@create-markdown/react 0.1.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/dist/index.cjs ADDED
@@ -0,0 +1,520 @@
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";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @create-markdown/react
3
+ * React components and hooks for @create-markdown
4
+ */
5
+ export { BlockRenderer, BlockElement, InlineContent, } from './block-renderer';
6
+ export type { BlockRendererProps, BlockRenderers, SingleBlockProps, } from './block-renderer';
7
+ export { useDocument, useMarkdown, useBlockEditor, } from './hooks';
8
+ export type { UseDocumentReturn, UseMarkdownReturn, UseBlockEditorReturn, } from './hooks';
9
+ export type { Block, BlockType, Document, TextSpan, InlineStyle, } from '@create-markdown/core';
10
+ export { paragraph, heading, h1, h2, h3, h4, h5, h6, bulletList, numberedList, checkListItem, checkList, codeBlock, blockquote, divider, image, callout, text, bold, italic, code, link, } from '@create-markdown/core';
11
+ /**
12
+ * Package version
13
+ */
14
+ export declare const VERSION = "0.1.0";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,SAAS,EACT,OAAO,EACP,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,UAAU,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,EACL,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,GACL,MAAM,uBAAuB,CAAC;AAM/B;;GAEG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC"}