@astryxdesign/cli 0.7.16 → 0.7.17-canary.gb36275e
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 +13 -23
- package/api/build/_adapter.d.mts +5 -0
- package/api/build/_adapter.mjs +49 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/build.doc.mjs +2 -1
- package/api/build/kit/rank.mjs +59 -12
- package/api/build/kit/weights.d.mts +16 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +238 -31
- package/api/build/kit/word-model.d.mts +23 -0
- package/api/build/kit/word-model.mjs +46 -0
- package/api/build/kit/words.d.mts +42 -0
- package/api/build/kit/words.mjs +82 -1
- package/api/component/__fixtures__/resolutions/modules.txt +4 -5
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +46 -5
- package/api/discover/_adapter.d.mts +1 -1
- package/api/docs/_adapter.d.mts +26 -2
- package/api/docs/_adapter.mjs +217 -5
- package/api/docs/docs.d.mts +3 -0
- package/api/docs/docs.doc.mjs +7 -1
- package/api/docs/docs.mjs +12 -0
- package/api/docs/docs.type.d.mts +5 -0
- package/api/docs/docs.type.mjs +2 -0
- package/api/docs/node/node.mjs +1 -1
- package/api/doctor/_adapter.d.mts +27 -5
- package/api/doctor/_adapter.mjs +77 -6
- package/api/doctor/built-checks.mjs +38 -13
- package/api/doctor/doctor.d.mts +4 -3
- package/api/doctor/doctor.mjs +14 -7
- package/api/doctor/theme-checks.mjs +121 -17
- package/api/render/_adapter.mjs +531 -192
- package/api/render/render.doc.mjs +11 -3
- package/api/render/render.type.d.mts +30 -0
- package/api/render/render.type.mjs +19 -0
- package/api/search/ORDERING.md +1 -1
- package/api/search/_candidate-score.mjs +51 -32
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_result.d.mts +5 -5
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search.d.mts +1 -1
- package/api/theme/_adapter.mjs +10 -0
- package/api/theme/build/build.d.mts +47 -0
- package/api/theme/build/build.mjs +147 -25
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +48 -0
- package/api/theme-edit/_adapter.mjs +675 -42
- package/api/theme-edit/_check.d.mts +28 -22
- package/api/theme-edit/_check.mjs +1481 -252
- package/api/theme-edit/_color.d.mts +9 -0
- package/api/theme-edit/_color.mjs +41 -1
- package/api/theme-edit/_compiler.mjs +9 -0
- package/api/theme-edit/_context.mjs +60 -3
- package/api/theme-edit/_css.mjs +21 -1
- package/api/theme-edit/_edit.d.mts +22 -0
- package/api/theme-edit/_edit.mjs +1196 -88
- package/api/theme-edit/_how-commands.d.mts +57 -0
- package/api/theme-edit/_how-commands.mjs +536 -1
- package/api/theme-edit/_how-question.d.mts +65 -0
- package/api/theme-edit/_how-question.mjs +4401 -225
- package/api/theme-edit/_how.mjs +104 -4
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_normal.d.mts +153 -0
- package/api/theme-edit/_normal.mjs +661 -0
- package/api/theme-edit/_palette.mjs +10 -4
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +103 -2
- package/api/theme-edit/_preview-app.d.mts +7 -1
- package/api/theme-edit/_preview-app.mjs +205 -17
- package/api/theme-edit/_preview.d.mts +64 -8
- package/api/theme-edit/_preview.mjs +447 -89
- package/api/theme-edit/_settings.d.mts +176 -5
- package/api/theme-edit/_settings.mjs +1936 -128
- package/api/theme-edit/_tables.d.mts +6 -0
- package/api/theme-edit/_tables.mjs +32 -1
- package/api/theme-edit/theme-edit.type.d.mts +10 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -1
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
- package/assets/codemods/run-codemod.mjs +73 -6
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -0
- package/assets/docs/theme.doc.dense.mjs +2 -2
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +43 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +2 -1
- package/assets/templates/pages/blank/template.doc.mjs +1 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
- package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
- package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
- package/assets/templates/pages/documentation/template.doc.mjs +4 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/template.doc.mjs +2 -8
- package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
- package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
- package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +24 -2
- package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
- package/assets/templates/pages/library/template.doc.mjs +4 -1
- package/assets/templates/pages/login/template.doc.mjs +2 -1
- package/assets/templates/pages/login-card/template.doc.mjs +2 -1
- package/assets/templates/pages/login-split/template.doc.mjs +2 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
- package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- package/assets/templates/pages/table-page/template.doc.mjs +5 -4
- package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
- package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +3 -3
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/clients/cli/bin/astryx.mjs +6 -9
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.mjs +20 -2
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +22 -14
- package/clients/cli/commands/experimental/render.mjs +32 -1
- package/clients/cli/commands/experimental/theme.mjs +65 -14
- package/clients/cli/commands/experimental-render.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +2 -1
- package/clients/cli/commands/search.mjs +6 -1
- package/clients/cli/commands/template.mjs +4 -2
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +153 -5
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/theme-state.d.mts +13 -1
- package/foundation/config/theme-state.mjs +47 -7
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +27 -2
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/entry-name-files.d.mts +43 -0
- package/foundation/discovery/entry-name-files.mjs +264 -0
- package/foundation/discovery/hook-discovery.d.mts +8 -2
- package/foundation/discovery/hook-discovery.mjs +20 -7
- package/foundation/discovery/package-exports.d.mts +10 -0
- package/foundation/discovery/package-exports.mjs +56 -3
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/template-adapter.d.mts +52 -0
- package/foundation/discovery/template-adapter.mjs +173 -10
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +22 -0
- package/foundation/doc-compiler/stored-docs.mjs +49 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/gather-cache.d.mts +25 -4
- package/foundation/fs/gather-cache.mjs +163 -53
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +60 -0
- package/foundation/fs/kept-tree.mjs +154 -0
- package/foundation/fs/module-loader.d.mts +18 -2
- package/foundation/fs/module-loader.mjs +92 -20
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/render/embedded-imports.d.mts +5 -4
- package/foundation/render/embedded-imports.mjs +7 -16
- package/foundation/render/file-header.d.mts +66 -0
- package/foundation/render/file-header.mjs +118 -0
- package/foundation/render/host-answer.d.mts +18 -0
- package/foundation/render/host-answer.mjs +46 -0
- package/foundation/render/host-exit.d.mts +1 -0
- package/foundation/render/host-exit.mjs +6 -1
- package/foundation/render/html-reader.d.mts +55 -2
- package/foundation/render/html-reader.mjs +145 -26
- package/foundation/render/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +83 -13
- package/foundation/render/render-page.d.mts +34 -2
- package/foundation/render/render-page.mjs +210 -29
- package/foundation/render/source-block.d.mts +73 -6
- package/foundation/render/source-block.mjs +170 -19
- package/foundation/render/ts-paths.d.mts +53 -6
- package/foundation/render/ts-paths.mjs +286 -41
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +12 -1
- package/foundation/response/error-codes.mjs +10 -0
- package/foundation/text/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +16 -3
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +13 -0
- package/host/index.mjs +8 -6
- package/package.json +6 -6
|
@@ -16,7 +16,7 @@ export const doc = {
|
|
|
16
16
|
summary:
|
|
17
17
|
'Render a page to one self-contained HTML file, or turn a rendered file back into a page.',
|
|
18
18
|
description:
|
|
19
|
-
"Renders the page module's default export on the server with the project's own React and Astryx components (outside a project, with the Astryx, React and StyleX the CLI runs with), and writes ONE static HTML file that needs nothing beside it: the page's own StyleX styles are compiled, Core's stylesheets are cut to the rules the markup uses (layer order, custom properties and keyframes kept), local images become data: URIs, and the page's source is embedded so it can be given back exactly. The file runs no script and loads nothing from the network, so it works inside a sandboxed frame with a strict content security policy, and its colors follow the viewer's light or dark scheme. Warnings name anything that may differ from what the author meant, such as a component that did not render the text it was given. With `reverse
|
|
19
|
+
"Renders the page module's default export on the server with the project's own React and Astryx components (outside a project, with the Astryx, React and StyleX the CLI runs with), and writes ONE static HTML file that needs nothing beside it: the page's own StyleX styles are compiled, Core's stylesheets are cut to the rules the markup uses (layer order, custom properties and keyframes kept), local images become data: URIs, and the page's source is embedded so it can be given back exactly. The file runs no script and loads nothing from the network, so it works inside a sandboxed frame with a strict content security policy, and its colors follow the viewer's light or dark scheme. Warnings name anything that may differ from what the author meant, such as a component that did not render the text it was given. The file opens with a plain note for its next reader, a person or an agent: the CLI version and render format that made it, the page's path, the files it carries, the packages and versions it rendered with, and the exact commands that give the page back and render it again; the embedded source records the same facts and the markup as rendered. With `reverse` (the way back, or unrender), it writes the embedded source back byte for byte, and only the files a render embeds: the page and the local modules, stylesheets, JSON files and images it imports, into a new folder; it also reports the render format, the CLI version and packages that rendered the file, and whether someone changed the markup after the render, naming each run of text that changed and where the old text sits in the restored source (the restored files stay the page as rendered); a file with Astryx markup but no embedded source is rebuilt from its component class names and data attributes (text and layout only); any other file is refused. Experimental: it may change or be removed in a patch release.",
|
|
20
20
|
importPath: '@astryxdesign/cli/api/experimental',
|
|
21
21
|
signature:
|
|
22
22
|
'render(file: string, options?: RenderOptions): Promise<RenderPageResponse | RenderReverseResponse>',
|
|
@@ -29,6 +29,9 @@ export const doc = {
|
|
|
29
29
|
'snapshot',
|
|
30
30
|
'self-contained',
|
|
31
31
|
'reverse',
|
|
32
|
+
'unrender',
|
|
33
|
+
'restore',
|
|
34
|
+
'round trip',
|
|
32
35
|
],
|
|
33
36
|
params: [
|
|
34
37
|
{
|
|
@@ -77,7 +80,7 @@ export const doc = {
|
|
|
77
80
|
{
|
|
78
81
|
type: 'render.reverse',
|
|
79
82
|
description:
|
|
80
|
-
"How the page came back (`embedded`, exact; or `rebuilt`, text and layout only), the files written, and for a rebuilt page the components it uses and what could not be rebuilt.",
|
|
83
|
+
"How the page came back (`embedded`, exact; or `rebuilt`, text and layout only), the files written; for an embedded page the render format, the CLI version and packages that rendered it, and whether its markup changed after the render, with each text change; for a rebuilt page the components it uses and what could not be rebuilt.",
|
|
81
84
|
},
|
|
82
85
|
],
|
|
83
86
|
throws: [
|
|
@@ -87,6 +90,7 @@ export const doc = {
|
|
|
87
90
|
when: 'the file or `out` has the wrong kind of extension, `out` is the input itself, `title` is given with `reverse`, or `overwrite` without it; with `reverse`, the page would land under a configuration name (`vite.config.ts`) or where a test, story or benchmark runner would run it (judged from the repository root)',
|
|
88
91
|
},
|
|
89
92
|
{code: 'ERR_FILE_NOT_FOUND', when: 'the file, or a local file the page imports, does not exist'},
|
|
93
|
+
{code: 'ERR_READ_FAILED', when: 'the file is there but cannot be read: no read permission, a folder or a pipe given as the file, or another file-system error; the message names the reason'},
|
|
90
94
|
{code: 'ERR_FILE_EXISTS', when: 'rendering would replace an existing file a render did not write, reversing would replace an existing file and `overwrite` is not set, or an existing file the project protects (generated, vendored or ignored) would be replaced, which `overwrite` never does'},
|
|
91
95
|
{code: 'ERR_WRITE_FAILED', when: 'a file cannot be written, such as when `out` names a folder; with `reverse`, every file is written or none is'},
|
|
92
96
|
{code: 'ERR_RENDER_COMPILE', when: 'the page does not compile, or a stylesheet it imports is not valid CSS (the message names the file)'},
|
|
@@ -101,7 +105,11 @@ export const doc = {
|
|
|
101
105
|
code: 'ERR_RENDER_NOT_ASTRYX',
|
|
102
106
|
when: 'reversing a file a render did not write, with no embedded source and no Astryx markup; the suggestion is `astryx build "<what the page is>"`',
|
|
103
107
|
},
|
|
104
|
-
{code: 'ERR_RENDER_SOURCE_DAMAGED', when: 'reversing a file a render wrote whose embedded source was removed (and that has no Astryx components to rebuild from), a file whose embedded source is damaged, lists a path twice, carries a module, stylesheet or JSON file the page does not reach through its imports, or an image, font or media file whose bytes are not one, or carries a file a render never embeds (a dotfile or dot-folder, `node_modules`, a package manifest, lockfile or tool configuration, or any kind but a page module, stylesheet, JSON or image)'},
|
|
108
|
+
{code: 'ERR_RENDER_SOURCE_DAMAGED', when: 'reversing a file a render wrote whose embedded source was removed (and that has no Astryx components to rebuild from), a file a render wrote that ends before its embedded source, a file that holds merge conflict markers, a file whose embedded source is cut short or damaged (or names a CLI version that is not a release version), lists a path twice, carries a module, stylesheet or JSON file the page does not reach through its imports, or an image, font or media file whose bytes are not one, or carries a file a render never embeds (a dotfile or dot-folder, `node_modules`, a package manifest, lockfile or tool configuration, or any kind but a page module, stylesheet, JSON or image)'},
|
|
109
|
+
{
|
|
110
|
+
code: 'ERR_RENDER_NEWER_FORMAT',
|
|
111
|
+
when: 'reversing a file in a newer render format than this CLI reads; the message and the suggestion name the CLI version that wrote it',
|
|
112
|
+
},
|
|
105
113
|
{code: 'ERR_PATH_TRAVERSAL', when: 'a file would be written outside the current folder (symlinks followed), or through a symbolic link: `out`, or with `reverse` the page or an embedded file; or, with `reverse`, a file other than the page would go into a folder that already exists'},
|
|
106
114
|
],
|
|
107
115
|
examples: [
|
|
@@ -37,6 +37,28 @@ export type RenderWarning = {
|
|
|
37
37
|
*/
|
|
38
38
|
message: string;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* A run of text in a rendered file that differs from the text the render
|
|
42
|
+
* wrote: someone edited the HTML after the render.
|
|
43
|
+
*/
|
|
44
|
+
export type RenderEdit = {
|
|
45
|
+
/**
|
|
46
|
+
* - The text as rendered; null for text added after the render.
|
|
47
|
+
*/
|
|
48
|
+
was: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* - The text the file holds now; null for text removed after the render.
|
|
51
|
+
*/
|
|
52
|
+
now: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* - The restored module that holds the text as rendered, when it appears there exactly once.
|
|
55
|
+
*/
|
|
56
|
+
file?: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* - The line of `file` where that text starts.
|
|
59
|
+
*/
|
|
60
|
+
line?: number | undefined;
|
|
61
|
+
};
|
|
40
62
|
/**
|
|
41
63
|
* `astryx --json experimental render <page>`.
|
|
42
64
|
*/
|
|
@@ -70,5 +92,13 @@ export type RenderReverseResponse = {
|
|
|
70
92
|
elements?: number | undefined;
|
|
71
93
|
unknown?: string[] | undefined;
|
|
72
94
|
omitted?: string[] | undefined;
|
|
95
|
+
format?: number | undefined;
|
|
96
|
+
renderedBy?: string | undefined;
|
|
97
|
+
packages?: string[] | undefined;
|
|
98
|
+
title?: string | undefined;
|
|
99
|
+
edited?: boolean | undefined;
|
|
100
|
+
stylesEdited?: boolean | undefined;
|
|
101
|
+
edits?: RenderEdit[] | undefined;
|
|
102
|
+
moreEdits?: number | undefined;
|
|
73
103
|
};
|
|
74
104
|
};
|
|
@@ -26,6 +26,17 @@
|
|
|
26
26
|
* @property {string} message - What happened and what to do, in one sentence.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A run of text in a rendered file that differs from the text the render
|
|
31
|
+
* wrote: someone edited the HTML after the render.
|
|
32
|
+
* @experimental May change or be removed in a patch release.
|
|
33
|
+
* @typedef {object} RenderEdit
|
|
34
|
+
* @property {string | null} was - The text as rendered; null for text added after the render.
|
|
35
|
+
* @property {string | null} now - The text the file holds now; null for text removed after the render.
|
|
36
|
+
* @property {string} [file] - The restored module that holds the text as rendered, when it appears there exactly once.
|
|
37
|
+
* @property {number} [line] - The line of `file` where that text starts.
|
|
38
|
+
*/
|
|
39
|
+
|
|
29
40
|
/**
|
|
30
41
|
* `astryx --json experimental render <page>`.
|
|
31
42
|
* @experimental May change or be removed in a patch release.
|
|
@@ -59,6 +70,14 @@
|
|
|
59
70
|
* @property {number} [data.elements] - Rebuilt only: how many component elements were rebuilt.
|
|
60
71
|
* @property {string[]} [data.unknown] - Rebuilt only: Astryx class names no installed component claims; their content is kept as plain elements.
|
|
61
72
|
* @property {string[]} [data.omitted] - Rebuilt only: component kinds left out because the markup cannot give them back (such as icons).
|
|
73
|
+
* @property {number} [data.format] - Embedded only: the render format of the file's embedded source.
|
|
74
|
+
* @property {string} [data.renderedBy] - Embedded only: the version of the CLI that rendered the file, when the file names it.
|
|
75
|
+
* @property {string[]} [data.packages] - Embedded only, when the file records them: the packages the page rendered with, as `name@version`.
|
|
76
|
+
* @property {string} [data.title] - Embedded only: the title given with --title when the page was rendered, which a render again needs too.
|
|
77
|
+
* @property {boolean} [data.edited] - Embedded only, when the file records the page as rendered: whether someone changed its markup, title or styles after the render. The restored files are always the page as rendered, without those changes.
|
|
78
|
+
* @property {boolean} [data.stylesEdited] - With `edited`: whether the styles (the <style> element) changed after the render.
|
|
79
|
+
* @property {RenderEdit[]} [data.edits] - When `edited`: each run of text that changed after the render (at most 50, the title first), so the change can be made in the source. Empty when only styles, attributes, elements or formatting changed.
|
|
80
|
+
* @property {number} [data.moreEdits] - When `edits` stops at 50: how many more changes there are.
|
|
62
81
|
*/
|
|
63
82
|
|
|
64
83
|
export {};
|
package/api/search/ORDERING.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
`spec:AST-083` owns search's result order; this file describes the data that implements it. Inside one score band, a searcher's static weights decide the order. Matches with the same score move together as one block, placed by the learned position of the block's first match: moving each one on its own breaks search's existing rules for tied matches. Inside a block, the lexical ranker's order holds, except below the first result: there a block of one domain puts a part of the first result first (its name words start with the first result's; at most two parts lead across an answer), then the match whose matched words are rarer in the catalog. Matches never cross bands or kinds. There is no model runtime: every number is a plain static value read at load time.
|
|
8
8
|
|
|
9
|
-
After that order, one fit pass reads the first ten results (`_fit-order.mjs`). The first result stays. The others split into runs of one band and kind. Inside a run, each match gets a fit to the whole query from
|
|
9
|
+
After that order, one fit pass reads the first ten results (`_fit-order.mjs`). The first result stays. The others split into runs of one band and kind. Inside a run, each match gets a fit to the whole query from the block picker's `matchOf` (`../build/blocks/blocks.mjs` with `blocks.weights.json`, over the weights' vocabulary) over the match's own docs: its name words, display name or title, description, and keywords. A match whose fit is under 1.7 times the run's median fit moves, in order, after the others in its run, unless its name spells two or more of the query's words. Such a match never moves down; it can still move up when others move after it. A run whose median fit is zero or less keeps its order. A query that is an entry's whole name skips the pass, as it skips the learned order. The pass always reads ten places before the limit cuts the answer. At the default limit, and at any limit of 10 or more, the set of results stays the same. A smaller limit shows the top of the new order, so it can show a different result. Build's loader (`loadBlockPicker` in `../build/_adapter.mjs`) reads and checks the block-picker weights for both commands. When the file is missing, unreadable, or not the picker's shape, the loader returns null and the pass keeps the order. The pass reads the weights only when a run holds two or more matches, and it decodes only the matrix rows that the query's words and those matches' docs use, so a search does not pay for the whole catalog.
|
|
10
10
|
|
|
11
11
|
## Files
|
|
12
12
|
|
|
@@ -130,25 +130,50 @@ function mentionPattern(term, t) {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
* Each
|
|
134
|
-
*
|
|
135
|
-
*
|
|
133
|
+
* Each candidate's names and keywords lowercased once, and its description,
|
|
134
|
+
* prose and guidance lowercased on first use: a search scores every candidate
|
|
135
|
+
* for every term and synonym. Keyed by the candidate object, so it goes when
|
|
136
|
+
* the catalog does. A candidate's name, aliases, keywords, description, prose
|
|
137
|
+
* and guidance must not change after its first score, as no catalog changes
|
|
138
|
+
* them: an edited candidate, including one in a stored index passed to
|
|
139
|
+
* `rankSearchIndex()` again, would still be scored on its first text.
|
|
140
|
+
* @type {WeakMap<object, {names: {name: string, lower: string, leaf: string}[], keywords: {kw: string, text: string, lower: string}[], description?: string, prose: (string | undefined)[], guidance: (string | undefined)[]}>}
|
|
136
141
|
*/
|
|
137
|
-
const
|
|
142
|
+
const prepared = new WeakMap();
|
|
138
143
|
|
|
139
|
-
/**
|
|
140
|
-
|
|
144
|
+
/** @param {any} candidate */
|
|
145
|
+
function prepare(candidate) {
|
|
146
|
+
let p = prepared.get(candidate);
|
|
147
|
+
if (p === undefined) {
|
|
148
|
+
const {name, aliases = [], keywords = []} = candidate;
|
|
149
|
+
p = {
|
|
150
|
+
names: [name, ...aliases.filter(Boolean)].map(n => {
|
|
151
|
+
const l = n.toLowerCase();
|
|
152
|
+
return {name: n, lower: l, leaf: l.slice(l.lastIndexOf('/') + 1)};
|
|
153
|
+
}),
|
|
154
|
+
keywords: keywords.map((/** @type {string} */ kw) => {
|
|
155
|
+
const text = String(kw);
|
|
156
|
+
return {kw, text, lower: text.toLowerCase()};
|
|
157
|
+
}),
|
|
158
|
+
description: undefined,
|
|
159
|
+
prose: [],
|
|
160
|
+
guidance: [],
|
|
161
|
+
};
|
|
162
|
+
prepared.set(candidate, p);
|
|
163
|
+
}
|
|
164
|
+
return p;
|
|
165
|
+
}
|
|
141
166
|
|
|
142
167
|
/**
|
|
143
|
-
* @param {string}
|
|
144
|
-
* @
|
|
168
|
+
* @param {(string | undefined)[]} memo
|
|
169
|
+
* @param {unknown[]} blobs
|
|
170
|
+
* @param {number} i
|
|
145
171
|
*/
|
|
146
|
-
function
|
|
147
|
-
let out =
|
|
172
|
+
function loweredAt(memo, blobs, i) {
|
|
173
|
+
let out = memo[i];
|
|
148
174
|
if (out === undefined) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
lowered.set(text, out);
|
|
175
|
+
out = String(blobs[i]).toLowerCase();
|
|
176
|
+
memo[i] = out;
|
|
152
177
|
}
|
|
153
178
|
return out;
|
|
154
179
|
}
|
|
@@ -196,10 +221,7 @@ export function scoreCandidate(
|
|
|
196
221
|
{fuzzy = true, joins = true, part = false, synonym = false} = {},
|
|
197
222
|
) {
|
|
198
223
|
const {
|
|
199
|
-
name,
|
|
200
|
-
aliases = [],
|
|
201
224
|
domain,
|
|
202
|
-
keywords = [],
|
|
203
225
|
description = '',
|
|
204
226
|
prose = [],
|
|
205
227
|
guidance = [],
|
|
@@ -208,6 +230,7 @@ export function scoreCandidate(
|
|
|
208
230
|
} = candidate;
|
|
209
231
|
// The term's forms, worked out once for every word below.
|
|
210
232
|
const t = termWords(term);
|
|
233
|
+
const p = prepare(candidate);
|
|
211
234
|
let best = 0;
|
|
212
235
|
let reason = '';
|
|
213
236
|
/** @type {'partial' | 'keyword' | false} */
|
|
@@ -229,11 +252,13 @@ export function scoreCandidate(
|
|
|
229
252
|
// ── Name signals ────────────────────────────────────────────────
|
|
230
253
|
// An alias is a name too: a theme answers to its display name as well as
|
|
231
254
|
// its slug.
|
|
232
|
-
for (const
|
|
233
|
-
|
|
255
|
+
for (const {
|
|
256
|
+
name: candidateName,
|
|
257
|
+
lower: nameLower,
|
|
258
|
+
leaf: leafLower,
|
|
259
|
+
} of p.names) {
|
|
234
260
|
// A placed guide's name is its route, and the route's last segment is its
|
|
235
261
|
// name too, as a flat topic's is: `codemods` is authoring/building-blocks/codemods.
|
|
236
|
-
const leafLower = nameLower.slice(nameLower.lastIndexOf('/') + 1);
|
|
237
262
|
|
|
238
263
|
// A plural of the name is the name: `integration` is the `integrations`
|
|
239
264
|
// guides, `tab` the `tabs` doc.
|
|
@@ -315,8 +340,7 @@ export function scoreCandidate(
|
|
|
315
340
|
|
|
316
341
|
// ── Keyword signals ─────────────────────────────────────────────
|
|
317
342
|
const termJoined = joined(term);
|
|
318
|
-
for (const kw of keywords) {
|
|
319
|
-
const kwLower = String(kw).toLowerCase();
|
|
343
|
+
for (const {kw, text: kwText, lower: kwLower} of p.keywords) {
|
|
320
344
|
// A one-word keyword typed as separate words is the keyword: `number
|
|
321
345
|
// field` is `numberfield`. Only a
|
|
322
346
|
// lowercase keyword, one an author declares for a reader to type: a
|
|
@@ -326,12 +350,7 @@ export function scoreCandidate(
|
|
|
326
350
|
consider(90, `keyword "${kw}"`);
|
|
327
351
|
continue;
|
|
328
352
|
}
|
|
329
|
-
if (
|
|
330
|
-
joins &&
|
|
331
|
-
domain !== 'doc' &&
|
|
332
|
-
/\s/.test(term) &&
|
|
333
|
-
String(kw) === termJoined
|
|
334
|
-
) {
|
|
353
|
+
if (joins && domain !== 'doc' && /\s/.test(term) && kwText === termJoined) {
|
|
335
354
|
consider(90, `keyword "${kw}"`, 'keyword');
|
|
336
355
|
continue;
|
|
337
356
|
}
|
|
@@ -368,12 +387,12 @@ export function scoreCandidate(
|
|
|
368
387
|
// so "chart" matches "charts" and "filter" matches "filtering".
|
|
369
388
|
if (term.length >= 3) {
|
|
370
389
|
const re = mentionPattern(term, t);
|
|
371
|
-
if (description && re.test(
|
|
390
|
+
if (description && re.test((p.description ??= description.toLowerCase()))) {
|
|
372
391
|
consider(50, `description mentions "${term}"`);
|
|
373
392
|
} else {
|
|
374
393
|
let matchedProse = false;
|
|
375
|
-
for (
|
|
376
|
-
if (
|
|
394
|
+
for (let i = 0; i < prose.length; i++) {
|
|
395
|
+
if (prose[i] && re.test(loweredAt(p.prose, prose, i))) {
|
|
377
396
|
consider(50, `docs mention "${term}"`);
|
|
378
397
|
matchedProse = true;
|
|
379
398
|
break;
|
|
@@ -383,8 +402,8 @@ export function scoreCandidate(
|
|
|
383
402
|
// so the term appearing there is weaker evidence than the component's own
|
|
384
403
|
// summary. Only consulted when nothing stronger matched.
|
|
385
404
|
if (!matchedProse) {
|
|
386
|
-
for (
|
|
387
|
-
if (
|
|
405
|
+
for (let i = 0; i < guidance.length; i++) {
|
|
406
|
+
if (guidance[i] && re.test(loweredAt(p.guidance, guidance, i))) {
|
|
388
407
|
consider(45, `guidance mentions "${term}"`);
|
|
389
408
|
break;
|
|
390
409
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
* @output the same response with the same results, maybe in a new order
|
|
9
9
|
* @position api/search; rankWith (_main-searcher.mjs) runs it after
|
|
10
10
|
* orderMatches, with the weights the adapter loads (loadSearchData) through
|
|
11
|
-
* build's own loader. The fit is
|
|
12
|
-
* (build/blocks/blocks.mjs)
|
|
13
|
-
* never saw is scored from its own docs the same way. Without readable
|
|
11
|
+
* build's own loader. The fit is the block picker's `matchOf`
|
|
12
|
+
* (build/blocks/blocks.mjs) over the shipped weights' vocabulary, so an entry
|
|
13
|
+
* the weights never saw is scored from its own docs the same way. Without readable
|
|
14
14
|
* weights the order stays.
|
|
15
15
|
*/
|
|
16
16
|
|
package/api/search/_result.d.mts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* (spec AST-081 FR3).
|
|
18
18
|
*/
|
|
19
19
|
export function toResult(c: Candidate, score: number, reason: string, matchedTerms: number, queryTerms: number, outside?: boolean): {
|
|
20
|
-
domain: "
|
|
20
|
+
domain: "component" | "template" | "doc" | "theme" | "hook";
|
|
21
21
|
name: string;
|
|
22
22
|
package: string | undefined;
|
|
23
23
|
score: number;
|
|
@@ -27,7 +27,7 @@ export function toResult(c: Candidate, score: number, reason: string, matchedTer
|
|
|
27
27
|
deprecated?: import("../../authoring/index.js").ComponentDeprecation | undefined;
|
|
28
28
|
import: string | undefined;
|
|
29
29
|
command: string;
|
|
30
|
-
domain: "
|
|
30
|
+
domain: "component" | "template" | "doc" | "theme" | "hook";
|
|
31
31
|
name: string;
|
|
32
32
|
package: string | undefined;
|
|
33
33
|
score: number;
|
|
@@ -39,7 +39,7 @@ export function toResult(c: Candidate, score: number, reason: string, matchedTer
|
|
|
39
39
|
command: string;
|
|
40
40
|
section?: string | undefined;
|
|
41
41
|
name: string;
|
|
42
|
-
domain: "
|
|
42
|
+
domain: "component" | "template" | "doc" | "theme" | "hook";
|
|
43
43
|
package: string | undefined;
|
|
44
44
|
score: number;
|
|
45
45
|
reason: string;
|
|
@@ -48,7 +48,7 @@ export function toResult(c: Candidate, score: number, reason: string, matchedTer
|
|
|
48
48
|
displayName: string | undefined;
|
|
49
49
|
kind: "page" | "block" | undefined;
|
|
50
50
|
command: string;
|
|
51
|
-
domain: "
|
|
51
|
+
domain: "component" | "template" | "doc" | "theme" | "hook";
|
|
52
52
|
name: string;
|
|
53
53
|
package: string | undefined;
|
|
54
54
|
score: number;
|
|
@@ -57,7 +57,7 @@ export function toResult(c: Candidate, score: number, reason: string, matchedTer
|
|
|
57
57
|
} | {
|
|
58
58
|
displayName: string | undefined;
|
|
59
59
|
command: string;
|
|
60
|
-
domain: "
|
|
60
|
+
domain: "component" | "template" | "doc" | "theme" | "hook";
|
|
61
61
|
name: string;
|
|
62
62
|
package: string | undefined;
|
|
63
63
|
score: number;
|
package/api/search/_score.d.mts
CHANGED
|
@@ -7,12 +7,17 @@
|
|
|
7
7
|
* @param {string} tok
|
|
8
8
|
* @param {Candidate} candidate
|
|
9
9
|
* @param {{fuzzy?: boolean, part?: boolean}} [opts] - see scoreCandidate
|
|
10
|
+
* @param {{score: number, reason: string} | null} [direct] - scoreCandidate(tok,
|
|
11
|
+
* candidate, opts), when the caller already holds it
|
|
10
12
|
* @returns {{score: number, reason: string} | null}
|
|
11
13
|
*/
|
|
12
14
|
export function bestForToken(tok: string, candidate: Candidate, opts?: {
|
|
13
15
|
fuzzy?: boolean;
|
|
14
16
|
part?: boolean;
|
|
15
|
-
}
|
|
17
|
+
}, direct?: {
|
|
18
|
+
score: number;
|
|
19
|
+
reason: string;
|
|
20
|
+
} | null): {
|
|
16
21
|
score: number;
|
|
17
22
|
reason: string;
|
|
18
23
|
} | null;
|
package/api/search/_score.mjs
CHANGED
|
@@ -40,10 +40,13 @@ const MIN_TOKEN_SCORE = 50;
|
|
|
40
40
|
* @param {string} tok
|
|
41
41
|
* @param {Candidate} candidate
|
|
42
42
|
* @param {{fuzzy?: boolean, part?: boolean}} [opts] - see scoreCandidate
|
|
43
|
+
* @param {{score: number, reason: string} | null} [direct] - scoreCandidate(tok,
|
|
44
|
+
* candidate, opts), when the caller already holds it
|
|
43
45
|
* @returns {{score: number, reason: string} | null}
|
|
44
46
|
*/
|
|
45
|
-
export function bestForToken(tok, candidate, opts = {}) {
|
|
46
|
-
let best =
|
|
47
|
+
export function bestForToken(tok, candidate, opts = {}, direct = undefined) {
|
|
48
|
+
let best =
|
|
49
|
+
direct !== undefined ? direct : scoreCandidate(tok, candidate, opts);
|
|
47
50
|
const syns = SYNONYM_INDEX.get(tok);
|
|
48
51
|
if (syns) {
|
|
49
52
|
for (const s of syns) {
|
|
@@ -131,8 +134,17 @@ export function scoreQuery(
|
|
|
131
134
|
* single words), but if stopwords left exactly one DIFFERENT token (e.g.
|
|
132
135
|
* "pricing page" → "pricing"), score that token too and take the stronger. */
|
|
133
136
|
const fewTokens = () => {
|
|
137
|
+
// A one-word query whose token is the query itself scores exactly as
|
|
138
|
+
// `full` did: `joins` only matters for a term with a space in it.
|
|
134
139
|
const single =
|
|
135
|
-
tokens.length === 1
|
|
140
|
+
tokens.length === 1
|
|
141
|
+
? bestForToken(
|
|
142
|
+
tokens[0],
|
|
143
|
+
candidate,
|
|
144
|
+
{fuzzy},
|
|
145
|
+
tokens[0] === term && !/\s/.test(term) ? full : undefined,
|
|
146
|
+
)
|
|
147
|
+
: null;
|
|
136
148
|
if (full && (!single || full.score >= single.score)) return asFull(full);
|
|
137
149
|
return single ? asFull(single) : null;
|
|
138
150
|
};
|
package/api/search/search.d.mts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export function search(query: string, options?: {
|
|
15
15
|
cwd?: string | undefined;
|
|
16
|
-
type?: "
|
|
16
|
+
type?: "component" | "template" | "doc" | "theme" | "hook" | undefined;
|
|
17
17
|
limit?: number | undefined;
|
|
18
18
|
}): Promise<import("./search.type.mjs").SearchResponse>;
|
|
19
19
|
/**
|
package/api/theme/_adapter.mjs
CHANGED
|
@@ -1186,6 +1186,7 @@ async function writeThemeApp(
|
|
|
1186
1186
|
stylesheet: theme.stylesheet,
|
|
1187
1187
|
...(theme.fontStylesheet ? {fontStylesheet: theme.fontStylesheet} : {}),
|
|
1188
1188
|
source: theme.source,
|
|
1189
|
+
...(theme.mode ? {mode: theme.mode} : {}),
|
|
1189
1190
|
})),
|
|
1190
1191
|
default: defaultSlug,
|
|
1191
1192
|
modulePath: prepared.module.path,
|
|
@@ -1194,6 +1195,15 @@ async function writeThemeApp(
|
|
|
1194
1195
|
slug,
|
|
1195
1196
|
changed,
|
|
1196
1197
|
firstAdd: action === 'add' && !state.configured,
|
|
1198
|
+
// The module lists one-mode themes' modes for the first time, after
|
|
1199
|
+
// the app was wired without them: the wiring takes the mode now.
|
|
1200
|
+
...(state.configured &&
|
|
1201
|
+
/\bexport const themeModes\b/.test(prepared.moduleContents) &&
|
|
1202
|
+
!/\bexport const themeModes\b/.test(
|
|
1203
|
+
String(prepared.module.expectedOriginal ?? ''),
|
|
1204
|
+
)
|
|
1205
|
+
? {wireModes: true}
|
|
1206
|
+
: {}),
|
|
1197
1207
|
},
|
|
1198
1208
|
...(notes.length > 0 ? {notes} : {}),
|
|
1199
1209
|
},
|
|
@@ -26,6 +26,15 @@
|
|
|
26
26
|
* @returns {() => any}
|
|
27
27
|
*/
|
|
28
28
|
export function lazyRootModule(resolveFile: () => string | null): () => any;
|
|
29
|
+
/**
|
|
30
|
+
* `target` spelled through real directories: the deepest ancestor that exists
|
|
31
|
+
* is resolved through its symlinks, and the missing rest is appended as given.
|
|
32
|
+
* The build confines its outputs by it, and the theme editor's compile guard
|
|
33
|
+
* reads paths through it too, so both read a path the same way.
|
|
34
|
+
* @param {string} target absolute path
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
37
|
+
export function realLocation(target: string): string;
|
|
29
38
|
/**
|
|
30
39
|
* Why `theme build` has no Core to generate with, and the fix for where it
|
|
31
40
|
* ran: the Astryx repository builds Core, an app installs it, and an installed
|
|
@@ -57,6 +66,34 @@ export function normalizeThemeBuildForCompare(content: string): string;
|
|
|
57
66
|
* @returns {boolean}
|
|
58
67
|
*/
|
|
59
68
|
export function isPrivateVarRefusal(error: unknown): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The marks a file's leading comment carries (see `generatedMark`): a theme
|
|
71
|
+
* build's output, or a file the theme editor writes, with the command it
|
|
72
|
+
* names. The one reader build and doctor share.
|
|
73
|
+
* @param {string} source the start of the file
|
|
74
|
+
* @param {string} [file] its path, for a mark that names no exact command
|
|
75
|
+
*/
|
|
76
|
+
export function fileMark(source: string, file?: string): {
|
|
77
|
+
kind: "build" | "editor";
|
|
78
|
+
command: string;
|
|
79
|
+
} | null;
|
|
80
|
+
/**
|
|
81
|
+
* The command a file's leading comment says writes it, when another CLI
|
|
82
|
+
* command generates it (the theme editor's settings module or app copy):
|
|
83
|
+
* the exact command its mark names. Null for a theme build's own output and
|
|
84
|
+
* a file without a mark, such as a theme source of one's own.
|
|
85
|
+
* @param {string} file
|
|
86
|
+
* @returns {string | null}
|
|
87
|
+
*/
|
|
88
|
+
export function generatedFileCommand(file: string): string | null;
|
|
89
|
+
/**
|
|
90
|
+
* The command that writes `file`: from its own mark, or, when it is
|
|
91
|
+
* missing, from the files beside it (see `missingGeneratedCommand`); null
|
|
92
|
+
* otherwise.
|
|
93
|
+
* @param {string} file
|
|
94
|
+
* @returns {string | null}
|
|
95
|
+
*/
|
|
96
|
+
export function generatedSourceCommand(file: string): string | null;
|
|
60
97
|
/**
|
|
61
98
|
* The files a theme source is made of: the source and every local file it
|
|
62
99
|
* imports, directly or through other local files, read from their import
|
|
@@ -129,6 +166,13 @@ export function writeDeferredBuildOutputs(deferred: Array<Array<{
|
|
|
129
166
|
* @returns {string}
|
|
130
167
|
*/
|
|
131
168
|
export function importSpecifier(relDir: string, base: string): string;
|
|
169
|
+
/**
|
|
170
|
+
* A one-mode `colorModes` value (`['light']` or `['dark']`), or null for
|
|
171
|
+
* anything else: a theme with both modes needs no export.
|
|
172
|
+
* @param {unknown} value
|
|
173
|
+
* @returns {['light'] | ['dark'] | null}
|
|
174
|
+
*/
|
|
175
|
+
export function oneColorMode(value: unknown): ["light"] | ["dark"] | null;
|
|
132
176
|
/**
|
|
133
177
|
* The package a theme load failed on because it is not installed.
|
|
134
178
|
* @param {unknown} error
|
|
@@ -359,6 +403,8 @@ export type ThemeBuildTrailer = {
|
|
|
359
403
|
* output must stay inside, for a scratch build; `commandWords` names the
|
|
360
404
|
* command in the rebuild hint; `prepareFamily`, `familyLoader`, and
|
|
361
405
|
* `familyInterception` make the build a family member's plan.
|
|
406
|
+
* `colorModes` is the one color mode a calling command knows the theme has
|
|
407
|
+
* (the theme editor, from its settings), written into the built module.
|
|
362
408
|
*/
|
|
363
409
|
export type ThemeBuildHandOff = {
|
|
364
410
|
prepareFamily?: boolean;
|
|
@@ -374,4 +420,5 @@ export type ThemeBuildHandOff = {
|
|
|
374
420
|
group: string;
|
|
375
421
|
build: string;
|
|
376
422
|
};
|
|
423
|
+
colorModes?: ["light"] | ["dark"] | null;
|
|
377
424
|
};
|