@reacteditor/core 0.0.9 → 0.0.10
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-KXEVJBNG.mjs → Editor-3COFH5WN.mjs} +3 -3
- package/dist/{actions-2L-1hQ7r.d.mts → actions-B8_EA7vy.d.mts} +1 -1
- package/dist/{actions-2L-1hQ7r.d.ts → actions-B8_EA7vy.d.ts} +1 -1
- package/dist/{chunk-DU757QEH.mjs → chunk-3IP22OOD.mjs} +307 -33
- package/dist/{chunk-AJWRDM22.mjs → chunk-BZ4BQZJR.mjs} +4 -4
- package/dist/{chunk-TI3KC54Y.mjs → chunk-PUDWMFBH.mjs} +46 -0
- package/dist/{full-ZFZZ626B.mjs → full-QT5KXRDP.mjs} +2 -2
- package/dist/{index-BNsSzMCj.d.ts → index-BrHy0cc_.d.ts} +1 -1
- package/dist/{index-BXuSeNez.d.mts → index-JoD48fK_.d.mts} +1 -1
- package/dist/index.css +84 -84
- package/dist/index.d.mts +110 -17
- package/dist/index.d.ts +110 -17
- package/dist/index.js +990 -663
- package/dist/index.mjs +27 -11
- package/dist/internal.d.mts +2 -2
- package/dist/internal.d.ts +2 -2
- 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 +84 -84
- package/dist/no-external.d.mts +4 -4
- package/dist/no-external.d.ts +4 -4
- package/dist/no-external.js +990 -663
- package/dist/no-external.mjs +27 -11
- 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 +48 -0
- package/dist/rsc.mjs +5 -1
- package/dist/{walk-tree-4C3ODO3X.d.mts → walk-tree-BR2XIZ0W.d.mts} +33 -2
- package/dist/{walk-tree-C9GrSWsR.d.ts → walk-tree-DpUJ9kDx.d.ts} +33 -2
- package/package.json +14 -3
- package/dist/{chunk-U7VW3V3W.mjs → chunk-BUR5T7IX.mjs} +3 -3
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
EditorInner,
|
|
6
6
|
LoadedRichTextMenu
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BZ4BQZJR.mjs";
|
|
8
|
+
import "./chunk-BUR5T7IX.mjs";
|
|
9
|
+
import "./chunk-FT6UFK7G.mjs";
|
|
8
10
|
import "./chunk-6QJ2HF4O.mjs";
|
|
9
|
-
import "./chunk-U7VW3V3W.mjs";
|
|
10
11
|
import "./chunk-OIFPBVSF.mjs";
|
|
11
12
|
import "./chunk-AD7BMXAA.mjs";
|
|
12
|
-
import "./chunk-FT6UFK7G.mjs";
|
|
13
13
|
import {
|
|
14
14
|
useAppStore,
|
|
15
15
|
useAppStoreApi
|
|
@@ -856,4 +856,4 @@ type EditorAction = {
|
|
|
856
856
|
recordHistory?: boolean;
|
|
857
857
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
858
858
|
|
|
859
|
-
export { type EditorComponent as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type EditorAction as E, type Fields as F, type ComponentConfigExtensions as G, type History as H, type IframeConfig as I, type ComponentConfigParams as J, type ComponentDataMap as K, type ComponentDataOptionalId as L, type Metadata as M, type ComponentMetadata as N, type OnAction as O, type PrivateAppState as P, type ConfigParams as Q, type
|
|
859
|
+
export { type EditorComponent as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type EditorAction as E, type Fields as F, type ComponentConfigExtensions as G, type History as H, type IframeConfig as I, type ComponentConfigParams as J, type ComponentDataMap as K, type ComponentDataOptionalId as L, type Metadata as M, type ComponentMetadata as N, type OnAction as O, type PrivateAppState as P, type ConfigParams as Q, type RootDataWithProps as R, type CustomField as S, type CustomFieldRender as T, type UserGenerics as U, type Viewports as V, type WithId as W, type DefaultRootProps as X, type DefaultRootRenderProps as Y, type Direction as Z, type DragAxis as _, type Permissions as a, type EditorContext as a0, type EditorMetadata as a1, type ExternalField as a2, type ExternalFieldWithAdaptor as a3, type ExtractConfigParams as a4, type ExtractField as a5, type FieldMetadata as a6, type FieldRenderFunctions as a7, type FieldTransformFn as a8, type FieldTransformFnParams as a9, type ItemWithId as aa, type MappedItem as ab, type NumberField as ac, type ObjectField as ad, type OverrideKey as ae, type RadioField as af, type RichText as ag, type RootConfig as ah, type RootDataWithoutProps as ai, type SelectField as aj, type Slot as ak, type SlotComponent as al, type SlotField as am, type TextField as an, type TextareaField as ao, type Viewport as ap, type WithChildren as aq, type WithEditorProps as ar, type WithSlotProps as as, overrideKeys as at, type ComponentData as b, type ResolveDataTrigger as c, type Plugin as d, type Overrides as e, type UiState as f, type ComponentConfig as g, type FieldTransforms as h, type RichtextField as i, type Content as j, type DefaultComponents as k, type DefaultComponentProps as l, type DefaultRootFieldProps as m, type RootData as n, type Field as o, type FieldProps as p, type InitialHistory as q, type ItemSelector as r, type PluginInternal as s, type Adaptor as t, type ArrayField as u, type ArrayState as v, type AsFieldProps as w, type BaseField as x, type CacheOpts as y, type ColorField as z };
|
|
@@ -856,4 +856,4 @@ type EditorAction = {
|
|
|
856
856
|
recordHistory?: boolean;
|
|
857
857
|
} & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
|
|
858
858
|
|
|
859
|
-
export { type EditorComponent as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type EditorAction as E, type Fields as F, type ComponentConfigExtensions as G, type History as H, type IframeConfig as I, type ComponentConfigParams as J, type ComponentDataMap as K, type ComponentDataOptionalId as L, type Metadata as M, type ComponentMetadata as N, type OnAction as O, type PrivateAppState as P, type ConfigParams as Q, type
|
|
859
|
+
export { type EditorComponent as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type EditorAction as E, type Fields as F, type ComponentConfigExtensions as G, type History as H, type IframeConfig as I, type ComponentConfigParams as J, type ComponentDataMap as K, type ComponentDataOptionalId as L, type Metadata as M, type ComponentMetadata as N, type OnAction as O, type PrivateAppState as P, type ConfigParams as Q, type RootDataWithProps as R, type CustomField as S, type CustomFieldRender as T, type UserGenerics as U, type Viewports as V, type WithId as W, type DefaultRootProps as X, type DefaultRootRenderProps as Y, type Direction as Z, type DragAxis as _, type Permissions as a, type EditorContext as a0, type EditorMetadata as a1, type ExternalField as a2, type ExternalFieldWithAdaptor as a3, type ExtractConfigParams as a4, type ExtractField as a5, type FieldMetadata as a6, type FieldRenderFunctions as a7, type FieldTransformFn as a8, type FieldTransformFnParams as a9, type ItemWithId as aa, type MappedItem as ab, type NumberField as ac, type ObjectField as ad, type OverrideKey as ae, type RadioField as af, type RichText as ag, type RootConfig as ah, type RootDataWithoutProps as ai, type SelectField as aj, type Slot as ak, type SlotComponent as al, type SlotField as am, type TextField as an, type TextareaField as ao, type Viewport as ap, type WithChildren as aq, type WithEditorProps as ar, type WithSlotProps as as, overrideKeys as at, type ComponentData as b, type ResolveDataTrigger as c, type Plugin as d, type Overrides as e, type UiState as f, type ComponentConfig as g, type FieldTransforms as h, type RichtextField as i, type Content as j, type DefaultComponents as k, type DefaultComponentProps as l, type DefaultRootFieldProps as m, type RootData as n, type Field as o, type FieldProps as p, type InitialHistory as q, type ItemSelector as r, type PluginInternal as s, type Adaptor as t, type ArrayField as u, type ArrayState as v, type AsFieldProps as w, type BaseField as x, type CacheOpts as y, type ColorField as z };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorInner,
|
|
3
3
|
LoadedRichTextMenu
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BZ4BQZJR.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ActionBar,
|
|
7
|
+
IconButton,
|
|
8
|
+
LoadedRichTextMenuInner,
|
|
9
|
+
Loader
|
|
10
|
+
} from "./chunk-BUR5T7IX.mjs";
|
|
5
11
|
import {
|
|
6
12
|
RichTextRenderFallback,
|
|
7
13
|
SlotRender,
|
|
@@ -10,13 +16,7 @@ import {
|
|
|
10
16
|
getSlotTransform,
|
|
11
17
|
useRichtextProps,
|
|
12
18
|
useSlots
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
ActionBar,
|
|
16
|
-
IconButton,
|
|
17
|
-
LoadedRichTextMenuInner,
|
|
18
|
-
Loader
|
|
19
|
-
} from "./chunk-U7VW3V3W.mjs";
|
|
19
|
+
} from "./chunk-PUDWMFBH.mjs";
|
|
20
20
|
import {
|
|
21
21
|
Check,
|
|
22
22
|
ChevronDown,
|
|
@@ -2146,7 +2146,7 @@ EditorFallback.displayName = "EditorFallback";
|
|
|
2146
2146
|
// components/AutoField/fields/RichtextField/index.tsx
|
|
2147
2147
|
import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
|
|
2148
2148
|
var Editor = lazy(
|
|
2149
|
-
() => import("./Editor-
|
|
2149
|
+
() => import("./Editor-3COFH5WN.mjs").then((m) => ({
|
|
2150
2150
|
default: m.Editor
|
|
2151
2151
|
}))
|
|
2152
2152
|
);
|
|
@@ -4698,7 +4698,7 @@ import {
|
|
|
4698
4698
|
} from "react";
|
|
4699
4699
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4700
4700
|
var Editor2 = lazy2(
|
|
4701
|
-
() => import("./Editor-
|
|
4701
|
+
() => import("./Editor-3COFH5WN.mjs").then((m) => ({
|
|
4702
4702
|
default: m.Editor
|
|
4703
4703
|
}))
|
|
4704
4704
|
);
|
|
@@ -7662,7 +7662,7 @@ var DEVICE_VIEWPORTS = {
|
|
|
7662
7662
|
var BrowserBar = ({
|
|
7663
7663
|
onViewportChange
|
|
7664
7664
|
}) => {
|
|
7665
|
-
const { routes,
|
|
7665
|
+
const { routes, currentRoute, onRouteChange } = usePropsContext();
|
|
7666
7666
|
const viewports = useAppStore((s) => s.state.ui.viewports);
|
|
7667
7667
|
const dispatch = useAppStore((s) => s.dispatch);
|
|
7668
7668
|
const leftSideBarVisible = useAppStore((s) => s.state.ui.leftSideBarVisible);
|
|
@@ -7688,24 +7688,24 @@ var BrowserBar = ({
|
|
|
7688
7688
|
const setDevice = (device) => {
|
|
7689
7689
|
onViewportChange == null ? void 0 : onViewportChange(DEVICE_VIEWPORTS[device]);
|
|
7690
7690
|
};
|
|
7691
|
-
const showRoutePicker = !!routes &&
|
|
7692
|
-
const [inputValue, setInputValue] = useState20(
|
|
7693
|
-
const lastSyncedPath = useRef13(
|
|
7694
|
-
if (lastSyncedPath.current !==
|
|
7695
|
-
lastSyncedPath.current =
|
|
7696
|
-
setInputValue(
|
|
7691
|
+
const showRoutePicker = !!routes && currentRoute !== void 0 && !!onRouteChange;
|
|
7692
|
+
const [inputValue, setInputValue] = useState20(currentRoute != null ? currentRoute : "");
|
|
7693
|
+
const lastSyncedPath = useRef13(currentRoute);
|
|
7694
|
+
if (lastSyncedPath.current !== currentRoute) {
|
|
7695
|
+
lastSyncedPath.current = currentRoute;
|
|
7696
|
+
setInputValue(currentRoute != null ? currentRoute : "");
|
|
7697
7697
|
}
|
|
7698
7698
|
const submit = (raw) => {
|
|
7699
7699
|
const next = normalizeRoute(raw);
|
|
7700
|
-
if (!next || next ===
|
|
7700
|
+
if (!next || next === currentRoute) return;
|
|
7701
7701
|
void (onRouteChange == null ? void 0 : onRouteChange(next));
|
|
7702
7702
|
};
|
|
7703
7703
|
return /* @__PURE__ */ jsxs20("div", { className: getClassName30(), children: [
|
|
7704
7704
|
showRoutePicker ? /* @__PURE__ */ jsxs20(
|
|
7705
7705
|
Combobox,
|
|
7706
7706
|
{
|
|
7707
|
-
items: routes
|
|
7708
|
-
value:
|
|
7707
|
+
items: routes,
|
|
7708
|
+
value: currentRoute,
|
|
7709
7709
|
onValueChange: (next) => {
|
|
7710
7710
|
if (typeof next === "string") submit(next);
|
|
7711
7711
|
},
|
|
@@ -7738,13 +7738,7 @@ var BrowserBar = ({
|
|
|
7738
7738
|
),
|
|
7739
7739
|
/* @__PURE__ */ jsxs20(ComboboxContent, { children: [
|
|
7740
7740
|
/* @__PURE__ */ jsx49(ComboboxEmpty, { children: "Press Enter to go to this path" }),
|
|
7741
|
-
/* @__PURE__ */ jsx49(ComboboxList, { children: (path) => {
|
|
7742
|
-
const route = routes.find((r) => r.path === path);
|
|
7743
|
-
return /* @__PURE__ */ jsxs20(ComboboxItem, { value: path, children: [
|
|
7744
|
-
/* @__PURE__ */ jsx49("span", { className: getClassName30("itemPath"), children: path }),
|
|
7745
|
-
(route == null ? void 0 : route.title) ? /* @__PURE__ */ jsx49("span", { className: getClassName30("itemTitle"), children: route.title }) : null
|
|
7746
|
-
] }, path);
|
|
7747
|
-
} })
|
|
7741
|
+
/* @__PURE__ */ jsx49(ComboboxList, { children: (path) => /* @__PURE__ */ jsx49(ComboboxItem, { value: path, children: /* @__PURE__ */ jsx49("span", { className: getClassName30("itemPath"), children: path }) }, path) })
|
|
7748
7742
|
] })
|
|
7749
7743
|
]
|
|
7750
7744
|
}
|
|
@@ -8456,7 +8450,7 @@ var getLayoutClassName = get_class_name_factory_default("EditorLayout", styles_m
|
|
|
8456
8450
|
var getPluginTabClassName = get_class_name_factory_default("EditorPluginTab", styles_module_default23);
|
|
8457
8451
|
var FieldSideBarToolbar = () => {
|
|
8458
8452
|
const appStore = useAppStoreApi();
|
|
8459
|
-
const { onPublish } = usePropsContext();
|
|
8453
|
+
const { onPublish, currentRoute } = usePropsContext();
|
|
8460
8454
|
const back = useAppStore((s) => s.history.back);
|
|
8461
8455
|
const forward = useAppStore((s) => s.history.forward);
|
|
8462
8456
|
const hasFuture = useAppStore((s) => s.history.hasFuture());
|
|
@@ -8492,7 +8486,7 @@ var FieldSideBarToolbar = () => {
|
|
|
8492
8486
|
{
|
|
8493
8487
|
onClick: () => {
|
|
8494
8488
|
const data = appStore.getState().state.data;
|
|
8495
|
-
onPublish && onPublish(data);
|
|
8489
|
+
onPublish && onPublish(data, currentRoute);
|
|
8496
8490
|
},
|
|
8497
8491
|
children: "Publish"
|
|
8498
8492
|
}
|
|
@@ -9073,6 +9067,280 @@ Editor3.Layout = Layout;
|
|
|
9073
9067
|
Editor3.Outline = Outline;
|
|
9074
9068
|
Editor3.Preview = Preview2;
|
|
9075
9069
|
|
|
9070
|
+
// lib/use-stable-value.ts
|
|
9071
|
+
init_react_import();
|
|
9072
|
+
import { useRef as useRef20 } from "react";
|
|
9073
|
+
import { deepEqual as deepEqual3 } from "fast-equals";
|
|
9074
|
+
var useStableValue = (value) => {
|
|
9075
|
+
const ref = useRef20(value);
|
|
9076
|
+
if (!deepEqual3(ref.current, value)) {
|
|
9077
|
+
ref.current = value;
|
|
9078
|
+
}
|
|
9079
|
+
return ref.current;
|
|
9080
|
+
};
|
|
9081
|
+
|
|
9082
|
+
// components/App/context.ts
|
|
9083
|
+
init_react_import();
|
|
9084
|
+
import { createContext as createContext9, useContext as useContext16, useMemo as useMemo25 } from "react";
|
|
9085
|
+
import { matchRoutes, useLocation, useNavigate } from "react-router";
|
|
9086
|
+
var appConfigContext = createContext9(null);
|
|
9087
|
+
var useAppConfigContext = () => {
|
|
9088
|
+
const ctx = useContext16(appConfigContext);
|
|
9089
|
+
if (!ctx) {
|
|
9090
|
+
throw new Error("useApp must be called inside an <AppProvider> or <App>");
|
|
9091
|
+
}
|
|
9092
|
+
return ctx;
|
|
9093
|
+
};
|
|
9094
|
+
var stripPrefix = (path, prefix) => {
|
|
9095
|
+
if (path === prefix) return "/";
|
|
9096
|
+
if (!path.startsWith(`${prefix}/`)) return path;
|
|
9097
|
+
const rest = path.slice(prefix.length);
|
|
9098
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
9099
|
+
};
|
|
9100
|
+
var useApp = () => {
|
|
9101
|
+
const cfg = useAppConfigContext();
|
|
9102
|
+
const location = useLocation();
|
|
9103
|
+
const rrNavigate = useNavigate();
|
|
9104
|
+
const currentPath = location.pathname || "/";
|
|
9105
|
+
const isEditing = cfg.editorPath !== null && (currentPath === cfg.editorPath || currentPath.startsWith(`${cfg.editorPath}/`));
|
|
9106
|
+
const matchRoute = isEditing ? stripPrefix(currentPath, cfg.editorPath) : currentPath;
|
|
9107
|
+
const matched = useMemo25(() => {
|
|
9108
|
+
const routeKeys = Object.keys(cfg.pages);
|
|
9109
|
+
if (routeKeys.length === 0) return null;
|
|
9110
|
+
const matches = matchRoutes(
|
|
9111
|
+
routeKeys.map((path) => ({ path })),
|
|
9112
|
+
matchRoute
|
|
9113
|
+
);
|
|
9114
|
+
if (!matches || matches.length === 0) return null;
|
|
9115
|
+
const last = matches[matches.length - 1];
|
|
9116
|
+
const key = last.route.path;
|
|
9117
|
+
return {
|
|
9118
|
+
route: key,
|
|
9119
|
+
params: last.params,
|
|
9120
|
+
data: cfg.pages[key]
|
|
9121
|
+
};
|
|
9122
|
+
}, [cfg.pages, matchRoute]);
|
|
9123
|
+
const routes = useMemo25(() => Object.keys(cfg.pages), [cfg.pages]);
|
|
9124
|
+
const navigate = (route) => {
|
|
9125
|
+
const target = isEditing && cfg.editorPath ? `${cfg.editorPath}${route === "/" ? "" : route}` || "/" : route;
|
|
9126
|
+
rrNavigate(target || "/");
|
|
9127
|
+
};
|
|
9128
|
+
return __spreadProps(__spreadValues({}, cfg), {
|
|
9129
|
+
routes,
|
|
9130
|
+
currentPath,
|
|
9131
|
+
isEditing,
|
|
9132
|
+
matchRoute,
|
|
9133
|
+
matched,
|
|
9134
|
+
navigate
|
|
9135
|
+
});
|
|
9136
|
+
};
|
|
9137
|
+
|
|
9138
|
+
// components/App/AppProvider.tsx
|
|
9139
|
+
init_react_import();
|
|
9140
|
+
import { useMemo as useMemo26 } from "react";
|
|
9141
|
+
import {
|
|
9142
|
+
BrowserRouter,
|
|
9143
|
+
HashRouter,
|
|
9144
|
+
MemoryRouter,
|
|
9145
|
+
StaticRouter
|
|
9146
|
+
} from "react-router";
|
|
9147
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
9148
|
+
var EDITOR_PATH = "/editor";
|
|
9149
|
+
var isServer = typeof window === "undefined";
|
|
9150
|
+
function AppProvider({
|
|
9151
|
+
config,
|
|
9152
|
+
pages,
|
|
9153
|
+
editorPath = EDITOR_PATH,
|
|
9154
|
+
router = "browser",
|
|
9155
|
+
currentPath,
|
|
9156
|
+
children
|
|
9157
|
+
}) {
|
|
9158
|
+
const stablePages = useStableValue(pages);
|
|
9159
|
+
const resolvedEditorPath = editorPath === null ? null : editorPath || EDITOR_PATH;
|
|
9160
|
+
const ctxValue = useMemo26(
|
|
9161
|
+
() => ({
|
|
9162
|
+
config,
|
|
9163
|
+
pages: stablePages,
|
|
9164
|
+
editorPath: resolvedEditorPath
|
|
9165
|
+
}),
|
|
9166
|
+
[config, stablePages, resolvedEditorPath]
|
|
9167
|
+
);
|
|
9168
|
+
const inner = /* @__PURE__ */ jsx57(appConfigContext.Provider, { value: ctxValue, children });
|
|
9169
|
+
if (isServer) {
|
|
9170
|
+
return /* @__PURE__ */ jsx57(StaticRouter, { location: currentPath != null ? currentPath : "/", children: inner });
|
|
9171
|
+
}
|
|
9172
|
+
if (router === "hash") {
|
|
9173
|
+
return /* @__PURE__ */ jsx57(HashRouter, { children: inner });
|
|
9174
|
+
}
|
|
9175
|
+
if (router === "memory") {
|
|
9176
|
+
return /* @__PURE__ */ jsx57(MemoryRouter, { initialEntries: [currentPath != null ? currentPath : "/"], children: inner });
|
|
9177
|
+
}
|
|
9178
|
+
return /* @__PURE__ */ jsx57(BrowserRouter, { children: inner });
|
|
9179
|
+
}
|
|
9180
|
+
|
|
9181
|
+
// components/App/App.tsx
|
|
9182
|
+
init_react_import();
|
|
9183
|
+
import { Route, Routes } from "react-router";
|
|
9184
|
+
import { Fragment as Fragment16, jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
9185
|
+
var joinEditorPath = (editorPath, route) => {
|
|
9186
|
+
if (route === "/") return editorPath;
|
|
9187
|
+
return `${editorPath}${route}`;
|
|
9188
|
+
};
|
|
9189
|
+
var DefaultNotFound = () => /* @__PURE__ */ jsx58(
|
|
9190
|
+
"div",
|
|
9191
|
+
{
|
|
9192
|
+
style: {
|
|
9193
|
+
display: "flex",
|
|
9194
|
+
height: "100vh",
|
|
9195
|
+
textAlign: "center",
|
|
9196
|
+
justifyContent: "center",
|
|
9197
|
+
alignItems: "center"
|
|
9198
|
+
},
|
|
9199
|
+
children: /* @__PURE__ */ jsxs25("div", { children: [
|
|
9200
|
+
/* @__PURE__ */ jsx58("h1", { children: "404" }),
|
|
9201
|
+
/* @__PURE__ */ jsx58("p", { children: "No page matches this route." })
|
|
9202
|
+
] })
|
|
9203
|
+
}
|
|
9204
|
+
);
|
|
9205
|
+
function RenderRoute({
|
|
9206
|
+
routeKey,
|
|
9207
|
+
metadata
|
|
9208
|
+
}) {
|
|
9209
|
+
const { config, pages } = useApp();
|
|
9210
|
+
const data = pages[routeKey];
|
|
9211
|
+
if (!data) return null;
|
|
9212
|
+
return /* @__PURE__ */ jsx58(
|
|
9213
|
+
Render,
|
|
9214
|
+
{
|
|
9215
|
+
config,
|
|
9216
|
+
data,
|
|
9217
|
+
metadata
|
|
9218
|
+
},
|
|
9219
|
+
routeKey
|
|
9220
|
+
);
|
|
9221
|
+
}
|
|
9222
|
+
function EditorRouteRender({
|
|
9223
|
+
routeKey,
|
|
9224
|
+
layoutProps
|
|
9225
|
+
}) {
|
|
9226
|
+
const {
|
|
9227
|
+
onPublish,
|
|
9228
|
+
onChange,
|
|
9229
|
+
plugins,
|
|
9230
|
+
overrides,
|
|
9231
|
+
fieldTransforms,
|
|
9232
|
+
metadata,
|
|
9233
|
+
iframe,
|
|
9234
|
+
viewports,
|
|
9235
|
+
permissions
|
|
9236
|
+
} = layoutProps;
|
|
9237
|
+
const { config, pages, routes, navigate } = useApp();
|
|
9238
|
+
const data = pages[routeKey];
|
|
9239
|
+
if (!data) return null;
|
|
9240
|
+
return /* @__PURE__ */ jsx58(
|
|
9241
|
+
Editor3,
|
|
9242
|
+
{
|
|
9243
|
+
config,
|
|
9244
|
+
data,
|
|
9245
|
+
plugins,
|
|
9246
|
+
overrides,
|
|
9247
|
+
fieldTransforms,
|
|
9248
|
+
metadata,
|
|
9249
|
+
iframe,
|
|
9250
|
+
viewports,
|
|
9251
|
+
permissions,
|
|
9252
|
+
onChange,
|
|
9253
|
+
onPublish,
|
|
9254
|
+
routes,
|
|
9255
|
+
currentRoute: routeKey,
|
|
9256
|
+
onRouteChange: (next) => navigate(next)
|
|
9257
|
+
},
|
|
9258
|
+
routeKey
|
|
9259
|
+
);
|
|
9260
|
+
}
|
|
9261
|
+
function NotFoundRoute({
|
|
9262
|
+
renderNotFound
|
|
9263
|
+
}) {
|
|
9264
|
+
return renderNotFound ? /* @__PURE__ */ jsx58(Fragment16, { children: renderNotFound() }) : /* @__PURE__ */ jsx58(DefaultNotFound, {});
|
|
9265
|
+
}
|
|
9266
|
+
function AppLayout(layoutProps) {
|
|
9267
|
+
const { pages, editorPath } = useApp();
|
|
9268
|
+
const renderRoutes = Object.keys(pages);
|
|
9269
|
+
return /* @__PURE__ */ jsxs25(Routes, { children: [
|
|
9270
|
+
renderRoutes.map((routeKey) => /* @__PURE__ */ jsx58(
|
|
9271
|
+
Route,
|
|
9272
|
+
{
|
|
9273
|
+
path: routeKey,
|
|
9274
|
+
element: /* @__PURE__ */ jsx58(
|
|
9275
|
+
RenderRoute,
|
|
9276
|
+
{
|
|
9277
|
+
routeKey,
|
|
9278
|
+
metadata: layoutProps.metadata
|
|
9279
|
+
}
|
|
9280
|
+
)
|
|
9281
|
+
},
|
|
9282
|
+
`render:${routeKey}`
|
|
9283
|
+
)),
|
|
9284
|
+
editorPath !== null && renderRoutes.map((routeKey) => /* @__PURE__ */ jsx58(
|
|
9285
|
+
Route,
|
|
9286
|
+
{
|
|
9287
|
+
path: joinEditorPath(editorPath, routeKey),
|
|
9288
|
+
element: /* @__PURE__ */ jsx58(
|
|
9289
|
+
EditorRouteRender,
|
|
9290
|
+
{
|
|
9291
|
+
routeKey,
|
|
9292
|
+
layoutProps
|
|
9293
|
+
}
|
|
9294
|
+
)
|
|
9295
|
+
},
|
|
9296
|
+
`edit:${routeKey}`
|
|
9297
|
+
)),
|
|
9298
|
+
/* @__PURE__ */ jsx58(
|
|
9299
|
+
Route,
|
|
9300
|
+
{
|
|
9301
|
+
path: "*",
|
|
9302
|
+
element: /* @__PURE__ */ jsx58(NotFoundRoute, { renderNotFound: layoutProps.renderNotFound })
|
|
9303
|
+
}
|
|
9304
|
+
)
|
|
9305
|
+
] });
|
|
9306
|
+
}
|
|
9307
|
+
function App(props) {
|
|
9308
|
+
const _a = props, {
|
|
9309
|
+
config,
|
|
9310
|
+
pages,
|
|
9311
|
+
currentPath,
|
|
9312
|
+
editorPath,
|
|
9313
|
+
router,
|
|
9314
|
+
children
|
|
9315
|
+
} = _a, layoutProps = __objRest(_a, [
|
|
9316
|
+
"config",
|
|
9317
|
+
"pages",
|
|
9318
|
+
"currentPath",
|
|
9319
|
+
"editorPath",
|
|
9320
|
+
"router",
|
|
9321
|
+
"children"
|
|
9322
|
+
]);
|
|
9323
|
+
return /* @__PURE__ */ jsx58(
|
|
9324
|
+
AppProvider,
|
|
9325
|
+
{
|
|
9326
|
+
config,
|
|
9327
|
+
pages,
|
|
9328
|
+
currentPath,
|
|
9329
|
+
editorPath,
|
|
9330
|
+
router,
|
|
9331
|
+
children: children != null ? children : /* @__PURE__ */ jsx58(AppLayout, __spreadValues({}, layoutProps))
|
|
9332
|
+
}
|
|
9333
|
+
);
|
|
9334
|
+
}
|
|
9335
|
+
|
|
9336
|
+
// components/App/use-route-params.ts
|
|
9337
|
+
init_react_import();
|
|
9338
|
+
import { useParams } from "react-router";
|
|
9339
|
+
var useRouteParams = useParams;
|
|
9340
|
+
|
|
9341
|
+
// components/App/index.ts
|
|
9342
|
+
init_react_import();
|
|
9343
|
+
|
|
9076
9344
|
// lib/page-metadata.ts
|
|
9077
9345
|
init_react_import();
|
|
9078
9346
|
function pageMetadata(data) {
|
|
@@ -9098,12 +9366,12 @@ function pageMetadata(data) {
|
|
|
9098
9366
|
|
|
9099
9367
|
// plugins/legacy-side-bar/index.tsx
|
|
9100
9368
|
init_react_import();
|
|
9101
|
-
import { jsx as
|
|
9369
|
+
import { jsx as jsx59, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
9102
9370
|
var legacySideBarPlugin = () => ({
|
|
9103
9371
|
name: "legacy-side-bar",
|
|
9104
|
-
render: () => /* @__PURE__ */
|
|
9105
|
-
/* @__PURE__ */
|
|
9106
|
-
/* @__PURE__ */
|
|
9372
|
+
render: () => /* @__PURE__ */ jsxs26("div", { style: { overflowY: "auto" }, children: [
|
|
9373
|
+
/* @__PURE__ */ jsx59(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ jsx59(Components, {}) }),
|
|
9374
|
+
/* @__PURE__ */ jsx59(SidebarSection, { title: "Outline", children: /* @__PURE__ */ jsx59(Outline, {}) })
|
|
9107
9375
|
] })
|
|
9108
9376
|
});
|
|
9109
9377
|
|
|
@@ -9168,6 +9436,12 @@ export {
|
|
|
9168
9436
|
fieldsPlugin,
|
|
9169
9437
|
usePropsContext,
|
|
9170
9438
|
Editor3 as Editor,
|
|
9439
|
+
useStableValue,
|
|
9440
|
+
appConfigContext,
|
|
9441
|
+
useApp,
|
|
9442
|
+
AppProvider,
|
|
9443
|
+
App,
|
|
9444
|
+
useRouteParams,
|
|
9171
9445
|
pageMetadata,
|
|
9172
9446
|
legacySideBarPlugin
|
|
9173
9447
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoadedRichTextMenuInner
|
|
3
|
+
} from "./chunk-BUR5T7IX.mjs";
|
|
1
4
|
import {
|
|
2
5
|
styles_module_default
|
|
3
6
|
} from "./chunk-6QJ2HF4O.mjs";
|
|
4
|
-
import {
|
|
5
|
-
LoadedRichTextMenuInner
|
|
6
|
-
} from "./chunk-U7VW3V3W.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useAppStore,
|
|
9
9
|
useAppStoreApi
|
|
@@ -100,7 +100,7 @@ init_react_import();
|
|
|
100
100
|
import { lazy, Suspense } from "react";
|
|
101
101
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
102
102
|
var LoadedRichTextMenuFull = lazy(
|
|
103
|
-
() => import("./full-
|
|
103
|
+
() => import("./full-QT5KXRDP.mjs").then((m) => ({
|
|
104
104
|
default: m.LoadedRichTextMenuFull
|
|
105
105
|
}))
|
|
106
106
|
);
|
|
@@ -24,6 +24,50 @@ import {
|
|
|
24
24
|
init_react_import
|
|
25
25
|
} from "./chunk-M6W7YEVX.mjs";
|
|
26
26
|
|
|
27
|
+
// lib/get-route-props.ts
|
|
28
|
+
init_react_import();
|
|
29
|
+
import { matchRoutes } from "react-router";
|
|
30
|
+
var DEFAULT_EDITOR_PATH = "/editor";
|
|
31
|
+
var stripEditorPrefix = (currentRoute, editorPath) => {
|
|
32
|
+
if (!editorPath) return currentRoute;
|
|
33
|
+
if (currentRoute === editorPath) return "/";
|
|
34
|
+
if (!currentRoute.startsWith(`${editorPath}/`)) return currentRoute;
|
|
35
|
+
const rest = currentRoute.slice(editorPath.length);
|
|
36
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
37
|
+
};
|
|
38
|
+
var findMatch = (pages, pathname) => {
|
|
39
|
+
const keys = Object.keys(pages);
|
|
40
|
+
if (keys.length === 0) return null;
|
|
41
|
+
const matches = matchRoutes(
|
|
42
|
+
keys.map((path) => ({ path })),
|
|
43
|
+
pathname
|
|
44
|
+
);
|
|
45
|
+
if (!matches || matches.length === 0) return null;
|
|
46
|
+
const last = matches[matches.length - 1];
|
|
47
|
+
const key = last.route.path;
|
|
48
|
+
return { route: key, params: last.params, data: pages[key] };
|
|
49
|
+
};
|
|
50
|
+
var getRouteProps = (pages, currentRoute, options = {}) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
53
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
54
|
+
const match = findMatch(pages, matchRoute);
|
|
55
|
+
if (!match) return null;
|
|
56
|
+
const props = (_b = (_a = match.data) == null ? void 0 : _a.root) == null ? void 0 : _b.props;
|
|
57
|
+
return props != null ? props : null;
|
|
58
|
+
};
|
|
59
|
+
var resolveRouteFromString = (pages, currentRoute, options = {}) => {
|
|
60
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
61
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
62
|
+
const match = findMatch(pages, matchRoute);
|
|
63
|
+
if (!match) return null;
|
|
64
|
+
return {
|
|
65
|
+
route: match.route,
|
|
66
|
+
data: match.data,
|
|
67
|
+
params: match.params
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
27
71
|
// lib/migrate.ts
|
|
28
72
|
init_react_import();
|
|
29
73
|
var migrations = [
|
|
@@ -470,6 +514,8 @@ export {
|
|
|
470
514
|
useRichtextProps,
|
|
471
515
|
SlotRenderPure,
|
|
472
516
|
SlotRender,
|
|
517
|
+
getRouteProps,
|
|
518
|
+
resolveRouteFromString,
|
|
473
519
|
migrate,
|
|
474
520
|
transformProps,
|
|
475
521
|
resolveAllData
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LoadedRichTextMenuInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BUR5T7IX.mjs";
|
|
4
|
+
import "./chunk-FT6UFK7G.mjs";
|
|
4
5
|
import "./chunk-OIFPBVSF.mjs";
|
|
5
6
|
import "./chunk-AD7BMXAA.mjs";
|
|
6
|
-
import "./chunk-FT6UFK7G.mjs";
|
|
7
7
|
import "./chunk-LRFRIIKG.mjs";
|
|
8
8
|
import "./chunk-M4JDRFYB.mjs";
|
|
9
9
|
import "./chunk-IIRJMJFU.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as History,
|
|
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-B8_EA7vy.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,
|
|
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-B8_EA7vy.mjs';
|
|
2
2
|
import { Editor } from '@tiptap/react';
|
|
3
3
|
|
|
4
4
|
type HistorySlice<D = any> = {
|