@astryxdesign/cli 0.7.16 → 0.7.17-canary.g0404a74
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 +17 -0
- package/api/build/_adapter.mjs +53 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/blocks/blocks.weights.json +1 -1
- 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 +6 -4
- package/api/build/kit/rank.mjs +132 -28
- package/api/build/kit/signals.d.mts +7 -1
- package/api/build/kit/signals.mjs +21 -10
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +14 -9
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +351 -46
- 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 +86 -0
- package/api/build/kit/words.mjs +241 -1
- package/api/build/tree.mjs +1 -1
- package/api/component/__fixtures__/resolutions/modules.txt +5 -6
- package/api/component/_adapter.d.mts +26 -2
- package/api/component/_adapter.mjs +135 -8
- package/api/component/component.mjs +14 -1
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +48 -6
- package/api/discover/_adapter.d.mts +11 -1
- package/api/discover/_adapter.mjs +95 -1
- package/api/discover/detail/item/item.mjs +5 -0
- package/api/discover/discover.mjs +12 -3
- package/api/discover/discover.type.d.mts +16 -3
- package/api/discover/discover.type.mjs +13 -3
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +57 -2
- package/api/docs/_adapter.mjs +266 -33
- package/api/docs/_entry-names-lazily.d.mts +22 -0
- package/api/docs/_entry-names-lazily.mjs +25 -0
- package/api/docs/_entry-names.d.mts +23 -0
- package/api/docs/_entry-names.mjs +105 -0
- 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 +54 -5
- package/api/doctor/_adapter.mjs +162 -11
- package/api/doctor/built-checks.mjs +40 -14
- package/api/doctor/doctor.d.mts +15 -3
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +31 -7
- package/api/doctor/theme-checks.d.mts +35 -3
- package/api/doctor/theme-checks.mjs +377 -29
- package/api/hook/_adapter.d.mts +10 -4
- package/api/hook/_adapter.mjs +41 -5
- package/api/hook/detail/detail.mjs +5 -2
- package/api/hook/detail/params/params.mjs +10 -3
- 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/add-helpers.mjs +10 -0
- package/api/integration/authoring-checks.mjs +11 -8
- 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/pack-check.mjs +16 -1
- package/api/integration/validate-integration.d.mts +18 -6
- package/api/integration/validate-integration.mjs +129 -15
- package/api/integration/validate-integration.type.d.mts +22 -0
- package/api/integration/validate-integration.type.mjs +2 -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 +53 -1
- package/api/render/render.type.mjs +32 -2
- package/api/search/ORDERING.md +2 -2
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.d.mts +9 -4
- package/api/search/_candidate-score.mjs +133 -46
- 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 +14 -0
- package/api/search/_lexical.mjs +93 -11
- 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/template/_adapter.d.mts +16 -0
- package/api/template/_adapter.mjs +39 -2
- package/api/template/cdn/cdn.mjs +37 -8
- package/api/template/copy/copy.d.mts +6 -3
- package/api/template/copy/copy.mjs +40 -8
- package/api/template/template.doc.mjs +3 -3
- package/api/template/template.mjs +63 -11
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +1 -0
- package/api/theme/_adapter.d.mts +12 -1
- package/api/theme/_adapter.mjs +132 -13
- package/api/theme/_app-provider.d.mts +31 -0
- package/api/theme/_app-provider.mjs +135 -0
- package/api/theme/add/add.mjs +3 -1
- package/api/theme/build/build.d.mts +142 -1
- package/api/theme/build/build.mjs +692 -284
- 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 +80 -5
- package/api/theme/build/font-warning.mjs +323 -55
- package/api/theme/build/icon-imports.mjs +51 -9
- package/api/theme/build/null-values.d.mts +28 -0
- package/api/theme/build/null-values.mjs +191 -0
- package/api/theme/list/list.mjs +17 -1
- package/api/theme/remove/remove.d.mts +2 -1
- package/api/theme/remove/remove.mjs +7 -3
- package/api/theme/theme.type.d.mts +78 -1
- package/api/theme/theme.type.mjs +38 -2
- package/api/theme/themeAdd.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +1 -1
- package/api/theme/themeRemove.doc.mjs +8 -5
- package/api/theme-edit/_adapter.d.mts +116 -4
- package/api/theme-edit/_adapter.mjs +1058 -93
- package/api/theme-edit/_catalog.d.mts +46 -2
- package/api/theme-edit/_catalog.mjs +115 -14
- package/api/theme-edit/_check.d.mts +133 -24
- package/api/theme-edit/_check.mjs +3392 -531
- package/api/theme-edit/_color.d.mts +26 -0
- package/api/theme-edit/_color.mjs +92 -2
- package/api/theme-edit/_compiler.d.mts +5 -1
- package/api/theme-edit/_compiler.mjs +141 -17
- package/api/theme-edit/_context.d.mts +74 -6
- package/api/theme-edit/_context.mjs +468 -76
- package/api/theme-edit/_css.d.mts +21 -0
- package/api/theme-edit/_css.mjs +87 -14
- package/api/theme-edit/_edit.d.mts +74 -7
- package/api/theme-edit/_edit.mjs +4426 -319
- package/api/theme-edit/_how-commands.d.mts +76 -1
- package/api/theme-edit/_how-commands.mjs +793 -9
- package/api/theme-edit/_how-question.d.mts +97 -6
- package/api/theme-edit/_how-question.mjs +9184 -747
- package/api/theme-edit/_how.d.mts +5 -2
- package/api/theme-edit/_how.mjs +255 -46
- 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 +322 -0
- package/api/theme-edit/_normal.mjs +1630 -0
- package/api/theme-edit/_palette.d.mts +49 -0
- package/api/theme-edit/_palette.mjs +180 -38
- package/api/theme-edit/_part-words.d.mts +39 -0
- package/api/theme-edit/_part-words.mjs +152 -0
- package/api/theme-edit/_parts.d.mts +55 -3
- package/api/theme-edit/_parts.mjs +421 -36
- package/api/theme-edit/_preview-app.d.mts +7 -13
- package/api/theme-edit/_preview-app.mjs +1108 -599
- package/api/theme-edit/_preview.d.mts +156 -19
- package/api/theme-edit/_preview.mjs +809 -180
- package/api/theme-edit/_project.d.mts +61 -1
- package/api/theme-edit/_project.mjs +177 -6
- package/api/theme-edit/_settings.d.mts +619 -48
- package/api/theme-edit/_settings.mjs +4910 -617
- package/api/theme-edit/_tables.d.mts +41 -0
- package/api/theme-edit/_tables.mjs +261 -41
- 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 +34 -2
- package/api/theme-edit/theme-edit.type.mjs +18 -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/api/upgrade/upgrade.mjs +16 -1
- package/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/integration-runner.mjs +1 -1
- package/assets/codemods/jscodeshift.d.ts +1 -1
- package/assets/codemods/run-codemod.mjs +151 -18
- package/assets/codemods/runner.mjs +1 -4
- 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 +2 -0
- package/assets/docs/theme.doc.dense.mjs +76 -7
- package/assets/docs/theme.doc.mjs +66 -2
- package/assets/docs/theme.doc.zh.mjs +51 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/font-setup.doc.mjs +1 -1
- package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
- package/assets/docs/tree/render-pages.doc.mjs +46 -5
- 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/tree/write-good-templates.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/docs-routes.generated.json +1 -0
- 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/ChatComposerInput/useSpeechRecognitionHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useSpeechRecognitionHookUsage.tsx +43 -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/page.tsx +31 -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/page.tsx +1 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +1 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-comparison/page.tsx +2 -2
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/page.tsx +1 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- package/assets/templates/pages/detail-page/page.tsx +60 -7
- 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/page.tsx +13 -13
- package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/page.tsx +14 -2
- package/assets/templates/pages/editor/template.doc.mjs +2 -8
- package/assets/templates/pages/file-explorer/page.tsx +9 -0
- 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/form-wizard-vertical/page.tsx +23 -3
- package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +33 -2
- package/assets/templates/pages/kanban-board/page.tsx +12 -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/page.tsx +16 -0
- package/assets/templates/pages/login-card/template.doc.mjs +2 -1
- package/assets/templates/pages/login-split/page.tsx +19 -6
- 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/messaging-shell/template.doc.mjs +6 -0
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/payment-form/page.tsx +30 -4
- package/assets/templates/pages/product-detail/page.tsx +26 -2
- 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/page.tsx +162 -12
- 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/page.tsx +11 -3
- 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/page.tsx +9 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/page.tsx +161 -133
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- package/assets/templates/pages/table-page/page.tsx +14 -1
- 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/page.tsx +47 -7
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/assets/theme.template.ts +9 -2
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +9 -9
- 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/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +24 -1
- package/authoring/integration/schema.mjs +126 -4
- package/authoring/integration/type.ts +14 -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 +22 -3
- package/clients/cli/commands/discover.mjs +70 -3
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +44 -6
- package/clients/cli/commands/doctor.mjs +84 -16
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +1032 -134
- 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 +2 -2
- 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 +2 -2
- 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-remove.doc.mjs +4 -4
- 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.doc.mjs +1 -1
- package/clients/cli/commands/template.mjs +15 -2
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme-remove.doc.mjs +13 -5
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +849 -441
- package/clients/cli/commands/upgrade.mjs +46 -8
- package/clients/cli/index.mjs +9 -19
- 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 +265 -29
- package/clients/cli/lib/manifest.mjs +3 -2
- package/clients/cli/lib/stray-option.mjs +478 -0
- package/clients/cli/lib/unknown-command.mjs +353 -0
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +26 -29
- package/foundation/config/theme-state.d.mts +31 -2
- package/foundation/config/theme-state.mjs +140 -8
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/cli-self-doc-names.d.mts +13 -0
- package/foundation/discovery/cli-self-doc-names.mjs +51 -0
- package/foundation/discovery/cli-self-docs.d.mts +0 -2
- package/foundation/discovery/cli-self-docs.mjs +2 -15
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +59 -10
- 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/core-theme-facts.d.mts +70 -0
- package/foundation/discovery/core-theme-facts.mjs +384 -0
- package/foundation/discovery/doc-types.mjs +4 -3
- package/foundation/discovery/docs-discovery.d.mts +66 -9
- package/foundation/discovery/docs-discovery.mjs +126 -60
- package/foundation/discovery/entry-name-files.d.mts +106 -0
- package/foundation/discovery/entry-name-files.mjs +354 -0
- package/foundation/discovery/hook-discovery.d.mts +18 -2
- package/foundation/discovery/hook-discovery.mjs +93 -42
- 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-component-views.d.mts +15 -0
- package/foundation/discovery/integration-component-views.mjs +91 -0
- package/foundation/discovery/integration-doc-files.mjs +2 -1
- package/foundation/discovery/module-exports.d.mts +26 -1
- package/foundation/discovery/module-exports.mjs +114 -40
- package/foundation/discovery/name-roots.d.mts +38 -0
- package/foundation/discovery/name-roots.mjs +108 -0
- package/foundation/discovery/next-routes.d.mts +48 -0
- package/foundation/discovery/next-routes.mjs +181 -0
- 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 +40 -18
- package/foundation/discovery/template-adapter.d.mts +49 -29
- package/foundation/discovery/template-adapter.mjs +89 -99
- package/foundation/discovery/template-destination.d.mts +28 -0
- package/foundation/discovery/template-destination.mjs +104 -0
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/template-ids.d.mts +69 -0
- package/foundation/discovery/template-ids.mjs +199 -0
- package/foundation/discovery/theme-discovery.d.mts +12 -0
- package/foundation/discovery/theme-discovery.mjs +34 -4
- package/foundation/discovery/theme-imports.d.mts +24 -0
- package/foundation/discovery/theme-imports.mjs +61 -4
- package/foundation/discovery/theming-targets.d.mts +13 -5
- package/foundation/discovery/theming-targets.mjs +41 -47
- package/foundation/doc-compiler/generated-levels.d.mts +43 -0
- package/foundation/doc-compiler/generated-levels.mjs +72 -0
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- package/foundation/doc-compiler/literal-doc.d.mts +12 -0
- package/foundation/doc-compiler/literal-doc.mjs +322 -0
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +29 -0
- package/foundation/doc-compiler/stored-docs.mjs +63 -1
- package/foundation/doc-compiler/tree.d.mts +4 -84
- package/foundation/doc-compiler/tree.mjs +4 -62
- package/foundation/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +46 -0
- package/foundation/fonts/font-stylesheet.mjs +173 -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 +16 -5
- package/foundation/fs/gather-cache.d.mts +94 -4
- package/foundation/fs/gather-cache.mjs +671 -106
- package/foundation/fs/glob.d.mts +16 -0
- package/foundation/fs/glob.mjs +105 -0
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +80 -0
- package/foundation/fs/kept-tree.mjs +240 -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/path-safety.d.mts +11 -2
- package/foundation/fs/path-safety.mjs +108 -18
- package/foundation/fs/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/fs/read-record.d.mts +56 -7
- package/foundation/fs/read-record.mjs +280 -56
- package/foundation/fs/regular-file.d.mts +29 -0
- package/foundation/fs/regular-file.mjs +77 -0
- 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/integrations.d.mts +23 -1
- package/foundation/integrations/integrations.mjs +18 -1
- package/foundation/integrations/pack-state.d.mts +75 -0
- package/foundation/integrations/pack-state.mjs +314 -0
- package/foundation/integrations/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/shipped-imports.d.mts +122 -0
- package/foundation/integrations/shipped-imports.mjs +497 -0
- package/foundation/integrations/validate-contributions.d.mts +0 -17
- package/foundation/integrations/validate-contributions.mjs +59 -333
- package/foundation/render/assets.mjs +52 -7
- package/foundation/render/charts.d.mts +78 -27
- package/foundation/render/charts.mjs +266 -90
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +70 -7
- package/foundation/render/embedded-imports.mjs +132 -41
- 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/layers.d.mts +30 -0
- package/foundation/render/layers.mjs +158 -0
- package/foundation/render/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/offline.d.mts +32 -0
- package/foundation/render/offline.mjs +56 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +354 -21
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +192 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +46 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +79 -5
- package/foundation/render/render-page.mjs +735 -109
- 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 +6 -6
- package/foundation/suggest/name-index.d.mts +148 -0
- package/foundation/suggest/name-index.mjs +317 -0
- package/foundation/suggest/other-command.d.mts +140 -0
- package/foundation/suggest/other-command.mjs +756 -0
- 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/entry-names.d.mts +14 -0
- package/foundation/text/entry-names.mjs +14 -0
- package/foundation/text/string-utils.d.mts +46 -6
- package/foundation/text/string-utils.mjs +118 -20
- package/foundation/text/suggest-order.d.mts +47 -4
- package/foundation/text/suggest-order.mjs +174 -5
- package/foundation/xle/browser.d.mts +2 -2
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
|
@@ -53,6 +53,18 @@ export function paletteFiles(slug: string): {
|
|
|
53
53
|
* @param {string} value
|
|
54
54
|
*/
|
|
55
55
|
export function seedOf(value: string): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Whether a color dial's seed comes out different at two vibrancies: the
|
|
58
|
+
* ramp the generator grows from it, light and dark, compared shade by
|
|
59
|
+
* shade. A seed with no saturation to change (a pure gray) gives the same
|
|
60
|
+
* ramp at every vibrancy. A gray-ish seed is grown as the editor grows it
|
|
61
|
+
* (a neutral), so a warm or cool gray counts by what it shows.
|
|
62
|
+
* @param {string} dial
|
|
63
|
+
* @param {string | null} seed
|
|
64
|
+
* @param {number} from
|
|
65
|
+
* @param {number} to
|
|
66
|
+
*/
|
|
67
|
+
export function vibrancyMoves(dial: string, seed: string | null, from: number, to: number): boolean;
|
|
56
68
|
/**
|
|
57
69
|
* The modes a theme has: one for a one-mode theme, else light and dark.
|
|
58
70
|
* @param {{mode?: string}} data
|
|
@@ -111,6 +123,14 @@ export function syncPalette(cwd: string, slug: string, data: {
|
|
|
111
123
|
* @returns {Record<string, string>}
|
|
112
124
|
*/
|
|
113
125
|
export function readWrittenRecord(cwd: string, slug: string): Record<string, string>;
|
|
126
|
+
/**
|
|
127
|
+
* The record of what the editor wrote, read from a theme folder as it is
|
|
128
|
+
* (a copy of one included); empty when there is none or it is damaged.
|
|
129
|
+
* @param {string} dir
|
|
130
|
+
* @param {string} slug
|
|
131
|
+
* @returns {Record<string, string>}
|
|
132
|
+
*/
|
|
133
|
+
export function readRecordIn(dir: string, slug: string): Record<string, string>;
|
|
114
134
|
/**
|
|
115
135
|
* Write the record whole, or remove it when it names nothing. A record that
|
|
116
136
|
* cannot be written leaves nothing removed later: the safe way round.
|
|
@@ -195,6 +215,33 @@ export function paletteDialOf(token: string): string | null;
|
|
|
195
215
|
* @returns {string[]}
|
|
196
216
|
*/
|
|
197
217
|
export function mappingRows(dial: string): string[];
|
|
218
|
+
/**
|
|
219
|
+
* A contrast check's identity: its token, its mode and what it is measured
|
|
220
|
+
* on, whatever ratio or shade it reaches. The same check before and after a
|
|
221
|
+
* change has the same key, as a text or border problem's key does.
|
|
222
|
+
* @param {ContrastCheck} c
|
|
223
|
+
*/
|
|
224
|
+
export function paletteCheckKey(c: ContrastCheck): string;
|
|
225
|
+
/**
|
|
226
|
+
* The contrast checks a dial's colors fail, as their notes say them, each
|
|
227
|
+
* with its identity ({@link paletteCheckKey}), to tell the checks a change
|
|
228
|
+
* made fail from the ones that failed before it.
|
|
229
|
+
* @param {PaletteMapping | null} pal
|
|
230
|
+
* @param {string} dial
|
|
231
|
+
* @param {Mode[]} [modes] the modes the theme has
|
|
232
|
+
* @returns {Array<{key: string, text: string}>}
|
|
233
|
+
*/
|
|
234
|
+
export function paletteFailures(pal: PaletteMapping | null, dial: string, modes?: Mode[]): Array<{
|
|
235
|
+
key: string;
|
|
236
|
+
text: string;
|
|
237
|
+
}>;
|
|
238
|
+
/**
|
|
239
|
+
* The identities of every contrast check a palette fails, whatever its
|
|
240
|
+
* dial: what a change compares its own failures with.
|
|
241
|
+
* @param {PaletteMapping | null} pal
|
|
242
|
+
* @returns {Set<string>}
|
|
243
|
+
*/
|
|
244
|
+
export function paletteFailedKeys(pal: PaletteMapping | null): Set<string>;
|
|
198
245
|
/**
|
|
199
246
|
* What one color dial did, for the result notes: what its main token uses
|
|
200
247
|
* in each mode, every token contrast moved, and last the generated files.
|
|
@@ -207,6 +254,7 @@ export function mappingRows(dial: string): string[];
|
|
|
207
254
|
* @returns {string[]}
|
|
208
255
|
*/
|
|
209
256
|
export function paletteNotes(pal: PaletteMapping | null, dial: string, slug: string, modes?: Mode[]): string[];
|
|
257
|
+
export { readRegularFile };
|
|
210
258
|
export function isEditorTemp(name: string): boolean;
|
|
211
259
|
/** @typedef {'light' | 'dark'} Mode */
|
|
212
260
|
/** @typedef {import('./_settings.mjs').Setting} Setting */
|
|
@@ -377,3 +425,4 @@ export type PaletteMapping = {
|
|
|
377
425
|
*/
|
|
378
426
|
lift: Record<string, Partial<Record<Mode, StopRef>>> | null;
|
|
379
427
|
};
|
|
428
|
+
import { readRegularFile } from '../../foundation/fs/regular-file.mjs';
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
import * as fs from 'node:fs';
|
|
19
19
|
import * as path from 'node:path';
|
|
20
|
+
import {readRegularFile} from '../../foundation/fs/regular-file.mjs';
|
|
20
21
|
import {isAlive} from '../../foundation/release/cache.mjs';
|
|
21
22
|
import {stillHolds} from '../../foundation/release/folder-lock.mjs';
|
|
22
23
|
import {AstryxError} from '../error.mjs';
|
|
@@ -64,6 +65,8 @@ import {P, wordTable} from './_tables.mjs';
|
|
|
64
65
|
import {quoteCommandArgument} from '../../foundation/env/package-manager.mjs';
|
|
65
66
|
import {sha256} from '../../foundation/render/source-block.mjs';
|
|
66
67
|
|
|
68
|
+
export {readRegularFile};
|
|
69
|
+
|
|
67
70
|
/**
|
|
68
71
|
* Write a file whole: a temp file beside it, renamed into place, so a link
|
|
69
72
|
* there is replaced, never written through, and a stopped write leaves the
|
|
@@ -156,7 +159,11 @@ function sweepTemps(dir) {
|
|
|
156
159
|
}
|
|
157
160
|
continue;
|
|
158
161
|
}
|
|
159
|
-
|
|
162
|
+
// A picture taken under its own name (`.<picture>.part-<pid>.png`) by a
|
|
163
|
+
// run stopped while the browser ran.
|
|
164
|
+
const m =
|
|
165
|
+
/^\..+\.astryx-(\d+)-[a-z0-9]+\.tmp$/.exec(n) ??
|
|
166
|
+
/^\.[\w-]+\.part-(\d+)\.png$/.exec(n);
|
|
160
167
|
if (!m) continue;
|
|
161
168
|
const p = path.join(dir, n);
|
|
162
169
|
try {
|
|
@@ -203,12 +210,14 @@ export function removeEmptyFolder(dir, opts = {}) {
|
|
|
203
210
|
|
|
204
211
|
/**
|
|
205
212
|
* Whether a file name is one of the editor's own temp files: a whole-file
|
|
206
|
-
* write's `.<name>.astryx-<pid>-<random>.tmp`,
|
|
207
|
-
* `.<
|
|
213
|
+
* write's `.<name>.astryx-<pid>-<random>.tmp`, a build's `.<name>.tmp-<id>`,
|
|
214
|
+
* or a picture's `.<picture>.part-<pid>.png`. A command stopped part way can
|
|
215
|
+
* leave one behind.
|
|
208
216
|
* @param {string} name
|
|
209
217
|
*/
|
|
210
218
|
export const isEditorTemp = name =>
|
|
211
|
-
/^\..+\.(astryx-\d+-[a-z0-9]+\.tmp|tmp-[\w-]+)$/.test(name)
|
|
219
|
+
/^\..+\.(astryx-\d+-[a-z0-9]+\.tmp|tmp-[\w-]+)$/.test(name) ||
|
|
220
|
+
/^\.[\w-]+\.part-\d+\.png$/.test(name);
|
|
212
221
|
|
|
213
222
|
/**
|
|
214
223
|
* A temp file beside `file` for a whole write, named so only the editor
|
|
@@ -323,8 +332,9 @@ const NON_TEXT = 3;
|
|
|
323
332
|
/**
|
|
324
333
|
* The official neutral theme's color mapping, read from the theme the CLI
|
|
325
334
|
* ships rather than copied: each token's stops, `[light, dark]`, written
|
|
326
|
-
* there as `<family>.<mode>[N]` or `withAlpha(<family>.<mode>[N], 'aa')
|
|
327
|
-
*
|
|
335
|
+
* there as `<family>.<mode>[N]` or `withAlpha(<family>.<mode>[N], 'aa')`
|
|
336
|
+
* (one stop for both modes when it writes one), and the parts whose
|
|
337
|
+
* secondary text it lifts (`[part, block]`).
|
|
328
338
|
* @returns {{stops: Record<string, Array<{stop: number, alpha?: string}>>, lifted: Array<[string, string]>}}
|
|
329
339
|
*/
|
|
330
340
|
function readOfficialNeutral() {
|
|
@@ -364,6 +374,9 @@ function readOfficialNeutral() {
|
|
|
364
374
|
if (keys.at(-1) === 'tokens' && node.value.type === 'ArrayExpression') {
|
|
365
375
|
const pair = node.value.elements.map(stopOf);
|
|
366
376
|
if (pair.length === 2 && pair.every(Boolean)) stops[key] = pair;
|
|
377
|
+
} else if (keys.at(-1) === 'tokens') {
|
|
378
|
+
const one = stopOf(node.value);
|
|
379
|
+
if (one) stops[key] = [one, one];
|
|
367
380
|
}
|
|
368
381
|
if (keys.at(-3) === 'components' && key === '--color-text-secondary')
|
|
369
382
|
lifted.push([keys.at(-2) ?? '', keys.at(-1) ?? '']);
|
|
@@ -387,27 +400,41 @@ const officialStops = token =>
|
|
|
387
400
|
/**
|
|
388
401
|
* The tokens the neutral color sets at the official theme's stops. The page
|
|
389
402
|
* background, `--color-background-body`, stays the base theme's, so a
|
|
390
|
-
* tinted gray never tints the page.
|
|
391
|
-
*
|
|
403
|
+
* tinted gray never tints the page. The inverted surface (tooltips,
|
|
404
|
+
* toasts), which the official theme leaves to Core, is the card surface of
|
|
405
|
+
* the other mode, as Core makes it from a neutral scale, inside the ramp
|
|
406
|
+
* (Core's tones 10 and 99: never the white or black end every ramp shares)
|
|
407
|
+
* so it carries the neutral color (NEUTRAL_INSIDE); the text on it is the
|
|
408
|
+
* theme's on-dark and on-light. A layout without one of these stops uses
|
|
409
|
+
* the nearest one it has.
|
|
392
410
|
*/
|
|
393
411
|
const NEUTRAL_STOPS = wordTable(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
412
|
+
/** @type {Record<string, [number, number]>} */ ({
|
|
413
|
+
...Object.fromEntries(
|
|
414
|
+
[
|
|
415
|
+
'--color-background-surface',
|
|
416
|
+
'--color-background-card',
|
|
417
|
+
'--color-background-popover',
|
|
418
|
+
'--color-background-muted',
|
|
419
|
+
'--color-text-primary',
|
|
420
|
+
'--color-text-secondary',
|
|
421
|
+
'--color-text-disabled',
|
|
422
|
+
'--color-icon-primary',
|
|
423
|
+
'--color-icon-secondary',
|
|
424
|
+
'--color-icon-disabled',
|
|
425
|
+
'--color-border-emphasized',
|
|
426
|
+
'--color-skeleton',
|
|
427
|
+
'--color-on-dark',
|
|
428
|
+
'--color-on-light',
|
|
429
|
+
].map(t => [t, officialStops(t)]),
|
|
430
|
+
),
|
|
431
|
+
'--color-background-inverted': /** @type {[number, number]} */ (
|
|
432
|
+
[...officialStops('--color-background-card')].reverse()
|
|
433
|
+
),
|
|
434
|
+
}),
|
|
410
435
|
);
|
|
436
|
+
/** Neutral tokens whose shade stays inside the ramp, off its white and black ends. */
|
|
437
|
+
const NEUTRAL_INSIDE = new Set(['--color-background-inverted']);
|
|
411
438
|
/** Neutral tints: a stop with an opacity, `[[stop, alpha], [stop, alpha]]`. */
|
|
412
439
|
const NEUTRAL_TINTS = wordTable(
|
|
413
440
|
Object.fromEntries(
|
|
@@ -536,6 +563,33 @@ const isGray = seed => hexToOklch(seed).C < GRAY_CHROMA;
|
|
|
536
563
|
/** Whether a seed (or no seed) has no color to saturate. @param {string | null} seed */
|
|
537
564
|
export const isGraySeed = seed => !seed || isGray(seed);
|
|
538
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Whether a color dial's seed comes out different at two vibrancies: the
|
|
568
|
+
* ramp the generator grows from it, light and dark, compared shade by
|
|
569
|
+
* shade. A seed with no saturation to change (a pure gray) gives the same
|
|
570
|
+
* ramp at every vibrancy. A gray-ish seed is grown as the editor grows it
|
|
571
|
+
* (a neutral), so a warm or cool gray counts by what it shows.
|
|
572
|
+
* @param {string} dial
|
|
573
|
+
* @param {string | null} seed
|
|
574
|
+
* @param {number} from
|
|
575
|
+
* @param {number} to
|
|
576
|
+
*/
|
|
577
|
+
export function vibrancyMoves(dial, seed, from, to) {
|
|
578
|
+
if (!seed || from === to) return false;
|
|
579
|
+
const kind = dial === 'neutral' || isGray(seed) ? 'neutral' : 'chromatic';
|
|
580
|
+
const ramp = (/** @type {number} */ vibrancy) =>
|
|
581
|
+
JSON.stringify(
|
|
582
|
+
/** @type {any} */ (
|
|
583
|
+
generate({
|
|
584
|
+
vibrancy,
|
|
585
|
+
...(kind === 'neutral' ? {neutralProfile: 'custom'} : {}),
|
|
586
|
+
families: [{id: 'seed', seed, kind}],
|
|
587
|
+
}).palette.seed
|
|
588
|
+
),
|
|
589
|
+
);
|
|
590
|
+
return ramp(from) !== ramp(to);
|
|
591
|
+
}
|
|
592
|
+
|
|
539
593
|
/** @param {unknown} a @param {unknown} b */
|
|
540
594
|
function sameColor(a, b) {
|
|
541
595
|
try {
|
|
@@ -782,6 +836,12 @@ function tools(
|
|
|
782
836
|
const {stops} = candidate;
|
|
783
837
|
/** @param {number} n */
|
|
784
838
|
const at = n => nearestStop(stops, n);
|
|
839
|
+
/** The stop nearest `n` off the white and black ends. @param {number} n */
|
|
840
|
+
const atInside = n =>
|
|
841
|
+
nearestStop(
|
|
842
|
+
stops.filter(s => s > 0 && s < 100),
|
|
843
|
+
n,
|
|
844
|
+
);
|
|
785
845
|
/** @param {string} id @param {Mode} m @param {number} stop @param {string} [alpha] @returns {StopRef} */
|
|
786
846
|
const ref = (id, m, stop, alpha) => {
|
|
787
847
|
const color = /** @type {any} */ (candidate.palette[id])[m][stop];
|
|
@@ -960,6 +1020,7 @@ function tools(
|
|
|
960
1020
|
return {
|
|
961
1021
|
stops,
|
|
962
1022
|
at,
|
|
1023
|
+
atInside,
|
|
963
1024
|
ref,
|
|
964
1025
|
exactOf,
|
|
965
1026
|
settingOf,
|
|
@@ -1460,9 +1521,20 @@ function syncPaletteFiles(cwd, slug, data, base) {
|
|
|
1460
1521
|
* @returns {Record<string, string>}
|
|
1461
1522
|
*/
|
|
1462
1523
|
export function readWrittenRecord(cwd, slug) {
|
|
1524
|
+
return readRecordIn(path.join(cwd, 'themes', slug), slug);
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* The record of what the editor wrote, read from a theme folder as it is
|
|
1529
|
+
* (a copy of one included); empty when there is none or it is damaged.
|
|
1530
|
+
* @param {string} dir
|
|
1531
|
+
* @param {string} slug
|
|
1532
|
+
* @returns {Record<string, string>}
|
|
1533
|
+
*/
|
|
1534
|
+
export function readRecordIn(dir, slug) {
|
|
1463
1535
|
try {
|
|
1464
1536
|
const json = JSON.parse(
|
|
1465
|
-
|
|
1537
|
+
readRegularFile(path.join(dir, `${slug}.pictures.json`), 'utf8'),
|
|
1466
1538
|
);
|
|
1467
1539
|
return json && typeof json === 'object' && !Array.isArray(json) ? json : {};
|
|
1468
1540
|
} catch {
|
|
@@ -1902,7 +1974,18 @@ export function paletteMapping(cwd, slug, data, base, tokenDefaults) {
|
|
|
1902
1974
|
const {config} = plan;
|
|
1903
1975
|
const candidate = generate(config, paletteFiles(slug).config);
|
|
1904
1976
|
const t = tools(candidate, data, base, ownSourceTokenValues(cwd, slug));
|
|
1905
|
-
const {
|
|
1977
|
+
const {
|
|
1978
|
+
stops,
|
|
1979
|
+
at,
|
|
1980
|
+
atInside,
|
|
1981
|
+
ref,
|
|
1982
|
+
exactOf,
|
|
1983
|
+
rawOf,
|
|
1984
|
+
settingOf,
|
|
1985
|
+
side,
|
|
1986
|
+
solid,
|
|
1987
|
+
surfaces,
|
|
1988
|
+
} = t;
|
|
1906
1989
|
// Both halves, for a one-mode theme too (see planPalette).
|
|
1907
1990
|
const modes = modesForStrategy('light-and-dark');
|
|
1908
1991
|
/** @type {PaletteMapping['tokens']} */
|
|
@@ -1984,10 +2067,11 @@ export function paletteMapping(cwd, slug, data, base, tokenDefaults) {
|
|
|
1984
2067
|
token === '--color-icon-secondary'
|
|
1985
2068
|
)
|
|
1986
2069
|
continue;
|
|
2070
|
+
const shade = NEUTRAL_INSIDE.has(token) ? atInside : at;
|
|
1987
2071
|
put(
|
|
1988
2072
|
token,
|
|
1989
2073
|
'neutral',
|
|
1990
|
-
each(m => ref('neutral', m,
|
|
2074
|
+
each(m => ref('neutral', m, shade(pair[side(m)]))),
|
|
1991
2075
|
);
|
|
1992
2076
|
}
|
|
1993
2077
|
for (const [token, pair] of Object.entries(NEUTRAL_TINTS))
|
|
@@ -2506,7 +2590,7 @@ export function mappingRows(dial) {
|
|
|
2506
2590
|
'your exact color sits at its own shade, light and dark, and the shades around it follow it (white and black are already the ends of every ramp)',
|
|
2507
2591
|
...Object.entries(NEUTRAL_STOPS).map(
|
|
2508
2592
|
([t, [l, d]]) =>
|
|
2509
|
-
`${t}: light shade ${l}, dark shade ${d}${t.endsWith('-secondary') ? ` (moves to a shade that reads at ${t.includes('icon') ? NON_TEXT : TEXT}:1 on the surfaces)` : ''}`,
|
|
2593
|
+
`${t}: light shade ${l}, dark shade ${d}${t.endsWith('-secondary') ? ` (moves to a shade that reads at ${t.includes('icon') ? NON_TEXT : TEXT}:1 on the surfaces)` : NEUTRAL_INSIDE.has(t) ? ' (the card surface of the other mode, for tooltips and toasts, at the nearest shade inside the ramp so it carries your color)' : ''}`,
|
|
2510
2594
|
),
|
|
2511
2595
|
...Object.entries(NEUTRAL_TINTS).map(
|
|
2512
2596
|
([t, [[l, la], [d, da]]]) =>
|
|
@@ -2550,6 +2634,72 @@ export function mappingRows(dial) {
|
|
|
2550
2634
|
return rows;
|
|
2551
2635
|
}
|
|
2552
2636
|
|
|
2637
|
+
/**
|
|
2638
|
+
* The contrast checks of the colors a dial makes, in the theme's modes.
|
|
2639
|
+
* @param {PaletteMapping} pal
|
|
2640
|
+
* @param {string} dial
|
|
2641
|
+
* @param {Mode[]} modes
|
|
2642
|
+
*/
|
|
2643
|
+
function dialChecks(pal, dial, modes) {
|
|
2644
|
+
return pal.contrast.filter(
|
|
2645
|
+
c =>
|
|
2646
|
+
(pal.tokens[c.token]?.family === dial || c.dials?.includes(dial)) &&
|
|
2647
|
+
// A theme with one mode never shows the other one's shades.
|
|
2648
|
+
modes.includes(c.mode),
|
|
2649
|
+
);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2652
|
+
/**
|
|
2653
|
+
* What one contrast check says: its own note, or for a failed one the
|
|
2654
|
+
* ratio it reached.
|
|
2655
|
+
* @param {PaletteMapping['contrast'][number]} c
|
|
2656
|
+
* @param {string} dial
|
|
2657
|
+
*/
|
|
2658
|
+
function checkNote(c, dial) {
|
|
2659
|
+
return (
|
|
2660
|
+
c.note ||
|
|
2661
|
+
`${c.token} reads at only ${c.ratio}:1 in ${c.mode} on ${c.against} (needs ${c.needs}:1) even at shade ${shade(c.stop)}, the most contrasting one: pick a lighter or darker ${dial}, or set ${c.token} exactly`
|
|
2662
|
+
);
|
|
2663
|
+
}
|
|
2664
|
+
|
|
2665
|
+
/**
|
|
2666
|
+
* A contrast check's identity: its token, its mode and what it is measured
|
|
2667
|
+
* on, whatever ratio or shade it reaches. The same check before and after a
|
|
2668
|
+
* change has the same key, as a text or border problem's key does.
|
|
2669
|
+
* @param {ContrastCheck} c
|
|
2670
|
+
*/
|
|
2671
|
+
export function paletteCheckKey(c) {
|
|
2672
|
+
return `palette|${c.token}|${c.mode}|${c.against}`;
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
/**
|
|
2676
|
+
* The contrast checks a dial's colors fail, as their notes say them, each
|
|
2677
|
+
* with its identity ({@link paletteCheckKey}), to tell the checks a change
|
|
2678
|
+
* made fail from the ones that failed before it.
|
|
2679
|
+
* @param {PaletteMapping | null} pal
|
|
2680
|
+
* @param {string} dial
|
|
2681
|
+
* @param {Mode[]} [modes] the modes the theme has
|
|
2682
|
+
* @returns {Array<{key: string, text: string}>}
|
|
2683
|
+
*/
|
|
2684
|
+
export function paletteFailures(pal, dial, modes = ['light', 'dark']) {
|
|
2685
|
+
if (!pal) return [];
|
|
2686
|
+
return dialChecks(pal, dial, modes)
|
|
2687
|
+
.filter(c => !c.pass)
|
|
2688
|
+
.map(c => ({key: paletteCheckKey(c), text: checkNote(c, dial)}));
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* The identities of every contrast check a palette fails, whatever its
|
|
2693
|
+
* dial: what a change compares its own failures with.
|
|
2694
|
+
* @param {PaletteMapping | null} pal
|
|
2695
|
+
* @returns {Set<string>}
|
|
2696
|
+
*/
|
|
2697
|
+
export function paletteFailedKeys(pal) {
|
|
2698
|
+
return new Set(
|
|
2699
|
+
(pal?.contrast ?? []).filter(c => !c.pass).map(paletteCheckKey),
|
|
2700
|
+
);
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2553
2703
|
/**
|
|
2554
2704
|
* What one color dial did, for the result notes: what its main token uses
|
|
2555
2705
|
* in each mode, every token contrast moved, and last the generated files.
|
|
@@ -2598,16 +2748,8 @@ export function paletteNotes(pal, dial, slug, modes = ['light', 'dark']) {
|
|
|
2598
2748
|
notes.push(
|
|
2599
2749
|
`your ${dial} ${given.value} is outside the colors every screen shows (sRGB), so the nearest one, ${given.seed}, is used`,
|
|
2600
2750
|
);
|
|
2601
|
-
for (const c of pal
|
|
2602
|
-
if (
|
|
2603
|
-
continue;
|
|
2604
|
-
// A theme with one mode never shows the other one's shades.
|
|
2605
|
-
if (!modes.includes(c.mode)) continue;
|
|
2606
|
-
if (c.note) notes.push(c.note);
|
|
2607
|
-
else if (!c.pass)
|
|
2608
|
-
notes.push(
|
|
2609
|
-
`${c.token} reads at only ${c.ratio}:1 in ${c.mode} on ${c.against} (needs ${c.needs}:1) even at shade ${shade(c.stop)}, the most contrasting one: pick a lighter or darker ${dial}, or set ${c.token} exactly`,
|
|
2610
|
-
);
|
|
2751
|
+
for (const c of dialChecks(pal, dial, modes)) {
|
|
2752
|
+
if (c.note || !c.pass) notes.push(checkNote(c, dial));
|
|
2611
2753
|
else if (c.stop !== c.preferred)
|
|
2612
2754
|
notes.push(
|
|
2613
2755
|
`${c.token} uses shade ${shade(c.stop)} in ${c.mode}, not ${shade(c.preferred)}, so it reads at ${c.ratio}:1 on ${c.against}`,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The part or group a plain word names, as how reads it (`checkboxes` is
|
|
6
|
+
* the checks group, `panels` the containers), or null.
|
|
7
|
+
* @param {string} word
|
|
8
|
+
* @returns {string | null}
|
|
9
|
+
*/
|
|
10
|
+
export function partForWord(word: string): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* The single words the table reads as a part or group, each with what it
|
|
13
|
+
* names (`sidebar` side-nav, `checkbox` checks, `toggle` switch): the words
|
|
14
|
+
* a part's typo is read against beside the part names. Taken from the
|
|
15
|
+
* table's own words, a plural's singular (`toggles?`) included.
|
|
16
|
+
* @returns {Map<string, string>}
|
|
17
|
+
*/
|
|
18
|
+
export function partWords(): Map<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* @file The plain words for parts that Core's catalog cannot give (groups,
|
|
21
|
+
* variants, font roles, phrases of several words, and words two components
|
|
22
|
+
* share), and the part or group one plain word names.
|
|
23
|
+
* @position api/theme-edit — a leaf with no imports, read by _how-question.mjs
|
|
24
|
+
* and _check.mjs
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Phrases for parts that Core's catalog cannot give: groups, variants,
|
|
28
|
+
* font roles, phrases of several words, and words two components share.
|
|
29
|
+
* They are read before the catalog's names and doc keywords
|
|
30
|
+
* (partLexicon), longest phrase first.
|
|
31
|
+
* @type {Array<[RegExp, {on: string, when?: string, role?: string, level?: string, missing?: string}]>}
|
|
32
|
+
*/
|
|
33
|
+
export const OVERRIDES: Array<[RegExp, {
|
|
34
|
+
on: string;
|
|
35
|
+
when?: string;
|
|
36
|
+
role?: string;
|
|
37
|
+
level?: string;
|
|
38
|
+
missing?: string;
|
|
39
|
+
}]>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The plain words for parts that Core's catalog cannot give (groups,
|
|
5
|
+
* variants, font roles, phrases of several words, and words two components
|
|
6
|
+
* share), and the part or group one plain word names.
|
|
7
|
+
* @position api/theme-edit — a leaf with no imports, read by _how-question.mjs
|
|
8
|
+
* and _check.mjs
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Phrases for parts that Core's catalog cannot give: groups, variants,
|
|
13
|
+
* font roles, phrases of several words, and words two components share.
|
|
14
|
+
* They are read before the catalog's names and doc keywords
|
|
15
|
+
* (partLexicon), longest phrase first.
|
|
16
|
+
* @type {Array<[RegExp, {on: string, when?: string, role?: string, level?: string, missing?: string}]>}
|
|
17
|
+
*/
|
|
18
|
+
export const OVERRIDES = [
|
|
19
|
+
[/\bdividers?\b/, {on: 'divider'}],
|
|
20
|
+
[
|
|
21
|
+
/\baccordions? (headers?|triggers?|titles?|headings?)\b/,
|
|
22
|
+
{on: 'collapsible-trigger'},
|
|
23
|
+
],
|
|
24
|
+
[/\baccordions?\b/, {on: 'collapsible'}],
|
|
25
|
+
[/\bcombo ?box(es)?\b/, {on: 'complex-selector'}],
|
|
26
|
+
[/\bnotifications?\b/, {on: 'toast'}],
|
|
27
|
+
[/\b(focus (ring|outline)s?)\b/, {on: 'focus-ring'}],
|
|
28
|
+
[/\b((modal |dialog )?(overlay|scrim|backdrop))\b/, {on: 'overlay'}],
|
|
29
|
+
[/\bicons?\b/, {on: 'icons'}],
|
|
30
|
+
[
|
|
31
|
+
/\b(table header|column headers?|table headings?)\b/,
|
|
32
|
+
{on: 'table-header-cell'},
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
/\b(tabs? (underline|indicator)s?|underline (of|on|under) (the )?tabs?)\b/,
|
|
36
|
+
{on: 'tab-indicator'},
|
|
37
|
+
],
|
|
38
|
+
[/\b(status dots?)\b/, {on: 'status-dot'}],
|
|
39
|
+
[/\b(progress( bar)?( fill)?|loading bar)\b/, {on: 'progress-bar-fill'}],
|
|
40
|
+
[
|
|
41
|
+
/\b((side ?nav|sidebar)( nav(igation)?)? (links?|items?))\b/,
|
|
42
|
+
{on: 'side-nav-item'},
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
/\b((dropdown |context )?menu (items?|options?|entries)|dropdown items?)\b/,
|
|
46
|
+
{on: 'dropdown-menu-item'},
|
|
47
|
+
],
|
|
48
|
+
[/\b(nav(igation)? (links?|items?))\b/, {on: 'top-nav-item'}],
|
|
49
|
+
// A context menu is its own part in Core (its items are the dropdown
|
|
50
|
+
// menu's items, which it reuses).
|
|
51
|
+
[/\b(context ?menus?|right[- ]click menus?)\b/, {on: 'context-menu'}],
|
|
52
|
+
[/\b((dropdown )?menus?)\b/, {on: 'dropdown-menu'}],
|
|
53
|
+
// A part's own header or footer ("dialog header", "card footer") is that
|
|
54
|
+
// part's, never the app's top bar or footer.
|
|
55
|
+
[
|
|
56
|
+
/(?<!\b(?:dialog|modal|card|drawer|sheet|popover|panel|section|table|menu)s? )\bfooters?\b/,
|
|
57
|
+
{on: 'layout-footer'},
|
|
58
|
+
],
|
|
59
|
+
[/\b(side ?nav|sidebar|side ?panel)\b/, {on: 'side-nav'}],
|
|
60
|
+
[
|
|
61
|
+
/\b(app (name|title)|logo|site title|product name)\b/,
|
|
62
|
+
{on: 'top-nav-heading'},
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
/(?<!\b(?:dialog|modal|card|drawer|sheet|popover|panel|section|table|menu)s? )\b(header|top ?bar|title ?bar|nav ?bar|app ?bar|masthead)\b/,
|
|
66
|
+
{on: 'app-shell-header'},
|
|
67
|
+
],
|
|
68
|
+
[/\b(page|app background|whole background|body background)\b/, {on: 'page'}],
|
|
69
|
+
[/\b(radio( buttons?)?|radios)\b/, {on: 'radio-indicator'}],
|
|
70
|
+
[/\b(primary|main) buttons?\b/, {on: 'button', when: 'variant:primary'}],
|
|
71
|
+
[/\bsecondary buttons?\b/, {on: 'button', when: 'variant:secondary'}],
|
|
72
|
+
[/\bghost buttons?\b/, {on: 'button', when: 'variant:ghost'}],
|
|
73
|
+
[
|
|
74
|
+
/\b(danger|destructive|delete) (buttons?|ones?|variant)\b/,
|
|
75
|
+
{on: 'button', when: 'variant:destructive'},
|
|
76
|
+
],
|
|
77
|
+
[/\b(panels?|windows?|boxes|tiles?|containers?)\b/, {on: 'containers'}],
|
|
78
|
+
[/\b(banners?|alerts?|notices?|announcements?)\b/, {on: 'banner'}],
|
|
79
|
+
[/\b(text ?areas?|multi-?line (inputs?|fields?))\b/, {on: 'text-area'}],
|
|
80
|
+
[
|
|
81
|
+
/\b(select (dropdowns?|menus?|box(es)?|inputs?)|selects|dropdowns?|pickers?|select(?! (the|a|an|all|any|one|which|what|it|them)\b))\b/,
|
|
82
|
+
{on: 'selector'},
|
|
83
|
+
],
|
|
84
|
+
[/\b(skeletons?( loaders?)?|loading placeholders?)\b/, {on: 'skeleton'}],
|
|
85
|
+
[
|
|
86
|
+
/\b(inputs?|text ?box(es)?|text ?fields?|form fields?|fields?)\b/,
|
|
87
|
+
{on: 'inputs'},
|
|
88
|
+
],
|
|
89
|
+
// A checkbox is the box itself; the checks group (checkbox and radio)
|
|
90
|
+
// goes by its own name.
|
|
91
|
+
[/\b(checkbox(es)?|check ?marks?)\b/, {on: 'checkbox-indicator'}],
|
|
92
|
+
// "switch off", "switch the buttons to" are the verb, not the part.
|
|
93
|
+
[
|
|
94
|
+
/\b(toggles?|switch(?:e?s)?(?! (off|on|to|the|out|it|them|over|back|from)\b))\b/,
|
|
95
|
+
{on: 'switch'},
|
|
96
|
+
],
|
|
97
|
+
[/\b((table )?cells?)\b/, {on: 'table-cell'}],
|
|
98
|
+
[/\b(table rows?|rows?|tables?)\b/, {on: 'table-row'}],
|
|
99
|
+
[/\b(badges?|chips?|tags?)\b/, {on: 'badge'}],
|
|
100
|
+
[/\bh([1-6])\b/, {on: 'heading'}],
|
|
101
|
+
[/\b(headings?|titles?)\b/, {on: 'heading'}],
|
|
102
|
+
[/\b(modals?|popups?)\b/, {on: 'dialog'}],
|
|
103
|
+
[/\bcode\b/, {on: 'code', role: 'code'}],
|
|
104
|
+
// Small, secondary and supporting text, captions and fine print: the
|
|
105
|
+
// supporting text style, not the base size.
|
|
106
|
+
[
|
|
107
|
+
/\b((?:small|secondary|supporting|helper|hint|caption|muted) (?:text|copy)|fine print|captions?)\b/,
|
|
108
|
+
{on: 'body', role: 'supporting'},
|
|
109
|
+
],
|
|
110
|
+
[/\bbody( text)?\b/, {on: 'body', role: 'body'}],
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The part or group a plain word names, as how reads it (`checkboxes` is
|
|
115
|
+
* the checks group, `panels` the containers), or null.
|
|
116
|
+
* @param {string} word
|
|
117
|
+
* @returns {string | null}
|
|
118
|
+
*/
|
|
119
|
+
export function partForWord(word) {
|
|
120
|
+
const w = String(word ?? '')
|
|
121
|
+
.trim()
|
|
122
|
+
.toLowerCase();
|
|
123
|
+
if (!w) return null;
|
|
124
|
+
for (const [re, hit] of OVERRIDES)
|
|
125
|
+
if (/** @type {RegExp} */ (re).test(w))
|
|
126
|
+
return /** @type {{on: string}} */ (hit).on;
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** @type {Map<string, string> | null} */
|
|
131
|
+
let words = null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The single words the table reads as a part or group, each with what it
|
|
135
|
+
* names (`sidebar` side-nav, `checkbox` checks, `toggle` switch): the words
|
|
136
|
+
* a part's typo is read against beside the part names. Taken from the
|
|
137
|
+
* table's own words, a plural's singular (`toggles?`) included.
|
|
138
|
+
* @returns {Map<string, string>}
|
|
139
|
+
*/
|
|
140
|
+
export function partWords() {
|
|
141
|
+
if (words) return words;
|
|
142
|
+
words = new Map();
|
|
143
|
+
for (const [re] of OVERRIDES)
|
|
144
|
+
for (const m of re.source.matchAll(/[a-z]{3,}(\?)?/g)) {
|
|
145
|
+
const w = m[0].replace(/\?$/, '');
|
|
146
|
+
for (const each of m[1] ? [w, w.slice(0, -1)] : [w]) {
|
|
147
|
+
const on = partForWord(each);
|
|
148
|
+
if (on && !words.has(each)) words.set(each, on);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return words;
|
|
152
|
+
}
|