@bitcobblers/wod-wiki-ui 0.5.29 → 0.6.31
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/dist/{chunk-HRROD36H.mjs → chunk-V2JNLN54.mjs} +28 -13
- package/dist/chunk-V2JNLN54.mjs.map +1 -0
- package/dist/extensions/index.cjs +26 -11
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +1 -1
- package/dist/extensions/index.d.ts +1 -1
- package/dist/extensions/index.mjs +1 -1
- package/dist/{index-BZqjX-eA.d.cts → index-B8_9uGBX.d.cts} +1 -0
- package/dist/{index-BZqjX-eA.d.ts → index-B8_9uGBX.d.ts} +1 -0
- package/dist/index.cjs +32 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-HRROD36H.mjs.map +0 -1
|
@@ -800,11 +800,12 @@ var SectionGeometryPlugin = class {
|
|
|
800
800
|
rects = [];
|
|
801
801
|
docVersion = 0;
|
|
802
802
|
listeners = /* @__PURE__ */ new Set();
|
|
803
|
+
pendingNotify = null;
|
|
803
804
|
update(update) {
|
|
804
805
|
if (update.docChanged) {
|
|
805
806
|
this.docVersion++;
|
|
806
807
|
}
|
|
807
|
-
if (update.docChanged || update.
|
|
808
|
+
if (update.docChanged || update.geometryChanged) {
|
|
808
809
|
this.measure();
|
|
809
810
|
}
|
|
810
811
|
}
|
|
@@ -819,18 +820,19 @@ var SectionGeometryPlugin = class {
|
|
|
819
820
|
try {
|
|
820
821
|
const sectionState = this.view.state.field(sectionField, false);
|
|
821
822
|
const sections = sectionState?.sections ?? [];
|
|
822
|
-
const
|
|
823
|
-
const scrollTop = this.view.scrollDOM?.scrollTop ?? 0;
|
|
823
|
+
const docLength = this.view.state.doc.length;
|
|
824
824
|
this.rects = sections.map((sec) => {
|
|
825
|
-
|
|
826
|
-
|
|
825
|
+
const from = Math.max(0, Math.min(sec.from, docLength));
|
|
826
|
+
const to = Math.max(0, Math.min(sec.to, docLength));
|
|
827
|
+
let top = 0;
|
|
828
|
+
let bottom = 20;
|
|
827
829
|
try {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
+
const topBlock = this.view.lineBlockAt(from);
|
|
831
|
+
const bottomBlock = this.view.lineBlockAt(to);
|
|
832
|
+
top = topBlock.top;
|
|
833
|
+
bottom = bottomBlock.top + bottomBlock.height;
|
|
830
834
|
} catch {
|
|
831
835
|
}
|
|
832
|
-
const top = fromCoords ? fromCoords.top - (scrollRect?.top ?? 0) + scrollTop : 0;
|
|
833
|
-
const bottom = toCoords ? toCoords.bottom - (scrollRect?.top ?? 0) + scrollTop : top;
|
|
834
836
|
const height = Math.max(bottom - top, 20);
|
|
835
837
|
return {
|
|
836
838
|
sectionId: sec.id,
|
|
@@ -846,11 +848,24 @@ var SectionGeometryPlugin = class {
|
|
|
846
848
|
}
|
|
847
849
|
}
|
|
848
850
|
notify() {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
+
if (typeof requestAnimationFrame === "function") {
|
|
852
|
+
if (this.pendingNotify !== null) return;
|
|
853
|
+
this.pendingNotify = requestAnimationFrame(() => {
|
|
854
|
+
this.pendingNotify = null;
|
|
855
|
+
for (const listener of this.listeners) {
|
|
856
|
+
listener(this.rects, this.docVersion);
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
} else {
|
|
860
|
+
for (const listener of this.listeners) {
|
|
861
|
+
listener(this.rects, this.docVersion);
|
|
862
|
+
}
|
|
851
863
|
}
|
|
852
864
|
}
|
|
853
865
|
destroy() {
|
|
866
|
+
if (this.pendingNotify !== null && typeof cancelAnimationFrame === "function") {
|
|
867
|
+
cancelAnimationFrame(this.pendingNotify);
|
|
868
|
+
}
|
|
854
869
|
this.listeners.clear();
|
|
855
870
|
}
|
|
856
871
|
};
|