@astryxdesign/cli 0.1.7 → 0.1.8-canary.07362a9
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/CHANGELOG.md +40 -0
- package/README.md +115 -19
- package/{src/api → api/blog}/blog.mjs +42 -6
- package/{src/api → api/blog}/blog.test.mjs +2 -2
- package/api/build/build.mjs +92 -0
- package/api/build/build.test.mjs +92 -0
- package/{src/api → api/component}/component.mjs +49 -26
- package/{src/api → api/discover}/discover.mjs +55 -18
- package/{src/api → api/docs}/docs.mjs +47 -21
- package/{src/api → api/doctor}/doctor.mjs +13 -10
- package/{src/api → api}/error.mjs +2 -2
- package/{src/api → api/hook}/hook.mjs +11 -11
- package/{src/api → api}/index.mjs +16 -9
- package/{src/api → api/integration}/validate-integration.mjs +48 -15
- package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
- package/{src/api → api/layout}/layout.mjs +66 -17
- package/{src/api → api/layout}/layout.test.mjs +1 -1
- package/{src/api → api/search}/search.mjs +71 -12
- package/api/swizzle/swizzle.mjs +283 -0
- package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
- package/{src/api → api/template}/template-integration.test.mjs +2 -2
- package/{src/api → api/template}/template-suffix.test.mjs +3 -3
- package/{src/api → api/template}/template.mjs +96 -19
- package/{src/api → api/theme}/theme-add.mjs +35 -7
- package/{src → authoring}/codemod.mjs +6 -6
- package/{src → authoring}/config.test.mjs +1 -1
- package/{src → authoring}/doc.mjs +1 -1
- package/{src → authoring}/doc.test.mjs +1 -1
- package/{src → authoring}/template.mjs +1 -1
- package/bin/astryx.mjs +12 -10
- package/{src → cli}/commands/blog.mjs +48 -7
- package/{src → cli}/commands/build-theme.mjs +133 -115
- package/cli/commands/build.mjs +172 -0
- package/cli/commands/cli-postinstall.test.mjs +42 -0
- package/{src → cli}/commands/component/index.mjs +52 -25
- package/{src → cli}/commands/component-ownership.test.mjs +3 -3
- package/{src → cli}/commands/component-package.test.mjs +1 -1
- package/{src → cli}/commands/component-resolution.test.mjs +2 -2
- package/{src → cli}/commands/discover.mjs +23 -12
- package/{src → cli}/commands/docs.mjs +42 -10
- package/{src → cli}/commands/docs.test.mjs +1 -1
- package/{src → cli}/commands/doctor.mjs +3 -3
- package/{src → cli}/commands/doctor.test.mjs +2 -2
- package/{src → cli}/commands/ensure-core-built.mjs +3 -2
- package/{src → cli}/commands/external-showcase.test.mjs +1 -1
- package/{src → cli}/commands/hook/index.mjs +40 -17
- package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
- package/cli/commands/init.mjs +195 -0
- package/{src → cli}/commands/init.next-steps.test.mjs +1 -1
- package/cli/commands/interactive-guard.test.mjs +66 -0
- package/{src → cli}/commands/json-contract.test.mjs +2 -2
- package/{src → cli}/commands/layout.mjs +59 -19
- package/{src → cli}/commands/search.mjs +22 -15
- package/{src → cli}/commands/search.test.mjs +1 -1
- package/cli/commands/setup-nudge.test.mjs +108 -0
- package/cli/commands/swizzle.mjs +103 -0
- package/{src → cli}/commands/template.mjs +84 -53
- package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
- package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
- package/{src → cli}/commands/upgrade.mjs +291 -77
- package/cli/commands/upgrade.test.mjs +314 -0
- package/{src → cli}/commands/validate-integration.mjs +17 -37
- package/{src → cli}/index.mjs +55 -19
- package/{src/codemods → codemods}/__tests__/registry.test.mjs +1 -0
- package/{src/codemods → codemods}/ensure-jscodeshift.mjs +12 -28
- package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
- package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
- package/{src/codemods → codemods}/integration-runner.mjs +8 -3
- package/{src/codemods → codemods}/registry.mjs +4 -1
- package/{src/codemods → codemods}/run-codemod.mjs +18 -11
- package/{src/codemods → codemods}/runner.mjs +24 -14
- package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
- package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
- package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +42 -7
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +43 -0
- package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +117 -13
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +86 -15
- package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
- package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
- package/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +161 -0
- package/codemods/transforms/v0.1.8/index.mjs +19 -0
- package/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +239 -0
- package/docs/cli-integrations.doc.mjs +150 -0
- package/docs/elevation.doc.mjs +79 -1
- package/docs/getting-started.doc.mjs +9 -9
- package/docs/internationalization.doc.mjs +92 -46
- package/docs/migration.doc.mjs +18 -18
- package/docs/principles.doc.dense.mjs +1 -1
- package/docs/principles.doc.mjs +6 -6
- package/docs/principles.doc.zh.mjs +1 -1
- package/docs/styling-libraries.doc.mjs +3 -3
- package/docs/styling.doc.mjs +4 -4
- package/docs/theme.doc.dense.mjs +2 -2
- package/docs/theme.doc.mjs +7 -7
- package/docs/theme.doc.zh.mjs +1 -1
- package/docs/tokens.doc.mjs +1 -1
- package/docs/working-with-ai.doc.mjs +19 -19
- package/{src/commands → lib/agent-docs}/agent-docs.mjs +164 -29
- package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
- package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +123 -10
- package/{src/lib → lib}/cli-error.mjs +2 -2
- package/{src/lib → lib}/component-discovery.mjs +44 -2
- package/{src/lib → lib}/component-format.mjs +67 -25
- package/{src/lib → lib}/component-loader.mjs +27 -13
- package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
- package/{src/lib → lib}/error-codes.test.mjs +1 -1
- package/{src/lib → lib}/hook-discovery.mjs +14 -1
- package/{src/lib → lib}/hook-format.mjs +29 -5
- package/{src/lib → lib}/integration-warnings.mjs +2 -2
- package/{src/lib → lib}/integrations.mjs +20 -0
- package/{src/lib → lib}/integrations.test.mjs +1 -1
- package/{src/lib → lib}/json-contract.test.mjs +1 -1
- package/{src/lib → lib}/json-shim.mjs +11 -6
- package/{src/lib → lib}/json-shim.test.mjs +1 -1
- package/{src/lib → lib}/json.mjs +3 -3
- package/{src/lib → lib}/levenshtein.mjs +6 -0
- package/{src/lib → lib}/manifest.mjs +7 -5
- package/{src/lib → lib}/manifest.test.mjs +2 -2
- package/{src/lib → lib}/module-loader.mjs +1 -0
- package/{src/lib → lib}/package-scanner.mjs +47 -0
- package/{src/lib → lib}/project.mjs +48 -18
- package/{src/lib → lib}/project.test.mjs +1 -1
- package/{src/lib → lib}/resolve-theme.mjs +5 -0
- package/{src/lib → lib}/string-utils.mjs +15 -0
- package/lib/term-log.mjs +57 -0
- package/{src/lib → lib}/xle/browser.mjs +18 -8
- package/{src/lib → lib}/xle/expand.mjs +155 -22
- package/{src/lib → lib}/xle/parse.mjs +119 -13
- package/{src/lib → lib}/xle/print.mjs +54 -14
- package/{src/lib → lib}/xle/registry-core.mjs +28 -3
- package/{src/lib → lib}/xle/registry.mjs +9 -4
- package/{src/lib → lib}/xle/splice.mjs +13 -2
- package/{src/lib → lib}/xle/validate.mjs +95 -14
- package/lib/xle/xle-ast.d.ts +214 -0
- package/package.json +37 -28
- package/scripts/postinstall.mjs +74 -0
- package/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +2 -2
- package/templates/blocks/components/Avatar/AvatarInitialsFallback.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +5 -5
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
- package/templates/blocks/components/AvatarGroup/AvatarGroupShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowCustomText.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowDefault.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +3 -3
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +3 -3
- package/templates/blocks/components/Banner/BannerFloating.doc.mjs +14 -0
- package/templates/blocks/components/Banner/BannerFloating.tsx +16 -0
- package/templates/blocks/components/Button/ButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/Button/ButtonFloating.tsx +37 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.doc.mjs +14 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +23 -0
- package/templates/blocks/components/Card/CardElevations.doc.mjs +14 -0
- package/templates/blocks/components/Card/CardElevations.tsx +32 -0
- package/templates/blocks/components/Card/ClickableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/ClickableCardElevated.tsx +21 -0
- package/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/SelectableCardElevated.tsx +37 -0
- package/templates/blocks/components/Carousel/CarouselSnap.tsx +1 -1
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +14 -0
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +75 -0
- package/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx +2 -2
- package/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleGrouping.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +1 -1
- package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +5 -9
- package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -1
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -1
- package/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/IconButton/IconButtonFloating.tsx +37 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
- package/templates/blocks/components/Item/ItemWithMedia.tsx +2 -2
- package/templates/blocks/components/ListItem/ListItemWithMedia.tsx +2 -2
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +39 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.tsx +44 -0
- package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -6
- package/templates/blocks/components/Stack/StackFillItem.tsx +2 -6
- package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
- package/templates/blocks/components/TabList/TabListTabsWithActions.tsx +2 -7
- package/templates/blocks/components/Table/TableRowStatusTable.doc.mjs +14 -0
- package/templates/blocks/components/Table/TableRowStatusTable.tsx +59 -0
- package/templates/blocks/components/Thumbnail/ThumbnailDisabled.tsx +6 -1
- package/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx +1 -0
- package/templates/blocks/components/Thumbnail/ThumbnailRemovable.tsx +1 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemShowcase.tsx +1 -1
- package/templates/pages/ai-chat/page.tsx +4 -4
- package/templates/pages/dashboard-portfolio/page.tsx +3 -11
- package/templates/pages/detail-page/page.tsx +5 -12
- package/templates/pages/documentation-design/page.tsx +1 -1
- package/templates/pages/messaging-shell/page.tsx +6 -8
- package/templates/pages/table-grouped/page.tsx +9 -14
- package/templates/pages/table-page/page.tsx +7 -9
- package/templates/pages/table-page-heatmap-status/page.tsx +5 -13
- package/{src/types → types}/api.contract.assert.ts +17 -8
- package/{src/types → types}/api.d.ts +110 -9
- package/{src/types → types}/base.d.ts +40 -4
- package/types/build.d.ts +53 -0
- package/types/codemod.d.ts +166 -0
- package/{src/types → types}/component.d.ts +1 -1
- package/{src/types → types}/discover.d.ts +1 -1
- package/{src/types → types}/docs.d.ts +1 -4
- package/{src/types → types}/hook.d.ts +1 -1
- package/{src/types → types}/index.d.ts +1 -0
- package/types/jscodeshift.d.ts +19 -0
- package/types/layout.d.ts +74 -0
- package/{src/types → types}/swizzle.d.ts +4 -0
- package/{src/types → types}/template-api.d.ts +4 -1
- package/types/theme.d.ts +53 -0
- package/types/upgrade.d.ts +108 -0
- package/utils/package-manager.mjs +178 -0
- package/utils/package-manager.test.mjs +220 -0
- package/{src/utils → utils}/path-safety.mjs +0 -18
- package/{src/utils → utils}/paths.mjs +4 -1
- package/{src/utils → utils}/update-check.mjs +5 -4
- package/{src/utils → utils}/update-check.test.mjs +3 -3
- package/docs/integration-authoring.md +0 -105
- package/src/commands/build.mjs +0 -196
- package/src/commands/init.mjs +0 -288
- package/src/commands/interactive-guard.test.mjs +0 -69
- package/src/commands/swizzle.mjs +0 -440
- package/src/commands/upgrade.test.mjs +0 -160
- package/src/types/codemod.d.ts +0 -81
- package/src/types/theme.d.ts +0 -23
- package/src/types/upgrade.d.ts +0 -64
- package/src/utils/interactive.mjs +0 -76
- package/src/utils/interactive.test.mjs +0 -70
- package/src/utils/package-manager.mjs +0 -74
- package/src/utils/package-manager.test.mjs +0 -113
- /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
- /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
- /package/{src/api → api/template}/template.test.mjs +0 -0
- /package/{src → authoring}/codemod.test.mjs +0 -0
- /package/{src → authoring}/config.mjs +0 -0
- /package/{src → authoring}/integration.mjs +0 -0
- /package/{src → authoring}/template.test.mjs +0 -0
- /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
- /package/{src → cli}/commands/component.test.mjs +0 -0
- /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
- /package/{src → cli}/commands/template.test.mjs +0 -0
- /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
- /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
- /package/{src → cli}/update-hint-commands.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
- /package/{src/lib → lib}/cli-error.test.mjs +0 -0
- /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
- /package/{src/lib → lib}/component-format.test.mjs +0 -0
- /package/{src/lib → lib}/component-loader.test.mjs +0 -0
- /package/{src/lib → lib}/config-cache.mjs +0 -0
- /package/{src/lib → lib}/config-cache.test.mjs +0 -0
- /package/{src/lib → lib}/config-schema.mjs +0 -0
- /package/{src/lib → lib}/error-codes.mjs +0 -0
- /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
- /package/{src/lib → lib}/module-loader.test.mjs +0 -0
- /package/{src/lib → lib}/node-version.mjs +0 -0
- /package/{src/lib → lib}/node-version.test.mjs +0 -0
- /package/{src/lib → lib}/parse.mjs +0 -0
- /package/{src/lib → lib}/site.mjs +0 -0
- /package/{src/lib → lib}/xle/browser.d.ts +0 -0
- /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
- /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
- /package/{src/schemas → schemas}/template-schema.mjs +0 -0
- /package/{src/types → types}/config.d.ts +0 -0
- /package/{src/types → types}/doc.d.ts +0 -0
- /package/{src/types → types}/doctor.d.ts +0 -0
- /package/{src/types → types}/error-codes.d.ts +0 -0
- /package/{src/types → types}/integration.d.ts +0 -0
- /package/{src/types → types}/manifest.d.ts +0 -0
- /package/{src/types → types}/search.d.ts +0 -0
- /package/{src/types → types}/template.d.ts +0 -0
- /package/{src/types → types}/validate-integration.d.ts +0 -0
- /package/{src/utils → utils}/github.mjs +0 -0
- /package/{src/utils → utils}/path-safety.test.mjs +0 -0
- /package/{src/utils → utils}/paths.test.mjs +0 -0
- /package/{src/utils → utils}/semver.mjs +0 -0
- /package/{src/utils → utils}/semver.test.mjs +0 -0
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {discoverComponents, findComponentReadme, resolveImportPath} from './component-discovery.mjs';
|
|
8
8
|
import {loadDocs} from './component-loader.mjs';
|
|
9
|
+
import {getCliInvocation} from '../utils/package-manager.mjs';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Derive the `defineTheme` component-override key from a theming target.
|
|
@@ -18,15 +19,19 @@ import {loadDocs} from './component-loader.mjs';
|
|
|
18
19
|
* Keep the `astryx-` literal in sync with packages/core/src/naming.ts
|
|
19
20
|
* (NAMESPACE / classPrefix), the same way build-theme.mjs mirrors it.
|
|
20
21
|
* <!-- SYNC: packages/core/src/naming.ts (namespace prefix source of truth) -->
|
|
22
|
+
* @param {import('../../core/src/docs-types').ThemingTarget} target
|
|
23
|
+
* @returns {string}
|
|
21
24
|
*/
|
|
22
25
|
function targetKey(target) {
|
|
23
26
|
return target.className.replace(/^astryx-/, '');
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
/** @param {string} name @returns {string} */
|
|
26
30
|
function dataAttrForName(name) {
|
|
27
31
|
return `data-${name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()}`;
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
/** @param {import('../../core/src/docs-types').ThemingTarget} target @returns {string[]} */
|
|
30
35
|
function getTargetDataAttributes(target) {
|
|
31
36
|
return [
|
|
32
37
|
...(target.visualProps || []).map(dataAttrForName),
|
|
@@ -42,13 +47,17 @@ function getTargetDataAttributes(target) {
|
|
|
42
47
|
* than the header has columns gets the excess *discarded*, so an unescaped
|
|
43
48
|
* `gap: 0 | 0.5 | ...` silently eats its own Default and Description columns.
|
|
44
49
|
* <!-- SYNC: packages/core/src/Markdown/parser.ts (splits on unescaped pipes) -->
|
|
50
|
+
* @param {unknown} value
|
|
51
|
+
* @returns {string}
|
|
45
52
|
*/
|
|
46
53
|
export function mdCell(value) {
|
|
47
54
|
return String(value ?? '').replace(/\|/g, '\\|');
|
|
48
55
|
}
|
|
49
56
|
|
|
57
|
+
/** @param {import('../../core/src/docs-types').PropDoc[]} [props] @returns {string} */
|
|
50
58
|
function formatPropsTable(props) {
|
|
51
59
|
if (!props || props.length === 0) return '';
|
|
60
|
+
/** @type {string[]} */
|
|
52
61
|
const lines = [];
|
|
53
62
|
lines.push('| Prop | Type | Default | Description |');
|
|
54
63
|
lines.push('|------|------|---------|-------------|');
|
|
@@ -71,6 +80,8 @@ function formatPropsTable(props) {
|
|
|
71
80
|
* and was being printed literally as the string "undefined". Emit the
|
|
72
81
|
* description only when present, and when there are no inline props point the
|
|
73
82
|
* reader at the sub-component's own docs instead of a blank/`undefined` block.
|
|
83
|
+
* @param {any} comp
|
|
84
|
+
* @returns {string[]}
|
|
74
85
|
*/
|
|
75
86
|
function formatSubComponent(comp) {
|
|
76
87
|
const out = [`### ${comp.name}\n`];
|
|
@@ -81,7 +92,7 @@ function formatSubComponent(comp) {
|
|
|
81
92
|
if (table) {
|
|
82
93
|
out.push(table + '\n');
|
|
83
94
|
} else {
|
|
84
|
-
out.push(`See
|
|
95
|
+
out.push(`See \`${getCliInvocation()} component ${comp.name}\` for props and usage.\n`);
|
|
85
96
|
}
|
|
86
97
|
return out;
|
|
87
98
|
}
|
|
@@ -91,6 +102,9 @@ function formatSubComponent(comp) {
|
|
|
91
102
|
* the visualProps and the variant prop in the component's props list.
|
|
92
103
|
* Returns an array of variant strings from the `variant` prop type,
|
|
93
104
|
* or the variants from target visualProps.
|
|
105
|
+
* @param {import('../../core/src/docs-types').ThemingTarget} target
|
|
106
|
+
* @param {any} docs
|
|
107
|
+
* @returns {string[]}
|
|
94
108
|
*/
|
|
95
109
|
function getTargetVariants(target, docs) {
|
|
96
110
|
if (!target.visualProps?.length) return [];
|
|
@@ -98,12 +112,12 @@ function getTargetVariants(target, docs) {
|
|
|
98
112
|
// If variant is a visualProp, try to resolve the actual variant values from props
|
|
99
113
|
if (target.visualProps.includes('variant')) {
|
|
100
114
|
const allProps = docs.props || (docs.components?.[0]?.props) || [];
|
|
101
|
-
const variantProp = allProps.find(p => p.name === 'variant');
|
|
115
|
+
const variantProp = allProps.find((/** @type {any} */ p) => p.name === 'variant');
|
|
102
116
|
if (variantProp && variantProp.type.includes('|')) {
|
|
103
117
|
return variantProp.type
|
|
104
118
|
.replace(/['"]/g, '')
|
|
105
119
|
.split('|')
|
|
106
|
-
.map(v => v.trim())
|
|
120
|
+
.map((/** @type {string} */ v) => v.trim())
|
|
107
121
|
.filter(Boolean);
|
|
108
122
|
}
|
|
109
123
|
}
|
|
@@ -114,6 +128,8 @@ function getTargetVariants(target, docs) {
|
|
|
114
128
|
|
|
115
129
|
/**
|
|
116
130
|
* Get the state classes for a theming target from the states field.
|
|
131
|
+
* @param {import('../../core/src/docs-types').ThemingTarget} target
|
|
132
|
+
* @returns {string[]}
|
|
117
133
|
*/
|
|
118
134
|
function getTargetStates(target) {
|
|
119
135
|
return target.states || [];
|
|
@@ -122,13 +138,14 @@ function getTargetStates(target) {
|
|
|
122
138
|
/**
|
|
123
139
|
* Format the theming targets table, merging in theme variants if available.
|
|
124
140
|
*
|
|
125
|
-
* @param {
|
|
126
|
-
* @param {
|
|
141
|
+
* @param {any} docs - Component doc object
|
|
142
|
+
* @param {any} themeData - Resolved theme data with variants
|
|
127
143
|
* @returns {string} Markdown table
|
|
128
144
|
*/
|
|
129
145
|
function formatTargetsTable(docs, themeData) {
|
|
130
146
|
if (!docs.theming?.targets?.length) return '';
|
|
131
147
|
|
|
148
|
+
/** @type {string[]} */
|
|
132
149
|
const lines = [];
|
|
133
150
|
lines.push('| Component class | Preferred data attributes | Props | States |');
|
|
134
151
|
lines.push('|-----------------|---------------------------|-------|--------|');
|
|
@@ -145,7 +162,7 @@ function formatTargetsTable(docs, themeData) {
|
|
|
145
162
|
// Build variant display: core variants plain, theme variants with * suffix
|
|
146
163
|
const variantParts = [
|
|
147
164
|
...coreVariants,
|
|
148
|
-
...themeVariants.map(v => `${v}*`),
|
|
165
|
+
...themeVariants.map((/** @type {string} */ v) => `${v}*`),
|
|
149
166
|
];
|
|
150
167
|
|
|
151
168
|
const variantsStr = variantParts.length > 0 ? variantParts.join(', ') : '—';
|
|
@@ -165,12 +182,13 @@ function formatTargetsTable(docs, themeData) {
|
|
|
165
182
|
/**
|
|
166
183
|
* Format full component docs (default mode, replaces cleanReadme).
|
|
167
184
|
*
|
|
168
|
-
* @param {
|
|
185
|
+
* @param {any} docs - Component doc object
|
|
169
186
|
* @param {object} [options] - Options
|
|
170
|
-
* @param {
|
|
187
|
+
* @param {any} [options.themeData] - Resolved theme data
|
|
171
188
|
* @param {string|null} [options.importHint] - Import path hint (e.g. '@astryxdesign/core/Button')
|
|
172
189
|
*/
|
|
173
190
|
export function formatFull(docs, options = {}) {
|
|
191
|
+
/** @type {string[]} */
|
|
174
192
|
const sections = [];
|
|
175
193
|
|
|
176
194
|
sections.push(`# ${docs.name}\n`);
|
|
@@ -244,8 +262,8 @@ export function formatFull(docs, options = {}) {
|
|
|
244
262
|
|
|
245
263
|
// Note about theme variants if any are present
|
|
246
264
|
if (themeData?.variants) {
|
|
247
|
-
const componentKeys = docs.theming.targets.map(t => targetKey(t));
|
|
248
|
-
const hasThemeVariants = componentKeys.some(k => themeData.variants[k]?.length > 0);
|
|
265
|
+
const componentKeys = docs.theming.targets.map((/** @type {any} */ t) => targetKey(t));
|
|
266
|
+
const hasThemeVariants = componentKeys.some((/** @type {any} */ k) => themeData.variants[k]?.length > 0);
|
|
249
267
|
if (hasThemeVariants) {
|
|
250
268
|
sections.push(`_\\* = custom variant from ${themeData.name || 'active'} theme_\n`);
|
|
251
269
|
}
|
|
@@ -289,7 +307,7 @@ export function formatFull(docs, options = {}) {
|
|
|
289
307
|
|
|
290
308
|
// Component CSS vars — split into public (directly settable) and private (set via derived)
|
|
291
309
|
if (docs.theming?.vars?.length) {
|
|
292
|
-
const publicVars = docs.theming.vars.filter(v => !v.private && !v.derived);
|
|
310
|
+
const publicVars = docs.theming.vars.filter((/** @type {any} */ v) => !v.private && !v.derived);
|
|
293
311
|
|
|
294
312
|
if (publicVars.length > 0) {
|
|
295
313
|
sections.push('**Themeable CSS variables** — additional properties that can be overridden in `defineTheme` component overrides.\n');
|
|
@@ -308,12 +326,12 @@ export function formatFull(docs, options = {}) {
|
|
|
308
326
|
if (docs.theming?.derived?.length) {
|
|
309
327
|
const varsKey = docs.theming.targets?.length ? targetKey(docs.theming.targets[0]) : docs.theming.componentKey || '';
|
|
310
328
|
const derivedExamples = docs.theming.derived
|
|
311
|
-
.filter(d => d.vars?.length)
|
|
312
|
-
.map(d => ` ${d.property}: '...',`)
|
|
329
|
+
.filter((/** @type {any} */ d) => d.vars?.length)
|
|
330
|
+
.map((/** @type {any} */ d) => ` ${d.property}: '...',`)
|
|
313
331
|
.join('\n');
|
|
314
332
|
const expandExamples = docs.theming.derived
|
|
315
|
-
.filter(d => d.expand === 'container')
|
|
316
|
-
.map(d => ` ${d.property}: '...', // expands to container layout tokens`)
|
|
333
|
+
.filter((/** @type {any} */ d) => d.expand === 'container')
|
|
334
|
+
.map((/** @type {any} */ d) => ` ${d.property}: '...', // expands to container layout tokens`)
|
|
317
335
|
.join('\n');
|
|
318
336
|
const allExamples = [derivedExamples, expandExamples].filter(Boolean).join('\n');
|
|
319
337
|
if (allExamples) {
|
|
@@ -330,6 +348,10 @@ export function formatFull(docs, options = {}) {
|
|
|
330
348
|
/**
|
|
331
349
|
* Format compact docs for LLM consumption (replaces extractCompact + ensureImportStatement).
|
|
332
350
|
* Includes: import, best practices, props, theming.
|
|
351
|
+
* @param {any} docs
|
|
352
|
+
* @param {string} componentName
|
|
353
|
+
* @param {string} [importHint]
|
|
354
|
+
* @returns {string}
|
|
333
355
|
*/
|
|
334
356
|
export function formatCompact(docs, componentName, importHint) {
|
|
335
357
|
// Bare name (un-prefix migration P5a): the CLI now presents component names
|
|
@@ -338,6 +360,7 @@ export function formatCompact(docs, componentName, importHint) {
|
|
|
338
360
|
? componentName.slice(3)
|
|
339
361
|
: componentName;
|
|
340
362
|
|
|
363
|
+
/** @type {string[]} */
|
|
341
364
|
const sections = [];
|
|
342
365
|
|
|
343
366
|
sections.push(`# ${docs.name}\n`);
|
|
@@ -345,7 +368,7 @@ export function formatCompact(docs, componentName, importHint) {
|
|
|
345
368
|
sections.push(desc + '\n');
|
|
346
369
|
|
|
347
370
|
if (docs.usage?.anatomy?.length) {
|
|
348
|
-
sections.push('Anatomy: ' + docs.usage.anatomy.map(el => {
|
|
371
|
+
sections.push('Anatomy: ' + docs.usage.anatomy.map((/** @type {any} */ el) => {
|
|
349
372
|
const req = el.required ? '' : ' (optional)';
|
|
350
373
|
return `${el.name}${req}`;
|
|
351
374
|
}).join(', ') + '\n');
|
|
@@ -395,7 +418,7 @@ export function formatCompact(docs, componentName, importHint) {
|
|
|
395
418
|
propLines.push('| CSS Property | Sets |');
|
|
396
419
|
propLines.push('|-------------|------|');
|
|
397
420
|
for (const d of docs.theming.derived) {
|
|
398
|
-
const target = d.expand === 'container' ? 'container layout tokens' : (d.vars || []).map(v => `\`${mdCell(v)}\``).join(', ');
|
|
421
|
+
const target = d.expand === 'container' ? 'container layout tokens' : (d.vars || []).map((/** @type {any} */ v) => `\`${mdCell(v)}\``).join(', ');
|
|
399
422
|
propLines.push(`| \`${mdCell(d.property)}\` | ${target} |`);
|
|
400
423
|
}
|
|
401
424
|
sections.push(propLines.join('\n') + '\n');
|
|
@@ -425,12 +448,20 @@ export function formatCompact(docs, componentName, importHint) {
|
|
|
425
448
|
*/
|
|
426
449
|
const SIGNATURE_UNION_MAX_MEMBERS = 8;
|
|
427
450
|
|
|
451
|
+
/**
|
|
452
|
+
* @param {any} docs
|
|
453
|
+
* @param {string} componentName
|
|
454
|
+
* @param {string} [importHint]
|
|
455
|
+
* @param {{themeData?: any}} [options]
|
|
456
|
+
* @returns {string}
|
|
457
|
+
*/
|
|
428
458
|
export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
429
459
|
const displayName = componentName.startsWith('XDS')
|
|
430
460
|
? componentName.slice(3)
|
|
431
461
|
: componentName;
|
|
432
462
|
|
|
433
463
|
// Find the right props and examples for this component
|
|
464
|
+
/** @type {any[]} */
|
|
434
465
|
let props = [];
|
|
435
466
|
let description = docs.usage?.description || docs.description || '';
|
|
436
467
|
let examples = docs.examples || [];
|
|
@@ -438,7 +469,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
438
469
|
if ('props' in docs) {
|
|
439
470
|
props = docs.props;
|
|
440
471
|
} else if ('components' in docs) {
|
|
441
|
-
const entry = docs.components.find(c => c.name === displayName);
|
|
472
|
+
const entry = docs.components.find((/** @type {any} */ c) => c.name === displayName);
|
|
442
473
|
if (entry) {
|
|
443
474
|
props = entry.props;
|
|
444
475
|
description = entry.description;
|
|
@@ -447,7 +478,9 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
447
478
|
}
|
|
448
479
|
|
|
449
480
|
// Build signature from union-type props
|
|
481
|
+
/** @type {string[]} */
|
|
450
482
|
const signatureProps = [];
|
|
483
|
+
/** @type {string[]} */
|
|
451
484
|
const otherProps = [];
|
|
452
485
|
|
|
453
486
|
for (const prop of props) {
|
|
@@ -456,7 +489,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
456
489
|
? prop.type
|
|
457
490
|
.replace(/['"]/g, '')
|
|
458
491
|
.split('|')
|
|
459
|
-
.map(v => v.trim())
|
|
492
|
+
.map((/** @type {string} */ v) => v.trim())
|
|
460
493
|
: null;
|
|
461
494
|
if (values && values.length <= SIGNATURE_UNION_MAX_MEMBERS) {
|
|
462
495
|
signatureProps.push(`${prop.name}: ${values.join('|')}`);
|
|
@@ -468,6 +501,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
468
501
|
}
|
|
469
502
|
|
|
470
503
|
// Build output
|
|
504
|
+
/** @type {string[]} */
|
|
471
505
|
const output = [];
|
|
472
506
|
|
|
473
507
|
// Signature line
|
|
@@ -489,8 +523,8 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
489
523
|
// Component vars (if any — only show public vars)
|
|
490
524
|
if (docs.theming?.vars?.length) {
|
|
491
525
|
const varNames = docs.theming.vars
|
|
492
|
-
.filter(v => !v.derived && !v.private)
|
|
493
|
-
.map(v => `${v.name} (${v.default})`)
|
|
526
|
+
.filter((/** @type {any} */ v) => !v.derived && !v.private)
|
|
527
|
+
.map((/** @type {any} */ v) => `${v.name} (${v.default})`)
|
|
494
528
|
.join(', ');
|
|
495
529
|
if (varNames) {
|
|
496
530
|
output.push(` Vars: ${varNames}`);
|
|
@@ -500,7 +534,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
500
534
|
// Derived properties (if any)
|
|
501
535
|
if (docs.theming?.derived?.length) {
|
|
502
536
|
const derivedNames = docs.theming.derived
|
|
503
|
-
.map(d => d.expand === 'container' ? `${d.property} → container tokens` : `${d.property} → ${(d.vars || []).join(', ')}`)
|
|
537
|
+
.map((/** @type {any} */ d) => d.expand === 'container' ? `${d.property} → container tokens` : `${d.property} → ${(d.vars || []).join(', ')}`)
|
|
504
538
|
.join('; ');
|
|
505
539
|
output.push(` Derived: ${derivedNames}`);
|
|
506
540
|
}
|
|
@@ -508,7 +542,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
508
542
|
// Theme targets (component class, preferred data attrs, props, states) with theme variant merging
|
|
509
543
|
if (docs.theming?.targets?.length) {
|
|
510
544
|
const { themeData = null } = options;
|
|
511
|
-
const targetParts = docs.theming.targets.map(t => {
|
|
545
|
+
const targetParts = docs.theming.targets.map((/** @type {any} */ t) => {
|
|
512
546
|
const parts = [t.className];
|
|
513
547
|
const dataAttrs = getTargetDataAttributes(t);
|
|
514
548
|
if (dataAttrs.length) parts.push(`preferred attrs: ${dataAttrs.join(', ')}`);
|
|
@@ -517,7 +551,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
517
551
|
// Merge theme variants
|
|
518
552
|
const componentKey = targetKey(t);
|
|
519
553
|
const themeVars = themeData?.variants?.[componentKey];
|
|
520
|
-
if (themeVars?.length) parts.push(`theme: ${themeVars.map(v => v + '*').join(', ')}`);
|
|
554
|
+
if (themeVars?.length) parts.push(`theme: ${themeVars.map((/** @type {any} */ v) => v + '*').join(', ')}`);
|
|
521
555
|
return parts.join(' ');
|
|
522
556
|
});
|
|
523
557
|
output.push(` Targets: ${targetParts.join(' | ')}`);
|
|
@@ -532,7 +566,7 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
532
566
|
if (examples.length > 0) {
|
|
533
567
|
const code = examples[0].code;
|
|
534
568
|
const codeLine =
|
|
535
|
-
code.split('\n').find(l => l.trim().startsWith('<XDS')) ||
|
|
569
|
+
code.split('\n').find((/** @type {string} */ l) => l.trim().startsWith('<XDS')) ||
|
|
536
570
|
code.split('\n')[0];
|
|
537
571
|
output.push(` ${codeLine.trim()}`);
|
|
538
572
|
}
|
|
@@ -542,6 +576,9 @@ export function formatBrief(docs, componentName, importHint, options = {}) {
|
|
|
542
576
|
|
|
543
577
|
/**
|
|
544
578
|
* Format only the props tables (replaces extractProps).
|
|
579
|
+
* @param {any} docs
|
|
580
|
+
* @param {string} componentName
|
|
581
|
+
* @returns {string}
|
|
545
582
|
*/
|
|
546
583
|
export function formatProps(docs, componentName) {
|
|
547
584
|
if ('props' in docs) {
|
|
@@ -549,6 +586,7 @@ export function formatProps(docs, componentName) {
|
|
|
549
586
|
}
|
|
550
587
|
|
|
551
588
|
if ('components' in docs) {
|
|
589
|
+
/** @type {string[]} */
|
|
552
590
|
const sections = [];
|
|
553
591
|
for (const comp of docs.components) {
|
|
554
592
|
sections.push(`### ${comp.name} Props\n`);
|
|
@@ -562,9 +600,13 @@ export function formatProps(docs, componentName) {
|
|
|
562
600
|
|
|
563
601
|
/**
|
|
564
602
|
* Format brief summaries for ALL components in one output.
|
|
603
|
+
* @param {string} coreDir
|
|
604
|
+
* @param {{zh?: boolean, lang?: string, themeData?: any}} [options]
|
|
605
|
+
* @returns {Promise<string>}
|
|
565
606
|
*/
|
|
566
607
|
export async function formatBriefAll(coreDir, {zh = false, lang, themeData = null} = {}) {
|
|
567
608
|
const components = discoverComponents(coreDir);
|
|
609
|
+
/** @type {string[]} */
|
|
568
610
|
const output = [];
|
|
569
611
|
|
|
570
612
|
for (const [key, comps] of Object.entries(components)) {
|
|
@@ -37,6 +37,7 @@ export async function loadComponentDoc(
|
|
|
37
37
|
{zh = false, dense = false, lang} = {},
|
|
38
38
|
) {
|
|
39
39
|
const mod = await importUserModule(docPath);
|
|
40
|
+
/** @type {any} */
|
|
40
41
|
const authored = mod?.default ?? mod?.docs;
|
|
41
42
|
|
|
42
43
|
const result = ComponentDocSchema.safeParse(authored);
|
|
@@ -52,16 +53,23 @@ export async function loadComponentDoc(
|
|
|
52
53
|
locale === 'zh' ? 'docsZh' : locale === 'dense' ? 'docsDense' : null;
|
|
53
54
|
if (!translationKey || !mod[translationKey]) return docs;
|
|
54
55
|
|
|
56
|
+
/** @type {any} */
|
|
55
57
|
const translation = mod[translationKey];
|
|
56
|
-
if (translation.props || translation.components?.some(c => c.props)) {
|
|
58
|
+
if (translation.props || translation.components?.some((/** @type {any} */ c) => c.props)) {
|
|
57
59
|
return translation;
|
|
58
60
|
}
|
|
59
61
|
return mergeTranslation(docs, translation);
|
|
60
62
|
}
|
|
61
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @param {any} docs
|
|
66
|
+
* @param {any} translation
|
|
67
|
+
* @returns {any}
|
|
68
|
+
*/
|
|
62
69
|
export function mergeTranslation(docs, translation) {
|
|
63
70
|
if (!translation) return docs;
|
|
64
71
|
|
|
72
|
+
/** @type {any} */
|
|
65
73
|
const merged = {...docs};
|
|
66
74
|
|
|
67
75
|
// Merge prose into usage
|
|
@@ -77,7 +85,7 @@ export function mergeTranslation(docs, translation) {
|
|
|
77
85
|
|
|
78
86
|
// Merge prop descriptions for single-component docs
|
|
79
87
|
if (translation.propDescriptions && merged.props) {
|
|
80
|
-
merged.props = merged.props.map(prop => {
|
|
88
|
+
merged.props = merged.props.map((/** @type {any} */ prop) => {
|
|
81
89
|
const desc = translation.propDescriptions[prop.name];
|
|
82
90
|
return desc != null ? {...prop, description: desc} : prop;
|
|
83
91
|
});
|
|
@@ -88,7 +96,7 @@ export function mergeTranslation(docs, translation) {
|
|
|
88
96
|
// translation has an entry. Names may include dots (e.g. 'options.isActive');
|
|
89
97
|
// the lookup is keyed by the exact param name.
|
|
90
98
|
if (translation.paramDescriptions && merged.params) {
|
|
91
|
-
merged.params = merged.params.map(param => {
|
|
99
|
+
merged.params = merged.params.map((/** @type {any} */ param) => {
|
|
92
100
|
const desc = translation.paramDescriptions[param.name];
|
|
93
101
|
return desc != null ? {...param, description: desc} : param;
|
|
94
102
|
});
|
|
@@ -97,7 +105,7 @@ export function mergeTranslation(docs, translation) {
|
|
|
97
105
|
// Merge hook return descriptions (HookTranslationDoc). Returns are an array
|
|
98
106
|
// of {name, type, description}; override description by name where present.
|
|
99
107
|
if (translation.returnDescriptions && merged.returns) {
|
|
100
|
-
merged.returns = merged.returns.map(ret => {
|
|
108
|
+
merged.returns = merged.returns.map((/** @type {any} */ ret) => {
|
|
101
109
|
const desc = translation.returnDescriptions[ret.name];
|
|
102
110
|
return desc != null ? {...ret, description: desc} : ret;
|
|
103
111
|
});
|
|
@@ -105,15 +113,15 @@ export function mergeTranslation(docs, translation) {
|
|
|
105
113
|
|
|
106
114
|
// Merge sub-component translations
|
|
107
115
|
if (translation.components && merged.components) {
|
|
108
|
-
merged.components = merged.components.map((comp, i) => {
|
|
109
|
-
const trans = translation.components.find(t => t.name === comp.name)
|
|
116
|
+
merged.components = merged.components.map((/** @type {any} */ comp, /** @type {any} */ i) => {
|
|
117
|
+
const trans = translation.components.find((/** @type {any} */ t) => t.name === comp.name)
|
|
110
118
|
|| translation.components[i];
|
|
111
119
|
if (!trans) return comp;
|
|
112
120
|
|
|
113
121
|
const mergedComp = {...comp};
|
|
114
122
|
if (trans.description) mergedComp.description = trans.description;
|
|
115
123
|
if (trans.propDescriptions && comp.props) {
|
|
116
|
-
mergedComp.props = comp.props.map(prop => {
|
|
124
|
+
mergedComp.props = comp.props.map((/** @type {any} */ prop) => {
|
|
117
125
|
const desc = trans.propDescriptions[prop.name];
|
|
118
126
|
return desc != null ? {...prop, description: desc} : prop;
|
|
119
127
|
});
|
|
@@ -130,6 +138,9 @@ export function mergeTranslation(docs, translation) {
|
|
|
130
138
|
* Supports --lang flag: 'zh' for Chinese, 'dense' for compressed format.
|
|
131
139
|
* Also supports legacy --zh and --dense flags.
|
|
132
140
|
* Translations are merged onto the base docs, keeping structure intact.
|
|
141
|
+
* @param {string} readmePath
|
|
142
|
+
* @param {{zh?: boolean, dense?: boolean, lang?: string}} [opts]
|
|
143
|
+
* @returns {Promise<any>}
|
|
133
144
|
*/
|
|
134
145
|
export async function loadDocs(readmePath, {zh = false, dense = false, lang} = {}) {
|
|
135
146
|
const mod = await import(pathToFileURL(readmePath).href);
|
|
@@ -151,7 +162,7 @@ export async function loadDocs(readmePath, {zh = false, dense = false, lang} = {
|
|
|
151
162
|
// `isIconOnly`. A reader of the translated docs cannot discover a prop that
|
|
152
163
|
// is not there. Overlay it instead, so an untranslated prop falls back to
|
|
153
164
|
// its English entry. (Same principle as the reference-doc overlays, #2182.)
|
|
154
|
-
if (translation.props || translation.components?.some(c => c.props)) {
|
|
165
|
+
if (translation.props || translation.components?.some((/** @type {any} */ c) => c.props)) {
|
|
155
166
|
return overlayComponentDoc(docs, translation);
|
|
156
167
|
}
|
|
157
168
|
|
|
@@ -172,11 +183,14 @@ export async function loadDocs(readmePath, {zh = false, dense = false, lang} = {
|
|
|
172
183
|
* @returns {any} Merged doc with every base prop present.
|
|
173
184
|
*/
|
|
174
185
|
function overlayComponentDoc(docs, translation) {
|
|
175
|
-
/** Merge one prop list: keep base entries and order, translate what's covered.
|
|
186
|
+
/** Merge one prop list: keep base entries and order, translate what's covered.
|
|
187
|
+
* @param {any[] | undefined} baseProps
|
|
188
|
+
* @param {any[] | undefined} tProps
|
|
189
|
+
*/
|
|
176
190
|
const overlayProps = (baseProps, tProps) => {
|
|
177
191
|
if (!baseProps) return baseProps;
|
|
178
|
-
const byName = new Map((tProps ?? []).map(p => [p.name, p]));
|
|
179
|
-
return baseProps.map(prop => {
|
|
192
|
+
const byName = new Map((tProps ?? []).map((/** @type {any} */ p) => [p.name, p]));
|
|
193
|
+
return baseProps.map((/** @type {any} */ prop) => {
|
|
180
194
|
const t = byName.get(prop.name);
|
|
181
195
|
// Take the translated text, but never let it drop the prop's contract
|
|
182
196
|
// (type/default/required stay authoritative from the English doc).
|
|
@@ -190,9 +204,9 @@ function overlayComponentDoc(docs, translation) {
|
|
|
190
204
|
|
|
191
205
|
if (docs.components) {
|
|
192
206
|
const tByName = new Map(
|
|
193
|
-
(translation.components ?? []).map(c => [c.name, c]),
|
|
207
|
+
(translation.components ?? []).map((/** @type {any} */ c) => [c.name, c]),
|
|
194
208
|
);
|
|
195
|
-
merged.components = docs.components.map(base => {
|
|
209
|
+
merged.components = docs.components.map((/** @type {any} */ base) => {
|
|
196
210
|
const t = tByName.get(base.name);
|
|
197
211
|
if (!t) return base;
|
|
198
212
|
return {...base, ...t, props: overlayProps(base.props, t.props)};
|
|
@@ -21,7 +21,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
21
21
|
import {ERROR_CODES, isErrorCode, allErrorCodes} from './error-codes.mjs';
|
|
22
22
|
|
|
23
23
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
const CLI_BIN = path.resolve(__dirname, '
|
|
24
|
+
const CLI_BIN = path.resolve(__dirname, '../bin/astryx.mjs');
|
|
25
25
|
|
|
26
26
|
function runCli(args, {cwd} = {}) {
|
|
27
27
|
const res = spawnSync('node', [CLI_BIN, ...args], {
|
|
@@ -15,6 +15,8 @@ const CATEGORY_RE = /(?:^|\n) {0,4}category:\s*['"]([^'"]+)['"]/;
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Read the `category` field from a hook's .doc.mjs file (synchronous).
|
|
18
|
+
* @param {string} docPath
|
|
19
|
+
* @returns {{category: string | null}}
|
|
18
20
|
*/
|
|
19
21
|
function readHookMeta(docPath) {
|
|
20
22
|
try {
|
|
@@ -31,6 +33,8 @@ function readHookMeta(docPath) {
|
|
|
31
33
|
/**
|
|
32
34
|
* Extract the hook name from a doc filename.
|
|
33
35
|
* e.g. 'useFocusTrap.doc.mjs' → 'useFocusTrap'
|
|
36
|
+
* @param {string} fileName
|
|
37
|
+
* @returns {string}
|
|
34
38
|
*/
|
|
35
39
|
function hookNameFromFile(fileName) {
|
|
36
40
|
return fileName.replace('.doc.mjs', '');
|
|
@@ -41,6 +45,8 @@ function hookNameFromFile(fileName) {
|
|
|
41
45
|
* Returns Record<category, hookName[]> similar to discoverComponents.
|
|
42
46
|
* Categories from HookDoc.category: focus, layout, animation, interaction, data, media, streaming
|
|
43
47
|
* Hooks without a category go in 'Other'.
|
|
48
|
+
* @param {string} coreDir
|
|
49
|
+
* @returns {Record<string, string[]>}
|
|
44
50
|
*/
|
|
45
51
|
export function discoverHooks(coreDir) {
|
|
46
52
|
const srcDir = path.join(coreDir, 'src');
|
|
@@ -77,7 +83,7 @@ export function discoverHooks(coreDir) {
|
|
|
77
83
|
const groups = new Map();
|
|
78
84
|
for (const [hookName, category] of hookCategories) {
|
|
79
85
|
if (!groups.has(category)) groups.set(category, []);
|
|
80
|
-
groups.get(category)
|
|
86
|
+
groups.get(category)?.push(hookName);
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
// Sort members within each group
|
|
@@ -103,6 +109,8 @@ export function discoverHooks(coreDir) {
|
|
|
103
109
|
|
|
104
110
|
/**
|
|
105
111
|
* Recursively scan a directory for use*.doc.mjs files.
|
|
112
|
+
* @param {string} dirPath
|
|
113
|
+
* @param {Map<string, string>} hookCategories
|
|
106
114
|
*/
|
|
107
115
|
function scanDirForHookDocs(dirPath, hookCategories) {
|
|
108
116
|
if (!fs.existsSync(dirPath)) return;
|
|
@@ -199,6 +207,9 @@ export function findHookDoc(coreDir, name) {
|
|
|
199
207
|
|
|
200
208
|
/**
|
|
201
209
|
* Recursively search a directory for a hook doc matching any of the candidate names.
|
|
210
|
+
* @param {string} dirPath
|
|
211
|
+
* @param {string[]} candidates
|
|
212
|
+
* @returns {string | null}
|
|
202
213
|
*/
|
|
203
214
|
function searchDirForHookDoc(dirPath, candidates) {
|
|
204
215
|
if (!fs.existsSync(dirPath)) return null;
|
|
@@ -221,6 +232,8 @@ function searchDirForHookDoc(dirPath, candidates) {
|
|
|
221
232
|
|
|
222
233
|
/**
|
|
223
234
|
* Get all discovered hook names as a flat array (for fuzzy matching).
|
|
235
|
+
* @param {string} coreDir
|
|
236
|
+
* @returns {string[]}
|
|
224
237
|
*/
|
|
225
238
|
export function getAllHookNames(coreDir) {
|
|
226
239
|
const hooks = discoverHooks(coreDir);
|
|
@@ -16,14 +16,16 @@ import {mdCell} from './component-format.mjs';
|
|
|
16
16
|
/**
|
|
17
17
|
* Build a signature string from hook docs.
|
|
18
18
|
* e.g. 'useFocusTrap(options: UseFocusTrapOptions): { containerRef, focusFirst }'
|
|
19
|
+
* @param {any} docs
|
|
20
|
+
* @returns {string}
|
|
19
21
|
*/
|
|
20
22
|
function buildSignature(docs) {
|
|
21
23
|
const name = docs.name;
|
|
22
24
|
|
|
23
25
|
// Build params string — only top-level params (skip options.foo nested params)
|
|
24
|
-
const topParams = (docs.params || []).filter(p => !p.name.includes('.'));
|
|
26
|
+
const topParams = (docs.params || []).filter((/** @type {any} */ p) => !p.name.includes('.'));
|
|
25
27
|
const paramStr = topParams
|
|
26
|
-
.map(p => {
|
|
28
|
+
.map((/** @type {any} */ p) => {
|
|
27
29
|
const opt = p.required ? '' : '?';
|
|
28
30
|
return `${p.name}${opt}: ${p.type}`;
|
|
29
31
|
})
|
|
@@ -37,7 +39,7 @@ function buildSignature(docs) {
|
|
|
37
39
|
} else if (returns.length === 1 && returns[0].name === 'value') {
|
|
38
40
|
returnStr = returns[0].type;
|
|
39
41
|
} else {
|
|
40
|
-
returnStr = `{ ${returns.map(r => r.name).join(', ')} }`;
|
|
42
|
+
returnStr = `{ ${returns.map((/** @type {any} */ r) => r.name).join(', ')} }`;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
return `${name}(${paramStr}): ${returnStr}`;
|
|
@@ -45,9 +47,12 @@ function buildSignature(docs) {
|
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* Format a parameters table (matches component props table style).
|
|
50
|
+
* @param {any[]} [params]
|
|
51
|
+
* @returns {string}
|
|
48
52
|
*/
|
|
49
53
|
function formatParamsTable(params) {
|
|
50
54
|
if (!params || params.length === 0) return '';
|
|
55
|
+
/** @type {string[]} */
|
|
51
56
|
const lines = [];
|
|
52
57
|
lines.push('| Param | Type | Default | Description |');
|
|
53
58
|
lines.push('|-------|------|---------|-------------|');
|
|
@@ -63,9 +68,12 @@ function formatParamsTable(params) {
|
|
|
63
68
|
|
|
64
69
|
/**
|
|
65
70
|
* Format a returns table.
|
|
71
|
+
* @param {any[]} [returns]
|
|
72
|
+
* @returns {string}
|
|
66
73
|
*/
|
|
67
74
|
function formatReturnsTable(returns) {
|
|
68
75
|
if (!returns || returns.length === 0) return '';
|
|
76
|
+
/** @type {string[]} */
|
|
69
77
|
const lines = [];
|
|
70
78
|
lines.push('| Field | Type | Description |');
|
|
71
79
|
lines.push('|-------|------|-------------|');
|
|
@@ -81,8 +89,11 @@ function formatReturnsTable(returns) {
|
|
|
81
89
|
* Format full hook docs (default mode).
|
|
82
90
|
* Matches component formatFull structure:
|
|
83
91
|
* # Name, description, anatomy→params, best practices, props→params+returns, theming→related
|
|
92
|
+
* @param {any} docs
|
|
93
|
+
* @returns {string}
|
|
84
94
|
*/
|
|
85
95
|
export function formatHookFull(docs) {
|
|
96
|
+
/** @type {string[]} */
|
|
86
97
|
const sections = [];
|
|
87
98
|
|
|
88
99
|
sections.push(`# ${docs.name}\n`);
|
|
@@ -119,8 +130,12 @@ export function formatHookFull(docs) {
|
|
|
119
130
|
* Format compact hook docs for LLM consumption.
|
|
120
131
|
* Matches component formatCompact structure:
|
|
121
132
|
* # Name, description, ## Import, ## Best Practices, ## Parameters, ## Returns
|
|
133
|
+
* @param {any} docs
|
|
134
|
+
* @param {string} [importPath]
|
|
135
|
+
* @returns {string}
|
|
122
136
|
*/
|
|
123
137
|
export function formatHookCompact(docs, importPath) {
|
|
138
|
+
/** @type {string[]} */
|
|
124
139
|
const sections = [];
|
|
125
140
|
|
|
126
141
|
sections.push(`# ${docs.name}\n`);
|
|
@@ -159,6 +174,7 @@ export function formatHookCompact(docs, importPath) {
|
|
|
159
174
|
}
|
|
160
175
|
|
|
161
176
|
// Related components (compact footer)
|
|
177
|
+
/** @type {string[]} */
|
|
162
178
|
const relatedParts = [];
|
|
163
179
|
if (docs.relatedComponents?.length) {
|
|
164
180
|
relatedParts.push(`Components: ${docs.relatedComponents.join(', ')}`);
|
|
@@ -181,8 +197,11 @@ export function formatHookCompact(docs, importPath) {
|
|
|
181
197
|
* signature ← from 'import/path'
|
|
182
198
|
* description
|
|
183
199
|
* key params
|
|
200
|
+
* @param {any} docs
|
|
201
|
+
* @returns {string}
|
|
184
202
|
*/
|
|
185
203
|
export function formatHookBrief(docs) {
|
|
204
|
+
/** @type {string[]} */
|
|
186
205
|
const output = [];
|
|
187
206
|
|
|
188
207
|
// Signature line with import hint (matches component brief)
|
|
@@ -204,8 +223,8 @@ export function formatHookBrief(docs) {
|
|
|
204
223
|
|
|
205
224
|
// Key params (matches component brief 'prop · prop' line)
|
|
206
225
|
const paramNames = (docs.params || [])
|
|
207
|
-
.filter(p => !p.name.includes('.'))
|
|
208
|
-
.map(p => p.required ? `${p.name}: ${p.type.split('|')[0].trim()}` : p.name);
|
|
226
|
+
.filter((/** @type {any} */ p) => !p.name.includes('.'))
|
|
227
|
+
.map((/** @type {any} */ p) => p.required ? `${p.name}: ${p.type.split('|')[0].trim()}` : p.name);
|
|
209
228
|
if (paramNames.length > 0) {
|
|
210
229
|
output.push(` ${paramNames.join(' \u00b7 ')}`);
|
|
211
230
|
}
|
|
@@ -216,9 +235,12 @@ export function formatHookBrief(docs) {
|
|
|
216
235
|
/**
|
|
217
236
|
* Format brief summaries for ALL hooks in one output.
|
|
218
237
|
* Matches component formatBriefAll: group headers with ##.
|
|
238
|
+
* @param {string} coreDir
|
|
239
|
+
* @returns {Promise<string>}
|
|
219
240
|
*/
|
|
220
241
|
export async function formatHookBriefAll(coreDir) {
|
|
221
242
|
const hooks = discoverHooks(coreDir);
|
|
243
|
+
/** @type {string[]} */
|
|
222
244
|
const output = [];
|
|
223
245
|
|
|
224
246
|
for (const [category, hookNames] of Object.entries(hooks)) {
|
|
@@ -243,6 +265,8 @@ export async function formatHookBriefAll(coreDir) {
|
|
|
243
265
|
|
|
244
266
|
/**
|
|
245
267
|
* Format only the parameters table (matches component formatProps).
|
|
268
|
+
* @param {any} docs
|
|
269
|
+
* @returns {string}
|
|
246
270
|
*/
|
|
247
271
|
export function formatHookParams(docs) {
|
|
248
272
|
if (docs.params?.length) {
|