@bloklabs/react 1.8.0 → 1.10.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, createBlocksApiForEditor as y, createEmittedEchoWindow as ee, deepEqual as b, deepEqual as x, equalsOutputData as te, fillDefaults as S, markSanitizerConfig as C, mountChildBlocks as w, normalizeReadOnlyConfig as ne, toRenderableData as re } from "@bloklabs/core/adapters";
4
- import { Fragment as T, jsx as E } from "react/jsx-runtime";
5
- import { getDirection as D, normalizeLocale as O } from "@bloklabs/core/locales";
6
- import { createPortal as k, flushSync as A } from "react-dom";
7
- import { blocksToViewNodes as j } from "@bloklabs/core/view";
8
- import { createRoot as M } 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 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";
9
9
  //#region src/holder-map.ts
10
- var N = /* @__PURE__ */ new WeakMap();
10
+ var I = /* @__PURE__ */ new WeakMap();
11
11
  function ie(e, t) {
12
- N.set(e, t);
12
+ I.set(e, t);
13
13
  }
14
- function P(e) {
15
- return N.get(e);
14
+ function L(e) {
15
+ return I.get(e);
16
16
  }
17
- function F(e) {
18
- N.delete(e);
17
+ function R(e) {
18
+ I.delete(e);
19
19
  }
20
20
  //#endregion
21
21
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
22
- function I(e) {
22
+ function z(e) {
23
23
  "@babel/helpers - typeof";
24
- return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
24
+ return z = 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
- }, I(e);
28
+ }, z(e);
29
29
  }
30
30
  //#endregion
31
31
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
32
- function L(e, t) {
33
- if (I(e) != "object" || !e) return e;
32
+ function B(e, t) {
33
+ if (z(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 (I(r) != "object") return r;
37
+ if (z(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
43
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
44
- function R(e) {
45
- var t = L(e, "string");
46
- return I(t) == "symbol" ? t : t + "";
44
+ function V(e) {
45
+ var t = B(e, "string");
46
+ return z(t) == "symbol" ? t : t + "";
47
47
  }
48
48
  //#endregion
49
49
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
50
- function z(e, t, n) {
51
- return (t = R(t)) in e ? Object.defineProperty(e, t, {
50
+ function H(e, t, n) {
51
+ return (t = V(t)) in e ? Object.defineProperty(e, t, {
52
52
  value: n,
53
53
  enumerable: !0,
54
54
  configurable: !0,
@@ -57,7 +57,7 @@ function z(e, t, n) {
57
57
  }
58
58
  //#endregion
59
59
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectSpread2.js
60
- function B(e, t) {
60
+ function U(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 B(e, t) {
67
67
  }
68
68
  return n;
69
69
  }
70
- function V(e) {
70
+ function W(e) {
71
71
  for (var t = 1; t < arguments.length; t++) {
72
72
  var n = arguments[t] == null ? {} : arguments[t];
73
- t % 2 ? B(Object(n), !0).forEach(function(t) {
74
- z(e, t, n[t]);
75
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : B(Object(n)).forEach(function(t) {
73
+ t % 2 ? U(Object(n), !0).forEach(function(t) {
74
+ H(e, t, n[t]);
75
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : U(Object(n)).forEach(function(t) {
76
76
  Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
77
77
  });
78
78
  }
@@ -80,35 +80,35 @@ function V(e) {
80
80
  }
81
81
  //#endregion
82
82
  //#region src/provide-blok.tsx
83
- var H = n({});
84
- function U({ defaults: e, children: t }) {
85
- return /* @__PURE__ */ E(H.Provider, {
83
+ var G = n({});
84
+ function ae({ defaults: e, children: t }) {
85
+ return /* @__PURE__ */ k(G.Provider, {
86
86
  value: e,
87
87
  children: t
88
88
  });
89
89
  }
90
- function W() {
91
- return s(H);
90
+ function oe() {
91
+ return s(G);
92
92
  }
93
- function ae(e, t) {
93
+ function se(e, t) {
94
94
  if (Object.keys(e).length === 0) return t;
95
- let n = V({}, e);
95
+ let n = W({}, 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 = V(V({}, e.tools), t.tools)), n;
100
+ return (e.tools !== void 0 || t.tools !== void 0) && (n.tools = W(W({}, e.tools), t.tools)), n;
101
101
  }
102
102
  //#endregion
103
103
  //#region src/block-portal-registry.ts
104
- var G = "__blokPortalRegistry", K = "__blokToolName", oe = () => {
104
+ var K = "__blokPortalRegistry", q = "__blokToolName", ce = () => {
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 : V(V({}, i), {}, { props: V(V({}, i.props), {}, { config: o }) })), r(a);
111
+ a.set(t, o === void 0 ? i : W(W({}, i), {}, { props: W(W({}, 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 G = "__blokPortalRegistry", K = "__blokToolName", oe = () => {
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, V(V({}, i), {}, { props: V(V({}, i.props), n) })), r(a);
123
+ a.set(t, W(W({}, i), {}, { props: W(W({}, 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, V(V({}, t), {}, { props: V(V({}, t.props), {}, { config: i }) }));
130
+ for (let [e, t] of a) o.set(e, W(W({}, t), {}, { props: W(W({}, t.props), {}, { config: i }) }));
131
131
  r(o);
132
132
  },
133
133
  subscribe(e) {
@@ -139,57 +139,57 @@ var G = "__blokPortalRegistry", K = "__blokToolName", oe = () => {
139
139
  return e.snapshot;
140
140
  }
141
141
  };
142
- }, q = /* @__PURE__ */ new WeakMap();
143
- function se(e, t) {
144
- q.set(e, t);
142
+ }, J = /* @__PURE__ */ new WeakMap();
143
+ function le(e, t) {
144
+ J.set(e, t);
145
145
  }
146
- function ce(e) {
147
- return q.get(e);
146
+ function ue(e) {
147
+ return J.get(e);
148
148
  }
149
- function J(e) {
150
- q.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 Y = /* @__PURE__ */ new WeakMap();
155
- function le(e, t) {
156
- Y.set(e, t);
154
+ var X = /* @__PURE__ */ new WeakMap();
155
+ function de(e, t) {
156
+ X.set(e, t);
157
157
  }
158
- function ue(e) {
159
- return Y.get(e);
158
+ function fe(e) {
159
+ return X.get(e);
160
160
  }
161
- function X(e) {
162
- Y.delete(e);
161
+ function Z(e) {
162
+ X.delete(e);
163
163
  }
164
164
  //#endregion
165
165
  //#region src/live-tool-config.ts
166
- var Z = (e) => {
166
+ 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
- }, de = (e, t) => t.reduce((e, t) => {
170
+ }, pe = (e, t) => t.reduce((e, t) => {
171
171
  if (Array.isArray(e)) return typeof t == "number" ? e[t] : void 0;
172
- if (Z(e)) return e[t];
173
- }, e), fe = (e, t) => {
172
+ if (Q(e)) return e[t];
173
+ }, e), me = (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)) {
177
177
  let r = Array.isArray(t) ? t : [];
178
178
  return e.map((e, t) => n(e, r[t]));
179
179
  }
180
- if (Z(e)) {
181
- let r = Z(t) ? t : {}, i = {};
180
+ if (Q(e)) {
181
+ let r = Q(t) ? t : {}, i = {};
182
182
  for (let [t, a] of Object.entries(e)) i[t] = n(a, r[t]);
183
183
  return i;
184
184
  }
185
185
  return e;
186
186
  }, r = n(t, e);
187
- return Z(r) ? r : {};
188
- }, pe = (e, t) => {
189
- if (!Z(e)) return e;
187
+ return Q(r) ? r : {};
188
+ }, he = (e, t) => {
189
+ if (!Q(e)) return e;
190
190
  let n = {};
191
191
  for (let [r, i] of Object.entries(e)) {
192
- if (!Z(i) || !Z(i.config)) {
192
+ if (!Q(i) || !Q(i.config)) {
193
193
  n[r] = i;
194
194
  continue;
195
195
  }
@@ -197,12 +197,12 @@ var Z = (e) => {
197
197
  if (typeof n == "function") {
198
198
  let e = n;
199
199
  return function(...n) {
200
- let a = t(), o = Z(a) ? a[r] : void 0, s = de(Z(o) ? o.config : void 0, i);
200
+ let a = t(), o = Q(a) ? a[r] : void 0, s = pe(Q(o) ? o.config : void 0, i);
201
201
  return Reflect.apply(typeof s == "function" ? s : e, this, n);
202
202
  };
203
203
  }
204
204
  if (Array.isArray(n)) return e.has(n) ? n : (e.add(n), n.map((e, t) => a(e, [...i, t])));
205
- if (Z(n)) {
205
+ if (Q(n)) {
206
206
  if (e.has(n)) return n;
207
207
  e.add(n);
208
208
  let t = {};
@@ -211,37 +211,37 @@ var Z = (e) => {
211
211
  }
212
212
  return n;
213
213
  };
214
- n[r] = V(V({}, i), {}, { config: a(i.config, []) });
214
+ n[r] = W(W({}, i), {}, { config: a(i.config, []) });
215
215
  }
216
216
  return n;
217
- }, me = (e) => {
217
+ }, ge = (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
- }, he = (e) => {
220
+ }, _e = (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
- }, ge = (e, t) => {
223
+ }, ve = (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 (!me(a) && !he(a)) {
228
+ if (!ge(a) && !_e(a)) {
229
229
  n[i] = a;
230
230
  continue;
231
231
  }
232
- let e = typeof a == "function" ? { class: a } : V({}, a);
233
- e.config = V(V({}, (r = e.config) == null ? {} : r), {}, {
234
- [G]: t,
235
- [K]: i
232
+ let e = typeof a == "function" ? { class: a } : W({}, a);
233
+ e.config = W(W({}, (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 _e(e, t) {
242
+ function ye(e, t) {
243
243
  var n, r;
244
- let i = ae(s(H), e), [a, o] = f(null), l = d(i);
244
+ let i = se(s(G), 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 _e(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(Promise.resolve()), S = d(void 0), C = d(null), w = d(void 0), T = d(/* @__PURE__ */ new Map()), E = d(/* @__PURE__ */ new Map()), D = d(null), O = d({
253
+ }), h = u(() => ({}), t == null ? [] : t), g = d(i.data), _ = d(ee()), v = d(null), y = d(i.data), b = d(Promise.resolve()), x = d(void 0), S = d(null), C = 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 _e(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
- ve(t, o);
266
+ be(t, o);
267
267
  };
268
268
  if (t.editor !== null && !t.isDestroyed) {
269
- F(t.editor), J(t.editor), X(t.editor);
269
+ R(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 _e(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 = oe(), a = r.tools === void 0 ? void 0 : pe(r.tools, () => l.current.tools), s = a === void 0 ? void 0 : ge(a, i);
278
- C.current = i, w.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]));
277
+ let r = l.current, i = ce(), a = r.tools === void 0 ? void 0 : he(r.tools, () => l.current.tools), s = a === void 0 ? void 0 : ve(a, i);
278
+ S.current = i, C.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;
@@ -312,39 +312,39 @@ function _e(e, t) {
312
312
  onAfterRender: r.onAfterRender !== void 0
313
313
  };
314
314
  O.current = u;
315
- let d = new m(V(V(V(V(V(V(V(V({}, r), s === void 0 ? {} : { tools: s }), {}, {
315
+ let d = new m(W(W(W(W(W(W(W(W({}, 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 } : {}));
322
- return t.editor = d, y.current = r.data, ie(d, n), se(d, i), le(d, { markRendered: (e) => {
323
- _.current.clear(), g.current = e, S.current = void 0;
322
+ return t.editor = d, y.current = r.data, ie(d, n), le(d, i), de(d, { markRendered: (e) => {
323
+ _.current.clear(), g.current = e, x.current = void 0;
324
324
  } }), d.isReady.then(() => {
325
325
  t.editor === d && !t.isDestroyed && (t.isEditorReady = !0, o(d));
326
326
  }).catch(() => {
327
327
  if (t.editor === d && !t.isDestroyed) {
328
- F(d), J(d), X(d);
328
+ R(d), Y(d), Z(d);
329
329
  try {
330
330
  d.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
- ve(t, o);
335
+ be(t, o);
336
336
  };
337
337
  }, [h]), c(() => {
338
- let e = C.current, t = p.current;
338
+ let e = S.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 = w.current;
342
+ let r = C.current;
343
343
  for (let [t, a] of Object.entries(n)) {
344
344
  var i;
345
- if (!me(a)) continue;
346
- let n = typeof a == "function" || (i = a.config) == null ? {} : i, o = r == null ? void 0 : r[t], s = fe(typeof o == "object" && o ? o.config : void 0, n), c = T.current.get(t);
347
- if (c !== void 0 && x(s, c)) continue;
345
+ if (!ge(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 = T.current.get(t);
347
+ if (c !== void 0 && w(s, c)) continue;
348
348
  let l = Object.freeze(s);
349
349
  T.current.set(t, l), e.setToolConfig(t, l);
350
350
  }
@@ -356,7 +356,7 @@ function _e(e, t) {
356
356
  var n;
357
357
  if (!E.current.has(r)) continue;
358
358
  let t = typeof i == "object" && i ? i.toolbox : void 0;
359
- x(t, E.current.get(r)) || (E.current.set(r, t), (n = e.editor.tools) == null || n.update(r, { toolbox: t }));
359
+ w(t, E.current.get(r)) || (E.current.set(r, t), (n = e.editor.tools) == null || n.update(r, { toolbox: t }));
360
360
  }
361
361
  }), c(() => {
362
362
  let e = p.current, t = D.current;
@@ -400,50 +400,50 @@ function _e(e, t) {
400
400
  c(() => {
401
401
  a === null || !P || a.focus();
402
402
  }, [a, P]);
403
- let { theme: I } = i;
403
+ let { theme: F } = i;
404
+ c(() => {
405
+ a === null || F === void 0 || a.theme.set(F);
406
+ }, [a, F]);
407
+ let { width: I } = i;
404
408
  c(() => {
405
- a === null || I === void 0 || a.theme.set(I);
409
+ a === null || I === void 0 || a.width.set(I);
406
410
  }, [a, I]);
407
- let { width: L } = i;
411
+ let L = (n = i.style) == null ? void 0 : n.tokens, z = d((r = i.style) == null ? void 0 : r.tokens);
408
412
  c(() => {
409
- a === null || L === void 0 || a.width.set(L);
413
+ a === null || L === void 0 || w(L, z.current) || (z.current = L, a.tokens.set(L));
410
414
  }, [a, L]);
411
- let R = (n = i.style) == null ? void 0 : n.tokens, z = d((r = i.style) == null ? void 0 : r.tokens);
415
+ let { i18n: B } = i, V = d(i.i18n);
412
416
  c(() => {
413
- a === null || R === void 0 || x(R, z.current) || (z.current = R, a.tokens.set(R));
414
- }, [a, R]);
415
- let { i18n: B } = i, U = d(i.i18n);
416
- c(() => {
417
- if (a === null || B === void 0 || x(B, U.current)) return;
418
- U.current = B;
417
+ if (a === null || B === void 0 || w(B, V.current)) return;
418
+ V.current = B;
419
419
  let { locale: e, messages: t, direction: n } = B;
420
- a.i18n.update(V(V(V({}, e === void 0 ? {} : { locale: e }), t === void 0 ? {} : { messages: t }), n === void 0 ? {} : { direction: n }));
420
+ a.i18n.update(W(W(W({}, e === void 0 ? {} : { locale: e }), t === void 0 ? {} : { messages: t }), n === void 0 ? {} : { direction: n }));
421
421
  }, [a, B]);
422
- let { placeholder: W } = i;
422
+ let { placeholder: H } = i;
423
423
  c(() => {
424
- a === null || W === void 0 || a.placeholder.set(W);
425
- }, [a, W]);
426
- let { data: G } = i;
424
+ a === null || H === void 0 || a.placeholder.set(H);
425
+ }, [a, H]);
426
+ let { data: U } = i;
427
427
  return c(() => {
428
- if (a === null || G === void 0) return;
428
+ if (a === null || U === void 0) return;
429
429
  let e = p.current;
430
430
  if (e.editor !== a || e.isDestroyed) return;
431
- if (v.current !== a && (v.current = a, S.current = void 0, _.current.clear(), x(G, y.current))) {
432
- g.current = G;
431
+ if (v.current !== a && (v.current = a, x.current = void 0, _.current.clear(), w(U, y.current))) {
432
+ g.current = U;
433
433
  return;
434
434
  }
435
- let t = g.current, n = S.current;
436
- t !== void 0 && te(G, t) || n !== void 0 && te(G, n) || _.current.matches(G) || (_.current.clear(), S.current = G, b.current = b.current.catch(() => void 0).then(() => a.render(re(G))).then(() => {
437
- g.current = G;
435
+ let t = g.current, n = x.current;
436
+ t !== void 0 && te(U, t) || n !== void 0 && te(U, n) || _.current.matches(U) || (_.current.clear(), x.current = U, b.current = b.current.catch(() => void 0).then(() => a.render(re(U))).then(() => {
437
+ g.current = U;
438
438
  }, () => {}).then(() => {
439
- S.current === G && (S.current = void 0);
439
+ x.current === U && (x.current = void 0);
440
440
  }));
441
- }, [a, G]), a;
441
+ }, [a, U]), a;
442
442
  }
443
- function ve(e, t) {
443
+ function be(e, t) {
444
444
  e.destroyTimeout = setTimeout(() => {
445
445
  if (e.editor !== null) {
446
- F(e.editor), J(e.editor), X(e.editor);
446
+ R(e.editor), Y(e.editor), Z(e.editor);
447
447
  try {
448
448
  e.editor.destroy();
449
449
  } catch (e) {}
@@ -453,7 +453,7 @@ function ve(e, t) {
453
453
  }
454
454
  //#endregion
455
455
  //#region src/BlockPortalHost.tsx
456
- var ye = class extends e {
456
+ var xe = class extends e {
457
457
  constructor(...e) {
458
458
  super(...e), this.state = { failed: !1 };
459
459
  }
@@ -465,22 +465,22 @@ var ye = class extends e {
465
465
  return this.state.failed ? null : this.props.children;
466
466
  }
467
467
  };
468
- function be({ registry: e }) {
468
+ function Se({ registry: e }) {
469
469
  let t = p(e.subscribe, e.getSnapshot, e.getSnapshot);
470
- return /* @__PURE__ */ E(T, { children: Array.from(t.entries()).map(([e, t]) => {
470
+ return /* @__PURE__ */ k(O, { children: Array.from(t.entries()).map(([e, t]) => {
471
471
  let n = t.component;
472
- return k(/* @__PURE__ */ E(ye, { children: /* @__PURE__ */ E(n, V({}, t.props)) }), t.hostEl, e);
472
+ return M(/* @__PURE__ */ k(xe, { children: /* @__PURE__ */ k(n, W({}, t.props)) }), t.hostEl, e);
473
473
  }) });
474
474
  }
475
475
  //#endregion
476
476
  //#region src/blok-instance-context.ts
477
- var xe = n(null);
478
- function Se() {
479
- return s(xe);
477
+ var Ce = n(null);
478
+ function we() {
479
+ return s(Ce);
480
480
  }
481
481
  //#endregion
482
482
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectWithoutPropertiesLoose.js
483
- function Ce(e, t) {
483
+ function Te(e, t) {
484
484
  if (e == null) return {};
485
485
  var n = {};
486
486
  for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
@@ -491,9 +491,9 @@ function Ce(e, t) {
491
491
  }
492
492
  //#endregion
493
493
  //#region \0@oxc-project+runtime@0.139.0/helpers/esm/objectWithoutProperties.js
494
- function Q(e, t) {
494
+ function $(e, t) {
495
495
  if (e == null) return {};
496
- var n, r, i = Ce(e, t);
496
+ var n, r, i = Te(e, t);
497
497
  if (Object.getOwnPropertySymbols) {
498
498
  var a = Object.getOwnPropertySymbols(e);
499
499
  for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
@@ -502,22 +502,22 @@ function Q(e, t) {
502
502
  }
503
503
  //#endregion
504
504
  //#region src/BlokContent.tsx
505
- var we = ["editor"];
506
- function Te(e) {
505
+ var Ee = ["editor"];
506
+ function De(e) {
507
507
  var t, n;
508
508
  if (typeof window > "u") return;
509
509
  let r = window.location.hash.slice(1);
510
- r !== "" && ((t = (n = e.blocks).scrollToBlock) == null || t.call(n, Ee(r)));
510
+ r !== "" && ((t = (n = e.blocks).scrollToBlock) == null || t.call(n, Oe(r)));
511
511
  }
512
- function Ee(e) {
512
+ function Oe(e) {
513
513
  try {
514
514
  return decodeURIComponent(e);
515
515
  } catch (t) {
516
516
  return e;
517
517
  }
518
518
  }
519
- var De = i(function(e, t) {
520
- let { editor: n } = e, r = Q(e, we), i = d(null), a = (e) => {
519
+ var ke = i(function(e, t) {
520
+ let { editor: n } = e, r = $(e, Ee), i = d(null), a = (e) => {
521
521
  if (i.current = e, typeof t == "function") t(e);
522
522
  else if (t != null) {
523
523
  let n = t;
@@ -526,33 +526,33 @@ var De = i(function(e, t) {
526
526
  };
527
527
  c(() => {
528
528
  if (n === null || i.current === null) return;
529
- let e = P(n);
530
- if (e !== void 0) return i.current.appendChild(e), Te(n), () => {
529
+ let e = L(n);
530
+ if (e !== void 0) return i.current.appendChild(e), De(n), () => {
531
531
  e.remove();
532
532
  };
533
533
  }, [n]);
534
- let o = n === null ? void 0 : ce(n);
535
- return /* @__PURE__ */ E("div", V(V({ ref: a }, r), {}, { children: o === void 0 ? null : /* @__PURE__ */ E(xe.Provider, {
534
+ let o = n === null ? void 0 : ue(n);
535
+ return /* @__PURE__ */ k("div", W(W({ ref: a }, r), {}, { children: o === void 0 ? null : /* @__PURE__ */ k(Ce.Provider, {
536
536
  value: n,
537
- children: /* @__PURE__ */ E(be, { registry: o })
537
+ children: /* @__PURE__ */ k(Se, { registry: o })
538
538
  }) }));
539
- }), Oe = /* @__PURE__ */ "autofocus.defaultBlock.dataModel.placeholder.sanitizer.hideToolbar.maxHistoryLength.historyDebounceTime.newGroupDelay.globalUndoRedo.tools.data.minHeight.logLevel.readOnly.i18n.link.linkPaste.onBeforePaste.onReady.onChange.onSave.onError.onEnter.onSubmit.onBeforeRender.onAfterRender.inlineToolbar.tunes.style.theme.onThemeChange.scrollToBlock.user.resolveUser.notifierPosition.notifier.width.migrations.uploader.captureClicksBelowEditor".split("."), ke = [
539
+ }), Ae = /* @__PURE__ */ "autofocus.defaultBlock.dataModel.placeholder.sanitizer.hideToolbar.maxHistoryLength.historyDebounceTime.newGroupDelay.globalUndoRedo.tools.data.minHeight.logLevel.readOnly.i18n.link.linkPaste.onBeforePaste.onReady.onChange.onSave.onError.onEnter.onSubmit.onBeforeRender.onAfterRender.inlineToolbar.tunes.style.theme.onThemeChange.scrollToBlock.user.resolveUser.notifierPosition.notifier.width.migrations.uploader.captureClicksBelowEditor".split("."), je = [
540
540
  "deps",
541
541
  "onReady",
542
542
  "locale",
543
543
  "onBlocksRendered",
544
544
  "onBlockRendered"
545
- ], Ae = new Set(Oe), je = i(function(e, t) {
546
- let { deps: n, onReady: r, locale: i, onBlocksRendered: a, onBlockRendered: o } = e, s = Q(e, ke), u = {}, f = {};
545
+ ], Me = new Set(Ae), Ne = i(function(e, t) {
546
+ let { deps: n, onReady: r, locale: i, onBlocksRendered: a, onBlockRendered: o } = e, s = $(e, je), u = {}, f = {};
547
547
  for (let e of Object.keys(s)) {
548
548
  let t = s[e];
549
- Ae.has(e) ? u[e] = t : f[e] = t;
549
+ Me.has(e) ? u[e] = t : f[e] = t;
550
550
  }
551
551
  if (i !== void 0) {
552
552
  let e = u.i18n;
553
- u.i18n = V(V({}, e), {}, { locale: i });
553
+ u.i18n = W(W({}, e), {}, { locale: i });
554
554
  }
555
- let p = _e(u, n);
555
+ let p = ye(u, n);
556
556
  l(t, () => p, [p]);
557
557
  let m = d(r);
558
558
  m.current = r;
@@ -592,11 +592,11 @@ var De = i(function(e, t) {
592
592
  p,
593
593
  v,
594
594
  y
595
- ]), /* @__PURE__ */ E(De, V({ editor: p }, f));
595
+ ]), /* @__PURE__ */ k(ke, W({ editor: p }, f));
596
596
  });
597
597
  //#endregion
598
598
  //#region src/useBlokHandle.ts
599
- function Me() {
599
+ function Pe() {
600
600
  let e = d(null);
601
601
  return u(() => ({
602
602
  ref: (t) => {
@@ -616,7 +616,7 @@ function Me() {
616
616
  let t = e.current;
617
617
  return t === null ? Promise.resolve() : t.clear().then(() => {
618
618
  var e;
619
- (e = ue(t)) == null || e.markRendered(v);
619
+ (e = fe(t)) == null || e.markRendered(v);
620
620
  });
621
621
  },
622
622
  save: () => e.current === null ? Promise.resolve(null) : e.current.save(),
@@ -624,7 +624,7 @@ function Me() {
624
624
  let n = e.current;
625
625
  return n === null ? Promise.resolve() : n.render(t).then(() => {
626
626
  var e;
627
- (e = ue(n)) == null || e.markRendered(t);
627
+ (e = fe(n)) == null || e.markRendered(t);
628
628
  });
629
629
  },
630
630
  setReadOnly: (t) => {
@@ -635,22 +635,23 @@ function Me() {
635
635
  }
636
636
  //#endregion
637
637
  //#region src/useBlocks.ts
638
- var Ne = "block changed";
639
- function Pe(e) {
640
- let t = d(0), n = d(e);
641
- n.current !== e && (n.current = e, t.current = 0);
642
- let r = o((n) => {
638
+ var Fe = "block changed";
639
+ function Ie(e, t = {}) {
640
+ var n;
641
+ let r = (n = t.within) == null ? null : n, i = d(0), a = d(e);
642
+ a.current !== e && (a.current = e, i.current = 0);
643
+ let s = o((t) => {
643
644
  if (e === null) return () => void 0;
644
- let r = () => {
645
- t.current += 1, n();
645
+ let n = (n) => {
646
+ r !== null && !b(e, n, r) || (i.current += 1, t());
646
647
  };
647
- return e.on(Ne, r), () => e.off(Ne, r);
648
- }, [e]), i = o(() => t.current, []);
649
- return p(r, i, i), u(() => e === null ? _ : y(e), [e]);
648
+ return e.on(Fe, n), () => e.off(Fe, n);
649
+ }, [e, r]), c = o(() => i.current, []);
650
+ return p(s, c, c), u(() => e === null ? _ : x(e), [e]);
650
651
  }
651
652
  //#endregion
652
653
  //#region src/useBlokReady.ts
653
- function Fe(e = {}) {
654
+ function Le(e = {}) {
654
655
  let { within: t, settleOn: n } = e, [r, i] = f(!1);
655
656
  return c(() => {
656
657
  let e = () => {
@@ -666,7 +667,7 @@ function Fe(e = {}) {
666
667
  }
667
668
  //#endregion
668
669
  //#region src/view-nodes-to-react.ts
669
- var Ie = /* @__PURE__ */ new Set([
670
+ var Re = /* @__PURE__ */ new Set([
670
671
  "area",
671
672
  "base",
672
673
  "br",
@@ -681,7 +682,7 @@ var Ie = /* @__PURE__ */ new Set([
681
682
  "source",
682
683
  "track",
683
684
  "wbr"
684
- ]), Le = /* @__PURE__ */ new Set([
685
+ ]), ze = /* @__PURE__ */ new Set([
685
686
  "disabled",
686
687
  "open",
687
688
  "controls",
@@ -697,7 +698,7 @@ var Ie = /* @__PURE__ */ new Set([
697
698
  "novalidate",
698
699
  "allowfullscreen",
699
700
  "itemscope"
700
- ]), $ = {
701
+ ]), Be = {
701
702
  class: "className",
702
703
  for: "htmlFor",
703
704
  colspan: "colSpan",
@@ -719,7 +720,7 @@ var Ie = /* @__PURE__ */ new Set([
719
720
  minlength: "minLength",
720
721
  usemap: "useMap",
721
722
  itemscope: "itemScope"
722
- }, Re = (e) => {
723
+ }, Ve = (e) => {
723
724
  let t = {};
724
725
  for (let n of e.split(";")) {
725
726
  let e = n.indexOf(":");
@@ -730,12 +731,12 @@ var Ie = /* @__PURE__ */ new Set([
730
731
  t[a] = i;
731
732
  }
732
733
  return t;
733
- }, ze = (e, t) => {
734
+ }, He = (e, t) => {
734
735
  let n = { key: t };
735
736
  for (let [t, a] of Object.entries(e)) {
736
737
  var r;
737
738
  if (t === "style") {
738
- n.style = Re(a);
739
+ n.style = Ve(a);
739
740
  continue;
740
741
  }
741
742
  if (t === "checked") {
@@ -746,28 +747,29 @@ var Ie = /* @__PURE__ */ new Set([
746
747
  n.defaultValue = a;
747
748
  continue;
748
749
  }
749
- if (Le.has(t)) {
750
+ if (ze.has(t)) {
750
751
  var i;
751
- n[(i = $[t]) == null ? t : i] = !0;
752
+ n[(i = Be[t]) == null ? t : i] = !0;
752
753
  continue;
753
754
  }
754
- n[(r = $[t]) == null ? t : r] = a;
755
+ n[(r = Be[t]) == null ? t : r] = a;
755
756
  }
756
757
  return n;
757
- }, Be = (e) => e.map((e, t) => {
758
+ }, Ue = (e) => e.map((e, t) => {
758
759
  if ("text" in e) return e.text;
759
- let n = ze(e.attrs, t);
760
- return Ie.has(e.tag) || e.children.length === 0 ? r(e.tag, n) : r(e.tag, n, ...Be(e.children));
761
- }), Ve = (e, n) => {
762
- 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.classes;
763
- return u(() => r(t, null, ...Be(j(e, {
760
+ let n = He(e.attrs, t);
761
+ return Re.has(e.tag) || e.children.length === 0 ? r(e.tag, n) : r(e.tag, n, ...Ue(e.children));
762
+ }), We = (e, n) => {
763
+ 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;
764
+ return u(() => r(t, null, ...Ue(P(e, {
764
765
  schema: i,
765
766
  renderers: a,
766
767
  onUnknownBlock: o,
767
768
  toolAttributes: s,
768
769
  blockIds: c,
769
770
  transformUrl: l,
770
- classes: d
771
+ inlineRenderers: d,
772
+ classes: f
771
773
  }))), [
772
774
  e,
773
775
  i,
@@ -776,9 +778,10 @@ var Ie = /* @__PURE__ */ new Set([
776
778
  s,
777
779
  c,
778
780
  l,
779
- d
781
+ d,
782
+ f
780
783
  ]);
781
- }, He = [
784
+ }, Ge = [
782
785
  "data",
783
786
  "schema",
784
787
  "renderers",
@@ -786,69 +789,49 @@ var Ie = /* @__PURE__ */ new Set([
786
789
  "toolAttributes",
787
790
  "blockIds",
788
791
  "transformUrl",
792
+ "inlineRenderers",
789
793
  "classes"
790
- ], Ue = (e) => {
791
- let { data: t, schema: n, renderers: r, onUnknownBlock: i, toolAttributes: a, blockIds: o, transformUrl: s, classes: c } = e, l = Q(e, He), u = Ve(t, {
794
+ ], Ke = (e) => {
795
+ let { data: t, schema: n, renderers: r, onUnknownBlock: i, toolAttributes: a, blockIds: o, transformUrl: s, inlineRenderers: c, classes: l } = e, u = $(e, Ge), d = We(t, {
792
796
  schema: n,
793
797
  renderers: r,
794
798
  onUnknownBlock: i,
795
799
  toolAttributes: a,
796
800
  blockIds: o,
797
801
  transformUrl: s,
798
- classes: c == null || c
802
+ inlineRenderers: c,
803
+ classes: l == null || l
799
804
  });
800
- return /* @__PURE__ */ E("div", V(V({ "data-blok-interface": "view" }, l), {}, { children: u }));
801
- }, We = ["icon", "title"], Ge = ["commit", "readOnly"], Ke = [G, K], qe = (e, t, n) => {
802
- let r = /* @__PURE__ */ new Map();
803
- t.forEach((e, t) => {
804
- var i;
805
- let a = [];
806
- for (let [r, o] of Object.entries((i = n == null ? void 0 : n(e, t)) == null ? {} : i)) {
807
- if (o == null) {
808
- e.holder.removeAttribute(r);
809
- continue;
810
- }
811
- e.holder.setAttribute(r, String(o)), a.push(r);
812
- }
813
- r.set(e.id, {
814
- holder: e.holder,
815
- names: a
816
- });
817
- });
818
- for (let [t, n] of e) {
819
- let e = r.get(t);
820
- n.names.filter((t) => e === void 0 || !e.names.includes(t)).forEach((e) => n.holder.removeAttribute(e));
821
- }
822
- e.clear(), r.forEach((t, n) => e.set(n, t));
823
- }, Je = (e, t, n) => {
805
+ return /* @__PURE__ */ k("div", W(W({ "data-blok-interface": "view" }, u), {}, { children: d }));
806
+ }, qe = ["icon", "title"], Je = ["commit", "readOnly"], Ye = [K, q], Xe = (e, t, n) => {
824
807
  var r;
825
808
  e == null || (r = e.events) == null || r.emit(h, {
826
809
  blockId: t,
827
810
  childIds: n.map((e) => e.id)
828
811
  });
829
- }, Ye = /* @__PURE__ */ new Set([
812
+ }, Ze = /* @__PURE__ */ new Set([
830
813
  void 0,
831
814
  "user",
832
815
  "api",
833
816
  "convert"
834
- ]), Xe = [
817
+ ]), Qe = [
835
818
  "toolbox",
836
819
  "isReadOnlySupported",
837
820
  "__isBlokReactBlock",
838
821
  "__buildPortalToolbox"
839
822
  ];
840
- function Ze(e) {
823
+ function $e(e) {
841
824
  var t, n;
842
825
  let r = (e) => {
843
826
  if (typeof document > "u") return null;
844
- let t = document.createElement("div"), n = M(t);
845
- A(() => {
827
+ let t = document.createElement("div"), n = F(t);
828
+ N(() => {
846
829
  n.render(e);
847
830
  });
848
831
  let r = t.innerHTML;
849
832
  return n.unmount(), r === "" ? null : r;
850
833
  }, i = (e) => {
851
- let { icon: t, title: n } = e, i = V({}, Q(e, We));
834
+ let { icon: t, title: n } = e, i = W({}, $(e, qe));
852
835
  if (typeof n == "string" && (i.title = n), !a(t)) return t !== void 0 && (i.icon = t), {
853
836
  entry: i,
854
837
  deferred: !1
@@ -880,13 +863,13 @@ function Ze(e) {
880
863
  if (s && delete o.icon, !a(e.title)) return o;
881
864
  let c = document.createElement("span");
882
865
  c.setAttribute("data-blok-mutation-free", "true");
883
- let l = e.title, u = () => /* @__PURE__ */ E(T, { children: l });
866
+ let l = e.title, u = () => /* @__PURE__ */ k(O, { children: l });
884
867
  return u.displayName = `BlokToolboxTitle(${n})`, t.register(`__blok-toolbox-title__:${n}:${r}`, {
885
868
  hostEl: c,
886
869
  component: u,
887
870
  props: {},
888
871
  toolName: n
889
- }), V(V({}, o), {}, { titleEl: c });
872
+ }), W(W({}, o), {}, { titleEl: c });
890
873
  });
891
874
  return Array.isArray(e.toolbox) ? o : o[0];
892
875
  }, l = {
@@ -900,10 +883,10 @@ function Ze(e) {
900
883
  let n = e.viewComponent;
901
884
  if (t.readOnly && n !== void 0) {
902
885
  let { commit: e, readOnly: r } = t;
903
- return /* @__PURE__ */ E(n, V({}, Q(t, Ge)));
886
+ return /* @__PURE__ */ k(n, W({}, $(t, Je)));
904
887
  }
905
888
  let r = e.component;
906
- return /* @__PURE__ */ E(r, V({}, t));
889
+ return /* @__PURE__ */ k(r, W({}, t));
907
890
  }, p = (t = class {
908
891
  static get toolbox() {
909
892
  return u();
@@ -916,32 +899,37 @@ function Ze(e) {
916
899
  }
917
900
  constructor(t) {
918
901
  var n, r, i;
919
- this.mountSignalled = !1, this.hostEl = null, this.pendingDispatch = !1, this.commit = (t) => {
902
+ this.mountSignalled = !1, this.hostEl = null, this.pendingDispatch = !1, this.anchorEl = null, this.toolbarAnchorRef = (e) => {
903
+ this.anchorEl = e;
904
+ }, this.commit = (t) => {
920
905
  var n;
921
- let r = S(e.propSchema, V(V({}, this.mirror), t));
922
- b(r, this.mirror) || (this.mirror = r, this.lastRendered = r, (n = this.registry) == null || n.setProps(this.blockApi.id, { data: r }), this.flushDispatch());
906
+ let r = T(e.propSchema, W(W({}, this.mirror), t));
907
+ C(r, this.mirror) || (this.mirror = r, this.lastRendered = r, (n = this.registry) == null || n.setProps(this.blockApi.id, { data: r }), this.flushDispatch());
923
908
  }, this.blockApi = t.block;
924
909
  let a = (n = t.config) == null ? {} : n;
925
- this.registry = a[G];
926
- let o = a[K];
910
+ this.registry = a[K];
911
+ let o = a[q];
927
912
  this.toolName = typeof o == "string" ? o : void 0;
928
913
  let s = {};
929
- for (let [e, t] of Object.entries(a)) Ke.includes(e) || (s[e] = t);
914
+ for (let [e, t] of Object.entries(a)) Ye.includes(e) || (s[e] = t);
930
915
  this.toolConfig = Object.freeze(s), this.api = t.api;
931
916
  let l = t.api;
932
917
  this.pointerDrag = () => {
933
918
  var e;
934
919
  return (l == null || (e = l.blocks) == null ? void 0 : e.isPointerDragActive) === !0;
935
- }, this.mirror = S(e.propSchema, (r = t.data) == null ? {} : r), this.lastRendered = this.mirror, this.readOnly = t.readOnly, this.origin = (i = t.origin) == null ? "api" : i;
920
+ }, 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;
936
921
  let u = this.blockApi, f = this.api;
937
- this.childrenComponent = function({ childAttributes: e }) {
938
- let t = d(null), n = d(/* @__PURE__ */ new Map());
922
+ this.childrenComponent = function({ childAttributes: e, childContentAttributes: t }) {
923
+ let n = d(null), r = d(S());
939
924
  return c(() => {
940
- if (t.current === null) return;
941
- let r = u.getChildren();
942
- w(t.current, r), qe(n.current, r, e), Je(f, u.id, r);
943
- }), /* @__PURE__ */ E("div", {
944
- ref: t,
925
+ if (n.current === null) return;
926
+ let i = u.getChildren();
927
+ D(n.current, i), y(r.current, i, {
928
+ childAttributes: e,
929
+ childContentAttributes: t
930
+ }), Xe(f, u.id, i);
931
+ }), /* @__PURE__ */ k("div", {
932
+ ref: n,
945
933
  [g.nestedBlocks]: ""
946
934
  });
947
935
  }, this.entryComponent = this.buildEntryComponent();
@@ -956,8 +944,8 @@ function Ze(e) {
956
944
  origin: this.origin,
957
945
  api: this.api
958
946
  };
959
- t == null || t(this.blockApi, e), Ye.has(this.origin) && (n == null || n(this.blockApi, e));
960
- }, a = (e) => (c(i, []), /* @__PURE__ */ E(r, V({}, e)));
947
+ t == null || t(this.blockApi, e), Ze.has(this.origin) && (n == null || n(this.blockApi, e));
948
+ }, a = (e) => (c(i, []), /* @__PURE__ */ k(r, W({}, e)));
961
949
  return a.displayName = `BlokBlockMount(${e.type})`, a;
962
950
  }
963
951
  render() {
@@ -979,16 +967,18 @@ function Ze(e) {
979
967
  }
980
968
  async setData(t) {
981
969
  var n = this;
982
- let r = S(e.propSchema, t == null ? {} : t);
983
- return b(r, n.lastRendered) ? !0 : (n.mirror = r, n.lastRendered = r, n.pushProps({ data: r }), !0);
970
+ let r = T(e.propSchema, t == null ? {} : t);
971
+ return C(r, n.lastRendered) ? !0 : (n.mirror = r, n.lastRendered = r, n.pushProps({ data: r }), !0);
984
972
  }
985
973
  setReadOnly(e) {
986
974
  this.readOnly = e, this.pushProps({ readOnly: e });
987
975
  }
988
976
  getToolbarAnchorElement() {
989
977
  var t;
990
- let n = this.hostEl;
991
- if (!(n === null || e.getToolbarAnchorElement === void 0)) return (t = e.getToolbarAnchorElement(n, this.blockApi)) == null ? void 0 : t;
978
+ let n = this.anchorEl;
979
+ if (n !== null && n.isConnected) return n;
980
+ let r = this.hostEl;
981
+ if (!(r === null || e.getToolbarAnchorElement === void 0)) return (t = e.getToolbarAnchorElement(r, this.blockApi)) == null ? void 0 : t;
992
982
  }
993
983
  moved() {
994
984
  var t;
@@ -1010,12 +1000,13 @@ function Ze(e) {
1010
1000
  api: this.api,
1011
1001
  readOnly: this.readOnly,
1012
1002
  config: this.toolConfig,
1013
- BlockChildren: this.childrenComponent
1003
+ BlockChildren: this.childrenComponent,
1004
+ toolbarAnchorRef: this.toolbarAnchorRef
1014
1005
  };
1015
1006
  }
1016
1007
  pushProps(e) {
1017
1008
  let t = this.registry;
1018
- t !== void 0 && A(() => {
1009
+ t !== void 0 && N(() => {
1019
1010
  t.setProps(this.blockApi.id, e);
1020
1011
  });
1021
1012
  }
@@ -1036,7 +1027,7 @@ function Ze(e) {
1036
1027
  requestAnimationFrame(e);
1037
1028
  }
1038
1029
  }, t.__isBlokReactBlock = !0, t);
1039
- for (let [t, r] of Object.entries((n = e.statics) == null ? {} : n)) Xe.includes(t) || Object.defineProperty(p, t, {
1030
+ for (let [t, r] of Object.entries((n = e.statics) == null ? {} : n)) Qe.includes(t) || Object.defineProperty(p, t, {
1040
1031
  value: r,
1041
1032
  writable: !0,
1042
1033
  enumerable: !0,
@@ -1046,13 +1037,13 @@ function Ze(e) {
1046
1037
  }
1047
1038
  //#endregion
1048
1039
  //#region src/createReactInlineTool.tsx
1049
- var Qe = [G, K], $e = (e) => `__blok-inline-tool__:${e}:${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, et = n(null);
1050
- function tt() {
1051
- let e = s(et);
1040
+ var et = [K, q], tt = (e) => `__blok-inline-tool__:${e}:${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, nt = n(null);
1041
+ function rt() {
1042
+ let e = s(nt);
1052
1043
  if (e === null) throw Error("useInlineTool() must be called from a component rendered by createReactInlineTool");
1053
1044
  return e;
1054
1045
  }
1055
- function nt(e) {
1046
+ function it(e) {
1056
1047
  var t;
1057
1048
  return t = class {
1058
1049
  static get type() {
@@ -1072,7 +1063,7 @@ function nt(e) {
1072
1063
  return e.mark;
1073
1064
  }
1074
1065
  static get sanitize() {
1075
- return e.sanitize === void 0 ? e.mark === void 0 ? void 0 : C(e.mark) : e.sanitize;
1066
+ return e.sanitize === void 0 ? e.mark === void 0 ? void 0 : E(e.mark) : e.sanitize;
1076
1067
  }
1077
1068
  static get isReadOnlySupported() {
1078
1069
  var t;
@@ -1082,11 +1073,11 @@ function nt(e) {
1082
1073
  var n;
1083
1074
  this.active = !1, this.registered = !1;
1084
1075
  let r = (n = t == null ? void 0 : t.config) == null ? {} : n;
1085
- this.api = t == null ? void 0 : t.api, this.registry = r[G];
1086
- let i = r[K];
1087
- this.toolName = typeof i == "string" ? i : e.type, this.portalKey = $e(this.toolName);
1076
+ this.api = t == null ? void 0 : t.api, this.registry = r[K];
1077
+ let i = r[q];
1078
+ this.toolName = typeof i == "string" ? i : e.type, this.portalKey = tt(this.toolName);
1088
1079
  let a = {};
1089
- for (let [e, t] of Object.entries(r)) Qe.includes(e) || (a[e] = t);
1080
+ for (let [e, t] of Object.entries(r)) et.includes(e) || (a[e] = t);
1090
1081
  this.toolConfig = Object.freeze(a), this.portalComponent = this.createPortalComponent();
1091
1082
  }
1092
1083
  render() {
@@ -1149,9 +1140,9 @@ function nt(e) {
1149
1140
  api: t,
1150
1141
  mark: i
1151
1142
  }), [e.active, e.config]);
1152
- return /* @__PURE__ */ E(et.Provider, {
1143
+ return /* @__PURE__ */ k(nt.Provider, {
1153
1144
  value: n,
1154
- children: /* @__PURE__ */ E(r, {
1145
+ children: /* @__PURE__ */ k(r, {
1155
1146
  active: e.active,
1156
1147
  config: e.config
1157
1148
  })
@@ -1162,4 +1153,4 @@ function nt(e) {
1162
1153
  }, t.__isBlokReactInlineTool = !0, t.isInline = !0, t;
1163
1154
  }
1164
1155
  //#endregion
1165
- export { G as BLOK_PORTAL_REGISTRY_CONFIG_KEY, K as BLOK_TOOL_NAME_CONFIG_KEY, be as BlockPortalHost, De as BlokContent, je as BlokEditor, U as BlokProvider, Ue as BlokView, oe as createBlockPortalRegistry, Ze as createReactBlock, nt as createReactInlineTool, D as getDirection, O as normalizeLocale, Pe as useBlocks, _e as useBlok, W as useBlokDefaults, Me as useBlokHandle, Se as useBlokInstance, Fe as useBlokReady, Ve as useBlokView, tt as useInlineTool };
1156
+ export { K as BLOK_PORTAL_REGISTRY_CONFIG_KEY, q as BLOK_TOOL_NAME_CONFIG_KEY, Se as BlockPortalHost, ke as BlokContent, Ne as BlokEditor, ae as BlokProvider, Ke as BlokView, ce as createBlockPortalRegistry, $e as createReactBlock, it as createReactInlineTool, A as getDirection, j as normalizeLocale, Ie as useBlocks, ye as useBlok, oe as useBlokDefaults, Pe as useBlokHandle, we as useBlokInstance, Le as useBlokReady, We as useBlokView, rt as useInlineTool };