@inkami/blx 0.17.3

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 (114) hide show
  1. package/README.md +98 -0
  2. package/dist/attributed-string/attributed-string.d.ts +37 -0
  3. package/dist/attributed-string/index.d.ts +2 -0
  4. package/dist/attributed-string/types.d.ts +13 -0
  5. package/dist/autocomplete/autocomplete-menu.d.ts +24 -0
  6. package/dist/autocomplete/index.d.ts +2 -0
  7. package/dist/autocomplete/types.d.ts +29 -0
  8. package/dist/blob-store/index.d.ts +32 -0
  9. package/dist/blob-store/types.d.ts +24 -0
  10. package/dist/block/block-controller.d.ts +205 -0
  11. package/dist/block/index.d.ts +2 -0
  12. package/dist/block/types.d.ts +15 -0
  13. package/dist/block-action-menu/block-action-menu.d.ts +62 -0
  14. package/dist/block-action-menu/index.d.ts +2 -0
  15. package/dist/block-context-menu/block-context-menu.d.ts +33 -0
  16. package/dist/block-context-menu/index.d.ts +2 -0
  17. package/dist/blx.js +16245 -0
  18. package/dist/blx.js.map +1 -0
  19. package/dist/caret/custom-caret.d.ts +30 -0
  20. package/dist/clipboard/clipboard-manager.d.ts +28 -0
  21. package/dist/clipboard/index.d.ts +2 -0
  22. package/dist/clipboard/paste-parser.d.ts +30 -0
  23. package/dist/commands/command-registry.d.ts +26 -0
  24. package/dist/commands/index.d.ts +2 -0
  25. package/dist/crdt/automerge-sync.d.ts +157 -0
  26. package/dist/crdt/crdt-log.d.ts +57 -0
  27. package/dist/crdt/index.d.ts +8 -0
  28. package/dist/crdt/remote-cursor-renderer.d.ts +28 -0
  29. package/dist/crdt/replay-ui.d.ts +34 -0
  30. package/dist/crdt/types.d.ts +47 -0
  31. package/dist/date-picker/agenda-utils.d.ts +37 -0
  32. package/dist/date-picker/date-parser.d.ts +25 -0
  33. package/dist/date-picker/date-picker.d.ts +115 -0
  34. package/dist/date-picker/index.d.ts +6 -0
  35. package/dist/drag-handle/drag-handle.d.ts +105 -0
  36. package/dist/drag-handle/index.d.ts +1 -0
  37. package/dist/editor.d.ts +864 -0
  38. package/dist/emoji-picker/emoji-data.d.ts +22 -0
  39. package/dist/emoji-picker/emoji-picker.d.ts +43 -0
  40. package/dist/emoji-picker/index.d.ts +3 -0
  41. package/dist/event-bus/event-bus.d.ts +14 -0
  42. package/dist/event-bus/index.d.ts +2 -0
  43. package/dist/event-bus/types.d.ts +320 -0
  44. package/dist/fold/fold-manager.d.ts +27 -0
  45. package/dist/fold/index.d.ts +2 -0
  46. package/dist/grapheme.d.ts +28 -0
  47. package/dist/index.d.ts +62 -0
  48. package/dist/inline-toolbar/highlight-picker.d.ts +41 -0
  49. package/dist/inline-toolbar/index.d.ts +5 -0
  50. package/dist/inline-toolbar/inline-toolbar.d.ts +97 -0
  51. package/dist/inline-toolbar/link-popover.d.ts +24 -0
  52. package/dist/keybindings/defaults.d.ts +2 -0
  53. package/dist/keybindings/index.d.ts +4 -0
  54. package/dist/keybindings/key-matcher.d.ts +41 -0
  55. package/dist/keybindings/types.d.ts +6 -0
  56. package/dist/keybindings/vim.d.ts +2 -0
  57. package/dist/markdown/block-shortcuts.d.ts +35 -0
  58. package/dist/markdown/emoticon-substitutions.d.ts +22 -0
  59. package/dist/markdown/export.d.ts +5 -0
  60. package/dist/markdown/index.d.ts +4 -0
  61. package/dist/markdown/inline-shortcuts.d.ts +13 -0
  62. package/dist/markdown/types.d.ts +29 -0
  63. package/dist/plugins/blockquote.d.ts +6 -0
  64. package/dist/plugins/checklist.d.ts +18 -0
  65. package/dist/plugins/code.d.ts +50 -0
  66. package/dist/plugins/excalidraw.d.ts +26 -0
  67. package/dist/plugins/heading.d.ts +20 -0
  68. package/dist/plugins/horizontal-rule.d.ts +5 -0
  69. package/dist/plugins/image.d.ts +19 -0
  70. package/dist/plugins/index.d.ts +28 -0
  71. package/dist/plugins/list.d.ts +18 -0
  72. package/dist/plugins/mermaid.d.ts +11 -0
  73. package/dist/plugins/paragraph.d.ts +18 -0
  74. package/dist/plugins/prism-loader.d.ts +16 -0
  75. package/dist/plugins/render-utils.d.ts +43 -0
  76. package/dist/plugins/table.d.ts +22 -0
  77. package/dist/plugins/youtube.d.ts +21 -0
  78. package/dist/schema/index.d.ts +2 -0
  79. package/dist/schema/schema-registry.d.ts +35 -0
  80. package/dist/schema/types.d.ts +67 -0
  81. package/dist/search/index.d.ts +4 -0
  82. package/dist/search/search-engine.d.ts +39 -0
  83. package/dist/search/search-ui.d.ts +59 -0
  84. package/dist/selection/index.d.ts +3 -0
  85. package/dist/selection/selection-manager.d.ts +41 -0
  86. package/dist/selection/types.d.ts +20 -0
  87. package/dist/slash-menu/index.d.ts +2 -0
  88. package/dist/slash-menu/slash-menu.d.ts +27 -0
  89. package/dist/table-of-contents/index.d.ts +1 -0
  90. package/dist/table-of-contents/table-of-contents.d.ts +74 -0
  91. package/dist/transaction/index.d.ts +2 -0
  92. package/dist/transaction/transaction.d.ts +29 -0
  93. package/dist/transaction/types.d.ts +40 -0
  94. package/dist/types.d.ts +21 -0
  95. package/dist/ui/context-menu.d.ts +103 -0
  96. package/dist/ui/dismiss.d.ts +33 -0
  97. package/dist/ui/dropdown.d.ts +81 -0
  98. package/dist/ui/floating-scroll-manager.d.ts +50 -0
  99. package/dist/ui/index.d.ts +18 -0
  100. package/dist/ui/modal.d.ts +109 -0
  101. package/dist/ui/popover.d.ts +59 -0
  102. package/dist/ui/position-fixed.d.ts +35 -0
  103. package/dist/ui/toast.d.ts +60 -0
  104. package/dist/ui/tooltip.d.ts +64 -0
  105. package/dist/undo/index.d.ts +5 -0
  106. package/dist/undo/jump-list.d.ts +37 -0
  107. package/dist/undo/types.d.ts +49 -0
  108. package/dist/undo/undo-manager.d.ts +47 -0
  109. package/dist/util/icons.d.ts +13 -0
  110. package/dist/util/id.d.ts +10 -0
  111. package/dist/viewport/block-viewport.d.ts +106 -0
  112. package/dist/viewport/index.d.ts +2 -0
  113. package/package.json +66 -0
  114. package/style.css +4670 -0
@@ -0,0 +1,22 @@
1
+ export interface EmojiEntry {
2
+ emoji: string;
3
+ name: string;
4
+ keywords: string[];
5
+ }
6
+ export declare const EMOJI_LIST: EmojiEntry[];
7
+ /** Emoji category — defines a slice of EMOJI_LIST for browsing. */
8
+ export interface EmojiCategory {
9
+ key: string;
10
+ icon: string;
11
+ start: number;
12
+ end: number;
13
+ }
14
+ /** Category definitions matching the order of EMOJI_LIST. */
15
+ export declare const EMOJI_CATEGORIES: EmojiCategory[];
16
+ /** Get emoji entries for a category. */
17
+ export declare function getEmojiByCategory(category: EmojiCategory): EmojiEntry[];
18
+ /**
19
+ * Search emoji by name/keyword prefix match.
20
+ * Returns top N results (default 8).
21
+ */
22
+ export declare function searchEmoji(query: string, limit?: number): EmojiEntry[];
@@ -0,0 +1,43 @@
1
+ import type { EmojiEntry } from "./emoji-data";
2
+ export declare class EmojiPicker {
3
+ private el;
4
+ private items;
5
+ private selectedIndex;
6
+ private onSelect;
7
+ private onClose;
8
+ /** Whether the picker is showing browse mode (all categories) vs search results. */
9
+ private browseMode;
10
+ private activeCategoryIndex;
11
+ private tabBar;
12
+ private grid;
13
+ private tooltip;
14
+ constructor(onSelect: (emoji: string) => void, onClose: () => void);
15
+ get element(): HTMLElement;
16
+ show(anchorRect: DOMRect): void;
17
+ /** Reposition the picker to follow a new anchor rect (e.g. on scroll) */
18
+ reposition(anchorRect: DOMRect): void;
19
+ hide(): void;
20
+ get visible(): boolean;
21
+ updateResults(entries: EmojiEntry[]): void;
22
+ /**
23
+ * Switch to browse mode — show all emoji in the active category.
24
+ * Called when the query is empty (user just typed `:` with nothing after).
25
+ */
26
+ enterBrowseMode(): void;
27
+ /**
28
+ * Switch to search mode — show filtered results.
29
+ * Called when the query has text.
30
+ */
31
+ enterSearchMode(entries: EmojiEntry[]): void;
32
+ /** Handle keyboard events. Returns true if the event was consumed. */
33
+ handleKeyDown(e: KeyboardEvent): boolean;
34
+ /** Get the currently selected entry, or null */
35
+ getSelectedEntry(): EmojiEntry | null;
36
+ destroy(): void;
37
+ private buildTabBar;
38
+ private switchCategory;
39
+ private updateTabSelection;
40
+ private renderGrid;
41
+ private updateSelection;
42
+ private showTooltip;
43
+ }
@@ -0,0 +1,3 @@
1
+ export { EmojiPicker } from "./emoji-picker";
2
+ export { searchEmoji, EMOJI_LIST, EMOJI_CATEGORIES, getEmojiByCategory } from "./emoji-data";
3
+ export type { EmojiEntry, EmojiCategory } from "./emoji-data";
@@ -0,0 +1,14 @@
1
+ import type { EventHandler, Unsubscribe } from "./types";
2
+ /**
3
+ * Typed event bus — generic over an event map.
4
+ * Handlers that throw do not break other handlers.
5
+ */
6
+ export declare class EventBus<TEventMap = Record<string, unknown>> {
7
+ private handlers;
8
+ on<K extends keyof TEventMap>(event: K, handler: EventHandler<TEventMap[K]>): Unsubscribe;
9
+ once<K extends keyof TEventMap>(event: K, handler: EventHandler<TEventMap[K]>): Unsubscribe;
10
+ off<K extends keyof TEventMap>(event: K, handler: EventHandler<TEventMap[K]>): void;
11
+ emit<K extends keyof TEventMap>(event: K, payload: TEventMap[K]): void;
12
+ emitAsync<K extends keyof TEventMap>(event: K, payload: TEventMap[K]): Promise<void>;
13
+ clear(): void;
14
+ }
@@ -0,0 +1,2 @@
1
+ export { EventBus } from "./event-bus";
2
+ export type { EditorEventMap, EventHandler, Unsubscribe, ThemeMode } from "./types";
@@ -0,0 +1,320 @@
1
+ import type { AttributedString } from "../attributed-string";
2
+ import type { BlockMetadata } from "../schema/types";
3
+ import type { MultiBlockSelection } from "../selection/types";
4
+ import type { CommandRegistry } from "../commands/command-registry";
5
+ /** Payload types for all editor events */
6
+ export interface EditorEventMap {
7
+ "block:added": {
8
+ blockId: string;
9
+ index: number;
10
+ };
11
+ "block:removed": {
12
+ blockId: string;
13
+ };
14
+ "block:moved": {
15
+ blockId: string;
16
+ fromIndex: number;
17
+ toIndex: number;
18
+ };
19
+ "block:typeChanged": {
20
+ blockId: string;
21
+ oldType: string;
22
+ newType: string;
23
+ };
24
+ "block:contentChanged": {
25
+ blockId: string;
26
+ content: AttributedString;
27
+ metadata?: BlockMetadata;
28
+ previousContent?: AttributedString;
29
+ previousMetadata?: BlockMetadata;
30
+ previousCursorOffset?: number;
31
+ };
32
+ "block:focus": {
33
+ blockId: string;
34
+ offset?: number;
35
+ caretX?: number;
36
+ };
37
+ "block:blur": {
38
+ blockId: string;
39
+ };
40
+ "block:split": {
41
+ blockId: string;
42
+ offset: number;
43
+ };
44
+ "block:merge": {
45
+ blockId: string;
46
+ direction: "backward" | "forward";
47
+ };
48
+ "block:slashMenu": {
49
+ blockId: string;
50
+ query: string;
51
+ slashOffset: number;
52
+ };
53
+ "block:slashClose": {
54
+ blockId: string;
55
+ };
56
+ "block:emojiSearch": {
57
+ blockId: string;
58
+ query: string;
59
+ colonOffset: number;
60
+ };
61
+ "block:emojiClose": {
62
+ blockId: string;
63
+ };
64
+ "block:emojiCommit": {
65
+ blockId: string;
66
+ colonOffset: number;
67
+ cursorOffset: number;
68
+ emoji: string;
69
+ };
70
+ "block:autoCompleteMenu": {
71
+ blockId: string;
72
+ query: string;
73
+ bracketOffset: number;
74
+ };
75
+ "block:autoCompleteClose": {
76
+ blockId: string;
77
+ };
78
+ "block:convertType": {
79
+ blockId: string;
80
+ newType: string;
81
+ metadata: Record<string, unknown>;
82
+ };
83
+ "block:checklistToggled": {
84
+ blockId: string;
85
+ checked: boolean;
86
+ };
87
+ "block:agendaOpen": {
88
+ blockId: string;
89
+ atOffset: number;
90
+ role?: "due" | "scheduled" | "event";
91
+ };
92
+ "block:agendaSearch": {
93
+ blockId: string;
94
+ query: string;
95
+ atOffset: number;
96
+ role?: "due" | "scheduled" | "event";
97
+ };
98
+ "block:agendaClose": {
99
+ blockId: string;
100
+ };
101
+ "block:agendaAutoConfirm": {
102
+ blockId: string;
103
+ query: string;
104
+ role?: "due" | "scheduled" | "event";
105
+ };
106
+ "block:agendaEdit": {
107
+ blockId: string;
108
+ role: "due" | "scheduled" | "event";
109
+ date: string;
110
+ };
111
+ "block:agendaChanged": {
112
+ blockId: string;
113
+ role: "due" | "scheduled" | "event";
114
+ date: string | null;
115
+ previous: string | null;
116
+ recurrence?: {
117
+ interval: number;
118
+ unit: string;
119
+ anchor?: string;
120
+ fromCompletion?: boolean;
121
+ } | null;
122
+ };
123
+ "editor:ready": Record<string, never>;
124
+ "editor:destroyed": Record<string, never>;
125
+ "block:indent": {
126
+ blockId: string;
127
+ };
128
+ "block:outdent": {
129
+ blockId: string;
130
+ };
131
+ "block:selectTo": {
132
+ blockId: string;
133
+ direction: "up" | "down";
134
+ };
135
+ "selection:blockSelect": {
136
+ state: MultiBlockSelection | null;
137
+ };
138
+ "block:jumpToDocStart": {
139
+ blockId: string;
140
+ };
141
+ "block:jumpToDocEnd": {
142
+ blockId: string;
143
+ };
144
+ "block:selectToDocStart": {
145
+ blockId: string;
146
+ };
147
+ "block:selectToDocEnd": {
148
+ blockId: string;
149
+ };
150
+ "block:pageUp": {
151
+ blockId: string;
152
+ };
153
+ "block:pageDown": {
154
+ blockId: string;
155
+ };
156
+ "selection:changed": {
157
+ blockId: string | null;
158
+ start: number;
159
+ end: number;
160
+ /** Set when the selection spans into a different block (multi-block) */
161
+ endBlockId?: string;
162
+ };
163
+ "editor:unfocusedInput": {
164
+ key: string;
165
+ isComposing: boolean;
166
+ };
167
+ "block:enterBlockSelect": {
168
+ blockId: string;
169
+ };
170
+ "editor:modeChanged": {
171
+ mode: "insert" | "normal" | "visualBlock";
172
+ };
173
+ "block:moveUp": {
174
+ blockId: string;
175
+ };
176
+ "block:moveDown": {
177
+ blockId: string;
178
+ };
179
+ "link:click": {
180
+ href: string;
181
+ resolvedHref: string;
182
+ originalEvent: MouseEvent;
183
+ };
184
+ "blockRef:click": {
185
+ blockId: string;
186
+ originalEvent: MouseEvent;
187
+ };
188
+ "blockRef:hover": {
189
+ blockId: string;
190
+ element: HTMLElement;
191
+ originalEvent: MouseEvent;
192
+ };
193
+ "blockRef:hoverEnd": {
194
+ blockId: string;
195
+ };
196
+ "block:refineWithAI": {
197
+ blockIds: string[];
198
+ };
199
+ "editor:themeChanged": {
200
+ theme: ThemeMode;
201
+ };
202
+ "editor:undo": Record<string, never>;
203
+ "editor:redo": Record<string, never>;
204
+ "editor:historyChanged": {
205
+ canUndo: boolean;
206
+ canRedo: boolean;
207
+ };
208
+ "editor:jumpBack": {
209
+ blockId: string;
210
+ offset: number;
211
+ };
212
+ "editor:jumpForward": {
213
+ blockId: string;
214
+ offset: number;
215
+ };
216
+ "table:cellEdit": {
217
+ blockId: string;
218
+ row: number;
219
+ col: number;
220
+ value: string;
221
+ };
222
+ "table:createRowBelow": {
223
+ blockId: string;
224
+ row: number;
225
+ };
226
+ "table:deleteRow": {
227
+ blockId: string;
228
+ row: number;
229
+ };
230
+ "table:navigateOut": {
231
+ blockId: string;
232
+ direction: "up" | "down";
233
+ };
234
+ "table:exit": {
235
+ blockId: string;
236
+ };
237
+ "table:escape": {
238
+ blockId: string;
239
+ };
240
+ "table:addColumn": {
241
+ blockId: string;
242
+ col: number;
243
+ };
244
+ "table:deleteColumn": {
245
+ blockId: string;
246
+ col: number;
247
+ };
248
+ "table:moveRow": {
249
+ blockId: string;
250
+ from: number;
251
+ to: number;
252
+ };
253
+ "table:moveColumn": {
254
+ blockId: string;
255
+ from: number;
256
+ to: number;
257
+ };
258
+ "table:bulkClear": {
259
+ blockId: string;
260
+ keys: string[];
261
+ };
262
+ "table:selectionChanged": {
263
+ blockId: string;
264
+ startRow: number;
265
+ endRow: number;
266
+ startCol: number;
267
+ endCol: number;
268
+ };
269
+ "table:insertRowAbove": {
270
+ blockId: string;
271
+ row: number;
272
+ };
273
+ "table:duplicateRow": {
274
+ blockId: string;
275
+ startRow: number;
276
+ endRow: number;
277
+ };
278
+ "table:clearRow": {
279
+ blockId: string;
280
+ startRow: number;
281
+ endRow: number;
282
+ };
283
+ "table:duplicateColumn": {
284
+ blockId: string;
285
+ startCol: number;
286
+ endCol: number;
287
+ };
288
+ "table:clearColumn": {
289
+ blockId: string;
290
+ startCol: number;
291
+ endCol: number;
292
+ };
293
+ "table:bulkFormat": {
294
+ blockId: string;
295
+ startRow: number;
296
+ endRow: number;
297
+ startCol: number;
298
+ endCol: number;
299
+ attribute: string;
300
+ applied: boolean;
301
+ };
302
+ "editor:openSlashMenu": {
303
+ blockId: string;
304
+ };
305
+ "editor:openCommandMode": {
306
+ commands: CommandRegistry;
307
+ };
308
+ "editor:save": Record<string, never>;
309
+ "editor:close": Record<string, never>;
310
+ "editor:openDocumentSwitcher": Record<string, never>;
311
+ "editor:foldChanged": {
312
+ blockId: string | null;
313
+ folded: boolean;
314
+ };
315
+ }
316
+ export type ThemeMode = "light" | "dark" | "system";
317
+ /** Handler function for a given event key */
318
+ export type EventHandler<T> = (payload: T) => void | Promise<void>;
319
+ /** Unsubscribe function returned by on() */
320
+ export type Unsubscribe = () => void;
@@ -0,0 +1,27 @@
1
+ import type { Block } from "../types";
2
+ export interface FoldState {
3
+ foldedIds: string[];
4
+ }
5
+ export interface FoldCallbacks {
6
+ onFoldChanged?: (state: FoldState) => void;
7
+ }
8
+ export declare class FoldManager {
9
+ private foldedHeadingIds;
10
+ private hiddenBlockIds;
11
+ private callbacks;
12
+ setCallbacks(cb: FoldCallbacks): void;
13
+ loadState(state: FoldState | null): void;
14
+ getState(): FoldState;
15
+ toggle(headingBlockId: string, allBlocks: ReadonlyArray<Block>): Set<string>;
16
+ fold(headingBlockId: string, allBlocks: ReadonlyArray<Block>): Set<string>;
17
+ unfold(headingBlockId: string, allBlocks: ReadonlyArray<Block>): Set<string>;
18
+ foldAll(allBlocks: ReadonlyArray<Block>): Set<string>;
19
+ unfoldAll(allBlocks: ReadonlyArray<Block>): Set<string>;
20
+ isFolded(headingBlockId: string): boolean;
21
+ isHidden(blockId: string): boolean;
22
+ recompute(allBlocks: ReadonlyArray<Block>): Set<string>;
23
+ getHiddenBlockIds(): ReadonlySet<string>;
24
+ findOwningHeading(blockId: string, allBlocks: ReadonlyArray<Block>): string | null;
25
+ }
26
+ export declare function getHeadingScope(headingBlock: Block, allBlocks: ReadonlyArray<Block>): string[];
27
+ export declare function computeHiddenBlocks(foldedHeadingIds: Set<string>, allBlocks: ReadonlyArray<Block>): Set<string>;
@@ -0,0 +1,2 @@
1
+ export { FoldManager, getHeadingScope, computeHiddenBlocks } from "./fold-manager";
2
+ export type { FoldState, FoldCallbacks } from "./fold-manager";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Grapheme-cluster boundary utilities.
3
+ *
4
+ * JavaScript string `.length` counts UTF-16 code units, so multi-codepoint
5
+ * characters like ❤️ (U+2764 + U+FE0F, length 2) or 👨‍👩‍👧 (length 8)
6
+ * span more than 1 unit. When deleting "one character" on backspace or
7
+ * forward-delete we must remove the entire grapheme cluster, not just a
8
+ * single code unit.
9
+ *
10
+ * Uses `Intl.Segmenter` (supported in all modern browsers and Node 16+).
11
+ */
12
+ /**
13
+ * Return the UTF-16 offset of the start of the grapheme cluster that
14
+ * ends at (or contains) `offset`. If `offset` is 0, returns 0.
15
+ *
16
+ * Example: for text "a❤️b" (UTF-16 units: a ❤ \uFE0F b),
17
+ * prevGraphemeBoundary(text, 3) → 1 (skips both code units of ❤️)
18
+ */
19
+ export declare function prevGraphemeBoundary(text: string, offset: number): number;
20
+ /**
21
+ * Return the UTF-16 offset just past the grapheme cluster that starts
22
+ * at (or contains) `offset`. If `offset` is at/past the end, returns
23
+ * `text.length`.
24
+ *
25
+ * Example: for text "a❤️b" (UTF-16 units: a ❤ \uFE0F b),
26
+ * nextGraphemeBoundary(text, 1) → 3 (skips both code units of ❤️)
27
+ */
28
+ export declare function nextGraphemeBoundary(text: string, offset: number): number;
@@ -0,0 +1,62 @@
1
+ export { Editor } from "./editor";
2
+ export type { EditorOptions, EditorJSON, DateSuggestionProvider, ExternalKeybinding } from "./editor";
3
+ export type { Block, BlockJSON } from "./types";
4
+ export { blockToJSON, blockFromJSON } from "./types";
5
+ export { AttributedString } from "./attributed-string";
6
+ export type { Attributes, AttributeValue, Span, AttributedStringJSON } from "./attributed-string";
7
+ export { EventBus } from "./event-bus";
8
+ export type { EditorEventMap, EventHandler, Unsubscribe, ThemeMode } from "./event-bus";
9
+ export { SchemaRegistry } from "./schema";
10
+ export type { BlockTypePlugin, BlockMetadata, ConversionTarget } from "./schema";
11
+ export { Transaction } from "./transaction";
12
+ export type { Operation, TransactionResult } from "./transaction";
13
+ export { BlockController } from "./block";
14
+ export type { BlockView } from "./block";
15
+ export { paragraphPlugin, headingPlugin, listPlugin, codeBlockPlugin, horizontalRulePlugin, youtubePlugin, imagePlugin, tablePlugin, blockquotePlugin, mermaidPlugin, renderMermaidSvg, excalidrawPlugin, openExcalidrawModal, renderExcalidrawSvg, parseYouTubeUrl, CODE_LANGUAGES, registerDefaultPlugins, renderAttributedString, setUrlResolver, setBlockRefRenderCallback, resolveUrl, } from "./plugins";
16
+ export type { ParagraphMetadata, HeadingMetadata, ListMetadata, CodeBlockMetadata, HorizontalRuleMetadata, YouTubeMetadata, ImageMetadata, TableMetadata, BlockquoteMetadata, MermaidMetadata, ExcalidrawMetadata } from "./plugins";
17
+ export type { TableSelection } from "./plugins/table";
18
+ export { SelectionManager } from "./selection";
19
+ export type { InlineSelection, MultiBlockSelection, SelectionState } from "./selection";
20
+ export { isMultiBlockSelection, isInlineSelection } from "./selection";
21
+ export { detectInlineShortcut, detectBlockShortcut, blocksToMarkdown } from "./markdown";
22
+ export type { InlineShortcutMatch, BlockShortcutMatch } from "./markdown";
23
+ export { DatePicker, classifyAgendaDate, parseAgendaDate, formatAgendaDateISO, agendaStateClass, parseDateQuery } from "./date-picker";
24
+ export type { AgendaState, AgendaDisplay, DateSuggestion, DateRole, Recurrence } from "./date-picker";
25
+ export { EmojiPicker, searchEmoji, EMOJI_LIST } from "./emoji-picker";
26
+ export type { EmojiEntry } from "./emoji-picker";
27
+ export { InlineToolbar, TOOLBAR_BUTTONS } from "./inline-toolbar";
28
+ export type { ToolbarButton, ToolbarActionContext } from "./inline-toolbar";
29
+ export { HighlightPicker, HIGHLIGHT_COLORS } from "./inline-toolbar";
30
+ export type { HighlightColorName } from "./inline-toolbar";
31
+ export { BlockActionMenu } from "./block-action-menu";
32
+ export type { BlockActionMenuEntry } from "./block-action-menu";
33
+ export { BlockContextMenu } from "./block-context-menu";
34
+ export type { BlockContextMenuEntry } from "./block-context-menu";
35
+ export { copyBlocksToClipboard, readBlocksFromClipboard, extractBlocksFromHtml, htmlToBlocks, markdownToBlocks, plainTextToBlocks } from "./clipboard";
36
+ export { AutoCompleteMenu } from "./autocomplete";
37
+ export type { AutoCompleteEntry, AutoCompleteProvider } from "./autocomplete";
38
+ export { DEFAULT_KEYBINDINGS, VIM_KEYBINDINGS } from "./keybindings";
39
+ export type { KeyDescriptor, KeybindingMap } from "./keybindings";
40
+ export { CommandRegistry } from "./commands/command-registry";
41
+ export type { CommandEntry, ExternalCommandEntry } from "./commands/command-registry";
42
+ export { SearchEngine, SearchUI } from "./search";
43
+ export type { SearchMatch, SearchOptions, SearchUICallbacks } from "./search";
44
+ export { UndoManager } from "./undo";
45
+ export type { UndoManagerOptions } from "./undo";
46
+ export { JumpList } from "./undo";
47
+ export type { JumpEntry, JumpListOptions, UndoAction, UndoEntry, CursorState, BlockSnapshot } from "./undo";
48
+ export { CrdtLog } from "./crdt";
49
+ export { PEER_COLORS, renderRemoteCursors, clearRemoteCursors } from "./crdt";
50
+ export { AutomergeSync, diffText } from "./crdt";
51
+ export type { AutomergeDocSchema, AutomergeBlockData, AutomergeSyncOptions } from "./crdt";
52
+ export type { CrdtOperation, CrdtLogSnapshot, CrdtPeer, RemoteCursor } from "./crdt";
53
+ export { setBlobStore, getBlobStore, isBlobRef, resolveBlobSrc, storeFileAsBlob, sha256Hex, makeBlobRef, blobRefHash } from "./blob-store";
54
+ export type { BlobStore } from "./blob-store";
55
+ export { BlockViewport } from "./viewport";
56
+ export type { BlockViewportOptions } from "./viewport";
57
+ export { FoldManager, getHeadingScope, computeHiddenBlocks } from "./fold";
58
+ export type { FoldState, FoldCallbacks } from "./fold";
59
+ export { TableOfContents } from "./table-of-contents";
60
+ export { ContextMenu, Popover, positionFixed, dismissOnClickOutside } from "./ui";
61
+ export type { MenuItem, ContextMenuOptions, PopoverOptions, PositionFixedOptions, DismissHandle } from "./ui";
62
+ export { generateId, isUUID } from "./util/id";
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Small floating popover showing color swatches for text highlighting.
3
+ * Displayed below the inline toolbar or selection rect.
4
+ */
5
+ /** Predefined highlight colors available in the picker. */
6
+ export declare const HIGHLIGHT_COLORS: readonly [{
7
+ readonly name: "yellow";
8
+ readonly label: "Yellow";
9
+ }, {
10
+ readonly name: "green";
11
+ readonly label: "Green";
12
+ }, {
13
+ readonly name: "blue";
14
+ readonly label: "Blue";
15
+ }, {
16
+ readonly name: "pink";
17
+ readonly label: "Pink";
18
+ }, {
19
+ readonly name: "orange";
20
+ readonly label: "Orange";
21
+ }, {
22
+ readonly name: "purple";
23
+ readonly label: "Purple";
24
+ }];
25
+ export type HighlightColorName = (typeof HIGHLIGHT_COLORS)[number]["name"];
26
+ export declare class HighlightPicker {
27
+ private popover;
28
+ private onApply;
29
+ private onRemove;
30
+ private onClose;
31
+ constructor(onApply: (color: string) => void, onRemove: () => void, onClose: () => void);
32
+ get element(): HTMLElement;
33
+ get visible(): boolean;
34
+ /**
35
+ * Show the picker positioned relative to the given anchor rect.
36
+ * Highlights the currently active color (if any).
37
+ */
38
+ show(anchorRect: DOMRect, activeColor?: string): void;
39
+ hide(): void;
40
+ destroy(): void;
41
+ }
@@ -0,0 +1,5 @@
1
+ export { InlineToolbar, TOOLBAR_BUTTONS } from "./inline-toolbar";
2
+ export type { ToolbarButton, ToolbarActionContext } from "./inline-toolbar";
3
+ export { LinkPopover } from "./link-popover";
4
+ export { HighlightPicker, HIGHLIGHT_COLORS } from "./highlight-picker";
5
+ export type { HighlightColorName } from "./highlight-picker";
@@ -0,0 +1,97 @@
1
+ import type { Attributes } from "../attributed-string/types";
2
+ /** Context passed to custom toolbar button handlers */
3
+ export interface ToolbarActionContext {
4
+ /** ID of the block containing the selection */
5
+ blockId: string;
6
+ /** Start offset of the selection within the block */
7
+ start: number;
8
+ /** End offset of the selection within the block */
9
+ end: number;
10
+ /** Attributes that are active across the entire selection */
11
+ activeAttributes: Attributes;
12
+ /** Convenience: apply or remove a single attribute on the selection */
13
+ applyAttribute: (attribute: string, active: boolean) => void;
14
+ }
15
+ /** Toolbar button configuration */
16
+ export interface ToolbarButton {
17
+ /** Unique key identifying this button */
18
+ key: string;
19
+ /** Accessible label / tooltip text */
20
+ label: string;
21
+ /**
22
+ * Button icon — either a text string or a render function.
23
+ * When a string, displayed as text with a CSS class `blx-inline-toolbar-icon-{key}`.
24
+ * When a function, called with the container element to render custom HTML.
25
+ */
26
+ icon: string | ((container: HTMLElement) => void);
27
+ /**
28
+ * Attribute to toggle (e.g. "bold", "italic").
29
+ * When set, clicking the button toggles this attribute via the standard
30
+ * applyAttributes/removeAttributes transaction flow.
31
+ * Mutually exclusive with `onAction`.
32
+ */
33
+ attribute?: string;
34
+ /**
35
+ * Custom action handler. Called when the button is clicked.
36
+ * Use this for buttons that need non-standard behavior (e.g. link input,
37
+ * color picker). Mutually exclusive with `attribute`.
38
+ */
39
+ onAction?: (context: ToolbarActionContext) => void;
40
+ /**
41
+ * Custom active-state check. When provided, this function determines
42
+ * whether the button appears pressed/active. When omitted, buttons
43
+ * with `attribute` use the standard attribute intersection check.
44
+ */
45
+ isActive?: (context: ToolbarActionContext) => boolean;
46
+ }
47
+ /** Standard inline formatting buttons */
48
+ export declare const TOOLBAR_BUTTONS: ToolbarButton[];
49
+ /**
50
+ * Floating inline toolbar that appears on text selection.
51
+ *
52
+ * Provides buttons for formatting and is extensible via `addButton()`.
53
+ * Positioned above (or below) the selection bounding rect. Dismissed on
54
+ * selection collapse, click outside, or Escape key.
55
+ */
56
+ export declare class InlineToolbar {
57
+ private popover;
58
+ private onFormat;
59
+ private onCustomAction;
60
+ private activeAttributes;
61
+ /** Built-in buttons (left group) */
62
+ private builtinButtons;
63
+ /** Plugin-added buttons (right group, after separator) */
64
+ private pluginButtons;
65
+ /** Current action context (set on show/update, used by click handlers) */
66
+ private actionContext;
67
+ constructor(onFormat: (attribute: string, active: boolean) => void, builtinButtons?: ToolbarButton[]);
68
+ get element(): HTMLElement;
69
+ get visible(): boolean;
70
+ /** Set the handler for custom (non-attribute) button actions */
71
+ setCustomActionHandler(handler: (key: string, context: ToolbarActionContext) => void): void;
72
+ /**
73
+ * Add a button to the toolbar. Plugin buttons appear after a separator.
74
+ * If a button with the same key already exists, it is replaced.
75
+ */
76
+ addButton(button: ToolbarButton): void;
77
+ /** Remove a plugin-added button by key. Returns true if found. */
78
+ removeButton(key: string): boolean;
79
+ /** Get all currently registered buttons (built-in + plugin) */
80
+ getButtons(): ReadonlyArray<ToolbarButton>;
81
+ /**
82
+ * Show the toolbar positioned relative to the given selection rect.
83
+ * Positions above the selection by default; flips below if near viewport top.
84
+ */
85
+ show(selectionRect: DOMRect, activeAttrs: Attributes, context?: ToolbarActionContext): void;
86
+ /** Reposition the toolbar to follow a new anchor rect (e.g. on scroll) */
87
+ reposition(selectionRect: DOMRect): void;
88
+ /** Update the active state of buttons without repositioning */
89
+ updateActiveAttributes(activeAttrs: Attributes, context?: ToolbarActionContext): void;
90
+ hide(): void;
91
+ destroy(): void;
92
+ /** Sync the active set from standard attributes + custom isActive checks */
93
+ private syncActiveState;
94
+ private renderButtons;
95
+ private handleButtonClick;
96
+ private updateButtonStates;
97
+ }