@mittwald/flow-remote-react-renderer 1.5.0-next.47 → 1.5.0-next.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (10) hide show
  1. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-core@1.7.0-mittwald.10_@preact_signals-core@1.14.2/node_modules/@mittwald/remote-dom-core/build/esm/connection.mjs.map +1 -1
  2. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-core@1.7.0-mittwald.10_@preact_signals-core@1.14.2/node_modules/@mittwald/remote-dom-core/build/esm/receivers/RemoteReceiver.mjs.map +1 -1
  3. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/RemoteRootRenderer.mjs.map +1 -1
  4. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/RemoteTextRenderer.mjs.map +1 -1
  5. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/component.mjs.map +1 -1
  6. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/constants.mjs.map +1 -1
  7. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/hooks/props-for-element.mjs.map +1 -1
  8. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/hooks/remote-received.mjs.map +1 -1
  9. package/dist/js/node_modules/.pnpm/@mittwald_remote-dom-react@1.2.2-mittwald.10_patch_hash_62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/node.mjs.map +1 -1
  10. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"connection.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-core@1.7.0-mittwald.10_@preact+signals-core@1.14.2/node_modules/@mittwald/remote-dom-core/build/esm/connection.mjs"],"sourcesContent":["import { MUTATION_TYPE_INSERT_CHILD, MUTATION_TYPE_REMOVE_CHILD, MUTATION_TYPE_UPDATE_TEXT, MUTATION_TYPE_UPDATE_PROPERTY } from './constants.mjs';\n\n/**\n * A helper for creating a `RemoteConnection` object. The `RemoteConnection`\n * protocol is pretty low-level; this function provides more human-friendly\n * naming on top of the protocol.\n */\nfunction createRemoteConnection({\n call,\n insertChild,\n removeChild,\n updateText,\n updateProperty\n}) {\n const handlers = {\n [MUTATION_TYPE_INSERT_CHILD]: insertChild,\n [MUTATION_TYPE_REMOVE_CHILD]: removeChild,\n [MUTATION_TYPE_UPDATE_TEXT]: updateText,\n [MUTATION_TYPE_UPDATE_PROPERTY]: updateProperty\n };\n return {\n call,\n mutate(records) {\n for (const [type, ...args] of records) {\n handlers[type](...args);\n }\n }\n };\n}\n\nexport { createRemoteConnection };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAOA,SAAS,uBAAuB,EAC9B,MACA,aACA,aACA,YACA,kBACC;CACD,MAAM,WAAW;GACe,IAAA;GACA,IAAA;GACD,IAAA;GACI,IAAA;CACnC;CACA,OAAO;EACL;EACA,OAAO,SAAS;GACd,KAAK,MAAM,CAAC,MAAM,GAAG,SAAS,SAC5B,SAAS,KAAK,CAAC,GAAG,IAAI;EAE1B;CACF;AACF"}
1
+ {"version":3,"file":"connection.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-core@1.7.0-mittwald.10_@preact+signals-core@1.14.2/node_modules/@mittwald/remote-dom-core/build/esm/connection.mjs"],"sourcesContent":["import { MUTATION_TYPE_INSERT_CHILD, MUTATION_TYPE_REMOVE_CHILD, MUTATION_TYPE_UPDATE_TEXT, MUTATION_TYPE_UPDATE_PROPERTY } from './constants.mjs';\n\n/**\n * A helper for creating a `RemoteConnection` object. The `RemoteConnection`\n * protocol is pretty low-level; this function provides more human-friendly\n * naming on top of the protocol.\n */\nfunction createRemoteConnection({\n call,\n insertChild,\n removeChild,\n updateText,\n updateProperty\n}) {\n const handlers = {\n [MUTATION_TYPE_INSERT_CHILD]: insertChild,\n [MUTATION_TYPE_REMOVE_CHILD]: removeChild,\n [MUTATION_TYPE_UPDATE_TEXT]: updateText,\n [MUTATION_TYPE_UPDATE_PROPERTY]: updateProperty\n };\n return {\n call,\n mutate(records) {\n for (const [type, ...args] of records) {\n handlers[type](...args);\n }\n }\n };\n}\n\nexport { createRemoteConnection };\n"],"ignoreList":[0],"mappings":";;;;;;;;AAOA,SAAS,uBAAuB,EAC9B,MACA,aACA,aACA,YACA,kBACC;CACD,MAAM,WAAW;GACe,IAAA;GACA,IAAA;GACD,IAAA;GACI,IAAA;CACnC;CACA,OAAO;EACL;EACA,OAAO,SAAS;GACd,KAAK,MAAM,CAAC,MAAM,GAAG,SAAS,SAC5B,SAAS,KAAK,CAAC,GAAG,IAAI;EAE1B;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteReceiver.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-core@1.7.0-mittwald.10_@preact+signals-core@1.14.2/node_modules/@mittwald/remote-dom-core/build/esm/receivers/RemoteReceiver.mjs"],"sourcesContent":["import { createRemoteConnection } from '../connection.mjs';\nimport { ROOT_ID, NODE_TYPE_ROOT, UPDATE_PROPERTY_TYPE_EVENT_LISTENER, UPDATE_PROPERTY_TYPE_ATTRIBUTE, UPDATE_PROPERTY_TYPE_PROPERTY, NODE_TYPE_ELEMENT, NODE_TYPE_COMMENT, NODE_TYPE_TEXT } from '../constants.mjs';\n\n/**\n * Represents a text node of a remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * node is updated.\n */\n\n/**\n * Represents a comment node of a remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * node is updated.\n */\n\n/**\n * Represents an element node of a remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * node is updated.\n */\n\n/**\n * Represents the root node of the remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * root is updated.\n */\n\n/**\n * Represents any node that can be stored in the host representation of the remote tree.\n */\n\n/**\n * Any node in the remote tree that can have children nodes.\n */\n\n/**\n * A `RemoteReceiver` stores remote elements into a basic JavaScript representation,\n * and allows subscribing to individual elements in the remote environment.\n * This can be useful for mapping remote elements to components in a JavaScript\n * framework; for example, the [`@remote-dom/react` library](https://github.com/Shopify/remote-dom/blob/main/packages/react#remoterenderer)\n * uses this receiver to map remote elements to React components.\n */\nclass RemoteReceiver {\n /**\n * Represents the root node of the remote tree. This node is always defined,\n * and you will likely be most interested in its `children` property, which\n * contains the top-level elements of the remote tree.\n */\n root = (() => ({\n id: ROOT_ID,\n type: NODE_TYPE_ROOT,\n children: [],\n version: 0,\n properties: {},\n attributes: {},\n eventListeners: {}\n }))();\n\n /**\n * An object that can synchronize a tree of elements between two JavaScript\n * environments. This object acts as a “thin waist”, allowing for efficient\n * communication of changes between a “remote” environment (usually, a JavaScript\n * sandbox, such as an `iframe` or Web Worker) and a “host” environment\n * (usually, a top-level browser page).\n */\n\n attached = (() => new Map([[ROOT_ID, this.root]]))();\n subscribers = (() => new Map())();\n parents = (() => new Map())();\n implementations = (() => new Map())();\n constructor({\n retain,\n release,\n methods\n } = {}) {\n const {\n attached,\n parents,\n subscribers\n } = this;\n this.connection = createRemoteConnection({\n call: (id, method, ...args) => {\n const implementation = this.implementations.get(id);\n const implementationMethod = implementation?.[method];\n if (typeof implementationMethod !== 'function') {\n throw new Error(`Node ${id} does not implement the ${method}() method`);\n }\n return implementationMethod(...args);\n },\n insertChild: (parentId, child, nextSiblingId) => {\n const parent = attached.get(parentId);\n const children = parent.children;\n if (children.some(existing => existing.id === child.id)) {\n return;\n }\n const normalizedChild = attach(child, parent);\n if (nextSiblingId === undefined) {\n children.push(normalizedChild);\n } else {\n const sibling = attached.get(nextSiblingId);\n children.splice(children.indexOf(sibling), 0, normalizedChild);\n }\n parent.version += 1;\n this.parents.set(child.id, parent.id);\n runSubscribers(parent);\n },\n removeChild: (parentId, id) => {\n const parent = attached.get(parentId);\n const children = parent.children;\n const node = attached.get(id);\n const index = parent.children.indexOf(node);\n const [removed] = children.splice(index, 1);\n if (!removed) {\n return;\n }\n parent.version += 1;\n runSubscribers(parent);\n detach(removed);\n },\n updateProperty: (id, property, value, type = UPDATE_PROPERTY_TYPE_PROPERTY) => {\n const element = attached.get(id);\n retain?.(value);\n let updateObject;\n switch (type) {\n case UPDATE_PROPERTY_TYPE_PROPERTY:\n updateObject = element.properties;\n break;\n case UPDATE_PROPERTY_TYPE_ATTRIBUTE:\n updateObject = element.attributes;\n break;\n case UPDATE_PROPERTY_TYPE_EVENT_LISTENER:\n updateObject = element.eventListeners;\n break;\n }\n const oldValue = updateObject[property];\n updateObject[property] = value;\n element.version += 1;\n let parentForUpdate;\n\n // If the slot changes, inform parent nodes so they can\n // re-parent it appropriately.\n if (property === 'slot') {\n const parentId = this.parents.get(id);\n parentForUpdate = parentId == null ? parentId : attached.get(parentId);\n if (parentForUpdate) {\n parentForUpdate.version += 1;\n }\n }\n runSubscribers(element);\n if (parentForUpdate) runSubscribers(parentForUpdate);\n release?.(oldValue);\n },\n updateText: (id, newText) => {\n const text = attached.get(id);\n text.data = newText;\n text.version += 1;\n runSubscribers(text);\n }\n });\n if (methods) this.implement(this.root, methods);\n function runSubscribers(attached) {\n const subscribed = subscribers.get(attached.id);\n if (subscribed) {\n for (const subscriber of subscribed) {\n subscriber(attached);\n }\n }\n }\n function attach(child, parent) {\n let normalizedChild;\n switch (child.type) {\n case NODE_TYPE_TEXT:\n case NODE_TYPE_COMMENT:\n {\n const {\n id,\n type,\n data\n } = child;\n normalizedChild = {\n id,\n type,\n data,\n version: 0\n };\n break;\n }\n case NODE_TYPE_ELEMENT:\n {\n const {\n id,\n type,\n element,\n children,\n properties,\n attributes,\n eventListeners\n } = child;\n retain?.(properties);\n retain?.(eventListeners);\n const resolvedChildren = [];\n normalizedChild = {\n id,\n type,\n element,\n version: 0,\n children: resolvedChildren,\n properties: {\n ...properties\n },\n attributes: {\n ...attributes\n },\n eventListeners: {\n ...eventListeners\n }\n };\n for (const grandChild of children) {\n resolvedChildren.push(attach(grandChild, normalizedChild));\n }\n break;\n }\n default:\n {\n throw new Error(`Unknown node type: ${JSON.stringify(child)}`);\n }\n }\n attached.set(normalizedChild.id, normalizedChild);\n parents.set(normalizedChild.id, parent.id);\n return normalizedChild;\n }\n function detach(child) {\n attached.delete(child.id);\n parents.delete(child.id);\n if (release) {\n if ('properties' in child) release(child.properties);\n if ('eventListeners' in child) release(child.eventListeners);\n }\n if ('children' in child) {\n for (const grandChild of child.children) {\n detach(grandChild);\n }\n }\n }\n }\n\n /**\n * Fetches the latest state of a remote element that has been\n * received from the remote environment.\n *\n * @param node The remote node to fetch.\n * @returns The current state of the remote node, or `undefined` if the node is not connected to the remote tree.\n *\n * @example\n * import {RemoteReceiver} from '@mittwald/remote-dom-core/receivers';\n *\n * const receiver = new RemoteReceiver();\n *\n * receiver.get(receiver.root) === receiver.root; // true\n */\n get({\n id\n }) {\n return this.attached.get(id);\n }\n\n /**\n * Lets you define how [remote methods](https://github.com/Shopify/remote-dom/blob/main/packages/core#remotemethods)\n * are implemented for a particular element in the tree.\n *\n * @param node The remote node to subscribe for changes.\n * @param implementation A record containing the methods to expose for the passed node.\n *\n * @example\n * // In the host environment:\n * import {RemoteReceiver} from '@mittwald/remote-dom-core/receivers';\n *\n * const receiver = new RemoteReceiver();\n *\n * receiver.implement(receiver.root, {\n * alert(message) {\n * window.alert(message);\n * },\n * });\n *\n * // In the remote environment:\n * import {RemoteRootElement} from '@mittwald/remote-dom-core/elements';\n *\n * customElements.define('remote-root', RemoteRootElement);\n *\n * const root = document.createElement('remote-root');\n * root.connect(receiver.connection);\n *\n * root.callRemoteMethod('alert', 'Hello, world!');\n */\n implement({\n id\n }, implementation) {\n if (implementation == null) {\n this.implementations.delete(id);\n } else {\n this.implementations.set(id, implementation);\n }\n }\n\n /**\n * Allows you to subscribe to changes in a remote element. This includes\n * changes to the remote element’s properties and list of children, but\n * note that you will not receive updates for properties or children of\n * _nested_ elements.\n *\n * @param node The remote node to subscribe for changes.\n * @param subscriber A function that will be called with the updated node on each change.\n *\n * @example\n * import {RemoteReceiver} from '@mittwald/remote-dom-core/receivers';\n *\n * const abort = new AbortController();\n * const receiver = new RemoteReceiver();\n *\n * // Subscribe to all changes in the top-level children, attached\n * // directly to the remote “root”.\n * receiver.subscribe(\n * receiver.root,\n * (root) => {\n * console.log('Root changed!', root);\n * },\n * {signal: abort.signal},\n * );\n */\n subscribe({\n id\n }, subscriber, {\n signal\n } = {}) {\n let subscribersSet = this.subscribers.get(id);\n if (subscribersSet == null) {\n subscribersSet = new Set();\n this.subscribers.set(id, subscribersSet);\n }\n subscribersSet.add(subscriber);\n signal?.addEventListener('abort', () => {\n subscribersSet.delete(subscriber);\n if (subscribersSet.size === 0) {\n this.subscribers.delete(id);\n }\n });\n }\n}\n\nexport { RemoteReceiver };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,iBAAN,MAAqB;;;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AAc;EACzC;EACA,eAAe,IAAI,UAAU;EAC7B,QAAQ,iBAAiB,eAAe;GACtC,eAAe,OAAO,UAAU;GAChC,IAAI,eAAe,SAAS,GAC1B,KAAK,YAAY,OAAO,EAAE;EAE9B,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"RemoteReceiver.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-core@1.7.0-mittwald.10_@preact+signals-core@1.14.2/node_modules/@mittwald/remote-dom-core/build/esm/receivers/RemoteReceiver.mjs"],"sourcesContent":["import { createRemoteConnection } from '../connection.mjs';\nimport { ROOT_ID, NODE_TYPE_ROOT, UPDATE_PROPERTY_TYPE_EVENT_LISTENER, UPDATE_PROPERTY_TYPE_ATTRIBUTE, UPDATE_PROPERTY_TYPE_PROPERTY, NODE_TYPE_ELEMENT, NODE_TYPE_COMMENT, NODE_TYPE_TEXT } from '../constants.mjs';\n\n/**\n * Represents a text node of a remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * node is updated.\n */\n\n/**\n * Represents a comment node of a remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * node is updated.\n */\n\n/**\n * Represents an element node of a remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * node is updated.\n */\n\n/**\n * Represents the root node of the remote tree in a plain JavaScript format, with\n * the addition of a `version` property that is incremented whenever the\n * root is updated.\n */\n\n/**\n * Represents any node that can be stored in the host representation of the remote tree.\n */\n\n/**\n * Any node in the remote tree that can have children nodes.\n */\n\n/**\n * A `RemoteReceiver` stores remote elements into a basic JavaScript representation,\n * and allows subscribing to individual elements in the remote environment.\n * This can be useful for mapping remote elements to components in a JavaScript\n * framework; for example, the [`@remote-dom/react` library](https://github.com/Shopify/remote-dom/blob/main/packages/react#remoterenderer)\n * uses this receiver to map remote elements to React components.\n */\nclass RemoteReceiver {\n /**\n * Represents the root node of the remote tree. This node is always defined,\n * and you will likely be most interested in its `children` property, which\n * contains the top-level elements of the remote tree.\n */\n root = (() => ({\n id: ROOT_ID,\n type: NODE_TYPE_ROOT,\n children: [],\n version: 0,\n properties: {},\n attributes: {},\n eventListeners: {}\n }))();\n\n /**\n * An object that can synchronize a tree of elements between two JavaScript\n * environments. This object acts as a “thin waist”, allowing for efficient\n * communication of changes between a “remote” environment (usually, a JavaScript\n * sandbox, such as an `iframe` or Web Worker) and a “host” environment\n * (usually, a top-level browser page).\n */\n\n attached = (() => new Map([[ROOT_ID, this.root]]))();\n subscribers = (() => new Map())();\n parents = (() => new Map())();\n implementations = (() => new Map())();\n constructor({\n retain,\n release,\n methods\n } = {}) {\n const {\n attached,\n parents,\n subscribers\n } = this;\n this.connection = createRemoteConnection({\n call: (id, method, ...args) => {\n const implementation = this.implementations.get(id);\n const implementationMethod = implementation?.[method];\n if (typeof implementationMethod !== 'function') {\n throw new Error(`Node ${id} does not implement the ${method}() method`);\n }\n return implementationMethod(...args);\n },\n insertChild: (parentId, child, nextSiblingId) => {\n const parent = attached.get(parentId);\n const children = parent.children;\n if (children.some(existing => existing.id === child.id)) {\n return;\n }\n const normalizedChild = attach(child, parent);\n if (nextSiblingId === undefined) {\n children.push(normalizedChild);\n } else {\n const sibling = attached.get(nextSiblingId);\n children.splice(children.indexOf(sibling), 0, normalizedChild);\n }\n parent.version += 1;\n this.parents.set(child.id, parent.id);\n runSubscribers(parent);\n },\n removeChild: (parentId, id) => {\n const parent = attached.get(parentId);\n const children = parent.children;\n const node = attached.get(id);\n const index = parent.children.indexOf(node);\n const [removed] = children.splice(index, 1);\n if (!removed) {\n return;\n }\n parent.version += 1;\n runSubscribers(parent);\n detach(removed);\n },\n updateProperty: (id, property, value, type = UPDATE_PROPERTY_TYPE_PROPERTY) => {\n const element = attached.get(id);\n retain?.(value);\n let updateObject;\n switch (type) {\n case UPDATE_PROPERTY_TYPE_PROPERTY:\n updateObject = element.properties;\n break;\n case UPDATE_PROPERTY_TYPE_ATTRIBUTE:\n updateObject = element.attributes;\n break;\n case UPDATE_PROPERTY_TYPE_EVENT_LISTENER:\n updateObject = element.eventListeners;\n break;\n }\n const oldValue = updateObject[property];\n updateObject[property] = value;\n element.version += 1;\n let parentForUpdate;\n\n // If the slot changes, inform parent nodes so they can\n // re-parent it appropriately.\n if (property === 'slot') {\n const parentId = this.parents.get(id);\n parentForUpdate = parentId == null ? parentId : attached.get(parentId);\n if (parentForUpdate) {\n parentForUpdate.version += 1;\n }\n }\n runSubscribers(element);\n if (parentForUpdate) runSubscribers(parentForUpdate);\n release?.(oldValue);\n },\n updateText: (id, newText) => {\n const text = attached.get(id);\n text.data = newText;\n text.version += 1;\n runSubscribers(text);\n }\n });\n if (methods) this.implement(this.root, methods);\n function runSubscribers(attached) {\n const subscribed = subscribers.get(attached.id);\n if (subscribed) {\n for (const subscriber of subscribed) {\n subscriber(attached);\n }\n }\n }\n function attach(child, parent) {\n let normalizedChild;\n switch (child.type) {\n case NODE_TYPE_TEXT:\n case NODE_TYPE_COMMENT:\n {\n const {\n id,\n type,\n data\n } = child;\n normalizedChild = {\n id,\n type,\n data,\n version: 0\n };\n break;\n }\n case NODE_TYPE_ELEMENT:\n {\n const {\n id,\n type,\n element,\n children,\n properties,\n attributes,\n eventListeners\n } = child;\n retain?.(properties);\n retain?.(eventListeners);\n const resolvedChildren = [];\n normalizedChild = {\n id,\n type,\n element,\n version: 0,\n children: resolvedChildren,\n properties: {\n ...properties\n },\n attributes: {\n ...attributes\n },\n eventListeners: {\n ...eventListeners\n }\n };\n for (const grandChild of children) {\n resolvedChildren.push(attach(grandChild, normalizedChild));\n }\n break;\n }\n default:\n {\n throw new Error(`Unknown node type: ${JSON.stringify(child)}`);\n }\n }\n attached.set(normalizedChild.id, normalizedChild);\n parents.set(normalizedChild.id, parent.id);\n return normalizedChild;\n }\n function detach(child) {\n attached.delete(child.id);\n parents.delete(child.id);\n if (release) {\n if ('properties' in child) release(child.properties);\n if ('eventListeners' in child) release(child.eventListeners);\n }\n if ('children' in child) {\n for (const grandChild of child.children) {\n detach(grandChild);\n }\n }\n }\n }\n\n /**\n * Fetches the latest state of a remote element that has been\n * received from the remote environment.\n *\n * @param node The remote node to fetch.\n * @returns The current state of the remote node, or `undefined` if the node is not connected to the remote tree.\n *\n * @example\n * import {RemoteReceiver} from '@mittwald/remote-dom-core/receivers';\n *\n * const receiver = new RemoteReceiver();\n *\n * receiver.get(receiver.root) === receiver.root; // true\n */\n get({\n id\n }) {\n return this.attached.get(id);\n }\n\n /**\n * Lets you define how [remote methods](https://github.com/Shopify/remote-dom/blob/main/packages/core#remotemethods)\n * are implemented for a particular element in the tree.\n *\n * @param node The remote node to subscribe for changes.\n * @param implementation A record containing the methods to expose for the passed node.\n *\n * @example\n * // In the host environment:\n * import {RemoteReceiver} from '@mittwald/remote-dom-core/receivers';\n *\n * const receiver = new RemoteReceiver();\n *\n * receiver.implement(receiver.root, {\n * alert(message) {\n * window.alert(message);\n * },\n * });\n *\n * // In the remote environment:\n * import {RemoteRootElement} from '@mittwald/remote-dom-core/elements';\n *\n * customElements.define('remote-root', RemoteRootElement);\n *\n * const root = document.createElement('remote-root');\n * root.connect(receiver.connection);\n *\n * root.callRemoteMethod('alert', 'Hello, world!');\n */\n implement({\n id\n }, implementation) {\n if (implementation == null) {\n this.implementations.delete(id);\n } else {\n this.implementations.set(id, implementation);\n }\n }\n\n /**\n * Allows you to subscribe to changes in a remote element. This includes\n * changes to the remote element’s properties and list of children, but\n * note that you will not receive updates for properties or children of\n * _nested_ elements.\n *\n * @param node The remote node to subscribe for changes.\n * @param subscriber A function that will be called with the updated node on each change.\n *\n * @example\n * import {RemoteReceiver} from '@mittwald/remote-dom-core/receivers';\n *\n * const abort = new AbortController();\n * const receiver = new RemoteReceiver();\n *\n * // Subscribe to all changes in the top-level children, attached\n * // directly to the remote “root”.\n * receiver.subscribe(\n * receiver.root,\n * (root) => {\n * console.log('Root changed!', root);\n * },\n * {signal: abort.signal},\n * );\n */\n subscribe({\n id\n }, subscriber, {\n signal\n } = {}) {\n let subscribersSet = this.subscribers.get(id);\n if (subscribersSet == null) {\n subscribersSet = new Set();\n this.subscribers.set(id, subscribersSet);\n }\n subscribersSet.add(subscriber);\n signal?.addEventListener('abort', () => {\n subscribersSet.delete(subscriber);\n if (subscribersSet.size === 0) {\n this.subscribers.delete(id);\n }\n });\n }\n}\n\nexport { RemoteReceiver };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,iBAAN,MAAqB;;;;;;CAMnB,eAAe;EACb,IAAA;EACA,MAAA;EACA,UAAU,CAAC;EACX,SAAS;EACT,YAAY,CAAC;EACb,YAAY,CAAC;EACb,gBAAgB,CAAC;CACnB,GAAA,CAAI;;;;;;;;CAUJ,kCAAkB,IAAI,IAAI,CAAC,CAAA,KAAU,KAAK,IAAI,CAAC,CAAC,EAAA,CAAG;CACnD,qCAAqB,IAAI,IAAI,EAAA,CAAG;CAChC,iCAAiB,IAAI,IAAI,EAAA,CAAG;CAC5B,yCAAyB,IAAI,IAAI,EAAA,CAAG;CACpC,YAAY,EACV,QACA,SACA,YACE,CAAC,GAAG;EACN,MAAM,EACJ,UACA,SACA,gBACE;EACJ,KAAK,aAAa,uBAAuB;GACvC,OAAO,IAAI,QAAQ,GAAG,SAAS;IAE7B,MAAM,uBADiB,KAAK,gBAAgB,IAAI,EACN,CAAC,GAAG;IAC9C,IAAI,OAAO,yBAAyB,YAClC,MAAM,IAAI,MAAM,QAAQ,GAAG,0BAA0B,OAAO,UAAU;IAExE,OAAO,qBAAqB,GAAG,IAAI;GACrC;GACA,cAAc,UAAU,OAAO,kBAAkB;IAC/C,MAAM,SAAS,SAAS,IAAI,QAAQ;IACpC,MAAM,WAAW,OAAO;IACxB,IAAI,SAAS,MAAK,aAAY,SAAS,OAAO,MAAM,EAAE,GACpD;IAEF,MAAM,kBAAkB,OAAO,OAAO,MAAM;IAC5C,IAAI,kBAAkB,KAAA,GACpB,SAAS,KAAK,eAAe;SACxB;K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AgB;EACjB,IAAI,kBAAkB,MACpB,KAAK,gBAAgB,OAAO,EAAE;OAE9B,KAAK,gBAAgB,IAAI,IAAI,cAAc;CAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,UAAU,EACR,MACC,YAAY,EACb,WACE,CAAC,GAAG;EACN,IAAI,iBAAiB,KAAK,YAAY,IAAI,EAAE;EAC5C,IAAI,kBAAkB,MAAM;GAC1B,iCAAiB,IAAI,IAAI;GACzB,KAAK,YAAY,IAAI,IAAI,cAAc;EACzC;EACA,eAAe,IAAI,UAAU;EAC7B,QAAQ,iBAAiB,eAAe;GACtC,eAAe,OAAO,UAAU;GAChC,IAAI,eAAe,SAAS,GAC1B,KAAK,YAAY,OAAO,EAAE;EAE9B,CAAC;CACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteRootRenderer.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/RemoteRootRenderer.mjs"],"sourcesContent":["import { useRemoteReceived } from './hooks/remote-received.mjs';\nimport { renderRemoteNode } from './node.mjs';\nimport { jsx, Fragment } from 'react/jsx-runtime';\n\n/**\n * A component that can be used to render a tree of UI elements from a remote\n * environment.\n */\nfunction RemoteRootRenderer(props) {\n const {\n receiver\n } = props;\n const {\n children\n } = useRemoteReceived(receiver.root, receiver);\n return /*#__PURE__*/jsx(Fragment, {\n children: children.map(child => renderRemoteNode(child, props))\n });\n}\n\nexport { RemoteRootRenderer };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAQA,SAAS,mBAAmB,OAAO;CACjC,MAAM,EACJ,aACE;CACJ,MAAM,EACJ,aACE,kBAAkB,SAAS,MAAM,QAAQ;CAC7C,OAAoB,kBAAI,UAAU,EAChC,UAAU,SAAS,KAAI,UAAS,iBAAiB,OAAO,KAAK,CAAC,EAChE,CAAC;AACH"}
1
+ {"version":3,"file":"RemoteRootRenderer.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/RemoteRootRenderer.mjs"],"sourcesContent":["import { useRemoteReceived } from './hooks/remote-received.mjs';\nimport { renderRemoteNode } from './node.mjs';\nimport { jsx, Fragment } from 'react/jsx-runtime';\n\n/**\n * A component that can be used to render a tree of UI elements from a remote\n * environment.\n */\nfunction RemoteRootRenderer(props) {\n const {\n receiver\n } = props;\n const {\n children\n } = useRemoteReceived(receiver.root, receiver);\n return /*#__PURE__*/jsx(Fragment, {\n children: children.map(child => renderRemoteNode(child, props))\n });\n}\n\nexport { RemoteRootRenderer };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;AAQA,SAAS,mBAAmB,OAAO;CACjC,MAAM,EACJ,aACE;CACJ,MAAM,EACJ,aACE,kBAAkB,SAAS,MAAM,QAAQ;CAC7C,OAAoB,kBAAI,UAAU,EAChC,UAAU,SAAS,KAAI,UAAS,iBAAiB,OAAO,KAAK,CAAC,EAChE,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteTextRenderer.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/RemoteTextRenderer.mjs"],"sourcesContent":["import { useRemoteReceived } from './hooks/remote-received.mjs';\nimport { jsx, Fragment } from 'react/jsx-runtime';\n\n/**\n * Renders a remote React element to the host using React.\n */\nfunction RemoteTextRenderer({\n remote,\n receiver\n}) {\n const text = useRemoteReceived(remote, receiver);\n return text ? /*#__PURE__*/jsx(Fragment, {\n children: text.data\n }) : null;\n}\n\nexport { RemoteTextRenderer };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAMA,SAAS,mBAAmB,EAC1B,QACA,YACC;CACD,MAAM,OAAO,kBAAkB,QAAQ,QAAQ;CAC/C,OAAO,OAAoB,kBAAI,UAAU,EACvC,UAAU,KAAK,KACjB,CAAC,IAAI;AACP"}
1
+ {"version":3,"file":"RemoteTextRenderer.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/RemoteTextRenderer.mjs"],"sourcesContent":["import { useRemoteReceived } from './hooks/remote-received.mjs';\nimport { jsx, Fragment } from 'react/jsx-runtime';\n\n/**\n * Renders a remote React element to the host using React.\n */\nfunction RemoteTextRenderer({\n remote,\n receiver\n}) {\n const text = useRemoteReceived(remote, receiver);\n return text ? /*#__PURE__*/jsx(Fragment, {\n children: text.data\n }) : null;\n}\n\nexport { RemoteTextRenderer };\n"],"ignoreList":[0],"mappings":";;;;;;;;AAMA,SAAS,mBAAmB,EAC1B,QACA,YACC;CACD,MAAM,OAAO,kBAAkB,QAAQ,QAAQ;CAC/C,OAAO,OAAoB,kBAAI,UAAU,EACvC,UAAU,KAAK,KACjB,CAAC,IAAI;AACP"}
@@ -1 +1 @@
1
- {"version":3,"file":"component.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/component.mjs"],"sourcesContent":["import { memo, useRef, useEffect } from 'react';\nimport { useRemoteReceived } from './hooks/remote-received.mjs';\nimport { usePropsForRemoteElement } from './hooks/props-for-element.mjs';\nimport { REMOTE_ELEMENT_PROP, REMOTE_ELEMENT_ATTACHED_PROP } from './constants.mjs';\nimport { jsx } from 'react/jsx-runtime';\n\n/**\n * Takes a React component, and returns a new component that can be used to render that\n * component from a remote element. This wrapper will handle subscribing to changes in that\n * element, and will normalize the properties on that remote element before passing them\n * to your React component.\n */\nfunction createRemoteComponentRenderer(Component, {\n name,\n eventProps\n} = {}) {\n const RemoteComponentRenderer = /*#__PURE__*/memo(function RemoteComponentRenderer({\n element,\n receiver,\n components\n }) {\n const internalsRef = useRef();\n const attachedElement = useRemoteReceived(element, receiver);\n const resolvedElement = attachedElement ?? element;\n const resolvedId = resolvedElement.id;\n const props = usePropsForRemoteElement(resolvedElement, {\n receiver,\n components,\n eventProps\n });\n props[REMOTE_ELEMENT_PROP] = resolvedElement;\n props[REMOTE_ELEMENT_ATTACHED_PROP] = attachedElement != null;\n if (internalsRef.current == null) {\n const internals = {\n id: resolvedId,\n receiver\n };\n internals.instanceRef = createImplementationRef(internals);\n internalsRef.current = internals;\n }\n internalsRef.current.id = resolvedId;\n internalsRef.current.receiver = receiver;\n useEffect(() => {\n const node = {\n id: resolvedId\n };\n receiver.implement(node, internalsRef.current?.instanceRef.current);\n return () => {\n receiver.implement(node, null);\n };\n }, [resolvedId, receiver]);\n return /*#__PURE__*/jsx(Component, {\n ref: internalsRef.current.instanceRef,\n ...props\n });\n });\n RemoteComponentRenderer.displayName = name ?? `RemoteComponentRenderer(${Component.displayName ?? Component.name ?? 'Component'})`;\n return RemoteComponentRenderer;\n}\nfunction createImplementationRef(internals) {\n let current = null;\n return {\n get current() {\n return current;\n },\n set current(implementation) {\n current = implementation;\n internals.receiver.implement(internals, implementation);\n }\n };\n}\n\nexport { createRemoteComponentRenderer };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;AAYA,SAAS,8BAA8B,WAAW,EAChD,MACA,eACE,CAAC,GAAG;CACN,MAAM,0BAAuC,mBAAK,SAAS,wBAAwB,EACjF,SACA,UACA,cACC;EACD,MAAM,eAAe,OAAO;EAC5B,MAAM,kBAAkB,kBAAkB,SAAS,QAAQ;EAC3D,MAAM,kBAAkB,mBAAmB;EAC3C,MAAM,aAAa,gBAAgB;EACnC,MAAM,QAAQ,yBAAyB,iBAAiB;GACtD;GACA;GACA;EACF,CAAC;EACD,MAAM,uBAAuB;EAC7B,MAAM,gCAAgC,mBAAmB;EACzD,IAAI,aAAa,WAAW,MAAM;GAChC,MAAM,YAAY;IAChB,IAAI;IACJ;GACF;GACA,UAAU,cAAc,wBAAwB,SAAS;GACzD,aAAa,UAAU;EACzB;EACA,aAAa,QAAQ,KAAK;EAC1B,aAAa,QAAQ,WAAW;EAChC,gBAAgB;GACd,MAAM,OAAO,EACX,IAAI,WACN;GACA,SAAS,UAAU,MAAM,aAAa,SAAS,YAAY,OAAO;GAClE,aAAa;IACX,SAAS,UAAU,MAAM,IAAI;GAC/B;EACF,GAAG,CAAC,YAAY,QAAQ,CAAC;EACzB,OAAoB,kBAAI,WAAW;GACjC,KAAK,aAAa,QAAQ;GAC1B,GAAG;EACL,CAAC;CACH,CAAC;CACD,wBAAwB,cAAc,QAAQ,2BAA2B,UAAU,eAAe,UAAU,QAAQ,YAAY;CAChI,OAAO;AACT;AACA,SAAS,wBAAwB,WAAW;CAC1C,IAAI,UAAU;CACd,OAAO;EACL,IAAI,UAAU;GACZ,OAAO;EACT;EACA,IAAI,QAAQ,gBAAgB;GAC1B,UAAU;GACV,UAAU,SAAS,UAAU,WAAW,cAAc;EACxD;CACF;AACF"}
1
+ {"version":3,"file":"component.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/component.mjs"],"sourcesContent":["import { memo, useRef, useEffect } from 'react';\nimport { useRemoteReceived } from './hooks/remote-received.mjs';\nimport { usePropsForRemoteElement } from './hooks/props-for-element.mjs';\nimport { REMOTE_ELEMENT_PROP, REMOTE_ELEMENT_ATTACHED_PROP } from './constants.mjs';\nimport { jsx } from 'react/jsx-runtime';\n\n/**\n * Takes a React component, and returns a new component that can be used to render that\n * component from a remote element. This wrapper will handle subscribing to changes in that\n * element, and will normalize the properties on that remote element before passing them\n * to your React component.\n */\nfunction createRemoteComponentRenderer(Component, {\n name,\n eventProps\n} = {}) {\n const RemoteComponentRenderer = /*#__PURE__*/memo(function RemoteComponentRenderer({\n element,\n receiver,\n components\n }) {\n const internalsRef = useRef();\n const attachedElement = useRemoteReceived(element, receiver);\n const resolvedElement = attachedElement ?? element;\n const resolvedId = resolvedElement.id;\n const props = usePropsForRemoteElement(resolvedElement, {\n receiver,\n components,\n eventProps\n });\n props[REMOTE_ELEMENT_PROP] = resolvedElement;\n props[REMOTE_ELEMENT_ATTACHED_PROP] = attachedElement != null;\n if (internalsRef.current == null) {\n const internals = {\n id: resolvedId,\n receiver\n };\n internals.instanceRef = createImplementationRef(internals);\n internalsRef.current = internals;\n }\n internalsRef.current.id = resolvedId;\n internalsRef.current.receiver = receiver;\n useEffect(() => {\n const node = {\n id: resolvedId\n };\n receiver.implement(node, internalsRef.current?.instanceRef.current);\n return () => {\n receiver.implement(node, null);\n };\n }, [resolvedId, receiver]);\n return /*#__PURE__*/jsx(Component, {\n ref: internalsRef.current.instanceRef,\n ...props\n });\n });\n RemoteComponentRenderer.displayName = name ?? `RemoteComponentRenderer(${Component.displayName ?? Component.name ?? 'Component'})`;\n return RemoteComponentRenderer;\n}\nfunction createImplementationRef(internals) {\n let current = null;\n return {\n get current() {\n return current;\n },\n set current(implementation) {\n current = implementation;\n internals.receiver.implement(internals, implementation);\n }\n };\n}\n\nexport { createRemoteComponentRenderer };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;AAYA,SAAS,8BAA8B,WAAW,EAChD,MACA,eACE,CAAC,GAAG;CACN,MAAM,0BAAuC,mBAAK,SAAS,wBAAwB,EACjF,SACA,UACA,cACC;EACD,MAAM,eAAe,OAAO;EAC5B,MAAM,kBAAkB,kBAAkB,SAAS,QAAQ;EAC3D,MAAM,kBAAkB,mBAAmB;EAC3C,MAAM,aAAa,gBAAgB;EACnC,MAAM,QAAQ,yBAAyB,iBAAiB;GACtD;GACA;GACA;EACF,CAAC;EACD,MAAM,uBAAuB;EAC7B,MAAM,gCAAgC,mBAAmB;EACzD,IAAI,aAAa,WAAW,MAAM;GAChC,MAAM,YAAY;IAChB,IAAI;IACJ;GACF;GACA,UAAU,cAAc,wBAAwB,SAAS;GACzD,aAAa,UAAU;EACzB;EACA,aAAa,QAAQ,KAAK;EAC1B,aAAa,QAAQ,WAAW;EAChC,gBAAgB;GACd,MAAM,OAAO,EACX,IAAI,WACN;GACA,SAAS,UAAU,MAAM,aAAa,SAAS,YAAY,OAAO;GAClE,aAAa;IACX,SAAS,UAAU,MAAM,IAAI;GAC/B;EACF,GAAG,CAAC,YAAY,QAAQ,CAAC;EACzB,OAAoB,kBAAI,WAAW;GACjC,KAAK,aAAa,QAAQ;GAC1B,GAAG;EACL,CAAC;CACH,CAAC;CACD,wBAAwB,cAAc,QAAQ,2BAA2B,UAAU,eAAe,UAAU,QAAQ,YAAY;CAChI,OAAO;AACT;AACA,SAAS,wBAAwB,WAAW;CAC1C,IAAI,UAAU;CACd,OAAO;EACL,IAAI,UAAU;GACZ,OAAO;EACT;EACA,IAAI,QAAQ,gBAAgB;GAC1B,UAAU;GACV,UAAU,SAAS,UAAU,WAAW,cAAc;EACxD;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/constants.mjs"],"sourcesContent":["/**\n * The property name used to pass a remote element instance to the React component\n * that is configured to render it.\n */\nconst REMOTE_ELEMENT_PROP = Symbol.for('remote-dom.element');\nconst REMOTE_ELEMENT_ATTACHED_PROP = Symbol.for('remote-dom.element.attached');\n\nexport { REMOTE_ELEMENT_ATTACHED_PROP, REMOTE_ELEMENT_PROP };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAIA,IAAM,sBAAsB,OAAO,IAAI,oBAAoB;AAC3D,IAAM,+BAA+B,OAAO,IAAI,6BAA6B"}
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/constants.mjs"],"sourcesContent":["/**\n * The property name used to pass a remote element instance to the React component\n * that is configured to render it.\n */\nconst REMOTE_ELEMENT_PROP = Symbol.for('remote-dom.element');\nconst REMOTE_ELEMENT_ATTACHED_PROP = Symbol.for('remote-dom.element.attached');\n\nexport { REMOTE_ELEMENT_ATTACHED_PROP, REMOTE_ELEMENT_PROP };\n"],"ignoreList":[0],"mappings":";;;;;;;AAIA,IAAM,sBAAsB,OAAO,IAAI,oBAAoB;AAC3D,IAAM,+BAA+B,OAAO,IAAI,6BAA6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"props-for-element.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/hooks/props-for-element.mjs"],"sourcesContent":["import { renderRemoteNode } from '../node.mjs';\nimport { jsxs, Fragment } from 'react/jsx-runtime';\n\nfunction usePropsForRemoteElement(element, options) {\n if (!element) return undefined;\n const {\n children,\n properties,\n attributes,\n eventListeners\n } = element;\n const reactChildren = [];\n const resolvedProperties = {\n ...properties,\n ...attributes,\n children: reactChildren\n };\n if (options.eventProps) {\n for (const [prop, eventDescription] of Object.entries(options.eventProps)) {\n const eventName = eventDescription?.event;\n if (eventName == null) continue;\n const listener = eventListeners[eventName];\n if (listener) {\n resolvedProperties[prop] = wrapEventListenerForCallback(listener);\n }\n }\n } else {\n // Assume all event listeners are allowed, and write each one as a conventional\n // Preact callback prop.\n for (const [eventName, listener] of Object.entries(eventListeners)) {\n // A removed listener reaches the host as an update to `undefined`,\n // because RemoteReceiver assigns rather than deletes, so the key\n // outlives it. Wrapping that installs a callable prop that throws\n // when the event fires.\n if (!listener) continue;\n resolvedProperties[`on${eventName[0].toUpperCase()}${eventName.slice(1)}`] = wrapEventListenerForCallback(listener);\n }\n }\n for (const child of children) {\n if (child.type === 1 && typeof child.attributes.slot === 'string') {\n const slot = child.attributes.slot;\n const rendered = renderRemoteNode(child, options);\n resolvedProperties[slot] = resolvedProperties[slot] ? /*#__PURE__*/jsxs(Fragment, {\n children: [resolvedProperties[slot], rendered]\n }) : rendered;\n } else {\n reactChildren.push(renderRemoteNode(child, options));\n }\n }\n // Pass no children rather than `[]`, so the component sees `undefined`\n // as it does when rendered locally.\n if (reactChildren.length === 0) delete resolvedProperties.children;\n return resolvedProperties;\n}\nfunction wrapEventListenerForCallback(listener) {\n return function eventListenerCallbackWrapper(...args) {\n if (args.length === 1 && args[0] instanceof Event) {\n const event = args[0];\n if (event.target !== event.currentTarget) return;\n return 'detail' in event ? listener(event.detail) : listener();\n }\n return listener(...args);\n };\n}\n\nexport { usePropsForRemoteElement };\n"],"x_google_ignoreList":[0],"mappings":";;;;;AAGA,SAAS,yBAAyB,SAAS,SAAS;CAClD,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,MAAM,EACJ,UACA,YACA,YACA,mBACE;CACJ,MAAM,gBAAgB,CAAC;CACvB,MAAM,qBAAqB;EACzB,GAAG;EACH,GAAG;EACH,UAAU;CACZ;CACA,IAAI,QAAQ,YACV,KAAK,MAAM,CAAC,MAAM,qBAAqB,OAAO,QAAQ,QAAQ,UAAU,GAAG;EACzE,MAAM,YAAY,kBAAkB;EACpC,IAAI,aAAa,MAAM;EACvB,MAAM,WAAW,eAAe;EAChC,IAAI,UACF,mBAAmB,QAAQ,6BAA6B,QAAQ;CAEpE;MAIA,KAAK,MAAM,CAAC,WAAW,aAAa,OAAO,QAAQ,cAAc,GAAG;EAKlE,IAAI,CAAC,UAAU;EACf,mBAAmB,KAAK,UAAU,EAAE,CAAC,YAAY,IAAI,UAAU,MAAM,CAAC,OAAO,6BAA6B,QAAQ;CACpH;CAEF,KAAK,MAAM,SAAS,UAClB,IAAI,MAAM,SAAS,KAAK,OAAO,MAAM,WAAW,SAAS,UAAU;EACjE,MAAM,OAAO,MAAM,WAAW;EAC9B,MAAM,WAAW,iBAAiB,OAAO,OAAO;EAChD,mBAAmB,QAAQ,mBAAmB,QAAqB,mBAAK,UAAU,EAChF,UAAU,CAAC,mBAAmB,OAAO,QAAQ,EAC/C,CAAC,IAAI;CACP,OACE,cAAc,KAAK,iBAAiB,OAAO,OAAO,CAAC;CAKvD,IAAI,cAAc,WAAW,GAAG,OAAO,mBAAmB;CAC1D,OAAO;AACT;AACA,SAAS,6BAA6B,UAAU;CAC9C,OAAO,SAAS,6BAA6B,GAAG,MAAM;EACpD,IAAI,KAAK,WAAW,KAAK,KAAK,cAAc,OAAO;GACjD,MAAM,QAAQ,KAAK;GACnB,IAAI,MAAM,WAAW,MAAM,eAAe;GAC1C,OAAO,YAAY,QAAQ,SAAS,MAAM,MAAM,IAAI,SAAS;EAC/D;EACA,OAAO,SAAS,GAAG,IAAI;CACzB;AACF"}
1
+ {"version":3,"file":"props-for-element.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/hooks/props-for-element.mjs"],"sourcesContent":["import { renderRemoteNode } from '../node.mjs';\nimport { jsxs, Fragment } from 'react/jsx-runtime';\n\nfunction usePropsForRemoteElement(element, options) {\n if (!element) return undefined;\n const {\n children,\n properties,\n attributes,\n eventListeners\n } = element;\n const reactChildren = [];\n const resolvedProperties = {\n ...properties,\n ...attributes,\n children: reactChildren\n };\n if (options.eventProps) {\n for (const [prop, eventDescription] of Object.entries(options.eventProps)) {\n const eventName = eventDescription?.event;\n if (eventName == null) continue;\n const listener = eventListeners[eventName];\n if (listener) {\n resolvedProperties[prop] = wrapEventListenerForCallback(listener);\n }\n }\n } else {\n // Assume all event listeners are allowed, and write each one as a conventional\n // Preact callback prop.\n for (const [eventName, listener] of Object.entries(eventListeners)) {\n // A removed listener reaches the host as an update to `undefined`,\n // because RemoteReceiver assigns rather than deletes, so the key\n // outlives it. Wrapping that installs a callable prop that throws\n // when the event fires.\n if (!listener) continue;\n resolvedProperties[`on${eventName[0].toUpperCase()}${eventName.slice(1)}`] = wrapEventListenerForCallback(listener);\n }\n }\n for (const child of children) {\n if (child.type === 1 && typeof child.attributes.slot === 'string') {\n const slot = child.attributes.slot;\n const rendered = renderRemoteNode(child, options);\n resolvedProperties[slot] = resolvedProperties[slot] ? /*#__PURE__*/jsxs(Fragment, {\n children: [resolvedProperties[slot], rendered]\n }) : rendered;\n } else {\n reactChildren.push(renderRemoteNode(child, options));\n }\n }\n // Pass no children rather than `[]`, so the component sees `undefined`\n // as it does when rendered locally.\n if (reactChildren.length === 0) delete resolvedProperties.children;\n return resolvedProperties;\n}\nfunction wrapEventListenerForCallback(listener) {\n return function eventListenerCallbackWrapper(...args) {\n if (args.length === 1 && args[0] instanceof Event) {\n const event = args[0];\n if (event.target !== event.currentTarget) return;\n return 'detail' in event ? listener(event.detail) : listener();\n }\n return listener(...args);\n };\n}\n\nexport { usePropsForRemoteElement };\n"],"ignoreList":[0],"mappings":";;;;;AAGA,SAAS,yBAAyB,SAAS,SAAS;CAClD,IAAI,CAAC,SAAS,OAAO,KAAA;CACrB,MAAM,EACJ,UACA,YACA,YACA,mBACE;CACJ,MAAM,gBAAgB,CAAC;CACvB,MAAM,qBAAqB;EACzB,GAAG;EACH,GAAG;EACH,UAAU;CACZ;CACA,IAAI,QAAQ,YACV,KAAK,MAAM,CAAC,MAAM,qBAAqB,OAAO,QAAQ,QAAQ,UAAU,GAAG;EACzE,MAAM,YAAY,kBAAkB;EACpC,IAAI,aAAa,MAAM;EACvB,MAAM,WAAW,eAAe;EAChC,IAAI,UACF,mBAAmB,QAAQ,6BAA6B,QAAQ;CAEpE;MAIA,KAAK,MAAM,CAAC,WAAW,aAAa,OAAO,QAAQ,cAAc,GAAG;EAKlE,IAAI,CAAC,UAAU;EACf,mBAAmB,KAAK,UAAU,EAAE,CAAC,YAAY,IAAI,UAAU,MAAM,CAAC,OAAO,6BAA6B,QAAQ;CACpH;CAEF,KAAK,MAAM,SAAS,UAClB,IAAI,MAAM,SAAS,KAAK,OAAO,MAAM,WAAW,SAAS,UAAU;EACjE,MAAM,OAAO,MAAM,WAAW;EAC9B,MAAM,WAAW,iBAAiB,OAAO,OAAO;EAChD,mBAAmB,QAAQ,mBAAmB,QAAqB,mBAAK,UAAU,EAChF,UAAU,CAAC,mBAAmB,OAAO,QAAQ,EAC/C,CAAC,IAAI;CACP,OACE,cAAc,KAAK,iBAAiB,OAAO,OAAO,CAAC;CAKvD,IAAI,cAAc,WAAW,GAAG,OAAO,mBAAmB;CAC1D,OAAO;AACT;AACA,SAAS,6BAA6B,UAAU;CAC9C,OAAO,SAAS,6BAA6B,GAAG,MAAM;EACpD,IAAI,KAAK,WAAW,KAAK,KAAK,cAAc,OAAO;GACjD,MAAM,QAAQ,KAAK;GACnB,IAAI,MAAM,WAAW,MAAM,eAAe;GAC1C,OAAO,YAAY,QAAQ,SAAS,MAAM,MAAM,IAAI,SAAS;EAC/D;EACA,OAAO,SAAS,GAAG,IAAI;CACzB;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"remote-received.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/hooks/remote-received.mjs"],"sourcesContent":["import { useState, useDebugValue, useEffect } from 'react';\n\n/**\n * Subscribes to a remote node’s updates and returns its current value.\n */\nfunction useRemoteReceived(remote, receiver) {\n const [state, setState] = useState(() => {\n const value = receiver.get(remote);\n return {\n id: remote.id,\n version: value?.version,\n value,\n receiver\n };\n });\n let returnValue = state.value;\n\n // If parameters have changed since our last render, schedule an update with its current value.\n if (state.receiver !== receiver || state.id !== remote.id) {\n // When the consumer of this hook changes receiver or attached node, the node they switched\n // to might already be unmounted. We guard against that by making sure we don’t get null\n // back from the receiver, and storing the “attached” node in state whether it is actually\n // attached or not, so we have a paper trail of how we got here.\n const updated = receiver.get(remote);\n\n // If the subscription has been updated, we'll schedule another update with React.\n // React will process this update immediately, so the old subscription value won't be committed.\n // It is still nice to avoid returning a mismatched value though, so let's override the return value.\n returnValue = updated;\n setState({\n receiver,\n id: remote.id,\n version: updated?.version,\n value: returnValue\n });\n }\n useDebugValue(returnValue);\n useEffect(() => {\n const abort = new AbortController();\n const checkForUpdates = () => {\n if (abort.signal.aborted) return;\n setState(previousState => {\n const {\n id: previousId,\n version: previousVersion,\n receiver: previousReceiver\n } = previousState;\n const {\n id\n } = remote;\n\n // Ignore values from stale sources\n if (previousReceiver !== receiver || previousId !== id) {\n return previousState;\n }\n\n // This function is also called as part of the initial useEffect() when the\n // component mounts. It’s possible that between the initial render (when the\n // remote component was for sure attached, to the best of the host’s knowledge)\n // and the effect, the component was removed from the remote tree. You’ll see that\n // the rest of this callback is careful to handle cases where the node is in this\n // state.\n const value = receiver.get(remote);\n const version = value?.version;\n\n // If the value hasn't changed, no update is needed.\n // Return state as-is so React can bail out and avoid an unnecessary render.\n if (previousVersion === version) {\n return previousState;\n }\n return {\n receiver,\n value,\n id,\n version\n };\n });\n };\n receiver.subscribe(remote, checkForUpdates, {\n signal: abort.signal\n });\n\n // Passive effect, so we need to check if anything has changed\n checkForUpdates();\n return () => {\n abort.abort();\n };\n }, [receiver, remote.id]);\n return returnValue;\n}\n\nexport { useRemoteReceived };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAKA,SAAS,kBAAkB,QAAQ,UAAU;CAC3C,MAAM,CAAC,OAAO,YAAY,eAAe;EACvC,MAAM,QAAQ,SAAS,IAAI,MAAM;EACjC,OAAO;GACL,IAAI,OAAO;GACX,SAAS,OAAO;GAChB;GACA;EACF;CACF,CAAC;CACD,IAAI,cAAc,MAAM;CAGxB,IAAI,MAAM,aAAa,YAAY,MAAM,OAAO,OAAO,IAAI;EAKzD,MAAM,UAAU,SAAS,IAAI,MAAM;EAKnC,cAAc;EACd,SAAS;GACP;GACA,IAAI,OAAO;GACX,SAAS,SAAS;GAClB,OAAO;EACT,CAAC;CACH;CACA,cAAc,WAAW;CACzB,gBAAgB;EACd,MAAM,QAAQ,IAAI,gBAAgB;EAClC,MAAM,wBAAwB;GAC5B,IAAI,MAAM,OAAO,SAAS;GAC1B,UAAS,kBAAiB;IACxB,MAAM,EACJ,IAAI,YACJ,SAAS,iBACT,UAAU,qBACR;IACJ,MAAM,EACJ,OACE;IAGJ,IAAI,qBAAqB,YAAY,eAAe,IAClD,OAAO;IAST,MAAM,QAAQ,SAAS,IAAI,MAAM;IACjC,MAAM,UAAU,OAAO;IAIvB,IAAI,oBAAoB,SACtB,OAAO;IAET,OAAO;KACL;KACA;KACA;KACA;IACF;GACF,CAAC;EACH;EACA,SAAS,UAAU,QAAQ,iBAAiB,EAC1C,QAAQ,MAAM,OAChB,CAAC;EAGD,gBAAgB;EAChB,aAAa;GACX,MAAM,MAAM;EACd;CACF,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC;CACxB,OAAO;AACT"}
1
+ {"version":3,"file":"remote-received.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/hooks/remote-received.mjs"],"sourcesContent":["import { useState, useDebugValue, useEffect } from 'react';\n\n/**\n * Subscribes to a remote node’s updates and returns its current value.\n */\nfunction useRemoteReceived(remote, receiver) {\n const [state, setState] = useState(() => {\n const value = receiver.get(remote);\n return {\n id: remote.id,\n version: value?.version,\n value,\n receiver\n };\n });\n let returnValue = state.value;\n\n // If parameters have changed since our last render, schedule an update with its current value.\n if (state.receiver !== receiver || state.id !== remote.id) {\n // When the consumer of this hook changes receiver or attached node, the node they switched\n // to might already be unmounted. We guard against that by making sure we don’t get null\n // back from the receiver, and storing the “attached” node in state whether it is actually\n // attached or not, so we have a paper trail of how we got here.\n const updated = receiver.get(remote);\n\n // If the subscription has been updated, we'll schedule another update with React.\n // React will process this update immediately, so the old subscription value won't be committed.\n // It is still nice to avoid returning a mismatched value though, so let's override the return value.\n returnValue = updated;\n setState({\n receiver,\n id: remote.id,\n version: updated?.version,\n value: returnValue\n });\n }\n useDebugValue(returnValue);\n useEffect(() => {\n const abort = new AbortController();\n const checkForUpdates = () => {\n if (abort.signal.aborted) return;\n setState(previousState => {\n const {\n id: previousId,\n version: previousVersion,\n receiver: previousReceiver\n } = previousState;\n const {\n id\n } = remote;\n\n // Ignore values from stale sources\n if (previousReceiver !== receiver || previousId !== id) {\n return previousState;\n }\n\n // This function is also called as part of the initial useEffect() when the\n // component mounts. It’s possible that between the initial render (when the\n // remote component was for sure attached, to the best of the host’s knowledge)\n // and the effect, the component was removed from the remote tree. You’ll see that\n // the rest of this callback is careful to handle cases where the node is in this\n // state.\n const value = receiver.get(remote);\n const version = value?.version;\n\n // If the value hasn't changed, no update is needed.\n // Return state as-is so React can bail out and avoid an unnecessary render.\n if (previousVersion === version) {\n return previousState;\n }\n return {\n receiver,\n value,\n id,\n version\n };\n });\n };\n receiver.subscribe(remote, checkForUpdates, {\n signal: abort.signal\n });\n\n // Passive effect, so we need to check if anything has changed\n checkForUpdates();\n return () => {\n abort.abort();\n };\n }, [receiver, remote.id]);\n return returnValue;\n}\n\nexport { useRemoteReceived };\n"],"ignoreList":[0],"mappings":";;;;;;;AAKA,SAAS,kBAAkB,QAAQ,UAAU;CAC3C,MAAM,CAAC,OAAO,YAAY,eAAe;EACvC,MAAM,QAAQ,SAAS,IAAI,MAAM;EACjC,OAAO;GACL,IAAI,OAAO;GACX,SAAS,OAAO;GAChB;GACA;EACF;CACF,CAAC;CACD,IAAI,cAAc,MAAM;CAGxB,IAAI,MAAM,aAAa,YAAY,MAAM,OAAO,OAAO,IAAI;EAKzD,MAAM,UAAU,SAAS,IAAI,MAAM;EAKnC,cAAc;EACd,SAAS;GACP;GACA,IAAI,OAAO;GACX,SAAS,SAAS;GAClB,OAAO;EACT,CAAC;CACH;CACA,cAAc,WAAW;CACzB,gBAAgB;EACd,MAAM,QAAQ,IAAI,gBAAgB;EAClC,MAAM,wBAAwB;GAC5B,IAAI,MAAM,OAAO,SAAS;GAC1B,UAAS,kBAAiB;IACxB,MAAM,EACJ,IAAI,YACJ,SAAS,iBACT,UAAU,qBACR;IACJ,MAAM,EACJ,OACE;IAGJ,IAAI,qBAAqB,YAAY,eAAe,IAClD,OAAO;IAST,MAAM,QAAQ,SAAS,IAAI,MAAM;IACjC,MAAM,UAAU,OAAO;IAIvB,IAAI,oBAAoB,SACtB,OAAO;IAET,OAAO;KACL;KACA;KACA;KACA;IACF;GACF,CAAC;EACH;EACA,SAAS,UAAU,QAAQ,iBAAiB,EAC1C,QAAQ,MAAM,OAChB,CAAC;EAGD,gBAAgB;EAChB,aAAa;GACX,MAAM,MAAM;EACd;CACF,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC;CACxB,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"node.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/node.mjs"],"sourcesContent":["import { RemoteTextRenderer } from './RemoteTextRenderer.mjs';\nimport { jsx } from 'react/jsx-runtime';\n\n/**\n * Renders a remote node to the host using React.\n *\n * @param node The remote node to render using React\n */\nfunction renderRemoteNode(node, {\n receiver,\n components\n}) {\n switch (node.type) {\n case 1:\n {\n const Component = components.get(node.element);\n if (Component == null) {\n throw new Error(`No component found for remote element: ${node.element}`);\n }\n return /*#__PURE__*/jsx(Component, {\n element: node,\n receiver: receiver,\n components: components\n }, node.id);\n }\n case 3:\n {\n return /*#__PURE__*/jsx(RemoteTextRenderer, {\n remote: node,\n receiver: receiver\n }, node.id);\n }\n case 8:\n {\n return null;\n }\n default:\n {\n throw new Error(`Unknown remote node type: ${String(node)}`);\n }\n }\n}\n\nexport { renderRemoteNode };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAQA,SAAS,iBAAiB,MAAM,EAC9B,UACA,cACC;CACD,QAAQ,KAAK,MAAb;EACE,KAAK,GACH;GACE,MAAM,YAAY,WAAW,IAAI,KAAK,OAAO;GAC7C,IAAI,aAAa,MACf,MAAM,IAAI,MAAM,0CAA0C,KAAK,SAAS;GAE1E,OAAoB,kBAAI,WAAW;IACjC,SAAS;IACC;IACE;GACd,GAAG,KAAK,EAAE;EACZ;EACF,KAAK,GAED,OAAoB,kBAAI,oBAAoB;GAC1C,QAAQ;GACE;EACZ,GAAG,KAAK,EAAE;EAEd,KAAK,GAED,OAAO;EAEX,SAEI,MAAM,IAAI,MAAM,6BAA6B,OAAO,IAAI,GAAG;CAEjE;AACF"}
1
+ {"version":3,"file":"node.mjs","names":[],"sources":["../../../../../../../../../../../../../node_modules/.pnpm/@mittwald+remote-dom-react@1.2.2-mittwald.10_patch_hash=62bb2b92626b650b153b14495520154_33e6b0816e3c6200b85ecb89e48d0790/node_modules/@mittwald/remote-dom-react/build/esm/host/node.mjs"],"sourcesContent":["import { RemoteTextRenderer } from './RemoteTextRenderer.mjs';\nimport { jsx } from 'react/jsx-runtime';\n\n/**\n * Renders a remote node to the host using React.\n *\n * @param node The remote node to render using React\n */\nfunction renderRemoteNode(node, {\n receiver,\n components\n}) {\n switch (node.type) {\n case 1:\n {\n const Component = components.get(node.element);\n if (Component == null) {\n throw new Error(`No component found for remote element: ${node.element}`);\n }\n return /*#__PURE__*/jsx(Component, {\n element: node,\n receiver: receiver,\n components: components\n }, node.id);\n }\n case 3:\n {\n return /*#__PURE__*/jsx(RemoteTextRenderer, {\n remote: node,\n receiver: receiver\n }, node.id);\n }\n case 8:\n {\n return null;\n }\n default:\n {\n throw new Error(`Unknown remote node type: ${String(node)}`);\n }\n }\n}\n\nexport { renderRemoteNode };\n"],"ignoreList":[0],"mappings":";;;;;;;;;;AAQA,SAAS,iBAAiB,MAAM,EAC9B,UACA,cACC;CACD,QAAQ,KAAK,MAAb;EACE,KAAK,GACH;GACE,MAAM,YAAY,WAAW,IAAI,KAAK,OAAO;GAC7C,IAAI,aAAa,MACf,MAAM,IAAI,MAAM,0CAA0C,KAAK,SAAS;GAE1E,OAAoB,kBAAI,WAAW;IACjC,SAAS;IACC;IACE;GACd,GAAG,KAAK,EAAE;EACZ;EACF,KAAK,GAED,OAAoB,kBAAI,oBAAoB;GAC1C,QAAQ;GACE;EACZ,GAAG,KAAK,EAAE;EAEd,KAAK,GAED,OAAO;EAEX,SAEI,MAAM,IAAI,MAAM,6BAA6B,OAAO,IAAI,GAAG;CAEjE;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-remote-react-renderer",
3
- "version": "1.5.0-next.47",
3
+ "version": "1.5.0-next.49",
4
4
  "type": "module",
5
5
  "description": "React rendering for Flow Remote Elements",
6
6
  "homepage": "https://flow.mittwald.de",
@@ -29,9 +29,9 @@
29
29
  "test:unit": "vitest run --passWithNoTests"
30
30
  },
31
31
  "dependencies": {
32
- "@mittwald/ext-bridge": "1.5.0-next.47",
33
- "@mittwald/flow-remote-core": "1.5.0-next.47",
34
- "@mittwald/flow-remote-elements": "1.5.0-next.47",
32
+ "@mittwald/ext-bridge": "1.5.0-next.49",
33
+ "@mittwald/flow-remote-core": "1.5.0-next.49",
34
+ "@mittwald/flow-remote-elements": "1.5.0-next.49",
35
35
  "@mittwald/react-use-promise": "^4.2.2",
36
36
  "@mittwald/remote-dom-react": "1.2.2-mittwald.10",
37
37
  "@types/react": "^19.2",
@@ -40,9 +40,9 @@
40
40
  "remeda": "^2.43.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@mittwald/flow-core": "1.5.0-next.47",
44
- "@mittwald/flow-react-components": "1.5.0-next.47",
45
- "@mittwald/typescript-config": "1.5.0-next.47",
43
+ "@mittwald/flow-core": "1.5.0-next.49",
44
+ "@mittwald/flow-react-components": "1.5.0-next.49",
45
+ "@mittwald/typescript-config": "1.5.0-next.49",
46
46
  "@types/node": "^25.9.3",
47
47
  "nx": "^22.7.5",
48
48
  "react": "^19.2.8",
@@ -57,7 +57,7 @@
57
57
  "vitest": "^4.1.11"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mittwald/flow-react-components": "1.5.0-next.47",
60
+ "@mittwald/flow-react-components": "1.5.0-next.49",
61
61
  "react": "^19.2.0",
62
62
  "react-dom": "^19.2.0",
63
63
  "react-hook-form": "^7.65.0"
@@ -67,5 +67,5 @@
67
67
  "optional": true
68
68
  }
69
69
  },
70
- "gitHead": "4e2913c0bf752feb0df4660e39b6c12bf974f59e"
70
+ "gitHead": "5af9457a3e3dc275a9032ffec18e03fd87dba7d8"
71
71
  }