markloom 0.3.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/README.md +125 -0
- package/dist/ai/index.cjs +19 -0
- package/dist/ai/index.d.cts +10 -0
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.js +19 -0
- package/dist/ai/theme.css +304 -0
- package/dist/chunk-2X6AF7XH.cjs +9030 -0
- package/dist/chunk-7Q6AXLF2.cjs +1076 -0
- package/dist/chunk-GUPMZI6Q.js +1076 -0
- package/dist/chunk-HA6XHJUD.cjs +218 -0
- package/dist/chunk-ITVAR2UM.js +218 -0
- package/dist/chunk-J3QWW6CN.js +2305 -0
- package/dist/chunk-UCNEQGMY.js +9030 -0
- package/dist/chunk-VVFIQLVR.cjs +2305 -0
- package/dist/comments-USjT1wYN.d.cts +105 -0
- package/dist/comments-USjT1wYN.d.ts +105 -0
- package/dist/controller-Dm4uLD3I.d.ts +507 -0
- package/dist/controller-cE9iEYp3.d.cts +507 -0
- package/dist/index.cjs +424 -0
- package/dist/index.d.cts +184 -0
- package/dist/index.d.ts +184 -0
- package/dist/index.js +424 -0
- package/dist/react/index.cjs +45 -0
- package/dist/react/index.d.cts +22 -0
- package/dist/react/index.d.ts +22 -0
- package/dist/react/index.js +45 -0
- package/dist/view/index.cjs +368 -0
- package/dist/view/index.d.cts +155 -0
- package/dist/view/index.d.ts +155 -0
- package/dist/view/index.js +368 -0
- package/dist/view/theme.css +2627 -0
- package/package.json +89 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Editor
|
|
3
|
+
} from "../chunk-UCNEQGMY.js";
|
|
4
|
+
import "../chunk-ITVAR2UM.js";
|
|
5
|
+
import "../chunk-GUPMZI6Q.js";
|
|
6
|
+
import "../chunk-J3QWW6CN.js";
|
|
7
|
+
|
|
8
|
+
// src/react/index.ts
|
|
9
|
+
import { createElement, useEffect, useRef, useState } from "react";
|
|
10
|
+
function useLoom(initialDoc, opts = {}) {
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const editorRef = useRef(null);
|
|
13
|
+
const [doc, setDoc] = useState(initialDoc);
|
|
14
|
+
const optsRef = useRef(opts);
|
|
15
|
+
optsRef.current = opts;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const host = ref.current;
|
|
18
|
+
if (!host)
|
|
19
|
+
return;
|
|
20
|
+
const ed = new Editor(host, initialDoc, {
|
|
21
|
+
...optsRef.current,
|
|
22
|
+
onChange: (d) => {
|
|
23
|
+
setDoc(d);
|
|
24
|
+
optsRef.current.onChange?.(d);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
editorRef.current = ed;
|
|
28
|
+
return () => {
|
|
29
|
+
ed.destroy();
|
|
30
|
+
editorRef.current = null;
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
editorRef.current?.setEditable(opts.editable ?? true);
|
|
35
|
+
}, [opts.editable]);
|
|
36
|
+
return { ref, editor: editorRef, doc };
|
|
37
|
+
}
|
|
38
|
+
function Loom({ doc, className, style, ...opts }) {
|
|
39
|
+
const { ref } = useLoom(doc, opts);
|
|
40
|
+
return createElement("div", { ref, className, style });
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
Loom,
|
|
44
|
+
useLoom
|
|
45
|
+
};
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
var _chunk2X6AF7XHcjs = require('../chunk-2X6AF7XH.cjs');
|
|
83
|
+
require('../chunk-HA6XHJUD.cjs');
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
var _chunk7Q6AXLF2cjs = require('../chunk-7Q6AXLF2.cjs');
|
|
95
|
+
require('../chunk-VVFIQLVR.cjs');
|
|
96
|
+
|
|
97
|
+
// src/view/shiki-code-view.ts
|
|
98
|
+
var _preact = require('preact');
|
|
99
|
+
function shikiCodeView(highlight, langs) {
|
|
100
|
+
return {
|
|
101
|
+
langs,
|
|
102
|
+
render(ctx) {
|
|
103
|
+
const lang = _optionalChain([ctx, 'access', _ => _.node, 'access', _2 => _2.attrs, 'optionalAccess', _3 => _3.lang]);
|
|
104
|
+
const leaf = _preact.h.call(void 0, "div", {
|
|
105
|
+
"key": 0,
|
|
106
|
+
"data-leaf": 0,
|
|
107
|
+
"data-code-hl": "",
|
|
108
|
+
// 标记:此叶是多 text 节点拼接,selection 按全文 offset 走
|
|
109
|
+
"dangerouslySetInnerHTML": { __html: anchorEmptyLines(highlight(ctx.text, lang)) }
|
|
110
|
+
});
|
|
111
|
+
const copy = _preact.h.call(void 0, "button", { "key": "copy", "data-copy": "", "type": "button", "contentEditable": "false", "tabIndex": -1, "aria-label": "\u590D\u5236\u4EE3\u7801" });
|
|
112
|
+
const langBtn = _preact.h.call(void 0, "button", { "key": "lang", "data-code-lang": "", "type": "button", "contentEditable": "false", "tabIndex": -1 }, lang || "\u7EAF\u6587\u672C");
|
|
113
|
+
return _preact.h.call(void 0, "div", { "key": ctx.key, "data-block-id": _nullishCoalesce(ctx.node.id, () => ( "")), "data-code-block": "" }, [langBtn, copy, leaf]);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function anchorEmptyLines(html) {
|
|
118
|
+
if (typeof DOMParser === "undefined")
|
|
119
|
+
return html;
|
|
120
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
121
|
+
const pre = doc.body.firstElementChild;
|
|
122
|
+
if (!pre)
|
|
123
|
+
return html;
|
|
124
|
+
for (const line of pre.querySelectorAll("span.line")) {
|
|
125
|
+
if (_optionalChain([line, 'access', _4 => _4.textContent, 'optionalAccess', _5 => _5.length]))
|
|
126
|
+
continue;
|
|
127
|
+
const inner = _nullishCoalesce(line.firstElementChild, () => ( line));
|
|
128
|
+
inner.appendChild(doc.createTextNode("\u200B"));
|
|
129
|
+
}
|
|
130
|
+
return pre.outerHTML;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/view/extensions/typography.ts
|
|
134
|
+
var SUBS = [
|
|
135
|
+
{ trigger: "-", from: "--", to: "\u2014" },
|
|
136
|
+
// 两个连字符 → em dash
|
|
137
|
+
{ trigger: ".", from: "...", to: "\u2026" },
|
|
138
|
+
// 三点 → 省略号
|
|
139
|
+
{ trigger: ">", from: "->", to: "\u2192" },
|
|
140
|
+
{ trigger: "-", from: "<-", to: "\u2190" },
|
|
141
|
+
// 注:'<' 已在,打 '-' 触发(trigger='-' 与 -- 同触发,下方按 from 尾字符分流)
|
|
142
|
+
{ trigger: ")", from: "(c)", to: "\xA9" },
|
|
143
|
+
{ trigger: ")", from: "(r)", to: "\xAE" },
|
|
144
|
+
{ trigger: ")", from: "(tm)", to: "\u2122" },
|
|
145
|
+
{ trigger: "2", from: "1/2", to: "\xBD" },
|
|
146
|
+
{ trigger: "4", from: "1/4", to: "\xBC" },
|
|
147
|
+
{ trigger: "4", from: "3/4", to: "\xBE" }
|
|
148
|
+
];
|
|
149
|
+
function subRule() {
|
|
150
|
+
return {
|
|
151
|
+
match: (ctx) => {
|
|
152
|
+
if (ctx.block.type === "code")
|
|
153
|
+
return null;
|
|
154
|
+
const combined = ctx.marker + ctx.trigger;
|
|
155
|
+
for (const s of SUBS) {
|
|
156
|
+
if (s.trigger !== ctx.trigger || !combined.endsWith(s.from))
|
|
157
|
+
continue;
|
|
158
|
+
const eaten = s.from.length - 1;
|
|
159
|
+
const at = ctx.offset - eaten;
|
|
160
|
+
if (at < 0)
|
|
161
|
+
return null;
|
|
162
|
+
const steps = [
|
|
163
|
+
{ kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
|
|
164
|
+
{ kind: "insertText", path: ctx.leafPath, offset: at, text: s.to }
|
|
165
|
+
];
|
|
166
|
+
return { steps, selection: _chunk2X6AF7XHcjs.caret.call(void 0, ctx.leafPath.concat(at + s.to.length)) };
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function quoteRule(quote, open, close) {
|
|
173
|
+
return {
|
|
174
|
+
match: (ctx) => {
|
|
175
|
+
if (ctx.block.type === "code" || ctx.trigger !== quote)
|
|
176
|
+
return null;
|
|
177
|
+
const prev = ctx.marker.slice(-1);
|
|
178
|
+
const to = prev === "" || prev === " " || prev === "\n" || prev === " " || prev === "(" || prev === "[" || prev === "{" ? open : close;
|
|
179
|
+
const steps = [{ kind: "insertText", path: ctx.leafPath, offset: ctx.offset, text: to }];
|
|
180
|
+
return { steps, selection: _chunk2X6AF7XHcjs.caret.call(void 0, ctx.leafPath.concat(ctx.offset + to.length)) };
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
var typography = {
|
|
185
|
+
name: "typography",
|
|
186
|
+
inputRules: [subRule(), quoteRule('"', "\u201C", "\u201D"), quoteRule("'", "\u2018", "\u2019")]
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// src/view/extensions/emoji.ts
|
|
190
|
+
var MAP = {
|
|
191
|
+
smile: "\u{1F604}",
|
|
192
|
+
smiling: "\u{1F60A}",
|
|
193
|
+
grin: "\u{1F601}",
|
|
194
|
+
joy: "\u{1F602}",
|
|
195
|
+
rofl: "\u{1F923}",
|
|
196
|
+
wink: "\u{1F609}",
|
|
197
|
+
blush: "\u{1F60A}",
|
|
198
|
+
heart: "\u2764\uFE0F",
|
|
199
|
+
hearts: "\u{1F495}",
|
|
200
|
+
fire: "\u{1F525}",
|
|
201
|
+
thumbsup: "\u{1F44D}",
|
|
202
|
+
thumbsdown: "\u{1F44E}",
|
|
203
|
+
ok: "\u{1F44C}",
|
|
204
|
+
clap: "\u{1F44F}",
|
|
205
|
+
tada: "\u{1F389}",
|
|
206
|
+
rocket: "\u{1F680}",
|
|
207
|
+
star: "\u2B50",
|
|
208
|
+
sparkles: "\u2728",
|
|
209
|
+
check: "\u2705",
|
|
210
|
+
x: "\u274C",
|
|
211
|
+
warning: "\u26A0\uFE0F",
|
|
212
|
+
eyes: "\u{1F440}",
|
|
213
|
+
thinking: "\u{1F914}",
|
|
214
|
+
wave: "\u{1F44B}",
|
|
215
|
+
pray: "\u{1F64F}",
|
|
216
|
+
muscle: "\u{1F4AA}",
|
|
217
|
+
coffee: "\u2615",
|
|
218
|
+
pizza: "\u{1F355}",
|
|
219
|
+
100: "\u{1F4AF}",
|
|
220
|
+
poop: "\u{1F4A9}",
|
|
221
|
+
skull: "\u{1F480}",
|
|
222
|
+
ghost: "\u{1F47B}",
|
|
223
|
+
robot: "\u{1F916}",
|
|
224
|
+
cat: "\u{1F431}",
|
|
225
|
+
dog: "\u{1F436}"
|
|
226
|
+
};
|
|
227
|
+
function emojiRule() {
|
|
228
|
+
return {
|
|
229
|
+
match: (ctx) => {
|
|
230
|
+
if (ctx.block.type === "code" || ctx.trigger !== ":")
|
|
231
|
+
return null;
|
|
232
|
+
const m = ctx.marker;
|
|
233
|
+
let colon = -1;
|
|
234
|
+
for (let i = m.length - 1; i >= 0; i--) {
|
|
235
|
+
if (m[i] === ":") {
|
|
236
|
+
colon = i;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (colon < 0)
|
|
241
|
+
return null;
|
|
242
|
+
const name = m.slice(colon + 1);
|
|
243
|
+
if (!name || name.includes(" ") || name.includes("\n"))
|
|
244
|
+
return null;
|
|
245
|
+
const glyph = MAP[name];
|
|
246
|
+
if (!glyph)
|
|
247
|
+
return null;
|
|
248
|
+
const eaten = name.length + 1;
|
|
249
|
+
const at = ctx.offset - eaten;
|
|
250
|
+
if (at < 0)
|
|
251
|
+
return null;
|
|
252
|
+
const steps = [
|
|
253
|
+
{ kind: "deleteText", path: ctx.leafPath, offset: at, length: eaten },
|
|
254
|
+
{ kind: "insertText", path: ctx.leafPath, offset: at, text: glyph }
|
|
255
|
+
];
|
|
256
|
+
return { steps, selection: _chunk2X6AF7XHcjs.caret.call(void 0, ctx.leafPath.concat(at + glyph.length)) };
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
var emoji = {
|
|
261
|
+
name: "emoji",
|
|
262
|
+
inputRules: [emojiRule()]
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/view/extensions/invisible-characters.ts
|
|
266
|
+
var invisibleCharacters = { name: "invisibleCharacters" };
|
|
267
|
+
|
|
268
|
+
// src/view/extensions/comments.ts
|
|
269
|
+
var comments = {
|
|
270
|
+
name: "comments",
|
|
271
|
+
marks: [{ name: "comment", tag: "span" }]
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
exports.CALLOUT_VARIANTS = _chunk2X6AF7XHcjs.CALLOUT_VARIANTS; exports.CommentPanel = _chunk2X6AF7XHcjs.CommentPanel; exports.Editor = _chunk2X6AF7XHcjs.Editor; exports.MentionMenu = _chunk2X6AF7XHcjs.MentionMenu; exports.MentionPopovers = _chunk2X6AF7XHcjs.MentionPopovers; exports.TocPanel = _chunk2X6AF7XHcjs.TocPanel; exports.askInput = _chunk2X6AF7XHcjs.askInput; exports.askLinkPopover = _chunk2X6AF7XHcjs.askLinkPopover; exports.atomIsSelected = _chunk2X6AF7XHcjs.atomIsSelected; exports.blockExtensions = _chunk2X6AF7XHcjs.blockExtensions; exports.blockPlainText = _chunk7Q6AXLF2cjs.blockPlainText; exports.blockTransform = _chunk2X6AF7XHcjs.blockTransform; exports.boldMark = _chunk2X6AF7XHcjs.boldMark; exports.bubbleMenu = _chunk2X6AF7XHcjs.bubbleMenu; exports.calloutVariantFromQuery = _chunk2X6AF7XHcjs.calloutVariantFromQuery; exports.caret = _chunk2X6AF7XHcjs.caret; exports.chord = _chunk2X6AF7XHcjs.chord; exports.closeAskInput = _chunk2X6AF7XHcjs.closeAskInput; exports.codeBlock = _chunk2X6AF7XHcjs.codeBlock; exports.codeControls = _chunk2X6AF7XHcjs.codeControls; exports.codeMark = _chunk2X6AF7XHcjs.codeMark; exports.comments = comments; exports.cycleCalloutVariant = _chunk2X6AF7XHcjs.cycleCalloutVariant; exports.decorationExtensions = _chunk2X6AF7XHcjs.decorationExtensions; exports.defaultBlockRenderers = _chunk2X6AF7XHcjs.defaultBlockRenderers; exports.defaultBlockTag = _chunk2X6AF7XHcjs.defaultBlockTag; exports.defaultMarkTag = _chunk2X6AF7XHcjs.defaultMarkTag; exports.diffSpan = _chunk2X6AF7XHcjs.diffSpan; exports.domToPoint = _chunk7Q6AXLF2cjs.domToPoint; exports.dragHandle = _chunk2X6AF7XHcjs.dragHandle; exports.elementChildren = _chunk7Q6AXLF2cjs.elementChildren; exports.embedBlock = _chunk2X6AF7XHcjs.embedBlock; exports.emoji = emoji; exports.focusBlockId = _chunk7Q6AXLF2cjs.focusBlockId; exports.highlightMark = _chunk2X6AF7XHcjs.highlightMark; exports.history = _chunk2X6AF7XHcjs.history; exports.hrBlock = _chunk2X6AF7XHcjs.hrBlock; exports.imageBlock = _chunk2X6AF7XHcjs.imageBlock; exports.indentItem = _chunk2X6AF7XHcjs.indentItem; exports.inputRules = _chunk2X6AF7XHcjs.inputRules; exports.invisibleCharacters = invisibleCharacters; exports.isAtom = _chunk2X6AF7XHcjs.isAtom; exports.isOpaque = _chunk2X6AF7XHcjs.isOpaque; exports.italicMark = _chunk2X6AF7XHcjs.italicMark; exports.leafText = _chunk2X6AF7XHcjs.leafText; exports.lineBoundaryBack = _chunk2X6AF7XHcjs.lineBoundaryBack; exports.lineBoundaryFwd = _chunk2X6AF7XHcjs.lineBoundaryFwd; exports.linkMark = _chunk2X6AF7XHcjs.linkMark; exports.loomKit = _chunk2X6AF7XHcjs.loomKit; exports.mapInput = _chunk2X6AF7XHcjs.mapInput; exports.mapPaste = _chunk2X6AF7XHcjs.mapPaste; exports.mapPasteBlocks = _chunk2X6AF7XHcjs.mapPasteBlocks; exports.markExtensions = _chunk2X6AF7XHcjs.markExtensions; exports.marksAtCaret = _chunk2X6AF7XHcjs.marksAtCaret; exports.mentionMenu = _chunk2X6AF7XHcjs.mentionMenu; exports.mergeTextStyleAttrs = _chunk2X6AF7XHcjs.mergeTextStyleAttrs; exports.normalizeLinkUrl = _chunk2X6AF7XHcjs.normalizeLinkUrl; exports.outdentItem = _chunk2X6AF7XHcjs.outdentItem; exports.pointToDom = _chunk7Q6AXLF2cjs.pointToDom; exports.readSelection = _chunk7Q6AXLF2cjs.readSelection; exports.renderCode = _chunk2X6AF7XHcjs.renderCode; exports.renderDoc = _chunk2X6AF7XHcjs.renderDoc; exports.renderEmbed = _chunk2X6AF7XHcjs.renderEmbed; exports.renderHr = _chunk2X6AF7XHcjs.renderHr; exports.renderImage = _chunk2X6AF7XHcjs.renderImage; exports.renderTable = _chunk2X6AF7XHcjs.renderTable; exports.renderToHtml = _chunk2X6AF7XHcjs.renderToHtml; exports.resolve = _chunk2X6AF7XHcjs.resolve; exports.rootEl = _chunk7Q6AXLF2cjs.rootEl; exports.safeCssValue = _chunk2X6AF7XHcjs.safeCssValue; exports.serializeSelection = _chunk2X6AF7XHcjs.serializeSelection; exports.setAlign = _chunk2X6AF7XHcjs.setAlign; exports.setCalloutVariant = _chunk2X6AF7XHcjs.setCalloutVariant; exports.setTextStyle = _chunk2X6AF7XHcjs.setTextStyle; exports.shikiCodeView = shikiCodeView; exports.slashMenu = _chunk2X6AF7XHcjs.slashMenu; exports.startAiWrite = _chunk7Q6AXLF2cjs.startAiWrite; exports.strikeMark = _chunk2X6AF7XHcjs.strikeMark; exports.subscriptMark = _chunk2X6AF7XHcjs.subscriptMark; exports.superscriptMark = _chunk2X6AF7XHcjs.superscriptMark; exports.tableBlock = _chunk2X6AF7XHcjs.tableBlock; exports.textAlign = _chunk2X6AF7XHcjs.textAlign; exports.textStyleCss = _chunk2X6AF7XHcjs.textStyleCss; exports.textStyleMark = _chunk2X6AF7XHcjs.textStyleMark; exports.toggleMark = _chunk2X6AF7XHcjs.toggleMark; exports.toggleMarkList = _chunk2X6AF7XHcjs.toggleMarkList; exports.twitchChannel = _chunk2X6AF7XHcjs.twitchChannel; exports.typography = typography; exports.underlineMark = _chunk2X6AF7XHcjs.underlineMark; exports.wordBoundaryBack = _chunk2X6AF7XHcjs.wordBoundaryBack; exports.wordBoundaryFwd = _chunk2X6AF7XHcjs.wordBoundaryFwd; exports.wrapList = _chunk2X6AF7XHcjs.wrapList; exports.writeSelection = _chunk7Q6AXLF2cjs.writeSelection; exports.youtubeId = _chunk2X6AF7XHcjs.youtubeId;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { N as NodeView, l as Extension } from '../controller-cE9iEYp3.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, M as MentionCandidate, x as MentionHost, y as MentionMenu, z as MentionPopovers, F as MentionPopoversHost, G as MentionProfile, H as NodeViewCtx, P as PasteRule, R as RenderOpts, J 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 renderCode, ad as renderDoc, ae as renderEmbed, af as renderHr, ag as renderImage, ah as renderTable, ai as renderToHtml, aj as resolve, ak as safeCssValue, al as serializeSelection, am as setAlign, an as setCalloutVariant, ao as setTextStyle, s as startAiWrite, ap as textStyleCss, aq as toggleMark, ar as toggleMarkList, as as twitchChannel, at as wordBoundaryBack, au as wordBoundaryFwd, av as wrapList, aw as youtubeId } from '../controller-cE9iEYp3.cjs';
|
|
3
|
+
import { E as ElementNode, a as Position, N as Node, g as Selection, S as Step, C as CommentAuthor, d as CommentThread, c as CommentRenderState } from '../comments-USjT1wYN.cjs';
|
|
4
|
+
import 'preact';
|
|
5
|
+
|
|
6
|
+
declare function shikiCodeView(highlight: (code: string, lang?: string) => string, langs?: () => string[]): NodeView;
|
|
7
|
+
|
|
8
|
+
declare function rootEl(root: HTMLElement): HTMLElement;
|
|
9
|
+
declare function pointToDom(root: HTMLElement, doc: ElementNode, pos: Position): {
|
|
10
|
+
node: Node;
|
|
11
|
+
offset: number;
|
|
12
|
+
} | null;
|
|
13
|
+
declare function domToPoint(root: HTMLElement, doc: ElementNode, container: globalThis.Node, domOffset: number): Position | null;
|
|
14
|
+
declare function readSelection(root: HTMLElement, doc: ElementNode): Selection | null;
|
|
15
|
+
declare function writeSelection(root: HTMLElement, doc: ElementNode, selection: Selection): void;
|
|
16
|
+
declare function elementChildren(el: HTMLElement): HTMLElement[];
|
|
17
|
+
|
|
18
|
+
declare function loomKit(): Extension[];
|
|
19
|
+
|
|
20
|
+
declare const boldMark: Extension;
|
|
21
|
+
declare const italicMark: Extension;
|
|
22
|
+
declare const codeMark: Extension;
|
|
23
|
+
declare const strikeMark: Extension;
|
|
24
|
+
declare const underlineMark: Extension;
|
|
25
|
+
declare const highlightMark: Extension;
|
|
26
|
+
declare const superscriptMark: Extension;
|
|
27
|
+
declare const subscriptMark: Extension;
|
|
28
|
+
declare const linkMark: Extension;
|
|
29
|
+
declare const textStyleMark: Extension;
|
|
30
|
+
declare const markExtensions: Extension[];
|
|
31
|
+
|
|
32
|
+
declare const tableBlock: Extension;
|
|
33
|
+
declare const codeBlock: Extension;
|
|
34
|
+
declare const imageBlock: Extension;
|
|
35
|
+
declare const embedBlock: Extension;
|
|
36
|
+
declare const hrBlock: Extension;
|
|
37
|
+
declare const blockExtensions: Extension[];
|
|
38
|
+
|
|
39
|
+
declare const inputRules: Extension;
|
|
40
|
+
|
|
41
|
+
declare const typography: Extension;
|
|
42
|
+
|
|
43
|
+
declare const emoji: Extension;
|
|
44
|
+
|
|
45
|
+
declare const invisibleCharacters: Extension;
|
|
46
|
+
|
|
47
|
+
declare const comments: Extension;
|
|
48
|
+
|
|
49
|
+
declare const textAlign: Extension;
|
|
50
|
+
|
|
51
|
+
interface CommentPanelHost {
|
|
52
|
+
root: HTMLElement;
|
|
53
|
+
doc: () => ElementNode;
|
|
54
|
+
dispatch: (steps: Step[], selectionAfter?: Selection) => void;
|
|
55
|
+
markSel: () => Selection | null;
|
|
56
|
+
author: () => CommentAuthor;
|
|
57
|
+
newId: () => string;
|
|
58
|
+
redraw: () => void;
|
|
59
|
+
onChange?: (threads: CommentThread[]) => void;
|
|
60
|
+
readonly: () => boolean;
|
|
61
|
+
}
|
|
62
|
+
declare class CommentPanel {
|
|
63
|
+
private host;
|
|
64
|
+
private overlay;
|
|
65
|
+
/** 与正文共用的滚动容器(找不到则 body + window 滚) */
|
|
66
|
+
private scrollRoot;
|
|
67
|
+
private threads;
|
|
68
|
+
private activeId;
|
|
69
|
+
private mode;
|
|
70
|
+
private showResolved;
|
|
71
|
+
constructor(host: CommentPanelHost, initial?: CommentThread[]);
|
|
72
|
+
destroy(): void;
|
|
73
|
+
getThreads(): CommentThread[];
|
|
74
|
+
setThreads(threads: CommentThread[]): void;
|
|
75
|
+
renderState(): CommentRenderState;
|
|
76
|
+
beginCompose(): void;
|
|
77
|
+
openThread(id: string): void;
|
|
78
|
+
openList(): void;
|
|
79
|
+
close(): void;
|
|
80
|
+
private commitThreads;
|
|
81
|
+
private onRootClick;
|
|
82
|
+
private onKey;
|
|
83
|
+
private onReflow;
|
|
84
|
+
private submitCompose;
|
|
85
|
+
private reply;
|
|
86
|
+
private toggleResolve;
|
|
87
|
+
private deleteThread;
|
|
88
|
+
private visibleThreads;
|
|
89
|
+
/** 卡片 top(相对 rail-body)。正文与栏共滚 → viewport 差即内容坐标。 */
|
|
90
|
+
private cardTops;
|
|
91
|
+
private reflowAfterPaint;
|
|
92
|
+
private paint;
|
|
93
|
+
private threadCard;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface AskInputOpts {
|
|
97
|
+
title: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
placeholder?: string;
|
|
100
|
+
defaultValue?: string;
|
|
101
|
+
confirmLabel?: string;
|
|
102
|
+
cancelLabel?: string;
|
|
103
|
+
multiline?: boolean;
|
|
104
|
+
/** 返回错误文案则拦确认;返回 null 放行 */
|
|
105
|
+
validate?: (value: string) => string | null;
|
|
106
|
+
}
|
|
107
|
+
interface AskLinkPopoverOpts {
|
|
108
|
+
/** 锚点选区/按钮 rect;可传函数在定位时再取 */
|
|
109
|
+
anchor: DOMRect | (() => DOMRect);
|
|
110
|
+
placeholder?: string;
|
|
111
|
+
defaultValue?: string;
|
|
112
|
+
confirmLabel?: string;
|
|
113
|
+
}
|
|
114
|
+
declare function askInput(opts: AskInputOpts): Promise<string | null>;
|
|
115
|
+
/** 无协议时补 https://;空串原样返回 */
|
|
116
|
+
declare function normalizeLinkUrl(raw: string): string;
|
|
117
|
+
declare function askLinkPopover(opts: AskLinkPopoverOpts): Promise<string | null>;
|
|
118
|
+
/** 测试/销毁:关掉当前弹层 */
|
|
119
|
+
declare function closeAskInput(): void;
|
|
120
|
+
|
|
121
|
+
declare const history: Extension;
|
|
122
|
+
|
|
123
|
+
declare const codeControls: Extension;
|
|
124
|
+
declare const bubbleMenu: Extension;
|
|
125
|
+
declare const slashMenu: Extension;
|
|
126
|
+
declare const mentionMenu: Extension;
|
|
127
|
+
declare const dragHandle: Extension;
|
|
128
|
+
declare const decorationExtensions: Extension[];
|
|
129
|
+
|
|
130
|
+
interface TocPanelHost {
|
|
131
|
+
root: HTMLElement;
|
|
132
|
+
doc: () => ElementNode;
|
|
133
|
+
}
|
|
134
|
+
declare class TocPanel {
|
|
135
|
+
private host;
|
|
136
|
+
private rail;
|
|
137
|
+
private open;
|
|
138
|
+
private activeId;
|
|
139
|
+
private entries;
|
|
140
|
+
private scrollRoot;
|
|
141
|
+
constructor(host: TocPanelHost);
|
|
142
|
+
destroy(): void;
|
|
143
|
+
setOpen(open: boolean): void;
|
|
144
|
+
private setPadOpen;
|
|
145
|
+
private onRedraw;
|
|
146
|
+
private refresh;
|
|
147
|
+
private onScroll;
|
|
148
|
+
/** 视口上 1/4 处最近的标题 = 当前节(飞书感) */
|
|
149
|
+
private syncActive;
|
|
150
|
+
private headingEl;
|
|
151
|
+
private jump;
|
|
152
|
+
private paint;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
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, loomKit, markExtensions, mentionMenu, normalizeLinkUrl, pointToDom, readSelection, rootEl, shikiCodeView, slashMenu, strikeMark, subscriptMark, superscriptMark, tableBlock, textAlign, textStyleMark, typography, underlineMark, writeSelection };
|