@bloklabs/react 1.15.2 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,54 +1,54 @@
1
1
  import { Component as e, Fragment as t, createContext as n, createElement as r, forwardRef as i, isValidElement as a, useCallback as o, useContext as s, useEffect as c, useImperativeHandle as l, useMemo as u, useRef as d, useState as f, useSyncExternalStore as p } from "react";
2
2
  import { Blok as m } from "@bloklabs/core";
3
- import { BlockChildrenMounted as h, DATA_ATTR as g, EMPTY_API as _, EMPTY_OUTPUT_DATA as v, applyChildDecoration as y, changeTouchesSubtree as b, createBlocksApiForEditor as x, createChildDecorationLedger as S, createEmittedEchoWindow as ee, deepEqual as C, deepEqual as w, equalsOutputData as te, fillDefaults as T, markSanitizerConfig as E, mountChildBlocks as D, normalizeReadOnlyConfig as ne, toRenderableData as re } from "@bloklabs/core/adapters";
4
- import { Fragment as O, jsx as k } from "react/jsx-runtime";
5
- import { getDirection as A, normalizeLocale as j } from "@bloklabs/core/locales";
6
- import { createPortal as M, flushSync as N } from "react-dom";
7
- import { blocksToViewNodes as P } from "@bloklabs/core/view";
8
- import { createRoot as F } from "react-dom/client";
3
+ import { BlockChildrenMounted as h, DATA_ATTR as g, EMPTY_API as _, EMPTY_OUTPUT_DATA as v, applyChildDecoration as y, changeTouchesSubtree as b, createBlocksApiForEditor as ee, createChildDecorationLedger as x, createEmittedEchoWindow as te, deepEqual as S, deepEqual as C, equalsOutputData as ne, fillDefaults as w, markSanitizerConfig as re, mountChildBlocks as T, normalizeReadOnlyConfig as ie, toRenderableData as ae, withSlotlessDescendants as E } from "@bloklabs/core/adapters";
4
+ import { Fragment as D, jsx as O } from "react/jsx-runtime";
5
+ import { getDirection as k, normalizeLocale as A } from "@bloklabs/core/locales";
6
+ import { createPortal as j, flushSync as M } from "react-dom";
7
+ import { blocksToViewNodes as N } from "@bloklabs/core/view";
8
+ import { createRoot as P } from "react-dom/client";
9
9
  //#region src/holder-map.ts
10
- var I = /* @__PURE__ */ new WeakMap();
11
- function ie(e, t) {
12
- I.set(e, t);
10
+ var F = /* @__PURE__ */ new WeakMap();
11
+ function oe(e, t) {
12
+ F.set(e, t);
13
13
  }
14
- function ae(e) {
15
- return I.get(e);
14
+ function se(e) {
15
+ return F.get(e);
16
16
  }
17
- function L(e) {
18
- I.delete(e);
17
+ function I(e) {
18
+ F.delete(e);
19
19
  }
20
20
  //#endregion
21
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
22
- function R(e) {
21
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/typeof.js
22
+ function L(e) {
23
23
  "@babel/helpers - typeof";
24
- return R = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
24
+ return L = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
25
25
  return typeof e;
26
26
  } : function(e) {
27
27
  return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
28
- }, R(e);
28
+ }, L(e);
29
29
  }
30
30
  //#endregion
31
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
32
- function z(e, t) {
33
- if (R(e) != "object" || !e) return e;
31
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPrimitive.js
32
+ function R(e, t) {
33
+ if (L(e) != "object" || !e) return e;
34
34
  var n = e[Symbol.toPrimitive];
35
35
  if (n !== void 0) {
36
36
  var r = n.call(e, t || "default");
37
- if (R(r) != "object") return r;
37
+ if (L(r) != "object") return r;
38
38
  throw TypeError("@@toPrimitive must return a primitive value.");
39
39
  }
40
40
  return (t === "string" ? String : Number)(e);
41
41
  }
42
42
  //#endregion
43
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
44
- function B(e) {
45
- var t = z(e, "string");
46
- return R(t) == "symbol" ? t : t + "";
43
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPropertyKey.js
44
+ function z(e) {
45
+ var t = R(e, "string");
46
+ return L(t) == "symbol" ? t : t + "";
47
47
  }
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
50
- function V(e, t, n) {
51
- return (t = B(t)) in e ? Object.defineProperty(e, t, {
49
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/defineProperty.js
50
+ function B(e, t, n) {
51
+ return (t = z(t)) in e ? Object.defineProperty(e, t, {
52
52
  value: n,
53
53
  enumerable: !0,
54
54
  configurable: !0,
@@ -56,8 +56,8 @@ function V(e, t, n) {
56
56
  }) : e[t] = n, e;
57
57
  }
58
58
  //#endregion
59
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/objectSpread2.js
60
- function H(e, t) {
59
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/objectSpread2.js
60
+ function V(e, t) {
61
61
  var n = Object.keys(e);
62
62
  if (Object.getOwnPropertySymbols) {
63
63
  var r = Object.getOwnPropertySymbols(e);
@@ -67,12 +67,12 @@ function H(e, t) {
67
67
  }
68
68
  return n;
69
69
  }
70
- function U(e) {
70
+ function H(e) {
71
71
  for (var t = 1; t < arguments.length; t++) {
72
72
  var n = arguments[t] == null ? {} : arguments[t];
73
- t % 2 ? H(Object(n), !0).forEach(function(t) {
74
- V(e, t, n[t]);
75
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : H(Object(n)).forEach(function(t) {
73
+ t % 2 ? V(Object(n), !0).forEach(function(t) {
74
+ B(e, t, n[t]);
75
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : V(Object(n)).forEach(function(t) {
76
76
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
77
77
  });
78
78
  }
@@ -80,35 +80,35 @@ function U(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/provide-blok.tsx
83
- var W = n({});
84
- function G({ defaults: e, children: t }) {
85
- return /* @__PURE__ */ k(W.Provider, {
83
+ var U = n({});
84
+ function W({ defaults: e, children: t }) {
85
+ return /* @__PURE__ */ O(U.Provider, {
86
86
  value: e,
87
87
  children: t
88
88
  });
89
89
  }
90
- function K() {
91
- return s(W);
90
+ function G() {
91
+ return s(U);
92
92
  }
93
- function oe(e, t) {
93
+ function ce(e, t) {
94
94
  if (Object.keys(e).length === 0) return t;
95
- let n = U({}, e);
95
+ let n = H({}, e);
96
96
  for (let e of Object.keys(t)) {
97
97
  let r = t[e];
98
98
  r !== void 0 && (n[e] = r);
99
99
  }
100
- return (e.tools !== void 0 || t.tools !== void 0) && (n.tools = U(U({}, e.tools), t.tools)), n;
100
+ return (e.tools !== void 0 || t.tools !== void 0) && (n.tools = H(H({}, e.tools), t.tools)), n;
101
101
  }
102
102
  //#endregion
103
103
  //#region src/block-portal-registry.ts
104
- var q = "__blokPortalRegistry", J = "__blokToolName", se = () => {
104
+ var K = "__blokPortalRegistry", q = "__blokToolName", le = () => {
105
105
  let e = { snapshot: /* @__PURE__ */ new Map() }, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), r = (n) => {
106
106
  e.snapshot = n, t.forEach((e) => e());
107
107
  };
108
108
  return {
109
109
  register(t, i) {
110
110
  let a = new Map(e.snapshot), o = i.toolName === void 0 ? void 0 : n.get(i.toolName);
111
- a.set(t, o === void 0 ? i : U(U({}, i), {}, { props: U(U({}, i.props), {}, { config: o }) })), r(a);
111
+ a.set(t, o === void 0 ? i : H(H({}, i), {}, { props: H(H({}, i.props), {}, { config: o }) })), r(a);
112
112
  },
113
113
  unregister(t, n) {
114
114
  let i = e.snapshot.get(t);
@@ -120,14 +120,14 @@ var q = "__blokPortalRegistry", J = "__blokToolName", se = () => {
120
120
  let i = e.snapshot.get(t);
121
121
  if (i === void 0) return;
122
122
  let a = new Map(e.snapshot);
123
- a.set(t, U(U({}, i), {}, { props: U(U({}, i.props), n) })), r(a);
123
+ a.set(t, H(H({}, i), {}, { props: H(H({}, i.props), n) })), r(a);
124
124
  },
125
125
  setToolConfig(t, i) {
126
126
  n.set(t, i);
127
127
  let a = [...e.snapshot].filter(([, e]) => e.toolName === t);
128
128
  if (a.length === 0) return;
129
129
  let o = new Map(e.snapshot);
130
- for (let [e, t] of a) o.set(e, U(U({}, t), {}, { props: U(U({}, t.props), {}, { config: i }) }));
130
+ for (let [e, t] of a) o.set(e, H(H({}, t), {}, { props: H(H({}, t.props), {}, { config: i }) }));
131
131
  r(o);
132
132
  },
133
133
  subscribe(e) {
@@ -139,27 +139,27 @@ var q = "__blokPortalRegistry", J = "__blokToolName", se = () => {
139
139
  return e.snapshot;
140
140
  }
141
141
  };
142
- }, Y = /* @__PURE__ */ new WeakMap();
143
- function ce(e, t) {
144
- Y.set(e, t);
142
+ }, J = /* @__PURE__ */ new WeakMap();
143
+ function ue(e, t) {
144
+ J.set(e, t);
145
145
  }
146
- function le(e) {
147
- return Y.get(e);
146
+ function de(e) {
147
+ return J.get(e);
148
148
  }
149
- function X(e) {
150
- Y.delete(e);
149
+ function Y(e) {
150
+ J.delete(e);
151
151
  }
152
152
  //#endregion
153
153
  //#region src/content-baseline-map.ts
154
- var Z = /* @__PURE__ */ new WeakMap();
155
- function ue(e, t) {
156
- Z.set(e, t);
154
+ var X = /* @__PURE__ */ new WeakMap();
155
+ function fe(e, t) {
156
+ X.set(e, t);
157
157
  }
158
- function de(e) {
159
- return Z.get(e);
158
+ function pe(e) {
159
+ return X.get(e);
160
160
  }
161
- function fe(e) {
162
- Z.delete(e);
161
+ function Z(e) {
162
+ X.delete(e);
163
163
  }
164
164
  //#endregion
165
165
  //#region src/live-tool-config.ts
@@ -167,10 +167,10 @@ var Q = (e) => {
167
167
  if (typeof e != "object" || !e) return !1;
168
168
  let t = Object.getPrototypeOf(e);
169
169
  return t === Object.prototype || t === null;
170
- }, pe = (e, t) => t.reduce((e, t) => {
170
+ }, me = (e, t) => t.reduce((e, t) => {
171
171
  if (Array.isArray(e)) return typeof t == "number" ? e[t] : void 0;
172
172
  if (Q(e)) return e[t];
173
- }, e), me = (e, t) => {
173
+ }, e), he = (e, t) => {
174
174
  let n = (e, t) => {
175
175
  if (typeof e == "function") return typeof t == "function" ? t : e;
176
176
  if (Array.isArray(e)) {
@@ -185,7 +185,7 @@ var Q = (e) => {
185
185
  return e;
186
186
  }, r = n(t, e);
187
187
  return Q(r) ? r : {};
188
- }, he = (e, t) => {
188
+ }, ge = (e, t) => {
189
189
  if (!Q(e)) return e;
190
190
  let n = {};
191
191
  for (let [r, i] of Object.entries(e)) {
@@ -197,7 +197,7 @@ var Q = (e) => {
197
197
  if (typeof n == "function") {
198
198
  let e = n;
199
199
  return function(...n) {
200
- let a = t(), o = Q(a) ? a[r] : void 0, s = pe(Q(o) ? o.config : void 0, i);
200
+ let a = t(), o = Q(a) ? a[r] : void 0, s = me(Q(o) ? o.config : void 0, i);
201
201
  return Reflect.apply(typeof s == "function" ? s : e, this, n);
202
202
  };
203
203
  }
@@ -211,37 +211,37 @@ var Q = (e) => {
211
211
  }
212
212
  return n;
213
213
  };
214
- n[r] = U(U({}, i), {}, { config: a(i.config, []) });
214
+ n[r] = H(H({}, i), {}, { config: a(i.config, []) });
215
215
  }
216
216
  return n;
217
- }, ge = (e) => `[Blok] \`data\` is ignored while collaboration is on: the document lives on the sync service and is shared with everyone editing it, so replacing it from this editor would overwrite their work. To replace the whole document, call POST /sync/${e == null ? "{doc}" : e}/reset on your server — it reloads the document from your own document endpoint and every open editor picks it up. To change part of it, use the blocks API (insert/update/delete).`, _e = (e) => {
217
+ }, _e = (e) => `[Blok] \`data\` is ignored while collaboration is on: the document lives on the sync service and is shared with everyone editing it, so replacing it from this editor would overwrite their work. To replace the whole document, call POST /sync/${e == null ? "{doc}" : e}/reset on your server — it reloads the document from your own document endpoint and every open editor picks it up. To change part of it, use the blocks API (insert/update/delete).`, ve = (e) => {
218
218
  let t = typeof e == "function" ? e : e == null ? void 0 : e.class;
219
219
  return typeof t == "function" && t.__isBlokReactBlock === !0;
220
- }, ve = (e) => {
220
+ }, ye = (e) => {
221
221
  let t = typeof e == "function" ? e : e == null ? void 0 : e.class;
222
222
  return typeof t == "function" && t.__isBlokReactInlineTool === !0;
223
- }, ye = (e, t) => {
223
+ }, be = (e, t) => {
224
224
  if (typeof e != "object" || !e) return e;
225
225
  let n = {};
226
226
  for (let [i, a] of Object.entries(e)) {
227
227
  var r;
228
- if (!_e(a) && !ve(a)) {
228
+ if (!ve(a) && !ye(a)) {
229
229
  n[i] = a;
230
230
  continue;
231
231
  }
232
- let e = typeof a == "function" ? { class: a } : U({}, a);
233
- e.config = U(U({}, (r = e.config) == null ? {} : r), {}, {
234
- [q]: t,
235
- [J]: i
232
+ let e = typeof a == "function" ? { class: a } : H({}, a);
233
+ e.config = H(H({}, (r = e.config) == null ? {} : r), {}, {
234
+ [K]: t,
235
+ [q]: i
236
236
  });
237
237
  let o = e.class.__buildPortalToolbox, s = typeof o == "function" && e.toolbox === void 0 ? o(t, i) : void 0;
238
238
  s !== void 0 && (e.toolbox = s), n[i] = e;
239
239
  }
240
240
  return n;
241
241
  };
242
- function be(e, t) {
242
+ function xe(e, t) {
243
243
  var n, r;
244
- let i = oe(s(W), e), [a, o] = f(null), l = d(i);
244
+ let i = ce(s(U), e), [a, o] = f(null), l = d(i);
245
245
  l.current = i;
246
246
  let p = d({
247
247
  editor: null,
@@ -250,7 +250,7 @@ function be(e, t) {
250
250
  isDestroyed: !1,
251
251
  isEditorReady: !1,
252
252
  depsToken: null
253
- }), h = u(() => ({}), t == null ? [] : t), g = d(i.data), _ = d(ee()), v = d(null), y = d(i.data), b = d(i.collaboration), x = d(Promise.resolve()), S = d(!1), C = d(void 0), T = d(null), E = d(void 0), D = d(/* @__PURE__ */ new Map()), O = d(/* @__PURE__ */ new Map()), k = d(null), A = d({
253
+ }), h = u(() => ({}), t == null ? [] : t), g = d(i.data), _ = d(te()), v = d(null), y = d(i.data), b = d(i.collaboration), ee = d(Promise.resolve()), x = d(null), S = d(void 0), w = d(null), re = d(void 0), T = d(/* @__PURE__ */ new Map()), E = d(/* @__PURE__ */ new Map()), D = d(null), O = d({
254
254
  onChange: !1,
255
255
  onSave: !1,
256
256
  onEnter: !1,
@@ -263,10 +263,10 @@ function be(e, t) {
263
263
  if (typeof window > "u") return;
264
264
  let t = p.current;
265
265
  if (t.destroyTimeout !== null && (clearTimeout(t.destroyTimeout), t.destroyTimeout = null), t.editor !== null && !t.isDestroyed && t.depsToken === h) return t.isEditorReady && o(t.editor), () => {
266
- xe(t, o);
266
+ Se(t, o);
267
267
  };
268
268
  if (t.editor !== null && !t.isDestroyed) {
269
- L(t.editor), X(t.editor), fe(t.editor);
269
+ I(t.editor), Y(t.editor), Z(t.editor);
270
270
  try {
271
271
  t.editor.destroy();
272
272
  } catch (e) {}
@@ -274,8 +274,8 @@ function be(e, t) {
274
274
  }
275
275
  let n = document.createElement("div");
276
276
  t.holder = n, t.isDestroyed = !1, t.isEditorReady = !1, t.depsToken = h;
277
- let r = l.current, i = se(), a = r.tools === void 0 ? void 0 : he(r.tools, () => l.current.tools), s = a === void 0 ? void 0 : ye(a, i);
278
- T.current = i, E.current = a, D.current = /* @__PURE__ */ new Map(), O.current = new Map(Object.entries((e = r.tools) == null ? {} : e).map(([e, t]) => [e, typeof t == "object" && t ? t.toolbox : void 0]));
277
+ let r = l.current, i = le(), a = r.tools === void 0 ? void 0 : ge(r.tools, () => l.current.tools), s = a === void 0 ? void 0 : be(a, i);
278
+ w.current = i, re.current = a, T.current = /* @__PURE__ */ new Map(), E.current = new Map(Object.entries((e = r.tools) == null ? {} : e).map(([e, t]) => [e, typeof t == "object" && t ? t.toolbox : void 0]));
279
279
  let c = {
280
280
  onChange: (...e) => {
281
281
  var t, n;
@@ -302,7 +302,7 @@ function be(e, t) {
302
302
  (t = (n = l.current).onAfterRender) == null || t.call(n, ...e);
303
303
  }
304
304
  };
305
- k.current = c;
305
+ D.current = c;
306
306
  let u = {
307
307
  onChange: r.onChange !== void 0,
308
308
  onSave: r.onSave !== void 0,
@@ -311,57 +311,57 @@ function be(e, t) {
311
311
  onBeforeRender: r.onBeforeRender !== void 0,
312
312
  onAfterRender: r.onAfterRender !== void 0
313
313
  };
314
- A.current = u;
315
- let d = U(U(U(U(U(U(U(U({}, r), s === void 0 ? {} : { tools: s }), {}, {
314
+ O.current = u;
315
+ let d = H(H(H(H(H(H(H(H({}, r), s === void 0 ? {} : { tools: s }), {}, {
316
316
  holder: n,
317
317
  onReady: (...e) => {
318
318
  var t, n;
319
319
  (t = (n = l.current).onReady) == null || t.call(n, ...e);
320
320
  }
321
321
  }, u.onChange ? { onChange: c.onChange } : {}), u.onSave ? { onSave: c.onSave } : {}), u.onEnter ? { onEnter: c.onEnter } : {}), u.onSubmit ? { onSubmit: c.onSubmit } : {}), u.onBeforeRender ? { onBeforeRender: c.onBeforeRender } : {}), u.onAfterRender ? { onAfterRender: c.onAfterRender } : {}), f = new m(d);
322
- return t.editor = f, y.current = r.data, b.current = r.collaboration, ie(f, n), ce(f, i), ue(f, { markRendered: (e) => {
323
- _.current.clear(), g.current = e, C.current = void 0;
322
+ return t.editor = f, y.current = r.data, b.current = r.collaboration, oe(f, n), ue(f, i), fe(f, { markRendered: (e) => {
323
+ _.current.clear(), g.current = e, S.current = void 0;
324
324
  } }), f.isReady.then(() => {
325
325
  t.editor === f && !t.isDestroyed && (t.isEditorReady = !0, o(f));
326
326
  }).catch(() => {
327
327
  if (t.editor === f && !t.isDestroyed) {
328
- L(f), X(f), fe(f);
328
+ I(f), Y(f), Z(f);
329
329
  try {
330
330
  f.destroy();
331
331
  } catch (e) {}
332
332
  t.editor = null, t.holder = null, t.isDestroyed = !0, t.isEditorReady = !1, o(null);
333
333
  }
334
334
  }), () => {
335
- xe(t, o);
335
+ Se(t, o);
336
336
  };
337
337
  }, [h]), c(() => {
338
- let e = T.current, t = p.current;
338
+ let e = w.current, t = p.current;
339
339
  if (e === null || t.editor === null || t.isDestroyed) return;
340
340
  let n = l.current.tools;
341
341
  if (typeof n != "object" || !n) return;
342
- let r = E.current;
342
+ let r = re.current;
343
343
  for (let [t, a] of Object.entries(n)) {
344
344
  var i;
345
- if (!_e(a)) continue;
346
- let n = typeof a == "function" || (i = a.config) == null ? {} : i, o = r == null ? void 0 : r[t], s = me(typeof o == "object" && o ? o.config : void 0, n), c = D.current.get(t);
347
- if (c !== void 0 && w(s, c)) continue;
345
+ if (!ve(a)) continue;
346
+ let n = typeof a == "function" || (i = a.config) == null ? {} : i, o = r == null ? void 0 : r[t], s = he(typeof o == "object" && o ? o.config : void 0, n), c = T.current.get(t);
347
+ if (c !== void 0 && C(s, c)) continue;
348
348
  let l = Object.freeze(s);
349
- D.current.set(t, l), e.setToolConfig(t, l);
349
+ T.current.set(t, l), e.setToolConfig(t, l);
350
350
  }
351
351
  }), c(() => {
352
352
  let e = p.current;
353
353
  if (e.editor === null || e.isDestroyed || !e.isEditorReady) return;
354
354
  let t = l.current.tools;
355
- if (!(typeof t != "object" || !t)) for (let [r, i] of Object.entries(t)) {
355
+ if (typeof t == "object" && t) for (let [r, i] of Object.entries(t)) {
356
356
  var n;
357
- if (!O.current.has(r)) continue;
358
- let t = typeof i == "object" && i ? i.toolbox : void 0, a = O.current.get(r);
359
- w(t, a) || (O.current.set(r, t), (n = e.editor.tools) == null || n.update(r, { toolbox: t }));
357
+ if (!E.current.has(r)) continue;
358
+ let t = typeof i == "object" && i ? i.toolbox : void 0, a = E.current.get(r);
359
+ C(t, a) || (E.current.set(r, t), (n = e.editor.tools) == null || n.update(r, { toolbox: t }));
360
360
  }
361
361
  }), c(() => {
362
- let e = p.current, t = k.current;
362
+ let e = p.current, t = D.current;
363
363
  if (e.editor === null || e.isDestroyed || !e.isEditorReady || t === null) return;
364
- let n = l.current, r = A.current, i = {}, a = { value: !1 }, o = (e, i) => {
364
+ let n = l.current, r = O.current, i = {}, a = { value: !1 }, o = (e, i) => {
365
365
  let o = n[e] !== void 0;
366
366
  o !== r[e] && (r[e] = o, a.value = !0, i(o ? t[e] : void 0));
367
367
  };
@@ -379,81 +379,82 @@ function be(e, t) {
379
379
  i.onAfterRender = e;
380
380
  }), a.value && e.editor.handlers.set(i);
381
381
  });
382
- let j = typeof i.readOnly == "object" && i.readOnly !== null, { enabled: M, hideControls: N } = ne(i.readOnly);
382
+ let k = typeof i.readOnly == "object" && i.readOnly !== null, { enabled: A, hideControls: j } = ie(i.readOnly);
383
383
  c(() => {
384
- a !== null && (j ? a.readOnly.set(M, { hideControls: N }) : a.readOnly.set(M));
384
+ a !== null && (k ? a.readOnly.set(A, { hideControls: j }) : a.readOnly.set(A));
385
385
  }, [
386
386
  a,
387
- M,
388
- N,
389
- j
387
+ A,
388
+ j,
389
+ k
390
390
  ]);
391
- let { hideToolbar: P } = i;
391
+ let { hideToolbar: M } = i;
392
+ c(() => {
393
+ a !== null && M !== void 0 && a.toolbar.setHidden(M);
394
+ }, [a, M]);
395
+ let { toolbarPosition: N } = i;
392
396
  c(() => {
393
- a !== null && P !== void 0 && a.toolbar.setHidden(P);
394
- }, [a, P]);
395
- let { toolbarPosition: F } = i;
397
+ a !== null && N !== void 0 && a.toolbar.setPosition(N);
398
+ }, [a, N]);
399
+ let { inlineToolbar: P } = i, F = P === void 0 ? void 0 : JSON.stringify(P);
396
400
  c(() => {
397
- a !== null && F !== void 0 && a.toolbar.setPosition(F);
401
+ a !== null && P !== void 0 && a.tools.setInlineToolbar(P);
398
402
  }, [a, F]);
399
- let { inlineToolbar: I } = i, ae = I === void 0 ? void 0 : JSON.stringify(I);
403
+ let { autofocus: se } = i;
404
+ c(() => {
405
+ a !== null && se && a.focus();
406
+ }, [a, se]);
407
+ let { theme: L } = i;
400
408
  c(() => {
401
- a !== null && I !== void 0 && a.tools.setInlineToolbar(I);
402
- }, [a, ae]);
403
- let { autofocus: R } = i;
409
+ a !== null && L !== void 0 && a.theme.set(L);
410
+ }, [a, L]);
411
+ let { width: R } = i;
404
412
  c(() => {
405
- a === null || !R || a.focus();
413
+ a !== null && R !== void 0 && a.width.set(R);
406
414
  }, [a, R]);
407
- let { theme: z } = i;
415
+ let z = (n = i.style) == null ? void 0 : n.tokens, B = d((r = i.style) == null ? void 0 : r.tokens);
408
416
  c(() => {
409
- a !== null && z !== void 0 && a.theme.set(z);
417
+ a !== null && z !== void 0 && (C(z, B.current) || (B.current = z, a.tokens.set(z)));
410
418
  }, [a, z]);
411
- let { width: B } = i;
419
+ let { i18n: V } = i, W = d(i.i18n);
412
420
  c(() => {
413
- a !== null && B !== void 0 && a.width.set(B);
414
- }, [a, B]);
415
- let V = (n = i.style) == null ? void 0 : n.tokens, H = d((r = i.style) == null ? void 0 : r.tokens);
416
- c(() => {
417
- a !== null && V !== void 0 && (w(V, H.current) || (H.current = V, a.tokens.set(V)));
421
+ let e = W.current;
422
+ if (a === null || V === void 0 && (e == null ? void 0 : e.direction) === void 0 || C(V, e)) return;
423
+ W.current = V;
424
+ let { locale: t, messages: n, direction: r } = V == null ? {} : V, i = r == null ? (e == null ? void 0 : e.direction) === void 0 ? void 0 : null : r;
425
+ a.i18n.update(H(H(H({}, t === void 0 ? {} : { locale: t }), n === void 0 ? {} : { messages: n }), i === void 0 ? {} : { direction: i }));
418
426
  }, [a, V]);
419
- let { i18n: G } = i, K = d(i.i18n);
427
+ let { placeholder: G } = i;
420
428
  c(() => {
421
- if (a === null || G === void 0 || w(G, K.current)) return;
422
- K.current = G;
423
- let { locale: e, messages: t, direction: n } = G;
424
- a.i18n.update(U(U(U({}, e === void 0 ? {} : { locale: e }), t === void 0 ? {} : { messages: t }), n === void 0 ? {} : { direction: n }));
429
+ a !== null && G !== void 0 && a.placeholder.set(G);
425
430
  }, [a, G]);
426
- let { placeholder: q } = i;
427
- c(() => {
428
- a !== null && q !== void 0 && a.placeholder.set(q);
429
- }, [a, q]);
430
- let { data: J } = i;
431
+ let { data: K } = i;
431
432
  return c(() => {
432
- if (a === null || J === void 0) return;
433
+ if (a === null || K === void 0) return;
433
434
  let e = p.current;
434
435
  if (e.editor !== a || e.isDestroyed) return;
435
- if (v.current !== a && (v.current = a, C.current = void 0, _.current.clear(), w(J, y.current))) {
436
- g.current = J;
436
+ if (v.current !== a && (v.current = a, S.current = void 0, _.current.clear(), C(K, y.current))) {
437
+ g.current = K;
437
438
  return;
438
439
  }
439
- let t = g.current, n = C.current;
440
- if (t !== void 0 && te(J, t) || n !== void 0 && te(J, n) || _.current.matches(J)) return;
440
+ let t = g.current, n = S.current;
441
+ if (t !== void 0 && ne(K, t) || n !== void 0 && ne(K, n) || _.current.matches(K)) return;
441
442
  let r = b.current;
442
443
  if (r !== void 0) {
443
- S.current || (S.current = !0, console.warn(ge(r.doc)));
444
+ x.current !== a && (x.current = a, console.warn(_e(r.doc)));
444
445
  return;
445
446
  }
446
- _.current.clear(), C.current = J, x.current = x.current.catch(() => void 0).then(() => a.render(re(J))).then(() => {
447
- g.current = J;
447
+ _.current.clear(), S.current = K, ee.current = ee.current.catch(() => void 0).then(() => a.render(ae(K))).then(() => {
448
+ g.current = K;
448
449
  }, () => {}).then(() => {
449
- C.current === J && (C.current = void 0);
450
+ S.current === K && (S.current = void 0);
450
451
  });
451
- }, [a, J]), a;
452
+ }, [a, K]), a;
452
453
  }
453
- function xe(e, t) {
454
+ function Se(e, t) {
454
455
  e.destroyTimeout = setTimeout(() => {
455
456
  if (e.editor !== null) {
456
- L(e.editor), X(e.editor), fe(e.editor);
457
+ I(e.editor), Y(e.editor), Z(e.editor);
457
458
  try {
458
459
  e.editor.destroy();
459
460
  } catch (e) {}
@@ -463,7 +464,7 @@ function xe(e, t) {
463
464
  }
464
465
  //#endregion
465
466
  //#region src/BlockPortalHost.tsx
466
- var Se = class extends e {
467
+ var Ce = class extends e {
467
468
  constructor(...e) {
468
469
  super(...e), this.state = { failed: !1 };
469
470
  }
@@ -475,22 +476,22 @@ var Se = class extends e {
475
476
  return this.state.failed ? null : this.props.children;
476
477
  }
477
478
  };
478
- function Ce({ registry: e }) {
479
+ function we({ registry: e }) {
479
480
  let t = p(e.subscribe, e.getSnapshot, e.getSnapshot);
480
- return /* @__PURE__ */ k(O, { children: Array.from(t.entries()).map(([e, t]) => {
481
+ return /* @__PURE__ */ O(D, { children: Array.from(t.entries()).map(([e, t]) => {
481
482
  let n = t.component;
482
- return M(/* @__PURE__ */ k(Se, { children: /* @__PURE__ */ k(n, U({}, t.props)) }), t.hostEl, e);
483
+ return j(/* @__PURE__ */ O(Ce, { children: /* @__PURE__ */ O(n, H({}, t.props)) }), t.hostEl, e);
483
484
  }) });
484
485
  }
485
486
  //#endregion
486
487
  //#region src/blok-instance-context.ts
487
- var we = n(null);
488
- function Te() {
489
- return s(we);
488
+ var Te = n(null);
489
+ function Ee() {
490
+ return s(Te);
490
491
  }
491
492
  //#endregion
492
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/objectWithoutPropertiesLoose.js
493
- function Ee(e, t) {
493
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/objectWithoutPropertiesLoose.js
494
+ function De(e, t) {
494
495
  if (e == null) return {};
495
496
  var n = {};
496
497
  for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
@@ -500,10 +501,10 @@ function Ee(e, t) {
500
501
  return n;
501
502
  }
502
503
  //#endregion
503
- //#region \0@oxc-project+runtime@0.147.0/helpers/esm/objectWithoutProperties.js
504
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/objectWithoutProperties.js
504
505
  function $(e, t) {
505
506
  if (e == null) return {};
506
- var n, r, i = Ee(e, t);
507
+ var n, r, i = De(e, t);
507
508
  if (Object.getOwnPropertySymbols) {
508
509
  var a = Object.getOwnPropertySymbols(e);
509
510
  for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
@@ -512,22 +513,22 @@ function $(e, t) {
512
513
  }
513
514
  //#endregion
514
515
  //#region src/BlokContent.tsx
515
- var De = ["editor"];
516
- function Oe(e) {
516
+ var Oe = ["editor"];
517
+ function ke(e) {
517
518
  var t, n;
518
519
  if (typeof window > "u") return;
519
520
  let r = window.location.hash.slice(1);
520
- r !== "" && ((t = (n = e.blocks).scrollToBlock) == null || t.call(n, ke(r)));
521
+ r !== "" && ((t = (n = e.blocks).scrollToBlock) == null || t.call(n, Ae(r)));
521
522
  }
522
- function ke(e) {
523
+ function Ae(e) {
523
524
  try {
524
525
  return decodeURIComponent(e);
525
526
  } catch (t) {
526
527
  return e;
527
528
  }
528
529
  }
529
- var Ae = i(function(e, t) {
530
- let { editor: n } = e, r = $(e, De), i = d(null), a = (e) => {
530
+ var je = i(function(e, t) {
531
+ let { editor: n } = e, r = $(e, Oe), i = d(null), a = (e) => {
531
532
  if (i.current = e, typeof t == "function") t(e);
532
533
  else if (t != null) {
533
534
  let n = t;
@@ -536,33 +537,33 @@ var Ae = i(function(e, t) {
536
537
  };
537
538
  c(() => {
538
539
  if (n === null || i.current === null) return;
539
- let e = ae(n);
540
- if (e !== void 0) return i.current.appendChild(e), Oe(n), () => {
540
+ let e = se(n);
541
+ if (e !== void 0) return i.current.appendChild(e), ke(n), () => {
541
542
  e.remove();
542
543
  };
543
544
  }, [n]);
544
- let o = n === null ? void 0 : le(n);
545
- return /* @__PURE__ */ k("div", U(U({ ref: a }, r), {}, { children: o === void 0 ? null : /* @__PURE__ */ k(we.Provider, {
545
+ let o = n === null ? void 0 : de(n);
546
+ return /* @__PURE__ */ O("div", H(H({ ref: a }, r), {}, { children: o === void 0 ? null : /* @__PURE__ */ O(Te.Provider, {
546
547
  value: n,
547
- children: /* @__PURE__ */ k(Ce, { registry: o })
548
+ children: /* @__PURE__ */ O(we, { registry: o })
548
549
  }) }));
549
- }), je = /* @__PURE__ */ "autofocus.defaultBlock.dataModel.placeholder.sanitizer.hideToolbar.toolbarPosition.maxHistoryLength.historyDebounceTime.newGroupDelay.globalUndoRedo.tools.data.minHeight.logLevel.readOnly.i18n.link.linkPaste.onBeforePaste.onReady.onChange.onSave.onError.onEnter.onSubmit.onBeforeRender.onAfterRender.inlineToolbar.inlineEmoji.tunes.style.theme.onThemeChange.scrollToBlock.user.resolveUser.notifierPosition.notifier.width.migrations.uploader.server.ticket.persistence.collaboration.captureClicksBelowEditor".split("."), Me = [
550
+ }), Me = /* @__PURE__ */ "autofocus.defaultBlock.dataModel.placeholder.sanitizer.hideToolbar.toolbarPosition.maxHistoryLength.historyDebounceTime.newGroupDelay.globalUndoRedo.tools.data.minHeight.loader.logLevel.readOnly.i18n.link.linkPaste.onBeforePaste.onReady.onChange.onSave.onError.onImageFailure.onEnter.onSubmit.onBeforeRender.onAfterRender.inlineToolbar.inlineEmoji.find.tunes.style.theme.onThemeChange.scrollToBlock.user.resolveUser.notifierPosition.notifier.width.migrations.uploader.media.server.ticket.persistence.collaboration.documentId.tabSync.captureClicksBelowEditor".split("."), Ne = [
550
551
  "deps",
551
552
  "onReady",
552
553
  "locale",
553
554
  "onBlocksRendered",
554
555
  "onBlockRendered"
555
- ], Ne = new Set(je), Pe = i(function(e, t) {
556
- let { deps: n, onReady: r, locale: i, onBlocksRendered: a, onBlockRendered: o } = e, s = $(e, Me), u = {}, f = {};
556
+ ], Pe = new Set(Me), Fe = i(function(e, t) {
557
+ let { deps: n, onReady: r, locale: i, onBlocksRendered: a, onBlockRendered: o } = e, s = $(e, Ne), u = {}, f = {};
557
558
  for (let e of Object.keys(s)) {
558
559
  let t = s[e];
559
- Ne.has(e) ? u[e] = t : f[e] = t;
560
+ Pe.has(e) ? u[e] = t : f[e] = t;
560
561
  }
561
562
  if (i !== void 0) {
562
563
  let e = u.i18n;
563
- u.i18n = U(U({}, e), {}, { locale: i });
564
+ u.i18n = H(H({}, e), {}, { locale: i });
564
565
  }
565
- let p = be(u, n);
566
+ let p = xe(u, n);
566
567
  l(t, () => p, [p]);
567
568
  let m = d(r);
568
569
  m.current = r;
@@ -602,11 +603,11 @@ var Ae = i(function(e, t) {
602
603
  p,
603
604
  v,
604
605
  y
605
- ]), /* @__PURE__ */ k(Ae, U({ editor: p }, f));
606
+ ]), /* @__PURE__ */ O(je, H({ editor: p }, f));
606
607
  });
607
608
  //#endregion
608
609
  //#region src/useBlokHandle.ts
609
- function Fe() {
610
+ function Ie() {
610
611
  let e = d(null);
611
612
  return u(() => ({
612
613
  ref: (t) => {
@@ -626,15 +627,16 @@ function Fe() {
626
627
  let t = e.current;
627
628
  return t === null ? Promise.resolve() : t.clear().then(() => {
628
629
  var e;
629
- (e = de(t)) == null || e.markRendered(v);
630
+ (e = pe(t)) == null || e.markRendered(v);
630
631
  });
631
632
  },
632
633
  save: () => e.current === null ? Promise.resolve(null) : e.current.save(),
634
+ confirmLeave: () => e.current === null ? Promise.resolve(!0) : e.current.confirmLeave(),
633
635
  render: (t) => {
634
636
  let n = e.current;
635
637
  return n === null ? Promise.resolve() : n.render(t).then(() => {
636
638
  var e;
637
- (e = de(n)) == null || e.markRendered(t);
639
+ (e = pe(n)) == null || e.markRendered(t);
638
640
  });
639
641
  },
640
642
  setReadOnly: (t) => {
@@ -645,23 +647,23 @@ function Fe() {
645
647
  }
646
648
  //#endregion
647
649
  //#region src/useBlocks.ts
648
- var Ie = "block changed";
649
- function Le(e, t = {}) {
650
+ var Le = "block changed";
651
+ function Re(e, t = {}) {
650
652
  var n;
651
653
  let r = (n = t.within) == null ? null : n, i = d(0), a = d(e);
652
654
  a.current !== e && (a.current = e, i.current = 0);
653
655
  let s = o((t) => {
654
656
  if (e === null) return () => void 0;
655
657
  let n = (n) => {
656
- r !== null && !b(e, n, r) || (i.current += 1, t());
658
+ (r === null || b(e, n, r)) && (i.current += 1, t());
657
659
  };
658
- return e.on(Ie, n), () => e.off(Ie, n);
660
+ return e.on(Le, n), () => e.off(Le, n);
659
661
  }, [e, r]), c = o(() => i.current, []);
660
- return p(s, c, c), u(() => e === null ? _ : x(e), [e]);
662
+ return p(s, c, c), u(() => e === null ? _ : ee(e), [e]);
661
663
  }
662
664
  //#endregion
663
665
  //#region src/useBlokReady.ts
664
- function Re(e = {}) {
666
+ function ze(e = {}) {
665
667
  let { within: t, settleOn: n } = e, [r, i] = f(!1);
666
668
  return c(() => {
667
669
  let e = () => {
@@ -677,7 +679,7 @@ function Re(e = {}) {
677
679
  }
678
680
  //#endregion
679
681
  //#region src/view-nodes-to-react.ts
680
- var ze = /* @__PURE__ */ new Set([
682
+ var Be = /* @__PURE__ */ new Set([
681
683
  "area",
682
684
  "base",
683
685
  "br",
@@ -692,7 +694,7 @@ var ze = /* @__PURE__ */ new Set([
692
694
  "source",
693
695
  "track",
694
696
  "wbr"
695
- ]), Be = /* @__PURE__ */ new Set([
697
+ ]), Ve = /* @__PURE__ */ new Set([
696
698
  "disabled",
697
699
  "open",
698
700
  "controls",
@@ -708,7 +710,7 @@ var ze = /* @__PURE__ */ new Set([
708
710
  "novalidate",
709
711
  "allowfullscreen",
710
712
  "itemscope"
711
- ]), Ve = {
713
+ ]), He = {
712
714
  class: "className",
713
715
  for: "htmlFor",
714
716
  colspan: "colSpan",
@@ -730,7 +732,7 @@ var ze = /* @__PURE__ */ new Set([
730
732
  minlength: "minLength",
731
733
  usemap: "useMap",
732
734
  itemscope: "itemScope"
733
- }, He = (e) => {
735
+ }, Ue = (e) => e.startsWith("aria-") || e.startsWith("data-") ? e : e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), We = (e) => {
734
736
  let t = {};
735
737
  for (let n of e.split(";")) {
736
738
  let e = n.indexOf(":");
@@ -741,37 +743,37 @@ var ze = /* @__PURE__ */ new Set([
741
743
  t[a] = i;
742
744
  }
743
745
  return t;
744
- }, Ue = (e, t) => {
745
- let n = { key: t };
746
- for (let [t, a] of Object.entries(e)) {
747
- var r;
746
+ }, Ge = (e, t, n) => {
747
+ let r = { key: t };
748
+ for (let [t, o] of Object.entries(e)) {
749
+ var i;
748
750
  if (t === "style") {
749
- n.style = He(a);
751
+ r.style = We(o);
750
752
  continue;
751
753
  }
752
754
  if (t === "checked") {
753
- n.defaultChecked = !0;
755
+ r.defaultChecked = !0;
754
756
  continue;
755
757
  }
756
758
  if (t === "value") {
757
- n.defaultValue = a;
759
+ r.defaultValue = o;
758
760
  continue;
759
761
  }
760
- if (Be.has(t)) {
761
- var i;
762
- n[(i = Ve[t]) == null ? t : i] = !0;
762
+ if (Ve.has(t)) {
763
+ var a;
764
+ r[(a = He[t]) == null ? t : a] = !0;
763
765
  continue;
764
766
  }
765
- n[(r = Ve[t]) == null ? t : r] = a;
767
+ r[(i = He[t]) == null ? n ? Ue(t) : t : i] = o;
766
768
  }
767
- return n;
768
- }, We = (e) => e.map((e, t) => {
769
+ return r;
770
+ }, Ke = (e, t = !1) => e.map((e, n) => {
769
771
  if ("text" in e) return e.text;
770
- let n = Ue(e.attrs, t);
771
- return ze.has(e.tag) || e.children.length === 0 ? r(e.tag, n) : r(e.tag, n, ...We(e.children));
772
- }), Ge = (e, n) => {
773
- let i = n == null ? void 0 : n.schema, a = n == null ? void 0 : n.renderers, o = n == null ? void 0 : n.onUnknownBlock, s = n == null ? void 0 : n.toolAttributes, c = n == null ? void 0 : n.blockIds, l = n == null ? void 0 : n.transformUrl, d = n == null ? void 0 : n.inlineRenderers, f = n == null ? void 0 : n.classes;
774
- return u(() => r(t, null, ...We(P(e, {
772
+ let i = t || e.tag === "svg", a = Ge(e.attrs, n, i);
773
+ return Be.has(e.tag) || e.children.length === 0 ? r(e.tag, a) : r(e.tag, a, ...Ke(e.children, i));
774
+ }), qe = (e, n) => {
775
+ let i = n == null ? void 0 : n.schema, a = n == null ? void 0 : n.renderers, o = n == null ? void 0 : n.onUnknownBlock, s = n == null ? void 0 : n.toolAttributes, c = n == null ? void 0 : n.blockIds, l = n == null ? void 0 : n.transformUrl, d = n == null ? void 0 : n.inlineRenderers, f = n == null ? void 0 : n.pageHref, p = n == null ? void 0 : n.pageInfo, m = n == null ? void 0 : n.classes, h = n == null ? void 0 : n.direction;
776
+ return u(() => r(t, null, ...Ke(N(e, {
775
777
  schema: i,
776
778
  renderers: a,
777
779
  onUnknownBlock: o,
@@ -779,7 +781,10 @@ var ze = /* @__PURE__ */ new Set([
779
781
  blockIds: c,
780
782
  transformUrl: l,
781
783
  inlineRenderers: d,
782
- classes: f
784
+ pageHref: f,
785
+ pageInfo: p,
786
+ classes: m,
787
+ direction: h
783
788
  }))), [
784
789
  e,
785
790
  i,
@@ -789,9 +794,12 @@ var ze = /* @__PURE__ */ new Set([
789
794
  c,
790
795
  l,
791
796
  d,
792
- f
797
+ f,
798
+ p,
799
+ m,
800
+ h
793
801
  ]);
794
- }, Ke = [
802
+ }, Je = [
795
803
  "data",
796
804
  "schema",
797
805
  "renderers",
@@ -800,9 +808,12 @@ var ze = /* @__PURE__ */ new Set([
800
808
  "blockIds",
801
809
  "transformUrl",
802
810
  "inlineRenderers",
803
- "classes"
804
- ], qe = (e) => {
805
- let { data: t, schema: n, renderers: r, onUnknownBlock: i, toolAttributes: a, blockIds: o, transformUrl: s, inlineRenderers: c, classes: l } = e, u = $(e, Ke), d = Ge(t, {
811
+ "pageHref",
812
+ "pageInfo",
813
+ "classes",
814
+ "direction"
815
+ ], Ye = (e) => {
816
+ let { data: t, schema: n, renderers: r, onUnknownBlock: i, toolAttributes: a, blockIds: o, transformUrl: s, inlineRenderers: c, pageHref: l, pageInfo: u, classes: d, direction: f } = e, p = $(e, Je), m = qe(t, {
806
817
  schema: n,
807
818
  renderers: r,
808
819
  onUnknownBlock: i,
@@ -810,38 +821,44 @@ var ze = /* @__PURE__ */ new Set([
810
821
  blockIds: o,
811
822
  transformUrl: s,
812
823
  inlineRenderers: c,
813
- classes: l == null || l
824
+ pageHref: l,
825
+ pageInfo: u,
826
+ classes: d == null || d,
827
+ direction: f
814
828
  });
815
- return /* @__PURE__ */ k("div", U(U({ "data-blok-interface": "view" }, u), {}, { children: d }));
816
- }, Je = ["icon", "title"], Ye = ["commit", "readOnly"], Xe = [q, J], Ze = (e, t, n) => {
829
+ return /* @__PURE__ */ O("div", H(H({
830
+ "data-blok-interface": "view",
831
+ dir: f
832
+ }, p), {}, { children: m }));
833
+ }, Xe = ["icon", "title"], Ze = ["commit", "readOnly"], Qe = [K, q], $e = (e, t, n) => {
817
834
  var r;
818
835
  e == null || (r = e.events) == null || r.emit(h, {
819
836
  blockId: t,
820
837
  childIds: n.map((e) => e.id)
821
838
  });
822
- }, Qe = /* @__PURE__ */ new Set([
839
+ }, et = /* @__PURE__ */ new Set([
823
840
  void 0,
824
841
  "user",
825
842
  "api",
826
843
  "convert"
827
- ]), $e = [
844
+ ]), tt = [
828
845
  "toolbox",
829
846
  "isReadOnlySupported",
830
847
  "__isBlokReactBlock",
831
848
  "__buildPortalToolbox"
832
849
  ];
833
- function et(e) {
850
+ function nt(e) {
834
851
  var t, n;
835
852
  let r = (e) => {
836
853
  if (typeof document > "u") return null;
837
- let t = document.createElement("div"), n = F(t);
838
- N(() => {
854
+ let t = document.createElement("div"), n = P(t);
855
+ M(() => {
839
856
  n.render(e);
840
857
  });
841
858
  let r = t.innerHTML;
842
859
  return n.unmount(), r === "" ? null : r;
843
860
  }, i = (e) => {
844
- let { icon: t, title: n } = e, i = U({}, $(e, Je));
861
+ let { icon: t, title: n } = e, i = H({}, $(e, Xe));
845
862
  if (typeof n == "string" && (i.title = n), !a(t)) return t !== void 0 && (i.icon = t), {
846
863
  entry: i,
847
864
  deferred: !1
@@ -873,13 +890,13 @@ function et(e) {
873
890
  if (s && delete o.icon, !a(e.title)) return o;
874
891
  let c = document.createElement("span");
875
892
  c.setAttribute("data-blok-mutation-free", "true");
876
- let l = e.title, u = () => /* @__PURE__ */ k(O, { children: l });
893
+ let l = e.title, u = () => /* @__PURE__ */ O(D, { children: l });
877
894
  return u.displayName = `BlokToolboxTitle(${n})`, t.register(`__blok-toolbox-title__:${n}:${r}`, {
878
895
  hostEl: c,
879
896
  component: u,
880
897
  props: {},
881
898
  toolName: n
882
- }), U(U({}, o), {}, { titleEl: c });
899
+ }), H(H({}, o), {}, { titleEl: c });
883
900
  });
884
901
  return Array.isArray(e.toolbox) ? o : o[0];
885
902
  }, l = {
@@ -892,11 +909,11 @@ function et(e) {
892
909
  }, f = e.viewComponent === void 0 ? e.component : (t) => {
893
910
  let n = e.viewComponent;
894
911
  if (t.readOnly && n !== void 0) {
895
- let { commit: e, readOnly: r } = t, i = $(t, Ye);
896
- return /* @__PURE__ */ k(n, U({}, i));
912
+ let { commit: e, readOnly: r } = t, i = $(t, Ze);
913
+ return /* @__PURE__ */ O(n, H({}, i));
897
914
  }
898
915
  let r = e.component;
899
- return /* @__PURE__ */ k(r, U({}, t));
916
+ return /* @__PURE__ */ O(r, H({}, t));
900
917
  }, p = (t = class {
901
918
  static get toolbox() {
902
919
  return u();
@@ -913,32 +930,32 @@ function et(e) {
913
930
  this.anchorEl = e;
914
931
  }, this.commit = (t) => {
915
932
  var n;
916
- let r = T(e.propSchema, U(U({}, this.mirror), t));
917
- C(r, this.mirror) || (this.mirror = r, this.lastRendered = r, (n = this.registry) == null || n.setProps(this.blockApi.id, { data: r }), this.flushDispatch());
933
+ let r = w(e.propSchema, H(H({}, this.mirror), t));
934
+ S(r, this.mirror) || (this.mirror = r, this.lastRendered = r, (n = this.registry) == null || n.setProps(this.blockApi.id, { data: r }), this.flushDispatch());
918
935
  }, this.blockApi = t.block;
919
936
  let a = (n = t.config) == null ? {} : n;
920
- this.registry = a[q];
921
- let o = a[J];
937
+ this.registry = a[K];
938
+ let o = a[q];
922
939
  this.toolName = typeof o == "string" ? o : void 0;
923
940
  let s = {};
924
- for (let [e, t] of Object.entries(a)) Xe.includes(e) || (s[e] = t);
941
+ for (let [e, t] of Object.entries(a)) Qe.includes(e) || (s[e] = t);
925
942
  this.toolConfig = Object.freeze(s), this.api = t.api;
926
943
  let l = t.api;
927
944
  this.pointerDrag = () => {
928
945
  var e;
929
946
  return (l == null || (e = l.blocks) == null ? void 0 : e.isPointerDragActive) === !0;
930
- }, this.mirror = T(e.propSchema, (r = t.data) == null ? {} : r), this.lastRendered = this.mirror, this.readOnly = t.readOnly, this.origin = (i = t.origin) == null ? "api" : i;
947
+ }, this.mirror = w(e.propSchema, (r = t.data) == null ? {} : r), this.lastRendered = this.mirror, this.readOnly = t.readOnly, this.origin = (i = t.origin) == null ? "api" : i;
931
948
  let u = this.blockApi, f = this.api;
932
949
  this.childrenComponent = function({ childAttributes: e, childContentAttributes: t }) {
933
- let n = d(null), r = d(S());
950
+ let n = d(null), r = d(x());
934
951
  return c(() => {
935
952
  if (n.current === null) return;
936
953
  let i = u.getChildren();
937
- D(n.current, i), y(r.current, i, {
954
+ T(n.current, E(i, (e) => f.blocks.getChildren(e))), y(r.current, i, {
938
955
  childAttributes: e,
939
956
  childContentAttributes: t
940
- }), Ze(f, u.id, i);
941
- }), /* @__PURE__ */ k("div", {
957
+ }), $e(f, u.id, i);
958
+ }), /* @__PURE__ */ O("div", {
942
959
  ref: n,
943
960
  [g.nestedBlocks]: ""
944
961
  });
@@ -954,8 +971,8 @@ function et(e) {
954
971
  origin: this.origin,
955
972
  api: this.api
956
973
  };
957
- t == null || t(this.blockApi, e), Qe.has(this.origin) && (n == null || n(this.blockApi, e));
958
- }, a = (e) => (c(i, []), /* @__PURE__ */ k(r, U({}, e)));
974
+ t == null || t(this.blockApi, e), et.has(this.origin) && (n == null || n(this.blockApi, e));
975
+ }, a = (e) => (c(i, []), /* @__PURE__ */ O(r, H({}, e)));
959
976
  return a.displayName = `BlokBlockMount(${e.type})`, a;
960
977
  }
961
978
  render() {
@@ -976,9 +993,8 @@ function et(e) {
976
993
  return this.mirror;
977
994
  }
978
995
  async setData(t) {
979
- var n = this;
980
- let r = T(e.propSchema, t == null ? {} : t);
981
- return C(r, n.lastRendered) ? !0 : (n.mirror = r, n.lastRendered = r, n.pushProps({ data: r }), !0);
996
+ let n = w(e.propSchema, t == null ? {} : t);
997
+ return S(n, this.lastRendered) ? !0 : (this.mirror = n, this.lastRendered = n, this.pushProps({ data: n }), !0);
982
998
  }
983
999
  setReadOnly(e) {
984
1000
  this.readOnly = e, this.pushProps({ readOnly: e });
@@ -990,6 +1006,10 @@ function et(e) {
990
1006
  let r = this.hostEl;
991
1007
  if (r !== null && e.getToolbarAnchorElement !== void 0) return (t = e.getToolbarAnchorElement(r, this.blockApi)) == null ? void 0 : t;
992
1008
  }
1009
+ onNavigationEnter(t) {
1010
+ var n;
1011
+ return ((n = e.onNavigationEnter) == null ? void 0 : n.call(e, t, this.blockApi)) === !0;
1012
+ }
993
1013
  moved() {
994
1014
  var t;
995
1015
  (t = e.onMoved) == null || t.call(e, this.blockApi);
@@ -1016,7 +1036,7 @@ function et(e) {
1016
1036
  }
1017
1037
  pushProps(e) {
1018
1038
  let t = this.registry;
1019
- t !== void 0 && N(() => {
1039
+ t !== void 0 && M(() => {
1020
1040
  t.setProps(this.blockApi.id, e);
1021
1041
  });
1022
1042
  }
@@ -1037,7 +1057,7 @@ function et(e) {
1037
1057
  requestAnimationFrame(e);
1038
1058
  }
1039
1059
  }, t.__isBlokReactBlock = !0, t);
1040
- for (let [t, r] of Object.entries((n = e.statics) == null ? {} : n)) $e.includes(t) || Object.defineProperty(p, t, {
1060
+ for (let [t, r] of Object.entries((n = e.statics) == null ? {} : n)) tt.includes(t) || Object.defineProperty(p, t, {
1041
1061
  value: r,
1042
1062
  writable: !0,
1043
1063
  enumerable: !0,
@@ -1047,15 +1067,14 @@ function et(e) {
1047
1067
  }
1048
1068
  //#endregion
1049
1069
  //#region src/createReactInlineTool.tsx
1050
- var tt = [q, J], nt = (e) => `__blok-inline-tool__:${e}:${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, rt = n(null);
1051
- function it() {
1052
- let e = s(rt);
1070
+ var rt = [K, q], it = (e) => `__blok-inline-tool__:${e}:${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, at = n(null);
1071
+ function ot() {
1072
+ let e = s(at);
1053
1073
  if (e === null) throw Error("useInlineTool() must be called from a component rendered by createReactInlineTool");
1054
1074
  return e;
1055
1075
  }
1056
- function at(e) {
1057
- var t;
1058
- return t = class {
1076
+ function st(e) {
1077
+ var t = class {
1059
1078
  static get type() {
1060
1079
  return e.type;
1061
1080
  }
@@ -1073,7 +1092,7 @@ function at(e) {
1073
1092
  return e.mark;
1074
1093
  }
1075
1094
  static get sanitize() {
1076
- return e.sanitize === void 0 ? e.mark === void 0 ? void 0 : E(e.mark) : e.sanitize;
1095
+ return e.sanitize === void 0 ? e.mark === void 0 ? void 0 : re(e.mark) : e.sanitize;
1077
1096
  }
1078
1097
  static get isReadOnlySupported() {
1079
1098
  var t;
@@ -1083,11 +1102,11 @@ function at(e) {
1083
1102
  var n;
1084
1103
  this.active = !1, this.registered = !1;
1085
1104
  let r = (n = t == null ? void 0 : t.config) == null ? {} : n;
1086
- this.api = t == null ? void 0 : t.api, this.registry = r[q];
1087
- let i = r[J];
1088
- this.toolName = typeof i == "string" ? i : e.type, this.portalKey = nt(this.toolName);
1105
+ this.api = t == null ? void 0 : t.api, this.registry = r[K];
1106
+ let i = r[q];
1107
+ this.toolName = typeof i == "string" ? i : e.type, this.portalKey = it(this.toolName);
1089
1108
  let a = {};
1090
- for (let [e, t] of Object.entries(r)) tt.includes(e) || (a[e] = t);
1109
+ for (let [e, t] of Object.entries(r)) rt.includes(e) || (a[e] = t);
1091
1110
  this.toolConfig = Object.freeze(a), this.portalComponent = this.createPortalComponent();
1092
1111
  }
1093
1112
  render() {
@@ -1150,9 +1169,9 @@ function at(e) {
1150
1169
  api: t,
1151
1170
  mark: i
1152
1171
  }), [e.active, e.config]);
1153
- return /* @__PURE__ */ k(rt.Provider, {
1172
+ return /* @__PURE__ */ O(at.Provider, {
1154
1173
  value: n,
1155
- children: /* @__PURE__ */ k(r, {
1174
+ children: /* @__PURE__ */ O(r, {
1156
1175
  active: e.active,
1157
1176
  config: e.config
1158
1177
  })
@@ -1160,7 +1179,8 @@ function at(e) {
1160
1179
  };
1161
1180
  return a.displayName = `BlokInlineTool(${this.toolName})`, a;
1162
1181
  }
1163
- }, t.__isBlokReactInlineTool = !0, t.isInline = !0, t;
1182
+ };
1183
+ return t.__isBlokReactInlineTool = !0, t.isInline = !0, t;
1164
1184
  }
1165
1185
  //#endregion
1166
- export { q as BLOK_PORTAL_REGISTRY_CONFIG_KEY, J as BLOK_TOOL_NAME_CONFIG_KEY, Ce as BlockPortalHost, Ae as BlokContent, Pe as BlokEditor, G as BlokProvider, qe as BlokView, je as USE_BLOK_CONFIG_KEYS, se as createBlockPortalRegistry, et as createReactBlock, at as createReactInlineTool, A as getDirection, j as normalizeLocale, Le as useBlocks, be as useBlok, K as useBlokDefaults, Fe as useBlokHandle, Te as useBlokInstance, Re as useBlokReady, Ge as useBlokView, it as useInlineTool };
1186
+ export { K as BLOK_PORTAL_REGISTRY_CONFIG_KEY, q as BLOK_TOOL_NAME_CONFIG_KEY, we as BlockPortalHost, je as BlokContent, Fe as BlokEditor, W as BlokProvider, Ye as BlokView, Me as USE_BLOK_CONFIG_KEYS, le as createBlockPortalRegistry, nt as createReactBlock, st as createReactInlineTool, k as getDirection, A as normalizeLocale, Re as useBlocks, xe as useBlok, G as useBlokDefaults, Ie as useBlokHandle, Ee as useBlokInstance, ze as useBlokReady, qe as useBlokView, ot as useInlineTool };