@owomark/core 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +9 -5
- package/dist/browser.js +3 -1
- package/dist/{chunk-WVGCRIJO.js → chunk-WV2K5MNU.js} +57 -15
- package/dist/{chunk-CJSBFWKS.js → chunk-YS3HGP3M.js} +38 -38
- package/dist/{editor-core-BSoeizSI.d.ts → editor-core-edBvPqBi.d.ts} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +1 -1
- package/dist/internal/dom-adapter.d.ts +3 -3
- package/dist/internal/dom-adapter.js +2 -2
- package/dist/{public-cCK3rvQc.d.ts → public-BjF6yWIR.d.ts} +1 -1
- package/dist/{registry-6IkGJsLt.d.ts → registry-DI94xf3v.d.ts} +1 -1
- package/dist/semantic/components/index.d.ts +3 -3
- package/dist/semantic/editor/index.d.ts +2 -2
- package/dist/semantic/index.d.ts +2 -2
- package/dist/semantic/runtime/index.d.ts +2 -2
- package/dist/semantic/shared/index.d.ts +3 -3
- package/dist/semantic/syntax/index.d.ts +2 -2
- package/dist/{types-BdOo-u1R.d.ts → types-0QKyuzQy.d.ts} +1 -1
- package/package.json +1 -1
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OwoMarkSelection, a as OwoMarkDocument, D as DirtyRange, I as InlineTokenType, e as InlineToken, f as PreviewBlock } from './public-
|
|
2
|
-
import { O as OwoMarkScrollProjectionSnapshot, a as OwoMarkSurfaceGeometrySnapshot, b as OwoMarkScrollController } from './types-
|
|
1
|
+
import { O as OwoMarkSelection, a as OwoMarkDocument, D as DirtyRange, I as InlineTokenType, e as InlineToken, f as ContainerFrame, g as PreviewBlock } from './public-BjF6yWIR.js';
|
|
2
|
+
import { O as OwoMarkScrollProjectionSnapshot, a as OwoMarkSurfaceGeometrySnapshot, b as OwoMarkScrollController } from './types-0QKyuzQy.js';
|
|
3
3
|
|
|
4
4
|
declare function invalidateBlockCache(root: HTMLElement): void;
|
|
5
5
|
|
|
@@ -41,12 +41,12 @@ declare function detectAndRenderDirty(root: HTMLElement, oldDoc: OwoMarkDocument
|
|
|
41
41
|
declare const TOKEN_CLASS_EXEMPTIONS: Set<"text" | "strong-marker" | "strong" | "emphasis-marker" | "emphasis" | "custom-inline-marker" | "custom-inline" | "code-marker" | "code" | "link-bracket" | "link-text" | "link-url" | "reference-bracket" | "reference-label" | "image-marker" | "image-alt" | "image-url" | "heading-marker" | "list-marker" | "task-marker" | "task-marker-checked" | "table-separator" | "blockquote-marker" | "fence-marker" | "fence-lang" | "code-block-text" | "strikethrough-marker" | "strikethrough" | "math-marker" | "math-text" | "hr" | "html">;
|
|
42
42
|
declare const TOKEN_TO_CLASS: Record<InlineTokenType, string>;
|
|
43
43
|
declare const BLOCK_TYPE_TO_CLASS: Record<string, string>;
|
|
44
|
-
declare function createBlockElement(doc: Document, tokens: InlineToken[], blockIndex: number, blockType: string, headingLevel?: number, depth?: number): HTMLDivElement;
|
|
44
|
+
declare function createBlockElement(doc: Document, tokens: InlineToken[], blockIndex: number, blockType: string, headingLevel?: number, depth?: number, ancestry?: readonly ContainerFrame[]): HTMLDivElement;
|
|
45
45
|
/**
|
|
46
46
|
* Update an existing block element's content with new tokens.
|
|
47
47
|
* Returns true if the block was modified.
|
|
48
48
|
*/
|
|
49
|
-
declare function updateBlockElement(doc: Document, existing: HTMLDivElement, tokens: InlineToken[], blockType: string, headingLevel?: number, depth?: number): boolean;
|
|
49
|
+
declare function updateBlockElement(doc: Document, existing: HTMLDivElement, tokens: InlineToken[], blockType: string, headingLevel?: number, depth?: number, ancestry?: readonly ContainerFrame[]): boolean;
|
|
50
50
|
|
|
51
51
|
declare const BQ_STEP: number;
|
|
52
52
|
/**
|
|
@@ -54,6 +54,10 @@ declare const BQ_STEP: number;
|
|
|
54
54
|
* Returns null when depth <= 1 (no extra bars needed — the first bar is
|
|
55
55
|
* rendered by the block's own border/class styling).
|
|
56
56
|
*/
|
|
57
|
+
declare function getBlockquoteDepthFromAncestry(ancestry: readonly {
|
|
58
|
+
kind: string;
|
|
59
|
+
depth: number;
|
|
60
|
+
}[]): number;
|
|
57
61
|
declare function buildBlockquoteBarsBoxShadow(depth: number): string | null;
|
|
58
62
|
|
|
59
63
|
declare function measureEditorSurfaceGeometry(projection: OwoMarkScrollProjectionSnapshot, editorRoot: HTMLElement, _body?: string): OwoMarkSurfaceGeometrySnapshot;
|
|
@@ -63,4 +67,4 @@ declare function createScrollController(): OwoMarkScrollController & {
|
|
|
63
67
|
updateProjection(previewBlocks: readonly PreviewBlock[], documentRevision: number): void;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
|
-
export { BLOCK_TYPE_TO_CLASS, BQ_STEP, TOKEN_CLASS_EXEMPTIONS, TOKEN_TO_CLASS, buildBlockquoteBarsBoxShadow, createBlockElement, createScrollController, detectAndRenderDirty, domRangeToOffset, fullRender, invalidateBlockCache, measureEditorSurfaceGeometry, measurePreviewSurfaceGeometry, offsetToDomRange, patchDirtyBlocks, readSelection, restoreSelection, updateBlockElement };
|
|
70
|
+
export { BLOCK_TYPE_TO_CLASS, BQ_STEP, TOKEN_CLASS_EXEMPTIONS, TOKEN_TO_CLASS, buildBlockquoteBarsBoxShadow, createBlockElement, createScrollController, detectAndRenderDirty, domRangeToOffset, fullRender, getBlockquoteDepthFromAncestry, invalidateBlockCache, measureEditorSurfaceGeometry, measurePreviewSurfaceGeometry, offsetToDomRange, patchDirtyBlocks, readSelection, restoreSelection, updateBlockElement };
|
package/dist/browser.js
CHANGED
|
@@ -14,13 +14,14 @@ import {
|
|
|
14
14
|
detectAndRenderDirty,
|
|
15
15
|
domRangeToOffset,
|
|
16
16
|
fullRender,
|
|
17
|
+
getBlockquoteDepthFromAncestry,
|
|
17
18
|
invalidateBlockCache,
|
|
18
19
|
offsetToDomRange,
|
|
19
20
|
patchDirtyBlocks,
|
|
20
21
|
readSelection,
|
|
21
22
|
restoreSelection,
|
|
22
23
|
updateBlockElement
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YS3HGP3M.js";
|
|
24
25
|
import {
|
|
25
26
|
deriveSourceKey
|
|
26
27
|
} from "./chunk-WFPUIPWU.js";
|
|
@@ -385,6 +386,7 @@ export {
|
|
|
385
386
|
detectAndRenderDirty,
|
|
386
387
|
domRangeToOffset,
|
|
387
388
|
fullRender,
|
|
389
|
+
getBlockquoteDepthFromAncestry,
|
|
388
390
|
invalidateBlockCache,
|
|
389
391
|
measureEditorSurfaceGeometry,
|
|
390
392
|
measurePreviewSurfaceGeometry,
|
|
@@ -470,6 +470,25 @@ function matchDelimitedRange(raw, index, baseOffset, delimiter, markerType, cont
|
|
|
470
470
|
]
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
+
function matchDisplayMathInline(raw, index, baseOffset) {
|
|
474
|
+
if (raw[index] !== "$" || raw[index + 1] !== "$" || isEscaped(raw, index)) return null;
|
|
475
|
+
const contentStart = index + 2;
|
|
476
|
+
if (contentStart >= raw.length) return null;
|
|
477
|
+
for (let cursor = contentStart; cursor < raw.length - 1; cursor += 1) {
|
|
478
|
+
if (raw[cursor] === "$" && raw[cursor + 1] === "$" && !isEscaped(raw, cursor)) {
|
|
479
|
+
if (cursor === contentStart) return null;
|
|
480
|
+
return {
|
|
481
|
+
end: cursor + 2,
|
|
482
|
+
tokens: [
|
|
483
|
+
tok("math-marker", "$$", baseOffset + index),
|
|
484
|
+
tok("math-text", raw.slice(contentStart, cursor), baseOffset + contentStart),
|
|
485
|
+
tok("math-marker", "$$", baseOffset + cursor)
|
|
486
|
+
]
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
return null;
|
|
491
|
+
}
|
|
473
492
|
function matchInlineMath(raw, index, baseOffset) {
|
|
474
493
|
if (raw[index] !== "$" || isEscaped(raw, index)) return null;
|
|
475
494
|
if (raw[index + 1] === "$") return null;
|
|
@@ -565,7 +584,7 @@ function tryMatch(raw, index, baseOffset, extensions, options) {
|
|
|
565
584
|
return match;
|
|
566
585
|
}
|
|
567
586
|
}
|
|
568
|
-
return matchCodeSpan(raw, index, baseOffset) ?? resolvePriorityMatch(raw, index, baseOffset, extensions, "before-link", blockType) ?? matchLinkLike(raw, index, baseOffset, true, options) ?? matchLinkLike(raw, index, baseOffset, false, options) ?? matchDelimitedRange(raw, index, baseOffset, "~~", "strikethrough-marker", "strikethrough") ?? matchInlineMath(raw, index, baseOffset) ?? matchHtml(raw, index, baseOffset) ?? resolvePriorityMatch(raw, index, baseOffset, extensions, "before-emphasis", blockType) ?? matchStrong(raw, index, baseOffset) ?? matchEmphasis(raw, index, baseOffset);
|
|
587
|
+
return matchCodeSpan(raw, index, baseOffset) ?? resolvePriorityMatch(raw, index, baseOffset, extensions, "before-link", blockType) ?? matchLinkLike(raw, index, baseOffset, true, options) ?? matchLinkLike(raw, index, baseOffset, false, options) ?? matchDelimitedRange(raw, index, baseOffset, "~~", "strikethrough-marker", "strikethrough") ?? matchDisplayMathInline(raw, index, baseOffset) ?? matchInlineMath(raw, index, baseOffset) ?? matchHtml(raw, index, baseOffset) ?? resolvePriorityMatch(raw, index, baseOffset, extensions, "before-emphasis", blockType) ?? matchStrong(raw, index, baseOffset) ?? matchEmphasis(raw, index, baseOffset);
|
|
569
588
|
}
|
|
570
589
|
function resolvePriorityMatch(raw, index, baseOffset, extensions, priority, blockType) {
|
|
571
590
|
for (const matcher of resolveExtensionMatchers(extensions, priority, blockType)) {
|
|
@@ -1861,7 +1880,39 @@ function tokensToDecorators(tokens, raw, baseOffset) {
|
|
|
1861
1880
|
}
|
|
1862
1881
|
return decorators;
|
|
1863
1882
|
}
|
|
1864
|
-
function
|
|
1883
|
+
function emitPrefixTokens(prefixText, start, ancestry) {
|
|
1884
|
+
if (!prefixText) return [];
|
|
1885
|
+
const hasBqAncestry = ancestry.some((f) => f.kind === "blockquote");
|
|
1886
|
+
if (hasBqAncestry) {
|
|
1887
|
+
const bqMatch = prefixText.match(/^((?:>\s?)+)/);
|
|
1888
|
+
if (bqMatch) {
|
|
1889
|
+
const markerText = bqMatch[1];
|
|
1890
|
+
const tokens = [{
|
|
1891
|
+
type: "blockquote-marker",
|
|
1892
|
+
text: markerText,
|
|
1893
|
+
start,
|
|
1894
|
+
end: start + markerText.length
|
|
1895
|
+
}];
|
|
1896
|
+
if (markerText.length < prefixText.length) {
|
|
1897
|
+
const rest = prefixText.slice(markerText.length);
|
|
1898
|
+
tokens.push({
|
|
1899
|
+
type: "text",
|
|
1900
|
+
text: rest,
|
|
1901
|
+
start: start + markerText.length,
|
|
1902
|
+
end: start + prefixText.length
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
return tokens;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
return [{
|
|
1909
|
+
type: "text",
|
|
1910
|
+
text: prefixText,
|
|
1911
|
+
start,
|
|
1912
|
+
end: start + prefixText.length
|
|
1913
|
+
}];
|
|
1914
|
+
}
|
|
1915
|
+
function buildStructuredDecorators(lines, blockType, baseOffset, options, ancestry = []) {
|
|
1865
1916
|
if (lines.length === 1 && lines[0].prefixLength === 0 && lines[0].raw === lines[0].syntax) {
|
|
1866
1917
|
return tokensToDecorators(tokenizeBlock(lines[0].raw, blockType, baseOffset, options), lines[0].raw, baseOffset);
|
|
1867
1918
|
}
|
|
@@ -1875,12 +1926,7 @@ function buildStructuredDecorators(lines, blockType, baseOffset, options) {
|
|
|
1875
1926
|
rawCursor += 1;
|
|
1876
1927
|
}
|
|
1877
1928
|
if (line.prefixLength > 0) {
|
|
1878
|
-
tokens.push(
|
|
1879
|
-
type: "text",
|
|
1880
|
-
text: line.raw.slice(0, line.prefixLength),
|
|
1881
|
-
start: rawCursor,
|
|
1882
|
-
end: rawCursor + line.prefixLength
|
|
1883
|
-
});
|
|
1929
|
+
tokens.push(...emitPrefixTokens(line.raw.slice(0, line.prefixLength), rawCursor, ancestry));
|
|
1884
1930
|
}
|
|
1885
1931
|
const syntaxOffset = rawCursor + line.prefixLength;
|
|
1886
1932
|
if (index === 0) {
|
|
@@ -1934,12 +1980,7 @@ function buildStructuredDecorators(lines, blockType, baseOffset, options) {
|
|
|
1934
1980
|
rawCursor += 1;
|
|
1935
1981
|
}
|
|
1936
1982
|
if (line.prefixLength > 0) {
|
|
1937
|
-
tokens.push(
|
|
1938
|
-
type: "text",
|
|
1939
|
-
text: line.raw.slice(0, line.prefixLength),
|
|
1940
|
-
start: rawCursor,
|
|
1941
|
-
end: rawCursor + line.prefixLength
|
|
1942
|
-
});
|
|
1983
|
+
tokens.push(...emitPrefixTokens(line.raw.slice(0, line.prefixLength), rawCursor, ancestry));
|
|
1943
1984
|
}
|
|
1944
1985
|
const syntaxOffset = rawCursor + line.prefixLength;
|
|
1945
1986
|
tokens.push(...tokenizeBlock(line.syntax, blockType, syntaxOffset, options));
|
|
@@ -1979,7 +2020,8 @@ function createBlock(input) {
|
|
|
1979
2020
|
input.lines ?? [{ raw: input.raw, syntax: input.syntaxRaw, prefixLength: input.raw.length - input.syntaxRaw.length }],
|
|
1980
2021
|
input.type,
|
|
1981
2022
|
input.offset,
|
|
1982
|
-
input.tokenizeOptions ?? {}
|
|
2023
|
+
input.tokenizeOptions ?? {},
|
|
2024
|
+
input.ancestry
|
|
1983
2025
|
);
|
|
1984
2026
|
const base = {
|
|
1985
2027
|
raw: input.raw,
|
|
@@ -250,6 +250,15 @@ function readSelection(root) {
|
|
|
250
250
|
var BQ_BAR_WIDTH = 3;
|
|
251
251
|
var BQ_GAP = 12;
|
|
252
252
|
var BQ_STEP = BQ_BAR_WIDTH + BQ_GAP;
|
|
253
|
+
function getBlockquoteDepthFromAncestry(ancestry) {
|
|
254
|
+
let maxDepth = 0;
|
|
255
|
+
for (const frame of ancestry) {
|
|
256
|
+
if (frame.kind === "blockquote" && frame.depth > maxDepth) {
|
|
257
|
+
maxDepth = frame.depth;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return maxDepth;
|
|
261
|
+
}
|
|
253
262
|
function buildBlockquoteBarsBoxShadow(depth) {
|
|
254
263
|
if (depth <= 1) return null;
|
|
255
264
|
const shadows = [];
|
|
@@ -269,6 +278,20 @@ function applyBlockquoteBarsStyle(el, depth) {
|
|
|
269
278
|
el.style.paddingLeft = `${depth * BQ_STEP}px`;
|
|
270
279
|
el.style.boxShadow = shadow;
|
|
271
280
|
}
|
|
281
|
+
function applyBlockquoteVisuals(el, blockType, depth, ancestry) {
|
|
282
|
+
const bqDepth = blockType === "blockquote" ? depth && depth > 0 ? depth : 0 : ancestry ? getBlockquoteDepthFromAncestry(ancestry) : 0;
|
|
283
|
+
if (bqDepth > 0) {
|
|
284
|
+
el.setAttribute("data-owo-depth", String(bqDepth));
|
|
285
|
+
if (blockType !== "blockquote") {
|
|
286
|
+
el.className += " owo-block-blockquote";
|
|
287
|
+
}
|
|
288
|
+
applyBlockquoteBarsStyle(el, bqDepth);
|
|
289
|
+
} else {
|
|
290
|
+
el.removeAttribute("data-owo-depth");
|
|
291
|
+
el.style.paddingLeft = "";
|
|
292
|
+
el.style.boxShadow = "";
|
|
293
|
+
}
|
|
294
|
+
}
|
|
272
295
|
var TOKEN_TO_CLASS = {
|
|
273
296
|
"text": "",
|
|
274
297
|
"strong-marker": "owo-syntax-marker",
|
|
@@ -318,17 +341,14 @@ var BLOCK_TYPE_TO_CLASS = {
|
|
|
318
341
|
"math-block": "owo-block-math",
|
|
319
342
|
"table": "owo-block-table"
|
|
320
343
|
};
|
|
321
|
-
function createBlockElement(doc, tokens, blockIndex, blockType, headingLevel, depth) {
|
|
344
|
+
function createBlockElement(doc, tokens, blockIndex, blockType, headingLevel, depth, ancestry) {
|
|
322
345
|
const div = doc.createElement("div");
|
|
323
346
|
div.setAttribute("data-owo-block", String(blockIndex));
|
|
324
347
|
div.className = BLOCK_TYPE_TO_CLASS[blockType] || "owo-block-paragraph";
|
|
325
348
|
if (blockType === "heading" && headingLevel) {
|
|
326
349
|
div.setAttribute("data-owo-heading", String(headingLevel));
|
|
327
350
|
}
|
|
328
|
-
|
|
329
|
-
div.setAttribute("data-owo-depth", String(depth));
|
|
330
|
-
applyBlockquoteBarsStyle(div, depth);
|
|
331
|
-
}
|
|
351
|
+
applyBlockquoteVisuals(div, blockType, depth, ancestry);
|
|
332
352
|
renderTokensInto(doc, div, tokens);
|
|
333
353
|
return div;
|
|
334
354
|
}
|
|
@@ -399,60 +419,37 @@ function renderDecoratorsInto(doc, container, decorators) {
|
|
|
399
419
|
container.appendChild(doc.createElement("br"));
|
|
400
420
|
}
|
|
401
421
|
}
|
|
402
|
-
function createBlockElementFromDecorators(doc, decorators, blockIndex, blockType, headingLevel, depth) {
|
|
422
|
+
function createBlockElementFromDecorators(doc, decorators, blockIndex, blockType, headingLevel, depth, ancestry) {
|
|
403
423
|
const div = doc.createElement("div");
|
|
404
424
|
div.setAttribute("data-owo-block", String(blockIndex));
|
|
405
425
|
div.className = BLOCK_TYPE_TO_CLASS[blockType] || "owo-block-paragraph";
|
|
406
426
|
if (blockType === "heading" && headingLevel) {
|
|
407
427
|
div.setAttribute("data-owo-heading", String(headingLevel));
|
|
408
428
|
}
|
|
409
|
-
|
|
410
|
-
div.setAttribute("data-owo-depth", String(depth));
|
|
411
|
-
applyBlockquoteBarsStyle(div, depth);
|
|
412
|
-
}
|
|
429
|
+
applyBlockquoteVisuals(div, blockType, depth, ancestry);
|
|
413
430
|
renderDecoratorsInto(doc, div, decorators);
|
|
414
431
|
return div;
|
|
415
432
|
}
|
|
416
|
-
function updateBlockElementFromDecorators(doc, existing, decorators, blockType, headingLevel, depth) {
|
|
417
|
-
|
|
418
|
-
if (existing.className !== newClass) {
|
|
419
|
-
existing.className = newClass;
|
|
420
|
-
}
|
|
433
|
+
function updateBlockElementFromDecorators(doc, existing, decorators, blockType, headingLevel, depth, ancestry) {
|
|
434
|
+
existing.className = BLOCK_TYPE_TO_CLASS[blockType] || "owo-block-paragraph";
|
|
421
435
|
if (blockType === "heading" && headingLevel) {
|
|
422
436
|
existing.setAttribute("data-owo-heading", String(headingLevel));
|
|
423
437
|
} else {
|
|
424
438
|
existing.removeAttribute("data-owo-heading");
|
|
425
439
|
}
|
|
426
|
-
|
|
427
|
-
existing.setAttribute("data-owo-depth", String(depth));
|
|
428
|
-
applyBlockquoteBarsStyle(existing, depth);
|
|
429
|
-
} else {
|
|
430
|
-
existing.removeAttribute("data-owo-depth");
|
|
431
|
-
existing.style.paddingLeft = "";
|
|
432
|
-
existing.style.boxShadow = "";
|
|
433
|
-
}
|
|
440
|
+
applyBlockquoteVisuals(existing, blockType, depth, ancestry);
|
|
434
441
|
existing.textContent = "";
|
|
435
442
|
renderDecoratorsInto(doc, existing, decorators);
|
|
436
443
|
return true;
|
|
437
444
|
}
|
|
438
|
-
function updateBlockElement(doc, existing, tokens, blockType, headingLevel, depth) {
|
|
439
|
-
|
|
440
|
-
if (existing.className !== newClass) {
|
|
441
|
-
existing.className = newClass;
|
|
442
|
-
}
|
|
445
|
+
function updateBlockElement(doc, existing, tokens, blockType, headingLevel, depth, ancestry) {
|
|
446
|
+
existing.className = BLOCK_TYPE_TO_CLASS[blockType] || "owo-block-paragraph";
|
|
443
447
|
if (blockType === "heading" && headingLevel) {
|
|
444
448
|
existing.setAttribute("data-owo-heading", String(headingLevel));
|
|
445
449
|
} else {
|
|
446
450
|
existing.removeAttribute("data-owo-heading");
|
|
447
451
|
}
|
|
448
|
-
|
|
449
|
-
existing.setAttribute("data-owo-depth", String(depth));
|
|
450
|
-
applyBlockquoteBarsStyle(existing, depth);
|
|
451
|
-
} else {
|
|
452
|
-
existing.removeAttribute("data-owo-depth");
|
|
453
|
-
existing.style.paddingLeft = "";
|
|
454
|
-
existing.style.boxShadow = "";
|
|
455
|
-
}
|
|
452
|
+
applyBlockquoteVisuals(existing, blockType, depth, ancestry);
|
|
456
453
|
existing.textContent = "";
|
|
457
454
|
renderTokensInto(doc, existing, tokens);
|
|
458
455
|
return true;
|
|
@@ -471,7 +468,8 @@ function fullRender(root, doc) {
|
|
|
471
468
|
i,
|
|
472
469
|
block.type,
|
|
473
470
|
block.type === "heading" ? block.headingLevel : void 0,
|
|
474
|
-
block.depth
|
|
471
|
+
block.depth,
|
|
472
|
+
block.ancestry
|
|
475
473
|
);
|
|
476
474
|
root.appendChild(el);
|
|
477
475
|
offset += block.raw.length + 1;
|
|
@@ -495,7 +493,8 @@ function patchDirtyBlocks(root, doc, dirty) {
|
|
|
495
493
|
block.decorators,
|
|
496
494
|
block.type,
|
|
497
495
|
block.type === "heading" ? block.headingLevel : void 0,
|
|
498
|
-
block.depth
|
|
496
|
+
block.depth,
|
|
497
|
+
block.ancestry
|
|
499
498
|
);
|
|
500
499
|
}
|
|
501
500
|
}
|
|
@@ -537,6 +536,7 @@ export {
|
|
|
537
536
|
restoreSelection,
|
|
538
537
|
readSelection,
|
|
539
538
|
BQ_STEP,
|
|
539
|
+
getBlockquoteDepthFromAncestry,
|
|
540
540
|
buildBlockquoteBarsBoxShadow,
|
|
541
541
|
TOKEN_CLASS_EXEMPTIONS,
|
|
542
542
|
TOKEN_TO_CLASS,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OwoMarkDocument, O as OwoMarkSelection, V as VirtualSelection, C as CompositionState, B as BlockType, b as BlockContext, c as BlockInsertType, d as BlockContextListener } from './public-
|
|
1
|
+
import { a as OwoMarkDocument, O as OwoMarkSelection, V as VirtualSelection, C as CompositionState, B as BlockType, b as BlockContext, c as BlockInsertType, d as BlockContextListener } from './public-BjF6yWIR.js';
|
|
2
2
|
|
|
3
3
|
type CoreSelectionSnapshot = {
|
|
4
4
|
linear: OwoMarkSelection | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CoreStateSnapshot, S as SlashState, a as CommandRegistry } from './editor-core-
|
|
2
|
-
export { B as BeforeInputIntent, b as CommandContext, c as CommandDefinition, d as CoreApplyAction, e as CoreApplyResult, f as CoreSelectionSnapshot, g as CreateOwoMarkCoreOptions, D as DocumentChangeCallback, I as IndentMode, h as IndentResult, K as KeyDownIntent, O as OwoMarkCore, P as PasteIntent, i as SlashStateListener, j as SlashTriggerInfo, k as applyMarkdownIndent, l as createOwoMarkCore, r as resolveIndentSize } from './editor-core-
|
|
3
|
-
import {
|
|
4
|
-
export { b as BlockContext, d as BlockContextListener,
|
|
5
|
-
export { O as OwoComponentDescriptor, d as OwoEditorEntryDescriptor, f as OwoFeatureFlagKey, g as OwoRuntimeBlockDescriptor, h as OwoSyntaxDescriptor } from './registry-
|
|
1
|
+
import { C as CoreStateSnapshot, S as SlashState, a as CommandRegistry } from './editor-core-edBvPqBi.js';
|
|
2
|
+
export { B as BeforeInputIntent, b as CommandContext, c as CommandDefinition, d as CoreApplyAction, e as CoreApplyResult, f as CoreSelectionSnapshot, g as CreateOwoMarkCoreOptions, D as DocumentChangeCallback, I as IndentMode, h as IndentResult, K as KeyDownIntent, O as OwoMarkCore, P as PasteIntent, i as SlashStateListener, j as SlashTriggerInfo, k as applyMarkdownIndent, l as createOwoMarkCore, r as resolveIndentSize } from './editor-core-edBvPqBi.js';
|
|
3
|
+
import { h as BlockNode, i as BlockContextType, O as OwoMarkSelection, j as ContainerBlockSyntaxExtension, J as JsonValue, k as ParseMarkdownOptions, a as OwoMarkDocument, l as ConformanceDocument, D as DirtyRange, P as PreviewBlockKind, g as PreviewBlock, m as BlockTransform, n as OwoMarkSharedStateController, o as InlineExtensionPriority, p as InlineSyntaxExtension, T as TokenizeInlineOptions, e as InlineToken, q as TokenizeBlockOptions } from './public-BjF6yWIR.js';
|
|
4
|
+
export { b as BlockContext, d as BlockContextListener, r as BlockExtensionPriority, c as BlockInsertType, s as BlockSyntaxExtension, B as BlockType, t as CLASSLESS_INLINE_TOKEN_TYPES, C as CompositionState, u as ConformanceBlockNode, v as ConformanceContainerNode, w as ConformanceInlineNode, x as ConformanceTableCell, y as ConformanceTableRow, z as ContainerBlockExtensionPriority, f as ContainerFrame, A as ContainerKind, E as CustomBlockRuntimeBinding, F as Decorator, G as DecoratorType, H as HeadingLevel, K as HistoryEntry, L as INLINE_TOKEN_TYPES, M as InlineExtensionHostBlockType, N as InlineScannerMatch, I as InlineTokenType, Q as JsonPrimitive, R as Leaf, S as OwoMarkCommands, U as OwoMarkDocumentTrace, W as OwoMarkEditorLike, X as OwoMarkSharedState, Y as OwoMarkSharedStateStore, Z as ParserDiffScope, _ as ParserExtensionConsumer, $ as ParserExtensionParent, a0 as ParserExtensionScope, a1 as PreviewDirtyReason, a2 as SideAnnotationMemberBlock, a3 as SideAnnotationMemberBlockType, a4 as SideAnnotationSourceKind, a5 as TokenizeBlockExtensionOptions, a6 as VirtualPosition, V as VirtualSelection, a7 as getBlockIndexForPosition, a8 as isVirtualSelectionCollapsed, a9 as linearToVirtual, aa as linearToVirtualPosition, ab as virtualPositionToLinear, ac as virtualPositionsEqual, ad as virtualToLinear } from './public-BjF6yWIR.js';
|
|
5
|
+
export { O as OwoComponentDescriptor, d as OwoEditorEntryDescriptor, f as OwoFeatureFlagKey, g as OwoRuntimeBlockDescriptor, h as OwoSyntaxDescriptor } from './registry-DI94xf3v.js';
|
|
6
6
|
export { getSyntaxDescriptor, parseInlineSideAnnotationFromText, stripInlineSideAnnotationTail, stripSideContinuationTail, syntaxRegistry } from './semantic/syntax/index.js';
|
|
7
7
|
export { componentRegistry, getComponentDescriptor, getComponentDescriptorByDirective } from './semantic/components/index.js';
|
|
8
8
|
export { getRuntimeBlockDescriptor, getRuntimeBlockDescriptorByBlockType, getRuntimeBlockDescriptorByPreviewKind, runtimeBlockRegistry } from './semantic/runtime/index.js';
|
|
@@ -10,8 +10,8 @@ export { editorEntryRegistry, getEditorEntryDescriptor, getEditorEntryDescriptor
|
|
|
10
10
|
export { WordBoundaryResult, deleteToLineEnd, deleteToLineStart, deleteWordBackward, deleteWordForward } from './internal/commands/word-boundary.js';
|
|
11
11
|
export { normalizeMarkdownPaste } from './internal/clipboard/paste.js';
|
|
12
12
|
export { enableMapSet, produce } from 'immer';
|
|
13
|
-
import { O as OwoMarkScrollProjectionSnapshot, c as OwoMarkScrollProjectionSegment, S as SourceKey, a as OwoMarkSurfaceGeometrySnapshot, V as ViewportMetrics, G as GlobalScrollPosition } from './types-
|
|
14
|
-
export { C as ContentId, d as Geometry, b as OwoMarkScrollController, e as OwoMarkScrollDegradedReason, f as OwoMarkSurfaceGeometrySegment, g as OwoMarkSurfaceGeometrySnapshotStatus, h as ScrollProjectionSegmentKind, i as ScrollResolutionResult, j as ScrollSurface, k as ScrollToScrollPositionOptions, l as ScrollToScrollPositionResult } from './types-
|
|
13
|
+
import { O as OwoMarkScrollProjectionSnapshot, c as OwoMarkScrollProjectionSegment, S as SourceKey, a as OwoMarkSurfaceGeometrySnapshot, V as ViewportMetrics, G as GlobalScrollPosition } from './types-0QKyuzQy.js';
|
|
14
|
+
export { C as ContentId, d as Geometry, b as OwoMarkScrollController, e as OwoMarkScrollDegradedReason, f as OwoMarkSurfaceGeometrySegment, g as OwoMarkSurfaceGeometrySnapshotStatus, h as ScrollProjectionSegmentKind, i as ScrollResolutionResult, j as ScrollSurface, k as ScrollToScrollPositionOptions, l as ScrollToScrollPositionResult } from './types-0QKyuzQy.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Resolve the extended BlockContextType from a BlockNode.
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as OwoMarkSelection, a as OwoMarkDocument, V as VirtualSelection } from '../public-
|
|
2
|
-
import { O as OwoMarkCore } from '../editor-core-
|
|
3
|
-
export { D as DocumentChangeCallback } from '../editor-core-
|
|
1
|
+
import { O as OwoMarkSelection, a as OwoMarkDocument, V as VirtualSelection } from '../public-BjF6yWIR.js';
|
|
2
|
+
import { O as OwoMarkCore } from '../editor-core-edBvPqBi.js';
|
|
3
|
+
export { D as DocumentChangeCallback } from '../editor-core-edBvPqBi.js';
|
|
4
4
|
|
|
5
5
|
type OwoMarkEditorInstance = {
|
|
6
6
|
mount(root: HTMLElement): void;
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
fullRender,
|
|
4
4
|
readSelection,
|
|
5
5
|
restoreSelection
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-YS3HGP3M.js";
|
|
7
7
|
import {
|
|
8
8
|
createOwoMarkCore
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-WV2K5MNU.js";
|
|
10
10
|
import "../chunk-WFPUIPWU.js";
|
|
11
11
|
import "../chunk-ROJILHRQ.js";
|
|
12
12
|
import "../chunk-BKJCBEI7.js";
|
|
@@ -470,4 +470,4 @@ type HistoryEntry = {
|
|
|
470
470
|
selection: OwoMarkSelection;
|
|
471
471
|
};
|
|
472
472
|
|
|
473
|
-
export { type ParserExtensionParent as $, type ContainerKind as A, type BlockType as B, type CompositionState as C, type DirtyRange as D, type CustomBlockRuntimeBinding as E, type Decorator as F, type DecoratorType as G, type HeadingLevel as H, type InlineTokenType as I, type JsonValue as J, type HistoryEntry as K, INLINE_TOKEN_TYPES as L, type InlineExtensionHostBlockType as M, type InlineScannerMatch as N, type OwoMarkSelection as O, type PreviewBlockKind as P, type JsonPrimitive as Q, type Leaf as R, type OwoMarkCommands as S, type TokenizeInlineOptions as T, type OwoMarkDocumentTrace as U, type VirtualSelection as V, type OwoMarkEditorLike as W, type OwoMarkSharedState as X, type OwoMarkSharedStateStore as Y, type ParserDiffScope as Z, type ParserExtensionConsumer as _, type OwoMarkDocument as a, type ParserExtensionScope as a0, type PreviewDirtyReason as a1, type SideAnnotationMemberBlock as a2, type SideAnnotationMemberBlockType as a3, type SideAnnotationSourceKind as a4, type TokenizeBlockExtensionOptions as a5, type VirtualPosition as a6, getBlockIndexForPosition as a7, isVirtualSelectionCollapsed as a8, linearToVirtual as a9, linearToVirtualPosition as aa, virtualPositionToLinear as ab, virtualPositionsEqual as ac, virtualToLinear as ad, type BlockContext as b, type BlockInsertType as c, type BlockContextListener as d, type InlineToken as e, type
|
|
473
|
+
export { type ParserExtensionParent as $, type ContainerKind as A, type BlockType as B, type CompositionState as C, type DirtyRange as D, type CustomBlockRuntimeBinding as E, type Decorator as F, type DecoratorType as G, type HeadingLevel as H, type InlineTokenType as I, type JsonValue as J, type HistoryEntry as K, INLINE_TOKEN_TYPES as L, type InlineExtensionHostBlockType as M, type InlineScannerMatch as N, type OwoMarkSelection as O, type PreviewBlockKind as P, type JsonPrimitive as Q, type Leaf as R, type OwoMarkCommands as S, type TokenizeInlineOptions as T, type OwoMarkDocumentTrace as U, type VirtualSelection as V, type OwoMarkEditorLike as W, type OwoMarkSharedState as X, type OwoMarkSharedStateStore as Y, type ParserDiffScope as Z, type ParserExtensionConsumer as _, type OwoMarkDocument as a, type ParserExtensionScope as a0, type PreviewDirtyReason as a1, type SideAnnotationMemberBlock as a2, type SideAnnotationMemberBlockType as a3, type SideAnnotationSourceKind as a4, type TokenizeBlockExtensionOptions as a5, type VirtualPosition as a6, getBlockIndexForPosition as a7, isVirtualSelectionCollapsed as a8, linearToVirtual as a9, linearToVirtualPosition as aa, virtualPositionToLinear as ab, virtualPositionsEqual as ac, virtualToLinear as ad, type BlockContext as b, type BlockInsertType as c, type BlockContextListener as d, type InlineToken as e, type ContainerFrame as f, type PreviewBlock as g, type BlockNode as h, type BlockContextType as i, type ContainerBlockSyntaxExtension as j, type ParseMarkdownOptions as k, type ConformanceDocument as l, type BlockTransform as m, type OwoMarkSharedStateController as n, type InlineExtensionPriority as o, type InlineSyntaxExtension as p, type TokenizeBlockOptions as q, type BlockExtensionPriority as r, type BlockSyntaxExtension as s, CLASSLESS_INLINE_TOKEN_TYPES as t, type ConformanceBlockNode as u, type ConformanceContainerNode as v, type ConformanceInlineNode as w, type ConformanceTableCell as x, type ConformanceTableRow as y, type ContainerBlockExtensionPriority as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PreviewBlockKind } from './public-
|
|
1
|
+
import { P as PreviewBlockKind } from './public-BjF6yWIR.js';
|
|
2
2
|
|
|
3
3
|
type OwoFeatureFlagKey = 'enableSideAnnotation' | 'enableMath' | 'enableComponents';
|
|
4
4
|
type OwoSemanticDescriptorFamily = 'syntax' | 'component' | 'runtime' | 'editor';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as OwoDescriptorRegistry, O as OwoComponentDescriptor } from '../../registry-
|
|
2
|
-
export { a as OwoComponentKind, b as OwoComponentPayloadStrategy } from '../../registry-
|
|
3
|
-
import '../../public-
|
|
1
|
+
import { c as OwoDescriptorRegistry, O as OwoComponentDescriptor } from '../../registry-DI94xf3v.js';
|
|
2
|
+
export { a as OwoComponentKind, b as OwoComponentPayloadStrategy } from '../../registry-DI94xf3v.js';
|
|
3
|
+
import '../../public-BjF6yWIR.js';
|
|
4
4
|
|
|
5
5
|
declare const componentRegistry: OwoDescriptorRegistry<OwoComponentDescriptor>;
|
|
6
6
|
declare function getComponentDescriptor(key: string): OwoComponentDescriptor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as OwoDescriptorRegistry, d as OwoEditorEntryDescriptor, e as OwoEditorEntryPresentation } from '../../registry-
|
|
2
|
-
import '../../public-
|
|
1
|
+
import { c as OwoDescriptorRegistry, d as OwoEditorEntryDescriptor, e as OwoEditorEntryPresentation } from '../../registry-DI94xf3v.js';
|
|
2
|
+
import '../../public-BjF6yWIR.js';
|
|
3
3
|
|
|
4
4
|
declare const editorEntryRegistry: OwoDescriptorRegistry<OwoEditorEntryDescriptor>;
|
|
5
5
|
declare function getEditorEntryDescriptor(key: string): OwoEditorEntryDescriptor;
|
package/dist/semantic/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { O as OwoComponentDescriptor, a as OwoComponentKind, b as OwoComponentPayloadStrategy, c as OwoDescriptorRegistry, d as OwoEditorEntryDescriptor, e as OwoEditorEntryPresentation, f as OwoFeatureFlagKey, g as OwoRuntimeBlockDescriptor, h as OwoSyntaxDescriptor, i as createDescriptorRegistry, r as requireDescriptor } from '../registry-
|
|
1
|
+
export { O as OwoComponentDescriptor, a as OwoComponentKind, b as OwoComponentPayloadStrategy, c as OwoDescriptorRegistry, d as OwoEditorEntryDescriptor, e as OwoEditorEntryPresentation, f as OwoFeatureFlagKey, g as OwoRuntimeBlockDescriptor, h as OwoSyntaxDescriptor, i as createDescriptorRegistry, r as requireDescriptor } from '../registry-DI94xf3v.js';
|
|
2
2
|
export { validateComponentDescriptors, validateEditorEntryDescriptors, validateRuntimeDescriptors, validateSyntaxDescriptors } from './shared/index.js';
|
|
3
3
|
export { MATH_FENCE_RE, MULTI_LINE_MATH_BLOCK_CLOSE_RE, MULTI_LINE_MATH_BLOCK_OPEN_RE, MathFenceNormalizationLineMapping, MathFenceNormalizationRewrite, SIDE_ANNOTATION_RENDERER_KEY_BY_TYPE, SIDE_ANNOTATION_SYMBOL_BY_KEYWORD, SIDE_ANNOTATION_TAIL_RE, SIDE_ANNOTATION_TYPE_SYMBOLS, SIDE_ANNOTATION_TYPE_SYMBOLS_SORTED, SIDE_ANNOTATION_TYPE_TABLE, SIDE_CONTINUATION_TAIL_RE, SIDE_NOTE_DEFINITION_RE, SIDE_NOTE_REF_RE, SINGLE_LINE_MATH_BLOCK_RE, SideAnnotationType, SideAnnotationTypeDescriptor, SideAnnotationTypeSymbol, collectMathFenceNormalizationRewrites, getSyntaxDescriptor, isFenceOnlyMathLine, isMultiLineMathBlockClose, isMultiLineMathBlockOpen, isSingleLineMathBlock, mathSyntaxDescriptor, parseInlineSideAnnotationFromText, parseInlineSideAnnotationText, parseSideDirectiveLabel, parseSideNoteDefinitionRaw, sideAnnotationSyntaxDescriptors, sideAnnotationTypeDescriptors, stripInlineSideAnnotationTail, stripSideContinuationTail, syntaxRegistry } from './syntax/index.js';
|
|
4
4
|
export { componentRegistry, getComponentDescriptor, getComponentDescriptorByDirective } from './components/index.js';
|
|
5
5
|
export { getRuntimeBlockDescriptor, getRuntimeBlockDescriptorByBlockType, getRuntimeBlockDescriptorByPreviewKind, runtimeBlockRegistry } from './runtime/index.js';
|
|
6
6
|
export { editorEntryRegistry, getEditorEntryDescriptor, getEditorEntryDescriptorByCommandId, resolveEditorEntryPresentation } from './editor/index.js';
|
|
7
|
-
import '../public-
|
|
7
|
+
import '../public-BjF6yWIR.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as OwoRuntimeBlockDescriptor, c as OwoDescriptorRegistry } from '../../registry-
|
|
2
|
-
import '../../public-
|
|
1
|
+
import { g as OwoRuntimeBlockDescriptor, c as OwoDescriptorRegistry } from '../../registry-DI94xf3v.js';
|
|
2
|
+
import '../../public-BjF6yWIR.js';
|
|
3
3
|
|
|
4
4
|
declare const runtimeBlockRegistry: OwoDescriptorRegistry<OwoRuntimeBlockDescriptor>;
|
|
5
5
|
declare function getRuntimeBlockDescriptor(key: string): OwoRuntimeBlockDescriptor;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as OwoComponentDescriptor, d as OwoEditorEntryDescriptor, g as OwoRuntimeBlockDescriptor, h as OwoSyntaxDescriptor } from '../../registry-
|
|
2
|
-
export { a as OwoComponentKind, b as OwoComponentPayloadStrategy, c as OwoDescriptorRegistry, e as OwoEditorEntryPresentation, f as OwoFeatureFlagKey, i as createDescriptorRegistry, r as requireDescriptor } from '../../registry-
|
|
3
|
-
import '../../public-
|
|
1
|
+
import { O as OwoComponentDescriptor, d as OwoEditorEntryDescriptor, g as OwoRuntimeBlockDescriptor, h as OwoSyntaxDescriptor } from '../../registry-DI94xf3v.js';
|
|
2
|
+
export { a as OwoComponentKind, b as OwoComponentPayloadStrategy, c as OwoDescriptorRegistry, e as OwoEditorEntryPresentation, f as OwoFeatureFlagKey, i as createDescriptorRegistry, r as requireDescriptor } from '../../registry-DI94xf3v.js';
|
|
3
|
+
import '../../public-BjF6yWIR.js';
|
|
4
4
|
|
|
5
5
|
declare function validateSyntaxDescriptors(descriptors: readonly OwoSyntaxDescriptor[]): void;
|
|
6
6
|
declare function validateComponentDescriptors(descriptors: readonly OwoComponentDescriptor[]): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as OwoSyntaxDescriptor, c as OwoDescriptorRegistry } from '../../registry-
|
|
2
|
-
import '../../public-
|
|
1
|
+
import { h as OwoSyntaxDescriptor, c as OwoDescriptorRegistry } from '../../registry-DI94xf3v.js';
|
|
2
|
+
import '../../public-BjF6yWIR.js';
|
|
3
3
|
|
|
4
4
|
/** Fence-only display math line, e.g. `$$`. */
|
|
5
5
|
declare const MATH_FENCE_RE: RegExp;
|