@astryxdesign/cli 0.7.17 → 0.7.18-canary.g57306fd
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/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/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/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/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +13 -13
- 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/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/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/text/written-string.d.mts +4 -1
- package/foundation/text/written-string.mjs +4 -1
- package/package.json +8 -7
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file How a question says a text's looks: its weight, a run of looks
|
|
5
|
+
* said together for a part's text or the top bar's links, and links said
|
|
6
|
+
* with the top bar.
|
|
7
|
+
* @input the question's clauses, a draft's steps, and the hue words
|
|
8
|
+
* @output weights, the top bar's links read as its nav items, and the
|
|
9
|
+
* text color and link size a run of looks asks for
|
|
10
|
+
* @position api/theme-edit — read by _how-question.mjs; reads only the
|
|
11
|
+
* weight table
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {HEADING_WEIGHTS} from './_tables.mjs';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A font weight written in a clause: a number from 100 to 900, or a weight
|
|
18
|
+
* word ("semibold").
|
|
19
|
+
* @param {{text: string}} c
|
|
20
|
+
*/
|
|
21
|
+
export function weightIn(c) {
|
|
22
|
+
const n = /\b([1-9]00)\b(?!\s*(px|ms|%))/.exec(c.text)?.[1];
|
|
23
|
+
if (n) return n;
|
|
24
|
+
// "weight 450": any weight from 1 to 1000 written beside the word.
|
|
25
|
+
const typed =
|
|
26
|
+
/\bweight\s*:?\s*(\d{1,4})\b(?!\s*(?:px|ms|%|rem|em))/.exec(c.text)?.[1] ??
|
|
27
|
+
/\b(\d{1,4})\s+(?:font\s+)?weight\b/.exec(c.text)?.[1];
|
|
28
|
+
if (typed && Number(typed) >= 1 && Number(typed) <= 1000) return typed;
|
|
29
|
+
const w = /\b(semi-?bold|medium|regular|normal)\b/.exec(c.text)?.[1];
|
|
30
|
+
return w
|
|
31
|
+
? HEADING_WEIGHTS[
|
|
32
|
+
/** @type {keyof typeof HEADING_WEIGHTS} */ (
|
|
33
|
+
w === 'normal' ? 'regular' : w.replace('-', '')
|
|
34
|
+
)
|
|
35
|
+
]
|
|
36
|
+
: null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** @type {Map<string, RegExp>} */
|
|
40
|
+
const lookRuns = new Map();
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Looks said together right before the text or links they style, at
|
|
44
|
+
* least one a weight or a size, with the noun phrase ending there: "white
|
|
45
|
+
* bold 11px links", "bold 13px #3b5998 text" (which the question reader
|
|
46
|
+
* writes "bold 13px text #3b5998"), "#3b5998 bold 13px text". A noun after
|
|
47
|
+
* it ("a 2px black text stroke") makes no run. A run the question reader
|
|
48
|
+
* splits ("13px #3b5998 bold text", "italic 13px #3b5998 text") is found
|
|
49
|
+
* in no one clause, so it reads as before. Group 1 is the noun.
|
|
50
|
+
* @param {string[]} hues the hue words a question can say
|
|
51
|
+
*/
|
|
52
|
+
function lookRun(hues) {
|
|
53
|
+
const kept = lookRuns.get(hues.join('|'));
|
|
54
|
+
if (kept) return kept;
|
|
55
|
+
const color = `#[0-9a-f]{3,8}|white|black|gr[ae]y|${hues.join('|')}`;
|
|
56
|
+
const ws = String.raw`bold|semi-?bold|\d+(?:\.\d+)?(?:px|rem|pt)`;
|
|
57
|
+
const look = `(?:${color}|${ws}|uppercase|italic)`;
|
|
58
|
+
const end = String.raw`(?=\s*(?:$|[,;.:)]|(?:and|but|then|in|on|of|for|with|to|at|inside|across|that|which|when|while)\b))`;
|
|
59
|
+
const run = new RegExp(
|
|
60
|
+
String.raw`(?:^|\s)(?:${look}\s+)*(?:${ws})\s+(?:${look}\s+)*(text|links?)(?:\s+#[0-9a-f]{3,8})?\b${end}`,
|
|
61
|
+
);
|
|
62
|
+
lookRuns.set(hues.join('|'), run);
|
|
63
|
+
return run;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Parts whose text is the page's, never their own. */
|
|
67
|
+
const PAGE_PARTS = new Set(['page', 'app-shell', 'layout-content', 'body']);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The run of looks a clause says for its own part's text, or for the top
|
|
71
|
+
* bar's links: never for the page, every link, or links said with another
|
|
72
|
+
* part, which read as before.
|
|
73
|
+
* @param {{text: string, parts: Array<{on: string}>, container?: string, within?: unknown}} c
|
|
74
|
+
* @param {string[]} hues
|
|
75
|
+
*/
|
|
76
|
+
function ownRun(c, hues) {
|
|
77
|
+
const m = lookRun(hues).exec(String(c.text ?? ''));
|
|
78
|
+
// (A run said for one part's text but placed in another, "tabs with bold
|
|
79
|
+
// 13px #3b5998 text on cards", reads as before.)
|
|
80
|
+
if (!m || c.container || c.within || new Set(c.parts.map(p => p.on)).size > 1)
|
|
81
|
+
return null;
|
|
82
|
+
const owns = /^links?$/.test(m[1])
|
|
83
|
+
? c.parts.length > 0 && c.parts.every(p => p.on === 'top-nav-item')
|
|
84
|
+
: c.parts.length > 0 &&
|
|
85
|
+
c.parts.every(p => p.on !== 'link' && !PAGE_PARTS.has(p.on));
|
|
86
|
+
return owns ? m[0] : null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* A draft for a run of looks read whole ("bold 13px #3b5998 text") writes
|
|
91
|
+
* one of its looks, and the run's color is its color ask's, so a typed
|
|
92
|
+
* color of that run is no word the draft failed to read; any other typed
|
|
93
|
+
* color still is.
|
|
94
|
+
* @param {{text: string, parts: Array<{on: string}>}} c the clause
|
|
95
|
+
* @param {Array<{thing: string}>} steps this draft's steps
|
|
96
|
+
* @param {string[]} hues the hue words a question can say
|
|
97
|
+
* @param {string[]} literals the typed colors the draft would report
|
|
98
|
+
*/
|
|
99
|
+
export function colorInOtherDraft(c, steps, hues, literals) {
|
|
100
|
+
const run = (ownRun(c, hues) ?? '').toLowerCase();
|
|
101
|
+
return (
|
|
102
|
+
RUN_READ.has(c) &&
|
|
103
|
+
/#[0-9a-f]{3,8}\b/.test(run) &&
|
|
104
|
+
literals.every(l => run.includes(l.toLowerCase())) &&
|
|
105
|
+
steps.length > 0
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The asks of a clause whose run of looks is read whole. */
|
|
110
|
+
const RUN_READ = new WeakSet();
|
|
111
|
+
|
|
112
|
+
/** The looks of a part's text said together, each an ask of its own. */
|
|
113
|
+
export const TEXT_LOOKS = ['case', 'weight', 'italic', 'tracking', 'fontsize'];
|
|
114
|
+
|
|
115
|
+
/** The asks a run of looks can make: those looks and its color. */
|
|
116
|
+
const RUN_ASKS = new Set(['text', ...TEXT_LOOKS]);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A run of looks said for a part's text or the top bar's links asks for
|
|
120
|
+
* each of its looks: its color ("tabs: bold 13px #3b5998 text") and a size
|
|
121
|
+
* said for links ("white bold 11px links"), each an ask of its own beside
|
|
122
|
+
* the weight and size the clause reader already gives, when every ask the
|
|
123
|
+
* clause makes is a look of that text.
|
|
124
|
+
* @param {Array<{text: string, aspects: string[], parts: Array<{on: string}>, container?: string, placeStrict?: unknown, state?: string | null}>} clauses
|
|
125
|
+
* @param {string[]} hues the hue words a question can say
|
|
126
|
+
*/
|
|
127
|
+
export function addRunLooks(clauses, hues) {
|
|
128
|
+
const color = new RegExp(
|
|
129
|
+
`#[0-9a-f]{3,8}|\\b(?:white|black|gr[ae]y|${hues.join('|')})\\b`,
|
|
130
|
+
);
|
|
131
|
+
// (A clause is keyed by its words, its parts and its state: two parts
|
|
132
|
+
// said with the same words, "cards with bold 13px #3b5998 text, buttons
|
|
133
|
+
// with bold 13px #3b5998 text", are two runs. Asks the reader split from
|
|
134
|
+
// one clause sit side by side with its words.)
|
|
135
|
+
const id = (/** @type {(typeof clauses)[number]} */ x) =>
|
|
136
|
+
`${x.text}\u0000${x.parts.map(p => p.on).join(',')}\u0000${x.state ?? ''}`;
|
|
137
|
+
// (A clause the reader gives another clause's words and part says no
|
|
138
|
+
// run of its own.)
|
|
139
|
+
/** @type {Map<string, number>} */
|
|
140
|
+
const first = new Map();
|
|
141
|
+
clauses.forEach((x, k) => first.has(id(x)) || first.set(id(x), k));
|
|
142
|
+
for (let i = clauses.length - 1; i >= 0; i--) {
|
|
143
|
+
const c = clauses[i];
|
|
144
|
+
// (Asks split from one clause share its words and part: read them
|
|
145
|
+
// once.)
|
|
146
|
+
if (
|
|
147
|
+
clauses[i - 1]?.text === c.text ||
|
|
148
|
+
(first.get(id(c)) ?? i) < i ||
|
|
149
|
+
// (A run said for a state, "selected tabs with …", reads as before:
|
|
150
|
+
// the reader can give it another clause's words.)
|
|
151
|
+
c.state
|
|
152
|
+
)
|
|
153
|
+
continue;
|
|
154
|
+
let end = i;
|
|
155
|
+
while (clauses[end + 1]?.text === c.text) end++;
|
|
156
|
+
const group = clauses.slice(i, end + 1);
|
|
157
|
+
const asks = group.flatMap(x => x.aspects);
|
|
158
|
+
// ("cards, tabs and buttons with bold 13px #3b5998 text": the reader
|
|
159
|
+
// gives the run's color to only some parts of a list. Unless every
|
|
160
|
+
// part said with the run's other looks has the color too, the list
|
|
161
|
+
// reads as before.)
|
|
162
|
+
if (/#[0-9a-f]{3,8}\b/i.test(c.text)) {
|
|
163
|
+
const own = new Set(String(c.text).toLowerCase().split(/\s+/));
|
|
164
|
+
const looks = (/** @type {string} */ t) =>
|
|
165
|
+
t
|
|
166
|
+
.toLowerCase()
|
|
167
|
+
.split(/\s+/)
|
|
168
|
+
.filter(w => w && !/^\d+(?:\.\d+)?(?:px|rem|pt)$/.test(w));
|
|
169
|
+
const sameState = (/** @type {(typeof clauses)[number]} */ x) =>
|
|
170
|
+
(x.state ?? null) === (c.state ?? null);
|
|
171
|
+
/** @type {Set<string>} */
|
|
172
|
+
const withLooks = new Set();
|
|
173
|
+
/** @type {Set<string>} */
|
|
174
|
+
const withColor = new Set();
|
|
175
|
+
for (const x of clauses) {
|
|
176
|
+
if (!x.text || !sameState(x)) continue;
|
|
177
|
+
const ws = looks(String(x.text));
|
|
178
|
+
if (!ws.every(w => own.has(w))) continue;
|
|
179
|
+
const into = /#[0-9a-f]{3,8}\b/i.test(x.text) ? withColor : withLooks;
|
|
180
|
+
for (const p of x.parts) into.add(p.on);
|
|
181
|
+
}
|
|
182
|
+
if ([...withLooks].some(on => !withColor.has(on))) continue;
|
|
183
|
+
}
|
|
184
|
+
const run = ownRun(c, hues);
|
|
185
|
+
// ("top bar #3b5998 with 11px white links": the links' color stays the
|
|
186
|
+
// bar's link color, and their size is the nav items'.)
|
|
187
|
+
const said = lookRun(hues).exec(String(c.text ?? ''))?.[0] ?? '';
|
|
188
|
+
if (
|
|
189
|
+
!run &&
|
|
190
|
+
/\blinks?\b/.test(said) &&
|
|
191
|
+
/\d(?:px|rem|pt)\b/.test(said) &&
|
|
192
|
+
BAR_KEPT.has(c) &&
|
|
193
|
+
!asks.includes('fontsize') &&
|
|
194
|
+
asks.every(a => RUN_ASKS.has(a))
|
|
195
|
+
) {
|
|
196
|
+
const size = {...c, parts: [{on: 'top-nav-item'}], aspects: ['fontsize']};
|
|
197
|
+
delete size.container;
|
|
198
|
+
delete size.placeStrict;
|
|
199
|
+
for (const x of [...group, size]) RUN_READ.add(x);
|
|
200
|
+
clauses.splice(end + 1, 0, size);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
// (Only when every ask of the clause is a look of the run's own part's
|
|
204
|
+
// text: otherwise the clause reads as before.)
|
|
205
|
+
if (
|
|
206
|
+
!run ||
|
|
207
|
+
!group.every(x => ownRun(x, hues)) ||
|
|
208
|
+
!asks.every(a => RUN_ASKS.has(a))
|
|
209
|
+
)
|
|
210
|
+
continue;
|
|
211
|
+
/** @type {string[]} */
|
|
212
|
+
const add = [];
|
|
213
|
+
if (color.test(run) && !asks.includes('text')) add.push('text');
|
|
214
|
+
if (/\blinks?\b/.test(run) && /\d(?:px|rem|pt)\b/.test(run)) {
|
|
215
|
+
if (!asks.includes('fontsize')) add.push('fontsize');
|
|
216
|
+
}
|
|
217
|
+
// (The color of the bar's links is the bar's link color, placed as the
|
|
218
|
+
// question reader places it.)
|
|
219
|
+
const inBar = IN_BAR.get(c);
|
|
220
|
+
const copies = add.map(a =>
|
|
221
|
+
a === 'text' && inBar
|
|
222
|
+
? {...c, ...inBar, parts: [{on: 'link'}], aspects: [a]}
|
|
223
|
+
: {...c, parts: c.parts.map(p => ({...p})), aspects: [a]},
|
|
224
|
+
);
|
|
225
|
+
for (const x of [...group, ...copies]) RUN_READ.add(x);
|
|
226
|
+
clauses.splice(end + 1, 0, ...copies);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Where the question reader placed the bar's links, kept for the color
|
|
232
|
+
* ask a run of their looks adds.
|
|
233
|
+
* @type {WeakMap<object, {container: string, placeStrict: unknown}>}
|
|
234
|
+
*/
|
|
235
|
+
const IN_BAR = new WeakMap();
|
|
236
|
+
|
|
237
|
+
/** The bar's links whose color the question reader keeps to the bar. */
|
|
238
|
+
const BAR_KEPT = new WeakSet();
|
|
239
|
+
|
|
240
|
+
/** The parts that are the top bar. */
|
|
241
|
+
export const BAR_PARTS = new Set(['app-shell-header', 'top-nav']);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Links said with the top bar are its nav items, never every link in the
|
|
245
|
+
* app: in the clause after the bar's, joined by "with" ("top bar #3b5998
|
|
246
|
+
* with white links"), or in a clause that holds the bar only as the place
|
|
247
|
+
* of its links and asks only for the links' text ("top bar with white bold
|
|
248
|
+
* links"), more links said after them with "and" for a mode or a state,
|
|
249
|
+
* and a look said for them again ("and underline them on hover"). A
|
|
250
|
+
* clause that also asks for a look of the bar, never says links, or places
|
|
251
|
+
* its links elsewhere ("links on cards") keeps its reading.
|
|
252
|
+
* @param {Array<{joint?: string, text: string, aspects: string[], parts: Array<{on: string}>, container?: string, within?: unknown, placeStrict?: unknown}>} clauses
|
|
253
|
+
* @param {(text: string) => boolean} namesBar whether words name the bar,
|
|
254
|
+
* by the part words
|
|
255
|
+
* @param {(clause: object) => void} release drops the notes that a
|
|
256
|
+
* clause's links could not be kept to the bar
|
|
257
|
+
*/
|
|
258
|
+
export function barLinksAreNavItems(clauses, namesBar, release) {
|
|
259
|
+
const bar = (/** @type {{on: string}} */ p) => BAR_PARTS.has(p.on);
|
|
260
|
+
const link = (/** @type {{on: string}} */ p) => p.on === 'link';
|
|
261
|
+
/** @type {string | null} the bar whose links were last its nav items */
|
|
262
|
+
let held = null;
|
|
263
|
+
// (Whether the clause before is the bar's links.)
|
|
264
|
+
let lastBar = false;
|
|
265
|
+
for (let k = 0; k < clauses.length;) {
|
|
266
|
+
// (Asks split from one clause share its words and its joint: they are
|
|
267
|
+
// read as one, and the bar is in the clause before them all.)
|
|
268
|
+
const c = clauses[k];
|
|
269
|
+
let end = k;
|
|
270
|
+
while (clauses[end + 1]?.text === c.text) end++;
|
|
271
|
+
const group = clauses.slice(k, end + 1);
|
|
272
|
+
const before = clauses[k - 1];
|
|
273
|
+
k = end + 1;
|
|
274
|
+
// (Links the ask places elsewhere, "the links on cards", stay there;
|
|
275
|
+
// links said with the bar are its nav items, and "the links in the
|
|
276
|
+
// header" read as before.)
|
|
277
|
+
const placed = group.find(x => x.container || x.within);
|
|
278
|
+
const barPlaced = Boolean(
|
|
279
|
+
placed && BAR_PARTS.has(String(placed.container)),
|
|
280
|
+
);
|
|
281
|
+
if (placed && !barPlaced) {
|
|
282
|
+
lastBar = false;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
const inBar = barPlaced && /^[\s;]*with\s*$/.test(c.joint ?? '');
|
|
286
|
+
const unplace = (/** @type {(typeof clauses)[number]} */ x) => {
|
|
287
|
+
if (x.container && BAR_PARTS.has(x.container)) {
|
|
288
|
+
delete x.container;
|
|
289
|
+
delete x.placeStrict;
|
|
290
|
+
release(x);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
const says = /\blinks?\b/.test(c.text);
|
|
294
|
+
const and = /^[\s,]*and\s*$/.test(c.joint ?? '');
|
|
295
|
+
const navBefore = lastBar;
|
|
296
|
+
const barOf = (/** @type {typeof clauses} */ xs) =>
|
|
297
|
+
xs.flatMap(x => x.parts).find(bar)?.on ?? null;
|
|
298
|
+
// ("top bar navy with blue buttons": only links said with the bar are
|
|
299
|
+
// its nav items.)
|
|
300
|
+
const joined =
|
|
301
|
+
says &&
|
|
302
|
+
(inBar ||
|
|
303
|
+
(/^[\s;]*with\s*$/.test(c.joint ?? '') &&
|
|
304
|
+
Boolean(before && barOf([before]))));
|
|
305
|
+
// ("… with white links in light mode and gray links in dark mode": more
|
|
306
|
+
// links said in the bar's list for a mode or a state of their own are
|
|
307
|
+
// its nav items too.)
|
|
308
|
+
const more =
|
|
309
|
+
says &&
|
|
310
|
+
and &&
|
|
311
|
+
navBefore &&
|
|
312
|
+
/\b(?:(?:light|dark) mode|hover(?:ed|ing)?|selected|active|focus(?:ed)?|pressed|visited)\b/.test(
|
|
313
|
+
c.text,
|
|
314
|
+
) &&
|
|
315
|
+
group.every(x => x.parts.length && x.parts.every(p => link(p) || bar(p)));
|
|
316
|
+
const holder =
|
|
317
|
+
says &&
|
|
318
|
+
Boolean(barOf(group)) &&
|
|
319
|
+
group.some(x => x.parts.some(link)) &&
|
|
320
|
+
!namesBar(c.text) &&
|
|
321
|
+
group.every(x => x.aspects.every(a => RUN_ASKS.has(a)));
|
|
322
|
+
// ("… with white links, and underline them on hover": a look said for
|
|
323
|
+
// those links again, by "them", is the nav items' too.)
|
|
324
|
+
const again =
|
|
325
|
+
!says &&
|
|
326
|
+
and &&
|
|
327
|
+
navBefore &&
|
|
328
|
+
/\b(?:them|they|their)\b/.test(c.text) &&
|
|
329
|
+
group.every(x => x.parts.length && x.parts.every(p => link(p) || bar(p)));
|
|
330
|
+
if (joined || holder || more || again) {
|
|
331
|
+
if (!again)
|
|
332
|
+
held =
|
|
333
|
+
(inBar ? String(placed?.container) : null) ??
|
|
334
|
+
(joined && before ? barOf([before]) : barOf(group)) ??
|
|
335
|
+
held;
|
|
336
|
+
for (const x of group) {
|
|
337
|
+
// (The links' color said in the bar is the bar's link color, as
|
|
338
|
+
// the question reader places it.)
|
|
339
|
+
if (x.aspects.includes('text') && BAR_PARTS.has(String(x.container))) {
|
|
340
|
+
BAR_KEPT.add(x);
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
if (x.container && BAR_PARTS.has(x.container))
|
|
344
|
+
IN_BAR.set(x, {container: x.container, placeStrict: x.placeStrict});
|
|
345
|
+
unplace(x);
|
|
346
|
+
if (holder || more || again) x.parts = x.parts.filter(p => !bar(p));
|
|
347
|
+
for (const p of x.parts) if (link(p)) p.on = 'top-nav-item';
|
|
348
|
+
}
|
|
349
|
+
lastBar = true;
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
lastBar = false;
|
|
353
|
+
if (
|
|
354
|
+
// ("top bar with white links and white text": a look said after the
|
|
355
|
+
// links for text, or one the bar draws, is the bar's own.)
|
|
356
|
+
!says &&
|
|
357
|
+
and &&
|
|
358
|
+
navBefore &&
|
|
359
|
+
held &&
|
|
360
|
+
// (Only a look said for text, or one the bar draws itself; "underline
|
|
361
|
+
// them on hover" is still the links'.)
|
|
362
|
+
!/\b(?:them|their|they|it|its)\b/.test(c.text) &&
|
|
363
|
+
(/\btext\b/.test(c.text) ||
|
|
364
|
+
group.every(x =>
|
|
365
|
+
x.aspects.every(a =>
|
|
366
|
+
['background', 'border', 'shadow', 'corners'].includes(a),
|
|
367
|
+
),
|
|
368
|
+
)) &&
|
|
369
|
+
group.every(x => x.parts.length && x.parts.every(p => link(p) || bar(p)))
|
|
370
|
+
)
|
|
371
|
+
for (const x of group) {
|
|
372
|
+
unplace(x);
|
|
373
|
+
x.parts = [{on: held}];
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Split a printed command into its arguments, as a POSIX shell reads them:
|
|
6
|
-
* single quotes (with `'\''` for a quote inside), double quotes and
|
|
7
|
-
* backslashes. `null` when the quotes do not close.
|
|
8
|
-
* @param {string} line
|
|
9
|
-
* @returns {string[] | null}
|
|
10
|
-
*/
|
|
11
|
-
export function splitCommand(line: string): string[] | null;
|
|
12
|
-
/**
|
|
13
|
-
* Read a suggested `set <slug> <thing> <value> [flags]` line; `null` when it
|
|
14
|
-
* is not one this check can read (another command or theme, a placeholder,
|
|
15
|
-
* an unknown flag): such a line is kept as it is.
|
|
16
|
-
* @param {string} name
|
|
17
|
-
* @param {string} slug
|
|
18
|
-
*/
|
|
19
|
-
export function readSetLine(name: string, slug: string): {
|
|
20
|
-
thing: string;
|
|
21
|
-
value: string;
|
|
22
|
-
flags: {
|
|
23
|
-
on?: string;
|
|
24
|
-
when?: string;
|
|
25
|
-
state?: string;
|
|
26
|
-
mode?: string;
|
|
27
|
-
only?: boolean;
|
|
28
|
-
};
|
|
29
|
-
} | null;
|
|
30
4
|
/**
|
|
31
5
|
* Drop each `set` suggestion of a refusal that `set` itself would refuse,
|
|
32
6
|
* checked against the theme as it is now (a copy: nothing is changed). Any
|
|
@@ -71,3 +45,6 @@ export function followLine(line: string, check: (line: string) => Promise<Astryx
|
|
|
71
45
|
next?: import("../../foundation/response/base").Suggestion[];
|
|
72
46
|
}>;
|
|
73
47
|
import { AstryxError } from '../error.mjs';
|
|
48
|
+
import { readSetLine } from './_set-line.mjs';
|
|
49
|
+
import { splitCommand } from './_set-line.mjs';
|
|
50
|
+
export { readSetLine, splitCommand };
|
package/api/theme-edit/_vet.mjs
CHANGED
|
@@ -13,95 +13,9 @@ import {AstryxError} from '../error.mjs';
|
|
|
13
13
|
import {checkSetting} from './_check.mjs';
|
|
14
14
|
import {allowedLine} from './_normal.mjs';
|
|
15
15
|
import {P} from './_tables.mjs';
|
|
16
|
+
import {readSetLine, splitCommand} from './_set-line.mjs';
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
* Split a printed command into its arguments, as a POSIX shell reads them:
|
|
19
|
-
* single quotes (with `'\''` for a quote inside), double quotes and
|
|
20
|
-
* backslashes. `null` when the quotes do not close.
|
|
21
|
-
* @param {string} line
|
|
22
|
-
* @returns {string[] | null}
|
|
23
|
-
*/
|
|
24
|
-
export function splitCommand(line) {
|
|
25
|
-
/** @type {string[]} */
|
|
26
|
-
const out = [];
|
|
27
|
-
let cur = '';
|
|
28
|
-
let has = false;
|
|
29
|
-
for (let i = 0; i < line.length; i += 1) {
|
|
30
|
-
const c = line[i];
|
|
31
|
-
if (c === "'") {
|
|
32
|
-
const end = line.indexOf("'", i + 1);
|
|
33
|
-
if (end < 0) return null;
|
|
34
|
-
cur += line.slice(i + 1, end);
|
|
35
|
-
has = true;
|
|
36
|
-
i = end;
|
|
37
|
-
} else if (c === '"') {
|
|
38
|
-
let j = i + 1;
|
|
39
|
-
for (; j < line.length && line[j] !== '"'; j += 1) {
|
|
40
|
-
if (line[j] === '\\' && j + 1 < line.length) j += 1;
|
|
41
|
-
cur += line[j];
|
|
42
|
-
}
|
|
43
|
-
if (j >= line.length) return null;
|
|
44
|
-
has = true;
|
|
45
|
-
i = j;
|
|
46
|
-
} else if (c === '\\' && i + 1 < line.length) {
|
|
47
|
-
cur += line[i + 1];
|
|
48
|
-
has = true;
|
|
49
|
-
i += 1;
|
|
50
|
-
} else if (/\s/.test(c)) {
|
|
51
|
-
if (has) out.push(cur);
|
|
52
|
-
cur = '';
|
|
53
|
-
has = false;
|
|
54
|
-
} else {
|
|
55
|
-
cur += c;
|
|
56
|
-
has = true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (has) out.push(cur);
|
|
60
|
-
return out;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const VALUE_FLAGS = new Set(['on', 'when', 'state', 'mode']);
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Read a suggested `set <slug> <thing> <value> [flags]` line; `null` when it
|
|
67
|
-
* is not one this check can read (another command or theme, a placeholder,
|
|
68
|
-
* an unknown flag): such a line is kept as it is.
|
|
69
|
-
* @param {string} name
|
|
70
|
-
* @param {string} slug
|
|
71
|
-
*/
|
|
72
|
-
export function readSetLine(name, slug) {
|
|
73
|
-
const prefix = `${P} set ${slug} `;
|
|
74
|
-
if (!name.startsWith(prefix)) return null;
|
|
75
|
-
const rest = name.slice(prefix.length);
|
|
76
|
-
// A placeholder (`<a color>`, `…`) is a pattern, not a command to run.
|
|
77
|
-
if (/<[^>]*>|…/.test(rest)) return null;
|
|
78
|
-
const args = splitCommand(rest);
|
|
79
|
-
if (!args || !args.length) return null;
|
|
80
|
-
/** @type {string[]} */
|
|
81
|
-
const pos = [];
|
|
82
|
-
/** @type {{on?: string, when?: string, state?: string, mode?: string, only?: boolean}} */
|
|
83
|
-
const flags = {};
|
|
84
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
85
|
-
const a = args[i];
|
|
86
|
-
const m = /^--([a-z]+)(?:=(.*))?$/.exec(a);
|
|
87
|
-
// A token (`--color-accent`) is the thing, not a flag.
|
|
88
|
-
if (m && (VALUE_FLAGS.has(m[1]) || m[1] === 'only') && pos.length) {
|
|
89
|
-
if (m[1] === 'only') {
|
|
90
|
-
flags.only = true;
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
const v = m[2] ?? args[(i += 1)];
|
|
94
|
-
if (v == null) return null;
|
|
95
|
-
/** @type {any} */ (flags)[m[1]] = v;
|
|
96
|
-
} else if (m && pos.length) {
|
|
97
|
-
// Some other flag (`--png`): not part of the setting.
|
|
98
|
-
if (m[1] === 'png') continue;
|
|
99
|
-
return null;
|
|
100
|
-
} else pos.push(a);
|
|
101
|
-
}
|
|
102
|
-
if (pos.length > 2 || !pos.length) return null;
|
|
103
|
-
return {thing: pos[0], value: pos[1] ?? '', flags};
|
|
104
|
-
}
|
|
18
|
+
export {readSetLine, splitCommand};
|
|
105
19
|
|
|
106
20
|
/**
|
|
107
21
|
* Drop each `set` suggestion of a refusal that `set` itself would refuse,
|
|
@@ -130,7 +44,9 @@ export function vetSuggestions(e, ctx, slug, data) {
|
|
|
130
44
|
structuredClone(data),
|
|
131
45
|
line.thing,
|
|
132
46
|
line.value,
|
|
133
|
-
line
|
|
47
|
+
// `set` reads a typed box shorthand as its sides, so the line is
|
|
48
|
+
// checked the way it runs.
|
|
49
|
+
{...line.flags, sides: true},
|
|
134
50
|
false,
|
|
135
51
|
);
|
|
136
52
|
return null;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* inside it), a family (its members), a setting (a dial's rungs, a token's
|
|
8
8
|
* type and readers, a CSS property), an aspect (colors, text, corners...: the
|
|
9
9
|
* whole-theme tokens and dial), a plain-words question (exact commands), a
|
|
10
|
-
* PNG picture (its main colors, or the color at points), or with `list` a
|
|
10
|
+
* PNG picture (its main colors and the look's traits measured from it, or the color at points), or with `list` a
|
|
11
11
|
* list of dials, tokens, parts, families or CSS properties.
|
|
12
12
|
* @experimental
|
|
13
13
|
* @param {string} subject a part, family, setting, aspect, question, or PNG file; with `list`, a filter
|
|
@@ -16,7 +16,7 @@ import * as adapter from '../_adapter.mjs';
|
|
|
16
16
|
* inside it), a family (its members), a setting (a dial's rungs, a token's
|
|
17
17
|
* type and readers, a CSS property), an aspect (colors, text, corners...: the
|
|
18
18
|
* whole-theme tokens and dial), a plain-words question (exact commands), a
|
|
19
|
-
* PNG picture (its main colors, or the color at points), or with `list` a
|
|
19
|
+
* PNG picture (its main colors and the look's traits measured from it, or the color at points), or with `list` a
|
|
20
20
|
* list of dials, tokens, parts, families or CSS properties.
|
|
21
21
|
* @experimental
|
|
22
22
|
* @param {string} subject a part, family, setting, aspect, question, or PNG file; with `list`, a filter
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Every setting of a theme, key resolved values, problems it caused, the
|
|
6
|
-
* sample page and the theme-building page with every component
|
|
6
|
+
* sample page and the theme-building page with every component; with
|
|
7
|
+
* `options.on`, what one part of any theme shows, written nowhere.
|
|
7
8
|
* @experimental
|
|
8
9
|
* @param {string} theme
|
|
9
10
|
* @param {import('../theme-edit.type.mjs').ThemeEditShowOptions} [options]
|
|
10
|
-
* @returns {Promise<import('../theme-edit.type.mjs').ThemeEditShowResponse>}
|
|
11
|
+
* @returns {Promise<import('../theme-edit.type.mjs').ThemeEditShowResponse | import('../theme-edit.type.mjs').ThemeEditShowPartResponse>}
|
|
11
12
|
*/
|
|
12
|
-
export function themeEditShow(theme: string, options?: import("../theme-edit.type.mjs").ThemeEditShowOptions): Promise<import("../theme-edit.type.mjs").ThemeEditShowResponse>;
|
|
13
|
+
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>;
|
|
@@ -12,11 +12,12 @@ import * as adapter from '../_adapter.mjs';
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Every setting of a theme, key resolved values, problems it caused, the
|
|
15
|
-
* sample page and the theme-building page with every component
|
|
15
|
+
* sample page and the theme-building page with every component; with
|
|
16
|
+
* `options.on`, what one part of any theme shows, written nowhere.
|
|
16
17
|
* @experimental
|
|
17
18
|
* @param {string} theme
|
|
18
19
|
* @param {import('../theme-edit.type.mjs').ThemeEditShowOptions} [options]
|
|
19
|
-
* @returns {Promise<import('../theme-edit.type.mjs').ThemeEditShowResponse>}
|
|
20
|
+
* @returns {Promise<import('../theme-edit.type.mjs').ThemeEditShowResponse | import('../theme-edit.type.mjs').ThemeEditShowPartResponse>}
|
|
20
21
|
*/
|
|
21
22
|
export async function themeEditShow(theme, options = {}) {
|
|
22
23
|
return adapter.themeEditShow(theme, options);
|