@mittwald/flow-remote-core 0.2.0-alpha.895 → 0.2.0-alpha.897
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.
- package/dist/js/index-node.mjs +13 -13
- package/dist/js/index.mjs +12 -12
- package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs +38 -0
- package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/Thread.mjs +231 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/Thread.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs +10 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/errors.mjs +8 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/errors.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs +69 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/nanoid.mjs +11 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/nanoid.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs +212 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/shared.mjs +11 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/shared.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs +161 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs +86 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs +140 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs +211 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs +5 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs.map +1 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs +17 -0
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs.map +1 -0
- package/dist/js/{connection → packages/remote-core/src/connection}/connectHostRenderRoot.mjs +1 -1
- package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs.map +1 -0
- package/dist/js/{connection → packages/remote-core/src/connection}/connectRemoteIframe.mjs +1 -1
- package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/connection/types.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/error.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs.map +1 -0
- package/dist/js/{serialization → packages/remote-core/src/serialization}/FlowThreadSerialization.mjs +2 -1
- package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/serialization/Serializer.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs.map +1 -0
- package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/file.mjs +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs.map +1 -0
- package/dist/js/packages/remote-core/src/shim.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/js/connection/connectHostRenderRoot.mjs.map +0 -1
- package/dist/js/connection/connectRemoteIframe.mjs.map +0 -1
- package/dist/js/connection/types.mjs.map +0 -1
- package/dist/js/error.mjs.map +0 -1
- package/dist/js/ext-bridge/getWithMergedHostConfig.mjs.map +0 -1
- package/dist/js/ext-bridge/implementation.mjs.map +0 -1
- package/dist/js/serialization/FlowThreadSerialization.mjs.map +0 -1
- package/dist/js/serialization/Serializer.mjs.map +0 -1
- package/dist/js/serialization/serializers/dataTransferText.mjs.map +0 -1
- package/dist/js/serialization/serializers/date.mjs.map +0 -1
- package/dist/js/serialization/serializers/file.mjs.map +0 -1
- package/dist/js/serialization/serializers/fileList.mjs.map +0 -1
- package/dist/js/serialization/serializers/formData.mjs.map +0 -1
- package/dist/js/serialization/serializers/passwordPolicy.mjs.map +0 -1
- package/dist/js/shim.mjs.map +0 -1
- /package/dist/js/{connection → packages/remote-core/src/connection}/types.mjs +0 -0
- /package/dist/js/{error.mjs → packages/remote-core/src/error.mjs} +0 -0
- /package/dist/js/{ext-bridge → packages/remote-core/src/ext-bridge}/getWithMergedHostConfig.mjs +0 -0
- /package/dist/js/{ext-bridge → packages/remote-core/src/ext-bridge}/implementation.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/Serializer.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/dataTransferText.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/date.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/fileList.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/formData.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/index.mjs +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/index.mjs.map +0 -0
- /package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/passwordPolicy.mjs +0 -0
- /package/dist/js/{shim.mjs → packages/remote-core/src/shim.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreadNestedWindow.mjs","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { CHECK_MESSAGE, RESPONSE_MESSAGE } from './shared.mjs';\n\n/**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = new ThreadNestedWindow(window.opener);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadNestedWindow extends Thread {\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadNestedWindow.from(window.opener);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadNestedWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadNestedWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadNestedWindow(window, {\n ...options,\n exports\n });\n }\n constructor(parent, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(nestedWindowToThreadTarget(parent, {\n targetOrigin\n }), options);\n this.parent = parent;\n }\n}\nfunction nestedWindowToThreadTarget(parent, {\n targetOrigin = '*'\n} = {}) {\n const ready = () => {\n const respond = () => parent.postMessage(RESPONSE_MESSAGE, targetOrigin);\n self.addEventListener('message', ({\n data,\n source\n }) => {\n if (source !== parent) return;\n if (data === CHECK_MESSAGE) respond();\n });\n respond();\n };\n if (document.readyState === 'complete') {\n ready();\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n ready();\n }\n });\n }\n return {\n send(message, transfer) {\n return parent.postMessage(message, targetOrigin, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.data === CHECK_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadNestedWindow, nestedWindowToThreadTarget };\n"],"names":[],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,kBAAkB,SAAS,MAAM,CAAC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE;AAC/B,IAAI,OAAO,IAAI,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC;AAClD,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE;AACjC,IAAI,OAAO,IAAI,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO;AAC1D,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE;AAC1C,IAAI,IAAI,kBAAkB,CAAC,MAAM,EAAE;AACnC,MAAM,GAAG,OAAO;AAChB,MAAM;AACN,KAAK,CAAC;AACN,EAAE;AACF,EAAE,WAAW,CAAC,MAAM,EAAE;AACtB,IAAI,YAAY,GAAG,GAAG;AACtB,IAAI,GAAG;AACP,GAAG,GAAG,EAAE,EAAE;AACV,IAAI,KAAK,CAAC,0BAA0B,CAAC,MAAM,EAAE;AAC7C,MAAM;AACN,KAAK,CAAC,EAAE,OAAO,CAAC;AAChB,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,EAAE;AACT,QAAQ;AACR,OAAO,CAAC;AACR,IAAI;AACJ,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { Thread } from '../../Thread.mjs';
|
|
2
|
+
import { RESPONSE_MESSAGE, CHECK_MESSAGE } from './shared.mjs';
|
|
3
|
+
import { ThreadNestedWindow } from './ThreadNestedWindow.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a thread from a `Window` created by this environment.
|
|
7
|
+
*
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
12
|
+
*
|
|
13
|
+
* const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');
|
|
14
|
+
* const thread = new ThreadWindow(popup);
|
|
15
|
+
* await thread.imports.sendMessage('Hello world!');
|
|
16
|
+
*/
|
|
17
|
+
class ThreadWindow extends Thread {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a thread from a `Window` created by this environment.
|
|
20
|
+
*
|
|
21
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
25
|
+
*
|
|
26
|
+
* const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');
|
|
27
|
+
* const thread = ThreadWindow.from(popup);
|
|
28
|
+
* await thread.imports.sendMessage('Hello world!');
|
|
29
|
+
*/
|
|
30
|
+
static from(window, options) {
|
|
31
|
+
return new ThreadWindow(window, options);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Starts a thread wrapped around a `window` object, and returns the imports
|
|
36
|
+
* of the thread.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
41
|
+
*
|
|
42
|
+
* const {getMessage} = ThreadWindow.import(window);
|
|
43
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
44
|
+
*
|
|
45
|
+
* // In the nested window:
|
|
46
|
+
*
|
|
47
|
+
* import {ThreadNestedWindow} from '@quilted/threads';
|
|
48
|
+
*
|
|
49
|
+
* ThreadNestedWindow.export(window.opener, {
|
|
50
|
+
* async getMessage() {
|
|
51
|
+
* return 'Hello, world!';
|
|
52
|
+
* },
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
static import(window, options) {
|
|
57
|
+
return new ThreadWindow(window, options).imports;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Starts a thread wrapped around a `window` object, providing the second
|
|
62
|
+
* argument as the exports of the thread.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
67
|
+
*
|
|
68
|
+
* ThreadWindow.export(window, {
|
|
69
|
+
* async getMessage() {
|
|
70
|
+
* return 'Hello, world!';
|
|
71
|
+
* },
|
|
72
|
+
* });
|
|
73
|
+
*
|
|
74
|
+
* // In the nested window:
|
|
75
|
+
*
|
|
76
|
+
* import {ThreadNestedWindow} from '@quilted/threads';
|
|
77
|
+
*
|
|
78
|
+
* const {getMessage} = ThreadNestedWindow.import(window.opener);
|
|
79
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
static export(window, exports, options) {
|
|
83
|
+
new ThreadWindow(window, {
|
|
84
|
+
...options,
|
|
85
|
+
exports
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Creates a thread from within a window created by a parent document (for example,
|
|
91
|
+
* an `iframe` or popup window).
|
|
92
|
+
*
|
|
93
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
97
|
+
*
|
|
98
|
+
* // Inside a document opened as a popup window
|
|
99
|
+
* const thread = ThreadWindow.opener();
|
|
100
|
+
* await thread.imports.sendMessage('Hello world!');
|
|
101
|
+
*/
|
|
102
|
+
static opener = (() => Object.assign(options => ThreadNestedWindow.from(window.opener, options), {
|
|
103
|
+
/**
|
|
104
|
+
* Starts a thread wrapped around a nested `window` object, and returns the imports
|
|
105
|
+
* of the thread.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
110
|
+
*
|
|
111
|
+
* const {getMessage} = ThreadWindow.opener.import();
|
|
112
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
113
|
+
*
|
|
114
|
+
* // In the parent window:
|
|
115
|
+
*
|
|
116
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
117
|
+
*
|
|
118
|
+
* ThreadWindow.export(window, {
|
|
119
|
+
* async getMessage() {
|
|
120
|
+
* return 'Hello, world!';
|
|
121
|
+
* },
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
import: options => ThreadNestedWindow.import(window.opener, options),
|
|
126
|
+
/**
|
|
127
|
+
* Starts a thread wrapped around a nested `window` object, providing the second
|
|
128
|
+
* argument as the exports of the thread.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
133
|
+
*
|
|
134
|
+
* ThreadWindow.opener.export({
|
|
135
|
+
* async getMessage() {
|
|
136
|
+
* return 'Hello, world!';
|
|
137
|
+
* },
|
|
138
|
+
* });
|
|
139
|
+
*
|
|
140
|
+
* // In the parent window:
|
|
141
|
+
*
|
|
142
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
143
|
+
*
|
|
144
|
+
* const {getMessage} = ThreadWindow.import(window);
|
|
145
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export: (exports, options) => ThreadNestedWindow.export(window.opener, {
|
|
149
|
+
...options,
|
|
150
|
+
exports
|
|
151
|
+
})
|
|
152
|
+
}))();
|
|
153
|
+
constructor(window, {
|
|
154
|
+
targetOrigin = '*',
|
|
155
|
+
...options
|
|
156
|
+
} = {}) {
|
|
157
|
+
super(windowToThreadTarget(window, {
|
|
158
|
+
targetOrigin
|
|
159
|
+
}), options);
|
|
160
|
+
this.window = window;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function windowToThreadTarget(window, {
|
|
164
|
+
targetOrigin = '*'
|
|
165
|
+
} = {}) {
|
|
166
|
+
let connected = false;
|
|
167
|
+
const sendMessage = function send(message, transfer) {
|
|
168
|
+
window.postMessage(message, targetOrigin, transfer);
|
|
169
|
+
};
|
|
170
|
+
const connectedPromise = new Promise(resolve => {
|
|
171
|
+
const abort = new AbortController();
|
|
172
|
+
globalThis.window.addEventListener('message', event => {
|
|
173
|
+
if (event.source !== window) return;
|
|
174
|
+
if (event.data === RESPONSE_MESSAGE) {
|
|
175
|
+
connected = true;
|
|
176
|
+
abort.abort();
|
|
177
|
+
resolve();
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
signal: abort.signal
|
|
181
|
+
});
|
|
182
|
+
abort.signal.addEventListener('abort', () => resolve(), {
|
|
183
|
+
once: true
|
|
184
|
+
});
|
|
185
|
+
sendMessage(CHECK_MESSAGE);
|
|
186
|
+
});
|
|
187
|
+
return {
|
|
188
|
+
send(message, transfer) {
|
|
189
|
+
if (!connected) {
|
|
190
|
+
return connectedPromise.then(() => {
|
|
191
|
+
if (connected) return sendMessage(message, transfer);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return sendMessage(message, transfer);
|
|
195
|
+
},
|
|
196
|
+
listen(listen, {
|
|
197
|
+
signal
|
|
198
|
+
}) {
|
|
199
|
+
self.addEventListener('message', event => {
|
|
200
|
+
if (event.source !== window) return;
|
|
201
|
+
if (event.data === RESPONSE_MESSAGE) return;
|
|
202
|
+
listen(event.data);
|
|
203
|
+
}, {
|
|
204
|
+
signal
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export { ThreadWindow, windowToThreadTarget };
|
|
211
|
+
//# sourceMappingURL=ThreadWindow.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreadWindow.mjs","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { RESPONSE_MESSAGE, CHECK_MESSAGE } from './shared.mjs';\nimport { ThreadNestedWindow } from './ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = new ThreadWindow(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadWindow extends Thread {\n /**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = ThreadWindow.from(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadWindow(window, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadWindow.opener();\n * await thread.imports.sendMessage('Hello world!');\n */\n static opener = (() => Object.assign(options => ThreadNestedWindow.from(window.opener, options), {\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.opener.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedWindow.import(window.opener, options),\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.opener.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedWindow.export(window.opener, {\n ...options,\n exports\n })\n }))();\n constructor(window, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(window, {\n targetOrigin\n }), options);\n this.window = window;\n }\n}\nfunction windowToThreadTarget(window, {\n targetOrigin = '*'\n} = {}) {\n let connected = false;\n const sendMessage = function send(message, transfer) {\n window.postMessage(message, targetOrigin, transfer);\n };\n const connectedPromise = new Promise(resolve => {\n const abort = new AbortController();\n globalThis.window.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) {\n connected = true;\n abort.abort();\n resolve();\n }\n }, {\n signal: abort.signal\n });\n abort.signal.addEventListener('abort', () => resolve(), {\n once: true\n });\n sendMessage(CHECK_MESSAGE);\n });\n return {\n send(message, transfer) {\n if (!connected) {\n return connectedPromise.then(() => {\n if (connected) return sendMessage(message, transfer);\n });\n }\n return sendMessage(message, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadWindow, windowToThreadTarget };\n"],"names":[],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,YAAY,SAAS,MAAM,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE;AAC/B,IAAI,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC;AAC5C,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE;AACjC,IAAI,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO;AACpD,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE;AAC1C,IAAI,IAAI,YAAY,CAAC,MAAM,EAAE;AAC7B,MAAM,GAAG,OAAO;AAChB,MAAM;AACN,KAAK,CAAC;AACN,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,OAAO,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE;AACnG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,EAAE,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;AAC3E,MAAM,GAAG,OAAO;AAChB,MAAM;AACN,KAAK;AACL,GAAG,CAAC,GAAG;AACP,EAAE,WAAW,C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AAI,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE;AAC5B,MAAM,IAAI,CAAC,SAAS,EAAE;AACtB,QAAQ,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM;AAC3C,UAAU,IAAI,SAAS,EAAE,OAAO,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC9D,QAAQ,CAAC,CAAC;AACV,MAAM;AACN,MAAM,OAAO,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC;AAC3C,IAAI,CAAC;AACL,IAAI,MAAM,CAAC,MAAM,EAAE;AACnB,MAAM;AACN,KAAK,EAAE;AACP,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,IAAI;AAChD,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE;AACrC,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE;AAC7C,QAAQ,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AAC1B,MAAM,CAAC,EAAE;AACT,QAAQ;AACR,OAAO,CAAC;AACR,IAAI;AACJ,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.mjs","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs"],"sourcesContent":["const CHECK_MESSAGE = 'quilt.threads.ping';\nconst RESPONSE_MESSAGE = 'quilt.threads.pong';\n\nexport { CHECK_MESSAGE, RESPONSE_MESSAGE };\n"],"names":[],"mappings":"AAAK,MAAC,aAAa,GAAG;AACjB,MAAC,gBAAgB,GAAG;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TRANSFERABLE } from './constants.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Marks the value as being transferable between threads. The memory for this object
|
|
5
|
+
* will be moved to the target thread once the object is sent.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects
|
|
8
|
+
*/
|
|
9
|
+
function markAsTransferable(value) {
|
|
10
|
+
Object.assign(value, {
|
|
11
|
+
[TRANSFERABLE]: true
|
|
12
|
+
});
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { markAsTransferable };
|
|
17
|
+
//# sourceMappingURL=transfer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.mjs","sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs"],"sourcesContent":["import { TRANSFERABLE } from './constants.mjs';\n\n/**\n * Marks the value as being transferable between threads. The memory for this object\n * will be moved to the target thread once the object is sent.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects\n */\nfunction markAsTransferable(value) {\n Object.assign(value, {\n [TRANSFERABLE]: true\n });\n return value;\n}\n\nexport { markAsTransferable };\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;AACvB,IAAI,CAAC,YAAY,GAAG;AACpB,GAAG,CAAC;AACJ,EAAE,OAAO,KAAK;AACd;;;;","x_google_ignoreList":[0]}
|
package/dist/js/{connection → packages/remote-core/src/connection}/connectHostRenderRoot.mjs
RENAMED
|
@@ -2,7 +2,7 @@ import { Version } from './types.mjs';
|
|
|
2
2
|
import { RemoteError } from '../error.mjs';
|
|
3
3
|
import { FlowThreadSerialization } from '../serialization/FlowThreadSerialization.mjs';
|
|
4
4
|
import '@mittwald/remote-dom-core/elements';
|
|
5
|
-
import { ThreadNestedIframe } from '@quilted/threads';
|
|
5
|
+
import { ThreadNestedIframe } from '../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs';
|
|
6
6
|
|
|
7
7
|
const incompatibleParentFrameError = () => new RemoteError("Could not find any compatible parent frame");
|
|
8
8
|
const connectRemoteReceiver = (root, receiverConnection) => import('@mittwald/remote-dom-core/elements').then(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectHostRenderRoot.mjs","sources":["../../../../../../src/connection/connectHostRenderRoot.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type RemoteExports,\n type RemoteToHostConnection,\n} from \"@/connection/types\";\nimport { RemoteError } from \"@/error\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport { type RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadNestedIframe } from \"@quilted/threads\";\n\ninterface Options {\n root: HTMLDivElement;\n onPathnameChanged?: (pathname: string) => void;\n}\n\nconst incompatibleParentFrameError = () =>\n new RemoteError(\"Could not find any compatible parent frame\");\n\nexport const connectRemoteReceiver = (\n root: HTMLDivElement,\n receiverConnection: RemoteConnection,\n) =>\n import(\"@mittwald/remote-dom-core/elements\").then(\n ({ RemoteMutationObserver }) => {\n const observer = new RemoteMutationObserver(receiverConnection);\n observer.observe(root);\n },\n );\n\nexport const connectHostRenderRoot = async (\n options: Options,\n): Promise<RemoteToHostConnection> => {\n const { root, onPathnameChanged } = options;\n\n const connection = new ThreadNestedIframe<HostExports, RemoteExports>({\n serialization: new FlowThreadSerialization(),\n exports: {\n render: (connection: RemoteConnection) =>\n connectRemoteReceiver(root, connection),\n setPathname: async (pathname) => {\n onPathnameChanged?.(pathname);\n },\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady(Version.v3);\n\n if (typeof mwExtBridge !== \"undefined\") {\n mwExtBridge.connection = connection.imports;\n await mwExtBridge.readiness.setIsReady();\n }\n\n return connection;\n } catch (error) {\n if (\n error instanceof Error &&\n /No '.*' method is exported from this thread/.test(error.message)\n ) {\n throw incompatibleParentFrameError();\n }\n throw error;\n }\n};\n\nexport const connectHostRenderRootRef =\n (opts: Omit<Options, \"root\">) => (ref: HTMLDivElement | null) => {\n if (ref === null) {\n return;\n }\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as Promise<RemoteToHostConnection>;\n }\n\n const connection = connectHostRenderRoot({\n root: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":["connection"],"mappings":";;;;;;AAgBA,MAAM,4BAAA,GAA+B,MACnC,IAAI,WAAA,CAAY,4CAA4C,CAAA;AAEvD,MAAM,wBAAwB,CACnC,IAAA,EACA,kBAAA,KAEA,OAAO,oCAAoC,CAAA,CAAE,IAAA;AAAA,EAC3C,CAAC,EAAE,sBAAA,EAAuB,KAAM;AAC9B,IAAA,MAAM,QAAA,GAAW,IAAI,sBAAA,CAAuB,kBAAkB,CAAA;AAC9D,IAAA,QAAA,CAAS,QAAQ,IAAI,CAAA;AAAA,EACvB;AACF;AAEK,MAAM,qBAAA,GAAwB,OACnC,OAAA,KACoC;AACpC,EAAA,MAAM,EAAE,IAAA,EAAM,iBAAA,EAAkB,GAAI,OAAA;AAEpC,EAAA,MAAM,UAAA,GAAa,IAAI,kBAAA,CAA+C;AAAA,IACpE,aAAA,EAAe,IAAI,uBAAA,EAAwB;AAAA,IAC3C,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,CAACA,WAAAA,KACP,qBAAA,CAAsB,MAAMA,WAAU,CAAA;AAAA,MACxC,WAAA,EAAa,OAAO,QAAA,KAAa;AAC/B,QAAA,iBAAA,GAAoB,QAAQ,CAAA;AAAA,MAC9B;AAAA;AACF,GACD,CAAA;AAED,EAAA,IAAI,UAAA,CAAW,WAAW,MAAA,EAAQ;AAChC,IAAA,MAAM,4BAAA,EAA6B;AAAA,EACrC;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,UAAA,CAAW,OAAA,CAAQ,UAAA,CAAW,OAAA,CAAQ,EAAE,CAAA;AAE9C,IAAA,IAAI,OAAO,gBAAgB,WAAA,EAAa;AACtC,MAAA,WAAA,CAAY,aAAa,UAAA,CAAW,OAAA;AACpC,MAAA,MAAM,WAAA,CAAY,UAAU,UAAA,EAAW;AAAA,IACzC;AAEA,IAAA,OAAO,UAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,IACE,iBAAiB,KAAA,IACjB,6CAAA,CAA8C,IAAA,CAAK,KAAA,CAAM,OAAO,CAAA,EAChE;AACA,MAAA,MAAM,4BAAA,EAA6B;AAAA,IACrC;AACA,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAEO,MAAM,wBAAA,GACX,CAAC,IAAA,KAAgC,CAAC,GAAA,KAA+B;AAC/D,EAAA,IAAI,QAAQ,IAAA,EAAM;AAChB,IAAA;AAAA,EACF;AACA,EAAA,IAAI,wBAAwB,GAAA,EAAK;AAC/B,IAAA,OAAO,IAAI,oBAAoB,CAAA;AAAA,EACjC;AAEA,EAAA,MAAM,aAAa,qBAAA,CAAsB;AAAA,IACvC,IAAA,EAAM,GAAA;AAAA,IACN,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -2,7 +2,7 @@ import { Version } from './types.mjs';
|
|
|
2
2
|
import { getWithMergedHostConfig } from '../ext-bridge/getWithMergedHostConfig.mjs';
|
|
3
3
|
import { emptyImplementation } from '../ext-bridge/implementation.mjs';
|
|
4
4
|
import { FlowThreadSerialization } from '../serialization/FlowThreadSerialization.mjs';
|
|
5
|
-
import { ThreadIframe } from '@quilted/threads';
|
|
5
|
+
import { ThreadIframe } from '../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs';
|
|
6
6
|
|
|
7
7
|
const connectRemoteIframe = (opts) => {
|
|
8
8
|
const {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectRemoteIframe.mjs","sources":["../../../../../../src/connection/connectRemoteIframe.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type HostToRemoteConnection,\n type NavigationState,\n type RemoteExports,\n type RemoteExtBridgeConnectionApi,\n} from \"@/connection/types\";\nimport { getWithMergedHostConfig } from \"@/ext-bridge/getWithMergedHostConfig\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport { type HostConfig } from \"@mittwald/flow-core\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadIframe } from \"@quilted/threads\";\n\ninterface Options {\n connection: RemoteConnection;\n iframe: HTMLIFrameElement;\n hostConfig: HostConfig;\n onReady?: (connection: HostToRemoteConnection) => void;\n onLoadingChanged?: (isLoading: boolean) => void;\n onError?: (error: string) => void;\n onNavigationStateChanged?: (state: NavigationState) => void;\n extBridgeImplementation?: RemoteExtBridgeConnectionApi;\n}\n\nexport const connectRemoteIframe = (opts: Options): HostToRemoteConnection => {\n const {\n connection,\n iframe,\n onReady,\n onLoadingChanged,\n onError,\n onNavigationStateChanged,\n extBridgeImplementation: extBridgeImplementationProp = emptyImplementation,\n hostConfig,\n } = opts;\n\n const extBridgeImplementation = {\n ...extBridgeImplementationProp,\n getConfig: getWithMergedHostConfig(extBridgeImplementationProp, hostConfig),\n };\n\n const result = {\n thread: new ThreadIframe<RemoteExports, HostExports>(iframe, {\n serialization: new FlowThreadSerialization(),\n exports: {\n ...extBridgeImplementation,\n setIsReady: async (version = Version.v1) => {\n result.version = version;\n onReady?.(result);\n },\n setIsLoading: async (isLoading: boolean) => {\n onLoadingChanged?.(isLoading);\n },\n setError: async (error: string) => {\n onError?.(error);\n },\n setNavigationState: async (state) => {\n onNavigationStateChanged?.(state);\n },\n getHostConfig: async () => {\n return hostConfig;\n },\n },\n }),\n updateHostPathname: (hostPathname?: string) => {\n if (hostPathname === undefined) {\n return;\n }\n\n if (result.version >= Version.v2) {\n result.thread.imports.setPathname(hostPathname);\n }\n },\n version: 0,\n };\n\n result.thread.imports.render(connection);\n return result;\n};\n\nexport const connectRemoteIframeRef =\n (opts: Omit<Options, \"iframe\">) => (ref: HTMLIFrameElement | null) => {\n if (!ref) {\n return;\n }\n\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as HostToRemoteConnection;\n }\n\n const connection = connectRemoteIframe({\n iframe: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,mBAAA,GAAsB,CAAC,IAAA,KAA0C;AAC5E,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,gBAAA;AAAA,IACA,OAAA;AAAA,IACA,wBAAA;AAAA,IACA,yBAAyB,2BAAA,GAA8B,mBAAA;AAAA,IACvD;AAAA,GACF,GAAI,IAAA;AAEJ,EAAA,MAAM,uBAAA,GAA0B;AAAA,IAC9B,GAAG,2BAAA;AAAA,IACH,SAAA,EAAW,uBAAA,CAAwB,2BAAA,EAA6B,UAAU;AAAA,GAC5E;AAEA,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,IAAI,YAAA,CAAyC,MAAA,EAAQ;AAAA,MAC3D,aAAA,EAAe,IAAI,uBAAA,EAAwB;AAAA,MA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AAA,CAAoB;AAAA,IACrC,MAAA,EAAQ,GAAA;AAAA,IACR,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":["../../../../../../src/connection/types.ts"],"sourcesContent":["import type {\n ExtBridgeConfigInput,\n ExtBridgeConnectionApi,\n} from \"@mittwald/ext-bridge\";\nimport type { HostConfig } from \"@mittwald/flow-core\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core\";\nimport type { ThreadIframe, ThreadNestedIframe } from \"@quilted/threads\";\nexport type { RemoteConnection } from \"@mittwald/remote-dom-core\";\n\nexport interface NavigationState {\n pathname: string;\n isPending: boolean;\n}\n\nexport type RemoteExtBridgeConfig = Omit<\n ExtBridgeConfigInput,\n keyof HostConfig\n>;\n\nexport interface RemoteExtBridgeConnectionApi extends Omit<\n ExtBridgeConnectionApi,\n \"getConfig\"\n> {\n getConfig: () => Promise<RemoteExtBridgeConfig>;\n}\n\n/**\n * Breaking Change warning: Do not remove/rename/modify existing properties of\n * this interface, as they might be used by existing extensions.\n *\n * When addding properties, make sure to release the host before all clients.\n */\nexport interface HostExports extends ExtBridgeConnectionApi {\n setIsReady: (version?: Version) => Promise<void>;\n setIsLoading: (isLoading: boolean) => Promise<void>;\n setError: (error: string) => Promise<void>;\n setNavigationState: (state: NavigationState) => Promise<void>;\n getHostConfig: () => Promise<HostConfig>;\n}\n\nexport interface RemoteExports {\n render: (connection: RemoteConnection) => Promise<void>;\n setPathname: (pathname: string) => Promise<void>;\n}\n\nexport type RemoteToHostConnection = ThreadNestedIframe<\n HostExports,\n RemoteExports\n>;\n\nexport interface HostToRemoteConnection {\n version: Version;\n thread: ThreadIframe<RemoteExports, HostExports>;\n updateHostPathname: (hostPathname?: string) => void;\n}\n\nexport enum Version {\n vUnknown = 0,\n v1 = 1,\n v2 = 2,\n v3 = 3,\n}\n"],"names":["Version"],"mappings":"AAwDO,IAAK,OAAA,qBAAAA,QAAAA,KAAL;AACL,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,cAAW,CAAA,CAAA,GAAX,UAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AAJU,EAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","sources":["../../../../../src/error.ts"],"sourcesContent":["export class RemoteError extends Error {\n constructor(message: string) {\n super(message);\n this.message = message;\n }\n}\n\nRemoteError.prototype.name = \"RemoteError\";\n"],"names":[],"mappings":"AAAO,MAAM,oBAAoB,KAAA,CAAM;AAAA,EACrC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF;AAEA,WAAA,CAAY,UAAU,IAAA,GAAO,aAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWithMergedHostConfig.mjs","sources":["../../../../../../src/ext-bridge/getWithMergedHostConfig.ts"],"sourcesContent":["import type { RemoteExtBridgeConnectionApi } from \"@/connection\";\nimport type { ExtBridgeConfigInput } from \"@mittwald/ext-bridge\";\nimport type { HostConfig } from \"@mittwald/flow-core\";\n\nexport const getWithMergedHostConfig =\n (extBridgeConnection: RemoteExtBridgeConnectionApi, hostConfig: HostConfig) =>\n async (): Promise<ExtBridgeConfigInput> => {\n const baseConfig = await extBridgeConnection.getConfig();\n\n return {\n ...hostConfig,\n ...baseConfig,\n };\n };\n"],"names":[],"mappings":"AAIO,MAAM,uBAAA,GACX,CAAC,mBAAA,EAAmD,UAAA,KACpD,YAA2C;AACzC,EAAA,MAAM,UAAA,GAAa,MAAM,mBAAA,CAAoB,SAAA,EAAU;AAEvD,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation.mjs","sources":["../../../../../../src/ext-bridge/implementation.ts"],"sourcesContent":["import { RemoteError } from \"@/error\";\nimport type { ExtBridgeConnectionApi } from \"@mittwald/ext-bridge\";\n\nexport const emptyImplementation = new Proxy(\n {},\n {\n get() {\n throw new RemoteError(\"Missing implementation for mittwald.extBridge\");\n },\n },\n) as ExtBridgeConnectionApi;\n"],"names":[],"mappings":";;AAGO,MAAM,sBAAsB,IAAI,KAAA;AAAA,EACrC,EAAC;AAAA,EACD;AAAA,IACE,GAAA,GAAM;AACJ,MAAA,MAAM,IAAI,YAAY,+CAA+C,CAAA;AAAA,IACvE;AAAA;AAEJ;;;;"}
|
package/dist/js/{serialization → packages/remote-core/src/serialization}/FlowThreadSerialization.mjs
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ThreadSerializationStructuredClone, TRANSFERABLE } from '@quilted/threads';
|
|
2
1
|
import * as index from './serializers/index.mjs';
|
|
3
2
|
import { isObjectType } from 'remeda';
|
|
4
3
|
import { Serializer } from './Serializer.mjs';
|
|
4
|
+
import { ThreadSerializationStructuredClone } from '../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs';
|
|
5
|
+
import { TRANSFERABLE } from '../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs';
|
|
5
6
|
|
|
6
7
|
const serializers = Object.values(index).filter(
|
|
7
8
|
(val) => val instanceof Serializer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowThreadSerialization.mjs","sources":["../../../../../../src/serialization/FlowThreadSerialization.ts"],"sourcesContent":["import {\n ThreadSerializationStructuredClone,\n type ThreadSerializationOptions,\n TRANSFERABLE,\n} from \"@quilted/threads\";\nimport * as serializerModules from \"./serializers\";\nimport { isObjectType } from \"remeda\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nconst serializers = Object.values(serializerModules).filter(\n (val) => val instanceof Serializer,\n);\n\nexport class FlowThreadSerialization extends ThreadSerializationStructuredClone {\n public constructor() {\n const options: ThreadSerializationOptions = {\n serialize: async (val, serialize) => {\n try {\n if (this.isSerializableByBase(val)) {\n return;\n }\n if (this.omitSerialization(val)) {\n return null;\n }\n for (const serializer of serializers) {\n const serialization = await serializer.serialize(val);\n\n if (serialization.applied) {\n return await serialize(serialization.result);\n }\n }\n\n if (isObjectType(val)) {\n return await serialize({ ...val });\n }\n\n return undefined;\n } catch (error) {\n console.error(\"Error while serializing\", error);\n throw error;\n }\n },\n\n deserialize: async (val, deserialize) => {\n try {\n for (const serializer of serializers) {\n const deserialization = await serializer.deserialize(val);\n\n if (deserialization.applied) {\n return deserialization.result.value;\n }\n }\n\n return await deserialize(val);\n } catch (error) {\n console.error(\"Error while deserializing\", error);\n throw error;\n }\n },\n };\n\n super(options);\n }\n\n private isSerializableByBase(val: unknown) {\n return (\n val instanceof Map ||\n val instanceof Set ||\n Array.isArray(val) ||\n typeof val === \"function\" ||\n (isObjectType(val) && TRANSFERABLE in val)\n );\n }\n\n private omitSerialization(val: unknown) {\n return val instanceof HTMLElement || val === window;\n }\n}\n"],"names":["serializerModules"],"mappings":";;;;;;AASA,MAAM,WAAA,GAAc,MAAA,CA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A;AAAA,YAChC;AAAA,UACF;AAEA,UAAA,OAAO,MAAM,YAAY,GAAG,CAAA;AAAA,QAC9B,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,KAAA,CAAM,6BAA6B,KAAK,CAAA;AAChD,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF;AAAA,KACF;AAEA,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA,EACf;AAAA,EAEQ,qBAAqB,GAAA,EAAc;AACzC,IAAA,OACE,GAAA,YAAe,GAAA,IACf,GAAA,YAAe,GAAA,IACf,MAAM,OAAA,CAAQ,GAAG,CAAA,IACjB,OAAO,GAAA,KAAQ,UAAA,IACd,YAAA,CAAa,GAAG,KAAK,YAAA,IAAgB,GAAA;AAAA,EAE1C;AAAA,EAEQ,kBAAkB,GAAA,EAAc;AACtC,IAAA,OAAO,GAAA,YAAe,eAAe,GAAA,KAAQ,MAAA;AAAA,EAC/C;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Serializer.mjs","sources":["../../../../../../src/serialization/Serializer.ts"],"sourcesContent":["interface SerializationStrategy<TIn, TOut> {\n isApplicable: (val: unknown) => val is TIn;\n apply: (val: TIn) => TOut | Promise<TOut>;\n}\n\nconst Key = \"mittwald.flow-remote-core.serializer.name\";\n\nexport interface SuccessfulSerializationResult<T> {\n value: T;\n [Key]: string;\n}\n\nexport type SerializationResult<T> =\n | { applied: true; result: SuccessfulSerializationResult<T> }\n | { applied: false };\n\nexport class Serializer<TIn, TOut> {\n public constructor(\n private options: {\n name: string;\n serialize: SerializationStrategy<TIn, TOut>;\n deserialize: Pick<SerializationStrategy<TOut, TIn>, \"apply\">;\n },\n ) {}\n\n private async apply<TIn, TOut>(\n val: unknown,\n strategy: SerializationStrategy<TIn, TOut>,\n ): Promise<SerializationResult<TOut>> {\n if (!strategy.isApplicable(val)) {\n return { applied: false };\n }\n\n const resolved = await strategy.apply(val);\n\n return {\n applied: true,\n result: {\n [Key]: this.options.name,\n value: resolved,\n },\n };\n }\n\n public async serialize(val: unknown): Promise<SerializationResult<TOut>> {\n return this.apply<TIn, TOut>(val, this.options.serialize);\n }\n\n public async deserialize(val: unknown): Promise<SerializationResult<TIn>> {\n return this.apply(val, {\n isApplicable: (\n candidate,\n ): candidate is SuccessfulSerializationResult<TOut> =>\n !!candidate &&\n typeof candidate === \"object\" &&\n Key in candidate &&\n (candidate as never)[Key] === this.options.name,\n apply: (serialization) =>\n this.options.deserialize.apply(serialization.value),\n });\n }\n}\n"],"names":[],"mappings":"AAKA,MAAM,GAAA,GAAM,2CAAA;AAWL,MAAM,UAAA,CAAsB;AAAA,EAC1B,YACG,OAAA,EAKR;AALQ,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA,EAKP;AAAA,EALO,OAAA;AAAA,EAOV,MAAc,KAAA,CACZ,GAAA,EACA,QAAA,EACoC;AACpC,IAAA,IAAI,CAAC,QAAA,CAAS,YAAA,CAAa,GAAG,CAAA,EAAG;AAC/B,MAAA,OAAO,EAAE,SAAS,KAAA,EAAM;AAAA,IAC1B;AAEA,IAAA,MAAM,QAAA,GAAW,MAAM,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA;AAEzC,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,IAAA;AAAA,MACT,MAAA,EAAQ;AAAA,QACN,CAAC,GAAG,GAAG,IAAA,CAAK,OAAA,CAAQ,IAAA;AAAA,QACpB,KAAA,EAAO;AAAA;AACT,KACF;AAAA,EACF;AAAA,EAEA,MAAa,UAAU,GAAA,EAAkD;AACvE,IAAA,OAAO,IAAA,CAAK,KAAA,CAAiB,GAAA,EAAK,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA,EAC1D;AAAA,EAEA,MAAa,YAAY,GAAA,EAAiD;AACxE,IAAA,OAAO,IAAA,CAAK,MAAM,GAAA,EAAK;AAAA,MACrB,YAAA,EAAc,CACZ,SAAA,KAEA,CAAC,CAAC,SAAA,IACF,OAAO,SAAA,KAAc,QAAA,IACrB,OAAO,SAAA,IACN,SAAA,CAAoB,GAAG,CAAA,KAAM,KAAK,OAAA,CAAQ,IAAA;AAAA,MAC7C,KAAA,EAAO,CAAC,aAAA,KACN,IAAA,CAAK,QAAQ,WAAA,CAAY,KAAA,CAAM,cAAc,KAAK;AAAA,KACrD,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataTransferText.mjs","sources":["../../../../../../../src/serialization/serializers/dataTransferText.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\n\nexport const dataTransferTextSerializer = new Serializer<DataTransfer, string>({\n name: \"DataTransferText\",\n serialize: {\n isApplicable: (val): val is DataTransfer => {\n return (\n val instanceof DataTransfer &&\n val.types.every((type) => type === \"text/plain\")\n );\n },\n apply: (dataTransfer) => {\n return dataTransfer.getData(\"text\") || dataTransfer.getData(\"text/plain\");\n },\n },\n deserialize: {\n apply: (asString) => {\n const dataTransfer = new DataTransfer();\n dataTransfer.setData(\"text\", asString);\n return dataTransfer;\n },\n },\n});\n"],"names":[],"mappings":";;AAEO,MAAM,0BAAA,GAA6B,IAAI,UAAA,CAAiC;AAAA,EAC7E,IAAA,EAAM,kBAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAA6B;AAC1C,MAAA,OACE,GAAA,YAAe,gBACf,GAAA,CAAI,KAAA,CAAM,MAAM,CAAC,IAAA,KAAS,SAAS,YAAY,CAAA;AAAA,IAEnD,CAAA;AAAA,IACA,KAAA,EAAO,CAAC,YAAA,KAAiB;AACvB,MAAA,OAAO,aAAa,OAAA,CAAQ,MAAM,CAAA,IAAK,YAAA,CAAa,QAAQ,YAAY,CAAA;AAAA,IAC1E;AAAA,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,QAAA,KAAa;AACnB,MAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AACtC,MAAA,YAAA,CAAa,OAAA,CAAQ,QAAQ,QAAQ,CAAA;AACrC,MAAA,OAAO,YAAA;AAAA,IACT;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.mjs","sources":["../../../../../../../src/serialization/serializers/date.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\nimport { parseDate } from \"@internationalized/date\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nexport const calendarDateSerializer = new Serializer<CalendarDate, string>({\n name: \"CalendarDate\",\n serialize: {\n isApplicable: (val) => val instanceof CalendarDate,\n apply: (date) => date.toString(),\n },\n deserialize: {\n apply: (asString) => parseDate(asString),\n },\n});\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAA,GAAyB,IAAI,UAAA,CAAiC;AAAA,EACzE,IAAA,EAAM,cAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,GAAA,YAAe,YAAA;AAAA,IACtC,KAAA,EAAO,CAAC,IAAA,KAAS,IAAA,CAAK,QAAA;AAAS,GACjC;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,QAAA,KAAa,SAAA,CAAU,QAAQ;AAAA;AAE3C,CAAC;;;;"}
|
package/dist/js/{serialization → packages/remote-core/src/serialization}/serializers/file.mjs
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { markAsTransferable } from '@quilted/threads';
|
|
2
1
|
import { Serializer } from '../Serializer.mjs';
|
|
2
|
+
import { markAsTransferable } from '../../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs';
|
|
3
3
|
|
|
4
4
|
const isSerializedFile = (value) => {
|
|
5
5
|
return !!(value && typeof value === "object" && "name" in value && "type" in value && "lastModified" in value && "content" in value);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.mjs","sources":["../../../../../../../src/serialization/serializers/file.ts"],"sourcesContent":["import { markAsTransferable } from \"@quilted/threads\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nexport interface SerializedFile {\n name: string;\n type: string;\n lastModified: number;\n content: ArrayBuffer;\n}\n\nexport const isSerializedFile = (value: unknown): value is SerializedFile => {\n return !!(\n value &&\n typeof value === \"object\" &&\n \"name\" in value &&\n \"type\" in value &&\n \"lastModified\" in value &&\n \"content\" in value\n );\n};\n\nexport const fileSerialize = async (file: File): Promise<SerializedFile> => {\n return {\n name: file.name,\n type: file.type,\n lastModified: file.lastModified,\n content: markAsTransferable(await file.arrayBuffer()),\n };\n};\n\nexport const fileDeSerialize = (file: SerializedFile) => {\n return new File([file.content], file.name, {\n lastModified: file.lastModified,\n type: file.type,\n });\n};\n\nexport const fileSerializer = new Serializer<File, SerializedFile>({\n name: \"File\",\n serialize: {\n isApplicable: (something) => something instanceof File,\n apply: fileSerialize,\n },\n deserialize: {\n apply: fileDeSerialize,\n },\n});\n"],"names":[],"mappings":";;;AAUO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAA4C;AAC3E,EAAA,OAAO,CAAC,EACN,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,MAAA,IAAU,KAAA,IACV,MAAA,IAAU,KAAA,IACV,cAAA,IAAkB,KAAA,IAClB,SAAA,IAAa,KAAA,CAAA;AAEjB;AAEO,MAAM,aAAA,GAAgB,OAAO,IAAA,KAAwC;AAC1E,EAAA,OAAO;AAAA,IACL,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,cAAc,IAAA,CAAK,YAAA;AAAA,IACnB,OAAA,EAAS,kBAAA,CAAmB,MAAM,IAAA,CAAK,aAAa;AAAA,GACtD;AACF;AAEO,MAAM,eAAA,GAAkB,CAAC,IAAA,KAAyB;AACvD,EAAA,OAAO,IAAI,IAAA,CAAK,CAAC,KAAK,OAAO,CAAA,EAAG,KAAK,IAAA,EAAM;AAAA,IACzC,cAAc,IAAA,CAAK,YAAA;AAAA,IACnB,MAAM,IAAA,CAAK;AAAA,GACZ,CAAA;AACH;AAEO,MAAM,cAAA,GAAiB,IAAI,UAAA,CAAiC;AAAA,EACjE,IAAA,EAAM,MAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KAAc,SAAA,YAAqB,IAAA;AAAA,IAClD,KAAA,EAAO;AAAA,GACT;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO;AAAA;AAEX,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileList.mjs","sources":["../../../../../../../src/serialization/serializers/fileList.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n fileDeSerialize,\n fileSerialize,\n type SerializedFile,\n} from \"@/serialization/serializers\";\n\nexport const fileListSerializer = new Serializer<FileList, SerializedFile[]>({\n name: \"FileList\",\n serialize: {\n isApplicable: (something): something is FileList =>\n something instanceof FileList,\n apply: async (fileList) =>\n await Promise.all(Array.from(fileList, fileSerialize)),\n },\n deserialize: {\n apply: (arrayFiles) => {\n const dataTransfer = new DataTransfer();\n for (const file of arrayFiles) {\n dataTransfer.items.add(fileDeSerialize(file));\n }\n return dataTransfer.files;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAOO,MAAM,kBAAA,GAAqB,IAAI,UAAA,CAAuC;AAAA,EAC3E,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KACb,SAAA,YAAqB,QAAA;AAAA,IACvB,KAAA,EAAO,OAAO,QAAA,KACZ,MAAM,OAAA,CAAQ,IAAI,KAAA,CAAM,IAAA,CAAK,QAAA,EAAU,aAAa,CAAC;AAAA,GACzD;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,UAAA,KAAe;AACrB,MAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AACtC,MAAA,KAAA,MAAW,QAAQ,UAAA,EAAY;AAC7B,QAAA,YAAA,CAAa,KAAA,CAAM,GAAA,CAAI,eAAA,CAAgB,IAAI,CAAC,CAAA;AAAA,MAC9C;AACA,MAAA,OAAO,YAAA,CAAa,KAAA;AAAA,IACtB;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formData.mjs","sources":["../../../../../../../src/serialization/serializers/formData.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n fileDeSerialize,\n fileSerialize,\n isSerializedFile,\n} from \"@/serialization/serializers\";\n\ntype SerializedFormDataValue =\n | FormDataEntryValue\n | Awaited<ReturnType<typeof fileSerialize>>;\ntype SerializedFormDataEntries = [string, SerializedFormDataValue][];\n\nexport const formDataSerializer = new Serializer<\n FormData,\n SerializedFormDataEntries\n>({\n name: \"FormData\",\n serialize: {\n isApplicable: (val) => {\n return val instanceof FormData;\n },\n apply: async (formData) => {\n const out: SerializedFormDataEntries = [];\n\n for (const [fieldName, fieldValue] of formData.entries()) {\n out.push([\n fieldName,\n fieldValue instanceof File\n ? await fileSerialize(fieldValue)\n : fieldValue,\n ]);\n }\n\n return out;\n },\n },\n deserialize: {\n apply: (array) => {\n const formData = new FormData();\n\n for (const [name, value] of array) {\n const deserializedValue = isSerializedFile(value)\n ? fileDeSerialize(value)\n : value;\n\n formData.append(name, deserializedValue);\n }\n\n return formData;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAYO,MAAM,kBAAA,GAAqB,IAAI,UAAA,CAGpC;AAAA,EACA,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ;AACrB,MAAA,OAAO,GAAA,YAAe,QAAA;AAAA,IACxB,CAAA;AAAA,IACA,KAAA,EAAO,OAAO,QAAA,KAAa;AACzB,MAAA,MAAM,MAAiC,EAAC;AAExC,MAAA,KAAA,MAAW,CAAC,SAAA,EAAW,UAAU,CAAA,IAAK,QAAA,CAAS,SAAQ,EAAG;AACxD,QAAA,GAAA,CAAI,IAAA,CAAK;AAAA,UACP,SAAA;AAAA,UACA,UAAA,YAAsB,IAAA,GAClB,MAAM,aAAA,CAAc,UAAU,CAAA,GAC9B;AAAA,SACL,CAAA;AAAA,MACH;AAEA,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,KAAA,KAAU;AAChB,MAAA,MAAM,QAAA,GAAW,IAAI,QAAA,EAAS;AAE9B,MAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,CAAA,IAAK,KAAA,EAAO;AACjC,QAAA,MAAM,oBAAoB,gBAAA,CAAiB,KAAK,CAAA,GAC5C,eAAA,CAAgB,KAAK,CAAA,GACrB,KAAA;AAEJ,QAAA,QAAA,CAAS,MAAA,CAAO,MAAM,iBAAiB,CAAA;AAAA,MACzC;AAEA,MAAA,OAAO,QAAA;AAAA,IACT;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passwordPolicy.mjs","sources":["../../../../../../../src/serialization/serializers/passwordPolicy.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n Policy,\n type PolicyDeclaration,\n} from \"@mittwald/flow-react-components/mittwald-password-tools-js\";\n\nexport const passwordPolicySerializer = new Serializer<\n Policy,\n PolicyDeclaration\n>({\n name: \"PasswordPolicy\",\n serialize: {\n isApplicable: (val) => Policy.isPolicy(val),\n apply: (policy) => policy.toDeclaration(),\n },\n deserialize: {\n apply: (policyDeclaration) => Policy.fromDeclaration(policyDeclaration),\n },\n});\n"],"names":[],"mappings":";;;AAMO,MAAM,wBAAA,GAA2B,IAAI,UAAA,CAG1C;AAAA,EACA,IAAA,EAAM,gBAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,MAAA,CAAO,SAAS,GAAG,CAAA;AAAA,IAC1C,KAAA,EAAO,CAAC,MAAA,KAAW,MAAA,CAAO,aAAA;AAAc,GAC1C;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,iBAAA,KAAsB,MAAA,CAAO,gBAAgB,iBAAiB;AAAA;AAE1E,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim.mjs","sources":["../../../../../src/shim.ts"],"sourcesContent":["import { HTMLElement, customElements } from \"@lit-labs/ssr-dom-shim\";\n\nglobalThis.HTMLElement = HTMLElement;\nglobalThis.customElements = customElements;\nglobalThis.MutationObserver = class MutationObserver {\n public constructor() {\n // mocked\n }\n public disconnect() {\n // mocked\n }\n public observe() {\n // mocked\n }\n public takeRecords() {\n return [];\n }\n};\n"],"names":[],"mappings":";;AAEA,UAAA,CAAW,WAAA,GAAc,WAAA;AACzB,UAAA,CAAW,cAAA,GAAiB,cAAA;AAC5B,UAAA,CAAW,gBAAA,GAAmB,MAAM,gBAAA,CAAiB;AAAA,EAC5C,WAAA,GAAc;AAAA,EAErB;AAAA,EACO,UAAA,GAAa;AAAA,EAEpB;AAAA,EACO,OAAA,GAAU;AAAA,EAEjB;AAAA,EACO,WAAA,GAAc;AACnB,IAAA,OAAO,EAAC;AAAA,EACV;AACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-remote-core",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.897",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core functionality to setup a remote/host environment",
|
|
6
6
|
"homepage": "https://flow.mittwald.de",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"remeda": "^2.39.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@mittwald/ext-bridge": "0.2.0-alpha.
|
|
37
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.897",
|
|
38
38
|
"@mittwald/flow-core": "",
|
|
39
|
-
"@mittwald/flow-react-components": "0.2.0-alpha.
|
|
39
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.897",
|
|
40
40
|
"@mittwald/typescript-config": "",
|
|
41
41
|
"@types/node": "^25.9.3",
|
|
42
42
|
"nx": "^22.7.5",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"vitest": "^4.1.9"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@mittwald/ext-bridge": "0.2.0-alpha.
|
|
55
|
-
"@mittwald/flow-react-components": "0.2.0-alpha.
|
|
54
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.896",
|
|
55
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.896"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@mittwald/ext-bridge": {
|
|
59
59
|
"optional": true
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "93de98792cf43c7d0d6ef9d5907ae3fd8e6df09c"
|
|
63
63
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectHostRenderRoot.mjs","sources":["../../../src/connection/connectHostRenderRoot.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type RemoteExports,\n type RemoteToHostConnection,\n} from \"@/connection/types\";\nimport { RemoteError } from \"@/error\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport { type RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadNestedIframe } from \"@quilted/threads\";\n\ninterface Options {\n root: HTMLDivElement;\n onPathnameChanged?: (pathname: string) => void;\n}\n\nconst incompatibleParentFrameError = () =>\n new RemoteError(\"Could not find any compatible parent frame\");\n\nexport const connectRemoteReceiver = (\n root: HTMLDivElement,\n receiverConnection: RemoteConnection,\n) =>\n import(\"@mittwald/remote-dom-core/elements\").then(\n ({ RemoteMutationObserver }) => {\n const observer = new RemoteMutationObserver(receiverConnection);\n observer.observe(root);\n },\n );\n\nexport const connectHostRenderRoot = async (\n options: Options,\n): Promise<RemoteToHostConnection> => {\n const { root, onPathnameChanged } = options;\n\n const connection = new ThreadNestedIframe<HostExports, RemoteExports>({\n serialization: new FlowThreadSerialization(),\n exports: {\n render: (connection: RemoteConnection) =>\n connectRemoteReceiver(root, connection),\n setPathname: async (pathname) => {\n onPathnameChanged?.(pathname);\n },\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady(Version.v3);\n\n if (typeof mwExtBridge !== \"undefined\") {\n mwExtBridge.connection = connection.imports;\n await mwExtBridge.readiness.setIsReady();\n }\n\n return connection;\n } catch (error) {\n if (\n error instanceof Error &&\n /No '.*' method is exported from this thread/.test(error.message)\n ) {\n throw incompatibleParentFrameError();\n }\n throw error;\n }\n};\n\nexport const connectHostRenderRootRef =\n (opts: Omit<Options, \"root\">) => (ref: HTMLDivElement | null) => {\n if (ref === null) {\n return;\n }\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as Promise<RemoteToHostConnection>;\n }\n\n const connection = connectHostRenderRoot({\n root: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":["connection"],"mappings":";;;;;;AAgBA,MAAM,4BAAA,GAA+B,MACnC,IAAI,WAAA,CAAY,4CAA4C,CAAA;AAEvD,MAAM,wBAAwB,CACnC,IAAA,EACA,kBAAA,KAEA,OAAO,oCAAoC,CAAA,CAAE,IAAA;AAAA,EAC3C,CAAC,EAAE,sBAAA,EAAuB,KAAM;AAC9B,IAAA,MAAM,QAAA,GAAW,IAAI,sBAAA,CAAuB,kBAAkB,CAAA;AA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,IAAI,oBAAoB,CAAA;AAAA,EACjC;AAEA,EAAA,MAAM,aAAa,qBAAA,CAAsB;AAAA,IACvC,IAAA,EAAM,GAAA;AAAA,IACN,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectRemoteIframe.mjs","sources":["../../../src/connection/connectRemoteIframe.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type HostToRemoteConnection,\n type NavigationState,\n type RemoteExports,\n type RemoteExtBridgeConnectionApi,\n} from \"@/connection/types\";\nimport { getWithMergedHostConfig } from \"@/ext-bridge/getWithMergedHostConfig\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport { type HostConfig } from \"@mittwald/flow-core\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadIframe } from \"@quilted/threads\";\n\ninterface Options {\n connection: RemoteConnection;\n iframe: HTMLIFrameElement;\n hostConfig: HostConfig;\n onReady?: (connection: HostToRemoteConnection) => void;\n onLoadingChanged?: (isLoading: boolean) => void;\n onError?: (error: string) => void;\n onNavigationStateChanged?: (state: NavigationState) => void;\n extBridgeImplementation?: RemoteExtBridgeConnectionApi;\n}\n\nexport const connectRemoteIframe = (opts: Options): HostToRemoteConnection => {\n const {\n connection,\n iframe,\n onReady,\n onLoadingChanged,\n onError,\n onNavigationStateChanged,\n extBridgeImplementation: extBridgeImplementationProp = emptyImplementation,\n hostConfig,\n } = opts;\n\n const extBridgeImplementation = {\n ...extBridgeImplementationProp,\n getConfig: getWithMergedHostConfig(extBridgeImplementationProp, hostConfig),\n };\n\n const result = {\n thread: new ThreadIframe<RemoteExports, HostExports>(iframe, {\n serialization: new FlowThreadSerialization(),\n exports: {\n ...extBridgeImplementation,\n setIsReady: async (version = Version.v1) => {\n result.version = version;\n onReady?.(result);\n },\n setIsLoading: async (isLoading: boolean) => {\n onLoadingChanged?.(isLoading);\n },\n setError: async (error: string) => {\n onError?.(error);\n },\n setNavigationState: async (state) => {\n onNavigationStateChanged?.(state);\n },\n getHostConfig: async () => {\n return hostConfig;\n },\n },\n }),\n updateHostPathname: (hostPathname?: string) => {\n if (hostPathname === undefined) {\n return;\n }\n\n if (result.version >= Version.v2) {\n result.thread.imports.setPathname(hostPathname);\n }\n },\n version: 0,\n };\n\n result.thread.imports.render(connection);\n return result;\n};\n\nexport const connectRemoteIframeRef =\n (opts: Omit<Options, \"iframe\">) => (ref: HTMLIFrameElement | null) => {\n if (!ref) {\n return;\n }\n\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as HostToRemoteConnection;\n }\n\n const connection = connectRemoteIframe({\n iframe: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,mBAAA,GAAsB,CAAC,IAAA,KAA0C;AAC5E,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,gBAAA;AAAA,IACA,OAAA;AAAA,IACA,wBAAA;AAAA,IACA,yBAAyB,2BAAA,GAA8B,mBAAA;AAAA,IACvD;AAAA,GACF,GAAI,IAAA;AAEJ,EAAA,MAAM,uBAAA,GAA0B;AAAA,IAC9B,GAAG,2BAAA;AAAA,IACH,SAAA,EAAW,uBAAA,CAAwB,2BAAA,EAA6B,UAAU;AAAA,GAC5E;AAEA,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,IAAI,YAAA,CAAyC,MAAA,EAAQ;AAAA,MAC3D,aAAA,EAAe,IAAI,uBAAA,EAAwB;AAAA,MAC3C,OAAA,EAAS;AAAA,QACP,GAAG,uBAAA;AAAA,QACH,UAAA,EAAY,OAAO,O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,CAAA;AACD,EAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sources":["../../../src/connection/types.ts"],"sourcesContent":["import type {\n ExtBridgeConfigInput,\n ExtBridgeConnectionApi,\n} from \"@mittwald/ext-bridge\";\nimport type { HostConfig } from \"@mittwald/flow-core\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core\";\nimport type { ThreadIframe, ThreadNestedIframe } from \"@quilted/threads\";\nexport type { RemoteConnection } from \"@mittwald/remote-dom-core\";\n\nexport interface NavigationState {\n pathname: string;\n isPending: boolean;\n}\n\nexport type RemoteExtBridgeConfig = Omit<\n ExtBridgeConfigInput,\n keyof HostConfig\n>;\n\nexport interface RemoteExtBridgeConnectionApi extends Omit<\n ExtBridgeConnectionApi,\n \"getConfig\"\n> {\n getConfig: () => Promise<RemoteExtBridgeConfig>;\n}\n\n/**\n * Breaking Change warning: Do not remove/rename/modify existing properties of\n * this interface, as they might be used by existing extensions.\n *\n * When addding properties, make sure to release the host before all clients.\n */\nexport interface HostExports extends ExtBridgeConnectionApi {\n setIsReady: (version?: Version) => Promise<void>;\n setIsLoading: (isLoading: boolean) => Promise<void>;\n setError: (error: string) => Promise<void>;\n setNavigationState: (state: NavigationState) => Promise<void>;\n getHostConfig: () => Promise<HostConfig>;\n}\n\nexport interface RemoteExports {\n render: (connection: RemoteConnection) => Promise<void>;\n setPathname: (pathname: string) => Promise<void>;\n}\n\nexport type RemoteToHostConnection = ThreadNestedIframe<\n HostExports,\n RemoteExports\n>;\n\nexport interface HostToRemoteConnection {\n version: Version;\n thread: ThreadIframe<RemoteExports, HostExports>;\n updateHostPathname: (hostPathname?: string) => void;\n}\n\nexport enum Version {\n vUnknown = 0,\n v1 = 1,\n v2 = 2,\n v3 = 3,\n}\n"],"names":["Version"],"mappings":"AAwDO,IAAK,OAAA,qBAAAA,QAAAA,KAAL;AACL,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,cAAW,CAAA,CAAA,GAAX,UAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AAJU,EAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;;"}
|
package/dist/js/error.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.mjs","sources":["../../src/error.ts"],"sourcesContent":["export class RemoteError extends Error {\n constructor(message: string) {\n super(message);\n this.message = message;\n }\n}\n\nRemoteError.prototype.name = \"RemoteError\";\n"],"names":[],"mappings":"AAAO,MAAM,oBAAoB,KAAA,CAAM;AAAA,EACrC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF;AAEA,WAAA,CAAY,UAAU,IAAA,GAAO,aAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getWithMergedHostConfig.mjs","sources":["../../../src/ext-bridge/getWithMergedHostConfig.ts"],"sourcesContent":["import type { RemoteExtBridgeConnectionApi } from \"@/connection\";\nimport type { ExtBridgeConfigInput } from \"@mittwald/ext-bridge\";\nimport type { HostConfig } from \"@mittwald/flow-core\";\n\nexport const getWithMergedHostConfig =\n (extBridgeConnection: RemoteExtBridgeConnectionApi, hostConfig: HostConfig) =>\n async (): Promise<ExtBridgeConfigInput> => {\n const baseConfig = await extBridgeConnection.getConfig();\n\n return {\n ...hostConfig,\n ...baseConfig,\n };\n };\n"],"names":[],"mappings":"AAIO,MAAM,uBAAA,GACX,CAAC,mBAAA,EAAmD,UAAA,KACpD,YAA2C;AACzC,EAAA,MAAM,UAAA,GAAa,MAAM,mBAAA,CAAoB,SAAA,EAAU;AAEvD,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,GAAG;AAAA,GACL;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.mjs","sources":["../../../src/ext-bridge/implementation.ts"],"sourcesContent":["import { RemoteError } from \"@/error\";\nimport type { ExtBridgeConnectionApi } from \"@mittwald/ext-bridge\";\n\nexport const emptyImplementation = new Proxy(\n {},\n {\n get() {\n throw new RemoteError(\"Missing implementation for mittwald.extBridge\");\n },\n },\n) as ExtBridgeConnectionApi;\n"],"names":[],"mappings":";;AAGO,MAAM,sBAAsB,IAAI,KAAA;AAAA,EACrC,EAAC;AAAA,EACD;AAAA,IACE,GAAA,GAAM;AACJ,MAAA,MAAM,IAAI,YAAY,+CAA+C,CAAA;AAAA,IACvE;AAAA;AAEJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowThreadSerialization.mjs","sources":["../../../src/serialization/FlowThreadSerialization.ts"],"sourcesContent":["import {\n ThreadSerializationStructuredClone,\n type ThreadSerializationOptions,\n TRANSFERABLE,\n} from \"@quilted/threads\";\nimport * as serializerModules from \"./serializers\";\nimport { isObjectType } from \"remeda\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nconst serializers = Object.values(serializerModules).filter(\n (val) => val instanceof Serializer,\n);\n\nexport class FlowThreadSerialization extends ThreadSerializationStructuredClone {\n public constructor() {\n const options: ThreadSerializationOptions = {\n serialize: async (val, serialize) => {\n try {\n if (this.isSerializableByBase(val)) {\n return;\n }\n if (this.omitSerialization(val)) {\n return null;\n }\n for (const serializer of serializers) {\n const serialization = await serializer.serialize(val);\n\n if (serialization.applied) {\n return await serialize(serialization.result);\n }\n }\n\n if (isObjectType(val)) {\n return await serialize({ ...val });\n }\n\n return undefined;\n } catch (error) {\n console.error(\"Error while serializing\", error);\n throw error;\n }\n },\n\n deserialize: async (val, deserialize) => {\n try {\n for (const serializer of serializers) {\n const deserialization = await serializer.deserialize(val);\n\n if (deserialization.applied) {\n return deserialization.result.value;\n }\n }\n\n return await deserialize(val);\n } catch (error) {\n console.error(\"Error while deserializing\", error);\n throw error;\n }\n },\n };\n\n super(options);\n }\n\n private isSerializableByBase(val: unknown) {\n return (\n val instanceof Map ||\n val instanceof Set ||\n Array.isArray(val) ||\n typeof val === \"function\" ||\n (isObjectType(val) && TRANSFERABLE in val)\n );\n }\n\n private omitSerialization(val: unknown) {\n return val instanceof HTMLElement || val === window;\n }\n}\n"],"names":["serializerModules"],"mappings":";;;;;AASA,MAAM,WAAA,GAAc,MAAA,CAAO,MAAA,CAAOA,KAAiB,CAAA,CAAE,MAAA;AAAA,EACnD,CAAC,QAAQ,GAAA,YAAe;AAC1B,CAAA;AAEO,MAAM,gCAAgC,kCAAA,CAAmC;AAAA,EACvE,WAAA,GAAc;AACnB,IAAA,MAAM,OAAA,GAAsC;AAAA,MAC1C,SAAA,EAAW,OAAO,GAAA,EAAK,SAAA,KAAc;AACnC,QAAA,IAAI;AACF,UAAA,IAAI,IAAA,CAAK,oBAAA,CAAqB,GAAG,CAAA,EAAG;AAClC,YAAA;AAAA,UACF;AACA,UAAA,IAAI,IAAA,CAAK,iBAAA,CAAkB,GAAG,CAAA,EAAG;AAC/B,YAAA,OAAO,IAAA;AAAA,UACT;AACA,UAAA,KAAA,MAAW,cAAc,WAAA,EAAa;AACpC,YAAA,MAAM,aAAA,GAAgB,MAAM,UAAA,CAAW,SAAA,CAAU,GAAG,CAAA;AAEpD,YAAA,IAAI,cAAc,OAAA,EAAS;AACzB,cAAA,OAAO,MAAM,SAAA,CAAU,aAAA,CAAc,MAAM,CAAA;AAAA,YAC7C;AAAA,UACF;AAEA,UAAA,IAAI,YAAA,CAAa,GAAG,CAAA,EAAG;AACrB,YAAA,OAAO,MAAM,SAAA,CAAU,EAAE,GAAG,KAAK,CAAA;AAAA,UACnC;AAEA,UAAA,OAAO,KAAA,CAAA;AAAA,QACT,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF,CAAA;AAAA,MAEA,WAAA,EAAa,OAAO,GAAA,EAAK,WAAA,KAAgB;AACvC,QAAA,IAAI;AACF,UAAA,KAAA,MAAW,cAAc,WAAA,EAAa;AACpC,YAAA,MAAM,eAAA,GAAkB,MAAM,UAAA,CAAW,WAAA,CAAY,GAAG,CAAA;AAExD,YAAA,IAAI,gBAAgB,OAAA,EAAS;AAC3B,cAAA,OAAO,gBAAgB,MAAA,CAAO,KAAA;AAAA,YAChC;AAAA,UACF;AAEA,UAAA,OAAO,MAAM,YAAY,GAAG,CAAA;AAAA,QAC9B,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,KAAA,CAAM,6BAA6B,KAAK,CAAA;AAChD,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF;AAAA,KACF;AAEA,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA,EACf;AAAA,EAEQ,qBAAqB,GAAA,EAAc;AACzC,IAAA,OACE,GAAA,YAAe,GAAA,IACf,GAAA,YAAe,GAAA,IACf,MAAM,OAAA,CAAQ,GAAG,CAAA,IACjB,OAAO,GAAA,KAAQ,UAAA,IACd,YAAA,CAAa,GAAG,KAAK,YAAA,IAAgB,GAAA;AAAA,EAE1C;AAAA,EAEQ,kBAAkB,GAAA,EAAc;AACtC,IAAA,OAAO,GAAA,YAAe,eAAe,GAAA,KAAQ,MAAA;AAAA,EAC/C;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Serializer.mjs","sources":["../../../src/serialization/Serializer.ts"],"sourcesContent":["interface SerializationStrategy<TIn, TOut> {\n isApplicable: (val: unknown) => val is TIn;\n apply: (val: TIn) => TOut | Promise<TOut>;\n}\n\nconst Key = \"mittwald.flow-remote-core.serializer.name\";\n\nexport interface SuccessfulSerializationResult<T> {\n value: T;\n [Key]: string;\n}\n\nexport type SerializationResult<T> =\n | { applied: true; result: SuccessfulSerializationResult<T> }\n | { applied: false };\n\nexport class Serializer<TIn, TOut> {\n public constructor(\n private options: {\n name: string;\n serialize: SerializationStrategy<TIn, TOut>;\n deserialize: Pick<SerializationStrategy<TOut, TIn>, \"apply\">;\n },\n ) {}\n\n private async apply<TIn, TOut>(\n val: unknown,\n strategy: SerializationStrategy<TIn, TOut>,\n ): Promise<SerializationResult<TOut>> {\n if (!strategy.isApplicable(val)) {\n return { applied: false };\n }\n\n const resolved = await strategy.apply(val);\n\n return {\n applied: true,\n result: {\n [Key]: this.options.name,\n value: resolved,\n },\n };\n }\n\n public async serialize(val: unknown): Promise<SerializationResult<TOut>> {\n return this.apply<TIn, TOut>(val, this.options.serialize);\n }\n\n public async deserialize(val: unknown): Promise<SerializationResult<TIn>> {\n return this.apply(val, {\n isApplicable: (\n candidate,\n ): candidate is SuccessfulSerializationResult<TOut> =>\n !!candidate &&\n typeof candidate === \"object\" &&\n Key in candidate &&\n (candidate as never)[Key] === this.options.name,\n apply: (serialization) =>\n this.options.deserialize.apply(serialization.value),\n });\n }\n}\n"],"names":[],"mappings":"AAKA,MAAM,GAAA,GAAM,2CAAA;AAWL,MAAM,UAAA,CAAsB;AAAA,EAC1B,YACG,OAAA,EAKR;AALQ,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA,EAKP;AAAA,EALO,OAAA;AAAA,EAOV,MAAc,KAAA,CACZ,GAAA,EACA,QAAA,EACoC;AACpC,IAAA,IAAI,CAAC,QAAA,CAAS,YAAA,CAAa,GAAG,CAAA,EAAG;AAC/B,MAAA,OAAO,EAAE,SAAS,KAAA,EAAM;AAAA,IAC1B;AAEA,IAAA,MAAM,QAAA,GAAW,MAAM,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA;AAEzC,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,IAAA;AAAA,MACT,MAAA,EAAQ;AAAA,QACN,CAAC,GAAG,GAAG,IAAA,CAAK,OAAA,CAAQ,IAAA;AAAA,QACpB,KAAA,EAAO;AAAA;AACT,KACF;AAAA,EACF;AAAA,EAEA,MAAa,UAAU,GAAA,EAAkD;AACvE,IAAA,OAAO,IAAA,CAAK,KAAA,CAAiB,GAAA,EAAK,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA,EAC1D;AAAA,EAEA,MAAa,YAAY,GAAA,EAAiD;AACxE,IAAA,OAAO,IAAA,CAAK,MAAM,GAAA,EAAK;AAAA,MACrB,YAAA,EAAc,CACZ,SAAA,KAEA,CAAC,CAAC,SAAA,IACF,OAAO,SAAA,KAAc,QAAA,IACrB,OAAO,SAAA,IACN,SAAA,CAAoB,GAAG,CAAA,KAAM,KAAK,OAAA,CAAQ,IAAA;AAAA,MAC7C,KAAA,EAAO,CAAC,aAAA,KACN,IAAA,CAAK,QAAQ,WAAA,CAAY,KAAA,CAAM,cAAc,KAAK;AAAA,KACrD,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dataTransferText.mjs","sources":["../../../../src/serialization/serializers/dataTransferText.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\n\nexport const dataTransferTextSerializer = new Serializer<DataTransfer, string>({\n name: \"DataTransferText\",\n serialize: {\n isApplicable: (val): val is DataTransfer => {\n return (\n val instanceof DataTransfer &&\n val.types.every((type) => type === \"text/plain\")\n );\n },\n apply: (dataTransfer) => {\n return dataTransfer.getData(\"text\") || dataTransfer.getData(\"text/plain\");\n },\n },\n deserialize: {\n apply: (asString) => {\n const dataTransfer = new DataTransfer();\n dataTransfer.setData(\"text\", asString);\n return dataTransfer;\n },\n },\n});\n"],"names":[],"mappings":";;AAEO,MAAM,0BAAA,GAA6B,IAAI,UAAA,CAAiC;AAAA,EAC7E,IAAA,EAAM,kBAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAA6B;AAC1C,MAAA,OACE,GAAA,YAAe,gBACf,GAAA,CAAI,KAAA,CAAM,MAAM,CAAC,IAAA,KAAS,SAAS,YAAY,CAAA;AAAA,IAEnD,CAAA;AAAA,IACA,KAAA,EAAO,CAAC,YAAA,KAAiB;AACvB,MAAA,OAAO,aAAa,OAAA,CAAQ,MAAM,CAAA,IAAK,YAAA,CAAa,QAAQ,YAAY,CAAA;AAAA,IAC1E;AAAA,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,QAAA,KAAa;AACnB,MAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AACtC,MAAA,YAAA,CAAa,OAAA,CAAQ,QAAQ,QAAQ,CAAA;AACrC,MAAA,OAAO,YAAA;AAAA,IACT;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.mjs","sources":["../../../../src/serialization/serializers/date.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\nimport { parseDate } from \"@internationalized/date\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nexport const calendarDateSerializer = new Serializer<CalendarDate, string>({\n name: \"CalendarDate\",\n serialize: {\n isApplicable: (val) => val instanceof CalendarDate,\n apply: (date) => date.toString(),\n },\n deserialize: {\n apply: (asString) => parseDate(asString),\n },\n});\n"],"names":[],"mappings":";;;AAIO,MAAM,sBAAA,GAAyB,IAAI,UAAA,CAAiC;AAAA,EACzE,IAAA,EAAM,cAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,GAAA,YAAe,YAAA;AAAA,IACtC,KAAA,EAAO,CAAC,IAAA,KAAS,IAAA,CAAK,QAAA;AAAS,GACjC;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,QAAA,KAAa,SAAA,CAAU,QAAQ;AAAA;AAE3C,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file.mjs","sources":["../../../../src/serialization/serializers/file.ts"],"sourcesContent":["import { markAsTransferable } from \"@quilted/threads\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nexport interface SerializedFile {\n name: string;\n type: string;\n lastModified: number;\n content: ArrayBuffer;\n}\n\nexport const isSerializedFile = (value: unknown): value is SerializedFile => {\n return !!(\n value &&\n typeof value === \"object\" &&\n \"name\" in value &&\n \"type\" in value &&\n \"lastModified\" in value &&\n \"content\" in value\n );\n};\n\nexport const fileSerialize = async (file: File): Promise<SerializedFile> => {\n return {\n name: file.name,\n type: file.type,\n lastModified: file.lastModified,\n content: markAsTransferable(await file.arrayBuffer()),\n };\n};\n\nexport const fileDeSerialize = (file: SerializedFile) => {\n return new File([file.content], file.name, {\n lastModified: file.lastModified,\n type: file.type,\n });\n};\n\nexport const fileSerializer = new Serializer<File, SerializedFile>({\n name: \"File\",\n serialize: {\n isApplicable: (something) => something instanceof File,\n apply: fileSerialize,\n },\n deserialize: {\n apply: fileDeSerialize,\n },\n});\n"],"names":[],"mappings":";;;AAUO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAA4C;AAC3E,EAAA,OAAO,CAAC,EACN,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,MAAA,IAAU,KAAA,IACV,MAAA,IAAU,KAAA,IACV,cAAA,IAAkB,KAAA,IAClB,SAAA,IAAa,KAAA,CAAA;AAEjB;AAEO,MAAM,aAAA,GAAgB,OAAO,IAAA,KAAwC;AAC1E,EAAA,OAAO;AAAA,IACL,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,cAAc,IAAA,CAAK,YAAA;AAAA,IACnB,OAAA,EAAS,kBAAA,CAAmB,MAAM,IAAA,CAAK,aAAa;AAAA,GACtD;AACF;AAEO,MAAM,eAAA,GAAkB,CAAC,IAAA,KAAyB;AACvD,EAAA,OAAO,IAAI,IAAA,CAAK,CAAC,KAAK,OAAO,CAAA,EAAG,KAAK,IAAA,EAAM;AAAA,IACzC,cAAc,IAAA,CAAK,YAAA;AAAA,IACnB,MAAM,IAAA,CAAK;AAAA,GACZ,CAAA;AACH;AAEO,MAAM,cAAA,GAAiB,IAAI,UAAA,CAAiC;AAAA,EACjE,IAAA,EAAM,MAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KAAc,SAAA,YAAqB,IAAA;AAAA,IAClD,KAAA,EAAO;AAAA,GACT;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO;AAAA;AAEX,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileList.mjs","sources":["../../../../src/serialization/serializers/fileList.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n fileDeSerialize,\n fileSerialize,\n type SerializedFile,\n} from \"@/serialization/serializers\";\n\nexport const fileListSerializer = new Serializer<FileList, SerializedFile[]>({\n name: \"FileList\",\n serialize: {\n isApplicable: (something): something is FileList =>\n something instanceof FileList,\n apply: async (fileList) =>\n await Promise.all(Array.from(fileList, fileSerialize)),\n },\n deserialize: {\n apply: (arrayFiles) => {\n const dataTransfer = new DataTransfer();\n for (const file of arrayFiles) {\n dataTransfer.items.add(fileDeSerialize(file));\n }\n return dataTransfer.files;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAOO,MAAM,kBAAA,GAAqB,IAAI,UAAA,CAAuC;AAAA,EAC3E,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KACb,SAAA,YAAqB,QAAA;AAAA,IACvB,KAAA,EAAO,OAAO,QAAA,KACZ,MAAM,OAAA,CAAQ,IAAI,KAAA,CAAM,IAAA,CAAK,QAAA,EAAU,aAAa,CAAC;AAAA,GACzD;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,UAAA,KAAe;AACrB,MAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AACtC,MAAA,KAAA,MAAW,QAAQ,UAAA,EAAY;AAC7B,QAAA,YAAA,CAAa,KAAA,CAAM,GAAA,CAAI,eAAA,CAAgB,IAAI,CAAC,CAAA;AAAA,MAC9C;AACA,MAAA,OAAO,YAAA,CAAa,KAAA;AAAA,IACtB;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formData.mjs","sources":["../../../../src/serialization/serializers/formData.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n fileDeSerialize,\n fileSerialize,\n isSerializedFile,\n} from \"@/serialization/serializers\";\n\ntype SerializedFormDataValue =\n | FormDataEntryValue\n | Awaited<ReturnType<typeof fileSerialize>>;\ntype SerializedFormDataEntries = [string, SerializedFormDataValue][];\n\nexport const formDataSerializer = new Serializer<\n FormData,\n SerializedFormDataEntries\n>({\n name: \"FormData\",\n serialize: {\n isApplicable: (val) => {\n return val instanceof FormData;\n },\n apply: async (formData) => {\n const out: SerializedFormDataEntries = [];\n\n for (const [fieldName, fieldValue] of formData.entries()) {\n out.push([\n fieldName,\n fieldValue instanceof File\n ? await fileSerialize(fieldValue)\n : fieldValue,\n ]);\n }\n\n return out;\n },\n },\n deserialize: {\n apply: (array) => {\n const formData = new FormData();\n\n for (const [name, value] of array) {\n const deserializedValue = isSerializedFile(value)\n ? fileDeSerialize(value)\n : value;\n\n formData.append(name, deserializedValue);\n }\n\n return formData;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAYO,MAAM,kBAAA,GAAqB,IAAI,UAAA,CAGpC;AAAA,EACA,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ;AACrB,MAAA,OAAO,GAAA,YAAe,QAAA;AAAA,IACxB,CAAA;AAAA,IACA,KAAA,EAAO,OAAO,QAAA,KAAa;AACzB,MAAA,MAAM,MAAiC,EAAC;AAExC,MAAA,KAAA,MAAW,CAAC,SAAA,EAAW,UAAU,CAAA,IAAK,QAAA,CAAS,SAAQ,EAAG;AACxD,QAAA,GAAA,CAAI,IAAA,CAAK;AAAA,UACP,SAAA;AAAA,UACA,UAAA,YAAsB,IAAA,GAClB,MAAM,aAAA,CAAc,UAAU,CAAA,GAC9B;AAAA,SACL,CAAA;AAAA,MACH;AAEA,MAAA,OAAO,GAAA;AAAA,IACT;AAAA,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,KAAA,KAAU;AAChB,MAAA,MAAM,QAAA,GAAW,IAAI,QAAA,EAAS;AAE9B,MAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,CAAA,IAAK,KAAA,EAAO;AACjC,QAAA,MAAM,oBAAoB,gBAAA,CAAiB,KAAK,CAAA,GAC5C,eAAA,CAAgB,KAAK,CAAA,GACrB,KAAA;AAEJ,QAAA,QAAA,CAAS,MAAA,CAAO,MAAM,iBAAiB,CAAA;AAAA,MACzC;AAEA,MAAA,OAAO,QAAA;AAAA,IACT;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passwordPolicy.mjs","sources":["../../../../src/serialization/serializers/passwordPolicy.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n Policy,\n type PolicyDeclaration,\n} from \"@mittwald/flow-react-components/mittwald-password-tools-js\";\n\nexport const passwordPolicySerializer = new Serializer<\n Policy,\n PolicyDeclaration\n>({\n name: \"PasswordPolicy\",\n serialize: {\n isApplicable: (val) => Policy.isPolicy(val),\n apply: (policy) => policy.toDeclaration(),\n },\n deserialize: {\n apply: (policyDeclaration) => Policy.fromDeclaration(policyDeclaration),\n },\n});\n"],"names":[],"mappings":";;;AAMO,MAAM,wBAAA,GAA2B,IAAI,UAAA,CAG1C;AAAA,EACA,IAAA,EAAM,gBAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,MAAA,CAAO,SAAS,GAAG,CAAA;AAAA,IAC1C,KAAA,EAAO,CAAC,MAAA,KAAW,MAAA,CAAO,aAAA;AAAc,GAC1C;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,iBAAA,KAAsB,MAAA,CAAO,gBAAgB,iBAAiB;AAAA;AAE1E,CAAC;;;;"}
|
package/dist/js/shim.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shim.mjs","sources":["../../src/shim.ts"],"sourcesContent":["import { HTMLElement, customElements } from \"@lit-labs/ssr-dom-shim\";\n\nglobalThis.HTMLElement = HTMLElement;\nglobalThis.customElements = customElements;\nglobalThis.MutationObserver = class MutationObserver {\n public constructor() {\n // mocked\n }\n public disconnect() {\n // mocked\n }\n public observe() {\n // mocked\n }\n public takeRecords() {\n return [];\n }\n};\n"],"names":[],"mappings":";;AAEA,UAAA,CAAW,WAAA,GAAc,WAAA;AACzB,UAAA,CAAW,cAAA,GAAiB,cAAA;AAC5B,UAAA,CAAW,gBAAA,GAAmB,MAAM,gBAAA,CAAiB;AAAA,EAC5C,WAAA,GAAc;AAAA,EAErB;AAAA,EACO,UAAA,GAAa;AAAA,EAEpB;AAAA,EACO,OAAA,GAAU;AAAA,EAEjB;AAAA,EACO,WAAA,GAAc;AACnB,IAAA,OAAO,EAAC;AAAA,EACV;AACF,CAAA"}
|
|
File without changes
|
|
File without changes
|