@reacteditor/core 0.0.9 → 0.0.11
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/README.md +7 -7
- package/dist/{Editor-KXEVJBNG.mjs → Editor-GK6JTUPD.mjs} +7 -7
- package/dist/{actions-2L-1hQ7r.d.mts → actions-C0LX6bI4.d.mts} +2 -1
- package/dist/{actions-2L-1hQ7r.d.ts → actions-C0LX6bI4.d.ts} +2 -1
- package/dist/{chunk-LRFRIIKG.mjs → chunk-56I7ST5F.mjs} +1 -1
- package/dist/{chunk-DU757QEH.mjs → chunk-74TOLW7F.mjs} +1561 -1266
- package/dist/{chunk-IIRJMJFU.mjs → chunk-ERNSJXVF.mjs} +1 -0
- package/dist/{chunk-TI3KC54Y.mjs → chunk-II42EKFK.mjs} +47 -1
- package/dist/{chunk-AD7BMXAA.mjs → chunk-MJJPWASL.mjs} +1 -1
- package/dist/{chunk-U7VW3V3W.mjs → chunk-TGVAC3JP.mjs} +9 -9
- package/dist/{chunk-FT6UFK7G.mjs → chunk-X4EUZIHA.mjs} +1 -1
- package/dist/{chunk-OIFPBVSF.mjs → chunk-XLVEWZWT.mjs} +1 -1
- package/dist/{chunk-AJWRDM22.mjs → chunk-YBG2RYVF.mjs} +5 -5
- package/dist/{full-ZFZZ626B.mjs → full-IUPXFMQP.mjs} +6 -6
- package/dist/{index-BXuSeNez.d.mts → index-DMbFEg8G.d.mts} +1 -1
- package/dist/{index-BNsSzMCj.d.ts → index-DmThy7vE.d.ts} +1 -1
- package/dist/index.css +109 -109
- package/dist/index.d.mts +155 -17
- package/dist/index.d.ts +155 -17
- package/dist/index.js +1080 -731
- package/dist/index.mjs +31 -15
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/{loaded-GLBLMTBL.mjs → loaded-BT7NIVEO.mjs} +3 -3
- package/dist/{loaded-O4QHGE26.mjs → loaded-HVOKDVC3.mjs} +3 -3
- package/dist/{loaded-R34BR6I5.mjs → loaded-YFYCF5F4.mjs} +3 -3
- package/dist/nextjs.d.mts +38 -0
- package/dist/nextjs.d.ts +38 -0
- package/dist/nextjs.js +65 -0
- package/dist/nextjs.mjs +30 -0
- package/dist/no-external.css +109 -109
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +1080 -731
- package/dist/no-external.mjs +31 -15
- package/dist/remix.d.mts +33 -0
- package/dist/remix.d.ts +33 -0
- package/dist/remix.js +65 -0
- package/dist/remix.mjs +30 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +49 -0
- package/dist/rsc.mjs +6 -2
- package/dist/{walk-tree-C9GrSWsR.d.ts → walk-tree-5oDs6qOL.d.mts} +33 -2
- package/dist/{walk-tree-4C3ODO3X.d.mts → walk-tree-B1q6t5Jp.d.ts} +33 -2
- package/package.json +17 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics,
|
|
2
|
-
export { t as Adaptor, A as AppState, u as ArrayField, v as ArrayState, w as AsFieldProps, B as BaseData, x as BaseField, y as CacheOpts, z as ColorField,
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
1
|
+
import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, q as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, r as ItemSelector, s as PluginInternal } from './actions-C0LX6bI4.mjs';
|
|
2
|
+
export { t as Adaptor, A as AppState, u as ArrayField, v as ArrayState, w as AsFieldProps, B as BaseData, x as BaseField, y as CacheOpts, z as ColorField, g as ComponentConfig, G as ComponentConfigExtensions, J as ComponentConfigParams, K as ComponentDataMap, L as ComponentDataOptionalId, N as ComponentMetadata, Q as ConfigParams, j as Content, S as CustomField, T as CustomFieldRender, k as DefaultComponents, X as DefaultRootProps, Y as DefaultRootRenderProps, Z as Direction, _ as DragAxis, $ as EditorComponent, a0 as EditorContext, a1 as EditorMetadata, a2 as ExternalField, a3 as ExternalFieldWithAdaptor, a4 as ExtractConfigParams, a5 as ExtractField, a6 as FieldMetadata, a7 as FieldRenderFunctions, a8 as FieldTransformFn, a9 as FieldTransformFnParams, F as Fields, H as History, aa as ItemWithId, ab as MappedItem, ac as NumberField, ad as ObjectField, ae as OverrideKey, af as RadioField, ag as RichText, i as RichtextField, ah as RootConfig, n as RootData, R as RootDataWithProps, ai as RootDataWithoutProps, aj as SelectField, ak as Slot, al as SlotComponent, am as SlotField, an as TextField, ao as TextareaField, ap as Viewport, aq as WithChildren, ar as WithEditorProps, W as WithId, as as WithSlotProps, at as overrideKeys } from './actions-C0LX6bI4.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-5oDs6qOL.mjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
|
7
|
-
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-
|
|
7
|
+
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-DMbFEg8G.mjs';
|
|
8
8
|
import '@tiptap/react';
|
|
9
9
|
import '@tiptap/extension-blockquote';
|
|
10
10
|
import '@tiptap/extension-bold';
|
|
@@ -30,17 +30,17 @@ import '@tiptap/extension-underline';
|
|
|
30
30
|
type GlobalsMap = NonNullable<Data["globals"]>;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* A
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* `
|
|
33
|
+
* A route key — the literal string used as a `pages` key in `<App>` and
|
|
34
|
+
* the picker entry in `<Editor routes>`. The same string flows through:
|
|
35
|
+
* - `pages={{ [routeKey]: pageData }}` declares the schema
|
|
36
|
+
* - `<Editor routes={[routeKey, ...]}>` powers the page picker
|
|
37
|
+
* - `<Editor currentPath={routeKey}>` marks the selected page
|
|
38
|
+
* - `onPublish(data, routeKey)` returns it for persistence
|
|
39
|
+
*
|
|
40
|
+
* Patterns follow path-to-regexp v8 / Express 5 syntax: "/", "/about",
|
|
41
|
+
* "/products/:handle", "/docs/*splat".
|
|
39
42
|
*/
|
|
40
|
-
type Route =
|
|
41
|
-
path: string;
|
|
42
|
-
title: string;
|
|
43
|
-
};
|
|
43
|
+
type Route = string;
|
|
44
44
|
|
|
45
45
|
declare const ActionBar: {
|
|
46
46
|
({ label, children, }: {
|
|
@@ -91,6 +91,135 @@ declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<Value
|
|
|
91
91
|
value: any;
|
|
92
92
|
}): react_jsx_runtime.JSX.Element | null;
|
|
93
93
|
|
|
94
|
+
/** A route key — the literal pattern used in `pages`. */
|
|
95
|
+
type RouteKey = string;
|
|
96
|
+
type AppMatched<Data = unknown> = {
|
|
97
|
+
/** The route key string — stable persistence identifier. */
|
|
98
|
+
route: RouteKey;
|
|
99
|
+
/** Concrete params extracted from the URL (e.g. { handle: "abc" }). */
|
|
100
|
+
params: Readonly<Record<string, string | undefined>>;
|
|
101
|
+
/** The page's data. */
|
|
102
|
+
data: Data;
|
|
103
|
+
};
|
|
104
|
+
type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
105
|
+
config: UserConfig;
|
|
106
|
+
pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
|
|
107
|
+
/** "/edit" by default; null disables editor mode entirely. */
|
|
108
|
+
editorPath: string | null;
|
|
109
|
+
};
|
|
110
|
+
declare const appConfigContext: react.Context<AppConfigContext<Config, UserGenerics<Config>> | null>;
|
|
111
|
+
type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
|
|
112
|
+
/** All page route keys, in declaration order. */
|
|
113
|
+
routes: RouteKey[];
|
|
114
|
+
/** Resolved current pathname from React Router. */
|
|
115
|
+
currentPath: string;
|
|
116
|
+
/** True when currentPath starts with editorPath. */
|
|
117
|
+
isEditing: boolean;
|
|
118
|
+
/** The URL relative to editorPath when isEditing — what pages are matched against. */
|
|
119
|
+
matchRoute: string;
|
|
120
|
+
/** Result of matching matchRoute against pages. Null = 404. */
|
|
121
|
+
matched: AppMatched<Partial<G["UserData"] | Data>> | null;
|
|
122
|
+
/** Navigate to a route key. Wraps with editorPath when editing. */
|
|
123
|
+
navigate: (route: RouteKey) => void;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Read the resolved route context. Combines config + pages + editorPath
|
|
127
|
+
* (from `<AppProvider>`) with the live location/navigation (from React Router).
|
|
128
|
+
*/
|
|
129
|
+
declare const useApp: <UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>() => AppContextValue<UserConfig, G>;
|
|
130
|
+
|
|
131
|
+
/** Which RR router variant to use on the client. SSR always uses StaticRouter. */
|
|
132
|
+
type AppRouterVariant = "browser" | "hash" | "memory";
|
|
133
|
+
type AppProviderProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
134
|
+
config: UserConfig;
|
|
135
|
+
pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
|
|
136
|
+
/** Defaults to "/editor". Pass null to disable editor mode. */
|
|
137
|
+
editorPath?: string | null;
|
|
138
|
+
/** Client-side router variant. Defaults to "browser". */
|
|
139
|
+
router?: AppRouterVariant;
|
|
140
|
+
/**
|
|
141
|
+
* Initial pathname for SSR (StaticRouter) or MemoryRouter.
|
|
142
|
+
* Required during SSR so the first paint matches the requested URL.
|
|
143
|
+
* Ignored for BrowserRouter and HashRouter on the client (they read window).
|
|
144
|
+
*/
|
|
145
|
+
currentPath?: string;
|
|
146
|
+
children?: ReactNode;
|
|
147
|
+
};
|
|
148
|
+
declare function AppProvider<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, pages, editorPath, router, currentPath, children, }: AppProviderProps<UserConfig, G>): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
/** Editor pass-through props shared by <App> (default layout) and <App.Editor>. */
|
|
151
|
+
type EditorPassthroughProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
152
|
+
/** Called when the editor publishes. `route` is the schema route key. */
|
|
153
|
+
onPublish?: (data: G["UserData"], route?: string) => void;
|
|
154
|
+
onChange?: (data: G["UserData"]) => void;
|
|
155
|
+
onAction?: OnAction<G["UserData"]>;
|
|
156
|
+
ui?: Partial<UiState>;
|
|
157
|
+
plugins?: Plugin<UserConfig>[];
|
|
158
|
+
overrides?: Partial<Overrides<UserConfig>>;
|
|
159
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
160
|
+
metadata?: Metadata;
|
|
161
|
+
iframe?: IframeConfig;
|
|
162
|
+
viewports?: Viewports;
|
|
163
|
+
permissions?: Partial<Permissions>;
|
|
164
|
+
renderHeader?: (props: {
|
|
165
|
+
children: ReactNode;
|
|
166
|
+
dispatch: (action: EditorAction) => void;
|
|
167
|
+
state: G["UserAppState"];
|
|
168
|
+
}) => ReactElement;
|
|
169
|
+
renderHeaderActions?: (props: {
|
|
170
|
+
state: G["UserAppState"];
|
|
171
|
+
dispatch: (action: EditorAction) => void;
|
|
172
|
+
}) => ReactElement;
|
|
173
|
+
title?: ReactNode;
|
|
174
|
+
dnd?: {
|
|
175
|
+
disableAutoScroll?: boolean;
|
|
176
|
+
};
|
|
177
|
+
initialHistory?: InitialHistory;
|
|
178
|
+
height?: CSSProperties["height"];
|
|
179
|
+
fullScreenCanvas?: boolean;
|
|
180
|
+
disableZoomControls?: boolean;
|
|
181
|
+
_experimentalVirtualization?: boolean;
|
|
182
|
+
};
|
|
183
|
+
type AppProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppProviderProps<UserConfig, G> & EditorPassthroughProps<UserConfig, G> & {
|
|
184
|
+
/** Optional custom not-found component — falls back to a built-in. */
|
|
185
|
+
renderNotFound?: () => ReactNode;
|
|
186
|
+
};
|
|
187
|
+
type AppRenderProps = {
|
|
188
|
+
metadata?: Metadata;
|
|
189
|
+
renderNotFound?: () => ReactNode;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Mounts <Render> for the current page when the URL is *not* under editorPath.
|
|
193
|
+
* Returns null while editing — safe to place anywhere inside <App>.
|
|
194
|
+
*/
|
|
195
|
+
declare function AppRender<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ metadata, renderNotFound }: AppRenderProps): react_jsx_runtime.JSX.Element | null;
|
|
196
|
+
type AppEditorProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = EditorPassthroughProps<UserConfig, G> & {
|
|
197
|
+
children?: ReactNode;
|
|
198
|
+
renderNotFound?: () => ReactNode;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Mounts <Editor> for the current page when the URL is under editorPath.
|
|
202
|
+
* Returns null otherwise. Children are forwarded to <Editor> for compositional
|
|
203
|
+
* UI (e.g. <Editor.Preview />, <Editor.Fields />).
|
|
204
|
+
*/
|
|
205
|
+
declare function AppEditor<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: AppEditorProps<UserConfig, G>): react_jsx_runtime.JSX.Element | null;
|
|
206
|
+
declare function App<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: AppProps<UserConfig, G>): react_jsx_runtime.JSX.Element;
|
|
207
|
+
declare namespace App {
|
|
208
|
+
var Render: typeof AppRender;
|
|
209
|
+
var Editor: typeof AppEditor;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Returns the schema-named params extracted from the current route.
|
|
214
|
+
*
|
|
215
|
+
* Designed for components rendered *inside* the schema (e.g. a ProductDetails
|
|
216
|
+
* block inside `pages["/products/:handle"]`) — they need `:handle` resolved
|
|
217
|
+
* by name. This is a typed re-export of React Router's `useParams()`.
|
|
218
|
+
*
|
|
219
|
+
* Returns `{}` when no page matched (404).
|
|
220
|
+
*/
|
|
221
|
+
declare const useRouteParams: <P extends Record<string, string | undefined> = Record<string, string | undefined>>() => Readonly<P>;
|
|
222
|
+
|
|
94
223
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
95
224
|
children: ReactNode;
|
|
96
225
|
href?: string;
|
|
@@ -161,7 +290,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
161
290
|
data: Partial<G["UserData"] | Data>;
|
|
162
291
|
ui?: Partial<UiState>;
|
|
163
292
|
onChange?: (data: G["UserData"]) => void;
|
|
164
|
-
onPublish?: (data: G["UserData"]) => void;
|
|
293
|
+
onPublish?: (data: G["UserData"], route?: string) => void;
|
|
165
294
|
onAction?: OnAction<G["UserData"]>;
|
|
166
295
|
permissions?: Partial<Permissions>;
|
|
167
296
|
plugins?: Plugin<UserConfig>[];
|
|
@@ -180,7 +309,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
180
309
|
headerPath?: string;
|
|
181
310
|
title?: ReactNode;
|
|
182
311
|
routes?: Route[];
|
|
183
|
-
|
|
312
|
+
currentRoute?: string;
|
|
184
313
|
onRouteChange?: (path: string) => void | Promise<void>;
|
|
185
314
|
viewports?: Viewports;
|
|
186
315
|
iframe?: IframeConfig;
|
|
@@ -284,6 +413,15 @@ declare const RichTextMenu: {
|
|
|
284
413
|
Underline: typeof Underline;
|
|
285
414
|
};
|
|
286
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Returns a structurally-stable reference. Updates only when `value` deep-changes,
|
|
418
|
+
* so referentially-fresh-but-content-equal objects don't re-trigger downstream memos.
|
|
419
|
+
*
|
|
420
|
+
* Used inside `<AppProvider>` so that users passing inline `pages={{ ... }}` don't
|
|
421
|
+
* re-compile the route table on every parent render.
|
|
422
|
+
*/
|
|
423
|
+
declare const useStableValue: <T>(value: T) => T;
|
|
424
|
+
|
|
287
425
|
/**
|
|
288
426
|
* Framework-agnostic SEO output shape. Mirrors the subset of Next.js's
|
|
289
427
|
* Metadata type that most page builders care about — title, description,
|
|
@@ -413,4 +551,4 @@ declare const outlinePlugin: () => Plugin;
|
|
|
413
551
|
|
|
414
552
|
declare const legacySideBarPlugin: () => Plugin;
|
|
415
553
|
|
|
416
|
-
export { Action, ActionBar, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, type EditorCommands, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, Separator, UiState, type UseEditorData, UserGenerics, Viewports, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useEditor, useGetEditor, usePropsContext };
|
|
554
|
+
export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppMatched, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, type EditorCommands, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, 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,10 +1,10 @@
|
|
|
1
|
-
import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics,
|
|
2
|
-
export { t as Adaptor, A as AppState, u as ArrayField, v as ArrayState, w as AsFieldProps, B as BaseData, x as BaseField, y as CacheOpts, z as ColorField,
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
1
|
+
import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, q as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, r as ItemSelector, s as PluginInternal } from './actions-C0LX6bI4.js';
|
|
2
|
+
export { t as Adaptor, A as AppState, u as ArrayField, v as ArrayState, w as AsFieldProps, B as BaseData, x as BaseField, y as CacheOpts, z as ColorField, g as ComponentConfig, G as ComponentConfigExtensions, J as ComponentConfigParams, K as ComponentDataMap, L as ComponentDataOptionalId, N as ComponentMetadata, Q as ConfigParams, j as Content, S as CustomField, T as CustomFieldRender, k as DefaultComponents, X as DefaultRootProps, Y as DefaultRootRenderProps, Z as Direction, _ as DragAxis, $ as EditorComponent, a0 as EditorContext, a1 as EditorMetadata, a2 as ExternalField, a3 as ExternalFieldWithAdaptor, a4 as ExtractConfigParams, a5 as ExtractField, a6 as FieldMetadata, a7 as FieldRenderFunctions, a8 as FieldTransformFn, a9 as FieldTransformFnParams, F as Fields, H as History, aa as ItemWithId, ab as MappedItem, ac as NumberField, ad as ObjectField, ae as OverrideKey, af as RadioField, ag as RichText, i as RichtextField, ah as RootConfig, n as RootData, R as RootDataWithProps, ai as RootDataWithoutProps, aj as SelectField, ak as Slot, al as SlotComponent, am as SlotField, an as TextField, ao as TextareaField, ap as Viewport, aq as WithChildren, ar as WithEditorProps, W as WithId, as as WithSlotProps, at as overrideKeys } from './actions-C0LX6bI4.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-B1q6t5Jp.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
|
|
7
|
-
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-
|
|
7
|
+
import { A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-DmThy7vE.js';
|
|
8
8
|
import '@tiptap/react';
|
|
9
9
|
import '@tiptap/extension-blockquote';
|
|
10
10
|
import '@tiptap/extension-bold';
|
|
@@ -30,17 +30,17 @@ import '@tiptap/extension-underline';
|
|
|
30
30
|
type GlobalsMap = NonNullable<Data["globals"]>;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* A
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* `
|
|
33
|
+
* A route key — the literal string used as a `pages` key in `<App>` and
|
|
34
|
+
* the picker entry in `<Editor routes>`. The same string flows through:
|
|
35
|
+
* - `pages={{ [routeKey]: pageData }}` declares the schema
|
|
36
|
+
* - `<Editor routes={[routeKey, ...]}>` powers the page picker
|
|
37
|
+
* - `<Editor currentPath={routeKey}>` marks the selected page
|
|
38
|
+
* - `onPublish(data, routeKey)` returns it for persistence
|
|
39
|
+
*
|
|
40
|
+
* Patterns follow path-to-regexp v8 / Express 5 syntax: "/", "/about",
|
|
41
|
+
* "/products/:handle", "/docs/*splat".
|
|
39
42
|
*/
|
|
40
|
-
type Route =
|
|
41
|
-
path: string;
|
|
42
|
-
title: string;
|
|
43
|
-
};
|
|
43
|
+
type Route = string;
|
|
44
44
|
|
|
45
45
|
declare const ActionBar: {
|
|
46
46
|
({ label, children, }: {
|
|
@@ -91,6 +91,135 @@ declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<Value
|
|
|
91
91
|
value: any;
|
|
92
92
|
}): react_jsx_runtime.JSX.Element | null;
|
|
93
93
|
|
|
94
|
+
/** A route key — the literal pattern used in `pages`. */
|
|
95
|
+
type RouteKey = string;
|
|
96
|
+
type AppMatched<Data = unknown> = {
|
|
97
|
+
/** The route key string — stable persistence identifier. */
|
|
98
|
+
route: RouteKey;
|
|
99
|
+
/** Concrete params extracted from the URL (e.g. { handle: "abc" }). */
|
|
100
|
+
params: Readonly<Record<string, string | undefined>>;
|
|
101
|
+
/** The page's data. */
|
|
102
|
+
data: Data;
|
|
103
|
+
};
|
|
104
|
+
type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
105
|
+
config: UserConfig;
|
|
106
|
+
pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
|
|
107
|
+
/** "/edit" by default; null disables editor mode entirely. */
|
|
108
|
+
editorPath: string | null;
|
|
109
|
+
};
|
|
110
|
+
declare const appConfigContext: react.Context<AppConfigContext<Config, UserGenerics<Config>> | null>;
|
|
111
|
+
type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
|
|
112
|
+
/** All page route keys, in declaration order. */
|
|
113
|
+
routes: RouteKey[];
|
|
114
|
+
/** Resolved current pathname from React Router. */
|
|
115
|
+
currentPath: string;
|
|
116
|
+
/** True when currentPath starts with editorPath. */
|
|
117
|
+
isEditing: boolean;
|
|
118
|
+
/** The URL relative to editorPath when isEditing — what pages are matched against. */
|
|
119
|
+
matchRoute: string;
|
|
120
|
+
/** Result of matching matchRoute against pages. Null = 404. */
|
|
121
|
+
matched: AppMatched<Partial<G["UserData"] | Data>> | null;
|
|
122
|
+
/** Navigate to a route key. Wraps with editorPath when editing. */
|
|
123
|
+
navigate: (route: RouteKey) => void;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Read the resolved route context. Combines config + pages + editorPath
|
|
127
|
+
* (from `<AppProvider>`) with the live location/navigation (from React Router).
|
|
128
|
+
*/
|
|
129
|
+
declare const useApp: <UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>() => AppContextValue<UserConfig, G>;
|
|
130
|
+
|
|
131
|
+
/** Which RR router variant to use on the client. SSR always uses StaticRouter. */
|
|
132
|
+
type AppRouterVariant = "browser" | "hash" | "memory";
|
|
133
|
+
type AppProviderProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
134
|
+
config: UserConfig;
|
|
135
|
+
pages: Record<RouteKey, Partial<G["UserData"] | Data>>;
|
|
136
|
+
/** Defaults to "/editor". Pass null to disable editor mode. */
|
|
137
|
+
editorPath?: string | null;
|
|
138
|
+
/** Client-side router variant. Defaults to "browser". */
|
|
139
|
+
router?: AppRouterVariant;
|
|
140
|
+
/**
|
|
141
|
+
* Initial pathname for SSR (StaticRouter) or MemoryRouter.
|
|
142
|
+
* Required during SSR so the first paint matches the requested URL.
|
|
143
|
+
* Ignored for BrowserRouter and HashRouter on the client (they read window).
|
|
144
|
+
*/
|
|
145
|
+
currentPath?: string;
|
|
146
|
+
children?: ReactNode;
|
|
147
|
+
};
|
|
148
|
+
declare function AppProvider<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, pages, editorPath, router, currentPath, children, }: AppProviderProps<UserConfig, G>): react_jsx_runtime.JSX.Element;
|
|
149
|
+
|
|
150
|
+
/** Editor pass-through props shared by <App> (default layout) and <App.Editor>. */
|
|
151
|
+
type EditorPassthroughProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
152
|
+
/** Called when the editor publishes. `route` is the schema route key. */
|
|
153
|
+
onPublish?: (data: G["UserData"], route?: string) => void;
|
|
154
|
+
onChange?: (data: G["UserData"]) => void;
|
|
155
|
+
onAction?: OnAction<G["UserData"]>;
|
|
156
|
+
ui?: Partial<UiState>;
|
|
157
|
+
plugins?: Plugin<UserConfig>[];
|
|
158
|
+
overrides?: Partial<Overrides<UserConfig>>;
|
|
159
|
+
fieldTransforms?: FieldTransforms<UserConfig>;
|
|
160
|
+
metadata?: Metadata;
|
|
161
|
+
iframe?: IframeConfig;
|
|
162
|
+
viewports?: Viewports;
|
|
163
|
+
permissions?: Partial<Permissions>;
|
|
164
|
+
renderHeader?: (props: {
|
|
165
|
+
children: ReactNode;
|
|
166
|
+
dispatch: (action: EditorAction) => void;
|
|
167
|
+
state: G["UserAppState"];
|
|
168
|
+
}) => ReactElement;
|
|
169
|
+
renderHeaderActions?: (props: {
|
|
170
|
+
state: G["UserAppState"];
|
|
171
|
+
dispatch: (action: EditorAction) => void;
|
|
172
|
+
}) => ReactElement;
|
|
173
|
+
title?: ReactNode;
|
|
174
|
+
dnd?: {
|
|
175
|
+
disableAutoScroll?: boolean;
|
|
176
|
+
};
|
|
177
|
+
initialHistory?: InitialHistory;
|
|
178
|
+
height?: CSSProperties["height"];
|
|
179
|
+
fullScreenCanvas?: boolean;
|
|
180
|
+
disableZoomControls?: boolean;
|
|
181
|
+
_experimentalVirtualization?: boolean;
|
|
182
|
+
};
|
|
183
|
+
type AppProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppProviderProps<UserConfig, G> & EditorPassthroughProps<UserConfig, G> & {
|
|
184
|
+
/** Optional custom not-found component — falls back to a built-in. */
|
|
185
|
+
renderNotFound?: () => ReactNode;
|
|
186
|
+
};
|
|
187
|
+
type AppRenderProps = {
|
|
188
|
+
metadata?: Metadata;
|
|
189
|
+
renderNotFound?: () => ReactNode;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Mounts <Render> for the current page when the URL is *not* under editorPath.
|
|
193
|
+
* Returns null while editing — safe to place anywhere inside <App>.
|
|
194
|
+
*/
|
|
195
|
+
declare function AppRender<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ metadata, renderNotFound }: AppRenderProps): react_jsx_runtime.JSX.Element | null;
|
|
196
|
+
type AppEditorProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = EditorPassthroughProps<UserConfig, G> & {
|
|
197
|
+
children?: ReactNode;
|
|
198
|
+
renderNotFound?: () => ReactNode;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Mounts <Editor> for the current page when the URL is under editorPath.
|
|
202
|
+
* Returns null otherwise. Children are forwarded to <Editor> for compositional
|
|
203
|
+
* UI (e.g. <Editor.Preview />, <Editor.Fields />).
|
|
204
|
+
*/
|
|
205
|
+
declare function AppEditor<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: AppEditorProps<UserConfig, G>): react_jsx_runtime.JSX.Element | null;
|
|
206
|
+
declare function App<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: AppProps<UserConfig, G>): react_jsx_runtime.JSX.Element;
|
|
207
|
+
declare namespace App {
|
|
208
|
+
var Render: typeof AppRender;
|
|
209
|
+
var Editor: typeof AppEditor;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Returns the schema-named params extracted from the current route.
|
|
214
|
+
*
|
|
215
|
+
* Designed for components rendered *inside* the schema (e.g. a ProductDetails
|
|
216
|
+
* block inside `pages["/products/:handle"]`) — they need `:handle` resolved
|
|
217
|
+
* by name. This is a typed re-export of React Router's `useParams()`.
|
|
218
|
+
*
|
|
219
|
+
* Returns `{}` when no page matched (404).
|
|
220
|
+
*/
|
|
221
|
+
declare const useRouteParams: <P extends Record<string, string | undefined> = Record<string, string | undefined>>() => Readonly<P>;
|
|
222
|
+
|
|
94
223
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
|
95
224
|
children: ReactNode;
|
|
96
225
|
href?: string;
|
|
@@ -161,7 +290,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
161
290
|
data: Partial<G["UserData"] | Data>;
|
|
162
291
|
ui?: Partial<UiState>;
|
|
163
292
|
onChange?: (data: G["UserData"]) => void;
|
|
164
|
-
onPublish?: (data: G["UserData"]) => void;
|
|
293
|
+
onPublish?: (data: G["UserData"], route?: string) => void;
|
|
165
294
|
onAction?: OnAction<G["UserData"]>;
|
|
166
295
|
permissions?: Partial<Permissions>;
|
|
167
296
|
plugins?: Plugin<UserConfig>[];
|
|
@@ -180,7 +309,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
180
309
|
headerPath?: string;
|
|
181
310
|
title?: ReactNode;
|
|
182
311
|
routes?: Route[];
|
|
183
|
-
|
|
312
|
+
currentRoute?: string;
|
|
184
313
|
onRouteChange?: (path: string) => void | Promise<void>;
|
|
185
314
|
viewports?: Viewports;
|
|
186
315
|
iframe?: IframeConfig;
|
|
@@ -284,6 +413,15 @@ declare const RichTextMenu: {
|
|
|
284
413
|
Underline: typeof Underline;
|
|
285
414
|
};
|
|
286
415
|
|
|
416
|
+
/**
|
|
417
|
+
* Returns a structurally-stable reference. Updates only when `value` deep-changes,
|
|
418
|
+
* so referentially-fresh-but-content-equal objects don't re-trigger downstream memos.
|
|
419
|
+
*
|
|
420
|
+
* Used inside `<AppProvider>` so that users passing inline `pages={{ ... }}` don't
|
|
421
|
+
* re-compile the route table on every parent render.
|
|
422
|
+
*/
|
|
423
|
+
declare const useStableValue: <T>(value: T) => T;
|
|
424
|
+
|
|
287
425
|
/**
|
|
288
426
|
* Framework-agnostic SEO output shape. Mirrors the subset of Next.js's
|
|
289
427
|
* Metadata type that most page builders care about — title, description,
|
|
@@ -413,4 +551,4 @@ declare const outlinePlugin: () => Plugin;
|
|
|
413
551
|
|
|
414
552
|
declare const legacySideBarPlugin: () => Plugin;
|
|
415
553
|
|
|
416
|
-
export { Action, ActionBar, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, type EditorCommands, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, Overrides, type PageMetadata, type Parent, Permissions, Plugin, Render, ResolveDataTrigger, RichTextMenu, type Route, Separator, UiState, type UseEditorData, UserGenerics, Viewports, blocksPlugin, createUseEditor, fieldsPlugin, legacySideBarPlugin, outlinePlugin, pageMetadata, registerOverlayPortal, renderContext, setDeep, useEditor, useGetEditor, usePropsContext };
|
|
554
|
+
export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type AppMatched, type AppProps, AppProvider, type AppProviderProps, type AppRenderProps, type AppRouterVariant, AutoField, Button, ComponentData, ComponentList, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, Editor, EditorAction, type EditorApi, type EditorCommands, Field, FieldLabel, FieldProps, FieldTransforms, type GlobalsMap, Group, IconButton, IframeConfig, InitialHistory, type InsertComponentArgs, Label, Metadata, type MoveDestination, OnAction, 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 };
|