@reacteditor/core 0.0.17 → 0.0.19
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-RY6D73N6.mjs → Editor-GVYZ7S5L.mjs} +6 -6
- package/dist/{Editor-4LPVLYSU.css → Editor-IRCQF4VT.css} +10 -16
- package/dist/{chunk-2A2HBRLV.mjs → chunk-BORTMJJZ.mjs} +3 -3
- package/dist/{chunk-C5G7WUBQ.mjs → chunk-DKFLK64M.mjs} +1 -1
- package/dist/{chunk-AXB6UJ2P.mjs → chunk-HWYAMQID.mjs} +57 -44
- package/dist/{chunk-CUGSM3PC.mjs → chunk-M36T7BWB.mjs} +1 -1
- package/dist/{chunk-NUBRSWFJ.mjs → chunk-MUBFR675.mjs} +18 -1
- package/dist/{chunk-OAOKQORI.mjs → chunk-MVJENRGK.mjs} +129 -28
- package/dist/{chunk-ESU6AYGB.mjs → chunk-PGSQPCM6.mjs} +1 -1
- package/dist/{full-7ABPY2WA.css → full-B5V3G4IY.css} +10 -16
- package/dist/{full-35622JEC.mjs → full-QWTPWHXQ.mjs} +5 -5
- package/dist/{index-BZRpxcwy.d.mts → index-DET4zR84.d.mts} +25 -1
- package/dist/{index-B_21fGrq.d.ts → index-YRgZBGas.d.ts} +25 -1
- package/dist/index.css +10 -16
- package/dist/index.d.mts +35 -20
- package/dist/index.d.ts +35 -20
- package/dist/index.js +183 -53
- package/dist/index.mjs +7 -7
- package/dist/internal.d.mts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/{loaded-I7V7FYES.mjs → loaded-BHRFTTT2.mjs} +2 -2
- package/dist/{loaded-GJMTZ3M5.mjs → loaded-HIFB4G2Q.mjs} +2 -2
- package/dist/{loaded-HGQBTPJQ.mjs → loaded-XKFARPER.mjs} +2 -2
- package/dist/no-external.css +10 -16
- package/dist/no-external.d.mts +2 -2
- package/dist/no-external.d.ts +2 -2
- package/dist/no-external.js +183 -53
- package/dist/no-external.mjs +7 -7
- package/package.json +2 -2
|
@@ -88,25 +88,19 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Loader/styles.module.css/#css-module-data */
|
|
91
|
-
@keyframes _loader-
|
|
92
|
-
|
|
93
|
-
transform: rotate(0deg)
|
|
91
|
+
@keyframes _loader-spin_6933g_1 {
|
|
92
|
+
from {
|
|
93
|
+
transform: rotate(0deg);
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
transform: rotate(
|
|
97
|
-
}
|
|
98
|
-
100% {
|
|
99
|
-
transform: rotate(360deg) scale(1);
|
|
95
|
+
to {
|
|
96
|
+
transform: rotate(360deg);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
display: inline-block;
|
|
108
|
-
animation: _loader-animation_nacdm_1 1s 0s infinite linear;
|
|
109
|
-
animation-fill-mode: both;
|
|
99
|
+
._Loader_6933g_10 {
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
animation: _loader-spin_6933g_1 1s linear infinite;
|
|
110
104
|
}
|
|
111
105
|
|
|
112
106
|
/* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/ActionBar/styles.module.css/#css-module-data */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LoadedRichTextMenuInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-MVJENRGK.mjs";
|
|
4
|
+
import "./chunk-M36T7BWB.mjs";
|
|
5
|
+
import "./chunk-PGSQPCM6.mjs";
|
|
6
|
+
import "./chunk-DKFLK64M.mjs";
|
|
7
|
+
import "./chunk-MUBFR675.mjs";
|
|
8
8
|
import "./chunk-M4JDRFYB.mjs";
|
|
9
9
|
import "./chunk-FTVOCMGV.mjs";
|
|
10
10
|
import "./chunk-DQU3HIP4.mjs";
|
|
@@ -69,6 +69,20 @@ type ZoomConfig = {
|
|
|
69
69
|
type ComponentState = Record<string, {
|
|
70
70
|
loadingCount: number;
|
|
71
71
|
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Routing descriptor for the page currently loaded in the editor. Mirrored
|
|
74
|
+
* from `useApp().route` by `<App>` and exposed via `useEditor((s) => s.route)`.
|
|
75
|
+
*/
|
|
76
|
+
type EditorRoute = {
|
|
77
|
+
/** Route key/pattern, e.g. "/posts/:handle". */
|
|
78
|
+
key: string;
|
|
79
|
+
/** Canonical page URL (editorPath stripped), e.g. "/posts/abc". */
|
|
80
|
+
path: string;
|
|
81
|
+
/** Concrete URL params extracted from the URL. */
|
|
82
|
+
params: Record<string, string | undefined>;
|
|
83
|
+
};
|
|
84
|
+
/** Publish callback signature — receives current data + route descriptor. */
|
|
85
|
+
type OnPublish<UserData = unknown> = (data: UserData, route: EditorRoute | null) => void | Promise<void>;
|
|
72
86
|
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
73
87
|
instanceId: string;
|
|
74
88
|
state: G["UserAppState"];
|
|
@@ -113,6 +127,16 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
|
|
|
113
127
|
id: string;
|
|
114
128
|
} | null;
|
|
115
129
|
scrollToComponent: (id: string) => void;
|
|
130
|
+
route: EditorRoute | null;
|
|
131
|
+
onPublish?: OnPublish<G["UserData"]>;
|
|
132
|
+
/** True while a `publish()` call is in flight. */
|
|
133
|
+
isPublishing: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Invoke the user's `onPublish` with the current data + route, awaiting
|
|
136
|
+
* the result. `isPublishing` flips true for the duration. No-op when
|
|
137
|
+
* `onPublish` isn't set.
|
|
138
|
+
*/
|
|
139
|
+
publish: () => Promise<void>;
|
|
116
140
|
};
|
|
117
141
|
|
|
118
|
-
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|
|
142
|
+
export type { AppStore as A, EditorRoute as E, GetPermissions as G, HistorySlice as H, OnPublish as O, RefreshPermissions as R };
|
|
@@ -69,6 +69,20 @@ type ZoomConfig = {
|
|
|
69
69
|
type ComponentState = Record<string, {
|
|
70
70
|
loadingCount: number;
|
|
71
71
|
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Routing descriptor for the page currently loaded in the editor. Mirrored
|
|
74
|
+
* from `useApp().route` by `<App>` and exposed via `useEditor((s) => s.route)`.
|
|
75
|
+
*/
|
|
76
|
+
type EditorRoute = {
|
|
77
|
+
/** Route key/pattern, e.g. "/posts/:handle". */
|
|
78
|
+
key: string;
|
|
79
|
+
/** Canonical page URL (editorPath stripped), e.g. "/posts/abc". */
|
|
80
|
+
path: string;
|
|
81
|
+
/** Concrete URL params extracted from the URL. */
|
|
82
|
+
params: Record<string, string | undefined>;
|
|
83
|
+
};
|
|
84
|
+
/** Publish callback signature — receives current data + route descriptor. */
|
|
85
|
+
type OnPublish<UserData = unknown> = (data: UserData, route: EditorRoute | null) => void | Promise<void>;
|
|
72
86
|
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
73
87
|
instanceId: string;
|
|
74
88
|
state: G["UserAppState"];
|
|
@@ -113,6 +127,16 @@ type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserCon
|
|
|
113
127
|
id: string;
|
|
114
128
|
} | null;
|
|
115
129
|
scrollToComponent: (id: string) => void;
|
|
130
|
+
route: EditorRoute | null;
|
|
131
|
+
onPublish?: OnPublish<G["UserData"]>;
|
|
132
|
+
/** True while a `publish()` call is in flight. */
|
|
133
|
+
isPublishing: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Invoke the user's `onPublish` with the current data + route, awaiting
|
|
136
|
+
* the result. `isPublishing` flips true for the duration. No-op when
|
|
137
|
+
* `onPublish` isn't set.
|
|
138
|
+
*/
|
|
139
|
+
publish: () => Promise<void>;
|
|
116
140
|
};
|
|
117
141
|
|
|
118
|
-
export type { AppStore as A, GetPermissions as G, HistorySlice as H, RefreshPermissions as R };
|
|
142
|
+
export type { AppStore as A, EditorRoute as E, GetPermissions as G, HistorySlice as H, OnPublish as O, RefreshPermissions as R };
|
package/dist/index.css
CHANGED
|
@@ -706,25 +706,19 @@ textarea._Input-input_zwh6e_27 {
|
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
/* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/Loader/styles.module.css/#css-module-data */
|
|
709
|
-
@keyframes _loader-
|
|
710
|
-
|
|
711
|
-
transform: rotate(0deg)
|
|
709
|
+
@keyframes _loader-spin_6933g_1 {
|
|
710
|
+
from {
|
|
711
|
+
transform: rotate(0deg);
|
|
712
712
|
}
|
|
713
|
-
|
|
714
|
-
transform: rotate(
|
|
715
|
-
}
|
|
716
|
-
100% {
|
|
717
|
-
transform: rotate(360deg) scale(1);
|
|
713
|
+
to {
|
|
714
|
+
transform: rotate(360deg);
|
|
718
715
|
}
|
|
719
716
|
}
|
|
720
|
-
.
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
display: inline-block;
|
|
726
|
-
animation: _loader-animation_nacdm_1 1s 0s infinite linear;
|
|
727
|
-
animation-fill-mode: both;
|
|
717
|
+
._Loader_6933g_10 {
|
|
718
|
+
display: inline-flex;
|
|
719
|
+
align-items: center;
|
|
720
|
+
justify-content: center;
|
|
721
|
+
animation: _loader-spin_6933g_1 1s linear infinite;
|
|
728
722
|
}
|
|
729
723
|
|
|
730
724
|
/* css-module:/Users/rami/Documents/apps/react-editor/packages/core/components/DragIcon/styles.module.css/#css-module-data */
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, q as EditorChromeConfig, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, r as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, s as ItemSelector, t as PluginInternal } from './actions-BxLinRKD.mjs';
|
|
2
2
|
export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, G as ColorField, g as ComponentConfig, J as ComponentConfigExtensions, K as ComponentConfigParams, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, k as DefaultComponents, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, a7 as FieldMetadata, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, F as Fields, H as History, ab as ItemWithId, ac as MappedItem, ad as NumberField, ae as ObjectField, af as OverrideKey, ag as RadioField, ah as RichText, i as RichtextField, ai as RootConfig, n as RootData, R as RootDataWithProps, aj as RootDataWithoutProps, ak as SelectField, al as Slot, am as SlotComponent, an as SlotField, ao as TextField, ap as TextareaField, aq as Viewport, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxLinRKD.mjs';
|
|
3
3
|
export { G as GetRoutePropsOptions, g as getRouteProps, m as migrate, r as resolveAllData, a as resolveRouteFromString, t as transformProps, w as walkTree } from './walk-tree-BvYigWFL.mjs';
|
|
4
|
+
import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-DET4zR84.mjs';
|
|
4
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
import * as react from 'react';
|
|
6
7
|
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-BZRpxcwy.mjs';
|
|
8
8
|
import '@tiptap/react';
|
|
9
9
|
import '@tiptap/extension-blockquote';
|
|
10
10
|
import '@tiptap/extension-bold';
|
|
@@ -34,8 +34,8 @@ type GlobalsMap = NonNullable<Data["globals"]>;
|
|
|
34
34
|
* the picker entry in `<Editor routes>`. The same string flows through:
|
|
35
35
|
* - `pages={{ [routeKey]: pageData }}` declares the schema
|
|
36
36
|
* - `<Editor routes={[routeKey, ...]}>` powers the page picker
|
|
37
|
-
* - `<Editor
|
|
38
|
-
* - `onPublish(data,
|
|
37
|
+
* - `<Editor route={{ key: routeKey, path, params }}>` marks the selected page
|
|
38
|
+
* - `onPublish(data, route)` returns the descriptor for persistence
|
|
39
39
|
*
|
|
40
40
|
* Patterns follow path-to-regexp v8 / Express 5 syntax: "/", "/about",
|
|
41
41
|
* "/products/:handle", "/docs/*splat".
|
|
@@ -93,13 +93,18 @@ declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<Value
|
|
|
93
93
|
|
|
94
94
|
/** A route key — the literal pattern used in `pages`. */
|
|
95
95
|
type RouteKey = string;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Routing descriptor for the current page. Pure routing info — no page data
|
|
98
|
+
* (use `pages[route.key]` for the static initial, or `useEditor((s) => s.appState.data)`
|
|
99
|
+
* for the live editor data).
|
|
100
|
+
*/
|
|
101
|
+
type AppRoute = {
|
|
102
|
+
/** Route key/pattern, e.g. "/posts/:handle". */
|
|
103
|
+
key: RouteKey;
|
|
104
|
+
/** Canonical page URL with `editorPath` stripped, e.g. "/posts/abc". */
|
|
105
|
+
path: string;
|
|
99
106
|
/** Concrete params extracted from the URL (e.g. { handle: "abc" }). */
|
|
100
107
|
params: Readonly<Record<string, string | undefined>>;
|
|
101
|
-
/** The page's data. */
|
|
102
|
-
data: Data;
|
|
103
108
|
};
|
|
104
109
|
type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
105
110
|
config: UserConfig;
|
|
@@ -111,14 +116,10 @@ declare const appConfigContext: react.Context<AppConfigContext<Config, UserGener
|
|
|
111
116
|
type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
|
|
112
117
|
/** All page route keys, in declaration order. */
|
|
113
118
|
routes: RouteKey[];
|
|
114
|
-
/**
|
|
115
|
-
currentPath: string;
|
|
116
|
-
/** True when currentPath starts with editorPath. */
|
|
119
|
+
/** True when the live URL is under `editorPath`. */
|
|
117
120
|
isEditing: boolean;
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
/** Result of matching matchRoute against pages. Null = 404. */
|
|
121
|
-
matched: AppMatched<Partial<G["UserData"] | Data>> | null;
|
|
121
|
+
/** Resolved routing descriptor for the current page. Null = 404. */
|
|
122
|
+
route: AppRoute | null;
|
|
122
123
|
/** Navigate to a route key. Wraps with editorPath when editing. */
|
|
123
124
|
navigate: (route: RouteKey) => void;
|
|
124
125
|
};
|
|
@@ -149,8 +150,8 @@ declare function AppProvider<UserConfig extends Config = Config, G extends UserG
|
|
|
149
150
|
|
|
150
151
|
/** Editor pass-through props shared by <App> (default layout) and <App.Editor>. */
|
|
151
152
|
type EditorPassthroughProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
152
|
-
/** Called when the editor publishes
|
|
153
|
-
onPublish?:
|
|
153
|
+
/** Called when the editor publishes — receives `(data, route)`. */
|
|
154
|
+
onPublish?: OnPublish<G["UserData"]>;
|
|
154
155
|
onChange?: (data: G["UserData"]) => void;
|
|
155
156
|
onAction?: OnAction<G["UserData"]>;
|
|
156
157
|
ui?: Partial<UiState> & Partial<EditorChromeConfig>;
|
|
@@ -296,7 +297,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
296
297
|
*/
|
|
297
298
|
ui?: Partial<UiState> & Partial<EditorChromeConfig>;
|
|
298
299
|
onChange?: (data: G["UserData"]) => void;
|
|
299
|
-
onPublish?:
|
|
300
|
+
onPublish?: OnPublish<G["UserData"]>;
|
|
300
301
|
onAction?: OnAction<G["UserData"]>;
|
|
301
302
|
permissions?: Partial<Permissions>;
|
|
302
303
|
plugins?: Plugin<UserConfig>[];
|
|
@@ -315,7 +316,12 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
315
316
|
headerPath?: string;
|
|
316
317
|
title?: ReactNode;
|
|
317
318
|
routes?: Route[];
|
|
318
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Routing descriptor for the page being edited. Mirrored into the editor
|
|
321
|
+
* store and exposed via `useEditor((s) => s.route)`. Set by `<App>` from
|
|
322
|
+
* `useApp().route`; usually omitted when mounting `<Editor>` standalone.
|
|
323
|
+
*/
|
|
324
|
+
route?: EditorRoute;
|
|
319
325
|
onRouteChange?: (path: string) => void | Promise<void>;
|
|
320
326
|
viewports?: Viewports;
|
|
321
327
|
iframe?: IframeConfig;
|
|
@@ -501,11 +507,20 @@ type EditorCommands = {
|
|
|
501
507
|
updateRoot: (updater: Partial<DefaultRootFieldProps> | ((prev: DefaultRootFieldProps) => Partial<DefaultRootFieldProps>)) => void;
|
|
502
508
|
selectComponent: (id: string | null) => void;
|
|
503
509
|
scrollToComponent: (id: string) => void;
|
|
510
|
+
/**
|
|
511
|
+
* Invoke the user's `onPublish` callback with the current editor data and
|
|
512
|
+
* route descriptor. No-op when `onPublish` isn't set on the Editor.
|
|
513
|
+
*/
|
|
514
|
+
publish: () => void;
|
|
504
515
|
};
|
|
505
516
|
|
|
506
517
|
type UseEditorData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = EditorCommands & {
|
|
507
518
|
appState: G["UserPublicAppState"];
|
|
508
519
|
config: UserConfig;
|
|
520
|
+
/** Routing descriptor for the page being edited. Null when standalone or 404. */
|
|
521
|
+
route: EditorRoute | null;
|
|
522
|
+
/** True while a `publish()` call is in flight. */
|
|
523
|
+
isPublishing: boolean;
|
|
509
524
|
dispatch: AppStore["dispatch"];
|
|
510
525
|
getPermissions: GetPermissions<UserConfig>;
|
|
511
526
|
refreshPermissions: RefreshPermissions<UserConfig>;
|
|
@@ -557,4 +572,4 @@ declare const outlinePlugin: () => Plugin;
|
|
|
557
572
|
|
|
558
573
|
declare const legacySideBarPlugin: () => Plugin;
|
|
559
574
|
|
|
560
|
-
export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { D as Data, o as Field, p as FieldProps, C as Config, U as UserGenerics, O as OnAction, f as UiState, q as EditorChromeConfig, d as Plugin, e as Overrides, h as FieldTransforms, M as Metadata, I as IframeConfig, V as Viewports, a as Permissions, E as EditorAction, r as InitialHistory, b as ComponentData, l as DefaultComponentProps, m as DefaultRootFieldProps, c as ResolveDataTrigger, s as ItemSelector, t as PluginInternal } from './actions-BxLinRKD.js';
|
|
2
2
|
export { u as Adaptor, A as AppState, v as ArrayField, w as ArrayState, x as AsFieldProps, B as BaseData, y as BaseField, z as CacheOpts, G as ColorField, g as ComponentConfig, J as ComponentConfigExtensions, K as ComponentConfigParams, L as ComponentDataMap, N as ComponentDataOptionalId, Q as ComponentMetadata, S as ConfigParams, j as Content, T as CustomField, X as CustomFieldRender, k as DefaultComponents, Y as DefaultRootProps, Z as DefaultRootRenderProps, _ as Direction, $ as DragAxis, a0 as EditorComponent, a1 as EditorContext, a2 as EditorMetadata, a3 as ExternalField, a4 as ExternalFieldWithAdaptor, a5 as ExtractConfigParams, a6 as ExtractField, a7 as FieldMetadata, a8 as FieldRenderFunctions, a9 as FieldTransformFn, aa as FieldTransformFnParams, F as Fields, H as History, ab as ItemWithId, ac as MappedItem, ad as NumberField, ae as ObjectField, af as OverrideKey, ag as RadioField, ah as RichText, i as RichtextField, ai as RootConfig, n as RootData, R as RootDataWithProps, aj as RootDataWithoutProps, ak as SelectField, al as Slot, am as SlotComponent, an as SlotField, ao as TextField, ap as TextareaField, aq as Viewport, ar as WithChildren, as as WithEditorProps, W as WithId, at as WithSlotProps, au as overrideKeys } from './actions-BxLinRKD.js';
|
|
3
3
|
export { G as GetRoutePropsOptions, g as getRouteProps, m as migrate, r as resolveAllData, a as resolveRouteFromString, t as transformProps, w as walkTree } from './walk-tree-Clklc1Ql.js';
|
|
4
|
+
import { O as OnPublish, E as EditorRoute, A as AppStore, G as GetPermissions, R as RefreshPermissions, H as HistorySlice } from './index-YRgZBGas.js';
|
|
4
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
import * as react from 'react';
|
|
6
7
|
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-B_21fGrq.js';
|
|
8
8
|
import '@tiptap/react';
|
|
9
9
|
import '@tiptap/extension-blockquote';
|
|
10
10
|
import '@tiptap/extension-bold';
|
|
@@ -34,8 +34,8 @@ type GlobalsMap = NonNullable<Data["globals"]>;
|
|
|
34
34
|
* the picker entry in `<Editor routes>`. The same string flows through:
|
|
35
35
|
* - `pages={{ [routeKey]: pageData }}` declares the schema
|
|
36
36
|
* - `<Editor routes={[routeKey, ...]}>` powers the page picker
|
|
37
|
-
* - `<Editor
|
|
38
|
-
* - `onPublish(data,
|
|
37
|
+
* - `<Editor route={{ key: routeKey, path, params }}>` marks the selected page
|
|
38
|
+
* - `onPublish(data, route)` returns the descriptor for persistence
|
|
39
39
|
*
|
|
40
40
|
* Patterns follow path-to-regexp v8 / Express 5 syntax: "/", "/about",
|
|
41
41
|
* "/products/:handle", "/docs/*splat".
|
|
@@ -93,13 +93,18 @@ declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<Value
|
|
|
93
93
|
|
|
94
94
|
/** A route key — the literal pattern used in `pages`. */
|
|
95
95
|
type RouteKey = string;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Routing descriptor for the current page. Pure routing info — no page data
|
|
98
|
+
* (use `pages[route.key]` for the static initial, or `useEditor((s) => s.appState.data)`
|
|
99
|
+
* for the live editor data).
|
|
100
|
+
*/
|
|
101
|
+
type AppRoute = {
|
|
102
|
+
/** Route key/pattern, e.g. "/posts/:handle". */
|
|
103
|
+
key: RouteKey;
|
|
104
|
+
/** Canonical page URL with `editorPath` stripped, e.g. "/posts/abc". */
|
|
105
|
+
path: string;
|
|
99
106
|
/** Concrete params extracted from the URL (e.g. { handle: "abc" }). */
|
|
100
107
|
params: Readonly<Record<string, string | undefined>>;
|
|
101
|
-
/** The page's data. */
|
|
102
|
-
data: Data;
|
|
103
108
|
};
|
|
104
109
|
type AppConfigContext<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
105
110
|
config: UserConfig;
|
|
@@ -111,14 +116,10 @@ declare const appConfigContext: react.Context<AppConfigContext<Config, UserGener
|
|
|
111
116
|
type AppContextValue<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = AppConfigContext<UserConfig, G> & {
|
|
112
117
|
/** All page route keys, in declaration order. */
|
|
113
118
|
routes: RouteKey[];
|
|
114
|
-
/**
|
|
115
|
-
currentPath: string;
|
|
116
|
-
/** True when currentPath starts with editorPath. */
|
|
119
|
+
/** True when the live URL is under `editorPath`. */
|
|
117
120
|
isEditing: boolean;
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
/** Result of matching matchRoute against pages. Null = 404. */
|
|
121
|
-
matched: AppMatched<Partial<G["UserData"] | Data>> | null;
|
|
121
|
+
/** Resolved routing descriptor for the current page. Null = 404. */
|
|
122
|
+
route: AppRoute | null;
|
|
122
123
|
/** Navigate to a route key. Wraps with editorPath when editing. */
|
|
123
124
|
navigate: (route: RouteKey) => void;
|
|
124
125
|
};
|
|
@@ -149,8 +150,8 @@ declare function AppProvider<UserConfig extends Config = Config, G extends UserG
|
|
|
149
150
|
|
|
150
151
|
/** Editor pass-through props shared by <App> (default layout) and <App.Editor>. */
|
|
151
152
|
type EditorPassthroughProps<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
|
152
|
-
/** Called when the editor publishes
|
|
153
|
-
onPublish?:
|
|
153
|
+
/** Called when the editor publishes — receives `(data, route)`. */
|
|
154
|
+
onPublish?: OnPublish<G["UserData"]>;
|
|
154
155
|
onChange?: (data: G["UserData"]) => void;
|
|
155
156
|
onAction?: OnAction<G["UserData"]>;
|
|
156
157
|
ui?: Partial<UiState> & Partial<EditorChromeConfig>;
|
|
@@ -296,7 +297,7 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
296
297
|
*/
|
|
297
298
|
ui?: Partial<UiState> & Partial<EditorChromeConfig>;
|
|
298
299
|
onChange?: (data: G["UserData"]) => void;
|
|
299
|
-
onPublish?:
|
|
300
|
+
onPublish?: OnPublish<G["UserData"]>;
|
|
300
301
|
onAction?: OnAction<G["UserData"]>;
|
|
301
302
|
permissions?: Partial<Permissions>;
|
|
302
303
|
plugins?: Plugin<UserConfig>[];
|
|
@@ -315,7 +316,12 @@ type EditorProps<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
|
315
316
|
headerPath?: string;
|
|
316
317
|
title?: ReactNode;
|
|
317
318
|
routes?: Route[];
|
|
318
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Routing descriptor for the page being edited. Mirrored into the editor
|
|
321
|
+
* store and exposed via `useEditor((s) => s.route)`. Set by `<App>` from
|
|
322
|
+
* `useApp().route`; usually omitted when mounting `<Editor>` standalone.
|
|
323
|
+
*/
|
|
324
|
+
route?: EditorRoute;
|
|
319
325
|
onRouteChange?: (path: string) => void | Promise<void>;
|
|
320
326
|
viewports?: Viewports;
|
|
321
327
|
iframe?: IframeConfig;
|
|
@@ -501,11 +507,20 @@ type EditorCommands = {
|
|
|
501
507
|
updateRoot: (updater: Partial<DefaultRootFieldProps> | ((prev: DefaultRootFieldProps) => Partial<DefaultRootFieldProps>)) => void;
|
|
502
508
|
selectComponent: (id: string | null) => void;
|
|
503
509
|
scrollToComponent: (id: string) => void;
|
|
510
|
+
/**
|
|
511
|
+
* Invoke the user's `onPublish` callback with the current editor data and
|
|
512
|
+
* route descriptor. No-op when `onPublish` isn't set on the Editor.
|
|
513
|
+
*/
|
|
514
|
+
publish: () => void;
|
|
504
515
|
};
|
|
505
516
|
|
|
506
517
|
type UseEditorData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = EditorCommands & {
|
|
507
518
|
appState: G["UserPublicAppState"];
|
|
508
519
|
config: UserConfig;
|
|
520
|
+
/** Routing descriptor for the page being edited. Null when standalone or 404. */
|
|
521
|
+
route: EditorRoute | null;
|
|
522
|
+
/** True while a `publish()` call is in flight. */
|
|
523
|
+
isPublishing: boolean;
|
|
509
524
|
dispatch: AppStore["dispatch"];
|
|
510
525
|
getPermissions: GetPermissions<UserConfig>;
|
|
511
526
|
refreshPermissions: RefreshPermissions<UserConfig>;
|
|
@@ -557,4 +572,4 @@ declare const outlinePlugin: () => Plugin;
|
|
|
557
572
|
|
|
558
573
|
declare const legacySideBarPlugin: () => Plugin;
|
|
559
574
|
|
|
560
|
-
export { Action, ActionBar, App, type AppContextValue, type AppEditorProps, type
|
|
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 };
|