mini-three-adapter 0.1.6 → 0.1.8
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/AGENTS.md +85 -85
- package/LICENSE +21 -21
- package/README.md +159 -159
- package/dist/build/rollup.d.ts +2 -2
- package/dist/build/rollup.js.map +1 -1
- package/dist/build/vite.d.ts +2 -2
- package/dist/build/vite.js.map +1 -1
- package/dist/{chunk-MSP7V7KM.js → chunk-DQH3YRGN.js} +3 -3
- package/dist/chunk-DQH3YRGN.js.map +1 -0
- package/dist/{chunk-35XVAVDB.js → chunk-J34MD3IL.js} +2 -2
- package/dist/chunk-J34MD3IL.js.map +1 -0
- package/dist/{chunk-LCJNTN6F.js → chunk-LAVHSWBU.js} +8 -5
- package/dist/chunk-LAVHSWBU.js.map +1 -0
- package/dist/{chunk-WYUHMKUM.js → chunk-RYWYBOYO.js} +43 -4
- package/dist/chunk-RYWYBOYO.js.map +1 -0
- package/dist/{chunk-6Y4MKIJL.js → chunk-SXQUZI22.js} +4 -4
- package/dist/chunk-SXQUZI22.js.map +1 -0
- package/dist/{chunk-TDVL2OAV.js → chunk-TPMMZFHW.js} +123 -58
- package/dist/chunk-TPMMZFHW.js.map +1 -0
- package/dist/{chunk-L4QZ5SP6.js → chunk-YPG3QUYK.js} +4 -4
- package/dist/chunk-YPG3QUYK.js.map +1 -0
- package/dist/core/index.d.ts +9 -3
- package/dist/core/index.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -7
- package/dist/platforms/browser.d.ts +2 -2
- package/dist/platforms/browser.js +4 -4
- package/dist/platforms/wechat-game.d.ts +2 -2
- package/dist/platforms/wechat-game.js +5 -5
- package/dist/platforms/wechat-miniprogram.d.ts +2 -2
- package/dist/platforms/wechat-miniprogram.js +5 -5
- package/dist/{plugin-core-BuqW9C-L.d.ts → plugin-core-CBOr1cyv.d.ts} +15 -4
- package/dist/polyfills/index.d.ts +1 -1
- package/dist/polyfills/index.js +1 -1
- package/dist/{runtime-BrHExTjl.d.ts → runtime-C8_xIlDM.d.ts} +29 -1
- package/dist/scope.d.ts +1 -1
- package/dist/scope.js +1 -1
- package/dist/{types-X_5SJh4y.d.ts → types-DOoJ7noL.d.ts} +13 -1
- package/docs/01-design-principles.md +105 -105
- package/docs/03-module-map.md +99 -99
- package/docs/04-api-reference.md +310 -304
- package/docs/05-build-plugin.md +176 -176
- package/docs/06-platform-notes.md +8 -4
- package/docs/07-integration-guide.md +226 -225
- package/docs/08-extension-guide.md +101 -101
- package/docs/09-testing-and-release.md +212 -211
- package/docs/11-compat-matrix.md +100 -100
- package/docs/README.md +41 -41
- package/docs/adr/0001-scoped-globals.md +41 -41
- package/docs/adr/0002-unified-runtime-lifecycle.md +40 -40
- package/docs/adr/0003-ast-rewrite.md +51 -51
- package/docs/adr/0004-in-place-patching.md +42 -42
- package/docs/adr/0005-webgl2-only.md +44 -44
- package/docs/adr/0006-zero-three-dependency.md +43 -43
- package/docs/adr/0007-capability-probe-fallback.md +61 -61
- package/docs/adr/0008-probe-fallback-boundary.md +56 -56
- package/docs/adr/0009-placeholder-scope-environment-globals.md +69 -69
- package/docs/adr/0010-native-event-target-boundary.md +82 -0
- package/docs/adr/0011-host-callback-slot-bridging.md +45 -0
- package/docs/adr/README.md +33 -31
- package/package.json +126 -125
- package/dist/chunk-35XVAVDB.js.map +0 -1
- package/dist/chunk-6Y4MKIJL.js.map +0 -1
- package/dist/chunk-L4QZ5SP6.js.map +0 -1
- package/dist/chunk-LCJNTN6F.js.map +0 -1
- package/dist/chunk-MSP7V7KM.js.map +0 -1
- package/dist/chunk-TDVL2OAV.js.map +0 -1
- package/dist/chunk-WYUHMKUM.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createScope, setActiveScope, getEarlyScopeReads, clearEarlyScopeReads, hasActiveScope, getActiveScope, installGlobals } from './chunk-
|
|
2
|
-
import { patchEventTarget, MiniEventTarget,
|
|
1
|
+
import { createScope, setActiveScope, getEarlyScopeReads, clearEarlyScopeReads, hasActiveScope, getActiveScope, installGlobals } from './chunk-J34MD3IL.js';
|
|
2
|
+
import { patchEventTarget, MiniEventTarget, MiniPointerEvent, MiniMouseEvent, atob, btoa, MiniEvent, MiniCustomEvent, MiniMessageEvent, MiniProgressEvent, MiniDOMException, MiniBlob, MiniURL, MiniTextDecoder, MiniTextEncoder, MiniAbortController, MiniAbortSignal, createFetch, createXMLHttpRequestFactory } from './chunk-LAVHSWBU.js';
|
|
3
3
|
import { __publicField } from './chunk-V6TY7KAL.js';
|
|
4
4
|
|
|
5
5
|
// src/core/diagnostics.ts
|
|
@@ -96,6 +96,7 @@ function patchElement(instance, options) {
|
|
|
96
96
|
throw new TypeError("[mini-three-adapter] patchElement expects an object");
|
|
97
97
|
}
|
|
98
98
|
let rect = { ...options.rect };
|
|
99
|
+
const native = options.nativeEventTarget === true;
|
|
99
100
|
const style = {};
|
|
100
101
|
define(style, "width", { get: () => `${rect.width}px`, set: (v) => {
|
|
101
102
|
const n = Number.parseFloat(String(v));
|
|
@@ -111,36 +112,40 @@ function patchElement(instance, options) {
|
|
|
111
112
|
} });
|
|
112
113
|
style.cursor = "default";
|
|
113
114
|
style.touchAction = "none";
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
const defineMember = (key, descriptor) => {
|
|
116
|
+
if (native && key in instance) return;
|
|
117
|
+
define(instance, key, descriptor);
|
|
118
|
+
};
|
|
119
|
+
defineMember("style", { value: style, writable: true });
|
|
120
|
+
defineMember("clientTop", { get: () => 0 });
|
|
121
|
+
defineMember("clientLeft", { get: () => 0 });
|
|
122
|
+
defineMember("clientWidth", { get: () => rect.width });
|
|
123
|
+
defineMember("clientHeight", { get: () => rect.height });
|
|
124
|
+
defineMember("offsetTop", { get: () => rect.top });
|
|
125
|
+
defineMember("offsetLeft", { get: () => rect.left });
|
|
126
|
+
defineMember("offsetWidth", { get: () => rect.width });
|
|
127
|
+
defineMember("offsetHeight", { get: () => rect.height });
|
|
128
|
+
defineMember("getBoundingClientRect", { value: () => ({ ...rect }), writable: true });
|
|
129
|
+
defineMember("setAttribute", { value: (name, value) => {
|
|
125
130
|
var _a2;
|
|
126
131
|
(_a2 = options.onSetAttribute) == null ? void 0 : _a2.call(options, name, value, instance);
|
|
127
132
|
}, writable: true });
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
defineMember("removeAttribute", { value: () => void 0, writable: true });
|
|
134
|
+
defineMember("ownerDocument", { value: (_a = options.document) != null ? _a : null, writable: true });
|
|
135
|
+
defineMember("getRootNode", { value: () => {
|
|
131
136
|
var _a2;
|
|
132
137
|
return (_a2 = options.document) != null ? _a2 : instance;
|
|
133
138
|
}, writable: true });
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
patchEventTarget(instance);
|
|
139
|
+
defineMember("setPointerCapture", { value: () => void 0, writable: true });
|
|
140
|
+
defineMember("releasePointerCapture", { value: () => void 0, writable: true });
|
|
141
|
+
defineMember("hasPointerCapture", { value: () => false, writable: true });
|
|
142
|
+
defineMember("requestPointerLock", { value: () => void 0, writable: true });
|
|
143
|
+
defineMember("exitPointerLock", { value: () => void 0, writable: true });
|
|
144
|
+
defineMember("focus", { value: () => void 0, writable: true });
|
|
145
|
+
defineMember("blur", { value: () => void 0, writable: true });
|
|
146
|
+
defineMember("scrollTop", { get: () => 0, set: () => void 0 });
|
|
147
|
+
defineMember("scrollLeft", { get: () => 0, set: () => void 0 });
|
|
148
|
+
if (!native) patchEventTarget(instance);
|
|
144
149
|
if (options.extra) {
|
|
145
150
|
for (const [key, descriptor] of Object.entries(options.extra)) {
|
|
146
151
|
define(instance, key, descriptor);
|
|
@@ -250,18 +255,27 @@ function patchCanvas(raw, options = {}) {
|
|
|
250
255
|
if (typeof raw.toDataURL === "function") return raw.toDataURL(type, quality);
|
|
251
256
|
return "data:,";
|
|
252
257
|
};
|
|
258
|
+
const native = options.nativeEventTarget === true;
|
|
259
|
+
const extra = {
|
|
260
|
+
// Context caching and WebGL normalisation stay ours even on a real canvas:
|
|
261
|
+
// the native getContext is re-read through findOriginalGetContext, so
|
|
262
|
+
// identity and behaviour are unchanged for the host.
|
|
263
|
+
getContext: { value: getContext, writable: true }
|
|
264
|
+
};
|
|
265
|
+
if (!native) {
|
|
266
|
+
extra.toDataURL = { value: toDataURL, writable: true };
|
|
267
|
+
extra.nodeType = { value: 1 };
|
|
268
|
+
extra.tagName = { value: "CANVAS" };
|
|
269
|
+
extra.nodeName = { value: "CANVAS" };
|
|
270
|
+
} else if (typeof raw.toDataURL !== "function") {
|
|
271
|
+
extra.toDataURL = { value: toDataURL, writable: true };
|
|
272
|
+
}
|
|
253
273
|
const patched = patchElement(raw, {
|
|
254
274
|
rect: normalizeRect(options.rect),
|
|
255
275
|
document: options.document,
|
|
256
276
|
instanceOf: [HTMLCanvasElementShim, HTMLElementShim],
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
toDataURL: { value: toDataURL, writable: true },
|
|
260
|
-
// three.js reads `canvas.nodeType` / `canvas.tagName` in a few addons.
|
|
261
|
-
nodeType: { value: 1 },
|
|
262
|
-
tagName: { value: "CANVAS" },
|
|
263
|
-
nodeName: { value: "CANVAS" }
|
|
264
|
-
}
|
|
277
|
+
nativeEventTarget: native,
|
|
278
|
+
extra
|
|
265
279
|
});
|
|
266
280
|
return {
|
|
267
281
|
...patched,
|
|
@@ -351,7 +365,8 @@ function createDocument(options) {
|
|
|
351
365
|
rect: { width: raw.width, height: raw.height, left: 0, top: 0, right: raw.width, bottom: raw.height },
|
|
352
366
|
document,
|
|
353
367
|
diagnostics,
|
|
354
|
-
normalizeWebGL: true
|
|
368
|
+
normalizeWebGL: true,
|
|
369
|
+
nativeEventTarget: binding.nativeEventTarget === true
|
|
355
370
|
});
|
|
356
371
|
OffscreenCanvasShim.__instances.add(raw);
|
|
357
372
|
return patched.canvas;
|
|
@@ -421,7 +436,8 @@ function createOffscreenCanvasCtor(binding) {
|
|
|
421
436
|
const raw = binding.createOffscreenCanvas(width, height, "2d");
|
|
422
437
|
const patched = patchCanvas(raw, {
|
|
423
438
|
rect: { width, height, left: 0, top: 0, right: width, bottom: height },
|
|
424
|
-
normalizeWebGL: true
|
|
439
|
+
normalizeWebGL: true,
|
|
440
|
+
nativeEventTarget: binding.nativeEventTarget === true
|
|
425
441
|
});
|
|
426
442
|
OffscreenCanvasShim.__instances.add(raw);
|
|
427
443
|
return patched.canvas;
|
|
@@ -517,6 +533,16 @@ function toArrayLike(value) {
|
|
|
517
533
|
if (!value) return [];
|
|
518
534
|
return Array.prototype.slice.call(value);
|
|
519
535
|
}
|
|
536
|
+
function normalizeMouseType(raw) {
|
|
537
|
+
if (raw === "wheel") return "wheel";
|
|
538
|
+
return raw.startsWith("mouse") ? raw : `mouse${raw}`;
|
|
539
|
+
}
|
|
540
|
+
function writeExtra(target, key, value) {
|
|
541
|
+
try {
|
|
542
|
+
target[key] = value;
|
|
543
|
+
} catch {
|
|
544
|
+
}
|
|
545
|
+
}
|
|
520
546
|
var PointerBridge = class {
|
|
521
547
|
constructor(options) {
|
|
522
548
|
__publicField(this, "options", options);
|
|
@@ -613,7 +639,7 @@ var PointerBridge = class {
|
|
|
613
639
|
this.emit(pointerType, id, init);
|
|
614
640
|
if (this.options.emitMouseEvents !== false) {
|
|
615
641
|
const mouseType = (_f = MOUSE_TYPE_MAP[pointerType]) != null ? _f : "mouseup";
|
|
616
|
-
const mouse =
|
|
642
|
+
const mouse = this.makeMouse(mouseType, {
|
|
617
643
|
...init,
|
|
618
644
|
button: pointerType === "pointerdown" ? 0 : 0,
|
|
619
645
|
buttons,
|
|
@@ -633,7 +659,7 @@ var PointerBridge = class {
|
|
|
633
659
|
const point = points[0];
|
|
634
660
|
if (point) {
|
|
635
661
|
const coords = this.toCoords(point, event);
|
|
636
|
-
this.fanout(
|
|
662
|
+
this.fanout(this.makeMouse("click", {
|
|
637
663
|
pointerId: 1,
|
|
638
664
|
clientX: coords.x,
|
|
639
665
|
clientY: coords.y,
|
|
@@ -647,12 +673,12 @@ var PointerBridge = class {
|
|
|
647
673
|
}
|
|
648
674
|
/** Convenience for mouse events coming from WeChat devtools / PC. */
|
|
649
675
|
dispatchMouse(event) {
|
|
650
|
-
var _a, _b, _c, _d, _e, _f;
|
|
676
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
651
677
|
const rect = this.rect;
|
|
652
678
|
const x = (_b = (_a = event.clientX) != null ? _a : event.x) != null ? _b : 0;
|
|
653
679
|
const y = (_d = (_c = event.clientY) != null ? _c : event.y) != null ? _d : 0;
|
|
654
|
-
const type = event.type
|
|
655
|
-
const mouse =
|
|
680
|
+
const type = normalizeMouseType(event.type);
|
|
681
|
+
const mouse = this.makeMouse(type, {
|
|
656
682
|
pointerId: 1,
|
|
657
683
|
clientX: x,
|
|
658
684
|
clientY: y,
|
|
@@ -660,9 +686,13 @@ var PointerBridge = class {
|
|
|
660
686
|
offsetY: y - rect.top,
|
|
661
687
|
button: (_e = event.button) != null ? _e : 0,
|
|
662
688
|
buttons: type === "mouseup" ? 0 : 1,
|
|
663
|
-
pointerType: "mouse"
|
|
689
|
+
pointerType: "mouse",
|
|
690
|
+
...type === "wheel" ? { deltaY: (_f = event.deltaY) != null ? _f : 0, deltaMode: (_g = event.deltaMode) != null ? _g : 0 } : {}
|
|
664
691
|
});
|
|
665
|
-
|
|
692
|
+
if (type === "wheel") {
|
|
693
|
+
writeExtra(mouse, "deltaY", (_h = event.deltaY) != null ? _h : 0);
|
|
694
|
+
writeExtra(mouse, "wheelDelta", (_i = event.deltaY) != null ? _i : 0);
|
|
695
|
+
}
|
|
666
696
|
this.fanout(mouse, 1);
|
|
667
697
|
}
|
|
668
698
|
dispose() {
|
|
@@ -705,19 +735,30 @@ var PointerBridge = class {
|
|
|
705
735
|
return { x, y, offsetX: x - this.rect.left, offsetY: y - this.rect.top };
|
|
706
736
|
}
|
|
707
737
|
emit(type, pointerId, init = {}) {
|
|
708
|
-
|
|
738
|
+
this.fanout(this.makePointer(type, { ...init, pointerId }), pointerId);
|
|
739
|
+
}
|
|
740
|
+
makePointer(type, init) {
|
|
741
|
+
if (this.options.createEvent) return this.options.createEvent(type, init);
|
|
742
|
+
const ev = new MiniPointerEvent(type, init);
|
|
709
743
|
ev.target = this.options.targets.element;
|
|
710
|
-
|
|
744
|
+
return ev;
|
|
745
|
+
}
|
|
746
|
+
makeMouse(type, init) {
|
|
747
|
+
if (this.options.createEvent) return this.options.createEvent(type, init);
|
|
748
|
+
const ev = new MiniMouseEvent(type, init);
|
|
749
|
+
ev.target = this.options.targets.element;
|
|
750
|
+
return ev;
|
|
711
751
|
}
|
|
712
752
|
fanout(event, pointerId, propagateOverride) {
|
|
713
753
|
var _a;
|
|
754
|
+
const native = this.options.nativeEventTarget === true;
|
|
714
755
|
const propagate = (_a = propagateOverride != null ? propagateOverride : this.options.propagate) != null ? _a : true;
|
|
715
756
|
const captured = this.captured.get(pointerId);
|
|
716
|
-
const targets = captured ? [captured] : [this.options.targets.element, this.options.targets.document, this.options.targets.window];
|
|
757
|
+
const targets = captured ? [captured] : native ? [this.options.targets.element] : [this.options.targets.element, this.options.targets.document, this.options.targets.window];
|
|
717
758
|
for (const target of targets) {
|
|
718
759
|
if (!target) continue;
|
|
719
760
|
if (!propagate && target !== this.options.targets.element && target !== captured) continue;
|
|
720
|
-
event.currentTarget = target;
|
|
761
|
+
if (!native) event.currentTarget = target;
|
|
721
762
|
target.dispatchEvent(event);
|
|
722
763
|
if (event.cancelBubble) break;
|
|
723
764
|
}
|
|
@@ -830,12 +871,14 @@ async function createRuntime(platform, options = {}) {
|
|
|
830
871
|
defaultContextType: (_c = options.defaultContextType) != null ? _c : "webgl2",
|
|
831
872
|
documentRef
|
|
832
873
|
});
|
|
874
|
+
const nativeEvents = binding.nativeEventTarget === true;
|
|
833
875
|
const patched = patchCanvas(binding.rawCanvas, {
|
|
834
876
|
rect: initialRect,
|
|
835
877
|
document,
|
|
836
878
|
diagnostics,
|
|
837
879
|
cacheContexts: (_d = options.cacheContexts) != null ? _d : true,
|
|
838
|
-
normalizeWebGL: (_e = options.normalizeWebGL) != null ? _e : true
|
|
880
|
+
normalizeWebGL: (_e = options.normalizeWebGL) != null ? _e : true,
|
|
881
|
+
nativeEventTarget: nativeEvents
|
|
839
882
|
});
|
|
840
883
|
const canvas = patched.canvas;
|
|
841
884
|
const windowInfo = createWindowInfoStore(wx, {
|
|
@@ -923,18 +966,23 @@ async function createRuntime(platform, options = {}) {
|
|
|
923
966
|
const host = globalThis;
|
|
924
967
|
scope.Worker = (_g = host.Worker) != null ? _g : void 0;
|
|
925
968
|
scope.WebAssembly = (_i = (_h = host.WebAssembly) != null ? _h : host.WXWebAssembly) != null ? _i : void 0;
|
|
969
|
+
const createEvent = nativeEvents && typeof binding.createEvent === "function" ? binding.createEvent.bind(binding) : void 0;
|
|
926
970
|
const bridge = new PointerBridge({
|
|
927
971
|
getRect: () => canvas.getBoundingClientRect(),
|
|
928
972
|
targets: { element: canvas, document, window: scope },
|
|
929
973
|
propagate: (_j = options.propagatePointerEvents) != null ? _j : true,
|
|
930
974
|
emitMouseEvents: (_k = options.emitMouseEvents) != null ? _k : true,
|
|
975
|
+
nativeEventTarget: nativeEvents,
|
|
976
|
+
...createEvent ? { createEvent } : {},
|
|
931
977
|
diagnostics
|
|
932
978
|
});
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
979
|
+
if (!nativeEvents) {
|
|
980
|
+
Object.defineProperties(canvas, {
|
|
981
|
+
setPointerCapture: { value: (id) => bridge.setPointerCapture(id, canvas), configurable: true },
|
|
982
|
+
releasePointerCapture: { value: (id) => bridge.releasePointerCapture(id), configurable: true },
|
|
983
|
+
hasPointerCapture: { value: (id) => bridge.activePointerCount > 0 && id >= 0, configurable: true }
|
|
984
|
+
});
|
|
985
|
+
}
|
|
938
986
|
const emitter = /* @__PURE__ */ new Map();
|
|
939
987
|
const emit = (name, ...args) => {
|
|
940
988
|
const set = emitter.get(name);
|
|
@@ -1019,7 +1067,8 @@ async function createRuntime(platform, options = {}) {
|
|
|
1019
1067
|
const p = patchCanvas(raw, {
|
|
1020
1068
|
rect: { width, height, left: 0, top: 0, right: width, bottom: height },
|
|
1021
1069
|
document,
|
|
1022
|
-
diagnostics
|
|
1070
|
+
diagnostics,
|
|
1071
|
+
nativeEventTarget: nativeEvents
|
|
1023
1072
|
});
|
|
1024
1073
|
return p.canvas;
|
|
1025
1074
|
},
|
|
@@ -1283,8 +1332,14 @@ function createImageFactory(wx, diagnostics) {
|
|
|
1283
1332
|
let terminalDetail;
|
|
1284
1333
|
const decodeWaiters = [];
|
|
1285
1334
|
let watchdogId;
|
|
1335
|
+
let dispatchDepth = 0;
|
|
1286
1336
|
const dispatch = (event) => {
|
|
1287
|
-
|
|
1337
|
+
dispatchDepth++;
|
|
1338
|
+
try {
|
|
1339
|
+
raw.dispatchEvent(event);
|
|
1340
|
+
} finally {
|
|
1341
|
+
dispatchDepth--;
|
|
1342
|
+
}
|
|
1288
1343
|
};
|
|
1289
1344
|
const finish = (eventName, detail) => {
|
|
1290
1345
|
if (settled || failed) return;
|
|
@@ -1331,12 +1386,16 @@ function createImageFactory(wx, diagnostics) {
|
|
|
1331
1386
|
hostShape
|
|
1332
1387
|
);
|
|
1333
1388
|
}
|
|
1389
|
+
const forwarders = {
|
|
1390
|
+
load: forwardLoad,
|
|
1391
|
+
error: forwardError
|
|
1392
|
+
};
|
|
1334
1393
|
for (const eventName of ["load", "error"]) {
|
|
1335
1394
|
try {
|
|
1336
1395
|
Object.defineProperty(raw, `on${eventName}`, {
|
|
1337
1396
|
configurable: true,
|
|
1338
1397
|
enumerable: true,
|
|
1339
|
-
get: () => handlers[eventName],
|
|
1398
|
+
get: () => dispatchDepth > 0 ? handlers[eventName] : forwarders[eventName],
|
|
1340
1399
|
set: (next) => {
|
|
1341
1400
|
handlers[eventName] = typeof next === "function" ? next : void 0;
|
|
1342
1401
|
}
|
|
@@ -1371,6 +1430,11 @@ function createImageFactory(wx, diagnostics) {
|
|
|
1371
1430
|
finish("load", { type: "load", reason: "watchdog-complete" });
|
|
1372
1431
|
return;
|
|
1373
1432
|
}
|
|
1433
|
+
diagnostics == null ? void 0 : diagnostics.warnOnce(
|
|
1434
|
+
"image-events-timeout",
|
|
1435
|
+
`image-events-timeout: no load or error event within ${EVENT_WATCHDOG_MS} ms; the texture is reported as failed (package textures decode well inside 2s; slow network images need preloading, docs/06 \xA76.3.1)`,
|
|
1436
|
+
{ path: eventPath, src: currentSrc }
|
|
1437
|
+
);
|
|
1374
1438
|
forwardError({ type: "error", reason: "image-events-timeout", path: eventPath });
|
|
1375
1439
|
}, EVENT_WATCHDOG_MS);
|
|
1376
1440
|
};
|
|
@@ -1415,6 +1479,7 @@ function createImageFactory(wx, diagnostics) {
|
|
|
1415
1479
|
};
|
|
1416
1480
|
onSrcChange = startFallback;
|
|
1417
1481
|
Object.defineProperty(raw, "crossOrigin", { value: "", writable: true, configurable: true });
|
|
1482
|
+
Object.defineProperty(raw, "fetchPriority", { value: "auto", writable: true, configurable: true });
|
|
1418
1483
|
Object.defineProperty(raw, "decode", {
|
|
1419
1484
|
value: () => new Promise((resolve, reject) => {
|
|
1420
1485
|
if (failed) return reject(terminalDetail);
|
|
@@ -1449,5 +1514,5 @@ function createImageFactory(wx, diagnostics) {
|
|
|
1449
1514
|
}
|
|
1450
1515
|
|
|
1451
1516
|
export { DOMRectShim, HTMLCanvasElementShim, HTMLElementShim, HTMLImageElementShim, ImageDataShim, OffscreenCanvasShim, PointerBridge, ShimDOMRect, ShimImageData, WebGL2RenderingContextShim, WebGLRenderingContextShim, capabilityReport, createDiagnostics, createDocument, createFrameScheduler, createImageFactory, createMockClass, createOffscreenCanvas, createRuntime, createScreen, createWindowInfoStore, currentScope, detectCapabilities, isMarked, markAs, normalizeRect, patchCanvas, patchElement, readWindowInfo, versionAtLeast };
|
|
1452
|
-
//# sourceMappingURL=chunk-
|
|
1453
|
-
//# sourceMappingURL=chunk-
|
|
1517
|
+
//# sourceMappingURL=chunk-TPMMZFHW.js.map
|
|
1518
|
+
//# sourceMappingURL=chunk-TPMMZFHW.js.map
|