@linloir/limr 0.1.0 → 1.0.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.en.md +123 -0
- package/README.md +63 -138
- package/dist/base.css +10 -7
- package/dist/{chunk-65V5OZ4G.js → chunk-3ILUZKDB.js} +77 -17
- package/dist/chunk-3ILUZKDB.js.map +1 -0
- package/dist/{chunk-ETHLPBKQ.js → chunk-N77VD2YR.js} +96 -51
- package/dist/chunk-N77VD2YR.js.map +1 -0
- package/dist/{chunk-7JF5HHVF.js → chunk-TTISGBST.js} +14 -1
- package/dist/{chunk-7JF5HHVF.js.map → chunk-TTISGBST.js.map} +1 -1
- package/dist/core/index.d.ts +6 -3
- package/dist/core/index.js +3 -1
- package/dist/extensions/index.d.ts +2 -2
- package/dist/extensions/index.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +5 -3
- package/dist/styles.css +10 -7
- package/dist/{translations-BliabrPd.d.ts → translations-DHnYMg4h.d.ts} +11 -3
- package/docs/README.md +13 -0
- package/docs/api.md +5 -158
- package/docs/assets/rendered.svg +9 -0
- package/docs/assets/source.svg +9 -0
- package/docs/en/README.md +26 -0
- package/docs/en/ai-skills.md +57 -0
- package/docs/en/annotations.md +84 -0
- package/docs/en/api.md +107 -0
- package/docs/en/architecture.md +33 -0
- package/docs/en/extensions.md +159 -0
- package/docs/en/getting-started.md +67 -0
- package/docs/en/integration.md +130 -0
- package/docs/en/modules.md +80 -0
- package/docs/en/performance.md +53 -0
- package/docs/en/plugin-packages.md +68 -0
- package/docs/en/styles.md +80 -0
- package/docs/en/syntax.md +352 -0
- package/docs/extensions.md +5 -306
- package/docs/implementation.md +5 -76
- package/docs/performance.md +5 -81
- package/docs/screenshots/blocks.png +0 -0
- package/docs/screenshots/dark.png +0 -0
- package/docs/screenshots/desktop.png +0 -0
- package/docs/screenshots/plugin-mobile.png +0 -0
- package/docs/styles.md +5 -100
- package/docs/visual-upgrade.md +5 -145
- package/docs/zh-CN/README.md +26 -0
- package/docs/zh-CN/ai-skills.md +57 -0
- package/docs/zh-CN/annotations.md +84 -0
- package/docs/zh-CN/api.md +107 -0
- package/docs/zh-CN/architecture.md +33 -0
- package/docs/zh-CN/extensions.md +159 -0
- package/docs/zh-CN/getting-started.md +67 -0
- package/docs/zh-CN/integration.md +130 -0
- package/docs/zh-CN/modules.md +80 -0
- package/docs/zh-CN/performance.md +53 -0
- package/docs/zh-CN/plugin-packages.md +68 -0
- package/docs/zh-CN/styles.md +80 -0
- package/docs/zh-CN/syntax.md +352 -0
- package/examples/notes.tsx +18 -11
- package/examples/packages/paper-theme/index.css +25 -0
- package/examples/packages/paper-theme/package.json +7 -0
- package/examples/packages/reading-tools/index.d.ts +2 -0
- package/examples/packages/reading-tools/index.js +25 -0
- package/examples/packages/reading-tools/package.json +16 -0
- package/package.json +9 -5
- package/skills/limr-plugin-development/SKILL.md +22 -0
- package/skills/limr-plugin-development/agents/openai.yaml +4 -0
- package/skills/limr-plugin-development/assets/plugin-template/README.md +30 -0
- package/skills/limr-plugin-development/assets/plugin-template/package.json +36 -0
- package/skills/limr-plugin-development/assets/plugin-template/src/index.tsx +50 -0
- package/skills/limr-plugin-development/assets/plugin-template/src/styles.css +9 -0
- package/skills/limr-plugin-development/assets/plugin-template/tsconfig.json +20 -0
- package/skills/limr-plugin-development/assets/plugin-template/tsup.config.ts +8 -0
- package/skills/limr-plugin-development/references/contract.md +45 -0
- package/skills/limr-use/SKILL.md +23 -0
- package/skills/limr-use/agents/openai.yaml +4 -0
- package/skills/limr-use/references/integration.md +41 -0
- package/skills/limr-use/references/syntax.md +17 -0
- package/dist/chunk-65V5OZ4G.js.map +0 -1
- package/dist/chunk-ETHLPBKQ.js.map +0 -1
|
@@ -19,17 +19,17 @@ import {
|
|
|
19
19
|
useSelection,
|
|
20
20
|
useStoreSelector,
|
|
21
21
|
useTheme
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3ILUZKDB.js";
|
|
23
23
|
import {
|
|
24
|
+
annotationReferenceRange,
|
|
24
25
|
defaultHighlight,
|
|
25
26
|
intersects,
|
|
26
27
|
mapText,
|
|
27
28
|
rangeOf,
|
|
28
29
|
resolveAnnotationAnchors,
|
|
29
30
|
sameRange,
|
|
30
|
-
selectionFromRange
|
|
31
|
-
|
|
32
|
-
} from "./chunk-7JF5HHVF.js";
|
|
31
|
+
selectionFromRange
|
|
32
|
+
} from "./chunk-TTISGBST.js";
|
|
33
33
|
|
|
34
34
|
// src/components/Reader.tsx
|
|
35
35
|
import { useEffect as useEffect7, useId as useId2, useRef as useRef5, useState as useState5 } from "react";
|
|
@@ -236,39 +236,29 @@ function AnnotationGroup({ occurrence, presentation, expanded = true, enabled =
|
|
|
236
236
|
|
|
237
237
|
// src/components/annotation-reference.ts
|
|
238
238
|
function annotationReferenceText(document2, occurrence) {
|
|
239
|
-
const
|
|
239
|
+
const referenceRange = annotationReferenceRange(document2, occurrence);
|
|
240
|
+
const blocks = document2.blocks.filter((block) => intersects(block.range, referenceRange));
|
|
240
241
|
let reference = "";
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
node.
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const mapping = mapText(document2.source, node.value, range);
|
|
256
|
-
reference += node.value.split("").filter((_, index) => mapping.ends[index] > occurrence.range.start && mapping.starts[index] < occurrence.range.end).join("");
|
|
257
|
-
} else if (node.type === "image") reference += String(node.alt ?? "");
|
|
258
|
-
else node.children?.forEach(visit);
|
|
259
|
-
};
|
|
260
|
-
blocks.forEach((block, index) => {
|
|
261
|
-
if (index) reference += " ";
|
|
262
|
-
visit(block.node);
|
|
263
|
-
});
|
|
264
|
-
reference ||= occurrence.quote ?? document2.source.slice(occurrence.range.start, occurrence.range.end);
|
|
265
|
-
}
|
|
242
|
+
const visit = (node) => {
|
|
243
|
+
const range = rangeOf(node);
|
|
244
|
+
if (!intersects(range, referenceRange) || ["annotationReference", "footnoteReference", "annotationDefinition", "definition"].includes(node.type)) return;
|
|
245
|
+
if (node.value !== void 0) {
|
|
246
|
+
const mapping = mapText(document2.source, node.value, range);
|
|
247
|
+
reference += node.value.split("").filter((_, index) => mapping.ends[index] > referenceRange.start && mapping.starts[index] < referenceRange.end).join("");
|
|
248
|
+
} else if (node.type === "image") reference += String(node.alt ?? "");
|
|
249
|
+
else node.children?.forEach(visit);
|
|
250
|
+
};
|
|
251
|
+
blocks.forEach((block, index) => {
|
|
252
|
+
if (index) reference += " ";
|
|
253
|
+
visit(block.node);
|
|
254
|
+
});
|
|
255
|
+
if (!occurrence.embedded) reference ||= occurrence.quote ?? document2.source.slice(referenceRange.start, referenceRange.end);
|
|
266
256
|
return reference.replace(/\s+/g, " ").trim();
|
|
267
257
|
}
|
|
268
258
|
|
|
269
259
|
// src/components/AnnotationSidebar.tsx
|
|
270
260
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
271
|
-
var alignSidebar = (items, { activeId, gap, height }) => {
|
|
261
|
+
var alignSidebar = (items, { activeId, gap, height, prioritizeActive }) => {
|
|
272
262
|
const positions = items.map((item) => item.anchorTop);
|
|
273
263
|
const activeIndex = items.findIndex((item) => item.id === activeId);
|
|
274
264
|
const pivot = activeIndex < 0 ? 0 : activeIndex;
|
|
@@ -277,8 +267,9 @@ var alignSidebar = (items, { activeId, gap, height }) => {
|
|
|
277
267
|
for (let i = pivot - 1; i >= 0; i--) positions[i] = Math.min(items[i].anchorTop, positions[i + 1] - items[i].height - gap);
|
|
278
268
|
for (let i = pivot + 1; i < items.length; i++) positions[i] = Math.max(items[i].anchorTop, positions[i - 1] + items[i - 1].height + gap);
|
|
279
269
|
if (height !== void 0 && items.reduce((sum, item) => sum + item.height, gap * (items.length - 1)) <= height) {
|
|
280
|
-
|
|
281
|
-
for (let i =
|
|
270
|
+
const start = prioritizeActive && activeIndex >= 0 ? pivot + 1 : 0;
|
|
271
|
+
for (let i = items.length - 1; i >= start; i--) positions[i] = Math.min(positions[i], (i === items.length - 1 ? height : positions[i + 1] - gap) - items[i].height);
|
|
272
|
+
if (start || activeIndex < 0 || positions[0] >= 0) for (let i = start; i < items.length; i++) positions[i] = Math.max(positions[i], i === 0 ? 0 : positions[i - 1] + items[i - 1].height + gap);
|
|
282
273
|
}
|
|
283
274
|
return new Map(items.map((item, index) => [item.id, positions[index]]));
|
|
284
275
|
};
|
|
@@ -298,12 +289,16 @@ function AnnotationSidebar({ sync = "document", gap = 14, positioner = alignSide
|
|
|
298
289
|
const rail = useRef2(null);
|
|
299
290
|
const cards = useRef2(/* @__PURE__ */ new Map());
|
|
300
291
|
const [sizes, setSizes] = useState2(/* @__PURE__ */ new Map());
|
|
292
|
+
const [minimumSizes, setMinimumSizes] = useState2(/* @__PURE__ */ new Map());
|
|
301
293
|
const [anchorTops, setAnchorTops] = useState2(/* @__PURE__ */ new Map());
|
|
302
294
|
const [railHeight, setRailHeight] = useState2(0);
|
|
303
|
-
const measured = useRef2({ sizes: /* @__PURE__ */ new Map(), height: 0 });
|
|
295
|
+
const measured = useRef2({ sizes: /* @__PURE__ */ new Map(), minimum: /* @__PURE__ */ new Map(), height: 0 });
|
|
304
296
|
const resizeFrame = useRef2(0);
|
|
305
297
|
const [viewportTop, setViewportTop] = useState2(0);
|
|
298
|
+
const [viewportHeight, setViewportHeight] = useState2(0);
|
|
306
299
|
const [cardLock, setCardLock] = useState2(null);
|
|
300
|
+
const lastFocus = useRef2(null);
|
|
301
|
+
const [release, setRelease] = useState2(null);
|
|
307
302
|
const occurrences = useMemo(() => {
|
|
308
303
|
const values = [...decorations.occurrences].sort((a, b) => a.range.start - b.range.start || a.range.end - b.range.end || a.id.localeCompare(b.id));
|
|
309
304
|
if (sync === "none") {
|
|
@@ -318,13 +313,20 @@ function AnnotationSidebar({ sync = "document", gap = 14, positioner = alignSide
|
|
|
318
313
|
})])), [decorations, occurrences]);
|
|
319
314
|
const measure = useCallback((beforePaint = false) => {
|
|
320
315
|
const next = /* @__PURE__ */ new Map();
|
|
321
|
-
|
|
316
|
+
const minimum = /* @__PURE__ */ new Map();
|
|
317
|
+
cards.current.forEach((element2, id) => {
|
|
318
|
+
const height2 = element2.getBoundingClientRect().height;
|
|
319
|
+
next.set(id, height2);
|
|
320
|
+
const panels = [...element2.querySelectorAll(":scope > .limr-sidebar-card-body > .limr-collapse")];
|
|
321
|
+
minimum.set(id, height2 - panels.reduce((sum, panel) => sum + panel.getBoundingClientRect().height, 0));
|
|
322
|
+
});
|
|
322
323
|
const height = rail.current?.getBoundingClientRect().height ?? 0;
|
|
323
324
|
const old = measured.current;
|
|
324
|
-
if (old.height === height && old.sizes.size === next.size && [...next].every(([id, size2]) => size2 === old.sizes.get(id))) return;
|
|
325
|
-
measured.current = { sizes: next, height };
|
|
325
|
+
if (old.height === height && old.sizes.size === next.size && [...next].every(([id, size2]) => size2 === old.sizes.get(id) && Math.abs(minimum.get(id) - (old.minimum.get(id) ?? 0)) < 0.5)) return;
|
|
326
|
+
measured.current = { sizes: next, minimum, height };
|
|
326
327
|
const update = () => {
|
|
327
328
|
setSizes(next);
|
|
329
|
+
setMinimumSizes(minimum);
|
|
328
330
|
setRailHeight(height);
|
|
329
331
|
};
|
|
330
332
|
if (!beforePaint) {
|
|
@@ -357,13 +359,19 @@ function AnnotationSidebar({ sync = "document", gap = 14, positioner = alignSide
|
|
|
357
359
|
for (const occurrence of occurrences) {
|
|
358
360
|
const marker = runtime.anchors.get(occurrence.id);
|
|
359
361
|
if (!marker || marker.closest("[inert]")) continue;
|
|
360
|
-
const rect =
|
|
362
|
+
const rect = sourceRangeStartRect(runtime, decorations.referenceRanges.get(occurrence.id) ?? occurrence.range);
|
|
361
363
|
values.set(occurrence.id, (rect || marker.getBoundingClientRect()).top - top - displacement2);
|
|
362
364
|
}
|
|
363
365
|
setAnchorTops((old) => old.size === values.size && [...values].every(([id, value]) => Math.abs(value - (old.get(id) ?? -Infinity)) < 0.5) ? old : values);
|
|
364
|
-
}, [runtime, occurrences, layout, sync]);
|
|
366
|
+
}, [runtime, decorations.referenceRanges, occurrences, layout, sync]);
|
|
365
367
|
useIsomorphicLayoutEffect(() => {
|
|
366
|
-
if (sync
|
|
368
|
+
if (sync !== "document" || !rail.current) return;
|
|
369
|
+
const root = runtime.configuration.get().scrollRoot;
|
|
370
|
+
const bounds = rail.current.getBoundingClientRect();
|
|
371
|
+
const top = Math.max(bounds.top, runtime.getViewportTop() + (root?.clientTop ?? 0), window.visualViewport?.offsetTop ?? 0);
|
|
372
|
+
const bottom = Math.min(bounds.bottom, root ? runtime.getViewportTop() + root.clientTop + root.clientHeight : Infinity, (window.visualViewport?.offsetTop ?? 0) + (window.visualViewport?.height ?? innerHeight));
|
|
373
|
+
setViewportTop(Math.max(0, top - bounds.top + (runtime.configuration.get().scrollOffset ?? 24)));
|
|
374
|
+
setViewportHeight(Math.max(0, bottom - top));
|
|
367
375
|
}, [runtime, layout, viewport, sync]);
|
|
368
376
|
useEffect4(() => {
|
|
369
377
|
const dismiss = (event) => {
|
|
@@ -395,15 +403,52 @@ function AnnotationSidebar({ sync = "document", gap = 14, positioner = alignSide
|
|
|
395
403
|
if (sync !== "none") items.sort((a, b) => (anchorTops.get(a.id) ?? 0) - (anchorTops.get(b.id) ?? 0));
|
|
396
404
|
const readingId = items.find((item) => (anchorTops.get(item.id) ?? 0) >= viewportTop)?.id ?? items.at(-1)?.id ?? null;
|
|
397
405
|
const alignmentId = hovered ?? active ?? readingId;
|
|
406
|
+
const focusedId = hovered ?? active;
|
|
398
407
|
const source = hovered ? hoverSource : active ? activeSource : null;
|
|
399
408
|
const locked = source === "sidebar" && cardLock?.id === alignmentId ? cardLock : null;
|
|
409
|
+
const lockedTop = locked?.top;
|
|
410
|
+
useIsomorphicLayoutEffect(() => {
|
|
411
|
+
const previous = lastFocus.current;
|
|
412
|
+
lastFocus.current = focusedId ? { id: focusedId, top: lockedTop } : null;
|
|
413
|
+
if (focusedId || sync !== "document" || !rail.current || matchMedia("(prefers-reduced-motion: reduce)").matches) {
|
|
414
|
+
setRelease(null);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
if (!previous) return;
|
|
418
|
+
const style2 = getComputedStyle(rail.current), value = style2.getPropertyValue("--limr-motion-slow").trim();
|
|
419
|
+
const milliseconds = parseFloat(value) * (value.endsWith("ms") ? 1 : 1e3);
|
|
420
|
+
const duration = Number.isFinite(milliseconds) ? Math.max(0, milliseconds) : 460;
|
|
421
|
+
if (!duration) {
|
|
422
|
+
setRelease(null);
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const motion = rail.current.animate([{}, {}], { duration, easing: style2.getPropertyValue("--limr-ease").trim() || "ease-out" });
|
|
426
|
+
setRelease({ ...previous, progress: 0 });
|
|
427
|
+
let frame = 0;
|
|
428
|
+
const step = () => {
|
|
429
|
+
if (motion.playState === "finished") {
|
|
430
|
+
setRelease(null);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
setRelease({ ...previous, progress: motion.effect?.getComputedTiming().progress ?? 0 });
|
|
434
|
+
frame = requestAnimationFrame(step);
|
|
435
|
+
};
|
|
436
|
+
frame = requestAnimationFrame(step);
|
|
437
|
+
return () => {
|
|
438
|
+
cancelAnimationFrame(frame);
|
|
439
|
+
motion.cancel();
|
|
440
|
+
};
|
|
441
|
+
}, [focusedId, lockedTop, sync]);
|
|
400
442
|
const sidebarItems = items.map((item) => ({ id: item.id, anchorTop: anchorTops.get(item.id) ?? 0, height: sizes.get(item.id) ?? 80 }));
|
|
401
|
-
const positionContext = { activeId: alignmentId, gap, height: sync === "document" && railHeight > 0 ? railHeight : void 0 };
|
|
402
|
-
const positions = positioner(locked ? sidebarItems.map((item) => item.id === locked.id ? { ...item, anchorTop: locked.top } : item) : sidebarItems, positionContext);
|
|
443
|
+
const positionContext = { activeId: alignmentId, gap, height: sync === "document" && railHeight > 0 ? railHeight : void 0, prioritizeActive: !!(hovered || active) };
|
|
444
|
+
const positions = new Map(positioner(locked ? sidebarItems.map((item) => item.id === locked.id ? { ...item, anchorTop: locked.top } : item) : sidebarItems, positionContext));
|
|
445
|
+
const releasing = !focusedId && release;
|
|
446
|
+
if (releasing) {
|
|
447
|
+
const origin = positioner(sidebarItems.map((item) => item.id === releasing.id && releasing.top !== void 0 ? { ...item, anchorTop: releasing.top } : item), { ...positionContext, activeId: releasing.id, prioritizeActive: true });
|
|
448
|
+
for (const [id, top] of positions) positions.set(id, top + ((origin.get(id) ?? top) - top) * (1 - releasing.progress));
|
|
449
|
+
}
|
|
403
450
|
const lockedAnchor = locked ? anchorTops.get(locked.id) ?? locked.top : 0;
|
|
404
|
-
const
|
|
405
|
-
const lockFits = locked && (positions.get(locked.id) ?? locked.top) >= locked.top - 0.5;
|
|
406
|
-
const displacement = sync === "document" && locked && anchorFits && lockFits ? (positions.get(locked.id) ?? locked.top) - lockedAnchor : 0;
|
|
451
|
+
const displacement = sync === "document" && locked ? (positions.get(locked.id) ?? locked.top) - lockedAnchor : 0;
|
|
407
452
|
useIsomorphicLayoutEffect(() => {
|
|
408
453
|
if (sync === "document") runtime.documentOffset.set(displacement);
|
|
409
454
|
}, [runtime, displacement, sync]);
|
|
@@ -413,17 +458,17 @@ function AnnotationSidebar({ sync = "document", gap = 14, positioner = alignSide
|
|
|
413
458
|
if (card && rail.current) {
|
|
414
459
|
const origin = rail.current.getBoundingClientRect().top;
|
|
415
460
|
const top = card.getBoundingClientRect().top - origin;
|
|
416
|
-
|
|
417
|
-
const boundedTop = positioner(sidebarItems, { ...positionContext, activeId: id }).get(id) ?? anchorTop;
|
|
418
|
-
setCardLock({ id, top: boundedTop < anchorTop - 0.5 ? anchorTop : top });
|
|
461
|
+
setCardLock({ id, top });
|
|
419
462
|
}
|
|
420
463
|
};
|
|
421
|
-
return /* @__PURE__ */ jsx3("aside", { ref: rail, "aria-label": locale.annotations, className: `limr-sidebar ${className ?? ""}`, "data-sync": sync, "data-limr-theme": theme, "data-limr-appearance": appearance, style, children: items.map((occurrence) => {
|
|
464
|
+
return /* @__PURE__ */ jsx3("aside", { ref: rail, "aria-label": locale.annotations, className: `limr-sidebar ${className ?? ""}`, "data-sync": sync, "data-releasing": releasing ? "" : void 0, "data-limr-theme": theme, "data-limr-appearance": appearance, style, children: items.map((occurrence) => {
|
|
422
465
|
const annotation = decorations.annotations.get(occurrence.annotationIds[0]);
|
|
423
466
|
const definition = runtime.annotationTypes.get(annotation?.type ?? "citation");
|
|
424
467
|
const isActive = active === occurrence.id;
|
|
425
468
|
const palette = definition?.sidebar;
|
|
426
469
|
const Preview = palette?.Preview;
|
|
470
|
+
const available = source === "marker" && alignmentId === occurrence.id && !isActive ? Math.max(minimumSizes.get(occurrence.id) ?? 80, railHeight - (anchorTops.get(occurrence.id) ?? 0)) : railHeight;
|
|
471
|
+
const cardHeight = isActive ? Math.min(available, Math.max(minimumSizes.get(occurrence.id) ?? 80, viewportHeight || railHeight)) : available;
|
|
427
472
|
const cardStyle = {
|
|
428
473
|
"--limr-annotation-color": palette?.color ?? definition?.color,
|
|
429
474
|
"--limr-annotation-border": palette?.borderColor,
|
|
@@ -436,7 +481,7 @@ function AnnotationSidebar({ sync = "document", gap = 14, positioner = alignSide
|
|
|
436
481
|
position: "absolute",
|
|
437
482
|
top: positions.get(occurrence.id) ?? 0,
|
|
438
483
|
insetInline: 0,
|
|
439
|
-
"--limr-sidebar-card-height": `${
|
|
484
|
+
"--limr-sidebar-card-height": `${cardHeight}px`
|
|
440
485
|
} : { marginBlockEnd: gap }
|
|
441
486
|
};
|
|
442
487
|
const collapseOnContentClick = occurrence.annotationIds.every((id) => runtime.annotationTypes.get(decorations.annotations.get(id)?.type ?? "")?.sidebar?.collapseOnContentClick);
|
|
@@ -1190,4 +1235,4 @@ export {
|
|
|
1190
1235
|
SelectionToolbar,
|
|
1191
1236
|
Reader
|
|
1192
1237
|
};
|
|
1193
|
-
//# sourceMappingURL=chunk-
|
|
1238
|
+
//# sourceMappingURL=chunk-N77VD2YR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Reader.tsx","../src/components/TableOfContents.tsx","../src/react/overflow-fade.ts","../src/components/AnnotationSidebar.tsx","../src/components/AnnotationContent.tsx","../src/components/annotation-reference.ts","../src/components/AnnotationOverlay.tsx","../src/components/card-motion.ts","../src/components/SelectionToolbar.tsx"],"sourcesContent":["import { useEffect, useId, useRef, useState, type CSSProperties } from 'react';\nimport { useAppearance, DocumentProvider, useIsomorphicLayoutEffect, useLocale, useRuntime, useStoreSelector, useTheme, type DocumentProviderProps } from '../react/context';\nimport { Markdown } from '../react/Markdown';\nimport type { SelectionAction, StyledProps } from '../react/types';\nimport { TableOfContents } from './TableOfContents';\nimport { AnnotationSidebar } from './AnnotationSidebar';\nimport { AnnotationOverlay } from './AnnotationOverlay';\nimport { SelectionToolbar } from './SelectionToolbar';\nimport { Collapse } from './Collapse';\nimport { useOverflowFade } from '../react/overflow-fade';\n\nexport interface ReaderProps extends Omit<DocumentProviderProps, 'children'>, StyledProps {\n actions?: readonly SelectionAction[];\n toc?: boolean;\n sidebar?: boolean;\n followOutput?: boolean;\n sidebarBreakpoint?: number;\n /** Fill unused viewport height without deriving the layout from annotations. */\n fillHeight?: boolean;\n}\nexport function Reader({ actions, toc = true, sidebar = true, followOutput = false, sidebarBreakpoint = 1120, fillHeight = true, className, style, ...provider }: ReaderProps) {\n return <DocumentProvider {...provider}><ReaderLayout actions={actions} toc={toc} sidebar={sidebar} followOutput={followOutput} sidebarBreakpoint={sidebarBreakpoint} fillHeight={fillHeight} className={className} style={style} /></DocumentProvider>;\n}\nfunction ReaderLayout({ actions, toc, sidebar, followOutput, sidebarBreakpoint, fillHeight, className, style }: Pick<ReaderProps, 'actions' | 'toc' | 'sidebar' | 'followOutput' | 'className' | 'style' | 'fillHeight'> & { sidebarBreakpoint: number }) {\n const runtime = useRuntime();\n const scrollRoot = useStoreSelector(runtime.configuration, config => config.scrollRoot);\n const layout = useStoreSelector(runtime.layout, value => value);\n const appearance = useAppearance();\n const theme = useTheme();\n const ref = useRef<HTMLDivElement>(null);\n const tocRail = useRef<HTMLDivElement>(null);\n const content = useRef<HTMLElement>(null);\n useOverflowFade(content, runtime, ':scope > .limr-prose');\n const [width, setWidth] = useState(0);\n const [availableHeight, setAvailableHeight] = useState(0);\n useIsomorphicLayoutEffect(() => {\n if (!fillHeight || !ref.current) return;\n // Use the origin in scroll coordinates. Scrolling must not grow/shrink the\n // reading canvas and feed back into the page's scroll range.\n const origin = ref.current.getBoundingClientRect().top - runtime.getViewportTop() - (scrollRoot?.clientTop ?? 0) + runtime.getScrollTop();\n setAvailableHeight(Math.max(0, (scrollRoot?.clientHeight ?? window.innerHeight) - origin));\n }, [runtime, scrollRoot, fillHeight, layout, width]);\n useEffect(() => {\n const element = ref.current;\n if (!element) return;\n const observer = new ResizeObserver(() => { setWidth(element.clientWidth); runtime.requestLayout(); });\n observer.observe(element);\n if (scrollRoot) observer.observe(scrollRoot);\n if (element.parentElement) observer.observe(element.parentElement);\n setWidth(element.clientWidth);\n return () => observer.disconnect();\n }, [runtime, scrollRoot, sidebarBreakpoint]);\n useIsomorphicLayoutEffect(() => {\n const rail = tocRail.current;\n if (!rail) return;\n let frame = 0;\n const measure = () => {\n frame = 0;\n if (!rail.clientWidth) return;\n const viewport = window.visualViewport;\n let top = viewport?.offsetTop ?? 0, bottom = top + (viewport?.height ?? window.innerHeight);\n if (scrollRoot) {\n const origin = scrollRoot.getBoundingClientRect().top + scrollRoot.clientTop;\n top = Math.max(top, origin); bottom = Math.min(bottom, origin + scrollRoot.clientHeight);\n }\n const reader = ref.current!.getBoundingClientRect();\n // A reader that has left the viewport must not cover the next reader.\n rail.toggleAttribute('inert', reader.bottom <= top || reader.top >= bottom);\n const height = `${Math.max(0, bottom - Math.max(top, rail.getBoundingClientRect().top)).toFixed(2)}px`;\n if (rail.style.getPropertyValue('--limr-toc-available-height') !== height) rail.style.setProperty('--limr-toc-available-height', height);\n };\n const schedule = () => { if (!frame) frame = requestAnimationFrame(measure); };\n const unsubscribe = [runtime.layout.subscribe(schedule), runtime.viewport.subscribe(schedule)];\n window.addEventListener('scroll', schedule, { passive: true });\n window.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('scroll', schedule);\n measure();\n return () => {\n cancelAnimationFrame(frame); unsubscribe.forEach(fn => fn());\n window.removeEventListener('scroll', schedule); window.removeEventListener('resize', schedule);\n window.visualViewport?.removeEventListener('resize', schedule); window.visualViewport?.removeEventListener('scroll', schedule);\n rail.removeAttribute('inert'); rail.style.removeProperty('--limr-toc-available-height');\n };\n }, [runtime, scrollRoot, toc]);\n const sidebarVisible = !!sidebar && width >= sidebarBreakpoint;\n return <div ref={ref} className={`limr-reader ${className ?? ''}`} style={{ '--limr-reader-available-height': fillHeight ? `${availableHeight}px` : undefined, ...style } as CSSProperties} data-fill-height={fillHeight || undefined} data-sidebar={sidebarVisible || undefined} data-toc={toc && width >= 800 || undefined} data-limr-theme={theme} data-limr-appearance={appearance}>\n {toc && <><div ref={tocRail} className=\"limr-reader-toc\"><TableOfContents /></div><MobileContents /></>}\n <main ref={content} className=\"limr-reader-content\"><Markdown followOutput={followOutput} /></main>\n {sidebarVisible && <AnnotationSidebar />}\n <AnnotationOverlay disabled={sidebarVisible} />\n <SelectionToolbar actions={actions} />\n </div>;\n}\n\nfunction MobileContents() {\n const locale = useLocale();\n const [open, setOpen] = useState(false);\n const id = useId();\n return <div className=\"limr-reader-mobile-toc\">\n <button type=\"button\" className=\"limr-mobile-toc-toggle\" aria-expanded={open} aria-controls={id} onClick={() => setOpen(value => !value)}>\n <span>{locale.contents}</span><svg viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\"><path d=\"m6 8 4 4 4-4\" /></svg>\n </button>\n <div id={id}><Collapse open={open} keepMounted><TableOfContents /></Collapse></div>\n </div>;\n}\n","import { useEffect, useRef } from 'react';\nimport { useAppearance, useDocumentSelector, useLocale, useRuntime, useStoreSelector, useTheme } from '../react/context';\nimport type { StyledProps } from '../react/types';\nimport { scrollWithMotion } from '../react/motion';\nimport { useOverflowFade } from '../react/overflow-fade';\n\nexport interface TableOfContentsProps extends StyledProps { title?: string; maxDepth?: number; followActive?: boolean; topInset?: number; updateHash?: boolean }\nexport function TableOfContents({ title, maxDepth = 6, followActive = true, topInset = 24, updateHash = false, className, style }: TableOfContentsProps) {\n const runtime = useRuntime();\n const appearance = useAppearance();\n const theme = useTheme(), locale = useLocale();\n const headings = useDocumentSelector(doc => doc.headings);\n useStoreSelector(runtime.layout, value => value);\n const active = useStoreSelector(runtime.interaction, state => state.activeHeading);\n const list = useRef<HTMLDivElement>(null);\n useOverflowFade(list, runtime, ':scope > ol');\n const manualUntil = useRef(0);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const visible = headings.filter(heading => heading.level <= maxDepth && !runtime.headings.get(heading.id)?.closest('[inert]'));\n visible.sort((a, b) => {\n const left = runtime.headings.get(a.id), right = runtime.headings.get(b.id);\n return left && right && left !== right ? left.compareDocumentPosition(right) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1 : 0;\n });\n const minimum = Math.min(...visible.map(heading => heading.level), 6);\n useEffect(() => {\n if (!followActive || !active) return;\n const follow = () => {\n const container = list.current;\n if (!container || container.clientHeight === 0) return;\n const element = Array.from(container.querySelectorAll<HTMLElement>('[data-heading]')).find(item => item.dataset.heading === active);\n if (!element) return;\n const top = element.getBoundingClientRect().top - container.getBoundingClientRect().top + container.scrollTop - topInset;\n const target = Math.max(0, Math.min(top, container.scrollHeight - container.clientHeight));\n if (Math.abs(target - container.scrollTop) > 1) scrollWithMotion(container, target);\n };\n const delay = Math.max(0, manualUntil.current - Date.now());\n timer.current = setTimeout(follow, delay);\n return () => clearTimeout(timer.current);\n }, [active, headings, followActive, topInset]);\n const manual = () => { manualUntil.current = Date.now() + 1200; clearTimeout(timer.current); };\n return <nav className={`limr-toc ${className ?? ''}`} style={style} data-limr-theme={theme} data-limr-appearance={appearance} aria-label={title ?? locale.contents}>\n <div className=\"limr-toc-title\">{title ?? locale.contents}</div>\n <div className=\"limr-toc-scroll\" ref={list} onWheel={manual} onTouchStart={manual} onKeyDown={manual} tabIndex={0}>\n <ol>{visible.map(heading => <li key={heading.id}><a data-heading={heading.id} href={`#${heading.id}`} aria-current={heading.id === active ? 'location' : undefined}\n style={{ paddingInlineStart: 12 + Math.min(heading.level - minimum, 4) * 14 }}\n onClick={event => { event.preventDefault(); runtime.scrollToHeading(heading.id); if (updateHash) history.replaceState(history.state, '', `#${heading.id}`); }}><span className=\"limr-underline\">{heading.text}</span></a></li>)}</ol>\n </div>\n </nav>;\n}\n","import { useEffect, type RefObject } from 'react';\nimport type { ReaderRuntime } from './runtime';\n\n/** Follow actual clipping edges, including a nested viewport and in-flight\n * document/card motion. Masks never reserve space or change scroll geometry. */\nexport function useOverflowFade(ref: RefObject<HTMLElement | null>, runtime: ReaderRuntime, contentSelector: string, beforeMeasure?: () => void) {\n useEffect(() => {\n const host = ref.current;\n if (!host) return;\n let frame = 0, transitions = 0;\n const measure = () => {\n frame = 0;\n // Constraint-driven cards must finish positioning with this frame's\n // heights before clipping is tested. Even a transient mask toggle can\n // invalidate the composited layer while a footer card grows upward.\n beforeMeasure?.();\n const box = host.getBoundingClientRect();\n const viewport = window.visualViewport;\n let top = Math.max(box.top, viewport?.offsetTop ?? 0);\n let bottom = Math.min(box.bottom, (viewport?.offsetTop ?? 0) + (viewport?.height ?? innerHeight));\n const root = runtime.configuration.get().scrollRoot;\n if (root) { const bounds = root.getBoundingClientRect(); top = Math.max(top, bounds.top + root.clientTop); bottom = Math.min(bottom, bounds.top + root.clientTop + root.clientHeight); }\n const contents = [...host.querySelectorAll<HTMLElement>(contentSelector)].map(element => element.getBoundingClientRect());\n const clipsTop = bottom > top && contents.some(rect => rect.top < top - .5);\n const clipsBottom = bottom > top && contents.some(rect => rect.bottom > bottom + .5);\n host.toggleAttribute('data-overflow-top', clipsTop);\n host.toggleAttribute('data-overflow-bottom', clipsBottom);\n const set = (name: string, value: number) => { const css = `${Math.max(0, value).toFixed(2)}px`; if (host.style.getPropertyValue(name) !== css) host.style.setProperty(name, css); };\n set('--limr-fade-start', top - box.top);\n set('--limr-fade-end', bottom - box.top);\n if (transitions && host.getAnimations({ subtree: true }).some(animation => animation.playState === 'running')) schedule();\n else transitions = 0;\n };\n const schedule = () => { if (!frame) frame = requestAnimationFrame(measure); };\n const refresh = () => { cancelAnimationFrame(frame); measure(); };\n const start = () => { transitions++; schedule(); };\n const end = () => { transitions = Math.max(0, transitions - 1); schedule(); };\n host.addEventListener('transitionrun', start);\n host.addEventListener('transitionend', end);\n host.addEventListener('transitioncancel', end);\n const resize = new ResizeObserver(refresh); resize.observe(host);\n const mutation = new MutationObserver(records => {\n // ResizeObserver can synchronously reposition growing sidebar cards.\n // Read that committed geometry before paint, not on the next frame after\n // their CSS heights have advanced again and outrun the stored positions.\n if (records.some(record => {\n const element = record.target instanceof Element ? record.target : record.target.parentElement;\n return element && element !== host && !element.closest('.limr-highlight-layer,.limr-paint-layer');\n })) refresh();\n });\n mutation.observe(host, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ['style', 'class'] });\n const unsubscribe = [runtime.layout.subscribe(schedule), runtime.viewport.subscribe(refresh), runtime.documentOffset.subscribe(schedule), runtime.configuration.subscribe(schedule)];\n const scroll = (event: Event) => {\n const target = event.target;\n if (target === window.document || target === window || target instanceof Element && target.contains(host)) refresh();\n };\n // Capture nested scrolling directly; routing it through the runtime's frame\n // notification and then another rAF makes a viewport-fixed fade trail text.\n window.addEventListener('scroll', scroll, { capture: true, passive: true });\n window.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('resize', schedule);\n window.visualViewport?.addEventListener('scroll', refresh);\n schedule();\n return () => {\n cancelAnimationFrame(frame); resize.disconnect(); mutation.disconnect(); unsubscribe.forEach(fn => fn());\n host.removeEventListener('transitionrun', start); host.removeEventListener('transitionend', end); host.removeEventListener('transitioncancel', end);\n window.removeEventListener('scroll', scroll, true); window.removeEventListener('resize', schedule);\n window.visualViewport?.removeEventListener('resize', schedule); window.visualViewport?.removeEventListener('scroll', refresh);\n host.removeAttribute('data-overflow-top'); host.removeAttribute('data-overflow-bottom');\n host.style.removeProperty('--limr-fade-start'); host.style.removeProperty('--limr-fade-end');\n };\n }, [ref, runtime, contentSelector, beforeMeasure]);\n}\n","import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type CSSProperties, type ReactNode } from 'react';\nimport { flushSync } from 'react-dom';\nimport { useAppearance, useDocument, useIsomorphicLayoutEffect, useLocale, useRuntime, useStoreSelector, useTheme } from '../react/context';\nimport type { AnnotationOccurrence } from '../core';\nimport type { StyledProps } from '../react/types';\nimport { AnnotationGroup } from './AnnotationContent';\nimport { Collapse } from './Collapse';\nimport { annotationReferenceText } from './annotation-reference';\nimport { sourceRangeStartRect } from '../react/source-geometry';\nimport { useOverflowFade } from '../react/overflow-fade';\n\n/** anchorTop is the first referenced text line, falling back to the marker. */\nexport interface SidebarItem { id: string; anchorTop: number; height: number }\nexport type SidebarPositioner = (items: readonly SidebarItem[], context: { activeId: string | null; gap: number; height?: number; prioritizeActive?: boolean }) => ReadonlyMap<string, number>;\nexport const alignSidebar: SidebarPositioner = (items, { activeId, gap, height, prioritizeActive }) => {\n const positions = items.map(item => item.anchorTop);\n const activeIndex = items.findIndex(item => item.id === activeId);\n const pivot = activeIndex < 0 ? 0 : activeIndex;\n if (!items.length) return new Map();\n positions[pivot] = height === undefined ? items[pivot].anchorTop : Math.max(0, Math.min(items[pivot].anchorTop, height - items[pivot].height));\n for (let i = pivot - 1; i >= 0; i--) positions[i] = Math.min(items[i].anchorTop, positions[i + 1] - items[i].height - gap);\n // Earlier cards may move above the clipped rail. Keeping them above zero\n // would push a late active card away from its anchor in a short document.\n for (let i = pivot + 1; i < items.length; i++) positions[i] = Math.max(items[i].anchorTop, positions[i - 1] + items[i - 1].height + gap);\n if (height !== undefined && items.reduce((sum, item) => sum + item.height, gap * (items.length - 1)) <= height) {\n // With enough total room, borrow unused space above the final cards.\n // Earlier cards intentionally clipped by the focused pivot must stay there:\n // restoring the top boundary would push that card away from its reference.\n const start = prioritizeActive && activeIndex >= 0 ? pivot + 1 : 0;\n for (let i = items.length - 1; i >= start; i--) positions[i] = Math.min(positions[i], (i === items.length - 1 ? height : positions[i + 1] - gap) - items[i].height);\n if (start || activeIndex < 0 || positions[0] >= 0) for (let i = start; i < items.length; i++) positions[i] = Math.max(positions[i], i === 0 ? 0 : positions[i - 1] + items[i - 1].height + gap);\n }\n return new Map(items.map((item, index) => [item.id, positions[index]]));\n};\n\nexport interface AnnotationSidebarProps extends StyledProps {\n sync?: 'document' | 'none';\n gap?: number;\n positioner?: SidebarPositioner;\n renderCard?: (props: { occurrence: AnnotationOccurrence; active: boolean; activate: () => void }) => ReactNode;\n}\nexport function AnnotationSidebar({ sync = 'document', gap = 14, positioner = alignSidebar, renderCard, className, style }: AnnotationSidebarProps) {\n const runtime = useRuntime();\n const document = useDocument();\n const appearance = useAppearance();\n const theme = useTheme(), locale = useLocale();\n const decorations = useStoreSelector(runtime.decorations, value => value);\n const active = useStoreSelector(runtime.interaction, state => state.active);\n const hovered = useStoreSelector(runtime.interaction, state => state.hovered);\n const hoverSource = useStoreSelector(runtime.interaction, state => state.hoverSource);\n const activeSource = useStoreSelector(runtime.interaction, state => state.activeSource);\n useSyncExternalStore(runtime.configuration.subscribe, runtime.configuration.get, runtime.configuration.get);\n const layout = useSyncExternalStore(runtime.layout.subscribe, runtime.layout.get, runtime.layout.get);\n const viewport = useSyncExternalStore(runtime.viewport.subscribe, runtime.viewport.get, runtime.viewport.get);\n const rail = useRef<HTMLElement>(null);\n const cards = useRef(new Map<string, HTMLDivElement>());\n const [sizes, setSizes] = useState<Map<string, number>>(new Map());\n const [minimumSizes, setMinimumSizes] = useState<Map<string, number>>(new Map());\n const [anchorTops, setAnchorTops] = useState<Map<string, number>>(new Map());\n const [railHeight, setRailHeight] = useState(0);\n const measured = useRef({ sizes: new Map<string, number>(), minimum: new Map<string, number>(), height: 0 });\n const resizeFrame = useRef(0);\n const [viewportTop, setViewportTop] = useState(0);\n const [viewportHeight, setViewportHeight] = useState(0);\n const [cardLock, setCardLock] = useState<{ id: string; top: number } | null>(null);\n const lastFocus = useRef<{ id: string; top?: number } | null>(null);\n const [release, setRelease] = useState<{ id: string; top?: number; progress: number } | null>(null);\n const occurrences = useMemo(() => {\n const values = [...decorations.occurrences].sort((a, b) => a.range.start - b.range.start || a.range.end - b.range.end || a.id.localeCompare(b.id));\n if (sync === 'none') for (const annotation of decorations.annotations.values()) if (annotation.type !== 'highlight' && !values.some(item => item.annotationIds.includes(annotation.id))) values.push({ id: `unanchored-${annotation.id}`, range: { start: 0, end: 0 }, annotationIds: [annotation.id] });\n return values;\n }, [decorations, sync]);\n const references = useMemo(() => new Map(occurrences.map(occurrence => [occurrence.id, annotationReferenceText(document, occurrence)])), [document, occurrences]);\n const annotationGroups = useMemo(() => new Map(occurrences.map(occurrence => [occurrence.id, occurrence.annotationIds.flatMap(id => { const annotation = decorations.annotations.get(id); return annotation ? [annotation] : []; })])), [decorations, occurrences]);\n const measure = useCallback((beforePaint = false) => {\n const next = new Map<string, number>();\n const minimum = new Map<string, number>();\n cards.current.forEach((element, id) => {\n const height = element.getBoundingClientRect().height;\n next.set(id, height);\n const panels = [...element.querySelectorAll<HTMLElement>(':scope > .limr-sidebar-card-body > .limr-collapse')];\n minimum.set(id, height - panels.reduce((sum, panel) => sum + panel.getBoundingClientRect().height, 0));\n });\n // Keep the rail and card bounds in the same subpixel coordinate system.\n // Rounded clientHeight can put a bottom-aligned card outside the mask.\n const height = rail.current?.getBoundingClientRect().height ?? 0;\n const old = measured.current;\n if (old.height === height && old.sizes.size === next.size && [...next].every(([id, size]) => size === old.sizes.get(id) && Math.abs(minimum.get(id)! - (old.minimum.get(id) ?? 0)) < .5)) return;\n measured.current = { sizes: next, minimum, height };\n const update = () => { setSizes(next); setMinimumSizes(minimum); setRailHeight(height); };\n if (!beforePaint) { update(); return; }\n // The heights already contain the collapse animation's easing. Applying a\n // second top transition makes neighbors chase them and overlap the card.\n const element = rail.current;\n element?.setAttribute('data-resizing', '');\n flushSync(update);\n cancelAnimationFrame(resizeFrame.current);\n resizeFrame.current = requestAnimationFrame(() => {\n resizeFrame.current = requestAnimationFrame(() => element?.removeAttribute('data-resizing'));\n });\n }, []);\n const prepareFade = useCallback(() => measure(true), [measure]);\n useOverflowFade(rail, runtime, ':scope > .limr-sidebar-card', prepareFade);\n useEffect(() => {\n const observer = new ResizeObserver(() => measure(true));\n if (rail.current) observer.observe(rail.current);\n cards.current.forEach(element => observer.observe(element));\n measure();\n return () => observer.disconnect();\n }, [occurrences, measure, anchorTops]);\n useEffect(() => () => cancelAnimationFrame(resizeFrame.current), []);\n useIsomorphicLayoutEffect(() => {\n if (sync === 'none' || !rail.current) return;\n const top = rail.current.getBoundingClientRect().top;\n const values = new Map<string, number>();\n const displacement = runtime.getContentOffset();\n for (const occurrence of occurrences) {\n const marker = runtime.anchors.get(occurrence.id);\n if (!marker || marker.closest('[inert]')) continue;\n const rect = sourceRangeStartRect(runtime, decorations.referenceRanges.get(occurrence.id) ?? occurrence.range);\n values.set(occurrence.id, (rect || marker.getBoundingClientRect()).top - top - displacement);\n }\n setAnchorTops(old => old.size === values.size && [...values].every(([id, value]) => Math.abs(value - (old.get(id) ?? -Infinity)) < .5) ? old : values);\n }, [runtime, decorations.referenceRanges, occurrences, layout, sync]);\n useIsomorphicLayoutEffect(() => {\n if (sync !== 'document' || !rail.current) return;\n const root = runtime.configuration.get().scrollRoot;\n const bounds = rail.current.getBoundingClientRect();\n const top = Math.max(bounds.top, runtime.getViewportTop() + (root?.clientTop ?? 0), window.visualViewport?.offsetTop ?? 0);\n const bottom = Math.min(bounds.bottom, root ? runtime.getViewportTop() + root.clientTop + root.clientHeight : Infinity, (window.visualViewport?.offsetTop ?? 0) + (window.visualViewport?.height ?? innerHeight));\n setViewportTop(Math.max(0, top - bounds.top + (runtime.configuration.get().scrollOffset ?? 24)));\n setViewportHeight(Math.max(0, bottom - top));\n }, [runtime, layout, viewport, sync]);\n useEffect(() => {\n const dismiss = (event: PointerEvent) => {\n if (event.button !== 0) return;\n const target = event.target;\n if (!(target instanceof Element)) return;\n const card = target.closest('.limr-sidebar-card');\n const marker = target.closest<HTMLElement>('[data-limr-anchor]');\n if ((card && rail.current?.contains(card)) || (marker && runtime.anchors.get(marker.dataset.limrAnchor!) === marker)) return;\n // Floating module UI and selection actions keep their own dismissal rules.\n if (target.closest('.limr-overlay-positioner,.limr-selection-toolbar')) return;\n const { active, hovered } = runtime.interaction.get();\n if (active || hovered) runtime.activate(null);\n };\n const escape = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented || !runtime.interaction.get().active) return;\n const anchor = runtime.anchors.get(runtime.interaction.get().active!);\n anchor?.focus({ preventScroll: true });\n runtime.activate(null);\n };\n window.document.addEventListener('pointerdown', dismiss);\n window.document.addEventListener('keydown', escape);\n return () => { window.document.removeEventListener('pointerdown', dismiss); window.document.removeEventListener('keydown', escape); if (sync === 'document') runtime.documentOffset.set(0); };\n }, [runtime, sync]);\n const items = occurrences.filter(item => sync === 'none' || anchorTops.has(item.id));\n // Extensions may present source subtrees in another order (e.g. translation\n // before original). Aligned cards follow their rendered anchors.\n if (sync !== 'none') items.sort((a, b) => (anchorTops.get(a.id) ?? 0) - (anchorTops.get(b.id) ?? 0));\n const readingId = items.find(item => (anchorTops.get(item.id) ?? 0) >= viewportTop)?.id ?? items.at(-1)?.id ?? null;\n const alignmentId = hovered ?? active ?? readingId;\n const focusedId = hovered ?? active;\n const source = hovered ? hoverSource : active ? activeSource : null;\n const locked = source === 'sidebar' && cardLock?.id === alignmentId ? cardLock : null;\n const lockedTop = locked?.top;\n useIsomorphicLayoutEffect(() => {\n const previous = lastFocus.current;\n lastFocus.current = focusedId ? { id: focusedId, top: lockedTop } : null;\n if (focusedId || sync !== 'document' || !rail.current || matchMedia('(prefers-reduced-motion: reduce)').matches) { setRelease(null); return; }\n if (!previous) return;\n const style = getComputedStyle(rail.current), value = style.getPropertyValue('--limr-motion-slow').trim();\n const milliseconds = parseFloat(value) * (value.endsWith('ms') ? 1 : 1000);\n const duration = Number.isFinite(milliseconds) ? Math.max(0, milliseconds) : 460;\n if (!duration) { setRelease(null); return; }\n // Use the skin's timing as a clock. Interpolate two layouts computed with\n // the SAME current card heights, so collapse and repacking share an easing\n // without a second CSS top transition making neighbors collide.\n const motion = rail.current.animate([{}, {}], { duration, easing: style.getPropertyValue('--limr-ease').trim() || 'ease-out' });\n setRelease({ ...previous, progress: 0 });\n let frame = 0;\n const step = () => {\n if (motion.playState === 'finished') { setRelease(null); return; }\n setRelease({ ...previous, progress: motion.effect?.getComputedTiming().progress ?? 0 });\n frame = requestAnimationFrame(step);\n };\n frame = requestAnimationFrame(step);\n return () => { cancelAnimationFrame(frame); motion.cancel(); };\n }, [focusedId, lockedTop, sync]);\n const sidebarItems = items.map(item => ({ id: item.id, anchorTop: anchorTops.get(item.id) ?? 0, height: sizes.get(item.id) ?? 80 }));\n const positionContext = { activeId: alignmentId, gap, height: sync === 'document' && railHeight > 0 ? railHeight : undefined, prioritizeActive: !!(hovered || active) };\n const positions = new Map(positioner(locked ? sidebarItems.map(item => item.id === locked.id ? { ...item, anchorTop: locked.top } : item) : sidebarItems, positionContext));\n const releasing = !focusedId && release;\n if (releasing) {\n const origin = positioner(sidebarItems.map(item => item.id === releasing.id && releasing.top !== undefined ? { ...item, anchorTop: releasing.top } : item), { ...positionContext, activeId: releasing.id, prioritizeActive: true });\n for (const [id, top] of positions) positions.set(id, top + ((origin.get(id) ?? top) - top) * (1 - releasing.progress));\n }\n const lockedAnchor = locked ? anchorTops.get(locked.id) ?? locked.top : 0;\n // Footer packing must not disable reverse alignment. Keep the hovered card\n // under the pointer and move its referenced text, even at the rail boundary.\n const displacement = sync === 'document' && locked ? (positions.get(locked.id) ?? locked.top) - lockedAnchor : 0;\n useIsomorphicLayoutEffect(() => { if (sync === 'document') runtime.documentOffset.set(displacement); }, [runtime, displacement, sync]);\n const lockCard = (id: string) => {\n // Keep the original resting position while this card is hovered or active.\n // Relocking its boundary-raised top would prevent a collapse from moving\n // back down, then jump when pointer leave releases the new lock.\n if (locked?.id === id) return;\n const card = cards.current.get(id);\n if (card && rail.current) {\n const origin = rail.current.getBoundingClientRect().top;\n const top = card.getBoundingClientRect().top - origin;\n setCardLock({ id, top });\n }\n };\n return <aside ref={rail} aria-label={locale.annotations} className={`limr-sidebar ${className ?? ''}`} data-sync={sync} data-releasing={releasing ? '' : undefined} data-limr-theme={theme} data-limr-appearance={appearance} style={style}>\n {items.map(occurrence => {\n const annotation = decorations.annotations.get(occurrence.annotationIds[0]);\n const definition = runtime.annotationTypes.get(annotation?.type ?? 'citation');\n const isActive = active === occurrence.id;\n const palette = definition?.sidebar;\n const Preview = palette?.Preview;\n // A marker at the end of the article can align its collapsed card by\n // giving the reference/title priority over the optional summary. Expanded\n // content is bounded by the viewport and scrolls inside the card.\n const available = source === 'marker' && alignmentId === occurrence.id && !isActive\n ? Math.max(minimumSizes.get(occurrence.id) ?? 80, railHeight - (anchorTops.get(occurrence.id) ?? 0)) : railHeight;\n const cardHeight = isActive ? Math.min(available, Math.max(minimumSizes.get(occurrence.id) ?? 80, viewportHeight || railHeight)) : available;\n const cardStyle = {\n '--limr-annotation-color': palette?.color ?? definition?.color,\n '--limr-annotation-border': palette?.borderColor,\n '--limr-annotation-title': palette?.titleColor,\n '--limr-annotation-text': palette?.textColor,\n '--limr-annotation-excerpt': palette?.excerptColor,\n '--limr-annotation-preview': palette?.previewColor,\n '--limr-sidebar-preview-lines': String(Math.max(1, Math.floor(palette?.previewLines ?? 2))),\n ...(sync === 'document' ? {\n position: 'absolute', top: positions.get(occurrence.id) ?? 0, insetInline: 0,\n '--limr-sidebar-card-height': `${cardHeight}px`,\n } : { marginBlockEnd: gap }),\n } as CSSProperties & { [token: `--${string}`]: string | undefined };\n // A mixed card must not dismiss a conversation because a citation opted in.\n const collapseOnContentClick = occurrence.annotationIds.every(id => runtime.annotationTypes.get(decorations.annotations.get(id)?.type ?? '')?.sidebar?.collapseOnContentClick);\n const activate = () => {\n const hovering = runtime.interaction.get().hovered === occurrence.id || cards.current.get(occurrence.id)?.matches(':hover');\n lockCard(occurrence.id);\n runtime.activate(isActive ? null : occurrence.id, 'sidebar');\n // Activation clears marker hover; the pointer is still inside this card.\n if (hovering) runtime.hover(occurrence.id, 'sidebar');\n };\n return <div key={occurrence.id} ref={element => { if (element) cards.current.set(occurrence.id, element); else cards.current.delete(occurrence.id); }}\n className=\"limr-sidebar-card\" data-type={annotation?.type} data-locked={locked?.id === occurrence.id || undefined} data-active={isActive || hovered === occurrence.id || undefined} data-expanded={isActive || undefined} data-default-card={!renderCard || undefined} data-content-toggle={collapseOnContentClick || undefined} data-citations={occurrence.annotationIds.every(id => decorations.annotations.get(id)?.type === 'citation') || undefined} data-occurrence={occurrence.id}\n style={cardStyle}\n onPointerEnter={event => { if (event.pointerType !== 'touch') { lockCard(occurrence.id); runtime.hover(occurrence.id, 'sidebar'); } }} onPointerLeave={() => { if (runtime.interaction.get().hovered === occurrence.id && runtime.interaction.get().hoverSource === 'sidebar') runtime.hover(null); }}\n onClick={event => {\n if ((!isActive || collapseOnContentClick) && !renderCard && !event.defaultPrevented && !(event.target as Element).closest('button,a,input,select,textarea,summary,[role=\"button\"],[role=\"link\"],[contenteditable=\"true\"],[data-limr-card-interactive]') && window.getSelection()?.isCollapsed !== false) activate();\n }}>\n {renderCard ? renderCard({ occurrence, active: isActive, activate }) : <>\n {references.get(occurrence.id) && <div className=\"limr-sidebar-reference\" title={references.get(occurrence.id)}><p className=\"limr-sidebar-excerpt\">{references.get(occurrence.id)}</p></div>}\n <div className=\"limr-sidebar-card-body\">\n <button type=\"button\" className=\"limr-sidebar-card-heading\" onClick={activate} aria-expanded={isActive}>{definition?.label ?? annotation?.type ?? 'Reference'}<span className=\"limr-sidebar-toggle\"><span key={String(isActive)} className=\"limr-button-label limr-underline\">{isActive ? locale.collapse : locale.expand}</span></span></button>\n {Preview && annotation && <Collapse open={!isActive} keepMounted className=\"limr-sidebar-preview-panel\"><div className=\"limr-sidebar-preview\"><Preview annotation={annotation} data={annotation.data} occurrence={occurrence} annotations={annotationGroups.get(occurrence.id)!} referenceText={references.get(occurrence.id) ?? ''} /></div></Collapse>}\n <Collapse open={isActive} className=\"limr-sidebar-expansion\"><div className=\"limr-sidebar-card-content\"><AnnotationGroup occurrence={occurrence} presentation=\"sidebar\" enabled={isActive} /></div></Collapse>\n </div>\n </>}\n </div>;\n })}\n </aside>;\n}\n","import { useEffect, useState } from 'react';\nimport { useRuntime, useStoreSelector } from '../react/context';\nimport type { Annotation, AnnotationOccurrence } from '../core';\nimport type { AnnotationPresentation } from '../react/types';\n\nexport function AnnotationContent({ annotationId, presentation, expanded = true, enabled = true }: { annotationId: string; presentation: AnnotationPresentation; expanded?: boolean; enabled?: boolean }) {\n const runtime = useRuntime();\n const annotation = useStoreSelector(runtime.decorations, state => state.annotations.get(annotationId));\n const editing = useStoreSelector(runtime.interaction, state => state.editing === annotationId);\n const definition = useStoreSelector(runtime.configuration, () => runtime.annotationTypes.get(annotation?.type ?? 'citation'));\n const version = useStoreSelector(runtime.resourceVersions, versions => versions.get(annotationId) ?? 0);\n const [loaded, setLoaded] = useState<{ id: string; data?: unknown; loading: boolean; error: Error | null }>({ id: annotationId, loading: !!definition?.load, error: null });\n useEffect(() => {\n if (!definition?.load || !annotation || !enabled) return;\n let disposed = false;\n setLoaded({ id: annotationId, loading: true, error: null });\n const request = runtime.resources.acquire(runtime.getResourceKey(annotation), signal => definition.load!(annotation, { signal }));\n request.promise.then(data => { if (!disposed) setLoaded({ id: annotationId, data, loading: false, error: null }); }).catch(error => { if (!disposed) setLoaded({ id: annotationId, loading: false, error: error instanceof Error ? error : new Error(String(error)) }); });\n return () => { disposed = true; request.release(); };\n }, [runtime, annotation, annotationId, definition, version, enabled]);\n const retry = () => runtime.invalidateAnnotation(annotationId);\n const Content = definition?.Content;\n const current = loaded.id === annotationId ? loaded : { loading: !!definition?.load, error: null, data: undefined };\n if (!annotation) return <span className=\"limr-muted\">{runtime.locale.unavailable} · {annotationId}</span>;\n if (!Content) return <span className=\"limr-muted\">{runtime.locale.unavailable} · {annotation.type}</span>;\n return <Content editing={editing} annotation={annotation} data={definition?.load ? current.data ?? annotation.data : annotation.data} loading={definition?.load ? current.loading : false} error={current.error} retry={retry} presentation={presentation} expanded={expanded} />;\n}\n\nexport function AnnotationGroup({ occurrence, presentation, expanded = true, enabled = true }: { occurrence: AnnotationOccurrence; presentation: AnnotationPresentation; expanded?: boolean; enabled?: boolean }) {\n return <>{occurrence.annotationIds.map(id => <div key={id} className=\"limr-annotation-entry\"><AnnotationContent annotationId={id} presentation={presentation} expanded={expanded} enabled={enabled} /></div>)}</>;\n}\n","import { annotationReferenceRange, mapText, type AnnotationOccurrence, type DocumentSnapshot, type MarkdownNode } from '../core';\nimport { intersects, rangeOf } from '../core/tree';\n\n/** Render the anchored text, without exposing Markdown syntax or <ref> tags. */\nexport function annotationReferenceText(document: DocumentSnapshot, occurrence: AnnotationOccurrence): string {\n const referenceRange = annotationReferenceRange(document, occurrence);\n const blocks = document.blocks.filter(block => intersects(block.range, referenceRange));\n let reference = '';\n const visit = (node: MarkdownNode) => {\n const range = rangeOf(node);\n if (!intersects(range, referenceRange) || ['annotationReference', 'footnoteReference', 'annotationDefinition', 'definition'].includes(node.type)) return;\n if (node.value !== undefined) {\n const mapping = mapText(document.source, node.value, range);\n reference += node.value.split('').filter((_, index) => mapping.ends[index] > referenceRange.start && mapping.starts[index] < referenceRange.end).join('');\n } else if (node.type === 'image') reference += String(node.alt ?? '');\n else node.children?.forEach(visit);\n };\n blocks.forEach((block, index) => { if (index) reference += ' '; visit(block.node); });\n if (!occurrence.embedded) reference ||= occurrence.quote ?? document.source.slice(referenceRange.start, referenceRange.end);\n return reference.replace(/\\s+/g, ' ').trim();\n}\n","import { useEffect, useState, useSyncExternalStore, type CSSProperties } from 'react';\nimport { autoUpdate, flip, FloatingFocusManager, FloatingOverlay, FloatingPortal, offset, shift, size, useDismiss, useFloating, useInteractions, useRole } from '@floating-ui/react';\nimport { useAppearance, useIsomorphicLayoutEffect, useLocale, useRuntime, useStoreSelector, useTheme } from '../react/context';\nimport { AnnotationGroup } from './AnnotationContent';\nimport { useCardMotion } from './card-motion';\nimport { AnnotationCard } from './AnnotationCard';\nimport type { AnnotationOccurrence } from '../core';\nimport type { AnnotationOverlayCardProps } from '../react/types';\n\nexport interface AnnotationOverlayProps { disabled?: boolean; portalRoot?: HTMLElement | null; previewWidth?: number; maxHeight?: string }\nconst length = (value: number | string) => typeof value === 'number' ? `${value}px` : value;\nconst idleSubscribe = () => () => {};\nexport function AnnotationOverlay({ disabled = false, portalRoot, previewWidth = 340, maxHeight = '80dvh' }: AnnotationOverlayProps) {\n const runtime = useRuntime();\n const appearance = useAppearance();\n const theme = useTheme(), locale = useLocale();\n const editing = useStoreSelector(runtime.interaction, state => state.editing);\n const active = useStoreSelector(runtime.interaction, state => state.active);\n const hovered = useStoreSelector(runtime.interaction, state => state.hovered);\n const occurrences = useStoreSelector(runtime.decorations, state => state.occurrences);\n useSyncExternalStore(runtime.layout.subscribe, runtime.layout.get, runtime.layout.get);\n const [preview, setPreview] = useState<string | null>(null);\n const [collapsedId, setCollapsedId] = useState<string | null>(null);\n const [, setViewportTick] = useState(0);\n useEffect(() => {\n if (active || disabled) { setPreview(null); return; }\n if (hovered) { setPreview(hovered); return; }\n const timer = setTimeout(() => setPreview(null), 90);\n return () => clearTimeout(timer);\n }, [hovered, active, disabled]);\n useEffect(() => {\n const update = () => setViewportTick(value => value + 1);\n window.visualViewport?.addEventListener('resize', update);\n window.visualViewport?.addEventListener('scroll', update);\n window.addEventListener('resize', update);\n return () => { window.visualViewport?.removeEventListener('resize', update); window.visualViewport?.removeEventListener('scroll', update); window.removeEventListener('resize', update); };\n }, []);\n const wantedId = active ?? preview;\n const wanted = occurrences.find(item => item.id === wantedId);\n const [retained, setRetained] = useState<AnnotationOccurrence | null>(null);\n const occurrence = wanted ?? retained;\n const id = occurrence?.id;\n const annotation = useStoreSelector(runtime.decorations, state => state.annotations.get(occurrence?.annotationIds[0] ?? ''));\n const definition = useStoreSelector(runtime.configuration, () => runtime.annotationTypes.get(annotation?.type ?? 'citation'));\n const policy = definition?.overlay?.expand;\n const expansion = typeof policy === 'function' ? annotation && policy(annotation) : policy;\n const pinned = active === id;\n const expanded = pinned && !!expansion && collapsedId !== id;\n const [lastExpanded, setLastExpanded] = useState(false);\n const [lastPinned, setLastPinned] = useState(false);\n const open = !!wanted && !disabled;\n useSyncExternalStore(open ? runtime.viewport.subscribe : idleSubscribe, runtime.viewport.get, runtime.viewport.get);\n useEffect(() => {\n if (open) { setRetained(wanted!); setLastExpanded(expanded); setLastPinned(pinned); }\n }, [wanted, open, expanded, pinned]);\n const close = () => {\n const anchor = id ? runtime.anchors.get(id) : null;\n anchor?.focus({ preventScroll: true });\n runtime.activate(null); runtime.hover(null); setPreview(null);\n };\n const anchor = id ? runtime.anchors.get(id) : undefined;\n const [previewGeometry, setPreviewGeometry] = useState<{ id?: string; rect: DOMRect; placement: string } | null>(null);\n const fromPreview = previewGeometry?.id === id ? previewGeometry : null;\n const requestedExpanded = open ? expanded : lastExpanded;\n // Even a toolbar/touch opening first measures the real module preview at\n // its anchor. It stays hidden for this layout pass, and is never duplicated.\n const measuringPreview = open && requestedExpanded && !fromPreview;\n const shownExpanded = requestedExpanded && !measuringPreview;\n const shownPinned = open ? pinned : lastPinned;\n const centered = shownExpanded && expansion && expansion.placement === 'center';\n const anchoredExpansion = shownExpanded && !centered && fromPreview;\n const { refs, update, floatingStyles, context, isPositioned, placement, middlewareData } = useFloating({ open, elements: { reference: anchor ?? null }, onOpenChange: next => { if (!next) close(); }, strategy: 'fixed', transform: false, placement: 'bottom-start', whileElementsMounted: autoUpdate, middleware: [offset(8), flip({ padding: 12 }), shift({ padding: 12 }), size({ padding: 12, apply: ({ availableHeight, elements }) => {\n if (!shownExpanded) elements.floating.style.maxHeight = `${Math.max(0, Math.floor(Math.min(360, availableHeight)))}px`;\n else if (!centered && !fromPreview) elements.floating.style.maxHeight = `min(${length(expansion && expansion.maxHeight || maxHeight)}, ${Math.max(0, Math.floor(availableHeight))}px)`;\n } }, [shownExpanded, !!centered, !!fromPreview, expansion && expansion.maxHeight, maxHeight]), {\n name: 'limrAnchor',\n options: shownExpanded,\n fn: ({ elements }) => ({ data: { id: (elements.reference as HTMLElement).dataset?.limrAnchor, expanded: shownExpanded } }),\n }] });\n useIsomorphicLayoutEffect(() => {\n // A retained surface never remounts when an exit is reversed. Floating UI\n // resets isPositioned on close, so explicitly remeasure that same surface.\n if (open && anchor) update();\n }, [anchor, update, open, shownExpanded]);\n const dismiss = useDismiss(context, { escapeKey: true, outsidePress: true });\n const role = useRole(context, { role: 'dialog' });\n const { getFloatingProps } = useInteractions([dismiss, role]);\n const ready = !!centered || !!anchoredExpansion || !open || isPositioned && middlewareData.limrAnchor?.id === id && middlewareData.limrAnchor?.expanded === shownExpanded;\n const [surface, setSurface] = useState<HTMLDivElement | null>(null);\n const edge = (shownExpanded ? fromPreview?.placement ?? 'bottom' : placement).startsWith('top') ? 'bottom' : 'top';\n useCardMotion(surface, refs.floating.current, anchor, open, shownExpanded, ready && !measuringPreview, id, edge, fromPreview?.rect, () => { setRetained(null); setCollapsedId(null); setPreviewGeometry(null); });\n useIsomorphicLayoutEffect(() => {\n if (!shownExpanded && open && ready && refs.floating.current) {\n const rect = refs.floating.current.getBoundingClientRect();\n if (!fromPreview || fromPreview.placement !== placement || (['x', 'y', 'width', 'height'] as const).some(key => Math.abs(rect[key] - fromPreview.rect[key]) > .5)) setPreviewGeometry({ id, rect, placement });\n }\n });\n if (!occurrence || disabled) return null;\n const visual = window.visualViewport;\n const viewLeft = visual?.offsetLeft ?? 0, viewTop = visual?.offsetTop ?? 0;\n const availableWidth = visual?.width ?? window.innerWidth, availableHeight = visual?.height ?? window.innerHeight;\n // Portalled dialogs belong to the whole visible page, including when the\n // reader lives in an offset column or a nested scroll container.\n const top = viewTop + 12;\n const bottom = viewTop + availableHeight - 12;\n const heightLimit = Math.max(0, bottom - top);\n const settings = shownExpanded && expansion ? expansion : undefined;\n const width = `min(${length(settings?.width ?? (centered ? 640 : definition?.overlay?.previewWidth ?? previewWidth))}, ${Math.max(0, availableWidth - 24)}px)`;\n let style: CSSProperties = { ...floatingStyles, width, maxHeight: Math.min(360, availableHeight - 24) };\n if (settings) {\n style = { ...style, height: settings.height === undefined ? undefined : `min(${length(settings.height)}, ${heightLimit}px)`, maxHeight: `min(${length(settings.maxHeight ?? maxHeight)}, ${heightLimit}px)` };\n if (centered) style = { ...style, left: viewLeft + availableWidth / 2, top: viewTop + availableHeight / 2, transform: 'translate(-50%, -50%)' };\n else if (fromPreview) {\n const upward = fromPreview.placement.startsWith('top');\n const room = Math.max(0, upward ? fromPreview.rect.bottom - top : bottom - fromPreview.rect.top);\n style = { ...style, left: fromPreview.rect.left, top: upward ? fromPreview.rect.bottom : fromPreview.rect.top, transform: upward ? 'translateY(-100%)' : 'none', maxWidth: viewLeft + availableWidth - 12 - fromPreview.rect.left, maxHeight: `min(${length(settings.maxHeight ?? maxHeight)}, ${room}px)` };\n }\n }\n const Card = definition?.overlay?.Card;\n const cardProps: AnnotationOverlayCardProps = {\n annotation: annotation ?? { id: occurrence.annotationIds[0], type: 'unknown' }, occurrence,\n presentation: shownExpanded ? 'expanded' : 'preview', expanded: shownExpanded, pinned: shownPinned,\n canExpand: !!expansion,\n expand: () => { setCollapsedId(null); runtime.activate(occurrence.id); },\n collapse: () => { setCollapsedId(occurrence.id); runtime.activate(occurrence.id); },\n close,\n children: <AnnotationGroup occurrence={occurrence} presentation={shownExpanded ? 'expanded' : 'preview'} expanded={shownExpanded} />,\n };\n const modal = open && !!centered;\n const card = <FloatingFocusManager context={context} modal={modal} disabled={!open || !pinned || measuringPreview} initialFocus={editing ? -1 : refs.floating} returnFocus={false}>\n <div ref={refs.setFloating} {...getFloatingProps()} tabIndex={-1} aria-label={definition?.label ?? locale.annotations} className=\"limr-overlay-positioner\" style={{ ...style, pointerEvents: open ? 'auto' : 'none', visibility: ready && !measuringPreview ? 'visible' : 'hidden' }}>\n <div ref={setSurface} className={`limr-annotation-overlay ${shownExpanded ? 'limr-annotation-expanded' : 'limr-annotation-preview'}`} style={{ '--limr-annotation-color': definition?.color } as CSSProperties} data-type={annotation?.type} data-state={open ? 'open' : 'closing'} data-pinned={shownPinned || undefined} data-placement={centered ? 'center' : anchoredExpansion ? fromPreview.placement : placement} data-limr-theme={theme} data-limr-appearance={appearance}\n onPointerEnter={event => { if (!pinned && event.pointerType !== 'touch') runtime.hover(occurrence.id); }} onPointerLeave={() => { if (!pinned) runtime.hover(null); }}>\n <div className=\"limr-overlay-surface\" aria-hidden=\"true\" />\n <div className=\"limr-overlay-card\">{Card && annotation ? <Card {...cardProps} /> : <AnnotationCard {...cardProps} title={definition?.label ?? annotation?.type ?? locale.annotations} />}</div>\n </div>\n </div>\n </FloatingFocusManager>;\n return <FloatingPortal root={portalRoot}><FloatingOverlay className=\"limr-backdrop\" data-expanded={modal || undefined} lockScroll={modal} style={{ pointerEvents: modal ? 'auto' : 'none' }}>{card}</FloatingOverlay></FloatingPortal>;\n}\n","import { useRef } from 'react';\nimport { useIsomorphicLayoutEffect } from '../react/context';\n\nconst moving = (animation: Animation | null) => animation?.playState === 'running' || animation?.playState === 'paused';\nconst durationOf = (value: string, fallback: number) => {\n const duration = parseFloat(value) * (value.endsWith('ms') ? 1 : 1000);\n return Number.isFinite(duration) && duration > 0 ? duration : fallback;\n};\n/** Measure a stationary host, and animate its surface from the live frame.\n * Each direction starts a fresh easing curve: reversing an ease-out entrance would\n * otherwise leave the card apparently motionless at the start of its exit. */\nexport function useCardMotion(element: HTMLElement | null, host: HTMLElement | null, anchor: HTMLElement | undefined, open: boolean, expanded: boolean, ready: boolean, id: string | undefined, edge: 'top' | 'bottom', previewRect: DOMRect | undefined, onExit: () => void) {\n const previous = useRef<DOMRect | null>(null);\n const reveal = useRef<Animation | null>(null);\n const content = useRef<Animation | null>(null);\n const hero = useRef<Animation | null>(null);\n const shape = useRef<Animation | null>(null);\n const state = useRef<{ id?: string; expanded: boolean; open: boolean } | null>(null);\n const latest = useRef({ open, onExit });\n latest.current = { open, onExit };\n useIsomorphicLayoutEffect(() => {\n if (!element || !host || !ready) return;\n const sameCard = state.current?.id === id;\n const presentationChanged = sameCard && state.current?.expanded !== expanded;\n const intentChanged = !sameCard || state.current?.open !== open || presentationChanged;\n const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;\n if (!intentChanged && !reduced) return;\n const computed = getComputedStyle(element);\n const shell = element.querySelector<HTMLElement>('.limr-overlay-surface');\n const card = element.querySelector<HTMLElement>('.limr-overlay-card');\n const previousBody = sameCard ? (content.current?.effect as KeyframeEffect | null)?.target as HTMLElement | null : null;\n const body = presentationChanged || expanded ? card : previousBody?.isConnected ? previousBody : element.querySelector<HTMLElement>('[data-limr-card-body], .limr-overlay-content');\n const bodyStyle = body ? getComputedStyle(body) : null;\n // Snapshot before cancelling any effects; interruption never jumps to an\n // endpoint, even during a preview-to-dialog morph or an unfinished exit.\n const liveSurface = { opacity: computed.opacity, clipPath: computed.clipPath };\n const liveTransform = computed.transform;\n const liveBody = { opacity: bodyStyle?.opacity ?? '1', transform: bodyStyle?.transform ?? 'none', clipPath: bodyStyle?.clipPath ?? 'none' };\n let before = sameCard ? previous.current : expanded ? previewRect ?? null : null;\n // React has moved the host; apply the live transform to its OLD rectangle.\n if (before && sameCard && hero.current && computed.transform !== 'none') {\n const matrix = new DOMMatrixReadOnly(computed.transform);\n before = new DOMRect(before.x + matrix.m41, before.y + matrix.m42, before.width, before.height);\n }\n if (before && sameCard && shell && shape.current) {\n const matrix = new DOMMatrixReadOnly(getComputedStyle(shell).transform);\n before = new DOMRect(before.x, before.y, before.width * matrix.a, before.height * matrix.d);\n }\n const target = host.getBoundingClientRect();\n const anchorRect = anchor?.getBoundingClientRect() ?? target;\n const originX = Math.max(0, Math.min(100, ((anchorRect.left + anchorRect.right) / 2 - target.left) / Math.max(1, target.width) * 100));\n const radius = computed.borderRadius || '8px';\n const collapsed = `inset(${edge === 'bottom' ? 100 : 0}% ${100 - originX}% ${edge === 'bottom' ? 0 : 100}% ${originX}% round ${radius})`;\n // Leave room for the old, larger shell while it shrinks to a preview.\n const overflow = Math.max(48, (before?.width ?? 0) - target.width + 48, (before?.height ?? 0) - target.height + 48);\n const revealed = `inset(-${overflow}px -${overflow}px -${overflow}px -${overflow}px round ${radius})`;\n const cancel = () => {\n reveal.current?.cancel(); content.current?.cancel(); hero.current?.cancel(); shape.current?.cancel();\n reveal.current = content.current = hero.current = shape.current = null;\n };\n cancel();\n state.current = { id, expanded, open };\n previous.current = target;\n if (reduced || !open && !sameCard) {\n delete element.dataset.motion;\n if (!open) latest.current.onExit();\n return;\n }\n const previewDuration = durationOf((computed.getPropertyValue('--limr-overlay-duration') || computed.getPropertyValue('--limr-overlay-enter-duration')).trim(), 560);\n const morphDuration = durationOf(computed.getPropertyValue('--limr-overlay-morph-duration').trim(), 480);\n const morph = open && !!before && (presentationChanged || !sameCard && expanded);\n const returning = !open && expanded && !!previewRect;\n const destination = returning ? previewRect : target;\n const duration = morph || expanded ? morphDuration : previewDuration;\n const easing = computed.getPropertyValue('--limr-overlay-ease').trim() || 'cubic-bezier(.22,1,.36,1)';\n element.dataset.motion = !open ? 'closing' : morph ? 'morphing' : 'opening';\n reveal.current = element.animate([\n sameCard ? { ...liveSurface, ...(morph ? { clipPath: revealed } : {}) } : { opacity: 0, clipPath: morph ? revealed : collapsed },\n { opacity: open ? 1 : 0, clipPath: open || returning ? revealed : collapsed },\n ], { duration, easing, fill: 'both' });\n if (before && (morph || liveTransform !== 'none' || returning)) {\n const x = before.left - target.left, y = before.top - target.top;\n const sx = before.width / Math.max(1, target.width), sy = before.height / Math.max(1, target.height);\n hero.current = element.animate([\n { transform: `translate(${x}px, ${y}px)` },\n { transform: `translate(${destination.left - target.left}px, ${destination.top - target.top}px)` },\n ], { duration, easing, fill: 'both' });\n // Only the painted background changes scale. The entire module UI,\n // including titles, inputs and controls, retains its natural text metrics.\n shape.current = shell?.animate([\n { transform: `scale(${sx}, ${sy})` },\n { transform: `scale(${destination.width / Math.max(1, target.width)}, ${destination.height / Math.max(1, target.height)})` },\n ], { duration, easing, fill: 'both' }) ?? null;\n }\n const delay = open ? morph ? 50 : !sameCard ? 35 : 0 : 0;\n content.current = body?.animate([\n sameCard && !morph ? liveBody : { opacity: 0, transform: 'translateY(6px)', clipPath: morph ? `inset(0px ${Math.max(0, target.width - before!.width)}px ${Math.max(0, target.height - before!.height)}px 0px)` : 'inset(0px)' },\n { opacity: open ? 1 : 0, transform: open ? 'translateY(0px)' : 'translateY(-4px)', clipPath: returning ? `inset(0px ${Math.max(0, target.width - destination.width)}px ${Math.max(0, target.height - destination.height)}px 0px)` : 'inset(0px)' },\n ], {\n // Content and surface settle together in either direction.\n duration: duration - delay, delay, easing, fill: 'both',\n }) ?? null;\n const current = reveal.current;\n const finish = () => {\n if (reveal.current !== current) return;\n if (![reveal.current, content.current, hero.current, shape.current].some(moving)) {\n delete element.dataset.motion;\n if (!latest.current.open) latest.current.onExit();\n else previous.current = host.getBoundingClientRect();\n }\n };\n for (const animation of [reveal.current, content.current, hero.current, shape.current]) if (animation) animation.onfinish = finish;\n finish();\n }, [element, host, anchor, open, expanded, ready, id, edge, previewRect]);\n useIsomorphicLayoutEffect(() => {\n if (host && open && ready && !moving(hero.current)) previous.current = host.getBoundingClientRect();\n });\n useIsomorphicLayoutEffect(() => {\n if (!host || !open) return;\n const observer = new ResizeObserver(() => { if (!moving(hero.current)) previous.current = host.getBoundingClientRect(); });\n observer.observe(host);\n return () => observer.disconnect();\n }, [host, open, id]);\n useIsomorphicLayoutEffect(() => () => {\n reveal.current?.cancel(); content.current?.cancel(); hero.current?.cancel(); shape.current?.cancel();\n reveal.current = content.current = hero.current = shape.current = null;\n state.current = null; previous.current = null;\n if (element) delete element.dataset.motion;\n }, [element]);\n}\n","import { useEffect, useId, useMemo, useRef, useState, type CSSProperties, type ReactNode } from 'react';\nimport { autoUpdate, FloatingPortal, offset, shift, useFloating } from '@floating-ui/react';\nimport { defaultHighlight, resolveAnnotationAnchors, sameRange, selectionFromRange, type Annotation, type HighlightData } from '../core';\nimport { copyText, deleteAnnotations, highlightPalette, highlightSelection } from '../extensions/actions';\nimport { useAppearance, useRuntime, useSelection, useStoreSelector, useTheme } from '../react/context';\nimport type { ActionContext, SelectionAction, StyledProps, ToolbarActionContext } from '../react/types';\nimport { annotationReferenceText } from './annotation-reference';\nimport { OverlayScrollArea } from './OverlayScrollArea';\nimport { Collapse } from './Collapse';\n\nexport interface SelectionToolbarProps extends StyledProps {\n /** Replaces the built-in actions. Extension actions are added. */\n actions?: readonly SelectionAction[];\n portalRoot?: HTMLElement | null;\n /** Maximum panel body height in pixels; plugins inherit the available space. */\n maxPanelHeight?: number;\n render?: (props: { context: ActionContext; actions: readonly SelectionAction[]; run: (action: SelectionAction) => Promise<void> }) => ReactNode;\n}\nconst defaults = [highlightPalette(), highlightSelection(), copyText(), deleteAnnotations()];\n\nexport function SelectionToolbar({ actions, portalRoot, maxPanelHeight = 260, className = '', style, render }: SelectionToolbarProps) {\n const runtime = useRuntime();\n const appearance = useAppearance(), theme = useTheme();\n const selection = useSelection();\n const interaction = useStoreSelector(runtime.interaction, value => value);\n const decorations = useStoreSelector(runtime.decorations, value => value);\n const config = useStoreSelector(runtime.configuration, value => value);\n const paint = interaction.activeHighlight ? decorations.highlights.get(interaction.activeHighlight) : null;\n const active = decorations.occurrences.find(item => item.id === interaction.active);\n const hiddenActive = active && [...decorations.highlights.values()].some(item => item.hidden && sameRange(item.range, active.range));\n const combined = useMemo(() => {\n const map = new Map((actions ?? defaults).map(action => [action.id, action]));\n config.extensions?.forEach(extension => extension.actions?.forEach(action => map.set(action.id, action)));\n actions?.forEach(action => map.set(action.id, action));\n const order = (action: SelectionAction) => action.placement === 'start' ? -1 : action.placement === 'end' ? 1 : 0;\n return [...map.values()].sort((a, b) => order(a) - order(b));\n }, [config.extensions, actions]);\n const [busy, setBusy] = useState<string | null>(null);\n const busyRef = useRef(false);\n const [error, setError] = useState<string | null>(null);\n const [expanded, setExpanded] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n const [deleteHintOpen, setDeleteHintOpen] = useState(false);\n const [preferredHighlight, setPreferredHighlight] = useState<HighlightData>(defaultHighlight);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const successTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const panelId = useId();\n const documentSnapshot = runtime.document.getSnapshot();\n const effectiveSelection = useMemo(() => {\n if (selection) return selection;\n // Dismissed annotations can retain their edit state for later resumption.\n // Only the active annotation's editor suppresses highlight actions.\n if (interaction.editing && active?.annotationIds.includes(interaction.editing)) return null;\n const range = paint?.range ?? (hiddenActive ? active?.range : undefined);\n return range ? selectionFromRange(documentSnapshot, range, {\n text: paint ? runtime.highlightReference?.text ?? annotationReferenceText(documentSnapshot, { id: paint.id, annotationIds: [], range }) : annotationReferenceText(documentSnapshot, active!),\n }) : null;\n }, [documentSnapshot, paint, active, selection, interaction.editing, hiddenActive]);\n const annotations = useMemo(() => effectiveSelection ? [...decorations.annotations.values()].filter(annotation =>\n resolveAnnotationAnchors(annotation, documentSnapshot).some(anchor => [...effectiveSelection.raw.ranges, ...effectiveSelection.syntax.ranges].some(range => sameRange(anchor.range, range)))) : [], [decorations, effectiveSelection, documentSnapshot]);\n const highlight = (paint ? decorations.annotations.get(paint.annotationId) : annotations.find(annotation => annotation.type === 'highlight')) as Annotation<HighlightData> | undefined;\n const highlightAppearance = highlight?.data ?? preferredHighlight;\n const context: ActionContext | null = effectiveSelection ? {\n ...runtime.commands, selection: effectiveSelection, annotations, highlight: highlight ?? null, locale: runtime.locale,\n addAnnotation: (annotation, options) => runtime.commands.addAnnotation(annotation, { highlight: highlightAppearance, ...options }),\n document: documentSnapshot, signal: runtime.signal, clearSelection: () => runtime.clearSelection(),\n } : null;\n const available = context ? combined.filter(action => action.visible?.(context) ?? true) : [];\n const expandedAction = available.find(action => action.id === expanded && action.renderExpanded);\n const hasPanels = available.some(action => action.renderExpanded);\n const open = !!context && effectiveSelection!.settled && available.length > 0;\n const { refs, floatingStyles, placement, isPositioned } = useFloating({\n open, strategy: 'fixed', placement: 'bottom',\n middleware: [offset(10), { name: 'toolbarSpace', options: { hasPanels, maxPanelHeight }, fn({ rects, placement, elements }) {\n const viewport = window.visualViewport;\n const root = runtime.configuration.get().scrollRoot?.getBoundingClientRect();\n const top = Math.max(viewport?.offsetTop ?? 0, root?.top ?? 0);\n const bottom = Math.min((viewport?.offsetTop ?? 0) + (viewport?.height ?? window.innerHeight), root?.bottom ?? Infinity);\n const above = Math.max(0, rects.reference.y - top - 20), below = Math.max(0, bottom - rects.reference.y - rects.reference.height - 20);\n const row = (elements.floating.querySelector('.limr-toolbar-actions')?.getBoundingClientRect().height ?? 34) + (elements.floating.querySelector('.limr-toolbar-delete-hint')?.getBoundingClientRect().height ?? 0);\n const limit = Math.max(0, parseFloat(getComputedStyle(elements.floating).getPropertyValue('--limr-toolbar-panel-max-height')) || maxPanelHeight);\n const needed = row + (hasPanels ? limit : 0) + 24;\n // Reserve the same budget while closed or expanded, so hover never moves the action row.\n const next = below >= needed || below >= above ? 'bottom' : 'top';\n const room = next === 'bottom' ? below : above;\n elements.floating.style.setProperty('--limr-toolbar-panel-height', `${Math.max(0, Math.min(limit, room - row - 24))}px`);\n elements.floating.style.setProperty('--limr-toolbar-available-height', `${room}px`);\n return placement !== next ? { reset: { placement: next } } : {};\n } }, shift({ padding: 10 })], whileElementsMounted: autoUpdate,\n });\n useEffect(() => {\n const reference = selection ? runtime.selectionRange : paint ? runtime.highlightReference : active ? runtime.anchors.get(active.id) : null;\n if (reference) refs.setPositionReference({ getBoundingClientRect: () => reference.getBoundingClientRect(), getClientRects: () => reference.getClientRects(), contextElement: runtime.content ?? undefined });\n }, [runtime, refs, selection, paint, active]);\n const selectionKey = effectiveSelection?.raw.ranges.map(range => `${range.start}-${range.end}`).join(',') ?? '';\n useEffect(() => { setError(null); setExpanded(null); setSuccess(null); setDeleteHintOpen(false); clearTimeout(closeTimer.current); clearTimeout(successTimer.current); }, [selectionKey, open]);\n useEffect(() => () => { clearTimeout(closeTimer.current); clearTimeout(successTimer.current); }, []);\n const dismiss = () => { runtime.clearSelection(); runtime.activate(null); };\n useEffect(() => {\n if (!open) return;\n const down = (event: PointerEvent) => {\n if (event.target instanceof Element && event.target.closest('[data-limr-selection-ui],.limr-sidebar-card,.limr-overlay-positioner,[data-limr-anchor]')) return;\n if (runtime.interaction.get().activeHighlight) runtime.clearSelection();\n };\n const key = (event: KeyboardEvent) => {\n if (event.key !== 'Escape' || event.defaultPrevented) return;\n if (expanded) {\n setExpanded(null);\n refs.floating.current?.querySelector<HTMLButtonElement>(`[data-action-id=\"${CSS.escape(expanded)}\"] button`)?.focus();\n } else dismiss();\n event.preventDefault();\n };\n document.addEventListener('pointerdown', down); document.addEventListener('keydown', key);\n return () => { document.removeEventListener('pointerdown', down); document.removeEventListener('keydown', key); };\n }, [open, expanded, runtime, refs]);\n const expand = (id: string) => { clearTimeout(closeTimer.current); setExpanded(id); };\n const execute = async (action: SelectionAction, operation: () => void | Promise<void>) => {\n if (!context || busyRef.current || action.disabled?.(context)) return;\n busyRef.current = true; setBusy(action.id); setError(null);\n try { await operation(); }\n catch (cause) { if (!runtime.signal.aborted) setError(cause instanceof Error ? cause.message : String(cause)); }\n finally { busyRef.current = false; if (!runtime.signal.aborted) setBusy(null); }\n };\n const actionContext = (action: SelectionAction): ToolbarActionContext => ({\n ...context!, busy: !!busy, expanded: expanded === action.id, highlightAppearance, setHighlightAppearance: setPreferredHighlight,\n expand: () => expand(action.id), collapse: () => setExpanded(null),\n run: operation => execute(action, () => operation(context!)),\n });\n const run = (action: SelectionAction) => execute(action, async () => {\n if (action.run) await action.run(actionContext(action));\n else if (action.renderExpanded) expanded === action.id ? setExpanded(null) : expand(action.id);\n if (action.successLabel && !runtime.signal.aborted) {\n setSuccess(action.id); clearTimeout(successTimer.current);\n successTimer.current = setTimeout(() => setSuccess(null), 2400);\n }\n });\n if (!open || !context) return null;\n const label = (action: SelectionAction) => {\n const value = success === action.id && action.successLabel ? action.successLabel : action.label;\n return typeof value === 'function' ? value(context) : value;\n };\n const annotationCount = annotations.filter(annotation => annotation.type !== 'highlight').length;\n const hint = available.some(action => action.id === 'delete-annotations') && annotationCount > 1 ? context.locale.deleteAnnotationsHint.replace('{count}', String(annotationCount)) : null;\n return <FloatingPortal root={portalRoot}><div ref={refs.setFloating} className={`limr-selection-toolbar ${className}`} style={{ ...style, ...floatingStyles, visibility: isPositioned ? undefined : 'hidden' }} role=\"toolbar\" aria-label=\"Text actions\" data-limr-selection-ui=\"true\" data-limr-theme={theme} data-limr-appearance={appearance} data-placement={placement} data-highlight={highlight?.id} data-expanded={expandedAction?.id}\n onMouseDown={event => { if (!(event.target instanceof Element) || !event.target.closest('input,textarea,select,[contenteditable]')) event.preventDefault(); }}\n onPointerEnter={() => clearTimeout(closeTimer.current)}\n onPointerLeave={event => {\n if (event.pointerType !== 'mouse' || event.currentTarget.contains(document.activeElement)) return;\n closeTimer.current = setTimeout(() => setExpanded(null), 200);\n }}\n onBlur={event => { if (!event.currentTarget.contains(event.relatedTarget) && !event.currentTarget.matches(':hover')) setExpanded(null); }}\n onKeyDown={event => {\n if (event.target instanceof Element && event.target.closest('.limr-toolbar-panel')) return;\n if (!['ArrowRight', 'ArrowLeft', 'Home', 'End', 'ArrowDown', 'ArrowUp'].includes(event.key)) return;\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n const id = (event.target as Element).closest<HTMLElement>('[data-action-id]')?.dataset.actionId;\n const action = available.find(item => item.id === id);\n if (action?.renderExpanded) { expand(action.id); requestAnimationFrame(() => refs.floating.current?.querySelector<HTMLElement>('.limr-toolbar-panel button,.limr-toolbar-panel input,.limr-toolbar-panel textarea')?.focus()); }\n } else {\n const buttons = Array.from(event.currentTarget.querySelectorAll<HTMLButtonElement>('.limr-toolbar-actions button:not(:disabled)'));\n const current = buttons.indexOf(document.activeElement as HTMLButtonElement);\n const index = event.key === 'Home' ? 0 : event.key === 'End' ? buttons.length - 1 : (current + (event.key === 'ArrowRight' ? 1 : buttons.length - 1)) % buttons.length;\n buttons[index]?.focus();\n }\n event.preventDefault();\n }}>\n <div className=\"limr-toolbar-surface\" key={selectionKey} data-ready={isPositioned || undefined}>\n <div className=\"limr-toolbar-actions\">{render ? render({ context, actions: available, run }) : available.map((action, index) => <div className=\"limr-toolbar-item\" key={action.id} data-action-id={action.id} data-active={expanded === action.id || undefined} data-tone={action.tone} data-status={success === action.id ? 'success' : undefined} style={{ '--limr-tool-index': index } as CSSProperties}\n onPointerEnter={event => {\n if (event.pointerType !== 'mouse' || busy || action.disabled?.(context)) return;\n if (expandedAction && expandedAction.id !== action.id && refs.floating.current?.querySelector('.limr-toolbar-panel')?.contains(document.activeElement)) return;\n clearTimeout(closeTimer.current);\n if (action.renderExpanded) expand(action.id); else setExpanded(null);\n try { action.onHover?.(actionContext(action)); }\n catch (cause) { setError(cause instanceof Error ? cause.message : String(cause)); }\n }}>\n {action.render ? action.render(actionContext(action)) : <button className=\"limr-toolbar-action\" type=\"button\" disabled={!!busy || action.disabled?.(context)} onClick={() => void run(action)} aria-label={label(action)} aria-busy={busy === action.id} aria-expanded={action.renderExpanded ? expanded === action.id : undefined} aria-controls={action.renderExpanded && expanded === action.id ? panelId : undefined}\n aria-describedby={action.id === 'delete-annotations' && hint && deleteHintOpen ? `${panelId}-delete` : undefined}\n onPointerEnter={event => { if (action.id === 'delete-annotations' && event.pointerType !== 'touch') setDeleteHintOpen(true); }}\n onPointerLeave={event => { if (action.id === 'delete-annotations') setDeleteHintOpen(event.currentTarget.matches(':focus-visible')); }}\n onFocus={event => { if (action.id === 'delete-annotations' && event.currentTarget.matches(':focus-visible')) setDeleteHintOpen(true); }}\n onBlur={event => { if (action.id === 'delete-annotations' && !event.currentTarget.matches(':hover')) setDeleteHintOpen(false); }}>\n <span className=\"limr-tool-face\" data-visible={success !== action.id || undefined} aria-hidden=\"true\">\n <span className=\"limr-tool-icon\" key={typeof action.label === 'function' ? action.label(context) : action.label}>{typeof action.icon === 'function' ? action.icon(context) : action.icon}</span><span className=\"limr-tool-label limr-underline\">{typeof action.label === 'function' ? action.label(context) : action.label}</span>\n </span>\n {action.successLabel && <span className=\"limr-tool-face\" data-visible={success === action.id || undefined} aria-hidden=\"true\">\n <span className=\"limr-tool-icon\">{action.successIcon ?? (typeof action.icon === 'function' ? action.icon(context) : action.icon)}</span><span className=\"limr-tool-label limr-underline\">{typeof action.successLabel === 'function' ? action.successLabel(context) : action.successLabel}</span>\n </span>}\n </button>}\n </div>)}</div>\n {expandedAction && <div id={panelId} className=\"limr-toolbar-panel\" key={expandedAction.id} role=\"group\" aria-label={label(expandedAction)}><OverlayScrollArea active label={label(expandedAction)}>{expandedAction.renderExpanded!(actionContext(expandedAction))}</OverlayScrollArea></div>}\n {hint && <Collapse open={deleteHintOpen} keepMounted className=\"limr-toolbar-delete-warning\"><p id={`${panelId}-delete`} className=\"limr-toolbar-delete-hint\">{hint}</p></Collapse>}\n {error && <span role=\"alert\" className=\"limr-action-error\">{error}</span>}\n </div>\n </div></FloatingPortal>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAAA,YAAW,SAAAC,QAAO,UAAAC,SAAQ,YAAAC,iBAAoC;;;ACAvE,SAAS,aAAAC,YAAW,cAAc;;;ACAlC,SAAS,iBAAiC;AAKnC,SAAS,gBAAgB,KAAoC,SAAwB,i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WAAA,EAAE;AAAA,sBAAAC,KAAC,SAAI,KAAK,SAAS,WAAU,mBAAkB,0BAAAA,KAAC,mBAAgB,GAAE;AAAA,MAAM,gBAAAA,KAAC,kBAAe;AAAA,OAAE;AAAA,IACpG,gBAAAA,KAAC,UAAK,KAAK,SAAS,WAAU,uBAAsB,0BAAAA,KAAC,YAAS,cAA4B,GAAE;AAAA,IAC3F,kBAAkB,gBAAAA,KAAC,qBAAkB;AAAA,IACtC,gBAAAA,KAAC,qBAAkB,UAAU,gBAAgB;AAAA,IAC7C,gBAAAA,KAAC,oBAAiB,SAAkB;AAAA,KACtC;AACF;AAEA,SAAS,iBAAiB;AACxB,QAAM,SAAS,UAAU;AACzB,QAAM,CAAC,MAAM,OAAO,IAAIG,UAAS,KAAK;AACtC,QAAM,KAAKE,OAAM;AACjB,SAAO,gBAAAJ,MAAC,SAAI,WAAU,0BACpB;AAAA,oBAAAA,MAAC,YAAO,MAAK,UAAS,WAAU,0BAAyB,iBAAe,MAAM,iBAAe,IAAI,SAAS,MAAM,QAAQ,WAAS,CAAC,KAAK,GACrI;AAAA,sBAAAD,KAAC,UAAM,iBAAO,UAAS;AAAA,MAAO,gBAAAA,KAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,eAAY,QAAO,0BAAAA,KAAC,UAAK,GAAE,gBAAe,GAAE;AAAA,OACjH;AAAA,IACA,gBAAAA,KAAC,SAAI,IAAQ,0BAAAA,KAAC,YAAS,MAAY,aAAW,MAAC,0BAAAA,KAAC,mBAAgB,GAAE,GAAW;AAAA,KAC/E;AACF;","names":["useEffect","useId","useRef","useState","useEffect","useEffect","useEffect","useRef","useState","useEffect","jsx","jsxs","useEffect","document","Fragment","jsx","jsxs","document","useRef","useState","element","height","size","useEffect","displacement","active","hovered","style","useEffect","useState","useSyncExternalStore","useRef","useRef","jsx","jsxs","useSyncExternalStore","useState","useEffect","update","anchor","availableHeight","useEffect","useMemo","useRef","useState","autoUpdate","FloatingPortal","offset","shift","useFloating","jsx","jsxs","useMemo","useState","useRef","useFloating","offset","placement","shift","autoUpdate","useEffect","FloatingPortal","Fragment","jsx","jsxs","useRef","useState","useEffect","useId"]}
|
|
@@ -434,6 +434,18 @@ function selectionFromRange(document, raw, options = {}) {
|
|
|
434
434
|
// src/core/annotations.ts
|
|
435
435
|
var defaultHighlight = { color: "#F2C744", style: "background" };
|
|
436
436
|
var sameRange = (a, b) => a.start === b.start && a.end === b.end;
|
|
437
|
+
function annotationReferenceRange(document, occurrence) {
|
|
438
|
+
if (!occurrence.embedded) return occurrence.range;
|
|
439
|
+
let reference = occurrence.range;
|
|
440
|
+
const visit = (node) => {
|
|
441
|
+
const range = rangeOf(node);
|
|
442
|
+
if (!intersects(range, occurrence.range)) return;
|
|
443
|
+
if (["paragraph", "heading", "listItem", "tableCell"].includes(node.type)) reference = range;
|
|
444
|
+
node.children?.forEach(visit);
|
|
445
|
+
};
|
|
446
|
+
for (const block of document.blocks) if (intersects(block.range, occurrence.range)) visit(block.node);
|
|
447
|
+
return reference;
|
|
448
|
+
}
|
|
437
449
|
function resolveAnnotationAnchors(annotation, document) {
|
|
438
450
|
return (annotation.anchors ?? (annotation.range ? [{ range: annotation.range }] : [])).flatMap((anchor) => {
|
|
439
451
|
if (anchor.documentId && anchor.documentId !== document.id) return [];
|
|
@@ -460,6 +472,7 @@ export {
|
|
|
460
472
|
selectionFromRange,
|
|
461
473
|
defaultHighlight,
|
|
462
474
|
sameRange,
|
|
475
|
+
annotationReferenceRange,
|
|
463
476
|
resolveAnnotationAnchors
|
|
464
477
|
};
|
|
465
|
-
//# sourceMappingURL=chunk-
|
|
478
|
+
//# sourceMappingURL=chunk-TTISGBST.js.map
|