create-ailk 0.47.0 → 0.48.1
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 +192 -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 +1 -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 +807 -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 +42 -41
- package/dist/site-chrome.js +51 -70
- package/dist/site-fonts.d.ts +14 -14
- package/dist/site-fonts.js +9 -4
- 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 +11 -4
- package/templates/apps/api/CLAUDE.md +6 -4
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +15 -5
- package/templates/apps/mcp/CLAUDE.md +4 -2
- package/templates/apps/web/.env.example +10 -3
- package/templates/apps/web/CLAUDE.md +14 -3
- package/templates/apps/web/app/[locale]/layout.tsx +53 -50
- 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 +179 -31
- package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
- package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +71 -32
- 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-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 +97 -14
- 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 +52 -34
- 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-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 +195 -6
- 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/site-chrome.js
CHANGED
|
@@ -10,16 +10,18 @@
|
|
|
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 as the record of what create-ailk wrote there;
|
|
18
|
+
* `look-settings` (#12476, #12635) reads the values a live site's retired
|
|
19
|
+
* file declares, takes its layout from them and refuses one the layout does
|
|
20
|
+
* not take, before the look is imported.
|
|
17
21
|
*
|
|
18
22
|
* Every field is optional and DEFAULTS to `full` / `columns` / `false` /
|
|
19
23
|
* `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`.
|
|
24
|
+
* (#6469).
|
|
23
25
|
*
|
|
24
26
|
* A design supplies layout knobs too (#6638, widened #6813 D4): its OWN
|
|
25
27
|
* `layout` (a `DesignPackage`'s, read by `design-scaffold.ts`'s
|
|
@@ -29,21 +31,7 @@
|
|
|
29
31
|
* close): an unrecognized design NAME now fails in `resolveDesign`, before
|
|
30
32
|
* this function ever sees one.
|
|
31
33
|
*/
|
|
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
|
-
];
|
|
34
|
+
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
35
|
/** Defaults (#5612 D1; banner off since #6469). */
|
|
48
36
|
export const DEFAULT_SITE_CHROME = {
|
|
49
37
|
nav: "full",
|
|
@@ -51,8 +39,19 @@ export const DEFAULT_SITE_CHROME = {
|
|
|
51
39
|
announcementBanner: false,
|
|
52
40
|
home: "default",
|
|
53
41
|
};
|
|
54
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Site-relative path of the retired layout file (#12477): no generator writes
|
|
44
|
+
* it. `update` never records it (`REGENERATED_APP_PATHS`) and removes it only
|
|
45
|
+
* once the hub's read for the site carries its look (D6).
|
|
46
|
+
*/
|
|
55
47
|
export const SITE_CHROME_PATH = "apps/web/lib/site-chrome.ts";
|
|
48
|
+
/**
|
|
49
|
+
* Layout keys that are no longer settings, each with the reason a layout that
|
|
50
|
+
* carries one is refused (#12500 D3) — refused by name, never silently dropped.
|
|
51
|
+
*/
|
|
52
|
+
export const RETIRED_LAYOUT_KEYS = {
|
|
53
|
+
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",
|
|
54
|
+
};
|
|
56
55
|
/** Thrown by `validateTemplateLayout` on an unrecognized value, naming the field. */
|
|
57
56
|
export class TemplateLayoutError extends Error {
|
|
58
57
|
constructor(message) {
|
|
@@ -60,21 +59,6 @@ export class TemplateLayoutError extends Error {
|
|
|
60
59
|
this.name = "TemplateLayoutError";
|
|
61
60
|
}
|
|
62
61
|
}
|
|
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
62
|
/**
|
|
79
63
|
* Validate an UNTRUSTED `layout` value (a bundle's `ailk-template.json`
|
|
80
64
|
* `layout` field — arbitrary JSON, never compile-time checked the way the
|
|
@@ -95,15 +79,20 @@ export function validateTemplateLayout(value, subject) {
|
|
|
95
79
|
}
|
|
96
80
|
const raw = value;
|
|
97
81
|
const result = {};
|
|
82
|
+
for (const [key, reason] of Object.entries(RETIRED_LAYOUT_KEYS)) {
|
|
83
|
+
if (Object.hasOwn(raw, key)) {
|
|
84
|
+
throw new TemplateLayoutError(`${subject}: layout.${key} ${reason}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
98
87
|
if ("nav" in raw && raw.nav !== undefined) {
|
|
99
|
-
if (!
|
|
100
|
-
throw new TemplateLayoutError(`${subject}: layout.nav must be one of ${
|
|
88
|
+
if (!HEADER_STYLES.includes(raw.nav)) {
|
|
89
|
+
throw new TemplateLayoutError(`${subject}: layout.nav must be one of ${HEADER_STYLES.join(", ")} — got ${JSON.stringify(raw.nav)}`);
|
|
101
90
|
}
|
|
102
91
|
result.nav = raw.nav;
|
|
103
92
|
}
|
|
104
93
|
if ("footer" in raw && raw.footer !== undefined) {
|
|
105
|
-
if (!
|
|
106
|
-
throw new TemplateLayoutError(`${subject}: layout.footer must be one of ${
|
|
94
|
+
if (!FOOTER_STYLES.includes(raw.footer)) {
|
|
95
|
+
throw new TemplateLayoutError(`${subject}: layout.footer must be one of ${FOOTER_STYLES.join(", ")} — got ${JSON.stringify(raw.footer)}`);
|
|
107
96
|
}
|
|
108
97
|
result.footer = raw.footer;
|
|
109
98
|
}
|
|
@@ -124,8 +113,8 @@ export function validateTemplateLayout(value, subject) {
|
|
|
124
113
|
const badIndex = Array.isArray(grounds)
|
|
125
114
|
? grounds.findIndex((g) => !DECK_GROUND_VALUES.includes(g))
|
|
126
115
|
: -1;
|
|
127
|
-
if (!Array.isArray(grounds) || grounds.length === 0 || badIndex !== -1) {
|
|
128
|
-
throw new TemplateLayoutError(`${subject}: layout.deckGrounds must be a
|
|
116
|
+
if (!Array.isArray(grounds) || grounds.length === 0 || grounds.length > DECK_GROUNDS_MAX || badIndex !== -1) {
|
|
117
|
+
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
118
|
}
|
|
130
119
|
result.deckGrounds = grounds;
|
|
131
120
|
}
|
|
@@ -147,12 +136,6 @@ export function validateTemplateLayout(value, subject) {
|
|
|
147
136
|
}
|
|
148
137
|
result.deckAnchors = raw.deckAnchors;
|
|
149
138
|
}
|
|
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
139
|
if ("chromeStyle" in raw && raw.chromeStyle !== undefined) {
|
|
157
140
|
if (!CHROME_STYLE_VALUES.includes(raw.chromeStyle)) {
|
|
158
141
|
throw new TemplateLayoutError(`${subject}: layout.chromeStyle must be one of ${CHROME_STYLE_VALUES.join(", ")} — got ${JSON.stringify(raw.chromeStyle)}`);
|
|
@@ -162,10 +145,16 @@ export function validateTemplateLayout(value, subject) {
|
|
|
162
145
|
if ("closingFooterPaths" in raw && raw.closingFooterPaths !== undefined) {
|
|
163
146
|
const paths = raw.closingFooterPaths;
|
|
164
147
|
const badIndex = Array.isArray(paths)
|
|
165
|
-
? paths.findIndex((p) => typeof p !== "string" ||
|
|
148
|
+
? paths.findIndex((p) => typeof p !== "string" ||
|
|
149
|
+
p.length > CLOSING_FOOTER_PATH_MAX ||
|
|
150
|
+
!CLOSING_FOOTER_PATH_REGEX.test(p) ||
|
|
151
|
+
p.split("/").filter(Boolean).length > CLOSING_FOOTER_PATH_SEGMENTS_MAX)
|
|
166
152
|
: -1;
|
|
167
|
-
if (
|
|
168
|
-
throw new TemplateLayoutError(`${subject}: layout.closingFooterPaths must be a
|
|
153
|
+
if (badIndex !== -1) {
|
|
154
|
+
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])}`);
|
|
155
|
+
}
|
|
156
|
+
if (!Array.isArray(paths) || paths.length === 0 || paths.length > CLOSING_FOOTER_PATHS_MAX) {
|
|
157
|
+
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
158
|
}
|
|
170
159
|
result.closingFooterPaths = paths;
|
|
171
160
|
}
|
|
@@ -219,9 +208,6 @@ export function resolveSiteChrome(layout, designLayout) {
|
|
|
219
208
|
resolved.deckAnchors = "bare";
|
|
220
209
|
}
|
|
221
210
|
// #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
211
|
if ((layout?.chromeStyle ?? fromDesign.chromeStyle) === "minimal") {
|
|
226
212
|
resolved.chromeStyle = "minimal";
|
|
227
213
|
}
|
|
@@ -234,11 +220,10 @@ export function resolveSiteChrome(layout, designLayout) {
|
|
|
234
220
|
return resolved;
|
|
235
221
|
}
|
|
236
222
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* `snap="mandatory"` + `deckHero` to MarketingShell.
|
|
223
|
+
* The text create-ailk wrote to `apps/web/lib/site-chrome.ts` for a resolved
|
|
224
|
+
* layout, before #12477 retired the file; nothing writes it. `look-settings`
|
|
225
|
+
* compares the values a site's file declares, never its text (#12635): each
|
|
226
|
+
* release changed the `SiteChrome` type header above them.
|
|
242
227
|
*/
|
|
243
228
|
export function renderSiteChrome(resolved) {
|
|
244
229
|
// #7719 D3 — each `deckGrounds` line is emitted only when the chrome has one,
|
|
@@ -259,9 +244,8 @@ export function renderSiteChrome(resolved) {
|
|
|
259
244
|
const presentationValue = resolved.deckPresentation === true ? "\n deckPresentation: true," : "";
|
|
260
245
|
// #8773 — the same form: member and bullet always, the value line only for "bare".
|
|
261
246
|
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",' : "";
|
|
247
|
+
// #7742 D1 — the same form again: member and bullet always, the value line
|
|
248
|
+
// only for the opt-in value.
|
|
265
249
|
const chromeStyleValue = resolved.chromeStyle === "minimal" ? '\n chromeStyle: "minimal",' : "";
|
|
266
250
|
// #7797 D1 — the same form: member and bullet always, the value line only for a non-empty list.
|
|
267
251
|
const closingFooterPathsValue = resolved.closingFooterPaths === undefined
|
|
@@ -286,8 +270,6 @@ export function renderSiteChrome(resolved) {
|
|
|
286
270
|
// the one-bar footer.
|
|
287
271
|
// - deckPresentation → the deck home presents slide by slide: fitted slides, slide anchors, the mark follows the ground
|
|
288
272
|
// - 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
273
|
// - chromeStyle: "minimal" → the deck's closing slide is the wordmark,
|
|
292
274
|
// contact lines and one legal line; the consent bar is a hairline bar on
|
|
293
275
|
// the page ground; the 404 renders in the site's theme.
|
|
@@ -295,14 +277,13 @@ export function renderSiteChrome(resolved) {
|
|
|
295
277
|
// (the wordmark, contact lines and legal line) instead of its usual footer.${groundsComment}
|
|
296
278
|
|
|
297
279
|
export interface SiteChrome {
|
|
298
|
-
nav: "
|
|
299
|
-
footer: "
|
|
280
|
+
nav: ${HEADER_STYLES.map((v) => JSON.stringify(v)).join(" | ")};
|
|
281
|
+
footer: ${FOOTER_STYLES.map((v) => JSON.stringify(v)).join(" | ")};
|
|
300
282
|
announcementBanner: boolean;
|
|
301
283
|
home: "default" | "deck";
|
|
302
284
|
innerPages?: "bare";
|
|
303
285
|
deckPresentation?: true;
|
|
304
286
|
deckAnchors?: "bare";
|
|
305
|
-
colorMode?: "light";
|
|
306
287
|
chromeStyle?: "minimal";
|
|
307
288
|
closingFooterPaths?: readonly string[];${groundsMember}
|
|
308
289
|
}
|
|
@@ -311,7 +292,7 @@ export const siteChrome: SiteChrome = {
|
|
|
311
292
|
nav: ${JSON.stringify(resolved.nav)},
|
|
312
293
|
footer: ${JSON.stringify(resolved.footer)},
|
|
313
294
|
announcementBanner: ${JSON.stringify(resolved.announcementBanner)},
|
|
314
|
-
home: ${JSON.stringify(resolved.home)},${groundsValue}${innerPagesValue}${presentationValue}${deckAnchorsValue}${
|
|
295
|
+
home: ${JSON.stringify(resolved.home)},${groundsValue}${innerPagesValue}${presentationValue}${deckAnchorsValue}${chromeStyleValue}${closingFooterPathsValue}
|
|
315
296
|
};
|
|
316
297
|
`;
|
|
317
298
|
}
|
package/dist/site-fonts.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
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
|
-
*
|
|
9
|
-
*
|
|
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. Nothing writes the file:
|
|
6
|
+
* `renderSiteFonts` is the record of what create-ailk wrote, and
|
|
7
|
+
* `look-settings` (#12476, #12635) reads the faces a live site's file
|
|
8
|
+
* declares, by `fontExportName`, and compares them with the faces its
|
|
9
|
+
* settings compile to before the site's look is imported.
|
|
16
10
|
*/
|
|
17
11
|
import type { CompiledDesignFonts } from "./design-compile.js";
|
|
18
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Site-relative path of the retired faces file (#12477): no generator writes
|
|
14
|
+
* it. `update` never records it (`REGENERATED_APP_PATHS`) and removes it only
|
|
15
|
+
* once the hub's read for the site carries its look (D6).
|
|
16
|
+
*/
|
|
19
17
|
export declare const SITE_FONTS_PATH = "apps/web/lib/site-fonts.ts";
|
|
18
|
+
/** The `next/font/google` export that loads `family`: its spaces become underscores. */
|
|
19
|
+
export declare const fontExportName: (family: string) => string;
|
|
20
20
|
/** Render `apps/web/lib/site-fonts.ts` for `fonts` (D3.2). Ends with a trailing newline. */
|
|
21
21
|
export declare function renderSiteFonts(fonts: CompiledDesignFonts | undefined): string;
|
package/dist/site-fonts.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Site-relative path of the retired faces file (#12477): no generator writes
|
|
3
|
+
* it. `update` never records it (`REGENERATED_APP_PATHS`) and removes it only
|
|
4
|
+
* once the hub's read for the site carries its look (D6).
|
|
5
|
+
*/
|
|
2
6
|
export const SITE_FONTS_PATH = "apps/web/lib/site-fonts.ts";
|
|
3
7
|
const HEADER = `// site-fonts.ts — the web faces the site's design sources.
|
|
4
8
|
//
|
|
@@ -14,6 +18,8 @@ const INTERFACE = `export interface SiteFonts {
|
|
|
14
18
|
families: { display?: string | undefined; body?: string | undefined };
|
|
15
19
|
}
|
|
16
20
|
`;
|
|
21
|
+
/** The `next/font/google` export that loads `family`: its spaces become underscores. */
|
|
22
|
+
export const fontExportName = (family) => family.replace(/ /g, "_");
|
|
17
23
|
/** Render `apps/web/lib/site-fonts.ts` for `fonts` (D3.2). Ends with a trailing newline. */
|
|
18
24
|
export function renderSiteFonts(fonts) {
|
|
19
25
|
const faces = ["display", "body"].flatMap((role) => {
|
|
@@ -29,9 +35,8 @@ export function renderSiteFonts(fonts) {
|
|
|
29
35
|
if (!slotOf.has(face.family))
|
|
30
36
|
slotOf.set(face.family, role);
|
|
31
37
|
}
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const loaders = [...slotOf].map(([family, slot]) => `const ${slot}Face = ${exportName(family)}({ subsets: ${JSON.stringify(["latin"])}, variable: ${JSON.stringify(`--font-design-${slot}`)} });`);
|
|
38
|
+
const imports = [...slotOf.keys()].map(fontExportName).sort();
|
|
39
|
+
const loaders = [...slotOf].map(([family, slot]) => `const ${slot}Face = ${fontExportName(family)}({ subsets: ${JSON.stringify(["latin"])}, variable: ${JSON.stringify(`--font-design-${slot}`)} });`);
|
|
35
40
|
const className = [...slotOf.values()].map((slot) => `${slot}Face.variable`).join(", ");
|
|
36
41
|
const families = faces.map(({ role, face }) => {
|
|
37
42
|
const slot = slotOf.get(face.family) ?? role;
|
package/dist/starter-grid.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import type { CategorySlug } from "./category-profile.js";
|
|
18
18
|
import type { ModuleName } from "./parse-args.js";
|
|
19
19
|
import type { TemplateLayout } from "./site-chrome.js";
|
|
20
|
-
import type {
|
|
20
|
+
import type { StarterShape, TemplateRosterRow } from "./template-manifest.js";
|
|
21
21
|
/**
|
|
22
22
|
* The roster routes a hub keeps (#10040): the sign-in pair and the three legal
|
|
23
23
|
* pages. Declared here, beside the rosters they are cut from, so this file
|
|
@@ -55,7 +55,7 @@ export interface AliasDifferences {
|
|
|
55
55
|
*/
|
|
56
56
|
export interface TemplateAlias {
|
|
57
57
|
readonly shape: BuildableShape;
|
|
58
|
-
readonly design:
|
|
58
|
+
readonly design: string;
|
|
59
59
|
/** Becomes the manifest's `requires`. */
|
|
60
60
|
readonly modules: readonly ModuleName[];
|
|
61
61
|
readonly categories: readonly CategorySlug[];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** The branch an `--apply` on the default branch creates, before its date. */
|
|
2
|
+
export declare const LOOK_COPY_IMPORT_BRANCH_PREFIX = "look-copy-import/";
|
|
3
|
+
/** A refusal the CLI exits 2 on, thrown before any write. */
|
|
4
|
+
export declare class StripLookCopiesRefusedError extends Error {
|
|
5
|
+
readonly exitCode = 2;
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export interface StripLookCopiesOptions {
|
|
9
|
+
/** The site. */
|
|
10
|
+
targetDir: string;
|
|
11
|
+
/** `--apply`: write. Without it nothing is written. */
|
|
12
|
+
apply?: boolean;
|
|
13
|
+
/** `--api-url`. */
|
|
14
|
+
apiUrl?: string | undefined;
|
|
15
|
+
/** `--workspace`. */
|
|
16
|
+
workspaceId?: string | undefined;
|
|
17
|
+
/** create-ailk's `component-catalog.json` (cli.ts passes it from its package root). */
|
|
18
|
+
catalogPath: string;
|
|
19
|
+
/** Injectable for tests; defaults to `process.env`. */
|
|
20
|
+
env?: NodeJS.ProcessEnv;
|
|
21
|
+
/** Injectable for tests; defaults to `globalThis.fetch`. */
|
|
22
|
+
fetch?: typeof globalThis.fetch;
|
|
23
|
+
/** Injectable for tests: the date the import branch is named for. */
|
|
24
|
+
now?: Date;
|
|
25
|
+
/** Each report line as it happens; defaults to nothing. */
|
|
26
|
+
onLine?: (line: string) => void;
|
|
27
|
+
}
|
|
28
|
+
/** One look copy: the `data` entry `field` of section `index` of a page. */
|
|
29
|
+
export interface LookCopy {
|
|
30
|
+
readonly path: string;
|
|
31
|
+
readonly index: number;
|
|
32
|
+
readonly sectionType: string;
|
|
33
|
+
readonly field: string;
|
|
34
|
+
}
|
|
35
|
+
export interface KeptLookCopy {
|
|
36
|
+
readonly path: string;
|
|
37
|
+
/** `edited`: the entry changed since the file's first commit. `section`: the look sets a field the section lacks, or every entry is a copy. `no-commit`: no commit holds the file. `unreadable`: its sections cannot be located. */
|
|
38
|
+
readonly reason: "edited" | "section" | "no-commit" | "unreadable";
|
|
39
|
+
readonly index?: number;
|
|
40
|
+
readonly sectionType?: string;
|
|
41
|
+
readonly field?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface StripLookCopiesResult {
|
|
44
|
+
readonly removed: LookCopy[];
|
|
45
|
+
readonly kept: KeptLookCopy[];
|
|
46
|
+
/** `--apply`: the site-relative files written. */
|
|
47
|
+
readonly written: string[];
|
|
48
|
+
/** `--apply` with something to remove: the branch the files were written on. */
|
|
49
|
+
readonly branch?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether a look may set a field, read from its JSON Schema in the catalog —
|
|
53
|
+
* the rule `@working-theory/validation` applies to the zod schema (#12474 D7),
|
|
54
|
+
* which create-ailk cannot import: an enum, a const or a union of consts, a
|
|
55
|
+
* boolean, or a number with both ends and a maximum of at most 10 000.
|
|
56
|
+
*/
|
|
57
|
+
export declare function lookSettable(schema: unknown): boolean;
|
|
58
|
+
export declare function stripLookCopies(opts: StripLookCopiesOptions): Promise<StripLookCopiesResult>;
|
|
59
|
+
export interface StripLookCopiesArgs {
|
|
60
|
+
target: string | undefined;
|
|
61
|
+
apply: boolean;
|
|
62
|
+
apiUrl: string | undefined;
|
|
63
|
+
workspaceId: string | undefined;
|
|
64
|
+
help: boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare const STRIP_LOOK_COPIES_HELP = "create-ailk strip-look-copies \u2014 remove from a site's page files the section look values its look already sets.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk strip-look-copies [<dir>] [--apply] [--api-url <origin>] [--workspace <wksp_id>]\n\nArguments:\n <dir> The site, inside a git work tree. Defaults to the\n current dir.\n\nOptions:\n --apply Write the files. Without it the command prints what\n it would remove and writes nothing.\n --api-url <origin> The API origin that holds the workspace \u2014 on a\n spoke, its hub's. Else AILK_API_URL. https: only\n (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace whose look is read. Else\n AILK_WORKSPACE_ID.\n -h, --help Show this help.\n\nThe look is the workspace design's worked-out section settings, read with the\nagent key from AILK_AGENT_KEY only. The site's own read of it,\nGET /v1/content/site-config, is sent on a spoke with AILK_SPOKE_KEY when it\nis set, and keyless otherwise, and must carry the same design version and\nsection settings; else the command refuses. On a spoke, a workspace or origin\nother than the one its apps/web/.env or .env.local names is refused. No key is\nprinted.\n\nA section entry in a content/ page (not _site.mdx) is removed when its field\nis a look field of its section type, the look sets it to the same value, the\nlook sets no field the section lacks, and the entry is unchanged in every\ncommit of the file since the one that added it. Any other entry stays: a\nvalue that differs, one a commit changed (listed as edited), a section the\nlook would add a field to (listed as kept), a file no commit holds. Only the\nentry and one separator are removed; every other byte stays.\n\nThe dry run prints one line per removal, <path>: <sectionType>.<field> (no\nvalues), and a total. --apply refuses a dirty work tree; on the default\nbranch (main, master, or the one origin/HEAD names) it first creates and\nswitches to look-copy-import/<YYYYMMDD>; then it writes the files and prints\nthe next steps. It never commits, pushes or opens a pull request. A second\nrun reports nothing to remove. Exit 0 on success, 2 on a refusal (nothing is\nwritten).\n";
|
|
67
|
+
export declare function parseStripLookCopiesArgs(argv: string[]): StripLookCopiesArgs;
|