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

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.
@@ -778,6 +778,88 @@ var inspectorDefinitionByBlockType = {
778
778
  // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
779
779
  var import_jsx_runtime3 = require("react/jsx-runtime");
780
780
 
781
+ // src/studio/imageUploadOptimization.ts
782
+ var import_promises = require("fs/promises");
783
+ var DEFAULT_OPTIONS = {
784
+ avifQuality: 50,
785
+ enforceSmallerForLossy: true,
786
+ jpegQuality: 78,
787
+ minBytes: 48 * 1024,
788
+ minQualityFloor: 42,
789
+ onlyIfSmaller: true,
790
+ pngCompressionLevel: 9,
791
+ skipAnimated: true,
792
+ tiffQuality: 75,
793
+ webpQuality: 78
794
+ };
795
+
796
+ // src/studio/index.ts
797
+ var isRecord3 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
798
+ function assertStudioDocumentV1(input) {
799
+ if (!isRecord3(input)) {
800
+ throw new Error("Studio document must be an object");
801
+ }
802
+ if (input.schemaVersion !== 1) {
803
+ throw new Error("Unsupported studio schemaVersion");
804
+ }
805
+ if (!Array.isArray(input.nodes)) {
806
+ throw new Error("Studio document nodes must be an array");
807
+ }
808
+ const nodes = input.nodes.map((node, index) => {
809
+ if (!isRecord3(node)) {
810
+ throw new Error(`Node at index ${index} must be an object`);
811
+ }
812
+ if (typeof node.id !== "string" || node.id.length === 0) {
813
+ throw new Error(`Node at index ${index} has invalid id`);
814
+ }
815
+ if (typeof node.type !== "string" || node.type.length === 0) {
816
+ throw new Error(`Node at index ${index} has invalid type`);
817
+ }
818
+ if (!isRecord3(node.data)) {
819
+ throw new Error(`Node at index ${index} has invalid data`);
820
+ }
821
+ return {
822
+ id: node.id,
823
+ type: node.type,
824
+ data: node.data
825
+ };
826
+ });
827
+ return {
828
+ metadata: isRecord3(input.metadata) ? input.metadata : void 0,
829
+ schemaVersion: 1,
830
+ title: typeof input.title === "string" ? input.title : void 0,
831
+ nodes,
832
+ updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
833
+ };
834
+ }
835
+
836
+ // src/studio-pages/migrations.ts
837
+ var migratePageNodeToSettingsV2 = (node) => {
838
+ const normalized = migrateBlockToSettingsV2({
839
+ blockType: node.type,
840
+ ...node.data
841
+ });
842
+ const { blockType: _ignoredBlockType, ...data } = normalized;
843
+ return {
844
+ ...node,
845
+ data
846
+ };
847
+ };
848
+ var migratePageDocumentSettingsToV2 = (value) => {
849
+ const current = assertStudioDocumentV1(value);
850
+ return {
851
+ ...current,
852
+ nodes: current.nodes.map(migratePageNodeToSettingsV2)
853
+ };
854
+ };
855
+ var pageStudioMigrations = [
856
+ {
857
+ fromVersion: 1,
858
+ migrate: migratePageDocumentSettingsToV2,
859
+ toVersion: 1
860
+ }
861
+ ];
862
+
781
863
  // src/studio-pages/index.ts
782
864
  var withSectionStyleDefaults = (value) => ({
783
865
  ...sectionStyleDefaults,
@@ -1027,7 +1109,7 @@ var pageStudioModuleManifest = {
1027
1109
  paletteGroups: pagePaletteGroups,
1028
1110
  inspectorPanels: pageInspectorPanels,
1029
1111
  validators: [validatePageDocument],
1030
- migrations: [],
1112
+ migrations: pageStudioMigrations,
1031
1113
  compiler: {
1032
1114
  compileNode: (node) => {
1033
1115
  const normalized = migrateBlockToSettingsV2({
@@ -8,8 +8,9 @@ import {
8
8
  pageStudioModuleManifest,
9
9
  resolveBuilderThemeTokens,
10
10
  studioDocumentToLayout
11
- } from "../chunk-C6VEFZVY.mjs";
11
+ } from "../chunk-C2NV4VHU.mjs";
12
12
  import "../chunk-SIL2J5MF.mjs";
13
+ import "../chunk-ADIIWIYL.mjs";
13
14
  import "../chunk-6BWS3CLP.mjs";
14
15
  export {
15
16
  createDefaultStudioDocument,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.5.0-beta.74",
3
+ "version": "0.5.0-beta.76",
4
4
  "description": "Unified Payload CMS toolkit for Orion Studios",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",