@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/no-external.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
+
App,
|
|
3
|
+
AppProvider,
|
|
2
4
|
AutoField,
|
|
3
5
|
Button,
|
|
4
6
|
ComponentList,
|
|
@@ -6,6 +8,7 @@ import {
|
|
|
6
8
|
Editor,
|
|
7
9
|
FieldLabel,
|
|
8
10
|
Render,
|
|
11
|
+
appConfigContext,
|
|
9
12
|
blocksPlugin,
|
|
10
13
|
createUseEditor,
|
|
11
14
|
fieldsPlugin,
|
|
@@ -16,17 +19,14 @@ import {
|
|
|
16
19
|
registerOverlayPortal,
|
|
17
20
|
renderContext,
|
|
18
21
|
setDeep,
|
|
22
|
+
useApp,
|
|
19
23
|
useEditor,
|
|
20
24
|
useGetEditor,
|
|
21
|
-
usePropsContext
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
resolveAllData,
|
|
27
|
-
transformProps
|
|
28
|
-
} from "./chunk-TI3KC54Y.mjs";
|
|
29
|
-
import "./chunk-6QJ2HF4O.mjs";
|
|
25
|
+
usePropsContext,
|
|
26
|
+
useRouteParams,
|
|
27
|
+
useStableValue
|
|
28
|
+
} from "./chunk-74TOLW7F.mjs";
|
|
29
|
+
import "./chunk-YBG2RYVF.mjs";
|
|
30
30
|
import {
|
|
31
31
|
Action,
|
|
32
32
|
ActionBar,
|
|
@@ -35,13 +35,21 @@ import {
|
|
|
35
35
|
Label,
|
|
36
36
|
RichTextMenu,
|
|
37
37
|
Separator
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
} from "./chunk-TGVAC3JP.mjs";
|
|
39
|
+
import "./chunk-X4EUZIHA.mjs";
|
|
40
|
+
import {
|
|
41
|
+
getRouteProps,
|
|
42
|
+
migrate,
|
|
43
|
+
resolveAllData,
|
|
44
|
+
resolveRouteFromString,
|
|
45
|
+
transformProps
|
|
46
|
+
} from "./chunk-II42EKFK.mjs";
|
|
47
|
+
import "./chunk-6QJ2HF4O.mjs";
|
|
48
|
+
import "./chunk-XLVEWZWT.mjs";
|
|
49
|
+
import "./chunk-MJJPWASL.mjs";
|
|
50
|
+
import "./chunk-56I7ST5F.mjs";
|
|
43
51
|
import "./chunk-M4JDRFYB.mjs";
|
|
44
|
-
import "./chunk-
|
|
52
|
+
import "./chunk-ERNSJXVF.mjs";
|
|
45
53
|
import "./chunk-Y2EFNT5P.mjs";
|
|
46
54
|
import {
|
|
47
55
|
walkTree
|
|
@@ -55,6 +63,8 @@ init_react_import();
|
|
|
55
63
|
export {
|
|
56
64
|
Action,
|
|
57
65
|
ActionBar,
|
|
66
|
+
App,
|
|
67
|
+
AppProvider,
|
|
58
68
|
AutoField,
|
|
59
69
|
Button,
|
|
60
70
|
ComponentList,
|
|
@@ -67,9 +77,11 @@ export {
|
|
|
67
77
|
Render,
|
|
68
78
|
RichTextMenu,
|
|
69
79
|
Separator,
|
|
80
|
+
appConfigContext,
|
|
70
81
|
blocksPlugin,
|
|
71
82
|
createUseEditor,
|
|
72
83
|
fieldsPlugin,
|
|
84
|
+
getRouteProps,
|
|
73
85
|
legacySideBarPlugin,
|
|
74
86
|
migrate,
|
|
75
87
|
outlinePlugin,
|
|
@@ -78,10 +90,14 @@ export {
|
|
|
78
90
|
registerOverlayPortal,
|
|
79
91
|
renderContext,
|
|
80
92
|
resolveAllData,
|
|
93
|
+
resolveRouteFromString,
|
|
81
94
|
setDeep,
|
|
82
95
|
transformProps,
|
|
96
|
+
useApp,
|
|
83
97
|
useEditor,
|
|
84
98
|
useGetEditor,
|
|
85
99
|
usePropsContext,
|
|
100
|
+
useRouteParams,
|
|
101
|
+
useStableValue,
|
|
86
102
|
walkTree
|
|
87
103
|
};
|
package/dist/remix.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remix helpers for `<App>`.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions — no `@remix-run/*` imports — namespaced for future
|
|
5
|
+
* extension.
|
|
6
|
+
*/
|
|
7
|
+
type RemixSplatParams = {
|
|
8
|
+
/** The splat segment from a `$.tsx` route. */
|
|
9
|
+
"*"?: string;
|
|
10
|
+
};
|
|
11
|
+
type RemixResolvedRoute = {
|
|
12
|
+
/** Full path including any editor prefix, e.g. "/editor/products/foo". */
|
|
13
|
+
route: string;
|
|
14
|
+
/** True when `route` starts with the editor prefix. */
|
|
15
|
+
isEditor: boolean;
|
|
16
|
+
/** Path with the editor prefix stripped — what schemas match against. */
|
|
17
|
+
matchRoute: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolve Remix splat params into a route descriptor for `<App>`.
|
|
21
|
+
*
|
|
22
|
+
* Mounted at `app/routes/$.tsx`:
|
|
23
|
+
* - `/products/abc` → `{ route: "/products/abc", isEditor: false, matchRoute: "/products/abc" }`
|
|
24
|
+
* - `/editor/products/abc` → `{ route: "/editor/products/abc", isEditor: true, matchRoute: "/products/abc" }`
|
|
25
|
+
*
|
|
26
|
+
* `editorPath` defaults to "/editor" — same default as `<App>`. Pass `null`
|
|
27
|
+
* to skip editor-mode classification.
|
|
28
|
+
*/
|
|
29
|
+
declare const remixResolveRoute: (params: RemixSplatParams, options?: {
|
|
30
|
+
editorPath?: string | null;
|
|
31
|
+
}) => RemixResolvedRoute;
|
|
32
|
+
|
|
33
|
+
export { type RemixResolvedRoute, type RemixSplatParams, remixResolveRoute };
|
package/dist/remix.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remix helpers for `<App>`.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions — no `@remix-run/*` imports — namespaced for future
|
|
5
|
+
* extension.
|
|
6
|
+
*/
|
|
7
|
+
type RemixSplatParams = {
|
|
8
|
+
/** The splat segment from a `$.tsx` route. */
|
|
9
|
+
"*"?: string;
|
|
10
|
+
};
|
|
11
|
+
type RemixResolvedRoute = {
|
|
12
|
+
/** Full path including any editor prefix, e.g. "/editor/products/foo". */
|
|
13
|
+
route: string;
|
|
14
|
+
/** True when `route` starts with the editor prefix. */
|
|
15
|
+
isEditor: boolean;
|
|
16
|
+
/** Path with the editor prefix stripped — what schemas match against. */
|
|
17
|
+
matchRoute: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolve Remix splat params into a route descriptor for `<App>`.
|
|
21
|
+
*
|
|
22
|
+
* Mounted at `app/routes/$.tsx`:
|
|
23
|
+
* - `/products/abc` → `{ route: "/products/abc", isEditor: false, matchRoute: "/products/abc" }`
|
|
24
|
+
* - `/editor/products/abc` → `{ route: "/editor/products/abc", isEditor: true, matchRoute: "/products/abc" }`
|
|
25
|
+
*
|
|
26
|
+
* `editorPath` defaults to "/editor" — same default as `<App>`. Pass `null`
|
|
27
|
+
* to skip editor-mode classification.
|
|
28
|
+
*/
|
|
29
|
+
declare const remixResolveRoute: (params: RemixSplatParams, options?: {
|
|
30
|
+
editorPath?: string | null;
|
|
31
|
+
}) => RemixResolvedRoute;
|
|
32
|
+
|
|
33
|
+
export { type RemixResolvedRoute, type RemixSplatParams, remixResolveRoute };
|
package/dist/remix.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// bundle/remix.ts
|
|
31
|
+
var remix_exports = {};
|
|
32
|
+
__export(remix_exports, {
|
|
33
|
+
remixResolveRoute: () => remixResolveRoute
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(remix_exports);
|
|
36
|
+
|
|
37
|
+
// ../tsup-config/react-import.js
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
|
|
40
|
+
// bundle/remix.ts
|
|
41
|
+
var DEFAULT_EDITOR_PATH = "/editor";
|
|
42
|
+
var stripEditorPrefix = (route, editorPath) => {
|
|
43
|
+
if (!editorPath) return route;
|
|
44
|
+
if (route === editorPath) return "/";
|
|
45
|
+
if (!route.startsWith(`${editorPath}/`)) return route;
|
|
46
|
+
const rest = route.slice(editorPath.length);
|
|
47
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
48
|
+
};
|
|
49
|
+
var buildRoute = (params) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const splat = (_a = params == null ? void 0 : params["*"]) != null ? _a : "";
|
|
52
|
+
if (!splat) return "/";
|
|
53
|
+
return splat.startsWith("/") ? splat : `/${splat}`;
|
|
54
|
+
};
|
|
55
|
+
var remixResolveRoute = (params, options) => {
|
|
56
|
+
const editorPath = (options == null ? void 0 : options.editorPath) === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
57
|
+
const route = buildRoute(params);
|
|
58
|
+
const isEditor = editorPath !== null && (route === editorPath || route.startsWith(`${editorPath}/`));
|
|
59
|
+
const matchRoute = isEditor ? stripEditorPrefix(route, editorPath) : route;
|
|
60
|
+
return { route, isEditor, matchRoute };
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
remixResolveRoute
|
|
65
|
+
});
|
package/dist/remix.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_import
|
|
3
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
4
|
+
|
|
5
|
+
// bundle/remix.ts
|
|
6
|
+
init_react_import();
|
|
7
|
+
var DEFAULT_EDITOR_PATH = "/editor";
|
|
8
|
+
var stripEditorPrefix = (route, editorPath) => {
|
|
9
|
+
if (!editorPath) return route;
|
|
10
|
+
if (route === editorPath) return "/";
|
|
11
|
+
if (!route.startsWith(`${editorPath}/`)) return route;
|
|
12
|
+
const rest = route.slice(editorPath.length);
|
|
13
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
14
|
+
};
|
|
15
|
+
var buildRoute = (params) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const splat = (_a = params == null ? void 0 : params["*"]) != null ? _a : "";
|
|
18
|
+
if (!splat) return "/";
|
|
19
|
+
return splat.startsWith("/") ? splat : `/${splat}`;
|
|
20
|
+
};
|
|
21
|
+
var remixResolveRoute = (params, options) => {
|
|
22
|
+
const editorPath = (options == null ? void 0 : options.editorPath) === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
23
|
+
const route = buildRoute(params);
|
|
24
|
+
const isEditor = editorPath !== null && (route === editorPath || route.startsWith(`${editorPath}/`));
|
|
25
|
+
const matchRoute = isEditor ? stripEditorPrefix(route, editorPath) : route;
|
|
26
|
+
return { route, isEditor, matchRoute };
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
remixResolveRoute
|
|
30
|
+
};
|
package/dist/rsc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as Config, U as UserGenerics, M as Metadata } from './actions-
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { C as Config, U as UserGenerics, M as Metadata } 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 'react';
|
|
5
5
|
import '@tiptap/react';
|
|
6
6
|
import '@tiptap/extension-blockquote';
|
package/dist/rsc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { C as Config, U as UserGenerics, M as Metadata } from './actions-
|
|
3
|
-
export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-
|
|
2
|
+
import { C as Config, U as UserGenerics, M as Metadata } 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 'react';
|
|
5
5
|
import '@tiptap/react';
|
|
6
6
|
import '@tiptap/extension-blockquote';
|
package/dist/rsc.js
CHANGED
|
@@ -356,8 +356,10 @@ var init_Render = __esm({
|
|
|
356
356
|
var rsc_exports = {};
|
|
357
357
|
__export(rsc_exports, {
|
|
358
358
|
Render: () => Render,
|
|
359
|
+
getRouteProps: () => getRouteProps,
|
|
359
360
|
migrate: () => migrate,
|
|
360
361
|
resolveAllData: () => resolveAllData,
|
|
362
|
+
resolveRouteFromString: () => resolveRouteFromString,
|
|
361
363
|
transformProps: () => transformProps,
|
|
362
364
|
walkTree: () => walkTree
|
|
363
365
|
});
|
|
@@ -1158,6 +1160,7 @@ var defaultAppState = {
|
|
|
1158
1160
|
ui: {
|
|
1159
1161
|
leftSideBarVisible: true,
|
|
1160
1162
|
rightSideBarVisible: true,
|
|
1163
|
+
navBarVisible: true,
|
|
1161
1164
|
arrayState: {},
|
|
1162
1165
|
itemSelector: null,
|
|
1163
1166
|
componentList: {},
|
|
@@ -1474,11 +1477,57 @@ function migrate(data, config, migrationOptions) {
|
|
|
1474
1477
|
data
|
|
1475
1478
|
);
|
|
1476
1479
|
}
|
|
1480
|
+
|
|
1481
|
+
// lib/get-route-props.ts
|
|
1482
|
+
init_react_import();
|
|
1483
|
+
var import_react_router = require("react-router");
|
|
1484
|
+
var DEFAULT_EDITOR_PATH = "/editor";
|
|
1485
|
+
var stripEditorPrefix = (currentRoute, editorPath) => {
|
|
1486
|
+
if (!editorPath) return currentRoute;
|
|
1487
|
+
if (currentRoute === editorPath) return "/";
|
|
1488
|
+
if (!currentRoute.startsWith(`${editorPath}/`)) return currentRoute;
|
|
1489
|
+
const rest = currentRoute.slice(editorPath.length);
|
|
1490
|
+
return rest.startsWith("/") ? rest : `/${rest}`;
|
|
1491
|
+
};
|
|
1492
|
+
var findMatch = (pages, pathname) => {
|
|
1493
|
+
const keys = Object.keys(pages);
|
|
1494
|
+
if (keys.length === 0) return null;
|
|
1495
|
+
const matches = (0, import_react_router.matchRoutes)(
|
|
1496
|
+
keys.map((path) => ({ path })),
|
|
1497
|
+
pathname
|
|
1498
|
+
);
|
|
1499
|
+
if (!matches || matches.length === 0) return null;
|
|
1500
|
+
const last = matches[matches.length - 1];
|
|
1501
|
+
const key = last.route.path;
|
|
1502
|
+
return { route: key, params: last.params, data: pages[key] };
|
|
1503
|
+
};
|
|
1504
|
+
var getRouteProps = (pages, currentRoute, options = {}) => {
|
|
1505
|
+
var _a, _b;
|
|
1506
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
1507
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
1508
|
+
const match = findMatch(pages, matchRoute);
|
|
1509
|
+
if (!match) return null;
|
|
1510
|
+
const props = (_b = (_a = match.data) == null ? void 0 : _a.root) == null ? void 0 : _b.props;
|
|
1511
|
+
return props != null ? props : null;
|
|
1512
|
+
};
|
|
1513
|
+
var resolveRouteFromString = (pages, currentRoute, options = {}) => {
|
|
1514
|
+
const editorPath = options.editorPath === void 0 ? DEFAULT_EDITOR_PATH : options.editorPath;
|
|
1515
|
+
const matchRoute = stripEditorPrefix(currentRoute || "/", editorPath);
|
|
1516
|
+
const match = findMatch(pages, matchRoute);
|
|
1517
|
+
if (!match) return null;
|
|
1518
|
+
return {
|
|
1519
|
+
route: match.route,
|
|
1520
|
+
data: match.data,
|
|
1521
|
+
params: match.params
|
|
1522
|
+
};
|
|
1523
|
+
};
|
|
1477
1524
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1478
1525
|
0 && (module.exports = {
|
|
1479
1526
|
Render,
|
|
1527
|
+
getRouteProps,
|
|
1480
1528
|
migrate,
|
|
1481
1529
|
resolveAllData,
|
|
1530
|
+
resolveRouteFromString,
|
|
1482
1531
|
transformProps,
|
|
1483
1532
|
walkTree
|
|
1484
1533
|
});
|
package/dist/rsc.mjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SlotRenderPure,
|
|
3
|
+
getRouteProps,
|
|
3
4
|
migrate,
|
|
4
5
|
resolveAllData,
|
|
6
|
+
resolveRouteFromString,
|
|
5
7
|
transformProps,
|
|
6
8
|
useRichtextProps,
|
|
7
9
|
useSlots
|
|
8
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-II42EKFK.mjs";
|
|
9
11
|
import "./chunk-6QJ2HF4O.mjs";
|
|
10
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-ERNSJXVF.mjs";
|
|
11
13
|
import "./chunk-Y2EFNT5P.mjs";
|
|
12
14
|
import {
|
|
13
15
|
rootAreaId,
|
|
@@ -141,8 +143,10 @@ function Render({
|
|
|
141
143
|
}
|
|
142
144
|
export {
|
|
143
145
|
Render,
|
|
146
|
+
getRouteProps,
|
|
144
147
|
migrate,
|
|
145
148
|
resolveAllData,
|
|
149
|
+
resolveRouteFromString,
|
|
146
150
|
transformProps,
|
|
147
151
|
walkTree
|
|
148
152
|
};
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
import { C as Config, D as Data, W as WithId, U as UserGenerics,
|
|
1
|
+
import { C as Config, D as Data, W as WithId, U as UserGenerics, j as Content, b as ComponentData, k as DefaultComponents, l as DefaultComponentProps, m as DefaultRootFieldProps, M as Metadata, n as RootData } from './actions-C0LX6bI4.mjs';
|
|
2
|
+
|
|
3
|
+
type GetRoutePropsOptions = {
|
|
4
|
+
/** Defaults to "/editor". Pass null to skip editor-prefix handling. */
|
|
5
|
+
editorPath?: string | null;
|
|
6
|
+
};
|
|
7
|
+
type AnyPages = Record<string, {
|
|
8
|
+
root?: {
|
|
9
|
+
props?: unknown;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the matched page for `currentRoute` against `pages` and return its
|
|
16
|
+
* `root.props`. Editor prefix is stripped first so `/edit/about` returns the
|
|
17
|
+
* same root props as `/about`.
|
|
18
|
+
*
|
|
19
|
+
* Server-safe — uses `matchRoutes` from `react-router` which is a pure
|
|
20
|
+
* non-React utility. Useful in Next's `generateMetadata` and similar hooks.
|
|
21
|
+
*/
|
|
22
|
+
declare const getRouteProps: <P = Record<string, unknown>>(pages: AnyPages, currentRoute: string, options?: GetRoutePropsOptions) => P | null;
|
|
23
|
+
/**
|
|
24
|
+
* Lower-level variant that returns the matched route key alongside the data,
|
|
25
|
+
* for callers that need to know which entry resolved (canonical URLs,
|
|
26
|
+
* persistence keys, etc.) server-side.
|
|
27
|
+
*/
|
|
28
|
+
declare const resolveRouteFromString: <Data = unknown>(pages: Record<string, Data>, currentRoute: string, options?: GetRoutePropsOptions) => {
|
|
29
|
+
route: string;
|
|
30
|
+
data: Data;
|
|
31
|
+
params: Readonly<Record<string, string | undefined>>;
|
|
32
|
+
} | null;
|
|
2
33
|
|
|
3
34
|
type MigrationOptions<UserConfig extends Config> = {
|
|
4
35
|
migrateDynamicZonesForComponent?: {
|
|
@@ -26,4 +57,4 @@ type WalkTreeOptions = {
|
|
|
26
57
|
};
|
|
27
58
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
28
59
|
|
|
29
|
-
export { migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
60
|
+
export { type GetRoutePropsOptions as G, resolveRouteFromString as a, getRouteProps as g, migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
import { C as Config, D as Data, W as WithId, U as UserGenerics,
|
|
1
|
+
import { C as Config, D as Data, W as WithId, U as UserGenerics, j as Content, b as ComponentData, k as DefaultComponents, l as DefaultComponentProps, m as DefaultRootFieldProps, M as Metadata, n as RootData } from './actions-C0LX6bI4.js';
|
|
2
|
+
|
|
3
|
+
type GetRoutePropsOptions = {
|
|
4
|
+
/** Defaults to "/editor". Pass null to skip editor-prefix handling. */
|
|
5
|
+
editorPath?: string | null;
|
|
6
|
+
};
|
|
7
|
+
type AnyPages = Record<string, {
|
|
8
|
+
root?: {
|
|
9
|
+
props?: unknown;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the matched page for `currentRoute` against `pages` and return its
|
|
16
|
+
* `root.props`. Editor prefix is stripped first so `/edit/about` returns the
|
|
17
|
+
* same root props as `/about`.
|
|
18
|
+
*
|
|
19
|
+
* Server-safe — uses `matchRoutes` from `react-router` which is a pure
|
|
20
|
+
* non-React utility. Useful in Next's `generateMetadata` and similar hooks.
|
|
21
|
+
*/
|
|
22
|
+
declare const getRouteProps: <P = Record<string, unknown>>(pages: AnyPages, currentRoute: string, options?: GetRoutePropsOptions) => P | null;
|
|
23
|
+
/**
|
|
24
|
+
* Lower-level variant that returns the matched route key alongside the data,
|
|
25
|
+
* for callers that need to know which entry resolved (canonical URLs,
|
|
26
|
+
* persistence keys, etc.) server-side.
|
|
27
|
+
*/
|
|
28
|
+
declare const resolveRouteFromString: <Data = unknown>(pages: Record<string, Data>, currentRoute: string, options?: GetRoutePropsOptions) => {
|
|
29
|
+
route: string;
|
|
30
|
+
data: Data;
|
|
31
|
+
params: Readonly<Record<string, string | undefined>>;
|
|
32
|
+
} | null;
|
|
2
33
|
|
|
3
34
|
type MigrationOptions<UserConfig extends Config> = {
|
|
4
35
|
migrateDynamicZonesForComponent?: {
|
|
@@ -26,4 +57,4 @@ type WalkTreeOptions = {
|
|
|
26
57
|
};
|
|
27
58
|
declare function walkTree<T extends ComponentData | RootData | G["UserData"], UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(data: T, config: UserConfig, callbackFn: (data: Content, options: WalkTreeOptions) => Content | null | void): T;
|
|
28
59
|
|
|
29
|
-
export { migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
|
60
|
+
export { type GetRoutePropsOptions as G, resolveRouteFromString as a, getRouteProps as g, migrate as m, resolveAllData as r, transformProps as t, walkTree as w };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reacteditor/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "The open-source visual editor for React",
|
|
5
5
|
"author": "Rami Bitar <rami@frontend.co>",
|
|
6
|
-
"repository": "
|
|
7
|
-
"bugs": "https://github.com/
|
|
8
|
-
"homepage": "https://
|
|
6
|
+
"repository": "reacteditor/editor",
|
|
7
|
+
"bugs": "https://github.com/reacteditor/editor/issues",
|
|
8
|
+
"homepage": "https://reacteditor.dev",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"editor",
|
|
11
11
|
"visual",
|
|
@@ -50,6 +50,16 @@
|
|
|
50
50
|
"import": "./dist/internal.mjs",
|
|
51
51
|
"require": "./dist/internal.js"
|
|
52
52
|
},
|
|
53
|
+
"./nextjs": {
|
|
54
|
+
"types": "./dist/nextjs.d.ts",
|
|
55
|
+
"import": "./dist/nextjs.mjs",
|
|
56
|
+
"require": "./dist/nextjs.js"
|
|
57
|
+
},
|
|
58
|
+
"./remix": {
|
|
59
|
+
"types": "./dist/remix.d.ts",
|
|
60
|
+
"import": "./dist/remix.mjs",
|
|
61
|
+
"require": "./dist/remix.js"
|
|
62
|
+
},
|
|
53
63
|
"./react-editor.css": "./dist/index.css",
|
|
54
64
|
"./no-external.css": "./dist/no-external.css",
|
|
55
65
|
"./dist/index.css": "./dist/index.css",
|
|
@@ -65,7 +75,7 @@
|
|
|
65
75
|
"license": "MIT",
|
|
66
76
|
"scripts": {
|
|
67
77
|
"lint": "eslint \"**/*.ts*\"",
|
|
68
|
-
"build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts bundle/internal.ts",
|
|
78
|
+
"build": "rm -rf dist && tsup bundle/index.ts bundle/rsc.tsx bundle/no-external.ts bundle/internal.ts bundle/nextjs.ts bundle/remix.ts",
|
|
69
79
|
"test": "jest",
|
|
70
80
|
"prepare": "cp ../../README.md . && yarn build",
|
|
71
81
|
"postpublish": "rm README.md"
|
|
@@ -140,6 +150,7 @@
|
|
|
140
150
|
"zustand": "^5.0.3"
|
|
141
151
|
},
|
|
142
152
|
"peerDependencies": {
|
|
143
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
153
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
154
|
+
"react-router": "^7.0.0"
|
|
144
155
|
}
|
|
145
156
|
}
|