@alien6-studio/elea-content-editor 0.0.0-stage → 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.
Files changed (149) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +164 -2
  3. package/dist/AddBlockButton.d.ts +16 -0
  4. package/dist/AddBlockButton.d.ts.map +1 -0
  5. package/dist/AddBlockButton.js +103 -0
  6. package/dist/AddBlockButton.js.map +1 -0
  7. package/dist/BlockEditor.d.ts +46 -0
  8. package/dist/BlockEditor.d.ts.map +1 -0
  9. package/dist/BlockEditor.js +397 -0
  10. package/dist/BlockEditor.js.map +1 -0
  11. package/dist/ContentEditor.d.ts +59 -0
  12. package/dist/ContentEditor.d.ts.map +1 -0
  13. package/dist/ContentEditor.js +460 -0
  14. package/dist/ContentEditor.js.map +1 -0
  15. package/dist/EditorPreview.d.ts +12 -0
  16. package/dist/EditorPreview.d.ts.map +1 -0
  17. package/dist/EditorPreview.js +10 -0
  18. package/dist/EditorPreview.js.map +1 -0
  19. package/dist/MarkdownEditor.d.ts +14 -0
  20. package/dist/MarkdownEditor.d.ts.map +1 -0
  21. package/dist/MarkdownEditor.js +30 -0
  22. package/dist/MarkdownEditor.js.map +1 -0
  23. package/dist/QuickAddButtons.d.ts +10 -0
  24. package/dist/QuickAddButtons.d.ts.map +1 -0
  25. package/dist/QuickAddButtons.js +19 -0
  26. package/dist/QuickAddButtons.js.map +1 -0
  27. package/dist/RichTextField.d.ts +72 -0
  28. package/dist/RichTextField.d.ts.map +1 -0
  29. package/dist/RichTextField.js +1008 -0
  30. package/dist/RichTextField.js.map +1 -0
  31. package/dist/RichTextInput.d.ts +12 -0
  32. package/dist/RichTextInput.d.ts.map +1 -0
  33. package/dist/RichTextInput.js +148 -0
  34. package/dist/RichTextInput.js.map +1 -0
  35. package/dist/SlashMenu.d.ts +27 -0
  36. package/dist/SlashMenu.d.ts.map +1 -0
  37. package/dist/SlashMenu.js +59 -0
  38. package/dist/SlashMenu.js.map +1 -0
  39. package/dist/Toolbar.d.ts +15 -0
  40. package/dist/Toolbar.d.ts.map +1 -0
  41. package/dist/Toolbar.js +27 -0
  42. package/dist/Toolbar.js.map +1 -0
  43. package/dist/VirtualizedBlockList.d.ts +40 -0
  44. package/dist/VirtualizedBlockList.d.ts.map +1 -0
  45. package/dist/VirtualizedBlockList.js +51 -0
  46. package/dist/VirtualizedBlockList.js.map +1 -0
  47. package/dist/blockPaste.d.ts +17 -0
  48. package/dist/blockPaste.d.ts.map +1 -0
  49. package/dist/blockPaste.js +50 -0
  50. package/dist/blockPaste.js.map +1 -0
  51. package/dist/blocks/AttachmentBlock.d.ts +3 -0
  52. package/dist/blocks/AttachmentBlock.d.ts.map +1 -0
  53. package/dist/blocks/AttachmentBlock.js +55 -0
  54. package/dist/blocks/AttachmentBlock.js.map +1 -0
  55. package/dist/blocks/ImageBlock.d.ts +14 -0
  56. package/dist/blocks/ImageBlock.d.ts.map +1 -0
  57. package/dist/blocks/ImageBlock.js +137 -0
  58. package/dist/blocks/ImageBlock.js.map +1 -0
  59. package/dist/blocks/MediaActions.d.ts +15 -0
  60. package/dist/blocks/MediaActions.d.ts.map +1 -0
  61. package/dist/blocks/MediaActions.js +7 -0
  62. package/dist/blocks/MediaActions.js.map +1 -0
  63. package/dist/blocks/VideoBlock.d.ts +3 -0
  64. package/dist/blocks/VideoBlock.d.ts.map +1 -0
  65. package/dist/blocks/VideoBlock.js +47 -0
  66. package/dist/blocks/VideoBlock.js.map +1 -0
  67. package/dist/blocks/cropper.d.ts +2 -0
  68. package/dist/blocks/cropper.d.ts.map +1 -0
  69. package/dist/blocks/cropper.js +3 -0
  70. package/dist/blocks/cropper.js.map +1 -0
  71. package/dist/bundle.css +6 -0
  72. package/dist/caret.d.ts +13 -0
  73. package/dist/caret.d.ts.map +1 -0
  74. package/dist/caret.js +52 -0
  75. package/dist/caret.js.map +1 -0
  76. package/dist/clipboardHtml.d.ts +4 -0
  77. package/dist/clipboardHtml.d.ts.map +1 -0
  78. package/dist/clipboardHtml.js +18 -0
  79. package/dist/clipboardHtml.js.map +1 -0
  80. package/dist/editorChrome.d.ts +53 -0
  81. package/dist/editorChrome.d.ts.map +1 -0
  82. package/dist/editorChrome.js +35 -0
  83. package/dist/editorChrome.js.map +1 -0
  84. package/dist/hooks/useBlockDrag.d.ts +26 -0
  85. package/dist/hooks/useBlockDrag.d.ts.map +1 -0
  86. package/dist/hooks/useBlockDrag.js +57 -0
  87. package/dist/hooks/useBlockDrag.js.map +1 -0
  88. package/dist/hooks/useBlockFocus.d.ts +13 -0
  89. package/dist/hooks/useBlockFocus.d.ts.map +1 -0
  90. package/dist/hooks/useBlockFocus.js +95 -0
  91. package/dist/hooks/useBlockFocus.js.map +1 -0
  92. package/dist/hooks/useBlockManagement.d.ts +27 -0
  93. package/dist/hooks/useBlockManagement.d.ts.map +1 -0
  94. package/dist/hooks/useBlockManagement.js +120 -0
  95. package/dist/hooks/useBlockManagement.js.map +1 -0
  96. package/dist/hooks/useBlockSelection.d.ts +30 -0
  97. package/dist/hooks/useBlockSelection.d.ts.map +1 -0
  98. package/dist/hooks/useBlockSelection.js +166 -0
  99. package/dist/hooks/useBlockSelection.js.map +1 -0
  100. package/dist/hooks/useBlockVisibility.d.ts +10 -0
  101. package/dist/hooks/useBlockVisibility.d.ts.map +1 -0
  102. package/dist/hooks/useBlockVisibility.js +48 -0
  103. package/dist/hooks/useBlockVisibility.js.map +1 -0
  104. package/dist/hooks/useDocumentHistory.d.ts +29 -0
  105. package/dist/hooks/useDocumentHistory.d.ts.map +1 -0
  106. package/dist/hooks/useDocumentHistory.js +75 -0
  107. package/dist/hooks/useDocumentHistory.js.map +1 -0
  108. package/dist/hooks/useTextareaResize.d.ts +6 -0
  109. package/dist/hooks/useTextareaResize.d.ts.map +1 -0
  110. package/dist/hooks/useTextareaResize.js +30 -0
  111. package/dist/hooks/useTextareaResize.js.map +1 -0
  112. package/dist/icons.d.ts +28 -0
  113. package/dist/icons.d.ts.map +1 -0
  114. package/dist/icons.js +37 -0
  115. package/dist/icons.js.map +1 -0
  116. package/dist/index.d.ts +24 -0
  117. package/dist/index.d.ts.map +1 -0
  118. package/dist/index.js +24 -0
  119. package/dist/index.js.map +1 -0
  120. package/dist/listCommands.d.ts +11 -0
  121. package/dist/listCommands.d.ts.map +1 -0
  122. package/dist/listCommands.js +190 -0
  123. package/dist/listCommands.js.map +1 -0
  124. package/dist/listHtml.d.ts +20 -0
  125. package/dist/listHtml.d.ts.map +1 -0
  126. package/dist/listHtml.js +108 -0
  127. package/dist/listHtml.js.map +1 -0
  128. package/dist/markdownSource.d.ts +40 -0
  129. package/dist/markdownSource.d.ts.map +1 -0
  130. package/dist/markdownSource.js +205 -0
  131. package/dist/markdownSource.js.map +1 -0
  132. package/dist/parts.d.ts +34 -0
  133. package/dist/parts.d.ts.map +1 -0
  134. package/dist/parts.js +68 -0
  135. package/dist/parts.js.map +1 -0
  136. package/dist/paste.d.ts +21 -0
  137. package/dist/paste.d.ts.map +1 -0
  138. package/dist/paste.js +273 -0
  139. package/dist/paste.js.map +1 -0
  140. package/dist/provider.d.ts +73 -0
  141. package/dist/provider.d.ts.map +1 -0
  142. package/dist/provider.js +16 -0
  143. package/dist/provider.js.map +1 -0
  144. package/dist/selection.d.ts +17 -0
  145. package/dist/selection.d.ts.map +1 -0
  146. package/dist/selection.js +88 -0
  147. package/dist/selection.js.map +1 -0
  148. package/dist/styles.css +668 -0
  149. package/package.json +64 -4
@@ -0,0 +1,166 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ import { caretOnEdgeLine } from "../caret.js";
4
+ import { blockRun, neighbourId } from "../selection.js";
5
+ const blockIdOf = (target) => target?.closest?.("[data-elea-block-id]")?.dataset.eleaBlockId ?? null;
6
+ const DRAG_THRESHOLD = 4;
7
+ /** Ctrl or Cmd+click adds a block to the selection, or takes it out. */
8
+ function toggleBlock(selected, order, id, focusedBlock) {
9
+ const chosen = new Set(selected);
10
+ if (!chosen.size && focusedBlock && focusedBlock !== id)
11
+ chosen.add(focusedBlock);
12
+ if (chosen.has(id))
13
+ chosen.delete(id);
14
+ else
15
+ chosen.add(id);
16
+ const ids = order.filter(blockId => chosen.has(blockId));
17
+ return { ids, anchor: chosen.has(id) ? id : ids[0] ?? null };
18
+ }
19
+ /**
20
+ * A selection of whole blocks, as an editor like Medium offers, and never at the same time as
21
+ * a text selection: a drag across blocks or Shift with the arrows at the edge of a field selects
22
+ * a run of blocks and takes the caret away; Escape or a plain click releases it.
23
+ */
24
+ export function useBlockSelection(order, root) {
25
+ const [selection, setSelection] = useState({ ids: [], anchor: null });
26
+ const [dragging, setDragging] = useState(false);
27
+ const orderRef = useRef(order);
28
+ orderRef.current = order;
29
+ const press = useRef(null);
30
+ // Blocks that disappear leave the selection
31
+ useEffect(() => {
32
+ setSelection((current) => {
33
+ if (!current.ids.length)
34
+ return current;
35
+ const available = new Set(order);
36
+ const ids = current.ids.filter((id) => available.has(id));
37
+ return ids.length === current.ids.length ? current : { ids, anchor: ids.length > 0 ? current.anchor : null };
38
+ });
39
+ }, [order]);
40
+ const clear = useCallback(() => setSelection((current) => (current.ids.length === 0 && current.anchor === null ? current : { ids: [], anchor: null })), []);
41
+ const select = useCallback((anchor, focus = anchor) => {
42
+ const ids = blockRun(orderRef.current, anchor, focus);
43
+ setSelection({ ids, anchor });
44
+ }, []);
45
+ /** Blocks and text never select together: the caret leaves its field for the editor root. */
46
+ const takeFocus = useCallback(() => {
47
+ globalThis.getSelection?.()?.removeAllRanges();
48
+ const active = document.activeElement;
49
+ if (active && active !== root.current && root.current?.contains(active))
50
+ active.blur();
51
+ root.current?.focus({ preventScroll: true });
52
+ }, [root]);
53
+ const selectAll = useCallback(() => {
54
+ const ids = [...orderRef.current];
55
+ takeFocus();
56
+ setSelection({ ids, anchor: ids[0] ?? null });
57
+ }, [takeFocus]);
58
+ const setIds = useCallback((ids) => setSelection({ ids, anchor: ids[0] ?? null }), []);
59
+ const extend = useCallback((direction, from) => {
60
+ setSelection((current) => {
61
+ const anchor = current.anchor ?? from;
62
+ if (!anchor)
63
+ return current;
64
+ const ids = current.ids.length > 0 ? current.ids : [anchor];
65
+ // The moving end is the one opposite to the anchor
66
+ const focus = (ids[0] === anchor ? ids.at(-1) : ids[0]);
67
+ const next = neighbourId(orderRef.current, focus, direction);
68
+ return { ids: blockRun(orderRef.current, anchor, next), anchor };
69
+ });
70
+ }, []);
71
+ // The drag is followed on the document, so releasing outside the editor ends it and
72
+ // nothing selects on a later hover
73
+ useEffect(() => {
74
+ const up = () => {
75
+ if (!press.current)
76
+ return;
77
+ press.current = null;
78
+ setDragging(false);
79
+ };
80
+ const move = (event) => {
81
+ const current = press.current;
82
+ if (!current)
83
+ return;
84
+ // A release the document never saw (a native drag of selected text swallows it) ends the press
85
+ if (event.buttons === 0) {
86
+ up();
87
+ return;
88
+ }
89
+ if (!current.dragging && Math.hypot(event.clientX - current.x, event.clientY - current.y) < DRAG_THRESHOLD)
90
+ return;
91
+ const under = document.elementFromPoint(event.clientX, event.clientY);
92
+ const id = under && root.current?.contains(under) ? blockIdOf(under) : null;
93
+ if (!id)
94
+ return;
95
+ if (!current.dragging) {
96
+ if (id === current.id)
97
+ return;
98
+ // Crossing a block boundary: the native text selection gives way to blocks
99
+ current.dragging = true;
100
+ setDragging(true);
101
+ takeFocus();
102
+ }
103
+ select(current.id, id);
104
+ };
105
+ document.addEventListener("mousemove", move);
106
+ document.addEventListener("mouseup", up);
107
+ const nativeDrag = (event) => { if (!event.defaultPrevented)
108
+ up(); };
109
+ document.addEventListener("dragstart", nativeDrag);
110
+ return () => {
111
+ document.removeEventListener("mousemove", move);
112
+ document.removeEventListener("mouseup", up);
113
+ document.removeEventListener("dragstart", nativeDrag);
114
+ };
115
+ }, [root, select, takeFocus]);
116
+ const onMouseDown = useCallback((event, focusedBlock) => {
117
+ if (event.button !== 0)
118
+ return;
119
+ if (event.target.closest?.(".elea-selection-bar"))
120
+ return;
121
+ const id = blockIdOf(event.target);
122
+ if (!id) {
123
+ clear();
124
+ return;
125
+ }
126
+ const anchor = selection.anchor ?? focusedBlock;
127
+ if ((event.metaKey || event.ctrlKey) && !event.shiftKey) {
128
+ if (event.target.closest("a,button,select,input,textarea,[role=button]"))
129
+ return;
130
+ event.preventDefault();
131
+ setSelection(toggleBlock(selection.ids, orderRef.current, id, focusedBlock));
132
+ takeFocus();
133
+ return;
134
+ }
135
+ if (event.shiftKey && anchor && anchor !== id) {
136
+ event.preventDefault();
137
+ select(anchor, id);
138
+ takeFocus();
139
+ return;
140
+ }
141
+ press.current = { id, x: event.clientX, y: event.clientY, dragging: false };
142
+ if (selection.ids.length > 0)
143
+ clear();
144
+ }, [selection, select, clear, takeFocus]);
145
+ const onKeyDown = useCallback((event, focusedBlock) => {
146
+ if (event.key === "Escape" && selection.ids.length > 0) {
147
+ clear();
148
+ return true;
149
+ }
150
+ if (event.shiftKey && !event.ctrlKey && !event.metaKey && !event.altKey && (event.key === "ArrowDown" || event.key === "ArrowUp")) {
151
+ const direction = event.key === "ArrowDown" ? 1 : -1;
152
+ if (selection.ids.length === 0) {
153
+ // Text selection comes first: blocks only once the caret has no line left in its field
154
+ if (!focusedBlock || !caretOnEdgeLine(event.target, direction))
155
+ return false;
156
+ takeFocus();
157
+ }
158
+ event.preventDefault();
159
+ extend(direction, focusedBlock);
160
+ return true;
161
+ }
162
+ return false;
163
+ }, [selection.ids.length, clear, extend, takeFocus]);
164
+ return { selection, clear, select, selectAll, setIds, extend, dragging, onMouseDown, onKeyDown };
165
+ }
166
+ //# sourceMappingURL=useBlockSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBlockSelection.js","sourceRoot":"","sources":["../../src/hooks/useBlockSelection.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAuD,MAAM,OAAO,CAAC;AACtH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CA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O,KAAK,CAAC;IACf,CAAC,EACD,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CACjD,CAAC;IAEF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AACnG,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Tracks which registered blocks have entered the viewport. A block stays visible once
3
+ * seen, so scrolling back never re-renders placeholders.
4
+ */
5
+ export declare function useBlockVisibility(options?: IntersectionObserverInit | null): {
6
+ visibleBlocks: ReadonlySet<string>;
7
+ registerBlock: (id: string, element: Element | null) => void;
8
+ isBlockVisible: (id: string) => boolean;
9
+ };
10
+ //# sourceMappingURL=useBlockVisibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBlockVisibility.d.ts","sourceRoot":"","sources":["../../src/hooks/useBlockVisibility.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,wBAAwB,GAAG,IAAsB;;wBAyBhE,MAAM,WAAW,OAAO,GAAG,IAAI;yBAaE,MAAM;EACnE"}
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ const DEFAULT_OPTIONS = { rootMargin: "200px", threshold: 0 };
4
+ /**
5
+ * Tracks which registered blocks have entered the viewport. A block stays visible once
6
+ * seen, so scrolling back never re-renders placeholders.
7
+ */
8
+ export function useBlockVisibility(options = DEFAULT_OPTIONS) {
9
+ const [visibleBlocks, setVisibleBlocks] = useState(() => new Set());
10
+ const observerRef = useRef(null);
11
+ const elementsRef = useRef(new Map());
12
+ useEffect(() => {
13
+ if (!options || typeof IntersectionObserver === "undefined")
14
+ return;
15
+ const observer = new IntersectionObserver((entries) => {
16
+ setVisibleBlocks((previous) => {
17
+ const next = new Set(previous);
18
+ for (const entry of entries) {
19
+ const id = entry.target.dataset.eleaBlockId;
20
+ if (id && entry.isIntersecting)
21
+ next.add(id);
22
+ }
23
+ return next.size === previous.size ? previous : next;
24
+ });
25
+ }, options);
26
+ observerRef.current = observer;
27
+ for (const element of elementsRef.current.values())
28
+ observer.observe(element);
29
+ return () => {
30
+ observer.disconnect();
31
+ observerRef.current = null;
32
+ };
33
+ }, [options]);
34
+ const registerBlock = (id, element) => {
35
+ if (element) {
36
+ elementsRef.current.set(id, element);
37
+ observerRef.current?.observe(element);
38
+ return;
39
+ }
40
+ const existing = elementsRef.current.get(id);
41
+ if (existing) {
42
+ observerRef.current?.unobserve(existing);
43
+ elementsRef.current.delete(id);
44
+ }
45
+ };
46
+ return { visibleBlocks, registerBlock, isBlockVisible: (id) => visibleBlocks.has(id) };
47
+ }
48
+ //# sourceMappingURL=useBlockVisibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBlockVisibility.js","sourceRoot":"","sources":["../../src/hooks/useBlockVisibility.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,MAAM,eAAe,GAA6B,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;AAExF;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAO,GAAoC,eAAe;IAC3F,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAsB,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IACzF,MAAM,WAAW,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,GAAG,EAAmB,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,OAAO,oBAAoB,KAAK,WAAW;YAAE,OAAO;QACpE,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C;QAC7C,IAAI,QAAQ,EAAE,CAAC;YACb,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;YACzC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;AACjG,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { EleaBlock } from "@alien6-studio/elea-content";
2
+ /** The editable state of a document, as the host holds it. */
3
+ export interface DocumentSnapshot {
4
+ blocks: EleaBlock[];
5
+ title: string;
6
+ summary: string;
7
+ }
8
+ export interface DocumentHistoryOptions {
9
+ onBlocksChange: (blocks: EleaBlock[]) => void;
10
+ onTitleChange?: ((title: string) => void) | undefined;
11
+ onSummaryChange?: ((summary: string) => void) | undefined;
12
+ /** Changes closer than this, in milliseconds, join the previous entry: typing undoes by bursts. */
13
+ groupWithinMs?: number | undefined;
14
+ /** Oldest entries fall off beyond this count. */
15
+ limit?: number | undefined;
16
+ }
17
+ export interface DocumentHistory {
18
+ undo: () => void;
19
+ redo: () => void;
20
+ canUndo: boolean;
21
+ canRedo: boolean;
22
+ }
23
+ /**
24
+ * Undo and redo over the controlled state of the editor. Every change the host applies is
25
+ * recorded; undo hands the previous snapshot back to the host through the same callbacks,
26
+ * so the host stays the single owner of the state.
27
+ */
28
+ export declare function useDocumentHistory(current: DocumentSnapshot, options: DocumentHistoryOptions): DocumentHistory;
29
+ //# sourceMappingURL=useDocumentHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocumentHistory.d.ts","sourceRoot":"","sources":["../../src/hooks/useDocumentHistory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,8DAA8D;AAC9D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC9C,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACtD,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC1D,mGAAmG;IACnG,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,sBAAsB,GAAG,eAAe,CAoE9G"}
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ /**
4
+ * Undo and redo over the controlled state of the editor. Every change the host applies is
5
+ * recorded; undo hands the previous snapshot back to the host through the same callbacks,
6
+ * so the host stays the single owner of the state.
7
+ */
8
+ export function useDocumentHistory(current, options) {
9
+ const { onBlocksChange, onTitleChange, onSummaryChange, groupWithinMs = 500, limit = 100 } = options;
10
+ const pastRef = useRef([]);
11
+ const futureRef = useRef([]);
12
+ const presentRef = useRef(current);
13
+ const lastChangeAtRef = useRef(0);
14
+ const applyingRef = useRef(false);
15
+ const [availability, setAvailability] = useState({ canUndo: false, canRedo: false });
16
+ const refresh = () => {
17
+ const next = { canUndo: pastRef.current.length > 0, canRedo: futureRef.current.length > 0 };
18
+ setAvailability((previous) => (previous.canUndo === next.canUndo && previous.canRedo === next.canRedo ? previous : next));
19
+ };
20
+ useEffect(() => {
21
+ const present = presentRef.current;
22
+ if (current.blocks === present.blocks && current.title === present.title && current.summary === present.summary)
23
+ return;
24
+ if (applyingRef.current) {
25
+ // The host just applied an undo or redo: that is the new present, not a new entry
26
+ applyingRef.current = false;
27
+ presentRef.current = current;
28
+ refresh();
29
+ return;
30
+ }
31
+ const now = Date.now();
32
+ const structural = current.blocks !== present.blocks && (current.blocks.length !== present.blocks.length
33
+ || current.blocks.some((block, index) => block.id !== present.blocks[index]?.id || block.type !== present.blocks[index]?.type));
34
+ const grouped = !structural && pastRef.current.length > 0 && now - lastChangeAtRef.current < groupWithinMs;
35
+ if (!grouped) {
36
+ pastRef.current.push(present);
37
+ if (pastRef.current.length > limit)
38
+ pastRef.current.shift();
39
+ }
40
+ futureRef.current = [];
41
+ presentRef.current = current;
42
+ lastChangeAtRef.current = structural ? -Infinity : now;
43
+ refresh();
44
+ });
45
+ const apply = useCallback((snapshot) => {
46
+ applyingRef.current = true;
47
+ onBlocksChange(snapshot.blocks);
48
+ if (onTitleChange && snapshot.title !== presentRef.current.title)
49
+ onTitleChange(snapshot.title);
50
+ if (onSummaryChange && snapshot.summary !== presentRef.current.summary)
51
+ onSummaryChange(snapshot.summary);
52
+ // When nothing the host controls changed, the effect never fires: settle here
53
+ if (snapshot.blocks === presentRef.current.blocks && snapshot.title === presentRef.current.title && snapshot.summary === presentRef.current.summary)
54
+ applyingRef.current = false;
55
+ lastChangeAtRef.current = 0;
56
+ }, [onBlocksChange, onTitleChange, onSummaryChange]);
57
+ const undo = useCallback(() => {
58
+ const target = pastRef.current.pop();
59
+ if (!target)
60
+ return;
61
+ futureRef.current.push(presentRef.current);
62
+ apply(target);
63
+ refresh();
64
+ }, [apply]);
65
+ const redo = useCallback(() => {
66
+ const target = futureRef.current.pop();
67
+ if (!target)
68
+ return;
69
+ pastRef.current.push(presentRef.current);
70
+ apply(target);
71
+ refresh();
72
+ }, [apply]);
73
+ return { undo, redo, canUndo: availability.canUndo, canRedo: availability.canRedo };
74
+ }
75
+ //# sourceMappingURL=useDocumentHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocumentHistory.js","sourceRoot":"","sources":["../../src/hooks/useDocumentHistory.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA0BjE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAyB,EAAE,OAA+B;IAC3F,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,GAAG,GAAG,EAAE,KAAK,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;IACrG,MAAM,OAAO,GAAG,MAAM,CAAqB,EAAE,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,CAAqB,EAAE,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAmB,OAAO,CAAC,CAAC;IACrD,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAErF,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5F,eAAe,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,OA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AM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC3C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC;AACtF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type RefObject } from "react";
2
+ /** Fits a textarea to its content; usable from event handlers too. */
3
+ export declare function resizeTextarea(element: HTMLTextAreaElement): void;
4
+ /** A ref to put on a textarea that resizes whenever `value` changes, the fonts load or the window resizes. */
5
+ export declare function useTextareaResize<T extends HTMLTextAreaElement>(value: string): RefObject<T | null>;
6
+ //# sourceMappingURL=useTextareaResize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTextareaResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useTextareaResize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAGjE;AAED,8GAA8G;AAC9G,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAiBnG"}
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { useEffect, useRef } from "react";
3
+ /** Fits a textarea to its content; usable from event handlers too. */
4
+ export function resizeTextarea(element) {
5
+ element.style.height = "auto";
6
+ element.style.height = `${element.scrollHeight}px`;
7
+ }
8
+ /** A ref to put on a textarea that resizes whenever `value` changes, the fonts load or the window resizes. */
9
+ export function useTextareaResize(value) {
10
+ const ref = useRef(null);
11
+ useEffect(() => {
12
+ if (ref.current)
13
+ resizeTextarea(ref.current);
14
+ }, [value]);
15
+ useEffect(() => {
16
+ const fit = () => { if (ref.current)
17
+ resizeTextarea(ref.current); };
18
+ // Web fonts change the metrics after the first measure, so the height follows their arrival
19
+ let cancelled = false;
20
+ void document.fonts?.ready.then(() => { if (!cancelled)
21
+ fit(); });
22
+ window.addEventListener("resize", fit);
23
+ return () => {
24
+ cancelled = true;
25
+ window.removeEventListener("resize", fit);
26
+ };
27
+ }, []);
28
+ return ref;
29
+ }
30
+ //# sourceMappingURL=useTextareaResize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTextareaResize.js","sourceRoot":"","sources":["../../src/hooks/useTextareaResize.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAE1D,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAAC,OAA4B;IACzD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC9B,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,YAAY,IAAI,CAAC;AACrD,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,iBAAiB,CAAgC,KAAa;IAC5E,MAAM,GAAG,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAC5B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,GAAG,CAAC,OAAO;YAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO;YAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,4FAA4F;QAC5F,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,KAAK,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS;YAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACvC,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;YACjB,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC5C,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { SVGProps } from "react";
2
+ type IconProps = SVGProps<SVGSVGElement>;
3
+ export declare const PlusIcon: (props: IconProps) => import("react").JSX.Element;
4
+ export declare const PencilIcon: (props: IconProps) => import("react").JSX.Element;
5
+ export declare const TrashIcon: (props: IconProps) => import("react").JSX.Element;
6
+ export declare const BoldIcon: (props: IconProps) => import("react").JSX.Element;
7
+ export declare const ItalicIcon: (props: IconProps) => import("react").JSX.Element;
8
+ export declare const UnderlineIcon: (props: IconProps) => import("react").JSX.Element;
9
+ export declare const LinkIcon: (props: IconProps) => import("react").JSX.Element;
10
+ export declare const EraserIcon: (props: IconProps) => import("react").JSX.Element;
11
+ export declare const QuoteIcon: (props: IconProps) => import("react").JSX.Element;
12
+ export declare const ListIcon: (props: IconProps) => import("react").JSX.Element;
13
+ export declare const HeadingIcon: (props: IconProps) => import("react").JSX.Element;
14
+ export declare const PilcrowIcon: (props: IconProps) => import("react").JSX.Element;
15
+ export declare const ImageIcon: (props: IconProps) => import("react").JSX.Element;
16
+ export declare const VideoIcon: (props: IconProps) => import("react").JSX.Element;
17
+ export declare const PaperclipIcon: (props: IconProps) => import("react").JSX.Element;
18
+ export declare const CheckIcon: (props: IconProps) => import("react").JSX.Element;
19
+ export declare const CloseIcon: (props: IconProps) => import("react").JSX.Element;
20
+ export declare const CopyIcon: (props: IconProps) => import("react").JSX.Element;
21
+ export declare const ScissorsIcon: (props: IconProps) => import("react").JSX.Element;
22
+ export declare const GripIcon: (props: IconProps) => import("react").JSX.Element;
23
+ export declare const UndoIcon: (props: IconProps) => import("react").JSX.Element;
24
+ export declare const RedoIcon: (props: IconProps) => import("react").JSX.Element;
25
+ export declare const UploadIcon: (props: IconProps) => import("react").JSX.Element;
26
+ export declare const blockTypeIcons: Record<string, (props: IconProps) => React.JSX.Element>;
27
+ export {};
28
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,KAAK,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAUzC,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAA0D,CAAC;AACpG,eAAO,MAAM,UAAU,UAAW,SAAS,gCAAqG,CAAC;AACjJ,eAAO,MAAM,SAAS,UAAW,SAAS,gCAA4F,CAAC;AACvI,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAAyF,CAAC;AACnI,eAAO,MAAM,UAAU,UAAW,SAAS,gCAAoE,CAAC;AAChH,eAAO,MAAM,aAAa,UAAW,SAAS,gCAAyE,CAAC;AACxH,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAAgI,CAAC;AAC1K,eAAO,MAAM,UAAU,UAAW,SAAS,gCAA4H,CAAC;AACxK,eAAO,MAAM,SAAS,UAAW,SAAS,gCAA8F,CAAC;AACzI,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAA2F,CAAC;AACrI,eAAO,MAAM,WAAW,UAAW,SAAS,gCAAiE,CAAC;AAC9G,eAAO,MAAM,WAAW,UAAW,SAAS,gCAAwF,CAAC;AACrI,eAAO,MAAM,SAAS,UAAW,SAAS,gCAAyI,CAAC;AACpL,eAAO,MAAM,SAAS,UAAW,SAAS,gCAA4G,CAAC;AACvJ,eAAO,MAAM,aAAa,UAAW,SAAS,gCAAwH,CAAC;AACvK,eAAO,MAAM,SAAS,UAAW,SAAS,gCAAyD,CAAC;AACpG,eAAO,MAAM,SAAS,UAAW,SAAS,gCAA8D,CAAC;AACzG,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAAmJ,CAAC;AAC7L,eAAO,MAAM,YAAY,UAAW,SAAS,gCAAmJ,CAAC;AACjM,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAAoO,CAAC;AAC9Q,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAA+E,CAAC;AACzH,eAAO,MAAM,QAAQ,UAAW,SAAS,gCAA+E,CAAC;AACzH,eAAO,MAAM,UAAU,UAAW,SAAS,gCAAyG,CAAC;AAErJ,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,KAAK,CAAC,GAAG,CAAC,OAAO,CAQlF,CAAC"}
package/dist/icons.js ADDED
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ function Icon({ children, ...props }) {
3
+ return (_jsx("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", ...props, children: children }));
4
+ }
5
+ export const PlusIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M12 5v14M5 12h14" }) });
6
+ export const PencilIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "m4 16-1 5 5-1L20 8a2.8 2.8 0 0 0-4-4L4 16ZM14 6l4 4M13 21h8" }) });
7
+ export const TrashIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6" }) });
8
+ export const BoldIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M7 4h7a4 4 0 0 1 0 8H7zM7 12h8a4 4 0 0 1 0 8H7z" }) });
9
+ export const ItalicIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M19 4h-9M14 20H5M15 4 9 20" }) });
10
+ export const UnderlineIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M6 4v6a6 6 0 0 0 12 0V4M4 20h16" }) });
11
+ export const LinkIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1" }) });
12
+ export const EraserIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "m7 21-4-4a2 2 0 0 1 0-3L14 3a2 2 0 0 1 3 0l4 4a2 2 0 0 1 0 3l-9 9M22 21H7M5 12l7 7" }) });
13
+ export const QuoteIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M4 16h5V9H5a4 4 0 0 1 4-4M13 16h5V9h-4a4 4 0 0 1 4-4" }) });
14
+ export const ListIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01" }) });
15
+ export const HeadingIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M6 4v16M18 4v16M6 12h12" }) });
16
+ export const PilcrowIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M13 4v16M17 4v16M19 4H9.5a4.5 4.5 0 0 0 0 9H13" }) });
17
+ export const ImageIcon = (props) => _jsxs(Icon, { ...props, children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }), _jsx("circle", { cx: "9", cy: "9", r: "2" }), _jsx("path", { d: "m21 15-5-5L5 21" })] });
18
+ export const VideoIcon = (props) => _jsxs(Icon, { ...props, children: [_jsx("path", { d: "m22 8-6 4 6 4V8z" }), _jsx("rect", { x: "2", y: "6", width: "14", height: "12", rx: "2" })] });
19
+ export const PaperclipIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "m21 12-8.5 8.5a5 5 0 0 1-7-7l9-9a3 3 0 0 1 4.5 4.5l-9 9a1.5 1.5 0 0 1-2-2L16 8" }) });
20
+ export const CheckIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M20 6 9 17l-5-5" }) });
21
+ export const CloseIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
22
+ export const CopyIcon = (props) => _jsxs(Icon, { ...props, children: [_jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }), _jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })] });
23
+ export const ScissorsIcon = (props) => _jsxs(Icon, { ...props, children: [_jsx("circle", { cx: "6", cy: "6", r: "3" }), _jsx("circle", { cx: "6", cy: "18", r: "3" }), _jsx("path", { d: "M20 4 8.1 15.9M14.5 14.5 20 20M8.1 8.1 12 12" })] });
24
+ export const GripIcon = (props) => _jsxs(Icon, { ...props, children: [_jsx("circle", { cx: "9", cy: "6", r: "1.2" }), _jsx("circle", { cx: "15", cy: "6", r: "1.2" }), _jsx("circle", { cx: "9", cy: "12", r: "1.2" }), _jsx("circle", { cx: "15", cy: "12", r: "1.2" }), _jsx("circle", { cx: "9", cy: "18", r: "1.2" }), _jsx("circle", { cx: "15", cy: "18", r: "1.2" })] });
25
+ export const UndoIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "m9 4-5 5 5 5M4 9h10a6 6 0 0 1 0 12h-2" }) });
26
+ export const RedoIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "m15 4 5 5-5 5m5-5H10a6 6 0 0 0 0 12h2" }) });
27
+ export const UploadIcon = (props) => _jsx(Icon, { ...props, children: _jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12" }) });
28
+ export const blockTypeIcons = {
29
+ paragraph: PilcrowIcon,
30
+ header: HeadingIcon,
31
+ list: ListIcon,
32
+ quote: QuoteIcon,
33
+ image: ImageIcon,
34
+ video: VideoIcon,
35
+ attachment: PaperclipIcon,
36
+ };
37
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":";AAIA,SAAS,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAuB;IACvD,OAAO,CACL,cAAK,OAAO,EAAC,WAAW,EAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,iBAAa,MAAM,EAAC,SAAS,EAAC,OAAO,KAAK,KAAK,YAC5L,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAgB,EAAE,EAAE,CAAC,KAAC,IAAI,OAAK,KAAK,YAAE,eAAM,CAAC,EAAC,kBAAkB,GAAG,GAAO,CAAC;AACpG,MAAM,CAAC,MAAM,UAAU,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AAC,EAAC,KAAK,GAAG,EAAA,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,KAAK,GAAG,IAAO,CAAC;AAC9Q,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAgB,EAAE,EAAE,CAAC,KAAC,IAAI,OAAK,KAAK,YAAE,eAAM,CAAC,EAAC,uCAAuC,GAAG,GAAO,CAAC;AACzH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAgB,EAAE,EAAE,CAAC,KAAC,IAAI,OAAK,KAAK,YAAE,eAAM,CAAC,EAAC,uCAAuC,GAAG,GAAO,CAAC;AACzH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAgB,EAAE,EAAE,CAAC,KAAC,IAAI,OAAK,KAAK,YAAE,eAAM,CAAC,EAAC,iEAAiE,GAAG,GAAO,CAAC;AAErJ,MAAM,CAAC,MAAM,cAAc,GAA4D;IACrF,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,WAAW;IACnB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,aAAa;CAC1B,CAAC"}
@@ -0,0 +1,24 @@
1
+ export { ContentEditor, type ContentEditorHandle, type ContentEditorProps, type EditorMode } from "./ContentEditor.js";
2
+ export { useDocumentHistory, type DocumentHistory, type DocumentHistoryOptions, type DocumentSnapshot } from "./hooks/useDocumentHistory.js";
3
+ export { BlockEditor, type BlockEditorComponent, type BlockEditorMap, type BlockEditorProps } from "./BlockEditor.js";
4
+ export { RichTextField, EMPTY_FORMATS, type ActiveFormats, type BlockTag, type InlineTag, type ListTag, type RichTextFieldHandle, type RichTextFieldProps, type SelectionInfo } from "./RichTextField.js";
5
+ export { SlashMenu, slashMenuItems, type SlashMenuHandle, type SlashMenuProps } from "./SlashMenu.js";
6
+ export { RichTextInput, type RichTextInputProps } from "./RichTextInput.js";
7
+ export { Toolbar, type ToolbarProps } from "./Toolbar.js";
8
+ export { AddBlockButton, type AddBlockButtonProps } from "./AddBlockButton.js";
9
+ export { QuickAddButtons, type QuickAddButtonsProps } from "./QuickAddButtons.js";
10
+ export { VirtualizedBlockList, type VirtualizedBlockListProps } from "./VirtualizedBlockList.js";
11
+ export { ImageBlock, type MediaBlockProps } from "./blocks/ImageBlock.js";
12
+ export { VideoBlock } from "./blocks/VideoBlock.js";
13
+ export { AttachmentBlock } from "./blocks/AttachmentBlock.js";
14
+ export { ContentProvider, useContentServices, type AttachmentPickerProps, type EditorContextInfo, type ContentEditorServices, type ContentContextValue, type ContentProviderProps, type ImageUploadOptions, type ImageUploadStatus, type PickedAttachment, type UploadedImage, } from "./provider.js";
15
+ export { useBlockManagement, type BlockManagement, type UseBlockManagementOptions } from "./hooks/useBlockManagement.js";
16
+ export { useBlockFocus, type BlockFocus } from "./hooks/useBlockFocus.js";
17
+ export { useBlockVisibility } from "./hooks/useBlockVisibility.js";
18
+ export { useTextareaResize, resizeTextarea } from "./hooks/useTextareaResize.js";
19
+ export { parseClipboard, parsePastedHtml, parsePastedText, type PastedContent } from "./paste.js";
20
+ export { useBlockSelection, type BlockSelection, type BlockSelectionHandlers } from "./hooks/useBlockSelection.js";
21
+ export { BLOCKS_CLIPBOARD_TYPE, blockRun, neighbourId, readBlocksFromClipboard, writeBlocksToClipboard } from "./selection.js";
22
+ export { useBlockDrag, dropPositionFor, type BlockDrag, type DropPosition, type DropTarget, type UseBlockDragOptions } from "./hooks/useBlockDrag.js";
23
+ export { loadEditorParts, type EditorPart } from "./parts.js";
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvH,OAAO,EA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,EACrB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACzH,OAAO,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC/H,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,KAAK,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ export { ContentEditor } from "./ContentEditor.js";
2
+ export { useDocumentHistory } from "./hooks/useDocumentHistory.js";
3
+ export { BlockEditor } from "./BlockEditor.js";
4
+ export { RichTextField, EMPTY_FORMATS } from "./RichTextField.js";
5
+ export { SlashMenu, slashMenuItems } from "./SlashMenu.js";
6
+ export { RichTextInput } from "./RichTextInput.js";
7
+ export { Toolbar } from "./Toolbar.js";
8
+ export { AddBlockButton } from "./AddBlockButton.js";
9
+ export { QuickAddButtons } from "./QuickAddButtons.js";
10
+ export { VirtualizedBlockList } from "./VirtualizedBlockList.js";
11
+ export { ImageBlock } from "./blocks/ImageBlock.js";
12
+ export { VideoBlock } from "./blocks/VideoBlock.js";
13
+ export { AttachmentBlock } from "./blocks/AttachmentBlock.js";
14
+ export { ContentProvider, useContentServices, } from "./provider.js";
15
+ export { useBlockManagement } from "./hooks/useBlockManagement.js";
16
+ export { useBlockFocus } from "./hooks/useBlockFocus.js";
17
+ export { useBlockVisibility } from "./hooks/useBlockVisibility.js";
18
+ export { useTextareaResize, resizeTextarea } from "./hooks/useTextareaResize.js";
19
+ export { parseClipboard, parsePastedHtml, parsePastedText } from "./paste.js";
20
+ export { useBlockSelection } from "./hooks/useBlockSelection.js";
21
+ export { BLOCKS_CLIPBOARD_TYPE, blockRun, neighbourId, readBlocksFromClipboard, writeBlocksToClipboard } from "./selection.js";
22
+ export { useBlockDrag, dropPositionFor } from "./hooks/useBlockDrag.js";
23
+ export { loadEditorParts } from "./parts.js";
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsE,MAAM,oBAAoB,CAAC;AACvH,OAAO,EAAE,kBAAkB,EAA4E,MAAM,+BAA+B,CAAC;AAC7I,OAAO,EAAE,WAAW,EAAyE,MAAM,kBAAkB,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,aAAa,EAA0I,MAAM,oBAAoB,CAAC;AAC1M,OAAO,EAAE,SAAS,EAAE,cAAc,EAA6C,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAA6B,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAkC,MAAM,2BAA2B,CAAC;AACjG,OAAO,EAAE,UAAU,EAAwB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,kBAAkB,GAUnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAwD,MAAM,+BAA+B,CAAC;AACzH,OAAO,EAAE,aAAa,EAAmB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAsB,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAoD,MAAM,8BAA8B,CAAC;AACnH,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC/H,OAAO,EAAE,YAAY,EAAE,eAAe,EAAgF,MAAM,yBAAyB,CAAC;AACtJ,OAAO,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type BlockLike, type ListMarker } from "@alien6-studio/elea-content";
2
+ export type ListCommand = ListMarker | "indent" | "outdent";
3
+ export declare const topLevelListItems: (field: HTMLElement) => NodeListOf<HTMLLIElement>;
4
+ /** Change list markers or indentation. A root outdent returns the replacement blocks. */
5
+ export declare function applyListCommand(field: HTMLElement, command: ListCommand, blockType?: string): boolean | {
6
+ blocks: BlockLike[];
7
+ focus: number;
8
+ };
9
+ /** Ticks or unticks the task the caret is in; false outside a checklist. */
10
+ export declare function toggleTask(field: HTMLElement, item: Element | null | undefined): boolean;
11
+ //# sourceMappingURL=listCommands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listCommands.d.ts","sourceRoot":"","sources":["../src/listCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,KAAK,SAAS,EAAiB,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAIlJ,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC5D,eAAO,MAAM,iBAAiB,UAAW,WAAW,8BAAuE,CAAC;AAyB5H,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG;IAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAwB/I;AAmED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAIxF"}