@haklex/rich-headless 0.0.82 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,462 +1,480 @@
1
- import { $toMarkdown, allHeadlessTransformers } from "./transformers.mjs";
2
- import { CodeHighlightNode, CodeNode } from "@lexical/code";
1
+ import { CodeNode, CodeHighlightNode } from "@lexical/code";
3
2
  import { HorizontalRuleNode } from "@lexical/extension";
4
- import { AutoLinkNode, LinkNode } from "@lexical/link";
5
- import { ListItemNode, ListNode } from "@lexical/list";
3
+ import { LinkNode, AutoLinkNode } from "@lexical/link";
4
+ import { ListNode, ListItemNode } from "@lexical/list";
6
5
  import { HeadingNode, QuoteNode } from "@lexical/rich-text";
7
- import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
6
+ import { TableNode, TableCellNode, TableRowNode } from "@lexical/table";
8
7
  import { DecoratorNode, ElementNode } from "lexical";
9
- //#region src/index.ts
10
- /**
11
- * @haklex/rich-headless
12
- *
13
- * Headless-compatible Lexical node registry for server-side parsing.
14
- * Zero React dependency — only lexical + standard @lexical/* packages.
15
- *
16
- * Usage with @lexical/headless:
17
- * import { createHeadlessEditor } from '@lexical/headless'
18
- * import { allHeadlessNodes } from '@haklex/rich-headless'
19
- * const editor = createHeadlessEditor({ nodes: allHeadlessNodes })
20
- */
21
- var builtinNodes = [
22
- HeadingNode,
23
- QuoteNode,
24
- ListNode,
25
- ListItemNode,
26
- LinkNode,
27
- AutoLinkNode,
28
- HorizontalRuleNode,
29
- TableNode,
30
- TableCellNode,
31
- TableRowNode,
32
- CodeNode,
33
- CodeHighlightNode
8
+ import { $toMarkdown, allHeadlessTransformers } from "./transformers.mjs";
9
+ const builtinNodes = [
10
+ HeadingNode,
11
+ QuoteNode,
12
+ ListNode,
13
+ ListItemNode,
14
+ LinkNode,
15
+ AutoLinkNode,
16
+ HorizontalRuleNode,
17
+ TableNode,
18
+ TableCellNode,
19
+ TableRowNode,
20
+ CodeNode,
21
+ CodeHighlightNode
34
22
  ];
35
23
  function stubDOM() {
36
- return document.createElement("span");
24
+ return document.createElement("span");
37
25
  }
38
26
  function extractText(state) {
39
- if (!state || typeof state !== "object") return "";
40
- const root = state.root;
41
- if (!root) return "";
42
- return walkChildren(root);
27
+ if (!state || typeof state !== "object") return "";
28
+ const root = state.root;
29
+ if (!root) return "";
30
+ return walkChildren(root);
43
31
  }
44
32
  function walkChildren(node) {
45
- const children = node.children;
46
- if (!children) return node.text ?? "";
47
- return children.map(walkChildren).join("\n");
33
+ const children = node.children;
34
+ if (!children) return node.text ?? "";
35
+ return children.map(walkChildren).join("\n");
36
+ }
37
+ class SpoilerNode extends ElementNode {
38
+ static getType() {
39
+ return "spoiler";
40
+ }
41
+ static clone(node) {
42
+ return new SpoilerNode(node.__key);
43
+ }
44
+ constructor(key) {
45
+ super(key);
46
+ }
47
+ static importJSON(_json) {
48
+ return new SpoilerNode();
49
+ }
50
+ exportJSON() {
51
+ return { ...super.exportJSON(), type: "spoiler", version: 1 };
52
+ }
53
+ createDOM() {
54
+ return stubDOM();
55
+ }
56
+ updateDOM() {
57
+ return false;
58
+ }
59
+ isInline() {
60
+ return true;
61
+ }
62
+ }
63
+ class RubyNode extends ElementNode {
64
+ constructor(key) {
65
+ super(key);
66
+ this.__reading = "";
67
+ }
68
+ static getType() {
69
+ return "ruby";
70
+ }
71
+ static clone(node) {
72
+ const n = new RubyNode(node.__key);
73
+ n.__reading = node.__reading;
74
+ return n;
75
+ }
76
+ static importJSON(json) {
77
+ const node = new RubyNode();
78
+ node.__reading = json.reading ?? "";
79
+ return node;
80
+ }
81
+ exportJSON() {
82
+ return {
83
+ ...super.exportJSON(),
84
+ type: "ruby",
85
+ reading: this.__reading,
86
+ version: 1
87
+ };
88
+ }
89
+ createDOM() {
90
+ return stubDOM();
91
+ }
92
+ updateDOM() {
93
+ return false;
94
+ }
95
+ isInline() {
96
+ return true;
97
+ }
98
+ }
99
+ class DetailsNode extends ElementNode {
100
+ constructor(key) {
101
+ super(key);
102
+ this.__summary = "";
103
+ this.__open = false;
104
+ }
105
+ static getType() {
106
+ return "details";
107
+ }
108
+ static clone(node) {
109
+ const n = new DetailsNode(node.__key);
110
+ n.__summary = node.__summary;
111
+ n.__open = node.__open;
112
+ return n;
113
+ }
114
+ static importJSON(json) {
115
+ const node = new DetailsNode();
116
+ node.__summary = json.summary ?? "";
117
+ node.__open = json.open ?? false;
118
+ return node;
119
+ }
120
+ exportJSON() {
121
+ return {
122
+ ...super.exportJSON(),
123
+ type: "details",
124
+ summary: this.__summary,
125
+ open: this.__open
126
+ };
127
+ }
128
+ createDOM() {
129
+ return stubDOM();
130
+ }
131
+ updateDOM() {
132
+ return false;
133
+ }
48
134
  }
49
- var SpoilerNode = class SpoilerNode extends ElementNode {
50
- static getType() {
51
- return "spoiler";
52
- }
53
- static clone(node) {
54
- return new SpoilerNode(node.__key);
55
- }
56
- constructor(key) {
57
- super(key);
58
- }
59
- static importJSON(_json) {
60
- return new SpoilerNode();
61
- }
62
- exportJSON() {
63
- return {
64
- ...super.exportJSON(),
65
- type: "spoiler",
66
- version: 1
67
- };
68
- }
69
- createDOM() {
70
- return stubDOM();
71
- }
72
- updateDOM() {
73
- return false;
74
- }
75
- isInline() {
76
- return true;
77
- }
78
- };
79
- var RubyNode = class RubyNode extends ElementNode {
80
- static getType() {
81
- return "ruby";
82
- }
83
- static clone(node) {
84
- const n = new RubyNode(node.__key);
85
- n.__reading = node.__reading;
86
- return n;
87
- }
88
- constructor(key) {
89
- super(key);
90
- this.__reading = "";
91
- }
92
- static importJSON(json) {
93
- const node = new RubyNode();
94
- node.__reading = json.reading ?? "";
95
- return node;
96
- }
97
- exportJSON() {
98
- return {
99
- ...super.exportJSON(),
100
- type: "ruby",
101
- reading: this.__reading,
102
- version: 1
103
- };
104
- }
105
- createDOM() {
106
- return stubDOM();
107
- }
108
- updateDOM() {
109
- return false;
110
- }
111
- isInline() {
112
- return true;
113
- }
114
- };
115
- var DetailsNode = class DetailsNode extends ElementNode {
116
- static getType() {
117
- return "details";
118
- }
119
- static clone(node) {
120
- const n = new DetailsNode(node.__key);
121
- n.__summary = node.__summary;
122
- n.__open = node.__open;
123
- return n;
124
- }
125
- constructor(key) {
126
- super(key);
127
- this.__summary = "";
128
- this.__open = false;
129
- }
130
- static importJSON(json) {
131
- const node = new DetailsNode();
132
- node.__summary = json.summary ?? "";
133
- node.__open = json.open ?? false;
134
- return node;
135
- }
136
- exportJSON() {
137
- return {
138
- ...super.exportJSON(),
139
- type: "details",
140
- summary: this.__summary,
141
- open: this.__open
142
- };
143
- }
144
- createDOM() {
145
- return stubDOM();
146
- }
147
- updateDOM() {
148
- return false;
149
- }
150
- };
151
135
  function headlessDecorator(type, propKeys, defaults, inline = false) {
152
- class Node extends DecoratorNode {
153
- constructor(key) {
154
- super(key);
155
- for (const k of propKeys) this[`__${k}`] = defaults[k];
156
- }
157
- static getType() {
158
- return type;
159
- }
160
- static clone(node) {
161
- const n = new Node(node.__key);
162
- for (const k of propKeys) n[`__${k}`] = node[`__${k}`];
163
- return n;
164
- }
165
- static importJSON(json) {
166
- const node = new Node();
167
- for (const k of propKeys) node[`__${k}`] = json[k] ?? defaults[k];
168
- return node;
169
- }
170
- exportJSON() {
171
- const out = {
172
- type,
173
- version: 1
174
- };
175
- for (const k of propKeys) out[k] = this[`__${k}`];
176
- return out;
177
- }
178
- createDOM(_config) {
179
- return stubDOM();
180
- }
181
- updateDOM() {
182
- return false;
183
- }
184
- decorate(_editor, _config) {
185
- return null;
186
- }
187
- isInline() {
188
- return inline;
189
- }
190
- }
191
- return Node;
136
+ class Node extends DecoratorNode {
137
+ constructor(key) {
138
+ super(key);
139
+ for (const k of propKeys) {
140
+ this[`__${k}`] = defaults[k];
141
+ }
142
+ }
143
+ static getType() {
144
+ return type;
145
+ }
146
+ static clone(node) {
147
+ const n = new Node(node.__key);
148
+ for (const k of propKeys) {
149
+ n[`__${k}`] = node[`__${k}`];
150
+ }
151
+ return n;
152
+ }
153
+ static importJSON(json) {
154
+ const node = new Node();
155
+ for (const k of propKeys) {
156
+ node[`__${k}`] = json[k] ?? defaults[k];
157
+ }
158
+ return node;
159
+ }
160
+ exportJSON() {
161
+ const out = { type, version: 1 };
162
+ for (const k of propKeys) {
163
+ out[k] = this[`__${k}`];
164
+ }
165
+ return out;
166
+ }
167
+ createDOM(_config) {
168
+ return stubDOM();
169
+ }
170
+ updateDOM() {
171
+ return false;
172
+ }
173
+ decorate(_editor, _config) {
174
+ return null;
175
+ }
176
+ isInline() {
177
+ return inline;
178
+ }
179
+ }
180
+ return Node;
192
181
  }
193
- var ImageNode = headlessDecorator("image", [
194
- "src",
195
- "altText",
196
- "width",
197
- "height",
198
- "caption",
199
- "thumbhash",
200
- "accent"
201
- ], {
202
- src: "",
203
- altText: "",
204
- width: void 0,
205
- height: void 0,
206
- caption: void 0,
207
- thumbhash: void 0,
208
- accent: void 0
182
+ const ImageNode = headlessDecorator(
183
+ "image",
184
+ ["src", "altText", "width", "height", "caption", "thumbhash", "accent"],
185
+ {
186
+ src: "",
187
+ altText: "",
188
+ width: void 0,
189
+ height: void 0,
190
+ caption: void 0,
191
+ thumbhash: void 0,
192
+ accent: void 0
193
+ }
194
+ );
195
+ const VideoNode = headlessDecorator("video", ["src", "poster", "width", "height"], {
196
+ src: "",
197
+ poster: void 0,
198
+ width: void 0,
199
+ height: void 0
209
200
  });
210
- var VideoNode = headlessDecorator("video", [
211
- "src",
212
- "poster",
213
- "width",
214
- "height"
215
- ], {
216
- src: "",
217
- poster: void 0,
218
- width: void 0,
219
- height: void 0
201
+ const LinkCardNode = headlessDecorator(
202
+ "link-card",
203
+ ["url", "source", "id", "title", "description", "favicon", "image"],
204
+ {
205
+ url: "",
206
+ source: void 0,
207
+ id: void 0,
208
+ title: void 0,
209
+ description: void 0,
210
+ favicon: void 0,
211
+ image: void 0
212
+ }
213
+ );
214
+ const KaTeXInlineNode = headlessDecorator(
215
+ "katex-inline",
216
+ ["equation"],
217
+ { equation: "" },
218
+ true
219
+ );
220
+ const KaTeXBlockNode = headlessDecorator("katex-block", ["equation"], {
221
+ equation: ""
220
222
  });
221
- var LinkCardNode = headlessDecorator("link-card", [
222
- "url",
223
- "source",
224
- "id",
225
- "title",
226
- "description",
227
- "favicon",
228
- "image"
229
- ], {
230
- url: "",
231
- source: void 0,
232
- id: void 0,
233
- title: void 0,
234
- description: void 0,
235
- favicon: void 0,
236
- image: void 0
223
+ const MermaidNode = headlessDecorator("mermaid", ["diagram"], {
224
+ diagram: ""
237
225
  });
238
- var KaTeXInlineNode = headlessDecorator("katex-inline", ["equation"], { equation: "" }, true);
239
- var KaTeXBlockNode = headlessDecorator("katex-block", ["equation"], { equation: "" });
240
- var MermaidNode = headlessDecorator("mermaid", ["diagram"], { diagram: "" });
241
- var MentionNode = headlessDecorator("mention", [
242
- "platform",
243
- "handle",
244
- "displayName"
245
- ], {
246
- platform: "",
247
- handle: "",
248
- displayName: void 0
249
- }, true);
250
- var CodeBlockNode = headlessDecorator("code-block", ["code", "language"], {
251
- code: "",
252
- language: ""
226
+ const MentionNode = headlessDecorator(
227
+ "mention",
228
+ ["platform", "handle", "displayName"],
229
+ { platform: "", handle: "", displayName: void 0 },
230
+ true
231
+ );
232
+ const CodeBlockNode = headlessDecorator("code-block", ["code", "language"], {
233
+ code: "",
234
+ language: ""
253
235
  });
254
- var FootnoteNode = headlessDecorator("footnote", ["identifier"], { identifier: "" }, true);
255
- var FootnoteSectionNode = headlessDecorator("footnote-section", ["definitions"], { definitions: {} });
256
- var EmbedNode = headlessDecorator("embed", ["url", "source"], {
257
- url: "",
258
- source: null
236
+ const FootnoteNode = headlessDecorator("footnote", ["identifier"], { identifier: "" }, true);
237
+ const FootnoteSectionNode = headlessDecorator("footnote-section", ["definitions"], {
238
+ definitions: {}
259
239
  });
260
- var CodeSnippetNode = headlessDecorator("code-snippet", ["files"], { files: [] });
261
- var GalleryNode = headlessDecorator("gallery", ["images", "layout"], {
262
- images: [],
263
- layout: "grid"
240
+ const EmbedNode = headlessDecorator("embed", ["url", "source"], {
241
+ url: "",
242
+ source: null
264
243
  });
265
- var ExcalidrawNode = headlessDecorator("excalidraw", ["snapshot"], { snapshot: "" });
266
- var TagNode = headlessDecorator("tag", ["text"], { text: "" }, true);
267
- var BannerNode = class BannerNode extends DecoratorNode {
268
- static getType() {
269
- return "banner";
270
- }
271
- constructor(key) {
272
- super(key);
273
- this.__bannerType = "note";
274
- this.__contentState = null;
275
- }
276
- static clone(node) {
277
- const n = new BannerNode(node.__key);
278
- n.__bannerType = node.__bannerType;
279
- n.__contentState = node.__contentState;
280
- return n;
281
- }
282
- static importJSON(json) {
283
- const node = new BannerNode();
284
- node.__bannerType = json.bannerType ?? "note";
285
- node.__contentState = json.content ?? null;
286
- return node;
287
- }
288
- exportJSON() {
289
- return {
290
- type: "banner",
291
- version: 1,
292
- bannerType: this.__bannerType,
293
- content: this.__contentState
294
- };
295
- }
296
- createDOM() {
297
- return stubDOM();
298
- }
299
- updateDOM() {
300
- return false;
301
- }
302
- decorate() {
303
- return null;
304
- }
305
- getTextContent() {
306
- return extractText(this.__contentState);
307
- }
308
- };
309
- var AlertQuoteNode = class AlertQuoteNode extends DecoratorNode {
310
- static getType() {
311
- return "alert-quote";
312
- }
313
- constructor(key) {
314
- super(key);
315
- this.__alertType = "note";
316
- this.__contentState = null;
317
- }
318
- static clone(node) {
319
- const n = new AlertQuoteNode(node.__key);
320
- n.__alertType = node.__alertType;
321
- n.__contentState = node.__contentState;
322
- return n;
323
- }
324
- static importJSON(json) {
325
- const node = new AlertQuoteNode();
326
- node.__alertType = json.alertType ?? "note";
327
- node.__contentState = json.content ?? null;
328
- return node;
329
- }
330
- exportJSON() {
331
- return {
332
- type: "alert-quote",
333
- version: 1,
334
- alertType: this.__alertType,
335
- content: this.__contentState
336
- };
337
- }
338
- createDOM() {
339
- return stubDOM();
340
- }
341
- updateDOM() {
342
- return false;
343
- }
344
- decorate() {
345
- return null;
346
- }
347
- getTextContent() {
348
- return extractText(this.__contentState);
349
- }
350
- };
351
- var NestedDocNode = class NestedDocNode extends DecoratorNode {
352
- static getType() {
353
- return "nested-doc";
354
- }
355
- constructor(key) {
356
- super(key);
357
- this.__contentState = null;
358
- }
359
- static clone(node) {
360
- const n = new NestedDocNode(node.__key);
361
- n.__contentState = node.__contentState;
362
- return n;
363
- }
364
- static importJSON(json) {
365
- const node = new NestedDocNode();
366
- node.__contentState = json.content ?? null;
367
- return node;
368
- }
369
- exportJSON() {
370
- return {
371
- type: "nested-doc",
372
- version: 1,
373
- content: this.__contentState
374
- };
375
- }
376
- createDOM() {
377
- return stubDOM();
378
- }
379
- updateDOM() {
380
- return false;
381
- }
382
- decorate() {
383
- return null;
384
- }
385
- getTextContent() {
386
- return extractText(this.__contentState);
387
- }
388
- };
389
- var GridContainerNode = class GridContainerNode extends DecoratorNode {
390
- static getType() {
391
- return "grid-container";
392
- }
393
- constructor(key) {
394
- super(key);
395
- this.__cols = 2;
396
- this.__gap = "16px";
397
- this.__cells = [];
398
- }
399
- static clone(node) {
400
- const n = new GridContainerNode(node.__key);
401
- n.__cols = node.__cols;
402
- n.__gap = node.__gap;
403
- n.__cells = node.__cells;
404
- return n;
405
- }
406
- static importJSON(json) {
407
- const node = new GridContainerNode();
408
- node.__cols = json.cols ?? 2;
409
- const rawGap = json.gap;
410
- node.__gap = typeof rawGap === "number" ? `${rawGap}px` : rawGap ?? "16px";
411
- node.__cells = json.cells ?? [];
412
- return node;
413
- }
414
- exportJSON() {
415
- return {
416
- type: "grid-container",
417
- version: 1,
418
- cols: this.__cols,
419
- gap: this.__gap,
420
- cells: this.__cells
421
- };
422
- }
423
- createDOM() {
424
- return stubDOM();
425
- }
426
- updateDOM() {
427
- return false;
428
- }
429
- decorate() {
430
- return null;
431
- }
432
- getTextContent() {
433
- return this.__cells.map((cell) => extractText(cell)).join("\n");
434
- }
435
- };
436
- var customHeadlessNodes = [
437
- SpoilerNode,
438
- RubyNode,
439
- DetailsNode,
440
- ImageNode,
441
- VideoNode,
442
- LinkCardNode,
443
- KaTeXInlineNode,
444
- KaTeXBlockNode,
445
- MermaidNode,
446
- MentionNode,
447
- CodeBlockNode,
448
- FootnoteNode,
449
- FootnoteSectionNode,
450
- EmbedNode,
451
- CodeSnippetNode,
452
- GalleryNode,
453
- ExcalidrawNode,
454
- TagNode,
455
- BannerNode,
456
- AlertQuoteNode,
457
- NestedDocNode,
458
- GridContainerNode
244
+ const CodeSnippetNode = headlessDecorator("code-snippet", ["files"], {
245
+ files: []
246
+ });
247
+ const GalleryNode = headlessDecorator("gallery", ["images", "layout"], {
248
+ images: [],
249
+ layout: "grid"
250
+ });
251
+ const ExcalidrawNode = headlessDecorator("excalidraw", ["snapshot"], {
252
+ snapshot: ""
253
+ });
254
+ const TagNode = headlessDecorator("tag", ["text"], { text: "" }, true);
255
+ const CommentNode = headlessDecorator("comment", ["text"], { text: "" }, true);
256
+ class BannerNode extends DecoratorNode {
257
+ constructor(key) {
258
+ super(key);
259
+ this.__bannerType = "note";
260
+ this.__contentState = null;
261
+ }
262
+ static getType() {
263
+ return "banner";
264
+ }
265
+ static clone(node) {
266
+ const n = new BannerNode(node.__key);
267
+ n.__bannerType = node.__bannerType;
268
+ n.__contentState = node.__contentState;
269
+ return n;
270
+ }
271
+ static importJSON(json) {
272
+ const node = new BannerNode();
273
+ node.__bannerType = json.bannerType ?? "note";
274
+ node.__contentState = json.content ?? null;
275
+ return node;
276
+ }
277
+ exportJSON() {
278
+ return {
279
+ type: "banner",
280
+ version: 1,
281
+ bannerType: this.__bannerType,
282
+ content: this.__contentState
283
+ };
284
+ }
285
+ createDOM() {
286
+ return stubDOM();
287
+ }
288
+ updateDOM() {
289
+ return false;
290
+ }
291
+ decorate() {
292
+ return null;
293
+ }
294
+ getTextContent() {
295
+ return extractText(this.__contentState);
296
+ }
297
+ }
298
+ class AlertQuoteNode extends DecoratorNode {
299
+ constructor(key) {
300
+ super(key);
301
+ this.__alertType = "note";
302
+ this.__contentState = null;
303
+ }
304
+ static getType() {
305
+ return "alert-quote";
306
+ }
307
+ static clone(node) {
308
+ const n = new AlertQuoteNode(node.__key);
309
+ n.__alertType = node.__alertType;
310
+ n.__contentState = node.__contentState;
311
+ return n;
312
+ }
313
+ static importJSON(json) {
314
+ const node = new AlertQuoteNode();
315
+ node.__alertType = json.alertType ?? "note";
316
+ node.__contentState = json.content ?? null;
317
+ return node;
318
+ }
319
+ exportJSON() {
320
+ return {
321
+ type: "alert-quote",
322
+ version: 1,
323
+ alertType: this.__alertType,
324
+ content: this.__contentState
325
+ };
326
+ }
327
+ createDOM() {
328
+ return stubDOM();
329
+ }
330
+ updateDOM() {
331
+ return false;
332
+ }
333
+ decorate() {
334
+ return null;
335
+ }
336
+ getTextContent() {
337
+ return extractText(this.__contentState);
338
+ }
339
+ }
340
+ class NestedDocNode extends DecoratorNode {
341
+ constructor(key) {
342
+ super(key);
343
+ this.__contentState = null;
344
+ }
345
+ static getType() {
346
+ return "nested-doc";
347
+ }
348
+ static clone(node) {
349
+ const n = new NestedDocNode(node.__key);
350
+ n.__contentState = node.__contentState;
351
+ return n;
352
+ }
353
+ static importJSON(json) {
354
+ const node = new NestedDocNode();
355
+ node.__contentState = json.content ?? null;
356
+ return node;
357
+ }
358
+ exportJSON() {
359
+ return {
360
+ type: "nested-doc",
361
+ version: 1,
362
+ content: this.__contentState
363
+ };
364
+ }
365
+ createDOM() {
366
+ return stubDOM();
367
+ }
368
+ updateDOM() {
369
+ return false;
370
+ }
371
+ decorate() {
372
+ return null;
373
+ }
374
+ getTextContent() {
375
+ return extractText(this.__contentState);
376
+ }
377
+ }
378
+ class GridContainerNode extends DecoratorNode {
379
+ constructor(key) {
380
+ super(key);
381
+ this.__cols = 2;
382
+ this.__gap = "16px";
383
+ this.__cells = [];
384
+ }
385
+ static getType() {
386
+ return "grid-container";
387
+ }
388
+ static clone(node) {
389
+ const n = new GridContainerNode(node.__key);
390
+ n.__cols = node.__cols;
391
+ n.__gap = node.__gap;
392
+ n.__cells = node.__cells;
393
+ return n;
394
+ }
395
+ static importJSON(json) {
396
+ const node = new GridContainerNode();
397
+ node.__cols = json.cols ?? 2;
398
+ const rawGap = json.gap;
399
+ node.__gap = typeof rawGap === "number" ? `${rawGap}px` : rawGap ?? "16px";
400
+ node.__cells = json.cells ?? [];
401
+ return node;
402
+ }
403
+ exportJSON() {
404
+ return {
405
+ type: "grid-container",
406
+ version: 1,
407
+ cols: this.__cols,
408
+ gap: this.__gap,
409
+ cells: this.__cells
410
+ };
411
+ }
412
+ createDOM() {
413
+ return stubDOM();
414
+ }
415
+ updateDOM() {
416
+ return false;
417
+ }
418
+ decorate() {
419
+ return null;
420
+ }
421
+ getTextContent() {
422
+ return this.__cells.map((cell) => extractText(cell)).join("\n");
423
+ }
424
+ }
425
+ const customHeadlessNodes = [
426
+ SpoilerNode,
427
+ RubyNode,
428
+ DetailsNode,
429
+ ImageNode,
430
+ VideoNode,
431
+ LinkCardNode,
432
+ KaTeXInlineNode,
433
+ KaTeXBlockNode,
434
+ MermaidNode,
435
+ MentionNode,
436
+ CodeBlockNode,
437
+ FootnoteNode,
438
+ FootnoteSectionNode,
439
+ EmbedNode,
440
+ CodeSnippetNode,
441
+ GalleryNode,
442
+ ExcalidrawNode,
443
+ TagNode,
444
+ CommentNode,
445
+ BannerNode,
446
+ AlertQuoteNode,
447
+ NestedDocNode,
448
+ GridContainerNode
459
449
  ];
460
- var allHeadlessNodes = [...builtinNodes, ...customHeadlessNodes];
461
- //#endregion
462
- export { $toMarkdown, AlertQuoteNode, BannerNode, CodeBlockNode, CodeSnippetNode, DetailsNode, EmbedNode, ExcalidrawNode, FootnoteNode, FootnoteSectionNode, GalleryNode, GridContainerNode, ImageNode, KaTeXBlockNode, KaTeXInlineNode, LinkCardNode, MentionNode, MermaidNode, NestedDocNode, RubyNode, SpoilerNode, TagNode, VideoNode, allHeadlessNodes, allHeadlessTransformers, builtinNodes, customHeadlessNodes };
450
+ const allHeadlessNodes = [...builtinNodes, ...customHeadlessNodes];
451
+ export {
452
+ $toMarkdown,
453
+ AlertQuoteNode,
454
+ BannerNode,
455
+ CodeBlockNode,
456
+ CodeSnippetNode,
457
+ CommentNode,
458
+ DetailsNode,
459
+ EmbedNode,
460
+ ExcalidrawNode,
461
+ FootnoteNode,
462
+ FootnoteSectionNode,
463
+ GalleryNode,
464
+ GridContainerNode,
465
+ ImageNode,
466
+ KaTeXBlockNode,
467
+ KaTeXInlineNode,
468
+ LinkCardNode,
469
+ MentionNode,
470
+ MermaidNode,
471
+ NestedDocNode,
472
+ RubyNode,
473
+ SpoilerNode,
474
+ TagNode,
475
+ VideoNode,
476
+ allHeadlessNodes,
477
+ allHeadlessTransformers,
478
+ builtinNodes,
479
+ customHeadlessNodes
480
+ };