@reacteditor/core 0.0.21 → 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 -1
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, q as EditorChromeConfig, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, r as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, s as ItemSelector, t as PluginInternal } from './actions-BxLinRKD.mjs';
2
- export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, G as ColorField, g as ComponentConfig, J as ComponentConfigExtensions, K as ComponentConfigParams, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, k as DefaultComponents, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, a7 as FieldMetadata, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, F as Fields, H as History, ab as ItemWithId, ac as MappedItem, ad as NumberField, ae as ObjectField, af as OverrideKey, ag as RadioField, ah as RichText, i as RichtextField, ai as RootConfig, n as RootData, R as RootDataWithProps, aj as RootDataWithoutProps, ak as SelectField, al as Slot, am as SlotComponent, an as SlotField, ao as TextField, ap as TextareaField, aq as Viewport, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxLinRKD.mjs';
3
- export { G as GetRoutePropsOptions, g as getRouteProps, m as migrate, r as resolveAllData, a as resolveRouteFromString, t as transformProps, w as walkTree } from './walk-tree-BvYigWFL.mjs';
4
- import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-DET4zR84.mjs';
1
+ import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, q as EditorChromeConfig, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, r as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, s as ItemSelector, t as PluginInternal } from './actions-D_rLbpVe.mjs';
2
+ export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, G as ColorField, g as ComponentConfig, J as ComponentConfigExtensions, K as ComponentConfigParams, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, k as DefaultComponents, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, a7 as FieldMetadata, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, F as Fields, H as History, ab as ItemWithId, ac as MappedItem, ad as NumberField, ae as ObjectField, af as OverrideKey, ag as RadioField, ah as RichText, i as RichtextField, ai as RootConfig, n as RootData, R as RootDataWithProps, aj as RootDataWithoutProps, ak as SelectField, al as Slot, am as SlotComponent, an as SlotField, ao as TextField, ap as TextareaField, aq as Viewport, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-D_rLbpVe.mjs';
3
+ export { G as GetRoutePropsOptions, g as getRouteProps, m as migrate, r as resolveAllData, a as resolveRouteFromString, t as transformProps, w as walkTree } from './walk-tree-Dq_FpsiR.mjs';
4
+ import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-ByKXq8j5.mjs';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as react from 'react';
7
7
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
@@ -26,8 +26,18 @@ import '@tiptap/extension-underline';
26
26
  * `data.globals` and is keyed by component type. Instances opt in per-node
27
27
  * via `synced: true`; synced instances render from this map (children + id
28
28
  * stay extrinsic).
29
+ *
30
+ * The reserved key `__root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
31
+ * for the page root when `config.root.global !== false` and the page's
32
+ * `data.root.synced` is not `false`.
29
33
  */
30
34
  type GlobalsMap = NonNullable<Data["globals"]>;
35
+ /**
36
+ * Reserved key inside `data.globals` that stores shared root props. Chosen
37
+ * with a double underscore so it cannot collide with a user-defined component
38
+ * type name.
39
+ */
40
+ declare const GLOBAL_ROOT_KEY: "__root";
31
41
 
32
42
  /**
33
43
  * A route key — the literal string used as a `pages` key in `<App>` and
@@ -111,6 +121,15 @@ type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics
111
121
  pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
112
122
  /** "/edit" by default; null disables editor mode entirely. */
113
123
  editorPath: string | null;
124
+ /**
125
+ * App-owned globals map overlaid onto each page's `data.globals` so synced
126
+ * instances (and the synced root) share state across pages. Always defined
127
+ * — App seeds it from the initial pages and keeps it in sync via
128
+ * `setGlobals` (called by the editor's onChange wrapper).
129
+ */
130
+ globals: GlobalsMap;
131
+ /** Internal: update the shared globals map. Not exposed to host code. */
132
+ setGlobals: (next: GlobalsMap) => void;
114
133
  };
115
134
  declare const appConfigContext: react.Context<AppConfigContext<Config, UserGenerics<Config>> | null>;
116
135
  type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
@@ -122,6 +141,12 @@ type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<
122
141
  route: AppRoute | null;
123
142
  /** Navigate to a route key. Wraps with editorPath when editing. */
124
143
  navigate: (route: RouteKey) => void;
144
+ /**
145
+ * Resolved per-page data with `globals` overlaid from the app-level
146
+ * `globals` prop (app wins over the page's own `data.globals`). Returns
147
+ * the page's data unchanged when no app-level globals are configured.
148
+ */
149
+ resolvePageData: <D extends Partial<Data>>(pageData: D) => D;
125
150
  };
126
151
  /**
127
152
  * Read the resolved route context. Combines config + pages + editorPath
@@ -572,4 +597,4 @@ declare const outlinePlugin: () => Plugin;
572
597
 
573
598
  declare const legacySideBarPlugin: () => Plugin;
574
599
 
575
- export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRoute, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, EditorChromeConfig, type EditorCommands, EditorRoute, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, OnPublish, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, type RouteKey, Separator, UiState, type UseEditorData, UserGenerics, Viewports, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue };
600
+ export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRoute, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, EditorChromeConfig, type EditorCommands, EditorRoute, Field, FieldLabel, FieldProps, FieldTransforms, GLOBAL_ROOT_KEY, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, OnPublish, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, type RouteKey, Separator, UiState, type UseEditorData, UserGenerics, Viewports, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, q as EditorChromeConfig, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, r as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, s as ItemSelector, t as PluginInternal } from './actions-BxLinRKD.js';
2
- export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, G as ColorField, g as ComponentConfig, J as ComponentConfigExtensions, K as ComponentConfigParams, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, k as DefaultComponents, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, a7 as FieldMetadata, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, F as Fields, H as History, ab as ItemWithId, ac as MappedItem, ad as NumberField, ae as ObjectField, af as OverrideKey, ag as RadioField, ah as RichText, i as RichtextField, ai as RootConfig, n as RootData, R as RootDataWithProps, aj as RootDataWithoutProps, ak as SelectField, al as Slot, am as SlotComponent, an as SlotField, ao as TextField, ap as TextareaField, aq as Viewport, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxLinRKD.js';
3
- export { G as GetRoutePropsOptions, g as getRouteProps, m as migrate, r as resolveAllData, a as resolveRouteFromString, t as transformProps, w as walkTree } from './walk-tree-Clklc1Ql.js';
4
- import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-YRgZBGas.js';
1
+ import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, q as EditorChromeConfig, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, r as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, s as ItemSelector, t as PluginInternal } from './actions-D_rLbpVe.js';
2
+ export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, G as ColorField, g as ComponentConfig, J as ComponentConfigExtensions, K as ComponentConfigParams, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, k as DefaultComponents, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, a7 as FieldMetadata, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, F as Fields, H as History, ab as ItemWithId, ac as MappedItem, ad as NumberField, ae as ObjectField, af as OverrideKey, ag as RadioField, ah as RichText, i as RichtextField, ai as RootConfig, n as RootData, R as RootDataWithProps, aj as RootDataWithoutProps, ak as SelectField, al as Slot, am as SlotComponent, an as SlotField, ao as TextField, ap as TextareaField, aq as Viewport, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-D_rLbpVe.js';
3
+ export { G as GetRoutePropsOptions, g as getRouteProps, m as migrate, r as resolveAllData, a as resolveRouteFromString, t as transformProps, w as walkTree } from './walk-tree-CklAwhBX.js';
4
+ import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-jLN0kzKZ.js';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
6
  import * as react from 'react';
7
7
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
@@ -26,8 +26,18 @@ import '@tiptap/extension-underline';
26
26
  * `data.globals` and is keyed by component type. Instances opt in per-node
27
27
  * via `synced: true`; synced instances render from this map (children + id
28
28
  * stay extrinsic).
29
+ *
30
+ * The reserved key `__root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
31
+ * for the page root when `config.root.global !== false` and the page's
32
+ * `data.root.synced` is not `false`.
29
33
  */
30
34
  type GlobalsMap = NonNullable<Data["globals"]>;
35
+ /**
36
+ * Reserved key inside `data.globals` that stores shared root props. Chosen
37
+ * with a double underscore so it cannot collide with a user-defined component
38
+ * type name.
39
+ */
40
+ declare const GLOBAL_ROOT_KEY: "__root";
31
41
 
32
42
  /**
33
43
  * A route key — the literal string used as a `pages` key in `<App>` and
@@ -111,6 +121,15 @@ type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics
111
121
  pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
112
122
  /** "/edit" by default; null disables editor mode entirely. */
113
123
  editorPath: string | null;
124
+ /**
125
+ * App-owned globals map overlaid onto each page's `data.globals` so synced
126
+ * instances (and the synced root) share state across pages. Always defined
127
+ * — App seeds it from the initial pages and keeps it in sync via
128
+ * `setGlobals` (called by the editor's onChange wrapper).
129
+ */
130
+ globals: GlobalsMap;
131
+ /** Internal: update the shared globals map. Not exposed to host code. */
132
+ setGlobals: (next: GlobalsMap) => void;
114
133
  };
115
134
  declare const appConfigContext: react.Context<AppConfigContext<Config, UserGenerics<Config>> | null>;
116
135
  type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
@@ -122,6 +141,12 @@ type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<
122
141
  route: AppRoute | null;
123
142
  /** Navigate to a route key. Wraps with editorPath when editing. */
124
143
  navigate: (route: RouteKey) => void;
144
+ /**
145
+ * Resolved per-page data with `globals` overlaid from the app-level
146
+ * `globals` prop (app wins over the page's own `data.globals`). Returns
147
+ * the page's data unchanged when no app-level globals are configured.
148
+ */
149
+ resolvePageData: <D extends Partial<Data>>(pageData: D) => D;
125
150
  };
126
151
  /**
127
152
  * Read the resolved route context. Combines config + pages + editorPath
@@ -572,4 +597,4 @@ declare const outlinePlugin: () => Plugin;
572
597
 
573
598
  declare const legacySideBarPlugin: () => Plugin;
574
599
 
575
- export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRoute, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, EditorChromeConfig, type EditorCommands, EditorRoute, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, OnPublish, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, type RouteKey, Separator, UiState, type UseEditorData, UserGenerics, Viewports, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue };
600
+ export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRoute, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, EditorChromeConfig, type EditorCommands, EditorRoute, Field, FieldLabel, FieldProps, FieldTransforms, GLOBAL_ROOT_KEY, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, OnPublish, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, type RouteKey, Separator, UiState, type UseEditorData, UserGenerics, Viewports, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue };
package/dist/index.js CHANGED
@@ -1693,11 +1693,11 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
1693
1693
  const processedRoot = processItem(rootAsComponent, [], -1);
1694
1694
  const root = __spreadValues(__spreadValues({}, state.data.root), processedRoot);
1695
1695
  return __spreadProps(__spreadValues({}, state), {
1696
- data: {
1696
+ data: __spreadValues({
1697
1697
  root,
1698
1698
  content: processedContent,
1699
1699
  zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
1700
- },
1700
+ }, state.data.globals !== void 0 ? { globals: state.data.globals } : {}),
1701
1701
  indexes: {
1702
1702
  nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
1703
1703
  zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
@@ -1996,10 +1996,10 @@ var init_replace_root = __esm({
1996
1996
  (content) => content,
1997
1997
  (childItem) => {
1998
1998
  if (childItem.props.id === "root") {
1999
- return __spreadProps(__spreadValues({}, childItem), {
1999
+ return __spreadValues(__spreadProps(__spreadValues({}, childItem), {
2000
2000
  props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
2001
2001
  readOnly: action.root.readOnly
2002
- });
2002
+ }), action.root.synced !== void 0 ? { synced: action.root.synced } : {});
2003
2003
  }
2004
2004
  return childItem;
2005
2005
  }
@@ -5585,6 +5585,7 @@ __export(index_exports, {
5585
5585
  Drawer: () => Drawer,
5586
5586
  Editor: () => Editor4,
5587
5587
  FieldLabel: () => FieldLabel,
5588
+ GLOBAL_ROOT_KEY: () => GLOBAL_ROOT_KEY,
5588
5589
  Group: () => Group,
5589
5590
  IconButton: () => IconButton,
5590
5591
  Label: () => Label,
@@ -5665,6 +5666,7 @@ init_react_import();
5665
5666
 
5666
5667
  // types/Globals.ts
5667
5668
  init_react_import();
5669
+ var GLOBAL_ROOT_KEY = "__root";
5668
5670
 
5669
5671
  // types/Props.tsx
5670
5672
  init_react_import();
@@ -8044,6 +8046,7 @@ init_react_import();
8044
8046
 
8045
8047
  // components/App/App.tsx
8046
8048
  init_react_import();
8049
+ var import_react99 = require("react");
8047
8050
  var import_react_router3 = require("react-router");
8048
8051
 
8049
8052
  // components/Editor/index.tsx
@@ -8194,21 +8197,45 @@ var GlobalSyncButton = () => {
8194
8197
  return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
8195
8198
  }
8196
8199
  );
8197
- if (!selectedItem || !isGlobalType) return null;
8198
- const isUnlinked = selectedItem.synced === false;
8200
+ const isRootGlobal3 = useAppStore(
8201
+ (s) => {
8202
+ var _a;
8203
+ return !selectedItem && ((_a = s.config.root) == null ? void 0 : _a.global) !== false;
8204
+ }
8205
+ );
8206
+ const rootSynced = useAppStore(
8207
+ (s) => {
8208
+ var _a;
8209
+ return ((_a = s.state.data.root) == null ? void 0 : _a.synced) !== false;
8210
+ }
8211
+ );
8212
+ if (selectedItem) {
8213
+ if (!isGlobalType) return null;
8214
+ } else if (!isRootGlobal3) {
8215
+ return null;
8216
+ }
8217
+ const isUnlinked = selectedItem ? selectedItem.synced === false : !rootSynced;
8199
8218
  const onClick = () => __async(null, null, function* () {
8200
8219
  const { dispatch, state, resolveComponentData: resolveComponentData2 } = appStore.getState();
8201
- const latestSelector = getSelectorForId(state, selectedItem.props.id);
8202
- if (!latestSelector) return;
8203
- const resolved = yield resolveComponentData2(
8204
- __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
8205
- "replace"
8206
- );
8220
+ if (selectedItem) {
8221
+ const latestSelector = getSelectorForId(state, selectedItem.props.id);
8222
+ if (!latestSelector) return;
8223
+ const resolved = yield resolveComponentData2(
8224
+ __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
8225
+ "replace"
8226
+ );
8227
+ dispatch({
8228
+ type: "replace",
8229
+ destinationIndex: latestSelector.index,
8230
+ destinationZone: latestSelector.zone || rootDroppableId,
8231
+ data: resolved.node
8232
+ });
8233
+ return;
8234
+ }
8207
8235
  dispatch({
8208
- type: "replace",
8209
- destinationIndex: latestSelector.index,
8210
- destinationZone: latestSelector.zone || rootDroppableId,
8211
- data: resolved.node
8236
+ type: "replaceRoot",
8237
+ root: __spreadProps(__spreadValues({}, state.data.root), { synced: isUnlinked ? true : false }),
8238
+ recordHistory: true
8212
8239
  });
8213
8240
  });
8214
8241
  const syncButtonClass = [
@@ -9500,6 +9527,10 @@ var ContextSlotRender = ({
9500
9527
 
9501
9528
  // lib/resolve-globals.ts
9502
9529
  init_react_import();
9530
+ var isRootGlobal = (config) => {
9531
+ var _a;
9532
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
9533
+ };
9503
9534
  function resolveItem(item, globals, config, visitedTypes) {
9504
9535
  var _a, _b, _c, _d;
9505
9536
  const type = item.type;
@@ -9537,14 +9568,23 @@ function resolveItem(item, globals, config, visitedTypes) {
9537
9568
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
9538
9569
  }
9539
9570
  function resolveGlobals(data, config) {
9540
- var _a;
9571
+ var _a, _b, _c, _d;
9541
9572
  const globals = data.globals;
9542
9573
  if (!globals || Object.keys(globals).length === 0) return data;
9543
9574
  const visited = /* @__PURE__ */ new Set();
9544
9575
  const content = ((_a = data.content) != null ? _a : []).map(
9545
9576
  (item) => resolveItem(item, globals, config, visited)
9546
9577
  );
9547
- return __spreadProps(__spreadValues({}, data), { content });
9578
+ const rootGlobal = globals[GLOBAL_ROOT_KEY];
9579
+ const rootSynced = ((_b = data.root) == null ? void 0 : _b.synced) !== false;
9580
+ let nextRoot = data.root;
9581
+ if (isRootGlobal(config) && rootSynced && rootGlobal) {
9582
+ const currentProps = (_d = (_c = data.root) == null ? void 0 : _c.props) != null ? _d : {};
9583
+ nextRoot = __spreadProps(__spreadValues({}, data.root), {
9584
+ props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
9585
+ });
9586
+ }
9587
+ return __spreadProps(__spreadValues({}, data), { root: nextRoot, content });
9548
9588
  }
9549
9589
 
9550
9590
  // components/Render/index.tsx
@@ -13055,8 +13095,12 @@ init_populate_ids();
13055
13095
 
13056
13096
  // lib/split-global-data.ts
13057
13097
  init_react_import();
13098
+ var isRootGlobal2 = (config) => {
13099
+ var _a;
13100
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
13101
+ };
13058
13102
  function splitGlobals(data, config) {
13059
- var _a, _b;
13103
+ var _a, _b, _c, _d;
13060
13104
  const extracted = __spreadValues({}, (_a = data.globals) != null ? _a : {});
13061
13105
  function visit(node) {
13062
13106
  var _a2, _b2;
@@ -13078,7 +13122,7 @@ function splitGlobals(data, config) {
13078
13122
  if (!isGlobalType || !node.synced) {
13079
13123
  return __spreadProps(__spreadValues({}, node), { props: processedProps });
13080
13124
  }
13081
- const _c = processedProps, { children, id } = _c, sharedProps = __objRest(_c, ["children", "id"]);
13125
+ const _c2 = processedProps, { children, id } = _c2, sharedProps = __objRest(_c2, ["children", "id"]);
13082
13126
  extracted[type] = { props: sharedProps };
13083
13127
  const instanceProps = { id };
13084
13128
  if (children !== void 0) instanceProps.children = children;
@@ -13090,7 +13134,19 @@ function splitGlobals(data, config) {
13090
13134
  const strippedContent = ((_b = data.content) != null ? _b : []).map(
13091
13135
  (item) => visit(item)
13092
13136
  );
13137
+ let nextRoot = data.root;
13138
+ const rootSynced = ((_c = data.root) == null ? void 0 : _c.synced) !== false;
13139
+ if (isRootGlobal2(config) && rootSynced && data.root) {
13140
+ const currentProps = (_d = data.root.props) != null ? _d : {};
13141
+ const _e = currentProps, { children, id } = _e, sharedRootProps = __objRest(_e, ["children", "id"]);
13142
+ extracted[GLOBAL_ROOT_KEY] = { props: sharedRootProps };
13143
+ const instanceProps = {};
13144
+ if (id !== void 0) instanceProps.id = id;
13145
+ if (children !== void 0) instanceProps.children = children;
13146
+ nextRoot = __spreadProps(__spreadValues({}, data.root), { props: instanceProps });
13147
+ }
13093
13148
  return __spreadProps(__spreadValues({}, data), {
13149
+ root: nextRoot,
13094
13150
  content: strippedContent,
13095
13151
  globals: extracted
13096
13152
  });
@@ -13463,6 +13519,8 @@ var UrlBar = () => {
13463
13519
  inputValue,
13464
13520
  onInputValueChange: (next) => setInputValue(next),
13465
13521
  autoHighlight: false,
13522
+ openOnInputClick: true,
13523
+ filter: null,
13466
13524
  children: [
13467
13525
  /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
13468
13526
  "form",
@@ -15025,11 +15083,19 @@ var useApp = () => {
15025
15083
  const next = isEditing && cfg.editorPath ? `${cfg.editorPath}${target === "/" ? "" : target}` || "/" : target;
15026
15084
  rrNavigate(next || "/");
15027
15085
  };
15086
+ const resolvePageData = (pageData) => {
15087
+ var _a;
15088
+ if (!cfg.globals || Object.keys(cfg.globals).length === 0) return pageData;
15089
+ return __spreadProps(__spreadValues({}, pageData), {
15090
+ globals: __spreadValues(__spreadValues({}, (_a = pageData.globals) != null ? _a : {}), cfg.globals)
15091
+ });
15092
+ };
15028
15093
  return __spreadProps(__spreadValues({}, cfg), {
15029
15094
  routes,
15030
15095
  isEditing,
15031
15096
  route,
15032
- navigate
15097
+ navigate,
15098
+ resolvePageData
15033
15099
  });
15034
15100
  };
15035
15101
 
@@ -15037,6 +15103,19 @@ var useApp = () => {
15037
15103
  var import_jsx_runtime93 = require("react/jsx-runtime");
15038
15104
  var EDITOR_PATH = "/editor";
15039
15105
  var isServer = typeof window === "undefined";
15106
+ var seedGlobalsFromPages = (pages) => {
15107
+ const merged = {};
15108
+ for (const page of Object.values(pages)) {
15109
+ const pageGlobals = page.globals;
15110
+ if (!pageGlobals) continue;
15111
+ for (const [key, entry] of Object.entries(pageGlobals)) {
15112
+ if (entry && entry.props) {
15113
+ merged[key] = entry;
15114
+ }
15115
+ }
15116
+ }
15117
+ return merged;
15118
+ };
15040
15119
  function AppProvider({
15041
15120
  config,
15042
15121
  pages,
@@ -15046,14 +15125,22 @@ function AppProvider({
15046
15125
  children
15047
15126
  }) {
15048
15127
  const stablePages = useStableValue(pages);
15128
+ const [globals, setGlobals] = (0, import_react98.useState)(
15129
+ () => seedGlobalsFromPages(stablePages)
15130
+ );
15131
+ const updateGlobals = (0, import_react98.useCallback)((next) => {
15132
+ setGlobals(next);
15133
+ }, []);
15049
15134
  const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
15050
15135
  const ctxValue = (0, import_react98.useMemo)(
15051
15136
  () => ({
15052
15137
  config,
15053
15138
  pages: stablePages,
15054
- editorPath: resolvedEditorPath
15139
+ editorPath: resolvedEditorPath,
15140
+ globals,
15141
+ setGlobals: updateGlobals
15055
15142
  }),
15056
- [config, stablePages, resolvedEditorPath]
15143
+ [config, stablePages, resolvedEditorPath, globals, updateGlobals]
15057
15144
  );
15058
15145
  const inner = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(appConfigContext.Provider, { value: ctxValue, children });
15059
15146
  if (isServer) {
@@ -15094,14 +15181,14 @@ function RenderForKey({
15094
15181
  routeKey,
15095
15182
  metadata
15096
15183
  }) {
15097
- const { config, pages } = useApp();
15184
+ const { config, pages, resolvePageData } = useApp();
15098
15185
  const data = pages[routeKey];
15099
15186
  if (!data) return null;
15100
15187
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
15101
15188
  Render,
15102
15189
  {
15103
15190
  config,
15104
- data,
15191
+ data: resolvePageData(data),
15105
15192
  metadata
15106
15193
  },
15107
15194
  routeKey
@@ -15112,9 +15199,27 @@ function EditorForKey({
15112
15199
  editorProps,
15113
15200
  children
15114
15201
  }) {
15115
- const { config, pages, routes, navigate, route } = useApp();
15116
- const data = pages[routeKey];
15117
- if (!data) return null;
15202
+ const {
15203
+ config,
15204
+ pages,
15205
+ routes,
15206
+ navigate,
15207
+ route,
15208
+ resolvePageData,
15209
+ setGlobals
15210
+ } = useApp();
15211
+ const rawData = pages[routeKey];
15212
+ const hostOnChange = editorProps.onChange;
15213
+ const handleChange = (0, import_react99.useCallback)(
15214
+ (next) => {
15215
+ const nextGlobals = next.globals;
15216
+ if (nextGlobals) setGlobals(nextGlobals);
15217
+ hostOnChange == null ? void 0 : hostOnChange(next);
15218
+ },
15219
+ [hostOnChange, setGlobals]
15220
+ );
15221
+ if (!rawData) return null;
15222
+ const data = resolvePageData(rawData);
15118
15223
  const editorRoute = {
15119
15224
  key: routeKey,
15120
15225
  path: (route == null ? void 0 : route.key) === routeKey ? route.path : routeKey,
@@ -15133,7 +15238,7 @@ function EditorForKey({
15133
15238
  iframe: editorProps.iframe,
15134
15239
  viewports: editorProps.viewports,
15135
15240
  permissions: editorProps.permissions,
15136
- onChange: editorProps.onChange,
15241
+ onChange: handleChange,
15137
15242
  onPublish: editorProps.onPublish,
15138
15243
  onAction: editorProps.onAction,
15139
15244
  renderHeader: editorProps.renderHeader,
@@ -15622,6 +15727,7 @@ var legacySideBarPlugin = () => ({
15622
15727
  Drawer,
15623
15728
  Editor,
15624
15729
  FieldLabel,
15730
+ GLOBAL_ROOT_KEY,
15625
15731
  Group,
15626
15732
  IconButton,
15627
15733
  Label,
package/dist/index.mjs CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  Drawer,
8
8
  Editor,
9
9
  FieldLabel,
10
+ GLOBAL_ROOT_KEY,
10
11
  Render,
11
12
  appConfigContext,
12
13
  blocksPlugin,
@@ -25,8 +26,8 @@ import {
25
26
  usePropsContext,
26
27
  useRouteParams,
27
28
  useStableValue
28
- } from "./chunk-HWYAMQID.mjs";
29
- import "./chunk-BORTMJJZ.mjs";
29
+ } from "./chunk-UOKINS3M.mjs";
30
+ import "./chunk-UEPLVAME.mjs";
30
31
  import {
31
32
  Action,
32
33
  ActionBar,
@@ -35,25 +36,25 @@ import {
35
36
  Label,
36
37
  RichTextMenu,
37
38
  Separator
38
- } from "./chunk-MVJENRGK.mjs";
39
- import "./chunk-M36T7BWB.mjs";
39
+ } from "./chunk-XREK5QOM.mjs";
40
+ import "./chunk-HIOPRNZ4.mjs";
40
41
  import {
41
42
  getRouteProps,
42
43
  migrate,
43
44
  resolveAllData,
44
45
  resolveRouteFromString,
45
46
  transformProps
46
- } from "./chunk-AD67LVXW.mjs";
47
+ } from "./chunk-U52CF6C5.mjs";
47
48
  import "./chunk-6QJ2HF4O.mjs";
48
- import "./chunk-PGSQPCM6.mjs";
49
- import "./chunk-DKFLK64M.mjs";
50
- import "./chunk-MUBFR675.mjs";
51
- import "./chunk-M4JDRFYB.mjs";
52
- import "./chunk-FTVOCMGV.mjs";
49
+ import "./chunk-R344I62Q.mjs";
50
+ import "./chunk-ANWIFBRQ.mjs";
51
+ import "./chunk-QGW2O2TN.mjs";
52
+ import "./chunk-BFLF77R7.mjs";
53
+ import "./chunk-MGEDZ4MA.mjs";
53
54
  import "./chunk-DQU3HIP4.mjs";
54
55
  import {
55
56
  walkTree
56
- } from "./chunk-JIXMPJZA.mjs";
57
+ } from "./chunk-SQ66YE7L.mjs";
57
58
  import {
58
59
  init_react_import
59
60
  } from "./chunk-M6W7YEVX.mjs";
@@ -71,6 +72,7 @@ export {
71
72
  Drawer,
72
73
  Editor,
73
74
  FieldLabel,
75
+ GLOBAL_ROOT_KEY,
74
76
  Group,
75
77
  IconButton,
76
78
  Label,
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-BxLinRKD.mjs';
3
- import { A as AppStore } from './index-DET4zR84.mjs';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-D_rLbpVe.mjs';
3
+ import { A as AppStore } from './index-ByKXq8j5.mjs';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
@@ -1,6 +1,6 @@
1
1
  import { Reducer } from 'react';
2
- import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-BxLinRKD.js';
3
- import { A as AppStore } from './index-YRgZBGas.js';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-D_rLbpVe.js';
3
+ import { A as AppStore } from './index-jLN0kzKZ.js';
4
4
  import '@tiptap/react';
5
5
  import '@tiptap/extension-blockquote';
6
6
  import '@tiptap/extension-bold';
package/dist/internal.js CHANGED
@@ -389,11 +389,11 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
389
389
  const processedRoot = processItem(rootAsComponent, [], -1);
390
390
  const root = __spreadValues(__spreadValues({}, state.data.root), processedRoot);
391
391
  return __spreadProps(__spreadValues({}, state), {
392
- data: {
392
+ data: __spreadValues({
393
393
  root,
394
394
  content: processedContent,
395
395
  zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
396
- },
396
+ }, state.data.globals !== void 0 ? { globals: state.data.globals } : {}),
397
397
  indexes: {
398
398
  nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
399
399
  zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
@@ -608,10 +608,10 @@ var replaceRootAction = (state, action, appStore) => {
608
608
  (content) => content,
609
609
  (childItem) => {
610
610
  if (childItem.props.id === "root") {
611
- return __spreadProps(__spreadValues({}, childItem), {
611
+ return __spreadValues(__spreadProps(__spreadValues({}, childItem), {
612
612
  props: __spreadValues(__spreadValues({}, childItem.props), action.root.props),
613
613
  readOnly: action.root.readOnly
614
- });
614
+ }), action.root.synced !== void 0 ? { synced: action.root.synced } : {});
615
615
  }
616
616
  return childItem;
617
617
  }
package/dist/internal.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createReducer
3
- } from "./chunk-M4JDRFYB.mjs";
4
- import "./chunk-JIXMPJZA.mjs";
3
+ } from "./chunk-BFLF77R7.mjs";
4
+ import "./chunk-SQ66YE7L.mjs";
5
5
  import {
6
6
  init_react_import
7
7
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useHeadingOptions
3
- } from "./chunk-DKFLK64M.mjs";
3
+ } from "./chunk-ANWIFBRQ.mjs";
4
4
  import {
5
5
  Heading,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-MUBFR675.mjs";
9
- import "./chunk-M4JDRFYB.mjs";
10
- import "./chunk-FTVOCMGV.mjs";
8
+ } from "./chunk-QGW2O2TN.mjs";
9
+ import "./chunk-BFLF77R7.mjs";
10
+ import "./chunk-MGEDZ4MA.mjs";
11
11
  import "./chunk-DQU3HIP4.mjs";
12
- import "./chunk-JIXMPJZA.mjs";
12
+ import "./chunk-SQ66YE7L.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useAlignOptions
3
- } from "./chunk-PGSQPCM6.mjs";
3
+ } from "./chunk-R344I62Q.mjs";
4
4
  import {
5
5
  AlignLeft,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-MUBFR675.mjs";
9
- import "./chunk-M4JDRFYB.mjs";
10
- import "./chunk-FTVOCMGV.mjs";
8
+ } from "./chunk-QGW2O2TN.mjs";
9
+ import "./chunk-BFLF77R7.mjs";
10
+ import "./chunk-MGEDZ4MA.mjs";
11
11
  import "./chunk-DQU3HIP4.mjs";
12
- import "./chunk-JIXMPJZA.mjs";
12
+ import "./chunk-SQ66YE7L.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  useListOptions
3
- } from "./chunk-M36T7BWB.mjs";
3
+ } from "./chunk-HIOPRNZ4.mjs";
4
4
  import {
5
5
  List,
6
6
  SelectControl,
7
7
  useControlContext
8
- } from "./chunk-MUBFR675.mjs";
9
- import "./chunk-M4JDRFYB.mjs";
10
- import "./chunk-FTVOCMGV.mjs";
8
+ } from "./chunk-QGW2O2TN.mjs";
9
+ import "./chunk-BFLF77R7.mjs";
10
+ import "./chunk-MGEDZ4MA.mjs";
11
11
  import "./chunk-DQU3HIP4.mjs";
12
- import "./chunk-JIXMPJZA.mjs";
12
+ import "./chunk-SQ66YE7L.mjs";
13
13
  import {
14
14
  init_react_import
15
15
  } from "./chunk-M6W7YEVX.mjs";