create-ailk 0.46.6 → 0.48.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/README.md +180 -43
- package/component-catalog.json +223 -285
- package/component-catalog.md +1 -1
- package/dist/apply-design.d.ts +26 -68
- package/dist/apply-design.js +150 -322
- package/dist/cli.js +152 -17
- package/dist/compare-chrome.d.ts +108 -0
- package/dist/compare-chrome.js +481 -0
- package/dist/compare-look.d.ts +94 -0
- package/dist/compare-look.js +378 -0
- package/dist/copy.js +1 -1
- package/dist/design-compile.d.ts +17 -21
- package/dist/design-compile.js +32 -56
- package/dist/design-files.d.ts +93 -0
- package/dist/design-files.js +312 -0
- package/dist/design-home.d.ts +4 -2
- package/dist/design-home.js +88 -6
- package/dist/design-names.d.ts +13 -0
- package/dist/design-names.js +76 -0
- package/dist/design-package.d.ts +46 -56
- package/dist/design-package.js +285 -288
- package/dist/design-presets.d.ts +41 -0
- package/dist/design-presets.js +83 -4
- package/dist/design-scaffold.d.ts +12 -2
- package/dist/design-scaffold.js +72 -34
- package/dist/generated/design-settings.d.ts +56 -0
- package/dist/generated/design-settings.js +237 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/inventory.d.ts +3 -2
- package/dist/inventory.js +10 -4
- package/dist/lib/design-checks.d.ts +46 -0
- package/dist/lib/design-checks.js +79 -1
- package/dist/lib/env-catalog.js +5 -1
- package/dist/lib/module-license-gate.d.ts +1 -1
- package/dist/lib/module-license-gate.js +1 -1
- package/dist/lib/render-verdict.d.ts +13 -1
- package/dist/lib/render-verdict.js +41 -1
- package/dist/look-hub.d.ts +44 -0
- package/dist/look-hub.js +130 -0
- package/dist/look-record.d.ts +35 -0
- package/dist/look-record.js +85 -0
- package/dist/look-samples.d.ts +66 -0
- package/dist/look-samples.js +456 -0
- package/dist/look-settings.d.ts +53 -0
- package/dist/look-settings.js +363 -0
- package/dist/module-architecture.js +12 -0
- package/dist/parse-args.d.ts +10 -6
- package/dist/parse-args.js +26 -13
- package/dist/programmatic.d.ts +1 -19
- package/dist/programmatic.js +65 -103
- package/dist/retired-design-bodies.d.ts +29 -0
- package/dist/retired-design-bodies.js +51 -0
- package/dist/seed-flows.d.ts +1 -1
- package/dist/seed-flows.js +12 -14
- package/dist/seed-workspace.d.ts +4 -1
- package/dist/seed-workspace.js +139 -17
- package/dist/site-chrome.d.ts +41 -41
- package/dist/site-chrome.js +50 -70
- package/dist/site-fonts.d.ts +10 -14
- package/dist/site-fonts.js +5 -1
- package/dist/starter-grid.d.ts +2 -2
- package/dist/strip-look-copies.d.ts +67 -0
- package/dist/strip-look-copies.js +591 -0
- package/dist/template-manifest.d.ts +6 -14
- package/dist/template-manifest.js +0 -9
- package/dist/template-record.d.ts +3 -1
- package/dist/template-record.js +3 -1
- package/dist/topology.d.ts +15 -0
- package/dist/topology.js +60 -0
- package/dist/update.d.ts +57 -1
- package/dist/update.js +742 -13
- package/package.json +3 -4
- package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/designs/minimalism/DESIGN.md +163 -297
- package/site-templates/designs/minimalism/LOOK.md +42 -0
- package/site-templates/designs/minimalism/design.yaml +167 -0
- package/site-templates/designs/standard/DESIGN.md +145 -149
- package/site-templates/designs/standard/LOOK.md +42 -0
- package/site-templates/designs/standard/design.yaml +72 -0
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
- package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
- package/site-templates/shapes/person-service/content/_site.mdx +0 -26
- package/templates/.claude/rules/extending.md +3 -2
- package/templates/.env.example +11 -4
- package/templates/CLAUDE.md +1 -1
- package/templates/DESIGN.md +145 -149
- package/templates/README.md +15 -16
- package/templates/apps/api/.env.example +29 -4
- package/templates/apps/api/CLAUDE.md +7 -4
- package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +30 -4
- package/templates/apps/api/src/vercel-handler.ts +32 -2
- package/templates/apps/mcp/.env.example +8 -0
- package/templates/apps/mcp/CLAUDE.md +5 -3
- package/templates/apps/web/.env.example +10 -3
- package/templates/apps/web/CLAUDE.md +31 -4
- package/templates/apps/web/app/[locale]/layout.tsx +141 -77
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
- package/templates/apps/web/app/not-found.tsx +11 -11
- package/templates/apps/web/auth.ts +48 -35
- package/templates/apps/web/jest.config.cjs +5 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +542 -10
- package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
- package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +233 -0
- package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
- package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
- package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
- package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
- package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
- package/templates/apps/web/lib/deck-page.ts +3 -10
- package/templates/apps/web/lib/deploy-fonts.ts +12 -0
- package/templates/apps/web/lib/hub-site-config.ts +237 -29
- package/templates/apps/web/lib/library-fonts.ts +41 -0
- package/templates/apps/web/lib/mcp-oauth.ts +11 -4
- package/templates/apps/web/lib/page-chrome.ts +105 -20
- package/templates/apps/web/lib/section-look.ts +28 -0
- package/templates/apps/web/lib/site-design.ts +205 -0
- package/templates/apps/web/lib/site-navigation.ts +208 -0
- package/templates/apps/web/lib/site-theme-head.ts +98 -13
- package/templates/apps/web/lib/site-theme.ts +40 -62
- package/templates/apps/web/messages/en.json +0 -6
- package/templates/apps/web/next.config.mjs +213 -11
- package/templates/apps/web/package.json +2 -0
- package/templates/apps/web/site-pages.config.tsx +4 -2
- package/templates/content/_site.mdx +0 -26
- package/templates/design.yaml +75 -0
- package/templates/project.yaml +14 -0
- package/versions.json +52 -51
- package/site-templates/marketing-site/DESIGN.md +0 -259
- package/site-templates/marketing-site-free/DESIGN.md +0 -259
- package/site-templates/saas-product/DESIGN.md +0 -259
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
- package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
- package/templates/apps/web/lib/site-chrome.ts +0 -46
- package/templates/apps/web/lib/site-fonts.ts +0 -15
package/dist/seed-workspace.js
CHANGED
|
@@ -19,12 +19,21 @@
|
|
|
19
19
|
* source are printed before the first one. The importer owns the transport
|
|
20
20
|
* (#10203 D5): bearer header only, no redirect, the key never printed.
|
|
21
21
|
*
|
|
22
|
-
* The scaffold-time step (D3, D6) runs
|
|
23
|
-
*
|
|
22
|
+
* The scaffold-time step (D3, D6) runs on a hub with an Admin (`workspace`
|
|
23
|
+
* or `multi-tenant`), and on a spoke, after `--install`, with all three
|
|
24
24
|
* variables set; otherwise it prints why and the command that seeds and
|
|
25
|
-
* switches later, or nothing on a site with
|
|
25
|
+
* switches later, or nothing on a site with neither. It never fails the
|
|
26
26
|
* scaffold.
|
|
27
27
|
*
|
|
28
|
+
* Then the look (#12477 D4, spec
|
|
29
|
+
* docs/specs/12477-retire-the-generated-look-files-spec.md): a new site's
|
|
30
|
+
* first hub design record, built from the design and starter it was
|
|
31
|
+
* scaffolded with (`look-record.ts`), written only where the workspace holds
|
|
32
|
+
* none and the site carries no look of its own — never over a stored record,
|
|
33
|
+
* never into a workspace already in use. A spoke's pages are its own files,
|
|
34
|
+
* so on a spoke only the look is seeded, and only into the workspace its own
|
|
35
|
+
* env files name.
|
|
36
|
+
*
|
|
28
37
|
* Pure module: no `import.meta.url`, so jest can import it directly. `fetch`,
|
|
29
38
|
* `sleep`, `env` and the adapter are injectable. Spec:
|
|
30
39
|
* docs/specs/10204-seed-the-starter-s-roster-spec.md; the publish and the
|
|
@@ -33,10 +42,13 @@
|
|
|
33
42
|
import { join, resolve } from "node:path";
|
|
34
43
|
import { parseArgs } from "node:util";
|
|
35
44
|
import { AddModuleRefusedError } from "./add-module-core.js";
|
|
45
|
+
import { shippedDesignsDir } from "./design-names.js";
|
|
36
46
|
import { ImportMdxRefusedError, formatImportMdxReport, importMdx, loadSiteMdxAdapter, } from "./lib/import-mdx.js";
|
|
47
|
+
import { describeAnswer, designUrl, hubRequest, retiredLookSources, storedVersion, } from "./look-hub.js";
|
|
48
|
+
import { lookRecordFor, readLookInputs } from "./look-record.js";
|
|
37
49
|
import { ParseError } from "./parse-args.js";
|
|
38
50
|
import { readSiteRoster } from "./site-roster.js";
|
|
39
|
-
import { HUB_ORIGIN_ENV_VAR, TopologyError, normalizeHubUrl, readSiteTopology, writeApiEnv, writeWebEnv, } from "./topology.js";
|
|
51
|
+
import { HUB_ORIGIN_ENV_VAR, TopologyError, normalizeHubUrl, readSiteTopology, spokeOriginMismatch, spokeWorkspaceMismatch, writeApiEnv, writeWebEnv, } from "./topology.js";
|
|
40
52
|
/** The environment variable the agent key is read from — and nowhere else. */
|
|
41
53
|
export const AGENT_KEY_ENV_VAR = "AILK_AGENT_KEY";
|
|
42
54
|
/** The environment variable the workspace id is read from when no flag names one. */
|
|
@@ -87,12 +99,9 @@ export async function seedWorkspace(opts) {
|
|
|
87
99
|
throw err;
|
|
88
100
|
refuse(`${err.message}.`);
|
|
89
101
|
}
|
|
90
|
-
if (topology === "spoke") {
|
|
91
|
-
refuse(`${opts.targetDir} is a spoke: its pages are its own MDX files, and its hub owns the workspace.`);
|
|
92
|
-
}
|
|
93
102
|
const apiKey = given(env[AGENT_KEY_ENV_VAR]);
|
|
94
103
|
if (apiKey === undefined) {
|
|
95
|
-
refuse(`set ${AGENT_KEY_ENV_VAR} to an agent key with the content-edit and content-publish grants, at Autonomous. It is read from the environment only — never a flag or a file.`);
|
|
104
|
+
refuse(`set ${AGENT_KEY_ENV_VAR} to an agent key with the content-edit and content-publish grants, at Autonomous (and the site-design grant, for the look). It is read from the environment only — never a flag or a file.`);
|
|
96
105
|
}
|
|
97
106
|
const workspaceId = given(opts.workspaceId) ?? given(env[WORKSPACE_ID_ENV_VAR]);
|
|
98
107
|
if (workspaceId === undefined) {
|
|
@@ -113,6 +122,23 @@ export async function seedWorkspace(opts) {
|
|
|
113
122
|
throw err;
|
|
114
123
|
refuse(`the API origin must be an https: origin (http: only on a loopback host) with no path, query, fragment or credentials (from ${source}).`);
|
|
115
124
|
}
|
|
125
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
126
|
+
const designsDir = opts.designsDir ?? shippedDesignsDir();
|
|
127
|
+
const look = { targetDir, designsDir, origin, workspaceId, apiKey, fetchImpl, onLine };
|
|
128
|
+
// #12477 D4 — a spoke's pages are its own files: only its look is seeded,
|
|
129
|
+
// and only into the workspace and hub its own env files name.
|
|
130
|
+
if (topology === "spoke") {
|
|
131
|
+
const mismatch = spokeWorkspaceMismatch(targetDir, workspaceId) ?? spokeOriginMismatch(targetDir, origin);
|
|
132
|
+
if (mismatch !== undefined)
|
|
133
|
+
refuse(`${mismatch}.`);
|
|
134
|
+
onLine(`Seeding ${opts.targetDir}'s look into workspace ${workspaceId} at ${origin} (from ${source}) — a spoke's pages are its own files.`);
|
|
135
|
+
const result = {
|
|
136
|
+
pages: [],
|
|
137
|
+
counts: { created: 0, updated: 0, unchanged: 0, skipped: 0, failed: 0 },
|
|
138
|
+
};
|
|
139
|
+
const lookOk = await seedLook({ ...look, topology, workspaceHeldPages: false });
|
|
140
|
+
return { result, exitCode: lookOk ? 0 : 1 };
|
|
141
|
+
}
|
|
116
142
|
onLine(`Seeding ${opts.targetDir} into workspace ${workspaceId} at ${origin} (from ${source}).`);
|
|
117
143
|
const adapters = opts.adapters ?? (await loadSiteMdxAdapter(targetDir));
|
|
118
144
|
const result = await importMdx({
|
|
@@ -154,7 +180,91 @@ export async function seedWorkspace(opts) {
|
|
|
154
180
|
}
|
|
155
181
|
onLine("Content source: content/ (unchanged) until every page is seeded and Live.");
|
|
156
182
|
}
|
|
157
|
-
|
|
183
|
+
const lookOk = await seedLook({ ...look, topology, workspaceHeldPages: updated + unchanged > 0 });
|
|
184
|
+
return { result, exitCode: failed > 0 || !lookOk ? 1 : 0 };
|
|
185
|
+
}
|
|
186
|
+
const IN_USE = "Look: not written — the workspace is already in use; import its look (#12476's runbook) or choose it on the Admin's Look page.";
|
|
187
|
+
/**
|
|
188
|
+
* Write the site's first hub design record (D4 steps 0–3). `false` only when
|
|
189
|
+
* the look was not written for a reason that fails the run: a hub answer
|
|
190
|
+
* that is neither the record nor a named skip.
|
|
191
|
+
*/
|
|
192
|
+
async function seedLook(input) {
|
|
193
|
+
const { onLine } = input;
|
|
194
|
+
// Step 0 — not a new site: no design request.
|
|
195
|
+
if (retiredLookSources(input.targetDir).length > 0) {
|
|
196
|
+
onLine("Look: not written — this site still carries its look files; import it (#12476's runbook) instead.");
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
if (input.topology === "hub" && input.workspaceHeldPages) {
|
|
200
|
+
onLine("Look: not written — the workspace already held pages; import its look (#12476's runbook) or choose it on the Admin's Look page.");
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
let inputs;
|
|
204
|
+
try {
|
|
205
|
+
inputs = readLookInputs(input.targetDir, input.designsDir);
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
// The site's design.yaml or manifest does not read: no record from it.
|
|
209
|
+
onLine(`Look: not written (the site's design does not read: ${err.message}).`);
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (inputs === undefined) {
|
|
213
|
+
onLine("Look: not written — the site records no design; choose one on the Admin's Look page.");
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
const base = `${input.origin}/v1/workspaces/${encodeURIComponent(input.workspaceId)}`;
|
|
217
|
+
if (input.topology === "spoke") {
|
|
218
|
+
// A spoke's identity and navigation show use: the imports write them for a live spoke.
|
|
219
|
+
const identity = await hubRequest(input.fetchImpl, `${base}/identity`, input.apiKey);
|
|
220
|
+
if (!identity.ok) {
|
|
221
|
+
onLine(`Look: not written (${describeAnswer(identity)}).`);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
const navigation = await hubRequest(input.fetchImpl, `${base}/navigation`, input.apiKey);
|
|
225
|
+
const navigationVersion = storedVersion(navigation);
|
|
226
|
+
if (navigationVersion === undefined) {
|
|
227
|
+
onLine(`Look: not written (${describeAnswer(navigation)}).`);
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
if (identity.data !== null || navigationVersion !== null) {
|
|
231
|
+
onLine(IN_USE);
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// Step 1 — never written over a stored record.
|
|
236
|
+
const url = designUrl(input.origin, input.workspaceId);
|
|
237
|
+
const read = await hubRequest(input.fetchImpl, url, input.apiKey);
|
|
238
|
+
const stored = storedVersion(read);
|
|
239
|
+
if (stored === undefined) {
|
|
240
|
+
onLine(`Look: not written (${describeAnswer(read)}).`);
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
if (stored !== null) {
|
|
244
|
+
onLine(`Look: kept — the workspace holds version ${stored}.`);
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
// Step 2 — the first record.
|
|
248
|
+
const design = lookRecordFor(inputs);
|
|
249
|
+
const written = await hubRequest(input.fetchImpl, url, input.apiKey, {
|
|
250
|
+
method: "PUT",
|
|
251
|
+
body: { version: null, design },
|
|
252
|
+
});
|
|
253
|
+
const version = storedVersion(written);
|
|
254
|
+
if (typeof version === "number") {
|
|
255
|
+
onLine(`Look: written version ${version} · ${design.from?.look ?? "its own look"}.`);
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
if (written.status === 409) {
|
|
259
|
+
onLine("Look: kept — a record was saved meanwhile.");
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
if (written.status === 403) {
|
|
263
|
+
onLine(`Look: skipped — the agent key has no site-design grant (403 ${written.code ?? "<unexpected>"}); tick Site design on the agent's key, or choose the look on the Admin's Look page.`);
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
onLine(`Look: not written (${describeAnswer(written)}).`);
|
|
267
|
+
return false;
|
|
158
268
|
}
|
|
159
269
|
const SEED_CREDENTIALS = [
|
|
160
270
|
HUB_ORIGIN_ENV_VAR,
|
|
@@ -169,9 +279,9 @@ function joinNames(names) {
|
|
|
169
279
|
}
|
|
170
280
|
/** What the scaffold does about seeding, decided in D3's order. */
|
|
171
281
|
export function scaffoldSeedPlan(input) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
282
|
+
// #12477 D4 — a spoke seeds its look; a hub needs an Admin to seed at all.
|
|
283
|
+
if (input.topology !== "spoke" &&
|
|
284
|
+
!input.modules.includes("workspace") &&
|
|
175
285
|
!input.modules.includes("multi-tenant")) {
|
|
176
286
|
return { kind: "not-applicable" };
|
|
177
287
|
}
|
|
@@ -198,10 +308,13 @@ export async function runScaffoldSeed(opts) {
|
|
|
198
308
|
const plan = scaffoldSeedPlan(opts);
|
|
199
309
|
if (plan.kind === "not-applicable")
|
|
200
310
|
return;
|
|
201
|
-
const later =
|
|
311
|
+
const later = () => {
|
|
312
|
+
opts.onLine(` To seed it and switch to the database later: ${AGENT_KEY_ENV_VAR}=<key> create-ailk seed-workspace ${opts.targetDir} --api-url <origin> --workspace <wksp_id>`);
|
|
313
|
+
opts.onLine(" Its look step needs the key's site-design grant; until the look is written the site renders the base look.");
|
|
314
|
+
};
|
|
202
315
|
if (plan.kind === "skip") {
|
|
203
316
|
opts.onLine(plan.reason);
|
|
204
|
-
|
|
317
|
+
later();
|
|
205
318
|
return;
|
|
206
319
|
}
|
|
207
320
|
opts.onLine("Seeding the workspace:");
|
|
@@ -210,6 +323,7 @@ export async function runScaffoldSeed(opts) {
|
|
|
210
323
|
targetDir: opts.targetDir,
|
|
211
324
|
env: opts.env,
|
|
212
325
|
onLine: opts.onLine,
|
|
326
|
+
...(opts.designsDir !== undefined && { designsDir: opts.designsDir }),
|
|
213
327
|
...(opts.adapters !== undefined && { adapters: opts.adapters }),
|
|
214
328
|
...(opts.fetch !== undefined && { fetch: opts.fetch }),
|
|
215
329
|
...(opts.sleep !== undefined && { sleep: opts.sleep }),
|
|
@@ -221,7 +335,7 @@ export async function runScaffoldSeed(opts) {
|
|
|
221
335
|
throw err;
|
|
222
336
|
}
|
|
223
337
|
opts.onLine(err.message);
|
|
224
|
-
|
|
338
|
+
later();
|
|
225
339
|
}
|
|
226
340
|
}
|
|
227
341
|
export const SEED_WORKSPACE_HELP = `create-ailk seed-workspace — import a starter's pages into its workspace.
|
|
@@ -245,8 +359,16 @@ agent key, which is read from AILK_AGENT_KEY only and needs the content-edit
|
|
|
245
359
|
and content-publish grants, at Autonomous. Each page prints created, updated,
|
|
246
360
|
unchanged, skipped or failed, so a re-run is safe. When every page is Live, the site
|
|
247
361
|
switches apps/web and apps/api to CONTENT_ADAPTER=database, keeping a value
|
|
248
|
-
either already sets. The site's dependencies must be installed.
|
|
249
|
-
|
|
362
|
+
either already sets. The site's dependencies must be installed.
|
|
363
|
+
|
|
364
|
+
Then the look: the site's first design record, from the design and starter it
|
|
365
|
+
was scaffolded with, is written to the workspace — only where the workspace
|
|
366
|
+
holds none, and never for a site that still carries its look files or a
|
|
367
|
+
workspace already in use. This step alone needs the key's site-design grant;
|
|
368
|
+
without it the step is skipped and named. On a spoke, whose pages are its own
|
|
369
|
+
files, only the look is seeded, into the workspace and at the hub its
|
|
370
|
+
apps/web env files name. Exit 0 when every page was seeded and the look written, kept or
|
|
371
|
+
skipped, 1 when any failed, 2 on a refusal (nothing is sent).
|
|
250
372
|
`;
|
|
251
373
|
export function parseSeedWorkspaceArgs(argv) {
|
|
252
374
|
let parsed;
|
package/dist/site-chrome.d.ts
CHANGED
|
@@ -10,16 +10,17 @@
|
|
|
10
10
|
* file (spec 5462 D9/D16) — these are SITE-LEVEL facts a template DECLARES
|
|
11
11
|
* (on `TemplateManifest.layout` in the code registry, or on a bundle's
|
|
12
12
|
* `ailk-template.json` `layout` field), never a file it ships. This module is
|
|
13
|
-
* the single place that declares the vocabulary, fills defaults
|
|
14
|
-
* untrusted (bundle-sourced) value
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* the single place that declares the vocabulary, fills defaults and validates
|
|
14
|
+
* an untrusted (bundle-sourced) value. The resolved knobs reach a site as its
|
|
15
|
+
* hub design record's layout (`look-record.ts`, #12477): no scaffold or
|
|
16
|
+
* `apply-design` writes `apps/web/lib/site-chrome.ts` any more.
|
|
17
|
+
* `renderSiteChrome` stays only for `look-settings` (#12476), which proves a
|
|
18
|
+
* live site's retired file is what its settings compiled to before the look
|
|
19
|
+
* is imported.
|
|
17
20
|
*
|
|
18
21
|
* Every field is optional and DEFAULTS to `full` / `columns` / `false` /
|
|
19
22
|
* `default` — the announcement banner is off unless a template turns it on
|
|
20
|
-
* (#6469).
|
|
21
|
-
* block, gets these defaults written, byte-identical to the monorepo's own
|
|
22
|
-
* committed `apps/web/lib/site-chrome.ts`.
|
|
23
|
+
* (#6469).
|
|
23
24
|
*
|
|
24
25
|
* A design supplies layout knobs too (#6638, widened #6813 D4): its OWN
|
|
25
26
|
* `layout` (a `DesignPackage`'s, read by `design-scaffold.ts`'s
|
|
@@ -29,36 +30,31 @@
|
|
|
29
30
|
* close): an unrecognized design NAME now fails in `resolveDesign`, before
|
|
30
31
|
* this function ever sees one.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
33
|
+
import { CHROME_STYLE_VALUES, DECK_ANCHORS_VALUES, DECK_GROUND_VALUES, FOOTER_STYLES, HEADER_STYLES, HOME_VALUES, INNER_PAGES_VALUES } from "./generated/design-settings.js";
|
|
34
|
+
/**
|
|
35
|
+
* The `nav` knob's vocabulary: the one header style list (#12470 D7) —
|
|
36
|
+
* `mark-only` → the layout passes Nav an empty `navItems` (brand mark + the
|
|
37
|
+
* existing actions/theme/locale controls only); `bare` and `none` as a page's
|
|
38
|
+
* own header.
|
|
39
|
+
*/
|
|
40
|
+
export type SiteChromeHeader = (typeof HEADER_STYLES)[number];
|
|
41
|
+
/** The `footer` knob's vocabulary: the one footer style list (#12470 D7). */
|
|
42
|
+
export type SiteChromeFooterStyle = (typeof FOOTER_STYLES)[number];
|
|
38
43
|
/** The `home` knob's vocabulary. `deck` → the locale-root route mounts
|
|
39
44
|
* MarketingShell with `snap="mandatory"` + `deckHero` (spec 5426 D7). */
|
|
40
|
-
export type SiteChromeHome =
|
|
45
|
+
export type SiteChromeHome = (typeof HOME_VALUES)[number];
|
|
41
46
|
/** The `innerPages` knob's vocabulary (#7721). `bare` → every non-home page
|
|
42
47
|
* gets the bare header and the one-bar footer. */
|
|
43
|
-
export type SiteChromeInnerPages =
|
|
48
|
+
export type SiteChromeInnerPages = (typeof INNER_PAGES_VALUES)[number];
|
|
44
49
|
/** The `deckAnchors` knob's vocabulary (#8773). `bare` → the deck home names
|
|
45
50
|
* its slides `#<id>` instead of `#slide-<id>`, keeping the `slide-` name only
|
|
46
51
|
* where the bare id would collide (the page renderer's `deckSlideAnchors`). */
|
|
47
|
-
export type SiteChromeDeckAnchors =
|
|
48
|
-
/** The `colorMode` knob's vocabulary (#7742). `light` pins the site to light
|
|
49
|
-
* and removes every theme switch; dark then appears only as a deck ground. */
|
|
50
|
-
export type SiteChromeColorMode = "user" | "light";
|
|
52
|
+
export type SiteChromeDeckAnchors = (typeof DECK_ANCHORS_VALUES)[number];
|
|
51
53
|
/** The `chromeStyle` knob's vocabulary (#7742). `minimal` → the deck's closing
|
|
52
54
|
* slide is the wordmark + contact lines + one legal line, and the consent bar
|
|
53
55
|
* is a ground-coloured hairline bar that never covers the down cue. */
|
|
54
|
-
export type SiteChromeChromeStyle =
|
|
55
|
-
/**
|
|
56
|
-
* The `deckGrounds` knob's vocabulary (#7719 D3) — the shared section surface
|
|
57
|
-
* enum, duplicated from `@working-theory/validation`'s `SectionSurfaceSchema`
|
|
58
|
-
* because `create-ailk` cannot import it (one runtime dependency, § 1.5);
|
|
59
|
-
* `site-chrome.test.ts` proves the two lists equal.
|
|
60
|
-
*/
|
|
61
|
-
export declare const DECK_GROUND_VALUES: readonly ["none", "gray-100", "wash", "wash-secondary", "gradient-brand", "gradient-dark", "solid-dark"];
|
|
56
|
+
export type SiteChromeChromeStyle = (typeof CHROME_STYLE_VALUES)[number];
|
|
57
|
+
/** The `deckGrounds` knob's vocabulary (#7719 D3): the shared section surface list. */
|
|
62
58
|
export type DeckGround = (typeof DECK_GROUND_VALUES)[number];
|
|
63
59
|
/**
|
|
64
60
|
* A template's declared layout block — every field optional. Lives on
|
|
@@ -66,8 +62,8 @@ export type DeckGround = (typeof DECK_GROUND_VALUES)[number];
|
|
|
66
62
|
* on a template bundle's `ailk-template.json` `layout` field, same shape.
|
|
67
63
|
*/
|
|
68
64
|
export interface TemplateLayout {
|
|
69
|
-
nav?:
|
|
70
|
-
footer?:
|
|
65
|
+
nav?: SiteChromeHeader;
|
|
66
|
+
footer?: SiteChromeFooterStyle;
|
|
71
67
|
announcementBanner?: boolean;
|
|
72
68
|
home?: SiteChromeHome;
|
|
73
69
|
/** #7719 D3 — the surfaces a deck home cycles, slide by slide, onto slides that author none. */
|
|
@@ -78,8 +74,6 @@ export interface TemplateLayout {
|
|
|
78
74
|
deckPresentation?: boolean;
|
|
79
75
|
/** #8773 — `bare`: a presenting deck names its slides `#<id>` (a presenting deck home only). */
|
|
80
76
|
deckAnchors?: SiteChromeDeckAnchors;
|
|
81
|
-
/** #7742 D1 — `light`: the site is pinned to light, with no theme switch. */
|
|
82
|
-
colorMode?: SiteChromeColorMode;
|
|
83
77
|
/** #7742 D1 — `minimal`: the minimal closing slide, consent bar and themed 404. */
|
|
84
78
|
chromeStyle?: SiteChromeChromeStyle;
|
|
85
79
|
/** #7797 D1 — route paths whose page ends on the closing footer (wordmark, contact lines, legal line). */
|
|
@@ -87,8 +81,8 @@ export interface TemplateLayout {
|
|
|
87
81
|
}
|
|
88
82
|
/** `TemplateLayout` with every field resolved — what `site-chrome.ts` exports. */
|
|
89
83
|
export interface ResolvedSiteChrome {
|
|
90
|
-
nav:
|
|
91
|
-
footer:
|
|
84
|
+
nav: SiteChromeHeader;
|
|
85
|
+
footer: SiteChromeFooterStyle;
|
|
92
86
|
announcementBanner: boolean;
|
|
93
87
|
home: SiteChromeHome;
|
|
94
88
|
/** Present only when a list resolves AND `home` is `deck` (#7719 D3) — never an `undefined` key. */
|
|
@@ -99,8 +93,6 @@ export interface ResolvedSiteChrome {
|
|
|
99
93
|
deckPresentation?: true;
|
|
100
94
|
/** Present only when it resolves to "bare" on a presenting deck home (#8773) — never "prefixed". */
|
|
101
95
|
deckAnchors?: "bare";
|
|
102
|
-
/** Present only when it resolves to "light" — never "user" (#7742 D1). */
|
|
103
|
-
colorMode?: "light";
|
|
104
96
|
/** Present only when it resolves to "minimal" — never "default" (#7742 D1). */
|
|
105
97
|
chromeStyle?: "minimal";
|
|
106
98
|
/** Present only when a non-empty list resolves — never `[]` (#7797 D1). */
|
|
@@ -108,8 +100,17 @@ export interface ResolvedSiteChrome {
|
|
|
108
100
|
}
|
|
109
101
|
/** Defaults (#5612 D1; banner off since #6469). */
|
|
110
102
|
export declare const DEFAULT_SITE_CHROME: ResolvedSiteChrome;
|
|
111
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Site-relative path of the retired layout file (#12477): no generator writes
|
|
105
|
+
* it. `update` never records it (`REGENERATED_APP_PATHS`) and removes it only
|
|
106
|
+
* once the hub's read for the site carries its look (D6).
|
|
107
|
+
*/
|
|
112
108
|
export declare const SITE_CHROME_PATH = "apps/web/lib/site-chrome.ts";
|
|
109
|
+
/**
|
|
110
|
+
* Layout keys that are no longer settings, each with the reason a layout that
|
|
111
|
+
* carries one is refused (#12500 D3) — refused by name, never silently dropped.
|
|
112
|
+
*/
|
|
113
|
+
export declare const RETIRED_LAYOUT_KEYS: Readonly<Record<string, string>>;
|
|
113
114
|
/** Thrown by `validateTemplateLayout` on an unrecognized value, naming the field. */
|
|
114
115
|
export declare class TemplateLayoutError extends Error {
|
|
115
116
|
constructor(message: string);
|
|
@@ -142,10 +143,9 @@ export declare function validateTemplateLayout(value: unknown, subject: string):
|
|
|
142
143
|
*/
|
|
143
144
|
export declare function resolveSiteChrome(layout?: TemplateLayout, designLayout?: TemplateLayout): ResolvedSiteChrome;
|
|
144
145
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* `snap="mandatory"` + `deckHero` to MarketingShell.
|
|
146
|
+
* The text create-ailk wrote to `apps/web/lib/site-chrome.ts` for a resolved
|
|
147
|
+
* layout, before #12477 retired the file. Read only by `look-settings`
|
|
148
|
+
* (#12476), which compares a live site's file to it before the site's look
|
|
149
|
+
* is imported; nothing writes it.
|
|
150
150
|
*/
|
|
151
151
|
export declare function renderSiteChrome(resolved: ResolvedSiteChrome): string;
|
package/dist/site-chrome.js
CHANGED
|
@@ -10,16 +10,17 @@
|
|
|
10
10
|
* file (spec 5462 D9/D16) — these are SITE-LEVEL facts a template DECLARES
|
|
11
11
|
* (on `TemplateManifest.layout` in the code registry, or on a bundle's
|
|
12
12
|
* `ailk-template.json` `layout` field), never a file it ships. This module is
|
|
13
|
-
* the single place that declares the vocabulary, fills defaults
|
|
14
|
-
* untrusted (bundle-sourced) value
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* the single place that declares the vocabulary, fills defaults and validates
|
|
14
|
+
* an untrusted (bundle-sourced) value. The resolved knobs reach a site as its
|
|
15
|
+
* hub design record's layout (`look-record.ts`, #12477): no scaffold or
|
|
16
|
+
* `apply-design` writes `apps/web/lib/site-chrome.ts` any more.
|
|
17
|
+
* `renderSiteChrome` stays only for `look-settings` (#12476), which proves a
|
|
18
|
+
* live site's retired file is what its settings compiled to before the look
|
|
19
|
+
* is imported.
|
|
17
20
|
*
|
|
18
21
|
* Every field is optional and DEFAULTS to `full` / `columns` / `false` /
|
|
19
22
|
* `default` — the announcement banner is off unless a template turns it on
|
|
20
|
-
* (#6469).
|
|
21
|
-
* block, gets these defaults written, byte-identical to the monorepo's own
|
|
22
|
-
* committed `apps/web/lib/site-chrome.ts`.
|
|
23
|
+
* (#6469).
|
|
23
24
|
*
|
|
24
25
|
* A design supplies layout knobs too (#6638, widened #6813 D4): its OWN
|
|
25
26
|
* `layout` (a `DesignPackage`'s, read by `design-scaffold.ts`'s
|
|
@@ -29,21 +30,7 @@
|
|
|
29
30
|
* close): an unrecognized design NAME now fails in `resolveDesign`, before
|
|
30
31
|
* this function ever sees one.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
-
* The `deckGrounds` knob's vocabulary (#7719 D3) — the shared section surface
|
|
34
|
-
* enum, duplicated from `@working-theory/validation`'s `SectionSurfaceSchema`
|
|
35
|
-
* because `create-ailk` cannot import it (one runtime dependency, § 1.5);
|
|
36
|
-
* `site-chrome.test.ts` proves the two lists equal.
|
|
37
|
-
*/
|
|
38
|
-
export const DECK_GROUND_VALUES = [
|
|
39
|
-
"none",
|
|
40
|
-
"gray-100",
|
|
41
|
-
"wash",
|
|
42
|
-
"wash-secondary",
|
|
43
|
-
"gradient-brand",
|
|
44
|
-
"gradient-dark",
|
|
45
|
-
"solid-dark",
|
|
46
|
-
];
|
|
33
|
+
import { CHROME_STYLE_VALUES, CLOSING_FOOTER_PATH_MAX, CLOSING_FOOTER_PATH_REGEX, CLOSING_FOOTER_PATH_SEGMENTS_MAX, CLOSING_FOOTER_PATHS_MAX, DECK_ANCHORS_VALUES, DECK_GROUND_VALUES, DECK_GROUNDS_MAX, FOOTER_STYLES, HEADER_STYLES, HOME_VALUES, INNER_PAGES_VALUES, } from "./generated/design-settings.js";
|
|
47
34
|
/** Defaults (#5612 D1; banner off since #6469). */
|
|
48
35
|
export const DEFAULT_SITE_CHROME = {
|
|
49
36
|
nav: "full",
|
|
@@ -51,8 +38,19 @@ export const DEFAULT_SITE_CHROME = {
|
|
|
51
38
|
announcementBanner: false,
|
|
52
39
|
home: "default",
|
|
53
40
|
};
|
|
54
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Site-relative path of the retired layout file (#12477): no generator writes
|
|
43
|
+
* it. `update` never records it (`REGENERATED_APP_PATHS`) and removes it only
|
|
44
|
+
* once the hub's read for the site carries its look (D6).
|
|
45
|
+
*/
|
|
55
46
|
export const SITE_CHROME_PATH = "apps/web/lib/site-chrome.ts";
|
|
47
|
+
/**
|
|
48
|
+
* Layout keys that are no longer settings, each with the reason a layout that
|
|
49
|
+
* carries one is refused (#12500 D3) — refused by name, never silently dropped.
|
|
50
|
+
*/
|
|
51
|
+
export const RETIRED_LAYOUT_KEYS = {
|
|
52
|
+
colorMode: "is retired by #12500 — every look has a light and a dark version; a look that is the same in both modes sets its dark colours to its light ones",
|
|
53
|
+
};
|
|
56
54
|
/** Thrown by `validateTemplateLayout` on an unrecognized value, naming the field. */
|
|
57
55
|
export class TemplateLayoutError extends Error {
|
|
58
56
|
constructor(message) {
|
|
@@ -60,21 +58,6 @@ export class TemplateLayoutError extends Error {
|
|
|
60
58
|
this.name = "TemplateLayoutError";
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
|
-
const NAV_VALUES = ["full", "mark-only"];
|
|
64
|
-
const FOOTER_VALUES = ["columns", "centered"];
|
|
65
|
-
const HOME_VALUES = ["default", "deck"];
|
|
66
|
-
const INNER_PAGES_VALUES = ["default", "bare"];
|
|
67
|
-
const DECK_ANCHORS_VALUES = ["prefixed", "bare"];
|
|
68
|
-
const COLOR_MODE_VALUES = ["user", "light"];
|
|
69
|
-
const CHROME_STYLE_VALUES = ["default", "minimal"];
|
|
70
|
-
/**
|
|
71
|
-
* A `closingFooterPaths` member (#7797): a route path as the site writes it —
|
|
72
|
-
* a leading "/" and no query, fragment, whitespace or control character. The
|
|
73
|
-
* layout normalizes the visitor's pathname (locale prefix, trailing slash)
|
|
74
|
-
* before comparing, so "/about" and "/about/" name the same page.
|
|
75
|
-
*/
|
|
76
|
-
// eslint-disable-next-line no-control-regex -- the class deliberately refuses control characters
|
|
77
|
-
const CLOSING_FOOTER_PATH = /^\/[^\s?#\u0000-\u001f]*$/;
|
|
78
61
|
/**
|
|
79
62
|
* Validate an UNTRUSTED `layout` value (a bundle's `ailk-template.json`
|
|
80
63
|
* `layout` field — arbitrary JSON, never compile-time checked the way the
|
|
@@ -95,15 +78,20 @@ export function validateTemplateLayout(value, subject) {
|
|
|
95
78
|
}
|
|
96
79
|
const raw = value;
|
|
97
80
|
const result = {};
|
|
81
|
+
for (const [key, reason] of Object.entries(RETIRED_LAYOUT_KEYS)) {
|
|
82
|
+
if (Object.hasOwn(raw, key)) {
|
|
83
|
+
throw new TemplateLayoutError(`${subject}: layout.${key} ${reason}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
98
86
|
if ("nav" in raw && raw.nav !== undefined) {
|
|
99
|
-
if (!
|
|
100
|
-
throw new TemplateLayoutError(`${subject}: layout.nav must be one of ${
|
|
87
|
+
if (!HEADER_STYLES.includes(raw.nav)) {
|
|
88
|
+
throw new TemplateLayoutError(`${subject}: layout.nav must be one of ${HEADER_STYLES.join(", ")} — got ${JSON.stringify(raw.nav)}`);
|
|
101
89
|
}
|
|
102
90
|
result.nav = raw.nav;
|
|
103
91
|
}
|
|
104
92
|
if ("footer" in raw && raw.footer !== undefined) {
|
|
105
|
-
if (!
|
|
106
|
-
throw new TemplateLayoutError(`${subject}: layout.footer must be one of ${
|
|
93
|
+
if (!FOOTER_STYLES.includes(raw.footer)) {
|
|
94
|
+
throw new TemplateLayoutError(`${subject}: layout.footer must be one of ${FOOTER_STYLES.join(", ")} — got ${JSON.stringify(raw.footer)}`);
|
|
107
95
|
}
|
|
108
96
|
result.footer = raw.footer;
|
|
109
97
|
}
|
|
@@ -124,8 +112,8 @@ export function validateTemplateLayout(value, subject) {
|
|
|
124
112
|
const badIndex = Array.isArray(grounds)
|
|
125
113
|
? grounds.findIndex((g) => !DECK_GROUND_VALUES.includes(g))
|
|
126
114
|
: -1;
|
|
127
|
-
if (!Array.isArray(grounds) || grounds.length === 0 || badIndex !== -1) {
|
|
128
|
-
throw new TemplateLayoutError(`${subject}: layout.deckGrounds must be a
|
|
115
|
+
if (!Array.isArray(grounds) || grounds.length === 0 || grounds.length > DECK_GROUNDS_MAX || badIndex !== -1) {
|
|
116
|
+
throw new TemplateLayoutError(`${subject}: layout.deckGrounds must be a list of 1 to ${DECK_GROUNDS_MAX} of ${DECK_GROUND_VALUES.join(", ")} — got ${JSON.stringify(badIndex !== -1 ? grounds[badIndex] : grounds)}`);
|
|
129
117
|
}
|
|
130
118
|
result.deckGrounds = grounds;
|
|
131
119
|
}
|
|
@@ -147,12 +135,6 @@ export function validateTemplateLayout(value, subject) {
|
|
|
147
135
|
}
|
|
148
136
|
result.deckAnchors = raw.deckAnchors;
|
|
149
137
|
}
|
|
150
|
-
if ("colorMode" in raw && raw.colorMode !== undefined) {
|
|
151
|
-
if (!COLOR_MODE_VALUES.includes(raw.colorMode)) {
|
|
152
|
-
throw new TemplateLayoutError(`${subject}: layout.colorMode must be one of ${COLOR_MODE_VALUES.join(", ")} — got ${JSON.stringify(raw.colorMode)}`);
|
|
153
|
-
}
|
|
154
|
-
result.colorMode = raw.colorMode;
|
|
155
|
-
}
|
|
156
138
|
if ("chromeStyle" in raw && raw.chromeStyle !== undefined) {
|
|
157
139
|
if (!CHROME_STYLE_VALUES.includes(raw.chromeStyle)) {
|
|
158
140
|
throw new TemplateLayoutError(`${subject}: layout.chromeStyle must be one of ${CHROME_STYLE_VALUES.join(", ")} — got ${JSON.stringify(raw.chromeStyle)}`);
|
|
@@ -162,10 +144,16 @@ export function validateTemplateLayout(value, subject) {
|
|
|
162
144
|
if ("closingFooterPaths" in raw && raw.closingFooterPaths !== undefined) {
|
|
163
145
|
const paths = raw.closingFooterPaths;
|
|
164
146
|
const badIndex = Array.isArray(paths)
|
|
165
|
-
? paths.findIndex((p) => typeof p !== "string" ||
|
|
147
|
+
? paths.findIndex((p) => typeof p !== "string" ||
|
|
148
|
+
p.length > CLOSING_FOOTER_PATH_MAX ||
|
|
149
|
+
!CLOSING_FOOTER_PATH_REGEX.test(p) ||
|
|
150
|
+
p.split("/").filter(Boolean).length > CLOSING_FOOTER_PATH_SEGMENTS_MAX)
|
|
166
151
|
: -1;
|
|
167
|
-
if (
|
|
168
|
-
throw new TemplateLayoutError(`${subject}: layout.closingFooterPaths must be a
|
|
152
|
+
if (badIndex !== -1) {
|
|
153
|
+
throw new TemplateLayoutError(`${subject}: layout.closingFooterPaths.${badIndex} must be a site path of plain segments (/, letters, digits, . _ ~ -), at most ${CLOSING_FOOTER_PATH_MAX} characters — got ${JSON.stringify(paths[badIndex])}`);
|
|
154
|
+
}
|
|
155
|
+
if (!Array.isArray(paths) || paths.length === 0 || paths.length > CLOSING_FOOTER_PATHS_MAX) {
|
|
156
|
+
throw new TemplateLayoutError(`${subject}: layout.closingFooterPaths must be a list of 1 to ${CLOSING_FOOTER_PATHS_MAX} route paths ("/about") — got ${JSON.stringify(paths)}`);
|
|
169
157
|
}
|
|
170
158
|
result.closingFooterPaths = paths;
|
|
171
159
|
}
|
|
@@ -219,9 +207,6 @@ export function resolveSiteChrome(layout, designLayout) {
|
|
|
219
207
|
resolved.deckAnchors = "bare";
|
|
220
208
|
}
|
|
221
209
|
// #7742 D1 — as with `innerPages`, only the opt-in value is ever a key.
|
|
222
|
-
if ((layout?.colorMode ?? fromDesign.colorMode) === "light") {
|
|
223
|
-
resolved.colorMode = "light";
|
|
224
|
-
}
|
|
225
210
|
if ((layout?.chromeStyle ?? fromDesign.chromeStyle) === "minimal") {
|
|
226
211
|
resolved.chromeStyle = "minimal";
|
|
227
212
|
}
|
|
@@ -234,11 +219,10 @@ export function resolveSiteChrome(layout, designLayout) {
|
|
|
234
219
|
return resolved;
|
|
235
220
|
}
|
|
236
221
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* `snap="mandatory"` + `deckHero` to MarketingShell.
|
|
222
|
+
* The text create-ailk wrote to `apps/web/lib/site-chrome.ts` for a resolved
|
|
223
|
+
* layout, before #12477 retired the file. Read only by `look-settings`
|
|
224
|
+
* (#12476), which compares a live site's file to it before the site's look
|
|
225
|
+
* is imported; nothing writes it.
|
|
242
226
|
*/
|
|
243
227
|
export function renderSiteChrome(resolved) {
|
|
244
228
|
// #7719 D3 — each `deckGrounds` line is emitted only when the chrome has one,
|
|
@@ -259,9 +243,8 @@ export function renderSiteChrome(resolved) {
|
|
|
259
243
|
const presentationValue = resolved.deckPresentation === true ? "\n deckPresentation: true," : "";
|
|
260
244
|
// #8773 — the same form: member and bullet always, the value line only for "bare".
|
|
261
245
|
const deckAnchorsValue = resolved.deckAnchors === "bare" ? '\n deckAnchors: "bare",' : "";
|
|
262
|
-
// #7742 D1 — the same form again: member and bullet always, value
|
|
263
|
-
// only for the opt-in
|
|
264
|
-
const colorModeValue = resolved.colorMode === "light" ? '\n colorMode: "light",' : "";
|
|
246
|
+
// #7742 D1 — the same form again: member and bullet always, the value line
|
|
247
|
+
// only for the opt-in value.
|
|
265
248
|
const chromeStyleValue = resolved.chromeStyle === "minimal" ? '\n chromeStyle: "minimal",' : "";
|
|
266
249
|
// #7797 D1 — the same form: member and bullet always, the value line only for a non-empty list.
|
|
267
250
|
const closingFooterPathsValue = resolved.closingFooterPaths === undefined
|
|
@@ -286,8 +269,6 @@ export function renderSiteChrome(resolved) {
|
|
|
286
269
|
// the one-bar footer.
|
|
287
270
|
// - deckPresentation → the deck home presents slide by slide: fitted slides, slide anchors, the mark follows the ground
|
|
288
271
|
// - deckAnchors: "bare" → the presenting deck names its slides #<id> instead of #slide-<id>
|
|
289
|
-
// - colorMode: "light" → the site is pinned to light and shows no theme
|
|
290
|
-
// switch; dark appears only as a deck ground.
|
|
291
272
|
// - chromeStyle: "minimal" → the deck's closing slide is the wordmark,
|
|
292
273
|
// contact lines and one legal line; the consent bar is a hairline bar on
|
|
293
274
|
// the page ground; the 404 renders in the site's theme.
|
|
@@ -295,14 +276,13 @@ export function renderSiteChrome(resolved) {
|
|
|
295
276
|
// (the wordmark, contact lines and legal line) instead of its usual footer.${groundsComment}
|
|
296
277
|
|
|
297
278
|
export interface SiteChrome {
|
|
298
|
-
nav: "
|
|
299
|
-
footer: "
|
|
279
|
+
nav: ${HEADER_STYLES.map((v) => JSON.stringify(v)).join(" | ")};
|
|
280
|
+
footer: ${FOOTER_STYLES.map((v) => JSON.stringify(v)).join(" | ")};
|
|
300
281
|
announcementBanner: boolean;
|
|
301
282
|
home: "default" | "deck";
|
|
302
283
|
innerPages?: "bare";
|
|
303
284
|
deckPresentation?: true;
|
|
304
285
|
deckAnchors?: "bare";
|
|
305
|
-
colorMode?: "light";
|
|
306
286
|
chromeStyle?: "minimal";
|
|
307
287
|
closingFooterPaths?: readonly string[];${groundsMember}
|
|
308
288
|
}
|
|
@@ -311,7 +291,7 @@ export const siteChrome: SiteChrome = {
|
|
|
311
291
|
nav: ${JSON.stringify(resolved.nav)},
|
|
312
292
|
footer: ${JSON.stringify(resolved.footer)},
|
|
313
293
|
announcementBanner: ${JSON.stringify(resolved.announcementBanner)},
|
|
314
|
-
home: ${JSON.stringify(resolved.home)},${groundsValue}${innerPagesValue}${presentationValue}${deckAnchorsValue}${
|
|
294
|
+
home: ${JSON.stringify(resolved.home)},${groundsValue}${innerPagesValue}${presentationValue}${deckAnchorsValue}${chromeStyleValue}${closingFooterPathsValue}
|
|
315
295
|
};
|
|
316
296
|
`;
|
|
317
297
|
}
|
package/dist/site-fonts.d.ts
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The web faces a design's typography sources (#7720, spec
|
|
3
|
-
* docs/specs/7720-a-web-font-source-and-spec.md D3.2)
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* literal options at a module-scope call site, so a face cannot be chosen
|
|
9
|
-
* from the request-time `theme:` block — it is chosen here, at scaffold and
|
|
10
|
-
* apply-design time, as source text. The faces download at the site's
|
|
11
|
-
* `next build` and are served from its own origin, which the CSP's
|
|
12
|
-
* `font-src 'self'` already allows.
|
|
13
|
-
*
|
|
14
|
-
* With no sourced face the render is the empty default, byte-identical to the
|
|
15
|
-
* monorepo's own committed `apps/web/lib/site-fonts.ts`.
|
|
3
|
+
* docs/specs/7720-a-web-font-source-and-spec.md D3.2), as create-ailk wrote
|
|
4
|
+
* them to `apps/web/lib/site-fonts.ts` before #12477 retired the file: a
|
|
5
|
+
* site's faces now come from its hub design record. `renderSiteFonts` is read
|
|
6
|
+
* only by `look-settings` (#12476), which compares a live site's file to it
|
|
7
|
+
* before the site's look is imported; nothing writes it.
|
|
16
8
|
*/
|
|
17
9
|
import type { CompiledDesignFonts } from "./design-compile.js";
|
|
18
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Site-relative path of the retired faces file (#12477): no generator writes
|
|
12
|
+
* it. `update` never records it (`REGENERATED_APP_PATHS`) and removes it only
|
|
13
|
+
* once the hub's read for the site carries its look (D6).
|
|
14
|
+
*/
|
|
19
15
|
export declare const SITE_FONTS_PATH = "apps/web/lib/site-fonts.ts";
|
|
20
16
|
/** Render `apps/web/lib/site-fonts.ts` for `fonts` (D3.2). Ends with a trailing newline. */
|
|
21
17
|
export declare function renderSiteFonts(fonts: CompiledDesignFonts | undefined): string;
|