@elabs-ai/components-editor 4.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.
Files changed (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +149 -0
  3. package/dist/chunk-LBC5VJBD.js +3748 -0
  4. package/dist/chunk-LBC5VJBD.js.map +1 -0
  5. package/dist/index.css +233 -0
  6. package/dist/index.css.map +1 -0
  7. package/dist/index.d.ts +199 -0
  8. package/dist/index.js +362 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/lib/monaco-environment.d.ts +2 -0
  11. package/dist/lib/monaco-environment.js +44 -0
  12. package/dist/lib/monaco-environment.js.map +1 -0
  13. package/dist/markdown/frontmatter.d.ts +11 -0
  14. package/dist/markdown/frontmatter.js +33 -0
  15. package/dist/markdown/frontmatter.js.map +1 -0
  16. package/dist/markdown/index.css +233 -0
  17. package/dist/markdown/index.css.map +1 -0
  18. package/dist/markdown/index.d.ts +1486 -0
  19. package/dist/markdown/index.js +4882 -0
  20. package/dist/markdown/index.js.map +1 -0
  21. package/dist/markdown/parse.d.ts +25 -0
  22. package/dist/markdown/parse.js +14 -0
  23. package/dist/markdown/parse.js.map +1 -0
  24. package/dist/markdown-editor-DfBZibAn.d.ts +702 -0
  25. package/package.json +101 -0
  26. package/src/ai-objects/ai-objects-integration.test.tsx +128 -0
  27. package/src/ai-objects/ai-objects.stories.tsx +233 -0
  28. package/src/ai-objects/ai-objects.test.tsx +205 -0
  29. package/src/ai-objects/decision-card.tsx +178 -0
  30. package/src/ai-objects/directives.ts +136 -0
  31. package/src/ai-objects/entity.tsx +181 -0
  32. package/src/ai-objects/index.ts +34 -0
  33. package/src/ai-objects/knowledge-card.tsx +143 -0
  34. package/src/calc-block/calc-block.stories.tsx +297 -0
  35. package/src/calc-block/calc-block.test.tsx +164 -0
  36. package/src/calc-block/calc-block.tsx +398 -0
  37. package/src/calc-block/calc-editor-monaco.ts +214 -0
  38. package/src/calc-block/calc-editor-prose.ts +128 -0
  39. package/src/calc-block/calc-editor.css +80 -0
  40. package/src/calc-block/calc-editor.stories.tsx +272 -0
  41. package/src/calc-block/calc-editor.test.ts +228 -0
  42. package/src/calc-block/calc-editor.ts +270 -0
  43. package/src/calc-block/calc-inline.stories.tsx +44 -0
  44. package/src/calc-block/calc-inline.test.tsx +44 -0
  45. package/src/calc-block/calc-inline.tsx +75 -0
  46. package/src/calc-block/index.ts +20 -0
  47. package/src/calc-block/types.ts +164 -0
  48. package/src/code-editor/code-editor.stories.tsx +218 -0
  49. package/src/code-editor/code-editor.test.tsx +134 -0
  50. package/src/code-editor/code-editor.tsx +250 -0
  51. package/src/code-editor/index.ts +6 -0
  52. package/src/code-workspace/code-workspace.stories.tsx +51 -0
  53. package/src/code-workspace/code-workspace.test.tsx +146 -0
  54. package/src/code-workspace/code-workspace.tsx +253 -0
  55. package/src/code-workspace/index.ts +6 -0
  56. package/src/copy-button/copy-button.tsx +51 -0
  57. package/src/copy-button/index.ts +1 -0
  58. package/src/css.d.ts +3 -0
  59. package/src/diff-editor/diff-editor.stories.tsx +44 -0
  60. package/src/diff-editor/diff-editor.test.tsx +68 -0
  61. package/src/diff-editor/diff-editor.tsx +151 -0
  62. package/src/diff-editor/index.ts +1 -0
  63. package/src/editor-context-menu/editor-context-menu.tsx +120 -0
  64. package/src/editor-context-menu/index.ts +1 -0
  65. package/src/editor-toolbar/editor-toolbar.tsx +83 -0
  66. package/src/editor-toolbar/index.ts +1 -0
  67. package/src/index.ts +48 -0
  68. package/src/lib/editor-completions-monaco.test.ts +206 -0
  69. package/src/lib/editor-completions-monaco.ts +127 -0
  70. package/src/lib/editor-completions.test.ts +156 -0
  71. package/src/lib/editor-completions.ts +153 -0
  72. package/src/lib/editor-content-access-prose.test.ts +411 -0
  73. package/src/lib/editor-content-access-prose.ts +172 -0
  74. package/src/lib/editor-content-access.test.ts +182 -0
  75. package/src/lib/editor-content-access.ts +109 -0
  76. package/src/lib/languages.ts +32 -0
  77. package/src/lib/markdown/diff.test.ts +80 -0
  78. package/src/lib/markdown/diff.ts +194 -0
  79. package/src/lib/markdown/directives.ts +342 -0
  80. package/src/lib/markdown/frontmatter.ts +50 -0
  81. package/src/lib/markdown/markdown-scale.test.ts +65 -0
  82. package/src/lib/markdown/markdown-scale.ts +62 -0
  83. package/src/lib/markdown/merge.test.ts +64 -0
  84. package/src/lib/markdown/merge.ts +158 -0
  85. package/src/lib/markdown/slugify.test.ts +156 -0
  86. package/src/lib/markdown/slugify.ts +47 -0
  87. package/src/lib/monaco-environment.ts +103 -0
  88. package/src/lib/monaco-theme-bridge.ts +293 -0
  89. package/src/lib/use-data-theme.ts +61 -0
  90. package/src/markdown/frontmatter.ts +14 -0
  91. package/src/markdown/index.ts +323 -0
  92. package/src/markdown/parse.test.ts +60 -0
  93. package/src/markdown/parse.ts +38 -0
  94. package/src/markdown-academic/citations.test.ts +77 -0
  95. package/src/markdown-academic/citations.tsx +442 -0
  96. package/src/markdown-academic/footnotes.tsx +235 -0
  97. package/src/markdown-academic/index.ts +32 -0
  98. package/src/markdown-academic/math.tsx +163 -0
  99. package/src/markdown-academic/toc.tsx +88 -0
  100. package/src/markdown-editor/completions/completions-menu.tsx +96 -0
  101. package/src/markdown-editor/completions/completions-prose.test.ts +356 -0
  102. package/src/markdown-editor/completions/completions-prose.ts +313 -0
  103. package/src/markdown-editor/completions/completions-widget.tsx +75 -0
  104. package/src/markdown-editor/completions/index.ts +37 -0
  105. package/src/markdown-editor/directive-nodes.ts +151 -0
  106. package/src/markdown-editor/directive-views.test.tsx +189 -0
  107. package/src/markdown-editor/directive-views.tsx +795 -0
  108. package/src/markdown-editor/exit-keymap.test.ts +88 -0
  109. package/src/markdown-editor/exit-keymap.ts +87 -0
  110. package/src/markdown-editor/index.ts +6 -0
  111. package/src/markdown-editor/markdown-editor.css +250 -0
  112. package/src/markdown-editor/markdown-editor.directives.test.tsx +105 -0
  113. package/src/markdown-editor/markdown-editor.fill.test.ts +34 -0
  114. package/src/markdown-editor/markdown-editor.paste-embed.test.tsx +297 -0
  115. package/src/markdown-editor/markdown-editor.stories.tsx +560 -0
  116. package/src/markdown-editor/markdown-editor.strictmode.test.tsx +38 -0
  117. package/src/markdown-editor/markdown-editor.table.test.tsx +287 -0
  118. package/src/markdown-editor/markdown-editor.tsx +560 -0
  119. package/src/markdown-editor/milkdown-react/editor.tsx +33 -0
  120. package/src/markdown-editor/milkdown-react/index.ts +8 -0
  121. package/src/markdown-editor/milkdown-react/types.ts +27 -0
  122. package/src/markdown-editor/milkdown-react/use-editor.ts +27 -0
  123. package/src/markdown-editor/milkdown-react/use-get-editor.ts +56 -0
  124. package/src/markdown-editor/milkdown-react/use-instance.ts +23 -0
  125. package/src/markdown-editor/paste-embed.ts +355 -0
  126. package/src/markdown-editor/slash/brand-slash-commands.test.ts +194 -0
  127. package/src/markdown-editor/slash/brand-slash-commands.ts +324 -0
  128. package/src/markdown-editor/slash/brand-slash-plugin.test.ts +254 -0
  129. package/src/markdown-editor/slash/brand-slash-plugin.ts +385 -0
  130. package/src/markdown-editor/slash/index.ts +107 -0
  131. package/src/markdown-editor/slash/insert-directive.test.ts +263 -0
  132. package/src/markdown-editor/slash/insert-directive.ts +345 -0
  133. package/src/markdown-editor/slash/monaco-slash-menu.test.tsx +198 -0
  134. package/src/markdown-editor/slash/monaco-slash-menu.tsx +356 -0
  135. package/src/markdown-editor/slash/shortcut-monaco.ts +69 -0
  136. package/src/markdown-editor/slash/shortcut.test.ts +157 -0
  137. package/src/markdown-editor/slash/shortcut.ts +57 -0
  138. package/src/markdown-editor/slash/slash-menu.stories.tsx +139 -0
  139. package/src/markdown-editor/slash/slash-menu.tsx +115 -0
  140. package/src/markdown-editor/slash/slash-scroll.test.tsx +52 -0
  141. package/src/markdown-editor/slash/slash-widget.tsx +97 -0
  142. package/src/markdown-editor/slash/source-slash-trigger.test.ts +42 -0
  143. package/src/markdown-editor/slash/source-slash-trigger.ts +46 -0
  144. package/src/markdown-editor/table-view.tsx +249 -0
  145. package/src/markdown-iteration/directive.tsx +92 -0
  146. package/src/markdown-iteration/edit-context.ts +56 -0
  147. package/src/markdown-iteration/index.ts +24 -0
  148. package/src/markdown-iteration/iteration-block.test.tsx +138 -0
  149. package/src/markdown-iteration/iteration-builder-dialog.stories.tsx +293 -0
  150. package/src/markdown-iteration/iteration-builder-dialog.tsx +312 -0
  151. package/src/markdown-iteration/iteration-builder.test.ts +252 -0
  152. package/src/markdown-iteration/iteration-builder.ts +303 -0
  153. package/src/markdown-iteration/iteration.test.ts +56 -0
  154. package/src/markdown-iteration/iteration.tsx +333 -0
  155. package/src/markdown-iteration/template-dialog.stories.tsx +63 -0
  156. package/src/markdown-iteration/template-dialog.test.tsx +104 -0
  157. package/src/markdown-iteration/template-dialog.tsx +116 -0
  158. package/src/markdown-outline/document-outline.stories.tsx +76 -0
  159. package/src/markdown-outline/document-outline.tsx +83 -0
  160. package/src/markdown-outline/index.ts +2 -0
  161. package/src/markdown-outline/markdown-outline.test.ts +49 -0
  162. package/src/markdown-outline/markdown-outline.ts +60 -0
  163. package/src/markdown-preview/code-fence.tsx +193 -0
  164. package/src/markdown-preview/index.ts +8 -0
  165. package/src/markdown-preview/markdown-preview-academic.stories.tsx +203 -0
  166. package/src/markdown-preview/markdown-preview-academic.test.tsx +257 -0
  167. package/src/markdown-preview/markdown-preview-iteration-calc.test.tsx +71 -0
  168. package/src/markdown-preview/markdown-preview-iteration-nested.test.tsx +58 -0
  169. package/src/markdown-preview/markdown-preview-iteration.stories.tsx +187 -0
  170. package/src/markdown-preview/markdown-preview-iteration.test.tsx +90 -0
  171. package/src/markdown-preview/markdown-preview-linking.test.tsx +61 -0
  172. package/src/markdown-preview/markdown-preview-transclusion.test.tsx +33 -0
  173. package/src/markdown-preview/markdown-preview.stories.tsx +108 -0
  174. package/src/markdown-preview/markdown-preview.test.tsx +411 -0
  175. package/src/markdown-preview/markdown-preview.tsx +1541 -0
  176. package/src/markdown-toolbar/index.ts +8 -0
  177. package/src/markdown-toolbar/markdown-commands.test.ts +84 -0
  178. package/src/markdown-toolbar/markdown-commands.ts +104 -0
  179. package/src/markdown-toolbar/markdown-toolbar.stories.tsx +56 -0
  180. package/src/markdown-toolbar/markdown-toolbar.tsx +263 -0
  181. package/src/markdown-workspace/focus-writing.test.ts +52 -0
  182. package/src/markdown-workspace/focus-writing.ts +38 -0
  183. package/src/markdown-workspace/index.ts +6 -0
  184. package/src/markdown-workspace/markdown-workspace.stories.tsx +688 -0
  185. package/src/markdown-workspace/markdown-workspace.test.tsx +326 -0
  186. package/src/markdown-workspace/markdown-workspace.tsx +787 -0
  187. package/src/mermaid-diagram/index.ts +1 -0
  188. package/src/mermaid-diagram/mermaid-diagram.stories.tsx +42 -0
  189. package/src/mermaid-diagram/mermaid-diagram.test.tsx +86 -0
  190. package/src/mermaid-diagram/mermaid-diagram.tsx +318 -0
  191. package/src/mermaid-diagram/mermaid-viewer.test.tsx +89 -0
  192. package/src/mermaid-diagram/mermaid-viewer.tsx +367 -0
  193. package/src/mermaid-diagram/real-parse.test.ts +42 -0
  194. package/src/mermaid-diagram/remediate.test.ts +60 -0
  195. package/src/mermaid-diagram/remediate.ts +124 -0
  196. package/src/mermaid-workspace/index.ts +1 -0
  197. package/src/mermaid-workspace/mermaid-workspace.stories.tsx +28 -0
  198. package/src/mermaid-workspace/mermaid-workspace.tsx +71 -0
  199. package/src/metric-block/index.ts +1 -0
  200. package/src/metric-block/metric-block.stories.tsx +40 -0
  201. package/src/metric-block/metric-block.tsx +14 -0
  202. package/src/monaco-workers.d.ts +10 -0
  203. package/src/prose/index.ts +14 -0
  204. package/src/prose/prose.stories.tsx +44 -0
  205. package/src/prose/prose.test.tsx +44 -0
  206. package/src/prose/prose.tsx +21 -0
  207. package/src/timeline/index.ts +18 -0
package/dist/index.css ADDED
@@ -0,0 +1,233 @@
1
+ /* src/markdown-editor/markdown-editor.css */
2
+ .milkdown-host .ProseMirror {
3
+ outline: none;
4
+ padding: 1rem 1.1rem;
5
+ min-height: 9rem;
6
+ color: var(--foreground);
7
+ font-size: 0.875rem;
8
+ line-height: 1.65;
9
+ caret-color: var(--primary);
10
+ word-break: break-word;
11
+ max-width: var(--md-measure, 48rem);
12
+ margin-inline: auto;
13
+ }
14
+ .milkdown-host .ProseMirror:focus {
15
+ outline: none;
16
+ }
17
+ .milkdown-host {
18
+ display: flex;
19
+ flex-direction: column;
20
+ min-height: 100%;
21
+ }
22
+ .milkdown-host > div,
23
+ .milkdown-host .milkdown {
24
+ display: flex;
25
+ min-height: 0;
26
+ flex: 1 1 auto;
27
+ flex-direction: column;
28
+ }
29
+ .milkdown-host .ProseMirror.editor {
30
+ flex: 1 1 auto;
31
+ }
32
+ .milkdown-host .ProseMirror > * + * {
33
+ margin-top: 0.7em;
34
+ }
35
+ .milkdown-host .ProseMirror h1,
36
+ .milkdown-host .ProseMirror h2,
37
+ .milkdown-host .ProseMirror h3,
38
+ .milkdown-host .ProseMirror h4,
39
+ .milkdown-host .ProseMirror h5,
40
+ .milkdown-host .ProseMirror h6 {
41
+ font-weight: var(--md-heading-weight, 600);
42
+ letter-spacing: var(--md-heading-tracking, -0.025em);
43
+ line-height: 1.25;
44
+ color: var(--foreground);
45
+ margin-top: 1.1em;
46
+ }
47
+ .milkdown-host .ProseMirror h1 {
48
+ font-size: var(--md-h1, 1.5rem);
49
+ }
50
+ .milkdown-host .ProseMirror h2 {
51
+ font-size: var(--md-h2, 1.25rem);
52
+ }
53
+ .milkdown-host .ProseMirror h3 {
54
+ font-size: var(--md-h3, 1.125rem);
55
+ }
56
+ .milkdown-host .ProseMirror h4 {
57
+ font-size: var(--md-h4, 1rem);
58
+ }
59
+ .milkdown-host .ProseMirror h5 {
60
+ font-size: var(--md-h5, 0.875rem);
61
+ }
62
+ .milkdown-host .ProseMirror h6 {
63
+ font-size: var(--md-h6, 0.875rem);
64
+ color: var(--muted-foreground);
65
+ }
66
+ .milkdown-host .ProseMirror a {
67
+ color: var(--primary);
68
+ text-decoration: underline;
69
+ text-underline-offset: 2px;
70
+ }
71
+ .milkdown-host .ProseMirror strong {
72
+ font-weight: 650;
73
+ }
74
+ .milkdown-host .ProseMirror code {
75
+ font-family:
76
+ ui-monospace,
77
+ SFMono-Regular,
78
+ Menlo,
79
+ monospace;
80
+ font-size: 0.85em;
81
+ background: var(--muted);
82
+ color: var(--foreground);
83
+ padding: 0.12em 0.36em;
84
+ border-radius: calc(var(--radius) - 4px);
85
+ }
86
+ .milkdown-host .ProseMirror blockquote {
87
+ border-left: 2px solid var(--border);
88
+ padding-left: 1rem;
89
+ color: var(--muted-foreground);
90
+ }
91
+ .milkdown-host .ProseMirror pre {
92
+ background: var(--surface-muted);
93
+ border: 1px solid var(--border);
94
+ border-radius: var(--radius);
95
+ padding: 0.85rem 1rem;
96
+ overflow: auto;
97
+ }
98
+ .milkdown-host .ProseMirror pre code {
99
+ background: transparent;
100
+ padding: 0;
101
+ font-size: 0.82rem;
102
+ }
103
+ .milkdown-host .ProseMirror hr {
104
+ border: none;
105
+ border-top: 1px solid var(--border);
106
+ margin: 1.25em 0;
107
+ }
108
+ .milkdown-host .ProseMirror ul,
109
+ .milkdown-host .ProseMirror ol {
110
+ padding-left: 1.4rem;
111
+ }
112
+ .milkdown-host .ProseMirror ul {
113
+ list-style: disc;
114
+ }
115
+ .milkdown-host .ProseMirror ol {
116
+ list-style: decimal;
117
+ }
118
+ .milkdown-host .ProseMirror li > * + * {
119
+ margin-top: 0.35em;
120
+ }
121
+ .milkdown-host .ProseMirror table {
122
+ border-collapse: collapse;
123
+ width: 100%;
124
+ font-size: 0.85rem;
125
+ }
126
+ .milkdown-host .ProseMirror th,
127
+ .milkdown-host .ProseMirror td {
128
+ border: 1px solid var(--border);
129
+ padding: 0.4rem 0.6rem;
130
+ text-align: left;
131
+ }
132
+ .milkdown-host .ProseMirror th {
133
+ background: var(--surface-muted);
134
+ font-weight: 600;
135
+ }
136
+ .milkdown-host .ProseMirror ul[data-item-type=task] {
137
+ list-style: none;
138
+ padding-left: 0.25rem;
139
+ }
140
+ .milkdown-host .ProseMirror[contenteditable=false] {
141
+ caret-color: transparent;
142
+ }
143
+ .milkdown-host .brand-directive {
144
+ margin: 0.85em 0;
145
+ }
146
+ .milkdown-host .brand-directive__body > * + * {
147
+ margin-top: 0.6em;
148
+ }
149
+ .milkdown-host .brand-directive__body > :first-child {
150
+ margin-top: 0;
151
+ }
152
+ .milkdown-host .brand-directive--timeline {
153
+ border-left: 2px solid var(--border);
154
+ padding-left: 1rem;
155
+ }
156
+ .milkdown-host .brand-inline-edit {
157
+ cursor: text;
158
+ min-width: 1ch;
159
+ font: inherit;
160
+ color: inherit;
161
+ letter-spacing: inherit;
162
+ }
163
+ .milkdown-host .brand-inline-edit:empty::before {
164
+ content: attr(data-placeholder);
165
+ color: var(--muted-foreground);
166
+ opacity: 0.65;
167
+ pointer-events: none;
168
+ }
169
+ [data-focus-writing] .milkdown-host .ProseMirror > * {
170
+ opacity: 0.35;
171
+ transition: opacity var(--t-base, 200ms) var(--ease-standard, ease);
172
+ }
173
+ [data-focus-writing] .milkdown-host .ProseMirror > .wb-fw-active,
174
+ [data-focus-writing] .milkdown-host .ProseMirror > *:hover {
175
+ opacity: 1;
176
+ }
177
+ @media (prefers-reduced-motion: reduce) {
178
+ [data-focus-writing] .milkdown-host .ProseMirror > * {
179
+ transition: none;
180
+ }
181
+ }
182
+
183
+ /* src/calc-block/calc-editor.css */
184
+ .brand-calc-tok.brand-calc-tok--number,
185
+ .brand-calc-tok.brand-calc-tok--constant {
186
+ color: var(--calc-number);
187
+ }
188
+ .brand-calc-tok.brand-calc-tok--unit {
189
+ color: var(--calc-unit);
190
+ }
191
+ .brand-calc-tok.brand-calc-tok--currency {
192
+ color: var(--calc-currency);
193
+ }
194
+ .brand-calc-tok.brand-calc-tok--operator {
195
+ color: var(--calc-operator);
196
+ }
197
+ .brand-calc-tok.brand-calc-tok--function {
198
+ color: var(--calc-function);
199
+ }
200
+ .brand-calc-tok.brand-calc-tok--var-ref {
201
+ color: var(--calc-variable);
202
+ }
203
+ .brand-calc-tok.brand-calc-tok--var-def {
204
+ color: var(--calc-variable);
205
+ font-weight: 500;
206
+ }
207
+ .brand-calc-tok.brand-calc-tok--line-ref {
208
+ color: var(--calc-reference);
209
+ font-variant-numeric: tabular-nums;
210
+ }
211
+ .brand-calc-tok.brand-calc-tok--comment {
212
+ color: var(--calc-comment);
213
+ font-style: italic;
214
+ }
215
+ .brand-calc-tok.brand-calc-tok--unknown {
216
+ color: var(--calc-warning);
217
+ }
218
+ .brand-calc-tok.brand-calc-tok--unresolved {
219
+ text-decoration: underline dotted;
220
+ text-decoration-thickness: 1px;
221
+ text-underline-offset: 2px;
222
+ }
223
+ .brand-calc-inlay {
224
+ margin-inline-start: 1ch;
225
+ color: var(--calc-result);
226
+ font-variant-numeric: tabular-nums;
227
+ user-select: none;
228
+ white-space: pre;
229
+ }
230
+ .brand-calc-inlay--error {
231
+ color: var(--calc-warning);
232
+ }
233
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/markdown-editor/markdown-editor.css","../src/calc-block/calc-editor.css"],"sourcesContent":["/**\n * Token-driven theme for the Milkdown (ProseMirror) WYSIWYG surface.\n *\n * Milkdown core ships ZERO styles (headless), so this is where brand-ui owns the\n * look. Every value is a semantic design token (var(--foreground), --border,\n * --radius, …) — NO raw colors — so the editor matches all three themes\n * (light/dark) for free. Every rule\n * is scoped under `.milkdown-host` so nothing leaks globally.\n */\n\n.milkdown-host .ProseMirror {\n outline: none;\n padding: 1rem 1.1rem;\n min-height: 9rem;\n color: var(--foreground);\n font-size: 0.875rem;\n line-height: 1.65;\n caret-color: var(--primary);\n word-break: break-word;\n /* Same reading measure as the preview (max-w-3xl). Driven by the shared scale\n (--md-measure, set via markdownScaleVars) so editor + preview match (#18). */\n max-width: var(--md-measure, 48rem);\n margin-inline: auto;\n}\n\n.milkdown-host .ProseMirror:focus {\n outline: none;\n}\n\n/* ----------------------------------------------------------------------------\n * Fill height — the editable grows to fill a definite-height parent.\n *\n * Milkdown's host box is otherwise content-sized (the `.ProseMirror` floor below\n * is `min-height: 9rem`), so inside a tall pane a short document leaves a large\n * dead area below the editable AND the caret-anchored `/` slash menu clips inside\n * the short box near the bottom edge. Making `.milkdown-host` a column flex that\n * fills its parent — and letting the intermediate Milkdown wrapper + the\n * ProseMirror surface grow inside it — means the editable fills the pane\n * (clickable everywhere) and the slash menu has room to open / flip.\n *\n * `min-height: 100%` only resolves against a parent with a DEFINITE height (the\n * workspace's `h-full` wysiwyg pane, or any sized container). In an\n * indefinite-height parent it resolves to `auto`, so the standalone / short\n * editor still sizes to its content above the 9rem floor — no regression for the\n * autodocs / inline cases. (elabs-components: editor-fill-height)\n * ------------------------------------------------------------------------- */\n.milkdown-host {\n display: flex;\n flex-direction: column;\n min-height: 100%;\n}\n.milkdown-host > div,\n.milkdown-host .milkdown {\n display: flex;\n min-height: 0;\n flex: 1 1 auto;\n flex-direction: column;\n}\n.milkdown-host .ProseMirror.editor {\n flex: 1 1 auto;\n}\n\n.milkdown-host .ProseMirror > * + * {\n margin-top: 0.7em;\n}\n\n/* Headings — sizes/weight/tracking come from the SHARED markdown scale\n (markdown-scale.ts → --md-* vars on .milkdown-host), so the editor matches the\n prose `Heading` exactly and can't drift on the next edit to either side (#18).\n Fallbacks equal the canonical scale for use without the vars (e.g. clipboard). */\n.milkdown-host .ProseMirror h1,\n.milkdown-host .ProseMirror h2,\n.milkdown-host .ProseMirror h3,\n.milkdown-host .ProseMirror h4,\n.milkdown-host .ProseMirror h5,\n.milkdown-host .ProseMirror h6 {\n font-weight: var(--md-heading-weight, 600);\n letter-spacing: var(--md-heading-tracking, -0.025em);\n line-height: 1.25;\n color: var(--foreground);\n margin-top: 1.1em;\n}\n.milkdown-host .ProseMirror h1 {\n font-size: var(--md-h1, 1.5rem);\n}\n.milkdown-host .ProseMirror h2 {\n font-size: var(--md-h2, 1.25rem);\n}\n.milkdown-host .ProseMirror h3 {\n font-size: var(--md-h3, 1.125rem);\n}\n.milkdown-host .ProseMirror h4 {\n font-size: var(--md-h4, 1rem);\n}\n.milkdown-host .ProseMirror h5 {\n font-size: var(--md-h5, 0.875rem);\n}\n.milkdown-host .ProseMirror h6 {\n font-size: var(--md-h6, 0.875rem);\n color: var(--muted-foreground);\n}\n\n/* Inline */\n.milkdown-host .ProseMirror a {\n color: var(--primary);\n text-decoration: underline;\n text-underline-offset: 2px;\n}\n.milkdown-host .ProseMirror strong {\n font-weight: 650;\n}\n.milkdown-host .ProseMirror code {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 0.85em;\n background: var(--muted);\n color: var(--foreground);\n padding: 0.12em 0.36em;\n border-radius: calc(var(--radius) - 4px);\n}\n\n/* Blocks */\n.milkdown-host .ProseMirror blockquote {\n border-left: 2px solid var(--border);\n padding-left: 1rem;\n color: var(--muted-foreground);\n}\n.milkdown-host .ProseMirror pre {\n background: var(--surface-muted);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 0.85rem 1rem;\n overflow: auto;\n}\n.milkdown-host .ProseMirror pre code {\n background: transparent;\n padding: 0;\n font-size: 0.82rem;\n}\n.milkdown-host .ProseMirror hr {\n border: none;\n border-top: 1px solid var(--border);\n margin: 1.25em 0;\n}\n\n/* Lists */\n.milkdown-host .ProseMirror ul,\n.milkdown-host .ProseMirror ol {\n padding-left: 1.4rem;\n}\n.milkdown-host .ProseMirror ul {\n list-style: disc;\n}\n.milkdown-host .ProseMirror ol {\n list-style: decimal;\n}\n.milkdown-host .ProseMirror li > * + * {\n margin-top: 0.35em;\n}\n\n/* Tables (GFM) */\n.milkdown-host .ProseMirror table {\n border-collapse: collapse;\n width: 100%;\n font-size: 0.85rem;\n}\n.milkdown-host .ProseMirror th,\n.milkdown-host .ProseMirror td {\n border: 1px solid var(--border);\n padding: 0.4rem 0.6rem;\n text-align: left;\n}\n.milkdown-host .ProseMirror th {\n background: var(--surface-muted);\n font-weight: 600;\n}\n\n/* Task lists (GFM) */\n.milkdown-host .ProseMirror ul[data-item-type=\"task\"] {\n list-style: none;\n padding-left: 0.25rem;\n}\n\n/* Read-only mode dims the caret affordance */\n.milkdown-host .ProseMirror[contenteditable=\"false\"] {\n caret-color: transparent;\n}\n\n/* ---- Brand `:::` directives ----------------------------------------------------\n * These now render as LIVE @brand React components via @prosemirror-adapter/react\n * (see directive-views.tsx), so the box-model chrome (card/callout/metric borders,\n * fills, type accents) comes from the components themselves — NOT from here. This\n * section only owns what the editor adds on top: outer spacing, the editable-body\n * rhythm, the timeline frame (an editable list, not a derived <Timeline>), and the\n * inline-edit affordance for editable attributes (card/callout title, metric\n * label/value). The `toDOM` defs in directive-nodes.ts keep their own marker classes\n * for clipboard serialization but are not visually rendered while node-views are on.\n */\n.milkdown-host .brand-directive {\n margin: 0.85em 0;\n}\n.milkdown-host .brand-directive__body > * + * {\n margin-top: 0.6em;\n}\n/* The first/last editable block inside a card/callout shouldn't add stray margin\n * on top of the component's own padding. */\n.milkdown-host .brand-directive__body > :first-child {\n margin-top: 0;\n}\n\n/* timeline → keep the list editable inside a subtle frame */\n.milkdown-host .brand-directive--timeline {\n border-left: 2px solid var(--border);\n padding-left: 1rem;\n}\n\n/* Inline-editable directive attribute (seamless, caret-friendly). */\n.milkdown-host .brand-inline-edit {\n cursor: text;\n min-width: 1ch;\n /* inherit the surrounding component's type (CardTitle, MetricBlock label/value) */\n font: inherit;\n color: inherit;\n letter-spacing: inherit;\n}\n.milkdown-host .brand-inline-edit:empty::before {\n content: attr(data-placeholder);\n color: var(--muted-foreground);\n opacity: 0.65;\n pointer-events: none;\n}\n\n/* ------------------------------------------------------------------------- */\n/* Focus writing (Ulysses Phase A): under a `[data-focus-writing]` ancestor */\n/* (the workspace's wysiwyg pane), every top-level block dims except the one */\n/* owning the selection (`.wb-fw-active`, set by the workspace) — paragraph */\n/* focus. Hover un-dims for mouse repositioning. Token-driven, motion-safe. */\n/* ------------------------------------------------------------------------- */\n[data-focus-writing] .milkdown-host .ProseMirror > * {\n opacity: 0.35;\n transition: opacity var(--t-base, 200ms) var(--ease-standard, ease);\n}\n[data-focus-writing] .milkdown-host .ProseMirror > .wb-fw-active,\n[data-focus-writing] .milkdown-host .ProseMirror > *:hover {\n opacity: 1;\n}\n@media (prefers-reduced-motion: reduce) {\n [data-focus-writing] .milkdown-host .ProseMirror > * {\n transition: none;\n }\n}\n","/**\n * Calc authoring decorations (#220) — shared by the Monaco source surface\n * (decoration `inlineClassName`) and the Milkdown WYSIWYG surface (ProseMirror\n * inline decorations + result-inlay widgets).\n *\n * Colors come from the `--calc-*` syntax tokens — the SAME tokens `CalcBlock`\n * paints with (#221), already AA-verified against `--background` (the editor\n * surface) and `--card` in all three themes — so highlighting tracks the theme via\n * the cascade with no hardcoded hex. The compound `.brand-calc-tok.brand-calc-tok--x`\n * selector raises specificity above Monaco's own token color class (`.mtkN`) so\n * the calc color wins regardless of stylesheet load order (no `!important`).\n *\n * Hue is never the SOLE cue (var-def = weight, unresolved = dotted underline), so\n * roles stay distinct in the high-contrast theme where the calc colors collapse\n * toward the foreground — mirroring `CalcBlock.tokenClass`.\n */\n\n.brand-calc-tok.brand-calc-tok--number,\n.brand-calc-tok.brand-calc-tok--constant {\n color: var(--calc-number);\n}\n.brand-calc-tok.brand-calc-tok--unit {\n color: var(--calc-unit);\n}\n.brand-calc-tok.brand-calc-tok--currency {\n color: var(--calc-currency);\n}\n.brand-calc-tok.brand-calc-tok--operator {\n color: var(--calc-operator);\n}\n.brand-calc-tok.brand-calc-tok--function {\n color: var(--calc-function);\n}\n.brand-calc-tok.brand-calc-tok--var-ref {\n color: var(--calc-variable);\n}\n.brand-calc-tok.brand-calc-tok--var-def {\n color: var(--calc-variable);\n font-weight: 500;\n}\n.brand-calc-tok.brand-calc-tok--line-ref {\n color: var(--calc-reference);\n font-variant-numeric: tabular-nums;\n}\n.brand-calc-tok.brand-calc-tok--comment {\n color: var(--calc-comment);\n font-style: italic;\n}\n.brand-calc-tok.brand-calc-tok--unknown {\n color: var(--calc-warning);\n}\n\n/* Non-hue cue for unresolved identifiers / dangling refs — carries the role in\n high-contrast, where hue is flattened. */\n.brand-calc-tok.brand-calc-tok--unresolved {\n text-decoration: underline dotted;\n text-decoration-thickness: 1px;\n text-underline-offset: 2px;\n}\n\n/**\n * WYSIWYG result inlay — a ProseMirror widget after each calc line showing the\n * computed answer. The number IS the signal (shown as text), color is only an\n * enhancement, and it is non-editable / non-selectable so it never enters the\n * document. (The Monaco surface uses Monaco's own inlay hints, themed via the\n * theme bridge's `editorInlayHint.*` colors — not this class.)\n */\n.brand-calc-inlay {\n /* Full strength (no opacity de-emphasis): the result is the answer, and the\n `--calc-result` token is AA-verified at FULL opacity (#221) — reducing it\n would drop effective contrast below what the contrast gate models. */\n margin-inline-start: 1ch;\n color: var(--calc-result);\n font-variant-numeric: tabular-nums;\n user-select: none;\n white-space: pre;\n}\n.brand-calc-inlay--error {\n color: var(--calc-warning);\n}\n"],"mappings":";AAUA,CAAC,cAAc,CAAC;AACd,WAAS;AACT,WAAS,KAAK;AACd,cAAY;AACZ,SAAO,IAAI;AACX,aAAW;AACX,eAAa;AACb,eAAa,IAAI;AACjB,cAAY;AAGZ,aAAW,IAAI,YAAY,EAAE;AAC7B,iBAAe;AACjB;AAEA,CAfC,cAec,CAfC,WAeW;AACzB,WAAS;AACX;AAmBA,CApCC;AAqCC,WAAS;AACT,kBAAgB;AAChB,cAAY;AACd;AACA,CAzCC,cAyCc,EAAE;AACjB,CA1CC,cA0Cc,CAAC;AACd,WAAS;AACT,cAAY;AACZ,QAAM,EAAE,EAAE;AACV,kBAAgB;AAClB;AACA,CAhDC,cAgDc,CAhDC,WAgDW,CAAC;AAC1B,QAAM,EAAE,EAAE;AACZ;AAEA,CApDC,cAoDc,CApDC,YAoDY,EAAE,EAAE,EAAE;AAChC,cAAY;AACd;AAMA,CA5DC,cA4Dc,CA5DC,YA4DY;AAC5B,CA7DC,cA6Dc,CA7DC,YA6DY;AAC5B,CA9DC,cA8Dc,CA9DC,YA8DY;AAC5B,C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AI;AACb;","names":[]}
@@ -0,0 +1,199 @@
1
+ import { E as EditorContentAccess, M as MonacoCodeEditor } from './markdown-editor-DfBZibAn.js';
2
+ export { C as CodeEditor, a as CodeEditorProps, b as EditorAction, c as EditorSelection, d as EmbedAssetFn, e as MarkdownEditor, f as MarkdownEditorHandle, g as MarkdownEditorProps, m as monacoContentAccess } from './markdown-editor-DfBZibAn.js';
3
+ import * as react from 'react';
4
+ import { HTMLAttributes, ReactNode, ComponentProps } from 'react';
5
+ import * as monaco from 'monaco-editor';
6
+ export { monaco };
7
+ import { Button } from '@elabs-ai/components-ui';
8
+ import { ThemeName } from '@elabs-ai/components-tokens';
9
+ import '@milkdown/kit/ctx';
10
+ import '@milkdown/kit/prose/model';
11
+ import '@milkdown/kit/prose/state';
12
+
13
+ type MonacoDiffEditor = monaco.editor.IStandaloneDiffEditor;
14
+ interface DiffEditorProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"> {
15
+ /** Left/original document. */
16
+ original: string;
17
+ /** Right/modified document. */
18
+ modified: string;
19
+ /** Monaco language id applied to both sides. Defaults to "typescript". */
20
+ language?: string;
21
+ /** Read-only (diffs are read-only by default). */
22
+ readOnly?: boolean;
23
+ /** Side-by-side (true) vs inline (false) diff. Defaults to side-by-side. */
24
+ renderSideBySide?: boolean;
25
+ /** Editor height. Number → px. Defaults to "100%". */
26
+ height?: number | string;
27
+ /** Passthrough Monaco diff options (merged over the defaults). */
28
+ options?: monaco.editor.IStandaloneDiffEditorConstructionOptions;
29
+ /** Called once the diff editor + monaco namespace are ready. */
30
+ onMount?: (editor: MonacoDiffEditor, monacoApi: typeof monaco) => void;
31
+ }
32
+ /**
33
+ * A token-themed Monaco diff editor (original ↔ modified). Same theming bridge
34
+ * and chrome story as {@link CodeEditor}; reads as a side-by-side or inline diff.
35
+ */
36
+ declare const DiffEditor: react.ForwardRefExoticComponent<DiffEditorProps & react.RefAttributes<monaco.editor.IStandaloneDiffEditor | null>>;
37
+
38
+ interface EditorFile {
39
+ /** Unique path/name; shown (basename) on the tab and used as the model path. */
40
+ path: string;
41
+ /** Monaco language id. Inferred from the extension when omitted. */
42
+ language?: string;
43
+ /** File content. */
44
+ value: string;
45
+ }
46
+ interface CodeWorkspaceProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> {
47
+ /** Open files, one tab each. */
48
+ files: EditorFile[];
49
+ /** Controlled active file path. */
50
+ activePath?: string;
51
+ /** Initial active path for uncontrolled use. Defaults to the first file. */
52
+ defaultActivePath?: string;
53
+ /** Called when the active tab changes. */
54
+ onActivePathChange?: (path: string) => void;
55
+ /** Called on every edit with the file path + new content. */
56
+ onFileChange?: (path: string, value: string) => void;
57
+ /** Render all files read-only. */
58
+ readOnly?: boolean;
59
+ /** Workspace height. Number → px. Defaults to "100%". */
60
+ height?: number | string;
61
+ }
62
+ /**
63
+ * Imperative handle exposed via `CodeWorkspace`'s `ref`.
64
+ *
65
+ * **Migration note:** the forwarded `ref` type changed from `HTMLDivElement` to
66
+ * `CodeWorkspaceHandle` (mirrors the #273 `MarkdownWorkspaceHandle` precedent).
67
+ * Replace any `ref.current` / `ref.current.scrollIntoView()` DOM access with
68
+ * `ref.current?.getElement()`. This is the only breaking change in this work.
69
+ */
70
+ interface CodeWorkspaceHandle extends EditorContentAccess {
71
+ /**
72
+ * The live Monaco editor for the currently active tab, or `null` while booting
73
+ * or when no files are open. Consumers needing the full Monaco API can use this
74
+ * and pass it to `monacoContentAccess(handle.getActiveEditor()!)`.
75
+ */
76
+ getActiveEditor(): MonacoCodeEditor | null;
77
+ /**
78
+ * The workspace root DOM element. Preserves the old `HTMLDivElement` ref access
79
+ * that existed before the ref-type change (#273 `MarkdownWorkspace` playbook).
80
+ */
81
+ getElement(): HTMLDivElement | null;
82
+ }
83
+ /**
84
+ * Multi-file editor shell: brand-ui `Tabs` for the file bar above a single
85
+ * {@link CodeEditor} that swaps to the active file. This is the "reuse our
86
+ * components for the chrome" surface — Tabs/Button are ours; the editing surface
87
+ * is Monaco. Edits bubble through `onFileChange`.
88
+ *
89
+ * The forwarded `ref` exposes a {@link CodeWorkspaceHandle} (not `HTMLDivElement`).
90
+ * Use `ref.current?.getElement()` to access the root DOM node.
91
+ */
92
+ declare const CodeWorkspace: react.ForwardRefExoticComponent<CodeWorkspaceProps & react.RefAttributes<CodeWorkspaceHandle>>;
93
+
94
+ /**
95
+ * Curated language list for the editor toolbar's language picker. Ids are
96
+ * Monaco's built-in language ids (`monaco.languages.getLanguages()`), so they
97
+ * map straight onto `setModelLanguage` / model creation.
98
+ */
99
+ interface EditorLanguage {
100
+ /** Monaco language id (e.g. "typescript"). */
101
+ id: string;
102
+ /** Human-readable label for the picker. */
103
+ label: string;
104
+ }
105
+ declare const EDITOR_LANGUAGES: EditorLanguage[];
106
+ /** Look up a language's label, falling back to the raw id. */
107
+ declare function languageLabel(id: string): string;
108
+
109
+ interface EditorToolbarProps extends HTMLAttributes<HTMLDivElement> {
110
+ /** Filename shown on the left (e.g. "index.ts"). */
111
+ filename?: ReactNode;
112
+ /** Active language id; shows a language picker when `onLanguageChange` is set. */
113
+ language?: string;
114
+ /** Called when the user picks a language. Omit to hide the picker. */
115
+ onLanguageChange?: (language: string) => void;
116
+ /** Languages offered in the picker. Defaults to {@link EDITOR_LANGUAGES}. */
117
+ languages?: EditorLanguage[];
118
+ /** Text copied by the copy button. Omit to hide the button. */
119
+ copyValue?: string;
120
+ /** Extra actions rendered before the copy button (brand-ui buttons, etc.). */
121
+ actions?: ReactNode;
122
+ }
123
+ /**
124
+ * Brand-ui chrome for the editors — the part that genuinely reuses our
125
+ * components. Renders a filename label, an optional language `Select` and a copy
126
+ * `Button`. The editing surface itself is Monaco; this is the frame around it.
127
+ */
128
+ declare const EditorToolbar: react.ForwardRefExoticComponent<EditorToolbarProps & react.RefAttributes<HTMLDivElement>>;
129
+
130
+ interface EditorContextMenuProps {
131
+ /** The Monaco editor instance to act on (null until mounted). */
132
+ editor: monaco.editor.IStandaloneCodeEditor | null;
133
+ /** Hide editing items (cut/paste/format) for read-only editors. */
134
+ readOnly?: boolean;
135
+ /** The editor element wrapped as the right-click trigger. */
136
+ children: ReactNode;
137
+ }
138
+ /**
139
+ * Replaces Monaco's built-in context menu with brand-ui's `ContextMenu`, wired
140
+ * to the editor instance. This is the "reuse our components instead of Monaco's
141
+ * built-in ones" path for the right-click menu — set `contextMenu="brand"` on
142
+ * `CodeEditor` (the default) and it disables Monaco's menu and renders this.
143
+ *
144
+ * Clipboard ops use the async Clipboard API + `executeEdits` (reliable in the
145
+ * browser); other entries delegate to the editor's own actions.
146
+ */
147
+ declare function EditorContextMenu({ editor, readOnly, children }: EditorContextMenuProps): react.JSX.Element;
148
+
149
+ interface CopyButtonProps extends Omit<ComponentProps<typeof Button>, "value"> {
150
+ /** Text written to the clipboard on click. */
151
+ value: string;
152
+ /** Show the "Copy" / "Copied" label next to the icon. Defaults to true. */
153
+ label?: boolean;
154
+ }
155
+ /**
156
+ * Brand-ui copy-to-clipboard button with a transient "Copied" state. Shared by
157
+ * the editor toolbar and workspace so the copy affordance is defined once.
158
+ */
159
+ declare function CopyButton({ value, label, className, ...props }: CopyButtonProps): react.JSX.Element;
160
+
161
+ /**
162
+ * Build a Monaco theme from the resolved CSS variables on `rootEl`
163
+ * (defaults to `<html>`, where `data-theme` lives).
164
+ */
165
+ declare function buildBrandThemeData(rootEl?: HTMLElement | null): monaco.editor.IStandaloneThemeData;
166
+ /** The Monaco theme id used for a given brand theme. */
167
+ declare function brandThemeId(theme: ThemeName): string;
168
+ /**
169
+ * Define + activate the Monaco theme for `theme`, reading live token values.
170
+ * `setTheme` is global to all editors, so calling this from any mounted editor
171
+ * is idempotent and keeps every editor in sync.
172
+ */
173
+ declare function applyBrandTheme(monaco: typeof monaco, theme: ThemeName, rootEl?: HTMLElement | null): string;
174
+
175
+ interface DataThemeState {
176
+ /** The active brand theme parsed from `data-theme`. */
177
+ theme: ThemeName;
178
+ /**
179
+ * Increments on every observed `data-theme` mutation (and the initial read),
180
+ * even when the parsed theme name is unchanged. Consumers depend on this to
181
+ * re-run side effects once the attribute settles — e.g. the editor re-applies
182
+ * its Monaco theme after a late attribute write that matches the default,
183
+ * which a name-only dependency would miss.
184
+ */
185
+ revision: number;
186
+ }
187
+ /**
188
+ * Reads the active brand theme straight from the `data-theme` attribute and
189
+ * keeps it in sync via a `MutationObserver`. Deliberately decoupled from
190
+ * `ThemeProvider`/`useTheme` so the editor themes correctly whether or not a
191
+ * provider is present (Storybook's theme decorator just sets `data-theme`).
192
+ *
193
+ * @param target Element to watch. Defaults to `<html>` (where `ThemeProvider`
194
+ * writes). Pass a scoped element for nested theming; the document root is also
195
+ * observed as a fallback.
196
+ */
197
+ declare function useDataTheme(target?: HTMLElement | null): DataThemeState;
198
+
199
+ export { CodeWorkspace, type CodeWorkspaceHandle, type CodeWorkspaceProps, CopyButton, type CopyButtonProps, type DataThemeState, DiffEditor, type DiffEditorProps, EDITOR_LANGUAGES, EditorContentAccess, EditorContextMenu, type EditorContextMenuProps, type EditorFile, type EditorLanguage, EditorToolbar, type EditorToolbarProps, MonacoCodeEditor, type MonacoDiffEditor, applyBrandTheme, brandThemeId, buildBrandThemeData, languageLabel, useDataTheme };