@reacteditor/core 0.0.22 → 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.
@@ -510,7 +510,7 @@ type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldPro
510
510
  props: Props;
511
511
  /**
512
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
513
+ * `root`). Defaults to `true` when `config.root.global !== false`. Set
514
514
  * `false` to make the root page-local while leaving other pages synced.
515
515
  */
516
516
  synced?: boolean;
@@ -510,7 +510,7 @@ type RootDataWithProps<Props extends DefaultComponentProps = DefaultRootFieldPro
510
510
  props: Props;
511
511
  /**
512
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
513
+ * `root`). Defaults to `true` when `config.root.global !== false`. Set
514
514
  * `false` to make the root page-local while leaving other pages synced.
515
515
  */
516
516
  synced?: boolean;
@@ -113,7 +113,8 @@ var overrideKeys = [
113
113
 
114
114
  // types/Globals.ts
115
115
  init_react_import();
116
- var GLOBAL_ROOT_KEY = "__root";
116
+ var GLOBAL_ROOT_KEY = "root";
117
+ var LEGACY_GLOBAL_ROOT_KEY = "__root";
117
118
 
118
119
  // lib/data/set-deep.ts
119
120
  init_react_import();
@@ -5581,18 +5582,18 @@ function resolveItem(item, globals, config, visitedTypes) {
5581
5582
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
5582
5583
  }
5583
5584
  function resolveGlobals(data, config) {
5584
- var _a, _b, _c, _d;
5585
+ var _a, _b, _c, _d, _e;
5585
5586
  const globals = data.globals;
5586
5587
  if (!globals || Object.keys(globals).length === 0) return data;
5587
5588
  const visited = /* @__PURE__ */ new Set();
5588
5589
  const content = ((_a = data.content) != null ? _a : []).map(
5589
5590
  (item) => resolveItem(item, globals, config, visited)
5590
5591
  );
5591
- const rootGlobal = globals[GLOBAL_ROOT_KEY];
5592
- const rootSynced = ((_b = data.root) == null ? void 0 : _b.synced) !== false;
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;
5593
5594
  let nextRoot = data.root;
5594
5595
  if (isRootGlobal(config) && rootSynced && rootGlobal) {
5595
- const currentProps = (_d = (_c = data.root) == null ? void 0 : _c.props) != null ? _d : {};
5596
+ const currentProps = (_e = (_d = data.root) == null ? void 0 : _d.props) != null ? _e : {};
5596
5597
  nextRoot = __spreadProps(__spreadValues({}, data.root), {
5597
5598
  props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
5598
5599
  });
@@ -6459,7 +6460,7 @@ var Fields = memo8(FieldsInternal);
6459
6460
 
6460
6461
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
6461
6462
  init_react_import();
6462
- 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" };
6463
6464
 
6464
6465
  // plugins/fields/index.tsx
6465
6466
  import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
@@ -7405,6 +7406,9 @@ var isRootGlobal2 = (config) => {
7405
7406
  function splitGlobals(data, config) {
7406
7407
  var _a, _b, _c, _d;
7407
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
+ }
7408
7412
  function visit(node) {
7409
7413
  var _a2, _b2;
7410
7414
  const type = node.type;
@@ -9250,6 +9254,11 @@ import {
9250
9254
  import { jsx as jsx55 } from "react/jsx-runtime";
9251
9255
  var EDITOR_PATH = "/editor";
9252
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
+ };
9253
9262
  var seedGlobalsFromPages = (pages) => {
9254
9263
  const merged = {};
9255
9264
  for (const page of Object.values(pages)) {
@@ -9271,6 +9280,11 @@ function AppProvider({
9271
9280
  currentPath,
9272
9281
  children
9273
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
+ }
9274
9288
  const stablePages = useStableValue(pages);
9275
9289
  const [globals, setGlobals] = useState25(
9276
9290
  () => seedGlobalsFromPages(stablePages)
@@ -9278,7 +9292,7 @@ function AppProvider({
9278
9292
  const updateGlobals = useCallback26((next) => {
9279
9293
  setGlobals(next);
9280
9294
  }, []);
9281
- const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
9295
+ const resolvedEditorPath = editorPath === null ? null : normalizeEditorPath(editorPath != null ? editorPath : EDITOR_PATH);
9282
9296
  const ctxValue = useMemo26(
9283
9297
  () => ({
9284
9298
  config,
@@ -9611,6 +9625,7 @@ init_react_import();
9611
9625
  export {
9612
9626
  overrideKeys,
9613
9627
  GLOBAL_ROOT_KEY,
9628
+ LEGACY_GLOBAL_ROOT_KEY,
9614
9629
  setDeep,
9615
9630
  Button,
9616
9631
  FieldLabel,
@@ -1,4 +1,4 @@
1
- import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-D_rLbpVe.js';
1
+ import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-BxpNoF2q.js';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
@@ -1,4 +1,4 @@
1
- import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-D_rLbpVe.mjs';
1
+ import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-BxpNoF2q.mjs';
2
2
  import { Editor } from '@tiptap/react';
3
3
 
4
4
  type HistorySlice<D = any> = {
package/dist/index.css CHANGED
@@ -3144,13 +3144,14 @@ body:has(._DropZone--isAnimating_1h108_70:empty) [data-editor-overlay] {
3144
3144
  }
3145
3145
 
3146
3146
  /* css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css/#css-module-data */
3147
- ._FieldsPlugin_262zt_1 {
3148
- background: white;
3147
+ ._FieldsPlugin_11j3y_1 {
3148
+ background: var(--editor-surface-panel);
3149
3149
  height: 100%;
3150
3150
  overflow-y: auto;
3151
3151
  }
3152
- ._FieldsPlugin-header_262zt_7 {
3153
- border-bottom: 1px solid var(--editor-color-grey-09);
3152
+ ._FieldsPlugin-header_11j3y_7 {
3153
+ border-bottom: 1px solid var(--editor-border-subtle);
3154
+ color: var(--editor-text-primary);
3154
3155
  font-weight: 600;
3155
3156
  padding-bottom: 8px;
3156
3157
  padding-left: 16px;
@@ -3158,7 +3159,7 @@ body:has(._DropZone--isAnimating_1h108_70:empty) [data-editor-overlay] {
3158
3159
  padding-top: 8px;
3159
3160
  }
3160
3161
  @media (min-width: 638px) {
3161
- ._FieldsPlugin-header_262zt_7 {
3162
+ ._FieldsPlugin-header_11j3y_7 {
3162
3163
  padding: 16px;
3163
3164
  }
3164
3165
  }
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-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';
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-BxpNoF2q.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-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
+ import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-YjPj7lv4.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';
@@ -27,17 +27,25 @@ import '@tiptap/extension-underline';
27
27
  * via `synced: true`; synced instances render from this map (children + id
28
28
  * stay extrinsic).
29
29
  *
30
- * The reserved key `__root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
30
+ * The reserved key `root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
31
31
  * for the page root when `config.root.global !== false` and the page's
32
- * `data.root.synced` is not `false`.
32
+ * `data.root.synced` is not `false`. Matches `data.root` at the top level
33
+ * — same concept, same name.
33
34
  */
34
35
  type GlobalsMap = NonNullable<Data["globals"]>;
35
36
  /**
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.
37
+ * Reserved key inside `data.globals` that stores shared root props. Mirrors
38
+ * the top-level `data.root` field name so the concept is identifiable in
39
+ * both spots. Component types in this codebase are PascalCase by convention,
40
+ * so collision with a lowercase `root` component type is not a real concern.
39
41
  */
40
- declare const GLOBAL_ROOT_KEY: "__root";
42
+ declare const GLOBAL_ROOT_KEY: "root";
43
+ /**
44
+ * Legacy key — `data.globals` rows written by core 0.0.22 used this. The
45
+ * resolver / splitter reads from it as a fallback so stored data keeps
46
+ * resolving until callers re-publish. Safe to remove in a future major.
47
+ */
48
+ declare const LEGACY_GLOBAL_ROOT_KEY: "__root";
41
49
 
42
50
  /**
43
51
  * A route key — the literal string used as a `pages` key in `<App>` and
@@ -597,4 +605,4 @@ declare const outlinePlugin: () => Plugin;
597
605
 
598
606
  declare const legacySideBarPlugin: () => Plugin;
599
607
 
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 };
608
+ 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, LEGACY_GLOBAL_ROOT_KEY, 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-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';
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-BxpNoF2q.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-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
+ import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-XnBvIAmy.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';
@@ -27,17 +27,25 @@ import '@tiptap/extension-underline';
27
27
  * via `synced: true`; synced instances render from this map (children + id
28
28
  * stay extrinsic).
29
29
  *
30
- * The reserved key `__root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
30
+ * The reserved key `root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
31
31
  * for the page root when `config.root.global !== false` and the page's
32
- * `data.root.synced` is not `false`.
32
+ * `data.root.synced` is not `false`. Matches `data.root` at the top level
33
+ * — same concept, same name.
33
34
  */
34
35
  type GlobalsMap = NonNullable<Data["globals"]>;
35
36
  /**
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.
37
+ * Reserved key inside `data.globals` that stores shared root props. Mirrors
38
+ * the top-level `data.root` field name so the concept is identifiable in
39
+ * both spots. Component types in this codebase are PascalCase by convention,
40
+ * so collision with a lowercase `root` component type is not a real concern.
39
41
  */
40
- declare const GLOBAL_ROOT_KEY: "__root";
42
+ declare const GLOBAL_ROOT_KEY: "root";
43
+ /**
44
+ * Legacy key — `data.globals` rows written by core 0.0.22 used this. The
45
+ * resolver / splitter reads from it as a fallback so stored data keeps
46
+ * resolving until callers re-publish. Safe to remove in a future major.
47
+ */
48
+ declare const LEGACY_GLOBAL_ROOT_KEY: "__root";
41
49
 
42
50
  /**
43
51
  * A route key — the literal string used as a `pages` key in `<App>` and
@@ -597,4 +605,4 @@ declare const outlinePlugin: () => Plugin;
597
605
 
598
606
  declare const legacySideBarPlugin: () => Plugin;
599
607
 
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 };
608
+ 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, LEGACY_GLOBAL_ROOT_KEY, 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
@@ -5588,6 +5588,7 @@ __export(index_exports, {
5588
5588
  GLOBAL_ROOT_KEY: () => GLOBAL_ROOT_KEY,
5589
5589
  Group: () => Group,
5590
5590
  IconButton: () => IconButton,
5591
+ LEGACY_GLOBAL_ROOT_KEY: () => LEGACY_GLOBAL_ROOT_KEY,
5591
5592
  Label: () => Label,
5592
5593
  Render: () => Render,
5593
5594
  RichTextMenu: () => RichTextMenu,
@@ -5666,7 +5667,8 @@ init_react_import();
5666
5667
 
5667
5668
  // types/Globals.ts
5668
5669
  init_react_import();
5669
- var GLOBAL_ROOT_KEY = "__root";
5670
+ var GLOBAL_ROOT_KEY = "root";
5671
+ var LEGACY_GLOBAL_ROOT_KEY = "__root";
5670
5672
 
5671
5673
  // types/Props.tsx
5672
5674
  init_react_import();
@@ -9568,18 +9570,18 @@ function resolveItem(item, globals, config, visitedTypes) {
9568
9570
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
9569
9571
  }
9570
9572
  function resolveGlobals(data, config) {
9571
- var _a, _b, _c, _d;
9573
+ var _a, _b, _c, _d, _e;
9572
9574
  const globals = data.globals;
9573
9575
  if (!globals || Object.keys(globals).length === 0) return data;
9574
9576
  const visited = /* @__PURE__ */ new Set();
9575
9577
  const content = ((_a = data.content) != null ? _a : []).map(
9576
9578
  (item) => resolveItem(item, globals, config, visited)
9577
9579
  );
9578
- const rootGlobal = globals[GLOBAL_ROOT_KEY];
9579
- const rootSynced = ((_b = data.root) == null ? void 0 : _b.synced) !== false;
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;
9580
9582
  let nextRoot = data.root;
9581
9583
  if (isRootGlobal(config) && rootSynced && rootGlobal) {
9582
- const currentProps = (_d = (_c = data.root) == null ? void 0 : _c.props) != null ? _d : {};
9584
+ const currentProps = (_e = (_d = data.root) == null ? void 0 : _d.props) != null ? _e : {};
9583
9585
  nextRoot = __spreadProps(__spreadValues({}, data.root), {
9584
9586
  props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
9585
9587
  });
@@ -13102,6 +13104,9 @@ var isRootGlobal2 = (config) => {
13102
13104
  function splitGlobals(data, config) {
13103
13105
  var _a, _b, _c, _d;
13104
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
+ }
13105
13110
  function visit(node) {
13106
13111
  var _a2, _b2;
13107
13112
  const type = node.type;
@@ -14313,7 +14318,7 @@ init_store();
14313
14318
 
14314
14319
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
14315
14320
  init_react_import();
14316
- 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" };
14317
14322
 
14318
14323
  // plugins/fields/index.tsx
14319
14324
  init_lib();
@@ -15103,6 +15108,11 @@ var useApp = () => {
15103
15108
  var import_jsx_runtime93 = require("react/jsx-runtime");
15104
15109
  var EDITOR_PATH = "/editor";
15105
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
+ };
15106
15116
  var seedGlobalsFromPages = (pages) => {
15107
15117
  const merged = {};
15108
15118
  for (const page of Object.values(pages)) {
@@ -15124,6 +15134,11 @@ function AppProvider({
15124
15134
  currentPath,
15125
15135
  children
15126
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
+ }
15127
15142
  const stablePages = useStableValue(pages);
15128
15143
  const [globals, setGlobals] = (0, import_react98.useState)(
15129
15144
  () => seedGlobalsFromPages(stablePages)
@@ -15131,7 +15146,7 @@ function AppProvider({
15131
15146
  const updateGlobals = (0, import_react98.useCallback)((next) => {
15132
15147
  setGlobals(next);
15133
15148
  }, []);
15134
- const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
15149
+ const resolvedEditorPath = editorPath === null ? null : normalizeEditorPath(editorPath != null ? editorPath : EDITOR_PATH);
15135
15150
  const ctxValue = (0, import_react98.useMemo)(
15136
15151
  () => ({
15137
15152
  config,
@@ -15730,6 +15745,7 @@ var legacySideBarPlugin = () => ({
15730
15745
  GLOBAL_ROOT_KEY,
15731
15746
  Group,
15732
15747
  IconButton,
15748
+ LEGACY_GLOBAL_ROOT_KEY,
15733
15749
  Label,
15734
15750
  Render,
15735
15751
  RichTextMenu,
package/dist/index.mjs CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  Editor,
9
9
  FieldLabel,
10
10
  GLOBAL_ROOT_KEY,
11
+ LEGACY_GLOBAL_ROOT_KEY,
11
12
  Render,
12
13
  appConfigContext,
13
14
  blocksPlugin,
@@ -26,7 +27,7 @@ import {
26
27
  usePropsContext,
27
28
  useRouteParams,
28
29
  useStableValue
29
- } from "./chunk-UOKINS3M.mjs";
30
+ } from "./chunk-5WTMEYPV.mjs";
30
31
  import "./chunk-UEPLVAME.mjs";
31
32
  import {
32
33
  Action,
@@ -75,6 +76,7 @@ export {
75
76
  GLOBAL_ROOT_KEY,
76
77
  Group,
77
78
  IconButton,
79
+ LEGACY_GLOBAL_ROOT_KEY,
78
80
  Label,
79
81
  Render,
80
82
  RichTextMenu,
@@ -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-D_rLbpVe.mjs';
3
- import { A as AppStore } from './index-ByKXq8j5.mjs';
2
+ import { D as Data, A as AppState, O as OnAction, P as PrivateAppState, E as EditorAction } from './actions-BxpNoF2q.mjs';
3
+ import { A as AppStore } from './index-YjPj7lv4.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-D_rLbpVe.js';
3
- import { A as AppStore } from './index-jLN0kzKZ.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';
@@ -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-D_rLbpVe.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, 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-Dq_FpsiR.mjs';
4
- export { E as EditorRoute, O as OnPublish } from './index-ByKXq8j5.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-D_rLbpVe.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, 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-CklAwhBX.js';
4
- export { E as EditorRoute, O as OnPublish } from './index-jLN0kzKZ.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';
@@ -5588,6 +5588,7 @@ __export(no_external_exports, {
5588
5588
  GLOBAL_ROOT_KEY: () => GLOBAL_ROOT_KEY,
5589
5589
  Group: () => Group,
5590
5590
  IconButton: () => IconButton,
5591
+ LEGACY_GLOBAL_ROOT_KEY: () => LEGACY_GLOBAL_ROOT_KEY,
5591
5592
  Label: () => Label,
5592
5593
  Render: () => Render,
5593
5594
  RichTextMenu: () => RichTextMenu,
@@ -5666,7 +5667,8 @@ init_react_import();
5666
5667
 
5667
5668
  // types/Globals.ts
5668
5669
  init_react_import();
5669
- var GLOBAL_ROOT_KEY = "__root";
5670
+ var GLOBAL_ROOT_KEY = "root";
5671
+ var LEGACY_GLOBAL_ROOT_KEY = "__root";
5670
5672
 
5671
5673
  // types/Props.tsx
5672
5674
  init_react_import();
@@ -9568,18 +9570,18 @@ function resolveItem(item, globals, config, visitedTypes) {
9568
9570
  return __spreadProps(__spreadValues({}, item), { props: mergedProps });
9569
9571
  }
9570
9572
  function resolveGlobals(data, config) {
9571
- var _a, _b, _c, _d;
9573
+ var _a, _b, _c, _d, _e;
9572
9574
  const globals = data.globals;
9573
9575
  if (!globals || Object.keys(globals).length === 0) return data;
9574
9576
  const visited = /* @__PURE__ */ new Set();
9575
9577
  const content = ((_a = data.content) != null ? _a : []).map(
9576
9578
  (item) => resolveItem(item, globals, config, visited)
9577
9579
  );
9578
- const rootGlobal = globals[GLOBAL_ROOT_KEY];
9579
- const rootSynced = ((_b = data.root) == null ? void 0 : _b.synced) !== false;
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;
9580
9582
  let nextRoot = data.root;
9581
9583
  if (isRootGlobal(config) && rootSynced && rootGlobal) {
9582
- const currentProps = (_d = (_c = data.root) == null ? void 0 : _c.props) != null ? _d : {};
9584
+ const currentProps = (_e = (_d = data.root) == null ? void 0 : _d.props) != null ? _e : {};
9583
9585
  nextRoot = __spreadProps(__spreadValues({}, data.root), {
9584
9586
  props: __spreadValues(__spreadValues(__spreadValues({}, rootGlobal.props), currentProps.children !== void 0 ? { children: currentProps.children } : {}), currentProps.id !== void 0 ? { id: currentProps.id } : {})
9585
9587
  });
@@ -13102,6 +13104,9 @@ var isRootGlobal2 = (config) => {
13102
13104
  function splitGlobals(data, config) {
13103
13105
  var _a, _b, _c, _d;
13104
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
+ }
13105
13110
  function visit(node) {
13106
13111
  var _a2, _b2;
13107
13112
  const type = node.type;
@@ -14313,7 +14318,7 @@ init_store();
14313
14318
 
14314
14319
  // css-module:/Users/rami/Documents/apps/react-editor/packages/core/plugins/fields/styles.module.css#css-module
14315
14320
  init_react_import();
14316
- 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" };
14317
14322
 
14318
14323
  // plugins/fields/index.tsx
14319
14324
  init_lib();
@@ -15103,6 +15108,11 @@ var useApp = () => {
15103
15108
  var import_jsx_runtime93 = require("react/jsx-runtime");
15104
15109
  var EDITOR_PATH = "/editor";
15105
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
+ };
15106
15116
  var seedGlobalsFromPages = (pages) => {
15107
15117
  const merged = {};
15108
15118
  for (const page of Object.values(pages)) {
@@ -15124,6 +15134,11 @@ function AppProvider({
15124
15134
  currentPath,
15125
15135
  children
15126
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
+ }
15127
15142
  const stablePages = useStableValue(pages);
15128
15143
  const [globals, setGlobals] = (0, import_react98.useState)(
15129
15144
  () => seedGlobalsFromPages(stablePages)
@@ -15131,7 +15146,7 @@ function AppProvider({
15131
15146
  const updateGlobals = (0, import_react98.useCallback)((next) => {
15132
15147
  setGlobals(next);
15133
15148
  }, []);
15134
- const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
15149
+ const resolvedEditorPath = editorPath === null ? null : normalizeEditorPath(editorPath != null ? editorPath : EDITOR_PATH);
15135
15150
  const ctxValue = (0, import_react98.useMemo)(
15136
15151
  () => ({
15137
15152
  config,
@@ -15730,6 +15745,7 @@ var legacySideBarPlugin = () => ({
15730
15745
  GLOBAL_ROOT_KEY,
15731
15746
  Group,
15732
15747
  IconButton,
15748
+ LEGACY_GLOBAL_ROOT_KEY,
15733
15749
  Label,
15734
15750
  Render,
15735
15751
  RichTextMenu,
@@ -8,6 +8,7 @@ import {
8
8
  Editor,
9
9
  FieldLabel,
10
10
  GLOBAL_ROOT_KEY,
11
+ LEGACY_GLOBAL_ROOT_KEY,
11
12
  Render,
12
13
  appConfigContext,
13
14
  blocksPlugin,
@@ -26,7 +27,7 @@ import {
26
27
  usePropsContext,
27
28
  useRouteParams,
28
29
  useStableValue
29
- } from "./chunk-UOKINS3M.mjs";
30
+ } from "./chunk-5WTMEYPV.mjs";
30
31
  import "./chunk-UEPLVAME.mjs";
31
32
  import {
32
33
  Action,
@@ -75,6 +76,7 @@ export {
75
76
  GLOBAL_ROOT_KEY,
76
77
  Group,
77
78
  IconButton,
79
+ LEGACY_GLOBAL_ROOT_KEY,
78
80
  Label,
79
81
  Render,
80
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-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';
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-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';
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';
@@ -1,4 +1,4 @@
1
- import { C as Config, D as Data, W as WithId, U as UserGenerics, j as Content, b as ComponentData, k as DefaultComponents, l as DefaultComponentProps, m as DefaultRootFieldProps, M as Metadata, n as RootData } from './actions-D_rLbpVe.js';
1
+ import { C as Config, D as Data, W as WithId, U as UserGenerics, j as Content, b as ComponentData, k as DefaultComponents, l as DefaultComponentProps, m as DefaultRootFieldProps, M as Metadata, n as RootData } from './actions-BxpNoF2q.js';
2
2
 
3
3
  type GetRoutePropsOptions = {
4
4
  /** Defaults to "/editor". Pass null to skip editor-prefix handling. */
@@ -1,4 +1,4 @@
1
- import { C as Config, D as Data, W as WithId, U as UserGenerics, j as Content, b as ComponentData, k as DefaultComponents, l as DefaultComponentProps, m as DefaultRootFieldProps, M as Metadata, n as RootData } from './actions-D_rLbpVe.mjs';
1
+ import { C as Config, D as Data, W as WithId, U as UserGenerics, j as Content, b as ComponentData, k as DefaultComponents, l as DefaultComponentProps, m as DefaultRootFieldProps, M as Metadata, n as RootData } from './actions-BxpNoF2q.mjs';
2
2
 
3
3
  type GetRoutePropsOptions = {
4
4
  /** Defaults to "/editor". Pass null to skip editor-prefix handling. */
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@reacteditor/core",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Frontend AI, Inc.",
6
6
  "repository": "reacteditor/editor",
7
7
  "bugs": "https://github.com/reacteditor/editor/issues",
8
8
  "homepage": "https://reacteditor.dev",
9
9
  "keywords": [
10
+ "ai",
10
11
  "editor",
11
12
  "visual",
12
13
  "editor",
@@ -93,7 +94,6 @@
93
94
  "@types/object-hash": "^3.0.6",
94
95
  "@types/react": "^19.2.7",
95
96
  "@types/react-dom": "^19.2.3",
96
- "@types/uuid": "^10.0.0",
97
97
  "css-box-model": "^1.2.1",
98
98
  "eslint": "^7.32.0",
99
99
  "eslint-config-custom": "*",
@@ -146,8 +146,8 @@
146
146
  "object-hash": "^3.0.0",
147
147
  "react-hotkeys-hook": "^4.6.1",
148
148
  "use-debounce": "^9.0.4",
149
- "uuid": "^9.0.1",
150
- "zustand": "^5.0.3"
149
+ "uuid": "^11.1.1",
150
+ "zustand": "^5.0.13"
151
151
  },
152
152
  "peerDependencies": {
153
153
  "react": "^18.0.0 || ^19.0.0",