@milkdown/crepe 7.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/lib/apl-p0IPP13W.js +76 -0
- package/lib/asciiarmor-lJsBxlJJ.js +34 -0
- package/lib/asn1-Q9v1zIy5.js +102 -0
- package/lib/asterisk-foNkeTjy.js +273 -0
- package/lib/brainfuck-0XqyXpNS.js +35 -0
- package/lib/clike-ak6Z6Yhe.js +639 -0
- package/lib/clojure-iYO8U8Sg.js +810 -0
- package/lib/clsx-7d8NmkQq.js +21 -0
- package/lib/cmake-SVzjkxV_.js +28 -0
- package/lib/cobol-APHEnAOX.js +74 -0
- package/lib/coffeescript-KqQa0SYG.js +182 -0
- package/lib/commonlisp-bwqNqR5V.js +79 -0
- package/lib/core/crepe.d.ts +21 -0
- package/lib/core/crepe.d.ts.map +1 -0
- package/lib/core/index.d.ts +3 -0
- package/lib/core/index.d.ts.map +1 -0
- package/lib/core/slice.d.ts +12 -0
- package/lib/core/slice.d.ts.map +1 -0
- package/lib/crystal-BViWuDpA.js +217 -0
- package/lib/css-KHXHXfXg.js +1572 -0
- package/lib/cypher-XpTt4zQ3.js +69 -0
- package/lib/d-fLig6yqY.js +139 -0
- package/lib/diff-WoKGLpy6.js +18 -0
- package/lib/dockerfile-u6f6Vw2s.js +194 -0
- package/lib/dtd-SIJRUW6K.js +91 -0
- package/lib/dylan-4HCLhpWP.js +238 -0
- package/lib/ebnf-h_0lged5.js +77 -0
- package/lib/ecl-Lf4FF0lf.js +133 -0
- package/lib/eiffel-qlw8KUyf.js +112 -0
- package/lib/elm-QRnB3zXs.js +108 -0
- package/lib/erlang-fyVKb7eK.js +488 -0
- package/lib/factor-BEeN4upY.js +65 -0
- package/lib/fcl-lRek3hEb.js +106 -0
- package/lib/feature/block-edit/handle/component.d.ts +9 -0
- package/lib/feature/block-edit/handle/component.d.ts.map +1 -0
- package/lib/feature/block-edit/handle/index.d.ts +12 -0
- package/lib/feature/block-edit/handle/index.d.ts.map +1 -0
- package/lib/feature/block-edit/index.d.ts +3 -0
- package/lib/feature/block-edit/index.d.ts.map +1 -0
- package/lib/feature/block-edit/menu/component.d.ts +14 -0
- package/lib/feature/block-edit/menu/component.d.ts.map +1 -0
- package/lib/feature/block-edit/menu/config.d.ts +21 -0
- package/lib/feature/block-edit/menu/config.d.ts.map +1 -0
- package/lib/feature/block-edit/menu/icons.d.ts +14 -0
- package/lib/feature/block-edit/menu/icons.d.ts.map +1 -0
- package/lib/feature/block-edit/menu/index.d.ts +9 -0
- package/lib/feature/block-edit/menu/index.d.ts.map +1 -0
- package/lib/feature/code-mirror/index.d.ts +3 -0
- package/lib/feature/code-mirror/index.d.ts.map +1 -0
- package/lib/feature/gap-cursor/index.d.ts +3 -0
- package/lib/feature/gap-cursor/index.d.ts.map +1 -0
- package/lib/feature/image-block/index.d.ts +3 -0
- package/lib/feature/image-block/index.d.ts.map +1 -0
- package/lib/feature/index.d.ts +18 -0
- package/lib/feature/index.d.ts.map +1 -0
- package/lib/feature/link-tooltip/consts.d.ts +5 -0
- package/lib/feature/link-tooltip/consts.d.ts.map +1 -0
- package/lib/feature/link-tooltip/index.d.ts +3 -0
- package/lib/feature/link-tooltip/index.d.ts.map +1 -0
- package/lib/feature/list-item/consts.d.ts +2 -0
- package/lib/feature/list-item/consts.d.ts.map +1 -0
- package/lib/feature/list-item/index.d.ts +3 -0
- package/lib/feature/list-item/index.d.ts.map +1 -0
- package/lib/feature/placeholder/index.d.ts +10 -0
- package/lib/feature/placeholder/index.d.ts.map +1 -0
- package/lib/feature/shared.d.ts +3 -0
- package/lib/feature/shared.d.ts.map +1 -0
- package/lib/feature/toolbar/component.d.ts +13 -0
- package/lib/feature/toolbar/component.d.ts.map +1 -0
- package/lib/feature/toolbar/consts.d.ts +5 -0
- package/lib/feature/toolbar/consts.d.ts.map +1 -0
- package/lib/feature/toolbar/index.d.ts +3 -0
- package/lib/feature/toolbar/index.d.ts.map +1 -0
- package/lib/forth-ua2bRd8T.js +60 -0
- package/lib/fortran-WnF7znuN.js +443 -0
- package/lib/gas-wowve1o7.js +183 -0
- package/lib/gherkin-m7GIChu3.js +34 -0
- package/lib/go-th443Dhb.js +158 -0
- package/lib/groovy-tR4RiZnc.js +161 -0
- package/lib/haskell-jxVBofv5.js +375 -0
- package/lib/haxe-kWPI2tq3.js +390 -0
- package/lib/hooks-82sqkbtE.js +21 -0
- package/lib/http-3GIFWUlG.js +45 -0
- package/lib/icons-HYkfuR-O.js +50 -0
- package/lib/idl-PvpMZg-l.js +947 -0
- package/lib/index-0RbcZMbq.js +8 -0
- package/lib/index-4afXjFMY.js +517 -0
- package/lib/index-7MeyepDG.js +78 -0
- package/lib/index-7QgQq3x3.js +551 -0
- package/lib/index-7pgP6qYs.js +107 -0
- package/lib/index-8DvtgRVa.js +19511 -0
- package/lib/index-8Gg-jEP4.js +288 -0
- package/lib/index-8S8qcncB.js +507 -0
- package/lib/index-9A_GmGh4.js +1039 -0
- package/lib/index-EJJfYLzA.js +928 -0
- package/lib/index-Eg39w5kL.js +984 -0
- package/lib/index-FIk_7oPb.js +168 -0
- package/lib/index-LlbrXb_n.js +368 -0
- package/lib/index-MovKtgMG.js +121 -0
- package/lib/index-N9GtIS4X.js +64 -0
- package/lib/index-Pwn25-kf.js +8 -0
- package/lib/index-SdFSDosa.js +1295 -0
- package/lib/index-W5Th22-Z.js +1744 -0
- package/lib/index-XiXSFLmI.js +20975 -0
- package/lib/index-bknOViGv.js +47 -0
- package/lib/index-bkuIUPFS.js +275 -0
- package/lib/index-jPA8J9Eo.js +8 -0
- package/lib/index-lsG76a9s.js +552 -0
- package/lib/index-oTRzPo3B.js +146 -0
- package/lib/index-rrf6_6DC.js +317 -0
- package/lib/index-vJbZIHYF.js +81 -0
- package/lib/index-vPRh55CO.js +137 -0
- package/lib/index-vxy63hib.js +323 -0
- package/lib/index-wn1_LgCS.js +99 -0
- package/lib/index-xHADmDT3.js +12 -0
- package/lib/index-yt2EpMtv.js +141 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.es.js +7 -0
- package/lib/javascript-8ZHqHagw.js +758 -0
- package/lib/jinja2-vsOFe0qD.js +154 -0
- package/lib/julia-dlp_pbN1.js +241 -0
- package/lib/livescript-Gf5R-LT6.js +273 -0
- package/lib/lua-c5Y_JsBp.js +221 -0
- package/lib/mathematica-iiGTGmUs.js +35 -0
- package/lib/mbox-ZJh86H8B.js +78 -0
- package/lib/meta-tAGyVRPE.js +511 -0
- package/lib/mirc-i0qkCa0y.js +73 -0
- package/lib/mllike-Dy551fZW.js +275 -0
- package/lib/modelica-n6tGqUT9.js +94 -0
- package/lib/mscgen-aKSbB7D9.js +104 -0
- package/lib/mumps-lNiKA6sp.js +25 -0
- package/lib/nginx--YmuCfDj.js +93 -0
- package/lib/nsis-zhS8iA09.js +62 -0
- package/lib/ntriples-E3jQl3MC.js +79 -0
- package/lib/octave-EQvkGIeG.js +144 -0
- package/lib/oz-W2cpqFf6.js +152 -0
- package/lib/pascal-lCh6ouNZ.js +79 -0
- package/lib/perl-PxEQBX0B.js +915 -0
- package/lib/pig-Y_bNcrzS.js +56 -0
- package/lib/powershell-GaQP-TZr.js +249 -0
- package/lib/properties-mbRyn54L.js +26 -0
- package/lib/prosemirror-noTDkx-k.js +4 -0
- package/lib/protobuf-8CJideyJ.js +49 -0
- package/lib/puppet-ABBaChNZ.js +45 -0
- package/lib/python-sKdHg3Ka.js +321 -0
- package/lib/q-_1yG40Nm.js +89 -0
- package/lib/r-Ziz56bHT.js +108 -0
- package/lib/rpm-ORjGOHaQ.js +57 -0
- package/lib/ruby-jlbYq0dT.js +233 -0
- package/lib/sas-2n7xeUuO.js +107 -0
- package/lib/schema-tKk3m1fu.js +62 -0
- package/lib/scheme-XCs-NPeU.js +126 -0
- package/lib/shell-0_1Um7Dq.js +184 -0
- package/lib/sieve-7uyJD1x1.js +73 -0
- package/lib/simple-mode--HIzBxba.js +95 -0
- package/lib/smalltalk-PEFzrlQ-.js +48 -0
- package/lib/solr-BLBaHahN.js +41 -0
- package/lib/sparql-4F9ZWf1b.js +204 -0
- package/lib/spreadsheet-SGSo6blj.js +49 -0
- package/lib/sql-tebLBzN0.js +291 -0
- package/lib/stex-SFJcFGOO.js +130 -0
- package/lib/stylus-rwwWYWFm.js +256 -0
- package/lib/swift-eorJ0tCv.js +238 -0
- package/lib/tcl-IwXMB8U4.js +82 -0
- package/lib/textile-ok2VyjwC.js +299 -0
- package/lib/theme/classic/index.d.ts +3 -0
- package/lib/theme/classic/index.d.ts.map +1 -0
- package/lib/theme/classic-dark/index.d.ts +3 -0
- package/lib/theme/classic-dark/index.d.ts.map +1 -0
- package/lib/theme/headless/index.d.ts +3 -0
- package/lib/theme/headless/index.d.ts.map +1 -0
- package/lib/theme/index.d.ts +8 -0
- package/lib/theme/index.d.ts.map +1 -0
- package/lib/theme/shared.d.ts +3 -0
- package/lib/theme/shared.d.ts.map +1 -0
- package/lib/tiddlywiki-DLhz8_pc.js +156 -0
- package/lib/tiki-DFAqFElY.js +183 -0
- package/lib/tippy.esm-MZ2vxByW.js +1813 -0
- package/lib/toml-ryxpTZEV.js +49 -0
- package/lib/tooltip-plugin-gcwyQdiT.js +119 -0
- package/lib/troff-ZzZyvNct.js +36 -0
- package/lib/ttcn-6gvkqqpW.js +136 -0
- package/lib/ttcn-cfg-oSu-Dq5C.js +98 -0
- package/lib/turtle-10ofr5au.js +87 -0
- package/lib/use-css-light-dom-EKWZDmbJ.js +82 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/vb-a6n6fzrD.js +74 -0
- package/lib/vbscript-dgvo8jPt.js +324 -0
- package/lib/velocity-CBncCrwO.js +97 -0
- package/lib/verilog-KlcACt6C.js +271 -0
- package/lib/vhdl-NMd7Gf35.js +117 -0
- package/lib/webidl-z1UE5DN_.js +160 -0
- package/lib/xquery-hDt5jWTp.js +431 -0
- package/lib/yacas-ftgh_qwr.js +74 -0
- package/lib/yaml-DnNTfjXK.js +53 -0
- package/lib/z80-dA1PqWe1.js +62 -0
- package/package.json +87 -0
- package/src/core/crepe.ts +98 -0
- package/src/core/index.ts +4 -0
- package/src/core/slice.ts +44 -0
- package/src/feature/block-edit/handle/component.ts +68 -0
- package/src/feature/block-edit/handle/index.ts +81 -0
- package/src/feature/block-edit/index.ts +17 -0
- package/src/feature/block-edit/menu/component.ts +210 -0
- package/src/feature/block-edit/menu/config.ts +335 -0
- package/src/feature/block-edit/menu/icons.ts +171 -0
- package/src/feature/block-edit/menu/index.ts +113 -0
- package/src/feature/block-edit/style.css +126 -0
- package/src/feature/code-mirror/index.ts +60 -0
- package/src/feature/code-mirror/style.css +159 -0
- package/src/feature/gap-cursor/index.ts +31 -0
- package/src/feature/image-block/index.ts +59 -0
- package/src/feature/image-block/style.css +215 -0
- package/src/feature/index.ts +66 -0
- package/src/feature/link-tooltip/consts.ts +47 -0
- package/src/feature/link-tooltip/index.ts +22 -0
- package/src/feature/link-tooltip/style.css +107 -0
- package/src/feature/list-item/consts.ts +15 -0
- package/src/feature/list-item/index.ts +30 -0
- package/src/feature/list-item/style.css +23 -0
- package/src/feature/placeholder/index.ts +87 -0
- package/src/feature/placeholder/style.css +9 -0
- package/src/feature/shared.ts +4 -0
- package/src/feature/toolbar/component.ts +101 -0
- package/src/feature/toolbar/consts.ts +26 -0
- package/src/feature/toolbar/index.ts +92 -0
- package/src/feature/toolbar/style.css +37 -0
- package/src/index.ts +5 -0
- package/src/theme/classic/index.ts +12 -0
- package/src/theme/classic/style.css +192 -0
- package/src/theme/classic-dark/index.ts +12 -0
- package/src/theme/classic-dark/style.css +197 -0
- package/src/theme/headless/index.ts +9 -0
- package/src/theme/index.ts +26 -0
- package/src/theme/shared.ts +4 -0
- package/src/utils/index.ts +12 -0
- package/src/vite-env.d.ts +2 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { P as b, j as T, o as p, p as V, T as v, q as x, F as w, t as k, D, w as M, $ as O, x as P, i as F, a as N, C as y } from "./index-XiXSFLmI.js";
|
|
2
|
+
function R(i = {}) {
|
|
3
|
+
return new b({
|
|
4
|
+
view(e) {
|
|
5
|
+
return new B(e, i);
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
class B {
|
|
10
|
+
constructor(e, t) {
|
|
11
|
+
var o;
|
|
12
|
+
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (o = t.width) !== null && o !== void 0 ? o : 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((r) => {
|
|
13
|
+
let l = (s) => {
|
|
14
|
+
this[r](s);
|
|
15
|
+
};
|
|
16
|
+
return e.dom.addEventListener(r, l), { name: r, handler: l };
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
destroy() {
|
|
20
|
+
this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
|
|
21
|
+
}
|
|
22
|
+
update(e, t) {
|
|
23
|
+
this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
|
|
24
|
+
}
|
|
25
|
+
setCursor(e) {
|
|
26
|
+
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
27
|
+
}
|
|
28
|
+
updateOverlay() {
|
|
29
|
+
let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, o;
|
|
30
|
+
if (t) {
|
|
31
|
+
let n = e.nodeBefore, d = e.nodeAfter;
|
|
32
|
+
if (n || d) {
|
|
33
|
+
let c = this.editorView.nodeDOM(this.cursorPos - (n ? n.nodeSize : 0));
|
|
34
|
+
if (c) {
|
|
35
|
+
let u = c.getBoundingClientRect(), f = n ? u.bottom : u.top;
|
|
36
|
+
n && d && (f = (f + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2), o = { left: u.left, right: u.right, top: f - this.width / 2, bottom: f + this.width / 2 };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!o) {
|
|
41
|
+
let n = this.editorView.coordsAtPos(this.cursorPos);
|
|
42
|
+
o = { left: n.left - this.width / 2, right: n.left + this.width / 2, top: n.top, bottom: n.bottom };
|
|
43
|
+
}
|
|
44
|
+
let r = this.editorView.dom.offsetParent;
|
|
45
|
+
this.element || (this.element = r.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
|
|
46
|
+
let l, s;
|
|
47
|
+
if (!r || r == document.body && getComputedStyle(r).position == "static")
|
|
48
|
+
l = -pageXOffset, s = -pageYOffset;
|
|
49
|
+
else {
|
|
50
|
+
let n = r.getBoundingClientRect();
|
|
51
|
+
l = n.left - r.scrollLeft, s = n.top - r.scrollTop;
|
|
52
|
+
}
|
|
53
|
+
this.element.style.left = o.left - l + "px", this.element.style.top = o.top - s + "px", this.element.style.width = o.right - o.left + "px", this.element.style.height = o.bottom - o.top + "px";
|
|
54
|
+
}
|
|
55
|
+
scheduleRemoval(e) {
|
|
56
|
+
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
57
|
+
}
|
|
58
|
+
dragover(e) {
|
|
59
|
+
if (!this.editorView.editable)
|
|
60
|
+
return;
|
|
61
|
+
let t = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), o = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), r = o && o.type.spec.disableDropCursor, l = typeof r == "function" ? r(this.editorView, t, e) : r;
|
|
62
|
+
if (t && !l) {
|
|
63
|
+
let s = t.pos;
|
|
64
|
+
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
65
|
+
let n = T(this.editorView.state.doc, s, this.editorView.dragging.slice);
|
|
66
|
+
n != null && (s = n);
|
|
67
|
+
}
|
|
68
|
+
this.setCursor(s), this.scheduleRemoval(5e3);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
dragend() {
|
|
72
|
+
this.scheduleRemoval(20);
|
|
73
|
+
}
|
|
74
|
+
drop() {
|
|
75
|
+
this.scheduleRemoval(20);
|
|
76
|
+
}
|
|
77
|
+
dragleave(e) {
|
|
78
|
+
(e.target == this.editorView.dom || !this.editorView.dom.contains(e.relatedTarget)) && this.setCursor(null);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
class a extends p {
|
|
82
|
+
/**
|
|
83
|
+
Create a gap cursor.
|
|
84
|
+
*/
|
|
85
|
+
constructor(e) {
|
|
86
|
+
super(e, e);
|
|
87
|
+
}
|
|
88
|
+
map(e, t) {
|
|
89
|
+
let o = e.resolve(t.map(this.head));
|
|
90
|
+
return a.valid(o) ? new a(o) : p.near(o);
|
|
91
|
+
}
|
|
92
|
+
content() {
|
|
93
|
+
return k.empty;
|
|
94
|
+
}
|
|
95
|
+
eq(e) {
|
|
96
|
+
return e instanceof a && e.head == this.head;
|
|
97
|
+
}
|
|
98
|
+
toJSON() {
|
|
99
|
+
return { type: "gapcursor", pos: this.head };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
@internal
|
|
103
|
+
*/
|
|
104
|
+
static fromJSON(e, t) {
|
|
105
|
+
if (typeof t.pos != "number")
|
|
106
|
+
throw new RangeError("Invalid input for GapCursor.fromJSON");
|
|
107
|
+
return new a(e.resolve(t.pos));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
@internal
|
|
111
|
+
*/
|
|
112
|
+
getBookmark() {
|
|
113
|
+
return new g(this.anchor);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
@internal
|
|
117
|
+
*/
|
|
118
|
+
static valid(e) {
|
|
119
|
+
let t = e.parent;
|
|
120
|
+
if (t.isTextblock || !E(e) || !L(e))
|
|
121
|
+
return !1;
|
|
122
|
+
let o = t.type.spec.allowGapCursor;
|
|
123
|
+
if (o != null)
|
|
124
|
+
return o;
|
|
125
|
+
let r = t.contentMatchAt(e.index()).defaultType;
|
|
126
|
+
return r && r.isTextblock;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
@internal
|
|
130
|
+
*/
|
|
131
|
+
static findGapCursorFrom(e, t, o = !1) {
|
|
132
|
+
e:
|
|
133
|
+
for (; ; ) {
|
|
134
|
+
if (!o && a.valid(e))
|
|
135
|
+
return e;
|
|
136
|
+
let r = e.pos, l = null;
|
|
137
|
+
for (let s = e.depth; ; s--) {
|
|
138
|
+
let n = e.node(s);
|
|
139
|
+
if (t > 0 ? e.indexAfter(s) < n.childCount : e.index(s) > 0) {
|
|
140
|
+
l = n.child(t > 0 ? e.indexAfter(s) : e.index(s) - 1);
|
|
141
|
+
break;
|
|
142
|
+
} else if (s == 0)
|
|
143
|
+
return null;
|
|
144
|
+
r += t;
|
|
145
|
+
let d = e.doc.resolve(r);
|
|
146
|
+
if (a.valid(d))
|
|
147
|
+
return d;
|
|
148
|
+
}
|
|
149
|
+
for (; ; ) {
|
|
150
|
+
let s = t > 0 ? l.firstChild : l.lastChild;
|
|
151
|
+
if (!s) {
|
|
152
|
+
if (l.isAtom && !l.isText && !x.isSelectable(l)) {
|
|
153
|
+
e = e.doc.resolve(r + l.nodeSize * t), o = !1;
|
|
154
|
+
continue e;
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
l = s, r += t;
|
|
159
|
+
let n = e.doc.resolve(r);
|
|
160
|
+
if (a.valid(n))
|
|
161
|
+
return n;
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
a.prototype.visible = !1;
|
|
168
|
+
a.findFrom = a.findGapCursorFrom;
|
|
169
|
+
p.jsonID("gapcursor", a);
|
|
170
|
+
class g {
|
|
171
|
+
constructor(e) {
|
|
172
|
+
this.pos = e;
|
|
173
|
+
}
|
|
174
|
+
map(e) {
|
|
175
|
+
return new g(e.map(this.pos));
|
|
176
|
+
}
|
|
177
|
+
resolve(e) {
|
|
178
|
+
let t = e.resolve(this.pos);
|
|
179
|
+
return a.valid(t) ? new a(t) : p.near(t);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function E(i) {
|
|
183
|
+
for (let e = i.depth; e >= 0; e--) {
|
|
184
|
+
let t = i.index(e), o = i.node(e);
|
|
185
|
+
if (t == 0) {
|
|
186
|
+
if (o.type.spec.isolating)
|
|
187
|
+
return !0;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
for (let r = o.child(t - 1); ; r = r.lastChild) {
|
|
191
|
+
if (r.childCount == 0 && !r.inlineContent || r.isAtom || r.type.spec.isolating)
|
|
192
|
+
return !0;
|
|
193
|
+
if (r.inlineContent)
|
|
194
|
+
return !1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return !0;
|
|
198
|
+
}
|
|
199
|
+
function L(i) {
|
|
200
|
+
for (let e = i.depth; e >= 0; e--) {
|
|
201
|
+
let t = i.indexAfter(e), o = i.node(e);
|
|
202
|
+
if (t == o.childCount) {
|
|
203
|
+
if (o.type.spec.isolating)
|
|
204
|
+
return !0;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
for (let r = o.child(t); ; r = r.firstChild) {
|
|
208
|
+
if (r.childCount == 0 && !r.inlineContent || r.isAtom || r.type.spec.isolating)
|
|
209
|
+
return !0;
|
|
210
|
+
if (r.inlineContent)
|
|
211
|
+
return !1;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return !0;
|
|
215
|
+
}
|
|
216
|
+
function z() {
|
|
217
|
+
return new b({
|
|
218
|
+
props: {
|
|
219
|
+
decorations: Y,
|
|
220
|
+
createSelectionBetween(i, e, t) {
|
|
221
|
+
return e.pos == t.pos && a.valid(t) ? new a(t) : null;
|
|
222
|
+
},
|
|
223
|
+
handleClick: J,
|
|
224
|
+
handleKeyDown: j,
|
|
225
|
+
handleDOMEvents: { beforeinput: X }
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
const j = V({
|
|
230
|
+
ArrowLeft: h("horiz", -1),
|
|
231
|
+
ArrowRight: h("horiz", 1),
|
|
232
|
+
ArrowUp: h("vert", -1),
|
|
233
|
+
ArrowDown: h("vert", 1)
|
|
234
|
+
});
|
|
235
|
+
function h(i, e) {
|
|
236
|
+
const t = i == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
|
|
237
|
+
return function(o, r, l) {
|
|
238
|
+
let s = o.selection, n = e > 0 ? s.$to : s.$from, d = s.empty;
|
|
239
|
+
if (s instanceof v) {
|
|
240
|
+
if (!l.endOfTextblock(t) || n.depth == 0)
|
|
241
|
+
return !1;
|
|
242
|
+
d = !1, n = o.doc.resolve(e > 0 ? n.after() : n.before());
|
|
243
|
+
}
|
|
244
|
+
let c = a.findGapCursorFrom(n, e, d);
|
|
245
|
+
return c ? (r && r(o.tr.setSelection(new a(c))), !0) : !1;
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function J(i, e, t) {
|
|
249
|
+
if (!i || !i.editable)
|
|
250
|
+
return !1;
|
|
251
|
+
let o = i.state.doc.resolve(e);
|
|
252
|
+
if (!a.valid(o))
|
|
253
|
+
return !1;
|
|
254
|
+
let r = i.posAtCoords({ left: t.clientX, top: t.clientY });
|
|
255
|
+
return r && r.inside > -1 && x.isSelectable(i.state.doc.nodeAt(r.inside)) ? !1 : (i.dispatch(i.state.tr.setSelection(new a(o))), !0);
|
|
256
|
+
}
|
|
257
|
+
function X(i, e) {
|
|
258
|
+
if (e.inputType != "insertCompositionText" || !(i.state.selection instanceof a))
|
|
259
|
+
return !1;
|
|
260
|
+
let { $from: t } = i.state.selection, o = t.parent.contentMatchAt(t.index()).findWrapping(i.state.schema.nodes.text);
|
|
261
|
+
if (!o)
|
|
262
|
+
return !1;
|
|
263
|
+
let r = w.empty;
|
|
264
|
+
for (let s = o.length - 1; s >= 0; s--)
|
|
265
|
+
r = w.from(o[s].createAndFill(null, r));
|
|
266
|
+
let l = i.state.tr.replace(t.pos, t.pos, new k(r, 0, 0));
|
|
267
|
+
return l.setSelection(v.near(l.doc.resolve(t.pos + 1))), i.dispatch(l), !1;
|
|
268
|
+
}
|
|
269
|
+
function Y(i) {
|
|
270
|
+
if (!(i.selection instanceof a))
|
|
271
|
+
return null;
|
|
272
|
+
let e = document.createElement("div");
|
|
273
|
+
return e.className = "ProseMirror-gapcursor", D.create(i.doc, [M.widget(i.selection.head, e, { key: "gapcursor" })]);
|
|
274
|
+
}
|
|
275
|
+
function C(i, e) {
|
|
276
|
+
return Object.assign(i, {
|
|
277
|
+
meta: {
|
|
278
|
+
package: "@milkdown/plugin-cursor",
|
|
279
|
+
...e
|
|
280
|
+
}
|
|
281
|
+
}), i;
|
|
282
|
+
}
|
|
283
|
+
const m = O({}, "dropCursorConfig");
|
|
284
|
+
C(m, {
|
|
285
|
+
displayName: "Ctx<dropCursor>"
|
|
286
|
+
});
|
|
287
|
+
const A = P((i) => R(i.get(m.key)));
|
|
288
|
+
C(A, {
|
|
289
|
+
displayName: "Prose<dropCursor>"
|
|
290
|
+
});
|
|
291
|
+
const S = P(() => z());
|
|
292
|
+
C(S, {
|
|
293
|
+
displayName: "Prose<gapCursor>"
|
|
294
|
+
});
|
|
295
|
+
const q = [m, A, S], I = '.ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}.ProseMirror-gapcursor:after{content:"";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}.ProseMirror-focused .ProseMirror-gapcursor{display:block}';
|
|
296
|
+
function H(i) {
|
|
297
|
+
switch (i) {
|
|
298
|
+
case y.Classic:
|
|
299
|
+
return "#1F1B16";
|
|
300
|
+
case y.ClassicDark:
|
|
301
|
+
return "#EAE1D9";
|
|
302
|
+
default:
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
const U = (i) => {
|
|
307
|
+
i.config(F(I)).config((e) => {
|
|
308
|
+
const t = e.get(N);
|
|
309
|
+
e.update(m.key, (o) => ({
|
|
310
|
+
...o,
|
|
311
|
+
color: H(t)
|
|
312
|
+
}));
|
|
313
|
+
}).use(q);
|
|
314
|
+
};
|
|
315
|
+
export {
|
|
316
|
+
U as defineFeature
|
|
317
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { L as o } from "./index-SdFSDosa.js";
|
|
2
|
+
import { s, t as r, L as n, b as P, d as a, f as i, j as Q, a as c } from "./index-8DvtgRVa.js";
|
|
3
|
+
import "./meta-tAGyVRPE.js";
|
|
4
|
+
import "./icons-HYkfuR-O.js";
|
|
5
|
+
import "./index-XiXSFLmI.js";
|
|
6
|
+
import "./hooks-82sqkbtE.js";
|
|
7
|
+
import "./use-css-light-dom-EKWZDmbJ.js";
|
|
8
|
+
import "./clsx-7d8NmkQq.js";
|
|
9
|
+
const p = s({
|
|
10
|
+
String: r.string,
|
|
11
|
+
Number: r.number,
|
|
12
|
+
"True False": r.bool,
|
|
13
|
+
PropertyName: r.propertyName,
|
|
14
|
+
Null: r.null,
|
|
15
|
+
",": r.separator,
|
|
16
|
+
"[ ]": r.squareBracket,
|
|
17
|
+
"{ }": r.brace
|
|
18
|
+
}), g = o.deserialize({
|
|
19
|
+
version: 14,
|
|
20
|
+
states: "$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",
|
|
21
|
+
stateData: "#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",
|
|
22
|
+
goto: "!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",
|
|
23
|
+
nodeNames: "⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",
|
|
24
|
+
maxTerm: 25,
|
|
25
|
+
nodeProps: [
|
|
26
|
+
["openedBy", 7, "{", 12, "["],
|
|
27
|
+
["closedBy", 8, "}", 13, "]"]
|
|
28
|
+
],
|
|
29
|
+
propSources: [p],
|
|
30
|
+
skippedNodes: [0],
|
|
31
|
+
repeatNodeCount: 2,
|
|
32
|
+
tokenData: "(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",
|
|
33
|
+
tokenizers: [0],
|
|
34
|
+
topRules: { JsonText: [0, 1] },
|
|
35
|
+
tokenPrec: 0
|
|
36
|
+
}), j = () => (t) => {
|
|
37
|
+
try {
|
|
38
|
+
JSON.parse(t.state.doc.toString());
|
|
39
|
+
} catch (O) {
|
|
40
|
+
if (!(O instanceof SyntaxError))
|
|
41
|
+
throw O;
|
|
42
|
+
const e = m(O, t.state.doc);
|
|
43
|
+
return [{
|
|
44
|
+
from: e,
|
|
45
|
+
message: O.message,
|
|
46
|
+
severity: "error",
|
|
47
|
+
to: e
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
return [];
|
|
51
|
+
};
|
|
52
|
+
function m(t, O) {
|
|
53
|
+
let e;
|
|
54
|
+
return (e = t.message.match(/at position (\d+)/)) ? Math.min(+e[1], O.length) : (e = t.message.match(/at line (\d+) column (\d+)/)) ? Math.min(O.line(+e[1]).from + +e[2] - 1, O.length) : 0;
|
|
55
|
+
}
|
|
56
|
+
const u = /* @__PURE__ */ n.define({
|
|
57
|
+
name: "json",
|
|
58
|
+
parser: /* @__PURE__ */ g.configure({
|
|
59
|
+
props: [
|
|
60
|
+
/* @__PURE__ */ P.add({
|
|
61
|
+
Object: /* @__PURE__ */ a({ except: /^\s*\}/ }),
|
|
62
|
+
Array: /* @__PURE__ */ a({ except: /^\s*\]/ })
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ i.add({
|
|
65
|
+
"Object Array": Q
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
}),
|
|
69
|
+
languageData: {
|
|
70
|
+
closeBrackets: { brackets: ["[", "{", '"'] },
|
|
71
|
+
indentOnInput: /^\s*[\}\]]$/
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
function y() {
|
|
75
|
+
return new c(u);
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
y as json,
|
|
79
|
+
u as jsonLanguage,
|
|
80
|
+
j as jsonParseLinter
|
|
81
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var v = (o, t, n) => {
|
|
2
|
+
if (!t.has(o))
|
|
3
|
+
throw TypeError("Cannot " + n);
|
|
4
|
+
};
|
|
5
|
+
var a = (o, t, n) => (v(o, t, "read from private field"), n ? n.call(o) : t.get(o)), w = (o, t, n) => {
|
|
6
|
+
if (t.has(o))
|
|
7
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
+
t instanceof WeakSet ? t.add(o) : t.set(o, n);
|
|
9
|
+
}, g = (o, t, n, c) => (v(o, t, "write to private field"), c ? c.call(o, n) : t.set(o, n), n);
|
|
10
|
+
import { O as B, Q as S, R as E, d as b, f, U as u, V as I, W as F, X as O, i as P, T as k } from "./index-XiXSFLmI.js";
|
|
11
|
+
import { h as m, c as R, f as A, a as j } from "./meta-tAGyVRPE.js";
|
|
12
|
+
import { c as p } from "./clsx-7d8NmkQq.js";
|
|
13
|
+
import { a as H, t as U, T as D } from "./tooltip-plugin-gcwyQdiT.js";
|
|
14
|
+
import "./icons-HYkfuR-O.js";
|
|
15
|
+
import "./tippy.esm-MZ2vxByW.js";
|
|
16
|
+
const N = m`
|
|
17
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
18
|
+
<path d="M8.85758 18.625C8.4358 18.625 8.07715 18.4772 7.78163 18.1817C7.48613 17.8862 7.33838 17.5275 7.33838 17.1058V6.8942C7.33838 6.47242 7.48613 6.11377 7.78163 5.81825C8.07715 5.52275 8.4358 5.375 8.85758 5.375H12.1999C13.2191 5.375 14.1406 5.69231 14.9643 6.32693C15.788 6.96154 16.1999 7.81603 16.1999 8.89038C16.1999 9.63779 16.0194 10.2471 15.6585 10.7183C15.2976 11.1894 14.9088 11.5314 14.4922 11.7442C15.005 11.9211 15.4947 12.2708 15.9614 12.7933C16.428 13.3157 16.6614 14.0192 16.6614 14.9038C16.6614 16.182 16.1902 17.1217 15.2479 17.723C14.3056 18.3243 13.3563 18.625 12.3999 18.625H8.85758ZM9.4883 16.6327H12.3191C13.1063 16.6327 13.6627 16.4141 13.9884 15.9769C14.314 15.5397 14.4768 15.1205 14.4768 14.7192C14.4768 14.3179 14.314 13.8987 13.9884 13.4615C13.6627 13.0243 13.0909 12.8057 12.273 12.8057H9.4883V16.6327ZM9.4883 10.875H12.0826C12.6903 10.875 13.172 10.7013 13.5278 10.3539C13.8836 10.0064 14.0615 9.59037 14.0615 9.10575C14.0615 8.59035 13.8733 8.16918 13.497 7.84225C13.1207 7.51533 12.6595 7.35188 12.1133 7.35188H9.4883V10.875Z" fill="#817567"/>
|
|
19
|
+
</svg>
|
|
20
|
+
`, Q = m`
|
|
21
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
22
|
+
<path d="M6.29811 18.625C6.04505 18.625 5.83115 18.5375 5.65641 18.3626C5.48166 18.1877 5.39429 17.9736 5.39429 17.7203C5.39429 17.467 5.48166 17.2532 5.65641 17.0788C5.83115 16.9045 6.04505 16.8173 6.29811 16.8173H9.21159L12.452 7.18265H9.53851C9.28545 7.18265 9.07155 7.0952 8.89681 6.9203C8.72206 6.7454 8.63469 6.5313 8.63469 6.278C8.63469 6.02472 8.72206 5.81089 8.89681 5.63652C9.07155 5.46217 9.28545 5.375 9.53851 5.375H16.8847C17.1377 5.375 17.3516 5.46245 17.5264 5.63735C17.7011 5.81225 17.7885 6.02634 17.7885 6.27962C17.7885 6.53293 17.7011 6.74676 17.5264 6.92113C17.3516 7.09548 17.1377 7.18265 16.8847 7.18265H14.2789L11.0385 16.8173H13.6443C13.8973 16.8173 14.1112 16.9048 14.286 17.0797C14.4607 17.2546 14.5481 17.4687 14.5481 17.722C14.5481 17.9752 14.4607 18.1891 14.286 18.3634C14.1112 18.5378 13.8973 18.625 13.6443 18.625H6.29811Z" fill="#817567"/>
|
|
23
|
+
</svg>
|
|
24
|
+
`, W = m`
|
|
25
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
26
|
+
<path d="M4.46924 12.0158L8.52694 16.0735C8.66541 16.212 8.73624 16.386 8.73944 16.5956C8.74266 16.8052 8.67183 16.9824 8.52694 17.1273C8.38208 17.2722 8.20644 17.3446 8.00004 17.3446C7.79364 17.3446 7.61801 17.2722 7.47315 17.1273L2.97892 12.6331C2.88532 12.5395 2.81929 12.4408 2.78084 12.3369C2.74238 12.2331 2.72314 12.1209 2.72314 12.0004C2.72314 11.8799 2.74238 11.7677 2.78084 11.6639C2.81929 11.56 2.88532 11.4613 2.97892 11.3677L7.47315 6.87351C7.62184 6.72479 7.79844 6.64882 8.00292 6.6456C8.2074 6.6424 8.38721 6.71837 8.54234 6.87351C8.69746 7.02862 8.77502 7.20682 8.77502 7.4081C8.77502 7.60937 8.69746 7.78757 8.54234 7.94271L4.46924 12.0158ZM19.5308 11.985L15.4731 7.9273C15.3347 7.78885 15.2638 7.61482 15.2606 7.40521C15.2574 7.19561 15.3283 7.01837 15.4731 6.87351C15.618 6.72862 15.7936 6.65618 16 6.65618C16.2064 6.65618 16.3821 6.72862 16.5269 6.87351L21.0212 11.3677C21.1148 11.4613 21.1808 11.56 21.2192 11.6639C21.2577 11.7677 21.2769 11.8799 21.2769 12.0004C21.2769 12.1209 21.2577 12.2331 21.2192 12.3369C21.1808 12.4408 21.1148 12.5395 21.0212 12.6331L16.5269 17.1273C16.3782 17.276 16.2042 17.3494 16.0048 17.3475C15.8055 17.3456 15.6283 17.2671 15.4731 17.1119C15.318 16.9568 15.2404 16.7786 15.2404 16.5773C15.2404 16.376 15.318 16.1978 15.4731 16.0427L19.5308 11.985Z" fill="#817567"/>
|
|
27
|
+
</svg>
|
|
28
|
+
`, X = m`
|
|
29
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
30
|
+
<path d="M17.0385 19.5003V16.5388H14.0769V15.0388H17.0385V12.0773H18.5384V15.0388H21.5V16.5388H18.5384V19.5003H17.0385ZM10.8077 16.5388H7.03845C5.78282 16.5388 4.7125 16.0963 3.8275 15.2114C2.9425 14.3266 2.5 13.2564 2.5 12.0009C2.5 10.7454 2.9425 9.67504 3.8275 8.78979C4.7125 7.90454 5.78282 7.46191 7.03845 7.46191H10.8077V8.96186H7.03845C6.1987 8.96186 5.48235 9.25834 4.8894 9.85129C4.29645 10.4442 3.99998 11.1606 3.99998 12.0003C3.99998 12.8401 4.29645 13.5564 4.8894 14.1494C5.48235 14.7423 6.1987 15.0388 7.03845 15.0388H10.8077V16.5388ZM8.25 12.7503V11.2504H15.75V12.7503H8.25ZM21.5 12.0003H20C20 11.1606 19.7035 10.4442 19.1106 9.85129C18.5176 9.25834 17.8013 8.96186 16.9615 8.96186H13.1923V7.46191H16.9615C18.2171 7.46191 19.2875 7.90441 20.1725 8.78939C21.0575 9.67439 21.5 10.7447 21.5 12.0003Z" fill="#817567"/>
|
|
31
|
+
</svg>
|
|
32
|
+
`, V = ({ ctx: o, hide: t, show: n }) => {
|
|
33
|
+
const c = A();
|
|
34
|
+
j(() => {
|
|
35
|
+
c();
|
|
36
|
+
}, [n]);
|
|
37
|
+
const s = (e) => (i) => {
|
|
38
|
+
i.preventDefault(), o && e(o), c();
|
|
39
|
+
}, r = (e) => {
|
|
40
|
+
if (!o)
|
|
41
|
+
return !1;
|
|
42
|
+
const i = o.get(f), { state: { doc: d, selection: h } } = i;
|
|
43
|
+
return d.rangeHasMark(h.from, h.to, e);
|
|
44
|
+
};
|
|
45
|
+
return m`<host>
|
|
46
|
+
<button
|
|
47
|
+
class=${p("toolbar-item", o && r(B.type(o)) && "active")}
|
|
48
|
+
onmousedown=${s((e) => {
|
|
49
|
+
e.get(u).call(I.key);
|
|
50
|
+
})}
|
|
51
|
+
>
|
|
52
|
+
${N}
|
|
53
|
+
</button>
|
|
54
|
+
<button
|
|
55
|
+
class=${p("toolbar-item", o && r(S.type(o)) && "active")}
|
|
56
|
+
onmousedown=${s((e) => {
|
|
57
|
+
e.get(u).call(F.key);
|
|
58
|
+
})}
|
|
59
|
+
>
|
|
60
|
+
${Q}
|
|
61
|
+
</button>
|
|
62
|
+
<div class="divider"></div>
|
|
63
|
+
<button
|
|
64
|
+
class=${p("toolbar-item", o && r(E.type(o)) && "active")}
|
|
65
|
+
onmousedown=${s((e) => {
|
|
66
|
+
e.get(u).call(O.key);
|
|
67
|
+
})}
|
|
68
|
+
>
|
|
69
|
+
${W}
|
|
70
|
+
</button>
|
|
71
|
+
<button
|
|
72
|
+
class=${p("toolbar-item", o && r(b.type(o)) && "active")}
|
|
73
|
+
onmousedown=${s((e) => {
|
|
74
|
+
const i = e.get(f), { selection: d } = i.state;
|
|
75
|
+
if (r(b.type(e))) {
|
|
76
|
+
e.get(H.key).removeLink(d.from, d.to);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
e.get(H.key).addLink(d.from, d.to), t == null || t();
|
|
80
|
+
})}
|
|
81
|
+
>
|
|
82
|
+
${X}
|
|
83
|
+
</button>
|
|
84
|
+
</host>`;
|
|
85
|
+
};
|
|
86
|
+
V.props = {
|
|
87
|
+
ctx: Object,
|
|
88
|
+
hide: Function,
|
|
89
|
+
show: Boolean
|
|
90
|
+
};
|
|
91
|
+
const x = R(V), _ = ".milkdown milkdown-toolbar{display:flex;background:var(--crepe-color-surface);box-shadow:var(--crepe-shadow-1);border-radius:8px;overflow:hidden}.milkdown milkdown-toolbar .divider{width:1px;background:color-mix(in srgb,var(--crepe-color-outline),transparent 80%);height:24px;margin:10px}.milkdown milkdown-toolbar .toolbar-item{width:44px;height:44px;padding:10px;cursor:pointer}.milkdown milkdown-toolbar .toolbar-item:hover{background:var(--crepe-color-hover)}.milkdown milkdown-toolbar .toolbar-item.active{background:var(--crepe-color-selected)}.milkdown milkdown-toolbar .toolbar-item svg{height:24px;width:24px;color:var(--crepe-color-outline)}", y = U("CREPE_TOOLBAR");
|
|
92
|
+
var C, l;
|
|
93
|
+
class q {
|
|
94
|
+
constructor(t, n) {
|
|
95
|
+
w(this, C, void 0);
|
|
96
|
+
w(this, l, void 0);
|
|
97
|
+
this.update = (s, r) => {
|
|
98
|
+
a(this, C).update(s, r);
|
|
99
|
+
}, this.destroy = () => {
|
|
100
|
+
a(this, C).destroy(), a(this, l).remove();
|
|
101
|
+
}, this.hide = () => {
|
|
102
|
+
a(this, C).hide();
|
|
103
|
+
};
|
|
104
|
+
const c = new x();
|
|
105
|
+
g(this, l, c), a(this, l).ctx = t, a(this, l).hide = this.hide, g(this, C, new D({
|
|
106
|
+
content: a(this, l),
|
|
107
|
+
debounce: 20,
|
|
108
|
+
tippyOptions: {
|
|
109
|
+
arrow: !1,
|
|
110
|
+
delay: 0,
|
|
111
|
+
duration: 0,
|
|
112
|
+
onShow: () => {
|
|
113
|
+
a(this, l).show = !0;
|
|
114
|
+
},
|
|
115
|
+
onHidden: () => {
|
|
116
|
+
a(this, l).show = !1;
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
shouldShow(s) {
|
|
120
|
+
const { doc: r, selection: e } = s.state, { empty: i, from: d, to: h } = e, L = !r.textBetween(d, h).length && e instanceof k, $ = !(e instanceof k), M = c.contains(document.activeElement), T = !s.hasFocus() && !M, Z = !s.editable;
|
|
121
|
+
return !(T || $ || i || L || Z);
|
|
122
|
+
}
|
|
123
|
+
})), this.update(n);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
C = new WeakMap(), l = new WeakMap();
|
|
127
|
+
customElements.define("milkdown-toolbar", x);
|
|
128
|
+
const e1 = (o) => {
|
|
129
|
+
o.config(P(_)).config((t) => {
|
|
130
|
+
t.set(y.key, {
|
|
131
|
+
view: (n) => new q(t, n)
|
|
132
|
+
});
|
|
133
|
+
}).use(y);
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
e1 as defineFeature
|
|
137
|
+
};
|