@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
|
@@ -62,6 +62,8 @@ import * as fs from 'node:fs';
|
|
|
62
62
|
import * as os from 'node:os';
|
|
63
63
|
import * as path from 'node:path';
|
|
64
64
|
import {createRequire, isBuiltin} from 'node:module';
|
|
65
|
+
import {moduleImports} from '../../../foundation/render/embedded-imports.mjs';
|
|
66
|
+
import {STYLESHEET_FILE} from '../../../foundation/fs/stylesheet-file.mjs';
|
|
65
67
|
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
66
68
|
import {babelParse as parse} from '../../../foundation/runtime/lazy-dependencies.mjs';
|
|
67
69
|
import {jitiCacheOptions} from '../../../foundation/fs/jiti-cache.mjs';
|
|
@@ -116,6 +118,7 @@ import {
|
|
|
116
118
|
INPUT_DECLARATION_FILES,
|
|
117
119
|
inputFieldsFrom,
|
|
118
120
|
sourceFieldProblems,
|
|
121
|
+
inputFieldProblems,
|
|
119
122
|
sourceTypography,
|
|
120
123
|
} from './input-fields.mjs';
|
|
121
124
|
import {styleKeyProblems} from './style-keys.mjs';
|
|
@@ -3644,7 +3647,13 @@ export async function validateThemePrivateInputs(
|
|
|
3644
3647
|
}
|
|
3645
3648
|
|
|
3646
3649
|
// The CLI's own Core, unless a build in this process already chose one.
|
|
3647
|
-
|
|
3650
|
+
// Only doctor calls this, and doctor never reads the Core a copy installed
|
|
3651
|
+
// for the computer carries, which is often missing too: there the project's
|
|
3652
|
+
// installed Core loads the input.
|
|
3653
|
+
const cliCore = await loadCliCore();
|
|
3654
|
+
if (carriesCore() || !cliCore.themeModule) {
|
|
3655
|
+
await selectCore(cwd, {projectOnly: true});
|
|
3656
|
+
}
|
|
3648
3657
|
const interception = interceptCore(_coreThemeModule, _coreRootModule);
|
|
3649
3658
|
let theme;
|
|
3650
3659
|
try {
|
|
@@ -3677,14 +3686,15 @@ export async function validateThemePrivateInputs(
|
|
|
3677
3686
|
* import { defaultIconRegistry } from './icons';
|
|
3678
3687
|
* icons: defaultIconRegistry,
|
|
3679
3688
|
* @param {string} filePath
|
|
3680
|
-
* @param {'icons' | 'indicators' | 'componentIcons'} field
|
|
3689
|
+
* @param {'icons' | 'indicators' | 'componentIcons' | 'extends'} field the field (`extends`: the base a theme imports)
|
|
3681
3690
|
* @returns {{exportName: string, importPath: string} | null}
|
|
3682
3691
|
*/
|
|
3683
3692
|
function extractRegistryInfo(filePath, field) {
|
|
3684
3693
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
3685
3694
|
const defineIndex = content.indexOf('defineTheme(');
|
|
3686
|
-
|
|
3687
|
-
|
|
3695
|
+
// A plain-object theme writes its fields with no defineTheme() call.
|
|
3696
|
+
if (defineIndex < 0 && field !== 'extends') return null;
|
|
3697
|
+
const themeSource = content.slice(Math.max(defineIndex, 0));
|
|
3688
3698
|
const explicit = themeSource.match(
|
|
3689
3699
|
new RegExp(`${field}:\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?=[,}])`),
|
|
3690
3700
|
);
|
|
@@ -3925,6 +3935,163 @@ function keptWarnings(kept, cwd) {
|
|
|
3925
3935
|
);
|
|
3926
3936
|
}
|
|
3927
3937
|
|
|
3938
|
+
/**
|
|
3939
|
+
* Read each value of a loaded theme (in plain objects and arrays, at any
|
|
3940
|
+
* depth), so a getter or Proxy the module wrote that throws fails here, as
|
|
3941
|
+
* a load: "Failed to load theme from <file>: <message> (reading <field>)".
|
|
3942
|
+
* @param {any} theme
|
|
3943
|
+
* @param {string} filePath
|
|
3944
|
+
*/
|
|
3945
|
+
function readThemeValues(theme, filePath) {
|
|
3946
|
+
/** @type {Set<any>} */
|
|
3947
|
+
const seen = new Set();
|
|
3948
|
+
/** @param {any} value @param {string[]} at */
|
|
3949
|
+
const walk = (value, at) => {
|
|
3950
|
+
if (
|
|
3951
|
+
!value ||
|
|
3952
|
+
typeof value !== 'object' ||
|
|
3953
|
+
seen.has(value) ||
|
|
3954
|
+
at.length > 32
|
|
3955
|
+
)
|
|
3956
|
+
return;
|
|
3957
|
+
seen.add(value);
|
|
3958
|
+
if (!Array.isArray(value) && !isPlainObject(value)) return;
|
|
3959
|
+
/** @type {Array<string | symbol>} */
|
|
3960
|
+
let keys;
|
|
3961
|
+
try {
|
|
3962
|
+
keys = Reflect.ownKeys(value);
|
|
3963
|
+
} catch (error) {
|
|
3964
|
+
throw readFailure(error, at);
|
|
3965
|
+
}
|
|
3966
|
+
for (const key of keys) {
|
|
3967
|
+
if (typeof key !== 'string') continue;
|
|
3968
|
+
/** @type {any} */
|
|
3969
|
+
let next;
|
|
3970
|
+
try {
|
|
3971
|
+
next = value[key];
|
|
3972
|
+
} catch (error) {
|
|
3973
|
+
throw readFailure(error, [...at, key]);
|
|
3974
|
+
}
|
|
3975
|
+
walk(next, [...at, key]);
|
|
3976
|
+
}
|
|
3977
|
+
};
|
|
3978
|
+
/** @param {unknown} error @param {string[]} at */
|
|
3979
|
+
const readFailure = (error, at) =>
|
|
3980
|
+
new Error(
|
|
3981
|
+
`Failed to load theme from ${filePath}: ${error instanceof Error ? error.message : thrownText(error)}${at.length ? ` (reading ${at.join('.')})` : ''}`,
|
|
3982
|
+
{cause: error},
|
|
3983
|
+
);
|
|
3984
|
+
walk(theme, []);
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3987
|
+
/**
|
|
3988
|
+
* Whether a theme object is one defineTheme() made: it carries the surface
|
|
3989
|
+
* data defineTheme adds (the `__onDark` key, set even when it is empty) or a
|
|
3990
|
+
* built module's mark, with its tokens. Any other object is raw input.
|
|
3991
|
+
* @param {any} theme
|
|
3992
|
+
*/
|
|
3993
|
+
function isDefinedTheme(theme) {
|
|
3994
|
+
return (
|
|
3995
|
+
theme.tokens !== undefined &&
|
|
3996
|
+
(Object.hasOwn(theme, '__onDark') || theme.__built === true)
|
|
3997
|
+
);
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
/**
|
|
4001
|
+
* A plain-object theme as defineTheme() input: a field given as undefined
|
|
4002
|
+
* is a field not given (`extends: undefined` names no base), and a plain
|
|
4003
|
+
* base it extends is made with defineTheme() first, its own base before it,
|
|
4004
|
+
* so a base's `extends`, typography and [light, dark] pairs are resolved as
|
|
4005
|
+
* the theme's own are.
|
|
4006
|
+
* @param {any} theme
|
|
4007
|
+
* @param {Set<any>} [seen] the bases already met, for one that extends itself
|
|
4008
|
+
* @returns {any}
|
|
4009
|
+
*/
|
|
4010
|
+
function defineThemeInput(theme, seen = new Set()) {
|
|
4011
|
+
const input = Object.fromEntries(
|
|
4012
|
+
Object.entries(theme).filter(([, value]) => value !== undefined),
|
|
4013
|
+
);
|
|
4014
|
+
const base = input.extends;
|
|
4015
|
+
if (
|
|
4016
|
+
base &&
|
|
4017
|
+
typeof base === 'object' &&
|
|
4018
|
+
!isDefinedTheme(base) &&
|
|
4019
|
+
!seen.has(base)
|
|
4020
|
+
) {
|
|
4021
|
+
seen.add(base);
|
|
4022
|
+
input.extends = _defineTheme(defineThemeInput(base, seen));
|
|
4023
|
+
}
|
|
4024
|
+
return input;
|
|
4025
|
+
}
|
|
4026
|
+
|
|
4027
|
+
/**
|
|
4028
|
+
* The stylesheets a theme's modules import that are there and that its
|
|
4029
|
+
* outputs do not carry, each as an app writes its import: a stylesheet the
|
|
4030
|
+
* theme file imports by the specifier it writes (`'pkg/fonts.css'`) or, for
|
|
4031
|
+
* a relative one, its path from the working folder; one a module the theme
|
|
4032
|
+
* imports brings in (`loaded`, from the load), by its path when it is a file
|
|
4033
|
+
* of the project. Read from the source as well as the load: a load the
|
|
4034
|
+
* module cache answers runs no import again.
|
|
4035
|
+
* @param {string} filePath the theme source
|
|
4036
|
+
* @param {string} source its text
|
|
4037
|
+
* @param {string[]} loaded the stylesheet files the load brought in
|
|
4038
|
+
* @param {string} outPath the stylesheet this build writes
|
|
4039
|
+
* @param {string} cwd
|
|
4040
|
+
* @returns {string[]}
|
|
4041
|
+
*/
|
|
4042
|
+
function carriedStylesheets(filePath, source, loaded, outPath, cwd) {
|
|
4043
|
+
/** @param {string} file */
|
|
4044
|
+
const real = file => {
|
|
4045
|
+
try {
|
|
4046
|
+
return fs.realpathSync(file);
|
|
4047
|
+
} catch {
|
|
4048
|
+
return path.resolve(file);
|
|
4049
|
+
}
|
|
4050
|
+
};
|
|
4051
|
+
const own = real(outPath);
|
|
4052
|
+
/** @type {Map<string, string>} each named stylesheet, by its real file */
|
|
4053
|
+
const named = new Map();
|
|
4054
|
+
const require = createRequire(filePath);
|
|
4055
|
+
for (const {specifier, typeOnly} of moduleImports(source, filePath) ?? []) {
|
|
4056
|
+
const query = specifier.lastIndexOf('?');
|
|
4057
|
+
const bare =
|
|
4058
|
+
query > specifier.lastIndexOf('/')
|
|
4059
|
+
? specifier.slice(0, query)
|
|
4060
|
+
: specifier;
|
|
4061
|
+
if (typeOnly || !STYLESHEET_FILE.test(bare)) continue;
|
|
4062
|
+
const relative = bare.startsWith('./') || bare.startsWith('../');
|
|
4063
|
+
let file;
|
|
4064
|
+
try {
|
|
4065
|
+
file = relative
|
|
4066
|
+
? path.resolve(path.dirname(filePath), bare)
|
|
4067
|
+
: require.resolve(bare);
|
|
4068
|
+
} catch {
|
|
4069
|
+
continue;
|
|
4070
|
+
}
|
|
4071
|
+
if (!fs.existsSync(file)) continue;
|
|
4072
|
+
const key = real(file);
|
|
4073
|
+
if (key === own || named.has(key)) continue;
|
|
4074
|
+
named.set(
|
|
4075
|
+
key,
|
|
4076
|
+
relative ? path.relative(cwd, file) || file : `'${specifier}'`,
|
|
4077
|
+
);
|
|
4078
|
+
}
|
|
4079
|
+
for (const file of loaded) {
|
|
4080
|
+
const key = real(file);
|
|
4081
|
+
if (key === own || named.has(key)) continue;
|
|
4082
|
+
const shown = path.relative(cwd, file);
|
|
4083
|
+
// A package's own stylesheet a module of it imports is the package's.
|
|
4084
|
+
if (
|
|
4085
|
+
!shown ||
|
|
4086
|
+
shown.startsWith('..') ||
|
|
4087
|
+
shown.split(path.sep).includes('node_modules')
|
|
4088
|
+
)
|
|
4089
|
+
continue;
|
|
4090
|
+
named.set(key, shown);
|
|
4091
|
+
}
|
|
4092
|
+
return [...named.values()];
|
|
4093
|
+
}
|
|
4094
|
+
|
|
3928
4095
|
/**
|
|
3929
4096
|
* Refuse a theme whose source imports a stylesheet that is not there, unless
|
|
3930
4097
|
* it is the stylesheet this build writes (which loads empty, so the first
|
|
@@ -4808,6 +4975,10 @@ async function themeBuildInternal(
|
|
|
4808
4975
|
importedStylesheets = loaded.importedStylesheets ?? [];
|
|
4809
4976
|
loadDegradation = loaded.degraded;
|
|
4810
4977
|
colorModes = handOff.colorModes ?? loaded.colorModes ?? null;
|
|
4978
|
+
// Every value of the theme is read here, where a getter or Proxy of the
|
|
4979
|
+
// module's that throws is a failed load naming the file and the field,
|
|
4980
|
+
// never a failure of a check that reads it later.
|
|
4981
|
+
readThemeValues(themeDef, filePath);
|
|
4811
4982
|
} catch (e) {
|
|
4812
4983
|
const err = /** @type {Error} */ (e);
|
|
4813
4984
|
const shown = path.relative(cwd, filePath) || filePath;
|
|
@@ -5120,6 +5291,26 @@ async function themeBuildInternal(
|
|
|
5120
5291
|
from: null,
|
|
5121
5292
|
}))
|
|
5122
5293
|
: [];
|
|
5294
|
+
// A field the source reader cannot place (the theme reached through a
|
|
5295
|
+
// member, an array element, a call) is judged on the input itself, the
|
|
5296
|
+
// one defineTheme reads, and named without a line: never dropped.
|
|
5297
|
+
const loadedInput =
|
|
5298
|
+
interception?.inputOf(themeDef) ??
|
|
5299
|
+
(isDefinedTheme(themeDef) ? null : themeDef);
|
|
5300
|
+
if (fields && loadedInput) {
|
|
5301
|
+
const placed = new Set(badFields.map(f => f.path.join('.')));
|
|
5302
|
+
for (const f of inputFieldProblems(loadedInput, fields))
|
|
5303
|
+
if (!placed.has(f.path.join('.')))
|
|
5304
|
+
badFields.push({
|
|
5305
|
+
path: f.path,
|
|
5306
|
+
why: f.why,
|
|
5307
|
+
line: null,
|
|
5308
|
+
at: null,
|
|
5309
|
+
inherited: false,
|
|
5310
|
+
elsewhere: false,
|
|
5311
|
+
from: null,
|
|
5312
|
+
});
|
|
5313
|
+
}
|
|
5123
5314
|
// A typography value Core builds into something no browser uses (a font
|
|
5124
5315
|
// stack in one family, a quoted name with a space, a role weight with no
|
|
5125
5316
|
// type scale), or of a type the field does not take (a weight as a
|
|
@@ -5133,6 +5324,8 @@ async function themeBuildInternal(
|
|
|
5133
5324
|
const levels = fields?.levels ?? [];
|
|
5134
5325
|
const typographyInput =
|
|
5135
5326
|
interception?.inputOf(themeDef)?.typography ??
|
|
5327
|
+
// A plain-object theme is its own input.
|
|
5328
|
+
themeDef.typography ??
|
|
5136
5329
|
sourceTypography(themeSource, filePath);
|
|
5137
5330
|
/** @type {Map<string, {path: string[], why: string, value: unknown}>} */
|
|
5138
5331
|
const typographyProblems = new Map();
|
|
@@ -5274,22 +5467,34 @@ async function themeBuildInternal(
|
|
|
5274
5467
|
// defineTheme() turns a [light, dark] pair into light-dark() and adds
|
|
5275
5468
|
// Core's media-surface rules. A theme with no tokens is raw input too,
|
|
5276
5469
|
// whatever it carries (a resolved theme always has its tokens).
|
|
5277
|
-
const resolved =
|
|
5278
|
-
|
|
5279
|
-
|
|
5470
|
+
const resolved = isDefinedTheme(themeDef);
|
|
5471
|
+
// A base the source imports and extends that resolved to nothing (an
|
|
5472
|
+
// export the package does not have) is refused naming it, never built as
|
|
5473
|
+
// a theme with no base.
|
|
5474
|
+
if (
|
|
5475
|
+
!resolved &&
|
|
5476
|
+
Object.hasOwn(themeDef, 'extends') &&
|
|
5477
|
+
themeDef.extends === undefined
|
|
5478
|
+
) {
|
|
5479
|
+
const base = themeBaseBinding(filePath, themeExportName);
|
|
5480
|
+
const written =
|
|
5481
|
+
base?.importPath !== undefined
|
|
5482
|
+
? {importPath: base.importPath, exportName: base.exportName}
|
|
5483
|
+
: null;
|
|
5484
|
+
if (written)
|
|
5485
|
+
throw new AstryxError(
|
|
5486
|
+
`Theme "${themeDef.name}" extends ${written.exportName} from '${written.importPath}', which is undefined: '${written.importPath}' does not export ${written.exportName}, so the theme would build without its base. Import the base theme that package exports, or install the version that exports ${written.exportName}.`,
|
|
5487
|
+
undefined,
|
|
5488
|
+
ERROR_CODES.ERR_THEME_LOAD,
|
|
5489
|
+
);
|
|
5490
|
+
}
|
|
5280
5491
|
const needsResolution =
|
|
5281
5492
|
!resolved ||
|
|
5282
5493
|
INPUT_ONLY_FIELDS.some(field => themeDef[field] !== undefined) ||
|
|
5283
5494
|
('localTokens' in themeDef && themeDef.__localTokenLineage === undefined);
|
|
5284
5495
|
if (needsResolution) {
|
|
5285
5496
|
try {
|
|
5286
|
-
|
|
5287
|
-
// above read it (`extends: undefined` names no base).
|
|
5288
|
-
resolvedTheme = _defineTheme(
|
|
5289
|
-
Object.fromEntries(
|
|
5290
|
-
Object.entries(themeDef).filter(([, value]) => value !== undefined),
|
|
5291
|
-
),
|
|
5292
|
-
);
|
|
5497
|
+
resolvedTheme = _defineTheme(defineThemeInput(themeDef));
|
|
5293
5498
|
} catch (error) {
|
|
5294
5499
|
const message =
|
|
5295
5500
|
error instanceof Error
|
|
@@ -5675,9 +5880,16 @@ async function themeBuildInternal(
|
|
|
5675
5880
|
// A stylesheet the source imports for its side effect (`import
|
|
5676
5881
|
// './brand.css'`) loads empty, and the outputs do not carry it: said, so
|
|
5677
5882
|
// the app imports it beside the theme's stylesheet.
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5883
|
+
// Each is named as an app writes its import: a package stylesheet by the
|
|
5884
|
+
// specifier the source wrote, a file of the project by its path.
|
|
5885
|
+
for (const shown of carriedStylesheets(
|
|
5886
|
+
filePath,
|
|
5887
|
+
themeSource,
|
|
5888
|
+
importedStylesheets,
|
|
5889
|
+
outPath,
|
|
5890
|
+
cwd,
|
|
5891
|
+
)) {
|
|
5892
|
+
const w = `${path.relative(cwd, filePath) || filePath} imports ${shown}, which the built outputs do not carry (a theme's module and stylesheet hold only the theme): import it in your app beside ${path.relative(cwd, outPath) || outPath}.`;
|
|
5681
5893
|
warningMessages.push(w);
|
|
5682
5894
|
logger.warn(`Warning: ${w}`);
|
|
5683
5895
|
}
|
|
@@ -5831,6 +6043,7 @@ async function themeBuildInternal(
|
|
|
5831
6043
|
if (handOff.prepareFamily) {
|
|
5832
6044
|
return {
|
|
5833
6045
|
filePath,
|
|
6046
|
+
exportName: themeExportName,
|
|
5834
6047
|
sourceRelative: sourceRelative.split(path.sep).join('/'),
|
|
5835
6048
|
theme: displayTheme,
|
|
5836
6049
|
sourceTheme: themeDef,
|
|
@@ -6613,12 +6826,58 @@ async function buildFamily(
|
|
|
6613
6826
|
const specifier = planned?.renamed.get(importPath);
|
|
6614
6827
|
return sourceFile && specifier ? {specifier, sourceFile} : null;
|
|
6615
6828
|
};
|
|
6829
|
+
// The root's own base, when the family does not select it: a package
|
|
6830
|
+
// theme the module imports, as the root's standalone module does, for the
|
|
6831
|
+
// registries it inherits (icons, indicators, slot functions).
|
|
6832
|
+
/** @type {Map<string, {binding: string, importLine: string}>} */
|
|
6833
|
+
const rootBases = new Map();
|
|
6834
|
+
/** The receipt's account of that base. @type {{theme: string, package: string | null, export: string | null} | null} */
|
|
6835
|
+
let familyBase = null;
|
|
6836
|
+
/** The root whose base it is, for the text line. */
|
|
6837
|
+
let familyBaseOf = '';
|
|
6838
|
+
for (const member of members) {
|
|
6839
|
+
if (!member.unselectedBase) continue;
|
|
6840
|
+
// The root's own `extends`, and where its binding comes from: an import
|
|
6841
|
+
// of a package is a package base; an import of a file of the project, or
|
|
6842
|
+
// a theme the root's file defines itself, is a local base.
|
|
6843
|
+
const binding = themeBaseBinding(member.filePath, member.exportName);
|
|
6844
|
+
const fromPackage =
|
|
6845
|
+
binding?.importPath !== undefined &&
|
|
6846
|
+
!binding.importPath.startsWith('.') &&
|
|
6847
|
+
!path.isAbsolute(binding.importPath)
|
|
6848
|
+
? binding
|
|
6849
|
+
: null;
|
|
6850
|
+
familyBaseOf = member.theme.name;
|
|
6851
|
+
familyBase = {
|
|
6852
|
+
theme: member.unselectedBase,
|
|
6853
|
+
package: fromPackage ? packageOfSpecifier(fromPackage.importPath) : null,
|
|
6854
|
+
export: binding?.importPath !== undefined ? binding.exportName : null,
|
|
6855
|
+
};
|
|
6856
|
+
const inherits = [
|
|
6857
|
+
themeIconEntries(member.sourceParent),
|
|
6858
|
+
member.sourceParent?.indicators,
|
|
6859
|
+
themeComponentIcons(member.sourceParent),
|
|
6860
|
+
].some(value => value && Object.keys(value).length > 0);
|
|
6861
|
+
if (!inherits) continue;
|
|
6862
|
+
if (!fromPackage)
|
|
6863
|
+
throw new AstryxError(
|
|
6864
|
+
`Theme "${member.theme.name}" extends "${member.unselectedBase}", ${binding?.local ? `a theme ${path.basename(member.filePath)} defines itself` : binding?.importPath !== undefined ? `a theme of ${binding.importPath}` : 'a theme'} the family does not select, and the family module can carry the icons it inherits only from a package it imports. Select "${member.unselectedBase}" too (in a theme file of its own), or build "${member.theme.name}" on its own.`,
|
|
6865
|
+
undefined,
|
|
6866
|
+
ERROR_CODES.ERR_THEME_INVALID,
|
|
6867
|
+
);
|
|
6868
|
+
const local = `${bindings.get(member.theme.name)}Base`;
|
|
6869
|
+
rootBases.set(member.theme.name, {
|
|
6870
|
+
binding: local,
|
|
6871
|
+
importLine: `import { ${fromPackage.exportName} as ${local} } from ${JSON.stringify(fromPackage.importPath)};\n`,
|
|
6872
|
+
});
|
|
6873
|
+
}
|
|
6616
6874
|
const js = members
|
|
6617
6875
|
.map(member => {
|
|
6618
6876
|
const themeBinding = bindings.get(member.theme.name);
|
|
6877
|
+
const base = rootBases.get(member.theme.name) ?? null;
|
|
6619
6878
|
const parentBinding = member.parentName
|
|
6620
6879
|
? bindings.get(member.parentName)
|
|
6621
|
-
: null;
|
|
6880
|
+
: (base?.binding ?? null);
|
|
6622
6881
|
// prettier-ignore
|
|
6623
6882
|
const icon = familyRegistryInput(member.iconInfo, member.filePath, outDir, options.iconsSpecifier, compileLocal);
|
|
6624
6883
|
// prettier-ignore
|
|
@@ -6628,9 +6887,9 @@ async function buildFamily(
|
|
|
6628
6887
|
const ownIcons = icon.info ? `${themeBinding}Icons` : null;
|
|
6629
6888
|
// A parent with function entries keeps them in `__icons`; its `icons`
|
|
6630
6889
|
// is the node view.
|
|
6631
|
-
const parent =
|
|
6632
|
-
other => other.theme.name === member.parentName
|
|
6633
|
-
|
|
6890
|
+
const parent =
|
|
6891
|
+
members.find(other => other.theme.name === member.parentName) ??
|
|
6892
|
+
(base ? {theme: member.sourceParent} : undefined);
|
|
6634
6893
|
const inheritedIcons = parentBinding
|
|
6635
6894
|
? `${parentBinding}.${hasFunctionIconEntry(themeIconEntries(parent?.theme)) ? '__icons' : 'icons'}`
|
|
6636
6895
|
: null;
|
|
@@ -6659,6 +6918,7 @@ async function buildFamily(
|
|
|
6659
6918
|
compileLocal,
|
|
6660
6919
|
});
|
|
6661
6920
|
return (
|
|
6921
|
+
(base?.importLine ?? '') +
|
|
6662
6922
|
indicatorImport +
|
|
6663
6923
|
generateBuiltModule(member.theme, iconImports, icon.specifier, {
|
|
6664
6924
|
themeBinding,
|
|
@@ -6777,6 +7037,13 @@ async function buildFamily(
|
|
|
6777
7037
|
}
|
|
6778
7038
|
writeBuildOutputs(writes);
|
|
6779
7039
|
for (const output of Object.values(outputs)) logger.log(`[ok] ${output}`);
|
|
7040
|
+
// The base the outputs require, as the receipt's `base` says it.
|
|
7041
|
+
if (familyBase)
|
|
7042
|
+
logger.log(
|
|
7043
|
+
familyBase.package
|
|
7044
|
+
? ` requires ${familyBase.package} (${familyBase.export}) for ${familyBaseOf}'s base ${familyBase.theme}`
|
|
7045
|
+
: ` ${familyBaseOf}'s base ${familyBase.theme} is a local theme${familyBase.export ? ` (${familyBase.export})` : ''} the family does not select`,
|
|
7046
|
+
);
|
|
6780
7047
|
const themeBindings = members.map(member => bindings.get(member.theme.name));
|
|
6781
7048
|
// From the outputs' project root, whatever folder the build ran in: the
|
|
6782
7049
|
// snippet is relative to a file in that project's src/.
|
|
@@ -6837,6 +7104,118 @@ Or load the same stylesheet natively:
|
|
|
6837
7104
|
outputs,
|
|
6838
7105
|
warnings,
|
|
6839
7106
|
notices,
|
|
7107
|
+
// The base the family's root extends that the family does not select:
|
|
7108
|
+
// a requirement of the outputs (an installed package the app keeps).
|
|
7109
|
+
...(familyBase ? {base: familyBase} : {}),
|
|
6840
7110
|
},
|
|
6841
7111
|
};
|
|
6842
7112
|
}
|
|
7113
|
+
|
|
7114
|
+
/**
|
|
7115
|
+
* The binding a theme's own `extends` names, as its source writes it: the
|
|
7116
|
+
* theme the module exports as `exportName` (through consts, a defineTheme()
|
|
7117
|
+
* call or a plain object), its `extends` field, and where that name comes
|
|
7118
|
+
* from. An import gives its specifier and the name it imports; a theme the
|
|
7119
|
+
* file defines itself is `local`. Null when the source does not show it (no
|
|
7120
|
+
* `extends`, a computed one, or an export the reader cannot place).
|
|
7121
|
+
* @param {string} filePath
|
|
7122
|
+
* @param {string | undefined} exportName
|
|
7123
|
+
* @returns {{importPath: string, exportName: string, local?: undefined} | {local: string, importPath?: undefined, exportName?: undefined} | null}
|
|
7124
|
+
*/
|
|
7125
|
+
function themeBaseBinding(filePath, exportName) {
|
|
7126
|
+
/** @type {any} */
|
|
7127
|
+
let ast;
|
|
7128
|
+
try {
|
|
7129
|
+
ast = parse(fs.readFileSync(filePath, 'utf8'), {
|
|
7130
|
+
sourceType: 'unambiguous',
|
|
7131
|
+
plugins: sourcePlugins(filePath),
|
|
7132
|
+
});
|
|
7133
|
+
} catch {
|
|
7134
|
+
return null;
|
|
7135
|
+
}
|
|
7136
|
+
/** @type {Map<string, {source: string, imported: string}>} */
|
|
7137
|
+
const imports = new Map();
|
|
7138
|
+
/** @type {Map<string, any>} */
|
|
7139
|
+
const consts = new Map();
|
|
7140
|
+
/** @type {Map<string, any>} the node each export gives */
|
|
7141
|
+
const exported = new Map();
|
|
7142
|
+
/** @param {any} declaration */
|
|
7143
|
+
const addDeclaration = declaration => {
|
|
7144
|
+
if (declaration?.type !== 'VariableDeclaration') return;
|
|
7145
|
+
for (const d of declaration.declarations)
|
|
7146
|
+
if (d.id?.type === 'Identifier' && d.init) consts.set(d.id.name, d.init);
|
|
7147
|
+
};
|
|
7148
|
+
for (const node of ast.program.body) {
|
|
7149
|
+
if (node.type === 'ImportDeclaration' && node.importKind !== 'type')
|
|
7150
|
+
for (const spec of node.specifiers)
|
|
7151
|
+
if (spec.type === 'ImportSpecifier')
|
|
7152
|
+
imports.set(spec.local.name, {
|
|
7153
|
+
source: node.source.value,
|
|
7154
|
+
imported: spec.imported.name ?? spec.imported.value,
|
|
7155
|
+
});
|
|
7156
|
+
else if (spec.type === 'ImportDefaultSpecifier')
|
|
7157
|
+
imports.set(spec.local.name, {
|
|
7158
|
+
source: node.source.value,
|
|
7159
|
+
imported: 'default',
|
|
7160
|
+
});
|
|
7161
|
+
addDeclaration(node);
|
|
7162
|
+
if (node.type === 'ExportNamedDeclaration') {
|
|
7163
|
+
addDeclaration(node.declaration);
|
|
7164
|
+
if (node.declaration?.type === 'VariableDeclaration')
|
|
7165
|
+
for (const d of node.declaration.declarations)
|
|
7166
|
+
if (d.id?.type === 'Identifier') exported.set(d.id.name, d.id);
|
|
7167
|
+
if (!node.source)
|
|
7168
|
+
for (const spec of node.specifiers ?? [])
|
|
7169
|
+
if (spec.type === 'ExportSpecifier')
|
|
7170
|
+
exported.set(spec.exported.name ?? spec.exported.value, spec.local);
|
|
7171
|
+
}
|
|
7172
|
+
if (node.type === 'ExportDefaultDeclaration')
|
|
7173
|
+
exported.set('default', node.declaration);
|
|
7174
|
+
}
|
|
7175
|
+
/** @param {any} node @returns {any} */
|
|
7176
|
+
const unwrap = node => {
|
|
7177
|
+
while (
|
|
7178
|
+
node &&
|
|
7179
|
+
/^(?:TSAsExpression|TSSatisfiesExpression|TSNonNullExpression|TSTypeAssertion|ParenthesizedExpression)$/.test(
|
|
7180
|
+
node.type,
|
|
7181
|
+
)
|
|
7182
|
+
)
|
|
7183
|
+
node = node.expression;
|
|
7184
|
+
return node;
|
|
7185
|
+
};
|
|
7186
|
+
/** @param {any} node @param {number} depth @returns {any} the theme object literal */
|
|
7187
|
+
const themeObject = (node, depth = 0) => {
|
|
7188
|
+
node = unwrap(node);
|
|
7189
|
+
if (!node || depth > 8) return null;
|
|
7190
|
+
if (node.type === 'Identifier')
|
|
7191
|
+
return consts.has(node.name)
|
|
7192
|
+
? themeObject(consts.get(node.name), depth + 1)
|
|
7193
|
+
: null;
|
|
7194
|
+
if (node.type === 'CallExpression')
|
|
7195
|
+
return themeObject(node.arguments?.[0], depth + 1);
|
|
7196
|
+
return node.type === 'ObjectExpression' ? node : null;
|
|
7197
|
+
};
|
|
7198
|
+
const object = themeObject(exported.get(exportName ?? 'default'));
|
|
7199
|
+
const field = object?.properties.find(
|
|
7200
|
+
(/** @type {any} */ p) =>
|
|
7201
|
+
p.type === 'ObjectProperty' &&
|
|
7202
|
+
!p.computed &&
|
|
7203
|
+
(p.key.name ?? p.key.value) === 'extends',
|
|
7204
|
+
);
|
|
7205
|
+
const value = unwrap(field?.value);
|
|
7206
|
+
if (value?.type !== 'Identifier') return null;
|
|
7207
|
+
const imported = imports.get(value.name);
|
|
7208
|
+
if (imported)
|
|
7209
|
+
return {importPath: imported.source, exportName: imported.imported};
|
|
7210
|
+
return consts.has(value.name) ? {local: value.name} : null;
|
|
7211
|
+
}
|
|
7212
|
+
|
|
7213
|
+
/**
|
|
7214
|
+
* The package a bare import specifier names: `@scope/name/sub` is
|
|
7215
|
+
* `@scope/name`, `name/sub` is `name`.
|
|
7216
|
+
* @param {string} specifier
|
|
7217
|
+
*/
|
|
7218
|
+
function packageOfSpecifier(specifier) {
|
|
7219
|
+
const parts = specifier.split('/');
|
|
7220
|
+
return specifier.startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];
|
|
7221
|
+
}
|
|
@@ -43,18 +43,22 @@ export function resolveThemeFamily(members) {
|
|
|
43
43
|
`Theme "${member.theme.name}" has an invalid normalized parent.`,
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
// A member whose base is not selected is a root: the family's one root
|
|
47
|
+
// may extend a base of its own (a package theme), which its resolved
|
|
48
|
+
// values carry, as its standalone build does.
|
|
49
|
+
const selectedParent = parent?.name ?? null;
|
|
50
|
+
const parentName =
|
|
51
|
+
selectedParent && byName.has(selectedParent) ? selectedParent : null;
|
|
52
52
|
if (parentName && parent !== byName.get(parentName).sourceTheme) {
|
|
53
53
|
throw new Error(
|
|
54
54
|
`Theme "${member.theme.name}" does not extend the selected "${parentName}" source.`,
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
...member,
|
|
59
|
+
parentName,
|
|
60
|
+
unselectedBase: parentName ? null : selectedParent,
|
|
61
|
+
};
|
|
58
62
|
});
|
|
59
63
|
const resolved = new Map(
|
|
60
64
|
withParents.map(member => [member.theme.name, member]),
|
|
@@ -75,6 +79,13 @@ export function resolveThemeFamily(members) {
|
|
|
75
79
|
for (const member of withParents) visit(member);
|
|
76
80
|
const roots = withParents.filter(member => member.parentName === null);
|
|
77
81
|
if (roots.length !== 1) {
|
|
82
|
+
// A member whose base is not selected, beside another root, misses that
|
|
83
|
+
// ancestor: named so, with the base it extends.
|
|
84
|
+
const missing = roots.find(member => member.unselectedBase);
|
|
85
|
+
if (roots.length > 1 && missing)
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Theme "${missing.theme.name}" is missing selected ancestor "${missing.unselectedBase}": a family has one root, and only the root may extend a theme the family does not select. Select "${missing.unselectedBase}" too, or build "${missing.theme.name}" on its own.`,
|
|
88
|
+
);
|
|
78
89
|
throw new Error(
|
|
79
90
|
`A theme family must have exactly one selected root; found ${roots.length}.`,
|
|
80
91
|
);
|
|
@@ -254,10 +254,11 @@ export const APPLE_FACE_GENERICS = /** @type {Record<string, string>} */ ({
|
|
|
254
254
|
* @returns {string | null}
|
|
255
255
|
*/
|
|
256
256
|
export function appleFaceGeneric(family) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
const key = family.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
258
|
+
// Only the table's own names: a word such as constructor is no face.
|
|
259
|
+
return Object.hasOwn(APPLE_FACE_GENERICS, key)
|
|
260
|
+
? APPLE_FACE_GENERICS[key]
|
|
261
|
+
: null;
|
|
261
262
|
}
|
|
262
263
|
|
|
263
264
|
/**
|
|
@@ -30,16 +30,31 @@ export function sourceFieldProblems(entry: SourceFile, fields: InputFields, load
|
|
|
30
30
|
why: string;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* Each field the loaded theme input holds that Core's theme input does not
|
|
34
|
+
* take, by its key path, as {@link sourceFieldProblems} words it: the input
|
|
35
|
+
* the build hands defineTheme, whatever expression in the source made it (a
|
|
36
|
+
* member, an array element, a call's result). A key with two underscores
|
|
37
|
+
* (`__onDark`) is the theme's own data, not a field.
|
|
38
|
+
* @param {any} input the theme input as loaded
|
|
39
|
+
* @param {InputFields} fields
|
|
40
|
+
* @returns {Array<{path: string[], why: string}>}
|
|
41
|
+
*/
|
|
42
|
+
export function inputFieldProblems(input: any, fields: InputFields): Array<{
|
|
43
|
+
path: string[];
|
|
44
|
+
why: string;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* A theme source's typography as the plain values it writes: text,
|
|
48
|
+
* numbers (signed too) and arrays, in nested blocks, followed through the consts of the
|
|
49
|
+
* theme file. A value written as anything else (a call, a name from another
|
|
50
|
+
* module) is UNREAD, and a block with a spread of one is marked UNREAD, so
|
|
51
|
+
* a judge never reads it as missing. Null when the source writes none.
|
|
37
52
|
* @param {string} source
|
|
38
53
|
* @param {string} [file] the source's file name, which says whether it is
|
|
39
54
|
* read with JSX
|
|
40
|
-
* @returns {
|
|
55
|
+
* @returns {unknown}
|
|
41
56
|
*/
|
|
42
|
-
export function sourceTypography(source: string, file?: string):
|
|
57
|
+
export function sourceTypography(source: string, file?: string): unknown;
|
|
43
58
|
/**
|
|
44
59
|
* The fields Core's `defineTheme()` input takes, read from the type
|
|
45
60
|
* declarations of the installed Core, so the editor names a misspelled
|