@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
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import {babelParse as parseModule} from '../../../foundation/runtime/lazy-dependencies.mjs';
|
|
18
18
|
import {levenshteinDistance} from '../../../foundation/text/levenshtein.mjs';
|
|
19
19
|
import {sourcePlugins} from './source-syntax.mjs';
|
|
20
|
+
import {UNREAD} from './typography-values.mjs';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* The fields Core's `defineTheme()` input takes, read from the type
|
|
@@ -528,39 +529,129 @@ export function sourceFieldProblems(entry, fields, load) {
|
|
|
528
529
|
}
|
|
529
530
|
|
|
530
531
|
/**
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
532
|
+
* Each field the loaded theme input holds that Core's theme input does not
|
|
533
|
+
* take, by its key path, as {@link sourceFieldProblems} words it: the input
|
|
534
|
+
* the build hands defineTheme, whatever expression in the source made it (a
|
|
535
|
+
* member, an array element, a call's result). A key with two underscores
|
|
536
|
+
* (`__onDark`) is the theme's own data, not a field.
|
|
537
|
+
* @param {any} input the theme input as loaded
|
|
538
|
+
* @param {InputFields} fields
|
|
539
|
+
* @returns {Array<{path: string[], why: string}>}
|
|
540
|
+
*/
|
|
541
|
+
export function inputFieldProblems(input, fields) {
|
|
542
|
+
/** @type {Array<{path: string[], why: string}>} */
|
|
543
|
+
const out = [];
|
|
544
|
+
const did = (/** @type {string | null} */ near) =>
|
|
545
|
+
near ? `; did you mean ${near}?` : '';
|
|
546
|
+
/** @param {any} value */
|
|
547
|
+
const block = value =>
|
|
548
|
+
value && typeof value === 'object' && !Array.isArray(value) ? value : null;
|
|
549
|
+
/**
|
|
550
|
+
* @param {any} object
|
|
551
|
+
* @param {string[]} at
|
|
552
|
+
* @param {string[]} takes
|
|
553
|
+
* @param {(k: string, near: string | null) => string} why
|
|
554
|
+
*/
|
|
555
|
+
const check = (object, at, takes, why) => {
|
|
556
|
+
for (const k of Object.keys(object)) {
|
|
557
|
+
if (k.startsWith('__') || takes.includes(k)) continue;
|
|
558
|
+
out.push({path: [...at, k], why: why(k, nearField(k, takes))});
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
const top = block(input);
|
|
562
|
+
if (!top) return out;
|
|
563
|
+
check(
|
|
564
|
+
top,
|
|
565
|
+
[],
|
|
566
|
+
fields.theme,
|
|
567
|
+
(k, near) =>
|
|
568
|
+
`${k} is no field defineTheme takes, so the build reads nothing from it${did(near)}`,
|
|
569
|
+
);
|
|
570
|
+
for (const surface of ['onDark', 'onLight']) {
|
|
571
|
+
const value = block(top[surface]);
|
|
572
|
+
if (value)
|
|
573
|
+
check(
|
|
574
|
+
value,
|
|
575
|
+
[surface],
|
|
576
|
+
fields.surface,
|
|
577
|
+
(k, near) =>
|
|
578
|
+
`${k} is no field ${surface} takes, so the build reads nothing from it${did(near)}`,
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
const typography = block(top.typography);
|
|
582
|
+
if (!typography) return out;
|
|
583
|
+
check(
|
|
584
|
+
typography,
|
|
585
|
+
['typography'],
|
|
586
|
+
fields.typography,
|
|
587
|
+
(k, near) =>
|
|
588
|
+
`${k} is no field typography takes (${fields.typography.join(', ')}), so Core builds nothing from it${did(near)}`,
|
|
589
|
+
);
|
|
590
|
+
for (const role of Object.keys(typography)) {
|
|
591
|
+
if (!fields.typography.includes(role)) continue;
|
|
592
|
+
const value = block(typography[role]);
|
|
593
|
+
const takes = role === 'scale' ? fields.scale : fields.role;
|
|
594
|
+
if (!value || !takes.length) continue;
|
|
595
|
+
check(
|
|
596
|
+
value,
|
|
597
|
+
['typography', role],
|
|
598
|
+
takes,
|
|
599
|
+
(k, near) =>
|
|
600
|
+
`${k} is no field typography.${role} takes (${takes.join(', ')}), so Core builds nothing from it${did(near)}`,
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
return out;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* A theme source's typography as the plain values it writes: text,
|
|
608
|
+
* numbers (signed too) and arrays, in nested blocks, followed through the consts of the
|
|
609
|
+
* theme file. A value written as anything else (a call, a name from another
|
|
610
|
+
* module) is UNREAD, and a block with a spread of one is marked UNREAD, so
|
|
611
|
+
* a judge never reads it as missing. Null when the source writes none.
|
|
535
612
|
* @param {string} source
|
|
536
613
|
* @param {string} [file] the source's file name, which says whether it is
|
|
537
614
|
* read with JSX
|
|
538
|
-
* @returns {
|
|
615
|
+
* @returns {unknown}
|
|
539
616
|
*/
|
|
540
617
|
export function sourceTypography(source, file = '') {
|
|
541
618
|
const {inputs, objectOf} = themeInputs({file, source}, () => null);
|
|
542
619
|
/** @param {any} node @param {any} mod @returns {any} */
|
|
543
620
|
const plain = (node, mod) => {
|
|
544
621
|
const n = unwrap(node);
|
|
545
|
-
if (!n) return
|
|
622
|
+
if (!n) return UNREAD;
|
|
546
623
|
if (n.type === 'StringLiteral' || n.type === 'NumericLiteral')
|
|
547
624
|
return n.value;
|
|
548
625
|
if (n.type === 'TemplateLiteral' && n.expressions.length === 0)
|
|
549
626
|
return n.quasis.map((/** @type {any} */ q) => q.value.cooked).join('');
|
|
627
|
+
// A signed number (-100, +500) is a number as written.
|
|
628
|
+
if (
|
|
629
|
+
n.type === 'UnaryExpression' &&
|
|
630
|
+
(n.operator === '-' || n.operator === '+') &&
|
|
631
|
+
unwrap(n.argument)?.type === 'NumericLiteral'
|
|
632
|
+
)
|
|
633
|
+
return (n.operator === '-' ? -1 : 1) * unwrap(n.argument).value;
|
|
634
|
+
if (n.type === 'ArrayExpression')
|
|
635
|
+
return n.elements.map((/** @type {any} */ e) =>
|
|
636
|
+
e?.type === 'SpreadElement' ? UNREAD : plain(e, mod),
|
|
637
|
+
);
|
|
550
638
|
const object = objectOf(n, mod);
|
|
551
|
-
if (!object) return
|
|
552
|
-
/** @type {Record<string, any>} */
|
|
639
|
+
if (!object) return UNREAD;
|
|
640
|
+
/** @type {Record<string | symbol, any>} */
|
|
553
641
|
const out = {};
|
|
554
642
|
for (const p of object.node.properties) {
|
|
555
643
|
if (p.type === 'SpreadElement') {
|
|
556
644
|
const spread = plain(p.argument, object.mod);
|
|
557
645
|
if (spread && typeof spread === 'object') Object.assign(out, spread);
|
|
646
|
+
else out[UNREAD] = true;
|
|
558
647
|
continue;
|
|
559
648
|
}
|
|
560
649
|
const k = keyOf(p);
|
|
561
|
-
if (k == null || p.type !== 'ObjectProperty')
|
|
562
|
-
|
|
563
|
-
|
|
650
|
+
if (k == null || p.type !== 'ObjectProperty') {
|
|
651
|
+
out[UNREAD] = true;
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
out[k] = plain(p.value, object.mod);
|
|
564
655
|
}
|
|
565
656
|
return out;
|
|
566
657
|
};
|
|
@@ -569,8 +660,8 @@ export function sourceTypography(source, file = '') {
|
|
|
569
660
|
(/** @type {any} */ x) =>
|
|
570
661
|
x.type === 'ObjectProperty' && keyOf(x) === 'typography',
|
|
571
662
|
);
|
|
572
|
-
const v = p ? plain(p.value, input.mod) :
|
|
573
|
-
if (v
|
|
663
|
+
const v = p ? plain(p.value, input.mod) : UNREAD;
|
|
664
|
+
if (v !== UNREAD) return v;
|
|
574
665
|
}
|
|
575
666
|
return null;
|
|
576
667
|
}
|
|
@@ -20,6 +20,19 @@ export function isHeadingLevel(key: string, levels: string[]): boolean;
|
|
|
20
20
|
* @returns {string | null}
|
|
21
21
|
*/
|
|
22
22
|
export function typographyValueProblem(key: string, value: unknown): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* The keys of a role's weights that name a level another key names too
|
|
25
|
+
* (`'01'` and `1`): Core keeps the one it reads last, so each other one
|
|
26
|
+
* builds nothing.
|
|
27
|
+
* @param {string} role
|
|
28
|
+
* @param {Record<string, unknown>} weights
|
|
29
|
+
* @param {string[]} levels
|
|
30
|
+
* @returns {Array<{key: string, why: string}>}
|
|
31
|
+
*/
|
|
32
|
+
export function levelDuplicates(role: string, weights: Record<string, unknown>, levels: string[]): Array<{
|
|
33
|
+
key: string;
|
|
34
|
+
why: string;
|
|
35
|
+
}>;
|
|
23
36
|
/**
|
|
24
37
|
* Every problem in a theme's own typography block, by its path: a field
|
|
25
38
|
* value (typographyValueProblem), a `weights` entry that is no heading
|
|
@@ -34,6 +47,15 @@ export function typographyInputProblems(typography: unknown, levels?: string[]):
|
|
|
34
47
|
why: string;
|
|
35
48
|
value: unknown;
|
|
36
49
|
}>;
|
|
50
|
+
/**
|
|
51
|
+
* A value the source writes that cannot be known without running it (a
|
|
52
|
+
* call, a name from another module). On a block, as a key, it marks a block
|
|
53
|
+
* the source reader could not read whole (a spread of such a value), so a
|
|
54
|
+
* field it lacks may still be given.
|
|
55
|
+
*/
|
|
56
|
+
export const UNREAD: unique symbol;
|
|
57
|
+
export function missingScaleFieldWhy(field: "base" | "ratio"): string;
|
|
58
|
+
export function typographyBlockWhy(value: unknown): string;
|
|
37
59
|
export function noLevelWhy(level: string, levels: string[], key: string): string;
|
|
38
60
|
export function noScaleWeightWhy(key: string, role: string, instead: string): string;
|
|
39
61
|
export function roleWeightTokens(role: string): string;
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* @input A theme's raw `typography` input; the heading levels Core's input
|
|
7
7
|
* types take.
|
|
8
8
|
* @output typographyValueProblem(): one field's problem; isHeadingLevel():
|
|
9
|
-
* a weights key as Core reads it;
|
|
10
|
-
*
|
|
9
|
+
* a weights key as Core reads it; levelDuplicates(): two keys for
|
|
10
|
+
* one level; missingScaleFieldWhy(), typographyBlockWhy(),
|
|
11
|
+
* noLevelWhy() and noScaleWeightWhy(): the block rules' reasons;
|
|
11
12
|
* typographyInputProblems(): every problem in a typography block.
|
|
12
13
|
* @position Shared by the editor, which refuses each problem, and by theme
|
|
13
14
|
* build, which warns it at its line: one judge for one file.
|
|
@@ -19,12 +20,50 @@
|
|
|
19
20
|
* number of pixels, whatever Number() would make of it.
|
|
20
21
|
* @param {unknown} value
|
|
21
22
|
*/
|
|
22
|
-
const scaleNumber = value =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const scaleNumber = value => {
|
|
24
|
+
const v = primitive(value);
|
|
25
|
+
return typeof v === 'number'
|
|
26
|
+
? v
|
|
27
|
+
: typeof v === 'string' && v.trim() !== ''
|
|
28
|
+
? Number(v)
|
|
27
29
|
: NaN;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A value as the build hands it to Core: a boxed primitive
|
|
34
|
+
* (`new Number(16)`) as its primitive, and a BigInt as its digits, which is
|
|
35
|
+
* how the build writes it.
|
|
36
|
+
* @param {unknown} value
|
|
37
|
+
* @returns {unknown}
|
|
38
|
+
*/
|
|
39
|
+
function primitive(value) {
|
|
40
|
+
if (
|
|
41
|
+
value instanceof Number ||
|
|
42
|
+
value instanceof String ||
|
|
43
|
+
value instanceof Boolean
|
|
44
|
+
)
|
|
45
|
+
return value.valueOf();
|
|
46
|
+
if (typeof value === 'bigint') return String(value);
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A value the source writes that cannot be known without running it (a
|
|
52
|
+
* call, a name from another module). On a block, as a key, it marks a block
|
|
53
|
+
* the source reader could not read whole (a spread of such a value), so a
|
|
54
|
+
* field it lacks may still be given.
|
|
55
|
+
*/
|
|
56
|
+
export const UNREAD = Symbol('unread');
|
|
57
|
+
|
|
58
|
+
/** Whether a block may hold fields the source reader could not see. @param {any} block */
|
|
59
|
+
const partial = block => Boolean(block?.[UNREAD]);
|
|
60
|
+
|
|
61
|
+
/** Whether a value is a plain block of fields. @param {unknown} value */
|
|
62
|
+
const isBlock = value =>
|
|
63
|
+
value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
64
|
+
|
|
65
|
+
/** The typography roles Core builds a font list and weights for. */
|
|
66
|
+
const ROLES = ['body', 'heading', 'code'];
|
|
28
67
|
|
|
29
68
|
/** A value as the source writes it. @param {unknown} value */
|
|
30
69
|
function describe(value) {
|
|
@@ -81,7 +120,9 @@ function nearWeightName(value) {
|
|
|
81
120
|
* @returns {string | null}
|
|
82
121
|
*/
|
|
83
122
|
function weightTextProblem(value) {
|
|
84
|
-
|
|
123
|
+
value = primitive(value);
|
|
124
|
+
if (typeof value !== 'string' || value === '' || isFontWeight(value))
|
|
125
|
+
return null;
|
|
85
126
|
const near = nearWeightName(value);
|
|
86
127
|
return `"${value.trim()}" is no font weight, so the browser drops the weight Core writes from it and the text keeps the weight around it: write a number from 1 to 1000 in quotes, ${CORE_WEIGHT_NAMES.join(', ')} (Core's weight names), or a weight token, such as ${near ? `'${near}'` : "'600'"}`;
|
|
87
128
|
}
|
|
@@ -109,11 +150,38 @@ export function isHeadingLevel(key, levels) {
|
|
|
109
150
|
* @returns {string | null}
|
|
110
151
|
*/
|
|
111
152
|
export function typographyValueProblem(key, value) {
|
|
112
|
-
|
|
153
|
+
value = primitive(value);
|
|
154
|
+
const parts = key.split('.');
|
|
155
|
+
const field = parts.at(-1);
|
|
156
|
+
// A role and the scale are blocks: Core reads their fields, so a plain
|
|
157
|
+
// value builds nothing (a role) or every size as NaNrem (a scale).
|
|
158
|
+
if (
|
|
159
|
+
parts.length === 1 &&
|
|
160
|
+
ROLES.includes(field ?? '') &&
|
|
161
|
+
value != null &&
|
|
162
|
+
!isBlock(value)
|
|
163
|
+
)
|
|
164
|
+
return `typography.${field} is a block of fields, such as ${field}: {family: 'Inter'}, and Core reads nothing from ${describe(value)}, so it builds nothing`;
|
|
165
|
+
if (parts.length === 1 && field === 'scale' && value && !isBlock(value))
|
|
166
|
+
return `typography.scale is a block of a base and a ratio, such as scale: {base: 16, ratio: 1.2}, and Core reads ${describe(value)} as one with neither, so it builds every font size as NaNrem, which no page can use`;
|
|
167
|
+
// A role's weights is a block of heading levels. Core reads any other
|
|
168
|
+
// value by its entries: a text's letters, or an array's places, become
|
|
169
|
+
// levels.
|
|
170
|
+
if (field === 'weights' && parts.length === 2) {
|
|
171
|
+
if (isBlock(value)) return null;
|
|
172
|
+
const reads =
|
|
173
|
+
typeof value === 'string' || Array.isArray(value)
|
|
174
|
+
? `reads ${describe(value)} by its ${typeof value === 'string' ? 'letters' : 'places'} as levels, which builds no weight you meant`
|
|
175
|
+
: `finds no levels in ${describe(value)}, so it builds nothing`;
|
|
176
|
+
return `typography.${key} takes a weight for each heading level, such as weights: {1: '800'}, and Core ${reads}; for one weight for every heading, use ${parts[0]}.weight`;
|
|
177
|
+
}
|
|
113
178
|
// A weight is typed as text. A number is a type mismatch: the theme's
|
|
114
179
|
// types refuse it, while Core still writes a weight from 1 to 1000 that
|
|
115
180
|
// the browser reads.
|
|
116
|
-
if (field === 'weight' ||
|
|
181
|
+
if (field === 'weight' || parts.includes('weights')) {
|
|
182
|
+
// Core skips an empty weight and keeps its own.
|
|
183
|
+
if (value === '' || value === 0 || value === false)
|
|
184
|
+
return `typography.${key} is empty, and Core skips an empty weight and keeps its default, so it builds nothing: give a weight, such as '600', or take it out`;
|
|
117
185
|
if (typeof value === 'number' && value >= 1 && value <= 1000)
|
|
118
186
|
return `a typography weight is text, and ${value} is a number: a type mismatch the theme's types refuse (Core still writes ${value}, which the browser reads as that weight); write '${value}' (or a weight token, such as 'var(--font-weight-bold)')`;
|
|
119
187
|
if (typeof value !== 'string')
|
|
@@ -163,6 +231,48 @@ export function typographyValueProblem(key, value) {
|
|
|
163
231
|
return null;
|
|
164
232
|
}
|
|
165
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Why a type scale with no base or no ratio builds no size a page can use.
|
|
236
|
+
* @param {'base' | 'ratio'} field
|
|
237
|
+
*/
|
|
238
|
+
export const missingScaleFieldWhy = field =>
|
|
239
|
+
`the type scale is given no ${field}, and Core reads the sizes from the base and the ratio together, so it builds every font size as NaNrem: add ${field === 'base' ? 'the body size in pixels, such as scale: {base: 16, ratio: …}' : 'the step between sizes, such as scale: {base: …, ratio: 1.2}'}`;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Why a typography that is no block builds nothing.
|
|
243
|
+
* @param {unknown} value
|
|
244
|
+
*/
|
|
245
|
+
export const typographyBlockWhy = value =>
|
|
246
|
+
`typography is a block of roles and a scale, such as typography: {body: {family: 'Inter'}}, and Core reads nothing from ${describe(primitive(value))}, so it builds nothing`;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The keys of a role's weights that name a level another key names too
|
|
250
|
+
* (`'01'` and `1`): Core keeps the one it reads last, so each other one
|
|
251
|
+
* builds nothing.
|
|
252
|
+
* @param {string} role
|
|
253
|
+
* @param {Record<string, unknown>} weights
|
|
254
|
+
* @param {string[]} levels
|
|
255
|
+
* @returns {Array<{key: string, why: string}>}
|
|
256
|
+
*/
|
|
257
|
+
export function levelDuplicates(role, weights, levels) {
|
|
258
|
+
/** @type {Map<number, string>} */
|
|
259
|
+
const at = new Map();
|
|
260
|
+
/** @type {Array<{key: string, why: string}>} */
|
|
261
|
+
const out = [];
|
|
262
|
+
for (const level of Object.keys(weights)) {
|
|
263
|
+
if (!isHeadingLevel(level, levels)) continue;
|
|
264
|
+
const n = Number(level.trim());
|
|
265
|
+
const before = at.get(n);
|
|
266
|
+
if (before !== undefined)
|
|
267
|
+
out.push({
|
|
268
|
+
key: before,
|
|
269
|
+
why: `${before} and ${level} are both heading level ${n}, and Core keeps the one it reads last (${level}), so typography.${role}.weights.${before} builds nothing: keep one`,
|
|
270
|
+
});
|
|
271
|
+
at.set(n, level);
|
|
272
|
+
}
|
|
273
|
+
return out;
|
|
274
|
+
}
|
|
275
|
+
|
|
166
276
|
/**
|
|
167
277
|
* Why a `weights` entry that is no heading level builds nothing.
|
|
168
278
|
* @param {string} level
|
|
@@ -202,20 +312,53 @@ export const roleWeightTokens = role =>
|
|
|
202
312
|
export function typographyInputProblems(typography, levels = []) {
|
|
203
313
|
/** @type {Array<{path: string[], why: string, value: unknown}>} */
|
|
204
314
|
const out = [];
|
|
205
|
-
if (
|
|
315
|
+
if (typography == null || typography === UNREAD) return out;
|
|
316
|
+
if (!isBlock(typography)) {
|
|
317
|
+
out.push({
|
|
318
|
+
path: ['typography'],
|
|
319
|
+
why: typographyBlockWhy(typography),
|
|
320
|
+
value: typography,
|
|
321
|
+
});
|
|
322
|
+
return out;
|
|
323
|
+
}
|
|
206
324
|
const t = /** @type {Record<string, any>} */ (typography);
|
|
325
|
+
const noScale = !t.scale && !partial(t);
|
|
326
|
+
/** Roles whose weights is no block: that is their reason. */
|
|
327
|
+
const shapeless = new Set();
|
|
207
328
|
for (const [block, fields] of Object.entries(t)) {
|
|
208
|
-
if (
|
|
329
|
+
if (fields === undefined || fields === UNREAD) continue;
|
|
330
|
+
if (!isBlock(fields)) {
|
|
331
|
+
const why = typographyValueProblem(block, fields);
|
|
332
|
+
if (why) out.push({path: ['typography', block], why, value: fields});
|
|
209
333
|
continue;
|
|
334
|
+
}
|
|
335
|
+
if (block === 'scale') {
|
|
336
|
+
const missing = /** @type {const} */ (['base', 'ratio']).find(
|
|
337
|
+
f => fields[f] === undefined,
|
|
338
|
+
);
|
|
339
|
+
if (missing && !partial(fields))
|
|
340
|
+
out.push({
|
|
341
|
+
path: ['typography', 'scale'],
|
|
342
|
+
why: missingScaleFieldWhy(missing),
|
|
343
|
+
value: fields,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
210
346
|
for (const [field, value] of Object.entries(fields)) {
|
|
211
|
-
if (value === undefined) continue;
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
347
|
+
if (value === undefined || value === UNREAD) continue;
|
|
348
|
+
if (field === 'weights' && !isBlock(primitive(value))) {
|
|
349
|
+
const why = typographyValueProblem(`${block}.weights`, value);
|
|
350
|
+
if (why) {
|
|
351
|
+
shapeless.add(block);
|
|
352
|
+
out.push({path: ['typography', block, 'weights'], why, value});
|
|
353
|
+
}
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
// Without a type scale Core writes no role weight: that reason is
|
|
357
|
+
// given below, for any weight.
|
|
358
|
+
if (noScale && (field === 'weight' || field === 'weights')) continue;
|
|
359
|
+
if (field === 'weights') {
|
|
218
360
|
for (const [level, w] of Object.entries(value)) {
|
|
361
|
+
if (w === UNREAD) continue;
|
|
219
362
|
const key = `${block}.weights.${level}`;
|
|
220
363
|
const why =
|
|
221
364
|
levels.length && !isHeadingLevel(level, levels)
|
|
@@ -228,6 +371,12 @@ export function typographyInputProblems(typography, levels = []) {
|
|
|
228
371
|
value: w,
|
|
229
372
|
});
|
|
230
373
|
}
|
|
374
|
+
for (const d of levelDuplicates(block, value, levels))
|
|
375
|
+
out.push({
|
|
376
|
+
path: ['typography', block, 'weights', d.key],
|
|
377
|
+
why: d.why,
|
|
378
|
+
value: value[d.key],
|
|
379
|
+
});
|
|
231
380
|
continue;
|
|
232
381
|
}
|
|
233
382
|
const why =
|
|
@@ -236,12 +385,13 @@ export function typographyInputProblems(typography, levels = []) {
|
|
|
236
385
|
if (why) out.push({path: ['typography', block, field], why, value});
|
|
237
386
|
}
|
|
238
387
|
}
|
|
239
|
-
if (
|
|
240
|
-
for (const role of
|
|
388
|
+
if (noScale)
|
|
389
|
+
for (const role of ROLES) {
|
|
241
390
|
const r = t[role];
|
|
242
|
-
if (!r
|
|
391
|
+
if (!isBlock(r)) continue;
|
|
243
392
|
for (const field of ['weight', 'weights']) {
|
|
244
393
|
if (r[field] === undefined) continue;
|
|
394
|
+
if (field === 'weights' && shapeless.has(role)) continue;
|
|
245
395
|
const key = `${role}.${field}`;
|
|
246
396
|
out.push({
|
|
247
397
|
path: ['typography', role, field],
|
|
@@ -60,6 +60,13 @@ export function writtenValueProblems(theme: Record<string, any>, options?: {
|
|
|
60
60
|
onLight?: Record<string, unknown>;
|
|
61
61
|
};
|
|
62
62
|
}): WrittenValueProblem[];
|
|
63
|
+
/**
|
|
64
|
+
* A custom property's name as CSS reads it: two dashes, then name
|
|
65
|
+
* characters (letters, digits, `_`, `-`, and any letter beyond ASCII, as in
|
|
66
|
+
* `--café`). The one pattern every var() reader here and in the editor
|
|
67
|
+
* builds on.
|
|
68
|
+
*/
|
|
69
|
+
export const CUSTOM_PROPERTY: string;
|
|
63
70
|
export function bigIntAsText(_key: string, value: unknown): unknown;
|
|
64
71
|
/**
|
|
65
72
|
* `unbuildable`: a value Core cannot write at all, so the build stops
|
|
@@ -21,6 +21,20 @@ import {
|
|
|
21
21
|
keptCssTreeAnswer,
|
|
22
22
|
} from '../../../foundation/runtime/css-tree.mjs';
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* A custom property's name as CSS reads it: two dashes, then name
|
|
26
|
+
* characters (letters, digits, `_`, `-`, and any letter beyond ASCII, as in
|
|
27
|
+
* `--café`). The one pattern every var() reader here and in the editor
|
|
28
|
+
* builds on.
|
|
29
|
+
*/
|
|
30
|
+
export const CUSTOM_PROPERTY = String.raw`--(?:[\w-]|[^\x00-\x7F])+`;
|
|
31
|
+
|
|
32
|
+
/** A var() that names a custom property, and the comma of its fallback. */
|
|
33
|
+
const VAR_REF = new RegExp(
|
|
34
|
+
String.raw`var\(\s*(${CUSTOM_PROPERTY})\s*(,)?`,
|
|
35
|
+
'gi',
|
|
36
|
+
);
|
|
37
|
+
|
|
24
38
|
/** @param {unknown} value @returns {value is Record<string, any>} */
|
|
25
39
|
const isBlock = value =>
|
|
26
40
|
value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -166,20 +180,57 @@ function tokenValueProblem(key, value, reads) {
|
|
|
166
180
|
const number = halves.findIndex(h => typeof h === 'number');
|
|
167
181
|
if (number !== -1)
|
|
168
182
|
return `${key} gives the number ${halves[number]} as its ${number === 0 ? 'light' : 'dark'} half, so the build writes ${shown}, and light-dark() takes colors only, so the browser drops the whole value, in both modes: give both halves a color, or one value for both modes`;
|
|
183
|
+
const length = halves.findIndex(h => isLength(String(h)));
|
|
184
|
+
if (length !== -1)
|
|
185
|
+
return `${key} gives a [light, dark] pair of sizes (${halves[length]}), so the build writes ${shown}, and light-dark() takes colors only, so the browser drops the whole value, in both modes: give it one value for both modes`;
|
|
186
|
+
// Each half is read as the text it is written in.
|
|
187
|
+
for (const [i, h] of halves.entries()) {
|
|
188
|
+
const why = unsetVarRead(key, String(h), reads);
|
|
189
|
+
if (why)
|
|
190
|
+
return `${key} gives a ${i === 0 ? 'light' : 'dark'} half that reads var(${why}), which no token sets, so the build writes ${shown}, and the browser drops the whole value, in both modes: read a token, or give a fallback (var(${why}, <value>))`;
|
|
191
|
+
}
|
|
169
192
|
return null;
|
|
170
193
|
}
|
|
171
194
|
const bad = nonText(key, value);
|
|
172
195
|
if (bad) return bad;
|
|
173
196
|
if (boxed(value)) value = /** @type {any} */ (value).valueOf();
|
|
174
197
|
if (typeof value !== 'string') return null;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
198
|
+
const name = unsetVarRead(key, value, reads);
|
|
199
|
+
return name
|
|
200
|
+
? `${key} reads var(${name}), which no token sets, so it has no value and the browser drops what reads it: read a token, or give a fallback (var(${name}, <value>))`
|
|
201
|
+
: null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The first custom property a value's var()s read with no fallback that no
|
|
206
|
+
* token sets, or null.
|
|
207
|
+
* @param {string} key the token the value is given to
|
|
208
|
+
* @param {string} value
|
|
209
|
+
* @param {(name: string) => boolean} [reads] whether a var() of a name reads
|
|
210
|
+
* a value
|
|
211
|
+
* @returns {string | null}
|
|
212
|
+
*/
|
|
213
|
+
function unsetVarRead(key, value, reads) {
|
|
214
|
+
if (!reads) return null;
|
|
215
|
+
for (const [, name, comma] of value.matchAll(VAR_REF))
|
|
216
|
+
if (!comma && name !== key && !reads(name)) return name;
|
|
180
217
|
return null;
|
|
181
218
|
}
|
|
182
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Whether a value is a size (a length or a percentage), which a [light,
|
|
222
|
+
* dark] pair cannot hold: light-dark() takes colors only.
|
|
223
|
+
* @param {string} value
|
|
224
|
+
*/
|
|
225
|
+
function isLength(value) {
|
|
226
|
+
try {
|
|
227
|
+
const ast = cssTree().parse(value, {context: 'value'});
|
|
228
|
+
return !cssTree().lexer.matchType('length-percentage', ast).error;
|
|
229
|
+
} catch {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
183
234
|
/**
|
|
184
235
|
* Why a token's name or empty value sets no token, or null: a name that does
|
|
185
236
|
* not start with exactly two dashes (`-color-accent`, `---color-border`),
|
|
@@ -205,9 +256,7 @@ function tokenNameProblem(key, value, isProperty) {
|
|
|
205
256
|
/** @param {unknown} value @returns {string[]} the custom properties a value's var()s read */
|
|
206
257
|
const varNames = value =>
|
|
207
258
|
(Array.isArray(value) ? value : [value]).flatMap(part =>
|
|
208
|
-
typeof part === 'string'
|
|
209
|
-
? [...part.matchAll(/var\(\s*(--[\w-]+)/gi)].map(m => m[1])
|
|
210
|
-
: [],
|
|
259
|
+
typeof part === 'string' ? [...part.matchAll(VAR_REF)].map(m => m[1]) : [],
|
|
211
260
|
);
|
|
212
261
|
|
|
213
262
|
/**
|
|
@@ -9,7 +9,7 @@ export const doc = {
|
|
|
9
9
|
displayName: 'generateTonalPalette()',
|
|
10
10
|
summary: 'Generate candidate tonal palette data without filesystem effects.',
|
|
11
11
|
description:
|
|
12
|
-
'Runs the
|
|
12
|
+
'Runs the recipe the request names: astryx-oklch-v1 when it names none, so a request or config made before v2 keeps its colors, or astryx-oklch-v2, whose pale stops follow the vibrancy and each seed\'s own chroma. New palettes name v2: the theme editor records it in each config it makes, and a new config should too. A config keeps the recipe it records; to pin one, record "recipe": "astryx-oklch-v1" (or v2) in the palette config. The returned candidate ' +
|
|
13
13
|
'contains exact hex values for review; it does not modify a theme, write files, ' +
|
|
14
14
|
'perform semantic mapping, or make accessibility claims. Stop numbers remain ' +
|
|
15
15
|
'stable across layouts, and requested decimal stops are emitted explicitly. ' +
|
|
@@ -38,8 +38,19 @@ export function serializeGenerationResult(result: unknown): string;
|
|
|
38
38
|
/** @typedef {{colors: Record<number, string>, diagnostics: TonalPaletteRampDiagnostics}} GeneratedRamp */
|
|
39
39
|
/** @typedef {{id: string, name: string, seed: string, kind: 'chromatic' | 'neutral', anchors: TonalPaletteAnchor[]}} NormalizedFamily */
|
|
40
40
|
/** @typedef {{id: string, name: string, seed: string, light?: GeneratedRamp, dark?: GeneratedRamp}} GeneratedFamily */
|
|
41
|
-
/** @typedef {{recipe:
|
|
41
|
+
/** @typedef {{recipe: PaletteRecipe, status: 'candidate', request: NormalizedRequest, families: GeneratedFamily[], coordination: TonalPaletteCoordinationDiagnostics[], errors: {familyId: string, message: string}[]}} PaletteGenerationResult */
|
|
42
|
+
/** @typedef {'astryx-oklch-v1' | 'astryx-oklch-v2'} PaletteRecipe */
|
|
43
|
+
/** The recipe a request that names none runs: the first one. */
|
|
42
44
|
export const PALETTE_RECIPE: "astryx-oklch-v1";
|
|
45
|
+
/**
|
|
46
|
+
* The recipe whose pale stops follow the vibrancy and the seed's own
|
|
47
|
+
* chroma: a stop whose gamut cannot hold the most vivid request gives every
|
|
48
|
+
* request the same share of it, and coordination never raises a seed's
|
|
49
|
+
* chroma. A request runs it by naming it.
|
|
50
|
+
*/
|
|
51
|
+
export const PALETTE_RECIPE_V2: "astryx-oklch-v2";
|
|
52
|
+
/** Every recipe the generator runs. */
|
|
53
|
+
export const PALETTE_RECIPES: readonly string[];
|
|
43
54
|
/**
|
|
44
55
|
* Identity of this generator implementation. `PALETTE_RECIPE` names the
|
|
45
56
|
* normative algorithm; this names the code that ran it, so a receipt can tell
|
|
@@ -93,7 +104,7 @@ export type GeneratedFamily = {
|
|
|
93
104
|
dark?: GeneratedRamp;
|
|
94
105
|
};
|
|
95
106
|
export type PaletteGenerationResult = {
|
|
96
|
-
recipe:
|
|
107
|
+
recipe: PaletteRecipe;
|
|
97
108
|
status: "candidate";
|
|
98
109
|
request: NormalizedRequest;
|
|
99
110
|
families: GeneratedFamily[];
|
|
@@ -103,3 +114,4 @@ export type PaletteGenerationResult = {
|
|
|
103
114
|
message: string;
|
|
104
115
|
}[];
|
|
105
116
|
};
|
|
117
|
+
export type PaletteRecipe = "astryx-oklch-v1" | "astryx-oklch-v2";
|