@orion-studios/payload-studio 0.5.0-beta.7 → 0.5.0-beta.70

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 (67) hide show
  1. package/README.md +20 -0
  2. package/dist/admin/client.d.mts +2 -0
  3. package/dist/admin/client.d.ts +2 -0
  4. package/dist/admin/client.js +779 -137
  5. package/dist/admin/client.mjs +769 -129
  6. package/dist/admin/index.d.mts +1 -1
  7. package/dist/admin/index.d.ts +1 -1
  8. package/dist/admin/index.js +100 -8
  9. package/dist/admin/index.mjs +3 -1
  10. package/dist/admin-app/client.d.mts +7 -0
  11. package/dist/admin-app/client.d.ts +7 -0
  12. package/dist/admin-app/client.js +1262 -3
  13. package/dist/admin-app/client.mjs +1164 -2
  14. package/dist/admin-app/index.d.mts +1 -1
  15. package/dist/admin-app/index.d.ts +1 -1
  16. package/dist/admin-app/index.js +167 -0
  17. package/dist/admin-app/index.mjs +13 -1
  18. package/dist/admin-app/styles.css +229 -0
  19. package/dist/blocks/index.js +633 -8
  20. package/dist/blocks/index.mjs +2 -2
  21. package/dist/{chunk-ZLLNO5FM.mjs → chunk-CKX5Y2HU.mjs} +44 -13
  22. package/dist/{chunk-J7W5EE3B.mjs → chunk-HCEPGEAI.mjs} +100 -8
  23. package/dist/chunk-HXGAG6I7.mjs +325 -0
  24. package/dist/chunk-ROTPP5CU.mjs +99 -0
  25. package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
  26. package/dist/chunk-VDGSMD6H.mjs +1072 -0
  27. package/dist/{chunk-PC5622T7.mjs → chunk-XK3K5GRP.mjs} +620 -9
  28. package/dist/chunk-XVH5SCBD.mjs +234 -0
  29. package/dist/{index-CmR6NInu.d.ts → index-BIwu3qIH.d.mts} +29 -3
  30. package/dist/{index-CmR6NInu.d.mts → index-BIwu3qIH.d.ts} +29 -3
  31. package/dist/index-CdnUNrvX.d.mts +134 -0
  32. package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.mts} +1 -0
  33. package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.ts} +1 -0
  34. package/dist/index-DyHbWliW.d.ts +134 -0
  35. package/dist/index-ZbOx4OCF.d.mts +128 -0
  36. package/dist/index-ZbOx4OCF.d.ts +128 -0
  37. package/dist/{index-DJFhANvJ.d.mts → index-cDYkEj29.d.mts} +20 -2
  38. package/dist/{index-DJFhANvJ.d.ts → index-cDYkEj29.d.ts} +20 -2
  39. package/dist/index.d.mts +5 -5
  40. package/dist/index.d.ts +5 -5
  41. package/dist/index.js +2145 -305
  42. package/dist/index.mjs +9 -9
  43. package/dist/nextjs/index.d.mts +1 -1
  44. package/dist/nextjs/index.d.ts +1 -1
  45. package/dist/nextjs/index.js +996 -13
  46. package/dist/nextjs/index.mjs +4 -1
  47. package/dist/studio/index.d.mts +2 -1
  48. package/dist/studio/index.d.ts +2 -1
  49. package/dist/studio/index.js +171 -2
  50. package/dist/studio/index.mjs +7 -3
  51. package/dist/studio-pages/builder.css +358 -8
  52. package/dist/studio-pages/client.d.mts +17 -0
  53. package/dist/studio-pages/client.d.ts +17 -0
  54. package/dist/studio-pages/client.js +5657 -1478
  55. package/dist/studio-pages/client.mjs +5549 -1461
  56. package/dist/studio-pages/index.d.mts +3 -2
  57. package/dist/studio-pages/index.d.ts +3 -2
  58. package/dist/studio-pages/index.js +799 -29
  59. package/dist/studio-pages/index.mjs +6 -2
  60. package/package.json +26 -12
  61. package/dist/chunk-AAOHJDNS.mjs +0 -67
  62. package/dist/chunk-N67KVM2S.mjs +0 -156
  63. package/dist/chunk-UJFU323N.mjs +0 -301
  64. package/dist/index-B9N5MyjF.d.mts +0 -39
  65. package/dist/index-BallJs-K.d.mts +0 -43
  66. package/dist/index-BallJs-K.d.ts +0 -43
  67. package/dist/index-g8tBHLKD.d.ts +0 -39
@@ -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 AdminNavIcon, c as AdminNavInput, d as AdminNavItem, e as AdminNavLinkItem, f as AdminPage, g as AdminPageLinkOption, h as AdminPageRecord, j as AdminRole, M as MediaDetailPanelProps, k as MediaListItemProps, N as NestedNavItem, l as NestedNavItemInput, m as NestedNavTree, n as buildAdminPageLinkOptions, o as buildNestedNavTree, p as getAdminNavRows, q as navItemIsActive, r as normalizeAdminNavInputs, s as normalizeNestedNavItems, t as parseAdminHeaderNavFromForm, u as roleCanAccessNav } from '../index-ZbOx4OCF.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 AdminNavIcon, c as AdminNavInput, d as AdminNavItem, e as AdminNavLinkItem, f as AdminPage, g as AdminPageLinkOption, h as AdminPageRecord, j as AdminRole, M as MediaDetailPanelProps, k as MediaListItemProps, N as NestedNavItem, l as NestedNavItemInput, m as NestedNavTree, n as buildAdminPageLinkOptions, o as buildNestedNavTree, p as getAdminNavRows, q as navItemIsActive, r as normalizeAdminNavInputs, s as normalizeNestedNavItems, t as parseAdminHeaderNavFromForm, u as roleCanAccessNav } from '../index-ZbOx4OCF.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
  };
@@ -101,6 +101,12 @@
101
101
  background: rgba(0, 0, 0, 0.08);
102
102
  }
103
103
 
104
+ .is-collapsed .orion-admin-nav-link {
105
+ align-items: center;
106
+ display: flex;
107
+ justify-content: center;
108
+ }
109
+
104
110
  .orion-admin-sidebar-footer {
105
111
  border-top: 1px solid var(--orion-admin-border);
106
112
  bottom: 0.9rem;
@@ -120,3 +126,226 @@
120
126
  max-width: none;
121
127
  width: 100%;
122
128
  }
129
+
130
+ .orion-admin-nav-editor {
131
+ border: 1px solid var(--orion-admin-card-border);
132
+ border-radius: 12px;
133
+ display: grid;
134
+ gap: 0.65rem;
135
+ padding: 0.75rem;
136
+ }
137
+
138
+ .orion-admin-nav-editor-head {
139
+ align-items: center;
140
+ display: flex;
141
+ justify-content: space-between;
142
+ }
143
+
144
+ .orion-admin-nav-editor-title {
145
+ font-weight: 800;
146
+ }
147
+
148
+ .orion-admin-nav-editor-add {
149
+ background: #111;
150
+ border: 0;
151
+ border-radius: 999px;
152
+ color: #fff;
153
+ cursor: pointer;
154
+ font-size: 0.86rem;
155
+ font-weight: 800;
156
+ padding: 0.35rem 0.7rem;
157
+ }
158
+
159
+ .orion-admin-action-button {
160
+ background: #111;
161
+ border: 0;
162
+ border-radius: 10px;
163
+ color: #fff;
164
+ cursor: pointer;
165
+ font-weight: 800;
166
+ padding: 0.55rem 0.8rem;
167
+ }
168
+
169
+ .orion-admin-nav-editor-help {
170
+ color: var(--orion-admin-muted);
171
+ font-size: 0.84rem;
172
+ }
173
+
174
+ .orion-admin-nav-editor-empty {
175
+ background: #f2f5f3;
176
+ border: 1px dashed var(--orion-admin-border);
177
+ border-radius: 10px;
178
+ color: var(--orion-admin-muted);
179
+ font-size: 0.9rem;
180
+ padding: 0.7rem;
181
+ }
182
+
183
+ .orion-admin-nav-editor-list {
184
+ display: grid;
185
+ gap: 0.55rem;
186
+ }
187
+
188
+ .orion-admin-nav-editor-row {
189
+ background: #fff;
190
+ border: 1px solid var(--orion-admin-border);
191
+ border-radius: 10px;
192
+ display: grid;
193
+ gap: 0.5rem;
194
+ padding: 0.65rem;
195
+ transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
196
+ }
197
+
198
+ .orion-admin-nav-editor-row.is-dragging {
199
+ border-color: rgba(24, 95, 69, 0.55);
200
+ box-shadow: 0 10px 24px rgba(15, 42, 33, 0.16);
201
+ transform: scale(0.996);
202
+ }
203
+
204
+ .orion-admin-nav-editor-row.is-drop-target {
205
+ border-color: rgba(24, 95, 69, 0.7);
206
+ box-shadow: inset 0 0 0 2px rgba(24, 95, 69, 0.12);
207
+ }
208
+
209
+ .orion-admin-nav-editor-row-head {
210
+ align-items: center;
211
+ display: flex;
212
+ gap: 0.6rem;
213
+ }
214
+
215
+ .orion-admin-nav-editor-drag {
216
+ background: #e8efeb;
217
+ border-radius: 999px;
218
+ color: #255543;
219
+ cursor: grab;
220
+ font-size: 0.75rem;
221
+ font-weight: 800;
222
+ padding: 0.2rem 0.5rem;
223
+ text-transform: uppercase;
224
+ user-select: none;
225
+ }
226
+
227
+ .orion-admin-nav-editor-row-index {
228
+ color: var(--orion-admin-muted);
229
+ font-size: 0.82rem;
230
+ font-weight: 700;
231
+ }
232
+
233
+ .orion-admin-nav-editor-remove {
234
+ background: #8c1f1f;
235
+ border: 0;
236
+ border-radius: 999px;
237
+ color: #fff;
238
+ cursor: pointer;
239
+ font-size: 0.8rem;
240
+ font-weight: 700;
241
+ margin-left: auto;
242
+ padding: 0.25rem 0.6rem;
243
+ }
244
+
245
+ .orion-admin-nav-editor-row-grid {
246
+ display: grid;
247
+ gap: 0.5rem;
248
+ grid-template-columns: repeat(3, minmax(0, 1fr));
249
+ }
250
+
251
+ @media (max-width: 1024px) {
252
+ .orion-admin-nav-editor-row-grid {
253
+ grid-template-columns: 1fr;
254
+ }
255
+ }
256
+
257
+ .orion-admin-media-preview {
258
+ border-radius: 10px;
259
+ display: block;
260
+ height: 68px;
261
+ object-fit: cover;
262
+ width: 68px;
263
+ }
264
+
265
+ .orion-admin-meta-table {
266
+ display: grid;
267
+ gap: 0;
268
+ padding: 0;
269
+ }
270
+
271
+ .orion-admin-meta-row {
272
+ align-items: center;
273
+ display: flex;
274
+ gap: 1rem;
275
+ justify-content: space-between;
276
+ padding: 0.6rem 1rem;
277
+ }
278
+
279
+ .orion-admin-meta-row:not(:last-child) {
280
+ border-bottom: 1px solid var(--orion-admin-card-border);
281
+ }
282
+
283
+ .orion-admin-meta-label {
284
+ color: var(--orion-admin-muted);
285
+ font-size: 0.88rem;
286
+ }
287
+
288
+ .orion-admin-meta-value {
289
+ font-size: 0.92rem;
290
+ font-weight: 700;
291
+ text-align: right;
292
+ }
293
+
294
+ .orion-admin-dropzone {
295
+ align-items: center;
296
+ border: 2px dashed var(--orion-admin-border);
297
+ border-radius: 12px;
298
+ cursor: pointer;
299
+ display: flex;
300
+ justify-content: center;
301
+ min-height: 120px;
302
+ padding: 1rem;
303
+ transition: border-color 0.15s ease, background 0.15s ease;
304
+ }
305
+
306
+ .orion-admin-dropzone:hover {
307
+ border-color: var(--orion-admin-muted);
308
+ }
309
+
310
+ .orion-admin-dropzone.is-dragging {
311
+ background: rgba(24, 95, 69, 0.06);
312
+ border-color: rgba(24, 95, 69, 0.5);
313
+ }
314
+
315
+ .orion-admin-dropzone.has-file {
316
+ border-style: solid;
317
+ }
318
+
319
+ .orion-admin-dropzone-label {
320
+ display: grid;
321
+ gap: 0.2rem;
322
+ text-align: center;
323
+ }
324
+
325
+ .orion-admin-dropzone-label strong {
326
+ font-size: 0.95rem;
327
+ }
328
+
329
+ .orion-admin-dropzone-label span {
330
+ color: var(--orion-admin-muted);
331
+ font-size: 0.85rem;
332
+ }
333
+
334
+ .orion-admin-dropzone-preview {
335
+ align-items: center;
336
+ display: flex;
337
+ gap: 0.8rem;
338
+ }
339
+
340
+ .orion-admin-dropzone-preview img {
341
+ border-radius: 8px;
342
+ height: 60px;
343
+ object-fit: cover;
344
+ width: 60px;
345
+ }
346
+
347
+ .orion-admin-dropzone-preview span {
348
+ color: var(--orion-admin-text);
349
+ font-size: 0.9rem;
350
+ font-weight: 600;
351
+ }