@linloir/limr 0.1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.en.md +151 -0
  2. package/README.md +80 -127
  3. package/benchmarks/results/layout.json +2593 -0
  4. package/benchmarks/results/markstream-code.json +1823 -0
  5. package/benchmarks/results/markstream-reading-repeat.json +1152 -0
  6. package/benchmarks/results/markstream.json +12486 -0
  7. package/benchmarks/results/streaming-browser.json +77 -0
  8. package/benchmarks/results/streaming.json +357 -0
  9. package/dist/base.css +93 -10
  10. package/dist/{chunk-7JF5HHVF.js → chunk-BG5QUQFR.js} +340 -72
  11. package/dist/chunk-BG5QUQFR.js.map +1 -0
  12. package/dist/chunk-BVHHOVMT.js +179 -0
  13. package/dist/chunk-BVHHOVMT.js.map +1 -0
  14. package/dist/chunk-FJZCQY2S.js +155 -0
  15. package/dist/chunk-FJZCQY2S.js.map +1 -0
  16. package/dist/chunk-FSI5OTBW.js +1 -0
  17. package/dist/{chunk-ETHLPBKQ.js → chunk-GU2RPESF.js} +238 -131
  18. package/dist/chunk-GU2RPESF.js.map +1 -0
  19. package/dist/{chunk-65V5OZ4G.js → chunk-SUAAUGAX.js} +1350 -511
  20. package/dist/chunk-SUAAUGAX.js.map +1 -0
  21. package/dist/core/index.d.ts +6 -3
  22. package/dist/core/index.js +15 -5
  23. package/dist/extensions/index.d.ts +30 -5
  24. package/dist/extensions/index.js +15 -3
  25. package/dist/index.d.ts +4 -4
  26. package/dist/index.js +31 -8
  27. package/dist/{engine-43u8B4yt.d.ts → knuth-plass-C8mgFm7W.d.ts} +67 -1
  28. package/dist/knuth-plass-layout-CHQCWKB5.js +449 -0
  29. package/dist/knuth-plass-layout-CHQCWKB5.js.map +1 -0
  30. package/dist/react/index.d.ts +7 -5
  31. package/dist/react/index.js +7 -3
  32. package/dist/styles.css +93 -10
  33. package/dist/{translations-BliabrPd.d.ts → translations-BXzSwLBJ.d.ts} +49 -4
  34. package/docs/README.md +13 -0
  35. package/docs/api.md +5 -158
  36. package/docs/assets/rendered.svg +9 -0
  37. package/docs/assets/source.svg +9 -0
  38. package/docs/en/README.md +28 -0
  39. package/docs/en/ai-skills.md +57 -0
  40. package/docs/en/annotations.md +86 -0
  41. package/docs/en/api.md +115 -0
  42. package/docs/en/architecture.md +41 -0
  43. package/docs/en/extensions.md +208 -0
  44. package/docs/en/getting-started.md +69 -0
  45. package/docs/en/integration.md +154 -0
  46. package/docs/en/modules.md +84 -0
  47. package/docs/en/performance.md +93 -0
  48. package/docs/en/plugin-packages.md +68 -0
  49. package/docs/en/styles.md +99 -0
  50. package/docs/en/syntax.md +455 -0
  51. package/docs/extensions.md +5 -306
  52. package/docs/implementation.md +5 -76
  53. package/docs/performance.md +5 -81
  54. package/docs/screenshots/blocks.png +0 -0
  55. package/docs/screenshots/dark.png +0 -0
  56. package/docs/screenshots/desktop.png +0 -0
  57. package/docs/screenshots/plugin-mobile.png +0 -0
  58. package/docs/styles.md +5 -100
  59. package/docs/visual-upgrade.md +5 -145
  60. package/docs/zh-CN/README.md +28 -0
  61. package/docs/zh-CN/ai-skills.md +57 -0
  62. package/docs/zh-CN/annotations.md +86 -0
  63. package/docs/zh-CN/api.md +115 -0
  64. package/docs/zh-CN/architecture.md +41 -0
  65. package/docs/zh-CN/extensions.md +210 -0
  66. package/docs/zh-CN/getting-started.md +69 -0
  67. package/docs/zh-CN/integration.md +154 -0
  68. package/docs/zh-CN/modules.md +84 -0
  69. package/docs/zh-CN/performance.md +93 -0
  70. package/docs/zh-CN/plugin-packages.md +68 -0
  71. package/docs/zh-CN/styles.md +99 -0
  72. package/docs/zh-CN/syntax.md +457 -0
  73. package/examples/notes.tsx +18 -11
  74. package/examples/packages/paper-theme/index.css +25 -0
  75. package/examples/packages/paper-theme/package.json +7 -0
  76. package/examples/packages/reading-tools/index.d.ts +2 -0
  77. package/examples/packages/reading-tools/index.js +25 -0
  78. package/examples/packages/reading-tools/package.json +16 -0
  79. package/package.json +17 -5
  80. package/skills/limr-plugin-development/SKILL.md +22 -0
  81. package/skills/limr-plugin-development/agents/openai.yaml +4 -0
  82. package/skills/limr-plugin-development/assets/plugin-template/README.md +30 -0
  83. package/skills/limr-plugin-development/assets/plugin-template/package.json +36 -0
  84. package/skills/limr-plugin-development/assets/plugin-template/src/index.tsx +50 -0
  85. package/skills/limr-plugin-development/assets/plugin-template/src/styles.css +9 -0
  86. package/skills/limr-plugin-development/assets/plugin-template/tsconfig.json +20 -0
  87. package/skills/limr-plugin-development/assets/plugin-template/tsup.config.ts +8 -0
  88. package/skills/limr-plugin-development/references/contract.md +51 -0
  89. package/skills/limr-use/SKILL.md +23 -0
  90. package/skills/limr-use/agents/openai.yaml +4 -0
  91. package/skills/limr-use/references/integration.md +49 -0
  92. package/skills/limr-use/references/syntax.md +20 -0
  93. package/dist/chunk-65V5OZ4G.js.map +0 -1
  94. package/dist/chunk-7JF5HHVF.js.map +0 -1
  95. package/dist/chunk-ETHLPBKQ.js.map +0 -1
  96. package/dist/chunk-V2OG4Y3F.js +0 -1
  97. /package/dist/{chunk-V2OG4Y3F.js.map → chunk-FSI5OTBW.js.map} +0 -0
@@ -1,5 +1,5 @@
1
- import { k as SourceRange, f as DocumentSnapshot, h as SelectionSnapshot, g as HighlightData, A as Annotation, a as AnnotationAnchor, M as MarkdownNode } from '../engine-43u8B4yt.js';
2
- export { b as AnnotationOccurrence, B as Block, D as Diagnostic, c as DocumentEngine, d as DocumentMetrics, e as DocumentOptions, H as Heading, P as ParseContext, R as Rect, S as SelectionResult, i as SourcePoint, j as SourcePosition, l as SyntaxExtension, m as createDocument, r as replaceExtension } from '../engine-43u8B4yt.js';
1
+ import { m as SourceRange, f as DocumentSnapshot, j as SelectionSnapshot, b as AnnotationOccurrence, g as HighlightData, A as Annotation, a as AnnotationAnchor, M as MarkdownNode } from '../knuth-plass-C8mgFm7W.js';
2
+ export { B as Block, D as Diagnostic, c as DocumentEngine, d as DocumentMetrics, e as DocumentOptions, H as Heading, K as KnuthPlassOptions, L as LineBreak, h as LineItem, P as ParagraphLayout, i as ParseContext, R as Rect, S as SelectionResult, k as SourcePoint, l as SourcePosition, n as SyntaxExtension, o as createDocument, p as knuthPlass, q as prepareKnuthPlass, r as replaceExtension, t as texBadness } from '../knuth-plass-C8mgFm7W.js';
3
3
  import 'micromark-util-types';
4
4
  import 'mdast-util-from-markdown';
5
5
 
@@ -42,6 +42,9 @@ declare class ResourceCache<T = unknown> {
42
42
 
43
43
  declare const defaultHighlight: Readonly<HighlightData>;
44
44
  declare const sameRange: (a: SourceRange, b: SourceRange) => boolean;
45
+ /** Embedded references quote their nearest text block; keep the marker's own
46
+ * range intact for source mapping, insertion and selection. */
47
+ declare function annotationReferenceRange(document: DocumentSnapshot, occurrence: AnnotationOccurrence): SourceRange;
45
48
  /** Resolve persisted anchors once against the current source. */
46
49
  declare function resolveAnnotationAnchors(annotation: Annotation, document: DocumentSnapshot): AnnotationAnchor[];
47
50
 
@@ -51,4 +54,4 @@ declare function rangeOf(node: MarkdownNode): SourceRange;
51
54
  declare function intersects(a: SourceRange, b: SourceRange): boolean;
52
55
  declare function safeUrl(value: unknown, image?: boolean): string | undefined;
53
56
 
54
- export { Annotation, AnnotationAnchor, DocumentSnapshot, HighlightData, LruCache, MarkdownNode, ResourceCache, SelectionSnapshot, SourceRange, type TextMapping, defaultHighlight, intersects, mapText, rangeOf, resolveAnnotationAnchors, safeUrl, sameRange, selectionFromRange, textContent, walk };
57
+ export { Annotation, AnnotationAnchor, AnnotationOccurrence, DocumentSnapshot, HighlightData, LruCache, MarkdownNode, ResourceCache, SelectionSnapshot, SourceRange, type TextMapping, annotationReferenceRange, defaultHighlight, intersects, mapText, rangeOf, resolveAnnotationAnchors, safeUrl, sameRange, selectionFromRange, textContent, walk };
@@ -1,18 +1,24 @@
1
1
  import {
2
2
  DocumentEngine,
3
+ annotationReferenceRange,
3
4
  createDocument,
4
5
  defaultHighlight,
5
- intersects,
6
6
  mapText,
7
- rangeOf,
8
7
  replaceExtension,
9
8
  resolveAnnotationAnchors,
10
- safeUrl,
11
9
  sameRange,
12
- selectionFromRange,
10
+ selectionFromRange
11
+ } from "../chunk-BG5QUQFR.js";
12
+ import {
13
+ intersects,
14
+ knuthPlass,
15
+ prepareKnuthPlass,
16
+ rangeOf,
17
+ safeUrl,
18
+ texBadness,
13
19
  textContent,
14
20
  walk
15
- } from "../chunk-7JF5HHVF.js";
21
+ } from "../chunk-FJZCQY2S.js";
16
22
  import {
17
23
  LruCache,
18
24
  ResourceCache
@@ -21,16 +27,20 @@ export {
21
27
  DocumentEngine,
22
28
  LruCache,
23
29
  ResourceCache,
30
+ annotationReferenceRange,
24
31
  createDocument,
25
32
  defaultHighlight,
26
33
  intersects,
34
+ knuthPlass,
27
35
  mapText,
36
+ prepareKnuthPlass,
28
37
  rangeOf,
29
38
  replaceExtension,
30
39
  resolveAnnotationAnchors,
31
40
  safeUrl,
32
41
  sameRange,
33
42
  selectionFromRange,
43
+ texBadness,
34
44
  textContent,
35
45
  walk
36
46
  };
@@ -1,8 +1,8 @@
1
- import { N as NodeRenderer, f as AnnotationType, R as RendererExtension, i as MarkdownProps, S as SelectionAction } from '../translations-BliabrPd.js';
2
- export { n as TranslationMode, o as TranslationsOptions, t as translations } from '../translations-BliabrPd.js';
1
+ import { N as NodeRenderer, R as RendererExtension, f as AnnotationType, i as MarkdownProps, S as SelectionAction } from '../translations-BXzSwLBJ.js';
2
+ export { p as TranslationMode, q as TranslationsOptions, t as translations } from '../translations-BXzSwLBJ.js';
3
3
  import { KatexOptions } from 'katex';
4
4
  import * as react from 'react';
5
- import '../engine-43u8B4yt.js';
5
+ import '../knuth-plass-C8mgFm7W.js';
6
6
  import 'micromark-util-types';
7
7
  import 'mdast-util-from-markdown';
8
8
 
@@ -12,9 +12,10 @@ interface BlockExtensionOptions {
12
12
  tags?: readonly string[];
13
13
  directives?: readonly string[];
14
14
  selection?: 'content' | 'atomic';
15
+ streaming?: RendererExtension['streaming'];
15
16
  }
16
17
  /** A tag/directive adapter with original source positions and streaming recovery. */
17
- declare function defineBlock({ name, component, tags, directives, selection }: BlockExtensionOptions): RendererExtension;
18
+ declare function defineBlock({ name, component, tags, directives, selection, streaming }: BlockExtensionOptions): RendererExtension;
18
19
  declare function defineAnnotation<T>(type: AnnotationType<T>): RendererExtension;
19
20
  declare function defineExtension(extension: RendererExtension): RendererExtension;
20
21
 
@@ -28,6 +29,30 @@ interface MathOptions {
28
29
  }
29
30
  declare function math(options?: MathOptions): RendererExtension;
30
31
 
32
+ /** Lazy, atomic diagrams. An unclosed streaming fence never reaches Mermaid. */
33
+ declare function mermaid(): RendererExtension;
34
+
35
+ declare function calloutType(value: string): string;
36
+ /** Obsidian blockquotes and LiMR ::callout share the same renderer and AST. */
37
+ declare function callout(options?: {
38
+ component?: NodeRenderer;
39
+ }): RendererExtension;
40
+
41
+ interface InlineHighlightOptions {
42
+ color?: string;
43
+ component?: NodeRenderer;
44
+ }
45
+ /** Markdown-authored highlights share the normal paint/hover/copy machinery,
46
+ * while their source remains the authority for editing. */
47
+ declare function inlineHighlights(options?: InlineHighlightOptions): RendererExtension;
48
+
49
+ interface FootnoteData {
50
+ body: string;
51
+ }
52
+ /** GFM definitions keep their AST identity for incremental parsing, but their
53
+ * references use the same marker/sidebar/overlay contract as other modules. */
54
+ declare function footnotes(options?: Partial<AnnotationType<FootnoteData>>): RendererExtension;
55
+
31
56
  interface CodeHighlightOptions {
32
57
  languages?: readonly string[];
33
58
  lightTheme?: string;
@@ -127,4 +152,4 @@ declare function highlightPalette(options?: HighlightOptions): SelectionAction;
127
152
  declare function highlightSelection(): SelectionAction;
128
153
  declare function deleteAnnotations(): SelectionAction;
129
154
 
130
- export { AnnotationMarkdown, type BlockExtensionOptions, type CitationData, type CodeHighlightOptions, type FiguresOptions, type HighlightOptions, type MathOptions, type VideoOptions, citation, codeHighlight, copyText, defineAnnotation, defineBlock, defineExtension, definition, deleteAnnotations, extras, figures, gfm, highlightColors, highlightPalette, highlightSelection, math, preloadMath, question, standard, video };
155
+ export { AnnotationMarkdown, type BlockExtensionOptions, type CitationData, type CodeHighlightOptions, type FiguresOptions, type FootnoteData, type HighlightOptions, type InlineHighlightOptions, type MathOptions, type VideoOptions, callout, calloutType, citation, codeHighlight, copyText, defineAnnotation, defineBlock, defineExtension, definition, deleteAnnotations, extras, figures, footnotes, gfm, highlightColors, highlightPalette, highlightSelection, inlineHighlights, math, mermaid, preloadMath, question, standard, video };
@@ -1,6 +1,8 @@
1
- import "../chunk-V2OG4Y3F.js";
1
+ import "../chunk-FSI5OTBW.js";
2
2
  import {
3
3
  AnnotationMarkdown,
4
+ callout,
5
+ calloutType,
4
6
  citation,
5
7
  codeHighlight,
6
8
  copyText,
@@ -11,21 +13,28 @@ import {
11
13
  deleteAnnotations,
12
14
  extras,
13
15
  figures,
16
+ footnotes,
14
17
  gfm,
15
18
  highlightColors,
16
19
  highlightPalette,
17
20
  highlightSelection,
21
+ inlineHighlights,
18
22
  math,
23
+ mermaid,
19
24
  preloadMath,
20
25
  question,
21
26
  standard,
22
27
  translations,
23
28
  video
24
- } from "../chunk-65V5OZ4G.js";
25
- import "../chunk-7JF5HHVF.js";
29
+ } from "../chunk-SUAAUGAX.js";
30
+ import "../chunk-BG5QUQFR.js";
31
+ import "../chunk-BVHHOVMT.js";
32
+ import "../chunk-FJZCQY2S.js";
26
33
  import "../chunk-6N6TFHEN.js";
27
34
  export {
28
35
  AnnotationMarkdown,
36
+ callout,
37
+ calloutType,
29
38
  citation,
30
39
  codeHighlight,
31
40
  copyText,
@@ -36,11 +45,14 @@ export {
36
45
  deleteAnnotations,
37
46
  extras,
38
47
  figures,
48
+ footnotes,
39
49
  gfm,
40
50
  highlightColors,
41
51
  highlightPalette,
42
52
  highlightSelection,
53
+ inlineHighlights,
43
54
  math,
55
+ mermaid,
44
56
  preloadMath,
45
57
  question,
46
58
  standard,
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { A as Annotation, a as AnnotationAnchor, b as AnnotationOccurrence, B as Block, D as Diagnostic, c as DocumentEngine, d as DocumentMetrics, e as DocumentOptions, f as DocumentSnapshot, H as Heading, g as HighlightData, M as MarkdownNode, P as ParseContext, R as Rect, S as SelectionResult, h as SelectionSnapshot, i as SourcePoint, j as SourcePosition, k as SourceRange, l as SyntaxExtension, m as createDocument, r as replaceExtension } from './engine-43u8B4yt.js';
2
- export { LruCache, ResourceCache, TextMapping, defaultHighlight, intersects, mapText, rangeOf, resolveAnnotationAnchors, safeUrl, sameRange, selectionFromRange, textContent, walk } from './core/index.js';
3
- export { A as ActionContext, a as AnnotationContentProps, b as AnnotationExpansion, c as AnnotationOverlayCardProps, d as AnnotationPresentation, e as AnnotationSidebarPreviewProps, f as AnnotationType, D as DocumentCommands, g as DocumentProvider, h as DocumentProviderProps, L as LiMRLocale, M as Markdown, i as MarkdownProps, N as NodeRenderer, j as NodeRendererProps, R as RendererExtension, k as RendererParameters, S as SelectionAction, l as StyledProps, T as TextToken, m as ToolbarActionContext, n as TranslationMode, o as TranslationsOptions, V as ViewConfiguration, t as translations, u as useAnchor, p as useAnnotation, q as useAnnotationState, r as useAnnotations, s as useDocument, v as useDocumentSelector, w as useLiMR, x as useRendererParameter, y as useSelection } from './translations-BliabrPd.js';
1
+ export { A as Annotation, a as AnnotationAnchor, b as AnnotationOccurrence, B as Block, D as Diagnostic, c as DocumentEngine, d as DocumentMetrics, e as DocumentOptions, f as DocumentSnapshot, H as Heading, g as HighlightData, K as KnuthPlassOptions, L as LineBreak, h as LineItem, M as MarkdownNode, P as ParagraphLayout, i as ParseContext, R as Rect, S as SelectionResult, j as SelectionSnapshot, k as SourcePoint, l as SourcePosition, m as SourceRange, n as SyntaxExtension, o as createDocument, p as knuthPlass, q as prepareKnuthPlass, r as replaceExtension, t as texBadness } from './knuth-plass-C8mgFm7W.js';
2
+ export { LruCache, ResourceCache, TextMapping, annotationReferenceRange, defaultHighlight, intersects, mapText, rangeOf, resolveAnnotationAnchors, safeUrl, sameRange, selectionFromRange, textContent, walk } from './core/index.js';
3
+ export { A as ActionContext, a as AnnotationContentProps, b as AnnotationExpansion, c as AnnotationOverlayCardProps, d as AnnotationPresentation, e as AnnotationSidebarPreviewProps, f as AnnotationType, D as DocumentCommands, g as DocumentProvider, h as DocumentProviderProps, L as LiMRLocale, M as Markdown, i as MarkdownProps, N as NodeRenderer, j as NodeRendererProps, R as RendererExtension, k as RendererOverride, l as RendererParameters, S as SelectionAction, m as StreamEffect, n as StyledProps, T as TextToken, o as ToolbarActionContext, p as TranslationMode, q as TranslationsOptions, r as TypographyMode, V as ViewConfiguration, t as translations, u as useAnchor, s as useAnnotation, v as useAnnotationState, w as useAnnotations, x as useDocument, y as useDocumentSelector, z as useLiMR, B as useLocale, C as useRendererParameter, E as useSelection } from './translations-BXzSwLBJ.js';
4
4
  export { AnnotationCard, AnnotationCardProps, AnnotationContent, AnnotationGroup, AnnotationOverlay, AnnotationOverlayProps, AnnotationSidebar, AnnotationSidebarProps, InlineMarker, InlineMarkerProps, Reader, ReaderProps, SelectionToolbar, SelectionToolbarProps, SidebarItem, SidebarPositioner, TableOfContents, TableOfContentsProps, ToolIcon, ToolIconName, alignSidebar, chinese, english } from './react/index.js';
5
- export { AnnotationMarkdown, BlockExtensionOptions, CitationData, CodeHighlightOptions, FiguresOptions, HighlightOptions, MathOptions, VideoOptions, citation, codeHighlight, copyText, defineAnnotation, defineBlock, defineExtension, definition, deleteAnnotations, extras, figures, gfm, highlightColors, highlightPalette, highlightSelection, math, preloadMath, question, standard, video } from './extensions/index.js';
5
+ export { AnnotationMarkdown, BlockExtensionOptions, CitationData, CodeHighlightOptions, FiguresOptions, FootnoteData, HighlightOptions, InlineHighlightOptions, MathOptions, VideoOptions, callout, calloutType, citation, codeHighlight, copyText, defineAnnotation, defineBlock, defineExtension, definition, deleteAnnotations, extras, figures, footnotes, gfm, highlightColors, highlightPalette, highlightSelection, inlineHighlights, math, mermaid, preloadMath, question, standard, video } from './extensions/index.js';
6
6
  import 'micromark-util-types';
7
7
  import 'mdast-util-from-markdown';
8
8
  import 'react';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-V2OG4Y3F.js";
1
+ import "./chunk-FSI5OTBW.js";
2
2
  import {
3
3
  AnnotationContent,
4
4
  AnnotationGroup,
@@ -8,7 +8,7 @@ import {
8
8
  SelectionToolbar,
9
9
  TableOfContents,
10
10
  alignSidebar
11
- } from "./chunk-ETHLPBKQ.js";
11
+ } from "./chunk-GU2RPESF.js";
12
12
  import {
13
13
  AnnotationCard,
14
14
  AnnotationMarkdown,
@@ -16,6 +16,8 @@ import {
16
16
  InlineMarker,
17
17
  Markdown,
18
18
  ToolIcon,
19
+ callout,
20
+ calloutType,
19
21
  chinese,
20
22
  citation,
21
23
  codeHighlight,
@@ -28,11 +30,14 @@ import {
28
30
  english,
29
31
  extras,
30
32
  figures,
33
+ footnotes,
31
34
  gfm,
32
35
  highlightColors,
33
36
  highlightPalette,
34
37
  highlightSelection,
38
+ inlineHighlights,
35
39
  math,
40
+ mermaid,
36
41
  preloadMath,
37
42
  question,
38
43
  standard,
@@ -44,25 +49,33 @@ import {
44
49
  useDocument,
45
50
  useDocumentSelector,
46
51
  useLiMR,
52
+ useLocale,
47
53
  useRendererParameter,
48
54
  useSelection,
49
55
  video
50
- } from "./chunk-65V5OZ4G.js";
56
+ } from "./chunk-SUAAUGAX.js";
51
57
  import {
52
58
  DocumentEngine,
59
+ annotationReferenceRange,
53
60
  createDocument,
54
61
  defaultHighlight,
55
- intersects,
56
62
  mapText,
57
- rangeOf,
58
63
  replaceExtension,
59
64
  resolveAnnotationAnchors,
60
- safeUrl,
61
65
  sameRange,
62
- selectionFromRange,
66
+ selectionFromRange
67
+ } from "./chunk-BG5QUQFR.js";
68
+ import "./chunk-BVHHOVMT.js";
69
+ import {
70
+ intersects,
71
+ knuthPlass,
72
+ prepareKnuthPlass,
73
+ rangeOf,
74
+ safeUrl,
75
+ texBadness,
63
76
  textContent,
64
77
  walk
65
- } from "./chunk-7JF5HHVF.js";
78
+ } from "./chunk-FJZCQY2S.js";
66
79
  import {
67
80
  LruCache,
68
81
  ResourceCache
@@ -85,6 +98,9 @@ export {
85
98
  TableOfContents,
86
99
  ToolIcon,
87
100
  alignSidebar,
101
+ annotationReferenceRange,
102
+ callout,
103
+ calloutType,
88
104
  chinese,
89
105
  citation,
90
106
  codeHighlight,
@@ -99,14 +115,19 @@ export {
99
115
  english,
100
116
  extras,
101
117
  figures,
118
+ footnotes,
102
119
  gfm,
103
120
  highlightColors,
104
121
  highlightPalette,
105
122
  highlightSelection,
123
+ inlineHighlights,
106
124
  intersects,
125
+ knuthPlass,
107
126
  mapText,
108
127
  math,
128
+ mermaid,
109
129
  preloadMath,
130
+ prepareKnuthPlass,
110
131
  question,
111
132
  rangeOf,
112
133
  replaceExtension,
@@ -115,6 +136,7 @@ export {
115
136
  sameRange,
116
137
  selectionFromRange,
117
138
  standard,
139
+ texBadness,
118
140
  textContent,
119
141
  translations,
120
142
  useAnchor,
@@ -124,6 +146,7 @@ export {
124
146
  useDocument,
125
147
  useDocumentSelector,
126
148
  useLiMR,
149
+ useLocale,
127
150
  useRendererParameter,
128
151
  useSelection,
129
152
  video,
@@ -27,6 +27,8 @@ interface MarkdownNode {
27
27
  attributeNodes?: Record<string, MarkdownNode>;
28
28
  inline?: boolean;
29
29
  selection?: 'content' | 'atomic';
30
+ /** The opening syntax is known but its closing delimiter has not arrived. */
31
+ incomplete?: boolean;
30
32
  [key: string]: unknown;
31
33
  }
32
34
  interface ParseContext {
@@ -41,6 +43,8 @@ interface SyntaxExtension {
41
43
  mdast?: readonly Extension$1[];
42
44
  tags?: readonly string[];
43
45
  directives?: readonly string[];
46
+ /** Directive bodies are literal source (for example code or LaTeX). */
47
+ literal?: boolean;
44
48
  selection?: 'content' | 'atomic';
45
49
  transform?: (root: MarkdownNode, context: ParseContext) => void;
46
50
  display?: 'block' | 'inline' | 'auto';
@@ -74,12 +78,16 @@ interface AnnotationOccurrence extends AnnotationAnchor {
74
78
  id: string;
75
79
  annotationIds: readonly string[];
76
80
  embedded?: boolean;
81
+ /** Optional referenced text range, distinct from the marker's source range. */
82
+ referenceRange?: SourceRange;
77
83
  }
78
84
  /** Data for the built-in `highlight` annotation type. */
79
85
  interface HighlightData {
80
86
  color?: string;
81
87
  style?: 'background' | 'underline' | 'dotted' | 'wavy';
82
88
  hidden?: boolean;
89
+ /** Authored in Markdown: the default toolbar offers copying without editing. */
90
+ readOnly?: boolean;
83
91
  }
84
92
  interface Block {
85
93
  id: string;
@@ -126,6 +134,8 @@ interface SelectionResult {
126
134
  interface SelectionSnapshot {
127
135
  documentId: string;
128
136
  revision: number;
137
+ /** Readable selected text; the browser adapter substitutes complete original
138
+ * source (including delimiters) for selected atomic content once settled. */
129
139
  text: string;
130
140
  quality: 'exact' | 'atomic' | 'unmapped';
131
141
  raw: SelectionResult;
@@ -156,6 +166,9 @@ declare class DocumentEngine {
156
166
  private listeners;
157
167
  private definitionSignature;
158
168
  private recoveryOffset;
169
+ private lines;
170
+ private facts;
171
+ private relevant;
159
172
  constructor(source?: string, options?: DocumentOptions);
160
173
  getSnapshot: () => DocumentSnapshot;
161
174
  subscribe: (listener: () => void) => (() => void);
@@ -169,4 +182,57 @@ declare class DocumentEngine {
169
182
  declare function createDocument(source?: string, options?: DocumentOptions): DocumentEngine;
170
183
  declare function replaceExtension<T extends SyntaxExtension>(extensions: readonly T[], replacement: T): T[];
171
184
 
172
- export { type Annotation as A, type Block as B, type Diagnostic as D, type Heading as H, type MarkdownNode as M, type ParseContext as P, type Rect as R, type SelectionResult as S, type AnnotationAnchor as a, type AnnotationOccurrence as b, DocumentEngine as c, type DocumentMetrics as d, type DocumentOptions as e, type DocumentSnapshot as f, type HighlightData as g, type SelectionSnapshot as h, type SourcePoint as i, type SourcePosition as j, type SourceRange as k, type SyntaxExtension as l, createDocument as m, replaceExtension as r };
185
+ /** TeX82's paragraph model (tex.web, sections 815–873): boxes, glue,
186
+ * discretionary penalties, four fitness classes and a minimum-demerit path.
187
+ * Widths are converted to scaled units for TeX's integer badness calculation. */
188
+ type LineItem = {
189
+ type: 'box';
190
+ width: number;
191
+ } | {
192
+ type: 'glue';
193
+ width: number;
194
+ stretch: number;
195
+ shrink: number;
196
+ infinite?: boolean;
197
+ } | {
198
+ type: 'penalty';
199
+ width: number;
200
+ penalty: number;
201
+ flagged?: boolean;
202
+ automatic?: boolean;
203
+ };
204
+ interface KnuthPlassOptions {
205
+ pretolerance?: number;
206
+ tolerance?: number;
207
+ linePenalty?: number;
208
+ hyphenPenalty?: number;
209
+ adjacentDemerits?: number;
210
+ doubleHyphenDemerits?: number;
211
+ finalHyphenDemerits?: number;
212
+ /** Extra stretch in CSS pixels in the emergency pass, as in TeX. */
213
+ emergencyStretch?: number;
214
+ looseness?: number;
215
+ /** Default: Knuth–Liang en-US patterns. Return pieces that join to the word. */
216
+ hyphenate?: false | ((word: string) => readonly string[]);
217
+ }
218
+ interface LineBreak {
219
+ index: number;
220
+ start: number;
221
+ ratio: number;
222
+ fitness: number;
223
+ }
224
+ interface ParagraphLayout {
225
+ lines: LineBreak[];
226
+ demerits: number;
227
+ pass: 'pretolerance' | 'tolerance' | 'emergency' | 'final';
228
+ }
229
+ /** The integer approximation used by TeX, including its saturation at 10000. */
230
+ declare function texBadness(amount: number, available: number): number;
231
+ /** Prefix sums and safe active-node pruning remove repeated line scans. With
232
+ * constant line lengths and zero looseness, equal fitness is an exact shared
233
+ * state: future cost is independent of line count. No beam or word limit. */
234
+ declare function knuthPlass(items: readonly LineItem[], lengths: number | readonly number[], options?: KnuthPlassOptions): ParagraphLayout;
235
+ /** Retains width/stretch prefix sums across responsive layouts of the same text. */
236
+ declare function prepareKnuthPlass(items: readonly LineItem[]): (lengths: number | readonly number[], options?: KnuthPlassOptions) => ParagraphLayout;
237
+
238
+ export { type Annotation as A, type Block as B, type Diagnostic as D, type Heading as H, type KnuthPlassOptions as K, type LineBreak as L, type MarkdownNode as M, type ParagraphLayout as P, type Rect as R, type SelectionResult as S, type AnnotationAnchor as a, type AnnotationOccurrence as b, DocumentEngine as c, type DocumentMetrics as d, type DocumentOptions as e, type DocumentSnapshot as f, type HighlightData as g, type LineItem as h, type ParseContext as i, type SelectionSnapshot as j, type SourcePoint as k, type SourcePosition as l, type SourceRange as m, type SyntaxExtension as n, createDocument as o, knuthPlass as p, prepareKnuthPlass as q, replaceExtension as r, texBadness as t };