@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -63
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +122 -6
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.mjs +23 -14
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +3 -3
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +62 -3
- package/api/build/kit/answer.mjs +2 -3
- package/api/build/kit/signals.d.mts +10 -0
- package/api/build/kit/signals.mjs +15 -2
- package/api/component/detail/blocks/blocks.mjs +2 -1
- package/api/discover/_adapter.d.mts +57 -6
- package/api/discover/_adapter.mjs +278 -49
- package/api/discover/_catalog-view.d.mts +7 -0
- package/api/discover/_catalog-view.mjs +10 -1
- package/api/discover/detail/detail.d.mts +3 -2
- package/api/discover/detail/detail.mjs +3 -2
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/discover.d.mts +24 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +146 -25
- package/api/discover/discover.type.d.mts +6 -4
- package/api/discover/discover.type.mjs +6 -4
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +290 -70
- package/api/docs/_entry-names.mjs +4 -3
- package/api/doctor/_adapter.d.mts +43 -3
- package/api/doctor/_adapter.mjs +142 -18
- package/api/doctor/built-checks.d.mts +30 -3
- package/api/doctor/built-checks.mjs +132 -5
- package/api/doctor/doctor.d.mts +93 -6
- package/api/doctor/doctor.doc.mjs +2 -2
- package/api/doctor/doctor.mjs +524 -33
- package/api/doctor/doctor.type.d.mts +2 -1
- package/api/doctor/doctor.type.mjs +2 -1
- package/api/doctor/theme-checks.d.mts +19 -0
- package/api/doctor/theme-checks.mjs +74 -6
- package/api/hook/hook.type.d.mts +1 -1
- package/api/hook/hook.type.mjs +1 -1
- package/api/hook/list/list.mjs +11 -7
- package/api/icon/_adapter.d.mts +2 -1
- package/api/icon/_adapter.mjs +10 -15
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +32 -1
- package/api/icon/icon.type.mjs +19 -3
- package/api/icon/list/list.mjs +4 -1
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +18 -8
- package/api/icon/search/search.d.mts +26 -3
- package/api/icon/search/search.mjs +155 -9
- package/api/init/_adapter.d.mts +14 -0
- package/api/init/_adapter.mjs +26 -4
- package/api/init/init.d.mts +1 -1
- package/api/init/init.doc.mjs +2 -2
- package/api/init/init.mjs +1 -1
- package/api/init/init.type.d.mts +29 -1
- package/api/init/init.type.mjs +14 -1
- package/api/init/run/run.d.mts +11 -1
- package/api/init/run/run.mjs +84 -5
- package/api/integration/_adapter.d.mts +5 -4
- package/api/integration/_adapter.mjs +7 -5
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +8 -9
- package/api/integration/validate-integration.d.mts +1 -1
- package/api/integration/validate-integration.mjs +26 -24
- package/api/integration/validate-integration.type.d.mts +5 -2
- package/api/integration/validate-integration.type.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.d.mts +4 -2
- package/api/render/_adapter.mjs +62 -21
- package/api/render/render.doc.mjs +8 -5
- package/api/render/render.mjs +1 -1
- package/api/render/render.type.d.mts +2 -0
- package/api/render/render.type.mjs +2 -0
- package/api/search/ORDERING.md +2 -2
- package/api/search/_candidate-score.d.mts +3 -0
- package/api/search/_candidate-score.mjs +36 -3
- package/api/search/_gather-docs.mjs +29 -2
- package/api/search/_gather-templates.mjs +2 -1
- package/api/search/_main-searcher.mjs +13 -0
- package/api/search/_named-keywords.d.mts +2 -1
- package/api/search/_named-keywords.mjs +48 -6
- package/api/search/_order.d.mts +36 -1
- package/api/search/_order.mjs +141 -3
- package/api/swizzle/list/list.mjs +8 -1
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/template/copy/copy.mjs +3 -4
- package/api/template/list/list.mjs +2 -1
- package/api/template/show/show.mjs +2 -1
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +19 -1
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +1 -0
- package/api/theme/_adapter.mjs +3 -5
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/build/build.d.mts +4 -10
- package/api/theme/build/build.mjs +165 -116
- package/api/theme/build/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- package/api/theme/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/generator.mjs +24 -0
- package/api/theme/theme.type.d.mts +4 -2
- package/api/theme/theme.type.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +2 -2
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +100 -22
- package/api/theme-edit/_check.mjs +213 -43
- package/api/theme-edit/_color.d.mts +14 -0
- package/api/theme-edit/_color.mjs +22 -0
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +20 -2
- package/api/theme-edit/_context.mjs +157 -29
- package/api/theme-edit/_edit.mjs +426 -58
- package/api/theme-edit/_how-question.d.mts +14 -0
- package/api/theme-edit/_how-question.mjs +1541 -127
- package/api/theme-edit/_how.mjs +43 -0
- package/api/theme-edit/_missed.mjs +107 -27
- package/api/theme-edit/_normal.d.mts +18 -4
- package/api/theme-edit/_normal.mjs +84 -3
- package/api/theme-edit/_palette.d.mts +9 -0
- package/api/theme-edit/_palette.mjs +158 -33
- package/api/theme-edit/_part-words.mjs +16 -3
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +120 -36
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +255 -67
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +16 -1
- package/api/theme-edit/_settings.d.mts +116 -0
- package/api/theme-edit/_settings.mjs +1197 -58
- package/api/theme-edit/_tables.d.mts +16 -0
- package/api/theme-edit/_tables.mjs +34 -4
- package/api/theme-edit/theme-edit.type.d.mts +15 -2
- package/api/theme-edit/theme-edit.type.mjs +8 -6
- package/api/upgrade/_adapter.d.mts +46 -7
- package/api/upgrade/_adapter.mjs +110 -15
- package/api/upgrade/registry/registry.d.mts +6 -3
- package/api/upgrade/registry/registry.mjs +21 -6
- package/api/upgrade/run/run.mjs +23 -11
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +6 -6
- package/assets/docs/tree/problems.doc.mjs +3 -3
- package/assets/docs/tree/render-pages.doc.mjs +17 -3
- package/assets/docs/tree/share-a-page.doc.mjs +5 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +40 -5
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/installed-icon-set.doc.mjs +30 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +6 -2
- package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +3 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +2 -2
- package/assets/templates/pages/course-detail/page.tsx +1 -1
- package/assets/templates/pages/dashboard/page.tsx +24 -8
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
- package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
- package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
- package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
- package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
- package/assets/templates/pages/detail-page/page.tsx +22 -5
- package/assets/templates/pages/documentation/page.tsx +4 -2
- package/assets/templates/pages/documentation-design/page.tsx +5 -2
- package/assets/templates/pages/documentation-technical/page.tsx +4 -2
- package/assets/templates/pages/editor/page.tsx +28 -9
- package/assets/templates/pages/file-explorer/page.tsx +3 -1
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
- package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +1 -1
- package/assets/templates/pages/ide/page.tsx +7 -2
- package/assets/templates/pages/kanban-board/page.tsx +10 -4
- package/assets/templates/pages/library/page.tsx +31 -61
- package/assets/templates/pages/login/page.tsx +4 -2
- package/assets/templates/pages/login-card/page.tsx +4 -2
- package/assets/templates/pages/login-split/page.tsx +3 -2
- package/assets/templates/pages/login-sso/page.tsx +4 -4
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/product-detail/page.tsx +16 -4
- package/assets/templates/pages/product-gallery/page.tsx +1 -1
- package/assets/templates/pages/settings/page.tsx +10 -4
- package/assets/templates/pages/settings-dialog/page.tsx +5 -6
- package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -2
- package/assets/templates/pages/table-filter/page.tsx +21 -6
- package/assets/templates/pages/table-grouped/page.tsx +23 -2
- package/assets/templates/pages/table-inbox/page.tsx +82 -32
- package/assets/templates/pages/theme-showcase/page.tsx +3 -2
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +197 -4
- package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
- package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +69 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
- package/authoring/codemod/parse.d.mts +0 -36
- package/authoring/codemod/parse.mjs +62 -41
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/parse.d.mts +0 -47
- package/authoring/config/parse.mjs +128 -103
- package/authoring/config/type.ts +4 -3
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/discover/parse.d.mts +2 -2
- package/authoring/discover/parse.mjs +52 -38
- package/authoring/discover/type.ts +2 -1
- package/authoring/doctypes/_schema.d.mts +834 -950
- package/authoring/doctypes/_schema.mjs +863 -825
- package/authoring/doctypes/command/parse.mjs +2 -2
- package/authoring/doctypes/component/parse.mjs +2 -2
- package/authoring/doctypes/enum/parse.mjs +2 -2
- package/authoring/doctypes/hook/parse.mjs +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
- package/authoring/doctypes/icon-definition/parse.mjs +59 -43
- package/authoring/doctypes/icon-set/parse.d.mts +0 -75
- package/authoring/doctypes/icon-set/parse.mjs +239 -210
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/namespace/parse.mjs +2 -2
- package/authoring/doctypes/reference/parse.mjs +2 -2
- package/authoring/doctypes/schema/parse.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +0 -101
- package/authoring/doctypes/template/parse.mjs +131 -106
- package/authoring/doctypes/theme/parse.d.mts +0 -23
- package/authoring/doctypes/theme/parse.mjs +52 -36
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +20 -2
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.mjs +27 -13
- package/clients/cli/commands/component.mjs +14 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +20 -3
- package/clients/cli/commands/docs.doc.mjs +11 -9
- package/clients/cli/commands/docs.mjs +50 -21
- package/clients/cli/commands/experimental/icon.mjs +330 -227
- package/clients/cli/commands/experimental/render.mjs +16 -1
- package/clients/cli/commands/experimental/theme.mjs +42 -17
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-render.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +36 -24
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +53 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +46 -9
- package/clients/cli/commands/template.mjs +3 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +12 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +23 -17
- package/clients/cli/lib/base-gate.mjs +37 -5
- package/clients/cli/lib/define-command.mjs +82 -4
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/stray-option.mjs +27 -1
- package/clients/cli/lib/unknown-command.mjs +326 -11
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +49 -1
- package/foundation/agent-docs/agent-docs.mjs +108 -7
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core.d.mts +1 -1
- package/foundation/bases/core.mjs +3 -3
- package/foundation/bases/resolve.d.mts +4 -8
- package/foundation/bases/resolve.mjs +15 -21
- package/foundation/bases/state.d.mts +15 -9
- package/foundation/bases/state.mjs +33 -6
- package/foundation/config/project.d.mts +5 -4
- package/foundation/config/project.mjs +33 -17
- package/foundation/discovery/component-discovery.mjs +15 -28
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +12 -2
- package/foundation/discovery/icon-ranking.mjs +197 -10
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.d.mts +28 -0
- package/foundation/discovery/icon-set-discovery.mjs +42 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -11
- package/foundation/discovery/icon-set-writer.mjs +3 -29
- package/foundation/discovery/module-exports.d.mts +1 -1
- package/foundation/discovery/module-exports.mjs +136 -33
- package/foundation/discovery/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/template-adapter.d.mts +1 -1
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icons.d.mts +45 -2
- package/foundation/discovery/template-icons.mjs +26 -54
- package/foundation/discovery/template-needs.d.mts +28 -2
- package/foundation/discovery/template-needs.mjs +92 -11
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.mjs +2 -4
- package/foundation/doc-compiler/parse-readable.mjs +4 -3
- package/foundation/doc-compiler/stored-docs.d.mts +13 -0
- package/foundation/doc-compiler/stored-docs.mjs +74 -3
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- package/foundation/fs/gather-cache.d.mts +23 -0
- package/foundation/fs/gather-cache.mjs +94 -2
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/read-record.mjs +9 -5
- package/foundation/identity/package-names.d.mts +18 -0
- package/foundation/identity/package-names.mjs +19 -0
- package/foundation/identity/providers.mjs +3 -2
- package/foundation/integrations/icon-features.d.mts +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- package/foundation/integrations/integrations.d.mts +13 -1
- package/foundation/integrations/integrations.mjs +47 -6
- package/foundation/integrations/pack-state.d.mts +21 -0
- package/foundation/integrations/pack-state.mjs +42 -19
- package/foundation/integrations/validate-contributions.d.mts +11 -3
- package/foundation/integrations/validate-contributions.mjs +51 -13
- package/foundation/release/cache.d.mts +13 -1
- package/foundation/release/cache.mjs +94 -14
- package/foundation/release/notices.d.mts +15 -0
- package/foundation/release/notices.mjs +111 -7
- package/foundation/release/project.d.mts +3 -4
- package/foundation/release/project.mjs +5 -6
- package/foundation/render/client-bundle.d.mts +126 -0
- package/foundation/render/client-bundle.mjs +565 -0
- package/foundation/render/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- package/foundation/render/embedded-imports.d.mts +4 -3
- package/foundation/render/embedded-imports.mjs +13 -8
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.mjs +5 -4
- package/foundation/render/page-worker.mjs +562 -86
- package/foundation/render/picture-chrome.mjs +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +33 -0
- package/foundation/render/picture-window.mjs +78 -0
- package/foundation/render/render-page.d.mts +55 -4
- package/foundation/render/render-page.mjs +199 -28
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +2 -1
- package/foundation/render/served-packages.mjs +5 -3
- package/foundation/render/ts-paths.d.mts +11 -0
- package/foundation/render/ts-paths.mjs +27 -2
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +10 -2
- package/foundation/response/response-types.doc.mjs +12 -12
- package/foundation/runtime/package-root.d.mts +8 -0
- package/foundation/runtime/package-root.mjs +20 -0
- package/foundation/suggest/other-command.d.mts +11 -0
- package/foundation/suggest/other-command.mjs +1 -1
- package/foundation/text/icon-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +25 -0
- package/foundation/text/icon-set-next.mjs +29 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
} from './_catalog.mjs';
|
|
34
34
|
import {
|
|
35
35
|
catalogVariants,
|
|
36
|
+
codeFingerprint,
|
|
36
37
|
demoProps,
|
|
37
38
|
needsParent,
|
|
38
39
|
renderDir,
|
|
@@ -59,6 +60,7 @@ import {importPathOf, installLine} from './_project.mjs';
|
|
|
59
60
|
import {
|
|
60
61
|
COLOR_PROP_PARTS,
|
|
61
62
|
DIRECT,
|
|
63
|
+
FAMILIES,
|
|
62
64
|
P,
|
|
63
65
|
SHOWCASE_GROUPS,
|
|
64
66
|
wordTable,
|
|
@@ -68,6 +70,7 @@ import {findNodeModulesPackage} from '../../foundation/fs/paths.mjs';
|
|
|
68
70
|
import {themeFileImports} from '../../foundation/discovery/theme-discovery.mjs';
|
|
69
71
|
import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
|
|
70
72
|
import {compareText} from '../../foundation/text/compare-text.mjs';
|
|
73
|
+
import {PICTURE_TAKEN} from '../../foundation/render/picture-window.mjs';
|
|
71
74
|
import {FONT_PROBE_PREFIX} from '../../foundation/render/font-probe.mjs';
|
|
72
75
|
import {CUT_SHORT_PREFIX} from '../../foundation/render/cut-short.mjs';
|
|
73
76
|
|
|
@@ -119,7 +122,7 @@ function groupOf(name, category) {
|
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
/**
|
|
122
|
-
* A container's or a layout's props on the sheet, with
|
|
125
|
+
* A container's or a layout's props on the sheet, with a line of sample
|
|
123
126
|
* text when its doc suggests no children (a section, a form layout): empty,
|
|
124
127
|
* it draws nothing of the theme. The part data reads the doc's own props.
|
|
125
128
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
@@ -141,10 +144,7 @@ function withSampleContent(project, name, props) {
|
|
|
141
144
|
return props;
|
|
142
145
|
return {
|
|
143
146
|
...props,
|
|
144
|
-
children: [
|
|
145
|
-
{__element: 'Text', props: {}, children: ['Content']},
|
|
146
|
-
{__element: 'Text', props: {}, children: ['More content']},
|
|
147
|
-
],
|
|
147
|
+
children: [{__element: 'Text', props: {}, children: ['Sample content']}],
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -165,8 +165,8 @@ export function familyOf(project, name) {
|
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* The sections of the theme-building page whose parts the theme's settings
|
|
168
|
-
* set on their own (`--on badge
|
|
169
|
-
* of, each in its section. A setting for the whole theme (a color, the
|
|
168
|
+
* set on their own (`--on badge`, or a group of parts such as `--on
|
|
169
|
+
* inputs`): the components each part names a class of, each in its section. A setting for the whole theme (a color, the
|
|
170
170
|
* corners) sets no section here: the sample page and the open states show
|
|
171
171
|
* it.
|
|
172
172
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
@@ -174,8 +174,11 @@ export function familyOf(project, name) {
|
|
|
174
174
|
* @returns {string[]}
|
|
175
175
|
*/
|
|
176
176
|
export function touchedFamilies(project, data) {
|
|
177
|
+
// A group (`--on inputs`) sets each of its parts.
|
|
177
178
|
const parts = new Set(
|
|
178
|
-
(data.settings ?? []).flatMap(s =>
|
|
179
|
+
(data.settings ?? []).flatMap(s =>
|
|
180
|
+
s.on ? (FAMILIES[s.on] ?? [s.on]) : [],
|
|
181
|
+
),
|
|
179
182
|
);
|
|
180
183
|
/** @type {Set<string>} */
|
|
181
184
|
const out = new Set();
|
|
@@ -188,6 +191,76 @@ export function touchedFamilies(project, data) {
|
|
|
188
191
|
return [...out];
|
|
189
192
|
}
|
|
190
193
|
|
|
194
|
+
/**
|
|
195
|
+
* What the cached component items are built by ({@link codeFingerprint}):
|
|
196
|
+
* this file and every file it imports, read the first time it is needed.
|
|
197
|
+
* @type {string | null}
|
|
198
|
+
*/
|
|
199
|
+
let itemsKey = null;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The component items of the theme-building page for each group, as JSON,
|
|
203
|
+
* by cache file: read or made once a process. They come from the installed
|
|
204
|
+
* Core's component docs alone, which the same install (its cache folder,
|
|
205
|
+
* keyed by its version and stylesheet) never changes, and every sample page
|
|
206
|
+
* and sheet a command renders starts from them; the cache file
|
|
207
|
+
* (items.json beside the part data) keeps them for the next command.
|
|
208
|
+
* @type {Map<string, Record<string, string>>}
|
|
209
|
+
*/
|
|
210
|
+
const itemsByFile = new Map();
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The component items for a group, from the cache or made now
|
|
214
|
+
* ({@link componentItems}), as a copy of their own.
|
|
215
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
216
|
+
* @param {string | undefined} group
|
|
217
|
+
* @returns {import('./_catalog.mjs').CatalogItem[]}
|
|
218
|
+
*/
|
|
219
|
+
function cachedComponentItems(project, group) {
|
|
220
|
+
itemsKey ??= codeFingerprint(import.meta.url);
|
|
221
|
+
const file = path.join(project.cacheDir, 'items.json');
|
|
222
|
+
let kept = itemsByFile.get(file);
|
|
223
|
+
if (!kept) {
|
|
224
|
+
kept = {};
|
|
225
|
+
try {
|
|
226
|
+
const cached = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
227
|
+
if (
|
|
228
|
+
cached?.itemsKey === itemsKey &&
|
|
229
|
+
cached.coreKey === project.coreKey &&
|
|
230
|
+
cached.groups &&
|
|
231
|
+
typeof cached.groups === 'object'
|
|
232
|
+
)
|
|
233
|
+
for (const [g, items] of Object.entries(cached.groups))
|
|
234
|
+
if (Array.isArray(items)) kept[g] = JSON.stringify(items);
|
|
235
|
+
} catch {
|
|
236
|
+
// Not made yet, or unreadable: made now.
|
|
237
|
+
}
|
|
238
|
+
itemsByFile.set(file, kept);
|
|
239
|
+
}
|
|
240
|
+
const at = group ?? '';
|
|
241
|
+
if (kept[at] == null) {
|
|
242
|
+
kept[at] = JSON.stringify(componentItems(project, group));
|
|
243
|
+
try {
|
|
244
|
+
fs.mkdirSync(project.cacheDir, {recursive: true});
|
|
245
|
+
// Written beside it and renamed in, so a reader never sees half a
|
|
246
|
+
// file; another command writing at once leaves one whole file.
|
|
247
|
+
const part = `${file}.${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
|
|
248
|
+
fs.writeFileSync(
|
|
249
|
+
part,
|
|
250
|
+
`{"itemsKey":${JSON.stringify(itemsKey)},"coreKey":${JSON.stringify(project.coreKey)},"groups":{${Object.entries(
|
|
251
|
+
kept,
|
|
252
|
+
)
|
|
253
|
+
.map(([g, json]) => `${JSON.stringify(g)}:${json}`)
|
|
254
|
+
.join(',')}}}`,
|
|
255
|
+
);
|
|
256
|
+
fs.renameSync(part, file);
|
|
257
|
+
} catch {
|
|
258
|
+
// A read-only node_modules: made again next time.
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return JSON.parse(kept[at]);
|
|
262
|
+
}
|
|
263
|
+
|
|
191
264
|
/**
|
|
192
265
|
* Items of the theme-building page: each component once per variant
|
|
193
266
|
* (overlays open), the sample page, and template pages
|
|
@@ -197,6 +270,16 @@ export function touchedFamilies(project, data) {
|
|
|
197
270
|
* @returns {{items: import('./_catalog.mjs').CatalogItem[], imports: Record<string, import('./_catalog.mjs').Binding>, skipped: string[], notes: string[]}}
|
|
198
271
|
*/
|
|
199
272
|
export function showcaseItems(project, group) {
|
|
273
|
+
return withPages(project, group, cachedComponentItems(project, group));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* The component items of the theme-building page ({@link showcaseItems}).
|
|
278
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
279
|
+
* @param {string | undefined} group only this group
|
|
280
|
+
* @returns {import('./_catalog.mjs').CatalogItem[]}
|
|
281
|
+
*/
|
|
282
|
+
function componentItems(project, group) {
|
|
200
283
|
/** @type {import('./_catalog.mjs').CatalogItem[]} */
|
|
201
284
|
const items = [];
|
|
202
285
|
/** @param {string} name */
|
|
@@ -215,6 +298,17 @@ export function showcaseItems(project, group) {
|
|
|
215
298
|
// to, never alone beside it: that page stays one or two screens.
|
|
216
299
|
if (group === 'overlays' && g === 'overlays' && info?.subComponentOf)
|
|
217
300
|
continue;
|
|
301
|
+
// A deprecated part is not drawn: a theme styles the part that replaces
|
|
302
|
+
// it. An overlay whose playground opens it over the page draws nothing
|
|
303
|
+
// closed (a phone's navigation drawer, slid out of the window): where
|
|
304
|
+
// the open states draw it open (below), that is its only cell.
|
|
305
|
+
if (info?.deprecated) continue;
|
|
306
|
+
if (
|
|
307
|
+
(!group || group === 'overlays') &&
|
|
308
|
+
info?.overlay &&
|
|
309
|
+
OPEN_SCENES.some(s => s.name === name)
|
|
310
|
+
)
|
|
311
|
+
continue;
|
|
218
312
|
catalogVariants(project, name, 12, {shown: true}).forEach((v, i) =>
|
|
219
313
|
items.push({
|
|
220
314
|
group: g,
|
|
@@ -222,7 +316,11 @@ export function showcaseItems(project, group) {
|
|
|
222
316
|
label: v.label,
|
|
223
317
|
tree: inParent({
|
|
224
318
|
__element: name,
|
|
225
|
-
|
|
319
|
+
// A doc's sample children may name a part by an older name (a
|
|
320
|
+
// stack, a heading): each is drawn by the name Core exports.
|
|
321
|
+
props: /** @type {Record<string, unknown>} */ (
|
|
322
|
+
withCoreAliases(project, withSampleContent(project, name, v.props))
|
|
323
|
+
),
|
|
226
324
|
}),
|
|
227
325
|
// An overlay shown open is drawn open: Core places a popover,
|
|
228
326
|
// tooltip or hover card only once it is mounted. Any other part, as
|
|
@@ -288,6 +386,19 @@ export function showcaseItems(project, group) {
|
|
|
288
386
|
states: true,
|
|
289
387
|
});
|
|
290
388
|
}
|
|
389
|
+
return items;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* {@link showcaseItems}' items with the sample app and the template pages
|
|
394
|
+
* whose packages the project has (read from the project each time: what it
|
|
395
|
+
* installs can change).
|
|
396
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
397
|
+
* @param {string | undefined} group only this group
|
|
398
|
+
* @param {import('./_catalog.mjs').CatalogItem[]} items
|
|
399
|
+
* @returns {{items: import('./_catalog.mjs').CatalogItem[], imports: Record<string, import('./_catalog.mjs').Binding>, skipped: string[], notes: string[]}}
|
|
400
|
+
*/
|
|
401
|
+
function withPages(project, group, items) {
|
|
291
402
|
items.push({
|
|
292
403
|
group: 'pages',
|
|
293
404
|
name: 'Sample app',
|
|
@@ -1097,6 +1208,35 @@ function withCoreNames(project, v) {
|
|
|
1097
1208
|
return v;
|
|
1098
1209
|
}
|
|
1099
1210
|
|
|
1211
|
+
/**
|
|
1212
|
+
* A value with each element a doc names by an older name named as Core
|
|
1213
|
+
* exports it; everything else is the same value, the same
|
|
1214
|
+
* object where nothing in it changed (a part's props keep what marks them).
|
|
1215
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
1216
|
+
* @param {unknown} v
|
|
1217
|
+
* @returns {unknown}
|
|
1218
|
+
*/
|
|
1219
|
+
function withCoreAliases(project, v) {
|
|
1220
|
+
if (Array.isArray(v)) {
|
|
1221
|
+
const out = v.map(x => withCoreAliases(project, x));
|
|
1222
|
+
return out.every((x, i) => x === v[i]) ? v : out;
|
|
1223
|
+
}
|
|
1224
|
+
if (!v || typeof v !== 'object') return v;
|
|
1225
|
+
if (isElement(v)) {
|
|
1226
|
+
const name = coreName(project, v.__element) ?? v.__element;
|
|
1227
|
+
const props = withCoreAliases(project, v.props);
|
|
1228
|
+
const children = withCoreAliases(project, v.children);
|
|
1229
|
+
return name === v.__element && props === v.props && children === v.children
|
|
1230
|
+
? v
|
|
1231
|
+
: {...v, __element: name, props, children};
|
|
1232
|
+
}
|
|
1233
|
+
const entries = Object.entries(v);
|
|
1234
|
+
const out = entries.map(([k, x]) => [k, withCoreAliases(project, x)]);
|
|
1235
|
+
return out.every(([, x], i) => x === entries[i][1])
|
|
1236
|
+
? v
|
|
1237
|
+
: {...v, ...Object.fromEntries(out)};
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1100
1240
|
/** @param {unknown} v @returns {boolean} */
|
|
1101
1241
|
const holdsElement = v =>
|
|
1102
1242
|
isElement(v) || (Array.isArray(v) && v.some(holdsElement));
|
|
@@ -1914,22 +2054,13 @@ export function newPictureRun() {
|
|
|
1914
2054
|
}
|
|
1915
2055
|
|
|
1916
2056
|
/**
|
|
1917
|
-
* A whole-page PNG of an HTML file
|
|
1918
|
-
* installed, else a Chrome or Chromium found on the machine. Each browser
|
|
1919
|
-
* gets its own time bound, and the next one its turn when one fails or
|
|
1920
|
-
* hangs. Not ok with a reason when none is there or every one failed: the
|
|
1921
|
-
* reason then names each one's real error. When a later browser took the
|
|
1922
|
-
* picture, `note` says why an earlier one did not. `cutShort` is the text
|
|
1923
|
-
* the page draws cut short, measured in it by the browser that took the
|
|
1924
|
-
* picture, each with whether its part keeping its width draws it whole;
|
|
1925
|
-
* absent when that browser's script measured nothing.
|
|
2057
|
+
* A whole-page PNG of an HTML file: {@link screenshots} with one picture.
|
|
1926
2058
|
* @param {import('./_project.mjs').ThemeProject} project
|
|
1927
2059
|
* @param {string} html absolute
|
|
1928
2060
|
* @param {string} png absolute
|
|
1929
2061
|
* @param {'light' | 'dark'} mode
|
|
1930
|
-
* @param {PictureRun} [run]
|
|
1931
|
-
*
|
|
1932
|
-
* @returns {Promise<{ok: true, file: string, notes?: string[], cutShort?: Array<{part: string | null, text: string, whole: boolean}>} | {ok: false, reason: string, stopped?: string}>}
|
|
2062
|
+
* @param {PictureRun} [run]
|
|
2063
|
+
* @returns {Promise<PictureResult>}
|
|
1933
2064
|
*/
|
|
1934
2065
|
export async function screenshot(
|
|
1935
2066
|
project,
|
|
@@ -1938,6 +2069,41 @@ export async function screenshot(
|
|
|
1938
2069
|
mode,
|
|
1939
2070
|
run = newPictureRun(),
|
|
1940
2071
|
) {
|
|
2072
|
+
const [r] = await screenshots(project, [{html, png, mode}], run);
|
|
2073
|
+
return /** @type {PictureResult} */ (r);
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* @typedef {{ok: true, file: string, notes?: string[], cutShort?: Array<{part: string | null, text: string, whole: boolean, broken?: boolean}>} | {ok: false, reason: string, stopped?: string}} PictureResult
|
|
2078
|
+
*/
|
|
2079
|
+
|
|
2080
|
+
/** The time a batch adds to its browser's bound for each page after the first. */
|
|
2081
|
+
const PAGE_BOUND_MS = 20_000;
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* Whole-page PNGs of HTML files, all with one browser: a Playwright the
|
|
2085
|
+
* project has installed, else a Chrome or Chromium found on the machine.
|
|
2086
|
+
* One browser start for the whole batch, a few pages drawn at once, so a
|
|
2087
|
+
* run of many pictures costs about one start. Each browser gets its own
|
|
2088
|
+
* time bound, and the next one the pictures still to take when one fails
|
|
2089
|
+
* or hangs. A result for each picture, in order, up to the first that was
|
|
2090
|
+
* not taken: that one not ok with a reason (naming each browser's real
|
|
2091
|
+
* error, or that none is there), and none after it. When a later browser
|
|
2092
|
+
* took a picture, its `notes` say why an earlier one did not. `cutShort` is
|
|
2093
|
+
* the text the page draws cut short, measured in it by the browser that
|
|
2094
|
+
* took the picture, each with whether its part keeping its width draws it
|
|
2095
|
+
* whole; absent when that browser's script measured nothing.
|
|
2096
|
+
* @param {import('./_project.mjs').ThemeProject} project
|
|
2097
|
+
* @param {Array<{html: string, png: string, mode: 'light' | 'dark'}>} jobs
|
|
2098
|
+
* absolute paths
|
|
2099
|
+
* @param {PictureRun} [run] what earlier pictures of the same run learned:
|
|
2100
|
+
* a browser that failed or hung there is not tried again
|
|
2101
|
+
* @returns {Promise<PictureResult[]>}
|
|
2102
|
+
*/
|
|
2103
|
+
export async function screenshots(project, jobs, run = newPictureRun()) {
|
|
2104
|
+
/** @type {PictureResult[]} */
|
|
2105
|
+
const results = [];
|
|
2106
|
+
if (!jobs.length) return results;
|
|
1941
2107
|
/** What was tried and why it could not take the picture. @type {string[]} */
|
|
1942
2108
|
const failed = [...run.failed.values()];
|
|
1943
2109
|
/** Whether a Playwright was found without its own browser installed. */
|
|
@@ -1969,8 +2135,8 @@ export async function screenshot(
|
|
|
1969
2135
|
);
|
|
1970
2136
|
return local(rest ? `${head} (${rest})` : head);
|
|
1971
2137
|
};
|
|
1972
|
-
/** The browsers to try, in order: each a picture script and its
|
|
1973
|
-
/** @type {Array<{who: string, script: string,
|
|
2138
|
+
/** The browsers to try, in order: each a picture script and its first argument. */
|
|
2139
|
+
/** @type {Array<{who: string, script: string, first: string}>} */
|
|
1974
2140
|
const tries = [];
|
|
1975
2141
|
for (const pkg of ['playwright', 'playwright-core']) {
|
|
1976
2142
|
try {
|
|
@@ -1979,7 +2145,7 @@ export async function screenshot(
|
|
|
1979
2145
|
tries.push({
|
|
1980
2146
|
who: `${pkg}'s own browser`,
|
|
1981
2147
|
script: PLAYWRIGHT_PICTURE,
|
|
1982
|
-
|
|
2148
|
+
first: entry,
|
|
1983
2149
|
});
|
|
1984
2150
|
break;
|
|
1985
2151
|
} catch {
|
|
@@ -1987,41 +2153,61 @@ export async function screenshot(
|
|
|
1987
2153
|
}
|
|
1988
2154
|
}
|
|
1989
2155
|
const chrome = chromeBinary();
|
|
1990
|
-
if (chrome)
|
|
1991
|
-
tries.push({
|
|
1992
|
-
who: chrome,
|
|
1993
|
-
script: CHROME_PICTURE,
|
|
1994
|
-
args: [chrome, html, png, mode],
|
|
1995
|
-
});
|
|
2156
|
+
if (chrome) tries.push({who: chrome, script: CHROME_PICTURE, first: chrome});
|
|
1996
2157
|
for (const t of tries) {
|
|
1997
2158
|
if (run.failed.has(t.who)) continue;
|
|
1998
|
-
const
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2159
|
+
const rest = jobs.slice(results.length);
|
|
2160
|
+
const r = await runBrowser(
|
|
2161
|
+
t.script,
|
|
2162
|
+
[t.first, JSON.stringify(rest)],
|
|
2163
|
+
BROWSER_BOUND_MS + (rest.length - 1) * PAGE_BOUND_MS,
|
|
2164
|
+
{drop: rest.map(j => j.png)},
|
|
2165
|
+
);
|
|
2166
|
+
if (r.stoppedBy) {
|
|
2167
|
+
results.push({
|
|
2003
2168
|
ok: false,
|
|
2004
2169
|
stopped: r.stoppedBy,
|
|
2005
2170
|
reason: `the pictures were stopped (${r.stoppedBy}) before the browser finished`,
|
|
2006
|
-
};
|
|
2007
|
-
|
|
2008
|
-
|
|
2171
|
+
});
|
|
2172
|
+
return results;
|
|
2173
|
+
}
|
|
2174
|
+
if (r.noTemp) {
|
|
2175
|
+
results.push({
|
|
2009
2176
|
ok: false,
|
|
2010
2177
|
reason: `no browser was started: the system temp folder cannot be written (${r.noTemp}), and a browser needs a profile folder of its own there; fix the temp folder (TMPDIR), then run the command again`,
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
|
-
|
|
2178
|
+
});
|
|
2179
|
+
return results;
|
|
2180
|
+
}
|
|
2181
|
+
// Each picture's own lines, by its place in this browser's share.
|
|
2182
|
+
/** @type {Map<number, string[]>} */
|
|
2183
|
+
const said = new Map();
|
|
2184
|
+
for (const line of String(r.stdout ?? '').split('\n')) {
|
|
2185
|
+
const tab = line.indexOf('\t');
|
|
2186
|
+
const i = Number(line.slice(0, tab));
|
|
2187
|
+
if (tab < 1 || !Number.isInteger(i)) continue;
|
|
2188
|
+
said.set(i, [...(said.get(i) ?? []), line.slice(tab + 1)]);
|
|
2189
|
+
}
|
|
2190
|
+
// The pictures it took whole, in order, up to the first it did not.
|
|
2191
|
+
for (const [i, job] of rest.entries()) {
|
|
2192
|
+
const lines = said.get(i) ?? [];
|
|
2193
|
+
if (!lines.includes(PICTURE_TAKEN) || !fs.existsSync(job.png)) break;
|
|
2194
|
+
const out = lines.join('\n');
|
|
2195
|
+
results.push({
|
|
2014
2196
|
ok: true,
|
|
2015
|
-
file: shown(project.cwd, png),
|
|
2197
|
+
file: shown(project.cwd, job.png),
|
|
2016
2198
|
notes: [
|
|
2017
2199
|
...(failed.length
|
|
2018
2200
|
? [`the picture was taken with ${t.who}; ${failed.join('; ')}`]
|
|
2019
2201
|
: []),
|
|
2020
|
-
...pictureFontNotes(
|
|
2202
|
+
...pictureFontNotes(out),
|
|
2021
2203
|
],
|
|
2022
|
-
...measuredCutShort(
|
|
2023
|
-
};
|
|
2204
|
+
...measuredCutShort(out),
|
|
2205
|
+
});
|
|
2024
2206
|
}
|
|
2207
|
+
if (results.length === jobs.length) return results;
|
|
2208
|
+
// A share it did not finish is the next browser's.
|
|
2209
|
+
for (const job of jobs.slice(results.length))
|
|
2210
|
+
fs.rmSync(job.png, {force: true});
|
|
2025
2211
|
const text = r.error ? String(r.error.message) : r.stderr;
|
|
2026
2212
|
if (
|
|
2027
2213
|
t.script === PLAYWRIGHT_PICTURE &&
|
|
@@ -2029,30 +2215,31 @@ export async function screenshot(
|
|
|
2029
2215
|
)
|
|
2030
2216
|
pwMissing = true;
|
|
2031
2217
|
const why = r.timedOut
|
|
2032
|
-
? `${t.who} did not finish within ${BROWSER_BOUND_MS / 1000} seconds, so it was stopped`
|
|
2033
|
-
: `${t.who} could not take it: ${causeOf(text)}`;
|
|
2218
|
+
? `${t.who} did not finish within ${(BROWSER_BOUND_MS + (rest.length - 1) * PAGE_BOUND_MS) / 1000} seconds, so it was stopped`
|
|
2219
|
+
: `${t.who} could not take it: ${causeOf(text || (r.status === 0 ? 'it stopped before every picture was taken' : ''))}`;
|
|
2034
2220
|
run.failed.set(t.who, why);
|
|
2035
2221
|
failed.push(why);
|
|
2036
2222
|
}
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2223
|
+
results.push(
|
|
2224
|
+
failed.length
|
|
2225
|
+
? {
|
|
2226
|
+
ok: false,
|
|
2227
|
+
// Advice that can change the result: Playwright's browser only when
|
|
2228
|
+
// it is missing; a Chrome to check only when there is one.
|
|
2229
|
+
reason: `${failed.join('; ')}. ${
|
|
2230
|
+
!pwFound
|
|
2231
|
+
? `Install Playwright with its browser (${installLine(project.cwd, ['playwright'])}, then npx playwright install chromium), or`
|
|
2232
|
+
: pwMissing
|
|
2233
|
+
? 'Give Playwright its browser (npx playwright install chromium), or'
|
|
2234
|
+
: "Fix what Playwright's browser needs (the reason is above), or"
|
|
2235
|
+
} ${chrome ? `check that ${chrome} starts on this machine` : 'install Google Chrome or Chromium'}. The HTML preview needs neither.`,
|
|
2236
|
+
}
|
|
2237
|
+
: {
|
|
2238
|
+
ok: false,
|
|
2239
|
+
reason: `No browser was found to take the picture. Install Playwright with its browser (${installLine(project.cwd, ['playwright'])}, then npx playwright install chromium), or install Google Chrome or Chromium. The HTML preview needs neither.`,
|
|
2240
|
+
},
|
|
2241
|
+
);
|
|
2242
|
+
return results;
|
|
2056
2243
|
}
|
|
2057
2244
|
|
|
2058
2245
|
/** The generic families any font of a common kind stands in for. */
|
|
@@ -2101,7 +2288,7 @@ export function pictureFontNotes(stdout) {
|
|
|
2101
2288
|
* The text a picture script measured cut short, from the line it prints
|
|
2102
2289
|
* after `CUT_SHORT_PREFIX`; nothing when it printed none that reads.
|
|
2103
2290
|
* @param {string} stdout what the picture script printed
|
|
2104
|
-
* @returns {{cutShort?: Array<{part: string | null, text: string, whole: boolean}>}}
|
|
2291
|
+
* @returns {{cutShort?: Array<{part: string | null, text: string, whole: boolean, broken?: boolean}>}}
|
|
2105
2292
|
*/
|
|
2106
2293
|
function measuredCutShort(stdout) {
|
|
2107
2294
|
const line = stdout.split('\n').find(l => l.startsWith(CUT_SHORT_PREFIX));
|
|
@@ -2121,6 +2308,7 @@ function measuredCutShort(stdout) {
|
|
|
2121
2308
|
part: typeof x.part === 'string' ? x.part : null,
|
|
2122
2309
|
text: x.text,
|
|
2123
2310
|
whole: x.whole === true,
|
|
2311
|
+
...(x.broken === true ? {broken: true} : {}),
|
|
2124
2312
|
})),
|
|
2125
2313
|
};
|
|
2126
2314
|
}
|
|
@@ -12,11 +12,18 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export function themeCacheRoot(dir: string): string | null;
|
|
14
14
|
/**
|
|
15
|
-
* The
|
|
15
|
+
* The step that adds packages to the app: the install guidance its
|
|
16
|
+
* integrations give, else {@link packageManagerAddLine}.
|
|
16
17
|
* @param {string} cwd
|
|
17
18
|
* @param {string[]} packages
|
|
18
19
|
*/
|
|
19
20
|
export function installLine(cwd: string, packages: string[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* The command that adds packages, in the project's package manager.
|
|
23
|
+
* @param {string} cwd
|
|
24
|
+
* @param {string[]} packages
|
|
25
|
+
*/
|
|
26
|
+
export function packageManagerAddLine(cwd: string, packages: string[]): string;
|
|
20
27
|
/**
|
|
21
28
|
* The project's package manager command that lists every installed copy of
|
|
22
29
|
* a package and what pulled each in.
|
|
@@ -152,6 +159,10 @@ export type ComponentInfo = {
|
|
|
152
159
|
* - Its playground opens it over the whole page, so a page of components leaves it out.
|
|
153
160
|
*/
|
|
154
161
|
overlay: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* - Its doc marks it deprecated: another part replaces it.
|
|
164
|
+
*/
|
|
165
|
+
deprecated: boolean;
|
|
155
166
|
/**
|
|
156
167
|
* - The component it is a part of, or null.
|
|
157
168
|
*/
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
oncePerListing,
|
|
37
37
|
withListingCache,
|
|
38
38
|
} from '../../foundation/fs/listing-cache.mjs';
|
|
39
|
+
import {installGuidanceFor} from '../../foundation/env/cli-command.mjs';
|
|
39
40
|
|
|
40
41
|
/**
|
|
41
42
|
* @typedef {object} ThemeProject
|
|
@@ -67,6 +68,7 @@ import {
|
|
|
67
68
|
* @property {{component: string, props: Record<string, unknown>} | null} wrapper - The parent the playground renders it in, or null.
|
|
68
69
|
* @property {boolean} opens - An overlay its playground shows in place: the pages render it open.
|
|
69
70
|
* @property {boolean} overlay - Its playground opens it over the whole page, so a page of components leaves it out.
|
|
71
|
+
* @property {boolean} deprecated - Its doc marks it deprecated: another part replaces it.
|
|
70
72
|
* @property {string | null} subComponentOf - The component it is a part of, or null.
|
|
71
73
|
* @property {string[]} keywords - The doc's search keywords.
|
|
72
74
|
* @property {Record<string, {type: string, required: boolean, default: string | null, slots: Array<{__element: string, props?: Record<string, unknown>, children?: unknown}>}>} props - Each prop's declared type, whether it is required, its documented default (as the doc writes it), and the elements the doc suggests for it.
|
|
@@ -117,11 +119,23 @@ function nodeModulesRoot(dir) {
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
/**
|
|
120
|
-
* The
|
|
122
|
+
* The step that adds packages to the app: the install guidance its
|
|
123
|
+
* integrations give, else {@link packageManagerAddLine}.
|
|
121
124
|
* @param {string} cwd
|
|
122
125
|
* @param {string[]} packages
|
|
123
126
|
*/
|
|
124
127
|
export function installLine(cwd, packages) {
|
|
128
|
+
return (
|
|
129
|
+
installGuidanceFor(packages, cwd) ?? packageManagerAddLine(cwd, packages)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The command that adds packages, in the project's package manager.
|
|
135
|
+
* @param {string} cwd
|
|
136
|
+
* @param {string[]} packages
|
|
137
|
+
*/
|
|
138
|
+
export function packageManagerAddLine(cwd, packages) {
|
|
125
139
|
const pm = detectPackageManager(cwd);
|
|
126
140
|
return `${pm === 'npm' || pm === 'npx' ? 'npm install' : `${pm} add`} ${packages.join(' ')}`;
|
|
127
141
|
}
|
|
@@ -242,6 +256,7 @@ async function readComponents(coreDir) {
|
|
|
242
256
|
}
|
|
243
257
|
: null,
|
|
244
258
|
overlay: pg?.overlay === true,
|
|
259
|
+
deprecated: Boolean(doc.deprecated),
|
|
245
260
|
// An overlay with an open state, unless its playground opens it as
|
|
246
261
|
// a real overlay over the page.
|
|
247
262
|
opens:
|