@orion-studios/payload-studio 0.5.0-beta.76 → 0.5.0-beta.78

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.
@@ -1,9 +1,9 @@
1
- import {
2
- studioDocumentToLayout
3
- } from "./chunk-C2NV4VHU.mjs";
4
1
  import {
5
2
  assertStudioDocumentV1
6
3
  } from "./chunk-ADIIWIYL.mjs";
4
+ import {
5
+ studioDocumentToLayout
6
+ } from "./chunk-FWVVRZ32.mjs";
7
7
  import {
8
8
  __export
9
9
  } from "./chunk-6BWS3CLP.mjs";
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  sectionStyleDefaults
3
3
  } from "./chunk-SIL2J5MF.mjs";
4
- import {
5
- assertStudioDocumentV1
6
- } from "./chunk-ADIIWIYL.mjs";
7
4
  import {
8
5
  __export
9
6
  } from "./chunk-6BWS3CLP.mjs";
@@ -749,6 +746,44 @@ var inspectorDefinitionByBlockType = {
749
746
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
750
747
 
751
748
  // src/studio-pages/migrations.ts
749
+ var isRecord3 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
750
+ var assertPageStudioDocumentV1 = (value) => {
751
+ if (!isRecord3(value)) {
752
+ throw new Error("Studio document must be an object");
753
+ }
754
+ if (value.schemaVersion !== 1) {
755
+ throw new Error("Unsupported studio schemaVersion");
756
+ }
757
+ if (!Array.isArray(value.nodes)) {
758
+ throw new Error("Studio document nodes must be an array");
759
+ }
760
+ const nodes = value.nodes.map((node, index) => {
761
+ if (!isRecord3(node)) {
762
+ throw new Error(`Node at index ${index} must be an object`);
763
+ }
764
+ if (typeof node.id !== "string" || node.id.length === 0) {
765
+ throw new Error(`Node at index ${index} has invalid id`);
766
+ }
767
+ if (typeof node.type !== "string" || node.type.length === 0) {
768
+ throw new Error(`Node at index ${index} has invalid type`);
769
+ }
770
+ if (!isRecord3(node.data)) {
771
+ throw new Error(`Node at index ${index} has invalid data`);
772
+ }
773
+ return {
774
+ data: node.data,
775
+ id: node.id,
776
+ type: node.type
777
+ };
778
+ });
779
+ return {
780
+ metadata: isRecord3(value.metadata) ? value.metadata : void 0,
781
+ nodes,
782
+ schemaVersion: 1,
783
+ title: typeof value.title === "string" ? value.title : void 0,
784
+ updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
785
+ };
786
+ };
752
787
  var migratePageNodeToSettingsV2 = (node) => {
753
788
  const normalized = migrateBlockToSettingsV2({
754
789
  blockType: node.type,
@@ -761,7 +796,7 @@ var migratePageNodeToSettingsV2 = (node) => {
761
796
  };
762
797
  };
763
798
  var migratePageDocumentSettingsToV2 = (value) => {
764
- const current = assertStudioDocumentV1(value);
799
+ const current = assertPageStudioDocumentV1(value);
765
800
  return {
766
801
  ...current,
767
802
  nodes: current.nodes.map(migratePageNodeToSettingsV2)
@@ -1003,18 +1038,24 @@ var pagePaletteGroups = [
1003
1038
  ]
1004
1039
  }
1005
1040
  ];
1006
- var pageInspectorPanels = Object.keys(defaultNodeData).map((nodeType) => ({
1007
- id: `${nodeType}-panel`,
1008
- label: `${nodeTypeLabels[nodeType] || nodeType} Settings`,
1041
+ var pageInspectorPanelRegistry = Object.keys(defaultNodeData).map((nodeType) => ({
1009
1042
  nodeType,
1010
- fields: inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
1011
- advanced: field.advanced,
1012
- group: field.group,
1013
- inlineEditable: field.inlineEditable,
1014
- key: field.key,
1015
- label: field.label,
1016
- type: field.type
1017
- })) || []
1043
+ panelID: `${nodeType}-panel`,
1044
+ panelLabel: `${nodeTypeLabels[nodeType] || nodeType} Settings`
1045
+ }));
1046
+ var resolvePanelFields = (nodeType) => inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
1047
+ advanced: field.advanced,
1048
+ group: field.group,
1049
+ inlineEditable: field.inlineEditable,
1050
+ key: field.key,
1051
+ label: field.label,
1052
+ type: field.type
1053
+ })) || [];
1054
+ var pageInspectorPanels = pageInspectorPanelRegistry.map((entry) => ({
1055
+ fields: resolvePanelFields(entry.nodeType),
1056
+ id: entry.panelID,
1057
+ label: entry.panelLabel,
1058
+ nodeType: entry.nodeType
1018
1059
  }));
1019
1060
  var pageStudioModuleManifest = {
1020
1061
  id: "studio-pages",
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ export { i as adminApp } from './index-ZbOx4OCF.mjs';
3
3
  export { i as blocks } from './index-CluwY0ZQ.mjs';
4
4
  export { i as nextjs } from './index-CpG3UHcS.mjs';
5
5
  export { i as studio } from './index-BIwu3qIH.mjs';
6
- export { i as studioPages } from './index-CdnUNrvX.mjs';
6
+ export { i as studioPages } from './index-DT_Vorvh.mjs';
7
7
  import 'payload';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { i as adminApp } from './index-ZbOx4OCF.js';
3
3
  export { i as blocks } from './index-CluwY0ZQ.js';
4
4
  export { i as nextjs } from './index-CpG3UHcS.js';
5
5
  export { i as studio } from './index-BIwu3qIH.js';
6
- export { i as studioPages } from './index-DyHbWliW.js';
6
+ export { i as studioPages } from './index-BBp-3l6M.js';
7
7
  import 'payload';
8
8
  import 'react/jsx-runtime';
9
9
  import 'react';
package/dist/index.js CHANGED
@@ -3436,6 +3436,44 @@ var inspectorDefinitionByBlockType = {
3436
3436
  var import_jsx_runtime6 = require("react/jsx-runtime");
3437
3437
 
3438
3438
  // src/studio-pages/migrations.ts
3439
+ var isRecord4 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
3440
+ var assertPageStudioDocumentV1 = (value) => {
3441
+ if (!isRecord4(value)) {
3442
+ throw new Error("Studio document must be an object");
3443
+ }
3444
+ if (value.schemaVersion !== 1) {
3445
+ throw new Error("Unsupported studio schemaVersion");
3446
+ }
3447
+ if (!Array.isArray(value.nodes)) {
3448
+ throw new Error("Studio document nodes must be an array");
3449
+ }
3450
+ const nodes = value.nodes.map((node, index) => {
3451
+ if (!isRecord4(node)) {
3452
+ throw new Error(`Node at index ${index} must be an object`);
3453
+ }
3454
+ if (typeof node.id !== "string" || node.id.length === 0) {
3455
+ throw new Error(`Node at index ${index} has invalid id`);
3456
+ }
3457
+ if (typeof node.type !== "string" || node.type.length === 0) {
3458
+ throw new Error(`Node at index ${index} has invalid type`);
3459
+ }
3460
+ if (!isRecord4(node.data)) {
3461
+ throw new Error(`Node at index ${index} has invalid data`);
3462
+ }
3463
+ return {
3464
+ data: node.data,
3465
+ id: node.id,
3466
+ type: node.type
3467
+ };
3468
+ });
3469
+ return {
3470
+ metadata: isRecord4(value.metadata) ? value.metadata : void 0,
3471
+ nodes,
3472
+ schemaVersion: 1,
3473
+ title: typeof value.title === "string" ? value.title : void 0,
3474
+ updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
3475
+ };
3476
+ };
3439
3477
  var migratePageNodeToSettingsV2 = (node) => {
3440
3478
  const normalized = migrateBlockToSettingsV2({
3441
3479
  blockType: node.type,
@@ -3448,7 +3486,7 @@ var migratePageNodeToSettingsV2 = (node) => {
3448
3486
  };
3449
3487
  };
3450
3488
  var migratePageDocumentSettingsToV2 = (value) => {
3451
- const current = assertStudioDocumentV1(value);
3489
+ const current = assertPageStudioDocumentV1(value);
3452
3490
  return {
3453
3491
  ...current,
3454
3492
  nodes: current.nodes.map(migratePageNodeToSettingsV2)
@@ -3690,18 +3728,24 @@ var pagePaletteGroups = [
3690
3728
  ]
3691
3729
  }
3692
3730
  ];
3693
- var pageInspectorPanels = Object.keys(defaultNodeData).map((nodeType) => ({
3694
- id: `${nodeType}-panel`,
3695
- label: `${nodeTypeLabels[nodeType] || nodeType} Settings`,
3731
+ var pageInspectorPanelRegistry = Object.keys(defaultNodeData).map((nodeType) => ({
3696
3732
  nodeType,
3697
- fields: inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
3698
- advanced: field.advanced,
3699
- group: field.group,
3700
- inlineEditable: field.inlineEditable,
3701
- key: field.key,
3702
- label: field.label,
3703
- type: field.type
3704
- })) || []
3733
+ panelID: `${nodeType}-panel`,
3734
+ panelLabel: `${nodeTypeLabels[nodeType] || nodeType} Settings`
3735
+ }));
3736
+ var resolvePanelFields = (nodeType) => inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
3737
+ advanced: field.advanced,
3738
+ group: field.group,
3739
+ inlineEditable: field.inlineEditable,
3740
+ key: field.key,
3741
+ label: field.label,
3742
+ type: field.type
3743
+ })) || [];
3744
+ var pageInspectorPanels = pageInspectorPanelRegistry.map((entry) => ({
3745
+ fields: resolvePanelFields(entry.nodeType),
3746
+ id: entry.panelID,
3747
+ label: entry.panelLabel,
3748
+ nodeType: entry.nodeType
3705
3749
  }));
3706
3750
  var pageStudioModuleManifest = {
3707
3751
  id: "studio-pages",
package/dist/index.mjs CHANGED
@@ -9,14 +9,14 @@ import {
9
9
  } from "./chunk-XK3K5GRP.mjs";
10
10
  import {
11
11
  nextjs_exports
12
- } from "./chunk-J25NGORF.mjs";
13
- import {
14
- studio_pages_exports
15
- } from "./chunk-C2NV4VHU.mjs";
16
- import "./chunk-SIL2J5MF.mjs";
12
+ } from "./chunk-AFLEATYB.mjs";
17
13
  import {
18
14
  studio_exports
19
15
  } from "./chunk-ADIIWIYL.mjs";
16
+ import {
17
+ studio_pages_exports
18
+ } from "./chunk-FWVVRZ32.mjs";
19
+ import "./chunk-SIL2J5MF.mjs";
20
20
  import "./chunk-6BWS3CLP.mjs";
21
21
  export {
22
22
  admin_exports as admin,
@@ -979,18 +979,24 @@ var pageNodeTypes = Object.keys(defaultNodeData).map((type) => ({
979
979
  return data;
980
980
  }
981
981
  }));
982
- var pageInspectorPanels = Object.keys(defaultNodeData).map((nodeType) => ({
983
- id: `${nodeType}-panel`,
984
- label: `${nodeTypeLabels[nodeType] || nodeType} Settings`,
982
+ var pageInspectorPanelRegistry = Object.keys(defaultNodeData).map((nodeType) => ({
985
983
  nodeType,
986
- fields: inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
987
- advanced: field.advanced,
988
- group: field.group,
989
- inlineEditable: field.inlineEditable,
990
- key: field.key,
991
- label: field.label,
992
- type: field.type
993
- })) || []
984
+ panelID: `${nodeType}-panel`,
985
+ panelLabel: `${nodeTypeLabels[nodeType] || nodeType} Settings`
986
+ }));
987
+ var resolvePanelFields = (nodeType) => inspectorDefinitionByBlockType[nodeType]?.fields.map((field) => ({
988
+ advanced: field.advanced,
989
+ group: field.group,
990
+ inlineEditable: field.inlineEditable,
991
+ key: field.key,
992
+ label: field.label,
993
+ type: field.type
994
+ })) || [];
995
+ var pageInspectorPanels = pageInspectorPanelRegistry.map((entry) => ({
996
+ fields: resolvePanelFields(entry.nodeType),
997
+ id: entry.panelID,
998
+ label: entry.panelLabel,
999
+ nodeType: entry.nodeType
994
1000
  }));
995
1001
  var studioDocumentToLayout = (document) => document.nodes.map(
996
1002
  (node) => migrateBlockToSettingsV2({
@@ -4,10 +4,10 @@ import {
4
4
  createPayloadClient,
5
5
  createSiteQueries,
6
6
  resolveMedia
7
- } from "../chunk-J25NGORF.mjs";
8
- import "../chunk-C2NV4VHU.mjs";
9
- import "../chunk-SIL2J5MF.mjs";
7
+ } from "../chunk-AFLEATYB.mjs";
10
8
  import "../chunk-ADIIWIYL.mjs";
9
+ import "../chunk-FWVVRZ32.mjs";
10
+ import "../chunk-SIL2J5MF.mjs";
11
11
  import "../chunk-6BWS3CLP.mjs";
12
12
  export {
13
13
  WEBSITE_CONTENT_TAG,