@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69
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 +64 -63
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +122 -6
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.mjs +23 -14
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +3 -3
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +62 -3
- package/api/build/kit/answer.mjs +2 -3
- package/api/build/kit/signals.d.mts +10 -0
- package/api/build/kit/signals.mjs +15 -2
- package/api/component/detail/blocks/blocks.mjs +2 -1
- package/api/discover/_adapter.d.mts +57 -6
- package/api/discover/_adapter.mjs +278 -49
- package/api/discover/_catalog-view.d.mts +7 -0
- package/api/discover/_catalog-view.mjs +10 -1
- package/api/discover/detail/detail.d.mts +3 -2
- package/api/discover/detail/detail.mjs +3 -2
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/discover.d.mts +24 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +146 -25
- package/api/discover/discover.type.d.mts +6 -4
- package/api/discover/discover.type.mjs +6 -4
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +290 -70
- package/api/docs/_entry-names.mjs +4 -3
- package/api/doctor/_adapter.d.mts +43 -3
- package/api/doctor/_adapter.mjs +142 -18
- package/api/doctor/built-checks.d.mts +30 -3
- package/api/doctor/built-checks.mjs +132 -5
- package/api/doctor/doctor.d.mts +93 -6
- package/api/doctor/doctor.doc.mjs +2 -2
- package/api/doctor/doctor.mjs +524 -33
- package/api/doctor/doctor.type.d.mts +2 -1
- package/api/doctor/doctor.type.mjs +2 -1
- package/api/doctor/theme-checks.d.mts +19 -0
- package/api/doctor/theme-checks.mjs +74 -6
- package/api/hook/hook.type.d.mts +1 -1
- package/api/hook/hook.type.mjs +1 -1
- package/api/hook/list/list.mjs +11 -7
- package/api/icon/_adapter.d.mts +2 -1
- package/api/icon/_adapter.mjs +10 -15
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +32 -1
- package/api/icon/icon.type.mjs +19 -3
- package/api/icon/list/list.mjs +4 -1
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +18 -8
- package/api/icon/search/search.d.mts +26 -3
- package/api/icon/search/search.mjs +155 -9
- package/api/init/_adapter.d.mts +14 -0
- package/api/init/_adapter.mjs +26 -4
- package/api/init/init.d.mts +1 -1
- package/api/init/init.doc.mjs +2 -2
- package/api/init/init.mjs +1 -1
- package/api/init/init.type.d.mts +29 -1
- package/api/init/init.type.mjs +14 -1
- package/api/init/run/run.d.mts +11 -1
- package/api/init/run/run.mjs +84 -5
- package/api/integration/_adapter.d.mts +5 -4
- package/api/integration/_adapter.mjs +7 -5
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +8 -9
- package/api/integration/validate-integration.d.mts +1 -1
- package/api/integration/validate-integration.mjs +26 -24
- package/api/integration/validate-integration.type.d.mts +5 -2
- package/api/integration/validate-integration.type.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.d.mts +4 -2
- package/api/render/_adapter.mjs +62 -21
- package/api/render/render.doc.mjs +8 -5
- package/api/render/render.mjs +1 -1
- package/api/render/render.type.d.mts +2 -0
- package/api/render/render.type.mjs +2 -0
- package/api/search/ORDERING.md +2 -2
- package/api/search/_candidate-score.d.mts +3 -0
- package/api/search/_candidate-score.mjs +36 -3
- package/api/search/_gather-docs.mjs +29 -2
- package/api/search/_gather-templates.mjs +2 -1
- package/api/search/_main-searcher.mjs +13 -0
- package/api/search/_named-keywords.d.mts +2 -1
- package/api/search/_named-keywords.mjs +48 -6
- package/api/search/_order.d.mts +36 -1
- package/api/search/_order.mjs +141 -3
- package/api/swizzle/list/list.mjs +8 -1
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/template/copy/copy.mjs +3 -4
- package/api/template/list/list.mjs +2 -1
- package/api/template/show/show.mjs +2 -1
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +19 -1
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +1 -0
- package/api/theme/_adapter.mjs +3 -5
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/build/build.d.mts +4 -10
- package/api/theme/build/build.mjs +165 -116
- package/api/theme/build/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- package/api/theme/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/generator.mjs +24 -0
- package/api/theme/theme.type.d.mts +4 -2
- package/api/theme/theme.type.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +2 -2
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +100 -22
- package/api/theme-edit/_check.mjs +213 -43
- package/api/theme-edit/_color.d.mts +14 -0
- package/api/theme-edit/_color.mjs +22 -0
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +20 -2
- package/api/theme-edit/_context.mjs +157 -29
- package/api/theme-edit/_edit.mjs +426 -58
- package/api/theme-edit/_how-question.d.mts +14 -0
- package/api/theme-edit/_how-question.mjs +1541 -127
- package/api/theme-edit/_how.mjs +43 -0
- package/api/theme-edit/_missed.mjs +107 -27
- package/api/theme-edit/_normal.d.mts +18 -4
- package/api/theme-edit/_normal.mjs +84 -3
- package/api/theme-edit/_palette.d.mts +9 -0
- package/api/theme-edit/_palette.mjs +158 -33
- package/api/theme-edit/_part-words.mjs +16 -3
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +120 -36
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +255 -67
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +16 -1
- package/api/theme-edit/_settings.d.mts +116 -0
- package/api/theme-edit/_settings.mjs +1197 -58
- package/api/theme-edit/_tables.d.mts +16 -0
- package/api/theme-edit/_tables.mjs +34 -4
- package/api/theme-edit/theme-edit.type.d.mts +15 -2
- package/api/theme-edit/theme-edit.type.mjs +8 -6
- package/api/upgrade/_adapter.d.mts +46 -7
- package/api/upgrade/_adapter.mjs +110 -15
- package/api/upgrade/registry/registry.d.mts +6 -3
- package/api/upgrade/registry/registry.mjs +21 -6
- package/api/upgrade/run/run.mjs +23 -11
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +6 -6
- package/assets/docs/tree/problems.doc.mjs +3 -3
- package/assets/docs/tree/render-pages.doc.mjs +17 -3
- package/assets/docs/tree/share-a-page.doc.mjs +5 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +40 -5
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/installed-icon-set.doc.mjs +30 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +6 -2
- package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +3 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +2 -2
- package/assets/templates/pages/course-detail/page.tsx +1 -1
- package/assets/templates/pages/dashboard/page.tsx +24 -8
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
- package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
- package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
- package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
- package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
- package/assets/templates/pages/detail-page/page.tsx +22 -5
- package/assets/templates/pages/documentation/page.tsx +4 -2
- package/assets/templates/pages/documentation-design/page.tsx +5 -2
- package/assets/templates/pages/documentation-technical/page.tsx +4 -2
- package/assets/templates/pages/editor/page.tsx +28 -9
- package/assets/templates/pages/file-explorer/page.tsx +3 -1
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
- package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +1 -1
- package/assets/templates/pages/ide/page.tsx +7 -2
- package/assets/templates/pages/kanban-board/page.tsx +10 -4
- package/assets/templates/pages/library/page.tsx +31 -61
- package/assets/templates/pages/login/page.tsx +4 -2
- package/assets/templates/pages/login-card/page.tsx +4 -2
- package/assets/templates/pages/login-split/page.tsx +3 -2
- package/assets/templates/pages/login-sso/page.tsx +4 -4
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/product-detail/page.tsx +16 -4
- package/assets/templates/pages/product-gallery/page.tsx +1 -1
- package/assets/templates/pages/settings/page.tsx +10 -4
- package/assets/templates/pages/settings-dialog/page.tsx +5 -6
- package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -2
- package/assets/templates/pages/table-filter/page.tsx +21 -6
- package/assets/templates/pages/table-grouped/page.tsx +23 -2
- package/assets/templates/pages/table-inbox/page.tsx +82 -32
- package/assets/templates/pages/theme-showcase/page.tsx +3 -2
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +197 -4
- package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
- package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +69 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
- package/authoring/codemod/parse.d.mts +0 -36
- package/authoring/codemod/parse.mjs +62 -41
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/parse.d.mts +0 -47
- package/authoring/config/parse.mjs +128 -103
- package/authoring/config/type.ts +4 -3
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/discover/parse.d.mts +2 -2
- package/authoring/discover/parse.mjs +52 -38
- package/authoring/discover/type.ts +2 -1
- package/authoring/doctypes/_schema.d.mts +834 -950
- package/authoring/doctypes/_schema.mjs +863 -825
- package/authoring/doctypes/command/parse.mjs +2 -2
- package/authoring/doctypes/component/parse.mjs +2 -2
- package/authoring/doctypes/enum/parse.mjs +2 -2
- package/authoring/doctypes/hook/parse.mjs +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
- package/authoring/doctypes/icon-definition/parse.mjs +59 -43
- package/authoring/doctypes/icon-set/parse.d.mts +0 -75
- package/authoring/doctypes/icon-set/parse.mjs +239 -210
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/namespace/parse.mjs +2 -2
- package/authoring/doctypes/reference/parse.mjs +2 -2
- package/authoring/doctypes/schema/parse.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +0 -101
- package/authoring/doctypes/template/parse.mjs +131 -106
- package/authoring/doctypes/theme/parse.d.mts +0 -23
- package/authoring/doctypes/theme/parse.mjs +52 -36
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +20 -2
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.mjs +27 -13
- package/clients/cli/commands/component.mjs +14 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +20 -3
- package/clients/cli/commands/docs.doc.mjs +11 -9
- package/clients/cli/commands/docs.mjs +50 -21
- package/clients/cli/commands/experimental/icon.mjs +330 -227
- package/clients/cli/commands/experimental/render.mjs +16 -1
- package/clients/cli/commands/experimental/theme.mjs +42 -17
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-render.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- 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/init.doc.mjs +36 -24
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +53 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +46 -9
- package/clients/cli/commands/template.mjs +3 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +12 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +23 -17
- package/clients/cli/lib/base-gate.mjs +37 -5
- package/clients/cli/lib/define-command.mjs +82 -4
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/stray-option.mjs +27 -1
- package/clients/cli/lib/unknown-command.mjs +326 -11
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +49 -1
- package/foundation/agent-docs/agent-docs.mjs +108 -7
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core.d.mts +1 -1
- package/foundation/bases/core.mjs +3 -3
- package/foundation/bases/resolve.d.mts +4 -8
- package/foundation/bases/resolve.mjs +15 -21
- package/foundation/bases/state.d.mts +15 -9
- package/foundation/bases/state.mjs +33 -6
- package/foundation/config/project.d.mts +5 -4
- package/foundation/config/project.mjs +33 -17
- package/foundation/discovery/component-discovery.mjs +15 -28
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +12 -2
- package/foundation/discovery/icon-ranking.mjs +197 -10
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.d.mts +28 -0
- package/foundation/discovery/icon-set-discovery.mjs +42 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -11
- package/foundation/discovery/icon-set-writer.mjs +3 -29
- package/foundation/discovery/module-exports.d.mts +1 -1
- package/foundation/discovery/module-exports.mjs +136 -33
- package/foundation/discovery/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/template-adapter.d.mts +1 -1
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icons.d.mts +45 -2
- package/foundation/discovery/template-icons.mjs +26 -54
- package/foundation/discovery/template-needs.d.mts +28 -2
- package/foundation/discovery/template-needs.mjs +92 -11
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.mjs +2 -4
- package/foundation/doc-compiler/parse-readable.mjs +4 -3
- package/foundation/doc-compiler/stored-docs.d.mts +13 -0
- package/foundation/doc-compiler/stored-docs.mjs +74 -3
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- package/foundation/fs/gather-cache.d.mts +23 -0
- package/foundation/fs/gather-cache.mjs +94 -2
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/read-record.mjs +9 -5
- package/foundation/identity/package-names.d.mts +18 -0
- package/foundation/identity/package-names.mjs +19 -0
- package/foundation/identity/providers.mjs +3 -2
- package/foundation/integrations/icon-features.d.mts +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- package/foundation/integrations/integrations.d.mts +13 -1
- package/foundation/integrations/integrations.mjs +47 -6
- package/foundation/integrations/pack-state.d.mts +21 -0
- package/foundation/integrations/pack-state.mjs +42 -19
- package/foundation/integrations/validate-contributions.d.mts +11 -3
- package/foundation/integrations/validate-contributions.mjs +51 -13
- package/foundation/release/cache.d.mts +13 -1
- package/foundation/release/cache.mjs +94 -14
- package/foundation/release/notices.d.mts +15 -0
- package/foundation/release/notices.mjs +111 -7
- package/foundation/release/project.d.mts +3 -4
- package/foundation/release/project.mjs +5 -6
- package/foundation/render/client-bundle.d.mts +126 -0
- package/foundation/render/client-bundle.mjs +565 -0
- package/foundation/render/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- package/foundation/render/embedded-imports.d.mts +4 -3
- package/foundation/render/embedded-imports.mjs +13 -8
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.mjs +5 -4
- package/foundation/render/page-worker.mjs +562 -86
- package/foundation/render/picture-chrome.mjs +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +33 -0
- package/foundation/render/picture-window.mjs +78 -0
- package/foundation/render/render-page.d.mts +55 -4
- package/foundation/render/render-page.mjs +199 -28
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +2 -1
- package/foundation/render/served-packages.mjs +5 -3
- package/foundation/render/ts-paths.d.mts +11 -0
- package/foundation/render/ts-paths.mjs +27 -2
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +10 -2
- package/foundation/response/response-types.doc.mjs +12 -12
- package/foundation/runtime/package-root.d.mts +8 -0
- package/foundation/runtime/package-root.mjs +20 -0
- package/foundation/suggest/other-command.d.mts +11 -0
- package/foundation/suggest/other-command.mjs +1 -1
- package/foundation/text/icon-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +25 -0
- package/foundation/text/icon-set-next.mjs +29 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
|
@@ -135,6 +135,7 @@ import {
|
|
|
135
135
|
savedStateRead,
|
|
136
136
|
propertySpelling,
|
|
137
137
|
modesOf,
|
|
138
|
+
dialNumber,
|
|
138
139
|
} from './_settings.mjs';
|
|
139
140
|
import {isColorToken} from './_compiler.mjs';
|
|
140
141
|
import {
|
|
@@ -1130,6 +1131,56 @@ function modeColorBelongs(ctx, data, token, value) {
|
|
|
1130
1131
|
return best[1] >= 4.5 && worst[1] < 3 ? best[0] : null;
|
|
1131
1132
|
}
|
|
1132
1133
|
|
|
1134
|
+
/**
|
|
1135
|
+
* Words that name a dial together with the value they ask for: the word
|
|
1136
|
+
* typed as the setting, the values typed for it, and the dial and value
|
|
1137
|
+
* they mean (`shadows none` is `surfaces flat`; `dark-mode true` is `mode
|
|
1138
|
+
* dark-only`). Registered as documented readings, so the line it offers
|
|
1139
|
+
* passes the repair gate.
|
|
1140
|
+
* @type {Array<{words: RegExp, values: string[], dial: string, value: string}>}
|
|
1141
|
+
*/
|
|
1142
|
+
const DIAL_VALUE_WORDS = [
|
|
1143
|
+
{
|
|
1144
|
+
words: /^(?:shadows?|elevation)$/,
|
|
1145
|
+
values: ['none', 'off', 'no', '0', 'false', 'flat'],
|
|
1146
|
+
dial: 'surfaces',
|
|
1147
|
+
value: 'flat',
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
words: /^(?:dark|darkmode)$/,
|
|
1151
|
+
values: ['true', 'yes', 'on', '1'],
|
|
1152
|
+
dial: 'mode',
|
|
1153
|
+
value: 'dark-only',
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
words: /^(?:light|lightmode)$/,
|
|
1157
|
+
values: ['true', 'yes', 'on', '1'],
|
|
1158
|
+
dial: 'mode',
|
|
1159
|
+
value: 'light-only',
|
|
1160
|
+
},
|
|
1161
|
+
];
|
|
1162
|
+
documentReadings(
|
|
1163
|
+
DIAL_VALUE_WORDS.flatMap(x =>
|
|
1164
|
+
x.values.map(w => /** @type {[string, string]} */ ([w, x.value])),
|
|
1165
|
+
),
|
|
1166
|
+
);
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* The dial and value a word typed as the setting means with its value, by
|
|
1170
|
+
* DIAL_VALUE_WORDS, or null.
|
|
1171
|
+
* @param {string} word the setting as typed, lowercase
|
|
1172
|
+
* @param {string} value
|
|
1173
|
+
* @returns {{dial: string, value: string} | null}
|
|
1174
|
+
*/
|
|
1175
|
+
function dialValueOf(word, value) {
|
|
1176
|
+
const w = word.replace(/[-_ ]?(?:colou?r|mode)$/, '') || word;
|
|
1177
|
+
const typed = value.trim().toLowerCase();
|
|
1178
|
+
const hit = DIAL_VALUE_WORDS.find(
|
|
1179
|
+
x => x.words.test(w) && x.values.includes(typed),
|
|
1180
|
+
);
|
|
1181
|
+
return hit ? {dial: hit.dial, value: hit.value} : null;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1133
1184
|
/** A number or a size, which is never a font family. */
|
|
1134
1185
|
const NUMBERISH = /^[+-]?(\d+\.?\d*|\.\d+)(px|rem|em|pt|%)?$/i;
|
|
1135
1186
|
|
|
@@ -1158,9 +1209,10 @@ const NUMBERISH = /^[+-]?(\d+\.?\d*|\.\d+)(px|rem|em|pt|%)?$/i;
|
|
|
1158
1209
|
* @param {string} value
|
|
1159
1210
|
* @param {any} ctx
|
|
1160
1211
|
* @param {boolean} [presets] whether a preset name is read (the font dial)
|
|
1161
|
-
* @param {Array<{name: string, near: string, rung?: string}>} [notes] filled with each family kept as
|
|
1212
|
+
* @param {Array<{name: string, near: string, rung?: string, words?: string}>} [notes] filled with each family kept as
|
|
1162
1213
|
* typed that is near a font a system ships (a family the editor does not
|
|
1163
|
-
* know may be a real one: Corben is no typo of Corbel)
|
|
1214
|
+
* know may be a real one: Corben is no typo of Corbel), or whose last
|
|
1215
|
+
* words name a weight or style (`words`: Bodoni Moda Bold)
|
|
1164
1216
|
* @returns {{why: string, families: string, asTyped: string | null, rung: string | null, size: boolean, textSize: number | null, style: string | null} | null}
|
|
1165
1217
|
*/
|
|
1166
1218
|
function fontListProblem(value, ctx, presets = false, notes = []) {
|
|
@@ -1562,6 +1614,26 @@ function fontListProblem(value, ctx, presets = false, notes = []) {
|
|
|
1562
1614
|
) &&
|
|
1563
1615
|
!(!knownFamily(ctx, name) && knownStart)
|
|
1564
1616
|
) {
|
|
1617
|
+
// A family the editor does not know whose last words are a weight or
|
|
1618
|
+
// style (Bodoni Moda Bold) may be a real family (Archivo Black): kept
|
|
1619
|
+
// as typed, and said, with the lines for the family and its weight.
|
|
1620
|
+
if (!knownFamily(ctx, name)) {
|
|
1621
|
+
const w = tail.find(t => t.kind === 'weight')?.value;
|
|
1622
|
+
notes.push({
|
|
1623
|
+
name,
|
|
1624
|
+
near: base,
|
|
1625
|
+
words: tail.map(t => t.text).join(' '),
|
|
1626
|
+
...(w != null
|
|
1627
|
+
? {
|
|
1628
|
+
rung: Object.entries(HEADING_WEIGHTS).reduce((a, b) =>
|
|
1629
|
+
Math.abs(Number(b[1]) - w) < Math.abs(Number(a[1]) - w)
|
|
1630
|
+
? b
|
|
1631
|
+
: a,
|
|
1632
|
+
)[0],
|
|
1633
|
+
}
|
|
1634
|
+
: {}),
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1565
1637
|
kept.push(name);
|
|
1566
1638
|
continue;
|
|
1567
1639
|
}
|
|
@@ -3219,6 +3291,48 @@ export function dividerParts(C) {
|
|
|
3219
3291
|
*/
|
|
3220
3292
|
function lineRefusal(ctx, slug, s, prop, v) {
|
|
3221
3293
|
const parts = partsOf(ctx, s);
|
|
3294
|
+
// A border's color or width on a part whose line an element inside it
|
|
3295
|
+
// draws, and whose own element draws no border (a divider): there is no
|
|
3296
|
+
// border for it to color or widen. The line's own token is what reaches
|
|
3297
|
+
// it: its color, or the border width its thickness reads.
|
|
3298
|
+
if (
|
|
3299
|
+
/^border(?:-(?:top|right|bottom|left|block|inline)(?:-(?:start|end))?)?-(color|width)$/.test(
|
|
3300
|
+
prop,
|
|
3301
|
+
) &&
|
|
3302
|
+
parts.length &&
|
|
3303
|
+
parts.every(
|
|
3304
|
+
t =>
|
|
3305
|
+
(ctx.C.MAP[t]?.line ?? []).length &&
|
|
3306
|
+
!Object.keys(ctx.C.MAP[t]?.own ?? {}).some(
|
|
3307
|
+
k =>
|
|
3308
|
+
/^border(?:-[a-z-]+)?(?:-style)?$/.test(k) &&
|
|
3309
|
+
!/radius|color|width/.test(k),
|
|
3310
|
+
),
|
|
3311
|
+
)
|
|
3312
|
+
) {
|
|
3313
|
+
const part = parts[0];
|
|
3314
|
+
const lineProps = ctx.C.MAP[part]?.line ?? [];
|
|
3315
|
+
const width = prop.endsWith('-width');
|
|
3316
|
+
const toks = [
|
|
3317
|
+
...new Set(
|
|
3318
|
+
lineProps.flatMap((/** @type {string} */ lp) =>
|
|
3319
|
+
Object.keys(ctx.C.MAP[part]?.own?.[lp]?.tokens ?? {}),
|
|
3320
|
+
),
|
|
3321
|
+
),
|
|
3322
|
+
].filter(t => (width ? /^--border-width\b/.test(t) : /^--color-/.test(t)));
|
|
3323
|
+
refuse(
|
|
3324
|
+
E.ERR_THEME_NO_EFFECT,
|
|
3325
|
+
`${part} draws no border: its line is drawn by an element inside it, so ${prop} on ${part} has no border to ${width ? 'widen' : 'color'}${toks.length ? `; the line reads ${toks.join(' and ')} for its ${width ? 'thickness' : 'color'}` : ''}.`,
|
|
3326
|
+
{
|
|
3327
|
+
run: toks.length
|
|
3328
|
+
? toks.map(
|
|
3329
|
+
tok =>
|
|
3330
|
+
`${P} set ${slug} ${tok} ${quoteCommandArgument(v)} --on ${s.on ?? part}${s.when ? ` --when ${s.when}` : ''}${s.mode && !width ? ` --mode ${s.mode}` : ''}`,
|
|
3331
|
+
)
|
|
3332
|
+
: [`${HOW} ${part}`],
|
|
3333
|
+
},
|
|
3334
|
+
);
|
|
3335
|
+
}
|
|
3222
3336
|
const drawn = (/** @type {string} */ t) =>
|
|
3223
3337
|
(ctx.C.MAP[t]?.line ?? []).includes(prop) ||
|
|
3224
3338
|
(prop === 'background' &&
|
|
@@ -4286,20 +4400,64 @@ export function checkSetting(
|
|
|
4286
4400
|
thing === 'font-family' ||
|
|
4287
4401
|
thing.startsWith('--font-family'))
|
|
4288
4402
|
) {
|
|
4289
|
-
/** @type {Array<{name: string, near: string, rung?: string}>} */
|
|
4403
|
+
/** @type {Array<{name: string, near: string, rung?: string, words?: string}>} */
|
|
4290
4404
|
const near = [];
|
|
4291
4405
|
fontListProblem(value, ctx, thing === 'font', near);
|
|
4292
4406
|
if (near.length)
|
|
4293
4407
|
s.note = near
|
|
4294
4408
|
.map(
|
|
4295
4409
|
n =>
|
|
4296
|
-
`"${n.name}" is kept as typed: the editor does not know that family, and a font a system ships is spelled near it; if that was meant: ${P} set ${slug} ${thing} ${quoteCommandArgument(String(value).replace(n.name, n.near))}${flags.on ? ` --on ${flags.on}` : ''}${n.rung && thing === 'font' ? ` and ${P} set ${slug} headings ${n.rung}` : ''}`,
|
|
4410
|
+
`"${n.name}" is kept as typed: the editor does not know that family, and ${n.words ? `its last words (${n.words}) name a ${n.rung ? 'weight' : 'style'}` : 'a font a system ships is spelled near it'}; if ${n.words ? `${n.words} was` : 'that was'} meant: ${P} set ${slug} ${thing} ${quoteCommandArgument(String(value).replace(n.name, n.near))}${flags.on ? ` --on ${flags.on}` : ''}${n.rung && thing === 'font' ? ` and ${P} set ${slug} headings ${n.rung}` : ''}`,
|
|
4297
4411
|
)
|
|
4298
4412
|
.join('; ');
|
|
4299
4413
|
}
|
|
4300
4414
|
return s;
|
|
4301
4415
|
}
|
|
4302
4416
|
|
|
4417
|
+
/**
|
|
4418
|
+
* The part a value names beside the value (pasted from notes or typed as
|
|
4419
|
+
* words): a label (`card: #eee`, `button = red`, `button:hover: red` with a
|
|
4420
|
+
* state), `red on button`, or the part as the first or last word (`card
|
|
4421
|
+
* 8px`, `button red`); the part as --on reads it (a plural is its part),
|
|
4422
|
+
* with the value left and the state named. Null when no exact part or
|
|
4423
|
+
* group is named.
|
|
4424
|
+
* @param {any} ctx
|
|
4425
|
+
* @param {string} text
|
|
4426
|
+
* @returns {{on: string, value: string, state?: string} | null}
|
|
4427
|
+
*/
|
|
4428
|
+
function partInValue(ctx, text) {
|
|
4429
|
+
/** The part a word names, or null. @param {string} w */
|
|
4430
|
+
const partOf = w => {
|
|
4431
|
+
const word = w.trim().toLowerCase().replace(/\s+/g, '-');
|
|
4432
|
+
return (
|
|
4433
|
+
[word, word.replace(/e?s$/, ''), word.replace(/s$/, '')].find(
|
|
4434
|
+
x => x && (ctx.project.target.has(x) || FAMILIES[x]),
|
|
4435
|
+
) ?? null
|
|
4436
|
+
);
|
|
4437
|
+
};
|
|
4438
|
+
const t = text.trim();
|
|
4439
|
+
/** @type {Array<[string, string, string?]>} part words, value, state */
|
|
4440
|
+
const readings = [];
|
|
4441
|
+
const label =
|
|
4442
|
+
/^([a-z][a-z -]*?)\s*(?::\s*([a-z][a-z-]*)\s*)?[:=]\s*(\S.*)$/i.exec(t);
|
|
4443
|
+
if (label) readings.push([label[1], label[3], label[2]]);
|
|
4444
|
+
const on = /^(\S.*?)\s+on\s+([a-z][a-z -]*)$/i.exec(t);
|
|
4445
|
+
if (on) readings.push([on[2], on[1]]);
|
|
4446
|
+
const words = t.split(/\s+/);
|
|
4447
|
+
if (words.length > 1) {
|
|
4448
|
+
readings.push([words[0], words.slice(1).join(' ')]);
|
|
4449
|
+
readings.push([words[words.length - 1], words.slice(0, -1).join(' ')]);
|
|
4450
|
+
}
|
|
4451
|
+
for (const [part, value, state] of readings) {
|
|
4452
|
+
const found = partOf(part);
|
|
4453
|
+
if (!found || !value.trim()) continue;
|
|
4454
|
+
const read = state ? stateSpelling(state) : undefined;
|
|
4455
|
+
if (state && !STATE_WORDS.includes(/** @type {string} */ (read))) continue;
|
|
4456
|
+
return {on: found, value: value.trim(), ...(read ? {state: read} : {})};
|
|
4457
|
+
}
|
|
4458
|
+
return null;
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4303
4461
|
/**
|
|
4304
4462
|
* A note for a var() with a fallback whose name is a letter or two off a
|
|
4305
4463
|
* design token (`var(--spacing-xl, 2rem)` when the token is `--spacing-x1`):
|
|
@@ -4431,8 +4589,11 @@ function checkOne(
|
|
|
4431
4589
|
refuse(E.ERR_MISSING_ARGUMENT, `--${k} was given no value.`, {
|
|
4432
4590
|
run: [`${P} ${unset ? 'undo' : 'set'} --help`],
|
|
4433
4591
|
});
|
|
4434
|
-
// A value pasted over several lines is one value
|
|
4435
|
-
|
|
4592
|
+
// A value pasted over several lines is one value; a dial's number typed
|
|
4593
|
+
// with the dial's unit (`text-size 24px`) is that number.
|
|
4594
|
+
const v = DIALS[thing]
|
|
4595
|
+
? dialNumber(thing, normalValue(thing, value ?? ''))
|
|
4596
|
+
: normalValue(thing, value ?? '');
|
|
4436
4597
|
// A var() that misspells a design token would read nothing.
|
|
4437
4598
|
if (!unset) {
|
|
4438
4599
|
const bad = unknownVarRef(v, TOKENS, thing, reads);
|
|
@@ -4948,19 +5109,33 @@ function checkOne(
|
|
|
4948
5109
|
`"${s.state}" is not a state of ${s.on}: it names ${s.on} when it is not ${denied}, its rest look, which a setting with no --state gives.`,
|
|
4949
5110
|
{run: [setLine(slug, thing, v, {...s, state: undefined}, unset)]},
|
|
4950
5111
|
);
|
|
4951
|
-
if (s.state && !statesHold(states, s.state))
|
|
5112
|
+
if (s.state && !statesHold(states, s.state)) {
|
|
5113
|
+
// A part drawn inside this one that has the state (a calendar's day
|
|
5114
|
+
// is today; the calendar is not): that part's line, with the state.
|
|
5115
|
+
const state = String(s.state);
|
|
5116
|
+
const inner = meant
|
|
5117
|
+
? []
|
|
5118
|
+
: [...ctx.project.target.keys()]
|
|
5119
|
+
.filter(
|
|
5120
|
+
k =>
|
|
5121
|
+
k.startsWith(`${s.on}-`) &&
|
|
5122
|
+
statesHold(partStates(ctx, k), state),
|
|
5123
|
+
)
|
|
5124
|
+
.slice(0, 3);
|
|
4952
5125
|
refuse(
|
|
4953
5126
|
E.ERR_THEME_UNKNOWN_STATE,
|
|
4954
|
-
`"${s.state}" is not a state of ${s.on}. States: ${settableStates(ctx, slug, data, s.on).join(', ') || 'none'}
|
|
5127
|
+
`"${s.state}" is not a state of ${s.on}. States: ${settableStates(ctx, slug, data, s.on).join(', ') || 'none'}.${inner.length ? ` ${inner.join(', ')} ${inner.length > 1 ? 'have' : 'has'} it.` : ''}`,
|
|
4955
5128
|
{
|
|
4956
5129
|
...(meant ? {didYouMean: [meant]} : {}),
|
|
4957
5130
|
run: [
|
|
4958
|
-
meant
|
|
4959
|
-
? setLine(slug, thing, v, {...s, state: meant}, unset)
|
|
4960
|
-
:
|
|
5131
|
+
...(meant
|
|
5132
|
+
? [setLine(slug, thing, v, {...s, state: meant}, unset)]
|
|
5133
|
+
: inner.map(k => setLine(slug, thing, v, {...s, on: k}, unset))),
|
|
5134
|
+
...(meant ? [] : [`${HOW} ${quoteCommandArgument(s.on)}`]),
|
|
4961
5135
|
],
|
|
4962
5136
|
},
|
|
4963
5137
|
);
|
|
5138
|
+
}
|
|
4964
5139
|
}
|
|
4965
5140
|
{
|
|
4966
5141
|
// A fill or text color a part's own element never declares, which an
|
|
@@ -5629,12 +5804,26 @@ function checkOne(
|
|
|
5629
5804
|
if (at >= 0 && stepped >= 0 && stepped < L.length) return L[stepped][0];
|
|
5630
5805
|
// At the last rung that way, a step goes nowhere: refused as every
|
|
5631
5806
|
// dial refuses it at its end, with the other way.
|
|
5632
|
-
if (at >= 0)
|
|
5807
|
+
if (at >= 0) {
|
|
5808
|
+
// Past the last rung, an exact size still does it: the line for one
|
|
5809
|
+
// step beyond this rung, as the dial writes sizes.
|
|
5810
|
+
const beyond =
|
|
5811
|
+
typeof L[at][1] === 'number'
|
|
5812
|
+
? Math.round(
|
|
5813
|
+
/** @type {number} */ (L[at][1]) * (v === 'more' ? 1.15 : 0.87),
|
|
5814
|
+
)
|
|
5815
|
+
: null;
|
|
5633
5816
|
refuse(
|
|
5634
5817
|
E.ERR_THEME_NO_EFFECT,
|
|
5635
|
-
`${thing} is already at its ${v === 'more' ? 'largest' : 'smallest'} step, ${L[at][0]}${s.on ? ` on ${s.on}` : ''}, so "${v}" has nowhere to go
|
|
5636
|
-
{
|
|
5818
|
+
`${thing} is already at its ${v === 'more' ? 'largest' : 'smallest'} step, ${L[at][0]}${s.on ? ` on ${s.on}` : ''}, so "${v}" has nowhere to go.${beyond ? ` An exact size goes past the rungs.` : ''}`,
|
|
5819
|
+
{
|
|
5820
|
+
run: [
|
|
5821
|
+
setLine(slug, thing, v === 'more' ? 'less' : 'more', s),
|
|
5822
|
+
...(beyond ? [setLine(slug, thing, String(beyond), s)] : []),
|
|
5823
|
+
],
|
|
5824
|
+
},
|
|
5637
5825
|
);
|
|
5826
|
+
}
|
|
5638
5827
|
// A size between rungs steps to the next rung that way, never past it.
|
|
5639
5828
|
const px =
|
|
5640
5829
|
typeof cur === 'number'
|
|
@@ -6090,7 +6279,7 @@ function checkOne(
|
|
|
6090
6279
|
)
|
|
6091
6280
|
refuse(
|
|
6092
6281
|
E.ERR_THEME_BAD_VALUE,
|
|
6093
|
-
`text-size takes ${DIALS['text-size'].values} (a number is the body size in pixels, 10 to 32), not "${v}".`,
|
|
6282
|
+
`text-size takes ${DIALS['text-size'].values} (a number is the body size in pixels, 10 to 32), not "${String(value ?? v).trim()}".`,
|
|
6094
6283
|
(() => {
|
|
6095
6284
|
// A rung in other letter case (Medium) or with px is that rung;
|
|
6096
6285
|
// a CSS size keyword (x-large) is the size CSS gives it.
|
|
@@ -6123,7 +6312,9 @@ function checkOne(
|
|
|
6123
6312
|
Number(t) >= 10 &&
|
|
6124
6313
|
Number(t) <= 32
|
|
6125
6314
|
? String(Number(t))
|
|
6126
|
-
:
|
|
6315
|
+
: // As typed, its unit kept (3px is the smallest size,
|
|
6316
|
+
// never a bare 3).
|
|
6317
|
+
textSizePx(String(value ?? v));
|
|
6127
6318
|
return {
|
|
6128
6319
|
run: [
|
|
6129
6320
|
size != null
|
|
@@ -6985,19 +7176,10 @@ function checkOne(
|
|
|
6985
7176
|
// named.
|
|
6986
7177
|
run: [
|
|
6987
7178
|
...(() => {
|
|
6988
|
-
const
|
|
6989
|
-
|
|
6990
|
-
);
|
|
6991
|
-
if (!label) return [];
|
|
6992
|
-
const word = label[1].trim().toLowerCase().replace(/\s+/g, '-');
|
|
6993
|
-
const on = [
|
|
6994
|
-
word,
|
|
6995
|
-
word.replace(/e?s$/, ''),
|
|
6996
|
-
word.replace(/s$/, ''),
|
|
6997
|
-
].find(w => ctx.project.target.has(w) || FAMILIES[w]);
|
|
6998
|
-
return on
|
|
7179
|
+
const named = partInValue(ctx, String(v ?? ''));
|
|
7180
|
+
return named
|
|
6999
7181
|
? [
|
|
7000
|
-
`${P} set ${slug} ${prop} ${quoteCommandArgument(
|
|
7182
|
+
`${P} set ${slug} ${prop} ${quoteCommandArgument(named.value)} --on ${named.on}${named.state ? ` --state ${named.state}` : ''}`,
|
|
7001
7183
|
]
|
|
7002
7184
|
: [];
|
|
7003
7185
|
})(),
|
|
@@ -7643,21 +7825,9 @@ function checkOne(
|
|
|
7643
7825
|
};
|
|
7644
7826
|
const aliases = aliasesOf(lower);
|
|
7645
7827
|
// A word that names a dial AND the value it asks for (`shadows none` is
|
|
7646
|
-
// `surfaces flat`, `dark-mode true` is `mode dark-only`): that command
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
const off = /^(none|off|no|0|false|flat)$/.test(
|
|
7650
|
-
String(v).trim().toLowerCase(),
|
|
7651
|
-
);
|
|
7652
|
-
const on = /^(true|yes|on|1)$/.test(String(v).trim().toLowerCase());
|
|
7653
|
-
if (/^(shadows?|elevation)$/.test(word) && off)
|
|
7654
|
-
return {dial: 'surfaces', value: 'flat'};
|
|
7655
|
-
if (/^(dark|darkmode)$/.test(word) && on)
|
|
7656
|
-
return {dial: 'mode', value: 'dark-only'};
|
|
7657
|
-
if (/^(light|lightmode)$/.test(word) && on)
|
|
7658
|
-
return {dial: 'mode', value: 'light-only'};
|
|
7659
|
-
return null;
|
|
7660
|
-
})();
|
|
7828
|
+
// `surfaces flat`, `dark-mode true` is `mode dark-only`): that command,
|
|
7829
|
+
// from the one table of such words.
|
|
7830
|
+
const asDialValue = dialValueOf(lower, String(v));
|
|
7661
7831
|
if (!hint && !aliases.length && asDialValue && DIALS[asDialValue.dial])
|
|
7662
7832
|
return refuse(
|
|
7663
7833
|
E.ERR_THEME_UNKNOWN_THING,
|
|
@@ -23,6 +23,20 @@ export function alphaOf(value: unknown): number;
|
|
|
23
23
|
* @returns {Rgb}
|
|
24
24
|
*/
|
|
25
25
|
export function compositeOver(over: Rgb, alpha: number, under: Rgb): Rgb;
|
|
26
|
+
/**
|
|
27
|
+
* A color in OKLab (lightness, a, b), from its sRGB channels: what the eye
|
|
28
|
+
* sees as close or far ({@link oklabDistance}).
|
|
29
|
+
* @param {[number, number, number]} rgb
|
|
30
|
+
* @returns {number[]}
|
|
31
|
+
*/
|
|
32
|
+
export function oklabOf(rgb: [number, number, number]): number[];
|
|
33
|
+
/**
|
|
34
|
+
* How far apart two colors look: their distance in OKLab (0 the same; about
|
|
35
|
+
* 0.02 the least a person tells apart).
|
|
36
|
+
* @param {[number, number, number]} a
|
|
37
|
+
* @param {[number, number, number]} b
|
|
38
|
+
*/
|
|
39
|
+
export function oklabDistance(a: [number, number, number], b: [number, number, number]): number;
|
|
26
40
|
/**
|
|
27
41
|
* One side of a color-mix(): the color, and the share written before or
|
|
28
42
|
* after it at the top level (null when none). A percentage inside the
|
|
@@ -522,6 +522,28 @@ const toLinear = c => {
|
|
|
522
522
|
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
523
523
|
};
|
|
524
524
|
|
|
525
|
+
/**
|
|
526
|
+
* A color in OKLab (lightness, a, b), from its sRGB channels: what the eye
|
|
527
|
+
* sees as close or far ({@link oklabDistance}).
|
|
528
|
+
* @param {[number, number, number]} rgb
|
|
529
|
+
* @returns {number[]}
|
|
530
|
+
*/
|
|
531
|
+
export function oklabOf(rgb) {
|
|
532
|
+
return linearToOklab(rgb.map(toLinear));
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* How far apart two colors look: their distance in OKLab (0 the same; about
|
|
537
|
+
* 0.02 the least a person tells apart).
|
|
538
|
+
* @param {[number, number, number]} a
|
|
539
|
+
* @param {[number, number, number]} b
|
|
540
|
+
*/
|
|
541
|
+
export function oklabDistance(a, b) {
|
|
542
|
+
const x = oklabOf(a);
|
|
543
|
+
const y = oklabOf(b);
|
|
544
|
+
return Math.hypot(x[0] - y[0], x[1] - y[1], x[2] - y[2]);
|
|
545
|
+
}
|
|
546
|
+
|
|
525
547
|
/** Linear sRGB to OKLab. @param {number[]} lin @returns {number[]} */
|
|
526
548
|
function linearToOklab([r, g, b]) {
|
|
527
549
|
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
@@ -396,6 +396,58 @@ export function makeCompiler(project, parts) {
|
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
+
// Read only under conditions the part is not drawn in by default (a
|
|
400
|
+
// link reads --color-text-primary only as color primary; drawn as it
|
|
401
|
+
// is, it reads --color-text-accent): set on the part with no
|
|
402
|
+
// condition, it changes nothing in its default look. Said, with the
|
|
403
|
+
// token that look reads and the condition that reads this one.
|
|
404
|
+
if (
|
|
405
|
+
!wProp &&
|
|
406
|
+
allReads(target).has(token) &&
|
|
407
|
+
(g === 'text' || g === 'background')
|
|
408
|
+
) {
|
|
409
|
+
const conds = [
|
|
410
|
+
...Object.values(MAP[target]?.own ?? {}).flatMap(
|
|
411
|
+
x => /** @type {string[]} */ (x.tokens?.[token] ?? []),
|
|
412
|
+
),
|
|
413
|
+
];
|
|
414
|
+
const attrsOf = (/** @type {string} */ c) => c.split(' ')[0];
|
|
415
|
+
const drawn = [
|
|
416
|
+
...new Set(
|
|
417
|
+
parts.pairs
|
|
418
|
+
.filter(p =>
|
|
419
|
+
g === 'text' ? p.fg.target === target : p.bg.target === target,
|
|
420
|
+
)
|
|
421
|
+
.map(p => (g === 'text' ? p.fg.tokens[0] : p.bg.tokens[0]))
|
|
422
|
+
.filter(Boolean),
|
|
423
|
+
),
|
|
424
|
+
];
|
|
425
|
+
const inside = (MAP[target]?.inside?.[token] ?? []).length > 0;
|
|
426
|
+
if (
|
|
427
|
+
conds.length &&
|
|
428
|
+
conds.every(c => /=/.test(attrsOf(c))) &&
|
|
429
|
+
drawn.length &&
|
|
430
|
+
!drawn.includes(token) &&
|
|
431
|
+
!inside
|
|
432
|
+
) {
|
|
433
|
+
const named = [
|
|
434
|
+
...new Set(
|
|
435
|
+
conds
|
|
436
|
+
.flatMap(c => attrsOf(c).split(','))
|
|
437
|
+
.map(a => a.replace('=', ':')),
|
|
438
|
+
),
|
|
439
|
+
];
|
|
440
|
+
return {
|
|
441
|
+
soft: true,
|
|
442
|
+
message: `${target} reads ${token} only when ${named.join(' or ')}; as drawn by default it reads ${drawn.join(', ')}, so this changes nothing in its default look. For the default look: ${P} set ${theme} ${drawn[0]} ${quoteCommandArgument(value)} --on ${target}${also}; for ${named[0]} alone: ${P} set ${theme} ${token} ${quoteCommandArgument(value)} --on ${target} --when ${named[0]}${also}`,
|
|
443
|
+
run: [
|
|
444
|
+
`${P} set ${theme} ${drawn[0]} ${quoteCommandArgument(value)} --on ${target}${also}`,
|
|
445
|
+
`${P} set ${theme} ${token} ${quoteCommandArgument(value)} --on ${target} --when ${named[0]}${also}`,
|
|
446
|
+
],
|
|
447
|
+
also: [],
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
}
|
|
399
451
|
if (allReads(target).has(token)) {
|
|
400
452
|
// Read, but maybe only for another property: an error color that feeds
|
|
401
453
|
// only the focus outline does not paint the background.
|
|
@@ -137,7 +137,9 @@ export function cutShortProblem(ctx: import("./_settings.mjs").Ctx, slug: string
|
|
|
137
137
|
* states among them) have no name: their cells are narrow, and the full
|
|
138
138
|
* sheet cuts long labels short in every theme.
|
|
139
139
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
140
|
-
* @param {Array<{html: string, png: string, name?: string}>} shots
|
|
140
|
+
* @param {Array<{html: string, png: string, name?: string, most?: number}>} shots
|
|
141
|
+
* `most`: the tallest the page's picture may be; a taller one is cut into
|
|
142
|
+
* pictures that tall, in order ({@link pagesOfPicture})
|
|
141
143
|
* @param {Array<'light' | 'dark'>} modes
|
|
142
144
|
* @returns {Promise<{files: string[], problem: string | null, cutShort: CutShort[]}>}
|
|
143
145
|
*/
|
|
@@ -145,6 +147,7 @@ export function pictures(project: import("./_project.mjs").ThemeProject, shots:
|
|
|
145
147
|
html: string;
|
|
146
148
|
png: string;
|
|
147
149
|
name?: string;
|
|
150
|
+
most?: number;
|
|
148
151
|
}>, modes: Array<"light" | "dark">): Promise<{
|
|
149
152
|
files: string[];
|
|
150
153
|
problem: string | null;
|
|
@@ -306,6 +309,12 @@ export function stampSheet(file: string, slug: string, cwd: string): void;
|
|
|
306
309
|
export function checkSection(section: string | undefined, theme?: string, rest?: string): string | undefined;
|
|
307
310
|
/** The sample page, as a note about its pictures names it. */
|
|
308
311
|
export const SAMPLE_PAGE_NAME: "the sample page";
|
|
312
|
+
/**
|
|
313
|
+
* The tallest a family's picture is: a reader fits a picture to its width,
|
|
314
|
+
* and a taller one comes out too small to read, so it is cut into pictures
|
|
315
|
+
* this tall (`sheet-inputs-1.png`, `-2` …).
|
|
316
|
+
*/
|
|
317
|
+
export const FAMILY_PICTURE_HEIGHT: 1600;
|
|
309
318
|
/**
|
|
310
319
|
* The family `show --png` pictures when the theme's settings set no part of
|
|
311
320
|
* its own (a fresh theme, or only theme-wide settings): the buttons, an
|
|
@@ -319,12 +328,20 @@ export const FAMILY_OVERVIEW: "actions";
|
|
|
319
328
|
* is preview.png).
|
|
320
329
|
*/
|
|
321
330
|
export const FAMILY_SECTIONS: readonly string[];
|
|
331
|
+
/**
|
|
332
|
+
* The errors of a folder that cannot be written (no permission, read-only,
|
|
333
|
+
* full): a page the pictures need that cannot be written there is the
|
|
334
|
+
* pictures' problem, which the picture run names, never a refusal of the
|
|
335
|
+
* command.
|
|
336
|
+
*/
|
|
337
|
+
export const UNWRITABLE: readonly string[];
|
|
322
338
|
/**
|
|
323
339
|
* Text one page's pictures draw cut short in one part, as the browser
|
|
324
340
|
* measured it: the page and its picture, the part (null when the text sits
|
|
325
341
|
* in none), its texts, the one mode it was cut in when only one was, and
|
|
326
342
|
* whether every text is drawn whole once the part keeps its width
|
|
327
|
-
* (`flex-shrink: 0`, applied in the page and measured).
|
|
343
|
+
* (`flex-shrink: 0`, applied in the page and measured). `broken`: the
|
|
344
|
+
* texts are words drawn broken across two lines inside the word, not cut.
|
|
328
345
|
*/
|
|
329
346
|
export type CutShort = {
|
|
330
347
|
page: string;
|
|
@@ -333,4 +350,5 @@ export type CutShort = {
|
|
|
333
350
|
texts: string[];
|
|
334
351
|
only: "light" | "dark" | null;
|
|
335
352
|
whole: boolean;
|
|
353
|
+
broken?: boolean;
|
|
336
354
|
};
|