@mittwald/flow-remote-core 0.2.0-alpha.1032 → 0.2.0-alpha.1034
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/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/js/index-node.mjs +21 -17
- package/dist/js/index-node.mjs.map +1 -1
- package/dist/js/index.mjs +24 -16
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs +33 -36
- package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/Thread.mjs +167 -225
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs +6 -9
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/errors.mjs +9 -7
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs +68 -67
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/nanoid.mjs +8 -8
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs +130 -210
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/shared.mjs +8 -6
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs +152 -159
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs +76 -84
- 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 -1
- 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 +117 -137
- 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 -1
- 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 +189 -208
- 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 -1
- 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 +6 -4
- 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 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs +12 -13
- 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 -1
- package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs +51 -61
- package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs +73 -101
- package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/connection/index.mjs +4 -0
- package/dist/js/packages/remote-core/src/connection/types.mjs +13 -11
- package/dist/js/packages/remote-core/src/connection/types.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/error.mjs +10 -8
- package/dist/js/packages/remote-core/src/error.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/events/remoteEvents.mjs +14 -16
- package/dist/js/packages/remote-core/src/events/remoteEvents.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs +10 -8
- package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs +8 -12
- package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs +49 -61
- package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/Serializer.mjs +31 -31
- package/dist/js/packages/remote-core/src/serialization/Serializer.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/index.mjs +10 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs +20 -21
- package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs +13 -14
- package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs +27 -28
- package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs +18 -22
- package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs +27 -34
- package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/index.mjs +23 -7
- package/dist/js/packages/remote-core/src/serialization/serializers/index.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs +13 -14
- package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/shim.mjs +32 -15
- package/dist/js/packages/remote-core/src/shim.mjs.map +1 -1
- package/dist/types/index-node.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/shim.d.ts +13 -1
- package/dist/types/shim.d.ts.map +1 -1
- package/package.json +9 -11
|
@@ -1 +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 onHostError?: (error: string) => void;\n packageVersion?: string;\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, onHostError, packageVersion } = 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 setHostError: async (error) => {\n onHostError?.(error);\n },\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady({\n version: Version.v5,\n packageVersion,\n });\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"],"
|
|
1
|
+
{"version":3,"file":"connectHostRenderRoot.mjs","names":[],"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 onHostError?: (error: string) => void;\n packageVersion?: string;\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, onHostError, packageVersion } = 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 setHostError: async (error) => {\n onHostError?.(error);\n },\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady({\n version: Version.v5,\n packageVersion,\n });\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"],"mappings":";;;;;;AAkBA,IAAM,qCACJ,IAAI,YAAY,4CAA4C;AAE9D,IAAa,yBACX,MACA,uBAEA,OAAO,qCAAqC,CAAC,MAC1C,EAAE,6BAA6B;CAE9B,IADqB,uBAAuB,kBAC5C,CAAA,CAAS,QAAQ,IAAI;AACvB,CACF;AAEF,IAAa,wBAAwB,OACnC,YACoC;CACpC,MAAM,EAAE,MAAM,mBAAmB,aAAa,mBAAmB;CAEjE,MAAM,aAAa,IAAI,mBAA+C;EACpE,eAAe,IAAI,wBAAwB;EAC3C,SAAS;GACP,SAAS,eACP,sBAAsB,MAAM,UAAU;GACxC,aAAa,OAAO,aAAa;IAC/B,oBAAoB,QAAQ;GAC9B;GACA,cAAc,OAAO,UAAU;IAC7B,cAAc,KAAK;GACrB;EACF;CACF,CAAC;CAED,IAAI,WAAW,WAAW,QACxB,MAAM,6BAA6B;CAGrC,IAAI;EACF,MAAM,WAAW,QAAQ,WAAW;GAClC,SAAS,QAAQ;GACjB;EACF,CAAC;EAED,IAAI,OAAO,gBAAgB,aAAa;GACtC,YAAY,aAAa,WAAW;GACpC,MAAM,YAAY,UAAU,WAAW;EACzC;EAEA,OAAO;CACT,SAAS,OAAO;EACd,IACE,iBAAiB,SACjB,8CAA8C,KAAK,MAAM,OAAO,GAEhE,MAAM,6BAA6B;EAErC,MAAM;CACR;AACF;AAEA,IAAa,4BACV,UAAiC,QAA+B;CAC/D,IAAI,QAAQ,MACV;CAEF,IAAI,wBAAwB,KAC1B,OAAO,IAAI;CAGb,MAAM,aAAa,sBAAsB;EACvC,MAAM;EACN,GAAG;CACL,CAAC;CACD,OAAO,OAAO,KAAK,EAAE,oBAAoB,WAAW,CAAC;CACrD,OAAO;AACT"}
|
|
@@ -1,105 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
version: event
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
return event ?? {
|
|
15
|
-
version: Version.v1
|
|
16
|
-
};
|
|
1
|
+
import { ThreadIframe } from "../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs";
|
|
2
|
+
import { FlowThreadSerialization } from "../serialization/FlowThreadSerialization.mjs";
|
|
3
|
+
import { Version } from "./types.mjs";
|
|
4
|
+
import { parseReportedEvent } from "../events/remoteEvents.mjs";
|
|
5
|
+
import { getWithMergedHostConfig } from "../ext-bridge/getWithMergedHostConfig.mjs";
|
|
6
|
+
import { emptyImplementation } from "../ext-bridge/implementation.mjs";
|
|
7
|
+
//#region src/connection/connectRemoteIframe.ts
|
|
8
|
+
var normalizeReadyEvent = (event) => {
|
|
9
|
+
if (typeof event === "number") return { version: event };
|
|
10
|
+
return event ?? { version: Version.v1 };
|
|
17
11
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}),
|
|
71
|
-
updateHostPathname: (hostPathname) => {
|
|
72
|
-
if (hostPathname === void 0) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (result.version >= Version.v2) {
|
|
76
|
-
result.thread.imports.setPathname(hostPathname);
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
reportHostError: async (error) => {
|
|
80
|
-
if (result.version >= Version.v5) {
|
|
81
|
-
await result.thread.imports.setHostError(error);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
version: 0
|
|
85
|
-
};
|
|
86
|
-
result.thread.imports.render(connection);
|
|
87
|
-
return result;
|
|
12
|
+
var connectRemoteIframe = (opts) => {
|
|
13
|
+
const { connection, iframe, onReady, onLoadingChanged, onError, onNavigationStateChanged, onDeprecation, onEvent, extBridgeImplementation: extBridgeImplementationProp = emptyImplementation, hostConfig } = opts;
|
|
14
|
+
const extBridgeImplementation = {
|
|
15
|
+
...extBridgeImplementationProp,
|
|
16
|
+
getConfig: getWithMergedHostConfig(extBridgeImplementationProp, hostConfig)
|
|
17
|
+
};
|
|
18
|
+
const result = {
|
|
19
|
+
thread: new ThreadIframe(iframe, {
|
|
20
|
+
serialization: new FlowThreadSerialization(),
|
|
21
|
+
exports: {
|
|
22
|
+
...extBridgeImplementation,
|
|
23
|
+
setIsReady: async (event) => {
|
|
24
|
+
const readyEvent = normalizeReadyEvent(event);
|
|
25
|
+
result.version = readyEvent.version;
|
|
26
|
+
onReady?.({
|
|
27
|
+
connection: result,
|
|
28
|
+
remoteReadyEvent: readyEvent
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
setIsLoading: async (isLoading) => {
|
|
32
|
+
onLoadingChanged?.(isLoading);
|
|
33
|
+
},
|
|
34
|
+
setError: async (error) => {
|
|
35
|
+
onError?.(error);
|
|
36
|
+
},
|
|
37
|
+
setNavigationState: async (state) => {
|
|
38
|
+
onNavigationStateChanged?.(state);
|
|
39
|
+
},
|
|
40
|
+
reportDeprecation: async (message) => {
|
|
41
|
+
onDeprecation?.(message);
|
|
42
|
+
},
|
|
43
|
+
reportEvent: async (event) => {
|
|
44
|
+
const parsed = parseReportedEvent(event);
|
|
45
|
+
if (parsed) onEvent?.(parsed);
|
|
46
|
+
},
|
|
47
|
+
getHostConfig: async () => {
|
|
48
|
+
return hostConfig;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
updateHostPathname: (hostPathname) => {
|
|
53
|
+
if (hostPathname === void 0) return;
|
|
54
|
+
if (result.version >= Version.v2) result.thread.imports.setPathname(hostPathname);
|
|
55
|
+
},
|
|
56
|
+
reportHostError: async (error) => {
|
|
57
|
+
if (result.version >= Version.v5) await result.thread.imports.setHostError(error);
|
|
58
|
+
},
|
|
59
|
+
version: 0
|
|
60
|
+
};
|
|
61
|
+
result.thread.imports.render(connection);
|
|
62
|
+
return result;
|
|
88
63
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
...opts
|
|
99
|
-
});
|
|
100
|
-
Object.assign(ref, { __remoteConnection: connection });
|
|
101
|
-
return connection;
|
|
64
|
+
var connectRemoteIframeRef = (opts) => (ref) => {
|
|
65
|
+
if (!ref) return;
|
|
66
|
+
if ("__remoteConnection" in ref) return ref["__remoteConnection"];
|
|
67
|
+
const connection = connectRemoteIframe({
|
|
68
|
+
iframe: ref,
|
|
69
|
+
...opts
|
|
70
|
+
});
|
|
71
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
72
|
+
return connection;
|
|
102
73
|
};
|
|
103
|
-
|
|
74
|
+
//#endregion
|
|
104
75
|
export { connectRemoteIframe, connectRemoteIframeRef };
|
|
105
|
-
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=connectRemoteIframe.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectRemoteIframe.mjs","sources":["../../../../../../src/connection/connectRemoteIframe.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type HostToRemoteConnection,\n type HostToRemoteConnectionReadyEvent,\n type NavigationState,\n type RemoteExports,\n type RemoteExtBridgeConnectionApi,\n type RemoteReadyEvent,\n type RemoteReadyEventInput,\n} from \"@/connection/types\";\nimport { parseReportedEvent, type ReportedEvent } from \"@/events/remoteEvents\";\nimport { getWithMergedHostConfig } from \"@/ext-bridge/getWithMergedHostConfig\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport type { HostConfig } from \"@mittwald/ext-bridge\";\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?: (event: HostToRemoteConnectionReadyEvent) => void;\n onLoadingChanged?: (isLoading: boolean) => void;\n onError?: (error: string) => void;\n onNavigationStateChanged?: (state: NavigationState) => void;\n onDeprecation?: (message: string) => void;\n onEvent?: (event: ReportedEvent) => void;\n extBridgeImplementation?: RemoteExtBridgeConnectionApi;\n}\n\nconst normalizeReadyEvent = (\n event?: RemoteReadyEventInput,\n): RemoteReadyEvent => {\n if (typeof event === \"number\") {\n return {\n version: event,\n };\n }\n\n return (\n event ?? {\n version: Version.v1,\n }\n );\n};\n\nexport const connectRemoteIframe = (opts: Options): HostToRemoteConnection => {\n const {\n connection,\n iframe,\n onReady,\n onLoadingChanged,\n onError,\n onNavigationStateChanged,\n onDeprecation,\n onEvent,\n extBridgeImplementation: extBridgeImplementationProp = emptyImplementation,\n hostConfig,\n } = opts;\n\n const extBridgeImplementation = {\n ...extBridgeImplementationProp,\n getConfig: getWithMergedHostConfig(extBridgeImplementationProp, hostConfig),\n };\n\n const result: HostToRemoteConnection = {\n thread: new ThreadIframe<RemoteExports, HostExports>(iframe, {\n serialization: new FlowThreadSerialization(),\n exports: {\n ...extBridgeImplementation,\n setIsReady: async (event) => {\n const readyEvent = normalizeReadyEvent(event);\n result.version = readyEvent.version;\n onReady?.({\n connection: result,\n remoteReadyEvent: readyEvent,\n });\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 reportDeprecation: async (message: string) => {\n onDeprecation?.(message);\n },\n reportEvent: async (event) => {\n const parsed = parseReportedEvent(event);\n if (parsed) {\n onEvent?.(parsed);\n }\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 reportHostError: async (error) => {\n if (result.version >= Version.v5) {\n await result.thread.imports.setHostError(error);\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"],"
|
|
1
|
+
{"version":3,"file":"connectRemoteIframe.mjs","names":[],"sources":["../../../../../../src/connection/connectRemoteIframe.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type HostToRemoteConnection,\n type HostToRemoteConnectionReadyEvent,\n type NavigationState,\n type RemoteExports,\n type RemoteExtBridgeConnectionApi,\n type RemoteReadyEvent,\n type RemoteReadyEventInput,\n} from \"@/connection/types\";\nimport { parseReportedEvent, type ReportedEvent } from \"@/events/remoteEvents\";\nimport { getWithMergedHostConfig } from \"@/ext-bridge/getWithMergedHostConfig\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport type { HostConfig } from \"@mittwald/ext-bridge\";\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?: (event: HostToRemoteConnectionReadyEvent) => void;\n onLoadingChanged?: (isLoading: boolean) => void;\n onError?: (error: string) => void;\n onNavigationStateChanged?: (state: NavigationState) => void;\n onDeprecation?: (message: string) => void;\n onEvent?: (event: ReportedEvent) => void;\n extBridgeImplementation?: RemoteExtBridgeConnectionApi;\n}\n\nconst normalizeReadyEvent = (\n event?: RemoteReadyEventInput,\n): RemoteReadyEvent => {\n if (typeof event === \"number\") {\n return {\n version: event,\n };\n }\n\n return (\n event ?? {\n version: Version.v1,\n }\n );\n};\n\nexport const connectRemoteIframe = (opts: Options): HostToRemoteConnection => {\n const {\n connection,\n iframe,\n onReady,\n onLoadingChanged,\n onError,\n onNavigationStateChanged,\n onDeprecation,\n onEvent,\n extBridgeImplementation: extBridgeImplementationProp = emptyImplementation,\n hostConfig,\n } = opts;\n\n const extBridgeImplementation = {\n ...extBridgeImplementationProp,\n getConfig: getWithMergedHostConfig(extBridgeImplementationProp, hostConfig),\n };\n\n const result: HostToRemoteConnection = {\n thread: new ThreadIframe<RemoteExports, HostExports>(iframe, {\n serialization: new FlowThreadSerialization(),\n exports: {\n ...extBridgeImplementation,\n setIsReady: async (event) => {\n const readyEvent = normalizeReadyEvent(event);\n result.version = readyEvent.version;\n onReady?.({\n connection: result,\n remoteReadyEvent: readyEvent,\n });\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 reportDeprecation: async (message: string) => {\n onDeprecation?.(message);\n },\n reportEvent: async (event) => {\n const parsed = parseReportedEvent(event);\n if (parsed) {\n onEvent?.(parsed);\n }\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 reportHostError: async (error) => {\n if (result.version >= Version.v5) {\n await result.thread.imports.setHostError(error);\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"],"mappings":";;;;;;;AAgCA,IAAM,uBACJ,UACqB;CACrB,IAAI,OAAO,UAAU,UACnB,OAAO,EACL,SAAS,MACX;CAGF,OACE,SAAS,EACP,SAAS,QAAQ,GACnB;AAEJ;AAEA,IAAa,uBAAuB,SAA0C;CAC5E,MAAM,EACJ,YACA,QACA,SACA,kBACA,SACA,0BACA,eACA,SACA,yBAAyB,8BAA8B,qBACvD,eACE;CAEJ,MAAM,0BAA0B;EAC9B,GAAG;EACH,WAAW,wBAAwB,6BAA6B,UAAU;CAC5E;CAEA,MAAM,SAAiC;EACrC,QAAQ,IAAI,aAAyC,QAAQ;GAC3D,eAAe,IAAI,wBAAwB;GAC3C,SAAS;IACP,GAAG;IACH,YAAY,OAAO,UAAU;KAC3B,MAAM,aAAa,oBAAoB,KAAK;KAC5C,OAAO,UAAU,WAAW;KAC5B,UAAU;MACR,YAAY;MACZ,kBAAkB;KACpB,CAAC;IACH;IACA,cAAc,OAAO,cAAuB;KAC1C,mBAAmB,SAAS;IAC9B;IACA,UAAU,OAAO,UAAkB;KACjC,UAAU,KAAK;IACjB;IACA,oBAAoB,OAAO,UAAU;KACnC,2BAA2B,KAAK;IAClC;IACA,mBAAmB,OAAO,YAAoB;KAC5C,gBAAgB,OAAO;IACzB;IACA,aAAa,OAAO,UAAU;KAC5B,MAAM,SAAS,mBAAmB,KAAK;KACvC,IAAI,QACF,UAAU,MAAM;IAEpB;IACA,eAAe,YAAY;KACzB,OAAO;IACT;GACF;EACF,CAAC;EACD,qBAAqB,iBAA0B;GAC7C,IAAI,iBAAiB,KAAA,GACnB;GAGF,IAAI,OAAO,WAAW,QAAQ,IAC5B,OAAO,OAAO,QAAQ,YAAY,YAAY;EAElD;EACA,iBAAiB,OAAO,UAAU;GAChC,IAAI,OAAO,WAAW,QAAQ,IAC5B,MAAM,OAAO,OAAO,QAAQ,aAAa,KAAK;EAElD;EACA,SAAS;CACX;CAEA,OAAO,OAAO,QAAQ,OAAO,UAAU;CACvC,OAAO;AACT;AAEA,IAAa,0BACV,UAAmC,QAAkC;CACpE,IAAI,CAAC,KACH;CAGF,IAAI,wBAAwB,KAC1B,OAAO,IAAI;CAGb,MAAM,aAAa,oBAAoB;EACrC,QAAQ;EACR,GAAG;CACL,CAAC;CACD,OAAO,OAAO,KAAK,EAAE,oBAAoB,WAAW,CAAC;CACrD,OAAO;AACT"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Version } from "./types.mjs";
|
|
2
|
+
import { connectHostRenderRoot, connectHostRenderRootRef, connectRemoteReceiver } from "./connectHostRenderRoot.mjs";
|
|
3
|
+
import { connectRemoteIframe, connectRemoteIframeRef } from "./connectRemoteIframe.mjs";
|
|
4
|
+
export { Version, connectHostRenderRoot, connectHostRenderRootRef, connectRemoteIframe, connectRemoteIframeRef, connectRemoteReceiver };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//#region src/connection/types.ts
|
|
2
|
+
var Version = /* @__PURE__ */ function(Version) {
|
|
3
|
+
Version[Version["vUnknown"] = 0] = "vUnknown";
|
|
4
|
+
Version[Version["v1"] = 1] = "v1";
|
|
5
|
+
Version[Version["v2"] = 2] = "v2";
|
|
6
|
+
Version[Version["v3"] = 3] = "v3";
|
|
7
|
+
Version[Version["v4"] = 4] = "v4";
|
|
8
|
+
Version[Version["v5"] = 5] = "v5";
|
|
9
|
+
return Version;
|
|
10
|
+
}({});
|
|
11
|
+
//#endregion
|
|
11
12
|
export { Version };
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sources":["../../../../../../src/connection/types.ts"],"sourcesContent":["import type {\n ExtBridgeConfigInput,\n ExtBridgeConnectionApi,\n HostConfig,\n} from \"@mittwald/ext-bridge\";\nimport type { ReportedEvent } from \"@/events/remoteEvents\";\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 interface RemoteReadyEvent {\n version: Version;\n packageVersion?: string;\n}\n\nexport type RemoteReadyEventInput = Version | RemoteReadyEvent;\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: (event?: RemoteReadyEventInput) => 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 reportDeprecation: (message: string) => Promise<void>;\n reportEvent: (event: ReportedEvent) => Promise<void>;\n}\n\nexport interface RemoteExports {\n render: (connection: RemoteConnection) => Promise<void>;\n setPathname: (pathname: string) => Promise<void>;\n setHostError: (error: 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 reportHostError: (error: string) => Promise<void>;\n}\n\nexport interface HostToRemoteConnectionReadyEvent {\n connection: HostToRemoteConnection;\n remoteReadyEvent: RemoteReadyEvent;\n}\n\nexport enum Version {\n vUnknown = 0,\n v1 = 1,\n v2 = 2,\n v3 = 3,\n v4 = 4,\n v5 = 5,\n}\n"],"
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../../../../../src/connection/types.ts"],"sourcesContent":["import type {\n ExtBridgeConfigInput,\n ExtBridgeConnectionApi,\n HostConfig,\n} from \"@mittwald/ext-bridge\";\nimport type { ReportedEvent } from \"@/events/remoteEvents\";\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 interface RemoteReadyEvent {\n version: Version;\n packageVersion?: string;\n}\n\nexport type RemoteReadyEventInput = Version | RemoteReadyEvent;\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: (event?: RemoteReadyEventInput) => 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 reportDeprecation: (message: string) => Promise<void>;\n reportEvent: (event: ReportedEvent) => Promise<void>;\n}\n\nexport interface RemoteExports {\n render: (connection: RemoteConnection) => Promise<void>;\n setPathname: (pathname: string) => Promise<void>;\n setHostError: (error: 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 reportHostError: (error: string) => Promise<void>;\n}\n\nexport interface HostToRemoteConnectionReadyEvent {\n connection: HostToRemoteConnection;\n remoteReadyEvent: RemoteReadyEvent;\n}\n\nexport enum Version {\n vUnknown = 0,\n v1 = 1,\n v2 = 2,\n v3 = 3,\n v4 = 4,\n v5 = 5,\n}\n"],"mappings":";AAyEA,IAAY,UAAL,yBAAA,SAAA;CACL,QAAA,QAAA,cAAA,KAAA;CACA,QAAA,QAAA,QAAA,KAAA;CACA,QAAA,QAAA,QAAA,KAAA;CACA,QAAA,QAAA,QAAA,KAAA;CACA,QAAA,QAAA,QAAA,KAAA;CACA,QAAA,QAAA,QAAA,KAAA;;AACF,EAAA,CAAA,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
//#region src/error.ts
|
|
2
|
+
var RemoteError = class extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.message = message;
|
|
6
|
+
}
|
|
7
|
+
};
|
|
7
8
|
RemoteError.prototype.name = "RemoteError";
|
|
8
|
-
|
|
9
|
+
//#endregion
|
|
9
10
|
export { RemoteError };
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=error.mjs.map
|
|
@@ -1 +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"],"
|
|
1
|
+
{"version":3,"file":"error.mjs","names":[],"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"],"mappings":";AAAA,IAAa,cAAb,cAAiC,MAAM;CACrC,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,UAAU;CACjB;AACF;AAEA,YAAY,UAAU,OAAO"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/events/remoteEvents.ts
|
|
3
|
+
var componentRenderedEventSchema = z.object({
|
|
4
|
+
event: z.literal("ComponentRendered"),
|
|
5
|
+
data: z.object({
|
|
6
|
+
/** Display name of the Flow component the extension rendered. */
|
|
7
|
+
component: z.string() })
|
|
9
8
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const result = reportedEventSchema.safeParse(event);
|
|
15
|
-
return result.success ? result.data : void 0;
|
|
9
|
+
var reportedEventSchema = z.discriminatedUnion("event", [componentRenderedEventSchema]);
|
|
10
|
+
var parseReportedEvent = (event) => {
|
|
11
|
+
const result = reportedEventSchema.safeParse(event);
|
|
12
|
+
return result.success ? result.data : void 0;
|
|
16
13
|
};
|
|
17
|
-
|
|
14
|
+
//#endregion
|
|
18
15
|
export { componentRenderedEventSchema, parseReportedEvent, reportedEventSchema };
|
|
19
|
-
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=remoteEvents.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteEvents.mjs","sources":["../../../../../../src/events/remoteEvents.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const componentRenderedEventSchema = z.object({\n event: z.literal(\"ComponentRendered\"),\n data: z.object({\n /** Display name of the Flow component the extension rendered. */\n component: z.string(),\n }),\n});\n\nexport const reportedEventSchema = z.discriminatedUnion(\"event\", [\n componentRenderedEventSchema,\n]);\n\nexport type ComponentRenderedEvent = z.infer<\n typeof componentRenderedEventSchema\n>;\n\nexport type ReportedEvent = z.infer<typeof reportedEventSchema>;\n\nexport const parseReportedEvent = (\n event: unknown,\n): ReportedEvent | undefined => {\n const result = reportedEventSchema.safeParse(event);\n return result.success ? result.data : undefined;\n};\n"],"
|
|
1
|
+
{"version":3,"file":"remoteEvents.mjs","names":[],"sources":["../../../../../../src/events/remoteEvents.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const componentRenderedEventSchema = z.object({\n event: z.literal(\"ComponentRendered\"),\n data: z.object({\n /** Display name of the Flow component the extension rendered. */\n component: z.string(),\n }),\n});\n\nexport const reportedEventSchema = z.discriminatedUnion(\"event\", [\n componentRenderedEventSchema,\n]);\n\nexport type ComponentRenderedEvent = z.infer<\n typeof componentRenderedEventSchema\n>;\n\nexport type ReportedEvent = z.infer<typeof reportedEventSchema>;\n\nexport const parseReportedEvent = (\n event: unknown,\n): ReportedEvent | undefined => {\n const result = reportedEventSchema.safeParse(event);\n return result.success ? result.data : undefined;\n};\n"],"mappings":";;AAEA,IAAa,+BAA+B,EAAE,OAAO;CACnD,OAAO,EAAE,QAAQ,mBAAmB;CACpC,MAAM,EAAE,OAAO;;AAEb,WAAW,EAAE,OAAO,EACtB,CAAC;AACH,CAAC;AAED,IAAa,sBAAsB,EAAE,mBAAmB,SAAS,CAC/D,4BACF,CAAC;AAQD,IAAa,sBACX,UAC8B;CAC9B,MAAM,SAAS,oBAAoB,UAAU,KAAK;CAClD,OAAO,OAAO,UAAU,OAAO,OAAO,KAAA;AACxC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/ext-bridge/getWithMergedHostConfig.ts
|
|
2
|
+
var getWithMergedHostConfig = (extBridgeConnection, hostConfig) => async () => {
|
|
3
|
+
const baseConfig = await extBridgeConnection.getConfig();
|
|
4
|
+
return {
|
|
5
|
+
...hostConfig,
|
|
6
|
+
...baseConfig
|
|
7
|
+
};
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
//#endregion
|
|
9
10
|
export { getWithMergedHostConfig };
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=getWithMergedHostConfig.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWithMergedHostConfig.mjs","sources":["../../../../../../src/ext-bridge/getWithMergedHostConfig.ts"],"sourcesContent":["import type { RemoteExtBridgeConnectionApi } from \"@/connection\";\nimport type { ExtBridgeConfigInput, HostConfig } from \"@mittwald/ext-bridge\";\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"],"
|
|
1
|
+
{"version":3,"file":"getWithMergedHostConfig.mjs","names":[],"sources":["../../../../../../src/ext-bridge/getWithMergedHostConfig.ts"],"sourcesContent":["import type { RemoteExtBridgeConnectionApi } from \"@/connection\";\nimport type { ExtBridgeConfigInput, HostConfig } from \"@mittwald/ext-bridge\";\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"],"mappings":";AAGA,IAAa,2BACV,qBAAmD,eACpD,YAA2C;CACzC,MAAM,aAAa,MAAM,oBAAoB,UAAU;CAEvD,OAAO;EACL,GAAG;EACH,GAAG;CACL;AACF"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { RemoteError } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throw new RemoteError("Missing implementation for mittwald.extBridge");
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
);
|
|
11
|
-
|
|
1
|
+
import { RemoteError } from "../error.mjs";
|
|
2
|
+
//#region src/ext-bridge/implementation.ts
|
|
3
|
+
var emptyImplementation = new Proxy({}, { get() {
|
|
4
|
+
throw new RemoteError("Missing implementation for mittwald.extBridge");
|
|
5
|
+
} });
|
|
6
|
+
//#endregion
|
|
12
7
|
export { emptyImplementation };
|
|
13
|
-
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=implementation.mjs.map
|
|
@@ -1 +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"],"
|
|
1
|
+
{"version":3,"file":"implementation.mjs","names":[],"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"],"mappings":";;AAGA,IAAa,sBAAsB,IAAI,MACrC,CAAC,GACD,EACE,MAAM;CACJ,MAAM,IAAI,YAAY,+CAA+C;AACvE,EACF,CACF"}
|
|
@@ -1,62 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
super(options);
|
|
52
|
-
}
|
|
53
|
-
isSerializableByBase(val) {
|
|
54
|
-
return val instanceof Map || val instanceof Set || Array.isArray(val) || typeof val === "function" || isObjectType(val) && TRANSFERABLE in val;
|
|
55
|
-
}
|
|
56
|
-
omitSerialization(val) {
|
|
57
|
-
return val instanceof HTMLElement || val === window;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
1
|
+
import { Serializer } from "./Serializer.mjs";
|
|
2
|
+
import { TRANSFERABLE } from "../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs";
|
|
3
|
+
import { ThreadSerializationStructuredClone } from "../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs";
|
|
4
|
+
import { serializers_exports } from "./serializers/index.mjs";
|
|
5
|
+
import { isObjectType } from "remeda";
|
|
6
|
+
//#region src/serialization/FlowThreadSerialization.ts
|
|
7
|
+
var serializers = Object.values(serializers_exports).filter((val) => val instanceof Serializer);
|
|
8
|
+
var FlowThreadSerialization = class extends ThreadSerializationStructuredClone {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
serialize: async (val, serialize) => {
|
|
12
|
+
try {
|
|
13
|
+
if (this.isSerializableByBase(val)) return;
|
|
14
|
+
if (this.omitSerialization(val)) return null;
|
|
15
|
+
for (const serializer of serializers) {
|
|
16
|
+
const serialization = await serializer.serialize(val);
|
|
17
|
+
if (serialization.applied) return await serialize(serialization.result);
|
|
18
|
+
}
|
|
19
|
+
if (isObjectType(val)) return await serialize({ ...val });
|
|
20
|
+
return;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error("Error while serializing", error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
deserialize: async (val, deserialize) => {
|
|
27
|
+
try {
|
|
28
|
+
for (const serializer of serializers) {
|
|
29
|
+
const deserialization = await serializer.deserialize(val);
|
|
30
|
+
if (deserialization.applied) return deserialization.result.value;
|
|
31
|
+
}
|
|
32
|
+
return await deserialize(val);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error("Error while deserializing", error);
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
isSerializableByBase(val) {
|
|
41
|
+
return val instanceof Map || val instanceof Set || Array.isArray(val) || typeof val === "function" || isObjectType(val) && TRANSFERABLE in val;
|
|
42
|
+
}
|
|
43
|
+
omitSerialization(val) {
|
|
44
|
+
return val instanceof HTMLElement || val === window;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
61
48
|
export { FlowThreadSerialization };
|
|
62
|
-
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=FlowThreadSerialization.mjs.map
|
|
@@ -1 +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"],"
|
|
1
|
+
{"version":3,"file":"FlowThreadSerialization.mjs","names":[],"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"],"mappings":";;;;;;AASA,IAAM,cAAc,OAAO,OAAO,mBAAiB,CAAC,CAAC,QAClD,QAAQ,eAAe,UAC1B;AAEA,IAAa,0BAAb,cAA6C,mCAAmC;CAC9E,cAAqB;EA+CnB,MAAM;GA7CJ,WAAW,OAAO,KAAK,cAAc;IACnC,IAAI;KACF,IAAI,KAAK,qBAAqB,GAAG,GAC/B;KAEF,IAAI,KAAK,kBAAkB,GAAG,GAC5B,OAAO;KAET,KAAK,MAAM,cAAc,aAAa;MACpC,MAAM,gBAAgB,MAAM,WAAW,UAAU,GAAG;MAEpD,IAAI,cAAc,SAChB,OAAO,MAAM,UAAU,cAAc,MAAM;KAE/C;KAEA,IAAI,aAAa,GAAG,GAClB,OAAO,MAAM,UAAU,EAAE,GAAG,IAAI,CAAC;KAGnC;IACF,SAAS,OAAO;KACd,QAAQ,MAAM,2BAA2B,KAAK;KAC9C,MAAM;IACR;GACF;GAEA,aAAa,OAAO,KAAK,gBAAgB;IACvC,IAAI;KACF,KAAK,MAAM,cAAc,aAAa;MACpC,MAAM,kBAAkB,MAAM,WAAW,YAAY,GAAG;MAExD,IAAI,gBAAgB,SAClB,OAAO,gBAAgB,OAAO;KAElC;KAEA,OAAO,MAAM,YAAY,GAAG;IAC9B,SAAS,OAAO;KACd,QAAQ,MAAM,6BAA6B,KAAK;KAChD,MAAM;IACR;GACF;EAGI,CAAO;CACf;CAEA,qBAA6B,KAAc;EACzC,OACE,eAAe,OACf,eAAe,OACf,MAAM,QAAQ,GAAG,KACjB,OAAO,QAAQ,cACd,aAAa,GAAG,KAAK,gBAAgB;CAE1C;CAEA,kBAA0B,KAAc;EACtC,OAAO,eAAe,eAAe,QAAQ;CAC/C;AACF"}
|