@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
@@ -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-BxpNoF2q.js';
3
+ import { A as AppStore } from './index-XnBvIAmy.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";
@@ -3142,13 +3142,14 @@ body:has(._DropZone--isAnimating_1h108_70:empty) [data-editor-overlay] {
3142
3142
  }
3143
3143
 
3144
3144
  /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css/#css-module-data */
3145
- ._FieldsPlugin_262zt_1 {
3146
- background: white;
3145
+ ._FieldsPlugin_11j3y_1 {
3146
+ background: var(--editor-surface-panel);
3147
3147
  height: 100%;
3148
3148
  overflow-y: auto;
3149
3149
  }
3150
- ._FieldsPlugin-header_262zt_7 {
3151
- border-bottom: 1px solid var(--editor-color-grey-09);
3150
+ ._FieldsPlugin-header_11j3y_7 {
3151
+ border-bottom: 1px solid var(--editor-border-subtle);
3152
+ color: var(--editor-text-primary);
3152
3153
  font-weight: 600;
3153
3154
  padding-bottom: 8px;
3154
3155
  padding-left: 16px;
@@ -3156,7 +3157,7 @@ body:has(._DropZone--isAnimating_1h108_70:empty) [data-editor-overlay] {
3156
3157
  padding-top: 8px;
3157
3158
  }
3158
3159
  @media (min-width: 638px) {
3159
- ._FieldsPlugin-header_262zt_7 {
3160
+ ._FieldsPlugin-header_11j3y_7 {
3160
3161
  padding: 16px;
3161
3162
  }
3162
3163
  }
@@ -1,7 +1,7 @@
1
- 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, b as ComponentData, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, C as Config, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, D as Data, l as DefaultComponentProps, k as DefaultComponents, m as DefaultRootFieldProps, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, E as EditorAction, q as EditorChromeConfig, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, o as Field, a7 as FieldMetadata, p as FieldProps, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, h as FieldTransforms, F as Fields, H as History, I as IframeConfig, r as InitialHistory, ab as ItemWithId, ac as MappedItem, M as Metadata, ad as NumberField, ae as ObjectField, O as OnAction, af as OverrideKey, e as Overrides, a as Permissions, d as Plugin, ag as RadioField, c as ResolveDataTrigger, 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, f as UiState, U as UserGenerics, aq as Viewport, V as Viewports, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxLinRKD.mjs';
2
- export { Action, ActionBar, App, AppContextValue, AppEditorProps, AppProps, AppProvider, AppProviderProps, AppRenderProps, AppRoute, AppRouterVariant, AutoField, Button, ComponentList, Drawer, Editor, EditorApi, EditorCommands, FieldLabel, GlobalsMap, Group, IconButton, InsertComponentArgs, Label, MoveDestination, PageMetadata, Parent, Render, RichTextMenu, Route, RouteKey, Separator, UseEditorData, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue } from './index.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
- export { E as EditorRoute, O as OnPublish } from './index-DET4zR84.mjs';
1
+ 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, b as ComponentData, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, C as Config, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, D as Data, l as DefaultComponentProps, k as DefaultComponents, m as DefaultRootFieldProps, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, E as EditorAction, q as EditorChromeConfig, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, o as Field, a7 as FieldMetadata, p as FieldProps, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, h as FieldTransforms, F as Fields, H as History, I as IframeConfig, r as InitialHistory, ab as ItemWithId, ac as MappedItem, M as Metadata, ad as NumberField, ae as ObjectField, O as OnAction, af as OverrideKey, e as Overrides, a as Permissions, d as Plugin, ag as RadioField, c as ResolveDataTrigger, 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, f as UiState, U as UserGenerics, aq as Viewport, V as Viewports, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxpNoF2q.mjs';
2
+ export { Action, ActionBar, App, AppContextValue, AppEditorProps, AppProps, AppProvider, AppProviderProps, AppRenderProps, AppRoute, AppRouterVariant, AutoField, Button, ComponentList, Drawer, Editor, EditorApi, EditorCommands, FieldLabel, GLOBAL_ROOT_KEY, GlobalsMap, Group, IconButton, InsertComponentArgs, LEGACY_GLOBAL_ROOT_KEY, Label, MoveDestination, PageMetadata, Parent, Render, RichTextMenu, Route, RouteKey, Separator, UseEditorData, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue } from './index.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-uv_FsXcr.mjs';
4
+ export { E as EditorRoute, O as OnPublish } from './index-YjPj7lv4.mjs';
5
5
  import 'react';
6
6
  import '@tiptap/react';
7
7
  import '@tiptap/extension-blockquote';
@@ -1,7 +1,7 @@
1
- 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, b as ComponentData, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, C as Config, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, D as Data, l as DefaultComponentProps, k as DefaultComponents, m as DefaultRootFieldProps, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, E as EditorAction, q as EditorChromeConfig, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, o as Field, a7 as FieldMetadata, p as FieldProps, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, h as FieldTransforms, F as Fields, H as History, I as IframeConfig, r as InitialHistory, ab as ItemWithId, ac as MappedItem, M as Metadata, ad as NumberField, ae as ObjectField, O as OnAction, af as OverrideKey, e as Overrides, a as Permissions, d as Plugin, ag as RadioField, c as ResolveDataTrigger, 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, f as UiState, U as UserGenerics, aq as Viewport, V as Viewports, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxLinRKD.js';
2
- export { Action, ActionBar, App, AppContextValue, AppEditorProps, AppProps, AppProvider, AppProviderProps, AppRenderProps, AppRoute, AppRouterVariant, AutoField, Button, ComponentList, Drawer, Editor, EditorApi, EditorCommands, FieldLabel, GlobalsMap, Group, IconButton, InsertComponentArgs, Label, MoveDestination, PageMetadata, Parent, Render, RichTextMenu, Route, RouteKey, Separator, UseEditorData, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue } from './index.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
- export { E as EditorRoute, O as OnPublish } from './index-YRgZBGas.js';
1
+ 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, b as ComponentData, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, C as Config, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, D as Data, l as DefaultComponentProps, k as DefaultComponents, m as DefaultRootFieldProps, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, E as EditorAction, q as EditorChromeConfig, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, o as Field, a7 as FieldMetadata, p as FieldProps, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, h as FieldTransforms, F as Fields, H as History, I as IframeConfig, r as InitialHistory, ab as ItemWithId, ac as MappedItem, M as Metadata, ad as NumberField, ae as ObjectField, O as OnAction, af as OverrideKey, e as Overrides, a as Permissions, d as Plugin, ag as RadioField, c as ResolveDataTrigger, 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, f as UiState, U as UserGenerics, aq as Viewport, V as Viewports, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxpNoF2q.js';
2
+ export { Action, ActionBar, App, AppContextValue, AppEditorProps, AppProps, AppProvider, AppProviderProps, AppRenderProps, AppRoute, AppRouterVariant, AutoField, Button, ComponentList, Drawer, Editor, EditorApi, EditorCommands, FieldLabel, GLOBAL_ROOT_KEY, GlobalsMap, Group, IconButton, InsertComponentArgs, LEGACY_GLOBAL_ROOT_KEY, Label, MoveDestination, PageMetadata, Parent, Render, RichTextMenu, Route, RouteKey, Separator, UseEditorData, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue } from './index.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-BfVJmXEX.js';
4
+ export { E as EditorRoute, O as OnPublish } from './index-XnBvIAmy.js';
5
5
  import 'react';
6
6
  import '@tiptap/react';
7
7
  import '@tiptap/extension-blockquote';
@@ -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,8 +5585,10 @@ __export(no_external_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,
5591
+ LEGACY_GLOBAL_ROOT_KEY: () => LEGACY_GLOBAL_ROOT_KEY,
5590
5592
  Label: () => Label,
5591
5593
  Render: () => Render,
5592
5594
  RichTextMenu: () => RichTextMenu,
@@ -5665,6 +5667,8 @@ init_react_import();
5665
5667
 
5666
5668
  // types/Globals.ts
5667
5669
  init_react_import();
5670
+ var GLOBAL_ROOT_KEY = "root";
5671
+ var LEGACY_GLOBAL_ROOT_KEY = "__root";
5668
5672
 
5669
5673
  // types/Props.tsx
5670
5674
  init_react_import();
@@ -8044,6 +8048,7 @@ init_react_import();
8044
8048
 
8045
8049
  // components/App/App.tsx
8046
8050
  init_react_import();
8051
+ var import_react99 = require("react");
8047
8052
  var import_react_router3 = require("react-router");
8048
8053
 
8049
8054
  // components/Editor/index.tsx
@@ -8194,21 +8199,45 @@ var GlobalSyncButton = () => {
8194
8199
  return selectedItem ? ((_a = s.config.components[selectedItem.type]) == null ? void 0 : _a.global) === true : false;
8195
8200
  }
8196
8201
  );
8197
- if (!selectedItem || !isGlobalType) return null;
8198
- const isUnlinked = selectedItem.synced === false;
8202
+ const isRootGlobal3 = useAppStore(
8203
+ (s) => {
8204
+ var _a;
8205
+ return !selectedItem && ((_a = s.config.root) == null ? void 0 : _a.global) !== false;
8206
+ }
8207
+ );
8208
+ const rootSynced = useAppStore(
8209
+ (s) => {
8210
+ var _a;
8211
+ return ((_a = s.state.data.root) == null ? void 0 : _a.synced) !== false;
8212
+ }
8213
+ );
8214
+ if (selectedItem) {
8215
+ if (!isGlobalType) return null;
8216
+ } else if (!isRootGlobal3) {
8217
+ return null;
8218
+ }
8219
+ const isUnlinked = selectedItem ? selectedItem.synced === false : !rootSynced;
8199
8220
  const onClick = () => __async(null, null, function* () {
8200
8221
  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
- );
8222
+ if (selectedItem) {
8223
+ const latestSelector = getSelectorForId(state, selectedItem.props.id);
8224
+ if (!latestSelector) return;
8225
+ const resolved = yield resolveComponentData2(
8226
+ __spreadProps(__spreadValues({}, selectedItem), { synced: isUnlinked ? true : false }),
8227
+ "replace"
8228
+ );
8229
+ dispatch({
8230
+ type: "replace",
8231
+ destinationIndex: latestSelector.index,
8232
+ destinationZone: latestSelector.zone || rootDroppableId,
8233
+ data: resolved.node
8234
+ });
8235
+ return;
8236
+ }
8207
8237
  dispatch({
8208
- type: "replace",
8209
- destinationIndex: latestSelector.index,
8210
- destinationZone: latestSelector.zone || rootDroppableId,
8211
- data: resolved.node
8238
+ type: "replaceRoot",
8239
+ root: __spreadProps(__spreadValues({}, state.data.root), { synced: isUnlinked ? true : false }),
8240
+ recordHistory: true
8212
8241
  });
8213
8242
  });
8214
8243
  const syncButtonClass = [
@@ -9500,6 +9529,10 @@ var ContextSlotRender = ({
9500
9529
 
9501
9530
  // lib/resolve-globals.ts
9502
9531
  init_react_import();
9532
+ var isRootGlobal = (config) => {
9533
+ var _a;
9534
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
9535
+ };
9503
9536
  function resolveItem(item, globals, config, visitedTypes) {
9504
9537
  var _a, _b, _c, _d;
9505
9538
  const type = item.type;
@@ -9537,14 +9570,23 @@ function resolveItem(item, globals, config, visitedTypes) {
9537
9570
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
9538
9571
  }
9539
9572
  function resolveGlobals(data, config) {
9540
- var _a;
9573
+ var _a, _b, _c, _d, _e;
9541
9574
  const globals = data.globals;
9542
9575
  if (!globals || Object.keys(globals).length === 0) return data;
9543
9576
  const visited = /* @__PURE__ */ new Set();
9544
9577
  const content = ((_a = data.content) != null ? _a : []).map(
9545
9578
  (item) => resolveItem(item, globals, config, visited)
9546
9579
  );
9547
- return __spreadProps(__spreadValues({}, data), { content });
9580
+ const rootGlobal = (_b = globals[GLOBAL_ROOT_KEY]) != null ? _b : globals[LEGACY_GLOBAL_ROOT_KEY];
9581
+ const rootSynced = ((_c = data.root) == null ? void 0 : _c.synced) !== false;
9582
+ let nextRoot = data.root;
9583
+ if (isRootGlobal(config) && rootSynced && rootGlobal) {
9584
+ const currentProps = (_e = (_d = data.root) == null ? void 0 : _d.props) != null ? _e : {};
9585
+ nextRoot = __spreadProps(__spreadValues({}, data.root), {
9586
+ props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
9587
+ });
9588
+ }
9589
+ return __spreadProps(__spreadValues({}, data), { root: nextRoot, content });
9548
9590
  }
9549
9591
 
9550
9592
  // components/Render/index.tsx
@@ -13055,9 +13097,16 @@ init_populate_ids();
13055
13097
 
13056
13098
  // lib/split-global-data.ts
13057
13099
  init_react_import();
13100
+ var isRootGlobal2 = (config) => {
13101
+ var _a;
13102
+ return ((_a = config.root) == null ? void 0 : _a.global) !== false;
13103
+ };
13058
13104
  function splitGlobals(data, config) {
13059
- var _a, _b;
13105
+ var _a, _b, _c, _d;
13060
13106
  const extracted = __spreadValues({}, (_a = data.globals) != null ? _a : {});
13107
+ if (LEGACY_GLOBAL_ROOT_KEY in extracted) {
13108
+ delete extracted[LEGACY_GLOBAL_ROOT_KEY];
13109
+ }
13061
13110
  function visit(node) {
13062
13111
  var _a2, _b2;
13063
13112
  const type = node.type;
@@ -13078,7 +13127,7 @@ function splitGlobals(data, config) {
13078
13127
  if (!isGlobalType || !node.synced) {
13079
13128
  return __spreadProps(__spreadValues({}, node), { props: processedProps });
13080
13129
  }
13081
- const _c = processedProps, { children, id } = _c, sharedProps = __objRest(_c, ["children", "id"]);
13130
+ const _c2 = processedProps, { children, id } = _c2, sharedProps = __objRest(_c2, ["children", "id"]);
13082
13131
  extracted[type] = { props: sharedProps };
13083
13132
  const instanceProps = { id };
13084
13133
  if (children !== void 0) instanceProps.children = children;
@@ -13090,7 +13139,19 @@ function splitGlobals(data, config) {
13090
13139
  const strippedContent = ((_b = data.content) != null ? _b : []).map(
13091
13140
  (item) => visit(item)
13092
13141
  );
13142
+ let nextRoot = data.root;
13143
+ const rootSynced = ((_c = data.root) == null ? void 0 : _c.synced) !== false;
13144
+ if (isRootGlobal2(config) && rootSynced && data.root) {
13145
+ const currentProps = (_d = data.root.props) != null ? _d : {};
13146
+ const _e = currentProps, { children, id } = _e, sharedRootProps = __objRest(_e, ["children", "id"]);
13147
+ extracted[GLOBAL_ROOT_KEY] = { props: sharedRootProps };
13148
+ const instanceProps = {};
13149
+ if (id !== void 0) instanceProps.id = id;
13150
+ if (children !== void 0) instanceProps.children = children;
13151
+ nextRoot = __spreadProps(__spreadValues({}, data.root), { props: instanceProps });
13152
+ }
13093
13153
  return __spreadProps(__spreadValues({}, data), {
13154
+ root: nextRoot,
13094
13155
  content: strippedContent,
13095
13156
  globals: extracted
13096
13157
  });
@@ -13463,6 +13524,8 @@ var UrlBar = () => {
13463
13524
  inputValue,
13464
13525
  onInputValueChange: (next) => setInputValue(next),
13465
13526
  autoHighlight: false,
13527
+ openOnInputClick: true,
13528
+ filter: null,
13466
13529
  children: [
13467
13530
  /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
13468
13531
  "form",
@@ -14255,7 +14318,7 @@ init_store();
14255
14318
 
14256
14319
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
14257
14320
  init_react_import();
14258
- var styles_module_default34 = { "FieldsPlugin": "_FieldsPlugin_262zt_1", "FieldsPlugin-header": "_FieldsPlugin-header_262zt_7" };
14321
+ var styles_module_default34 = { "FieldsPlugin": "_FieldsPlugin_11j3y_1", "FieldsPlugin-header": "_FieldsPlugin-header_11j3y_7" };
14259
14322
 
14260
14323
  // plugins/fields/index.tsx
14261
14324
  init_lib();
@@ -15025,11 +15088,19 @@ var useApp = () => {
15025
15088
  const next = isEditing && cfg.editorPath ? `${cfg.editorPath}${target === "/" ? "" : target}` || "/" : target;
15026
15089
  rrNavigate(next || "/");
15027
15090
  };
15091
+ const resolvePageData = (pageData) => {
15092
+ var _a;
15093
+ if (!cfg.globals || Object.keys(cfg.globals).length === 0) return pageData;
15094
+ return __spreadProps(__spreadValues({}, pageData), {
15095
+ globals: __spreadValues(__spreadValues({}, (_a = pageData.globals) != null ? _a : {}), cfg.globals)
15096
+ });
15097
+ };
15028
15098
  return __spreadProps(__spreadValues({}, cfg), {
15029
15099
  routes,
15030
15100
  isEditing,
15031
15101
  route,
15032
- navigate
15102
+ navigate,
15103
+ resolvePageData
15033
15104
  });
15034
15105
  };
15035
15106
 
@@ -15037,6 +15108,24 @@ var useApp = () => {
15037
15108
  var import_jsx_runtime93 = require("react/jsx-runtime");
15038
15109
  var EDITOR_PATH = "/editor";
15039
15110
  var isServer = typeof window === "undefined";
15111
+ var normalizeEditorPath = (path) => {
15112
+ if (!path || path === "/") return EDITOR_PATH;
15113
+ const withLeading = path.startsWith("/") ? path : `/${path}`;
15114
+ return withLeading.length > 1 && withLeading.endsWith("/") ? withLeading.slice(0, -1) : withLeading;
15115
+ };
15116
+ var seedGlobalsFromPages = (pages) => {
15117
+ const merged = {};
15118
+ for (const page of Object.values(pages)) {
15119
+ const pageGlobals = page.globals;
15120
+ if (!pageGlobals) continue;
15121
+ for (const [key, entry] of Object.entries(pageGlobals)) {
15122
+ if (entry && entry.props) {
15123
+ merged[key] = entry;
15124
+ }
15125
+ }
15126
+ }
15127
+ return merged;
15128
+ };
15040
15129
  function AppProvider({
15041
15130
  config,
15042
15131
  pages,
@@ -15045,15 +15134,28 @@ function AppProvider({
15045
15134
  currentPath,
15046
15135
  children
15047
15136
  }) {
15137
+ if (!pages || typeof pages !== "object") {
15138
+ throw new Error(
15139
+ "<App> requires a `pages` prop (a map of route \u2192 data). For a single-page setup with no routing, use <Editor> directly instead."
15140
+ );
15141
+ }
15048
15142
  const stablePages = useStableValue(pages);
15049
- const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
15143
+ const [globals, setGlobals] = (0, import_react98.useState)(
15144
+ () => seedGlobalsFromPages(stablePages)
15145
+ );
15146
+ const updateGlobals = (0, import_react98.useCallback)((next) => {
15147
+ setGlobals(next);
15148
+ }, []);
15149
+ const resolvedEditorPath = editorPath === null ? null : normalizeEditorPath(editorPath != null ? editorPath : EDITOR_PATH);
15050
15150
  const ctxValue = (0, import_react98.useMemo)(
15051
15151
  () => ({
15052
15152
  config,
15053
15153
  pages: stablePages,
15054
- editorPath: resolvedEditorPath
15154
+ editorPath: resolvedEditorPath,
15155
+ globals,
15156
+ setGlobals: updateGlobals
15055
15157
  }),
15056
- [config, stablePages, resolvedEditorPath]
15158
+ [config, stablePages, resolvedEditorPath, globals, updateGlobals]
15057
15159
  );
15058
15160
  const inner = /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(appConfigContext.Provider, { value: ctxValue, children });
15059
15161
  if (isServer) {
@@ -15094,14 +15196,14 @@ function RenderForKey({
15094
15196
  routeKey,
15095
15197
  metadata
15096
15198
  }) {
15097
- const { config, pages } = useApp();
15199
+ const { config, pages, resolvePageData } = useApp();
15098
15200
  const data = pages[routeKey];
15099
15201
  if (!data) return null;
15100
15202
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
15101
15203
  Render,
15102
15204
  {
15103
15205
  config,
15104
- data,
15206
+ data: resolvePageData(data),
15105
15207
  metadata
15106
15208
  },
15107
15209
  routeKey
@@ -15112,9 +15214,27 @@ function EditorForKey({
15112
15214
  editorProps,
15113
15215
  children
15114
15216
  }) {
15115
- const { config, pages, routes, navigate, route } = useApp();
15116
- const data = pages[routeKey];
15117
- if (!data) return null;
15217
+ const {
15218
+ config,
15219
+ pages,
15220
+ routes,
15221
+ navigate,
15222
+ route,
15223
+ resolvePageData,
15224
+ setGlobals
15225
+ } = useApp();
15226
+ const rawData = pages[routeKey];
15227
+ const hostOnChange = editorProps.onChange;
15228
+ const handleChange = (0, import_react99.useCallback)(
15229
+ (next) => {
15230
+ const nextGlobals = next.globals;
15231
+ if (nextGlobals) setGlobals(nextGlobals);
15232
+ hostOnChange == null ? void 0 : hostOnChange(next);
15233
+ },
15234
+ [hostOnChange, setGlobals]
15235
+ );
15236
+ if (!rawData) return null;
15237
+ const data = resolvePageData(rawData);
15118
15238
  const editorRoute = {
15119
15239
  key: routeKey,
15120
15240
  path: (route == null ? void 0 : route.key) === routeKey ? route.path : routeKey,
@@ -15133,7 +15253,7 @@ function EditorForKey({
15133
15253
  iframe: editorProps.iframe,
15134
15254
  viewports: editorProps.viewports,
15135
15255
  permissions: editorProps.permissions,
15136
- onChange: editorProps.onChange,
15256
+ onChange: handleChange,
15137
15257
  onPublish: editorProps.onPublish,
15138
15258
  onAction: editorProps.onAction,
15139
15259
  renderHeader: editorProps.renderHeader,
@@ -15622,8 +15742,10 @@ var legacySideBarPlugin = () => ({
15622
15742
  Drawer,
15623
15743
  Editor,
15624
15744
  FieldLabel,
15745
+ GLOBAL_ROOT_KEY,
15625
15746
  Group,
15626
15747
  IconButton,
15748
+ LEGACY_GLOBAL_ROOT_KEY,
15627
15749
  Label,
15628
15750
  Render,
15629
15751
  RichTextMenu,
@@ -7,6 +7,8 @@ import {
7
7
  Drawer,
8
8
  Editor,
9
9
  FieldLabel,
10
+ GLOBAL_ROOT_KEY,
11
+ LEGACY_GLOBAL_ROOT_KEY,
10
12
  Render,
11
13
  appConfigContext,
12
14
  blocksPlugin,
@@ -25,8 +27,8 @@ import {
25
27
  usePropsContext,
26
28
  useRouteParams,
27
29
  useStableValue
28
- } from "./chunk-HWYAMQID.mjs";
29
- import "./chunk-BORTMJJZ.mjs";
30
+ } from "./chunk-5WTMEYPV.mjs";
31
+ import "./chunk-UEPLVAME.mjs";
30
32
  import {
31
33
  Action,
32
34
  ActionBar,
@@ -35,25 +37,25 @@ import {
35
37
  Label,
36
38
  RichTextMenu,
37
39
  Separator
38
- } from "./chunk-MVJENRGK.mjs";
39
- import "./chunk-M36T7BWB.mjs";
40
+ } from "./chunk-XREK5QOM.mjs";
41
+ import "./chunk-HIOPRNZ4.mjs";
40
42
  import {
41
43
  getRouteProps,
42
44
  migrate,
43
45
  resolveAllData,
44
46
  resolveRouteFromString,
45
47
  transformProps
46
- } from "./chunk-AD67LVXW.mjs";
48
+ } from "./chunk-U52CF6C5.mjs";
47
49
  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";
50
+ import "./chunk-R344I62Q.mjs";
51
+ import "./chunk-ANWIFBRQ.mjs";
52
+ import "./chunk-QGW2O2TN.mjs";
53
+ import "./chunk-BFLF77R7.mjs";
54
+ import "./chunk-MGEDZ4MA.mjs";
53
55
  import "./chunk-DQU3HIP4.mjs";
54
56
  import {
55
57
  walkTree
56
- } from "./chunk-JIXMPJZA.mjs";
58
+ } from "./chunk-SQ66YE7L.mjs";
57
59
  import {
58
60
  init_react_import
59
61
  } from "./chunk-M6W7YEVX.mjs";
@@ -71,8 +73,10 @@ export {
71
73
  Drawer,
72
74
  Editor,
73
75
  FieldLabel,
76
+ GLOBAL_ROOT_KEY,
74
77
  Group,
75
78
  IconButton,
79
+ LEGACY_GLOBAL_ROOT_KEY,
76
80
  Label,
77
81
  Render,
78
82
  RichTextMenu,
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } 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';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './actions-BxpNoF2q.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-uv_FsXcr.mjs';
4
4
  import 'react';
5
5
  import '@tiptap/react';
6
6
  import '@tiptap/extension-blockquote';
package/dist/rsc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } 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';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './actions-BxpNoF2q.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-BfVJmXEX.js';
4
4
  import 'react';
5
5
  import '@tiptap/react';
6
6
  import '@tiptap/extension-blockquote';
package/dist/rsc.js CHANGED
@@ -1355,11 +1355,11 @@ function walkAppState(state, config, mapContent = (content) => content, mapNodeO
1355
1355
  const processedRoot = processItem(rootAsComponent, [], -1);
1356
1356
  const root = __spreadValues(__spreadValues({}, state.data.root), processedRoot);
1357
1357
  return __spreadProps(__spreadValues({}, state), {
1358
- data: {
1358
+ data: __spreadValues({
1359
1359
  root,
1360
1360
  content: processedContent,
1361
1361
  zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
1362
- },
1362
+ }, state.data.globals !== void 0 ? { globals: state.data.globals } : {}),
1363
1363
  indexes: {
1364
1364
  nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
1365
1365
  zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
package/dist/rsc.mjs CHANGED
@@ -7,9 +7,9 @@ import {
7
7
  transformProps,
8
8
  useRichtextProps,
9
9
  useSlots
10
- } from "./chunk-AD67LVXW.mjs";
10
+ } from "./chunk-U52CF6C5.mjs";
11
11
  import "./chunk-6QJ2HF4O.mjs";
12
- import "./chunk-FTVOCMGV.mjs";
12
+ import "./chunk-MGEDZ4MA.mjs";
13
13
  import "./chunk-DQU3HIP4.mjs";
14
14
  import {
15
15
  rootAreaId,
@@ -17,7 +17,7 @@ import {
17
17
  rootZone,
18
18
  setupZone,
19
19
  walkTree
20
- } from "./chunk-JIXMPJZA.mjs";
20
+ } from "./chunk-SQ66YE7L.mjs";
21
21
  import {
22
22
  __spreadProps,
23
23
  __spreadValues,