@mittwald/flow-remote-core 0.2.0-alpha.104 → 0.2.0-alpha.1041

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +2 -2
  2. package/dist/js/_virtual/_rolldown/runtime.mjs +13 -0
  3. package/dist/js/index-node.mjs +21 -0
  4. package/dist/js/index-node.mjs.map +1 -0
  5. package/dist/js/index.mjs +24 -0
  6. package/dist/js/index.mjs.map +1 -0
  7. package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs +35 -0
  8. package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs.map +1 -0
  9. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/Thread.mjs +173 -0
  10. 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
  11. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs +7 -0
  12. 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
  13. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/errors.mjs +10 -0
  14. 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
  15. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs +70 -0
  16. 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
  17. 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
  18. 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
  19. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs +132 -0
  20. 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
  21. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/shared.mjs +13 -0
  22. 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
  23. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs +154 -0
  24. 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
  25. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs +78 -0
  26. 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
  27. 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 +120 -0
  28. 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
  29. 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 +192 -0
  30. 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
  31. 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 +7 -0
  32. 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
  33. package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs +16 -0
  34. 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
  35. package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs +54 -0
  36. package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs.map +1 -0
  37. package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs +77 -0
  38. package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs.map +1 -0
  39. package/dist/js/packages/remote-core/src/connection/index.mjs +4 -0
  40. package/dist/js/packages/remote-core/src/connection/types.mjs +14 -0
  41. package/dist/js/packages/remote-core/src/connection/types.mjs.map +1 -0
  42. package/dist/js/packages/remote-core/src/error.mjs +12 -0
  43. package/dist/js/packages/remote-core/src/error.mjs.map +1 -0
  44. package/dist/js/packages/remote-core/src/events/remoteEvents.mjs +17 -0
  45. package/dist/js/packages/remote-core/src/events/remoteEvents.mjs.map +1 -0
  46. package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs +12 -0
  47. package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs.map +1 -0
  48. package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs +9 -0
  49. package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs.map +1 -0
  50. package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs +50 -0
  51. package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -0
  52. package/dist/js/packages/remote-core/src/serialization/Serializer.mjs +32 -0
  53. package/dist/js/packages/remote-core/src/serialization/Serializer.mjs.map +1 -0
  54. package/dist/js/packages/remote-core/src/serialization/index.mjs +10 -0
  55. package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs +22 -0
  56. package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs.map +1 -0
  57. package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs +15 -0
  58. package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs.map +1 -0
  59. package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs +32 -0
  60. package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs.map +1 -0
  61. package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs +20 -0
  62. package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs.map +1 -0
  63. package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs +29 -0
  64. package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs.map +1 -0
  65. package/dist/js/packages/remote-core/src/serialization/serializers/index.mjs +23 -0
  66. package/dist/js/packages/remote-core/src/serialization/serializers/index.mjs.map +1 -0
  67. package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs +15 -0
  68. package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs.map +1 -0
  69. package/dist/js/packages/remote-core/src/shim.mjs +33 -0
  70. package/dist/js/packages/remote-core/src/shim.mjs.map +1 -0
  71. package/dist/types/connection/connectHostRenderRoot.d.ts +11 -2
  72. package/dist/types/connection/connectHostRenderRoot.d.ts.map +1 -1
  73. package/dist/types/connection/connectRemoteIframe.d.ts +14 -8
  74. package/dist/types/connection/connectRemoteIframe.d.ts.map +1 -1
  75. package/dist/types/connection/types.d.ts +50 -5
  76. package/dist/types/connection/types.d.ts.map +1 -1
  77. package/dist/types/events/remoteEvents.d.ts +17 -0
  78. package/dist/types/events/remoteEvents.d.ts.map +1 -0
  79. package/dist/types/events/remoteEvents.test.d.ts +2 -0
  80. package/dist/types/events/remoteEvents.test.d.ts.map +1 -0
  81. package/dist/types/ext-bridge/getWithMergedHostConfig.d.ts +4 -0
  82. package/dist/types/ext-bridge/getWithMergedHostConfig.d.ts.map +1 -0
  83. package/dist/types/ext-bridge/implementation.d.ts +2 -2
  84. package/dist/types/ext-bridge/implementation.d.ts.map +1 -1
  85. package/dist/types/index-node.d.ts +2 -0
  86. package/dist/types/index-node.d.ts.map +1 -0
  87. package/dist/types/index.d.ts +4 -4
  88. package/dist/types/index.d.ts.map +1 -1
  89. package/dist/types/serialization/FlowThreadSerialization.d.ts +7 -0
  90. package/dist/types/serialization/FlowThreadSerialization.d.ts.map +1 -0
  91. package/dist/types/serialization/FlowThreadSerialization.test.d.ts +2 -0
  92. package/dist/types/serialization/FlowThreadSerialization.test.d.ts.map +1 -0
  93. package/dist/types/serialization/Serialization.test.d.ts +2 -0
  94. package/dist/types/serialization/Serialization.test.d.ts.map +1 -0
  95. package/dist/types/serialization/Serializer.d.ts +28 -0
  96. package/dist/types/serialization/Serializer.d.ts.map +1 -0
  97. package/dist/types/serialization/index.d.ts +4 -0
  98. package/dist/types/serialization/index.d.ts.map +1 -0
  99. package/dist/types/serialization/serializers/dataTransferText.d.ts +3 -0
  100. package/dist/types/serialization/serializers/dataTransferText.d.ts.map +1 -0
  101. package/dist/types/serialization/serializers/date.d.ts +4 -0
  102. package/dist/types/serialization/serializers/date.d.ts.map +1 -0
  103. package/dist/types/serialization/serializers/file.d.ts +12 -0
  104. package/dist/types/serialization/serializers/file.d.ts.map +1 -0
  105. package/dist/types/serialization/serializers/fileList.d.ts +4 -0
  106. package/dist/types/serialization/serializers/fileList.d.ts.map +1 -0
  107. package/dist/types/serialization/serializers/formData.d.ts +7 -0
  108. package/dist/types/serialization/serializers/formData.d.ts.map +1 -0
  109. package/dist/types/serialization/serializers/index.d.ts +7 -0
  110. package/dist/types/serialization/serializers/index.d.ts.map +1 -0
  111. package/dist/types/serialization/serializers/passwordPolicy.d.ts +4 -0
  112. package/dist/types/serialization/serializers/passwordPolicy.d.ts.map +1 -0
  113. package/dist/types/shim.d.ts +14 -0
  114. package/dist/types/shim.d.ts.map +1 -0
  115. package/dist/types/tests/utils.d.ts +2 -0
  116. package/dist/types/tests/utils.d.ts.map +1 -0
  117. package/package.json +29 -22
  118. package/dist/index.js +0 -100
  119. package/dist/types/events/FlowRemoteEvent.d.ts +0 -4
  120. package/dist/types/events/FlowRemoteEvent.d.ts.map +0 -1
  121. package/dist/types/events/index.d.ts +0 -5
  122. package/dist/types/events/index.d.ts.map +0 -1
  123. package/dist/types/events/serializers.d.ts +0 -5
  124. package/dist/types/events/serializers.d.ts.map +0 -1
  125. package/dist/types/ext-bridge/delegateExtBridgeRemoteFunctions.d.ts +0 -4
  126. package/dist/types/ext-bridge/delegateExtBridgeRemoteFunctions.d.ts.map +0 -1
@@ -0,0 +1,54 @@
1
+ import { ThreadNestedIframe } from "../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs";
2
+ import { FlowThreadSerialization } from "../serialization/FlowThreadSerialization.mjs";
3
+ import { Version } from "./types.mjs";
4
+ import { RemoteError } from "../error.mjs";
5
+ import "@mittwald/remote-dom-core/elements";
6
+ //#region src/connection/connectHostRenderRoot.ts
7
+ var incompatibleParentFrameError = () => new RemoteError("Could not find any compatible parent frame");
8
+ var connectRemoteReceiver = (root, receiverConnection) => import("@mittwald/remote-dom-core/elements").then(({ RemoteMutationObserver }) => {
9
+ new RemoteMutationObserver(receiverConnection).observe(root);
10
+ });
11
+ var connectHostRenderRoot = async (options) => {
12
+ const { root, onPathnameChanged, onHostError, packageVersion } = options;
13
+ const connection = new ThreadNestedIframe({
14
+ serialization: new FlowThreadSerialization(),
15
+ exports: {
16
+ render: (connection) => connectRemoteReceiver(root, connection),
17
+ setPathname: async (pathname) => {
18
+ onPathnameChanged?.(pathname);
19
+ },
20
+ setHostError: async (error) => {
21
+ onHostError?.(error);
22
+ }
23
+ }
24
+ });
25
+ if (connection.parent === window) throw incompatibleParentFrameError();
26
+ try {
27
+ await connection.imports.setIsReady({
28
+ version: Version.v5,
29
+ packageVersion
30
+ });
31
+ if (typeof mwExtBridge !== "undefined") {
32
+ mwExtBridge.connection = connection.imports;
33
+ await mwExtBridge.readiness.setIsReady();
34
+ }
35
+ return connection;
36
+ } catch (error) {
37
+ if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) throw incompatibleParentFrameError();
38
+ throw error;
39
+ }
40
+ };
41
+ var connectHostRenderRootRef = (opts) => (ref) => {
42
+ if (ref === null) return;
43
+ if ("__remoteConnection" in ref) return ref["__remoteConnection"];
44
+ const connection = connectHostRenderRoot({
45
+ root: ref,
46
+ ...opts
47
+ });
48
+ Object.assign(ref, { __remoteConnection: connection });
49
+ return connection;
50
+ };
51
+ //#endregion
52
+ export { connectHostRenderRoot, connectHostRenderRootRef, connectRemoteReceiver };
53
+
54
+ //# sourceMappingURL=connectHostRenderRoot.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,77 @@
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 };
11
+ };
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;
63
+ };
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;
73
+ };
74
+ //#endregion
75
+ export { connectRemoteIframe, connectRemoteIframeRef };
76
+
77
+ //# sourceMappingURL=connectRemoteIframe.mjs.map
@@ -0,0 +1 @@
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 };
@@ -0,0 +1,14 @@
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
12
+ export { Version };
13
+
14
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,12 @@
1
+ //#region src/error.ts
2
+ var RemoteError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.message = message;
6
+ }
7
+ };
8
+ RemoteError.prototype.name = "RemoteError";
9
+ //#endregion
10
+ export { RemoteError };
11
+
12
+ //# sourceMappingURL=error.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,17 @@
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() })
8
+ });
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;
13
+ };
14
+ //#endregion
15
+ export { componentRenderedEventSchema, parseReportedEvent, reportedEventSchema };
16
+
17
+ //# sourceMappingURL=remoteEvents.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,12 @@
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
+ };
8
+ };
9
+ //#endregion
10
+ export { getWithMergedHostConfig };
11
+
12
+ //# sourceMappingURL=getWithMergedHostConfig.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,9 @@
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
7
+ export { emptyImplementation };
8
+
9
+ //# sourceMappingURL=implementation.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,50 @@
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
48
+ export { FlowThreadSerialization };
49
+
50
+ //# sourceMappingURL=FlowThreadSerialization.mjs.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,32 @@
1
+ //#region src/serialization/Serializer.ts
2
+ var Key = "mittwald.flow-remote-core.serializer.name";
3
+ var Serializer = class {
4
+ options;
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+ async apply(val, strategy) {
9
+ if (!strategy.isApplicable(val)) return { applied: false };
10
+ const resolved = await strategy.apply(val);
11
+ return {
12
+ applied: true,
13
+ result: {
14
+ [Key]: this.options.name,
15
+ value: resolved
16
+ }
17
+ };
18
+ }
19
+ async serialize(val) {
20
+ return this.apply(val, this.options.serialize);
21
+ }
22
+ async deserialize(val) {
23
+ return this.apply(val, {
24
+ isApplicable: (candidate) => !!candidate && typeof candidate === "object" && Key in candidate && candidate[Key] === this.options.name,
25
+ apply: (serialization) => this.options.deserialize.apply(serialization.value)
26
+ });
27
+ }
28
+ };
29
+ //#endregion
30
+ export { Serializer };
31
+
32
+ //# sourceMappingURL=Serializer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Serializer.mjs","names":[],"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"],"mappings":";AAKA,IAAM,MAAM;AAWZ,IAAa,aAAb,MAAmC;CAEvB;CADV,YACE,SAKA;EALQ,KAAA,UAAA;CAKP;CAEH,MAAc,MACZ,KACA,UACoC;EACpC,IAAI,CAAC,SAAS,aAAa,GAAG,GAC5B,OAAO,EAAE,SAAS,MAAM;EAG1B,MAAM,WAAW,MAAM,SAAS,MAAM,GAAG;EAEzC,OAAO;GACL,SAAS;GACT,QAAQ;KACL,MAAM,KAAK,QAAQ;IACpB,OAAO;GACT;EACF;CACF;CAEA,MAAa,UAAU,KAAkD;EACvE,OAAO,KAAK,MAAiB,KAAK,KAAK,QAAQ,SAAS;CAC1D;CAEA,MAAa,YAAY,KAAiD;EACxE,OAAO,KAAK,MAAM,KAAK;GACrB,eACE,cAEA,CAAC,CAAC,aACF,OAAO,cAAc,YACrB,OAAO,aACN,UAAoB,SAAS,KAAK,QAAQ;GAC7C,QAAQ,kBACN,KAAK,QAAQ,YAAY,MAAM,cAAc,KAAK;EACtD,CAAC;CACH;AACF"}
@@ -0,0 +1,10 @@
1
+ import { Serializer } from "./Serializer.mjs";
2
+ import { calendarDateSerializer } from "./serializers/date.mjs";
3
+ import { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile } from "./serializers/file.mjs";
4
+ import { fileListSerializer } from "./serializers/fileList.mjs";
5
+ import { dataTransferTextSerializer } from "./serializers/dataTransferText.mjs";
6
+ import { formDataSerializer } from "./serializers/formData.mjs";
7
+ import { passwordPolicySerializer } from "./serializers/passwordPolicy.mjs";
8
+ import "./serializers/index.mjs";
9
+ import { FlowThreadSerialization } from "./FlowThreadSerialization.mjs";
10
+ export { FlowThreadSerialization, Serializer, calendarDateSerializer, dataTransferTextSerializer, fileDeSerialize, fileListSerializer, fileSerialize, fileSerializer, formDataSerializer, isSerializedFile, passwordPolicySerializer };
@@ -0,0 +1,22 @@
1
+ import { Serializer } from "../Serializer.mjs";
2
+ //#region src/serialization/serializers/dataTransferText.ts
3
+ var dataTransferTextSerializer = new Serializer({
4
+ name: "DataTransferText",
5
+ serialize: {
6
+ isApplicable: (val) => {
7
+ return val instanceof DataTransfer && val.types.every((type) => type === "text/plain");
8
+ },
9
+ apply: (dataTransfer) => {
10
+ return dataTransfer.getData("text") || dataTransfer.getData("text/plain");
11
+ }
12
+ },
13
+ deserialize: { apply: (asString) => {
14
+ const dataTransfer = new DataTransfer();
15
+ dataTransfer.setData("text", asString);
16
+ return dataTransfer;
17
+ } }
18
+ });
19
+ //#endregion
20
+ export { dataTransferTextSerializer };
21
+
22
+ //# sourceMappingURL=dataTransferText.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataTransferText.mjs","names":[],"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"],"mappings":";;AAEA,IAAa,6BAA6B,IAAI,WAAiC;CAC7E,MAAM;CACN,WAAW;EACT,eAAe,QAA6B;GAC1C,OACE,eAAe,gBACf,IAAI,MAAM,OAAO,SAAS,SAAS,YAAY;EAEnD;EACA,QAAQ,iBAAiB;GACvB,OAAO,aAAa,QAAQ,MAAM,KAAK,aAAa,QAAQ,YAAY;EAC1E;CACF;CACA,aAAa,EACX,QAAQ,aAAa;EACnB,MAAM,eAAe,IAAI,aAAa;EACtC,aAAa,QAAQ,QAAQ,QAAQ;EACrC,OAAO;CACT,EACF;AACF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Serializer } from "../Serializer.mjs";
2
+ import { CalendarDate, parseDate } from "@internationalized/date";
3
+ //#region src/serialization/serializers/date.ts
4
+ var calendarDateSerializer = new Serializer({
5
+ name: "CalendarDate",
6
+ serialize: {
7
+ isApplicable: (val) => val instanceof CalendarDate,
8
+ apply: (date) => date.toString()
9
+ },
10
+ deserialize: { apply: (asString) => parseDate(asString) }
11
+ });
12
+ //#endregion
13
+ export { calendarDateSerializer };
14
+
15
+ //# sourceMappingURL=date.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.mjs","names":[],"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"],"mappings":";;;AAIA,IAAa,yBAAyB,IAAI,WAAiC;CACzE,MAAM;CACN,WAAW;EACT,eAAe,QAAQ,eAAe;EACtC,QAAQ,SAAS,KAAK,SAAS;CACjC;CACA,aAAa,EACX,QAAQ,aAAa,UAAU,QAAQ,EACzC;AACF,CAAC"}
@@ -0,0 +1,32 @@
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
+ //#region src/serialization/serializers/file.ts
4
+ var isSerializedFile = (value) => {
5
+ return !!(value && typeof value === "object" && "name" in value && "type" in value && "lastModified" in value && "content" in value);
6
+ };
7
+ var fileSerialize = async (file) => {
8
+ return {
9
+ name: file.name,
10
+ type: file.type,
11
+ lastModified: file.lastModified,
12
+ content: markAsTransferable(await file.arrayBuffer())
13
+ };
14
+ };
15
+ var fileDeSerialize = (file) => {
16
+ return new File([file.content], file.name, {
17
+ lastModified: file.lastModified,
18
+ type: file.type
19
+ });
20
+ };
21
+ var fileSerializer = new Serializer({
22
+ name: "File",
23
+ serialize: {
24
+ isApplicable: (something) => something instanceof File,
25
+ apply: fileSerialize
26
+ },
27
+ deserialize: { apply: fileDeSerialize }
28
+ });
29
+ //#endregion
30
+ export { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile };
31
+
32
+ //# sourceMappingURL=file.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.mjs","names":[],"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"],"mappings":";;;AAUA,IAAa,oBAAoB,UAA4C;CAC3E,OAAO,CAAC,EACN,SACA,OAAO,UAAU,YACjB,UAAU,SACV,UAAU,SACV,kBAAkB,SAClB,aAAa;AAEjB;AAEA,IAAa,gBAAgB,OAAO,SAAwC;CAC1E,OAAO;EACL,MAAM,KAAK;EACX,MAAM,KAAK;EACX,cAAc,KAAK;EACnB,SAAS,mBAAmB,MAAM,KAAK,YAAY,CAAC;CACtD;AACF;AAEA,IAAa,mBAAmB,SAAyB;CACvD,OAAO,IAAI,KAAK,CAAC,KAAK,OAAO,GAAG,KAAK,MAAM;EACzC,cAAc,KAAK;EACnB,MAAM,KAAK;CACb,CAAC;AACH;AAEA,IAAa,iBAAiB,IAAI,WAAiC;CACjE,MAAM;CACN,WAAW;EACT,eAAe,cAAc,qBAAqB;EAClD,OAAO;CACT;CACA,aAAa,EACX,OAAO,gBACT;AACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Serializer } from "../Serializer.mjs";
2
+ import { fileDeSerialize, fileSerialize } from "./file.mjs";
3
+ import "./index.mjs";
4
+ //#region src/serialization/serializers/fileList.ts
5
+ var fileListSerializer = new Serializer({
6
+ name: "FileList",
7
+ serialize: {
8
+ isApplicable: (something) => something instanceof FileList,
9
+ apply: async (fileList) => await Promise.all(Array.from(fileList, fileSerialize))
10
+ },
11
+ deserialize: { apply: (arrayFiles) => {
12
+ const dataTransfer = new DataTransfer();
13
+ for (const file of arrayFiles) dataTransfer.items.add(fileDeSerialize(file));
14
+ return dataTransfer.files;
15
+ } }
16
+ });
17
+ //#endregion
18
+ export { fileListSerializer };
19
+
20
+ //# sourceMappingURL=fileList.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileList.mjs","names":[],"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"],"mappings":";;;;AAOA,IAAa,qBAAqB,IAAI,WAAuC;CAC3E,MAAM;CACN,WAAW;EACT,eAAe,cACb,qBAAqB;EACvB,OAAO,OAAO,aACZ,MAAM,QAAQ,IAAI,MAAM,KAAK,UAAU,aAAa,CAAC;CACzD;CACA,aAAa,EACX,QAAQ,eAAe;EACrB,MAAM,eAAe,IAAI,aAAa;EACtC,KAAK,MAAM,QAAQ,YACjB,aAAa,MAAM,IAAI,gBAAgB,IAAI,CAAC;EAE9C,OAAO,aAAa;CACtB,EACF;AACF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { Serializer } from "../Serializer.mjs";
2
+ import { fileDeSerialize, fileSerialize, isSerializedFile } from "./file.mjs";
3
+ import "./index.mjs";
4
+ //#region src/serialization/serializers/formData.ts
5
+ var formDataSerializer = new Serializer({
6
+ name: "FormData",
7
+ serialize: {
8
+ isApplicable: (val) => {
9
+ return val instanceof FormData;
10
+ },
11
+ apply: async (formData) => {
12
+ const out = [];
13
+ for (const [fieldName, fieldValue] of formData.entries()) out.push([fieldName, fieldValue instanceof File ? await fileSerialize(fieldValue) : fieldValue]);
14
+ return out;
15
+ }
16
+ },
17
+ deserialize: { apply: (array) => {
18
+ const formData = new FormData();
19
+ for (const [name, value] of array) {
20
+ const deserializedValue = isSerializedFile(value) ? fileDeSerialize(value) : value;
21
+ formData.append(name, deserializedValue);
22
+ }
23
+ return formData;
24
+ } }
25
+ });
26
+ //#endregion
27
+ export { formDataSerializer };
28
+
29
+ //# sourceMappingURL=formData.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formData.mjs","names":[],"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"],"mappings":";;;;AAYA,IAAa,qBAAqB,IAAI,WAGpC;CACA,MAAM;CACN,WAAW;EACT,eAAe,QAAQ;GACrB,OAAO,eAAe;EACxB;EACA,OAAO,OAAO,aAAa;GACzB,MAAM,MAAiC,CAAC;GAExC,KAAK,MAAM,CAAC,WAAW,eAAe,SAAS,QAAQ,GACrD,IAAI,KAAK,CACP,WACA,sBAAsB,OAClB,MAAM,cAAc,UAAU,IAC9B,UACN,CAAC;GAGH,OAAO;EACT;CACF;CACA,aAAa,EACX,QAAQ,UAAU;EAChB,MAAM,WAAW,IAAI,SAAS;EAE9B,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO;GACjC,MAAM,oBAAoB,iBAAiB,KAAK,IAC5C,gBAAgB,KAAK,IACrB;GAEJ,SAAS,OAAO,MAAM,iBAAiB;EACzC;EAEA,OAAO;CACT,EACF;AACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { __exportAll } from "../../../../../_virtual/_rolldown/runtime.mjs";
2
+ import { calendarDateSerializer } from "./date.mjs";
3
+ import { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile } from "./file.mjs";
4
+ import { fileListSerializer } from "./fileList.mjs";
5
+ import { dataTransferTextSerializer } from "./dataTransferText.mjs";
6
+ import { formDataSerializer } from "./formData.mjs";
7
+ import { passwordPolicySerializer } from "./passwordPolicy.mjs";
8
+ //#region src/serialization/serializers/index.ts
9
+ var serializers_exports = /* @__PURE__ */ __exportAll({
10
+ calendarDateSerializer: () => calendarDateSerializer,
11
+ dataTransferTextSerializer: () => dataTransferTextSerializer,
12
+ fileDeSerialize: () => fileDeSerialize,
13
+ fileListSerializer: () => fileListSerializer,
14
+ fileSerialize: () => fileSerialize,
15
+ fileSerializer: () => fileSerializer,
16
+ formDataSerializer: () => formDataSerializer,
17
+ isSerializedFile: () => isSerializedFile,
18
+ passwordPolicySerializer: () => passwordPolicySerializer
19
+ });
20
+ //#endregion
21
+ export { calendarDateSerializer, dataTransferTextSerializer, fileDeSerialize, fileListSerializer, fileSerialize, fileSerializer, formDataSerializer, isSerializedFile, passwordPolicySerializer, serializers_exports };
22
+
23
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../src/serialization/serializers/index.ts"],"sourcesContent":["export * from \"./date\";\nexport * from \"./file\";\nexport * from \"./fileList\";\nexport * from \"./dataTransferText\";\nexport * from \"./formData\";\nexport * from \"./passwordPolicy\";\n"],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { Serializer } from "../Serializer.mjs";
2
+ import { Policy } from "@mittwald/flow-react-components/mittwald-password-tools-js";
3
+ //#region src/serialization/serializers/passwordPolicy.ts
4
+ var passwordPolicySerializer = new Serializer({
5
+ name: "PasswordPolicy",
6
+ serialize: {
7
+ isApplicable: (val) => Policy.isPolicy(val),
8
+ apply: (policy) => policy.toDeclaration()
9
+ },
10
+ deserialize: { apply: (policyDeclaration) => Policy.fromDeclaration(policyDeclaration) }
11
+ });
12
+ //#endregion
13
+ export { passwordPolicySerializer };
14
+
15
+ //# sourceMappingURL=passwordPolicy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passwordPolicy.mjs","names":[],"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"],"mappings":";;;AAMA,IAAa,2BAA2B,IAAI,WAG1C;CACA,MAAM;CACN,WAAW;EACT,eAAe,QAAQ,OAAO,SAAS,GAAG;EAC1C,QAAQ,WAAW,OAAO,cAAc;CAC1C;CACA,aAAa,EACX,QAAQ,sBAAsB,OAAO,gBAAgB,iBAAiB,EACxE;AACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { HTMLElement, customElements } from "@lit-labs/ssr-dom-shim";
2
+ //#region src/shim.ts
3
+ /**
4
+ * Installs a minimal DOM shim so modules that subclass `HTMLElement` — the
5
+ * remote custom elements, via the remote-dom fork's `RemoteElement` — can be
6
+ * evaluated in a Node/SSR context (e.g. Next.js server-rendering a client
7
+ * component). Guarded on a missing DOM, so it is a no-op in a real browser and
8
+ * can safely live on the browser entry without clobbering the native DOM.
9
+ *
10
+ * Exported as a _used binding_ rather than imported as a bare `import
11
+ * "./shim"`: Vite 8's Rollup reorders bare side-effect imports after binding
12
+ * imports, which would let `HTMLElement` be subclassed before the shim runs. A
13
+ * binding keeps this import in source order — first.
14
+ */
15
+ var domShimApplied = (() => {
16
+ if (typeof globalThis.HTMLElement === "undefined") {
17
+ globalThis.HTMLElement = HTMLElement;
18
+ globalThis.customElements = customElements;
19
+ globalThis.MutationObserver = class MutationObserver {
20
+ constructor() {}
21
+ disconnect() {}
22
+ observe() {}
23
+ takeRecords() {
24
+ return [];
25
+ }
26
+ };
27
+ }
28
+ return true;
29
+ })();
30
+ //#endregion
31
+ export { domShimApplied };
32
+
33
+ //# sourceMappingURL=shim.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shim.mjs","names":[],"sources":["../../../../../src/shim.ts"],"sourcesContent":["import { HTMLElement, customElements } from \"@lit-labs/ssr-dom-shim\";\n\n/**\n * Installs a minimal DOM shim so modules that subclass `HTMLElement` — the\n * remote custom elements, via the remote-dom fork's `RemoteElement` — can be\n * evaluated in a Node/SSR context (e.g. Next.js server-rendering a client\n * component). Guarded on a missing DOM, so it is a no-op in a real browser and\n * can safely live on the browser entry without clobbering the native DOM.\n *\n * Exported as a _used binding_ rather than imported as a bare `import\n * \"./shim\"`: Vite 8's Rollup reorders bare side-effect imports after binding\n * imports, which would let `HTMLElement` be subclassed before the shim runs. A\n * binding keeps this import in source order — first.\n */\nexport const domShimApplied = (() => {\n if (typeof globalThis.HTMLElement === \"undefined\") {\n globalThis.HTMLElement = HTMLElement;\n globalThis.customElements = customElements;\n globalThis.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 }\n\n return true;\n})();\n"],"mappings":";;;;;;;;;;;;;;AAcA,IAAa,wBAAwB;CACnC,IAAI,OAAO,WAAW,gBAAgB,aAAa;EACjD,WAAW,cAAc;EACzB,WAAW,iBAAiB;EAC5B,WAAW,mBAAmB,MAAM,iBAAiB;GACnD,cAAqB,CAErB;GACA,aAAoB,CAEpB;GACA,UAAiB,CAEjB;GACA,cAAqB;IACnB,OAAO,CAAC;GACV;EACF;CACF;CAEA,OAAO;AACT,EAAA,CAAG"}