@haklex/rich-compose 0.7.0 → 0.9.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 (158) hide show
  1. package/README.md +127 -75
  2. package/dist/core/compose-editor.d.ts +5 -0
  3. package/dist/core/compose-editor.d.ts.map +1 -0
  4. package/dist/core/dedup.d.ts +5 -4
  5. package/dist/core/dedup.d.ts.map +1 -1
  6. package/dist/core/index.d.ts +2 -1
  7. package/dist/core/index.d.ts.map +1 -1
  8. package/dist/core/types.d.ts +14 -27
  9. package/dist/core/types.d.ts.map +1 -1
  10. package/dist/editor.d.ts +20 -0
  11. package/dist/editor.d.ts.map +1 -0
  12. package/dist/editor.mjs +39 -0
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.mjs +104 -14
  16. package/dist/module-7OFwgDvr.js +8 -0
  17. package/dist/module-B-aCJYWf.js +8 -0
  18. package/dist/module-B-j9xcYZ.js +29 -0
  19. package/dist/module-BEeJOlCj.js +8 -0
  20. package/dist/module-BNXS9cXW.js +8 -0
  21. package/dist/module-BdF2K0Q_.js +8 -0
  22. package/dist/module-BgRES6Iz.js +8 -0
  23. package/dist/module-Bzx-kcbg.js +8 -0
  24. package/dist/module-CG73r8KF.js +9 -0
  25. package/dist/module-CoX2HXw7.js +26 -0
  26. package/dist/module-CzzVTOfw.js +9 -0
  27. package/dist/module-DO20vUA2.js +9 -0
  28. package/dist/module-DTPNIUqA.js +9 -0
  29. package/dist/module-D_1K8V59.js +8 -0
  30. package/dist/module-DmFLjjSK.js +8 -0
  31. package/dist/module-LSK-rHcR.js +8 -0
  32. package/dist/modules/alert/edit.d.ts +3 -0
  33. package/dist/modules/alert/edit.d.ts.map +1 -0
  34. package/dist/modules/alert/edit.mjs +9 -0
  35. package/dist/modules/alert/index.d.ts.map +1 -1
  36. package/dist/modules/alert/index.mjs +1 -8
  37. package/dist/modules/banner/edit.d.ts +3 -0
  38. package/dist/modules/banner/edit.d.ts.map +1 -0
  39. package/dist/modules/banner/edit.mjs +9 -0
  40. package/dist/modules/banner/index.d.ts.map +1 -1
  41. package/dist/modules/banner/index.mjs +1 -8
  42. package/dist/modules/chat/edit.d.ts +3 -0
  43. package/dist/modules/chat/edit.d.ts.map +1 -0
  44. package/dist/modules/chat/edit.mjs +10 -0
  45. package/dist/modules/chat/index.d.ts.map +1 -1
  46. package/dist/modules/chat/index.mjs +1 -16
  47. package/dist/modules/chat/module.d.ts +0 -7
  48. package/dist/modules/chat/module.d.ts.map +1 -1
  49. package/dist/modules/code-block/edit.d.ts +3 -0
  50. package/dist/modules/code-block/edit.d.ts.map +1 -0
  51. package/dist/modules/code-block/edit.mjs +9 -0
  52. package/dist/modules/code-block/index.d.ts.map +1 -1
  53. package/dist/modules/code-block/index.mjs +1 -38
  54. package/dist/modules/code-block/module.d.ts +0 -9
  55. package/dist/modules/code-block/module.d.ts.map +1 -1
  56. package/dist/modules/code-snippet/edit.d.ts +3 -0
  57. package/dist/modules/code-snippet/edit.d.ts.map +1 -0
  58. package/dist/modules/code-snippet/edit.mjs +10 -0
  59. package/dist/modules/code-snippet/index.d.ts.map +1 -1
  60. package/dist/modules/code-snippet/index.mjs +1 -14
  61. package/dist/modules/code-snippet/module.d.ts +0 -5
  62. package/dist/modules/code-snippet/module.d.ts.map +1 -1
  63. package/dist/modules/embed/edit.d.ts +3 -0
  64. package/dist/modules/embed/edit.d.ts.map +1 -0
  65. package/dist/modules/embed/edit.mjs +9 -0
  66. package/dist/modules/embed/index.d.ts.map +1 -1
  67. package/dist/modules/embed/index.mjs +1 -16
  68. package/dist/modules/embed/module.d.ts +0 -8
  69. package/dist/modules/embed/module.d.ts.map +1 -1
  70. package/dist/modules/excalidraw/edit.d.ts +3 -0
  71. package/dist/modules/excalidraw/edit.d.ts.map +1 -0
  72. package/dist/modules/excalidraw/edit.mjs +12 -0
  73. package/dist/modules/excalidraw/index.d.ts.map +1 -1
  74. package/dist/modules/excalidraw/index.mjs +1 -16
  75. package/dist/modules/excalidraw/module.d.ts +0 -9
  76. package/dist/modules/excalidraw/module.d.ts.map +1 -1
  77. package/dist/modules/gallery/edit.d.ts +3 -0
  78. package/dist/modules/gallery/edit.d.ts.map +1 -0
  79. package/dist/modules/gallery/edit.mjs +10 -0
  80. package/dist/modules/gallery/index.d.ts.map +1 -1
  81. package/dist/modules/gallery/index.mjs +1 -14
  82. package/dist/modules/gallery/module.d.ts +0 -5
  83. package/dist/modules/gallery/module.d.ts.map +1 -1
  84. package/dist/modules/image/edit.d.ts +3 -0
  85. package/dist/modules/image/edit.d.ts.map +1 -0
  86. package/dist/modules/image/edit.mjs +9 -0
  87. package/dist/modules/image/index.d.ts.map +1 -1
  88. package/dist/modules/image/index.mjs +1 -8
  89. package/dist/modules/katex/edit.d.ts +3 -0
  90. package/dist/modules/katex/edit.d.ts.map +1 -0
  91. package/dist/modules/katex/edit.mjs +8 -0
  92. package/dist/modules/link-card/edit.d.ts +3 -0
  93. package/dist/modules/link-card/edit.d.ts.map +1 -0
  94. package/dist/modules/link-card/edit.mjs +11 -0
  95. package/dist/modules/link-card/index.d.ts.map +1 -1
  96. package/dist/modules/link-card/index.mjs +1 -14
  97. package/dist/modules/link-card/module.d.ts +0 -6
  98. package/dist/modules/link-card/module.d.ts.map +1 -1
  99. package/dist/modules/mention/edit.d.ts +3 -0
  100. package/dist/modules/mention/edit.d.ts.map +1 -0
  101. package/dist/modules/mention/edit.mjs +9 -0
  102. package/dist/modules/mention/index.d.ts.map +1 -1
  103. package/dist/modules/mention/index.mjs +2 -8
  104. package/dist/modules/mermaid/edit.d.ts +3 -0
  105. package/dist/modules/mermaid/edit.d.ts.map +1 -0
  106. package/dist/modules/mermaid/edit.mjs +9 -0
  107. package/dist/modules/mermaid/index.d.ts.map +1 -1
  108. package/dist/modules/mermaid/index.mjs +1 -32
  109. package/dist/modules/mermaid/module.d.ts +0 -6
  110. package/dist/modules/mermaid/module.d.ts.map +1 -1
  111. package/dist/modules/nested-doc/edit.d.ts +3 -0
  112. package/dist/modules/nested-doc/edit.d.ts.map +1 -0
  113. package/dist/modules/nested-doc/edit.mjs +9 -0
  114. package/dist/modules/nested-doc/index.d.ts.map +1 -1
  115. package/dist/modules/nested-doc/index.mjs +1 -14
  116. package/dist/modules/nested-doc/module.d.ts +0 -7
  117. package/dist/modules/nested-doc/module.d.ts.map +1 -1
  118. package/dist/modules/poll/edit.d.ts +3 -0
  119. package/dist/modules/poll/edit.d.ts.map +1 -0
  120. package/dist/modules/poll/edit.mjs +9 -0
  121. package/dist/modules/poll/index.d.ts.map +1 -1
  122. package/dist/modules/poll/index.mjs +1 -18
  123. package/dist/modules/poll/module.d.ts +0 -9
  124. package/dist/modules/poll/module.d.ts.map +1 -1
  125. package/dist/modules/ruby/edit.d.ts +3 -0
  126. package/dist/modules/ruby/edit.d.ts.map +1 -0
  127. package/dist/modules/ruby/edit.mjs +9 -0
  128. package/dist/modules/ruby/index.d.ts.map +1 -1
  129. package/dist/modules/ruby/index.mjs +1 -8
  130. package/dist/modules/video/edit.d.ts +3 -0
  131. package/dist/modules/video/edit.d.ts.map +1 -0
  132. package/dist/modules/video/edit.mjs +9 -0
  133. package/dist/modules/video/index.d.ts.map +1 -1
  134. package/dist/modules/video/index.mjs +1 -8
  135. package/dist/renderer.d.ts +19 -0
  136. package/dist/renderer.d.ts.map +1 -0
  137. package/dist/renderer.mjs +53 -0
  138. package/dist/style/alert.css +2 -0
  139. package/dist/style/banner.css +2 -0
  140. package/dist/style/chat.css +2 -0
  141. package/dist/style/code-block.css +2 -0
  142. package/dist/style/code-snippet.css +2 -0
  143. package/dist/style/embed.css +2 -0
  144. package/dist/style/excalidraw.css +2 -0
  145. package/dist/style/foundation.css +9 -0
  146. package/dist/style/gallery.css +2 -0
  147. package/dist/style/image.css +2 -0
  148. package/dist/style/katex.css +2 -0
  149. package/dist/style/link-card.css +2 -0
  150. package/dist/style/mention.css +2 -0
  151. package/dist/style/mermaid.css +2 -0
  152. package/dist/style/nested-doc.css +2 -0
  153. package/dist/style/poll.css +2 -0
  154. package/dist/{rich-compose.css → style/ruby.css} +1 -1
  155. package/dist/style/table.css +11 -0
  156. package/dist/style/video.css +2 -0
  157. package/dist/style.css +92 -0
  158. package/package.json +100 -23
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # @haklex/rich-compose
2
2
 
3
- Compose primitives for haklex rich content renderers — Gundam-style assembly of Lexical nodes, sync/lazy renderers, and Provider stacks.
3
+ Compose primitives for haklex rich content — Gundam-style assembly of Lexical nodes, sync/lazy renderers, edit-side decorators, and Provider stacks. Powers both `composeRenderer` (read-only) and `composeEditor` (editable).
4
4
 
5
5
  ## Why
6
6
 
7
- The legacy `@haklex/rich-kit-shiro/renderer` (now removed) shipped every default renderer eagerly: even when a consumer overrode `CodeBlock` or `LinkCard`, the upstream `shiki` and `LinkCardRenderer` chains stayed in the production bundle. `rich-compose` solves three problems at once:
7
+ The legacy `@haklex/rich-kit-shiro/renderer` (now removed) shipped every default renderer eagerly: overriding `CodeBlock` or `LinkCard` left the original `shiki` and `LinkCardRenderer` chains in the bundle. `rich-compose` solves three problems at once:
8
8
 
9
9
  1. **Subtractable** — drop a module by not importing it.
10
- 2. **Replaceable** — swap a default renderer with no leftover bytes from the original.
10
+ 2. **Replaceable** — swap a default renderer with no leftover bytes.
11
11
  3. **Extensible** — add new renderer slots (sync or lazy) without touching the package.
12
12
 
13
- Tree-shake is enforced by physical subpath isolation (`./modules/<name>/node` separates Klasses from heavy renderer code) plus ESM-only emit.
13
+ Tree-shake is enforced by physical subpath isolation (`./modules/<name>/node` separates Klasses from heavy renderer code; `./modules/<name>` vs `./modules/<name>/edit` separates static-only from editor-only chains) plus ESM-only emit.
14
14
 
15
15
  ## Installation
16
16
 
@@ -26,26 +26,45 @@ pnpm add @haklex/rich-compose
26
26
  | `lexical` / `@lexical/react` | `^0.44.0` |
27
27
  | `@haklex/rich-editor` | workspace |
28
28
 
29
- Per-module upstream packages (`@haklex/rich-ext-*`, `@haklex/rich-renderer-*`) are optional peers — install only those you compose into your renderer.
29
+ Per-module upstream packages (`@haklex/rich-ext-*`, `@haklex/rich-renderer-*`) are optional peers — install only those you compose.
30
30
 
31
31
  ## Quick start
32
32
 
33
+ ### Read-only renderer
34
+
33
35
  ```tsx
34
- import { composeRenderer } from '@haklex/rich-compose'
35
- import { embedModule } from '@haklex/rich-compose/modules/embed'
36
- import { codeBlockModule } from '@haklex/rich-compose/modules/code-block'
37
- import { linkCardModule } from '@haklex/rich-compose/modules/link-card'
38
- // import any modules you need...
36
+ import { composeRenderer } from '@haklex/rich-compose';
37
+ import { allRendererModules } from '@haklex/rich-compose/renderer';
39
38
 
40
- const RichContent = composeRenderer({
41
- modules: [embedModule, codeBlockModule, linkCardModule],
42
- })
39
+ const RichContent = composeRenderer({ modules: allRendererModules });
43
40
 
44
41
  // Render
45
- <RichContent value={editorState} theme="light" variant="article" />
42
+ <RichContent value={editorState} theme="light" variant="article" />;
43
+ ```
44
+
45
+ Or cherry-pick:
46
+
47
+ ```tsx
48
+ import { composeRenderer } from '@haklex/rich-compose';
49
+ import { embedModule } from '@haklex/rich-compose/modules/embed';
50
+ import { codeBlockModule } from '@haklex/rich-compose/modules/code-block';
51
+
52
+ const RichContent = composeRenderer({ modules: [embedModule, codeBlockModule] });
53
+ ```
54
+
55
+ ### Editor
56
+
57
+ ```tsx
58
+ import { composeEditor } from '@haklex/rich-compose';
59
+ import { allEditorModules } from '@haklex/rich-compose/editor';
60
+
61
+ const RichEditor = composeEditor({ modules: allEditorModules });
62
+
63
+ // Use like @haklex/rich-editor's RichEditor — accepts the same props plus children for plugins.
64
+ <RichEditor initialValue={state} onChange={setState} variant="article" />;
46
65
  ```
47
66
 
48
- `composeRenderer` returns a memoized React component compatible with `<RichRenderer>`'s prop surface (theme, variant, value, className, style, …).
67
+ Both helpers return memoized React components. `composeEditor` internally wires `composeRenderer` for nested editor states.
49
68
 
50
69
  ## Three consumer modes
51
70
 
@@ -55,11 +74,12 @@ Import the module sugar. Klass + renderer + (optional) lazy/SSR fallback are wir
55
74
 
56
75
  ```tsx
57
76
  import { embedModule } from '@haklex/rich-compose/modules/embed';
77
+ import { embedEditModule } from '@haklex/rich-compose/modules/embed/edit';
58
78
  ```
59
79
 
60
80
  ### Mode B — custom renderer (tree-shake the default)
61
81
 
62
- Import the Klass from the `/node` subpath; supply your own renderer. The default renderer's chunk never enters the bundle.
82
+ Import the Klass from `/node`; supply your own renderer.
63
83
 
64
84
  ```tsx
65
85
  import { GalleryNode } from '@haklex/rich-compose/modules/gallery/node';
@@ -71,7 +91,7 @@ const myGalleryModule: RichRendererModule = {
71
91
  };
72
92
  ```
73
93
 
74
- For modules with no custom Klass (most of the renderer-only modules), simply construct a module with the same `name` and your renderer:
94
+ For renderer-only modules (no custom Klass), construct with matching `name`:
75
95
 
76
96
  ```tsx
77
97
  const myLinkCardModule: RichRendererModule = {
@@ -82,10 +102,9 @@ const myLinkCardModule: RichRendererModule = {
82
102
 
83
103
  ### Mode C — wrap the default
84
104
 
85
- Pull the default renderer from `/renderer` and wrap it.
105
+ Pull the default renderer from `/renderer` and wrap.
86
106
 
87
107
  ```tsx
88
- import { LinkCardNode } from '@haklex/rich-compose/modules/link-card/node'; // when applicable
89
108
  import { LinkCardRenderer } from '@haklex/rich-compose/modules/link-card/renderer';
90
109
 
91
110
  const wrappedModule: RichRendererModule = {
@@ -100,40 +119,32 @@ const wrappedModule: RichRendererModule = {
100
119
  };
101
120
  ```
102
121
 
103
- ## `RichRendererModule` shape
122
+ ## Module shapes
123
+
124
+ `RichRendererModule` (read-only) and `RichEditorModule` (editor superset).
104
125
 
105
126
  ```ts
106
127
  interface RichRendererModule {
107
128
  name: string; // dedup key
108
- nodes?: Klass<LexicalNode>[]; // optional — omit for builtin types
129
+ nodes?: Klass<LexicalNode>[]; // base Klasses
109
130
  renderers?: Partial<RendererConfig>; // sync renderer map
110
- Provider?: ComponentType<{ children: ReactNode }>; // optional internal provider
131
+ Provider?: ComponentType<{ children: ReactNode }>; // shared provider
111
132
  lazyRenderers?: Partial<{
112
- // code-split renderers
113
133
  [K in RendererKey]: () => Promise<{ default: NonNullable<RendererConfig[K]> }>;
114
134
  }>;
115
- ssrFallback?: Partial<Record<RendererKey, ReactNode>>; // deterministic fallback
135
+ ssrFallback?: Partial<Record<RendererKey, ReactNode>>;
116
136
  }
117
- ```
118
-
119
- `composeRenderer` merges modules, dedups Klasses, wraps lazy loaders in `React.lazy` (factory built once per compose), stacks Providers, and always sets `NestedContentRendererProvider` to a recursive closure for nested editor states.
120
-
121
- ## Lazy modules
122
137
 
123
- `code-block` and `mermaid` ship lazy by default with deterministic `ssrFallback`s. The `excalidraw` Klass renders through its own upstream `decorate()` which code-splits internally.
124
-
125
- To override a lazy renderer (e.g., for a sync, pre-tokenized code block on SSR), pass an entry in `overrides`:
126
-
127
- ```ts
128
- composeRenderer({
129
- modules: [
130
- /* ... */
131
- ],
132
- overrides: { CodeBlock: PreTokenizedCodeBlock },
133
- });
138
+ interface RichEditorModule extends RichRendererModule {
139
+ editNodes?: Klass<LexicalNode>[]; // edit-side subclasses (override base by getType)
140
+ editRenderers?: Partial<RendererConfig>; // override renderers in editor mode
141
+ EditorProvider?: ComponentType<{ children: ReactNode }>; // editor-only provider
142
+ plugins?: ReactNode; // module-owned editor plugins
143
+ actions?: ReactNode; // module-owned action UI
144
+ }
134
145
  ```
135
146
 
136
- The lazy chunk is still emitted but never fetched at runtime.
147
+ `composeRenderer` consumes `RichRendererModule[]`; `composeEditor` consumes `RichEditorModule[]`. Each editor module spreads its renderer-only counterpart, so `allEditorModules` is a strict superset of `allRendererModules`.
137
148
 
138
149
  ## Dedup rules
139
150
 
@@ -145,52 +156,93 @@ modules:
145
156
 
146
157
  nodes:
147
158
  reference seen → skip
148
- same getType collision → throw at compose time
149
- (multiple Klass instances break instanceof)
159
+ subclass override → edit Klass replaces base Klass (same getType, A extends B)
160
+ unrelated collision → throw at compose time
161
+ (would break instanceof across module boundaries)
150
162
  ```
151
163
 
152
- ## Module catalog
164
+ ## Lazy modules
165
+
166
+ `code-block` and `mermaid` ship lazy by default with deterministic `ssrFallback`s. `excalidraw`'s Klass code-splits internally via its own `decorate()`.
153
167
 
154
- | Module | Klass | Renderer mode | Source |
155
- | -------------- | ----------------- | ------------------------------- | ------------------------- |
156
- | `alert` | builtin | sync | `rich-renderer-alert` |
157
- | `banner` | builtin | sync | `rich-renderer-banner` |
158
- | `chat` | `ChatNode` | sync | `rich-ext-chat` |
159
- | `code-block` | builtin | lazy + ssr fallback | `rich-renderer-codeblock` |
160
- | `code-snippet` | `CodeSnippetNode` | sync | `rich-ext-code-snippet` |
161
- | `embed` | `EmbedNode` | sync (via node decorate) | `rich-ext-embed` |
162
- | `excalidraw` | `ExcalidrawNode` | via node decorate | `rich-ext-excalidraw` |
163
- | `gallery` | `GalleryNode` | sync | `rich-ext-gallery` |
164
- | `image` | builtin | sync | `rich-renderer-image` |
165
- | `link-card` | builtin | sync | `rich-renderer-linkcard` |
166
- | `mention` | builtin | sync | `rich-renderer-mention` |
167
- | `mermaid` | builtin | lazy + ssr fallback | `rich-renderer-mermaid` |
168
- | `nested-doc` | `NestedDocNode` | recursive (via composeRenderer) | `rich-ext-nested-doc` |
169
- | `ruby` | builtin | sync | `rich-renderer-ruby` |
170
- | `video` | builtin | sync | `rich-renderer-video` |
171
-
172
- Not shipped (handled by `@haklex/rich-editor`'s default renderers via Klass `decorate()`): `katex`, `poll`, `tag`, `footnote`. To override these, pass `overrides` to `composeRenderer`:
168
+ To override a lazy renderer (e.g., pre-tokenized code block for SSR), pass `overrides`:
173
169
 
174
170
  ```ts
175
171
  composeRenderer({
176
- modules: [
177
- /* ... */
178
- ],
179
- overrides: { KaTeX: MyKaTeXRenderer, Poll: MyPollRenderer },
172
+ modules: allRendererModules,
173
+ overrides: { CodeBlock: PreTokenizedCodeBlock },
180
174
  });
181
175
  ```
182
176
 
183
- > **Note**: `@haklex/rich-editor` registers a wide set of custom Klasses in `customNodes` (LinkCard, Mention, Image, Video, KaTeX, Mermaid, Alert, Banner, Ruby, Tag, Poll, CodeBlock, Footnote, etc.). Modules for these contribute only renderer mappings — there is no Klass to register, hence no `node.ts` and no `/node` subpath.
177
+ The lazy chunk is still emitted but never fetched at runtime.
178
+
179
+ ## Module catalog
180
+
181
+ | Module | Base Klass | Edit Klass | Mode | Source |
182
+ | -------------- | ----------------- | --------------------- | ------------------------------- | ------------------------- |
183
+ | `alert` | builtin | — | sync | `rich-renderer-alert` |
184
+ | `banner` | builtin | — | sync | `rich-renderer-banner` |
185
+ | `chat` | `ChatNode` | `ChatEditNode` | sync | `rich-ext-chat` |
186
+ | `code-block` | builtin | — | lazy + ssr fallback | `rich-renderer-codeblock` |
187
+ | `code-snippet` | `CodeSnippetNode` | `CodeSnippetEditNode` | sync | `rich-ext-code-snippet` |
188
+ | `embed` | `EmbedNode` | `EmbedEditNode` | sync (via node decorate) | `rich-ext-embed` |
189
+ | `excalidraw` | `ExcalidrawNode` | `ExcalidrawEditNode` | via node decorate | `rich-ext-excalidraw` |
190
+ | `gallery` | `GalleryNode` | `GalleryEditNode` | sync | `rich-ext-gallery` |
191
+ | `image` | builtin | — | sync | `rich-renderer-image` |
192
+ | `katex` | — | builtin | edit-only (no static renderer) | `rich-renderer-katex` |
193
+ | `link-card` | builtin | — | sync | `rich-renderer-linkcard` |
194
+ | `mention` | builtin | — | sync | `rich-renderer-mention` |
195
+ | `mermaid` | builtin | — | lazy + ssr fallback | `rich-renderer-mermaid` |
196
+ | `nested-doc` | `NestedDocNode` | `NestedDocEditNode` | recursive (via composeRenderer) | `rich-ext-nested-doc` |
197
+ | `poll` | `PollNode` | `PollEditNode` | sync | `rich-ext-poll` |
198
+ | `ruby` | builtin | — | sync | `rich-renderer-ruby` |
199
+ | `video` | builtin | — | sync | `rich-renderer-video` |
200
+
201
+ `katex` ships only an edit module — KaTeX rendering for the read-only side is wired by the host renderer via `decorate()`.
184
202
 
185
203
  ## Sub-path exports
186
204
 
187
- | Path | Description |
188
- | ---------------------------------------------- | --------------------------------------- |
189
- | `@haklex/rich-compose` | core: `composeRenderer`, types, helpers |
190
- | `@haklex/rich-compose/modules/<name>` | full module barrel |
191
- | `@haklex/rich-compose/modules/<name>/node` | Klass(es) only (when applicable) |
192
- | `@haklex/rich-compose/modules/<name>/renderer` | default renderer only |
193
- | `@haklex/rich-compose/style.css` | core styles (skeletons, layout shell) |
205
+ | Path | Description |
206
+ | ---------------------------------------------- | --------------------------------------------------------------- |
207
+ | `@haklex/rich-compose` | core: `composeRenderer`, `composeEditor`, types, helpers |
208
+ | `@haklex/rich-compose/renderer` | aggregate barrel — every renderer module + `allRendererModules` |
209
+ | `@haklex/rich-compose/editor` | aggregate barrel every editor module + `allEditorModules` |
210
+ | `@haklex/rich-compose/modules/<name>` | renderer-side module barrel |
211
+ | `@haklex/rich-compose/modules/<name>/edit` | editor-side module (extends the renderer module) |
212
+ | `@haklex/rich-compose/modules/<name>/node` | Klass(es) only (when applicable) |
213
+ | `@haklex/rich-compose/modules/<name>/renderer` | default renderer only |
214
+ | `@haklex/rich-compose/style.css` | all-in-one CSS bundle — prose body + tokens + every module |
215
+ | `@haklex/rich-compose/style/foundation.css` | prose body + theme tokens + variant classes (no modules) |
216
+ | `@haklex/rich-compose/style/table.css` | built-in table renderer |
217
+ | `@haklex/rich-compose/style/<name>.css` | per-module CSS (alert, banner, image, video, …) |
218
+
219
+ Aggregate barrels are convenient defaults; the fine-grained `/modules/<name>` and `/modules/<name>/edit` subpaths stay available for dynamic-import and selective inclusion.
220
+
221
+ ## CSS strategy
222
+
223
+ Two consumer patterns:
224
+
225
+ **All-in-one (default).** One import covers everything `rich-compose` can render:
226
+
227
+ ```ts
228
+ import '@haklex/rich-compose/style.css';
229
+ ```
230
+
231
+ **Fine-grained (advanced).** Use this when you've overridden one or more default renderers and want to drop their CSS from your bundle. Import `foundation.css` plus the modules you keep — never reach into `rich-renderer-*` or `rich-ext-*` packages directly:
232
+
233
+ ```ts
234
+ import '@haklex/rich-compose/style/foundation.css';
235
+ import '@haklex/rich-compose/style/alert.css';
236
+ import '@haklex/rich-compose/style/image.css';
237
+ import '@haklex/rich-compose/style/ruby.css';
238
+ // …only modules whose default renderer you kept
239
+ ```
240
+
241
+ Module subpaths mirror the JS module subpaths (`modules/<name>` ↔ `style/<name>.css`).
242
+
243
+ ### Why not auto-injected via `import` side effects
244
+
245
+ Earlier versions tried to side-effect-import each module's CSS from inside `modules/<name>/index.ts`. Combined with `sideEffects: ["**/*.css"]` (which marks `.mjs` files as side-effect-free) and bundler optimizations such as Next.js `optimizePackageImports`, those bare CSS imports were tree-shaken away — modules rendered but their styling was missing. The explicit subpath model above eliminates that footgun: the consumer states which CSS they want, and the bundler honors it deterministically.
194
246
 
195
247
  ## Part of Haklex
196
248
 
@@ -0,0 +1,5 @@
1
+ import { RichEditorProps } from '@haklex/rich-editor';
2
+ import { ComponentType } from 'react';
3
+ import { ComposeEditorOptions } from './types';
4
+ export declare function composeEditor(opts: ComposeEditorOptions): ComponentType<RichEditorProps>;
5
+ //# sourceMappingURL=compose-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose-editor.d.ts","sourceRoot":"","sources":["../../src/core/compose-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,aAAa,EAAwD,MAAM,OAAO,CAAC;AAKjG,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,SAAS,CAAC;AAwCtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,aAAa,CAAC,eAAe,CAAC,CA2ExF"}
@@ -6,11 +6,12 @@ import { RichRendererModule } from './types';
6
6
  * 2. Same module.name → replace previous module entirely; warn in dev
7
7
  * 3. Else → append
8
8
  */
9
- export declare function mergeModules(preset: RichRendererModule[] | undefined, modules: RichRendererModule[] | undefined): RichRendererModule[];
9
+ export declare function mergeModules<M extends RichRendererModule>(preset: M[] | undefined, modules: M[] | undefined): M[];
10
10
  /**
11
- * Dedup by class reference. Throws if two distinct Klasses share the same
12
- * `getType()` multiple Klass instances will break `instanceof` checks
13
- * across module boundaries.
11
+ * Dedup by class reference. When two Klasses share the same `getType()`,
12
+ * a subclass relationship (edit Klass extends base Klass) auto-resolves:
13
+ * the subclass replaces its parent. Unrelated collisions throw — `instanceof`
14
+ * would break across module boundaries.
14
15
  */
15
16
  export declare function dedupNodes(nodes: Klass<LexicalNode>[]): Klass<LexicalNode>[];
16
17
  //# sourceMappingURL=dedup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/core/dedup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,kBAAkB,EAAE,GAAG,SAAS,EACxC,OAAO,EAAE,kBAAkB,EAAE,GAAG,SAAS,GACxC,kBAAkB,EAAE,CA0BtB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,EAAE,CAyB5E"}
1
+ {"version":3,"file":"dedup.d.ts","sourceRoot":"","sources":["../../src/core/dedup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,kBAAkB,EACvD,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,EACvB,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,GACvB,CAAC,EAAE,CAyBL;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,EAAE,CAwC5E"}
@@ -1,5 +1,6 @@
1
1
  export { composeRenderer } from './compose';
2
+ export { composeEditor } from './compose-editor';
2
3
  export { dedupNodes, mergeModules } from './dedup';
3
4
  export { wrapLazy } from './lazy';
4
- export type { ComposeRendererOptions, RendererKey, RichRendererBaseProps, RichRendererModule, } from './types';
5
+ export type { ComposeEditorOptions, ComposeRendererOptions, RendererKey, RichEditorModule, RichRendererBaseProps, RichRendererModule, } from './types';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,YAAY,EACV,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
@@ -4,52 +4,39 @@ import { ComponentType, CSSProperties, ReactNode } from 'react';
4
4
  import { BuiltinNodeRenderer } from '../static-renderer/types';
5
5
  export type RendererKey = keyof RendererConfig;
6
6
  export interface RichRendererModule {
7
- /**
8
- * Lazy renderers. Each loader returns the renderer component as default
9
- * export. composeRenderer wraps each in `React.lazy` (factory created
10
- * once at compose time) + `<Suspense fallback={ssrFallback?.[type]}>`.
11
- */
12
7
  lazyRenderers?: Partial<{
13
8
  [K in RendererKey]: () => Promise<{
14
9
  default: NonNullable<RendererConfig[K]>;
15
10
  }>;
16
11
  }>;
17
- /** Stable identifier; used for dedup, debug logs, and Provider DevTools naming. */
18
12
  name: string;
19
- /**
20
- * Lexical node classes. Always synchronous. Optional — modules that only
21
- * override renderers for Lexical builtin types omit this field.
22
- * composeRenderer treats missing `nodes` as `[]`.
23
- */
24
13
  nodes?: Klass<LexicalNode>[];
25
- /**
26
- * Optional context provider. composeRenderer stacks Providers in module
27
- * order outside `<RichRenderer>`. Module Providers are for internal
28
- * plumbing only — do not redeclare `NestedContentRendererProvider`,
29
- * composeRenderer manages it.
30
- */
31
14
  Provider?: ComponentType<{
32
15
  children: ReactNode;
33
16
  }>;
34
- /** type → Component map. Sync renderers. */
35
17
  renderers?: Partial<RendererConfig>;
36
- /**
37
- * SSR / Suspense fallback. Must be deterministic — no Date.now, no random,
38
- * no client-only API access. Renders identically server-side and during
39
- * client hydration.
40
- */
41
18
  ssrFallback?: Partial<Record<RendererKey, ReactNode>>;
42
19
  }
20
+ export interface RichEditorModule extends RichRendererModule {
21
+ actions?: ReactNode;
22
+ editNodes?: Klass<LexicalNode>[];
23
+ EditorProvider?: ComponentType<{
24
+ children: ReactNode;
25
+ }>;
26
+ editRenderers?: Partial<RendererConfig>;
27
+ plugins?: ReactNode;
28
+ }
43
29
  export interface ComposeRendererOptions {
44
- /** Pass-through to `<RichRenderer>` for `paragraph` / `link` / `autolink` etc. */
45
30
  builtinNodeOverrides?: Record<string, BuiltinNodeRenderer>;
46
- /** Appended to preset; later modules override earlier on `name` collision. */
47
31
  modules?: RichRendererModule[];
48
- /** Final renderer overrides; takes precedence over module-supplied renderers. */
49
32
  overrides?: Partial<RendererConfig>;
50
- /** Starting set; can be `shiroPreset`, custom array, or omitted. */
51
33
  preset?: RichRendererModule[];
52
34
  }
35
+ export interface ComposeEditorOptions {
36
+ modules?: RichEditorModule[];
37
+ overrides?: Partial<RendererConfig>;
38
+ preset?: RichEditorModule[];
39
+ }
53
40
  export interface RichRendererBaseProps {
54
41
  as?: keyof React.JSX.IntrinsicElements;
55
42
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;SACrB,CAAC,IAAI,WAAW,GAAG,MAAM,OAAO,CAAC;YAAE,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;SAAE,CAAC;KAC/E,CAAC,CAAC;IAEH,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;IAE7B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAElD,4CAA4C;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAEpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3D,8EAA8E;IAC9E,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,iFAAiF;IACjF,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpC,oEAAoE;IACpE,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;SACrB,CAAC,IAAI,WAAW,GAAG,MAAM,OAAO,CAAC;YAAE,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;SAAE,CAAC;KAC/E,CAAC,CAAC;IACH,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;CACvD;AAED,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3D,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B"}
@@ -0,0 +1,20 @@
1
+ import { alertEditModule } from './modules/alert/edit';
2
+ import { bannerEditModule } from './modules/banner/edit';
3
+ import { chatEditModule } from './modules/chat/edit';
4
+ import { codeBlockEditModule } from './modules/code-block/edit';
5
+ import { codeSnippetEditModule } from './modules/code-snippet/edit';
6
+ import { embedEditModule } from './modules/embed/edit';
7
+ import { excalidrawEditModule } from './modules/excalidraw/edit';
8
+ import { galleryEditModule } from './modules/gallery/edit';
9
+ import { imageEditModule } from './modules/image/edit';
10
+ import { katexEditModule } from './modules/katex/edit';
11
+ import { linkCardEditModule } from './modules/link-card/edit';
12
+ import { mentionEditModule } from './modules/mention/edit';
13
+ import { mermaidEditModule } from './modules/mermaid/edit';
14
+ import { nestedDocEditModule } from './modules/nested-doc/edit';
15
+ import { pollEditModule } from './modules/poll/edit';
16
+ import { rubyEditModule } from './modules/ruby/edit';
17
+ import { videoEditModule } from './modules/video/edit';
18
+ export { alertEditModule, bannerEditModule, chatEditModule, codeBlockEditModule, codeSnippetEditModule, embedEditModule, excalidrawEditModule, galleryEditModule, imageEditModule, katexEditModule, linkCardEditModule, mentionEditModule, mermaidEditModule, nestedDocEditModule, pollEditModule, rubyEditModule, videoEditModule, };
19
+ export declare const allEditorModules: import('./core').RichEditorModule[];
20
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,eAAe,GAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,qCAkB5B,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { alertEditModule } from "./modules/alert/edit.mjs";
2
+ import { bannerEditModule } from "./modules/banner/edit.mjs";
3
+ import { chatEditModule } from "./modules/chat/edit.mjs";
4
+ import { codeBlockEditModule } from "./modules/code-block/edit.mjs";
5
+ import { codeSnippetEditModule } from "./modules/code-snippet/edit.mjs";
6
+ import { embedEditModule } from "./modules/embed/edit.mjs";
7
+ import { excalidrawEditModule } from "./modules/excalidraw/edit.mjs";
8
+ import { galleryEditModule } from "./modules/gallery/edit.mjs";
9
+ import { imageEditModule } from "./modules/image/edit.mjs";
10
+ import { katexEditModule } from "./modules/katex/edit.mjs";
11
+ import { linkCardEditModule } from "./modules/link-card/edit.mjs";
12
+ import { mentionEditModule } from "./modules/mention/edit.mjs";
13
+ import { mermaidEditModule } from "./modules/mermaid/edit.mjs";
14
+ import { nestedDocEditModule } from "./modules/nested-doc/edit.mjs";
15
+ import { pollEditModule } from "./modules/poll/edit.mjs";
16
+ import { rubyEditModule } from "./modules/ruby/edit.mjs";
17
+ import { videoEditModule } from "./modules/video/edit.mjs";
18
+ //#region src/editor.ts
19
+ var allEditorModules = [
20
+ alertEditModule,
21
+ bannerEditModule,
22
+ chatEditModule,
23
+ codeBlockEditModule,
24
+ codeSnippetEditModule,
25
+ embedEditModule,
26
+ excalidrawEditModule,
27
+ galleryEditModule,
28
+ imageEditModule,
29
+ katexEditModule,
30
+ linkCardEditModule,
31
+ mentionEditModule,
32
+ mermaidEditModule,
33
+ nestedDocEditModule,
34
+ pollEditModule,
35
+ rubyEditModule,
36
+ videoEditModule
37
+ ];
38
+ //#endregion
39
+ export { alertEditModule, allEditorModules, bannerEditModule, chatEditModule, codeBlockEditModule, codeSnippetEditModule, embedEditModule, excalidrawEditModule, galleryEditModule, imageEditModule, katexEditModule, linkCardEditModule, mentionEditModule, mermaidEditModule, nestedDocEditModule, pollEditModule, rubyEditModule, videoEditModule };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export type { ComposeRendererOptions, RendererKey, RichRendererBaseProps, RichRendererModule, } from './core';
2
- export { composeRenderer, dedupNodes, mergeModules, wrapLazy } from './core';
1
+ export type { ComposeEditorOptions, ComposeRendererOptions, RendererKey, RichEditorModule, RichRendererBaseProps, RichRendererModule, } from './core';
2
+ export { composeEditor, composeRenderer, dedupNodes, mergeModules, wrapLazy } from './core';
3
3
  export type { BuiltinNodeRenderer, RichRendererProps } from './static-renderer';
4
4
  export { RichRenderer } from './static-renderer';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7E,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC5F,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}