@bloklabs/cli 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{block-builder-B_eFe3eS.mjs → block-builder-BhbHyKmd.mjs} +7 -7
- package/dist/cli.mjs +2 -2
- package/dist/{convert-gdocs-BhHRt3Cx.mjs → convert-gdocs-D8zi-ZHD.mjs} +58 -44
- package/dist/{convert-gdocs-BxtZIyfN.mjs → convert-gdocs-DhqPnu2C.mjs} +58 -44
- package/dist/{convert-html-Qy4nomiO.mjs → convert-html-CtLOMx8H.mjs} +2 -2
- package/dist/{convert-html-GFOTARll.mjs → convert-html-lcE4WDun.mjs} +2 -2
- package/package.json +3 -3
|
@@ -381,11 +381,11 @@ var M = {
|
|
|
381
381
|
STRONG: !0,
|
|
382
382
|
I: !0,
|
|
383
383
|
EM: !0,
|
|
384
|
-
A: new Set(["href"]),
|
|
384
|
+
A: /* @__PURE__ */ new Set(["href"]),
|
|
385
385
|
S: !0,
|
|
386
386
|
U: !0,
|
|
387
387
|
CODE: !0,
|
|
388
|
-
MARK: new Set(["style"]),
|
|
388
|
+
MARK: /* @__PURE__ */ new Set(["style"]),
|
|
389
389
|
BR: !0,
|
|
390
390
|
P: !0,
|
|
391
391
|
H1: !0,
|
|
@@ -396,20 +396,20 @@ var M = {
|
|
|
396
396
|
H6: !0,
|
|
397
397
|
UL: !0,
|
|
398
398
|
OL: !0,
|
|
399
|
-
LI: new Set(["aria-level"]),
|
|
399
|
+
LI: /* @__PURE__ */ new Set(["aria-level"]),
|
|
400
400
|
TABLE: !0,
|
|
401
401
|
THEAD: !0,
|
|
402
402
|
TBODY: !0,
|
|
403
403
|
TR: !0,
|
|
404
|
-
TD: new Set(["style"]),
|
|
405
|
-
TH: new Set(["style"]),
|
|
404
|
+
TD: /* @__PURE__ */ new Set(["style"]),
|
|
405
|
+
TH: /* @__PURE__ */ new Set(["style"]),
|
|
406
406
|
BLOCKQUOTE: !0,
|
|
407
407
|
PRE: !0,
|
|
408
408
|
HR: !0,
|
|
409
|
-
ASIDE: new Set(["style"]),
|
|
409
|
+
ASIDE: /* @__PURE__ */ new Set(["style"]),
|
|
410
410
|
DETAILS: !0,
|
|
411
411
|
SUMMARY: !0,
|
|
412
|
-
IMG: new Set(["src", "style"])
|
|
412
|
+
IMG: /* @__PURE__ */ new Set(["src", "style"])
|
|
413
413
|
};
|
|
414
414
|
function N(e) {
|
|
415
415
|
I(e);
|
package/dist/cli.mjs
CHANGED
|
@@ -41,14 +41,14 @@ var t = "# Migrating from EditorJS to Blok\n\nThis guide covers the breaking cha
|
|
|
41
41
|
case "convert-html": {
|
|
42
42
|
let e = new (await (import("jsdom"))).JSDOM("");
|
|
43
43
|
globalThis.DOMParser = e.window.DOMParser, globalThis.Node = e.window.Node;
|
|
44
|
-
let { convertHtml: t } = await import("./convert-html-
|
|
44
|
+
let { convertHtml: t } = await import("./convert-html-CtLOMx8H.mjs");
|
|
45
45
|
r(t((await import("node:fs")).readFileSync("/dev/stdin", "utf-8")), s);
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
48
48
|
case "convert-gdocs": {
|
|
49
49
|
let e = new (await (import("jsdom"))).JSDOM("");
|
|
50
50
|
globalThis.DOMParser = e.window.DOMParser, globalThis.Node = e.window.Node, globalThis.document = e.window.document;
|
|
51
|
-
let { convertGdocs: t } = await import("./convert-gdocs-
|
|
51
|
+
let { convertGdocs: t } = await import("./convert-gdocs-DhqPnu2C.mjs");
|
|
52
52
|
r(t((await import("node:fs")).readFileSync("/dev/stdin", "utf-8")), s);
|
|
53
53
|
break;
|
|
54
54
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "./block-builder-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./block-builder-BhbHyKmd.mjs";
|
|
2
|
+
//#region src/components/modules/paste/constants.ts
|
|
3
|
+
var o = "data-blok-columns-candidate";
|
|
4
|
+
//#endregion
|
|
2
5
|
//#region src/components/modules/paste/google-docs-preprocessor.ts
|
|
3
|
-
function
|
|
6
|
+
function s(e) {
|
|
4
7
|
let t = document.createElement("div");
|
|
5
8
|
t.innerHTML = e;
|
|
6
|
-
let n =
|
|
7
|
-
return
|
|
9
|
+
let n = m(t);
|
|
10
|
+
return E(t, n), n && (O(t), k(t), p(t)), t.innerHTML;
|
|
8
11
|
}
|
|
9
|
-
function
|
|
12
|
+
function c(e, t) {
|
|
10
13
|
let n = e.parentElement;
|
|
11
|
-
return n === null ? null : n === t ? e :
|
|
14
|
+
return n === null ? null : n === t ? e : c(n, t);
|
|
12
15
|
}
|
|
13
|
-
function
|
|
16
|
+
function l(e, t, n) {
|
|
14
17
|
let r = e.cloneNode(!1), i = [];
|
|
15
18
|
for (let n of Array.from(e.childNodes)) {
|
|
16
19
|
if (n === t) break;
|
|
@@ -18,58 +21,60 @@ function c(e, t, n) {
|
|
|
18
21
|
}
|
|
19
22
|
return i.forEach((e) => r.appendChild(e)), n !== null && r.appendChild(n), r.childNodes.length > 0 ? r : null;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
24
|
+
function u(e, t, n) {
|
|
22
25
|
let r = e.cloneNode(!1), i = Array.from(e.childNodes), a = i.findIndex((e) => e === t), o = i.slice(a + 1);
|
|
23
26
|
return n !== null && r.appendChild(n), o.forEach((e) => r.appendChild(e)), r.childNodes.length > 0 ? r : null;
|
|
24
27
|
}
|
|
25
|
-
function
|
|
28
|
+
function d(e, t) {
|
|
26
29
|
let n = (e, r, i) => {
|
|
27
30
|
if (e === t) return {
|
|
28
31
|
before: r,
|
|
29
32
|
after: i
|
|
30
33
|
};
|
|
31
34
|
let a = e.parentElement;
|
|
32
|
-
|
|
35
|
+
if (a === null) return {
|
|
33
36
|
before: r,
|
|
34
37
|
after: i
|
|
35
|
-
}
|
|
38
|
+
};
|
|
39
|
+
let o = l(a, e, r), s = u(a, e, i);
|
|
40
|
+
return n(a, o, s);
|
|
36
41
|
};
|
|
37
42
|
return n(e, null, null);
|
|
38
43
|
}
|
|
39
|
-
function
|
|
44
|
+
function f(e, t) {
|
|
40
45
|
let n = e.parentElement;
|
|
41
|
-
return n === null || n === t ? !1 : n.tagName === "TABLE"
|
|
46
|
+
return n === null || n === t ? !1 : n.tagName === "TABLE" || f(n, t);
|
|
42
47
|
}
|
|
43
|
-
function
|
|
48
|
+
function p(e) {
|
|
44
49
|
let t = Array.from(e.querySelectorAll("img"));
|
|
45
50
|
for (let n of t) {
|
|
46
|
-
if (
|
|
47
|
-
let t =
|
|
51
|
+
if (f(n, e)) continue;
|
|
52
|
+
let t = c(n, e);
|
|
48
53
|
if (!t) continue;
|
|
49
|
-
let { before: r, after: i } =
|
|
54
|
+
let { before: r, after: i } = d(n, t), a = document.createDocumentFragment();
|
|
50
55
|
r && a.appendChild(r), a.appendChild(n), i && a.appendChild(i), t.replaceWith(a);
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
|
-
function
|
|
58
|
+
function m(e) {
|
|
54
59
|
let t = e.querySelector("b[id^=\"docs-internal-guid-\"]");
|
|
55
60
|
if (!t) return !1;
|
|
56
61
|
let n = document.createDocumentFragment();
|
|
57
62
|
for (; t.firstChild;) n.appendChild(t.firstChild);
|
|
58
63
|
return t.replaceWith(n), !0;
|
|
59
64
|
}
|
|
60
|
-
function
|
|
65
|
+
function h(e, t, n) {
|
|
61
66
|
return e ? `background-color: ${n}` : t ? "background-color: transparent" : "";
|
|
62
67
|
}
|
|
63
|
-
function
|
|
68
|
+
function g(e) {
|
|
64
69
|
let t = e.replace(/\s/g, "");
|
|
65
70
|
return t === "rgb(0,0,0)" || t === "#000000";
|
|
66
71
|
}
|
|
67
|
-
function
|
|
72
|
+
function _(e) {
|
|
68
73
|
if (e.closest("a") !== null) return !0;
|
|
69
74
|
let t = e.querySelector("a");
|
|
70
75
|
return t !== null && t.textContent?.trim() === e.textContent?.trim();
|
|
71
76
|
}
|
|
72
|
-
function
|
|
77
|
+
function v(e) {
|
|
73
78
|
let t = e.replace(/\s/g, "").toLowerCase(), n = /^rgba?\((\d+),(\d+),(\d+)(?:,[\d.]+)?\)$/.exec(t);
|
|
74
79
|
if (n) {
|
|
75
80
|
let e = parseInt(n[1], 10) / 255, t = parseInt(n[2], 10) / 255, r = parseInt(n[3], 10) / 255;
|
|
@@ -100,17 +105,17 @@ function _(e) {
|
|
|
100
105
|
}
|
|
101
106
|
return -1;
|
|
102
107
|
}
|
|
103
|
-
var
|
|
104
|
-
function
|
|
105
|
-
let t =
|
|
108
|
+
var y = r, b = e;
|
|
109
|
+
function x(e) {
|
|
110
|
+
let t = v(e);
|
|
106
111
|
return t >= 0 && t > .75;
|
|
107
112
|
}
|
|
108
|
-
function
|
|
113
|
+
function S(e, n, r, i, a) {
|
|
109
114
|
if (!n && !r) return e;
|
|
110
|
-
let o = n && i !== void 0 ? t(i, "text") : "", s = r && a !== void 0 ? t(a, "bg") : "", c = [n ? `color: ${o}` : "",
|
|
115
|
+
let o = n && i !== void 0 ? t(i, "text") : "", s = r && a !== void 0 ? t(a, "bg") : "", c = [n ? `color: ${o}` : "", h(r, n, s)].filter(Boolean).join("; ");
|
|
111
116
|
return c ? `<mark style="${c};">${e}</mark>` : e;
|
|
112
117
|
}
|
|
113
|
-
var
|
|
118
|
+
var C = /* @__PURE__ */ new Set([
|
|
114
119
|
"H1",
|
|
115
120
|
"H2",
|
|
116
121
|
"H3",
|
|
@@ -118,30 +123,39 @@ var S = new Set([
|
|
|
118
123
|
"H5",
|
|
119
124
|
"H6"
|
|
120
125
|
]);
|
|
121
|
-
function
|
|
126
|
+
function w(e) {
|
|
122
127
|
let t = e.parentElement;
|
|
123
|
-
return t === null ? !1 :
|
|
128
|
+
return t === null ? !1 : C.has(t.tagName) ? !0 : w(t);
|
|
124
129
|
}
|
|
125
|
-
function
|
|
126
|
-
let n = e.getAttribute("style") ?? "", r = /font-weight\s*:\s*(700|bold)/i.test(n) && !
|
|
130
|
+
function T(e, t) {
|
|
131
|
+
let n = e.getAttribute("style") ?? "", r = /font-weight\s*:\s*(700|bold)/i.test(n) && !w(e), i = /font-style\s*:\s*italic/i.test(n), a = /(?<![a-z-])color\s*:\s*([^;]+)/i.exec(n), o = /background-color\s*:\s*([^;]+)/i.exec(n), s = a?.[1]?.trim(), c = o?.[1]?.trim(), l = !(s !== void 0 && _(e)) && (t ? s !== void 0 && !g(s) : s !== void 0 && !g(s) && !x(s)), u = c !== void 0 && c !== "transparent" && !y(c) && !b(c);
|
|
127
132
|
if (!r && !i && !l && !u) return null;
|
|
128
|
-
let d =
|
|
133
|
+
let d = S(e.innerHTML, l, u, s, c), f = i ? `<i>${d}</i>` : d;
|
|
129
134
|
return r ? `<b>${f}</b>` : f;
|
|
130
135
|
}
|
|
131
|
-
function
|
|
136
|
+
function E(e, t) {
|
|
132
137
|
for (let n of Array.from(e.querySelectorAll("span[style]"))) {
|
|
133
|
-
let e =
|
|
138
|
+
let e = T(n, t);
|
|
134
139
|
e !== null && n.replaceWith(document.createRange().createContextualFragment(e));
|
|
135
140
|
}
|
|
136
|
-
t &&
|
|
141
|
+
t && D(e);
|
|
137
142
|
}
|
|
138
|
-
function
|
|
143
|
+
function D(e) {
|
|
139
144
|
for (let n of Array.from(e.querySelectorAll("a[style]"))) {
|
|
140
145
|
let e = n.getAttribute("style") ?? "", r = /background-color\s*:\s*([^;]+)/i.exec(e)?.[1]?.trim(), i = r !== void 0 && r !== "transparent" && r !== "inherit", a = n;
|
|
141
146
|
a.style.removeProperty("color"), i && (a.innerHTML = `<mark style="background-color: ${t(r, "bg")};">${a.innerHTML}</mark>`, a.style.removeProperty("background-color"));
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
|
-
function
|
|
149
|
+
function O(e) {
|
|
150
|
+
if (e.querySelector("google-sheets-html-origin") === null) for (let t of Array.from(e.querySelectorAll("table"))) {
|
|
151
|
+
if (t.parentElement?.closest("table") !== null) continue;
|
|
152
|
+
let e = Array.from(t.querySelectorAll("tr")).filter((e) => e.closest("table") === t);
|
|
153
|
+
if (e.length === 0) continue;
|
|
154
|
+
let n = e.map((e) => Array.from(e.children).filter((e) => e.tagName === "TD" || e.tagName === "TH").length), r = n[0];
|
|
155
|
+
n.every((e) => e === r) && (r === 2 || r === 3) && t.setAttribute(o, "");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function k(e) {
|
|
145
159
|
for (let t of Array.from(e.querySelectorAll("td, th"))) {
|
|
146
160
|
let e = t.querySelectorAll("p");
|
|
147
161
|
if (e.length !== 0) {
|
|
@@ -155,14 +169,14 @@ function D(e) {
|
|
|
155
169
|
}
|
|
156
170
|
//#endregion
|
|
157
171
|
//#region src/cli/commands/convert-gdocs/index.ts
|
|
158
|
-
function
|
|
159
|
-
let t =
|
|
172
|
+
function A(e) {
|
|
173
|
+
let t = s(e), r = new DOMParser().parseFromString(t, "text/html").body;
|
|
160
174
|
i(r), n(r);
|
|
161
|
-
let
|
|
162
|
-
version: "1.2.
|
|
175
|
+
let o = {
|
|
176
|
+
version: "1.2.6",
|
|
163
177
|
blocks: a(r)
|
|
164
178
|
};
|
|
165
|
-
return JSON.stringify(
|
|
179
|
+
return JSON.stringify(o);
|
|
166
180
|
}
|
|
167
181
|
//#endregion
|
|
168
|
-
export {
|
|
182
|
+
export { A as convertGdocs };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "./block-builder-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./block-builder-BhbHyKmd.mjs";
|
|
2
|
+
//#region src/components/modules/paste/constants.ts
|
|
3
|
+
var o = "data-blok-columns-candidate";
|
|
4
|
+
//#endregion
|
|
2
5
|
//#region src/components/modules/paste/google-docs-preprocessor.ts
|
|
3
|
-
function
|
|
6
|
+
function s(e) {
|
|
4
7
|
let t = document.createElement("div");
|
|
5
8
|
t.innerHTML = e;
|
|
6
|
-
let n =
|
|
7
|
-
return
|
|
9
|
+
let n = m(t);
|
|
10
|
+
return E(t, n), n && (O(t), k(t), p(t)), t.innerHTML;
|
|
8
11
|
}
|
|
9
|
-
function
|
|
12
|
+
function c(e, t) {
|
|
10
13
|
let n = e.parentElement;
|
|
11
|
-
return n === null ? null : n === t ? e :
|
|
14
|
+
return n === null ? null : n === t ? e : c(n, t);
|
|
12
15
|
}
|
|
13
|
-
function
|
|
16
|
+
function l(e, t, n) {
|
|
14
17
|
let r = e.cloneNode(!1), i = [];
|
|
15
18
|
for (let n of Array.from(e.childNodes)) {
|
|
16
19
|
if (n === t) break;
|
|
@@ -18,58 +21,60 @@ function c(e, t, n) {
|
|
|
18
21
|
}
|
|
19
22
|
return i.forEach((e) => r.appendChild(e)), n !== null && r.appendChild(n), r.childNodes.length > 0 ? r : null;
|
|
20
23
|
}
|
|
21
|
-
function
|
|
24
|
+
function u(e, t, n) {
|
|
22
25
|
let r = e.cloneNode(!1), i = Array.from(e.childNodes), a = i.findIndex((e) => e === t), o = i.slice(a + 1);
|
|
23
26
|
return n !== null && r.appendChild(n), o.forEach((e) => r.appendChild(e)), r.childNodes.length > 0 ? r : null;
|
|
24
27
|
}
|
|
25
|
-
function
|
|
28
|
+
function d(e, t) {
|
|
26
29
|
let n = (e, r, i) => {
|
|
27
30
|
if (e === t) return {
|
|
28
31
|
before: r,
|
|
29
32
|
after: i
|
|
30
33
|
};
|
|
31
34
|
let a = e.parentElement;
|
|
32
|
-
|
|
35
|
+
if (a === null) return {
|
|
33
36
|
before: r,
|
|
34
37
|
after: i
|
|
35
|
-
}
|
|
38
|
+
};
|
|
39
|
+
let o = l(a, e, r), s = u(a, e, i);
|
|
40
|
+
return n(a, o, s);
|
|
36
41
|
};
|
|
37
42
|
return n(e, null, null);
|
|
38
43
|
}
|
|
39
|
-
function
|
|
44
|
+
function f(e, t) {
|
|
40
45
|
let n = e.parentElement;
|
|
41
|
-
return n === null || n === t ? !1 : n.tagName === "TABLE"
|
|
46
|
+
return n === null || n === t ? !1 : n.tagName === "TABLE" || f(n, t);
|
|
42
47
|
}
|
|
43
|
-
function
|
|
48
|
+
function p(e) {
|
|
44
49
|
let t = Array.from(e.querySelectorAll("img"));
|
|
45
50
|
for (let n of t) {
|
|
46
|
-
if (
|
|
47
|
-
let t =
|
|
51
|
+
if (f(n, e)) continue;
|
|
52
|
+
let t = c(n, e);
|
|
48
53
|
if (!t) continue;
|
|
49
|
-
let { before: r, after: i } =
|
|
54
|
+
let { before: r, after: i } = d(n, t), a = document.createDocumentFragment();
|
|
50
55
|
r && a.appendChild(r), a.appendChild(n), i && a.appendChild(i), t.replaceWith(a);
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
|
-
function
|
|
58
|
+
function m(e) {
|
|
54
59
|
let t = e.querySelector("b[id^=\"docs-internal-guid-\"]");
|
|
55
60
|
if (!t) return !1;
|
|
56
61
|
let n = document.createDocumentFragment();
|
|
57
62
|
for (; t.firstChild;) n.appendChild(t.firstChild);
|
|
58
63
|
return t.replaceWith(n), !0;
|
|
59
64
|
}
|
|
60
|
-
function
|
|
65
|
+
function h(e, t, n) {
|
|
61
66
|
return e ? `background-color: ${n}` : t ? "background-color: transparent" : "";
|
|
62
67
|
}
|
|
63
|
-
function
|
|
68
|
+
function g(e) {
|
|
64
69
|
let t = e.replace(/\s/g, "");
|
|
65
70
|
return t === "rgb(0,0,0)" || t === "#000000";
|
|
66
71
|
}
|
|
67
|
-
function
|
|
72
|
+
function _(e) {
|
|
68
73
|
if (e.closest("a") !== null) return !0;
|
|
69
74
|
let t = e.querySelector("a");
|
|
70
75
|
return t !== null && t.textContent?.trim() === e.textContent?.trim();
|
|
71
76
|
}
|
|
72
|
-
function
|
|
77
|
+
function v(e) {
|
|
73
78
|
let t = e.replace(/\s/g, "").toLowerCase(), n = /^rgba?\((\d+),(\d+),(\d+)(?:,[\d.]+)?\)$/.exec(t);
|
|
74
79
|
if (n) {
|
|
75
80
|
let e = parseInt(n[1], 10) / 255, t = parseInt(n[2], 10) / 255, r = parseInt(n[3], 10) / 255;
|
|
@@ -100,17 +105,17 @@ function _(e) {
|
|
|
100
105
|
}
|
|
101
106
|
return -1;
|
|
102
107
|
}
|
|
103
|
-
var
|
|
104
|
-
function
|
|
105
|
-
let t =
|
|
108
|
+
var y = r, b = e;
|
|
109
|
+
function x(e) {
|
|
110
|
+
let t = v(e);
|
|
106
111
|
return t >= 0 && t > .75;
|
|
107
112
|
}
|
|
108
|
-
function
|
|
113
|
+
function S(e, n, r, i, a) {
|
|
109
114
|
if (!n && !r) return e;
|
|
110
|
-
let o = n && i !== void 0 ? t(i, "text") : "", s = r && a !== void 0 ? t(a, "bg") : "", c = [n ? `color: ${o}` : "",
|
|
115
|
+
let o = n && i !== void 0 ? t(i, "text") : "", s = r && a !== void 0 ? t(a, "bg") : "", c = [n ? `color: ${o}` : "", h(r, n, s)].filter(Boolean).join("; ");
|
|
111
116
|
return c ? `<mark style="${c};">${e}</mark>` : e;
|
|
112
117
|
}
|
|
113
|
-
var
|
|
118
|
+
var C = /* @__PURE__ */ new Set([
|
|
114
119
|
"H1",
|
|
115
120
|
"H2",
|
|
116
121
|
"H3",
|
|
@@ -118,30 +123,39 @@ var S = new Set([
|
|
|
118
123
|
"H5",
|
|
119
124
|
"H6"
|
|
120
125
|
]);
|
|
121
|
-
function
|
|
126
|
+
function w(e) {
|
|
122
127
|
let t = e.parentElement;
|
|
123
|
-
return t === null ? !1 :
|
|
128
|
+
return t === null ? !1 : C.has(t.tagName) ? !0 : w(t);
|
|
124
129
|
}
|
|
125
|
-
function
|
|
126
|
-
let n = e.getAttribute("style") ?? "", r = /font-weight\s*:\s*(700|bold)/i.test(n) && !
|
|
130
|
+
function T(e, t) {
|
|
131
|
+
let n = e.getAttribute("style") ?? "", r = /font-weight\s*:\s*(700|bold)/i.test(n) && !w(e), i = /font-style\s*:\s*italic/i.test(n), a = /(?<![a-z-])color\s*:\s*([^;]+)/i.exec(n), o = /background-color\s*:\s*([^;]+)/i.exec(n), s = a?.[1]?.trim(), c = o?.[1]?.trim(), l = !(s !== void 0 && _(e)) && (t ? s !== void 0 && !g(s) : s !== void 0 && !g(s) && !x(s)), u = c !== void 0 && c !== "transparent" && !y(c) && !b(c);
|
|
127
132
|
if (!r && !i && !l && !u) return null;
|
|
128
|
-
let d =
|
|
133
|
+
let d = S(e.innerHTML, l, u, s, c), f = i ? `<i>${d}</i>` : d;
|
|
129
134
|
return r ? `<b>${f}</b>` : f;
|
|
130
135
|
}
|
|
131
|
-
function
|
|
136
|
+
function E(e, t) {
|
|
132
137
|
for (let n of Array.from(e.querySelectorAll("span[style]"))) {
|
|
133
|
-
let e =
|
|
138
|
+
let e = T(n, t);
|
|
134
139
|
e !== null && n.replaceWith(document.createRange().createContextualFragment(e));
|
|
135
140
|
}
|
|
136
|
-
t &&
|
|
141
|
+
t && D(e);
|
|
137
142
|
}
|
|
138
|
-
function
|
|
143
|
+
function D(e) {
|
|
139
144
|
for (let n of Array.from(e.querySelectorAll("a[style]"))) {
|
|
140
145
|
let e = n.getAttribute("style") ?? "", r = /background-color\s*:\s*([^;]+)/i.exec(e)?.[1]?.trim(), i = r !== void 0 && r !== "transparent" && r !== "inherit", a = n;
|
|
141
146
|
a.style.removeProperty("color"), i && (a.innerHTML = `<mark style="background-color: ${t(r, "bg")};">${a.innerHTML}</mark>`, a.style.removeProperty("background-color"));
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
|
-
function
|
|
149
|
+
function O(e) {
|
|
150
|
+
if (e.querySelector("google-sheets-html-origin") === null) for (let t of Array.from(e.querySelectorAll("table"))) {
|
|
151
|
+
if (t.parentElement?.closest("table") !== null) continue;
|
|
152
|
+
let e = Array.from(t.querySelectorAll("tr")).filter((e) => e.closest("table") === t);
|
|
153
|
+
if (e.length === 0) continue;
|
|
154
|
+
let n = e.map((e) => Array.from(e.children).filter((e) => e.tagName === "TD" || e.tagName === "TH").length), r = n[0];
|
|
155
|
+
n.every((e) => e === r) && (r === 2 || r === 3) && t.setAttribute(o, "");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function k(e) {
|
|
145
159
|
for (let t of Array.from(e.querySelectorAll("td, th"))) {
|
|
146
160
|
let e = t.querySelectorAll("p");
|
|
147
161
|
if (e.length !== 0) {
|
|
@@ -155,14 +169,14 @@ function D(e) {
|
|
|
155
169
|
}
|
|
156
170
|
//#endregion
|
|
157
171
|
//#region src/cli/commands/convert-gdocs/index.ts
|
|
158
|
-
function
|
|
159
|
-
let t =
|
|
172
|
+
function A(e) {
|
|
173
|
+
let t = s(e), r = new DOMParser().parseFromString(t, "text/html").body;
|
|
160
174
|
i(r), n(r);
|
|
161
|
-
let
|
|
162
|
-
version: "1.
|
|
175
|
+
let o = {
|
|
176
|
+
version: "1.3.0",
|
|
163
177
|
blocks: a(r)
|
|
164
178
|
};
|
|
165
|
-
return JSON.stringify(
|
|
179
|
+
return JSON.stringify(o);
|
|
166
180
|
}
|
|
167
181
|
//#endregion
|
|
168
|
-
export {
|
|
182
|
+
export { A as convertGdocs };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./block-builder-
|
|
1
|
+
import { n as e, r as t, t as n } from "./block-builder-BhbHyKmd.mjs";
|
|
2
2
|
//#region src/cli/commands/convert-html/index.ts
|
|
3
3
|
function r(r) {
|
|
4
4
|
let i = new DOMParser().parseFromString(r, "text/html").body;
|
|
5
5
|
t(i), e(i);
|
|
6
6
|
let a = {
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.3.0",
|
|
8
8
|
blocks: n(i)
|
|
9
9
|
};
|
|
10
10
|
return JSON.stringify(a);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./block-builder-
|
|
1
|
+
import { n as e, r as t, t as n } from "./block-builder-BhbHyKmd.mjs";
|
|
2
2
|
//#region src/cli/commands/convert-html/index.ts
|
|
3
3
|
function r(r) {
|
|
4
4
|
let i = new DOMParser().parseFromString(r, "text/html").body;
|
|
5
5
|
t(i), e(i);
|
|
6
6
|
let a = {
|
|
7
|
-
version: "1.2.
|
|
7
|
+
version: "1.2.6",
|
|
8
8
|
blocks: n(i)
|
|
9
9
|
};
|
|
10
10
|
return JSON.stringify(a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloklabs/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "CLI tools for Blok — convert HTML to Blok JSON, generate migration guides",
|
|
5
5
|
"bin": {
|
|
6
6
|
"blok-cli": "bin/blok-cli.mjs"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"engines": {
|
|
13
|
-
"node": "
|
|
13
|
+
"node": "^20.19.0 || ^22.13.0 || >=24.0.0"
|
|
14
14
|
},
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"access": "public"
|
|
@@ -31,6 +31,6 @@
|
|
|
31
31
|
"directory": "packages/cli"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"jsdom": "
|
|
34
|
+
"jsdom": "29.1.1"
|
|
35
35
|
}
|
|
36
36
|
}
|