plitejs 54.0.0-beta.3 → 54.0.0-beta.5

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.
Files changed (56) hide show
  1. package/dist/annotations/index.d.ts +1 -1
  2. package/dist/annotations/index.js +1 -1
  3. package/dist/authored/index.d.ts +2 -2
  4. package/dist/authored/index.js +168 -46
  5. package/dist/{authored-veto-DSnQcHGR.js → authored-veto-Cu-5JdVj.js} +1 -1
  6. package/dist/{comparison-plan-CEQL0ooW.js → comparison-plan-BJxnVPcS.js} +1 -1
  7. package/dist/{comparison-types-Dt-unJZY.d.ts → comparison-types-Bvvxzxq2.d.ts} +1 -1
  8. package/dist/{create-editor-CkHtPWXV.js → create-editor-XvI_4sYc.js} +2 -1
  9. package/dist/diff/index.d.ts +2 -2
  10. package/dist/diff/index.js +2 -2
  11. package/dist/dom/index.d.ts +1 -1
  12. package/dist/dom/index.js +1 -1
  13. package/dist/{dom-Cgfscvnm.js → dom-BjspML2h.js} +71 -46
  14. package/dist/{editor-owner-IUmkTeXz.js → editor-owner-CRgIQ625.js} +1 -1
  15. package/dist/history/index.d.ts +1 -1
  16. package/dist/history/index.js +2 -2
  17. package/dist/hyperscript/index.d.ts +1 -1
  18. package/dist/hyperscript/index.js +1 -1
  19. package/dist/{hyperscript-FPuoArEi.js → hyperscript-BFypA5qW.js} +2 -2
  20. package/dist/{index-Cw-oC2ps.d.ts → index-BUJsM0oV.d.ts} +1 -1
  21. package/dist/{index-HPYawTae.d.ts → index-BwmXxqbi.d.ts} +1 -1
  22. package/dist/{index-DPWyk3lG.d.ts → index-CRmyGzS8.d.ts} +7 -1
  23. package/dist/{index-K0Za9YXc.d.ts → index-CYac3_ID.d.ts} +26 -22
  24. package/dist/{index-BpQx2UG4.d.ts → index-DaXz-4c7.d.ts} +10 -8
  25. package/dist/{index-DpltOCot.d.ts → index-QuqD4Dyj.d.ts} +109 -27
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +4 -4
  28. package/dist/internal/index.d.ts +2 -2
  29. package/dist/internal/index.js +4 -4
  30. package/dist/{mapped-view-store-ld-6uxEU.js → mapped-view-store-XUJ-fnHE.js} +1 -1
  31. package/dist/{native-grouping-input-DMNcsIaW.js → native-grouping-input-8kO12VK9.js} +1 -1
  32. package/dist/pagination/index.d.ts +1 -1
  33. package/dist/pagination/index.js +1 -1
  34. package/dist/pagination/react.d.ts +2 -2
  35. package/dist/pagination/react.js +5 -5
  36. package/dist/{pagination-D_A8iPJP.js → pagination-ChDBJtdC.js} +1 -1
  37. package/dist/{plugin-DWzkJbnJ.js → plugin-BvM4s-Lr.js} +1481 -964
  38. package/dist/{range-geometry-BjeLHOnl.js → range-geometry-B5CITwMp.js} +2 -2
  39. package/dist/{range-geometry-BLAHRE11.d.ts → range-geometry-wFuJaBlA.d.ts} +1 -1
  40. package/dist/react/index.d.ts +5 -5
  41. package/dist/react/index.js +6 -6
  42. package/dist/react/virtualized.d.ts +2 -2
  43. package/dist/react/virtualized.js +1 -1
  44. package/dist/{react-DZ15gmz2.js → react-cmFeNP6P.js} +16 -8
  45. package/dist/{retraction-BMem8Rfk.js → retraction-lXQwo2Ia.js} +1 -1
  46. package/dist/{src-cT1OTKP_.js → src-BA6F9yxN.js} +195 -3
  47. package/dist/{store-Cz2mXyDe.js → store-Bllfuqp4.js} +24 -11
  48. package/dist/testing/index.d.ts +2 -2
  49. package/dist/testing/index.js +3 -3
  50. package/dist/{use-editor-dom-scope-BbMDSCpW.js → use-editor-dom-scope-B4gF9t_Y.js} +572 -524
  51. package/dist/yjs/index.d.ts +1 -1
  52. package/dist/yjs/index.js +1 -1
  53. package/dist/yjs/react/index.d.ts +3 -3
  54. package/dist/yjs/react/index.js +3 -3
  55. package/dist/{yjs-DOK-m7kl.js → yjs-CWdWDrpv.js} +5 -2
  56. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { Ic as readAuthoredView, eu as failInvariant, il as notifyObservers, ip as getDefined, mu as RangeApi, pi as subscribeEditorViewState } from "./plugin-DWzkJbnJ.js";
2
- import { p as projectRange } from "./create-editor-CkHtPWXV.js";
1
+ import { Hc as readAuthoredView, Jf as RangeApi, _l as notifyObservers, mi as subscribeEditorViewState, pu as failInvariant, vp as getDefined } from "./plugin-BvM4s-Lr.js";
2
+ import { p as projectRange } from "./create-editor-XvI_4sYc.js";
3
3
  import { n as registerAnnotationStoreMetrics } from "./annotation-store-metrics-Ccjkef45.js";
4
- import { n as createMappedViewStoreKernel, r as createViewSourceFaultBoundary, t as areMappedViewDataEqual } from "./mapped-view-store-ld-6uxEU.js";
4
+ import { n as createMappedViewStoreKernel, r as createViewSourceFaultBoundary, t as areMappedViewDataEqual } from "./mapped-view-store-XUJ-fnHE.js";
5
5
  //#region src/internal/view/stable-id-mapped-source.ts
6
6
  const EMPTY_OUTPUTS = Object.freeze([]);
7
7
  const createPersistentReadonlyRecord = (initial, onNodeCopy, onChildEntriesCopy) => {
@@ -514,7 +514,7 @@ const createPliteAnnotationStoreInternal = (editorInput, source, options, dorman
514
514
  mappedResolveCount += 1;
515
515
  const resolvedRange = annotation.anchor.resolve(editor);
516
516
  const mappedRange = resolvedRange ? projectAnnotationRange(editor, resolvedRange) : null;
517
- const range = mappedRange ? resolvedRange : null;
517
+ const range = resolvedRange && mappedRange && !(options.hideEmpty && editor.read.ranges.isEmpty(resolvedRange)) ? resolvedRange : null;
518
518
  return {
519
519
  entity: Object.freeze({
520
520
  data: annotation.data,
@@ -555,6 +555,13 @@ const createPliteAnnotationStoreInternal = (editorInput, source, options, dorman
555
555
  let subscriberCount = 0;
556
556
  let lastSnapshot = dormant ? null : editor.read.runtime.snapshot();
557
557
  let lastProjection = dormant ? void 0 : authoredPreview(editor);
558
+ let lastSchema = dormant ? void 0 : editor.read.schema.identity();
559
+ const markFresh = () => {
560
+ lastSnapshot = editor.read.runtime.snapshot();
561
+ lastProjection = authoredPreview(editor);
562
+ lastSchema = editor.read.schema.identity();
563
+ };
564
+ const schemaChanged = () => options.hideEmpty === true && editor.read.schema.identity() !== lastSchema;
558
565
  const refreshCandidates = (candidateIds = null, forceAll = candidateIds === null, reason = "refresh") => {
559
566
  const annotationsResult = faultBoundary.run("read", getAnnotations);
560
567
  if (!annotationsResult.ok) return;
@@ -566,8 +573,7 @@ const createPliteAnnotationStoreInternal = (editorInput, source, options, dorman
566
573
  } }));
567
574
  if (!mappedResult.ok) return;
568
575
  currentAnnotations = annotationsResult.value;
569
- lastSnapshot = editor.read.runtime.snapshot();
570
- lastProjection = authoredPreview(editor);
576
+ markFresh();
571
577
  const changedIds = mappedResult.value.changedEntityIds;
572
578
  const changed = changedIds.length > 0 || mappedResult.value.orderChanged || mappedResult.value.affectedOutputKeys.length > 0;
573
579
  const subscriberWakeCount = changed ? annotationsStore.subscriberCount() + changeListeners.size + annotationsStore.countKeySubscribers(changedIds) : 0;
@@ -592,19 +598,23 @@ const createPliteAnnotationStoreInternal = (editorInput, source, options, dorman
592
598
  const ensureFresh = () => {
593
599
  if (!activated || destroyed) return;
594
600
  const snapshot = editor.read.runtime.snapshot();
595
- if (snapshot.children !== lastSnapshot?.children || snapshot.index !== lastSnapshot?.index || authoredPreview(editor) !== lastProjection) refreshCandidates(null, true, "editor");
601
+ if (snapshot.children !== lastSnapshot?.children || snapshot.index !== lastSnapshot?.index || authoredPreview(editor) !== lastProjection || schemaChanged()) refreshCandidates(null, true, "editor");
596
602
  };
597
603
  const subscribeToEditor = () => {
598
604
  const unsubscribeCommit = editor.subscribeCommit((change) => {
599
- if (destroyed || !shouldRefreshForEditorChange(change)) return;
605
+ if (destroyed) return;
606
+ if (schemaChanged()) {
607
+ refreshCandidates(null, true, "editor");
608
+ return;
609
+ }
610
+ if (!shouldRefreshForEditorChange(change)) return;
600
611
  if (authoredPreview(editor) !== lastProjection) {
601
612
  refreshCandidates(null, true, "editor");
602
613
  return;
603
614
  }
604
615
  const candidateIds = change ? Array.from(/* @__PURE__ */ new Set([...mappedSource.getIdsForOutputKeys(change.changed.nodeKeysAll("decoration")), ...change.changed.hasAny("document") ? mappedSource.getIdsWithoutOutputs() : []])) : null;
605
616
  if (candidateIds && candidateIds.length === 0) {
606
- lastSnapshot = editor.read.runtime.snapshot();
607
- lastProjection = authoredPreview(editor);
617
+ markFresh();
608
618
  return;
609
619
  }
610
620
  refreshCandidates(candidateIds, candidateIds === null, "editor");
@@ -650,7 +660,10 @@ const createPliteAnnotationStoreInternal = (editorInput, source, options, dorman
650
660
  },
651
661
  getAnnotationsAt: (nodeKey) => {
652
662
  ensureFresh();
653
- return Object.freeze(mappedSource.getIdsForOutputKeys([nodeKey]).flatMap((id) => annotationsStore.getSnapshot().byId.get(id) ?? []));
663
+ return Object.freeze(mappedSource.getIdsForOutputKeys([nodeKey]).flatMap((id) => {
664
+ const annotation = annotationsStore.getSnapshot().byId.get(id);
665
+ return annotation?.range ? [annotation] : [];
666
+ }));
654
667
  },
655
668
  getSnapshot: () => {
656
669
  ensureFresh();
@@ -1,5 +1,5 @@
1
- import { $f as insertText, Dc as Editor, Df as deleteBackward, Hp as unhangRange, If as getChildren, Ii as setEditorFocused, Og as Point, Qs as Element, Rp as string, Si as getLiveSelection, Sp as positions, Tf as before, Uf as getSelection, Wf as getSnapshot, Yf as insertBreak, _g as Range, bc as AnyEditor, bf as Value, gp as move, kf as deleteForward, kp as replace, mc as Text, nh as Selection, oh as TextSelection, rp as isEditor, tp as isBlock, vh as Descendant, wf as after, xg as Location } from "../index-DpltOCot.js";
2
- import { i as createHyperscript, o as createEditor } from "../index-HPYawTae.js";
1
+ import { $f as getSnapshot, Bi as setEditorFocused, Dh as Descendant, Gf as getChildren, If as deleteBackward, Mg as Location, Nf as after, Of as Value, Og as Range, Pf as before, Qf as getSelection, Rf as deleteForward, Rp as replace, Tp as move, Zp as unhangRange, cp as insertText, dh as Selection, fp as isEditor, hh as TextSelection, ip as insertBreak, jc as Editor, jp as positions, nc as Element, qp as string, up as isBlock, vc as Text, wc as AnyEditor, wi as getLiveSelection, zg as Point } from "../index-QuqD4Dyj.js";
2
+ import { i as createHyperscript, o as createEditor } from "../index-BwmXxqbi.js";
3
3
  //#region src/testing/createDataTransfer.d.ts
4
4
  declare const createDataTransfer: (dataMap?: Map<string, string>) => DataTransfer;
5
5
  //#endregion
@@ -1,6 +1,6 @@
1
- import { Bt as point, Ft as move, J as deleteForward, Jt as replace, K as deleteBackward, St as isEditor, U as after, Vt as positions, W as before, bt as isBlock, ct as getSelection, lt as getSnapshot, mt as insertBreak, mu as RangeApi, ni as setEditorFocused, or as getLiveSelection, rn as string, sn as unhangRange, tt as getChildren, vt as insertText } from "../plugin-DWzkJbnJ.js";
2
- import { a as createEditor$1 } from "../create-editor-CkHtPWXV.js";
3
- import { a as createText, i as createEditorFixture, n as createHyperscript, r as createEditor, t as jsx$1 } from "../hyperscript-FPuoArEi.js";
1
+ import { Bt as point, Ft as move, J as deleteForward, Jf as RangeApi, Jt as replace, K as deleteBackward, St as isEditor, U as after, Vt as positions, W as before, ar as getLiveSelection, bt as isBlock, ct as getSelection, lt as getSnapshot, mt as insertBreak, ri as setEditorFocused, rn as string, sn as unhangRange, tt as getChildren, vt as insertText } from "../plugin-BvM4s-Lr.js";
2
+ import { a as createEditor$1 } from "../create-editor-XvI_4sYc.js";
3
+ import { a as createText, i as createEditorFixture, n as createHyperscript, r as createEditor, t as jsx$1 } from "../hyperscript-BFypA5qW.js";
4
4
  import { t as BROWSER_HANDLE_KEY } from "../browser-protocol-pvt4HFF7.js";
5
5
  //#region src/testing/createDataTransfer.ts
6
6
  const createDataTransfer = (dataMap = /* @__PURE__ */ new Map()) => ({