Options
All
  • Public
  • Public/Protected
  • All
Menu

@pluginsdotdev/react-host

TODO: description

Usage

const reactHost = require('@pluginsdotdev/react-host');

// TODO: DEMONSTRATE API

Index

Type aliases

AnyReactComponent

AnyReactComponent: any

BaseEventConfig

BaseEventConfig: { eventOptions: { capture?: undefined | false | true; passive?: undefined | false | true }; eventType: string }

Type declaration

  • eventOptions: { capture?: undefined | false | true; passive?: undefined | false | true }
    • Optional capture?: undefined | false | true
    • Optional passive?: undefined | false | true
  • eventType: string

HostConfig

HostConfig: { scriptNonce?: undefined | string; styleNonce?: undefined | string }

Type declaration

  • Optional scriptNonce?: undefined | string
  • Optional styleNonce?: undefined | string

NodeComponentProps

NodeComponentProps: { cssVarBindings: Map<string, string>; exposedComponents?: Record<string, ComponentType>; hostConfig: HostConfig; hostId: HostId; isPluginRoot: boolean; node: Node | undefined; nodesById: Map<NodeId, Node>; pluginDomain: string; pluginPoint: string; pluginUrl: string }

Type declaration

  • cssVarBindings: Map<string, string>
  • Optional exposedComponents?: Record<string, ComponentType>
  • hostConfig: HostConfig
  • hostId: HostId
  • isPluginRoot: boolean
  • node: Node | undefined
  • nodesById: Map<NodeId, Node>
  • pluginDomain: string
  • pluginPoint: string
  • pluginUrl: string

NodeEventConfig

NodeEventConfig: BaseEventConfig & { handler: (this: HTMLElement, event: __type) => void }

RootNode

RootNode: Node & { cssVarBindings: Map<string, string>; nodesById: Map<NodeId, Node> }

Variables

Const ignoredProps

ignoredProps: Set<string> = new Set<string>(["currentTarget", "srcElement", "view"])

Const nodeIdByNode

nodeIdByNode: WeakMap<__type, string> = new WeakMap<EventTarget, NodeId>()

Const rootId

rootId: 0 = 0

Const syntheticEventSupers

syntheticEventSupers: ({ prop: string; spr: { constructor: any; prototype: __type } } | { prop: string; spr: { constructor: any; AT_TARGET: number; BUBBLING_PHASE: number; CAPTURING_PHASE: number; NONE: number; prototype: __type } })[] = [{ prop: "currentTarget", spr: EventTarget },{ prop: "nativeEvent", spr: Event },{ prop: "target", spr: EventTarget },]

Const syntheticEventTypes

syntheticEventTypes: { prop: string; type: string }[] = [{ prop: "bubbles", type: "boolean" },{ prop: "cancelable", type: "boolean" },{ prop: "defaultPrevented", type: "boolean" },{ prop: "eventPhase", type: "number" },{ prop: "isTrusted", type: "boolean" },{ prop: "preventDefault", type: "function" },{ prop: "isDefaultPrevented", type: "function" },{ prop: "stopPropagation", type: "function" },{ prop: "isPropagationStopped", type: "function" },{ prop: "persist", type: "function" },{ prop: "timeStamp", type: "number" },{ prop: "type", type: "string" },]

Const withShadowDOM

withShadowDOM: (arg: A) => R = memoized(withShadowDOMCache, (C: string) =>React.forwardRef<HTMLElement, any>(({ children, ...props }, ref) => {const shadowRef = useRef<HTMLElement>(null);const [root, setRoot] = useState<ShadowRoot | null>(null);useEffect(() => {const el = shadowRef.current;if (typeof ref === "function") {ref(el);} else if (ref) {ref.current = el;}if (!el || root) {return;}setRoot(el.attachShadow({ mode: "open" }));}, [root]);return React.createElement(C,{ ...props, ref: shadowRef },root? ReactDOM.createPortal(React.createElement(React.Fragment, {}, children),(root as any) as HTMLElement): null);}))

Type declaration

    • (arg: A): R
    • Parameters

      • arg: A

      Returns R

Const withShadowDOMCache

withShadowDOMCache: Record<string, AnyReactComponent>

Functions

Const NodeComponent

  • NodeComponent(__namedParameters: { cssVarBindings: Map<string, string>; exposedComponents: undefined | {}; hostConfig: { scriptNonce?: undefined | string; styleNonce?: undefined | string }; hostId: string; isPluginRoot: boolean; node: undefined | Node; nodesById: Map<string, Node>; pluginDomain: string; pluginPoint: string; pluginUrl: string }): null | ReactElement<{ nonce: undefined | string }, string | ((props: P) => ReactElement<any, any> | null) | {}> | DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>
  • Parameters

    • __namedParameters: { cssVarBindings: Map<string, string>; exposedComponents: undefined | {}; hostConfig: { scriptNonce?: undefined | string; styleNonce?: undefined | string }; hostId: string; isPluginRoot: boolean; node: undefined | Node; nodesById: Map<string, Node>; pluginDomain: string; pluginPoint: string; pluginUrl: string }
      • cssVarBindings: Map<string, string>
      • exposedComponents: undefined | {}
      • hostConfig: { scriptNonce?: undefined | string; styleNonce?: undefined | string }
        • Optional scriptNonce?: undefined | string
        • Optional styleNonce?: undefined | string
      • hostId: string
      • isPluginRoot: boolean
      • node: undefined | Node
      • nodesById: Map<string, Node>
      • pluginDomain: string
      • pluginPoint: string
      • pluginUrl: string

    Returns null | ReactElement<{ nonce: undefined | string }, string | ((props: P) => ReactElement<any, any> | null) | {}> | DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>

Const allKeys

  • allKeys(obj: object): Array<string>

Const applyUpdates

Const deleteDescendants

  • deleteDescendants(nodesById: Map<NodeId, Node>, saved: Set<NodeId>, id: NodeId): void

Const emptyRootNode

  • emptyRootNode(): { children: never[]; cssVarBindings: Map<string, string>; handlers: never[]; id: string; nodesById: Map<string, Node>; props: {}; type: string }
  • Returns { children: never[]; cssVarBindings: Map<string, string>; handlers: never[]; id: string; nodesById: Map<string, Node>; props: {}; type: string }

    • children: never[]
    • cssVarBindings: Map<string, string>
    • handlers: never[]
    • id: string
    • nodesById: Map<string, Node>
    • props: {}
    • type: string

Const eventConfigSetDiff

Const eventConfigsMatch

Const exhaustive

  • exhaustive(x: never): never

Const getProxyHandler

  • getProxyHandler(nodeIdByNode: WeakMap<__type, NodeId>): { toBridgeHandler: (...args: A) => R; type: string & { __TYPE__: K } }
  • Parameters

    • nodeIdByNode: WeakMap<__type, NodeId>

    Returns { toBridgeHandler: (...args: A) => R; type: string & { __TYPE__: K } }

    • toBridgeHandler: (...args: A) => R
        • (...args: A): R
        • Parameters

          • Rest ...args: A

          Returns R

    • type: string & { __TYPE__: K }

Const hostComponentName

  • hostComponentName(type: string): string

Const isEvent

  • isEvent(e: any): e is Event

Const isHostComponent

  • isHostComponent(type: string): boolean

Const isRootComponent

  • isRootComponent(type: string): boolean

Const isShadowComponent

  • isShadowComponent(type: string): boolean

Const isSyntheticEvent

  • isSyntheticEvent(e: any): e is SyntheticEvent

Const makeHandler

  • makeHandler(nodeId: NodeId, opts: EventOptions, handler: EventHandler): (Anonymous function)

Const memoized

  • memoized<A, R>(cache: Record<A, R>, fn: (arg: A) => R): (arg: A) => R
  • Type parameters

    • A: string | number

    • R

    Parameters

    • cache: Record<A, R>
    • fn: (arg: A) => R
        • (arg: A): R
        • Parameters

          • arg: A

          Returns R

    Returns (arg: A) => R

      • (arg: A): R
      • Parameters

        • arg: A

        Returns R

Const needShadowRoot

  • needShadowRoot(nodeType: string): boolean

Const proxyEventTarget

  • proxyEventTarget(nodeIdByNode: WeakMap<__type, NodeId>, val: __type): { checked: any; nodeId: undefined | string; selectedIndex: any; value: any }

Const realizeTree

  • realizeTree(nodesById: Map<NodeId, Node>, __namedParameters: { children: string[]; id: string; props: {}; text: undefined | string; type: string }): RealizedNode
  • Parameters

    • nodesById: Map<NodeId, Node>
    • __namedParameters: { children: string[]; id: string; props: {}; text: undefined | string; type: string }
      • children: string[]
      • id: string
      • props: {}
      • text: undefined | string
      • type: string

    Returns RealizedNode

Const resolveElement

  • resolveElement(exposedComponents: Record<string, ComponentType>, nodeType: string): React.ComponentType | string

Const shadowComponentName

  • shadowComponentName(type: string): string

Const toBridgeHandler

  • toBridgeHandler(nodeIdByNode: WeakMap<__type, NodeId>, proxyId: ProxyIdFactory, localState: LocalBridgeState, hostValue: HostValue): null | { proxyId: string & { __TYPE__: K }; replacementValue: object }
  • toBridgeHandler(_: ProxyIdFactory, localState: LocalBridgeState, hostValue: HostValue): null | { replacementValue: {} }

Const toSimpleObj

  • toSimpleObj(nodeIdByNode: WeakMap<__type, NodeId>, orig: {}): {}
  • toSimpleObj(orig: {}): {}

Const useCustomCanvasHydrator

  • useCustomCanvasHydrator(node: Node | undefined, ref: RefObject<Element>): void

Const useCustomHydrator

  • useCustomHydrator(node: Node | undefined, ref: RefObject<Element>): void

Const useEventHandlerWiring

  • useEventHandlerWiring(node: Node | undefined): RefObject<HTMLElement>

Object literals

Const proxyHandler

proxyHandler: object

toBridgeHandler

toBridgeHandler: toBridgeHandler

type

type: string & { __TYPE__: K } = "plugins.dev/SyntheticEvent" as ProxyType

Legend

  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method

Generated using TypeDoc