@mittwald/flow-remote-core 0.2.0-alpha.23 → 0.2.0-alpha.231
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/README.md +1 -1
- package/dist/js/connection/connectHostRenderRoot.mjs +55 -0
- package/dist/js/connection/connectHostRenderRoot.mjs.map +1 -0
- package/dist/js/connection/connectRemoteIframe.mjs +50 -0
- package/dist/js/connection/connectRemoteIframe.mjs.map +1 -0
- package/dist/js/connection/types.mjs +10 -0
- package/dist/js/connection/types.mjs.map +1 -0
- package/dist/js/error.mjs +10 -0
- package/dist/js/error.mjs.map +1 -0
- package/dist/js/events/FlowRemoteEvent.mjs +10 -0
- package/dist/js/events/FlowRemoteEvent.mjs.map +1 -0
- package/dist/js/events/index.mjs +13 -0
- package/dist/js/events/index.mjs.map +1 -0
- package/dist/js/events/serializers.mjs +25 -0
- package/dist/js/events/serializers.mjs.map +1 -0
- package/dist/js/ext-bridge/implementation.mjs +13 -0
- package/dist/js/ext-bridge/implementation.mjs.map +1 -0
- package/dist/js/index-node.mjs +10 -0
- package/dist/js/index-node.mjs.map +1 -0
- package/dist/js/index.mjs +9 -0
- package/dist/js/index.mjs.map +1 -0
- package/dist/js/shim.mjs +16 -0
- package/dist/js/shim.mjs.map +1 -0
- package/dist/js/utils/eventValueTransformer.mjs +21 -0
- package/dist/js/utils/eventValueTransformer.mjs.map +1 -0
- package/dist/js/utils/file.mjs +19 -0
- package/dist/js/utils/file.mjs.map +1 -0
- package/dist/js/utils/helper.mjs +20 -0
- package/dist/js/utils/helper.mjs.map +1 -0
- package/dist/js/utils/promise.mjs +28 -0
- package/dist/js/utils/promise.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 +28 -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/events/index.d.ts +1 -1
- package/dist/types/events/index.d.ts.map +1 -1
- package/dist/types/events/serializers.d.ts.map +1 -1
- 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 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/shim.d.ts +2 -0
- package/dist/types/shim.d.ts.map +1 -0
- package/dist/types/utils/eventValueTransformer.d.ts +2 -0
- package/dist/types/utils/eventValueTransformer.d.ts.map +1 -0
- package/dist/types/utils/file.d.ts +2 -0
- package/dist/types/utils/file.d.ts.map +1 -0
- package/dist/types/utils/helper.d.ts +2 -0
- package/dist/types/utils/helper.d.ts.map +1 -0
- package/dist/types/utils/promise.d.ts +6 -0
- package/dist/types/utils/promise.d.ts.map +1 -0
- package/dist/types/utils/promise.test.d.ts +2 -0
- package/dist/types/utils/promise.test.d.ts.map +1 -0
- package/package.json +31 -18
- 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/README.md
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Version } from './types.mjs';
|
|
2
|
+
import { RemoteError } from '../error.mjs';
|
|
3
|
+
import '@mittwald/remote-dom-core/elements';
|
|
4
|
+
import { ThreadNestedIframe } from '@quilted/threads';
|
|
5
|
+
|
|
6
|
+
const incompatibleParentFrameError = () => new RemoteError("Could not find any compatible parent frame");
|
|
7
|
+
const connectHostRenderRoot = async (options) => {
|
|
8
|
+
const { root, onPathnameChanged } = options;
|
|
9
|
+
const connection = new ThreadNestedIframe({
|
|
10
|
+
exports: {
|
|
11
|
+
render: (connection2) => import('@mittwald/remote-dom-core/elements').then(
|
|
12
|
+
({ RemoteMutationObserver }) => {
|
|
13
|
+
const observer = new RemoteMutationObserver(connection2);
|
|
14
|
+
observer.observe(root);
|
|
15
|
+
}
|
|
16
|
+
),
|
|
17
|
+
setPathname: async (pathname) => {
|
|
18
|
+
onPathnameChanged?.(pathname);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (connection.parent === window) {
|
|
23
|
+
throw incompatibleParentFrameError();
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
await connection.imports.setIsReady(Version.v3);
|
|
27
|
+
if (typeof mwExtBridge !== "undefined") {
|
|
28
|
+
mwExtBridge.connection = connection.imports;
|
|
29
|
+
await mwExtBridge.readiness.setIsReady();
|
|
30
|
+
}
|
|
31
|
+
return connection;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) {
|
|
34
|
+
throw incompatibleParentFrameError();
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const connectHostRenderRootRef = (opts) => (ref) => {
|
|
40
|
+
if (ref === null) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if ("__remoteConnection" in ref) {
|
|
44
|
+
return ref["__remoteConnection"];
|
|
45
|
+
}
|
|
46
|
+
const connection = connectHostRenderRoot({
|
|
47
|
+
root: ref,
|
|
48
|
+
...opts
|
|
49
|
+
});
|
|
50
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
51
|
+
return connection;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { connectHostRenderRoot, connectHostRenderRootRef };
|
|
55
|
+
//# 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 { 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 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":";;;;;AAeA,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,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,50 @@
|
|
|
1
|
+
import { emptyImplementation } from '../ext-bridge/implementation.mjs';
|
|
2
|
+
import { ThreadIframe } from '@quilted/threads';
|
|
3
|
+
|
|
4
|
+
const connectRemoteIframe = (opts) => {
|
|
5
|
+
const {
|
|
6
|
+
connection,
|
|
7
|
+
iframe,
|
|
8
|
+
onReady,
|
|
9
|
+
onError,
|
|
10
|
+
onNavigationStateChanged,
|
|
11
|
+
extBridgeImplementation = emptyImplementation
|
|
12
|
+
} = opts;
|
|
13
|
+
const result = {
|
|
14
|
+
thread: new ThreadIframe(iframe, {
|
|
15
|
+
exports: {
|
|
16
|
+
...extBridgeImplementation,
|
|
17
|
+
setIsReady: async (version = 1) => {
|
|
18
|
+
result.version = version;
|
|
19
|
+
onReady?.();
|
|
20
|
+
},
|
|
21
|
+
setError: async (error) => {
|
|
22
|
+
onError?.(error);
|
|
23
|
+
},
|
|
24
|
+
setNavigationState: async (state) => {
|
|
25
|
+
onNavigationStateChanged?.(state);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
version: 0
|
|
30
|
+
};
|
|
31
|
+
result.thread.imports.render(connection);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
const connectRemoteIframeRef = (opts) => (ref) => {
|
|
35
|
+
if (!ref) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if ("__remoteConnection" in ref) {
|
|
39
|
+
return ref["__remoteConnection"];
|
|
40
|
+
}
|
|
41
|
+
const connection = connectRemoteIframe({
|
|
42
|
+
iframe: ref,
|
|
43
|
+
...opts
|
|
44
|
+
});
|
|
45
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
46
|
+
return connection;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { connectRemoteIframe, connectRemoteIframeRef };
|
|
50
|
+
//# sourceMappingURL=connectRemoteIframe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectRemoteIframe.mjs","sources":["../../../src/connection/connectRemoteIframe.ts"],"sourcesContent":["import type {\n HostExports,\n HostToRemoteConnection,\n NavigationState,\n RemoteExports,\n} from \"@/connection/types\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\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?: () => 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 exports: {\n ...extBridgeImplementation,\n setIsReady: async (version = 1) => {\n result.version = version;\n onReady?.();\n },\n setError: async (error: string) => {\n onError?.(error);\n },\n setNavigationState: async (state) => {\n onNavigationStateChanged?.(state);\n },\n },\n }),\n version: 0,\n };\n\n result.thread.imports.render(connection);\n return result;\n};\n\nexport const connectRemoteIframeRef =\n (opts: Omit<Options, \"iframe\">) => (ref: HTMLIFrameElement | null) => {\n if (!ref) {\n return;\n }\n\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as HostToRemoteConnection;\n }\n\n const connection = connectRemoteIframe({\n iframe: ref,\n ...opts,\n });\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n };\n"],"names":[],"mappings":";;;AAoBa,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,OAAS,EAAA;AAAA,QACP,GAAG,uBAAA;AAAA,QACH,UAAA,EAAY,OAAO,OAAA,GAAU,CAAM,KAAA;AACjC,UAAA,MAAA,CAAO,OAAU,GAAA,OAAA;AACjB,UAAU,OAAA,IAAA;AAAA,SACZ;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;AAAA,GACX;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}\n\nexport enum Version {\n vUnknown = 0,\n v1 = 1,\n v2 = 2,\n v3 = 3,\n}\n"],"names":["Version"],"mappings":"AA8BY,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 @@
|
|
|
1
|
+
{"version":3,"file":"FlowRemoteEvent.mjs","sources":["../../../src/events/FlowRemoteEvent.ts"],"sourcesContent":["export class FlowRemoteEvent<T> extends CustomEvent<T> {\n public constructor(type: string, detail: T) {\n super(type, {\n detail,\n });\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,wBAA2B,WAAe,CAAA;AAAA,EAC9C,WAAA,CAAY,MAAc,MAAW,EAAA;AAC1C,IAAA,KAAA,CAAM,IAAM,EAAA;AAAA,MACV;AAAA,KACD,CAAA;AAAA;AAEL;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { standard } from './serializers.mjs';
|
|
2
|
+
import resolveNestedPromises from '../utils/promise.mjs';
|
|
3
|
+
import { eventValueTransformer } from '../utils/eventValueTransformer.mjs';
|
|
4
|
+
|
|
5
|
+
const mapEventHandler = (eventHandler, eventName, eventSerialization = {}) => (event) => {
|
|
6
|
+
const serialize = eventSerialization[eventName] ?? standard;
|
|
7
|
+
const data = eventValueTransformer(eventName, serialize(event));
|
|
8
|
+
resolveNestedPromises(data).then(eventHandler);
|
|
9
|
+
return null;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { mapEventHandler };
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/events/index.ts"],"sourcesContent":["import { standard } from \"@/events/serializers\";\nimport resolveNestedPromises from \"@/utils/promise\";\nimport { eventValueTransformer } from \"@/utils/eventValueTransformer\";\n\nexport type EventHandler = (event: unknown) => void;\nexport type EventSerialization = (event: unknown) => unknown;\nexport type EventSerializationMap = Record<string, EventSerialization>;\n\nexport const mapEventHandler =\n (\n eventHandler: EventHandler,\n eventName: string,\n eventSerialization: EventSerializationMap = {},\n ) =>\n (event: unknown) => {\n const serialize = eventSerialization[eventName] ?? standard;\n const data = eventValueTransformer(eventName, serialize(event));\n\n resolveNestedPromises(data).then(eventHandler);\n return null;\n };\n"],"names":[],"mappings":";;;;AAQa,MAAA,eAAA,GACX,CACE,YACA,EAAA,SAAA,EACA,qBAA4C,EAAC,KAE/C,CAAC,KAAmB,KAAA;AAClB,EAAM,MAAA,SAAA,GAAY,kBAAmB,CAAA,SAAS,CAAK,IAAA,QAAA;AACnD,EAAA,MAAM,IAAO,GAAA,qBAAA,CAAsB,SAAW,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA;AAE9D,EAAsB,qBAAA,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,YAAY,CAAA;AAC7C,EAAO,OAAA,IAAA;AACT;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
|
|
3
|
+
const isPrimitive = (something) => R.isString(something) || R.isNumber(something) || R.isBoolean(something);
|
|
4
|
+
const isFile = (something) => something instanceof File || something instanceof FileList;
|
|
5
|
+
const primitiveFlat = (event) => {
|
|
6
|
+
if (R.isArray(event)) {
|
|
7
|
+
return event.map(primitiveFlat);
|
|
8
|
+
} else if (R.isObjectType(event)) {
|
|
9
|
+
if (isFile(event)) {
|
|
10
|
+
return event;
|
|
11
|
+
}
|
|
12
|
+
return R.pickBy(
|
|
13
|
+
event,
|
|
14
|
+
(value) => isPrimitive(value) || isFile(value)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
return event;
|
|
18
|
+
};
|
|
19
|
+
const pick = (...props) => (event) => {
|
|
20
|
+
return R.pick(event, props);
|
|
21
|
+
};
|
|
22
|
+
const standard = primitiveFlat;
|
|
23
|
+
|
|
24
|
+
export { pick, primitiveFlat, standard };
|
|
25
|
+
//# sourceMappingURL=serializers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializers.mjs","sources":["../../../src/events/serializers.ts"],"sourcesContent":["import type { EventSerialization } from \"@/events/index\";\nimport * as R from \"remeda\";\n\nconst isPrimitive = (something: unknown) =>\n R.isString(something) || R.isNumber(something) || R.isBoolean(something);\n\nconst isFile = (something: unknown) =>\n something instanceof File || something instanceof FileList;\n\nexport const primitiveFlat: EventSerialization = (event) => {\n if (R.isArray(event)) {\n return event.map(primitiveFlat);\n } else if (R.isObjectType(event)) {\n if (isFile(event)) {\n return event;\n }\n\n return R.pickBy(\n event as never,\n (value) => isPrimitive(value) || isFile(value),\n );\n }\n return event;\n};\n\nexport const pick =\n (...props: string[]): EventSerialization =>\n (event) => {\n return R.pick(event as never, props);\n };\n\nexport const standard = primitiveFlat;\n"],"names":[],"mappings":";;AAGA,MAAM,WAAc,GAAA,CAAC,SACnB,KAAA,CAAA,CAAE,QAAS,CAAA,SAAS,CAAK,IAAA,CAAA,CAAE,QAAS,CAAA,SAAS,CAAK,IAAA,CAAA,CAAE,UAAU,SAAS,CAAA;AAEzE,MAAM,MAAS,GAAA,CAAC,SACd,KAAA,SAAA,YAAqB,QAAQ,SAAqB,YAAA,QAAA;AAEvC,MAAA,aAAA,GAAoC,CAAC,KAAU,KAAA;AAC1D,EAAI,IAAA,CAAA,CAAE,OAAQ,CAAA,KAAK,CAAG,EAAA;AACpB,IAAO,OAAA,KAAA,CAAM,IAAI,aAAa,CAAA;AAAA,GACrB,MAAA,IAAA,CAAA,CAAE,YAAa,CAAA,KAAK,CAAG,EAAA;AAChC,IAAI,IAAA,MAAA,CAAO,KAAK,CAAG,EAAA;AACjB,MAAO,OAAA,KAAA;AAAA;AAGT,IAAA,OAAO,CAAE,CAAA,MAAA;AAAA,MACP,KAAA;AAAA,MACA,CAAC,KAAU,KAAA,WAAA,CAAY,KAAK,CAAA,IAAK,OAAO,KAAK;AAAA,KAC/C;AAAA;AAEF,EAAO,OAAA,KAAA;AACT;AAEO,MAAM,IACX,GAAA,CAAA,GAAI,KACJ,KAAA,CAAC,KAAU,KAAA;AACT,EAAO,OAAA,CAAA,CAAE,IAAK,CAAA,KAAA,EAAgB,KAAK,CAAA;AACrC;AAEK,MAAM,QAAW,GAAA;;;;"}
|
|
@@ -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,10 @@
|
|
|
1
|
+
import './shim.mjs';
|
|
2
|
+
export { RemoteElement, RemoteEvent } from '@mittwald/remote-dom-core/elements';
|
|
3
|
+
export { connectHostRenderRoot, connectHostRenderRootRef } from './connection/connectHostRenderRoot.mjs';
|
|
4
|
+
export { connectRemoteIframe, connectRemoteIframeRef } from './connection/connectRemoteIframe.mjs';
|
|
5
|
+
export { Version } from './connection/types.mjs';
|
|
6
|
+
export { RemoteError } from './error.mjs';
|
|
7
|
+
export { mapEventHandler } from './events/index.mjs';
|
|
8
|
+
export { FlowRemoteEvent } from './events/FlowRemoteEvent.mjs';
|
|
9
|
+
export { pick, primitiveFlat, standard } from './events/serializers.mjs';
|
|
10
|
+
//# sourceMappingURL=index-node.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { RemoteElement, RemoteEvent } from '@mittwald/remote-dom-core/elements';
|
|
2
|
+
export { connectHostRenderRoot, connectHostRenderRootRef } from './connection/connectHostRenderRoot.mjs';
|
|
3
|
+
export { connectRemoteIframe, connectRemoteIframeRef } from './connection/connectRemoteIframe.mjs';
|
|
4
|
+
export { Version } from './connection/types.mjs';
|
|
5
|
+
export { RemoteError } from './error.mjs';
|
|
6
|
+
export { mapEventHandler } from './events/index.mjs';
|
|
7
|
+
export { FlowRemoteEvent } from './events/FlowRemoteEvent.mjs';
|
|
8
|
+
export { pick, primitiveFlat, standard } from './events/serializers.mjs';
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/dist/js/shim.mjs
ADDED
|
@@ -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,21 @@
|
|
|
1
|
+
import { resolveFileContents } from './file.mjs';
|
|
2
|
+
import { deepMapValues } from './helper.mjs';
|
|
3
|
+
|
|
4
|
+
const eventObjectResolvers = {
|
|
5
|
+
FileList: (event) => Promise.all([...event].map(eventObjectResolvers.File)),
|
|
6
|
+
File: resolveFileContents
|
|
7
|
+
};
|
|
8
|
+
const eventValueTransformer = (eventName, event) => {
|
|
9
|
+
const replaceMaybeObjectTypeWithPromise = (value) => {
|
|
10
|
+
const constructorName = value?.constructor.name;
|
|
11
|
+
const eventObjectResolverFunction = eventObjectResolvers[constructorName];
|
|
12
|
+
if (constructorName && eventObjectResolverFunction) {
|
|
13
|
+
return eventObjectResolverFunction(value);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
return deepMapValues(event, replaceMaybeObjectTypeWithPromise);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { eventValueTransformer };
|
|
21
|
+
//# sourceMappingURL=eventValueTransformer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventValueTransformer.mjs","sources":["../../../src/utils/eventValueTransformer.ts"],"sourcesContent":["import { resolveFileContents } from \"@/utils/file\";\nimport { deepMapValues } from \"@/utils/helper\";\n\nconst eventObjectResolvers = {\n FileList: (event: unknown) =>\n Promise.all([...(event as FileList)].map(eventObjectResolvers.File)),\n File: resolveFileContents,\n} as const;\n\ntype EventObjectResolverMap = typeof eventObjectResolvers;\n\nexport const eventValueTransformer = (eventName: string, event: unknown) => {\n const replaceMaybeObjectTypeWithPromise = (value: unknown) => {\n const constructorName = value?.constructor\n .name as keyof EventObjectResolverMap;\n\n const eventObjectResolverFunction = eventObjectResolvers[constructorName];\n if (constructorName && eventObjectResolverFunction) {\n return eventObjectResolverFunction(value);\n }\n\n return value;\n };\n\n return deepMapValues(event, replaceMaybeObjectTypeWithPromise);\n};\n"],"names":[],"mappings":";;;AAGA,MAAM,oBAAuB,GAAA;AAAA,EAC3B,QAAU,EAAA,CAAC,KACT,KAAA,OAAA,CAAQ,GAAI,CAAA,CAAC,GAAI,KAAkB,CAAE,CAAA,GAAA,CAAI,oBAAqB,CAAA,IAAI,CAAC,CAAA;AAAA,EACrE,IAAM,EAAA;AACR,CAAA;AAIa,MAAA,qBAAA,GAAwB,CAAC,SAAA,EAAmB,KAAmB,KAAA;AAC1E,EAAM,MAAA,iCAAA,GAAoC,CAAC,KAAmB,KAAA;AAC5D,IAAM,MAAA,eAAA,GAAkB,OAAO,WAC5B,CAAA,IAAA;AAEH,IAAM,MAAA,2BAAA,GAA8B,qBAAqB,eAAe,CAAA;AACxE,IAAA,IAAI,mBAAmB,2BAA6B,EAAA;AAClD,MAAA,OAAO,4BAA4B,KAAK,CAAA;AAAA;AAG1C,IAAO,OAAA,KAAA;AAAA,GACT;AAEA,EAAO,OAAA,aAAA,CAAc,OAAO,iCAAiC,CAAA;AAC/D;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TRANSFERABLE } from '@quilted/threads';
|
|
2
|
+
|
|
3
|
+
const resolveFileContents = async (file) => {
|
|
4
|
+
if (!(file instanceof File)) {
|
|
5
|
+
return file;
|
|
6
|
+
}
|
|
7
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
8
|
+
return {
|
|
9
|
+
name: file.name,
|
|
10
|
+
type: file.type,
|
|
11
|
+
lastModified: file.lastModified,
|
|
12
|
+
size: file.size,
|
|
13
|
+
content: arrayBuffer,
|
|
14
|
+
[TRANSFERABLE]: 1
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { resolveFileContents };
|
|
19
|
+
//# sourceMappingURL=file.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.mjs","sources":["../../../src/utils/file.ts"],"sourcesContent":["import { TRANSFERABLE } from \"@quilted/threads\";\n\nexport const resolveFileContents = async (file: unknown) => {\n if (!(file instanceof File)) {\n return file;\n }\n\n const arrayBuffer = await file.arrayBuffer();\n\n return {\n name: file.name,\n type: file.type,\n lastModified: file.lastModified,\n size: file.size,\n content: arrayBuffer,\n [TRANSFERABLE]: 1,\n };\n};\n"],"names":[],"mappings":";;AAEa,MAAA,mBAAA,GAAsB,OAAO,IAAkB,KAAA;AAC1D,EAAI,IAAA,EAAE,gBAAgB,IAAO,CAAA,EAAA;AAC3B,IAAO,OAAA,IAAA;AAAA;AAGT,EAAM,MAAA,WAAA,GAAc,MAAM,IAAA,CAAK,WAAY,EAAA;AAE3C,EAAO,OAAA;AAAA,IACL,MAAM,IAAK,CAAA,IAAA;AAAA,IACX,MAAM,IAAK,CAAA,IAAA;AAAA,IACX,cAAc,IAAK,CAAA,YAAA;AAAA,IACnB,MAAM,IAAK,CAAA,IAAA;AAAA,IACX,OAAS,EAAA,WAAA;AAAA,IACT,CAAC,YAAY,GAAG;AAAA,GAClB;AACF;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
|
|
3
|
+
function deepMapValues(input, fn = (v) => v) {
|
|
4
|
+
input = fn(input);
|
|
5
|
+
if (R.isPromise(input)) {
|
|
6
|
+
return input;
|
|
7
|
+
}
|
|
8
|
+
if (R.isArray(input)) {
|
|
9
|
+
return R.map((item) => deepMapValues(item, fn));
|
|
10
|
+
}
|
|
11
|
+
if (R.isObjectType(input)) {
|
|
12
|
+
return R.mapValues(input, (value) => {
|
|
13
|
+
return deepMapValues(value, fn);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return input;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { deepMapValues };
|
|
20
|
+
//# sourceMappingURL=helper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.mjs","sources":["../../../src/utils/helper.ts"],"sourcesContent":["import * as R from \"remeda\";\n\nexport function deepMapValues(\n input: unknown,\n fn: (value: unknown) => unknown = (v) => v,\n): unknown {\n input = fn(input);\n\n if (R.isPromise(input)) {\n return input;\n }\n\n if (R.isArray(input)) {\n return R.map((item) => deepMapValues(item, fn));\n }\n\n if (R.isObjectType(input)) {\n return R.mapValues(input, (value) => {\n return deepMapValues(value, fn);\n });\n }\n\n return input;\n}\n"],"names":[],"mappings":";;AAEO,SAAS,aACd,CAAA,KAAA,EACA,EAAkC,GAAA,CAAC,MAAM,CAChC,EAAA;AACT,EAAA,KAAA,GAAQ,GAAG,KAAK,CAAA;AAEhB,EAAI,IAAA,CAAA,CAAE,SAAU,CAAA,KAAK,CAAG,EAAA;AACtB,IAAO,OAAA,KAAA;AAAA;AAGT,EAAI,IAAA,CAAA,CAAE,OAAQ,CAAA,KAAK,CAAG,EAAA;AACpB,IAAA,OAAO,EAAE,GAAI,CAAA,CAAC,SAAS,aAAc,CAAA,IAAA,EAAM,EAAE,CAAC,CAAA;AAAA;AAGhD,EAAI,IAAA,CAAA,CAAE,YAAa,CAAA,KAAK,CAAG,EAAA;AACzB,IAAA,OAAO,CAAE,CAAA,SAAA,CAAU,KAAO,EAAA,CAAC,KAAU,KAAA;AACnC,MAAO,OAAA,aAAA,CAAc,OAAO,EAAE,CAAA;AAAA,KAC/B,CAAA;AAAA;AAGH,EAAO,OAAA,KAAA;AACT;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as R from 'remeda';
|
|
2
|
+
|
|
3
|
+
async function resolveNestedPromises(input) {
|
|
4
|
+
if (input instanceof Promise) {
|
|
5
|
+
return resolveNestedPromises(await input);
|
|
6
|
+
}
|
|
7
|
+
if (R.isArray(input)) {
|
|
8
|
+
return await Promise.all(
|
|
9
|
+
input.map((item) => resolveNestedPromises(item))
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
if (input && typeof input === "object" && R.isPlainObject(input)) {
|
|
13
|
+
const entries = Object.entries(input);
|
|
14
|
+
const resolvedEntries = await Promise.all(
|
|
15
|
+
entries.map(async ([key, value]) => [
|
|
16
|
+
key,
|
|
17
|
+
await resolveNestedPromises(value)
|
|
18
|
+
])
|
|
19
|
+
);
|
|
20
|
+
return Promise.resolve(
|
|
21
|
+
Object.fromEntries(resolvedEntries)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
return input;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { resolveNestedPromises as default };
|
|
28
|
+
//# sourceMappingURL=promise.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.mjs","sources":["../../../src/utils/promise.ts"],"sourcesContent":["import * as R from \"remeda\";\n\ntype AwaitedObject<T> =\n T extends Promise<infer U>\n ? AwaitedObject<U>\n : T extends (infer V)[]\n ? AwaitedObject<V>[]\n : T extends object\n ? { [K in keyof T]: AwaitedObject<T[K]> }\n : T;\n\nasync function resolveNestedPromises<T>(input: T): Promise<AwaitedObject<T>> {\n if (input instanceof Promise) {\n return resolveNestedPromises(await input);\n }\n\n if (R.isArray(input)) {\n return (await Promise.all(\n input.map((item) => resolveNestedPromises(item)),\n )) as AwaitedObject<T>;\n }\n\n if (input && typeof input === \"object\" && R.isPlainObject(input)) {\n const entries = Object.entries(input);\n const resolvedEntries = await Promise.all(\n entries.map(async ([key, value]) => [\n key,\n await resolveNestedPromises(value),\n ]),\n );\n\n return Promise.resolve(\n Object.fromEntries(resolvedEntries) as AwaitedObject<T>,\n );\n }\n\n return input as AwaitedObject<T>;\n}\n\nexport default resolveNestedPromises;\n"],"names":[],"mappings":";;AAWA,eAAe,sBAAyB,KAAqC,EAAA;AAC3E,EAAA,IAAI,iBAAiB,OAAS,EAAA;AAC5B,IAAO,OAAA,qBAAA,CAAsB,MAAM,KAAK,CAAA;AAAA;AAG1C,EAAI,IAAA,CAAA,CAAE,OAAQ,CAAA,KAAK,CAAG,EAAA;AACpB,IAAA,OAAQ,MAAM,OAAQ,CAAA,GAAA;AAAA,MACpB,MAAM,GAAI,CAAA,CAAC,IAAS,KAAA,qBAAA,CAAsB,IAAI,CAAC;AAAA,KACjD;AAAA;AAGF,EAAA,IAAI,SAAS,OAAO,KAAA,KAAU,YAAY,CAAE,CAAA,aAAA,CAAc,KAAK,CAAG,EAAA;AAChE,IAAM,MAAA,OAAA,GAAU,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAA;AACpC,IAAM,MAAA,eAAA,GAAkB,MAAM,OAAQ,CAAA,GAAA;AAAA,MACpC,QAAQ,GAAI,CAAA,OAAO,CAAC,GAAA,EAAK,KAAK,CAAM,KAAA;AAAA,QAClC,GAAA;AAAA,QACA,MAAM,sBAAsB,KAAK;AAAA,OAClC;AAAA,KACH;AAEA,IAAA,OAAO,OAAQ,CAAA,OAAA;AAAA,MACb,MAAA,CAAO,YAAY,eAAe;AAAA,KACpC;AAAA;AAGF,EAAO,OAAA,KAAA;AACT;;;;"}
|
|
@@ -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;AAK5B,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,CAwChC,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?: () => 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,KAAK,EAEV,sBAAsB,EACtB,eAAe,EAEhB,MAAM,oBAAoB,CAAC;AAE5B,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,MAAM,IAAI,CAAC;IACrB,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,sBA+BnD,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,28 @@
|
|
|
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
|
+
}
|
|
22
|
+
export declare enum Version {
|
|
23
|
+
vUnknown = 0,
|
|
24
|
+
v1 = 1,
|
|
25
|
+
v2 = 2,
|
|
26
|
+
v3 = 3
|
|
27
|
+
}
|
|
28
|
+
//# 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;CAClD;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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type EventHandler = (event: unknown) => void;
|
|
2
|
-
export declare const mapEventHandler: (eventHandler: EventHandler, eventName: string, eventSerialization?: EventSerializationMap) => (event: unknown) => void;
|
|
3
2
|
export type EventSerialization = (event: unknown) => unknown;
|
|
4
3
|
export type EventSerializationMap = Record<string, EventSerialization>;
|
|
4
|
+
export declare const mapEventHandler: (eventHandler: EventHandler, eventName: string, eventSerialization?: EventSerializationMap) => (event: unknown) => null;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAEvE,eAAO,MAAM,eAAe,GAExB,cAAc,YAAY,EAC1B,WAAW,MAAM,EACjB,qBAAoB,qBAA0B,MAE/C,OAAO,OAAO,SAMd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/events/serializers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/events/serializers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AASzD,eAAO,MAAM,aAAa,EAAE,kBAc3B,CAAC;AAEF,eAAO,MAAM,IAAI,GACd,GAAG,OAAO,MAAM,EAAE,KAAG,kBAGrB,CAAC;AAEJ,eAAO,MAAM,QAAQ,oBAAgB,CAAC"}
|
|
@@ -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,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './connection
|
|
1
|
+
export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@mittwald/remote-dom-core/elements';
|
|
2
|
+
export * from './connection';
|
|
3
|
+
export * from './error';
|
|
3
4
|
export * from './events';
|
|
4
5
|
export * from './events/FlowRemoteEvent';
|
|
5
6
|
export * from './events/serializers';
|
|
6
|
-
export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@remote-dom/core/elements';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
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;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,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":"eventValueTransformer.d.ts","sourceRoot":"","sources":["../../../src/utils/eventValueTransformer.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,OAAO,OAAO,YActE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/utils/file.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,GAAU,MAAM,OAAO,qBAetD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../src/utils/helper.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,EAAE,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAkB,GACzC,OAAO,CAkBT"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type AwaitedObject<T> = T extends Promise<infer U> ? AwaitedObject<U> : T extends (infer V)[] ? AwaitedObject<V>[] : T extends object ? {
|
|
2
|
+
[K in keyof T]: AwaitedObject<T[K]>;
|
|
3
|
+
} : T;
|
|
4
|
+
declare function resolveNestedPromises<T>(input: T): Promise<AwaitedObject<T>>;
|
|
5
|
+
export default resolveNestedPromises;
|
|
6
|
+
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../src/utils/promise.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,CAAC,CAAC,IAClB,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GACtB,aAAa,CAAC,CAAC,CAAC,GAChB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,aAAa,CAAC,CAAC,CAAC,EAAE,GAClB,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACvC,CAAC,CAAC;AAEZ,iBAAe,qBAAqB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CA0B3E;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.test.d.ts","sourceRoot":"","sources":["../../../src/utils/promise.test.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.231",
|
|
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": [
|
|
@@ -18,28 +19,40 @@
|
|
|
18
19
|
"node": ">=20.11"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
|
-
"build": "
|
|
22
|
+
"build": "vite build --config vite.build.config.ts",
|
|
22
23
|
"clean": "rimraf dist",
|
|
23
|
-
"test": "",
|
|
24
|
-
"test:compile": "
|
|
24
|
+
"test": "exit 0",
|
|
25
|
+
"test:compile": "tsc --noEmit",
|
|
26
|
+
"test:unit": "vitest run"
|
|
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.3",
|
|
31
|
+
"@quilted/threads": "^3.1.3",
|
|
32
|
+
"remeda": "^2.22.3"
|
|
30
33
|
},
|
|
31
34
|
"devDependencies": {
|
|
32
|
-
"@mittwald/
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
35
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.231",
|
|
36
|
+
"@mittwald/typescript-config": "",
|
|
37
|
+
"@types/node": "^22.15.23",
|
|
38
|
+
"nx": "^20.8.2",
|
|
39
|
+
"prettier": "^3.5.3",
|
|
36
40
|
"rimraf": "^6.0.1",
|
|
37
41
|
"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"
|
|
42
|
+
"typescript": "^5.8.3",
|
|
43
|
+
"vite": "^6.3.5",
|
|
44
|
+
"vite-plugin-checker": "^0.9.3",
|
|
45
|
+
"vite-plugin-dts": "^4.5.4",
|
|
46
|
+
"vite-plugin-externalize-deps": "^0.9.0",
|
|
47
|
+
"vitest": "^3.1.4"
|
|
43
48
|
},
|
|
44
|
-
"
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@mittwald/ext-bridge": "*"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"@mittwald/ext-bridge": {
|
|
54
|
+
"optional": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"gitHead": "33feffc6772b0bb6749f9a9ad11bf1e955b20bac"
|
|
45
58
|
}
|
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"}
|