@astryxdesign/cli 0.7.16 → 0.7.17-canary.g16fe6a8
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 +76 -86
- package/api/build/_adapter.d.mts +12 -0
- package/api/build/_adapter.mjs +51 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +3 -3
- package/api/build/kit/kind.d.mts +2 -1
- package/api/build/kit/kind.mjs +199 -10
- package/api/build/kit/kit.mjs +6 -4
- package/api/build/kit/rank.d.mts +4 -2
- package/api/build/kit/rank.mjs +125 -24
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +12 -8
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +340 -43
- 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 +48 -0
- package/api/build/kit/words.mjs +90 -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 +48 -6
- package/api/discover/_adapter.d.mts +1 -1
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +28 -2
- package/api/docs/_adapter.mjs +249 -10
- 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 +83 -10
- package/api/doctor/built-checks.mjs +40 -14
- 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/icon/_records.mjs +2 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/integration/_adapter.d.mts +44 -0
- package/api/integration/_adapter.mjs +77 -1
- package/api/integration/authoring-checks.mjs +6 -6
- package/api/integration/example-scope.d.mts +14 -0
- package/api/integration/example-scope.mjs +44 -0
- package/api/integration/example-scope.type.d.mts +29 -0
- package/api/integration/example-scope.type.mjs +25 -0
- package/api/integration/integrationExampleScope.doc.d.mts +11 -0
- package/api/integration/integrationExampleScope.doc.mjs +59 -0
- package/api/integration/validate-integration.mjs +19 -1
- package/api/integration/validate-integration.type.d.mts +9 -0
- package/api/integration/validate-integration.type.mjs +1 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.mjs +591 -195
- package/api/render/render.doc.mjs +11 -3
- package/api/render/render.type.d.mts +52 -0
- package/api/render/render.type.mjs +31 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.mjs +51 -32
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_gather-components.d.mts +3 -2
- package/api/search/_gather-components.mjs +12 -3
- package/api/search/_lexical.d.mts +5 -0
- package/api/search/_lexical.mjs +8 -2
- package/api/search/_result.d.mts +11 -9
- package/api/search/_result.mjs +4 -4
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search-index.mjs +7 -1
- package/api/search/search.d.mts +1 -1
- package/api/theme/_adapter.mjs +12 -1
- package/api/theme/build/build.d.mts +132 -1
- package/api/theme/build/build.mjs +482 -157
- package/api/theme/build/core-interception.d.mts +10 -0
- package/api/theme/build/core-interception.mjs +10 -0
- package/api/theme/build/font-warning.d.mts +44 -5
- package/api/theme/build/font-warning.mjs +118 -10
- package/api/theme/build/icon-imports.mjs +51 -9
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +115 -4
- package/api/theme-edit/_adapter.mjs +997 -83
- package/api/theme-edit/_catalog.d.mts +20 -2
- package/api/theme-edit/_catalog.mjs +50 -10
- package/api/theme-edit/_check.d.mts +75 -24
- package/api/theme-edit/_check.mjs +2672 -422
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +54 -1
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +133 -15
- package/api/theme-edit/_context.d.mts +14 -3
- package/api/theme-edit/_context.mjs +225 -65
- package/api/theme-edit/_css.d.mts +14 -0
- package/api/theme-edit/_css.mjs +46 -1
- package/api/theme-edit/_edit.d.mts +54 -4
- package/api/theme-edit/_edit.mjs +2966 -286
- package/api/theme-edit/_how-commands.d.mts +72 -1
- package/api/theme-edit/_how-commands.mjs +770 -9
- package/api/theme-edit/_how-question.d.mts +82 -5
- package/api/theme-edit/_how-question.mjs +6983 -701
- package/api/theme-edit/_how.d.mts +2 -1
- package/api/theme-edit/_how.mjs +237 -41
- package/api/theme-edit/_importers.d.mts +38 -0
- package/api/theme-edit/_importers.mjs +188 -0
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_name-rule.d.mts +11 -0
- package/api/theme-edit/_name-rule.mjs +12 -0
- package/api/theme-edit/_normal.d.mts +303 -0
- package/api/theme-edit/_normal.mjs +1517 -0
- package/api/theme-edit/_palette.d.mts +12 -0
- package/api/theme-edit/_palette.mjs +37 -4
- package/api/theme-edit/_part-words.d.mts +31 -0
- package/api/theme-edit/_part-words.mjs +126 -0
- package/api/theme-edit/_parts.d.mts +28 -2
- package/api/theme-edit/_parts.mjs +267 -31
- package/api/theme-edit/_preview-app.d.mts +7 -13
- package/api/theme-edit/_preview-app.mjs +814 -406
- package/api/theme-edit/_preview.d.mts +116 -16
- package/api/theme-edit/_preview.mjs +649 -152
- package/api/theme-edit/_project.d.mts +22 -1
- package/api/theme-edit/_project.mjs +83 -3
- package/api/theme-edit/_settings.d.mts +467 -42
- package/api/theme-edit/_settings.mjs +3527 -468
- package/api/theme-edit/_tables.d.mts +21 -0
- package/api/theme-edit/_tables.mjs +97 -3
- package/api/theme-edit/_vet.d.mts +31 -0
- package/api/theme-edit/_vet.mjs +114 -8
- package/api/theme-edit/theme-edit.type.d.mts +16 -2
- package/api/theme-edit/theme-edit.type.mjs +6 -3
- package/api/theme-edit/themeEditHow.doc.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
- package/api/theme-edit/themeEditNew.doc.mjs +7 -4
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
- package/api/upgrade/run/run.mjs +4 -3
- package/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/run-codemod.mjs +87 -7
- 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/component-list.generated.json +1 -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/checks.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +44 -3
- package/assets/docs/tree/share-a-page.doc.mjs +157 -0
- package/assets/docs/tree/single-component.doc.mjs +4 -0
- 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/search-catalog.generated.json +2 -0
- 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/Hooks/useContainerRevealHookUsage.tsx +2 -2
- 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 +5 -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/assets/theme.template.ts +6 -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/component/categories.d.mts +37 -0
- package/authoring/doctypes/component/categories.mjs +54 -0
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/authoring/example/example.doc.d.mts +12 -0
- package/authoring/example/example.doc.mjs +69 -0
- package/authoring/example/preview.d.mts +92 -0
- package/authoring/example/preview.mjs +994 -0
- package/authoring/example/type.ts +102 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +12 -0
- package/authoring/index.mjs +3 -1
- 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 +22 -3
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +32 -14
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +573 -119
- 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-how.doc.mjs +87 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- 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/experimental-theme-preview-remove.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme.doc.mjs +5 -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 +718 -438
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- package/clients/cli/lib/cli-error.mjs +2 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/lib/json-shim.mjs +132 -24
- package/clients/cli/lib/manifest.mjs +3 -2
- 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/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +56 -8
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/copied-passages.mjs +2 -1
- package/foundation/discovery/core-component-docs.d.mts +29 -0
- package/foundation/discovery/core-component-docs.mjs +83 -0
- package/foundation/discovery/doc-types.mjs +4 -3
- 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 +22 -8
- package/foundation/discovery/icon-definition-discovery.mjs +2 -1
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.mjs +2 -1
- package/foundation/discovery/integration-doc-files.mjs +2 -1
- package/foundation/discovery/package-exports.d.mts +10 -0
- package/foundation/discovery/package-exports.mjs +56 -3
- package/foundation/discovery/prop-drift.mjs +9 -9
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/stored-component-list.d.mts +43 -0
- package/foundation/discovery/stored-component-list.mjs +90 -0
- package/foundation/discovery/stored-search-catalog.d.mts +115 -0
- package/foundation/discovery/stored-search-catalog.mjs +297 -0
- package/foundation/discovery/stored-self-audit.d.mts +26 -10
- package/foundation/discovery/stored-self-audit.mjs +38 -18
- package/foundation/discovery/template-adapter.d.mts +53 -1
- package/foundation/discovery/template-adapter.mjs +176 -12
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/theme-discovery.mjs +31 -4
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/discovery/theming-targets.d.mts +6 -5
- package/foundation/discovery/theming-targets.mjs +31 -47
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- 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/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +38 -0
- package/foundation/fonts/font-stylesheet.mjs +141 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/exact-codec.d.mts +12 -2
- package/foundation/fs/exact-codec.mjs +23 -6
- package/foundation/fs/file-protection.mjs +4 -3
- package/foundation/fs/gather-cache.d.mts +62 -4
- package/foundation/fs/gather-cache.mjs +517 -91
- 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/listing-cache.d.mts +7 -0
- package/foundation/fs/listing-cache.mjs +10 -0
- package/foundation/fs/module-loader.d.mts +24 -2
- package/foundation/fs/module-loader.mjs +94 -21
- package/foundation/fs/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/fs/read-record.d.mts +9 -0
- package/foundation/fs/read-record.mjs +19 -11
- package/foundation/fs/stop-cleanup.d.mts +12 -0
- package/foundation/fs/stop-cleanup.mjs +66 -0
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/integrations/contribution-inventory.mjs +4 -3
- package/foundation/integrations/example-code.d.mts +63 -0
- package/foundation/integrations/example-code.mjs +416 -0
- package/foundation/integrations/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/validate-contributions.mjs +17 -45
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +39 -7
- package/foundation/render/embedded-imports.mjs +66 -27
- 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 +121 -13
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +185 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +34 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +35 -3
- package/foundation/render/render-page.mjs +641 -96
- package/foundation/render/source-block.d.mts +85 -6
- package/foundation/render/source-block.mjs +211 -20
- package/foundation/render/ts-paths.d.mts +69 -6
- package/foundation/render/ts-paths.mjs +326 -40
- 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 +11 -1
- package/foundation/response/response-types.doc.mjs +2 -2
- package/foundation/text/compare-text.d.mts +14 -0
- package/foundation/text/compare-text.mjs +68 -0
- package/foundation/text/css-escape.d.mts +18 -0
- package/foundation/text/css-escape.mjs +35 -0
- package/foundation/text/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +18 -4
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +15 -1
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The colors written inside a value (a shadow's layers, a gradient's
|
|
6
|
+
* stops): each hex color and each color function, in order.
|
|
7
|
+
* @param {string} value
|
|
8
|
+
* @returns {string[]}
|
|
9
|
+
*/
|
|
10
|
+
export function colorsIn(value: string): string[];
|
|
4
11
|
/**
|
|
5
12
|
* The opacity of a CSS color, 0 to 1: the alpha of an 8- or 4-digit hex,
|
|
6
13
|
* `rgba()`/`hsla()`, or a `/ alpha` part; 0 for `transparent`; 1 otherwise.
|
|
@@ -72,6 +79,9 @@ export function isSafeValue(v: string): boolean;
|
|
|
72
79
|
export { splitTop };
|
|
73
80
|
/** The CSS named colors, for suggestions. */
|
|
74
81
|
export const COLOR_NAMES: string[];
|
|
82
|
+
export function namedColorHex(name: string): string | null;
|
|
83
|
+
/** One color written inside a value: a hex color or a color function. */
|
|
84
|
+
export const COLOR_IN_VALUE: RegExp;
|
|
75
85
|
export function hex(rgb: number[]): string;
|
|
76
86
|
export function isColorValue(v: unknown): boolean;
|
|
77
87
|
export function isSize(v: unknown, name?: string): boolean;
|
|
@@ -179,6 +179,14 @@ const NAMED = wordTable(
|
|
|
179
179
|
/** The CSS named colors, for suggestions. */
|
|
180
180
|
export const COLOR_NAMES = Object.keys(NAMED);
|
|
181
181
|
|
|
182
|
+
/**
|
|
183
|
+
* The hex a CSS color name is, or null.
|
|
184
|
+
* @param {string} name
|
|
185
|
+
* @returns {string | null}
|
|
186
|
+
*/
|
|
187
|
+
export const namedColorHex = name =>
|
|
188
|
+
Object.hasOwn(NAMED, name) ? NAMED[name] : null;
|
|
189
|
+
|
|
182
190
|
/** Color keywords that are valid colors but have no fixed value. */
|
|
183
191
|
const KEYWORDS = ['transparent', 'currentcolor', ...CSS_WIDE];
|
|
184
192
|
|
|
@@ -441,6 +449,20 @@ const polar = (c, h) => [
|
|
|
441
449
|
c * Math.sin((h * Math.PI) / 180),
|
|
442
450
|
];
|
|
443
451
|
|
|
452
|
+
/**
|
|
453
|
+
* The colors written inside a value (a shadow's layers, a gradient's
|
|
454
|
+
* stops): each hex color and each color function, in order.
|
|
455
|
+
* @param {string} value
|
|
456
|
+
* @returns {string[]}
|
|
457
|
+
*/
|
|
458
|
+
export function colorsIn(value) {
|
|
459
|
+
return [...String(value ?? '').matchAll(COLOR_IN_VALUE)].map(m => m[0]);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** One color written inside a value: a hex color or a color function. */
|
|
463
|
+
export const COLOR_IN_VALUE =
|
|
464
|
+
/#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\((?:[^()]|\([^()]*\))*\)/gi;
|
|
465
|
+
|
|
444
466
|
/**
|
|
445
467
|
* The opacity of a CSS color, 0 to 1: the alpha of an 8- or 4-digit hex,
|
|
446
468
|
* `rgba()`/`hsla()`, or a `/ alpha` part; 0 for `transparent`; 1 otherwise.
|
|
@@ -514,7 +536,33 @@ export function mixSide(side) {
|
|
|
514
536
|
if (w == null) return null;
|
|
515
537
|
const plain = /^calc\(\s*(.*?)\s*\)$/i.exec(w)?.[1] ?? w;
|
|
516
538
|
const n = cssNumber(plain);
|
|
517
|
-
return n
|
|
539
|
+
if (n) return n.unit === '%' ? n.value : null;
|
|
540
|
+
// Math of two terms that gives a percentage: percentages added or
|
|
541
|
+
// taken away (`25% + 25%`), a percentage scaled by a number
|
|
542
|
+
// (`50% * 1`, `100% / 2`).
|
|
543
|
+
const m = /^(\S+)\s*([*/+-])\s*(\S+)$/.exec(plain);
|
|
544
|
+
if (!m) return null;
|
|
545
|
+
const [a, b] = [cssNumber(m[1]), cssNumber(m[3])];
|
|
546
|
+
if (!a || !b) return null;
|
|
547
|
+
const pct = (/** @type {{unit: string}} */ x) => x.unit === '%';
|
|
548
|
+
const plainNum = (/** @type {{unit: string}} */ x) => x.unit === '';
|
|
549
|
+
const r =
|
|
550
|
+
m[2] === '+' || m[2] === '-'
|
|
551
|
+
? pct(a) && pct(b)
|
|
552
|
+
? m[2] === '+'
|
|
553
|
+
? a.value + b.value
|
|
554
|
+
: a.value - b.value
|
|
555
|
+
: null
|
|
556
|
+
: m[2] === '*'
|
|
557
|
+
? pct(a) && plainNum(b)
|
|
558
|
+
? a.value * b.value
|
|
559
|
+
: plainNum(a) && pct(b)
|
|
560
|
+
? a.value * b.value
|
|
561
|
+
: null
|
|
562
|
+
: pct(a) && plainNum(b) && b.value !== 0
|
|
563
|
+
? a.value / b.value
|
|
564
|
+
: null;
|
|
565
|
+
return r != null && Number.isFinite(r) ? r : null;
|
|
518
566
|
};
|
|
519
567
|
if (words.length < 2) return {color: side.trim(), pct: null};
|
|
520
568
|
const last = share(words.at(-1));
|
|
@@ -1009,7 +1057,12 @@ export function isSafeValue(v) {
|
|
|
1009
1057
|
)
|
|
1010
1058
|
)
|
|
1011
1059
|
return false;
|
|
1060
|
+
// A CSS escape (`Gill\ Sans`, `\5FAE`) is one character of a name, as
|
|
1061
|
+
// CSS reads it, never a boundary; a backslash that escapes nothing (at
|
|
1062
|
+
// the end, or before a line break) could join the next declaration, so
|
|
1063
|
+
// it stays and is refused.
|
|
1012
1064
|
const outside = v
|
|
1065
|
+
.replace(/\\(?:[0-9a-fA-F]{1,6}[ \t]?|[^\n\r\f0-9a-fA-F])/g, 'x')
|
|
1013
1066
|
.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""')
|
|
1014
1067
|
.replace(/url\(data:[^\s"'()\\]*\)/gi, 'url()');
|
|
1015
1068
|
if (/[;{}\\<>]/.test(outside)) return false;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {DIRECT, GROUPS, HOW} from './_tables.mjs';
|
|
13
|
+
import {splitTop} from './_css.mjs';
|
|
13
14
|
import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
|
|
14
15
|
|
|
15
16
|
/** Only these token types may differ between light and dark. */
|
|
@@ -112,13 +113,21 @@ export function makeCompiler(project, parts) {
|
|
|
112
113
|
if (cond === 'always') return '';
|
|
113
114
|
const attrs = MAP[target]?.attrs ?? {};
|
|
114
115
|
const [attrPart, ...css] = cond.split(' ');
|
|
116
|
+
const t = TARGET.get(target);
|
|
115
117
|
const kept = (attrPart.includes('=') ? attrPart.split(',') : []).filter(
|
|
116
118
|
kv => {
|
|
117
119
|
const [k] = kv.split('=');
|
|
120
|
+
// Only the part's own visual props are read down to what a person
|
|
121
|
+
// acts on (a size or an elevation the render happened to use is not
|
|
122
|
+
// a condition). Anything else stays: a runtime state of the part, a
|
|
123
|
+
// prop of another target on the same element (a selectable card's
|
|
124
|
+
// selection on its card), and the place another component puts the
|
|
125
|
+
// part in (the part data's aria context conditions); none is the
|
|
126
|
+
// part at rest.
|
|
127
|
+
if (!t?.props.includes(k) || t.states.includes(k)) return true;
|
|
118
128
|
return (
|
|
119
|
-
|
|
120
|
-
([
|
|
121
|
-
(attrs[k]?.length ?? 0) > 1)
|
|
129
|
+
['variant', 'status', 'tone', 'color'].includes(k) &&
|
|
130
|
+
(attrs[k]?.length ?? 0) > 1
|
|
122
131
|
);
|
|
123
132
|
},
|
|
124
133
|
);
|
|
@@ -384,7 +393,16 @@ export function makeCompiler(project, parts) {
|
|
|
384
393
|
function variantValues(target) {
|
|
385
394
|
const comp = TARGET.get(target)?.component;
|
|
386
395
|
const info = comp ? project.components[comp] : undefined;
|
|
396
|
+
// The component named like the part (Heading for heading) owns its
|
|
397
|
+
// values before any other component whose docs name the same class.
|
|
398
|
+
const pascal = target.replace(/(^|-)([a-z0-9])/g, (_, __, ch) =>
|
|
399
|
+
ch.toUpperCase(),
|
|
400
|
+
);
|
|
401
|
+
const own = project.components?.[pascal]?.targets?.find(
|
|
402
|
+
(/** @type {any} */ x) => x.className === `astryx-${target}`,
|
|
403
|
+
);
|
|
387
404
|
const t =
|
|
405
|
+
own ??
|
|
388
406
|
info?.targets.find(x => x.className === `astryx-${target}`) ??
|
|
389
407
|
info?.targets[0];
|
|
390
408
|
const fromDocs = t?.values ?? {};
|
|
@@ -393,9 +411,55 @@ export function makeCompiler(project, parts) {
|
|
|
393
411
|
const out = {};
|
|
394
412
|
for (const p of TARGET.get(target)?.props ?? [])
|
|
395
413
|
out[p] = fromDocs[p]?.length ? fromDocs[p] : (seen[p] ?? []);
|
|
414
|
+
// A state Core marks with more than one value (a checkbox's checked and
|
|
415
|
+
// indeterminate looks) is a condition --when names by value.
|
|
416
|
+
for (const st of TARGET.get(target)?.states ?? [])
|
|
417
|
+
if ((seen[st] ?? []).some(v => v !== st)) out[st] = seen[st];
|
|
396
418
|
return out;
|
|
397
419
|
}
|
|
398
420
|
|
|
421
|
+
/**
|
|
422
|
+
* The color stops of a background made of gradients, or null when any
|
|
423
|
+
* layer is an image or any stop has no color the editor can name.
|
|
424
|
+
* @param {string} v
|
|
425
|
+
* @returns {string[] | null}
|
|
426
|
+
*/
|
|
427
|
+
function gradientStops(v) {
|
|
428
|
+
/** The parts between commas outside parentheses. @param {string} x */
|
|
429
|
+
const top = x =>
|
|
430
|
+
splitTop(x, ',')
|
|
431
|
+
.map(part => part.trim())
|
|
432
|
+
.filter(Boolean);
|
|
433
|
+
/** @type {string[]} */
|
|
434
|
+
const stops = [];
|
|
435
|
+
for (const layer of top(v)) {
|
|
436
|
+
const m =
|
|
437
|
+
/^(?:repeating-)?(?:linear|radial|conic)-gradient\((.*)\)$/s.exec(
|
|
438
|
+
layer,
|
|
439
|
+
);
|
|
440
|
+
if (!m) {
|
|
441
|
+
// A layer that is one color (the shorthand's last) is a stop too.
|
|
442
|
+
if (/url\(|gradient\(/.test(layer)) return null;
|
|
443
|
+
stops.push(layer);
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
for (const arg of top(m[1])) {
|
|
447
|
+
// The direction, shape or position comes first, with no color.
|
|
448
|
+
if (
|
|
449
|
+
/^(to\b|at\b|from\b|-?[\d.]+(deg|turn|rad|grad)\b|circle\b|ellipse\b|closest|farthest)/.test(
|
|
450
|
+
arg,
|
|
451
|
+
)
|
|
452
|
+
)
|
|
453
|
+
continue;
|
|
454
|
+
// A stop is its color and up to two positions after it.
|
|
455
|
+
const color = arg.replace(/(\s+-?[\d.]+(%|px|rem|em)?)+$/, '').trim();
|
|
456
|
+
if (!color || /^-?[\d.]+(%|px|rem|em)?$/.test(color)) continue;
|
|
457
|
+
stops.push(color);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return stops.length ? stops : null;
|
|
461
|
+
}
|
|
462
|
+
|
|
399
463
|
/**
|
|
400
464
|
* Text that this theme made unreadable: every real text-on-background pair,
|
|
401
465
|
* in each mode, below 4.5:1 now but not as low in the base theme. Also
|
|
@@ -417,13 +481,18 @@ export function makeCompiler(project, parts) {
|
|
|
417
481
|
extra = [],
|
|
418
482
|
) {
|
|
419
483
|
/**
|
|
420
|
-
* The opaque colors the eye sees for a pair, or null with no fixed color
|
|
484
|
+
* The opaque colors the eye sees for a pair, or null with no fixed color:
|
|
485
|
+
* a see-through background is drawn over what is beneath it (the region
|
|
486
|
+
* the part sits in, else the page).
|
|
421
487
|
* @param {unknown} fg @param {unknown} bg @param {string} m
|
|
488
|
+
* @param {unknown} [beneath]
|
|
422
489
|
*/
|
|
423
|
-
const drawn = (fg, bg, m) => {
|
|
490
|
+
const drawn = (fg, bg, m, beneath = page(m)) => {
|
|
424
491
|
/** @type {[number, number, number]} */
|
|
425
492
|
const ground =
|
|
426
|
-
parseColor(
|
|
493
|
+
parseColor(beneath) ??
|
|
494
|
+
parseColor(page(m)) ??
|
|
495
|
+
(m === 'dark' ? [0, 0, 0] : [255, 255, 255]);
|
|
427
496
|
const bgAlpha = alphaOf(bg);
|
|
428
497
|
const back = parseColor(bg);
|
|
429
498
|
const under =
|
|
@@ -432,7 +501,7 @@ export function makeCompiler(project, parts) {
|
|
|
432
501
|
if (!under || !top) return null;
|
|
433
502
|
return [compositeOver(top, alphaOf(fg), under), under];
|
|
434
503
|
};
|
|
435
|
-
/** @type {Array<{part: string, mode: string, ratio: number, sample: string, fg: string, bgPart: string | null, bg: string}>} */
|
|
504
|
+
/** @type {Array<{part: string, mode: string, ratio: number, sample: string, fg: string, bgPart: string | null, bg: string, over: string | null}>} */
|
|
436
505
|
const out = [];
|
|
437
506
|
const seen = new Set();
|
|
438
507
|
/** @type {Set<string>} */
|
|
@@ -446,9 +515,45 @@ export function makeCompiler(project, parts) {
|
|
|
446
515
|
continue;
|
|
447
516
|
for (const m of modes) {
|
|
448
517
|
const fg = value(p, 'fg', m);
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
const
|
|
518
|
+
const whole = value(p, 'bg', m);
|
|
519
|
+
// The region a part sits in shows through its see-through background.
|
|
520
|
+
const region = p.over ? {...p, bg: p.over} : null;
|
|
521
|
+
const beneath = region ? value(region, 'bg', m) : page(m);
|
|
522
|
+
const baseBeneath = region ? baseValue(region, 'bg', m) : page(m);
|
|
523
|
+
// Over a region, only a see-through background shows it: an opaque
|
|
524
|
+
// one is measured as the pair itself already is.
|
|
525
|
+
if (
|
|
526
|
+
region &&
|
|
527
|
+
alphaOf(whole) >= 1 &&
|
|
528
|
+
!/gradient|url\(/.test(String(whole))
|
|
529
|
+
)
|
|
530
|
+
continue;
|
|
531
|
+
// A gradient is measured at each of its color stops, the worst one
|
|
532
|
+
// counting; an image, or a stop with no fixed color, is not checked.
|
|
533
|
+
const stops = /gradient|url\(/.test(String(whole))
|
|
534
|
+
? gradientStops(String(whole))
|
|
535
|
+
: [whole];
|
|
536
|
+
if (!stops) {
|
|
537
|
+
if (whole !== baseValue(p, 'bg', m)) unchecked.add(String(whole));
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
const measured = stops.map(stop => ({
|
|
541
|
+
stop,
|
|
542
|
+
pair: drawn(fg, stop, m, beneath),
|
|
543
|
+
}));
|
|
544
|
+
if (stops.length > 1 && measured.some(x => !x.pair)) {
|
|
545
|
+
if (whole !== baseValue(p, 'bg', m)) unchecked.add(String(whole));
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
const worst = measured.reduce((a, b) =>
|
|
549
|
+
a.pair &&
|
|
550
|
+
b.pair &&
|
|
551
|
+
ratio(b.pair[0], b.pair[1]) < ratio(a.pair[0], a.pair[1])
|
|
552
|
+
? b
|
|
553
|
+
: a,
|
|
554
|
+
);
|
|
555
|
+
const bg = worst.stop;
|
|
556
|
+
const pair = worst.pair;
|
|
452
557
|
if (!pair) {
|
|
453
558
|
for (const [v, side] of /** @type {const} */ ([
|
|
454
559
|
[fg, 'fg'],
|
|
@@ -465,9 +570,14 @@ export function makeCompiler(project, parts) {
|
|
|
465
570
|
}
|
|
466
571
|
const r = ratio(pair[0], pair[1]);
|
|
467
572
|
if (r >= 4.5) continue;
|
|
468
|
-
const was = drawn(
|
|
573
|
+
const was = drawn(
|
|
574
|
+
baseValue(p, 'fg', m),
|
|
575
|
+
baseValue(p, 'bg', m),
|
|
576
|
+
m,
|
|
577
|
+
baseBeneath,
|
|
578
|
+
);
|
|
469
579
|
if (was && ratio(was[0], was[1]) <= r + 0.05) continue;
|
|
470
|
-
const key = `${p.text}|${fg}|${bg}|${m}`;
|
|
580
|
+
const key = `${p.text}|${fg}|${bg}|${beneath}|${m}`;
|
|
471
581
|
if (seen.has(key)) continue;
|
|
472
582
|
seen.add(key);
|
|
473
583
|
out.push({
|
|
@@ -482,10 +592,18 @@ export function makeCompiler(project, parts) {
|
|
|
482
592
|
? String(fg)
|
|
483
593
|
: (p.fg.tokens[0] ?? String(fg)),
|
|
484
594
|
bgPart: p.bg.target,
|
|
595
|
+
// What shows through a see-through background, when it is the
|
|
596
|
+
// region the part sits in.
|
|
597
|
+
over:
|
|
598
|
+
region && alphaOf(bg) < 1
|
|
599
|
+
? `${p.over?.target}'s ${beneath !== baseBeneath ? String(beneath) : (p.over?.tokens[0] ?? String(beneath))}`
|
|
600
|
+
: null,
|
|
485
601
|
bg:
|
|
486
|
-
|
|
487
|
-
?
|
|
488
|
-
:
|
|
602
|
+
stops.length > 1
|
|
603
|
+
? `${bg}, a stop of its gradient`
|
|
604
|
+
: bg !== baseValue(p, 'bg', m)
|
|
605
|
+
? String(bg)
|
|
606
|
+
: (p.bg.tokens[0] ?? String(bg)),
|
|
489
607
|
});
|
|
490
608
|
}
|
|
491
609
|
}
|
|
@@ -56,6 +56,7 @@ export function context(cwd: string): Promise<{
|
|
|
56
56
|
fg: string;
|
|
57
57
|
bgPart: string | null;
|
|
58
58
|
bg: string;
|
|
59
|
+
over: string | null;
|
|
59
60
|
}[];
|
|
60
61
|
more: number;
|
|
61
62
|
unchecked: string[];
|
|
@@ -86,6 +87,16 @@ export function coreApp(cwd: string): string | null;
|
|
|
86
87
|
* @param {string} message
|
|
87
88
|
*/
|
|
88
89
|
export function renderCause(project: import("./_project.mjs").ThemeProject, message: string): string;
|
|
90
|
+
/**
|
|
91
|
+
* The two copies of React a render saw, when the app's and the one Core
|
|
92
|
+
* resolves differ; else null.
|
|
93
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
94
|
+
* @returns {{app: string, core: string} | null}
|
|
95
|
+
*/
|
|
96
|
+
export function reactCopies(project: import("./_project.mjs").ThemeProject): {
|
|
97
|
+
app: string;
|
|
98
|
+
core: string;
|
|
99
|
+
} | null;
|
|
89
100
|
/**
|
|
90
101
|
* Pictures of HTML files, on request.
|
|
91
102
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
@@ -101,9 +112,9 @@ export function pictures(project: import("./_project.mjs").ThemeProject, shots:
|
|
|
101
112
|
problem: string | null;
|
|
102
113
|
}>;
|
|
103
114
|
/**
|
|
104
|
-
* Font notes for the
|
|
105
|
-
* install line when its package is missing, and a warning
|
|
106
|
-
* package loads, naming the closest open font.
|
|
115
|
+
* Font notes for the families the theme builds: the import line for an
|
|
116
|
+
* open font, the install line when its package is missing, and a warning
|
|
117
|
+
* for a family no package loads, naming the closest open font.
|
|
107
118
|
* @param {import('./_settings.mjs').Ctx} ctx
|
|
108
119
|
* @param {import('./_settings.mjs').ThemeData} data
|
|
109
120
|
* @returns {string[]}
|