@bloklabs/cli 1.4.3 → 1.4.4
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/cli.mjs +2 -2
- package/dist/{convert-gdocs-DhqPnu2C.mjs → convert-gdocs-Y3Psy87D.mjs} +39 -35
- package/dist/{convert-html-BkMfT06o.mjs → convert-html-BM5cG4wR.mjs} +2 -2
- package/package.json +1 -1
- package/dist/block-builder-B_eFe3eS.mjs +0 -673
- package/dist/block-builder-BhbHyKmd.mjs +0 -673
- package/dist/block-builder-Cp5f8JCh.mjs +0 -779
- package/dist/convert-gdocs-6yY_wt82.mjs +0 -182
- package/dist/convert-gdocs-BDD1tJ_Q.mjs +0 -168
- package/dist/convert-gdocs-BZA8nIXm.mjs +0 -165
- package/dist/convert-gdocs-BeTateXm.mjs +0 -168
- package/dist/convert-gdocs-BhHRt3Cx.mjs +0 -168
- package/dist/convert-gdocs-BnJm2wSS.mjs +0 -165
- package/dist/convert-gdocs-Bp3j6l4q.mjs +0 -182
- package/dist/convert-gdocs-BvHmiAhV.mjs +0 -168
- package/dist/convert-gdocs-Bw88sUiB.mjs +0 -168
- package/dist/convert-gdocs-BxtZIyfN.mjs +0 -168
- package/dist/convert-gdocs-C2s8p7mh.mjs +0 -168
- package/dist/convert-gdocs-C71xkLGm.mjs +0 -165
- package/dist/convert-gdocs-CBRViTQf.mjs +0 -180
- package/dist/convert-gdocs-CHHN9rsx.mjs +0 -168
- package/dist/convert-gdocs-CKB34RE1.mjs +0 -168
- package/dist/convert-gdocs-CP4hP3lh.mjs +0 -165
- package/dist/convert-gdocs-CdKyF8Q9.mjs +0 -168
- package/dist/convert-gdocs-Ckxs9BwZ.mjs +0 -165
- package/dist/convert-gdocs-CwqIzHDl.mjs +0 -165
- package/dist/convert-gdocs-D0GC6YDQ.mjs +0 -165
- package/dist/convert-gdocs-D2pNV_P2.mjs +0 -165
- package/dist/convert-gdocs-DGmfsVqf.mjs +0 -165
- package/dist/convert-gdocs-DLaumLJ0.mjs +0 -182
- package/dist/convert-gdocs-DfDkgIvB.mjs +0 -168
- package/dist/convert-gdocs-Dg4BvXJv.mjs +0 -165
- package/dist/convert-gdocs-DgEV2uq0.mjs +0 -168
- package/dist/convert-gdocs-DxCZJg3f.mjs +0 -168
- package/dist/convert-gdocs-Dxv8hZRN.mjs +0 -168
- package/dist/convert-gdocs-E0xZ8aMJ.mjs +0 -168
- package/dist/convert-gdocs-Gr31yEVO.mjs +0 -168
- package/dist/convert-gdocs-qBKpfEIJ.mjs +0 -168
- package/dist/convert-html--cLXJ4AY.mjs +0 -13
- package/dist/convert-html-2hMWDvO2.mjs +0 -13
- package/dist/convert-html-B0G5pVra.mjs +0 -13
- package/dist/convert-html-BE95-_tJ.mjs +0 -13
- package/dist/convert-html-BLSIt9Cz.mjs +0 -13
- package/dist/convert-html-BMfw-V_A.mjs +0 -13
- package/dist/convert-html-Bi6ervFd.mjs +0 -13
- package/dist/convert-html-BwGfSIdd.mjs +0 -13
- package/dist/convert-html-BxOQfxMe.mjs +0 -13
- package/dist/convert-html-C5HKrrnY.mjs +0 -13
- package/dist/convert-html-CSFMRW8-.mjs +0 -13
- package/dist/convert-html-CUYvaNyX.mjs +0 -13
- package/dist/convert-html-CWU4BKK2.mjs +0 -13
- package/dist/convert-html-C_XAR-3k.mjs +0 -13
- package/dist/convert-html-CblPztis.mjs +0 -13
- package/dist/convert-html-CtLOMx8H.mjs +0 -13
- package/dist/convert-html-D-QH5JkA.mjs +0 -13
- package/dist/convert-html-DCWeObhy.mjs +0 -13
- package/dist/convert-html-DLCj5_Ti.mjs +0 -13
- package/dist/convert-html-DofDta-k.mjs +0 -13
- package/dist/convert-html-DtP-Ofru.mjs +0 -13
- package/dist/convert-html-GFOTARll.mjs +0 -13
- package/dist/convert-html-JmnpFRtf.mjs +0 -13
- package/dist/convert-html-Qy4nomiO.mjs +0 -13
- package/dist/convert-html-Y87KeWXA.mjs +0 -13
- package/dist/convert-html-dnxmpyLt.mjs +0 -13
- package/dist/convert-html-gVS6hEIk.mjs +0 -13
- package/dist/convert-html-nZIHLjp5.mjs +0 -13
- package/dist/convert-html-pNLuv-6b.mjs +0 -13
- package/dist/convert-html-vk0C2MGe.mjs +0 -13
- package/dist/convert-html-wpLDZrzb.mjs +0 -13
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-BM5cG4wR.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-Y3Psy87D.mjs");
|
|
52
52
|
r(t((await import("node:fs")).readFileSync("/dev/stdin", "utf-8")), s);
|
|
53
53
|
break;
|
|
54
54
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
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-Dc6PL7RK.mjs";
|
|
2
2
|
//#region src/components/modules/paste/constants.ts
|
|
3
3
|
var o = "data-blok-columns-candidate";
|
|
4
4
|
//#endregion
|
|
5
5
|
//#region src/components/modules/paste/google-docs-preprocessor.ts
|
|
6
6
|
function s(e) {
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
let
|
|
10
|
-
return
|
|
7
|
+
let n = document.createElement("div");
|
|
8
|
+
n.innerHTML = e;
|
|
9
|
+
let r = m(n);
|
|
10
|
+
return w(n, r), k(n), r && (E(n), p(n)), t(n), n.innerHTML;
|
|
11
11
|
}
|
|
12
12
|
function c(e, t) {
|
|
13
13
|
let n = e.parentElement;
|
|
@@ -105,17 +105,16 @@ function v(e) {
|
|
|
105
105
|
}
|
|
106
106
|
return -1;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
function x(e) {
|
|
108
|
+
function y(e) {
|
|
110
109
|
let t = v(e);
|
|
111
110
|
return t >= 0 && t > .75;
|
|
112
111
|
}
|
|
113
|
-
function
|
|
114
|
-
if (!n && !r) return
|
|
115
|
-
let o = n && i !== void 0 ?
|
|
116
|
-
return c ? `<mark style="${c};">${
|
|
112
|
+
function b(t, n, r, i, a) {
|
|
113
|
+
if (!n && !r) return t;
|
|
114
|
+
let o = n && i !== void 0 ? e(i, "text") : "", s = r && a !== void 0 ? e(a, "bg") : "", c = [n ? `color: ${o}` : "", h(r, n, s)].filter(Boolean).join("; ");
|
|
115
|
+
return c ? `<mark style="${c};">${t}</mark>` : t;
|
|
117
116
|
}
|
|
118
|
-
var
|
|
117
|
+
var x = /* @__PURE__ */ new Set([
|
|
119
118
|
"H1",
|
|
120
119
|
"H2",
|
|
121
120
|
"H3",
|
|
@@ -123,30 +122,30 @@ var C = /* @__PURE__ */ new Set([
|
|
|
123
122
|
"H5",
|
|
124
123
|
"H6"
|
|
125
124
|
]);
|
|
126
|
-
function
|
|
125
|
+
function S(e) {
|
|
127
126
|
let t = e.parentElement;
|
|
128
|
-
return t === null ? !1 :
|
|
127
|
+
return t === null ? !1 : x.has(t.tagName) ? !0 : S(t);
|
|
129
128
|
}
|
|
130
|
-
function
|
|
131
|
-
let n = e.getAttribute("style") ?? "",
|
|
132
|
-
if (!
|
|
133
|
-
let
|
|
134
|
-
return
|
|
129
|
+
function C(e, t) {
|
|
130
|
+
let n = e.getAttribute("style") ?? "", i = /font-weight\s*:\s*(700|bold)/i.test(n) && !S(e), a = /font-style\s*:\s*italic/i.test(n), o = /(?<![a-z-])color\s*:\s*([^;]+)/i.exec(n), s = /background-color\s*:\s*([^;]+)/i.exec(n), c = o?.[1]?.trim(), l = s?.[1]?.trim(), u = !(c !== void 0 && _(e)) && (t ? c !== void 0 && !g(c) : c !== void 0 && !g(c) && !y(c)), d = l !== void 0 && !r(l);
|
|
131
|
+
if (!i && !a && !u && !d) return null;
|
|
132
|
+
let f = b(e.innerHTML, u, d, c, l), p = a ? `<i>${f}</i>` : f;
|
|
133
|
+
return i ? `<b>${p}</b>` : p;
|
|
135
134
|
}
|
|
136
|
-
function
|
|
135
|
+
function w(e, t) {
|
|
137
136
|
for (let n of Array.from(e.querySelectorAll("span[style]"))) {
|
|
138
|
-
let e =
|
|
137
|
+
let e = C(n, t);
|
|
139
138
|
e !== null && n.replaceWith(document.createRange().createContextualFragment(e));
|
|
140
139
|
}
|
|
141
|
-
t &&
|
|
140
|
+
t && T(e);
|
|
142
141
|
}
|
|
143
|
-
function
|
|
144
|
-
for (let n of Array.from(
|
|
145
|
-
let
|
|
146
|
-
a.style.removeProperty("color"), i && (a.innerHTML = `<mark style="background-color: ${
|
|
142
|
+
function T(t) {
|
|
143
|
+
for (let n of Array.from(t.querySelectorAll("a[style]"))) {
|
|
144
|
+
let t = n.getAttribute("style") ?? "", r = /background-color\s*:\s*([^;]+)/i.exec(t)?.[1]?.trim(), i = r !== void 0 && r !== "transparent" && r !== "inherit", a = n;
|
|
145
|
+
a.style.removeProperty("color"), i && (a.innerHTML = `<mark style="background-color: ${e(r, "bg")};">${a.innerHTML}</mark>`, a.style.removeProperty("background-color"));
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
|
-
function
|
|
148
|
+
function E(e) {
|
|
150
149
|
if (e.querySelector("google-sheets-html-origin") === null) for (let t of Array.from(e.querySelectorAll("table"))) {
|
|
151
150
|
if (t.parentElement?.closest("table") !== null) continue;
|
|
152
151
|
let e = Array.from(t.querySelectorAll("tr")).filter((e) => e.closest("table") === t);
|
|
@@ -155,16 +154,21 @@ function O(e) {
|
|
|
155
154
|
n.every((e) => e === r) && (r === 2 || r === 3) && t.setAttribute(o, "");
|
|
156
155
|
}
|
|
157
156
|
}
|
|
157
|
+
function D(e) {
|
|
158
|
+
return e.children.length === 0 && (e.textContent ?? "").replace(/\s/g, "") === "";
|
|
159
|
+
}
|
|
160
|
+
function O(e) {
|
|
161
|
+
if (D(e)) {
|
|
162
|
+
e.remove();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
let t = document.createRange().createContextualFragment(e.innerHTML + "<br>");
|
|
166
|
+
e.replaceWith(t);
|
|
167
|
+
}
|
|
158
168
|
function k(e) {
|
|
159
169
|
for (let t of Array.from(e.querySelectorAll("td, th"))) {
|
|
160
170
|
let e = t.querySelectorAll("p");
|
|
161
|
-
|
|
162
|
-
for (let t of Array.from(e)) {
|
|
163
|
-
let e = document.createRange().createContextualFragment(t.innerHTML + "<br>");
|
|
164
|
-
t.replaceWith(e);
|
|
165
|
-
}
|
|
166
|
-
t.innerHTML = t.innerHTML.replace(/(<br\s*\/?>|\s)+$/i, "");
|
|
167
|
-
}
|
|
171
|
+
e.length !== 0 && (Array.from(e).forEach(O), t.innerHTML = t.innerHTML.replace(/(<br\s*\/?>|\s)+$/i, ""));
|
|
168
172
|
}
|
|
169
173
|
}
|
|
170
174
|
//#endregion
|
|
@@ -173,7 +177,7 @@ function A(e) {
|
|
|
173
177
|
let t = s(e), r = new DOMParser().parseFromString(t, "text/html").body;
|
|
174
178
|
i(r), n(r);
|
|
175
179
|
let o = {
|
|
176
|
-
version: "1.
|
|
180
|
+
version: "1.4.4",
|
|
177
181
|
blocks: a(r)
|
|
178
182
|
};
|
|
179
183
|
return JSON.stringify(o);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./block-builder-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./block-builder-Dc6PL7RK.mjs";
|
|
2
2
|
//#region src/cli/commands/convert-html/index.ts
|
|
3
3
|
function i(i) {
|
|
4
4
|
let a = new DOMParser().parseFromString(i, "text/html").body;
|
|
5
5
|
n(a), t(a), e(a);
|
|
6
6
|
let o = {
|
|
7
|
-
version: "1.4.
|
|
7
|
+
version: "1.4.4",
|
|
8
8
|
blocks: r(a)
|
|
9
9
|
};
|
|
10
10
|
return JSON.stringify(o);
|