@mushi-mushi/web 1.37.3 → 1.38.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/README.md CHANGED
@@ -44,7 +44,7 @@ Building in Lovable or Bolt with no terminal? A script tag works too: [Mushi Mus
44
44
  | **Privacy** | A built-in PII scrubber, selector masking for screenshots, and opt-in session replay. |
45
45
  | **Stays out of the way** | Zero-size host with `pointer-events: none`, keyboard-first, respects reduced motion. |
46
46
  | **Runtime config** | Change the widget from the console without a deploy. Values you set in code win. |
47
- | **Size** | CI caps the core bundle at 88.5 KB gzipped (105 KB uncompressed). Screenshot capture, screenshot markup and the Your reports views load only when used. |
47
+ | **Size** | CI caps the core bundle at 89.2 KB gzipped (105 KB uncompressed). Screenshot capture, screenshot markup and the Your reports views load only when used. |
48
48
 
49
49
  ## Recipes
50
50
 
package/dist/headless.cjs CHANGED
@@ -1215,7 +1215,7 @@ function createPerformanceCapture() {
1215
1215
  }
1216
1216
  };
1217
1217
  }
1218
- function createElementSelector() {
1218
+ function createElementSelector(privateSelector = () => "", scrubText = (text) => text) {
1219
1219
  let active = false;
1220
1220
  let overlay = null;
1221
1221
  let captureLayer = null;
@@ -1248,6 +1248,18 @@ function createElementSelector() {
1248
1248
  }
1249
1249
  return "//" + parts.join("/");
1250
1250
  }
1251
+ function elementText(el) {
1252
+ const selector = privateSelector();
1253
+ if (selector) {
1254
+ try {
1255
+ if (el.closest(selector) || el.querySelector(selector)) return void 0;
1256
+ } catch {
1257
+ return void 0;
1258
+ }
1259
+ }
1260
+ const text = el.textContent?.trim().slice(0, 200);
1261
+ return text ? scrubText(text) : void 0;
1262
+ }
1251
1263
  function captureElement(el) {
1252
1264
  const rect = el.getBoundingClientRect();
1253
1265
  const className = typeof el.className === "string" ? el.className : el.getAttribute("class") ?? "";
@@ -1255,7 +1267,7 @@ function createElementSelector() {
1255
1267
  tagName: el.tagName.toLowerCase(),
1256
1268
  id: el.id || void 0,
1257
1269
  className: className || void 0,
1258
- textContent: el.textContent?.trim().slice(0, 200) || void 0,
1270
+ textContent: elementText(el),
1259
1271
  xpath: getXPath(el),
1260
1272
  rect: {
1261
1273
  x: Math.round(rect.x),