@mittwald/flow-remote-core 0.2.0-alpha.145 → 0.2.0-alpha.147

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.
@@ -0,0 +1,35 @@
1
+ import { delegateExtBridgeRemoteFunctions } from '../ext-bridge/delegateExtBridgeRemoteFunctions.mjs';
2
+ import { ThreadNestedIframe } from '@quilted/threads';
3
+
4
+ const connectHostRenderRoot = (div) => {
5
+ const thread = new ThreadNestedIframe({
6
+ exports: {
7
+ render: (connection) => import('@mittwald/remote-dom-core/elements').then(
8
+ ({ RemoteMutationObserver }) => {
9
+ const observer = new RemoteMutationObserver(connection);
10
+ observer.observe(div);
11
+ }
12
+ )
13
+ }
14
+ });
15
+ thread.imports.setIsReady();
16
+ if (typeof mittwald.extBridge !== "undefined") {
17
+ delegateExtBridgeRemoteFunctions(thread);
18
+ mittwald.extBridge.setIsReady();
19
+ }
20
+ return thread;
21
+ };
22
+ const connectHostRenderRootRef = (ref) => {
23
+ if (ref === null) {
24
+ return;
25
+ }
26
+ if ("__remoteConnection" in ref) {
27
+ return ref["__remoteConnection"];
28
+ }
29
+ const connection = connectHostRenderRoot(ref);
30
+ Object.assign(ref, { __remoteConnection: connection });
31
+ return connection;
32
+ };
33
+
34
+ export { connectHostRenderRoot, connectHostRenderRootRef };
35
+ //# sourceMappingURL=connectHostRenderRoot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectHostRenderRoot.mjs","sources":["../../../src/connection/connectHostRenderRoot.ts"],"sourcesContent":["import type {\n HostExports,\n RemoteExports,\n RemoteToHostConnection,\n} from \"@/connection/types\";\nimport { delegateExtBridgeRemoteFunctions } from \"@/ext-bridge/delegateExtBridgeRemoteFunctions\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadNestedIframe } from \"@quilted/threads\";\n\nexport const connectHostRenderRoot = (\n div: HTMLDivElement,\n): RemoteToHostConnection => {\n const thread = 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(div);\n },\n ),\n },\n });\n\n thread.imports.setIsReady();\n\n if (typeof mittwald.extBridge !== \"undefined\") {\n delegateExtBridgeRemoteFunctions(thread);\n mittwald.extBridge.setIsReady();\n }\n\n return thread;\n};\n\nexport const connectHostRenderRootRef = (ref: HTMLDivElement | null) => {\n if (ref === null) {\n return;\n }\n if (\"__remoteConnection\" in ref) {\n return ref[\"__remoteConnection\"] as RemoteToHostConnection;\n }\n\n const connection = connectHostRenderRoot(ref);\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n};\n"],"names":[],"mappings":";;;AASa,MAAA,qBAAA,GAAwB,CACnC,GAC2B,KAAA;AAC3B,EAAM,MAAA,MAAA,GAAS,IAAI,kBAA+C,CAAA;AAAA,IAChE,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA,CAAC,UACP,KAAA,OAAO,oCAAoC,CAAE,CAAA,IAAA;AAAA,QAC3C,CAAC,EAAE,sBAAA,EAA6B,KAAA;AAC9B,UAAM,MAAA,QAAA,GAAW,IAAI,sBAAA,CAAuB,UAAU,CAAA;AACtD,UAAA,QAAA,CAAS,QAAQ,GAAG,CAAA;AAAA;AACtB;AACF;AACJ,GACD,CAAA;AAED,EAAA,MAAA,CAAO,QAAQ,UAAW,EAAA;AAE1B,EAAI,IAAA,OAAO,QAAS,CAAA,SAAA,KAAc,WAAa,EAAA;AAC7C,IAAA,gCAAA,CAAiC,MAAM,CAAA;AACvC,IAAA,QAAA,CAAS,UAAU,UAAW,EAAA;AAAA;AAGhC,EAAO,OAAA,MAAA;AACT;AAEa,MAAA,wBAAA,GAA2B,CAAC,GAA+B,KAAA;AACtE,EAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,IAAA;AAAA;AAEF,EAAA,IAAI,wBAAwB,GAAK,EAAA;AAC/B,IAAA,OAAO,IAAI,oBAAoB,CAAA;AAAA;AAGjC,EAAM,MAAA,UAAA,GAAa,sBAAsB,GAAG,CAAA;AAC5C,EAAA,MAAA,CAAO,MAAO,CAAA,GAAA,EAAK,EAAE,kBAAA,EAAoB,YAAY,CAAA;AACrD,EAAO,OAAA,UAAA;AACT;;;;"}
@@ -0,0 +1,43 @@
1
+ import { emptyImplementation } from '../ext-bridge/implementation.mjs';
2
+ import '@mittwald/ext-bridge';
3
+ import { ThreadIframe } from '@quilted/threads';
4
+
5
+ const connectRemoteIframe = (opts) => {
6
+ const {
7
+ connection,
8
+ iframe,
9
+ onReady,
10
+ onError,
11
+ extBridgeImplementation = emptyImplementation
12
+ } = opts;
13
+ const thread = new ThreadIframe(iframe, {
14
+ exports: {
15
+ ...extBridgeImplementation,
16
+ setIsReady: async () => {
17
+ onReady?.();
18
+ },
19
+ setError: async (error) => {
20
+ onError?.(error);
21
+ }
22
+ }
23
+ });
24
+ thread.imports.render(connection);
25
+ return thread;
26
+ };
27
+ const connectRemoteIframeRef = (opts) => (ref) => {
28
+ if (!ref) {
29
+ return;
30
+ }
31
+ if ("__remoteConnection" in ref) {
32
+ return ref["__remoteConnection"];
33
+ }
34
+ const connection = connectRemoteIframe({
35
+ iframe: ref,
36
+ ...opts
37
+ });
38
+ Object.assign(ref, { __remoteConnection: connection });
39
+ return connection;
40
+ };
41
+
42
+ export { connectRemoteIframe, connectRemoteIframeRef };
43
+ //# 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 RemoteExports,\n} from \"@/connection/types\";\nimport { emptyImplementation } from \"@/ext-bridge/implementation\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { type ExtBridgeRemoteApi } from \"@mittwald/ext-bridge\";\nimport { ThreadIframe } from \"@quilted/threads\";\n\ninterface Opts {\n connection: RemoteConnection;\n iframe: HTMLIFrameElement;\n onReady?: () => void;\n onError?: (error: string) => void;\n extBridgeImplementation?: ExtBridgeRemoteApi;\n}\n\nexport const connectRemoteIframe = (opts: Opts): HostToRemoteConnection => {\n const {\n connection,\n iframe,\n onReady,\n onError,\n extBridgeImplementation = emptyImplementation,\n } = opts;\n\n const thread = new ThreadIframe<RemoteExports, HostExports>(iframe, {\n exports: {\n ...extBridgeImplementation,\n setIsReady: async () => {\n onReady?.();\n },\n setError: async (error: string) => {\n onError?.(error);\n },\n },\n });\n\n thread.imports.render(connection);\n return thread;\n};\n\nexport const connectRemoteIframeRef =\n (opts: Omit<Opts, \"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":";;;;AAkBa,MAAA,mBAAA,GAAsB,CAAC,IAAuC,KAAA;AACzE,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,uBAA0B,GAAA;AAAA,GACxB,GAAA,IAAA;AAEJ,EAAM,MAAA,MAAA,GAAS,IAAI,YAAA,CAAyC,MAAQ,EAAA;AAAA,IAClE,OAAS,EAAA;AAAA,MACP,GAAG,uBAAA;AAAA,MACH,YAAY,YAAY;AACtB,QAAU,OAAA,IAAA;AAAA,OACZ;AAAA,MACA,QAAA,EAAU,OAAO,KAAkB,KAAA;AACjC,QAAA,OAAA,GAAU,KAAK,CAAA;AAAA;AACjB;AACF,GACD,CAAA;AAED,EAAO,MAAA,CAAA,OAAA,CAAQ,OAAO,UAAU,CAAA;AAChC,EAAO,OAAA,MAAA;AACT;AAEO,MAAM,sBACX,GAAA,CAAC,IAA+B,KAAA,CAAC,GAAkC,KAAA;AACjE,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
+ class RemoteError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.message = message;
5
+ }
6
+ }
7
+ RemoteError.prototype.name = "RemoteError";
8
+
9
+ export { RemoteError };
10
+ //# sourceMappingURL=error.mjs.map
@@ -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,10 @@
1
+ class FlowRemoteEvent extends CustomEvent {
2
+ constructor(type, detail) {
3
+ super(type, {
4
+ detail
5
+ });
6
+ }
7
+ }
8
+
9
+ export { FlowRemoteEvent };
10
+ //# sourceMappingURL=FlowRemoteEvent.mjs.map
@@ -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,9 @@
1
+ import { standard } from './serializers.mjs';
2
+
3
+ const mapEventHandler = (eventHandler, eventName, eventSerialization = {}) => (event) => {
4
+ const serialize = eventSerialization[eventName] ?? standard;
5
+ return eventHandler(serialize(event));
6
+ };
7
+
8
+ export { mapEventHandler };
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/events/index.ts"],"sourcesContent":["import { standard } from \"@/events/serializers\";\n\nexport type EventHandler = (event: unknown) => void;\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 return eventHandler(serialize(event));\n };\n\nexport type EventSerialization = (event: unknown) => unknown;\nexport type EventSerializationMap = Record<string, EventSerialization>;\n"],"names":[],"mappings":";;AAIa,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,EAAO,OAAA,YAAA,CAAa,SAAU,CAAA,KAAK,CAAC,CAAA;AACtC;;;;"}
@@ -0,0 +1,12 @@
1
+ import * as r from 'remeda';
2
+ import { isObjectType, isString, isNumber, isBoolean } from 'remeda';
3
+
4
+ const isPrimitive = (something) => isString(something) || isNumber(something) || isBoolean(something) || r.isArray(something) && something.every(isPrimitive);
5
+ const primitiveFlat = (event) => r.isArray(event) ? event.map(primitiveFlat) : isObjectType(event) ? r.pickBy(event, isPrimitive) : event;
6
+ const pick = (...props) => (event) => {
7
+ return r.pick(event, props);
8
+ };
9
+ const standard = primitiveFlat;
10
+
11
+ export { pick, primitiveFlat, standard };
12
+ //# 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\";\nimport { isBoolean, isNumber, isObjectType, isString } from \"remeda\";\n\nconst isPrimitive = (something: unknown) =>\n isString(something) ||\n isNumber(something) ||\n isBoolean(something) ||\n (r.isArray(something) && something.every(isPrimitive));\n\nexport const primitiveFlat: EventSerialization = (event) =>\n r.isArray(event)\n ? event.map(primitiveFlat)\n : isObjectType(event)\n ? r.pickBy(event as never, isPrimitive)\n : event;\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":";;;AAIA,MAAM,cAAc,CAAC,SAAA,KACnB,SAAS,SAAS,CAAA,IAClB,SAAS,SAAS,CAAA,IAClB,SAAU,CAAA,SAAS,KAClB,CAAE,CAAA,OAAA,CAAQ,SAAS,CAAK,IAAA,SAAA,CAAU,MAAM,WAAW,CAAA;AAE/C,MAAM,gBAAoC,CAAC,KAAA,KAChD,EAAE,OAAQ,CAAA,KAAK,IACX,KAAM,CAAA,GAAA,CAAI,aAAa,CAAA,GACvB,aAAa,KAAK,CAAA,GAChB,EAAE,MAAO,CAAA,KAAA,EAAgB,WAAW,CACpC,GAAA;AAED,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,15 @@
1
+ const fnNames = Object.keys({
2
+ getSessionToken: true,
3
+ getConfig: true
4
+ });
5
+ const delegateExtBridgeRemoteFunctions = (thread) => {
6
+ const hostExports = thread.imports;
7
+ const delegationEntries = fnNames.map((fn) => {
8
+ const delegation = (...args) => hostExports[fn]?.(...args);
9
+ return [fn, delegation];
10
+ });
11
+ Object.assign(mittwald.extBridge, Object.fromEntries(delegationEntries));
12
+ };
13
+
14
+ export { delegateExtBridgeRemoteFunctions };
15
+ //# sourceMappingURL=delegateExtBridgeRemoteFunctions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegateExtBridgeRemoteFunctions.mjs","sources":["../../../src/ext-bridge/delegateExtBridgeRemoteFunctions.ts"],"sourcesContent":["import type { ExtBridgeRemoteApi } from \"@mittwald/ext-bridge\";\nimport type { ThreadNestedIframe } from \"@quilted/threads\";\n\nconst fnNames = Object.keys({\n getSessionToken: true,\n getConfig: true,\n} satisfies Record<keyof ExtBridgeRemoteApi, true>);\n\n/** Delegation is required because `thread.imports` is Proxy object */\nexport const delegateExtBridgeRemoteFunctions = (\n thread: ThreadNestedIframe<unknown, unknown>,\n) => {\n const hostExports = thread.imports as Record<string, CallableFunction>;\n\n const delegationEntries = fnNames.map((fn) => {\n const delegation = (...args: unknown[]) => hostExports[fn]?.(...args);\n return [fn, delegation];\n });\n\n Object.assign(mittwald.extBridge, Object.fromEntries(delegationEntries));\n};\n"],"names":[],"mappings":"AAGA,MAAM,OAAA,GAAU,OAAO,IAAK,CAAA;AAAA,EAC1B,eAAiB,EAAA,IAAA;AAAA,EACjB,SAAW,EAAA;AACb,CAAkD,CAAA;AAGrC,MAAA,gCAAA,GAAmC,CAC9C,MACG,KAAA;AACH,EAAA,MAAM,cAAc,MAAO,CAAA,OAAA;AAE3B,EAAA,MAAM,iBAAoB,GAAA,OAAA,CAAQ,GAAI,CAAA,CAAC,EAAO,KAAA;AAC5C,IAAA,MAAM,aAAa,CAAI,GAAA,IAAA,KAAoB,YAAY,EAAE,CAAA,GAAI,GAAG,IAAI,CAAA;AACpE,IAAO,OAAA,CAAC,IAAI,UAAU,CAAA;AAAA,GACvB,CAAA;AAED,EAAA,MAAA,CAAO,OAAO,QAAS,CAAA,SAAA,EAAW,MAAO,CAAA,WAAA,CAAY,iBAAiB,CAAC,CAAA;AACzE;;;;"}
@@ -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 { ExtBridgeRemoteApi } 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 ExtBridgeRemoteApi;\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,9 @@
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 { 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-node.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-node.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,8 @@
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 { RemoteError } from './error.mjs';
5
+ export { mapEventHandler } from './events/index.mjs';
6
+ export { FlowRemoteEvent } from './events/FlowRemoteEvent.mjs';
7
+ export { pick, primitiveFlat, standard } from './events/serializers.mjs';
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,5 @@
1
+ import { HTMLElement, customElements } from '@lit-labs/ssr-dom-shim';
2
+
3
+ globalThis.HTMLElement = HTMLElement;
4
+ globalThis.customElements = customElements;
5
+ //# 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;\n"],"names":[],"mappings":";;AAEA,UAAA,CAAW,WAAc,GAAA,WAAA;AACzB,UAAA,CAAW,cAAiB,GAAA,cAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './index';
2
+ //# sourceMappingURL=index-node.d.ts.map
@@ -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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../../src/shim.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-remote-core",
3
- "version": "0.2.0-alpha.145",
3
+ "version": "0.2.0-alpha.147",
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
- "default": "./dist/index.js"
11
+ "node": "./dist/js/index-node.mjs",
12
+ "default": "./dist/js/index.mjs"
12
13
  }
13
14
  },
14
15
  "files": [
@@ -24,12 +25,13 @@
24
25
  "test:compile": "tsc --noEmit"
25
26
  },
26
27
  "dependencies": {
28
+ "@lit-labs/ssr-dom-shim": "^1.3.0",
27
29
  "@mittwald/remote-dom-core": "1.7.0-mittwald.3",
28
30
  "@quilted/threads": "^3.1.3",
29
31
  "remeda": "^2.21.1"
30
32
  },
31
33
  "devDependencies": {
32
- "@mittwald/ext-bridge": "0.2.0-alpha.145",
34
+ "@mittwald/ext-bridge": "0.2.0-alpha.147",
33
35
  "@mittwald/typescript-config": "",
34
36
  "@types/node": "^22.13.10",
35
37
  "nx": "^20.5.0",
@@ -50,5 +52,5 @@
50
52
  "optional": true
51
53
  }
52
54
  },
53
- "gitHead": "a2e708b21ea3e4087100fa653f79195f5ca2acd6"
55
+ "gitHead": "0e48e8f8b5dd7dfab8dda0c8ac768fecf7317fc4"
54
56
  }
package/dist/index.js DELETED
@@ -1,100 +0,0 @@
1
- import { RemoteElement as h, RemoteEvent as A } from "@mittwald/remote-dom-core/elements";
2
- import { ThreadNestedIframe as u, ThreadIframe as l } from "@quilted/threads";
3
- import "@mittwald/ext-bridge";
4
- import * as i from "remeda";
5
- import { isObjectType as R, isString as g, isNumber as f, isBoolean as y } from "remeda";
6
- const x = Object.keys({
7
- getSessionToken: !0,
8
- getConfig: !0
9
- }), _ = (e) => {
10
- const t = e.imports, n = x.map((o) => [o, (...c) => {
11
- var s;
12
- return (s = t[o]) == null ? void 0 : s.call(t, ...c);
13
- }]);
14
- Object.assign(mittwald.extBridge, Object.fromEntries(n));
15
- }, w = (e) => {
16
- const t = new u({
17
- exports: {
18
- render: (n) => import("@mittwald/remote-dom-core/elements").then(
19
- ({ RemoteMutationObserver: o }) => {
20
- new o(n).observe(e);
21
- }
22
- )
23
- }
24
- });
25
- return t.imports.setIsReady(), typeof mittwald.extBridge < "u" && (_(t), mittwald.extBridge.setIsReady()), t;
26
- }, v = (e) => {
27
- if (e === null)
28
- return;
29
- if ("__remoteConnection" in e)
30
- return e.__remoteConnection;
31
- const t = w(e);
32
- return Object.assign(e, { __remoteConnection: t }), t;
33
- };
34
- class m extends Error {
35
- constructor(t) {
36
- super(t), this.message = t;
37
- }
38
- }
39
- m.prototype.name = "RemoteError";
40
- const b = new Proxy(
41
- {},
42
- {
43
- get() {
44
- throw new m("Missing implementation for mittwald.extBridge");
45
- }
46
- }
47
- ), E = (e) => {
48
- const {
49
- connection: t,
50
- iframe: n,
51
- onReady: o,
52
- onError: r,
53
- extBridgeImplementation: c = b
54
- } = e, s = new l(n, {
55
- exports: {
56
- ...c,
57
- setIsReady: async () => {
58
- o == null || o();
59
- },
60
- setError: async (p) => {
61
- r == null || r(p);
62
- }
63
- }
64
- });
65
- return s.imports.render(t), s;
66
- }, O = (e) => (t) => {
67
- if (!t)
68
- return;
69
- if ("__remoteConnection" in t)
70
- return t.__remoteConnection;
71
- const n = E({
72
- iframe: t,
73
- ...e
74
- });
75
- return Object.assign(t, { __remoteConnection: n }), n;
76
- }, a = (e) => g(e) || f(e) || y(e) || i.isArray(e) && e.every(a), d = (e) => i.isArray(e) ? e.map(d) : R(e) ? i.pickBy(e, a) : e, k = (...e) => (t) => i.pick(t, e), I = d, T = (e, t, n = {}) => (o) => {
77
- const r = n[t] ?? I;
78
- return e(r(o));
79
- };
80
- class F extends CustomEvent {
81
- constructor(t, n) {
82
- super(t, {
83
- detail: n
84
- });
85
- }
86
- }
87
- export {
88
- F as FlowRemoteEvent,
89
- h as RemoteElement,
90
- m as RemoteError,
91
- A as RemoteEvent,
92
- w as connectHostRenderRoot,
93
- v as connectHostRenderRootRef,
94
- E as connectRemoteIframe,
95
- O as connectRemoteIframeRef,
96
- T as mapEventHandler,
97
- k as pick,
98
- d as primitiveFlat,
99
- I as standard
100
- };