@mittwald/flow-remote-core 0.2.0-alpha.30 → 0.2.0-alpha.300
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/core/src/file.mjs +16 -0
- package/dist/js/core/src/file.mjs.map +1 -0
- package/dist/js/index-node.mjs +7 -0
- package/dist/js/index-node.mjs.map +1 -0
- package/dist/js/index.mjs +6 -0
- package/dist/js/index.mjs.map +1 -0
- package/dist/js/remote-core/src/connection/connectHostRenderRoot.mjs +57 -0
- package/dist/js/remote-core/src/connection/connectHostRenderRoot.mjs.map +1 -0
- package/dist/js/remote-core/src/connection/connectRemoteIframe.mjs +61 -0
- package/dist/js/remote-core/src/connection/connectRemoteIframe.mjs.map +1 -0
- package/dist/js/remote-core/src/connection/types.mjs +10 -0
- package/dist/js/remote-core/src/connection/types.mjs.map +1 -0
- package/dist/js/remote-core/src/error.mjs +10 -0
- package/dist/js/remote-core/src/error.mjs.map +1 -0
- package/dist/js/remote-core/src/ext-bridge/implementation.mjs +13 -0
- package/dist/js/remote-core/src/ext-bridge/implementation.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/FlowThreadSerialization.mjs +57 -0
- package/dist/js/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/Serializer.mjs +32 -0
- package/dist/js/remote-core/src/serialization/Serializer.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/dataTransferText.mjs +21 -0
- package/dist/js/remote-core/src/serialization/serializers/dataTransferText.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/date.mjs +16 -0
- package/dist/js/remote-core/src/serialization/serializers/date.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/file.mjs +42 -0
- package/dist/js/remote-core/src/serialization/serializers/file.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/formData.mjs +27 -0
- package/dist/js/remote-core/src/serialization/serializers/formData.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/index.mjs +5 -0
- package/dist/js/remote-core/src/serialization/serializers/index.mjs.map +1 -0
- package/dist/js/remote-core/src/shim.mjs +16 -0
- package/dist/js/remote-core/src/shim.mjs.map +1 -0
- package/dist/types/connection/connectHostRenderRoot.d.ts +9 -0
- package/dist/types/connection/connectHostRenderRoot.d.ts.map +1 -0
- package/dist/types/connection/connectRemoteIframe.d.ts +10 -8
- package/dist/types/connection/connectRemoteIframe.d.ts.map +1 -1
- package/dist/types/connection/index.d.ts +4 -0
- package/dist/types/connection/index.d.ts.map +1 -0
- package/dist/types/connection/types.d.ts +29 -0
- package/dist/types/connection/types.d.ts.map +1 -0
- package/dist/types/error.d.ts +4 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/ext-bridge/implementation.d.ts +3 -0
- package/dist/types/ext-bridge/implementation.d.ts.map +1 -0
- package/dist/types/index-node.d.ts +2 -0
- package/dist/types/index-node.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/serialization/FlowThreadSerialization.d.ts +7 -0
- package/dist/types/serialization/FlowThreadSerialization.d.ts.map +1 -0
- package/dist/types/serialization/Serializer.d.ts +28 -0
- package/dist/types/serialization/Serializer.d.ts.map +1 -0
- package/dist/types/serialization/serializers/dataTransferText.d.ts +3 -0
- package/dist/types/serialization/serializers/dataTransferText.d.ts.map +1 -0
- package/dist/types/serialization/serializers/date.d.ts +4 -0
- package/dist/types/serialization/serializers/date.d.ts.map +1 -0
- package/dist/types/serialization/serializers/file.d.ts +12 -0
- package/dist/types/serialization/serializers/file.d.ts.map +1 -0
- package/dist/types/serialization/serializers/formData.d.ts +6 -0
- package/dist/types/serialization/serializers/formData.d.ts.map +1 -0
- package/dist/types/serialization/serializers/index.d.ts +5 -0
- package/dist/types/serialization/serializers/index.d.ts.map +1 -0
- package/dist/types/shim.d.ts +2 -0
- package/dist/types/shim.d.ts.map +1 -0
- package/package.json +37 -16
- package/LICENSE +0 -21
- package/dist/index.js +0 -50
- package/dist/types/connection/connectHostIframe.d.ts +0 -3
- package/dist/types/connection/connectHostIframe.d.ts.map +0 -1
- package/dist/types/events/FlowRemoteEvent.d.ts +0 -4
- package/dist/types/events/FlowRemoteEvent.d.ts.map +0 -1
- package/dist/types/events/index.d.ts +0 -5
- package/dist/types/events/index.d.ts.map +0 -1
- package/dist/types/events/serializers.d.ts +0 -5
- package/dist/types/events/serializers.d.ts.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import invariant from 'invariant';
|
|
2
|
+
|
|
3
|
+
const Key = "mittwald.flow-core.file.awaitedArrayBuffer";
|
|
4
|
+
function isFileWithAwaitedArrayBuffer(file) {
|
|
5
|
+
return Key in file;
|
|
6
|
+
}
|
|
7
|
+
const getAwaitArrayBuffer = (file) => {
|
|
8
|
+
invariant(
|
|
9
|
+
isFileWithAwaitedArrayBuffer(file),
|
|
10
|
+
"Could not get awaited ArrayBuffer from file"
|
|
11
|
+
);
|
|
12
|
+
return file[Key];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { getAwaitArrayBuffer };
|
|
16
|
+
//# sourceMappingURL=file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.mjs","sources":["../../../../../core/src/file.ts"],"sourcesContent":["import invariant from \"invariant\";\n\nconst Key = \"mittwald.flow-core.file.awaitedArrayBuffer\";\n\nexport type FileWithAwaitedArrayBuffer = File & {\n [Key]: ArrayBuffer;\n};\n\nfunction isFileWithAwaitedArrayBuffer(\n file: File | FileWithAwaitedArrayBuffer,\n): file is FileWithAwaitedArrayBuffer {\n return Key in file;\n}\n\nexport const addAwaitedArrayBuffer = async (file: File) => {\n if (isFileWithAwaitedArrayBuffer(file)) {\n return file;\n }\n\n const arrayBuffer = await file.arrayBuffer();\n Object.assign(file, { [Key]: arrayBuffer });\n};\n\nexport const getAwaitArrayBuffer = (\n file: File | FileWithAwaitedArrayBuffer,\n) => {\n invariant(\n isFileWithAwaitedArrayBuffer(file),\n \"Could not get awaited ArrayBuffer from file\",\n );\n return file[Key];\n};\n"],"names":[],"mappings":";;AAEA,MAAM,GAAM,GAAA,4CAAA;AAMZ,SAAS,6BACP,IACoC,EAAA;AACpC,EAAA,OAAO,GAAO,IAAA,IAAA;AAChB;AAWa,MAAA,mBAAA,GAAsB,CACjC,IACG,KAAA;AACH,EAAA,SAAA;AAAA,IACE,6BAA6B,IAAI,CAAA;AAAA,IACjC;AAAA,GACF;AACA,EAAA,OAAO,KAAK,GAAG,CAAA;AACjB;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './remote-core/src/shim.mjs';
|
|
2
|
+
export { RemoteElement, RemoteEvent } from '@mittwald/remote-dom-core/elements';
|
|
3
|
+
export { connectHostRenderRoot, connectHostRenderRootRef } from './remote-core/src/connection/connectHostRenderRoot.mjs';
|
|
4
|
+
export { connectRemoteIframe, connectRemoteIframeRef } from './remote-core/src/connection/connectRemoteIframe.mjs';
|
|
5
|
+
export { Version } from './remote-core/src/connection/types.mjs';
|
|
6
|
+
export { RemoteError } from './remote-core/src/error.mjs';
|
|
7
|
+
//# sourceMappingURL=index-node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { RemoteElement, RemoteEvent } from '@mittwald/remote-dom-core/elements';
|
|
2
|
+
export { connectHostRenderRoot, connectHostRenderRootRef } from './remote-core/src/connection/connectHostRenderRoot.mjs';
|
|
3
|
+
export { connectRemoteIframe, connectRemoteIframeRef } from './remote-core/src/connection/connectRemoteIframe.mjs';
|
|
4
|
+
export { Version } from './remote-core/src/connection/types.mjs';
|
|
5
|
+
export { RemoteError } from './remote-core/src/error.mjs';
|
|
6
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Version } from './types.mjs';
|
|
2
|
+
import { RemoteError } from '../error.mjs';
|
|
3
|
+
import { FlowThreadSerialization } from '../serialization/FlowThreadSerialization.mjs';
|
|
4
|
+
import '@mittwald/remote-dom-core/elements';
|
|
5
|
+
import { ThreadNestedIframe } from '@quilted/threads';
|
|
6
|
+
|
|
7
|
+
const incompatibleParentFrameError = () => new RemoteError("Could not find any compatible parent frame");
|
|
8
|
+
const connectHostRenderRoot = async (options) => {
|
|
9
|
+
const { root, onPathnameChanged } = options;
|
|
10
|
+
const connection = new ThreadNestedIframe({
|
|
11
|
+
serialization: new FlowThreadSerialization(),
|
|
12
|
+
exports: {
|
|
13
|
+
render: (connection2) => import('@mittwald/remote-dom-core/elements').then(
|
|
14
|
+
({ RemoteMutationObserver }) => {
|
|
15
|
+
const observer = new RemoteMutationObserver(connection2);
|
|
16
|
+
observer.observe(root);
|
|
17
|
+
}
|
|
18
|
+
),
|
|
19
|
+
setPathname: async (pathname) => {
|
|
20
|
+
onPathnameChanged?.(pathname);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
if (connection.parent === window) {
|
|
25
|
+
throw incompatibleParentFrameError();
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
await connection.imports.setIsReady(Version.v3);
|
|
29
|
+
if (typeof mwExtBridge !== "undefined") {
|
|
30
|
+
mwExtBridge.connection = connection.imports;
|
|
31
|
+
await mwExtBridge.readiness.setIsReady();
|
|
32
|
+
}
|
|
33
|
+
return connection;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) {
|
|
36
|
+
throw incompatibleParentFrameError();
|
|
37
|
+
}
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const connectHostRenderRootRef = (opts) => (ref) => {
|
|
42
|
+
if (ref === null) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if ("__remoteConnection" in ref) {
|
|
46
|
+
return ref["__remoteConnection"];
|
|
47
|
+
}
|
|
48
|
+
const connection = connectHostRenderRoot({
|
|
49
|
+
root: ref,
|
|
50
|
+
...opts
|
|
51
|
+
});
|
|
52
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
53
|
+
return connection;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { connectHostRenderRoot, connectHostRenderRootRef };
|
|
57
|
+
//# sourceMappingURL=connectHostRenderRoot.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectHostRenderRoot.mjs","sources":["../../../../../src/connection/connectHostRenderRoot.ts"],"sourcesContent":["import {\n Version,\n type HostExports,\n type RemoteExports,\n type RemoteToHostConnection,\n} from \"@/connection/types\";\nimport { RemoteError } from \"@/error\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport { type RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadNestedIframe } from \"@quilted/threads\";\n\ninterface Options {\n root: HTMLDivElement;\n onPathnameChanged?: (pathname: string) => void;\n}\n\nconst incompatibleParentFrameError = () =>\n new RemoteError(\"Could not find any compatible parent frame\");\n\nexport const connectHostRenderRoot = async (\n options: Options,\n): Promise<RemoteToHostConnection> => {\n const { root, onPathnameChanged } = options;\n\n const connection = new ThreadNestedIframe<HostExports, RemoteExports>({\n serialization: new FlowThreadSerialization(),\n exports: {\n render: (connection: RemoteConnection) =>\n import(\"@mittwald/remote-dom-core/elements\").then(\n ({ RemoteMutationObserver }) => {\n const observer = new RemoteMutationObserver(connection);\n observer.observe(root);\n },\n ),\n setPathname: async (pathname) => {\n onPathnameChanged?.(pathname);\n },\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady(Version.v3);\n\n if (typeof mwExtBridge !== \"undefined\") {\n mwExtBridge.connection = connection.imports;\n await mwExtBridge.readiness.setIsReady();\n }\n\n return connection;\n } catch (error) {\n if (\n error instanceof Error &&\n /No '.*' method is exported from this thread/.test(error.message)\n ) {\n throw incompatibleParentFrameError();\n }\n throw error;\n }\n};\n\nexport const connectHostRenderRootRef =\n (opts: Omit<Options, \"root\">) => (ref: HTMLDivElement | null) => {\n if (ref === null) {\n return;\n }\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as Promise<RemoteToHostConnection>;\n }\n\n const connection = connectHostRenderRoot({\n root: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":["connection"],"mappings":";;;;;;AAgBA,MAAM,4BAA+B,GAAA,MACnC,IAAI,WAAA,CAAY,4CAA4C,CAAA;AAEjD,MAAA,qBAAA,GAAwB,OACnC,OACoC,KAAA;AACpC,EAAM,MAAA,EAAE,IAAM,EAAA,iBAAA,EAAsB,GAAA,OAAA;AAEpC,EAAM,MAAA,UAAA,GAAa,IAAI,kBAA+C,CAAA;AAAA,IACpE,aAAA,EAAe,IAAI,uBAAwB,EAAA;AAAA,IAC3C,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA,CAACA,WACP,KAAA,OAAO,oCAAoC,CAAE,CAAA,IAAA;AAAA,QAC3C,CAAC,EAAE,sBAAA,EAA6B,KAAA;AAC9B,UAAM,MAAA,QAAA,GAAW,IAAI,sBAAA,CAAuBA,WAAU,CAAA;AACtD,UAAA,QAAA,CAAS,QAAQ,IAAI,CAAA;AAAA;AACvB,OACF;AAAA,MACF,WAAA,EAAa,OAAO,QAAa,KAAA;AAC/B,QAAA,iBAAA,GAAoB,QAAQ,CAAA;AAAA;AAC9B;AACF,GACD,CAAA;AAED,EAAI,IAAA,UAAA,CAAW,WAAW,MAAQ,EAAA;AAChC,IAAA,MAAM,4BAA6B,EAAA;AAAA;AAGrC,EAAI,IAAA;AACF,IAAA,MAAM,UAAW,CAAA,OAAA,CAAQ,UAAW,CAAA,OAAA,CAAQ,EAAE,CAAA;AAE9C,IAAI,IAAA,OAAO,gBAAgB,WAAa,EAAA;AACtC,MAAA,WAAA,CAAY,aAAa,UAAW,CAAA,OAAA;AACpC,MAAM,MAAA,WAAA,CAAY,UAAU,UAAW,EAAA;AAAA;AAGzC,IAAO,OAAA,UAAA;AAAA,WACA,KAAO,EAAA;AACd,IAAA,IACE,iBAAiB,KACjB,IAAA,6CAAA,CAA8C,IAAK,CAAA,KAAA,CAAM,OAAO,CAChE,EAAA;AACA,MAAA,MAAM,4BAA6B,EAAA;AAAA;AAErC,IAAM,MAAA,KAAA;AAAA;AAEV;AAEO,MAAM,wBACX,GAAA,CAAC,IAAgC,KAAA,CAAC,GAA+B,KAAA;AAC/D,EAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,IAAA;AAAA;AAEF,EAAA,IAAI,wBAAwB,GAAK,EAAA;AAC/B,IAAA,OAAO,IAAI,oBAAoB,CAAA;AAAA;AAGjC,EAAA,MAAM,aAAa,qBAAsB,CAAA;AAAA,IACvC,IAAM,EAAA,GAAA;AAAA,IACN,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAO,CAAA,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAO,OAAA,UAAA;AACT;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Version } from './types.mjs';
|
|
2
|
+
import { emptyImplementation } from '../ext-bridge/implementation.mjs';
|
|
3
|
+
import { FlowThreadSerialization } from '../serialization/FlowThreadSerialization.mjs';
|
|
4
|
+
import { ThreadIframe } from '@quilted/threads';
|
|
5
|
+
|
|
6
|
+
const connectRemoteIframe = (opts) => {
|
|
7
|
+
const {
|
|
8
|
+
connection,
|
|
9
|
+
iframe,
|
|
10
|
+
onReady,
|
|
11
|
+
onError,
|
|
12
|
+
onNavigationStateChanged,
|
|
13
|
+
extBridgeImplementation = emptyImplementation
|
|
14
|
+
} = opts;
|
|
15
|
+
const result = {
|
|
16
|
+
thread: new ThreadIframe(iframe, {
|
|
17
|
+
serialization: new FlowThreadSerialization(),
|
|
18
|
+
exports: {
|
|
19
|
+
...extBridgeImplementation,
|
|
20
|
+
setIsReady: async (version = 1) => {
|
|
21
|
+
result.version = version;
|
|
22
|
+
onReady?.(result);
|
|
23
|
+
},
|
|
24
|
+
setError: async (error) => {
|
|
25
|
+
onError?.(error);
|
|
26
|
+
},
|
|
27
|
+
setNavigationState: async (state) => {
|
|
28
|
+
onNavigationStateChanged?.(state);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
version: 0,
|
|
33
|
+
updateHostPathname: (hostPathname) => {
|
|
34
|
+
if (hostPathname === void 0) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (result.version >= Version.v2) {
|
|
38
|
+
result.thread.imports.setPathname(hostPathname);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
result.thread.imports.render(connection);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
const connectRemoteIframeRef = (opts) => (ref) => {
|
|
46
|
+
if (!ref) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if ("__remoteConnection" in ref) {
|
|
50
|
+
return ref["__remoteConnection"];
|
|
51
|
+
}
|
|
52
|
+
const connection = connectRemoteIframe({
|
|
53
|
+
iframe: ref,
|
|
54
|
+
...opts
|
|
55
|
+
});
|
|
56
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
57
|
+
return connection;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { connectRemoteIframe, connectRemoteIframeRef };
|
|
61
|
+
//# sourceMappingURL=connectRemoteIframe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectRemoteIframe.mjs","sources":["../../../../../src/connection/connectRemoteIframe.ts"],"sourcesContent":["import {\n type HostExports,\n type HostToRemoteConnection,\n type NavigationState,\n type RemoteExports,\n Version,\n} from \"@/connection/types\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\nimport { FlowThreadSerialization } from \"@/serialization/FlowThreadSerialization\";\nimport type { ExtBridgeConnectionApi } 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 onReady?: (connection: HostToRemoteConnection) => void;\n onError?: (error: string) => void;\n onNavigationStateChanged?: (state: NavigationState) => void;\n extBridgeImplementation?: ExtBridgeConnectionApi;\n}\n\nexport const connectRemoteIframe = (opts: Options): HostToRemoteConnection => {\n const {\n connection,\n iframe,\n onReady,\n onError,\n onNavigationStateChanged,\n extBridgeImplementation = emptyImplementation,\n } = opts;\n\n const result = {\n thread: new ThreadIframe<RemoteExports, HostExports>(iframe, {\n serialization: new FlowThreadSerialization(),\n exports: {\n ...extBridgeImplementation,\n setIsReady: async (version = 1) => {\n result.version = version;\n onReady?.(result);\n },\n setError: async (error: string) => {\n onError?.(error);\n },\n setNavigationState: async (state) => {\n onNavigationStateChanged?.(state);\n },\n },\n }),\n version: 0,\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 };\n\n result.thread.imports.render(connection);\n return result;\n};\n\nexport const connectRemoteIframeRef =\n (opts: Omit<Options, \"iframe\">) => (ref: HTMLIFrameElement | null) => {\n if (!ref) {\n return;\n }\n\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as HostToRemoteConnection;\n }\n\n const connection = connectRemoteIframe({\n iframe: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,mBAAA,GAAsB,CAAC,IAA0C,KAAA;AAC5E,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,wBAAA;AAAA,IACA,uBAA0B,GAAA;AAAA,GACxB,GAAA,IAAA;AAEJ,EAAA,MAAM,MAAS,GAAA;AAAA,IACb,MAAA,EAAQ,IAAI,YAAA,CAAyC,MAAQ,EAAA;AAAA,MAC3D,aAAA,EAAe,IAAI,uBAAwB,EAAA;AAAA,MAC3C,OAAS,EAAA;AAAA,QACP,GAAG,uBAAA;AAAA,QACH,UAAA,EAAY,OAAO,OAAA,GAAU,CAAM,KAAA;AACjC,UAAA,MAAA,CAAO,OAAU,GAAA,OAAA;AACjB,UAAA,OAAA,GAAU,MAAM,CAAA;AAAA,SAClB;AAAA,QACA,QAAA,EAAU,OAAO,KAAkB,KAAA;AACjC,UAAA,OAAA,GAAU,KAAK,CAAA;AAAA,SACjB;AAAA,QACA,kBAAA,EAAoB,OAAO,KAAU,KAAA;AACnC,UAAA,wBAAA,GAA2B,KAAK,CAAA;AAAA;AAClC;AACF,KACD,CAAA;AAAA,IACD,OAAS,EAAA,CAAA;AAAA,IACT,kBAAA,EAAoB,CAAC,YAA0B,KAAA;AAC7C,MAAA,IAAI,iBAAiB,MAAW,EAAA;AAC9B,QAAA;AAAA;AAGF,MAAI,IAAA,MAAA,CAAO,OAAW,IAAA,OAAA,CAAQ,EAAI,EAAA;AAChC,QAAO,MAAA,CAAA,MAAA,CAAO,OAAQ,CAAA,WAAA,CAAY,YAAY,CAAA;AAAA;AAChD;AACF,GACF;AAEA,EAAO,MAAA,CAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,CAAO,UAAU,CAAA;AACvC,EAAO,OAAA,MAAA;AACT;AAEO,MAAM,sBACX,GAAA,CAAC,IAAkC,KAAA,CAAC,GAAkC,KAAA;AACpE,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IAAA;AAAA;AAGF,EAAA,IAAI,wBAAwB,GAAK,EAAA;AAC/B,IAAA,OAAO,IAAI,oBAAoB,CAAA;AAAA;AAGjC,EAAA,MAAM,aAAa,mBAAoB,CAAA;AAAA,IACrC,MAAQ,EAAA,GAAA;AAAA,IACR,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAO,CAAA,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAO,OAAA,UAAA;AACT;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var Version = /* @__PURE__ */ ((Version2) => {
|
|
2
|
+
Version2[Version2["vUnknown"] = 0] = "vUnknown";
|
|
3
|
+
Version2[Version2["v1"] = 1] = "v1";
|
|
4
|
+
Version2[Version2["v2"] = 2] = "v2";
|
|
5
|
+
Version2[Version2["v3"] = 3] = "v3";
|
|
6
|
+
return Version2;
|
|
7
|
+
})(Version || {});
|
|
8
|
+
|
|
9
|
+
export { Version };
|
|
10
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":["../../../../../src/connection/types.ts"],"sourcesContent":["import type { ExtBridgeConnectionApi } from \"@mittwald/ext-bridge\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core\";\nimport type { ThreadIframe, ThreadNestedIframe } from \"@quilted/threads\";\n\nexport interface NavigationState {\n pathname: string;\n isPending: boolean;\n}\n\nexport interface HostExports extends ExtBridgeConnectionApi {\n setIsReady: (version?: Version) => Promise<void>;\n setError: (error: string) => Promise<void>;\n setNavigationState: (state: NavigationState) => Promise<void>;\n}\n\nexport interface RemoteExports {\n render: (connection: RemoteConnection) => Promise<void>;\n setPathname: (pathname: string) => Promise<void>;\n}\n\nexport type RemoteToHostConnection = ThreadNestedIframe<\n HostExports,\n RemoteExports\n>;\n\nexport interface HostToRemoteConnection {\n version: Version;\n thread: ThreadIframe<RemoteExports, HostExports>;\n updateHostPathname: (hostPathname?: string) => void;\n}\n\nexport enum Version {\n vUnknown = 0,\n v1 = 1,\n v2 = 2,\n v3 = 3,\n}\n"],"names":["Version"],"mappings":"AA+BY,IAAA,OAAA,qBAAAA,QAAL,KAAA;AACL,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,cAAW,CAAX,CAAA,GAAA,UAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAL,CAAA,GAAA,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAL,CAAA,GAAA,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAL,CAAA,GAAA,IAAA;AAJU,EAAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","sources":["../../../../src/error.ts"],"sourcesContent":["export class RemoteError extends Error {\n constructor(message: string) {\n super(message);\n this.message = message;\n }\n}\n\nRemoteError.prototype.name = \"RemoteError\";\n"],"names":[],"mappings":"AAAO,MAAM,oBAAoB,KAAM,CAAA;AAAA,EACrC,YAAY,OAAiB,EAAA;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,OAAU,GAAA,OAAA;AAAA;AAEnB;AAEA,WAAA,CAAY,UAAU,IAAO,GAAA,aAAA;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RemoteError } from '../error.mjs';
|
|
2
|
+
|
|
3
|
+
const emptyImplementation = new Proxy(
|
|
4
|
+
{},
|
|
5
|
+
{
|
|
6
|
+
get() {
|
|
7
|
+
throw new RemoteError("Missing implementation for mittwald.extBridge");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export { emptyImplementation };
|
|
13
|
+
//# sourceMappingURL=implementation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation.mjs","sources":["../../../../../src/ext-bridge/implementation.ts"],"sourcesContent":["import { RemoteError } from \"@/error\";\nimport type { ExtBridgeConnectionApi } from \"@mittwald/ext-bridge\";\n\nexport const emptyImplementation = new Proxy(\n {},\n {\n get() {\n throw new RemoteError(\"Missing implementation for mittwald.extBridge\");\n },\n },\n) as ExtBridgeConnectionApi;\n"],"names":[],"mappings":";;AAGO,MAAM,sBAAsB,IAAI,KAAA;AAAA,EACrC,EAAC;AAAA,EACD;AAAA,IACE,GAAM,GAAA;AACJ,MAAM,MAAA,IAAI,YAAY,+CAA+C,CAAA;AAAA;AACvE;AAEJ;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ThreadSerializationStructuredClone } from '@quilted/threads';
|
|
2
|
+
import * as index from './serializers/index.mjs';
|
|
3
|
+
import { isObjectType } from 'remeda';
|
|
4
|
+
|
|
5
|
+
const serializers = Object.values(index);
|
|
6
|
+
class FlowThreadSerialization extends ThreadSerializationStructuredClone {
|
|
7
|
+
constructor() {
|
|
8
|
+
const options = {
|
|
9
|
+
serialize: (val, serialize) => {
|
|
10
|
+
try {
|
|
11
|
+
if (this.isSerializableByBase(val)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (this.omitSerialization(val)) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
for (const serializer of serializers) {
|
|
18
|
+
const serialization = serializer.serialize(val);
|
|
19
|
+
if (serialization.applied) {
|
|
20
|
+
return serialization.result;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (isObjectType(val)) {
|
|
24
|
+
return serialize({ ...val });
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error("Error while serializing", error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
deserialize: (val, serialize) => {
|
|
32
|
+
try {
|
|
33
|
+
for (const serializer of serializers) {
|
|
34
|
+
const deserialization = serializer.deserialize(val);
|
|
35
|
+
if (deserialization.applied) {
|
|
36
|
+
return deserialization.result.value;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return serialize(val);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error("Error while deserializing", error);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
super(options);
|
|
47
|
+
}
|
|
48
|
+
isSerializableByBase(val) {
|
|
49
|
+
return val instanceof Map || val instanceof Set || Array.isArray(val) || typeof val === "function";
|
|
50
|
+
}
|
|
51
|
+
omitSerialization(val) {
|
|
52
|
+
return val instanceof HTMLElement || val === window;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { FlowThreadSerialization };
|
|
57
|
+
//# sourceMappingURL=FlowThreadSerialization.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowThreadSerialization.mjs","sources":["../../../../../src/serialization/FlowThreadSerialization.ts"],"sourcesContent":["import {\n ThreadSerializationStructuredClone,\n type ThreadSerializationOptions,\n} from \"@quilted/threads\";\nimport * as serializerModules from \"./serializers\";\nimport { isObjectType } from \"remeda\";\n\nconst serializers = Object.values(serializerModules);\n\nexport class FlowThreadSerialization extends ThreadSerializationStructuredClone {\n public constructor() {\n const options: ThreadSerializationOptions = {\n serialize: (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 = serializer.serialize(val as never);\n if (serialization.applied) {\n return serialization.result;\n }\n }\n if (isObjectType(val)) {\n return serialize({ ...val });\n }\n } catch (error) {\n console.error(\"Error while serializing\", error);\n throw error;\n }\n },\n deserialize: (val, serialize) => {\n try {\n for (const serializer of serializers) {\n const deserialization = serializer.deserialize(val as never);\n if (deserialization.applied) {\n return deserialization.result.value;\n }\n }\n return serialize(val);\n } catch (error) {\n console.error(\"Error while deserializing\", error);\n throw error;\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 );\n }\n\n private omitSerialization(val: unknown) {\n return val instanceof HTMLElement || val === window;\n }\n}\n"],"names":["serializerModules"],"mappings":";;;;AAOA,MAAM,WAAA,GAAc,MAAO,CAAA,MAAA,CAAOA,KAAiB,CAAA;AAE5C,MAAM,gCAAgC,kCAAmC,CAAA;AAAA,EACvE,WAAc,GAAA;AACnB,IAAA,MAAM,OAAsC,GAAA;AAAA,MAC1C,SAAA,EAAW,CAAC,GAAA,EAAK,SAAc,KAAA;AAC7B,QAAI,IAAA;AACF,UAAI,IAAA,IAAA,CAAK,oBAAqB,CAAA,GAAG,CAAG,EAAA;AAClC,YAAA;AAAA;AAEF,UAAI,IAAA,IAAA,CAAK,iBAAkB,CAAA,GAAG,CAAG,EAAA;AAC/B,YAAO,OAAA,IAAA;AAAA;AAET,UAAA,KAAA,MAAW,cAAc,WAAa,EAAA;AACpC,YAAM,MAAA,aAAA,GAAgB,UAAW,CAAA,SAAA,CAAU,GAAY,CAAA;AACvD,YAAA,IAAI,cAAc,OAAS,EAAA;AACzB,cAAA,OAAO,aAAc,CAAA,MAAA;AAAA;AACvB;AAEF,UAAI,IAAA,YAAA,CAAa,GAAG,CAAG,EAAA;AACrB,YAAA,OAAO,SAAU,CAAA,EAAE,GAAG,GAAA,EAAK,CAAA;AAAA;AAC7B,iBACO,KAAO,EAAA;AACd,UAAQ,OAAA,CAAA,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,UAAM,MAAA,KAAA;AAAA;AACR,OACF;AAAA,MACA,WAAA,EAAa,CAAC,GAAA,EAAK,SAAc,KAAA;AAC/B,QAAI,IAAA;AACF,UAAA,KAAA,MAAW,cAAc,WAAa,EAAA;AACpC,YAAM,MAAA,eAAA,GAAkB,UAAW,CAAA,WAAA,CAAY,GAAY,CAAA;AAC3D,YAAA,IAAI,gBAAgB,OAAS,EAAA;AAC3B,cAAA,OAAO,gBAAgB,MAAO,CAAA,KAAA;AAAA;AAChC;AAEF,UAAA,OAAO,UAAU,GAAG,CAAA;AAAA,iBACb,KAAO,EAAA;AACd,UAAQ,OAAA,CAAA,KAAA,CAAM,6BAA6B,KAAK,CAAA;AAChD,UAAM,MAAA,KAAA;AAAA;AACR;AACF,KACF;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA;AACf,EAEQ,qBAAqB,GAAc,EAAA;AACzC,IACE,OAAA,GAAA,YAAe,OACf,GAAe,YAAA,GAAA,IACf,MAAM,OAAQ,CAAA,GAAG,CACjB,IAAA,OAAO,GAAQ,KAAA,UAAA;AAAA;AAEnB,EAEQ,kBAAkB,GAAc,EAAA;AACtC,IAAO,OAAA,GAAA,YAAe,eAAe,GAAQ,KAAA,MAAA;AAAA;AAEjD;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const Key = "mittwald.flow-remote-core.serializer.name";
|
|
2
|
+
class Serializer {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
this.options = options;
|
|
5
|
+
}
|
|
6
|
+
apply(val, strategy) {
|
|
7
|
+
if (strategy.isApplicable(val)) {
|
|
8
|
+
return {
|
|
9
|
+
applied: true,
|
|
10
|
+
result: {
|
|
11
|
+
[Key]: this.options.name,
|
|
12
|
+
value: strategy.apply(val)
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
applied: false
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
serialize(val) {
|
|
21
|
+
return this.apply(val, this.options.serialize);
|
|
22
|
+
}
|
|
23
|
+
deserialize(val) {
|
|
24
|
+
return this.apply(val, {
|
|
25
|
+
apply: (serialization) => this.options.deserialize.apply(serialization.value),
|
|
26
|
+
isApplicable: (val2) => !!val2 && typeof val2 === "object" && Key in val2 && val2[Key] === this.options.name
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { Serializer };
|
|
32
|
+
//# sourceMappingURL=Serializer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Serializer.mjs","sources":["../../../../../src/serialization/Serializer.ts"],"sourcesContent":["interface SerializationStrategy<TIn, TOut> {\n isApplicable: (val: unknown) => val is TIn;\n apply: (val: TIn) => TOut;\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 apply<TIn, TOut>(\n val: unknown,\n strategy: SerializationStrategy<TIn, TOut>,\n ): SerializationResult<TOut> {\n if (strategy.isApplicable(val)) {\n return {\n applied: true,\n result: {\n [Key]: this.options.name,\n value: strategy.apply(val),\n },\n };\n }\n return {\n applied: false,\n };\n }\n\n public serialize(val: unknown): SerializationResult<TOut> {\n return this.apply<TIn, TOut>(val, this.options.serialize);\n }\n\n public deserialize(val: unknown): SerializationResult<TIn> {\n return this.apply(val, {\n apply: (serialization: SuccessfulSerializationResult<TOut>) =>\n this.options.deserialize.apply(serialization.value),\n\n isApplicable: (val): val is SuccessfulSerializationResult<TOut> =>\n !!val &&\n typeof val === \"object\" &&\n Key in val &&\n val[Key] === this.options.name,\n });\n }\n}\n"],"names":["val"],"mappings":"AAKA,MAAM,GAAM,GAAA,2CAAA;AAWL,MAAM,UAAsB,CAAA;AAAA,EAC1B,YACG,OAKR,EAAA;AALQ,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA;AAKP,EAEK,KAAA,CACN,KACA,QAC2B,EAAA;AAC3B,IAAI,IAAA,QAAA,CAAS,YAAa,CAAA,GAAG,CAAG,EAAA;AAC9B,MAAO,OAAA;AAAA,QACL,OAAS,EAAA,IAAA;AAAA,QACT,MAAQ,EAAA;AAAA,UACN,CAAC,GAAG,GAAG,IAAA,CAAK,OAAQ,CAAA,IAAA;AAAA,UACpB,KAAA,EAAO,QAAS,CAAA,KAAA,CAAM,GAAG;AAAA;AAC3B,OACF;AAAA;AAEF,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,KACX;AAAA;AACF,EAEO,UAAU,GAAyC,EAAA;AACxD,IAAA,OAAO,IAAK,CAAA,KAAA,CAAiB,GAAK,EAAA,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA;AAC1D,EAEO,YAAY,GAAwC,EAAA;AACzD,IAAO,OAAA,IAAA,CAAK,MAAM,GAAK,EAAA;AAAA,MACrB,KAAA,EAAO,CAAC,aACN,KAAA,IAAA,CAAK,QAAQ,WAAY,CAAA,KAAA,CAAM,cAAc,KAAK,CAAA;AAAA,MAEpD,YAAc,EAAA,CAACA,IACb,KAAA,CAAC,CAACA,IACF,IAAA,OAAOA,IAAQ,KAAA,QAAA,IACf,OAAOA,IACPA,IAAAA,IAAAA,CAAI,GAAG,CAAA,KAAM,KAAK,OAAQ,CAAA;AAAA,KAC7B,CAAA;AAAA;AAEL;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Serializer } from '../Serializer.mjs';
|
|
2
|
+
|
|
3
|
+
const 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) => dataTransfer.getData("text")
|
|
10
|
+
},
|
|
11
|
+
deserialize: {
|
|
12
|
+
apply: (asString) => {
|
|
13
|
+
const dataTransfer = new DataTransfer();
|
|
14
|
+
dataTransfer.setData("text", asString);
|
|
15
|
+
return dataTransfer;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export { dataTransferTextSerializer };
|
|
21
|
+
//# sourceMappingURL=dataTransferText.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataTransferText.mjs","sources":["../../../../../../src/serialization/serializers/dataTransferText.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\n\nexport const dataTransferTextSerializer = new Serializer<DataTransfer, string>({\n name: \"DataTransferText\",\n serialize: {\n isApplicable: (val): val is DataTransfer => {\n return (\n val instanceof DataTransfer &&\n val.types.every((type) => type === \"text/plain\")\n );\n },\n apply: (dataTransfer) => dataTransfer.getData(\"text\"),\n },\n deserialize: {\n apply: (asString) => {\n const dataTransfer = new DataTransfer();\n dataTransfer.setData(\"text\", asString);\n return dataTransfer;\n },\n },\n});\n"],"names":[],"mappings":";;AAEa,MAAA,0BAAA,GAA6B,IAAI,UAAiC,CAAA;AAAA,EAC7E,IAAM,EAAA,kBAAA;AAAA,EACN,SAAW,EAAA;AAAA,IACT,YAAA,EAAc,CAAC,GAA6B,KAAA;AAC1C,MACE,OAAA,GAAA,YAAe,gBACf,GAAI,CAAA,KAAA,CAAM,MAAM,CAAC,IAAA,KAAS,SAAS,YAAY,CAAA;AAAA,KAEnD;AAAA,IACA,KAAO,EAAA,CAAC,YAAiB,KAAA,YAAA,CAAa,QAAQ,MAAM;AAAA,GACtD;AAAA,EACA,WAAa,EAAA;AAAA,IACX,KAAA,EAAO,CAAC,QAAa,KAAA;AACnB,MAAM,MAAA,YAAA,GAAe,IAAI,YAAa,EAAA;AACtC,MAAa,YAAA,CAAA,OAAA,CAAQ,QAAQ,QAAQ,CAAA;AACrC,MAAO,OAAA,YAAA;AAAA;AACT;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { parseDate, CalendarDate } from '@internationalized/date';
|
|
2
|
+
import { Serializer } from '../Serializer.mjs';
|
|
3
|
+
|
|
4
|
+
const calendarDateSerializer = new Serializer({
|
|
5
|
+
name: "CalendarDate",
|
|
6
|
+
serialize: {
|
|
7
|
+
isApplicable: (val) => val instanceof CalendarDate,
|
|
8
|
+
apply: (date) => date.toString()
|
|
9
|
+
},
|
|
10
|
+
deserialize: {
|
|
11
|
+
apply: (asString) => parseDate(asString)
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { calendarDateSerializer };
|
|
16
|
+
//# sourceMappingURL=date.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.mjs","sources":["../../../../../../src/serialization/serializers/date.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\nimport { parseDate } from \"@internationalized/date\";\nimport { Serializer } from \"@/serialization/Serializer\";\n\nexport const calendarDateSerializer = new Serializer<CalendarDate, string>({\n name: \"CalendarDate\",\n serialize: {\n isApplicable: (val) => val instanceof CalendarDate,\n apply: (date) => date.toString(),\n },\n deserialize: {\n apply: (asString) => parseDate(asString),\n },\n});\n"],"names":[],"mappings":";;;AAIa,MAAA,sBAAA,GAAyB,IAAI,UAAiC,CAAA;AAAA,EACzE,IAAM,EAAA,cAAA;AAAA,EACN,SAAW,EAAA;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,GAAe,YAAA,YAAA;AAAA,IACtC,KAAO,EAAA,CAAC,IAAS,KAAA,IAAA,CAAK,QAAS;AAAA,GACjC;AAAA,EACA,WAAa,EAAA;AAAA,IACX,KAAO,EAAA,CAAC,QAAa,KAAA,SAAA,CAAU,QAAQ;AAAA;AAE3C,CAAC;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TRANSFERABLE } from '@quilted/threads';
|
|
2
|
+
import { Serializer } from '../Serializer.mjs';
|
|
3
|
+
import { getAwaitArrayBuffer } from '../../../../core/src/file.mjs';
|
|
4
|
+
|
|
5
|
+
const serialize = (file) => ({
|
|
6
|
+
name: file.name,
|
|
7
|
+
type: file.type,
|
|
8
|
+
lastModified: file.lastModified,
|
|
9
|
+
content: getAwaitArrayBuffer(file),
|
|
10
|
+
[TRANSFERABLE]: 1
|
|
11
|
+
});
|
|
12
|
+
const deserialize = (file) => new File([file.content], file.name, {
|
|
13
|
+
lastModified: file.lastModified,
|
|
14
|
+
type: file.type
|
|
15
|
+
});
|
|
16
|
+
const fileSerializer = new Serializer({
|
|
17
|
+
name: "File",
|
|
18
|
+
deserialize: {
|
|
19
|
+
apply: deserialize
|
|
20
|
+
},
|
|
21
|
+
serialize: {
|
|
22
|
+
isApplicable: (something) => something instanceof File,
|
|
23
|
+
apply: serialize
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const fileListSerializer = new Serializer({
|
|
27
|
+
name: "FileList",
|
|
28
|
+
deserialize: {
|
|
29
|
+
apply: (files) => {
|
|
30
|
+
const dataTransfer = new DataTransfer();
|
|
31
|
+
files.map(deserialize).forEach((f) => dataTransfer.items.add(f));
|
|
32
|
+
return dataTransfer.files;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
serialize: {
|
|
36
|
+
isApplicable: (something) => something instanceof FileList,
|
|
37
|
+
apply: (fileList) => Array.from(fileList).map(serialize)
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { fileListSerializer, fileSerializer };
|
|
42
|
+
//# sourceMappingURL=file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.mjs","sources":["../../../../../../src/serialization/serializers/file.ts"],"sourcesContent":["import { TRANSFERABLE } from \"@quilted/threads\";\nimport { Serializer } from \"@/serialization/Serializer\";\nimport { getAwaitArrayBuffer } from \"@mittwald/flow-core\";\n\nexport interface SerializedFile {\n name: string;\n type: string;\n lastModified: number;\n content: ArrayBuffer;\n [TRANSFERABLE]: number;\n}\n\nconst serialize = (file: File) => ({\n name: file.name,\n type: file.type,\n lastModified: file.lastModified,\n content: getAwaitArrayBuffer(file),\n [TRANSFERABLE]: 1,\n});\n\nconst deserialize = (file: SerializedFile) =>\n new File([file.content], file.name, {\n lastModified: file.lastModified,\n type: file.type,\n });\n\nexport const fileSerializer = new Serializer<File, SerializedFile>({\n name: \"File\",\n deserialize: {\n apply: deserialize,\n },\n serialize: {\n isApplicable: (something) => something instanceof File,\n apply: serialize,\n },\n});\n\nexport const fileListSerializer = new Serializer<FileList, SerializedFile[]>({\n name: \"FileList\",\n deserialize: {\n apply: (files) => {\n const dataTransfer = new DataTransfer();\n files.map(deserialize).forEach((f) => dataTransfer.items.add(f));\n return dataTransfer.files;\n },\n },\n serialize: {\n isApplicable: (something) => something instanceof FileList,\n apply: (fileList) => Array.from(fileList).map(serialize),\n },\n});\n"],"names":[],"mappings":";;;;AAYA,MAAM,SAAA,GAAY,CAAC,IAAgB,MAAA;AAAA,EACjC,MAAM,IAAK,CAAA,IAAA;AAAA,EACX,MAAM,IAAK,CAAA,IAAA;AAAA,EACX,cAAc,IAAK,CAAA,YAAA;AAAA,EACnB,OAAA,EAAS,oBAAoB,IAAI,CAAA;AAAA,EACjC,CAAC,YAAY,GAAG;AAClB,CAAA,CAAA;AAEA,MAAM,WAAA,GAAc,CAAC,IAAA,KACnB,IAAI,IAAA,CAAK,CAAC,IAAK,CAAA,OAAO,CAAG,EAAA,IAAA,CAAK,IAAM,EAAA;AAAA,EAClC,cAAc,IAAK,CAAA,YAAA;AAAA,EACnB,MAAM,IAAK,CAAA;AACb,CAAC,CAAA;AAEU,MAAA,cAAA,GAAiB,IAAI,UAAiC,CAAA;AAAA,EACjE,IAAM,EAAA,MAAA;AAAA,EACN,WAAa,EAAA;AAAA,IACX,KAAO,EAAA;AAAA,GACT;AAAA,EACA,SAAW,EAAA;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KAAc,SAAqB,YAAA,IAAA;AAAA,IAClD,KAAO,EAAA;AAAA;AAEX,CAAC;AAEY,MAAA,kBAAA,GAAqB,IAAI,UAAuC,CAAA;AAAA,EAC3E,IAAM,EAAA,UAAA;AAAA,EACN,WAAa,EAAA;AAAA,IACX,KAAA,EAAO,CAAC,KAAU,KAAA;AAChB,MAAM,MAAA,YAAA,GAAe,IAAI,YAAa,EAAA;AACtC,MAAM,KAAA,CAAA,GAAA,CAAI,WAAW,CAAA,CAAE,OAAQ,CAAA,CAAC,MAAM,YAAa,CAAA,KAAA,CAAM,GAAI,CAAA,CAAC,CAAC,CAAA;AAC/D,MAAA,OAAO,YAAa,CAAA,KAAA;AAAA;AACtB,GACF;AAAA,EACA,SAAW,EAAA;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KAAc,SAAqB,YAAA,QAAA;AAAA,IAClD,KAAA,EAAO,CAAC,QAAa,KAAA,KAAA,CAAM,KAAK,QAAQ,CAAA,CAAE,IAAI,SAAS;AAAA;AAE3D,CAAC;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Serializer } from '../Serializer.mjs';
|
|
2
|
+
|
|
3
|
+
const formDataSerializer = new Serializer({
|
|
4
|
+
name: "FormData",
|
|
5
|
+
serialize: {
|
|
6
|
+
isApplicable: (val) => val instanceof FormData,
|
|
7
|
+
apply: (formData) => {
|
|
8
|
+
return formData.entries().toArray();
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
deserialize: {
|
|
12
|
+
apply: (array) => {
|
|
13
|
+
const formData = new FormData();
|
|
14
|
+
for (const [name, value] of array) {
|
|
15
|
+
if (!formData.has(name)) {
|
|
16
|
+
formData.set(name, value);
|
|
17
|
+
} else {
|
|
18
|
+
formData.append(name, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return formData;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { formDataSerializer };
|
|
27
|
+
//# sourceMappingURL=formData.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formData.mjs","sources":["../../../../../../src/serialization/serializers/formData.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\n\ntype FormDataEntry = [string, unknown];\ntype FormDataEntries = FormDataEntry[];\n\nexport const formDataSerializer = new Serializer<FormData, FormDataEntries>({\n name: \"FormData\",\n serialize: {\n isApplicable: (val) => val instanceof FormData,\n apply: (formData) => {\n return formData.entries().toArray();\n },\n },\n deserialize: {\n apply: (array) => {\n const formData = new FormData();\n for (const [name, value] of array) {\n if (!formData.has(name)) {\n formData.set(name, value as never);\n } else {\n formData.append(name, value as never);\n }\n }\n return formData;\n },\n },\n});\n"],"names":[],"mappings":";;AAKa,MAAA,kBAAA,GAAqB,IAAI,UAAsC,CAAA;AAAA,EAC1E,IAAM,EAAA,UAAA;AAAA,EACN,SAAW,EAAA;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,GAAe,YAAA,QAAA;AAAA,IACtC,KAAA,EAAO,CAAC,QAAa,KAAA;AACnB,MAAO,OAAA,QAAA,CAAS,OAAQ,EAAA,CAAE,OAAQ,EAAA;AAAA;AACpC,GACF;AAAA,EACA,WAAa,EAAA;AAAA,IACX,KAAA,EAAO,CAAC,KAAU,KAAA;AAChB,MAAM,MAAA,QAAA,GAAW,IAAI,QAAS,EAAA;AAC9B,MAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,CAAA,IAAK,KAAO,EAAA;AACjC,QAAA,IAAI,CAAC,QAAA,CAAS,GAAI,CAAA,IAAI,CAAG,EAAA;AACvB,UAAS,QAAA,CAAA,GAAA,CAAI,MAAM,KAAc,CAAA;AAAA,SAC5B,MAAA;AACL,UAAS,QAAA,CAAA,MAAA,CAAO,MAAM,KAAc,CAAA;AAAA;AACtC;AAEF,MAAO,OAAA,QAAA;AAAA;AACT;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { calendarDateSerializer } from './date.mjs';
|
|
2
|
+
export { fileListSerializer, fileSerializer } from './file.mjs';
|
|
3
|
+
export { dataTransferTextSerializer } from './dataTransferText.mjs';
|
|
4
|
+
export { formDataSerializer } from './formData.mjs';
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLElement, customElements } from '@lit-labs/ssr-dom-shim';
|
|
2
|
+
|
|
3
|
+
globalThis.HTMLElement = HTMLElement;
|
|
4
|
+
globalThis.customElements = customElements;
|
|
5
|
+
globalThis.MutationObserver = class MutationObserver {
|
|
6
|
+
constructor() {
|
|
7
|
+
}
|
|
8
|
+
disconnect() {
|
|
9
|
+
}
|
|
10
|
+
observe() {
|
|
11
|
+
}
|
|
12
|
+
takeRecords() {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=shim.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim.mjs","sources":["../../../../src/shim.ts"],"sourcesContent":["import { HTMLElement, customElements } from \"@lit-labs/ssr-dom-shim\";\n\nglobalThis.HTMLElement = HTMLElement;\nglobalThis.customElements = customElements;\nglobalThis.MutationObserver = class MutationObserver {\n public constructor() {\n // mocked\n }\n public disconnect() {\n // mocked\n }\n public observe() {\n // mocked\n }\n public takeRecords() {\n return [];\n }\n};\n"],"names":[],"mappings":";;AAEA,UAAA,CAAW,WAAc,GAAA,WAAA;AACzB,UAAA,CAAW,cAAiB,GAAA,cAAA;AAC5B,UAAW,CAAA,gBAAA,GAAmB,MAAM,gBAAiB,CAAA;AAAA,EAC5C,WAAc,GAAA;AAAA;AAErB,EACO,UAAa,GAAA;AAAA;AAEpB,EACO,OAAU,GAAA;AAAA;AAEjB,EACO,WAAc,GAAA;AACnB,IAAA,OAAO,EAAC;AAAA;AAEZ,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RemoteToHostConnection } from './types';
|
|
2
|
+
interface Options {
|
|
3
|
+
root: HTMLDivElement;
|
|
4
|
+
onPathnameChanged?: (pathname: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const connectHostRenderRoot: (options: Options) => Promise<RemoteToHostConnection>;
|
|
7
|
+
export declare const connectHostRenderRootRef: (opts: Omit<Options, "root">) => (ref: HTMLDivElement | null) => Promise<RemoteToHostConnection> | undefined;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=connectHostRenderRoot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectHostRenderRoot.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostRenderRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAM5B,UAAU,OAAO;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAKD,eAAO,MAAM,qBAAqB,GAChC,SAAS,OAAO,KACf,OAAO,CAAC,sBAAsB,CAyChC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAClC,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,cAAc,GAAG,IAAI,gDAc3D,CAAC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { HostToRemoteConnection, NavigationState } from './types';
|
|
2
|
+
import { ExtBridgeConnectionApi } from '@mittwald/ext-bridge';
|
|
3
|
+
import { RemoteConnection } from '@mittwald/remote-dom-core/elements';
|
|
4
|
+
interface Options {
|
|
4
5
|
connection: RemoteConnection;
|
|
5
6
|
iframe: HTMLIFrameElement;
|
|
7
|
+
onReady?: (connection: HostToRemoteConnection) => void;
|
|
8
|
+
onError?: (error: string) => void;
|
|
9
|
+
onNavigationStateChanged?: (state: NavigationState) => void;
|
|
10
|
+
extBridgeImplementation?: ExtBridgeConnectionApi;
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export declare const connectRemoteIframe: (opts: Opts) => ThreadIframe<ThreadIframeTarget, Record<string, never>>;
|
|
11
|
-
export declare const connectRemoteIframeRef: (connection: RemoteConnection) => (ref: HTMLIFrameElement | null) => void;
|
|
12
|
+
export declare const connectRemoteIframe: (opts: Options) => HostToRemoteConnection;
|
|
13
|
+
export declare const connectRemoteIframeRef: (opts: Omit<Options, "iframe">) => (ref: HTMLIFrameElement | null) => HostToRemoteConnection | undefined;
|
|
12
14
|
export {};
|
|
13
15
|
//# sourceMappingURL=connectRemoteIframe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectRemoteIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectRemoteIframe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"connectRemoteIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectRemoteIframe.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EAGrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,UAAU,OAAO;IACf,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5D,uBAAuB,CAAC,EAAE,sBAAsB,CAAC;CAClD;AAED,eAAO,MAAM,mBAAmB,GAAI,MAAM,OAAO,KAAG,sBAyCnD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAChC,MAAM,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,KAAK,iBAAiB,GAAG,IAAI,uCAehE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ExtBridgeConnectionApi } from '@mittwald/ext-bridge';
|
|
2
|
+
import { RemoteConnection } from '@mittwald/remote-dom-core';
|
|
3
|
+
import { ThreadIframe, ThreadNestedIframe } from '@quilted/threads';
|
|
4
|
+
export interface NavigationState {
|
|
5
|
+
pathname: string;
|
|
6
|
+
isPending: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface HostExports extends ExtBridgeConnectionApi {
|
|
9
|
+
setIsReady: (version?: Version) => Promise<void>;
|
|
10
|
+
setError: (error: string) => Promise<void>;
|
|
11
|
+
setNavigationState: (state: NavigationState) => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export interface RemoteExports {
|
|
14
|
+
render: (connection: RemoteConnection) => Promise<void>;
|
|
15
|
+
setPathname: (pathname: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export type RemoteToHostConnection = ThreadNestedIframe<HostExports, RemoteExports>;
|
|
18
|
+
export interface HostToRemoteConnection {
|
|
19
|
+
version: Version;
|
|
20
|
+
thread: ThreadIframe<RemoteExports, HostExports>;
|
|
21
|
+
updateHostPathname: (hostPathname?: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare enum Version {
|
|
24
|
+
vUnknown = 0,
|
|
25
|
+
v1 = 1,
|
|
26
|
+
v2 = 2,
|
|
27
|
+
v3 = 3
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/connection/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,sBAAsB;IACzD,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,kBAAkB,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CACrD,WAAW,EACX,aAAa,CACd,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACjD,kBAAkB,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD;AAED,oBAAY,OAAO;IACjB,QAAQ,IAAI;IACZ,EAAE,IAAI;IACN,EAAE,IAAI;IACN,EAAE,IAAI;CACP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/ext-bridge/implementation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,eAAO,MAAM,mBAAmB,EAO3B,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.d.ts","sourceRoot":"","sources":["../../src/index-node.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,CAAC;AAChB,cAAc,SAAS,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './connection
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './events/FlowRemoteEvent';
|
|
5
|
-
export * from './events/serializers';
|
|
6
|
-
export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@remote-dom/core/elements';
|
|
1
|
+
export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@mittwald/remote-dom-core/elements';
|
|
2
|
+
export * from './connection';
|
|
3
|
+
export * from './error';
|
|
7
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,wBAAwB,GAC9B,MAAM,oCAAoC,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThreadSerializationStructuredClone } from '@quilted/threads';
|
|
2
|
+
export declare class FlowThreadSerialization extends ThreadSerializationStructuredClone {
|
|
3
|
+
constructor();
|
|
4
|
+
private isSerializableByBase;
|
|
5
|
+
private omitSerialization;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=FlowThreadSerialization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowThreadSerialization.d.ts","sourceRoot":"","sources":["../../../src/serialization/FlowThreadSerialization.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kCAAkC,EAEnC,MAAM,kBAAkB,CAAC;AAM1B,qBAAa,uBAAwB,SAAQ,kCAAkC;;IA2C7E,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
interface SerializationStrategy<TIn, TOut> {
|
|
2
|
+
isApplicable: (val: unknown) => val is TIn;
|
|
3
|
+
apply: (val: TIn) => TOut;
|
|
4
|
+
}
|
|
5
|
+
declare const Key = "mittwald.flow-remote-core.serializer.name";
|
|
6
|
+
export interface SuccessfulSerializationResult<T> {
|
|
7
|
+
value: T;
|
|
8
|
+
[Key]: string;
|
|
9
|
+
}
|
|
10
|
+
export type SerializationResult<T> = {
|
|
11
|
+
applied: true;
|
|
12
|
+
result: SuccessfulSerializationResult<T>;
|
|
13
|
+
} | {
|
|
14
|
+
applied: false;
|
|
15
|
+
};
|
|
16
|
+
export declare class Serializer<TIn, TOut> {
|
|
17
|
+
private options;
|
|
18
|
+
constructor(options: {
|
|
19
|
+
name: string;
|
|
20
|
+
serialize: SerializationStrategy<TIn, TOut>;
|
|
21
|
+
deserialize: Pick<SerializationStrategy<TOut, TIn>, "apply">;
|
|
22
|
+
});
|
|
23
|
+
private apply;
|
|
24
|
+
serialize(val: unknown): SerializationResult<TOut>;
|
|
25
|
+
deserialize(val: unknown): SerializationResult<TIn>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=Serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Serializer.d.ts","sourceRoot":"","sources":["../../../src/serialization/Serializer.ts"],"names":[],"mappings":"AAAA,UAAU,qBAAqB,CAAC,GAAG,EAAE,IAAI;IACvC,YAAY,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,GAAG,CAAC;IAC3C,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;CAC3B;AAED,QAAA,MAAM,GAAG,8CAA8C,CAAC;AAExD,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC9C,KAAK,EAAE,CAAC,CAAC;IACT,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAC7B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC,CAAA;CAAE,GAC3D;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvB,qBAAa,UAAU,CAAC,GAAG,EAAE,IAAI;IAE7B,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,WAAW,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;KAC9D;IAGH,OAAO,CAAC,KAAK;IAkBN,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAAC,IAAI,CAAC;IAIlD,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CAAC,GAAG,CAAC;CAY3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataTransferText.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/dataTransferText.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,eAAO,MAAM,0BAA0B,kCAkBrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,eAAO,MAAM,sBAAsB,kCASjC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TRANSFERABLE } from '@quilted/threads';
|
|
2
|
+
import { Serializer } from '../Serializer';
|
|
3
|
+
export interface SerializedFile {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
lastModified: number;
|
|
7
|
+
content: ArrayBuffer;
|
|
8
|
+
[TRANSFERABLE]: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const fileSerializer: Serializer<File, SerializedFile>;
|
|
11
|
+
export declare const fileListSerializer: Serializer<FileList, SerializedFile[]>;
|
|
12
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAGxD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,WAAW,CAAC;IACrB,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CACxB;AAgBD,eAAO,MAAM,cAAc,kCASzB,CAAC;AAEH,eAAO,MAAM,kBAAkB,wCAa7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formData.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/formData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACvC,KAAK,eAAe,GAAG,aAAa,EAAE,CAAC;AAEvC,eAAO,MAAM,kBAAkB,uCAqB7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../../src/shim.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-remote-core",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.300",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core functionality to setup a remote/host environment",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/types/index.d.ts",
|
|
11
|
-
"
|
|
11
|
+
"node": "./dist/js/index-node.mjs",
|
|
12
|
+
"default": "./dist/js/index.mjs"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
@@ -21,25 +22,45 @@
|
|
|
21
22
|
"build": "vite build --config vite.build.config.ts",
|
|
22
23
|
"clean": "rimraf dist",
|
|
23
24
|
"test": "exit 0",
|
|
24
|
-
"test:compile": "tsc --noEmit"
|
|
25
|
+
"test:compile": "tsc --noEmit",
|
|
26
|
+
"test:unit": "vitest run --passWithNoTests"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@remote-dom
|
|
29
|
-
"
|
|
29
|
+
"@lit-labs/ssr-dom-shim": "^1.3.0",
|
|
30
|
+
"@mittwald/remote-dom-core": "1.7.0-mittwald.10",
|
|
31
|
+
"@quilted/threads": "^3.1.3",
|
|
32
|
+
"@types/invariant": "^2.2.37",
|
|
33
|
+
"invariant": "^2.2.4",
|
|
34
|
+
"remeda": "^2.22.3"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
37
|
+
"@internationalized/date": "^3.8.1",
|
|
38
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.300",
|
|
39
|
+
"@mittwald/flow-core": "",
|
|
40
|
+
"@mittwald/typescript-config": "",
|
|
41
|
+
"@types/node": "^22.15.23",
|
|
42
|
+
"nx": "^20.8.2",
|
|
43
|
+
"prettier": "^3.5.3",
|
|
36
44
|
"rimraf": "^6.0.1",
|
|
37
45
|
"rollup-preserve-directives": "^1.1.3",
|
|
38
|
-
"typescript": "^5.
|
|
39
|
-
"vite": "^6.
|
|
40
|
-
"vite-plugin-checker": "^0.
|
|
41
|
-
"vite-plugin-dts": "^4.5.
|
|
42
|
-
"vite-plugin-externalize-deps": "^0.9.0"
|
|
46
|
+
"typescript": "^5.8.3",
|
|
47
|
+
"vite": "^6.3.5",
|
|
48
|
+
"vite-plugin-checker": "^0.9.3",
|
|
49
|
+
"vite-plugin-dts": "^4.5.4",
|
|
50
|
+
"vite-plugin-externalize-deps": "^0.9.0",
|
|
51
|
+
"vitest": "^3.1.4"
|
|
43
52
|
},
|
|
44
|
-
"
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@internationalized/date": "^3.8.1",
|
|
55
|
+
"@mittwald/ext-bridge": "*"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@mittwald/ext-bridge": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@internationalized/date": {
|
|
62
|
+
"optional": true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"gitHead": "a06879e8f973c3a14bbd92b4edce05cf69ccfdeb"
|
|
45
66
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Mittwald CM Service GmbH & Co. KG and contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ThreadIframe as i, ThreadNestedIframe as c } from "@quilted/threads";
|
|
2
|
-
import { RemoteElement as k, RemoteEvent as H } from "@remote-dom/core/elements";
|
|
3
|
-
import * as r from "remeda";
|
|
4
|
-
import { isObjectType as m, isString as a, isNumber as d, isBoolean as p } from "remeda";
|
|
5
|
-
const b = (e) => {
|
|
6
|
-
const t = new i(e.iframe);
|
|
7
|
-
return t.imports.render(e.connection), t;
|
|
8
|
-
}, R = (e) => (t) => {
|
|
9
|
-
t && !("__remoteConnectionEstablished" in t) && (Object.assign(t, { __remoteConnectionEstablished: !0 }), b({
|
|
10
|
-
iframe: t,
|
|
11
|
-
connection: e
|
|
12
|
-
}));
|
|
13
|
-
}, l = (e) => {
|
|
14
|
-
new c({
|
|
15
|
-
exports: {
|
|
16
|
-
render: (t) => {
|
|
17
|
-
import("@remote-dom/core/elements").then(
|
|
18
|
-
({ RemoteMutationObserver: o }) => {
|
|
19
|
-
new o(t).observe(e);
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}, h = (e) => {
|
|
26
|
-
e && !("__remoteConnectionEstablished" in e) && (Object.assign(e, { __remoteConnectionEstablished: !0 }), l(e));
|
|
27
|
-
}, f = (e) => a(e) || d(e) || p(e), E = (e) => m(e) ? r.pickBy(e, f) : e, I = (...e) => (t) => r.pick(t, e), u = E, C = (e, t, o = {}) => (n) => {
|
|
28
|
-
const s = o[t] ?? u;
|
|
29
|
-
return e(s(n));
|
|
30
|
-
};
|
|
31
|
-
class w extends CustomEvent {
|
|
32
|
-
constructor(t, o) {
|
|
33
|
-
super(t, {
|
|
34
|
-
detail: o
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
w as FlowRemoteEvent,
|
|
40
|
-
k as RemoteElement,
|
|
41
|
-
H as RemoteEvent,
|
|
42
|
-
l as connectHostIframe,
|
|
43
|
-
h as connectHostIframeRef,
|
|
44
|
-
b as connectRemoteIframe,
|
|
45
|
-
R as connectRemoteIframeRef,
|
|
46
|
-
C as mapEventHandler,
|
|
47
|
-
I as pick,
|
|
48
|
-
E as primitiveFlat,
|
|
49
|
-
u as standard
|
|
50
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectHostIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostIframe.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,WAAY,iBAAiB,SAa1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAS,iBAAiB,GAAG,IAAI,SAKjE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlowRemoteEvent.d.ts","sourceRoot":"","sources":["../../../src/events/FlowRemoteEvent.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAe,CAAC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;gBACjC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;CAK3C"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type EventHandler = (event: unknown) => void;
|
|
2
|
-
export declare const mapEventHandler: (eventHandler: EventHandler, eventName: string, eventSerialization?: EventSerializationMap) => (event: unknown) => void;
|
|
3
|
-
export type EventSerialization = (event: unknown) => unknown;
|
|
4
|
-
export type EventSerializationMap = Record<string, EventSerialization>;
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAEpD,eAAO,MAAM,eAAe,iBAEV,YAAY,aACf,MAAM,uBACG,qBAAqB,aAEnC,OAAO,SAGd,CAAC;AAEJ,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EventSerialization } from './index';
|
|
2
|
-
export declare const primitiveFlat: EventSerialization;
|
|
3
|
-
export declare const pick: (...props: string[]) => EventSerialization;
|
|
4
|
-
export declare const standard: EventSerialization;
|
|
5
|
-
//# sourceMappingURL=serializers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/events/serializers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAKzD,eAAO,MAAM,aAAa,EAAE,kBACyC,CAAC;AAEtE,eAAO,MAAM,IAAI,aACJ,MAAM,EAAE,KAAG,kBAES,CAAC;AAElC,eAAO,MAAM,QAAQ,oBAAgB,CAAC"}
|