@mittwald/flow-remote-core 0.2.0-alpha.1032 → 0.2.0-alpha.1034
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/js/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/js/index-node.mjs +21 -17
- package/dist/js/index-node.mjs.map +1 -1
- package/dist/js/index.mjs +24 -16
- package/dist/js/index.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs +33 -36
- package/dist/js/node_modules/.pnpm/@quilted_events@2.1.5/node_modules/@quilted/events/build/esm/abort/NestedAbortController.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/Thread.mjs +167 -225
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/Thread.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs +6 -9
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/constants.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/errors.mjs +9 -7
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/errors.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs +68 -67
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/functions/ThreadFunctionsAutomatic.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/nanoid.mjs +8 -8
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/nanoid.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs +130 -210
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/ThreadSerializationStructuredClone.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/shared.mjs +8 -6
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/serialization/shared.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs +152 -159
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadIframe.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs +76 -84
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs +117 -137
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadNestedWindow.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs +189 -208
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs +6 -4
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs.map +1 -1
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs +12 -13
- package/dist/js/node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs +51 -61
- package/dist/js/packages/remote-core/src/connection/connectHostRenderRoot.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs +73 -101
- package/dist/js/packages/remote-core/src/connection/connectRemoteIframe.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/connection/index.mjs +4 -0
- package/dist/js/packages/remote-core/src/connection/types.mjs +13 -11
- package/dist/js/packages/remote-core/src/connection/types.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/error.mjs +10 -8
- package/dist/js/packages/remote-core/src/error.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/events/remoteEvents.mjs +14 -16
- package/dist/js/packages/remote-core/src/events/remoteEvents.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs +10 -8
- package/dist/js/packages/remote-core/src/ext-bridge/getWithMergedHostConfig.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs +8 -12
- package/dist/js/packages/remote-core/src/ext-bridge/implementation.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs +49 -61
- package/dist/js/packages/remote-core/src/serialization/FlowThreadSerialization.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/Serializer.mjs +31 -31
- package/dist/js/packages/remote-core/src/serialization/Serializer.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/index.mjs +10 -0
- package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs +20 -21
- package/dist/js/packages/remote-core/src/serialization/serializers/dataTransferText.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs +13 -14
- package/dist/js/packages/remote-core/src/serialization/serializers/date.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs +27 -28
- package/dist/js/packages/remote-core/src/serialization/serializers/file.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs +18 -22
- package/dist/js/packages/remote-core/src/serialization/serializers/fileList.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs +27 -34
- package/dist/js/packages/remote-core/src/serialization/serializers/formData.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/index.mjs +23 -7
- package/dist/js/packages/remote-core/src/serialization/serializers/index.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs +13 -14
- package/dist/js/packages/remote-core/src/serialization/serializers/passwordPolicy.mjs.map +1 -1
- package/dist/js/packages/remote-core/src/shim.mjs +32 -15
- package/dist/js/packages/remote-core/src/shim.mjs.map +1 -1
- package/dist/types/index-node.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/shim.d.ts +13 -1
- package/dist/types/shim.d.ts.map +1 -1
- package/package.json +9 -11
|
@@ -1,211 +1,192 @@
|
|
|
1
|
-
import { Thread } from
|
|
2
|
-
import {
|
|
3
|
-
import { ThreadNestedWindow } from
|
|
4
|
-
|
|
1
|
+
import { Thread } from "../../Thread.mjs";
|
|
2
|
+
import { CHECK_MESSAGE } from "./shared.mjs";
|
|
3
|
+
import { ThreadNestedWindow } from "./ThreadNestedWindow.mjs";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class ThreadWindow extends Thread {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
6
|
+
* Creates a thread from a `Window` created by this environment.
|
|
7
|
+
*
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
12
|
+
*
|
|
13
|
+
* const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');
|
|
14
|
+
* const thread = new ThreadWindow(popup);
|
|
15
|
+
* await thread.imports.sendMessage('Hello world!');
|
|
16
|
+
*/
|
|
17
|
+
var ThreadWindow = class ThreadWindow extends Thread {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a thread from a `Window` created by this environment.
|
|
20
|
+
*
|
|
21
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
25
|
+
*
|
|
26
|
+
* const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');
|
|
27
|
+
* const thread = ThreadWindow.from(popup);
|
|
28
|
+
* await thread.imports.sendMessage('Hello world!');
|
|
29
|
+
*/
|
|
30
|
+
static from(window, options) {
|
|
31
|
+
return new ThreadWindow(window, options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Starts a thread wrapped around a `window` object, and returns the imports
|
|
35
|
+
* of the thread.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
40
|
+
*
|
|
41
|
+
* const {getMessage} = ThreadWindow.import(window);
|
|
42
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
43
|
+
*
|
|
44
|
+
* // In the nested window:
|
|
45
|
+
*
|
|
46
|
+
* import {ThreadNestedWindow} from '@quilted/threads';
|
|
47
|
+
*
|
|
48
|
+
* ThreadNestedWindow.export(window.opener, {
|
|
49
|
+
* async getMessage() {
|
|
50
|
+
* return 'Hello, world!';
|
|
51
|
+
* },
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
static import(window, options) {
|
|
56
|
+
return new ThreadWindow(window, options).imports;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Starts a thread wrapped around a `window` object, providing the second
|
|
60
|
+
* argument as the exports of the thread.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
65
|
+
*
|
|
66
|
+
* ThreadWindow.export(window, {
|
|
67
|
+
* async getMessage() {
|
|
68
|
+
* return 'Hello, world!';
|
|
69
|
+
* },
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // In the nested window:
|
|
73
|
+
*
|
|
74
|
+
* import {ThreadNestedWindow} from '@quilted/threads';
|
|
75
|
+
*
|
|
76
|
+
* const {getMessage} = ThreadNestedWindow.import(window.opener);
|
|
77
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
static export(window, exports, options) {
|
|
81
|
+
new ThreadWindow(window, {
|
|
82
|
+
...options,
|
|
83
|
+
exports
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Creates a thread from within a window created by a parent document (for example,
|
|
88
|
+
* an `iframe` or popup window).
|
|
89
|
+
*
|
|
90
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
94
|
+
*
|
|
95
|
+
* // Inside a document opened as a popup window
|
|
96
|
+
* const thread = ThreadWindow.opener();
|
|
97
|
+
* await thread.imports.sendMessage('Hello world!');
|
|
98
|
+
*/
|
|
99
|
+
static opener = (() => Object.assign((options) => ThreadNestedWindow.from(window.opener, options), {
|
|
100
|
+
/**
|
|
101
|
+
* Starts a thread wrapped around a nested `window` object, and returns the imports
|
|
102
|
+
* of the thread.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
107
|
+
*
|
|
108
|
+
* const {getMessage} = ThreadWindow.opener.import();
|
|
109
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
110
|
+
*
|
|
111
|
+
* // In the parent window:
|
|
112
|
+
*
|
|
113
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
114
|
+
*
|
|
115
|
+
* ThreadWindow.export(window, {
|
|
116
|
+
* async getMessage() {
|
|
117
|
+
* return 'Hello, world!';
|
|
118
|
+
* },
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
import: (options) => ThreadNestedWindow.import(window.opener, options),
|
|
123
|
+
/**
|
|
124
|
+
* Starts a thread wrapped around a nested `window` object, providing the second
|
|
125
|
+
* argument as the exports of the thread.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
130
|
+
*
|
|
131
|
+
* ThreadWindow.opener.export({
|
|
132
|
+
* async getMessage() {
|
|
133
|
+
* return 'Hello, world!';
|
|
134
|
+
* },
|
|
135
|
+
* });
|
|
136
|
+
*
|
|
137
|
+
* // In the parent window:
|
|
138
|
+
*
|
|
139
|
+
* import {ThreadWindow} from '@quilted/threads';
|
|
140
|
+
*
|
|
141
|
+
* const {getMessage} = ThreadWindow.import(window);
|
|
142
|
+
* const message = await getMessage(); // 'Hello, world!'
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export: (exports, options) => ThreadNestedWindow.export(window.opener, {
|
|
146
|
+
...options,
|
|
147
|
+
exports
|
|
148
|
+
})
|
|
149
|
+
}))();
|
|
150
|
+
constructor(window, { targetOrigin = "*", ...options } = {}) {
|
|
151
|
+
super(windowToThreadTarget(window, { targetOrigin }), options);
|
|
152
|
+
this.window = window;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
function windowToThreadTarget(window, { targetOrigin = "*" } = {}) {
|
|
156
|
+
let connected = false;
|
|
157
|
+
const sendMessage = function send(message, transfer) {
|
|
158
|
+
window.postMessage(message, targetOrigin, transfer);
|
|
159
|
+
};
|
|
160
|
+
const connectedPromise = new Promise((resolve) => {
|
|
161
|
+
const abort = new AbortController();
|
|
162
|
+
globalThis.window.addEventListener("message", (event) => {
|
|
163
|
+
if (event.source !== window) return;
|
|
164
|
+
if (event.data === "quilt.threads.pong") {
|
|
165
|
+
connected = true;
|
|
166
|
+
abort.abort();
|
|
167
|
+
resolve();
|
|
168
|
+
}
|
|
169
|
+
}, { signal: abort.signal });
|
|
170
|
+
abort.signal.addEventListener("abort", () => resolve(), { once: true });
|
|
171
|
+
sendMessage(CHECK_MESSAGE);
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
send(message, transfer) {
|
|
175
|
+
if (!connected) return connectedPromise.then(() => {
|
|
176
|
+
if (connected) return sendMessage(message, transfer);
|
|
177
|
+
});
|
|
178
|
+
return sendMessage(message, transfer);
|
|
179
|
+
},
|
|
180
|
+
listen(listen, { signal }) {
|
|
181
|
+
self.addEventListener("message", (event) => {
|
|
182
|
+
if (event.source !== window) return;
|
|
183
|
+
if (event.data === "quilt.threads.pong") return;
|
|
184
|
+
listen(event.data);
|
|
185
|
+
}, { signal });
|
|
186
|
+
}
|
|
187
|
+
};
|
|
162
188
|
}
|
|
163
|
-
|
|
164
|
-
targetOrigin = '*'
|
|
165
|
-
} = {}) {
|
|
166
|
-
let connected = false;
|
|
167
|
-
const sendMessage = function send(message, transfer) {
|
|
168
|
-
window.postMessage(message, targetOrigin, transfer);
|
|
169
|
-
};
|
|
170
|
-
const connectedPromise = new Promise(resolve => {
|
|
171
|
-
const abort = new AbortController();
|
|
172
|
-
globalThis.window.addEventListener('message', event => {
|
|
173
|
-
if (event.source !== window) return;
|
|
174
|
-
if (event.data === RESPONSE_MESSAGE) {
|
|
175
|
-
connected = true;
|
|
176
|
-
abort.abort();
|
|
177
|
-
resolve();
|
|
178
|
-
}
|
|
179
|
-
}, {
|
|
180
|
-
signal: abort.signal
|
|
181
|
-
});
|
|
182
|
-
abort.signal.addEventListener('abort', () => resolve(), {
|
|
183
|
-
once: true
|
|
184
|
-
});
|
|
185
|
-
sendMessage(CHECK_MESSAGE);
|
|
186
|
-
});
|
|
187
|
-
return {
|
|
188
|
-
send(message, transfer) {
|
|
189
|
-
if (!connected) {
|
|
190
|
-
return connectedPromise.then(() => {
|
|
191
|
-
if (connected) return sendMessage(message, transfer);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
return sendMessage(message, transfer);
|
|
195
|
-
},
|
|
196
|
-
listen(listen, {
|
|
197
|
-
signal
|
|
198
|
-
}) {
|
|
199
|
-
self.addEventListener('message', event => {
|
|
200
|
-
if (event.source !== window) return;
|
|
201
|
-
if (event.data === RESPONSE_MESSAGE) return;
|
|
202
|
-
listen(event.data);
|
|
203
|
-
}, {
|
|
204
|
-
signal
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
189
|
+
//#endregion
|
|
210
190
|
export { ThreadWindow, windowToThreadTarget };
|
|
211
|
-
|
|
191
|
+
|
|
192
|
+
//# sourceMappingURL=ThreadWindow.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadWindow.mjs","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { RESPONSE_MESSAGE, CHECK_MESSAGE } from './shared.mjs';\nimport { ThreadNestedWindow } from './ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = new ThreadWindow(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadWindow extends Thread {\n /**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = ThreadWindow.from(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadWindow(window, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadWindow.opener();\n * await thread.imports.sendMessage('Hello world!');\n */\n static opener = (() => Object.assign(options => ThreadNestedWindow.from(window.opener, options), {\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.opener.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedWindow.import(window.opener, options),\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.opener.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedWindow.export(window.opener, {\n ...options,\n exports\n })\n }))();\n constructor(window, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(window, {\n targetOrigin\n }), options);\n this.window = window;\n }\n}\nfunction windowToThreadTarget(window, {\n targetOrigin = '*'\n} = {}) {\n let connected = false;\n const sendMessage = function send(message, transfer) {\n window.postMessage(message, targetOrigin, transfer);\n };\n const connectedPromise = new Promise(resolve => {\n const abort = new AbortController();\n globalThis.window.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) {\n connected = true;\n abort.abort();\n resolve();\n }\n }, {\n signal: abort.signal\n });\n abort.signal.addEventListener('abort', () => resolve(), {\n once: true\n });\n sendMessage(CHECK_MESSAGE);\n });\n return {\n send(message, transfer) {\n if (!connected) {\n return connectedPromise.then(() => {\n if (connected) return sendMessage(message, transfer);\n });\n }\n return sendMessage(message, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadWindow, windowToThreadTarget };\n"],"
|
|
1
|
+
{"version":3,"file":"ThreadWindow.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/ThreadWindow.mjs"],"sourcesContent":["import { Thread } from '../../Thread.mjs';\nimport { RESPONSE_MESSAGE, CHECK_MESSAGE } from './shared.mjs';\nimport { ThreadNestedWindow } from './ThreadNestedWindow.mjs';\n\n/**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = new ThreadWindow(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\nclass ThreadWindow extends Thread {\n /**\n * Creates a thread from a `Window` created by this environment.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const popup = window.open('https://my-app.com/popup', 'MyAppPopup', 'popup');\n * const thread = ThreadWindow.from(popup);\n * await thread.imports.sendMessage('Hello world!');\n */\n static from(window, options) {\n return new ThreadWindow(window, options);\n }\n\n /**\n * Starts a thread wrapped around a `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * ThreadNestedWindow.export(window.opener, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n static import(window, options) {\n return new ThreadWindow(window, options).imports;\n }\n\n /**\n * Starts a thread wrapped around a `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the nested window:\n *\n * import {ThreadNestedWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadNestedWindow.import(window.opener);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n static export(window, exports, options) {\n new ThreadWindow(window, {\n ...options,\n exports\n });\n }\n\n /**\n * Creates a thread from within a window created by a parent document (for example,\n * an `iframe` or popup window).\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/opener\n *\n * @example\n * import {ThreadWindow} from '@quilted/threads';\n *\n * // Inside a document opened as a popup window\n * const thread = ThreadWindow.opener();\n * await thread.imports.sendMessage('Hello world!');\n */\n static opener = (() => Object.assign(options => ThreadNestedWindow.from(window.opener, options), {\n /**\n * Starts a thread wrapped around a nested `window` object, and returns the imports\n * of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.opener.import();\n * const message = await getMessage(); // 'Hello, world!'\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.export(window, {\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n * ```\n */\n import: options => ThreadNestedWindow.import(window.opener, options),\n /**\n * Starts a thread wrapped around a nested `window` object, providing the second\n * argument as the exports of the thread.\n *\n * @example\n * ```ts\n * import {ThreadWindow} from '@quilted/threads';\n *\n * ThreadWindow.opener.export({\n * async getMessage() {\n * return 'Hello, world!';\n * },\n * });\n *\n * // In the parent window:\n *\n * import {ThreadWindow} from '@quilted/threads';\n *\n * const {getMessage} = ThreadWindow.import(window);\n * const message = await getMessage(); // 'Hello, world!'\n * ```\n */\n export: (exports, options) => ThreadNestedWindow.export(window.opener, {\n ...options,\n exports\n })\n }))();\n constructor(window, {\n targetOrigin = '*',\n ...options\n } = {}) {\n super(windowToThreadTarget(window, {\n targetOrigin\n }), options);\n this.window = window;\n }\n}\nfunction windowToThreadTarget(window, {\n targetOrigin = '*'\n} = {}) {\n let connected = false;\n const sendMessage = function send(message, transfer) {\n window.postMessage(message, targetOrigin, transfer);\n };\n const connectedPromise = new Promise(resolve => {\n const abort = new AbortController();\n globalThis.window.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) {\n connected = true;\n abort.abort();\n resolve();\n }\n }, {\n signal: abort.signal\n });\n abort.signal.addEventListener('abort', () => resolve(), {\n once: true\n });\n sendMessage(CHECK_MESSAGE);\n });\n return {\n send(message, transfer) {\n if (!connected) {\n return connectedPromise.then(() => {\n if (connected) return sendMessage(message, transfer);\n });\n }\n return sendMessage(message, transfer);\n },\n listen(listen, {\n signal\n }) {\n self.addEventListener('message', event => {\n if (event.source !== window) return;\n if (event.data === RESPONSE_MESSAGE) return;\n listen(event.data);\n }, {\n signal\n });\n }\n };\n}\n\nexport { ThreadWindow, windowToThreadTarget };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AAgBA,IAAM,eAAN,MAAM,qBAAqB,OAAO;;;;;;;;;;;;;CAahC,OAAO,KAAK,QAAQ,SAAS;EAC3B,OAAO,IAAI,aAAa,QAAQ,OAAO;CACzC;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS;EAC7B,OAAO,IAAI,aAAa,QAAQ,OAAO,CAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;;;;;;;;CAwBA,OAAO,OAAO,QAAQ,SAAS,SAAS;EACtC,IAAI,aAAa,QAAQ;GACvB,GAAG;GACH;EACF,CAAC;CACH;;;;;;;;;;;;;;CAeA,OAAO,gBAAgB,OAAO,QAAO,YAAW,mBAAmB,KAAK,OAAO,QAAQ,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB/F,SAAQ,YAAW,mBAAmB,OAAO,OAAO,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBnE,SAAS,SAAS,YAAY,mBAAmB,OAAO,OAAO,QAAQ;GACrE,GAAG;GACH;EACF,CAAC;CACH,CAAC,EAAA,CAAG;CACJ,YAAY,QAAQ,EAClB,eAAe,KACf,GAAG,YACD,CAAC,GAAG;EACN,MAAM,qBAAqB,QAAQ,EACjC,aACF,CAAC,GAAG,OAAO;EACX,KAAK,SAAS;CAChB;AACF;AACA,SAAS,qBAAqB,QAAQ,EACpC,eAAe,QACb,CAAC,GAAG;CACN,IAAI,YAAY;CAChB,MAAM,cAAc,SAAS,KAAK,SAAS,UAAU;EACnD,OAAO,YAAY,SAAS,cAAc,QAAQ;CACpD;CACA,MAAM,mBAAmB,IAAI,SAAQ,YAAW;EAC9C,MAAM,QAAQ,IAAI,gBAAgB;EAClC,WAAW,OAAO,iBAAiB,YAAW,UAAS;GACrD,IAAI,MAAM,WAAW,QAAQ;GAC7B,IAAI,MAAM,SAAA,sBAA2B;IACnC,YAAY;IACZ,MAAM,MAAM;IACZ,QAAQ;GACV;EACF,GAAG,EACD,QAAQ,MAAM,OAChB,CAAC;EACD,MAAM,OAAO,iBAAiB,eAAe,QAAQ,GAAG,EACtD,MAAM,KACR,CAAC;EACD,YAAY,aAAa;CAC3B,CAAC;CACD,OAAO;EACL,KAAK,SAAS,UAAU;GACtB,IAAI,CAAC,WACH,OAAO,iBAAiB,WAAW;IACjC,IAAI,WAAW,OAAO,YAAY,SAAS,QAAQ;GACrD,CAAC;GAEH,OAAO,YAAY,SAAS,QAAQ;EACtC;EACA,OAAO,QAAQ,EACb,UACC;GACD,KAAK,iBAAiB,YAAW,UAAS;IACxC,IAAI,MAAM,WAAW,QAAQ;IAC7B,IAAI,MAAM,SAAA,sBAA2B;IACrC,OAAO,MAAM,IAAI;GACnB,GAAG,EACD,OACF,CAAC;EACH;CACF;AACF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region ../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs
|
|
2
|
+
var CHECK_MESSAGE = "quilt.threads.ping";
|
|
3
|
+
var RESPONSE_MESSAGE = "quilt.threads.pong";
|
|
4
|
+
//#endregion
|
|
4
5
|
export { CHECK_MESSAGE, RESPONSE_MESSAGE };
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=shared.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.mjs","sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs"],"sourcesContent":["const CHECK_MESSAGE = 'quilt.threads.ping';\nconst RESPONSE_MESSAGE = 'quilt.threads.pong';\n\nexport { CHECK_MESSAGE, RESPONSE_MESSAGE };\n"],"
|
|
1
|
+
{"version":3,"file":"shared.mjs","names":[],"sources":["../../../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/window/shared.mjs"],"sourcesContent":["const CHECK_MESSAGE = 'quilt.threads.ping';\nconst RESPONSE_MESSAGE = 'quilt.threads.pong';\n\nexport { CHECK_MESSAGE, RESPONSE_MESSAGE };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,gBAAgB;AACtB,IAAM,mBAAmB"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { TRANSFERABLE } from
|
|
2
|
-
|
|
1
|
+
import { TRANSFERABLE } from "./constants.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
* Marks the value as being transferable between threads. The memory for this object
|
|
5
|
+
* will be moved to the target thread once the object is sent.
|
|
6
|
+
*
|
|
7
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects
|
|
8
|
+
*/
|
|
9
9
|
function markAsTransferable(value) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
return value;
|
|
10
|
+
Object.assign(value, { [TRANSFERABLE]: true });
|
|
11
|
+
return value;
|
|
14
12
|
}
|
|
15
|
-
|
|
13
|
+
//#endregion
|
|
16
14
|
export { markAsTransferable };
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=transfer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.mjs","sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs"],"sourcesContent":["import { TRANSFERABLE } from './constants.mjs';\n\n/**\n * Marks the value as being transferable between threads. The memory for this object\n * will be moved to the target thread once the object is sent.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects\n */\nfunction markAsTransferable(value) {\n Object.assign(value, {\n [TRANSFERABLE]: true\n });\n return value;\n}\n\nexport { markAsTransferable };\n"],"
|
|
1
|
+
{"version":3,"file":"transfer.mjs","names":[],"sources":["../../../../../../../../../../../../node_modules/.pnpm/@quilted+threads@3.3.1_patch_hash=df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/transfer.mjs"],"sourcesContent":["import { TRANSFERABLE } from './constants.mjs';\n\n/**\n * Marks the value as being transferable between threads. The memory for this object\n * will be moved to the target thread once the object is sent.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects\n */\nfunction markAsTransferable(value) {\n Object.assign(value, {\n [TRANSFERABLE]: true\n });\n return value;\n}\n\nexport { markAsTransferable };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAQA,SAAS,mBAAmB,OAAO;CACjC,OAAO,OAAO,OAAO,GAClB,eAAe,KAClB,CAAC;CACD,OAAO;AACT"}
|
|
@@ -1,64 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return connection;
|
|
41
|
-
} catch (error) {
|
|
42
|
-
if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) {
|
|
43
|
-
throw incompatibleParentFrameError();
|
|
44
|
-
}
|
|
45
|
-
throw error;
|
|
46
|
-
}
|
|
1
|
+
import { ThreadNestedIframe } from "../../../../node_modules/.pnpm/@quilted_threads@3.3.1_patch_hash_df15ead5d86def314ee16ab6a48f9e4faa765b52aa161b10d2848_aa11bff1669c76d0bae25976909ea4eb/node_modules/@quilted/threads/build/esm/threads/ThreadNestedIframe.mjs";
|
|
2
|
+
import { FlowThreadSerialization } from "../serialization/FlowThreadSerialization.mjs";
|
|
3
|
+
import { Version } from "./types.mjs";
|
|
4
|
+
import { RemoteError } from "../error.mjs";
|
|
5
|
+
import "@mittwald/remote-dom-core/elements";
|
|
6
|
+
//#region src/connection/connectHostRenderRoot.ts
|
|
7
|
+
var incompatibleParentFrameError = () => new RemoteError("Could not find any compatible parent frame");
|
|
8
|
+
var connectRemoteReceiver = (root, receiverConnection) => import("@mittwald/remote-dom-core/elements").then(({ RemoteMutationObserver }) => {
|
|
9
|
+
new RemoteMutationObserver(receiverConnection).observe(root);
|
|
10
|
+
});
|
|
11
|
+
var connectHostRenderRoot = async (options) => {
|
|
12
|
+
const { root, onPathnameChanged, onHostError, packageVersion } = options;
|
|
13
|
+
const connection = new ThreadNestedIframe({
|
|
14
|
+
serialization: new FlowThreadSerialization(),
|
|
15
|
+
exports: {
|
|
16
|
+
render: (connection) => connectRemoteReceiver(root, connection),
|
|
17
|
+
setPathname: async (pathname) => {
|
|
18
|
+
onPathnameChanged?.(pathname);
|
|
19
|
+
},
|
|
20
|
+
setHostError: async (error) => {
|
|
21
|
+
onHostError?.(error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (connection.parent === window) throw incompatibleParentFrameError();
|
|
26
|
+
try {
|
|
27
|
+
await connection.imports.setIsReady({
|
|
28
|
+
version: Version.v5,
|
|
29
|
+
packageVersion
|
|
30
|
+
});
|
|
31
|
+
if (typeof mwExtBridge !== "undefined") {
|
|
32
|
+
mwExtBridge.connection = connection.imports;
|
|
33
|
+
await mwExtBridge.readiness.setIsReady();
|
|
34
|
+
}
|
|
35
|
+
return connection;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
if (error instanceof Error && /No '.*' method is exported from this thread/.test(error.message)) throw incompatibleParentFrameError();
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
47
40
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
...opts
|
|
58
|
-
});
|
|
59
|
-
Object.assign(ref, { __remoteConnection: connection });
|
|
60
|
-
return connection;
|
|
41
|
+
var connectHostRenderRootRef = (opts) => (ref) => {
|
|
42
|
+
if (ref === null) return;
|
|
43
|
+
if ("__remoteConnection" in ref) return ref["__remoteConnection"];
|
|
44
|
+
const connection = connectHostRenderRoot({
|
|
45
|
+
root: ref,
|
|
46
|
+
...opts
|
|
47
|
+
});
|
|
48
|
+
Object.assign(ref, { __remoteConnection: connection });
|
|
49
|
+
return connection;
|
|
61
50
|
};
|
|
62
|
-
|
|
51
|
+
//#endregion
|
|
63
52
|
export { connectHostRenderRoot, connectHostRenderRootRef, connectRemoteReceiver };
|
|
64
|
-
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=connectHostRenderRoot.mjs.map
|