@mittwald/flow-remote-core 0.2.0-alpha.101 → 0.2.0-alpha.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +88 -36
- package/dist/types/connection/connectHostRenderRoot.d.ts +3 -6
- package/dist/types/connection/connectHostRenderRoot.d.ts.map +1 -1
- package/dist/types/connection/connectRemoteIframe.d.ts +7 -7
- 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 +13 -0
- package/dist/types/connection/types.d.ts.map +1 -0
- package/dist/types/error.d.ts +4 -0
- package/dist/types/error.d.ts.map +1 -0
- package/dist/types/ext-bridge/delegateExtBridgeRemoteFunctions.d.ts +4 -0
- package/dist/types/ext-bridge/delegateExtBridgeRemoteFunctions.d.ts.map +1 -0
- package/dist/types/ext-bridge/implementation.d.ts +3 -0
- package/dist/types/ext-bridge/implementation.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +12 -3
package/dist/index.js
CHANGED
|
@@ -1,48 +1,100 @@
|
|
|
1
|
-
import { RemoteElement as
|
|
2
|
-
import { ThreadNestedIframe as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 E = Object.keys({
|
|
7
|
+
getSessionToken: !0,
|
|
8
|
+
getConfig: !0
|
|
9
|
+
}), x = (e) => {
|
|
10
|
+
const t = e.imports, n = E.map((o) => [o, (...c) => {
|
|
11
|
+
var s;
|
|
12
|
+
return (s = t[o]) == null ? void 0 : s.call(t, ...c);
|
|
13
|
+
}]);
|
|
14
|
+
Object.assign(mwExtBridge, Object.fromEntries(n));
|
|
15
|
+
}, _ = (e) => {
|
|
16
|
+
const t = new u({
|
|
17
|
+
exports: {
|
|
18
|
+
render: (n) => import("@mfalkenberg/remote-dom-core/elements").then(
|
|
19
|
+
({ RemoteMutationObserver: o }) => {
|
|
20
|
+
new o(n).observe(e);
|
|
11
21
|
}
|
|
12
|
-
)
|
|
22
|
+
)
|
|
13
23
|
}
|
|
24
|
+
});
|
|
25
|
+
return t.imports.setIsReady(), typeof mwExtBridge < "u" && (x(t), mwExtBridge.setIsReady()), t;
|
|
26
|
+
}, v = (e) => {
|
|
27
|
+
if (e === null)
|
|
28
|
+
return;
|
|
29
|
+
if ("__remoteConnection" in e)
|
|
30
|
+
return e.__remoteConnection;
|
|
31
|
+
const t = _(e);
|
|
32
|
+
return Object.assign(e, { __remoteConnection: t }), t;
|
|
33
|
+
};
|
|
34
|
+
class m extends Error {
|
|
35
|
+
constructor(t) {
|
|
36
|
+
super(t), this.message = t;
|
|
14
37
|
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
}
|
|
39
|
+
m.prototype.name = "RemoteError";
|
|
40
|
+
const w = new Proxy(
|
|
41
|
+
{},
|
|
42
|
+
{
|
|
43
|
+
get() {
|
|
44
|
+
throw new m("Missing implementation for MwExtBridge");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
), b = (e) => {
|
|
48
|
+
const {
|
|
49
|
+
connection: t,
|
|
50
|
+
iframe: n,
|
|
51
|
+
onReady: o,
|
|
52
|
+
onError: r,
|
|
53
|
+
extBridgeImplementation: c = w
|
|
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 = b({
|
|
22
72
|
iframe: t,
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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));
|
|
28
79
|
};
|
|
29
|
-
class
|
|
30
|
-
constructor(t,
|
|
80
|
+
class F extends CustomEvent {
|
|
81
|
+
constructor(t, n) {
|
|
31
82
|
super(t, {
|
|
32
|
-
detail:
|
|
83
|
+
detail: n
|
|
33
84
|
});
|
|
34
85
|
}
|
|
35
86
|
}
|
|
36
87
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
88
|
+
F as FlowRemoteEvent,
|
|
89
|
+
h as RemoteElement,
|
|
90
|
+
m as RemoteError,
|
|
91
|
+
A as RemoteEvent,
|
|
92
|
+
_ as connectHostRenderRoot,
|
|
41
93
|
v as connectHostRenderRootRef,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
94
|
+
b as connectRemoteIframe,
|
|
95
|
+
O as connectRemoteIframeRef,
|
|
96
|
+
T as mapEventHandler,
|
|
97
|
+
k as pick,
|
|
98
|
+
d as primitiveFlat,
|
|
99
|
+
I as standard
|
|
48
100
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
render: (connection: RemoteConnection) => void;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const connectHostRenderRootRef: (ref: HTMLDivElement | null) => void;
|
|
1
|
+
import { RemoteToHostConnection } from './types';
|
|
2
|
+
export declare const connectHostRenderRoot: (div: HTMLDivElement) => RemoteToHostConnection;
|
|
3
|
+
export declare const connectHostRenderRootRef: (ref: HTMLDivElement | null) => RemoteToHostConnection | undefined;
|
|
7
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,
|
|
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,14 +1,14 @@
|
|
|
1
|
+
import { HostToRemoteConnection } from './types';
|
|
1
2
|
import { RemoteConnection } from '@mfalkenberg/remote-dom-core/elements';
|
|
2
|
-
import {
|
|
3
|
-
export type HostData = Record<string, unknown>;
|
|
3
|
+
import { ExtBridgeRemoteApi } from '@mittwald/ext-bridge';
|
|
4
4
|
interface Opts {
|
|
5
5
|
connection: RemoteConnection;
|
|
6
6
|
iframe: HTMLIFrameElement;
|
|
7
|
+
onReady?: () => void;
|
|
8
|
+
onError?: (error: string) => void;
|
|
9
|
+
extBridgeImplementation?: ExtBridgeRemoteApi;
|
|
7
10
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export declare const connectRemoteIframe: (opts: Opts) => ThreadIframe<ThreadIframeTarget, Record<string, never>>;
|
|
12
|
-
export declare const connectRemoteIframeRef: (connection: RemoteConnection) => (ref: HTMLIFrameElement | null) => void;
|
|
11
|
+
export declare const connectRemoteIframe: (opts: Opts) => HostToRemoteConnection;
|
|
12
|
+
export declare const connectRemoteIframeRef: (opts: Omit<Opts, "iframe">) => (ref: HTMLIFrameElement | null) => HostToRemoteConnection | undefined;
|
|
13
13
|
export {};
|
|
14
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,KAAK,
|
|
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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,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 @@
|
|
|
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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { RemoteElement, RemoteEvent, type RemoteElementConstructor, } from '@mfalkenberg/remote-dom-core/elements';
|
|
2
|
-
export * from './connection
|
|
3
|
-
export * from './
|
|
2
|
+
export * from './connection';
|
|
3
|
+
export * from './error';
|
|
4
4
|
export * from './events';
|
|
5
5
|
export * from './events/FlowRemoteEvent';
|
|
6
6
|
export * from './events/serializers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,wBAAwB,GAC9B,MAAM,uCAAuC,CAAC;AAC/C,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.
|
|
3
|
+
"version": "0.2.0-alpha.103",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core functionality to setup a remote/host environment",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"remeda": "^2.21.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@mittwald/
|
|
32
|
+
"@mittwald/ext-bridge": "0.2.0-alpha.103",
|
|
33
|
+
"@mittwald/typescript-config": "",
|
|
33
34
|
"@types/node": "^22.13.10",
|
|
34
35
|
"nx": "^20.5.0",
|
|
35
36
|
"prettier": "^3.5.3",
|
|
@@ -41,5 +42,13 @@
|
|
|
41
42
|
"vite-plugin-dts": "^4.5.3",
|
|
42
43
|
"vite-plugin-externalize-deps": "^0.9.0"
|
|
43
44
|
},
|
|
44
|
-
"
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@mittwald/ext-bridge": "*"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@mittwald/ext-bridge": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"gitHead": "86cc253434473a6057cd9db5f2fd1a0062e34ff2"
|
|
45
54
|
}
|