@reacteditor/core 0.0.20 → 0.0.22

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.
Files changed (39) hide show
  1. package/dist/{Editor-GVYZ7S5L.mjs → Editor-L76D646I.mjs} +9 -9
  2. package/dist/{actions-BxLinRKD.d.mts → actions-D_rLbpVe.d.mts} +6 -0
  3. package/dist/{actions-BxLinRKD.d.ts → actions-D_rLbpVe.d.ts} +6 -0
  4. package/dist/{chunk-DKFLK64M.mjs → chunk-ANWIFBRQ.mjs} +1 -1
  5. package/dist/{chunk-M4JDRFYB.mjs → chunk-BFLF77R7.mjs} +3 -3
  6. package/dist/{chunk-M36T7BWB.mjs → chunk-HIOPRNZ4.mjs} +1 -1
  7. package/dist/{chunk-FTVOCMGV.mjs → chunk-MGEDZ4MA.mjs} +1 -1
  8. package/dist/{chunk-MUBFR675.mjs → chunk-QGW2O2TN.mjs} +3 -3
  9. package/dist/{chunk-PGSQPCM6.mjs → chunk-R344I62Q.mjs} +1 -1
  10. package/dist/{chunk-JIXMPJZA.mjs → chunk-SQ66YE7L.mjs} +2 -2
  11. package/dist/{chunk-AD67LVXW.mjs → chunk-U52CF6C5.mjs} +2 -2
  12. package/dist/{chunk-BORTMJJZ.mjs → chunk-UEPLVAME.mjs} +3 -3
  13. package/dist/{chunk-HWYAMQID.mjs → chunk-UOKINS3M.mjs} +143 -38
  14. package/dist/{chunk-MVJENRGK.mjs → chunk-XREK5QOM.mjs} +7 -7
  15. package/dist/{full-QWTPWHXQ.mjs → full-WQ3EE5XF.mjs} +8 -8
  16. package/dist/{index-DET4zR84.d.mts → index-ByKXq8j5.d.mts} +1 -1
  17. package/dist/{index-YRgZBGas.d.ts → index-jLN0kzKZ.d.ts} +1 -1
  18. package/dist/index.d.mts +30 -5
  19. package/dist/index.d.ts +30 -5
  20. package/dist/index.js +135 -29
  21. package/dist/index.mjs +13 -11
  22. package/dist/internal.d.mts +2 -2
  23. package/dist/internal.d.ts +2 -2
  24. package/dist/internal.js +4 -4
  25. package/dist/internal.mjs +2 -2
  26. package/dist/{loaded-BHRFTTT2.mjs → loaded-B6MZXIYJ.mjs} +5 -5
  27. package/dist/{loaded-XKFARPER.mjs → loaded-IYWHACEP.mjs} +5 -5
  28. package/dist/{loaded-HIFB4G2Q.mjs → loaded-QSBR22EG.mjs} +5 -5
  29. package/dist/no-external.d.mts +4 -4
  30. package/dist/no-external.d.ts +4 -4
  31. package/dist/no-external.js +135 -29
  32. package/dist/no-external.mjs +13 -11
  33. package/dist/rsc.d.mts +2 -2
  34. package/dist/rsc.d.ts +2 -2
  35. package/dist/rsc.js +2 -2
  36. package/dist/rsc.mjs +3 -3
  37. package/dist/{walk-tree-Clklc1Ql.d.ts → walk-tree-CklAwhBX.d.ts} +1 -1
  38. package/dist/{walk-tree-BvYigWFL.d.mts → walk-tree-Dq_FpsiR.d.mts} +1 -1
  39. package/package.json +1 -6
@@ -4,20 +4,20 @@ import {
4
4
  import {
5
5
  EditorInner,
6
6
  LoadedRichTextMenu
7
- } from "./chunk-BORTMJJZ.mjs";
8
- import "./chunk-MVJENRGK.mjs";
9
- import "./chunk-M36T7BWB.mjs";
7
+ } from "./chunk-UEPLVAME.mjs";
8
+ import "./chunk-XREK5QOM.mjs";
9
+ import "./chunk-HIOPRNZ4.mjs";
10
10
  import "./chunk-6QJ2HF4O.mjs";
11
- import "./chunk-PGSQPCM6.mjs";
12
- import "./chunk-DKFLK64M.mjs";
11
+ import "./chunk-R344I62Q.mjs";
12
+ import "./chunk-ANWIFBRQ.mjs";
13
13
  import {
14
14
  useAppStore,
15
15
  useAppStoreApi
16
- } from "./chunk-MUBFR675.mjs";
17
- import "./chunk-M4JDRFYB.mjs";
18
- import "./chunk-FTVOCMGV.mjs";
16
+ } from "./chunk-QGW2O2TN.mjs";
17
+ import "./chunk-BFLF77R7.mjs";
18
+ import "./chunk-MGEDZ4MA.mjs";
19
19
  import "./chunk-DQU3HIP4.mjs";
20
- import "./chunk-JIXMPJZA.mjs";
20
+ import "./chunk-SQ66YE7L.mjs";
21
21
  import {
22
22
  __spreadProps,
23
23
  __spreadValues,
@@ -508,6 +508,12 @@ type BaseData<Props extends {
508
508
  };
509
509
  type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
510
510
  props: Props;
511
+ /**
512
+ * Opt this page's root into the shared root entry in `data.globals` (key
513
+ * `__root`). Defaults to `true` when `config.root.global !== false`. Set
514
+ * `false` to make the root page-local while leaving other pages synced.
515
+ */
516
+ synced?: boolean;
511
517
  };
512
518
  type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
513
519
  type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
@@ -508,6 +508,12 @@ type BaseData<Props extends {
508
508
  };
509
509
  type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = BaseData<Props> & {
510
510
  props: Props;
511
+ /**
512
+ * Opt this page's root into the shared root entry in `data.globals` (key
513
+ * `__root`). Defaults to `true` when `config.root.global !== false`. Set
514
+ * `false` to make the root page-local while leaving other pages synced.
515
+ */
516
+ synced?: boolean;
511
517
  };
512
518
  type RootDataWithoutProps<Props extends DefaultComponentProps = DefaultRootFieldProps> = Props;
513
519
  type RootData<Props extends DefaultComponentProps = DefaultRootFieldProps> = Partial<RootDataWithProps<AsFieldProps<Props>>> & Partial<RootDataWithoutProps<Props>>;
@@ -5,7 +5,7 @@ import {
5
5
  Heading4,
6
6
  Heading5,
7
7
  Heading6
8
- } from "./chunk-MUBFR675.mjs";
8
+ } from "./chunk-QGW2O2TN.mjs";
9
9
  import {
10
10
  init_react_import
11
11
  } from "./chunk-M6W7YEVX.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  setupZone,
5
5
  walkAppState,
6
6
  walkTree
7
- } from "./chunk-JIXMPJZA.mjs";
7
+ } from "./chunk-SQ66YE7L.mjs";
8
8
  import {
9
9
  __spreadProps,
10
10
  __spreadValues,
@@ -188,10 +188,10 @@ var replaceRootAction = (state, action, appStore) => {
188
188
  (content) => content,
189
189
  (childItem) => {
190
190
  if (childItem.props.id === "root") {
191
- return __spreadProps(__spreadValues({}, childItem), {
191
+ return __spreadValues(__spreadProps(__spreadValues({}, childItem), {
192
192
  props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
193
193
  readOnly: action.root.readOnly
194
- });
194
+ }), action.root.synced !== void 0 ? { synced: action.root.synced } : {});
195
195
  }
196
196
  return childItem;
197
197
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  List,
3
3
  ListOrdered
4
- } from "./chunk-MUBFR675.mjs";
4
+ } from "./chunk-QGW2O2TN.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mapFields,
3
3
  toComponent
4
- } from "./chunk-JIXMPJZA.mjs";
4
+ } from "./chunk-SQ66YE7L.mjs";
5
5
  import {
6
6
  __async,
7
7
  __spreadProps,
@@ -2,20 +2,20 @@ import {
2
2
  createReducer,
3
3
  getItem,
4
4
  makeStatePublic
5
- } from "./chunk-M4JDRFYB.mjs";
5
+ } from "./chunk-BFLF77R7.mjs";
6
6
  import {
7
7
  defaultAppState,
8
8
  defaultViewports,
9
9
  getChanged,
10
10
  resolveComponentData
11
- } from "./chunk-FTVOCMGV.mjs";
11
+ } from "./chunk-MGEDZ4MA.mjs";
12
12
  import {
13
13
  get_class_name_factory_default
14
14
  } from "./chunk-DQU3HIP4.mjs";
15
15
  import {
16
16
  generateId,
17
17
  walkAppState
18
- } from "./chunk-JIXMPJZA.mjs";
18
+ } from "./chunk-SQ66YE7L.mjs";
19
19
  import {
20
20
  __async,
21
21
  __objRest,
@@ -3,7 +3,7 @@ import {
3
3
  AlignJustify,
4
4
  AlignLeft,
5
5
  AlignRight
6
- } from "./chunk-MUBFR675.mjs";
6
+ } from "./chunk-QGW2O2TN.mjs";
7
7
  import {
8
8
  init_react_import
9
9
  } from "./chunk-M6W7YEVX.mjs";
@@ -416,11 +416,11 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
416
416
  const processedRoot = processItem(rootAsComponent, [], -1);
417
417
  const root = __spreadValues(__spreadValues({}, state.data.root), processedRoot);
418
418
  return __spreadProps(__spreadValues({}, state), {
419
- data: {
419
+ data: __spreadValues({
420
420
  root,
421
421
  content: processedContent,
422
422
  zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
423
- },
423
+ }, state.data.globals !== void 0 ? { globals: state.data.globals } : {}),
424
424
  indexes: {
425
425
  nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
426
426
  zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  defaultAppState,
6
6
  resolveComponentData
7
- } from "./chunk-FTVOCMGV.mjs";
7
+ } from "./chunk-MGEDZ4MA.mjs";
8
8
  import {
9
9
  get_class_name_factory_default
10
10
  } from "./chunk-DQU3HIP4.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  toComponent,
16
16
  walkAppState,
17
17
  walkTree
18
- } from "./chunk-JIXMPJZA.mjs";
18
+ } from "./chunk-SQ66YE7L.mjs";
19
19
  import {
20
20
  __async,
21
21
  __objRest,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-MVJENRGK.mjs";
3
+ } from "./chunk-XREK5QOM.mjs";
4
4
  import {
5
5
  styles_module_default
6
6
  } from "./chunk-6QJ2HF4O.mjs";
7
7
  import {
8
8
  useAppStore,
9
9
  useAppStoreApi
10
- } from "./chunk-MUBFR675.mjs";
10
+ } from "./chunk-QGW2O2TN.mjs";
11
11
  import {
12
12
  get_class_name_factory_default
13
13
  } from "./chunk-DQU3HIP4.mjs";
@@ -100,7 +100,7 @@ init_react_import();
100
100
  import { lazy, Suspense } from "react";
101
101
  import { jsx as jsx2 } from "react/jsx-runtime";
102
102
  var LoadedRichTextMenuFull = lazy(
103
- () => import("./full-QWTPWHXQ.mjs").then((m) => ({
103
+ () => import("./full-WQ3EE5XF.mjs").then((m) => ({
104
104
  default: m.LoadedRichTextMenuFull
105
105
  }))
106
106
  );
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  EditorInner,
3
3
  LoadedRichTextMenu
4
- } from "./chunk-BORTMJJZ.mjs";
4
+ } from "./chunk-UEPLVAME.mjs";
5
5
  import {
6
6
  ActionBar,
7
7
  IconButton,
8
8
  LoadedRichTextMenuInner,
9
9
  Loader
10
- } from "./chunk-MVJENRGK.mjs";
10
+ } from "./chunk-XREK5QOM.mjs";
11
11
  import {
12
12
  RichTextRenderFallback,
13
13
  SlotRender,
@@ -16,7 +16,7 @@ import {
16
16
  getSlotTransform,
17
17
  useRichtextProps,
18
18
  useSlots
19
- } from "./chunk-AD67LVXW.mjs";
19
+ } from "./chunk-U52CF6C5.mjs";
20
20
  import {
21
21
  Check,
22
22
  ChevronDown,
@@ -60,18 +60,18 @@ import {
60
60
  useRegisterFieldsSlice,
61
61
  useRegisterHistorySlice,
62
62
  useRegisterPermissionsSlice
63
- } from "./chunk-MUBFR675.mjs";
63
+ } from "./chunk-QGW2O2TN.mjs";
64
64
  import {
65
65
  getItem,
66
66
  insert,
67
67
  insertAction,
68
68
  makeStatePublic,
69
69
  populateIds
70
- } from "./chunk-M4JDRFYB.mjs";
70
+ } from "./chunk-BFLF77R7.mjs";
71
71
  import {
72
72
  defaultAppState,
73
73
  defaultViewports
74
- } from "./chunk-FTVOCMGV.mjs";
74
+ } from "./chunk-MGEDZ4MA.mjs";
75
75
  import {
76
76
  get_class_name_factory_default
77
77
  } from "./chunk-DQU3HIP4.mjs";
@@ -87,7 +87,7 @@ import {
87
87
  toComponent,
88
88
  walkAppState,
89
89
  walkField
90
- } from "./chunk-JIXMPJZA.mjs";
90
+ } from "./chunk-SQ66YE7L.mjs";
91
91
  import {
92
92
  __async,
93
93
  __objRest,
@@ -111,6 +111,10 @@ var overrideKeys = [
111
111
  "preview"
112
112
  ];
113
113
 
114
+ // types/Globals.ts
115
+ init_react_import();
116
+ var GLOBAL_ROOT_KEY = "__root";
117
+
114
118
  // lib/data/set-deep.ts
115
119
  init_react_import();
116
120
  function setDeep(node, path, newVal) {
@@ -2145,7 +2149,7 @@ EditorFallback.displayName = "EditorFallback";
2145
2149
  // components/AutoField/fields/RichtextField/index.tsx
2146
2150
  import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
2147
2151
  var Editor = lazy(
2148
- () => import("./Editor-GVYZ7S5L.mjs").then((m) => ({
2152
+ () => import("./Editor-L76D646I.mjs").then((m) => ({
2149
2153
  default: m.Editor
2150
2154
  }))
2151
2155
  );
@@ -4697,7 +4701,7 @@ import {
4697
4701
  } from "react";
4698
4702
  import { jsx as jsx30 } from "react/jsx-runtime";
4699
4703
  var Editor2 = lazy2(
4700
- () => import("./Editor-GVYZ7S5L.mjs").then((m) => ({
4704
+ () => import("./Editor-L76D646I.mjs").then((m) => ({
4701
4705
  default: m.Editor
4702
4706
  }))
4703
4707
  );
@@ -5536,6 +5540,10 @@ import React3, { useMemo as useMemo13 } from "react";
5536
5540
 
5537
5541
  // lib/resolve-globals.ts
5538
5542
  init_react_import();
5543
+ var isRootGlobal = (config) => {
5544
+ var _a;
5545
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
5546
+ };
5539
5547
  function resolveItem(item, globals, config, visitedTypes) {
5540
5548
  var _a, _b, _c, _d;
5541
5549
  const type = item.type;
@@ -5573,14 +5581,23 @@ function resolveItem(item, globals, config, visitedTypes) {
5573
5581
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
5574
5582
  }
5575
5583
  function resolveGlobals(data, config) {
5576
- var _a;
5584
+ var _a, _b, _c, _d;
5577
5585
  const globals = data.globals;
5578
5586
  if (!globals || Object.keys(globals).length === 0) return data;
5579
5587
  const visited = /* @__PURE__ */ new Set();
5580
5588
  const content = ((_a = data.content) != null ? _a : []).map(
5581
5589
  (item) => resolveItem(item, globals, config, visited)
5582
5590
  );
5583
- return __spreadProps(__spreadValues({}, data), { content });
5591
+ const rootGlobal = globals[GLOBAL_ROOT_KEY];
5592
+ const rootSynced = ((_b = data.root) == null ? void 0 : _b.synced) !== false;
5593
+ let nextRoot = data.root;
5594
+ if (isRootGlobal(config) && rootSynced && rootGlobal) {
5595
+ const currentProps = (_d = (_c = data.root) == null ? void 0 : _c.props) != null ? _d : {};
5596
+ nextRoot = __spreadProps(__spreadValues({}, data.root), {
5597
+ props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
5598
+ });
5599
+ }
5600
+ return __spreadProps(__spreadValues({}, data), { root: nextRoot, content });
5584
5601
  }
5585
5602
 
5586
5603
  // components/Render/index.tsx
@@ -6346,21 +6363,45 @@ var GlobalSyncButton = () => {
6346
6363
  return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
6347
6364
  }
6348
6365
  );
6349
- if (!selectedItem || !isGlobalType) return null;
6350
- const isUnlinked = selectedItem.synced === false;
6366
+ const isRootGlobal3 = useAppStore(
6367
+ (s) => {
6368
+ var _a;
6369
+ return !selectedItem && ((_a = s.config.root) == null ? void 0 : _a.global) !== false;
6370
+ }
6371
+ );
6372
+ const rootSynced = useAppStore(
6373
+ (s) => {
6374
+ var _a;
6375
+ return ((_a = s.state.data.root) == null ? void 0 : _a.synced) !== false;
6376
+ }
6377
+ );
6378
+ if (selectedItem) {
6379
+ if (!isGlobalType) return null;
6380
+ } else if (!isRootGlobal3) {
6381
+ return null;
6382
+ }
6383
+ const isUnlinked = selectedItem ? selectedItem.synced === false : !rootSynced;
6351
6384
  const onClick = () => __async(null, null, function* () {
6352
6385
  const { dispatch, state, resolveComponentData } = appStore.getState();
6353
- const latestSelector = getSelectorForId(state, selectedItem.props.id);
6354
- if (!latestSelector) return;
6355
- const resolved = yield resolveComponentData(
6356
- __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
6357
- "replace"
6358
- );
6386
+ if (selectedItem) {
6387
+ const latestSelector = getSelectorForId(state, selectedItem.props.id);
6388
+ if (!latestSelector) return;
6389
+ const resolved = yield resolveComponentData(
6390
+ __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
6391
+ "replace"
6392
+ );
6393
+ dispatch({
6394
+ type: "replace",
6395
+ destinationIndex: latestSelector.index,
6396
+ destinationZone: latestSelector.zone || rootDroppableId,
6397
+ data: resolved.node
6398
+ });
6399
+ return;
6400
+ }
6359
6401
  dispatch({
6360
- type: "replace",
6361
- destinationIndex: latestSelector.index,
6362
- destinationZone: latestSelector.zone || rootDroppableId,
6363
- data: resolved.node
6402
+ type: "replaceRoot",
6403
+ root: __spreadProps(__spreadValues({}, state.data.root), { synced: isUnlinked ? true : false }),
6404
+ recordHistory: true
6364
6405
  });
6365
6406
  });
6366
6407
  const syncButtonClass = [
@@ -7357,8 +7398,12 @@ import { deepEqual as deepEqual2 } from "fast-equals";
7357
7398
 
7358
7399
  // lib/split-global-data.ts
7359
7400
  init_react_import();
7401
+ var isRootGlobal2 = (config) => {
7402
+ var _a;
7403
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
7404
+ };
7360
7405
  function splitGlobals(data, config) {
7361
- var _a, _b;
7406
+ var _a, _b, _c, _d;
7362
7407
  const extracted = __spreadValues({}, (_a = data.globals) != null ? _a : {});
7363
7408
  function visit(node) {
7364
7409
  var _a2, _b2;
@@ -7380,7 +7425,7 @@ function splitGlobals(data, config) {
7380
7425
  if (!isGlobalType || !node.synced) {
7381
7426
  return __spreadProps(__spreadValues({}, node), { props: processedProps });
7382
7427
  }
7383
- const _c = processedProps, { children, id } = _c, sharedProps = __objRest(_c, ["children", "id"]);
7428
+ const _c2 = processedProps, { children, id } = _c2, sharedProps = __objRest(_c2, ["children", "id"]);
7384
7429
  extracted[type] = { props: sharedProps };
7385
7430
  const instanceProps = { id };
7386
7431
  if (children !== void 0) instanceProps.children = children;
@@ -7392,7 +7437,19 @@ function splitGlobals(data, config) {
7392
7437
  const strippedContent = ((_b = data.content) != null ? _b : []).map(
7393
7438
  (item) => visit(item)
7394
7439
  );
7440
+ let nextRoot = data.root;
7441
+ const rootSynced = ((_c = data.root) == null ? void 0 : _c.synced) !== false;
7442
+ if (isRootGlobal2(config) && rootSynced && data.root) {
7443
+ const currentProps = (_d = data.root.props) != null ? _d : {};
7444
+ const _e = currentProps, { children, id } = _e, sharedRootProps = __objRest(_e, ["children", "id"]);
7445
+ extracted[GLOBAL_ROOT_KEY] = { props: sharedRootProps };
7446
+ const instanceProps = {};
7447
+ if (id !== void 0) instanceProps.id = id;
7448
+ if (children !== void 0) instanceProps.children = children;
7449
+ nextRoot = __spreadProps(__spreadValues({}, data.root), { props: instanceProps });
7450
+ }
7395
7451
  return __spreadProps(__spreadValues({}, data), {
7452
+ root: nextRoot,
7396
7453
  content: strippedContent,
7397
7454
  globals: extracted
7398
7455
  });
@@ -7669,6 +7726,8 @@ var UrlBar = () => {
7669
7726
  inputValue,
7670
7727
  onInputValueChange: (next) => setInputValue(next),
7671
7728
  autoHighlight: false,
7729
+ openOnInputClick: true,
7730
+ filter: null,
7672
7731
  children: [
7673
7732
  /* @__PURE__ */ jsxs20(
7674
7733
  "form",
@@ -9163,17 +9222,25 @@ var useApp = () => {
9163
9222
  const next = isEditing && cfg.editorPath ? `${cfg.editorPath}${target === "/" ? "" : target}` || "/" : target;
9164
9223
  rrNavigate(next || "/");
9165
9224
  };
9225
+ const resolvePageData = (pageData) => {
9226
+ var _a;
9227
+ if (!cfg.globals || Object.keys(cfg.globals).length === 0) return pageData;
9228
+ return __spreadProps(__spreadValues({}, pageData), {
9229
+ globals: __spreadValues(__spreadValues({}, (_a = pageData.globals) != null ? _a : {}), cfg.globals)
9230
+ });
9231
+ };
9166
9232
  return __spreadProps(__spreadValues({}, cfg), {
9167
9233
  routes,
9168
9234
  isEditing,
9169
9235
  route,
9170
- navigate
9236
+ navigate,
9237
+ resolvePageData
9171
9238
  });
9172
9239
  };
9173
9240
 
9174
9241
  // components/App/AppProvider.tsx
9175
9242
  init_react_import();
9176
- import { useMemo as useMemo26 } from "react";
9243
+ import { useCallback as useCallback26, useMemo as useMemo26, useState as useState25 } from "react";
9177
9244
  import {
9178
9245
  BrowserRouter,
9179
9246
  HashRouter,
@@ -9183,6 +9250,19 @@ import {
9183
9250
  import { jsx as jsx55 } from "react/jsx-runtime";
9184
9251
  var EDITOR_PATH = "/editor";
9185
9252
  var isServer = typeof window === "undefined";
9253
+ var seedGlobalsFromPages = (pages) => {
9254
+ const merged = {};
9255
+ for (const page of Object.values(pages)) {
9256
+ const pageGlobals = page.globals;
9257
+ if (!pageGlobals) continue;
9258
+ for (const [key, entry] of Object.entries(pageGlobals)) {
9259
+ if (entry && entry.props) {
9260
+ merged[key] = entry;
9261
+ }
9262
+ }
9263
+ }
9264
+ return merged;
9265
+ };
9186
9266
  function AppProvider({
9187
9267
  config,
9188
9268
  pages,
@@ -9192,14 +9272,22 @@ function AppProvider({
9192
9272
  children
9193
9273
  }) {
9194
9274
  const stablePages = useStableValue(pages);
9275
+ const [globals, setGlobals] = useState25(
9276
+ () => seedGlobalsFromPages(stablePages)
9277
+ );
9278
+ const updateGlobals = useCallback26((next) => {
9279
+ setGlobals(next);
9280
+ }, []);
9195
9281
  const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
9196
9282
  const ctxValue = useMemo26(
9197
9283
  () => ({
9198
9284
  config,
9199
9285
  pages: stablePages,
9200
- editorPath: resolvedEditorPath
9286
+ editorPath: resolvedEditorPath,
9287
+ globals,
9288
+ setGlobals: updateGlobals
9201
9289
  }),
9202
- [config, stablePages, resolvedEditorPath]
9290
+ [config, stablePages, resolvedEditorPath, globals, updateGlobals]
9203
9291
  );
9204
9292
  const inner = /* @__PURE__ */ jsx55(appConfigContext.Provider, { value: ctxValue, children });
9205
9293
  if (isServer) {
@@ -9216,6 +9304,7 @@ function AppProvider({
9216
9304
 
9217
9305
  // components/App/App.tsx
9218
9306
  init_react_import();
9307
+ import { useCallback as useCallback27 } from "react";
9219
9308
  import { Route, Routes } from "react-router";
9220
9309
  import { Fragment as Fragment15, jsx as jsx56, jsxs as jsxs24 } from "react/jsx-runtime";
9221
9310
  var joinEditorPath = (editorPath, route) => {
@@ -9242,14 +9331,14 @@ function RenderForKey({
9242
9331
  routeKey,
9243
9332
  metadata
9244
9333
  }) {
9245
- const { config, pages } = useApp();
9334
+ const { config, pages, resolvePageData } = useApp();
9246
9335
  const data = pages[routeKey];
9247
9336
  if (!data) return null;
9248
9337
  return /* @__PURE__ */ jsx56(
9249
9338
  Render,
9250
9339
  {
9251
9340
  config,
9252
- data,
9341
+ data: resolvePageData(data),
9253
9342
  metadata
9254
9343
  },
9255
9344
  routeKey
@@ -9260,9 +9349,27 @@ function EditorForKey({
9260
9349
  editorProps,
9261
9350
  children
9262
9351
  }) {
9263
- const { config, pages, routes, navigate, route } = useApp();
9264
- const data = pages[routeKey];
9265
- if (!data) return null;
9352
+ const {
9353
+ config,
9354
+ pages,
9355
+ routes,
9356
+ navigate,
9357
+ route,
9358
+ resolvePageData,
9359
+ setGlobals
9360
+ } = useApp();
9361
+ const rawData = pages[routeKey];
9362
+ const hostOnChange = editorProps.onChange;
9363
+ const handleChange = useCallback27(
9364
+ (next) => {
9365
+ const nextGlobals = next.globals;
9366
+ if (nextGlobals) setGlobals(nextGlobals);
9367
+ hostOnChange == null ? void 0 : hostOnChange(next);
9368
+ },
9369
+ [hostOnChange, setGlobals]
9370
+ );
9371
+ if (!rawData) return null;
9372
+ const data = resolvePageData(rawData);
9266
9373
  const editorRoute = {
9267
9374
  key: routeKey,
9268
9375
  path: (route == null ? void 0 : route.key) === routeKey ? route.path : routeKey,
@@ -9281,7 +9388,7 @@ function EditorForKey({
9281
9388
  iframe: editorProps.iframe,
9282
9389
  viewports: editorProps.viewports,
9283
9390
  permissions: editorProps.permissions,
9284
- onChange: editorProps.onChange,
9391
+ onChange: handleChange,
9285
9392
  onPublish: editorProps.onPublish,
9286
9393
  onAction: editorProps.onAction,
9287
9394
  renderHeader: editorProps.renderHeader,
@@ -9492,9 +9599,6 @@ init_react_import();
9492
9599
  // types/Fields.ts
9493
9600
  init_react_import();
9494
9601
 
9495
- // types/Globals.ts
9496
- init_react_import();
9497
-
9498
9602
  // types/Props.tsx
9499
9603
  init_react_import();
9500
9604
 
@@ -9506,6 +9610,7 @@ init_react_import();
9506
9610
 
9507
9611
  export {
9508
9612
  overrideKeys,
9613
+ GLOBAL_ROOT_KEY,
9509
9614
  setDeep,
9510
9615
  Button,
9511
9616
  FieldLabel,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-M36T7BWB.mjs";
3
+ } from "./chunk-HIOPRNZ4.mjs";
4
4
  import {
5
5
  useAlignOptions
6
- } from "./chunk-PGSQPCM6.mjs";
6
+ } from "./chunk-R344I62Q.mjs";
7
7
  import {
8
8
  useHeadingOptions
9
- } from "./chunk-DKFLK64M.mjs";
9
+ } from "./chunk-ANWIFBRQ.mjs";
10
10
  import {
11
11
  AlignCenter,
12
12
  AlignJustify,
@@ -26,7 +26,7 @@ import {
26
26
  Strikethrough,
27
27
  Underline,
28
28
  useControlContext
29
- } from "./chunk-MUBFR675.mjs";
29
+ } from "./chunk-QGW2O2TN.mjs";
30
30
  import {
31
31
  get_class_name_factory_default
32
32
  } from "./chunk-DQU3HIP4.mjs";
@@ -450,7 +450,7 @@ function AlignSelectFallback() {
450
450
  // components/RichTextMenu/controls/AlignSelect/index.tsx
451
451
  import { jsx as jsx10 } from "react/jsx-runtime";
452
452
  var AlignSelectLoaded = lazy(
453
- () => import("./loaded-XKFARPER.mjs").then((m) => ({
453
+ () => import("./loaded-IYWHACEP.mjs").then((m) => ({
454
454
  default: m.AlignSelectLoaded
455
455
  }))
456
456
  );
@@ -681,7 +681,7 @@ function HeadingSelectFallback() {
681
681
  // components/RichTextMenu/controls/HeadingSelect/index.tsx
682
682
  import { jsx as jsx22 } from "react/jsx-runtime";
683
683
  var HeadingSelectLoaded = lazy2(
684
- () => import("./loaded-BHRFTTT2.mjs").then((m) => ({
684
+ () => import("./loaded-B6MZXIYJ.mjs").then((m) => ({
685
685
  default: m.HeadingSelectLoaded
686
686
  }))
687
687
  );
@@ -713,7 +713,7 @@ function ListSelectFallback() {
713
713
  // components/RichTextMenu/controls/ListSelect/index.tsx
714
714
  import { jsx as jsx24 } from "react/jsx-runtime";
715
715
  var ListSelectLoaded = lazy3(
716
- () => import("./loaded-HIFB4G2Q.mjs").then((m) => ({
716
+ () => import("./loaded-QSBR22EG.mjs").then((m) => ({
717
717
  default: m.ListSelectLoaded
718
718
  }))
719
719
  );
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  LoadedRichTextMenuInner
3
- } from "./chunk-MVJENRGK.mjs";
4
- import "./chunk-M36T7BWB.mjs";
5
- import "./chunk-PGSQPCM6.mjs";
6
- import "./chunk-DKFLK64M.mjs";
7
- import "./chunk-MUBFR675.mjs";
8
- import "./chunk-M4JDRFYB.mjs";
9
- import "./chunk-FTVOCMGV.mjs";
3
+ } from "./chunk-XREK5QOM.mjs";
4
+ import "./chunk-HIOPRNZ4.mjs";
5
+ import "./chunk-R344I62Q.mjs";
6
+ import "./chunk-ANWIFBRQ.mjs";
7
+ import "./chunk-QGW2O2TN.mjs";
8
+ import "./chunk-BFLF77R7.mjs";
9
+ import "./chunk-MGEDZ4MA.mjs";
10
10
  import "./chunk-DQU3HIP4.mjs";
11
- import "./chunk-JIXMPJZA.mjs";
11
+ import "./chunk-SQ66YE7L.mjs";
12
12
  import {
13
13
  __spreadValues,
14
14
  init_react_import
@@ -1,4 +1,4 @@
1
- import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-BxLinRKD.mjs';
1
+ import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-D_rLbpVe.mjs';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
@@ -1,4 +1,4 @@
1
- import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-BxLinRKD.js';
1
+ import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-D_rLbpVe.js';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {