@mushi-mushi/web 1.30.0 → 1.31.1
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/README.md +19 -5
- package/dist/chunks/widget-views-DX3OYHGR.js +233 -0
- package/dist/chunks/widget-views-DX3OYHGR.js.map +1 -0
- package/dist/headless.cjs +17 -1
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.js +17 -1
- package/dist/headless.js.map +1 -1
- package/dist/i18n/index.cjs +126 -258
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +95 -43
- package/dist/i18n/index.d.ts +95 -43
- package/dist/i18n/index.js +126 -258
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +1817 -2259
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -204
- package/dist/index.d.ts +267 -247
- package/dist/index.js +1579 -2260
- package/dist/index.js.map +1 -1
- package/dist/mushi.loader.global.js +12 -495
- package/dist/test-utils.cjs +237 -0
- package/dist/test-utils.cjs.map +1 -1
- package/dist/test-utils.js +237 -0
- package/dist/test-utils.js.map +1 -1
- package/package.json +12 -3
package/dist/headless.js
CHANGED
|
@@ -348,7 +348,7 @@ function createScreenshotCapture(options = {}) {
|
|
|
348
348
|
try {
|
|
349
349
|
if (typeof document === "undefined") return null;
|
|
350
350
|
const canvas = document.createElement("canvas");
|
|
351
|
-
const ctx = canvas.getContext("2d");
|
|
351
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
352
352
|
if (!ctx) {
|
|
353
353
|
activeOptions.onFailed?.("unsupported");
|
|
354
354
|
emitScreenshotFailed("unsupported");
|
|
@@ -433,6 +433,8 @@ function buildPrivacySafeDocument(privacy) {
|
|
|
433
433
|
clone.querySelector("#mushi-mushi-widget")?.remove();
|
|
434
434
|
stripTaintSources(clone);
|
|
435
435
|
inlineDocumentStyles(clone);
|
|
436
|
+
freezeMotion(clone);
|
|
437
|
+
fillViewport(clone);
|
|
436
438
|
const redactSelectors = [
|
|
437
439
|
ALWAYS_REDACT_SELECTORS,
|
|
438
440
|
...privacy?.redactSelectors ?? DEFAULT_REDACT_SELECTORS
|
|
@@ -522,6 +524,20 @@ function inlineDocumentStyles(clone) {
|
|
|
522
524
|
styleEl.textContent = css;
|
|
523
525
|
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
524
526
|
}
|
|
527
|
+
var FREEZE_MOTION_CSS = "*,*::before,*::after{animation:none!important;transition:none!important}";
|
|
528
|
+
function fillViewport(clone) {
|
|
529
|
+
const clear = (c) => !c || c === "transparent" || /^rgba\(.*,\s*0\)$/.test(c);
|
|
530
|
+
let bg = getComputedStyle(document.documentElement).backgroundColor;
|
|
531
|
+
if (clear(bg) && document.body) bg = getComputedStyle(document.body).backgroundColor;
|
|
532
|
+
const root = clone;
|
|
533
|
+
root.style.setProperty("background-color", clear(bg) ? "Canvas" : bg);
|
|
534
|
+
root.style.setProperty("min-height", `${window.innerHeight}px`);
|
|
535
|
+
}
|
|
536
|
+
function freezeMotion(clone) {
|
|
537
|
+
const styleEl = document.createElement("style");
|
|
538
|
+
styleEl.textContent = FREEZE_MOTION_CSS;
|
|
539
|
+
(clone.querySelector("head") ?? clone).appendChild(styleEl);
|
|
540
|
+
}
|
|
525
541
|
function serializeSheet(sheet) {
|
|
526
542
|
let rules;
|
|
527
543
|
try {
|