@owomark/core 0.1.5 → 0.1.7

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 (38) hide show
  1. package/README.md +30 -10
  2. package/dist/.build-manifest.json +130 -0
  3. package/dist/browser.d.ts +66 -0
  4. package/dist/browser.js +396 -0
  5. package/dist/chunk-3KTK7CSS.js +82 -0
  6. package/dist/chunk-5JNL3LHV.js +215 -0
  7. package/dist/chunk-ASRCHEFF.js +0 -0
  8. package/dist/chunk-BKJCBEI7.js +397 -0
  9. package/dist/chunk-CJSBFWKS.js +549 -0
  10. package/dist/chunk-GA5EFGSZ.js +5820 -0
  11. package/dist/chunk-OOH46GIF.js +95 -0
  12. package/dist/chunk-ROJILHRQ.js +192 -0
  13. package/dist/chunk-WFPUIPWU.js +34 -0
  14. package/dist/chunk-WXVKSKP3.js +191 -0
  15. package/dist/chunk-YZYJIXGO.js +0 -0
  16. package/dist/editor-core-DbPhn6aI.d.ts +249 -0
  17. package/dist/index.d.ts +77 -86
  18. package/dist/index.js +161 -245
  19. package/dist/internal/dom-adapter.d.ts +37 -1
  20. package/dist/internal/dom-adapter.js +9 -2
  21. package/dist/public-zMo7BR9l.d.ts +469 -0
  22. package/dist/registry-C849sxCo.d.ts +74 -0
  23. package/dist/semantic/components/index.d.ts +9 -0
  24. package/dist/semantic/components/index.js +11 -0
  25. package/dist/semantic/editor/index.d.ts +9 -0
  26. package/dist/semantic/editor/index.js +13 -0
  27. package/dist/semantic/index.d.ts +7 -0
  28. package/dist/semantic/index.js +106 -0
  29. package/dist/semantic/runtime/index.d.ts +9 -0
  30. package/dist/semantic/runtime/index.js +13 -0
  31. package/dist/semantic/shared/index.d.ts +10 -0
  32. package/dist/semantic/shared/index.js +17 -0
  33. package/dist/semantic/syntax/index.d.ts +151 -0
  34. package/dist/semantic/syntax/index.js +63 -0
  35. package/dist/types-DMqYF6Zn.d.ts +83 -0
  36. package/package.json +29 -1
  37. package/dist/chunk-TRLKIMRD.js +0 -3227
  38. package/dist/dom-adapter-CTSJe5Uo.d.ts +0 -469
package/dist/index.js CHANGED
@@ -1,21 +1,24 @@
1
1
  import {
2
- BLOCK_TYPE_TO_CLASS,
3
- BQ_STEP,
2
+ DEFAULT_VIEWPORT_ANCHOR_RATIO,
3
+ buildProgressSegments,
4
+ buildScrollProjectionSnapshot,
5
+ projectToScrollSegments,
6
+ resolveScrollPosition,
7
+ resolveScrollTopFromPosition
8
+ } from "./chunk-5JNL3LHV.js";
9
+ import {
10
+ CARDS_FAMILY_CUSTOM_BLOCK_KEY,
4
11
  NOT_HANDLED,
5
- SIDE_ANNOTATION_TAIL_RE,
6
- SIDE_CONTINUATION_TAIL_RE,
7
- TOKEN_TO_CLASS,
8
12
  applyMarkdownIndent,
9
- buildBlockquoteBarsBoxShadow,
10
- createBlockElement,
13
+ buildConformanceDocument,
14
+ buildConformanceMdastRoot,
15
+ cardsFamilyContainerExtension,
16
+ computePreviewDirtyRange,
11
17
  createBlockIdGenerator,
12
18
  createCommandRegistry,
19
+ createDelimitedInlineExtension,
13
20
  createOwoMarkCore,
14
- detectAndRenderDirty,
15
- domRangeToOffset,
16
- expandDirtyRange,
17
- expandWithContext,
18
- fullRender,
21
+ deriveRenderKey,
19
22
  getBlockAtOffset,
20
23
  getBlockById,
21
24
  getBlockIndexById,
@@ -25,35 +28,53 @@ import {
25
28
  handleMarkdownEnter,
26
29
  handleSmartBackspace,
27
30
  handleSmartDelete,
31
+ hydrateOwoMarkDocument,
28
32
  insertCodeFence,
29
33
  insertImage,
30
34
  insertLink,
31
35
  insertMathBlock,
32
36
  insertSideAnnotation,
33
37
  insertTable,
34
- invalidateBlockCache,
38
+ isCardsFamilyAttributes,
35
39
  isVirtualSelectionCollapsed,
36
40
  linearToVirtual,
37
41
  linearToVirtualPosition,
38
- offsetToDomRange,
39
42
  parseMarkdownToDocument,
40
- patchDirtyBlocks,
41
- readSelection,
43
+ projectToPreviewBlocks,
42
44
  reconcileBlocks,
43
45
  resetBlockIdCounter,
44
46
  resolveBlockContextType,
45
47
  resolveIndentSize,
46
- restoreSelection,
47
48
  serializeDocument,
48
49
  toggleBold,
49
50
  toggleItalic,
50
51
  tokenizeBlock,
51
52
  tokenizeInline,
52
- updateBlockElement,
53
53
  virtualPositionToLinear,
54
54
  virtualPositionsEqual,
55
55
  virtualToLinear
56
- } from "./chunk-TRLKIMRD.js";
56
+ } from "./chunk-GA5EFGSZ.js";
57
+ import {
58
+ deriveBlockId,
59
+ deriveSourceKey,
60
+ expandDirtyRange,
61
+ expandWithContext
62
+ } from "./chunk-WFPUIPWU.js";
63
+ import "./chunk-YZYJIXGO.js";
64
+ import "./chunk-ASRCHEFF.js";
65
+ import {
66
+ getRuntimeBlockDescriptor,
67
+ getRuntimeBlockDescriptorByBlockType,
68
+ getRuntimeBlockDescriptorByPreviewKind,
69
+ runtimeBlockRegistry
70
+ } from "./chunk-ROJILHRQ.js";
71
+ import {
72
+ getSyntaxDescriptor,
73
+ parseInlineSideAnnotationFromText,
74
+ stripInlineSideAnnotationTail,
75
+ stripSideContinuationTail,
76
+ syntaxRegistry
77
+ } from "./chunk-BKJCBEI7.js";
57
78
  import {
58
79
  normalizeMarkdownPaste
59
80
  } from "./chunk-BGXCXQZP.js";
@@ -63,216 +84,55 @@ import {
63
84
  deleteWordBackward,
64
85
  deleteWordForward
65
86
  } from "./chunk-MPIWZLI3.js";
87
+ import {
88
+ componentRegistry,
89
+ getComponentDescriptor,
90
+ getComponentDescriptorByDirective
91
+ } from "./chunk-WXVKSKP3.js";
92
+ import {
93
+ editorEntryRegistry,
94
+ getEditorEntryDescriptor,
95
+ getEditorEntryDescriptorByCommandId,
96
+ resolveEditorEntryPresentation
97
+ } from "./chunk-3KTK7CSS.js";
98
+ import "./chunk-OOH46GIF.js";
66
99
 
67
- // src/preview/block-id.ts
68
- function deriveBlockId(renderKey, occurrenceIndex) {
69
- return `${renderKey}#${occurrenceIndex}`;
70
- }
71
- function deriveSourceKey(startLine, endLine) {
72
- return `L${startLine}-${endLine}`;
73
- }
74
-
75
- // src/preview/render-key.ts
76
- function djb2(input) {
77
- let hash = 5381;
78
- for (let i = 0; i < input.length; i++) {
79
- hash = (hash << 5) + hash ^ input.charCodeAt(i);
80
- }
81
- return (hash >>> 0).toString(36);
82
- }
83
- function deriveRenderKey(raw, kind, themeKey) {
84
- const src = `${kind}:${themeKey ?? ""}:${raw}`;
85
- return djb2(src);
86
- }
87
-
88
- // src/preview/projection.ts
89
- var BLOCK_TYPE_TO_KIND = {
90
- "paragraph": "paragraph",
91
- "heading": "heading",
92
- "unordered-list": "unordered-list",
93
- "ordered-list": "ordered-list",
94
- "blockquote": "blockquote",
95
- "code-fence": "code-fence",
96
- "directive-container": "custom",
97
- "thematic-break": "thematic-break",
98
- "math-block": "math-block",
99
- "table": "table"
100
- };
101
- function blockTypeToPreviewKind(node) {
102
- return BLOCK_TYPE_TO_KIND[node.type];
103
- }
104
- function isGroupableType(type) {
105
- return type === "unordered-list" || type === "ordered-list" || type === "blockquote";
106
- }
107
- function countLines(raw) {
108
- let count = 1;
109
- for (let i = 0; i < raw.length; i++) {
110
- if (raw.charCodeAt(i) === 10) count++;
111
- }
112
- return count;
113
- }
114
- function isBlankParagraph(block) {
115
- return block.type === "paragraph" && !block.raw.trim();
116
- }
117
- function isSideAnnotationHead(block) {
118
- return block.type === "paragraph" && SIDE_ANNOTATION_TAIL_RE.test(block.raw);
119
- }
120
- function isSideAnnotationContinuation(block) {
121
- return block.type === "paragraph" && SIDE_CONTINUATION_TAIL_RE.test(block.raw);
122
- }
123
- function collectSideAnnotationChain(blocks, startIndex) {
124
- if (!isSideAnnotationHead(blocks[startIndex])) return null;
125
- const rawParts = [blocks[startIndex].raw];
126
- let endIndex = startIndex;
127
- let endLine = 0;
128
- let currentLine = 0;
129
- let foundContinuation = false;
130
- let i = startIndex + 1;
131
- while (i < blocks.length) {
132
- const block = blocks[i];
133
- if (isBlankParagraph(block)) {
134
- const next = blocks[i + 1];
135
- if (!next || !isSideAnnotationContinuation(next)) break;
136
- rawParts.push(block.raw, next.raw);
137
- endIndex = i + 1;
138
- i += 2;
139
- foundContinuation = true;
140
- continue;
141
- }
142
- if (isSideAnnotationContinuation(block)) {
143
- rawParts.push(block.raw);
144
- endIndex = i;
145
- i++;
146
- foundContinuation = true;
147
- continue;
148
- }
149
- break;
150
- }
151
- if (!foundContinuation) return null;
152
- for (let j = startIndex; j <= endIndex; j++) {
153
- currentLine += countLines(blocks[j].raw);
154
- }
155
- endLine = currentLine - 1;
156
- return {
157
- endIndex,
158
- raw: rawParts.join("\n"),
159
- endLine
160
- };
161
- }
162
- function projectToPreviewBlocks(doc, themeKey, transforms) {
163
- const result = [];
164
- const blocks = doc.blocks;
165
- const occurrenceCounter = /* @__PURE__ */ new Map();
166
- let currentLine = 1;
167
- let i = 0;
168
- while (i < blocks.length) {
169
- const block = blocks[i];
170
- const blockLines = countLines(block.raw);
171
- const startLine = currentLine;
172
- const sideChain = collectSideAnnotationChain(blocks, i);
173
- if (sideChain) {
174
- const endLine2 = startLine + sideChain.endLine;
175
- const renderKey2 = deriveRenderKey(sideChain.raw, "paragraph", themeKey);
176
- const occurrence2 = occurrenceCounter.get(renderKey2) ?? 0;
177
- occurrenceCounter.set(renderKey2, occurrence2 + 1);
178
- result.push({
179
- blockId: deriveBlockId(renderKey2, occurrence2),
180
- kind: "paragraph",
181
- raw: sideChain.raw,
182
- startLine,
183
- endLine: endLine2,
184
- renderKey: renderKey2
185
- });
186
- currentLine = endLine2 + 1;
187
- i = sideChain.endIndex + 1;
188
- continue;
189
- }
190
- if (isBlankParagraph(block)) {
191
- currentLine += blockLines;
192
- i++;
193
- continue;
194
- }
195
- if (isGroupableType(block.type)) {
196
- const groupType = block.type;
197
- const groupRawParts = [block.raw];
198
- let endLine2 = startLine + blockLines - 1;
199
- let j = i + 1;
200
- while (j < blocks.length && blocks[j].type === groupType) {
201
- const nextLines = countLines(blocks[j].raw);
202
- endLine2 += nextLines;
203
- groupRawParts.push(blocks[j].raw);
204
- j++;
205
- }
206
- const raw = groupRawParts.join("\n");
207
- const kind2 = blockTypeToPreviewKind(block);
208
- const renderKey2 = deriveRenderKey(raw, kind2, themeKey);
209
- const occurrence2 = occurrenceCounter.get(renderKey2) ?? 0;
210
- occurrenceCounter.set(renderKey2, occurrence2 + 1);
211
- result.push({
212
- blockId: deriveBlockId(renderKey2, occurrence2),
213
- kind: kind2,
214
- raw,
215
- startLine,
216
- endLine: endLine2,
217
- renderKey: renderKey2
218
- });
219
- currentLine = endLine2 + 1;
220
- i = j;
221
- continue;
222
- }
223
- const endLine = startLine + blockLines - 1;
224
- const kind = blockTypeToPreviewKind(block);
225
- const renderKey = deriveRenderKey(block.raw, kind, themeKey);
226
- const occurrence = occurrenceCounter.get(renderKey) ?? 0;
227
- occurrenceCounter.set(renderKey, occurrence + 1);
228
- const previewBlock = {
229
- blockId: deriveBlockId(renderKey, occurrence),
230
- kind,
231
- raw: block.raw,
232
- startLine,
233
- endLine,
234
- renderKey
235
- };
236
- if (block.type === "code-fence") {
237
- previewBlock.language = block.language || null;
238
- }
239
- if (block.type === "heading") {
240
- previewBlock.headingLevel = block.headingLevel;
241
- }
242
- result.push(previewBlock);
243
- currentLine = endLine + 1;
244
- i++;
245
- }
246
- if (!transforms || transforms.length === 0) return result;
247
- return result.map((block) => {
248
- let b = block;
249
- for (const transform of transforms) {
250
- b = transform(b);
251
- }
252
- return b;
253
- });
254
- }
255
- function blocksMatch(a, b) {
256
- return a.blockId === b.blockId;
257
- }
258
- function computePreviewDirtyRange(oldBlocks, newBlocks) {
259
- const oldLen = oldBlocks.length;
260
- const newLen = newBlocks.length;
261
- const minLen = Math.min(oldLen, newLen);
262
- let start = 0;
263
- while (start < minLen && blocksMatch(oldBlocks[start], newBlocks[start])) {
264
- start++;
265
- }
266
- let oldEnd = oldLen - 1;
267
- let newEnd = newLen - 1;
268
- while (oldEnd >= start && newEnd >= start && blocksMatch(oldBlocks[oldEnd], newBlocks[newEnd])) {
269
- oldEnd--;
270
- newEnd--;
271
- }
272
- const end = Math.max(oldEnd, newEnd);
273
- if (start > end) return null;
274
- return { startBlock: start, endBlock: Math.min(end, newLen - 1) };
275
- }
100
+ // src/types/public.ts
101
+ var INLINE_TOKEN_TYPES = [
102
+ "text",
103
+ "strong-marker",
104
+ "strong",
105
+ "emphasis-marker",
106
+ "emphasis",
107
+ "custom-inline-marker",
108
+ "custom-inline",
109
+ "code-marker",
110
+ "code",
111
+ "link-bracket",
112
+ "link-text",
113
+ "link-url",
114
+ "reference-bracket",
115
+ "reference-label",
116
+ "image-marker",
117
+ "image-alt",
118
+ "image-url",
119
+ "heading-marker",
120
+ "list-marker",
121
+ "task-marker",
122
+ "task-marker-checked",
123
+ "table-separator",
124
+ "blockquote-marker",
125
+ "fence-marker",
126
+ "fence-lang",
127
+ "code-block-text",
128
+ "strikethrough-marker",
129
+ "strikethrough",
130
+ "math-marker",
131
+ "math-text",
132
+ "hr",
133
+ "html"
134
+ ];
135
+ var CLASSLESS_INLINE_TOKEN_TYPES = ["text"];
276
136
 
277
137
  // src/state/shared-state.ts
278
138
  function createInitialState(markdown, themeKey, transforms) {
@@ -287,6 +147,8 @@ function createInitialState(markdown, themeKey, transforms) {
287
147
  compositionActive: false,
288
148
  visibleBlockIds: [],
289
149
  version: 1,
150
+ contentVersion: 1,
151
+ uiVersion: 1,
290
152
  markdown
291
153
  };
292
154
  }
@@ -297,10 +159,17 @@ function createSharedStateStore(options) {
297
159
  let editor = null;
298
160
  let editorUnsubs = [];
299
161
  const listeners = /* @__PURE__ */ new Set();
162
+ const selectorListeners = /* @__PURE__ */ new Set();
300
163
  function notify() {
301
164
  for (const listener of listeners) {
302
165
  listener(state);
303
166
  }
167
+ for (const subscription of selectorListeners) {
168
+ const nextSelected = subscription.selector(state);
169
+ if (subscription.isEqual(subscription.lastSelected, nextSelected)) continue;
170
+ subscription.lastSelected = nextSelected;
171
+ subscription.listener(nextSelected, state);
172
+ }
304
173
  }
305
174
  function updateFromMarkdown(markdown, reason) {
306
175
  const oldBlocks = state.previewBlocks;
@@ -324,6 +193,8 @@ function createSharedStateStore(options) {
324
193
  compositionActive: state.compositionActive,
325
194
  visibleBlockIds: state.visibleBlockIds,
326
195
  version: state.version + 1,
196
+ contentVersion: state.contentVersion + 1,
197
+ uiVersion: state.uiVersion,
327
198
  markdown
328
199
  };
329
200
  notify();
@@ -335,7 +206,8 @@ function createSharedStateStore(options) {
335
206
  previewBlocks,
336
207
  dirtyRange: previewBlocks.length > 0 ? { startBlock: 0, endBlock: previewBlocks.length - 1 } : null,
337
208
  dirtyReason: reason,
338
- version: state.version + 1
209
+ version: state.version + 1,
210
+ contentVersion: state.contentVersion + 1
339
211
  };
340
212
  notify();
341
213
  }
@@ -346,11 +218,19 @@ function createSharedStateStore(options) {
346
218
  updateFromMarkdown(markdown, "text-edit");
347
219
  });
348
220
  const unsubSelection = instance.onSelectionChange((selection) => {
349
- state = { ...state, selection, version: state.version + 1 };
221
+ state = {
222
+ ...state,
223
+ selection,
224
+ uiVersion: state.uiVersion + 1
225
+ };
350
226
  notify();
351
227
  });
352
228
  const unsubComposition = instance.onCompositionStateChange((active) => {
353
- state = { ...state, compositionActive: active, version: state.version + 1 };
229
+ state = {
230
+ ...state,
231
+ compositionActive: active,
232
+ uiVersion: state.uiVersion + 1
233
+ };
354
234
  notify();
355
235
  });
356
236
  editorUnsubs = [unsubChange, unsubSelection, unsubComposition];
@@ -373,6 +253,18 @@ function createSharedStateStore(options) {
373
253
  listeners.add(listener);
374
254
  return () => listeners.delete(listener);
375
255
  },
256
+ subscribeWithSelector(selector, listener, isEqual = Object.is) {
257
+ const subscription = {
258
+ selector,
259
+ listener,
260
+ isEqual,
261
+ lastSelected: selector(state)
262
+ };
263
+ selectorListeners.add(subscription);
264
+ return () => {
265
+ selectorListeners.delete(subscription);
266
+ };
267
+ },
376
268
  setMarkdown(markdown) {
377
269
  if (editor) {
378
270
  editor.setMarkdown(markdown);
@@ -530,6 +422,13 @@ function estimateEditorBlockHeight(block, charsPerLine = 80) {
530
422
  const lineCount = countNewlines(block.raw) + 1;
531
423
  return lineCount * lineHeight + FENCED_BLOCK_PADDING;
532
424
  }
425
+ case "side-annotation":
426
+ case "side-note-definition":
427
+ case "directive-container":
428
+ case "custom-block": {
429
+ const lineCount = countNewlines(block.raw) + 1;
430
+ return lineCount * lineHeight + FENCED_BLOCK_PADDING;
431
+ }
533
432
  case "table": {
534
433
  const lineCount = countNewlines(block.raw) + 1;
535
434
  return lineCount * lineHeight + TABLE_BLOCK_PADDING;
@@ -588,18 +487,24 @@ function computeVisibleRange(rows, scrollTop, viewportHeight, overscan = 5) {
588
487
  return { startIndex, endIndex, totalHeight, offsetTop, offsetBottom };
589
488
  }
590
489
  export {
591
- BLOCK_TYPE_TO_CLASS,
592
- BQ_STEP,
490
+ CARDS_FAMILY_CUSTOM_BLOCK_KEY,
491
+ CLASSLESS_INLINE_TOKEN_TYPES,
492
+ DEFAULT_VIEWPORT_ANCHOR_RATIO,
493
+ INLINE_TOKEN_TYPES,
593
494
  NOT_HANDLED,
594
- TOKEN_TO_CLASS,
595
495
  applyMarkdownIndent,
596
- buildBlockquoteBarsBoxShadow,
496
+ buildConformanceDocument,
497
+ buildConformanceMdastRoot,
498
+ buildProgressSegments,
499
+ buildScrollProjectionSnapshot,
597
500
  buildVirtualRows,
501
+ cardsFamilyContainerExtension,
502
+ componentRegistry,
598
503
  computePreviewDirtyRange,
599
504
  computeVisibleRange,
600
- createBlockElement,
601
505
  createBlockIdGenerator,
602
506
  createCommandRegistry,
507
+ createDelimitedInlineExtension,
603
508
  createImageSizeTransform,
604
509
  createOwoMarkCore,
605
510
  createSharedStateStore,
@@ -610,50 +515,61 @@ export {
610
515
  deriveBlockId,
611
516
  deriveRenderKey,
612
517
  deriveSourceKey,
613
- detectAndRenderDirty,
614
- domRangeToOffset,
518
+ editorEntryRegistry,
615
519
  enableMapSet,
616
520
  estimateEditorBlockHeight,
617
521
  expandDirtyRange,
618
522
  expandWithContext,
619
- fullRender,
620
523
  getBlockAtOffset,
621
524
  getBlockById,
622
525
  getBlockIndexById,
623
526
  getBlockIndexForPosition,
624
527
  getBlockStartOffset,
528
+ getComponentDescriptor,
529
+ getComponentDescriptorByDirective,
530
+ getEditorEntryDescriptor,
531
+ getEditorEntryDescriptorByCommandId,
532
+ getRuntimeBlockDescriptor,
533
+ getRuntimeBlockDescriptorByBlockType,
534
+ getRuntimeBlockDescriptorByPreviewKind,
535
+ getSyntaxDescriptor,
625
536
  handleCharInput,
626
537
  handleMarkdownEnter,
627
538
  handleSmartBackspace,
628
539
  handleSmartDelete,
540
+ hydrateOwoMarkDocument,
629
541
  insertCodeFence,
630
542
  insertImage,
631
543
  insertLink,
632
544
  insertMathBlock,
633
545
  insertSideAnnotation,
634
546
  insertTable,
635
- invalidateBlockCache,
547
+ isCardsFamilyAttributes,
636
548
  isVirtualSelectionCollapsed,
637
549
  linearToVirtual,
638
550
  linearToVirtualPosition,
639
551
  normalizeMarkdownPaste,
640
- offsetToDomRange,
552
+ parseInlineSideAnnotationFromText,
641
553
  parseMarkdownToDocument,
642
- patchDirtyBlocks,
643
554
  produce,
644
555
  projectToPreviewBlocks,
645
- readSelection,
556
+ projectToScrollSegments,
646
557
  reconcileBlocks,
647
558
  resetBlockIdCounter,
648
559
  resolveBlockContextType,
560
+ resolveEditorEntryPresentation,
649
561
  resolveIndentSize,
650
- restoreSelection,
562
+ resolveScrollPosition,
563
+ resolveScrollTopFromPosition,
564
+ runtimeBlockRegistry,
651
565
  serializeDocument,
566
+ stripInlineSideAnnotationTail,
567
+ stripSideContinuationTail,
568
+ syntaxRegistry,
652
569
  toggleBold,
653
570
  toggleItalic,
654
571
  tokenizeBlock,
655
572
  tokenizeInline,
656
- updateBlockElement,
657
573
  virtualPositionToLinear,
658
574
  virtualPositionsEqual,
659
575
  virtualToLinear
@@ -1 +1,37 @@
1
- export { v as DocumentChangeCallback, w as DomAdapterInstance, a6 as createDomAdapter } from '../dom-adapter-CTSJe5Uo.js';
1
+ import { O as OwoMarkSelection, a as OwoMarkDocument, V as VirtualSelection } from '../public-zMo7BR9l.js';
2
+ import { O as OwoMarkCore } from '../editor-core-DbPhn6aI.js';
3
+ export { D as DocumentChangeCallback } from '../editor-core-DbPhn6aI.js';
4
+
5
+ type OwoMarkEditorInstance = {
6
+ mount(root: HTMLElement): void;
7
+ destroy(): void;
8
+ getMarkdown(): string;
9
+ setMarkdown(markdown: string): void;
10
+ replaceMarkdown(markdown: string, selection: OwoMarkSelection): void;
11
+ getSelection(): OwoMarkSelection | null;
12
+ getDocument(): OwoMarkDocument;
13
+ focus(): void;
14
+ dispatch(command: string, payload?: unknown): void;
15
+ setIndentMode(mode: 'auto' | '2' | '4'): void;
16
+ onChange(callback: (markdown: string) => void): () => void;
17
+ onSelectionChange(callback: (selection: OwoMarkSelection) => void): () => void;
18
+ onCompositionStateChange(callback: (active: boolean) => void): () => void;
19
+ onDocumentChange(callback: (doc: OwoMarkDocument, selection: VirtualSelection) => void): () => void;
20
+ };
21
+
22
+ /**
23
+ * Shared DOM adapter factory.
24
+ *
25
+ * Contains the full DOM event binding, imperative rendering, and
26
+ * selection management logic. Consumed by `@owomark/view`.
27
+ *
28
+ * @internal Not part of the public API — consumed only by adapter wrappers.
29
+ */
30
+
31
+ type DomAdapterInstance = OwoMarkEditorInstance & {
32
+ /** Internal escape hatch for @owomark/view wrappers. */
33
+ getCore(): OwoMarkCore;
34
+ };
35
+ declare function createDomAdapter(): DomAdapterInstance;
36
+
37
+ export { type DomAdapterInstance, createDomAdapter };
@@ -1,12 +1,19 @@
1
1
  import {
2
- createOwoMarkCore,
3
2
  detectAndRenderDirty,
4
3
  fullRender,
5
4
  readSelection,
6
5
  restoreSelection
7
- } from "../chunk-TRLKIMRD.js";
6
+ } from "../chunk-CJSBFWKS.js";
7
+ import {
8
+ createOwoMarkCore
9
+ } from "../chunk-GA5EFGSZ.js";
10
+ import "../chunk-WFPUIPWU.js";
11
+ import "../chunk-ROJILHRQ.js";
12
+ import "../chunk-BKJCBEI7.js";
8
13
  import "../chunk-BGXCXQZP.js";
9
14
  import "../chunk-MPIWZLI3.js";
15
+ import "../chunk-3KTK7CSS.js";
16
+ import "../chunk-OOH46GIF.js";
10
17
 
11
18
  // src/internal/dom-adapter.ts
12
19
  function createDomAdapter() {