@create-markdown/react 0.1.0 → 2.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Val Alexander
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -5,8 +5,8 @@ React components and hooks for @create-markdown.
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- # Using bun
9
- bun add @create-markdown/react
8
+ # Using pnpm
9
+ pnpm add @create-markdown/react
10
10
 
11
11
  # Using npm
12
12
  npm install @create-markdown/react
package/dist/index.cjs CHANGED
@@ -1,520 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __moduleCache = /* @__PURE__ */ new WeakMap;
6
- var __toCommonJS = (from) => {
7
- var entry = __moduleCache.get(from), desc;
8
- if (entry)
9
- return entry;
10
- entry = __defProp({}, "__esModule", { value: true });
11
- if (from && typeof from === "object" || typeof from === "function")
12
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- }));
16
- __moduleCache.set(from, entry);
17
- return entry;
18
- };
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, {
22
- get: all[name],
23
- enumerable: true,
24
- configurable: true,
25
- set: (newValue) => all[name] = () => newValue
26
- });
27
- };
28
-
29
- // src/index.ts
30
- var exports_src = {};
31
- __export(exports_src, {
32
- useMarkdown: () => useMarkdown,
33
- useDocument: () => useDocument,
34
- useBlockEditor: () => useBlockEditor,
35
- text: () => import_core2.text,
36
- paragraph: () => import_core2.paragraph,
37
- numberedList: () => import_core2.numberedList,
38
- link: () => import_core2.link,
39
- italic: () => import_core2.italic,
40
- image: () => import_core2.image,
41
- heading: () => import_core2.heading,
42
- h6: () => import_core2.h6,
43
- h5: () => import_core2.h5,
44
- h4: () => import_core2.h4,
45
- h3: () => import_core2.h3,
46
- h2: () => import_core2.h2,
47
- h1: () => import_core2.h1,
48
- divider: () => import_core2.divider,
49
- codeBlock: () => import_core2.codeBlock,
50
- code: () => import_core2.code,
51
- checkListItem: () => import_core2.checkListItem,
52
- checkList: () => import_core2.checkList,
53
- callout: () => import_core2.callout,
54
- bulletList: () => import_core2.bulletList,
55
- bold: () => import_core2.bold,
56
- blockquote: () => import_core2.blockquote,
57
- VERSION: () => VERSION,
58
- InlineContent: () => InlineContent,
59
- BlockRenderer: () => BlockRenderer,
60
- BlockElement: () => BlockElement
61
- });
62
- module.exports = __toCommonJS(exports_src);
63
-
64
- // src/block-renderer.tsx
65
- var jsx_dev_runtime = require("react/jsx-dev-runtime");
66
- function BlockRenderer({
67
- blocks,
68
- className,
69
- customRenderers
70
- }) {
71
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("div", {
72
- className,
73
- children: blocks.map((block) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV(BlockElement, {
74
- block,
75
- customRenderers
76
- }, block.id, false, undefined, this))
77
- }, undefined, false, undefined, this);
78
- }
79
- function BlockElement({
80
- block,
81
- customRenderers
82
- }) {
83
- const CustomRenderer = customRenderers?.[block.type];
84
- if (CustomRenderer) {
85
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(CustomRenderer, {
86
- block
87
- }, undefined, false, undefined, this);
88
- }
89
- switch (block.type) {
90
- case "paragraph":
91
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ParagraphRenderer, {
92
- block
93
- }, undefined, false, undefined, this);
94
- case "heading":
95
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(HeadingRenderer, {
96
- block
97
- }, undefined, false, undefined, this);
98
- case "bulletList":
99
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(BulletListRenderer, {
100
- block,
101
- customRenderers
102
- }, undefined, false, undefined, this);
103
- case "numberedList":
104
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(NumberedListRenderer, {
105
- block,
106
- customRenderers
107
- }, undefined, false, undefined, this);
108
- case "checkList":
109
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(CheckListRenderer, {
110
- block
111
- }, undefined, false, undefined, this);
112
- case "codeBlock":
113
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(CodeBlockRenderer, {
114
- block
115
- }, undefined, false, undefined, this);
116
- case "blockquote":
117
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(BlockquoteRenderer, {
118
- block
119
- }, undefined, false, undefined, this);
120
- case "table":
121
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(TableRenderer, {
122
- block
123
- }, undefined, false, undefined, this);
124
- case "image":
125
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ImageRenderer, {
126
- block
127
- }, undefined, false, undefined, this);
128
- case "divider":
129
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(DividerRenderer, {}, undefined, false, undefined, this);
130
- case "callout":
131
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(CalloutRenderer, {
132
- block
133
- }, undefined, false, undefined, this);
134
- default:
135
- return null;
136
- }
137
- }
138
- function InlineContent({ spans }) {
139
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(jsx_dev_runtime.Fragment, {
140
- children: spans.map((span, index) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV(SpanElement, {
141
- span
142
- }, index, false, undefined, this))
143
- }, undefined, false, undefined, this);
144
- }
145
- function SpanElement({ span }) {
146
- let content = span.text;
147
- const styles = span.styles;
148
- if (styles.code) {
149
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("code", {
150
- children: content
151
- }, undefined, false, undefined, this);
152
- }
153
- if (styles.highlight) {
154
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("mark", {
155
- children: content
156
- }, undefined, false, undefined, this);
157
- }
158
- if (styles.strikethrough) {
159
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("del", {
160
- children: content
161
- }, undefined, false, undefined, this);
162
- }
163
- if (styles.underline) {
164
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("u", {
165
- children: content
166
- }, undefined, false, undefined, this);
167
- }
168
- if (styles.italic) {
169
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("em", {
170
- children: content
171
- }, undefined, false, undefined, this);
172
- }
173
- if (styles.bold) {
174
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("strong", {
175
- children: content
176
- }, undefined, false, undefined, this);
177
- }
178
- if (styles.link) {
179
- content = /* @__PURE__ */ jsx_dev_runtime.jsxDEV("a", {
180
- href: styles.link.url,
181
- title: styles.link.title,
182
- children: content
183
- }, undefined, false, undefined, this);
184
- }
185
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(jsx_dev_runtime.Fragment, {
186
- children: content
187
- }, undefined, false, undefined, this);
188
- }
189
- function ParagraphRenderer({ block }) {
190
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("p", {
191
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
192
- spans: block.content
193
- }, undefined, false, undefined, this)
194
- }, undefined, false, undefined, this);
195
- }
196
- function HeadingRenderer({ block }) {
197
- const Tag = `h${block.props.level}`;
198
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Tag, {
199
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
200
- spans: block.content
201
- }, undefined, false, undefined, this)
202
- }, undefined, false, undefined, this);
203
- }
204
- function BulletListRenderer({
205
- block,
206
- customRenderers
207
- }) {
208
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("ul", {
209
- children: block.children.map((child) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV("li", {
210
- children: [
211
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
212
- spans: child.content
213
- }, undefined, false, undefined, this),
214
- child.children.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(BlockElement, {
215
- block: child,
216
- customRenderers
217
- }, undefined, false, undefined, this)
218
- ]
219
- }, child.id, true, undefined, this))
220
- }, undefined, false, undefined, this);
221
- }
222
- function NumberedListRenderer({
223
- block,
224
- customRenderers
225
- }) {
226
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("ol", {
227
- children: block.children.map((child) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV("li", {
228
- children: [
229
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
230
- spans: child.content
231
- }, undefined, false, undefined, this),
232
- child.children.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(BlockElement, {
233
- block: child,
234
- customRenderers
235
- }, undefined, false, undefined, this)
236
- ]
237
- }, child.id, true, undefined, this))
238
- }, undefined, false, undefined, this);
239
- }
240
- function CheckListRenderer({ block }) {
241
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("div", {
242
- style: { display: "flex", alignItems: "flex-start", gap: "0.5rem" },
243
- children: [
244
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV("input", {
245
- type: "checkbox",
246
- checked: block.props.checked,
247
- readOnly: true,
248
- style: { marginTop: "0.25rem" }
249
- }, undefined, false, undefined, this),
250
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV("span", {
251
- style: { textDecoration: block.props.checked ? "line-through" : "none" },
252
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
253
- spans: block.content
254
- }, undefined, false, undefined, this)
255
- }, undefined, false, undefined, this)
256
- ]
257
- }, undefined, true, undefined, this);
258
- }
259
- function CodeBlockRenderer({ block }) {
260
- const code = block.content.map((span) => span.text).join("");
261
- const language = block.props.language;
262
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("pre", {
263
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV("code", {
264
- className: language ? `language-${language}` : undefined,
265
- children: code
266
- }, undefined, false, undefined, this)
267
- }, undefined, false, undefined, this);
268
- }
269
- function BlockquoteRenderer({ block }) {
270
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("blockquote", {
271
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
272
- spans: block.content
273
- }, undefined, false, undefined, this)
274
- }, undefined, false, undefined, this);
275
- }
276
- function TableRenderer({ block }) {
277
- const { headers, rows, alignments } = block.props;
278
- const getAlignment = (index) => {
279
- return alignments?.[index] ?? undefined;
280
- };
281
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("table", {
282
- children: [
283
- headers.length > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV("thead", {
284
- children: /* @__PURE__ */ jsx_dev_runtime.jsxDEV("tr", {
285
- children: headers.map((header, i) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV("th", {
286
- style: { textAlign: getAlignment(i) },
287
- children: header
288
- }, i, false, undefined, this))
289
- }, undefined, false, undefined, this)
290
- }, undefined, false, undefined, this),
291
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV("tbody", {
292
- children: rows.map((row, rowIndex) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV("tr", {
293
- children: row.map((cell, cellIndex) => /* @__PURE__ */ jsx_dev_runtime.jsxDEV("td", {
294
- style: { textAlign: getAlignment(cellIndex) },
295
- children: cell
296
- }, cellIndex, false, undefined, this))
297
- }, rowIndex, false, undefined, this))
298
- }, undefined, false, undefined, this)
299
- ]
300
- }, undefined, true, undefined, this);
301
- }
302
- function ImageRenderer({ block }) {
303
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("figure", {
304
- children: [
305
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV("img", {
306
- src: block.props.url,
307
- alt: block.props.alt ?? "",
308
- title: block.props.title,
309
- width: block.props.width,
310
- height: block.props.height
311
- }, undefined, false, undefined, this),
312
- block.props.alt && /* @__PURE__ */ jsx_dev_runtime.jsxDEV("figcaption", {
313
- children: block.props.alt
314
- }, undefined, false, undefined, this)
315
- ]
316
- }, undefined, true, undefined, this);
317
- }
318
- function DividerRenderer() {
319
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("hr", {}, undefined, false, undefined, this);
320
- }
321
- function CalloutRenderer({ block }) {
322
- const calloutType = block.props.type;
323
- const styles = {
324
- padding: "1rem",
325
- borderRadius: "0.25rem",
326
- borderLeft: "4px solid",
327
- marginBottom: "1rem"
328
- };
329
- const colors = {
330
- info: { borderColor: "#3b82f6", backgroundColor: "#eff6ff" },
331
- warning: { borderColor: "#f59e0b", backgroundColor: "#fffbeb" },
332
- tip: { borderColor: "#10b981", backgroundColor: "#ecfdf5" },
333
- danger: { borderColor: "#ef4444", backgroundColor: "#fef2f2" },
334
- note: { borderColor: "#6b7280", backgroundColor: "#f9fafb" }
335
- };
336
- const colorStyle = colors[calloutType] ?? colors.note;
337
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV("div", {
338
- style: {
339
- ...styles,
340
- borderLeftColor: colorStyle.borderColor,
341
- backgroundColor: colorStyle.backgroundColor
342
- },
343
- role: "alert",
344
- children: [
345
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV("strong", {
346
- style: { textTransform: "capitalize", display: "block", marginBottom: "0.5rem" },
347
- children: calloutType
348
- }, undefined, false, undefined, this),
349
- /* @__PURE__ */ jsx_dev_runtime.jsxDEV(InlineContent, {
350
- spans: block.content
351
- }, undefined, false, undefined, this)
352
- ]
353
- }, undefined, true, undefined, this);
354
- }
355
- // src/hooks.ts
356
- var import_react = require("react");
357
- var import_core = require("@create-markdown/core");
358
- function useDocument(initialBlocks = [], options) {
359
- const [document, setDocument] = import_react.useState(() => import_core.createDocument(initialBlocks, options));
360
- const insert = import_react.useCallback((block, index) => {
361
- setDocument((doc) => import_core.insertBlock(doc, block, index));
362
- }, []);
363
- const append = import_react.useCallback((block) => {
364
- setDocument((doc) => import_core.appendBlock(doc, block));
365
- }, []);
366
- const remove = import_react.useCallback((blockId) => {
367
- setDocument((doc) => import_core.removeBlock(doc, blockId));
368
- }, []);
369
- const update = import_react.useCallback((blockId, updates) => {
370
- setDocument((doc) => import_core.updateBlock(doc, blockId, updates));
371
- }, []);
372
- const move = import_react.useCallback((blockId, newIndex) => {
373
- setDocument((doc) => import_core.moveBlock(doc, blockId, newIndex));
374
- }, []);
375
- const find = import_react.useCallback((blockId) => import_core.findBlock(document, blockId), [document]);
376
- const getIndex = import_react.useCallback((blockId) => import_core.getBlockIndex(document, blockId), [document]);
377
- const clear = import_react.useCallback(() => {
378
- setDocument((doc) => import_core.clearBlocks(doc));
379
- }, []);
380
- const set = import_react.useCallback((blocks) => {
381
- setDocument((doc) => import_core.setBlocks(doc, blocks));
382
- }, []);
383
- const toMd = import_react.useCallback(() => import_core.blocksToMarkdown(document.blocks), [document]);
384
- const fromMd = import_react.useCallback((markdown) => {
385
- const blocks = import_core.markdownToBlocks(markdown);
386
- setDocument((doc) => import_core.setBlocks(doc, blocks));
387
- }, []);
388
- const meta = import_react.useCallback((newMeta) => {
389
- setDocument((doc) => import_core.updateMeta(doc, newMeta));
390
- }, []);
391
- return {
392
- document,
393
- blocks: document.blocks,
394
- insertBlock: insert,
395
- appendBlock: append,
396
- removeBlock: remove,
397
- updateBlock: update,
398
- moveBlock: move,
399
- findBlock: find,
400
- getBlockIndex: getIndex,
401
- clearBlocks: clear,
402
- setBlocks: set,
403
- setDocument,
404
- toMarkdown: toMd,
405
- fromMarkdown: fromMd,
406
- updateMeta: meta
407
- };
408
- }
409
- function useMarkdown(initialMarkdown = "") {
410
- const [markdown, setMarkdownState] = import_react.useState(initialMarkdown);
411
- const blocks = import_react.useMemo(() => import_core.markdownToBlocks(markdown), [markdown]);
412
- const setMarkdown = import_react.useCallback((newMarkdown) => {
413
- setMarkdownState(newMarkdown);
414
- }, []);
415
- const setBlocksFromBlocks = import_react.useCallback((newBlocks) => {
416
- const newMarkdown = import_core.blocksToMarkdown(newBlocks);
417
- setMarkdownState(newMarkdown);
418
- }, []);
419
- return {
420
- markdown,
421
- blocks,
422
- setMarkdown,
423
- setBlocks: setBlocksFromBlocks
424
- };
425
- }
426
- function useBlockEditor(documentHook) {
427
- const { document, blocks, removeBlock: removeBlock2, updateBlock: updateBlock2, moveBlock: moveBlock2, insertBlock: insertBlock2 } = documentHook;
428
- const [selectedBlockId, setSelectedBlockId] = import_react.useState(null);
429
- const selectedBlock = import_react.useMemo(() => selectedBlockId ? import_core.findBlock(document, selectedBlockId) : undefined, [document, selectedBlockId]);
430
- const selectBlock = import_react.useCallback((blockId) => {
431
- setSelectedBlockId(blockId);
432
- }, []);
433
- const selectNext = import_react.useCallback(() => {
434
- if (!selectedBlockId) {
435
- if (blocks.length > 0) {
436
- setSelectedBlockId(blocks[0].id);
437
- }
438
- return;
439
- }
440
- const currentIndex = import_core.getBlockIndex(document, selectedBlockId);
441
- if (currentIndex < blocks.length - 1) {
442
- setSelectedBlockId(blocks[currentIndex + 1].id);
443
- }
444
- }, [document, blocks, selectedBlockId]);
445
- const selectPrevious = import_react.useCallback(() => {
446
- if (!selectedBlockId) {
447
- if (blocks.length > 0) {
448
- setSelectedBlockId(blocks[blocks.length - 1].id);
449
- }
450
- return;
451
- }
452
- const currentIndex = import_core.getBlockIndex(document, selectedBlockId);
453
- if (currentIndex > 0) {
454
- setSelectedBlockId(blocks[currentIndex - 1].id);
455
- }
456
- }, [document, blocks, selectedBlockId]);
457
- const deleteSelected = import_react.useCallback(() => {
458
- if (!selectedBlockId)
459
- return;
460
- const currentIndex = import_core.getBlockIndex(document, selectedBlockId);
461
- removeBlock2(selectedBlockId);
462
- if (blocks.length > 1) {
463
- if (currentIndex < blocks.length - 1) {
464
- setSelectedBlockId(blocks[currentIndex + 1].id);
465
- } else if (currentIndex > 0) {
466
- setSelectedBlockId(blocks[currentIndex - 1].id);
467
- }
468
- } else {
469
- setSelectedBlockId(null);
470
- }
471
- }, [document, blocks, selectedBlockId, removeBlock2]);
472
- const updateSelectedContent = import_react.useCallback((content) => {
473
- if (!selectedBlockId)
474
- return;
475
- updateBlock2(selectedBlockId, { content });
476
- }, [selectedBlockId, updateBlock2]);
477
- const duplicateSelected = import_react.useCallback(() => {
478
- if (!selectedBlockId || !selectedBlock)
479
- return;
480
- const currentIndex = import_core.getBlockIndex(document, selectedBlockId);
481
- const clonedBlock = {
482
- ...selectedBlock,
483
- id: Math.random().toString(36).substring(2, 9)
484
- };
485
- insertBlock2(clonedBlock, currentIndex + 1);
486
- setSelectedBlockId(clonedBlock.id);
487
- }, [document, selectedBlockId, selectedBlock, insertBlock2]);
488
- const moveSelectedUp = import_react.useCallback(() => {
489
- if (!selectedBlockId)
490
- return;
491
- const currentIndex = import_core.getBlockIndex(document, selectedBlockId);
492
- if (currentIndex > 0) {
493
- moveBlock2(selectedBlockId, currentIndex - 1);
494
- }
495
- }, [document, selectedBlockId, moveBlock2]);
496
- const moveSelectedDown = import_react.useCallback(() => {
497
- if (!selectedBlockId)
498
- return;
499
- const currentIndex = import_core.getBlockIndex(document, selectedBlockId);
500
- if (currentIndex < blocks.length - 1) {
501
- moveBlock2(selectedBlockId, currentIndex + 1);
502
- }
503
- }, [document, blocks, selectedBlockId, moveBlock2]);
504
- return {
505
- selectedBlockId,
506
- selectedBlock,
507
- selectBlock,
508
- selectNext,
509
- selectPrevious,
510
- deleteSelected,
511
- updateSelectedContent,
512
- duplicateSelected,
513
- moveSelectedUp,
514
- moveSelectedDown
515
- };
516
- }
517
-
518
- // src/index.ts
519
- var import_core2 = require("@create-markdown/core");
520
- var VERSION = "0.1.0";
1
+ "use strict";var S=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var U=(o,e)=>{for(var t in e)S(o,t,{get:e[t],enumerable:!0})},N=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let k of M(e))!L.call(o,k)&&k!==t&&S(o,k,{get:()=>e[k],enumerable:!(i=D(e,k))||i.enumerable});return o};var q=o=>N(S({},"__esModule",{value:!0}),o);var W={};U(W,{BlockElement:()=>b,BlockRenderer:()=>w,InlineContent:()=>g,VERSION:()=>Q,blockquote:()=>r.blockquote,bold:()=>r.bold,bulletList:()=>r.bulletList,callout:()=>r.callout,checkList:()=>r.checkList,checkListItem:()=>r.checkListItem,code:()=>r.code,codeBlock:()=>r.codeBlock,divider:()=>r.divider,h1:()=>r.h1,h2:()=>r.h2,h3:()=>r.h3,h4:()=>r.h4,h5:()=>r.h5,h6:()=>r.h6,heading:()=>r.heading,image:()=>r.image,italic:()=>r.italic,link:()=>r.link,numberedList:()=>r.numberedList,paragraph:()=>r.paragraph,text:()=>r.text,useBlockEditor:()=>P,useDocument:()=>T,useMarkdown:()=>E});module.exports=q(W);var n=require("react/jsx-runtime");function w({blocks:o,className:e,customRenderers:t}){return(0,n.jsx)("div",{className:e,children:o.map(i=>(0,n.jsx)(b,{block:i,customRenderers:t},i.id))})}function b({block:o,customRenderers:e}){let t=e?.[o.type];if(t)return(0,n.jsx)(t,{block:o});switch(o.type){case"paragraph":return(0,n.jsx)(H,{block:o});case"heading":return(0,n.jsx)(A,{block:o});case"bulletList":return(0,n.jsx)($,{block:o,customRenderers:e});case"numberedList":return(0,n.jsx)(z,{block:o,customRenderers:e});case"checkList":return(0,n.jsx)(F,{block:o});case"codeBlock":return(0,n.jsx)(J,{block:o});case"blockquote":return(0,n.jsx)(V,{block:o});case"table":return(0,n.jsx)(X,{block:o});case"image":return(0,n.jsx)(j,{block:o});case"divider":return(0,n.jsx)(G,{});case"callout":return(0,n.jsx)(K,{block:o});default:return null}}function g({spans:o}){return(0,n.jsx)(n.Fragment,{children:o.map((e,t)=>(0,n.jsx)(O,{span:e},t))})}function O({span:o}){let e=o.text,t=o.styles;return t.code&&(e=(0,n.jsx)("code",{children:e})),t.highlight&&(e=(0,n.jsx)("mark",{children:e})),t.strikethrough&&(e=(0,n.jsx)("del",{children:e})),t.underline&&(e=(0,n.jsx)("u",{children:e})),t.italic&&(e=(0,n.jsx)("em",{children:e})),t.bold&&(e=(0,n.jsx)("strong",{children:e})),t.link&&(e=(0,n.jsx)("a",{href:t.link.url,title:t.link.title,children:e})),(0,n.jsx)(n.Fragment,{children:e})}function H({block:o}){return(0,n.jsx)("p",{children:(0,n.jsx)(g,{spans:o.content})})}function A({block:o}){let e=`h${o.props.level}`;return(0,n.jsx)(e,{children:(0,n.jsx)(g,{spans:o.content})})}function $({block:o,customRenderers:e}){return(0,n.jsx)("ul",{children:o.children.map(t=>(0,n.jsxs)("li",{children:[(0,n.jsx)(g,{spans:t.content}),t.children.length>0&&(0,n.jsx)(b,{block:t,customRenderers:e})]},t.id))})}function z({block:o,customRenderers:e}){return(0,n.jsx)("ol",{children:o.children.map(t=>(0,n.jsxs)("li",{children:[(0,n.jsx)(g,{spans:t.content}),t.children.length>0&&(0,n.jsx)(b,{block:t,customRenderers:e})]},t.id))})}function F({block:o}){return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem"},children:[(0,n.jsx)("input",{type:"checkbox",checked:o.props.checked,readOnly:!0,style:{marginTop:"0.25rem"}}),(0,n.jsx)("span",{style:{textDecoration:o.props.checked?"line-through":"none"},children:(0,n.jsx)(g,{spans:o.content})})]})}function J({block:o}){let e=o.content.map(i=>i.text).join(""),t=o.props.language;return(0,n.jsx)("pre",{children:(0,n.jsx)("code",{className:t?`language-${t}`:void 0,children:e})})}function V({block:o}){return(0,n.jsx)("blockquote",{children:(0,n.jsx)(g,{spans:o.content})})}function X({block:o}){let{headers:e,rows:t,alignments:i}=o.props,k=p=>i?.[p]??void 0;return(0,n.jsxs)("table",{children:[e.length>0&&(0,n.jsx)("thead",{children:(0,n.jsx)("tr",{children:e.map((p,B)=>(0,n.jsx)("th",{style:{textAlign:k(B)},children:p},B))})}),(0,n.jsx)("tbody",{children:t.map((p,B)=>(0,n.jsx)("tr",{children:p.map((l,m)=>(0,n.jsx)("td",{style:{textAlign:k(m)},children:l},m))},B))})]})}function j({block:o}){return(0,n.jsxs)("figure",{children:[(0,n.jsx)("img",{src:o.props.url,alt:o.props.alt??"",title:o.props.title,width:o.props.width,height:o.props.height}),o.props.alt&&(0,n.jsx)("figcaption",{children:o.props.alt})]})}function G(){return(0,n.jsx)("hr",{})}function K({block:o}){let e=o.props.type,t={padding:"1rem",borderRadius:"0.25rem",borderLeft:"4px solid",marginBottom:"1rem"},i={info:{borderColor:"#3b82f6",backgroundColor:"#eff6ff"},warning:{borderColor:"#f59e0b",backgroundColor:"#fffbeb"},tip:{borderColor:"#10b981",backgroundColor:"#ecfdf5"},danger:{borderColor:"#ef4444",backgroundColor:"#fef2f2"},note:{borderColor:"#6b7280",backgroundColor:"#f9fafb"}},k=i[e]??i.note;return(0,n.jsxs)("div",{style:{...t,borderLeftColor:k.borderColor,backgroundColor:k.backgroundColor},role:"alert",children:[(0,n.jsx)("strong",{style:{textTransform:"capitalize",display:"block",marginBottom:"0.5rem"},children:e}),(0,n.jsx)(g,{spans:o.content})]})}var a=require("react"),c=require("@create-markdown/core");function T(o=[],e){let[t,i]=(0,a.useState)(()=>(0,c.createDocument)(o,e)),k=(0,a.useCallback)((d,u)=>{i(s=>(0,c.insertBlock)(s,d,u))},[]),p=(0,a.useCallback)(d=>{i(u=>(0,c.appendBlock)(u,d))},[]),B=(0,a.useCallback)(d=>{i(u=>(0,c.removeBlock)(u,d))},[]),l=(0,a.useCallback)((d,u)=>{i(s=>(0,c.updateBlock)(s,d,u))},[]),m=(0,a.useCallback)((d,u)=>{i(s=>(0,c.moveBlock)(s,d,u))},[]),f=(0,a.useCallback)(d=>(0,c.findBlock)(t,d),[t]),R=(0,a.useCallback)(d=>(0,c.getBlockIndex)(t,d),[t]),h=(0,a.useCallback)(()=>{i(d=>(0,c.clearBlocks)(d))},[]),C=(0,a.useCallback)(d=>{i(u=>(0,c.setBlocks)(u,d))},[]),x=(0,a.useCallback)(()=>(0,c.blocksToMarkdown)(t.blocks),[t]),y=(0,a.useCallback)(d=>{let u=(0,c.markdownToBlocks)(d);i(s=>(0,c.setBlocks)(s,u))},[]),v=(0,a.useCallback)(d=>{i(u=>(0,c.updateMeta)(u,d))},[]);return{document:t,blocks:t.blocks,insertBlock:k,appendBlock:p,removeBlock:B,updateBlock:l,moveBlock:m,findBlock:f,getBlockIndex:R,clearBlocks:h,setBlocks:C,setDocument:i,toMarkdown:x,fromMarkdown:y,updateMeta:v}}function E(o=""){let[e,t]=(0,a.useState)(o),i=(0,a.useMemo)(()=>(0,c.markdownToBlocks)(e),[e]),k=(0,a.useCallback)(B=>{t(B)},[]),p=(0,a.useCallback)(B=>{let l=(0,c.blocksToMarkdown)(B);t(l)},[]);return{markdown:e,blocks:i,setMarkdown:k,setBlocks:p}}function P(o){let{document:e,blocks:t,removeBlock:i,updateBlock:k,moveBlock:p,insertBlock:B}=o,[l,m]=(0,a.useState)(null),f=(0,a.useMemo)(()=>l?(0,c.findBlock)(e,l):void 0,[e,l]),R=(0,a.useCallback)(s=>{m(s)},[]),h=(0,a.useCallback)(()=>{if(!l){t.length>0&&m(t[0].id);return}let s=(0,c.getBlockIndex)(e,l);s<t.length-1&&m(t[s+1].id)},[e,t,l]),C=(0,a.useCallback)(()=>{if(!l){t.length>0&&m(t[t.length-1].id);return}let s=(0,c.getBlockIndex)(e,l);s>0&&m(t[s-1].id)},[e,t,l]),x=(0,a.useCallback)(()=>{if(!l)return;let s=(0,c.getBlockIndex)(e,l);i(l),t.length>1?s<t.length-1?m(t[s+1].id):s>0&&m(t[s-1].id):m(null)},[e,t,l,i]),y=(0,a.useCallback)(s=>{l&&k(l,{content:s})},[l,k]),v=(0,a.useCallback)(()=>{if(!l||!f)return;let s=(0,c.getBlockIndex)(e,l),I={...f,id:Math.random().toString(36).substring(2,9)};B(I,s+1),m(I.id)},[e,l,f,B]),d=(0,a.useCallback)(()=>{if(!l)return;let s=(0,c.getBlockIndex)(e,l);s>0&&p(l,s-1)},[e,l,p]),u=(0,a.useCallback)(()=>{if(!l)return;let s=(0,c.getBlockIndex)(e,l);s<t.length-1&&p(l,s+1)},[e,t,l,p]);return{selectedBlockId:l,selectedBlock:f,selectBlock:R,selectNext:h,selectPrevious:C,deleteSelected:x,updateSelectedContent:y,duplicateSelected:v,moveSelectedUp:d,moveSelectedDown:u}}var r=require("@create-markdown/core"),Q="2.0.0";0&&(module.exports={BlockElement,BlockRenderer,InlineContent,VERSION,blockquote,bold,bulletList,callout,checkList,checkListItem,code,codeBlock,divider,h1,h2,h3,h4,h5,h6,heading,image,italic,link,numberedList,paragraph,text,useBlockEditor,useDocument,useMarkdown});
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/block-renderer.tsx","../src/hooks.ts"],"sourcesContent":["/**\n * @create-markdown/react\n * React components and hooks for @create-markdown\n */\n\n// Components\nexport {\n BlockRenderer,\n BlockElement,\n InlineContent,\n} from './block-renderer';\n\nexport type {\n BlockRendererProps,\n BlockRenderers,\n SingleBlockProps,\n} from './block-renderer';\n\n// Hooks\nexport {\n useDocument,\n useMarkdown,\n useBlockEditor,\n} from './hooks';\n\nexport type {\n UseDocumentReturn,\n UseMarkdownReturn,\n UseBlockEditorReturn,\n} from './hooks';\n\n// Re-export types that are commonly needed with React components\nexport type {\n Block,\n BlockType,\n Document,\n TextSpan,\n InlineStyle,\n} from '@create-markdown/core';\n\n// Re-export block factories for convenience\nexport {\n paragraph,\n heading,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n bulletList,\n numberedList,\n checkListItem,\n checkList,\n codeBlock,\n blockquote,\n divider,\n image,\n callout,\n text,\n bold,\n italic,\n code,\n link,\n} from '@create-markdown/core';\n\n// ============================================================================\n// Package Info\n// ============================================================================\n\n/**\n * Package version\n */\nexport const VERSION = '2.0.0';\n","/**\n * @create-markdown/react - Block Renderer\n * Render blocks as React elements\n */\n\nimport React from 'react';\nimport type {\n Block,\n TextSpan,\n HeadingBlock,\n CodeBlockBlock,\n ImageBlock,\n TableBlock,\n CalloutBlock,\n CheckListBlock,\n} from '@create-markdown/core';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface BlockRendererProps {\n /** Blocks to render */\n blocks: Block[];\n /** Custom class name for the container */\n className?: string;\n /** Custom renderers for specific block types */\n customRenderers?: Partial<BlockRenderers>;\n}\n\nexport interface BlockRenderers {\n paragraph: React.ComponentType<{ block: Block }>;\n heading: React.ComponentType<{ block: HeadingBlock }>;\n bulletList: React.ComponentType<{ block: Block }>;\n numberedList: React.ComponentType<{ block: Block }>;\n checkList: React.ComponentType<{ block: CheckListBlock }>;\n codeBlock: React.ComponentType<{ block: CodeBlockBlock }>;\n blockquote: React.ComponentType<{ block: Block }>;\n table: React.ComponentType<{ block: TableBlock }>;\n image: React.ComponentType<{ block: ImageBlock }>;\n divider: React.ComponentType<{ block: Block }>;\n callout: React.ComponentType<{ block: CalloutBlock }>;\n}\n\nexport interface SingleBlockProps {\n block: Block;\n customRenderers?: Partial<BlockRenderers>;\n}\n\n// ============================================================================\n// Main Component\n// ============================================================================\n\n/**\n * Renders: array of blocks as React elements\n */\nexport function BlockRenderer({\n blocks,\n className,\n customRenderers,\n}: BlockRendererProps): React.ReactElement {\n return (\n <div className={className}>\n {blocks.map((block) => (\n <BlockElement\n key={block.id}\n block={block}\n customRenderers={customRenderers}\n />\n ))}\n </div>\n );\n}\n\n/**\n * Renders: single block\n */\nexport function BlockElement({\n block,\n customRenderers,\n}: SingleBlockProps): React.ReactElement | null {\n // Check for custom renderer first\n const CustomRenderer = customRenderers?.[block.type as keyof BlockRenderers];\n if (CustomRenderer) {\n return <CustomRenderer block={block as never} />;\n }\n\n // Use default renderers\n switch (block.type) {\n case 'paragraph':\n return <ParagraphRenderer block={block} />;\n\n case 'heading':\n return <HeadingRenderer block={block as HeadingBlock} />;\n\n case 'bulletList':\n return <BulletListRenderer block={block} customRenderers={customRenderers} />;\n\n case 'numberedList':\n return <NumberedListRenderer block={block} customRenderers={customRenderers} />;\n\n case 'checkList':\n return <CheckListRenderer block={block as CheckListBlock} />;\n\n case 'codeBlock':\n return <CodeBlockRenderer block={block as CodeBlockBlock} />;\n\n case 'blockquote':\n return <BlockquoteRenderer block={block} />;\n\n case 'table':\n return <TableRenderer block={block as TableBlock} />;\n\n case 'image':\n return <ImageRenderer block={block as ImageBlock} />;\n\n case 'divider':\n return <DividerRenderer />;\n\n case 'callout':\n return <CalloutRenderer block={block as CalloutBlock} />;\n\n default:\n return null;\n }\n}\n\n// ============================================================================\n// Inline Content Renderer\n// ============================================================================\n\ninterface InlineContentProps {\n spans: TextSpan[];\n}\n\n/**\n * Renders: inline content (text spans with styles)\n */\nexport function InlineContent({ spans }: InlineContentProps): React.ReactElement {\n return (\n <>\n {spans.map((span, index) => (\n <SpanElement key={index} span={span} />\n ))}\n </>\n );\n}\n\ninterface SpanProps {\n span: TextSpan;\n}\n\n/**\n * Renders: single text span with styles\n */\nfunction SpanElement({ span }: SpanProps): React.ReactElement {\n let content: React.ReactNode = span.text;\n const styles = span.styles;\n\n // Apply styles from innermost to outermost\n if (styles.code) {\n content = <code>{content}</code>;\n }\n\n if (styles.highlight) {\n content = <mark>{content}</mark>;\n }\n\n if (styles.strikethrough) {\n content = <del>{content}</del>;\n }\n\n if (styles.underline) {\n content = <u>{content}</u>;\n }\n\n if (styles.italic) {\n content = <em>{content}</em>;\n }\n\n if (styles.bold) {\n content = <strong>{content}</strong>;\n }\n\n if (styles.link) {\n content = (\n <a href={styles.link.url} title={styles.link.title}>\n {content}\n </a>\n );\n }\n\n return <>{content}</>;\n}\n\n// ============================================================================\n// Block Renderers\n// ============================================================================\n\n/**\n * Renders: paragraph block\n */\nfunction ParagraphRenderer({ block }: { block: Block }): React.ReactElement {\n return (\n <p>\n <InlineContent spans={block.content} />\n </p>\n );\n}\n\n/**\n * Renders: heading block\n */\nfunction HeadingRenderer({ block }: { block: HeadingBlock }): React.ReactElement {\n const Tag = `h${block.props.level}` as keyof React.JSX.IntrinsicElements;\n\n return (\n <Tag>\n <InlineContent spans={block.content} />\n </Tag>\n );\n}\n\n/**\n * Renders: bullet list block\n */\nfunction BulletListRenderer({\n block,\n customRenderers,\n}: {\n block: Block;\n customRenderers?: Partial<BlockRenderers>;\n}): React.ReactElement {\n return (\n <ul>\n {block.children.map((child) => (\n <li key={child.id}>\n <InlineContent spans={child.content} />\n {child.children.length > 0 && (\n <BlockElement block={child} customRenderers={customRenderers} />\n )}\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * Renders: numbered list block\n */\nfunction NumberedListRenderer({\n block,\n customRenderers,\n}: {\n block: Block;\n customRenderers?: Partial<BlockRenderers>;\n}): React.ReactElement {\n return (\n <ol>\n {block.children.map((child) => (\n <li key={child.id}>\n <InlineContent spans={child.content} />\n {child.children.length > 0 && (\n <BlockElement block={child} customRenderers={customRenderers} />\n )}\n </li>\n ))}\n </ol>\n );\n}\n\n/**\n * Renders: checklist block\n */\nfunction CheckListRenderer({ block }: { block: CheckListBlock }): React.ReactElement {\n return (\n <div style={{ display: 'flex', alignItems: 'flex-start', gap: '0.5rem' }}>\n <input\n type=\"checkbox\"\n checked={block.props.checked}\n readOnly\n style={{ marginTop: '0.25rem' }}\n />\n <span style={{ textDecoration: block.props.checked ? 'line-through' : 'none' }}>\n <InlineContent spans={block.content} />\n </span>\n </div>\n );\n}\n\n/**\n * Renders: code block block\n */\nfunction CodeBlockRenderer({ block }: { block: CodeBlockBlock }): React.ReactElement {\n const code = block.content.map((span) => span.text).join('');\n const language = block.props.language;\n\n return (\n <pre>\n <code className={language ? `language-${language}` : undefined}>\n {code}\n </code>\n </pre>\n );\n}\n\n/**\n * Renders: blockquote block\n */\nfunction BlockquoteRenderer({ block }: { block: Block }): React.ReactElement {\n return (\n <blockquote>\n <InlineContent spans={block.content} />\n </blockquote>\n );\n}\n\n/**\n * Renders: table block\n */\nfunction TableRenderer({ block }: { block: TableBlock }): React.ReactElement {\n const { headers, rows, alignments } = block.props;\n\n const getAlignment = (index: number): React.CSSProperties['textAlign'] => {\n return alignments?.[index] ?? undefined;\n };\n\n return (\n <table>\n {headers.length > 0 && (\n <thead>\n <tr>\n {headers.map((header, i) => (\n <th key={i} style={{ textAlign: getAlignment(i) }}>\n {header}\n </th>\n ))}\n </tr>\n </thead>\n )}\n <tbody>\n {rows.map((row, rowIndex) => (\n <tr key={rowIndex}>\n {row.map((cell, cellIndex) => (\n <td key={cellIndex} style={{ textAlign: getAlignment(cellIndex) }}>\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n\n/**\n * Renders: image block\n */\nfunction ImageRenderer({ block }: { block: ImageBlock }): React.ReactElement {\n return (\n <figure>\n <img\n src={block.props.url}\n alt={block.props.alt ?? ''}\n title={block.props.title}\n width={block.props.width}\n height={block.props.height}\n />\n {block.props.alt && <figcaption>{block.props.alt}</figcaption>}\n </figure>\n );\n}\n\n/**\n * Renders: divider block\n */\nfunction DividerRenderer(): React.ReactElement {\n return <hr />;\n}\n\n/**\n * Renders: callout block\n */\nfunction CalloutRenderer({ block }: { block: CalloutBlock }): React.ReactElement {\n const calloutType = block.props.type;\n\n const styles: React.CSSProperties = {\n padding: '1rem',\n borderRadius: '0.25rem',\n borderLeft: '4px solid',\n marginBottom: '1rem',\n };\n\n // Color based on callout type\n const colors: Record<string, { borderColor: string; backgroundColor: string }> = {\n info: { borderColor: '#3b82f6', backgroundColor: '#eff6ff' },\n warning: { borderColor: '#f59e0b', backgroundColor: '#fffbeb' },\n tip: { borderColor: '#10b981', backgroundColor: '#ecfdf5' },\n danger: { borderColor: '#ef4444', backgroundColor: '#fef2f2' },\n note: { borderColor: '#6b7280', backgroundColor: '#f9fafb' },\n };\n\n const colorStyle = colors[calloutType] ?? colors.note;\n\n return (\n <div\n style={{\n ...styles,\n borderLeftColor: colorStyle.borderColor,\n backgroundColor: colorStyle.backgroundColor,\n }}\n role=\"alert\"\n >\n <strong style={{ textTransform: 'capitalize', display: 'block', marginBottom: '0.5rem' }}>\n {calloutType}\n </strong>\n <InlineContent spans={block.content} />\n </div>\n );\n}\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nexport default BlockRenderer;\n","/**\n * @create-markdown/react - Hooks\n * State management hooks for document manipulation\n */\n\nimport { useState, useCallback, useMemo } from 'react';\nimport type { Block, Document, DocumentOptions, TextSpan } from '@create-markdown/core';\nimport {\n createDocument,\n insertBlock,\n appendBlock,\n removeBlock,\n updateBlock,\n moveBlock,\n findBlock,\n getBlockIndex,\n clearBlocks,\n setBlocks,\n updateMeta,\n markdownToBlocks,\n blocksToMarkdown,\n} from '@create-markdown/core';\n\n// ============================================================================\n// useDocument Hook\n// ============================================================================\n\nexport interface UseDocumentReturn {\n /** Current document state */\n document: Document;\n /** Blocks in the document */\n blocks: Block[];\n \n // Block operations\n /** Insert: block at a specific index */\n insertBlock: (block: Block, index?: number) => void;\n /** Append: block to the end */\n appendBlock: (block: Block) => void;\n /** Remove: block by ID */\n removeBlock: (blockId: string) => void;\n /** Update: block by ID */\n updateBlock: (blockId: string, updates: Partial<Omit<Block, 'id' | 'type'>>) => void;\n /** Move: block to a new index */\n moveBlock: (blockId: string, newIndex: number) => void;\n /** Find: block by ID */\n findBlock: (blockId: string) => Block | undefined;\n /** Get: index of a block */\n getBlockIndex: (blockId: string) => number;\n \n // Bulk operations\n /** Clear: all blocks */\n clearBlocks: () => void;\n /** Replace: entire document with new blocks */\n setBlocks: (blocks: Block[]) => void;\n /** Set: entire document */\n setDocument: (doc: Document) => void;\n \n // Markdown operations\n /** Get: document as markdown */\n toMarkdown: () => string;\n /** Load: markdown into the document */\n fromMarkdown: (markdown: string) => void;\n \n // Metadata operations\n /** Update: document metadata */\n updateMeta: (meta: Partial<Document['meta']>) => void;\n}\n\n/**\n * Hook for managing: document with blocks\n * \n * @example\n * ```tsx\n * function Editor() {\n * const { blocks, appendBlock, toMarkdown } = useDocument();\n * \n * const addParagraph = () => {\n * appendBlock(paragraph('New paragraph'));\n * };\n * \n * return (\n * <div>\n * <BlockRenderer blocks={blocks} />\n * <button onClick={addParagraph}>Add Paragraph</button>\n * <button onClick={() => console.log(toMarkdown())}>Export</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useDocument(\n initialBlocks: Block[] = [],\n options?: DocumentOptions\n): UseDocumentReturn {\n const [document, setDocument] = useState<Document>(() =>\n createDocument(initialBlocks, options)\n );\n \n const insert = useCallback((block: Block, index?: number) => {\n setDocument((doc) => insertBlock(doc, block, index));\n }, []);\n \n const append = useCallback((block: Block) => {\n setDocument((doc) => appendBlock(doc, block));\n }, []);\n \n const remove = useCallback((blockId: string) => {\n setDocument((doc) => removeBlock(doc, blockId));\n }, []);\n \n const update = useCallback(\n (blockId: string, updates: Partial<Omit<Block, 'id' | 'type'>>) => {\n setDocument((doc) => updateBlock(doc, blockId, updates));\n },\n []\n );\n \n const move = useCallback((blockId: string, newIndex: number) => {\n setDocument((doc) => moveBlock(doc, blockId, newIndex));\n }, []);\n \n const find = useCallback(\n (blockId: string) => findBlock(document, blockId),\n [document]\n );\n \n const getIndex = useCallback(\n (blockId: string) => getBlockIndex(document, blockId),\n [document]\n );\n \n const clear = useCallback(() => {\n setDocument((doc) => clearBlocks(doc));\n }, []);\n \n const set = useCallback((blocks: Block[]) => {\n setDocument((doc) => setBlocks(doc, blocks));\n }, []);\n \n const toMd = useCallback(() => blocksToMarkdown(document.blocks), [document]);\n \n const fromMd = useCallback((markdown: string) => {\n const blocks = markdownToBlocks(markdown);\n setDocument((doc) => setBlocks(doc, blocks));\n }, []);\n \n const meta = useCallback((newMeta: Partial<Document['meta']>) => {\n setDocument((doc) => updateMeta(doc, newMeta));\n }, []);\n \n return {\n document,\n blocks: document.blocks,\n insertBlock: insert,\n appendBlock: append,\n removeBlock: remove,\n updateBlock: update,\n moveBlock: move,\n findBlock: find,\n getBlockIndex: getIndex,\n clearBlocks: clear,\n setBlocks: set,\n setDocument,\n toMarkdown: toMd,\n fromMarkdown: fromMd,\n updateMeta: meta,\n };\n}\n\n// ============================================================================\n// useMarkdown Hook\n// ============================================================================\n\nexport interface UseMarkdownReturn {\n /** Current markdown string */\n markdown: string;\n /** Parsed blocks */\n blocks: Block[];\n /** Update: markdown content */\n setMarkdown: (markdown: string) => void;\n /** Update: blocks (will update markdown too) */\n setBlocks: (blocks: Block[]) => void;\n}\n\n/**\n * Hook for bidirectional: markdown/blocks state\n * \n * @example\n * ```tsx\n * function MarkdownEditor() {\n * const { markdown, blocks, setMarkdown } = useMarkdown('# Hello');\n * \n * return (\n * <div>\n * <textarea\n * value={markdown}\n * onChange={(e) => setMarkdown(e.target.value)}\n * />\n * <BlockRenderer blocks={blocks} />\n * </div>\n * );\n * }\n * ```\n */\nexport function useMarkdown(initialMarkdown: string = ''): UseMarkdownReturn {\n const [markdown, setMarkdownState] = useState(initialMarkdown);\n \n const blocks = useMemo(() => markdownToBlocks(markdown), [markdown]);\n \n const setMarkdown = useCallback((newMarkdown: string) => {\n setMarkdownState(newMarkdown);\n }, []);\n \n const setBlocksFromBlocks = useCallback((newBlocks: Block[]) => {\n const newMarkdown = blocksToMarkdown(newBlocks);\n setMarkdownState(newMarkdown);\n }, []);\n \n return {\n markdown,\n blocks,\n setMarkdown,\n setBlocks: setBlocksFromBlocks,\n };\n}\n\n// ============================================================================\n// useBlockEditor Hook\n// ============================================================================\n\nexport interface UseBlockEditorReturn {\n /** Current selected block ID */\n selectedBlockId: string | null;\n /** Current selected block */\n selectedBlock: Block | undefined;\n /** Select: block by ID */\n selectBlock: (blockId: string | null) => void;\n /** Select: next block */\n selectNext: () => void;\n /** Select: previous block */\n selectPrevious: () => void;\n /** Delete: selected block */\n deleteSelected: () => void;\n /** Update: selected block's content */\n updateSelectedContent: (content: TextSpan[]) => void;\n /** Duplicate: selected block */\n duplicateSelected: () => void;\n /** Move: selected block up */\n moveSelectedUp: () => void;\n /** Move: selected block down */\n moveSelectedDown: () => void;\n}\n\n/**\n * Hook for: block selection and editing operations\n * \n * @example\n * ```tsx\n * function Editor() {\n * const doc = useDocument();\n * const editor = useBlockEditor(doc);\n * \n * return (\n * <div>\n * {doc.blocks.map((block) => (\n * <div\n * key={block.id}\n * onClick={() => editor.selectBlock(block.id)}\n * style={{\n * border: editor.selectedBlockId === block.id ? '2px solid blue' : 'none'\n * }}\n * >\n * <BlockElement block={block} />\n * </div>\n * ))}\n * </div>\n * );\n * }\n * ```\n */\nexport function useBlockEditor(\n documentHook: UseDocumentReturn\n): UseBlockEditorReturn {\n const { document, blocks, removeBlock, updateBlock, moveBlock, insertBlock } =\n documentHook;\n \n const [selectedBlockId, setSelectedBlockId] = useState<string | null>(null);\n \n const selectedBlock = useMemo(\n () => (selectedBlockId ? findBlock(document, selectedBlockId) : undefined),\n [document, selectedBlockId]\n );\n \n const selectBlock = useCallback((blockId: string | null) => {\n setSelectedBlockId(blockId);\n }, []);\n \n const selectNext = useCallback(() => {\n if (!selectedBlockId) {\n if (blocks.length > 0) {\n setSelectedBlockId(blocks[0].id);\n }\n return;\n }\n \n const currentIndex = getBlockIndex(document, selectedBlockId);\n if (currentIndex < blocks.length - 1) {\n setSelectedBlockId(blocks[currentIndex + 1].id);\n }\n }, [document, blocks, selectedBlockId]);\n \n const selectPrevious = useCallback(() => {\n if (!selectedBlockId) {\n if (blocks.length > 0) {\n setSelectedBlockId(blocks[blocks.length - 1].id);\n }\n return;\n }\n \n const currentIndex = getBlockIndex(document, selectedBlockId);\n if (currentIndex > 0) {\n setSelectedBlockId(blocks[currentIndex - 1].id);\n }\n }, [document, blocks, selectedBlockId]);\n \n const deleteSelected = useCallback(() => {\n if (!selectedBlockId) return;\n \n const currentIndex = getBlockIndex(document, selectedBlockId);\n removeBlock(selectedBlockId);\n \n // Select next block or previous if at end\n if (blocks.length > 1) {\n if (currentIndex < blocks.length - 1) {\n setSelectedBlockId(blocks[currentIndex + 1].id);\n } else if (currentIndex > 0) {\n setSelectedBlockId(blocks[currentIndex - 1].id);\n }\n } else {\n setSelectedBlockId(null);\n }\n }, [document, blocks, selectedBlockId, removeBlock]);\n \n const updateSelectedContent = useCallback(\n (content: TextSpan[]) => {\n if (!selectedBlockId) return;\n updateBlock(selectedBlockId, { content });\n },\n [selectedBlockId, updateBlock]\n );\n \n const duplicateSelected = useCallback(() => {\n if (!selectedBlockId || !selectedBlock) return;\n \n const currentIndex = getBlockIndex(document, selectedBlockId);\n const clonedBlock: Block = {\n ...selectedBlock,\n id: Math.random().toString(36).substring(2, 9),\n };\n \n insertBlock(clonedBlock, currentIndex + 1);\n setSelectedBlockId(clonedBlock.id);\n }, [document, selectedBlockId, selectedBlock, insertBlock]);\n \n const moveSelectedUp = useCallback(() => {\n if (!selectedBlockId) return;\n \n const currentIndex = getBlockIndex(document, selectedBlockId);\n if (currentIndex > 0) {\n moveBlock(selectedBlockId, currentIndex - 1);\n }\n }, [document, selectedBlockId, moveBlock]);\n \n const moveSelectedDown = useCallback(() => {\n if (!selectedBlockId) return;\n \n const currentIndex = getBlockIndex(document, selectedBlockId);\n if (currentIndex < blocks.length - 1) {\n moveBlock(selectedBlockId, currentIndex + 1);\n }\n }, [document, blocks, selectedBlockId, moveBlock]);\n \n return {\n selectedBlockId,\n selectedBlock,\n selectBlock,\n selectNext,\n selectPrevious,\n deleteSelected,\n updateSelectedContent,\n duplicateSelected,\n moveSelectedUp,\n moveSelectedDown,\n };\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,kBAAAC,EAAA,kBAAAC,EAAA,YAAAC,EAAA,2cAAAC,EAAA,gBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAT,GCgEgB,IAAAU,EAAA,6BART,SAASC,EAAc,CAC1B,OAAAC,EACA,UAAAC,EACA,gBAAAC,CACJ,EAA2C,CACvC,SACI,OAAC,OAAI,UAAWD,EACX,SAAAD,EAAO,IAAKG,MACT,OAACC,EAAA,CAEG,MAAOD,EACP,gBAAiBD,GAFZC,EAAM,EAGf,CACH,EACL,CAER,CAKO,SAASC,EAAa,CACzB,MAAAD,EACA,gBAAAD,CACJ,EAAgD,CAE5C,IAAMG,EAAiBH,IAAkBC,EAAM,IAA4B,EAC3E,GAAIE,EACA,SAAO,OAACA,EAAA,CAAe,MAAOF,EAAgB,EAIlD,OAAQA,EAAM,KAAM,CAChB,IAAK,YACD,SAAO,OAACG,EAAA,CAAkB,MAAOH,EAAO,EAE5C,IAAK,UACD,SAAO,OAACI,EAAA,CAAgB,MAAOJ,EAAuB,EAE1D,IAAK,aACD,SAAO,OAACK,EAAA,CAAmB,MAAOL,EAAO,gBAAiBD,EAAiB,EAE/E,IAAK,eACD,SAAO,OAACO,EAAA,CAAqB,MAAON,EAAO,gBAAiBD,EAAiB,EAEjF,IAAK,YACD,SAAO,OAACQ,EAAA,CAAkB,MAAOP,EAAyB,EAE9D,IAAK,YACD,SAAO,OAACQ,EAAA,CAAkB,MAAOR,EAAyB,EAE9D,IAAK,aACD,SAAO,OAACS,EAAA,CAAmB,MAAOT,EAAO,EAE7C,IAAK,QACD,SAAO,OAACU,EAAA,CAA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QmB,EAAiBJ,CAAW,CAAC,EAE7CY,KAAwB,eAC3BC,GAAwB,CAClBT,GACLH,EAAYG,EAAiB,CAAE,QAAAS,CAAQ,CAAC,CAC1C,EACA,CAACT,EAAiBH,CAAW,CAC/B,EAEMa,KAAoB,eAAY,IAAM,CAC1C,GAAI,CAACV,GAAmB,CAACE,EAAe,OAExC,IAAMG,KAAe,iBAAczC,EAAUoC,CAAe,EACtDW,EAAqB,CACzB,GAAGT,EACH,GAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,EAAG,CAAC,CAC/C,EAEAH,EAAYY,EAAaN,EAAe,CAAC,EACzCJ,EAAmBU,EAAY,EAAE,CACnC,EAAG,CAAC/C,EAAUoC,EAAiBE,EAAeH,CAAW,CAAC,EAEpDa,KAAiB,eAAY,IAAM,CACvC,GAAI,CAACZ,EAAiB,OAEtB,IAAMK,KAAe,iBAAczC,EAAUoC,CAAe,EACxDK,EAAe,GACjBP,EAAUE,EAAiBK,EAAe,CAAC,CAE/C,EAAG,CAACzC,EAAUoC,EAAiBF,CAAS,CAAC,EAEnCe,KAAmB,eAAY,IAAM,CACzC,GAAI,CAACb,EAAiB,OAEtB,IAAMK,KAAe,iBAAczC,EAAUoC,CAAe,EACxDK,EAAexB,EAAO,OAAS,GACjCiB,EAAUE,EAAiBK,EAAe,CAAC,CAE/C,EAAG,CAACzC,EAAUiB,EAAQmB,EAAiBF,CAAS,CAAC,EAEjD,MAAO,CACL,gBAAAE,EACA,cAAAE,EACA,YAAAC,EACA,WAAAC,EACA,eAAAE,EACA,eAAAC,EACA,sBAAAC,EACA,kBAAAE,EACA,eAAAE,EACA,iBAAAC,CACF,CACF,CFjWA,IAAAC,EAuBO,iCASMC,EAAU","names":["index_exports","__export","BlockElement","BlockRenderer","InlineContent","VERSION","useBlockEditor","useDocument","useMarkdown","__toCommonJS","import_jsx_runtime","BlockRenderer","blocks","className","customRenderers","block","BlockElement","CustomRenderer","ParagraphRenderer","HeadingRenderer","BulletListRenderer","NumberedListRenderer","CheckListRenderer","CodeBlockRenderer","BlockquoteRenderer","TableRenderer","ImageRenderer","DividerRenderer","CalloutRenderer","InlineContent","spans","span","index","SpanElement","content","styles","Tag","child","code","language","headers","rows","alignments","getAlignment","header","i","row","rowIndex","cell","cellIndex","calloutType","colors","colorStyle","import_react","import_core","useDocument","initialBlocks","options","document","setDocument","insert","block","index","doc","append","remove","blockId","update","updates","move","newIndex","find","getIndex","clear","set","blocks","toMd","fromMd","markdown","meta","newMeta","useMarkdown","initialMarkdown","setMarkdownState","setMarkdown","newMarkdown","setBlocksFromBlocks","newBlocks","useBlockEditor","documentHook","removeBlock","updateBlock","moveBlock","insertBlock","selectedBlockId","setSelectedBlockId","selectedBlock","selectBlock","selectNext","currentIndex","selectPrevious","deleteSelected","updateSelectedContent","content","duplicateSelected","clonedBlock","moveSelectedUp","moveSelectedDown","import_core","VERSION"]}
package/dist/index.d.ts CHANGED
@@ -11,5 +11,5 @@ export { paragraph, heading, h1, h2, h3, h4, h5, h6, bulletList, numberedList, c
11
11
  /**
12
12
  * Package version
13
13
  */
14
- export declare const VERSION = "0.1.0";
14
+ export declare const VERSION = "2.0.0";
15
15
  //# sourceMappingURL=index.d.ts.map