@astryxdesign/cli 0.7.4-canary.626f01e → 0.7.4-canary.720bb10
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 +81 -80
- package/api/discover/_adapter.d.mts +49 -1
- package/api/discover/_adapter.mjs +117 -8
- package/api/discover/detail/item/item.mjs +31 -0
- package/api/discover/discover.mjs +26 -8
- package/api/discover/discover.type.d.mts +25 -0
- package/api/discover/discover.type.mjs +15 -1
- package/api/docs/_adapter.mjs +24 -4
- package/api/docs/docs.type.d.mts +10 -0
- package/api/docs/docs.type.mjs +4 -0
- package/api/docs/node/node.mjs +20 -3
- package/api/doctor/doctor.d.mts +34 -2
- package/api/doctor/doctor.mjs +109 -11
- package/api/doctor/doctor.test.mjs +7 -3
- package/api/doctor/icon-sets.test.mjs +111 -0
- package/api/icon/_adapter.d.mts +54 -0
- package/api/icon/_adapter.mjs +173 -0
- package/api/icon/_authoring.d.mts +42 -0
- package/api/icon/_authoring.mjs +628 -0
- package/api/icon/_options.d.mts +15 -0
- package/api/icon/_options.mjs +41 -0
- package/api/icon/_records.d.mts +47 -0
- package/api/icon/_records.mjs +69 -0
- package/api/icon/add/add.d.mts +14 -0
- package/api/icon/add/add.mjs +416 -0
- package/api/icon/detail/detail.d.mts +12 -0
- package/api/icon/detail/detail.mjs +88 -0
- package/api/icon/error-codes.test.mjs +334 -0
- package/api/icon/experimental-markers.test.mjs +93 -0
- package/api/icon/icon.d.mts +16 -0
- package/api/icon/icon.doc.d.mts +9 -0
- package/api/icon/icon.doc.mjs +91 -0
- package/api/icon/icon.mjs +96 -0
- package/api/icon/icon.test.mjs +374 -0
- package/api/icon/icon.type.d.mts +430 -0
- package/api/icon/icon.type.mjs +290 -0
- package/api/icon/iconAdd.doc.d.mts +6 -0
- package/api/icon/iconAdd.doc.mjs +146 -0
- package/api/icon/iconMap.doc.d.mts +6 -0
- package/api/icon/iconMap.doc.mjs +92 -0
- package/api/icon/iconNewDefinition.doc.d.mts +5 -0
- package/api/icon/iconNewDefinition.doc.mjs +101 -0
- package/api/icon/iconNewSet.doc.d.mts +5 -0
- package/api/icon/iconNewSet.doc.mjs +103 -0
- package/api/icon/iconUse.doc.d.mts +6 -0
- package/api/icon/iconUse.doc.mjs +70 -0
- package/api/icon/list/list.d.mts +11 -0
- package/api/icon/list/list.mjs +64 -0
- package/api/icon/map/map.d.mts +14 -0
- package/api/icon/map/map.mjs +122 -0
- package/api/icon/new-definition/new-definition.d.mts +12 -0
- package/api/icon/new-definition/new-definition.mjs +32 -0
- package/api/icon/new-definition/new-definition.undo.test.mjs +97 -0
- package/api/icon/new-set/new-set.d.mts +12 -0
- package/api/icon/new-set/new-set.mjs +32 -0
- package/api/icon/new-set/new-set.test.mjs +348 -0
- package/api/icon/search/search.d.mts +14 -0
- package/api/icon/search/search.mjs +50 -0
- package/api/icon/use/use.d.mts +15 -0
- package/api/icon/use/use.mjs +101 -0
- package/api/index.d.mts +6 -0
- package/api/index.mjs +6 -0
- package/api/integration/_adapter.d.mts +9 -0
- package/api/integration/_adapter.mjs +18 -0
- package/api/integration/add-contribution.d.mts +3 -12
- package/api/integration/add-contribution.mjs +7 -97
- package/api/integration/add-contribution.test.mjs +14 -10
- package/api/integration/add-helpers.d.mts +46 -0
- package/api/integration/add-helpers.mjs +106 -4
- package/api/integration/doc-stability.test.mjs +216 -0
- package/api/integration/example-checks.no-npm.test.mjs +140 -0
- package/api/integration/example-checks.test.mjs +776 -0
- package/api/integration/integration-authoring.type.d.mts +1 -0
- package/api/integration/integration-authoring.type.mjs +1 -0
- package/api/integration/pack-check.mjs +3 -0
- package/api/integration/pack-check.type.d.mts +9 -1
- package/api/integration/pack-check.type.mjs +4 -1
- package/api/integration/validate-installed-icon-sets.test.mjs +67 -0
- package/api/integration/validate-integration-case-disk.test.mjs +12 -2
- package/api/integration/validate-integration-gaps.test.mjs +36 -15
- package/api/integration/validate-integration.d.mts +11 -1
- package/api/integration/validate-integration.mjs +84 -5
- package/api/integration/validate-integration.type.d.mts +84 -0
- package/api/integration/validate-integration.type.mjs +44 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_gather-docs.mjs +40 -1
- package/api/search/_order.d.mts +1 -1
- package/api/search/_order.mjs +75 -6
- package/api/search/search.tie-order.test.mjs +39 -0
- package/api/template/_adapter.d.mts +13 -0
- package/api/template/_adapter.mjs +36 -0
- package/api/template/copy/copy.d.mts +5 -2
- package/api/template/copy/copy.mjs +19 -3
- package/api/template/show/show.d.mts +6 -1
- package/api/template/show/show.mjs +11 -2
- package/api/template/template-suffix.test.mjs +26 -0
- package/api/template/template.mjs +6 -2
- package/api/template/template.type.d.mts +53 -0
- package/api/template/template.type.mjs +15 -0
- package/api/upgrade/_adapter.d.mts +10 -2
- package/api/upgrade/_adapter.mjs +23 -4
- package/api/upgrade/run/run.mjs +4 -1
- package/assets/docs/tree/experimental.doc.mjs +31 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +48 -0
- package/assets/docs/tree/icon-set-files.doc.mjs +33 -0
- package/assets/docs/tree/icon-sets.doc.mjs +377 -0
- package/assets/icons/definitions/activity.doc.mjs +9 -0
- package/assets/icons/definitions/add.doc.mjs +9 -0
- package/assets/icons/definitions/adjustments.doc.mjs +9 -0
- package/assets/icons/definitions/announcement.doc.mjs +9 -0
- package/assets/icons/definitions/apps.doc.mjs +9 -0
- package/assets/icons/definitions/archive.doc.mjs +9 -0
- package/assets/icons/definitions/arrowDown.doc.mjs +10 -0
- package/assets/icons/definitions/arrowLeft.doc.mjs +9 -0
- package/assets/icons/definitions/arrowRight.doc.mjs +9 -0
- package/assets/icons/definitions/arrowUp.doc.mjs +10 -0
- package/assets/icons/definitions/arrowsUpDown.doc.mjs +10 -0
- package/assets/icons/definitions/attach.doc.mjs +9 -0
- package/assets/icons/definitions/audio.doc.mjs +9 -0
- package/assets/icons/definitions/bank.doc.mjs +9 -0
- package/assets/icons/definitions/bold.doc.mjs +9 -0
- package/assets/icons/definitions/bolt.doc.mjs +9 -0
- package/assets/icons/definitions/book.doc.mjs +9 -0
- package/assets/icons/definitions/bookmark.doc.mjs +9 -0
- package/assets/icons/definitions/bug.doc.mjs +9 -0
- package/assets/icons/definitions/building.doc.mjs +9 -0
- package/assets/icons/definitions/calendar.doc.mjs +10 -0
- package/assets/icons/definitions/cart.doc.mjs +9 -0
- package/assets/icons/definitions/chart.doc.mjs +9 -0
- package/assets/icons/definitions/check.doc.mjs +10 -0
- package/assets/icons/definitions/checkDouble.doc.mjs +10 -0
- package/assets/icons/definitions/chevronDown.doc.mjs +10 -0
- package/assets/icons/definitions/chevronLeft.doc.mjs +10 -0
- package/assets/icons/definitions/chevronRight.doc.mjs +10 -0
- package/assets/icons/definitions/chevronUp.doc.mjs +9 -0
- package/assets/icons/definitions/chevronsLeft.doc.mjs +10 -0
- package/assets/icons/definitions/chevronsRight.doc.mjs +10 -0
- package/assets/icons/definitions/click.doc.mjs +9 -0
- package/assets/icons/definitions/clipboard.doc.mjs +10 -0
- package/assets/icons/definitions/clock.doc.mjs +10 -0
- package/assets/icons/definitions/close.doc.mjs +10 -0
- package/assets/icons/definitions/code.doc.mjs +9 -0
- package/assets/icons/definitions/collapse.doc.mjs +9 -0
- package/assets/icons/definitions/compose.doc.mjs +9 -0
- package/assets/icons/definitions/conversation.doc.mjs +9 -0
- package/assets/icons/definitions/copy.doc.mjs +10 -0
- package/assets/icons/definitions/creditCard.doc.mjs +9 -0
- package/assets/icons/definitions/database.doc.mjs +9 -0
- package/assets/icons/definitions/delete.doc.mjs +9 -0
- package/assets/icons/definitions/desktop.doc.mjs +9 -0
- package/assets/icons/definitions/discount.doc.mjs +9 -0
- package/assets/icons/definitions/document.doc.mjs +9 -0
- package/assets/icons/definitions/download.doc.mjs +9 -0
- package/assets/icons/definitions/drag.doc.mjs +9 -0
- package/assets/icons/definitions/edit.doc.mjs +9 -0
- package/assets/icons/definitions/emoji.doc.mjs +9 -0
- package/assets/icons/definitions/error.doc.mjs +10 -0
- package/assets/icons/definitions/expand.doc.mjs +9 -0
- package/assets/icons/definitions/experiment.doc.mjs +9 -0
- package/assets/icons/definitions/externalLink.doc.mjs +10 -0
- package/assets/icons/definitions/eye.doc.mjs +9 -0
- package/assets/icons/definitions/eyeSlash.doc.mjs +10 -0
- package/assets/icons/definitions/file.doc.mjs +9 -0
- package/assets/icons/definitions/flag.doc.mjs +9 -0
- package/assets/icons/definitions/folder.doc.mjs +9 -0
- package/assets/icons/definitions/folderAdd.doc.mjs +9 -0
- package/assets/icons/definitions/funnel.doc.mjs +10 -0
- package/assets/icons/definitions/globe.doc.mjs +9 -0
- package/assets/icons/definitions/gridView.doc.mjs +9 -0
- package/assets/icons/definitions/heart.doc.mjs +9 -0
- package/assets/icons/definitions/home.doc.mjs +9 -0
- package/assets/icons/definitions/image.doc.mjs +9 -0
- package/assets/icons/definitions/inbox.doc.mjs +9 -0
- package/assets/icons/definitions/info.doc.mjs +10 -0
- package/assets/icons/definitions/italic.doc.mjs +9 -0
- package/assets/icons/definitions/key.doc.mjs +9 -0
- package/assets/icons/definitions/language.doc.mjs +9 -0
- package/assets/icons/definitions/lightbulb.doc.mjs +9 -0
- package/assets/icons/definitions/link.doc.mjs +9 -0
- package/assets/icons/definitions/list.doc.mjs +9 -0
- package/assets/icons/definitions/location.doc.mjs +9 -0
- package/assets/icons/definitions/lock.doc.mjs +9 -0
- package/assets/icons/definitions/mail.doc.mjs +9 -0
- package/assets/icons/definitions/mention.doc.mjs +9 -0
- package/assets/icons/definitions/menu.doc.mjs +10 -0
- package/assets/icons/definitions/message.doc.mjs +9 -0
- package/assets/icons/definitions/microphone.doc.mjs +10 -0
- package/assets/icons/definitions/mobile.doc.mjs +9 -0
- package/assets/icons/definitions/money.doc.mjs +9 -0
- package/assets/icons/definitions/moon.doc.mjs +9 -0
- package/assets/icons/definitions/moreHorizontal.doc.mjs +10 -0
- package/assets/icons/definitions/notification.doc.mjs +9 -0
- package/assets/icons/definitions/notificationActive.doc.mjs +9 -0
- package/assets/icons/definitions/notificationOff.doc.mjs +9 -0
- package/assets/icons/definitions/package.doc.mjs +9 -0
- package/assets/icons/definitions/pause.doc.mjs +9 -0
- package/assets/icons/definitions/pin.doc.mjs +9 -0
- package/assets/icons/definitions/play.doc.mjs +9 -0
- package/assets/icons/definitions/raiseHand.doc.mjs +9 -0
- package/assets/icons/definitions/redo.doc.mjs +9 -0
- package/assets/icons/definitions/refresh.doc.mjs +9 -0
- package/assets/icons/definitions/remove.doc.mjs +9 -0
- package/assets/icons/definitions/rocket.doc.mjs +9 -0
- package/assets/icons/definitions/save.doc.mjs +9 -0
- package/assets/icons/definitions/search.doc.mjs +10 -0
- package/assets/icons/definitions/send.doc.mjs +9 -0
- package/assets/icons/definitions/server.doc.mjs +9 -0
- package/assets/icons/definitions/settings.doc.mjs +9 -0
- package/assets/icons/definitions/share.doc.mjs +9 -0
- package/assets/icons/definitions/shield.doc.mjs +9 -0
- package/assets/icons/definitions/shipping.doc.mjs +9 -0
- package/assets/icons/definitions/shoppingBag.doc.mjs +9 -0
- package/assets/icons/definitions/sparkles.doc.mjs +9 -0
- package/assets/icons/definitions/star.doc.mjs +9 -0
- package/assets/icons/definitions/stop.doc.mjs +10 -0
- package/assets/icons/definitions/strikethrough.doc.mjs +9 -0
- package/assets/icons/definitions/success.doc.mjs +10 -0
- package/assets/icons/definitions/sun.doc.mjs +9 -0
- package/assets/icons/definitions/swatch.doc.mjs +9 -0
- package/assets/icons/definitions/table.doc.mjs +9 -0
- package/assets/icons/definitions/tag.doc.mjs +9 -0
- package/assets/icons/definitions/thumbsDown.doc.mjs +9 -0
- package/assets/icons/definitions/thumbsUp.doc.mjs +9 -0
- package/assets/icons/definitions/trendDown.doc.mjs +9 -0
- package/assets/icons/definitions/trendUp.doc.mjs +9 -0
- package/assets/icons/definitions/underline.doc.mjs +9 -0
- package/assets/icons/definitions/undo.doc.mjs +9 -0
- package/assets/icons/definitions/unlock.doc.mjs +9 -0
- package/assets/icons/definitions/upload.doc.mjs +10 -0
- package/assets/icons/definitions/user.doc.mjs +9 -0
- package/assets/icons/definitions/userAdd.doc.mjs +9 -0
- package/assets/icons/definitions/userCircle.doc.mjs +9 -0
- package/assets/icons/definitions/users.doc.mjs +9 -0
- package/assets/icons/definitions/video.doc.mjs +9 -0
- package/assets/icons/definitions/viewColumns.doc.mjs +10 -0
- package/assets/icons/definitions/warning.doc.mjs +10 -0
- package/assets/icons/definitions/work.doc.mjs +9 -0
- package/assets/icons/definitions/wrench.doc.mjs +10 -0
- package/assets/templates/blocks/components/AppShell/AppShellShowcase.doc.mjs +16 -3
- package/assets/templates/blocks/components/AppShell/AppShellSideNavOnly.doc.mjs +16 -1
- package/assets/templates/blocks/components/AppShell/AppShellTopNavOnly.doc.mjs +9 -1
- package/assets/templates/blocks/components/AppShell/AppShellTopNavWithSideNav.doc.mjs +17 -1
- package/assets/templates/blocks/components/AppShell/AppShellWithBanner.doc.mjs +18 -1
- package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +1 -0
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.doc.mjs +8 -0
- package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsDeepHierarchy.doc.mjs +1 -0
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsWithIcons.doc.mjs +1 -0
- package/assets/templates/blocks/components/Button/ButtonFloating.doc.mjs +1 -0
- package/assets/templates/blocks/components/Button/ButtonWithIcon.doc.mjs +6 -0
- package/assets/templates/blocks/components/ButtonGroup/ButtonGroupShowcase.doc.mjs +5 -0
- package/assets/templates/blocks/components/Center/CenterHorizontal.doc.mjs +8 -0
- package/assets/templates/blocks/components/Center/CenterInsideACard.doc.mjs +1 -0
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +5 -0
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFooterActions.doc.mjs +13 -1
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.doc.mjs +17 -1
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.doc.mjs +1 -0
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.doc.mjs +15 -1
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.doc.mjs +15 -1
- package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonCustomIcon.doc.mjs +6 -0
- package/assets/templates/blocks/components/ChatSendButton/ChatSendButtonShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageStatusUpdates.doc.mjs +1 -0
- package/assets/templates/blocks/components/ChatSystemMessage/ChatSystemMessageWithIcon.doc.mjs +6 -0
- package/assets/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.doc.mjs +3 -2
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.doc.mjs +6 -0
- package/assets/templates/blocks/components/DropdownMenu/DropdownMenuBottomSheet.doc.mjs +6 -0
- package/assets/templates/blocks/components/DropdownMenu/DropdownMenuNoChevron.doc.mjs +1 -0
- package/assets/templates/blocks/components/EmptyState/EmptyStateActions.doc.mjs +1 -0
- package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.doc.mjs +1 -0
- package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.doc.mjs +1 -0
- package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.doc.mjs +1 -0
- package/assets/templates/blocks/components/Hooks/useKeyboardHintHookUsage.doc.mjs +10 -1
- package/assets/templates/blocks/components/HoverCard/HoverCardInteractiveContent.doc.mjs +1 -0
- package/assets/templates/blocks/components/HoverCard/HoverCardProfileHoverCard.doc.mjs +1 -0
- package/assets/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +1 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +1 -0
- package/assets/templates/blocks/components/Item/ItemShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/Item/ItemWithMetadata.doc.mjs +1 -1
- package/assets/templates/blocks/components/MetadataListItem/MetadataListItemBasic.doc.mjs +1 -1
- package/assets/templates/blocks/components/MobileNav/MobileNavBasicMobileNav.doc.mjs +7 -0
- package/assets/templates/blocks/components/MobileNav/MobileNavEndSideMobileNav.doc.mjs +1 -0
- package/assets/templates/blocks/components/MobileNav/MobileNavWithoutTitleMobileNav.doc.mjs +1 -0
- package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.doc.mjs +6 -0
- package/assets/templates/blocks/components/MoreMenu/MoreMenuWithDividers.doc.mjs +5 -0
- package/assets/templates/blocks/components/MoreMenu/MoreMenuWithSections.doc.mjs +5 -0
- package/assets/templates/blocks/components/Pagination/PaginationDotsCarousel.doc.mjs +1 -0
- package/assets/templates/blocks/components/Popover/PopoverBottomSheetAlternative.doc.mjs +1 -0
- package/assets/templates/blocks/components/Section/SectionWashHighlight.doc.mjs +1 -0
- package/assets/templates/blocks/components/SegmentedControlItem/SegmentedControlItemBasic.doc.mjs +1 -1
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.doc.mjs +8 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.doc.mjs +1 -0
- package/assets/templates/blocks/components/TextInput/TextInputIcon.doc.mjs +1 -0
- package/assets/templates/blocks/components/TextInput/TextInputSearch.doc.mjs +1 -0
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonColor.doc.mjs +11 -0
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonGroup.doc.mjs +16 -1
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonIconSwap.doc.mjs +6 -0
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonLabel.doc.mjs +13 -1
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonShowcase.doc.mjs +6 -0
- package/assets/templates/blocks/components/ToggleButton/ToggleButtonStates.doc.mjs +1 -0
- package/assets/templates/blocks/components/Token/TokenIcon.doc.mjs +6 -0
- package/assets/templates/blocks/components/Token/TokenShowcase.doc.mjs +1 -0
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.doc.mjs +1 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarBulkActions.doc.mjs +1 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.doc.mjs +1 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarSizes.doc.mjs +1 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +1 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.doc.mjs +1 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarWithTabs.doc.mjs +1 -0
- package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.doc.mjs +1 -0
- package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.doc.mjs +6 -0
- package/assets/templates/blocks/components/TopNav/TopNavHoverMenu.doc.mjs +8 -0
- package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.doc.mjs +8 -0
- package/assets/templates/blocks/components/TopNav/TopNavMultipleDropdowns.doc.mjs +5 -0
- package/assets/templates/blocks/components/TopNav/TopNavShowcase.doc.mjs +5 -0
- package/assets/templates/blocks/components/TopNav/TopNavWithLogo.doc.mjs +1 -0
- package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuBasic.doc.mjs +1 -0
- package/assets/templates/blocks/components/TopNavMegaMenu/TopNavMegaMenuShowcase.doc.mjs +13 -1
- package/assets/templates/blocks/components/TopNavMegaMenuItem/TopNavMegaMenuItemBasic.doc.mjs +1 -0
- package/assets/templates/blocks/components/TopNavMenu/TopNavMenuBasic.doc.mjs +1 -0
- package/assets/templates/blocks/components/TopNavMenu/TopNavMenuShowcase.doc.mjs +6 -0
- package/assets/templates/blocks/components/TreeList/TreeListFileTreeWithIcons.doc.mjs +1 -0
- package/assets/templates/blocks/components/TreeList/TreeListInteractiveSettings.doc.mjs +1 -0
- package/assets/templates/blocks/components/Typeahead/TypeaheadSearchField.doc.mjs +1 -0
- package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.doc.mjs +15 -1
- package/assets/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.doc.mjs +10 -2
- package/assets/templates/pages/ai-chat/template.doc.mjs +9 -0
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +11 -0
- package/assets/templates/pages/canvas-editor/template.doc.mjs +17 -0
- package/assets/templates/pages/centered-hero/template.doc.mjs +1 -0
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +7 -0
- package/assets/templates/pages/contact-form/template.doc.mjs +5 -0
- package/assets/templates/pages/dashboard/template.doc.mjs +6 -0
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +8 -0
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +7 -0
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +8 -0
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +1 -0
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +7 -0
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +7 -0
- package/assets/templates/pages/detail-page/template.doc.mjs +10 -0
- package/assets/templates/pages/documentation-design/template.doc.mjs +6 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +5 -0
- package/assets/templates/pages/editor/template.doc.mjs +25 -0
- package/assets/templates/pages/file-explorer/template.doc.mjs +15 -0
- package/assets/templates/pages/form-wizard-inline/template.doc.mjs +1 -0
- package/assets/templates/pages/form-wizard-vertical/template.doc.mjs +12 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +1 -0
- package/assets/templates/pages/ide/template.doc.mjs +5 -0
- package/assets/templates/pages/incident-console/template.doc.mjs +1 -0
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -0
- package/assets/templates/pages/library/template.doc.mjs +1 -0
- package/assets/templates/pages/login/template.doc.mjs +1 -0
- package/assets/templates/pages/login-card/template.doc.mjs +1 -0
- package/assets/templates/pages/login-split/template.doc.mjs +1 -0
- package/assets/templates/pages/login-sso/template.doc.mjs +1 -0
- package/assets/templates/pages/messaging-shell/template.doc.mjs +13 -0
- package/assets/templates/pages/payment-form/template.doc.mjs +6 -0
- package/assets/templates/pages/product-detail/template.doc.mjs +1 -0
- package/assets/templates/pages/product-gallery/template.doc.mjs +1 -0
- package/assets/templates/pages/settings/template.doc.mjs +1 -0
- package/assets/templates/pages/settings-dialog/template.doc.mjs +49 -0
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +16 -0
- package/assets/templates/pages/shell-nav/template.doc.mjs +6 -0
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +11 -0
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +16 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +5 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +19 -0
- package/assets/templates/pages/table-grouped/template.doc.mjs +13 -0
- package/assets/templates/pages/table-inbox/template.doc.mjs +17 -0
- package/assets/templates/pages/table-page/template.doc.mjs +1 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/assets/templates/pages/theme-showcase/template.doc.mjs +19 -0
- package/assets/templates/pages/work-item-detail/template.doc.mjs +13 -0
- package/authoring/config/config.doc.mjs +8 -0
- package/authoring/config/parse.d.mts +1 -0
- package/authoring/config/parse.mjs +1 -0
- package/authoring/config/type.ts +8 -0
- package/authoring/discover/parse.d.mts +13 -3
- package/authoring/discover/parse.mjs +57 -4
- package/authoring/discover/parse.test.mjs +34 -0
- package/authoring/discover/type.ts +22 -2
- package/authoring/doctypes/_schema.d.mts +19 -0
- package/authoring/doctypes/_schema.mjs +5 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +7 -1
- package/authoring/doctypes/base/type.ts +10 -1
- package/authoring/doctypes/doc-stability-types.test.mjs +91 -0
- package/authoring/doctypes/enum/type.ts +4 -0
- package/authoring/doctypes/icon-definition/icon-definition.doc.d.mts +9 -0
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +89 -0
- package/authoring/doctypes/icon-definition/parse.d.mts +40 -0
- package/authoring/doctypes/icon-definition/parse.mjs +89 -0
- package/authoring/doctypes/icon-definition/parse.test.mjs +78 -0
- package/authoring/doctypes/icon-definition/type.ts +55 -0
- package/authoring/doctypes/icon-set/icon-names.d.mts +14 -0
- package/authoring/doctypes/icon-set/icon-names.mjs +44 -0
- package/authoring/doctypes/icon-set/icon-names.test.mjs +26 -0
- package/authoring/doctypes/icon-set/icon-set-data.doc.d.mts +10 -0
- package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +169 -0
- package/authoring/doctypes/icon-set/icon-set.doc.d.mts +9 -0
- package/authoring/doctypes/icon-set/icon-set.doc.mjs +90 -0
- package/authoring/doctypes/icon-set/parse.d.mts +105 -0
- package/authoring/doctypes/icon-set/parse.mjs +322 -0
- package/authoring/doctypes/icon-set/parse.test.mjs +179 -0
- package/authoring/doctypes/icon-set/type.ts +182 -0
- package/authoring/doctypes/load-contract.test.mjs +17 -4
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -0
- package/authoring/doctypes/namespace/type.ts +7 -0
- package/authoring/doctypes/parse.d.mts +6 -2
- package/authoring/doctypes/parse.mjs +10 -2
- package/authoring/doctypes/schema/type.ts +4 -0
- package/authoring/doctypes/template/parse.d.mts +4 -0
- package/authoring/doctypes/template/parse.mjs +11 -0
- package/authoring/doctypes/template/template.doc.mjs +7 -0
- package/authoring/doctypes/template/type.ts +10 -0
- package/authoring/doctypes/types.ts +3 -1
- package/authoring/identity/type.ts +11 -3
- package/authoring/index.d.mts +2 -0
- package/authoring/index.d.ts +15 -0
- package/authoring/index.mjs +5 -1
- package/authoring/integration/integration.doc.mjs +17 -0
- package/authoring/integration/schema.d.mts +6 -0
- package/authoring/integration/schema.mjs +4 -0
- package/authoring/integration/type.ts +8 -0
- package/clients/cli/commands/discover.icon-sets.test.mjs +133 -0
- package/clients/cli/commands/discover.mjs +3 -0
- package/clients/cli/commands/docs.mjs +23 -6
- package/clients/cli/commands/doctor-integration.test.mjs +38 -0
- package/clients/cli/commands/doctor.mjs +165 -16
- package/clients/cli/commands/experimental/icon.mjs +462 -0
- package/clients/cli/commands/experimental/index.mjs +43 -0
- package/clients/cli/commands/experimental-icon-add.doc.mjs +105 -0
- package/clients/cli/commands/experimental-icon-map.doc.mjs +57 -0
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +72 -0
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +76 -0
- package/clients/cli/commands/experimental-icon-use.doc.mjs +42 -0
- package/clients/cli/commands/experimental-icon.doc.mjs +68 -0
- package/clients/cli/commands/experimental.doc.mjs +28 -0
- package/clients/cli/commands/icon-authoring.test.mjs +1035 -0
- package/clients/cli/commands/icon-sets-guide.test.mjs +186 -0
- package/clients/cli/commands/icon.test.mjs +96 -0
- package/clients/cli/commands/integration.mjs +23 -1
- package/clients/cli/commands/template.icons.test.mjs +132 -0
- package/clients/cli/commands/template.mjs +36 -2
- package/clients/cli/commands/text-json-parity.test.mjs +51 -0
- package/clients/cli/formatters/index.mjs +8 -1
- package/clients/cli/formatters/index.test.mjs +15 -0
- package/clients/cli/index.mjs +13 -0
- package/clients/cli/lib/define-command.mjs +4 -0
- package/foundation/config/config-writer.d.mts +27 -0
- package/foundation/config/config-writer.mjs +202 -0
- package/foundation/config/config-writer.test.mjs +84 -0
- package/foundation/config/project.d.mts +24 -0
- package/foundation/config/project.mjs +105 -3
- package/foundation/discovery/authoring-self-docs.d.mts +22 -1
- package/foundation/discovery/authoring-self-docs.mjs +69 -19
- package/foundation/discovery/authoring-self-docs.test.mjs +19 -3
- package/foundation/discovery/authoring-surface.mjs +13 -6
- package/foundation/discovery/cli-self-docs.d.mts +6 -0
- package/foundation/discovery/cli-self-docs.mjs +58 -6
- package/foundation/discovery/component-discovery.export-names.test.mjs +31 -0
- package/foundation/discovery/doc-stability.d.mts +32 -0
- package/foundation/discovery/doc-stability.mjs +100 -0
- package/foundation/discovery/doc-types.d.mts +2 -2
- package/foundation/discovery/doc-types.mjs +8 -3
- package/foundation/discovery/doc-types.test.mjs +30 -0
- package/foundation/discovery/icon-definition-discovery.d.mts +59 -0
- package/foundation/discovery/icon-definition-discovery.mjs +117 -0
- package/foundation/discovery/icon-ranking.d.mts +113 -0
- package/foundation/discovery/icon-ranking.mjs +305 -0
- package/foundation/discovery/icon-set-checks.d.mts +142 -0
- package/foundation/discovery/icon-set-checks.mjs +742 -0
- package/foundation/discovery/icon-set-checks.test.mjs +905 -0
- package/foundation/discovery/icon-set-discovery.d.mts +229 -0
- package/foundation/discovery/icon-set-discovery.mjs +464 -0
- package/foundation/discovery/icon-set-discovery.test.mjs +320 -0
- package/foundation/discovery/icon-set-writer.d.mts +323 -0
- package/foundation/discovery/icon-set-writer.mjs +1181 -0
- package/foundation/discovery/integration-doc-files.mjs +17 -2
- package/foundation/discovery/integration-doc-files.test.mjs +29 -0
- package/foundation/discovery/module-exports.d.mts +122 -0
- package/foundation/discovery/module-exports.mjs +682 -11
- package/foundation/discovery/runner-commands.test.mjs +4 -1
- package/foundation/discovery/template-adapter.d.mts +5 -0
- package/foundation/discovery/template-adapter.mjs +17 -0
- package/foundation/discovery/template-icon-notes.d.mts +15 -0
- package/foundation/discovery/template-icon-notes.mjs +66 -0
- package/foundation/discovery/template-icons.d.mts +156 -0
- package/foundation/discovery/template-icons.mjs +712 -0
- package/foundation/discovery/template-icons.test.mjs +457 -0
- package/foundation/discovery/theme-discovery.d.mts +15 -0
- package/foundation/discovery/theme-discovery.mjs +137 -61
- package/foundation/doc-compiler/bundle.mjs +14 -0
- package/foundation/doc-compiler/compile.d.mts +1 -1
- package/foundation/doc-compiler/compile.mjs +10 -2
- package/foundation/doc-compiler/doc-loads.test.mjs +33 -0
- package/foundation/doc-compiler/inputs.d.mts +2 -2
- package/foundation/doc-compiler/inputs.mjs +17 -1
- package/foundation/doc-compiler/inputs.test.mjs +1 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +1 -1
- package/foundation/doc-compiler/read.d.mts +2 -2
- package/foundation/doc-compiler/read.mjs +4 -4
- package/foundation/doc-compiler/tree.d.mts +21 -0
- package/foundation/doc-compiler/tree.mjs +71 -4
- package/foundation/doc-compiler/tree.test.mjs +34 -0
- package/foundation/fs/paths.d.mts +3 -1
- package/foundation/fs/paths.mjs +8 -2
- package/foundation/identity/provider-identity.mjs +2 -0
- package/foundation/integrations/cli-requirement.d.mts +55 -0
- package/foundation/integrations/cli-requirement.mjs +92 -1
- package/foundation/integrations/cli-requirement.test.mjs +9 -0
- package/foundation/integrations/contribution-inventory.d.mts +12 -5
- package/foundation/integrations/contribution-inventory.mjs +66 -3
- package/foundation/integrations/integrations.d.mts +5 -0
- package/foundation/integrations/integrations.mjs +6 -2
- package/foundation/integrations/manifest-writer.d.mts +3 -0
- package/foundation/integrations/manifest-writer.mjs +51 -5
- package/foundation/integrations/manifest-writer.test.mjs +42 -0
- package/foundation/integrations/validate-contributions.d.mts +53 -0
- package/foundation/integrations/validate-contributions.mjs +791 -1
- package/foundation/response/response-types.doc.mjs +58 -1
- package/package.json +9 -9
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One definition, with the file and package it came from.
|
|
6
|
+
* @typedef {object} DiscoveredIconDefinition
|
|
7
|
+
* @property {IconDefinitionDoc} doc
|
|
8
|
+
* @property {string} file absolute path
|
|
9
|
+
* @property {string} package the package that ships it
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Read every definition file in one folder, without executing any.
|
|
13
|
+
* @param {string} dir
|
|
14
|
+
* @param {string} owner the package that ships the folder
|
|
15
|
+
* @returns {{definitions: DiscoveredIconDefinition[], errors: Array<{file: string, message: string}>}}
|
|
16
|
+
*/
|
|
17
|
+
export function readDefinitionsDir(dir: string, owner: string): {
|
|
18
|
+
definitions: DiscoveredIconDefinition[];
|
|
19
|
+
errors: Array<{
|
|
20
|
+
file: string;
|
|
21
|
+
message: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Astryx's own definitions, read once per process.
|
|
26
|
+
* @returns {{definitions: DiscoveredIconDefinition[], errors: Array<{file: string, message: string}>}}
|
|
27
|
+
*/
|
|
28
|
+
export function astryxIconDefinitions(): {
|
|
29
|
+
definitions: DiscoveredIconDefinition[];
|
|
30
|
+
errors: Array<{
|
|
31
|
+
file: string;
|
|
32
|
+
message: string;
|
|
33
|
+
}>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Astryx's definitions by name.
|
|
37
|
+
* @returns {Map<string, IconDefinitionDoc>}
|
|
38
|
+
*/
|
|
39
|
+
export function astryxDefinitionsByName(): Map<string, IconDefinitionDoc>;
|
|
40
|
+
/** @typedef {import('../../authoring/doctypes/icon-definition/type').IconDefinitionDoc} IconDefinitionDoc */
|
|
41
|
+
/** The folder Astryx's own definitions live in. */
|
|
42
|
+
export const ASTRYX_DEFINITIONS_DIR: string;
|
|
43
|
+
/** The package that ships Astryx's definitions. */
|
|
44
|
+
export const ASTRYX_DEFINITIONS_PACKAGE: "@astryxdesign/cli";
|
|
45
|
+
/**
|
|
46
|
+
* One definition, with the file and package it came from.
|
|
47
|
+
*/
|
|
48
|
+
export type DiscoveredIconDefinition = {
|
|
49
|
+
doc: IconDefinitionDoc;
|
|
50
|
+
/**
|
|
51
|
+
* absolute path
|
|
52
|
+
*/
|
|
53
|
+
file: string;
|
|
54
|
+
/**
|
|
55
|
+
* the package that ships it
|
|
56
|
+
*/
|
|
57
|
+
package: string;
|
|
58
|
+
};
|
|
59
|
+
export type IconDefinitionDoc = import("../../authoring/doctypes/icon-definition/type").IconDefinitionDoc;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Icon definition discovery (AST-084): every definition file in a definitions
|
|
5
|
+
* folder, read statically and checked as an IconDefinitionDoc.
|
|
6
|
+
*
|
|
7
|
+
* Astryx's own definitions are the files in the CLI's `assets/icons/definitions`
|
|
8
|
+
* folder. An icon set adds its own in `<set>/definitions`. There is no index
|
|
9
|
+
* file and no list: discovery reads every `<name>.doc.mjs` in the folder,
|
|
10
|
+
* and the file name must equal the definition's `name`.
|
|
11
|
+
*
|
|
12
|
+
* @input A definitions folder and the package that ships it
|
|
13
|
+
* @output The definitions, and the files that did not read
|
|
14
|
+
* @position packages/cli/foundation/discovery — the definition seam every icon
|
|
15
|
+
* surface reads
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import * as fs from 'node:fs';
|
|
19
|
+
import * as path from 'node:path';
|
|
20
|
+
import {parseIconDefinition} from '../../authoring/doctypes/icon-definition/parse.mjs';
|
|
21
|
+
import {CLI_ROOT} from '../fs/paths.mjs';
|
|
22
|
+
import {readStaticDescriptorValue} from './theme-discovery.mjs';
|
|
23
|
+
|
|
24
|
+
/** @typedef {import('../../authoring/doctypes/icon-definition/type').IconDefinitionDoc} IconDefinitionDoc */
|
|
25
|
+
|
|
26
|
+
/** The folder Astryx's own definitions live in. */
|
|
27
|
+
export const ASTRYX_DEFINITIONS_DIR = path.join(
|
|
28
|
+
CLI_ROOT,
|
|
29
|
+
'assets',
|
|
30
|
+
'icons',
|
|
31
|
+
'definitions',
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
/** The package that ships Astryx's definitions. */
|
|
35
|
+
export const ASTRYX_DEFINITIONS_PACKAGE = '@astryxdesign/cli';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* One definition, with the file and package it came from.
|
|
39
|
+
* @typedef {object} DiscoveredIconDefinition
|
|
40
|
+
* @property {IconDefinitionDoc} doc
|
|
41
|
+
* @property {string} file absolute path
|
|
42
|
+
* @property {string} package the package that ships it
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Read every definition file in one folder, without executing any.
|
|
47
|
+
* @param {string} dir
|
|
48
|
+
* @param {string} owner the package that ships the folder
|
|
49
|
+
* @returns {{definitions: DiscoveredIconDefinition[], errors: Array<{file: string, message: string}>}}
|
|
50
|
+
*/
|
|
51
|
+
export function readDefinitionsDir(dir, owner) {
|
|
52
|
+
/** @type {DiscoveredIconDefinition[]} */
|
|
53
|
+
const definitions = [];
|
|
54
|
+
/** @type {Array<{file: string, message: string}>} */
|
|
55
|
+
const errors = [];
|
|
56
|
+
/** @type {fs.Dirent[]} */
|
|
57
|
+
let entries;
|
|
58
|
+
try {
|
|
59
|
+
entries = fs.readdirSync(dir, {withFileTypes: true});
|
|
60
|
+
} catch {
|
|
61
|
+
return {definitions, errors};
|
|
62
|
+
}
|
|
63
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
64
|
+
if (!entry.name.endsWith('.doc.mjs')) continue;
|
|
65
|
+
const file = path.join(dir, entry.name);
|
|
66
|
+
const label = `Icon definition ${entry.name} in ${owner}`;
|
|
67
|
+
try {
|
|
68
|
+
if (!entry.isFile()) {
|
|
69
|
+
throw new Error(`${label} must be a regular file.`);
|
|
70
|
+
}
|
|
71
|
+
const doc = parseIconDefinition(
|
|
72
|
+
readStaticDescriptorValue(file, label, 'IconDefinitionDoc', {
|
|
73
|
+
data: true,
|
|
74
|
+
}),
|
|
75
|
+
label,
|
|
76
|
+
);
|
|
77
|
+
const stem = entry.name.slice(0, -'.doc.mjs'.length);
|
|
78
|
+
if (doc.name !== stem) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`${label} names "${doc.name}"; a definition file is named after its definition (${doc.name}.doc.mjs).`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
definitions.push({doc, file, package: owner});
|
|
84
|
+
} catch (error) {
|
|
85
|
+
errors.push({
|
|
86
|
+
file,
|
|
87
|
+
message: error instanceof Error ? error.message : String(error),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return {definitions, errors};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** @type {{definitions: DiscoveredIconDefinition[], errors: Array<{file: string, message: string}>} | undefined} */
|
|
95
|
+
let astryx;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Astryx's own definitions, read once per process.
|
|
99
|
+
* @returns {{definitions: DiscoveredIconDefinition[], errors: Array<{file: string, message: string}>}}
|
|
100
|
+
*/
|
|
101
|
+
export function astryxIconDefinitions() {
|
|
102
|
+
astryx ??= readDefinitionsDir(
|
|
103
|
+
ASTRYX_DEFINITIONS_DIR,
|
|
104
|
+
ASTRYX_DEFINITIONS_PACKAGE,
|
|
105
|
+
);
|
|
106
|
+
return astryx;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Astryx's definitions by name.
|
|
111
|
+
* @returns {Map<string, IconDefinitionDoc>}
|
|
112
|
+
*/
|
|
113
|
+
export function astryxDefinitionsByName() {
|
|
114
|
+
return new Map(
|
|
115
|
+
astryxIconDefinitions().definitions.map(m => [m.doc.name, m.doc]),
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/** @typedef {import('./icon-set-discovery.mjs').DiscoveredIconSet} DiscoveredIconSet */
|
|
5
|
+
/** @typedef {import('../../authoring/doctypes/icon-set/type').IconSetIcon} IconSetIcon */
|
|
6
|
+
/** @typedef {import('../../api/icon/icon.type.mjs').IconRecord} IconRecord */
|
|
7
|
+
/** @typedef {import('../../api/icon/icon.type.mjs').IconMatchEntry} IconMatchEntry */
|
|
8
|
+
/**
|
|
9
|
+
* The import line for one export.
|
|
10
|
+
* @param {string} exportName
|
|
11
|
+
* @param {string} module
|
|
12
|
+
*/
|
|
13
|
+
export function importLine(exportName: string, module: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* One icon as every icon read names it.
|
|
16
|
+
* @param {DiscoveredIconSet} set
|
|
17
|
+
* @param {IconSetIcon} icon
|
|
18
|
+
* @param {string[]} [definitions] the definitions the set's `map` names it
|
|
19
|
+
* for; read from the set when not given
|
|
20
|
+
* @returns {IconRecord}
|
|
21
|
+
*/
|
|
22
|
+
export function iconRecord(set: DiscoveredIconSet, icon: IconSetIcon, definitions?: string[]): IconRecord;
|
|
23
|
+
/**
|
|
24
|
+
* How one icon matches a query, before the searched sets decide which exact
|
|
25
|
+
* reading leads: the tier, whether an exact match is a name or a meaning
|
|
26
|
+
* match, and the keys that order matches within a tier.
|
|
27
|
+
* @typedef {object} IconMatch
|
|
28
|
+
* @property {'definition' | 'exact' | 'prefix' | 'partial'} tier
|
|
29
|
+
* @property {boolean} name the query is the id, or a word that is an id part
|
|
30
|
+
* @property {boolean} meaning the query is one of the icon's tags (never
|
|
31
|
+
* both: a tag is a word that is not the id or one of its parts)
|
|
32
|
+
* @property {number} rank within-tier key, lower first: for a name match 0
|
|
33
|
+
* (whole id) or 1 (an id part); for a meaning match the tag's position
|
|
34
|
+
* @property {string} reason
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* How one icon matches a query, or null when it does not.
|
|
38
|
+
* @param {string} query lower-case, trimmed
|
|
39
|
+
* @param {IconSetIcon} icon
|
|
40
|
+
* @param {string[]} [definitions] the icon definitions the set maps it to
|
|
41
|
+
* @returns {IconMatch | null}
|
|
42
|
+
*/
|
|
43
|
+
export function matchIcon(query: string, icon: IconSetIcon, definitions?: string[]): IconMatch | null;
|
|
44
|
+
/**
|
|
45
|
+
* Which exact reading leads for a set of matches: meaning, unless more icons
|
|
46
|
+
* carry the query as a name than as a tag.
|
|
47
|
+
* @param {Array<IconMatch | null>} matches
|
|
48
|
+
* @returns {'name' | 'meaning'}
|
|
49
|
+
*/
|
|
50
|
+
export function leadingReading(matches: Array<IconMatch | null>): "name" | "meaning";
|
|
51
|
+
/**
|
|
52
|
+
* How well one icon answers a query on its own, or null when it does not.
|
|
53
|
+
* An exact match is scored as if `leading` were the reading the searched
|
|
54
|
+
* sets favor (meaning, unless told otherwise).
|
|
55
|
+
* @param {string} query lower-case, trimmed
|
|
56
|
+
* @param {IconSetIcon} icon
|
|
57
|
+
* @param {'name' | 'meaning'} [leading]
|
|
58
|
+
* @param {string[]} [definitions] the icon definitions the set maps it to
|
|
59
|
+
* @returns {{score: number, reason: string} | null}
|
|
60
|
+
*/
|
|
61
|
+
export function scoreIcon(query: string, icon: IconSetIcon, leading?: "name" | "meaning", definitions?: string[]): {
|
|
62
|
+
score: number;
|
|
63
|
+
reason: string;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
* The icon with the words it matches by: its own words, then the name (read
|
|
67
|
+
* as words) and words of every definition the set's `map` names it for, so
|
|
68
|
+
* `bin` finds the icon mapped to `delete` without the data file repeating
|
|
69
|
+
* the definition's words. The icon's own words keep their places, so its
|
|
70
|
+
* own tags still rank first.
|
|
71
|
+
* @param {IconSetIcon} icon
|
|
72
|
+
* @param {string[]} definitions
|
|
73
|
+
* @param {(name: string) => {name: string, words: string[]} | undefined} lookup
|
|
74
|
+
* @returns {IconSetIcon}
|
|
75
|
+
*/
|
|
76
|
+
export function withDefinitionWords(icon: IconSetIcon, definitions: string[], lookup: (name: string) => {
|
|
77
|
+
name: string;
|
|
78
|
+
words: string[];
|
|
79
|
+
} | undefined): IconSetIcon;
|
|
80
|
+
/**
|
|
81
|
+
* Every icon in `sets` that answers the query, ranked (FR6).
|
|
82
|
+
* @param {DiscoveredIconSet[]} sets in tie order
|
|
83
|
+
* @param {string} query
|
|
84
|
+
* @returns {IconMatchEntry[]}
|
|
85
|
+
*/
|
|
86
|
+
export function rankIcons(sets: DiscoveredIconSet[], query: string): IconMatchEntry[];
|
|
87
|
+
export type DiscoveredIconSet = import("./icon-set-discovery.mjs").DiscoveredIconSet;
|
|
88
|
+
export type IconSetIcon = import("../../authoring/doctypes/icon-set/type").IconSetIcon;
|
|
89
|
+
export type IconRecord = import("../../api/icon/icon.type.mjs").IconRecord;
|
|
90
|
+
export type IconMatchEntry = import("../../api/icon/icon.type.mjs").IconMatchEntry;
|
|
91
|
+
/**
|
|
92
|
+
* How one icon matches a query, before the searched sets decide which exact
|
|
93
|
+
* reading leads: the tier, whether an exact match is a name or a meaning
|
|
94
|
+
* match, and the keys that order matches within a tier.
|
|
95
|
+
*/
|
|
96
|
+
export type IconMatch = {
|
|
97
|
+
tier: "definition" | "exact" | "prefix" | "partial";
|
|
98
|
+
/**
|
|
99
|
+
* the query is the id, or a word that is an id part
|
|
100
|
+
*/
|
|
101
|
+
name: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* the query is one of the icon's tags (never
|
|
104
|
+
* both: a tag is a word that is not the id or one of its parts)
|
|
105
|
+
*/
|
|
106
|
+
meaning: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* within-tier key, lower first: for a name match 0
|
|
109
|
+
* (whole id) or 1 (an id part); for a meaning match the tag's position
|
|
110
|
+
*/
|
|
111
|
+
rank: number;
|
|
112
|
+
reason: string;
|
|
113
|
+
};
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Pure icon records and ranking (AST-084 FR6), shared by the `icon`
|
|
5
|
+
* leaves and the icon-set checks' suggestions. No environment access.
|
|
6
|
+
*
|
|
7
|
+
* Ranking tiers, highest first:
|
|
8
|
+
* 100 the query is an icon definition the set's `map` names the icon for
|
|
9
|
+
* 90 an exact match in the reading the searched sets favor (below)
|
|
10
|
+
* 80 an exact match in the other reading
|
|
11
|
+
* 60 one of its words starts with the query
|
|
12
|
+
* 40 a partial match: the id or a word contains the query, or every
|
|
13
|
+
* word of the query starts one of the icon's words or id parts
|
|
14
|
+
*
|
|
15
|
+
* An exact match is a NAME match when the query is the icon's id, or one of
|
|
16
|
+
* its words that is also a part of its id (`trash` for `trash-2`); it is a
|
|
17
|
+
* MEANING match when the query is one of its other words, its tags. An id
|
|
18
|
+
* names the artwork; the tags say what it is for. Lucide's `delete` draws the
|
|
19
|
+
* Delete key, so `delete` names it, while `trash` is tagged `delete`: the
|
|
20
|
+
* query asks for the meaning. Which reading leads is decided by the searched
|
|
21
|
+
* sets themselves: when at least as many icons carry the query as a tag as
|
|
22
|
+
* carry it as a name, meaning matches score 90 and name-only matches 80;
|
|
23
|
+
* otherwise name matches score 90 and meaning-only matches 80 (`user` names
|
|
24
|
+
* many icons, so the `user` icon stays ahead of `contact`, which is only
|
|
25
|
+
* tagged `user`).
|
|
26
|
+
*
|
|
27
|
+
* Equal scores keep the set order first (the project's set, then load
|
|
28
|
+
* order), so the project's set always leads at a score. Within one set, a
|
|
29
|
+
* name match on the whole id comes before one on a part of it, and a meaning
|
|
30
|
+
* match whose query sits earlier among the icon's tags comes first (sets list
|
|
31
|
+
* an icon's most telling tags first). Remaining ties keep id order, so the
|
|
32
|
+
* same installation always answers the same way.
|
|
33
|
+
*
|
|
34
|
+
* @position foundation/discovery — read by api/icon and icon-set-checks
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
import {definitionsByIcon} from './icon-set-discovery.mjs';
|
|
38
|
+
import {astryxDefinitionsByName} from './icon-definition-discovery.mjs';
|
|
39
|
+
|
|
40
|
+
/** @typedef {import('./icon-set-discovery.mjs').DiscoveredIconSet} DiscoveredIconSet */
|
|
41
|
+
/** @typedef {import('../../authoring/doctypes/icon-set/type').IconSetIcon} IconSetIcon */
|
|
42
|
+
/** @typedef {import('../../api/icon/icon.type.mjs').IconRecord} IconRecord */
|
|
43
|
+
/** @typedef {import('../../api/icon/icon.type.mjs').IconMatchEntry} IconMatchEntry */
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The import line for one export.
|
|
47
|
+
* @param {string} exportName
|
|
48
|
+
* @param {string} module
|
|
49
|
+
*/
|
|
50
|
+
export function importLine(exportName, module) {
|
|
51
|
+
return `import {${exportName}} from '${module}';`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* One icon as every icon read names it.
|
|
56
|
+
* @param {DiscoveredIconSet} set
|
|
57
|
+
* @param {IconSetIcon} icon
|
|
58
|
+
* @param {string[]} [definitions] the definitions the set's `map` names it
|
|
59
|
+
* for; read from the set when not given
|
|
60
|
+
* @returns {IconRecord}
|
|
61
|
+
*/
|
|
62
|
+
export function iconRecord(set, icon, definitions) {
|
|
63
|
+
const module = icon.module ?? set.data.module;
|
|
64
|
+
return {
|
|
65
|
+
set: set.name,
|
|
66
|
+
id: icon.id,
|
|
67
|
+
package: set.package,
|
|
68
|
+
module,
|
|
69
|
+
export: icon.export,
|
|
70
|
+
import: importLine(icon.export, module),
|
|
71
|
+
words: [...icon.words],
|
|
72
|
+
definitions: [
|
|
73
|
+
...(definitions ?? definitionsByIcon(set.data).get(icon.id) ?? []),
|
|
74
|
+
],
|
|
75
|
+
variants: (icon.variants ?? []).map(variant => ({
|
|
76
|
+
variant: variant.variant,
|
|
77
|
+
module: variant.module ?? module,
|
|
78
|
+
export: variant.export,
|
|
79
|
+
})),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** @param {string} value */
|
|
84
|
+
const squash = value => value.toLowerCase().replace(/[\s_-]+/g, '');
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* How one icon matches a query, before the searched sets decide which exact
|
|
88
|
+
* reading leads: the tier, whether an exact match is a name or a meaning
|
|
89
|
+
* match, and the keys that order matches within a tier.
|
|
90
|
+
* @typedef {object} IconMatch
|
|
91
|
+
* @property {'definition' | 'exact' | 'prefix' | 'partial'} tier
|
|
92
|
+
* @property {boolean} name the query is the id, or a word that is an id part
|
|
93
|
+
* @property {boolean} meaning the query is one of the icon's tags (never
|
|
94
|
+
* both: a tag is a word that is not the id or one of its parts)
|
|
95
|
+
* @property {number} rank within-tier key, lower first: for a name match 0
|
|
96
|
+
* (whole id) or 1 (an id part); for a meaning match the tag's position
|
|
97
|
+
* @property {string} reason
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* How one icon matches a query, or null when it does not.
|
|
102
|
+
* @param {string} query lower-case, trimmed
|
|
103
|
+
* @param {IconSetIcon} icon
|
|
104
|
+
* @param {string[]} [definitions] the icon definitions the set maps it to
|
|
105
|
+
* @returns {IconMatch | null}
|
|
106
|
+
*/
|
|
107
|
+
export function matchIcon(query, icon, definitions = []) {
|
|
108
|
+
const joined = squash(query);
|
|
109
|
+
const definition = definitions.find(name => name.toLowerCase() === joined);
|
|
110
|
+
if (definition) {
|
|
111
|
+
return {
|
|
112
|
+
tier: 'definition',
|
|
113
|
+
name: false,
|
|
114
|
+
meaning: false,
|
|
115
|
+
rank: 0,
|
|
116
|
+
reason: `definition "${definition}"`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const id = query.replace(/\s+/g, '-');
|
|
120
|
+
const parts = new Set(icon.id.split('-'));
|
|
121
|
+
const tags = icon.words.filter(word => word !== icon.id && !parts.has(word));
|
|
122
|
+
const tagAt = tags.indexOf(query);
|
|
123
|
+
const wholeId = icon.id === id;
|
|
124
|
+
const partWord = !wholeId && parts.has(query) && icon.words.includes(query);
|
|
125
|
+
if (wholeId || partWord || tagAt >= 0) {
|
|
126
|
+
return {
|
|
127
|
+
tier: 'exact',
|
|
128
|
+
name: wholeId || partWord,
|
|
129
|
+
meaning: !wholeId && !partWord,
|
|
130
|
+
rank: wholeId ? 0 : partWord ? 1 : tagAt,
|
|
131
|
+
reason: wholeId ? `id "${icon.id}"` : `word "${query}"`,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const prefix = icon.words.find(word => word.startsWith(query));
|
|
135
|
+
if (prefix) {
|
|
136
|
+
return {
|
|
137
|
+
tier: 'prefix',
|
|
138
|
+
name: false,
|
|
139
|
+
meaning: false,
|
|
140
|
+
rank: 0,
|
|
141
|
+
reason: `word "${prefix}" starts with "${query}"`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const contains = [icon.id, ...icon.words].find(text => text.includes(query));
|
|
145
|
+
if (contains) {
|
|
146
|
+
return {
|
|
147
|
+
tier: 'partial',
|
|
148
|
+
name: false,
|
|
149
|
+
meaning: false,
|
|
150
|
+
rank: 0,
|
|
151
|
+
reason: `partial "${contains}"`,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const tokens = query.split(/\s+/).filter(Boolean);
|
|
155
|
+
if (tokens.length > 1) {
|
|
156
|
+
const all = [
|
|
157
|
+
...icon.id.split('-'),
|
|
158
|
+
...icon.words.flatMap(w => w.split(/\s+/)),
|
|
159
|
+
];
|
|
160
|
+
if (tokens.every(token => all.some(part => part.startsWith(token)))) {
|
|
161
|
+
return {
|
|
162
|
+
tier: 'partial',
|
|
163
|
+
name: false,
|
|
164
|
+
meaning: false,
|
|
165
|
+
rank: 0,
|
|
166
|
+
reason: `partial "${tokens.join(' ')}"`,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The score of one match, given which exact reading leads.
|
|
175
|
+
* @param {IconMatch} match
|
|
176
|
+
* @param {'name' | 'meaning'} leading
|
|
177
|
+
* @returns {number}
|
|
178
|
+
*/
|
|
179
|
+
function scoreOf(match, leading) {
|
|
180
|
+
switch (match.tier) {
|
|
181
|
+
case 'definition':
|
|
182
|
+
return 100;
|
|
183
|
+
case 'exact':
|
|
184
|
+
return match[leading] ? 90 : 80;
|
|
185
|
+
case 'prefix':
|
|
186
|
+
return 60;
|
|
187
|
+
default:
|
|
188
|
+
return 40;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Which exact reading leads for a set of matches: meaning, unless more icons
|
|
194
|
+
* carry the query as a name than as a tag.
|
|
195
|
+
* @param {Array<IconMatch | null>} matches
|
|
196
|
+
* @returns {'name' | 'meaning'}
|
|
197
|
+
*/
|
|
198
|
+
export function leadingReading(matches) {
|
|
199
|
+
let names = 0;
|
|
200
|
+
let meanings = 0;
|
|
201
|
+
for (const match of matches) {
|
|
202
|
+
if (match?.tier !== 'exact') continue;
|
|
203
|
+
if (match.name) names++;
|
|
204
|
+
if (match.meaning) meanings++;
|
|
205
|
+
}
|
|
206
|
+
return names > meanings ? 'name' : 'meaning';
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* How well one icon answers a query on its own, or null when it does not.
|
|
211
|
+
* An exact match is scored as if `leading` were the reading the searched
|
|
212
|
+
* sets favor (meaning, unless told otherwise).
|
|
213
|
+
* @param {string} query lower-case, trimmed
|
|
214
|
+
* @param {IconSetIcon} icon
|
|
215
|
+
* @param {'name' | 'meaning'} [leading]
|
|
216
|
+
* @param {string[]} [definitions] the icon definitions the set maps it to
|
|
217
|
+
* @returns {{score: number, reason: string} | null}
|
|
218
|
+
*/
|
|
219
|
+
export function scoreIcon(query, icon, leading = 'meaning', definitions = []) {
|
|
220
|
+
const match = matchIcon(query, icon, definitions);
|
|
221
|
+
return match ? {score: scoreOf(match, leading), reason: match.reason} : null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The icon with the words it matches by: its own words, then the name (read
|
|
226
|
+
* as words) and words of every definition the set's `map` names it for, so
|
|
227
|
+
* `bin` finds the icon mapped to `delete` without the data file repeating
|
|
228
|
+
* the definition's words. The icon's own words keep their places, so its
|
|
229
|
+
* own tags still rank first.
|
|
230
|
+
* @param {IconSetIcon} icon
|
|
231
|
+
* @param {string[]} definitions
|
|
232
|
+
* @param {(name: string) => {name: string, words: string[]} | undefined} lookup
|
|
233
|
+
* @returns {IconSetIcon}
|
|
234
|
+
*/
|
|
235
|
+
export function withDefinitionWords(icon, definitions, lookup) {
|
|
236
|
+
if (definitions.length === 0) return icon;
|
|
237
|
+
const words = [...icon.words];
|
|
238
|
+
for (const name of definitions) {
|
|
239
|
+
const doc = lookup(name);
|
|
240
|
+
const humanized = name
|
|
241
|
+
.replace(/([a-z0-9])([A-Z])/gu, '$1 $2')
|
|
242
|
+
.toLowerCase();
|
|
243
|
+
for (const word of [humanized, ...(doc?.words ?? [])]) {
|
|
244
|
+
const lower = word.toLowerCase();
|
|
245
|
+
if (!words.includes(lower)) words.push(lower);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return {...icon, words};
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Every icon in `sets` that answers the query, ranked (FR6).
|
|
253
|
+
* @param {DiscoveredIconSet[]} sets in tie order
|
|
254
|
+
* @param {string} query
|
|
255
|
+
* @returns {IconMatchEntry[]}
|
|
256
|
+
*/
|
|
257
|
+
export function rankIcons(sets, query) {
|
|
258
|
+
const term = query.trim().toLowerCase();
|
|
259
|
+
const astryx = astryxDefinitionsByName();
|
|
260
|
+
/** @type {Array<{set: DiscoveredIconSet, icon: IconSetIcon, definitions: string[], match: IconMatch, setIndex: number}>} */
|
|
261
|
+
const hits = [];
|
|
262
|
+
sets.forEach((set, setIndex) => {
|
|
263
|
+
const byIcon = definitionsByIcon(set.data);
|
|
264
|
+
const own = new Map(
|
|
265
|
+
(set.definitions ?? []).map(each => [each.doc.name, each.doc]),
|
|
266
|
+
);
|
|
267
|
+
for (const icon of set.data.icons) {
|
|
268
|
+
const definitions = byIcon.get(icon.id) ?? [];
|
|
269
|
+
const match = matchIcon(
|
|
270
|
+
term,
|
|
271
|
+
withDefinitionWords(
|
|
272
|
+
icon,
|
|
273
|
+
definitions,
|
|
274
|
+
name => astryx.get(name) ?? own.get(name),
|
|
275
|
+
),
|
|
276
|
+
definitions,
|
|
277
|
+
);
|
|
278
|
+
if (match) hits.push({set, icon, definitions, match, setIndex});
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
const leading = leadingReading(hits.map(hit => hit.match));
|
|
282
|
+
const found = hits.map(({set, icon, definitions, match, setIndex}) => {
|
|
283
|
+
const score = scoreOf(match, leading);
|
|
284
|
+
return {
|
|
285
|
+
entry: {
|
|
286
|
+
...iconRecord(set, icon, definitions),
|
|
287
|
+
reason: match.reason,
|
|
288
|
+
score,
|
|
289
|
+
},
|
|
290
|
+
// Within an exact score and one set: a name match keeps whole id
|
|
291
|
+
// before id part, a meaning match its tag position.
|
|
292
|
+
rank: match.tier === 'exact' ? match.rank : 0,
|
|
293
|
+
setIndex,
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
found.sort(
|
|
297
|
+
(a, b) =>
|
|
298
|
+
// Equal scores keep set order, so the project's set leads (FR6, FR8).
|
|
299
|
+
b.entry.score - a.entry.score ||
|
|
300
|
+
a.setIndex - b.setIndex ||
|
|
301
|
+
a.rank - b.rank ||
|
|
302
|
+
(a.entry.id < b.entry.id ? -1 : a.entry.id > b.entry.id ? 1 : 0),
|
|
303
|
+
);
|
|
304
|
+
return found.map(({entry}) => entry);
|
|
305
|
+
}
|