@sudajs/theme-engine 0.2.1 → 1.1.0
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/dist/agent.d.ts +288 -20
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +73 -9
- package/dist/agent.js.map +1 -1
- package/dist/assets.d.ts +21 -0
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +16 -0
- package/dist/assets.js.map +1 -1
- package/dist/check.d.ts +54 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +120 -0
- package/dist/check.js.map +1 -0
- package/dist/components/base-blocks.d.ts.map +1 -1
- package/dist/components/base-blocks.js +90 -6
- package/dist/components/base-blocks.js.map +1 -1
- package/dist/components/containers.d.ts.map +1 -1
- package/dist/components/containers.js +51 -2
- package/dist/components/containers.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/registry/filesystem.d.ts +20 -5
- package/dist/registry/filesystem.d.ts.map +1 -1
- package/dist/registry/filesystem.js +36 -25
- package/dist/registry/filesystem.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +38 -18
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/ai/slots.d.ts +0 -33
- package/dist/ai/slots.d.ts.map +0 -1
- package/dist/ai/slots.js +0 -139
- package/dist/ai/slots.js.map +0 -1
|
@@ -12,6 +12,11 @@ const ratioColumns = {
|
|
|
12
12
|
};
|
|
13
13
|
const TwoColumn = {
|
|
14
14
|
label: "Two columns",
|
|
15
|
+
ai: {
|
|
16
|
+
instructions: "Generic two-column layout container that holds blocks in a left/right pair. " +
|
|
17
|
+
"Use only when no purpose-built section already pairs media with copy. " +
|
|
18
|
+
"Prefer narrative sections over a bare TwoColumn for marketing pages.",
|
|
19
|
+
},
|
|
15
20
|
fields: {
|
|
16
21
|
left: slotField("Left column"),
|
|
17
22
|
right: slotField("Right column"),
|
|
@@ -24,6 +29,9 @@ const TwoColumn = {
|
|
|
24
29
|
{ label: "1 : 2", value: "1-2" },
|
|
25
30
|
{ label: "2 : 1", value: "2-1" },
|
|
26
31
|
],
|
|
32
|
+
ai: {
|
|
33
|
+
instructions: "Use '1-1' for balanced media-and-copy pairs, '2-1' when the left column carries primary content, and '1-2' to emphasise the right column.",
|
|
34
|
+
},
|
|
27
35
|
},
|
|
28
36
|
},
|
|
29
37
|
defaultProps: { left: [], right: [], gap: "32px", ratio: "1-1" },
|
|
@@ -40,6 +48,11 @@ const TwoColumn = {
|
|
|
40
48
|
};
|
|
41
49
|
const CardGrid = {
|
|
42
50
|
label: "Card grid",
|
|
51
|
+
ai: {
|
|
52
|
+
instructions: "Equal-width grid container for repeating block groups (feature blurbs, simple cards). " +
|
|
53
|
+
"Use when a theme has no domain-specific feature/card section. " +
|
|
54
|
+
"Do not use for navigation, testimonials, or pricing tiers when a richer section exists.",
|
|
55
|
+
},
|
|
43
56
|
fields: {
|
|
44
57
|
items: slotField("Cards"),
|
|
45
58
|
columns: {
|
|
@@ -47,6 +60,9 @@ const CardGrid = {
|
|
|
47
60
|
label: "Columns",
|
|
48
61
|
min: 1,
|
|
49
62
|
max: 6,
|
|
63
|
+
ai: {
|
|
64
|
+
instructions: "Choose 2–4 columns for typical desktop layouts; pick a value that divides the number of items evenly.",
|
|
65
|
+
},
|
|
50
66
|
},
|
|
51
67
|
gap: { type: "text", label: "Gap (e.g. 24px)" },
|
|
52
68
|
},
|
|
@@ -64,16 +80,31 @@ const CardGrid = {
|
|
|
64
80
|
};
|
|
65
81
|
const Accordion = {
|
|
66
82
|
label: "Accordion",
|
|
83
|
+
ai: {
|
|
84
|
+
instructions: "Collapsible Q&A or disclosure list. " +
|
|
85
|
+
"Use for FAQs or progressive-disclosure content groups. " +
|
|
86
|
+
"Place after the main explanation section and before the final CTA. Do not use for primary navigation or short feature lists.",
|
|
87
|
+
},
|
|
67
88
|
fields: {
|
|
68
89
|
items: {
|
|
69
90
|
type: "array",
|
|
70
91
|
label: "Items",
|
|
71
92
|
getItemSummary: (item) => item.title || "Item",
|
|
72
93
|
arrayFields: {
|
|
73
|
-
title: {
|
|
94
|
+
title: {
|
|
95
|
+
type: "text",
|
|
96
|
+
label: "Title",
|
|
97
|
+
ai: {
|
|
98
|
+
instructions: "Question or topic phrased the way a visitor would ask it. Keep it under 80 characters.",
|
|
99
|
+
required: true,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
74
102
|
content: slotField("Content"),
|
|
75
103
|
},
|
|
76
104
|
defaultItemProps: { title: "Question", content: [] },
|
|
105
|
+
ai: {
|
|
106
|
+
instructions: "Generate 4–8 entries covering the most common visitor questions for the page topic. Avoid duplicating the page hero copy.",
|
|
107
|
+
},
|
|
77
108
|
},
|
|
78
109
|
},
|
|
79
110
|
defaultProps: {
|
|
@@ -89,16 +120,29 @@ const Accordion = {
|
|
|
89
120
|
};
|
|
90
121
|
const Tabs = {
|
|
91
122
|
label: "Tabs",
|
|
123
|
+
ai: {
|
|
124
|
+
instructions: "Tabbed container for parallel content groups that share a single screen region. " +
|
|
125
|
+
"Use when 2–5 short alternative views need to be compared in place. " +
|
|
126
|
+
"Do not use for sequential steps (use a step list) or for FAQ-style disclosures (use Accordion).",
|
|
127
|
+
},
|
|
92
128
|
fields: {
|
|
93
129
|
items: {
|
|
94
130
|
type: "array",
|
|
95
131
|
label: "Tabs",
|
|
96
132
|
getItemSummary: (item) => item.label || "Tab",
|
|
97
133
|
arrayFields: {
|
|
98
|
-
label: {
|
|
134
|
+
label: {
|
|
135
|
+
type: "text",
|
|
136
|
+
label: "Label",
|
|
137
|
+
ai: {
|
|
138
|
+
instructions: "Short tab name, 1–3 words, distinct from sibling tabs.",
|
|
139
|
+
required: true,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
99
142
|
content: slotField("Content"),
|
|
100
143
|
},
|
|
101
144
|
defaultItemProps: { label: "Tab", content: [] },
|
|
145
|
+
ai: { instructions: "Generate 2–5 tabs that compare related options or perspectives." },
|
|
102
146
|
},
|
|
103
147
|
},
|
|
104
148
|
defaultProps: {
|
|
@@ -114,6 +158,11 @@ const Tabs = {
|
|
|
114
158
|
};
|
|
115
159
|
const Carousel = {
|
|
116
160
|
label: "Carousel",
|
|
161
|
+
ai: {
|
|
162
|
+
instructions: "Horizontal scroll/snap container for a homogeneous sequence of items. " +
|
|
163
|
+
"Use sparingly — only when items genuinely need horizontal browsing. " +
|
|
164
|
+
"Prefer CardGrid for static feature lists.",
|
|
165
|
+
},
|
|
117
166
|
fields: {
|
|
118
167
|
items: slotField("Slides"),
|
|
119
168
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../src/components/containers.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"containers.js","sourceRoot":"","sources":["../../src/components/containers.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,KAAK,GAAG,CAAC,GAAG,gBAAgB,CAAC,CAAC;AAEpC,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,EAAE,IAAI,EAAE,MAAe,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACxD,CAAC;AASD,MAAM,YAAY,GAA6C;IAC7D,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,MAAM,SAAS,GAAwB;IACrC,KAAK,EAAE,aAAa;IACpB,EAAE,EAAE;QACF,YAAY,EACV,8EA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MAAM,CAAG,CAAC,GAAI,CAAC;IACzD,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,SAAS;QACT,QAAQ;QACR,SAAS;QACT,IAAI;QACJ,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
export * from "./manifest.js";
|
|
3
3
|
export * from "./registry.js";
|
|
4
|
-
export * from "./ai/slots.js";
|
|
5
4
|
export * from "./assets.js";
|
|
6
5
|
export * from "./agent.js";
|
|
6
|
+
export * from "./check.js";
|
|
7
7
|
export * from "./cms/index.js";
|
|
8
8
|
export * from "./fields/index.js";
|
|
9
9
|
export * from "./components/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
export * from "./types.js";
|
|
3
3
|
export * from "./manifest.js";
|
|
4
4
|
export * from "./registry.js";
|
|
5
|
-
export * from "./ai/slots.js";
|
|
6
5
|
export * from "./assets.js";
|
|
7
6
|
export * from "./agent.js";
|
|
7
|
+
export * from "./check.js";
|
|
8
8
|
export * from "./cms/index.js";
|
|
9
9
|
// Editor building blocks (client-safe)
|
|
10
10
|
export * from "./fields/index.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAE5B,uCAAuC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAE/B,yCAAyC;AACzC,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import type { ThemeRegistry } from "../registry.js";
|
|
2
|
-
import type { ResolvedTheme, ThemeManifest } from "../types.js";
|
|
2
|
+
import type { ResolvedTheme, ThemeManifest, ThemeModule } from "../types.js";
|
|
3
3
|
export interface FileSystemThemeRegistryOptions {
|
|
4
4
|
/** Directories containing one subdirectory per theme artifact/source checkout. */
|
|
5
|
-
roots
|
|
5
|
+
roots?: string[];
|
|
6
6
|
/** Public API prefix that serves theme files, e.g. `/api/themes`. */
|
|
7
7
|
publicBasePath?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Pre-resolved theme artifacts. When provided, the registry skips filesystem
|
|
10
|
+
* scanning entirely and serves only these artifacts. Use this when the caller
|
|
11
|
+
* already loaded the theme module (e.g. the CLI dev preview) so sibling
|
|
12
|
+
* theme directories under the same root are not implicitly loaded.
|
|
13
|
+
*/
|
|
14
|
+
artifacts?: FileSystemThemeArtifact[];
|
|
15
|
+
}
|
|
16
|
+
export interface FileSystemThemeArtifact {
|
|
17
|
+
/** Absolute path to the theme artifact root (the directory containing `dist/`). */
|
|
18
|
+
rootPath: string;
|
|
19
|
+
/** Absolute path to the resolved server entry (typically `<rootPath>/dist/index.js`). */
|
|
20
|
+
serverEntryPath: string;
|
|
21
|
+
/** Pre-loaded theme module exported by `serverEntryPath`. */
|
|
22
|
+
module: ThemeModule;
|
|
8
23
|
}
|
|
9
24
|
/**
|
|
10
25
|
* Runtime registry backed by theme artifact files. Apps use this instead of
|
|
@@ -13,15 +28,15 @@ export interface FileSystemThemeRegistryOptions {
|
|
|
13
28
|
*/
|
|
14
29
|
export declare class FileSystemThemeRegistry implements ThemeRegistry {
|
|
15
30
|
private readonly options;
|
|
16
|
-
private
|
|
31
|
+
private artifacts;
|
|
17
32
|
constructor(options: FileSystemThemeRegistryOptions);
|
|
18
33
|
list(): Promise<ThemeManifest[]>;
|
|
19
34
|
has(key: string): Promise<boolean>;
|
|
20
35
|
resolve(key: string, version?: string): Promise<ResolvedTheme | null>;
|
|
21
36
|
resolveAssetPath(key: string, version: string, relativePath: string): Promise<string | null>;
|
|
22
37
|
resolveClientEntryPath(key: string, version: string): Promise<string | null>;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
38
|
+
private loadArtifacts;
|
|
39
|
+
private discoverArtifacts;
|
|
25
40
|
private createRuntime;
|
|
26
41
|
}
|
|
27
42
|
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/registry/filesystem.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/registry/filesystem.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAC;AAExF,MAAM,WAAW,8BAA8B;IAC7C,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,eAAe,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB;AAyED;;;;GAIG;AACH,qBAAa,uBAAwB,YAAW,aAAa;IAG/C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,SAAS,CAAyC;gBAE7B,OAAO,EAAE,8BAA8B;IAE9D,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAKhC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAkBrE,gBAAgB,CACpB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAgBnB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;YAWpE,aAAa;YAKb,iBAAiB;YAmCjB,aAAa;CAuB5B"}
|
|
@@ -60,32 +60,32 @@ async function importThemeModule(serverEntryPath) {
|
|
|
60
60
|
*/
|
|
61
61
|
export class FileSystemThemeRegistry {
|
|
62
62
|
options;
|
|
63
|
-
|
|
63
|
+
artifacts = null;
|
|
64
64
|
constructor(options) {
|
|
65
65
|
this.options = options;
|
|
66
66
|
}
|
|
67
67
|
async list() {
|
|
68
|
-
const
|
|
69
|
-
return
|
|
68
|
+
const artifacts = await this.loadArtifacts();
|
|
69
|
+
return artifacts.map((artifact) => artifact.module.manifest);
|
|
70
70
|
}
|
|
71
71
|
async has(key) {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
72
|
+
const artifacts = await this.loadArtifacts();
|
|
73
|
+
return artifacts.some((artifact) => artifact.module.manifest.key === key);
|
|
74
74
|
}
|
|
75
75
|
async resolve(key, version) {
|
|
76
|
-
const
|
|
77
|
-
const
|
|
76
|
+
const artifacts = await this.loadArtifacts();
|
|
77
|
+
const artifact = artifacts.find((candidate) => {
|
|
78
78
|
const manifest = candidate.module.manifest;
|
|
79
79
|
return manifest.key === key && (version === undefined || manifest.version === version);
|
|
80
80
|
});
|
|
81
|
-
if (!
|
|
81
|
+
if (!artifact) {
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
|
-
const manifest =
|
|
84
|
+
const manifest = artifact.module.manifest;
|
|
85
85
|
return {
|
|
86
86
|
manifest,
|
|
87
|
-
module:
|
|
88
|
-
runtime: await this.createRuntime(
|
|
87
|
+
module: artifact.module,
|
|
88
|
+
runtime: await this.createRuntime(artifact),
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
async resolveAssetPath(key, version, relativePath) {
|
|
@@ -112,13 +112,24 @@ export class FileSystemThemeRegistry {
|
|
|
112
112
|
const clientEntryPath = resolveClientEntryPathFromManifest(rootPath, manifest);
|
|
113
113
|
return (await pathExists(clientEntryPath)) ? clientEntryPath : null;
|
|
114
114
|
}
|
|
115
|
-
async
|
|
116
|
-
this.
|
|
117
|
-
return this.
|
|
115
|
+
async loadArtifacts() {
|
|
116
|
+
this.artifacts ??= this.discoverArtifacts();
|
|
117
|
+
return this.artifacts;
|
|
118
118
|
}
|
|
119
|
-
async
|
|
120
|
-
const
|
|
121
|
-
|
|
119
|
+
async discoverArtifacts() {
|
|
120
|
+
const preloadedArtifacts = this.options.artifacts;
|
|
121
|
+
if (preloadedArtifacts && preloadedArtifacts.length > 0) {
|
|
122
|
+
// Caller already resolved the artifacts (e.g. CLI dev preview). Skip
|
|
123
|
+
// filesystem scanning so we don't implicitly load sibling theme
|
|
124
|
+
// directories that happen to share the same root.
|
|
125
|
+
return preloadedArtifacts.map((artifact) => ({
|
|
126
|
+
rootPath: artifact.rootPath,
|
|
127
|
+
serverEntryPath: artifact.serverEntryPath,
|
|
128
|
+
module: artifact.module,
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
const artifacts = [];
|
|
132
|
+
for (const root of this.options.roots ?? []) {
|
|
122
133
|
if (!(await pathExists(root))) {
|
|
123
134
|
continue;
|
|
124
135
|
}
|
|
@@ -133,22 +144,22 @@ export class FileSystemThemeRegistry {
|
|
|
133
144
|
continue;
|
|
134
145
|
}
|
|
135
146
|
const module = await importThemeModule(serverEntryPath);
|
|
136
|
-
|
|
147
|
+
artifacts.push({ rootPath, serverEntryPath, module });
|
|
137
148
|
}
|
|
138
149
|
}
|
|
139
|
-
return
|
|
150
|
+
return artifacts;
|
|
140
151
|
}
|
|
141
|
-
async createRuntime(
|
|
142
|
-
const { key, version } =
|
|
152
|
+
async createRuntime(artifact) {
|
|
153
|
+
const { key, version } = artifact.module.manifest;
|
|
143
154
|
const runtime = {
|
|
144
|
-
rootPath:
|
|
145
|
-
serverEntryPath:
|
|
155
|
+
rootPath: artifact.rootPath,
|
|
156
|
+
serverEntryPath: artifact.serverEntryPath,
|
|
146
157
|
};
|
|
147
158
|
const basePath = this.options.publicBasePath;
|
|
148
159
|
if (basePath) {
|
|
149
160
|
const prefix = `/${toPublicPath(basePath, key, version)}`;
|
|
150
|
-
const stylesheetPath = path.join(
|
|
151
|
-
const clientEntryPath = resolveClientEntryPathFromManifest(
|
|
161
|
+
const stylesheetPath = path.join(artifact.rootPath, "styles.css");
|
|
162
|
+
const clientEntryPath = resolveClientEntryPathFromManifest(artifact.rootPath, artifact.module.manifest);
|
|
152
163
|
if (await pathExists(stylesheetPath)) {
|
|
153
164
|
runtime.stylesheetUrl = cacheBust(`${prefix}/assets/styles.css`, version);
|
|
154
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/registry/filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../src/registry/filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAkCzC,6EAA6E;AAC7E,iFAAiF;AACjF,oIAAoI;AACpI,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAElC,CAAC;AAExC,SAAS,8BAA8B,CAAC,KAAc;IACpD,O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,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YAClE,MAAM,eAAe,GAAG,kCAAkC,CACxD,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,MAAM,CAAC,QAAQ,CACzB,CAAC;YACF,IAAI,MAAM,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;gBACrC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,GAAG,MAAM,oBAAoB,EAAE,OAAO,CAAC,CAAC;YAC5E,CAAC;YACD,IAAI,MAAM,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;gBACtC,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,GAAG,MAAM,iBAAiB,EAAE,OAAO,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { createEngineComponents } from "./components/index.js";
|
|
|
2
2
|
export { colorSchemeField, createColorSchemeDefault, createThemeCssVariables, resolveColorSchemeTokens, SUDA_COLOR_TOKEN_KEYS, type ColorSchemeFieldOptions, type CreateThemeCssVariablesOptions, type SudaColorSchemePreset, type SudaColorSchemeValue, type SudaThemeColorTokens, } from "./fields/index.js";
|
|
3
3
|
export { resolveAsset, type ThemeRenderMetadata } from "./components/metadata.js";
|
|
4
4
|
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot.js";
|
|
5
|
-
export { createThemeAssetPath, resolveAssetPath, type ResolveAssetPathOptions, type ThemeAssetSummary, type ThemeUnsplashAssetSummary, } from "./assets.js";
|
|
5
|
+
export { createThemeAssetPath, createThemeAssetResolver, resolveAssetPath, type ResolveAssetPathOptions, type ThemeAssetResolver, type ThemeAssetSummary, type ThemeUnsplashAssetSummary, } from "./assets.js";
|
|
6
6
|
export type { LayoutData, PageData, SudaComponentConfig, SudaConfig, SudaField, SudaFields, SudaRootConfig, } from "./types.js";
|
|
7
7
|
export { applyCmsBindings, getCmsContext, type CmsBinding, type CmsContext, type CmsPagination, type CmsPostDetail, type CmsPostListPayload, type CmsPostSummary, type CmsTagDetail, type CmsTagSummary, type CmsViewBinding, type ThemeContentCapabilities, } from "./cms/index.js";
|
|
8
8
|
//# sourceMappingURL=runtime.d.ts.map
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,GAC/B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,UAAU,EACV,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC"}
|
package/dist/runtime.js
CHANGED
|
@@ -5,6 +5,6 @@ export { createEngineComponents } from "./components/index.js";
|
|
|
5
5
|
export { colorSchemeField, createColorSchemeDefault, createThemeCssVariables, resolveColorSchemeTokens, SUDA_COLOR_TOKEN_KEYS, } from "./fields/index.js";
|
|
6
6
|
export { resolveAsset } from "./components/metadata.js";
|
|
7
7
|
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot.js";
|
|
8
|
-
export { createThemeAssetPath, resolveAssetPath, } from "./assets.js";
|
|
8
|
+
export { createThemeAssetPath, createThemeAssetResolver, resolveAssetPath, } from "./assets.js";
|
|
9
9
|
export { applyCmsBindings, getCmsContext, } from "./cms/index.js";
|
|
10
10
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,mBAAmB;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,GAMtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,mBAAmB;AACnB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,GAMtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GAKjB,MAAM,UAAU,CAAC;AAUlB,OAAO,EACL,gBAAgB,EAChB,aAAa,GAWd,MAAM,aAAa,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ export { renderThemePage, ThemeRender, type ThemeRenderProps } from "./render/re
|
|
|
2
2
|
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot.js";
|
|
3
3
|
export { extractLayoutChrome, type LayoutChrome } from "./render/chrome.js";
|
|
4
4
|
export { resolveAsset, type ThemeRenderMetadata } from "./components/metadata.js";
|
|
5
|
-
export { createThemeAssetPath, resolveAssetPath, type ResolveAssetPathOptions, type ThemeAssetSummary, type ThemeUnsplashAssetSummary, } from "./assets.js";
|
|
5
|
+
export { createThemeAssetPath, createThemeAssetResolver, resolveAssetPath, type ResolveAssetPathOptions, type ThemeAssetResolver, type ThemeAssetSummary, type ThemeUnsplashAssetSummary, } from "./assets.js";
|
|
6
6
|
export { composeUnifiedThemeEditorData, splitUnifiedThemeEditorData, } from "./editor/unified-editor.js";
|
|
7
7
|
export * from "./cms/index.js";
|
|
8
8
|
export * from "./types.js";
|
|
9
9
|
export { themeManifestSchema, parseThemeManifest, safeParseThemeManifest } from "./manifest.js";
|
|
10
10
|
export * from "./registry.js";
|
|
11
11
|
export * from "./registry/filesystem.js";
|
|
12
|
-
export * from "./ai/slots.js";
|
|
13
12
|
export * from "./agent.js";
|
|
13
|
+
export * from "./check.js";
|
|
14
14
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,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7 +4,7 @@ export { renderThemePage, ThemeRender } from "./render/render.js";
|
|
|
4
4
|
export { getPageSlot, THEME_PAGE_SLOT } from "./render/slot.js";
|
|
5
5
|
export { extractLayoutChrome } from "./render/chrome.js";
|
|
6
6
|
export { resolveAsset } from "./components/metadata.js";
|
|
7
|
-
export { createThemeAssetPath, resolveAssetPath, } from "./assets.js";
|
|
7
|
+
export { createThemeAssetPath, createThemeAssetResolver, resolveAssetPath, } from "./assets.js";
|
|
8
8
|
export { composeUnifiedThemeEditorData, splitUnifiedThemeEditorData, } from "./editor/unified-editor.js";
|
|
9
9
|
export * from "./cms/index.js";
|
|
10
10
|
// Re-export contracts for convenience in server code.
|
|
@@ -12,6 +12,6 @@ export * from "./types.js";
|
|
|
12
12
|
export { themeManifestSchema, parseThemeManifest, safeParseThemeManifest } from "./manifest.js";
|
|
13
13
|
export * from "./registry.js";
|
|
14
14
|
export * from "./registry/filesystem.js";
|
|
15
|
-
export * from "./ai/slots.js";
|
|
16
15
|
export * from "./agent.js";
|
|
16
|
+
export * from "./check.js";
|
|
17
17
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0CAA0C;AAC1C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0CAA0C;AAC1C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAyB,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAqB,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAA4B,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,GAKjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,cAAc,aAAa,CAAC;AAE5B,sDAAsD;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC7F,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
import type { ComponentConfig as PuckComponentConfig, Config, Data, DefaultComponentProps, DefaultComponents, Fields as PuckFields, RootConfig as PuckRootConfig } from "@puckeditor/core";
|
|
2
|
+
import type { ComponentAiParams } from "@puckeditor/plugin-ai";
|
|
2
3
|
import type { ReactElement } from "react";
|
|
3
4
|
import type { ThemeContentCapabilities } from "./cms/types.js";
|
|
4
5
|
import type { ThemeRenderMetadata } from "./components/metadata.js";
|
|
5
6
|
import type { SudaField, SudaFieldExtension } from "./fields/suda-fields.js";
|
|
7
|
+
/**
|
|
8
|
+
* Component-level AI configuration. We reuse Puck's `ComponentAiParams` shape
|
|
9
|
+
* verbatim so any field Puck adds in the future flows through unchanged — the
|
|
10
|
+
* only Suda-specific tightening is that `instructions` is **required**, not
|
|
11
|
+
* optional. Without it the page-generation agent has no way to tell what the
|
|
12
|
+
* component is for, so {@link SudaComponentConfig} mandates it.
|
|
13
|
+
*
|
|
14
|
+
* Authors should describe (at a minimum):
|
|
15
|
+
*
|
|
16
|
+
* - **Purpose** — the business or content role of the component.
|
|
17
|
+
* - **Use when / Avoid when** — page types and intents that select this
|
|
18
|
+
* component versus a similar one.
|
|
19
|
+
* - **Placement** — where in the page the component normally belongs.
|
|
20
|
+
* - **Frequency** — once per page, multiple times, or with adjacency limits.
|
|
21
|
+
* - **Composition** — required neighbouring or child content where relevant.
|
|
22
|
+
*
|
|
23
|
+
* Avoid restating the component label, describing visual styling that does
|
|
24
|
+
* not change semantics, or duplicating site-wide rules (brand voice, factual
|
|
25
|
+
* constraints) — those belong in the global AI context.
|
|
26
|
+
*/
|
|
27
|
+
export type SudaComponentAi = Omit<ComponentAiParams, "instructions"> & {
|
|
28
|
+
/** Non-empty instructions used by the page-generation agent. Required. */
|
|
29
|
+
instructions: string;
|
|
30
|
+
};
|
|
6
31
|
/**
|
|
7
32
|
* Theme-facing alias for Puck's component config. Generic on the component's
|
|
8
33
|
* prop shape so `fields` and `defaultProps` are strictly typed against the
|
|
@@ -10,12 +35,22 @@ import type { SudaField, SudaFieldExtension } from "./fields/suda-fields.js";
|
|
|
10
35
|
*
|
|
11
36
|
* We pass the props through Puck's `ComponentConfigParams` shape (`{ props }`)
|
|
12
37
|
* so generic forwarding satisfies its `LeftOrExactRight` constraint.
|
|
38
|
+
*
|
|
39
|
+
* Suda contracts an `ai` field on every component (Puck's plugin-ai keeps it
|
|
40
|
+
* optional; we tighten it here so themes always describe their components for
|
|
41
|
+
* AI). Use {@link SudaComponentAi} to author the description.
|
|
13
42
|
*/
|
|
14
|
-
export type SudaComponentConfig<Props extends DefaultComponentProps = DefaultComponentProps> = PuckComponentConfig<{
|
|
43
|
+
export type SudaComponentConfig<Props extends DefaultComponentProps = DefaultComponentProps> = Omit<PuckComponentConfig<{
|
|
15
44
|
props: Props;
|
|
16
45
|
fields: Record<string, SudaFieldExtension>;
|
|
17
|
-
}
|
|
18
|
-
|
|
46
|
+
}>, "ai"> & {
|
|
47
|
+
ai: SudaComponentAi;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Theme-facing alias for Puck's root config. The Suda layout root usually has
|
|
51
|
+
* no AI-generated content, so `ai` remains optional here (set
|
|
52
|
+
* `ai: { exclude: true }` to make the intent explicit when needed).
|
|
53
|
+
*/
|
|
19
54
|
export type SudaRootConfig<Props extends DefaultComponentProps = DefaultComponentProps> = PuckRootConfig<{
|
|
20
55
|
props: Props;
|
|
21
56
|
fields: Record<string, SudaFieldExtension>;
|
|
@@ -111,19 +146,6 @@ export interface ThemeStarterPage {
|
|
|
111
146
|
isHome?: boolean;
|
|
112
147
|
data: PageData;
|
|
113
148
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Declares a slot inside a theme's prop tree that the AI assistant is allowed
|
|
116
|
-
* to read/write. Used to scope AI edits to safe, content-only fields.
|
|
117
|
-
*/
|
|
118
|
-
export interface AiSlotDescriptor {
|
|
119
|
-
/** Dot/bracket path into a component's props, e.g. "blocks[0].heading". */
|
|
120
|
-
path: string;
|
|
121
|
-
/** Human label shown to the assistant. */
|
|
122
|
-
label: string;
|
|
123
|
-
kind: "text" | "richtext" | "image" | "url" | "list";
|
|
124
|
-
/** Optional guidance the assistant should respect. */
|
|
125
|
-
hint?: string;
|
|
126
|
-
}
|
|
127
149
|
export interface ThemeRenderContext {
|
|
128
150
|
theme: Pick<ThemeModule, "pageConfig" | "layoutConfig">;
|
|
129
151
|
pageData: PageData;
|
|
@@ -161,8 +183,6 @@ export interface ThemeModule {
|
|
|
161
183
|
starterPages: ThemeStarterPage[];
|
|
162
184
|
/** Optional advanced renderer. Defaults to Puck Render. */
|
|
163
185
|
rendering?: ThemeRenderingOptions;
|
|
164
|
-
/** AI-editable slots, by component type. Optional. */
|
|
165
|
-
aiSlots?: Record<string, AiSlotDescriptor[]>;
|
|
166
186
|
/**
|
|
167
187
|
* Optional declaration of structured CMS views the theme supports
|
|
168
188
|
* (post.index/post.detail/tag.index/tag.detail) and their default routes.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,MAAM,EACN,IAAI,EACJ,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,IAAI,UAAU,EACpB,UAAU,IAAI,cAAc,EAC7B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,MAAM,EACN,IAAI,EACJ,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,IAAI,UAAU,EACpB,UAAU,IAAI,cAAc,EAC7B,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,GAAG;IACtE,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,qBAAqB,GAAG,qBAAqB,IACzF,IAAI,CACF,mBAAmB,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;CAAE,CAAC,EACjF,IAAI,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M,WAAW,WAAW;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,sDAAsD;IACtD,UAAU,EAAE,UAAU,CAAC;IACvB,2EAA2E;IAC3E,YAAY,EAAE,UAAU,CAAC;IACzB;;;OAGG;IACH,aAAa,EAAE,UAAU,CAAC;IAC1B,uCAAuC;IACvC,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,CAAC,EAAE,YAAY,CAAC;CACxB"}
|
package/package.json
CHANGED
package/dist/ai/slots.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { AiSlotDescriptor, PageData } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* A concrete AI-editable slot located inside a page document, produced by
|
|
4
|
-
* {@link extractAiSlots}. Identifies the component instance plus the prop path
|
|
5
|
-
* and current value, so the assistant can propose edits scoped to safe fields.
|
|
6
|
-
*/
|
|
7
|
-
export interface ResolvedAiSlot {
|
|
8
|
-
/** Puck component instance id (`props.id`). */
|
|
9
|
-
componentId: string;
|
|
10
|
-
/** Puck component type. */
|
|
11
|
-
type: string;
|
|
12
|
-
descriptor: AiSlotDescriptor;
|
|
13
|
-
value: unknown;
|
|
14
|
-
}
|
|
15
|
-
/** A single edit the assistant wants to apply. */
|
|
16
|
-
export interface AiSlotEdit {
|
|
17
|
-
componentId: string;
|
|
18
|
-
path: string;
|
|
19
|
-
value: unknown;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Walks a page document and returns every AI-editable slot declared by the
|
|
23
|
-
* theme's `aiSlots` map (keyed by component type).
|
|
24
|
-
*/
|
|
25
|
-
export declare function extractAiSlots(data: PageData, aiSlots: Record<string, AiSlotDescriptor[]> | undefined): ResolvedAiSlot[];
|
|
26
|
-
/**
|
|
27
|
-
* Applies a batch of AI edits to a page document, scoped strictly to the
|
|
28
|
-
* declared `aiSlots` for each component type. Edits targeting unknown
|
|
29
|
-
* components or paths outside the allow-list are ignored. Returns a new
|
|
30
|
-
* document; the input is not mutated.
|
|
31
|
-
*/
|
|
32
|
-
export declare function applyAiValues(data: PageData, aiSlots: Record<string, AiSlotDescriptor[]> | undefined, edits: AiSlotEdit[]): PageData;
|
|
33
|
-
//# sourceMappingURL=slots.d.ts.map
|
package/dist/ai/slots.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../../src/ai/slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,kDAAkD;AAClD,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AA6FD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,GAAG,SAAS,GACtD,cAAc,EAAE,CAqBlB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,CAAC,GAAG,SAAS,EACvD,KAAK,EAAE,UAAU,EAAE,GAClB,QAAQ,CAgCV"}
|