@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
|
@@ -29,16 +29,19 @@ export function themeEditHow(subject: string, options?: import("./theme-edit.typ
|
|
|
29
29
|
* @param {import('./_settings.mjs').Ctx} ctx
|
|
30
30
|
* @param {string} target
|
|
31
31
|
* @param {string} cond
|
|
32
|
+
* @param {string[]} [settable] the states set takes on the part (the one
|
|
33
|
+
* list its refusals and how name too), when known
|
|
32
34
|
* @returns {string}
|
|
33
35
|
*/
|
|
34
|
-
export function condition(ctx: import("./_settings.mjs").Ctx, target: string, cond: string): string;
|
|
36
|
+
export function condition(ctx: import("./_settings.mjs").Ctx, target: string, cond: string, settable?: string[]): string;
|
|
35
37
|
/**
|
|
36
38
|
* Read `--at` points: "x,y;x,y", "x,y x,y", repeated, or a flat "a,b,c,d".
|
|
37
39
|
* Each number is a whole pixel; anything else is refused by name.
|
|
38
40
|
* @param {string[]} at
|
|
41
|
+
* @param {string | null} [file] the picture the points are on
|
|
39
42
|
* @returns {Array<{x: number, y: number}>}
|
|
40
43
|
*/
|
|
41
|
-
export function parsePoints(at: string[]): Array<{
|
|
44
|
+
export function parsePoints(at: string[], file?: string | null): Array<{
|
|
42
45
|
x: number;
|
|
43
46
|
y: number;
|
|
44
47
|
}>;
|
package/api/theme-edit/_how.mjs
CHANGED
|
@@ -33,15 +33,17 @@ import {
|
|
|
33
33
|
editedThemes,
|
|
34
34
|
loadTheme,
|
|
35
35
|
nearest,
|
|
36
|
+
partComponentDocs,
|
|
36
37
|
refuse,
|
|
38
|
+
themeSourceParseError,
|
|
37
39
|
themeSourceProblem,
|
|
38
40
|
} from './_settings.mjs';
|
|
39
|
-
import {ASPECTS,
|
|
41
|
+
import {ASPECTS, settableStates} from './_check.mjs';
|
|
40
42
|
import {MODAL} from './_compiler.mjs';
|
|
41
43
|
import {PALETTE_DIALS, mappingRows, paletteFiles} from './_palette.mjs';
|
|
42
44
|
import {requireProject, context} from './_context.mjs';
|
|
43
45
|
import {checked, exampleStep, howTheme, render} from './_how-commands.mjs';
|
|
44
|
-
import {draftAnswer} from './_how-question.mjs';
|
|
46
|
+
import {draftAnswer, partLexicon, valueAsked} from './_how-question.mjs';
|
|
45
47
|
import {
|
|
46
48
|
getCliInvocation,
|
|
47
49
|
quoteCommandArgument,
|
|
@@ -191,6 +193,16 @@ async function answer(subject, options, cwd) {
|
|
|
191
193
|
// "½rem": a fraction is a number before anything reads the question.
|
|
192
194
|
const t = (subject ?? '')
|
|
193
195
|
.trim()
|
|
196
|
+
// "corners:", "var(--radius-element)": a setting pasted as written is
|
|
197
|
+
// a lookup of it.
|
|
198
|
+
.replace(/^([a-z][a-z -]*):\s*$/i, '$1')
|
|
199
|
+
.replace(/^var\(\s*(--[a-z0-9-]+)\s*\)$/i, '$1')
|
|
200
|
+
// A lone "½" with no unit after it is a share of now ("card padding
|
|
201
|
+
// ½"), never 0.5px.
|
|
202
|
+
.replace(
|
|
203
|
+
/(\d*)(?:½|1\u20442)(?!\s*(?:rem|px|em|%|x\b|×|times\b))/g,
|
|
204
|
+
(_, n) => (n ? `${n}½` : ' half '),
|
|
205
|
+
)
|
|
194
206
|
.replace(/(\d*)(?:½|1\u20442)/g, (_, n) => `${n ? Number(n) + 0.5 : '0.5'}`)
|
|
195
207
|
.replace(
|
|
196
208
|
/(\d*)(?:¼|1\u20444)/g,
|
|
@@ -200,6 +212,12 @@ async function answer(subject, options, cwd) {
|
|
|
200
212
|
/(\d*)(?:¾|3\u20444)/g,
|
|
201
213
|
(_, n) => `${n ? Number(n) + 0.75 : '0.75'}`,
|
|
202
214
|
);
|
|
215
|
+
// "paddingLeft", "borderRadius": a property as JavaScript spells it is
|
|
216
|
+
// that CSS property, as set takes it.
|
|
217
|
+
if (/^[a-z]+(?:[A-Z][a-z]+)+$/.test(t)) {
|
|
218
|
+
const kebab = t.replace(/[A-Z]/g, ch => `-${ch.toLowerCase()}`);
|
|
219
|
+
if (cssProperties().has(kebab)) return answer(kebab, options, cwd);
|
|
220
|
+
}
|
|
203
221
|
// "explain spacing", "tell me about the accent": the lookup of what is
|
|
204
222
|
// named, never a change.
|
|
205
223
|
const explain =
|
|
@@ -214,14 +232,36 @@ async function answer(subject, options, cwd) {
|
|
|
214
232
|
run: [`${HOW} ${t ? JSON.stringify(t) : 'card'}`],
|
|
215
233
|
});
|
|
216
234
|
if (options.theme != null) {
|
|
217
|
-
|
|
235
|
+
try {
|
|
236
|
+
loadTheme(cwd, options.theme);
|
|
237
|
+
} catch (e) {
|
|
238
|
+
// A theme name near the one typed: the same question for it, never
|
|
239
|
+
// only `show` (the question is kept).
|
|
240
|
+
const err = /** @type {any} */ (e);
|
|
241
|
+
// (A name typed in another case or as a path too.)
|
|
242
|
+
if (err?.suggestions)
|
|
243
|
+
for (const s of err.suggestions) {
|
|
244
|
+
const near = / show ([a-z][a-z0-9-]*)$/.exec(
|
|
245
|
+
String(s.name ?? ''),
|
|
246
|
+
)?.[1];
|
|
247
|
+
if (near)
|
|
248
|
+
s.name = `${HOW} ${quoteCommandArgument(t || 'card')} --theme ${near}`;
|
|
249
|
+
}
|
|
250
|
+
throw e;
|
|
251
|
+
}
|
|
218
252
|
// A theme whose source no longer extends its settings takes no setting:
|
|
219
253
|
// an answer would suggest commands that cannot run.
|
|
220
|
-
const
|
|
254
|
+
const parseError = themeSourceParseError(cwd, options.theme);
|
|
255
|
+
const broken = parseError
|
|
256
|
+
? {
|
|
257
|
+
problem: parseError,
|
|
258
|
+
fix: `Fix themes/${options.theme}/${options.theme}.theme.ts.`,
|
|
259
|
+
}
|
|
260
|
+
: await themeSourceProblem(cwd, options.theme);
|
|
221
261
|
if (broken)
|
|
222
262
|
refuse(
|
|
223
263
|
E.ERR_THEME_INVALID,
|
|
224
|
-
`${broken}, so settings cannot take effect and no command here would change the theme.
|
|
264
|
+
`${broken.problem}, so settings cannot take effect and no command here would change the theme. ${broken.fix} Then ask again.`,
|
|
225
265
|
{run: [`${P} show ${options.theme}`]},
|
|
226
266
|
);
|
|
227
267
|
}
|
|
@@ -247,16 +287,21 @@ async function answer(subject, options, cwd) {
|
|
|
247
287
|
}
|
|
248
288
|
if (isPicture(t, cwd))
|
|
249
289
|
return {kind: 'picture', subject: t, ...pictureColors(t, cwd, at, count)};
|
|
290
|
+
// What runs instead: the same subject without the picture option (a
|
|
291
|
+
// real command), never a made-up file name.
|
|
292
|
+
const without = t ? `${HOW} ${quoteCommandArgument(t)}` : `${HOW} --help`;
|
|
250
293
|
if (at.length)
|
|
251
294
|
refuse(
|
|
252
295
|
E.ERR_INVALID_ARGUMENT,
|
|
253
|
-
|
|
254
|
-
{run: [
|
|
296
|
+
`--at reads the color at points of a PNG picture; name your picture first (${HOW} <your .png file> --at x,y).`,
|
|
297
|
+
{run: [without]},
|
|
255
298
|
);
|
|
256
299
|
if (count != null)
|
|
257
|
-
refuse(
|
|
258
|
-
|
|
259
|
-
|
|
300
|
+
refuse(
|
|
301
|
+
E.ERR_INVALID_ARGUMENT,
|
|
302
|
+
`A count applies only to a picture (${HOW} <your .png file> 5).`,
|
|
303
|
+
{run: [without]},
|
|
304
|
+
);
|
|
260
305
|
if (!t) {
|
|
261
306
|
refuse(
|
|
262
307
|
E.ERR_MISSING_ARGUMENT,
|
|
@@ -430,9 +475,31 @@ async function answer(subject, options, cwd) {
|
|
|
430
475
|
// "What does --color-accent do", "what's the variable for card padding":
|
|
431
476
|
// "--focus-outline-width: 3px": a token typed with a value is set exactly,
|
|
432
477
|
// or refused with the nearest names; never another token.
|
|
478
|
+
// "cards: --color-border red", "--color-border red on inputs": the token
|
|
479
|
+
// on that part.
|
|
480
|
+
const scopeLead = /^\s*([a-z][a-z -]*?)\s*:\s*(?=--)/i.exec(t)?.[1];
|
|
481
|
+
const scopeTail =
|
|
482
|
+
/\s+(?:on|for)\s+(?:the |my |all )?([a-z][a-z -]*?)\s*$/i.exec(t)?.[1];
|
|
483
|
+
const scopeWord = scopeLead ?? scopeTail;
|
|
484
|
+
const scopeOn = scopeWord
|
|
485
|
+
? (() => {
|
|
486
|
+
const w = ` ${scopeWord.trim().toLowerCase()} `;
|
|
487
|
+
return (
|
|
488
|
+
partLexicon(ctx).parts.find(([re]) => re.test(w))?.[1].on ?? null
|
|
489
|
+
);
|
|
490
|
+
})()
|
|
491
|
+
: null;
|
|
433
492
|
const typedToken =
|
|
434
493
|
/^\s*(--[a-z][a-z0-9-]*)\s*(?::|\s+to\s+|\s+)\s*([^;]+?)\s*;?\s*(?:\bin (light|dark) mode\b.*)?$/i.exec(
|
|
435
|
-
t
|
|
494
|
+
t
|
|
495
|
+
.replace(/^\s*(?:change|set|make|token)\s+/i, ' ')
|
|
496
|
+
.replace(/^\s*[a-z][a-z -]*?\s*:\s*(?=--)/i, ' ')
|
|
497
|
+
.replace(
|
|
498
|
+
scopeOn && scopeTail
|
|
499
|
+
? /\s+(?:on|for)\s+(?:the |my |all )?[a-z][a-z -]*?\s*$/i
|
|
500
|
+
: /$^/,
|
|
501
|
+
'',
|
|
502
|
+
),
|
|
436
503
|
);
|
|
437
504
|
if (
|
|
438
505
|
typedToken &&
|
|
@@ -471,6 +538,7 @@ async function answer(subject, options, cwd) {
|
|
|
471
538
|
verb: 'set',
|
|
472
539
|
thing: token,
|
|
473
540
|
value,
|
|
541
|
+
...(scopeOn ? {on: scopeOn} : {}),
|
|
474
542
|
...(mode && env.data.mode === 'both' ? {mode} : {}),
|
|
475
543
|
},
|
|
476
544
|
],
|
|
@@ -510,8 +578,10 @@ async function answer(subject, options, cwd) {
|
|
|
510
578
|
results: tool,
|
|
511
579
|
...unknown,
|
|
512
580
|
};
|
|
513
|
-
// a question about what something is gets the lookup, not a change
|
|
581
|
+
// a question about what something is gets the lookup, not a change; a
|
|
582
|
+
// question about a part's value now gets the value (draftAnswer).
|
|
514
583
|
if (
|
|
584
|
+
!valueAsked(t) &&
|
|
515
585
|
(/^\s*(what|which|where)\b.*\b(variables?|tokens?|do|does|means?|controls?|for)\b|^\s*what('s| is) the (css )?(variable|token|property)/i.test(
|
|
516
586
|
t,
|
|
517
587
|
) ||
|
|
@@ -578,10 +648,13 @@ async function answer(subject, options, cwd) {
|
|
|
578
648
|
...unknown,
|
|
579
649
|
...(empty
|
|
580
650
|
? {
|
|
581
|
-
hint:
|
|
582
|
-
|
|
583
|
-
|
|
651
|
+
hint: `${
|
|
652
|
+
results.length
|
|
653
|
+
? `No command does all of "${t}" on ${env.slug}; the lines above say why.`
|
|
654
|
+
: `No match for "${t}". Name the part (header, nav links, card, button, banner, input...) and what to change (text color, background, gradient, corners, border, shadow, spacing, bold), in English.`
|
|
655
|
+
} See ${HOW} --help for the asks it understands.`,
|
|
584
656
|
run: [
|
|
657
|
+
`${HOW} --help`,
|
|
585
658
|
`${HOW} --list parts`,
|
|
586
659
|
`${HOW} "rounder buttons"`,
|
|
587
660
|
`${HOW} colors`,
|
|
@@ -591,6 +664,69 @@ async function answer(subject, options, cwd) {
|
|
|
591
664
|
};
|
|
592
665
|
}
|
|
593
666
|
|
|
667
|
+
/**
|
|
668
|
+
* The commands a refusal names to run instead that answer the draft: the
|
|
669
|
+
* same thing set, accepted by set's check, and (for a draft that carries
|
|
670
|
+
* what its clause asks) measured to do it.
|
|
671
|
+
* @param {import('./_how-commands.mjs').HowTheme} env
|
|
672
|
+
* @param {import('./_how-question.mjs').Draft} d
|
|
673
|
+
* @param {Array<{command: string, why: string, run?: string[]}>} refused
|
|
674
|
+
* @returns {string[]}
|
|
675
|
+
*/
|
|
676
|
+
function insteadOf(env, d, refused) {
|
|
677
|
+
// (The same thing on the same part: another part is another ask.)
|
|
678
|
+
const things = new Set(
|
|
679
|
+
d.options.flat().map(st => `${st.thing}|${st.on ?? ''}`),
|
|
680
|
+
);
|
|
681
|
+
/** @type {string[]} */
|
|
682
|
+
const out = [];
|
|
683
|
+
for (const line of refused.flatMap(r => r.run ?? [])) {
|
|
684
|
+
const words = [
|
|
685
|
+
...line
|
|
686
|
+
.replace(/^.*? editor /, '')
|
|
687
|
+
.matchAll(/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"|(\S+)/g),
|
|
688
|
+
].map(m => m[1] ?? m[2] ?? m[3]);
|
|
689
|
+
const st = exampleStep(
|
|
690
|
+
words.map(w => (/\s/.test(w) ? `"${w}"` : w)).join(' '),
|
|
691
|
+
);
|
|
692
|
+
if (
|
|
693
|
+
!st ||
|
|
694
|
+
!things.has(`${st.thing}|${st.on ?? ''}`) ||
|
|
695
|
+
/[<>]/.test(String(st.value ?? ''))
|
|
696
|
+
)
|
|
697
|
+
continue;
|
|
698
|
+
if (!env.check([st]).ok) continue;
|
|
699
|
+
// Held to what the draft asks, else to the way its own dial step went
|
|
700
|
+
// ("more"): never offered unmeasured.
|
|
701
|
+
const way = d.options
|
|
702
|
+
.flat()
|
|
703
|
+
.map(x => x.value)
|
|
704
|
+
.find(v => v === 'more' || v === 'less');
|
|
705
|
+
const intent =
|
|
706
|
+
d.intent ??
|
|
707
|
+
(way
|
|
708
|
+
? /** @type {import('./_how-commands.mjs').MeasureIntent} */ ({
|
|
709
|
+
families: [],
|
|
710
|
+
typed: [],
|
|
711
|
+
opacityDir: null,
|
|
712
|
+
dir: way,
|
|
713
|
+
zero: false,
|
|
714
|
+
lighter: null,
|
|
715
|
+
subjects: [],
|
|
716
|
+
keep: [],
|
|
717
|
+
mode: null,
|
|
718
|
+
})
|
|
719
|
+
: null);
|
|
720
|
+
if (!intent || typeof env.measure !== 'function') continue;
|
|
721
|
+
// A dial word the other way round from the one asked never answers it.
|
|
722
|
+
if (way && (st.value === 'more' || st.value === 'less') && st.value !== way)
|
|
723
|
+
continue;
|
|
724
|
+
if (env.measure([st], intent)) continue;
|
|
725
|
+
out.push(render(st, env.slug));
|
|
726
|
+
}
|
|
727
|
+
return out;
|
|
728
|
+
}
|
|
729
|
+
|
|
594
730
|
/**
|
|
595
731
|
* Check each draft's commands and keep what passes; a draft whose commands
|
|
596
732
|
* are all refused says why, and points to the lookup that helps.
|
|
@@ -598,15 +734,89 @@ async function answer(subject, options, cwd) {
|
|
|
598
734
|
* @param {import('./_how-question.mjs').Draft[]} drafts
|
|
599
735
|
*/
|
|
600
736
|
function finish(env, drafts) {
|
|
601
|
-
/** @type {Array<{text: string, commands: string[], sequence?: boolean, refused?: Array<{command: string, why: string}>}>} */
|
|
737
|
+
/** @type {Array<{text: string, commands: string[], sequence?: boolean, refused?: Array<{command: string, why: string, run?: string[]}>}>} */
|
|
602
738
|
const out = [];
|
|
739
|
+
// The measured check runs first on the drafts that carry what their
|
|
740
|
+
// clause asks; a draft that joins them ("all of it, in order") then keeps
|
|
741
|
+
// only the steps some kept option still has, so it never brings back a
|
|
742
|
+
// step the check left out.
|
|
743
|
+
const key = (/** @type {import('./_how-commands.mjs').Step} */ st) =>
|
|
744
|
+
JSON.stringify([
|
|
745
|
+
st.verb,
|
|
746
|
+
st.thing,
|
|
747
|
+
st.value,
|
|
748
|
+
st.on,
|
|
749
|
+
st.when,
|
|
750
|
+
st.state,
|
|
751
|
+
st.mode,
|
|
752
|
+
]);
|
|
753
|
+
/** @type {Set<string>} */
|
|
754
|
+
const dropped = new Set();
|
|
755
|
+
/** @type {Set<string>} */
|
|
756
|
+
const kept = new Set();
|
|
757
|
+
/** @type {Map<object, string[]>} */
|
|
758
|
+
const unmetOf = new Map();
|
|
759
|
+
if (typeof env.measure === 'function')
|
|
760
|
+
for (const d of drafts) {
|
|
761
|
+
if (!d.intent) continue;
|
|
762
|
+
const intent = d.intent;
|
|
763
|
+
/** @type {string[]} */
|
|
764
|
+
const unmet = [];
|
|
765
|
+
d.options = d.options.filter(o => {
|
|
766
|
+
const why = env.measure(o, intent);
|
|
767
|
+
for (const st of o) (why ? dropped : kept).add(key(st));
|
|
768
|
+
if (why) unmet.push(why);
|
|
769
|
+
return !why;
|
|
770
|
+
});
|
|
771
|
+
// One change in growing amounts: the first kept is the answer, and
|
|
772
|
+
// the smaller amounts that fell short are no reason to tell.
|
|
773
|
+
if (d.smallest && d.options.length) {
|
|
774
|
+
d.options = d.options.slice(0, 1);
|
|
775
|
+
unmet.length = 0;
|
|
776
|
+
}
|
|
777
|
+
unmetOf.set(d, unmet);
|
|
778
|
+
}
|
|
603
779
|
for (const d of drafts) {
|
|
780
|
+
if (!d.intent && dropped.size) {
|
|
781
|
+
d.options = d.options
|
|
782
|
+
.map(o => o.filter(st => !dropped.has(key(st)) || kept.has(key(st))))
|
|
783
|
+
.filter(o => o.length);
|
|
784
|
+
// A joined answer left holding what another answer already says is
|
|
785
|
+
// that answer: it is not given twice (and never as "all of it").
|
|
786
|
+
const same = (/** @type {import('./_how-commands.mjs').Step[]} */ o) =>
|
|
787
|
+
drafts.some(
|
|
788
|
+
x =>
|
|
789
|
+
x !== d &&
|
|
790
|
+
x.options.some(
|
|
791
|
+
y =>
|
|
792
|
+
y.length === o.length &&
|
|
793
|
+
y.every((st, i) => key(st) === key(o[i])),
|
|
794
|
+
),
|
|
795
|
+
);
|
|
796
|
+
if (d.options.length && d.options.every(same)) continue;
|
|
797
|
+
}
|
|
798
|
+
// The measured check: an option whose built result does not do what
|
|
799
|
+
// the question asks is left out, with a plain line saying why.
|
|
800
|
+
const unmet = unmetOf.get(d) ?? [];
|
|
801
|
+
if (unmet.length) {
|
|
802
|
+
if (unmet.length && !d.options.length)
|
|
803
|
+
d.text = `couldn't work out a command that does "${d.text}" as asked: ${[...new Set(unmet)].join('; ')}`;
|
|
804
|
+
else if (unmet.length)
|
|
805
|
+
d.text = `${d.text} (left out: ${[...new Set(unmet)].join('; ')})`;
|
|
806
|
+
}
|
|
604
807
|
const {commands, refused} = checked(env, d.options);
|
|
605
808
|
const lookups = d.lookup ? [d.lookup] : [];
|
|
809
|
+
if (!commands.length && !d.options.length && unmet.length) {
|
|
810
|
+
out.push({text: d.text, commands: lookups});
|
|
811
|
+
continue;
|
|
812
|
+
}
|
|
606
813
|
if (!commands.length && d.options.length && !lookups.length) {
|
|
607
814
|
out.push({
|
|
608
815
|
text: `${d.text}: no command does it on ${env.slug}${refused[0] ? `: ${refused[0].why}` : ''}`,
|
|
609
|
-
|
|
816
|
+
// The command the refusal itself names to run instead, when it
|
|
817
|
+
// sets the same thing, passes set's check and does what the
|
|
818
|
+
// question asks.
|
|
819
|
+
commands: insteadOf(env, d, refused),
|
|
610
820
|
refused,
|
|
611
821
|
});
|
|
612
822
|
continue;
|
|
@@ -682,32 +892,14 @@ function partAnswer(ctx, env, subject, key, unknown, themeFields) {
|
|
|
682
892
|
ctx.project.target.get(key)
|
|
683
893
|
);
|
|
684
894
|
const group = familyOf(key);
|
|
685
|
-
|
|
686
|
-
// applies there).
|
|
687
|
-
// Only the states set takes on this part: a state is dropped when the
|
|
688
|
-
// same change without it passes and with it is refused.
|
|
689
|
-
const takes = (/** @type {string | undefined} */ st) => {
|
|
690
|
-
try {
|
|
691
|
-
checkSetting(ctx, env.slug, env.data, 'opacity', '1', {
|
|
692
|
-
on: key,
|
|
693
|
-
...(st ? {state: st} : {}),
|
|
694
|
-
});
|
|
695
|
-
return true;
|
|
696
|
-
} catch {
|
|
697
|
-
return false;
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
const plainOk = takes(undefined);
|
|
701
|
-
const states = [...new Set([...target.states, ...COMMON_STATES])].filter(
|
|
702
|
-
st => !plainOk || takes(st),
|
|
703
|
-
);
|
|
895
|
+
const states = settableStates(ctx, env.slug, env.data, key);
|
|
704
896
|
const reads = Object.fromEntries(
|
|
705
897
|
Object.keys(GROUPS).map(g => [
|
|
706
898
|
g,
|
|
707
899
|
C.partReads(key, g).map(r => ({
|
|
708
900
|
token: r.token,
|
|
709
901
|
props: r.props,
|
|
710
|
-
when: [...new Set(r.when.map(w => condition(ctx, key, w)))],
|
|
902
|
+
when: [...new Set(r.when.map(w => condition(ctx, key, w, states)))],
|
|
711
903
|
})),
|
|
712
904
|
]),
|
|
713
905
|
);
|
|
@@ -721,7 +913,9 @@ function partAnswer(ctx, env, subject, key, unknown, themeFields) {
|
|
|
721
913
|
const extra = {};
|
|
722
914
|
if (!recorded && !ctx.unchecked) {
|
|
723
915
|
const {commands} = checked(env, [
|
|
724
|
-
|
|
916
|
+
// (A fill of one color is the background color: the shorthand would
|
|
917
|
+
// clear the image Core draws its hover tint with.)
|
|
918
|
+
[{verb: 'set', thing: 'background-color', value: '#f3f4f6', on: key}],
|
|
725
919
|
[{verb: 'set', thing: 'color', value: '#111827', on: key}],
|
|
726
920
|
[{verb: 'set', thing: 'border-radius', value: '8px', on: key}],
|
|
727
921
|
]);
|
|
@@ -734,6 +928,9 @@ function partAnswer(ctx, env, subject, key, unknown, themeFields) {
|
|
|
734
928
|
kind: 'part',
|
|
735
929
|
subject,
|
|
736
930
|
component: target.component ?? null,
|
|
931
|
+
// What the part is, from its component's doc (a side nav heading is the
|
|
932
|
+
// product or account heading at the top, not a section title).
|
|
933
|
+
is: partComponentDocs(ctx, key).at(-1)?.doc.description || null,
|
|
737
934
|
components,
|
|
738
935
|
recorded,
|
|
739
936
|
group,
|
|
@@ -755,13 +952,15 @@ function partAnswer(ctx, env, subject, key, unknown, themeFields) {
|
|
|
755
952
|
* @param {import('./_settings.mjs').Ctx} ctx
|
|
756
953
|
* @param {string} target
|
|
757
954
|
* @param {string} cond
|
|
955
|
+
* @param {string[]} [settable] the states set takes on the part (the one
|
|
956
|
+
* list its refusals and how name too), when known
|
|
758
957
|
* @returns {string}
|
|
759
958
|
*/
|
|
760
|
-
export function condition(ctx, target, cond) {
|
|
959
|
+
export function condition(ctx, target, cond, settable) {
|
|
761
960
|
if (!cond.trim()) return 'always';
|
|
762
961
|
const t = ctx.project.target.get(target);
|
|
763
962
|
const props = t?.props ?? [];
|
|
764
|
-
const states = [...(t?.states ?? []), ...COMMON_STATES];
|
|
963
|
+
const states = settable ?? [...(t?.states ?? []), ...COMMON_STATES];
|
|
765
964
|
const values = ctx.C.variantValues(target);
|
|
766
965
|
const words = cond.trim().split(/\s+/);
|
|
767
966
|
const isAttr = (/** @type {string} */ w) => /^[a-z][\w-]*=[^\s]*$/i.test(w);
|
|
@@ -773,10 +972,15 @@ export function condition(ctx, target, cond) {
|
|
|
773
972
|
let why = null;
|
|
774
973
|
for (const kv of attrs) {
|
|
775
974
|
const [k, v] = kv.split('=');
|
|
776
|
-
|
|
777
|
-
|
|
975
|
+
// A state written as its own name (`checked=checked`) set takes as
|
|
976
|
+
// --state.
|
|
977
|
+
if ((v === k || v === 'true') && states.includes(k))
|
|
978
|
+
flags.push(`--state ${k}`);
|
|
778
979
|
else if (props.includes(k) && (!values[k]?.length || values[k].includes(v)))
|
|
779
980
|
flags.push(`--when ${k}:${v}`);
|
|
981
|
+
// Another value of a state (a checkbox's `checked="indeterminate"`):
|
|
982
|
+
// set names it with --when.
|
|
983
|
+
else if (states.includes(k)) flags.push(`--when ${k}:${v}`);
|
|
780
984
|
else why ??= `${target} has no ${k} prop or state that set can name`;
|
|
781
985
|
}
|
|
782
986
|
if (css) {
|
|
@@ -1094,7 +1298,8 @@ function toolAnswer(t, env, targets) {
|
|
|
1094
1298
|
},
|
|
1095
1299
|
];
|
|
1096
1300
|
if (
|
|
1097
|
-
|
|
1301
|
+
// A question about a part's value now is answered with that value.
|
|
1302
|
+
(asks && !valueAsked(q)) ||
|
|
1098
1303
|
/^which parts (are|does|do)\b/.test(q) ||
|
|
1099
1304
|
(/^why (is|are|does|do)\b/.test(q) && !/\bnot\b|n'?t\b/.test(q))
|
|
1100
1305
|
) {
|
|
@@ -1342,14 +1547,18 @@ async function listItems(kind, filter, cwd) {
|
|
|
1342
1547
|
* Read `--at` points: "x,y;x,y", "x,y x,y", repeated, or a flat "a,b,c,d".
|
|
1343
1548
|
* Each number is a whole pixel; anything else is refused by name.
|
|
1344
1549
|
* @param {string[]} at
|
|
1550
|
+
* @param {string | null} [file] the picture the points are on
|
|
1345
1551
|
* @returns {Array<{x: number, y: number}>}
|
|
1346
1552
|
*/
|
|
1347
|
-
export function parsePoints(at) {
|
|
1553
|
+
export function parsePoints(at, file = null) {
|
|
1348
1554
|
const words = at
|
|
1349
1555
|
.join(' ')
|
|
1350
1556
|
.split(/[;\s]+/)
|
|
1351
1557
|
.filter(Boolean);
|
|
1352
|
-
|
|
1558
|
+
// The picture named, never a made-up file.
|
|
1559
|
+
const example = file
|
|
1560
|
+
? `${HOW} ${quoteCommandArgument(file)} --at "40,20;300,180"`
|
|
1561
|
+
: `${HOW} --help`;
|
|
1353
1562
|
if (!words.length)
|
|
1354
1563
|
refuse(E.ERR_INVALID_ARGUMENT, '--at names no point; give x,y pairs.', {
|
|
1355
1564
|
run: [example],
|
|
@@ -1409,7 +1618,7 @@ function pictureColors(file, cwd, at, count) {
|
|
|
1409
1618
|
`The count must be a positive whole number, not "${count}".`,
|
|
1410
1619
|
{run: [`${HOW} ${file} 5`]},
|
|
1411
1620
|
);
|
|
1412
|
-
const points = at.length ? parsePoints(at) : null;
|
|
1621
|
+
const points = at.length ? parsePoints(at, file) : null;
|
|
1413
1622
|
// The header holds the size, so a huge picture is refused unread.
|
|
1414
1623
|
const fd = fs.openSync(abs, 'r');
|
|
1415
1624
|
const head = Buffer.alloc(8);
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
* Files of the project's own that import any of `targets` (preview files
|
|
6
|
+
* about to be deleted), so deleting them would break the app's build. The
|
|
7
|
+
* whole project root is read: every .ts/.tsx/.js/.jsx/.mjs/.cjs/.mdx file
|
|
8
|
+
* outside node_modules, build output and dot folders, the preview's own
|
|
9
|
+
* files left out. Each file's import and export-from declarations,
|
|
10
|
+
* import() and require() calls (a string or a template with no
|
|
11
|
+
* substitution) are read from its syntax tree and resolved: relative,
|
|
12
|
+
* `@/`, or a tsconfig `paths` alias. `tooBig` when the project holds more
|
|
13
|
+
* than `limit` source files, so the caller refuses instead of guessing.
|
|
14
|
+
* @param {string} cwd
|
|
15
|
+
* @param {{files: string[]}} data the preview's record (its own files are
|
|
16
|
+
* left out)
|
|
17
|
+
* @param {string} dir the preview folder
|
|
18
|
+
* @param {string[]} targets absolute paths, without extension
|
|
19
|
+
* @param {{aliases: Array<{prefix: string, to: string[]}>, limit: number}} opts
|
|
20
|
+
* the app's tsconfig `paths` aliases, and how many source files to read
|
|
21
|
+
* at most
|
|
22
|
+
* @returns {{importers: string[], tooBig: boolean, limit: number}}
|
|
23
|
+
*/
|
|
24
|
+
export function pageImporters(cwd: string, data: {
|
|
25
|
+
files: string[];
|
|
26
|
+
}, dir: string, targets: string[], { aliases, limit }: {
|
|
27
|
+
aliases: Array<{
|
|
28
|
+
prefix: string;
|
|
29
|
+
to: string[];
|
|
30
|
+
}>;
|
|
31
|
+
limit: number;
|
|
32
|
+
}): {
|
|
33
|
+
importers: string[];
|
|
34
|
+
tooBig: boolean;
|
|
35
|
+
limit: number;
|
|
36
|
+
};
|
|
37
|
+
/** At most this many source files the preview's commands read. */
|
|
38
|
+
export const IMPORTER_SCAN_MAX: 50000;
|