@jackuait/blok 0.8.3-beta.3 → 0.8.3-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,7 +137,7 @@ var r = Object.create, i = Object.defineProperty, a = Object.getOwnPropertyDescr
137
137
  RIGHT: 2,
138
138
  BACKWARD: 3,
139
139
  FORWARD: 4
140
- }, g = () => "0.8.3-beta.3", _ = /* @__PURE__ */ function(e) {
140
+ }, g = () => "0.8.3-beta.4", _ = /* @__PURE__ */ function(e) {
141
141
  return e.VERBOSE = "VERBOSE", e.INFO = "INFO", e.WARN = "WARN", e.ERROR = "ERROR", e;
142
142
  }({}), v = (e, t, n = "log", r, i = "color: inherit") => {
143
143
  let a = typeof console > "u" ? void 0 : console;
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, A as n, At as r, B as i, Ct as a, D as o, Dt as s, Et as c, F as l, Ft as u, G as d, Gn as f, Gt as p, H as m, Ht as h, I as g, J as ee, Jt as _, K as te, L as ne, M as re, Mt as ie, N as ae, Nt as oe, O as se, Ot as ce, P as le, Pt as ue, Q as de, Qt as fe, R as pe, Rn as me, Rt as he, Tt as ge, U as _e, Ut as v, V as ve, W as ye, Wn as y, X as be, Y as xe, Yt as b, Z as Se, _t as Ce, a as we, at as Te, bt as Ee, c as De, d as Oe, et as ke, f as Ae, ft as je, g as Me, gt as Ne, h as Pe, ht as Fe, i as Ie, it as Le, j as Re, jt as ze, kt as Be, l as Ve, lt as He, mn as Ue, mt as We, n as Ge, nt as Ke, o as qe, ot as Je, p as Ye, pt as Xe, q as Ze, r as Qe, rt as $e, s as et, st as tt, t as nt, tt as rt, u as x, ut as it, v as at, vt as ot, wt as st, xt as ct, yt as lt, z as ut } from "./constants-B-YnSMJS.mjs";
1
+ import { $ as e, $t as t, A as n, At as r, B as i, Ct as a, D as o, Dt as s, Et as c, F as l, Ft as u, G as d, Gn as f, Gt as p, H as m, Ht as h, I as g, J as ee, Jt as _, K as te, L as ne, M as re, Mt as ie, N as ae, Nt as oe, O as se, Ot as ce, P as le, Pt as ue, Q as de, Qt as fe, R as pe, Rn as me, Rt as he, Tt as ge, U as _e, Ut as v, V as ve, W as ye, Wn as y, X as be, Y as xe, Yt as b, Z as Se, _t as Ce, a as we, at as Te, bt as Ee, c as De, d as Oe, et as ke, f as Ae, ft as je, g as Me, gt as Ne, h as Pe, ht as Fe, i as Ie, it as Le, j as Re, jt as ze, kt as Be, l as Ve, lt as He, mn as Ue, mt as We, n as Ge, nt as Ke, o as qe, ot as Je, p as Ye, pt as Xe, q as Ze, r as Qe, rt as $e, s as et, st as tt, t as nt, tt as rt, u as x, ut as it, v as at, vt as ot, wt as st, xt as ct, yt as lt, z as ut } from "./constants-Duj_CSIT.mjs";
2
2
  import { t as S } from "./objectSpread2-CyPxu8-u.mjs";
3
3
  import { n as C } from "./tw-DmW6-pCY.mjs";
4
4
  //#region src/components/utils/html.ts
@@ -5323,17 +5323,40 @@ var La = {
5323
5323
  let t = e.getBoundingClientRect(), n = this._element.getBoundingClientRect(), r = window.innerHeight, i = window.innerWidth, a = t.bottom + n.height > r ? t.top - n.height - 4 : t.bottom + 4, o = t.left - 8, s = o + n.width > i ? t.right - n.width : Math.max(0, o);
5324
5324
  this._element.style.top = `${a}px`, this._element.style.left = `${s}px`;
5325
5325
  }
5326
- }, Ha = class {
5326
+ };
5327
+ //#endregion
5328
+ //#region src/tools/callout/index.ts
5329
+ function Ha(e) {
5330
+ return e.isEmojiVisible === !1 ? "" : typeof e.emoji == "string" && e.emoji.length > 0 ? e.emoji : xa;
5331
+ }
5332
+ var Ua = {
5333
+ general: null,
5334
+ note: "blue",
5335
+ important: "purple",
5336
+ warning: "orange",
5337
+ additional: "yellow",
5338
+ recommendation: "green",
5339
+ caution: "red"
5340
+ }, Wa = class {
5327
5341
  constructor({ data: e, api: t, readOnly: n, block: r }) {
5328
5342
  this._dom = null, this._emojiPicker = null, this._colorPicker = null, this.api = t, this.readOnly = n, this._data = this.normalizeData(e), r && (this.blockId = r.id);
5329
5343
  }
5330
5344
  normalizeData(e) {
5331
- return {
5345
+ let t = e;
5346
+ return "variant" in t || "isEmojiVisible" in t ? this.normalizeLegacyData(t) : {
5332
5347
  emoji: typeof e.emoji == "string" ? e.emoji : xa,
5333
5348
  textColor: typeof e.textColor == "string" ? e.textColor : null,
5334
5349
  backgroundColor: typeof e.backgroundColor == "string" ? e.backgroundColor : null
5335
5350
  };
5336
5351
  }
5352
+ normalizeLegacyData(e) {
5353
+ let t = typeof e.variant == "string" ? e.variant : "general", n = t in Ua ? Ua[t] : null;
5354
+ return {
5355
+ emoji: Ha(e),
5356
+ textColor: null,
5357
+ backgroundColor: n == null ? null : n
5358
+ };
5359
+ }
5337
5360
  render() {
5338
5361
  let e = Ta({
5339
5362
  emoji: this._data.emoji,
@@ -5480,28 +5503,28 @@ var La = {
5480
5503
  }, L = (e) => {
5481
5504
  let t = e.tagName;
5482
5505
  return t === "B" || t === "STRONG";
5483
- }, Ua = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && L(e)), Wa = (e) => e.textContent.length === 0, R = (e) => e ? e.nodeType === Node.ELEMENT_NODE && L(e) ? z(e) : R(e.parentNode) : null, z = (e) => {
5506
+ }, Ga = (e) => !!(e && e.nodeType === Node.ELEMENT_NODE && L(e)), Ka = (e) => e.textContent.length === 0, R = (e) => e ? e.nodeType === Node.ELEMENT_NODE && L(e) ? z(e) : R(e.parentNode) : null, z = (e) => {
5484
5507
  if (e.tagName === "STRONG") return e;
5485
5508
  let t = document.createElement("strong");
5486
5509
  for (e.hasAttributes() && Array.from(e.attributes).forEach((e) => {
5487
5510
  t.setAttribute(e.name, e.value);
5488
5511
  }); e.firstChild;) t.appendChild(e.firstChild);
5489
5512
  return e.replaceWith(t), t;
5490
- }, Ga = (e) => {
5513
+ }, qa = (e) => {
5491
5514
  let t = e.nextSibling;
5492
5515
  if ((t == null ? void 0 : t.nodeType) === Node.TEXT_NODE) return t;
5493
5516
  let n = e.parentNode;
5494
5517
  if (!n) return null;
5495
5518
  let r = e.ownerDocument.createTextNode("");
5496
5519
  return n.insertBefore(r, t), r;
5497
- }, Ka = (e) => {
5520
+ }, Ja = (e) => {
5498
5521
  if (!e.boldElement.isConnected) return null;
5499
- let t = z(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : Ga(t);
5522
+ let t = z(e.boldElement), n = e.boundary, r = n.isConnected && n.previousSibling === t ? n : qa(t);
5500
5523
  return r ? {
5501
5524
  boundary: r,
5502
5525
  boldElement: t
5503
5526
  } : null;
5504
- }, qa = (e, t) => e ? e === t || t.contains(e) : !1, Ja, B = {
5527
+ }, Ya = (e, t) => e ? e === t || t.contains(e) : !1, Xa, B = {
5505
5528
  COLLAPSED_LENGTH: "data-blok-bold-collapsed-length",
5506
5529
  COLLAPSED_ACTIVE: "data-blok-bold-collapsed-active",
5507
5530
  PREV_LENGTH: "data-blok-bold-prev-length",
@@ -5554,7 +5577,7 @@ var La = {
5554
5577
  }
5555
5578
  exit(e, t) {
5556
5579
  let n = z(t), r = n.parentNode;
5557
- if (r) return Wa(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
5580
+ if (r) return Ka(n) ? this.removeEmptyBoldElement(e, n, r) : this.exitBoldWithContent(e, n, r);
5558
5581
  }
5559
5582
  removeEmptyBoldElement(e, t, n) {
5560
5583
  let r = document.createRange();
@@ -5578,7 +5601,7 @@ var La = {
5578
5601
  }
5579
5602
  maintain() {
5580
5603
  if (!(typeof document > "u")) for (let e of Array.from(this.records)) {
5581
- let t = Ka(e);
5604
+ let t = Ja(e);
5582
5605
  if (!t) {
5583
5606
  this.records.delete(e);
5584
5607
  continue;
@@ -5628,7 +5651,7 @@ var La = {
5628
5651
  if (u && !t.hasAttribute(B.LEADING_WHITESPACE) && t.setAttribute(B.LEADING_WHITESPACE, u[0]), l.length === 0) return;
5629
5652
  let d = t.textContent, f = d + l, p = (n = t.getAttribute(B.LEADING_WHITESPACE)) == null ? "" : n, m = p.length > 0 && d.length === 0 && !f.startsWith(p) ? p + f : f, h = document.createTextNode(m);
5630
5653
  for (; t.firstChild;) t.removeChild(t.firstChild);
5631
- if (t.appendChild(h), !(e != null && e.isCollapsed) || !qa(e.focusNode, o)) return;
5654
+ if (t.appendChild(h), !(e != null && e.isCollapsed) || !Ya(e.focusNode, o)) return;
5632
5655
  let g = document.createRange(), ee = h.textContent.length;
5633
5656
  g.setStart(h, ee), g.collapse(!0), e.removeAllRanges(), e.addRange(g);
5634
5657
  });
@@ -5652,7 +5675,7 @@ var La = {
5652
5675
  let r = document.createTextNode(n);
5653
5676
  (m = t.parentNode) == null || m.insertBefore(r, t.nextSibling);
5654
5677
  }
5655
- if (p && t.removeAttribute(B.PREV_LENGTH), e != null && e.isCollapsed && s && qa(e.focusNode, t)) {
5678
+ if (p && t.removeAttribute(B.PREV_LENGTH), e != null && e.isCollapsed && s && Ya(e.focusNode, t)) {
5656
5679
  let t = document.createRange(), n = s.textContent.length;
5657
5680
  t.setStart(s, n), t.collapse(!0), e.removeAllRanges(), e.addRange(t);
5658
5681
  }
@@ -5746,10 +5769,10 @@ var La = {
5746
5769
  return t.tagName === "STRONG" || t.tagName === "B";
5747
5770
  }
5748
5771
  };
5749
- Ja = V, Ja.instance = null;
5772
+ Xa = V, Xa.instance = null;
5750
5773
  //#endregion
5751
5774
  //#region src/components/inline-tools/services/bold-normalization-pass.ts
5752
- var Ya = {
5775
+ var Za = {
5753
5776
  convertLegacyTags: !0,
5754
5777
  normalizeWhitespace: !0,
5755
5778
  removeEmpty: !0,
@@ -5757,7 +5780,7 @@ var Ya = {
5757
5780
  preserveNode: null
5758
5781
  }, H = class e {
5759
5782
  constructor(e) {
5760
- this.options = S(S({}, Ya), e);
5783
+ this.options = S(S({}, Za), e);
5761
5784
  }
5762
5785
  run(e) {
5763
5786
  if (typeof document > "u") return;
@@ -5810,16 +5833,16 @@ var Ya = {
5810
5833
  t.includes("\xA0") && (e.textContent = t.replace(/\u00A0/g, " "));
5811
5834
  }
5812
5835
  isEmptyAndSafe(e) {
5813
- return e.textContent.length !== 0 || V.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && qa(this.options.preserveNode, e));
5836
+ return e.textContent.length !== 0 || V.getInstance().isActivePlaceholder(e) ? !1 : !(this.options.preserveNode && Ya(this.options.preserveNode, e));
5814
5837
  }
5815
5838
  mergeWithAdjacent(e) {
5816
5839
  let t = e.previousSibling;
5817
- if (t && Ua(t)) {
5840
+ if (t && Ga(t)) {
5818
5841
  this.mergeStrongNodes(t, e);
5819
5842
  return;
5820
5843
  }
5821
5844
  let n = e.nextSibling;
5822
- n && Ua(n) && this.mergeStrongNodes(e, n);
5845
+ n && Ga(n) && this.mergeStrongNodes(e, n);
5823
5846
  }
5824
5847
  mergeStrongNodes(e, t) {
5825
5848
  let n = z(e), r = z(t);
@@ -5833,7 +5856,7 @@ var Ya = {
5833
5856
  let i = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
5834
5857
  return i ? ((n = i.closest("[data-blok-component=\"paragraph\"]")) == null ? i.closest(f(y.elementContent)) : n) || i.closest(f(y.editor)) : null;
5835
5858
  }
5836
- }, Xa, Za = class e {
5859
+ }, Qa, $a = class e {
5837
5860
  constructor() {
5838
5861
  this.handlers = /* @__PURE__ */ new Map(), this.listenersRegistered = !1, this.handleSelectionChange = () => {
5839
5862
  let e = this.getSelection();
@@ -5890,10 +5913,10 @@ var Ya = {
5890
5913
  return !(t.meta && !n || t.ctrl && !e.ctrlKey);
5891
5914
  }
5892
5915
  };
5893
- Xa = Za, Xa.instance = null;
5916
+ Qa = $a, Qa.instance = null;
5894
5917
  //#endregion
5895
5918
  //#region src/components/inline-tools/utils/formatting-range-utils.ts
5896
- var Qa = (e, t) => {
5919
+ var eo = (e, t) => {
5897
5920
  try {
5898
5921
  return e.intersectsNode(t);
5899
5922
  } catch (n) {
@@ -5902,26 +5925,26 @@ var Qa = (e, t) => {
5902
5925
  let i = e.compareBoundaryPoints(Range.END_TO_START, r) > 0, a = e.compareBoundaryPoints(Range.START_TO_END, r) < 0;
5903
5926
  return i && a;
5904
5927
  }
5905
- }, $a = (e) => {
5928
+ }, to = (e) => {
5906
5929
  var t;
5907
5930
  let n = e.commonAncestorContainer, r = n.nodeType === Node.TEXT_NODE ? (t = n.parentNode) == null ? n : t : n;
5908
- return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => Qa(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
5909
- }, U = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : U(e.parentNode, t, n), W = (e, t) => U(e, t) !== null, G = (e, t, n = {}) => {
5931
+ return document.createTreeWalker(r, NodeFilter.SHOW_TEXT, { acceptNode: (t) => eo(e, t) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT });
5932
+ }, U = (e, t, n) => !e || e === n ? null : e.nodeType === Node.ELEMENT_NODE && t(e) ? e : U(e.parentNode, t, n), no = (e, t) => U(e, t) !== null, W = (e, t, n = {}) => {
5910
5933
  if (e.collapsed) return U(e.startContainer, t) !== null;
5911
- let r = $a(e), i = [];
5934
+ let r = to(e), i = [];
5912
5935
  for (; r.nextNode();) {
5913
5936
  let e = r.currentNode, t = e.textContent;
5914
5937
  n.ignoreWhitespace && t.trim().length === 0 || t.length !== 0 && i.push(e);
5915
5938
  }
5916
- return i.length === 0 ? U(e.startContainer, t) !== null : i.every((e) => W(e, t));
5917
- }, K = (e, t) => {
5918
- let n = /* @__PURE__ */ new Set(), r = $a(e);
5939
+ return i.length === 0 ? U(e.startContainer, t) !== null : i.every((e) => no(e, t));
5940
+ }, G = (e, t) => {
5941
+ let n = /* @__PURE__ */ new Set(), r = to(e);
5919
5942
  for (; r.nextNode();) {
5920
5943
  let e = U(r.currentNode, t);
5921
5944
  e && n.add(e);
5922
5945
  }
5923
5946
  return Array.from(n);
5924
- }, q, eo = class e {
5947
+ }, K, ro = class e {
5925
5948
  static get sanitize() {
5926
5949
  return {
5927
5950
  strong: {},
@@ -5933,7 +5956,7 @@ var Qa = (e, t) => {
5933
5956
  }
5934
5957
  static initializeGlobalListeners() {
5935
5958
  if (typeof document > "u") return !1;
5936
- let t = Za.getInstance();
5959
+ let t = $a.getInstance();
5937
5960
  return t.hasHandler("bold") ? !0 : (t.register("bold", {
5938
5961
  shortcut: {
5939
5962
  key: "b",
@@ -6015,7 +6038,7 @@ var Qa = (e, t) => {
6015
6038
  let e = document.createRange();
6016
6039
  return e.setStartBefore(s), e.setEndAfter(c), r.removeAllRanges(), r.addRange(e), e;
6017
6040
  })() || r.removeAllRanges(), H.normalizeAroundSelection(r), n.forEach((e) => {
6018
- Wa(e) && e.remove();
6041
+ Ka(e) && e.remove();
6019
6042
  }), this.notifySelectionChange();
6020
6043
  }
6021
6044
  replaceRangeWithHtml(t, n) {
@@ -6055,7 +6078,7 @@ var Qa = (e, t) => {
6055
6078
  n.selectNodeContents(e), t.removeAllRanges(), t.addRange(n);
6056
6079
  }
6057
6080
  isRangeBold(e, t) {
6058
- return G(e, L, t);
6081
+ return W(e, L, t);
6059
6082
  }
6060
6083
  removeNestedBold(e) {
6061
6084
  e.querySelectorAll("b,strong").forEach((e) => {
@@ -6151,12 +6174,12 @@ var Qa = (e, t) => {
6151
6174
  if (e.startOffset === n) return R(t);
6152
6175
  if (e.startOffset !== 0) return null;
6153
6176
  let r = t.previousSibling;
6154
- return Ua(r) ? r : null;
6177
+ return Ga(r) ? r : null;
6155
6178
  }
6156
6179
  static getBoundaryBoldForElement(e, t) {
6157
6180
  if (e.startOffset <= 0) return null;
6158
6181
  let n = t.childNodes[e.startOffset - 1];
6159
- return Ua(n) ? n : null;
6182
+ return Ga(n) ? n : null;
6160
6183
  }
6161
6184
  static isSelectionInsideBlok(e) {
6162
6185
  let t = e.anchorNode;
@@ -6175,16 +6198,16 @@ var Qa = (e, t) => {
6175
6198
  return t.innerHTML = e, t.content;
6176
6199
  }
6177
6200
  collectBoldAncestors(e) {
6178
- return K(e, L);
6201
+ return G(e, L);
6179
6202
  }
6180
6203
  };
6181
- q = eo, 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";
6204
+ K = ro, K.isInline = !0, K.title = "Bold", K.titleKey = "bold", K.markerSequence = 0, K.isProcessingMutation = !1, K.instances = /* @__PURE__ */ new Set(), K.guardKeydownListenerRegistered = !1, K.shortcut = "CMD+B";
6182
6205
  //#endregion
6183
6206
  //#region src/components/inline-tools/inline-tool-italic.ts
6184
- var J, to = (e) => {
6207
+ var q, io = (e) => {
6185
6208
  let t = e.tagName;
6186
6209
  return t === "I" || t === "EM";
6187
- }, no = class {
6210
+ }, ao = class {
6188
6211
  static get sanitize() {
6189
6212
  return {
6190
6213
  i: {},
@@ -6233,7 +6256,7 @@ var J, to = (e) => {
6233
6256
  return this.isRangeItalic(t, { ignoreWhitespace: !0 });
6234
6257
  }
6235
6258
  isRangeItalic(e, t) {
6236
- return G(e, to, t);
6259
+ return W(e, io, t);
6237
6260
  }
6238
6261
  wrapWithItalic(e) {
6239
6262
  let t = this.getRangeHtmlWithoutItalic(e), n = this.replaceRangeWithHtml(e, `<i>${t}</i>`), r = window.getSelection();
@@ -6259,13 +6282,13 @@ var J, to = (e) => {
6259
6282
  });
6260
6283
  }
6261
6284
  hasItalicParent(e) {
6262
- return W(e, to);
6285
+ return no(e, io);
6263
6286
  }
6264
6287
  findItalicElement(e) {
6265
- return U(e, to);
6288
+ return U(e, io);
6266
6289
  }
6267
6290
  collectItalicAncestors(e) {
6268
- return K(e, to);
6291
+ return G(e, io);
6269
6292
  }
6270
6293
  getRangeHtmlWithoutItalic(e) {
6271
6294
  let t = e.cloneContents();
@@ -6322,10 +6345,10 @@ var J, to = (e) => {
6322
6345
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
6323
6346
  }
6324
6347
  };
6325
- J = no, J.isInline = !0, J.title = "Italic", J.titleKey = "italic", J.shortcut = "CMD+I";
6348
+ q = ao, q.isInline = !0, q.title = "Italic", q.titleKey = "italic", q.shortcut = "CMD+I";
6326
6349
  //#endregion
6327
6350
  //#region src/components/inline-tools/inline-tool-link.ts
6328
- var Y, ro = "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", io = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", ao = class {
6351
+ var J, oo = "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", so = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text-left pointer-events-none", co = class {
6329
6352
  static get sanitize() {
6330
6353
  return { a: {
6331
6354
  href: !0,
@@ -6385,7 +6408,7 @@ var Y, ro = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
6385
6408
  let t = document.createElement("div");
6386
6409
  t.className = "mt-1 mb-0.5 h-px bg-link-input-border";
6387
6410
  let n = document.createElement("button");
6388
- n.type = "button", n.className = ro, n.setAttribute("data-link-suggestion-row", "");
6411
+ n.type = "button", n.className = oo, n.setAttribute("data-link-suggestion-row", "");
6389
6412
  let r = document.createElement("span");
6390
6413
  r.className = "text-gray-text shrink-0 flex [&>svg]:size-7", r.setAttribute("data-link-suggestion-icon", "");
6391
6414
  let i = document.createElement("span");
@@ -6403,7 +6426,7 @@ var Y, ro = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
6403
6426
  return;
6404
6427
  }
6405
6428
  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]");
6406
- 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 ? ro : io), this.nodes.suggestion.classList.remove("hidden");
6429
+ 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 ? oo : so), this.nodes.suggestion.classList.remove("hidden");
6407
6430
  }
6408
6431
  isLinkComplete(e) {
6409
6432
  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);
@@ -6532,13 +6555,13 @@ var Y, ro = "flex items-center gap-2 w-full mt-0.5 px-1.5 py-1.5 rounded-md text
6532
6555
  e && e.setAttribute(t, n ? "true" : "false");
6533
6556
  }
6534
6557
  };
6535
- Y = ao, Y.isInline = !0, Y.title = "Link", Y.titleKey = "link", Y.shortcut = "CMD+K";
6558
+ J = co, J.isInline = !0, J.title = "Link", J.titleKey = "link", J.shortcut = "CMD+K";
6536
6559
  //#endregion
6537
6560
  //#region src/components/inline-tools/utils/marker-dom-utils.ts
6538
- var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6561
+ var Y = (e) => e.tagName === "MARK", X = (e) => U(e, Y), Z, lo = {
6539
6562
  color: "background-color",
6540
6563
  "background-color": "color"
6541
- }, co = class e {
6564
+ }, uo = class e {
6542
6565
  static get sanitize() {
6543
6566
  return { mark: (t) => {
6544
6567
  let n = t.style, r = Array.from({ length: n.length }, (e, t) => n.item(t));
@@ -6571,7 +6594,7 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6571
6594
  isActive: () => {
6572
6595
  let e = window.getSelection();
6573
6596
  if (!e || e.rangeCount === 0) return !1;
6574
- let t = e.getRangeAt(0), n = G(t, X, { ignoreWhitespace: !0 });
6597
+ let t = e.getRangeAt(0), n = W(t, Y, { ignoreWhitespace: !0 });
6575
6598
  if (n) {
6576
6599
  let e = this.detectBothSelectionColors(t);
6577
6600
  this.updateToolbarColors(e.text, e.bg);
@@ -6622,10 +6645,10 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6622
6645
  if (!r || r.rangeCount === 0) return;
6623
6646
  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;
6624
6647
  this.splitMarksAtBoundaries(i);
6625
- let p = K(i, X);
6648
+ let p = G(i, Y);
6626
6649
  for (let t of p) {
6627
6650
  t.style.removeProperty(e);
6628
- let n = so[e], r = t.style.getPropertyValue(n);
6651
+ let n = lo[e], r = t.style.getPropertyValue(n);
6629
6652
  r !== "" && r !== "transparent" ? this.ensureTransparentBg(t) : this.unwrapElement(t);
6630
6653
  }
6631
6654
  let m = a.isConnected, h = s.isConnected;
@@ -6653,7 +6676,7 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6653
6676
  this.selection.removeFakeBackground(), this.selection.savedSelectionRange && this.selection.restore(), this.selection.clearSaved();
6654
6677
  }
6655
6678
  detectBothSelectionColors(e) {
6656
- let t = oo(e.startContainer);
6679
+ let t = X(e.startContainer);
6657
6680
  if (!t) return {
6658
6681
  text: null,
6659
6682
  bg: null
@@ -6673,7 +6696,7 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6673
6696
  text: null,
6674
6697
  bg: null
6675
6698
  };
6676
- let t = oo(e.getRangeAt(0).startContainer);
6699
+ let t = X(e.getRangeAt(0).startContainer);
6677
6700
  if (!t) return {
6678
6701
  text: null,
6679
6702
  bg: null
@@ -6693,14 +6716,14 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6693
6716
  this.selection.savedSelectionRange && (this.selection.removeFakeBackground(), this.selection.restore(), this.selection.clearSaved());
6694
6717
  }
6695
6718
  findContainingMark(e) {
6696
- let t = oo(e.startContainer), n = oo(e.endContainer);
6719
+ let t = X(e.startContainer), n = X(e.endContainer);
6697
6720
  return t && t === n ? t : null;
6698
6721
  }
6699
6722
  removeNestedMarkStyle(e, t) {
6700
- let n = K(e, X);
6723
+ let n = G(e, Y);
6701
6724
  for (let e of n) {
6702
6725
  e.style.removeProperty(t);
6703
- let n = so[t], r = e.style.getPropertyValue(n);
6726
+ let n = lo[t], r = e.style.getPropertyValue(n);
6704
6727
  r !== "" && r !== "transparent" ? this.ensureTransparentBg(e) : this.unwrapElement(e);
6705
6728
  }
6706
6729
  }
@@ -6731,7 +6754,7 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6731
6754
  }
6732
6755
  }
6733
6756
  splitMarksAtBoundaries(e) {
6734
- let t = K(e, X);
6757
+ let t = G(e, Y);
6735
6758
  for (let n of t) {
6736
6759
  let t = document.createRange();
6737
6760
  t.selectNodeContents(n);
@@ -6800,10 +6823,10 @@ var X = (e) => e.tagName === "MARK", oo = (e) => U(e, X), Z, so = {
6800
6823
  return r === null ? e : u(r, n);
6801
6824
  }
6802
6825
  };
6803
- Z = co, Z.isInline = !0, Z.title = "Color", Z.titleKey = "marker", Z.shortcut = "CMD+SHIFT+H", Z.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
6826
+ Z = uo, Z.isInline = !0, Z.title = "Color", Z.titleKey = "marker", Z.shortcut = "CMD+SHIFT+H", Z.ALLOWED_STYLE_PROPS = new Set(["color", "background-color"]);
6804
6827
  //#endregion
6805
6828
  //#region src/components/inline-tools/inline-tool-underline.ts
6806
- var Q, lo = (e) => e.tagName === "U", uo = class {
6829
+ var Q, fo = (e) => e.tagName === "U", po = class {
6807
6830
  static get sanitize() {
6808
6831
  return { u: {} };
6809
6832
  }
@@ -6849,7 +6872,7 @@ var Q, lo = (e) => e.tagName === "U", uo = class {
6849
6872
  return this.isRangeUnderline(t, { ignoreWhitespace: !0 });
6850
6873
  }
6851
6874
  isRangeUnderline(e, t) {
6852
- return G(e, lo, t);
6875
+ return W(e, fo, t);
6853
6876
  }
6854
6877
  wrapWithUnderline(e) {
6855
6878
  let t = this.getRangeHtmlWithoutUnderline(e), n = this.replaceRangeWithHtml(e, `<u>${t}</u>`), r = window.getSelection();
@@ -6875,13 +6898,13 @@ var Q, lo = (e) => e.tagName === "U", uo = class {
6875
6898
  });
6876
6899
  }
6877
6900
  hasUnderlineParent(e) {
6878
- return W(e, lo);
6901
+ return no(e, fo);
6879
6902
  }
6880
6903
  findUnderlineElement(e) {
6881
- return U(e, lo);
6904
+ return U(e, fo);
6882
6905
  }
6883
6906
  collectUnderlineAncestors(e) {
6884
- return K(e, lo);
6907
+ return G(e, fo);
6885
6908
  }
6886
6909
  getRangeHtmlWithoutUnderline(e) {
6887
6910
  let t = e.cloneContents();
@@ -6938,10 +6961,10 @@ var Q, lo = (e) => e.tagName === "U", uo = class {
6938
6961
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
6939
6962
  }
6940
6963
  };
6941
- Q = uo, Q.isInline = !0, Q.title = "Underline", Q.titleKey = "underline", Q.shortcut = "CMD+U";
6964
+ Q = po, Q.isInline = !0, Q.title = "Underline", Q.titleKey = "underline", Q.shortcut = "CMD+U";
6942
6965
  //#endregion
6943
6966
  //#region src/components/inline-tools/inline-tool-strikethrough.ts
6944
- var $, fo = (e) => e.tagName === "S", po = class {
6967
+ var $, mo = (e) => e.tagName === "S", ho = class {
6945
6968
  static get sanitize() {
6946
6969
  return { s: {} };
6947
6970
  }
@@ -6987,7 +7010,7 @@ var $, fo = (e) => e.tagName === "S", po = class {
6987
7010
  return this.isRangeStrikethrough(t, { ignoreWhitespace: !0 });
6988
7011
  }
6989
7012
  isRangeStrikethrough(e, t) {
6990
- return G(e, fo, t);
7013
+ return W(e, mo, t);
6991
7014
  }
6992
7015
  wrapWithStrikethrough(e) {
6993
7016
  let t = this.getRangeHtmlWithoutStrikethrough(e), n = this.replaceRangeWithHtml(e, `<s>${t}</s>`), r = window.getSelection();
@@ -7013,13 +7036,13 @@ var $, fo = (e) => e.tagName === "S", po = class {
7013
7036
  });
7014
7037
  }
7015
7038
  hasStrikethroughParent(e) {
7016
- return W(e, fo);
7039
+ return no(e, mo);
7017
7040
  }
7018
7041
  findStrikethroughElement(e) {
7019
- return U(e, fo);
7042
+ return U(e, mo);
7020
7043
  }
7021
7044
  collectStrikethroughAncestors(e) {
7022
- return K(e, fo);
7045
+ return G(e, mo);
7023
7046
  }
7024
7047
  getRangeHtmlWithoutStrikethrough(e) {
7025
7048
  let t = e.cloneContents();
@@ -7076,17 +7099,17 @@ var $, fo = (e) => e.tagName === "S", po = class {
7076
7099
  n.insertBefore(r, t.nextSibling), n.insertBefore(e, r);
7077
7100
  }
7078
7101
  };
7079
- $ = po, $.isInline = !0, $.title = "Strikethrough", $.titleKey = "strikethrough", $.shortcut = "CMD+SHIFT+S";
7102
+ $ = ho, $.isInline = !0, $.title = "Strikethrough", $.titleKey = "strikethrough", $.shortcut = "CMD+SHIFT+S";
7080
7103
  //#endregion
7081
7104
  //#region src/tools/index.ts
7082
- var mo = {
7105
+ var go = {
7083
7106
  paragraph: { preserveBlank: !0 },
7084
7107
  header: {},
7085
7108
  list: {},
7086
7109
  table: {},
7087
7110
  toggle: {},
7088
7111
  callout: {}
7089
- }, ho = {
7112
+ }, _o = {
7090
7113
  bold: {},
7091
7114
  italic: {},
7092
7115
  link: {},
@@ -7095,4 +7118,4 @@ var mo = {
7095
7118
  strikethrough: {}
7096
7119
  };
7097
7120
  //#endregion
7098
- export { co as a, eo as c, Zi as d, er as f, uo as i, Ha as l, xt as m, ho as n, ao as o, It as p, po as r, no as s, mo as t, na as u };
7121
+ export { uo as a, ro as c, Zi as d, er as f, po as i, Wa as l, xt as m, _o as n, co as o, It as p, ho as r, ao as s, go as t, na as u };
package/dist/full.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { Wn as e } from "./chunks/constants-B-YnSMJS.mjs";
2
- import { n as t, t as n } from "./chunks/blok-AX-spzEU.mjs";
1
+ import { Wn as e } from "./chunks/constants-Duj_CSIT.mjs";
2
+ import { n as t, t as n } from "./chunks/blok-eDCl1y00.mjs";
3
3
  import { t as r } from "./chunks/objectSpread2-CyPxu8-u.mjs";
4
- import { a as i, c as a, f as o, i as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./chunks/tools-tDa2fh-J.mjs";
4
+ import { a as i, c as a, f as o, i as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./chunks/tools-BG9c26dK.mjs";
5
5
  //#region src/full.ts
6
6
  var g = {
7
7
  paragraph: {
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import "./chunks/constants-B-YnSMJS.mjs";
2
- import { r as e, t } from "./chunks/blok-AX-spzEU.mjs";
1
+ import "./chunks/constants-Duj_CSIT.mjs";
2
+ import { r as e, t } from "./chunks/blok-eDCl1y00.mjs";
3
3
  import { t as n } from "./chunks/objectSpread2-CyPxu8-u.mjs";
4
4
  import { forwardRef as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
5
5
  import { jsx as c } from "react/jsx-runtime";
package/dist/tools.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { m as e } from "./chunks/constants-B-YnSMJS.mjs";
2
- import { a as t, c as n, d as r, f as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./chunks/tools-tDa2fh-J.mjs";
1
+ import { m as e } from "./chunks/constants-Duj_CSIT.mjs";
2
+ import { a as t, c as n, d as r, f as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./chunks/tools-BG9c26dK.mjs";
3
3
  export { n as Bold, o as Callout, e as Convert, u as Header, f as Italic, l as Link, i as List, t as Marker, s as Paragraph, d as Strikethrough, r as Table, m as Toggle, a as Underline, p as defaultBlockTools, c as defaultInlineTools };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackuait/blok",
3
- "version": "0.8.3-beta.3",
3
+ "version": "0.8.3-beta.4",
4
4
  "description": "Blok — headless, highly extensible rich text editor built for developers who need to implement a block-based editing experience (similar to Notion) without building it from scratch",
5
5
  "module": "dist/blok.mjs",
6
6
  "types": "./types/index.d.ts",