@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.
- package/dist/{Editor-GVYZ7S5L.mjs → Editor-L76D646I.mjs} +9 -9
- package/dist/{actions-BxLinRKD.d.mts → actions-BxpNoF2q.d.mts} +6 -0
- package/dist/{actions-BxLinRKD.d.ts → actions-BxpNoF2q.d.ts} +6 -0
- package/dist/{chunk-HWYAMQID.mjs → chunk-5WTMEYPV.mjs} +160 -40
- package/dist/{chunk-DKFLK64M.mjs → chunk-ANWIFBRQ.mjs} +1 -1
- package/dist/{chunk-M4JDRFYB.mjs → chunk-BFLF77R7.mjs} +3 -3
- package/dist/{chunk-M36T7BWB.mjs → chunk-HIOPRNZ4.mjs} +1 -1
- package/dist/{chunk-FTVOCMGV.mjs → chunk-MGEDZ4MA.mjs} +1 -1
- package/dist/{chunk-MUBFR675.mjs → chunk-QGW2O2TN.mjs} +3 -3
- package/dist/{chunk-PGSQPCM6.mjs → chunk-R344I62Q.mjs} +1 -1
- package/dist/{chunk-JIXMPJZA.mjs → chunk-SQ66YE7L.mjs} +2 -2
- package/dist/{chunk-AD67LVXW.mjs → chunk-U52CF6C5.mjs} +2 -2
- package/dist/{chunk-BORTMJJZ.mjs → chunk-UEPLVAME.mjs} +3 -3
- package/dist/{chunk-MVJENRGK.mjs → chunk-XREK5QOM.mjs} +7 -7
- package/dist/{full-QWTPWHXQ.mjs → full-WQ3EE5XF.mjs} +8 -8
- package/dist/{index-YRgZBGas.d.ts → index-XnBvIAmy.d.ts} +1 -1
- package/dist/{index-DET4zR84.d.mts → index-YjPj7lv4.d.mts} +1 -1
- package/dist/index.css +6 -5
- package/dist/index.d.mts +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +153 -31
- package/dist/index.mjs +15 -11
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +4 -4
- package/dist/internal.mjs +2 -2
- package/dist/{loaded-BHRFTTT2.mjs → loaded-B6MZXIYJ.mjs} +5 -5
- package/dist/{loaded-XKFARPER.mjs → loaded-IYWHACEP.mjs} +5 -5
- package/dist/{loaded-HIFB4G2Q.mjs → loaded-QSBR22EG.mjs} +5 -5
- package/dist/no-external.css +6 -5
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +153 -31
- package/dist/no-external.mjs +15 -11
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +2 -2
- package/dist/rsc.mjs +3 -3
- package/dist/{walk-tree-Clklc1Ql.d.ts → walk-tree-BfVJmXEX.d.ts} +1 -1
- package/dist/{walk-tree-BvYigWFL.d.mts → walk-tree-uv_FsXcr.d.mts} +1 -1
- package/package.json +4 -4
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LoadedRichTextMenuInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-XREK5QOM.mjs";
|
|
4
|
+
import "./chunk-HIOPRNZ4.mjs";
|
|
5
|
+
import "./chunk-R344I62Q.mjs";
|
|
6
|
+
import "./chunk-ANWIFBRQ.mjs";
|
|
7
|
+
import "./chunk-QGW2O2TN.mjs";
|
|
8
|
+
import "./chunk-BFLF77R7.mjs";
|
|
9
|
+
import "./chunk-MGEDZ4MA.mjs";
|
|
10
10
|
import "./chunk-DQU3HIP4.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-SQ66YE7L.mjs";
|
|
12
12
|
import {
|
|
13
13
|
__spreadValues,
|
|
14
14
|
init_react_import
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as History, a as Permissions, b as ComponentData, C as Config, U as UserGenerics, F as Fields, E as EditorAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, e as Overrides, V as Viewports, I as IframeConfig, f as UiState, g as ComponentConfig, A as AppState, M as Metadata, h as FieldTransforms, i as RichtextField } from './actions-
|
|
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-
|
|
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
|
-
.
|
|
3148
|
-
background:
|
|
3147
|
+
._FieldsPlugin_11j3y_1 {
|
|
3148
|
+
background: var(--editor-surface-panel);
|
|
3149
3149
|
height: 100%;
|
|
3150
3150
|
overflow-y: auto;
|
|
3151
3151
|
}
|
|
3152
|
-
._FieldsPlugin-
|
|
3153
|
-
border-bottom: 1px solid var(--editor-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
4
|
-
import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-
|
|
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';
|
|
@@ -26,8 +26,26 @@ import '@tiptap/extension-underline';
|
|
|
26
26
|
* `data.globals` and is keyed by component type. Instances opt in per-node
|
|
27
27
|
* via `synced: true`; synced instances render from this map (children + id
|
|
28
28
|
* stay extrinsic).
|
|
29
|
+
*
|
|
30
|
+
* The reserved key `root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
|
|
31
|
+
* for the page root when `config.root.global !== false` and the page's
|
|
32
|
+
* `data.root.synced` is not `false`. Matches `data.root` at the top level
|
|
33
|
+
* — same concept, same name.
|
|
29
34
|
*/
|
|
30
35
|
type GlobalsMap = NonNullable<Data["globals"]>;
|
|
36
|
+
/**
|
|
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.
|
|
41
|
+
*/
|
|
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";
|
|
31
49
|
|
|
32
50
|
/**
|
|
33
51
|
* A route key — the literal string used as a `pages` key in `<App>` and
|
|
@@ -111,6 +129,15 @@ type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics
|
|
|
111
129
|
pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
|
|
112
130
|
/** "/edit" by default; null disables editor mode entirely. */
|
|
113
131
|
editorPath: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* App-owned globals map overlaid onto each page's `data.globals` so synced
|
|
134
|
+
* instances (and the synced root) share state across pages. Always defined
|
|
135
|
+
* — App seeds it from the initial pages and keeps it in sync via
|
|
136
|
+
* `setGlobals` (called by the editor's onChange wrapper).
|
|
137
|
+
*/
|
|
138
|
+
globals: GlobalsMap;
|
|
139
|
+
/** Internal: update the shared globals map. Not exposed to host code. */
|
|
140
|
+
setGlobals: (next: GlobalsMap) => void;
|
|
114
141
|
};
|
|
115
142
|
declare const appConfigContext: react.Context<AppConfigContext<Config, UserGenerics<Config>> | null>;
|
|
116
143
|
type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
|
|
@@ -122,6 +149,12 @@ type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<
|
|
|
122
149
|
route: AppRoute | null;
|
|
123
150
|
/** Navigate to a route key. Wraps with editorPath when editing. */
|
|
124
151
|
navigate: (route: RouteKey) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Resolved per-page data with `globals` overlaid from the app-level
|
|
154
|
+
* `globals` prop (app wins over the page's own `data.globals`). Returns
|
|
155
|
+
* the page's data unchanged when no app-level globals are configured.
|
|
156
|
+
*/
|
|
157
|
+
resolvePageData: <D extends Partial<Data>>(pageData: D) => D;
|
|
125
158
|
};
|
|
126
159
|
/**
|
|
127
160
|
* Read the resolved route context. Combines config + pages + editorPath
|
|
@@ -572,4 +605,4 @@ declare const outlinePlugin: () => Plugin;
|
|
|
572
605
|
|
|
573
606
|
declare const legacySideBarPlugin: () => Plugin;
|
|
574
607
|
|
|
575
|
-
export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRoute, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, EditorChromeConfig, type EditorCommands, EditorRoute, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, OnPublish, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, type RouteKey, Separator, UiState, type UseEditorData, UserGenerics, Viewports, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue };
|
|
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-
|
|
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-
|
|
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-
|
|
4
|
-
import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-
|
|
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';
|
|
@@ -26,8 +26,26 @@ import '@tiptap/extension-underline';
|
|
|
26
26
|
* `data.globals` and is keyed by component type. Instances opt in per-node
|
|
27
27
|
* via `synced: true`; synced instances render from this map (children + id
|
|
28
28
|
* stay extrinsic).
|
|
29
|
+
*
|
|
30
|
+
* The reserved key `root` (see {@link GLOBAL_ROOT_KEY}) holds shared props
|
|
31
|
+
* for the page root when `config.root.global !== false` and the page's
|
|
32
|
+
* `data.root.synced` is not `false`. Matches `data.root` at the top level
|
|
33
|
+
* — same concept, same name.
|
|
29
34
|
*/
|
|
30
35
|
type GlobalsMap = NonNullable<Data["globals"]>;
|
|
36
|
+
/**
|
|
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.
|
|
41
|
+
*/
|
|
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";
|
|
31
49
|
|
|
32
50
|
/**
|
|
33
51
|
* A route key — the literal string used as a `pages` key in `<App>` and
|
|
@@ -111,6 +129,15 @@ type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics
|
|
|
111
129
|
pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
|
|
112
130
|
/** "/edit" by default; null disables editor mode entirely. */
|
|
113
131
|
editorPath: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* App-owned globals map overlaid onto each page's `data.globals` so synced
|
|
134
|
+
* instances (and the synced root) share state across pages. Always defined
|
|
135
|
+
* — App seeds it from the initial pages and keeps it in sync via
|
|
136
|
+
* `setGlobals` (called by the editor's onChange wrapper).
|
|
137
|
+
*/
|
|
138
|
+
globals: GlobalsMap;
|
|
139
|
+
/** Internal: update the shared globals map. Not exposed to host code. */
|
|
140
|
+
setGlobals: (next: GlobalsMap) => void;
|
|
114
141
|
};
|
|
115
142
|
declare const appConfigContext: react.Context<AppConfigContext<Config, UserGenerics<Config>> | null>;
|
|
116
143
|
type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
|
|
@@ -122,6 +149,12 @@ type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<
|
|
|
122
149
|
route: AppRoute | null;
|
|
123
150
|
/** Navigate to a route key. Wraps with editorPath when editing. */
|
|
124
151
|
navigate: (route: RouteKey) => void;
|
|
152
|
+
/**
|
|
153
|
+
* Resolved per-page data with `globals` overlaid from the app-level
|
|
154
|
+
* `globals` prop (app wins over the page's own `data.globals`). Returns
|
|
155
|
+
* the page's data unchanged when no app-level globals are configured.
|
|
156
|
+
*/
|
|
157
|
+
resolvePageData: <D extends Partial<Data>>(pageData: D) => D;
|
|
125
158
|
};
|
|
126
159
|
/**
|
|
127
160
|
* Read the resolved route context. Combines config + pages + editorPath
|
|
@@ -572,4 +605,4 @@ declare const outlinePlugin: () => Plugin;
|
|
|
572
605
|
|
|
573
606
|
declare const legacySideBarPlugin: () => Plugin;
|
|
574
607
|
|
|
575
|
-
export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRoute, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, EditorChromeConfig, type EditorCommands, EditorRoute, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, OnPublish, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, type RouteKey, Separator, UiState, type UseEditorData, UserGenerics, Viewports, appConfigContext, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useApp, useEditor, useGetEditor, usePropsContext, useRouteParams, useStableValue };
|
|
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
|
@@ -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(index_exports, {
|
|
|
5585
5585
|
Drawer: () => Drawer,
|
|
5586
5586
|
Editor: () => Editor4,
|
|
5587
5587
|
FieldLabel: () => FieldLabel,
|
|
5588
|
+
GLOBAL_ROOT_KEY: () => GLOBAL_ROOT_KEY,
|
|
5588
5589
|
Group: () => Group,
|
|
5589
5590
|
IconButton: () => IconButton,
|
|
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
|
-
|
|
8198
|
-
|
|
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
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
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: "
|
|
8209
|
-
|
|
8210
|
-
|
|
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
|
-
|
|
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
|
|
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": "
|
|
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
|
|
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 {
|
|
15116
|
-
|
|
15117
|
-
|
|
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:
|
|
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,
|
package/dist/index.mjs
CHANGED
|
@@ -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-
|
|
29
|
-
import "./chunk-
|
|
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-
|
|
39
|
-
import "./chunk-
|
|
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-
|
|
48
|
+
} from "./chunk-U52CF6C5.mjs";
|
|
47
49
|
import "./chunk-6QJ2HF4O.mjs";
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
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-
|
|
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/internal.d.mts
CHANGED
|
@@ -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-
|
|
3
|
-
import { A as AppStore } from './index-
|
|
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';
|