@lvce-editor/renderer-process 30.58.0 → 30.58.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.
@@ -1226,7 +1226,7 @@ const create$B = async ({
1226
1226
  const omitted = new Set(['SCRIPT', 'STYLE', 'LINK', 'META', 'BASE', 'NOSCRIPT']);
1227
1227
  const unsupported = new Set(['IFRAME', 'WEBVIEW', 'CANVAS', 'OBJECT', 'EMBED', 'VIDEO', 'AUDIO']);
1228
1228
  // The allowlist covers HTML, SVG and accessibility attributes.
1229
- const attributes$1 = /^(class|style|id|title|role|type|checked|disabled|selected|placeholder|width|height|viewBox|d|fill|stroke|cx|cy|r|x|y|x1|x2|y1|y2|points|transform|xmlns|aria-[\w-]+)$/i;
1229
+ const attributes$1 = /^(class|style|id|title|role|type|checked|disabled|selected|placeholder|width|height|viewBox|d|fill|stroke|cx|cy|r|x|y|x1|x2|y1|y2|points|transform|xmlns|data-[\w-]+|aria-[\w-]+)$/i;
1230
1230
  const capture = document => {
1231
1231
  const visit = original => {
1232
1232
  if (original.nodeType === 3) return {
@@ -1443,7 +1443,7 @@ const createClient = url => {
1443
1443
 
1444
1444
  const tags = new Set('body div span p pre code main section article header footer nav aside h1 h2 h3 h4 h5 h6 ul ol li table thead tbody tr td th button input textarea select option label form fieldset legend a img br hr strong em b i u s small details summary svg path rect circle ellipse line polyline polygon g defs clipPath text tspan'.split(' '));
1445
1445
  // The allowlist covers HTML, SVG and accessibility attributes.
1446
- const attributes = /^(class|style|id|title|role|type|checked|disabled|selected|placeholder|width|height|viewBox|d|fill|stroke|cx|cy|r|x|y|x1|x2|y1|y2|points|transform|xmlns|aria-[\w-]+)$/i;
1446
+ const attributes = /^(class|style|id|title|role|type|checked|disabled|selected|placeholder|width|height|viewBox|d|fill|stroke|cx|cy|r|x|y|x1|x2|y1|y2|points|transform|xmlns|data-[\w-]+|aria-[\w-]+)$/i;
1447
1447
  const renderFrame = (document, frame) => {
1448
1448
  let count = 0;
1449
1449
  const scrolls = [];
@@ -376,7 +376,7 @@ var getElementTag = (type) => {
376
376
 
377
377
  // ../session-replay-worker/src/visualDom.ts
378
378
  var element = (tag = "div") => ({ attrs: {}, children: [], tag });
379
- var styleKeys = /* @__PURE__ */ new Set(["width", "height", "top", "left", "marginTop", "paddingLeft", "paddingRight"]);
379
+ var styleKeys = /* @__PURE__ */ new Set(["width", "height", "top", "left", "translate", "marginTop", "paddingLeft", "paddingRight"]);
380
380
  var attributes = { className: "class", htmlFor: "for", inputType: "type" };
381
381
  var setStyle = (node, key, value) => {
382
382
  node.attrs ||= {};
@@ -430,6 +430,19 @@ var find = (node, selector) => {
430
430
  }
431
431
  return void 0;
432
432
  };
433
+ var expandPatches = (patches) => patches.flatMap((value) => {
434
+ if (value.type !== 18) return [value];
435
+ const { navigations } = value;
436
+ if (!Array.isArray(navigations) || navigations.length % 2 !== 0) throw new Error("Invalid compact replay navigation");
437
+ const result = [];
438
+ for (let index = 0; index < navigations.length; index += 2) {
439
+ const type = navigations[index];
440
+ const childIndex = navigations[index + 1];
441
+ if (![7, 8, 10].includes(type) || !Number.isSafeInteger(childIndex) || childIndex < 0) throw new Error("Invalid compact replay navigation");
442
+ result.push({ ...value, index: childIndex, type });
443
+ }
444
+ return result;
445
+ });
433
446
  var createVisualDom = () => {
434
447
  const views = /* @__PURE__ */ new Map();
435
448
  const parents = /* @__PURE__ */ new WeakMap();
@@ -498,7 +511,8 @@ var createVisualDom = () => {
498
511
  if (stack.some((entry) => entry.remaining !== 0)) throw new Error("Incomplete replay virtual DOM");
499
512
  return roots;
500
513
  };
501
- const patch = (uid, patches) => {
514
+ const patch = (uid, input) => {
515
+ const patches = expandPatches(input);
502
516
  let current = views.get(uid);
503
517
  if (!current) return;
504
518
  owners.set(current, uid);
@@ -540,7 +554,7 @@ var createVisualDom = () => {
540
554
  };
541
555
  for (let index = 0; index < patches.length; index++) {
542
556
  const value = patches[index];
543
- if (value.type === 7 && value.index === current.children?.length && patches[index + 1]?.type === 2) append(current, element());
557
+ if (value.type === 7 && value.index === current.children?.length && [2, 11].includes(patches[index + 1]?.type)) append(current, element());
544
558
  if (!mutations[value.type]) continue;
545
559
  current = mutations[value.type](current, value);
546
560
  if (!current) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.58.0",
3
+ "version": "30.58.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"