@reacteditor/core 0.0.21 → 0.0.23

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 (41) hide show
  1. package/dist/{Editor-GVYZ7S5L.mjs → Editor-L76D646I.mjs} +9 -9
  2. package/dist/{actions-BxLinRKD.d.mts → actions-BxpNoF2q.d.mts} +6 -0
  3. package/dist/{actions-BxLinRKD.d.ts → actions-BxpNoF2q.d.ts} +6 -0
  4. package/dist/{chunk-HWYAMQID.mjs → chunk-5WTMEYPV.mjs} +160 -40
  5. package/dist/{chunk-DKFLK64M.mjs → chunk-ANWIFBRQ.mjs} +1 -1
  6. package/dist/{chunk-M4JDRFYB.mjs → chunk-BFLF77R7.mjs} +3 -3
  7. package/dist/{chunk-M36T7BWB.mjs → chunk-HIOPRNZ4.mjs} +1 -1
  8. package/dist/{chunk-FTVOCMGV.mjs → chunk-MGEDZ4MA.mjs} +1 -1
  9. package/dist/{chunk-MUBFR675.mjs → chunk-QGW2O2TN.mjs} +3 -3
  10. package/dist/{chunk-PGSQPCM6.mjs → chunk-R344I62Q.mjs} +1 -1
  11. package/dist/{chunk-JIXMPJZA.mjs → chunk-SQ66YE7L.mjs} +2 -2
  12. package/dist/{chunk-AD67LVXW.mjs → chunk-U52CF6C5.mjs} +2 -2
  13. package/dist/{chunk-BORTMJJZ.mjs → chunk-UEPLVAME.mjs} +3 -3
  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-YRgZBGas.d.ts → index-XnBvIAmy.d.ts} +1 -1
  17. package/dist/{index-DET4zR84.d.mts → index-YjPj7lv4.d.mts} +1 -1
  18. package/dist/index.css +6 -5
  19. package/dist/index.d.mts +38 -5
  20. package/dist/index.d.ts +38 -5
  21. package/dist/index.js +153 -31
  22. package/dist/index.mjs +15 -11
  23. package/dist/internal.d.mts +2 -2
  24. package/dist/internal.d.ts +2 -2
  25. package/dist/internal.js +4 -4
  26. package/dist/internal.mjs +2 -2
  27. package/dist/{loaded-BHRFTTT2.mjs → loaded-B6MZXIYJ.mjs} +5 -5
  28. package/dist/{loaded-XKFARPER.mjs → loaded-IYWHACEP.mjs} +5 -5
  29. package/dist/{loaded-HIFB4G2Q.mjs → loaded-QSBR22EG.mjs} +5 -5
  30. package/dist/no-external.css +6 -5
  31. package/dist/no-external.d.mts +4 -4
  32. package/dist/no-external.d.ts +4 -4
  33. package/dist/no-external.js +153 -31
  34. package/dist/no-external.mjs +15 -11
  35. package/dist/rsc.d.mts +2 -2
  36. package/dist/rsc.d.ts +2 -2
  37. package/dist/rsc.js +2 -2
  38. package/dist/rsc.mjs +3 -3
  39. package/dist/{walk-tree-Clklc1Ql.d.ts → walk-tree-BfVJmXEX.d.ts} +1 -1
  40. package/dist/{walk-tree-BvYigWFL.d.mts → walk-tree-uv_FsXcr.d.mts} +1 -1
  41. package/package.json +4 -4
@@ -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>>;
@@ -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,11 @@ var overrideKeys = [
111
111
  "preview"
112
112
  ];
113
113
 
114
+ // types/Globals.ts
115
+ init_react_import();
116
+ var GLOBAL_ROOT_KEY = "root";
117
+ var LEGACY_GLOBAL_ROOT_KEY = "__root";
118
+
114
119
  // lib/data/set-deep.ts
115
120
  init_react_import();
116
121
  function setDeep(node, path, newVal) {
@@ -2145,7 +2150,7 @@ EditorFallback.displayName = "EditorFallback";
2145
2150
  // components/AutoField/fields/RichtextField/index.tsx
2146
2151
  import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
2147
2152
  var Editor = lazy(
2148
- () => import("./Editor-GVYZ7S5L.mjs").then((m) => ({
2153
+ () => import("./Editor-L76D646I.mjs").then((m) => ({
2149
2154
  default: m.Editor
2150
2155
  }))
2151
2156
  );
@@ -4697,7 +4702,7 @@ import {
4697
4702
  } from "react";
4698
4703
  import { jsx as jsx30 } from "react/jsx-runtime";
4699
4704
  var Editor2 = lazy2(
4700
- () => import("./Editor-GVYZ7S5L.mjs").then((m) => ({
4705
+ () => import("./Editor-L76D646I.mjs").then((m) => ({
4701
4706
  default: m.Editor
4702
4707
  }))
4703
4708
  );
@@ -5536,6 +5541,10 @@ import React3, { useMemo as useMemo13 } from "react";
5536
5541
 
5537
5542
  // lib/resolve-globals.ts
5538
5543
  init_react_import();
5544
+ var isRootGlobal = (config) => {
5545
+ var _a;
5546
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
5547
+ };
5539
5548
  function resolveItem(item, globals, config, visitedTypes) {
5540
5549
  var _a, _b, _c, _d;
5541
5550
  const type = item.type;
@@ -5573,14 +5582,23 @@ function resolveItem(item, globals, config, visitedTypes) {
5573
5582
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
5574
5583
  }
5575
5584
  function resolveGlobals(data, config) {
5576
- var _a;
5585
+ var _a, _b, _c, _d, _e;
5577
5586
  const globals = data.globals;
5578
5587
  if (!globals || Object.keys(globals).length === 0) return data;
5579
5588
  const visited = /* @__PURE__ */ new Set();
5580
5589
  const content = ((_a = data.content) != null ? _a : []).map(
5581
5590
  (item) => resolveItem(item, globals, config, visited)
5582
5591
  );
5583
- return __spreadProps(__spreadValues({}, data), { content });
5592
+ const rootGlobal = (_b = globals[GLOBAL_ROOT_KEY]) != null ? _b : globals[LEGACY_GLOBAL_ROOT_KEY];
5593
+ const rootSynced = ((_c = data.root) == null ? void 0 : _c.synced) !== false;
5594
+ let nextRoot = data.root;
5595
+ if (isRootGlobal(config) && rootSynced && rootGlobal) {
5596
+ const currentProps = (_e = (_d = data.root) == null ? void 0 : _d.props) != null ? _e : {};
5597
+ nextRoot = __spreadProps(__spreadValues({}, data.root), {
5598
+ props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
5599
+ });
5600
+ }
5601
+ return __spreadProps(__spreadValues({}, data), { root: nextRoot, content });
5584
5602
  }
5585
5603
 
5586
5604
  // components/Render/index.tsx
@@ -6346,21 +6364,45 @@ var GlobalSyncButton = () => {
6346
6364
  return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
6347
6365
  }
6348
6366
  );
6349
- if (!selectedItem || !isGlobalType) return null;
6350
- const isUnlinked = selectedItem.synced === false;
6367
+ const isRootGlobal3 = useAppStore(
6368
+ (s) => {
6369
+ var _a;
6370
+ return !selectedItem && ((_a = s.config.root) == null ? void 0 : _a.global) !== false;
6371
+ }
6372
+ );
6373
+ const rootSynced = useAppStore(
6374
+ (s) => {
6375
+ var _a;
6376
+ return ((_a = s.state.data.root) == null ? void 0 : _a.synced) !== false;
6377
+ }
6378
+ );
6379
+ if (selectedItem) {
6380
+ if (!isGlobalType) return null;
6381
+ } else if (!isRootGlobal3) {
6382
+ return null;
6383
+ }
6384
+ const isUnlinked = selectedItem ? selectedItem.synced === false : !rootSynced;
6351
6385
  const onClick = () => __async(null, null, function* () {
6352
6386
  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
- );
6387
+ if (selectedItem) {
6388
+ const latestSelector = getSelectorForId(state, selectedItem.props.id);
6389
+ if (!latestSelector) return;
6390
+ const resolved = yield resolveComponentData(
6391
+ __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
6392
+ "replace"
6393
+ );
6394
+ dispatch({
6395
+ type: "replace",
6396
+ destinationIndex: latestSelector.index,
6397
+ destinationZone: latestSelector.zone || rootDroppableId,
6398
+ data: resolved.node
6399
+ });
6400
+ return;
6401
+ }
6359
6402
  dispatch({
6360
- type: "replace",
6361
- destinationIndex: latestSelector.index,
6362
- destinationZone: latestSelector.zone || rootDroppableId,
6363
- data: resolved.node
6403
+ type: "replaceRoot",
6404
+ root: __spreadProps(__spreadValues({}, state.data.root), { synced: isUnlinked ? true : false }),
6405
+ recordHistory: true
6364
6406
  });
6365
6407
  });
6366
6408
  const syncButtonClass = [
@@ -6418,7 +6460,7 @@ var Fields = memo8(FieldsInternal);
6418
6460
 
6419
6461
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
6420
6462
  init_react_import();
6421
- var styles_module_default19 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
6463
+ var styles_module_default19 = { "FieldsPlugin": "_FieldsPlugin_11j3y_1", "FieldsPlugin-header": "_FieldsPlugin-header_11j3y_7" };
6422
6464
 
6423
6465
  // plugins/fields/index.tsx
6424
6466
  import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
@@ -7357,9 +7399,16 @@ import { deepEqual as deepEqual2 } from "fast-equals";
7357
7399
 
7358
7400
  // lib/split-global-data.ts
7359
7401
  init_react_import();
7402
+ var isRootGlobal2 = (config) => {
7403
+ var _a;
7404
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
7405
+ };
7360
7406
  function splitGlobals(data, config) {
7361
- var _a, _b;
7407
+ var _a, _b, _c, _d;
7362
7408
  const extracted = __spreadValues({}, (_a = data.globals) != null ? _a : {});
7409
+ if (LEGACY_GLOBAL_ROOT_KEY in extracted) {
7410
+ delete extracted[LEGACY_GLOBAL_ROOT_KEY];
7411
+ }
7363
7412
  function visit(node) {
7364
7413
  var _a2, _b2;
7365
7414
  const type = node.type;
@@ -7380,7 +7429,7 @@ function splitGlobals(data, config) {
7380
7429
  if (!isGlobalType || !node.synced) {
7381
7430
  return __spreadProps(__spreadValues({}, node), { props: processedProps });
7382
7431
  }
7383
- const _c = processedProps, { children, id } = _c, sharedProps = __objRest(_c, ["children", "id"]);
7432
+ const _c2 = processedProps, { children, id } = _c2, sharedProps = __objRest(_c2, ["children", "id"]);
7384
7433
  extracted[type] = { props: sharedProps };
7385
7434
  const instanceProps = { id };
7386
7435
  if (children !== void 0) instanceProps.children = children;
@@ -7392,7 +7441,19 @@ function splitGlobals(data, config) {
7392
7441
  const strippedContent = ((_b = data.content) != null ? _b : []).map(
7393
7442
  (item) => visit(item)
7394
7443
  );
7444
+ let nextRoot = data.root;
7445
+ const rootSynced = ((_c = data.root) == null ? void 0 : _c.synced) !== false;
7446
+ if (isRootGlobal2(config) && rootSynced && data.root) {
7447
+ const currentProps = (_d = data.root.props) != null ? _d : {};
7448
+ const _e = currentProps, { children, id } = _e, sharedRootProps = __objRest(_e, ["children", "id"]);
7449
+ extracted[GLOBAL_ROOT_KEY] = { props: sharedRootProps };
7450
+ const instanceProps = {};
7451
+ if (id !== void 0) instanceProps.id = id;
7452
+ if (children !== void 0) instanceProps.children = children;
7453
+ nextRoot = __spreadProps(__spreadValues({}, data.root), { props: instanceProps });
7454
+ }
7395
7455
  return __spreadProps(__spreadValues({}, data), {
7456
+ root: nextRoot,
7396
7457
  content: strippedContent,
7397
7458
  globals: extracted
7398
7459
  });
@@ -7669,6 +7730,8 @@ var UrlBar = () => {
7669
7730
  inputValue,
7670
7731
  onInputValueChange: (next) => setInputValue(next),
7671
7732
  autoHighlight: false,
7733
+ openOnInputClick: true,
7734
+ filter: null,
7672
7735
  children: [
7673
7736
  /* @__PURE__ */ jsxs20(
7674
7737
  "form",
@@ -9163,17 +9226,25 @@ var useApp = () => {
9163
9226
  const next = isEditing && cfg.editorPath ? `${cfg.editorPath}${target === "/" ? "" : target}` || "/" : target;
9164
9227
  rrNavigate(next || "/");
9165
9228
  };
9229
+ const resolvePageData = (pageData) => {
9230
+ var _a;
9231
+ if (!cfg.globals || Object.keys(cfg.globals).length === 0) return pageData;
9232
+ return __spreadProps(__spreadValues({}, pageData), {
9233
+ globals: __spreadValues(__spreadValues({}, (_a = pageData.globals) != null ? _a : {}), cfg.globals)
9234
+ });
9235
+ };
9166
9236
  return __spreadProps(__spreadValues({}, cfg), {
9167
9237
  routes,
9168
9238
  isEditing,
9169
9239
  route,
9170
- navigate
9240
+ navigate,
9241
+ resolvePageData
9171
9242
  });
9172
9243
  };
9173
9244
 
9174
9245
  // components/App/AppProvider.tsx
9175
9246
  init_react_import();
9176
- import { useMemo as useMemo26 } from "react";
9247
+ import { useCallback as useCallback26, useMemo as useMemo26, useState as useState25 } from "react";
9177
9248
  import {
9178
9249
  BrowserRouter,
9179
9250
  HashRouter,
@@ -9183,6 +9254,24 @@ import {
9183
9254
  import { jsx as jsx55 } from "react/jsx-runtime";
9184
9255
  var EDITOR_PATH = "/editor";
9185
9256
  var isServer = typeof window === "undefined";
9257
+ var normalizeEditorPath = (path) => {
9258
+ if (!path || path === "/") return EDITOR_PATH;
9259
+ const withLeading = path.startsWith("/") ? path : `/${path}`;
9260
+ return withLeading.length > 1 && withLeading.endsWith("/") ? withLeading.slice(0, -1) : withLeading;
9261
+ };
9262
+ var seedGlobalsFromPages = (pages) => {
9263
+ const merged = {};
9264
+ for (const page of Object.values(pages)) {
9265
+ const pageGlobals = page.globals;
9266
+ if (!pageGlobals) continue;
9267
+ for (const [key, entry] of Object.entries(pageGlobals)) {
9268
+ if (entry && entry.props) {
9269
+ merged[key] = entry;
9270
+ }
9271
+ }
9272
+ }
9273
+ return merged;
9274
+ };
9186
9275
  function AppProvider({
9187
9276
  config,
9188
9277
  pages,
@@ -9191,15 +9280,28 @@ function AppProvider({
9191
9280
  currentPath,
9192
9281
  children
9193
9282
  }) {
9283
+ if (!pages || typeof pages !== "object") {
9284
+ throw new Error(
9285
+ "<App> requires a `pages` prop (a map of route \u2192 data). For a single-page setup with no routing, use <Editor> directly instead."
9286
+ );
9287
+ }
9194
9288
  const stablePages = useStableValue(pages);
9195
- const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
9289
+ const [globals, setGlobals] = useState25(
9290
+ () => seedGlobalsFromPages(stablePages)
9291
+ );
9292
+ const updateGlobals = useCallback26((next) => {
9293
+ setGlobals(next);
9294
+ }, []);
9295
+ const resolvedEditorPath = editorPath === null ? null : normalizeEditorPath(editorPath != null ? editorPath : EDITOR_PATH);
9196
9296
  const ctxValue = useMemo26(
9197
9297
  () => ({
9198
9298
  config,
9199
9299
  pages: stablePages,
9200
- editorPath: resolvedEditorPath
9300
+ editorPath: resolvedEditorPath,
9301
+ globals,
9302
+ setGlobals: updateGlobals
9201
9303
  }),
9202
- [config, stablePages, resolvedEditorPath]
9304
+ [config, stablePages, resolvedEditorPath, globals, updateGlobals]
9203
9305
  );
9204
9306
  const inner = /* @__PURE__ */ jsx55(appConfigContext.Provider, { value: ctxValue, children });
9205
9307
  if (isServer) {
@@ -9216,6 +9318,7 @@ function AppProvider({
9216
9318
 
9217
9319
  // components/App/App.tsx
9218
9320
  init_react_import();
9321
+ import { useCallback as useCallback27 } from "react";
9219
9322
  import { Route, Routes } from "react-router";
9220
9323
  import { Fragment as Fragment15, jsx as jsx56, jsxs as jsxs24 } from "react/jsx-runtime";
9221
9324
  var joinEditorPath = (editorPath, route) => {
@@ -9242,14 +9345,14 @@ function RenderForKey({
9242
9345
  routeKey,
9243
9346
  metadata
9244
9347
  }) {
9245
- const { config, pages } = useApp();
9348
+ const { config, pages, resolvePageData } = useApp();
9246
9349
  const data = pages[routeKey];
9247
9350
  if (!data) return null;
9248
9351
  return /* @__PURE__ */ jsx56(
9249
9352
  Render,
9250
9353
  {
9251
9354
  config,
9252
- data,
9355
+ data: resolvePageData(data),
9253
9356
  metadata
9254
9357
  },
9255
9358
  routeKey
@@ -9260,9 +9363,27 @@ function EditorForKey({
9260
9363
  editorProps,
9261
9364
  children
9262
9365
  }) {
9263
- const { config, pages, routes, navigate, route } = useApp();
9264
- const data = pages[routeKey];
9265
- if (!data) return null;
9366
+ const {
9367
+ config,
9368
+ pages,
9369
+ routes,
9370
+ navigate,
9371
+ route,
9372
+ resolvePageData,
9373
+ setGlobals
9374
+ } = useApp();
9375
+ const rawData = pages[routeKey];
9376
+ const hostOnChange = editorProps.onChange;
9377
+ const handleChange = useCallback27(
9378
+ (next) => {
9379
+ const nextGlobals = next.globals;
9380
+ if (nextGlobals) setGlobals(nextGlobals);
9381
+ hostOnChange == null ? void 0 : hostOnChange(next);
9382
+ },
9383
+ [hostOnChange, setGlobals]
9384
+ );
9385
+ if (!rawData) return null;
9386
+ const data = resolvePageData(rawData);
9266
9387
  const editorRoute = {
9267
9388
  key: routeKey,
9268
9389
  path: (route == null ? void 0 : route.key) === routeKey ? route.path : routeKey,
@@ -9281,7 +9402,7 @@ function EditorForKey({
9281
9402
  iframe: editorProps.iframe,
9282
9403
  viewports: editorProps.viewports,
9283
9404
  permissions: editorProps.permissions,
9284
- onChange: editorProps.onChange,
9405
+ onChange: handleChange,
9285
9406
  onPublish: editorProps.onPublish,
9286
9407
  onAction: editorProps.onAction,
9287
9408
  renderHeader: editorProps.renderHeader,
@@ -9492,9 +9613,6 @@ init_react_import();
9492
9613
  // types/Fields.ts
9493
9614
  init_react_import();
9494
9615
 
9495
- // types/Globals.ts
9496
- init_react_import();
9497
-
9498
9616
  // types/Props.tsx
9499
9617
  init_react_import();
9500
9618
 
@@ -9506,6 +9624,8 @@ init_react_import();
9506
9624
 
9507
9625
  export {
9508
9626
  overrideKeys,
9627
+ GLOBAL_ROOT_KEY,
9628
+ LEGACY_GLOBAL_ROOT_KEY,
9509
9629
  setDeep,
9510
9630
  Button,
9511
9631
  FieldLabel,
@@ -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,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
  );