single-file-core 1.5.63 → 1.5.65
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/package.json
CHANGED
|
@@ -328,31 +328,54 @@
|
|
|
328
328
|
if (globalThis.CSS && globalThis.CSS.paintWorklet && globalThis.CSS.paintWorklet.addModule) {
|
|
329
329
|
const addModule = globalThis.CSS.paintWorklet.addModule;
|
|
330
330
|
globalThis.CSS.paintWorklet.addModule = function (moduleURL, options) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
try {
|
|
332
|
+
const result = addModule.apply(globalThis.CSS.paintWorklet, arguments);
|
|
333
|
+
moduleURL = new URL(moduleURL, document.baseURI).href;
|
|
334
|
+
document.dispatchEvent(new CustomEvent(NEW_WORKLET_EVENT, { detail: { moduleURL, options } }));
|
|
335
|
+
return result;
|
|
336
|
+
} catch (error) {
|
|
337
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
335
340
|
};
|
|
336
341
|
}
|
|
337
342
|
|
|
338
343
|
if (globalThis.FontFace) {
|
|
339
|
-
const
|
|
340
|
-
globalThis.FontFace = function () {
|
|
341
|
-
|
|
342
|
-
|
|
344
|
+
const origFontFace = globalThis.FontFace;
|
|
345
|
+
globalThis.FontFace = function FontFace(family, source, ...args) {
|
|
346
|
+
try {
|
|
347
|
+
if (!new.target) {
|
|
348
|
+
return origFontFace();
|
|
349
|
+
}
|
|
350
|
+
getDetailObject(family, source, ...args).then(detail => document.dispatchEvent(new CustomEvent(NEW_FONT_FACE_EVENT, { detail })));
|
|
351
|
+
return new FontFace(family, source, ...args);
|
|
352
|
+
} catch (error) {
|
|
353
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
343
356
|
};
|
|
344
|
-
globalThis.FontFace.prototype =
|
|
357
|
+
globalThis.FontFace.prototype = origFontFace.prototype;
|
|
345
358
|
globalThis.FontFace.toString = function () { return "function FontFace() { [native code] }"; };
|
|
346
359
|
const deleteFont = document.fonts.delete;
|
|
347
360
|
document.fonts.delete = function (fontFace) {
|
|
348
|
-
|
|
349
|
-
|
|
361
|
+
try {
|
|
362
|
+
getDetailObject(fontFace.family).then(detail => document.dispatchEvent(new CustomEvent(DELETE_FONT_EVENT, { detail })));
|
|
363
|
+
return deleteFont.call(document.fonts, fontFace);
|
|
364
|
+
} catch (error) {
|
|
365
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
366
|
+
throw error;
|
|
367
|
+
}
|
|
350
368
|
};
|
|
351
369
|
document.fonts.delete.toString = function () { return "function delete() { [native code] }"; };
|
|
352
370
|
const clearFonts = document.fonts.clear;
|
|
353
371
|
document.fonts.clear = function () {
|
|
354
|
-
|
|
355
|
-
|
|
372
|
+
try {
|
|
373
|
+
document.dispatchEvent(new CustomEvent(CLEAR_FONTS_EVENT));
|
|
374
|
+
return clearFonts.call(document.fonts);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
377
|
+
throw error;
|
|
378
|
+
}
|
|
356
379
|
};
|
|
357
380
|
document.fonts.clear.toString = function () { return "function clear() { [native code] }"; };
|
|
358
381
|
}
|
|
@@ -360,39 +383,56 @@
|
|
|
360
383
|
if (globalThis.IntersectionObserver) {
|
|
361
384
|
const IntersectionObserver = globalThis.IntersectionObserver;
|
|
362
385
|
globalThis.IntersectionObserver = function () {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
if (targetElements) {
|
|
383
|
-
targetElements = targetElements.filter(element => element != targetElement);
|
|
384
|
-
if (targetElements.length) {
|
|
385
|
-
observedElements.set(intersectionObserver, targetElements);
|
|
386
|
-
} else {
|
|
387
|
-
observedElements.delete(intersectionObserver);
|
|
388
|
-
observers.delete(intersectionObserver);
|
|
386
|
+
try {
|
|
387
|
+
const intersectionObserver = new IntersectionObserver(...arguments);
|
|
388
|
+
const observeIntersection = IntersectionObserver.prototype.observe || intersectionObserver.observe;
|
|
389
|
+
const unobserveIntersection = IntersectionObserver.prototype.unobserve || intersectionObserver.unobserve;
|
|
390
|
+
const callback = arguments[0];
|
|
391
|
+
const options = arguments[1];
|
|
392
|
+
if (observeIntersection) {
|
|
393
|
+
intersectionObserver.observe = function (targetElement) {
|
|
394
|
+
try {
|
|
395
|
+
let targetElements = observedElements.get(intersectionObserver);
|
|
396
|
+
if (!targetElements) {
|
|
397
|
+
targetElements = [];
|
|
398
|
+
observedElements.set(intersectionObserver, targetElements);
|
|
399
|
+
}
|
|
400
|
+
targetElements.push(targetElement);
|
|
401
|
+
return observeIntersection.call(intersectionObserver, targetElement);
|
|
402
|
+
} catch (error) {
|
|
403
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
404
|
+
throw error;
|
|
389
405
|
}
|
|
390
|
-
}
|
|
391
|
-
return
|
|
392
|
-
}
|
|
406
|
+
};
|
|
407
|
+
intersectionObserver.observe.toString = function () { return "function observe() { [native code] }"; };
|
|
408
|
+
}
|
|
409
|
+
if (unobserveIntersection) {
|
|
410
|
+
intersectionObserver.unobserve = function (targetElement) {
|
|
411
|
+
try {
|
|
412
|
+
let targetElements = observedElements.get(intersectionObserver);
|
|
413
|
+
if (targetElements) {
|
|
414
|
+
targetElements = targetElements.filter(element => element != targetElement);
|
|
415
|
+
if (targetElements.length) {
|
|
416
|
+
observedElements.set(intersectionObserver, targetElements);
|
|
417
|
+
} else {
|
|
418
|
+
observedElements.delete(intersectionObserver);
|
|
419
|
+
observers.delete(intersectionObserver);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return unobserveIntersection.call(intersectionObserver, targetElement);
|
|
423
|
+
} catch (error) {
|
|
424
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
425
|
+
throw error;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
intersectionObserver.unobserve.toString = function () { return "function unobserve() { [native code] }"; };
|
|
429
|
+
}
|
|
430
|
+
observers.set(intersectionObserver, { callback, options });
|
|
431
|
+
return intersectionObserver;
|
|
432
|
+
} catch (error) {
|
|
433
|
+
error.stack = error.message + "\n" + " \n" + error.stack.trim().split("\n").slice(-1).join("\n");
|
|
434
|
+
throw error;
|
|
393
435
|
}
|
|
394
|
-
observers.set(intersectionObserver, { callback, options });
|
|
395
|
-
return intersectionObserver;
|
|
396
436
|
};
|
|
397
437
|
globalThis.IntersectionObserver.prototype = IntersectionObserver.prototype;
|
|
398
438
|
globalThis.IntersectionObserver.toString = function () { return "function IntersectionObserver() { [native code] }"; };
|