@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
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @position api/theme-edit — checks over the part data
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import {CUSTOM_PROPERTY} from '../theme/build/written-values.mjs';
|
|
12
13
|
import {AstryxError} from '../error.mjs';
|
|
13
14
|
import * as fs from 'node:fs';
|
|
14
15
|
import * as path from 'node:path';
|
|
@@ -77,9 +78,12 @@ import {
|
|
|
77
78
|
colorAsCssReads,
|
|
78
79
|
isNumber,
|
|
79
80
|
isSafeValue,
|
|
81
|
+
UNSAFE_VALUE,
|
|
82
|
+
LONE_VAR,
|
|
80
83
|
withoutCssEscapes,
|
|
81
84
|
isSize,
|
|
82
85
|
parseColor,
|
|
86
|
+
ratio,
|
|
83
87
|
mixSide,
|
|
84
88
|
splitTop,
|
|
85
89
|
} from './_color.mjs';
|
|
@@ -98,6 +102,7 @@ import {
|
|
|
98
102
|
nearest,
|
|
99
103
|
negates,
|
|
100
104
|
partsOf,
|
|
105
|
+
autoMediaPart,
|
|
101
106
|
refuse,
|
|
102
107
|
lengthPx,
|
|
103
108
|
cornersPlain,
|
|
@@ -129,6 +134,7 @@ import {
|
|
|
129
134
|
partStates,
|
|
130
135
|
savedStateRead,
|
|
131
136
|
propertySpelling,
|
|
137
|
+
modesOf,
|
|
132
138
|
} from './_settings.mjs';
|
|
133
139
|
import {isColorToken} from './_compiler.mjs';
|
|
134
140
|
import {
|
|
@@ -597,17 +603,14 @@ export function pastedFont(v) {
|
|
|
597
603
|
*/
|
|
598
604
|
function valueMeant(type, value) {
|
|
599
605
|
// `!important` is not part of a token's value (the theme places its
|
|
600
|
-
// rules itself)
|
|
606
|
+
// rules itself), nor is a trailing `;` or an old browser hack's escape:
|
|
607
|
+
// the value without them (the one copy-debris cleanup).
|
|
601
608
|
/** @type {string} */
|
|
602
|
-
let p = (
|
|
609
|
+
let p = withoutCopyDebris(
|
|
603
610
|
type === 'font' || type === 'font-family'
|
|
604
611
|
? pastedFont(value) || value
|
|
605
|
-
: pastedDeclaration(value)?.value || typedPlain(value)
|
|
606
|
-
)
|
|
607
|
-
.replace(/;+\s*$/, '')
|
|
608
|
-
.replace(/\s*!\s*important\s*$/i, '')
|
|
609
|
-
.replace(/;+\s*$/, '')
|
|
610
|
-
.trim();
|
|
612
|
+
: pastedDeclaration(value)?.value || typedPlain(value),
|
|
613
|
+
);
|
|
611
614
|
// Copy debris around it (a trailing comma, a stray quote or bracket).
|
|
612
615
|
p = withoutDebris(p).trim();
|
|
613
616
|
const q = /^(["'])(.*)\1$/.exec(p);
|
|
@@ -901,13 +904,14 @@ export function storedProblems(ctx, slug, data, skip = '') {
|
|
|
901
904
|
)
|
|
902
905
|
)
|
|
903
906
|
return scope(`"${s.state}" is not a state of ${s.on}`);
|
|
904
|
-
if (t && s.when)
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
907
|
+
if (t && s.when)
|
|
908
|
+
for (const w of String(s.when).split('+')) {
|
|
909
|
+
const [prop, value] = w.split(':');
|
|
910
|
+
const values = ctx.C.variantValues(/** @type {string} */ (s.on));
|
|
911
|
+
if (!(prop in values)) return scope(`${s.on} has no prop "${prop}"`);
|
|
912
|
+
if (values[prop].length && !values[prop].includes(value))
|
|
913
|
+
return scope(`${s.on} has no ${prop} "${value}"`);
|
|
914
|
+
}
|
|
911
915
|
return null;
|
|
912
916
|
})();
|
|
913
917
|
if (problem) found.push(problem);
|
|
@@ -1074,6 +1078,58 @@ const WHOLE_THEME_EQUIVALENT = /** @type {Record<string, string>} */ ({
|
|
|
1074
1078
|
'background-color': '--color-background-body',
|
|
1075
1079
|
});
|
|
1076
1080
|
|
|
1081
|
+
/**
|
|
1082
|
+
* The one mode a whole-theme color belongs to, or null: a theme showing
|
|
1083
|
+
* both modes takes a page or text color that suits one of them (a dark
|
|
1084
|
+
* page, light text) in that mode only, since the same value in both would
|
|
1085
|
+
* leave the other unreadable. Measured against what the theme shows now,
|
|
1086
|
+
* by the contrast the page and its text keep.
|
|
1087
|
+
* @param {import('./_settings.mjs').Ctx} ctx
|
|
1088
|
+
* @param {any} data
|
|
1089
|
+
* @param {string} token the whole-theme token the value would set
|
|
1090
|
+
* @param {string} value
|
|
1091
|
+
* @returns {'light' | 'dark' | null}
|
|
1092
|
+
*/
|
|
1093
|
+
function modeColorBelongs(ctx, data, token, value) {
|
|
1094
|
+
if (!/^--color-(background-body|text-primary)$/.test(token)) return null;
|
|
1095
|
+
if (modesOf(data).length < 2) return null;
|
|
1096
|
+
const want = parseColor(String(value).trim());
|
|
1097
|
+
if (!want) return null;
|
|
1098
|
+
// The other side of the pair, as the theme shows it now: a page color is
|
|
1099
|
+
// read against that mode's text, a text color against its page.
|
|
1100
|
+
const other =
|
|
1101
|
+
token === '--color-background-body'
|
|
1102
|
+
? '--color-text-primary'
|
|
1103
|
+
: '--color-background-body';
|
|
1104
|
+
const saved = (data.settings ?? []).filter(
|
|
1105
|
+
(/** @type {any} */ x) => x.thing === other && !x.on,
|
|
1106
|
+
);
|
|
1107
|
+
const shown = (/** @type {'light' | 'dark'} */ m) => {
|
|
1108
|
+
const own =
|
|
1109
|
+
saved.find((/** @type {any} */ x) => x.mode === m) ??
|
|
1110
|
+
saved.find((/** @type {any} */ x) => !x.mode);
|
|
1111
|
+
const raw = String(
|
|
1112
|
+
own?.value ?? ctx.project.core.tokenDefaults?.[other] ?? '',
|
|
1113
|
+
);
|
|
1114
|
+
// `light-dark(a, b)`, as the token defaults write a pair.
|
|
1115
|
+
const inner = /^light-dark\(\s*([\s\S]*)\)$/i.exec(raw.trim())?.[1];
|
|
1116
|
+
const sides = inner ? splitTop(inner, ',').map(x => x.trim()) : null;
|
|
1117
|
+
return parseColor(
|
|
1118
|
+
sides && sides.length === 2 ? sides[m === 'dark' ? 1 : 0] : raw,
|
|
1119
|
+
);
|
|
1120
|
+
};
|
|
1121
|
+
/** @type {Array<['light' | 'dark', number]>} */
|
|
1122
|
+
const kept = [];
|
|
1123
|
+
for (const m of /** @type {const} */ (['light', 'dark'])) {
|
|
1124
|
+
const against = shown(m);
|
|
1125
|
+
if (!against) return null;
|
|
1126
|
+
kept.push([m, ratio(want, against)]);
|
|
1127
|
+
}
|
|
1128
|
+
const [best, worst] = [...kept].sort((a, b) => b[1] - a[1]);
|
|
1129
|
+
// One mode keeps text readable and the other does not: that mode.
|
|
1130
|
+
return best[1] >= 4.5 && worst[1] < 3 ? best[0] : null;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1077
1133
|
/** A number or a size, which is never a font family. */
|
|
1078
1134
|
const NUMBERISH = /^[+-]?(\d+\.?\d*|\.\d+)(px|rem|em|pt|%)?$/i;
|
|
1079
1135
|
|
|
@@ -1808,7 +1864,7 @@ function checkTypedValue(
|
|
|
1808
1864
|
if (!isSafeValue(value))
|
|
1809
1865
|
refuse(
|
|
1810
1866
|
E.ERR_THEME_BAD_VALUE,
|
|
1811
|
-
`"${value}" cannot be a CSS value:
|
|
1867
|
+
`"${value}" cannot be a CSS value: ${UNSAFE_VALUE}.${/!\s*important/i.test(value) ? ' !important is not used: the theme places its own rules.' : ''}`,
|
|
1812
1868
|
{
|
|
1813
1869
|
run: [
|
|
1814
1870
|
`${P} set ${slug} ${name} ${quoteCommandArgument(meant() ?? exampleOf(type, name))}`,
|
|
@@ -1890,7 +1946,10 @@ function checkTypedValue(
|
|
|
1890
1946
|
}
|
|
1891
1947
|
// A var() naming a design token must name one of the same kind; the
|
|
1892
1948
|
// app's own variables are its business.
|
|
1893
|
-
const ref =
|
|
1949
|
+
const ref = new RegExp(
|
|
1950
|
+
String.raw`^var\(\s*(${CUSTOM_PROPERTY})\s*(,.*)?\)$`,
|
|
1951
|
+
'i',
|
|
1952
|
+
).exec(value.trim());
|
|
1894
1953
|
if (ref) {
|
|
1895
1954
|
if (ref[1] in TOKENS && typeOf(ref[1]) !== type && type !== 'other')
|
|
1896
1955
|
refuse(
|
|
@@ -1960,7 +2019,10 @@ function checkTypedValue(
|
|
|
1960
2019
|
if (k !== 'other' && !ofKind.has(k)) ofKind.set(k, t);
|
|
1961
2020
|
}
|
|
1962
2021
|
for (const m of value.matchAll(
|
|
1963
|
-
|
|
2022
|
+
new RegExp(
|
|
2023
|
+
String.raw`var\(\s*(${CUSTOM_PROPERTY})\s*(?:,[^()]*)?\)`,
|
|
2024
|
+
'gi',
|
|
2025
|
+
),
|
|
1964
2026
|
)) {
|
|
1965
2027
|
const token = m[1];
|
|
1966
2028
|
if (!(token in TOKENS)) continue;
|
|
@@ -2034,7 +2096,7 @@ function checkTypedValue(
|
|
|
2034
2096
|
if (
|
|
2035
2097
|
type === 'number' &&
|
|
2036
2098
|
multiplied &&
|
|
2037
|
-
|
|
2099
|
+
!LONE_VAR.test(v0) &&
|
|
2038
2100
|
read?.unit !== '' &&
|
|
2039
2101
|
!(MATH_FUNCTION.test(v0) && matchType('number', v0) != null)
|
|
2040
2102
|
) {
|
|
@@ -2273,7 +2335,9 @@ function checkCycle(
|
|
|
2273
2335
|
'',
|
|
2274
2336
|
);
|
|
2275
2337
|
const refs = (/** @type {string} */ v) =>
|
|
2276
|
-
[
|
|
2338
|
+
[
|
|
2339
|
+
...v.matchAll(new RegExp(String.raw`var\(\s*(${CUSTOM_PROPERTY})`, 'gi')),
|
|
2340
|
+
].map(m => m[1]);
|
|
2277
2341
|
/** @type {string[]} */
|
|
2278
2342
|
const path = [];
|
|
2279
2343
|
const seen = new Set();
|
|
@@ -3266,13 +3330,22 @@ function mediaTextRefusal(ctx, slug, s, v) {
|
|
|
3266
3330
|
);
|
|
3267
3331
|
if (!parts.length || held.length !== parts.length) return;
|
|
3268
3332
|
const part = held[0];
|
|
3333
|
+
// A surface that keeps one side (a lightbox's dark island) draws its
|
|
3334
|
+
// text in the on-color for that side: that token on the part reaches it
|
|
3335
|
+
// there and nowhere else. One that follows its fill (a toast's) takes a
|
|
3336
|
+
// color on the part, written into both on-colors.
|
|
3337
|
+
const sides = /** @type {string[]} */ (
|
|
3338
|
+
/** @type {any} */ (ctx.C.MAP[part])?.mediaSides ?? []
|
|
3339
|
+
);
|
|
3340
|
+
const fixed = !autoMediaPart(ctx, part) && sides.length === 1;
|
|
3269
3341
|
refuse(
|
|
3270
3342
|
E.ERR_THEME_NO_EFFECT,
|
|
3271
|
-
`${part}'s text sits on Core's media surface inside it
|
|
3343
|
+
`${part}'s text sits on Core's media surface inside it, which sets the text color from --color-on-dark where that surface is dark and --color-on-light where it is light, so a text color token on ${part} never reaches it; ${fixed ? `set --color-on-${sides[0]} on ${part} instead (its surface is always ${sides[0]})` : `set its color on ${part} instead`}.`,
|
|
3272
3344
|
{
|
|
3273
|
-
// (The flags the command was given carry over: a
|
|
3345
|
+
// (The flags the command was given carry over: a variant; a mode
|
|
3346
|
+
// too, except on a surface that draws one side in both modes.)
|
|
3274
3347
|
run: [
|
|
3275
|
-
`${P} set ${slug} color ${quoteCommandArgument(v)} --on ${s.on ?? part}${s.when ? ` --when ${s.when}` : ''}${s.mode ? ` --mode ${s.mode}` : ''}${s.only ? ' --only' : ''}`,
|
|
3348
|
+
`${P} set ${slug} ${fixed ? `--color-on-${sides[0]}` : 'color'} ${quoteCommandArgument(v)} --on ${s.on ?? part}${s.when ? ` --when ${s.when}` : ''}${s.mode && !fixed ? ` --mode ${s.mode}` : ''}${s.only ? ' --only' : ''}`,
|
|
3276
3349
|
],
|
|
3277
3350
|
},
|
|
3278
3351
|
);
|
|
@@ -3464,6 +3537,29 @@ export function stateSynonym(word, states) {
|
|
|
3464
3537
|
);
|
|
3465
3538
|
}
|
|
3466
3539
|
|
|
3540
|
+
/**
|
|
3541
|
+
* The part's state a negated state word denies (`unpressed`, `not-pressed`,
|
|
3542
|
+
* `non-selected`), or null: the word names the part when it is NOT in that
|
|
3543
|
+
* state, its rest look, which a setting with no --state gives. Never a
|
|
3544
|
+
* reading as the state itself (the opposite of what was asked). A word the
|
|
3545
|
+
* synonym table reads (inactive) keeps that reading.
|
|
3546
|
+
* @param {string} state
|
|
3547
|
+
* @param {string[]} states
|
|
3548
|
+
* @returns {string | null}
|
|
3549
|
+
*/
|
|
3550
|
+
function negatedState(state, states) {
|
|
3551
|
+
const w = state.toLowerCase();
|
|
3552
|
+
if (STATE_SYNONYMS[w]) return null;
|
|
3553
|
+
const m = /^(?:un|non-?|not-?)([a-z][a-z-]*)$/.exec(w);
|
|
3554
|
+
if (!m) return null;
|
|
3555
|
+
const denied = m[1];
|
|
3556
|
+
return (
|
|
3557
|
+
sameState(denied, states) ??
|
|
3558
|
+
(STATE_SYNONYMS[denied] ?? []).find(x => states.includes(x)) ??
|
|
3559
|
+
null
|
|
3560
|
+
);
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3467
3563
|
/**
|
|
3468
3564
|
* The state a typed one means among those a part (or a group's members)
|
|
3469
3565
|
* has: another word for one, else the nearest; null when none is near.
|
|
@@ -4212,7 +4308,9 @@ export function checkSetting(
|
|
|
4212
4308
|
* @param {Record<string, unknown>} TOKENS
|
|
4213
4309
|
*/
|
|
4214
4310
|
function fallbackVarTypo(v, TOKENS) {
|
|
4215
|
-
for (const [, name] of v.matchAll(
|
|
4311
|
+
for (const [, name] of v.matchAll(
|
|
4312
|
+
new RegExp(String.raw`var\(\s*(${CUSTOM_PROPERTY})\s*,`, 'gi'),
|
|
4313
|
+
)) {
|
|
4216
4314
|
if (name in TOKENS || name.startsWith('--_')) continue;
|
|
4217
4315
|
const near = nearest(name, Object.keys(TOKENS)).filter(n =>
|
|
4218
4316
|
typoNear(name, n),
|
|
@@ -4373,7 +4471,14 @@ function checkOne(
|
|
|
4373
4471
|
],
|
|
4374
4472
|
});
|
|
4375
4473
|
if (flags.on) s.on = flags.on.trim();
|
|
4376
|
-
|
|
4474
|
+
// (Several conditions in one order, by prop, so an undo or a change
|
|
4475
|
+
// later finds them whatever order they were typed in.)
|
|
4476
|
+
if (flags.when)
|
|
4477
|
+
s.when = flags.when
|
|
4478
|
+
.trim()
|
|
4479
|
+
.split(/\s*\+\s*/)
|
|
4480
|
+
.sort()
|
|
4481
|
+
.join('+');
|
|
4377
4482
|
// A state in any case or spelling of its words (focusVisible,
|
|
4378
4483
|
// focus_visible, 'focus visible') is the state, written as CSS writes it.
|
|
4379
4484
|
if (flags.state) s.state = stateSpelling(flags.state);
|
|
@@ -4711,49 +4816,79 @@ function checkOne(
|
|
|
4711
4816
|
if (s.when) {
|
|
4712
4817
|
const variants = C.variantValues(s.on);
|
|
4713
4818
|
const conditions = Object.keys(variants);
|
|
4714
|
-
|
|
4715
|
-
//
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4819
|
+
// Several conditions, one per prop (`variant:ghost+size:sm`): each is
|
|
4820
|
+
// checked as one alone is, and a line that fixes one keeps the rest.
|
|
4821
|
+
const pieces = String(s.when).split('+');
|
|
4822
|
+
/** @param {number} i @param {string} w */
|
|
4823
|
+
const withPiece = (i, w) =>
|
|
4824
|
+
pieces.map((x, j) => (j === i ? w : x)).join('+');
|
|
4825
|
+
const seenProps = new Set();
|
|
4826
|
+
for (const [i, when] of pieces.entries()) {
|
|
4827
|
+
const reading = whenReading(when, t.props, variants);
|
|
4828
|
+
// A prop and value in other letters, with spaces or `=` between
|
|
4829
|
+
// (`Variant: Primary`, `variant=primary`): the working command.
|
|
4830
|
+
if (reading.written)
|
|
4831
|
+
refuse(
|
|
4832
|
+
E.ERR_THEME_UNKNOWN_VARIANT,
|
|
4833
|
+
`--when "${when}" is written ${reading.written}.`,
|
|
4834
|
+
{
|
|
4835
|
+
didYouMean: [withPiece(i, reading.written)],
|
|
4836
|
+
run: [
|
|
4837
|
+
setLine(
|
|
4838
|
+
slug,
|
|
4839
|
+
thing,
|
|
4840
|
+
v,
|
|
4841
|
+
{...s, when: withPiece(i, reading.written)},
|
|
4842
|
+
unset,
|
|
4843
|
+
),
|
|
4844
|
+
],
|
|
4845
|
+
},
|
|
4846
|
+
);
|
|
4847
|
+
const [p, wv, ...more] = when.split(':');
|
|
4848
|
+
if (!wv || more.length)
|
|
4849
|
+
refuse(
|
|
4850
|
+
E.ERR_THEME_BAD_VALUE,
|
|
4851
|
+
'--when takes <prop>:<value>, such as variant:primary.',
|
|
4852
|
+
{run: [`${HOW} ${s.on}`]},
|
|
4853
|
+
);
|
|
4854
|
+
if (seenProps.has(p))
|
|
4855
|
+
refuse(
|
|
4856
|
+
E.ERR_THEME_BAD_VALUE,
|
|
4857
|
+
`--when names ${p} twice (${s.when}); a part has one ${p} at a time.`,
|
|
4858
|
+
{run: [`${HOW} ${s.on}`]},
|
|
4859
|
+
);
|
|
4860
|
+
seenProps.add(p);
|
|
4861
|
+
const whenRun = reading.meant
|
|
4862
|
+
? [
|
|
4863
|
+
setLine(
|
|
4864
|
+
slug,
|
|
4865
|
+
thing,
|
|
4866
|
+
v,
|
|
4867
|
+
{...s, when: withPiece(i, reading.meant)},
|
|
4868
|
+
unset,
|
|
4869
|
+
),
|
|
4870
|
+
]
|
|
4871
|
+
: [];
|
|
4872
|
+
if (!t.props.includes(p) && !conditions.includes(p))
|
|
4873
|
+
refuse(
|
|
4874
|
+
E.ERR_THEME_UNKNOWN_VARIANT,
|
|
4875
|
+
`${s.on} has no prop "${p}". It has: ${t.props.join(', ') || 'none'}.`,
|
|
4876
|
+
{
|
|
4877
|
+
didYouMean: nearest(p, t.props),
|
|
4878
|
+
run: [...whenRun, `${HOW} ${s.on}`],
|
|
4879
|
+
},
|
|
4880
|
+
);
|
|
4881
|
+
const vals = variants[p] ?? [];
|
|
4882
|
+
if (vals.length && !vals.includes(wv))
|
|
4883
|
+
refuse(
|
|
4884
|
+
E.ERR_THEME_UNKNOWN_VARIANT,
|
|
4885
|
+
`${s.on} has no ${p} "${wv}". ${p} is one of: ${vals.join(', ')}.`,
|
|
4886
|
+
{
|
|
4887
|
+
didYouMean: nearest(wv, vals),
|
|
4888
|
+
run: [...whenRun, `${HOW} ${s.on}`],
|
|
4889
|
+
},
|
|
4890
|
+
);
|
|
4891
|
+
}
|
|
4757
4892
|
}
|
|
4758
4893
|
const states = partStates(ctx, s.on);
|
|
4759
4894
|
// A state the part lists in camelCase (toggle-button's isPressed) typed
|
|
@@ -4801,6 +4936,18 @@ function checkOne(
|
|
|
4801
4936
|
.map(state => setLine(slug, thing, v, {...s, state}, unset)),
|
|
4802
4937
|
},
|
|
4803
4938
|
);
|
|
4939
|
+
// A negated state (`unpressed`) is the part at rest: the same line with
|
|
4940
|
+
// no --state, never the state it denies.
|
|
4941
|
+
const denied =
|
|
4942
|
+
s.state && !statesHold(states, s.state)
|
|
4943
|
+
? negatedState(s.state, states)
|
|
4944
|
+
: null;
|
|
4945
|
+
if (denied)
|
|
4946
|
+
refuse(
|
|
4947
|
+
E.ERR_THEME_UNKNOWN_STATE,
|
|
4948
|
+
`"${s.state}" is not a state of ${s.on}: it names ${s.on} when it is not ${denied}, its rest look, which a setting with no --state gives.`,
|
|
4949
|
+
{run: [setLine(slug, thing, v, {...s, state: undefined}, unset)]},
|
|
4950
|
+
);
|
|
4804
4951
|
if (s.state && !statesHold(states, s.state))
|
|
4805
4952
|
refuse(
|
|
4806
4953
|
E.ERR_THEME_UNKNOWN_STATE,
|
|
@@ -4815,6 +4962,82 @@ function checkOne(
|
|
|
4815
4962
|
},
|
|
4816
4963
|
);
|
|
4817
4964
|
}
|
|
4965
|
+
{
|
|
4966
|
+
// A fill or text color a part's own element never declares, which an
|
|
4967
|
+
// element inside it paints from a token (a keyboard key's chip, a list
|
|
4968
|
+
// item's label text): the property set on the part is painted over
|
|
4969
|
+
// there, so it would never show. The token, set on the part, reaches the inner element.
|
|
4970
|
+
const prop = String(s.thing);
|
|
4971
|
+
if (
|
|
4972
|
+
!unset &&
|
|
4973
|
+
s.on &&
|
|
4974
|
+
!String(s.thing).startsWith('--') &&
|
|
4975
|
+
!FAMILIES[s.on] &&
|
|
4976
|
+
/^(background(-color)?|color)$/.test(prop)
|
|
4977
|
+
) {
|
|
4978
|
+
const rec = ctx.C.MAP[s.on];
|
|
4979
|
+
const props =
|
|
4980
|
+
prop === 'background' || prop === 'background-color'
|
|
4981
|
+
? ['background', 'background-color']
|
|
4982
|
+
: [prop];
|
|
4983
|
+
const innerToks = Object.entries(rec?.inside ?? {})
|
|
4984
|
+
.filter(([, ps]) =>
|
|
4985
|
+
/** @type {string[]} */ (ps).some(x => props.includes(x)),
|
|
4986
|
+
)
|
|
4987
|
+
.map(([t]) => t)
|
|
4988
|
+
.filter(t => /^--color-/.test(t));
|
|
4989
|
+
// (A media surface inside a part, a toast's, sets the text tokens of
|
|
4990
|
+
// what it holds from the color set on the part: never painted over.)
|
|
4991
|
+
if (
|
|
4992
|
+
rec &&
|
|
4993
|
+
!rec.media &&
|
|
4994
|
+
innerToks.length &&
|
|
4995
|
+
!props.some(x => rec.own?.[x]) &&
|
|
4996
|
+
!(rec.line ?? []).some((/** @type {string} */ x) => props.includes(x))
|
|
4997
|
+
)
|
|
4998
|
+
refuse(
|
|
4999
|
+
E.ERR_THEME_NO_EFFECT,
|
|
5000
|
+
`${s.on} draws no ${prop} of its own: an element inside it paints it from ${innerToks.join(', ')}, which paints over a ${prop} set on ${s.on}, so it would never show.`,
|
|
5001
|
+
{
|
|
5002
|
+
run: innerToks
|
|
5003
|
+
.slice(0, 2)
|
|
5004
|
+
.map(t => setLine(slug, t, v, {...s, only: undefined}, unset)),
|
|
5005
|
+
},
|
|
5006
|
+
);
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
// A part drawn under an invisible native input (a checkbox's box, a
|
|
5010
|
+
// switch): the input takes the pointer and the focus, so a hover, press
|
|
5011
|
+
// or focus state on the part's own element never applies. Named with the
|
|
5012
|
+
// part that holds the input, where those states land.
|
|
5013
|
+
if (
|
|
5014
|
+
!unset &&
|
|
5015
|
+
s.on &&
|
|
5016
|
+
/^(hover|active|focus|focus-visible|focus-within)$/.test(String(s.state))
|
|
5017
|
+
) {
|
|
5018
|
+
const all = partsOf(ctx, s);
|
|
5019
|
+
const under = all.filter(t => ctx.C.MAP[t]?.underInput != null);
|
|
5020
|
+
if (under.length && under.length === all.length) {
|
|
5021
|
+
const holders = [
|
|
5022
|
+
...new Set(under.map(t => ctx.C.MAP[t]?.underInput).filter(Boolean)),
|
|
5023
|
+
];
|
|
5024
|
+
refuse(
|
|
5025
|
+
E.ERR_THEME_NO_EFFECT,
|
|
5026
|
+
`${under.join(', ')} ${under.length > 1 ? 'are' : 'is'} drawn under an invisible input that takes the pointer and the focus, so --state ${s.state} on ${under.length > 1 ? 'them' : 'it'} would never apply${holders.length ? `; the input is inside ${holders.join(', ')}, where ${s.state} lands` : ''}.`,
|
|
5027
|
+
{
|
|
5028
|
+
// (A token: set on the part with no state, it is what Core reads
|
|
5029
|
+
// when it paints that state from the input, the focus ring's
|
|
5030
|
+
// color or the hover tint; a property would paint at rest.)
|
|
5031
|
+
run: [
|
|
5032
|
+
...(String(thing).startsWith('--')
|
|
5033
|
+
? [setLine(slug, thing, v, {...s, state: undefined}, unset)]
|
|
5034
|
+
: []),
|
|
5035
|
+
`${HOW} ${quoteCommandArgument(String(s.on))}`,
|
|
5036
|
+
],
|
|
5037
|
+
},
|
|
5038
|
+
);
|
|
5039
|
+
}
|
|
5040
|
+
}
|
|
4818
5041
|
// A part whose styled element is a wrapper (a text input's box) shows
|
|
4819
5042
|
// focus only through focus-within: focus or focus-visible there would
|
|
4820
5043
|
// never apply. Named the way `how` names it.
|
|
@@ -5013,17 +5236,22 @@ function checkOne(
|
|
|
5013
5236
|
variants[k] = [...new Set([...(variants[k] ?? []), ...vals])];
|
|
5014
5237
|
const states = [...new Set(members.flatMap(([m]) => partStates(ctx, m)))];
|
|
5015
5238
|
if (s.when) {
|
|
5016
|
-
|
|
5017
|
-
const fits = members.some(([m, t]) =>
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5239
|
+
// (Several conditions: a member that has every one.)
|
|
5240
|
+
const fits = members.some(([m, t]) =>
|
|
5241
|
+
String(s.when)
|
|
5242
|
+
.split('+')
|
|
5243
|
+
.every(w => {
|
|
5244
|
+
const [p, wv, ...more] = w.split(':');
|
|
5245
|
+
if (
|
|
5246
|
+
!wv ||
|
|
5247
|
+
more.length ||
|
|
5248
|
+
!(t.props.includes(p) || p in C.variantValues(m))
|
|
5249
|
+
)
|
|
5250
|
+
return false;
|
|
5251
|
+
const vals = C.variantValues(m)[p] ?? [];
|
|
5252
|
+
return !vals.length || vals.includes(wv);
|
|
5253
|
+
}),
|
|
5254
|
+
);
|
|
5027
5255
|
if (!fits) {
|
|
5028
5256
|
const reading = whenReading(s.when, props, variants);
|
|
5029
5257
|
const when = reading.written ?? reading.meant;
|
|
@@ -5047,6 +5275,13 @@ function checkOne(
|
|
|
5047
5275
|
state &&
|
|
5048
5276
|
!members.some(([m]) => statesHold(partStates(ctx, m), state))
|
|
5049
5277
|
) {
|
|
5278
|
+
const denied = negatedState(state, states);
|
|
5279
|
+
if (denied)
|
|
5280
|
+
refuse(
|
|
5281
|
+
E.ERR_THEME_UNKNOWN_STATE,
|
|
5282
|
+
`"${s.state}" is not a state of the ${s.on} group: it names its members when they are not ${denied}, their rest look, which a setting with no --state gives.`,
|
|
5283
|
+
{run: [setLine(slug, thing, v, {...s, state: undefined}, unset)]},
|
|
5284
|
+
);
|
|
5050
5285
|
const meant = stateMeant(state, states);
|
|
5051
5286
|
refuse(
|
|
5052
5287
|
E.ERR_THEME_UNKNOWN_STATE,
|
|
@@ -5659,7 +5894,20 @@ function checkOne(
|
|
|
5659
5894
|
// mean (rounded-none and not round are square, rounded-full is
|
|
5660
5895
|
// pill, rounded-[12px] is 12px).
|
|
5661
5896
|
const tw = /^rounded-\[(.+)\]$/.exec(lower)?.[1];
|
|
5897
|
+
// A rung said as an English word made from it (`rounded` is
|
|
5898
|
+
// round, `squared` square) is that rung, ahead of Tailwind's
|
|
5899
|
+
// class of the same letters (its `rounded` is 4px, which on most
|
|
5900
|
+
// bases is sharper than asked).
|
|
5901
|
+
const rung = CORNERS.map(([n]) => n).find(
|
|
5902
|
+
n => lower === `${n}ed` || lower === `${n}d`,
|
|
5903
|
+
);
|
|
5904
|
+
// Tailwind's own size for those letters is offered after it.
|
|
5905
|
+
const tailwindToo =
|
|
5906
|
+
rung && TAILWIND_RADIUS[lower] && TAILWIND_RADIUS[lower] !== rung
|
|
5907
|
+
? TAILWIND_RADIUS[lower]
|
|
5908
|
+
: null;
|
|
5662
5909
|
const opposite =
|
|
5910
|
+
rung ??
|
|
5663
5911
|
TAILWIND_RADIUS[lower] ??
|
|
5664
5912
|
(tw && lengthPx(tw) != null
|
|
5665
5913
|
? `${Math.round(Number(lengthPx(tw)) * 100) / 100}px`
|
|
@@ -5685,7 +5933,7 @@ function checkOne(
|
|
|
5685
5933
|
)[0] ?? null));
|
|
5686
5934
|
refuse(
|
|
5687
5935
|
E.ERR_THEME_BAD_VALUE,
|
|
5688
|
-
`corners takes ${DIALS.corners.values}, not "${v}"${bareNumber ? ' (a number needs its unit: px or rem)' : ''}.`,
|
|
5936
|
+
`corners takes ${DIALS.corners.values}, not "${v}"${bareNumber ? ' (a number needs its unit: px or rem)' : ''}${tailwindToo ? ` ("${v}" reads as ${rung}; Tailwind's ${lower} class is ${tailwindToo})` : ''}.`,
|
|
5689
5937
|
{
|
|
5690
5938
|
...(meant ? {didYouMean: [meant]} : {}),
|
|
5691
5939
|
// The same scope, flags included.
|
|
@@ -5704,6 +5952,9 @@ function checkOne(
|
|
|
5704
5952
|
meant
|
|
5705
5953
|
? setLine(slug, 'corners', meant, s)
|
|
5706
5954
|
: `${HOW} corners`,
|
|
5955
|
+
...(tailwindToo
|
|
5956
|
+
? [setLine(slug, 'corners', tailwindToo, s)]
|
|
5957
|
+
: []),
|
|
5707
5958
|
],
|
|
5708
5959
|
},
|
|
5709
5960
|
);
|
|
@@ -6751,9 +7002,17 @@ function checkOne(
|
|
|
6751
7002
|
: [];
|
|
6752
7003
|
})(),
|
|
6753
7004
|
...(v && WHOLE_THEME_EQUIVALENT[prop]
|
|
6754
|
-
?
|
|
6755
|
-
|
|
6756
|
-
|
|
7005
|
+
? (() => {
|
|
7006
|
+
const token = WHOLE_THEME_EQUIVALENT[prop];
|
|
7007
|
+
// A page or text color the theme shows in one mode only
|
|
7008
|
+
// (a dark page in a theme with both modes) is offered for
|
|
7009
|
+
// that mode first: the same color in both would leave the
|
|
7010
|
+
// other unreadable, as `how` answers it.
|
|
7011
|
+
const mode = modeColorBelongs(ctx, data, token, v);
|
|
7012
|
+
const line = (/** @type {string} */ m) =>
|
|
7013
|
+
`${P} set ${slug} ${token} ${quoteCommandArgument(v)}${m ? ` --mode ${m}` : ''}`;
|
|
7014
|
+
return mode ? [line(mode), line('')] : [line('')];
|
|
7015
|
+
})()
|
|
6757
7016
|
: []),
|
|
6758
7017
|
`${HOW} ${quoteCommandArgument(prop)}`,
|
|
6759
7018
|
],
|
|
@@ -7088,7 +7347,7 @@ function checkOne(
|
|
|
7088
7347
|
if (!isSafeValue(v))
|
|
7089
7348
|
refuse(
|
|
7090
7349
|
E.ERR_THEME_BAD_VALUE,
|
|
7091
|
-
`"${v}" cannot be a CSS value:
|
|
7350
|
+
`"${v}" cannot be a CSS value: ${UNSAFE_VALUE}.`,
|
|
7092
7351
|
{
|
|
7093
7352
|
// The value without its copy debris, when that is one.
|
|
7094
7353
|
run: [
|
|
@@ -7364,7 +7623,54 @@ function checkOne(
|
|
|
7364
7623
|
],
|
|
7365
7624
|
},
|
|
7366
7625
|
);
|
|
7367
|
-
|
|
7626
|
+
// A word people write for a dial, read the way the dial's own words are:
|
|
7627
|
+
// with `-color`/`-colour` after it (primary-color), in the plural
|
|
7628
|
+
// (shadows), and the words for a mode or a flat surface, which name a
|
|
7629
|
+
// dial with a value of their own.
|
|
7630
|
+
const aliasesOf = (/** @type {string} */ w) => {
|
|
7631
|
+
if (DIALS[w]) return [w];
|
|
7632
|
+
const found = COLOR_DIAL_WORDS.get(w);
|
|
7633
|
+
if (found) return found;
|
|
7634
|
+
const bare = w.replace(/[-_ ]?colou?r$/, '');
|
|
7635
|
+
if (bare !== w && (DIALS[bare] || COLOR_DIAL_WORDS.get(bare)))
|
|
7636
|
+
return DIALS[bare] ? [bare] : (COLOR_DIAL_WORDS.get(bare) ?? []);
|
|
7637
|
+
const singular = w.replace(/e?s$/, '');
|
|
7638
|
+
if (singular !== w && (DIALS[singular] || COLOR_DIAL_WORDS.get(singular)))
|
|
7639
|
+
return DIALS[singular]
|
|
7640
|
+
? [singular]
|
|
7641
|
+
: (COLOR_DIAL_WORDS.get(singular) ?? []);
|
|
7642
|
+
return [];
|
|
7643
|
+
};
|
|
7644
|
+
const aliases = aliasesOf(lower);
|
|
7645
|
+
// A word that names a dial AND the value it asks for (`shadows none` is
|
|
7646
|
+
// `surfaces flat`, `dark-mode true` is `mode dark-only`): that command.
|
|
7647
|
+
const asDialValue = (() => {
|
|
7648
|
+
const word = lower.replace(/[-_ ]?(?:colou?r|mode)$/, '') || lower;
|
|
7649
|
+
const off = /^(none|off|no|0|false|flat)$/.test(
|
|
7650
|
+
String(v).trim().toLowerCase(),
|
|
7651
|
+
);
|
|
7652
|
+
const on = /^(true|yes|on|1)$/.test(String(v).trim().toLowerCase());
|
|
7653
|
+
if (/^(shadows?|elevation)$/.test(word) && off)
|
|
7654
|
+
return {dial: 'surfaces', value: 'flat'};
|
|
7655
|
+
if (/^(dark|darkmode)$/.test(word) && on)
|
|
7656
|
+
return {dial: 'mode', value: 'dark-only'};
|
|
7657
|
+
if (/^(light|lightmode)$/.test(word) && on)
|
|
7658
|
+
return {dial: 'mode', value: 'light-only'};
|
|
7659
|
+
return null;
|
|
7660
|
+
})();
|
|
7661
|
+
if (!hint && !aliases.length && asDialValue && DIALS[asDialValue.dial])
|
|
7662
|
+
return refuse(
|
|
7663
|
+
E.ERR_THEME_UNKNOWN_THING,
|
|
7664
|
+
`"${thing}" is not a dial, a token, or a CSS property. ${asDialValue.dial} ${asDialValue.value} does that.`,
|
|
7665
|
+
{
|
|
7666
|
+
didYouMean: [asDialValue.dial],
|
|
7667
|
+
run: [
|
|
7668
|
+
unset
|
|
7669
|
+
? `${P} undo ${slug} ${asDialValue.dial}`
|
|
7670
|
+
: `${P} set ${slug} ${asDialValue.dial} ${asDialValue.value}`,
|
|
7671
|
+
],
|
|
7672
|
+
},
|
|
7673
|
+
);
|
|
7368
7674
|
if (!hint && aliases.length)
|
|
7369
7675
|
return refuse(
|
|
7370
7676
|
E.ERR_THEME_UNKNOWN_THING,
|
|
@@ -7581,7 +7887,10 @@ function tokenKindMismatch(ctx, prop, v) {
|
|
|
7581
7887
|
// `var(--x)px`) is wrong around the token, never for the token's kind.
|
|
7582
7888
|
if (!matchValue(prop, v)) return null;
|
|
7583
7889
|
for (const ref of varReferences(v)) {
|
|
7584
|
-
const m =
|
|
7890
|
+
const m = new RegExp(
|
|
7891
|
+
String.raw`^var\(\s*(${CUSTOM_PROPERTY})\s*(?:,[^()]*)?\)$`,
|
|
7892
|
+
'i',
|
|
7893
|
+
).exec(ref.text);
|
|
7585
7894
|
if (!m) continue;
|
|
7586
7895
|
const token = m[1];
|
|
7587
7896
|
if (!ctx.C.isToken(token)) continue;
|
|
@@ -7650,7 +7959,12 @@ export function unknownVarRef(v, TOKENS, thing, reads) {
|
|
|
7650
7959
|
// it. Named with the repaired form when there is one.
|
|
7651
7960
|
for (const m of v.matchAll(/var\(\s*([^,)]*?)\s*(?=[,)]|$)/gi)) {
|
|
7652
7961
|
const raw = m[1];
|
|
7653
|
-
|
|
7962
|
+
// A name after the dashes, as CSS reads one (`--café` included).
|
|
7963
|
+
if (
|
|
7964
|
+
new RegExp(String.raw`^${CUSTOM_PROPERTY}$`).test(raw) &&
|
|
7965
|
+
!raw.startsWith('---')
|
|
7966
|
+
)
|
|
7967
|
+
continue;
|
|
7654
7968
|
const bare = raw.replace(/^-+/, '');
|
|
7655
7969
|
const repaired = /^[a-z0-9][a-z0-9_-]*$/i.test(bare) ? `--${bare}` : null;
|
|
7656
7970
|
return {
|
|
@@ -7663,7 +7977,7 @@ export function unknownVarRef(v, TOKENS, thing, reads) {
|
|
|
7663
7977
|
};
|
|
7664
7978
|
}
|
|
7665
7979
|
for (const [ref, name, comma] of v.matchAll(
|
|
7666
|
-
|
|
7980
|
+
new RegExp(String.raw`var\(\s*(${CUSTOM_PROPERTY})\s*(,)?`, 'gi'),
|
|
7667
7981
|
)) {
|
|
7668
7982
|
if (name in TOKENS || name.startsWith('--_') || reads?.has(name)) continue;
|
|
7669
7983
|
// A fallback always gives a value: never "reads nothing" (a likely
|