@liminis/editor 0.1.0-rc.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.
- package/LICENSE +34 -0
- package/README.md +376 -0
- package/dist/annotations/anchor-align.d.ts +50 -0
- package/dist/annotations/anchor-align.js +74 -0
- package/dist/annotations/anchor-model.d.ts +81 -0
- package/dist/annotations/anchor-model.js +80 -0
- package/dist/annotations/anchor-resolver.d.ts +92 -0
- package/dist/annotations/anchor-resolver.js +231 -0
- package/dist/annotations/block-structure.d.ts +65 -0
- package/dist/annotations/block-structure.js +113 -0
- package/dist/annotations/types.d.ts +159 -0
- package/dist/annotations/types.js +50 -0
- package/dist/annotations.d.ts +25 -0
- package/dist/annotations.js +27 -0
- package/dist/app/App.d.ts +64 -0
- package/dist/app/App.js +180 -0
- package/dist/app/editor/AmbientCorrectionPlugin.d.ts +18 -0
- package/dist/app/editor/AmbientCorrectionPlugin.js +185 -0
- package/dist/app/editor/AnchorScrollPlugin.d.ts +16 -0
- package/dist/app/editor/AnchorScrollPlugin.js +134 -0
- package/dist/app/editor/AnnotationMarkerPlugin.d.ts +24 -0
- package/dist/app/editor/AnnotationMarkerPlugin.js +224 -0
- package/dist/app/editor/AnnotationPlugin.d.ts +42 -0
- package/dist/app/editor/AnnotationPlugin.js +135 -0
- package/dist/app/editor/AnnotationSurface.d.ts +34 -0
- package/dist/app/editor/AnnotationSurface.js +115 -0
- package/dist/app/editor/AssetContext.d.ts +20 -0
- package/dist/app/editor/AssetContext.js +81 -0
- package/dist/app/editor/BlockClickPlugin.d.ts +8 -0
- package/dist/app/editor/BlockClickPlugin.js +126 -0
- package/dist/app/editor/CodeBlockPlugin.d.ts +1 -0
- package/dist/app/editor/CodeBlockPlugin.js +219 -0
- package/dist/app/editor/CorrectionPanelPlugin.d.ts +14 -0
- package/dist/app/editor/CorrectionPanelPlugin.js +333 -0
- package/dist/app/editor/DragHandlePlugin.d.ts +1 -0
- package/dist/app/editor/DragHandlePlugin.js +300 -0
- package/dist/app/editor/Editor.d.ts +84 -0
- package/dist/app/editor/Editor.js +539 -0
- package/dist/app/editor/FrontmatterPlugin.d.ts +19 -0
- package/dist/app/editor/FrontmatterPlugin.js +301 -0
- package/dist/app/editor/ImageModal.d.ts +13 -0
- package/dist/app/editor/ImageModal.js +267 -0
- package/dist/app/editor/ImagePlugin.d.ts +3 -0
- package/dist/app/editor/ImagePlugin.js +187 -0
- package/dist/app/editor/LinkClickPlugin.d.ts +23 -0
- package/dist/app/editor/LinkClickPlugin.js +90 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.d.ts +49 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.js +373 -0
- package/dist/app/editor/OrderedTaskListPlugin.d.ts +21 -0
- package/dist/app/editor/OrderedTaskListPlugin.js +78 -0
- package/dist/app/editor/SearchPlugin.d.ts +1 -0
- package/dist/app/editor/SearchPlugin.js +379 -0
- package/dist/app/editor/SelectionContextMenuPlugin.d.ts +29 -0
- package/dist/app/editor/SelectionContextMenuPlugin.js +160 -0
- package/dist/app/editor/SlashMenu.d.ts +11 -0
- package/dist/app/editor/SlashMenu.js +494 -0
- package/dist/app/editor/SlashMenuPlugin.d.ts +1 -0
- package/dist/app/editor/SlashMenuPlugin.js +168 -0
- package/dist/app/editor/TableActionsPlugin.d.ts +1 -0
- package/dist/app/editor/TableActionsPlugin.js +398 -0
- package/dist/app/editor/TogglePlugin.d.ts +1 -0
- package/dist/app/editor/TogglePlugin.js +159 -0
- package/dist/app/editor/Toolbar.d.ts +10 -0
- package/dist/app/editor/Toolbar.js +263 -0
- package/dist/app/editor/WikiLinkExistencePlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkExistencePlugin.js +104 -0
- package/dist/app/editor/WikiLinkFormatPlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkFormatPlugin.js +203 -0
- package/dist/app/editor/annotation-marks.d.ts +177 -0
- package/dist/app/editor/annotation-marks.js +750 -0
- package/dist/app/editor/annotationCommands.d.ts +13 -0
- package/dist/app/editor/annotationCommands.js +11 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.d.ts +35 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.js +299 -0
- package/dist/app/editor/c4/edge-clipping.d.ts +24 -0
- package/dist/app/editor/c4/edge-clipping.js +139 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.d.ts +38 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.js +112 -0
- package/dist/app/editor/c4/layout.d.ts +25 -0
- package/dist/app/editor/c4/layout.js +839 -0
- package/dist/app/editor/c4/parser.d.ts +19 -0
- package/dist/app/editor/c4/parser.js +410 -0
- package/dist/app/editor/c4/render-to-string.d.ts +24 -0
- package/dist/app/editor/c4/render-to-string.js +34 -0
- package/dist/app/editor/c4/renderer.d.ts +64 -0
- package/dist/app/editor/c4/renderer.js +569 -0
- package/dist/app/editor/c4/types.d.ts +203 -0
- package/dist/app/editor/c4/types.js +43 -0
- package/dist/app/editor/correction-yaml.d.ts +10 -0
- package/dist/app/editor/correction-yaml.js +40 -0
- package/dist/app/editor/editorNodes.d.ts +9 -0
- package/dist/app/editor/editorNodes.js +36 -0
- package/dist/app/editor/index.d.ts +1 -0
- package/dist/app/editor/index.js +1 -0
- package/dist/app/editor/mark-overlap-resolver.d.ts +6 -0
- package/dist/app/editor/mark-overlap-resolver.js +45 -0
- package/dist/app/editor/nodes/C4Component.d.ts +14 -0
- package/dist/app/editor/nodes/C4Component.js +284 -0
- package/dist/app/editor/nodes/C4Node.d.ts +32 -0
- package/dist/app/editor/nodes/C4Node.js +112 -0
- package/dist/app/editor/nodes/CalloutNode.d.ts +23 -0
- package/dist/app/editor/nodes/CalloutNode.js +94 -0
- package/dist/app/editor/nodes/CustomLinkNode.d.ts +57 -0
- package/dist/app/editor/nodes/CustomLinkNode.js +209 -0
- package/dist/app/editor/nodes/CustomListItemNode.d.ts +46 -0
- package/dist/app/editor/nodes/CustomListItemNode.js +120 -0
- package/dist/app/editor/nodes/CustomListNode.d.ts +27 -0
- package/dist/app/editor/nodes/CustomListNode.js +54 -0
- package/dist/app/editor/nodes/DefinitionListNode.d.ts +44 -0
- package/dist/app/editor/nodes/DefinitionListNode.js +151 -0
- package/dist/app/editor/nodes/DiagramContextMenu.d.ts +45 -0
- package/dist/app/editor/nodes/DiagramContextMenu.js +116 -0
- package/dist/app/editor/nodes/EquationComponent.d.ts +17 -0
- package/dist/app/editor/nodes/EquationComponent.js +130 -0
- package/dist/app/editor/nodes/EquationNode.d.ts +43 -0
- package/dist/app/editor/nodes/EquationNode.js +179 -0
- package/dist/app/editor/nodes/FootnoteNode.d.ts +40 -0
- package/dist/app/editor/nodes/FootnoteNode.js +151 -0
- package/dist/app/editor/nodes/FrontmatterNode.d.ts +24 -0
- package/dist/app/editor/nodes/FrontmatterNode.js +88 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.d.ts +17 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.js +57 -0
- package/dist/app/editor/nodes/HtmlNode.d.ts +32 -0
- package/dist/app/editor/nodes/HtmlNode.js +121 -0
- package/dist/app/editor/nodes/ImageComponent.d.ts +11 -0
- package/dist/app/editor/nodes/ImageComponent.js +228 -0
- package/dist/app/editor/nodes/ImageNode.d.ts +53 -0
- package/dist/app/editor/nodes/ImageNode.js +183 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.d.ts +42 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.js +95 -0
- package/dist/app/editor/nodes/MermaidComponent.d.ts +11 -0
- package/dist/app/editor/nodes/MermaidComponent.js +216 -0
- package/dist/app/editor/nodes/MermaidNode.d.ts +27 -0
- package/dist/app/editor/nodes/MermaidNode.js +96 -0
- package/dist/app/editor/nodes/ToggleNode.d.ts +56 -0
- package/dist/app/editor/nodes/ToggleNode.js +237 -0
- package/dist/app/editor/nodes/diagram-context-menu.d.ts +11 -0
- package/dist/app/editor/nodes/diagram-context-menu.js +70 -0
- package/dist/app/editor/nodes/diagram-utils.d.ts +13 -0
- package/dist/app/editor/nodes/diagram-utils.js +29 -0
- package/dist/app/editor/nodes/index.d.ts +30 -0
- package/dist/app/editor/nodes/index.js +17 -0
- package/dist/app/editor/utils.d.ts +2 -0
- package/dist/app/editor/utils.js +17 -0
- package/dist/app/mapper/index.d.ts +3 -0
- package/dist/app/mapper/index.js +2 -0
- package/dist/app/mapper/lexicalToMdast.d.ts +62 -0
- package/dist/app/mapper/lexicalToMdast.js +1937 -0
- package/dist/app/mapper/mdastToLexical.d.ts +31 -0
- package/dist/app/mapper/mdastToLexical.js +1075 -0
- package/dist/contract.d.ts +8 -0
- package/dist/contract.js +8 -0
- package/dist/headless.d.ts +40 -0
- package/dist/headless.js +45 -0
- package/dist/host/context.d.ts +20 -0
- package/dist/host/context.js +24 -0
- package/dist/host/defaults.d.ts +21 -0
- package/dist/host/defaults.js +47 -0
- package/dist/host/messages.d.ts +26 -0
- package/dist/host/messages.js +47 -0
- package/dist/host/types.d.ts +75 -0
- package/dist/host/types.js +13 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +51 -0
- package/dist/markdown/annotate-sentinels.d.ts +42 -0
- package/dist/markdown/annotate-sentinels.js +86 -0
- package/dist/markdown/parse.d.ts +56 -0
- package/dist/markdown/parse.js +516 -0
- package/dist/markdown/stringify.d.ts +7 -0
- package/dist/markdown/stringify.js +439 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/LICENSE +21 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/README.md +41 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.d.ts +72 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.js +127 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.d.ts +8 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.js +6 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.d.ts +17 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.js +33 -0
- package/dist/markdown.d.ts +28 -0
- package/dist/markdown.js +44 -0
- package/dist/mathjax-config.d.ts +89 -0
- package/dist/mathjax-config.js +133 -0
- package/dist/nodes.d.ts +34 -0
- package/dist/nodes.js +34 -0
- package/dist/stores/correctionStore.d.ts +15 -0
- package/dist/stores/correctionStore.js +12 -0
- package/dist/stores/editorStore.d.ts +16 -0
- package/dist/stores/editorStore.js +27 -0
- package/dist/styles.css +2477 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +91 -0
- package/dist/utils/file-types.d.ts +10 -0
- package/dist/utils/file-types.js +46 -0
- package/docs/annotations.md +134 -0
- package/docs/decisions/README.md +72 -0
- package/docs/decisions/adr-002.md +27 -0
- package/docs/decisions/adr-007.md +27 -0
- package/docs/decisions/adr-010.md +26 -0
- package/docs/decisions/adr-024.md +124 -0
- package/docs/decisions/adr-024b.md +0 -0
- package/docs/decisions/adr-025.md +103 -0
- package/docs/decisions/adr-027.md +66 -0
- package/docs/decisions/adr-057.md +67 -0
- package/docs/decisions/adr-070.md +131 -0
- package/docs/decisions/adr-075.md +410 -0
- package/docs/decisions/adr-076.md +183 -0
- package/docs/decisions/adr-077.md +410 -0
- package/docs/decisions/adr-078.md +243 -0
- package/docs/decisions/adr-079.md +167 -0
- package/docs/decisions/adr-080.md +325 -0
- package/docs/decisions/adr-081.md +108 -0
- package/docs/decisions/adr-082.md +123 -0
- package/docs/decisions/adr-083.md +204 -0
- package/docs/decisions/adr-084.md +179 -0
- package/docs/editor-api.md +106 -0
- package/docs/markdown-pipeline.md +282 -0
- package/docs/provenance.md +106 -0
- package/docs/zusammen-editor-capability-map.md +232 -0
- package/package.json +175 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TextEditSchema: z.ZodObject<{
|
|
3
|
+
start: z.ZodNumber;
|
|
4
|
+
end: z.ZodNumber;
|
|
5
|
+
newText: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const CodeThemeSchema: z.ZodEnum<{
|
|
8
|
+
auto: "auto";
|
|
9
|
+
dark: "dark";
|
|
10
|
+
light: "light";
|
|
11
|
+
"github-dark": "github-dark";
|
|
12
|
+
"github-light": "github-light";
|
|
13
|
+
monokai: "monokai";
|
|
14
|
+
}>;
|
|
15
|
+
export declare const ImagePathResolutionSchema: z.ZodEnum<{
|
|
16
|
+
document: "document";
|
|
17
|
+
workspace: "workspace";
|
|
18
|
+
}>;
|
|
19
|
+
export declare const ThemeOverridesSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
20
|
+
export declare const SlashMDSettingsSchema: z.ZodObject<{
|
|
21
|
+
assetsFolder: z.ZodString;
|
|
22
|
+
imagePathResolution: z.ZodEnum<{
|
|
23
|
+
document: "document";
|
|
24
|
+
workspace: "workspace";
|
|
25
|
+
}>;
|
|
26
|
+
formatWrap: z.ZodNumber;
|
|
27
|
+
calloutsStyle: z.ZodEnum<{
|
|
28
|
+
admonition: "admonition";
|
|
29
|
+
emoji: "emoji";
|
|
30
|
+
}>;
|
|
31
|
+
togglesSyntax: z.ZodEnum<{
|
|
32
|
+
details: "details";
|
|
33
|
+
list: "list";
|
|
34
|
+
}>;
|
|
35
|
+
mathEnabled: z.ZodBoolean;
|
|
36
|
+
mermaidEnabled: z.ZodBoolean;
|
|
37
|
+
codeTheme: z.ZodEnum<{
|
|
38
|
+
auto: "auto";
|
|
39
|
+
dark: "dark";
|
|
40
|
+
light: "light";
|
|
41
|
+
"github-dark": "github-dark";
|
|
42
|
+
"github-light": "github-light";
|
|
43
|
+
monokai: "monokai";
|
|
44
|
+
}>;
|
|
45
|
+
headingColor: z.ZodString;
|
|
46
|
+
h1Color: z.ZodString;
|
|
47
|
+
h2Color: z.ZodString;
|
|
48
|
+
h3Color: z.ZodString;
|
|
49
|
+
h4Color: z.ZodString;
|
|
50
|
+
h5Color: z.ZodString;
|
|
51
|
+
h1Indent: z.ZodString;
|
|
52
|
+
h2Indent: z.ZodString;
|
|
53
|
+
h3Indent: z.ZodString;
|
|
54
|
+
h4Indent: z.ZodString;
|
|
55
|
+
h5Indent: z.ZodString;
|
|
56
|
+
boldColor: z.ZodString;
|
|
57
|
+
italicColor: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export declare const DocInitMessageSchema: z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"DOC_INIT">;
|
|
61
|
+
text: z.ZodString;
|
|
62
|
+
settings: z.ZodObject<{
|
|
63
|
+
assetsFolder: z.ZodString;
|
|
64
|
+
imagePathResolution: z.ZodEnum<{
|
|
65
|
+
document: "document";
|
|
66
|
+
workspace: "workspace";
|
|
67
|
+
}>;
|
|
68
|
+
formatWrap: z.ZodNumber;
|
|
69
|
+
calloutsStyle: z.ZodEnum<{
|
|
70
|
+
admonition: "admonition";
|
|
71
|
+
emoji: "emoji";
|
|
72
|
+
}>;
|
|
73
|
+
togglesSyntax: z.ZodEnum<{
|
|
74
|
+
details: "details";
|
|
75
|
+
list: "list";
|
|
76
|
+
}>;
|
|
77
|
+
mathEnabled: z.ZodBoolean;
|
|
78
|
+
mermaidEnabled: z.ZodBoolean;
|
|
79
|
+
codeTheme: z.ZodEnum<{
|
|
80
|
+
auto: "auto";
|
|
81
|
+
dark: "dark";
|
|
82
|
+
light: "light";
|
|
83
|
+
"github-dark": "github-dark";
|
|
84
|
+
"github-light": "github-light";
|
|
85
|
+
monokai: "monokai";
|
|
86
|
+
}>;
|
|
87
|
+
headingColor: z.ZodString;
|
|
88
|
+
h1Color: z.ZodString;
|
|
89
|
+
h2Color: z.ZodString;
|
|
90
|
+
h3Color: z.ZodString;
|
|
91
|
+
h4Color: z.ZodString;
|
|
92
|
+
h5Color: z.ZodString;
|
|
93
|
+
h1Indent: z.ZodString;
|
|
94
|
+
h2Indent: z.ZodString;
|
|
95
|
+
h3Indent: z.ZodString;
|
|
96
|
+
h4Indent: z.ZodString;
|
|
97
|
+
h5Indent: z.ZodString;
|
|
98
|
+
boldColor: z.ZodString;
|
|
99
|
+
italicColor: z.ZodString;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
assetBaseUri: z.ZodOptional<z.ZodString>;
|
|
102
|
+
documentDirUri: z.ZodOptional<z.ZodString>;
|
|
103
|
+
themeOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
export declare const DocChangedMessageSchema: z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"DOC_CHANGED">;
|
|
107
|
+
text: z.ZodString;
|
|
108
|
+
range: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
start: z.ZodNumber;
|
|
110
|
+
end: z.ZodNumber;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export declare const AssetWrittenMessageSchema: z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"ASSET_WRITTEN">;
|
|
115
|
+
relPath: z.ZodString;
|
|
116
|
+
webviewUri: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
export declare const AssetWriteFailedMessageSchema: z.ZodObject<{
|
|
119
|
+
type: z.ZodLiteral<"ASSET_WRITE_FAILED">;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export declare const SettingsChangedMessageSchema: z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<"SETTINGS_CHANGED">;
|
|
123
|
+
settings: z.ZodObject<{
|
|
124
|
+
assetsFolder: z.ZodString;
|
|
125
|
+
imagePathResolution: z.ZodEnum<{
|
|
126
|
+
document: "document";
|
|
127
|
+
workspace: "workspace";
|
|
128
|
+
}>;
|
|
129
|
+
formatWrap: z.ZodNumber;
|
|
130
|
+
calloutsStyle: z.ZodEnum<{
|
|
131
|
+
admonition: "admonition";
|
|
132
|
+
emoji: "emoji";
|
|
133
|
+
}>;
|
|
134
|
+
togglesSyntax: z.ZodEnum<{
|
|
135
|
+
details: "details";
|
|
136
|
+
list: "list";
|
|
137
|
+
}>;
|
|
138
|
+
mathEnabled: z.ZodBoolean;
|
|
139
|
+
mermaidEnabled: z.ZodBoolean;
|
|
140
|
+
codeTheme: z.ZodEnum<{
|
|
141
|
+
auto: "auto";
|
|
142
|
+
dark: "dark";
|
|
143
|
+
light: "light";
|
|
144
|
+
"github-dark": "github-dark";
|
|
145
|
+
"github-light": "github-light";
|
|
146
|
+
monokai: "monokai";
|
|
147
|
+
}>;
|
|
148
|
+
headingColor: z.ZodString;
|
|
149
|
+
h1Color: z.ZodString;
|
|
150
|
+
h2Color: z.ZodString;
|
|
151
|
+
h3Color: z.ZodString;
|
|
152
|
+
h4Color: z.ZodString;
|
|
153
|
+
h5Color: z.ZodString;
|
|
154
|
+
h1Indent: z.ZodString;
|
|
155
|
+
h2Indent: z.ZodString;
|
|
156
|
+
h3Indent: z.ZodString;
|
|
157
|
+
h4Indent: z.ZodString;
|
|
158
|
+
h5Indent: z.ZodString;
|
|
159
|
+
boldColor: z.ZodString;
|
|
160
|
+
italicColor: z.ZodString;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
themeOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
export declare const ErrorMessageSchema: z.ZodObject<{
|
|
165
|
+
type: z.ZodLiteral<"ERROR">;
|
|
166
|
+
message: z.ZodString;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export declare const HostToUIMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"DOC_INIT">;
|
|
170
|
+
text: z.ZodString;
|
|
171
|
+
settings: z.ZodObject<{
|
|
172
|
+
assetsFolder: z.ZodString;
|
|
173
|
+
imagePathResolution: z.ZodEnum<{
|
|
174
|
+
document: "document";
|
|
175
|
+
workspace: "workspace";
|
|
176
|
+
}>;
|
|
177
|
+
formatWrap: z.ZodNumber;
|
|
178
|
+
calloutsStyle: z.ZodEnum<{
|
|
179
|
+
admonition: "admonition";
|
|
180
|
+
emoji: "emoji";
|
|
181
|
+
}>;
|
|
182
|
+
togglesSyntax: z.ZodEnum<{
|
|
183
|
+
details: "details";
|
|
184
|
+
list: "list";
|
|
185
|
+
}>;
|
|
186
|
+
mathEnabled: z.ZodBoolean;
|
|
187
|
+
mermaidEnabled: z.ZodBoolean;
|
|
188
|
+
codeTheme: z.ZodEnum<{
|
|
189
|
+
auto: "auto";
|
|
190
|
+
dark: "dark";
|
|
191
|
+
light: "light";
|
|
192
|
+
"github-dark": "github-dark";
|
|
193
|
+
"github-light": "github-light";
|
|
194
|
+
monokai: "monokai";
|
|
195
|
+
}>;
|
|
196
|
+
headingColor: z.ZodString;
|
|
197
|
+
h1Color: z.ZodString;
|
|
198
|
+
h2Color: z.ZodString;
|
|
199
|
+
h3Color: z.ZodString;
|
|
200
|
+
h4Color: z.ZodString;
|
|
201
|
+
h5Color: z.ZodString;
|
|
202
|
+
h1Indent: z.ZodString;
|
|
203
|
+
h2Indent: z.ZodString;
|
|
204
|
+
h3Indent: z.ZodString;
|
|
205
|
+
h4Indent: z.ZodString;
|
|
206
|
+
h5Indent: z.ZodString;
|
|
207
|
+
boldColor: z.ZodString;
|
|
208
|
+
italicColor: z.ZodString;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
assetBaseUri: z.ZodOptional<z.ZodString>;
|
|
211
|
+
documentDirUri: z.ZodOptional<z.ZodString>;
|
|
212
|
+
themeOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
213
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"DOC_CHANGED">;
|
|
215
|
+
text: z.ZodString;
|
|
216
|
+
range: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
start: z.ZodNumber;
|
|
218
|
+
end: z.ZodNumber;
|
|
219
|
+
}, z.core.$strip>>;
|
|
220
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
221
|
+
type: z.ZodLiteral<"ASSET_WRITTEN">;
|
|
222
|
+
relPath: z.ZodString;
|
|
223
|
+
webviewUri: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
type: z.ZodLiteral<"ASSET_WRITE_FAILED">;
|
|
226
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
227
|
+
type: z.ZodLiteral<"SETTINGS_CHANGED">;
|
|
228
|
+
settings: z.ZodObject<{
|
|
229
|
+
assetsFolder: z.ZodString;
|
|
230
|
+
imagePathResolution: z.ZodEnum<{
|
|
231
|
+
document: "document";
|
|
232
|
+
workspace: "workspace";
|
|
233
|
+
}>;
|
|
234
|
+
formatWrap: z.ZodNumber;
|
|
235
|
+
calloutsStyle: z.ZodEnum<{
|
|
236
|
+
admonition: "admonition";
|
|
237
|
+
emoji: "emoji";
|
|
238
|
+
}>;
|
|
239
|
+
togglesSyntax: z.ZodEnum<{
|
|
240
|
+
details: "details";
|
|
241
|
+
list: "list";
|
|
242
|
+
}>;
|
|
243
|
+
mathEnabled: z.ZodBoolean;
|
|
244
|
+
mermaidEnabled: z.ZodBoolean;
|
|
245
|
+
codeTheme: z.ZodEnum<{
|
|
246
|
+
auto: "auto";
|
|
247
|
+
dark: "dark";
|
|
248
|
+
light: "light";
|
|
249
|
+
"github-dark": "github-dark";
|
|
250
|
+
"github-light": "github-light";
|
|
251
|
+
monokai: "monokai";
|
|
252
|
+
}>;
|
|
253
|
+
headingColor: z.ZodString;
|
|
254
|
+
h1Color: z.ZodString;
|
|
255
|
+
h2Color: z.ZodString;
|
|
256
|
+
h3Color: z.ZodString;
|
|
257
|
+
h4Color: z.ZodString;
|
|
258
|
+
h5Color: z.ZodString;
|
|
259
|
+
h1Indent: z.ZodString;
|
|
260
|
+
h2Indent: z.ZodString;
|
|
261
|
+
h3Indent: z.ZodString;
|
|
262
|
+
h4Indent: z.ZodString;
|
|
263
|
+
h5Indent: z.ZodString;
|
|
264
|
+
boldColor: z.ZodString;
|
|
265
|
+
italicColor: z.ZodString;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
themeOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
268
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
269
|
+
type: z.ZodLiteral<"ERROR">;
|
|
270
|
+
message: z.ZodString;
|
|
271
|
+
}, z.core.$strip>], "type">;
|
|
272
|
+
export type TextEdit = z.infer<typeof TextEditSchema>;
|
|
273
|
+
export type CodeTheme = z.infer<typeof CodeThemeSchema>;
|
|
274
|
+
export type ImagePathResolution = z.infer<typeof ImagePathResolutionSchema>;
|
|
275
|
+
export type ThemeOverrides = z.infer<typeof ThemeOverridesSchema>;
|
|
276
|
+
export type SlashMDSettings = z.infer<typeof SlashMDSettingsSchema>;
|
|
277
|
+
export type HostToUIMessage = z.infer<typeof HostToUIMessageSchema>;
|
|
278
|
+
export type UIToHostMessage = {
|
|
279
|
+
type: 'APPLY_TEXT_EDITS';
|
|
280
|
+
edits: TextEdit[];
|
|
281
|
+
reason: 'typing' | 'drag' | 'paste' | 'format';
|
|
282
|
+
} | {
|
|
283
|
+
type: 'WRITE_ASSET';
|
|
284
|
+
dataUri: string;
|
|
285
|
+
suggestedName?: string;
|
|
286
|
+
} | {
|
|
287
|
+
type: 'REQUEST_INIT';
|
|
288
|
+
} | {
|
|
289
|
+
type: 'REQUEST_SETTINGS';
|
|
290
|
+
} | {
|
|
291
|
+
type: 'OPEN_LINK';
|
|
292
|
+
url: string;
|
|
293
|
+
};
|
|
294
|
+
export declare function validateHostToUIMessage(data: unknown): HostToUIMessage | null;
|
|
295
|
+
export type BlockType = 'paragraph' | 'heading1' | 'heading2' | 'heading3' | 'bulletList' | 'numberedList' | 'todoList' | 'quote' | 'code' | 'divider' | 'image' | 'table' | 'toggle' | 'callout' | 'link';
|
|
296
|
+
export type CalloutType = 'note' | 'tip' | 'warning' | 'important' | 'caution';
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// ZOD SCHEMAS - Runtime validation
|
|
4
|
+
// =============================================================================
|
|
5
|
+
export const TextEditSchema = z.object({
|
|
6
|
+
start: z.number().int().min(0),
|
|
7
|
+
end: z.number().int().min(0),
|
|
8
|
+
newText: z.string().max(10_000_000),
|
|
9
|
+
});
|
|
10
|
+
// Code theme options
|
|
11
|
+
export const CodeThemeSchema = z.enum(['auto', 'dark', 'light', 'github-dark', 'github-light', 'monokai']);
|
|
12
|
+
// Image path resolution options
|
|
13
|
+
export const ImagePathResolutionSchema = z.enum(['document', 'workspace']);
|
|
14
|
+
// Theme overrides - CSS variable values
|
|
15
|
+
export const ThemeOverridesSchema = z.record(z.string(), z.string());
|
|
16
|
+
export const SlashMDSettingsSchema = z.object({
|
|
17
|
+
assetsFolder: z.string().max(256),
|
|
18
|
+
imagePathResolution: ImagePathResolutionSchema,
|
|
19
|
+
formatWrap: z.number().int().min(0).max(1000),
|
|
20
|
+
calloutsStyle: z.enum(['admonition', 'emoji']),
|
|
21
|
+
togglesSyntax: z.enum(['details', 'list']),
|
|
22
|
+
mathEnabled: z.boolean(),
|
|
23
|
+
mermaidEnabled: z.boolean(),
|
|
24
|
+
codeTheme: CodeThemeSchema,
|
|
25
|
+
headingColor: z.string().max(64),
|
|
26
|
+
h1Color: z.string().max(64),
|
|
27
|
+
h2Color: z.string().max(64),
|
|
28
|
+
h3Color: z.string().max(64),
|
|
29
|
+
h4Color: z.string().max(64),
|
|
30
|
+
h5Color: z.string().max(64),
|
|
31
|
+
h1Indent: z.string().max(64),
|
|
32
|
+
h2Indent: z.string().max(64),
|
|
33
|
+
h3Indent: z.string().max(64),
|
|
34
|
+
h4Indent: z.string().max(64),
|
|
35
|
+
h5Indent: z.string().max(64),
|
|
36
|
+
boldColor: z.string().max(64),
|
|
37
|
+
italicColor: z.string().max(64),
|
|
38
|
+
});
|
|
39
|
+
// Host → UI message schemas
|
|
40
|
+
export const DocInitMessageSchema = z.object({
|
|
41
|
+
type: z.literal('DOC_INIT'),
|
|
42
|
+
text: z.string(),
|
|
43
|
+
settings: SlashMDSettingsSchema,
|
|
44
|
+
assetBaseUri: z.string().optional(),
|
|
45
|
+
documentDirUri: z.string().optional(),
|
|
46
|
+
themeOverrides: ThemeOverridesSchema.optional(),
|
|
47
|
+
});
|
|
48
|
+
export const DocChangedMessageSchema = z.object({
|
|
49
|
+
type: z.literal('DOC_CHANGED'),
|
|
50
|
+
text: z.string(),
|
|
51
|
+
range: z.object({
|
|
52
|
+
start: z.number().int().min(0),
|
|
53
|
+
end: z.number().int().min(0),
|
|
54
|
+
}).optional(),
|
|
55
|
+
});
|
|
56
|
+
export const AssetWrittenMessageSchema = z.object({
|
|
57
|
+
type: z.literal('ASSET_WRITTEN'),
|
|
58
|
+
relPath: z.string().max(1024),
|
|
59
|
+
webviewUri: z.string().optional(),
|
|
60
|
+
});
|
|
61
|
+
export const AssetWriteFailedMessageSchema = z.object({
|
|
62
|
+
type: z.literal('ASSET_WRITE_FAILED'),
|
|
63
|
+
});
|
|
64
|
+
export const SettingsChangedMessageSchema = z.object({
|
|
65
|
+
type: z.literal('SETTINGS_CHANGED'),
|
|
66
|
+
settings: SlashMDSettingsSchema,
|
|
67
|
+
themeOverrides: ThemeOverridesSchema.optional(),
|
|
68
|
+
});
|
|
69
|
+
export const ErrorMessageSchema = z.object({
|
|
70
|
+
type: z.literal('ERROR'),
|
|
71
|
+
message: z.string().max(10000),
|
|
72
|
+
});
|
|
73
|
+
export const HostToUIMessageSchema = z.discriminatedUnion('type', [
|
|
74
|
+
DocInitMessageSchema,
|
|
75
|
+
DocChangedMessageSchema,
|
|
76
|
+
AssetWrittenMessageSchema,
|
|
77
|
+
AssetWriteFailedMessageSchema,
|
|
78
|
+
SettingsChangedMessageSchema,
|
|
79
|
+
ErrorMessageSchema,
|
|
80
|
+
]);
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// VALIDATION HELPER
|
|
83
|
+
// =============================================================================
|
|
84
|
+
export function validateHostToUIMessage(data) {
|
|
85
|
+
const result = HostToUIMessageSchema.safeParse(data);
|
|
86
|
+
if (!result.success) {
|
|
87
|
+
console.error('SlashMD: Invalid Host→UI message:', result.error.message);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return result.data;
|
|
91
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File type detection utilities for determining how to render files in the editor.
|
|
3
|
+
*/
|
|
4
|
+
export type FileType = 'markdown' | 'image' | 'pdf' | 'mermaid' | 'code' | 'remarkable-document' | 'unknown';
|
|
5
|
+
/**
|
|
6
|
+
* Determine the file type based on path and extension.
|
|
7
|
+
* @param path - The file path to check
|
|
8
|
+
* @returns The detected file type
|
|
9
|
+
*/
|
|
10
|
+
export declare function getFileType(path: string | null): FileType;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File type detection utilities for determining how to render files in the editor.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Determine the file type based on path and extension.
|
|
6
|
+
* @param path - The file path to check
|
|
7
|
+
* @returns The detected file type
|
|
8
|
+
*/
|
|
9
|
+
export function getFileType(path) {
|
|
10
|
+
if (!path)
|
|
11
|
+
return 'unknown';
|
|
12
|
+
const ext = path.toLowerCase().split('.').pop() || '';
|
|
13
|
+
// Check for remarkable document - files inside a remarkable document folder
|
|
14
|
+
// Structure: remarkable/DocName/document.pdf, remarkable/DocName/pages/page_001.png, etc.
|
|
15
|
+
// But NOT remarkable/index.md (which is the section index markdown)
|
|
16
|
+
if (path.startsWith('remarkable/')) {
|
|
17
|
+
const parts = path.split('/');
|
|
18
|
+
// parts[0] = 'remarkable', parts[1] = DocName or filename
|
|
19
|
+
// If parts.length >= 3, it's inside a document folder (e.g., remarkable/DocName/document.pdf)
|
|
20
|
+
// If parts.length === 2 and NOT a markdown file, treat as remarkable document folder
|
|
21
|
+
if (parts.length >= 3) {
|
|
22
|
+
return 'remarkable-document';
|
|
23
|
+
}
|
|
24
|
+
// parts.length === 2: remarkable/something - check if it's the index.md or a doc folder reference
|
|
25
|
+
if (parts.length === 2 && !['md', 'mdc'].includes(ext)) {
|
|
26
|
+
return 'remarkable-document';
|
|
27
|
+
}
|
|
28
|
+
// Fall through to normal extension checking for remarkable/index.md
|
|
29
|
+
}
|
|
30
|
+
if (['md', 'mdc'].includes(ext))
|
|
31
|
+
return 'markdown';
|
|
32
|
+
if (['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg'].includes(ext))
|
|
33
|
+
return 'image';
|
|
34
|
+
if (ext === 'pdf')
|
|
35
|
+
return 'pdf';
|
|
36
|
+
if (ext === 'mmd')
|
|
37
|
+
return 'mermaid';
|
|
38
|
+
// Text and data files - use code type for syntax highlighting (aligned with EditorColumn)
|
|
39
|
+
if (['txt', 'log', 'csv', 'json', 'xml', 'yml', 'yaml'].includes(ext))
|
|
40
|
+
return 'code';
|
|
41
|
+
// Code file extensions
|
|
42
|
+
const codeExtensions = ['py', 'js', 'ts', 'jsx', 'tsx', 'java', 'c', 'cpp', 'h', 'hpp', 'rs', 'go', 'rb', 'php', 'sh', 'bash', 'mjs', 'mts', 'zsh'];
|
|
43
|
+
if (codeExtensions.includes(ext))
|
|
44
|
+
return 'code';
|
|
45
|
+
return 'unknown';
|
|
46
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Annotations
|
|
2
|
+
|
|
3
|
+
An **annotation** is a range-anchored marker over document text whose anchor
|
|
4
|
+
survives edits to the surrounding document.
|
|
5
|
+
|
|
6
|
+
Comments and corrections are not separate features here. They are two *kinds*,
|
|
7
|
+
differing only by the configuration record a host supplies. If you are building
|
|
8
|
+
something that marks up a passage and hangs your own domain object off it, you
|
|
9
|
+
are configuring a kind.
|
|
10
|
+
|
|
11
|
+
## The seam
|
|
12
|
+
|
|
13
|
+
The package owns anchor mechanics and marker rendering. Identity, storage and
|
|
14
|
+
lifecycle stay in your application:
|
|
15
|
+
|
|
16
|
+
- `id` is **opaque** to the package. You mint it and you persist it.
|
|
17
|
+
- `payload` is **carried through untouched** and handed back on activation, so
|
|
18
|
+
you can round-trip your own domain object without the package understanding it.
|
|
19
|
+
- Resolution outcomes are **computed by you** — via `resolveAnchors` or your own
|
|
20
|
+
store. The package never classifies on your behalf.
|
|
21
|
+
|
|
22
|
+
## Turning it on
|
|
23
|
+
|
|
24
|
+
Supplying `annotationKinds` is the switch. With it absent, no annotation module
|
|
25
|
+
is loaded, no command is registered and nothing renders — the surface sits
|
|
26
|
+
behind a `React.lazy()` boundary, so it is not in the chunk your app downloads.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
<Editor
|
|
30
|
+
initialContent={markdown}
|
|
31
|
+
onChange={setMarkdown}
|
|
32
|
+
annotationKinds={{
|
|
33
|
+
comment: {
|
|
34
|
+
markerStyle: 'highlight',
|
|
35
|
+
createAffordance: { surface: 'toolbar', label: 'Comment' },
|
|
36
|
+
retainMarkOnCreate: true,
|
|
37
|
+
},
|
|
38
|
+
}}
|
|
39
|
+
annotations={annotations}
|
|
40
|
+
activeAnnotationId={activeId}
|
|
41
|
+
onCreateAnnotation={handleCreate}
|
|
42
|
+
onActivateAnnotation={setActiveId}
|
|
43
|
+
/>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### `AnnotationKindConfig`
|
|
47
|
+
|
|
48
|
+
| Field | Type | Meaning |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `markerStyle` | `'highlight' \| 'squiggle' \| 'none'` | How the kind paints. `none` places no visible marker at all — used by kinds that adopt the anchor model but render nothing themselves. |
|
|
51
|
+
| `createAffordance` | `{ surface: 'toolbar' \| 'contextMenu', label?: string } \| null` | Where a user-initiated create action is offered. Omit or `null` for host-injected annotations only. |
|
|
52
|
+
| `livemarkPolicy` | `(annotation) => boolean` | Whether an annotation gets a live `MarkNode` in the document. Defaults to `shouldPlaceLiveMark(outcome)`. Consulted only when `markerStyle` is not `none`. |
|
|
53
|
+
| `retainMarkOnCreate` | `boolean` | Whether the transient capture mark stays after an anchor is captured. A composer that highlights the passage wants `true`; a kind that captures and dismisses wants `false`. |
|
|
54
|
+
|
|
55
|
+
`AnnotationKindConfigs` is `Record<string, AnnotationKindConfig>`. Kind names are
|
|
56
|
+
plain strings — the package has no closed set and gives no kind special status.
|
|
57
|
+
|
|
58
|
+
### `Annotation`
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
interface Annotation<TPayload = unknown> {
|
|
62
|
+
id: string
|
|
63
|
+
kind: string
|
|
64
|
+
anchor: Anchor
|
|
65
|
+
outcome?: 'unchanged' | 're-attached' | 'flagged' | 'orphaned' // default 'unchanged'
|
|
66
|
+
presentation?: { className?: string; label?: string }
|
|
67
|
+
payload?: TPayload
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Anchors
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { captureAnchor, resolveAnchors, ANCHOR_SCHEMA } from '@liminis/editor/annotations'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This subpath is DOM-, React- and Lexical-free, so anchors can be captured,
|
|
78
|
+
stored and resolved anywhere — a server, a worker, an Electron main process, a
|
|
79
|
+
test with no DOM. (It does depend on `zod`, which is why it is a subpath of its
|
|
80
|
+
own rather than part of `./markdown`.)
|
|
81
|
+
|
|
82
|
+
### Capture
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const anchor = captureAnchor(documentText, { start, end }, docVersion)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
An anchor stores the quoted text plus `CONTEXT_WINDOW_CHARS` (40) of surrounding
|
|
89
|
+
context on each side, along with structural context and the document version it
|
|
90
|
+
was captured against. `ANCHOR_SCHEMA` and `ANCHOR_RESOLUTION_SCHEMA` are zod
|
|
91
|
+
schemas for persisting them.
|
|
92
|
+
|
|
93
|
+
### Resolution
|
|
94
|
+
|
|
95
|
+
When the document changes, re-resolve:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const result = await resolveAnchors(anchors, newDocumentText, newDocumentVersion)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Each anchor lands in one of four outcomes:
|
|
102
|
+
|
|
103
|
+
| Outcome | Meaning | Live mark placed? |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `unchanged` | The exact range still matches | yes |
|
|
106
|
+
| `re-attached` | Found at a new offset, similarity ≥ `REATTACH_THRESHOLD` (0.6) | yes |
|
|
107
|
+
| `flagged` | A candidate exists but is uncertain, similarity ≥ `FLAG_THRESHOLD` (0.35) | no — panel only |
|
|
108
|
+
| `orphaned` | Nothing matches | no — nothing left to point at |
|
|
109
|
+
|
|
110
|
+
`flagged` and `orphaned` deliberately get no in-document mark: one would be
|
|
111
|
+
pointing at text that may not be the right text, the other at nothing. Both stay
|
|
112
|
+
visible in whatever panel your app renders. `shouldPlaceLiveMark(outcome)`
|
|
113
|
+
encodes this, and `deriveMarkerTargets` applies it across a set.
|
|
114
|
+
|
|
115
|
+
`resolveAnchor` handles a single anchor. `similarity(a, b)` is the scoring
|
|
116
|
+
function, exported so you can reuse the same measure in your own UI.
|
|
117
|
+
|
|
118
|
+
### Semantic relocation
|
|
119
|
+
|
|
120
|
+
`resolveAnchors` accepts an optional `proposeSemanticRelocation` seam: an
|
|
121
|
+
async function that gets a chance to relocate an anchor the textual matcher
|
|
122
|
+
could not place — an LLM call, typically. `noopProposeSemanticRelocation` is the
|
|
123
|
+
default and returns `null`, so nothing is relocated unless you opt in.
|
|
124
|
+
|
|
125
|
+
## Marker styling
|
|
126
|
+
|
|
127
|
+
Markers are styled by `@liminis/editor/styles.css` (the `annotation-mark-*`
|
|
128
|
+
rules). **If you do not import that stylesheet, markers are invisible** — the
|
|
129
|
+
mark nodes are placed in the document, they just have no appearance. Nothing
|
|
130
|
+
errors. This is the single most likely reason "annotations don't work" for a new
|
|
131
|
+
consumer.
|
|
132
|
+
|
|
133
|
+
Per-annotation overrides go through `presentation.className`, which is applied
|
|
134
|
+
to that annotation's marker element in addition to the kind's own class.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Architectural Decision Records
|
|
2
|
+
|
|
3
|
+
The decisions that govern this package. Each one is a **verbatim copy** of the
|
|
4
|
+
record as it stood in `verveguy/liminis` at commit `34f0d828`, the point at which
|
|
5
|
+
this package was extracted into its own repository (verveguy/liminis#995).
|
|
6
|
+
|
|
7
|
+
| ADR | Title |
|
|
8
|
+
|-----|-------|
|
|
9
|
+
| [ADR-075](adr-075.md) | The `@liminis/editor` Package Boundary Is Drawn at Persistence |
|
|
10
|
+
| [ADR-076](adr-076.md) | Markdown Serialization Is a Fixed Point, at the Cost of a One-Time Canonicalization |
|
|
11
|
+
| [ADR-077](adr-077.md) | Comments and Corrections Are Two Kinds of One Annotation Mechanism |
|
|
12
|
+
| [ADR-078](adr-078.md) | `@liminis/editor` Is Delivered by a Non-Bundling `tsc` Emit Behind `publishConfig` |
|
|
13
|
+
| [ADR-079](adr-079.md) | A Seventh Export Subpath, `./nodes`, for the Headless Mapper |
|
|
14
|
+
|
|
15
|
+
## Why these five, and why copies rather than moves
|
|
16
|
+
|
|
17
|
+
These are the ADRs that the package's own source cites. ADR-075, ADR-077 and
|
|
18
|
+
ADR-078 are cited from the host application as well, so removing them from
|
|
19
|
+
`verveguy/liminis` would have left dangling citations *there*. ADR-076 and
|
|
20
|
+
ADR-079 are package-only, but were copied rather than moved so that the source
|
|
21
|
+
repository's decision index has no holes in its numbering.
|
|
22
|
+
|
|
23
|
+
The duplication is deliberate and it is a known cost: two copies can diverge.
|
|
24
|
+
Reconciling them is a single pass scheduled against a settled repository, as part
|
|
25
|
+
of the eventual decision to make this repository public. Until then, treat the
|
|
26
|
+
copies here as the record for questions about the package and the originals as
|
|
27
|
+
the record for questions about the application.
|
|
28
|
+
|
|
29
|
+
## Numbers cited inside these documents that are not in this table
|
|
30
|
+
|
|
31
|
+
The bodies below cite other ADRs — ADR-002, 007, 008, 010, 012, 024, 025, 027,
|
|
32
|
+
034, 042, 057, 070, 080. Those are decisions about the **host application**, not
|
|
33
|
+
about this package, and they are not reproduced here; importing them would drag
|
|
34
|
+
most of an unrelated decision index in behind them.
|
|
35
|
+
|
|
36
|
+
They are not dangling. Every one of them resolves in the source repository, at
|
|
37
|
+
`docs/project_notes/decisions/adr-0NNN.md` in `verveguy/liminis`.
|
|
38
|
+
|
|
39
|
+
The documents are kept byte-identical to their originals rather than rewritten to
|
|
40
|
+
remove those references. Rewriting them would fork the two copies on day one and
|
|
41
|
+
make the reconciliation pass above a manual read instead of a `diff`. Where one
|
|
42
|
+
of those application decisions was cited *by this package's own code*, the
|
|
43
|
+
citation was removed and its reasoning inlined at the call site instead — see
|
|
44
|
+
`docs/provenance.md`.
|
|
45
|
+
|
|
46
|
+
## Cross-references to records that stayed behind
|
|
47
|
+
|
|
48
|
+
These records were extracted from a larger decision log. Where one of them cites
|
|
49
|
+
an ADR that is **not** in this directory, that record is a Liminis *application*
|
|
50
|
+
decision — about the Electron shell, IPC, agent integration, the knowledge graph
|
|
51
|
+
or settings persistence — which deliberately did not travel, because it does not
|
|
52
|
+
govern this package.
|
|
53
|
+
|
|
54
|
+
Currently referenced but not present:
|
|
55
|
+
|
|
56
|
+
| cited | what it is | cited by |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| ADR-003 | Claude Agent SDK for AI integration | `adr-080` |
|
|
59
|
+
| ADR-008 | MCP server integration with per-chat permissions | `adr-077`, `adr-080` |
|
|
60
|
+
| ADR-012 | Component/BOM system for workspace tracking | `adr-077`, `adr-080` |
|
|
61
|
+
| ADR-032 | Main process owns all state; renderer is reactive | `adr-080` |
|
|
62
|
+
| ADR-034 | Claude Code configuration strategy | `adr-075` |
|
|
63
|
+
| ADR-042 | Context graph concurrent read/write architecture | `adr-075`, `adr-077` |
|
|
64
|
+
| ADR-055 | Atomic, serialized settings persistence | `adr-057` |
|
|
65
|
+
|
|
66
|
+
Chasing these to closure would import most of an 81-record log describing an
|
|
67
|
+
application this package does not depend on. The citations are left intact
|
|
68
|
+
rather than edited out, so the records stay verbatim copies and the reasoning
|
|
69
|
+
remains traceable for anyone who does have access to the Liminis repository.
|
|
70
|
+
|
|
71
|
+
**No document outside `docs/decisions/` cites a missing record** — the package's
|
|
72
|
+
own documentation (`README.md`, `docs/*.md`) is self-contained.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ADR-002: Lexical for Rich Text Editing (2026-01-25)
|
|
2
|
+
|
|
3
|
+
**Context:**
|
|
4
|
+
- Need a markdown editor with rich features (wikilinks, frontmatter, tables, math, mermaid)
|
|
5
|
+
- Must support custom node types for specialized rendering
|
|
6
|
+
- Performance matters for large documents
|
|
7
|
+
- Need full control over editing behavior
|
|
8
|
+
|
|
9
|
+
**Decision:**
|
|
10
|
+
- Use Lexical (Meta's editor framework) as the foundation
|
|
11
|
+
- Build custom nodes for: wikilinks, frontmatter, callouts, toggles, equations, mermaid diagrams, images
|
|
12
|
+
- Implement bidirectional markdown conversion (mdast ↔ Lexical)
|
|
13
|
+
- Use plugin architecture for features (slash menu, drag handles, shortcuts)
|
|
14
|
+
|
|
15
|
+
**Alternatives Considered:**
|
|
16
|
+
- ProseMirror → Rejected: steeper learning curve, more boilerplate
|
|
17
|
+
- TipTap → Rejected: ProseMirror wrapper adds abstraction layer
|
|
18
|
+
- Monaco Editor → Rejected: better for code, not rich markdown
|
|
19
|
+
- ContentEditable directly → Rejected: too low-level, browser inconsistencies
|
|
20
|
+
|
|
21
|
+
**Consequences:**
|
|
22
|
+
- ✅ Extensible node system for custom markdown features
|
|
23
|
+
- ✅ Good performance with large documents
|
|
24
|
+
- ✅ Active development and community
|
|
25
|
+
- ✅ Better control than contenteditable alternatives
|
|
26
|
+
- ❌ Requires custom markdown parsing/serialization layer
|
|
27
|
+
- ❌ Learning curve for Lexical's architecture
|