@jackuait/blok 0.3.1-beta.3 → 0.3.1-beta.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/README.md +5 -2
- package/codemod/README.md +4 -4
- package/codemod/migrate-editorjs-to-blok.js +224 -25
- package/codemod/package.json +2 -3
- package/codemod/test.js +218 -4
- package/dist/{blok-DVGmVJt8.mjs → blok-BCT64ySF.mjs} +33 -4
- package/dist/blok.mjs +1 -1
- package/dist/blok.umd.js +2 -2
- package/dist/{index-6boN1DB4.mjs → index-4mwy4fr7.mjs} +1 -1
- package/package.json +2 -2
|
@@ -1920,7 +1920,7 @@ function kE() {
|
|
|
1920
1920
|
var wE = kE();
|
|
1921
1921
|
const TE = /* @__PURE__ */ Mt(wE);
|
|
1922
1922
|
var Zk = /* @__PURE__ */ ((a) => (a.VERBOSE = "VERBOSE", a.INFO = "INFO", a.WARN = "WARN", a.ERROR = "ERROR", a))(Zk || {});
|
|
1923
|
-
const Sa = () => "0.3.1-beta.
|
|
1923
|
+
const Sa = () => "0.3.1-beta.7", ie = {
|
|
1924
1924
|
BACKSPACE: 8,
|
|
1925
1925
|
TAB: 9,
|
|
1926
1926
|
ENTER: 13,
|
|
@@ -2082,6 +2082,35 @@ class N {
|
|
|
2082
2082
|
static isLineBreakTag(e) {
|
|
2083
2083
|
return !!e && ["BR", "WBR"].includes(e.tagName);
|
|
2084
2084
|
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Checks if a class name is valid for use with classList.add()
|
|
2087
|
+
* classList.add() throws if class contains whitespace, is empty, or contains invalid characters
|
|
2088
|
+
* @param className - class name to validate
|
|
2089
|
+
* @returns {boolean} - true if valid for classList.add()
|
|
2090
|
+
*/
|
|
2091
|
+
static isValidClassName(e) {
|
|
2092
|
+
if (e === "" || /\s/.test(e))
|
|
2093
|
+
return !1;
|
|
2094
|
+
try {
|
|
2095
|
+
return document.createElement("div").classList.add(e), !0;
|
|
2096
|
+
} catch (t) {
|
|
2097
|
+
return !1;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Safely adds class names to an element, filtering out invalid ones
|
|
2102
|
+
* @param element - element to add classes to
|
|
2103
|
+
* @param classNames - array of class names to add
|
|
2104
|
+
*/
|
|
2105
|
+
static safelyAddClasses(e, t) {
|
|
2106
|
+
const o = [], i = [];
|
|
2107
|
+
for (const l of t)
|
|
2108
|
+
N.isValidClassName(l) ? o.push(l) : i.push(l);
|
|
2109
|
+
if (o.length > 0 && e.classList.add(...o), i.length > 0) {
|
|
2110
|
+
const l = e.className, c = l ? `${l} ${i.join(" ")}` : i.join(" ");
|
|
2111
|
+
e.setAttribute("class", c);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2085
2114
|
/**
|
|
2086
2115
|
* Helper for making Elements with class name and attributes
|
|
2087
2116
|
* @param {string} tagName - new Element tag name
|
|
@@ -2093,11 +2122,11 @@ class N {
|
|
|
2093
2122
|
const i = document.createElement(e);
|
|
2094
2123
|
if (Array.isArray(t)) {
|
|
2095
2124
|
const l = t.filter((c) => c !== void 0 && c !== "").flatMap((c) => c.split(" ")).filter((c) => c !== "");
|
|
2096
|
-
|
|
2125
|
+
N.safelyAddClasses(i, l);
|
|
2097
2126
|
}
|
|
2098
2127
|
if (typeof t == "string" && t !== "") {
|
|
2099
2128
|
const l = t.split(" ").filter((c) => c !== "");
|
|
2100
|
-
|
|
2129
|
+
N.safelyAddClasses(i, l);
|
|
2101
2130
|
}
|
|
2102
2131
|
for (const l in o) {
|
|
2103
2132
|
if (!Object.prototype.hasOwnProperty.call(o, l))
|
|
@@ -7048,7 +7077,7 @@ class sC {
|
|
|
7048
7077
|
* @returns {Promise<NotifierModule>} loaded notifier module
|
|
7049
7078
|
*/
|
|
7050
7079
|
loadNotifierModule() {
|
|
7051
|
-
return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-
|
|
7080
|
+
return this.notifierModule !== null ? Promise.resolve(this.notifierModule) : (this.loadingPromise === null && (this.loadingPromise = import("./index-4mwy4fr7.mjs").then((e) => {
|
|
7052
7081
|
var o;
|
|
7053
7082
|
const t = (o = e == null ? void 0 : e.default) != null ? o : e;
|
|
7054
7083
|
if (!this.isNotifierModule(t))
|
package/dist/blok.mjs
CHANGED