@orion-studios/payload-studio 0.5.0-beta.4 → 0.5.0-beta.41
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/admin/client.js +68 -7
- package/dist/admin/client.mjs +68 -7
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +37 -0
- package/dist/admin/index.mjs +3 -1
- package/dist/admin-app/client.d.mts +4 -0
- package/dist/admin-app/client.d.ts +4 -0
- package/dist/admin-app/client.js +705 -2
- package/dist/admin-app/client.mjs +701 -1
- package/dist/admin-app/index.d.mts +1 -1
- package/dist/admin-app/index.d.ts +1 -1
- package/dist/admin-app/index.js +167 -0
- package/dist/admin-app/index.mjs +13 -1
- package/dist/admin-app/styles.css +127 -0
- package/dist/blocks/index.js +457 -5
- package/dist/blocks/index.mjs +2 -2
- package/dist/{chunk-J7W5EE3B.mjs → chunk-7IGLXLUB.mjs} +37 -0
- package/dist/{chunk-ZLLNO5FM.mjs → chunk-GNYOAC5N.mjs} +44 -13
- package/dist/{chunk-UJFU323N.mjs → chunk-LB72FZZ3.mjs} +33 -9
- package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
- package/dist/{chunk-PC5622T7.mjs → chunk-XQYJXB46.mjs} +444 -6
- package/dist/chunk-XVH5SCBD.mjs +234 -0
- package/dist/index-BBvk9b9i.d.mts +97 -0
- package/dist/index-BBvk9b9i.d.ts +97 -0
- package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.mts} +1 -0
- package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.ts} +1 -0
- package/dist/{index-DJFhANvJ.d.ts → index-Dj21uD_B.d.mts} +5 -2
- package/dist/{index-DJFhANvJ.d.mts → index-Dj21uD_B.d.ts} +5 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +904 -204
- package/dist/index.mjs +12 -12
- package/dist/nextjs/index.d.mts +1 -1
- package/dist/nextjs/index.d.ts +1 -1
- package/dist/nextjs/index.js +290 -13
- package/dist/nextjs/index.mjs +4 -1
- package/dist/studio-pages/builder.css +25 -1
- package/dist/studio-pages/client.js +3593 -1279
- package/dist/studio-pages/client.mjs +3593 -1279
- package/dist/studio-pages/index.js +33 -8
- package/dist/studio-pages/index.mjs +2 -2
- package/package.json +24 -12
- package/dist/chunk-AAOHJDNS.mjs +0 -67
- package/dist/index-BallJs-K.d.mts +0 -43
- package/dist/index-BallJs-K.d.ts +0 -43
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-6BWS3CLP.mjs";
|
|
4
|
+
|
|
5
|
+
// src/admin-app/index.ts
|
|
6
|
+
var admin_app_exports = {};
|
|
7
|
+
__export(admin_app_exports, {
|
|
8
|
+
AdminBreadcrumbs: () => AdminBreadcrumbs,
|
|
9
|
+
AdminPage: () => AdminPage,
|
|
10
|
+
buildAdminPageLinkOptions: () => buildAdminPageLinkOptions,
|
|
11
|
+
buildNestedNavTree: () => buildNestedNavTree,
|
|
12
|
+
getAdminNavRows: () => getAdminNavRows,
|
|
13
|
+
navItemIsActive: () => navItemIsActive,
|
|
14
|
+
normalizeAdminNavInputs: () => normalizeAdminNavInputs,
|
|
15
|
+
normalizeNestedNavItems: () => normalizeNestedNavItems,
|
|
16
|
+
parseAdminHeaderNavFromForm: () => parseAdminHeaderNavFromForm,
|
|
17
|
+
roleCanAccessNav: () => roleCanAccessNav
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
+
function AdminBreadcrumbs({ items }) {
|
|
23
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "orion-admin-breadcrumbs", children: items.map((item, index) => {
|
|
24
|
+
const isLast = index === items.length - 1;
|
|
25
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
26
|
+
item.href && !isLast ? /* @__PURE__ */ jsx("a", { href: item.href, children: item.label }) : /* @__PURE__ */ jsx("span", { children: item.label }),
|
|
27
|
+
!isLast ? /* @__PURE__ */ jsx("span", { className: "orion-admin-breadcrumb-sep", children: "/" }) : null
|
|
28
|
+
] }, `${item.label}-${index}`);
|
|
29
|
+
}) });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/admin-app/components/AdminPage.tsx
|
|
33
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
34
|
+
function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
35
|
+
return /* @__PURE__ */ jsxs2("div", { className: "orion-admin-page", children: [
|
|
36
|
+
/* @__PURE__ */ jsxs2("div", { className: "orion-admin-page-header", children: [
|
|
37
|
+
/* @__PURE__ */ jsx2(AdminBreadcrumbs, { items: breadcrumbs }),
|
|
38
|
+
/* @__PURE__ */ jsxs2("div", { className: "orion-admin-page-title-row", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs2("div", { children: [
|
|
40
|
+
/* @__PURE__ */ jsx2("h1", { children: title }),
|
|
41
|
+
description ? /* @__PURE__ */ jsx2("p", { children: description }) : null
|
|
42
|
+
] }),
|
|
43
|
+
actions ? /* @__PURE__ */ jsx2("div", { className: "orion-admin-page-actions", children: actions }) : null
|
|
44
|
+
] })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx2("div", { className: "orion-admin-page-content", children })
|
|
47
|
+
] });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/admin-app/nestedNavigation.ts
|
|
51
|
+
var normalizeNestedNavItems = (items) => {
|
|
52
|
+
const deduped = [];
|
|
53
|
+
const seen = /* @__PURE__ */ new Set();
|
|
54
|
+
for (const item of items) {
|
|
55
|
+
const href = typeof item.href === "string" ? item.href.trim() : "";
|
|
56
|
+
const label = typeof item.label === "string" ? item.label.trim() : "";
|
|
57
|
+
const parentHref = typeof item.parentHref === "string" ? item.parentHref.trim() : "";
|
|
58
|
+
if (!href || !label || seen.has(href)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
seen.add(href);
|
|
62
|
+
deduped.push({
|
|
63
|
+
href,
|
|
64
|
+
label,
|
|
65
|
+
...parentHref ? { parentHref } : {}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
69
|
+
return deduped.map((item) => ({
|
|
70
|
+
href: item.href,
|
|
71
|
+
label: item.label,
|
|
72
|
+
...item.parentHref && item.parentHref !== item.href && hrefs.has(item.parentHref) ? { parentHref: item.parentHref } : {}
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
75
|
+
var buildNestedNavTree = (items) => {
|
|
76
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
77
|
+
const topLevel = [];
|
|
78
|
+
for (const item of items) {
|
|
79
|
+
if (!item.parentHref) {
|
|
80
|
+
topLevel.push(item);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const children = childrenByParent.get(item.parentHref) || [];
|
|
84
|
+
children.push(item);
|
|
85
|
+
childrenByParent.set(item.parentHref, children);
|
|
86
|
+
}
|
|
87
|
+
if (topLevel.length === 0 && items.length > 0) {
|
|
88
|
+
return {
|
|
89
|
+
topLevel: items.map((item) => ({ href: item.href, label: item.label })),
|
|
90
|
+
childrenByParent: /* @__PURE__ */ new Map()
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return { childrenByParent, topLevel };
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// src/admin-app/navigationLinks.ts
|
|
97
|
+
var fallbackHomeOption = {
|
|
98
|
+
href: "/",
|
|
99
|
+
label: "Home",
|
|
100
|
+
title: "Home"
|
|
101
|
+
};
|
|
102
|
+
var buildAdminPageLinkOptions = (pages) => {
|
|
103
|
+
const options = pages.map((page) => {
|
|
104
|
+
const href = typeof page.path === "string" ? page.path.trim() : "";
|
|
105
|
+
const title = typeof page.title === "string" && page.title.trim().length > 0 ? page.title.trim() : "Untitled Page";
|
|
106
|
+
if (!href) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const depth = href === "/" ? 0 : href.split("/").filter(Boolean).length;
|
|
110
|
+
const indentLevel = Math.max(depth - 1, 0);
|
|
111
|
+
const indent = indentLevel > 0 ? `${"\u21B3 ".repeat(indentLevel)}` : "";
|
|
112
|
+
return {
|
|
113
|
+
href,
|
|
114
|
+
label: `${indent}${title}`,
|
|
115
|
+
title
|
|
116
|
+
};
|
|
117
|
+
}).filter((option) => option !== null).sort((a, b) => {
|
|
118
|
+
if (a.href === "/" && b.href !== "/") return -1;
|
|
119
|
+
if (b.href === "/" && a.href !== "/") return 1;
|
|
120
|
+
return a.href.localeCompare(b.href);
|
|
121
|
+
});
|
|
122
|
+
if (options.length === 0) {
|
|
123
|
+
return [fallbackHomeOption];
|
|
124
|
+
}
|
|
125
|
+
return options;
|
|
126
|
+
};
|
|
127
|
+
var getAdminNavRows = (navItems, pageOptions, minRows = 6, maxRows = 20) => {
|
|
128
|
+
const preferredRows = Math.max(navItems.length + 2, Math.min(8, pageOptions.length));
|
|
129
|
+
return Math.min(Math.max(minRows, preferredRows), maxRows);
|
|
130
|
+
};
|
|
131
|
+
var normalizeAdminNavInputs = (rows, pageOptions) => {
|
|
132
|
+
const allowedLinks = new Map(pageOptions.map((option) => [option.href, option.title]));
|
|
133
|
+
const deduped = [];
|
|
134
|
+
const seen = /* @__PURE__ */ new Set();
|
|
135
|
+
for (const row of rows) {
|
|
136
|
+
const href = typeof row.href === "string" ? row.href.trim() : "";
|
|
137
|
+
const defaultLabel = allowedLinks.get(href);
|
|
138
|
+
const explicitLabel = typeof row.label === "string" ? row.label.trim() : "";
|
|
139
|
+
const parentHref = typeof row.parentHref === "string" ? row.parentHref.trim() : "";
|
|
140
|
+
if (!href || !defaultLabel || seen.has(href)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
seen.add(href);
|
|
144
|
+
deduped.push({
|
|
145
|
+
href,
|
|
146
|
+
label: explicitLabel.length > 0 ? explicitLabel : defaultLabel,
|
|
147
|
+
...parentHref.length > 0 ? { parentHref } : {}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const hrefs = new Set(deduped.map((item) => item.href));
|
|
151
|
+
const parentByHref = new Map(deduped.map((item) => [item.href, item.parentHref || ""]));
|
|
152
|
+
const createsCycle = (href, parentHref) => {
|
|
153
|
+
const visited = /* @__PURE__ */ new Set([href]);
|
|
154
|
+
let current = parentHref;
|
|
155
|
+
while (current) {
|
|
156
|
+
if (visited.has(current)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
visited.add(current);
|
|
160
|
+
current = parentByHref.get(current) || "";
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
};
|
|
164
|
+
return deduped.map((item) => {
|
|
165
|
+
const parentHref = item.parentHref;
|
|
166
|
+
if (!parentHref || parentHref === item.href || !hrefs.has(parentHref) || createsCycle(item.href, parentHref)) {
|
|
167
|
+
return {
|
|
168
|
+
href: item.href,
|
|
169
|
+
label: item.label
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return item;
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
|
|
176
|
+
const serialized = String(formData.get("navItemsState") || "").trim();
|
|
177
|
+
if (serialized.length > 0) {
|
|
178
|
+
try {
|
|
179
|
+
const parsed = JSON.parse(serialized);
|
|
180
|
+
if (Array.isArray(parsed)) {
|
|
181
|
+
return normalizeAdminNavInputs(parsed.slice(0, maxRows), pageOptions);
|
|
182
|
+
}
|
|
183
|
+
} catch {
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const rawCount = Number(String(formData.get("navCount") || "0"));
|
|
187
|
+
const navCount = Number.isFinite(rawCount) ? Math.max(0, Math.min(rawCount, maxRows)) : 0;
|
|
188
|
+
const navRows = [];
|
|
189
|
+
for (let index = 0; index < navCount; index += 1) {
|
|
190
|
+
const href = String(formData.get(`navPage_${index}`) || "").trim();
|
|
191
|
+
const label = String(formData.get(`navLabel_${index}`) || "").trim();
|
|
192
|
+
const parentHref = String(formData.get(`navParentHref_${index}`) || "").trim();
|
|
193
|
+
navRows.push({
|
|
194
|
+
href,
|
|
195
|
+
label,
|
|
196
|
+
parentHref
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (navRows.length > 0) {
|
|
200
|
+
return normalizeAdminNavInputs(navRows, pageOptions);
|
|
201
|
+
}
|
|
202
|
+
return [];
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// src/admin-app/routeRegistry.ts
|
|
206
|
+
var roleCanAccessNav = (role, item) => {
|
|
207
|
+
if (!item.roles || item.roles.length === 0) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
if (!role) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
return item.roles.includes(role);
|
|
214
|
+
};
|
|
215
|
+
var navItemIsActive = (pathname, item) => {
|
|
216
|
+
if (item.href === "/admin") {
|
|
217
|
+
return pathname === "/admin";
|
|
218
|
+
}
|
|
219
|
+
return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export {
|
|
223
|
+
AdminBreadcrumbs,
|
|
224
|
+
AdminPage,
|
|
225
|
+
normalizeNestedNavItems,
|
|
226
|
+
buildNestedNavTree,
|
|
227
|
+
buildAdminPageLinkOptions,
|
|
228
|
+
getAdminNavRows,
|
|
229
|
+
normalizeAdminNavInputs,
|
|
230
|
+
parseAdminHeaderNavFromForm,
|
|
231
|
+
roleCanAccessNav,
|
|
232
|
+
navItemIsActive,
|
|
233
|
+
admin_app_exports
|
|
234
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type AdminRole = 'admin' | 'editor' | 'client';
|
|
5
|
+
type AdminNavItem = {
|
|
6
|
+
href: string;
|
|
7
|
+
label: string;
|
|
8
|
+
matchPrefixes: string[];
|
|
9
|
+
roles?: AdminRole[];
|
|
10
|
+
};
|
|
11
|
+
type AdminBreadcrumbItem = {
|
|
12
|
+
label: string;
|
|
13
|
+
href?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const roleCanAccessNav: (role: string | undefined, item: AdminNavItem) => boolean;
|
|
16
|
+
declare const navItemIsActive: (pathname: string, item: AdminNavItem) => boolean;
|
|
17
|
+
|
|
18
|
+
type AdminBreadcrumbsProps = {
|
|
19
|
+
items: AdminBreadcrumbItem[];
|
|
20
|
+
};
|
|
21
|
+
declare function AdminBreadcrumbs({ items }: AdminBreadcrumbsProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
type AdminPageProps = {
|
|
24
|
+
title: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
breadcrumbs: AdminBreadcrumbItem[];
|
|
27
|
+
actions?: ReactNode;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
declare function AdminPage({ title, description, breadcrumbs, actions, children }: AdminPageProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
type NestedNavItemInput = {
|
|
33
|
+
href?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
parentHref?: string;
|
|
36
|
+
};
|
|
37
|
+
type NestedNavItem = {
|
|
38
|
+
href: string;
|
|
39
|
+
label: string;
|
|
40
|
+
parentHref?: string;
|
|
41
|
+
};
|
|
42
|
+
type NestedNavTree = {
|
|
43
|
+
topLevel: NestedNavItem[];
|
|
44
|
+
childrenByParent: Map<string, NestedNavItem[]>;
|
|
45
|
+
};
|
|
46
|
+
declare const normalizeNestedNavItems: <T extends NestedNavItemInput>(items: T[]) => NestedNavItem[];
|
|
47
|
+
declare const buildNestedNavTree: (items: NestedNavItem[]) => NestedNavTree;
|
|
48
|
+
|
|
49
|
+
type AdminNavLinkItem = {
|
|
50
|
+
href: string;
|
|
51
|
+
label: string;
|
|
52
|
+
parentHref?: string;
|
|
53
|
+
};
|
|
54
|
+
type AdminPageRecord = {
|
|
55
|
+
path?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
};
|
|
58
|
+
type AdminPageLinkOption = {
|
|
59
|
+
href: string;
|
|
60
|
+
label: string;
|
|
61
|
+
title: string;
|
|
62
|
+
};
|
|
63
|
+
declare const buildAdminPageLinkOptions: (pages: AdminPageRecord[]) => AdminPageLinkOption[];
|
|
64
|
+
declare const getAdminNavRows: (navItems: AdminNavLinkItem[], pageOptions: AdminPageLinkOption[], minRows?: number, maxRows?: number) => number;
|
|
65
|
+
type AdminNavInput = {
|
|
66
|
+
href?: string;
|
|
67
|
+
label?: string;
|
|
68
|
+
parentHref?: string;
|
|
69
|
+
};
|
|
70
|
+
declare const normalizeAdminNavInputs: (rows: AdminNavInput[], pageOptions: AdminPageLinkOption[]) => AdminNavLinkItem[];
|
|
71
|
+
declare const parseAdminHeaderNavFromForm: (formData: FormData, pageOptions: AdminPageLinkOption[], maxRows?: number) => AdminNavLinkItem[];
|
|
72
|
+
|
|
73
|
+
type index_AdminBreadcrumbItem = AdminBreadcrumbItem;
|
|
74
|
+
declare const index_AdminBreadcrumbs: typeof AdminBreadcrumbs;
|
|
75
|
+
type index_AdminNavInput = AdminNavInput;
|
|
76
|
+
type index_AdminNavItem = AdminNavItem;
|
|
77
|
+
type index_AdminNavLinkItem = AdminNavLinkItem;
|
|
78
|
+
declare const index_AdminPage: typeof AdminPage;
|
|
79
|
+
type index_AdminPageLinkOption = AdminPageLinkOption;
|
|
80
|
+
type index_AdminPageRecord = AdminPageRecord;
|
|
81
|
+
type index_AdminRole = AdminRole;
|
|
82
|
+
type index_NestedNavItem = NestedNavItem;
|
|
83
|
+
type index_NestedNavItemInput = NestedNavItemInput;
|
|
84
|
+
type index_NestedNavTree = NestedNavTree;
|
|
85
|
+
declare const index_buildAdminPageLinkOptions: typeof buildAdminPageLinkOptions;
|
|
86
|
+
declare const index_buildNestedNavTree: typeof buildNestedNavTree;
|
|
87
|
+
declare const index_getAdminNavRows: typeof getAdminNavRows;
|
|
88
|
+
declare const index_navItemIsActive: typeof navItemIsActive;
|
|
89
|
+
declare const index_normalizeAdminNavInputs: typeof normalizeAdminNavInputs;
|
|
90
|
+
declare const index_normalizeNestedNavItems: typeof normalizeNestedNavItems;
|
|
91
|
+
declare const index_parseAdminHeaderNavFromForm: typeof parseAdminHeaderNavFromForm;
|
|
92
|
+
declare const index_roleCanAccessNav: typeof roleCanAccessNav;
|
|
93
|
+
declare namespace index {
|
|
94
|
+
export { type index_AdminBreadcrumbItem as AdminBreadcrumbItem, index_AdminBreadcrumbs as AdminBreadcrumbs, type index_AdminNavInput as AdminNavInput, type index_AdminNavItem as AdminNavItem, type index_AdminNavLinkItem as AdminNavLinkItem, index_AdminPage as AdminPage, type index_AdminPageLinkOption as AdminPageLinkOption, type index_AdminPageRecord as AdminPageRecord, type index_AdminRole as AdminRole, type index_NestedNavItem as NestedNavItem, type index_NestedNavItemInput as NestedNavItemInput, type index_NestedNavTree as NestedNavTree, index_buildAdminPageLinkOptions as buildAdminPageLinkOptions, index_buildNestedNavTree as buildNestedNavTree, index_getAdminNavRows as getAdminNavRows, index_navItemIsActive as navItemIsActive, index_normalizeAdminNavInputs as normalizeAdminNavInputs, index_normalizeNestedNavItems as normalizeNestedNavItems, index_parseAdminHeaderNavFromForm as parseAdminHeaderNavFromForm, index_roleCanAccessNav as roleCanAccessNav };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { type AdminBreadcrumbItem as A, type NestedNavItem as N, AdminBreadcrumbs as a, type AdminNavInput as b, type AdminNavItem as c, type AdminNavLinkItem as d, AdminPage as e, type AdminPageLinkOption as f, type AdminPageRecord as g, type AdminRole as h, index as i, type NestedNavItemInput as j, type NestedNavTree as k, buildAdminPageLinkOptions as l, buildNestedNavTree as m, getAdminNavRows as n, navItemIsActive as o, normalizeAdminNavInputs as p, normalizeNestedNavItems as q, parseAdminHeaderNavFromForm as r, roleCanAccessNav as s };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type AdminRole = 'admin' | 'editor' | 'client';
|
|
5
|
+
type AdminNavItem = {
|
|
6
|
+
href: string;
|
|
7
|
+
label: string;
|
|
8
|
+
matchPrefixes: string[];
|
|
9
|
+
roles?: AdminRole[];
|
|
10
|
+
};
|
|
11
|
+
type AdminBreadcrumbItem = {
|
|
12
|
+
label: string;
|
|
13
|
+
href?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const roleCanAccessNav: (role: string | undefined, item: AdminNavItem) => boolean;
|
|
16
|
+
declare const navItemIsActive: (pathname: string, item: AdminNavItem) => boolean;
|
|
17
|
+
|
|
18
|
+
type AdminBreadcrumbsProps = {
|
|
19
|
+
items: AdminBreadcrumbItem[];
|
|
20
|
+
};
|
|
21
|
+
declare function AdminBreadcrumbs({ items }: AdminBreadcrumbsProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
type AdminPageProps = {
|
|
24
|
+
title: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
breadcrumbs: AdminBreadcrumbItem[];
|
|
27
|
+
actions?: ReactNode;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
declare function AdminPage({ title, description, breadcrumbs, actions, children }: AdminPageProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
type NestedNavItemInput = {
|
|
33
|
+
href?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
parentHref?: string;
|
|
36
|
+
};
|
|
37
|
+
type NestedNavItem = {
|
|
38
|
+
href: string;
|
|
39
|
+
label: string;
|
|
40
|
+
parentHref?: string;
|
|
41
|
+
};
|
|
42
|
+
type NestedNavTree = {
|
|
43
|
+
topLevel: NestedNavItem[];
|
|
44
|
+
childrenByParent: Map<string, NestedNavItem[]>;
|
|
45
|
+
};
|
|
46
|
+
declare const normalizeNestedNavItems: <T extends NestedNavItemInput>(items: T[]) => NestedNavItem[];
|
|
47
|
+
declare const buildNestedNavTree: (items: NestedNavItem[]) => NestedNavTree;
|
|
48
|
+
|
|
49
|
+
type AdminNavLinkItem = {
|
|
50
|
+
href: string;
|
|
51
|
+
label: string;
|
|
52
|
+
parentHref?: string;
|
|
53
|
+
};
|
|
54
|
+
type AdminPageRecord = {
|
|
55
|
+
path?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
};
|
|
58
|
+
type AdminPageLinkOption = {
|
|
59
|
+
href: string;
|
|
60
|
+
label: string;
|
|
61
|
+
title: string;
|
|
62
|
+
};
|
|
63
|
+
declare const buildAdminPageLinkOptions: (pages: AdminPageRecord[]) => AdminPageLinkOption[];
|
|
64
|
+
declare const getAdminNavRows: (navItems: AdminNavLinkItem[], pageOptions: AdminPageLinkOption[], minRows?: number, maxRows?: number) => number;
|
|
65
|
+
type AdminNavInput = {
|
|
66
|
+
href?: string;
|
|
67
|
+
label?: string;
|
|
68
|
+
parentHref?: string;
|
|
69
|
+
};
|
|
70
|
+
declare const normalizeAdminNavInputs: (rows: AdminNavInput[], pageOptions: AdminPageLinkOption[]) => AdminNavLinkItem[];
|
|
71
|
+
declare const parseAdminHeaderNavFromForm: (formData: FormData, pageOptions: AdminPageLinkOption[], maxRows?: number) => AdminNavLinkItem[];
|
|
72
|
+
|
|
73
|
+
type index_AdminBreadcrumbItem = AdminBreadcrumbItem;
|
|
74
|
+
declare const index_AdminBreadcrumbs: typeof AdminBreadcrumbs;
|
|
75
|
+
type index_AdminNavInput = AdminNavInput;
|
|
76
|
+
type index_AdminNavItem = AdminNavItem;
|
|
77
|
+
type index_AdminNavLinkItem = AdminNavLinkItem;
|
|
78
|
+
declare const index_AdminPage: typeof AdminPage;
|
|
79
|
+
type index_AdminPageLinkOption = AdminPageLinkOption;
|
|
80
|
+
type index_AdminPageRecord = AdminPageRecord;
|
|
81
|
+
type index_AdminRole = AdminRole;
|
|
82
|
+
type index_NestedNavItem = NestedNavItem;
|
|
83
|
+
type index_NestedNavItemInput = NestedNavItemInput;
|
|
84
|
+
type index_NestedNavTree = NestedNavTree;
|
|
85
|
+
declare const index_buildAdminPageLinkOptions: typeof buildAdminPageLinkOptions;
|
|
86
|
+
declare const index_buildNestedNavTree: typeof buildNestedNavTree;
|
|
87
|
+
declare const index_getAdminNavRows: typeof getAdminNavRows;
|
|
88
|
+
declare const index_navItemIsActive: typeof navItemIsActive;
|
|
89
|
+
declare const index_normalizeAdminNavInputs: typeof normalizeAdminNavInputs;
|
|
90
|
+
declare const index_normalizeNestedNavItems: typeof normalizeNestedNavItems;
|
|
91
|
+
declare const index_parseAdminHeaderNavFromForm: typeof parseAdminHeaderNavFromForm;
|
|
92
|
+
declare const index_roleCanAccessNav: typeof roleCanAccessNav;
|
|
93
|
+
declare namespace index {
|
|
94
|
+
export { type index_AdminBreadcrumbItem as AdminBreadcrumbItem, index_AdminBreadcrumbs as AdminBreadcrumbs, type index_AdminNavInput as AdminNavInput, type index_AdminNavItem as AdminNavItem, type index_AdminNavLinkItem as AdminNavLinkItem, index_AdminPage as AdminPage, type index_AdminPageLinkOption as AdminPageLinkOption, type index_AdminPageRecord as AdminPageRecord, type index_AdminRole as AdminRole, type index_NestedNavItem as NestedNavItem, type index_NestedNavItemInput as NestedNavItemInput, type index_NestedNavTree as NestedNavTree, index_buildAdminPageLinkOptions as buildAdminPageLinkOptions, index_buildNestedNavTree as buildNestedNavTree, index_getAdminNavRows as getAdminNavRows, index_navItemIsActive as navItemIsActive, index_normalizeAdminNavInputs as normalizeAdminNavInputs, index_normalizeNestedNavItems as normalizeNestedNavItems, index_parseAdminHeaderNavFromForm as parseAdminHeaderNavFromForm, index_roleCanAccessNav as roleCanAccessNav };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { type AdminBreadcrumbItem as A, type NestedNavItem as N, AdminBreadcrumbs as a, type AdminNavInput as b, type AdminNavItem as c, type AdminNavLinkItem as d, AdminPage as e, type AdminPageLinkOption as f, type AdminPageRecord as g, type AdminRole as h, index as i, type NestedNavItemInput as j, type NestedNavTree as k, buildAdminPageLinkOptions as l, buildNestedNavTree as m, getAdminNavRows as n, navItemIsActive as o, normalizeAdminNavInputs as p, normalizeNestedNavItems as q, parseAdminHeaderNavFromForm as r, roleCanAccessNav as s };
|
|
@@ -116,13 +116,16 @@ declare function configureAdmin(config: AdminConfig): {
|
|
|
116
116
|
|
|
117
117
|
declare function withTooltips(fields: Field[], customTooltips?: Record<string, string>): Field[];
|
|
118
118
|
|
|
119
|
+
declare const createHeaderNavItemsField: () => Field;
|
|
120
|
+
|
|
119
121
|
type index_AdminConfig = AdminConfig;
|
|
120
122
|
declare const index_configureAdmin: typeof configureAdmin;
|
|
123
|
+
declare const index_createHeaderNavItemsField: typeof createHeaderNavItemsField;
|
|
121
124
|
declare const index_createThemePreferenceField: typeof createThemePreferenceField;
|
|
122
125
|
declare const index_themePreferenceField: typeof themePreferenceField;
|
|
123
126
|
declare const index_withTooltips: typeof withTooltips;
|
|
124
127
|
declare namespace index {
|
|
125
|
-
export { type index_AdminConfig as AdminConfig, index_configureAdmin as configureAdmin, index_createThemePreferenceField as createThemePreferenceField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
|
|
128
|
+
export { type index_AdminConfig as AdminConfig, index_configureAdmin as configureAdmin, index_createHeaderNavItemsField as createHeaderNavItemsField, index_createThemePreferenceField as createThemePreferenceField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
export { type AdminConfig as A,
|
|
131
|
+
export { type AdminConfig as A, createHeaderNavItemsField as a, createThemePreferenceField as b, configureAdmin as c, index as i, themePreferenceField as t, withTooltips as w };
|
|
@@ -116,13 +116,16 @@ declare function configureAdmin(config: AdminConfig): {
|
|
|
116
116
|
|
|
117
117
|
declare function withTooltips(fields: Field[], customTooltips?: Record<string, string>): Field[];
|
|
118
118
|
|
|
119
|
+
declare const createHeaderNavItemsField: () => Field;
|
|
120
|
+
|
|
119
121
|
type index_AdminConfig = AdminConfig;
|
|
120
122
|
declare const index_configureAdmin: typeof configureAdmin;
|
|
123
|
+
declare const index_createHeaderNavItemsField: typeof createHeaderNavItemsField;
|
|
121
124
|
declare const index_createThemePreferenceField: typeof createThemePreferenceField;
|
|
122
125
|
declare const index_themePreferenceField: typeof themePreferenceField;
|
|
123
126
|
declare const index_withTooltips: typeof withTooltips;
|
|
124
127
|
declare namespace index {
|
|
125
|
-
export { type index_AdminConfig as AdminConfig, index_configureAdmin as configureAdmin, index_createThemePreferenceField as createThemePreferenceField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
|
|
128
|
+
export { type index_AdminConfig as AdminConfig, index_configureAdmin as configureAdmin, index_createHeaderNavItemsField as createHeaderNavItemsField, index_createThemePreferenceField as createThemePreferenceField, index_themePreferenceField as themePreferenceField, index_withTooltips as withTooltips };
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
export { type AdminConfig as A,
|
|
131
|
+
export { type AdminConfig as A, createHeaderNavItemsField as a, createThemePreferenceField as b, configureAdmin as c, index as i, themePreferenceField as t, withTooltips as w };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { i as admin } from './index-
|
|
2
|
-
export { i as adminApp } from './index-
|
|
1
|
+
export { i as admin } from './index-Dj21uD_B.mjs';
|
|
2
|
+
export { i as adminApp } from './index-BBvk9b9i.mjs';
|
|
3
3
|
export { i as blocks } from './index-CluwY0ZQ.mjs';
|
|
4
|
-
export { i as nextjs } from './index-
|
|
4
|
+
export { i as nextjs } from './index-CpG3UHcS.mjs';
|
|
5
5
|
export { i as studio } from './index-CmR6NInu.mjs';
|
|
6
6
|
export { i as studioPages } from './index-B9N5MyjF.mjs';
|
|
7
7
|
import 'payload';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { i as admin } from './index-
|
|
2
|
-
export { i as adminApp } from './index-
|
|
1
|
+
export { i as admin } from './index-Dj21uD_B.js';
|
|
2
|
+
export { i as adminApp } from './index-BBvk9b9i.js';
|
|
3
3
|
export { i as blocks } from './index-CluwY0ZQ.js';
|
|
4
|
-
export { i as nextjs } from './index-
|
|
4
|
+
export { i as nextjs } from './index-CpG3UHcS.js';
|
|
5
5
|
export { i as studio } from './index-CmR6NInu.js';
|
|
6
6
|
export { i as studioPages } from './index-g8tBHLKD.js';
|
|
7
7
|
import 'payload';
|