@yschimke/remote-compose-player-cmp 1.65.0 → 1.67.0
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/rcPlayer.import-object.mjs +25 -23
- package/dist/rcPlayer.mjs +41 -38
- package/dist/rcPlayer.wasm +0 -0
- package/package.json +1 -1
|
@@ -8,12 +8,28 @@ const wasmTag = wasmJsTag ?? new WebAssembly.Tag({ parameters: ['externref'] });
|
|
|
8
8
|
|
|
9
9
|
// Placed here to give access to it from externals (js_code)
|
|
10
10
|
let wasmExports;
|
|
11
|
-
let require;
|
|
12
11
|
|
|
13
12
|
if (typeof process !== 'undefined' && process.release.name === 'node') {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
function doNotUseRequire() {
|
|
14
|
+
throw new Error("Do not use top-level require. Prefer to use JS import or define your own require instead. Read more: https://kotl.in/r9txlt")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var require = new Proxy((function() {}), {
|
|
18
|
+
apply(target, thisArg, argumentsList) {
|
|
19
|
+
if (globalThis.require != null) {
|
|
20
|
+
return globalThis.require.apply(thisArg, argumentsList);
|
|
21
|
+
} else {
|
|
22
|
+
doNotUseRequire();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
get(target, prop, receiver) {
|
|
26
|
+
if (globalThis.require != null) {
|
|
27
|
+
return Reflect.get(globalThis.require, prop);
|
|
28
|
+
} else {
|
|
29
|
+
doNotUseRequire();
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
17
33
|
}
|
|
18
34
|
|
|
19
35
|
export function setWasmExports(exports) {
|
|
@@ -96,10 +112,10 @@ const js_code = {
|
|
|
96
112
|
'kotlin.wasm.internal.kotlinUIntToJsNumberUnsafe' : (x) => x >>> 0,
|
|
97
113
|
'kotlin.wasm.internal.kotlinULongToJsBigIntUnsafe' : (x) => x & 0xFFFFFFFFFFFFFFFFn,
|
|
98
114
|
'kotlin.wasm.internal.getCachedJsObject_$external_fun' : (p0, p1) => getCachedJsObject(p0, p1),
|
|
115
|
+
'kotlin.wasm.internal.utoa32_$external_fun' : (p0) => String(p0),
|
|
116
|
+
'kotlin.wasm.internal.utoa64_$external_fun' : (p0) => String(p0),
|
|
99
117
|
'kotlin.wasm.internal.itoa32_$external_fun' : (p0) => String(p0),
|
|
100
118
|
'kotlin.wasm.internal.itoa64_$external_fun' : (p0) => String(p0),
|
|
101
|
-
'kotlin.wasm.internal.utoa64_$external_fun' : (p0) => String(p0),
|
|
102
|
-
'kotlin.wasm.internal.utoa32_$external_fun' : (p0) => String(p0),
|
|
103
119
|
'kotlin.io.printlnImpl' : (message) => console.log(message),
|
|
104
120
|
'kotlin.js.jsArrayGet' : (array, index) => array[index],
|
|
105
121
|
'kotlin.js.jsArraySet' : (array, index, value) => { array[index] = value },
|
|
@@ -115,8 +131,7 @@ const js_code = {
|
|
|
115
131
|
'kotlin.js.JsString_$external_class_instanceof' : (x) => typeof x === 'string',
|
|
116
132
|
'kotlin.js.JsString_$external_class_get' : () => JsString,
|
|
117
133
|
'kotlin.js.then_$external_fun' : (_this, p0) => _this.then(p0),
|
|
118
|
-
'kotlin.js.
|
|
119
|
-
'kotlin.js.__convertKotlinClosureToJsClosure_((Js)->Js?)' : (f) => getCachedJsObject(f, (p0) => wasmExports['__callFunction_((Js)->Js?)'](f, p0)),
|
|
134
|
+
'kotlin.js.__convertKotlinClosureToJsClosure_1' : (f, trampoline) => getCachedJsObject(f, (p0) => trampoline(f, p0)),
|
|
120
135
|
'kotlin.js.catch_$external_fun' : (_this, p0) => _this.catch(p0),
|
|
121
136
|
'kotlin.random.initialSeed' : () => ((Math.random() * Math.pow(2, 32)) | 0),
|
|
122
137
|
'kotlin.wasm.internal.getJsClassName' : (jsKlass) => jsKlass.name,
|
|
@@ -130,7 +145,7 @@ const js_code = {
|
|
|
130
145
|
'kotlinx.coroutines.tryGetProcess' : () => (typeof(process) !== 'undefined' && typeof(process.nextTick) === 'function') ? process : null,
|
|
131
146
|
'kotlinx.coroutines.tryGetWindow' : () => (typeof(window) !== 'undefined' && window != null && typeof(window.addEventListener) === 'function') ? window : null,
|
|
132
147
|
'kotlinx.coroutines.nextTick_$external_fun' : (_this, p0) => _this.nextTick(p0),
|
|
133
|
-
'kotlinx.coroutines.
|
|
148
|
+
'kotlinx.coroutines.__convertKotlinClosureToJsClosure_0' : (f, trampoline) => getCachedJsObject(f, () => trampoline(f, )),
|
|
134
149
|
'kotlinx.coroutines.createScheduleMessagePoster' : (process) => () => Promise.resolve(0).then(process),
|
|
135
150
|
'kotlinx.coroutines.__callJsClosure_(()->Unit)' : (f, ) => f(),
|
|
136
151
|
'kotlinx.coroutines.createRescheduleMessagePoster' : (window) => () => window.postMessage('dispatchCoroutine', '*'),
|
|
@@ -172,17 +187,12 @@ const js_code = {
|
|
|
172
187
|
'org.w3c.dom.css.setProperty_$external_fun' : (_this, p0, p1, p2, isDefault0) => _this.setProperty(p0, p1, isDefault0 ? undefined : p2, ),
|
|
173
188
|
'org.w3c.dom.css.style_$external_prop_getter' : (_this) => _this.style,
|
|
174
189
|
'org.w3c.dom.events.addEventListener_$external_fun' : (_this, p0, p1, p2) => _this.addEventListener(p0, p1, p2),
|
|
175
|
-
'org.w3c.dom.events.__convertKotlinClosureToJsClosure_((Js)->Unit)' : (f) => getCachedJsObject(f, (p0) => wasmExports['__callFunction_((Js)->Unit)'](f, p0)),
|
|
176
190
|
'org.w3c.dom.events.addEventListener_$external_fun_1' : (_this, p0, p1) => _this.addEventListener(p0, p1),
|
|
177
191
|
'org.w3c.dom.events.type_$external_prop_getter' : (_this) => _this.type,
|
|
178
192
|
'org.w3c.dom.events.target_$external_prop_getter' : (_this) => _this.target,
|
|
179
193
|
'org.w3c.dom.events.cancelable_$external_prop_getter' : (_this) => _this.cancelable,
|
|
180
194
|
'org.w3c.dom.events.timeStamp_$external_prop_getter' : (_this) => _this.timeStamp,
|
|
181
195
|
'org.w3c.dom.events.preventDefault_$external_fun' : (_this, ) => _this.preventDefault(),
|
|
182
|
-
'org.w3c.dom.events.Event_$external_class_instanceof' : (x) => x instanceof Event,
|
|
183
|
-
'org.w3c.dom.events.Event_$external_class_get' : () => Event,
|
|
184
|
-
'org.w3c.dom.events.FocusEvent_$external_class_instanceof' : (x) => x instanceof FocusEvent,
|
|
185
|
-
'org.w3c.dom.events.FocusEvent_$external_class_get' : () => FocusEvent,
|
|
186
196
|
'org.w3c.dom.events.clientX_$external_prop_getter' : (_this) => _this.clientX,
|
|
187
197
|
'org.w3c.dom.events.clientY_$external_prop_getter' : (_this) => _this.clientY,
|
|
188
198
|
'org.w3c.dom.events.ctrlKey_$external_prop_getter' : (_this) => _this.ctrlKey,
|
|
@@ -199,18 +209,13 @@ const js_code = {
|
|
|
199
209
|
'org.w3c.dom.events.shiftKey_$external_prop_getter_1' : (_this) => _this.shiftKey,
|
|
200
210
|
'org.w3c.dom.events.altKey_$external_prop_getter_1' : (_this) => _this.altKey,
|
|
201
211
|
'org.w3c.dom.events.metaKey_$external_prop_getter_1' : (_this) => _this.metaKey,
|
|
202
|
-
'org.w3c.dom.events.KeyboardEvent_$external_class_instanceof' : (x) => x instanceof KeyboardEvent,
|
|
203
|
-
'org.w3c.dom.events.KeyboardEvent_$external_class_get' : () => KeyboardEvent,
|
|
204
212
|
'org.w3c.dom.events.deltaX_$external_prop_getter' : (_this) => _this.deltaX,
|
|
205
213
|
'org.w3c.dom.events.deltaY_$external_prop_getter' : (_this) => _this.deltaY,
|
|
206
|
-
'org.w3c.dom.events.WheelEvent_$external_class_instanceof' : (x) => x instanceof WheelEvent,
|
|
207
|
-
'org.w3c.dom.events.WheelEvent_$external_class_get' : () => WheelEvent,
|
|
208
214
|
'org.w3c.dom.ShadowRootInit' : (mode) => ({ mode: mode }),
|
|
209
215
|
'org.w3c.dom.AddEventListenerOptions_js_code' : (passive, once, capture) => ({ passive: passive, once: once, capture: capture }),
|
|
210
216
|
'org.w3c.dom.navigator_$external_prop_getter' : (_this) => _this.navigator,
|
|
211
217
|
'org.w3c.dom.devicePixelRatio_$external_prop_getter' : (_this) => _this.devicePixelRatio,
|
|
212
218
|
'org.w3c.dom.requestAnimationFrame_$external_fun' : (_this, p0) => _this.requestAnimationFrame(p0),
|
|
213
|
-
'org.w3c.dom.__convertKotlinClosureToJsClosure_((Double)->Unit)' : (f) => getCachedJsObject(f, (p0) => wasmExports['__callFunction_((Double)->Unit)'](f, p0)),
|
|
214
219
|
'org.w3c.dom.matchMedia_$external_fun' : (_this, p0) => _this.matchMedia(p0),
|
|
215
220
|
'org.w3c.dom.dropEffect_$external_prop_setter' : (_this, v) => _this.dropEffect = v,
|
|
216
221
|
'org.w3c.dom.setDragImage_$external_fun' : (_this, p0, p1, p2) => _this.setDragImage(p0, p1, p2),
|
|
@@ -263,15 +268,11 @@ const js_code = {
|
|
|
263
268
|
'org.w3c.dom.HTMLCanvasElement_$external_class_get' : () => HTMLCanvasElement,
|
|
264
269
|
'org.w3c.dom.HTMLTextAreaElement_$external_class_instanceof' : (x) => x instanceof HTMLTextAreaElement,
|
|
265
270
|
'org.w3c.dom.HTMLTextAreaElement_$external_class_get' : () => HTMLTextAreaElement,
|
|
266
|
-
'org.w3c.dom.TouchEvent_$external_class_instanceof' : (x) => x instanceof TouchEvent,
|
|
267
|
-
'org.w3c.dom.TouchEvent_$external_class_get' : () => TouchEvent,
|
|
268
271
|
'org.w3c.dom.matches_$external_prop_getter_1' : (_this) => _this.matches,
|
|
269
272
|
'org.w3c.dom.MediaQueryListEvent_$external_class_instanceof' : (x) => x instanceof MediaQueryListEvent,
|
|
270
273
|
'org.w3c.dom.MediaQueryListEvent_$external_class_get' : () => MediaQueryListEvent,
|
|
271
274
|
'org.w3c.dom.pointerevents.pointerId_$external_prop_getter' : (_this) => _this.pointerId,
|
|
272
275
|
'org.w3c.dom.pointerevents.pressure_$external_prop_getter' : (_this) => _this.pressure,
|
|
273
|
-
'org.w3c.dom.pointerevents.PointerEvent_$external_class_instanceof' : (x) => x instanceof PointerEvent,
|
|
274
|
-
'org.w3c.dom.pointerevents.PointerEvent_$external_class_get' : () => PointerEvent,
|
|
275
276
|
'org.w3c.performance.now_$external_fun' : (_this, ) => _this.now(),
|
|
276
277
|
'org.w3c.performance.performance_$external_prop_getter' : (_this) => _this.performance,
|
|
277
278
|
'kotlinx.browser.window_$external_prop_getter' : () => window,
|
|
@@ -505,6 +506,7 @@ export { wasmTag as __TAG };
|
|
|
505
506
|
export const importObject = {
|
|
506
507
|
js_code,
|
|
507
508
|
intrinsics: {
|
|
509
|
+
memory: new WebAssembly.Memory({ initial: 0 }),
|
|
508
510
|
tag: wasmTag
|
|
509
511
|
},
|
|
510
512
|
"'": StringConstantsProxy,
|
package/dist/rcPlayer.mjs
CHANGED
|
@@ -4,52 +4,32 @@ import { importObject, setWasmExports } from './rcPlayer.import-object.mjs'
|
|
|
4
4
|
|
|
5
5
|
let wasmInstance;
|
|
6
6
|
|
|
7
|
-
const isNodeJs = (typeof process !== 'undefined') && (process.release.name === 'node');
|
|
8
|
-
const isDeno = !isNodeJs && (typeof Deno !== 'undefined')
|
|
9
|
-
const isStandaloneJsVM =
|
|
10
|
-
!isDeno && !isNodeJs && (
|
|
11
|
-
typeof d8 !== 'undefined' // V8
|
|
12
|
-
|| typeof inIon !== 'undefined' // SpiderMonkey
|
|
13
|
-
|| typeof jscOptions !== 'undefined' // JavaScriptCore
|
|
14
|
-
);
|
|
15
|
-
const isBrowser = !isNodeJs && !isDeno && !isStandaloneJsVM && (typeof window !== 'undefined' || typeof self !== 'undefined');
|
|
16
|
-
|
|
17
|
-
if (!isNodeJs && !isDeno && !isStandaloneJsVM && !isBrowser) {
|
|
18
|
-
throw "Supported JS engine not detected";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const wasmFilePath = './rcPlayer.wasm';
|
|
22
7
|
const wasmOptions = { builtins: ['js-string'], importedStringConstants: "'" }
|
|
23
8
|
|
|
24
9
|
try {
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const fs = require('fs');
|
|
30
|
-
const url = require('url');
|
|
31
|
-
const filepath = import.meta.resolve(wasmFilePath);
|
|
10
|
+
if ((typeof process !== 'undefined') && (process.release.name === 'node')) {
|
|
11
|
+
const fs = await import(/* webpackIgnore: true */'node:fs');
|
|
12
|
+
const url = await import(/* webpackIgnore: true */'node:url');
|
|
13
|
+
const filepath = import.meta.resolve('./rcPlayer.wasm');
|
|
32
14
|
const wasmBuffer = fs.readFileSync(url.fileURLToPath(filepath));
|
|
33
15
|
const wasmModule = new WebAssembly.Module(wasmBuffer, wasmOptions);
|
|
34
16
|
wasmInstance = new WebAssembly.Instance(wasmModule, importObject);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (isDeno) {
|
|
17
|
+
} else if (typeof Deno !== 'undefined') {
|
|
38
18
|
const path = await import(/* webpackIgnore: true */'https://deno.land/std/path/mod.ts');
|
|
39
|
-
const binary = Deno.readFileSync(path.fromFileUrl(import.meta.resolve(
|
|
19
|
+
const binary = Deno.readFileSync(path.fromFileUrl(import.meta.resolve('./rcPlayer.wasm')));
|
|
40
20
|
const module = await WebAssembly.compile(binary, wasmOptions);
|
|
41
21
|
wasmInstance = await WebAssembly.instantiate(module, importObject);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
22
|
+
} else if (
|
|
23
|
+
(typeof d8 !== 'undefined' // V8
|
|
24
|
+
|| typeof inIon !== 'undefined' // SpiderMonkey
|
|
25
|
+
|| typeof jscOptions !== 'undefined' // JavaScriptCore
|
|
26
|
+
)
|
|
27
|
+
) {
|
|
28
|
+
const filepath = import.meta.url.replace(/\.mjs$/, '.wasm');
|
|
47
29
|
const wasmBuffer = read(filepath, 'binary');
|
|
48
30
|
const wasmModule = new WebAssembly.Module(wasmBuffer, wasmOptions);
|
|
49
31
|
wasmInstance = new WebAssembly.Instance(wasmModule, importObject);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (isBrowser) {
|
|
32
|
+
} else {
|
|
53
33
|
wasmInstance = (await WebAssembly.instantiateStreaming(fetch(new URL('./rcPlayer.wasm',import.meta.url).href), importObject, wasmOptions)).instance;
|
|
54
34
|
}
|
|
55
35
|
} catch (e) {
|
|
@@ -57,7 +37,7 @@ try {
|
|
|
57
37
|
let text = `Please make sure that your runtime environment supports the latest version of Wasm GC and Exception-Handling proposals.
|
|
58
38
|
For more information, see https://kotl.in/wasm-help
|
|
59
39
|
`;
|
|
60
|
-
if (
|
|
40
|
+
if (typeof console !== "undefined" && console.error !== void 0) {
|
|
61
41
|
console.error(text);
|
|
62
42
|
} else {
|
|
63
43
|
const t = "\n" + text;
|
|
@@ -71,11 +51,34 @@ For more information, see https://kotl.in/wasm-help
|
|
|
71
51
|
}
|
|
72
52
|
|
|
73
53
|
const exports = wasmInstance.exports
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
|
|
55
|
+
let memoryFirstTimeAccess = true;
|
|
56
|
+
const memoryProxy = new Proxy(importObject.intrinsics.memory, {
|
|
57
|
+
get(target, prop, receiver) {
|
|
58
|
+
if (memoryFirstTimeAccess) {
|
|
59
|
+
memoryFirstTimeAccess = false;
|
|
60
|
+
console.error('Accessing `memory` via `wasmExports` is deprecated. Use `kotlin.wasm.unsafe.wasmMemory` or update dependencies. Read more: https://kotl.in/vr3szr');
|
|
61
|
+
}
|
|
62
|
+
return Reflect.get(target, prop);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const wasmExports = new Proxy(memoryProxy, {
|
|
66
|
+
get(target, prop, receiver) {
|
|
67
|
+
if (prop == 'memory') {
|
|
68
|
+
return target;
|
|
69
|
+
} else {
|
|
70
|
+
throw new Error('Accessing exports via `wasmExports` is no longer supported. Remove usages or update dependencies. Read more: https://kotl.in/vr3szr');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const wasmMemory = wasmExports.memory;
|
|
76
|
+
export { wasmMemory as memory }
|
|
76
77
|
|
|
77
78
|
export const {
|
|
78
|
-
memory,
|
|
79
79
|
_start
|
|
80
80
|
} = exports
|
|
81
81
|
|
|
82
|
+
setWasmExports(wasmExports);
|
|
83
|
+
|
|
84
|
+
exports._start();
|
package/dist/rcPlayer.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yschimke/remote-compose-player-cmp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.67.0",
|
|
4
4
|
"description": "The Compose Multiplatform / Wasm Remote Compose player, as a drop-in browser bundle. Renders .rc documents in an iframe driven by query parameters and window.rcPlayerLoad.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"remote-compose",
|