markloom 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PACKAGES.md +26 -0
- package/README.md +20 -2
- package/collab.md +42 -7
- package/dist/ai/index.cjs +4 -4
- package/dist/ai/index.d.cts +5 -4
- package/dist/ai/index.d.ts +5 -4
- package/dist/ai/index.js +3 -3
- package/dist/ai/theme.css +66 -102
- package/dist/{chunk-VXM7Q6P5.cjs → chunk-ACFYBYZJ.cjs} +2604 -966
- package/dist/chunk-CGYCJORO.js +759 -0
- package/dist/chunk-EADZKEU4.cjs +498 -0
- package/dist/chunk-EJSFZHGT.js +24 -0
- package/dist/{chunk-YIFOGP2D.cjs → chunk-I5VK4U7J.cjs} +103 -60
- package/dist/{chunk-ZMTLSFLO.js → chunk-KYZJIOOL.js} +2138 -500
- package/dist/chunk-QEVME6ZU.cjs +759 -0
- package/dist/{chunk-MFYF2A6U.js → chunk-SNFF6X45.js} +51 -1
- package/dist/{chunk-FCH7LZFI.js → chunk-TB2OY3D4.js} +50 -7
- package/dist/{chunk-4TMHVNL6.cjs → chunk-TWD5T4YC.cjs} +155 -105
- package/dist/{chunk-JS527FDV.cjs → chunk-U3JZDFL4.cjs} +49 -9
- package/dist/{chunk-RLTHVQNQ.js → chunk-VSBIMMI7.js} +45 -5
- package/dist/chunk-YBAT343I.js +498 -0
- package/dist/chunk-ZKQSQSSM.cjs +24 -0
- package/dist/{client-ZRZj2nkq.d.cts → client-CLYq17SW.d.ts} +63 -7
- package/dist/{client-6KiH4kGK.d.ts → client-DAth8pPq.d.cts} +63 -7
- package/dist/collab/index.cjs +16 -4
- package/dist/collab/index.d.cts +19 -6
- package/dist/collab/index.d.ts +19 -6
- package/dist/collab/index.js +18 -6
- package/dist/{controller-BNuuUM3E.d.ts → controller-6AJ36G52.d.ts} +99 -7
- package/dist/{controller-DQITsFhy.d.cts → controller-BIOO_XKJ.d.cts} +99 -7
- package/dist/index.cjs +57 -7
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +54 -4
- package/dist/io/index.cjs +1413 -0
- package/dist/io/index.d.cts +33 -0
- package/dist/io/index.d.ts +33 -0
- package/dist/io/index.js +1413 -0
- package/dist/react/index.cjs +8 -8
- package/dist/react/index.d.cts +5 -4
- package/dist/react/index.d.ts +5 -4
- package/dist/react/index.js +7 -7
- package/dist/{rebase-batch-8rL_aXEE.d.ts → rebase-batch-DlerAcFN.d.ts} +11 -9
- package/dist/{rebase-batch-bYnBJpRO.d.cts → rebase-batch-PjENQ742.d.cts} +11 -9
- package/dist/suggest-Bk4zLzuv.d.ts +120 -0
- package/dist/suggest-BkGGiPKA.d.cts +120 -0
- package/dist/types-COUweEav.d.cts +30 -0
- package/dist/types-COUweEav.d.ts +30 -0
- package/dist/versions-9mG1epfB.d.cts +51 -0
- package/dist/versions-Bubyo4pt.d.ts +51 -0
- package/dist/view/index.cjs +56 -12
- package/dist/view/index.d.cts +203 -11
- package/dist/view/index.d.ts +203 -11
- package/dist/view/index.js +52 -8
- package/dist/view/theme.css +1829 -1587
- package/io.md +38 -0
- package/package.json +21 -5
- package/dist/chunk-4JSJAHTB.js +0 -255
- package/dist/chunk-ALZ3A5CS.cjs +0 -255
- package/dist/chunk-GQ2HHRGI.cjs +0 -16
- package/dist/chunk-LA5SBCGQ.js +0 -16
- package/dist/chunk-LEYAQNJA.js +0 -220
- package/dist/chunk-YXQDCW4Y.cjs +0 -220
- package/dist/comments-DlExS6f-.d.cts +0 -43
- package/dist/comments-PhnR7Gkn.d.ts +0 -43
- package/dist/step-BrvHIK7O.d.cts +0 -65
- package/dist/step-BrvHIK7O.d.ts +0 -65
package/dist/view/index.cjs
CHANGED
|
@@ -79,8 +79,6 @@
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
var _chunkVXM7Q6P5cjs = require('../chunk-VXM7Q6P5.cjs');
|
|
83
|
-
require('../chunk-YXQDCW4Y.cjs');
|
|
84
82
|
|
|
85
83
|
|
|
86
84
|
|
|
@@ -91,11 +89,35 @@ require('../chunk-YXQDCW4Y.cjs');
|
|
|
91
89
|
|
|
92
90
|
|
|
93
91
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
var _chunkACFYBYZJcjs = require('../chunk-ACFYBYZJ.cjs');
|
|
103
|
+
require('../chunk-QEVME6ZU.cjs');
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var _chunkI5VK4U7Jcjs = require('../chunk-I5VK4U7J.cjs');
|
|
117
|
+
require('../chunk-TWD5T4YC.cjs');
|
|
118
|
+
require('../chunk-EADZKEU4.cjs');
|
|
119
|
+
require('../chunk-U3JZDFL4.cjs');
|
|
120
|
+
require('../chunk-ZKQSQSSM.cjs');
|
|
99
121
|
|
|
100
122
|
// src/view/shiki-code-view.ts
|
|
101
123
|
var _preact = require('preact');
|
|
@@ -112,7 +134,7 @@ function shikiCodeView(highlight, langs) {
|
|
|
112
134
|
"dangerouslySetInnerHTML": { __html: anchorEmptyLines(highlight(ctx.text, lang)) }
|
|
113
135
|
});
|
|
114
136
|
const copy = _preact.h.call(void 0, "button", { "key": "copy", "data-copy": "", "type": "button", "contentEditable": "false", "tabIndex": -1, "aria-label": "\u590D\u5236\u4EE3\u7801" });
|
|
115
|
-
const langBtn = _preact.h.call(void 0, "button", { "key": "lang", "data-code-lang": "", "type": "button", "contentEditable": "false", "tabIndex": -1 }, lang || "\u7EAF\u6587\u672C");
|
|
137
|
+
const langBtn = ctx.editable === false ? null : _preact.h.call(void 0, "button", { "key": "lang", "data-code-lang": "", "type": "button", "contentEditable": "false", "tabIndex": -1 }, lang || "\u7EAF\u6587\u672C");
|
|
116
138
|
return _preact.h.call(void 0, "div", { "key": ctx.key, "data-block-id": _nullishCoalesce(ctx.node.id, () => ( "")), "data-code-block": "" }, [langBtn, copy, leaf]);
|
|
117
139
|
}
|
|
118
140
|
};
|
|
@@ -166,7 +188,7 @@ function subRule() {
|
|
|
166
188
|
{ kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
|
|
167
189
|
{ kind: "insertText", path: ctx.leafPath, offset: at, text: s.to }
|
|
168
190
|
];
|
|
169
|
-
return { steps, selection:
|
|
191
|
+
return { steps, selection: _chunkACFYBYZJcjs.caret.call(void 0, ctx.leafPath.concat(at + s.to.length)) };
|
|
170
192
|
}
|
|
171
193
|
return null;
|
|
172
194
|
}
|
|
@@ -180,7 +202,7 @@ function quoteRule(quote, open, close) {
|
|
|
180
202
|
const prev = ctx.marker.slice(-1);
|
|
181
203
|
const to = prev === "" || prev === " " || prev === "\n" || prev === " " || prev === "(" || prev === "[" || prev === "{" ? open : close;
|
|
182
204
|
const steps = [{ kind: "insertText", path: ctx.leafPath, offset: ctx.offset, text: to }];
|
|
183
|
-
return { steps, selection:
|
|
205
|
+
return { steps, selection: _chunkACFYBYZJcjs.caret.call(void 0, ctx.leafPath.concat(ctx.offset + to.length)) };
|
|
184
206
|
}
|
|
185
207
|
};
|
|
186
208
|
}
|
|
@@ -256,7 +278,7 @@ function emojiRule() {
|
|
|
256
278
|
{ kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
|
|
257
279
|
{ kind: "insertText", path: ctx.leafPath, offset: at, text: glyph }
|
|
258
280
|
];
|
|
259
|
-
return { steps, selection:
|
|
281
|
+
return { steps, selection: _chunkACFYBYZJcjs.caret.call(void 0, ctx.leafPath.concat(at + glyph.length)) };
|
|
260
282
|
}
|
|
261
283
|
};
|
|
262
284
|
}
|
|
@@ -368,4 +390,26 @@ var comments = {
|
|
|
368
390
|
|
|
369
391
|
|
|
370
392
|
|
|
371
|
-
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
exports.CALLOUT_VARIANTS = _chunkACFYBYZJcjs.CALLOUT_VARIANTS; exports.CommentPanel = _chunkACFYBYZJcjs.CommentPanel; exports.Editor = _chunkACFYBYZJcjs.Editor; exports.MentionMenu = _chunkACFYBYZJcjs.MentionMenu; exports.MentionPopovers = _chunkACFYBYZJcjs.MentionPopovers; exports.SearchBar = _chunkACFYBYZJcjs.SearchBar; exports.SuggestBar = _chunkACFYBYZJcjs.SuggestBar; exports.TocPanel = _chunkACFYBYZJcjs.TocPanel; exports.VersionsPanel = _chunkACFYBYZJcjs.VersionsPanel; exports.askInput = _chunkACFYBYZJcjs.askInput; exports.askLinkPopover = _chunkACFYBYZJcjs.askLinkPopover; exports.askPopover = _chunkACFYBYZJcjs.askPopover; exports.atomIsSelected = _chunkACFYBYZJcjs.atomIsSelected; exports.blockExtensions = _chunkACFYBYZJcjs.blockExtensions; exports.blockPlainText = _chunkI5VK4U7Jcjs.blockPlainText; exports.blockTransform = _chunkACFYBYZJcjs.blockTransform; exports.boldMark = _chunkACFYBYZJcjs.boldMark; exports.bubbleMenu = _chunkACFYBYZJcjs.bubbleMenu; exports.calloutVariantFromQuery = _chunkACFYBYZJcjs.calloutVariantFromQuery; exports.caret = _chunkACFYBYZJcjs.caret; exports.chord = _chunkACFYBYZJcjs.chord; exports.clipboardFromDataTransfer = _chunkACFYBYZJcjs.clipboardFromDataTransfer; exports.closeAskInput = _chunkACFYBYZJcjs.closeAskInput; exports.codeBlock = _chunkACFYBYZJcjs.codeBlock; exports.codeControls = _chunkACFYBYZJcjs.codeControls; exports.codeMark = _chunkACFYBYZJcjs.codeMark; exports.comments = comments; exports.cycleCalloutVariant = _chunkACFYBYZJcjs.cycleCalloutVariant; exports.decorationExtensions = _chunkACFYBYZJcjs.decorationExtensions; exports.defaultBlockRenderers = _chunkACFYBYZJcjs.defaultBlockRenderers; exports.defaultBlockTag = _chunkACFYBYZJcjs.defaultBlockTag; exports.defaultMarkTag = _chunkACFYBYZJcjs.defaultMarkTag; exports.diffSpan = _chunkACFYBYZJcjs.diffSpan; exports.docExtent = _chunkI5VK4U7Jcjs.docExtent; exports.domToPoint = _chunkI5VK4U7Jcjs.domToPoint; exports.dragHandle = _chunkACFYBYZJcjs.dragHandle; exports.elementChildren = _chunkI5VK4U7Jcjs.elementChildren; exports.embedBlock = _chunkACFYBYZJcjs.embedBlock; exports.emoji = emoji; exports.focusBlockId = _chunkI5VK4U7Jcjs.focusBlockId; exports.highlightMark = _chunkACFYBYZJcjs.highlightMark; exports.history = _chunkACFYBYZJcjs.history; exports.hrBlock = _chunkACFYBYZJcjs.hrBlock; exports.htmlToPlainText = _chunkACFYBYZJcjs.htmlToPlainText; exports.imageBlock = _chunkACFYBYZJcjs.imageBlock; exports.imageFileFrom = _chunkACFYBYZJcjs.imageFileFrom; exports.indentItem = _chunkACFYBYZJcjs.indentItem; exports.inputRules = _chunkACFYBYZJcjs.inputRules; exports.invisibleCharacters = invisibleCharacters; exports.isAtom = _chunkACFYBYZJcjs.isAtom; exports.isBareUrl = _chunkACFYBYZJcjs.isBareUrl; exports.isOpaque = _chunkACFYBYZJcjs.isOpaque; exports.italicMark = _chunkACFYBYZJcjs.italicMark; exports.leafText = _chunkACFYBYZJcjs.leafText; exports.lineBoundaryBack = _chunkACFYBYZJcjs.lineBoundaryBack; exports.lineBoundaryFwd = _chunkACFYBYZJcjs.lineBoundaryFwd; exports.linkMark = _chunkACFYBYZJcjs.linkMark; exports.mapInput = _chunkACFYBYZJcjs.mapInput; exports.mapPaste = _chunkACFYBYZJcjs.mapPaste; exports.mapPasteBlocks = _chunkACFYBYZJcjs.mapPasteBlocks; exports.markExtensions = _chunkACFYBYZJcjs.markExtensions; exports.markloomKit = _chunkACFYBYZJcjs.markloomKit; exports.marksAtCaret = _chunkACFYBYZJcjs.marksAtCaret; exports.mentionMenu = _chunkACFYBYZJcjs.mentionMenu; exports.mergeTextStyleAttrs = _chunkACFYBYZJcjs.mergeTextStyleAttrs; exports.normalizeLinkUrl = _chunkACFYBYZJcjs.normalizeLinkUrl; exports.outdentItem = _chunkACFYBYZJcjs.outdentItem; exports.pointToDom = _chunkI5VK4U7Jcjs.pointToDom; exports.projectDoc = _chunkACFYBYZJcjs.projectDoc; exports.readSelection = _chunkI5VK4U7Jcjs.readSelection; exports.renderCode = _chunkACFYBYZJcjs.renderCode; exports.renderDoc = _chunkACFYBYZJcjs.renderDoc; exports.renderEmbed = _chunkACFYBYZJcjs.renderEmbed; exports.renderHr = _chunkACFYBYZJcjs.renderHr; exports.renderImage = _chunkACFYBYZJcjs.renderImage; exports.renderTable = _chunkACFYBYZJcjs.renderTable; exports.renderToHtml = _chunkACFYBYZJcjs.renderToHtml; exports.resolve = _chunkACFYBYZJcjs.resolve; exports.resolvePaste = _chunkACFYBYZJcjs.resolvePaste; exports.rootEl = _chunkI5VK4U7Jcjs.rootEl; exports.safeCssValue = _chunkACFYBYZJcjs.safeCssValue; exports.selectionCovers = _chunkI5VK4U7Jcjs.selectionCovers; exports.serializeBlock = _chunkACFYBYZJcjs.serializeBlock; exports.serializeSelection = _chunkACFYBYZJcjs.serializeSelection; exports.setAlign = _chunkACFYBYZJcjs.setAlign; exports.setCalloutVariant = _chunkACFYBYZJcjs.setCalloutVariant; exports.setTextStyle = _chunkACFYBYZJcjs.setTextStyle; exports.shikiCodeView = shikiCodeView; exports.slashMenu = _chunkACFYBYZJcjs.slashMenu; exports.soloImgSrcFromHtml = _chunkACFYBYZJcjs.soloImgSrcFromHtml; exports.startAiWrite = _chunkI5VK4U7Jcjs.startAiWrite; exports.strikeMark = _chunkACFYBYZJcjs.strikeMark; exports.subscriptMark = _chunkACFYBYZJcjs.subscriptMark; exports.suggest = _chunkACFYBYZJcjs.suggest; exports.superscriptMark = _chunkACFYBYZJcjs.superscriptMark; exports.tableBlock = _chunkACFYBYZJcjs.tableBlock; exports.textAlign = _chunkACFYBYZJcjs.textAlign; exports.textStyleCss = _chunkACFYBYZJcjs.textStyleCss; exports.textStyleMark = _chunkACFYBYZJcjs.textStyleMark; exports.toggleMark = _chunkACFYBYZJcjs.toggleMark; exports.toggleMarkList = _chunkACFYBYZJcjs.toggleMarkList; exports.tryEmbed = _chunkACFYBYZJcjs.tryEmbed; exports.tryHtmlBlocks = _chunkACFYBYZJcjs.tryHtmlBlocks; exports.tryImageFile = _chunkACFYBYZJcjs.tryImageFile; exports.tryImageUrl = _chunkACFYBYZJcjs.tryImageUrl; exports.tryLinkMark = _chunkACFYBYZJcjs.tryLinkMark; exports.tryLiteral = _chunkACFYBYZJcjs.tryLiteral; exports.tryMarkdown = _chunkACFYBYZJcjs.tryMarkdown; exports.twitchChannel = _chunkACFYBYZJcjs.twitchChannel; exports.typography = typography; exports.underlineMark = _chunkACFYBYZJcjs.underlineMark; exports.wordBoundaryBack = _chunkACFYBYZJcjs.wordBoundaryBack; exports.wordBoundaryFwd = _chunkACFYBYZJcjs.wordBoundaryFwd; exports.wrapList = _chunkACFYBYZJcjs.wrapList; exports.writeSelection = _chunkI5VK4U7Jcjs.writeSelection; exports.youtubeId = _chunkACFYBYZJcjs.youtubeId;
|
package/dist/view/index.d.cts
CHANGED
|
@@ -1,22 +1,95 @@
|
|
|
1
|
-
import { N as NodeView, l as Extension } from '../controller-
|
|
2
|
-
export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as
|
|
3
|
-
import { E as ElementNode,
|
|
4
|
-
import {
|
|
1
|
+
import { N as NodeView, l as Extension } from '../controller-BIOO_XKJ.cjs';
|
|
2
|
+
export { e as AiWriteMode, f as AiWriteSession, m as AtomSelectCtx, B as BlockInputRule, n as BlockKind, o as BlockRenderCtx, p as BlockRenderer, C as CALLOUT_VARIANTS, q as CalloutVariant, D as DecorationFactory, r as DecorationHost, k as Editor, E as EditorOptions, I as InputResult, t as InputRuleCtx, u as Intent, K as KeymapCommand, v as KeymapCtx, w as KeymapResult, x as MentionCandidate, y as MentionHost, z as MentionMenu, F as MentionPopovers, G as MentionPopoversHost, H as MentionProfile, J as NodeViewCtx, P as PasteRule, R as RenderOpts, L as Resolved, S as SlashCommand, T as TextStylePatch, O as atomIsSelected, h as blockPlainText, Q as blockTransform, U as calloutVariantFromQuery, V as caret, W as chord, X as cycleCalloutVariant, Y as defaultBlockRenderers, Z as defaultBlockTag, _ as defaultMarkTag, $ as diffSpan, j as focusBlockId, a0 as indentItem, a1 as isAtom, a2 as isOpaque, a3 as leafText, a4 as lineBoundaryBack, a5 as lineBoundaryFwd, a6 as mapInput, a7 as mapPaste, a8 as mapPasteBlocks, a9 as marksAtCaret, aa as mergeTextStyleAttrs, ab as outdentItem, ac as projectDoc, ad as renderCode, ae as renderDoc, af as renderEmbed, ag as renderHr, ah as renderImage, ai as renderTable, aj as renderToHtml, ak as resolve, al as safeCssValue, am as serializeBlock, an as serializeSelection, ao as setAlign, ap as setCalloutVariant, aq as setTextStyle, s as startAiWrite, ar as textStyleCss, as as toggleMark, at as toggleMarkList, au as twitchChannel, av as wordBoundaryBack, aw as wordBoundaryFwd, ax as wrapList, ay as youtubeId } from '../controller-BIOO_XKJ.cjs';
|
|
3
|
+
import { E as ElementNode, S as Selection, a as Position, N as Node } from '../types-COUweEav.cjs';
|
|
4
|
+
import { S as Step, a as DocVersion } from '../versions-9mG1epfB.cjs';
|
|
5
|
+
import { C as CommentAuthor, c as CommentThread, b as CommentRenderState, T as TextMatch, e as SuggestAuthor, g as SuggestKind } from '../suggest-BkGGiPKA.cjs';
|
|
5
6
|
import 'preact';
|
|
6
|
-
import '../client-
|
|
7
|
+
import '../client-DAth8pPq.cjs';
|
|
7
8
|
|
|
8
9
|
declare function shikiCodeView(highlight: (code: string, lang?: string) => string, langs?: () => string[]): NodeView;
|
|
9
10
|
|
|
10
11
|
declare function rootEl(root: HTMLElement): HTMLElement;
|
|
12
|
+
declare function docExtent(doc: ElementNode): Selection | null;
|
|
13
|
+
declare function selectionCovers(sel: Selection, extent: Selection): boolean;
|
|
11
14
|
declare function pointToDom(root: HTMLElement, doc: ElementNode, pos: Position): {
|
|
12
15
|
node: Node;
|
|
13
16
|
offset: number;
|
|
14
17
|
} | null;
|
|
15
18
|
declare function domToPoint(root: HTMLElement, doc: ElementNode, container: globalThis.Node, domOffset: number): Position | null;
|
|
16
19
|
declare function readSelection(root: HTMLElement, doc: ElementNode): Selection | null;
|
|
17
|
-
declare function writeSelection(root: HTMLElement, doc: ElementNode, selection: Selection
|
|
20
|
+
declare function writeSelection(root: HTMLElement, doc: ElementNode, selection: Selection, opts?: {
|
|
21
|
+
scroll?: boolean;
|
|
22
|
+
}): void;
|
|
18
23
|
declare function elementChildren(el: HTMLElement): HTMLElement[];
|
|
19
24
|
|
|
25
|
+
type PasteContext = {
|
|
26
|
+
inCode: boolean;
|
|
27
|
+
selCollapsed: boolean;
|
|
28
|
+
emptyTopPara: boolean;
|
|
29
|
+
};
|
|
30
|
+
type PasteClipboard = {
|
|
31
|
+
plain: string;
|
|
32
|
+
html: string;
|
|
33
|
+
imageFile: File | null;
|
|
34
|
+
};
|
|
35
|
+
/** 互斥 plan。resolve 产出其一,editor 只 apply。 */
|
|
36
|
+
type PastePlan = {
|
|
37
|
+
kind: 'noop';
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'literal';
|
|
40
|
+
text: string;
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'image-file';
|
|
43
|
+
file: File;
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'image-url';
|
|
46
|
+
url: string;
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'link-mark';
|
|
49
|
+
url: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'embed';
|
|
52
|
+
embedKind: 'youtube' | 'twitch';
|
|
53
|
+
url: string;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'blocks';
|
|
56
|
+
blocks: ElementNode[];
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'markdown';
|
|
59
|
+
text: string;
|
|
60
|
+
};
|
|
61
|
+
/** 格式探测:命中返 Plan,未命中返 null(交给下一优先级)。 */
|
|
62
|
+
type PasteFormat = (ctx: PasteContext, clip: PasteClipboard) => PastePlan | null;
|
|
63
|
+
|
|
64
|
+
/** DataTransfer → 统一载荷。测试可直构造 PasteClipboard。 */
|
|
65
|
+
declare function clipboardFromDataTransfer(dt: DataTransfer | null | undefined): PasteClipboard;
|
|
66
|
+
/** 剪贴板第一个 image/* 文件。 */
|
|
67
|
+
declare function imageFileFrom(dt: DataTransfer | null | undefined): File | null;
|
|
68
|
+
|
|
69
|
+
declare const tryLiteral: PasteFormat;
|
|
70
|
+
/** 无 plain 时从 html 抽可见文本,不塞标签。 */
|
|
71
|
+
declare function htmlToPlainText(html: string): string;
|
|
72
|
+
|
|
73
|
+
declare const tryImageFile: PasteFormat;
|
|
74
|
+
declare const tryImageUrl: PasteFormat;
|
|
75
|
+
/**
|
|
76
|
+
* text/html 整体就是一个 <img>(无旁路文本)→ src。
|
|
77
|
+
* 带文字的富图文返 null,走 blocks。
|
|
78
|
+
*/
|
|
79
|
+
declare function soloImgSrcFromHtml(html: string | undefined): string | null;
|
|
80
|
+
|
|
81
|
+
declare const tryLinkMark: PasteFormat;
|
|
82
|
+
/** trim 后无空白,http(s):// 起头。词法扫。 */
|
|
83
|
+
declare function isBareUrl(s: string): boolean;
|
|
84
|
+
|
|
85
|
+
declare const tryEmbed: PasteFormat;
|
|
86
|
+
|
|
87
|
+
declare const tryHtmlBlocks: PasteFormat;
|
|
88
|
+
|
|
89
|
+
declare const tryMarkdown: PasteFormat;
|
|
90
|
+
|
|
91
|
+
declare function resolvePaste(ctx: PasteContext, clip: PasteClipboard): PastePlan;
|
|
92
|
+
|
|
20
93
|
declare function markloomKit(): Extension[];
|
|
21
94
|
|
|
22
95
|
declare const boldMark: Extension;
|
|
@@ -48,6 +121,8 @@ declare const invisibleCharacters: Extension;
|
|
|
48
121
|
|
|
49
122
|
declare const comments: Extension;
|
|
50
123
|
|
|
124
|
+
declare const suggest: Extension;
|
|
125
|
+
|
|
51
126
|
declare const textAlign: Extension;
|
|
52
127
|
|
|
53
128
|
interface CommentPanelHost {
|
|
@@ -106,16 +181,32 @@ interface AskInputOpts {
|
|
|
106
181
|
/** 返回错误文案则拦确认;返回 null 放行 */
|
|
107
182
|
validate?: (value: string) => string | null;
|
|
108
183
|
}
|
|
109
|
-
interface
|
|
184
|
+
interface AskPopoverOpts {
|
|
110
185
|
/** 锚点选区/按钮 rect;可传函数在定位时再取 */
|
|
111
186
|
anchor: DOMRect | (() => DOMRect);
|
|
112
187
|
placeholder?: string;
|
|
113
188
|
defaultValue?: string;
|
|
114
189
|
confirmLabel?: string;
|
|
190
|
+
ariaLabel?: string;
|
|
191
|
+
multiline?: boolean;
|
|
192
|
+
/** 等宽字体(公式) */
|
|
193
|
+
mono?: boolean;
|
|
194
|
+
/** 输入区宽(px),默认 280 / multiline 320 */
|
|
195
|
+
width?: number;
|
|
196
|
+
rows?: number;
|
|
197
|
+
validate?: (value: string) => string | null;
|
|
198
|
+
/** 确认前变换(链接补协议) */
|
|
199
|
+
normalize?: (value: string) => string;
|
|
200
|
+
/** 允许空串确认;默认 false */
|
|
201
|
+
allowEmpty?: boolean;
|
|
115
202
|
}
|
|
203
|
+
/** @deprecated 用 AskPopoverOpts;保留别名 */
|
|
204
|
+
type AskLinkPopoverOpts = Pick<AskPopoverOpts, 'anchor' | 'placeholder' | 'defaultValue' | 'confirmLabel'>;
|
|
116
205
|
declare function askInput(opts: AskInputOpts): Promise<string | null>;
|
|
117
206
|
/** 无协议时补 https://;空串原样返回 */
|
|
118
207
|
declare function normalizeLinkUrl(raw: string): string;
|
|
208
|
+
declare function askPopover(opts: AskPopoverOpts): Promise<string | null>;
|
|
209
|
+
/** 链接专用:补协议 + 单行 */
|
|
119
210
|
declare function askLinkPopover(opts: AskLinkPopoverOpts): Promise<string | null>;
|
|
120
211
|
/** 测试/销毁:关掉当前弹层 */
|
|
121
212
|
declare function closeAskInput(): void;
|
|
@@ -135,23 +226,124 @@ interface TocPanelHost {
|
|
|
135
226
|
}
|
|
136
227
|
declare class TocPanel {
|
|
137
228
|
private host;
|
|
229
|
+
private shell;
|
|
138
230
|
private rail;
|
|
139
231
|
private open;
|
|
140
232
|
private activeId;
|
|
141
233
|
private entries;
|
|
142
234
|
private scrollRoot;
|
|
235
|
+
private parentEl;
|
|
236
|
+
private fill;
|
|
237
|
+
private padEl;
|
|
238
|
+
/** 判定线:滚动容器顶 + 偏移;jump / sync 共用 */
|
|
239
|
+
private markOffset;
|
|
143
240
|
constructor(host: TocPanelHost);
|
|
144
241
|
destroy(): void;
|
|
145
242
|
setOpen(open: boolean): void;
|
|
146
|
-
private setPadOpen;
|
|
147
243
|
private onRedraw;
|
|
148
|
-
private refresh;
|
|
149
244
|
private onScroll;
|
|
150
|
-
|
|
245
|
+
private onResize;
|
|
246
|
+
private refresh;
|
|
247
|
+
/** 留白挂在滚动容器上(在全部子节点之后),避免夹在正文与页脚/prev-next 之间 */
|
|
248
|
+
private padTarget;
|
|
249
|
+
/**
|
|
250
|
+
* 文末可滚空间:让最后一个标题也能对齐顶线。
|
|
251
|
+
* 有了它,慢滚 / 点末项都走同一套「越过顶线」规则,无需触底特判。
|
|
252
|
+
*/
|
|
253
|
+
private ensureEndScrollRoom;
|
|
254
|
+
private clearEndScrollRoom;
|
|
151
255
|
private syncActive;
|
|
152
256
|
private headingEl;
|
|
153
257
|
private jump;
|
|
258
|
+
/**
|
|
259
|
+
* 长目录时 TOC 自身是滚轴:正文 scroll-spy 换了 active,
|
|
260
|
+
* 若该项在目录视口外则只滚 TOC 容器,不带动正文。
|
|
261
|
+
*/
|
|
262
|
+
private revealActiveInRail;
|
|
263
|
+
private paint;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
type SearchBarHost = {
|
|
267
|
+
root: HTMLElement;
|
|
268
|
+
doc: () => ElementNode;
|
|
269
|
+
dispatch: (steps: Step[], selectionAfter?: Selection) => void;
|
|
270
|
+
readonly: () => boolean;
|
|
271
|
+
focusMatch: (m: TextMatch) => void;
|
|
272
|
+
};
|
|
273
|
+
declare class SearchBar {
|
|
274
|
+
private host;
|
|
275
|
+
private el;
|
|
276
|
+
private open_;
|
|
277
|
+
private q;
|
|
278
|
+
private r;
|
|
279
|
+
private caseSensitive;
|
|
280
|
+
private hits;
|
|
281
|
+
private idx;
|
|
282
|
+
constructor(host: SearchBarHost);
|
|
283
|
+
open(): void;
|
|
284
|
+
close(): void;
|
|
285
|
+
get isOpen(): boolean;
|
|
286
|
+
destroy(): void;
|
|
287
|
+
rescan(): void;
|
|
288
|
+
private refresh;
|
|
289
|
+
private go;
|
|
290
|
+
private doReplaceOne;
|
|
291
|
+
private doReplaceAll;
|
|
292
|
+
private paint;
|
|
293
|
+
private onBarKey;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
type VersionsPanelHost = {
|
|
297
|
+
root: HTMLElement;
|
|
298
|
+
doc: () => ElementNode;
|
|
299
|
+
list: () => DocVersion[];
|
|
300
|
+
save: (name?: string) => DocVersion;
|
|
301
|
+
restore: (id: string) => boolean;
|
|
302
|
+
remove: (id: string) => boolean;
|
|
303
|
+
readonly: () => boolean;
|
|
304
|
+
};
|
|
305
|
+
declare class VersionsPanel {
|
|
306
|
+
private host;
|
|
307
|
+
private el;
|
|
308
|
+
private open;
|
|
309
|
+
private onRedraw;
|
|
310
|
+
constructor(host: VersionsPanelHost);
|
|
311
|
+
destroy(): void;
|
|
312
|
+
show(): void;
|
|
313
|
+
hide(): void;
|
|
314
|
+
toggle(): void;
|
|
315
|
+
private onKey;
|
|
316
|
+
private paint;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
type SuggestBarHost = {
|
|
320
|
+
root: HTMLElement;
|
|
321
|
+
doc: () => ElementNode;
|
|
322
|
+
dispatch: (steps: Step[], selectionAfter?: Selection) => void;
|
|
323
|
+
markSel: () => Selection | null;
|
|
324
|
+
author: () => SuggestAuthor;
|
|
325
|
+
newId: () => string;
|
|
326
|
+
readonly: () => boolean;
|
|
327
|
+
tracking: () => boolean;
|
|
328
|
+
setTracking: (on: boolean) => void;
|
|
329
|
+
};
|
|
330
|
+
declare class SuggestBar {
|
|
331
|
+
private host;
|
|
332
|
+
private el;
|
|
333
|
+
private open;
|
|
334
|
+
private onRedraw;
|
|
335
|
+
constructor(host: SuggestBarHost);
|
|
336
|
+
destroy(): void;
|
|
337
|
+
show(): void;
|
|
338
|
+
hide(): void;
|
|
339
|
+
toggle(): void;
|
|
340
|
+
rescan(): void;
|
|
341
|
+
/** 选区标建议(insert|delete) */
|
|
342
|
+
markSelection(kind: SuggestKind): boolean;
|
|
343
|
+
accept(id: string): void;
|
|
344
|
+
reject(id: string): void;
|
|
345
|
+
private onKey;
|
|
154
346
|
private paint;
|
|
155
347
|
}
|
|
156
348
|
|
|
157
|
-
export { type AskInputOpts, type AskLinkPopoverOpts, CommentPanel, type CommentPanelHost, Extension, NodeView, TocPanel, type TocPanelHost, askInput, askLinkPopover, blockExtensions, boldMark, bubbleMenu, closeAskInput, codeBlock, codeControls, codeMark, comments, decorationExtensions, domToPoint, dragHandle, elementChildren, embedBlock, emoji, highlightMark, history, hrBlock, imageBlock, inputRules, invisibleCharacters, italicMark, linkMark, markExtensions, markloomKit, mentionMenu, normalizeLinkUrl, pointToDom, readSelection, rootEl, shikiCodeView, slashMenu, strikeMark, subscriptMark, superscriptMark, tableBlock, textAlign, textStyleMark, typography, underlineMark, writeSelection };
|
|
349
|
+
export { type AskInputOpts, type AskLinkPopoverOpts, type AskPopoverOpts, CommentPanel, type CommentPanelHost, Extension, NodeView, type PasteClipboard, type PasteContext, type PasteFormat, type PastePlan, SearchBar, type SearchBarHost, SuggestBar, type SuggestBarHost, TocPanel, type TocPanelHost, VersionsPanel, type VersionsPanelHost, askInput, askLinkPopover, askPopover, blockExtensions, boldMark, bubbleMenu, clipboardFromDataTransfer, closeAskInput, codeBlock, codeControls, codeMark, comments, decorationExtensions, docExtent, domToPoint, dragHandle, elementChildren, embedBlock, emoji, highlightMark, history, hrBlock, htmlToPlainText, imageBlock, imageFileFrom, inputRules, invisibleCharacters, isBareUrl, italicMark, linkMark, markExtensions, markloomKit, mentionMenu, normalizeLinkUrl, pointToDom, readSelection, resolvePaste, rootEl, selectionCovers, shikiCodeView, slashMenu, soloImgSrcFromHtml, strikeMark, subscriptMark, suggest, superscriptMark, tableBlock, textAlign, textStyleMark, tryEmbed, tryHtmlBlocks, tryImageFile, tryImageUrl, tryLinkMark, tryLiteral, tryMarkdown, typography, underlineMark, writeSelection };
|