@kerfjs/ui 5.0.0-beta.11 → 5.0.0-beta.110
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 +707 -160
- package/ai/application-ui-diagnostic-ids-v1.json +115 -0
- package/ai/application-ui-profile-sync.cjs +548 -0
- package/ai/application-ui-profile.d.mts +1 -0
- package/ai/application-ui-profile.d.ts +106 -0
- package/ai/application-ui-profile.defaults.json +222 -0
- package/ai/application-ui-profile.mjs +653 -0
- package/ai/application-ui-profile.schema.json +140 -0
- package/ai/catalog-authoring.json +34 -0
- package/ai/catalog-authoring.schema.json +105 -0
- package/ai/compile-time-contracts-v1.json +149 -0
- package/ai/compile-time-contracts-v1.schema.json +52 -0
- package/ai/component-catalog-extension.schema.json +104 -0
- package/ai/component-catalog.json +9111 -1376
- package/ai/component-catalog.schema.json +94 -1
- package/ai/component-class-owners.cjs +83 -0
- package/ai/component-composition-extension.d.ts +7 -0
- package/ai/component-composition-extension.schema.json +7 -0
- package/ai/component-composition-rules.json +570 -0
- package/ai/component-composition.d.ts +143 -0
- package/ai/component-composition.json +10437 -0
- package/ai/component-composition.schema.json +444 -0
- package/ai/components/README.md +206 -0
- package/ai/components/anchored-surface.md +99 -0
- package/ai/components/application-tabs.md +65 -0
- package/ai/components/backdrop-image.md +84 -0
- package/ai/components/badge.md +77 -0
- package/ai/components/button.md +94 -0
- package/ai/components/checkbox-group.md +89 -0
- package/ai/components/checkbox.md +90 -0
- package/ai/components/chip.md +80 -0
- package/ai/components/choice-chips.md +93 -0
- package/ai/components/collapsible-panel.md +103 -0
- package/ai/components/color-field.md +92 -0
- package/ai/components/color-picker.md +93 -0
- package/ai/components/color-swatches.md +82 -0
- package/ai/components/column-track.md +78 -0
- package/ai/components/combobox.md +90 -0
- package/ai/components/content-item.md +101 -0
- package/ai/components/content-swap.md +78 -0
- package/ai/components/corner-status.md +88 -0
- package/ai/components/disclosure-arrow.md +77 -0
- package/ai/components/disclosure.md +88 -0
- package/ai/components/document-baseline.md +77 -0
- package/ai/components/edge-activity-indicator.md +81 -0
- package/ai/components/empty-state.md +80 -0
- package/ai/components/feedback.md +71 -0
- package/ai/components/file-picker.md +89 -0
- package/ai/components/floating-toolbar.md +82 -0
- package/ai/components/foundation.md +65 -0
- package/ai/components/framed-list.md +80 -0
- package/ai/components/grid.md +101 -0
- package/ai/components/headers.md +63 -0
- package/ai/components/layout.md +75 -0
- package/ai/components/list-action-row.md +108 -0
- package/ai/components/list-detail-dialog.md +90 -0
- package/ai/components/list-header.md +91 -0
- package/ai/components/list-inset-control.md +74 -0
- package/ai/components/list-inset-text.md +72 -0
- package/ai/components/list-item.md +108 -0
- package/ai/components/list.md +127 -0
- package/ai/components/loading-spinner.md +73 -0
- package/ai/components/lucide-icon.md +99 -0
- package/ai/components/message-composer.md +85 -0
- package/ai/components/nav-stack.md +120 -0
- package/ai/components/pane.md +127 -0
- package/ai/components/popup-menu.md +174 -0
- package/ai/components/progress-bar.md +82 -0
- package/ai/components/progress-ring.md +80 -0
- package/ai/components/radio-group.md +89 -0
- package/ai/components/recipe-app-shell.md +57 -0
- package/ai/components/recipe-collapsible-sidebar.md +57 -0
- package/ai/components/recipe-compact-toolbar.md +57 -0
- package/ai/components/recipe-composer-form.md +57 -0
- package/ai/components/recipe-list-detail-dialog.md +57 -0
- package/ai/components/recipe-list-workspace-states.md +57 -0
- package/ai/components/recipe-loading-inspector.md +57 -0
- package/ai/components/recipe-media-detail.md +57 -0
- package/ai/components/recipe-navigation-sidebar.md +57 -0
- package/ai/components/recipe-navigation-stack.md +57 -0
- package/ai/components/recipe-workspace-header.md +57 -0
- package/ai/components/resize.md +106 -0
- package/ai/components/row.md +96 -0
- package/ai/components/search-field.md +108 -0
- package/ai/components/segmented-control.md +83 -0
- package/ai/components/select.md +118 -0
- package/ai/components/skeleton.md +84 -0
- package/ai/components/slider.md +84 -0
- package/ai/components/spacer.md +86 -0
- package/ai/components/split-button.md +83 -0
- package/ai/components/split-view.md +105 -0
- package/ai/components/state-banner.md +96 -0
- package/ai/components/summary-row.md +85 -0
- package/ai/components/sunken-panel.md +79 -0
- package/ai/components/surface-scaffold.md +117 -0
- package/ai/components/switch.md +81 -0
- package/ai/components/tab-bar.md +114 -0
- package/ai/components/tab-navigator.md +105 -0
- package/ai/components/tabs.md +95 -0
- package/ai/components/tag-field.md +86 -0
- package/ai/components/text-field.md +102 -0
- package/ai/components/text.md +93 -0
- package/ai/components/toast.md +85 -0
- package/ai/components/toolbar-control-group.md +127 -0
- package/ai/components/toolbar-text.md +100 -0
- package/ai/components/toolbar.md +103 -0
- package/ai/components/tooltip.md +81 -0
- package/ai/components/value-table.md +80 -0
- package/ai/components/wa-accordion-item.md +61 -0
- package/ai/components/wa-accordion.md +71 -0
- package/ai/components/wa-animated-image.md +56 -0
- package/ai/components/wa-animation.md +56 -0
- package/ai/components/wa-avatar.md +56 -0
- package/ai/components/wa-badge.md +62 -0
- package/ai/components/wa-breadcrumb-item.md +54 -0
- package/ai/components/wa-breadcrumb.md +56 -0
- package/ai/components/wa-button-group.md +62 -0
- package/ai/components/wa-button.md +61 -0
- package/ai/components/wa-callout.md +60 -0
- package/ai/components/wa-card.md +67 -0
- package/ai/components/wa-carousel-item.md +54 -0
- package/ai/components/wa-carousel.md +56 -0
- package/ai/components/wa-checkbox-group.md +62 -0
- package/ai/components/wa-checkbox.md +61 -0
- package/ai/components/wa-color-picker.md +63 -0
- package/ai/components/wa-comparison.md +56 -0
- package/ai/components/wa-copy-button.md +56 -0
- package/ai/components/wa-details.md +67 -0
- package/ai/components/wa-dialog.md +65 -0
- package/ai/components/wa-divider.md +54 -0
- package/ai/components/wa-drawer.md +62 -0
- package/ai/components/wa-dropdown-item.md +62 -0
- package/ai/components/wa-dropdown.md +62 -0
- package/ai/components/wa-format-bytes.md +54 -0
- package/ai/components/wa-format-date.md +54 -0
- package/ai/components/wa-format-number.md +54 -0
- package/ai/components/wa-icon.md +59 -0
- package/ai/components/wa-include.md +55 -0
- package/ai/components/wa-input.md +62 -0
- package/ai/components/wa-intersection-observer.md +54 -0
- package/ai/components/wa-known-date.md +54 -0
- package/ai/components/wa-markdown.md +54 -0
- package/ai/components/wa-mutation-observer.md +54 -0
- package/ai/components/wa-number-input.md +56 -0
- package/ai/components/wa-option.md +61 -0
- package/ai/components/wa-otp-input.md +54 -0
- package/ai/components/wa-page.md +62 -0
- package/ai/components/wa-pagination.md +56 -0
- package/ai/components/wa-popover.md +61 -0
- package/ai/components/wa-popup.md +60 -0
- package/ai/components/wa-progress-bar.md +60 -0
- package/ai/components/wa-progress-ring.md +60 -0
- package/ai/components/wa-qr-code.md +54 -0
- package/ai/components/wa-radio-group.md +67 -0
- package/ai/components/wa-radio.md +61 -0
- package/ai/components/wa-random-content.md +54 -0
- package/ai/components/wa-rating.md +56 -0
- package/ai/components/wa-relative-time.md +54 -0
- package/ai/components/wa-resize-observer.md +54 -0
- package/ai/components/wa-scroller.md +61 -0
- package/ai/components/wa-select.md +65 -0
- package/ai/components/wa-skeleton.md +60 -0
- package/ai/components/wa-slider.md +61 -0
- package/ai/components/wa-spinner.md +60 -0
- package/ai/components/wa-split-panel.md +60 -0
- package/ai/components/wa-step.md +56 -0
- package/ai/components/wa-stepper.md +56 -0
- package/ai/components/wa-switch.md +60 -0
- package/ai/components/wa-tab-group.md +71 -0
- package/ai/components/wa-tab-panel.md +62 -0
- package/ai/components/wa-tab.md +61 -0
- package/ai/components/wa-tag-input.md +62 -0
- package/ai/components/wa-tag.md +62 -0
- package/ai/components/wa-textarea.md +60 -0
- package/ai/components/wa-time-input.md +56 -0
- package/ai/components/wa-toast-item.md +62 -0
- package/ai/components/wa-toast.md +62 -0
- package/ai/components/wa-tooltip.md +61 -0
- package/ai/components/wa-tree-item.md +56 -0
- package/ai/components/wa-tree.md +56 -0
- package/ai/components/wa-zoomable-frame.md +56 -0
- package/ai/components/workbench-dialog.md +90 -0
- package/ai/components/workbench.md +120 -0
- package/ai/public-api-signatures-v1.md +6114 -445
- package/ai/skill.md +545 -65
- package/ai/webawesome-jsx-signatures-v1.md +12 -2
- package/analyzer/cli.mjs +49 -0
- package/analyzer/component-ownership.d.mts +72 -0
- package/analyzer/component-ownership.mjs +429 -0
- package/analyzer/index.d.mts +53 -0
- package/analyzer/index.mjs +2375 -0
- package/analyzer/loud-pairs.d.mts +49 -0
- package/analyzer/loud-pairs.mjs +357 -0
- package/analyzer/report.schema.json +66 -0
- package/analyzer/selectors.d.mts +21 -0
- package/analyzer/selectors.mjs +212 -0
- package/catalog-projection-cli.mjs +96 -0
- package/catalog-projection.d.mts +55 -0
- package/catalog-projection.mjs +62 -0
- package/dist/anchored-surface.d.ts +69 -0
- package/dist/anchored-surface.js +3 -0
- package/dist/anchored-surface.js.map +1 -0
- package/dist/backdrop-image.d.ts +132 -0
- package/dist/backdrop-image.js +5 -0
- package/dist/backdrop-image.js.map +1 -0
- package/dist/badge.d.ts +91 -0
- package/dist/badge.js +4 -0
- package/dist/badge.js.map +1 -0
- package/dist/browser/anchored-surface.js +3 -0
- package/dist/browser/backdrop-image.js +3 -0
- package/dist/browser/badge.js +3 -0
- package/dist/browser/button.js +5 -0
- package/dist/browser/catalog.js +29 -0
- package/dist/browser/checkbox-group.js +5 -0
- package/dist/browser/checkbox.js +4 -0
- package/dist/browser/chip.js +3 -0
- package/dist/browser/choice-chips.js +3 -0
- package/dist/browser/collapsible-panel.js +9 -0
- package/dist/browser/color-field.js +4 -0
- package/dist/browser/color-picker.js +5 -0
- package/dist/browser/color-swatches.js +3 -0
- package/dist/browser/column-track.js +3 -0
- package/dist/browser/combobox.js +3 -0
- package/dist/browser/content-item.js +3 -0
- package/dist/browser/content-swap.js +3 -0
- package/dist/browser/corner-status.js +3 -0
- package/dist/browser/disclosure.js +5 -0
- package/dist/browser/edge-activity-indicator.js +3 -0
- package/dist/browser/file-picker.js +3 -0
- package/dist/browser/framed-list.js +3 -0
- package/dist/browser/grid.js +3 -0
- package/dist/browser/list-action-row.js +3 -0
- package/dist/browser/list-detail-dialog.js +14 -0
- package/dist/browser/list-header.js +3 -1
- package/dist/browser/list-inset-control.js +3 -0
- package/dist/browser/list-inset-text.js +3 -0
- package/dist/browser/list-item.js +1 -0
- package/dist/browser/list.js +3 -0
- package/dist/browser/message-composer.js +5 -0
- package/dist/browser/nav-stack.js +11 -0
- package/dist/browser/pane.js +3 -0
- package/dist/browser/popup-menu.js +4 -0
- package/dist/browser/progress-bar.js +3 -0
- package/dist/browser/progress-ring.js +3 -0
- package/dist/browser/radio-group.js +3 -0
- package/dist/browser/row.js +3 -0
- package/dist/browser/search-field.js +4 -0
- package/dist/browser/segmented-control.js +0 -1
- package/dist/browser/select.js +2 -1
- package/dist/browser/slider.js +3 -0
- package/dist/browser/spacer.js +3 -0
- package/dist/browser/split-button.js +5 -0
- package/dist/browser/split-view.js +13 -0
- package/dist/browser/state-banner.js +1 -0
- package/dist/browser/summary-row.js +3 -0
- package/dist/browser/sunken-panel.js +3 -0
- package/dist/browser/surface-scaffold.js +4 -0
- package/dist/browser/switch.js +3 -0
- package/dist/browser/tab-bar-item.js +4 -0
- package/dist/browser/tab-navigator.js +4 -0
- package/dist/browser/tag-field.js +5 -0
- package/dist/browser/text-field.js +4 -0
- package/dist/browser/text.js +3 -0
- package/dist/browser/toolbar-control-group.js +1 -0
- package/dist/browser/workbench-dialog.js +15 -0
- package/dist/browser/workbench.js +14 -0
- package/dist/button.d.ts +121 -0
- package/dist/button.js +7 -0
- package/dist/button.js.map +1 -0
- package/dist/catalog-resources.d.ts +50 -0
- package/dist/catalog-resources.js +22 -0
- package/dist/catalog-resources.js.map +1 -0
- package/dist/catalog.d.ts +134 -101
- package/dist/catalog.js +700 -108
- package/dist/catalog.js.map +1 -1
- package/dist/checkbox-group.d.ts +70 -0
- package/dist/checkbox-group.js +7 -0
- package/dist/checkbox-group.js.map +1 -0
- package/dist/checkbox.d.ts +45 -0
- package/dist/checkbox.js +6 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chip.d.ts +117 -0
- package/dist/chip.js +4 -0
- package/dist/chip.js.map +1 -0
- package/dist/choice-chips.d.ts +116 -0
- package/dist/choice-chips.js +3 -0
- package/dist/choice-chips.js.map +1 -0
- package/dist/chunk-2FW7D4IG.js +52 -0
- package/dist/chunk-2FW7D4IG.js.map +1 -0
- package/dist/chunk-2GOCOLQL.js +270 -0
- package/dist/chunk-2GOCOLQL.js.map +1 -0
- package/dist/chunk-2LM3PYHA.js +300 -0
- package/dist/chunk-2LM3PYHA.js.map +1 -0
- package/dist/chunk-36HVQ72F.js +123 -0
- package/dist/chunk-36HVQ72F.js.map +1 -0
- package/dist/chunk-3GLYIIFR.js +230 -0
- package/dist/chunk-3GLYIIFR.js.map +1 -0
- package/dist/chunk-3VZ6SFD4.js +8 -0
- package/dist/chunk-3VZ6SFD4.js.map +1 -0
- package/dist/chunk-3WYREXW4.js +120 -0
- package/dist/chunk-3WYREXW4.js.map +1 -0
- package/dist/chunk-3Z7N2NAZ.js +385 -0
- package/dist/chunk-3Z7N2NAZ.js.map +1 -0
- package/dist/chunk-4OV272LF.js +93 -0
- package/dist/chunk-4OV272LF.js.map +1 -0
- package/dist/chunk-4RECPEHI.js +67 -0
- package/dist/chunk-4RECPEHI.js.map +1 -0
- package/dist/chunk-4UB5Z3ZZ.js +68 -0
- package/dist/chunk-4UB5Z3ZZ.js.map +1 -0
- package/dist/chunk-5J6Z4BWY.js +141 -0
- package/dist/chunk-5J6Z4BWY.js.map +1 -0
- package/dist/chunk-5USKCWGL.js +113 -0
- package/dist/chunk-5USKCWGL.js.map +1 -0
- package/dist/chunk-6C6DLP3W.js +31 -0
- package/dist/chunk-6C6DLP3W.js.map +1 -0
- package/dist/chunk-6CDILXF4.js +204 -0
- package/dist/chunk-6CDILXF4.js.map +1 -0
- package/dist/chunk-6VVIW7VB.js +69 -0
- package/dist/chunk-6VVIW7VB.js.map +1 -0
- package/dist/chunk-7AK5I7U7.js +55 -0
- package/dist/chunk-7AK5I7U7.js.map +1 -0
- package/dist/chunk-7K6U6FCN.js +122 -0
- package/dist/chunk-7K6U6FCN.js.map +1 -0
- package/dist/chunk-AMIHGFLP.js +59 -0
- package/dist/chunk-AMIHGFLP.js.map +1 -0
- package/dist/chunk-AN5IWMTM.js +24 -0
- package/dist/chunk-AN5IWMTM.js.map +1 -0
- package/dist/chunk-ATGAJVZ6.js +268 -0
- package/dist/chunk-ATGAJVZ6.js.map +1 -0
- package/dist/chunk-AYPGXR2E.js +20 -0
- package/dist/chunk-AYPGXR2E.js.map +1 -0
- package/dist/chunk-B53PS2LE.js +34 -0
- package/dist/chunk-B53PS2LE.js.map +1 -0
- package/dist/chunk-BKUMG2KB.js +95 -0
- package/dist/chunk-BKUMG2KB.js.map +1 -0
- package/dist/chunk-C26Q6P4Q.js +76 -0
- package/dist/chunk-C26Q6P4Q.js.map +1 -0
- package/dist/chunk-CEJ5FK6G.js +288 -0
- package/dist/chunk-CEJ5FK6G.js.map +1 -0
- package/dist/chunk-CIAUILRR.js +222 -0
- package/dist/chunk-CIAUILRR.js.map +1 -0
- package/dist/chunk-CNM6ZWP2.js +38 -0
- package/dist/chunk-CNM6ZWP2.js.map +1 -0
- package/dist/chunk-CPSGUGAY.js +527 -0
- package/dist/chunk-CPSGUGAY.js.map +1 -0
- package/dist/chunk-CTQUDCY5.js +26 -0
- package/dist/chunk-CTQUDCY5.js.map +1 -0
- package/dist/chunk-CVD5IZGB.js +66 -0
- package/dist/chunk-CVD5IZGB.js.map +1 -0
- package/dist/chunk-D4MXSAMI.js +50 -0
- package/dist/chunk-D4MXSAMI.js.map +1 -0
- package/dist/chunk-D5RGM3XA.js +38 -0
- package/dist/chunk-D5RGM3XA.js.map +1 -0
- package/dist/chunk-DZJ4GBSP.js +59 -0
- package/dist/chunk-DZJ4GBSP.js.map +1 -0
- package/dist/chunk-EIET4QLK.js +51 -0
- package/dist/chunk-EIET4QLK.js.map +1 -0
- package/dist/chunk-EKHDLBRP.js +86 -0
- package/dist/chunk-EKHDLBRP.js.map +1 -0
- package/dist/chunk-EYDXFOSH.js +457 -0
- package/dist/chunk-EYDXFOSH.js.map +1 -0
- package/dist/chunk-G3J7JDP6.js +29 -0
- package/dist/chunk-G3J7JDP6.js.map +1 -0
- package/dist/chunk-GS2QD3N7.js +14 -0
- package/dist/chunk-GS2QD3N7.js.map +1 -0
- package/dist/chunk-GXSX6Q6O.js +42 -0
- package/dist/chunk-GXSX6Q6O.js.map +1 -0
- package/dist/chunk-HDXUHLTQ.js +90 -0
- package/dist/chunk-HDXUHLTQ.js.map +1 -0
- package/dist/chunk-HJXVVFBT.js +108 -0
- package/dist/chunk-HJXVVFBT.js.map +1 -0
- package/dist/chunk-HQZG3OFL.js +158 -0
- package/dist/chunk-HQZG3OFL.js.map +1 -0
- package/dist/chunk-HTERKONR.js +49 -0
- package/dist/chunk-HTERKONR.js.map +1 -0
- package/dist/chunk-HU5IHXCI.js +73 -0
- package/dist/chunk-HU5IHXCI.js.map +1 -0
- package/dist/chunk-IKS72C6P.js +53 -0
- package/dist/chunk-IKS72C6P.js.map +1 -0
- package/dist/chunk-IO27YTL3.js +73 -0
- package/dist/chunk-IO27YTL3.js.map +1 -0
- package/dist/chunk-IQSRHXZR.js +164 -0
- package/dist/chunk-IQSRHXZR.js.map +1 -0
- package/dist/chunk-ITUQC4FW.js +163 -0
- package/dist/chunk-ITUQC4FW.js.map +1 -0
- package/dist/chunk-JCCN3U6X.js +176 -0
- package/dist/chunk-JCCN3U6X.js.map +1 -0
- package/dist/chunk-K57NINLH.js +137 -0
- package/dist/chunk-K57NINLH.js.map +1 -0
- package/dist/chunk-KC6WUSNS.js +34 -0
- package/dist/chunk-KC6WUSNS.js.map +1 -0
- package/dist/chunk-KCS6NJ3O.js +82 -0
- package/dist/chunk-KCS6NJ3O.js.map +1 -0
- package/dist/chunk-KDQZ3E5C.js +75 -0
- package/dist/chunk-KDQZ3E5C.js.map +1 -0
- package/dist/chunk-KH4KEMSP.js +71 -0
- package/dist/chunk-KH4KEMSP.js.map +1 -0
- package/dist/chunk-KK3S5OTW.js +98 -0
- package/dist/chunk-KK3S5OTW.js.map +1 -0
- package/dist/chunk-KPINJHIC.js +122 -0
- package/dist/chunk-KPINJHIC.js.map +1 -0
- package/dist/chunk-LMHN2TJL.js +167 -0
- package/dist/chunk-LMHN2TJL.js.map +1 -0
- package/dist/chunk-LTBVP6VN.js +59 -0
- package/dist/chunk-LTBVP6VN.js.map +1 -0
- package/dist/{chunk-YGN7OMLT.js → chunk-LZUUUHNH.js} +13 -6
- package/dist/chunk-LZUUUHNH.js.map +1 -0
- package/dist/chunk-MHMWQ7RB.js +19 -0
- package/dist/chunk-MHMWQ7RB.js.map +1 -0
- package/dist/chunk-MJ5RU6XT.js +173 -0
- package/dist/chunk-MJ5RU6XT.js.map +1 -0
- package/dist/chunk-MVKHSAKE.js +169 -0
- package/dist/chunk-MVKHSAKE.js.map +1 -0
- package/dist/chunk-NB6POCFH.js +103 -0
- package/dist/chunk-NB6POCFH.js.map +1 -0
- package/dist/chunk-NR6O74ST.js +169 -0
- package/dist/chunk-NR6O74ST.js.map +1 -0
- package/dist/chunk-OHPYT2BH.js +82 -0
- package/dist/chunk-OHPYT2BH.js.map +1 -0
- package/dist/chunk-OQP3PFKQ.js +341 -0
- package/dist/chunk-OQP3PFKQ.js.map +1 -0
- package/dist/chunk-OZ6X76G5.js +547 -0
- package/dist/chunk-OZ6X76G5.js.map +1 -0
- package/dist/chunk-P7EJ4CAD.js +147 -0
- package/dist/chunk-P7EJ4CAD.js.map +1 -0
- package/dist/chunk-QDSZTQXL.js +28 -0
- package/dist/chunk-QDSZTQXL.js.map +1 -0
- package/dist/chunk-QH5KOFNS.js +39 -0
- package/dist/chunk-QH5KOFNS.js.map +1 -0
- package/dist/chunk-QPTJ5DOO.js +87 -0
- package/dist/chunk-QPTJ5DOO.js.map +1 -0
- package/dist/chunk-QYMJHS4K.js +36 -0
- package/dist/chunk-QYMJHS4K.js.map +1 -0
- package/dist/chunk-RMWNO6BA.js +89 -0
- package/dist/chunk-RMWNO6BA.js.map +1 -0
- package/dist/chunk-S2XULQEK.js +52 -0
- package/dist/chunk-S2XULQEK.js.map +1 -0
- package/dist/chunk-S3ECMF23.js +33 -0
- package/dist/chunk-S3ECMF23.js.map +1 -0
- package/dist/chunk-S4Y3YTAI.js +35 -0
- package/dist/chunk-S4Y3YTAI.js.map +1 -0
- package/dist/chunk-S4ZGTDSG.js +18 -0
- package/dist/chunk-S4ZGTDSG.js.map +1 -0
- package/dist/chunk-SCDWURBO.js +136 -0
- package/dist/chunk-SCDWURBO.js.map +1 -0
- package/dist/chunk-SOFPUW3O.js +196 -0
- package/dist/chunk-SOFPUW3O.js.map +1 -0
- package/dist/chunk-SQ5DH66U.js +37 -0
- package/dist/chunk-SQ5DH66U.js.map +1 -0
- package/dist/chunk-T74YB76U.js +547 -0
- package/dist/chunk-T74YB76U.js.map +1 -0
- package/dist/chunk-TI2GV36S.js +90 -0
- package/dist/chunk-TI2GV36S.js.map +1 -0
- package/dist/{chunk-56RJXPHG.js → chunk-TKNVL53O.js} +7 -4
- package/dist/chunk-TKNVL53O.js.map +1 -0
- package/dist/chunk-TNJLNLVE.js +115 -0
- package/dist/chunk-TNJLNLVE.js.map +1 -0
- package/dist/chunk-TUID42UE.js +15 -0
- package/dist/chunk-TUID42UE.js.map +1 -0
- package/dist/chunk-UMNHJSIO.js +848 -0
- package/dist/chunk-UMNHJSIO.js.map +1 -0
- package/dist/chunk-VEME3D7K.js +298 -0
- package/dist/chunk-VEME3D7K.js.map +1 -0
- package/dist/chunk-WPNIKZMJ.js +507 -0
- package/dist/chunk-WPNIKZMJ.js.map +1 -0
- package/dist/chunk-WSEJ2FDE.js +162 -0
- package/dist/chunk-WSEJ2FDE.js.map +1 -0
- package/dist/chunk-WVS6CUCT.js +48 -0
- package/dist/chunk-WVS6CUCT.js.map +1 -0
- package/dist/chunk-XWNXGFX3.js +381 -0
- package/dist/chunk-XWNXGFX3.js.map +1 -0
- package/dist/chunk-Y6KT7ZTR.js +109 -0
- package/dist/chunk-Y6KT7ZTR.js.map +1 -0
- package/dist/chunk-YMUIQRWK.js +44 -0
- package/dist/chunk-YMUIQRWK.js.map +1 -0
- package/dist/chunk-ZCDRLN3B.js +138 -0
- package/dist/chunk-ZCDRLN3B.js.map +1 -0
- package/dist/chunk-ZKKO4MHC.js +25 -0
- package/dist/chunk-ZKKO4MHC.js.map +1 -0
- package/dist/chunk-ZN7KUMPY.js +48 -0
- package/dist/chunk-ZN7KUMPY.js.map +1 -0
- package/dist/chunk-ZNROKDSZ.js +54 -0
- package/dist/chunk-ZNROKDSZ.js.map +1 -0
- package/dist/chunk-ZX2QQJXD.js +249 -0
- package/dist/chunk-ZX2QQJXD.js.map +1 -0
- package/dist/collapsible-panel.d.ts +96 -17
- package/dist/collapsible-panel.js +133 -14
- package/dist/collapsible-panel.js.map +1 -1
- package/dist/color-field.d.ts +51 -0
- package/dist/color-field.js +92 -0
- package/dist/color-field.js.map +1 -0
- package/dist/color-picker.d.ts +113 -0
- package/dist/color-picker.js +8 -0
- package/dist/color-picker.js.map +1 -0
- package/dist/color-swatches.d.ts +56 -0
- package/dist/color-swatches.js +4 -0
- package/dist/color-swatches.js.map +1 -0
- package/dist/column-track.d.ts +41 -0
- package/dist/column-track.js +4 -0
- package/dist/column-track.js.map +1 -0
- package/dist/combobox.d.ts +40 -0
- package/dist/combobox.js +3 -0
- package/dist/combobox.js.map +1 -0
- package/dist/content-item.d.ts +128 -0
- package/dist/content-item.js +4 -0
- package/dist/content-item.js.map +1 -0
- package/dist/content-swap.d.ts +34 -0
- package/dist/content-swap.js +3 -0
- package/dist/content-swap.js.map +1 -0
- package/dist/corner-status.d.ts +36 -0
- package/dist/corner-status.js +3 -0
- package/dist/corner-status.js.map +1 -0
- package/dist/css-values.d.ts +127 -0
- package/dist/css-values.js +3 -0
- package/dist/css-values.js.map +1 -0
- package/dist/device-class.js +34 -6
- package/dist/device-class.js.map +1 -1
- package/dist/disclosure-arrow.d.ts +6 -1
- package/dist/disclosure-arrow.js +2 -1
- package/dist/disclosure.d.ts +66 -0
- package/dist/disclosure.js +51 -0
- package/dist/disclosure.js.map +1 -0
- package/dist/edge-activity-indicator.d.ts +28 -0
- package/dist/edge-activity-indicator.js +3 -0
- package/dist/edge-activity-indicator.js.map +1 -0
- package/dist/empty-state.d.ts +5 -2
- package/dist/empty-state.js +2 -1
- package/dist/extension-attributes-mu8MFUl0.d.ts +13 -0
- package/dist/file-picker.d.ts +54 -0
- package/dist/file-picker.js +3 -0
- package/dist/file-picker.js.map +1 -0
- package/dist/flex-alignment-4ms8ZbV8.d.ts +5 -0
- package/dist/floating-toolbar.d.ts +29 -6
- package/dist/floating-toolbar.js +1 -1
- package/dist/framed-list.d.ts +47 -0
- package/dist/framed-list.js +4 -0
- package/dist/framed-list.js.map +1 -0
- package/dist/grid.d.ts +58 -0
- package/dist/grid.js +6 -0
- package/dist/grid.js.map +1 -0
- package/dist/help-tags-register.d.ts +13 -0
- package/dist/help-tags-register.js +10 -0
- package/dist/help-tags-register.js.map +1 -0
- package/dist/index.d.ts +72 -17
- package/dist/index.js +84 -25
- package/dist/list-action-row.d.ts +69 -12
- package/dist/list-action-row.js +8 -1
- package/dist/list-detail-dialog.d.ts +123 -0
- package/dist/list-detail-dialog.js +167 -0
- package/dist/list-detail-dialog.js.map +1 -0
- package/dist/list-header.d.ts +72 -10
- package/dist/list-header.js +4 -1
- package/dist/list-icon-tile-B8dr97OW.d.ts +18 -0
- package/dist/list-inset-control.d.ts +22 -0
- package/dist/list-inset-control.js +3 -0
- package/dist/list-inset-control.js.map +1 -0
- package/dist/list-inset-text.d.ts +30 -0
- package/dist/list-inset-text.js +4 -0
- package/dist/list-inset-text.js.map +1 -0
- package/dist/list-item.d.ts +49 -5
- package/dist/list-item.js +4 -1
- package/dist/list.d.ts +149 -0
- package/dist/list.js +7 -0
- package/dist/list.js.map +1 -0
- package/dist/loading-spinner.d.ts +12 -2
- package/dist/loading-spinner.js +2 -1
- package/dist/lucide-icon.d.ts +23 -3
- package/dist/lucide-icon.js +2 -1
- package/dist/message-composer.d.ts +70 -0
- package/dist/message-composer.js +6 -0
- package/dist/message-composer.js.map +1 -0
- package/dist/nav-stack-CU_0dKtI.d.ts +194 -0
- package/dist/nav-stack.d.ts +15 -38
- package/dist/nav-stack.js +14 -1
- package/dist/pane.d.ts +258 -0
- package/dist/pane.js +6 -0
- package/dist/pane.js.map +1 -0
- package/dist/panel-toolbar-vg6Ir5Dy.d.ts +77 -0
- package/dist/popup-menu-register.d.ts +11 -0
- package/dist/popup-menu-register.js +13 -0
- package/dist/popup-menu-register.js.map +1 -0
- package/dist/popup-menu.d.ts +153 -0
- package/dist/popup-menu.js +7 -0
- package/dist/popup-menu.js.map +1 -0
- package/dist/progress-bar.d.ts +52 -0
- package/dist/progress-bar.js +68 -0
- package/dist/progress-bar.js.map +1 -0
- package/dist/progress-ring.d.ts +44 -0
- package/dist/progress-ring.js +73 -0
- package/dist/progress-ring.js.map +1 -0
- package/dist/radio-group.d.ts +62 -0
- package/dist/radio-group.js +4 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/resizable-region.d.ts +32 -3
- package/dist/resizable-region.js +1 -1
- package/dist/row.d.ts +53 -0
- package/dist/row.js +7 -0
- package/dist/row.js.map +1 -0
- package/dist/scroll-clearance-BikHljTc.d.ts +14 -0
- package/dist/search-field-CrGTN5sa.d.ts +208 -0
- package/dist/search-field-model.d.ts +3 -0
- package/dist/search-field-model.js +3 -0
- package/dist/search-field-model.js.map +1 -0
- package/dist/search-field.d.ts +3 -0
- package/dist/search-field.js +5 -0
- package/dist/search-field.js.map +1 -0
- package/dist/segmented-control.d.ts +14 -9
- package/dist/segmented-control.js +1 -2
- package/dist/select-register.d.ts +6 -3
- package/dist/select-register.js +402 -8
- package/dist/select-register.js.map +1 -1
- package/dist/select.d.ts +128 -9
- package/dist/select.js +6 -1
- package/dist/selection.d.ts +54 -0
- package/dist/selection.js +3 -0
- package/dist/selection.js.map +1 -0
- package/dist/semantic-content-BbzjvSu9.d.ts +14 -0
- package/dist/semantic-tone-CdW013KF.d.ts +4 -0
- package/dist/sides-BPSWde0A.d.ts +4 -0
- package/dist/skeleton.d.ts +14 -7
- package/dist/skeleton.js +2 -1
- package/dist/slider.d.ts +74 -0
- package/dist/slider.js +103 -0
- package/dist/slider.js.map +1 -0
- package/dist/spacer.d.ts +18 -0
- package/dist/spacer.js +4 -0
- package/dist/spacer.js.map +1 -0
- package/dist/split-button.d.ts +69 -0
- package/dist/split-button.js +7 -0
- package/dist/split-button.js.map +1 -0
- package/dist/split-view.d.ts +66 -6
- package/dist/split-view.js +14 -15
- package/dist/split-view.js.map +1 -1
- package/dist/state-banner.d.ts +41 -7
- package/dist/state-banner.js +4 -1
- package/dist/styles/anchored-surface.css +44 -0
- package/dist/styles/backdrop-image.css +241 -0
- package/dist/styles/badge.css +157 -0
- package/dist/styles/button.css +293 -0
- package/dist/styles/catalog/components/catalog-example-stack.css +14 -0
- package/dist/styles/catalog/components/catalog-example.css +250 -0
- package/dist/styles/catalog/components/catalog-stage.css +61 -0
- package/dist/styles/catalog/components/catalog.css +26 -0
- package/dist/styles/catalog.css +5 -522
- package/dist/styles/checkbox-group.css +63 -0
- package/dist/styles/checkbox.css +122 -0
- package/dist/styles/chip.css +234 -0
- package/dist/styles/choice-chips.css +205 -0
- package/dist/styles/collapsible-panel.css +450 -16
- package/dist/styles/color-field.css +125 -0
- package/dist/styles/color-picker.css +366 -0
- package/dist/styles/color-swatches.css +122 -0
- package/dist/styles/column-track.css +57 -0
- package/dist/styles/combobox.css +115 -0
- package/dist/styles/components/actions/button/button.css +293 -0
- package/dist/styles/components/actions/floating-toolbar/floating-toolbar.css +119 -0
- package/dist/styles/components/actions/popup-menu/popup-menu.css +498 -0
- package/dist/styles/components/actions/split-button/split-button.css +141 -0
- package/dist/styles/components/actions/toolbar/toolbar.css +483 -0
- package/dist/styles/components/actions/toolbar-control-group/toolbar-control-group.css +1188 -0
- package/dist/styles/components/actions/toolbar-text/toolbar-text.css +256 -0
- package/dist/styles/components/collections/framed-list/framed-list.css +53 -0
- package/dist/styles/components/collections/list/list.css +293 -0
- package/dist/styles/components/collections/list-action-row/list-action-row.css +466 -0
- package/dist/styles/components/collections/list-header/list-header.css +236 -0
- package/dist/styles/components/collections/list-inset-control/list-inset-control.css +30 -0
- package/dist/styles/components/collections/list-inset-text/list-inset-text.css +29 -0
- package/dist/styles/components/collections/list-item/list-item.css +461 -0
- package/dist/styles/components/collections/summary-row/summary-row.css +161 -0
- package/dist/styles/components/data-display/value-table/value-table.css +183 -0
- package/dist/styles/components/feedback/anchored-surface/anchored-surface.css +44 -0
- package/dist/styles/components/feedback/badge/badge.css +157 -0
- package/dist/styles/components/feedback/chip/chip.css +234 -0
- package/dist/styles/components/feedback/corner-status/corner-status.css +60 -0
- package/dist/styles/components/feedback/edge-activity-indicator/edge-activity-indicator.css +127 -0
- package/dist/styles/components/feedback/empty-state/empty-state.css +47 -0
- package/dist/styles/components/feedback/loading-spinner/loading-spinner.css +25 -0
- package/dist/styles/components/feedback/progress-bar/progress-bar.css +168 -0
- package/dist/styles/components/feedback/progress-ring/progress-ring.css +91 -0
- package/dist/styles/components/feedback/skeleton/skeleton.css +92 -0
- package/dist/styles/components/feedback/state-banner/state-banner.css +312 -0
- package/dist/styles/components/forms/checkbox/checkbox.css +122 -0
- package/dist/styles/components/forms/checkbox-group/checkbox-group.css +63 -0
- package/dist/styles/components/forms/choice-chips/choice-chips.css +205 -0
- package/dist/styles/components/forms/color-field/color-field.css +125 -0
- package/dist/styles/components/forms/color-picker/color-picker.css +366 -0
- package/dist/styles/components/forms/color-swatches/color-swatches.css +122 -0
- package/dist/styles/components/forms/combobox/combobox.css +115 -0
- package/dist/styles/components/forms/file-picker/file-picker.css +81 -0
- package/dist/styles/components/forms/message-composer/message-composer.css +84 -0
- package/dist/styles/components/forms/radio-group/radio-group.css +158 -0
- package/dist/styles/components/forms/search-field/search-field.css +441 -0
- package/dist/styles/components/forms/segmented-control/segmented-control.css +196 -0
- package/dist/styles/components/forms/select/select.css +580 -0
- package/dist/styles/components/forms/slider/slider.css +241 -0
- package/dist/styles/components/forms/switch/switch.css +132 -0
- package/dist/styles/components/forms/tag-field/tag-field.css +8 -0
- package/dist/styles/components/forms/text-field/text-field.css +193 -0
- package/dist/styles/components/layout/collapsible-panel/collapsible-panel.css +580 -0
- package/dist/styles/components/layout/column-track/column-track.css +57 -0
- package/dist/styles/components/layout/content-swap/content-swap.css +154 -0
- package/dist/styles/components/layout/grid/grid.css +88 -0
- package/dist/styles/components/layout/pane/pane.css +780 -0
- package/dist/styles/components/layout/resizable-region/resizable-region.css +546 -0
- package/dist/styles/components/layout/row/row.css +125 -0
- package/dist/styles/components/layout/spacer/spacer.css +11 -0
- package/dist/styles/components/layout/split-view/split-view.css +171 -0
- package/dist/styles/components/layout/workbench/workbench.css +1098 -0
- package/dist/styles/components/media/lucide-icon/lucide-icon.css +15 -0
- package/dist/styles/components/navigation/disclosure-arrow/disclosure-arrow.css +43 -0
- package/dist/styles/components/navigation/nav-stack/nav-stack.css +619 -0
- package/dist/styles/components/navigation/tab-bar/tab-bar.css +203 -0
- package/dist/styles/components/navigation/tab-bar-item/tab-bar-item.css +389 -0
- package/dist/styles/components/navigation/tab-navigator/tab-navigator.css +460 -0
- package/dist/styles/components/surfaces/backdrop-image/backdrop-image.css +241 -0
- package/dist/styles/components/surfaces/content-item/content-item.css +168 -0
- package/dist/styles/components/surfaces/disclosure/disclosure.css +136 -0
- package/dist/styles/components/surfaces/sunken-panel/sunken-panel.css +34 -0
- package/dist/styles/components/surfaces/surface-scaffold/surface-scaffold.css +744 -0
- package/dist/styles/components/typography/text/text.css +232 -0
- package/dist/styles/content-item.css +168 -0
- package/dist/styles/content-swap.css +154 -0
- package/dist/styles/corner-status.css +60 -0
- package/dist/styles/disclosure-arrow.css +20 -0
- package/dist/styles/disclosure.css +136 -0
- package/dist/styles/document.css +98 -0
- package/dist/styles/edge-activity-indicator.css +127 -0
- package/dist/styles/file-picker.css +81 -0
- package/dist/styles/floating-toolbar.css +87 -6
- package/dist/styles/foundation.css +490 -50
- package/dist/styles/framed-list.css +53 -0
- package/dist/styles/grid.css +88 -0
- package/dist/styles/layout.css +3 -41
- package/dist/styles/list-action-row.css +324 -18
- package/dist/styles/list-detail-dialog.css +11 -0
- package/dist/styles/list-header.css +135 -59
- package/dist/styles/list-inset-control.css +30 -0
- package/dist/styles/list-inset-text.css +29 -0
- package/dist/styles/list-item.css +371 -33
- package/dist/styles/list.css +293 -0
- package/dist/styles/loading-spinner.css +4 -0
- package/dist/styles/lucide-icon.css +9 -0
- package/dist/styles/message-composer.css +84 -0
- package/dist/styles/nav-stack.css +555 -47
- package/dist/styles/overlay-sheet.css +211 -0
- package/dist/styles/overlay-toast.css +149 -0
- package/dist/styles/overlay-tooltip.css +55 -0
- package/dist/styles/pane.css +780 -0
- package/dist/styles/popup-menu.css +498 -0
- package/dist/styles/progress-bar.css +168 -0
- package/dist/styles/progress-ring.css +91 -0
- package/dist/styles/radio-group.css +158 -0
- package/dist/styles/resizable-region.css +439 -4
- package/dist/styles/row.css +125 -0
- package/dist/styles/search-field.css +441 -0
- package/dist/styles/segmented-control.css +36 -9
- package/dist/styles/select.css +516 -74
- package/dist/styles/skeleton.css +64 -3
- package/dist/styles/slider.css +241 -0
- package/dist/styles/spacer.css +11 -0
- package/dist/styles/split-button.css +141 -0
- package/dist/styles/split-view.css +139 -3
- package/dist/styles/state-banner.css +164 -25
- package/dist/styles/styles.css +38 -3
- package/dist/styles/summary-row.css +161 -0
- package/dist/styles/sunken-panel.css +34 -0
- package/dist/styles/surface-scaffold.css +744 -0
- package/dist/styles/switch.css +132 -0
- package/dist/styles/tab-bar-item.css +389 -0
- package/dist/styles/tab-bar.css +167 -9
- package/dist/styles/tab-navigator.css +460 -0
- package/dist/styles/tag-field.css +8 -0
- package/dist/styles/text-field.css +193 -0
- package/dist/styles/text.css +232 -0
- package/dist/styles/toolbar-control-group.css +1000 -37
- package/dist/styles/toolbar-text.css +223 -7
- package/dist/styles/toolbar.css +433 -11
- package/dist/styles/value-table.css +115 -7
- package/dist/styles/webawesome.css +474 -18
- package/dist/styles/workbench-dialog.css +10 -0
- package/dist/styles/workbench.css +1011 -7
- package/dist/summary-row.d.ts +56 -0
- package/dist/summary-row.js +4 -0
- package/dist/summary-row.js.map +1 -0
- package/dist/sunken-panel.d.ts +38 -0
- package/dist/sunken-panel.js +4 -0
- package/dist/sunken-panel.js.map +1 -0
- package/dist/surface-scaffold-register.d.ts +12 -0
- package/dist/surface-scaffold-register.js +10 -0
- package/dist/surface-scaffold-register.js.map +1 -0
- package/dist/surface-scaffold.d.ts +280 -0
- package/dist/surface-scaffold.js +8 -0
- package/dist/surface-scaffold.js.map +1 -0
- package/dist/switch.d.ts +38 -0
- package/dist/switch.js +4 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab-bar-item.d.ts +65 -0
- package/dist/tab-bar-item.js +6 -0
- package/dist/tab-bar-item.js.map +1 -0
- package/dist/tab-bar.d.ts +33 -7
- package/dist/tab-bar.js +1 -1
- package/dist/tab-navigator.d.ts +154 -0
- package/dist/tab-navigator.js +131 -0
- package/dist/tab-navigator.js.map +1 -0
- package/dist/tag-field.d.ts +52 -0
- package/dist/tag-field.js +6 -0
- package/dist/tag-field.js.map +1 -0
- package/dist/text-field.d.ts +91 -0
- package/dist/text-field.js +6 -0
- package/dist/text-field.js.map +1 -0
- package/dist/text.d.ts +103 -0
- package/dist/text.js +3 -0
- package/dist/text.js.map +1 -0
- package/dist/toolbar-control-group.d.ts +112 -8
- package/dist/toolbar-control-group.js +3 -1
- package/dist/toolbar-text.d.ts +63 -9
- package/dist/toolbar-text.js +2 -1
- package/dist/toolbar.d.ts +77 -7
- package/dist/toolbar.js +1 -1
- package/dist/types-DmHWkSd6.d.ts +207 -0
- package/dist/value-table.d.ts +30 -4
- package/dist/value-table.js +2 -1
- package/dist/webawesome.d.ts +11 -1
- package/dist/wire-catalog.d.ts +117 -5
- package/dist/wire-catalog.js +314 -14
- package/dist/wire-catalog.js.map +1 -1
- package/dist/wire-checkboxes.d.ts +10 -0
- package/dist/wire-checkboxes.js +3 -0
- package/dist/{wire-token-search-fields.js.map → wire-checkboxes.js.map} +1 -1
- package/dist/wire-choice-chips.d.ts +17 -0
- package/dist/wire-choice-chips.js +4 -0
- package/dist/wire-choice-chips.js.map +1 -0
- package/dist/wire-color-fields.d.ts +33 -0
- package/dist/wire-color-fields.js +82 -0
- package/dist/wire-color-fields.js.map +1 -0
- package/dist/wire-color-pickers.d.ts +35 -0
- package/dist/wire-color-pickers.js +9 -0
- package/dist/wire-color-pickers.js.map +1 -0
- package/dist/wire-comboboxes.d.ts +26 -0
- package/dist/wire-comboboxes.js +4 -0
- package/dist/wire-comboboxes.js.map +1 -0
- package/dist/wire-content-items.d.ts +15 -0
- package/dist/wire-content-items.js +208 -0
- package/dist/wire-content-items.js.map +1 -0
- package/dist/wire-corner-status.d.ts +11 -0
- package/dist/wire-corner-status.js +3 -0
- package/dist/wire-corner-status.js.map +1 -0
- package/dist/wire-file-pickers.d.ts +27 -0
- package/dist/wire-file-pickers.js +3 -0
- package/dist/wire-file-pickers.js.map +1 -0
- package/dist/wire-list-focus-scroll.d.ts +16 -0
- package/dist/wire-list-focus-scroll.js +3 -0
- package/dist/wire-list-focus-scroll.js.map +1 -0
- package/dist/wire-list-reorder.d.ts +41 -0
- package/dist/wire-list-reorder.js +3 -0
- package/dist/wire-list-reorder.js.map +1 -0
- package/dist/wire-message-composers.d.ts +17 -0
- package/dist/wire-message-composers.js +3 -0
- package/dist/wire-message-composers.js.map +1 -0
- package/dist/wire-nav-stack.d.ts +4 -1
- package/dist/wire-nav-stack.js +352 -15
- package/dist/wire-nav-stack.js.map +1 -1
- package/dist/wire-overlay-sheets.d.ts +20 -0
- package/dist/wire-overlay-sheets.js +4 -0
- package/dist/wire-overlay-sheets.js.map +1 -0
- package/dist/wire-pane-chrome.d.ts +21 -0
- package/dist/wire-pane-chrome.js +67 -0
- package/dist/wire-pane-chrome.js.map +1 -0
- package/dist/wire-resizable-regions.d.ts +2 -1
- package/dist/wire-resizable-regions.js +2 -1
- package/dist/wire-scroll-dividers.d.ts +87 -0
- package/dist/wire-scroll-dividers.js +3 -0
- package/dist/wire-scroll-dividers.js.map +1 -0
- package/dist/{wire-token-search-fields.d.ts → wire-search-fields.d.ts} +34 -25
- package/dist/wire-search-fields.js +6 -0
- package/dist/wire-search-fields.js.map +1 -0
- package/dist/wire-sidebar.d.ts +24 -4
- package/dist/wire-sidebar.js +159 -45
- package/dist/wire-sidebar.js.map +1 -1
- package/dist/wire-sliders.d.ts +12 -0
- package/dist/wire-sliders.js +31 -0
- package/dist/wire-sliders.js.map +1 -0
- package/dist/wire-tab-bars.d.ts +6 -2
- package/dist/wire-tab-bars.js +1 -1
- package/dist/wire-tab-navigator.d.ts +13 -0
- package/dist/wire-tab-navigator.js +153 -0
- package/dist/wire-tab-navigator.js.map +1 -0
- package/dist/wire-tag-fields.d.ts +41 -0
- package/dist/wire-tag-fields.js +258 -0
- package/dist/wire-tag-fields.js.map +1 -0
- package/dist/wire-text-fields.d.ts +12 -0
- package/dist/wire-text-fields.js +3 -0
- package/dist/wire-text-fields.js.map +1 -0
- package/dist/wire-toolbar-visibility.d.ts +13 -0
- package/dist/wire-toolbar-visibility.js +3 -0
- package/dist/wire-toolbar-visibility.js.map +1 -0
- package/dist/wire-workbench.d.ts +116 -0
- package/dist/wire-workbench.js +6 -0
- package/dist/wire-workbench.js.map +1 -0
- package/dist/workbench-dialog.d.ts +106 -0
- package/dist/workbench-dialog.js +127 -0
- package/dist/workbench-dialog.js.map +1 -0
- package/dist/workbench.d.ts +258 -10
- package/dist/workbench.js +21 -15
- package/dist/workbench.js.map +1 -1
- package/docs/accessibility.md +829 -41
- package/docs/anchored-surface.md +107 -0
- package/docs/app-layouts.md +200 -10
- package/docs/apple-hig.md +2 -0
- package/docs/backdrop-image.md +128 -0
- package/docs/catalog.md +599 -63
- package/docs/collapsible-panel.md +308 -25
- package/docs/color-field.md +65 -0
- package/docs/color-picker.md +102 -0
- package/docs/color-swatches.md +46 -0
- package/docs/component-contract.md +865 -57
- package/docs/component-integration.md +75 -0
- package/docs/component-selection.md +1124 -108
- package/docs/design/templates/button/emphasis-dark.svg +1 -0
- package/docs/design/templates/button/emphasis.svg +1 -0
- package/docs/design/templates/button/full-width-dark.svg +1 -0
- package/docs/design/templates/button/full-width.svg +1 -0
- package/docs/design/templates/button/icons-dark.svg +1 -0
- package/docs/design/templates/button/icons.svg +1 -0
- package/docs/design/templates/button/pill-dark.svg +1 -0
- package/docs/design/templates/button/pill.svg +1 -0
- package/docs/design/templates/button/states-dark.svg +1 -0
- package/docs/design/templates/button/states.svg +1 -0
- package/docs/design/templates/button/toggles-dark.svg +1 -0
- package/docs/design/templates/button/toggles.svg +1 -0
- package/docs/design/templates/button/tones-dark.svg +1 -0
- package/docs/design/templates/button/tones.svg +1 -0
- package/docs/design/templates/button-dark.svg +1 -0
- package/docs/design/templates/button.svg +1 -0
- package/docs/design/templates/checkbox/compact-dark.svg +1 -0
- package/docs/design/templates/checkbox/compact.svg +1 -0
- package/docs/design/templates/checkbox/error-dark.svg +1 -0
- package/docs/design/templates/checkbox/error.svg +1 -0
- package/docs/design/templates/checkbox/mixed-dark.svg +1 -0
- package/docs/design/templates/checkbox/mixed.svg +1 -0
- package/docs/design/templates/checkbox/states-dark.svg +1 -0
- package/docs/design/templates/checkbox/states.svg +1 -0
- package/docs/design/templates/checkbox-dark.svg +1 -0
- package/docs/design/templates/checkbox-group/horizontal-dark.svg +1 -0
- package/docs/design/templates/checkbox-group/horizontal.svg +1 -0
- package/docs/design/templates/checkbox-group/vertical-dark.svg +1 -0
- package/docs/design/templates/checkbox-group/vertical.svg +1 -0
- package/docs/design/templates/checkbox-group-dark.svg +1 -0
- package/docs/design/templates/checkbox-group.svg +1 -0
- package/docs/design/templates/checkbox.svg +1 -0
- package/docs/design/templates/chip/action-filters-dark.svg +1 -0
- package/docs/design/templates/chip/action-filters.svg +1 -0
- package/docs/design/templates/chip/tags-dark.svg +1 -0
- package/docs/design/templates/chip/tags.svg +1 -0
- package/docs/design/templates/chip-dark.svg +1 -0
- package/docs/design/templates/chip.svg +1 -0
- package/docs/design/templates/choice-chips/color-palette-dark.svg +1 -0
- package/docs/design/templates/choice-chips/color-palette.svg +1 -0
- package/docs/design/templates/choice-chips/compact-icons-dark.svg +1 -0
- package/docs/design/templates/choice-chips/compact-icons.svg +1 -0
- package/docs/design/templates/choice-chips/multiple-dark.svg +1 -0
- package/docs/design/templates/choice-chips/multiple.svg +1 -0
- package/docs/design/templates/choice-chips-dark.svg +1 -0
- package/docs/design/templates/choice-chips.svg +1 -0
- package/docs/design/templates/color-field/compact-dark.svg +1 -0
- package/docs/design/templates/color-field/compact.svg +1 -0
- package/docs/design/templates/color-field/error-dark.svg +1 -0
- package/docs/design/templates/color-field/error.svg +1 -0
- package/docs/design/templates/color-field/hint-dark.svg +1 -0
- package/docs/design/templates/color-field/hint.svg +1 -0
- package/docs/design/templates/color-field-dark.svg +1 -0
- package/docs/design/templates/color-field.svg +1 -0
- package/docs/design/templates/color-picker/gray-dark.svg +1 -0
- package/docs/design/templates/color-picker/gray.svg +1 -0
- package/docs/design/templates/color-picker/hsb-dark.svg +1 -0
- package/docs/design/templates/color-picker/hsb.svg +1 -0
- package/docs/design/templates/color-picker/rgb-dark.svg +1 -0
- package/docs/design/templates/color-picker/rgb.svg +1 -0
- package/docs/design/templates/color-picker-dark.svg +1 -0
- package/docs/design/templates/color-picker.svg +1 -0
- package/docs/design/templates/color-swatches/palette-dark.svg +1 -0
- package/docs/design/templates/color-swatches/palette.svg +1 -0
- package/docs/design/templates/color-swatches-dark.svg +1 -0
- package/docs/design/templates/color-swatches.svg +1 -0
- package/docs/design/templates/disclosure/embedded-dark.svg +1 -0
- package/docs/design/templates/disclosure/embedded.svg +1 -0
- package/docs/design/templates/disclosure/framed-sunken-dark.svg +1 -0
- package/docs/design/templates/disclosure/framed-sunken.svg +1 -0
- package/docs/design/templates/disclosure/plain-dark.svg +1 -0
- package/docs/design/templates/disclosure/plain.svg +1 -0
- package/docs/design/templates/disclosure-dark.svg +1 -0
- package/docs/design/templates/disclosure.svg +1 -0
- package/docs/design/templates/empty-state/filtered-dark.svg +1 -1
- package/docs/design/templates/empty-state/filtered.svg +1 -1
- package/docs/design/templates/empty-state/with-action-dark.svg +1 -1
- package/docs/design/templates/empty-state/with-action.svg +1 -1
- package/docs/design/templates/empty-state-dark.svg +1 -7
- package/docs/design/templates/empty-state.svg +1 -7
- package/docs/design/templates/list/compact-dark.svg +1 -0
- package/docs/design/templates/list/compact.svg +1 -0
- package/docs/design/templates/list/stack-dark.svg +1 -0
- package/docs/design/templates/list/stack.svg +1 -0
- package/docs/design/templates/list-action-row/default-dark.svg +1 -1
- package/docs/design/templates/list-action-row/default.svg +1 -1
- package/docs/design/templates/list-action-row/icon-tile-dark.svg +1 -0
- package/docs/design/templates/list-action-row/icon-tile.svg +1 -0
- package/docs/design/templates/list-action-row/selected-dark.svg +1 -1
- package/docs/design/templates/list-action-row/selected.svg +1 -1
- package/docs/design/templates/list-action-row/trailing-menu-dark.svg +1 -0
- package/docs/design/templates/list-action-row/trailing-menu.svg +1 -0
- package/docs/design/templates/list-action-row-dark.svg +1 -7
- package/docs/design/templates/list-action-row.svg +1 -7
- package/docs/design/templates/list-dark.svg +1 -0
- package/docs/design/templates/list-header/action-dark.svg +1 -1
- package/docs/design/templates/list-header/action.svg +1 -1
- package/docs/design/templates/list-header/count-dark.svg +1 -1
- package/docs/design/templates/list-header/count.svg +1 -1
- package/docs/design/templates/list-header/inline-action-dark.svg +1 -0
- package/docs/design/templates/list-header/inline-action.svg +1 -0
- package/docs/design/templates/list-header/size-l-dark.svg +1 -0
- package/docs/design/templates/list-header/size-l.svg +1 -0
- package/docs/design/templates/list-header/size-m-dark.svg +1 -0
- package/docs/design/templates/list-header/size-m.svg +1 -0
- package/docs/design/templates/list-header/size-xl-dark.svg +1 -0
- package/docs/design/templates/list-header/size-xl.svg +1 -0
- package/docs/design/templates/list-header/size-xs-dark.svg +1 -0
- package/docs/design/templates/list-header/size-xs.svg +1 -0
- package/docs/design/templates/list-header/toggle-collapsed-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-collapsed.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded-dark.svg +1 -1
- package/docs/design/templates/list-header/toggle-expanded.svg +1 -1
- package/docs/design/templates/list-header-dark.svg +1 -11
- package/docs/design/templates/list-header.svg +1 -11
- package/docs/design/templates/list-item/default-dark.svg +1 -1
- package/docs/design/templates/list-item/default.svg +1 -1
- package/docs/design/templates/list-item/icon-tile-dark.svg +1 -0
- package/docs/design/templates/list-item/icon-tile.svg +1 -0
- package/docs/design/templates/list-item/multiline-dark.svg +1 -1
- package/docs/design/templates/list-item/multiline.svg +1 -1
- package/docs/design/templates/list-item/selected-dark.svg +1 -1
- package/docs/design/templates/list-item/selected.svg +1 -1
- package/docs/design/templates/list-item/trailing-dark.svg +1 -1
- package/docs/design/templates/list-item/trailing.svg +1 -1
- package/docs/design/templates/list-item-dark.svg +1 -11
- package/docs/design/templates/list-item.svg +1 -11
- package/docs/design/templates/list.svg +1 -0
- package/docs/design/templates/message-composer/chat-dark.svg +1 -0
- package/docs/design/templates/message-composer/chat.svg +1 -0
- package/docs/design/templates/message-composer/prompt-dark.svg +1 -0
- package/docs/design/templates/message-composer/prompt.svg +1 -0
- package/docs/design/templates/message-composer-dark.svg +1 -0
- package/docs/design/templates/message-composer.svg +1 -0
- package/docs/design/templates/progress-bar/determinate-dark.svg +1 -0
- package/docs/design/templates/progress-bar/determinate.svg +1 -0
- package/docs/design/templates/progress-bar/tones-dark.svg +1 -0
- package/docs/design/templates/progress-bar/tones.svg +1 -0
- package/docs/design/templates/progress-bar-dark.svg +1 -0
- package/docs/design/templates/progress-bar.svg +1 -0
- package/docs/design/templates/progress-ring/sizes-dark.svg +1 -0
- package/docs/design/templates/progress-ring/sizes.svg +1 -0
- package/docs/design/templates/progress-ring/tones-dark.svg +1 -0
- package/docs/design/templates/progress-ring/tones.svg +1 -0
- package/docs/design/templates/progress-ring-dark.svg +1 -0
- package/docs/design/templates/progress-ring.svg +1 -0
- package/docs/design/templates/radio-group/horizontal-dark.svg +1 -0
- package/docs/design/templates/radio-group/horizontal.svg +1 -0
- package/docs/design/templates/radio-group/vertical-dark.svg +1 -0
- package/docs/design/templates/radio-group/vertical.svg +1 -0
- package/docs/design/templates/radio-group-dark.svg +1 -0
- package/docs/design/templates/radio-group.svg +1 -0
- package/docs/design/templates/search-field/empty-dark.svg +1 -0
- package/docs/design/templates/search-field/empty.svg +1 -0
- package/docs/design/templates/search-field/tokens-dark.svg +1 -0
- package/docs/design/templates/search-field/tokens.svg +1 -0
- package/docs/design/templates/search-field-dark.svg +1 -0
- package/docs/design/templates/search-field.svg +1 -0
- package/docs/design/templates/segmented-control/equal-dark.svg +1 -1
- package/docs/design/templates/segmented-control/equal.svg +1 -1
- package/docs/design/templates/segmented-control/pill-small-dark.svg +1 -1
- package/docs/design/templates/segmented-control/pill-small.svg +1 -1
- package/docs/design/templates/segmented-control-dark.svg +1 -7
- package/docs/design/templates/segmented-control.svg +1 -7
- package/docs/design/templates/select/compact-dark.svg +1 -0
- package/docs/design/templates/select/compact.svg +1 -0
- package/docs/design/templates/select/form-dark.svg +1 -0
- package/docs/design/templates/select/form.svg +1 -0
- package/docs/design/templates/select/icons-dark.svg +1 -0
- package/docs/design/templates/select/icons.svg +1 -0
- package/docs/design/templates/select-dark.svg +1 -0
- package/docs/design/templates/select.svg +1 -0
- package/docs/design/templates/skeleton-dark.svg +1 -9
- package/docs/design/templates/skeleton.svg +1 -9
- package/docs/design/templates/slider/compact-dark.svg +1 -0
- package/docs/design/templates/slider/compact.svg +1 -0
- package/docs/design/templates/slider/readout-dark.svg +1 -0
- package/docs/design/templates/slider/readout.svg +1 -0
- package/docs/design/templates/slider/ticks-dark.svg +1 -0
- package/docs/design/templates/slider/ticks.svg +1 -0
- package/docs/design/templates/slider-dark.svg +1 -0
- package/docs/design/templates/slider.svg +1 -0
- package/docs/design/templates/split-button/full-width-dark.svg +1 -0
- package/docs/design/templates/split-button/full-width.svg +1 -0
- package/docs/design/templates/split-button/pill-dark.svg +1 -0
- package/docs/design/templates/split-button/pill.svg +1 -0
- package/docs/design/templates/split-button/states-dark.svg +1 -0
- package/docs/design/templates/split-button/states.svg +1 -0
- package/docs/design/templates/split-button/tones-dark.svg +1 -0
- package/docs/design/templates/split-button/tones.svg +1 -0
- package/docs/design/templates/split-button-dark.svg +1 -0
- package/docs/design/templates/split-button.svg +1 -0
- package/docs/design/templates/state-banner/danger-dark.svg +1 -1
- package/docs/design/templates/state-banner/danger.svg +1 -1
- package/docs/design/templates/state-banner/info-badge-dark.svg +1 -0
- package/docs/design/templates/state-banner/info-badge.svg +1 -0
- package/docs/design/templates/state-banner/info-dark.svg +1 -1
- package/docs/design/templates/state-banner/info.svg +1 -1
- package/docs/design/templates/state-banner/strip-dark.svg +1 -0
- package/docs/design/templates/state-banner/strip.svg +1 -0
- package/docs/design/templates/state-banner/success-dark.svg +1 -1
- package/docs/design/templates/state-banner/success.svg +1 -1
- package/docs/design/templates/state-banner/warning-dark.svg +1 -1
- package/docs/design/templates/state-banner/warning.svg +1 -1
- package/docs/design/templates/state-banner-dark.svg +1 -11
- package/docs/design/templates/state-banner.svg +1 -11
- package/docs/design/templates/switch/compact-dark.svg +1 -0
- package/docs/design/templates/switch/compact.svg +1 -0
- package/docs/design/templates/switch/states-dark.svg +1 -0
- package/docs/design/templates/switch/states.svg +1 -0
- package/docs/design/templates/switch-dark.svg +1 -0
- package/docs/design/templates/switch.svg +1 -0
- package/docs/design/templates/tab-bar/workspace-tabs-dark.svg +1 -1
- package/docs/design/templates/tab-bar/workspace-tabs.svg +1 -1
- package/docs/design/templates/tab-bar-dark.svg +1 -5
- package/docs/design/templates/tab-bar.svg +1 -5
- package/docs/design/templates/tag-field/error-dark.svg +1 -0
- package/docs/design/templates/tag-field/error.svg +1 -0
- package/docs/design/templates/tag-field/tags-dark.svg +1 -0
- package/docs/design/templates/tag-field/tags.svg +1 -0
- package/docs/design/templates/tag-field-dark.svg +1 -0
- package/docs/design/templates/tag-field.svg +1 -0
- package/docs/design/templates/text-field/compact-dark.svg +1 -0
- package/docs/design/templates/text-field/compact.svg +1 -0
- package/docs/design/templates/text-field/error-dark.svg +1 -0
- package/docs/design/templates/text-field/error.svg +1 -0
- package/docs/design/templates/text-field/labeled-dark.svg +1 -0
- package/docs/design/templates/text-field/labeled.svg +1 -0
- package/docs/design/templates/text-field/multiline-dark.svg +1 -0
- package/docs/design/templates/text-field/multiline.svg +1 -0
- package/docs/design/templates/text-field/number-dark.svg +1 -0
- package/docs/design/templates/text-field/number.svg +1 -0
- package/docs/design/templates/text-field/search-dark.svg +1 -0
- package/docs/design/templates/text-field/search.svg +1 -0
- package/docs/design/templates/text-field-dark.svg +1 -0
- package/docs/design/templates/text-field.svg +1 -0
- package/docs/design/templates/toolbar/title-and-actions-dark.svg +1 -1
- package/docs/design/templates/toolbar/title-and-actions.svg +1 -1
- package/docs/design/templates/toolbar/width-visibility-320-dark.svg +1 -0
- package/docs/design/templates/toolbar/width-visibility-320.svg +1 -0
- package/docs/design/templates/toolbar/width-visibility-600-dark.svg +1 -0
- package/docs/design/templates/toolbar/width-visibility-600.svg +1 -0
- package/docs/design/templates/toolbar-control-group/borderless-single-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/borderless-single.svg +1 -1
- package/docs/design/templates/toolbar-control-group/glass-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/glass.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-buttons-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-buttons.svg +1 -1
- package/docs/design/templates/toolbar-control-group/icon-tile-brand-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-brand.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-danger-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-danger.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-neutral-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-neutral.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-success-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-success.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-warning-dark.svg +1 -0
- package/docs/design/templates/toolbar-control-group/icon-tile-warning.svg +1 -0
- package/docs/design/templates/toolbar-control-group/push-buttons-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/push-buttons.svg +1 -1
- package/docs/design/templates/toolbar-control-group/with-text-dark.svg +1 -1
- package/docs/design/templates/toolbar-control-group/with-text.svg +1 -1
- package/docs/design/templates/toolbar-control-group-dark.svg +1 -11
- package/docs/design/templates/toolbar-control-group.svg +1 -11
- package/docs/design/templates/toolbar-dark.svg +1 -5
- package/docs/design/templates/toolbar-text/dark-tone-dark.svg +1 -0
- package/docs/design/templates/toolbar-text/dark-tone.svg +1 -0
- package/docs/design/templates/toolbar-text/default-dark.svg +1 -1
- package/docs/design/templates/toolbar-text/default.svg +1 -1
- package/docs/design/templates/toolbar-text/large-dark.svg +1 -1
- package/docs/design/templates/toolbar-text/large.svg +1 -1
- package/docs/design/templates/toolbar-text/small-dark.svg +1 -1
- package/docs/design/templates/toolbar-text/small.svg +1 -1
- package/docs/design/templates/toolbar-text-dark.svg +1 -9
- package/docs/design/templates/toolbar-text.svg +1 -9
- package/docs/design/templates/toolbar.svg +1 -5
- package/docs/design/templates/value-table/details-dark.svg +1 -1
- package/docs/design/templates/value-table/details.svg +1 -1
- package/docs/design/templates/value-table-dark.svg +1 -5
- package/docs/design/templates/value-table.svg +1 -5
- package/docs/design/templates.md +87 -33
- package/docs/design-philosophy.md +65 -20
- package/docs/device-class.md +10 -9
- package/docs/disclosure.md +97 -0
- package/docs/document-baseline.md +93 -0
- package/docs/examples/application-ui-profile.json +60 -0
- package/docs/examples/command-palette-adapter.tsx +69 -17
- package/docs/examples/component-catalog-extension.json +52 -0
- package/docs/examples/component-composition-extension.json +80 -0
- package/docs/layout.md +946 -53
- package/docs/list-detail-dialog.md +100 -0
- package/docs/manual-test-plan.md +29 -0
- package/docs/message-composer.md +156 -0
- package/docs/nav-stack.md +327 -14
- package/docs/overlay-toast.md +62 -0
- package/docs/overlay-tooltip.md +53 -0
- package/docs/progress.md +62 -0
- package/docs/recipes.md +147 -73
- package/docs/slider.md +64 -0
- package/docs/split-view.md +96 -7
- package/docs/sunken-panel.md +106 -0
- package/docs/surface-scaffold.md +487 -0
- package/docs/tab-navigator.md +291 -0
- package/docs/tag-field.md +66 -0
- package/docs/type-contracts.md +137 -0
- package/docs/ui-analyzer.md +406 -0
- package/docs/ui-doctor.md +298 -0
- package/docs/ui-evaluator.md +139 -0
- package/docs/ux-demo.md +58 -17
- package/docs/webawesome-migration.md +82 -0
- package/docs/webawesome-theme.md +306 -47
- package/docs/workbench-dialog.md +88 -0
- package/docs/workbench.md +637 -12
- package/docs/writing.md +154 -0
- package/doctor/cli.mjs +120 -0
- package/doctor/component-style-checks.mjs +457 -0
- package/doctor/config.schema.json +94 -0
- package/doctor/copy-capitalization-checks.mjs +603 -0
- package/doctor/eslint-diagnostics.d.mts +24 -0
- package/doctor/eslint-diagnostics.mjs +24 -0
- package/doctor/index.d.mts +122 -0
- package/doctor/index.mjs +1424 -0
- package/doctor/report.schema.json +118 -0
- package/evaluator/cli.mjs +89 -0
- package/evaluator/index.d.mts +90 -0
- package/evaluator/index.mjs +1203 -0
- package/evaluator/report.schema.json +152 -0
- package/llms.txt +940 -54
- package/package.json +488 -43
- package/scripts/component-catalog-extension-validation.mjs +28 -0
- package/traversal-exclusions.mjs +86 -0
- package/ux-demo/recipes/app-shell.tsx +204 -16
- package/ux-demo/recipes/collapsible-sidebar.tsx +206 -45
- package/ux-demo/recipes/compact-toolbar.tsx +135 -14
- package/ux-demo/recipes/composer-form.tsx +135 -24
- package/ux-demo/recipes/list-detail-dialog.tsx +155 -21
- package/ux-demo/recipes/list-workspace-states.tsx +183 -11
- package/ux-demo/recipes/loaders.ts +11 -3
- package/ux-demo/recipes/loading-inspector.tsx +162 -39
- package/ux-demo/recipes/media-detail.tsx +272 -0
- package/ux-demo/recipes/mount-recipe.ts +28 -11
- package/ux-demo/recipes/navigation-sidebar.tsx +137 -11
- package/ux-demo/recipes/navigation-stack.tsx +79 -24
- package/ux-demo/recipes/types.ts +18 -2
- package/ux-demo/recipes/workspace-header.tsx +86 -5
- package/vite-ux-review.d.mts +83 -0
- package/vite-ux-review.mjs +120 -0
- package/dist/app-tab.d.ts +0 -30
- package/dist/app-tab.js +0 -5
- package/dist/app-tab.js.map +0 -1
- package/dist/browser/app-tab.js +0 -4
- package/dist/browser/panel-header.js +0 -7
- package/dist/browser/token-search-field.js +0 -4
- package/dist/chunk-2Z5TWHKQ.js +0 -34
- package/dist/chunk-2Z5TWHKQ.js.map +0 -1
- package/dist/chunk-37T3VNIZ.js +0 -19
- package/dist/chunk-37T3VNIZ.js.map +0 -1
- package/dist/chunk-55DATV3A.js +0 -10
- package/dist/chunk-55DATV3A.js.map +0 -1
- package/dist/chunk-56RJXPHG.js.map +0 -1
- package/dist/chunk-5ATCDSQS.js +0 -42
- package/dist/chunk-5ATCDSQS.js.map +0 -1
- package/dist/chunk-5E2HVJ33.js +0 -10
- package/dist/chunk-5E2HVJ33.js.map +0 -1
- package/dist/chunk-7BR3DO2A.js +0 -31
- package/dist/chunk-7BR3DO2A.js.map +0 -1
- package/dist/chunk-7JB7VPRI.js +0 -34
- package/dist/chunk-7JB7VPRI.js.map +0 -1
- package/dist/chunk-7LDCTU7D.js +0 -134
- package/dist/chunk-7LDCTU7D.js.map +0 -1
- package/dist/chunk-AQNKJRFH.js +0 -79
- package/dist/chunk-AQNKJRFH.js.map +0 -1
- package/dist/chunk-AVZHJN6C.js +0 -14
- package/dist/chunk-AVZHJN6C.js.map +0 -1
- package/dist/chunk-B24C4A6T.js +0 -22
- package/dist/chunk-B24C4A6T.js.map +0 -1
- package/dist/chunk-BLK3UEEI.js +0 -23
- package/dist/chunk-BLK3UEEI.js.map +0 -1
- package/dist/chunk-CH4SQ6H5.js +0 -39
- package/dist/chunk-CH4SQ6H5.js.map +0 -1
- package/dist/chunk-DAFFDO33.js +0 -14
- package/dist/chunk-DAFFDO33.js.map +0 -1
- package/dist/chunk-I7INRJO4.js +0 -17
- package/dist/chunk-I7INRJO4.js.map +0 -1
- package/dist/chunk-L4OKFDJY.js +0 -24
- package/dist/chunk-L4OKFDJY.js.map +0 -1
- package/dist/chunk-LCOBDOCC.js +0 -265
- package/dist/chunk-LCOBDOCC.js.map +0 -1
- package/dist/chunk-M5JRI6MN.js +0 -27
- package/dist/chunk-M5JRI6MN.js.map +0 -1
- package/dist/chunk-RNPGFQ33.js +0 -10
- package/dist/chunk-RNPGFQ33.js.map +0 -1
- package/dist/chunk-RUNWEPR4.js +0 -10
- package/dist/chunk-RUNWEPR4.js.map +0 -1
- package/dist/chunk-W2FK7ZNY.js +0 -26
- package/dist/chunk-W2FK7ZNY.js.map +0 -1
- package/dist/chunk-WVPYVDXY.js +0 -15
- package/dist/chunk-WVPYVDXY.js.map +0 -1
- package/dist/chunk-XE5ZLPCC.js +0 -20
- package/dist/chunk-XE5ZLPCC.js.map +0 -1
- package/dist/chunk-XXMOARTH.js +0 -229
- package/dist/chunk-XXMOARTH.js.map +0 -1
- package/dist/chunk-YGN7OMLT.js.map +0 -1
- package/dist/panel-header.d.ts +0 -36
- package/dist/panel-header.js +0 -7
- package/dist/panel-header.js.map +0 -1
- package/dist/styles/app-tab.css +0 -152
- package/dist/styles/panel-header.css +0 -64
- package/dist/styles/tab-scaffold.css +0 -84
- package/dist/styles/token-search-field.css +0 -289
- package/dist/tab-scaffold.d.ts +0 -30
- package/dist/tab-scaffold.js +0 -16
- package/dist/tab-scaffold.js.map +0 -1
- package/dist/token-search-field.d.ts +0 -43
- package/dist/token-search-field.js +0 -4
- package/dist/token-search-field.js.map +0 -1
- package/dist/wire-tab-scaffold.d.ts +0 -11
- package/dist/wire-tab-scaffold.js +0 -16
- package/dist/wire-tab-scaffold.js.map +0 -1
- package/dist/wire-token-search-fields.js +0 -5
- package/docs/design/templates/panel-header/icon-actions-dark.svg +0 -1
- package/docs/design/templates/panel-header/icon-actions.svg +0 -1
- package/docs/design/templates/panel-header/icon-summary-actions-dark.svg +0 -1
- package/docs/design/templates/panel-header/icon-summary-actions.svg +0 -1
- package/docs/design/templates/panel-header/no-icon-dark.svg +0 -1
- package/docs/design/templates/panel-header/no-icon.svg +0 -1
- package/docs/design/templates/panel-header/page-heading-dark.svg +0 -1
- package/docs/design/templates/panel-header/page-heading.svg +0 -1
- package/docs/design/templates/panel-header/title-only-dark.svg +0 -1
- package/docs/design/templates/panel-header/title-only.svg +0 -1
- package/docs/design/templates/panel-header-dark.svg +0 -13
- package/docs/design/templates/panel-header.svg +0 -13
- package/docs/design/templates/token-search-field/empty-dark.svg +0 -1
- package/docs/design/templates/token-search-field/empty.svg +0 -1
- package/docs/design/templates/token-search-field/tokens-dark.svg +0 -1
- package/docs/design/templates/token-search-field/tokens.svg +0 -1
- package/docs/design/templates/token-search-field-dark.svg +0 -7
- package/docs/design/templates/token-search-field.svg +0 -7
- package/docs/tab-scaffold.md +0 -41
- package/ux-demo/recipes/recipes.css +0 -448
|
@@ -0,0 +1,2375 @@
|
|
|
1
|
+
import { readFile, readdir, stat } from 'node:fs/promises';
|
|
2
|
+
import {
|
|
3
|
+
basename,
|
|
4
|
+
dirname,
|
|
5
|
+
extname,
|
|
6
|
+
isAbsolute,
|
|
7
|
+
relative,
|
|
8
|
+
resolve,
|
|
9
|
+
} from 'node:path';
|
|
10
|
+
import process from 'node:process';
|
|
11
|
+
|
|
12
|
+
import postcss from 'postcss';
|
|
13
|
+
import ts from 'typescript';
|
|
14
|
+
|
|
15
|
+
import { loadApplicationUiProfile } from '../ai/application-ui-profile.mjs';
|
|
16
|
+
import { createUiTraversalFilter } from '../traversal-exclusions.mjs';
|
|
17
|
+
import {
|
|
18
|
+
classOwnerFor,
|
|
19
|
+
componentLabel,
|
|
20
|
+
componentName,
|
|
21
|
+
componentOwnershipFacts,
|
|
22
|
+
contextualComponents,
|
|
23
|
+
configurationFor,
|
|
24
|
+
ownsClassBlock,
|
|
25
|
+
privateVariableOwner,
|
|
26
|
+
reportGap,
|
|
27
|
+
restyledComponents,
|
|
28
|
+
typedPropForToken,
|
|
29
|
+
} from './component-ownership.mjs';
|
|
30
|
+
import { collectLoudDeclarations, inspectLoudPairs } from './loud-pairs.mjs';
|
|
31
|
+
import {
|
|
32
|
+
classNames,
|
|
33
|
+
complexSelectorParts,
|
|
34
|
+
withoutRelationalArguments,
|
|
35
|
+
} from './selectors.mjs';
|
|
36
|
+
|
|
37
|
+
export const UI_ANALYSIS_SCHEMA_VERSION = 1;
|
|
38
|
+
|
|
39
|
+
export const UI_ANALYSIS_RULES = Object.freeze({
|
|
40
|
+
'KUI-L001': { severity: 'error', title: 'Private or unknown Kerf selector' },
|
|
41
|
+
'KUI-L002': { severity: 'error', title: 'Unknown Kerf token' },
|
|
42
|
+
'KUI-L003': { severity: 'error', title: 'Competing geometry owners' },
|
|
43
|
+
'KUI-L004': { severity: 'review', title: 'Repeated content inset' },
|
|
44
|
+
// KUI-L005 ('Forced component dimension') is retired: KUI-L019 reports any
|
|
45
|
+
// restyle of a cataloged component, dimensions included, and L005's only
|
|
46
|
+
// other shape (a public class as an ancestor) sizes an application element.
|
|
47
|
+
// The id stays in the diagnostic registry so existing exceptions still load.
|
|
48
|
+
'KUI-L006': {
|
|
49
|
+
severity: 'review',
|
|
50
|
+
title: 'Hard-coded spacing outside the approved scale',
|
|
51
|
+
},
|
|
52
|
+
'KUI-L007': { severity: 'error', title: 'Nested scroll owners' },
|
|
53
|
+
'KUI-L008': { severity: 'review', title: 'Dynamic class requires review' },
|
|
54
|
+
'KUI-L009': { severity: 'error', title: 'Stylesheet could not be parsed' },
|
|
55
|
+
'KUI-L010': {
|
|
56
|
+
severity: 'error',
|
|
57
|
+
title: 'Private Kerf descendant override',
|
|
58
|
+
},
|
|
59
|
+
'KUI-L011': { severity: 'error', title: 'Uncataloged shadow part override' },
|
|
60
|
+
'KUI-L012': { severity: 'error', title: 'Private Kerf token assignment' },
|
|
61
|
+
'KUI-L013': { severity: 'error', title: 'Uncataloged CSS value literal' },
|
|
62
|
+
'KUI-L014': { severity: 'error', title: 'Wrong CSS value helper dimension' },
|
|
63
|
+
'KUI-L015': { severity: 'error', title: 'Non-standalone CSS expression' },
|
|
64
|
+
'KUI-L016': { severity: 'error', title: 'Forbidden declaration-list escape' },
|
|
65
|
+
'KUI-L017': { severity: 'review', title: 'Exceptional spacing shorthand' },
|
|
66
|
+
'KUI-L018': {
|
|
67
|
+
severity: 'review',
|
|
68
|
+
title: 'Loud fill override without its on-loud pair',
|
|
69
|
+
},
|
|
70
|
+
'KUI-L019': {
|
|
71
|
+
severity: 'error',
|
|
72
|
+
title: 'Application CSS restyles a cataloged component',
|
|
73
|
+
},
|
|
74
|
+
'KUI-L020': {
|
|
75
|
+
severity: 'error',
|
|
76
|
+
title: "Another component's private variable",
|
|
77
|
+
},
|
|
78
|
+
'KUI-L021': {
|
|
79
|
+
severity: 'error',
|
|
80
|
+
title: 'Component token overridden where a typed prop exists',
|
|
81
|
+
},
|
|
82
|
+
'KUI-L022': {
|
|
83
|
+
severity: 'error',
|
|
84
|
+
title: "Hook class restyles a cataloged component's root",
|
|
85
|
+
},
|
|
86
|
+
'KUI-L023': {
|
|
87
|
+
severity: 'error',
|
|
88
|
+
title: "Another component's public class is rendered as markup",
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const ownershipAction =
|
|
93
|
+
"Configure the component through its typed props, variants, or public tokens; style only your own elements (in the component's context when needed). If no configuration covers the need, report the component gap to its package instead of overriding it.";
|
|
94
|
+
|
|
95
|
+
/** The doctor's per-rule repair action, where it is more specific than the default. */
|
|
96
|
+
export const UI_ANALYSIS_ACTIONS = Object.freeze({
|
|
97
|
+
'KUI-L019': ownershipAction,
|
|
98
|
+
'KUI-L020': ownershipAction,
|
|
99
|
+
'KUI-L021':
|
|
100
|
+
'Set the typed prop the diagnostic names on the component instead of overriding its token.',
|
|
101
|
+
'KUI-L022': ownershipAction,
|
|
102
|
+
'KUI-L023': ownershipAction,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const adoptionRules = new Set([
|
|
106
|
+
'KUI-L001',
|
|
107
|
+
'KUI-L002',
|
|
108
|
+
'KUI-L010',
|
|
109
|
+
'KUI-L011',
|
|
110
|
+
'KUI-L012',
|
|
111
|
+
'KUI-L019',
|
|
112
|
+
'KUI-L020',
|
|
113
|
+
'KUI-L021',
|
|
114
|
+
'KUI-L022',
|
|
115
|
+
'KUI-L023',
|
|
116
|
+
]);
|
|
117
|
+
|
|
118
|
+
const sourceExtensions = new Set(['.js', '.jsx', '.mjs', '.ts', '.tsx']);
|
|
119
|
+
function isTestModule(file) {
|
|
120
|
+
const path = file.replaceAll('\\', '/');
|
|
121
|
+
return (
|
|
122
|
+
/(?:^|\/)__tests__\//.test(path) ||
|
|
123
|
+
/\.(?:test|spec)\.(?:js|jsx|mjs|ts|tsx)$/.test(path)
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
const spacingProperties = /^(?:margin|padding|gap|inset)(?:-|$)/;
|
|
127
|
+
const approvedSpacing = new Set([0, 4, 8, 16, 24]);
|
|
128
|
+
async function collectFiles(root, paths) {
|
|
129
|
+
const files = [];
|
|
130
|
+
const excluded = await createUiTraversalFilter(root);
|
|
131
|
+
const visit = async (path) => {
|
|
132
|
+
if (excluded(path)) return;
|
|
133
|
+
const details = await stat(path);
|
|
134
|
+
if (details.isFile()) {
|
|
135
|
+
if (sourceExtensions.has(extname(path)) || path.endsWith('.css'))
|
|
136
|
+
files.push(path);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const entries = await readdir(path, { withFileTypes: true });
|
|
140
|
+
for (const entry of entries) {
|
|
141
|
+
const child = resolve(path, entry.name);
|
|
142
|
+
if (entry.isDirectory()) await visit(child);
|
|
143
|
+
else if (excluded(child)) continue;
|
|
144
|
+
else if (
|
|
145
|
+
sourceExtensions.has(extname(entry.name)) ||
|
|
146
|
+
entry.name.endsWith('.css')
|
|
147
|
+
)
|
|
148
|
+
files.push(child);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
for (const path of paths?.length ? paths : [root])
|
|
152
|
+
await visit(resolve(root, path));
|
|
153
|
+
return files.sort();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function location(file, node, source) {
|
|
157
|
+
if (!source) {
|
|
158
|
+
const point = node.source?.start;
|
|
159
|
+
return {
|
|
160
|
+
file,
|
|
161
|
+
line: point?.line ?? 1,
|
|
162
|
+
column: point?.column ?? point?.offset ?? 1,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const point = source.getLineAndCharacterOfPosition(node.getStart(source));
|
|
166
|
+
return {
|
|
167
|
+
file,
|
|
168
|
+
line: point.line + 1,
|
|
169
|
+
column: point.character + 1,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function diagnostic(ruleId, at, message, evidence, chain, adoption = false) {
|
|
174
|
+
const rule = UI_ANALYSIS_RULES[ruleId];
|
|
175
|
+
return {
|
|
176
|
+
ruleId,
|
|
177
|
+
severity: adoption && adoptionRules.has(ruleId) ? 'review' : rule.severity,
|
|
178
|
+
message,
|
|
179
|
+
location: at,
|
|
180
|
+
evidence,
|
|
181
|
+
chain,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function isSuppressed(item, profile, root) {
|
|
186
|
+
const target = relative(root, item.location.file).replaceAll('\\', '/');
|
|
187
|
+
return (profile?.exceptions ?? []).some(
|
|
188
|
+
(exception) =>
|
|
189
|
+
exception.rules?.includes(item.ruleId) && exception.target === target,
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function relativeStyleImports(file, source) {
|
|
194
|
+
const imports = [];
|
|
195
|
+
if (file.endsWith('.css')) {
|
|
196
|
+
let stylesheet;
|
|
197
|
+
try {
|
|
198
|
+
stylesheet = postcss.parse(source, { from: file });
|
|
199
|
+
} catch {
|
|
200
|
+
return imports;
|
|
201
|
+
}
|
|
202
|
+
stylesheet.walkAtRules('import', (rule) => {
|
|
203
|
+
const match = rule.params.match(
|
|
204
|
+
/^\s*(?:["']([^"']+)["']|url\(\s*(?:["']([^"']+)["']|([^\s)]+))\s*\))/,
|
|
205
|
+
);
|
|
206
|
+
const specifier = match?.[1] ?? match?.[2] ?? match?.[3];
|
|
207
|
+
if (specifier?.startsWith('.'))
|
|
208
|
+
imports.push(resolve(dirname(file), specifier));
|
|
209
|
+
});
|
|
210
|
+
return imports;
|
|
211
|
+
}
|
|
212
|
+
const syntax = file.endsWith('.tsx')
|
|
213
|
+
? ts.ScriptKind.TSX
|
|
214
|
+
: file.endsWith('.jsx')
|
|
215
|
+
? ts.ScriptKind.JSX
|
|
216
|
+
: file.endsWith('.ts')
|
|
217
|
+
? ts.ScriptKind.TS
|
|
218
|
+
: ts.ScriptKind.JS;
|
|
219
|
+
const module = ts.createSourceFile(
|
|
220
|
+
file,
|
|
221
|
+
source,
|
|
222
|
+
ts.ScriptTarget.Latest,
|
|
223
|
+
true,
|
|
224
|
+
syntax,
|
|
225
|
+
);
|
|
226
|
+
for (const statement of module.statements) {
|
|
227
|
+
if (
|
|
228
|
+
!ts.isImportDeclaration(statement) ||
|
|
229
|
+
!ts.isStringLiteral(statement.moduleSpecifier)
|
|
230
|
+
)
|
|
231
|
+
continue;
|
|
232
|
+
const specifier = statement.moduleSpecifier.text;
|
|
233
|
+
if (specifier.startsWith('.') && specifier.endsWith('.css'))
|
|
234
|
+
imports.push(resolve(dirname(file), specifier));
|
|
235
|
+
}
|
|
236
|
+
return imports;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function reachableStyleFacts(file, imports, styleFacts) {
|
|
240
|
+
const result = new Map();
|
|
241
|
+
for (const style of reachableStyleFiles(file, imports, styleFacts)) {
|
|
242
|
+
for (const [className, facts] of styleFacts.get(style)) {
|
|
243
|
+
const current = result.get(className) ?? { scroll: false, inset: false };
|
|
244
|
+
current.scroll ||= facts.scroll;
|
|
245
|
+
current.inset ||= facts.inset;
|
|
246
|
+
current.styled ??= facts.styled;
|
|
247
|
+
result.set(className, current);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function reachableStyleFiles(file, imports, styleFacts) {
|
|
254
|
+
const visited = new Set();
|
|
255
|
+
const visit = (style) => {
|
|
256
|
+
if (visited.has(style) || !styleFacts.has(style)) return;
|
|
257
|
+
visited.add(style);
|
|
258
|
+
for (const dependency of imports.get(style) ?? []) visit(dependency);
|
|
259
|
+
};
|
|
260
|
+
for (const style of imports.get(file) ?? []) visit(style);
|
|
261
|
+
return visited;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async function loadCatalogs(profileResult, ownership) {
|
|
265
|
+
const entries = [];
|
|
266
|
+
for (const catalog of profileResult.profile?.catalogs ?? []) {
|
|
267
|
+
const owner = profileResult.provenance[`$catalogs.${catalog.package}`];
|
|
268
|
+
if (!owner) continue;
|
|
269
|
+
try {
|
|
270
|
+
const artifact = JSON.parse(
|
|
271
|
+
await readFile(
|
|
272
|
+
resolve(dirname(owner), catalog.composition.path),
|
|
273
|
+
'utf8',
|
|
274
|
+
),
|
|
275
|
+
);
|
|
276
|
+
const selection = await loadSelectionFacts(owner, catalog);
|
|
277
|
+
const joined = new Set();
|
|
278
|
+
for (const entry of artifact.entries ?? []) {
|
|
279
|
+
const selected = selection.get(entry.key);
|
|
280
|
+
joined.add(entry.key);
|
|
281
|
+
const componentSource =
|
|
282
|
+
selected?.componentSource ??
|
|
283
|
+
(/\.[cm]?[jt]sx?$/.test(entry.source) ? entry.source : undefined);
|
|
284
|
+
entries.push(
|
|
285
|
+
selected
|
|
286
|
+
? {
|
|
287
|
+
...entry,
|
|
288
|
+
publicExports: entry.publicExports ?? selected.publicExports,
|
|
289
|
+
moduleImports: selected.moduleImports,
|
|
290
|
+
componentSource,
|
|
291
|
+
styleSources: entry.styleSources ?? selected.styleSources,
|
|
292
|
+
catalogDirectory: dirname(owner),
|
|
293
|
+
}
|
|
294
|
+
: { ...entry, componentSource, catalogDirectory: dirname(owner) },
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
for (const [key, selected] of selection) {
|
|
298
|
+
if (
|
|
299
|
+
ownership !== 'component' ||
|
|
300
|
+
joined.has(key) ||
|
|
301
|
+
!selected.componentSource
|
|
302
|
+
)
|
|
303
|
+
continue;
|
|
304
|
+
entries.push({
|
|
305
|
+
key,
|
|
306
|
+
package: catalog.package,
|
|
307
|
+
id: selected.id,
|
|
308
|
+
name: selected.name,
|
|
309
|
+
kind: selected.kind,
|
|
310
|
+
componentSource: selected.componentSource,
|
|
311
|
+
styleSources: selected.styleSources,
|
|
312
|
+
moduleImports: selected.moduleImports,
|
|
313
|
+
publicExports: selected.publicExports,
|
|
314
|
+
boundaries: {
|
|
315
|
+
publicClasses: selected.publicClasses ?? [],
|
|
316
|
+
rootElement: selected.rootElement,
|
|
317
|
+
},
|
|
318
|
+
catalogDirectory: dirname(owner),
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
} catch {
|
|
322
|
+
// Profile validation reports the precise catalog load failure.
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return entries;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// The composition (v2) catalog carries no import facts, and several of its
|
|
329
|
+
// entries share a display name (the Kerf `Select` and the Web Awesome
|
|
330
|
+
// `wa-select` are both "Select"). The selection (v1) catalog is where each
|
|
331
|
+
// entry's real public exports and import subpaths live, so join it by key.
|
|
332
|
+
async function loadSelectionFacts(owner, catalog) {
|
|
333
|
+
const facts = new Map();
|
|
334
|
+
if (!catalog.selection?.path) return facts;
|
|
335
|
+
let artifact;
|
|
336
|
+
try {
|
|
337
|
+
artifact = JSON.parse(
|
|
338
|
+
await readFile(resolve(dirname(owner), catalog.selection.path), 'utf8'),
|
|
339
|
+
);
|
|
340
|
+
} catch {
|
|
341
|
+
return facts;
|
|
342
|
+
}
|
|
343
|
+
const packageName = artifact.package ?? catalog.package;
|
|
344
|
+
for (const entry of artifact.entries ?? []) {
|
|
345
|
+
const delivery = entry.delivery ?? {};
|
|
346
|
+
facts.set(`${packageName}:${entry.id}`, {
|
|
347
|
+
id: entry.id,
|
|
348
|
+
name: entry.name,
|
|
349
|
+
kind: entry.kind,
|
|
350
|
+
publicExports: entry.publicExports,
|
|
351
|
+
publicClasses: entry.publicClasses,
|
|
352
|
+
rootElement: entry.rootElement,
|
|
353
|
+
componentSource: entry.source,
|
|
354
|
+
styleSources: entry.styleSources,
|
|
355
|
+
moduleImports: [delivery.browserImport, delivery.moduleImport].filter(
|
|
356
|
+
Boolean,
|
|
357
|
+
),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
return facts;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// A catalog entry's public exports mix the component render function with
|
|
364
|
+
// helpers its props consume (`Select` ships `uiColor`, `List` ships
|
|
365
|
+
// `px`/`rem`/`flex`). Only the render function stands for the entry, so only
|
|
366
|
+
// it may carry the entry's contracts. A component export is one whose name
|
|
367
|
+
// starts with an uppercase letter: JSX itself treats a lowercase tag as an
|
|
368
|
+
// intrinsic element, so a lowercase export can never be a component tag, and
|
|
369
|
+
// scripts/check-component-catalog.mjs enforces the converse for this package
|
|
370
|
+
// (every uppercase runtime export returns SafeHtml; no lowercase one does).
|
|
371
|
+
// eslint-plugin-kerfjs applies the same rule.
|
|
372
|
+
function isComponentExport(name) {
|
|
373
|
+
return /^[A-Z]/.test(name);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Pick the catalog entry an imported (or namespace-accessed) export name
|
|
377
|
+
// refers to. Names are not unique across a catalog, so candidates are ranked:
|
|
378
|
+
// an entry whose own import subpath is the module wins, then an entry that
|
|
379
|
+
// declares the name as a public export, then catalog order. A helper export
|
|
380
|
+
// never resolves to an entry.
|
|
381
|
+
function resolveExportEntry(
|
|
382
|
+
candidates,
|
|
383
|
+
name,
|
|
384
|
+
module,
|
|
385
|
+
file,
|
|
386
|
+
packageDirectory,
|
|
387
|
+
aliasSource,
|
|
388
|
+
) {
|
|
389
|
+
if (!isComponentExport(name)) return undefined;
|
|
390
|
+
const localSource =
|
|
391
|
+
packageDirectory && (module?.startsWith('.') || aliasSource)
|
|
392
|
+
? relative(
|
|
393
|
+
packageDirectory,
|
|
394
|
+
aliasSource ?? resolve(dirname(file), module),
|
|
395
|
+
)
|
|
396
|
+
.replaceAll('\\', '/')
|
|
397
|
+
.replace(/\.[cm]?[jt]sx?$/, '')
|
|
398
|
+
: undefined;
|
|
399
|
+
const eligible = (candidates ?? []).filter(
|
|
400
|
+
(entry) =>
|
|
401
|
+
module === entry.package ||
|
|
402
|
+
module?.startsWith(`${entry.package}/`) ||
|
|
403
|
+
(localSource &&
|
|
404
|
+
entry.componentSource?.replace(/\.[cm]?[jt]sx?$/, '') === localSource),
|
|
405
|
+
);
|
|
406
|
+
const exported = (entry) =>
|
|
407
|
+
(entry.publicExports ?? []).some(
|
|
408
|
+
(item) => (typeof item === 'string' ? item : item.name) === name,
|
|
409
|
+
);
|
|
410
|
+
return (
|
|
411
|
+
eligible.find((entry) => entry.moduleImports?.includes(module)) ??
|
|
412
|
+
eligible.find(exported) ??
|
|
413
|
+
eligible[0]
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// Use the nearest project tsconfig without walking into a parent repository.
|
|
418
|
+
// TypeScript expands `extends` and resolves exact and wildcard `paths` here.
|
|
419
|
+
function compilerOptionsFor(file, root, cache) {
|
|
420
|
+
let directory = dirname(file);
|
|
421
|
+
const visited = [];
|
|
422
|
+
while (directory === root || !relative(root, directory).startsWith('..')) {
|
|
423
|
+
if (cache.has(directory)) break;
|
|
424
|
+
visited.push(directory);
|
|
425
|
+
const configPath = resolve(directory, 'tsconfig.json');
|
|
426
|
+
if (ts.sys.fileExists(configPath)) {
|
|
427
|
+
const config = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
428
|
+
cache.set(
|
|
429
|
+
directory,
|
|
430
|
+
config.error
|
|
431
|
+
? undefined
|
|
432
|
+
: ts.parseJsonConfigFileContent(
|
|
433
|
+
config.config,
|
|
434
|
+
ts.sys,
|
|
435
|
+
directory,
|
|
436
|
+
undefined,
|
|
437
|
+
configPath,
|
|
438
|
+
).options,
|
|
439
|
+
);
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
if (directory === root) break;
|
|
443
|
+
directory = dirname(directory);
|
|
444
|
+
}
|
|
445
|
+
const options = cache.get(directory);
|
|
446
|
+
for (const path of visited) cache.set(path, options);
|
|
447
|
+
return options;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function catalogFacts(entries) {
|
|
451
|
+
const publicClasses = new Set();
|
|
452
|
+
const publicTokens = new Set();
|
|
453
|
+
const publicParts = new Map();
|
|
454
|
+
const classEntries = new Map();
|
|
455
|
+
const blockEntries = new Map();
|
|
456
|
+
const exportEntries = new Map();
|
|
457
|
+
const addExport = (name, entry) => {
|
|
458
|
+
const candidates = exportEntries.get(name) ?? [];
|
|
459
|
+
if (!candidates.includes(entry)) candidates.push(entry);
|
|
460
|
+
exportEntries.set(name, candidates);
|
|
461
|
+
};
|
|
462
|
+
for (const entry of entries) {
|
|
463
|
+
addExport(entry.name, entry);
|
|
464
|
+
for (const item of entry.publicExports ?? []) {
|
|
465
|
+
const name = typeof item === 'string' ? item : item.name;
|
|
466
|
+
if (isComponentExport(name)) addExport(name, entry);
|
|
467
|
+
}
|
|
468
|
+
for (const className of new Set(
|
|
469
|
+
[
|
|
470
|
+
entry.boundaries?.rootClass,
|
|
471
|
+
...(entry.boundaries?.publicClasses ?? []),
|
|
472
|
+
].filter(Boolean),
|
|
473
|
+
)) {
|
|
474
|
+
publicClasses.add(className);
|
|
475
|
+
const owners = classEntries.get(className) ?? [];
|
|
476
|
+
owners.push(entry);
|
|
477
|
+
classEntries.set(className, owners);
|
|
478
|
+
const block = bemBlock(className);
|
|
479
|
+
const blockOwners = blockEntries.get(block) ?? [];
|
|
480
|
+
if (!blockOwners.includes(entry)) blockOwners.push(entry);
|
|
481
|
+
blockEntries.set(block, blockOwners);
|
|
482
|
+
}
|
|
483
|
+
for (const token of entry.boundaries?.publicTokens ?? [])
|
|
484
|
+
publicTokens.add(token);
|
|
485
|
+
for (const part of entry.boundaries?.publicParts ?? []) {
|
|
486
|
+
const roots = publicParts.get(part) ?? new Set();
|
|
487
|
+
if (entry.boundaries?.rootClass) roots.add(entry.boundaries.rootClass);
|
|
488
|
+
publicParts.set(part, roots);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
entries,
|
|
493
|
+
publicClasses,
|
|
494
|
+
publicTokens,
|
|
495
|
+
publicParts,
|
|
496
|
+
classEntries,
|
|
497
|
+
blockEntries,
|
|
498
|
+
exportEntries,
|
|
499
|
+
ownership: componentOwnershipFacts(entries),
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
const bemBlock = (name) => name.split(/__|--/, 1)[0];
|
|
504
|
+
|
|
505
|
+
function renderedLiteralClasses(file, source) {
|
|
506
|
+
const names = new Set();
|
|
507
|
+
const parsed = ts.createSourceFile(
|
|
508
|
+
file,
|
|
509
|
+
source,
|
|
510
|
+
ts.ScriptTarget.Latest,
|
|
511
|
+
true,
|
|
512
|
+
file.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.JSX,
|
|
513
|
+
);
|
|
514
|
+
const visit = (node) => {
|
|
515
|
+
if (
|
|
516
|
+
ts.isJsxAttribute(node) &&
|
|
517
|
+
['class', 'className'].includes(node.name.text)
|
|
518
|
+
) {
|
|
519
|
+
const value =
|
|
520
|
+
node.initializer && ts.isStringLiteral(node.initializer)
|
|
521
|
+
? node.initializer.text
|
|
522
|
+
: node.initializer &&
|
|
523
|
+
ts.isJsxExpression(node.initializer) &&
|
|
524
|
+
node.initializer.expression &&
|
|
525
|
+
ts.isStringLiteral(node.initializer.expression)
|
|
526
|
+
? node.initializer.expression.text
|
|
527
|
+
: undefined;
|
|
528
|
+
for (const name of value?.split(/\s+/) ?? []) if (name) names.add(name);
|
|
529
|
+
}
|
|
530
|
+
ts.forEachChild(node, visit);
|
|
531
|
+
};
|
|
532
|
+
visit(parsed);
|
|
533
|
+
return names;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function inferOwnedClasses(entries, contents, imports) {
|
|
537
|
+
return entries.map((entry) => {
|
|
538
|
+
if (!entry.componentSource || !entry.catalogDirectory) return entry;
|
|
539
|
+
const sourceFile = resolve(entry.catalogDirectory, entry.componentSource);
|
|
540
|
+
const source = contents.get(sourceFile);
|
|
541
|
+
if (!source) return entry;
|
|
542
|
+
const styleFiles = entry.styleSources?.length
|
|
543
|
+
? entry.styleSources.map((path) => resolve(entry.catalogDirectory, path))
|
|
544
|
+
: [...(imports.get(sourceFile) ?? [])];
|
|
545
|
+
const styleSources = styleFiles.map((file) =>
|
|
546
|
+
relative(entry.catalogDirectory, file).replaceAll('\\', '/'),
|
|
547
|
+
);
|
|
548
|
+
const styledBlocks = new Set();
|
|
549
|
+
for (const style of styleFiles) {
|
|
550
|
+
const css = contents.get(style);
|
|
551
|
+
if (!css) continue;
|
|
552
|
+
try {
|
|
553
|
+
postcss.parse(css, { from: style }).walkRules((rule) => {
|
|
554
|
+
for (const name of subjectClasses(rule.selector))
|
|
555
|
+
styledBlocks.add(bemBlock(name));
|
|
556
|
+
});
|
|
557
|
+
} catch {
|
|
558
|
+
// The stylesheet parser reports malformed CSS in the normal pass.
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
const inferred = [...renderedLiteralClasses(sourceFile, source)].filter(
|
|
562
|
+
(name) => styledBlocks.has(bemBlock(name)),
|
|
563
|
+
);
|
|
564
|
+
if (!inferred.length) return { ...entry, styleSources };
|
|
565
|
+
return {
|
|
566
|
+
...entry,
|
|
567
|
+
styleSources,
|
|
568
|
+
boundaries: {
|
|
569
|
+
...entry.boundaries,
|
|
570
|
+
publicClasses: [
|
|
571
|
+
...new Set([...(entry.boundaries?.publicClasses ?? []), ...inferred]),
|
|
572
|
+
],
|
|
573
|
+
},
|
|
574
|
+
};
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async function ownershipGroupEntries(groups, root, contents) {
|
|
579
|
+
if (!groups?.length) return [];
|
|
580
|
+
const manifest = JSON.parse(
|
|
581
|
+
await readFile(resolve(root, 'package.json'), 'utf8'),
|
|
582
|
+
);
|
|
583
|
+
return Promise.all(
|
|
584
|
+
groups.map(async (group, index) => {
|
|
585
|
+
const classes = new Set();
|
|
586
|
+
for (const style of group.styleSources) {
|
|
587
|
+
const file = resolve(root, style);
|
|
588
|
+
let css = contents.get(file);
|
|
589
|
+
if (css === undefined)
|
|
590
|
+
try {
|
|
591
|
+
css = await readFile(file, 'utf8');
|
|
592
|
+
} catch {
|
|
593
|
+
// A missing configured file owns no classes.
|
|
594
|
+
}
|
|
595
|
+
if (!css) continue;
|
|
596
|
+
try {
|
|
597
|
+
postcss.parse(css, { from: file }).walkRules((rule) => {
|
|
598
|
+
for (const name of subjectClasses(rule.selector)) classes.add(name);
|
|
599
|
+
});
|
|
600
|
+
} catch {
|
|
601
|
+
// The normal stylesheet pass reports malformed CSS.
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return {
|
|
605
|
+
key: `${manifest.name}:ownership-group-${index + 1}`,
|
|
606
|
+
package: manifest.name,
|
|
607
|
+
id: `ownership-group-${index + 1}`,
|
|
608
|
+
name: `Ownership group ${index + 1}`,
|
|
609
|
+
catalogDirectory: root,
|
|
610
|
+
styleSources: group.styleSources,
|
|
611
|
+
ownershipGroupSources: group.sources,
|
|
612
|
+
boundaries: { publicClasses: [...classes] },
|
|
613
|
+
};
|
|
614
|
+
}),
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
async function implicitOwnershipEntries(files, imports, root) {
|
|
619
|
+
const found = [];
|
|
620
|
+
const packages = new Map();
|
|
621
|
+
const packageAt = async (directory) => {
|
|
622
|
+
if (packages.has(directory)) return packages.get(directory);
|
|
623
|
+
let result;
|
|
624
|
+
try {
|
|
625
|
+
const manifest = JSON.parse(
|
|
626
|
+
await readFile(resolve(directory, 'package.json'), 'utf8'),
|
|
627
|
+
);
|
|
628
|
+
if (typeof manifest.name === 'string')
|
|
629
|
+
result = { name: manifest.name, directory };
|
|
630
|
+
} catch {
|
|
631
|
+
// Search the containing directory for a package manifest.
|
|
632
|
+
}
|
|
633
|
+
if (!result && directory !== root) {
|
|
634
|
+
const parent = dirname(directory);
|
|
635
|
+
if (!relative(root, parent).startsWith('..'))
|
|
636
|
+
result = await packageAt(parent);
|
|
637
|
+
}
|
|
638
|
+
packages.set(directory, result);
|
|
639
|
+
return result;
|
|
640
|
+
};
|
|
641
|
+
for (const file of files) {
|
|
642
|
+
if (!sourceExtensions.has(extname(file))) continue;
|
|
643
|
+
const styles = (imports.get(file) ?? []).filter((path) =>
|
|
644
|
+
files.includes(path),
|
|
645
|
+
);
|
|
646
|
+
if (!styles.length) continue;
|
|
647
|
+
const owner = await packageAt(dirname(file));
|
|
648
|
+
if (!owner) continue;
|
|
649
|
+
const source = relative(owner.directory, file).replaceAll('\\', '/');
|
|
650
|
+
const id = `module:${source}`;
|
|
651
|
+
found.push({
|
|
652
|
+
key: `${owner.name}:${id}`,
|
|
653
|
+
package: owner.name,
|
|
654
|
+
id,
|
|
655
|
+
name: basename(file).replace(/\.[^.]+$/, ''),
|
|
656
|
+
componentSource: source,
|
|
657
|
+
catalogDirectory: owner.directory,
|
|
658
|
+
styleSources: styles.map((style) =>
|
|
659
|
+
relative(owner.directory, style).replaceAll('\\', '/'),
|
|
660
|
+
),
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
return found;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function spacingValues(value) {
|
|
667
|
+
const results = [];
|
|
668
|
+
for (const match of value.matchAll(/(-?\d*\.?\d+)(px|rem)\b/g)) {
|
|
669
|
+
const numeric = Number(match[1]) * (match[2] === 'rem' ? 16 : 1);
|
|
670
|
+
results.push({ text: match[0], pixels: numeric });
|
|
671
|
+
}
|
|
672
|
+
return results;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function escapeRegExp(value) {
|
|
676
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// A declaration that restyles, as opposed to one that only sets a custom
|
|
680
|
+
// property: setting a component's public token on its host is configuration,
|
|
681
|
+
// which the token rules (KUI-L002, KUI-L012, KUI-L020, KUI-L021) judge.
|
|
682
|
+
function restylingDeclarations(rule) {
|
|
683
|
+
return (rule.nodes ?? []).filter(
|
|
684
|
+
(node) => node.type === 'decl' && !node.prop.startsWith('--'),
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
function inKeyframes(rule) {
|
|
689
|
+
return rule.parent?.type === 'atrule' && /keyframes$/i.test(rule.parent.name);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// The classes a rule makes its subject (the rightmost compound of each complex
|
|
693
|
+
// selector, outside :has()/:not()).
|
|
694
|
+
function subjectClasses(selector) {
|
|
695
|
+
return complexSelectorParts(selector).flatMap((parts) => {
|
|
696
|
+
const subject = parts.at(-1)?.compound;
|
|
697
|
+
return subject ? classNames(withoutRelationalArguments(subject)) : [];
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function inspectComponentOwnership(
|
|
702
|
+
file,
|
|
703
|
+
rule,
|
|
704
|
+
facts,
|
|
705
|
+
diagnostics,
|
|
706
|
+
adoption,
|
|
707
|
+
isForeign,
|
|
708
|
+
ownershipEvidence,
|
|
709
|
+
ownershipContext,
|
|
710
|
+
) {
|
|
711
|
+
if (inKeyframes(rule)) return;
|
|
712
|
+
const restyling = restylingDeclarations(rule);
|
|
713
|
+
if (restyling.length === 0) return;
|
|
714
|
+
const properties = [...new Set(restyling.map((decl) => decl.prop))];
|
|
715
|
+
const restyled = restyledComponents(
|
|
716
|
+
rule.selector,
|
|
717
|
+
facts.ownership,
|
|
718
|
+
isForeign,
|
|
719
|
+
ownershipEvidence,
|
|
720
|
+
);
|
|
721
|
+
for (const { entry, coOwners, via, name } of restyled)
|
|
722
|
+
diagnostics.push(
|
|
723
|
+
diagnostic(
|
|
724
|
+
'KUI-L019',
|
|
725
|
+
location(file, rule),
|
|
726
|
+
coOwners
|
|
727
|
+
? `\`${name}\` makes a class co-owned by ${coOwners.map((owner) => componentLabel(owner)).join(', ')} the subject of an application rule (${properties.join(', ')}); those components own their styles. Configure an owning component or style your own element instead.`
|
|
728
|
+
: via === 'descendant'
|
|
729
|
+
? `\`${name}\` reaches an unclassed descendant inside ${componentLabel(entry)} (${properties.join(', ')}); components own their styles. Use a child combinator or an own class to target your element, or configure the child through ${configurationFor(entry)}. ${reportGap(entry)}`
|
|
730
|
+
: `\`${name}\` makes ${componentLabel(entry)} the subject of an application rule (${properties.join(', ')}); components own their styles. Configure it through ${configurationFor(entry)}. To place your own content in its context, style your own element (\`${name} > .your-element\`). ${reportGap(entry)}`,
|
|
731
|
+
{
|
|
732
|
+
selector: rule.selector,
|
|
733
|
+
...(coOwners
|
|
734
|
+
? { components: coOwners.map((owner) => owner.key) }
|
|
735
|
+
: { component: entry.key }),
|
|
736
|
+
via,
|
|
737
|
+
target: name,
|
|
738
|
+
properties,
|
|
739
|
+
},
|
|
740
|
+
undefined,
|
|
741
|
+
adoption,
|
|
742
|
+
),
|
|
743
|
+
);
|
|
744
|
+
if (ownershipContext === 'subject' || !ownershipEvidence?.ownPackage) return;
|
|
745
|
+
for (const { entry, name, position } of contextualComponents(
|
|
746
|
+
rule.selector,
|
|
747
|
+
facts.ownership,
|
|
748
|
+
isForeign,
|
|
749
|
+
ownershipEvidence.ownPackage,
|
|
750
|
+
ownershipContext === 'any-package',
|
|
751
|
+
)) {
|
|
752
|
+
if (position === 'subject') continue;
|
|
753
|
+
if (
|
|
754
|
+
restyled.some(
|
|
755
|
+
(item) => item.entry.key === entry.key && item.name === name,
|
|
756
|
+
)
|
|
757
|
+
)
|
|
758
|
+
continue;
|
|
759
|
+
diagnostics.push(
|
|
760
|
+
diagnostic(
|
|
761
|
+
'KUI-L019',
|
|
762
|
+
location(file, rule),
|
|
763
|
+
`\`${name}\` uses ${componentLabel(entry)} as ${position} selector context (${properties.join(', ')}); foreign component handles cannot key this stylesheet in this ownership mode. Configure the component through ${configurationFor(entry)}. ${reportGap(entry)}`,
|
|
764
|
+
{
|
|
765
|
+
selector: rule.selector,
|
|
766
|
+
component: entry.key,
|
|
767
|
+
via: 'context',
|
|
768
|
+
position,
|
|
769
|
+
target: name,
|
|
770
|
+
properties,
|
|
771
|
+
},
|
|
772
|
+
undefined,
|
|
773
|
+
adoption,
|
|
774
|
+
),
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function inspectVariableOwnership(
|
|
780
|
+
file,
|
|
781
|
+
decl,
|
|
782
|
+
facts,
|
|
783
|
+
diagnostics,
|
|
784
|
+
adoption,
|
|
785
|
+
isForeign,
|
|
786
|
+
) {
|
|
787
|
+
const at = location(file, decl);
|
|
788
|
+
const privates = new Set([
|
|
789
|
+
...(decl.prop.match(/--_[a-z0-9_-]+/gi) ?? []),
|
|
790
|
+
...(decl.value.match(/--_[a-z0-9_-]+/gi) ?? []),
|
|
791
|
+
]);
|
|
792
|
+
for (const variable of privates) {
|
|
793
|
+
const owner = privateVariableOwner(variable, facts.ownership);
|
|
794
|
+
if (owner === undefined || (owner && !isForeign(owner))) continue;
|
|
795
|
+
const written = decl.prop === variable;
|
|
796
|
+
diagnostics.push(
|
|
797
|
+
diagnostic(
|
|
798
|
+
'KUI-L020',
|
|
799
|
+
at,
|
|
800
|
+
`\`${variable}\` is ${owner ? `${componentName(owner)}'s` : "a Kerf component's"} private variable; ${written ? 'writing it overrides' : 'reading it couples to'} that component's implementation. Configure it through ${configurationFor(owner)}. ${reportGap(owner)}`,
|
|
801
|
+
{
|
|
802
|
+
property: decl.prop,
|
|
803
|
+
value: decl.value,
|
|
804
|
+
variable,
|
|
805
|
+
...(owner ? { component: owner.key } : {}),
|
|
806
|
+
access: written ? 'write' : 'read',
|
|
807
|
+
},
|
|
808
|
+
undefined,
|
|
809
|
+
adoption,
|
|
810
|
+
),
|
|
811
|
+
);
|
|
812
|
+
}
|
|
813
|
+
if (!decl.prop.startsWith('--')) return;
|
|
814
|
+
const typed = typedPropForToken(decl.prop, facts.ownership);
|
|
815
|
+
if (!typed || !isForeign(typed.entry)) return;
|
|
816
|
+
const contract = (typed.entry.cssValueProps ?? []).find(
|
|
817
|
+
({ path }) => path === typed.path,
|
|
818
|
+
);
|
|
819
|
+
const example = contract?.examples?.[0];
|
|
820
|
+
diagnostics.push(
|
|
821
|
+
diagnostic(
|
|
822
|
+
'KUI-L021',
|
|
823
|
+
at,
|
|
824
|
+
`\`${decl.prop}\` is what ${typed.entry.name}'s typed \`${typed.path}\` prop sets; set the prop on ${typed.entry.name}${example ? ` (\`<${typed.entry.name} ${example} />\`)` : ''} instead of overriding the token. ${reportGap(typed.entry)}`,
|
|
825
|
+
{
|
|
826
|
+
property: decl.prop,
|
|
827
|
+
value: decl.value,
|
|
828
|
+
component: typed.entry.key,
|
|
829
|
+
prop: typed.path,
|
|
830
|
+
},
|
|
831
|
+
undefined,
|
|
832
|
+
adoption,
|
|
833
|
+
),
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
async function inspectCss(
|
|
838
|
+
file,
|
|
839
|
+
source,
|
|
840
|
+
facts,
|
|
841
|
+
diagnostics,
|
|
842
|
+
cssFacts,
|
|
843
|
+
adoption = false,
|
|
844
|
+
siblingOnLoud = [],
|
|
845
|
+
isForeign = () => true,
|
|
846
|
+
ownershipEvidence,
|
|
847
|
+
ownershipContext = 'subject',
|
|
848
|
+
) {
|
|
849
|
+
let root;
|
|
850
|
+
try {
|
|
851
|
+
root = postcss.parse(source, { from: file });
|
|
852
|
+
} catch (error) {
|
|
853
|
+
diagnostics.push(
|
|
854
|
+
diagnostic(
|
|
855
|
+
'KUI-L009',
|
|
856
|
+
{ file, line: error.line ?? 1, column: error.column ?? 1 },
|
|
857
|
+
error.reason ?? error.message,
|
|
858
|
+
),
|
|
859
|
+
);
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
inspectLoudPairs(
|
|
863
|
+
file,
|
|
864
|
+
root,
|
|
865
|
+
(decl, message, evidence) =>
|
|
866
|
+
diagnostics.push(
|
|
867
|
+
diagnostic('KUI-L018', location(file, decl), message, evidence),
|
|
868
|
+
),
|
|
869
|
+
siblingOnLoud,
|
|
870
|
+
);
|
|
871
|
+
root.walkRules((rule) => {
|
|
872
|
+
const subjects = subjectClasses(rule.selector);
|
|
873
|
+
inspectComponentOwnership(
|
|
874
|
+
file,
|
|
875
|
+
rule,
|
|
876
|
+
facts,
|
|
877
|
+
diagnostics,
|
|
878
|
+
adoption,
|
|
879
|
+
isForeign,
|
|
880
|
+
ownershipEvidence,
|
|
881
|
+
ownershipContext,
|
|
882
|
+
);
|
|
883
|
+
if (!inKeyframes(rule) && restylingDeclarations(rule).length > 0)
|
|
884
|
+
for (const className of subjects) {
|
|
885
|
+
const record = cssFacts.get(className) ?? {
|
|
886
|
+
scroll: false,
|
|
887
|
+
inset: false,
|
|
888
|
+
};
|
|
889
|
+
record.styled ??= {
|
|
890
|
+
stylesheet: file,
|
|
891
|
+
line: rule.source?.start?.line ?? 1,
|
|
892
|
+
selector: rule.selector,
|
|
893
|
+
};
|
|
894
|
+
cssFacts.set(className, record);
|
|
895
|
+
}
|
|
896
|
+
const classes = [
|
|
897
|
+
...rule.selector.matchAll(/\.([_a-zA-Z]+[_a-zA-Z0-9-]*)/g),
|
|
898
|
+
].map((match) => match[1]);
|
|
899
|
+
const publicRootPattern = [...facts.publicClasses]
|
|
900
|
+
.map(
|
|
901
|
+
(className) => `\\.${className.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}`,
|
|
902
|
+
)
|
|
903
|
+
.join('|');
|
|
904
|
+
const privateDescendants = new Set();
|
|
905
|
+
if (publicRootPattern)
|
|
906
|
+
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
907
|
+
const rootMatch = new RegExp(
|
|
908
|
+
`(?:${publicRootPattern})(?:[.#:[\\w-]|\\s)*(?:>|\\s)`,
|
|
909
|
+
).exec(selector);
|
|
910
|
+
if (!rootMatch) continue;
|
|
911
|
+
const descendant = selector.slice(
|
|
912
|
+
rootMatch.index + rootMatch[0].length,
|
|
913
|
+
);
|
|
914
|
+
for (const match of descendant.matchAll(/\.(kui-[\w-]+)/g))
|
|
915
|
+
if (!facts.publicClasses.has(match[1]))
|
|
916
|
+
privateDescendants.add(match[1]);
|
|
917
|
+
}
|
|
918
|
+
for (const className of classes) {
|
|
919
|
+
if (privateDescendants.has(className))
|
|
920
|
+
diagnostics.push(
|
|
921
|
+
diagnostic(
|
|
922
|
+
'KUI-L010',
|
|
923
|
+
location(file, rule),
|
|
924
|
+
`.${className} is a private Kerf descendant; prefer the owning component's prop or variant, or catalog a deliberate public extension point.`,
|
|
925
|
+
{ selector: rule.selector, className },
|
|
926
|
+
undefined,
|
|
927
|
+
adoption,
|
|
928
|
+
),
|
|
929
|
+
);
|
|
930
|
+
else if (
|
|
931
|
+
className.startsWith('kui-') &&
|
|
932
|
+
!facts.publicClasses.has(className)
|
|
933
|
+
)
|
|
934
|
+
diagnostics.push(
|
|
935
|
+
diagnostic(
|
|
936
|
+
'KUI-L001',
|
|
937
|
+
location(file, rule),
|
|
938
|
+
`.${className} is not a cataloged public Kerf class; prefer a component prop or variant, or catalog the extension point.`,
|
|
939
|
+
{ selector: rule.selector, className },
|
|
940
|
+
undefined,
|
|
941
|
+
adoption,
|
|
942
|
+
),
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
for (const match of rule.selector.matchAll(/::part\(\s*([\w-]+)\s*\)/g)) {
|
|
946
|
+
const part = match[1];
|
|
947
|
+
const roots = facts.publicParts.get(part) ?? new Set();
|
|
948
|
+
const allowed = [...roots].some((className) =>
|
|
949
|
+
new RegExp(`\\.${escapeRegExp(className)}(?:[^\\w-]|$)`).test(
|
|
950
|
+
rule.selector.slice(0, match.index),
|
|
951
|
+
),
|
|
952
|
+
);
|
|
953
|
+
if (!allowed)
|
|
954
|
+
diagnostics.push(
|
|
955
|
+
diagnostic(
|
|
956
|
+
'KUI-L011',
|
|
957
|
+
location(file, rule),
|
|
958
|
+
`::part(${part}) is not a cataloged extension point; prefer the component's prop or variant, or add ${part} to boundaries.publicParts.`,
|
|
959
|
+
{ selector: rule.selector, part },
|
|
960
|
+
undefined,
|
|
961
|
+
adoption,
|
|
962
|
+
),
|
|
963
|
+
);
|
|
964
|
+
}
|
|
965
|
+
rule.walkDecls((decl) => {
|
|
966
|
+
inspectVariableOwnership(
|
|
967
|
+
file,
|
|
968
|
+
decl,
|
|
969
|
+
facts,
|
|
970
|
+
diagnostics,
|
|
971
|
+
adoption,
|
|
972
|
+
isForeign,
|
|
973
|
+
);
|
|
974
|
+
const at = location(file, decl);
|
|
975
|
+
const tokens = [
|
|
976
|
+
...(decl.prop.match(/--kui-[a-z0-9-]+/g) ?? []),
|
|
977
|
+
...(decl.value.match(/--kui-[a-z0-9-]+/g) ?? []),
|
|
978
|
+
];
|
|
979
|
+
for (const token of new Set(tokens))
|
|
980
|
+
if (!facts.publicTokens.has(token)) {
|
|
981
|
+
const assignment = decl.prop === token;
|
|
982
|
+
diagnostics.push(
|
|
983
|
+
diagnostic(
|
|
984
|
+
assignment ? 'KUI-L012' : 'KUI-L002',
|
|
985
|
+
at,
|
|
986
|
+
assignment
|
|
987
|
+
? `${token} has no public configuration contract; prefer the component's prop or variant, or catalog the token explicitly.`
|
|
988
|
+
: `${token} is not a cataloged public Kerf token; prefer a documented token or component configuration.`,
|
|
989
|
+
{ property: decl.prop, value: decl.value, token },
|
|
990
|
+
undefined,
|
|
991
|
+
adoption,
|
|
992
|
+
),
|
|
993
|
+
);
|
|
994
|
+
}
|
|
995
|
+
if (
|
|
996
|
+
spacingProperties.test(decl.prop) &&
|
|
997
|
+
!/var\(|calc\(|remify\(/.test(decl.value)
|
|
998
|
+
)
|
|
999
|
+
for (const value of spacingValues(decl.value))
|
|
1000
|
+
if (!approvedSpacing.has(value.pixels))
|
|
1001
|
+
diagnostics.push(
|
|
1002
|
+
diagnostic(
|
|
1003
|
+
'KUI-L006',
|
|
1004
|
+
at,
|
|
1005
|
+
`${decl.prop}: ${value.text} is outside the approved Kerf spacing scale.`,
|
|
1006
|
+
{
|
|
1007
|
+
property: decl.prop,
|
|
1008
|
+
value: decl.value,
|
|
1009
|
+
pixels: value.pixels,
|
|
1010
|
+
},
|
|
1011
|
+
),
|
|
1012
|
+
);
|
|
1013
|
+
for (const className of subjects) {
|
|
1014
|
+
const record = cssFacts.get(className) ?? {
|
|
1015
|
+
scroll: false,
|
|
1016
|
+
inset: false,
|
|
1017
|
+
};
|
|
1018
|
+
if (
|
|
1019
|
+
/^overflow(?:-|$)/.test(decl.prop) &&
|
|
1020
|
+
/\b(?:auto|scroll)\b/.test(decl.value)
|
|
1021
|
+
)
|
|
1022
|
+
record.scroll = true;
|
|
1023
|
+
if (/^padding(?:-|$)/.test(decl.prop) && decl.value !== '0')
|
|
1024
|
+
record.inset = true;
|
|
1025
|
+
cssFacts.set(className, record);
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
function literalClasses(attribute) {
|
|
1032
|
+
if (!attribute?.initializer) return { values: [], dynamic: false };
|
|
1033
|
+
const value = attribute.initializer;
|
|
1034
|
+
if (ts.isStringLiteral(value))
|
|
1035
|
+
return { values: value.text.split(/\s+/).filter(Boolean), dynamic: false };
|
|
1036
|
+
if (
|
|
1037
|
+
ts.isJsxExpression(value) &&
|
|
1038
|
+
value.expression &&
|
|
1039
|
+
ts.isStringLiteralLike(value.expression)
|
|
1040
|
+
)
|
|
1041
|
+
return {
|
|
1042
|
+
values: value.expression.text.split(/\s+/).filter(Boolean),
|
|
1043
|
+
dynamic: false,
|
|
1044
|
+
};
|
|
1045
|
+
return { values: [], dynamic: true };
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
function literalClassValues(expression) {
|
|
1049
|
+
if (!expression) return [];
|
|
1050
|
+
if (ts.isStringLiteralLike(expression))
|
|
1051
|
+
return expression.text.split(/\s+/).filter(Boolean);
|
|
1052
|
+
if (ts.isParenthesizedExpression(expression))
|
|
1053
|
+
return literalClassValues(expression.expression);
|
|
1054
|
+
if (ts.isConditionalExpression(expression))
|
|
1055
|
+
return [
|
|
1056
|
+
...literalClassValues(expression.whenTrue),
|
|
1057
|
+
...literalClassValues(expression.whenFalse),
|
|
1058
|
+
];
|
|
1059
|
+
return [];
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
function jsxOwnershipEvidence(style, facts, contents, root, compilerCache) {
|
|
1063
|
+
const hooks = new Map();
|
|
1064
|
+
const composedChildren = new Map();
|
|
1065
|
+
const composedDescendants = new Map();
|
|
1066
|
+
const ambiguousHooks = new Set();
|
|
1067
|
+
const ambiguousChildren = new Set();
|
|
1068
|
+
const ambiguousDescendants = new Set();
|
|
1069
|
+
const record = (map, ambiguous, key, entry) => {
|
|
1070
|
+
if (ambiguous.has(key)) return;
|
|
1071
|
+
if (map.has(key) && map.get(key).key !== entry.key) {
|
|
1072
|
+
map.delete(key);
|
|
1073
|
+
ambiguous.add(key);
|
|
1074
|
+
} else map.set(key, entry);
|
|
1075
|
+
};
|
|
1076
|
+
for (const owner of facts.entries) {
|
|
1077
|
+
if (!owner.componentSource || !owner.catalogDirectory) continue;
|
|
1078
|
+
const relativeStyle = relative(owner.catalogDirectory, style).replaceAll(
|
|
1079
|
+
'\\',
|
|
1080
|
+
'/',
|
|
1081
|
+
);
|
|
1082
|
+
if (!owner.styleSources?.includes(relativeStyle)) continue;
|
|
1083
|
+
const file = resolve(owner.catalogDirectory, owner.componentSource);
|
|
1084
|
+
const sourceText = contents.get(file);
|
|
1085
|
+
if (!sourceText) continue;
|
|
1086
|
+
const source = ts.createSourceFile(
|
|
1087
|
+
file,
|
|
1088
|
+
sourceText,
|
|
1089
|
+
ts.ScriptTarget.Latest,
|
|
1090
|
+
true,
|
|
1091
|
+
ts.ScriptKind.TSX,
|
|
1092
|
+
);
|
|
1093
|
+
const localComponents = new Map();
|
|
1094
|
+
for (const statement of source.statements) {
|
|
1095
|
+
if (
|
|
1096
|
+
ts.isFunctionDeclaration(statement) &&
|
|
1097
|
+
statement.name &&
|
|
1098
|
+
statement.body
|
|
1099
|
+
)
|
|
1100
|
+
localComponents.set(statement.name.text, statement.body);
|
|
1101
|
+
if (!ts.isVariableStatement(statement)) continue;
|
|
1102
|
+
for (const declaration of statement.declarationList.declarations)
|
|
1103
|
+
if (
|
|
1104
|
+
ts.isIdentifier(declaration.name) &&
|
|
1105
|
+
declaration.initializer &&
|
|
1106
|
+
(ts.isArrowFunction(declaration.initializer) ||
|
|
1107
|
+
ts.isFunctionExpression(declaration.initializer))
|
|
1108
|
+
)
|
|
1109
|
+
localComponents.set(
|
|
1110
|
+
declaration.name.text,
|
|
1111
|
+
declaration.initializer.body,
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
const imports = new Map();
|
|
1115
|
+
const namespaces = new Map();
|
|
1116
|
+
const compilerOptions = compilerOptionsFor(file, root, compilerCache);
|
|
1117
|
+
const aliasSource = (module) =>
|
|
1118
|
+
module && !module.startsWith('.') && compilerOptions?.paths
|
|
1119
|
+
? ts.resolveModuleName(module, file, compilerOptions, ts.sys)
|
|
1120
|
+
.resolvedModule?.resolvedFileName
|
|
1121
|
+
: undefined;
|
|
1122
|
+
for (const statement of source.statements) {
|
|
1123
|
+
if (
|
|
1124
|
+
!ts.isImportDeclaration(statement) ||
|
|
1125
|
+
!ts.isStringLiteral(statement.moduleSpecifier)
|
|
1126
|
+
)
|
|
1127
|
+
continue;
|
|
1128
|
+
const module = statement.moduleSpecifier.text;
|
|
1129
|
+
const bindings = statement.importClause?.namedBindings;
|
|
1130
|
+
if (bindings && ts.isNamespaceImport(bindings)) {
|
|
1131
|
+
namespaces.set(bindings.name.text, module);
|
|
1132
|
+
continue;
|
|
1133
|
+
}
|
|
1134
|
+
if (!bindings || !ts.isNamedImports(bindings)) continue;
|
|
1135
|
+
for (const item of bindings.elements) {
|
|
1136
|
+
const exported = item.propertyName?.text ?? item.name.text;
|
|
1137
|
+
const entry = resolveExportEntry(
|
|
1138
|
+
facts.exportEntries.get(exported),
|
|
1139
|
+
exported,
|
|
1140
|
+
module,
|
|
1141
|
+
file,
|
|
1142
|
+
owner.catalogDirectory,
|
|
1143
|
+
aliasSource(module),
|
|
1144
|
+
);
|
|
1145
|
+
if (entry) imports.set(item.name.text, entry);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
const openingOf = (node) =>
|
|
1149
|
+
ts.isJsxElement(node) ? node.openingElement : node;
|
|
1150
|
+
const entryFor = (opening) => {
|
|
1151
|
+
const tag = opening.tagName.getText(source);
|
|
1152
|
+
if (imports.has(tag)) return imports.get(tag);
|
|
1153
|
+
if (
|
|
1154
|
+
ts.isPropertyAccessExpression(opening.tagName) &&
|
|
1155
|
+
ts.isIdentifier(opening.tagName.expression)
|
|
1156
|
+
) {
|
|
1157
|
+
const module = namespaces.get(opening.tagName.expression.text);
|
|
1158
|
+
return resolveExportEntry(
|
|
1159
|
+
facts.exportEntries.get(opening.tagName.name.text),
|
|
1160
|
+
opening.tagName.name.text,
|
|
1161
|
+
module,
|
|
1162
|
+
file,
|
|
1163
|
+
owner.catalogDirectory,
|
|
1164
|
+
aliasSource(module),
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
return undefined;
|
|
1168
|
+
};
|
|
1169
|
+
const classesOf = (opening) =>
|
|
1170
|
+
literalClasses(
|
|
1171
|
+
opening.attributes.properties.find(
|
|
1172
|
+
(item) =>
|
|
1173
|
+
ts.isJsxAttribute(item) &&
|
|
1174
|
+
['class', 'className'].includes(item.name.getText(source)),
|
|
1175
|
+
),
|
|
1176
|
+
).values;
|
|
1177
|
+
const returnedJsx = (body) => {
|
|
1178
|
+
if (!ts.isBlock(body)) return [body];
|
|
1179
|
+
const expressions = [];
|
|
1180
|
+
const visitReturns = (node) => {
|
|
1181
|
+
if (ts.isReturnStatement(node)) {
|
|
1182
|
+
if (node.expression) expressions.push(node.expression);
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
if (
|
|
1186
|
+
node !== body &&
|
|
1187
|
+
(ts.isFunctionDeclaration(node) ||
|
|
1188
|
+
ts.isFunctionExpression(node) ||
|
|
1189
|
+
ts.isArrowFunction(node))
|
|
1190
|
+
)
|
|
1191
|
+
return;
|
|
1192
|
+
ts.forEachChild(node, visitReturns);
|
|
1193
|
+
};
|
|
1194
|
+
visitReturns(body);
|
|
1195
|
+
return expressions;
|
|
1196
|
+
};
|
|
1197
|
+
const localReturns = (opening, seen) => {
|
|
1198
|
+
const name = opening.tagName.getText(source);
|
|
1199
|
+
const body = localComponents.get(name);
|
|
1200
|
+
if (!body || seen.has(name)) return undefined;
|
|
1201
|
+
return { name, expressions: returnedJsx(body) };
|
|
1202
|
+
};
|
|
1203
|
+
const composedBelow = (node, found, seen = new Set()) => {
|
|
1204
|
+
if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
|
|
1205
|
+
const opening = openingOf(node);
|
|
1206
|
+
const entry = entryFor(opening);
|
|
1207
|
+
if (entry) {
|
|
1208
|
+
for (const type of [
|
|
1209
|
+
entry.boundaries?.rootElement,
|
|
1210
|
+
...(entry.boundaries?.descendantElements ?? []),
|
|
1211
|
+
]) {
|
|
1212
|
+
if (!type) continue;
|
|
1213
|
+
const entries = found.get(type) ?? new Set();
|
|
1214
|
+
entries.add(entry);
|
|
1215
|
+
found.set(type, entries);
|
|
1216
|
+
}
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
const local = localReturns(opening, seen);
|
|
1220
|
+
if (local) {
|
|
1221
|
+
const next = new Set([...seen, local.name]);
|
|
1222
|
+
for (const expression of local.expressions)
|
|
1223
|
+
composedBelow(expression, found, next);
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
if (ts.isJsxElement(node))
|
|
1227
|
+
for (const child of node.children) composedBelow(child, found, seen);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (ts.isJsxFragment(node)) {
|
|
1231
|
+
for (const child of node.children) composedBelow(child, found, seen);
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
ts.forEachChild(node, (child) => composedBelow(child, found, seen));
|
|
1235
|
+
};
|
|
1236
|
+
const expandedRoots = (node, seen = new Set()) => {
|
|
1237
|
+
if (ts.isJsxFragment(node))
|
|
1238
|
+
return node.children.flatMap((child) => expandedRoots(child, seen));
|
|
1239
|
+
if (!ts.isJsxElement(node) && !ts.isJsxSelfClosingElement(node)) {
|
|
1240
|
+
const roots = [];
|
|
1241
|
+
ts.forEachChild(node, (child) =>
|
|
1242
|
+
roots.push(...expandedRoots(child, seen)),
|
|
1243
|
+
);
|
|
1244
|
+
return roots;
|
|
1245
|
+
}
|
|
1246
|
+
const local = localReturns(openingOf(node), seen);
|
|
1247
|
+
if (!local) return [node];
|
|
1248
|
+
const next = new Set([...seen, local.name]);
|
|
1249
|
+
return local.expressions.flatMap((expression) =>
|
|
1250
|
+
expandedRoots(expression, next),
|
|
1251
|
+
);
|
|
1252
|
+
};
|
|
1253
|
+
const visit = (node) => {
|
|
1254
|
+
if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
|
|
1255
|
+
const opening = openingOf(node);
|
|
1256
|
+
const entry = entryFor(opening);
|
|
1257
|
+
if (entry)
|
|
1258
|
+
for (const name of classesOf(opening))
|
|
1259
|
+
record(hooks, ambiguousHooks, name, entry);
|
|
1260
|
+
if (ts.isJsxElement(node)) {
|
|
1261
|
+
const parentClasses = classesOf(opening);
|
|
1262
|
+
if (parentClasses.length) {
|
|
1263
|
+
const descendants = new Map();
|
|
1264
|
+
for (const child of node.children)
|
|
1265
|
+
composedBelow(child, descendants);
|
|
1266
|
+
for (const [type, entries] of descendants)
|
|
1267
|
+
for (const entry of entries)
|
|
1268
|
+
for (const name of parentClasses)
|
|
1269
|
+
record(
|
|
1270
|
+
composedDescendants,
|
|
1271
|
+
ambiguousDescendants,
|
|
1272
|
+
`${name}|${type}`,
|
|
1273
|
+
entry,
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
const possible = new Map();
|
|
1277
|
+
let dynamic = false;
|
|
1278
|
+
for (const child of node.children) {
|
|
1279
|
+
if (ts.isJsxExpression(child) && child.expression) dynamic = true;
|
|
1280
|
+
if (!ts.isJsxElement(child) && !ts.isJsxSelfClosingElement(child))
|
|
1281
|
+
continue;
|
|
1282
|
+
for (const root of expandedRoots(child)) {
|
|
1283
|
+
const childOpening = openingOf(root);
|
|
1284
|
+
const childEntry = entryFor(childOpening);
|
|
1285
|
+
const type =
|
|
1286
|
+
childEntry?.boundaries?.rootElement ??
|
|
1287
|
+
(childEntry
|
|
1288
|
+
? undefined
|
|
1289
|
+
: childOpening.tagName.getText(source).toLowerCase());
|
|
1290
|
+
if (!type) continue;
|
|
1291
|
+
const candidates = possible.get(type) ?? [];
|
|
1292
|
+
candidates.push(childEntry);
|
|
1293
|
+
possible.set(type, candidates);
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
if (!dynamic)
|
|
1297
|
+
for (const [type, candidates] of possible)
|
|
1298
|
+
if (
|
|
1299
|
+
candidates.length > 0 &&
|
|
1300
|
+
candidates.every(
|
|
1301
|
+
(candidate) => candidate?.key === candidates[0]?.key,
|
|
1302
|
+
) &&
|
|
1303
|
+
candidates[0]
|
|
1304
|
+
)
|
|
1305
|
+
for (const name of parentClasses)
|
|
1306
|
+
record(
|
|
1307
|
+
composedChildren,
|
|
1308
|
+
ambiguousChildren,
|
|
1309
|
+
`${name}|${type}`,
|
|
1310
|
+
candidates[0],
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
ts.forEachChild(node, visit);
|
|
1315
|
+
};
|
|
1316
|
+
visit(source);
|
|
1317
|
+
}
|
|
1318
|
+
return { componentMode: true, hooks, composedChildren, composedDescendants };
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
function cssPreferred(contract) {
|
|
1322
|
+
return (
|
|
1323
|
+
[
|
|
1324
|
+
...(contract.canonicalShorthands ?? []).map((item) => `\`${item}\``),
|
|
1325
|
+
...(contract.helpers ?? []).map((item) => `\`${item}()\``),
|
|
1326
|
+
].join(' or ') || 'a cataloged component prop'
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
function objectProperty(object, name) {
|
|
1331
|
+
return object?.properties.find(
|
|
1332
|
+
(property) =>
|
|
1333
|
+
ts.isPropertyAssignment(property) &&
|
|
1334
|
+
property.name.getText().replaceAll(/["']/g, '') === name,
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
// A catalog `cssValueProps` path is dot-separated object members, each
|
|
1339
|
+
// optionally suffixed with `[]` to visit every array element: `gap`,
|
|
1340
|
+
// `choices[].swatch`, `iconTile.color`. A member that does not resolve to a
|
|
1341
|
+
// literal object or array (a tone string, a variable, a spread) is skipped:
|
|
1342
|
+
// dynamic values are the type system's job.
|
|
1343
|
+
function cssPathSegments(path) {
|
|
1344
|
+
return path
|
|
1345
|
+
.split('.')
|
|
1346
|
+
.map((segment) =>
|
|
1347
|
+
segment.endsWith('[]')
|
|
1348
|
+
? { name: segment.slice(0, -2), each: true }
|
|
1349
|
+
: { name: segment, each: false },
|
|
1350
|
+
);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
function expandCssElements(values, each) {
|
|
1354
|
+
if (!each) return values;
|
|
1355
|
+
return values.flatMap((value) =>
|
|
1356
|
+
ts.isArrayLiteralExpression(value) ? value.elements : [],
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
function nestedCssValues(value, segments) {
|
|
1361
|
+
let values = expandCssElements(value ? [value] : [], segments[0].each);
|
|
1362
|
+
for (const { name, each } of segments.slice(1))
|
|
1363
|
+
values = expandCssElements(
|
|
1364
|
+
values.flatMap((item) => {
|
|
1365
|
+
if (!ts.isObjectLiteralExpression(item)) return [];
|
|
1366
|
+
const property = objectProperty(item, name);
|
|
1367
|
+
return property ? [property.initializer] : [];
|
|
1368
|
+
}),
|
|
1369
|
+
each,
|
|
1370
|
+
);
|
|
1371
|
+
return values;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
function jsxCssValues(opening, path) {
|
|
1375
|
+
const segments = cssPathSegments(path);
|
|
1376
|
+
const attribute = opening.attributes.properties.find(
|
|
1377
|
+
(item) =>
|
|
1378
|
+
ts.isJsxAttribute(item) && item.name.getText() === segments[0].name,
|
|
1379
|
+
);
|
|
1380
|
+
if (!attribute?.initializer) return [];
|
|
1381
|
+
const value = ts.isJsxExpression(attribute.initializer)
|
|
1382
|
+
? attribute.initializer.expression
|
|
1383
|
+
: attribute.initializer;
|
|
1384
|
+
return nestedCssValues(value, segments);
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
function callCssValues(call, path) {
|
|
1388
|
+
const options = call.arguments[0];
|
|
1389
|
+
if (!options || !ts.isObjectLiteralExpression(options)) return [];
|
|
1390
|
+
const segments = cssPathSegments(path);
|
|
1391
|
+
const property = objectProperty(options, segments[0].name);
|
|
1392
|
+
return property ? nestedCssValues(property.initializer, segments) : [];
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
function cssLiteral(value) {
|
|
1396
|
+
if (
|
|
1397
|
+
ts.isStringLiteralLike(value) ||
|
|
1398
|
+
ts.isNoSubstitutionTemplateLiteral(value)
|
|
1399
|
+
)
|
|
1400
|
+
return value.text;
|
|
1401
|
+
return undefined;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
function importedName(expression, helperImports, namespaces, packageName) {
|
|
1405
|
+
let helper;
|
|
1406
|
+
if (ts.isIdentifier(expression)) helper = helperImports.get(expression.text);
|
|
1407
|
+
else if (
|
|
1408
|
+
ts.isPropertyAccessExpression(expression) &&
|
|
1409
|
+
ts.isIdentifier(expression.expression) &&
|
|
1410
|
+
namespaces.has(expression.expression.text)
|
|
1411
|
+
)
|
|
1412
|
+
helper = {
|
|
1413
|
+
imported: expression.name.text,
|
|
1414
|
+
source: namespaces.get(expression.expression.text),
|
|
1415
|
+
};
|
|
1416
|
+
else helper = undefined;
|
|
1417
|
+
if (!helper) return undefined;
|
|
1418
|
+
return helper.source === packageName ||
|
|
1419
|
+
helper.source.startsWith(`${packageName}/`)
|
|
1420
|
+
? helper.imported
|
|
1421
|
+
: undefined;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
function inspectCssValues(
|
|
1425
|
+
file,
|
|
1426
|
+
source,
|
|
1427
|
+
entry,
|
|
1428
|
+
valuesFor,
|
|
1429
|
+
helperImports,
|
|
1430
|
+
namespaces,
|
|
1431
|
+
diagnostics,
|
|
1432
|
+
) {
|
|
1433
|
+
for (const contract of entry.cssValueProps ?? []) {
|
|
1434
|
+
const preferred = cssPreferred(contract);
|
|
1435
|
+
for (const value of valuesFor(contract.path)) {
|
|
1436
|
+
const at = location(file, value, source);
|
|
1437
|
+
if (
|
|
1438
|
+
contract.grammar === 'declarations' &&
|
|
1439
|
+
contract.rawPolicy !== 'allow'
|
|
1440
|
+
) {
|
|
1441
|
+
diagnostics.push(
|
|
1442
|
+
diagnostic(
|
|
1443
|
+
'KUI-L016',
|
|
1444
|
+
at,
|
|
1445
|
+
`\`${entry.name}.${contract.path}\` is a forbidden declaration-list escape hatch; use \`className\`, public tokens, or cataloged props.`,
|
|
1446
|
+
{ component: entry.key, path: contract.path },
|
|
1447
|
+
),
|
|
1448
|
+
);
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1451
|
+
const literal = cssLiteral(value);
|
|
1452
|
+
if (literal !== undefined) {
|
|
1453
|
+
if (contract.exceptionalShorthands?.includes(literal)) {
|
|
1454
|
+
diagnostics.push(
|
|
1455
|
+
diagnostic(
|
|
1456
|
+
'KUI-L017',
|
|
1457
|
+
at,
|
|
1458
|
+
`\`${literal}\` is an exceptional shorthand for \`${entry.name}.${contract.path}\`; prefer ${preferred} unless the off-scale choice is deliberate.`,
|
|
1459
|
+
{ component: entry.key, path: contract.path, value: literal },
|
|
1460
|
+
),
|
|
1461
|
+
);
|
|
1462
|
+
} else if (
|
|
1463
|
+
!contract.shorthands?.includes(literal) &&
|
|
1464
|
+
contract.rawPolicy !== 'allow'
|
|
1465
|
+
) {
|
|
1466
|
+
diagnostics.push(
|
|
1467
|
+
diagnostic(
|
|
1468
|
+
'KUI-L013',
|
|
1469
|
+
at,
|
|
1470
|
+
`\`${entry.name}.${contract.path}\` uses ${contract.grammar} grammar; replace raw \`${literal}\` with ${preferred}.`,
|
|
1471
|
+
{ component: entry.key, path: contract.path, value: literal },
|
|
1472
|
+
),
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1475
|
+
continue;
|
|
1476
|
+
}
|
|
1477
|
+
if (!ts.isCallExpression(value)) continue;
|
|
1478
|
+
const helper = importedName(
|
|
1479
|
+
value.expression,
|
|
1480
|
+
helperImports,
|
|
1481
|
+
namespaces,
|
|
1482
|
+
entry.package,
|
|
1483
|
+
);
|
|
1484
|
+
if (!helper) continue;
|
|
1485
|
+
if (contract.nonStandaloneHelpers?.includes(helper))
|
|
1486
|
+
diagnostics.push(
|
|
1487
|
+
diagnostic(
|
|
1488
|
+
'KUI-L015',
|
|
1489
|
+
at,
|
|
1490
|
+
`\`${helper}()\` is not a standalone CSS value for \`${entry.name}.${contract.path}\`; wrap it with an accepted composer such as \`calc()\`.`,
|
|
1491
|
+
{ component: entry.key, path: contract.path, helper },
|
|
1492
|
+
),
|
|
1493
|
+
);
|
|
1494
|
+
else if (
|
|
1495
|
+
!contract.helpers?.includes(helper) &&
|
|
1496
|
+
contract.unsafeHelper !== helper
|
|
1497
|
+
)
|
|
1498
|
+
diagnostics.push(
|
|
1499
|
+
diagnostic(
|
|
1500
|
+
'KUI-L014',
|
|
1501
|
+
at,
|
|
1502
|
+
`\`${helper}()\` produces the wrong grammar for \`${entry.name}.${contract.path}\`; use ${preferred}.`,
|
|
1503
|
+
{ component: entry.key, path: contract.path, helper },
|
|
1504
|
+
),
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
function inspectTsx(
|
|
1511
|
+
file,
|
|
1512
|
+
sourceText,
|
|
1513
|
+
facts,
|
|
1514
|
+
cssFacts,
|
|
1515
|
+
diagnostics,
|
|
1516
|
+
adoption = false,
|
|
1517
|
+
isForeign = () => true,
|
|
1518
|
+
packageDirectory,
|
|
1519
|
+
compilerOptions,
|
|
1520
|
+
componentMode = false,
|
|
1521
|
+
) {
|
|
1522
|
+
const source = ts.createSourceFile(
|
|
1523
|
+
file,
|
|
1524
|
+
sourceText,
|
|
1525
|
+
ts.ScriptTarget.Latest,
|
|
1526
|
+
true,
|
|
1527
|
+
ts.ScriptKind.TSX,
|
|
1528
|
+
);
|
|
1529
|
+
const imports = new Map();
|
|
1530
|
+
const helperImports = new Map();
|
|
1531
|
+
const namespaces = new Map();
|
|
1532
|
+
const aliasSources = new Map();
|
|
1533
|
+
const aliasSource = (module) => {
|
|
1534
|
+
if (!module || module.startsWith('.') || !compilerOptions?.paths)
|
|
1535
|
+
return undefined;
|
|
1536
|
+
if (!aliasSources.has(module))
|
|
1537
|
+
aliasSources.set(
|
|
1538
|
+
module,
|
|
1539
|
+
ts.resolveModuleName(module, file, compilerOptions, ts.sys)
|
|
1540
|
+
.resolvedModule?.resolvedFileName,
|
|
1541
|
+
);
|
|
1542
|
+
return aliasSources.get(module);
|
|
1543
|
+
};
|
|
1544
|
+
for (const statement of source.statements) {
|
|
1545
|
+
if (
|
|
1546
|
+
!ts.isImportDeclaration(statement) ||
|
|
1547
|
+
!ts.isStringLiteral(statement.moduleSpecifier)
|
|
1548
|
+
)
|
|
1549
|
+
continue;
|
|
1550
|
+
const module = statement.moduleSpecifier.text;
|
|
1551
|
+
const importClause = statement.importClause;
|
|
1552
|
+
if (importClause?.name)
|
|
1553
|
+
helperImports.set(importClause.name.text, {
|
|
1554
|
+
imported: 'default',
|
|
1555
|
+
source: module,
|
|
1556
|
+
});
|
|
1557
|
+
const bindings = statement.importClause?.namedBindings;
|
|
1558
|
+
if (bindings && ts.isNamespaceImport(bindings)) {
|
|
1559
|
+
namespaces.set(bindings.name.text, module);
|
|
1560
|
+
continue;
|
|
1561
|
+
}
|
|
1562
|
+
if (!bindings || !ts.isNamedImports(bindings)) continue;
|
|
1563
|
+
for (const item of bindings.elements) {
|
|
1564
|
+
const exported = item.propertyName?.text ?? item.name.text;
|
|
1565
|
+
helperImports.set(item.name.text, { imported: exported, source: module });
|
|
1566
|
+
const entry = resolveExportEntry(
|
|
1567
|
+
facts.exportEntries.get(exported),
|
|
1568
|
+
exported,
|
|
1569
|
+
module,
|
|
1570
|
+
file,
|
|
1571
|
+
packageDirectory,
|
|
1572
|
+
aliasSource(module),
|
|
1573
|
+
);
|
|
1574
|
+
if (entry) imports.set(item.name.text, entry);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
const stack = [];
|
|
1578
|
+
const inspectBorrowedMarkup = !isTestModule(file);
|
|
1579
|
+
const borrowed = (className, node, via) => {
|
|
1580
|
+
if (!inspectBorrowedMarkup) return;
|
|
1581
|
+
const owners =
|
|
1582
|
+
facts.classEntries.get(className) ??
|
|
1583
|
+
(componentMode && bemBlock(className) !== className
|
|
1584
|
+
? facts.blockEntries.get(bemBlock(className))
|
|
1585
|
+
: undefined) ??
|
|
1586
|
+
[];
|
|
1587
|
+
for (const owner of owners) {
|
|
1588
|
+
if (
|
|
1589
|
+
!isForeign(owner, className) ||
|
|
1590
|
+
owner.boundaries?.placeableClasses?.includes(className)
|
|
1591
|
+
)
|
|
1592
|
+
continue;
|
|
1593
|
+
diagnostics.push(
|
|
1594
|
+
diagnostic(
|
|
1595
|
+
'KUI-L023',
|
|
1596
|
+
location(file, node, source),
|
|
1597
|
+
`\`.${className}\` is rendered in this module's ${via} but belongs to ${componentLabel(owner)}. Render that component or configure it through ${configurationFor(owner)}. ${reportGap(owner)}`,
|
|
1598
|
+
{ className, component: owner.key, via },
|
|
1599
|
+
undefined,
|
|
1600
|
+
adoption,
|
|
1601
|
+
),
|
|
1602
|
+
);
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
const borrowedValues = (values, node, via) => {
|
|
1606
|
+
for (const className of new Set(values)) borrowed(className, node, via);
|
|
1607
|
+
};
|
|
1608
|
+
const templateGap = '\uE000';
|
|
1609
|
+
const rawHtmlClasses = (value) => {
|
|
1610
|
+
const classes = [];
|
|
1611
|
+
for (const match of value.matchAll(
|
|
1612
|
+
/<[a-z][^>]*\sclass\s*=\s*["']([^"']+)["']/gi,
|
|
1613
|
+
)) {
|
|
1614
|
+
const pieces = match[1].split(templateGap);
|
|
1615
|
+
for (const [index, piece] of pieces.entries()) {
|
|
1616
|
+
const words = piece.split(/\s+/).filter(Boolean);
|
|
1617
|
+
if (index > 0 && !/^\s/.test(piece)) words.shift();
|
|
1618
|
+
if (index < pieces.length - 1 && !/\s$/.test(piece)) words.pop();
|
|
1619
|
+
classes.push(...words);
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
return classes;
|
|
1623
|
+
};
|
|
1624
|
+
const visit = (node) => {
|
|
1625
|
+
if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
|
|
1626
|
+
const opening = ts.isJsxElement(node) ? node.openingElement : node;
|
|
1627
|
+
const tag = opening.tagName.getText(source);
|
|
1628
|
+
const namespaceEntry =
|
|
1629
|
+
ts.isPropertyAccessExpression(opening.tagName) &&
|
|
1630
|
+
ts.isIdentifier(opening.tagName.expression)
|
|
1631
|
+
? resolveExportEntry(
|
|
1632
|
+
facts.exportEntries.get(opening.tagName.name.text),
|
|
1633
|
+
opening.tagName.name.text,
|
|
1634
|
+
namespaces.get(opening.tagName.expression.text),
|
|
1635
|
+
file,
|
|
1636
|
+
packageDirectory,
|
|
1637
|
+
aliasSource(namespaces.get(opening.tagName.expression.text)),
|
|
1638
|
+
)
|
|
1639
|
+
: undefined;
|
|
1640
|
+
const entry = imports.get(tag) ?? namespaceEntry;
|
|
1641
|
+
const classAttribute = opening.attributes.properties.find(
|
|
1642
|
+
(item) =>
|
|
1643
|
+
ts.isJsxAttribute(item) &&
|
|
1644
|
+
['class', 'className'].includes(item.name.getText(source)),
|
|
1645
|
+
);
|
|
1646
|
+
const classes = literalClasses(classAttribute);
|
|
1647
|
+
const at = location(file, opening, source);
|
|
1648
|
+
if ((!entry && /^[a-z]/.test(tag)) || (componentMode && entry))
|
|
1649
|
+
borrowedValues(
|
|
1650
|
+
classAttribute?.initializer &&
|
|
1651
|
+
ts.isJsxExpression(classAttribute.initializer)
|
|
1652
|
+
? literalClassValues(classAttribute.initializer.expression)
|
|
1653
|
+
: classes.values,
|
|
1654
|
+
classAttribute ?? opening,
|
|
1655
|
+
'JSX markup',
|
|
1656
|
+
);
|
|
1657
|
+
if (entry)
|
|
1658
|
+
inspectCssValues(
|
|
1659
|
+
file,
|
|
1660
|
+
source,
|
|
1661
|
+
entry,
|
|
1662
|
+
(path) => jsxCssValues(opening, path),
|
|
1663
|
+
helperImports,
|
|
1664
|
+
namespaces,
|
|
1665
|
+
diagnostics,
|
|
1666
|
+
);
|
|
1667
|
+
if (entry && isForeign(entry))
|
|
1668
|
+
for (const className of classes.values) {
|
|
1669
|
+
// A class owned by the surrounding application is still a hook when
|
|
1670
|
+
// placed on another component's root. Only the component's own
|
|
1671
|
+
// public class is safe to style here.
|
|
1672
|
+
if (
|
|
1673
|
+
classOwnerFor(facts.ownership, className, componentMode)?.key ===
|
|
1674
|
+
entry.key
|
|
1675
|
+
)
|
|
1676
|
+
continue;
|
|
1677
|
+
const styled = cssFacts.get(className)?.styled;
|
|
1678
|
+
if (!styled) continue;
|
|
1679
|
+
diagnostics.push(
|
|
1680
|
+
diagnostic(
|
|
1681
|
+
'KUI-L022',
|
|
1682
|
+
at,
|
|
1683
|
+
`\`${className}\` is placed on ${entry.name}'s root and styled by ${basename(styled.stylesheet)}:${styled.line} (\`${styled.selector}\`), which restyles ${componentLabel(entry)}; components own their styles. Configure it through ${configurationFor(entry)}, or wrap it in your own element and style that. ${reportGap(entry)}`,
|
|
1684
|
+
{
|
|
1685
|
+
tag,
|
|
1686
|
+
component: entry.key,
|
|
1687
|
+
className,
|
|
1688
|
+
stylesheet: styled.stylesheet,
|
|
1689
|
+
line: styled.line,
|
|
1690
|
+
selector: styled.selector,
|
|
1691
|
+
},
|
|
1692
|
+
undefined,
|
|
1693
|
+
adoption,
|
|
1694
|
+
),
|
|
1695
|
+
);
|
|
1696
|
+
}
|
|
1697
|
+
if (classes.dynamic)
|
|
1698
|
+
diagnostics.push(
|
|
1699
|
+
diagnostic(
|
|
1700
|
+
'KUI-L008',
|
|
1701
|
+
at,
|
|
1702
|
+
'Dynamic class expression was left unclassified; review it against cataloged public classes.',
|
|
1703
|
+
{ tag },
|
|
1704
|
+
),
|
|
1705
|
+
);
|
|
1706
|
+
const owners = classes.values.flatMap(
|
|
1707
|
+
(className) => facts.classEntries.get(className) ?? [],
|
|
1708
|
+
);
|
|
1709
|
+
for (const property of ['margin', 'border', 'padding']) {
|
|
1710
|
+
const selfOwners = owners.filter(
|
|
1711
|
+
(owner) => owner.layout?.geometry?.[property] === 'self',
|
|
1712
|
+
);
|
|
1713
|
+
if (new Set(selfOwners.map((owner) => owner.key)).size > 1)
|
|
1714
|
+
diagnostics.push(
|
|
1715
|
+
diagnostic(
|
|
1716
|
+
'KUI-L003',
|
|
1717
|
+
at,
|
|
1718
|
+
`One element combines multiple ${property} owners: ${selfOwners.map((owner) => owner.key).join(', ')}.`,
|
|
1719
|
+
{ property, classes: classes.values },
|
|
1720
|
+
selfOwners.map((owner) => owner.key),
|
|
1721
|
+
),
|
|
1722
|
+
);
|
|
1723
|
+
}
|
|
1724
|
+
const scroll = classes.values.some(
|
|
1725
|
+
(className) => cssFacts.get(className)?.scroll,
|
|
1726
|
+
);
|
|
1727
|
+
const inset = classes.values.some(
|
|
1728
|
+
(className) => cssFacts.get(className)?.inset,
|
|
1729
|
+
);
|
|
1730
|
+
const parent = stack.at(-1);
|
|
1731
|
+
if (scroll && parent?.scroll)
|
|
1732
|
+
diagnostics.push(
|
|
1733
|
+
diagnostic(
|
|
1734
|
+
'KUI-L007',
|
|
1735
|
+
at,
|
|
1736
|
+
'A scroll-owning element is nested inside another declared scroll owner.',
|
|
1737
|
+
{ classes: classes.values },
|
|
1738
|
+
[parent.label, entry?.key ?? tag],
|
|
1739
|
+
),
|
|
1740
|
+
);
|
|
1741
|
+
if (inset && parent?.inset)
|
|
1742
|
+
diagnostics.push(
|
|
1743
|
+
diagnostic(
|
|
1744
|
+
'KUI-L004',
|
|
1745
|
+
at,
|
|
1746
|
+
'Nested elements both add content padding; confirm that the repeated inset is intentional.',
|
|
1747
|
+
{ classes: classes.values },
|
|
1748
|
+
[parent.label, entry?.key ?? tag],
|
|
1749
|
+
),
|
|
1750
|
+
);
|
|
1751
|
+
stack.push({
|
|
1752
|
+
scroll: scroll || parent?.scroll,
|
|
1753
|
+
inset: inset || parent?.inset,
|
|
1754
|
+
label: entry?.key ?? tag,
|
|
1755
|
+
});
|
|
1756
|
+
// JSX supplied through a prop (for example Toolbar.leading) is still
|
|
1757
|
+
// rendered markup and must be checked like ordinary children.
|
|
1758
|
+
ts.forEachChild(opening.attributes, visit);
|
|
1759
|
+
if (ts.isJsxElement(node))
|
|
1760
|
+
for (const child of node.children) visit(child);
|
|
1761
|
+
stack.pop();
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
if (ts.isCallExpression(node)) {
|
|
1765
|
+
if (ts.isPropertyAccessExpression(node.expression)) {
|
|
1766
|
+
const method = node.expression.name.text;
|
|
1767
|
+
const receiver = node.expression.expression;
|
|
1768
|
+
if (
|
|
1769
|
+
ts.isPropertyAccessExpression(receiver) &&
|
|
1770
|
+
receiver.name.text === 'classList'
|
|
1771
|
+
) {
|
|
1772
|
+
const written =
|
|
1773
|
+
method === 'add'
|
|
1774
|
+
? node.arguments
|
|
1775
|
+
: method === 'toggle'
|
|
1776
|
+
? node.arguments.slice(0, 1)
|
|
1777
|
+
: method === 'replace'
|
|
1778
|
+
? node.arguments.slice(1, 2)
|
|
1779
|
+
: [];
|
|
1780
|
+
for (const value of written)
|
|
1781
|
+
borrowedValues(literalClassValues(value), value, 'classList write');
|
|
1782
|
+
}
|
|
1783
|
+
if (
|
|
1784
|
+
method === 'setAttribute' &&
|
|
1785
|
+
node.arguments[0] &&
|
|
1786
|
+
ts.isStringLiteralLike(node.arguments[0]) &&
|
|
1787
|
+
node.arguments[0].text === 'class'
|
|
1788
|
+
)
|
|
1789
|
+
borrowedValues(
|
|
1790
|
+
literalClassValues(node.arguments[1]),
|
|
1791
|
+
node.arguments[1] ?? node,
|
|
1792
|
+
'setAttribute write',
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
const entry = ts.isIdentifier(node.expression)
|
|
1796
|
+
? imports.get(node.expression.text)
|
|
1797
|
+
: ts.isPropertyAccessExpression(node.expression) &&
|
|
1798
|
+
ts.isIdentifier(node.expression.expression)
|
|
1799
|
+
? resolveExportEntry(
|
|
1800
|
+
facts.exportEntries.get(node.expression.name.text),
|
|
1801
|
+
node.expression.name.text,
|
|
1802
|
+
namespaces.get(node.expression.expression.text),
|
|
1803
|
+
file,
|
|
1804
|
+
packageDirectory,
|
|
1805
|
+
aliasSource(namespaces.get(node.expression.expression.text)),
|
|
1806
|
+
)
|
|
1807
|
+
: undefined;
|
|
1808
|
+
if (entry)
|
|
1809
|
+
inspectCssValues(
|
|
1810
|
+
file,
|
|
1811
|
+
source,
|
|
1812
|
+
entry,
|
|
1813
|
+
(path) => callCssValues(node, path),
|
|
1814
|
+
helperImports,
|
|
1815
|
+
namespaces,
|
|
1816
|
+
diagnostics,
|
|
1817
|
+
);
|
|
1818
|
+
}
|
|
1819
|
+
if (
|
|
1820
|
+
ts.isBinaryExpression(node) &&
|
|
1821
|
+
[ts.SyntaxKind.EqualsToken, ts.SyntaxKind.PlusEqualsToken].includes(
|
|
1822
|
+
node.operatorToken.kind,
|
|
1823
|
+
) &&
|
|
1824
|
+
ts.isPropertyAccessExpression(node.left) &&
|
|
1825
|
+
node.left.name.text === 'className'
|
|
1826
|
+
)
|
|
1827
|
+
borrowedValues(
|
|
1828
|
+
literalClassValues(node.right),
|
|
1829
|
+
node.right,
|
|
1830
|
+
'className assignment',
|
|
1831
|
+
);
|
|
1832
|
+
if (ts.isStringLiteralLike(node) && node.text.includes('<'))
|
|
1833
|
+
borrowedValues(rawHtmlClasses(node.text), node, 'raw HTML');
|
|
1834
|
+
if (ts.isTemplateExpression(node)) {
|
|
1835
|
+
const staticHtml = [
|
|
1836
|
+
node.head.text,
|
|
1837
|
+
...node.templateSpans.map((span) => span.literal.text),
|
|
1838
|
+
].join(templateGap);
|
|
1839
|
+
if (staticHtml.includes('<'))
|
|
1840
|
+
borrowedValues(rawHtmlClasses(staticHtml), node, 'raw HTML');
|
|
1841
|
+
}
|
|
1842
|
+
ts.forEachChild(node, visit);
|
|
1843
|
+
};
|
|
1844
|
+
visit(source);
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
export async function analyzeUiProject({
|
|
1848
|
+
root: requestedRoot = process.cwd(),
|
|
1849
|
+
paths,
|
|
1850
|
+
knownRules = [],
|
|
1851
|
+
adoption = false,
|
|
1852
|
+
ownership = 'package',
|
|
1853
|
+
ownershipContext = 'subject',
|
|
1854
|
+
implicitComponentOwnership = false,
|
|
1855
|
+
ownershipGroups = [],
|
|
1856
|
+
profile: packageProfile = resolve(
|
|
1857
|
+
import.meta.dirname,
|
|
1858
|
+
'../ai/application-ui-profile.defaults.json',
|
|
1859
|
+
),
|
|
1860
|
+
} = {}) {
|
|
1861
|
+
const root = resolve(requestedRoot);
|
|
1862
|
+
const files = await collectFiles(root, paths);
|
|
1863
|
+
const diagnosticDecisions = new Map();
|
|
1864
|
+
const contents = new Map(
|
|
1865
|
+
await Promise.all(
|
|
1866
|
+
files.map(async (file) => [file, await readFile(file, 'utf8')]),
|
|
1867
|
+
),
|
|
1868
|
+
);
|
|
1869
|
+
const discoveredFiles = new Set(files);
|
|
1870
|
+
for (let index = 0; index < files.length; index += 1) {
|
|
1871
|
+
const file = files[index];
|
|
1872
|
+
for (const dependency of relativeStyleImports(file, contents.get(file))) {
|
|
1873
|
+
const projectPath = relative(root, dependency);
|
|
1874
|
+
if (
|
|
1875
|
+
discoveredFiles.has(dependency) ||
|
|
1876
|
+
projectPath === '..' ||
|
|
1877
|
+
projectPath.startsWith('../')
|
|
1878
|
+
)
|
|
1879
|
+
continue;
|
|
1880
|
+
try {
|
|
1881
|
+
const source = await readFile(dependency, 'utf8');
|
|
1882
|
+
discoveredFiles.add(dependency);
|
|
1883
|
+
files.push(dependency);
|
|
1884
|
+
contents.set(dependency, source);
|
|
1885
|
+
} catch {
|
|
1886
|
+
// TypeScript or the CSS toolchain reports missing imports; analysis stays read-only.
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
files.sort();
|
|
1891
|
+
const imports = new Map(
|
|
1892
|
+
files.map((file) => [file, relativeStyleImports(file, contents.get(file))]),
|
|
1893
|
+
);
|
|
1894
|
+
const implicitEntries =
|
|
1895
|
+
ownership === 'component' && implicitComponentOwnership
|
|
1896
|
+
? await implicitOwnershipEntries(files, imports, root)
|
|
1897
|
+
: [];
|
|
1898
|
+
const groupEntries =
|
|
1899
|
+
ownership === 'component'
|
|
1900
|
+
? await ownershipGroupEntries(ownershipGroups, root, contents)
|
|
1901
|
+
: [];
|
|
1902
|
+
const groupStyles = new Set(
|
|
1903
|
+
groupEntries.flatMap((entry) =>
|
|
1904
|
+
entry.styleSources.map((style) => resolve(entry.catalogDirectory, style)),
|
|
1905
|
+
),
|
|
1906
|
+
);
|
|
1907
|
+
const profileContexts = new Map();
|
|
1908
|
+
const loadContext = async (file) => {
|
|
1909
|
+
const startDirectory = file === root ? root : dirname(file);
|
|
1910
|
+
if (!profileContexts.has(startDirectory))
|
|
1911
|
+
profileContexts.set(
|
|
1912
|
+
startDirectory,
|
|
1913
|
+
(async () => {
|
|
1914
|
+
const profileResult = await loadApplicationUiProfile({
|
|
1915
|
+
workspaceRoot: root,
|
|
1916
|
+
startDirectory,
|
|
1917
|
+
packageProfile,
|
|
1918
|
+
knownRules: [...Object.keys(UI_ANALYSIS_RULES), ...knownRules],
|
|
1919
|
+
});
|
|
1920
|
+
const entries = await loadCatalogs(profileResult, ownership);
|
|
1921
|
+
const catalogedSources = new Set(
|
|
1922
|
+
entries
|
|
1923
|
+
.filter((entry) => entry.componentSource)
|
|
1924
|
+
.map((entry) =>
|
|
1925
|
+
resolve(entry.catalogDirectory, entry.componentSource),
|
|
1926
|
+
),
|
|
1927
|
+
);
|
|
1928
|
+
const ownershipEntries = [
|
|
1929
|
+
...entries,
|
|
1930
|
+
...groupEntries,
|
|
1931
|
+
...implicitEntries.flatMap((entry) => {
|
|
1932
|
+
const source = resolve(
|
|
1933
|
+
entry.catalogDirectory,
|
|
1934
|
+
entry.componentSource,
|
|
1935
|
+
);
|
|
1936
|
+
if (catalogedSources.has(source)) return [];
|
|
1937
|
+
if (
|
|
1938
|
+
groupEntries.some((group) => {
|
|
1939
|
+
const relativeSource = relative(
|
|
1940
|
+
group.catalogDirectory,
|
|
1941
|
+
source,
|
|
1942
|
+
).replaceAll('\\', '/');
|
|
1943
|
+
return group.ownershipGroupSources.some((path) =>
|
|
1944
|
+
path.endsWith('/')
|
|
1945
|
+
? relativeSource.startsWith(path)
|
|
1946
|
+
: relativeSource === path,
|
|
1947
|
+
);
|
|
1948
|
+
})
|
|
1949
|
+
)
|
|
1950
|
+
return [];
|
|
1951
|
+
const styleSources = entry.styleSources.filter(
|
|
1952
|
+
(style) =>
|
|
1953
|
+
!groupStyles.has(resolve(entry.catalogDirectory, style)),
|
|
1954
|
+
);
|
|
1955
|
+
return styleSources.length ? [{ ...entry, styleSources }] : [];
|
|
1956
|
+
}),
|
|
1957
|
+
];
|
|
1958
|
+
return {
|
|
1959
|
+
profileResult,
|
|
1960
|
+
facts: catalogFacts(
|
|
1961
|
+
ownership === 'component'
|
|
1962
|
+
? inferOwnedClasses(ownershipEntries, contents, imports)
|
|
1963
|
+
: entries,
|
|
1964
|
+
),
|
|
1965
|
+
startDirectory,
|
|
1966
|
+
};
|
|
1967
|
+
})(),
|
|
1968
|
+
);
|
|
1969
|
+
return profileContexts.get(startDirectory);
|
|
1970
|
+
};
|
|
1971
|
+
const contexts = new Map(
|
|
1972
|
+
await Promise.all(
|
|
1973
|
+
files.map(async (file) => [file, await loadContext(file)]),
|
|
1974
|
+
),
|
|
1975
|
+
);
|
|
1976
|
+
if (!files.length) await loadContext(root);
|
|
1977
|
+
// A stylesheet or source file belongs to the package whose manifest is
|
|
1978
|
+
// nearest it; entries of every other catalog package are foreign to it.
|
|
1979
|
+
const packages = new Map();
|
|
1980
|
+
const compilerOptions = new Map();
|
|
1981
|
+
const packageOf = async (directory) => {
|
|
1982
|
+
if (!packages.has(directory))
|
|
1983
|
+
packages.set(
|
|
1984
|
+
directory,
|
|
1985
|
+
(async () => {
|
|
1986
|
+
try {
|
|
1987
|
+
const manifest = JSON.parse(
|
|
1988
|
+
await readFile(resolve(directory, 'package.json'), 'utf8'),
|
|
1989
|
+
);
|
|
1990
|
+
if (typeof manifest.name === 'string')
|
|
1991
|
+
return { name: manifest.name, directory };
|
|
1992
|
+
} catch {
|
|
1993
|
+
// No readable manifest here; keep walking up.
|
|
1994
|
+
}
|
|
1995
|
+
const parent = dirname(directory);
|
|
1996
|
+
const inside = relative(root, parent);
|
|
1997
|
+
if (
|
|
1998
|
+
parent === directory ||
|
|
1999
|
+
inside === '..' ||
|
|
2000
|
+
inside.startsWith('../')
|
|
2001
|
+
)
|
|
2002
|
+
return undefined;
|
|
2003
|
+
return packageOf(parent);
|
|
2004
|
+
})(),
|
|
2005
|
+
);
|
|
2006
|
+
return packages.get(directory);
|
|
2007
|
+
};
|
|
2008
|
+
const styledBlocksByFile = new Map();
|
|
2009
|
+
const styledBlocksIn = (style) => {
|
|
2010
|
+
if (!styledBlocksByFile.has(style)) {
|
|
2011
|
+
const blocks = new Set();
|
|
2012
|
+
const css = contents.get(style);
|
|
2013
|
+
if (css)
|
|
2014
|
+
try {
|
|
2015
|
+
postcss.parse(css, { from: style }).walkRules((rule) => {
|
|
2016
|
+
for (const name of subjectClasses(rule.selector))
|
|
2017
|
+
blocks.add(bemBlock(name));
|
|
2018
|
+
});
|
|
2019
|
+
} catch {
|
|
2020
|
+
// Malformed CSS is reported by the normal inspection pass.
|
|
2021
|
+
}
|
|
2022
|
+
styledBlocksByFile.set(style, blocks);
|
|
2023
|
+
}
|
|
2024
|
+
return styledBlocksByFile.get(style);
|
|
2025
|
+
};
|
|
2026
|
+
const foreignTo = async (file, facts) => {
|
|
2027
|
+
const own = await packageOf(dirname(file));
|
|
2028
|
+
const source = own && relative(own.directory, file).replaceAll('\\', '/');
|
|
2029
|
+
const ownedStyles = new Set(imports.get(file) ?? []);
|
|
2030
|
+
if (ownership === 'component' && !file.endsWith('.css'))
|
|
2031
|
+
for (const entry of facts.entries) {
|
|
2032
|
+
if (
|
|
2033
|
+
entry.package !== own?.name ||
|
|
2034
|
+
!entry.componentSource ||
|
|
2035
|
+
!entry.catalogDirectory ||
|
|
2036
|
+
resolve(entry.catalogDirectory, entry.componentSource) !== file
|
|
2037
|
+
)
|
|
2038
|
+
continue;
|
|
2039
|
+
for (const style of entry.styleSources ?? [])
|
|
2040
|
+
ownedStyles.add(resolve(entry.catalogDirectory, style));
|
|
2041
|
+
}
|
|
2042
|
+
return (entry, className) => {
|
|
2043
|
+
if (entry.package !== own?.name) return true;
|
|
2044
|
+
if (ownership !== 'component') return false;
|
|
2045
|
+
if (entry.ownershipGroupSources) {
|
|
2046
|
+
const relativeFile = relative(entry.catalogDirectory, file).replaceAll(
|
|
2047
|
+
'\\',
|
|
2048
|
+
'/',
|
|
2049
|
+
);
|
|
2050
|
+
if (file.endsWith('.css'))
|
|
2051
|
+
return !entry.styleSources?.includes(relativeFile);
|
|
2052
|
+
return !entry.ownershipGroupSources.some((path) =>
|
|
2053
|
+
path.endsWith('/')
|
|
2054
|
+
? relativeFile.startsWith(path)
|
|
2055
|
+
: relativeFile === path,
|
|
2056
|
+
);
|
|
2057
|
+
}
|
|
2058
|
+
if (
|
|
2059
|
+
!file.endsWith('.css') &&
|
|
2060
|
+
className &&
|
|
2061
|
+
entry.catalogDirectory &&
|
|
2062
|
+
entry.styleSources?.some((style) => {
|
|
2063
|
+
const path = resolve(entry.catalogDirectory, style);
|
|
2064
|
+
return (
|
|
2065
|
+
ownedStyles.has(path) &&
|
|
2066
|
+
styledBlocksIn(path).has(bemBlock(className))
|
|
2067
|
+
);
|
|
2068
|
+
})
|
|
2069
|
+
)
|
|
2070
|
+
return false;
|
|
2071
|
+
const ownedSources = file.endsWith('.css')
|
|
2072
|
+
? entry.styleSources
|
|
2073
|
+
: [entry.componentSource];
|
|
2074
|
+
return !ownedSources?.includes(source);
|
|
2075
|
+
};
|
|
2076
|
+
};
|
|
2077
|
+
const styleFacts = new Map();
|
|
2078
|
+
const recordDiagnostics = (items, context) => {
|
|
2079
|
+
for (const item of items) {
|
|
2080
|
+
const key = JSON.stringify([
|
|
2081
|
+
item.ruleId,
|
|
2082
|
+
item.location,
|
|
2083
|
+
item.message,
|
|
2084
|
+
item.evidence,
|
|
2085
|
+
item.chain,
|
|
2086
|
+
]);
|
|
2087
|
+
const decision = diagnosticDecisions.get(key) ?? {
|
|
2088
|
+
item,
|
|
2089
|
+
active: false,
|
|
2090
|
+
suppressed: false,
|
|
2091
|
+
activeConsumers: new Set(),
|
|
2092
|
+
suppressedConsumers: new Set(),
|
|
2093
|
+
};
|
|
2094
|
+
const consumer =
|
|
2095
|
+
relative(root, context.startDirectory).replaceAll('\\', '/') || '.';
|
|
2096
|
+
if (isSuppressed(item, context.profileResult.profile, root)) {
|
|
2097
|
+
decision.suppressed = true;
|
|
2098
|
+
decision.suppressedConsumers.add(consumer);
|
|
2099
|
+
} else {
|
|
2100
|
+
decision.active = true;
|
|
2101
|
+
decision.activeConsumers.add(consumer);
|
|
2102
|
+
}
|
|
2103
|
+
diagnosticDecisions.set(key, decision);
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
for (const file of files.filter((item) => item.endsWith('.css'))) {
|
|
2107
|
+
const context = contexts.get(file);
|
|
2108
|
+
const fileFacts = new Map();
|
|
2109
|
+
await inspectCss(
|
|
2110
|
+
file,
|
|
2111
|
+
contents.get(file),
|
|
2112
|
+
context.facts,
|
|
2113
|
+
[],
|
|
2114
|
+
fileFacts,
|
|
2115
|
+
adoption,
|
|
2116
|
+
);
|
|
2117
|
+
styleFacts.set(file, fileFacts);
|
|
2118
|
+
}
|
|
2119
|
+
const styleConsumers = new Map(
|
|
2120
|
+
[...styleFacts.keys()].map((file) => [file, new Set()]),
|
|
2121
|
+
);
|
|
2122
|
+
// KUI-L018 accepts an on-loud from another stylesheet the same entry loads:
|
|
2123
|
+
// every stylesheet reachable from one file (a source module's CSS imports,
|
|
2124
|
+
// or a stylesheet with its @imports) is loaded together.
|
|
2125
|
+
const onLoudByStyle = new Map();
|
|
2126
|
+
for (const style of styleFacts.keys()) {
|
|
2127
|
+
let parsed;
|
|
2128
|
+
try {
|
|
2129
|
+
parsed = postcss.parse(contents.get(style), { from: style });
|
|
2130
|
+
} catch {
|
|
2131
|
+
continue;
|
|
2132
|
+
}
|
|
2133
|
+
onLoudByStyle.set(
|
|
2134
|
+
style,
|
|
2135
|
+
collectLoudDeclarations(style, parsed).filter(
|
|
2136
|
+
({ kind }) => kind === 'on-loud',
|
|
2137
|
+
),
|
|
2138
|
+
);
|
|
2139
|
+
}
|
|
2140
|
+
const coLoadedStyles = new Map(
|
|
2141
|
+
[...styleFacts.keys()].map((style) => [style, new Set()]),
|
|
2142
|
+
);
|
|
2143
|
+
for (const file of files) {
|
|
2144
|
+
const loaded = new Set(reachableStyleFiles(file, imports, styleFacts));
|
|
2145
|
+
if (styleFacts.has(file)) loaded.add(file);
|
|
2146
|
+
for (const style of loaded)
|
|
2147
|
+
for (const sibling of loaded)
|
|
2148
|
+
if (sibling !== style) coLoadedStyles.get(style).add(sibling);
|
|
2149
|
+
}
|
|
2150
|
+
const siblingOnLoud = (style) =>
|
|
2151
|
+
[...coLoadedStyles.get(style)]
|
|
2152
|
+
.sort()
|
|
2153
|
+
.flatMap((sibling) => onLoudByStyle.get(sibling) ?? []);
|
|
2154
|
+
for (const file of files.filter((item) =>
|
|
2155
|
+
sourceExtensions.has(extname(item)),
|
|
2156
|
+
)) {
|
|
2157
|
+
const context = contexts.get(file);
|
|
2158
|
+
const own = await packageOf(dirname(file));
|
|
2159
|
+
for (const style of reachableStyleFiles(file, imports, styleFacts))
|
|
2160
|
+
styleConsumers.get(style).add(context);
|
|
2161
|
+
const fileDiagnostics = [];
|
|
2162
|
+
inspectTsx(
|
|
2163
|
+
file,
|
|
2164
|
+
contents.get(file),
|
|
2165
|
+
context.facts,
|
|
2166
|
+
reachableStyleFacts(file, imports, styleFacts),
|
|
2167
|
+
fileDiagnostics,
|
|
2168
|
+
adoption,
|
|
2169
|
+
await foreignTo(file, context.facts),
|
|
2170
|
+
own?.directory,
|
|
2171
|
+
compilerOptionsFor(file, root, compilerOptions),
|
|
2172
|
+
ownership === 'component',
|
|
2173
|
+
);
|
|
2174
|
+
recordDiagnostics(fileDiagnostics, context);
|
|
2175
|
+
}
|
|
2176
|
+
for (const [file, consumers] of styleConsumers) {
|
|
2177
|
+
const applicableContexts = consumers.size
|
|
2178
|
+
? consumers
|
|
2179
|
+
: new Set([contexts.get(file)]);
|
|
2180
|
+
for (const context of applicableContexts) {
|
|
2181
|
+
const fileDiagnostics = [];
|
|
2182
|
+
const own = await packageOf(dirname(file));
|
|
2183
|
+
await inspectCss(
|
|
2184
|
+
file,
|
|
2185
|
+
contents.get(file),
|
|
2186
|
+
context.facts,
|
|
2187
|
+
fileDiagnostics,
|
|
2188
|
+
new Map(),
|
|
2189
|
+
adoption,
|
|
2190
|
+
siblingOnLoud(file),
|
|
2191
|
+
await foreignTo(file, context.facts),
|
|
2192
|
+
ownership === 'component'
|
|
2193
|
+
? {
|
|
2194
|
+
...jsxOwnershipEvidence(
|
|
2195
|
+
file,
|
|
2196
|
+
context.facts,
|
|
2197
|
+
contents,
|
|
2198
|
+
root,
|
|
2199
|
+
compilerOptions,
|
|
2200
|
+
),
|
|
2201
|
+
ownPackage: own?.name,
|
|
2202
|
+
}
|
|
2203
|
+
: undefined,
|
|
2204
|
+
ownershipContext,
|
|
2205
|
+
);
|
|
2206
|
+
recordDiagnostics(fileDiagnostics, context);
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
const active = [...diagnosticDecisions.values()]
|
|
2211
|
+
.filter((decision) => decision.active)
|
|
2212
|
+
.map((decision) => {
|
|
2213
|
+
if (
|
|
2214
|
+
!decision.suppressedConsumers.size &&
|
|
2215
|
+
decision.activeConsumers.size <= 1
|
|
2216
|
+
)
|
|
2217
|
+
return decision.item;
|
|
2218
|
+
return {
|
|
2219
|
+
...decision.item,
|
|
2220
|
+
evidence: {
|
|
2221
|
+
...decision.item.evidence,
|
|
2222
|
+
consumers: {
|
|
2223
|
+
active: [...decision.activeConsumers].sort(),
|
|
2224
|
+
suppressed: [...decision.suppressedConsumers].sort(),
|
|
2225
|
+
},
|
|
2226
|
+
},
|
|
2227
|
+
};
|
|
2228
|
+
});
|
|
2229
|
+
const suppressed = [...diagnosticDecisions.values()].filter(
|
|
2230
|
+
(decision) => !decision.active && decision.suppressed,
|
|
2231
|
+
).length;
|
|
2232
|
+
active.sort(
|
|
2233
|
+
(a, b) =>
|
|
2234
|
+
a.location.file.localeCompare(b.location.file) ||
|
|
2235
|
+
a.location.line - b.location.line ||
|
|
2236
|
+
a.ruleId.localeCompare(b.ruleId),
|
|
2237
|
+
);
|
|
2238
|
+
const portablePath = (file) => {
|
|
2239
|
+
if (!file || !isAbsolute(file)) return file;
|
|
2240
|
+
const path = relative(root, file).replaceAll('\\', '/');
|
|
2241
|
+
return path === '..' || path.startsWith('../')
|
|
2242
|
+
? `<external>/${basename(file)}`
|
|
2243
|
+
: path;
|
|
2244
|
+
};
|
|
2245
|
+
const resolvedContexts = await Promise.all(profileContexts.values());
|
|
2246
|
+
const profileFiles = [
|
|
2247
|
+
...new Set(
|
|
2248
|
+
resolvedContexts.flatMap(
|
|
2249
|
+
({ profileResult }) => profileResult.files ?? [],
|
|
2250
|
+
),
|
|
2251
|
+
),
|
|
2252
|
+
];
|
|
2253
|
+
const profilePackageRoot = dirname(profileFiles[0] ?? root);
|
|
2254
|
+
const portableMessage = (message) =>
|
|
2255
|
+
String(message)
|
|
2256
|
+
.replaceAll(root, '<repo-root>')
|
|
2257
|
+
.replaceAll(profilePackageRoot, '<package-root>');
|
|
2258
|
+
const profileDiagnostics = [
|
|
2259
|
+
...new Map(
|
|
2260
|
+
resolvedContexts
|
|
2261
|
+
.flatMap(({ profileResult }) => profileResult.diagnostics ?? [])
|
|
2262
|
+
.map((item) => [
|
|
2263
|
+
JSON.stringify([item.code, item.source, item.path, item.message]),
|
|
2264
|
+
{
|
|
2265
|
+
...item,
|
|
2266
|
+
source: portablePath(item.source),
|
|
2267
|
+
message: portableMessage(item.message),
|
|
2268
|
+
},
|
|
2269
|
+
]),
|
|
2270
|
+
).values(),
|
|
2271
|
+
];
|
|
2272
|
+
return {
|
|
2273
|
+
schemaVersion: UI_ANALYSIS_SCHEMA_VERSION,
|
|
2274
|
+
tool: { name: '@kerfjs/ui analyzer', version: 1 },
|
|
2275
|
+
root: '.',
|
|
2276
|
+
files: files.map((file) => relative(root, file).replaceAll('\\', '/')),
|
|
2277
|
+
profile: {
|
|
2278
|
+
files: profileFiles.map(portablePath),
|
|
2279
|
+
diagnostics: profileDiagnostics,
|
|
2280
|
+
},
|
|
2281
|
+
diagnostics: active.map((item) => ({
|
|
2282
|
+
...item,
|
|
2283
|
+
location: {
|
|
2284
|
+
...item.location,
|
|
2285
|
+
file: portablePath(item.location.file),
|
|
2286
|
+
},
|
|
2287
|
+
...(item.evidence?.stylesheet
|
|
2288
|
+
? {
|
|
2289
|
+
evidence: {
|
|
2290
|
+
...item.evidence,
|
|
2291
|
+
stylesheet: portablePath(item.evidence.stylesheet),
|
|
2292
|
+
},
|
|
2293
|
+
}
|
|
2294
|
+
: {}),
|
|
2295
|
+
})),
|
|
2296
|
+
summary: {
|
|
2297
|
+
errors:
|
|
2298
|
+
active.filter((item) => item.severity === 'error').length +
|
|
2299
|
+
profileDiagnostics.length,
|
|
2300
|
+
review: active.filter((item) => item.severity === 'review').length,
|
|
2301
|
+
suppressed,
|
|
2302
|
+
},
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
export function formatUiAnalysisText(report) {
|
|
2307
|
+
const lines = report.profile.diagnostics.map(
|
|
2308
|
+
(item) =>
|
|
2309
|
+
`${item.source ?? '<profile>'}:1:1 error ${item.code} ${item.message}`,
|
|
2310
|
+
);
|
|
2311
|
+
lines.push(
|
|
2312
|
+
...report.diagnostics.map(
|
|
2313
|
+
(item) =>
|
|
2314
|
+
`${item.location.file}:${item.location.line}:${item.location.column} ${item.severity} ${item.ruleId} ${item.message}`,
|
|
2315
|
+
),
|
|
2316
|
+
);
|
|
2317
|
+
lines.push(
|
|
2318
|
+
`Kerf UI analysis: ${report.summary.errors} error(s), ${report.summary.review} review finding(s), ${report.summary.suppressed} suppressed.`,
|
|
2319
|
+
);
|
|
2320
|
+
return lines.join('\n');
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
export function formatUiAnalysisSarif(report) {
|
|
2324
|
+
return {
|
|
2325
|
+
version: '2.1.0',
|
|
2326
|
+
$schema: 'https://json.schemastore.org/sarif-2.1.0.json',
|
|
2327
|
+
runs: [
|
|
2328
|
+
{
|
|
2329
|
+
tool: {
|
|
2330
|
+
driver: {
|
|
2331
|
+
name: report.tool.name,
|
|
2332
|
+
version: String(report.tool.version),
|
|
2333
|
+
rules: Object.entries(UI_ANALYSIS_RULES).map(([id, rule]) => ({
|
|
2334
|
+
id,
|
|
2335
|
+
shortDescription: { text: rule.title },
|
|
2336
|
+
})),
|
|
2337
|
+
},
|
|
2338
|
+
},
|
|
2339
|
+
results: [
|
|
2340
|
+
...report.profile.diagnostics.map((item) => ({
|
|
2341
|
+
ruleId: item.code,
|
|
2342
|
+
level: 'error',
|
|
2343
|
+
message: { text: item.message },
|
|
2344
|
+
locations: [
|
|
2345
|
+
{
|
|
2346
|
+
physicalLocation: {
|
|
2347
|
+
artifactLocation: { uri: item.source ?? '<profile>' },
|
|
2348
|
+
region: { startLine: 1, startColumn: 1 },
|
|
2349
|
+
},
|
|
2350
|
+
},
|
|
2351
|
+
],
|
|
2352
|
+
properties: { path: item.path },
|
|
2353
|
+
})),
|
|
2354
|
+
...report.diagnostics.map((item) => ({
|
|
2355
|
+
ruleId: item.ruleId,
|
|
2356
|
+
level: item.severity === 'error' ? 'error' : 'warning',
|
|
2357
|
+
message: { text: item.message },
|
|
2358
|
+
locations: [
|
|
2359
|
+
{
|
|
2360
|
+
physicalLocation: {
|
|
2361
|
+
artifactLocation: { uri: item.location.file },
|
|
2362
|
+
region: {
|
|
2363
|
+
startLine: item.location.line,
|
|
2364
|
+
startColumn: item.location.column,
|
|
2365
|
+
},
|
|
2366
|
+
},
|
|
2367
|
+
},
|
|
2368
|
+
],
|
|
2369
|
+
properties: { evidence: item.evidence, chain: item.chain },
|
|
2370
|
+
})),
|
|
2371
|
+
],
|
|
2372
|
+
},
|
|
2373
|
+
],
|
|
2374
|
+
};
|
|
2375
|
+
}
|