@glifox/gnosis 0.0.6 → 0.0.8
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/gnosis.mjs +625 -447
- package/dist/gnosis.umd.js +16 -6
- package/package.json +2 -2
package/dist/gnosis.mjs
CHANGED
|
@@ -1,83 +1,84 @@
|
|
|
1
|
-
var
|
|
2
|
-
var X = (t, r,
|
|
3
|
-
var
|
|
4
|
-
import { languages as
|
|
5
|
-
import { markdown as
|
|
6
|
-
import { GFM as
|
|
7
|
-
import { Tag as
|
|
8
|
-
import { ViewPlugin as
|
|
9
|
-
import { syntaxTree as
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var X = (t, r, a) => r in t ? U(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a;
|
|
3
|
+
var q = (t, r, a) => X(t, typeof r != "symbol" ? r + "" : r, a);
|
|
4
|
+
import { languages as J } from "@codemirror/language-data";
|
|
5
|
+
import { markdown as ee } from "@codemirror/lang-markdown";
|
|
6
|
+
import { GFM as re } from "@lezer/markdown";
|
|
7
|
+
import { Tag as te, styleTags as ae, tags as e } from "@lezer/highlight";
|
|
8
|
+
import { ViewPlugin as oe, Decoration as h, WidgetType as E, EditorView as A } from "@codemirror/view";
|
|
9
|
+
import { syntaxTree as $, HighlightStyle as ne, syntaxHighlighting as le } from "@codemirror/language";
|
|
10
10
|
import { EditorView as B } from "codemirror";
|
|
11
|
-
import { Compartment as
|
|
12
|
-
const
|
|
13
|
-
"Blockquote/...":
|
|
14
|
-
HorizontalRule:
|
|
15
|
-
"ATXHeading1/... SetextHeading1/...":
|
|
16
|
-
"ATXHeading2/... SetextHeading2/...":
|
|
17
|
-
"ATXHeading3/...":
|
|
18
|
-
"ATXHeading4/...":
|
|
19
|
-
"ATXHeading5/...":
|
|
20
|
-
"ATXHeading6/...":
|
|
21
|
-
"Comment CommentBlock":
|
|
22
|
-
Escape:
|
|
23
|
-
Entity:
|
|
24
|
-
"Emphasis/...":
|
|
25
|
-
"StrongEmphasis/...":
|
|
26
|
-
"Strikethrough/...":
|
|
27
|
-
"TableHeader/...":
|
|
28
|
-
"Link/... Image/...":
|
|
29
|
-
"OrderedList/... BulletList/...":
|
|
30
|
-
"BlockQuote/...":
|
|
31
|
-
"InlineCode CodeText":
|
|
32
|
-
"URL Autolink":
|
|
33
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark":
|
|
34
|
-
"CodeInfo LinkLabel TaskMarker TableDelimiter":
|
|
35
|
-
LinkTitle:
|
|
36
|
-
Paragraph:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this
|
|
11
|
+
import { Compartment as ce, StateEffect as se, StateField as ie } from "@codemirror/state";
|
|
12
|
+
const f = te.define("none"), ge = ae({
|
|
13
|
+
"Blockquote/...": f,
|
|
14
|
+
HorizontalRule: f,
|
|
15
|
+
"ATXHeading1/... SetextHeading1/...": f,
|
|
16
|
+
"ATXHeading2/... SetextHeading2/...": f,
|
|
17
|
+
"ATXHeading3/...": f,
|
|
18
|
+
"ATXHeading4/...": f,
|
|
19
|
+
"ATXHeading5/...": f,
|
|
20
|
+
"ATXHeading6/...": f,
|
|
21
|
+
"Comment CommentBlock": f,
|
|
22
|
+
Escape: f,
|
|
23
|
+
Entity: f,
|
|
24
|
+
"Emphasis/...": f,
|
|
25
|
+
"StrongEmphasis/...": f,
|
|
26
|
+
"Strikethrough/...": f,
|
|
27
|
+
"TableHeader/...": f,
|
|
28
|
+
"Link/... Image/...": f,
|
|
29
|
+
"OrderedList/... BulletList/...": f,
|
|
30
|
+
"BlockQuote/...": f,
|
|
31
|
+
"InlineCode CodeText": f,
|
|
32
|
+
"URL Autolink": f,
|
|
33
|
+
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark StrikethroughMark": f,
|
|
34
|
+
"CodeInfo LinkLabel TaskMarker TableDelimiter": f,
|
|
35
|
+
LinkTitle: f,
|
|
36
|
+
Paragraph: f,
|
|
37
|
+
"QuoteType/.. QuoteTypeMark QuoteTypeText": f
|
|
38
|
+
}), he = { props: [ge] }, v = (t, r, a = {}) => {
|
|
39
|
+
const o = class {
|
|
40
|
+
constructor(i) {
|
|
41
|
+
q(this, "decorations");
|
|
42
|
+
q(this, "conf");
|
|
43
|
+
this.conf = r, this.decorations = t(i, this.conf);
|
|
43
44
|
}
|
|
44
|
-
update(
|
|
45
|
-
(
|
|
45
|
+
update(i) {
|
|
46
|
+
(i.docChanged || i.viewportChanged || i.selectionSet) && (this.decorations = t(i.view, this.conf));
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
|
-
return
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
for (let
|
|
52
|
-
if (
|
|
49
|
+
return oe.fromClass(o, { decorations: (c) => c.decorations, ...a });
|
|
50
|
+
}, N = (t, r, a) => {
|
|
51
|
+
const o = t.state.selection.ranges;
|
|
52
|
+
for (let c of o)
|
|
53
|
+
if (c.from >= r && c.from <= a || c.to >= r && c.to <= a || c.from <= r && c.to >= a)
|
|
53
54
|
return !0;
|
|
54
55
|
return !1;
|
|
55
|
-
},
|
|
56
|
-
for (const { from:
|
|
57
|
-
|
|
56
|
+
}, L = (t, r) => {
|
|
57
|
+
for (const { from: a, to: o } of t.visibleRanges)
|
|
58
|
+
$(t.state).iterate({ ...r, from: a, to: o });
|
|
58
59
|
};
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
(t[0] - (1 -
|
|
62
|
-
(t[1] - (1 -
|
|
63
|
-
(t[2] - (1 -
|
|
60
|
+
function de(t, r, a, o = 1) {
|
|
61
|
+
const c = (g) => [
|
|
62
|
+
(t[0] - (1 - g) * r[0]) / g,
|
|
63
|
+
(t[1] - (1 - g) * r[1]) / g,
|
|
64
|
+
(t[2] - (1 - g) * r[2]) / g
|
|
64
65
|
];
|
|
65
|
-
let
|
|
66
|
-
const
|
|
67
|
-
return
|
|
66
|
+
let i = a, l = c(i);
|
|
67
|
+
const n = l.map((g, d) => g < 0 && r[d] > 0 ? 1 - l[d] / r[d] : a), s = Math.max(...n);
|
|
68
|
+
return s > i && (i = Math.min(s, o), t = c(i)), l = l.map((g) => Math.round(g < 0 ? 0 : g)), l.push(i), l;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
HorizontalRule: (l,
|
|
72
|
-
h.line({ class: "hr " + (
|
|
73
|
-
h.mark({ class: "mk" }).range(l,
|
|
70
|
+
function be(t, r) {
|
|
71
|
+
const a = ["Document"], o = {}, c = {
|
|
72
|
+
HorizontalRule: (l, n, s = !0) => [
|
|
73
|
+
h.line({ class: "hr " + (s ? "sw" : "") }).range(l),
|
|
74
|
+
h.mark({ class: "mk" }).range(l, n)
|
|
74
75
|
]
|
|
75
|
-
},
|
|
76
|
-
return
|
|
77
|
-
enter: ({ type: l, from:
|
|
78
|
-
}), h.set(
|
|
76
|
+
}, i = [];
|
|
77
|
+
return L(t, {
|
|
78
|
+
enter: ({ type: l, from: n, to: s }) => (l.name in c && i.push(...c[l.name](n, s, N(t, n, s))), a.includes(l.name) || l.name in o)
|
|
79
|
+
}), h.set(i, !1);
|
|
79
80
|
}
|
|
80
|
-
const
|
|
81
|
+
const me = (t) => {
|
|
81
82
|
const {
|
|
82
83
|
color: r = "black"
|
|
83
84
|
} = t || {};
|
|
@@ -94,29 +95,29 @@ const he = (t) => {
|
|
|
94
95
|
},
|
|
95
96
|
"&.cm-focused .hr.sw::before": { width: "0", height: "0" }
|
|
96
97
|
});
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
}, z = (t = {}) => [
|
|
99
|
+
v(be, {}),
|
|
100
|
+
me(t == null ? void 0 : t.color)
|
|
100
101
|
];
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
StrongEmphasis: (l = !0,
|
|
104
|
-
Strikethrough: (l = !0,
|
|
105
|
-
InlineCode: (l = !0,
|
|
106
|
-
Emphasis: (l = !0,
|
|
107
|
-
Mark: (l,
|
|
108
|
-
},
|
|
109
|
-
return
|
|
110
|
-
enter: ({ type: { name: l }, from:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
function ue(t, r) {
|
|
103
|
+
const a = ["FencedCode"], o = {
|
|
104
|
+
StrongEmphasis: (l = !0, n, s) => h.mark({ class: "il st " + (l ? "sw" : "") }).range(n, s),
|
|
105
|
+
Strikethrough: (l = !0, n, s) => h.mark({ class: "il sk " + (l ? "sw" : "") }).range(n, s),
|
|
106
|
+
InlineCode: (l = !0, n, s) => h.mark({ class: "il ic " + (l ? "sw" : "") }).range(n, s),
|
|
107
|
+
Emphasis: (l = !0, n, s) => h.mark({ class: "il it " + (l ? "sw" : "") }).range(n, s),
|
|
108
|
+
Mark: (l, n) => h.mark({ class: "mkl" }).range(l, n)
|
|
109
|
+
}, c = ["EmphasisMark", "CodeMark", "StrikethroughMark"], i = [];
|
|
110
|
+
return L(t, {
|
|
111
|
+
enter: ({ type: { name: l }, from: n, to: s }) => c.includes(l) ? (i.push(o.Mark(n, s)), !1) : (l in o && i.push(
|
|
112
|
+
o[l](
|
|
113
|
+
N(t, n, s),
|
|
114
|
+
n,
|
|
115
|
+
s
|
|
115
116
|
)
|
|
116
|
-
), !
|
|
117
|
-
}), h.set(
|
|
117
|
+
), !a.includes(l))
|
|
118
|
+
}), h.set(i, !1);
|
|
118
119
|
}
|
|
119
|
-
const
|
|
120
|
+
const fe = B.baseTheme({
|
|
120
121
|
".it ": { fontStyle: "italic" },
|
|
121
122
|
".st ": { fontWeight: "bold" },
|
|
122
123
|
".sk ": { textDecoration: "line-through" },
|
|
@@ -125,89 +126,111 @@ const be = B.baseTheme({
|
|
|
125
126
|
paddingInline: ".6ch",
|
|
126
127
|
borderRadius: ".6ch"
|
|
127
128
|
}
|
|
128
|
-
}),
|
|
129
|
+
}), pe = B.baseTheme({
|
|
129
130
|
".il .mkl": { fontSize: "0" },
|
|
130
131
|
"&.cm-focused .il.sw .mkl": { fontSize: "inherit" }
|
|
131
|
-
}),
|
|
132
|
+
}), Q = (t = {}) => {
|
|
132
133
|
const {
|
|
133
134
|
hideMarks: r = !0
|
|
134
135
|
} = t;
|
|
135
136
|
return [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
r ?
|
|
137
|
+
v(ue, {}),
|
|
138
|
+
fe,
|
|
139
|
+
r ? pe : []
|
|
139
140
|
];
|
|
140
141
|
};
|
|
141
|
-
class
|
|
142
|
-
constructor(
|
|
142
|
+
class ke extends E {
|
|
143
|
+
constructor(a) {
|
|
143
144
|
super();
|
|
144
|
-
|
|
145
|
-
this.checked =
|
|
145
|
+
q(this, "checked", !1);
|
|
146
|
+
this.checked = a;
|
|
146
147
|
}
|
|
147
148
|
// eq(other) { return other.checked == this.checked }
|
|
148
149
|
toDOM() {
|
|
149
|
-
let
|
|
150
|
-
|
|
151
|
-
let
|
|
152
|
-
return
|
|
150
|
+
let a = document.createElement("span");
|
|
151
|
+
a.setAttribute("aria-hidden", "true"), a.className = "TaskMark";
|
|
152
|
+
let o = a.appendChild(document.createElement("input"));
|
|
153
|
+
return o.type = "checkbox", o.checked = this.checked, a;
|
|
153
154
|
}
|
|
154
155
|
ignoreEvent() {
|
|
155
156
|
return !1;
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
159
|
+
function xe(t, r) {
|
|
160
|
+
const a = [
|
|
160
161
|
"Document",
|
|
161
162
|
"ListItem",
|
|
162
|
-
"Task"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}).range(a, c);
|
|
163
|
+
"Task",
|
|
164
|
+
"Blockquote"
|
|
165
|
+
], o = {
|
|
166
|
+
BulletList: {
|
|
167
|
+
class: "bl",
|
|
168
|
+
offset: 2
|
|
169
|
+
},
|
|
170
|
+
OrderedList: {
|
|
171
|
+
class: "ol",
|
|
172
|
+
offset: 3
|
|
173
173
|
}
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)), o.includes(a.name)),
|
|
182
|
-
leave: ({ type: { name: a }, from: c, to: i }) => {
|
|
183
|
-
const d = l.slice(-1)[0];
|
|
184
|
-
d && d.name === a && d.from === c && d.to === i && l.pop();
|
|
174
|
+
}, c = {
|
|
175
|
+
ListMark: (s, g, d, b = !0) => h.mark({ class: `${d.class} lm ${b ? "sw" : ""}` }).range(s, g),
|
|
176
|
+
TaskMarker: (s, g, d, b = !0) => {
|
|
177
|
+
const k = t.state.doc.sliceString(s + 1, g - 1) === "x";
|
|
178
|
+
return b ? h.mark({ class: `tm ${k ? "ck" : ""}` }).range(s, g) : h.replace({
|
|
179
|
+
widget: new ke(k)
|
|
180
|
+
}).range(s, g);
|
|
185
181
|
}
|
|
186
|
-
}
|
|
182
|
+
}, i = {
|
|
183
|
+
ListItem: (s, g, d, b) => {
|
|
184
|
+
const k = d.offset + (b ? 4 : 0), u = s + k, m = `calc(100% - ${Math.max(0, k) + 4}ch)`;
|
|
185
|
+
return u >= g ? [] : [
|
|
186
|
+
h.mark({
|
|
187
|
+
class: "ls-text-line",
|
|
188
|
+
attributes: { style: `width: ${m}` }
|
|
189
|
+
}).range(u, g)
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
}, l = [], n = [];
|
|
193
|
+
return L(t, {
|
|
194
|
+
enter: ({ name: s, from: g, to: d, node: b }) => s in o ? (n.push({ name: s, from: g, to: d }), !0) : (s in c && l.push(c[s](
|
|
195
|
+
g,
|
|
196
|
+
d,
|
|
197
|
+
o[n.slice(-1)[0].name],
|
|
198
|
+
N(t, g, d)
|
|
199
|
+
)), s in i && (console.log({ node: b, name: s }), l.push(...i[s](
|
|
200
|
+
g,
|
|
201
|
+
d,
|
|
202
|
+
o[n.slice(-1)[0].name],
|
|
203
|
+
b.getChild("Task") !== null
|
|
204
|
+
))), a.includes(s)),
|
|
205
|
+
leave: ({ name: s, from: g, to: d }) => {
|
|
206
|
+
const b = n.slice(-1)[0];
|
|
207
|
+
b && b.name === s && b.from === g && b.to === d && n.pop();
|
|
208
|
+
}
|
|
209
|
+
}), h.set(l, !0);
|
|
187
210
|
}
|
|
188
|
-
const
|
|
189
|
-
var
|
|
190
|
-
let
|
|
191
|
-
if (
|
|
192
|
-
},
|
|
193
|
-
const
|
|
194
|
-
let
|
|
195
|
-
if (
|
|
196
|
-
else if (
|
|
211
|
+
const Ce = (t, r) => {
|
|
212
|
+
var o;
|
|
213
|
+
let a = t.target;
|
|
214
|
+
if (a.nodeName === "INPUT" && ((o = a.parentElement) != null && o.classList.contains("TaskMark"))) return ye(r, r.posAtDOM(a));
|
|
215
|
+
}, ye = (t, r) => {
|
|
216
|
+
const a = r - 2, o = r - 1;
|
|
217
|
+
let c = t.state.doc.sliceString(Math.max(0, a), o), i;
|
|
218
|
+
if (c === "x") i = { from: a, to: o, insert: " " };
|
|
219
|
+
else if (c === " ") i = { from: a, to: o, insert: "x" };
|
|
197
220
|
else return !1;
|
|
198
|
-
return t.dispatch({ changes:
|
|
199
|
-
},
|
|
221
|
+
return t.dispatch({ changes: i }), !0;
|
|
222
|
+
}, we = (t) => {
|
|
200
223
|
const {
|
|
201
224
|
color: r = "black"
|
|
202
225
|
} = t || {};
|
|
203
226
|
return B.baseTheme({
|
|
204
227
|
/* Bullet list Point */
|
|
205
|
-
".lm.bl": {
|
|
228
|
+
"& .lm.bl": {
|
|
206
229
|
position: "relative",
|
|
207
230
|
paddingInlineStart: "1ch",
|
|
208
231
|
color: "transparent"
|
|
209
232
|
},
|
|
210
|
-
".lm.bl::before": {
|
|
233
|
+
"& .lm.bl::before": {
|
|
211
234
|
content: '""',
|
|
212
235
|
display: "inline",
|
|
213
236
|
position: "absolute",
|
|
@@ -224,141 +247,150 @@ const pe = (t, r) => {
|
|
|
224
247
|
"&.cm-focused .lm.bl.sw, &.cm-focused .lm.bl.sw::before": {
|
|
225
248
|
backgroundColor: "transparent",
|
|
226
249
|
color: "inherit"
|
|
250
|
+
},
|
|
251
|
+
/* list text line */
|
|
252
|
+
"& .ls-text-line": {
|
|
253
|
+
display: "inline-block",
|
|
254
|
+
ariaHidden: "true"
|
|
255
|
+
// border: "red 1px solid"
|
|
256
|
+
},
|
|
257
|
+
"& .cm-line .lm, & .cm-line .TaskMark, & .cm-line .tm, & .cm-line .ls-text-line": {
|
|
258
|
+
verticalAlign: "top"
|
|
227
259
|
}
|
|
228
260
|
});
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
],
|
|
233
|
-
var
|
|
234
|
-
let
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
let
|
|
261
|
+
}, K = (t = {}) => [
|
|
262
|
+
v(xe, {}, { eventHandlers: { mousedown: Ce } }),
|
|
263
|
+
we(t == null ? void 0 : t.color)
|
|
264
|
+
], Fe = (t, r) => {
|
|
265
|
+
var o;
|
|
266
|
+
let a = t.target;
|
|
267
|
+
if (a.nodeName === "BUTTON" && ((o = a.parentElement) != null && o.classList.contains("wg-codeblock"))) {
|
|
268
|
+
const c = ["FencedCode", "CodeBlock"];
|
|
269
|
+
let i = "";
|
|
238
270
|
const l = {
|
|
239
|
-
enter: ({ type: { name:
|
|
271
|
+
enter: ({ type: { name: n }, from: s, to: g, node: d }) => (c.includes(n) && (i = Be(r, d.toTree(), s, g)), !c.includes(n))
|
|
240
272
|
};
|
|
241
|
-
return
|
|
273
|
+
return $(r.state).iterate({
|
|
242
274
|
...l,
|
|
243
|
-
from: r.posAtDOM(
|
|
244
|
-
to: r.posAtDOM(
|
|
245
|
-
}), navigator.clipboard.writeText(
|
|
275
|
+
from: r.posAtDOM(a),
|
|
276
|
+
to: r.posAtDOM(a) + 2
|
|
277
|
+
}), navigator.clipboard.writeText(i), !0;
|
|
246
278
|
}
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
let
|
|
279
|
+
}, Be = (t, r, a, o) => {
|
|
280
|
+
const c = ["CodeMark", "CodeInfo"];
|
|
281
|
+
let i = t.state.doc.sliceString(a, o), l = /* @__PURE__ */ new Set();
|
|
250
282
|
r.iterate({
|
|
251
|
-
enter({ type: { name: d }, from: b, node:
|
|
252
|
-
|
|
283
|
+
enter({ type: { name: d }, from: b, node: k }) {
|
|
284
|
+
c.includes(d) && l.add(t.state.doc.lineAt(b + a).number);
|
|
253
285
|
}
|
|
254
286
|
});
|
|
255
|
-
const
|
|
256
|
-
return
|
|
287
|
+
const n = t.state.doc.lineAt(a), s = a - n.from, g = [];
|
|
288
|
+
return i.split(`
|
|
257
289
|
`).forEach((d, b) => {
|
|
258
|
-
l.has(b +
|
|
259
|
-
}),
|
|
290
|
+
l.has(b + n.number) || g.push(d.slice(s));
|
|
291
|
+
}), g.join(`
|
|
260
292
|
`);
|
|
261
293
|
};
|
|
262
|
-
class
|
|
263
|
-
constructor(
|
|
294
|
+
class R extends E {
|
|
295
|
+
constructor(a, o, c) {
|
|
264
296
|
super();
|
|
265
|
-
|
|
266
|
-
this.classes =
|
|
297
|
+
q(this, "classes", "");
|
|
298
|
+
this.classes = a, this.width = o, this.marginLeft = c;
|
|
267
299
|
}
|
|
268
300
|
toDOM() {
|
|
269
|
-
let
|
|
270
|
-
return
|
|
301
|
+
let a = document.createElement("span");
|
|
302
|
+
return a.setAttribute("aria-hidden", "true"), a.className = this.classes + " vacio", a.textContent = " ", a.style.width = this.width, a.style.marginLeft = this.marginLeft, a;
|
|
271
303
|
}
|
|
272
304
|
ignoreEvent() {
|
|
273
305
|
return !1;
|
|
274
306
|
}
|
|
275
307
|
}
|
|
276
|
-
const
|
|
308
|
+
const ve = (t) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
277
309
|
<path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M15 0C15.5304 0 16.0391 0.210714 16.4142 0.585786C16.7893 0.960859 17 1.46957 17 2V12C17 12.5304 16.7893 13.0391 16.4142 13.4142C16.0391 13.7893 15.5304 14 15 14H14V6C14 4.93913 13.5786 3.92172 12.8284 3.17157C12.0783 2.42143 11.0609 2 10 2H7C6.64895 1.99924 6.30395 2.09135 6 2.267V2C6 1.46957 6.21071 0.960859 6.58579 0.585786C6.96086 0.210714 7.46957 0 8 0H15Z"/>
|
|
278
310
|
<path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M5 4.054V8H1.2C1.27464 7.84448 1.3691 7.69928 1.481 7.568L3.941 4.698C4.2169 4.37661 4.58771 4.15111 5 4.054ZM7 4V8C7 8.53043 6.78929 9.03914 6.41421 9.41421C6.03914 9.78929 5.53043 10 5 10H1V16C1 16.5304 1.21071 17.0391 1.58579 17.4142C1.96086 17.7893 2.46957 18 3 18H10C10.5304 18 11.0391 17.7893 11.4142 17.4142C11.7893 17.0391 12 16.5304 12 16V6C12 5.46957 11.7893 4.96086 11.4142 4.58579C11.0391 4.21071 10.5304 4 10 4H7Z"/>
|
|
279
311
|
</svg>`;
|
|
280
|
-
class
|
|
281
|
-
constructor(r,
|
|
282
|
-
super(), this.type = r, this.code =
|
|
312
|
+
class Ne extends E {
|
|
313
|
+
constructor(r, a) {
|
|
314
|
+
super(), this.type = r, this.code = a;
|
|
283
315
|
}
|
|
284
316
|
toDOM() {
|
|
285
317
|
let r = document.createElement("span");
|
|
286
318
|
r.setAttribute("aria-hidden", "true"), r.className = "wg-codeblock";
|
|
287
|
-
let
|
|
288
|
-
return
|
|
319
|
+
let a = document.createElement("button");
|
|
320
|
+
return a.className = "wg-codeblock-btn", a.innerHTML = ve(), r.appendChild(a), r;
|
|
289
321
|
}
|
|
290
322
|
ignoreEvent() {
|
|
291
323
|
return !1;
|
|
292
324
|
}
|
|
293
325
|
}
|
|
294
|
-
const
|
|
295
|
-
function
|
|
326
|
+
const T = [];
|
|
327
|
+
function W(t, r) {
|
|
296
328
|
const {
|
|
297
|
-
mode:
|
|
329
|
+
mode: a
|
|
298
330
|
/* type, mark */
|
|
299
|
-
} = r,
|
|
300
|
-
FencedCode:
|
|
301
|
-
CodeBlock:
|
|
302
|
-
},
|
|
303
|
-
CodeMark: (
|
|
304
|
-
CodeInfo: (
|
|
331
|
+
} = r, o = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
|
|
332
|
+
FencedCode: I,
|
|
333
|
+
CodeBlock: I
|
|
334
|
+
}, i = {
|
|
335
|
+
CodeMark: (n, s, g) => [h.mark({ class: "cb-mk" }).range(s, g)],
|
|
336
|
+
CodeInfo: (n, s, g) => [h.mark({ class: "cb-mi" }).range(s, g)]
|
|
305
337
|
}, l = [];
|
|
306
|
-
return
|
|
307
|
-
enter: ({ type: { name:
|
|
308
|
-
Leave: ({ type: { name:
|
|
338
|
+
return L(t, {
|
|
339
|
+
enter: ({ type: { name: n }, from: s, to: g }) => (a === "type" && n in c && l.push(...c[n](t, s, g)), a === "mark" && n in i && l.push(...i[n](t, s, g)), o.includes(n) || n in c ? (T.push({ name: n, from: s, to: g }), !0) : !1),
|
|
340
|
+
Leave: ({ type: { name: n }, from: s, to: g }) => o.includes(n) || n in c ? (T.pop(), !0) : !1
|
|
309
341
|
}), {
|
|
310
342
|
type: h.set(l, !0),
|
|
311
343
|
mark: h.set(l, !0)
|
|
312
|
-
}[
|
|
344
|
+
}[a];
|
|
313
345
|
}
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
d ||
|
|
317
|
-
h.widget({ widget: new
|
|
346
|
+
const I = (t, r, a) => {
|
|
347
|
+
const o = [], c = T[T.length - 1], i = ["BulletList", "OrderedList", "ListItem"].some((u) => u === c.name), l = ["Blockquote"].some((u) => u === c.name), n = t.state.doc.lineAt(r), s = r - n.from, g = s > 0, d = N(t, n.from, a);
|
|
348
|
+
d || o.push(
|
|
349
|
+
h.widget({ widget: new Ne("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(r + 1)
|
|
318
350
|
);
|
|
319
|
-
const b =
|
|
351
|
+
const b = n.number, k = t.state.doc.sliceString(r, a).split(`
|
|
320
352
|
`).length;
|
|
321
|
-
for (let
|
|
322
|
-
const { from:
|
|
323
|
-
d &&
|
|
324
|
-
const p = Math.max(
|
|
325
|
-
if (
|
|
326
|
-
|
|
353
|
+
for (let u = b; u < k + b; u++) {
|
|
354
|
+
const { from: m, to: x } = t.state.doc.line(u), F = "100% - 1.2ch", y = ["cb-content"];
|
|
355
|
+
d && y.push("sw"), u === b && y.push("cb-start"), u === k + b - 1 && y.push("cb-end");
|
|
356
|
+
const p = Math.max(m + s, 0);
|
|
357
|
+
if (x < p)
|
|
358
|
+
y.push("free"), o.push(
|
|
327
359
|
h.widget({
|
|
328
|
-
widget: new
|
|
329
|
-
|
|
330
|
-
`calc(${
|
|
331
|
-
`calc(${p -
|
|
360
|
+
widget: new R(
|
|
361
|
+
y.join(" "),
|
|
362
|
+
`calc(${F} - ${p - m}ch)`,
|
|
363
|
+
`calc(${p - x}ch + 2px)`
|
|
332
364
|
),
|
|
333
365
|
side: 1
|
|
334
|
-
}).range(
|
|
366
|
+
}).range(x)
|
|
335
367
|
), console.log("Hello World");
|
|
336
|
-
else if (p ===
|
|
337
|
-
|
|
368
|
+
else if (p === x)
|
|
369
|
+
y.push("wg"), o.push(
|
|
338
370
|
h.widget({
|
|
339
|
-
widget: new
|
|
340
|
-
|
|
341
|
-
`calc(${
|
|
371
|
+
widget: new R(
|
|
372
|
+
y.join(" "),
|
|
373
|
+
`calc(${F} - ${p - m}ch)`
|
|
342
374
|
),
|
|
343
375
|
side: 1
|
|
344
376
|
}).range(p)
|
|
345
377
|
);
|
|
346
|
-
else if (
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
} else if (
|
|
350
|
-
const
|
|
351
|
-
|
|
378
|
+
else if (i || l || g) {
|
|
379
|
+
const w = { style: `width: calc(${F} - ${p - m}ch)` };
|
|
380
|
+
x > p && o.push(h.mark({ class: y.join(" "), attributes: w }).range(p, x)), m !== p && i && o.push(h.mark({ class: "cb-listsp" }).range(m, p)), m !== p && g && o.push(h.mark({ class: "cb-spacer" }).range(m, p)), m !== p && l && o.push(h.mark({ class: "cb-quote bq" }).range(m, p));
|
|
381
|
+
} else if (m !== x) {
|
|
382
|
+
const w = { style: `width: calc(${F})` };
|
|
383
|
+
o.push(h.mark({ class: y.join(" "), attributes: w }).range(m, x));
|
|
352
384
|
}
|
|
353
|
-
|
|
385
|
+
o.push(h.line({ class: "cb-line" }).range(m));
|
|
354
386
|
}
|
|
355
|
-
return
|
|
356
|
-
},
|
|
357
|
-
const
|
|
387
|
+
return o;
|
|
388
|
+
}, Le = () => {
|
|
389
|
+
const o = "4px", c = "1lh";
|
|
358
390
|
return B.baseTheme({
|
|
359
|
-
".cb-start": { borderRadius: `${
|
|
360
|
-
".cb-end ": { borderRadius: `0 0 ${
|
|
361
|
-
".cb-start.cb-end": { borderRadius: `${
|
|
391
|
+
".cb-start": { borderRadius: `${o} ${o} 0 0` },
|
|
392
|
+
".cb-end ": { borderRadius: `0 0 ${o} ${o}` },
|
|
393
|
+
".cb-start.cb-end": { borderRadius: `${o}` },
|
|
362
394
|
".cb-content": {
|
|
363
395
|
display: "inline-block",
|
|
364
396
|
marginLeft: "2px",
|
|
@@ -399,12 +431,12 @@ const P = (t, r, o) => {
|
|
|
399
431
|
outline: "none",
|
|
400
432
|
justifyContent: "center",
|
|
401
433
|
alignItems: "center",
|
|
402
|
-
height: `calc(${
|
|
434
|
+
height: `calc(${c} + 4px )`,
|
|
403
435
|
width: "5ch"
|
|
404
436
|
},
|
|
405
437
|
".cb-icon": {
|
|
406
|
-
width:
|
|
407
|
-
height:
|
|
438
|
+
width: c,
|
|
439
|
+
height: c,
|
|
408
440
|
pointerEvents: "none",
|
|
409
441
|
fill: "currentColor",
|
|
410
442
|
opacity: "0.7"
|
|
@@ -423,41 +455,41 @@ const P = (t, r, o) => {
|
|
|
423
455
|
width: "5ch"
|
|
424
456
|
}
|
|
425
457
|
});
|
|
426
|
-
},
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
458
|
+
}, G = (t) => [
|
|
459
|
+
v(W, { mode: "mark" }),
|
|
460
|
+
v(W, { mode: "type" }, { eventHandlers: { mousedown: Fe } }),
|
|
461
|
+
Le()
|
|
430
462
|
];
|
|
431
|
-
function
|
|
432
|
-
const
|
|
433
|
-
ATXHeading1: (l,
|
|
434
|
-
ATXHeading2: (l,
|
|
435
|
-
ATXHeading3: (l,
|
|
436
|
-
ATXHeading4: (l,
|
|
437
|
-
ATXHeading5: (l,
|
|
438
|
-
ATXHeading6: (l,
|
|
439
|
-
},
|
|
440
|
-
HeaderMark: (l,
|
|
441
|
-
},
|
|
442
|
-
return
|
|
443
|
-
enter: ({ type: l, from:
|
|
444
|
-
}), h.set(
|
|
463
|
+
function Ee(t, r) {
|
|
464
|
+
const a = ["Document"], o = {
|
|
465
|
+
ATXHeading1: (l, n = !0) => h.line({ class: "h1 hg " + (n ? "sw" : "") }).range(l),
|
|
466
|
+
ATXHeading2: (l, n = !0) => h.line({ class: "h2 hg " + (n ? "sw" : "") }).range(l),
|
|
467
|
+
ATXHeading3: (l, n = !0) => h.line({ class: "h3 hg " + (n ? "sw" : "") }).range(l),
|
|
468
|
+
ATXHeading4: (l, n = !0) => h.line({ class: "h4 hg " + (n ? "sw" : "") }).range(l),
|
|
469
|
+
ATXHeading5: (l, n = !0) => h.line({ class: "h5 hg " + (n ? "sw" : "") }).range(l),
|
|
470
|
+
ATXHeading6: (l, n = !0) => h.line({ class: "h6 hg " + (n ? "sw" : "") }).range(l)
|
|
471
|
+
}, c = {
|
|
472
|
+
HeaderMark: (l, n) => h.mark({ class: "mk" }).range(l, n)
|
|
473
|
+
}, i = [];
|
|
474
|
+
return L(t, {
|
|
475
|
+
enter: ({ type: l, from: n, to: s }) => (l.name in o && i.push(o[l.name](n, N(t, n, s))), l.name in c && i.push(c[l.name](n, s + 1)), a.includes(l.name) || l.name in o)
|
|
476
|
+
}), h.set(i, !1);
|
|
445
477
|
}
|
|
446
|
-
const
|
|
478
|
+
const qe = B.baseTheme({
|
|
447
479
|
".h1 ": { fontSize: "2.6rem" },
|
|
448
480
|
".h2 ": { fontSize: "2.0rem" },
|
|
449
481
|
".h3 ": { fontSize: "1.8rem" },
|
|
450
482
|
".h4 ": { fontSize: "1.6rem" },
|
|
451
483
|
".h5 ": { fontSize: "1.4rem" },
|
|
452
484
|
".h6 ": { fontSize: "1.2rem" }
|
|
453
|
-
}),
|
|
485
|
+
}), Me = B.baseTheme({
|
|
454
486
|
".hg .mk": { fontSize: "0" },
|
|
455
487
|
"&.cm-focused .hg.sw .mk": { fontSize: "inherit" }
|
|
456
|
-
}),
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
],
|
|
488
|
+
}), _ = (t = {}) => [
|
|
489
|
+
v(Ee, {}),
|
|
490
|
+
qe,
|
|
491
|
+
Me
|
|
492
|
+
], Te = {
|
|
461
493
|
version: "1.7.1",
|
|
462
494
|
latte: {
|
|
463
495
|
name: "Latte",
|
|
@@ -3251,14 +3283,14 @@ const ve = B.baseTheme({
|
|
|
3251
3283
|
}
|
|
3252
3284
|
}
|
|
3253
3285
|
}
|
|
3254
|
-
},
|
|
3255
|
-
...
|
|
3256
|
-
colorEntries:
|
|
3257
|
-
ansiColorEntries:
|
|
3286
|
+
}, M = (t) => Object.entries(t), { version: wr, ...Ae } = Te, Y = M(Ae).reduce((t, [r, a]) => (t[r] = {
|
|
3287
|
+
...a,
|
|
3288
|
+
colorEntries: M(a.colors),
|
|
3289
|
+
ansiColorEntries: M(a.ansiColors)
|
|
3258
3290
|
}, t), {});
|
|
3259
|
-
|
|
3260
|
-
const
|
|
3261
|
-
const
|
|
3291
|
+
M(Y);
|
|
3292
|
+
const C = ({ variant: t, settings: r, styles: a }) => {
|
|
3293
|
+
const o = A.theme({
|
|
3262
3294
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3263
3295
|
"&": {
|
|
3264
3296
|
backgroundColor: r.background,
|
|
@@ -3285,10 +3317,10 @@ const k = ({ variant: t, settings: r, styles: o }) => {
|
|
|
3285
3317
|
}
|
|
3286
3318
|
}, {
|
|
3287
3319
|
dark: t === "dark"
|
|
3288
|
-
}),
|
|
3289
|
-
return [
|
|
3320
|
+
}), c = ne.define(a);
|
|
3321
|
+
return [o, le(c)];
|
|
3290
3322
|
};
|
|
3291
|
-
|
|
3323
|
+
C({
|
|
3292
3324
|
variant: "dark",
|
|
3293
3325
|
settings: {
|
|
3294
3326
|
background: "#200020",
|
|
@@ -3370,7 +3402,7 @@ k({
|
|
|
3370
3402
|
}
|
|
3371
3403
|
]
|
|
3372
3404
|
});
|
|
3373
|
-
|
|
3405
|
+
C({
|
|
3374
3406
|
variant: "light",
|
|
3375
3407
|
settings: {
|
|
3376
3408
|
background: "#fcfcfc",
|
|
@@ -3444,7 +3476,7 @@ k({
|
|
|
3444
3476
|
}
|
|
3445
3477
|
]
|
|
3446
3478
|
});
|
|
3447
|
-
|
|
3479
|
+
C({
|
|
3448
3480
|
variant: "dark",
|
|
3449
3481
|
settings: {
|
|
3450
3482
|
background: "#15191EFA",
|
|
@@ -3500,7 +3532,7 @@ k({
|
|
|
3500
3532
|
}
|
|
3501
3533
|
]
|
|
3502
3534
|
});
|
|
3503
|
-
|
|
3535
|
+
C({
|
|
3504
3536
|
variant: "dark",
|
|
3505
3537
|
settings: {
|
|
3506
3538
|
background: "#2e241d",
|
|
@@ -3550,7 +3582,7 @@ k({
|
|
|
3550
3582
|
}
|
|
3551
3583
|
]
|
|
3552
3584
|
});
|
|
3553
|
-
|
|
3585
|
+
C({
|
|
3554
3586
|
variant: "dark",
|
|
3555
3587
|
settings: {
|
|
3556
3588
|
background: "#3b2627",
|
|
@@ -3612,7 +3644,7 @@ k({
|
|
|
3612
3644
|
}
|
|
3613
3645
|
]
|
|
3614
3646
|
});
|
|
3615
|
-
|
|
3647
|
+
C({
|
|
3616
3648
|
variant: "dark",
|
|
3617
3649
|
settings: {
|
|
3618
3650
|
background: "#000205",
|
|
@@ -3648,7 +3680,7 @@ k({
|
|
|
3648
3680
|
}
|
|
3649
3681
|
]
|
|
3650
3682
|
});
|
|
3651
|
-
|
|
3683
|
+
C({
|
|
3652
3684
|
variant: "light",
|
|
3653
3685
|
settings: {
|
|
3654
3686
|
background: "#fff",
|
|
@@ -3690,7 +3722,7 @@ k({
|
|
|
3690
3722
|
}
|
|
3691
3723
|
]
|
|
3692
3724
|
});
|
|
3693
|
-
|
|
3725
|
+
C({
|
|
3694
3726
|
variant: "dark",
|
|
3695
3727
|
settings: {
|
|
3696
3728
|
background: "#00254b",
|
|
@@ -3762,7 +3794,7 @@ k({
|
|
|
3762
3794
|
}
|
|
3763
3795
|
]
|
|
3764
3796
|
});
|
|
3765
|
-
|
|
3797
|
+
C({
|
|
3766
3798
|
variant: "dark",
|
|
3767
3799
|
settings: {
|
|
3768
3800
|
background: "#060521",
|
|
@@ -3822,7 +3854,7 @@ k({
|
|
|
3822
3854
|
}
|
|
3823
3855
|
]
|
|
3824
3856
|
});
|
|
3825
|
-
|
|
3857
|
+
C({
|
|
3826
3858
|
variant: "dark",
|
|
3827
3859
|
settings: {
|
|
3828
3860
|
background: "#2d2f3f",
|
|
@@ -3869,7 +3901,7 @@ k({
|
|
|
3869
3901
|
}
|
|
3870
3902
|
]
|
|
3871
3903
|
});
|
|
3872
|
-
|
|
3904
|
+
C({
|
|
3873
3905
|
variant: "light",
|
|
3874
3906
|
settings: {
|
|
3875
3907
|
background: "#FFFFFF",
|
|
@@ -3909,7 +3941,7 @@ k({
|
|
|
3909
3941
|
}
|
|
3910
3942
|
]
|
|
3911
3943
|
});
|
|
3912
|
-
|
|
3944
|
+
C({
|
|
3913
3945
|
variant: "light",
|
|
3914
3946
|
settings: {
|
|
3915
3947
|
background: "#f2f1f8",
|
|
@@ -3984,7 +4016,7 @@ k({
|
|
|
3984
4016
|
}
|
|
3985
4017
|
]
|
|
3986
4018
|
});
|
|
3987
|
-
|
|
4019
|
+
C({
|
|
3988
4020
|
variant: "light",
|
|
3989
4021
|
settings: {
|
|
3990
4022
|
background: "#faf4ed",
|
|
@@ -4038,7 +4070,7 @@ k({
|
|
|
4038
4070
|
}
|
|
4039
4071
|
]
|
|
4040
4072
|
});
|
|
4041
|
-
|
|
4073
|
+
C({
|
|
4042
4074
|
variant: "light",
|
|
4043
4075
|
settings: {
|
|
4044
4076
|
background: "#FFFFFF",
|
|
@@ -4116,7 +4148,7 @@ k({
|
|
|
4116
4148
|
}
|
|
4117
4149
|
]
|
|
4118
4150
|
});
|
|
4119
|
-
|
|
4151
|
+
C({
|
|
4120
4152
|
variant: "light",
|
|
4121
4153
|
settings: {
|
|
4122
4154
|
background: "#fef7e5",
|
|
@@ -4188,7 +4220,7 @@ k({
|
|
|
4188
4220
|
}
|
|
4189
4221
|
]
|
|
4190
4222
|
});
|
|
4191
|
-
|
|
4223
|
+
C({
|
|
4192
4224
|
variant: "light",
|
|
4193
4225
|
settings: {
|
|
4194
4226
|
background: "#FFFFFF",
|
|
@@ -4238,19 +4270,19 @@ k({
|
|
|
4238
4270
|
}
|
|
4239
4271
|
]
|
|
4240
4272
|
});
|
|
4241
|
-
const
|
|
4242
|
-
const r =
|
|
4243
|
-
return [
|
|
4244
|
-
|
|
4273
|
+
const De = new ce(), Se = (t = "latte") => {
|
|
4274
|
+
const r = Y[t].colors, a = r.base, o = t === "latte" ? "#484b64" : r.text.hex, c = He(r.crust.rgb, a.rgb, 0.1);
|
|
4275
|
+
return document.querySelector(":root").style.setProperty("--editor-background", a.hex), [
|
|
4276
|
+
C({
|
|
4245
4277
|
variant: t === "latte" ? "light" : "dark",
|
|
4246
4278
|
settings: {
|
|
4247
|
-
background:
|
|
4248
|
-
foreground:
|
|
4279
|
+
background: a.hex,
|
|
4280
|
+
foreground: o,
|
|
4249
4281
|
caret: r.rosewater.hex,
|
|
4250
4282
|
// selection: selection,
|
|
4251
|
-
lineHighlight:
|
|
4252
|
-
gutterBackground:
|
|
4253
|
-
gutterForeground:
|
|
4283
|
+
lineHighlight: H(r.overlay1.rgb, 0.1),
|
|
4284
|
+
gutterBackground: a.hex,
|
|
4285
|
+
gutterForeground: o
|
|
4254
4286
|
},
|
|
4255
4287
|
styles: [
|
|
4256
4288
|
// python
|
|
@@ -4293,7 +4325,7 @@ const Le = new le(), De = (t = "latte") => {
|
|
|
4293
4325
|
// no necesary good
|
|
4294
4326
|
{ tag: e.labelName, color: r.teal.hex },
|
|
4295
4327
|
// no necesary good
|
|
4296
|
-
{ tag: e.variableName, color:
|
|
4328
|
+
{ tag: e.variableName, color: o },
|
|
4297
4329
|
// no necesary good
|
|
4298
4330
|
{ tag: e.operator, color: r.sky.hex },
|
|
4299
4331
|
{ tag: e.logicOperator, color: r.sky.hex },
|
|
@@ -4321,88 +4353,134 @@ const Le = new le(), De = (t = "latte") => {
|
|
|
4321
4353
|
{ tag: e.macroName, color: r.peach.hex }
|
|
4322
4354
|
]
|
|
4323
4355
|
}),
|
|
4324
|
-
|
|
4356
|
+
A.theme({
|
|
4325
4357
|
// Editor
|
|
4326
|
-
"& .cm-selectionBackground, ::selection": { background: `${
|
|
4358
|
+
"& .cm-selectionBackground, ::selection": { background: `${H(r.overlay2.rgb, 0.3)} !important` },
|
|
4327
4359
|
// Code
|
|
4328
|
-
"& .cb-content, & .ic": { backgroundColor:
|
|
4329
|
-
".cb-icon": { fill:
|
|
4330
|
-
".wg-codeblock-btn:hover": { backgroundColor:
|
|
4360
|
+
"& .cb-content, & .ic": { backgroundColor: c },
|
|
4361
|
+
".cb-icon": { fill: o },
|
|
4362
|
+
".wg-codeblock-btn:hover": { backgroundColor: H(r.overlay1.rgb, 0.2) },
|
|
4331
4363
|
// Blockquote
|
|
4332
|
-
".bq-none-mark": { "--bq-none-mark":
|
|
4364
|
+
".bq-none-mark": { "--bq-none-mark": o },
|
|
4333
4365
|
".bq-note-mark": { "--bq-note-mark": r.blue.hex },
|
|
4334
4366
|
".bq-tip-mark": { "--bq-tip-mark": r.green.hex },
|
|
4335
4367
|
".bq-warning-mark": { "--bq-warning-mark": r.peach.hex },
|
|
4336
4368
|
".bq-important-mark": { "--bq-important-mark": r.mauve.hex },
|
|
4337
4369
|
".bq-caution-mark": { "--bq-caution-mark": r.red.hex },
|
|
4370
|
+
".wg-qt-icon": {
|
|
4371
|
+
"--bq-none-mark": o,
|
|
4372
|
+
"--bq-note-mark": r.blue.hex,
|
|
4373
|
+
"--bq-tip-mark": r.green.hex,
|
|
4374
|
+
"--bq-warning-mark": r.peach.hex,
|
|
4375
|
+
"--bq-important-mark": r.mauve.hex,
|
|
4376
|
+
"--bq-caution-mark": r.red.hex
|
|
4377
|
+
},
|
|
4338
4378
|
// Links
|
|
4339
4379
|
"& a.url": { color: r.blue.hex },
|
|
4340
|
-
"& a.url:visited": { color: r.mauve.hex }
|
|
4380
|
+
"& a.url:visited": { color: r.mauve.hex },
|
|
4381
|
+
// Html
|
|
4382
|
+
"& .cm-rendered-tag": {
|
|
4383
|
+
border: `1px solid ${r.surface2.hex}`,
|
|
4384
|
+
borderRadius: "4px",
|
|
4385
|
+
fontSize: ".8em",
|
|
4386
|
+
padding: "0px 3px",
|
|
4387
|
+
background: r.surface0.hex
|
|
4388
|
+
}
|
|
4341
4389
|
}, { dark: t !== "latte" })
|
|
4342
4390
|
];
|
|
4343
|
-
},
|
|
4344
|
-
const
|
|
4345
|
-
return `rgba(${
|
|
4346
|
-
},
|
|
4347
|
-
|
|
4348
|
-
|
|
4391
|
+
}, He = (t, r, a) => {
|
|
4392
|
+
const o = [t.r, t.g, t.b], c = [r.r, r.g, r.b];
|
|
4393
|
+
return `rgba(${de(o, c, a, 0.3).join(", ")})`;
|
|
4394
|
+
}, H = (t, r) => `rgba(${t.r}, ${t.g}, ${t.b}, ${r})`, $e = (t) => `<svg class="qt-icon qt-caution" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4395
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M196.094 54.176C191.229 54.988 188.782 56.222 167.834 68.423C158.562 73.823 147.197 80.435 142.578 83.117C137.959 85.799 129.961 90.458 124.805 93.47C119.648 96.482 111.211 101.406 106.055 104.413C84.503 116.982 82.78 118.066 79.627 121.029C76.043 124.397 73.548 127.986 71.861 132.199C69.426 138.28 69.543 135.024 69.435 199.872L69.336 259.18L70.21 263.086C72.901 275.106 75.333 277.456 99.826 291.697C130.626 309.606 166.896 330.685 175.781 335.841C190.902 344.615 195.154 346.196 201.915 345.563C208.158 344.978 210.107 344.123 225.391 335.264C255.218 317.977 294.844 294.867 311.417 285.093C322.591 278.504 327.153 273.047 329.413 263.569L330.273 259.961V199.609V139.258L329.396 135.938C327.721 129.594 324.327 124.148 319.504 120.066C316.509 117.531 317.424 118.075 248.047 77.651C205.151 52.657 205.162 52.662 196.094 54.176ZM206.746 110.34C212.104 111.475 216.464 114.838 218.945 119.75C220.313 122.457 220.428 126.187 219.575 140.039C219.323 144.121 218.592 157.129 217.95 168.945C214.743 227.944 214.663 228.952 212.917 232.683C208.369 242.403 195.202 244.021 188.814 235.646C185.935 231.872 185.59 229.751 184.375 208.398C183.935 200.664 182.688 180.01 181.605 162.5C178.965 119.84 178.966 119.825 183.963 114.828C188.541 110.25 197.755 108.434 206.746 110.34ZM205.105 254.139C220.433 258.641 225.321 277.899 213.857 288.623C198.306 303.17 174.003 287.211 181.04 267.073C184.452 257.309 195.564 251.336 205.105 254.139Z"/>
|
|
4396
|
+
</svg>`, Oe = (t) => `<svg class="qt-icon qt-warning" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4397
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M195.982 53.527C185.35 55.195 178.527 60.217 172.381 70.898C165.461 82.925 148.022 114.138 122.184 160.742C115.633 172.559 100.427 199.98 88.394 221.68C57.505 277.38 55.934 280.238 54.25 283.76C45.588 301.882 55.075 322.592 74.884 328.805L78.32 329.883L198.438 329.99C278.577 330.062 319.42 329.965 321.154 329.699C337.809 327.15 349.594 312.698 348.718 295.898C348.297 287.827 348.329 287.895 328.438 252.148C310.272 219.501 297.79 196.996 280.665 166.016C235.38 84.092 225.675 66.998 222.278 63.175C216.156 56.285 204.847 52.136 195.982 53.527ZM209.263 116.46C218.176 119.751 220.681 125.503 219.95 141.003C219.711 146.059 219.256 155.732 218.938 162.5C218.62 169.268 218.011 180.43 217.584 187.305C216.759 200.593 216.366 207.385 215.42 224.66C215.058 231.282 214.609 236.196 214.259 237.373C210.281 250.771 189.551 250.542 185.792 237.058C185.226 235.025 184.802 229.702 183.979 214.258C183.761 210.176 183.323 202.881 183.006 198.047C182.213 185.991 181.756 178.028 181.054 164.063C180.724 157.51 180.287 149.424 180.081 146.094C178.833 125.858 181.444 119.151 191.797 115.99C194.231 115.247 206.901 115.588 209.263 116.46ZM205.893 260.709C224.265 266.28 227.749 290.936 211.55 300.733C192.458 312.28 170.521 292.287 180.334 272.284C184.884 263.009 196.351 257.816 205.893 260.709Z"/>
|
|
4398
|
+
</svg>`, Re = (t) => `<svg class="qt-icon qt-important" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4399
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M190.234 64.334C153.518 67.16 117.751 87.08 95.346 117.181C46.258 183.13 68.9 277.91 142.564 314.837C228.927 358.129 330.405 294.361 330.594 196.68C330.742 119.807 265.747 58.523 190.234 64.334ZM219.531 126.465C220.494 126.947 221.218 127.78 221.98 129.284L223.062 131.421L222.957 139.621L222.852 147.822L221.875 148.263C213.74 151.931 214.67 145.87 214.532 196.094C214.395 245.634 214.025 242.228 219.783 244.354C223.193 245.613 223.047 245.172 223.047 254.214C223.047 263.28 222.791 264.649 220.681 266.868L219.262 268.359H200.09H180.919L179.769 267.392C177.295 265.31 176.926 263.501 177.043 254.054C177.131 246.999 177.246 245.543 177.734 245.295C178.057 245.131 179.5 244.445 180.943 243.77C182.568 243.01 183.905 242.067 184.459 241.291L185.352 240.039L185.456 197.305C185.559 155.268 185.548 154.545 184.78 152.959C183.999 151.347 181.2 149.279 178.906 148.622C176.957 148.063 176.953 148.047 176.953 139.659C176.953 129.986 177.595 127.658 180.624 126.34C182.693 125.439 217.703 125.552 219.531 126.465Z"/>
|
|
4400
|
+
</svg>`, We = (t) => `<svg class="qt-icon qt-note" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4401
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M107.227 63.8769C101.558 65.1289 95.375 67.9369 91.406 71.0639C90.01 72.1639 88.215 73.5439 87.417 74.1299C86.62 74.7159 85.96 75.3819 85.952 75.6099C85.944 75.8379 85.612 76.3739 85.214 76.8009C81.982 80.2699 78.079 87.8199 76.776 93.1259L75.781 97.1769V198.907C75.781 262.894 75.922 301.425 76.16 302.76C76.368 303.928 76.623 305.38 76.726 305.987C78.4 315.889 87.879 327.367 98.558 332.423C107.578 336.694 98.739 336.366 201.563 336.242L291.602 336.133L294.27 335.228C309.157 330.183 318.557 320.61 322.536 306.445L323.633 302.539V228.516C323.633 144.681 323.906 151.756 320.402 144.774L318.615 141.211L286.943 109.57C269.523 92.1679 253.932 76.5229 252.297 74.8049C246.111 68.3049 241.836 65.3209 236.902 64.0589C233.006 63.0629 111.686 62.8929 107.227 63.8769ZM233.77 78.3359C236.715 80.5619 300.292 144.132 300.799 145.356C301.574 147.227 300.841 149.245 299.01 150.282L297.461 151.159L274.127 151.165C258.248 151.17 250.198 151.032 248.931 150.734C240.06 148.649 234.561 144.527 231.043 137.327C228.119 131.344 228.085 130.936 228.21 104.035L228.32 80.5309L229.275 79.5149C229.801 78.9559 230.767 78.3419 231.424 78.1519C233.014 77.6899 232.904 77.6809 233.77 78.3359ZM192.354 175.195C194.09 176.288 194.73 177.166 196.549 180.952C197.924 183.813 194.551 189.489 190.695 190.803C187.744 191.808 132.089 191.686 129.883 190.669C122.396 187.22 123.011 176.607 130.837 174.194C131.386 174.024 145.033 173.917 161.164 173.954L190.492 174.023L192.354 175.195ZM269.587 217.641C271.831 218.313 276.709 223.047 275.158 223.047C275.018 223.047 275.115 223.301 275.373 223.611C277.4 226.054 274.593 231.969 270.523 233.832L268.466 234.774L199.37 234.672L130.273 234.57L128.645 233.465C122.49 229.288 123.57 220.238 130.522 217.722C132.38 217.05 267.351 216.971 269.587 217.641ZM247.509 261.237C249.631 262.341 252.9 266.371 252.223 267.048C252.125 267.146 252.179 267.824 252.344 268.555C252.508 269.285 252.542 269.985 252.417 270.109C252.293 270.233 252.148 270.627 252.096 270.984C251.721 273.539 250.106 275.678 247.498 277.074L245.898 277.93L189.258 278.036C138.155 278.132 132.426 278.082 130.664 277.516C122.018 274.742 123.019 262.33 132.031 260.562C132.783 260.414 158.711 260.317 189.648 260.347L245.898 260.4L247.509 261.237Z"/>
|
|
4402
|
+
</svg>`, Ie = (t) => `<svg class="qt-icon qt-tip" width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
4403
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M197.813 54.2439C196.932 54.6529 195.79 55.5789 195.274 56.3019L194.336 57.6169L194.219 70.8359L194.102 84.0549L195.076 85.3319C197.802 88.9059 203.271 88.5369 205.364 84.6369C206.151 83.1699 206.872 60.7239 206.215 58.1479C205.842 56.6839 203.21 53.9059 202.196 53.9059C201.901 53.9059 201.155 53.8149 200.537 53.7039C199.864 53.5829 198.772 53.7989 197.813 54.2439ZM116.233 86.0419C113.323 87.6899 112.27 91.6249 113.92 94.6849C115.402 97.4339 131.364 113.194 132.973 113.496C138.573 114.546 142.477 110.343 140.971 104.883C140.465 103.049 125.118 87.2169 122.574 85.9039C120.632 84.9019 118.15 84.9559 116.233 86.0419ZM277.93 85.7559C276.466 86.4829 260.132 103.191 259.49 104.618C257.281 109.529 261.871 114.699 267.084 113.171C268.604 112.726 283.491 98.5359 285.985 95.1559C289.892 89.8619 283.853 82.8139 277.93 85.7559ZM192.578 105.326C174.207 107.647 159.188 115.505 147.608 128.855C123.664 156.459 124.119 191.541 148.828 223.047C160.759 238.26 165.383 249.444 166.996 266.992C167.829 276.054 168.682 277.986 172.825 280.204C174.652 281.182 221.998 281.773 225.389 280.86C229.012 279.884 232.583 275.584 232.967 271.735C233.077 270.63 233.363 267.529 233.603 264.844C234.904 250.229 238.454 241.734 249.573 226.622C261.236 210.772 265.303 202.299 269.01 186.133C271.624 174.731 269.08 156.872 263.028 144.145C251.295 119.471 219.462 101.931 192.578 105.326ZM88.992 165.981C83.602 166.183 82.734 166.309 81.765 167.028C77.932 169.873 77.932 174.66 81.766 177.503C83.099 178.491 104.15 178.988 108.11 178.124C114.214 176.794 115.972 170.208 111.179 166.626C109.976 165.727 101.966 165.494 88.992 165.981ZM289.847 166.481C285.102 168.919 285.171 174.882 289.974 177.45C292.2 178.64 314.187 179.022 317.07 177.921C322.542 175.831 321.886 167.919 316.118 166.457C312.336 165.498 291.723 165.517 289.847 166.481ZM132.14 230.477C129.964 231.352 113.316 248.951 113.059 250.648C112.263 255.894 117.791 260.112 122.389 257.768C124.057 256.918 139.906 240.858 140.656 239.258C143.226 233.779 137.81 228.195 132.14 230.477ZM262.386 230.871C259.487 232.447 258.349 236.857 260.122 239.648C261.348 241.579 276.261 256.486 277.701 257.219C282.933 259.885 288.816 254.457 286.416 249.179C285.559 247.294 271.67 232.693 269.4 231.29C267.429 230.071 264.211 229.879 262.386 230.871ZM174.576 292.561C170.753 293.719 169.922 295.59 169.922 303.033C169.922 310.255 170.618 312.154 173.969 314.076L175.977 315.227L200.113 315.231C223.446 315.234 224.301 315.208 225.774 314.457C229.279 312.669 230.367 309.882 230.446 302.493L230.504 297.04L229.29 295.365C226.903 292.07 228.123 292.201 200.195 292.23C186.66 292.243 175.131 292.392 174.576 292.561ZM180.946 325.217C179.882 325.963 179.759 328.554 180.683 330.774C185.032 341.224 208.831 343.084 217.528 333.654C220.185 330.773 221.108 326.967 219.531 325.391C218.456 324.315 182.465 324.154 180.946 325.217Z"/>
|
|
4404
|
+
</svg>`, P = { tip: Ie, note: We, important: Re, warning: Oe, caution: $e, none: () => "" };
|
|
4405
|
+
class Pe extends E {
|
|
4406
|
+
constructor(r) {
|
|
4407
|
+
super(), this.type = r;
|
|
4408
|
+
}
|
|
4409
|
+
toDOM() {
|
|
4410
|
+
let r = document.createElement("span");
|
|
4411
|
+
return r.setAttribute("aria-hidden", "true"), r.className = "wg-qt-icon", r.innerHTML = this.type in P ? P[this.type]() : "", r;
|
|
4412
|
+
}
|
|
4413
|
+
ignoreEvent() {
|
|
4414
|
+
return !1;
|
|
4415
|
+
}
|
|
4416
|
+
eq(r) {
|
|
4417
|
+
return this.type === r.type;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
function Ze(t, r) {
|
|
4421
|
+
const a = ["Document", "ListItem", "BulletList", "OrderedList"], o = {
|
|
4349
4422
|
none: "bq-none-mark",
|
|
4350
4423
|
note: "bq-note-mark",
|
|
4351
4424
|
tip: "bq-tip-mark",
|
|
4352
4425
|
warning: "bq-warning-mark",
|
|
4353
4426
|
important: "bq-important-mark",
|
|
4354
4427
|
caution: "bq-caution-mark"
|
|
4355
|
-
},
|
|
4356
|
-
QuoteMark: (
|
|
4428
|
+
}, c = {
|
|
4429
|
+
QuoteMark: (n, s, g) => {
|
|
4357
4430
|
const d = ["qt-mk"];
|
|
4358
|
-
return
|
|
4431
|
+
return g in o ? d.push(o[g]) : d.push(o.none), h.mark({
|
|
4359
4432
|
class: d.join(" ")
|
|
4360
|
-
}).range(
|
|
4361
|
-
},
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4433
|
+
}).range(n, s);
|
|
4434
|
+
},
|
|
4435
|
+
QuoteType: (n, s, g) => h.widget({
|
|
4436
|
+
widget: new Pe(g),
|
|
4437
|
+
side: 1
|
|
4438
|
+
}).range(n),
|
|
4439
|
+
BlockquoteLine: (n, s) => h.line({ class: "bq-line " + (s ? "sw" : "") }).range(n),
|
|
4440
|
+
quoteLine: (n, s, g) => {
|
|
4441
|
+
const d = `calc(100% - ${Math.max(0, g) + 1.2}ch)`;
|
|
4365
4442
|
return h.mark({
|
|
4366
4443
|
class: "bq-text-line",
|
|
4367
4444
|
attributes: { style: `width: ${d}` }
|
|
4368
|
-
}).range(
|
|
4445
|
+
}).range(n, s);
|
|
4369
4446
|
}
|
|
4370
|
-
},
|
|
4371
|
-
const b = [],
|
|
4447
|
+
}, i = (n, s, g, d) => {
|
|
4448
|
+
const b = [], k = g.number, u = (m, x) => {
|
|
4449
|
+
let F = 0;
|
|
4450
|
+
const y = [];
|
|
4372
4451
|
let p = 0;
|
|
4373
|
-
const N = [];
|
|
4374
|
-
let T = 0;
|
|
4375
4452
|
return {
|
|
4376
|
-
enter({ name:
|
|
4377
|
-
|
|
4453
|
+
enter({ name: w, node: O, from: D, to: S }) {
|
|
4454
|
+
w === "Blockquote" && y.push(ze(n, O)), w === "QuoteMark" && (b.push(c[w](D, S, y[F])), p = S, F++), w === "QuoteType" && b.push(c[w](D, S, y[F - 1]));
|
|
4378
4455
|
},
|
|
4379
|
-
leave({ name:
|
|
4380
|
-
|
|
4456
|
+
leave({ name: w, from: O, to: D }) {
|
|
4457
|
+
w === "Paragraph" && p < x && b.push(c.quoteLine(p, x, p - m));
|
|
4381
4458
|
}
|
|
4382
4459
|
};
|
|
4383
4460
|
};
|
|
4384
|
-
for (let
|
|
4385
|
-
const { from: x, to:
|
|
4386
|
-
b.push(
|
|
4461
|
+
for (let m = k; m < d + k; m++) {
|
|
4462
|
+
const { from: x, to: F } = n.state.doc.line(m), { from: y, to: p } = s, w = N(n, y, p);
|
|
4463
|
+
b.push(c.BlockquoteLine(x, w)), $(n.state).iterate({ from: x, to: F, ...u(x, F) });
|
|
4387
4464
|
}
|
|
4388
4465
|
return b;
|
|
4389
4466
|
}, l = [];
|
|
4390
|
-
return
|
|
4391
|
-
enter: ({ name:
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4467
|
+
return L(t, {
|
|
4468
|
+
enter: ({ name: n, from: s, to: g, node: d }) => {
|
|
4469
|
+
if (n === "Blockquote") {
|
|
4470
|
+
const b = t.state.sliceDoc(s, g).split(`
|
|
4471
|
+
`), k = t.state.doc.lineAt(s);
|
|
4472
|
+
l.push(...i(t, d, k, b.length));
|
|
4473
|
+
}
|
|
4474
|
+
return a.includes(n);
|
|
4397
4475
|
}
|
|
4398
4476
|
}), h.set(l, !0);
|
|
4399
4477
|
}
|
|
4400
|
-
const
|
|
4401
|
-
const
|
|
4402
|
-
if (!
|
|
4403
|
-
const
|
|
4404
|
-
return
|
|
4405
|
-
},
|
|
4478
|
+
const ze = (t, r) => {
|
|
4479
|
+
const a = r.getChild("QuoteType");
|
|
4480
|
+
if (!a) return "none";
|
|
4481
|
+
const o = a.getChild("QuoteTypeText");
|
|
4482
|
+
return o ? t.state.sliceDoc(o.from, o.to).toLowerCase() : "none";
|
|
4483
|
+
}, Qe = () => B.baseTheme({
|
|
4406
4484
|
"& .qt-mk": {
|
|
4407
4485
|
// outline: "1px red solid",
|
|
4408
4486
|
position: "relative",
|
|
@@ -4419,6 +4497,9 @@ const qe = (t, r) => {
|
|
|
4419
4497
|
height: "200vh",
|
|
4420
4498
|
zIndex: "-1"
|
|
4421
4499
|
},
|
|
4500
|
+
"&.cm-focused .bq-line.sw .qt-mk::after": {
|
|
4501
|
+
opacity: 0.3
|
|
4502
|
+
},
|
|
4422
4503
|
"& .bq-line": { lineHeight: "1.2lh", overflowY: "hidden" },
|
|
4423
4504
|
"&.cm-focused .bq-line.sw .bq-none-mark, .bq-none-mark::after": { color: "var(--bq-none-mark)" },
|
|
4424
4505
|
"&.cm-focused .bq-line.sw .bq-note-mark, .bq-note-mark::after": { color: "var(--bq-note-mark)" },
|
|
@@ -4428,118 +4509,132 @@ const qe = (t, r) => {
|
|
|
4428
4509
|
"&.cm-focused .bq-line.sw .bq-caution-mark, .bq-caution-mark::after": { color: "var(--bq-caution-mark)" },
|
|
4429
4510
|
"& .bq-text-line": {
|
|
4430
4511
|
lineHeight: "1lh",
|
|
4431
|
-
// backgroundColor: "rgba(0, 0, 0, 0.1)",
|
|
4432
4512
|
display: "inline-block",
|
|
4433
|
-
// maxWidth: "95%",
|
|
4434
4513
|
paddingLeft: "6px",
|
|
4435
4514
|
textIndent: "-7px",
|
|
4436
4515
|
ariaHidden: "true"
|
|
4437
|
-
}
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4516
|
+
},
|
|
4517
|
+
"& .bq-text-line *": {
|
|
4518
|
+
verticalAlign: "middle"
|
|
4519
|
+
},
|
|
4520
|
+
"& .wg-qt-icon": {
|
|
4521
|
+
display: "inline-block"
|
|
4522
|
+
},
|
|
4523
|
+
"& .wg-qt-icon > .qt-icon": {
|
|
4524
|
+
paddingLeft: "1ch",
|
|
4525
|
+
width: "2em",
|
|
4526
|
+
height: "2em"
|
|
4527
|
+
},
|
|
4528
|
+
"& .wg-qt-icon > .qt-tip": { fill: "var(--bq-tip-mark)" },
|
|
4529
|
+
"& .wg-qt-icon > .qt-note": { fill: "var(--bq-note-mark)" },
|
|
4530
|
+
"& .wg-qt-icon > .qt-important": { fill: "var(--bq-important-mark)" },
|
|
4531
|
+
"& .wg-qt-icon > .qt-warning": { fill: "var(--bq-warning-mark)" },
|
|
4532
|
+
"& .wg-qt-icon > .qt-caution": { fill: "var(--bq-caution-mark)" }
|
|
4533
|
+
}), Ke = (t) => [
|
|
4534
|
+
v(Ze, t),
|
|
4535
|
+
Qe()
|
|
4536
|
+
], Ge = {
|
|
4442
4537
|
name: "QuoteTypeParser",
|
|
4443
4538
|
parse(t, r) {
|
|
4444
4539
|
if ((() => {
|
|
4445
|
-
for (let
|
|
4446
|
-
if (t.parentType(
|
|
4540
|
+
for (let o = 0; o < t.depth; o++)
|
|
4541
|
+
if (t.parentType(o).name === "Blockquote") return !0;
|
|
4447
4542
|
return !1;
|
|
4448
4543
|
})()) {
|
|
4449
|
-
const
|
|
4450
|
-
if (
|
|
4451
|
-
const
|
|
4452
|
-
|
|
4453
|
-
t.elt("QuoteTypeMark", t.lineStart +
|
|
4454
|
-
t.elt("QuoteTypeText", t.lineStart +
|
|
4544
|
+
const o = r.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
|
|
4545
|
+
if (o && o[2]) {
|
|
4546
|
+
const c = o[2], i = r.text.indexOf(c), l = i + c.length, n = t.elt("QuoteType", t.lineStart + i, t.lineStart + l);
|
|
4547
|
+
n.children = [
|
|
4548
|
+
t.elt("QuoteTypeMark", t.lineStart + i, t.lineStart + i + 2),
|
|
4549
|
+
t.elt("QuoteTypeText", t.lineStart + i + 2, t.lineStart + l - 1),
|
|
4455
4550
|
t.elt("QuoteTypeMark", t.lineStart + l - 1, t.lineStart + l)
|
|
4456
|
-
], t.addElement(
|
|
4551
|
+
], t.addElement(n);
|
|
4457
4552
|
}
|
|
4458
4553
|
}
|
|
4459
4554
|
return !1;
|
|
4460
4555
|
}
|
|
4461
|
-
},
|
|
4556
|
+
}, _e = {
|
|
4462
4557
|
defineNodes: [
|
|
4463
4558
|
{ name: "QuoteType", style: { "QuoteType/...": e.content } },
|
|
4464
4559
|
{ name: "QuoteTypeMark", style: e.processingInstruction },
|
|
4465
4560
|
{ name: "QuoteTypeText", style: e.bool }
|
|
4466
4561
|
],
|
|
4467
|
-
parseBlock: [
|
|
4468
|
-
},
|
|
4469
|
-
const
|
|
4470
|
-
return
|
|
4471
|
-
text:
|
|
4472
|
-
from: r +
|
|
4473
|
-
to: r + 1 +
|
|
4562
|
+
parseBlock: [Ge]
|
|
4563
|
+
}, j = (t, r, a) => {
|
|
4564
|
+
const o = t.state.sliceDoc(r, a), c = o.match(/\[(.*)\]/);
|
|
4565
|
+
return c !== null && c.length > 1 ? {
|
|
4566
|
+
text: c[1],
|
|
4567
|
+
from: r + o.indexOf(c[1]),
|
|
4568
|
+
to: r + 1 + c[1].length
|
|
4474
4569
|
} : { text: null };
|
|
4475
4570
|
};
|
|
4476
|
-
function
|
|
4477
|
-
const
|
|
4571
|
+
function Ye(t, r) {
|
|
4572
|
+
const a = ["FencedCode", "Image", "Link"], o = {
|
|
4478
4573
|
Link: {
|
|
4479
4574
|
marks: ["LinkMark"],
|
|
4480
4575
|
url: "URL"
|
|
4481
4576
|
}
|
|
4482
|
-
},
|
|
4483
|
-
Link: (l,
|
|
4484
|
-
LinkMark: (l,
|
|
4485
|
-
TextDec: (l,
|
|
4577
|
+
}, c = {
|
|
4578
|
+
Link: (l, n, s) => h.mark({ class: "link " + (s ? "sw" : "") }).range(l, n),
|
|
4579
|
+
LinkMark: (l, n) => h.mark({ class: "lk-mk" }).range(l, n),
|
|
4580
|
+
TextDec: (l, n, s) => h.mark({
|
|
4486
4581
|
class: "lk-text url",
|
|
4487
4582
|
tagName: "a",
|
|
4488
|
-
attributes: { href:
|
|
4489
|
-
}).range(l,
|
|
4490
|
-
URL: (l,
|
|
4583
|
+
attributes: { href: s, target: "_blank" }
|
|
4584
|
+
}).range(l, n),
|
|
4585
|
+
URL: (l, n, s) => h.mark({
|
|
4491
4586
|
class: "lk-url url",
|
|
4492
4587
|
tagName: "a",
|
|
4493
|
-
attributes: { href:
|
|
4494
|
-
}).range(l,
|
|
4495
|
-
},
|
|
4496
|
-
return
|
|
4497
|
-
enter: ({ type: { name: l }, from:
|
|
4498
|
-
if (l === "URL" &&
|
|
4499
|
-
|
|
4500
|
-
const d =
|
|
4501
|
-
|
|
4502
|
-
const b =
|
|
4503
|
-
let
|
|
4588
|
+
attributes: { href: s, target: "_blank" }
|
|
4589
|
+
}).range(l, n)
|
|
4590
|
+
}, i = [];
|
|
4591
|
+
return L(t, {
|
|
4592
|
+
enter: ({ type: { name: l }, from: n, to: s, node: g }) => {
|
|
4593
|
+
if (l === "URL" && i.push(c.URL(n, s, t.state.sliceDoc(n, s))), !(l in o)) return !a.includes(l);
|
|
4594
|
+
i.push(c.Link(n, s, N(t, n, s)));
|
|
4595
|
+
const d = o[l].marks.flatMap((u) => g.getChildren(u));
|
|
4596
|
+
i.push(...d.map(({ from: u, to: m }) => c.LinkMark(u, m)));
|
|
4597
|
+
const b = g.getChild(o[l].url);
|
|
4598
|
+
let k = null;
|
|
4504
4599
|
if (b !== null) {
|
|
4505
|
-
const { from:
|
|
4506
|
-
|
|
4600
|
+
const { from: u, to: m } = b;
|
|
4601
|
+
k = t.state.sliceDoc(u, m), i.push(c.URL(u, m, k));
|
|
4507
4602
|
}
|
|
4508
|
-
if (
|
|
4509
|
-
const { text:
|
|
4510
|
-
|
|
4603
|
+
if (g.getChild("Image") === null) {
|
|
4604
|
+
const { text: u, from: m, to: x } = j(t, n, s);
|
|
4605
|
+
u !== null && k !== null && i.push(c.TextDec(m, x, k));
|
|
4511
4606
|
}
|
|
4512
4607
|
return !1;
|
|
4513
4608
|
}
|
|
4514
|
-
}), h.set(
|
|
4609
|
+
}), h.set(i, !0);
|
|
4515
4610
|
}
|
|
4516
|
-
const
|
|
4611
|
+
const je = (t, r) => t.ctrlKey ? Ve(
|
|
4517
4612
|
t.target
|
|
4518
4613
|
/* as HTMLElement */
|
|
4519
|
-
) : !1,
|
|
4614
|
+
) : !1, Ve = (t) => {
|
|
4520
4615
|
if (t.nodeName === "A" && t.href && t.classList.contains("url"))
|
|
4521
4616
|
return window.open(t.href, t.target), !0;
|
|
4522
|
-
},
|
|
4617
|
+
}, Ue = B.baseTheme({
|
|
4523
4618
|
".lk-mk, .link > .lk-url": { display: "none" },
|
|
4524
4619
|
"&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
|
|
4525
|
-
}),
|
|
4620
|
+
}), Xe = (t = {}) => {
|
|
4526
4621
|
const {
|
|
4527
4622
|
hideMarks: r = !0
|
|
4528
4623
|
} = t;
|
|
4529
4624
|
return [
|
|
4530
|
-
|
|
4531
|
-
|
|
4625
|
+
v(Ye, {}, { eventHandlers: { mousedown: je } }),
|
|
4626
|
+
Ue
|
|
4532
4627
|
];
|
|
4533
4628
|
};
|
|
4534
|
-
class
|
|
4535
|
-
constructor(r,
|
|
4536
|
-
super(), this.img = r, this.url =
|
|
4629
|
+
class Je extends E {
|
|
4630
|
+
constructor(r, a = null, o = "[image]") {
|
|
4631
|
+
super(), this.img = r, this.url = a, this.alt = o;
|
|
4537
4632
|
}
|
|
4538
4633
|
toDOM() {
|
|
4539
4634
|
let r = document.createElement("img");
|
|
4540
4635
|
if (r.src = this.img, r.alt = this.alt, r.style.minWidth = "100px", this.url) {
|
|
4541
|
-
let
|
|
4542
|
-
return
|
|
4636
|
+
let a = document.createElement("a");
|
|
4637
|
+
return a.href = this.url, a.target = "_blank", a.classList.add("url"), a.appendChild(r), a;
|
|
4543
4638
|
} else
|
|
4544
4639
|
return r;
|
|
4545
4640
|
}
|
|
@@ -4550,90 +4645,173 @@ class ze extends S {
|
|
|
4550
4645
|
return !1;
|
|
4551
4646
|
}
|
|
4552
4647
|
}
|
|
4553
|
-
function
|
|
4554
|
-
const
|
|
4555
|
-
return
|
|
4556
|
-
enter: ({ type: { name:
|
|
4557
|
-
if (
|
|
4558
|
-
const { from:
|
|
4559
|
-
|
|
4648
|
+
function er(t, r) {
|
|
4649
|
+
const a = ["FencedCode", "Image"], o = [];
|
|
4650
|
+
return L(t, {
|
|
4651
|
+
enter: ({ type: { name: c }, from: i, to: l, node: n }) => {
|
|
4652
|
+
if (c === "Image" && !N(t, i, l)) {
|
|
4653
|
+
const { from: s, to: g } = n.getChild("URL"), d = t.state.sliceDoc(s, g), { text: b } = j(t, i, l);
|
|
4654
|
+
o.push(
|
|
4560
4655
|
h.replace({
|
|
4561
|
-
widget: new
|
|
4562
|
-
}).range(
|
|
4656
|
+
widget: new Je(d, rr(t, n), b)
|
|
4657
|
+
}).range(i, l)
|
|
4563
4658
|
);
|
|
4564
4659
|
}
|
|
4565
|
-
return !
|
|
4660
|
+
return !a.includes(c);
|
|
4566
4661
|
}
|
|
4567
|
-
}), h.set(
|
|
4662
|
+
}), h.set(o, !1);
|
|
4568
4663
|
}
|
|
4569
|
-
const
|
|
4570
|
-
const
|
|
4571
|
-
if (
|
|
4572
|
-
const { from:
|
|
4573
|
-
return t.state.sliceDoc(
|
|
4664
|
+
const rr = (t, r) => {
|
|
4665
|
+
const o = r.parent.getChild("URL");
|
|
4666
|
+
if (o !== null) {
|
|
4667
|
+
const { from: c, to: i } = o;
|
|
4668
|
+
return t.state.sliceDoc(c, i);
|
|
4574
4669
|
}
|
|
4575
4670
|
return null;
|
|
4576
|
-
},
|
|
4671
|
+
}, tr = (t, r) => t.ctrlKey ? ar(
|
|
4577
4672
|
t.target
|
|
4578
4673
|
/* as HTMLElement */
|
|
4579
|
-
) : !1,
|
|
4674
|
+
) : !1, ar = (t) => {
|
|
4580
4675
|
const r = t.parentElement ?? !1;
|
|
4581
4676
|
if (t.nodeName === "IMG" && r && r.nodeName === "A" && r.classList.contains("url"))
|
|
4582
4677
|
return !0;
|
|
4583
|
-
},
|
|
4678
|
+
}, or = B.baseTheme({}), nr = (t = {}) => {
|
|
4584
4679
|
const {
|
|
4585
4680
|
hideMarks: r = !0
|
|
4586
4681
|
} = t;
|
|
4587
4682
|
return [
|
|
4588
|
-
|
|
4589
|
-
|
|
4683
|
+
v(er, {}, { eventHandlers: { mousedown: tr } }),
|
|
4684
|
+
or
|
|
4590
4685
|
];
|
|
4591
|
-
}
|
|
4686
|
+
};
|
|
4687
|
+
class Z extends E {
|
|
4688
|
+
constructor(r, a = !1) {
|
|
4689
|
+
super(), this.content = r, this.tag = a;
|
|
4690
|
+
}
|
|
4691
|
+
toDOM() {
|
|
4692
|
+
const r = document.createElement("div");
|
|
4693
|
+
r.className = "cm-html-widget", r.setAttribute("aria-hidden", "true");
|
|
4694
|
+
const a = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
|
|
4695
|
+
return r.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + a, r.querySelectorAll("script").forEach((o) => {
|
|
4696
|
+
o.parentNode.removeChild(o);
|
|
4697
|
+
}), r;
|
|
4698
|
+
}
|
|
4699
|
+
ignoreEvent(r) {
|
|
4700
|
+
return r.type === "click";
|
|
4701
|
+
}
|
|
4702
|
+
eq(r) {
|
|
4703
|
+
return r.content === this.content;
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
const V = se.define(), lr = ie.define({
|
|
4707
|
+
create(t) {
|
|
4708
|
+
return h.none;
|
|
4709
|
+
},
|
|
4710
|
+
update(t, r) {
|
|
4711
|
+
t = t.map(r.changes);
|
|
4712
|
+
for (let a of r.effects)
|
|
4713
|
+
if (a.is(V))
|
|
4714
|
+
return a.value;
|
|
4715
|
+
return t;
|
|
4716
|
+
},
|
|
4717
|
+
provide: (t) => A.decorations.from(t)
|
|
4718
|
+
});
|
|
4719
|
+
function cr(t) {
|
|
4720
|
+
const r = [
|
|
4721
|
+
/<br>/,
|
|
4722
|
+
/<img .*\/>/
|
|
4723
|
+
], a = {
|
|
4724
|
+
HTMLBlock: (c, i) => {
|
|
4725
|
+
const l = t.state.doc.sliceString(c, i);
|
|
4726
|
+
return [h.replace({
|
|
4727
|
+
widget: new Z(l),
|
|
4728
|
+
inclusive: !1
|
|
4729
|
+
}).range(c, i)];
|
|
4730
|
+
},
|
|
4731
|
+
HTMLTag: (c, i) => {
|
|
4732
|
+
const l = t.state.doc.sliceString(c, i);
|
|
4733
|
+
return console.log(l), r.some((n) => n.test(l)) ? (console.log(l), [
|
|
4734
|
+
h.replace({
|
|
4735
|
+
widget: new Z(l, !0),
|
|
4736
|
+
inclusive: !1
|
|
4737
|
+
}).range(c, i)
|
|
4738
|
+
]) : [];
|
|
4739
|
+
}
|
|
4740
|
+
}, o = [];
|
|
4741
|
+
return L(t, {
|
|
4742
|
+
enter: ({ type: c, from: i, to: l, node: n }) => {
|
|
4743
|
+
c.name in a && (!N(t, i, l) || !t.hasFocus) && o.push(...a[c.name](i, l));
|
|
4744
|
+
}
|
|
4745
|
+
}), h.set(o);
|
|
4746
|
+
}
|
|
4747
|
+
const sr = B.baseTheme({
|
|
4748
|
+
"& .cm-html-widget": {
|
|
4749
|
+
all: "unset"
|
|
4750
|
+
// outline: "red solid 2px",
|
|
4751
|
+
},
|
|
4752
|
+
"& .cm-html-widget > *": {
|
|
4753
|
+
paddingTop: "0",
|
|
4754
|
+
paddingBottom: "0",
|
|
4755
|
+
marginBottom: "0",
|
|
4756
|
+
marginTop: "0"
|
|
4757
|
+
},
|
|
4758
|
+
"& .cm-widgetBuffer": { display: "none" }
|
|
4759
|
+
}), ir = A.updateListener.of((t) => {
|
|
4760
|
+
if (t.selectionSet || t.docChanged || t.focusChanged || t.geometryChanged) {
|
|
4761
|
+
const r = cr(t.view);
|
|
4762
|
+
t.view.dispatch({ effects: V.of(r) });
|
|
4763
|
+
}
|
|
4764
|
+
}), gr = (t = {}) => [
|
|
4765
|
+
lr,
|
|
4766
|
+
ir,
|
|
4767
|
+
sr
|
|
4768
|
+
], hr = (t = { markdown: {} }) => {
|
|
4592
4769
|
const {
|
|
4593
4770
|
markdown: {
|
|
4594
4771
|
defaultCodeLanguage: r,
|
|
4595
|
-
codeLanguages:
|
|
4596
|
-
addKeymap:
|
|
4597
|
-
base:
|
|
4598
|
-
completeHTMLTags:
|
|
4772
|
+
codeLanguages: a,
|
|
4773
|
+
addKeymap: o,
|
|
4774
|
+
base: c,
|
|
4775
|
+
completeHTMLTags: i,
|
|
4599
4776
|
htmlTagLanguage: l,
|
|
4600
|
-
extensions:
|
|
4777
|
+
extensions: n = []
|
|
4601
4778
|
},
|
|
4602
|
-
inline:
|
|
4603
|
-
Heading:
|
|
4779
|
+
inline: s,
|
|
4780
|
+
Heading: g,
|
|
4604
4781
|
Hr: d,
|
|
4605
4782
|
List: b,
|
|
4606
|
-
Code:
|
|
4607
|
-
} = t,
|
|
4783
|
+
Code: k
|
|
4784
|
+
} = t, u = {
|
|
4608
4785
|
defaultCodeLanguage: r,
|
|
4609
|
-
codeLanguages:
|
|
4610
|
-
addKeymap:
|
|
4611
|
-
base:
|
|
4612
|
-
completeHTMLTags:
|
|
4786
|
+
codeLanguages: a || J,
|
|
4787
|
+
addKeymap: o,
|
|
4788
|
+
base: c,
|
|
4789
|
+
completeHTMLTags: i,
|
|
4613
4790
|
htmlTagLanguage: l,
|
|
4614
|
-
extensions: [...
|
|
4791
|
+
extensions: [...n, re, he, _e]
|
|
4615
4792
|
};
|
|
4616
4793
|
return [
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4794
|
+
ee(u),
|
|
4795
|
+
De.of(Se()),
|
|
4796
|
+
Q(s),
|
|
4797
|
+
_(g),
|
|
4798
|
+
K(b),
|
|
4799
|
+
z(d),
|
|
4800
|
+
G(),
|
|
4801
|
+
Xe(),
|
|
4802
|
+
nr(),
|
|
4803
|
+
Ke(),
|
|
4804
|
+
gr()
|
|
4627
4805
|
];
|
|
4628
4806
|
};
|
|
4629
|
-
typeof window < "u" && (window.gnosis =
|
|
4807
|
+
typeof window < "u" && (window.gnosis = hr, window.HrPlugin = z, window.ListPlugin = K, window.CodePlugin = G, window.InlinePlugin = Q, window.HeadingPlugin = _);
|
|
4630
4808
|
export {
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4809
|
+
G as CodePlugin,
|
|
4810
|
+
_ as HeadingPlugin,
|
|
4811
|
+
z as HrPlugin,
|
|
4812
|
+
Q as InlinePlugin,
|
|
4813
|
+
K as ListPlugin,
|
|
4814
|
+
Se as catppuccin,
|
|
4815
|
+
hr as gnosis,
|
|
4816
|
+
De as themeVariant
|
|
4639
4817
|
};
|