@mittwald/flow-remote-core 0.2.0-alpha.61 → 0.2.0-alpha.610
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 +16 -0
- package/dist/js/index-node.mjs.map +1 -0
- package/dist/js/index.mjs +15 -0
- package/dist/js/index.mjs.map +1 -0
- package/dist/js/remote-core/src/connection/connectHostRenderRoot.mjs +58 -0
- package/dist/js/remote-core/src/connection/connectHostRenderRoot.mjs.map +1 -0
- package/dist/js/remote-core/src/connection/connectRemoteIframe.mjs +65 -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 +60 -0
- package/dist/js/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/Serializer.mjs +36 -0
- package/dist/js/remote-core/src/serialization/Serializer.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/dataTransferText.mjs +23 -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 +34 -0
- package/dist/js/remote-core/src/serialization/serializers/file.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/fileList.mjs +24 -0
- package/dist/js/remote-core/src/serialization/serializers/fileList.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/formData.mjs +36 -0
- package/dist/js/remote-core/src/serialization/serializers/formData.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/index.mjs +7 -0
- package/dist/js/remote-core/src/serialization/serializers/index.mjs.map +1 -0
- package/dist/js/remote-core/src/serialization/serializers/passwordPolicy.mjs +16 -0
- package/dist/js/remote-core/src/serialization/serializers/passwordPolicy.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 +10 -6
- package/dist/types/connection/connectHostRenderRoot.d.ts.map +1 -1
- package/dist/types/connection/connectRemoteIframe.d.ts +11 -9
- 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 +31 -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 +5 -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/FlowThreadSerialization.test.d.ts +2 -0
- package/dist/types/serialization/FlowThreadSerialization.test.d.ts.map +1 -0
- package/dist/types/serialization/Serialization.test.d.ts +2 -0
- package/dist/types/serialization/Serialization.test.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/index.d.ts +4 -0
- package/dist/types/serialization/index.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/fileList.d.ts +4 -0
- package/dist/types/serialization/serializers/fileList.d.ts.map +1 -0
- package/dist/types/serialization/serializers/formData.d.ts +3 -0
- package/dist/types/serialization/serializers/formData.d.ts.map +1 -0
- package/dist/types/serialization/serializers/index.d.ts +7 -0
- package/dist/types/serialization/serializers/index.d.ts.map +1 -0
- package/dist/types/serialization/serializers/passwordPolicy.d.ts +4 -0
- package/dist/types/serialization/serializers/passwordPolicy.d.ts.map +1 -0
- package/dist/types/shim.d.ts +2 -0
- package/dist/types/shim.d.ts.map +1 -0
- package/dist/types/tests/utils.d.ts +2 -0
- package/dist/types/tests/utils.d.ts.map +1 -0
- package/package.json +37 -19
- package/dist/index.js +0 -48
- 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 && file[Key] instanceof ArrayBuffer && !file[Key].detached;
|
|
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, isFileWithAwaitedArrayBuffer };
|
|
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\nexport function isFileWithAwaitedArrayBuffer(\n file: File | FileWithAwaitedArrayBuffer,\n): file is FileWithAwaitedArrayBuffer {\n return Key in file && file[Key] instanceof ArrayBuffer && !file[Key].detached;\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 return file;\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,GAAA,GAAM,4CAAA;AAML,SAAS,6BACd,IAAA,EACoC;AACpC,EAAA,OAAO,GAAA,IAAO,QAAQ,IAAA,CAAK,GAAG,aAAa,WAAA,IAAe,CAAC,IAAA,CAAK,GAAG,CAAA,CAAE,QAAA;AACvE;AAaO,MAAM,mBAAA,GAAsB,CACjC,IAAA,KACG;AACH,EAAA,SAAA;AAAA,IACE,6BAA6B,IAAI,CAAA;AAAA,IACjC;AAAA,GACF;AACA,EAAA,OAAO,KAAK,GAAG,CAAA;AACjB;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './remote-core/src/shim.mjs';
|
|
2
|
+
export { RemoteReceiver } from '@mittwald/remote-dom-core/receivers';
|
|
3
|
+
export { RemoteElement, RemoteEvent } from '@mittwald/remote-dom-core/elements';
|
|
4
|
+
export { calendarDateSerializer } from './remote-core/src/serialization/serializers/date.mjs';
|
|
5
|
+
export { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile } from './remote-core/src/serialization/serializers/file.mjs';
|
|
6
|
+
export { fileListSerializer } from './remote-core/src/serialization/serializers/fileList.mjs';
|
|
7
|
+
export { dataTransferTextSerializer } from './remote-core/src/serialization/serializers/dataTransferText.mjs';
|
|
8
|
+
export { formDataSerializer } from './remote-core/src/serialization/serializers/formData.mjs';
|
|
9
|
+
export { passwordPolicySerializer } from './remote-core/src/serialization/serializers/passwordPolicy.mjs';
|
|
10
|
+
export { FlowThreadSerialization } from './remote-core/src/serialization/FlowThreadSerialization.mjs';
|
|
11
|
+
export { Serializer } from './remote-core/src/serialization/Serializer.mjs';
|
|
12
|
+
export { connectHostRenderRoot, connectHostRenderRootRef, connectRemoteReceiver } from './remote-core/src/connection/connectHostRenderRoot.mjs';
|
|
13
|
+
export { connectRemoteIframe, connectRemoteIframeRef } from './remote-core/src/connection/connectRemoteIframe.mjs';
|
|
14
|
+
export { Version } from './remote-core/src/connection/types.mjs';
|
|
15
|
+
export { RemoteError } from './remote-core/src/error.mjs';
|
|
16
|
+
//# sourceMappingURL=index-node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { RemoteReceiver } from '@mittwald/remote-dom-core/receivers';
|
|
2
|
+
export { RemoteElement, RemoteEvent } from '@mittwald/remote-dom-core/elements';
|
|
3
|
+
export { calendarDateSerializer } from './remote-core/src/serialization/serializers/date.mjs';
|
|
4
|
+
export { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile } from './remote-core/src/serialization/serializers/file.mjs';
|
|
5
|
+
export { fileListSerializer } from './remote-core/src/serialization/serializers/fileList.mjs';
|
|
6
|
+
export { dataTransferTextSerializer } from './remote-core/src/serialization/serializers/dataTransferText.mjs';
|
|
7
|
+
export { formDataSerializer } from './remote-core/src/serialization/serializers/formData.mjs';
|
|
8
|
+
export { passwordPolicySerializer } from './remote-core/src/serialization/serializers/passwordPolicy.mjs';
|
|
9
|
+
export { FlowThreadSerialization } from './remote-core/src/serialization/FlowThreadSerialization.mjs';
|
|
10
|
+
export { Serializer } from './remote-core/src/serialization/Serializer.mjs';
|
|
11
|
+
export { connectHostRenderRoot, connectHostRenderRootRef, connectRemoteReceiver } from './remote-core/src/connection/connectHostRenderRoot.mjs';
|
|
12
|
+
export { connectRemoteIframe, connectRemoteIframeRef } from './remote-core/src/connection/connectRemoteIframe.mjs';
|
|
13
|
+
export { Version } from './remote-core/src/connection/types.mjs';
|
|
14
|
+
export { RemoteError } from './remote-core/src/error.mjs';
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 connectRemoteReceiver = (root, receiverConnection) => import('@mittwald/remote-dom-core/elements').then(
|
|
9
|
+
({ RemoteMutationObserver }) => {
|
|
10
|
+
const observer = new RemoteMutationObserver(receiverConnection);
|
|
11
|
+
observer.observe(root);
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
const connectHostRenderRoot = async (options) => {
|
|
15
|
+
const { root, onPathnameChanged } = options;
|
|
16
|
+
const connection = new ThreadNestedIframe({
|
|
17
|
+
serialization: new FlowThreadSerialization(),
|
|
18
|
+
exports: {
|
|
19
|
+
render: (connection2) => connectRemoteReceiver(root, connection2),
|
|
20
|
+
setPathname: async (pathname) => {
|
|
21
|
+
onPathnameChanged?.(pathname);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (connection.parent === window) {
|
|
26
|
+
throw incompatibleParentFrameError();
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
await connection.imports.setIsReady(Version.v3);
|
|
30
|
+
if (typeof mwExtBridge !== "undefined") {
|
|
31
|
+
mwExtBridge.connection = connection.imports;
|
|
32
|
+
await mwExtBridge.readiness.setIsReady();
|
|
33
|
+
}
|
|
34
|
+
return connection;
|
|
35
|
+
} catch (error) {
|
|
36
|
+
if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) {
|
|
37
|
+
throw incompatibleParentFrameError();
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const connectHostRenderRootRef = (opts) => (ref) => {
|
|
43
|
+
if (ref === null) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if ("__remoteConnection" in ref) {
|
|
47
|
+
return ref["__remoteConnection"];
|
|
48
|
+
}
|
|
49
|
+
const connection = connectHostRenderRoot({
|
|
50
|
+
root: ref,
|
|
51
|
+
...opts
|
|
52
|
+
});
|
|
53
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
54
|
+
return connection;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { connectHostRenderRoot, connectHostRenderRootRef, connectRemoteReceiver };
|
|
58
|
+
//# 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 connectRemoteReceiver = (\n root: HTMLDivElement,\n receiverConnection: RemoteConnection,\n) =>\n import(\"@mittwald/remote-dom-core/elements\").then(\n ({ RemoteMutationObserver }) => {\n const observer = new RemoteMutationObserver(receiverConnection);\n observer.observe(root);\n },\n );\n\nexport const connectHostRenderRoot = async (\n options: Options,\n): Promise<RemoteToHostConnection> => {\n const { root, onPathnameChanged } = options;\n\n const connection = new ThreadNestedIframe<HostExports, RemoteExports>({\n serialization: new FlowThreadSerialization(),\n exports: {\n render: (connection: RemoteConnection) =>\n connectRemoteReceiver(root, connection),\n setPathname: async (pathname) => {\n onPathnameChanged?.(pathname);\n },\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady(Version.v3);\n\n if (typeof mwExtBridge !== \"undefined\") {\n mwExtBridge.connection = connection.imports;\n await mwExtBridge.readiness.setIsReady();\n }\n\n return connection;\n } catch (error) {\n if (\n error instanceof Error &&\n /No '.*' method is exported from this thread/.test(error.message)\n ) {\n throw incompatibleParentFrameError();\n }\n throw error;\n }\n};\n\nexport const connectHostRenderRootRef =\n (opts: Omit<Options, \"root\">) => (ref: HTMLDivElement | null) => {\n if (ref === null) {\n return;\n }\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as Promise<RemoteToHostConnection>;\n }\n\n const connection = connectHostRenderRoot({\n root: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":["connection"],"mappings":";;;;;;AAgBA,MAAM,4BAAA,GAA+B,MACnC,IAAI,WAAA,CAAY,4CAA4C,CAAA;AAEvD,MAAM,wBAAwB,CACnC,IAAA,EACA,kBAAA,KAEA,OAAO,oCAAoC,CAAA,CAAE,IAAA;AAAA,EAC3C,CAAC,EAAE,sBAAA,EAAuB,KAAM;AAC9B,IAAA,MAAM,QAAA,GAAW,IAAI,sBAAA,CAAuB,kBAAkB,CAAA;AAC9D,IAAA,QAAA,CAAS,QAAQ,IAAI,CAAA;AAAA,EACvB;AACF;AAEK,MAAM,qBAAA,GAAwB,OACnC,OAAA,KACoC;AACpC,EAAA,MAAM,EAAE,IAAA,EAAM,iBAAA,EAAkB,GAAI,OAAA;AAEpC,EAAA,MAAM,UAAA,GAAa,IAAI,kBAAA,CAA+C;AAAA,IACpE,aAAA,EAAe,IAAI,uBAAA,EAAwB;AAAA,IAC3C,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,CAACA,WAAAA,KACP,qBAAA,CAAsB,MAAMA,WAAU,CAAA;AAAA,MACxC,WAAA,EAAa,OAAO,QAAA,KAAa;AAC/B,QAAA,iBAAA,GAAoB,QAAQ,CAAA;AAAA,MAC9B;AAAA;AACF,GACD,CAAA;AAED,EAAA,IAAI,UAAA,CAAW,WAAW,MAAA,EAAQ;AAChC,IAAA,MAAM,4BAAA,EAA6B;AAAA,EACrC;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,UAAA,CAAW,OAAA,CAAQ,UAAA,CAAW,OAAA,CAAQ,EAAE,CAAA;AAE9C,IAAA,IAAI,OAAO,gBAAgB,WAAA,EAAa;AACtC,MAAA,WAAA,CAAY,aAAa,UAAA,CAAW,OAAA;AACpC,MAAA,MAAM,WAAA,CAAY,UAAU,UAAA,EAAW;AAAA,IACzC;AAEA,IAAA,OAAO,UAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,IACE,iBAAiB,KAAA,IACjB,6CAAA,CAA8C,IAAA,CAAK,KAAA,CAAM,OAAO,CAAA,EAChE;AACA,MAAA,MAAM,4BAAA,EAA6B;AAAA,IACrC;AACA,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAEO,MAAM,wBAAA,GACX,CAAC,IAAA,KAAgC,CAAC,GAAA,KAA+B;AAC/D,EAAA,IAAI,QAAQ,IAAA,EAAM;AAChB,IAAA;AAAA,EACF;AACA,EAAA,IAAI,wBAAwB,GAAA,EAAK;AAC/B,IAAA,OAAO,IAAI,oBAAoB,CAAA;AAAA,EACjC;AAEA,EAAA,MAAM,aAAa,qBAAA,CAAsB;AAAA,IACvC,IAAA,EAAM,GAAA;AAAA,IACN,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
onLoadingChanged,
|
|
12
|
+
onError,
|
|
13
|
+
onNavigationStateChanged,
|
|
14
|
+
extBridgeImplementation = emptyImplementation
|
|
15
|
+
} = opts;
|
|
16
|
+
const result = {
|
|
17
|
+
thread: new ThreadIframe(iframe, {
|
|
18
|
+
serialization: new FlowThreadSerialization(),
|
|
19
|
+
exports: {
|
|
20
|
+
...extBridgeImplementation,
|
|
21
|
+
setIsReady: async (version = 1) => {
|
|
22
|
+
result.version = version;
|
|
23
|
+
onReady?.(result);
|
|
24
|
+
},
|
|
25
|
+
setIsLoading: async (isLoading) => {
|
|
26
|
+
onLoadingChanged?.(isLoading);
|
|
27
|
+
},
|
|
28
|
+
setError: async (error) => {
|
|
29
|
+
onError?.(error);
|
|
30
|
+
},
|
|
31
|
+
setNavigationState: async (state) => {
|
|
32
|
+
onNavigationStateChanged?.(state);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
version: 0,
|
|
37
|
+
updateHostPathname: (hostPathname) => {
|
|
38
|
+
if (hostPathname === void 0) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (result.version >= Version.v2) {
|
|
42
|
+
result.thread.imports.setPathname(hostPathname);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
result.thread.imports.render(connection);
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
const connectRemoteIframeRef = (opts) => (ref) => {
|
|
50
|
+
if (!ref) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if ("__remoteConnection" in ref) {
|
|
54
|
+
return ref["__remoteConnection"];
|
|
55
|
+
}
|
|
56
|
+
const connection = connectRemoteIframe({
|
|
57
|
+
iframe: ref,
|
|
58
|
+
...opts
|
|
59
|
+
});
|
|
60
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
61
|
+
return connection;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { connectRemoteIframe, connectRemoteIframeRef };
|
|
65
|
+
//# 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 onLoadingChanged?: (isLoading: boolean) => 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 onLoadingChanged,\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 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 },\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":";;;;;AAuBO,MAAM,mBAAA,GAAsB,CAAC,IAAA,KAA0C;AAC5E,EAAA,MAAM;AAAA,IACJ,UAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,gBAAA;AAAA,IACA,OAAA;AAAA,IACA,wBAAA;AAAA,IACA,uBAAA,GAA0B;AAAA,GAC5B,GAAI,IAAA;AAEJ,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,IAAI,YAAA,CAAyC,MAAA,EAAQ;AAAA,MAC3D,aAAA,EAAe,IAAI,uBAAA,EAAwB;AAAA,MAC3C,OAAA,EAAS;AAAA,QACP,GAAG,uBAAA;AAAA,QACH,UAAA,EAAY,OAAO,OAAA,GAAU,CAAA,KAAM;AACjC,UAAA,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,UAAA,OAAA,GAAU,MAAM,CAAA;AAAA,QAClB,CAAA;AAAA,QACA,YAAA,EAAc,OAAO,SAAA,KAAuB;AAC1C,UAAA,gBAAA,GAAmB,SAAS,CAAA;AAAA,QAC9B,CAAA;AAAA,QACA,QAAA,EAAU,OAAO,KAAA,KAAkB;AACjC,UAAA,OAAA,GAAU,KAAK,CAAA;AAAA,QACjB,CAAA;AAAA,QACA,kBAAA,EAAoB,OAAO,KAAA,KAAU;AACnC,UAAA,wBAAA,GAA2B,KAAK,CAAA;AAAA,QAClC;AAAA;AACF,KACD,CAAA;AAAA,IACD,OAAA,EAAS,CAAA;AAAA,IACT,kBAAA,EAAoB,CAAC,YAAA,KAA0B;AAC7C,MAAA,IAAI,iBAAiB,MAAA,EAAW;AAC9B,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,MAAA,CAAO,OAAA,IAAW,OAAA,CAAQ,EAAA,EAAI;AAChC,QAAA,MAAA,CAAO,MAAA,CAAO,OAAA,CAAQ,WAAA,CAAY,YAAY,CAAA;AAAA,MAChD;AAAA,IACF;AAAA,GACF;AAEA,EAAA,MAAA,CAAO,MAAA,CAAO,OAAA,CAAQ,MAAA,CAAO,UAAU,CAAA;AACvC,EAAA,OAAO,MAAA;AACT;AAEO,MAAM,sBAAA,GACX,CAAC,IAAA,KAAkC,CAAC,GAAA,KAAkC;AACpE,EAAA,IAAI,CAAC,GAAA,EAAK;AACR,IAAA;AAAA,EACF;AAEA,EAAA,IAAI,wBAAwB,GAAA,EAAK;AAC/B,IAAA,OAAO,IAAI,oBAAoB,CAAA;AAAA,EACjC;AAEA,EAAA,MAAM,aAAa,mBAAA,CAAoB;AAAA,IACrC,MAAA,EAAQ,GAAA;AAAA,IACR,GAAG;AAAA,GACJ,CAAA;AACD,EAAA,MAAA,CAAO,MAAA,CAAO,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAA,OAAO,UAAA;AACT;;;;"}
|
|
@@ -0,0 +1,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\";\nexport type { RemoteConnection } from \"@mittwald/remote-dom-core\";\n\nexport interface NavigationState {\n pathname: string;\n isPending: boolean;\n}\n\nexport interface HostExports extends ExtBridgeConnectionApi {\n setIsReady: (version?: Version) => Promise<void>;\n setIsLoading: (isLoading: boolean) => Promise<void>;\n setError: (error: string) => Promise<void>;\n setNavigationState: (state: NavigationState) => Promise<void>;\n}\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":"AAiCO,IAAK,OAAA,qBAAAA,QAAAA,KAAL;AACL,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,cAAW,CAAA,CAAA,GAAX,UAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AAJU,EAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.mjs","sources":["../../../../src/error.ts"],"sourcesContent":["export class RemoteError extends Error {\n constructor(message: string) {\n super(message);\n this.message = message;\n }\n}\n\nRemoteError.prototype.name = \"RemoteError\";\n"],"names":[],"mappings":"AAAO,MAAM,oBAAoB,KAAA,CAAM;AAAA,EACrC,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AACF;AAEA,WAAA,CAAY,UAAU,IAAA,GAAO,aAAA;;;;"}
|
|
@@ -0,0 +1,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,GAAA,GAAM;AACJ,MAAA,MAAM,IAAI,YAAY,+CAA+C,CAAA;AAAA,IACvE;AAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ThreadSerializationStructuredClone, TRANSFERABLE } from '@quilted/threads';
|
|
2
|
+
import * as index from './serializers/index.mjs';
|
|
3
|
+
import { isObjectType } from 'remeda';
|
|
4
|
+
import { Serializer } from './Serializer.mjs';
|
|
5
|
+
|
|
6
|
+
const serializers = Object.values(index).filter(
|
|
7
|
+
(val) => val instanceof Serializer
|
|
8
|
+
);
|
|
9
|
+
class FlowThreadSerialization extends ThreadSerializationStructuredClone {
|
|
10
|
+
constructor() {
|
|
11
|
+
const options = {
|
|
12
|
+
serialize: (val, serialize) => {
|
|
13
|
+
try {
|
|
14
|
+
if (this.isSerializableByBase(val)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (this.omitSerialization(val)) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
for (const serializer of serializers) {
|
|
21
|
+
const serialization = serializer.serialize(val);
|
|
22
|
+
if (serialization.applied) {
|
|
23
|
+
return serialize(serialization.result);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (isObjectType(val)) {
|
|
27
|
+
return serialize({ ...val });
|
|
28
|
+
}
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error("Error while serializing", error);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
deserialize: (val, serialize) => {
|
|
35
|
+
try {
|
|
36
|
+
for (const serializer of serializers) {
|
|
37
|
+
const deserialization = serializer.deserialize(val);
|
|
38
|
+
if (deserialization.applied) {
|
|
39
|
+
return deserialization.result.value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return serialize(val);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("Error while deserializing", error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
super(options);
|
|
50
|
+
}
|
|
51
|
+
isSerializableByBase(val) {
|
|
52
|
+
return val instanceof Map || val instanceof Set || Array.isArray(val) || typeof val === "function" || isObjectType(val) && TRANSFERABLE in val;
|
|
53
|
+
}
|
|
54
|
+
omitSerialization(val) {
|
|
55
|
+
return val instanceof HTMLElement || val === window;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { FlowThreadSerialization };
|
|
60
|
+
//# 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 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: (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);\n if (serialization.applied) {\n return serialize(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);\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 (isObjectType(val) && TRANSFERABLE in val)\n );\n }\n\n private omitSerialization(val: unknown) {\n return val instanceof HTMLElement || val === window;\n }\n}\n"],"names":["serializerModules"],"mappings":";;;;;AASA,MAAM,WAAA,GAAc,MAAA,CAAO,MAAA,CAAOA,KAAiB,CAAA,CAAE,MAAA;AAAA,EACnD,CAAC,QAAQ,GAAA,YAAe;AAC1B,CAAA;AAEO,MAAM,gCAAgC,kCAAA,CAAmC;AAAA,EACvE,WAAA,GAAc;AACnB,IAAA,MAAM,OAAA,GAAsC;AAAA,MAC1C,SAAA,EAAW,CAAC,GAAA,EAAK,SAAA,KAAc;AAC7B,QAAA,IAAI;AACF,UAAA,IAAI,IAAA,CAAK,oBAAA,CAAqB,GAAG,CAAA,EAAG;AAClC,YAAA;AAAA,UACF;AACA,UAAA,IAAI,IAAA,CAAK,iBAAA,CAAkB,GAAG,CAAA,EAAG;AAC/B,YAAA,OAAO,IAAA;AAAA,UACT;AACA,UAAA,KAAA,MAAW,cAAc,WAAA,EAAa;AACpC,YAAA,MAAM,aAAA,GAAgB,UAAA,CAAW,SAAA,CAAU,GAAG,CAAA;AAC9C,YAAA,IAAI,cAAc,OAAA,EAAS;AACzB,cAAA,OAAO,SAAA,CAAU,cAAc,MAAM,CAAA;AAAA,YACvC;AAAA,UACF;AACA,UAAA,IAAI,YAAA,CAAa,GAAG,CAAA,EAAG;AACrB,YAAA,OAAO,SAAA,CAAU,EAAE,GAAG,GAAA,EAAK,CAAA;AAAA,UAC7B;AAAA,QACF,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF,CAAA;AAAA,MACA,WAAA,EAAa,CAAC,GAAA,EAAK,SAAA,KAAc;AAC/B,QAAA,IAAI;AACF,UAAA,KAAA,MAAW,cAAc,WAAA,EAAa;AACpC,YAAA,MAAM,eAAA,GAAkB,UAAA,CAAW,WAAA,CAAY,GAAG,CAAA;AAClD,YAAA,IAAI,gBAAgB,OAAA,EAAS;AAC3B,cAAA,OAAO,gBAAgB,MAAA,CAAO,KAAA;AAAA,YAChC;AAAA,UACF;AACA,UAAA,OAAO,UAAU,GAAG,CAAA;AAAA,QACtB,SAAS,KAAA,EAAO;AACd,UAAA,OAAA,CAAQ,KAAA,CAAM,6BAA6B,KAAK,CAAA;AAChD,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF;AAAA,KACF;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAAA,EACf;AAAA,EAEQ,qBAAqB,GAAA,EAAc;AACzC,IAAA,OACE,GAAA,YAAe,GAAA,IACf,GAAA,YAAe,GAAA,IACf,MAAM,OAAA,CAAQ,GAAG,CAAA,IACjB,OAAO,GAAA,KAAQ,UAAA,IACd,YAAA,CAAa,GAAG,KAAK,YAAA,IAAgB,GAAA;AAAA,EAE1C;AAAA,EAEQ,kBAAkB,GAAA,EAAc;AACtC,IAAA,OAAO,GAAA,YAAe,eAAe,GAAA,KAAQ,MAAA;AAAA,EAC/C;AACF;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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) => {
|
|
26
|
+
return this.options.deserialize.apply(serialization.value);
|
|
27
|
+
},
|
|
28
|
+
isApplicable: (val2) => {
|
|
29
|
+
return !!val2 && typeof val2 === "object" && Key in val2 && val2[Key] === this.options.name;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Serializer };
|
|
36
|
+
//# 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 return this.options.deserialize.apply(serialization.value);\n },\n isApplicable: (val): val is SuccessfulSerializationResult<TOut> => {\n return (\n !!val &&\n typeof val === \"object\" &&\n Key in val &&\n val[Key] === this.options.name\n );\n },\n });\n }\n}\n"],"names":["val"],"mappings":"AAKA,MAAM,GAAA,GAAM,2CAAA;AAWL,MAAM,UAAA,CAAsB;AAAA,EAC1B,YACG,OAAA,EAKR;AALQ,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA,EAKP;AAAA,EAEK,KAAA,CACN,KACA,QAAA,EAC2B;AAC3B,IAAA,IAAI,QAAA,CAAS,YAAA,CAAa,GAAG,CAAA,EAAG;AAC9B,MAAA,OAAO;AAAA,QACL,OAAA,EAAS,IAAA;AAAA,QACT,MAAA,EAAQ;AAAA,UACN,CAAC,GAAG,GAAG,IAAA,CAAK,OAAA,CAAQ,IAAA;AAAA,UACpB,KAAA,EAAO,QAAA,CAAS,KAAA,CAAM,GAAG;AAAA;AAC3B,OACF;AAAA,IACF;AACA,IAAA,OAAO;AAAA,MACL,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AAAA,EAEO,UAAU,GAAA,EAAyC;AACxD,IAAA,OAAO,IAAA,CAAK,KAAA,CAAiB,GAAA,EAAK,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA,EAC1D;AAAA,EAEO,YAAY,GAAA,EAAwC;AACzD,IAAA,OAAO,IAAA,CAAK,MAAM,GAAA,EAAK;AAAA,MACrB,KAAA,EAAO,CAAC,aAAA,KAAuD;AAC7D,QAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,WAAA,CAAY,KAAA,CAAM,cAAc,KAAK,CAAA;AAAA,MAC3D,CAAA;AAAA,MACA,YAAA,EAAc,CAACA,IAAAA,KAAoD;AACjE,QAAA,OACE,CAAC,CAACA,IAAAA,IACF,OAAOA,IAAAA,KAAQ,QAAA,IACf,GAAA,IAAOA,IAAAA,IACPA,IAAAA,CAAI,GAAG,CAAA,KAAM,IAAA,CAAK,OAAA,CAAQ,IAAA;AAAA,MAE9B;AAAA,KACD,CAAA;AAAA,EACH;AACF;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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) => {
|
|
10
|
+
return dataTransfer.getData("text") || dataTransfer.getData("text/plain");
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
deserialize: {
|
|
14
|
+
apply: (asString) => {
|
|
15
|
+
const dataTransfer = new DataTransfer();
|
|
16
|
+
dataTransfer.setData("text", asString);
|
|
17
|
+
return dataTransfer;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export { dataTransferTextSerializer };
|
|
23
|
+
//# 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) => {\n return dataTransfer.getData(\"text\") || dataTransfer.getData(\"text/plain\");\n },\n },\n deserialize: {\n apply: (asString) => {\n const dataTransfer = new DataTransfer();\n dataTransfer.setData(\"text\", asString);\n return dataTransfer;\n },\n },\n});\n"],"names":[],"mappings":";;AAEO,MAAM,0BAAA,GAA6B,IAAI,UAAA,CAAiC;AAAA,EAC7E,IAAA,EAAM,kBAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAA6B;AAC1C,MAAA,OACE,GAAA,YAAe,gBACf,GAAA,CAAI,KAAA,CAAM,MAAM,CAAC,IAAA,KAAS,SAAS,YAAY,CAAA;AAAA,IAEnD,CAAA;AAAA,IACA,KAAA,EAAO,CAAC,YAAA,KAAiB;AACvB,MAAA,OAAO,aAAa,OAAA,CAAQ,MAAM,CAAA,IAAK,YAAA,CAAa,QAAQ,YAAY,CAAA;AAAA,IAC1E;AAAA,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,QAAA,KAAa;AACnB,MAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AACtC,MAAA,YAAA,CAAa,OAAA,CAAQ,QAAQ,QAAQ,CAAA;AACrC,MAAA,OAAO,YAAA;AAAA,IACT;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,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":";;;AAIO,MAAM,sBAAA,GAAyB,IAAI,UAAA,CAAiC;AAAA,EACzE,IAAA,EAAM,cAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,GAAA,YAAe,YAAA;AAAA,IACtC,KAAA,EAAO,CAAC,IAAA,KAAS,IAAA,CAAK,QAAA;AAAS,GACjC;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,QAAA,KAAa,SAAA,CAAU,QAAQ;AAAA;AAE3C,CAAC;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { markAsTransferable } from '@quilted/threads';
|
|
2
|
+
import { Serializer } from '../Serializer.mjs';
|
|
3
|
+
import { getAwaitArrayBuffer } from '../../../../core/src/file.mjs';
|
|
4
|
+
|
|
5
|
+
const isSerializedFile = (value) => {
|
|
6
|
+
return !!(value && typeof value === "object" && "name" in value && "type" in value && "lastModified" in value && "content" in value);
|
|
7
|
+
};
|
|
8
|
+
const fileSerialize = (file) => {
|
|
9
|
+
return {
|
|
10
|
+
name: file.name,
|
|
11
|
+
type: file.type,
|
|
12
|
+
lastModified: file.lastModified,
|
|
13
|
+
content: markAsTransferable(getAwaitArrayBuffer(file))
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const fileDeSerialize = (file) => {
|
|
17
|
+
return new File([file.content], file.name, {
|
|
18
|
+
lastModified: file.lastModified,
|
|
19
|
+
type: file.type
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const fileSerializer = new Serializer({
|
|
23
|
+
name: "File",
|
|
24
|
+
serialize: {
|
|
25
|
+
isApplicable: (something) => something instanceof File,
|
|
26
|
+
apply: fileSerialize
|
|
27
|
+
},
|
|
28
|
+
deserialize: {
|
|
29
|
+
apply: fileDeSerialize
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile };
|
|
34
|
+
//# sourceMappingURL=file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.mjs","sources":["../../../../../../src/serialization/serializers/file.ts"],"sourcesContent":["import { markAsTransferable } from \"@quilted/threads\";\nimport { Serializer } from \"@/serialization/Serializer\";\nimport { getAwaitArrayBuffer } from \"@mittwald/flow-core\";\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 = (file: File): SerializedFile => {\n return {\n name: file.name,\n type: file.type,\n lastModified: file.lastModified,\n content: markAsTransferable(getAwaitArrayBuffer(file)),\n };\n};\n\nexport const fileDeSerialize = (file: SerializedFile) => {\n return new File([file.content], file.name, {\n lastModified: file.lastModified,\n type: file.type,\n });\n};\n\nexport const fileSerializer = new Serializer<File, SerializedFile>({\n name: \"File\",\n serialize: {\n isApplicable: (something) => something instanceof File,\n apply: fileSerialize,\n },\n deserialize: {\n apply: fileDeSerialize,\n },\n});\n"],"names":[],"mappings":";;;;AAWO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAA4C;AAC3E,EAAA,OAAO,CAAC,EACN,KAAA,IACA,OAAO,KAAA,KAAU,QAAA,IACjB,MAAA,IAAU,KAAA,IACV,MAAA,IAAU,KAAA,IACV,cAAA,IAAkB,KAAA,IAClB,SAAA,IAAa,KAAA,CAAA;AAEjB;AAEO,MAAM,aAAA,GAAgB,CAAC,IAAA,KAA+B;AAC3D,EAAA,OAAO;AAAA,IACL,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,cAAc,IAAA,CAAK,YAAA;AAAA,IACnB,OAAA,EAAS,kBAAA,CAAmB,mBAAA,CAAoB,IAAI,CAAC;AAAA,GACvD;AACF;AAEO,MAAM,eAAA,GAAkB,CAAC,IAAA,KAAyB;AACvD,EAAA,OAAO,IAAI,IAAA,CAAK,CAAC,KAAK,OAAO,CAAA,EAAG,KAAK,IAAA,EAAM;AAAA,IACzC,cAAc,IAAA,CAAK,YAAA;AAAA,IACnB,MAAM,IAAA,CAAK;AAAA,GACZ,CAAA;AACH;AAEO,MAAM,cAAA,GAAiB,IAAI,UAAA,CAAiC;AAAA,EACjE,IAAA,EAAM,MAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KAAc,SAAA,YAAqB,IAAA;AAAA,IAClD,KAAA,EAAO;AAAA,GACT;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO;AAAA;AAEX,CAAC;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Serializer } from '../Serializer.mjs';
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import { fileDeSerialize, fileSerialize } from './file.mjs';
|
|
4
|
+
import '@mittwald/flow-react-components/mittwald-password-tools-js';
|
|
5
|
+
|
|
6
|
+
const fileListSerializer = new Serializer({
|
|
7
|
+
name: "FileList",
|
|
8
|
+
serialize: {
|
|
9
|
+
isApplicable: (something) => {
|
|
10
|
+
return something instanceof FileList;
|
|
11
|
+
},
|
|
12
|
+
apply: (fileList) => Array.from(fileList).map(fileSerialize)
|
|
13
|
+
},
|
|
14
|
+
deserialize: {
|
|
15
|
+
apply: (arrayFiles) => {
|
|
16
|
+
const dataTransfer = new DataTransfer();
|
|
17
|
+
arrayFiles.forEach((f) => dataTransfer.items.add(fileDeSerialize(f)));
|
|
18
|
+
return dataTransfer.files;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { fileListSerializer };
|
|
24
|
+
//# sourceMappingURL=fileList.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileList.mjs","sources":["../../../../../../src/serialization/serializers/fileList.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n fileDeSerialize,\n fileSerialize,\n type SerializedFile,\n} from \"@/serialization/serializers\";\n\nexport const fileListSerializer = new Serializer<FileList, SerializedFile[]>({\n name: \"FileList\",\n serialize: {\n isApplicable: (something) => {\n return something instanceof FileList;\n },\n apply: (fileList) => Array.from(fileList).map(fileSerialize),\n },\n deserialize: {\n apply: (arrayFiles) => {\n const dataTransfer = new DataTransfer();\n arrayFiles.forEach((f) => dataTransfer.items.add(fileDeSerialize(f)));\n return dataTransfer.files;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAOO,MAAM,kBAAA,GAAqB,IAAI,UAAA,CAAuC;AAAA,EAC3E,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,SAAA,KAAc;AAC3B,MAAA,OAAO,SAAA,YAAqB,QAAA;AAAA,IAC9B,CAAA;AAAA,IACA,KAAA,EAAO,CAAC,QAAA,KAAa,KAAA,CAAM,KAAK,QAAQ,CAAA,CAAE,IAAI,aAAa;AAAA,GAC7D;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,UAAA,KAAe;AACrB,MAAA,MAAM,YAAA,GAAe,IAAI,YAAA,EAAa;AACtC,MAAA,UAAA,CAAW,OAAA,CAAQ,CAAC,CAAA,KAAM,YAAA,CAAa,MAAM,GAAA,CAAI,eAAA,CAAgB,CAAC,CAAC,CAAC,CAAA;AACpE,MAAA,OAAO,YAAA,CAAa,KAAA;AAAA,IACtB;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Serializer } from '../Serializer.mjs';
|
|
2
|
+
import '@internationalized/date';
|
|
3
|
+
import { isSerializedFile, fileDeSerialize, fileSerialize } from './file.mjs';
|
|
4
|
+
import '@mittwald/flow-react-components/mittwald-password-tools-js';
|
|
5
|
+
|
|
6
|
+
const formDataSerializer = new Serializer({
|
|
7
|
+
name: "FormData",
|
|
8
|
+
serialize: {
|
|
9
|
+
isApplicable: (val) => val instanceof FormData,
|
|
10
|
+
apply: (formData) => {
|
|
11
|
+
return formData.entries().toArray().map(([fieldName, fieldValue]) => {
|
|
12
|
+
if (fieldValue instanceof File) {
|
|
13
|
+
return [fieldName, fileSerialize(fieldValue)];
|
|
14
|
+
}
|
|
15
|
+
return [fieldName, fieldValue];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
deserialize: {
|
|
20
|
+
apply: (array) => {
|
|
21
|
+
const formData = new FormData();
|
|
22
|
+
for (const [name, value] of array) {
|
|
23
|
+
const deserializedValue = isSerializedFile(value) ? fileDeSerialize(value) : value;
|
|
24
|
+
if (!formData.has(name)) {
|
|
25
|
+
formData.set(name, deserializedValue);
|
|
26
|
+
} else {
|
|
27
|
+
formData.append(name, deserializedValue);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return formData;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export { formDataSerializer };
|
|
36
|
+
//# 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\";\nimport {\n fileDeSerialize,\n fileSerialize,\n isSerializedFile,\n} from \"@/serialization/serializers\";\n\nexport const formDataSerializer = new Serializer<\n FormData,\n [string, FormDataEntryValue][]\n>({\n name: \"FormData\",\n serialize: {\n isApplicable: (val) => val instanceof FormData,\n apply: (formData) => {\n return formData\n .entries()\n .toArray()\n .map(([fieldName, fieldValue]) => {\n if (fieldValue instanceof File) {\n return [fieldName, fileSerialize(fieldValue)];\n }\n\n return [fieldName, fieldValue];\n }) as [string, FormDataEntryValue][];\n },\n },\n deserialize: {\n apply: (array) => {\n const formData = new FormData();\n for (const [name, value] of array) {\n const deserializedValue = isSerializedFile(value)\n ? fileDeSerialize(value)\n : value;\n\n if (!formData.has(name)) {\n formData.set(name, deserializedValue);\n } else {\n formData.append(name, deserializedValue);\n }\n }\n return formData;\n },\n },\n});\n"],"names":[],"mappings":";;;;;AAOO,MAAM,kBAAA,GAAqB,IAAI,UAAA,CAGpC;AAAA,EACA,IAAA,EAAM,UAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,GAAA,YAAe,QAAA;AAAA,IACtC,KAAA,EAAO,CAAC,QAAA,KAAa;AACnB,MAAA,OAAO,QAAA,CACJ,OAAA,EAAQ,CACR,OAAA,EAAQ,CACR,IAAI,CAAC,CAAC,SAAA,EAAW,UAAU,CAAA,KAAM;AAChC,QAAA,IAAI,sBAAsB,IAAA,EAAM;AAC9B,UAAA,OAAO,CAAC,SAAA,EAAW,aAAA,CAAc,UAAU,CAAC,CAAA;AAAA,QAC9C;AAEA,QAAA,OAAO,CAAC,WAAW,UAAU,CAAA;AAAA,MAC/B,CAAC,CAAA;AAAA,IACL;AAAA,GACF;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,KAAA,KAAU;AAChB,MAAA,MAAM,QAAA,GAAW,IAAI,QAAA,EAAS;AAC9B,MAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,CAAA,IAAK,KAAA,EAAO;AACjC,QAAA,MAAM,oBAAoB,gBAAA,CAAiB,KAAK,CAAA,GAC5C,eAAA,CAAgB,KAAK,CAAA,GACrB,KAAA;AAEJ,QAAA,IAAI,CAAC,QAAA,CAAS,GAAA,CAAI,IAAI,CAAA,EAAG;AACvB,UAAA,QAAA,CAAS,GAAA,CAAI,MAAM,iBAAiB,CAAA;AAAA,QACtC,CAAA,MAAO;AACL,UAAA,QAAA,CAAS,MAAA,CAAO,MAAM,iBAAiB,CAAA;AAAA,QACzC;AAAA,MACF;AACA,MAAA,OAAO,QAAA;AAAA,IACT;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { calendarDateSerializer } from './date.mjs';
|
|
2
|
+
export { fileDeSerialize, fileSerialize, fileSerializer, isSerializedFile } from './file.mjs';
|
|
3
|
+
export { fileListSerializer } from './fileList.mjs';
|
|
4
|
+
export { dataTransferTextSerializer } from './dataTransferText.mjs';
|
|
5
|
+
export { formDataSerializer } from './formData.mjs';
|
|
6
|
+
export { passwordPolicySerializer } from './passwordPolicy.mjs';
|
|
7
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Serializer } from '../Serializer.mjs';
|
|
2
|
+
import { Policy } from '@mittwald/flow-react-components/mittwald-password-tools-js';
|
|
3
|
+
|
|
4
|
+
const passwordPolicySerializer = new Serializer({
|
|
5
|
+
name: "PasswordPolicy",
|
|
6
|
+
serialize: {
|
|
7
|
+
isApplicable: (val) => Policy.isPolicy(val),
|
|
8
|
+
apply: (policy) => policy.toDeclaration()
|
|
9
|
+
},
|
|
10
|
+
deserialize: {
|
|
11
|
+
apply: (policyDeclaration) => Policy.fromDeclaration(policyDeclaration)
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { passwordPolicySerializer };
|
|
16
|
+
//# sourceMappingURL=passwordPolicy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passwordPolicy.mjs","sources":["../../../../../../src/serialization/serializers/passwordPolicy.ts"],"sourcesContent":["import { Serializer } from \"@/serialization/Serializer\";\nimport {\n Policy,\n type PolicyDeclaration,\n} from \"@mittwald/flow-react-components/mittwald-password-tools-js\";\n\nexport const passwordPolicySerializer = new Serializer<\n Policy,\n PolicyDeclaration\n>({\n name: \"PasswordPolicy\",\n serialize: {\n isApplicable: (val) => Policy.isPolicy(val),\n apply: (policy) => policy.toDeclaration(),\n },\n deserialize: {\n apply: (policyDeclaration) => Policy.fromDeclaration(policyDeclaration),\n },\n});\n"],"names":[],"mappings":";;;AAMO,MAAM,wBAAA,GAA2B,IAAI,UAAA,CAG1C;AAAA,EACA,IAAA,EAAM,gBAAA;AAAA,EACN,SAAA,EAAW;AAAA,IACT,YAAA,EAAc,CAAC,GAAA,KAAQ,MAAA,CAAO,SAAS,GAAG,CAAA;AAAA,IAC1C,KAAA,EAAO,CAAC,MAAA,KAAW,MAAA,CAAO,aAAA;AAAc,GAC1C;AAAA,EACA,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,CAAC,iBAAA,KAAsB,MAAA,CAAO,gBAAgB,iBAAiB;AAAA;AAE1E,CAAC;;;;"}
|
|
@@ -0,0 +1,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,WAAA,GAAc,WAAA;AACzB,UAAA,CAAW,cAAA,GAAiB,cAAA;AAC5B,UAAA,CAAW,gBAAA,GAAmB,MAAM,gBAAA,CAAiB;AAAA,EAC5C,WAAA,GAAc;AAAA,EAErB;AAAA,EACO,UAAA,GAAa;AAAA,EAEpB;AAAA,EACO,OAAA,GAAU;AAAA,EAEjB;AAAA,EACO,WAAA,GAAc;AACnB,IAAA,OAAO,EAAC;AAAA,EACV;AACF,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { RemoteToHostConnection } from './types';
|
|
2
|
+
import { RemoteConnection } from '@mittwald/remote-dom-core/elements';
|
|
3
|
+
interface Options {
|
|
4
|
+
root: HTMLDivElement;
|
|
5
|
+
onPathnameChanged?: (pathname: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const connectRemoteReceiver: (root: HTMLDivElement, receiverConnection: RemoteConnection) => Promise<void>;
|
|
8
|
+
export declare const connectHostRenderRoot: (options: Options) => Promise<RemoteToHostConnection>;
|
|
9
|
+
export declare const connectHostRenderRootRef: (opts: Omit<Options, "root">) => (ref: HTMLDivElement | null) => Promise<RemoteToHostConnection> | undefined;
|
|
10
|
+
export {};
|
|
7
11
|
//# sourceMappingURL=connectHostRenderRoot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectHostRenderRoot.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostRenderRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"connectHostRenderRoot.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostRenderRoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,UAAU,OAAO;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAKD,eAAO,MAAM,qBAAqB,GAChC,MAAM,cAAc,EACpB,oBAAoB,gBAAgB,kBAOnC,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAChC,SAAS,OAAO,KACf,OAAO,CAAC,sBAAsB,CAoChC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAClC,MAAM,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,cAAc,GAAG,IAAI,gDAc3D,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
interface
|
|
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 {
|
|
5
5
|
connection: RemoteConnection;
|
|
6
6
|
iframe: HTMLIFrameElement;
|
|
7
|
+
onReady?: (connection: HostToRemoteConnection) => void;
|
|
8
|
+
onLoadingChanged?: (isLoading: boolean) => void;
|
|
9
|
+
onError?: (error: string) => void;
|
|
10
|
+
onNavigationStateChanged?: (state: NavigationState) => void;
|
|
11
|
+
extBridgeImplementation?: ExtBridgeConnectionApi;
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export declare const connectRemoteIframe: (opts: Opts) => ThreadIframe<ThreadIframeTarget, Record<string, never>>;
|
|
12
|
-
export declare const connectRemoteIframeRef: (connection: RemoteConnection) => (ref: HTMLIFrameElement | null) => void;
|
|
13
|
+
export declare const connectRemoteIframe: (opts: Options) => HostToRemoteConnection;
|
|
14
|
+
export declare const connectRemoteIframeRef: (opts: Omit<Options, "iframe">) => (ref: HTMLIFrameElement | null) => HostToRemoteConnection | undefined;
|
|
13
15
|
export {};
|
|
14
16
|
//# sourceMappingURL=connectRemoteIframe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectRemoteIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectRemoteIframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
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,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,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,sBA6CnD,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,31 @@
|
|
|
1
|
+
import { ExtBridgeConnectionApi } from '@mittwald/ext-bridge';
|
|
2
|
+
import { RemoteConnection } from '@mittwald/remote-dom-core';
|
|
3
|
+
import { ThreadIframe, ThreadNestedIframe } from '@quilted/threads';
|
|
4
|
+
export type { RemoteConnection } from '@mittwald/remote-dom-core';
|
|
5
|
+
export interface NavigationState {
|
|
6
|
+
pathname: string;
|
|
7
|
+
isPending: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface HostExports extends ExtBridgeConnectionApi {
|
|
10
|
+
setIsReady: (version?: Version) => Promise<void>;
|
|
11
|
+
setIsLoading: (isLoading: boolean) => Promise<void>;
|
|
12
|
+
setError: (error: string) => Promise<void>;
|
|
13
|
+
setNavigationState: (state: NavigationState) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export interface RemoteExports {
|
|
16
|
+
render: (connection: RemoteConnection) => Promise<void>;
|
|
17
|
+
setPathname: (pathname: string) => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export type RemoteToHostConnection = ThreadNestedIframe<HostExports, RemoteExports>;
|
|
20
|
+
export interface HostToRemoteConnection {
|
|
21
|
+
version: Version;
|
|
22
|
+
thread: ThreadIframe<RemoteExports, HostExports>;
|
|
23
|
+
updateHostPathname: (hostPathname?: string) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare enum Version {
|
|
26
|
+
vUnknown = 0,
|
|
27
|
+
v1 = 1,
|
|
28
|
+
v2 = 2,
|
|
29
|
+
v3 = 3
|
|
30
|
+
}
|
|
31
|
+
//# 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;AACzE,YAAY,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,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,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,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,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './events/serializers';
|
|
1
|
+
export { RemoteReceiver } from '@mittwald/remote-dom-core/receivers';
|
|
2
|
+
export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@mittwald/remote-dom-core/elements';
|
|
3
|
+
export * from './serialization';
|
|
4
|
+
export * from './connection';
|
|
5
|
+
export * from './error';
|
|
7
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,wBAAwB,GAC9B,MAAM,oCAAoC,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,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,EAGnC,MAAM,kBAAkB,CAAC;AAS1B,qBAAa,uBAAwB,SAAQ,kCAAkC;;IA2C7E,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowThreadSerialization.test.d.ts","sourceRoot":"","sources":["../../../src/serialization/FlowThreadSerialization.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Serialization.test.d.ts","sourceRoot":"","sources":["../../../src/serialization/Serialization.test.tsx"],"names":[],"mappings":""}
|
|
@@ -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;CAe3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/serialization/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC"}
|
|
@@ -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,kCAoBrC,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 { Serializer } from '../Serializer';
|
|
2
|
+
export interface SerializedFile {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
lastModified: number;
|
|
6
|
+
content: ArrayBuffer;
|
|
7
|
+
}
|
|
8
|
+
export declare const isSerializedFile: (value: unknown) => value is SerializedFile;
|
|
9
|
+
export declare const fileSerialize: (file: File) => SerializedFile;
|
|
10
|
+
export declare const fileDeSerialize: (file: SerializedFile) => File;
|
|
11
|
+
export declare const fileSerializer: Serializer<File, 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":"AACA,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;CACtB;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,cAS1D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,cAO1C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,cAAc,SAKnD,CAAC;AAEF,eAAO,MAAM,cAAc,kCASzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileList.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/fileList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,kBAAkB,wCAe7B,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;AAOxD,eAAO,MAAM,kBAAkB,sDAqC7B,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,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Serializer } from '../Serializer';
|
|
2
|
+
import { Policy, PolicyDeclaration } from '@mittwald/flow-react-components/mittwald-password-tools-js';
|
|
3
|
+
export declare const passwordPolicySerializer: Serializer<Policy, PolicyDeclaration>;
|
|
4
|
+
//# sourceMappingURL=passwordPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passwordPolicy.d.ts","sourceRoot":"","sources":["../../../../src/serialization/serializers/passwordPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EACL,MAAM,EACN,KAAK,iBAAiB,EACvB,MAAM,4DAA4D,CAAC;AAEpE,eAAO,MAAM,wBAAwB,uCAYnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../../src/shim.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tests/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,OAAO,IAAI,EAAE,KAAG,QAyB9C,CAAC"}
|
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.610",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core functionality to setup a remote/host environment",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -8,38 +8,56 @@
|
|
|
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": [
|
|
15
16
|
"dist"
|
|
16
17
|
],
|
|
17
18
|
"engines": {
|
|
18
|
-
"node": ">=20.
|
|
19
|
+
"node": ">=20.19"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"build": "vite build --config vite.build.config.ts",
|
|
22
23
|
"clean": "rimraf dist",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:
|
|
24
|
+
"test:compile": "tsc --noEmit",
|
|
25
|
+
"test:unit": "vitest run --passWithNoTests"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
28
|
+
"@internationalized/date": "^3.10.0",
|
|
29
|
+
"@lit-labs/ssr-dom-shim": "^1.4.0",
|
|
30
|
+
"@mittwald/remote-dom-core": "1.7.0-mittwald.10",
|
|
31
|
+
"@quilted/threads": "^3.3.1",
|
|
32
|
+
"@types/invariant": "^2.2.37",
|
|
33
|
+
"invariant": "^2.2.4",
|
|
34
|
+
"remeda": "^2.32.0"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"@mittwald/
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.610",
|
|
38
|
+
"@mittwald/flow-core": "",
|
|
39
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.610",
|
|
40
|
+
"@mittwald/typescript-config": "",
|
|
41
|
+
"@types/node": "^24.10.1",
|
|
42
|
+
"nx": "^22.1.0",
|
|
43
|
+
"prettier": "^3.6.2",
|
|
44
|
+
"rimraf": "^6.1.2",
|
|
37
45
|
"rollup-preserve-directives": "^1.1.3",
|
|
38
|
-
"typescript": "^5.
|
|
39
|
-
"vite": "^
|
|
40
|
-
"vite-plugin-checker": "^0.
|
|
41
|
-
"vite-plugin-dts": "^4.5.
|
|
42
|
-
"vite-plugin-externalize-deps": "^0.
|
|
46
|
+
"typescript": "^5.9.3",
|
|
47
|
+
"vite": "^7.2.7",
|
|
48
|
+
"vite-plugin-checker": "^0.11.0",
|
|
49
|
+
"vite-plugin-dts": "^4.5.4",
|
|
50
|
+
"vite-plugin-externalize-deps": "^0.10.0",
|
|
51
|
+
"vitest": "^4.0.15"
|
|
43
52
|
},
|
|
44
|
-
"
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.609",
|
|
55
|
+
"@mittwald/flow-react-components": "0.2.0-alpha.609"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@mittwald/ext-bridge": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"gitHead": "44dba174d15f7cfb181b10e47f1a2bde81f545ff"
|
|
45
63
|
}
|
package/dist/index.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { RemoteElement as j, RemoteEvent as k } from "@mfalkenberg/remote-dom-core/elements";
|
|
2
|
-
import { ThreadNestedIframe as a, ThreadIframe as m } from "@quilted/threads";
|
|
3
|
-
import * as n from "remeda";
|
|
4
|
-
import { isObjectType as d, isString as p, isNumber as u, isBoolean as l } from "remeda";
|
|
5
|
-
const b = (e) => new a({
|
|
6
|
-
exports: {
|
|
7
|
-
render: (t) => {
|
|
8
|
-
import("@mfalkenberg/remote-dom-core/elements").then(
|
|
9
|
-
({ RemoteMutationObserver: r }) => {
|
|
10
|
-
new r(t).observe(e);
|
|
11
|
-
}
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}), v = (e) => {
|
|
16
|
-
e === null || "__remoteConnectionEstablished" in e || (b(e), Object.assign(e, { __remoteConnectionEstablished: !0 }));
|
|
17
|
-
}, R = (e) => {
|
|
18
|
-
const t = new m(e.iframe);
|
|
19
|
-
return t.imports.render(e.connection), t;
|
|
20
|
-
}, y = (e) => (t) => {
|
|
21
|
-
t && ("__remoteConnectionEstablished" in t || (R({
|
|
22
|
-
iframe: t,
|
|
23
|
-
connection: e
|
|
24
|
-
}), Object.assign(t, { __remoteConnectionEstablished: !0 })));
|
|
25
|
-
}, s = (e) => p(e) || u(e) || l(e) || n.isArray(e) && e.every(s), i = (e) => n.isArray(e) ? e.map(i) : d(e) ? n.pickBy(e, s) : e, C = (...e) => (t) => n.pick(t, e), f = i, h = (e, t, r = {}) => (o) => {
|
|
26
|
-
const c = r[t] ?? f;
|
|
27
|
-
return e(c(o));
|
|
28
|
-
};
|
|
29
|
-
class w extends CustomEvent {
|
|
30
|
-
constructor(t, r) {
|
|
31
|
-
super(t, {
|
|
32
|
-
detail: r
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
w as FlowRemoteEvent,
|
|
38
|
-
j as RemoteElement,
|
|
39
|
-
k as RemoteEvent,
|
|
40
|
-
b as connectHostRenderRoot,
|
|
41
|
-
v as connectHostRenderRootRef,
|
|
42
|
-
R as connectRemoteIframe,
|
|
43
|
-
y as connectRemoteIframeRef,
|
|
44
|
-
h as mapEventHandler,
|
|
45
|
-
C as pick,
|
|
46
|
-
i as primitiveFlat,
|
|
47
|
-
f as standard
|
|
48
|
-
};
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUzD,eAAO,MAAM,aAAa,EAAE,kBAKf,CAAC;AAEd,eAAO,MAAM,IAAI,aACJ,MAAM,EAAE,KAAG,kBAGrB,CAAC;AAEJ,eAAO,MAAM,QAAQ,oBAAgB,CAAC"}
|