@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.
Files changed (46) hide show
  1. package/dist/admin/client.js +68 -7
  2. package/dist/admin/client.mjs +68 -7
  3. package/dist/admin/index.d.mts +1 -1
  4. package/dist/admin/index.d.ts +1 -1
  5. package/dist/admin/index.js +37 -0
  6. package/dist/admin/index.mjs +3 -1
  7. package/dist/admin-app/client.d.mts +4 -0
  8. package/dist/admin-app/client.d.ts +4 -0
  9. package/dist/admin-app/client.js +705 -2
  10. package/dist/admin-app/client.mjs +701 -1
  11. package/dist/admin-app/index.d.mts +1 -1
  12. package/dist/admin-app/index.d.ts +1 -1
  13. package/dist/admin-app/index.js +167 -0
  14. package/dist/admin-app/index.mjs +13 -1
  15. package/dist/admin-app/styles.css +127 -0
  16. package/dist/blocks/index.js +457 -5
  17. package/dist/blocks/index.mjs +2 -2
  18. package/dist/{chunk-J7W5EE3B.mjs → chunk-7IGLXLUB.mjs} +37 -0
  19. package/dist/{chunk-ZLLNO5FM.mjs → chunk-GNYOAC5N.mjs} +44 -13
  20. package/dist/{chunk-UJFU323N.mjs → chunk-LB72FZZ3.mjs} +33 -9
  21. package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
  22. package/dist/{chunk-PC5622T7.mjs → chunk-XQYJXB46.mjs} +444 -6
  23. package/dist/chunk-XVH5SCBD.mjs +234 -0
  24. package/dist/index-BBvk9b9i.d.mts +97 -0
  25. package/dist/index-BBvk9b9i.d.ts +97 -0
  26. package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.mts} +1 -0
  27. package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.ts} +1 -0
  28. package/dist/{index-DJFhANvJ.d.ts → index-Dj21uD_B.d.mts} +5 -2
  29. package/dist/{index-DJFhANvJ.d.mts → index-Dj21uD_B.d.ts} +5 -2
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +904 -204
  33. package/dist/index.mjs +12 -12
  34. package/dist/nextjs/index.d.mts +1 -1
  35. package/dist/nextjs/index.d.ts +1 -1
  36. package/dist/nextjs/index.js +290 -13
  37. package/dist/nextjs/index.mjs +4 -1
  38. package/dist/studio-pages/builder.css +25 -1
  39. package/dist/studio-pages/client.js +3593 -1279
  40. package/dist/studio-pages/client.mjs +3593 -1279
  41. package/dist/studio-pages/index.js +33 -8
  42. package/dist/studio-pages/index.mjs +2 -2
  43. package/package.json +24 -12
  44. package/dist/chunk-AAOHJDNS.mjs +0 -67
  45. package/dist/index-BallJs-K.d.mts +0 -43
  46. package/dist/index-BallJs-K.d.ts +0 -43
@@ -1,3 +1,3 @@
1
- export { A as AdminBreadcrumbItem, a as AdminBreadcrumbs, b as AdminNavItem, c as AdminPage, d as AdminRole, n as navItemIsActive, r as roleCanAccessNav } from '../index-BallJs-K.mjs';
1
+ export { A as AdminBreadcrumbItem, a as AdminBreadcrumbs, b as AdminNavInput, c as AdminNavItem, d as AdminNavLinkItem, e as AdminPage, f as AdminPageLinkOption, g as AdminPageRecord, h as AdminRole, N as NestedNavItem, j as NestedNavItemInput, k as NestedNavTree, l as buildAdminPageLinkOptions, m as buildNestedNavTree, n as getAdminNavRows, o as navItemIsActive, p as normalizeAdminNavInputs, q as normalizeNestedNavItems, r as parseAdminHeaderNavFromForm, s as roleCanAccessNav } from '../index-BBvk9b9i.mjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
- export { A as AdminBreadcrumbItem, a as AdminBreadcrumbs, b as AdminNavItem, c as AdminPage, d as AdminRole, n as navItemIsActive, r as roleCanAccessNav } from '../index-BallJs-K.js';
1
+ export { A as AdminBreadcrumbItem, a as AdminBreadcrumbs, b as AdminNavInput, c as AdminNavItem, d as AdminNavLinkItem, e as AdminPage, f as AdminPageLinkOption, g as AdminPageRecord, h as AdminRole, N as NestedNavItem, j as NestedNavItemInput, k as NestedNavTree, l as buildAdminPageLinkOptions, m as buildNestedNavTree, n as getAdminNavRows, o as navItemIsActive, p as normalizeAdminNavInputs, q as normalizeNestedNavItems, r as parseAdminHeaderNavFromForm, s as roleCanAccessNav } from '../index-BBvk9b9i.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
@@ -22,7 +22,13 @@ var admin_app_exports = {};
22
22
  __export(admin_app_exports, {
23
23
  AdminBreadcrumbs: () => AdminBreadcrumbs,
24
24
  AdminPage: () => AdminPage,
25
+ buildAdminPageLinkOptions: () => buildAdminPageLinkOptions,
26
+ buildNestedNavTree: () => buildNestedNavTree,
27
+ getAdminNavRows: () => getAdminNavRows,
25
28
  navItemIsActive: () => navItemIsActive,
29
+ normalizeAdminNavInputs: () => normalizeAdminNavInputs,
30
+ normalizeNestedNavItems: () => normalizeNestedNavItems,
31
+ parseAdminHeaderNavFromForm: () => parseAdminHeaderNavFromForm,
26
32
  roleCanAccessNav: () => roleCanAccessNav
27
33
  });
28
34
  module.exports = __toCommonJS(admin_app_exports);
@@ -57,6 +63,161 @@ function AdminPage({ title, description, breadcrumbs, actions, children }) {
57
63
  ] });
58
64
  }
59
65
 
66
+ // src/admin-app/nestedNavigation.ts
67
+ var normalizeNestedNavItems = (items) => {
68
+ const deduped = [];
69
+ const seen = /* @__PURE__ */ new Set();
70
+ for (const item of items) {
71
+ const href = typeof item.href === "string" ? item.href.trim() : "";
72
+ const label = typeof item.label === "string" ? item.label.trim() : "";
73
+ const parentHref = typeof item.parentHref === "string" ? item.parentHref.trim() : "";
74
+ if (!href || !label || seen.has(href)) {
75
+ continue;
76
+ }
77
+ seen.add(href);
78
+ deduped.push({
79
+ href,
80
+ label,
81
+ ...parentHref ? { parentHref } : {}
82
+ });
83
+ }
84
+ const hrefs = new Set(deduped.map((item) => item.href));
85
+ return deduped.map((item) => ({
86
+ href: item.href,
87
+ label: item.label,
88
+ ...item.parentHref && item.parentHref !== item.href && hrefs.has(item.parentHref) ? { parentHref: item.parentHref } : {}
89
+ }));
90
+ };
91
+ var buildNestedNavTree = (items) => {
92
+ const childrenByParent = /* @__PURE__ */ new Map();
93
+ const topLevel = [];
94
+ for (const item of items) {
95
+ if (!item.parentHref) {
96
+ topLevel.push(item);
97
+ continue;
98
+ }
99
+ const children = childrenByParent.get(item.parentHref) || [];
100
+ children.push(item);
101
+ childrenByParent.set(item.parentHref, children);
102
+ }
103
+ if (topLevel.length === 0 && items.length > 0) {
104
+ return {
105
+ topLevel: items.map((item) => ({ href: item.href, label: item.label })),
106
+ childrenByParent: /* @__PURE__ */ new Map()
107
+ };
108
+ }
109
+ return { childrenByParent, topLevel };
110
+ };
111
+
112
+ // src/admin-app/navigationLinks.ts
113
+ var fallbackHomeOption = {
114
+ href: "/",
115
+ label: "Home",
116
+ title: "Home"
117
+ };
118
+ var buildAdminPageLinkOptions = (pages) => {
119
+ const options = pages.map((page) => {
120
+ const href = typeof page.path === "string" ? page.path.trim() : "";
121
+ const title = typeof page.title === "string" && page.title.trim().length > 0 ? page.title.trim() : "Untitled Page";
122
+ if (!href) {
123
+ return null;
124
+ }
125
+ const depth = href === "/" ? 0 : href.split("/").filter(Boolean).length;
126
+ const indentLevel = Math.max(depth - 1, 0);
127
+ const indent = indentLevel > 0 ? `${"\u21B3 ".repeat(indentLevel)}` : "";
128
+ return {
129
+ href,
130
+ label: `${indent}${title}`,
131
+ title
132
+ };
133
+ }).filter((option) => option !== null).sort((a, b) => {
134
+ if (a.href === "/" && b.href !== "/") return -1;
135
+ if (b.href === "/" && a.href !== "/") return 1;
136
+ return a.href.localeCompare(b.href);
137
+ });
138
+ if (options.length === 0) {
139
+ return [fallbackHomeOption];
140
+ }
141
+ return options;
142
+ };
143
+ var getAdminNavRows = (navItems, pageOptions, minRows = 6, maxRows = 20) => {
144
+ const preferredRows = Math.max(navItems.length + 2, Math.min(8, pageOptions.length));
145
+ return Math.min(Math.max(minRows, preferredRows), maxRows);
146
+ };
147
+ var normalizeAdminNavInputs = (rows, pageOptions) => {
148
+ const allowedLinks = new Map(pageOptions.map((option) => [option.href, option.title]));
149
+ const deduped = [];
150
+ const seen = /* @__PURE__ */ new Set();
151
+ for (const row of rows) {
152
+ const href = typeof row.href === "string" ? row.href.trim() : "";
153
+ const defaultLabel = allowedLinks.get(href);
154
+ const explicitLabel = typeof row.label === "string" ? row.label.trim() : "";
155
+ const parentHref = typeof row.parentHref === "string" ? row.parentHref.trim() : "";
156
+ if (!href || !defaultLabel || seen.has(href)) {
157
+ continue;
158
+ }
159
+ seen.add(href);
160
+ deduped.push({
161
+ href,
162
+ label: explicitLabel.length > 0 ? explicitLabel : defaultLabel,
163
+ ...parentHref.length > 0 ? { parentHref } : {}
164
+ });
165
+ }
166
+ const hrefs = new Set(deduped.map((item) => item.href));
167
+ const parentByHref = new Map(deduped.map((item) => [item.href, item.parentHref || ""]));
168
+ const createsCycle = (href, parentHref) => {
169
+ const visited = /* @__PURE__ */ new Set([href]);
170
+ let current = parentHref;
171
+ while (current) {
172
+ if (visited.has(current)) {
173
+ return true;
174
+ }
175
+ visited.add(current);
176
+ current = parentByHref.get(current) || "";
177
+ }
178
+ return false;
179
+ };
180
+ return deduped.map((item) => {
181
+ const parentHref = item.parentHref;
182
+ if (!parentHref || parentHref === item.href || !hrefs.has(parentHref) || createsCycle(item.href, parentHref)) {
183
+ return {
184
+ href: item.href,
185
+ label: item.label
186
+ };
187
+ }
188
+ return item;
189
+ });
190
+ };
191
+ var parseAdminHeaderNavFromForm = (formData, pageOptions, maxRows = 24) => {
192
+ const serialized = String(formData.get("navItemsState") || "").trim();
193
+ if (serialized.length > 0) {
194
+ try {
195
+ const parsed = JSON.parse(serialized);
196
+ if (Array.isArray(parsed)) {
197
+ return normalizeAdminNavInputs(parsed.slice(0, maxRows), pageOptions);
198
+ }
199
+ } catch {
200
+ }
201
+ }
202
+ const rawCount = Number(String(formData.get("navCount") || "0"));
203
+ const navCount = Number.isFinite(rawCount) ? Math.max(0, Math.min(rawCount, maxRows)) : 0;
204
+ const navRows = [];
205
+ for (let index = 0; index < navCount; index += 1) {
206
+ const href = String(formData.get(`navPage_${index}`) || "").trim();
207
+ const label = String(formData.get(`navLabel_${index}`) || "").trim();
208
+ const parentHref = String(formData.get(`navParentHref_${index}`) || "").trim();
209
+ navRows.push({
210
+ href,
211
+ label,
212
+ parentHref
213
+ });
214
+ }
215
+ if (navRows.length > 0) {
216
+ return normalizeAdminNavInputs(navRows, pageOptions);
217
+ }
218
+ return [];
219
+ };
220
+
60
221
  // src/admin-app/routeRegistry.ts
61
222
  var roleCanAccessNav = (role, item) => {
62
223
  if (!item.roles || item.roles.length === 0) {
@@ -77,6 +238,12 @@ var navItemIsActive = (pathname, item) => {
77
238
  0 && (module.exports = {
78
239
  AdminBreadcrumbs,
79
240
  AdminPage,
241
+ buildAdminPageLinkOptions,
242
+ buildNestedNavTree,
243
+ getAdminNavRows,
80
244
  navItemIsActive,
245
+ normalizeAdminNavInputs,
246
+ normalizeNestedNavItems,
247
+ parseAdminHeaderNavFromForm,
81
248
  roleCanAccessNav
82
249
  });
@@ -1,13 +1,25 @@
1
1
  import {
2
2
  AdminBreadcrumbs,
3
3
  AdminPage,
4
+ buildAdminPageLinkOptions,
5
+ buildNestedNavTree,
6
+ getAdminNavRows,
4
7
  navItemIsActive,
8
+ normalizeAdminNavInputs,
9
+ normalizeNestedNavItems,
10
+ parseAdminHeaderNavFromForm,
5
11
  roleCanAccessNav
6
- } from "../chunk-AAOHJDNS.mjs";
12
+ } from "../chunk-XVH5SCBD.mjs";
7
13
  import "../chunk-6BWS3CLP.mjs";
8
14
  export {
9
15
  AdminBreadcrumbs,
10
16
  AdminPage,
17
+ buildAdminPageLinkOptions,
18
+ buildNestedNavTree,
19
+ getAdminNavRows,
11
20
  navItemIsActive,
21
+ normalizeAdminNavInputs,
22
+ normalizeNestedNavItems,
23
+ parseAdminHeaderNavFromForm,
12
24
  roleCanAccessNav
13
25
  };
@@ -120,3 +120,130 @@
120
120
  max-width: none;
121
121
  width: 100%;
122
122
  }
123
+
124
+ .orion-admin-nav-editor {
125
+ border: 1px solid var(--orion-admin-card-border);
126
+ border-radius: 12px;
127
+ display: grid;
128
+ gap: 0.65rem;
129
+ padding: 0.75rem;
130
+ }
131
+
132
+ .orion-admin-nav-editor-head {
133
+ align-items: center;
134
+ display: flex;
135
+ justify-content: space-between;
136
+ }
137
+
138
+ .orion-admin-nav-editor-title {
139
+ font-weight: 800;
140
+ }
141
+
142
+ .orion-admin-nav-editor-add {
143
+ background: #111;
144
+ border: 0;
145
+ border-radius: 999px;
146
+ color: #fff;
147
+ cursor: pointer;
148
+ font-size: 0.86rem;
149
+ font-weight: 800;
150
+ padding: 0.35rem 0.7rem;
151
+ }
152
+
153
+ .orion-admin-action-button {
154
+ background: #111;
155
+ border: 0;
156
+ border-radius: 10px;
157
+ color: #fff;
158
+ cursor: pointer;
159
+ font-weight: 800;
160
+ padding: 0.55rem 0.8rem;
161
+ }
162
+
163
+ .orion-admin-nav-editor-help {
164
+ color: var(--orion-admin-muted);
165
+ font-size: 0.84rem;
166
+ }
167
+
168
+ .orion-admin-nav-editor-empty {
169
+ background: #f2f5f3;
170
+ border: 1px dashed var(--orion-admin-border);
171
+ border-radius: 10px;
172
+ color: var(--orion-admin-muted);
173
+ font-size: 0.9rem;
174
+ padding: 0.7rem;
175
+ }
176
+
177
+ .orion-admin-nav-editor-list {
178
+ display: grid;
179
+ gap: 0.55rem;
180
+ }
181
+
182
+ .orion-admin-nav-editor-row {
183
+ background: #fff;
184
+ border: 1px solid var(--orion-admin-border);
185
+ border-radius: 10px;
186
+ display: grid;
187
+ gap: 0.5rem;
188
+ padding: 0.65rem;
189
+ transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
190
+ }
191
+
192
+ .orion-admin-nav-editor-row.is-dragging {
193
+ border-color: rgba(24, 95, 69, 0.55);
194
+ box-shadow: 0 10px 24px rgba(15, 42, 33, 0.16);
195
+ transform: scale(0.996);
196
+ }
197
+
198
+ .orion-admin-nav-editor-row.is-drop-target {
199
+ border-color: rgba(24, 95, 69, 0.7);
200
+ box-shadow: inset 0 0 0 2px rgba(24, 95, 69, 0.12);
201
+ }
202
+
203
+ .orion-admin-nav-editor-row-head {
204
+ align-items: center;
205
+ display: flex;
206
+ gap: 0.6rem;
207
+ }
208
+
209
+ .orion-admin-nav-editor-drag {
210
+ background: #e8efeb;
211
+ border-radius: 999px;
212
+ color: #255543;
213
+ cursor: grab;
214
+ font-size: 0.75rem;
215
+ font-weight: 800;
216
+ padding: 0.2rem 0.5rem;
217
+ text-transform: uppercase;
218
+ user-select: none;
219
+ }
220
+
221
+ .orion-admin-nav-editor-row-index {
222
+ color: var(--orion-admin-muted);
223
+ font-size: 0.82rem;
224
+ font-weight: 700;
225
+ }
226
+
227
+ .orion-admin-nav-editor-remove {
228
+ background: #8c1f1f;
229
+ border: 0;
230
+ border-radius: 999px;
231
+ color: #fff;
232
+ cursor: pointer;
233
+ font-size: 0.8rem;
234
+ font-weight: 700;
235
+ margin-left: auto;
236
+ padding: 0.25rem 0.6rem;
237
+ }
238
+
239
+ .orion-admin-nav-editor-row-grid {
240
+ display: grid;
241
+ gap: 0.5rem;
242
+ grid-template-columns: repeat(3, minmax(0, 1fr));
243
+ }
244
+
245
+ @media (max-width: 1024px) {
246
+ .orion-admin-nav-editor-row-grid {
247
+ grid-template-columns: 1fr;
248
+ }
249
+ }