@glifox/gnosis 0.0.6 → 0.0.7
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 +444 -352
- package/dist/gnosis.umd.js +6 -6
- package/package.json +2 -2
package/dist/gnosis.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var L = (t, r,
|
|
4
|
-
import { languages as
|
|
5
|
-
import { markdown as
|
|
6
|
-
import { GFM as
|
|
7
|
-
import { Tag as
|
|
8
|
-
import { ViewPlugin as
|
|
9
|
-
import { syntaxTree as
|
|
10
|
-
import { EditorView as
|
|
11
|
-
import { Compartment as
|
|
12
|
-
const m =
|
|
1
|
+
var Z = Object.defineProperty;
|
|
2
|
+
var J = (t, r, a) => r in t ? Z(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a;
|
|
3
|
+
var L = (t, r, a) => J(t, typeof r != "symbol" ? r + "" : r, a);
|
|
4
|
+
import { languages as ee } from "@codemirror/language-data";
|
|
5
|
+
import { markdown as re } from "@codemirror/lang-markdown";
|
|
6
|
+
import { GFM as te } from "@lezer/markdown";
|
|
7
|
+
import { Tag as ae, styleTags as oe, tags as e } from "@lezer/highlight";
|
|
8
|
+
import { ViewPlugin as ne, Decoration as h, WidgetType as M, EditorView as q } from "@codemirror/view";
|
|
9
|
+
import { syntaxTree as $, HighlightStyle as le, syntaxHighlighting as ce } from "@codemirror/language";
|
|
10
|
+
import { EditorView as w } from "codemirror";
|
|
11
|
+
import { Compartment as se, StateEffect as ie, StateField as ge } from "@codemirror/state";
|
|
12
|
+
const m = ae.define("none"), he = oe({
|
|
13
13
|
"Blockquote/...": m,
|
|
14
14
|
HorizontalRule: m,
|
|
15
15
|
"ATXHeading1/... SetextHeading1/...": m,
|
|
@@ -34,54 +34,54 @@ const m = re.define("none"), ce = te({
|
|
|
34
34
|
"CodeInfo LinkLabel TaskMarker TableDelimiter": m,
|
|
35
35
|
LinkTitle: m,
|
|
36
36
|
Paragraph: m
|
|
37
|
-
}),
|
|
37
|
+
}), de = { props: [he] }, C = (t, r, a = {}) => {
|
|
38
38
|
const n = class {
|
|
39
|
-
constructor(
|
|
39
|
+
constructor(i) {
|
|
40
40
|
L(this, "decorations");
|
|
41
41
|
L(this, "conf");
|
|
42
|
-
this.conf = r, this.decorations = t(
|
|
42
|
+
this.conf = r, this.decorations = t(i, this.conf);
|
|
43
43
|
}
|
|
44
|
-
update(
|
|
45
|
-
(
|
|
44
|
+
update(i) {
|
|
45
|
+
(i.docChanged || i.viewportChanged || i.selectionSet) && (this.decorations = t(i.view, this.conf));
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
return
|
|
49
|
-
},
|
|
48
|
+
return ne.fromClass(n, { decorations: (c) => c.decorations, ...a });
|
|
49
|
+
}, N = (t, r, a) => {
|
|
50
50
|
const n = t.state.selection.ranges;
|
|
51
|
-
for (let
|
|
52
|
-
if (
|
|
51
|
+
for (let c of n)
|
|
52
|
+
if (c.from >= r && c.from <= a || c.to >= r && c.to <= a || c.from <= r && c.to >= a)
|
|
53
53
|
return !0;
|
|
54
54
|
return !1;
|
|
55
|
-
},
|
|
56
|
-
for (const { from:
|
|
57
|
-
|
|
55
|
+
}, v = (t, r) => {
|
|
56
|
+
for (const { from: a, to: n } of t.visibleRanges)
|
|
57
|
+
$(t.state).iterate({ ...r, from: a, to: n });
|
|
58
58
|
};
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
(t[0] - (1 -
|
|
62
|
-
(t[1] - (1 -
|
|
63
|
-
(t[2] - (1 -
|
|
59
|
+
function be(t, r, a, n = 1) {
|
|
60
|
+
const c = (g) => [
|
|
61
|
+
(t[0] - (1 - g) * r[0]) / g,
|
|
62
|
+
(t[1] - (1 - g) * r[1]) / g,
|
|
63
|
+
(t[2] - (1 - g) * r[2]) / g
|
|
64
64
|
];
|
|
65
|
-
let
|
|
66
|
-
const
|
|
67
|
-
return
|
|
65
|
+
let i = a, l = c(i);
|
|
66
|
+
const o = l.map((g, d) => g < 0 && r[d] > 0 ? 1 - l[d] / r[d] : a), s = Math.max(...o);
|
|
67
|
+
return s > i && (i = Math.min(s, n), t = c(i)), l = l.map((g) => Math.round(g < 0 ? 0 : g)), l.push(i), l;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
HorizontalRule: (l,
|
|
72
|
-
h.line({ class: "hr " + (
|
|
73
|
-
h.mark({ class: "mk" }).range(l,
|
|
69
|
+
function me(t, r) {
|
|
70
|
+
const a = ["Document"], n = {}, c = {
|
|
71
|
+
HorizontalRule: (l, o, s = !0) => [
|
|
72
|
+
h.line({ class: "hr " + (s ? "sw" : "") }).range(l),
|
|
73
|
+
h.mark({ class: "mk" }).range(l, o)
|
|
74
74
|
]
|
|
75
|
-
},
|
|
76
|
-
return
|
|
77
|
-
enter: ({ type: l, from:
|
|
78
|
-
}), h.set(
|
|
75
|
+
}, i = [];
|
|
76
|
+
return v(t, {
|
|
77
|
+
enter: ({ type: l, from: o, to: s }) => (l.name in c && i.push(...c[l.name](o, s, N(t, o, s))), a.includes(l.name) || l.name in n)
|
|
78
|
+
}), h.set(i, !1);
|
|
79
79
|
}
|
|
80
|
-
const
|
|
80
|
+
const ue = (t) => {
|
|
81
81
|
const {
|
|
82
82
|
color: r = "black"
|
|
83
83
|
} = t || {};
|
|
84
|
-
return
|
|
84
|
+
return w.baseTheme({
|
|
85
85
|
".hr": { position: "relative" },
|
|
86
86
|
".hr > .mk": { fontSize: "0" },
|
|
87
87
|
".hr.sw > .mk": { fontSize: "inherit" },
|
|
@@ -94,29 +94,29 @@ const he = (t) => {
|
|
|
94
94
|
},
|
|
95
95
|
"&.cm-focused .hr.sw::before": { width: "0", height: "0" }
|
|
96
96
|
});
|
|
97
|
-
},
|
|
98
|
-
C(
|
|
99
|
-
|
|
97
|
+
}, G = (t = {}) => [
|
|
98
|
+
C(me, {}),
|
|
99
|
+
ue(t == null ? void 0 : t.color)
|
|
100
100
|
];
|
|
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:
|
|
101
|
+
function fe(t, r) {
|
|
102
|
+
const a = ["FencedCode"], n = {
|
|
103
|
+
StrongEmphasis: (l = !0, o, s) => h.mark({ class: "il st " + (l ? "sw" : "") }).range(o, s),
|
|
104
|
+
Strikethrough: (l = !0, o, s) => h.mark({ class: "il sk " + (l ? "sw" : "") }).range(o, s),
|
|
105
|
+
InlineCode: (l = !0, o, s) => h.mark({ class: "il ic " + (l ? "sw" : "") }).range(o, s),
|
|
106
|
+
Emphasis: (l = !0, o, s) => h.mark({ class: "il it " + (l ? "sw" : "") }).range(o, s),
|
|
107
|
+
Mark: (l, o) => h.mark({ class: "mkl" }).range(l, o)
|
|
108
|
+
}, c = ["EmphasisMark", "CodeMark", "StrikethroughMark"], i = [];
|
|
109
|
+
return v(t, {
|
|
110
|
+
enter: ({ type: { name: l }, from: o, to: s }) => c.includes(l) ? (i.push(n.Mark(o, s)), !1) : (l in n && i.push(
|
|
111
111
|
n[l](
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
N(t, o, s),
|
|
113
|
+
o,
|
|
114
|
+
s
|
|
115
115
|
)
|
|
116
|
-
), !
|
|
117
|
-
}), h.set(
|
|
116
|
+
), !a.includes(l))
|
|
117
|
+
}), h.set(i, !1);
|
|
118
118
|
}
|
|
119
|
-
const
|
|
119
|
+
const pe = w.baseTheme({
|
|
120
120
|
".it ": { fontStyle: "italic" },
|
|
121
121
|
".st ": { fontWeight: "bold" },
|
|
122
122
|
".sk ": { textDecoration: "line-through" },
|
|
@@ -125,82 +125,82 @@ const be = B.baseTheme({
|
|
|
125
125
|
paddingInline: ".6ch",
|
|
126
126
|
borderRadius: ".6ch"
|
|
127
127
|
}
|
|
128
|
-
}),
|
|
128
|
+
}), ke = w.baseTheme({
|
|
129
129
|
".il .mkl": { fontSize: "0" },
|
|
130
130
|
"&.cm-focused .il.sw .mkl": { fontSize: "inherit" }
|
|
131
|
-
}),
|
|
131
|
+
}), Q = (t = {}) => {
|
|
132
132
|
const {
|
|
133
133
|
hideMarks: r = !0
|
|
134
134
|
} = t;
|
|
135
135
|
return [
|
|
136
|
-
C(
|
|
137
|
-
|
|
138
|
-
r ?
|
|
136
|
+
C(fe, {}),
|
|
137
|
+
pe,
|
|
138
|
+
r ? ke : []
|
|
139
139
|
];
|
|
140
140
|
};
|
|
141
|
-
class
|
|
142
|
-
constructor(
|
|
141
|
+
class xe extends M {
|
|
142
|
+
constructor(a) {
|
|
143
143
|
super();
|
|
144
144
|
L(this, "checked", !1);
|
|
145
|
-
this.checked =
|
|
145
|
+
this.checked = a;
|
|
146
146
|
}
|
|
147
147
|
// eq(other) { return other.checked == this.checked }
|
|
148
148
|
toDOM() {
|
|
149
|
-
let
|
|
150
|
-
|
|
151
|
-
let n =
|
|
152
|
-
return n.type = "checkbox", n.checked = this.checked,
|
|
149
|
+
let a = document.createElement("span");
|
|
150
|
+
a.setAttribute("aria-hidden", "true"), a.className = "TaskMark";
|
|
151
|
+
let n = a.appendChild(document.createElement("input"));
|
|
152
|
+
return n.type = "checkbox", n.checked = this.checked, a;
|
|
153
153
|
}
|
|
154
154
|
ignoreEvent() {
|
|
155
155
|
return !1;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
const
|
|
158
|
+
function ye(t, r) {
|
|
159
|
+
const a = [
|
|
160
160
|
"Document",
|
|
161
161
|
"ListItem",
|
|
162
162
|
"Task"
|
|
163
163
|
], n = {
|
|
164
164
|
BulletList: "bl",
|
|
165
165
|
OrderedList: "ol"
|
|
166
|
-
},
|
|
167
|
-
ListMark: (
|
|
168
|
-
TaskMarker: (
|
|
169
|
-
const b = t.state.doc.sliceString(
|
|
170
|
-
return d ? h.mark({ class: `tm ${b ? "ck" : ""}` }).range(
|
|
171
|
-
widget: new
|
|
172
|
-
}).range(
|
|
166
|
+
}, c = {
|
|
167
|
+
ListMark: (o, s, g, d = !0) => h.mark({ class: `${g} lm ${d ? "sw" : ""}` }).range(o, s),
|
|
168
|
+
TaskMarker: (o, s, g, d = !0) => {
|
|
169
|
+
const b = t.state.doc.sliceString(o + 1, s - 1) === "x";
|
|
170
|
+
return d ? h.mark({ class: `tm ${b ? "ck" : ""}` }).range(o, s) : h.replace({
|
|
171
|
+
widget: new xe(b)
|
|
172
|
+
}).range(o, s);
|
|
173
173
|
}
|
|
174
|
-
},
|
|
175
|
-
return
|
|
176
|
-
enter: ({ type:
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
}, i = [], l = [];
|
|
175
|
+
return v(t, {
|
|
176
|
+
enter: ({ type: o, from: s, to: g }) => o.name in n ? (l.push({ name: o.name, from: s, to: g }), !0) : (o.name in c && i.push(c[o.name](
|
|
177
|
+
s,
|
|
178
|
+
g,
|
|
179
179
|
n[l.slice(-1)[0].name],
|
|
180
|
-
|
|
181
|
-
)),
|
|
182
|
-
leave: ({ type: { name:
|
|
180
|
+
N(t, s, g)
|
|
181
|
+
)), a.includes(o.name)),
|
|
182
|
+
leave: ({ type: { name: o }, from: s, to: g }) => {
|
|
183
183
|
const d = l.slice(-1)[0];
|
|
184
|
-
d && d.name ===
|
|
184
|
+
d && d.name === o && d.from === s && d.to === g && l.pop();
|
|
185
185
|
}
|
|
186
|
-
}), h.set(
|
|
186
|
+
}), h.set(i, !1);
|
|
187
187
|
}
|
|
188
|
-
const
|
|
188
|
+
const Fe = (t, r) => {
|
|
189
189
|
var n;
|
|
190
|
-
let
|
|
191
|
-
if (
|
|
192
|
-
},
|
|
193
|
-
const
|
|
194
|
-
let
|
|
195
|
-
if (
|
|
196
|
-
else if (
|
|
190
|
+
let a = t.target;
|
|
191
|
+
if (a.nodeName === "INPUT" && ((n = a.parentElement) != null && n.classList.contains("TaskMark"))) return we(r, r.posAtDOM(a));
|
|
192
|
+
}, we = (t, r) => {
|
|
193
|
+
const a = r - 2, n = r - 1;
|
|
194
|
+
let c = t.state.doc.sliceString(Math.max(0, a), n), i;
|
|
195
|
+
if (c === "x") i = { from: a, to: n, insert: " " };
|
|
196
|
+
else if (c === " ") i = { from: a, to: n, insert: "x" };
|
|
197
197
|
else return !1;
|
|
198
|
-
return t.dispatch({ changes:
|
|
199
|
-
},
|
|
198
|
+
return t.dispatch({ changes: i }), !0;
|
|
199
|
+
}, Be = (t) => {
|
|
200
200
|
const {
|
|
201
201
|
color: r = "black"
|
|
202
202
|
} = t || {};
|
|
203
|
-
return
|
|
203
|
+
return w.baseTheme({
|
|
204
204
|
/* Bullet list Point */
|
|
205
205
|
".lm.bl": {
|
|
206
206
|
position: "relative",
|
|
@@ -226,108 +226,108 @@ const pe = (t, r) => {
|
|
|
226
226
|
color: "inherit"
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
},
|
|
230
|
-
C(
|
|
231
|
-
|
|
232
|
-
],
|
|
229
|
+
}, _ = (t = {}) => [
|
|
230
|
+
C(ye, {}, { eventHandlers: { mousedown: Fe } }),
|
|
231
|
+
Be(t == null ? void 0 : t.color)
|
|
232
|
+
], Ce = (t, r) => {
|
|
233
233
|
var n;
|
|
234
|
-
let
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
let
|
|
234
|
+
let a = t.target;
|
|
235
|
+
if (a.nodeName === "BUTTON" && ((n = a.parentElement) != null && n.classList.contains("wg-codeblock"))) {
|
|
236
|
+
const c = ["FencedCode", "CodeBlock"];
|
|
237
|
+
let i = "";
|
|
238
238
|
const l = {
|
|
239
|
-
enter: ({ type: { name:
|
|
239
|
+
enter: ({ type: { name: o }, from: s, to: g, node: d }) => (c.includes(o) && (i = Ne(r, d.toTree(), s, g)), !c.includes(o))
|
|
240
240
|
};
|
|
241
|
-
return
|
|
241
|
+
return $(r.state).iterate({
|
|
242
242
|
...l,
|
|
243
|
-
from: r.posAtDOM(
|
|
244
|
-
to: r.posAtDOM(
|
|
245
|
-
}), navigator.clipboard.writeText(
|
|
243
|
+
from: r.posAtDOM(a),
|
|
244
|
+
to: r.posAtDOM(a) + 2
|
|
245
|
+
}), navigator.clipboard.writeText(i), !0;
|
|
246
246
|
}
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
let
|
|
247
|
+
}, Ne = (t, r, a, n) => {
|
|
248
|
+
const c = ["CodeMark", "CodeInfo"];
|
|
249
|
+
let i = t.state.doc.sliceString(a, n), l = /* @__PURE__ */ new Set();
|
|
250
250
|
r.iterate({
|
|
251
251
|
enter({ type: { name: d }, from: b, node: y }) {
|
|
252
|
-
|
|
252
|
+
c.includes(d) && l.add(t.state.doc.lineAt(b + a).number);
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
|
-
const
|
|
256
|
-
return
|
|
255
|
+
const o = t.state.doc.lineAt(a), s = a - o.from, g = [];
|
|
256
|
+
return i.split(`
|
|
257
257
|
`).forEach((d, b) => {
|
|
258
|
-
l.has(b +
|
|
259
|
-
}),
|
|
258
|
+
l.has(b + o.number) || g.push(d.slice(s));
|
|
259
|
+
}), g.join(`
|
|
260
260
|
`);
|
|
261
261
|
};
|
|
262
|
-
class
|
|
263
|
-
constructor(
|
|
262
|
+
class I extends M {
|
|
263
|
+
constructor(a, n, c) {
|
|
264
264
|
super();
|
|
265
265
|
L(this, "classes", "");
|
|
266
|
-
this.classes =
|
|
266
|
+
this.classes = a, this.width = n, this.marginLeft = c;
|
|
267
267
|
}
|
|
268
268
|
toDOM() {
|
|
269
|
-
let
|
|
270
|
-
return
|
|
269
|
+
let a = document.createElement("span");
|
|
270
|
+
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
271
|
}
|
|
272
272
|
ignoreEvent() {
|
|
273
273
|
return !1;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const ve = (t) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
277
277
|
<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
278
|
<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
279
|
</svg>`;
|
|
280
|
-
class
|
|
281
|
-
constructor(r,
|
|
282
|
-
super(), this.type = r, this.code =
|
|
280
|
+
class Ee extends M {
|
|
281
|
+
constructor(r, a) {
|
|
282
|
+
super(), this.type = r, this.code = a;
|
|
283
283
|
}
|
|
284
284
|
toDOM() {
|
|
285
285
|
let r = document.createElement("span");
|
|
286
286
|
r.setAttribute("aria-hidden", "true"), r.className = "wg-codeblock";
|
|
287
|
-
let
|
|
288
|
-
return
|
|
287
|
+
let a = document.createElement("button");
|
|
288
|
+
return a.className = "wg-codeblock-btn", a.innerHTML = ve(), r.appendChild(a), r;
|
|
289
289
|
}
|
|
290
290
|
ignoreEvent() {
|
|
291
291
|
return !1;
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
-
const
|
|
295
|
-
function
|
|
294
|
+
const S = [];
|
|
295
|
+
function P(t, r) {
|
|
296
296
|
const {
|
|
297
|
-
mode:
|
|
297
|
+
mode: a
|
|
298
298
|
/* type, mark */
|
|
299
|
-
} = r, n = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"],
|
|
300
|
-
FencedCode:
|
|
301
|
-
CodeBlock:
|
|
302
|
-
},
|
|
303
|
-
CodeMark: (
|
|
304
|
-
CodeInfo: (
|
|
299
|
+
} = r, n = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
|
|
300
|
+
FencedCode: K,
|
|
301
|
+
CodeBlock: K
|
|
302
|
+
}, i = {
|
|
303
|
+
CodeMark: (o, s, g) => [h.mark({ class: "cb-mk" }).range(s, g)],
|
|
304
|
+
CodeInfo: (o, s, g) => [h.mark({ class: "cb-mi" }).range(s, g)]
|
|
305
305
|
}, l = [];
|
|
306
|
-
return
|
|
307
|
-
enter: ({ type: { name:
|
|
308
|
-
Leave: ({ type: { name:
|
|
306
|
+
return v(t, {
|
|
307
|
+
enter: ({ type: { name: o }, from: s, to: g }) => (a === "type" && o in c && l.push(...c[o](t, s, g)), a === "mark" && o in i && l.push(...i[o](t, s, g)), n.includes(o) || o in c ? (S.push({ name: o, from: s, to: g }), !0) : !1),
|
|
308
|
+
Leave: ({ type: { name: o }, from: s, to: g }) => n.includes(o) || o in c ? (S.pop(), !0) : !1
|
|
309
309
|
}), {
|
|
310
310
|
type: h.set(l, !0),
|
|
311
311
|
mark: h.set(l, !0)
|
|
312
|
-
}[
|
|
312
|
+
}[a];
|
|
313
313
|
}
|
|
314
|
-
const
|
|
315
|
-
const n = [],
|
|
314
|
+
const K = (t, r, a) => {
|
|
315
|
+
const n = [], c = S[S.length - 1], i = ["BulletList", "OrderedList", "ListItem"].some((f) => f === c.name), l = ["Blockquote"].some((f) => f === c.name), o = t.state.doc.lineAt(r), s = r - o.from, g = s > 0, d = N(t, o.from, a);
|
|
316
316
|
d || n.push(
|
|
317
|
-
h.widget({ widget: new
|
|
317
|
+
h.widget({ widget: new Ee("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(r + 1)
|
|
318
318
|
);
|
|
319
|
-
const b =
|
|
319
|
+
const b = o.number, y = t.state.doc.sliceString(r, a).split(`
|
|
320
320
|
`).length;
|
|
321
321
|
for (let f = b; f < y + b; f++) {
|
|
322
|
-
const { from: u, to: F } = t.state.doc.line(f),
|
|
322
|
+
const { from: u, to: F } = t.state.doc.line(f), B = "100% - 1.2ch", x = ["cb-content"];
|
|
323
323
|
d && x.push("sw"), f === b && x.push("cb-start"), f === y + b - 1 && x.push("cb-end");
|
|
324
|
-
const p = Math.max(u +
|
|
324
|
+
const p = Math.max(u + s, 0);
|
|
325
325
|
if (F < p)
|
|
326
326
|
x.push("free"), n.push(
|
|
327
327
|
h.widget({
|
|
328
|
-
widget: new
|
|
328
|
+
widget: new I(
|
|
329
329
|
x.join(" "),
|
|
330
|
-
`calc(${
|
|
330
|
+
`calc(${B} - ${p - u}ch)`,
|
|
331
331
|
`calc(${p - F}ch + 2px)`
|
|
332
332
|
),
|
|
333
333
|
side: 1
|
|
@@ -336,26 +336,26 @@ const P = (t, r, o) => {
|
|
|
336
336
|
else if (p === F)
|
|
337
337
|
x.push("wg"), n.push(
|
|
338
338
|
h.widget({
|
|
339
|
-
widget: new
|
|
339
|
+
widget: new I(
|
|
340
340
|
x.join(" "),
|
|
341
|
-
`calc(${
|
|
341
|
+
`calc(${B} - ${p - u}ch)`
|
|
342
342
|
),
|
|
343
343
|
side: 1
|
|
344
344
|
}).range(p)
|
|
345
345
|
);
|
|
346
|
-
else if (
|
|
347
|
-
const
|
|
348
|
-
F > p && n.push(h.mark({ class: x.join(" "), attributes:
|
|
346
|
+
else if (i || l || g) {
|
|
347
|
+
const E = { style: `width: calc(${B} - ${p - u}ch)` };
|
|
348
|
+
F > p && n.push(h.mark({ class: x.join(" "), attributes: E }).range(p, F)), u !== p && i && n.push(h.mark({ class: "cb-listsp" }).range(u, p)), u !== p && g && n.push(h.mark({ class: "cb-spacer" }).range(u, p)), u !== p && l && n.push(h.mark({ class: "cb-quote bq" }).range(u, p));
|
|
349
349
|
} else if (u !== F) {
|
|
350
|
-
const
|
|
351
|
-
n.push(h.mark({ class: x.join(" "), attributes:
|
|
350
|
+
const E = { style: `width: calc(${B})` };
|
|
351
|
+
n.push(h.mark({ class: x.join(" "), attributes: E }).range(u, F));
|
|
352
352
|
}
|
|
353
353
|
n.push(h.line({ class: "cb-line" }).range(u));
|
|
354
354
|
}
|
|
355
355
|
return n;
|
|
356
|
-
},
|
|
357
|
-
const n = "4px",
|
|
358
|
-
return
|
|
356
|
+
}, Te = () => {
|
|
357
|
+
const n = "4px", c = "1lh";
|
|
358
|
+
return w.baseTheme({
|
|
359
359
|
".cb-start": { borderRadius: `${n} ${n} 0 0` },
|
|
360
360
|
".cb-end ": { borderRadius: `0 0 ${n} ${n}` },
|
|
361
361
|
".cb-start.cb-end": { borderRadius: `${n}` },
|
|
@@ -399,12 +399,12 @@ const P = (t, r, o) => {
|
|
|
399
399
|
outline: "none",
|
|
400
400
|
justifyContent: "center",
|
|
401
401
|
alignItems: "center",
|
|
402
|
-
height: `calc(${
|
|
402
|
+
height: `calc(${c} + 4px )`,
|
|
403
403
|
width: "5ch"
|
|
404
404
|
},
|
|
405
405
|
".cb-icon": {
|
|
406
|
-
width:
|
|
407
|
-
height:
|
|
406
|
+
width: c,
|
|
407
|
+
height: c,
|
|
408
408
|
pointerEvents: "none",
|
|
409
409
|
fill: "currentColor",
|
|
410
410
|
opacity: "0.7"
|
|
@@ -423,41 +423,41 @@ const P = (t, r, o) => {
|
|
|
423
423
|
width: "5ch"
|
|
424
424
|
}
|
|
425
425
|
});
|
|
426
|
-
},
|
|
427
|
-
C(
|
|
428
|
-
C(
|
|
429
|
-
|
|
426
|
+
}, Y = (t) => [
|
|
427
|
+
C(P, { mode: "mark" }),
|
|
428
|
+
C(P, { mode: "type" }, { eventHandlers: { mousedown: Ce } }),
|
|
429
|
+
Te()
|
|
430
430
|
];
|
|
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(
|
|
431
|
+
function Ae(t, r) {
|
|
432
|
+
const a = ["Document"], n = {
|
|
433
|
+
ATXHeading1: (l, o = !0) => h.line({ class: "h1 hg " + (o ? "sw" : "") }).range(l),
|
|
434
|
+
ATXHeading2: (l, o = !0) => h.line({ class: "h2 hg " + (o ? "sw" : "") }).range(l),
|
|
435
|
+
ATXHeading3: (l, o = !0) => h.line({ class: "h3 hg " + (o ? "sw" : "") }).range(l),
|
|
436
|
+
ATXHeading4: (l, o = !0) => h.line({ class: "h4 hg " + (o ? "sw" : "") }).range(l),
|
|
437
|
+
ATXHeading5: (l, o = !0) => h.line({ class: "h5 hg " + (o ? "sw" : "") }).range(l),
|
|
438
|
+
ATXHeading6: (l, o = !0) => h.line({ class: "h6 hg " + (o ? "sw" : "") }).range(l)
|
|
439
|
+
}, c = {
|
|
440
|
+
HeaderMark: (l, o) => h.mark({ class: "mk" }).range(l, o)
|
|
441
|
+
}, i = [];
|
|
442
|
+
return v(t, {
|
|
443
|
+
enter: ({ type: l, from: o, to: s }) => (l.name in n && i.push(n[l.name](o, N(t, o, s))), l.name in c && i.push(c[l.name](o, s + 1)), a.includes(l.name) || l.name in n)
|
|
444
|
+
}), h.set(i, !1);
|
|
445
445
|
}
|
|
446
|
-
const
|
|
446
|
+
const Le = w.baseTheme({
|
|
447
447
|
".h1 ": { fontSize: "2.6rem" },
|
|
448
448
|
".h2 ": { fontSize: "2.0rem" },
|
|
449
449
|
".h3 ": { fontSize: "1.8rem" },
|
|
450
450
|
".h4 ": { fontSize: "1.6rem" },
|
|
451
451
|
".h5 ": { fontSize: "1.4rem" },
|
|
452
452
|
".h6 ": { fontSize: "1.2rem" }
|
|
453
|
-
}),
|
|
453
|
+
}), Me = w.baseTheme({
|
|
454
454
|
".hg .mk": { fontSize: "0" },
|
|
455
455
|
"&.cm-focused .hg.sw .mk": { fontSize: "inherit" }
|
|
456
|
-
}),
|
|
457
|
-
C(
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
],
|
|
456
|
+
}), j = (t = {}) => [
|
|
457
|
+
C(Ae, {}),
|
|
458
|
+
Le,
|
|
459
|
+
Me
|
|
460
|
+
], De = {
|
|
461
461
|
version: "1.7.1",
|
|
462
462
|
latte: {
|
|
463
463
|
name: "Latte",
|
|
@@ -3251,14 +3251,14 @@ const ve = B.baseTheme({
|
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
3253
|
}
|
|
3254
|
-
}, D = (t) => Object.entries(t), { version:
|
|
3255
|
-
...
|
|
3256
|
-
colorEntries: D(
|
|
3257
|
-
ansiColorEntries: D(
|
|
3254
|
+
}, D = (t) => Object.entries(t), { version: pr, ...Se } = De, U = D(Se).reduce((t, [r, a]) => (t[r] = {
|
|
3255
|
+
...a,
|
|
3256
|
+
colorEntries: D(a.colors),
|
|
3257
|
+
ansiColorEntries: D(a.ansiColors)
|
|
3258
3258
|
}, t), {});
|
|
3259
|
-
D(
|
|
3260
|
-
const k = ({ variant: t, settings: r, styles:
|
|
3261
|
-
const n =
|
|
3259
|
+
D(U);
|
|
3260
|
+
const k = ({ variant: t, settings: r, styles: a }) => {
|
|
3261
|
+
const n = q.theme({
|
|
3262
3262
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3263
3263
|
"&": {
|
|
3264
3264
|
backgroundColor: r.background,
|
|
@@ -3285,8 +3285,8 @@ const k = ({ variant: t, settings: r, styles: o }) => {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
}, {
|
|
3287
3287
|
dark: t === "dark"
|
|
3288
|
-
}),
|
|
3289
|
-
return [n,
|
|
3288
|
+
}), c = le.define(a);
|
|
3289
|
+
return [n, ce(c)];
|
|
3290
3290
|
};
|
|
3291
3291
|
k({
|
|
3292
3292
|
variant: "dark",
|
|
@@ -4238,18 +4238,18 @@ k({
|
|
|
4238
4238
|
}
|
|
4239
4239
|
]
|
|
4240
4240
|
});
|
|
4241
|
-
const
|
|
4242
|
-
const r =
|
|
4241
|
+
const qe = new se(), He = (t = "latte") => {
|
|
4242
|
+
const r = U[t].colors, a = r.base, n = t === "latte" ? "#484b64" : r.text.hex, c = $e(r.crust.rgb, a.rgb, 0.1);
|
|
4243
4243
|
return [
|
|
4244
4244
|
k({
|
|
4245
4245
|
variant: t === "latte" ? "light" : "dark",
|
|
4246
4246
|
settings: {
|
|
4247
|
-
background:
|
|
4247
|
+
background: a.hex,
|
|
4248
4248
|
foreground: n,
|
|
4249
4249
|
caret: r.rosewater.hex,
|
|
4250
4250
|
// selection: selection,
|
|
4251
|
-
lineHighlight:
|
|
4252
|
-
gutterBackground:
|
|
4251
|
+
lineHighlight: H(r.overlay1.rgb, 0.1),
|
|
4252
|
+
gutterBackground: a.hex,
|
|
4253
4253
|
gutterForeground: n
|
|
4254
4254
|
},
|
|
4255
4255
|
styles: [
|
|
@@ -4321,13 +4321,13 @@ const Le = new le(), De = (t = "latte") => {
|
|
|
4321
4321
|
{ tag: e.macroName, color: r.peach.hex }
|
|
4322
4322
|
]
|
|
4323
4323
|
}),
|
|
4324
|
-
|
|
4324
|
+
q.theme({
|
|
4325
4325
|
// Editor
|
|
4326
|
-
"& .cm-selectionBackground, ::selection": { background: `${
|
|
4326
|
+
"& .cm-selectionBackground, ::selection": { background: `${H(r.overlay2.rgb, 0.3)} !important` },
|
|
4327
4327
|
// Code
|
|
4328
|
-
"& .cb-content, & .ic": { backgroundColor:
|
|
4328
|
+
"& .cb-content, & .ic": { backgroundColor: c },
|
|
4329
4329
|
".cb-icon": { fill: n },
|
|
4330
|
-
".wg-codeblock-btn:hover": { backgroundColor:
|
|
4330
|
+
".wg-codeblock-btn:hover": { backgroundColor: H(r.overlay1.rgb, 0.2) },
|
|
4331
4331
|
// Blockquote
|
|
4332
4332
|
".bq-none-mark": { "--bq-none-mark": n },
|
|
4333
4333
|
".bq-note-mark": { "--bq-note-mark": r.blue.hex },
|
|
@@ -4337,72 +4337,80 @@ const Le = new le(), De = (t = "latte") => {
|
|
|
4337
4337
|
".bq-caution-mark": { "--bq-caution-mark": r.red.hex },
|
|
4338
4338
|
// Links
|
|
4339
4339
|
"& a.url": { color: r.blue.hex },
|
|
4340
|
-
"& a.url:visited": { color: r.mauve.hex }
|
|
4340
|
+
"& a.url:visited": { color: r.mauve.hex },
|
|
4341
|
+
// Html
|
|
4342
|
+
"& .cm-rendered-tag": {
|
|
4343
|
+
border: `1px solid ${r.surface2.hex}`,
|
|
4344
|
+
borderRadius: "4px",
|
|
4345
|
+
fontSize: ".8em",
|
|
4346
|
+
padding: "0px 3px",
|
|
4347
|
+
background: r.surface0.hex
|
|
4348
|
+
}
|
|
4341
4349
|
}, { dark: t !== "latte" })
|
|
4342
4350
|
];
|
|
4343
|
-
},
|
|
4344
|
-
const n = [t.r, t.g, t.b],
|
|
4345
|
-
return `rgba(${
|
|
4346
|
-
},
|
|
4347
|
-
function
|
|
4348
|
-
const
|
|
4351
|
+
}, $e = (t, r, a) => {
|
|
4352
|
+
const n = [t.r, t.g, t.b], c = [r.r, r.g, r.b];
|
|
4353
|
+
return `rgba(${be(n, c, a, 0.3).join(", ")})`;
|
|
4354
|
+
}, H = (t, r) => `rgba(${t.r}, ${t.g}, ${t.b}, ${r})`;
|
|
4355
|
+
function Oe(t, r) {
|
|
4356
|
+
const a = ["Document", "ListItem", "BulletList", "OrderedList"], n = {
|
|
4349
4357
|
none: "bq-none-mark",
|
|
4350
4358
|
note: "bq-note-mark",
|
|
4351
4359
|
tip: "bq-tip-mark",
|
|
4352
4360
|
warning: "bq-warning-mark",
|
|
4353
4361
|
important: "bq-important-mark",
|
|
4354
4362
|
caution: "bq-caution-mark"
|
|
4355
|
-
},
|
|
4356
|
-
QuoteMark: (
|
|
4363
|
+
}, c = {
|
|
4364
|
+
QuoteMark: (o, s, g) => {
|
|
4357
4365
|
const d = ["qt-mk"];
|
|
4358
|
-
return
|
|
4366
|
+
return g in n ? d.push(n[g]) : d.push(n.none), h.mark({
|
|
4359
4367
|
class: d.join(" ")
|
|
4360
|
-
}).range(
|
|
4368
|
+
}).range(o, s);
|
|
4361
4369
|
},
|
|
4362
|
-
BlockquoteLine: (
|
|
4363
|
-
quoteLine: (
|
|
4364
|
-
const d = `calc(100% - ${Math.max(0,
|
|
4370
|
+
BlockquoteLine: (o, s) => h.line({ class: "bq-line " + (s ? "sw" : "") }).range(o),
|
|
4371
|
+
quoteLine: (o, s, g) => {
|
|
4372
|
+
const d = `calc(100% - ${Math.max(0, g) + 1.2}ch)`;
|
|
4365
4373
|
return h.mark({
|
|
4366
4374
|
class: "bq-text-line",
|
|
4367
4375
|
attributes: { style: `width: ${d}` }
|
|
4368
|
-
}).range(
|
|
4376
|
+
}).range(o, s);
|
|
4369
4377
|
}
|
|
4370
|
-
},
|
|
4371
|
-
const b = [], { from: y, to: f } =
|
|
4378
|
+
}, i = (o, s, g, d) => {
|
|
4379
|
+
const b = [], { from: y, to: f } = s, u = g.number, F = (B, x) => {
|
|
4372
4380
|
let p = 0;
|
|
4373
|
-
const
|
|
4374
|
-
let
|
|
4381
|
+
const E = [];
|
|
4382
|
+
let A = 0;
|
|
4375
4383
|
return {
|
|
4376
|
-
enter({ name:
|
|
4377
|
-
|
|
4384
|
+
enter({ name: T, node: O, from: R, to: W }) {
|
|
4385
|
+
T === "Blockquote" && E.push(Re(o, O)), T === "QuoteMark" && (b.push(c[T](R, W, E[p])), A = W, p++);
|
|
4378
4386
|
},
|
|
4379
|
-
leave({ name:
|
|
4380
|
-
|
|
4387
|
+
leave({ name: T, from: O, to: R }) {
|
|
4388
|
+
T === "Paragraph" && A < x && b.push(c.quoteLine(A, x, A - B));
|
|
4381
4389
|
}
|
|
4382
4390
|
};
|
|
4383
4391
|
};
|
|
4384
|
-
for (let
|
|
4385
|
-
const { from: x, to: p } =
|
|
4386
|
-
b.push(
|
|
4392
|
+
for (let B = u; B < d + u; B++) {
|
|
4393
|
+
const { from: x, to: p } = o.state.doc.line(B), { from: E, to: A } = s, T = N(o, E, A);
|
|
4394
|
+
b.push(c.BlockquoteLine(x, T)), $(o.state).iterate({ from: x, to: p, ...F(x, p) });
|
|
4387
4395
|
}
|
|
4388
4396
|
return b;
|
|
4389
4397
|
}, l = [];
|
|
4390
|
-
return
|
|
4391
|
-
enter: ({ name:
|
|
4392
|
-
leave: ({ name:
|
|
4393
|
-
if (
|
|
4394
|
-
const b = t.state.sliceDoc(
|
|
4395
|
-
`), y = t.state.doc.lineAt(
|
|
4396
|
-
l.push(...
|
|
4398
|
+
return v(t, {
|
|
4399
|
+
enter: ({ name: o }) => !(o in a),
|
|
4400
|
+
leave: ({ name: o, from: s, to: g, node: d }) => {
|
|
4401
|
+
if (o !== "Blockquote") return;
|
|
4402
|
+
const b = t.state.sliceDoc(s, g).split(`
|
|
4403
|
+
`), y = t.state.doc.lineAt(s);
|
|
4404
|
+
l.push(...i(t, d, y, b.length));
|
|
4397
4405
|
}
|
|
4398
4406
|
}), h.set(l, !0);
|
|
4399
4407
|
}
|
|
4400
|
-
const
|
|
4401
|
-
const
|
|
4402
|
-
if (!
|
|
4403
|
-
const n =
|
|
4408
|
+
const Re = (t, r) => {
|
|
4409
|
+
const a = r.getChild("QuoteType");
|
|
4410
|
+
if (!a) return "none";
|
|
4411
|
+
const n = a.getChild("QuoteTypeText");
|
|
4404
4412
|
return n ? t.state.sliceDoc(n.from, n.to).toLowerCase() : "none";
|
|
4405
|
-
},
|
|
4413
|
+
}, We = () => w.baseTheme({
|
|
4406
4414
|
"& .qt-mk": {
|
|
4407
4415
|
// outline: "1px red solid",
|
|
4408
4416
|
position: "relative",
|
|
@@ -4419,6 +4427,9 @@ const qe = (t, r) => {
|
|
|
4419
4427
|
height: "200vh",
|
|
4420
4428
|
zIndex: "-1"
|
|
4421
4429
|
},
|
|
4430
|
+
"&.cm-focused .bq-line.sw .qt-mk::after": {
|
|
4431
|
+
opacity: 0.3
|
|
4432
|
+
},
|
|
4422
4433
|
"& .bq-line": { lineHeight: "1.2lh", overflowY: "hidden" },
|
|
4423
4434
|
"&.cm-focused .bq-line.sw .bq-none-mark, .bq-none-mark::after": { color: "var(--bq-none-mark)" },
|
|
4424
4435
|
"&.cm-focused .bq-line.sw .bq-note-mark, .bq-note-mark::after": { color: "var(--bq-note-mark)" },
|
|
@@ -4428,17 +4439,15 @@ const qe = (t, r) => {
|
|
|
4428
4439
|
"&.cm-focused .bq-line.sw .bq-caution-mark, .bq-caution-mark::after": { color: "var(--bq-caution-mark)" },
|
|
4429
4440
|
"& .bq-text-line": {
|
|
4430
4441
|
lineHeight: "1lh",
|
|
4431
|
-
// backgroundColor: "rgba(0, 0, 0, 0.1)",
|
|
4432
4442
|
display: "inline-block",
|
|
4433
|
-
// maxWidth: "95%",
|
|
4434
4443
|
paddingLeft: "6px",
|
|
4435
4444
|
textIndent: "-7px",
|
|
4436
4445
|
ariaHidden: "true"
|
|
4437
4446
|
}
|
|
4438
|
-
}),
|
|
4439
|
-
C(
|
|
4440
|
-
|
|
4441
|
-
],
|
|
4447
|
+
}), Ie = (t) => [
|
|
4448
|
+
C(Oe, t),
|
|
4449
|
+
We()
|
|
4450
|
+
], Pe = {
|
|
4442
4451
|
name: "QuoteTypeParser",
|
|
4443
4452
|
parse(t, r) {
|
|
4444
4453
|
if ((() => {
|
|
@@ -4448,98 +4457,98 @@ const qe = (t, r) => {
|
|
|
4448
4457
|
})()) {
|
|
4449
4458
|
const n = r.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
|
|
4450
4459
|
if (n && n[2]) {
|
|
4451
|
-
const
|
|
4452
|
-
|
|
4453
|
-
t.elt("QuoteTypeMark", t.lineStart +
|
|
4454
|
-
t.elt("QuoteTypeText", t.lineStart +
|
|
4460
|
+
const c = n[2], i = r.text.indexOf(c), l = i + c.length, o = t.elt("QuoteType", t.lineStart + i, t.lineStart + l);
|
|
4461
|
+
o.children = [
|
|
4462
|
+
t.elt("QuoteTypeMark", t.lineStart + i, t.lineStart + i + 2),
|
|
4463
|
+
t.elt("QuoteTypeText", t.lineStart + i + 2, t.lineStart + l - 1),
|
|
4455
4464
|
t.elt("QuoteTypeMark", t.lineStart + l - 1, t.lineStart + l)
|
|
4456
|
-
], t.addElement(
|
|
4465
|
+
], t.addElement(o);
|
|
4457
4466
|
}
|
|
4458
4467
|
}
|
|
4459
4468
|
return !1;
|
|
4460
4469
|
}
|
|
4461
|
-
},
|
|
4470
|
+
}, Ke = {
|
|
4462
4471
|
defineNodes: [
|
|
4463
4472
|
{ name: "QuoteType", style: { "QuoteType/...": e.content } },
|
|
4464
4473
|
{ name: "QuoteTypeMark", style: e.processingInstruction },
|
|
4465
4474
|
{ name: "QuoteTypeText", style: e.bool }
|
|
4466
4475
|
],
|
|
4467
|
-
parseBlock: [
|
|
4468
|
-
},
|
|
4469
|
-
const n = t.state.sliceDoc(r,
|
|
4470
|
-
return
|
|
4471
|
-
text:
|
|
4472
|
-
from: r + n.indexOf(
|
|
4473
|
-
to: r + 1 +
|
|
4476
|
+
parseBlock: [Pe]
|
|
4477
|
+
}, V = (t, r, a) => {
|
|
4478
|
+
const n = t.state.sliceDoc(r, a), c = n.match(/\[(.*)\]/);
|
|
4479
|
+
return c !== null && c.length > 1 ? {
|
|
4480
|
+
text: c[1],
|
|
4481
|
+
from: r + n.indexOf(c[1]),
|
|
4482
|
+
to: r + 1 + c[1].length
|
|
4474
4483
|
} : { text: null };
|
|
4475
4484
|
};
|
|
4476
|
-
function
|
|
4477
|
-
const
|
|
4485
|
+
function ze(t, r) {
|
|
4486
|
+
const a = ["FencedCode", "Image", "Link"], n = {
|
|
4478
4487
|
Link: {
|
|
4479
4488
|
marks: ["LinkMark"],
|
|
4480
4489
|
url: "URL"
|
|
4481
4490
|
}
|
|
4482
|
-
},
|
|
4483
|
-
Link: (l,
|
|
4484
|
-
LinkMark: (l,
|
|
4485
|
-
TextDec: (l,
|
|
4491
|
+
}, c = {
|
|
4492
|
+
Link: (l, o, s) => h.mark({ class: "link " + (s ? "sw" : "") }).range(l, o),
|
|
4493
|
+
LinkMark: (l, o) => h.mark({ class: "lk-mk" }).range(l, o),
|
|
4494
|
+
TextDec: (l, o, s) => h.mark({
|
|
4486
4495
|
class: "lk-text url",
|
|
4487
4496
|
tagName: "a",
|
|
4488
|
-
attributes: { href:
|
|
4489
|
-
}).range(l,
|
|
4490
|
-
URL: (l,
|
|
4497
|
+
attributes: { href: s, target: "_blank" }
|
|
4498
|
+
}).range(l, o),
|
|
4499
|
+
URL: (l, o, s) => h.mark({
|
|
4491
4500
|
class: "lk-url url",
|
|
4492
4501
|
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 = n[l].marks.flatMap((f) =>
|
|
4501
|
-
|
|
4502
|
-
const b =
|
|
4502
|
+
attributes: { href: s, target: "_blank" }
|
|
4503
|
+
}).range(l, o)
|
|
4504
|
+
}, i = [];
|
|
4505
|
+
return v(t, {
|
|
4506
|
+
enter: ({ type: { name: l }, from: o, to: s, node: g }) => {
|
|
4507
|
+
if (l === "URL" && i.push(c.URL(o, s, t.state.sliceDoc(o, s))), !(l in n)) return !a.includes(l);
|
|
4508
|
+
i.push(c.Link(o, s, N(t, o, s)));
|
|
4509
|
+
const d = n[l].marks.flatMap((f) => g.getChildren(f));
|
|
4510
|
+
i.push(...d.map(({ from: f, to: u }) => c.LinkMark(f, u)));
|
|
4511
|
+
const b = g.getChild(n[l].url);
|
|
4503
4512
|
let y = null;
|
|
4504
4513
|
if (b !== null) {
|
|
4505
4514
|
const { from: f, to: u } = b;
|
|
4506
|
-
y = t.state.sliceDoc(f, u),
|
|
4515
|
+
y = t.state.sliceDoc(f, u), i.push(c.URL(f, u, y));
|
|
4507
4516
|
}
|
|
4508
|
-
if (
|
|
4509
|
-
const { text: f, from: u, to: F } =
|
|
4510
|
-
f !== null && y !== null &&
|
|
4517
|
+
if (g.getChild("Image") === null) {
|
|
4518
|
+
const { text: f, from: u, to: F } = V(t, o, s);
|
|
4519
|
+
f !== null && y !== null && i.push(c.TextDec(u, F, y));
|
|
4511
4520
|
}
|
|
4512
4521
|
return !1;
|
|
4513
4522
|
}
|
|
4514
|
-
}), h.set(
|
|
4523
|
+
}), h.set(i, !0);
|
|
4515
4524
|
}
|
|
4516
|
-
const
|
|
4525
|
+
const Ge = (t, r) => t.ctrlKey ? Qe(
|
|
4517
4526
|
t.target
|
|
4518
4527
|
/* as HTMLElement */
|
|
4519
|
-
) : !1,
|
|
4528
|
+
) : !1, Qe = (t) => {
|
|
4520
4529
|
if (t.nodeName === "A" && t.href && t.classList.contains("url"))
|
|
4521
4530
|
return window.open(t.href, t.target), !0;
|
|
4522
|
-
},
|
|
4531
|
+
}, _e = w.baseTheme({
|
|
4523
4532
|
".lk-mk, .link > .lk-url": { display: "none" },
|
|
4524
4533
|
"&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
|
|
4525
|
-
}),
|
|
4534
|
+
}), Ye = (t = {}) => {
|
|
4526
4535
|
const {
|
|
4527
4536
|
hideMarks: r = !0
|
|
4528
4537
|
} = t;
|
|
4529
4538
|
return [
|
|
4530
|
-
C(
|
|
4531
|
-
|
|
4539
|
+
C(ze, {}, { eventHandlers: { mousedown: Ge } }),
|
|
4540
|
+
_e
|
|
4532
4541
|
];
|
|
4533
4542
|
};
|
|
4534
|
-
class
|
|
4535
|
-
constructor(r,
|
|
4536
|
-
super(), this.img = r, this.url =
|
|
4543
|
+
class je extends M {
|
|
4544
|
+
constructor(r, a = null, n = "[image]") {
|
|
4545
|
+
super(), this.img = r, this.url = a, this.alt = n;
|
|
4537
4546
|
}
|
|
4538
4547
|
toDOM() {
|
|
4539
4548
|
let r = document.createElement("img");
|
|
4540
4549
|
if (r.src = this.img, r.alt = this.alt, r.style.minWidth = "100px", this.url) {
|
|
4541
|
-
let
|
|
4542
|
-
return
|
|
4550
|
+
let a = document.createElement("a");
|
|
4551
|
+
return a.href = this.url, a.target = "_blank", a.classList.add("url"), a.appendChild(r), a;
|
|
4543
4552
|
} else
|
|
4544
4553
|
return r;
|
|
4545
4554
|
}
|
|
@@ -4550,90 +4559,173 @@ class ze extends S {
|
|
|
4550
4559
|
return !1;
|
|
4551
4560
|
}
|
|
4552
4561
|
}
|
|
4553
|
-
function
|
|
4554
|
-
const
|
|
4555
|
-
return
|
|
4556
|
-
enter: ({ type: { name:
|
|
4557
|
-
if (
|
|
4558
|
-
const { from:
|
|
4562
|
+
function Ue(t, r) {
|
|
4563
|
+
const a = ["FencedCode", "Image"], n = [];
|
|
4564
|
+
return v(t, {
|
|
4565
|
+
enter: ({ type: { name: c }, from: i, to: l, node: o }) => {
|
|
4566
|
+
if (c === "Image" && !N(t, i, l)) {
|
|
4567
|
+
const { from: s, to: g } = o.getChild("URL"), d = t.state.sliceDoc(s, g), { text: b } = V(t, i, l);
|
|
4559
4568
|
n.push(
|
|
4560
4569
|
h.replace({
|
|
4561
|
-
widget: new
|
|
4562
|
-
}).range(
|
|
4570
|
+
widget: new je(d, Ve(t, o), b)
|
|
4571
|
+
}).range(i, l)
|
|
4563
4572
|
);
|
|
4564
4573
|
}
|
|
4565
|
-
return !
|
|
4574
|
+
return !a.includes(c);
|
|
4566
4575
|
}
|
|
4567
4576
|
}), h.set(n, !1);
|
|
4568
4577
|
}
|
|
4569
|
-
const
|
|
4578
|
+
const Ve = (t, r) => {
|
|
4570
4579
|
const n = r.parent.getChild("URL");
|
|
4571
4580
|
if (n !== null) {
|
|
4572
|
-
const { from:
|
|
4573
|
-
return t.state.sliceDoc(
|
|
4581
|
+
const { from: c, to: i } = n;
|
|
4582
|
+
return t.state.sliceDoc(c, i);
|
|
4574
4583
|
}
|
|
4575
4584
|
return null;
|
|
4576
|
-
},
|
|
4585
|
+
}, Xe = (t, r) => t.ctrlKey ? Ze(
|
|
4577
4586
|
t.target
|
|
4578
4587
|
/* as HTMLElement */
|
|
4579
|
-
) : !1,
|
|
4588
|
+
) : !1, Ze = (t) => {
|
|
4580
4589
|
const r = t.parentElement ?? !1;
|
|
4581
4590
|
if (t.nodeName === "IMG" && r && r.nodeName === "A" && r.classList.contains("url"))
|
|
4582
4591
|
return !0;
|
|
4583
|
-
},
|
|
4592
|
+
}, Je = w.baseTheme({}), er = (t = {}) => {
|
|
4584
4593
|
const {
|
|
4585
4594
|
hideMarks: r = !0
|
|
4586
4595
|
} = t;
|
|
4587
4596
|
return [
|
|
4588
|
-
C(
|
|
4589
|
-
|
|
4597
|
+
C(Ue, {}, { eventHandlers: { mousedown: Xe } }),
|
|
4598
|
+
Je
|
|
4590
4599
|
];
|
|
4591
|
-
}
|
|
4600
|
+
};
|
|
4601
|
+
class z extends M {
|
|
4602
|
+
constructor(r, a = !1) {
|
|
4603
|
+
super(), this.content = r, this.tag = a;
|
|
4604
|
+
}
|
|
4605
|
+
toDOM() {
|
|
4606
|
+
const r = document.createElement("div");
|
|
4607
|
+
r.className = "cm-html-widget", r.setAttribute("aria-hidden", "true");
|
|
4608
|
+
const a = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
|
|
4609
|
+
return r.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + a, r.querySelectorAll("script").forEach((n) => {
|
|
4610
|
+
n.parentNode.removeChild(n);
|
|
4611
|
+
}), r;
|
|
4612
|
+
}
|
|
4613
|
+
ignoreEvent(r) {
|
|
4614
|
+
return r.type === "click";
|
|
4615
|
+
}
|
|
4616
|
+
eq(r) {
|
|
4617
|
+
return r.content === this.content;
|
|
4618
|
+
}
|
|
4619
|
+
}
|
|
4620
|
+
const X = ie.define(), rr = ge.define({
|
|
4621
|
+
create(t) {
|
|
4622
|
+
return h.none;
|
|
4623
|
+
},
|
|
4624
|
+
update(t, r) {
|
|
4625
|
+
t = t.map(r.changes);
|
|
4626
|
+
for (let a of r.effects)
|
|
4627
|
+
if (a.is(X))
|
|
4628
|
+
return a.value;
|
|
4629
|
+
return t;
|
|
4630
|
+
},
|
|
4631
|
+
provide: (t) => q.decorations.from(t)
|
|
4632
|
+
});
|
|
4633
|
+
function tr(t) {
|
|
4634
|
+
const r = [
|
|
4635
|
+
/<br>/,
|
|
4636
|
+
/<img .*\/>/
|
|
4637
|
+
], a = {
|
|
4638
|
+
HTMLBlock: (c, i) => {
|
|
4639
|
+
const l = t.state.doc.sliceString(c, i);
|
|
4640
|
+
return [h.replace({
|
|
4641
|
+
widget: new z(l),
|
|
4642
|
+
inclusive: !1
|
|
4643
|
+
}).range(c, i)];
|
|
4644
|
+
},
|
|
4645
|
+
HTMLTag: (c, i) => {
|
|
4646
|
+
const l = t.state.doc.sliceString(c, i);
|
|
4647
|
+
return console.log(l), r.some((o) => o.test(l)) ? (console.log(l), [
|
|
4648
|
+
h.replace({
|
|
4649
|
+
widget: new z(l, !0),
|
|
4650
|
+
inclusive: !1
|
|
4651
|
+
}).range(c, i)
|
|
4652
|
+
]) : [];
|
|
4653
|
+
}
|
|
4654
|
+
}, n = [];
|
|
4655
|
+
return v(t, {
|
|
4656
|
+
enter: ({ type: c, from: i, to: l, node: o }) => {
|
|
4657
|
+
c.name in a && (!N(t, i, l) || !t.hasFocus) && n.push(...a[c.name](i, l));
|
|
4658
|
+
}
|
|
4659
|
+
}), h.set(n);
|
|
4660
|
+
}
|
|
4661
|
+
const ar = w.baseTheme({
|
|
4662
|
+
"& .cm-html-widget": {
|
|
4663
|
+
all: "unset"
|
|
4664
|
+
// outline: "red solid 2px",
|
|
4665
|
+
},
|
|
4666
|
+
"& .cm-html-widget > *": {
|
|
4667
|
+
paddingTop: "0",
|
|
4668
|
+
paddingBottom: "0",
|
|
4669
|
+
marginBottom: "0",
|
|
4670
|
+
marginTop: "0"
|
|
4671
|
+
},
|
|
4672
|
+
"& .cm-widgetBuffer": { display: "none" }
|
|
4673
|
+
}), or = q.updateListener.of((t) => {
|
|
4674
|
+
if (t.selectionSet || t.docChanged || t.focusChanged || t.geometryChanged) {
|
|
4675
|
+
const r = tr(t.view);
|
|
4676
|
+
t.view.dispatch({ effects: X.of(r) });
|
|
4677
|
+
}
|
|
4678
|
+
}), nr = (t = {}) => [
|
|
4679
|
+
rr,
|
|
4680
|
+
or,
|
|
4681
|
+
ar
|
|
4682
|
+
], lr = (t = { markdown: {} }) => {
|
|
4592
4683
|
const {
|
|
4593
4684
|
markdown: {
|
|
4594
4685
|
defaultCodeLanguage: r,
|
|
4595
|
-
codeLanguages:
|
|
4686
|
+
codeLanguages: a,
|
|
4596
4687
|
addKeymap: n,
|
|
4597
|
-
base:
|
|
4598
|
-
completeHTMLTags:
|
|
4688
|
+
base: c,
|
|
4689
|
+
completeHTMLTags: i,
|
|
4599
4690
|
htmlTagLanguage: l,
|
|
4600
|
-
extensions:
|
|
4691
|
+
extensions: o = []
|
|
4601
4692
|
},
|
|
4602
|
-
inline:
|
|
4603
|
-
Heading:
|
|
4693
|
+
inline: s,
|
|
4694
|
+
Heading: g,
|
|
4604
4695
|
Hr: d,
|
|
4605
4696
|
List: b,
|
|
4606
4697
|
Code: y
|
|
4607
4698
|
} = t, f = {
|
|
4608
4699
|
defaultCodeLanguage: r,
|
|
4609
|
-
codeLanguages:
|
|
4700
|
+
codeLanguages: a || ee,
|
|
4610
4701
|
addKeymap: n,
|
|
4611
|
-
base:
|
|
4612
|
-
completeHTMLTags:
|
|
4702
|
+
base: c,
|
|
4703
|
+
completeHTMLTags: i,
|
|
4613
4704
|
htmlTagLanguage: l,
|
|
4614
|
-
extensions: [...
|
|
4705
|
+
extensions: [...o, te, de, Ke]
|
|
4615
4706
|
};
|
|
4616
4707
|
return [
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4708
|
+
re(f),
|
|
4709
|
+
qe.of(He()),
|
|
4710
|
+
Q(s),
|
|
4711
|
+
j(g),
|
|
4712
|
+
_(b),
|
|
4713
|
+
G(d),
|
|
4714
|
+
Y(),
|
|
4715
|
+
Ye(),
|
|
4716
|
+
er(),
|
|
4717
|
+
Ie(),
|
|
4718
|
+
nr()
|
|
4627
4719
|
];
|
|
4628
4720
|
};
|
|
4629
|
-
typeof window < "u" && (window.gnosis =
|
|
4721
|
+
typeof window < "u" && (window.gnosis = lr, window.HrPlugin = G, window.ListPlugin = _, window.CodePlugin = Y, window.InlinePlugin = Q, window.HeadingPlugin = j);
|
|
4630
4722
|
export {
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4723
|
+
Y as CodePlugin,
|
|
4724
|
+
j as HeadingPlugin,
|
|
4725
|
+
G as HrPlugin,
|
|
4726
|
+
Q as InlinePlugin,
|
|
4727
|
+
_ as ListPlugin,
|
|
4728
|
+
He as catppuccin,
|
|
4729
|
+
lr as gnosis,
|
|
4730
|
+
qe as themeVariant
|
|
4639
4731
|
};
|