@mrakomor/core 0.0.11 → 0.0.13

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 (113) hide show
  1. package/dist/blockChrome.mjs +2 -2
  2. package/dist/blockInsertMenu.mjs +1 -1
  3. package/dist/chunk-2C6UDFD4.mjs +1 -0
  4. package/dist/chunk-4WTPDNPA.mjs +1 -0
  5. package/dist/chunk-5AD5MQXI.mjs +1 -0
  6. package/dist/{chunk-K2DMHAUD.mjs → chunk-7CJLTNHZ.mjs} +1 -1
  7. package/dist/{chunk-VYTSZ4S6.mjs → chunk-B2UFH244.mjs} +1 -1
  8. package/dist/chunk-BWK2S4UI.mjs +2 -0
  9. package/dist/chunk-D6K2L5O3.mjs +4 -0
  10. package/dist/{chunk-NR2BAMSW.mjs → chunk-DHFIX7FW.mjs} +2 -2
  11. package/dist/chunk-ERNLRJPB.mjs +1 -0
  12. package/dist/chunk-EXDY5TZH.mjs +1 -0
  13. package/dist/chunk-J4TTWQ6J.mjs +2 -0
  14. package/dist/{chunk-2VURZA2E.mjs → chunk-SG5PCGIV.mjs} +1 -1
  15. package/dist/chunk-ZHOZPQZH.mjs +1 -0
  16. package/dist/clipboard.cjs +3 -3
  17. package/dist/clipboard.mjs +3 -3
  18. package/dist/footer.cjs +3 -3
  19. package/dist/footer.mjs +2 -2
  20. package/dist/headline.cjs +2 -2
  21. package/dist/headline.mjs +1 -1
  22. package/dist/help.cjs +1 -1
  23. package/dist/help.mjs +2 -2
  24. package/dist/index.cjs +6 -6
  25. package/dist/index.mjs +4 -4
  26. package/dist/link.mjs +2 -2
  27. package/dist/list.cjs +3 -3
  28. package/dist/list.mjs +1 -1
  29. package/dist/paragraph.cjs +2 -2
  30. package/dist/paragraph.mjs +1 -1
  31. package/dist/slashCommand.cjs +2 -2
  32. package/dist/slashCommand.mjs +1 -1
  33. package/dist/tooltip.cjs +1 -1
  34. package/dist/tooltip.mjs +2 -2
  35. package/dist/tts.cjs +8 -8
  36. package/dist/tts.mjs +3 -3
  37. package/dist/types/Mrakomor.d.mts +230 -0
  38. package/dist/types/component/AbstractComponent.d.mts +69 -0
  39. package/dist/types/component/Editor.d.mts +8 -0
  40. package/dist/types/component/block/BlockComponent.d.mts +105 -0
  41. package/dist/types/component/block/BlockRegister.d.mts +29 -0
  42. package/dist/types/component/block/ExternalComponent.d.mts +42 -0
  43. package/dist/types/component/block/UnknownComponent.d.mts +3 -0
  44. package/dist/types/component/block/blockItemEquals.d.mts +6 -0
  45. package/dist/types/component/block/helpers.d.mts +319 -0
  46. package/dist/types/component/editorContext.d.mts +4 -0
  47. package/dist/types/component/entityRange/EntityRangeElement.d.mts +15 -0
  48. package/dist/types/component/inlineStyle/Bold.d.mts +4 -0
  49. package/dist/types/component/inlineStyle/InlineElement.d.mts +10 -0
  50. package/dist/types/component/inlineStyle/Italic.d.mts +4 -0
  51. package/dist/types/component/inlineStyle/Subscript.d.mts +4 -0
  52. package/dist/types/component/inlineStyle/Superscript.d.mts +4 -0
  53. package/dist/types/component/inlineStyle/Underline.d.mts +4 -0
  54. package/dist/types/component/inlineStyle/index.d.mts +5 -0
  55. package/dist/types/component/overlayMount.d.mts +46 -0
  56. package/dist/types/dom.d.mts +169 -0
  57. package/dist/types/emitter.d.mts +38 -0
  58. package/dist/types/index.d.mts +7 -0
  59. package/dist/types/namespaces.d.mts +17 -0
  60. package/dist/types/plugin/blockChrome/BlockChrome.d.mts +11 -0
  61. package/dist/types/plugin/blockChrome/index.d.mts +1 -0
  62. package/dist/types/plugin/blockInsertMenu/BlockInsertMenu.d.mts +6 -0
  63. package/dist/types/plugin/blockInsertMenu/index.d.mts +1 -0
  64. package/dist/types/plugin/clipboard/clipboardHelpers.d.mts +151 -0
  65. package/dist/types/plugin/clipboard/clipboardPlugin.d.mts +6 -0
  66. package/dist/types/plugin/clipboard/index.d.mts +1 -0
  67. package/dist/types/plugin/default/defaultMrakomorPlugin.d.mts +21 -0
  68. package/dist/types/plugin/dialog/Dialog.d.mts +23 -0
  69. package/dist/types/plugin/footer/footerPlugin.d.mts +7 -0
  70. package/dist/types/plugin/footer/index.d.mts +1 -0
  71. package/dist/types/plugin/headline/Headline.d.mts +29 -0
  72. package/dist/types/plugin/headline/index.d.mts +1 -0
  73. package/dist/types/plugin/help/HelpRegister.d.mts +15 -0
  74. package/dist/types/plugin/help/helpPlugin.d.mts +26 -0
  75. package/dist/types/plugin/help/helpSchema.d.mts +11 -0
  76. package/dist/types/plugin/help/index.d.mts +1 -0
  77. package/dist/types/plugin/linkEntity/LinkEntity.d.mts +37 -0
  78. package/dist/types/plugin/linkEntity/index.d.mts +1 -0
  79. package/dist/types/plugin/list/List.d.mts +61 -0
  80. package/dist/types/plugin/list/index.d.mts +1 -0
  81. package/dist/types/plugin/list/listHelpers.d.mts +166 -0
  82. package/dist/types/plugin/menu/Menu.d.mts +22 -0
  83. package/dist/types/plugin/menu/menuPlugin.d.mts +6 -0
  84. package/dist/types/plugin/paragraph/Paragraph.d.mts +16 -0
  85. package/dist/types/plugin/paragraph/index.d.mts +1 -0
  86. package/dist/types/plugin/slashCommand/SlashActionRegister.d.mts +12 -0
  87. package/dist/types/plugin/slashCommand/index.d.mts +1 -0
  88. package/dist/types/plugin/slashCommand/slashActionSchema.d.mts +29 -0
  89. package/dist/types/plugin/slashCommand/slashCommandHelpers.d.mts +77 -0
  90. package/dist/types/plugin/slashCommand/slashCommandPlugin.d.mts +11 -0
  91. package/dist/types/plugin/slashCommand/slashHelp.d.mts +12 -0
  92. package/dist/types/plugin/tooltip/Tooltip.d.mts +16 -0
  93. package/dist/types/plugin/tooltip/index.d.mts +1 -0
  94. package/dist/types/plugin/tts/TtsHeadline.d.mts +27 -0
  95. package/dist/types/plugin/tts/TtsList.d.mts +19 -0
  96. package/dist/types/plugin/tts/TtsParagraph.d.mts +9 -0
  97. package/dist/types/plugin/tts/TtsVoice.d.mts +52 -0
  98. package/dist/types/plugin/tts/index.d.mts +4 -0
  99. package/dist/types/register/Register.d.mts +50 -0
  100. package/dist/types/register/sortRegisterEntries.d.mts +7 -0
  101. package/dist/types/schema/blockContent.d.mts +34 -0
  102. package/dist/types/schema/blockRegister.d.mts +14 -0
  103. package/dist/types/schema/config.d.mts +6 -0
  104. package/dist/types/types.d.mts +636 -0
  105. package/package.json +36 -22
  106. package/dist/chunk-5VPYPKGA.mjs +0 -1
  107. package/dist/chunk-BCE45I7Q.mjs +0 -2
  108. package/dist/chunk-N4I2WZWF.mjs +0 -1
  109. package/dist/chunk-SCFD3XBH.mjs +0 -1
  110. package/dist/chunk-T7OO472O.mjs +0 -1
  111. package/dist/chunk-WQWE5UCN.mjs +0 -1
  112. package/dist/chunk-YO4ZA6PJ.mjs +0 -2
  113. package/dist/chunk-ZDMD7SRT.mjs +0 -4
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Mount a vnode into `.mrakomor-tools-container` under a named wrapper div.
3
+ * @param {import('#src/types.mjs').Mrakomor} mrakomor
4
+ * @param {string} className
5
+ * @param {*} vnode
6
+ * @returns {{ container: HTMLElement | null, dispose: (() => void) | null }}
7
+ */
8
+ export function mountIntoToolsContainer(mrakomor: import("#src/types.mjs").Mrakomor, className: string, vnode: any): {
9
+ container: HTMLElement | null;
10
+ dispose: (() => void) | null;
11
+ };
12
+ /**
13
+ * Mount a vnode into `.mrakomor-footer-end` under a named wrapper div.
14
+ * Requires `footerPlugin` (the slot is not part of the editor shell).
15
+ * @param {import('#src/types.mjs').Mrakomor} mrakomor
16
+ * @param {string} className
17
+ * @param {*} vnode
18
+ * @returns {{ container: HTMLElement | null, dispose: (() => void) | null }}
19
+ */
20
+ export function mountIntoFooterEnd(mrakomor: import("#src/types.mjs").Mrakomor, className: string, vnode: any): {
21
+ container: HTMLElement | null;
22
+ dispose: (() => void) | null;
23
+ };
24
+ /**
25
+ * Mount a vnode into `.mrakomor-footer-start` under a named wrapper div.
26
+ * Requires `footerPlugin` (the slot is not part of the editor shell).
27
+ * @param {import('#src/types.mjs').Mrakomor} mrakomor
28
+ * @param {string} className
29
+ * @param {*} vnode
30
+ * @returns {{ container: HTMLElement | null, dispose: (() => void) | null }}
31
+ */
32
+ export function mountIntoFooterStart(mrakomor: import("#src/types.mjs").Mrakomor, className: string, vnode: any): {
33
+ container: HTMLElement | null;
34
+ dispose: (() => void) | null;
35
+ };
36
+ /**
37
+ * Mount a vnode into `.mrakomor-footer-end` (preferred footer actions slot).
38
+ * @param {import('#src/types.mjs').Mrakomor} mrakomor
39
+ * @param {string} className
40
+ * @param {*} vnode
41
+ * @returns {{ container: HTMLElement | null, dispose: (() => void) | null }}
42
+ */
43
+ export function mountIntoFooterContainer(mrakomor: import("#src/types.mjs").Mrakomor, className: string, vnode: any): {
44
+ container: HTMLElement | null;
45
+ dispose: (() => void) | null;
46
+ };
@@ -0,0 +1,169 @@
1
+ export const BLOCK_ELEMENT: unique symbol;
2
+ export const BLOCK_ELEMENT_BODY: unique symbol;
3
+ /** Drop the stored selection snapshot. */
4
+ export function clearGlobalSelectionState(): void;
5
+ /** Collapse the stored snapshot to its end offset and apply it. */
6
+ export function collapseGlobalSelectionState(): void;
7
+ /**
8
+ * BSON ObjectId-style 24-char lowercase hex id (timestamp + machine + pid + counter).
9
+ * @returns {string}
10
+ */
11
+ export function createComponentId(): string;
12
+ /**
13
+ * Block body first child — the contenteditable root (`<p>`, `<ul>`, …).
14
+ * @param {Element | null | undefined} element block wrapper
15
+ * @returns {Node | null}
16
+ */
17
+ export function getBlockContentRoot(element: Element | null | undefined): Node | null;
18
+ /**
19
+ * Child of the block wrapper marked `BLOCK_ELEMENT_BODY`.
20
+ * @param {Element | null | undefined} element
21
+ * @returns {Element | null}
22
+ */
23
+ export function getBlockElementBody(element: Element | null | undefined): Element | null;
24
+ /**
25
+ * Block wrapper that contains `child`.
26
+ * @param {Node | null | undefined} child
27
+ * @returns {Element | null}
28
+ */
29
+ export function getBlockElementByChild(child: Node | null | undefined): Element | null;
30
+ /**
31
+ * Block wrapper (`.mrakomor-block-element`) that contains the range start.
32
+ * @param {Range | null | undefined} range
33
+ * @returns {Element | null}
34
+ */
35
+ export function getBlockElementByRange(range: Range | null | undefined): Element | null;
36
+ /**
37
+ * Block component instance mounted inside the wrapper.
38
+ * @param {Element | null | undefined} element
39
+ * @returns {import('#src/types.mjs').BlockInstance | null}
40
+ */
41
+ export function getBlockElementInstance(element: Element | null | undefined): import("#src/types.mjs").BlockInstance | null;
42
+ /**
43
+ * Resolve a non-collapsed selection that may span multiple blocks.
44
+ * Offsets are character indexes within each block's selectable root.
45
+ * @param {Range | null} [range]
46
+ * @returns {import('#src/types.mjs').CrossBlockSelectionState | null}
47
+ */
48
+ export function getCrossBlockSelectionState(range?: Range | null): import("#src/types.mjs").CrossBlockSelectionState | null;
49
+ /**
50
+ * Collapsed caret offset within the selectable root (or block content root).
51
+ * @returns {number}
52
+ */
53
+ export function getCursorPosition(): number;
54
+ /**
55
+ * Character offset of `(container, offset)` relative to `selectableElement` text.
56
+ * @param {Node | null | undefined} selectableElement
57
+ * @param {Node} container
58
+ * @param {number} offset
59
+ * @returns {number}
60
+ */
61
+ export function getOffsetInSelectable(selectableElement: Node | null | undefined, container: Node, offset: number): number;
62
+ /**
63
+ * Clone of the live selection range, or `null` if there is none.
64
+ * @returns {Range | null}
65
+ */
66
+ export function getRange(): Range | null;
67
+ /**
68
+ * Selectable root that contains `child`.
69
+ * @param {Node | null | undefined} child
70
+ * @returns {Element | null}
71
+ */
72
+ export function getSelectableElementByChild(child: Node | null | undefined): Element | null;
73
+ /**
74
+ * Walk up from the range to the nearest selectable content root.
75
+ * Prefer this over tag checks (e.g. closest('li')) so blocks can opt in.
76
+ * @param {Range | null | undefined} range
77
+ * @returns {Element | null}
78
+ */
79
+ export function getSelectableElementByRange(range: Range | null | undefined): Element | null;
80
+ /**
81
+ * Index of `element` among `root`'s selectable items (see
82
+ * `getSelectableElementsInBlock`), or `-1` if not found.
83
+ * @param {Element | null | undefined} root
84
+ * @param {Element | null | undefined} element
85
+ * @returns {number}
86
+ */
87
+ export function getSelectableElementIndex(root: Element | null | undefined, element: Element | null | undefined): number;
88
+ /**
89
+ * All selectable items owned by one block, in DOM order. `root` is the
90
+ * block's content root (`getBlockContentRoot(blockElement)`): if it is
91
+ * itself marked (Paragraph's `<p>`, Headline's `<h*>` — one item), returns
92
+ * `[root]`; otherwise returns its direct children that are marked (List's
93
+ * `<li>`s — one per row). Generic replacement for tag-based walks like
94
+ * `nodeName === 'LI'`, so a future multi-item block needs no new resolver.
95
+ * @param {Element | null | undefined} root
96
+ * @returns {Element[]}
97
+ */
98
+ export function getSelectableElementsInBlock(root: Element | null | undefined): Element[];
99
+ /**
100
+ * Resolve the selectable item `range` falls in, scoped to `root`, plus its
101
+ * index among `root`'s selectable items (see `getSelectableElementsInBlock`).
102
+ * `null` when the range doesn't resolve to a marked item, or the resolved
103
+ * item isn't actually inside `root` (e.g. the range moved to a different
104
+ * block). Shared strict resolver behind List's own keydown handlers,
105
+ * clipboard's list-item range resolution, and
106
+ * `component/block/helpers.mjs`'s `resolveActiveExchangeItem`.
107
+ * @param {Element | null | undefined} root
108
+ * @param {Range | { startContainer: Node, endContainer?: Node } | null | undefined} range
109
+ * @returns {import('#src/types.mjs').SelectableItem | null}
110
+ */
111
+ export function getSelectableItemForRange(root: Element | null | undefined, range: Range | {
112
+ startContainer: Node;
113
+ endContainer?: Node;
114
+ } | null | undefined): import("#src/types.mjs").SelectableItem | null;
115
+ /**
116
+ * Selection offsets that survive remount, scoped to the selectable root.
117
+ * @returns {import('#src/types.mjs').SelectionState | null}
118
+ */
119
+ export function getSelectionState(): import("#src/types.mjs").SelectionState | null;
120
+ /**
121
+ * Whether a block wrapper's rendered content root is itself contentEditable
122
+ * (e.g. Paragraph's `<p>`, Headline's `<h*>` — `true`; a non-editable atomic
123
+ * block like Figure, or a missing/unmounted block — `false`).
124
+ * @param {Element | null | undefined} blockElement
125
+ * @returns {boolean}
126
+ */
127
+ export function isBlockContentEditable(blockElement: Element | null | undefined): boolean;
128
+ /**
129
+ * Position an overlay above an anchor, coordinates relative to the editor root.
130
+ * @param {Element} root
131
+ * @param {Element | DOMRect | { left: number, top: number }} anchor
132
+ * @param {Element | null | undefined} overlayEl
133
+ * @param {number} [offsetY]
134
+ * @returns {{ x: number, y: number }}
135
+ */
136
+ export function positionAboveAnchor(root: Element, anchor: Element | DOMRect | {
137
+ left: number;
138
+ top: number;
139
+ }, overlayEl: Element | null | undefined, offsetY?: number): {
140
+ x: number;
141
+ y: number;
142
+ };
143
+ /**
144
+ * Center an overlay within the editor root (coordinates relative to root).
145
+ * @param {Element} root
146
+ * @param {Element | null | undefined} overlayEl
147
+ * @returns {{ x: number, y: number }}
148
+ */
149
+ export function positionCenteredInRoot(root: Element, overlayEl: Element | null | undefined): {
150
+ x: number;
151
+ y: number;
152
+ };
153
+ /** Restore the last stored selection, if any. */
154
+ export function restoreGlobalSelectionState(): void;
155
+ /**
156
+ * Apply a `getSelectionState()` snapshot to the live DOM.
157
+ * @param {import('#src/types.mjs').SelectionState | null | undefined} state
158
+ */
159
+ export function restoreSelectionState(state: import("#src/types.mjs").SelectionState | null | undefined): void;
160
+ /** Marks the DOM node selection offsets are relative to (e.g. <p>, <li>). */
161
+ export const SELECTABLE_ELEMENT: unique symbol;
162
+ /**
163
+ * Place the caret at a character offset inside `contentEle`.
164
+ * @param {Node} contentEle
165
+ * @param {number} targetPosition
166
+ */
167
+ export function setCursorPosition(contentEle: Node, targetPosition: number): void;
168
+ /** Snapshot the current selection for dialog/tooltip restore. */
169
+ export function storeGlobalSelectionState(): void;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Command bus bound to a Mrakomor instance.
3
+ * Each `command.*` method emits the matching `EVENT` via `mrakomor.emit`.
4
+ *
5
+ * @param {{ mrakomor?: import('#src/types.mjs').Mrakomor }} [options]
6
+ * @returns {{ emitter: import('@esmj/emitter').Emitter, command: import('#src/types.mjs').MrakomorCommand }}
7
+ */
8
+ export function createCommands({ mrakomor }?: {
9
+ mrakomor?: import("#src/types.mjs").Mrakomor;
10
+ }): {
11
+ emitter: import("@esmj/emitter").Emitter;
12
+ command: import("#src/types.mjs").MrakomorCommand;
13
+ };
14
+ export namespace EVENT {
15
+ let INSERT_BLOCK_ELEMENT: string;
16
+ let REPLACE_BLOCK_ELEMENT: string;
17
+ let REMOVE_BLOCK_ELEMENT: string;
18
+ let MERGE_BLOCK_ELEMENT: string;
19
+ let INSERT_ENTITY_RANGE: string;
20
+ let REMOVE_ENTITY_RANGE: string;
21
+ let INSERT_INLINE_STYLE_RANGE: string;
22
+ let KEYDOWN: string;
23
+ let BEFORE_INPUT: string;
24
+ let INPUT: string;
25
+ let CLICK: string;
26
+ let FOCUSIN: string;
27
+ let FOCUSOUT: string;
28
+ let SELECTION_CHANGE: string;
29
+ let CONTENT_CHANGE: string;
30
+ let TRANSFORM_BLOCK_ELEMENT: string;
31
+ let MOVE_BLOCK_ELEMENT: string;
32
+ }
33
+ /**
34
+ * Skip the handler when a previous listener called `preventDefault()`.
35
+ * @param {Function} handler
36
+ * @returns {Function}
37
+ */
38
+ export function unlessPrevented(handler: Function): Function;
@@ -0,0 +1,7 @@
1
+ export { EVENT } from "./emitter.mjs";
2
+ export { defaultMrakomorPlugin } from "./plugin/default/defaultMrakomorPlugin.mjs";
3
+ export { Menu } from "./plugin/menu/Menu.mjs";
4
+ export { menuPlugin } from "./plugin/menu/menuPlugin.mjs";
5
+ export { Bold, Italic, Subscript, Superscript, Underline } from "./component/inlineStyle/index.mjs";
6
+ export { createMrakomor, Mrakomor } from "./Mrakomor.mjs";
7
+ export { Dialog, dialogPlugin } from "./plugin/dialog/Dialog.mjs";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Leaf block-namespace IDs.
3
+ * Safe to import from helpers/config without pulling component classes
4
+ * (avoids circular imports such as helpers ↔ Paragraph).
5
+ */
6
+ /** Default body text block; Enter after atomic blocks, unwraps, clipboard fallback. */
7
+ export const PARAGRAPH_NAMESPACE: "molecule.paragraph.Paragraph";
8
+ export const LIST_NAMESPACE: "molecule.list.List";
9
+ export const EXTERNAL_NAMESPACE: "molecule.external.ExternalComponent";
10
+ export const UNKNOWN_NAMESPACE: "namespace.unknown.UnknownComponent";
11
+ export const HEADLINE_H1_NAMESPACE: "molecule.headline.H1";
12
+ export const HEADLINE_H2_NAMESPACE: "molecule.headline.H2";
13
+ export const HEADLINE_H3_NAMESPACE: "molecule.headline.H3";
14
+ export const HEADLINE_H4_NAMESPACE: "molecule.headline.H4";
15
+ export const HEADLINE_H5_NAMESPACE: "molecule.headline.H5";
16
+ /** Prefix used by isTextBlock checks for any headline level. */
17
+ export const HEADLINE_NAMESPACE_PREFIX: "molecule.headline.";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Gutter UI: insert (+) and drag handle.
3
+ * @returns {*}
4
+ */
5
+ export function BlockChrome(): any;
6
+ /**
7
+ * Block gutter: insert (+) and drag-to-reorder.
8
+ * @param {import('#src/types.mjs').PluginContext} options
9
+ * @returns {import('#src/types.mjs').Plugin}
10
+ */
11
+ export function blockChromePlugin({ mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
@@ -0,0 +1 @@
1
+ export { BlockChrome, blockChromePlugin } from "./BlockChrome.mjs";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Plus insert menu — opens the shared menu with block registrations.
3
+ * @param {import('#src/types.mjs').PluginContext} options
4
+ * @returns {import('#src/types.mjs').Plugin}
5
+ */
6
+ export function blockInsertMenuPlugin({ mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
@@ -0,0 +1 @@
1
+ export { blockInsertMenuPlugin } from "./BlockInsertMenu.mjs";
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Normalized text length for a text block; `0` otherwise.
3
+ * @param {BlockState} state
4
+ * @returns {number}
5
+ */
6
+ export function textLength(state: BlockState): number;
7
+ /**
8
+ * Slice a text block to `[start, end)`, clipping inline/entity ranges.
9
+ * @param {BlockState} state
10
+ * @param {number} start
11
+ * @param {number} end
12
+ * @returns {BlockState}
13
+ */
14
+ export function sliceStateByRange(state: BlockState, start: number, end: number): BlockState;
15
+ /**
16
+ * Wrap a sliced list item as a paragraph (copy/paste of a list selection).
17
+ * @param {ListItem} item
18
+ * @param {number} start
19
+ * @param {number} end
20
+ * @returns {BlockState}
21
+ */
22
+ export function listItemToParagraph(item: ListItem, start: number, end: number): BlockState;
23
+ /**
24
+ * Blocks to write to the clipboard for the current selection.
25
+ * A selection inside one list, or spanning list items, copies as a paragraph.
26
+ *
27
+ * @param {BlockState[]} content
28
+ * @param {ClipboardSelection} selection
29
+ * @returns {BlockState[]}
30
+ */
31
+ export function copyBlocksFromSelection(content: BlockState[], selection: ClipboardSelection): BlockState[];
32
+ /**
33
+ * Delete `[startOffset, endOffset)` inside one list item.
34
+ * @param {ListBlockState} listState
35
+ * @param {number} itemIndex
36
+ * @param {number} startOffset
37
+ * @param {number} endOffset
38
+ * @returns {ListBlockState}
39
+ */
40
+ export function deleteListItemRange(listState: ListBlockState, itemIndex: number, startOffset: number, endOffset: number): ListBlockState;
41
+ /**
42
+ * Delete the selection: same-block trim, list-item range, or cross-block merge.
43
+ *
44
+ * @param {BlockState[]} content
45
+ * @param {ClipboardSelection} selection
46
+ * @returns {ContentMutation}
47
+ */
48
+ export function deleteSelection(content: BlockState[], selection: ClipboardSelection): ContentMutation;
49
+ /**
50
+ * Move copied `blocks` from `source` to `drop` in one model update.
51
+ * Same-list drop coordinates are those from before the delete.
52
+ *
53
+ * @param {BlockState[]} content
54
+ * @param {{ source: ClipboardSelection, drop: { index: number, offset: number, listItemIndex?: number }, blocks: BlockState[] }} payload
55
+ * @returns {ContentMutation}
56
+ */
57
+ export function moveSelection(content: BlockState[], { source, drop, blocks }: {
58
+ source: ClipboardSelection;
59
+ drop: {
60
+ index: number;
61
+ offset: number;
62
+ listItemIndex?: number;
63
+ };
64
+ blocks: BlockState[];
65
+ }): ContentMutation;
66
+ /**
67
+ * Insert clipboard `blocks` at a caret (or after a list/atomic block).
68
+ *
69
+ * @param {BlockState[]} content
70
+ * @param {{ index: number, offset: number, blocks: BlockState[], listItemIndex?: number }} payload
71
+ * @returns {ContentMutation}
72
+ */
73
+ export function applyPaste(content: BlockState[], { index, offset, blocks, listItemIndex }: {
74
+ index: number;
75
+ offset: number;
76
+ blocks: BlockState[];
77
+ listItemIndex?: number;
78
+ }): ContentMutation;
79
+ /**
80
+ * Parse the custom MIME JSON envelope; `null` if invalid.
81
+ * @param {string} text
82
+ * @returns {BlockState[] | null}
83
+ */
84
+ export function parseClipboardPayload(text: string): BlockState[] | null;
85
+ /**
86
+ * Strip HTML to text via `DOMParser`.
87
+ * @param {string} html
88
+ * @returns {string}
89
+ */
90
+ export function htmlToPlainText(html: string): string;
91
+ /**
92
+ * Split plain text on newlines into paragraph states.
93
+ * @param {string} text
94
+ * @param {string} [namespace]
95
+ * @returns {BlockState[]}
96
+ */
97
+ export function textToParagraphs(text: string, namespace?: string): BlockState[];
98
+ /**
99
+ * Human-readable text for one block (list items joined by newlines).
100
+ * @param {BlockState} block
101
+ * @returns {string}
102
+ */
103
+ export function blockToPlainText(block: BlockState): string;
104
+ /**
105
+ * Join blocks with newlines for `text/plain`.
106
+ * @param {BlockState[]} blocks
107
+ * @returns {string}
108
+ */
109
+ export function blocksToPlainText(blocks: BlockState[]): string;
110
+ /**
111
+ * JSON envelope written to the custom clipboard MIME.
112
+ * @param {BlockState[]} blocks
113
+ * @returns {{ v: number, blocks: BlockState[] }}
114
+ */
115
+ export function createClipboardPayload(blocks: BlockState[]): {
116
+ v: number;
117
+ blocks: BlockState[];
118
+ };
119
+ /**
120
+ * Write custom MIME JSON and `text/plain` onto a `DataTransfer`.
121
+ * @param {DataTransfer} clipboardData
122
+ * @param {BlockState[]} blocks
123
+ */
124
+ export function writeClipboardData(clipboardData: DataTransfer, blocks: BlockState[]): void;
125
+ /**
126
+ * Read blocks from clipboard: custom MIME, then JSON in `text/plain`, then plain/HTML text.
127
+ * @param {DataTransfer | null | undefined} clipboardData
128
+ * @param {string} [paragraphNamespace]
129
+ * @returns {BlockState[]}
130
+ */
131
+ export function readClipboardBlocks(clipboardData: DataTransfer | null | undefined, paragraphNamespace?: string): BlockState[];
132
+ /**
133
+ * Fresh `componentId`s for a pasted block (and its list items).
134
+ * @param {BlockState} block
135
+ * @returns {BlockState}
136
+ */
137
+ export function assignNewComponentIds(block: BlockState): BlockState;
138
+ /**
139
+ * @typedef {import('#src/types.mjs').BlockState} BlockState
140
+ * @typedef {import('#src/types.mjs').ListItem} ListItem
141
+ * @typedef {import('#src/types.mjs').ListBlockState} ListBlockState
142
+ * @typedef {import('#src/types.mjs').ClipboardSelection} ClipboardSelection
143
+ * @typedef {import('#src/types.mjs').ContentMutation} ContentMutation
144
+ */
145
+ export const CLIPBOARD_MIME: "application/x-mrakomor-blocks+json";
146
+ export const CLIPBOARD_PAYLOAD_VERSION: 1;
147
+ export type BlockState = import("#src/types.mjs").BlockState;
148
+ export type ListItem = import("#src/types.mjs").ListItem;
149
+ export type ListBlockState = import("#src/types.mjs").ListBlockState;
150
+ export type ClipboardSelection = import("#src/types.mjs").ClipboardSelection;
151
+ export type ContentMutation = import("#src/types.mjs").ContentMutation;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copy / cut / paste: native listeners + `command.copy|cut|paste`.
3
+ * @param {import('#src/types.mjs').PluginContext} options
4
+ * @returns {import('#src/types.mjs').Plugin}
5
+ */
6
+ export function clipboardPlugin({ root, mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
@@ -0,0 +1 @@
1
+ export { clipboardPlugin } from "./clipboardPlugin.mjs";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Replace one block in content by DOM element index. Normalizes only the
3
+ * changed entry and writes via the internal `_setContentState()` (not the
4
+ * public `setContent()`) so an unrelated stale/unresolvable entry elsewhere
5
+ * in `getContent()` can't turn this single-block update into a crash. Core
6
+ * plugin export — optional plugins (e.g. `list`) may import and reuse this
7
+ * instead of reimplementing the same splice-one-then-write pattern.
8
+ * @param {import('#src/types.mjs').Mrakomor} mrakomor
9
+ * @param {Element} blockElement
10
+ * @param {import('#src/types.mjs').ComponentStateInput} nextState
11
+ * @returns {boolean}
12
+ */
13
+ export function updateBlockAt(mrakomor: import("#src/types.mjs").Mrakomor, blockElement: Element, nextState: import("#src/types.mjs").ComponentStateInput): boolean;
14
+ /**
15
+ * Core editor defaults: External/Unknown resolve, command handlers, KEYDOWN,
16
+ * and the native DOM → emitter bridge. Always appended last by Mrakomor.
17
+ *
18
+ * @param {import('#src/types.mjs').PluginContext} [_options]
19
+ * @returns {import('#src/types.mjs').Plugin}
20
+ */
21
+ export function defaultMrakomorPlugin(_options?: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Floating dialog overlay.
3
+ * @param {{ open: import('#src/types.mjs').Signal<boolean>, placement: import('#src/types.mjs').Signal<string>, positionX: import('#src/types.mjs').Signal<number>, positionY: import('#src/types.mjs').Signal<number>, block: import('#src/types.mjs').Signal<*>, dialogRef: import('#src/types.mjs').ElementRef }} props
4
+ * @returns {*}
5
+ */
6
+ export function Dialog({ open, placement, positionX, positionY, block, dialogRef, }: {
7
+ open: import("#src/types.mjs").Signal<boolean>;
8
+ placement: import("#src/types.mjs").Signal<string>;
9
+ positionX: import("#src/types.mjs").Signal<number>;
10
+ positionY: import("#src/types.mjs").Signal<number>;
11
+ block: import("#src/types.mjs").Signal<any>;
12
+ dialogRef: import("#src/types.mjs").ElementRef;
13
+ }): any;
14
+ export namespace Dialog {
15
+ export { DIALOG_NAMESPACE as NAMESPACE };
16
+ }
17
+ /**
18
+ * Registers `command.openDialog` / `closeDialog` and mounts the dialog overlay.
19
+ * @param {import('#src/types.mjs').PluginContext} options
20
+ * @returns {import('#src/types.mjs').Plugin}
21
+ */
22
+ export function dialogPlugin({ mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
23
+ export const DIALOG_NAMESPACE: "mrakomor.dialog.Dialog";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Optional status bar plugin (block/character counts + action slots).
3
+ * List before `helpPlugin` so Help can mount into `.mrakomor-footer-end`.
4
+ * @param {import('#src/types.mjs').PluginContext} options
5
+ * @returns {import('#src/types.mjs').Plugin}
6
+ */
7
+ export function footerPlugin({ mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
@@ -0,0 +1 @@
1
+ export { footerPlugin } from "./footerPlugin.mjs";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Registers H1–H5 headline blocks.
3
+ * @returns {import('#src/types.mjs').Plugin}
4
+ */
5
+ export function headlinePlugin(): import("#src/types.mjs").Plugin;
6
+ export class HeadlineComponent extends BlockComponent {
7
+ static getStateSchema(node: any): any;
8
+ _level: number;
9
+ _buildContent(state: any): any;
10
+ render(): any;
11
+ onKeydown(event: any): void;
12
+ #private;
13
+ }
14
+ export class Headline1 extends HeadlineComponent {
15
+ static get LABEL(): string;
16
+ }
17
+ export class Headline2 extends HeadlineComponent {
18
+ static get LABEL(): string;
19
+ }
20
+ export class Headline3 extends HeadlineComponent {
21
+ static get LABEL(): string;
22
+ }
23
+ export class Headline4 extends HeadlineComponent {
24
+ static get LABEL(): string;
25
+ }
26
+ export class Headline5 extends HeadlineComponent {
27
+ static get LABEL(): string;
28
+ }
29
+ import { BlockComponent } from '#src/component/block/BlockComponent.mjs';
@@ -0,0 +1 @@
1
+ export { HeadlineComponent, headlinePlugin } from "./Headline.mjs";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Display-only help dialog register.
3
+ */
4
+ export class HelpRegister extends Register {
5
+ /**
6
+ * @param {import('#src/types.mjs').Mrakomor} mrakomor
7
+ */
8
+ constructor(mrakomor: import("#src/types.mjs").Mrakomor);
9
+ /**
10
+ * @param {import('#src/types.mjs').HelpEntry} raw
11
+ * @returns {import('#src/types.mjs').HelpEntry | null}
12
+ */
13
+ normalize(raw: import("#src/types.mjs").HelpEntry): import("#src/types.mjs").HelpEntry | null;
14
+ }
15
+ import Register from '#src/register/Register.mjs';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Group help entries by `group` for dialog rendering.
3
+ * @param {import('#src/types.mjs').HelpEntry[]} entries
4
+ * @returns {Map<string, import('#src/types.mjs').HelpEntry[]>}
5
+ */
6
+ export function groupHelpEntries(entries: import("#src/types.mjs").HelpEntry[]): Map<string, import("#src/types.mjs").HelpEntry[]>;
7
+ /**
8
+ * Build help dialog vDOM from registered entries.
9
+ * @param {import('#src/types.mjs').HelpEntry[]} entries
10
+ * @returns {*}
11
+ */
12
+ export function buildHelpDialogContent(entries: import("#src/types.mjs").HelpEntry[]): any;
13
+ /**
14
+ * Optional help plugin: display-only registry + help dialog + `/help` slash action.
15
+ * Needs `footerPlugin` listed earlier so the trigger can mount in the status bar.
16
+ * Registers `HELP_SLASH_ACTION` on `mrakomor.register.slashActions` in `registerCommands`
17
+ * (not `config.slashActions` / not `resolveConfig`).
18
+ * @param {import('#src/types.mjs').PluginContext} options
19
+ * @returns {import('#src/types.mjs').Plugin}
20
+ */
21
+ export function helpPlugin({ mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
22
+ /**
23
+ * Core `/help` slash action — owned by help plugin (optional; only when help is loaded).
24
+ * @type {import('#src/types.mjs').SlashActionRegistration}
25
+ */
26
+ export const HELP_SLASH_ACTION: import("#src/types.mjs").SlashActionRegistration;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Display-only help registry row.
3
+ * @returns {*} `@esmj/schema` object schema
4
+ */
5
+ export function helpEntrySchema(): any;
6
+ /**
7
+ * Parse a help registry entry; returns `null` when invalid.
8
+ * @param {import('#src/types.mjs').HelpEntry} entry
9
+ * @returns {import('#src/types.mjs').HelpEntry | null}
10
+ */
11
+ export function normalizeHelpEntry(entry: import("#src/types.mjs").HelpEntry): import("#src/types.mjs").HelpEntry | null;
@@ -0,0 +1 @@
1
+ export { buildHelpDialogContent, groupHelpEntries, HELP_SLASH_ACTION, helpPlugin } from "./helpPlugin.mjs";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Sanitize a link href with `@esmj/schema` (allow-list + catch to empty).
3
+ * @param {string | null | undefined} href
4
+ * @returns {string}
5
+ */
6
+ export function sanitizeLinkHref(href: string | null | undefined): string;
7
+ /**
8
+ * Registers the link entity and Cmd/Ctrl+K insert shortcut.
9
+ * @param {import('#src/types.mjs').PluginContext} options
10
+ * @returns {import('#src/types.mjs').Plugin}
11
+ */
12
+ export function linkEntityPlugin({ mrakomor }: import("#src/types.mjs").PluginContext): import("#src/types.mjs").Plugin;
13
+ export class LinkEntity extends EntityRangeElement {
14
+ static getStateSchema(node: any): import("@esmj/schema").SchemaInterface<{
15
+ entity: {
16
+ type: string;
17
+ data: unknown;
18
+ };
19
+ length: number;
20
+ offset: number;
21
+ }, {
22
+ entity: {
23
+ type: string;
24
+ data: unknown;
25
+ };
26
+ length: number;
27
+ offset: number;
28
+ }>;
29
+ input: {
30
+ get: () => null;
31
+ set: (element: any) => null;
32
+ [Symbol.toPrimitive](): string;
33
+ };
34
+ onMount(): void;
35
+ #private;
36
+ }
37
+ import { EntityRangeElement } from '../../component/entityRange/EntityRangeElement.mjs';
@@ -0,0 +1 @@
1
+ export { LinkEntity, linkEntityPlugin } from "./LinkEntity.mjs";