@astryxdesign/cli 0.7.17-canary.g4ea41ce → 0.7.17-canary.g5a3fd39
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 +7 -2
- package/api/build/_adapter.d.mts +7 -6
- package/api/build/_adapter.mjs +18 -11
- package/api/build/build.type.mjs +1 -1
- package/api/build/kit/kind.d.mts +6 -0
- package/api/build/kit/kind.mjs +1 -1
- package/api/build/kit/rank.d.mts +7 -1
- package/api/build/kit/rank.mjs +15 -5
- package/api/build/kit/signals.mjs +58 -57
- package/api/build/kit/start.d.mts +2 -1
- package/api/build/kit/start.mjs +62 -9
- package/api/build/kit/words.d.mts +6 -2
- package/api/build/kit/words.mjs +7 -3
- package/api/component/__fixtures__/resolutions/modules.txt +2 -2
- package/api/component/_adapter.d.mts +30 -24
- package/api/component/_adapter.mjs +72 -31
- package/api/component/component.mjs +4 -4
- package/api/component/detail/detail.d.mts +2 -2
- package/api/component/detail/detail.mjs +1 -1
- package/api/component/list/list.d.mts +2 -2
- package/api/component/list/list.mjs +4 -4
- package/api/discover/_adapter.mjs +15 -15
- package/api/docs/_adapter.d.mts +13 -5
- package/api/docs/_adapter.mjs +37 -10
- package/api/doctor/_adapter.d.mts +32 -0
- package/api/doctor/_adapter.mjs +56 -1
- package/api/doctor/doctor.mjs +28 -5
- package/api/doctor/theme-checks.mjs +165 -83
- package/api/error.d.mts +4 -3
- package/api/error.mjs +3 -2
- package/api/hook/_adapter.d.mts +5 -4
- package/api/hook/_adapter.mjs +6 -5
- package/api/icon/_options.d.mts +17 -0
- package/api/icon/_options.mjs +54 -0
- package/api/icon/exportIconIndex.doc.d.mts +10 -0
- package/api/icon/exportIconIndex.doc.mjs +59 -0
- package/api/icon/icon.mjs +11 -34
- package/api/icon/icon.type.d.mts +49 -0
- package/api/icon/icon.type.mjs +24 -0
- package/api/icon/rankIconIndex.doc.d.mts +10 -0
- package/api/icon/rankIconIndex.doc.mjs +79 -0
- package/api/icon/search/icon-index.d.mts +41 -0
- package/api/icon/search/icon-index.mjs +139 -0
- package/api/icon/search/search.d.mts +18 -0
- package/api/icon/search/search.mjs +13 -0
- package/api/index.d.mts +1 -0
- package/api/index.mjs +1 -0
- package/api/search/_adapter.d.mts +8 -5
- package/api/search/_adapter.mjs +14 -10
- package/api/search/_gather-components.d.mts +4 -4
- package/api/search/_gather-components.mjs +4 -3
- package/api/search/_gather-hooks.d.mts +2 -2
- package/api/search/_gather-hooks.mjs +1 -1
- package/api/search/_lexical.mjs +12 -2
- package/api/search/_priority.d.mts +10 -2
- package/api/search/_priority.mjs +37 -7
- package/api/search/_score.d.mts +12 -3
- package/api/search/_score.mjs +6 -3
- package/api/search/_words.mjs +12 -3
- package/api/search/search.d.mts +7 -1
- package/api/search/search.mjs +37 -4
- package/api/swizzle/_adapter.d.mts +7 -5
- package/api/swizzle/_adapter.mjs +7 -3
- package/api/swizzle/copy/copy.mjs +5 -4
- package/api/theme/build/build.d.mts +5 -0
- package/api/theme/build/build.mjs +400 -21
- package/api/theme/build/family.mjs +18 -7
- package/api/theme/build/font-warning.mjs +5 -4
- package/api/theme/build/input-fields.d.mts +21 -6
- package/api/theme/build/input-fields.mjs +104 -13
- package/api/theme/build/typography-values.d.mts +22 -0
- package/api/theme/build/typography-values.mjs +172 -22
- package/api/theme/build/written-values.d.mts +7 -0
- package/api/theme/build/written-values.mjs +57 -8
- package/api/theme/generateTonalPalette.doc.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +14 -2
- package/api/theme/palette/generate/generator.mjs +94 -8
- package/api/theme/theme.type.d.mts +21 -4
- package/api/theme/theme.type.mjs +14 -5
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +18 -3
- package/api/theme-edit/_adapter.d.mts +1 -1
- package/api/theme-edit/_adapter.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +10 -4
- package/api/theme-edit/_catalog.mjs +81 -22
- package/api/theme-edit/_check.mjs +402 -88
- package/api/theme-edit/_color.d.mts +11 -2
- package/api/theme-edit/_color.mjs +23 -7
- package/api/theme-edit/_compiler.mjs +11 -3
- package/api/theme-edit/_context.d.mts +87 -6
- package/api/theme-edit/_context.mjs +224 -17
- package/api/theme-edit/_css.mjs +4 -0
- package/api/theme-edit/_edit.mjs +331 -58
- package/api/theme-edit/_how-question.d.mts +11 -0
- package/api/theme-edit/_how-question.mjs +2514 -234
- package/api/theme-edit/_how.mjs +79 -14
- package/api/theme-edit/_missed.mjs +294 -32
- package/api/theme-edit/_normal.d.mts +3 -1
- package/api/theme-edit/_normal.mjs +4 -1
- package/api/theme-edit/_palette.mjs +36 -5
- package/api/theme-edit/_part-words.mjs +20 -2
- package/api/theme-edit/_parts.d.mts +12 -1
- package/api/theme-edit/_parts.mjs +116 -11
- package/api/theme-edit/_preview-app.mjs +40 -2
- package/api/theme-edit/_preview.d.mts +45 -5
- package/api/theme-edit/_preview.mjs +173 -21
- package/api/theme-edit/_settings.d.mts +20 -0
- package/api/theme-edit/_settings.mjs +1033 -94
- package/api/theme-edit/_tables.mjs +2 -2
- package/api/theme-edit/theme-edit.type.d.mts +6 -5
- package/api/theme-edit/theme-edit.type.mjs +8 -8
- package/api/upgrade/_adapter.mjs +13 -2
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/authoring.doc.mjs +1 -0
- package/assets/docs/tree/cli.doc.mjs +1 -0
- package/assets/docs/tree/computer-agent-guide.doc.mjs +1 -1
- package/assets/docs/tree/generate-a-palette.doc.mjs +2 -2
- package/assets/docs/tree/global.doc.mjs +1 -0
- package/assets/docs/tree/single-component.doc.mjs +40 -2
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/who-answers.doc.mjs +2 -2
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Blockquote/BlockquoteShowcase.tsx +1 -1
- package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +4 -4
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsCustomSeparator.tsx +1 -0
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsSupportingVariant.tsx +2 -2
- package/assets/templates/blocks/components/Card/CardElevations.tsx +1 -1
- package/assets/templates/blocks/components/Card/CardWithInnerLayout.tsx +19 -3
- package/assets/templates/blocks/components/Card/ClickableCardWithNestedButton.tsx +11 -1
- package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +1 -1
- package/assets/templates/blocks/components/Card/SelectableCardMulti.tsx +1 -1
- package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +1 -1
- package/assets/templates/blocks/components/Center/CenterInsideACard.tsx +1 -1
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.tsx +8 -0
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.tsx +8 -2
- package/assets/templates/blocks/components/ChatLayout/ChatLayoutPanelChat.tsx +1 -0
- package/assets/templates/blocks/components/ChatLayout/ChatLayoutShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleCustomContent.tsx +9 -1
- package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +12 -2
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.tsx +28 -7
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +35 -7
- package/assets/templates/blocks/components/Collapsible/CollapsibleShowcase.tsx +1 -1
- package/assets/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.tsx +20 -4
- package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +15 -3
- package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +29 -6
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBasic.tsx +2 -2
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.tsx +1 -1
- package/assets/templates/blocks/components/ContextMenu/ContextMenuShowcase.tsx +2 -2
- package/assets/templates/blocks/components/Divider/DividerFullBleed.tsx +1 -1
- package/assets/templates/blocks/components/Divider/DividerShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Divider/DividerVariants.tsx +1 -1
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +23 -4
- package/assets/templates/blocks/components/EmptyState/EmptyStateActions.tsx +18 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.tsx +20 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.tsx +16 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.tsx +11 -1
- package/assets/templates/blocks/components/Heading/HeadingTruncation.tsx +12 -2
- package/assets/templates/blocks/components/InternationalizationProvider/useDirectionHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/LayoutContent/LayoutContentBasic.tsx +1 -1
- package/assets/templates/blocks/components/LayoutContent/LayoutContentShowcase.tsx +1 -1
- package/assets/templates/blocks/components/LayoutFooter/LayoutFooterActions.tsx +17 -3
- package/assets/templates/blocks/components/LayoutFooter/LayoutFooterShowcase.tsx +17 -3
- package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderShowcase.tsx +15 -3
- package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.tsx +9 -2
- package/assets/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.tsx +1 -1
- package/assets/templates/blocks/components/LayoutPanel/LayoutPanelShowcase.tsx +1 -1
- package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.tsx +1 -1
- package/assets/templates/blocks/components/MultiSelector/MultiSelectorGhostToolbar.tsx +14 -2
- package/assets/templates/blocks/components/Outline/OutlineDensity.tsx +2 -0
- package/assets/templates/blocks/components/OverflowList/OverflowListShowcase.tsx +6 -1
- package/assets/templates/blocks/components/Pagination/PaginationVariants.tsx +4 -0
- package/assets/templates/blocks/components/Popover/PopoverHookUsage.tsx +17 -2
- package/assets/templates/blocks/components/SegmentedControl/SegmentedControlFillLayout.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorGhostToolbar.tsx +14 -2
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +8 -1
- package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +2 -2
- package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -0
- package/assets/templates/blocks/components/Switch/SwitchWithStatus.tsx +1 -1
- package/assets/templates/blocks/components/TabList/TabListTabsFillLayout.tsx +1 -1
- package/assets/templates/blocks/components/TabList/TabListTabsWithActions.tsx +12 -1
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +11 -1
- package/assets/templates/blocks/components/Table/TableInCard.tsx +2 -2
- package/assets/templates/blocks/components/Text/TextTruncation.tsx +1 -1
- package/assets/templates/blocks/components/Text/TextWordBreak.tsx +12 -2
- package/assets/templates/blocks/components/Text/TextWrap.tsx +19 -4
- package/assets/templates/blocks/components/TextArea/TextAreaCharacterCount.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaShowcase.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaStates.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaValidation.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.tsx +1 -1
- package/assets/templates/blocks/components/TextInput/TextInputStatusVariant.tsx +2 -2
- package/assets/templates/blocks/components/Timestamp/TimestampAutoFormat.tsx +15 -1
- package/assets/templates/blocks/components/Timestamp/TimestampRelativeFormat.tsx +15 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +8 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarSizes.tsx +12 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +18 -3
- package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.tsx +6 -0
- package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.tsx +7 -1
- package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +2 -2
- package/assets/templates/blocks/components/TopNav/TopNavShowcase.tsx +9 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +102 -6
- package/assets/templates/pages/canvas-editor/page.tsx +73 -2
- package/assets/templates/pages/centered-hero/page.tsx +10 -4
- package/assets/templates/pages/course-detail/page.tsx +46 -2
- package/assets/templates/pages/dashboard/page.tsx +45 -16
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +31 -20
- package/assets/templates/pages/dashboard-comparison/page.tsx +9 -0
- package/assets/templates/pages/dashboard-composition/page.tsx +22 -9
- package/assets/templates/pages/dashboard-progress/page.tsx +27 -15
- package/assets/templates/pages/dashboard-scorecard/page.tsx +9 -0
- package/assets/templates/pages/detail-page/page.tsx +105 -77
- package/assets/templates/pages/documentation/page.tsx +15 -2
- package/assets/templates/pages/documentation-design/page.tsx +7 -34
- package/assets/templates/pages/documentation-technical/page.tsx +76 -12
- package/assets/templates/pages/editor/page.tsx +26 -21
- package/assets/templates/pages/file-explorer/page.tsx +35 -1
- package/assets/templates/pages/form-two-column/page.tsx +2 -3
- package/assets/templates/pages/form-wizard/page.tsx +31 -3
- package/assets/templates/pages/form-wizard-vertical/page.tsx +32 -3
- package/assets/templates/pages/gallery-hero/page.tsx +2 -1
- package/assets/templates/pages/ide/page.tsx +15 -1
- package/assets/templates/pages/incident-console/page.tsx +2 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +1 -1
- package/assets/templates/pages/kanban-board/page.tsx +39 -2
- package/assets/templates/pages/payment-form/page.tsx +77 -39
- package/assets/templates/pages/product-gallery/page.tsx +16 -14
- package/assets/templates/pages/settings/page.tsx +35 -3
- package/assets/templates/pages/settings-dialog/page.tsx +34 -5
- package/assets/templates/pages/settings-sidebar/page.tsx +23 -3
- package/assets/templates/pages/shell-nav/page.tsx +28 -12
- package/assets/templates/pages/shell-side-nav/page.tsx +16 -1
- package/assets/templates/pages/shell-top-nav/page.tsx +27 -1
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -1
- package/assets/templates/pages/table/template.doc.mjs +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1 -1
- package/assets/templates/pages/table-comparison/page.tsx +1 -1
- package/assets/templates/pages/table-filter/page.tsx +9 -2
- package/assets/templates/pages/table-grouped/page.tsx +16 -6
- package/assets/templates/pages/table-inbox/page.tsx +60 -1
- package/assets/templates/pages/table-page/page.tsx +10 -2
- package/assets/templates/pages/table-tree/page.tsx +95 -13
- package/assets/templates/pages/theme-showcase/page.tsx +107 -11
- package/assets/templates/pages/work-item-detail/page.tsx +88 -74
- package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -1
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/gothic/gothicTheme.ts +5 -0
- package/assets/templates/themes/neutral/neutralTheme.ts +1 -1
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/y2k/y2kTheme.ts +1 -1
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +22 -8
- package/authoring/doctypes/_schema.mjs +31 -0
- package/authoring/doctypes/command/command.doc.mjs +24 -0
- package/authoring/doctypes/command/type.ts +31 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -5
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -0
- package/authoring/doctypes/namespace/type.ts +4 -0
- package/authoring/doctypes/template/type.ts +0 -7
- package/authoring/index.d.ts +6 -1
- package/authoring/integration/integration.doc.mjs +7 -0
- package/authoring/integration/schema.d.mts +6 -0
- package/authoring/integration/schema.mjs +3 -0
- package/authoring/integration/type.ts +34 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -0
- package/clients/cli/commands/component.mjs +5 -1
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/experimental/index.mjs +4 -1
- package/clients/cli/commands/experimental/theme.mjs +139 -64
- package/clients/cli/commands/experimental-render.doc.mjs +2 -0
- package/clients/cli/commands/experimental-theme-add.doc.mjs +2 -0
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +2 -0
- package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-template.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-use.doc.mjs +2 -0
- package/clients/cli/commands/gap-report.doc.mjs +1 -0
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +1 -1
- package/clients/cli/commands/integration-add.doc.mjs +1 -0
- package/clients/cli/commands/manifest.mjs +10 -3
- package/clients/cli/commands/swizzle.doc.mjs +8 -1
- package/clients/cli/commands/swizzle.mjs +13 -6
- package/clients/cli/commands/template.doc.mjs +3 -0
- package/clients/cli/commands/theme-add.doc.mjs +2 -1
- package/clients/cli/commands/theme-build.doc.mjs +2 -1
- package/clients/cli/commands/theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
- package/clients/cli/commands/theme-remove.doc.mjs +2 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -0
- package/clients/cli/commands/theme-template.doc.mjs +1 -0
- package/clients/cli/commands/theme-use.doc.mjs +2 -1
- package/clients/cli/commands/theme.doc.mjs +7 -2
- package/clients/cli/commands/theme.mjs +21 -5
- package/clients/cli/index.mjs +167 -59
- package/clients/cli/lib/base-gate.mjs +522 -0
- package/clients/cli/lib/command-path.mjs +26 -0
- package/clients/cli/lib/define-command.mjs +161 -12
- package/clients/cli/lib/json-shim.mjs +34 -31
- package/clients/cli/lib/manifest.d.ts +14 -0
- package/clients/cli/lib/manifest.mjs +78 -22
- package/clients/cli/lib/root-args.mjs +79 -0
- package/clients/cli/lib/stray-option.mjs +21 -8
- package/clients/cli/lib/unknown-command.mjs +27 -6
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +13 -1
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core-docs.d.mts +10 -0
- package/foundation/bases/core-docs.mjs +42 -0
- package/foundation/bases/core.d.mts +11 -0
- package/foundation/bases/core.mjs +32 -0
- package/foundation/bases/requirements.d.mts +128 -0
- package/foundation/bases/requirements.mjs +193 -0
- package/foundation/bases/resolve.d.mts +134 -0
- package/foundation/bases/resolve.mjs +295 -0
- package/foundation/bases/state.d.mts +24 -0
- package/foundation/bases/state.mjs +46 -0
- package/foundation/bases/steps.d.mts +49 -0
- package/foundation/bases/steps.mjs +88 -0
- package/foundation/config/project.d.mts +14 -0
- package/foundation/config/project.mjs +68 -1
- package/foundation/discovery/cli-self-docs.mjs +9 -1
- package/foundation/discovery/command-pointers.d.mts +28 -0
- package/foundation/discovery/command-pointers.mjs +31 -0
- package/foundation/discovery/component-discovery.d.mts +9 -8
- package/foundation/discovery/component-discovery.mjs +9 -4
- package/foundation/discovery/docs-discovery.d.mts +13 -5
- package/foundation/discovery/docs-discovery.mjs +25 -6
- package/foundation/discovery/hook-discovery.d.mts +6 -6
- package/foundation/discovery/hook-discovery.mjs +6 -4
- package/foundation/discovery/template-adapter.mjs +5 -0
- package/foundation/discovery/template-ids.d.mts +1 -1
- package/foundation/discovery/template-ids.mjs +5 -1
- package/foundation/discovery/theme-discovery.mjs +3 -0
- package/foundation/discovery/theme-imports.mjs +19 -1
- package/foundation/doc-compiler/tree.d.mts +4 -2
- package/foundation/doc-compiler/tree.mjs +46 -1
- package/foundation/env/package-manager.d.mts +7 -0
- package/foundation/env/package-manager.mjs +21 -0
- package/foundation/fonts/font-stylesheet.d.mts +8 -0
- package/foundation/fonts/font-stylesheet.mjs +26 -2
- package/foundation/fs/gather-cache.mjs +44 -13
- package/foundation/fs/own-modules.d.mts +29 -0
- package/foundation/fs/own-modules.mjs +57 -0
- package/foundation/fs/paths.d.mts +30 -2
- package/foundation/fs/paths.mjs +49 -2
- package/foundation/integrations/integrations.d.mts +4 -0
- package/foundation/integrations/integrations.mjs +6 -1
- package/foundation/release/choose.d.mts +7 -0
- package/foundation/release/choose.mjs +16 -2
- package/foundation/release/notices.d.mts +26 -0
- package/foundation/release/notices.mjs +48 -19
- package/foundation/release/project.d.mts +3 -2
- package/foundation/release/project.mjs +4 -5
- package/foundation/release/run-context.d.mts +7 -2
- package/foundation/release/run-context.mjs +6 -2
- package/foundation/render/css-cut.mjs +86 -6
- package/foundation/render/cut-short.d.mts +35 -0
- package/foundation/render/cut-short.mjs +124 -0
- package/foundation/render/font-probe.d.mts +27 -0
- package/foundation/render/font-probe.mjs +77 -0
- package/foundation/render/layers.d.mts +1 -9
- package/foundation/render/layers.mjs +2 -111
- package/foundation/render/page-worker.mjs +83 -6
- package/foundation/render/picture-chrome.mjs +24 -2
- package/foundation/render/picture-playwright.mjs +22 -2
- package/foundation/render/picture-window.d.mts +20 -4
- package/foundation/render/picture-window.mjs +137 -4
- package/foundation/response/base.d.ts +25 -0
- package/foundation/response/error-codes.d.mts +4 -1
- package/foundation/response/error-codes.d.ts +4 -1
- package/foundation/response/error-codes.doc.mjs +17 -0
- package/foundation/response/error-codes.mjs +21 -0
- package/foundation/response/json.d.mts +3 -1
- package/foundation/response/json.mjs +7 -2
- package/foundation/response/response-types.doc.mjs +2 -2
- package/foundation/suggest/name-index.d.mts +2 -1
- package/foundation/suggest/name-index.mjs +1 -1
- package/foundation/suggest/other-command.d.mts +4 -1
- package/foundation/suggest/other-command.mjs +23 -6
- package/foundation/text/string-utils.d.mts +7 -2
- package/foundation/text/string-utils.mjs +24 -10
- package/package.json +6 -6
- package/assets/templates/pages/access-denied/page.tsx +0 -101
- package/assets/templates/pages/access-denied/template.doc.mjs +0 -24
- package/assets/templates/pages/error-page/page.tsx +0 -130
- package/assets/templates/pages/error-page/template.doc.mjs +0 -22
- package/assets/templates/pages/not-found/page.tsx +0 -124
- package/assets/templates/pages/not-found/template.doc.mjs +0 -30
- package/assets/templates/pages/review-workspace/page.tsx +0 -551
- package/assets/templates/pages/review-workspace/template.doc.mjs +0 -31
- package/assets/templates/pages/run-console/page.tsx +0 -945
- package/assets/templates/pages/run-console/template.doc.mjs +0 -27
- package/assets/templates/pages/welcome-portal/page.tsx +0 -538
- package/assets/templates/pages/welcome-portal/template.doc.mjs +0 -38
|
@@ -46,10 +46,12 @@ import {
|
|
|
46
46
|
commandInFolder,
|
|
47
47
|
detectPackageManager,
|
|
48
48
|
getCliInvocation,
|
|
49
|
+
installDependenciesCommand,
|
|
49
50
|
} from '../env/package-manager.mjs';
|
|
50
51
|
import {findAstryxProject, findPackageRoot} from '../fs/paths.mjs';
|
|
51
52
|
import {satisfiesRange, semverCompare} from '../env/semver.mjs';
|
|
52
53
|
import {isInReleaseCache, isReleaseVersion} from './cache.mjs';
|
|
54
|
+
import {pinnedVersion} from './choose.mjs';
|
|
53
55
|
import {
|
|
54
56
|
knownLatest,
|
|
55
57
|
readGlobalState,
|
|
@@ -63,7 +65,7 @@ import {
|
|
|
63
65
|
isGlobalCopy,
|
|
64
66
|
projectRootOf,
|
|
65
67
|
} from './choose.mjs';
|
|
66
|
-
import {
|
|
68
|
+
import {installsPackage, readReleaseFacts} from './project.mjs';
|
|
67
69
|
import {samePath} from '../fs/path-compare.mjs';
|
|
68
70
|
import {updateNoticesOff} from './update-notice-env.mjs';
|
|
69
71
|
|
|
@@ -392,15 +394,26 @@ const ADD = {
|
|
|
392
394
|
};
|
|
393
395
|
|
|
394
396
|
/**
|
|
395
|
-
* The command that
|
|
396
|
-
*
|
|
397
|
+
* The command that adds Astryx packages at `version` to the project at
|
|
398
|
+
* `root`, with its package manager. A project that pins its Core (or, with no
|
|
399
|
+
* Core, its CLI) to one version, as a starter does, keeps its packages
|
|
400
|
+
* pinned: npm saves a version it adds as a range unless it is told to save it
|
|
401
|
+
* exactly, so the command carries that flag when `version` is one version. A
|
|
402
|
+
* range is saved as the range.
|
|
403
|
+
* @param {string} root
|
|
404
|
+
* @param {string | null} [version]
|
|
405
|
+
* @returns {string}
|
|
397
406
|
*/
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
407
|
+
export function addVerbFor(root, version = null) {
|
|
408
|
+
const pm = detectPackageManager(root);
|
|
409
|
+
const add = ADD[pm] ?? ADD.npm;
|
|
410
|
+
if (!pinnedVersion(version)) return add;
|
|
411
|
+
const facts = readReleaseFacts(root);
|
|
412
|
+
if (!pinnedVersion(facts.declaredCoreRange ?? facts.declaredCliRange)) {
|
|
413
|
+
return add;
|
|
414
|
+
}
|
|
415
|
+
return `${add} ${pm === 'bun' ? '--exact' : '-E'}`;
|
|
416
|
+
}
|
|
404
417
|
|
|
405
418
|
/**
|
|
406
419
|
* The command that adds a package to the project of a run in `cwd`, with the
|
|
@@ -445,7 +458,7 @@ export function alignCliAndCore({cwd, cli, core}) {
|
|
|
445
458
|
* @returns {string}
|
|
446
459
|
*/
|
|
447
460
|
function alignIn(root, cli, core) {
|
|
448
|
-
const add =
|
|
461
|
+
const add = addVerbFor(root, semverCompare(cli, core) > 0 ? cli : core);
|
|
449
462
|
if (semverCompare(cli, core) > 0) {
|
|
450
463
|
return `${add} @astryxdesign/core@${cli}, then ${getCliInvocation(root, {installed: true})} upgrade --from ${core} --apply`;
|
|
451
464
|
}
|
|
@@ -471,6 +484,26 @@ export function installFolder(cwd) {
|
|
|
471
484
|
return {dir: project, moved: true};
|
|
472
485
|
}
|
|
473
486
|
|
|
487
|
+
/**
|
|
488
|
+
* The command that installs the project's dependencies, when the project a
|
|
489
|
+
* run in `cwd` belongs to lists `name` among the packages its install gets:
|
|
490
|
+
* a `name` that is not installed then comes from that install, at the version
|
|
491
|
+
* the project lists, as in a fresh clone, and adding it again would replace
|
|
492
|
+
* that version. Null when the project lists no `name`, when `cwd` belongs to
|
|
493
|
+
* no project, and in a folder inside the project whose package.json is not
|
|
494
|
+
* the project's (see {@link installFolder}), where an install would install
|
|
495
|
+
* that folder's own packages.
|
|
496
|
+
* @param {string} cwd
|
|
497
|
+
* @param {string} name
|
|
498
|
+
* @returns {string | null}
|
|
499
|
+
*/
|
|
500
|
+
export function listedPackageInstall(cwd, name) {
|
|
501
|
+
const target = installFolder(cwd);
|
|
502
|
+
if (target == null || target.moved) return null;
|
|
503
|
+
const root = projectRootOf(readReleaseFacts(cwd)) ?? cwd;
|
|
504
|
+
return installsPackage(root, name) ? installDependenciesCommand(root) : null;
|
|
505
|
+
}
|
|
506
|
+
|
|
474
507
|
/**
|
|
475
508
|
* What to tell a run in a folder inside a project whose package.json is not
|
|
476
509
|
* the project's: run from the project's folder, since adding there would make
|
|
@@ -513,12 +546,9 @@ export function cliInstallAdvice({cwd, core}) {
|
|
|
513
546
|
if (target.moved) {
|
|
514
547
|
return {root: target.dir, core, command: null, declared: false};
|
|
515
548
|
}
|
|
516
|
-
const
|
|
517
|
-
const
|
|
518
|
-
if (
|
|
519
|
-
const install = INSTALL[detectPackageManager(root)] ?? INSTALL.npm;
|
|
520
|
-
return {root, core, command: install, declared: true};
|
|
521
|
-
}
|
|
549
|
+
const root = projectRootOf(readReleaseFacts(cwd)) ?? cwd;
|
|
550
|
+
const install = listedPackageInstall(cwd, CLI_PACKAGE);
|
|
551
|
+
if (install) return {root, core, command: install, declared: true};
|
|
522
552
|
return {root, core, command: addCliCommand(root, core), declared: false};
|
|
523
553
|
}
|
|
524
554
|
|
|
@@ -568,7 +598,7 @@ export function noCliHintLine(answered, core, command, declared = false) {
|
|
|
568
598
|
* @returns {string}
|
|
569
599
|
*/
|
|
570
600
|
export function addCliCommand(root, version) {
|
|
571
|
-
return `${
|
|
601
|
+
return `${addVerbFor(root, version)} ${CLI_PACKAGE}@${version}`;
|
|
572
602
|
}
|
|
573
603
|
|
|
574
604
|
/**
|
|
@@ -592,12 +622,11 @@ export function projectLag({cwd, current: given, stateDir = userConfigDir()}) {
|
|
|
592
622
|
: given;
|
|
593
623
|
if (!isBehind(current, latest.version)) return null;
|
|
594
624
|
const newest = latest.version;
|
|
595
|
-
const pm = detectPackageManager(root);
|
|
596
625
|
// The CLI is always installed beside Core: a project that installed only
|
|
597
626
|
// Core gets it too, as recommended, so its version is pinned with Core's.
|
|
598
627
|
// From a folder inside the project whose package.json is not the
|
|
599
628
|
// project's, the install runs in the project's folder (see installFolder).
|
|
600
|
-
const add = `${
|
|
629
|
+
const add = `${addVerbFor(root, newest)} @astryxdesign/core@${newest} ${CLI_PACKAGE}@${newest}`;
|
|
601
630
|
const install = target.moved ? commandInFolder(root, add) : add;
|
|
602
631
|
// The command runs after the install above, so the picker's guess is the
|
|
603
632
|
// project's own CLI (spec AST-081 FR5).
|
|
@@ -48,13 +48,14 @@ export function findReadCore(startDir: string): InstalledAstryxPackage | null;
|
|
|
48
48
|
*/
|
|
49
49
|
export function findProjectCli(startDir: string): InstalledAstryxPackage | null;
|
|
50
50
|
/**
|
|
51
|
-
* Does the package.json in `dir` list
|
|
51
|
+
* Does the package.json in `dir` list `name` among the packages its install
|
|
52
52
|
* gets? A peer dependency does not count: some package managers never install
|
|
53
53
|
* peers.
|
|
54
54
|
* @param {string} dir
|
|
55
|
+
* @param {string} name
|
|
55
56
|
* @returns {boolean}
|
|
56
57
|
*/
|
|
57
|
-
export function
|
|
58
|
+
export function installsPackage(dir: string, name: string): boolean;
|
|
58
59
|
/**
|
|
59
60
|
* The nearest package.json at or above `startDir` that declares the Core or
|
|
60
61
|
* the CLI. The search stops after the first folder that holds
|
|
@@ -189,18 +189,17 @@ function declaredRanges(pkg) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* Does the package.json in `dir` list
|
|
192
|
+
* Does the package.json in `dir` list `name` among the packages its install
|
|
193
193
|
* gets? A peer dependency does not count: some package managers never install
|
|
194
194
|
* peers.
|
|
195
195
|
* @param {string} dir
|
|
196
|
+
* @param {string} name
|
|
196
197
|
* @returns {boolean}
|
|
197
198
|
*/
|
|
198
|
-
export function
|
|
199
|
+
export function installsPackage(dir, name) {
|
|
199
200
|
const pkg = readJson(path.join(dir, 'package.json'));
|
|
200
201
|
if (!pkg || typeof pkg !== 'object') return false;
|
|
201
|
-
return INSTALLED_FIELDS.some(
|
|
202
|
-
field => typeof pkg[field]?.[CLI_PACKAGE_NAME] === 'string',
|
|
203
|
-
);
|
|
202
|
+
return INSTALLED_FIELDS.some(field => typeof pkg[field]?.[name] === 'string');
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
/**
|
|
@@ -34,14 +34,19 @@ export function carriedCore(options?: {
|
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
36
|
* `meta.answeredBy` for this run: the answering CLI's version, the Core the
|
|
37
|
-
* run pairs with (`null` when there is none), and which copy answered.
|
|
37
|
+
* run pairs with (`null` when there is none), and which copy answered. A run
|
|
38
|
+
* whose base is not Core names that base in `base`, and pairs with no Core.
|
|
38
39
|
* @param {string} [cwd]
|
|
39
|
-
* @returns {{cli: string, core: string | null, copy: 'project' | 'starting' | 'matched' | 'carried' | 'fallback'}}
|
|
40
|
+
* @returns {{cli: string, core: string | null, copy: 'project' | 'starting' | 'matched' | 'carried' | 'fallback', base?: {name: string, version: string | null}}}
|
|
40
41
|
*/
|
|
41
42
|
export function answeredBy(cwd?: string): {
|
|
42
43
|
cli: string;
|
|
43
44
|
core: string | null;
|
|
44
45
|
copy: "project" | "starting" | "matched" | "carried" | "fallback";
|
|
46
|
+
base?: {
|
|
47
|
+
name: string;
|
|
48
|
+
version: string | null;
|
|
49
|
+
};
|
|
45
50
|
};
|
|
46
51
|
/** Exported for tests: forget the recorded choice. */
|
|
47
52
|
export function _resetRunChoice(): void;
|
|
@@ -23,6 +23,7 @@ import {isJsonMode} from '../response/json.mjs';
|
|
|
23
23
|
import {cachedRelease, ensureRelease, userCacheDir} from './cache.mjs';
|
|
24
24
|
import {readJson, findReadCore, CORE_PACKAGE_NAME} from './project.mjs';
|
|
25
25
|
import {hostedRun} from '../runtime/package-root.mjs';
|
|
26
|
+
import {currentNonCoreBase} from '../bases/state.mjs';
|
|
26
27
|
|
|
27
28
|
/** The running CLI package's folder. */
|
|
28
29
|
const CLI_ROOT = path.resolve(
|
|
@@ -139,12 +140,15 @@ export function carriedCore(options = {}) {
|
|
|
139
140
|
|
|
140
141
|
/**
|
|
141
142
|
* `meta.answeredBy` for this run: the answering CLI's version, the Core the
|
|
142
|
-
* run pairs with (`null` when there is none), and which copy answered.
|
|
143
|
+
* run pairs with (`null` when there is none), and which copy answered. A run
|
|
144
|
+
* whose base is not Core names that base in `base`, and pairs with no Core.
|
|
143
145
|
* @param {string} [cwd]
|
|
144
|
-
* @returns {{cli: string, core: string | null, copy: 'project' | 'starting' | 'matched' | 'carried' | 'fallback'}}
|
|
146
|
+
* @returns {{cli: string, core: string | null, copy: 'project' | 'starting' | 'matched' | 'carried' | 'fallback', base?: {name: string, version: string | null}}}
|
|
145
147
|
*/
|
|
146
148
|
export function answeredBy(cwd = process.cwd()) {
|
|
147
149
|
const choice = runChoice(cwd);
|
|
150
|
+
const base = currentNonCoreBase();
|
|
151
|
+
if (base) return {cli: cliVersion(), core: null, copy: choice.copy, base};
|
|
148
152
|
const read = findReadCore(cwd);
|
|
149
153
|
let core = read ? read.version : null;
|
|
150
154
|
if (!core && choice.copy !== 'project') {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import postcss from 'postcss';
|
|
17
|
+
import {desktopMatches} from './picture-window.mjs';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Every class name in a page's markup.
|
|
@@ -51,7 +52,9 @@ export function requiredClasses(selector) {
|
|
|
51
52
|
for (let i = 0; i < 3 && /:(not|is|where|has)\(/.test(s); i++) {
|
|
52
53
|
s = s.replace(/:(?:not|is|where|has)\((?:[^()]|\([^()]*\))*\)/g, '');
|
|
53
54
|
}
|
|
54
|
-
return [...s.matchAll(/\.((?:\\.|[A-Za-z0-9_-])+)/g)].map(m =>
|
|
55
|
+
return [...s.matchAll(/\.((?:\\.|[A-Za-z0-9_-])+)/g)].map(m =>
|
|
56
|
+
unescapeIdent(m[1]),
|
|
57
|
+
);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/**
|
|
@@ -108,8 +111,32 @@ export function cutCss(css, used, options = {}) {
|
|
|
108
111
|
else if (kept.length !== splitSelectors(rule.selector).length) {
|
|
109
112
|
rule.selector = kept.join(',');
|
|
110
113
|
}
|
|
111
|
-
if (kept.length && options.states)
|
|
112
|
-
|
|
114
|
+
if (kept.length && options.states) {
|
|
115
|
+
const real = rule.selector;
|
|
116
|
+
rule.selector = withDrawnStates(real);
|
|
117
|
+
// A state rule behind media queries the picture's window answers
|
|
118
|
+
// true, each feature of them (`(hover: hover)`, Core's own hover wash;
|
|
119
|
+
// never `(forced-colors: active)`, nor a feature it does not judge),
|
|
120
|
+
// applies to an
|
|
121
|
+
// element drawn in that state, whatever the browser taking the
|
|
122
|
+
// picture reports about its pointer: a copy with the drawn states
|
|
123
|
+
// alone follows the outermost such query, in the same place.
|
|
124
|
+
const guards = mediaGuards(rule);
|
|
125
|
+
if (
|
|
126
|
+
guards.length &&
|
|
127
|
+
guards.every(at => desktopMatches(at.params, {sure: true}))
|
|
128
|
+
) {
|
|
129
|
+
const drawn = drawnStatesOnly(real);
|
|
130
|
+
if (drawn) {
|
|
131
|
+
const copy = rule.clone({selector: drawn});
|
|
132
|
+
const outer = guards[guards.length - 1];
|
|
133
|
+
/** @type {any} */ (outer.parent).insertAfter(
|
|
134
|
+
outer,
|
|
135
|
+
wrapIn(copy, rule, outer),
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
113
140
|
});
|
|
114
141
|
// Drop the grouping at-rules left empty, innermost first.
|
|
115
142
|
let changed = true;
|
|
@@ -117,7 +144,9 @@ export function cutCss(css, used, options = {}) {
|
|
|
117
144
|
changed = false;
|
|
118
145
|
rootNode.walkAtRules(at => {
|
|
119
146
|
if (
|
|
120
|
-
/^(media|supports|container|layer|scope|starting-style)$/i.test(
|
|
147
|
+
/^(media|supports|container|layer|scope|starting-style)$/i.test(
|
|
148
|
+
at.name,
|
|
149
|
+
) &&
|
|
121
150
|
at.nodes &&
|
|
122
151
|
at.nodes.length === 0
|
|
123
152
|
) {
|
|
@@ -138,6 +167,54 @@ export function cutCss(css, used, options = {}) {
|
|
|
138
167
|
return rootNode.toString().replace(/\n\s*\n/g, '\n');
|
|
139
168
|
}
|
|
140
169
|
|
|
170
|
+
/**
|
|
171
|
+
* The `@media` rules around a rule, innermost first, up to its root.
|
|
172
|
+
* @param {any} rule
|
|
173
|
+
* @returns {any[]}
|
|
174
|
+
*/
|
|
175
|
+
function mediaGuards(rule) {
|
|
176
|
+
const out = [];
|
|
177
|
+
for (let p = rule.parent; p && p.type !== 'root'; p = p.parent)
|
|
178
|
+
if (p.type === 'atrule' && /^media$/i.test(p.name)) out.push(p);
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A copy of `rule` inside the grouping rules between it and `outer` that are
|
|
184
|
+
* not media queries (a `@supports`, a `@layer`), so the copy keeps their
|
|
185
|
+
* conditions and its place in the cascade.
|
|
186
|
+
* @param {any} copy
|
|
187
|
+
* @param {any} rule
|
|
188
|
+
* @param {any} outer
|
|
189
|
+
* @returns {any}
|
|
190
|
+
*/
|
|
191
|
+
function wrapIn(copy, rule, outer) {
|
|
192
|
+
let node = copy;
|
|
193
|
+
for (let p = rule.parent; p && p !== outer; p = p.parent)
|
|
194
|
+
if (p.type === 'atrule' && !/^media$/i.test(p.name))
|
|
195
|
+
node = p.clone({nodes: []}).append(node);
|
|
196
|
+
return node;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* A selector matching only elements a page draws in a state (never the real
|
|
201
|
+
* pseudo-class), or null when it names no state.
|
|
202
|
+
* @param {string} selector
|
|
203
|
+
* @returns {string | null}
|
|
204
|
+
*/
|
|
205
|
+
function drawnStatesOnly(selector) {
|
|
206
|
+
let named = false;
|
|
207
|
+
const out = selector.replace(
|
|
208
|
+
/(\\.)|:(hover|active|focus-visible|focus-within|focus)(?![\w-])/g,
|
|
209
|
+
(whole, escaped, state) => {
|
|
210
|
+
if (escaped) return whole;
|
|
211
|
+
named = true;
|
|
212
|
+
return `:is(${DRAWN_STATES[/** @type {keyof typeof DRAWN_STATES} */ (state)]})`;
|
|
213
|
+
},
|
|
214
|
+
);
|
|
215
|
+
return named ? out : null;
|
|
216
|
+
}
|
|
217
|
+
|
|
141
218
|
/** What each state a page draws matches, beside the browser's own pseudo-class. */
|
|
142
219
|
const DRAWN_STATES = Object.freeze({
|
|
143
220
|
// A pointer over an element hovers it and every element around it; a
|
|
@@ -147,7 +224,8 @@ const DRAWN_STATES = Object.freeze({
|
|
|
147
224
|
// Keyboard focus is on one element; `:focus-within` reaches those around it.
|
|
148
225
|
'focus-visible': '[data-astryx-state~="focus"]',
|
|
149
226
|
focus: '[data-astryx-state~="focus"]',
|
|
150
|
-
'focus-within':
|
|
227
|
+
'focus-within':
|
|
228
|
+
'[data-astryx-state~="focus"],:has([data-astryx-state~="focus"])',
|
|
151
229
|
});
|
|
152
230
|
|
|
153
231
|
/**
|
|
@@ -162,7 +240,9 @@ export function withDrawnStates(selector) {
|
|
|
162
240
|
return selector.replace(
|
|
163
241
|
/(\\.)|:(hover|active|focus-visible|focus-within|focus)(?![\w-])/g,
|
|
164
242
|
(whole, escaped, state) =>
|
|
165
|
-
escaped
|
|
243
|
+
escaped
|
|
244
|
+
? whole
|
|
245
|
+
: `:is(:${state},${DRAWN_STATES[/** @type {keyof typeof DRAWN_STATES} */ (state)]})`,
|
|
166
246
|
);
|
|
167
247
|
}
|
|
168
248
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Each text the page draws cut short: an element whose text ends in an
|
|
6
|
+
* ellipsis with its text wider than its box, whose lines are clamped with
|
|
7
|
+
* its text taller than its box, or whose own text runs past the side of a
|
|
8
|
+
* box around it that clips what overflows. Text that is not drawn (no box,
|
|
9
|
+
* a box of a pixel kept for screen readers, hidden) is not counted. `part`
|
|
10
|
+
* is the nearest Astryx part the text sits in (its `astryx-<part>` class),
|
|
11
|
+
* or null. `whole` says whether the text is drawn whole once every element
|
|
12
|
+
* of that part keeps its width (`flex-shrink: 0`), measured by applying it
|
|
13
|
+
* in the page and taking it back.
|
|
14
|
+
* Runs in the page: it uses nothing from outside its own body.
|
|
15
|
+
* @returns {Array<{part: string | null, text: string, whole: boolean}>}
|
|
16
|
+
*/
|
|
17
|
+
export function cutShortText(): Array<{
|
|
18
|
+
part: string | null;
|
|
19
|
+
text: string;
|
|
20
|
+
whole: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* @file The text a picture's page draws cut short, measured in the page.
|
|
24
|
+
* @input None: `cutShortText` runs in the page the picture is taken of.
|
|
25
|
+
* @output `cutShortText`: each text the browser draws cut short (an ellipsis
|
|
26
|
+
* or a line clamp, or text drawn past the side of a box that clips it),
|
|
27
|
+
* with the part it sits in and whether keeping that part's width
|
|
28
|
+
* (`flex-shrink: 0` on it, the line the editor offers) draws it whole;
|
|
29
|
+
* `CUT_SHORT_PREFIX`, the line prefix a picture script prints it after.
|
|
30
|
+
* @position run by picture-chrome.mjs and picture-playwright.mjs once the
|
|
31
|
+
* page is drawn as the picture shows it; read back by `screenshot` in
|
|
32
|
+
* api/theme-edit/_preview.mjs from the script's stdout
|
|
33
|
+
*/
|
|
34
|
+
/** The line prefix a picture script prints the measurement after. */
|
|
35
|
+
export const CUT_SHORT_PREFIX: "astryx-cut-short:";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The text a picture's page draws cut short, measured in the page.
|
|
5
|
+
* @input None: `cutShortText` runs in the page the picture is taken of.
|
|
6
|
+
* @output `cutShortText`: each text the browser draws cut short (an ellipsis
|
|
7
|
+
* or a line clamp, or text drawn past the side of a box that clips it),
|
|
8
|
+
* with the part it sits in and whether keeping that part's width
|
|
9
|
+
* (`flex-shrink: 0` on it, the line the editor offers) draws it whole;
|
|
10
|
+
* `CUT_SHORT_PREFIX`, the line prefix a picture script prints it after.
|
|
11
|
+
* @position run by picture-chrome.mjs and picture-playwright.mjs once the
|
|
12
|
+
* page is drawn as the picture shows it; read back by `screenshot` in
|
|
13
|
+
* api/theme-edit/_preview.mjs from the script's stdout
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/* global document, getComputedStyle, HTMLElement -- cutShortText runs in the page */
|
|
17
|
+
|
|
18
|
+
/** The line prefix a picture script prints the measurement after. */
|
|
19
|
+
export const CUT_SHORT_PREFIX = 'astryx-cut-short:';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Each text the page draws cut short: an element whose text ends in an
|
|
23
|
+
* ellipsis with its text wider than its box, whose lines are clamped with
|
|
24
|
+
* its text taller than its box, or whose own text runs past the side of a
|
|
25
|
+
* box around it that clips what overflows. Text that is not drawn (no box,
|
|
26
|
+
* a box of a pixel kept for screen readers, hidden) is not counted. `part`
|
|
27
|
+
* is the nearest Astryx part the text sits in (its `astryx-<part>` class),
|
|
28
|
+
* or null. `whole` says whether the text is drawn whole once every element
|
|
29
|
+
* of that part keeps its width (`flex-shrink: 0`), measured by applying it
|
|
30
|
+
* in the page and taking it back.
|
|
31
|
+
* Runs in the page: it uses nothing from outside its own body.
|
|
32
|
+
* @returns {Array<{part: string | null, text: string, whole: boolean}>}
|
|
33
|
+
*/
|
|
34
|
+
export function cutShortText() {
|
|
35
|
+
/** @param {Element} el */
|
|
36
|
+
const drawn = el => {
|
|
37
|
+
for (
|
|
38
|
+
let a = /** @type {Element | null} */ (el);
|
|
39
|
+
a && a !== document.body;
|
|
40
|
+
a = a.parentElement
|
|
41
|
+
) {
|
|
42
|
+
const cs = getComputedStyle(a);
|
|
43
|
+
if (cs.display === 'contents') continue;
|
|
44
|
+
const r = a.getBoundingClientRect();
|
|
45
|
+
if (r.width < 2 || r.height < 2 || cs.visibility !== 'visible')
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
/** @param {Element} el */
|
|
51
|
+
const partOf = el => {
|
|
52
|
+
for (let a = /** @type {Element | null} */ (el); a; a = a.parentElement) {
|
|
53
|
+
const named = [...a.classList].find(
|
|
54
|
+
c => c.startsWith('astryx-') && !c.startsWith('astryx-theme'),
|
|
55
|
+
);
|
|
56
|
+
if (named) return named.slice('astryx-'.length);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
/** Whether an element draws text of its own, not only its children's. @param {Element} el */
|
|
61
|
+
const ownText = el =>
|
|
62
|
+
[...el.childNodes].some(
|
|
63
|
+
n => n.nodeType === 3 && (n.textContent ?? '').trim() !== '',
|
|
64
|
+
);
|
|
65
|
+
/** The text an element draws cut by an ellipsis or a line clamp. @param {HTMLElement} el */
|
|
66
|
+
const ellipsized = el => {
|
|
67
|
+
const cs = getComputedStyle(el);
|
|
68
|
+
const clamp = cs.getPropertyValue('-webkit-line-clamp');
|
|
69
|
+
return (
|
|
70
|
+
(cs.textOverflow === 'ellipsis' && el.scrollWidth > el.clientWidth) ||
|
|
71
|
+
(clamp !== '' && clamp !== 'none' && el.scrollHeight > el.clientHeight)
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Own text drawn past the side of a box around it that clips (a text's
|
|
76
|
+
* height runs past its line by its font's ascent and descent, so only
|
|
77
|
+
* its width is read).
|
|
78
|
+
* @param {HTMLElement} el
|
|
79
|
+
*/
|
|
80
|
+
const clipped = el => {
|
|
81
|
+
if (!ownText(el)) return false;
|
|
82
|
+
const range = document.createRange();
|
|
83
|
+
range.selectNodeContents(el);
|
|
84
|
+
const t = range.getBoundingClientRect();
|
|
85
|
+
if (t.width < 1 || t.height < 1) return false;
|
|
86
|
+
for (let a = el.parentElement; a; a = a.parentElement) {
|
|
87
|
+
if (getComputedStyle(a).overflowX === 'visible') continue;
|
|
88
|
+
const left = a.getBoundingClientRect().left + a.clientLeft;
|
|
89
|
+
if (t.left < left - 1 || t.right > left + a.clientWidth + 1) return true;
|
|
90
|
+
}
|
|
91
|
+
return false;
|
|
92
|
+
};
|
|
93
|
+
/** @param {HTMLElement} el */
|
|
94
|
+
const cutShort = el => ellipsized(el) || clipped(el);
|
|
95
|
+
/** @type {Array<{el: HTMLElement, part: string | null, text: string}>} */
|
|
96
|
+
const found = [];
|
|
97
|
+
for (const el of document.body.querySelectorAll('*')) {
|
|
98
|
+
if (!(el instanceof HTMLElement)) continue;
|
|
99
|
+
const text = (el.textContent ?? '').replace(/\s+/g, ' ').trim();
|
|
100
|
+
if (text && cutShort(el) && drawn(el))
|
|
101
|
+
found.push({el, part: partOf(el), text});
|
|
102
|
+
}
|
|
103
|
+
/** Whether each text is whole with its part's width kept. @type {Map<string | null, boolean>} */
|
|
104
|
+
const whole = new Map();
|
|
105
|
+
for (const part of new Set(found.map(f => f.part))) {
|
|
106
|
+
if (part === null) {
|
|
107
|
+
whole.set(part, false);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const keep = document.createElement('style');
|
|
111
|
+
keep.textContent = `.astryx-${part}{flex-shrink:0 !important}`;
|
|
112
|
+
document.head.append(keep);
|
|
113
|
+
whole.set(
|
|
114
|
+
part,
|
|
115
|
+
found.filter(f => f.part === part).every(f => !cutShort(f.el)),
|
|
116
|
+
);
|
|
117
|
+
keep.remove();
|
|
118
|
+
}
|
|
119
|
+
return found.map(({part, text}) => ({
|
|
120
|
+
part,
|
|
121
|
+
text,
|
|
122
|
+
whole: whole.get(part) ?? false,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The font each role's text is drawn in, as the browser's own font list
|
|
6
|
+
* names it (`DejaVu Sans`), with its stack.
|
|
7
|
+
* @param {(method: string, params?: Record<string, unknown>) => Promise<any>} send
|
|
8
|
+
* @returns {Promise<Record<string, {stack: string[], shown: string | null}>>}
|
|
9
|
+
*/
|
|
10
|
+
export function probeFonts(send: (method: string, params?: Record<string, unknown>) => Promise<any>): Promise<Record<string, {
|
|
11
|
+
stack: string[];
|
|
12
|
+
shown: string | null;
|
|
13
|
+
}>>;
|
|
14
|
+
/**
|
|
15
|
+
* @file Which font a picture draws the theme's headings and body text in.
|
|
16
|
+
* @input A DevTools protocol `send` for the page a picture was taken of.
|
|
17
|
+
* @output `probeFonts(send)`: for the theme's heading and body font stacks
|
|
18
|
+
* (its --font-family-* tokens), the stack and the font the browser draws
|
|
19
|
+
* it in; `FONT_PROBE_PREFIX`: the line prefix a picture script prints the
|
|
20
|
+
* result after.
|
|
21
|
+
* @position Run by the picture scripts (picture-chrome.mjs,
|
|
22
|
+
* picture-playwright.mjs) after the picture is taken; read by
|
|
23
|
+
* `screenshot` in api/theme-edit/_preview.mjs, which names a stack this
|
|
24
|
+
* machine has none of the families for.
|
|
25
|
+
*/
|
|
26
|
+
/** The line prefix a picture script prints the probe's result after. */
|
|
27
|
+
export const FONT_PROBE_PREFIX: "astryx-fonts:";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Which font a picture draws the theme's headings and body text in.
|
|
5
|
+
* @input A DevTools protocol `send` for the page a picture was taken of.
|
|
6
|
+
* @output `probeFonts(send)`: for the theme's heading and body font stacks
|
|
7
|
+
* (its --font-family-* tokens), the stack and the font the browser draws
|
|
8
|
+
* it in; `FONT_PROBE_PREFIX`: the line prefix a picture script prints the
|
|
9
|
+
* result after.
|
|
10
|
+
* @position Run by the picture scripts (picture-chrome.mjs,
|
|
11
|
+
* picture-playwright.mjs) after the picture is taken; read by
|
|
12
|
+
* `screenshot` in api/theme-edit/_preview.mjs, which names a stack this
|
|
13
|
+
* machine has none of the families for.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** The line prefix a picture script prints the probe's result after. */
|
|
17
|
+
export const FONT_PROBE_PREFIX = 'astryx-fonts:';
|
|
18
|
+
|
|
19
|
+
/** The roles probed, by the token that holds each one's stack. */
|
|
20
|
+
const ROLES = /** @type {const} */ ([
|
|
21
|
+
['heading', '--font-family-heading'],
|
|
22
|
+
['body', '--font-family-body'],
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Text in each role's stack, added inside the theme's root after the
|
|
27
|
+
* picture is taken, and each stack as the root resolves it.
|
|
28
|
+
*/
|
|
29
|
+
const SETUP = `document.fonts.ready.then(() => {
|
|
30
|
+
const root = document.querySelector('[data-astryx-theme]') ?? document.body;
|
|
31
|
+
const out = {};
|
|
32
|
+
for (const [role, token] of ${JSON.stringify(ROLES)}) {
|
|
33
|
+
const span = document.createElement('span');
|
|
34
|
+
span.id = 'astryx-font-probe-' + role;
|
|
35
|
+
span.textContent = 'Hamburgefonstiv 0123';
|
|
36
|
+
span.style.fontFamily = 'var(' + token + ')';
|
|
37
|
+
root.appendChild(span);
|
|
38
|
+
out[role] = getComputedStyle(span).fontFamily;
|
|
39
|
+
}
|
|
40
|
+
return JSON.stringify(out);
|
|
41
|
+
})`;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The font each role's text is drawn in, as the browser's own font list
|
|
45
|
+
* names it (`DejaVu Sans`), with its stack.
|
|
46
|
+
* @param {(method: string, params?: Record<string, unknown>) => Promise<any>} send
|
|
47
|
+
* @returns {Promise<Record<string, {stack: string[], shown: string | null}>>}
|
|
48
|
+
*/
|
|
49
|
+
export async function probeFonts(send) {
|
|
50
|
+
const set = await send('Runtime.evaluate', {
|
|
51
|
+
expression: SETUP,
|
|
52
|
+
awaitPromise: true,
|
|
53
|
+
returnByValue: true,
|
|
54
|
+
});
|
|
55
|
+
/** @type {Record<string, string>} */
|
|
56
|
+
const stacks = JSON.parse(set?.result?.value ?? '{}');
|
|
57
|
+
await send('DOM.enable');
|
|
58
|
+
await send('CSS.enable');
|
|
59
|
+
const {root} = await send('DOM.getDocument', {depth: 0});
|
|
60
|
+
/** @type {Record<string, {stack: string[], shown: string | null}>} */
|
|
61
|
+
const out = {};
|
|
62
|
+
for (const [role] of ROLES) {
|
|
63
|
+
const stack = String(stacks[role] ?? '')
|
|
64
|
+
.split(',')
|
|
65
|
+
.map(f => f.trim().replace(/^["']|["']$/g, ''))
|
|
66
|
+
.filter(Boolean);
|
|
67
|
+
const {nodeId} = await send('DOM.querySelector', {
|
|
68
|
+
nodeId: root.nodeId,
|
|
69
|
+
selector: `#astryx-font-probe-${role}`,
|
|
70
|
+
});
|
|
71
|
+
const fonts = nodeId
|
|
72
|
+
? (await send('CSS.getPlatformFontsForNode', {nodeId})).fonts
|
|
73
|
+
: [];
|
|
74
|
+
out[role] = {stack, shown: fonts?.[0]?.familyName ?? null};
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
@@ -8,15 +8,6 @@
|
|
|
8
8
|
* @returns {Promise<void>}
|
|
9
9
|
*/
|
|
10
10
|
export function layerDocument(): Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Whether a media query matches in the window a picture is taken in
|
|
13
|
-
* (PICTURE_WINDOW, a desktop's, with a mouse): each comma-separated query
|
|
14
|
-
* matches when its media type is the screen's and every feature holds
|
|
15
|
-
* (featureHolds); `not` turns it round.
|
|
16
|
-
* @param {string} query
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
19
|
-
export function desktopMatches(query: string): boolean;
|
|
20
11
|
/**
|
|
21
12
|
* The markup of each overlay the drawn page shows open, then of each popup
|
|
22
13
|
* its controls open: a press on each collapsed control that opens one, then
|
|
@@ -51,6 +42,7 @@ export function countQueuedImmediates(): void;
|
|
|
51
42
|
* @param {number} index
|
|
52
43
|
*/
|
|
53
44
|
export function layerPlaceholder(index: number): string;
|
|
45
|
+
export { desktopMatches } from "./picture-window.mjs";
|
|
54
46
|
/** The global the render worker installs for parts a page shows open in place. SYNC: page-worker.mjs assigns it by this name. */
|
|
55
47
|
export const LAYER_GLOBAL: "__astryxRenderLayer";
|
|
56
48
|
/** Where a part drawn open goes in the server markup. */
|