@mittwald/flow-remote-core 0.2.0-alpha.12 → 0.2.0-alpha.121

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 CHANGED
@@ -1,4 +1,4 @@
1
- # @mittwald/flow-remote-elements
1
+ # @mittwald/flow-remote-core
2
2
 
3
3
  This package is part of
4
4
  [Flow – mittwald design system](https://mittwald.github.io/flow/). See the
package/dist/index.js CHANGED
@@ -1,44 +1,100 @@
1
- import { ThreadIframe as i, ThreadNestedIframe as c } from "@quilted/threads";
2
- import { RemoteMutationObserver as m } from "@remote-dom/core/elements";
3
- import * as n from "remeda";
4
- import { isObjectType as a, isString as d, isNumber as p, isBoolean as b } from "remeda";
5
- const f = (e) => {
6
- const t = new i(e.iframe);
7
- return t.imports.render(e.connection), t;
8
- }, h = (e) => (t) => {
9
- t && !("__remoteConnectionEstablished" in t) && (Object.assign(t, { __remoteConnectionEstablished: !0 }), f({
10
- iframe: t,
11
- connection: e
12
- }));
13
- }, l = (e) => {
14
- new c({
1
+ import { RemoteElement as h, RemoteEvent as A } from "@mfalkenberg/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({
15
17
  exports: {
16
- render: (t) => {
17
- new m(t).observe(e);
18
+ render: (n) => import("@mfalkenberg/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);
18
62
  }
19
63
  }
20
64
  });
21
- }, C = (e) => {
22
- e && !("__remoteConnectionEstablished" in e) && (Object.assign(e, { __remoteConnectionEstablished: !0 }), l(e));
23
- }, u = (e) => d(e) || p(e) || b(e), _ = (e) => a(e) ? n.pickBy(e, u) : e, w = (...e) => (t) => n.pick(t, e), v = _, O = (e, t, o = {}) => (r) => {
24
- const s = o[t] ?? v;
25
- return e(s(r));
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));
26
79
  };
27
- class j extends CustomEvent {
28
- constructor(t, o) {
80
+ class F extends CustomEvent {
81
+ constructor(t, n) {
29
82
  super(t, {
30
- detail: o
83
+ detail: n
31
84
  });
32
85
  }
33
86
  }
34
87
  export {
35
- j as FlowRemoteEvent,
36
- l as connectHostIframe,
37
- C as connectHostIframeRef,
38
- f as connectRemoteIframe,
39
- h as connectRemoteIframeRef,
40
- O as mapEventHandler,
41
- w as pick,
42
- _ as primitiveFlat,
43
- v as standard
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
44
100
  };
@@ -0,0 +1,4 @@
1
+ import { RemoteToHostConnection } from './types';
2
+ export declare const connectHostRenderRoot: (div: HTMLDivElement) => RemoteToHostConnection;
3
+ export declare const connectHostRenderRootRef: (ref: HTMLDivElement | null) => RemoteToHostConnection | undefined;
4
+ //# 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,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,13 +1,14 @@
1
- import { ThreadIframe } from '@quilted/threads';
2
- import { RemoteConnection } from '@remote-dom/core/elements';
1
+ import { HostToRemoteConnection } from './types';
2
+ import { RemoteConnection } from '@mfalkenberg/remote-dom-core/elements';
3
+ import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
3
4
  interface Opts {
4
5
  connection: RemoteConnection;
5
6
  iframe: HTMLIFrameElement;
7
+ onReady?: () => void;
8
+ onError?: (error: string) => void;
9
+ extBridgeImplementation?: ExtBridgeRemoteApi;
6
10
  }
7
- interface ThreadIframeTarget {
8
- render: (connection: RemoteConnection) => AsyncIterator<unknown>;
9
- }
10
- export declare const connectRemoteIframe: (opts: Opts) => ThreadIframe<ThreadIframeTarget, Record<string, never>>;
11
- export declare const connectRemoteIframeRef: (connection: RemoteConnection) => (ref: HTMLIFrameElement | null) => void;
11
+ export declare const connectRemoteIframe: (opts: Opts) => HostToRemoteConnection;
12
+ export declare const connectRemoteIframeRef: (opts: Omit<Opts, "iframe">) => (ref: HTMLIFrameElement | null) => HostToRemoteConnection | undefined;
12
13
  export {};
13
14
  //# 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,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,UAAU,IAAI;IACZ,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,aAAa,CAAC,OAAO,CAAC,CAAC;CAClE;AAED,eAAO,MAAM,mBAAmB,SAAU,IAAI,4DAI7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,eACpB,gBAAgB,WAAW,iBAAiB,GAAG,IAAI,SAQ/D,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,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,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"}
@@ -0,0 +1,4 @@
1
+ export * from './connectHostRenderRoot';
2
+ export * from './connectRemoteIframe';
3
+ export * from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -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,13 @@
1
+ import { RemoteConnection } from '@mfalkenberg/remote-dom-core';
2
+ import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
3
+ import { ThreadIframe, ThreadNestedIframe } from '@quilted/threads';
4
+ export interface HostExports extends ExtBridgeRemoteApi {
5
+ setIsReady: () => Promise<void>;
6
+ setError: (error: string) => Promise<void>;
7
+ }
8
+ export interface RemoteExports {
9
+ render: (connection: RemoteConnection) => Promise<void>;
10
+ }
11
+ export type RemoteToHostConnection = ThreadNestedIframe<HostExports, RemoteExports>;
12
+ export type HostToRemoteConnection = ThreadIframe<RemoteExports, HostExports>;
13
+ //# 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,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,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"}
@@ -0,0 +1,4 @@
1
+ export declare class RemoteError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ //# sourceMappingURL=error.d.ts.map
@@ -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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAEpD,eAAO,MAAM,eAAe,iBAEV,YAAY,aACf,MAAM,uBACG,qBAAqB,aAEnC,OAAO,SAGd,CAAC;AAEJ,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;AAEpD,eAAO,MAAM,eAAe,GAExB,cAAc,YAAY,EAC1B,WAAW,MAAM,EACjB,qBAAoB,qBAA0B,MAE/C,OAAO,OAAO,SAGd,CAAC;AAEJ,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;AAC7D,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/events/serializers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAKzD,eAAO,MAAM,aAAa,EAAE,kBACyC,CAAC;AAEtE,eAAO,MAAM,IAAI,aACJ,MAAM,EAAE,KAAG,kBAES,CAAC;AAElC,eAAO,MAAM,QAAQ,oBAAgB,CAAC"}
1
+ {"version":3,"file":"serializers.d.ts","sourceRoot":"","sources":["../../../src/events/serializers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUzD,eAAO,MAAM,aAAa,EAAE,kBAKf,CAAC;AAEd,eAAO,MAAM,IAAI,GACd,GAAG,OAAO,MAAM,EAAE,KAAG,kBAGrB,CAAC;AAEJ,eAAO,MAAM,QAAQ,oBAAgB,CAAC"}
@@ -0,0 +1,4 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,3 @@
1
+ import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
2
+ export declare const emptyImplementation: ExtBridgeRemoteApi;
3
+ //# sourceMappingURL=implementation.d.ts.map
@@ -0,0 +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,5 +1,6 @@
1
- export * from './connection/connectRemoteIframe';
2
- export * from './connection/connectHostIframe';
1
+ export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@mfalkenberg/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';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,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,uCAAuC,CAAC;AAC/C,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,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.12",
3
+ "version": "0.2.0-alpha.121",
4
4
  "type": "module",
5
5
  "description": "Core functionality to setup a remote/host environment",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -9,10 +9,6 @@
9
9
  ".": {
10
10
  "types": "./dist/types/index.d.ts",
11
11
  "default": "./dist/index.js"
12
- },
13
- "./polyfill": {
14
- "types": "./dist/types/polyfill.d.ts",
15
- "default": "./dist/polyfill.js"
16
12
  }
17
13
  },
18
14
  "files": [
@@ -22,30 +18,37 @@
22
18
  "node": ">=20.11"
23
19
  },
24
20
  "scripts": {
25
- "build": "run vite build --config vite.build.config.ts",
21
+ "build": "vite build --config vite.build.config.ts",
26
22
  "clean": "rimraf dist",
27
- "test": "",
28
- "test:compile": "run tsc --noEmit"
23
+ "test": "exit 0",
24
+ "test:compile": "tsc --noEmit"
29
25
  },
30
26
  "dependencies": {
31
- "@quilted/threads": "^3.1.2",
32
- "remeda": "^2.19.2"
27
+ "@mfalkenberg/remote-dom-core": "^1.7.5",
28
+ "@quilted/threads": "^3.1.3",
29
+ "remeda": "^2.21.1"
33
30
  },
34
31
  "devDependencies": {
35
- "@mittwald/typescript-config": "workspace:*",
36
- "@remote-dom/core": "^1.5.2",
37
- "@types/node": "^22.10.7",
38
- "nx": "^20.3.2",
39
- "prettier": "^3.4.2",
32
+ "@mittwald/ext-bridge": "0.2.0-alpha.121",
33
+ "@mittwald/typescript-config": "",
34
+ "@types/node": "^22.13.10",
35
+ "nx": "^20.5.0",
36
+ "prettier": "^3.5.3",
40
37
  "rimraf": "^6.0.1",
41
- "typescript": "^5.7.3",
42
- "vite": "^6.0.9",
43
- "vite-plugin-checker": "^0.8.0",
44
- "vite-plugin-dts": "^4.5.0",
38
+ "rollup-preserve-directives": "^1.1.3",
39
+ "typescript": "^5.8.2",
40
+ "vite": "^6.2.1",
41
+ "vite-plugin-checker": "^0.9.0",
42
+ "vite-plugin-dts": "^4.5.3",
45
43
  "vite-plugin-externalize-deps": "^0.9.0"
46
44
  },
47
45
  "peerDependencies": {
48
- "@remote-dom/core": "^1.5.2"
46
+ "@mittwald/ext-bridge": "*"
49
47
  },
50
- "gitHead": "6151bfc1fcf54d4b9f7884a07caaca87cf7ba805"
48
+ "peerDependenciesMeta": {
49
+ "@mittwald/ext-bridge": {
50
+ "optional": true
51
+ }
52
+ },
53
+ "gitHead": "b8a02e994915aabd71c40678b3ca8d27312ac7cd"
51
54
  }
package/dist/polyfill.js DELETED
@@ -1 +0,0 @@
1
- import "@remote-dom/core/polyfill";
@@ -1,3 +0,0 @@
1
- export declare const connectHostIframe: (iframe: HTMLIFrameElement) => void;
2
- export declare const connectHostIframeRef: (ref: HTMLIFrameElement | null) => void;
3
- //# sourceMappingURL=connectHostIframe.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connectHostIframe.d.ts","sourceRoot":"","sources":["../../../src/connection/connectHostIframe.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,WAAY,iBAAiB,SAS1D,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAS,iBAAiB,GAAG,IAAI,SAKjE,CAAC"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=polyfill.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../src/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}