@jackuait/blok 0.10.2 → 0.10.3
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/blok.mjs +2 -2
- package/dist/chunks/{blok-D-T1XZ92.mjs → blok-3wc3aInM.mjs} +480 -463
- package/dist/chunks/{constants-CaB-mlB5.mjs → constants-Bp622jic.mjs} +109 -103
- package/dist/chunks/{tools-BFK2MvVI.mjs → tools-BC1jRfoS.mjs} +695 -644
- package/dist/full.mjs +3 -3
- package/dist/react.mjs +2 -2
- package/dist/tools.mjs +2 -2
- package/package.json +1 -1
- package/src/components/modules/toolbar/index.ts +95 -3
- package/src/components/modules/toolbar/plus-button.ts +37 -0
- package/src/components/modules/toolbar/settings-toggler.ts +6 -0
- package/src/components/modules/uiControllers/controllers/keyboard.ts +56 -22
- package/src/components/selection/cursor.ts +12 -2
- package/src/components/ui/toolbox.ts +31 -4
- package/src/components/utils/popover/popover-position.ts +8 -3
- package/src/tools/table/index.ts +10 -19
- package/src/tools/table/table-cell-selection.ts +126 -7
- package/src/tools/table/table-core.ts +59 -5
- package/src/tools/table/table-model.ts +8 -0
- package/src/tools/table/table-row-col-controls.ts +40 -18
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, A as t, At as n, B as r, Bt as i, Ct as a, D as o, Dt as s, En as c, Et as l, F as u, Ft as d, G as f, Gt as p, H as m, Ht as h, I as g, It as _, J as v, K as ee, Kt as y, L as b, Lt as x, M as S, Mt as te, N as ne, Nt as re, O as ie, Ot as ae, P as oe, Q as se, R as ce, Rt as le, St as ue, Tt as de, U as fe, Ut as pe, V as me, Vt as he, W as ge, Wt as _e, X as ve, Xn as ye, Xt as be, Y as xe, Z as Se, _t as Ce, a as we, at as Te, c as Ee, ct as De, d as Oe, dn as ke, dt as Ae, en as je, et as Me, f as Ne, ft as Pe, g as Fe, gt as Ie, h as Le, ht as Re, i as ze, it as Be, jt as Ve, k as He, kt as Ue, l as We, lt as Ge, mt as Ke, n as qe, nn as Je, nr as C, nt as Ye, o as Xe, on as w, ot as Ze, p as Qe, q as $e, qt as et, r as tt, rn as nt, rr as T, rt, s as it, sn as at, st as ot, t as st, tn as E, tt as ct, u as D, un as lt, ut, v as dt, vt as ft, wt as pt, xt as mt, yt as ht, z as gt, zt as _t } from "./constants-
|
|
1
|
+
import { $ as e, A as t, At as n, B as r, Bt as i, Ct as a, D as o, Dt as s, En as c, Et as l, F as u, Ft as d, G as f, Gt as p, H as m, Ht as h, I as g, It as _, J as v, K as ee, Kt as y, L as b, Lt as x, M as S, Mt as te, N as ne, Nt as re, O as ie, Ot as ae, P as oe, Q as se, R as ce, Rt as le, St as ue, Tt as de, U as fe, Ut as pe, V as me, Vt as he, W as ge, Wt as _e, X as ve, Xn as ye, Xt as be, Y as xe, Z as Se, _t as Ce, a as we, at as Te, c as Ee, ct as De, d as Oe, dn as ke, dt as Ae, en as je, et as Me, f as Ne, ft as Pe, g as Fe, gt as Ie, h as Le, ht as Re, i as ze, it as Be, jt as Ve, k as He, kt as Ue, l as We, lt as Ge, mt as Ke, n as qe, nn as Je, nr as C, nt as Ye, o as Xe, on as w, ot as Ze, p as Qe, q as $e, qt as et, r as tt, rn as nt, rr as T, rt, s as it, sn as at, st as ot, t as st, tn as E, tt as ct, u as D, un as lt, ut, v as dt, vt as ft, wt as pt, xt as mt, yt as ht, z as gt, zt as _t } from "./constants-Bp622jic.mjs";
|
|
2
2
|
import { t as O } from "./objectSpread2-CWwMYL_U.mjs";
|
|
3
3
|
import { n as k } from "./tw-CqxBf-1Y.mjs";
|
|
4
4
|
//#region src/components/utils/html.ts
|
|
@@ -1845,7 +1845,7 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
1845
1845
|
let t = e.querySelector("svg");
|
|
1846
1846
|
t && (t.setAttribute("width", vr), t.setAttribute("height", vr), t.setAttribute("viewBox", "0 0 24 24"), t.classList.add("text-gray-500", "pointer-events-none"));
|
|
1847
1847
|
}
|
|
1848
|
-
}, M = "data-blok-table-row", N = "data-blok-table-cell", P = "data-blok-table-cell-row", F = "data-blok-table-cell-col",
|
|
1848
|
+
}, M = "data-blok-table-row", N = "data-blok-table-cell", P = "data-blok-table-cell-row", F = "data-blok-table-cell-col", br = "1px solid var(--blok-table-border)", xr = [
|
|
1849
1849
|
"py-1",
|
|
1850
1850
|
"px-2",
|
|
1851
1851
|
"min-h-[2em]",
|
|
@@ -1853,17 +1853,17 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
1853
1853
|
"leading-none",
|
|
1854
1854
|
"text-sm",
|
|
1855
1855
|
"cursor-text"
|
|
1856
|
-
],
|
|
1856
|
+
], Sr = (e) => {
|
|
1857
1857
|
let t = Math.round(100 / e * 100) / 100;
|
|
1858
1858
|
return Array.from({ length: e }, () => t);
|
|
1859
|
-
},
|
|
1859
|
+
}, Cr = class {
|
|
1860
1860
|
constructor(e) {
|
|
1861
1861
|
this.readOnly = e.readOnly;
|
|
1862
1862
|
}
|
|
1863
1863
|
createGrid(e, t, n) {
|
|
1864
1864
|
let r = document.createElement("table");
|
|
1865
|
-
r.style.tableLayout = "fixed", r.style.width = "100%", r.style.borderCollapse = "separate", r.style.borderSpacing = "0px", r.style.borderTop =
|
|
1866
|
-
let i = n == null ?
|
|
1865
|
+
r.style.tableLayout = "fixed", r.style.width = "100%", r.style.borderCollapse = "separate", r.style.borderSpacing = "0px", r.style.borderTop = br, r.style.borderLeft = br;
|
|
1866
|
+
let i = n == null ? Sr(t) : n, a = document.createElement("colgroup");
|
|
1867
1867
|
i.forEach((e) => {
|
|
1868
1868
|
a.appendChild(this.createCol(e));
|
|
1869
1869
|
}), r.appendChild(a);
|
|
@@ -1876,9 +1876,9 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
1876
1876
|
createGridFromModel(e) {
|
|
1877
1877
|
var t;
|
|
1878
1878
|
let n = document.createElement("table");
|
|
1879
|
-
n.style.tableLayout = "fixed", n.style.width = "100%", n.style.borderCollapse = "separate", n.style.borderSpacing = "0px", n.style.borderTop =
|
|
1879
|
+
n.style.tableLayout = "fixed", n.style.width = "100%", n.style.borderCollapse = "separate", n.style.borderSpacing = "0px", n.style.borderTop = br, n.style.borderLeft = br;
|
|
1880
1880
|
let r = document.createElement("colgroup");
|
|
1881
|
-
((t = e.colWidths) == null ?
|
|
1881
|
+
((t = e.colWidths) == null ? Sr(e.cols) : t).forEach((e) => r.appendChild(this.createCol(e))), n.appendChild(r);
|
|
1882
1882
|
let i = document.createElement("tbody");
|
|
1883
1883
|
return Array.from({ length: e.rows }).forEach((t, n) => {
|
|
1884
1884
|
let r = document.createElement("tr");
|
|
@@ -1970,9 +1970,25 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
1970
1970
|
}), this.reindexCoordinates(e));
|
|
1971
1971
|
}
|
|
1972
1972
|
reindexCoordinates(e) {
|
|
1973
|
-
e.querySelectorAll(`[${M}]`)
|
|
1974
|
-
|
|
1975
|
-
|
|
1973
|
+
let t = Array.from(e.querySelectorAll(`[${M}]`)), n = /* @__PURE__ */ new Map();
|
|
1974
|
+
t.forEach((e, t) => {
|
|
1975
|
+
var r;
|
|
1976
|
+
let i = Array.from(e.querySelectorAll(`[${N}]`)), a = (r = n.get(t)) == null ? /* @__PURE__ */ new Set() : r;
|
|
1977
|
+
i.reduce((e, r) => {
|
|
1978
|
+
let i = r, o = (e) => a.has(e) ? o(e + 1) : e, s = o(e);
|
|
1979
|
+
r.setAttribute(P, String(t)), r.setAttribute(F, String(s));
|
|
1980
|
+
let c = i.colSpan || 1, l = i.rowSpan || 1;
|
|
1981
|
+
return l > 1 && this.blockRowspanCols(n, t, s, l, c), s + c;
|
|
1982
|
+
}, 0), n.delete(t);
|
|
1983
|
+
});
|
|
1984
|
+
}
|
|
1985
|
+
blockRowspanCols(e, t, n, r, i) {
|
|
1986
|
+
Array.from({ length: r - 1 }, (e, t) => t + 1).forEach((r) => {
|
|
1987
|
+
let a = t + r;
|
|
1988
|
+
e.has(a) || e.set(a, /* @__PURE__ */ new Set());
|
|
1989
|
+
let o = e.get(a);
|
|
1990
|
+
Array.from({ length: i }, (e, t) => t).forEach((e) => {
|
|
1991
|
+
o.add(n + e);
|
|
1976
1992
|
});
|
|
1977
1993
|
});
|
|
1978
1994
|
}
|
|
@@ -2041,11 +2057,11 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2041
2057
|
}
|
|
2042
2058
|
createCell(e, t) {
|
|
2043
2059
|
let n = document.createElement("td");
|
|
2044
|
-
n.className = k(
|
|
2060
|
+
n.className = k(xr), n.style.borderRight = br, n.style.borderBottom = br, n.style.overflow = "hidden", n.style.overflowWrap = "break-word", n.style.height = "0", n.setAttribute(N, ""), e !== void 0 && t !== void 0 && (n.setAttribute(P, String(e)), n.setAttribute(F, String(t)));
|
|
2045
2061
|
let r = document.createElement("div");
|
|
2046
|
-
return r.setAttribute(
|
|
2062
|
+
return r.setAttribute(L, ""), r.setAttribute(C.nestedBlocks, ""), r.style.display = "flex", r.style.flexDirection = "column", r.style.minHeight = "100%", n.appendChild(r), n;
|
|
2047
2063
|
}
|
|
2048
|
-
},
|
|
2064
|
+
}, I = (e) => typeof e == "object" && !!e && "blocks" in e, L = "data-blok-table-cell-blocks", wr = class {
|
|
2049
2065
|
constructor(e) {
|
|
2050
2066
|
var t;
|
|
2051
2067
|
this._activeCellWithBlocks = null, this.cellsPendingCheck = /* @__PURE__ */ new Set(), this.pendingCheckScheduled = !1, this.removedBlockCells = /* @__PURE__ */ new Map(), this.deferredEvents = [], this.isExitingTable = !1, this.handleBlockMutation = (e) => {
|
|
@@ -2071,7 +2087,7 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2071
2087
|
this.claimBlockForCell(i.cell, n.target.id), this.syncBlockToModel(i.cell, n.target.id), this.cellsPendingCheck.delete(i.cell);
|
|
2072
2088
|
return;
|
|
2073
2089
|
}
|
|
2074
|
-
let a = n.target.holder, o = a.closest(`[${
|
|
2090
|
+
let a = n.target.holder, o = a.closest(`[${L}]`);
|
|
2075
2091
|
o && this.stripPlaceholders(o);
|
|
2076
2092
|
let s = o && !this.model.findCellForBlock(n.target.id) ? o.closest(`[${N}]`) : null;
|
|
2077
2093
|
if (s && this.syncBlockToModel(s, n.target.id), o) return;
|
|
@@ -2089,11 +2105,11 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2089
2105
|
}, this.handleCellBlankSpaceClick = (e) => {
|
|
2090
2106
|
let t = e.target;
|
|
2091
2107
|
if (!t) return;
|
|
2092
|
-
let n = t.hasAttribute(N), r = t.hasAttribute(
|
|
2108
|
+
let n = t.hasAttribute(N), r = t.hasAttribute(L);
|
|
2093
2109
|
if (!n && !r) return;
|
|
2094
2110
|
let i = n ? t : t.closest(`[${N}]`);
|
|
2095
2111
|
if (!i) return;
|
|
2096
|
-
let a = n ? i.querySelector(`[${
|
|
2112
|
+
let a = n ? i.querySelector(`[${L}]`) : t;
|
|
2097
2113
|
if (!a) return;
|
|
2098
2114
|
let o = a.querySelectorAll("[data-blok-id]"), s = o[o.length - 1];
|
|
2099
2115
|
if (!s) return;
|
|
@@ -2191,7 +2207,7 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2191
2207
|
this.clearActiveCellWithBlocks();
|
|
2192
2208
|
let r = this.getCell(e.row, e.col);
|
|
2193
2209
|
if (!r) return;
|
|
2194
|
-
let i = r.querySelector(`[${
|
|
2210
|
+
let i = r.querySelector(`[${L}]`);
|
|
2195
2211
|
if (!i) return;
|
|
2196
2212
|
let a = i.querySelectorAll("[contenteditable=\"true\"]");
|
|
2197
2213
|
a.length !== 0 && ((t ? a[a.length - 1] : a[0]).focus(), (n = this.onNavigateToCell) == null || n.call(this, e));
|
|
@@ -2220,13 +2236,13 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2220
2236
|
e.forEach((e, t) => {
|
|
2221
2237
|
let n = i.querySelector(`[${F}="${t}"]`);
|
|
2222
2238
|
if (!n) return;
|
|
2223
|
-
let r = n.querySelector(`[${
|
|
2239
|
+
let r = n.querySelector(`[${L}]`);
|
|
2224
2240
|
if (!r) return;
|
|
2225
|
-
let o =
|
|
2241
|
+
let o = I(e) && e.blocks.length > 0 ? [...e.blocks] : null, { mountedIds: s, replacements: c } = o ? this.mountBlocksInCell(r, o) : {
|
|
2226
2242
|
mountedIds: [],
|
|
2227
2243
|
replacements: /* @__PURE__ */ new Map()
|
|
2228
2244
|
}, l = {};
|
|
2229
|
-
if (
|
|
2245
|
+
if (I(e) && (e.color !== void 0 && (l.color = e.color), e.textColor !== void 0 && (l.textColor = e.textColor)), s.length > 0) {
|
|
2230
2246
|
let e = o == null ? s : o, t = c.size > 0 ? e.map((e) => {
|
|
2231
2247
|
var t;
|
|
2232
2248
|
return (t = c.get(e)) == null ? e : t;
|
|
@@ -2274,7 +2290,7 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2274
2290
|
}
|
|
2275
2291
|
claimBlockForCell(e, t) {
|
|
2276
2292
|
var n, r;
|
|
2277
|
-
let i = e.querySelector(`[${
|
|
2293
|
+
let i = e.querySelector(`[${L}]`);
|
|
2278
2294
|
if (!i) return;
|
|
2279
2295
|
let a = this.api.blocks.getBlockIndex(t);
|
|
2280
2296
|
if (a === void 0) return;
|
|
@@ -2293,7 +2309,7 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2293
2309
|
}
|
|
2294
2310
|
ensureCellHasBlock(e) {
|
|
2295
2311
|
var t, n;
|
|
2296
|
-
let r = e.querySelector(`[${
|
|
2312
|
+
let r = e.querySelector(`[${L}]`);
|
|
2297
2313
|
r && r.querySelector("[data-blok-id]") === null && ((t = (n = this.api.blocks).transactWithoutCapture) == null || t.call(n, () => {
|
|
2298
2314
|
let t = this.api.blocks.insert("paragraph", { text: "" }, {}, this.api.blocks.getBlocksCount(), !0);
|
|
2299
2315
|
r.appendChild(t.holder), this.api.blocks.setBlockParent(t.id, this.tableBlockId), this.syncBlockToModel(e, t.id), this.stripPlaceholders(r);
|
|
@@ -2379,7 +2395,7 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2379
2395
|
getBlockIdsFromCells(e) {
|
|
2380
2396
|
let t = [];
|
|
2381
2397
|
return Array.from(e).forEach((e) => {
|
|
2382
|
-
let n = e.querySelector(`[${
|
|
2398
|
+
let n = e.querySelector(`[${L}]`);
|
|
2383
2399
|
n && n.querySelectorAll("[data-blok-id]").forEach((e) => {
|
|
2384
2400
|
let n = e.getAttribute("data-blok-id");
|
|
2385
2401
|
n && t.push(n);
|
|
@@ -2410,18 +2426,18 @@ var Kt = "outline-hidden py-[7px] mt-[2px] mb-px", qt = "outline-hidden pl-0.5 l
|
|
|
2410
2426
|
};
|
|
2411
2427
|
//#endregion
|
|
2412
2428
|
//#region src/components/shared/color-picker.ts
|
|
2413
|
-
function
|
|
2429
|
+
function Tr() {
|
|
2414
2430
|
var e, t;
|
|
2415
2431
|
let n = document.documentElement.getAttribute("data-blok-theme");
|
|
2416
2432
|
return n === "dark" ? y : n === "light" ? p : typeof window < "u" && (e = (t = window).matchMedia) != null && e.call(t, "(prefers-color-scheme: dark)").matches ? y : p;
|
|
2417
2433
|
}
|
|
2418
|
-
function
|
|
2434
|
+
function Er(e, t) {
|
|
2419
2435
|
if (e === t) return !0;
|
|
2420
2436
|
let n = _e(e), r = _e(t);
|
|
2421
2437
|
return n === null || r === null ? !1 : n[0] === r[0] && n[1] === r[1] && n[2] === r[2];
|
|
2422
2438
|
}
|
|
2423
|
-
var
|
|
2424
|
-
function
|
|
2439
|
+
var Dr = "var(--blok-swatch-neutral-bg)";
|
|
2440
|
+
function Or(e) {
|
|
2425
2441
|
let { i18n: t, modes: n, testIdPrefix: r, onColorSelect: i } = e, a = { activeColors: Object.fromEntries(n.map((e) => [e.key, null])) }, o = document.createElement("div");
|
|
2426
2442
|
o.setAttribute("data-blok-testid", `${r}-picker`), o.className = "flex flex-col gap-3 p-2";
|
|
2427
2443
|
let s = [];
|
|
@@ -2434,17 +2450,17 @@ function Dr(e) {
|
|
|
2434
2450
|
a.className = "grid gap-1", a.style.gridTemplateColumns = "repeat(5, 2.25rem)", s.push(a), n.appendChild(i), n.appendChild(a), o.appendChild(n);
|
|
2435
2451
|
});
|
|
2436
2452
|
let c = (e) => {
|
|
2437
|
-
let o = s[e], c = n[e], l =
|
|
2453
|
+
let o = s[e], c = n[e], l = Tr();
|
|
2438
2454
|
o.innerHTML = "";
|
|
2439
2455
|
let u = a.activeColors[c.key], d = document.createElement("button"), f = u === null;
|
|
2440
|
-
d.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-default`), d.className = k("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", f && "ring-2 ring-swatch-ring-hover"), d.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" && (d.style.color = "var(--blok-text-primary)"), d.style.backgroundColor =
|
|
2456
|
+
d.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-default`), d.className = k("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", f && "ring-2 ring-swatch-ring-hover"), d.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" && (d.style.color = "var(--blok-text-primary)"), d.style.backgroundColor = Dr, d.addEventListener("click", () => {
|
|
2441
2457
|
i(null, c.key);
|
|
2442
2458
|
});
|
|
2443
2459
|
let p = t.t("tools.colorPicker.defaultSwatchLabel").replace("{default}", t.t("tools.marker.default")).replace("{mode}", t.t(c.labelKey).toLowerCase());
|
|
2444
2460
|
E(d, p.charAt(0).toUpperCase() + p.slice(1), { placement: "top" }), o.appendChild(d);
|
|
2445
2461
|
for (let e of l) {
|
|
2446
|
-
let n = document.createElement("button"), a = c.presetField === "text" ? e.text : e.bg, s = u !== null &&
|
|
2447
|
-
n.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-${e.name}`), n.className = k("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", s && "ring-2 ring-swatch-ring-hover"), n.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" ? (n.style.color = e.text, n.style.backgroundColor =
|
|
2462
|
+
let n = document.createElement("button"), a = c.presetField === "text" ? e.text : e.bg, s = u !== null && Er(a, u);
|
|
2463
|
+
n.setAttribute("data-blok-testid", `${r}-swatch-${c.key}-${e.name}`), n.className = k("w-9 h-9 rounded-md cursor-pointer border-none outline-hidden", "flex items-center justify-center text-sm font-semibold", "transition-[box-shadow,transform] ring-inset hover:ring-2 hover:ring-swatch-ring-hover active:scale-90", s && "ring-2 ring-swatch-ring-hover"), n.textContent = c.presetField === "text" ? "A" : "", c.presetField === "text" ? (n.style.color = e.text, n.style.backgroundColor = Dr) : (n.style.color = l === y ? e.text : "#37352f", n.style.backgroundColor = e.bg), n.addEventListener("click", () => {
|
|
2448
2464
|
i(a, c.key);
|
|
2449
2465
|
});
|
|
2450
2466
|
let d = t.t("tools.colorPicker.colorSwatchLabel").replace("{color}", t.t("tools.colorPicker.color." + e.name)).replace("{mode}", t.t(c.labelKey).toLowerCase());
|
|
@@ -2467,8 +2483,8 @@ function Dr(e) {
|
|
|
2467
2483
|
}
|
|
2468
2484
|
//#endregion
|
|
2469
2485
|
//#region src/tools/table/table-cell-color-picker.ts
|
|
2470
|
-
var
|
|
2471
|
-
let t =
|
|
2486
|
+
var kr = (e) => {
|
|
2487
|
+
let t = Or({
|
|
2472
2488
|
i18n: e.i18n,
|
|
2473
2489
|
testIdPrefix: "cell-color",
|
|
2474
2490
|
modes: [{
|
|
@@ -2485,7 +2501,7 @@ var Or = (e) => {
|
|
|
2485
2501
|
}
|
|
2486
2502
|
});
|
|
2487
2503
|
return { element: t.element };
|
|
2488
|
-
},
|
|
2504
|
+
}, Ar = [
|
|
2489
2505
|
"top-left",
|
|
2490
2506
|
"top-center",
|
|
2491
2507
|
"top-right",
|
|
@@ -2495,7 +2511,7 @@ var Or = (e) => {
|
|
|
2495
2511
|
"bottom-left",
|
|
2496
2512
|
"bottom-center",
|
|
2497
2513
|
"bottom-right"
|
|
2498
|
-
],
|
|
2514
|
+
], jr = {
|
|
2499
2515
|
"top-left": "tools.table.placementTopLeft",
|
|
2500
2516
|
"top-center": "tools.table.placementTopCenter",
|
|
2501
2517
|
"top-right": "tools.table.placementTopRight",
|
|
@@ -2505,25 +2521,25 @@ var Or = (e) => {
|
|
|
2505
2521
|
"bottom-left": "tools.table.placementBottomLeft",
|
|
2506
2522
|
"bottom-center": "tools.table.placementBottomCenter",
|
|
2507
2523
|
"bottom-right": "tools.table.placementBottomRight"
|
|
2508
|
-
},
|
|
2524
|
+
}, Mr = {
|
|
2509
2525
|
top: "flex-start",
|
|
2510
2526
|
middle: "center",
|
|
2511
2527
|
bottom: "flex-end"
|
|
2512
|
-
},
|
|
2528
|
+
}, Nr = {
|
|
2513
2529
|
left: "flex-start",
|
|
2514
2530
|
center: "center",
|
|
2515
2531
|
right: "flex-end"
|
|
2516
|
-
},
|
|
2532
|
+
}, Pr = (e) => {
|
|
2517
2533
|
var t;
|
|
2518
2534
|
let n = (t = e.currentPlacement) == null ? "top-left" : t, r = document.createElement("div");
|
|
2519
2535
|
r.style.padding = "8px";
|
|
2520
2536
|
let i = document.createElement("div");
|
|
2521
2537
|
i.style.display = "grid", i.style.gridTemplateColumns = "repeat(3, 1fr)", i.style.gap = "3px";
|
|
2522
2538
|
let a = document.createElement("div");
|
|
2523
|
-
a.style.textAlign = "center", a.style.fontSize = "11px", a.style.marginTop = "6px", a.style.color = "var(--blok-text-secondary, #707684)", a.textContent = e.i18n.t(
|
|
2524
|
-
for (let t of
|
|
2539
|
+
a.style.textAlign = "center", a.style.fontSize = "11px", a.style.marginTop = "6px", a.style.color = "var(--blok-text-secondary, #707684)", a.textContent = e.i18n.t(jr[n]);
|
|
2540
|
+
for (let t of Ar) {
|
|
2525
2541
|
let [r, o] = t.split("-"), s = document.createElement("div");
|
|
2526
|
-
s.setAttribute("data-placement", t), s.style.width = "32px", s.style.height = "26px", s.style.borderRadius = "3px", s.style.display = "flex", s.style.flexDirection = "column", s.style.alignItems =
|
|
2542
|
+
s.setAttribute("data-placement", t), s.style.width = "32px", s.style.height = "26px", s.style.borderRadius = "3px", s.style.display = "flex", s.style.flexDirection = "column", s.style.alignItems = Nr[o], s.style.justifyContent = Mr[r], s.style.padding = "3px", s.style.cursor = "pointer", s.style.gap = "1px", t === n ? (s.setAttribute("data-active", "true"), s.style.outline = "2px solid var(--blok-color-primary, #388AE5)", s.style.outlineOffset = "-2px", s.style.backgroundColor = "var(--blok-item-focus-bg, rgba(35, 131, 226, 0.14))") : s.style.backgroundColor = "var(--blok-bg-light, #eff2f5)";
|
|
2527
2543
|
let c = document.createElement("div");
|
|
2528
2544
|
c.style.width = "14px", c.style.height = "2px", c.style.borderRadius = "1px", c.style.backgroundColor = "currentColor", c.style.opacity = "0.6";
|
|
2529
2545
|
let l = document.createElement("div");
|
|
@@ -2531,44 +2547,44 @@ var Or = (e) => {
|
|
|
2531
2547
|
i.querySelectorAll("[data-placement]").forEach((e) => {
|
|
2532
2548
|
let t = e;
|
|
2533
2549
|
t.removeAttribute("data-active"), t.style.outline = "", t.style.outlineOffset = "", t.style.backgroundColor = "var(--blok-bg-tertiary, #f0f0f0)";
|
|
2534
|
-
}), s.setAttribute("data-active", "true"), s.style.outline = "2px solid var(--blok-color-primary, #388AE5)", s.style.outlineOffset = "-2px", s.style.backgroundColor = "var(--blok-item-focus-bg, rgba(35, 131, 226, 0.14))", a.textContent = e.i18n.t(
|
|
2550
|
+
}), s.setAttribute("data-active", "true"), s.style.outline = "2px solid var(--blok-color-primary, #388AE5)", s.style.outlineOffset = "-2px", s.style.backgroundColor = "var(--blok-item-focus-bg, rgba(35, 131, 226, 0.14))", a.textContent = e.i18n.t(jr[t]), e.onPlacementSelect(t);
|
|
2535
2551
|
}), i.appendChild(s);
|
|
2536
2552
|
}
|
|
2537
2553
|
return r.appendChild(i), r.appendChild(a), { element: r };
|
|
2538
|
-
},
|
|
2554
|
+
}, Fr = (e, t, n) => {
|
|
2539
2555
|
t === "col" ? Object.assign(e.style, { height: `${n}px` }) : Object.assign(e.style, { width: `${n}px` });
|
|
2540
|
-
},
|
|
2556
|
+
}, Ir = [
|
|
2541
2557
|
[2, 2],
|
|
2542
2558
|
[8, 2],
|
|
2543
2559
|
[2, 7],
|
|
2544
2560
|
[8, 7],
|
|
2545
2561
|
[2, 12],
|
|
2546
2562
|
[8, 12]
|
|
2547
|
-
],
|
|
2563
|
+
], Lr = [
|
|
2548
2564
|
[2, 2],
|
|
2549
2565
|
[7, 2],
|
|
2550
2566
|
[12, 2],
|
|
2551
2567
|
[2, 8],
|
|
2552
2568
|
[7, 8],
|
|
2553
2569
|
[12, 8]
|
|
2554
|
-
],
|
|
2570
|
+
], Rr = (e) => {
|
|
2555
2571
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "svg"), n = e === "horizontal";
|
|
2556
2572
|
t.setAttribute("width", n ? "14" : "10"), t.setAttribute("height", n ? "10" : "14"), t.setAttribute("viewBox", n ? "0 0 14 10" : "0 0 10 14"), t.setAttribute("fill", "currentColor"), t.classList.add("opacity-0", "transition-opacity", "duration-150", "text-gray-400", "pointer-events-none");
|
|
2557
|
-
let r = n ?
|
|
2573
|
+
let r = n ? Lr : Ir;
|
|
2558
2574
|
for (let [e, n] of r) {
|
|
2559
2575
|
let r = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
2560
2576
|
r.setAttribute("cx", String(e)), r.setAttribute("cy", String(n)), r.setAttribute("r", "1.5"), t.appendChild(r);
|
|
2561
2577
|
}
|
|
2562
2578
|
return t;
|
|
2563
|
-
},
|
|
2579
|
+
}, zr = (e, t) => {
|
|
2564
2580
|
t === "col" ? Object.assign(e.style, { height: "16px" }) : Object.assign(e.style, { width: "16px" }), e.classList.add("bg-gray-200"), e.classList.remove("bg-gray-300");
|
|
2565
2581
|
let n = e.querySelector("svg");
|
|
2566
2582
|
n && (n.classList.remove("opacity-0"), n.classList.add("opacity-100"));
|
|
2567
|
-
},
|
|
2568
|
-
|
|
2583
|
+
}, Br = (e, t, n) => {
|
|
2584
|
+
Fr(e, t, n), e.classList.remove("bg-gray-200"), e.classList.add("bg-gray-300");
|
|
2569
2585
|
let r = e.querySelector("svg");
|
|
2570
2586
|
r && (r.classList.add("opacity-0"), r.classList.remove("opacity-100"));
|
|
2571
|
-
},
|
|
2587
|
+
}, Vr = "data-blok-table-cell-selected", Hr = "2px solid #3b82f6", Ur = "data-blok-table-selection-pill", Wr = 16, Gr = 20, Kr = 4, qr = [
|
|
2572
2588
|
"absolute",
|
|
2573
2589
|
"z-3",
|
|
2574
2590
|
"rounded-sm",
|
|
@@ -2581,9 +2597,9 @@ var Or = (e) => {
|
|
|
2581
2597
|
"overflow-hidden",
|
|
2582
2598
|
"cursor-pointer",
|
|
2583
2599
|
"bg-blue-500"
|
|
2584
|
-
],
|
|
2600
|
+
], Jr = (e) => e.style.userSelect === "none", Yr = class {
|
|
2585
2601
|
constructor(e) {
|
|
2586
|
-
this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.resizeObserver = null, this.lastPaintedRange = null, this.grid = e.grid, this.rectangleSelection = e.rectangleSelection, this.onSelectionActiveChange = e.onSelectionActiveChange, this.onClearContent = e.onClearContent, this.onCopy = e.onCopy, this.onCut = e.onCut, this.onCopyViaButton = e.onCopyViaButton, this.onColorChange = e.onColorChange, this.onPlacementChange = e.onPlacementChange, this.getCellPlacement = e.getCellPlacement, this.onSelectionRangeChange = e.onSelectionRangeChange, this.onPointerDragActiveChange = e.onPointerDragActiveChange, this.isPopoverOpen = e.isPopoverOpen, this.canMergeCells = e.canMergeCells, this.onMergeCells = e.onMergeCells, this.isMergedCell = e.isMergedCell, this.onSplitCell = e.onSplitCell, this.i18n = e.i18n, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this), this.boundCopyHandler = this.handleCopy.bind(this), this.boundCutHandler = this.handleCut.bind(this), this.boundPreventDragStart = this.handleDragStart.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown), this.grid.addEventListener("dragstart", this.boundPreventDragStart), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("copy", this.boundCopyHandler), document.addEventListener("cut", this.boundCutHandler);
|
|
2602
|
+
this.anchorCell = null, this.extentCell = null, this.isSelecting = !1, this.hasSelection = !1, this.selectedCells = [], this.overlay = null, this.pill = null, this.pillPopover = null, this.resizeObserver = null, this.lastPaintedRange = null, this.preExpansionWasSingleCell = !1, this.grid = e.grid, this.rectangleSelection = e.rectangleSelection, this.onSelectionActiveChange = e.onSelectionActiveChange, this.onClearContent = e.onClearContent, this.onCopy = e.onCopy, this.onCut = e.onCut, this.onCopyViaButton = e.onCopyViaButton, this.onColorChange = e.onColorChange, this.onPlacementChange = e.onPlacementChange, this.getCellPlacement = e.getCellPlacement, this.onSelectionRangeChange = e.onSelectionRangeChange, this.onPointerDragActiveChange = e.onPointerDragActiveChange, this.isPopoverOpen = e.isPopoverOpen, this.canMergeCells = e.canMergeCells, this.onMergeCells = e.onMergeCells, this.isMergedCell = e.isMergedCell, this.onSplitCell = e.onSplitCell, this.getCellSpan = e.getCellSpan, this.i18n = e.i18n, this.grid.style.position = "relative", this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.boundClearSelection = this.handleClearSelection.bind(this), this.boundCancelRectangle = this.handleCancelRectangle.bind(this), this.boundKeyDown = this.handleKeyDown.bind(this), this.boundCopyHandler = this.handleCopy.bind(this), this.boundCutHandler = this.handleCut.bind(this), this.boundPreventDragStart = this.handleDragStart.bind(this), this.grid.addEventListener("pointerdown", this.boundPointerDown), this.grid.addEventListener("dragstart", this.boundPreventDragStart), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("copy", this.boundCopyHandler), document.addEventListener("cut", this.boundCutHandler);
|
|
2587
2603
|
}
|
|
2588
2604
|
destroy() {
|
|
2589
2605
|
if (this.destroyPillPopover(), this.disconnectResizeObserver(), this.clearSelection(), this.anchorCell) {
|
|
@@ -2614,9 +2630,9 @@ var Or = (e) => {
|
|
|
2614
2630
|
}
|
|
2615
2631
|
handlePointerDown(e) {
|
|
2616
2632
|
var t;
|
|
2617
|
-
if (
|
|
2633
|
+
if (Jr(this.grid) || e.button !== 0) return;
|
|
2618
2634
|
let n = e.target;
|
|
2619
|
-
if (n.closest("[data-blok-table-grip]") || n.closest("[data-blok-table-resize]") || n.closest(`[${
|
|
2635
|
+
if (n.closest("[data-blok-table-grip]") || n.closest("[data-blok-table-resize]") || n.closest(`[${Ur}]`)) return;
|
|
2620
2636
|
let r = this.resolveCellCoord(n);
|
|
2621
2637
|
r && (this.hasSelection && this.lastPaintedRange !== null && this.lastPaintedRange.minRow === r.row && this.lastPaintedRange.maxRow === r.row && this.lastPaintedRange.minCol === r.col && this.lastPaintedRange.maxCol === r.col ? document.removeEventListener("pointerdown", this.boundClearSelection) : this.hasSelection && this.clearSelection(), this.anchorCell = r, this.isSelecting = !1, (t = this.onPointerDragActiveChange) == null || t.call(this, !0), document.addEventListener("mousemove", this.boundCancelRectangle, !0), document.addEventListener("pointermove", this.boundPointerMove), document.addEventListener("pointerup", this.boundPointerUp), document.addEventListener("pointercancel", this.boundPointerUp));
|
|
2622
2638
|
}
|
|
@@ -2658,7 +2674,7 @@ var Or = (e) => {
|
|
|
2658
2674
|
}
|
|
2659
2675
|
handleClearSelection(e) {
|
|
2660
2676
|
let t = e.target;
|
|
2661
|
-
t instanceof HTMLElement && t.closest(`[${
|
|
2677
|
+
t instanceof HTMLElement && t.closest(`[${Ur}]`) || t instanceof HTMLElement && t.closest("[data-blok-popover-opened]") !== null || (this.pillPopover !== null && this.destroyPillPopover(), document.removeEventListener("pointerdown", this.boundClearSelection), this.clearSelection());
|
|
2662
2678
|
}
|
|
2663
2679
|
handleKeyDown(e) {
|
|
2664
2680
|
var t;
|
|
@@ -2666,22 +2682,26 @@ var Or = (e) => {
|
|
|
2666
2682
|
}
|
|
2667
2683
|
handleCopy(e) {
|
|
2668
2684
|
var t;
|
|
2669
|
-
!this.hasSelection || !e.clipboardData || (e.preventDefault(), (t = this.onCopy) == null || t.call(this, [...this.selectedCells], e.clipboardData));
|
|
2685
|
+
!this.hasSelection || !e.clipboardData || this.selectedCells.length <= 1 && this.hasNativeTextSelection() || (e.preventDefault(), (t = this.onCopy) == null || t.call(this, [...this.selectedCells], e.clipboardData));
|
|
2670
2686
|
}
|
|
2671
2687
|
handleCut(e) {
|
|
2672
2688
|
var t, n;
|
|
2673
|
-
!this.hasSelection || !e.clipboardData || (e.preventDefault(), (t = this.onCut) == null || t.call(this, [...this.selectedCells], e.clipboardData), (n = this.onClearContent) == null || n.call(this, [...this.selectedCells]), this.clearSelection());
|
|
2689
|
+
!this.hasSelection || !e.clipboardData || this.selectedCells.length <= 1 && this.hasNativeTextSelection() || (e.preventDefault(), (t = this.onCut) == null || t.call(this, [...this.selectedCells], e.clipboardData), (n = this.onClearContent) == null || n.call(this, [...this.selectedCells]), this.clearSelection());
|
|
2690
|
+
}
|
|
2691
|
+
hasNativeTextSelection() {
|
|
2692
|
+
let e = window.getSelection();
|
|
2693
|
+
return e !== null && !e.isCollapsed;
|
|
2674
2694
|
}
|
|
2675
2695
|
clearSelection() {
|
|
2676
2696
|
let e = this.hasSelection;
|
|
2677
|
-
if (this.restoreModifiedCells(), this.hasSelection = !1, this.lastPaintedRange = null, e) {
|
|
2697
|
+
if (this.restoreModifiedCells(), this.hasSelection = !1, this.lastPaintedRange = null, this.preExpansionWasSingleCell = !1, e) {
|
|
2678
2698
|
var t;
|
|
2679
2699
|
(t = this.onSelectionActiveChange) == null || t.call(this, !1);
|
|
2680
2700
|
}
|
|
2681
2701
|
}
|
|
2682
2702
|
restoreModifiedCells() {
|
|
2683
2703
|
this.destroyPillPopover(), this.disconnectResizeObserver(), this.selectedCells.forEach((e) => {
|
|
2684
|
-
e.removeAttribute(
|
|
2704
|
+
e.removeAttribute(Vr);
|
|
2685
2705
|
}), this.pill && (this.pill.remove(), this.pill = null), this.overlay && (this.overlay.remove(), this.overlay = null), this.selectedCells = [];
|
|
2686
2706
|
}
|
|
2687
2707
|
showProgrammaticSelection(e, t, n, r) {
|
|
@@ -2698,26 +2718,43 @@ var Or = (e) => {
|
|
|
2698
2718
|
}
|
|
2699
2719
|
this.anchorCell = null, this.extentCell = null, document.addEventListener("pointerdown", this.boundClearSelection);
|
|
2700
2720
|
}
|
|
2721
|
+
expandRectToMergedSpans(e) {
|
|
2722
|
+
return this.getCellSpan ? this.expandRectStep(e) : e;
|
|
2723
|
+
}
|
|
2724
|
+
expandRectStep(e) {
|
|
2725
|
+
let t = this.getCellSpan;
|
|
2726
|
+
if (!t) return e;
|
|
2727
|
+
let n = Array.from({ length: e.maxRow - e.minRow + 1 }, (t, n) => e.minRow + n), r = Array.from({ length: e.maxCol - e.minCol + 1 }, (t, n) => e.minCol + n), i = n.reduce((e, n) => r.reduce((e, r) => {
|
|
2728
|
+
let { colspan: i, rowspan: a } = t(n, r);
|
|
2729
|
+
return {
|
|
2730
|
+
minRow: e.minRow,
|
|
2731
|
+
maxRow: Math.max(e.maxRow, n + a - 1),
|
|
2732
|
+
minCol: e.minCol,
|
|
2733
|
+
maxCol: Math.max(e.maxCol, r + i - 1)
|
|
2734
|
+
};
|
|
2735
|
+
}, e), e);
|
|
2736
|
+
return i.maxRow !== e.maxRow || i.maxCol !== e.maxCol ? this.expandRectStep(i) : i;
|
|
2737
|
+
}
|
|
2701
2738
|
paintSelection() {
|
|
2702
2739
|
if (!this.anchorCell || !this.extentCell) return;
|
|
2703
2740
|
this.selectedCells.forEach((e) => {
|
|
2704
|
-
e.removeAttribute(
|
|
2741
|
+
e.removeAttribute(Vr);
|
|
2705
2742
|
}), this.selectedCells = [];
|
|
2706
2743
|
let e = Math.min(this.anchorCell.row, this.extentCell.row), t = Math.max(this.anchorCell.row, this.extentCell.row), n = Math.min(this.anchorCell.col, this.extentCell.col), r = Math.max(this.anchorCell.col, this.extentCell.col);
|
|
2707
|
-
this.lastPaintedRange = {
|
|
2744
|
+
this.preExpansionWasSingleCell = e === t && n === r, this.lastPaintedRange = this.expandRectToMergedSpans({
|
|
2708
2745
|
minRow: e,
|
|
2709
2746
|
maxRow: t,
|
|
2710
2747
|
minCol: n,
|
|
2711
2748
|
maxCol: r
|
|
2712
|
-
};
|
|
2713
|
-
let i = this.grid.querySelectorAll(`[${M}]`);
|
|
2714
|
-
this.selectedCells = this.collectCellsInRange(i, e, t, n, r), this.selectedCells.forEach((e) => {
|
|
2715
|
-
e.setAttribute(Br, "");
|
|
2716
2749
|
});
|
|
2717
|
-
let
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2750
|
+
let { minRow: i, maxRow: a, minCol: o, maxCol: s } = this.lastPaintedRange, c = this.grid.querySelectorAll(`[${M}]`);
|
|
2751
|
+
this.selectedCells = this.collectCellsInRange(c, i, a, o, s), this.selectedCells.forEach((e) => {
|
|
2752
|
+
e.setAttribute(Vr, "");
|
|
2753
|
+
});
|
|
2754
|
+
let l = this.findCellByCoordOrIndex(c, i, o), u = this.findCellByCoordOrIndex(c, a, s);
|
|
2755
|
+
if (!l || !u) return;
|
|
2756
|
+
let d = this.grid.getBoundingClientRect(), f = l.getBoundingClientRect(), p = u.getBoundingClientRect(), m = getComputedStyle(this.grid), h = parseFloat(m.borderTopWidth) || 0, g = parseFloat(m.borderLeftWidth) || 0, _ = p.right - f.left + 1, v = p.bottom - f.top + 1, ee = f.top - d.top - h - 1, y = f.left - d.left - g - 1;
|
|
2757
|
+
this.overlay || (this.overlay = document.createElement("div"), this.overlay.setAttribute("data-blok-table-selection-overlay", ""), this.overlay.style.position = "absolute", this.overlay.style.border = Hr, this.overlay.style.pointerEvents = "none", this.overlay.style.boxSizing = "border-box", this.overlay.style.borderRadius = "2px", this.grid.appendChild(this.overlay)), this.overlay.style.top = `${ee}px`, this.overlay.style.left = `${y}px`, this.overlay.style.width = `${_}px`, this.overlay.style.height = `${v}px`, this.pill || (this.pill = this.createPill(), this.grid.appendChild(this.pill)), this.pill.style.left = `${y + _ - 1}px`, this.pill.style.top = `${ee + v / 2}px`, this.observeCellResizes();
|
|
2721
2758
|
}
|
|
2722
2759
|
repositionOverlay() {
|
|
2723
2760
|
let e = this.lastPaintedRange;
|
|
@@ -2740,8 +2777,8 @@ var Or = (e) => {
|
|
|
2740
2777
|
}
|
|
2741
2778
|
createPill() {
|
|
2742
2779
|
let e = document.createElement("div");
|
|
2743
|
-
e.setAttribute(
|
|
2744
|
-
let t =
|
|
2780
|
+
e.setAttribute(Ur, ""), e.setAttribute("contenteditable", "false"), e.className = k(qr), e.style.width = `${Kr}px`, e.style.height = `${Gr}px`, e.style.pointerEvents = "auto", e.style.transform = "translate(-50%, -50%)", e.style.outline = "2px solid var(--blok-table-grip-outline, transparent)";
|
|
2781
|
+
let t = Rr("vertical");
|
|
2745
2782
|
return t.classList.remove("text-gray-400"), t.classList.add("text-white"), e.appendChild(t), e.addEventListener("mouseenter", () => {
|
|
2746
2783
|
this.pillPopover === null && this.expandPill();
|
|
2747
2784
|
}), e.addEventListener("mouseleave", () => {
|
|
@@ -2755,7 +2792,7 @@ var Or = (e) => {
|
|
|
2755
2792
|
this.expandPill();
|
|
2756
2793
|
let e = ke === "Meta" ? "⌘C" : "Ctrl+C", t = [];
|
|
2757
2794
|
if (this.onColorChange !== void 0) {
|
|
2758
|
-
let { element: e } =
|
|
2795
|
+
let { element: e } = kr({
|
|
2759
2796
|
i18n: this.i18n,
|
|
2760
2797
|
onColorSelect: (e, t) => {
|
|
2761
2798
|
var n;
|
|
@@ -2777,7 +2814,7 @@ var Or = (e) => {
|
|
|
2777
2814
|
}
|
|
2778
2815
|
let n = [];
|
|
2779
2816
|
if (this.onPlacementChange !== void 0) {
|
|
2780
|
-
let e = this.lastPaintedRange && this.getCellPlacement ? this.getCellPlacement(this.lastPaintedRange.minRow, this.lastPaintedRange.minCol) : void 0, { element: t } =
|
|
2817
|
+
let e = this.lastPaintedRange && this.getCellPlacement ? this.getCellPlacement(this.lastPaintedRange.minRow, this.lastPaintedRange.minCol) : void 0, { element: t } = Pr({
|
|
2781
2818
|
i18n: this.i18n,
|
|
2782
2819
|
currentPlacement: e,
|
|
2783
2820
|
onPlacementSelect: (e) => {
|
|
@@ -2802,7 +2839,7 @@ var Or = (e) => {
|
|
|
2802
2839
|
if (this.lastPaintedRange && this.onMergeCells) {
|
|
2803
2840
|
var i;
|
|
2804
2841
|
let e = this.lastPaintedRange;
|
|
2805
|
-
(e.minRow !== e.maxRow || e.minCol !== e.maxCol) && (i = this.canMergeCells) != null && i.call(this, e) && r.push({
|
|
2842
|
+
(e.minRow !== e.maxRow || e.minCol !== e.maxCol) && !this.preExpansionWasSingleCell && (i = this.canMergeCells) != null && i.call(this, e) && r.push({
|
|
2806
2843
|
icon: Ke,
|
|
2807
2844
|
title: this.i18n.t("tools.table.mergeCells"),
|
|
2808
2845
|
closeOnActivate: !0,
|
|
@@ -2813,9 +2850,9 @@ var Or = (e) => {
|
|
|
2813
2850
|
});
|
|
2814
2851
|
}
|
|
2815
2852
|
if (this.lastPaintedRange && this.onSplitCell) {
|
|
2816
|
-
var a;
|
|
2817
|
-
let e = this.lastPaintedRange;
|
|
2818
|
-
|
|
2853
|
+
var a, o;
|
|
2854
|
+
let e = this.lastPaintedRange, t = e.minRow === e.maxRow && e.minCol === e.maxCol, n = this.preExpansionWasSingleCell && ((a = this.isMergedCell) == null ? void 0 : a.call(this, e.minRow, e.minCol));
|
|
2855
|
+
(t || n) && (o = this.isMergedCell) != null && o.call(this, e.minRow, e.minCol) && r.push({
|
|
2819
2856
|
icon: ue,
|
|
2820
2857
|
title: this.i18n.t("tools.table.splitCell"),
|
|
2821
2858
|
closeOnActivate: !0,
|
|
@@ -2859,13 +2896,13 @@ var Or = (e) => {
|
|
|
2859
2896
|
}
|
|
2860
2897
|
expandPill() {
|
|
2861
2898
|
if (!this.pill) return;
|
|
2862
|
-
this.pill.style.width = `${
|
|
2899
|
+
this.pill.style.width = `${Wr}px`;
|
|
2863
2900
|
let e = this.pill.querySelector("svg");
|
|
2864
2901
|
e && (e.classList.remove("opacity-0"), e.classList.add("opacity-100"));
|
|
2865
2902
|
}
|
|
2866
2903
|
collapsePill() {
|
|
2867
2904
|
if (!this.pill) return;
|
|
2868
|
-
this.pill.style.width = `${
|
|
2905
|
+
this.pill.style.width = `${Kr}px`;
|
|
2869
2906
|
let e = this.pill.querySelector("svg");
|
|
2870
2907
|
e && (e.classList.add("opacity-0"), e.classList.remove("opacity-100"));
|
|
2871
2908
|
}
|
|
@@ -2880,12 +2917,20 @@ var Or = (e) => {
|
|
|
2880
2917
|
if (!t) return null;
|
|
2881
2918
|
let n = t.closest(`[${M}]`);
|
|
2882
2919
|
if (!n || !this.grid.contains(n)) return null;
|
|
2883
|
-
let r =
|
|
2884
|
-
if (r
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2920
|
+
let r = t.getAttribute(P), i = t.getAttribute(F);
|
|
2921
|
+
if (r !== null && i !== null) {
|
|
2922
|
+
let e = parseInt(r, 10), t = parseInt(i, 10);
|
|
2923
|
+
if (!isNaN(e) && !isNaN(t)) return {
|
|
2924
|
+
row: e,
|
|
2925
|
+
col: t
|
|
2926
|
+
};
|
|
2927
|
+
}
|
|
2928
|
+
let a = Array.from(this.grid.querySelectorAll(`[${M}]`)).indexOf(n);
|
|
2929
|
+
if (a < 0) return null;
|
|
2930
|
+
let o = Array.from(n.querySelectorAll(`[${N}]`)).indexOf(t);
|
|
2931
|
+
return o < 0 ? null : {
|
|
2932
|
+
row: a,
|
|
2933
|
+
col: o
|
|
2889
2934
|
};
|
|
2890
2935
|
}
|
|
2891
2936
|
clampExtentToEdge(e) {
|
|
@@ -2913,8 +2958,11 @@ var Or = (e) => {
|
|
|
2913
2958
|
});
|
|
2914
2959
|
}
|
|
2915
2960
|
findCellByCoordOrIndex(e, t, n) {
|
|
2916
|
-
var r;
|
|
2917
|
-
return this.grid.querySelector(`[${P}="${t}"][${F}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${N}]`)[n])
|
|
2961
|
+
var r, i, a;
|
|
2962
|
+
return this.grid.querySelector(`[${P}="${t}"][${F}="${n}"]`) || ((r = e[t]) == null ? void 0 : r.querySelectorAll(`[${N}]`)[n]) || Array.from((i = (a = e[t]) == null ? void 0 : a.querySelectorAll("[data-blok-table-cell]")) == null ? [] : i).find((e) => {
|
|
2963
|
+
let t = Number(e.getAttribute(F)), r = e.colSpan || 1;
|
|
2964
|
+
return t <= n && t + r - 1 >= n;
|
|
2965
|
+
});
|
|
2918
2966
|
}
|
|
2919
2967
|
getLogicalColumnCount() {
|
|
2920
2968
|
var e, t;
|
|
@@ -2926,7 +2974,7 @@ var Or = (e) => {
|
|
|
2926
2974
|
clampAxis(e, t, n, r, i) {
|
|
2927
2975
|
return e < t ? 0 : e > n ? r - 1 : i;
|
|
2928
2976
|
}
|
|
2929
|
-
},
|
|
2977
|
+
}, R = (e) => {
|
|
2930
2978
|
let t = e.querySelector("colgroup");
|
|
2931
2979
|
if (!t) return [];
|
|
2932
2980
|
let n = t.querySelectorAll("col"), r = n[0];
|
|
@@ -2935,7 +2983,7 @@ var Or = (e) => {
|
|
|
2935
2983
|
if (t) return Array.from(t.querySelectorAll(`[${N}]`)).map((e) => Math.round(e.getBoundingClientRect().width));
|
|
2936
2984
|
}
|
|
2937
2985
|
return Array.from(n).map((e) => parseFloat(e.style.width) || 0);
|
|
2938
|
-
},
|
|
2986
|
+
}, z = (e, t) => {
|
|
2939
2987
|
let n = t.reduce((e, t) => e + t, 0), r = e;
|
|
2940
2988
|
r.style.width = `${n + 1}px`;
|
|
2941
2989
|
let i = e.querySelector("colgroup");
|
|
@@ -2944,28 +2992,28 @@ var Or = (e) => {
|
|
|
2944
2992
|
t.forEach((e, t) => {
|
|
2945
2993
|
t < a.length && (a[t].style.width = `${e}px`);
|
|
2946
2994
|
});
|
|
2947
|
-
},
|
|
2995
|
+
}, Xr = (e, t) => {
|
|
2948
2996
|
let n = Array.from(e.querySelectorAll(`[${M}]`)), r = n.findIndex((e) => Array.from(e.querySelectorAll(`[${N}]`)).includes(t));
|
|
2949
2997
|
return r === -1 ? null : {
|
|
2950
2998
|
row: r,
|
|
2951
2999
|
col: Array.from(n[r].querySelectorAll(`[${N}]`)).indexOf(t)
|
|
2952
3000
|
};
|
|
2953
|
-
},
|
|
3001
|
+
}, Zr = (e) => {
|
|
2954
3002
|
var t;
|
|
2955
|
-
let n = e.querySelector(`[${
|
|
3003
|
+
let n = e.querySelector(`[${L}]`);
|
|
2956
3004
|
return n ? ((t = n.textContent) == null ? "" : t).trim().length === 0 : !0;
|
|
2957
|
-
},
|
|
3005
|
+
}, Qr = (e, t) => {
|
|
2958
3006
|
let n = e.querySelectorAll(`[${M}]`)[t];
|
|
2959
3007
|
if (!n) return !0;
|
|
2960
3008
|
let r = n.querySelectorAll(`[${N}]`);
|
|
2961
|
-
return Array.from(r).every((e) =>
|
|
2962
|
-
},
|
|
3009
|
+
return Array.from(r).every((e) => Zr(e));
|
|
3010
|
+
}, $r = (e, t) => {
|
|
2963
3011
|
let n = e.querySelectorAll(`[${M}]`);
|
|
2964
3012
|
return Array.from(n).every((e) => {
|
|
2965
3013
|
let n = e.querySelector(`[${F}="${t}"]`);
|
|
2966
|
-
return !n ||
|
|
3014
|
+
return !n || Zr(n);
|
|
2967
3015
|
});
|
|
2968
|
-
},
|
|
3016
|
+
}, ei = (e) => {
|
|
2969
3017
|
let t = e.querySelector("colgroup");
|
|
2970
3018
|
if (!t) return;
|
|
2971
3019
|
let n = t.querySelectorAll("col"), r = Array.from(n).reduce((e, t) => e + (parseFloat(t.style.width) || 0), 0);
|
|
@@ -2975,25 +3023,25 @@ var Or = (e) => {
|
|
|
2975
3023
|
let t = e, n = parseFloat(t.style.width) || 0;
|
|
2976
3024
|
t.style.width = `${Math.round(n * i * 100) / 100}%`;
|
|
2977
3025
|
});
|
|
2978
|
-
},
|
|
3026
|
+
}, ti = (e, t, n) => {
|
|
2979
3027
|
if (!e) return e;
|
|
2980
3028
|
let r = [...e], [i] = r.splice(t, 1);
|
|
2981
3029
|
return r.splice(n, 0, i), r;
|
|
2982
|
-
},
|
|
3030
|
+
}, ni = (e, t) => {
|
|
2983
3031
|
if (!e) return e;
|
|
2984
3032
|
let n = [...e];
|
|
2985
3033
|
return n.splice(t, 1), n.length > 0 ? n : void 0;
|
|
2986
|
-
},
|
|
2987
|
-
let a = n == null ?
|
|
3034
|
+
}, ri = (e, t, n, r, i) => {
|
|
3035
|
+
let a = n == null ? R(e) : n, o = r === void 0 ? B(a) : Math.round(r / 2 * 100) / 100;
|
|
2988
3036
|
i.addColumn(e, t, a, o);
|
|
2989
3037
|
let s = [...a];
|
|
2990
3038
|
return s.splice(t, 0, o), s;
|
|
2991
|
-
},
|
|
3039
|
+
}, B = (e) => Math.round(e.reduce((e, t) => e + t, 0) / e.length / 2 * 100) / 100, ii = (e) => e.length === 0 ? 0 : Math.round(e.reduce((e, t) => e + t, 0) / e.length * 100) / 100, ai = (e, t, n) => {
|
|
2992
3040
|
var r;
|
|
2993
3041
|
if (!e) return [];
|
|
2994
3042
|
let i = e.querySelectorAll(`[${M}]`)[n];
|
|
2995
3043
|
return i ? (r = t == null ? void 0 : t.getBlockIdsFromCells(i.querySelectorAll("[data-blok-table-cell]"))) == null ? [] : r : [];
|
|
2996
|
-
},
|
|
3044
|
+
}, oi = (e, t, n) => {
|
|
2997
3045
|
var r;
|
|
2998
3046
|
if (!e) return [];
|
|
2999
3047
|
let i = e.querySelectorAll(`[${M}]`), a = [];
|
|
@@ -3001,11 +3049,11 @@ var Or = (e) => {
|
|
|
3001
3049
|
let t = e.querySelector(`[${F}="${n}"]`);
|
|
3002
3050
|
t && a.push(t);
|
|
3003
3051
|
}), (r = t == null ? void 0 : t.getBlockIdsFromCells(a)) == null ? [] : r;
|
|
3004
|
-
},
|
|
3052
|
+
}, V = (e, t) => {
|
|
3005
3053
|
e.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
3006
3054
|
t == null || t.ensureCellHasBlock(e);
|
|
3007
3055
|
});
|
|
3008
|
-
},
|
|
3056
|
+
}, si = (e, t, n, r) => {
|
|
3009
3057
|
let i = e.querySelectorAll(`[${M}]`);
|
|
3010
3058
|
t.forEach((e, t) => {
|
|
3011
3059
|
let a = i[t];
|
|
@@ -3013,11 +3061,11 @@ var Or = (e) => {
|
|
|
3013
3061
|
var i;
|
|
3014
3062
|
let o = a.querySelector(`[${F}="${t}"]`);
|
|
3015
3063
|
if (!o) return;
|
|
3016
|
-
let s = o.querySelector(`[${
|
|
3064
|
+
let s = o.querySelector(`[${L}]`);
|
|
3017
3065
|
if (!s) return;
|
|
3018
3066
|
let c = s.querySelectorAll("[data-blok-id]").length > 0;
|
|
3019
|
-
if (!(!
|
|
3020
|
-
if (!
|
|
3067
|
+
if (!(!I(e) && c)) {
|
|
3068
|
+
if (!I(e)) {
|
|
3021
3069
|
let t = document.createElement("div");
|
|
3022
3070
|
t.className = "leading-[1.5]", t.innerHTML = e, s.replaceChildren(t);
|
|
3023
3071
|
return;
|
|
@@ -3043,7 +3091,7 @@ var Or = (e) => {
|
|
|
3043
3091
|
}
|
|
3044
3092
|
});
|
|
3045
3093
|
});
|
|
3046
|
-
},
|
|
3094
|
+
}, ci = (e, t) => {
|
|
3047
3095
|
var n, r, i, a, o, s, c;
|
|
3048
3096
|
if (!(typeof e == "object" && e && "content" in e)) {
|
|
3049
3097
|
var l, u;
|
|
@@ -3063,50 +3111,50 @@ var Or = (e) => {
|
|
|
3063
3111
|
colWidths: m,
|
|
3064
3112
|
initialColWidth: d.initialColWidth
|
|
3065
3113
|
};
|
|
3066
|
-
},
|
|
3114
|
+
}, li = (e, t) => {
|
|
3067
3115
|
let n = (n) => {
|
|
3068
3116
|
let r = n.target.closest(`[${N}]`);
|
|
3069
3117
|
if (!r) return;
|
|
3070
|
-
let i =
|
|
3118
|
+
let i = Xr(e, r);
|
|
3071
3119
|
i && (t == null || t.handleKeyDown(n, i));
|
|
3072
3120
|
};
|
|
3073
3121
|
return e.addEventListener("keydown", n), () => {
|
|
3074
3122
|
e.removeEventListener("keydown", n);
|
|
3075
3123
|
};
|
|
3076
|
-
},
|
|
3077
|
-
e == null || e.classList.add(...
|
|
3078
|
-
},
|
|
3124
|
+
}, ui = ["overflow-x-auto", "overflow-y-hidden"], di = (e) => {
|
|
3125
|
+
e == null || e.classList.add(...ui);
|
|
3126
|
+
}, H = (e, t) => {
|
|
3079
3127
|
if (!e) return;
|
|
3080
3128
|
let n = e.querySelectorAll(`[${M}]`);
|
|
3081
3129
|
n.forEach((e) => {
|
|
3082
3130
|
e.removeAttribute("data-blok-table-heading");
|
|
3083
3131
|
}), t && n.length > 0 && n[0].setAttribute("data-blok-table-heading", "");
|
|
3084
|
-
},
|
|
3132
|
+
}, fi = (e, t) => {
|
|
3085
3133
|
let n = e.querySelectorAll(`[${M}]`);
|
|
3086
3134
|
t.forEach((e, t) => {
|
|
3087
3135
|
t >= n.length || e.forEach((e, r) => {
|
|
3088
3136
|
let i = n[t].querySelector(`[${F}="${r}"]`);
|
|
3089
|
-
i && (
|
|
3137
|
+
i && (I(e) && e.color ? i.style.backgroundColor = e.color : i.style.backgroundColor = "", I(e) && e.textColor ? i.style.color = e.textColor : i.style.color = "");
|
|
3090
3138
|
});
|
|
3091
3139
|
});
|
|
3092
|
-
},
|
|
3140
|
+
}, pi = (e, t) => {
|
|
3093
3141
|
let n = e.querySelectorAll(`[${M}]`);
|
|
3094
3142
|
t.forEach((e, t) => {
|
|
3095
3143
|
t >= n.length || e.forEach((e, r) => {
|
|
3096
3144
|
let i = n[t].querySelector(`[${F}="${r}"]`);
|
|
3097
3145
|
if (!i) return;
|
|
3098
|
-
let a = i.querySelector(`[${
|
|
3099
|
-
a && (
|
|
3146
|
+
let a = i.querySelector(`[${L}]`);
|
|
3147
|
+
a && (I(e) && e.placement && e.placement !== "top-left" ? a.setAttribute("data-blok-cell-placement", e.placement) : a.removeAttribute("data-blok-cell-placement"));
|
|
3100
3148
|
});
|
|
3101
3149
|
});
|
|
3102
|
-
},
|
|
3150
|
+
}, U = (e, t) => {
|
|
3103
3151
|
e && (e.querySelectorAll(`[${N}]`).forEach((e) => {
|
|
3104
3152
|
e.removeAttribute("data-blok-table-heading-col");
|
|
3105
3153
|
}), t && e.querySelectorAll(`[${M}]`).forEach((e) => {
|
|
3106
3154
|
let t = e.querySelector(`[${N}]`);
|
|
3107
3155
|
t && t.setAttribute("data-blok-table-heading-col", "");
|
|
3108
3156
|
}));
|
|
3109
|
-
},
|
|
3157
|
+
}, mi = (e) => !!(/^#[0-9a-f]{3,4}$/i.test(e) || /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(e) || /^rgba?\(\s*[\d.]+\s*,\s*[\d.]+\s*,\s*[\d.]+\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || /^hsla?\(\s*[\d.]+\s*,\s*[\d.]+%\s*,\s*[\d.]+%\s*(,\s*[\d.]+\s*)?\)$/i.test(e) || e === "transparent"), hi = class {
|
|
3110
3158
|
constructor(e) {
|
|
3111
3159
|
var t, n, r;
|
|
3112
3160
|
this.withHeadingsValue = (t = e == null ? void 0 : e.withHeadings) == null ? !1 : t, this.withHeadingColumnValue = (n = e == null ? void 0 : e.withHeadingColumn) == null ? !1 : n, this.stretchedValue = (r = e == null ? void 0 : e.stretched) == null ? !1 : r, this.colWidthsValue = e != null && e.colWidths ? [...e.colWidths] : void 0, this.initialColWidthValue = e == null ? void 0 : e.initialColWidth, this.contentGrid = this.normalizeContent(e == null ? void 0 : e.content), this.blockCellMap = /* @__PURE__ */ new Map(), this.rebuildBlockCellMap();
|
|
@@ -3149,7 +3197,7 @@ var Or = (e) => {
|
|
|
3149
3197
|
return (t = this.blockCellMap.get(e)) == null ? null : t;
|
|
3150
3198
|
}
|
|
3151
3199
|
addBlockToCell(e, t, n) {
|
|
3152
|
-
if (!this.isInBounds(e, t)) return;
|
|
3200
|
+
if (!this.isInBounds(e, t) || this.isSpannedCell(e, t)) return;
|
|
3153
3201
|
let r = this.blockCellMap.get(n);
|
|
3154
3202
|
if (r) {
|
|
3155
3203
|
let e = this.contentGrid[r.row][r.col];
|
|
@@ -3166,7 +3214,7 @@ var Or = (e) => {
|
|
|
3166
3214
|
i !== -1 && (r.blocks.splice(i, 1), this.blockCellMap.delete(n));
|
|
3167
3215
|
}
|
|
3168
3216
|
setCellBlocks(e, t, n) {
|
|
3169
|
-
if (this.isInBounds(e, t)) {
|
|
3217
|
+
if (this.isInBounds(e, t) && !this.isSpannedCell(e, t)) {
|
|
3170
3218
|
for (let n of this.contentGrid[e][t].blocks) this.blockCellMap.delete(n);
|
|
3171
3219
|
this.contentGrid[e][t].blocks = [...n];
|
|
3172
3220
|
for (let r of n) this.blockCellMap.set(r, {
|
|
@@ -3179,13 +3227,13 @@ var Or = (e) => {
|
|
|
3179
3227
|
return this.isInBounds(e, t) ? [...this.contentGrid[e][t].blocks] : [];
|
|
3180
3228
|
}
|
|
3181
3229
|
setCellColor(e, t, n) {
|
|
3182
|
-
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].color :
|
|
3230
|
+
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].color : mi(n) && (this.contentGrid[e][t].color = n));
|
|
3183
3231
|
}
|
|
3184
3232
|
getCellColor(e, t) {
|
|
3185
3233
|
if (this.isInBounds(e, t)) return this.contentGrid[e][t].color;
|
|
3186
3234
|
}
|
|
3187
3235
|
setCellTextColor(e, t, n) {
|
|
3188
|
-
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].textColor :
|
|
3236
|
+
this.isInBounds(e, t) && (n === void 0 ? delete this.contentGrid[e][t].textColor : mi(n) && (this.contentGrid[e][t].textColor = n));
|
|
3189
3237
|
}
|
|
3190
3238
|
getCellTextColor(e, t) {
|
|
3191
3239
|
if (this.isInBounds(e, t)) return this.contentGrid[e][t].textColor;
|
|
@@ -3633,9 +3681,9 @@ var Or = (e) => {
|
|
|
3633
3681
|
return !e || !Array.isArray(e) ? [] : e.map((e) => (e == null ? [] : e).map((e) => this.normalizeCell(e)));
|
|
3634
3682
|
}
|
|
3635
3683
|
normalizeCell(e) {
|
|
3636
|
-
if (
|
|
3684
|
+
if (I(e)) {
|
|
3637
3685
|
let t = { blocks: [...e.blocks] };
|
|
3638
|
-
return e.color !== void 0 &&
|
|
3686
|
+
return e.color !== void 0 && mi(e.color) && (t.color = e.color), e.textColor !== void 0 && mi(e.textColor) && (t.textColor = e.textColor), e.placement !== void 0 && (t.placement = e.placement), e.colspan !== void 0 && e.colspan > 1 && (t.colspan = e.colspan), e.rowspan !== void 0 && e.rowspan > 1 && (t.rowspan = e.rowspan), e.mergedInto !== void 0 && (t.mergedInto = [...e.mergedInto]), t;
|
|
3639
3687
|
}
|
|
3640
3688
|
return { blocks: [] };
|
|
3641
3689
|
}
|
|
@@ -3668,7 +3716,7 @@ var Or = (e) => {
|
|
|
3668
3716
|
for (let n of this.contentGrid) e < n.length && t.push(...n[e].blocks);
|
|
3669
3717
|
return t;
|
|
3670
3718
|
}
|
|
3671
|
-
},
|
|
3719
|
+
}, gi = "data-blok-table-resize", _i = 50, vi = 16, yi = class {
|
|
3672
3720
|
get enabled() {
|
|
3673
3721
|
return this._enabled;
|
|
3674
3722
|
}
|
|
@@ -3695,7 +3743,7 @@ var Or = (e) => {
|
|
|
3695
3743
|
}
|
|
3696
3744
|
createHandle(e) {
|
|
3697
3745
|
let t = document.createElement("div"), n = this.getHandleLeftPx(e);
|
|
3698
|
-
return t.setAttribute(
|
|
3746
|
+
return t.setAttribute(gi, ""), t.setAttribute("data-col", String(e)), t.style.position = "absolute", t.style.top = "-1px", t.style.bottom = "0px", t.style.width = `${vi}px`, t.style.left = `${n - vi / 2}px`, t.style.cursor = "col-resize", t.style.zIndex = "2", t.style.background = "linear-gradient(to right, transparent 7px, #3b82f6 7px, #3b82f6 9px, transparent 9px)", t.style.opacity = "0", t.style.transition = "opacity 150ms ease", t.setAttribute("contenteditable", "false"), t.addEventListener("mouseenter", () => {
|
|
3699
3747
|
this.isDragging || (t.style.opacity = "1");
|
|
3700
3748
|
}), t.addEventListener("mouseleave", () => {
|
|
3701
3749
|
this.isDragging || (t.style.opacity = "0");
|
|
@@ -3707,14 +3755,14 @@ var Or = (e) => {
|
|
|
3707
3755
|
updateHandlePositions() {
|
|
3708
3756
|
this.handles.forEach((e, t) => {
|
|
3709
3757
|
let n = this.getHandleLeftPx(t), r = e;
|
|
3710
|
-
r.style.left = `${n -
|
|
3758
|
+
r.style.left = `${n - vi / 2}px`;
|
|
3711
3759
|
});
|
|
3712
3760
|
}
|
|
3713
3761
|
onPointerDown(e) {
|
|
3714
3762
|
var t;
|
|
3715
3763
|
if (!this._enabled) return;
|
|
3716
3764
|
let n = e.target;
|
|
3717
|
-
if (!n.hasAttribute(
|
|
3765
|
+
if (!n.hasAttribute(gi)) return;
|
|
3718
3766
|
e.preventDefault(), this.needsInitialApply && (this.applyWidths(), this.updateHandlePositions(), this.needsInitialApply = !1);
|
|
3719
3767
|
let r = n.getAttribute("data-col");
|
|
3720
3768
|
r !== null && (this.dragColIndex = Number(r), this.isDragging = !0, this.dragStartX = e.clientX, this.startColWidth = this.colWidths[this.dragColIndex], this.dragColElements = this.resolveColElements(), (t = this.onDragStart) == null || t.call(this), this.gridEl.style.userSelect = "none", n.style.opacity = "1", n.setPointerCapture && n.setPointerCapture(e.pointerId), document.addEventListener("pointermove", this.boundPointerMove), document.addEventListener("pointerup", this.boundPointerUp));
|
|
@@ -3722,7 +3770,7 @@ var Or = (e) => {
|
|
|
3722
3770
|
onPointerMove(e) {
|
|
3723
3771
|
var t, n;
|
|
3724
3772
|
if (!this.isDragging) return;
|
|
3725
|
-
let r = e.clientX - this.dragStartX, i = this.startColWidth + r, a = Math.max(
|
|
3773
|
+
let r = e.clientX - this.dragStartX, i = this.startColWidth + r, a = Math.max(_i, i);
|
|
3726
3774
|
this.colWidths[this.dragColIndex] = a, this.applyWidths((t = this.dragColElements) == null ? void 0 : t), this.updateHandlePositions(), (n = this.onDrag) == null || n.call(this);
|
|
3727
3775
|
}
|
|
3728
3776
|
onPointerUp() {
|
|
@@ -3744,7 +3792,7 @@ var Or = (e) => {
|
|
|
3744
3792
|
}
|
|
3745
3793
|
});
|
|
3746
3794
|
}
|
|
3747
|
-
},
|
|
3795
|
+
}, bi = (e, t, n) => (n.grid.addRow(e, t), V(e, n.cellBlocks), {
|
|
3748
3796
|
pendingHighlight: {
|
|
3749
3797
|
type: "row",
|
|
3750
3798
|
index: t
|
|
@@ -3753,9 +3801,9 @@ var Or = (e) => {
|
|
|
3753
3801
|
colWidths: n.data.colWidths,
|
|
3754
3802
|
withHeadings: n.data.withHeadings,
|
|
3755
3803
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3756
|
-
}),
|
|
3757
|
-
let r =
|
|
3758
|
-
return
|
|
3804
|
+
}), xi = (e, t, n) => {
|
|
3805
|
+
let r = ri(e, t, n.data.colWidths, n.data.initialColWidth, n.grid);
|
|
3806
|
+
return V(e, n.cellBlocks), {
|
|
3759
3807
|
pendingHighlight: {
|
|
3760
3808
|
type: "col",
|
|
3761
3809
|
index: t
|
|
@@ -3765,7 +3813,7 @@ var Or = (e) => {
|
|
|
3765
3813
|
withHeadings: n.data.withHeadings,
|
|
3766
3814
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3767
3815
|
};
|
|
3768
|
-
},
|
|
3816
|
+
}, Si = (e, t, n, r) => (r.grid.moveRow(e, t, n), {
|
|
3769
3817
|
pendingHighlight: null,
|
|
3770
3818
|
moveSelection: {
|
|
3771
3819
|
type: "row",
|
|
@@ -3774,16 +3822,16 @@ var Or = (e) => {
|
|
|
3774
3822
|
colWidths: r.data.colWidths,
|
|
3775
3823
|
withHeadings: r.data.withHeadings,
|
|
3776
3824
|
withHeadingColumn: r.data.withHeadingColumn
|
|
3777
|
-
}),
|
|
3825
|
+
}), Ci = (e, t, n, r) => (r.grid.moveColumn(e, t, n), {
|
|
3778
3826
|
pendingHighlight: null,
|
|
3779
3827
|
moveSelection: {
|
|
3780
3828
|
type: "col",
|
|
3781
3829
|
index: n
|
|
3782
3830
|
},
|
|
3783
|
-
colWidths:
|
|
3831
|
+
colWidths: ti(r.data.colWidths, t, n),
|
|
3784
3832
|
withHeadings: r.data.withHeadings,
|
|
3785
3833
|
withHeadingColumn: r.data.withHeadingColumn
|
|
3786
|
-
}),
|
|
3834
|
+
}), wi = (e, t, n) => {
|
|
3787
3835
|
var r, i;
|
|
3788
3836
|
return (r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteRow(e, t), {
|
|
3789
3837
|
pendingHighlight: {
|
|
@@ -3795,11 +3843,11 @@ var Or = (e) => {
|
|
|
3795
3843
|
withHeadings: n.data.withHeadings,
|
|
3796
3844
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3797
3845
|
};
|
|
3798
|
-
},
|
|
3846
|
+
}, Ti = (e, t, n) => {
|
|
3799
3847
|
var r, i;
|
|
3800
3848
|
(r = n.cellBlocks) == null || r.deleteBlocks((i = n.blocksToDelete) == null ? [] : i), n.grid.deleteColumn(e, t);
|
|
3801
|
-
let a =
|
|
3802
|
-
return a ?
|
|
3849
|
+
let a = ni(n.data.colWidths, t);
|
|
3850
|
+
return a ? z(e, a) : ei(e), {
|
|
3803
3851
|
pendingHighlight: {
|
|
3804
3852
|
type: "col",
|
|
3805
3853
|
index: t < n.grid.getColumnCount(e) ? t : t - 1
|
|
@@ -3809,16 +3857,16 @@ var Or = (e) => {
|
|
|
3809
3857
|
withHeadings: n.data.withHeadings,
|
|
3810
3858
|
withHeadingColumn: n.data.withHeadingColumn
|
|
3811
3859
|
};
|
|
3812
|
-
},
|
|
3860
|
+
}, Ei = (e, t, n) => {
|
|
3813
3861
|
switch (t.type) {
|
|
3814
|
-
case "insert-row-above": return
|
|
3815
|
-
case "insert-row-below": return
|
|
3816
|
-
case "insert-col-left": return
|
|
3817
|
-
case "insert-col-right": return
|
|
3818
|
-
case "move-row": return
|
|
3819
|
-
case "move-col": return
|
|
3820
|
-
case "delete-row": return
|
|
3821
|
-
case "delete-col": return
|
|
3862
|
+
case "insert-row-above": return bi(e, t.index, n);
|
|
3863
|
+
case "insert-row-below": return bi(e, t.index + 1, n);
|
|
3864
|
+
case "insert-col-left": return xi(e, t.index, n);
|
|
3865
|
+
case "insert-col-right": return xi(e, t.index + 1, n);
|
|
3866
|
+
case "move-row": return Si(e, t.fromIndex, t.toIndex, n);
|
|
3867
|
+
case "move-col": return Ci(e, t.fromIndex, t.toIndex, n);
|
|
3868
|
+
case "delete-row": return wi(e, t.index, n);
|
|
3869
|
+
case "delete-col": return Ti(e, t.index, n);
|
|
3822
3870
|
case "toggle-heading": return {
|
|
3823
3871
|
pendingHighlight: {
|
|
3824
3872
|
type: "row",
|
|
@@ -3840,7 +3888,7 @@ var Or = (e) => {
|
|
|
3840
3888
|
withHeadingColumn: !n.data.withHeadingColumn
|
|
3841
3889
|
};
|
|
3842
3890
|
}
|
|
3843
|
-
},
|
|
3891
|
+
}, Di = 10, Oi = "data-blok-table-drag-ghost", ki = (e) => {
|
|
3844
3892
|
let t = e.querySelector("colgroup");
|
|
3845
3893
|
if (t) return Array.from(t.querySelectorAll("col")).reduce((e, t) => {
|
|
3846
3894
|
let n = e[e.length - 1], r = t.offsetWidth || parseFloat(t.style.width) || 0;
|
|
@@ -3851,7 +3899,7 @@ var Or = (e) => {
|
|
|
3851
3899
|
let n = e[e.length - 1];
|
|
3852
3900
|
return [...e, n + t.offsetWidth];
|
|
3853
3901
|
}, [0]) : [0];
|
|
3854
|
-
},
|
|
3902
|
+
}, Ai = class {
|
|
3855
3903
|
constructor(e) {
|
|
3856
3904
|
var t;
|
|
3857
3905
|
this.isDragging = !1, this.dragType = null, this.dragFromIndex = -1, this.dragStartX = 0, this.dragStartY = 0, this.dropIndicator = null, this.dragOverlayCells = [], this.ghostEl = null, this.ghostOffsetX = 0, this.ghostOffsetY = 0, this.resolveTracking = null, this.grid = e.grid, this.onAction = e.onAction, this.onDragStateChange = (t = e.onDragStateChange) == null ? null : t, this.boundDocPointerMove = this.handleDocPointerMove.bind(this), this.boundDocPointerUp = this.handleDocPointerUp.bind(this), this.boundDocPointerCancel = this.handleDocPointerCancel.bind(this);
|
|
@@ -3870,7 +3918,7 @@ var Or = (e) => {
|
|
|
3870
3918
|
}
|
|
3871
3919
|
handleDocPointerMove(e) {
|
|
3872
3920
|
let t = Math.abs(e.clientX - this.dragStartX), n = Math.abs(e.clientY - this.dragStartY);
|
|
3873
|
-
!this.isDragging && (t >
|
|
3921
|
+
!this.isDragging && (t > Di || n > Di) && (this.isDragging = !0, this.startDrag()), this.isDragging && (this.updateDragIndicator(e), this.updateGhostPosition(e));
|
|
3874
3922
|
}
|
|
3875
3923
|
handleDocPointerUp(e) {
|
|
3876
3924
|
if (document.removeEventListener("pointermove", this.boundDocPointerMove), document.removeEventListener("pointerup", this.boundDocPointerUp), document.removeEventListener("pointercancel", this.boundDocPointerCancel), this.isDragging) {
|
|
@@ -3949,7 +3997,7 @@ var Or = (e) => {
|
|
|
3949
3997
|
updateColIndicator(e, t) {
|
|
3950
3998
|
var n;
|
|
3951
3999
|
if (!this.dropIndicator) return;
|
|
3952
|
-
let r = e.clientX - t.left, i = this.getColDropIndex(r), a =
|
|
4000
|
+
let r = e.clientX - t.left, i = this.getColDropIndex(r), a = ki(this.grid);
|
|
3953
4001
|
this.dropIndicator.style.left = `${((n = a[i]) == null ? 0 : n) - 1.5}px`;
|
|
3954
4002
|
}
|
|
3955
4003
|
finishDrag(e) {
|
|
@@ -3978,7 +4026,7 @@ var Or = (e) => {
|
|
|
3978
4026
|
}
|
|
3979
4027
|
createGhost() {
|
|
3980
4028
|
let e = document.createElement("div");
|
|
3981
|
-
e.setAttribute(
|
|
4029
|
+
e.setAttribute(Oi, ""), e.setAttribute("contenteditable", "false");
|
|
3982
4030
|
let t = e.style;
|
|
3983
4031
|
t.position = "fixed", t.pointerEvents = "none", t.opacity = "0.5", t.zIndex = "50", t.borderRadius = "4px", t.overflow = "hidden", t.boxShadow = this.isDarkMode() ? "0 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08)" : "0 4px 12px rgba(0, 0, 0, 0.15)", this.ghostEl = e;
|
|
3984
4032
|
let n = this.getSourceRect();
|
|
@@ -4045,10 +4093,10 @@ var Or = (e) => {
|
|
|
4045
4093
|
return 0;
|
|
4046
4094
|
}
|
|
4047
4095
|
getColDropIndex(e) {
|
|
4048
|
-
let t =
|
|
4096
|
+
let t = ki(this.grid).map((t) => Math.abs(e - t)), n = Math.min(...t);
|
|
4049
4097
|
return t.indexOf(n);
|
|
4050
4098
|
}
|
|
4051
|
-
},
|
|
4099
|
+
}, ji = [
|
|
4052
4100
|
"flex",
|
|
4053
4101
|
"items-center",
|
|
4054
4102
|
"select-none",
|
|
@@ -4060,7 +4108,7 @@ var Or = (e) => {
|
|
|
4060
4108
|
"mb-px",
|
|
4061
4109
|
"cursor-pointer",
|
|
4062
4110
|
"can-hover:hover:bg-item-hover-bg"
|
|
4063
|
-
],
|
|
4111
|
+
], Mi = [
|
|
4064
4112
|
"flex",
|
|
4065
4113
|
"items-center",
|
|
4066
4114
|
"justify-center",
|
|
@@ -4069,13 +4117,13 @@ var Or = (e) => {
|
|
|
4069
4117
|
"mr-2",
|
|
4070
4118
|
"[&_svg]:w-icon",
|
|
4071
4119
|
"[&_svg]:h-icon"
|
|
4072
|
-
],
|
|
4120
|
+
], Ni = [
|
|
4073
4121
|
"mr-auto",
|
|
4074
4122
|
"truncate",
|
|
4075
4123
|
"text-sm",
|
|
4076
4124
|
"font-medium",
|
|
4077
4125
|
"leading-5"
|
|
4078
|
-
],
|
|
4126
|
+
], Pi = [
|
|
4079
4127
|
"relative",
|
|
4080
4128
|
"w-[30px]",
|
|
4081
4129
|
"h-[18px]",
|
|
@@ -4085,7 +4133,7 @@ var Or = (e) => {
|
|
|
4085
4133
|
"ease-out",
|
|
4086
4134
|
"shrink-0",
|
|
4087
4135
|
"ml-2"
|
|
4088
|
-
],
|
|
4136
|
+
], Fi = [
|
|
4089
4137
|
"absolute",
|
|
4090
4138
|
"top-[2px]",
|
|
4091
4139
|
"w-[14px]",
|
|
@@ -4095,27 +4143,27 @@ var Or = (e) => {
|
|
|
4095
4143
|
"transition-[left]",
|
|
4096
4144
|
"duration-[220ms]",
|
|
4097
4145
|
"[transition-timing-function:cubic-bezier(0.34,1.56,0.64,1)]"
|
|
4098
|
-
],
|
|
4146
|
+
], Ii = (e) => {
|
|
4099
4147
|
let { icon: t, label: n, isActive: r, onToggle: i } = e, a = { active: r }, o = document.createElement("div");
|
|
4100
|
-
o.className = k(
|
|
4148
|
+
o.className = k(ji);
|
|
4101
4149
|
let s = document.createElement("div");
|
|
4102
|
-
s.className = k(
|
|
4150
|
+
s.className = k(Mi), s.innerHTML = t, o.appendChild(s);
|
|
4103
4151
|
let c = document.createElement("span");
|
|
4104
|
-
c.className = k(
|
|
4152
|
+
c.className = k(Ni), c.textContent = n, o.appendChild(c);
|
|
4105
4153
|
let l = document.createElement("div");
|
|
4106
|
-
l.className = k(
|
|
4154
|
+
l.className = k(Pi);
|
|
4107
4155
|
let u = document.createElement("div");
|
|
4108
|
-
u.className = k(
|
|
4156
|
+
u.className = k(Fi), l.appendChild(u), o.appendChild(l);
|
|
4109
4157
|
let d = () => {
|
|
4110
4158
|
l.style.backgroundColor = a.active ? "var(--blok-toggle-on-bg)" : "var(--blok-toggle-off-bg)", u.style.left = a.active ? "14px" : "2px", u.style.backgroundColor = a.active ? "var(--blok-toggle-thumb-on-bg)" : "", u.style.boxShadow = a.active ? "0 1px 3px rgba(0,0,0,0.35), 0 0 0 1px rgba(0,0,0,0.04)" : "0 1px 3px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06)";
|
|
4111
4159
|
};
|
|
4112
4160
|
return d(), o.addEventListener("click", (e) => {
|
|
4113
4161
|
e.stopPropagation(), a.active = !a.active, d(), i(a.active);
|
|
4114
4162
|
}), o;
|
|
4115
|
-
},
|
|
4163
|
+
}, Li = (e, t) => {
|
|
4116
4164
|
let n = e === 0 ? [{
|
|
4117
4165
|
type: w.Html,
|
|
4118
|
-
element:
|
|
4166
|
+
element: Ii({
|
|
4119
4167
|
icon: Me,
|
|
4120
4168
|
label: t.i18n.t("tools.table.headerColumn"),
|
|
4121
4169
|
isActive: t.isHeadingColumn(),
|
|
@@ -4161,10 +4209,10 @@ var Or = (e) => {
|
|
|
4161
4209
|
...r,
|
|
4162
4210
|
...a
|
|
4163
4211
|
];
|
|
4164
|
-
},
|
|
4212
|
+
}, Ri = (e, t) => {
|
|
4165
4213
|
let n = e === 0 ? [{
|
|
4166
4214
|
type: w.Html,
|
|
4167
|
-
element:
|
|
4215
|
+
element: Ii({
|
|
4168
4216
|
icon: ct,
|
|
4169
4217
|
label: t.i18n.t("tools.table.headerRow"),
|
|
4170
4218
|
isActive: t.isHeadingRow(),
|
|
@@ -4210,7 +4258,7 @@ var Or = (e) => {
|
|
|
4210
4258
|
...r,
|
|
4211
4259
|
...a
|
|
4212
4260
|
];
|
|
4213
|
-
},
|
|
4261
|
+
}, zi = (e, t, n, r, i) => {
|
|
4214
4262
|
i.destroyPopover(), i.clearHideTimeout();
|
|
4215
4263
|
let a = e === "col" ? n.col[t] : n.row[t];
|
|
4216
4264
|
if (!a) return {
|
|
@@ -4218,7 +4266,7 @@ var Or = (e) => {
|
|
|
4218
4266
|
grip: null
|
|
4219
4267
|
};
|
|
4220
4268
|
let o = new Fe({
|
|
4221
|
-
items: e === "col" ?
|
|
4269
|
+
items: e === "col" ? Li(t, r) : Ri(t, r),
|
|
4222
4270
|
trigger: a,
|
|
4223
4271
|
flippable: !0
|
|
4224
4272
|
});
|
|
@@ -4229,7 +4277,7 @@ var Or = (e) => {
|
|
|
4229
4277
|
popover: o,
|
|
4230
4278
|
grip: a
|
|
4231
4279
|
};
|
|
4232
|
-
},
|
|
4280
|
+
}, Bi = "data-blok-table-grip", Vi = "data-blok-table-grip-col", Hi = "data-blok-table-grip-row", Ui = 150, Wi = 24, Gi = 4, Ki = 4, qi = 20, Ji = [
|
|
4233
4281
|
"absolute",
|
|
4234
4282
|
"z-3",
|
|
4235
4283
|
"rounded-sm",
|
|
@@ -4242,25 +4290,25 @@ var Or = (e) => {
|
|
|
4242
4290
|
"items-center",
|
|
4243
4291
|
"justify-center",
|
|
4244
4292
|
"overflow-hidden"
|
|
4245
|
-
],
|
|
4293
|
+
], Yi = [
|
|
4246
4294
|
"bg-gray-300",
|
|
4247
4295
|
"opacity-0",
|
|
4248
4296
|
"pointer-events-none"
|
|
4249
|
-
],
|
|
4297
|
+
], Xi = [
|
|
4250
4298
|
"bg-gray-300",
|
|
4251
4299
|
"opacity-100",
|
|
4252
4300
|
"pointer-events-auto"
|
|
4253
|
-
],
|
|
4301
|
+
], Zi = [
|
|
4254
4302
|
"bg-blue-500",
|
|
4255
4303
|
"text-white",
|
|
4256
4304
|
"opacity-100",
|
|
4257
4305
|
"pointer-events-auto"
|
|
4258
|
-
],
|
|
4306
|
+
], Qi = class {
|
|
4259
4307
|
constructor(e) {
|
|
4260
4308
|
this.colGrips = [], this.rowGrips = [], this.popoverState = {
|
|
4261
4309
|
popover: null,
|
|
4262
4310
|
grip: null
|
|
4263
|
-
}, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1, this.rowResizeObserver = null, this.boundScrollHandler = null, this.grid = e.grid, this.overlay = e.overlay, this.scrollContainer = e.scrollContainer, this.getColumnCount = e.getColumnCount, this.getRowCount = e.getRowCount, this.isHeadingRow = e.isHeadingRow, this.isHeadingColumn = e.isHeadingColumn, this.onAction = e.onAction, this.onGripClick = e.onGripClick, this.onGripPopoverClose = e.onGripPopoverClose, this.i18n = e.i18n, this.drag = new
|
|
4311
|
+
}, this.lockedGrip = null, this.hideTimeout = null, this.activeColGripIndex = -1, this.activeRowGripIndex = -1, this.isInsideTable = !1, this.rowResizeObserver = null, this.boundScrollHandler = null, this.grid = e.grid, this.overlay = e.overlay, this.scrollContainer = e.scrollContainer, this.getColumnCount = e.getColumnCount, this.getRowCount = e.getRowCount, this.isHeadingRow = e.isHeadingRow, this.isHeadingColumn = e.isHeadingColumn, this.onAction = e.onAction, this.onGripClick = e.onGripClick, this.onGripPopoverClose = e.onGripPopoverClose, this.i18n = e.i18n, this.drag = new Ai({
|
|
4264
4312
|
grid: this.grid,
|
|
4265
4313
|
onAction: this.onAction,
|
|
4266
4314
|
onDragStateChange: (t, n) => {
|
|
@@ -4328,26 +4376,36 @@ var Or = (e) => {
|
|
|
4328
4376
|
}
|
|
4329
4377
|
createGripElement(e, t) {
|
|
4330
4378
|
let n = document.createElement("div");
|
|
4331
|
-
n.className = k(
|
|
4332
|
-
let r = e === "col" ?
|
|
4333
|
-
return n.style.width = `${r}px`, n.style.height = `${i}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid var(--blok-table-grip-outline, transparent)", n.appendChild(
|
|
4334
|
-
this.overlay && this.clearHideTimeout(), this.isGripInteractionLocked() ||
|
|
4379
|
+
n.className = k(Ji, Yi), n.setAttribute(Bi, ""), n.setAttribute(e === "col" ? Vi : Hi, String(t)), n.setAttribute("contenteditable", "false");
|
|
4380
|
+
let r = e === "col" ? Wi : Ki, i = e === "col" ? Gi : qi, a = e === "col" ? Gi : Ki;
|
|
4381
|
+
return n.style.width = `${r}px`, n.style.height = `${i}px`, n.style.transform = "translate(-50%, -50%)", n.style.outline = "2px solid var(--blok-table-grip-outline, transparent)", n.appendChild(Rr(e === "col" ? "horizontal" : "vertical")), n.addEventListener("pointerdown", this.boundPointerDown), n.addEventListener("mouseenter", () => {
|
|
4382
|
+
this.overlay && this.clearHideTimeout(), this.isGripInteractionLocked() || zr(n, e);
|
|
4335
4383
|
}), n.addEventListener("mouseleave", () => {
|
|
4336
|
-
this.isGripInteractionLocked() || (
|
|
4384
|
+
this.isGripInteractionLocked() || (Br(n, e, a), this.overlay && this.scheduleHideAll());
|
|
4337
4385
|
}), n;
|
|
4338
4386
|
}
|
|
4339
4387
|
positionGrips() {
|
|
4340
4388
|
let e = this.grid.querySelectorAll(`[${M}]`);
|
|
4341
4389
|
if (!e[0]) return;
|
|
4342
|
-
let t =
|
|
4390
|
+
let t = ki(this.grid), n = this.overlay && this.scrollContainer ? this.scrollContainer.scrollLeft : 0, r = this.overlay && this.scrollContainer ? this.scrollContainer.clientWidth : Infinity;
|
|
4343
4391
|
this.colGrips.forEach((e, i) => {
|
|
4344
4392
|
if (i + 1 >= t.length) return;
|
|
4345
4393
|
let a = (t[i] + t[i + 1]) / 2 - n, o = e.style;
|
|
4346
4394
|
o.top = `${-1 / 2}px`, o.left = `${a}px`, this.overlay && (o.visibility = a < 0 || a > r ? "hidden" : "");
|
|
4347
4395
|
}), this.rowGrips.forEach((t, n) => {
|
|
4348
4396
|
if (n >= e.length) return;
|
|
4349
|
-
let r = e[n], i =
|
|
4350
|
-
|
|
4397
|
+
let r = e[n], i = this.grid.querySelectorAll(`[${P}="${n}"]`), a = Array.from(i).reduce((e, t) => {
|
|
4398
|
+
let n = t, r = e === null ? 0 : e.rowSpan || 1;
|
|
4399
|
+
return (n.rowSpan || 1) > r ? n : e;
|
|
4400
|
+
}, null);
|
|
4401
|
+
if ((a === null ? 1 : a.rowSpan || 1) > 1 && a !== null) {
|
|
4402
|
+
var o;
|
|
4403
|
+
let e = ((o = this.overlay) == null ? this.grid : o).getBoundingClientRect(), n = a.getBoundingClientRect(), r = n.top - e.top + n.height / 2, i = t.style;
|
|
4404
|
+
i.left = `${-1 / 2}px`, i.top = `${r}px`;
|
|
4405
|
+
} else {
|
|
4406
|
+
let e = r.offsetTop + r.offsetHeight / 2, n = t.style;
|
|
4407
|
+
n.left = `${-1 / 2}px`, n.top = `${e}px`;
|
|
4408
|
+
}
|
|
4351
4409
|
});
|
|
4352
4410
|
}
|
|
4353
4411
|
observeRowHeights() {
|
|
@@ -4374,14 +4432,12 @@ var Or = (e) => {
|
|
|
4374
4432
|
this.isGripInteractionLocked() || this.scheduleHideAll();
|
|
4375
4433
|
}
|
|
4376
4434
|
getCellPosition(e) {
|
|
4377
|
-
let t = e.
|
|
4378
|
-
if (
|
|
4379
|
-
let
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
row: n,
|
|
4384
|
-
col: r
|
|
4435
|
+
let t = e.getAttribute(P), n = e.getAttribute(F);
|
|
4436
|
+
if (t === null || n === null) return null;
|
|
4437
|
+
let r = parseInt(t, 10), i = parseInt(n, 10);
|
|
4438
|
+
return isNaN(r) || isNaN(i) ? null : {
|
|
4439
|
+
row: r,
|
|
4440
|
+
col: i
|
|
4385
4441
|
};
|
|
4386
4442
|
}
|
|
4387
4443
|
setGripsDisplay(e) {
|
|
@@ -4407,13 +4463,13 @@ var Or = (e) => {
|
|
|
4407
4463
|
this.activeRowGripIndex >= 0 && this.activeRowGripIndex < this.rowGrips.length && this.applyIdleClasses(this.rowGrips[this.activeRowGripIndex]), this.activeRowGripIndex = -1;
|
|
4408
4464
|
}
|
|
4409
4465
|
applyVisibleClasses(e) {
|
|
4410
|
-
let t = e, n = t.hasAttribute(
|
|
4411
|
-
|
|
4466
|
+
let t = e, n = t.hasAttribute(Vi);
|
|
4467
|
+
Fr(t, n ? "col" : "row", n ? Gi : Ki), this.isInsideTable && (t.style.transition = "none"), t.className = k(Ji, Xi), t.setAttribute("data-blok-table-grip-visible", ""), this.isInsideTable && (t.offsetHeight, t.style.transition = "");
|
|
4412
4468
|
let r = t.querySelector("svg");
|
|
4413
4469
|
r && (r.classList.remove("text-white", "opacity-100"), r.classList.add("text-gray-400", "opacity-0"));
|
|
4414
4470
|
}
|
|
4415
4471
|
applyActiveClasses(e) {
|
|
4416
|
-
Object.assign(e, { className: k(
|
|
4472
|
+
Object.assign(e, { className: k(Ji, Zi) }), e.setAttribute("data-blok-table-grip-visible", "");
|
|
4417
4473
|
let t = e.querySelector("svg");
|
|
4418
4474
|
t && (t.classList.remove("text-gray-400", "opacity-0"), t.classList.add("text-white", "opacity-100"));
|
|
4419
4475
|
}
|
|
@@ -4423,8 +4479,8 @@ var Or = (e) => {
|
|
|
4423
4479
|
});
|
|
4424
4480
|
}
|
|
4425
4481
|
applyIdleClasses(e) {
|
|
4426
|
-
let t = e, n = t.hasAttribute(
|
|
4427
|
-
this.isInsideTable && (t.style.transition = "none"),
|
|
4482
|
+
let t = e, n = t.hasAttribute(Vi), r = n ? "col" : "row", i = n ? Gi + 12 : Ki + 12;
|
|
4483
|
+
this.isInsideTable && (t.style.transition = "none"), Fr(t, r, i), t.className = k(Ji, Yi), t.removeAttribute("data-blok-table-grip-visible");
|
|
4428
4484
|
let a = t.querySelector("svg");
|
|
4429
4485
|
a && (a.classList.add("opacity-0"), a.classList.remove("opacity-100")), this.isInsideTable && (t.offsetHeight, t.style.transition = "");
|
|
4430
4486
|
}
|
|
@@ -4437,13 +4493,13 @@ var Or = (e) => {
|
|
|
4437
4493
|
scheduleHideAll() {
|
|
4438
4494
|
this.hideTimeout = setTimeout(() => {
|
|
4439
4495
|
this.hideColGrip(), this.hideRowGrip(), this.isInsideTable = !1, this.hideTimeout = null;
|
|
4440
|
-
},
|
|
4496
|
+
}, Ui);
|
|
4441
4497
|
}
|
|
4442
4498
|
clearHideTimeout() {
|
|
4443
4499
|
this.hideTimeout !== null && (clearTimeout(this.hideTimeout), this.hideTimeout = null);
|
|
4444
4500
|
}
|
|
4445
4501
|
handlePointerDown(e) {
|
|
4446
|
-
let t = e.target.closest(`[${
|
|
4502
|
+
let t = e.target.closest(`[${Bi}]`);
|
|
4447
4503
|
if (!t) return;
|
|
4448
4504
|
e.preventDefault(), e.stopPropagation();
|
|
4449
4505
|
let n = this.detectGripType(t);
|
|
@@ -4452,12 +4508,12 @@ var Or = (e) => {
|
|
|
4452
4508
|
});
|
|
4453
4509
|
}
|
|
4454
4510
|
detectGripType(e) {
|
|
4455
|
-
let t = e.getAttribute(
|
|
4511
|
+
let t = e.getAttribute(Vi);
|
|
4456
4512
|
if (t !== null) return {
|
|
4457
4513
|
type: "col",
|
|
4458
4514
|
index: Number(t)
|
|
4459
4515
|
};
|
|
4460
|
-
let n = e.getAttribute(
|
|
4516
|
+
let n = e.getAttribute(Hi);
|
|
4461
4517
|
return n === null ? null : {
|
|
4462
4518
|
type: "row",
|
|
4463
4519
|
index: Number(n)
|
|
@@ -4465,7 +4521,7 @@ var Or = (e) => {
|
|
|
4465
4521
|
}
|
|
4466
4522
|
openPopover(e, t) {
|
|
4467
4523
|
var n, r;
|
|
4468
|
-
this.popoverState =
|
|
4524
|
+
this.popoverState = zi(e, t, {
|
|
4469
4525
|
col: this.colGrips,
|
|
4470
4526
|
row: this.rowGrips
|
|
4471
4527
|
}, {
|
|
@@ -4494,10 +4550,10 @@ var Or = (e) => {
|
|
|
4494
4550
|
}, e.destroy();
|
|
4495
4551
|
}
|
|
4496
4552
|
}
|
|
4497
|
-
},
|
|
4553
|
+
}, $i = "data-blok-table-corner-drag", ea = 5, ta = class {
|
|
4498
4554
|
constructor(e) {
|
|
4499
4555
|
var t;
|
|
4500
|
-
this.dragState = null, this.wrapper = e.wrapper, this.gridEl = e.gridEl, this.getTableSize = e.getTableSize, this.onAddRow = e.onAddRow, this.onAddColumn = e.onAddColumn, this.onRemoveLastRow = e.onRemoveLastRow, this.onRemoveLastColumn = e.onRemoveLastColumn, this.onDragStart = e.onDragStart, this.onDragEnd = e.onDragEnd, this.canRemoveLastRow = e.canRemoveLastRow, this.canRemoveLastColumn = e.canRemoveLastColumn, this.onClickAdd = (t = e.onClickAdd) == null ? null : t, this.hitZone = document.createElement("div"), this.hitZone.setAttribute(
|
|
4556
|
+
this.dragState = null, this.wrapper = e.wrapper, this.gridEl = e.gridEl, this.getTableSize = e.getTableSize, this.onAddRow = e.onAddRow, this.onAddColumn = e.onAddColumn, this.onRemoveLastRow = e.onRemoveLastRow, this.onRemoveLastColumn = e.onRemoveLastColumn, this.onDragStart = e.onDragStart, this.onDragEnd = e.onDragEnd, this.canRemoveLastRow = e.canRemoveLastRow, this.canRemoveLastColumn = e.canRemoveLastColumn, this.onClickAdd = (t = e.onClickAdd) == null ? null : t, this.hitZone = document.createElement("div"), this.hitZone.setAttribute($i, ""), this.hitZone.setAttribute("contenteditable", "false"), this.hitZone.style.position = "absolute", this.hitZone.style.width = "36px", this.hitZone.style.height = "36px", this.hitZone.style.cursor = "nwse-resize", this.hitZone.style.zIndex = "2", this.hitZone.style.pointerEvents = "auto", this.hitZone.style.bottom = "-36px", this.hitZone.style.right = "-16px", this.boundMouseEnter = this.handleMouseEnter.bind(this), this.boundMouseLeave = this.handleMouseLeave.bind(this), this.boundPointerDown = this.handlePointerDown.bind(this), this.boundPointerMove = this.handlePointerMove.bind(this), this.boundPointerUp = this.handlePointerUp.bind(this), this.hitZone.addEventListener("mouseenter", this.boundMouseEnter), this.hitZone.addEventListener("mouseleave", this.boundMouseLeave), this.hitZone.addEventListener("pointerdown", this.boundPointerDown), this.wrapper.appendChild(this.hitZone);
|
|
4501
4557
|
}
|
|
4502
4558
|
updateTooltip() {
|
|
4503
4559
|
let e = this.getTableSize();
|
|
@@ -4535,7 +4591,7 @@ var Or = (e) => {
|
|
|
4535
4591
|
if (this.dragState === null) return;
|
|
4536
4592
|
let t = e.clientX - this.dragState.startX, n = e.clientY - this.dragState.startY;
|
|
4537
4593
|
if (!this.dragState.didDrag) {
|
|
4538
|
-
if (Math.sqrt(t * t + n * n) <
|
|
4594
|
+
if (Math.sqrt(t * t + n * n) < ea) return;
|
|
4539
4595
|
this.dragState.didDrag = !0, document.body.style.cursor = "nwse-resize", document.body.style.userSelect = "none", this.onDragStart();
|
|
4540
4596
|
}
|
|
4541
4597
|
let { unitHeight: r, unitWidth: i } = this.dragState, a = Math.trunc(n / r), o = Math.trunc(t / i);
|
|
@@ -4560,7 +4616,7 @@ var Or = (e) => {
|
|
|
4560
4616
|
var e;
|
|
4561
4617
|
this.hitZone.removeEventListener("mouseenter", this.boundMouseEnter), this.hitZone.removeEventListener("mouseleave", this.boundMouseLeave), this.hitZone.removeEventListener("pointerdown", this.boundPointerDown), this.hitZone.removeEventListener("pointermove", this.boundPointerMove), this.hitZone.removeEventListener("pointerup", this.boundPointerUp), (e = this.dragState) != null && e.didDrag && (document.body.style.cursor = "", document.body.style.userSelect = ""), this.dragState = null, je(), this.hitZone.remove();
|
|
4562
4618
|
}
|
|
4563
|
-
},
|
|
4619
|
+
}, na = "data-blok-table-haze", ra = "data-blok-table-haze-visible", ia = 1, aa = [
|
|
4564
4620
|
"absolute",
|
|
4565
4621
|
"top-0",
|
|
4566
4622
|
"bottom-0",
|
|
@@ -4570,17 +4626,17 @@ var Or = (e) => {
|
|
|
4570
4626
|
"transition-opacity",
|
|
4571
4627
|
"duration-150",
|
|
4572
4628
|
"z-1"
|
|
4573
|
-
],
|
|
4629
|
+
], oa = [
|
|
4574
4630
|
"left-0",
|
|
4575
4631
|
"bg-linear-to-r",
|
|
4576
4632
|
"from-white/80",
|
|
4577
4633
|
"to-transparent"
|
|
4578
|
-
],
|
|
4634
|
+
], sa = [
|
|
4579
4635
|
"right-5",
|
|
4580
4636
|
"bg-linear-to-l",
|
|
4581
4637
|
"from-white/80",
|
|
4582
4638
|
"to-transparent"
|
|
4583
|
-
],
|
|
4639
|
+
], ca = class {
|
|
4584
4640
|
constructor() {
|
|
4585
4641
|
this.leftHaze = null, this.rightHaze = null, this.scrollContainer = null, this.boundOnScroll = null, this.ticking = !1;
|
|
4586
4642
|
}
|
|
@@ -4600,7 +4656,7 @@ var Or = (e) => {
|
|
|
4600
4656
|
}
|
|
4601
4657
|
createHazeElement(e) {
|
|
4602
4658
|
let t = document.createElement("div");
|
|
4603
|
-
return t.setAttribute(
|
|
4659
|
+
return t.setAttribute(na, e), t.setAttribute("aria-hidden", "true"), t.classList.add(...aa, ...e === "left" ? oa : sa), t;
|
|
4604
4660
|
}
|
|
4605
4661
|
syncVisibility() {
|
|
4606
4662
|
let e = this.scrollContainer;
|
|
@@ -4611,12 +4667,12 @@ var Or = (e) => {
|
|
|
4611
4667
|
return;
|
|
4612
4668
|
}
|
|
4613
4669
|
let { scrollLeft: n, scrollWidth: r, clientWidth: i } = e, a = r - i;
|
|
4614
|
-
this.setVisible(this.leftHaze, n >
|
|
4670
|
+
this.setVisible(this.leftHaze, n > ia), this.setVisible(this.rightHaze, a > ia && n < a - ia);
|
|
4615
4671
|
}
|
|
4616
4672
|
setVisible(e, t) {
|
|
4617
|
-
e && (t ? e.setAttribute(
|
|
4673
|
+
e && (t ? e.setAttribute(ra, "") : e.removeAttribute(ra));
|
|
4618
4674
|
}
|
|
4619
|
-
},
|
|
4675
|
+
}, la = 3, ua = 3, da = ["my-2", "pr-5"], fa = [
|
|
4620
4676
|
"relative",
|
|
4621
4677
|
"mb-7",
|
|
4622
4678
|
"after:content-[\"\"]",
|
|
@@ -4626,11 +4682,11 @@ var Or = (e) => {
|
|
|
4626
4682
|
"after:right-0",
|
|
4627
4683
|
"after:h-10",
|
|
4628
4684
|
"after:pointer-events-none"
|
|
4629
|
-
],
|
|
4685
|
+
], pa = class {
|
|
4630
4686
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
4631
4687
|
this.initialContent = null, this.resize = null, this.addControls = null, this.rowColControls = null, this.cellBlocks = null, this.cellSelection = null, this.cornerDrag = null, this.scrollHaze = null, this.element = null, this.gridElement = null, this.scrollContainer = null, this.gripOverlay = null, this.pendingHighlight = null, this.isNewTable = !1, this.unregisterRestrictedTools = null, this.gridPasteCleanup = null, this.keyboardNavCleanup = null, this.setDataGeneration = 0, this.structuralOpDepth = 0, this.api = n, this.readOnly = r, this.config = t == null ? {} : t;
|
|
4632
|
-
let a =
|
|
4633
|
-
this.initialContent = a.content, this.grid = new
|
|
4688
|
+
let a = ci(e, this.config);
|
|
4689
|
+
this.initialContent = a.content, this.grid = new Cr({ readOnly: r }), this.model = new hi(a), this.blockId = i == null ? void 0 : i.id, this.config.restrictedTools !== void 0 && (this.unregisterRestrictedTools = c(this.config.restrictedTools));
|
|
4634
4690
|
}
|
|
4635
4691
|
runStructuralOp(e, t = !1) {
|
|
4636
4692
|
this.structuralOpDepth++;
|
|
@@ -4682,7 +4738,7 @@ var Or = (e) => {
|
|
|
4682
4738
|
if (typeof e == "string" || e.mergedInto) return;
|
|
4683
4739
|
let o = t.querySelector(`[${P}="${i}"][${F}="${a}"]`);
|
|
4684
4740
|
if (!o) return;
|
|
4685
|
-
let s = o.querySelector(`[${
|
|
4741
|
+
let s = o.querySelector(`[${L}]`);
|
|
4686
4742
|
s && e.blocks.forEach((e) => {
|
|
4687
4743
|
let t = n.get(e);
|
|
4688
4744
|
t && !r.has(e) && (s.appendChild(t), r.add(e));
|
|
@@ -4698,10 +4754,10 @@ var Or = (e) => {
|
|
|
4698
4754
|
}
|
|
4699
4755
|
createFlatGrid() {
|
|
4700
4756
|
var e, t;
|
|
4701
|
-
let n = ((e = this.initialContent) == null ? void 0 : e.length) || this.config.rows ||
|
|
4757
|
+
let n = ((e = this.initialContent) == null ? void 0 : e.length) || this.config.rows || la, r = ((t = this.initialContent) == null ? void 0 : t.reduce((e, t) => {
|
|
4702
4758
|
var n;
|
|
4703
4759
|
return Math.max(e, (n = t == null ? void 0 : t.length) == null ? 0 : n);
|
|
4704
|
-
}, 0)) || this.config.cols ||
|
|
4760
|
+
}, 0)) || this.config.cols || ua;
|
|
4705
4761
|
return this.grid.createGrid(n, r, this.model.colWidths);
|
|
4706
4762
|
}
|
|
4707
4763
|
initSubsystems(e) {
|
|
@@ -4772,23 +4828,23 @@ var Or = (e) => {
|
|
|
4772
4828
|
render() {
|
|
4773
4829
|
var e, t, n, r;
|
|
4774
4830
|
let i = document.createElement("div");
|
|
4775
|
-
i.className = k(
|
|
4831
|
+
i.className = k(da, !this.readOnly && fa), i.setAttribute(C.tool, "table"), this.readOnly && i.setAttribute("data-blok-table-readonly", ""), this.isNewTable = ((e = (t = this.initialContent) == null ? void 0 : t.length) == null ? 0 : e) === 0;
|
|
4776
4832
|
let a = ((n = (r = this.initialContent) == null ? void 0 : r.length) == null ? 0 : n) > 0, o = a && this.modelHasMerges(), s = o ? this.grid.createGridFromModel(this.model) : this.createFlatGrid();
|
|
4777
4833
|
if (a && !o) {
|
|
4778
4834
|
var c;
|
|
4779
4835
|
this.grid.fillGrid(s, (c = this.initialContent) == null ? [] : c);
|
|
4780
4836
|
}
|
|
4781
|
-
if (this.model.colWidths &&
|
|
4837
|
+
if (this.model.colWidths && z(s, this.model.colWidths), this.gridElement = s, this.model.colWidths || !this.readOnly) {
|
|
4782
4838
|
let e = document.createElement("div");
|
|
4783
4839
|
e.setAttribute("data-blok-table-scroll", "");
|
|
4784
|
-
let t = this.model.colWidths ?
|
|
4840
|
+
let t = this.model.colWidths ? ui : [];
|
|
4785
4841
|
e.classList.add(...t), e.appendChild(s), i.appendChild(e), this.scrollContainer = e;
|
|
4786
4842
|
} else i.appendChild(s), this.scrollContainer = null;
|
|
4787
4843
|
if (!this.readOnly) {
|
|
4788
4844
|
let e = document.createElement("div");
|
|
4789
4845
|
e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", i.appendChild(e), this.gripOverlay = e;
|
|
4790
4846
|
}
|
|
4791
|
-
return this.element = i, this.model.withHeadings &&
|
|
4847
|
+
return this.element = i, this.model.withHeadings && H(this.gridElement, this.model.withHeadings), this.model.withHeadingColumn && U(this.gridElement, this.model.withHeadingColumn), this.readOnly || (this.initCellBlocks(s), this.keyboardNavCleanup = li(s, this.cellBlocks)), i;
|
|
4792
4848
|
}
|
|
4793
4849
|
rendered() {
|
|
4794
4850
|
if (!this.element || this.initialContent === null) return;
|
|
@@ -4797,9 +4853,9 @@ var Or = (e) => {
|
|
|
4797
4853
|
let t = this.initialContent;
|
|
4798
4854
|
if (this.initialContent = null, this.readOnly) {
|
|
4799
4855
|
var n;
|
|
4800
|
-
|
|
4856
|
+
si(e, t, this.api, (n = this.blockId) == null ? "" : n);
|
|
4801
4857
|
let r = this.model.snapshot();
|
|
4802
|
-
|
|
4858
|
+
fi(e, r.content), pi(e, r.content), this.initScrollHaze();
|
|
4803
4859
|
return;
|
|
4804
4860
|
}
|
|
4805
4861
|
if (this.runTransactedStructuralOp(() => {
|
|
@@ -4808,15 +4864,15 @@ var Or = (e) => {
|
|
|
4808
4864
|
let t = e.querySelectorAll(`[${N}]`).length;
|
|
4809
4865
|
return Array.from({ length: t }, () => ({ blocks: [] }));
|
|
4810
4866
|
}) : i;
|
|
4811
|
-
this.model.replaceAll(O(O({}, this.model.snapshot()), {}, { content: a })), this.isNewTable &&
|
|
4867
|
+
this.model.replaceAll(O(O({}, this.model.snapshot()), {}, { content: a })), this.isNewTable && V(e, this.cellBlocks), this.removeGhostChildren();
|
|
4812
4868
|
}, !0), this.model.initialColWidth === void 0) {
|
|
4813
4869
|
var r;
|
|
4814
|
-
let t = (r = this.model.colWidths) == null ?
|
|
4815
|
-
this.model.setInitialColWidth(t.length > 0 ?
|
|
4870
|
+
let t = (r = this.model.colWidths) == null ? R(e) : r;
|
|
4871
|
+
this.model.setInitialColWidth(t.length > 0 ? ii(t) : void 0);
|
|
4816
4872
|
}
|
|
4817
4873
|
this.initSubsystems(e);
|
|
4818
4874
|
let i = this.model.snapshot();
|
|
4819
|
-
if (
|
|
4875
|
+
if (fi(e, i.content), pi(e, i.content), this.isNewTable) {
|
|
4820
4876
|
var a;
|
|
4821
4877
|
(a = this.cellSelection) == null || a.selectRange({
|
|
4822
4878
|
minRow: 0,
|
|
@@ -4830,11 +4886,11 @@ var Or = (e) => {
|
|
|
4830
4886
|
let t = this.element, n = this.gridElement;
|
|
4831
4887
|
if (!(!t || !n)) if (this.readOnly = e, e) {
|
|
4832
4888
|
var r, i;
|
|
4833
|
-
this.teardownSubsystems(), (r = this.cellBlocks) == null || r.destroy(), this.cellBlocks = null, this.gripOverlay && (this.gripOverlay.remove(), this.gripOverlay = null),
|
|
4889
|
+
this.teardownSubsystems(), (r = this.cellBlocks) == null || r.destroy(), this.cellBlocks = null, this.gripOverlay && (this.gripOverlay.remove(), this.gripOverlay = null), fa.forEach((e) => t.classList.remove(e)), t.setAttribute("data-blok-table-readonly", ""), si(n, this.model.snapshot().content, this.api, (i = this.blockId) == null ? "" : i);
|
|
4834
4890
|
} else {
|
|
4835
|
-
t.removeAttribute("data-blok-table-readonly"),
|
|
4891
|
+
t.removeAttribute("data-blok-table-readonly"), fa.forEach((e) => t.classList.add(e));
|
|
4836
4892
|
let e = document.createElement("div");
|
|
4837
|
-
e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", t.appendChild(e), this.gripOverlay = e, this.initCellBlocks(n), this.keyboardNavCleanup =
|
|
4893
|
+
e.setAttribute("data-blok-table-grip-overlay", ""), e.style.position = "absolute", e.style.inset = "0", e.style.pointerEvents = "none", e.style.zIndex = "3", t.appendChild(e), this.gripOverlay = e, this.initCellBlocks(n), this.keyboardNavCleanup = li(n, this.cellBlocks), this.initSubsystems(n);
|
|
4838
4894
|
}
|
|
4839
4895
|
}
|
|
4840
4896
|
removeGhostChildren() {
|
|
@@ -4849,7 +4905,7 @@ var Or = (e) => {
|
|
|
4849
4905
|
save(e) {
|
|
4850
4906
|
let t = this.model.snapshot();
|
|
4851
4907
|
return t.content = t.content.map((e) => e.map((e) => {
|
|
4852
|
-
if (!
|
|
4908
|
+
if (!I(e)) return e;
|
|
4853
4909
|
let t = e.blocks.filter((e) => {
|
|
4854
4910
|
var t, n;
|
|
4855
4911
|
let r = (t = (n = this.api.blocks).getById) == null ? void 0 : t.call(n, e);
|
|
@@ -4864,7 +4920,7 @@ var Or = (e) => {
|
|
|
4864
4920
|
setData(e) {
|
|
4865
4921
|
var t, n, r, i, a;
|
|
4866
4922
|
this.setDataGeneration++;
|
|
4867
|
-
let o = this.setDataGeneration, s =
|
|
4923
|
+
let o = this.setDataGeneration, s = ci(O(O({}, this.model.snapshot()), e), this.config);
|
|
4868
4924
|
this.initialContent = s.content, this.model.replaceAll(s), this.api.blocks.isSyncingFromYjs || this.runStructuralOp(() => {
|
|
4869
4925
|
var e;
|
|
4870
4926
|
(e = this.cellBlocks) == null || e.deleteAllBlocks();
|
|
@@ -4879,7 +4935,7 @@ var Or = (e) => {
|
|
|
4879
4935
|
if (!f) return;
|
|
4880
4936
|
if (this.readOnly) {
|
|
4881
4937
|
let e = this.model.snapshot();
|
|
4882
|
-
|
|
4938
|
+
fi(f, e.content), pi(f, e.content);
|
|
4883
4939
|
return;
|
|
4884
4940
|
}
|
|
4885
4941
|
if (o !== this.setDataGeneration || (this.runStructuralOp(() => {
|
|
@@ -4891,14 +4947,14 @@ var Or = (e) => {
|
|
|
4891
4947
|
let t = e.querySelectorAll(`[${N}]`).length;
|
|
4892
4948
|
return Array.from({ length: t }, () => ({ blocks: [] }));
|
|
4893
4949
|
});
|
|
4894
|
-
this.model.replaceAll(O(O({}, this.model.snapshot()), {}, { content: e })),
|
|
4950
|
+
this.model.replaceAll(O(O({}, this.model.snapshot()), {}, { content: e })), V(f, this.cellBlocks);
|
|
4895
4951
|
} else this.model.replaceAll(O(O({}, this.model.snapshot()), {}, { content: i }));
|
|
4896
4952
|
this.initialContent = null;
|
|
4897
4953
|
}
|
|
4898
4954
|
}, !0), o !== this.setDataGeneration)) return;
|
|
4899
4955
|
this.initSubsystems(f), l !== null && this.cellSelection !== null && this.cellSelection.selectRange(l), u !== null && this.rowColControls !== null && this.rowColControls.restoreVisibleGrips(u.col, u.row);
|
|
4900
4956
|
let p = this.model.snapshot();
|
|
4901
|
-
|
|
4957
|
+
fi(f, p.content), pi(f, p.content);
|
|
4902
4958
|
}
|
|
4903
4959
|
onPaste(e) {
|
|
4904
4960
|
var t, n;
|
|
@@ -4935,7 +4991,7 @@ var Or = (e) => {
|
|
|
4935
4991
|
});
|
|
4936
4992
|
}, !0), this.initSubsystems(f);
|
|
4937
4993
|
let e = this.model.snapshot();
|
|
4938
|
-
|
|
4994
|
+
fi(f, e.content), pi(f, e.content);
|
|
4939
4995
|
}
|
|
4940
4996
|
}
|
|
4941
4997
|
destroy() {
|
|
@@ -4963,10 +5019,10 @@ var Or = (e) => {
|
|
|
4963
5019
|
});
|
|
4964
5020
|
}
|
|
4965
5021
|
getBlockIdsInRow(e) {
|
|
4966
|
-
return
|
|
5022
|
+
return ai(this.element, this.cellBlocks, e);
|
|
4967
5023
|
}
|
|
4968
5024
|
getBlockIdsInColumn(e) {
|
|
4969
|
-
return
|
|
5025
|
+
return oi(this.element, this.cellBlocks, e);
|
|
4970
5026
|
}
|
|
4971
5027
|
initAddControls(e) {
|
|
4972
5028
|
var t;
|
|
@@ -4982,20 +5038,20 @@ var Or = (e) => {
|
|
|
4982
5038
|
}),
|
|
4983
5039
|
getNewColumnWidth: () => {
|
|
4984
5040
|
var t;
|
|
4985
|
-
let n = (t = this.model.colWidths) == null ?
|
|
4986
|
-
return this.model.initialColWidth === void 0 ?
|
|
5041
|
+
let n = (t = this.model.colWidths) == null ? R(e) : t;
|
|
5042
|
+
return this.model.initialColWidth === void 0 ? B(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
4987
5043
|
},
|
|
4988
5044
|
onAddRow: () => {
|
|
4989
5045
|
this.runTransactedStructuralOp(() => {
|
|
4990
5046
|
var t, n;
|
|
4991
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5047
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (t = this.addControls) == null || t.syncRowButtonWidth(), (n = this.rowColControls) == null || n.refresh();
|
|
4992
5048
|
});
|
|
4993
5049
|
},
|
|
4994
5050
|
onAddColumn: () => {
|
|
4995
5051
|
this.runTransactedStructuralOp(() => {
|
|
4996
5052
|
var t, n, r;
|
|
4997
|
-
let i = (t = this.model.colWidths) == null ?
|
|
4998
|
-
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]),
|
|
5053
|
+
let i = (t = this.model.colWidths) == null ? R(e) : t, a = this.model.initialColWidth === void 0 ? B(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
5054
|
+
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths([...i, a]), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth), (r = this.addControls) == null || r.syncRowButtonWidth();
|
|
4999
5055
|
});
|
|
5000
5056
|
},
|
|
5001
5057
|
onDragStart: () => {
|
|
@@ -5004,13 +5060,13 @@ var Or = (e) => {
|
|
|
5004
5060
|
},
|
|
5005
5061
|
onDragAddRow: () => {
|
|
5006
5062
|
this.runTransactedStructuralOp(() => {
|
|
5007
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5063
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5008
5064
|
});
|
|
5009
5065
|
},
|
|
5010
5066
|
onDragRemoveRow: () => {
|
|
5011
5067
|
this.runTransactedStructuralOp(() => {
|
|
5012
5068
|
let t = this.grid.getRowCount(e);
|
|
5013
|
-
if (t > 1 &&
|
|
5069
|
+
if (t > 1 && Qr(e, t - 1)) {
|
|
5014
5070
|
var n;
|
|
5015
5071
|
let { blocksToDelete: r } = this.model.deleteRow(t - 1);
|
|
5016
5072
|
(n = this.cellBlocks) == null || n.deleteBlocks(r), this.grid.deleteRow(e, t - 1);
|
|
@@ -5020,19 +5076,19 @@ var Or = (e) => {
|
|
|
5020
5076
|
onDragAddCol: () => {
|
|
5021
5077
|
this.runTransactedStructuralOp(() => {
|
|
5022
5078
|
var t;
|
|
5023
|
-
let r = (t = this.model.colWidths) == null ?
|
|
5024
|
-
this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a),
|
|
5079
|
+
let r = (t = this.model.colWidths) == null ? R(e) : t, i = this.model.initialColWidth === void 0 ? B(r) : Math.round(this.model.initialColWidth / 2 * 100) / 100, a = [...r, i];
|
|
5080
|
+
this.grid.addColumn(e, void 0, r, i), this.model.addColumn(void 0, i), this.model.setColWidths(a), z(e, a), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), n.addedCols++, this.scrollContainer && (this.scrollContainer.scrollLeft = this.scrollContainer.scrollWidth);
|
|
5025
5081
|
});
|
|
5026
5082
|
},
|
|
5027
5083
|
onDragRemoveCol: () => {
|
|
5028
5084
|
this.runTransactedStructuralOp(() => {
|
|
5029
5085
|
var t;
|
|
5030
5086
|
let r = this.grid.getColumnCount(e);
|
|
5031
|
-
if (r <= 1 ||
|
|
5087
|
+
if (r <= 1 || !$r(e, r - 1)) return;
|
|
5032
5088
|
let { blocksToDelete: i } = this.model.deleteColumn(r - 1);
|
|
5033
5089
|
(t = this.cellBlocks) == null || t.deleteBlocks(i), this.grid.deleteColumn(e, r - 1);
|
|
5034
5090
|
let a = this.model.colWidths;
|
|
5035
|
-
a &&
|
|
5091
|
+
a && z(e, a), this.initResize(e), n.addedCols--;
|
|
5036
5092
|
});
|
|
5037
5093
|
},
|
|
5038
5094
|
onDragEnd: () => {
|
|
@@ -5043,19 +5099,19 @@ var Or = (e) => {
|
|
|
5043
5099
|
}
|
|
5044
5100
|
initCornerDrag(e) {
|
|
5045
5101
|
var t;
|
|
5046
|
-
(t = this.cornerDrag) == null || t.destroy(), this.element && (this.cornerDrag = new
|
|
5102
|
+
(t = this.cornerDrag) == null || t.destroy(), this.element && (this.cornerDrag = new ta({
|
|
5047
5103
|
wrapper: this.element,
|
|
5048
5104
|
gridEl: e,
|
|
5049
5105
|
onAddRow: () => {
|
|
5050
5106
|
this.runStructuralOp(() => {
|
|
5051
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5107
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5052
5108
|
});
|
|
5053
5109
|
},
|
|
5054
5110
|
onAddColumn: () => {
|
|
5055
5111
|
this.runStructuralOp(() => {
|
|
5056
5112
|
var t;
|
|
5057
|
-
let n = (t = this.model.colWidths) == null ?
|
|
5058
|
-
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i),
|
|
5113
|
+
let n = (t = this.model.colWidths) == null ? R(e) : t, r = this.model.initialColWidth === void 0 ? B(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100, i = [...n, r];
|
|
5114
|
+
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths(i), z(e, i), di(this.ensureScrollContainer()), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn);
|
|
5059
5115
|
});
|
|
5060
5116
|
},
|
|
5061
5117
|
onRemoveLastRow: () => {
|
|
@@ -5075,7 +5131,7 @@ var Or = (e) => {
|
|
|
5075
5131
|
let { blocksToDelete: r } = this.model.deleteColumn(n - 1);
|
|
5076
5132
|
(t = this.cellBlocks) == null || t.deleteBlocks(r), this.grid.deleteColumn(e, n - 1);
|
|
5077
5133
|
let i = this.model.colWidths;
|
|
5078
|
-
i &&
|
|
5134
|
+
i && z(e, i);
|
|
5079
5135
|
});
|
|
5080
5136
|
},
|
|
5081
5137
|
onDragStart: () => {
|
|
@@ -5090,21 +5146,21 @@ var Or = (e) => {
|
|
|
5090
5146
|
rows: this.model.rows,
|
|
5091
5147
|
cols: this.model.cols
|
|
5092
5148
|
}),
|
|
5093
|
-
canRemoveLastRow: () => this.model.rows > 1 &&
|
|
5094
|
-
canRemoveLastColumn: () => this.model.cols > 1 &&
|
|
5149
|
+
canRemoveLastRow: () => this.model.rows > 1 && Qr(e, this.model.rows - 1),
|
|
5150
|
+
canRemoveLastColumn: () => this.model.cols > 1 && $r(e, this.model.cols - 1),
|
|
5095
5151
|
onClickAdd: () => {
|
|
5096
5152
|
this.runTransactedStructuralOp(() => {
|
|
5097
5153
|
var t, n, r;
|
|
5098
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5099
|
-
let i = (t = this.model.colWidths) == null ?
|
|
5100
|
-
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o),
|
|
5154
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5155
|
+
let i = (t = this.model.colWidths) == null ? R(e) : t, a = this.model.initialColWidth === void 0 ? B(i) : Math.round(this.model.initialColWidth / 2 * 100) / 100, o = [...i, a];
|
|
5156
|
+
this.grid.addColumn(e, void 0, i, a), this.model.addColumn(void 0, a), this.model.setColWidths(o), z(e, o), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (n = this.rowColControls) == null || n.refresh(), (r = this.addControls) == null || r.syncRowButtonWidth();
|
|
5101
5157
|
});
|
|
5102
5158
|
}
|
|
5103
5159
|
}));
|
|
5104
5160
|
}
|
|
5105
5161
|
initRowColControls(e) {
|
|
5106
5162
|
var t, n, r;
|
|
5107
|
-
(t = this.rowColControls) == null || t.destroy(), this.element && (this.rowColControls = new
|
|
5163
|
+
(t = this.rowColControls) == null || t.destroy(), this.element && (this.rowColControls = new Qi({
|
|
5108
5164
|
grid: e,
|
|
5109
5165
|
overlay: (n = this.gripOverlay) == null ? void 0 : n,
|
|
5110
5166
|
scrollContainer: (r = this.scrollContainer) == null ? void 0 : r,
|
|
@@ -5152,7 +5208,7 @@ var Or = (e) => {
|
|
|
5152
5208
|
this.runTransactedStructuralOp(() => {
|
|
5153
5209
|
var r, i;
|
|
5154
5210
|
if (n !== this.setDataGeneration || this.gridElement !== e) return;
|
|
5155
|
-
let a = this.model.colWidths, { blocksToDelete: o } = this.syncModelForAction(t), s =
|
|
5211
|
+
let a = this.model.colWidths, { blocksToDelete: o } = this.syncModelForAction(t), s = Ei(e, t, {
|
|
5156
5212
|
grid: this.grid,
|
|
5157
5213
|
data: {
|
|
5158
5214
|
colWidths: a,
|
|
@@ -5164,7 +5220,7 @@ var Or = (e) => {
|
|
|
5164
5220
|
blocksToDelete: o
|
|
5165
5221
|
});
|
|
5166
5222
|
if (n !== this.setDataGeneration || this.gridElement !== e) return;
|
|
5167
|
-
if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight,
|
|
5223
|
+
if (this.model.setColWidths(s.colWidths), this.model.setWithHeadings(s.withHeadings), this.model.setWithHeadingColumn(s.withHeadingColumn), this.pendingHighlight = s.pendingHighlight, H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn), this.initResize(e), (r = this.addControls) == null || r.syncRowButtonWidth(), !(t.type === "toggle-heading" || t.type === "toggle-heading-column")) {
|
|
5168
5224
|
var c;
|
|
5169
5225
|
(c = this.rowColControls) == null || c.refresh();
|
|
5170
5226
|
}
|
|
@@ -5210,10 +5266,10 @@ var Or = (e) => {
|
|
|
5210
5266
|
initResize(e) {
|
|
5211
5267
|
var t, n;
|
|
5212
5268
|
(t = this.resize) == null || t.destroy();
|
|
5213
|
-
let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ?
|
|
5214
|
-
r ||
|
|
5269
|
+
let r = this.model.colWidths === void 0, i = (n = this.model.colWidths) == null ? R(e) : n;
|
|
5270
|
+
r || di(this.ensureScrollContainer()), this.resize = new yi(e, i, (e) => {
|
|
5215
5271
|
var t, n, r;
|
|
5216
|
-
this.model.setColWidths(e),
|
|
5272
|
+
this.model.setColWidths(e), di(this.ensureScrollContainer()), (t = this.rowColControls) == null || t.positionGrips(), (n = this.addControls) == null || n.syncRowButtonWidth(), (r = this.scrollHaze) == null || r.update();
|
|
5217
5273
|
}, () => {
|
|
5218
5274
|
var e;
|
|
5219
5275
|
(e = this.rowColControls) == null || e.hideAllGrips();
|
|
@@ -5224,7 +5280,7 @@ var Or = (e) => {
|
|
|
5224
5280
|
}
|
|
5225
5281
|
initCellBlocks(e) {
|
|
5226
5282
|
var t;
|
|
5227
|
-
this.cellBlocks = new
|
|
5283
|
+
this.cellBlocks = new wr({
|
|
5228
5284
|
api: this.api,
|
|
5229
5285
|
gridElement: e,
|
|
5230
5286
|
tableBlockId: (t = this.blockId) == null ? "" : t,
|
|
@@ -5251,7 +5307,7 @@ var Or = (e) => {
|
|
|
5251
5307
|
let r = this.gridElement;
|
|
5252
5308
|
r && this.runTransactedStructuralOp(() => {
|
|
5253
5309
|
for (let i of e) {
|
|
5254
|
-
let e =
|
|
5310
|
+
let e = Xr(r, i);
|
|
5255
5311
|
e && (n === "backgroundColor" ? (this.model.setCellColor(e.row, e.col, t == null ? void 0 : t), i.style.backgroundColor = t == null ? "" : t) : (this.model.setCellTextColor(e.row, e.col, t == null ? void 0 : t), i.style.color = t == null ? "" : t));
|
|
5256
5312
|
}
|
|
5257
5313
|
});
|
|
@@ -5260,23 +5316,18 @@ var Or = (e) => {
|
|
|
5260
5316
|
let n = this.gridElement;
|
|
5261
5317
|
n && this.runTransactedStructuralOp(() => {
|
|
5262
5318
|
for (let r of e) {
|
|
5263
|
-
let e =
|
|
5319
|
+
let e = Xr(n, r);
|
|
5264
5320
|
if (!e) continue;
|
|
5265
5321
|
this.model.setCellPlacement(e.row, e.col, t === "top-left" ? void 0 : t);
|
|
5266
|
-
let i = r.querySelector(`[${
|
|
5322
|
+
let i = r.querySelector(`[${L}]`);
|
|
5267
5323
|
i && (t === "top-left" ? i.removeAttribute("data-blok-cell-placement") : i.setAttribute("data-blok-cell-placement", t));
|
|
5268
5324
|
}
|
|
5269
5325
|
});
|
|
5270
5326
|
}
|
|
5271
5327
|
collectCellBlockData(e) {
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
return e.map((e) => {
|
|
5276
|
-
var t;
|
|
5277
|
-
let r = e.closest(`[${M}]`);
|
|
5278
|
-
if (!r) return null;
|
|
5279
|
-
let i = n.indexOf(r), a = Array.from(r.querySelectorAll(`[${N}]`)).indexOf(e), o = e.querySelector(`[${R}]`), s = [];
|
|
5328
|
+
return this.gridElement ? e.map((e) => {
|
|
5329
|
+
var t, n, r;
|
|
5330
|
+
let i = parseInt((t = e.getAttribute("data-blok-table-cell-row")) == null ? "0" : t, 10), a = parseInt((n = e.getAttribute("data-blok-table-cell-col")) == null ? "0" : n, 10), o = e.querySelector(`[${L}]`), s = [];
|
|
5280
5331
|
if (!o) return {
|
|
5281
5332
|
row: i,
|
|
5282
5333
|
col: a,
|
|
@@ -5293,7 +5344,7 @@ var Or = (e) => {
|
|
|
5293
5344
|
data: r.preservedData
|
|
5294
5345
|
}, Object.keys(r.preservedTunes).length > 0 ? { tunes: r.preservedTunes } : {}));
|
|
5295
5346
|
});
|
|
5296
|
-
let c = s.length === 0 ? ((
|
|
5347
|
+
let c = s.length === 0 ? ((r = o.innerHTML) == null ? "" : r).trim() : "";
|
|
5297
5348
|
s.length === 0 && c.length > 0 && s.push({
|
|
5298
5349
|
tool: "paragraph",
|
|
5299
5350
|
data: { text: c }
|
|
@@ -5304,13 +5355,13 @@ var Or = (e) => {
|
|
|
5304
5355
|
col: a,
|
|
5305
5356
|
blocks: s
|
|
5306
5357
|
}, l === void 0 ? {} : { color: l }), u === void 0 ? {} : { textColor: u });
|
|
5307
|
-
})
|
|
5358
|
+
}) : [];
|
|
5308
5359
|
}
|
|
5309
5360
|
initCellSelection(e) {
|
|
5310
5361
|
var t;
|
|
5311
5362
|
(t = this.cellSelection) == null || t.destroy();
|
|
5312
5363
|
let n = this.api.rectangleSelection;
|
|
5313
|
-
this.cellSelection = new
|
|
5364
|
+
this.cellSelection = new Yr({
|
|
5314
5365
|
grid: e,
|
|
5315
5366
|
rectangleSelection: n,
|
|
5316
5367
|
i18n: this.api.i18n,
|
|
@@ -5337,7 +5388,7 @@ var Or = (e) => {
|
|
|
5337
5388
|
t.deleteBlocks(n);
|
|
5338
5389
|
let r = this.gridElement;
|
|
5339
5390
|
if (r) for (let t of e) {
|
|
5340
|
-
let e =
|
|
5391
|
+
let e = Xr(r, t);
|
|
5341
5392
|
e && (this.model.setCellColor(e.row, e.col, void 0), this.model.setCellTextColor(e.row, e.col, void 0), t.style.backgroundColor = "", t.style.color = "");
|
|
5342
5393
|
}
|
|
5343
5394
|
});
|
|
@@ -5369,12 +5420,13 @@ var Or = (e) => {
|
|
|
5369
5420
|
this.runTransactedStructuralOp(() => {
|
|
5370
5421
|
this.model.splitCell(e, t), this.rebuildTableBody();
|
|
5371
5422
|
});
|
|
5372
|
-
}
|
|
5423
|
+
},
|
|
5424
|
+
getCellSpan: (e, t) => this.model.getCellSpan(e, t)
|
|
5373
5425
|
});
|
|
5374
5426
|
}
|
|
5375
5427
|
initScrollHaze() {
|
|
5376
5428
|
var e;
|
|
5377
|
-
(e = this.scrollHaze) == null || e.destroy(), !(!this.element || !this.scrollContainer) && (this.scrollHaze = new
|
|
5429
|
+
(e = this.scrollHaze) == null || e.destroy(), !(!this.element || !this.scrollContainer) && (this.scrollHaze = new ca(), this.scrollHaze.init(this.element, this.scrollContainer));
|
|
5378
5430
|
}
|
|
5379
5431
|
initGridPasteListener(e) {
|
|
5380
5432
|
let t = (t) => {
|
|
@@ -5385,22 +5437,21 @@ var Or = (e) => {
|
|
|
5385
5437
|
};
|
|
5386
5438
|
}
|
|
5387
5439
|
handleGridPaste(e, t) {
|
|
5440
|
+
var n, r;
|
|
5388
5441
|
if (this.readOnly || !e.clipboardData || e.defaultPrevented) return;
|
|
5389
|
-
let
|
|
5390
|
-
if (!
|
|
5391
|
-
let
|
|
5392
|
-
if (!s) return;
|
|
5393
|
-
let c = s.closest(`[${N}]`);
|
|
5394
|
-
if (!c || !t.contains(c)) return;
|
|
5395
|
-
let l = c.closest(`[${M}]`);
|
|
5442
|
+
let a = e.clipboardData.getData("text/html"), o = _t(a), s = o === null ? i(a) : null, c = o == null ? s : o;
|
|
5443
|
+
if (!c || s !== null && new DOMParser().parseFromString(a, "text/html").querySelectorAll("table").length > 1) return;
|
|
5444
|
+
let l = document.activeElement;
|
|
5396
5445
|
if (!l) return;
|
|
5397
|
-
|
|
5398
|
-
|
|
5446
|
+
let u = l.closest(`[${N}]`);
|
|
5447
|
+
if (!u || !t.contains(u) || !u.closest("[data-blok-table-row]")) return;
|
|
5448
|
+
if (c.rows === 1 && c.cols === 1) {
|
|
5449
|
+
e.preventDefault(), e.stopPropagation(), this.insertSingleCellPayloadInline(c.cells[0][0]);
|
|
5399
5450
|
return;
|
|
5400
5451
|
}
|
|
5401
5452
|
e.preventDefault(), e.stopPropagation();
|
|
5402
|
-
let
|
|
5403
|
-
this.pastePayloadIntoCells(t,
|
|
5453
|
+
let d = parseInt((n = u.getAttribute("data-blok-table-cell-row")) == null ? "0" : n, 10), f = parseInt((r = u.getAttribute("data-blok-table-cell-col")) == null ? "0" : r, 10);
|
|
5454
|
+
this.pastePayloadIntoCells(t, c, d, f);
|
|
5404
5455
|
}
|
|
5405
5456
|
insertSingleCellPayloadInline(e) {
|
|
5406
5457
|
let t = e.blocks.map((e) => typeof e.data.text == "string" ? e.data.text : "").filter(Boolean).join("<br>");
|
|
@@ -5447,11 +5498,11 @@ var Or = (e) => {
|
|
|
5447
5498
|
expandGridForPaste(e, t, n) {
|
|
5448
5499
|
let r = this.grid.getRowCount(e), i = this.grid.getColumnCount(e);
|
|
5449
5500
|
Array.from({ length: Math.max(0, t - r) }).forEach(() => {
|
|
5450
|
-
this.grid.addRow(e), this.model.addRow(),
|
|
5501
|
+
this.grid.addRow(e), this.model.addRow(), V(e, this.cellBlocks), H(this.gridElement, this.model.withHeadings), U(this.gridElement, this.model.withHeadingColumn);
|
|
5451
5502
|
}), Array.from({ length: Math.max(0, n - i) }).forEach(() => {
|
|
5452
5503
|
var t;
|
|
5453
|
-
let n = (t = this.model.colWidths) == null ?
|
|
5454
|
-
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]),
|
|
5504
|
+
let n = (t = this.model.colWidths) == null ? R(e) : t, r = this.model.initialColWidth === void 0 ? B(n) : Math.round(this.model.initialColWidth / 2 * 100) / 100;
|
|
5505
|
+
this.grid.addColumn(e, void 0, n, r), this.model.addColumn(void 0, r), this.model.setColWidths([...n, r]), V(e, this.cellBlocks), U(this.gridElement, this.model.withHeadingColumn);
|
|
5455
5506
|
});
|
|
5456
5507
|
}
|
|
5457
5508
|
pasteCellPayload(e, t) {
|
|
@@ -5459,7 +5510,7 @@ var Or = (e) => {
|
|
|
5459
5510
|
let t = this.cellBlocks.getBlockIdsFromCells([e]);
|
|
5460
5511
|
this.cellBlocks.deleteBlocks(t);
|
|
5461
5512
|
}
|
|
5462
|
-
let n = e.querySelector(`[${
|
|
5513
|
+
let n = e.querySelector(`[${L}]`);
|
|
5463
5514
|
if (n) {
|
|
5464
5515
|
if (t.blocks.length === 0) {
|
|
5465
5516
|
var r;
|
|
@@ -5473,19 +5524,19 @@ var Or = (e) => {
|
|
|
5473
5524
|
}
|
|
5474
5525
|
}
|
|
5475
5526
|
}
|
|
5476
|
-
},
|
|
5527
|
+
}, ma = (e) => {
|
|
5477
5528
|
let t = document.createElement("div");
|
|
5478
5529
|
t.innerHTML = e.trim();
|
|
5479
5530
|
let n = document.createDocumentFragment();
|
|
5480
5531
|
return n.append(...Array.from(t.childNodes)), n;
|
|
5481
|
-
},
|
|
5532
|
+
}, ha = (e, t, n, r) => {
|
|
5482
5533
|
if (!t) return e;
|
|
5483
5534
|
let i = n();
|
|
5484
5535
|
return {
|
|
5485
5536
|
text: i ? vt(i.innerHTML) : e.text,
|
|
5486
5537
|
isOpen: r
|
|
5487
5538
|
};
|
|
5488
|
-
},
|
|
5539
|
+
}, ga = (e, t) => {
|
|
5489
5540
|
let { data: n, getContentElement: r } = e;
|
|
5490
5541
|
n.text += t.text;
|
|
5491
5542
|
let i = r();
|
|
@@ -5493,7 +5544,7 @@ var Or = (e) => {
|
|
|
5493
5544
|
let n = e.parseHTML(t.text);
|
|
5494
5545
|
i.appendChild(n), i.normalize();
|
|
5495
5546
|
}
|
|
5496
|
-
},
|
|
5547
|
+
}, _a = (e, t, n) => {
|
|
5497
5548
|
let r = n();
|
|
5498
5549
|
if (!r) return {
|
|
5499
5550
|
newData: e,
|
|
@@ -5504,7 +5555,7 @@ var Or = (e) => {
|
|
|
5504
5555
|
newData: i,
|
|
5505
5556
|
inPlace: !0
|
|
5506
5557
|
};
|
|
5507
|
-
},
|
|
5558
|
+
}, va = class e {
|
|
5508
5559
|
constructor({ data: e, config: t, api: n, readOnly: r, block: i }) {
|
|
5509
5560
|
var a;
|
|
5510
5561
|
this._element = null, this._contentElement = null, this._arrowElement = null, this._bodyPlaceholderElement = null, this._childContainerElement = null, this.handleBlockChanged = (e) => {
|
|
@@ -5548,16 +5599,16 @@ var Or = (e) => {
|
|
|
5548
5599
|
this.updateChildrenVisibility(), this.updateBodyPlaceholderVisibility();
|
|
5549
5600
|
}
|
|
5550
5601
|
save() {
|
|
5551
|
-
return
|
|
5602
|
+
return ha(this._data, this._element, this.getContentElement.bind(this), this._isOpen);
|
|
5552
5603
|
}
|
|
5553
5604
|
validate(e) {
|
|
5554
5605
|
return !0;
|
|
5555
5606
|
}
|
|
5556
5607
|
merge(e) {
|
|
5557
|
-
|
|
5608
|
+
ga({
|
|
5558
5609
|
data: this._data,
|
|
5559
5610
|
getContentElement: this.getContentElement.bind(this),
|
|
5560
|
-
parseHTML:
|
|
5611
|
+
parseHTML: ma
|
|
5561
5612
|
}, e);
|
|
5562
5613
|
}
|
|
5563
5614
|
onPaste(t) {
|
|
@@ -5569,7 +5620,7 @@ var Or = (e) => {
|
|
|
5569
5620
|
o !== null && (o.innerHTML = a);
|
|
5570
5621
|
}
|
|
5571
5622
|
setData(e) {
|
|
5572
|
-
let t =
|
|
5623
|
+
let t = _a(this._data, e, this.getContentElement.bind(this));
|
|
5573
5624
|
return this._data = t.newData, typeof this._data.isOpen == "boolean" && (this._isOpen = this._data.isOpen), this._arrowElement && this._element && Ft(this._arrowElement, this._element, this._isOpen, {
|
|
5574
5625
|
collapse: this.api.i18n.t(st),
|
|
5575
5626
|
expand: this.api.i18n.t(qe)
|
|
@@ -5706,18 +5757,18 @@ var Or = (e) => {
|
|
|
5706
5757
|
static get isReadOnlySupported() {
|
|
5707
5758
|
return !0;
|
|
5708
5759
|
}
|
|
5709
|
-
},
|
|
5760
|
+
}, ya = "callout", ba = "tools.callout.color", xa = "tools.callout.editIcon", Sa = "tools.callout.addEmoji", Ca = "tools.callout.removeEmoji", wa = "tools.callout.filterEmojis", Ta = "tools.callout.calloutEmojiCategory", Ea = "tools.callout.noEmojisFound", Da = "tools.callout.pickRandom", Oa = "tools.callout.skinTone", ka = "tools.callout.emojiCategoryPeople", Aa = "tools.callout.emojiCategoryNature", ja = "tools.callout.emojiCategoryFood", Ma = "tools.callout.emojiCategoryActivity", Na = "tools.callout.emojiCategoryTravel", Pa = "tools.callout.emojiCategoryObjects", Fa = "tools.callout.emojiCategorySymbols", Ia = "tools.callout.emojiCategoryFlags", La = "💡", Ra = "rounded-xl pl-8 pr-4 py-[5px] my-1 flex items-start gap-2 relative", za = "text-[1.5rem] leading-[1] cursor-pointer bg-transparent border-0 px-0 py-[7px] h-[38px] flex-shrink-0 select-none", Ba = "flex-1 min-w-0", Va = "absolute left-0 top-0 h-full cursor-grab select-none";
|
|
5710
5761
|
//#endregion
|
|
5711
5762
|
//#region src/tools/callout/dom-builder.ts
|
|
5712
|
-
function
|
|
5763
|
+
function Ha(e) {
|
|
5713
5764
|
let { emoji: t, readOnly: n, addEmojiLabel: r } = e, i = document.createElement("div");
|
|
5714
|
-
i.className =
|
|
5765
|
+
i.className = Ra;
|
|
5715
5766
|
let a = document.createElement("button");
|
|
5716
|
-
a.type = "button", a.className =
|
|
5767
|
+
a.type = "button", a.className = za, a.textContent = t || "", a.setAttribute("aria-label", t === "" ? r : t), a.setAttribute("tabindex", "0"), a.setAttribute("data-blok-testid", "callout-emoji-btn"), n && (a.disabled = !0);
|
|
5717
5768
|
let o = document.createElement("div");
|
|
5718
|
-
o.className =
|
|
5769
|
+
o.className = Ba, o.setAttribute(D.toggleChildren, ""), o.setAttribute(C.nestedBlocks, ""), o.setAttribute("data-blok-child-toolbar", ""), o.setAttribute("data-blok-mutation-free", "true"), i.appendChild(a), i.appendChild(o);
|
|
5719
5770
|
let s = document.createElement("span");
|
|
5720
|
-
return s.className =
|
|
5771
|
+
return s.className = Va, s.style.width = "32px", s.setAttribute("data-callout-drag-zone", ""), i.prepend(s), {
|
|
5721
5772
|
wrapper: i,
|
|
5722
5773
|
emojiButton: a,
|
|
5723
5774
|
childContainer: o,
|
|
@@ -5726,7 +5777,7 @@ function Va(e) {
|
|
|
5726
5777
|
}
|
|
5727
5778
|
//#endregion
|
|
5728
5779
|
//#region src/tools/callout/block-operations.ts
|
|
5729
|
-
function
|
|
5780
|
+
function Ua(e) {
|
|
5730
5781
|
return {
|
|
5731
5782
|
emoji: e.emoji,
|
|
5732
5783
|
textColor: e.textColor,
|
|
@@ -5735,7 +5786,7 @@ function Ha(e) {
|
|
|
5735
5786
|
}
|
|
5736
5787
|
//#endregion
|
|
5737
5788
|
//#region src/tools/callout/callout-keyboard.ts
|
|
5738
|
-
async function
|
|
5789
|
+
async function Wa(e) {
|
|
5739
5790
|
if (e.calloutBlockId === void 0) return;
|
|
5740
5791
|
let t = e.api.blocks.getChildren(e.calloutBlockId);
|
|
5741
5792
|
if (e.event.preventDefault(), t.length <= 1) {
|
|
@@ -5749,7 +5800,7 @@ async function Ua(e) {
|
|
|
5749
5800
|
}
|
|
5750
5801
|
//#endregion
|
|
5751
5802
|
//#region src/tools/callout/emoji-picker/emoji-data.ts
|
|
5752
|
-
var
|
|
5803
|
+
var Ga = [
|
|
5753
5804
|
"💡",
|
|
5754
5805
|
"👉",
|
|
5755
5806
|
"☝️",
|
|
@@ -5770,8 +5821,8 @@ var Wa = [
|
|
|
5770
5821
|
"📢",
|
|
5771
5822
|
"🛠️",
|
|
5772
5823
|
"⚙️"
|
|
5773
|
-
],
|
|
5774
|
-
function
|
|
5824
|
+
], Ka = { data: null };
|
|
5825
|
+
function qa(e, t) {
|
|
5775
5826
|
let n = [];
|
|
5776
5827
|
for (let r of e.emojis) {
|
|
5777
5828
|
let i = t[r];
|
|
@@ -5788,12 +5839,12 @@ function Ka(e, t) {
|
|
|
5788
5839
|
}
|
|
5789
5840
|
return n;
|
|
5790
5841
|
}
|
|
5791
|
-
async function
|
|
5792
|
-
if (
|
|
5793
|
-
let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) =>
|
|
5794
|
-
return
|
|
5842
|
+
async function Ja() {
|
|
5843
|
+
if (Ka.data !== null) return Ka.data;
|
|
5844
|
+
let e = await import("./native-D0cfLXsM.mjs"), t = "default" in e && e.default !== void 0 ? e.default : e, n = t.categories.flatMap((e) => qa(e, t.emojis));
|
|
5845
|
+
return Ka.data = n, n;
|
|
5795
5846
|
}
|
|
5796
|
-
function
|
|
5847
|
+
function Ya(e, t, n) {
|
|
5797
5848
|
let r = t.toLowerCase();
|
|
5798
5849
|
return e.filter((e) => {
|
|
5799
5850
|
if (e.name.toLowerCase().includes(r) || e.keywords.some((e) => e.includes(r))) return !0;
|
|
@@ -5801,7 +5852,7 @@ function Ja(e, t, n) {
|
|
|
5801
5852
|
return t === void 0 ? !1 : t.n.toLowerCase().includes(r) || t.k !== void 0 && t.k.some((e) => e.toLowerCase().includes(r));
|
|
5802
5853
|
});
|
|
5803
5854
|
}
|
|
5804
|
-
function
|
|
5855
|
+
function Xa(e) {
|
|
5805
5856
|
let t = /* @__PURE__ */ new Map();
|
|
5806
5857
|
for (let r of e) {
|
|
5807
5858
|
var n;
|
|
@@ -5812,7 +5863,7 @@ function Ya(e) {
|
|
|
5812
5863
|
}
|
|
5813
5864
|
//#endregion
|
|
5814
5865
|
//#region src/tools/callout/emoji-picker/emoji-locale.ts
|
|
5815
|
-
var
|
|
5866
|
+
var Za = /* @__PURE__ */ new Map(), Qa = {
|
|
5816
5867
|
am: () => import("./am-BxlkYGsI.mjs"),
|
|
5817
5868
|
ar: () => import("./ar-9vlpr9V8.mjs"),
|
|
5818
5869
|
az: () => import("./az-ON63W_FP.mjs"),
|
|
@@ -5879,32 +5930,32 @@ var Xa = /* @__PURE__ */ new Map(), Za = {
|
|
|
5879
5930
|
vi: () => import("./vi-bt-3LPGO.mjs"),
|
|
5880
5931
|
zh: () => import("./zh-Dgyb5Ly8.mjs")
|
|
5881
5932
|
};
|
|
5882
|
-
async function
|
|
5933
|
+
async function $a(e) {
|
|
5883
5934
|
if (e === "en") return null;
|
|
5884
|
-
let t =
|
|
5935
|
+
let t = Za.get(e);
|
|
5885
5936
|
if (t !== void 0) return t;
|
|
5886
|
-
let n =
|
|
5937
|
+
let n = Qa[e];
|
|
5887
5938
|
if (n === void 0) return null;
|
|
5888
5939
|
try {
|
|
5889
5940
|
let t = (await n()).default;
|
|
5890
|
-
return
|
|
5941
|
+
return Za.set(e, t), t;
|
|
5891
5942
|
} catch (e) {
|
|
5892
5943
|
return null;
|
|
5893
5944
|
}
|
|
5894
5945
|
}
|
|
5895
5946
|
//#endregion
|
|
5896
5947
|
//#region src/tools/callout/emoji-picker/index.ts
|
|
5897
|
-
var
|
|
5898
|
-
callout:
|
|
5899
|
-
people:
|
|
5900
|
-
nature:
|
|
5901
|
-
foods:
|
|
5902
|
-
activity:
|
|
5903
|
-
places:
|
|
5904
|
-
objects:
|
|
5905
|
-
symbols:
|
|
5906
|
-
flags:
|
|
5907
|
-
},
|
|
5948
|
+
var eo = {
|
|
5949
|
+
callout: Ta,
|
|
5950
|
+
people: ka,
|
|
5951
|
+
nature: Aa,
|
|
5952
|
+
foods: ja,
|
|
5953
|
+
activity: Ma,
|
|
5954
|
+
places: Na,
|
|
5955
|
+
objects: Pa,
|
|
5956
|
+
symbols: Fa,
|
|
5957
|
+
flags: Ia
|
|
5958
|
+
}, to = [
|
|
5908
5959
|
["callout", ge],
|
|
5909
5960
|
["people", m],
|
|
5910
5961
|
["nature", fe],
|
|
@@ -5914,17 +5965,17 @@ var $a = {
|
|
|
5914
5965
|
["objects", me],
|
|
5915
5966
|
["symbols", r],
|
|
5916
5967
|
["flags", ce]
|
|
5917
|
-
],
|
|
5968
|
+
], no = [
|
|
5918
5969
|
"✋",
|
|
5919
5970
|
"✋🏻",
|
|
5920
5971
|
"✋🏼",
|
|
5921
5972
|
"✋🏽",
|
|
5922
5973
|
"✋🏾",
|
|
5923
5974
|
"✋🏿"
|
|
5924
|
-
],
|
|
5925
|
-
function
|
|
5975
|
+
], ro = "blok-emoji-skin-tone";
|
|
5976
|
+
function io() {
|
|
5926
5977
|
try {
|
|
5927
|
-
let e = localStorage.getItem(
|
|
5978
|
+
let e = localStorage.getItem(ro);
|
|
5928
5979
|
if (e === null) return 0;
|
|
5929
5980
|
let t = parseInt(e, 10);
|
|
5930
5981
|
return t >= 0 && t <= 5 ? t : 0;
|
|
@@ -5932,12 +5983,12 @@ function ro() {
|
|
|
5932
5983
|
return 0;
|
|
5933
5984
|
}
|
|
5934
5985
|
}
|
|
5935
|
-
function
|
|
5986
|
+
function ao(e) {
|
|
5936
5987
|
try {
|
|
5937
|
-
localStorage.setItem(
|
|
5988
|
+
localStorage.setItem(ro, String(e));
|
|
5938
5989
|
} catch (e) {}
|
|
5939
5990
|
}
|
|
5940
|
-
var
|
|
5991
|
+
var oo = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><rect x=\"1.5\" y=\"1.5\" width=\"11\" height=\"11\" rx=\"2\" stroke=\"currentColor\" stroke-width=\"1.2\"/><circle cx=\"4.5\" cy=\"4.5\" r=\".9\" fill=\"currentColor\"/><circle cx=\"7\" cy=\"7\" r=\".9\" fill=\"currentColor\"/><circle cx=\"9.5\" cy=\"9.5\" r=\".9\" fill=\"currentColor\"/></svg>", so = class {
|
|
5941
5992
|
constructor(e) {
|
|
5942
5993
|
this._localeData = null, this._open = !1, this._allEmojis = [], this._skinTone = 0, this._showingEmptyState = !1, this._anchorEl = null, this._backdrop = null, this._savedOverflow = "", this._navButtons = /* @__PURE__ */ new Map(), this._sectionEls = /* @__PURE__ */ new Map(), this._activeNavId = "", this._navRafId = 0, this._skinToneButtons = [], this.onSelect = e.onSelect, this.onRemove = e.onRemove, this.i18n = e.i18n, this._locale = e.locale, this._element = this.buildElement();
|
|
5943
5994
|
let t = this._element.querySelector("[data-emoji-picker-body]"), n = this._element.querySelector("[data-emoji-picker-nav]"), r = this._element.querySelector("input[type=\"text\"]");
|
|
@@ -5955,13 +6006,13 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
5955
6006
|
async open(e) {
|
|
5956
6007
|
var t = this;
|
|
5957
6008
|
t._anchorEl = e, t._open = !0, t._filterInput.value = "", t._element.setAttribute("data-theme", t.resolveTheme());
|
|
5958
|
-
let n =
|
|
6009
|
+
let n = io();
|
|
5959
6010
|
if (n !== t._skinTone) {
|
|
5960
|
-
t._skinTone = n, t._skinToneToggle.textContent =
|
|
6011
|
+
t._skinTone = n, t._skinToneToggle.textContent = no[n];
|
|
5961
6012
|
for (let [e, r] of t._skinToneButtons.entries()) t.applySkinToneActiveStyle(r, e === n);
|
|
5962
6013
|
}
|
|
5963
|
-
if (t._allEmojis.length === 0 && (t._allEmojis = await
|
|
5964
|
-
let e = await
|
|
6014
|
+
if (t._allEmojis.length === 0 && (t._allEmojis = await Ja()), t._locale !== "en" && t._localeData === null) {
|
|
6015
|
+
let e = await $a(t._locale);
|
|
5965
6016
|
e !== null && (t._localeData = e);
|
|
5966
6017
|
}
|
|
5967
6018
|
t.renderEmojiGrid(t._allEmojis), t.showBackdrop(), t._element.style.animation = "none", t._element.hidden = !1, t.position(e), t._element.offsetHeight, t._element.style.animation = "", t._filterInput.focus();
|
|
@@ -5984,7 +6035,7 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
5984
6035
|
let r = document.createElement("span");
|
|
5985
6036
|
r.className = ["pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 flex items-center", "text-neutral-400 theme-dark:text-neutral-500 [&>svg]:w-[16px] [&>svg]:h-[16px]"].join(" "), r.innerHTML = mt;
|
|
5986
6037
|
let i = document.createElement("input");
|
|
5987
|
-
i.type = "text", i.placeholder = this.i18n.t(
|
|
6038
|
+
i.type = "text", i.placeholder = this.i18n.t(wa), i.className = [
|
|
5988
6039
|
"w-full text-[13px] rounded-lg py-[7px] pl-8 pr-3 outline-hidden",
|
|
5989
6040
|
"bg-neutral-100 text-neutral-800 placeholder:text-neutral-400",
|
|
5990
6041
|
"theme-dark:bg-neutral-800 theme-dark:text-neutral-200 theme-dark:placeholder:text-neutral-500",
|
|
@@ -5994,28 +6045,28 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
5994
6045
|
let a = document.createElement("div");
|
|
5995
6046
|
a.className = "relative flex-shrink-0";
|
|
5996
6047
|
let o = document.createElement("button");
|
|
5997
|
-
o.type = "button", o.setAttribute("data-emoji-picker-skin-toggle", ""), o.setAttribute("aria-label", this.i18n.t(
|
|
6048
|
+
o.type = "button", o.setAttribute("data-emoji-picker-skin-toggle", ""), o.setAttribute("aria-label", this.i18n.t(Oa)), o.title = this.i18n.t(Oa), o.className = [
|
|
5998
6049
|
"w-[28px] h-[28px] flex items-center justify-center rounded-lg",
|
|
5999
6050
|
"text-[14px] leading-none cursor-pointer select-none",
|
|
6000
6051
|
"hover:bg-neutral-100 theme-dark:hover:bg-neutral-800",
|
|
6001
6052
|
"active:scale-90 transition-all duration-100"
|
|
6002
|
-
].join(" "), o.textContent =
|
|
6053
|
+
].join(" "), o.textContent = no[this._skinTone], o.addEventListener("click", () => this.toggleSkinTonePopover()), this._skinToneToggle = o, a.appendChild(o), this._skinTonePopover = this.buildSkinTonePopover(), a.appendChild(this._skinTonePopover);
|
|
6003
6054
|
let s = document.createElement("button");
|
|
6004
|
-
s.type = "button", s.setAttribute("data-emoji-picker-random", ""), s.setAttribute("aria-label", this.i18n.t(
|
|
6055
|
+
s.type = "button", s.setAttribute("data-emoji-picker-random", ""), s.setAttribute("aria-label", this.i18n.t(Da)), s.className = [
|
|
6005
6056
|
"flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
|
|
6006
6057
|
"text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
|
|
6007
6058
|
"theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
|
|
6008
6059
|
"transition-colors duration-100 cursor-pointer"
|
|
6009
|
-
].join(" "), s.innerHTML =
|
|
6060
|
+
].join(" "), s.innerHTML = oo, s.addEventListener("click", () => this.pickRandom()), E(s, this.i18n.t(Da), { placement: "bottom" });
|
|
6010
6061
|
let c = document.createElement("button");
|
|
6011
|
-
c.type = "button", c.setAttribute("data-emoji-picker-remove", ""), c.setAttribute("aria-label", this.i18n.t(
|
|
6062
|
+
c.type = "button", c.setAttribute("data-emoji-picker-remove", ""), c.setAttribute("aria-label", this.i18n.t(Ca)), c.className = [
|
|
6012
6063
|
"flex-shrink-0 w-[34px] h-[34px] flex items-center justify-center rounded-lg",
|
|
6013
6064
|
"text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600",
|
|
6014
6065
|
"theme-dark:hover:bg-neutral-800 theme-dark:hover:text-neutral-300",
|
|
6015
6066
|
"transition-colors duration-100 cursor-pointer"
|
|
6016
6067
|
].join(" "), c.innerHTML = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><path d=\"M3.5 3.5l7 7M10.5 3.5l-7 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"/></svg>", c.addEventListener("click", () => {
|
|
6017
6068
|
this.onRemove(), this.close();
|
|
6018
|
-
}), E(c, this.i18n.t(
|
|
6069
|
+
}), E(c, this.i18n.t(Ca), { placement: "bottom" });
|
|
6019
6070
|
let l = document.createElement("div");
|
|
6020
6071
|
l.className = "flex items-center gap-1", l.appendChild(s), l.appendChild(c), t.appendChild(n), t.appendChild(a), t.appendChild(l), e.appendChild(t);
|
|
6021
6072
|
let u = document.createElement("div");
|
|
@@ -6042,9 +6093,9 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6042
6093
|
"bg-white border border-neutral-200/70 shadow-lg",
|
|
6043
6094
|
"theme-dark:bg-neutral-800 theme-dark:border-neutral-700/50"
|
|
6044
6095
|
].join(" "), e.hidden = !0, this._skinToneButtons = [];
|
|
6045
|
-
for (let [t, n] of
|
|
6096
|
+
for (let [t, n] of no.entries()) {
|
|
6046
6097
|
let r = document.createElement("button");
|
|
6047
|
-
r.type = "button", r.textContent = n, r.setAttribute("aria-label", `${this.i18n.t(
|
|
6098
|
+
r.type = "button", r.textContent = n, r.setAttribute("aria-label", `${this.i18n.t(Oa)} ${t + 1}`), r.className = [
|
|
6048
6099
|
"w-[32px] h-[32px] flex items-center justify-center rounded-lg",
|
|
6049
6100
|
"text-[1.2rem] leading-none cursor-pointer select-none",
|
|
6050
6101
|
"hover:bg-neutral-100 theme-dark:hover:bg-neutral-700",
|
|
@@ -6076,7 +6127,7 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6076
6127
|
e ? this._skinToneToggle.classList.add(...t) : this._skinToneToggle.classList.remove(...t);
|
|
6077
6128
|
}
|
|
6078
6129
|
setSkinTone(e) {
|
|
6079
|
-
this._skinTone = e,
|
|
6130
|
+
this._skinTone = e, ao(e), this._skinToneToggle.textContent = no[e];
|
|
6080
6131
|
for (let [t, n] of this._skinToneButtons.entries()) this.applySkinToneActiveStyle(n, t === e);
|
|
6081
6132
|
let t = Array.from(this._body.querySelectorAll("[data-emoji-native]"));
|
|
6082
6133
|
for (let e of t) {
|
|
@@ -6093,7 +6144,7 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6093
6144
|
}
|
|
6094
6145
|
buildCategoryNav(e) {
|
|
6095
6146
|
this._nav.innerHTML = "", this._navButtons.clear(), this._activeNavId = "";
|
|
6096
|
-
for (let [t, n] of
|
|
6147
|
+
for (let [t, n] of to) {
|
|
6097
6148
|
if (!e.has(t)) continue;
|
|
6098
6149
|
let r = this.translateCategory(t), i = document.createElement("button");
|
|
6099
6150
|
i.type = "button", i.innerHTML = n, i.title = r, i.setAttribute("aria-label", r), i.setAttribute("data-emoji-nav", t), i.className = [
|
|
@@ -6133,11 +6184,11 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6133
6184
|
return;
|
|
6134
6185
|
}
|
|
6135
6186
|
this._nav.hidden = !0;
|
|
6136
|
-
let t =
|
|
6187
|
+
let t = Ya(this._allEmojis, e, this._localeData);
|
|
6137
6188
|
if (t.length === 0) this._showingEmptyState || this.renderEmptyState();
|
|
6138
6189
|
else {
|
|
6139
6190
|
this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
|
|
6140
|
-
let e =
|
|
6191
|
+
let e = Xa(t);
|
|
6141
6192
|
for (let [t, n] of e) {
|
|
6142
6193
|
let e = this.buildSection(this.translateCategory(t), n);
|
|
6143
6194
|
e.setAttribute("data-emoji-section", t), this._sectionEls.set(t, e), this._body.appendChild(e);
|
|
@@ -6146,13 +6197,13 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6146
6197
|
}
|
|
6147
6198
|
renderEmojiGrid(e) {
|
|
6148
6199
|
this._body.innerHTML = "", this._sectionEls.clear(), this._showingEmptyState = !1;
|
|
6149
|
-
let t = /* @__PURE__ */ new Set(), n =
|
|
6200
|
+
let t = /* @__PURE__ */ new Set(), n = Ga.map((t) => e.find((e) => e.native === t)).filter((e) => e !== void 0);
|
|
6150
6201
|
if (n.length > 0) {
|
|
6151
6202
|
t.add("callout");
|
|
6152
6203
|
let e = this.buildSection(this.translateCategory("callout"), n);
|
|
6153
6204
|
e.setAttribute("data-emoji-section", "callout"), this._sectionEls.set("callout", e), this._body.appendChild(e);
|
|
6154
6205
|
}
|
|
6155
|
-
let r = new Set(
|
|
6206
|
+
let r = new Set(Ga), i = Xa(e.filter((e) => !r.has(e.native)));
|
|
6156
6207
|
for (let [e, n] of i) {
|
|
6157
6208
|
t.add(e);
|
|
6158
6209
|
let r = this.buildSection(this.translateCategory(e), n);
|
|
@@ -6171,10 +6222,10 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6171
6222
|
let t = document.createElement("span");
|
|
6172
6223
|
t.className = "mb-3 opacity-20 [&>svg]:w-9 [&>svg]:h-9", t.innerHTML = mt;
|
|
6173
6224
|
let n = document.createElement("span");
|
|
6174
|
-
n.className = "text-[13px] font-medium", n.textContent = this.i18n.t(
|
|
6225
|
+
n.className = "text-[13px] font-medium", n.textContent = this.i18n.t(Ea), e.appendChild(t), e.appendChild(n), this._body.appendChild(e);
|
|
6175
6226
|
}
|
|
6176
6227
|
translateCategory(e) {
|
|
6177
|
-
let t =
|
|
6228
|
+
let t = eo[e];
|
|
6178
6229
|
return t === void 0 ? e : this.i18n.t(t);
|
|
6179
6230
|
}
|
|
6180
6231
|
buildSection(e, t) {
|
|
@@ -6229,10 +6280,10 @@ var ao = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\"><r
|
|
|
6229
6280
|
};
|
|
6230
6281
|
//#endregion
|
|
6231
6282
|
//#region src/tools/callout/index.ts
|
|
6232
|
-
function
|
|
6233
|
-
return e.isEmojiVisible === !1 ? "" : typeof e.emoji == "string" && e.emoji.length > 0 ? e.emoji :
|
|
6283
|
+
function co(e) {
|
|
6284
|
+
return e.isEmojiVisible === !1 ? "" : typeof e.emoji == "string" && e.emoji.length > 0 ? e.emoji : La;
|
|
6234
6285
|
}
|
|
6235
|
-
var
|
|
6286
|
+
var lo = {
|
|
6236
6287
|
general: null,
|
|
6237
6288
|
note: "blue",
|
|
6238
6289
|
important: "purple",
|
|
@@ -6240,32 +6291,32 @@ var co = {
|
|
|
6240
6291
|
additional: "yellow",
|
|
6241
6292
|
recommendation: "green",
|
|
6242
6293
|
caution: "red"
|
|
6243
|
-
},
|
|
6294
|
+
}, uo = class {
|
|
6244
6295
|
constructor({ data: e, api: t, readOnly: n, block: r }) {
|
|
6245
6296
|
this._dom = null, this._emojiPicker = null, this._colorPicker = null, this._dragZone = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
|
|
6246
6297
|
}
|
|
6247
6298
|
normalizeData(e) {
|
|
6248
6299
|
let t = e;
|
|
6249
6300
|
return "variant" in t || "isEmojiVisible" in t ? this.normalizeLegacyData(t) : {
|
|
6250
|
-
emoji: typeof e.emoji == "string" ? e.emoji :
|
|
6301
|
+
emoji: typeof e.emoji == "string" ? e.emoji : La,
|
|
6251
6302
|
textColor: typeof e.textColor == "string" ? e.textColor : null,
|
|
6252
6303
|
backgroundColor: typeof e.backgroundColor == "string" ? e.backgroundColor : null
|
|
6253
6304
|
};
|
|
6254
6305
|
}
|
|
6255
6306
|
normalizeLegacyData(e) {
|
|
6256
|
-
let t = typeof e.variant == "string" ? e.variant : "general", n = t in
|
|
6307
|
+
let t = typeof e.variant == "string" ? e.variant : "general", n = t in lo ? lo[t] : null;
|
|
6257
6308
|
return {
|
|
6258
|
-
emoji:
|
|
6309
|
+
emoji: co(e),
|
|
6259
6310
|
textColor: null,
|
|
6260
6311
|
backgroundColor: n == null ? null : n
|
|
6261
6312
|
};
|
|
6262
6313
|
}
|
|
6263
6314
|
render() {
|
|
6264
6315
|
if (this._dom) return this._dom.wrapper;
|
|
6265
|
-
let e =
|
|
6316
|
+
let e = Ha({
|
|
6266
6317
|
emoji: this._data.emoji,
|
|
6267
6318
|
readOnly: this.readOnly,
|
|
6268
|
-
addEmojiLabel: this.api.i18n.t(
|
|
6319
|
+
addEmojiLabel: this.api.i18n.t(Sa)
|
|
6269
6320
|
});
|
|
6270
6321
|
return this._dom = e, this._dragZone = e.dragZone, this.applyColors(), this.readOnly || (e.emojiButton.addEventListener("click", () => this.openEmojiPicker()), e.emojiButton.addEventListener("keydown", (e) => {
|
|
6271
6322
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.openEmojiPicker());
|
|
@@ -6285,7 +6336,7 @@ var co = {
|
|
|
6285
6336
|
}
|
|
6286
6337
|
}
|
|
6287
6338
|
save() {
|
|
6288
|
-
return
|
|
6339
|
+
return Ua({
|
|
6289
6340
|
emoji: this._data.emoji,
|
|
6290
6341
|
textColor: this._data.textColor,
|
|
6291
6342
|
backgroundColor: this._data.backgroundColor
|
|
@@ -6305,7 +6356,7 @@ var co = {
|
|
|
6305
6356
|
}
|
|
6306
6357
|
renderSettings() {
|
|
6307
6358
|
if (this._colorPicker === null) {
|
|
6308
|
-
let e =
|
|
6359
|
+
let e = Or({
|
|
6309
6360
|
i18n: this.api.i18n,
|
|
6310
6361
|
testIdPrefix: "callout-color",
|
|
6311
6362
|
modes: [{
|
|
@@ -6326,13 +6377,13 @@ var co = {
|
|
|
6326
6377
|
}
|
|
6327
6378
|
return this.syncPickerActiveColors(), [{
|
|
6328
6379
|
icon: m,
|
|
6329
|
-
title: this.api.i18n.t(
|
|
6380
|
+
title: this.api.i18n.t(xa),
|
|
6330
6381
|
name: "callout-edit-icon",
|
|
6331
6382
|
closeOnActivate: !0,
|
|
6332
6383
|
onActivate: () => this.openEmojiPicker()
|
|
6333
6384
|
}, {
|
|
6334
6385
|
icon: Re,
|
|
6335
|
-
title: this.api.i18n.t(
|
|
6386
|
+
title: this.api.i18n.t(ba),
|
|
6336
6387
|
name: "callout-color",
|
|
6337
6388
|
children: { items: [{
|
|
6338
6389
|
type: w.Html,
|
|
@@ -6367,7 +6418,7 @@ var co = {
|
|
|
6367
6418
|
let n = t[0], r = e.target;
|
|
6368
6419
|
if (!n.holder.contains(r)) return;
|
|
6369
6420
|
let i = window.getSelection(), a = i !== null && i.rangeCount > 0 && i.getRangeAt(0).startOffset === 0 && i.getRangeAt(0).collapsed;
|
|
6370
|
-
n.holder.textContent !== "" || !a ||
|
|
6421
|
+
n.holder.textContent !== "" || !a || Wa({
|
|
6371
6422
|
api: this.api,
|
|
6372
6423
|
calloutBlockId: this.blockId,
|
|
6373
6424
|
firstChildBlockId: n.id,
|
|
@@ -6375,7 +6426,7 @@ var co = {
|
|
|
6375
6426
|
});
|
|
6376
6427
|
}
|
|
6377
6428
|
openEmojiPicker() {
|
|
6378
|
-
this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new
|
|
6429
|
+
this._dom !== null && (this._emojiPicker === null && (this._emojiPicker = new so({
|
|
6379
6430
|
onSelect: (e) => this.setEmoji(e),
|
|
6380
6431
|
onRemove: () => this.setEmoji(""),
|
|
6381
6432
|
i18n: this.api.i18n,
|
|
@@ -6383,14 +6434,14 @@ var co = {
|
|
|
6383
6434
|
}), document.body.appendChild(this._emojiPicker.getElement())), this._emojiPicker.open(this._dom.emojiButton));
|
|
6384
6435
|
}
|
|
6385
6436
|
setEmoji(e) {
|
|
6386
|
-
this._data.emoji = e, this._dom !== null && (this._dom.emojiButton.textContent = e, this._dom.emojiButton.setAttribute("aria-label", e === "" ? this.api.i18n.t(
|
|
6437
|
+
this._data.emoji = e, this._dom !== null && (this._dom.emojiButton.textContent = e, this._dom.emojiButton.setAttribute("aria-label", e === "" ? this.api.i18n.t(Sa) : e));
|
|
6387
6438
|
}
|
|
6388
6439
|
static get toolbox() {
|
|
6389
6440
|
return {
|
|
6390
6441
|
icon: ie,
|
|
6391
6442
|
title: "Callout",
|
|
6392
6443
|
titleKey: "callout",
|
|
6393
|
-
name:
|
|
6444
|
+
name: ya,
|
|
6394
6445
|
searchTerms: [
|
|
6395
6446
|
"callout",
|
|
6396
6447
|
"note",
|
|
@@ -6411,7 +6462,7 @@ var co = {
|
|
|
6411
6462
|
}
|
|
6412
6463
|
static get conversionConfig() {
|
|
6413
6464
|
return { import: () => ({
|
|
6414
|
-
emoji:
|
|
6465
|
+
emoji: La,
|
|
6415
6466
|
textColor: null,
|
|
6416
6467
|
backgroundColor: null
|
|
6417
6468
|
}) };
|
|
@@ -6429,7 +6480,7 @@ var co = {
|
|
|
6429
6480
|
static get isReadOnlySupported() {
|
|
6430
6481
|
return !0;
|
|
6431
6482
|
}
|
|
6432
|
-
},
|
|
6483
|
+
}, fo = class {
|
|
6433
6484
|
constructor(e) {
|
|
6434
6485
|
this.element = null;
|
|
6435
6486
|
}
|
|
@@ -6482,7 +6533,7 @@ var co = {
|
|
|
6482
6533
|
static get sanitize() {
|
|
6483
6534
|
return {};
|
|
6484
6535
|
}
|
|
6485
|
-
},
|
|
6536
|
+
}, po = "tools.quote.placeholder", mo = [
|
|
6486
6537
|
"border-l-[3px]",
|
|
6487
6538
|
"border-current",
|
|
6488
6539
|
"pl-[0.9em]",
|
|
@@ -6492,7 +6543,7 @@ var co = {
|
|
|
6492
6543
|
"outline-hidden",
|
|
6493
6544
|
"mt-[0.3em]",
|
|
6494
6545
|
"mb-[0.3em]"
|
|
6495
|
-
],
|
|
6546
|
+
], ho = "text-[1.2em]", go = class {
|
|
6496
6547
|
constructor({ data: e, api: t, readOnly: n }) {
|
|
6497
6548
|
var r, i;
|
|
6498
6549
|
this.placeholderCleanup = null, this._element = null, this.api = t, this.readOnly = n, this._data = {
|
|
@@ -6505,13 +6556,13 @@ var co = {
|
|
|
6505
6556
|
}
|
|
6506
6557
|
drawView() {
|
|
6507
6558
|
let e = document.createElement("blockquote");
|
|
6508
|
-
return e.className = k(this.api.styles.block,
|
|
6559
|
+
return e.className = k(this.api.styles.block, mo, xt, this._data.size === "large" ? ho : ""), e.setAttribute(C.tool, "quote"), e.contentEditable = "false", this._data.text ? e.innerHTML = this._data.text : this.readOnly && (e.innerHTML = "<br>"), this.readOnly || (e.contentEditable = "true", e.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = A(e, this.api.i18n.t(po), "data-blok-placeholder-active")), e;
|
|
6509
6560
|
}
|
|
6510
6561
|
render() {
|
|
6511
6562
|
return this._element || (this._element = this.drawView()), this._element;
|
|
6512
6563
|
}
|
|
6513
6564
|
setReadOnly(e) {
|
|
6514
|
-
this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), Ct(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = A(this._element, this.api.i18n.t(
|
|
6565
|
+
this._element && (this.readOnly = e, e ? (this._element.contentEditable = "false", this._element.removeEventListener("keyup", this.onKeyUp), this.placeholderCleanup && (this.placeholderCleanup(), this.placeholderCleanup = null), Ct(this._element) && (this._element.innerHTML = "<br>")) : (this._element.contentEditable = "true", this._element.addEventListener("keyup", this.onKeyUp), this.placeholderCleanup = A(this._element, this.api.i18n.t(po), "data-blok-placeholder-active"), this._element.innerHTML === "<br>" && (this._element.innerHTML = "")));
|
|
6515
6566
|
}
|
|
6516
6567
|
save(e) {
|
|
6517
6568
|
return {
|
|
@@ -6551,7 +6602,7 @@ var co = {
|
|
|
6551
6602
|
}];
|
|
6552
6603
|
}
|
|
6553
6604
|
setSize(e) {
|
|
6554
|
-
this._data.size = e, this._element && (this._element.className = k(this.api.styles.block,
|
|
6605
|
+
this._data.size = e, this._element && (this._element.className = k(this.api.styles.block, mo, xt, e === "large" ? ho : ""));
|
|
6555
6606
|
}
|
|
6556
6607
|
onPaste(e) {
|
|
6557
6608
|
let t = e.detail;
|
|
@@ -6598,7 +6649,7 @@ var co = {
|
|
|
6598
6649
|
static get pasteConfig() {
|
|
6599
6650
|
return { tags: ["BLOCKQUOTE"] };
|
|
6600
6651
|
}
|
|
6601
|
-
},
|
|
6652
|
+
}, _o = "tools.code.language", vo = "tools.code.copied", yo = "tools.code.copyCode", bo = "tools.code.searchLanguage", xo = "plain text", So = [
|
|
6602
6653
|
{
|
|
6603
6654
|
id: "plain text",
|
|
6604
6655
|
name: "Plain Text"
|
|
@@ -6723,12 +6774,12 @@ var co = {
|
|
|
6723
6774
|
id: "lua",
|
|
6724
6775
|
name: "Lua"
|
|
6725
6776
|
}
|
|
6726
|
-
],
|
|
6777
|
+
], Co = "group/code flex flex-col rounded-xl border border-border-secondary bg-bg-secondary overflow-hidden my-2", wo = "flex items-center gap-1 px-3 py-1.5 text-xs text-gray-text", To = "inline-flex items-center px-1.5 py-0.5 rounded cursor-pointer bg-transparent border-0 text-xs text-gray-text font-medium transition-colors can-hover:hover:bg-item-hover-bg select-none", Eo = "flex items-center gap-1 opacity-0 group-hover/code:opacity-100 transition-opacity", Do = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", Oo = "p-1.5 rounded-lg cursor-pointer bg-transparent border-0 text-gray-text transition-colors can-hover:hover:bg-item-hover-bg flex items-center justify-center", ko = "block px-4 py-3 font-mono text-sm leading-relaxed outline-hidden whitespace-pre-wrap overflow-x-auto min-h-[1.5em]", Ao = "text-xs text-gray-text font-medium select-none", jo = new Set(["latex", "mermaid"]), Mo = "tools.code.codeTab", No = "tools.code.previewTab", Po = "px-4 py-3 overflow-x-auto min-h-[1.5em] flex justify-center", Fo = "tools.code.sideBySide", Io = "flex items-center rounded-lg border border-border-secondary p-0.5 gap-0.5", Lo = "p-1 rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Ro = "p-1 rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", zo = "p-[6px] rounded cursor-pointer bg-transparent border-0 text-gray-text transition-colors flex items-center justify-center", Bo = "p-[6px] rounded cursor-pointer bg-item-hover-bg border-0 text-primary transition-colors flex items-center justify-center", Vo = "flex flex-col overflow-hidden", Ho = "flex flex-row overflow-hidden", Uo = "flex-1 min-w-0 overflow-hidden", Wo = "one-light", Go = "vitesse-dark", Ko = ".dark", qo = new Set(So.map((e) => e.id).filter((e) => e !== xo)), Jo = "flex overflow-hidden", Yo = "select-none text-right pl-4 pr-3 py-3 font-mono text-sm leading-relaxed text-gray-text/40 shrink-0", Xo = "leading-relaxed";
|
|
6727
6778
|
//#endregion
|
|
6728
6779
|
//#region src/tools/code/dom-builder.ts
|
|
6729
|
-
function
|
|
6780
|
+
function Zo(e) {
|
|
6730
6781
|
let t = document.createElement("div");
|
|
6731
|
-
t.className =
|
|
6782
|
+
t.className = Io, t.setAttribute("role", "group"), t.setAttribute("data-blok-testid", "code-view-mode");
|
|
6732
6783
|
let n = [
|
|
6733
6784
|
{
|
|
6734
6785
|
mode: "code",
|
|
@@ -6748,61 +6799,61 @@ function Xo(e) {
|
|
|
6748
6799
|
];
|
|
6749
6800
|
for (let { mode: e, icon: r, label: i } of n) {
|
|
6750
6801
|
let n = document.createElement("button"), a = e === "preview";
|
|
6751
|
-
n.type = "button", n.className = a ?
|
|
6802
|
+
n.type = "button", n.className = a ? zo : Lo, n.innerHTML = r, n.setAttribute("aria-label", i), n.setAttribute("aria-pressed", "false"), n.setAttribute("data-blok-testid", `code-mode-${e}`), n.setAttribute("data-mode", e), t.appendChild(n);
|
|
6752
6803
|
}
|
|
6753
6804
|
let r = document.createElement("div");
|
|
6754
|
-
r.className =
|
|
6805
|
+
r.className = Po, r.setAttribute("data-blok-testid", "code-preview");
|
|
6755
6806
|
let i = document.createElement("div");
|
|
6756
|
-
return i.className =
|
|
6807
|
+
return i.className = Vo, i.setAttribute("data-blok-testid", "code-split-container"), {
|
|
6757
6808
|
viewModeContainer: t,
|
|
6758
6809
|
previewElement: r,
|
|
6759
6810
|
splitContainer: i
|
|
6760
6811
|
};
|
|
6761
6812
|
}
|
|
6762
|
-
function
|
|
6813
|
+
function Qo(e, t) {
|
|
6763
6814
|
let n = Array.from(e.querySelectorAll("[data-mode]"));
|
|
6764
6815
|
for (let e of n) {
|
|
6765
6816
|
let n = e.getAttribute("data-mode") === t, r = e.getAttribute("data-mode") === "preview";
|
|
6766
|
-
e.setAttribute("aria-pressed", String(n)), r ? e.className = n ?
|
|
6817
|
+
e.setAttribute("aria-pressed", String(n)), r ? e.className = n ? Bo : zo : e.className = n ? Ro : Lo;
|
|
6767
6818
|
}
|
|
6768
6819
|
}
|
|
6769
|
-
function
|
|
6820
|
+
function $o(e) {
|
|
6770
6821
|
var n, r, i;
|
|
6771
6822
|
let { code: a, languageName: o, readOnly: s, copyLabel: c, previewable: l, viewModeLabels: u } = e, d = document.createElement("div");
|
|
6772
|
-
d.className =
|
|
6823
|
+
d.className = Co;
|
|
6773
6824
|
let f = document.createElement("div");
|
|
6774
|
-
f.className =
|
|
6825
|
+
f.className = wo;
|
|
6775
6826
|
let p = document.createElement("button");
|
|
6776
|
-
p.type = "button", p.className =
|
|
6827
|
+
p.type = "button", p.className = To, p.setAttribute("aria-haspopup", "listbox"), p.setAttribute("data-blok-testid", "code-language-btn");
|
|
6777
6828
|
let m = document.createElement("span");
|
|
6778
6829
|
m.textContent = o, p.appendChild(m);
|
|
6779
6830
|
let h = document.createElement("span");
|
|
6780
6831
|
h.className = "inline-flex items-center ml-0.5 -mr-0.5", h.innerHTML = t, p.appendChild(h);
|
|
6781
6832
|
let g = document.createElement("div");
|
|
6782
6833
|
g.className = "flex-1";
|
|
6783
|
-
let _ = !s && u ?
|
|
6834
|
+
let _ = !s && u ? Zo(u) : null, v = (n = _ == null ? void 0 : _.viewModeContainer) == null ? null : n, ee = (r = _ == null ? void 0 : _.previewElement) == null ? null : r, y = (i = _ == null ? void 0 : _.splitContainer) == null ? null : i;
|
|
6784
6835
|
v && (v.hidden = !l);
|
|
6785
6836
|
let b = document.createElement("button");
|
|
6786
|
-
b.type = "button", b.className = l ?
|
|
6837
|
+
b.type = "button", b.className = l ? Oo : Do, b.innerHTML = oe, b.setAttribute("aria-label", c), b.setAttribute("data-blok-testid", "code-copy-btn");
|
|
6787
6838
|
let x = document.createElement("code");
|
|
6788
|
-
x.className =
|
|
6839
|
+
x.className = ko, x.setAttribute("data-blok-testid", "code-content"), a && (x.textContent = a), s || (x.setAttribute("contenteditable", "plaintext-only"), x.setAttribute("spellcheck", "false"));
|
|
6789
6840
|
let S = document.createElement("div");
|
|
6790
|
-
S.className =
|
|
6841
|
+
S.className = Yo, S.setAttribute("aria-hidden", "true"), S.setAttribute("data-blok-testid", "code-gutter");
|
|
6791
6842
|
let te = a ? a.split("\n").length : 1;
|
|
6792
6843
|
Array.from({ length: te }, (e, t) => {
|
|
6793
6844
|
let n = document.createElement("div");
|
|
6794
|
-
n.className =
|
|
6845
|
+
n.className = Xo, n.textContent = String(t + 1), S.appendChild(n);
|
|
6795
6846
|
}), f.appendChild(p), f.appendChild(g);
|
|
6796
6847
|
let ne = document.createElement("div");
|
|
6797
|
-
ne.className =
|
|
6848
|
+
ne.className = Eo, v && ne.appendChild(v), ne.appendChild(b), f.appendChild(ne);
|
|
6798
6849
|
let re = document.createElement("pre");
|
|
6799
6850
|
re.appendChild(x);
|
|
6800
6851
|
let ie = document.createElement("div");
|
|
6801
|
-
if (ie.className =
|
|
6852
|
+
if (ie.className = Jo, ie.appendChild(S), ie.appendChild(re), d.appendChild(f), y && ee) {
|
|
6802
6853
|
let e = document.createElement("div");
|
|
6803
|
-
e.className =
|
|
6854
|
+
e.className = Uo, e.appendChild(ie);
|
|
6804
6855
|
let t = document.createElement("div");
|
|
6805
|
-
t.className =
|
|
6856
|
+
t.className = Uo, t.appendChild(ee), y.appendChild(e), y.appendChild(t), d.appendChild(y);
|
|
6806
6857
|
} else d.appendChild(ie);
|
|
6807
6858
|
return {
|
|
6808
6859
|
wrapper: d,
|
|
@@ -6818,10 +6869,10 @@ function Qo(e) {
|
|
|
6818
6869
|
}
|
|
6819
6870
|
//#endregion
|
|
6820
6871
|
//#region src/tools/code/code-keyboard.ts
|
|
6821
|
-
function
|
|
6822
|
-
return e.key === "Enter" && e.shiftKey ? (n(), !0) : e.key === "Enter" ? (
|
|
6872
|
+
function es(e, t, n) {
|
|
6873
|
+
return e.key === "Enter" && e.shiftKey ? (n(), !0) : e.key === "Enter" ? (ts(t), !0) : e.key === "Tab" && !e.shiftKey ? (ns(), !0) : e.key === "Tab" && e.shiftKey ? (is(t), !0) : !1;
|
|
6823
6874
|
}
|
|
6824
|
-
function
|
|
6875
|
+
function ts(e) {
|
|
6825
6876
|
var t;
|
|
6826
6877
|
let n = window.getSelection();
|
|
6827
6878
|
if (!n || n.rangeCount === 0) return;
|
|
@@ -6829,9 +6880,9 @@ function es(e) {
|
|
|
6829
6880
|
i.selectNodeContents(e), i.setEnd(r.startContainer, r.startOffset);
|
|
6830
6881
|
let a = i.toString().length, o = (t = e.textContent) == null ? "" : t, s = o.substring(0, a), c = o.substring(a);
|
|
6831
6882
|
for (; e.firstChild;) e.removeChild(e.firstChild);
|
|
6832
|
-
e.appendChild(document.createTextNode(s + "\n" + c)),
|
|
6883
|
+
e.appendChild(document.createTextNode(s + "\n" + c)), as(e, a + 1);
|
|
6833
6884
|
}
|
|
6834
|
-
function
|
|
6885
|
+
function ns() {
|
|
6835
6886
|
let e = window.getSelection();
|
|
6836
6887
|
if (!e || e.rangeCount === 0) return;
|
|
6837
6888
|
let t = e.getRangeAt(0);
|
|
@@ -6839,23 +6890,23 @@ function ts() {
|
|
|
6839
6890
|
let n = document.createTextNode(" ");
|
|
6840
6891
|
t.insertNode(n), t.setStartAfter(n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
6841
6892
|
}
|
|
6842
|
-
function
|
|
6893
|
+
function rs(e) {
|
|
6843
6894
|
let t = Math.min(2, e.length), n = e.substring(0, t).match(/^ */);
|
|
6844
6895
|
return n ? n[0].length : 0;
|
|
6845
6896
|
}
|
|
6846
|
-
function
|
|
6897
|
+
function is(e) {
|
|
6847
6898
|
var t;
|
|
6848
6899
|
let n = window.getSelection();
|
|
6849
6900
|
if (!n || n.rangeCount === 0) return;
|
|
6850
6901
|
let r = n.getRangeAt(0), i = (t = e.textContent) == null ? "" : t, a = r.cloneRange();
|
|
6851
6902
|
a.selectNodeContents(e), a.setEnd(r.startContainer, r.startOffset);
|
|
6852
|
-
let o = a.toString().length, s = i.lastIndexOf("\n", o - 1) + 1, c =
|
|
6903
|
+
let o = a.toString().length, s = i.lastIndexOf("\n", o - 1) + 1, c = rs(i.substring(s));
|
|
6853
6904
|
if (c === 0) return;
|
|
6854
6905
|
let l = i.substring(0, s) + i.substring(s + c);
|
|
6855
6906
|
for (; e.firstChild;) e.removeChild(e.firstChild);
|
|
6856
|
-
e.appendChild(document.createTextNode(l)),
|
|
6907
|
+
e.appendChild(document.createTextNode(l)), as(e, Math.max(s, o - c));
|
|
6857
6908
|
}
|
|
6858
|
-
function
|
|
6909
|
+
function as(e, t) {
|
|
6859
6910
|
let n = window.getSelection();
|
|
6860
6911
|
if (!n) return;
|
|
6861
6912
|
let r = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), i = (e) => {
|
|
@@ -6874,23 +6925,23 @@ function is(e, t) {
|
|
|
6874
6925
|
}
|
|
6875
6926
|
//#endregion
|
|
6876
6927
|
//#region src/tools/code/katex-loader.ts
|
|
6877
|
-
var
|
|
6928
|
+
var os = {
|
|
6878
6929
|
katexPromise: null,
|
|
6879
6930
|
cssInjected: !1
|
|
6880
6931
|
};
|
|
6881
|
-
function
|
|
6882
|
-
if (
|
|
6883
|
-
|
|
6932
|
+
function ss() {
|
|
6933
|
+
if (os.cssInjected) return;
|
|
6934
|
+
os.cssInjected = !0;
|
|
6884
6935
|
let e = document.createElement("link");
|
|
6885
6936
|
e.rel = "stylesheet", e.setAttribute("data-katex-css", ""), e.href = "https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css", document.head.appendChild(e);
|
|
6886
6937
|
}
|
|
6887
|
-
async function
|
|
6888
|
-
return
|
|
6938
|
+
async function cs() {
|
|
6939
|
+
return os.katexPromise || (os.katexPromise = import("./katex-CmTPfM0f.mjs").then((e) => e.n).then((e) => e.default)), os.katexPromise;
|
|
6889
6940
|
}
|
|
6890
|
-
async function
|
|
6891
|
-
|
|
6941
|
+
async function ls(e) {
|
|
6942
|
+
ss();
|
|
6892
6943
|
try {
|
|
6893
|
-
return (await
|
|
6944
|
+
return (await cs()).renderToString(e, {
|
|
6894
6945
|
throwOnError: !1,
|
|
6895
6946
|
displayMode: !0
|
|
6896
6947
|
});
|
|
@@ -6900,21 +6951,21 @@ async function cs(e) {
|
|
|
6900
6951
|
}
|
|
6901
6952
|
//#endregion
|
|
6902
6953
|
//#region src/tools/code/mermaid-loader.ts
|
|
6903
|
-
var
|
|
6954
|
+
var us = {
|
|
6904
6955
|
mermaidPromise: null,
|
|
6905
6956
|
initialized: !1
|
|
6906
6957
|
};
|
|
6907
|
-
async function
|
|
6908
|
-
|
|
6909
|
-
let e = await
|
|
6910
|
-
return
|
|
6958
|
+
async function ds() {
|
|
6959
|
+
us.mermaidPromise || (us.mermaidPromise = import("./mermaid.core-CA8nc1sZ.mjs").then((e) => e.default));
|
|
6960
|
+
let e = await us.mermaidPromise;
|
|
6961
|
+
return us.initialized || (us.initialized = !0, e.initialize({
|
|
6911
6962
|
startOnLoad: !1,
|
|
6912
6963
|
securityLevel: "strict"
|
|
6913
6964
|
})), e;
|
|
6914
6965
|
}
|
|
6915
|
-
async function
|
|
6966
|
+
async function fs(e) {
|
|
6916
6967
|
try {
|
|
6917
|
-
let t = await
|
|
6968
|
+
let t = await ds();
|
|
6918
6969
|
if (await t.parse(e, { suppressErrors: !0 }) === !1) return "<span class=\"text-red-500 text-sm\">Invalid Mermaid syntax</span>";
|
|
6919
6970
|
let n = `mermaid-${crypto.randomUUID()}`;
|
|
6920
6971
|
return (await t.render(n, e)).svg;
|
|
@@ -6924,7 +6975,7 @@ async function ds(e) {
|
|
|
6924
6975
|
}
|
|
6925
6976
|
//#endregion
|
|
6926
6977
|
//#region src/tools/code/shiki-loader.ts
|
|
6927
|
-
var
|
|
6978
|
+
var ps = {
|
|
6928
6979
|
javascript: () => import("./javascript-CBgeF1Xx.mjs"),
|
|
6929
6980
|
typescript: () => import("./typescript-DO5cd4m8.mjs").then((e) => e.n),
|
|
6930
6981
|
python: () => import("./python-DfwfY9t5.mjs"),
|
|
@@ -6955,29 +7006,29 @@ var fs = {
|
|
|
6955
7006
|
lua: () => import("./lua-DV0fuZWx.mjs"),
|
|
6956
7007
|
latex: () => import("./latex-24n3TcOR.mjs"),
|
|
6957
7008
|
mermaid: () => import("./mermaid-vF0cEnZ0.mjs")
|
|
6958
|
-
},
|
|
7009
|
+
}, ms = {
|
|
6959
7010
|
highlighterPromise: null,
|
|
6960
7011
|
highlighter: null
|
|
6961
7012
|
};
|
|
6962
|
-
function
|
|
6963
|
-
return
|
|
7013
|
+
function hs(e) {
|
|
7014
|
+
return qo.has(e);
|
|
6964
7015
|
}
|
|
6965
|
-
async function
|
|
6966
|
-
return
|
|
7016
|
+
async function gs() {
|
|
7017
|
+
return ms.highlighterPromise || (ms.highlighterPromise = (async () => {
|
|
6967
7018
|
let { createHighlighterCore: e } = await import("./core-Bm6DWt7D.mjs"), { createJavaScriptRegexEngine: t } = await import("./engine-javascript-CJpnSvzf.mjs"), n = await e({
|
|
6968
7019
|
themes: [import("./one-light-DmNO_Y4X.mjs"), import("./vitesse-dark-CcorSKT2.mjs")],
|
|
6969
7020
|
langs: [],
|
|
6970
7021
|
engine: t()
|
|
6971
7022
|
});
|
|
6972
|
-
return
|
|
6973
|
-
})()),
|
|
7023
|
+
return ms.highlighter = n, n;
|
|
7024
|
+
})()), ms.highlighterPromise;
|
|
6974
7025
|
}
|
|
6975
|
-
async function
|
|
7026
|
+
async function _s(e, t) {
|
|
6976
7027
|
if (e.getLoadedLanguages().includes(t)) return;
|
|
6977
|
-
let n =
|
|
7028
|
+
let n = ps[t];
|
|
6978
7029
|
n && await e.loadLanguage(await n());
|
|
6979
7030
|
}
|
|
6980
|
-
function
|
|
7031
|
+
function vs(e) {
|
|
6981
7032
|
return {
|
|
6982
7033
|
tokens: e.tokens.map((t) => t.map((t) => {
|
|
6983
7034
|
var n;
|
|
@@ -6990,52 +7041,52 @@ function _s(e) {
|
|
|
6990
7041
|
fg: e.fg
|
|
6991
7042
|
};
|
|
6992
7043
|
}
|
|
6993
|
-
async function
|
|
6994
|
-
if (!
|
|
7044
|
+
async function ys(e, t) {
|
|
7045
|
+
if (!hs(t)) return null;
|
|
6995
7046
|
try {
|
|
6996
|
-
let n = await
|
|
6997
|
-
await
|
|
7047
|
+
let n = await gs();
|
|
7048
|
+
await _s(n, t);
|
|
6998
7049
|
let r = n.codeToTokens(e, {
|
|
6999
7050
|
lang: t,
|
|
7000
|
-
theme:
|
|
7051
|
+
theme: Wo
|
|
7001
7052
|
}), i = n.codeToTokens(e, {
|
|
7002
7053
|
lang: t,
|
|
7003
|
-
theme:
|
|
7054
|
+
theme: Go
|
|
7004
7055
|
});
|
|
7005
7056
|
return {
|
|
7006
|
-
light:
|
|
7007
|
-
dark:
|
|
7057
|
+
light: vs(r),
|
|
7058
|
+
dark: vs(i)
|
|
7008
7059
|
};
|
|
7009
7060
|
} catch (e) {
|
|
7010
|
-
return
|
|
7061
|
+
return ms.highlighterPromise = null, ms.highlighter = null, null;
|
|
7011
7062
|
}
|
|
7012
7063
|
}
|
|
7013
7064
|
//#endregion
|
|
7014
7065
|
//#region src/tools/code/highlight-applier.ts
|
|
7015
|
-
var
|
|
7066
|
+
var bs = {
|
|
7016
7067
|
stylesheet: null,
|
|
7017
7068
|
knownRules: /* @__PURE__ */ new Set()
|
|
7018
7069
|
};
|
|
7019
|
-
function
|
|
7070
|
+
function xs() {
|
|
7020
7071
|
return typeof CSS < "u" && "highlights" in CSS;
|
|
7021
7072
|
}
|
|
7022
|
-
function
|
|
7073
|
+
function Ss() {
|
|
7023
7074
|
return CSS.highlights;
|
|
7024
7075
|
}
|
|
7025
|
-
function
|
|
7026
|
-
return
|
|
7076
|
+
function Cs() {
|
|
7077
|
+
return bs.stylesheet || (bs.stylesheet = new CSSStyleSheet(), document.adoptedStyleSheets = [...document.adoptedStyleSheets, bs.stylesheet]), bs.stylesheet;
|
|
7027
7078
|
}
|
|
7028
|
-
function
|
|
7079
|
+
function ws(e) {
|
|
7029
7080
|
let t = e.replace("#", "").toLowerCase();
|
|
7030
7081
|
return t.length > 6 ? t.substring(0, 6) : t;
|
|
7031
7082
|
}
|
|
7032
|
-
function
|
|
7083
|
+
function Ts(e, t, n, r) {
|
|
7033
7084
|
let i = `${r == null ? "" : r}::${t}`;
|
|
7034
|
-
if (
|
|
7085
|
+
if (bs.knownRules.has(i)) return;
|
|
7035
7086
|
let a = r ? `${r} ::highlight(${t}) { color: ${n}; }` : `::highlight(${t}) { color: ${n}; }`;
|
|
7036
|
-
e.insertRule(a, e.cssRules.length),
|
|
7087
|
+
e.insertRule(a, e.cssRules.length), bs.knownRules.add(i);
|
|
7037
7088
|
}
|
|
7038
|
-
function
|
|
7089
|
+
function Es(e, t) {
|
|
7039
7090
|
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT), r = (i, a) => {
|
|
7040
7091
|
var o, s;
|
|
7041
7092
|
if (!i) {
|
|
@@ -7056,7 +7107,7 @@ function Ts(e, t) {
|
|
|
7056
7107
|
};
|
|
7057
7108
|
return r(n.nextNode(), 0);
|
|
7058
7109
|
}
|
|
7059
|
-
function
|
|
7110
|
+
function Ds(e) {
|
|
7060
7111
|
return e.split("\n").reduce((e, t) => ({
|
|
7061
7112
|
offsets: [...e.offsets, e.pos],
|
|
7062
7113
|
pos: e.pos + t.length + 1
|
|
@@ -7065,30 +7116,30 @@ function Es(e) {
|
|
|
7065
7116
|
pos: 0
|
|
7066
7117
|
}).offsets;
|
|
7067
7118
|
}
|
|
7068
|
-
function
|
|
7119
|
+
function Os(e, t, n, r, i, a, o, s, c) {
|
|
7069
7120
|
if (!r.content.trim()) return;
|
|
7070
7121
|
let l = n + r.offset, u = l + r.content.length;
|
|
7071
7122
|
if (u > t.length) return;
|
|
7072
|
-
let d =
|
|
7123
|
+
let d = Es(e, l), f = Es(e, u);
|
|
7073
7124
|
if (!(!d || !f)) try {
|
|
7074
7125
|
let e = new Range();
|
|
7075
7126
|
e.setStart(d.node, d.offset), e.setEnd(f.node, f.offset);
|
|
7076
|
-
let t = `blok-${i}-${
|
|
7077
|
-
|
|
7127
|
+
let t = `blok-${i}-${ws(r.color)}`, n = Ss();
|
|
7128
|
+
Ts(s, t, r.color, a);
|
|
7078
7129
|
let l = n.get(t), u = l == null ? new Highlight() : l;
|
|
7079
7130
|
l || (u.priority = o, n.set(t, u)), u.add(e), c.push([t, e]);
|
|
7080
7131
|
} catch (e) {}
|
|
7081
7132
|
}
|
|
7082
|
-
function
|
|
7133
|
+
function ks(e, t, n, r, i, a, o, s, c) {
|
|
7083
7134
|
for (let [l, u] of r.tokens.entries()) {
|
|
7084
7135
|
let r = n[l];
|
|
7085
|
-
if (r !== void 0) for (let n of u)
|
|
7136
|
+
if (r !== void 0) for (let n of u) Os(e, t, r, n, i, a, o, s, c);
|
|
7086
7137
|
}
|
|
7087
7138
|
}
|
|
7088
|
-
function
|
|
7139
|
+
function As(e, t) {
|
|
7089
7140
|
var n;
|
|
7090
|
-
if (!
|
|
7091
|
-
let r =
|
|
7141
|
+
if (!xs()) return () => {};
|
|
7142
|
+
let r = Cs(), i = [], a = (n = e.textContent) == null ? "" : n, o = Ds(a), s = [[
|
|
7092
7143
|
"l",
|
|
7093
7144
|
t.light,
|
|
7094
7145
|
void 0,
|
|
@@ -7096,13 +7147,13 @@ function ks(e, t) {
|
|
|
7096
7147
|
], [
|
|
7097
7148
|
"d",
|
|
7098
7149
|
t.dark,
|
|
7099
|
-
|
|
7150
|
+
Ko,
|
|
7100
7151
|
1
|
|
7101
7152
|
]];
|
|
7102
|
-
for (let [t, n, c, l] of s)
|
|
7103
|
-
return () =>
|
|
7153
|
+
for (let [t, n, c, l] of s) ks(e, a, o, n, t, c, l, r, i);
|
|
7154
|
+
return () => js(i, Ss());
|
|
7104
7155
|
}
|
|
7105
|
-
function
|
|
7156
|
+
function js(e, t) {
|
|
7106
7157
|
for (let [n, r] of e) {
|
|
7107
7158
|
let e = t.get(n);
|
|
7108
7159
|
e && (e.delete(r), e.size === 0 && t.delete(n));
|
|
@@ -7110,7 +7161,7 @@ function As(e, t) {
|
|
|
7110
7161
|
}
|
|
7111
7162
|
//#endregion
|
|
7112
7163
|
//#region src/tools/code/language-detector.ts
|
|
7113
|
-
var
|
|
7164
|
+
var Ms = [
|
|
7114
7165
|
"javascript",
|
|
7115
7166
|
"typescript",
|
|
7116
7167
|
"python",
|
|
@@ -7126,8 +7177,8 @@ var js = [
|
|
|
7126
7177
|
"yaml",
|
|
7127
7178
|
"markdown",
|
|
7128
7179
|
"php"
|
|
7129
|
-
],
|
|
7130
|
-
function
|
|
7180
|
+
], Ns = 20, Ps = .75, Fs = 2;
|
|
7181
|
+
function Is(e, t) {
|
|
7131
7182
|
let n = e.flat(), r = n.reduce((e, t) => e + t.content.length, 0);
|
|
7132
7183
|
if (r === 0) return 1;
|
|
7133
7184
|
let { fgChars: i, nonFgColors: a } = n.reduce((e, n) => ({
|
|
@@ -7137,16 +7188,16 @@ function Fs(e, t) {
|
|
|
7137
7188
|
fgChars: 0,
|
|
7138
7189
|
nonFgColors: /* @__PURE__ */ new Set()
|
|
7139
7190
|
});
|
|
7140
|
-
return a.size <
|
|
7191
|
+
return a.size < Fs ? 1 : i / r;
|
|
7141
7192
|
}
|
|
7142
|
-
async function
|
|
7143
|
-
if (e.length <
|
|
7144
|
-
let t = (await Promise.all(
|
|
7193
|
+
async function Ls(e) {
|
|
7194
|
+
if (e.length < Ns) return null;
|
|
7195
|
+
let t = (await Promise.all(Ms.map(async (t) => ({
|
|
7145
7196
|
lang: t,
|
|
7146
|
-
tokens: await
|
|
7197
|
+
tokens: await ys(e, t)
|
|
7147
7198
|
})))).reduce((e, { lang: t, tokens: n }) => {
|
|
7148
7199
|
if (!n) return e;
|
|
7149
|
-
let r =
|
|
7200
|
+
let r = Is(n.light.tokens, n.light.fg);
|
|
7150
7201
|
return r < e.score ? {
|
|
7151
7202
|
lang: t,
|
|
7152
7203
|
score: r
|
|
@@ -7155,35 +7206,35 @@ async function Is(e) {
|
|
|
7155
7206
|
lang: null,
|
|
7156
7207
|
score: Infinity
|
|
7157
7208
|
});
|
|
7158
|
-
return t.lang === null || t.score >=
|
|
7209
|
+
return t.lang === null || t.score >= Ps ? null : t.lang;
|
|
7159
7210
|
}
|
|
7160
7211
|
//#endregion
|
|
7161
7212
|
//#region src/tools/code/index.ts
|
|
7162
|
-
var
|
|
7213
|
+
var Rs = 1500, zs = class {
|
|
7163
7214
|
constructor({ data: e, api: t, readOnly: n }) {
|
|
7164
7215
|
var r, i, a;
|
|
7165
7216
|
this._dom = null, this._lineNumbers = !0, this._picker = null, this._viewMode = "preview", this._previewContainer = null, this._disposeHighlights = null, this._highlightRafId = null, this._detectedLanguage = null, this._detectionTimeoutId = null, this.api = t, this.readOnly = n, this._data = {
|
|
7166
7217
|
code: (r = e == null ? void 0 : e.code) == null ? "" : r,
|
|
7167
|
-
language: (i = e == null ? void 0 : e.language) == null ?
|
|
7218
|
+
language: (i = e == null ? void 0 : e.language) == null ? xo : i,
|
|
7168
7219
|
lineNumbers: e == null ? void 0 : e.lineNumbers
|
|
7169
7220
|
}, this._lineNumbers = (a = e == null ? void 0 : e.lineNumbers) == null ? !0 : a;
|
|
7170
7221
|
}
|
|
7171
7222
|
render() {
|
|
7172
|
-
let e =
|
|
7223
|
+
let e = jo.has(this._data.language), t = $o({
|
|
7173
7224
|
code: this._data.code,
|
|
7174
7225
|
languageName: this.getLanguageName(this._data.language),
|
|
7175
7226
|
readOnly: this.readOnly,
|
|
7176
|
-
copyLabel: this.api.i18n.t(
|
|
7227
|
+
copyLabel: this.api.i18n.t(yo),
|
|
7177
7228
|
previewable: this.readOnly ? !1 : e,
|
|
7178
7229
|
viewModeLabels: this.readOnly ? void 0 : {
|
|
7179
|
-
code: this.api.i18n.t(
|
|
7180
|
-
preview: this.api.i18n.t(
|
|
7181
|
-
split: this.api.i18n.t(
|
|
7230
|
+
code: this.api.i18n.t(Mo),
|
|
7231
|
+
preview: this.api.i18n.t(No),
|
|
7232
|
+
split: this.api.i18n.t(Fo)
|
|
7182
7233
|
}
|
|
7183
7234
|
});
|
|
7184
7235
|
if (this._dom = t, t.gutterElement.hidden = !this._lineNumbers, this.readOnly && e) {
|
|
7185
7236
|
let e = document.createElement("div");
|
|
7186
|
-
e.className =
|
|
7237
|
+
e.className = Po, e.setAttribute("data-blok-testid", "code-preview"), t.wrapper.appendChild(e), t.preElement.hidden = !0, t.gutterElement.hidden = !0, this._previewContainer = e, this.renderPreview();
|
|
7187
7238
|
}
|
|
7188
7239
|
if (!this.readOnly && e && t.previewElement && (this._viewMode = "preview", this._previewContainer = t.previewElement, this.applyViewMode(), this.renderPreview()), !this.readOnly && t.viewModeContainer) {
|
|
7189
7240
|
let e = Array.from(t.viewModeContainer.querySelectorAll("[data-mode]"));
|
|
@@ -7196,10 +7247,10 @@ var Ls = 1500, Rs = class {
|
|
|
7196
7247
|
}
|
|
7197
7248
|
}
|
|
7198
7249
|
return this.readOnly || (t.codeElement.addEventListener("keydown", (e) => {
|
|
7199
|
-
|
|
7250
|
+
es(e, t.codeElement, () => this.exitBlock()) && (e.preventDefault(), this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection());
|
|
7200
7251
|
}), t.codeElement.addEventListener("input", () => {
|
|
7201
7252
|
this.syncTrailingBr(), this.updateGutter(), this.scheduleHighlight(), this.scheduleDetection();
|
|
7202
|
-
})), t.copyButton.addEventListener("click", () => this.copyCode()), E(t.copyButton, this.api.i18n.t(
|
|
7253
|
+
})), t.copyButton.addEventListener("click", () => this.copyCode()), E(t.copyButton, this.api.i18n.t(yo), { placement: "bottom" }), this.readOnly || (this._picker = this.buildLanguagePicker(t.languageButton, t.wrapper), t.languageButton.addEventListener("click", () => {
|
|
7203
7254
|
var e;
|
|
7204
7255
|
if ((e = this._picker) != null && e.isShown) this._picker.hide();
|
|
7205
7256
|
else {
|
|
@@ -7221,17 +7272,17 @@ var Ls = 1500, Rs = class {
|
|
|
7221
7272
|
applyViewMode() {
|
|
7222
7273
|
var e, t;
|
|
7223
7274
|
if (!((e = this._dom) != null && e.previewElement) || !this._dom.viewModeContainer || !this._dom.splitContainer) return;
|
|
7224
|
-
|
|
7275
|
+
Qo(this._dom.viewModeContainer, this._viewMode);
|
|
7225
7276
|
let n = (t = this._dom.preElement.parentElement) == null ? void 0 : t.parentElement;
|
|
7226
7277
|
switch (this._viewMode) {
|
|
7227
7278
|
case "code":
|
|
7228
|
-
this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0, n && (n.hidden = !1), this._dom.splitContainer.className =
|
|
7279
|
+
this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !0, n && (n.hidden = !1), this._dom.splitContainer.className = Vo;
|
|
7229
7280
|
break;
|
|
7230
7281
|
case "preview":
|
|
7231
|
-
this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, n && (n.hidden = !0), this._dom.splitContainer.className =
|
|
7282
|
+
this._dom.preElement.hidden = !0, this._dom.gutterElement.hidden = !0, this._dom.previewElement.hidden = !1, n && (n.hidden = !0), this._dom.splitContainer.className = Vo;
|
|
7232
7283
|
break;
|
|
7233
7284
|
case "split":
|
|
7234
|
-
this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !1, n && (n.hidden = !1), this._dom.splitContainer.className =
|
|
7285
|
+
this._dom.preElement.hidden = !1, this._dom.gutterElement.hidden = !this._lineNumbers, this._dom.previewElement.hidden = !1, n && (n.hidden = !1), this._dom.splitContainer.className = Ho;
|
|
7235
7286
|
break;
|
|
7236
7287
|
}
|
|
7237
7288
|
}
|
|
@@ -7240,7 +7291,7 @@ var Ls = 1500, Rs = class {
|
|
|
7240
7291
|
let r = e._previewContainer;
|
|
7241
7292
|
if (!r) return;
|
|
7242
7293
|
let i = (t = (n = e._dom) == null ? void 0 : n.codeElement.textContent) == null ? e._data.code : t;
|
|
7243
|
-
r.innerHTML = e._data.language === "mermaid" ? await
|
|
7294
|
+
r.innerHTML = e._data.language === "mermaid" ? await fs(i) : await ls(i);
|
|
7244
7295
|
}
|
|
7245
7296
|
setReadOnly(e) {
|
|
7246
7297
|
this.readOnly = e, this._dom && (e ? (this._dom.codeElement.setAttribute("contenteditable", "false"), this._dom.codeElement.removeAttribute("spellcheck")) : (this._dom.codeElement.setAttribute("contenteditable", "plaintext-only"), this._dom.codeElement.setAttribute("spellcheck", "false")));
|
|
@@ -7262,7 +7313,7 @@ var Ls = 1500, Rs = class {
|
|
|
7262
7313
|
renderSettings() {
|
|
7263
7314
|
let e = this._data.language, t = this._detectedLanguage, n = t !== null && t !== e, r = [];
|
|
7264
7315
|
if (n) {
|
|
7265
|
-
let e =
|
|
7316
|
+
let e = So.find((e) => e.id === t);
|
|
7266
7317
|
e && (r.push({
|
|
7267
7318
|
title: e.name,
|
|
7268
7319
|
secondaryLabel: "auto",
|
|
@@ -7272,14 +7323,14 @@ var Ls = 1500, Rs = class {
|
|
|
7272
7323
|
isActive: () => this._data.language === e.id
|
|
7273
7324
|
}), r.push({ type: w.Separator }));
|
|
7274
7325
|
}
|
|
7275
|
-
return r.push(...
|
|
7326
|
+
return r.push(...So.map((t) => ({
|
|
7276
7327
|
title: t.name,
|
|
7277
7328
|
trailingIcon: t.id === e ? He : void 0,
|
|
7278
7329
|
onActivate: () => this.setLanguage(t.id),
|
|
7279
7330
|
closeOnActivate: !0
|
|
7280
7331
|
}))), [{
|
|
7281
7332
|
icon: ne,
|
|
7282
|
-
title: this.api.i18n.t(
|
|
7333
|
+
title: this.api.i18n.t(_o),
|
|
7283
7334
|
name: "code-language",
|
|
7284
7335
|
children: { items: r }
|
|
7285
7336
|
}];
|
|
@@ -7300,7 +7351,7 @@ var Ls = 1500, Rs = class {
|
|
|
7300
7351
|
}
|
|
7301
7352
|
setLanguage(e) {
|
|
7302
7353
|
this._data.language = e;
|
|
7303
|
-
let t =
|
|
7354
|
+
let t = jo.has(e);
|
|
7304
7355
|
if (this._dom) {
|
|
7305
7356
|
let n = this._dom.languageButton.querySelector("span");
|
|
7306
7357
|
n && (n.textContent = this.getLanguageName(e)), this._dom.viewModeContainer && (this._dom.viewModeContainer.hidden = !t), t && this._dom.previewElement && (this._previewContainer = this._dom.previewElement, this._viewMode = "preview", this.applyViewMode(), this.renderPreview()), t || (this._previewContainer = null, this._viewMode = "code", this.applyViewMode()), this._picker && this._picker.destroy(), this._picker = this.buildLanguagePicker(this._dom.languageButton, this._dom.wrapper);
|
|
@@ -7310,7 +7361,7 @@ var Ls = 1500, Rs = class {
|
|
|
7310
7361
|
buildLanguagePickerItems() {
|
|
7311
7362
|
let e = this._data.language, t = this._detectedLanguage, n = t !== null && t !== e, r = [];
|
|
7312
7363
|
if (n) {
|
|
7313
|
-
let e =
|
|
7364
|
+
let e = So.find((e) => e.id === t);
|
|
7314
7365
|
e && (r.push({
|
|
7315
7366
|
title: e.name,
|
|
7316
7367
|
name: e.id,
|
|
@@ -7321,7 +7372,7 @@ var Ls = 1500, Rs = class {
|
|
|
7321
7372
|
onActivate: () => this.setLanguage(e.id)
|
|
7322
7373
|
}), r.push({ type: w.Separator }));
|
|
7323
7374
|
}
|
|
7324
|
-
return r.push(...
|
|
7375
|
+
return r.push(...So.map((t) => ({
|
|
7325
7376
|
title: t.name,
|
|
7326
7377
|
name: t.id,
|
|
7327
7378
|
trailingIcon: t.id === e ? He : void 0,
|
|
@@ -7337,11 +7388,11 @@ var Ls = 1500, Rs = class {
|
|
|
7337
7388
|
leftAlignElement: t,
|
|
7338
7389
|
searchable: !0,
|
|
7339
7390
|
width: "200px",
|
|
7340
|
-
messages: { search: this.api.i18n.t(
|
|
7391
|
+
messages: { search: this.api.i18n.t(bo) }
|
|
7341
7392
|
});
|
|
7342
7393
|
}
|
|
7343
7394
|
getLanguageName(e) {
|
|
7344
|
-
let t =
|
|
7395
|
+
let t = So.find((t) => t.id === e);
|
|
7345
7396
|
return t ? t.name : e;
|
|
7346
7397
|
}
|
|
7347
7398
|
copyCode() {
|
|
@@ -7350,9 +7401,9 @@ var Ls = 1500, Rs = class {
|
|
|
7350
7401
|
navigator.clipboard.writeText(n).then(() => {
|
|
7351
7402
|
if (!this._dom) return;
|
|
7352
7403
|
let e = this._dom.copyButton, t = e.innerHTML;
|
|
7353
|
-
e.innerHTML = `<span class="${
|
|
7404
|
+
e.innerHTML = `<span class="${Ao}">${this.api.i18n.t(vo)}</span>`, setTimeout(() => {
|
|
7354
7405
|
e.innerHTML = t;
|
|
7355
|
-
},
|
|
7406
|
+
}, Rs);
|
|
7356
7407
|
}).catch(() => {});
|
|
7357
7408
|
}
|
|
7358
7409
|
updateGutter() {
|
|
@@ -7361,7 +7412,7 @@ var Ls = 1500, Rs = class {
|
|
|
7361
7412
|
let t = (e = this._dom.codeElement.textContent) == null ? "" : e, n = t ? t.split("\n").length : 1, r = this._dom.gutterElement;
|
|
7362
7413
|
r.children.length !== n && (r.innerHTML = "", Array.from({ length: n }, (e, t) => {
|
|
7363
7414
|
let n = document.createElement("div");
|
|
7364
|
-
n.className =
|
|
7415
|
+
n.className = Xo, n.textContent = String(t + 1), r.appendChild(n);
|
|
7365
7416
|
}));
|
|
7366
7417
|
}
|
|
7367
7418
|
syncTrailingBr() {
|
|
@@ -7378,14 +7429,14 @@ var Ls = 1500, Rs = class {
|
|
|
7378
7429
|
scheduleDetection() {
|
|
7379
7430
|
this._detectionTimeoutId !== null && clearTimeout(this._detectionTimeoutId), this._detectionTimeoutId = setTimeout(() => {
|
|
7380
7431
|
var e, t;
|
|
7381
|
-
this._detectionTimeoutId = null,
|
|
7432
|
+
this._detectionTimeoutId = null, Ls((e = (t = this._dom) == null ? void 0 : t.codeElement.textContent) == null ? "" : e).then((e) => {
|
|
7382
7433
|
e !== this._detectedLanguage && (this._detectedLanguage = e, this._dom && (this._picker && this._picker.destroy(), this._picker = this.buildLanguagePicker(this._dom.languageButton, this._dom.wrapper)));
|
|
7383
7434
|
});
|
|
7384
7435
|
}, 600);
|
|
7385
7436
|
}
|
|
7386
7437
|
async highlightCode() {
|
|
7387
7438
|
var e = this, t, n, r;
|
|
7388
|
-
if (!
|
|
7439
|
+
if (!xs() || !hs(e._data.language)) {
|
|
7389
7440
|
var i;
|
|
7390
7441
|
(i = e._disposeHighlights) == null || i.call(e), e._disposeHighlights = null;
|
|
7391
7442
|
return;
|
|
@@ -7396,8 +7447,8 @@ var Ls = 1500, Rs = class {
|
|
|
7396
7447
|
(o = e._disposeHighlights) == null || o.call(e), e._disposeHighlights = null;
|
|
7397
7448
|
return;
|
|
7398
7449
|
}
|
|
7399
|
-
let s = await
|
|
7400
|
-
!s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights =
|
|
7450
|
+
let s = await ys(a, e._data.language);
|
|
7451
|
+
!s || !e._dom || ((r = e._disposeHighlights) == null || r.call(e), e._disposeHighlights = As(e._dom.codeElement, s));
|
|
7401
7452
|
}
|
|
7402
7453
|
exitBlock() {
|
|
7403
7454
|
let e = this.api.blocks.getCurrentBlockIndex();
|
|
@@ -7444,36 +7495,36 @@ var Ls = 1500, Rs = class {
|
|
|
7444
7495
|
patterns: { code: /^```/ }
|
|
7445
7496
|
};
|
|
7446
7497
|
}
|
|
7447
|
-
},
|
|
7498
|
+
}, W = (e) => {
|
|
7448
7499
|
let t = e.tagName;
|
|
7449
7500
|
return t === "B" || t === "STRONG";
|
|
7450
|
-
},
|
|
7501
|
+
}, Bs = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && W(e)), Vs = (e) => e.textContent.length === 0, G = (e) => e ? e.nodeType === Node.ELEMENT_NODE && W(e) ? K(e) : G(e.parentNode) : null, K = (e) => {
|
|
7451
7502
|
if (e.tagName === "STRONG") return e;
|
|
7452
7503
|
let t = document.createElement("strong");
|
|
7453
7504
|
for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
|
|
7454
7505
|
t.setAttribute(e.name, e.value);
|
|
7455
7506
|
}); e.firstChild;) t.appendChild(e.firstChild);
|
|
7456
7507
|
return e.replaceWith(t), t;
|
|
7457
|
-
},
|
|
7508
|
+
}, Hs = (e) => {
|
|
7458
7509
|
let t = e.nextSibling;
|
|
7459
7510
|
if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE) return t;
|
|
7460
7511
|
let n = e.parentNode;
|
|
7461
7512
|
if (!n) return null;
|
|
7462
7513
|
let r = e.ownerDocument.createTextNode("");
|
|
7463
7514
|
return n.insertBefore(r, t), r;
|
|
7464
|
-
},
|
|
7515
|
+
}, Us = (e) => {
|
|
7465
7516
|
if (!e.boldElement.isConnected) return null;
|
|
7466
|
-
let t =
|
|
7517
|
+
let t = K(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Hs(t);
|
|
7467
7518
|
return r ? {
|
|
7468
7519
|
boundary: r,
|
|
7469
7520
|
boldElement: t
|
|
7470
7521
|
} : null;
|
|
7471
|
-
},
|
|
7522
|
+
}, Ws = (e, t) => e ? e === t || t.contains(e) : !1, Gs, q = {
|
|
7472
7523
|
COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
|
|
7473
7524
|
COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
|
|
7474
7525
|
PREV_LENGTH: "data-blok-bold-prev-length",
|
|
7475
7526
|
LEADING_WHITESPACE: "data-blok-bold-leading-ws"
|
|
7476
|
-
},
|
|
7527
|
+
}, J = class e {
|
|
7477
7528
|
constructor() {
|
|
7478
7529
|
this.records = /* @__PURE__ */ new Set();
|
|
7479
7530
|
}
|
|
@@ -7487,15 +7538,15 @@ var Ls = 1500, Rs = class {
|
|
|
7487
7538
|
return this.records.size > 0;
|
|
7488
7539
|
}
|
|
7489
7540
|
isActivePlaceholder(e) {
|
|
7490
|
-
return e.getAttribute(
|
|
7541
|
+
return e.getAttribute(q.COLLAPSED_ACTIVE) === "true" || e.hasAttribute(q.COLLAPSED_LENGTH);
|
|
7491
7542
|
}
|
|
7492
7543
|
static get ATTR() {
|
|
7493
|
-
return
|
|
7544
|
+
return q;
|
|
7494
7545
|
}
|
|
7495
7546
|
enter(e, t) {
|
|
7496
7547
|
if (!e.collapsed) return;
|
|
7497
7548
|
let n = document.createElement("strong"), r = document.createTextNode("");
|
|
7498
|
-
n.appendChild(r), n.setAttribute(
|
|
7549
|
+
n.appendChild(r), n.setAttribute(q.COLLAPSED_ACTIVE, "true");
|
|
7499
7550
|
let i = e.startContainer, a = e.startOffset;
|
|
7500
7551
|
if (!(i.nodeType === Node.TEXT_NODE ? this.insertCollapsedBoldIntoText(i, n, a) : i.nodeType === Node.ELEMENT_NODE && (this.insertCollapsedBoldIntoElement(i, n, a), !0))) return;
|
|
7501
7552
|
let o = document.createRange();
|
|
@@ -7512,23 +7563,23 @@ var Ls = 1500, Rs = class {
|
|
|
7512
7563
|
let i = e.textContent, a = i.slice(0, n), o = i.slice(n);
|
|
7513
7564
|
e.textContent = a;
|
|
7514
7565
|
let s = o.length ? document.createTextNode(o) : null;
|
|
7515
|
-
return s && r.insertBefore(s, e.nextSibling), r.insertBefore(t, s == null ? e.nextSibling : s), t.setAttribute(
|
|
7566
|
+
return s && r.insertBefore(s, e.nextSibling), r.insertBefore(t, s == null ? e.nextSibling : s), t.setAttribute(q.PREV_LENGTH, a.length.toString()), !0;
|
|
7516
7567
|
}
|
|
7517
7568
|
insertCollapsedBoldIntoElement(e, t, n) {
|
|
7518
7569
|
var r;
|
|
7519
7570
|
let i = (r = e.childNodes[n]) == null ? null : r;
|
|
7520
|
-
e.insertBefore(t, i), t.setAttribute(
|
|
7571
|
+
e.insertBefore(t, i), t.setAttribute(q.PREV_LENGTH, "0");
|
|
7521
7572
|
}
|
|
7522
7573
|
exit(e, t) {
|
|
7523
|
-
let n =
|
|
7524
|
-
if (r) return
|
|
7574
|
+
let n = K(t), r = n.parentNode;
|
|
7575
|
+
if (r) return Vs(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
|
|
7525
7576
|
}
|
|
7526
7577
|
removeEmptyBoldElement(e, t, n) {
|
|
7527
7578
|
let r = document.createRange();
|
|
7528
7579
|
return r.setStartBefore(t), r.collapse(!0), n.removeChild(t), e.removeAllRanges(), e.addRange(r), r;
|
|
7529
7580
|
}
|
|
7530
7581
|
exitBoldWithContent(e, t, n) {
|
|
7531
|
-
t.setAttribute(
|
|
7582
|
+
t.setAttribute(q.COLLAPSED_LENGTH, t.textContent.length.toString()), t.removeAttribute(q.PREV_LENGTH), t.removeAttribute(q.COLLAPSED_ACTIVE), t.removeAttribute(q.LEADING_WHITESPACE);
|
|
7532
7583
|
let r = t.nextSibling, i = !r || r.nodeType !== Node.TEXT_NODE, a = i ? document.createTextNode("") : null;
|
|
7533
7584
|
a && n.insertBefore(a, r);
|
|
7534
7585
|
let o = a == null ? r : a;
|
|
@@ -7545,7 +7596,7 @@ var Ls = 1500, Rs = class {
|
|
|
7545
7596
|
}
|
|
7546
7597
|
maintain() {
|
|
7547
7598
|
if (!(typeof document > "u")) for (let e of Array.from(this.records)) {
|
|
7548
|
-
let t =
|
|
7599
|
+
let t = Us(e);
|
|
7549
7600
|
if (!t) {
|
|
7550
7601
|
this.records.delete(e);
|
|
7551
7602
|
continue;
|
|
@@ -7580,10 +7631,10 @@ var Ls = 1500, Rs = class {
|
|
|
7580
7631
|
var t, n;
|
|
7581
7632
|
let r = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t, i = r && r.nodeType === Node.ELEMENT_NODE ? r : r == null ? void 0 : r.parentElement, a = (n = i == null ? void 0 : i.closest(T(C.editor))) == null ? i == null ? void 0 : i.ownerDocument : n;
|
|
7582
7633
|
if (!a) return;
|
|
7583
|
-
let o = `strong[${
|
|
7634
|
+
let o = `strong[${q.COLLAPSED_ACTIVE}="true"]`;
|
|
7584
7635
|
a.querySelectorAll(o).forEach((t) => {
|
|
7585
7636
|
var n;
|
|
7586
|
-
let r = t.getAttribute(
|
|
7637
|
+
let r = t.getAttribute(q.PREV_LENGTH), i = t.previousSibling;
|
|
7587
7638
|
if (!r || !i || i.nodeType !== Node.TEXT_NODE) return;
|
|
7588
7639
|
let a = Number(r);
|
|
7589
7640
|
if (!Number.isFinite(a)) return;
|
|
@@ -7592,10 +7643,10 @@ var Ls = 1500, Rs = class {
|
|
|
7592
7643
|
let c = s.slice(0, a), l = s.slice(a);
|
|
7593
7644
|
o.textContent = c;
|
|
7594
7645
|
let u = l.match(/^[\u00A0\s]+/);
|
|
7595
|
-
if (u && !t.hasAttribute(
|
|
7596
|
-
let d = t.textContent, f = d + l, p = (n = t.getAttribute(
|
|
7646
|
+
if (u && !t.hasAttribute(q.LEADING_WHITESPACE) && t.setAttribute(q.LEADING_WHITESPACE, u[0]), l.length === 0) return;
|
|
7647
|
+
let d = t.textContent, f = d + l, p = (n = t.getAttribute(q.LEADING_WHITESPACE)) == null ? "" : n, m = p.length > 0 && d.length === 0 && !f.startsWith(p) ? p + f : f, h = document.createTextNode(m);
|
|
7597
7648
|
for (; t.firstChild;) t.removeChild(t.firstChild);
|
|
7598
|
-
if (t.appendChild(h), !(e != null && e.isCollapsed) || !
|
|
7649
|
+
if (t.appendChild(h), !(e != null && e.isCollapsed) || !Ws(e.focusNode, o)) return;
|
|
7599
7650
|
let g = document.createRange(), _ = h.textContent.length;
|
|
7600
7651
|
g.setStart(h, _), g.collapse(!0), e.removeAllRanges(), e.addRange(g);
|
|
7601
7652
|
});
|
|
@@ -7605,13 +7656,13 @@ var Ls = 1500, Rs = class {
|
|
|
7605
7656
|
let n = (t = e == null ? void 0 : e.anchorNode) == null ? e == null ? void 0 : e.focusNode : t;
|
|
7606
7657
|
if (!n) return;
|
|
7607
7658
|
let r = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, i = r == null ? void 0 : r.closest(T(C.editor));
|
|
7608
|
-
i && i.querySelectorAll(`strong[${
|
|
7659
|
+
i && i.querySelectorAll(`strong[${q.COLLAPSED_LENGTH}]`).forEach((t) => {
|
|
7609
7660
|
var n;
|
|
7610
|
-
let r = t.getAttribute(
|
|
7661
|
+
let r = t.getAttribute(q.COLLAPSED_LENGTH);
|
|
7611
7662
|
if (!r) return;
|
|
7612
7663
|
let i = Number(r), a = t.textContent;
|
|
7613
7664
|
if (!Number.isFinite(i)) return;
|
|
7614
|
-
let o = a.length > i, s = o ? this.splitCollapsedBoldText(t, i, a) : null, c = t.getAttribute(
|
|
7665
|
+
let o = a.length > i, s = o ? this.splitCollapsedBoldText(t, i, a) : null, c = t.getAttribute(q.PREV_LENGTH), l = c ? Number(c) : NaN, u = t.previousSibling, d = (u == null ? void 0 : u.nodeType) === Node.TEXT_NODE ? u : null, f = (n = d == null ? void 0 : d.textContent) == null ? "" : n, p = !!(c && Number.isFinite(l) && d && f.length > l);
|
|
7615
7666
|
if (p && d) {
|
|
7616
7667
|
var m;
|
|
7617
7668
|
let e = f.slice(0, l), n = f.slice(l);
|
|
@@ -7619,11 +7670,11 @@ var Ls = 1500, Rs = class {
|
|
|
7619
7670
|
let r = document.createTextNode(n);
|
|
7620
7671
|
(m = t.parentNode) == null || m.insertBefore(r, t.nextSibling);
|
|
7621
7672
|
}
|
|
7622
|
-
if (p && t.removeAttribute(
|
|
7673
|
+
if (p && t.removeAttribute(q.PREV_LENGTH), e != null && e.isCollapsed && s && Ws(e.focusNode, t)) {
|
|
7623
7674
|
let t = document.createRange(), n = s.textContent.length;
|
|
7624
7675
|
t.setStart(s, n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
|
|
7625
7676
|
}
|
|
7626
|
-
o && t.removeAttribute(
|
|
7677
|
+
o && t.removeAttribute(q.COLLAPSED_LENGTH);
|
|
7627
7678
|
});
|
|
7628
7679
|
}
|
|
7629
7680
|
splitCollapsedBoldText(e, t, n) {
|
|
@@ -7655,8 +7706,8 @@ var Ls = 1500, Rs = class {
|
|
|
7655
7706
|
if (!e.rangeCount) return;
|
|
7656
7707
|
let t = e.getRangeAt(0);
|
|
7657
7708
|
if (!t.collapsed) return;
|
|
7658
|
-
let n =
|
|
7659
|
-
(n == null ? void 0 : n.getAttribute(
|
|
7709
|
+
let n = G(t.startContainer);
|
|
7710
|
+
(n == null ? void 0 : n.getAttribute(q.COLLAPSED_ACTIVE)) !== "true" && (this.moveCaretFromElementContainer(e, t) || this.moveCaretFromTextContainer(e, t));
|
|
7660
7711
|
}
|
|
7661
7712
|
moveCaretFromElementContainer(e, t) {
|
|
7662
7713
|
if (t.startContainer.nodeType !== Node.ELEMENT_NODE) return !1;
|
|
@@ -7686,7 +7737,7 @@ var Ls = 1500, Rs = class {
|
|
|
7686
7737
|
this.setCaret(e, n, i.length);
|
|
7687
7738
|
return;
|
|
7688
7739
|
}
|
|
7689
|
-
let o =
|
|
7740
|
+
let o = G(n);
|
|
7690
7741
|
if (!o || t.startOffset !== n.textContent.length) return;
|
|
7691
7742
|
let s = this.ensureFollowingTextNode(o, o.nextSibling);
|
|
7692
7743
|
if (s) {
|
|
@@ -7713,18 +7764,18 @@ var Ls = 1500, Rs = class {
|
|
|
7713
7764
|
return t.tagName === "STRONG" || t.tagName === "B";
|
|
7714
7765
|
}
|
|
7715
7766
|
};
|
|
7716
|
-
|
|
7767
|
+
Gs = J, Gs.instance = null;
|
|
7717
7768
|
//#endregion
|
|
7718
7769
|
//#region src/components/inline-tools/services/bold-normalization-pass.ts
|
|
7719
|
-
var
|
|
7770
|
+
var Ks = {
|
|
7720
7771
|
convertLegacyTags: !0,
|
|
7721
7772
|
normalizeWhitespace: !0,
|
|
7722
7773
|
removeEmpty: !0,
|
|
7723
7774
|
mergeAdjacent: !0,
|
|
7724
7775
|
preserveNode: null
|
|
7725
|
-
},
|
|
7776
|
+
}, Y = class e {
|
|
7726
7777
|
constructor(e) {
|
|
7727
|
-
this.options = O(O({},
|
|
7778
|
+
this.options = O(O({}, Ks), e);
|
|
7728
7779
|
}
|
|
7729
7780
|
run(e) {
|
|
7730
7781
|
if (typeof document > "u") return;
|
|
@@ -7759,7 +7810,7 @@ var Gs = {
|
|
|
7759
7810
|
processCollectedElements(e, t) {
|
|
7760
7811
|
this.options.convertLegacyTags && e.forEach((e) => {
|
|
7761
7812
|
if (e.isConnected) {
|
|
7762
|
-
let n =
|
|
7813
|
+
let n = K(e);
|
|
7763
7814
|
t.push(n);
|
|
7764
7815
|
}
|
|
7765
7816
|
}), t.forEach((e) => {
|
|
@@ -7777,19 +7828,19 @@ var Gs = {
|
|
|
7777
7828
|
t.includes("\xA0") && (e.textContent = t.replace(/\u00A0/g, " "));
|
|
7778
7829
|
}
|
|
7779
7830
|
isEmptyAndSafe(e) {
|
|
7780
|
-
return e.textContent.length !== 0 ||
|
|
7831
|
+
return e.textContent.length !== 0 || J.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && Ws(this.options.preserveNode, e));
|
|
7781
7832
|
}
|
|
7782
7833
|
mergeWithAdjacent(e) {
|
|
7783
7834
|
let t = e.previousSibling;
|
|
7784
|
-
if (t &&
|
|
7835
|
+
if (t && Bs(t)) {
|
|
7785
7836
|
this.mergeStrongNodes(t, e);
|
|
7786
7837
|
return;
|
|
7787
7838
|
}
|
|
7788
7839
|
let n = e.nextSibling;
|
|
7789
|
-
n &&
|
|
7840
|
+
n && Bs(n) && this.mergeStrongNodes(e, n);
|
|
7790
7841
|
}
|
|
7791
7842
|
mergeStrongNodes(e, t) {
|
|
7792
|
-
let n =
|
|
7843
|
+
let n = K(e), r = K(t);
|
|
7793
7844
|
for (; r.firstChild;) n.appendChild(r.firstChild);
|
|
7794
7845
|
r.remove();
|
|
7795
7846
|
}
|
|
@@ -7800,7 +7851,7 @@ var Gs = {
|
|
|
7800
7851
|
let i = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
7801
7852
|
return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(T(C.elementContent)) : n) || i.closest(T(C.editor)) : null;
|
|
7802
7853
|
}
|
|
7803
|
-
},
|
|
7854
|
+
}, qs, Js = class e {
|
|
7804
7855
|
constructor() {
|
|
7805
7856
|
this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
|
|
7806
7857
|
let e = this.getSelection();
|
|
@@ -7857,10 +7908,10 @@ var Gs = {
|
|
|
7857
7908
|
return !(t.meta && !n || t.ctrl && !e.ctrlKey);
|
|
7858
7909
|
}
|
|
7859
7910
|
};
|
|
7860
|
-
|
|
7911
|
+
qs = Js, qs.instance = null;
|
|
7861
7912
|
//#endregion
|
|
7862
7913
|
//#region src/components/inline-tools/utils/formatting-range-utils.ts
|
|
7863
|
-
var
|
|
7914
|
+
var Ys = (e, t) => {
|
|
7864
7915
|
try {
|
|
7865
7916
|
return e.intersectsNode(t);
|
|
7866
7917
|
} catch (n) {
|
|
@@ -7869,26 +7920,26 @@ var Js = (e, t) => {
|
|
|
7869
7920
|
let i = e.compareBoundaryPoints(Range.END_TO_START, r) > 0, a = e.compareBoundaryPoints(Range.START_TO_END, r) < 0;
|
|
7870
7921
|
return i && a;
|
|
7871
7922
|
}
|
|
7872
|
-
},
|
|
7923
|
+
}, Xs = (e) => {
|
|
7873
7924
|
var t;
|
|
7874
7925
|
let n = e.commonAncestorContainer, r = n.nodeType === Node.TEXT_NODE ? (t = n.parentNode) == null ? n : t : n;
|
|
7875
|
-
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) =>
|
|
7876
|
-
},
|
|
7877
|
-
if (e.collapsed) return
|
|
7878
|
-
let r =
|
|
7926
|
+
return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Ys(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
|
|
7927
|
+
}, X = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : X(e.parentNode, t, n), Zs = (e, t) => X(e, t) !== null, Qs = (e, t, n = {}) => {
|
|
7928
|
+
if (e.collapsed) return X(e.startContainer, t) !== null;
|
|
7929
|
+
let r = Xs(e), i = [];
|
|
7879
7930
|
for (; r.nextNode();) {
|
|
7880
7931
|
let e = r.currentNode, t = e.textContent;
|
|
7881
7932
|
n.ignoreWhitespace && t.trim().length === 0 || t.length !== 0 && i.push(e);
|
|
7882
7933
|
}
|
|
7883
|
-
return i.length === 0 ?
|
|
7884
|
-
},
|
|
7885
|
-
let n = /* @__PURE__ */ new Set(), r =
|
|
7934
|
+
return i.length === 0 ? X(e.startContainer, t) !== null : i.every((e) => Zs(e, t));
|
|
7935
|
+
}, Z = (e, t) => {
|
|
7936
|
+
let n = /* @__PURE__ */ new Set(), r = Xs(e);
|
|
7886
7937
|
for (; r.nextNode();) {
|
|
7887
|
-
let e =
|
|
7938
|
+
let e = X(r.currentNode, t);
|
|
7888
7939
|
e && n.add(e);
|
|
7889
7940
|
}
|
|
7890
7941
|
return Array.from(n);
|
|
7891
|
-
},
|
|
7942
|
+
}, Q, $s = class e {
|
|
7892
7943
|
static get sanitize() {
|
|
7893
7944
|
return {
|
|
7894
7945
|
strong: {},
|
|
@@ -7900,7 +7951,7 @@ var Js = (e, t) => {
|
|
|
7900
7951
|
}
|
|
7901
7952
|
static initializeGlobalListeners() {
|
|
7902
7953
|
if (typeof document > "u") return !1;
|
|
7903
|
-
let t =
|
|
7954
|
+
let t = Js.getInstance();
|
|
7904
7955
|
return t.hasHandler("bold") ? !0 : (t.register("bold", {
|
|
7905
7956
|
shortcut: {
|
|
7906
7957
|
key: "b",
|
|
@@ -7916,14 +7967,14 @@ var Js = (e, t) => {
|
|
|
7916
7967
|
onInput: (t, n) => {
|
|
7917
7968
|
e.refreshSelectionState("input");
|
|
7918
7969
|
},
|
|
7919
|
-
onBeforeInput: (e) => e.inputType === "formatBold" ? (
|
|
7970
|
+
onBeforeInput: (e) => e.inputType === "formatBold" ? (Y.normalizeAroundSelection(window.getSelection()), !0) : !1,
|
|
7920
7971
|
isRelevant: (t) => e.isSelectionInsideBlok(t)
|
|
7921
7972
|
}), e.guardKeydownListenerRegistered || (document.addEventListener("keydown", (e) => {
|
|
7922
|
-
|
|
7973
|
+
J.getInstance().guardBoundaryKeydown(e);
|
|
7923
7974
|
}, !0), e.guardKeydownListenerRegistered = !0), e.ensureMutationObserver(), !0);
|
|
7924
7975
|
}
|
|
7925
7976
|
static mergeStrongNodes(e, t) {
|
|
7926
|
-
let n =
|
|
7977
|
+
let n = K(e), r = K(t);
|
|
7927
7978
|
for (; r.firstChild;) n.appendChild(r.firstChild);
|
|
7928
7979
|
return r.remove(), n;
|
|
7929
7980
|
}
|
|
@@ -7960,11 +8011,11 @@ var Js = (e, t) => {
|
|
|
7960
8011
|
r && n && (r.removeAllRanges(), r.addRange(n));
|
|
7961
8012
|
let i = this.findBoldElementFromRangeOrSelection(n, r);
|
|
7962
8013
|
if (!i) {
|
|
7963
|
-
|
|
8014
|
+
Y.normalizeAroundSelection(r), this.notifySelectionChange();
|
|
7964
8015
|
return;
|
|
7965
8016
|
}
|
|
7966
8017
|
let a = this.mergeAdjacentBold(i);
|
|
7967
|
-
this.selectElementContents(a),
|
|
8018
|
+
this.selectElementContents(a), Y.normalizeAroundSelection(r), this.notifySelectionChange();
|
|
7968
8019
|
}
|
|
7969
8020
|
unwrapBoldTags(t) {
|
|
7970
8021
|
let n = this.collectBoldAncestors(t), r = window.getSelection();
|
|
@@ -7973,7 +8024,7 @@ var Js = (e, t) => {
|
|
|
7973
8024
|
i.setAttribute("data-blok-bold-marker", `unwrap-${e.markerSequence++}`), i.appendChild(a), this.removeNestedBold(i), t.insertNode(i);
|
|
7974
8025
|
let o = document.createRange();
|
|
7975
8026
|
for (o.selectNodeContents(i), r.removeAllRanges(), r.addRange(o);;) {
|
|
7976
|
-
let e =
|
|
8027
|
+
let e = G(i);
|
|
7977
8028
|
if (!e) break;
|
|
7978
8029
|
this.moveMarkerOutOfBold(i, e);
|
|
7979
8030
|
}
|
|
@@ -7981,8 +8032,8 @@ var Js = (e, t) => {
|
|
|
7981
8032
|
this.unwrapElement(i), s && c && (() => {
|
|
7982
8033
|
let e = document.createRange();
|
|
7983
8034
|
return e.setStartBefore(s), e.setEndAfter(c), r.removeAllRanges(), r.addRange(e), e;
|
|
7984
|
-
})() || r.removeAllRanges(),
|
|
7985
|
-
|
|
8035
|
+
})() || r.removeAllRanges(), Y.normalizeAroundSelection(r), n.forEach((e) => {
|
|
8036
|
+
Vs(e) && e.remove();
|
|
7986
8037
|
}), this.notifySelectionChange();
|
|
7987
8038
|
}
|
|
7988
8039
|
replaceRangeWithHtml(t, n) {
|
|
@@ -8022,7 +8073,7 @@ var Js = (e, t) => {
|
|
|
8022
8073
|
n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
|
|
8023
8074
|
}
|
|
8024
8075
|
isRangeBold(e, t) {
|
|
8025
|
-
return
|
|
8076
|
+
return Qs(e, W, t);
|
|
8026
8077
|
}
|
|
8027
8078
|
removeNestedBold(e) {
|
|
8028
8079
|
e.querySelectorAll("b,strong").forEach((e) => {
|
|
@@ -8039,28 +8090,28 @@ var Js = (e, t) => {
|
|
|
8039
8090
|
t.removeChild(e);
|
|
8040
8091
|
}
|
|
8041
8092
|
findBoldElementFromRangeOrSelection(e, t) {
|
|
8042
|
-
return e ?
|
|
8093
|
+
return e ? G(e.startContainer) || G(e.commonAncestorContainer) || (e.startContainer.nodeType === Node.ELEMENT_NODE && W(e.startContainer) ? e.startContainer : null) : t ? G(t.focusNode) : null;
|
|
8043
8094
|
}
|
|
8044
8095
|
mergeAdjacentBold(t) {
|
|
8045
|
-
let n =
|
|
8046
|
-
return a && a.nodeType === Node.ELEMENT_NODE &&
|
|
8096
|
+
let n = K(t), r = n.previousSibling, i = r && r.nodeType === Node.ELEMENT_NODE && W(r) ? e.mergeStrongNodes(r, n) : n, a = i.nextSibling;
|
|
8097
|
+
return a && a.nodeType === Node.ELEMENT_NODE && W(a) ? e.mergeStrongNodes(i, a) : i;
|
|
8047
8098
|
}
|
|
8048
8099
|
toggleCollapsedSelection() {
|
|
8049
8100
|
let t = window.getSelection();
|
|
8050
8101
|
if (!t || t.rangeCount === 0) return;
|
|
8051
|
-
let n = t.getRangeAt(0), r =
|
|
8052
|
-
if (r && r.getAttribute(
|
|
8102
|
+
let n = t.getRangeAt(0), r = G(n.startContainer), i = (() => {
|
|
8103
|
+
if (r && r.getAttribute(J.ATTR.COLLAPSED_ACTIVE) !== "true") return J.getInstance().exit(t, r);
|
|
8053
8104
|
let i = r == null ? e.getBoundaryBold(n) : r;
|
|
8054
|
-
return i ?
|
|
8105
|
+
return i ? J.getInstance().exit(t, i) : this.startCollapsedBold(n);
|
|
8055
8106
|
})();
|
|
8056
|
-
document.dispatchEvent(new Event("selectionchange")), i && (t.removeAllRanges(), t.addRange(i)),
|
|
8107
|
+
document.dispatchEvent(new Event("selectionchange")), i && (t.removeAllRanges(), t.addRange(i)), Y.normalizeAroundSelection(t), this.notifySelectionChange();
|
|
8057
8108
|
}
|
|
8058
8109
|
startCollapsedBold(e) {
|
|
8059
|
-
let t =
|
|
8060
|
-
return
|
|
8110
|
+
let t = J.getInstance().enter(e, (e) => this.mergeAdjacentBold(e)), n = window.getSelection();
|
|
8111
|
+
return Y.normalizeAroundSelection(n), n && t && (n.removeAllRanges(), n.addRange(t)), this.notifySelectionChange(), t;
|
|
8061
8112
|
}
|
|
8062
8113
|
notifySelectionChange() {
|
|
8063
|
-
|
|
8114
|
+
J.getInstance().enforceLengths(window.getSelection()), document.dispatchEvent(new Event("selectionchange")), this.updateToolbarButtonState();
|
|
8064
8115
|
}
|
|
8065
8116
|
updateToolbarButtonState() {
|
|
8066
8117
|
let e = window.getSelection();
|
|
@@ -8074,7 +8125,7 @@ var Js = (e, t) => {
|
|
|
8074
8125
|
}
|
|
8075
8126
|
static refreshSelectionState(e) {
|
|
8076
8127
|
let t = window.getSelection();
|
|
8077
|
-
|
|
8128
|
+
J.getInstance().enforceLengths(t), J.getInstance().maintain(), J.getInstance().synchronize(t), Y.normalizeAroundSelection(t, { normalizeWhitespace: !1 }), e === "input" && t && J.getInstance().moveCaretAfterBoundaryBold(t);
|
|
8078
8129
|
}
|
|
8079
8130
|
static ensureMutationObserver() {
|
|
8080
8131
|
if (typeof MutationObserver > "u" || e.mutationObserver) return;
|
|
@@ -8083,7 +8134,7 @@ var Js = (e, t) => {
|
|
|
8083
8134
|
e.isProcessingMutation = !0;
|
|
8084
8135
|
try {
|
|
8085
8136
|
let n = (e) => {
|
|
8086
|
-
e && new
|
|
8137
|
+
e && new Y({
|
|
8087
8138
|
mergeAdjacent: !1,
|
|
8088
8139
|
removeEmpty: !1,
|
|
8089
8140
|
normalizeWhitespace: !1
|
|
@@ -8115,15 +8166,15 @@ var Js = (e, t) => {
|
|
|
8115
8166
|
}
|
|
8116
8167
|
static getBoundaryBoldForText(e, t) {
|
|
8117
8168
|
let n = t.textContent.length;
|
|
8118
|
-
if (e.startOffset === n) return
|
|
8169
|
+
if (e.startOffset === n) return G(t);
|
|
8119
8170
|
if (e.startOffset !== 0) return null;
|
|
8120
8171
|
let r = t.previousSibling;
|
|
8121
|
-
return
|
|
8172
|
+
return Bs(r) ? r : null;
|
|
8122
8173
|
}
|
|
8123
8174
|
static getBoundaryBoldForElement(e, t) {
|
|
8124
8175
|
if (e.startOffset <= 0) return null;
|
|
8125
8176
|
let n = t.childNodes[e.startOffset - 1];
|
|
8126
|
-
return
|
|
8177
|
+
return Bs(n) ? n : null;
|
|
8127
8178
|
}
|
|
8128
8179
|
static isSelectionInsideBlok(e) {
|
|
8129
8180
|
let t = e.anchorNode;
|
|
@@ -8142,16 +8193,16 @@ var Js = (e, t) => {
|
|
|
8142
8193
|
return t.innerHTML = e, t.content;
|
|
8143
8194
|
}
|
|
8144
8195
|
collectBoldAncestors(e) {
|
|
8145
|
-
return
|
|
8196
|
+
return Z(e, W);
|
|
8146
8197
|
}
|
|
8147
8198
|
};
|
|
8148
|
-
|
|
8199
|
+
Q = $s, Q.isInline = !0, Q.title = "Bold", Q.titleKey = "bold", Q.markerSequence = 0, Q.isProcessingMutation = !1, Q.instances = /* @__PURE__ */ new Set(), Q.guardKeydownListenerRegistered = !1, Q.shortcut = "CMD+B";
|
|
8149
8200
|
//#endregion
|
|
8150
8201
|
//#region src/components/inline-tools/inline-tool-italic.ts
|
|
8151
|
-
var
|
|
8202
|
+
var ec, tc = (e) => {
|
|
8152
8203
|
let t = e.tagName;
|
|
8153
8204
|
return t === "I" || t === "EM";
|
|
8154
|
-
},
|
|
8205
|
+
}, nc = class {
|
|
8155
8206
|
static get sanitize() {
|
|
8156
8207
|
return {
|
|
8157
8208
|
i: {},
|
|
@@ -8200,7 +8251,7 @@ var $s, ec = (e) => {
|
|
|
8200
8251
|
return this.isRangeItalic(t, { ignoreWhitespace: !0 });
|
|
8201
8252
|
}
|
|
8202
8253
|
isRangeItalic(e, t) {
|
|
8203
|
-
return
|
|
8254
|
+
return Qs(e, tc, t);
|
|
8204
8255
|
}
|
|
8205
8256
|
wrapWithItalic(e) {
|
|
8206
8257
|
let t = this.getRangeHtmlWithoutItalic(e), n = this.replaceRangeWithHtml(e, `<i>${t}</i>`), r = window.getSelection();
|
|
@@ -8226,13 +8277,13 @@ var $s, ec = (e) => {
|
|
|
8226
8277
|
});
|
|
8227
8278
|
}
|
|
8228
8279
|
hasItalicParent(e) {
|
|
8229
|
-
return
|
|
8280
|
+
return Zs(e, tc);
|
|
8230
8281
|
}
|
|
8231
8282
|
findItalicElement(e) {
|
|
8232
|
-
return
|
|
8283
|
+
return X(e, tc);
|
|
8233
8284
|
}
|
|
8234
8285
|
collectItalicAncestors(e) {
|
|
8235
|
-
return
|
|
8286
|
+
return Z(e, tc);
|
|
8236
8287
|
}
|
|
8237
8288
|
getRangeHtmlWithoutItalic(e) {
|
|
8238
8289
|
let t = e.cloneContents();
|
|
@@ -8289,10 +8340,10 @@ var $s, ec = (e) => {
|
|
|
8289
8340
|
n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
|
|
8290
8341
|
}
|
|
8291
8342
|
};
|
|
8292
|
-
|
|
8343
|
+
ec = nc, ec.isInline = !0, ec.title = "Italic", ec.titleKey = "italic", ec.shortcut = "CMD+I";
|
|
8293
8344
|
//#endregion
|
|
8294
8345
|
//#region src/components/inline-tools/inline-tool-link.ts
|
|
8295
|
-
var
|
|
8346
|
+
var rc, ic = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left cursor-pointer can-hover:hover:bg-item-hover-bg transition-colors", ac = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", oc = class {
|
|
8296
8347
|
static get sanitize() {
|
|
8297
8348
|
return { a: {
|
|
8298
8349
|
href: !0,
|
|
@@ -8352,7 +8403,7 @@ var nc, rc = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8352
8403
|
let t = document.createElement("div");
|
|
8353
8404
|
t.className = "mt-1 mb-0.5 h-px bg-link-input-border";
|
|
8354
8405
|
let n = document.createElement("button");
|
|
8355
|
-
n.type = "button", n.className =
|
|
8406
|
+
n.type = "button", n.className = ic, n.setAttribute("data-link-suggestion-row", "");
|
|
8356
8407
|
let r = document.createElement("span");
|
|
8357
8408
|
r.className = "text-gray-text shrink-0 flex [&>svg]:size-7", r.setAttribute("data-link-suggestion-icon", "");
|
|
8358
8409
|
let i = document.createElement("span");
|
|
@@ -8370,7 +8421,7 @@ var nc, rc = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8370
8421
|
return;
|
|
8371
8422
|
}
|
|
8372
8423
|
let n = this.isLinkComplete(t), { icon: r, label: i } = this.getLinkTypeInfo(t), a = this.nodes.suggestion.querySelector("[data-link-suggestion-icon]"), o = this.nodes.suggestion.querySelector("[data-link-suggestion-url]"), s = this.nodes.suggestion.querySelector("[data-link-suggestion-type]"), c = this.nodes.suggestion.querySelector("[data-link-suggestion-row]");
|
|
8373
|
-
a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ?
|
|
8424
|
+
a && (a.innerHTML = r, a.className = `${n ? "text-gray-text" : "text-gray-text opacity-40"} shrink-0 flex [&>svg]:size-7`), o && (o.textContent = t, o.className = `block text-xs font-medium truncate ${n ? "text-text-primary" : "text-gray-text"}`), s && (s.textContent = n ? i : "Keep typing to add a link", s.className = "block text-[10.5px] text-gray-text leading-tight mt-px"), c && (c.className = n ? ic : ac), this.nodes.suggestion.classList.remove("hidden");
|
|
8374
8425
|
}
|
|
8375
8426
|
isLinkComplete(e) {
|
|
8376
8427
|
return /^https?:\/\//i.test(e) ? e.replace(/^https?:\/\//i, "").length > 0 : /^\w+:\/\//.test(e) ? e.replace(/^\w+:\/\//, "").length > 0 : /^\w+:/.test(e) ? e.slice(e.indexOf(":") + 1).length > 0 : e.startsWith("//") ? e.slice(2).length > 0 : e.startsWith("#") ? e.length > 1 : e.startsWith("/") ? !0 : /\.[a-zA-Z]{2,}/.test(e) || /^\d{1,3}(\.\d{1,3}){3}/.test(e);
|
|
@@ -8499,10 +8550,10 @@ var nc, rc = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md tex
|
|
|
8499
8550
|
e && e.setAttribute(t, n ? "true" : "false");
|
|
8500
8551
|
}
|
|
8501
8552
|
};
|
|
8502
|
-
|
|
8553
|
+
rc = oc, rc.isInline = !0, rc.title = "Link", rc.titleKey = "link", rc.shortcut = "CMD+K";
|
|
8503
8554
|
//#endregion
|
|
8504
8555
|
//#region src/components/inline-tools/utils/marker-dom-utils.ts
|
|
8505
|
-
var
|
|
8556
|
+
var sc = (e) => e.tagName === "MARK", cc = (e) => X(e, sc), $, lc = {
|
|
8506
8557
|
color: "background-color",
|
|
8507
8558
|
"background-color": "color"
|
|
8508
8559
|
}, uc = class e {
|
|
@@ -8514,7 +8565,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8514
8565
|
} };
|
|
8515
8566
|
}
|
|
8516
8567
|
constructor({ api: e }) {
|
|
8517
|
-
this.colorMode = "color", this.activeTextColor = null, this.activeBgColor = null, this.i18n = e.i18n, this.inlineToolbar = e.inlineToolbar, this.selection = new at(), this.picker =
|
|
8568
|
+
this.colorMode = "color", this.activeTextColor = null, this.activeBgColor = null, this.i18n = e.i18n, this.inlineToolbar = e.inlineToolbar, this.selection = new at(), this.picker = Or({
|
|
8518
8569
|
i18n: this.i18n,
|
|
8519
8570
|
testIdPrefix: "marker",
|
|
8520
8571
|
modes: [{
|
|
@@ -8538,7 +8589,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8538
8589
|
isActive: () => {
|
|
8539
8590
|
let e = window.getSelection();
|
|
8540
8591
|
if (!e || e.rangeCount === 0) return !1;
|
|
8541
|
-
let t = e.getRangeAt(0), n =
|
|
8592
|
+
let t = e.getRangeAt(0), n = Qs(t, sc, { ignoreWhitespace: !0 });
|
|
8542
8593
|
if (n) {
|
|
8543
8594
|
let e = this.detectBothSelectionColors(t);
|
|
8544
8595
|
this.updateToolbarColors(e.text, e.bg);
|
|
@@ -8589,7 +8640,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8589
8640
|
if (!r || r.rangeCount === 0) return;
|
|
8590
8641
|
let i = r.getRangeAt(0), a = i.startContainer, o = i.startOffset, s = i.endContainer, c = i.endOffset, l = i.toString(), u = i.commonAncestorContainer, d = u.nodeType === Node.ELEMENT_NODE ? u : u.parentElement, f = d != null && d.closest("mark") ? (t = (n = d.closest("mark")) == null ? void 0 : n.parentElement) == null ? d : t : d;
|
|
8591
8642
|
this.splitMarksAtBoundaries(i);
|
|
8592
|
-
let p =
|
|
8643
|
+
let p = Z(i, sc);
|
|
8593
8644
|
for (let t of p) {
|
|
8594
8645
|
t.style.removeProperty(e);
|
|
8595
8646
|
let n = lc[e], r = t.style.getPropertyValue(n);
|
|
@@ -8620,7 +8671,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8620
8671
|
this.selection.removeFakeBackground(), this.selection.savedSelectionRange && this.selection.restore(), this.selection.clearSaved();
|
|
8621
8672
|
}
|
|
8622
8673
|
detectBothSelectionColors(e) {
|
|
8623
|
-
let t =
|
|
8674
|
+
let t = cc(e.startContainer);
|
|
8624
8675
|
if (!t) return {
|
|
8625
8676
|
text: null,
|
|
8626
8677
|
bg: null
|
|
@@ -8640,7 +8691,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8640
8691
|
text: null,
|
|
8641
8692
|
bg: null
|
|
8642
8693
|
};
|
|
8643
|
-
let t =
|
|
8694
|
+
let t = cc(e.getRangeAt(0).startContainer);
|
|
8644
8695
|
if (!t) return {
|
|
8645
8696
|
text: null,
|
|
8646
8697
|
bg: null
|
|
@@ -8660,11 +8711,11 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8660
8711
|
this.selection.savedSelectionRange && (this.selection.removeFakeBackground(), this.selection.restore(), this.selection.clearSaved());
|
|
8661
8712
|
}
|
|
8662
8713
|
findContainingMark(e) {
|
|
8663
|
-
let t =
|
|
8714
|
+
let t = cc(e.startContainer), n = cc(e.endContainer);
|
|
8664
8715
|
return t && t === n ? t : null;
|
|
8665
8716
|
}
|
|
8666
8717
|
removeNestedMarkStyle(e, t) {
|
|
8667
|
-
let n =
|
|
8718
|
+
let n = Z(e, sc);
|
|
8668
8719
|
for (let e of n) {
|
|
8669
8720
|
e.style.removeProperty(t);
|
|
8670
8721
|
let n = lc[t], r = e.style.getPropertyValue(n);
|
|
@@ -8698,7 +8749,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8698
8749
|
}
|
|
8699
8750
|
}
|
|
8700
8751
|
splitMarksAtBoundaries(e) {
|
|
8701
|
-
let t =
|
|
8752
|
+
let t = Z(e, sc);
|
|
8702
8753
|
for (let n of t) {
|
|
8703
8754
|
let t = document.createRange();
|
|
8704
8755
|
t.selectNodeContents(n);
|
|
@@ -8767,7 +8818,7 @@ var oc = (e) => e.tagName === "MARK", sc = (e) => Z(e, oc), cc, lc = {
|
|
|
8767
8818
|
return r === null ? e : et(r, n);
|
|
8768
8819
|
}
|
|
8769
8820
|
};
|
|
8770
|
-
|
|
8821
|
+
$ = uc, $.isInline = !0, $.title = "Color", $.titleKey = "marker", $.shortcut = "CMD+SHIFT+H", $.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
|
|
8771
8822
|
//#endregion
|
|
8772
8823
|
//#region src/components/inline-tools/inline-tool-underline.ts
|
|
8773
8824
|
var dc, fc = (e) => e.tagName === "U", pc = class {
|
|
@@ -8816,7 +8867,7 @@ var dc, fc = (e) => e.tagName === "U", pc = class {
|
|
|
8816
8867
|
return this.isRangeUnderline(t, { ignoreWhitespace: !0 });
|
|
8817
8868
|
}
|
|
8818
8869
|
isRangeUnderline(e, t) {
|
|
8819
|
-
return
|
|
8870
|
+
return Qs(e, fc, t);
|
|
8820
8871
|
}
|
|
8821
8872
|
wrapWithUnderline(e) {
|
|
8822
8873
|
let t = this.getRangeHtmlWithoutUnderline(e), n = this.replaceRangeWithHtml(e, `<u>${t}</u>`), r = window.getSelection();
|
|
@@ -8842,13 +8893,13 @@ var dc, fc = (e) => e.tagName === "U", pc = class {
|
|
|
8842
8893
|
});
|
|
8843
8894
|
}
|
|
8844
8895
|
hasUnderlineParent(e) {
|
|
8845
|
-
return
|
|
8896
|
+
return Zs(e, fc);
|
|
8846
8897
|
}
|
|
8847
8898
|
findUnderlineElement(e) {
|
|
8848
|
-
return
|
|
8899
|
+
return X(e, fc);
|
|
8849
8900
|
}
|
|
8850
8901
|
collectUnderlineAncestors(e) {
|
|
8851
|
-
return
|
|
8902
|
+
return Z(e, fc);
|
|
8852
8903
|
}
|
|
8853
8904
|
getRangeHtmlWithoutUnderline(e) {
|
|
8854
8905
|
let t = e.cloneContents();
|
|
@@ -8954,7 +9005,7 @@ var mc, hc = (e) => e.tagName === "S", gc = class {
|
|
|
8954
9005
|
return this.isRangeStrikethrough(t, { ignoreWhitespace: !0 });
|
|
8955
9006
|
}
|
|
8956
9007
|
isRangeStrikethrough(e, t) {
|
|
8957
|
-
return
|
|
9008
|
+
return Qs(e, hc, t);
|
|
8958
9009
|
}
|
|
8959
9010
|
wrapWithStrikethrough(e) {
|
|
8960
9011
|
let t = this.getRangeHtmlWithoutStrikethrough(e), n = this.replaceRangeWithHtml(e, `<s>${t}</s>`), r = window.getSelection();
|
|
@@ -8980,13 +9031,13 @@ var mc, hc = (e) => e.tagName === "S", gc = class {
|
|
|
8980
9031
|
});
|
|
8981
9032
|
}
|
|
8982
9033
|
hasStrikethroughParent(e) {
|
|
8983
|
-
return
|
|
9034
|
+
return Zs(e, hc);
|
|
8984
9035
|
}
|
|
8985
9036
|
findStrikethroughElement(e) {
|
|
8986
|
-
return
|
|
9037
|
+
return X(e, hc);
|
|
8987
9038
|
}
|
|
8988
9039
|
collectStrikethroughAncestors(e) {
|
|
8989
|
-
return
|
|
9040
|
+
return Z(e, hc);
|
|
8990
9041
|
}
|
|
8991
9042
|
getRangeHtmlWithoutStrikethrough(e) {
|
|
8992
9043
|
let t = e.cloneContents();
|
|
@@ -9092,7 +9143,7 @@ var _c, vc = (e) => e.tagName === "CODE", yc = class {
|
|
|
9092
9143
|
return this.isRangeCode(t, { ignoreWhitespace: !0 });
|
|
9093
9144
|
}
|
|
9094
9145
|
isRangeCode(e, t) {
|
|
9095
|
-
return
|
|
9146
|
+
return Qs(e, vc, t);
|
|
9096
9147
|
}
|
|
9097
9148
|
wrapWithCode(e) {
|
|
9098
9149
|
let t = this.getRangeHtmlWithoutCode(e), n = this.replaceRangeWithHtml(e, `<code>${t}</code>`), r = window.getSelection();
|
|
@@ -9118,10 +9169,10 @@ var _c, vc = (e) => e.tagName === "CODE", yc = class {
|
|
|
9118
9169
|
});
|
|
9119
9170
|
}
|
|
9120
9171
|
findCodeElement(e) {
|
|
9121
|
-
return
|
|
9172
|
+
return X(e, vc);
|
|
9122
9173
|
}
|
|
9123
9174
|
collectCodeAncestors(e) {
|
|
9124
|
-
return
|
|
9175
|
+
return Z(e, vc);
|
|
9125
9176
|
}
|
|
9126
9177
|
getRangeHtmlWithoutCode(e) {
|
|
9127
9178
|
let t = e.cloneContents();
|
|
@@ -9201,4 +9252,4 @@ var bc = {
|
|
|
9201
9252
|
inlineCode: {}
|
|
9202
9253
|
};
|
|
9203
9254
|
//#endregion
|
|
9204
|
-
export { Gt as _, pc as a,
|
|
9255
|
+
export { Gt as _, pc as a, nc as c, go as d, fo as f, ur as g, pa as h, gc as i, $s as l, va as m, xc as n, uc as o, uo as p, yc as r, oc as s, bc as t, zs as u, Ot as v };
|