@vizel/core 0.0.1-alpha.1 → 0.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.js +141 -141
- package/dist/index10.js +70 -110
- package/dist/index11.js +135 -168
- package/dist/index12.js +83 -74
- package/dist/index13.js +13 -134
- package/dist/index14.js +13 -146
- package/dist/index15.js +303 -15
- package/dist/index16.js +69 -14
- package/dist/index17.js +26 -295
- package/dist/index18.js +2 -2
- package/dist/index19.js +355 -24
- package/dist/index20.js +25 -264
- package/dist/index21.js +85 -68
- package/dist/index22.js +97 -353
- package/dist/index23.js +66 -84
- package/dist/index24.js +12 -36
- package/dist/index25.js +53 -92
- package/dist/index26.js +132 -96
- package/dist/index27.js +59 -126
- package/dist/index28.js +37 -53
- package/dist/index29.js +19 -62
- package/dist/index3.js +165 -60
- package/dist/index30.js +9 -37
- package/dist/index31.js +143 -19
- package/dist/index32.js +264 -11
- package/dist/index33.js +92 -9
- package/dist/index36.js +1 -1
- package/dist/index37.js +41 -57
- package/dist/index38.js +64 -4
- package/dist/index39.js +4 -123
- package/dist/index4.js +10 -86
- package/dist/index40.js +111 -315
- package/dist/index41.js +321 -481
- package/dist/index42.js +481 -42
- package/dist/index43.js +143 -138
- package/dist/index44.js +1 -1
- package/dist/index45.js +1 -1
- package/dist/index46.js +1 -1
- package/dist/index48.js +3 -3
- package/dist/index49.js +158 -1458
- package/dist/index5.js +132 -10
- package/dist/index50.js +1561 -5
- package/dist/index51.js +1408 -1467
- package/dist/index52.js +704 -183
- package/dist/index53.js +5 -723
- package/dist/index6.js +48 -131
- package/dist/index61.js +1 -1
- package/dist/index62.js +1 -1
- package/dist/index65.js +1 -1
- package/dist/index66.js +53 -1059
- package/dist/index67.js +1059 -53
- package/dist/index69.js +90 -3
- package/dist/index7.js +228 -409
- package/dist/index70.js +3 -90
- package/dist/index8.js +111 -45
- package/dist/index9.js +409 -228
- package/package.json +54 -80
package/dist/index6.js
CHANGED
|
@@ -1,135 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
lowlight: x = w
|
|
24
|
-
} = u;
|
|
25
|
-
return [H.extend({
|
|
26
|
-
addAttributes() {
|
|
27
|
-
return {
|
|
28
|
-
...this.parent?.(),
|
|
29
|
-
language: {
|
|
30
|
-
default: t,
|
|
31
|
-
parseHTML: (n) => n.getAttribute("data-language") || n.querySelector("code")?.getAttribute("class")?.replace("language-", "") || t,
|
|
32
|
-
renderHTML: (n) => ({
|
|
33
|
-
"data-language": n.language || t,
|
|
34
|
-
class: `language-${n.language || t}`
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
lineNumbers: {
|
|
38
|
-
default: p,
|
|
39
|
-
parseHTML: (n) => n.getAttribute("data-line-numbers") === "true",
|
|
40
|
-
renderHTML: (n) => n.lineNumbers ? { "data-line-numbers": "true" } : {}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
addNodeView() {
|
|
45
|
-
return ({ node: n, getPos: f, editor: d }) => {
|
|
46
|
-
const g = document.createElement("div");
|
|
47
|
-
g.classList.add("vizel-code-block"), n.attrs.lineNumbers && g.classList.add("vizel-code-block-line-numbers");
|
|
48
|
-
const o = document.createElement("div");
|
|
49
|
-
o.classList.add("vizel-code-block-language-selector"), o.setAttribute("contenteditable", "false");
|
|
50
|
-
const l = document.createElement("input");
|
|
51
|
-
l.type = "text", l.classList.add("vizel-code-block-language-input"), l.value = n.attrs.language || t, l.placeholder = "language";
|
|
52
|
-
const k = `vizel-languages-${Math.random().toString(36).slice(2, 9)}`, v = document.createElement("datalist");
|
|
53
|
-
v.id = k, l.setAttribute("list", k);
|
|
54
|
-
for (const e of N()) {
|
|
55
|
-
const a = document.createElement("option");
|
|
56
|
-
a.value = e.id, a.label = e.name, v.appendChild(a);
|
|
57
|
-
}
|
|
58
|
-
const C = () => {
|
|
59
|
-
const e = typeof f == "function" ? f() : null;
|
|
60
|
-
if (e != null) {
|
|
61
|
-
const a = l.value.toLowerCase().trim() || t;
|
|
62
|
-
l.value = a;
|
|
63
|
-
const { tr: c } = d.state, i = d.state.doc.nodeAt(e);
|
|
64
|
-
i && (c.setNodeMarkup(e, void 0, {
|
|
65
|
-
...i.attrs,
|
|
66
|
-
language: a
|
|
67
|
-
}), d.view.dispatch(c));
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
l.addEventListener("change", C), l.addEventListener("blur", C), l.addEventListener("keydown", (e) => {
|
|
71
|
-
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), C(), l.blur());
|
|
72
|
-
});
|
|
73
|
-
const s = document.createElement("button");
|
|
74
|
-
s.type = "button", s.classList.add("vizel-code-block-line-numbers-toggle"), s.innerHTML = S("listOrdered", { width: 16, height: 16 }), n.attrs.lineNumbers && s.classList.add("active"), s.title = n.attrs.lineNumbers ? "Hide line numbers" : "Show line numbers", o.appendChild(s), o.appendChild(l), o.appendChild(v);
|
|
75
|
-
const L = document.createElement("div");
|
|
76
|
-
L.classList.add("vizel-code-block-container");
|
|
77
|
-
const r = document.createElement("div");
|
|
78
|
-
r.classList.add("vizel-code-block-gutter"), r.setAttribute("contenteditable", "false"), r.setAttribute("aria-hidden", "true");
|
|
79
|
-
const E = document.createElement("pre"), b = document.createElement("code");
|
|
80
|
-
b.classList.add(`language-${n.attrs.language || t}`), E.appendChild(b), L.appendChild(r), L.appendChild(E), g.appendChild(o), g.appendChild(L);
|
|
81
|
-
const z = () => {
|
|
82
|
-
const e = b.textContent || "", a = e.split(`
|
|
83
|
-
`), c = e.endsWith(`
|
|
84
|
-
`) && a.length > 1 ? a.length - 1 : Math.max(1, a.length);
|
|
85
|
-
if (r.children.length !== c) {
|
|
86
|
-
r.innerHTML = "";
|
|
87
|
-
for (let i = 1; i <= c; i++) {
|
|
88
|
-
const m = document.createElement("div");
|
|
89
|
-
m.classList.add("vizel-code-block-line-number"), m.textContent = String(i), r.appendChild(m);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
n.attrs.lineNumbers && setTimeout(z, 0);
|
|
94
|
-
let A = n.attrs.language, h = n.attrs.lineNumbers;
|
|
95
|
-
s.addEventListener("click", (e) => {
|
|
96
|
-
e.preventDefault(), e.stopPropagation();
|
|
97
|
-
const a = typeof f == "function" ? f() : null;
|
|
98
|
-
if (a != null) {
|
|
99
|
-
const c = !h, { tr: i } = d.state, m = d.state.doc.nodeAt(a);
|
|
100
|
-
m && (i.setNodeMarkup(a, void 0, {
|
|
101
|
-
...m.attrs,
|
|
102
|
-
lineNumbers: c
|
|
103
|
-
}), d.view.dispatch(i));
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const M = (e) => {
|
|
107
|
-
A = e, l.value = e || t, b.className = `language-${e || t}`;
|
|
108
|
-
}, y = (e) => {
|
|
109
|
-
h = e, g.classList.toggle("vizel-code-block-line-numbers", e), s.classList.toggle("active", e), s.title = e ? "Hide line numbers" : "Show line numbers";
|
|
110
|
-
};
|
|
111
|
-
return {
|
|
112
|
-
dom: g,
|
|
113
|
-
contentDOM: b,
|
|
114
|
-
update(e) {
|
|
115
|
-
return e.type.name !== "codeBlock" ? !1 : (e.attrs.language !== A && M(e.attrs.language), e.attrs.lineNumbers !== h && y(e.attrs.lineNumbers), h && setTimeout(z, 0), !0);
|
|
116
|
-
},
|
|
117
|
-
ignoreMutation(e) {
|
|
118
|
-
return r.contains(e.target) || o.contains(e.target);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
};
|
|
1
|
+
import { Details as m, DetailsSummary as M, DetailsContent as p } from "./index41.js";
|
|
2
|
+
function A(r = {}) {
|
|
3
|
+
const { details: s = {}, detailsContent: i = {}, detailsSummary: o = {} } = r, a = m.extend({
|
|
4
|
+
renderMarkdown(t, e) {
|
|
5
|
+
const d = t.attrs?.open === !0 ? " open" : "", u = e.renderChildren(t.content ?? [], "");
|
|
6
|
+
return `<details${d}>
|
|
7
|
+
${u}</details>
|
|
8
|
+
|
|
9
|
+
`;
|
|
10
|
+
}
|
|
11
|
+
}), l = M.extend({
|
|
12
|
+
renderMarkdown(t, e) {
|
|
13
|
+
return `<summary>${e.renderChildren(t.content ?? [], "")}</summary>
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
}), c = p.extend({
|
|
17
|
+
renderMarkdown(t, e) {
|
|
18
|
+
return `
|
|
19
|
+
${e.renderChildren(t.content ?? [], `
|
|
20
|
+
|
|
21
|
+
`)}
|
|
22
|
+
`;
|
|
122
23
|
}
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
24
|
+
});
|
|
25
|
+
return [
|
|
26
|
+
a.configure({
|
|
27
|
+
HTMLAttributes: {
|
|
28
|
+
class: "vizel-details",
|
|
29
|
+
...s.HTMLAttributes
|
|
30
|
+
},
|
|
31
|
+
persist: !0
|
|
32
|
+
}),
|
|
33
|
+
c.configure({
|
|
34
|
+
HTMLAttributes: {
|
|
35
|
+
class: "vizel-details-content",
|
|
36
|
+
...i.HTMLAttributes
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
l.configure({
|
|
40
|
+
HTMLAttributes: {
|
|
41
|
+
class: "vizel-details-summary",
|
|
42
|
+
...o.HTMLAttributes
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
];
|
|
127
46
|
}
|
|
128
47
|
export {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
N as getVizelRegisteredLanguages,
|
|
134
|
-
w as lowlight
|
|
48
|
+
m as Details,
|
|
49
|
+
p as DetailsContent,
|
|
50
|
+
M as DetailsSummary,
|
|
51
|
+
A as createVizelDetailsExtensions
|
|
135
52
|
};
|
package/dist/index61.js
CHANGED
package/dist/index62.js
CHANGED
package/dist/index65.js
CHANGED