@astryxdesign/cli 0.7.17 → 0.7.18-canary.g32556bb
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 +1 -1
- package/api/discover/_adapter.d.mts +7 -5
- package/api/discover/_adapter.mjs +12 -11
- package/api/docs/_adapter.d.mts +19 -2
- package/api/docs/_adapter.mjs +66 -5
- package/api/doctor/_adapter.d.mts +11 -62
- package/api/doctor/_adapter.mjs +242 -472
- package/api/doctor/doctor.d.mts +1 -1
- package/api/doctor/doctor.mjs +3 -3
- package/api/doctor/theme-checks.mjs +37 -45
- package/api/error.d.mts +21 -0
- package/api/error.mjs +89 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/icon/_adapter.d.mts +8 -0
- package/api/icon/_adapter.mjs +17 -0
- package/api/icon/_authoring.mjs +6 -6
- package/api/icon/_default-look.mjs +16 -16
- package/api/icon/add/add.mjs +3 -3
- package/api/icon/exportIconIndex.doc.mjs +2 -2
- package/api/icon/icon.doc.mjs +2 -2
- package/api/icon/icon.type.d.mts +4 -0
- package/api/icon/icon.type.mjs +2 -1
- package/api/icon/search/icon-index.mjs +16 -3
- package/api/icon/search/search.d.mts +15 -5
- package/api/icon/search/search.mjs +74 -16
- package/api/icon/use/use.mjs +4 -4
- package/api/render/_adapter.mjs +233 -40
- package/api/render/render.type.d.mts +1 -1
- package/api/render/render.type.mjs +1 -1
- package/api/search/ORDERING.md +2 -2
- package/api/search/_adapter.mjs +4 -0
- package/api/search/_candidate-score.mjs +32 -8
- package/api/search/_cards.json +1 -1
- package/api/search/_compound.d.mts +0 -1
- package/api/search/_compound.mjs +93 -2
- package/api/search/_icons.d.mts +4 -2
- package/api/search/_icons.mjs +4 -2
- package/api/search/_lexical.mjs +177 -17
- package/api/search/_order.d.mts +3 -1
- package/api/search/_order.mjs +16 -5
- package/api/search/_result.d.mts +9 -0
- package/api/search/_result.mjs +10 -0
- package/api/search/_score.mjs +21 -3
- package/api/swizzle/_moduleGraph.d.mts +8 -0
- package/api/swizzle/_moduleGraph.mjs +61 -3
- package/api/template/copy/copy.mjs +5 -3
- package/api/template/template.type.d.mts +3 -3
- package/api/template/template.type.mjs +3 -3
- package/api/theme/_adapter.mjs +48 -12
- package/api/theme/build/build.d.mts +4 -0
- package/api/theme/build/build.mjs +69 -18
- package/api/theme/build/style-keys.mjs +4 -5
- package/api/theme/build/theme-object.mjs +5 -0
- package/api/theme/palette/generate/color.d.mts +47 -0
- package/api/theme/palette/generate/color.mjs +58 -1
- package/api/theme/palette/generate/derive-look.d.mts +293 -0
- package/api/theme/palette/generate/derive-look.mjs +1362 -0
- package/api/theme/palette/generate/editor-look.d.mts +62 -0
- package/api/theme/palette/generate/editor-look.mjs +550 -0
- package/api/theme/palette/generate/mapping.d.mts +94 -9
- package/api/theme/palette/generate/mapping.mjs +94 -22
- package/api/theme-edit/_adapter.mjs +13 -2
- package/api/theme-edit/_catalog.d.mts +13 -13
- package/api/theme-edit/_catalog.mjs +66 -28
- package/api/theme-edit/_check.d.mts +82 -6
- package/api/theme-edit/_check.mjs +1270 -238
- package/api/theme-edit/_color.d.mts +74 -0
- package/api/theme-edit/_color.mjs +168 -3
- package/api/theme-edit/_compiler.d.mts +3 -5
- package/api/theme-edit/_compiler.mjs +122 -23
- package/api/theme-edit/_context.d.mts +55 -12
- package/api/theme-edit/_context.mjs +114 -60
- package/api/theme-edit/_css.d.mts +11 -0
- package/api/theme-edit/_css.mjs +40 -0
- package/api/theme-edit/_edit.d.mts +15 -2
- package/api/theme-edit/_edit.mjs +1469 -133
- package/api/theme-edit/_how-commands.d.mts +116 -0
- package/api/theme-edit/_how-commands.mjs +227 -115
- package/api/theme-edit/_how-question.d.mts +74 -29
- package/api/theme-edit/_how-question.mjs +8514 -1256
- package/api/theme-edit/_how-sides.d.mts +22 -0
- package/api/theme-edit/_how-sides.mjs +173 -0
- package/api/theme-edit/_how-steps.d.mts +42 -0
- package/api/theme-edit/_how-steps.mjs +208 -0
- package/api/theme-edit/_how-values.d.mts +29 -0
- package/api/theme-edit/_how-values.mjs +111 -0
- package/api/theme-edit/_how-words.d.mts +15 -0
- package/api/theme-edit/_how-words.mjs +239 -0
- package/api/theme-edit/_how.d.mts +1 -1
- package/api/theme-edit/_how.mjs +422 -37
- package/api/theme-edit/_missed.d.mts +2 -1
- package/api/theme-edit/_missed.mjs +125 -13
- package/api/theme-edit/_normal.d.mts +5 -3
- package/api/theme-edit/_normal.mjs +54 -14
- package/api/theme-edit/_palette.d.mts +204 -4
- package/api/theme-edit/_palette.mjs +901 -25
- package/api/theme-edit/_part-pieces.d.mts +54 -0
- package/api/theme-edit/_part-pieces.mjs +179 -0
- package/api/theme-edit/_part-words.mjs +33 -5
- package/api/theme-edit/_parts.d.mts +133 -0
- package/api/theme-edit/_parts.mjs +599 -10
- package/api/theme-edit/_picture-traits.d.mts +259 -0
- package/api/theme-edit/_picture-traits.mjs +1030 -0
- package/api/theme-edit/_preview.d.mts +95 -4
- package/api/theme-edit/_preview.mjs +284 -31
- package/api/theme-edit/_project.d.mts +14 -4
- package/api/theme-edit/_project.mjs +95 -26
- package/api/theme-edit/_resolved.d.mts +46 -0
- package/api/theme-edit/_resolved.mjs +800 -0
- package/api/theme-edit/_set-line.d.mts +29 -0
- package/api/theme-edit/_set-line.mjs +100 -0
- package/api/theme-edit/_settings.d.mts +625 -28
- package/api/theme-edit/_settings.mjs +4867 -888
- package/api/theme-edit/_tables.d.mts +25 -1
- package/api/theme-edit/_tables.mjs +115 -11
- package/api/theme-edit/_text-looks.d.mts +78 -0
- package/api/theme-edit/_text-looks.mjs +376 -0
- package/api/theme-edit/_vet.d.mts +3 -26
- package/api/theme-edit/_vet.mjs +5 -89
- package/api/theme-edit/how/how.d.mts +1 -1
- package/api/theme-edit/how/how.mjs +1 -1
- package/api/theme-edit/show/show.d.mts +4 -3
- package/api/theme-edit/show/show.mjs +3 -2
- package/api/theme-edit/theme-edit.type.d.mts +117 -1
- package/api/theme-edit/theme-edit.type.mjs +46 -3
- package/api/theme-edit/themeEditHow.doc.mjs +3 -3
- package/api/theme-edit/themeEditNew.doc.mjs +4 -0
- package/api/theme-edit/themeEditSet.doc.mjs +6 -2
- package/api/theme-edit/themeEditShow.doc.mjs +22 -3
- package/api/theme-edit/themeEditUndo.doc.mjs +4 -0
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/author-a-theme.doc.mjs +7 -4
- package/assets/docs/icons.doc.mjs +7 -6
- package/assets/docs/theme.doc.dense.mjs +10 -0
- package/assets/docs/theme.doc.mjs +10 -0
- package/assets/docs/theme.doc.zh.mjs +10 -0
- package/assets/docs/tree/export-pages.doc.mjs +1 -1
- package/assets/docs/tree/icon-sets.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +89 -17
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/definitions/article.doc.mjs +9 -0
- package/assets/icons/template-icons.json +5 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationInlineText.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationShowcase.tsx +3 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.doc.mjs +1 -1
- package/assets/templates/blocks/components/Citation/CitationSourceList.tsx +7 -3
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.doc.mjs +1 -1
- package/assets/templates/blocks/components/Markdown/MarkdownCitedContent.tsx +5 -2
- package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +9 -1
- package/assets/templates/blocks/components/SideNavCollapseButton/SideNavCollapseButtonShowcase.doc.mjs +9 -2
- package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.doc.mjs +3 -2
- package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -1
- package/assets/templates/blocks/components/SideNavItem/SideNavItemShowcase.doc.mjs +3 -2
- package/assets/templates/blocks/components/SideNavSection/SideNavSectionShowcase.doc.mjs +2 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ide/page.tsx +5 -10
- package/assets/templates/pages/payment-form/page.tsx +16 -60
- package/assets/templates/themes/neutral/neutralTheme.ts +4 -3
- package/authoring/config/parse.mjs +1 -1
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +13 -13
- package/authoring/doctypes/icon-definition/parse.mjs +2 -2
- package/authoring/doctypes/icon-set/parse.mjs +1 -1
- package/authoring/doctypes/template/parse.mjs +1 -4
- package/authoring/gap-report/parse.d.mts +1 -1
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/ensure-core-built.mjs +17 -10
- package/clients/cli/commands/experimental/icon.mjs +7 -7
- package/clients/cli/commands/experimental/theme.mjs +175 -13
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +11 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +15 -5
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/hook.mjs +7 -0
- package/clients/cli/commands/template.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/index.mjs +6 -2
- package/clients/cli/lib/hook-format.mjs +41 -1
- package/clients/cli/lib/json-shim.mjs +34 -14
- package/clients/cli/lib/other-cli-words.mjs +7 -0
- package/clients/cli/lib/unknown-command.mjs +345 -46
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +11 -2
- package/foundation/agent-docs/agent-docs.mjs +51 -8
- package/foundation/config/project.d.mts +11 -1
- package/foundation/config/project.mjs +11 -2
- package/foundation/discovery/component-replacement.d.mts +5 -8
- package/foundation/discovery/component-replacement.mjs +12 -14
- package/foundation/discovery/core-augmentation-points.d.mts +35 -0
- package/foundation/discovery/core-augmentation-points.mjs +410 -9
- package/foundation/discovery/core-elements.d.mts +6 -0
- package/foundation/discovery/core-elements.mjs +10 -2
- package/foundation/discovery/core-prop-types.d.mts +5 -0
- package/foundation/discovery/core-prop-types.mjs +10 -3
- package/foundation/discovery/core-props.d.mts +8 -0
- package/foundation/discovery/core-props.mjs +29 -13
- package/foundation/discovery/icon-ranking.d.mts +5 -2
- package/foundation/discovery/icon-ranking.mjs +101 -18
- package/foundation/discovery/icon-set-checks.mjs +1 -1
- package/foundation/discovery/icon-set-writer.mjs +1 -1
- package/foundation/discovery/official-list.d.mts +17 -0
- package/foundation/discovery/official-list.mjs +77 -0
- package/foundation/discovery/template-icon-notes.mjs +3 -3
- package/foundation/discovery/template-icons.mjs +2 -2
- package/foundation/discovery/template-placeholders.mjs +1 -1
- package/foundation/discovery/unknown-core-props.d.mts +130 -0
- package/foundation/discovery/unknown-core-props.mjs +601 -0
- package/foundation/discovery/written-prop-values.d.mts +35 -0
- package/foundation/discovery/written-prop-values.mjs +258 -0
- package/foundation/fonts/fontsource-families.generated.d.mts +5 -0
- package/foundation/fonts/fontsource-families.generated.mjs +2110 -0
- package/foundation/fs/package-name.d.mts +10 -0
- package/foundation/fs/package-name.mjs +37 -0
- package/foundation/fs/project-source-files.d.mts +27 -0
- package/foundation/fs/project-source-files.mjs +115 -0
- package/foundation/fs/project-sources.d.mts +25 -0
- package/foundation/fs/project-sources.mjs +83 -0
- package/foundation/fs/read-record.d.mts +18 -0
- package/foundation/fs/read-record.mjs +36 -2
- package/foundation/integrations/integration-warnings.d.mts +39 -7
- package/foundation/integrations/integration-warnings.mjs +141 -19
- package/foundation/integrations/missing-dependency.d.mts +11 -0
- package/foundation/integrations/missing-dependency.mjs +20 -5
- package/foundation/release/folder-lock.d.mts +5 -2
- package/foundation/release/folder-lock.mjs +9 -3
- package/foundation/release/notices.mjs +2 -8
- package/foundation/render/cut-short.d.mts +8 -2
- package/foundation/render/cut-short.mjs +50 -5
- package/foundation/render/drawn-contrast.d.mts +40 -0
- package/foundation/render/drawn-contrast.mjs +355 -0
- package/foundation/render/file-header.mjs +4 -0
- package/foundation/render/layers.d.mts +2 -1
- package/foundation/render/layers.mjs +22 -1
- package/foundation/render/package-resolve-hooks.d.mts +38 -9
- package/foundation/render/package-resolve-hooks.mjs +124 -32
- package/foundation/render/page-worker.mjs +95 -23
- package/foundation/render/part-boxes.d.mts +27 -0
- package/foundation/render/part-boxes.mjs +45 -0
- package/foundation/render/picture-chrome.mjs +36 -4
- package/foundation/render/picture-playwright.mjs +26 -2
- package/foundation/render/picture-window.d.mts +29 -2
- package/foundation/render/picture-window.mjs +99 -1
- package/foundation/render/render-page.d.mts +39 -6
- package/foundation/render/render-page.mjs +26 -10
- package/foundation/render/ts-paths.mjs +2 -1
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/error-codes.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +9 -5
- package/foundation/suggest/other-command.mjs +25 -1
- package/foundation/text/icon-set-next.d.mts +1 -1
- package/foundation/text/icon-set-next.mjs +2 -2
- package/foundation/text/written-string.d.mts +4 -1
- package/foundation/text/written-string.mjs +4 -1
- package/package.json +8 -7
|
@@ -41,12 +41,13 @@ export function context(cwd: string): Promise<{
|
|
|
41
41
|
checkTokenOn: (theme: string, target: string, token: string, value: string, P: string, when?: string, also?: string) => CheckFailure | null;
|
|
42
42
|
checkTokenGlobal: (token: string, _P: string) => CheckFailure | null;
|
|
43
43
|
variantValues: (target: string) => Record<string, string[]>;
|
|
44
|
-
contrast: (value: (pair: TextPair, side: "fg" | "bg", mode: string) => string | null | undefined, baseValue: (pair: TextPair, side: "fg" | "bg", mode: string) => string | null | undefined, modes: string[], { parseColor, ratio, alphaOf, compositeOver, page }: {
|
|
44
|
+
contrast: (value: (pair: TextPair, side: "fg" | "bg", mode: string) => string | null | undefined, baseValue: (pair: TextPair, side: "fg" | "bg", mode: string) => string | null | undefined, modes: string[], { parseColor, ratio, alphaOf, compositeOver, page, drawnByRule, }: {
|
|
45
45
|
parseColor: (v: unknown) => [number, number, number] | null;
|
|
46
46
|
ratio: (a: number[], b: number[]) => number;
|
|
47
47
|
alphaOf: (v: unknown) => number;
|
|
48
48
|
compositeOver: (over: [number, number, number], alpha: number, under: [number, number, number]) => [number, number, number];
|
|
49
49
|
page: (mode: string) => string | null | undefined;
|
|
50
|
+
drawnByRule?: (pair: TextPair, side: "fg" | "bg", mode: string) => boolean;
|
|
50
51
|
}, extra?: TextPair[]) => {
|
|
51
52
|
problems: {
|
|
52
53
|
part: string;
|
|
@@ -129,6 +130,12 @@ export function cutShortProblem(ctx: import("./_settings.mjs").Ctx, slug: string
|
|
|
129
130
|
problem: string;
|
|
130
131
|
fix: string | null;
|
|
131
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* Text a picture draws too faint to read, as the browser measured it: the
|
|
135
|
+
* part it sits in, its text, the mode, its ratio and its two colors, and
|
|
136
|
+
* the page (`page`, null for a sheet) and picture it is on.
|
|
137
|
+
* @typedef {{page: string | null, file: string, part: string, text: string, mode: 'light' | 'dark', ratio: number, fg: string, bg: string}} LowContrast
|
|
138
|
+
*/
|
|
132
139
|
/**
|
|
133
140
|
* Pictures of HTML files, on request. A shot with a `name` is a page laid
|
|
134
141
|
* out so its text fits in the base theme (the sample page): the text its
|
|
@@ -136,13 +143,17 @@ export function cutShortProblem(ctx: import("./_settings.mjs").Ctx, slug: string
|
|
|
136
143
|
* `cutShort`, one entry for each part on each page ({@link cutShortNote},
|
|
137
144
|
* {@link cutShortProblem}). The sheets (the open
|
|
138
145
|
* states among them) have no name: their cells are narrow, and the full
|
|
139
|
-
* sheet cuts long labels short in every theme
|
|
146
|
+
* sheet cuts long labels short in every theme, so from a sheet only text
|
|
147
|
+
* drawn over the text beside it comes back.
|
|
140
148
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
141
149
|
* @param {Array<{html: string, png: string, name?: string, most?: number}>} shots
|
|
142
150
|
* `most`: the tallest the page's picture may be; a taller one is cut into
|
|
143
151
|
* pictures that tall, in order ({@link pagesOfPicture})
|
|
144
152
|
* @param {Array<'light' | 'dark'>} modes
|
|
145
|
-
*
|
|
153
|
+
* Every picture also measures the text it draws too faint to read
|
|
154
|
+
* (`lowContrast`): one entry for each part, text, pair of colors and mode,
|
|
155
|
+
* with the page it is on.
|
|
156
|
+
* @returns {Promise<{files: string[], problem: string | null, cutShort: CutShort[], lowContrast: LowContrast[]}>}
|
|
146
157
|
*/
|
|
147
158
|
export function pictures(project: import("./_project.mjs").ThemeProject, shots: Array<{
|
|
148
159
|
html: string;
|
|
@@ -153,6 +164,7 @@ export function pictures(project: import("./_project.mjs").ThemeProject, shots:
|
|
|
153
164
|
files: string[];
|
|
154
165
|
problem: string | null;
|
|
155
166
|
cutShort: CutShort[];
|
|
167
|
+
lowContrast: LowContrast[];
|
|
156
168
|
}>;
|
|
157
169
|
/**
|
|
158
170
|
* The families the theme's build writes that no package loads: not a
|
|
@@ -179,6 +191,18 @@ export function familiesNothingLoads(ctx: import("./_settings.mjs").Ctx, data: i
|
|
|
179
191
|
* @returns {string[]}
|
|
180
192
|
*/
|
|
181
193
|
export function themeImageNotes(ctx: import("./_settings.mjs").Ctx, slug: string): string[];
|
|
194
|
+
/**
|
|
195
|
+
* The open fonts a set's families name whose package is not installed, each
|
|
196
|
+
* with the line that installs it: until then the pictures and the app draw
|
|
197
|
+
* the next font in the stack.
|
|
198
|
+
* @param {import('./_settings.mjs').Ctx} ctx
|
|
199
|
+
* @param {import('./_settings.mjs').ThemeData} data
|
|
200
|
+
* @returns {Array<{family: string, run: string[]}>}
|
|
201
|
+
*/
|
|
202
|
+
export function fontsNotLoaded(ctx: import("./_settings.mjs").Ctx, data: import("./_settings.mjs").ThemeData): Array<{
|
|
203
|
+
family: string;
|
|
204
|
+
run: string[];
|
|
205
|
+
}>;
|
|
182
206
|
/**
|
|
183
207
|
* Font notes for the families the theme builds: the import line for an
|
|
184
208
|
* open font, the install line when its package is missing, and a warning
|
|
@@ -223,10 +247,11 @@ export function baseWeightNotes(ctx: import("./_settings.mjs").Ctx, data: import
|
|
|
223
247
|
export function styledChanges(before: any, after: any, base?: any, drawn?: (target: string, prop: string) => string | null): string[];
|
|
224
248
|
/**
|
|
225
249
|
* The line that says which pictures to open after a run that took them:
|
|
226
|
-
* each family of components' first ({@link familyPages}), then the
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
250
|
+
* each family of components' first ({@link familyPages}), then the pages
|
|
251
|
+
* section's (the sample app and each page template, cut between pages),
|
|
252
|
+
* then the sample page's and the open states' (every menu, tooltip, popover
|
|
253
|
+
* and list drawn open), of the mode shown first (light when the theme has
|
|
254
|
+
* both). Null when this run took none of them.
|
|
230
255
|
* @param {string[]} files the pictures taken, as shown (`themes/t/preview.png`)
|
|
231
256
|
* @returns {string | null}
|
|
232
257
|
*/
|
|
@@ -284,8 +309,8 @@ export function familyPages(sheet: string, slug: string, cwd: string, only?: rea
|
|
|
284
309
|
export function previewAfter(ctx: import("./_settings.mjs").Ctx, slug: string, data: import("./_settings.mjs").ThemeData, png: boolean): Promise<{
|
|
285
310
|
sheetStale?: string | undefined;
|
|
286
311
|
preview: string | null;
|
|
287
|
-
pictures: string[];
|
|
288
|
-
cutShort: CutShort[];
|
|
312
|
+
pictures: string[] | never[];
|
|
313
|
+
cutShort: never[] | CutShort[];
|
|
289
314
|
pictureProblem: string | null;
|
|
290
315
|
notChecked: {
|
|
291
316
|
code: import("../../foundation/response/error-codes.mjs").ErrorCode;
|
|
@@ -312,9 +337,10 @@ export function checkSection(section: string | undefined, theme?: string, rest?:
|
|
|
312
337
|
/** The sample page, as a note about its pictures names it. */
|
|
313
338
|
export const SAMPLE_PAGE_NAME: "the sample page";
|
|
314
339
|
/**
|
|
315
|
-
* The tallest a family's picture is: a reader fits a
|
|
316
|
-
* and a taller one comes out too small to read, so it
|
|
317
|
-
* this tall (`sheet-inputs-1.png`, `-2`
|
|
340
|
+
* The tallest a family's or the pages section's picture is: a reader fits a
|
|
341
|
+
* picture to its width, and a taller one comes out too small to read, so it
|
|
342
|
+
* is cut into pictures this tall (`sheet-inputs-1.png`, `-2` …;
|
|
343
|
+
* `sheet-pages-1.png` …).
|
|
318
344
|
*/
|
|
319
345
|
export const FAMILY_PICTURE_HEIGHT: 1600;
|
|
320
346
|
/**
|
|
@@ -337,6 +363,21 @@ export const FAMILY_SECTIONS: readonly string[];
|
|
|
337
363
|
* command.
|
|
338
364
|
*/
|
|
339
365
|
export const UNWRITABLE: readonly string[];
|
|
366
|
+
/**
|
|
367
|
+
* Text a picture draws too faint to read, as the browser measured it: the
|
|
368
|
+
* part it sits in, its text, the mode, its ratio and its two colors, and
|
|
369
|
+
* the page (`page`, null for a sheet) and picture it is on.
|
|
370
|
+
*/
|
|
371
|
+
export type LowContrast = {
|
|
372
|
+
page: string | null;
|
|
373
|
+
file: string;
|
|
374
|
+
part: string;
|
|
375
|
+
text: string;
|
|
376
|
+
mode: "light" | "dark";
|
|
377
|
+
ratio: number;
|
|
378
|
+
fg: string;
|
|
379
|
+
bg: string;
|
|
380
|
+
};
|
|
340
381
|
/**
|
|
341
382
|
* Text one page's pictures draw cut short in one part, as the browser
|
|
342
383
|
* measured it: the page and its picture, the part (null when the text sits
|
|
@@ -344,6 +385,7 @@ export const UNWRITABLE: readonly string[];
|
|
|
344
385
|
* whether every text is drawn whole once the part keeps its width
|
|
345
386
|
* (`flex-shrink: 0`, applied in the page and measured). `broken`: the
|
|
346
387
|
* texts are words drawn broken across two lines inside the word, not cut.
|
|
388
|
+
* `overlaps`: the texts run past their own box over a neighbor's text.
|
|
347
389
|
*/
|
|
348
390
|
export type CutShort = {
|
|
349
391
|
page: string;
|
|
@@ -353,4 +395,5 @@ export type CutShort = {
|
|
|
353
395
|
only: "light" | "dark" | null;
|
|
354
396
|
whole: boolean;
|
|
355
397
|
broken?: boolean;
|
|
398
|
+
overlaps?: boolean;
|
|
356
399
|
};
|
|
@@ -42,8 +42,8 @@ import {
|
|
|
42
42
|
SYSTEM_FONTS,
|
|
43
43
|
} from './_tables.mjs';
|
|
44
44
|
import {makeCompiler} from './_compiler.mjs';
|
|
45
|
-
import {openProject, installLine} from './_project.mjs';
|
|
46
|
-
import {partData} from './_parts.mjs';
|
|
45
|
+
import {openProject, installLine, refusePlugAndPlay} from './_project.mjs';
|
|
46
|
+
import {addCensusStates, partData} from './_parts.mjs';
|
|
47
47
|
import {writeWhole} from './_palette.mjs';
|
|
48
48
|
import {
|
|
49
49
|
assetRef,
|
|
@@ -106,19 +106,7 @@ export function requireProject(cwd) {
|
|
|
106
106
|
// package.json lists @astryxdesign/core.
|
|
107
107
|
const app = coreApp(cwd);
|
|
108
108
|
if (!app) refuseNoApp(cwd);
|
|
109
|
-
|
|
110
|
-
// its .pnp.cjs sits at the app or at the workspace root above it.
|
|
111
|
-
if (pnpAbove(app))
|
|
112
|
-
throw new AstryxError(
|
|
113
|
-
"This app uses Yarn Plug'n'Play, which astryx experimental theme does not support: it reads the installed Core from node_modules. Set `nodeLinker: node-modules` in .yarnrc.yml and run yarn install. Nothing was written.",
|
|
114
|
-
[
|
|
115
|
-
{
|
|
116
|
-
name: 'yarn config set nodeLinker node-modules',
|
|
117
|
-
reason: 'do this first, then yarn install',
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
E.ERR_PROJECT_REQUIRED,
|
|
121
|
-
);
|
|
109
|
+
refusePlugAndPlay(app);
|
|
122
110
|
if (findNodeModulesPackage(app, '@astryxdesign/core')) return;
|
|
123
111
|
// The app lists Core but it is not installed.
|
|
124
112
|
throw new AstryxError(
|
|
@@ -146,6 +134,7 @@ export async function context(cwd) {
|
|
|
146
134
|
let uncheckedCode = null;
|
|
147
135
|
try {
|
|
148
136
|
parts = await partData(project);
|
|
137
|
+
addCensusStates(project, parts);
|
|
149
138
|
} catch (e) {
|
|
150
139
|
if (!isRenderFailure(e)) throw e;
|
|
151
140
|
unchecked = renderCause(project, /** @type {Error} */ (e).message);
|
|
@@ -227,22 +216,6 @@ export function coreApp(cwd) {
|
|
|
227
216
|
}
|
|
228
217
|
}
|
|
229
218
|
|
|
230
|
-
/**
|
|
231
|
-
* Whether a Yarn Plug'n'Play loader (.pnp.cjs) is at the app folder or above
|
|
232
|
-
* it, up to its workspace root (or, outside a workspace, the repository
|
|
233
|
-
* root).
|
|
234
|
-
* @param {string} app
|
|
235
|
-
*/
|
|
236
|
-
function pnpAbove(app) {
|
|
237
|
-
const root = findDeclaredWorkspaceRoot(app);
|
|
238
|
-
for (let dir = app; ; dir = path.dirname(dir)) {
|
|
239
|
-
if (fs.existsSync(path.join(dir, '.pnp.cjs'))) return true;
|
|
240
|
-
if (dir === root || (!root && fs.existsSync(path.join(dir, '.git'))))
|
|
241
|
-
return false;
|
|
242
|
-
if (path.dirname(dir) === dir) return false;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
219
|
/**
|
|
247
220
|
* The command that installs an app's packages, in its package manager.
|
|
248
221
|
* @param {string} dir
|
|
@@ -443,7 +416,8 @@ export const SAMPLE_PAGE_NAME = 'the sample page';
|
|
|
443
416
|
* whether every text is drawn whole once the part keeps its width
|
|
444
417
|
* (`flex-shrink: 0`, applied in the page and measured). `broken`: the
|
|
445
418
|
* texts are words drawn broken across two lines inside the word, not cut.
|
|
446
|
-
*
|
|
419
|
+
* `overlaps`: the texts run past their own box over a neighbor's text.
|
|
420
|
+
* @typedef {{page: string, file: string, part: string | null, texts: string[], only: 'light' | 'dark' | null, whole: boolean, broken?: boolean, overlaps?: boolean}} CutShort
|
|
447
421
|
*/
|
|
448
422
|
|
|
449
423
|
/** The texts named, the first six and how many more. @param {string[]} texts */
|
|
@@ -462,6 +436,8 @@ export function cutShortNote(c) {
|
|
|
462
436
|
const what = c.part
|
|
463
437
|
? `${c.part} label${n === 1 ? '' : 's'}`
|
|
464
438
|
: `text${n === 1 ? '' : 's'}`;
|
|
439
|
+
if (c.overlaps)
|
|
440
|
+
return `${c.page} (${c.file}) draws ${n} ${what} over the text beside ${n === 1 ? 'it' : 'them'}${c.only ? ` in ${c.only} mode only` : ''} (${someTexts(c.texts)}); the text is wider than the space ${c.part ? `the ${c.part}` : 'its box'} gives it`;
|
|
465
441
|
if (c.broken)
|
|
466
442
|
return `${c.page} (${c.file}) breaks ${n} word${n === 1 ? '' : 's'} across lines inside the word${c.part ? ` in the ${c.part}` : ''}${c.only ? ` in ${c.only} mode only` : ''} (${someTexts(c.texts)}); the word is wider than the space ${c.part ? `the ${c.part}` : 'its box'} has`;
|
|
467
443
|
return `${c.page} (${c.file}) draws ${n} ${what} cut short${c.only ? ` in ${c.only} mode only` : ''} (${someTexts(c.texts)}); the text no longer fits ${c.part ? `the ${c.part}` : 'its box'}`;
|
|
@@ -479,9 +455,11 @@ export function cutShortNote(c) {
|
|
|
479
455
|
*/
|
|
480
456
|
export function cutShortProblem(ctx, slug, c) {
|
|
481
457
|
const label = c.part ? `${c.part} labels` : 'text';
|
|
482
|
-
const problem = c.
|
|
483
|
-
?
|
|
484
|
-
:
|
|
458
|
+
const problem = c.overlaps
|
|
459
|
+
? `${label} drawn over the text beside them in ${c.page}'s pictures (${c.file}${c.only ? `, ${c.only} mode` : ''}): ${someTexts(c.texts)}`
|
|
460
|
+
: c.broken
|
|
461
|
+
? `words broken across lines inside the word${c.part ? ` in the ${c.part}` : ''} in ${c.page}'s pictures (${c.file}${c.only ? `, ${c.only} mode` : ''}): ${someTexts(c.texts)}`
|
|
462
|
+
: `${label} cut short in ${c.page}'s pictures (${c.file}${c.only ? `, ${c.only} mode` : ''}): ${someTexts(c.texts)}`;
|
|
485
463
|
if (c.part && c.whole && ctx.project.target.has(c.part))
|
|
486
464
|
return {problem, fix: `${P} set ${slug} flex-shrink 0 --on ${c.part}`};
|
|
487
465
|
return {
|
|
@@ -492,6 +470,13 @@ export function cutShortProblem(ctx, slug, c) {
|
|
|
492
470
|
};
|
|
493
471
|
}
|
|
494
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Text a picture draws too faint to read, as the browser measured it: the
|
|
475
|
+
* part it sits in, its text, the mode, its ratio and its two colors, and
|
|
476
|
+
* the page (`page`, null for a sheet) and picture it is on.
|
|
477
|
+
* @typedef {{page: string | null, file: string, part: string, text: string, mode: 'light' | 'dark', ratio: number, fg: string, bg: string}} LowContrast
|
|
478
|
+
*/
|
|
479
|
+
|
|
495
480
|
/**
|
|
496
481
|
* Pictures of HTML files, on request. A shot with a `name` is a page laid
|
|
497
482
|
* out so its text fits in the base theme (the sample page): the text its
|
|
@@ -499,32 +484,39 @@ export function cutShortProblem(ctx, slug, c) {
|
|
|
499
484
|
* `cutShort`, one entry for each part on each page ({@link cutShortNote},
|
|
500
485
|
* {@link cutShortProblem}). The sheets (the open
|
|
501
486
|
* states among them) have no name: their cells are narrow, and the full
|
|
502
|
-
* sheet cuts long labels short in every theme
|
|
487
|
+
* sheet cuts long labels short in every theme, so from a sheet only text
|
|
488
|
+
* drawn over the text beside it comes back.
|
|
503
489
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
504
490
|
* @param {Array<{html: string, png: string, name?: string, most?: number}>} shots
|
|
505
491
|
* `most`: the tallest the page's picture may be; a taller one is cut into
|
|
506
492
|
* pictures that tall, in order ({@link pagesOfPicture})
|
|
507
493
|
* @param {Array<'light' | 'dark'>} modes
|
|
508
|
-
*
|
|
494
|
+
* Every picture also measures the text it draws too faint to read
|
|
495
|
+
* (`lowContrast`): one entry for each part, text, pair of colors and mode,
|
|
496
|
+
* with the page it is on.
|
|
497
|
+
* @returns {Promise<{files: string[], problem: string | null, cutShort: CutShort[], lowContrast: LowContrast[]}>}
|
|
509
498
|
*/
|
|
510
499
|
export async function pictures(project, shots, modes) {
|
|
511
500
|
/** @type {string[]} */
|
|
512
501
|
const files = [];
|
|
502
|
+
/** @type {Map<string, LowContrast>} */
|
|
503
|
+
const faint = new Map();
|
|
504
|
+
const faintNotes = () => [...faint.values()];
|
|
513
505
|
/**
|
|
514
506
|
* The text drawn cut short, by page, then by part: its texts, the modes
|
|
515
507
|
* it was drawn so in, whether keeping the part's width draws every one
|
|
516
508
|
* whole, and the page's picture.
|
|
517
|
-
* Keyed by part, and apart for words broken across lines.
|
|
518
|
-
* @type {Map<string, {file: string, parts: Map<string, {part: string, broken: boolean, texts: Set<string>, modes: Set<'light' | 'dark'>, whole: boolean}>}>}
|
|
509
|
+
* Keyed by part, and apart for words broken across lines and for text drawn over its neighbor.
|
|
510
|
+
* @type {Map<string, {label: string, file: string, parts: Map<string, {part: string, broken: boolean, overlaps: boolean, texts: Set<string>, modes: Set<'light' | 'dark'>, whole: boolean}>}>}
|
|
519
511
|
*/
|
|
520
512
|
const cut = new Map();
|
|
521
513
|
/** One entry for each part on each page, from what was measured. */
|
|
522
514
|
const cutShortNotes = () =>
|
|
523
|
-
[...cut].flatMap(([
|
|
515
|
+
[...cut].flatMap(([, page]) =>
|
|
524
516
|
[...page.parts.values()].map(
|
|
525
|
-
({part, broken, texts, modes: drawnIn, whole}) =>
|
|
517
|
+
({part, broken, overlaps, texts, modes: drawnIn, whole}) =>
|
|
526
518
|
/** @type {CutShort} */ ({
|
|
527
|
-
page:
|
|
519
|
+
page: page.label,
|
|
528
520
|
file: page.file,
|
|
529
521
|
part: part || null,
|
|
530
522
|
texts: [...texts],
|
|
@@ -532,6 +524,7 @@ export async function pictures(project, shots, modes) {
|
|
|
532
524
|
modes.length > 1 && drawnIn.size === 1 ? [...drawnIn][0] : null,
|
|
533
525
|
whole,
|
|
534
526
|
...(broken ? {broken: true} : {}),
|
|
527
|
+
...(overlaps ? {overlaps: true} : {}),
|
|
535
528
|
}),
|
|
536
529
|
),
|
|
537
530
|
);
|
|
@@ -588,6 +581,7 @@ export async function pictures(project, shots, modes) {
|
|
|
588
581
|
return {
|
|
589
582
|
files,
|
|
590
583
|
cutShort: [],
|
|
584
|
+
lowContrast: [],
|
|
591
585
|
problem: `${inTheWayPhrase(path.relative(project.cwd, record), st.isSymbolicLink() ? 'link' : st.isDirectory() ? 'folder' : 'other', "the record of the editor's pictures")}, so no picture was taken and it is left as it is; move ${st.isSymbolicLink() ? 'the link' : 'it'}, then run the command again`,
|
|
592
586
|
};
|
|
593
587
|
}
|
|
@@ -597,6 +591,7 @@ export async function pictures(project, shots, modes) {
|
|
|
597
591
|
return {
|
|
598
592
|
files,
|
|
599
593
|
cutShort: [],
|
|
594
|
+
lowContrast: [],
|
|
600
595
|
problem: `${blocked.map(f => path.relative(project.cwd, f)).join(', ')} ${blocked.length === 1 ? 'is a file' : 'are files'} the editor did not write (or changed since it did), so no picture was taken and ${blocked.length === 1 ? 'it is' : 'they are'} left as ${blocked.length === 1 ? 'it is' : 'they are'}`,
|
|
601
596
|
};
|
|
602
597
|
/** The pictures to take, each with where it goes. @type {Array<{html: string, out: string, part: string, m: 'light' | 'dark', name?: string, most?: number}>} */
|
|
@@ -634,6 +629,7 @@ export async function pictures(project, shots, modes) {
|
|
|
634
629
|
return {
|
|
635
630
|
files,
|
|
636
631
|
cutShort: cutShortNotes(),
|
|
632
|
+
lowContrast: faintNotes(),
|
|
637
633
|
problem: `${path.relative(project.cwd, part)} is a folder, where --png writes a picture before moving it into place, so no picture was taken; move it out of ${path.relative(project.cwd, path.dirname(out))}/`,
|
|
638
634
|
};
|
|
639
635
|
// A folder it cannot write gets no picture: named before the browser
|
|
@@ -644,6 +640,7 @@ export async function pictures(project, shots, modes) {
|
|
|
644
640
|
return {
|
|
645
641
|
files,
|
|
646
642
|
cutShort: cutShortNotes(),
|
|
643
|
+
lowContrast: faintNotes(),
|
|
647
644
|
problem: `${path.relative(project.cwd, path.dirname(out))}/ cannot be written (${/** @type {any} */ (e)?.code ?? 'no access'}), so no picture was taken; fix its permissions, then run the command again`,
|
|
648
645
|
};
|
|
649
646
|
}
|
|
@@ -670,6 +667,7 @@ export async function pictures(project, shots, modes) {
|
|
|
670
667
|
return {
|
|
671
668
|
files,
|
|
672
669
|
cutShort: cutShortNotes(),
|
|
670
|
+
lowContrast: faintNotes(),
|
|
673
671
|
problem: files.length
|
|
674
672
|
? `${files.join(', ')} ${files.length === 1 ? 'was' : 'were'} taken, but ${missed.join(', ')} ${missed.length === 1 ? 'was' : 'were'} not: ${r?.reason ?? 'the browser stopped first'}`
|
|
675
673
|
: `No picture was taken: ${r?.reason ?? 'the browser stopped first'}`,
|
|
@@ -682,11 +680,14 @@ export async function pictures(project, shots, modes) {
|
|
|
682
680
|
return {
|
|
683
681
|
files,
|
|
684
682
|
cutShort: cutShortNotes(),
|
|
683
|
+
lowContrast: faintNotes(),
|
|
685
684
|
problem: `the picture could not be moved into ${path.relative(project.cwd, out)} (${/** @type {any} */ (e)?.code ?? e})`,
|
|
686
685
|
};
|
|
687
686
|
}
|
|
688
687
|
r.file = path.relative(project.cwd, out).split(path.sep).join('/');
|
|
689
688
|
files.push(r.file);
|
|
689
|
+
/** The pictures this one became: itself, or the pieces it is cut into. */
|
|
690
|
+
let pieces = [r.file];
|
|
690
691
|
// A picture in a theme folder is recorded as the editor's, so a later
|
|
691
692
|
// change removes it and never a picture of the user's.
|
|
692
693
|
const slug = themeOf(out);
|
|
@@ -708,20 +709,49 @@ export async function pictures(project, shots, modes) {
|
|
|
708
709
|
files.pop();
|
|
709
710
|
files.push(...cut.files);
|
|
710
711
|
r.file = cut.files[0];
|
|
712
|
+
pieces = cut.files;
|
|
711
713
|
}
|
|
712
714
|
}
|
|
713
715
|
}
|
|
714
716
|
for (const n of r.notes ?? []) if (!notes.includes(n)) notes.push(n);
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
717
|
+
for (const x of r.lowContrast ?? []) {
|
|
718
|
+
const key = `${name ?? r.file}\u0000${x.part}\u0000${x.text}\u0000${x.fg}\u0000${x.bg}\u0000${m}`;
|
|
719
|
+
if (!faint.has(key))
|
|
720
|
+
faint.set(key, {
|
|
721
|
+
page: name ?? null,
|
|
722
|
+
file: r.file,
|
|
723
|
+
part: x.part,
|
|
724
|
+
text: x.text,
|
|
725
|
+
mode: m,
|
|
726
|
+
ratio: x.ratio,
|
|
727
|
+
fg: x.fg,
|
|
728
|
+
bg: x.bg,
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
// What the browser measured, kept by page and part; nothing when its
|
|
732
|
+
// script measured nothing. A sheet's narrow cells cut long labels in
|
|
733
|
+
// every theme, so a sheet keeps only text drawn over its neighbor.
|
|
734
|
+
const measured = (r.cutShort ?? []).filter(c => name || c.overlaps);
|
|
735
|
+
if (measured.length) {
|
|
736
|
+
// Each sheet is its own page: its pictures (one per mode, or the
|
|
737
|
+
// pieces a tall one is cut into) are named by the first of them.
|
|
738
|
+
const key = name ?? `\0${out.replace(/-dark\.png$/, '.png')}`;
|
|
739
|
+
const shownFile =
|
|
740
|
+
pieces.length > 1
|
|
741
|
+
? `${pieces[0]} to ${path.basename(pieces[pieces.length - 1])}`
|
|
742
|
+
: r.file;
|
|
743
|
+
const page = cut.get(key) ?? {
|
|
744
|
+
label: name ?? 'the sheet',
|
|
745
|
+
file: shownFile,
|
|
746
|
+
parts: new Map(),
|
|
747
|
+
};
|
|
748
|
+
cut.set(key, page);
|
|
749
|
+
for (const {part, text, whole, broken, overlaps} of measured) {
|
|
750
|
+
const key = `${part ?? ''}${broken ? '\0broken' : ''}${overlaps ? '\0overlaps' : ''}`;
|
|
722
751
|
const at = page.parts.get(key) ?? {
|
|
723
752
|
part: part ?? '',
|
|
724
753
|
broken: Boolean(broken),
|
|
754
|
+
overlaps: Boolean(overlaps),
|
|
725
755
|
texts: new Set(),
|
|
726
756
|
modes: new Set(),
|
|
727
757
|
whole: true,
|
|
@@ -758,6 +788,7 @@ export async function pictures(project, shots, modes) {
|
|
|
758
788
|
// which pictures a link at their name kept out.
|
|
759
789
|
problem: notes.join('; ') || null,
|
|
760
790
|
cutShort: cutShortNotes(),
|
|
791
|
+
lowContrast: faintNotes(),
|
|
761
792
|
};
|
|
762
793
|
}
|
|
763
794
|
|
|
@@ -902,6 +933,23 @@ export function themeImageNotes(ctx, slug) {
|
|
|
902
933
|
return [...notes.values()];
|
|
903
934
|
}
|
|
904
935
|
|
|
936
|
+
/**
|
|
937
|
+
* The open fonts a set's families name whose package is not installed, each
|
|
938
|
+
* with the line that installs it: until then the pictures and the app draw
|
|
939
|
+
* the next font in the stack.
|
|
940
|
+
* @param {import('./_settings.mjs').Ctx} ctx
|
|
941
|
+
* @param {import('./_settings.mjs').ThemeData} data
|
|
942
|
+
* @returns {Array<{family: string, run: string[]}>}
|
|
943
|
+
*/
|
|
944
|
+
export function fontsNotLoaded(ctx, data) {
|
|
945
|
+
return fontPackages(ctx, data)
|
|
946
|
+
.filter(p => !p.installed)
|
|
947
|
+
.map(p => ({
|
|
948
|
+
family: p.family,
|
|
949
|
+
run: [installLine(ctx.project.cwd, [p.pkg])],
|
|
950
|
+
}));
|
|
951
|
+
}
|
|
952
|
+
|
|
905
953
|
/**
|
|
906
954
|
* Font notes for the families the theme builds: the import line for an
|
|
907
955
|
* open font, the install line when its package is missing, and a warning
|
|
@@ -1303,10 +1351,11 @@ export function styledChanges(before, after, base, drawn) {
|
|
|
1303
1351
|
|
|
1304
1352
|
/**
|
|
1305
1353
|
* The line that says which pictures to open after a run that took them:
|
|
1306
|
-
* each family of components' first ({@link familyPages}), then the
|
|
1307
|
-
*
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1354
|
+
* each family of components' first ({@link familyPages}), then the pages
|
|
1355
|
+
* section's (the sample app and each page template, cut between pages),
|
|
1356
|
+
* then the sample page's and the open states' (every menu, tooltip, popover
|
|
1357
|
+
* and list drawn open), of the mode shown first (light when the theme has
|
|
1358
|
+
* both). Null when this run took none of them.
|
|
1310
1359
|
* @param {string[]} files the pictures taken, as shown (`themes/t/preview.png`)
|
|
1311
1360
|
* @returns {string | null}
|
|
1312
1361
|
*/
|
|
@@ -1323,10 +1372,11 @@ export function lookAtPictures(files) {
|
|
|
1323
1372
|
files.filter(f =>
|
|
1324
1373
|
new RegExp(`^sheet-${g}${dark}(?:-\\d+)?\\.png$`).test(path.basename(f)),
|
|
1325
1374
|
);
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
);
|
|
1329
|
-
|
|
1375
|
+
/** @param {string} g */
|
|
1376
|
+
const pictured = g => (cuts(g, '').length ? cuts(g, '') : cuts(g, '-dark'));
|
|
1377
|
+
const families = FAMILY_SECTIONS.flatMap(pictured);
|
|
1378
|
+
const pages = pictured('pages');
|
|
1379
|
+
if (!preview && !open && !families.length && !pages.length) return null;
|
|
1330
1380
|
const dark =
|
|
1331
1381
|
files.some(f => /-dark\.png$/.test(f)) &&
|
|
1332
1382
|
files.some(f => /(?<!-dark)\.png$/.test(f));
|
|
@@ -1335,6 +1385,9 @@ export function lookAtPictures(files) {
|
|
|
1335
1385
|
...(families.length
|
|
1336
1386
|
? [`${families.join(', ')} (one family of components each)`]
|
|
1337
1387
|
: []),
|
|
1388
|
+
...(pages.length
|
|
1389
|
+
? [`${pages.join(', ')} (the sample app and each page template)`]
|
|
1390
|
+
: []),
|
|
1338
1391
|
...(preview
|
|
1339
1392
|
? [
|
|
1340
1393
|
`${preview} (the sample page, a tooltip, a menu and a list drawn open below it)`,
|
|
@@ -1379,9 +1432,10 @@ export async function openStatesPage(ctx, slug, data) {
|
|
|
1379
1432
|
}
|
|
1380
1433
|
|
|
1381
1434
|
/**
|
|
1382
|
-
* The tallest a family's picture is: a reader fits a
|
|
1383
|
-
* and a taller one comes out too small to read, so it
|
|
1384
|
-
* this tall (`sheet-inputs-1.png`, `-2`
|
|
1435
|
+
* The tallest a family's or the pages section's picture is: a reader fits a
|
|
1436
|
+
* picture to its width, and a taller one comes out too small to read, so it
|
|
1437
|
+
* is cut into pictures this tall (`sheet-inputs-1.png`, `-2` …;
|
|
1438
|
+
* `sheet-pages-1.png` …).
|
|
1385
1439
|
*/
|
|
1386
1440
|
export const FAMILY_PICTURE_HEIGHT = 1600;
|
|
1387
1441
|
|
|
@@ -149,9 +149,20 @@ export function takesWholeNumbersOnly(prop: string): boolean;
|
|
|
149
149
|
* @returns {string | null}
|
|
150
150
|
*/
|
|
151
151
|
export function familyListMeant(value: string): string | null;
|
|
152
|
+
/**
|
|
153
|
+
* A two-sided (start/end) or four-sided (top/right/bottom/left) longhand's
|
|
154
|
+
* value, as each side's property and value by the shorthand rules; null for
|
|
155
|
+
* any other property.
|
|
156
|
+
* @param {string} prop kebab-case
|
|
157
|
+
* @param {string} v
|
|
158
|
+
* @returns {Record<string, string> | null}
|
|
159
|
+
*/
|
|
160
|
+
export function sidesOf(prop: string, v: string): Record<string, string> | null;
|
|
152
161
|
export function propertyGrammar(prop: string): any | null;
|
|
153
162
|
/** The math functions, by name, for a check of whether a value holds one. */
|
|
154
163
|
export const MATH_FUNCTION: RegExp;
|
|
164
|
+
/** A side word in a longhand's name, in the order a box value lists sides. */
|
|
165
|
+
export const BOX_SIDES: readonly ["top", "right", "bottom", "left"];
|
|
155
166
|
import { coversProperty } from '../../foundation/runtime/css-tree.mjs';
|
|
156
167
|
import { longhandsOf } from '../../foundation/runtime/css-tree.mjs';
|
|
157
168
|
export { coversProperty, longhandsOf };
|
package/api/theme-edit/_css.mjs
CHANGED
|
@@ -1125,3 +1125,43 @@ export function familyListMeant(value) {
|
|
|
1125
1125
|
if (!changed || families.some(f => f.includes('\\'))) return null;
|
|
1126
1126
|
return families.join(', ');
|
|
1127
1127
|
}
|
|
1128
|
+
|
|
1129
|
+
/** A side word in a longhand's name, in the order a box value lists sides. */
|
|
1130
|
+
export const BOX_SIDES = /** @type {const} */ ([
|
|
1131
|
+
'top',
|
|
1132
|
+
'right',
|
|
1133
|
+
'bottom',
|
|
1134
|
+
'left',
|
|
1135
|
+
]);
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* A two-sided (start/end) or four-sided (top/right/bottom/left) longhand's
|
|
1139
|
+
* value, as each side's property and value by the shorthand rules; null for
|
|
1140
|
+
* any other property.
|
|
1141
|
+
* @param {string} prop kebab-case
|
|
1142
|
+
* @param {string} v
|
|
1143
|
+
* @returns {Record<string, string> | null}
|
|
1144
|
+
*/
|
|
1145
|
+
export function sidesOf(prop, v) {
|
|
1146
|
+
// (A logical pair the property data lists no longhands for,
|
|
1147
|
+
// `border-block-width`: its start and its end.)
|
|
1148
|
+
const pair = /^(border-(?:block|inline))-(width|style|color)$/.exec(prop);
|
|
1149
|
+
const direct = pair
|
|
1150
|
+
? [`${pair[1]}-start-${pair[2]}`, `${pair[1]}-end-${pair[2]}`]
|
|
1151
|
+
: [...longhandsOf(prop)].filter(p => longhandsOf(p).size === 0);
|
|
1152
|
+
const w = splitTop(v.trim(), ' ').map(x => x.trim());
|
|
1153
|
+
if (!w.length || /!important/i.test(v)) return null;
|
|
1154
|
+
const start = direct.find(p => /-start(-|$)/.test(p));
|
|
1155
|
+
const end = direct.find(p => /-end(-|$)/.test(p));
|
|
1156
|
+
if (direct.length === 2 && start && end && w.length <= 2)
|
|
1157
|
+
return {[start]: w[0], [end]: w[1] ?? w[0]};
|
|
1158
|
+
const named = BOX_SIDES.map(side =>
|
|
1159
|
+
direct.find(p => new RegExp(`-${side}(-|$)`).test(p)),
|
|
1160
|
+
);
|
|
1161
|
+
if (direct.length !== 4 || named.some(x => !x) || w.length > 4) return null;
|
|
1162
|
+
const [t, r = t, bo = t, l = r] = w;
|
|
1163
|
+
const vals = [t, r, bo, l];
|
|
1164
|
+
return Object.fromEntries(
|
|
1165
|
+
named.map((p, i) => [/** @type {string} */ (p), vals[i]]),
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
@@ -105,9 +105,9 @@ export function editorOwnTokenRefusal(root: string, slug: string): Promise<Astry
|
|
|
105
105
|
* @experimental
|
|
106
106
|
* @param {string} theme
|
|
107
107
|
* @param {import('./theme-edit.type.mjs').ThemeEditShowOptions} [options]
|
|
108
|
-
* @returns {Promise<import('./theme-edit.type.mjs').ThemeEditShowResponse>}
|
|
108
|
+
* @returns {Promise<import('./theme-edit.type.mjs').ThemeEditShowResponse | import('./theme-edit.type.mjs').ThemeEditShowPartResponse>}
|
|
109
109
|
*/
|
|
110
|
-
export function themeEditShow(theme: string, options?: import("./theme-edit.type.mjs").ThemeEditShowOptions): Promise<import("./theme-edit.type.mjs").ThemeEditShowResponse>;
|
|
110
|
+
export function themeEditShow(theme: string, options?: import("./theme-edit.type.mjs").ThemeEditShowOptions): Promise<import("./theme-edit.type.mjs").ThemeEditShowResponse | import("./theme-edit.type.mjs").ThemeEditShowPartResponse>;
|
|
111
111
|
/**
|
|
112
112
|
* The family and weight tokens the theme's own source sets as plain tokens
|
|
113
113
|
* that phones do not show: on top of a base theme, its rule for those
|
|
@@ -121,6 +121,19 @@ export function themeEditShow(theme: string, options?: import("./theme-edit.type
|
|
|
121
121
|
* @returns {string[]}
|
|
122
122
|
*/
|
|
123
123
|
export function ownPhoneNotes(cwd: string, slug: string, data: import("./_settings.mjs").ThemeData): string[];
|
|
124
|
+
/**
|
|
125
|
+
* Notes for the text the pictures draw too faint to read that no contrast
|
|
126
|
+
* check measured: one for each part and mode, its texts, its ratios and
|
|
127
|
+
* colors as drawn, and the picture it is on, with `how` for the part. A
|
|
128
|
+
* part a check already names in that mode is left out: its problem or note
|
|
129
|
+
* says it.
|
|
130
|
+
* @param {import('./_context.mjs').LowContrast[]} drawn
|
|
131
|
+
* @param {Array<{text: string}>} checked every contrast check's problem and note
|
|
132
|
+
* @returns {string[]}
|
|
133
|
+
*/
|
|
134
|
+
export function drawnContrastNotes(drawn: import("./_context.mjs").LowContrast[], checked: Array<{
|
|
135
|
+
text: string;
|
|
136
|
+
}>): string[];
|
|
124
137
|
/**
|
|
125
138
|
* Put the theme back as it was before its last change. With `thing`, remove
|
|
126
139
|
* that one setting instead, wherever it is in the settings: it goes back to
|