@nuucognition/ncm-ui 0.1.0-dev.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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -0
  3. package/dist/blocks/admonition/index.d.ts +13 -0
  4. package/dist/blocks/admonition/index.js +1713 -0
  5. package/dist/blocks/aside/index.d.ts +13 -0
  6. package/dist/blocks/aside/index.js +1713 -0
  7. package/dist/blocks/attribution/index.d.ts +13 -0
  8. package/dist/blocks/attribution/index.js +32 -0
  9. package/dist/blocks/blockquote/index.d.ts +15 -0
  10. package/dist/blocks/blockquote/index.js +609 -0
  11. package/dist/blocks/chart/index.d.ts +14 -0
  12. package/dist/blocks/chart/index.js +29 -0
  13. package/dist/blocks/code/index.d.ts +15 -0
  14. package/dist/blocks/code/index.js +163 -0
  15. package/dist/blocks/container/index.d.ts +17 -0
  16. package/dist/blocks/container/index.js +633 -0
  17. package/dist/blocks/custom-code/index.d.ts +15 -0
  18. package/dist/blocks/custom-code/index.js +31 -0
  19. package/dist/blocks/dataview/index.d.ts +14 -0
  20. package/dist/blocks/dataview/index.js +29 -0
  21. package/dist/blocks/definition/index.d.ts +13 -0
  22. package/dist/blocks/definition/index.js +1713 -0
  23. package/dist/blocks/embed/index.d.ts +12 -0
  24. package/dist/blocks/embed/index.js +46 -0
  25. package/dist/blocks/embedding/index.d.ts +13 -0
  26. package/dist/blocks/embedding/index.js +763 -0
  27. package/dist/blocks/figure/index.d.ts +13 -0
  28. package/dist/blocks/figure/index.js +656 -0
  29. package/dist/blocks/footnote/index.d.ts +13 -0
  30. package/dist/blocks/footnote/index.js +1713 -0
  31. package/dist/blocks/frontmatter/index.d.ts +16 -0
  32. package/dist/blocks/frontmatter/index.js +38 -0
  33. package/dist/blocks/header/index.d.ts +9 -0
  34. package/dist/blocks/header/index.js +610 -0
  35. package/dist/blocks/horizontal-rule/index.d.ts +9 -0
  36. package/dist/blocks/horizontal-rule/index.js +19 -0
  37. package/dist/blocks/html/index.d.ts +31 -0
  38. package/dist/blocks/html/index.js +52 -0
  39. package/dist/blocks/index.d.ts +32 -0
  40. package/dist/blocks/index.js +1736 -0
  41. package/dist/blocks/latex/index.d.ts +9 -0
  42. package/dist/blocks/latex/index.js +107 -0
  43. package/dist/blocks/link/index.d.ts +14 -0
  44. package/dist/blocks/link/index.js +27 -0
  45. package/dist/blocks/list/index.d.ts +9 -0
  46. package/dist/blocks/list/index.js +675 -0
  47. package/dist/blocks/math/index.d.ts +13 -0
  48. package/dist/blocks/math/index.js +88 -0
  49. package/dist/blocks/mermaid/index.d.ts +14 -0
  50. package/dist/blocks/mermaid/index.js +29 -0
  51. package/dist/blocks/page-breaker/index.d.ts +16 -0
  52. package/dist/blocks/page-breaker/index.js +21 -0
  53. package/dist/blocks/paragraph/index.d.ts +9 -0
  54. package/dist/blocks/paragraph/index.js +608 -0
  55. package/dist/blocks/spoiler/index.d.ts +13 -0
  56. package/dist/blocks/spoiler/index.js +1713 -0
  57. package/dist/blocks/table/index.d.ts +9 -0
  58. package/dist/blocks/table/index.js +619 -0
  59. package/dist/blocks/task-list/index.d.ts +13 -0
  60. package/dist/blocks/task-list/index.js +670 -0
  61. package/dist/components/index.d.ts +599 -0
  62. package/dist/components/index.js +1840 -0
  63. package/dist/components/ncm-block.d.ts +28 -0
  64. package/dist/components/ncm-block.js +1712 -0
  65. package/dist/components/ncm-document.d.ts +48 -0
  66. package/dist/components/ncm-document.js +1839 -0
  67. package/dist/context/index.d.ts +7 -0
  68. package/dist/context/index.js +284 -0
  69. package/dist/hooks/index.d.ts +7 -0
  70. package/dist/hooks/index.js +1731 -0
  71. package/dist/hooks/use-block-renderer.d.ts +28 -0
  72. package/dist/hooks/use-block-renderer.js +1731 -0
  73. package/dist/hooks/use-ncm-config.d.ts +6 -0
  74. package/dist/hooks/use-ncm-config.js +11 -0
  75. package/dist/index.d.ts +43 -0
  76. package/dist/index.js +1887 -0
  77. package/dist/inline/index.d.ts +108 -0
  78. package/dist/inline/index.js +598 -0
  79. package/dist/inline-DwUYUmk4.d.ts +75 -0
  80. package/dist/lib/defaults.d.ts +24 -0
  81. package/dist/lib/defaults.js +1713 -0
  82. package/dist/lib/index.d.ts +2 -0
  83. package/dist/lib/index.js +10 -0
  84. package/dist/lib/katex.d.ts +3 -0
  85. package/dist/lib/katex.js +45 -0
  86. package/dist/lib/utils.d.ts +8 -0
  87. package/dist/lib/utils.js +10 -0
  88. package/dist/references-Bs5wJybr.d.ts +63 -0
  89. package/dist/renderers-C5f41FCy.d.ts +99 -0
  90. package/dist/styles/fonts/OpenDyslexic3-Bold.woff +0 -0
  91. package/dist/styles/fonts/OpenDyslexic3-Bold.woff2 +0 -0
  92. package/dist/styles/fonts/OpenDyslexic3-Regular.woff +0 -0
  93. package/dist/styles/fonts/OpenDyslexic3-Regular.woff2 +0 -0
  94. package/dist/styles/nuu.css +364 -0
  95. package/dist/styles/paper.css +332 -0
  96. package/dist/types/index.d.ts +4 -0
  97. package/dist/types/index.js +2 -0
  98. package/dist/use-ncm-config-D0doMYTH.d.ts +114 -0
  99. package/package.json +99 -0
@@ -0,0 +1,332 @@
1
+ /*
2
+ * NCM UI — Paper theme
3
+ *
4
+ * Editorial typography ladder matching @nuucognition/paper-ui.
5
+ * Single sans family (Inter) for everything except code, four-tone text
6
+ * ladder, generous whitespace, reading-optimized line lengths.
7
+ *
8
+ * Inherits the same NUU CSS variables; switches automatically with `.dark`.
9
+ */
10
+
11
+ [data-ncm-document].ncm-theme-paper {
12
+ font-family: var(--font-sans);
13
+ font-size: 0.8125rem;
14
+ line-height: 1.8;
15
+ color: var(--muted-foreground);
16
+ }
17
+
18
+ [data-ncm-document].ncm-theme-paper > * + * {
19
+ margin-top: 1rem;
20
+ }
21
+
22
+ /* Headings — Inter (not Geist), medium weight */
23
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"] {
24
+ font-family: var(--font-sans);
25
+ color: var(--foreground);
26
+ scroll-margin-top: 5rem;
27
+ margin-bottom: 0;
28
+ }
29
+
30
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"][data-ncm-level="1"] {
31
+ font-size: 1.625rem;
32
+ line-height: 1.25;
33
+ font-weight: 500;
34
+ margin-top: 0;
35
+ }
36
+
37
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"][data-ncm-level="1"]:first-child {
38
+ margin-top: 0;
39
+ }
40
+
41
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"][data-ncm-level="2"] {
42
+ font-size: 1.125rem;
43
+ line-height: 1.375;
44
+ font-weight: 500;
45
+ margin-top: 2.5rem;
46
+ }
47
+
48
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"][data-ncm-level="3"] {
49
+ font-size: 0.9375rem;
50
+ line-height: 1.375;
51
+ font-weight: 400;
52
+ margin-top: 1.5rem;
53
+ }
54
+
55
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"][data-ncm-level="4"] {
56
+ font-size: 0.6875rem;
57
+ font-weight: 400;
58
+ letter-spacing: 0.05em;
59
+ text-transform: uppercase;
60
+ color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
61
+ margin-top: 1rem;
62
+ }
63
+
64
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="header"][data-ncm-level="5"] {
65
+ font-family: var(--font-mono);
66
+ font-size: 0.6875rem;
67
+ font-weight: 400;
68
+ letter-spacing: 0.05em;
69
+ text-transform: uppercase;
70
+ color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
71
+ margin-top: 1rem;
72
+ }
73
+
74
+ /* Paragraph — body color is muted-foreground */
75
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="paragraph"] {
76
+ color: var(--muted-foreground);
77
+ line-height: 1.8;
78
+ }
79
+
80
+ /* Blockquote */
81
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="blockquote"] {
82
+ border-left: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
83
+ padding-left: 1rem;
84
+ color: var(--muted-foreground);
85
+ font-style: italic;
86
+ line-height: 1.8;
87
+ }
88
+
89
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="blockquote"] p + p {
90
+ margin-top: 0.5rem;
91
+ }
92
+
93
+ /* Lists */
94
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"],
95
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] {
96
+ padding-left: 1.25rem;
97
+ color: var(--muted-foreground);
98
+ line-height: 1.8;
99
+ }
100
+
101
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"]::marker,
102
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"]::marker,
103
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] li::marker,
104
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] li::marker {
105
+ color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
106
+ }
107
+
108
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] {
109
+ list-style-type: decimal;
110
+ }
111
+
112
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] {
113
+ list-style-type: disc;
114
+ }
115
+
116
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] li + li,
117
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] li + li {
118
+ margin-top: 0.25rem;
119
+ }
120
+
121
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] ol,
122
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] ul,
123
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] ol,
124
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] ul {
125
+ margin-top: 0.25rem;
126
+ padding-left: 1.25rem;
127
+ }
128
+
129
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] ol {
130
+ list-style-type: decimal;
131
+ }
132
+
133
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_ordered"] ul,
134
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] ul {
135
+ list-style-type: disc;
136
+ }
137
+
138
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="list_unordered"] ol {
139
+ list-style-type: decimal;
140
+ }
141
+
142
+ /* Tables */
143
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="table"] {
144
+ width: 100%;
145
+ overflow-x: auto;
146
+ }
147
+
148
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="table"] table {
149
+ width: 100%;
150
+ border-collapse: collapse;
151
+ font-size: 0.75rem;
152
+ line-height: 1.5;
153
+ }
154
+
155
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="table"] th {
156
+ border-bottom: 1px solid var(--border);
157
+ padding: 0.5rem 0.75rem;
158
+ text-align: left;
159
+ font-family: var(--font-mono);
160
+ font-size: 0.6875rem;
161
+ font-weight: 400;
162
+ text-transform: uppercase;
163
+ letter-spacing: 0.05em;
164
+ color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
165
+ background-color: transparent;
166
+ }
167
+
168
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="table"] td {
169
+ border-bottom: 1px solid var(--border);
170
+ padding: 0.5rem 0.75rem;
171
+ text-align: left;
172
+ color: var(--muted-foreground);
173
+ }
174
+
175
+ /* Code (block) */
176
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="code"] {
177
+ position: relative;
178
+ }
179
+
180
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="code"] pre {
181
+ overflow-x: auto;
182
+ border: 1px solid var(--border);
183
+ border-radius: var(--radius, 0.625rem);
184
+ padding: 1rem;
185
+ background-color: color-mix(in srgb, var(--muted) 50%, transparent);
186
+ color: var(--foreground);
187
+ font-family: var(--font-mono);
188
+ font-size: 0.75rem;
189
+ line-height: 1.6;
190
+ }
191
+
192
+ /* Inline code */
193
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="code"] {
194
+ font-family: var(--font-mono);
195
+ font-size: 0.75rem;
196
+ padding: 0.0625rem 0.25rem;
197
+ border: 1px solid var(--border);
198
+ border-radius: 0.25rem;
199
+ background-color: color-mix(in srgb, var(--muted) 50%, transparent);
200
+ color: var(--foreground);
201
+ }
202
+
203
+ /* Links */
204
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="link"],
205
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="wiki_link"][data-ncm-wikilink-status="resolved"],
206
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="wiki_embed"]:not([data-ncm-wikiembed-status]) {
207
+ color: var(--foreground);
208
+ text-decoration: underline;
209
+ text-decoration-thickness: 1px;
210
+ text-underline-offset: 3px;
211
+ font-weight: 400;
212
+ }
213
+
214
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="wiki_link"][data-ncm-wikilink-status="missing"],
215
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="wiki_embed"][data-ncm-wikiembed-status="missing"] {
216
+ color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
217
+ text-decoration: underline dashed;
218
+ text-underline-offset: 3px;
219
+ }
220
+
221
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="wiki_link"][data-ncm-wikilink-status="ambiguous"],
222
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="wiki_embed"][data-ncm-wikiembed-status="ambiguous"] {
223
+ color: var(--fire-text, var(--destructive));
224
+ }
225
+
226
+ /* Horizontal rule */
227
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="horizontal_rule"] {
228
+ border: 0;
229
+ border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
230
+ margin-top: 2.5rem;
231
+ margin-bottom: 2.5rem;
232
+ }
233
+
234
+ /* Embeddings */
235
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="embedding"] img,
236
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="embedding"] video {
237
+ max-width: 100%;
238
+ border-radius: var(--radius, 0.625rem);
239
+ }
240
+
241
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="embedding"] figcaption {
242
+ margin-top: 0.5rem;
243
+ text-align: left;
244
+ font-family: var(--font-mono);
245
+ font-size: 0.6875rem;
246
+ text-transform: uppercase;
247
+ letter-spacing: 0.05em;
248
+ color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
249
+ }
250
+
251
+ /* LaTeX display */
252
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="latex_display"] {
253
+ overflow-x: auto;
254
+ color: var(--foreground);
255
+ }
256
+
257
+ /* Custom code fallback */
258
+ [data-ncm-document].ncm-theme-paper [data-ncm-type="custom_code"] {
259
+ border: 1px dashed var(--border);
260
+ border-radius: var(--radius, 0.625rem);
261
+ padding: 1rem;
262
+ background-color: color-mix(in srgb, var(--muted) 50%, transparent);
263
+ color: var(--foreground);
264
+ font-family: var(--font-mono);
265
+ font-size: 0.75rem;
266
+ }
267
+
268
+ /* Inline references — ^[ref: …] (citation, [1]) and ^[footnote: …] (¹) */
269
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="reference"],
270
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="footnote"] {
271
+ position: relative;
272
+ white-space: nowrap;
273
+ }
274
+
275
+ [data-ncm-document].ncm-theme-paper [data-ncm-ref-marker] {
276
+ cursor: pointer;
277
+ color: var(--brand, var(--primary));
278
+ font-weight: 500;
279
+ border-radius: 0.1875rem;
280
+ outline: none;
281
+ }
282
+
283
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="reference"] [data-ncm-ref-marker] {
284
+ font-size: 0.85em;
285
+ padding: 0 0.0625rem;
286
+ }
287
+
288
+ [data-ncm-document].ncm-theme-paper sup[data-ncm-ref-marker] {
289
+ font-size: 0.7em;
290
+ line-height: 0;
291
+ padding-left: 0.0625rem;
292
+ }
293
+
294
+ [data-ncm-document].ncm-theme-paper [data-ncm-ref-marker]:hover,
295
+ [data-ncm-document].ncm-theme-paper [data-ncm-ref-marker]:focus-visible {
296
+ text-decoration: underline;
297
+ text-underline-offset: 2px;
298
+ }
299
+
300
+ /* Popover — content revealed on marker hover/focus */
301
+ [data-ncm-document].ncm-theme-paper [data-ncm-ref-popover] {
302
+ position: absolute;
303
+ left: 0;
304
+ top: 1.6em;
305
+ z-index: 20;
306
+ width: max-content;
307
+ max-width: min(22rem, 80vw);
308
+ padding: 0.5rem 0.75rem;
309
+ border: 1px solid var(--border);
310
+ border-radius: var(--radius, 0.625rem);
311
+ background: var(--popover, var(--background, var(--muted)));
312
+ color: var(--popover-foreground, var(--foreground));
313
+ box-shadow: 0 4px 14px rgb(0 0 0 / 0.1);
314
+ font-family: var(--font-sans);
315
+ font-size: calc(0.8125rem * var(--surf-reading-scale, 1));
316
+ font-weight: 400;
317
+ line-height: 1.55;
318
+ white-space: normal;
319
+ opacity: 0;
320
+ visibility: hidden;
321
+ transition: opacity 0.12s ease, visibility 0.12s ease;
322
+ pointer-events: none;
323
+ }
324
+
325
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="reference"]:hover [data-ncm-ref-popover],
326
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="reference"]:focus-within [data-ncm-ref-popover],
327
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="footnote"]:hover [data-ncm-ref-popover],
328
+ [data-ncm-document].ncm-theme-paper [data-ncm-token="footnote"]:focus-within [data-ncm-ref-popover] {
329
+ opacity: 1;
330
+ visibility: visible;
331
+ pointer-events: auto;
332
+ }
@@ -0,0 +1,4 @@
1
+ export { B as BlockRenderer, a as BlockRendererProps, b as BlockRendererRegistry, C as CompleteBlockRendererRegistry, E as EmbeddingRendererProps, c as EmbeddingRendererRegistry, K as KeyedBlockType } from '../renderers-C5f41FCy.js';
2
+ export { B as BoldToken, C as CodeToken, I as ImageToken, a as InlineRefToken, b as InlineToken, c as ItalicToken, L as LatexToken, d as LinkToken, S as StrikethroughToken, T as TextToken, W as WikiEmbedToken, e as WikiLinkToken } from '../inline-DwUYUmk4.js';
3
+ import 'react';
4
+ import '@nuucognition/ncm';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+
@@ -0,0 +1,114 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComponentType, ReactNode } from 'react';
3
+ import { MeshResolveLinkResult, MeshHydrationContext } from '@nuucognition/mesh-core';
4
+ import { EmbedType } from '@nuucognition/ncm';
5
+ import { c as EmbeddingRendererRegistry, b as BlockRendererRegistry } from './renderers-C5f41FCy.js';
6
+
7
+ /**
8
+ * Configuration for inline content rendering
9
+ */
10
+ interface InlineConfig {
11
+ onLinkClick?: (href: string, event: React.MouseEvent) => void;
12
+ onWikiLinkClick?: (target: string, result: MeshResolveLinkResult, event: React.MouseEvent) => void;
13
+ resolveWikiLinkHref?: (target: string, result: MeshResolveLinkResult) => string | null;
14
+ resolveAssetPath?: (path: string) => string;
15
+ customLatexRenderer?: ComponentType<{
16
+ content: string;
17
+ display?: boolean;
18
+ }>;
19
+ /**
20
+ * Show a hover/focus popover with a reference's content for inline references
21
+ * (`^[ref: …]` / `^[footnote: …]`). Defaults to `true`; set `false` to render
22
+ * bare markers (e.g. when the host surfaces the content elsewhere).
23
+ */
24
+ referencePopover?: boolean;
25
+ }
26
+ /**
27
+ * Configuration for embedding rendering
28
+ */
29
+ interface EmbeddingsConfig {
30
+ resolveUrl?: (target: string, embedType: EmbedType) => string;
31
+ renderers?: EmbeddingRendererRegistry;
32
+ imageClassName?: string;
33
+ videoClassName?: string;
34
+ audioClassName?: string;
35
+ }
36
+ /**
37
+ * Code rendering configuration
38
+ */
39
+ interface CodeConfig {
40
+ renderer?: ComponentType<{
41
+ code: string;
42
+ language?: string;
43
+ className?: string;
44
+ }>;
45
+ lineNumbers?: boolean;
46
+ copyButton?: boolean;
47
+ }
48
+ /**
49
+ * Reading-experience configuration applied at the inline-renderer leaf.
50
+ * Currently exposes a "bionic" reading mode that bolds the first portion of
51
+ * each word; only plain text tokens are transformed — code, latex, links,
52
+ * and embeds pass through unchanged.
53
+ */
54
+ interface ReadingConfig {
55
+ /** When true, render plain text with first-half-of-word bolding. */
56
+ bionic?: boolean;
57
+ /** Fraction of each word to bold (clamped to (0, 1]); defaults to 0.5. */
58
+ bionicRatio?: number;
59
+ /**
60
+ * When true, render the document with the OpenDyslexic3 typeface — the
61
+ * latest refined letterforms of the OpenDyslexic family, designed for
62
+ * dyslexic readers (weighted letter bottoms, distinctive shapes that
63
+ * resist mirror-letter confusion). The font files ship with this package
64
+ * — @font-face declarations live in `./styles/nuu.css`, so importing
65
+ * that stylesheet is enough.
66
+ */
67
+ dyslexicFont?: boolean;
68
+ /**
69
+ * When true, wrap every plain-text word in `<span data-ncm-beeline-word>`
70
+ * so a host-side colorize pass (e.g. `useBeelineColorize` in Surf) can
71
+ * paint a per-line color gradient across the body text — the BeeLine
72
+ * Reader trick. The NCM layer only marks word boundaries; color
73
+ * assignment is the host's responsibility because the palette (and the
74
+ * per-line direction flip) depends on layout that only exists after
75
+ * mount.
76
+ */
77
+ beeline?: boolean;
78
+ }
79
+ /**
80
+ * Main NCM configuration interface
81
+ *
82
+ * Theming and typography are owned by stylesheets (`@nuucognition/ncm-ui/styles/nuu.css`,
83
+ * `.../paper.css`) — selected via the `theme` prop on `NcmDocument`. The host
84
+ * controls light/dark via the `.dark` class on the document root.
85
+ */
86
+ interface NcmConfig {
87
+ renderers?: BlockRendererRegistry;
88
+ inline?: InlineConfig;
89
+ embeddings?: EmbeddingsConfig;
90
+ code?: CodeConfig;
91
+ reading?: ReadingConfig;
92
+ /** Optional Mesh hydration context for Obsidian-style wikilinks/embeds */
93
+ mesh?: MeshHydrationContext;
94
+ /** Additional class name for the document container */
95
+ className?: string;
96
+ }
97
+ declare function useNcmConfig(): NcmConfig;
98
+ interface NcmProviderProps {
99
+ config?: NcmConfig;
100
+ children: ReactNode;
101
+ }
102
+ /**
103
+ * Provider component for NCM configuration.
104
+ *
105
+ * @example
106
+ * ```tsx
107
+ * <NcmProvider config={{ mesh: meshContext, code: { lineNumbers: true } }}>
108
+ * <NcmDocument blocks={blocks} theme="paper" />
109
+ * </NcmProvider>
110
+ * ```
111
+ */
112
+ declare function NcmProvider({ config, children }: NcmProviderProps): react_jsx_runtime.JSX.Element;
113
+
114
+ export { type CodeConfig as C, type EmbeddingsConfig as E, type InlineConfig as I, type NcmConfig as N, NcmProvider as a, type NcmProviderProps as b, useNcmConfig as u };
package/package.json ADDED
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "@nuucognition/ncm-ui",
3
+ "version": "0.1.0-dev.1",
4
+ "description": "React renderers for NUU Cognition Markdown (NCM) blocks — a component library that renders parsed NCM Blocks to accessible, themeable markup.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "ncm",
9
+ "markdown",
10
+ "react",
11
+ "renderer",
12
+ "ui",
13
+ "katex",
14
+ "shiki",
15
+ "nuucognition"
16
+ ],
17
+ "sideEffects": [
18
+ "*.css"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "main": "./dist/index.js",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ "dependencies": {
32
+ "@nuucognition/mesh-core": "^1.0.0",
33
+ "clsx": "^2.1.1",
34
+ "katex": "^0.16.21",
35
+ "shiki": "^1.29.2",
36
+ "tailwind-merge": "^3.3.1",
37
+ "@nuucognition/ncm": "0.1.0-dev.2"
38
+ },
39
+ "devDependencies": {
40
+ "@types/katex": "^0.16.7",
41
+ "@types/react": "^19.1.9",
42
+ "@types/react-dom": "^19.1.7",
43
+ "eslint": "^9.32.0",
44
+ "jsdom": "^26.1.0",
45
+ "tsup": "^8.5.1",
46
+ "typescript": "^5.9.2",
47
+ "vitest": "^2.1.9",
48
+ "@nuucognition/typescript-config": "0.0.0",
49
+ "@nuucognition/eslint-config": "0.0.0"
50
+ },
51
+ "peerDependencies": {
52
+ "react": "^18.0.0 || ^19.0.0",
53
+ "react-dom": "^18.0.0 || ^19.0.0"
54
+ },
55
+ "exports": {
56
+ ".": {
57
+ "types": "./dist/index.d.ts",
58
+ "import": "./dist/index.js"
59
+ },
60
+ "./styles/nuu.css": "./dist/styles/nuu.css",
61
+ "./styles/paper.css": "./dist/styles/paper.css",
62
+ "./components/*": {
63
+ "types": "./dist/components/*.d.ts",
64
+ "import": "./dist/components/*.js"
65
+ },
66
+ "./blocks/*": {
67
+ "types": "./dist/blocks/*/index.d.ts",
68
+ "import": "./dist/blocks/*/index.js"
69
+ },
70
+ "./inline": {
71
+ "types": "./dist/inline/index.d.ts",
72
+ "import": "./dist/inline/index.js"
73
+ },
74
+ "./context": {
75
+ "types": "./dist/context/index.d.ts",
76
+ "import": "./dist/context/index.js"
77
+ },
78
+ "./hooks/*": {
79
+ "types": "./dist/hooks/*.d.ts",
80
+ "import": "./dist/hooks/*.js"
81
+ },
82
+ "./lib/*": {
83
+ "types": "./dist/lib/*.d.ts",
84
+ "import": "./dist/lib/*.js"
85
+ },
86
+ "./types": {
87
+ "types": "./dist/types/index.d.ts",
88
+ "import": "./dist/types/index.js"
89
+ }
90
+ },
91
+ "scripts": {
92
+ "build": "tsup",
93
+ "dev": "tsup --watch",
94
+ "lint": "eslint .",
95
+ "pretest": "pnpm --filter @nuucognition/ncm build",
96
+ "test": "vitest run",
97
+ "typecheck": "tsc --noEmit"
98
+ }
99
+ }