@estiva-app/ui 0.74.0 → 0.74.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.
@@ -1 +1 @@
1
- {"version":3,"file":"CommentHighlights.d.ts","sourceRoot":"","sources":["../src/CommentHighlights.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAA;IACb,uFAAuF;IACvF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,EAAE,EAAE,MAAM,CAAA;IACV,8EAA8E;IAC9E,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,sFAAsF;IACtF,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED,qDAAqD;AACrD,MAAM,MAAM,YAAY;AACtB,6DAA6D;AAC3D;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AACjE,8GAA8G;GAC5G;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AACjD,kCAAkC;GAChC;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,CAAA;AA8IzB,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,YAAY;QACpB,sFAAsF;QACtF,aAAa,EAAE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AAG,YAAY,CAEhF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,IAAI,CAOxF;AAED,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAErD;AA6BD,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAuExE"}
package/dist/editor.js CHANGED
@@ -675,20 +675,44 @@ function textOf(block) {
675
675
  let text = "";
676
676
  const starts = [];
677
677
  const ends = [];
678
- block.node.descendants((node, offset) => {
679
- const at = block.pos + 1 + offset;
680
- if (node.isText && node.text) {
681
- for (let i = 0; i < node.text.length; i++) starts.push(at + i), ends.push(at + i + 1);
682
- text += node.text;
683
- } else if (node.isInline && node.isLeaf) {
684
- const wire = typeof node.attrs.uri === "string" ? node.attrs.uri : "";
685
- for (let i = 0; i < wire.length; i++) starts.push(at), ends.push(at + node.nodeSize);
686
- text += wire;
678
+ const add = (chars, start, end) => {
679
+ for (let i = 0; i < chars.length; i++) starts.push(start), ends.push(end);
680
+ text += chars;
681
+ };
682
+ const walk = (node, pos) => {
683
+ if (node.isTextblock) {
684
+ node.forEach((child, offset) => {
685
+ const at = pos + 1 + offset;
686
+ if (child.isText && child.text) {
687
+ for (let i = 0; i < child.text.length; i++) starts.push(at + i), ends.push(at + i + 1);
688
+ text += child.text;
689
+ } else if (child.type.name === "hardBreak") add("\n", at, at + child.nodeSize);
690
+ else if (child.isInline && child.isLeaf) add(String(child.attrs.href || child.attrs.uri || ""), at, at + child.nodeSize);
691
+ });
692
+ return;
687
693
  }
688
- return true;
689
- });
694
+ if (node.type.name === "listItem") {
695
+ node.forEach((child, offset) => void (LISTS.has(child.type.name) || walk(child, pos + 1 + offset)));
696
+ return;
697
+ }
698
+ const children = LISTS.has(node.type.name) ? itemsOf(node, pos) : childrenOf(node, pos);
699
+ children.forEach(({ node: child, pos: at }, index) => {
700
+ if (index > 0) add("\n", at, at);
701
+ walk(child, at);
702
+ });
703
+ };
704
+ walk(block.node, block.pos);
690
705
  return { text, starts, ends };
691
706
  }
707
+ var LISTS = /* @__PURE__ */ new Set(["bulletList", "orderedList"]);
708
+ function childrenOf(node, pos) {
709
+ const out = [];
710
+ node.forEach((child, offset) => void out.push({ node: child, pos: pos + 1 + offset }));
711
+ return out;
712
+ }
713
+ function itemsOf(list, pos) {
714
+ return childrenOf(list, pos).flatMap((item) => [item, ...childrenOf(item.node, item.pos).flatMap((c) => LISTS.has(c.node.type.name) ? itemsOf(c.node, c.pos) : [])]);
715
+ }
692
716
  function find(text, words, from, context) {
693
717
  let first = -1;
694
718
  for (let at = text.indexOf(words, from); at !== -1; at = text.indexOf(words, at + 1)) {
@@ -883,6 +907,7 @@ function anchorOfSelection(editor) {
883
907
  if (run.length > 1 && end <= 0) run = run.slice(0, -1), lastText = textOf(run[run.length - 1]), end = lastText.text.length;
884
908
  if (run.length === 1) lastText = firstText;
885
909
  if (run.length === 1 && firstText.text && start >= end) return null;
910
+ if (run.length === 1 && firstText.text && !firstText.text.slice(start, end).replace(/\n/g, "")) return null;
886
911
  const blocks = run.map((p) => p.node.attrs.blockId);
887
912
  if (start === 0 && end >= lastText.text.length) return { blocks };
888
913
  const single = run.length === 1;
@@ -1477,8 +1502,8 @@ function EditorBlockHandle({ editor, turnInto = turnIntoRows, actions, children,
1477
1502
  }, [editor, turnInto]);
1478
1503
  return /* @__PURE__ */ jsx6(BlockHandle, { editing, actions, className, children });
1479
1504
  }
1480
- var LISTS = ["bulletList", "orderedList"];
1481
- var isList = (node) => LISTS.includes(node.type.name);
1505
+ var LISTS2 = ["bulletList", "orderedList"];
1506
+ var isList = (node) => LISTS2.includes(node.type.name);
1482
1507
  function listItems(list, at) {
1483
1508
  const out = [];
1484
1509
  list.descendants((node, pos) => {
@@ -2304,7 +2329,7 @@ function claimsIn(doc2) {
2304
2329
  doc2.descendants((node, pos, parent) => {
2305
2330
  const fixed = node.type.name === "unknownBlock";
2306
2331
  if (!fixed && !BLOCK_TYPE_SET.has(node.type.name)) return;
2307
- if (parent?.type.name === "listItem" && LISTS2.has(node.type.name)) return;
2332
+ if (parent?.type.name === "listItem" && LISTS3.has(node.type.name)) return;
2308
2333
  const id = node.attrs.blockId;
2309
2334
  if (typeof id !== "string" || id === "") return;
2310
2335
  const copies = claims.get(id);
@@ -2351,11 +2376,11 @@ function repeatedBlockIds(doc2, before, mapping) {
2351
2376
  }
2352
2377
  var BLOCK_CONTAINERS = /* @__PURE__ */ new Set(["bulletList", "orderedList", "table", "tableRow", "tableHeader", "tableCell"]);
2353
2378
  var FLATTENED = /* @__PURE__ */ new Set(["listItem", "blockquote"]);
2354
- var LISTS2 = /* @__PURE__ */ new Set(["bulletList", "orderedList"]);
2379
+ var LISTS3 = /* @__PURE__ */ new Set(["bulletList", "orderedList"]);
2355
2380
  function innerLists(item, pos) {
2356
2381
  const out = [];
2357
2382
  item.forEach((child, offset) => {
2358
- if (LISTS2.has(child.type.name)) out.push({ pos: pos + 1 + offset, node: child });
2383
+ if (LISTS3.has(child.type.name)) out.push({ pos: pos + 1 + offset, node: child });
2359
2384
  });
2360
2385
  return out;
2361
2386
  }
@@ -2384,7 +2409,7 @@ function hiddenIds(doc2) {
2384
2409
  doc2.descendants((node, pos) => {
2385
2410
  if (!FLATTENED.has(node.type.name)) return;
2386
2411
  node.forEach((child, offset) => {
2387
- const inner = child.isTextblock || node.type.name === "listItem" && LISTS2.has(child.type.name);
2412
+ const inner = child.isTextblock || node.type.name === "listItem" && LISTS3.has(child.type.name);
2388
2413
  if (inner && idOf(child) !== void 0) out.push(pos + 1 + offset);
2389
2414
  });
2390
2415
  });