@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.
- package/README.md +20 -0
- package/dist/admin/client.d.mts +2 -0
- package/dist/admin/client.d.ts +2 -0
- package/dist/admin/client.js +779 -137
- package/dist/admin/client.mjs +769 -129
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +100 -8
- package/dist/admin/index.mjs +3 -1
- package/dist/admin-app/client.d.mts +7 -0
- package/dist/admin-app/client.d.ts +7 -0
- package/dist/admin-app/client.js +1262 -3
- package/dist/admin-app/client.mjs +1164 -2
- 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 +229 -0
- package/dist/blocks/index.js +633 -8
- package/dist/blocks/index.mjs +2 -2
- package/dist/{chunk-ZLLNO5FM.mjs → chunk-CKX5Y2HU.mjs} +44 -13
- package/dist/{chunk-J7W5EE3B.mjs → chunk-HCEPGEAI.mjs} +100 -8
- package/dist/chunk-HXGAG6I7.mjs +325 -0
- package/dist/chunk-ROTPP5CU.mjs +99 -0
- package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
- package/dist/chunk-VDGSMD6H.mjs +1072 -0
- package/dist/{chunk-PC5622T7.mjs → chunk-XK3K5GRP.mjs} +620 -9
- package/dist/chunk-XVH5SCBD.mjs +234 -0
- package/dist/{index-CmR6NInu.d.ts → index-BIwu3qIH.d.mts} +29 -3
- package/dist/{index-CmR6NInu.d.mts → index-BIwu3qIH.d.ts} +29 -3
- package/dist/index-CdnUNrvX.d.mts +134 -0
- package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.mts} +1 -0
- package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.ts} +1 -0
- package/dist/index-DyHbWliW.d.ts +134 -0
- package/dist/index-ZbOx4OCF.d.mts +128 -0
- package/dist/index-ZbOx4OCF.d.ts +128 -0
- package/dist/{index-DJFhANvJ.d.mts → index-cDYkEj29.d.mts} +20 -2
- package/dist/{index-DJFhANvJ.d.ts → index-cDYkEj29.d.ts} +20 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +2145 -305
- package/dist/index.mjs +9 -9
- package/dist/nextjs/index.d.mts +1 -1
- package/dist/nextjs/index.d.ts +1 -1
- package/dist/nextjs/index.js +996 -13
- package/dist/nextjs/index.mjs +4 -1
- package/dist/studio/index.d.mts +2 -1
- package/dist/studio/index.d.ts +2 -1
- package/dist/studio/index.js +171 -2
- package/dist/studio/index.mjs +7 -3
- package/dist/studio-pages/builder.css +358 -8
- package/dist/studio-pages/client.d.mts +17 -0
- package/dist/studio-pages/client.d.ts +17 -0
- package/dist/studio-pages/client.js +5657 -1478
- package/dist/studio-pages/client.mjs +5549 -1461
- package/dist/studio-pages/index.d.mts +3 -2
- package/dist/studio-pages/index.d.ts +3 -2
- package/dist/studio-pages/index.js +799 -29
- package/dist/studio-pages/index.mjs +6 -2
- package/package.json +26 -12
- package/dist/chunk-AAOHJDNS.mjs +0 -67
- package/dist/chunk-N67KVM2S.mjs +0 -156
- package/dist/chunk-UJFU323N.mjs +0 -301
- package/dist/index-B9N5MyjF.d.mts +0 -39
- package/dist/index-BallJs-K.d.mts +0 -43
- package/dist/index-BallJs-K.d.ts +0 -43
- package/dist/index-g8tBHLKD.d.ts +0 -39
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDefaultStudioDocument,
|
|
3
|
+
defaultBuilderThemeTokens,
|
|
3
4
|
layoutToStudioDocument,
|
|
4
5
|
pageInspectorPanels,
|
|
5
6
|
pageNodeTypes,
|
|
6
7
|
pagePaletteGroups,
|
|
7
8
|
pageStudioModuleManifest,
|
|
9
|
+
resolveBuilderThemeTokens,
|
|
8
10
|
studioDocumentToLayout
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
+
} from "../chunk-VDGSMD6H.mjs";
|
|
12
|
+
import "../chunk-SIL2J5MF.mjs";
|
|
11
13
|
import "../chunk-6BWS3CLP.mjs";
|
|
12
14
|
export {
|
|
13
15
|
createDefaultStudioDocument,
|
|
16
|
+
defaultBuilderThemeTokens,
|
|
14
17
|
layoutToStudioDocument,
|
|
15
18
|
pageInspectorPanels,
|
|
16
19
|
pageNodeTypes,
|
|
17
20
|
pagePaletteGroups,
|
|
18
21
|
pageStudioModuleManifest,
|
|
22
|
+
resolveBuilderThemeTokens,
|
|
19
23
|
studioDocumentToLayout
|
|
20
24
|
};
|
package/package.json
CHANGED
|
@@ -1,60 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-studios/payload-studio",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.70",
|
|
4
4
|
"description": "Unified Payload CMS toolkit for Orion Studios",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
6
8
|
"exports": {
|
|
7
9
|
".": {
|
|
8
10
|
"types": "./dist/index.d.ts",
|
|
9
11
|
"require": "./dist/index.js",
|
|
10
|
-
"import": "./dist/index.mjs"
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"default": "./dist/index.mjs"
|
|
11
14
|
},
|
|
12
15
|
"./admin": {
|
|
13
16
|
"types": "./dist/admin/index.d.ts",
|
|
14
17
|
"require": "./dist/admin/index.js",
|
|
15
|
-
"import": "./dist/admin/index.mjs"
|
|
18
|
+
"import": "./dist/admin/index.mjs",
|
|
19
|
+
"default": "./dist/admin/index.mjs"
|
|
16
20
|
},
|
|
17
21
|
"./admin/client": {
|
|
18
22
|
"types": "./dist/admin/client.d.ts",
|
|
19
23
|
"require": "./dist/admin/client.js",
|
|
20
|
-
"import": "./dist/admin/client.mjs"
|
|
24
|
+
"import": "./dist/admin/client.mjs",
|
|
25
|
+
"default": "./dist/admin/client.mjs"
|
|
21
26
|
},
|
|
22
27
|
"./admin.css": "./dist/admin.css",
|
|
23
28
|
"./admin-app": {
|
|
24
29
|
"types": "./dist/admin-app/index.d.ts",
|
|
25
30
|
"require": "./dist/admin-app/index.js",
|
|
26
|
-
"import": "./dist/admin-app/index.mjs"
|
|
31
|
+
"import": "./dist/admin-app/index.mjs",
|
|
32
|
+
"default": "./dist/admin-app/index.mjs"
|
|
27
33
|
},
|
|
28
34
|
"./admin-app/client": {
|
|
29
35
|
"types": "./dist/admin-app/client.d.ts",
|
|
30
36
|
"require": "./dist/admin-app/client.js",
|
|
31
|
-
"import": "./dist/admin-app/client.mjs"
|
|
37
|
+
"import": "./dist/admin-app/client.mjs",
|
|
38
|
+
"default": "./dist/admin-app/client.mjs"
|
|
32
39
|
},
|
|
33
40
|
"./admin-app/styles.css": "./dist/admin-app/styles.css",
|
|
34
41
|
"./blocks": {
|
|
35
42
|
"types": "./dist/blocks/index.d.ts",
|
|
36
43
|
"require": "./dist/blocks/index.js",
|
|
37
|
-
"import": "./dist/blocks/index.mjs"
|
|
44
|
+
"import": "./dist/blocks/index.mjs",
|
|
45
|
+
"default": "./dist/blocks/index.mjs"
|
|
38
46
|
},
|
|
39
47
|
"./nextjs": {
|
|
40
48
|
"types": "./dist/nextjs/index.d.ts",
|
|
41
49
|
"require": "./dist/nextjs/index.js",
|
|
42
|
-
"import": "./dist/nextjs/index.mjs"
|
|
50
|
+
"import": "./dist/nextjs/index.mjs",
|
|
51
|
+
"default": "./dist/nextjs/index.mjs"
|
|
43
52
|
},
|
|
44
53
|
"./studio": {
|
|
45
54
|
"types": "./dist/studio/index.d.ts",
|
|
46
55
|
"require": "./dist/studio/index.js",
|
|
47
|
-
"import": "./dist/studio/index.mjs"
|
|
56
|
+
"import": "./dist/studio/index.mjs",
|
|
57
|
+
"default": "./dist/studio/index.mjs"
|
|
48
58
|
},
|
|
49
59
|
"./studio-pages": {
|
|
50
60
|
"types": "./dist/studio-pages/index.d.ts",
|
|
51
61
|
"require": "./dist/studio-pages/index.js",
|
|
52
|
-
"import": "./dist/studio-pages/index.mjs"
|
|
62
|
+
"import": "./dist/studio-pages/index.mjs",
|
|
63
|
+
"default": "./dist/studio-pages/index.mjs"
|
|
53
64
|
},
|
|
54
65
|
"./studio-pages/client": {
|
|
55
66
|
"types": "./dist/studio-pages/client.d.ts",
|
|
56
67
|
"require": "./dist/studio-pages/client.js",
|
|
57
|
-
"import": "./dist/studio-pages/client.mjs"
|
|
68
|
+
"import": "./dist/studio-pages/client.mjs",
|
|
69
|
+
"default": "./dist/studio-pages/client.mjs"
|
|
58
70
|
},
|
|
59
71
|
"./studio-pages/builder.css": "./dist/studio-pages/builder.css",
|
|
60
72
|
"./package.json": "./package.json"
|
|
@@ -63,8 +75,9 @@
|
|
|
63
75
|
"dist"
|
|
64
76
|
],
|
|
65
77
|
"scripts": {
|
|
66
|
-
"build": "tsup && node -e \"const fs=require('fs'); fs.copyFileSync('src/admin/styles/admin.css','dist/admin.css'); fs.mkdirSync('dist/admin-app',{recursive:true}); fs.copyFileSync('src/admin-app/styles/admin-app.css','dist/admin-app/styles.css'); fs.mkdirSync('dist/studio-pages',{recursive:true}); fs.copyFileSync('src/studio-pages/styles/builder.css','dist/studio-pages/builder.css'); fs.mkdirSync('dist/admin',{recursive:true}); fs.copyFileSync('src/admin/client.d.ts','dist/admin/client.d.ts'); fs.copyFileSync('src/admin/client.d.ts','dist/admin/client.d.mts'); fs.copyFileSync('src/studio-pages/client.d.ts','dist/studio-pages/client.d.ts'); fs.copyFileSync('src/studio-pages/client.d.ts','dist/studio-pages/client.d.mts')\"",
|
|
78
|
+
"build": "tsup && node -e \"const fs=require('fs'); fs.copyFileSync('src/admin/styles/admin.css','dist/admin.css'); fs.mkdirSync('dist/admin-app',{recursive:true}); fs.copyFileSync('src/admin-app/styles/admin-app.css','dist/admin-app/styles.css'); fs.mkdirSync('dist/studio-pages',{recursive:true}); fs.copyFileSync('src/studio-pages/styles/builder.css','dist/studio-pages/builder.css'); fs.mkdirSync('dist/admin',{recursive:true}); fs.copyFileSync('src/admin/client.d.ts','dist/admin/client.d.ts'); fs.copyFileSync('src/admin/client.d.ts','dist/admin/client.d.mts'); fs.copyFileSync('src/admin-app/client.d.ts','dist/admin-app/client.d.ts'); fs.copyFileSync('src/admin-app/client.d.ts','dist/admin-app/client.d.mts'); fs.copyFileSync('src/studio-pages/client.d.ts','dist/studio-pages/client.d.ts'); fs.copyFileSync('src/studio-pages/client.d.ts','dist/studio-pages/client.d.mts')\"",
|
|
67
79
|
"dev": "tsup --watch",
|
|
80
|
+
"test": "tsx --test src/studio-pages/builder/settings-v2/__tests__/*.test.ts",
|
|
68
81
|
"typecheck": "tsc --noEmit"
|
|
69
82
|
},
|
|
70
83
|
"keywords": [
|
|
@@ -92,6 +105,7 @@
|
|
|
92
105
|
"@types/react-dom": "^19.0.0",
|
|
93
106
|
"next": "16.1.6",
|
|
94
107
|
"payload": "3.75.0",
|
|
108
|
+
"tsx": "^4.21.0",
|
|
95
109
|
"tsup": "^8.0.0",
|
|
96
110
|
"typescript": "^5.3.0"
|
|
97
111
|
}
|
package/dist/chunk-AAOHJDNS.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
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
|
-
navItemIsActive: () => navItemIsActive,
|
|
11
|
-
roleCanAccessNav: () => roleCanAccessNav
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// src/admin-app/components/AdminBreadcrumbs.tsx
|
|
15
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
function AdminBreadcrumbs({ items }) {
|
|
17
|
-
return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", className: "orion-admin-breadcrumbs", children: items.map((item, index) => {
|
|
18
|
-
const isLast = index === items.length - 1;
|
|
19
|
-
return /* @__PURE__ */ jsxs("span", { children: [
|
|
20
|
-
item.href && !isLast ? /* @__PURE__ */ jsx("a", { href: item.href, children: item.label }) : /* @__PURE__ */ jsx("span", { children: item.label }),
|
|
21
|
-
!isLast ? /* @__PURE__ */ jsx("span", { className: "orion-admin-breadcrumb-sep", children: "/" }) : null
|
|
22
|
-
] }, `${item.label}-${index}`);
|
|
23
|
-
}) });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/admin-app/components/AdminPage.tsx
|
|
27
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
28
|
-
function AdminPage({ title, description, breadcrumbs, actions, children }) {
|
|
29
|
-
return /* @__PURE__ */ jsxs2("div", { className: "orion-admin-page", children: [
|
|
30
|
-
/* @__PURE__ */ jsxs2("div", { className: "orion-admin-page-header", children: [
|
|
31
|
-
/* @__PURE__ */ jsx2(AdminBreadcrumbs, { items: breadcrumbs }),
|
|
32
|
-
/* @__PURE__ */ jsxs2("div", { className: "orion-admin-page-title-row", children: [
|
|
33
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
34
|
-
/* @__PURE__ */ jsx2("h1", { children: title }),
|
|
35
|
-
description ? /* @__PURE__ */ jsx2("p", { children: description }) : null
|
|
36
|
-
] }),
|
|
37
|
-
actions ? /* @__PURE__ */ jsx2("div", { className: "orion-admin-page-actions", children: actions }) : null
|
|
38
|
-
] })
|
|
39
|
-
] }),
|
|
40
|
-
/* @__PURE__ */ jsx2("div", { className: "orion-admin-page-content", children })
|
|
41
|
-
] });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/admin-app/routeRegistry.ts
|
|
45
|
-
var roleCanAccessNav = (role, item) => {
|
|
46
|
-
if (!item.roles || item.roles.length === 0) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
if (!role) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return item.roles.includes(role);
|
|
53
|
-
};
|
|
54
|
-
var navItemIsActive = (pathname, item) => {
|
|
55
|
-
if (item.href === "/admin") {
|
|
56
|
-
return pathname === "/admin";
|
|
57
|
-
}
|
|
58
|
-
return item.matchPrefixes.some((prefix) => pathname.startsWith(prefix));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export {
|
|
62
|
-
AdminBreadcrumbs,
|
|
63
|
-
AdminPage,
|
|
64
|
-
roleCanAccessNav,
|
|
65
|
-
navItemIsActive,
|
|
66
|
-
admin_app_exports
|
|
67
|
-
};
|
package/dist/chunk-N67KVM2S.mjs
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-6BWS3CLP.mjs";
|
|
4
|
-
|
|
5
|
-
// src/studio/index.ts
|
|
6
|
-
var studio_exports = {};
|
|
7
|
-
__export(studio_exports, {
|
|
8
|
-
assertStudioDocumentV1: () => assertStudioDocumentV1,
|
|
9
|
-
compileStudioDocument: () => compileStudioDocument,
|
|
10
|
-
createEmptyStudioDocument: () => createEmptyStudioDocument,
|
|
11
|
-
createStudioRegistry: () => createStudioRegistry,
|
|
12
|
-
migrateStudioDocument: () => migrateStudioDocument,
|
|
13
|
-
validateStudioDocument: () => validateStudioDocument
|
|
14
|
-
});
|
|
15
|
-
var isRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
16
|
-
var makeIssue = (message, path, code = "studio.invalid") => ({
|
|
17
|
-
code,
|
|
18
|
-
message,
|
|
19
|
-
path,
|
|
20
|
-
severity: "error"
|
|
21
|
-
});
|
|
22
|
-
var createEmptyStudioDocument = (title) => ({
|
|
23
|
-
metadata: {},
|
|
24
|
-
schemaVersion: 1,
|
|
25
|
-
title,
|
|
26
|
-
nodes: [],
|
|
27
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
28
|
-
});
|
|
29
|
-
function assertStudioDocumentV1(input) {
|
|
30
|
-
if (!isRecord(input)) {
|
|
31
|
-
throw new Error("Studio document must be an object");
|
|
32
|
-
}
|
|
33
|
-
if (input.schemaVersion !== 1) {
|
|
34
|
-
throw new Error("Unsupported studio schemaVersion");
|
|
35
|
-
}
|
|
36
|
-
if (!Array.isArray(input.nodes)) {
|
|
37
|
-
throw new Error("Studio document nodes must be an array");
|
|
38
|
-
}
|
|
39
|
-
const nodes = input.nodes.map((node, index) => {
|
|
40
|
-
if (!isRecord(node)) {
|
|
41
|
-
throw new Error(`Node at index ${index} must be an object`);
|
|
42
|
-
}
|
|
43
|
-
if (typeof node.id !== "string" || node.id.length === 0) {
|
|
44
|
-
throw new Error(`Node at index ${index} has invalid id`);
|
|
45
|
-
}
|
|
46
|
-
if (typeof node.type !== "string" || node.type.length === 0) {
|
|
47
|
-
throw new Error(`Node at index ${index} has invalid type`);
|
|
48
|
-
}
|
|
49
|
-
if (!isRecord(node.data)) {
|
|
50
|
-
throw new Error(`Node at index ${index} has invalid data`);
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
id: node.id,
|
|
54
|
-
type: node.type,
|
|
55
|
-
data: node.data
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
metadata: isRecord(input.metadata) ? input.metadata : void 0,
|
|
60
|
-
schemaVersion: 1,
|
|
61
|
-
title: typeof input.title === "string" ? input.title : void 0,
|
|
62
|
-
nodes,
|
|
63
|
-
updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function createStudioRegistry(modules) {
|
|
67
|
-
const moduleByID = new Map(modules.map((mod) => [mod.id, mod]));
|
|
68
|
-
const nodeTypes = modules.flatMap((mod) => mod.nodeTypes);
|
|
69
|
-
const nodeTypeByName = new Map(nodeTypes.map((definition) => [definition.type, definition]));
|
|
70
|
-
return {
|
|
71
|
-
getModuleByID: (id) => moduleByID.get(id),
|
|
72
|
-
getNodeTypeByName: (type) => nodeTypeByName.get(type),
|
|
73
|
-
listInspectorPanels: () => modules.flatMap((mod) => mod.inspectorPanels),
|
|
74
|
-
listModules: () => [...modules],
|
|
75
|
-
listPaletteGroups: () => modules.flatMap((mod) => mod.paletteGroups),
|
|
76
|
-
listNodeTypes: () => [...nodeTypes]
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function validateStudioDocument(document, modules) {
|
|
80
|
-
const issues = [];
|
|
81
|
-
if (document.schemaVersion !== 1) {
|
|
82
|
-
issues.push(makeIssue("Unsupported schema version", "schemaVersion", "studio.schemaVersion"));
|
|
83
|
-
}
|
|
84
|
-
if (!Array.isArray(document.nodes)) {
|
|
85
|
-
issues.push(makeIssue("Nodes must be an array", "nodes", "studio.nodes"));
|
|
86
|
-
return issues;
|
|
87
|
-
}
|
|
88
|
-
const registry = createStudioRegistry(modules);
|
|
89
|
-
const nodeIDs = /* @__PURE__ */ new Set();
|
|
90
|
-
document.nodes.forEach((node, index) => {
|
|
91
|
-
if (!node.id) {
|
|
92
|
-
issues.push(makeIssue("Node id is required", `nodes.${index}.id`, "studio.node.id"));
|
|
93
|
-
}
|
|
94
|
-
if (nodeIDs.has(node.id)) {
|
|
95
|
-
issues.push(makeIssue("Node id must be unique", `nodes.${index}.id`, "studio.node.id.duplicate"));
|
|
96
|
-
}
|
|
97
|
-
nodeIDs.add(node.id);
|
|
98
|
-
if (!registry.getNodeTypeByName(node.type)) {
|
|
99
|
-
issues.push(makeIssue("Unsupported node type", `nodes.${index}.type`, "studio.node.type"));
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
for (const module of modules) {
|
|
103
|
-
for (const validate of module.validators) {
|
|
104
|
-
issues.push(...validate(document));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return issues;
|
|
108
|
-
}
|
|
109
|
-
function compileStudioDocument(document, modules) {
|
|
110
|
-
const issues = validateStudioDocument(document, modules);
|
|
111
|
-
const compilerEntries = modules.filter((mod) => typeof mod.compiler?.compileNode === "function").map((mod) => mod.compiler?.compileNode);
|
|
112
|
-
const layout = document.nodes.map((node) => {
|
|
113
|
-
for (const compileNode of compilerEntries) {
|
|
114
|
-
if (!compileNode) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
const compiled = compileNode(node);
|
|
118
|
-
if (compiled) {
|
|
119
|
-
return compiled;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
id: node.id,
|
|
124
|
-
blockType: node.type,
|
|
125
|
-
...node.data
|
|
126
|
-
};
|
|
127
|
-
});
|
|
128
|
-
return {
|
|
129
|
-
issues,
|
|
130
|
-
layout
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function migrateStudioDocument(value, migrations) {
|
|
134
|
-
const sorted = [...migrations].sort((a, b) => a.fromVersion - b.fromVersion);
|
|
135
|
-
if (isRecord(value) && value.schemaVersion === 1) {
|
|
136
|
-
return assertStudioDocumentV1(value);
|
|
137
|
-
}
|
|
138
|
-
let current = value;
|
|
139
|
-
for (const migration of sorted) {
|
|
140
|
-
if (!isRecord(current) || current.schemaVersion !== migration.fromVersion) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
current = migration.migrate(current);
|
|
144
|
-
}
|
|
145
|
-
return assertStudioDocumentV1(current);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export {
|
|
149
|
-
createEmptyStudioDocument,
|
|
150
|
-
assertStudioDocumentV1,
|
|
151
|
-
createStudioRegistry,
|
|
152
|
-
validateStudioDocument,
|
|
153
|
-
compileStudioDocument,
|
|
154
|
-
migrateStudioDocument,
|
|
155
|
-
studio_exports
|
|
156
|
-
};
|
package/dist/chunk-UJFU323N.mjs
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sectionStyleDefaults
|
|
3
|
-
} from "./chunk-ETRRXURT.mjs";
|
|
4
|
-
import {
|
|
5
|
-
__export
|
|
6
|
-
} from "./chunk-6BWS3CLP.mjs";
|
|
7
|
-
|
|
8
|
-
// src/studio-pages/index.ts
|
|
9
|
-
var studio_pages_exports = {};
|
|
10
|
-
__export(studio_pages_exports, {
|
|
11
|
-
createDefaultStudioDocument: () => createDefaultStudioDocument,
|
|
12
|
-
layoutToStudioDocument: () => layoutToStudioDocument,
|
|
13
|
-
pageInspectorPanels: () => pageInspectorPanels,
|
|
14
|
-
pageNodeTypes: () => pageNodeTypes,
|
|
15
|
-
pagePaletteGroups: () => pagePaletteGroups,
|
|
16
|
-
pageStudioModuleManifest: () => pageStudioModuleManifest,
|
|
17
|
-
studioDocumentToLayout: () => studioDocumentToLayout
|
|
18
|
-
});
|
|
19
|
-
var withSectionStyleDefaults = (value) => ({
|
|
20
|
-
...sectionStyleDefaults,
|
|
21
|
-
...value
|
|
22
|
-
});
|
|
23
|
-
var defaultNodeData = {
|
|
24
|
-
bookingEmbed: {
|
|
25
|
-
...withSectionStyleDefaults({}),
|
|
26
|
-
buttonHref: "/contact",
|
|
27
|
-
buttonLabel: "Book Consultation",
|
|
28
|
-
description: "Let visitors book a consultation.",
|
|
29
|
-
title: "Book a Time"
|
|
30
|
-
},
|
|
31
|
-
beforeAfter: withSectionStyleDefaults({
|
|
32
|
-
items: [
|
|
33
|
-
{
|
|
34
|
-
description: "Before and after result summary.",
|
|
35
|
-
label: "Project One"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
subtitle: "Show visual proof from real projects.",
|
|
39
|
-
title: "Before & After Results"
|
|
40
|
-
}),
|
|
41
|
-
cta: {
|
|
42
|
-
...withSectionStyleDefaults({}),
|
|
43
|
-
backgroundColor: "#1f684f",
|
|
44
|
-
buttonHref: "/contact",
|
|
45
|
-
buttonLabel: "Contact Us",
|
|
46
|
-
description: "Optional supporting copy.",
|
|
47
|
-
headline: "Ready to get started?",
|
|
48
|
-
style: "light"
|
|
49
|
-
},
|
|
50
|
-
faq: {
|
|
51
|
-
...withSectionStyleDefaults({}),
|
|
52
|
-
items: [{ answer: "Answer goes here.", question: "Frequently asked question?" }],
|
|
53
|
-
title: "Frequently Asked Questions"
|
|
54
|
-
},
|
|
55
|
-
featureGrid: {
|
|
56
|
-
...withSectionStyleDefaults({}),
|
|
57
|
-
items: [
|
|
58
|
-
{ description: "Explain this point.", icon: "01", title: "Feature One" },
|
|
59
|
-
{ description: "Explain this point.", icon: "02", title: "Feature Two" },
|
|
60
|
-
{ description: "Explain this point.", icon: "03", title: "Feature Three" }
|
|
61
|
-
],
|
|
62
|
-
title: "Section Title",
|
|
63
|
-
variant: "cards"
|
|
64
|
-
},
|
|
65
|
-
formEmbed: {
|
|
66
|
-
...withSectionStyleDefaults({}),
|
|
67
|
-
description: "Collect lead details from visitors.",
|
|
68
|
-
formType: "quote",
|
|
69
|
-
title: "Request a Quote"
|
|
70
|
-
},
|
|
71
|
-
hero: {
|
|
72
|
-
...withSectionStyleDefaults({}),
|
|
73
|
-
backgroundColor: "#124a37",
|
|
74
|
-
headline: "New Hero Section",
|
|
75
|
-
kicker: "Optional kicker",
|
|
76
|
-
primaryHref: "/contact",
|
|
77
|
-
primaryLabel: "Primary Action",
|
|
78
|
-
secondaryHref: "/services",
|
|
79
|
-
secondaryLabel: "Secondary Action",
|
|
80
|
-
subheadline: "Describe your offer clearly for website visitors.",
|
|
81
|
-
variant: "default"
|
|
82
|
-
},
|
|
83
|
-
media: {
|
|
84
|
-
...withSectionStyleDefaults({}),
|
|
85
|
-
caption: "Add a caption",
|
|
86
|
-
size: "default"
|
|
87
|
-
},
|
|
88
|
-
logoWall: withSectionStyleDefaults({
|
|
89
|
-
items: [
|
|
90
|
-
{ name: "Trusted Partner 1" },
|
|
91
|
-
{ name: "Trusted Partner 2" },
|
|
92
|
-
{ name: "Trusted Partner 3" }
|
|
93
|
-
],
|
|
94
|
-
subtitle: "Trusted by teams and homeowners across Central Texas.",
|
|
95
|
-
title: "Trusted by Local Organizations"
|
|
96
|
-
}),
|
|
97
|
-
richText: {
|
|
98
|
-
...withSectionStyleDefaults({}),
|
|
99
|
-
content: {
|
|
100
|
-
root: {
|
|
101
|
-
children: [
|
|
102
|
-
{
|
|
103
|
-
children: [
|
|
104
|
-
{
|
|
105
|
-
detail: 0,
|
|
106
|
-
format: 0,
|
|
107
|
-
mode: "normal",
|
|
108
|
-
style: "",
|
|
109
|
-
text: "Write your content here.",
|
|
110
|
-
type: "text",
|
|
111
|
-
version: 1
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
direction: "ltr",
|
|
115
|
-
format: "",
|
|
116
|
-
indent: 0,
|
|
117
|
-
type: "paragraph",
|
|
118
|
-
version: 1
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
direction: "ltr",
|
|
122
|
-
format: "",
|
|
123
|
-
indent: 0,
|
|
124
|
-
type: "root",
|
|
125
|
-
version: 1
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
title: "Section Heading",
|
|
129
|
-
width: "normal"
|
|
130
|
-
},
|
|
131
|
-
testimonials: {
|
|
132
|
-
...withSectionStyleDefaults({}),
|
|
133
|
-
items: [{ location: "City, ST", name: "Customer Name", quote: "Customer feedback goes here." }],
|
|
134
|
-
title: "What Customers Say"
|
|
135
|
-
},
|
|
136
|
-
stats: withSectionStyleDefaults({
|
|
137
|
-
items: [
|
|
138
|
-
{ description: "Average response time", label: "Same-Day Quotes", value: "24h" },
|
|
139
|
-
{ description: "Projects completed", label: "Completed Jobs", value: "1,200+" },
|
|
140
|
-
{ description: "Client satisfaction score", label: "Satisfaction", value: "4.9/5" }
|
|
141
|
-
],
|
|
142
|
-
subtitle: "Highlight measurable outcomes to build trust quickly.",
|
|
143
|
-
title: "Performance Highlights"
|
|
144
|
-
})
|
|
145
|
-
};
|
|
146
|
-
var nodeTypeLabels = {
|
|
147
|
-
bookingEmbed: "Booking Embed",
|
|
148
|
-
beforeAfter: "Before / After",
|
|
149
|
-
cta: "Call To Action",
|
|
150
|
-
faq: "FAQ",
|
|
151
|
-
featureGrid: "Feature Grid",
|
|
152
|
-
formEmbed: "Form Embed",
|
|
153
|
-
hero: "Hero",
|
|
154
|
-
logoWall: "Logo Wall",
|
|
155
|
-
media: "Media",
|
|
156
|
-
richText: "Rich Text",
|
|
157
|
-
stats: "Stats",
|
|
158
|
-
testimonials: "Testimonials"
|
|
159
|
-
};
|
|
160
|
-
var pageNodeTypes = Object.keys(defaultNodeData).map((type) => ({
|
|
161
|
-
type,
|
|
162
|
-
displayName: nodeTypeLabels[type] || type,
|
|
163
|
-
description: `Page node for ${nodeTypeLabels[type] || type}`,
|
|
164
|
-
getDefaultData: () => structuredClone(defaultNodeData[type])
|
|
165
|
-
}));
|
|
166
|
-
var validatePageDocument = (document) => {
|
|
167
|
-
const issues = [];
|
|
168
|
-
if (!document.title || document.title.trim().length === 0) {
|
|
169
|
-
issues.push({
|
|
170
|
-
code: "pages.title.required",
|
|
171
|
-
message: "Page title is required before publishing.",
|
|
172
|
-
path: "title",
|
|
173
|
-
severity: "error"
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
if (document.nodes.length === 0) {
|
|
177
|
-
issues.push({
|
|
178
|
-
code: "pages.nodes.required",
|
|
179
|
-
message: "At least one section is required.",
|
|
180
|
-
path: "nodes",
|
|
181
|
-
severity: "error"
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
document.nodes.forEach((node, index) => {
|
|
185
|
-
if (node.type === "hero" && typeof node.data.headline !== "string") {
|
|
186
|
-
issues.push({
|
|
187
|
-
code: "pages.hero.headline",
|
|
188
|
-
message: "Hero section requires a headline.",
|
|
189
|
-
path: `nodes.${index}.data.headline`,
|
|
190
|
-
severity: "error"
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
return issues;
|
|
195
|
-
};
|
|
196
|
-
var pagePaletteGroups = [
|
|
197
|
-
{
|
|
198
|
-
id: "page-core",
|
|
199
|
-
label: "Core Sections",
|
|
200
|
-
items: [
|
|
201
|
-
{ nodeType: "hero", title: "Hero", description: "Top-of-page headline and CTA" },
|
|
202
|
-
{ nodeType: "featureGrid", title: "Feature Grid", description: "Service or value cards" },
|
|
203
|
-
{ nodeType: "stats", title: "Stats", description: "Key performance highlights" },
|
|
204
|
-
{ nodeType: "logoWall", title: "Logo Wall", description: "Trust logos and badges" },
|
|
205
|
-
{ nodeType: "beforeAfter", title: "Before / After", description: "Visual before-and-after gallery" },
|
|
206
|
-
{ nodeType: "richText", title: "Rich Text", description: "Long-form content area" },
|
|
207
|
-
{ nodeType: "media", title: "Media", description: "Image/video section" },
|
|
208
|
-
{ nodeType: "testimonials", title: "Testimonials", description: "Social proof quotes" },
|
|
209
|
-
{ nodeType: "faq", title: "FAQ", description: "Question-and-answer section" },
|
|
210
|
-
{ nodeType: "cta", title: "Call To Action", description: "Conversion strip with button" },
|
|
211
|
-
{ nodeType: "formEmbed", title: "Form Embed", description: "Lead capture form" },
|
|
212
|
-
{ nodeType: "bookingEmbed", title: "Booking Embed", description: "Scheduling panel" }
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
];
|
|
216
|
-
var pageInspectorPanels = Object.keys(defaultNodeData).map((nodeType) => ({
|
|
217
|
-
id: `${nodeType}-panel`,
|
|
218
|
-
label: `${nodeTypeLabels[nodeType] || nodeType} Settings`,
|
|
219
|
-
nodeType,
|
|
220
|
-
fields: [
|
|
221
|
-
{
|
|
222
|
-
key: "title",
|
|
223
|
-
label: "Title",
|
|
224
|
-
type: "text"
|
|
225
|
-
}
|
|
226
|
-
]
|
|
227
|
-
}));
|
|
228
|
-
var pageStudioModuleManifest = {
|
|
229
|
-
id: "studio-pages",
|
|
230
|
-
version: "0.1.0-beta.0",
|
|
231
|
-
displayName: "Pages Studio Module",
|
|
232
|
-
nodeTypes: pageNodeTypes,
|
|
233
|
-
paletteGroups: pagePaletteGroups,
|
|
234
|
-
inspectorPanels: pageInspectorPanels,
|
|
235
|
-
validators: [validatePageDocument],
|
|
236
|
-
migrations: [],
|
|
237
|
-
compiler: {
|
|
238
|
-
compileNode: (node) => ({
|
|
239
|
-
id: node.id,
|
|
240
|
-
blockType: node.type,
|
|
241
|
-
...node.data
|
|
242
|
-
})
|
|
243
|
-
},
|
|
244
|
-
permissions: [
|
|
245
|
-
{ action: "read", role: "admin" },
|
|
246
|
-
{ action: "read", role: "editor" },
|
|
247
|
-
{ action: "read", role: "client" },
|
|
248
|
-
{ action: "update", role: "admin" },
|
|
249
|
-
{ action: "update", role: "editor" },
|
|
250
|
-
{ action: "update", role: "client" },
|
|
251
|
-
{ action: "publish", role: "admin" },
|
|
252
|
-
{ action: "publish", role: "editor" }
|
|
253
|
-
]
|
|
254
|
-
};
|
|
255
|
-
var ensureNodeID = (inputID, index) => {
|
|
256
|
-
if (typeof inputID === "string" && inputID.length > 0) {
|
|
257
|
-
return inputID;
|
|
258
|
-
}
|
|
259
|
-
return `node-${index + 1}`;
|
|
260
|
-
};
|
|
261
|
-
var layoutToStudioDocument = (layout, title, metadata) => {
|
|
262
|
-
const nodes = layout.filter((block) => typeof block.blockType === "string").map((block, index) => {
|
|
263
|
-
const blockType = String(block.blockType);
|
|
264
|
-
const { id, blockType: _, ...data } = block;
|
|
265
|
-
return {
|
|
266
|
-
id: ensureNodeID(id, index),
|
|
267
|
-
type: blockType,
|
|
268
|
-
data
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
|
-
return {
|
|
272
|
-
metadata,
|
|
273
|
-
schemaVersion: 1,
|
|
274
|
-
title,
|
|
275
|
-
nodes,
|
|
276
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
277
|
-
};
|
|
278
|
-
};
|
|
279
|
-
var studioDocumentToLayout = (document) => document.nodes.map((node) => ({
|
|
280
|
-
id: node.id,
|
|
281
|
-
blockType: node.type,
|
|
282
|
-
...node.data
|
|
283
|
-
}));
|
|
284
|
-
var createDefaultStudioDocument = (title) => ({
|
|
285
|
-
metadata: {},
|
|
286
|
-
schemaVersion: 1,
|
|
287
|
-
title,
|
|
288
|
-
nodes: [],
|
|
289
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
export {
|
|
293
|
-
pageNodeTypes,
|
|
294
|
-
pagePaletteGroups,
|
|
295
|
-
pageInspectorPanels,
|
|
296
|
-
pageStudioModuleManifest,
|
|
297
|
-
layoutToStudioDocument,
|
|
298
|
-
studioDocumentToLayout,
|
|
299
|
-
createDefaultStudioDocument,
|
|
300
|
-
studio_pages_exports
|
|
301
|
-
};
|