@mittwald/flow-remote-core 0.2.0-alpha.153 → 0.2.0-alpha.154

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.
@@ -1,23 +1,35 @@
1
- import { delegateExtBridgeRemoteFunctions } from '../ext-bridge/delegateExtBridgeRemoteFunctions.mjs';
1
+ import { RemoteError } from '../error.mjs';
2
+ import '@mittwald/remote-dom-core/elements';
2
3
  import { ThreadNestedIframe } from '@quilted/threads';
3
4
 
4
- const connectHostRenderRoot = (div) => {
5
- const thread = new ThreadNestedIframe({
5
+ const incompatibleParentFrameError = () => new RemoteError("Could not find any compatible parent frame");
6
+ const connectHostRenderRoot = async (div) => {
7
+ const connection = new ThreadNestedIframe({
6
8
  exports: {
7
- render: (connection) => import('@mittwald/remote-dom-core/elements').then(
9
+ render: (connection2) => import('@mittwald/remote-dom-core/elements').then(
8
10
  ({ RemoteMutationObserver }) => {
9
- const observer = new RemoteMutationObserver(connection);
11
+ const observer = new RemoteMutationObserver(connection2);
10
12
  observer.observe(div);
11
13
  }
12
14
  )
13
15
  }
14
16
  });
15
- thread.imports.setIsReady();
16
- if (typeof mittwald.extBridge !== "undefined") {
17
- delegateExtBridgeRemoteFunctions(thread);
18
- mittwald.extBridge.setIsReady();
17
+ if (connection.parent === window) {
18
+ throw incompatibleParentFrameError();
19
+ }
20
+ try {
21
+ await connection.imports.setIsReady();
22
+ if (typeof mwExtBridge !== "undefined") {
23
+ mwExtBridge.connection = connection.imports;
24
+ await mwExtBridge.readiness.setIsReady();
25
+ }
26
+ return connection;
27
+ } catch (error) {
28
+ if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) {
29
+ throw incompatibleParentFrameError();
30
+ }
31
+ throw error;
19
32
  }
20
- return thread;
21
33
  };
22
34
  const connectHostRenderRootRef = (ref) => {
23
35
  if (ref === null) {
@@ -1 +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;;;;"}
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 { RemoteError } from \"@/error\";\nimport { type RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadNestedIframe } from \"@quilted/threads\";\n\nconst incompatibleParentFrameError = () =>\n new RemoteError(\"Could not find any compatible parent frame\");\n\nexport const connectHostRenderRoot = async (\n div: HTMLDivElement,\n): Promise<RemoteToHostConnection> => {\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(div);\n },\n ),\n },\n });\n\n if (connection.parent === window) {\n throw incompatibleParentFrameError();\n }\n\n try {\n await connection.imports.setIsReady();\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 = (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(ref);\n Object.assign(ref, { __remoteConnection: connection });\n return connection;\n};\n"],"names":["connection"],"mappings":";;;;AASA,MAAM,4BAA+B,GAAA,MACnC,IAAI,WAAA,CAAY,4CAA4C,CAAA;AAEjD,MAAA,qBAAA,GAAwB,OACnC,GACoC,KAAA;AACpC,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,GAAG,CAAA;AAAA;AACtB;AACF;AACJ,GACD,CAAA;AAED,EAAI,IAAA,UAAA,CAAW,WAAW,MAAQ,EAAA;AAChC,IAAA,MAAM,4BAA6B,EAAA;AAAA;AAGrC,EAAI,IAAA;AACF,IAAM,MAAA,UAAA,CAAW,QAAQ,UAAW,EAAA;AAEpC,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;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;;;;"}
@@ -1,5 +1,4 @@
1
1
  import { emptyImplementation } from '../ext-bridge/implementation.mjs';
2
- import '@mittwald/ext-bridge';
3
2
  import { ThreadIframe } from '@quilted/threads';
4
3
 
5
4
  const connectRemoteIframe = (opts) => {
@@ -1 +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;;;;"}
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 { ExtBridgeConnectionApi } from \"@mittwald/ext-bridge\";\nimport type { RemoteConnection } from \"@mittwald/remote-dom-core/elements\";\nimport { ThreadIframe } from \"@quilted/threads\";\n\ninterface Opts {\n connection: RemoteConnection;\n iframe: HTMLIFrameElement;\n onReady?: () => void;\n onError?: (error: string) => void;\n extBridgeImplementation?: ExtBridgeConnectionApi;\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;;;;"}
@@ -1 +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;;;;"}
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;;;;"}
package/dist/js/shim.mjs CHANGED
@@ -2,4 +2,15 @@ import { HTMLElement, customElements } from '@lit-labs/ssr-dom-shim';
2
2
 
3
3
  globalThis.HTMLElement = HTMLElement;
4
4
  globalThis.customElements = customElements;
5
+ globalThis.MutationObserver = class MutationObserver {
6
+ constructor() {
7
+ }
8
+ disconnect() {
9
+ }
10
+ observe() {
11
+ }
12
+ takeRecords() {
13
+ return [];
14
+ }
15
+ };
5
16
  //# sourceMappingURL=shim.mjs.map
@@ -1 +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"}
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"}
@@ -1,4 +1,4 @@
1
1
  import { RemoteToHostConnection } from './types';
2
- export declare const connectHostRenderRoot: (div: HTMLDivElement) => RemoteToHostConnection;
3
- export declare const connectHostRenderRootRef: (ref: HTMLDivElement | null) => RemoteToHostConnection | undefined;
2
+ export declare const connectHostRenderRoot: (div: HTMLDivElement) => Promise<RemoteToHostConnection>;
3
+ export declare const connectHostRenderRootRef: (ref: HTMLDivElement | null) => Promise<RemoteToHostConnection> | undefined;
4
4
  //# sourceMappingURL=connectHostRenderRoot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectHostRenderRoot.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostRenderRoot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAK5B,eAAO,MAAM,qBAAqB,GAChC,KAAK,cAAc,KAClB,sBAqBF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,KAAK,cAAc,GAAG,IAAI,uCAWlE,CAAC"}
1
+ {"version":3,"file":"connectHostRenderRoot.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostRenderRoot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAQ5B,eAAO,MAAM,qBAAqB,GAChC,KAAK,cAAc,KAClB,OAAO,CAAC,sBAAsB,CAmChC,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,KAAK,cAAc,GAAG,IAAI,gDAWlE,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { HostToRemoteConnection } from './types';
2
+ import { ExtBridgeConnectionApi } from '@mittwald/ext-bridge';
2
3
  import { RemoteConnection } from '@mittwald/remote-dom-core/elements';
3
- import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
4
4
  interface Opts {
5
5
  connection: RemoteConnection;
6
6
  iframe: HTMLIFrameElement;
7
7
  onReady?: () => void;
8
8
  onError?: (error: string) => void;
9
- extBridgeImplementation?: ExtBridgeRemoteApi;
9
+ extBridgeImplementation?: ExtBridgeConnectionApi;
10
10
  }
11
11
  export declare const connectRemoteIframe: (opts: Opts) => HostToRemoteConnection;
12
12
  export declare const connectRemoteIframeRef: (opts: Omit<Opts, "iframe">) => (ref: HTMLIFrameElement | null) => HostToRemoteConnection | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"connectRemoteIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectRemoteIframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG/D,UAAU,IAAI;IACZ,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,uBAAuB,CAAC,EAAE,kBAAkB,CAAC;CAC9C;AAED,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,KAAG,sBAuBhD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAChC,MAAM,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,iBAAiB,GAAG,IAAI,uCAe7D,CAAC"}
1
+ {"version":3,"file":"connectRemoteIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectRemoteIframe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,UAAU,IAAI;IACZ,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,uBAAuB,CAAC,EAAE,sBAAsB,CAAC;CAClD;AAED,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,KAAG,sBAuBhD,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAChC,MAAM,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,KAAK,iBAAiB,GAAG,IAAI,uCAe7D,CAAC"}
@@ -1,7 +1,7 @@
1
+ import { ExtBridgeConnectionApi } from '@mittwald/ext-bridge';
1
2
  import { RemoteConnection } from '@mittwald/remote-dom-core';
2
- import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
3
3
  import { ThreadIframe, ThreadNestedIframe } from '@quilted/threads';
4
- export interface HostExports extends ExtBridgeRemoteApi {
4
+ export interface HostExports extends ExtBridgeConnectionApi {
5
5
  setIsReady: () => Promise<void>;
6
6
  setError: (error: string) => Promise<void>;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/connection/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CACrD,WAAW,EACX,aAAa,CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC"}
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,WAAY,SAAQ,sBAAsB;IACzD,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CACrD,WAAW,EACX,aAAa,CACd,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
2
- export declare const emptyImplementation: ExtBridgeRemoteApi;
1
+ import { ExtBridgeConnectionApi } from '@mittwald/ext-bridge';
2
+ export declare const emptyImplementation: ExtBridgeConnectionApi;
3
3
  //# sourceMappingURL=implementation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../../src/ext-bridge/implementation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,eAAO,MAAM,mBAAmB,EAO3B,kBAAkB,CAAC"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-remote-core",
3
- "version": "0.2.0-alpha.153",
3
+ "version": "0.2.0-alpha.154",
4
4
  "type": "module",
5
5
  "description": "Core functionality to setup a remote/host environment",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -31,7 +31,7 @@
31
31
  "remeda": "^2.21.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@mittwald/ext-bridge": "0.2.0-alpha.153",
34
+ "@mittwald/ext-bridge": "0.2.0-alpha.154",
35
35
  "@mittwald/typescript-config": "",
36
36
  "@types/node": "^22.13.10",
37
37
  "nx": "^20.5.0",
@@ -52,5 +52,5 @@
52
52
  "optional": true
53
53
  }
54
54
  },
55
- "gitHead": "6249eaf1059736228b5754edd281b0cae9e979a1"
55
+ "gitHead": "4c8d57c08217b895e5ac1879f0d2480ef8f4af68"
56
56
  }
@@ -1,15 +0,0 @@
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
@@ -1 +0,0 @@
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;;;;"}
@@ -1,4 +0,0 @@
1
- import { ThreadNestedIframe } from '@quilted/threads';
2
- /** Delegation is required because `thread.imports` is Proxy object */
3
- export declare const delegateExtBridgeRemoteFunctions: (thread: ThreadNestedIframe<unknown, unknown>) => void;
4
- //# sourceMappingURL=delegateExtBridgeRemoteFunctions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"delegateExtBridgeRemoteFunctions.d.ts","sourceRoot":"","sources":["../../../src/ext-bridge/delegateExtBridgeRemoteFunctions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAO3D,sEAAsE;AACtE,eAAO,MAAM,gCAAgC,GAC3C,QAAQ,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,SAU7C,CAAC"}