single-file-core 1.5.64 → 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,34 +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
344
|
const origFontFace = globalThis.FontFace;
|
|
340
345
|
globalThis.FontFace = function FontFace(family, source, ...args) {
|
|
341
|
-
|
|
342
|
-
|
|
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;
|
|
343
355
|
}
|
|
344
|
-
getDetailObject(family, source, ...args).then(detail => document.dispatchEvent(new CustomEvent(NEW_FONT_FACE_EVENT, { detail })));
|
|
345
|
-
return new FontFace(family, source, ...args);
|
|
346
356
|
};
|
|
347
357
|
globalThis.FontFace.prototype = origFontFace.prototype;
|
|
348
358
|
globalThis.FontFace.toString = function () { return "function FontFace() { [native code] }"; };
|
|
349
359
|
const deleteFont = document.fonts.delete;
|
|
350
360
|
document.fonts.delete = function (fontFace) {
|
|
351
|
-
|
|
352
|
-
|
|
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
|
+
}
|
|
353
368
|
};
|
|
354
369
|
document.fonts.delete.toString = function () { return "function delete() { [native code] }"; };
|
|
355
370
|
const clearFonts = document.fonts.clear;
|
|
356
371
|
document.fonts.clear = function () {
|
|
357
|
-
|
|
358
|
-
|
|
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
|
+
}
|
|
359
379
|
};
|
|
360
380
|
document.fonts.clear.toString = function () { return "function clear() { [native code] }"; };
|
|
361
381
|
}
|
|
@@ -363,39 +383,56 @@
|
|
|
363
383
|
if (globalThis.IntersectionObserver) {
|
|
364
384
|
const IntersectionObserver = globalThis.IntersectionObserver;
|
|
365
385
|
globalThis.IntersectionObserver = function () {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
if (targetElements) {
|
|
386
|
-
targetElements = targetElements.filter(element => element != targetElement);
|
|
387
|
-
if (targetElements.length) {
|
|
388
|
-
observedElements.set(intersectionObserver, targetElements);
|
|
389
|
-
} else {
|
|
390
|
-
observedElements.delete(intersectionObserver);
|
|
391
|
-
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;
|
|
392
405
|
}
|
|
393
|
-
}
|
|
394
|
-
return
|
|
395
|
-
}
|
|
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;
|
|
396
435
|
}
|
|
397
|
-
observers.set(intersectionObserver, { callback, options });
|
|
398
|
-
return intersectionObserver;
|
|
399
436
|
};
|
|
400
437
|
globalThis.IntersectionObserver.prototype = IntersectionObserver.prototype;
|
|
401
438
|
globalThis.IntersectionObserver.toString = function () { return "function IntersectionObserver() { [native code] }"; };
|