@adia-ai/web-components 0.0.1
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 +195 -0
- package/a2ui/dockables/action.js +152 -0
- package/a2ui/dockables/base.js +30 -0
- package/a2ui/dockables/controller.js +97 -0
- package/a2ui/dockables/data-source.js +103 -0
- package/a2ui/dockables/index.js +6 -0
- package/a2ui/dockables/lifecycle.js +84 -0
- package/a2ui/dockables/provider.js +59 -0
- package/a2ui/index.js +19 -0
- package/a2ui/manifest-runtime.js +226 -0
- package/a2ui/registry.js +200 -0
- package/a2ui/renderer.js +361 -0
- package/a2ui/root.js +152 -0
- package/a2ui/stream.js +243 -0
- package/a2ui/surface-manifest.js +294 -0
- package/a2ui/surface.js +222 -0
- package/a2ui/wire-factory.js +134 -0
- package/a2ui/wiring-engine.js +209 -0
- package/a2ui/wiring-registry.js +342 -0
- package/components/accordion/accordion.a2ui.json +129 -0
- package/components/accordion/accordion.css +133 -0
- package/components/accordion/accordion.js +125 -0
- package/components/accordion/accordion.yaml +527 -0
- package/components/action-list/action-list.a2ui.json +64 -0
- package/components/action-list/action-list.css +115 -0
- package/components/action-list/action-list.js +149 -0
- package/components/action-list/action-list.yaml +56 -0
- package/components/agent-artifact/agent-artifact.a2ui.json +99 -0
- package/components/agent-artifact/agent-artifact.css +94 -0
- package/components/agent-artifact/agent-artifact.js +169 -0
- package/components/agent-artifact/agent-artifact.yaml +71 -0
- package/components/agent-feedback-bar/agent-feedback-bar.a2ui.json +91 -0
- package/components/agent-feedback-bar/agent-feedback-bar.css +33 -0
- package/components/agent-feedback-bar/agent-feedback-bar.js +152 -0
- package/components/agent-feedback-bar/agent-feedback-bar.yaml +65 -0
- package/components/agent-questions/agent-questions.a2ui.json +89 -0
- package/components/agent-questions/agent-questions.css +146 -0
- package/components/agent-questions/agent-questions.js +189 -0
- package/components/agent-questions/agent-questions.yaml +63 -0
- package/components/agent-reasoning/agent-reasoning.a2ui.json +100 -0
- package/components/agent-reasoning/agent-reasoning.css +273 -0
- package/components/agent-reasoning/agent-reasoning.js +469 -0
- package/components/agent-reasoning/agent-reasoning.yaml +70 -0
- package/components/agent-suggestions/agent-suggestions.a2ui.json +87 -0
- package/components/agent-suggestions/agent-suggestions.css +18 -0
- package/components/agent-suggestions/agent-suggestions.js +87 -0
- package/components/agent-suggestions/agent-suggestions.yaml +59 -0
- package/components/agent-trace/agent-trace.a2ui.json +78 -0
- package/components/agent-trace/agent-trace.css +275 -0
- package/components/agent-trace/agent-trace.js +216 -0
- package/components/agent-trace/agent-trace.yaml +53 -0
- package/components/alert/alert.a2ui.json +211 -0
- package/components/alert/alert.css +88 -0
- package/components/alert/alert.js +96 -0
- package/components/alert/alert.yaml +205 -0
- package/components/avatar/avatar.a2ui.json +215 -0
- package/components/avatar/avatar.css +159 -0
- package/components/avatar/avatar.js +157 -0
- package/components/avatar/avatar.yaml +559 -0
- package/components/badge/badge.a2ui.json +169 -0
- package/components/badge/badge.css +78 -0
- package/components/badge/badge.js +53 -0
- package/components/badge/badge.yaml +612 -0
- package/components/block/block.a2ui.json +135 -0
- package/components/block/block.css +29 -0
- package/components/block/block.js +23 -0
- package/components/block/block.yaml +115 -0
- package/components/breadcrumb/breadcrumb.a2ui.json +86 -0
- package/components/breadcrumb/breadcrumb.css +78 -0
- package/components/breadcrumb/breadcrumb.js +44 -0
- package/components/breadcrumb/breadcrumb.yaml +84 -0
- package/components/button/button.a2ui.json +172 -0
- package/components/button/button.css +168 -0
- package/components/button/button.js +60 -0
- package/components/button/button.yaml +120 -0
- package/components/calendar-picker/calendar-picker.a2ui.json +139 -0
- package/components/calendar-picker/calendar-picker.css +321 -0
- package/components/calendar-picker/calendar-picker.js +324 -0
- package/components/calendar-picker/calendar-picker.yaml +243 -0
- package/components/canvas/canvas.a2ui.json +75 -0
- package/components/canvas/canvas.css +52 -0
- package/components/canvas/canvas.js +179 -0
- package/components/canvas/canvas.yaml +62 -0
- package/components/card/card.a2ui.json +276 -0
- package/components/card/card.css +362 -0
- package/components/card/card.js +58 -0
- package/components/card/card.yaml +527 -0
- package/components/chart/chart.a2ui.json +298 -0
- package/components/chart/chart.css +512 -0
- package/components/chart/chart.js +1075 -0
- package/components/chart/chart.yaml +540 -0
- package/components/chat/chat-input.css +141 -0
- package/components/chat/chat-input.js +242 -0
- package/components/chat/chat.a2ui.json +181 -0
- package/components/chat/chat.css +193 -0
- package/components/chat/chat.js +155 -0
- package/components/chat/chat.yaml +230 -0
- package/components/check/check.a2ui.json +134 -0
- package/components/check/check.css +126 -0
- package/components/check/check.js +58 -0
- package/components/check/check.yaml +109 -0
- package/components/code/code.a2ui.json +153 -0
- package/components/code/code.css +133 -0
- package/components/code/code.js +114 -0
- package/components/code/code.yaml +163 -0
- package/components/col/col.a2ui.json +104 -0
- package/components/col/col.css +36 -0
- package/components/col/col.js +19 -0
- package/components/col/col.yaml +364 -0
- package/components/color-picker/color-picker.a2ui.json +100 -0
- package/components/color-picker/color-picker.css +182 -0
- package/components/color-picker/color-picker.js +537 -0
- package/components/color-picker/color-picker.yaml +105 -0
- package/components/command/command.a2ui.json +221 -0
- package/components/command/command.css +251 -0
- package/components/command/command.js +284 -0
- package/components/command/command.yaml +186 -0
- package/components/description-list/description-list.a2ui.json +89 -0
- package/components/description-list/description-list.css +70 -0
- package/components/description-list/description-list.js +75 -0
- package/components/description-list/description-list.yaml +59 -0
- package/components/divider/divider.a2ui.json +126 -0
- package/components/divider/divider.css +102 -0
- package/components/divider/divider.js +47 -0
- package/components/divider/divider.yaml +366 -0
- package/components/drawer/drawer.a2ui.json +199 -0
- package/components/drawer/drawer.css +342 -0
- package/components/drawer/drawer.js +263 -0
- package/components/drawer/drawer.yaml +366 -0
- package/components/embed/embed.a2ui.json +150 -0
- package/components/embed/embed.css +28 -0
- package/components/embed/embed.js +63 -0
- package/components/embed/embed.yaml +224 -0
- package/components/empty-state/empty-state.a2ui.json +133 -0
- package/components/empty-state/empty-state.css +58 -0
- package/components/empty-state/empty-state.js +87 -0
- package/components/empty-state/empty-state.yaml +314 -0
- package/components/footer/footer.a2ui.json +79 -0
- package/components/footer/footer.yaml +239 -0
- package/components/grid/grid.a2ui.json +171 -0
- package/components/grid/grid.css +37 -0
- package/components/grid/grid.js +21 -0
- package/components/grid/grid.yaml +577 -0
- package/components/header/header.a2ui.json +76 -0
- package/components/header/header.yaml +336 -0
- package/components/heatmap/heatmap.a2ui.json +150 -0
- package/components/heatmap/heatmap.css +146 -0
- package/components/heatmap/heatmap.js +246 -0
- package/components/heatmap/heatmap.yaml +131 -0
- package/components/icon/icon.a2ui.json +79 -0
- package/components/icon/icon.css +20 -0
- package/components/icon/icon.js +26 -0
- package/components/icon/icon.yaml +233 -0
- package/components/image/image.a2ui.json +261 -0
- package/components/image/image.css +76 -0
- package/components/image/image.js +102 -0
- package/components/image/image.yaml +477 -0
- package/components/index.js +85 -0
- package/components/input/input.a2ui.json +284 -0
- package/components/input/input.css +162 -0
- package/components/input/input.js +148 -0
- package/components/input/input.yaml +496 -0
- package/components/inspector/inspector.a2ui.json +67 -0
- package/components/inspector/inspector.css +31 -0
- package/components/inspector/inspector.js +133 -0
- package/components/inspector/inspector.yaml +58 -0
- package/components/kbd/kbd.a2ui.json +96 -0
- package/components/kbd/kbd.css +62 -0
- package/components/kbd/kbd.js +24 -0
- package/components/kbd/kbd.yaml +213 -0
- package/components/list/list.a2ui.json +145 -0
- package/components/list/list.css +103 -0
- package/components/list/list.js +236 -0
- package/components/list/list.yaml +122 -0
- package/components/menu/menu.a2ui.json +146 -0
- package/components/menu/menu.css +146 -0
- package/components/menu/menu.js +296 -0
- package/components/menu/menu.yaml +123 -0
- package/components/modal/modal.a2ui.json +136 -0
- package/components/modal/modal.css +153 -0
- package/components/modal/modal.js +181 -0
- package/components/modal/modal.yaml +114 -0
- package/components/noodles/noodles.a2ui.json +145 -0
- package/components/noodles/noodles.css +118 -0
- package/components/noodles/noodles.js +470 -0
- package/components/noodles/noodles.yaml +123 -0
- package/components/otp-input/otp-input.a2ui.json +104 -0
- package/components/otp-input/otp-input.css +78 -0
- package/components/otp-input/otp-input.js +170 -0
- package/components/otp-input/otp-input.yaml +218 -0
- package/components/pagination/pagination.a2ui.json +122 -0
- package/components/pagination/pagination.css +162 -0
- package/components/pagination/pagination.js +185 -0
- package/components/pagination/pagination.yaml +165 -0
- package/components/pane/pane.a2ui.json +94 -0
- package/components/pane/pane.css +166 -0
- package/components/pane/pane.js +140 -0
- package/components/pane/pane.yaml +197 -0
- package/components/pipeline-status/pipeline-status.a2ui.json +90 -0
- package/components/pipeline-status/pipeline-status.css +162 -0
- package/components/pipeline-status/pipeline-status.js +176 -0
- package/components/pipeline-status/pipeline-status.yaml +99 -0
- package/components/popover/popover.a2ui.json +181 -0
- package/components/popover/popover.css +57 -0
- package/components/popover/popover.js +170 -0
- package/components/popover/popover.yaml +257 -0
- package/components/progress/progress.a2ui.json +199 -0
- package/components/progress/progress.css +88 -0
- package/components/progress/progress.js +64 -0
- package/components/progress/progress.yaml +342 -0
- package/components/progress-row/progress-row.a2ui.json +100 -0
- package/components/progress-row/progress-row.css +57 -0
- package/components/progress-row/progress-row.js +92 -0
- package/components/progress-row/progress-row.yaml +87 -0
- package/components/radio/radio.a2ui.json +232 -0
- package/components/radio/radio.css +102 -0
- package/components/radio/radio.js +73 -0
- package/components/radio/radio.yaml +248 -0
- package/components/range/range.a2ui.json +151 -0
- package/components/range/range.css +148 -0
- package/components/range/range.js +177 -0
- package/components/range/range.yaml +188 -0
- package/components/rating/rating.a2ui.json +105 -0
- package/components/rating/rating.css +92 -0
- package/components/rating/rating.js +138 -0
- package/components/rating/rating.yaml +74 -0
- package/components/richtext/richtext.a2ui.json +82 -0
- package/components/richtext/richtext.css +225 -0
- package/components/richtext/richtext.js +74 -0
- package/components/richtext/richtext.yaml +89 -0
- package/components/row/row.a2ui.json +102 -0
- package/components/row/row.css +51 -0
- package/components/row/row.js +39 -0
- package/components/row/row.yaml +358 -0
- package/components/search/search.a2ui.json +186 -0
- package/components/search/search.css +28 -0
- package/components/search/search.js +124 -0
- package/components/search/search.yaml +154 -0
- package/components/section/section.a2ui.json +78 -0
- package/components/section/section.yaml +338 -0
- package/components/segment/segment.a2ui.json +100 -0
- package/components/segment/segment.css +81 -0
- package/components/segment/segment.js +32 -0
- package/components/segment/segment.yaml +216 -0
- package/components/segmented/segmented.a2ui.json +106 -0
- package/components/segmented/segmented.css +67 -0
- package/components/segmented/segmented.js +149 -0
- package/components/segmented/segmented.yaml +91 -0
- package/components/select/select.a2ui.json +203 -0
- package/components/select/select.css +277 -0
- package/components/select/select.js +388 -0
- package/components/select/select.yaml +375 -0
- package/components/skeleton/skeleton.a2ui.json +120 -0
- package/components/skeleton/skeleton.css +47 -0
- package/components/skeleton/skeleton.js +43 -0
- package/components/skeleton/skeleton.yaml +153 -0
- package/components/slider/slider.a2ui.json +162 -0
- package/components/slider/slider.css +137 -0
- package/components/slider/slider.js +162 -0
- package/components/slider/slider.yaml +299 -0
- package/components/stack/stack.a2ui.json +62 -0
- package/components/stack/stack.css +28 -0
- package/components/stack/stack.js +18 -0
- package/components/stack/stack.yaml +54 -0
- package/components/stat/stat.a2ui.json +246 -0
- package/components/stat/stat.css +101 -0
- package/components/stat/stat.js +91 -0
- package/components/stat/stat.yaml +206 -0
- package/components/stepper/stepper.a2ui.json +77 -0
- package/components/stepper/stepper.css +243 -0
- package/components/stepper/stepper.js +118 -0
- package/components/stepper/stepper.yaml +73 -0
- package/components/stream/stream.a2ui.json +98 -0
- package/components/stream/stream.css +37 -0
- package/components/stream/stream.js +99 -0
- package/components/stream/stream.yaml +87 -0
- package/components/swiper/swiper.a2ui.json +140 -0
- package/components/swiper/swiper.css +267 -0
- package/components/swiper/swiper.js +285 -0
- package/components/swiper/swiper.yaml +268 -0
- package/components/switch/switch.a2ui.json +134 -0
- package/components/switch/switch.css +104 -0
- package/components/switch/switch.js +53 -0
- package/components/switch/switch.yaml +322 -0
- package/components/table/cell-types.js +296 -0
- package/components/table/table.a2ui.json +458 -0
- package/components/table/table.css +531 -0
- package/components/table/table.js +1392 -0
- package/components/table/table.yaml +528 -0
- package/components/tabs/tab.js +34 -0
- package/components/tabs/tabs.a2ui.json +174 -0
- package/components/tabs/tabs.css +162 -0
- package/components/tabs/tabs.js +226 -0
- package/components/tabs/tabs.yaml +255 -0
- package/components/tag/tag.a2ui.json +148 -0
- package/components/tag/tag.css +118 -0
- package/components/tag/tag.js +88 -0
- package/components/tag/tag.yaml +125 -0
- package/components/text/text.a2ui.json +99 -0
- package/components/text/text.css +65 -0
- package/components/text/text.js +35 -0
- package/components/text/text.yaml +360 -0
- package/components/textarea/textarea.a2ui.json +91 -0
- package/components/textarea/textarea.css +93 -0
- package/components/textarea/textarea.js +114 -0
- package/components/textarea/textarea.yaml +79 -0
- package/components/timeline/timeline.a2ui.json +82 -0
- package/components/timeline/timeline.css +389 -0
- package/components/timeline/timeline.js +171 -0
- package/components/timeline/timeline.yaml +185 -0
- package/components/toast/toast.a2ui.json +199 -0
- package/components/toast/toast.css +211 -0
- package/components/toast/toast.js +146 -0
- package/components/toast/toast.yaml +184 -0
- package/components/toggle-group/toggle-group.a2ui.json +126 -0
- package/components/toggle-group/toggle-group.css +102 -0
- package/components/toggle-group/toggle-group.js +147 -0
- package/components/toggle-group/toggle-group.yaml +98 -0
- package/components/toolbar/toolbar.a2ui.json +131 -0
- package/components/toolbar/toolbar.css +132 -0
- package/components/toolbar/toolbar.js +366 -0
- package/components/toolbar/toolbar.yaml +238 -0
- package/components/tooltip/tooltip.a2ui.json +148 -0
- package/components/tooltip/tooltip.css +39 -0
- package/components/tooltip/tooltip.js +96 -0
- package/components/tooltip/tooltip.yaml +201 -0
- package/components/tree/tree.a2ui.json +119 -0
- package/components/tree/tree.css +133 -0
- package/components/tree/tree.js +253 -0
- package/components/tree/tree.yaml +92 -0
- package/components/upload/upload.a2ui.json +185 -0
- package/components/upload/upload.css +115 -0
- package/components/upload/upload.js +189 -0
- package/components/upload/upload.yaml +302 -0
- package/core/anchor.js +187 -0
- package/core/controller.js +182 -0
- package/core/element.js +257 -0
- package/core/form.js +217 -0
- package/core/icons.js +180 -0
- package/core/markdown.js +95 -0
- package/core/polyfills.js +23 -0
- package/core/provider.js +262 -0
- package/core/signals.js +113 -0
- package/core/template.js +226 -0
- package/core/transport.js +77 -0
- package/package.json +38 -0
- package/patterns/adia-chat/adia-chat.a2ui.json +149 -0
- package/patterns/adia-chat/adia-chat.css +10 -0
- package/patterns/adia-chat/adia-chat.js +297 -0
- package/patterns/adia-chat/adia-chat.yaml +118 -0
- package/patterns/adia-chat/css/adia-chat.empty.css +12 -0
- package/patterns/adia-chat/css/adia-chat.layout.css +60 -0
- package/patterns/adia-chat/css/adia-chat.markdown.css +74 -0
- package/patterns/adia-chat/css/adia-chat.messages.css +87 -0
- package/patterns/adia-chat/css/adia-chat.streaming.css +30 -0
- package/patterns/adia-chat/css/adia-chat.tokens.css +95 -0
- package/patterns/adia-chat/index.html +93 -0
- package/patterns/adia-editor/adia-editor.a2ui.json +58 -0
- package/patterns/adia-editor/adia-editor.css +6 -0
- package/patterns/adia-editor/adia-editor.js +56 -0
- package/patterns/adia-editor/adia-editor.yaml +36 -0
- package/patterns/adia-editor/css/adia-editor.layout.css +86 -0
- package/patterns/adia-editor/css/adia-editor.tokens.css +28 -0
- package/patterns/adia-editor/index.html +179 -0
- package/patterns/app-nav/app-nav.a2ui.json +89 -0
- package/patterns/app-nav/app-nav.css +92 -0
- package/patterns/app-nav/app-nav.js +99 -0
- package/patterns/app-nav/app-nav.yaml +54 -0
- package/patterns/app-nav-group/app-nav-group.a2ui.json +82 -0
- package/patterns/app-nav-group/app-nav-group.css +261 -0
- package/patterns/app-nav-group/app-nav-group.js +116 -0
- package/patterns/app-nav-group/app-nav-group.yaml +59 -0
- package/patterns/app-nav-item/app-nav-item.a2ui.json +83 -0
- package/patterns/app-nav-item/app-nav-item.css +156 -0
- package/patterns/app-nav-item/app-nav-item.js +42 -0
- package/patterns/app-nav-item/app-nav-item.yaml +62 -0
- package/patterns/app-shell/app-shell.a2ui.json +114 -0
- package/patterns/app-shell/app-shell.css +14 -0
- package/patterns/app-shell/app-shell.js +251 -0
- package/patterns/app-shell/app-shell.yaml +66 -0
- package/patterns/app-shell/css/app-shell.collapsed.css +86 -0
- package/patterns/app-shell/css/app-shell.helpers.css +42 -0
- package/patterns/app-shell/css/app-shell.main.css +58 -0
- package/patterns/app-shell/css/app-shell.shell.css +44 -0
- package/patterns/app-shell/css/app-shell.sidebar.css +116 -0
- package/patterns/app-shell/css/app-shell.templates.css +214 -0
- package/patterns/app-shell/css/app-shell.tokens.css +116 -0
- package/patterns/app-shell/index.html +112 -0
- package/patterns/gen-ui/gen-ui.a2ui.json +72 -0
- package/patterns/gen-ui/gen-ui.css +83 -0
- package/patterns/gen-ui/gen-ui.js +136 -0
- package/patterns/gen-ui/gen-ui.yaml +43 -0
- package/patterns/index.js +10 -0
- package/patterns/section-nav/section-nav.a2ui.json +91 -0
- package/patterns/section-nav/section-nav.css +59 -0
- package/patterns/section-nav/section-nav.js +42 -0
- package/patterns/section-nav/section-nav.yaml +58 -0
- package/patterns/section-nav-group/section-nav-group.a2ui.json +95 -0
- package/patterns/section-nav-group/section-nav-group.css +74 -0
- package/patterns/section-nav-group/section-nav-group.js +84 -0
- package/patterns/section-nav-group/section-nav-group.yaml +66 -0
- package/patterns/section-nav-item/section-nav-item.a2ui.json +97 -0
- package/patterns/section-nav-item/section-nav-item.css +96 -0
- package/patterns/section-nav-item/section-nav-item.js +66 -0
- package/patterns/section-nav-item/section-nav-item.yaml +70 -0
- package/styles/colors/index.css +6 -0
- package/styles/colors/parameters.css +52 -0
- package/styles/colors/primitives-accent.css +89 -0
- package/styles/colors/primitives-brand.css +89 -0
- package/styles/colors/primitives-danger.css +89 -0
- package/styles/colors/primitives-info.css +89 -0
- package/styles/colors/primitives-neutral.css +91 -0
- package/styles/colors/primitives-shared.css +57 -0
- package/styles/colors/primitives-success.css +89 -0
- package/styles/colors/primitives-warning.css +89 -0
- package/styles/colors/primitives.css +17 -0
- package/styles/colors/scrims.css +182 -0
- package/styles/colors/semantics.css +595 -0
- package/styles/colors/surfaces.css +43 -0
- package/styles/fonts.css +99 -0
- package/styles/layouts/admin.css +7 -0
- package/styles/prose.css +186 -0
- package/styles/styles.css +193 -0
- package/styles/themes.css +155 -0
- package/styles/tokens.css +304 -0
- package/styles/typography.css +853 -0
- package/traits/active-state.js +24 -0
- package/traits/anchor-positioning.js +66 -0
- package/traits/attention-pulse.js +30 -0
- package/traits/confetti-burst.js +65 -0
- package/traits/confetti.js +57 -0
- package/traits/count-up.js +42 -0
- package/traits/define.js +76 -0
- package/traits/dirty-state.js +38 -0
- package/traits/drag-ghost.js +38 -0
- package/traits/draggable.js +73 -0
- package/traits/fade-presence.js +52 -0
- package/traits/focus-trap.js +63 -0
- package/traits/focusable.js +38 -0
- package/traits/glow-focus.js +33 -0
- package/traits/gradient-shift.js +32 -0
- package/traits/haptic-feedback.js +28 -0
- package/traits/hotkey.js +62 -0
- package/traits/hoverable.js +26 -0
- package/traits/index.js +55 -0
- package/traits/inertia-drag.js +133 -0
- package/traits/intersection-observer.js +33 -0
- package/traits/keyboard-nav.js +36 -0
- package/traits/magnetic-hover.js +37 -0
- package/traits/noise-texture.js +30 -0
- package/traits/parallax.js +42 -0
- package/traits/portal.js +27 -0
- package/traits/pressable.js +75 -0
- package/traits/resizable.js +100 -0
- package/traits/resize-observer.js +31 -0
- package/traits/ripple.js +53 -0
- package/traits/roving-tabindex.js +67 -0
- package/traits/scale-press.js +43 -0
- package/traits/scroll-lock.js +27 -0
- package/traits/shimmer-loading.js +44 -0
- package/traits/snap-to-grid.js +28 -0
- package/traits/sound-feedback.js +30 -0
- package/traits/spring-animate.js +56 -0
- package/traits/tilt-hover.js +37 -0
- package/traits/tossable.js +178 -0
- package/traits/typeahead.js +63 -0
- package/traits/typewriter.js +35 -0
- package/traits/validation.js +118 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { AdiaElement } from '@core/element.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* <command-ui> — Searchable command palette.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* <command-ui placeholder="Search...">
|
|
8
|
+
* <optgroup label="Navigation">
|
|
9
|
+
* <option value="home" data-icon="home" data-shortcut="⌘H">Go Home</option>
|
|
10
|
+
* </optgroup>
|
|
11
|
+
* </command-ui>
|
|
12
|
+
*
|
|
13
|
+
* Attributes on <option>:
|
|
14
|
+
* data-icon — icon name (renders icon-ui)
|
|
15
|
+
* data-shortcut — keyboard shortcut hint
|
|
16
|
+
* data-keywords — extra searchable text
|
|
17
|
+
* disabled — skips in navigation
|
|
18
|
+
*
|
|
19
|
+
* Events:
|
|
20
|
+
* select — { detail: { value, label } }
|
|
21
|
+
* dismiss — Escape pressed
|
|
22
|
+
*/
|
|
23
|
+
class AdiaCommand extends AdiaElement {
|
|
24
|
+
static properties = {
|
|
25
|
+
placeholder: { type: String, default: 'Type a command...', reflect: true },
|
|
26
|
+
open: { type: Boolean, default: false, reflect: true },
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
static template = () => null;
|
|
30
|
+
|
|
31
|
+
#items = [];
|
|
32
|
+
#activeIdx = -1;
|
|
33
|
+
#inputEl = null;
|
|
34
|
+
#listEl = null;
|
|
35
|
+
#footerEl = null;
|
|
36
|
+
#bound = false;
|
|
37
|
+
|
|
38
|
+
connected() {
|
|
39
|
+
if (!this.#bound) {
|
|
40
|
+
this.#bound = true;
|
|
41
|
+
this.addEventListener('keydown', this.#onKeydown);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
render() {
|
|
46
|
+
// Stamp internal structure once
|
|
47
|
+
if (!this.#inputEl) {
|
|
48
|
+
// Parse options from declarative children before replacing innerHTML
|
|
49
|
+
this.#parseOptions();
|
|
50
|
+
|
|
51
|
+
this.innerHTML = `
|
|
52
|
+
<header>
|
|
53
|
+
<icon-ui name="magnifying-glass" slot="icon"></icon-ui>
|
|
54
|
+
<input type="text" placeholder="${this.placeholder}" slot="input" />
|
|
55
|
+
</header>
|
|
56
|
+
<section slot="list"></section>
|
|
57
|
+
<footer>
|
|
58
|
+
<span data-hint><kbd>↑</kbd><kbd>↓</kbd> Navigate</span>
|
|
59
|
+
<span data-hint><kbd>↵</kbd> Select</span>
|
|
60
|
+
<span data-hint><kbd>⎋</kbd> Close</span>
|
|
61
|
+
</footer>
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
this.#inputEl = this.querySelector('input');
|
|
65
|
+
this.#listEl = this.querySelector('[slot="list"]');
|
|
66
|
+
this.#footerEl = this.querySelector('footer');
|
|
67
|
+
|
|
68
|
+
this.#inputEl.addEventListener('input', this.#onInput);
|
|
69
|
+
this.#renderItems();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (this.open) {
|
|
73
|
+
requestAnimationFrame(() => this.#inputEl?.focus());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ── Public API ──
|
|
78
|
+
|
|
79
|
+
get value() { return this.#inputEl?.value || ''; }
|
|
80
|
+
set value(v) { if (this.#inputEl) this.#inputEl.value = v; }
|
|
81
|
+
|
|
82
|
+
focus() { this.#inputEl?.focus(); }
|
|
83
|
+
|
|
84
|
+
setItems(items) {
|
|
85
|
+
this.#items = items;
|
|
86
|
+
this.#renderItems();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ── Parse declarative <option>/<optgroup> ──
|
|
90
|
+
|
|
91
|
+
#parseOptions() {
|
|
92
|
+
const items = [];
|
|
93
|
+
for (const child of this.children) {
|
|
94
|
+
if (child.tagName === 'OPTGROUP') {
|
|
95
|
+
const group = { label: child.label, items: [] };
|
|
96
|
+
for (const opt of child.querySelectorAll('option')) {
|
|
97
|
+
group.items.push(this.#optionToItem(opt));
|
|
98
|
+
}
|
|
99
|
+
items.push(group);
|
|
100
|
+
} else if (child.tagName === 'OPTION') {
|
|
101
|
+
items.push(this.#optionToItem(child));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.#items = items;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#optionToItem(opt) {
|
|
108
|
+
return {
|
|
109
|
+
value: opt.value,
|
|
110
|
+
label: opt.textContent.trim(),
|
|
111
|
+
icon: opt.dataset.icon || '',
|
|
112
|
+
shortcut: opt.dataset.shortcut || '',
|
|
113
|
+
keywords: opt.dataset.keywords || '',
|
|
114
|
+
disabled: opt.disabled,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ── Render ──
|
|
119
|
+
|
|
120
|
+
#renderItems(filter = '') {
|
|
121
|
+
if (!this.#listEl) return;
|
|
122
|
+
this.#listEl.innerHTML = '';
|
|
123
|
+
this.#activeIdx = -1;
|
|
124
|
+
const q = filter.toLowerCase();
|
|
125
|
+
|
|
126
|
+
const flat = this.#items;
|
|
127
|
+
let visibleCount = 0;
|
|
128
|
+
|
|
129
|
+
for (const entry of flat) {
|
|
130
|
+
if (entry.items) {
|
|
131
|
+
// Group
|
|
132
|
+
const filtered = entry.items.filter(i => this.#matches(i, q));
|
|
133
|
+
if (!filtered.length) continue;
|
|
134
|
+
|
|
135
|
+
const groupEl = document.createElement('div');
|
|
136
|
+
groupEl.setAttribute('data-group', '');
|
|
137
|
+
groupEl.innerHTML = `<div data-group-label>${entry.label}</div>`;
|
|
138
|
+
|
|
139
|
+
for (const item of filtered) {
|
|
140
|
+
groupEl.appendChild(this.#createItemEl(item, visibleCount));
|
|
141
|
+
visibleCount++;
|
|
142
|
+
}
|
|
143
|
+
this.#listEl.appendChild(groupEl);
|
|
144
|
+
} else {
|
|
145
|
+
if (!this.#matches(entry, q)) continue;
|
|
146
|
+
this.#listEl.appendChild(this.#createItemEl(entry, visibleCount));
|
|
147
|
+
visibleCount++;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Empty state
|
|
152
|
+
if (!visibleCount) {
|
|
153
|
+
const empty = document.createElement('div');
|
|
154
|
+
empty.setAttribute('data-empty', '');
|
|
155
|
+
empty.textContent = 'No results found.';
|
|
156
|
+
this.#listEl.appendChild(empty);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Activate first non-disabled
|
|
160
|
+
if (visibleCount > 0) this.#activate(0);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#createItemEl(item, idx) {
|
|
164
|
+
const el = document.createElement('div');
|
|
165
|
+
el.setAttribute('role', 'option');
|
|
166
|
+
el.setAttribute('data-value', item.value);
|
|
167
|
+
el.setAttribute('data-idx', idx);
|
|
168
|
+
if (item.disabled) el.setAttribute('aria-disabled', 'true');
|
|
169
|
+
|
|
170
|
+
el.innerHTML = `
|
|
171
|
+
${item.icon ? `<icon-ui name="${item.icon}"></icon-ui>` : ''}
|
|
172
|
+
<span data-text>${item.label}</span>
|
|
173
|
+
${item.shortcut ? `<span data-shortcut>${item.shortcut}</span>` : ''}
|
|
174
|
+
`;
|
|
175
|
+
|
|
176
|
+
el.addEventListener('click', () => {
|
|
177
|
+
if (item.disabled) return;
|
|
178
|
+
this.#select(item);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
el.addEventListener('pointerenter', () => {
|
|
182
|
+
if (item.disabled) return;
|
|
183
|
+
this.#activate(idx);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
return el;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
#matches(item, q) {
|
|
190
|
+
if (!q) return true;
|
|
191
|
+
return (item.label || '').toLowerCase().includes(q) ||
|
|
192
|
+
(item.value || '').toLowerCase().includes(q) ||
|
|
193
|
+
(item.keywords || '').toLowerCase().includes(q);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ── Navigation ──
|
|
197
|
+
|
|
198
|
+
#activate(idx) {
|
|
199
|
+
const options = this.#listEl.querySelectorAll('[role="option"]:not([aria-disabled])');
|
|
200
|
+
const prev = this.#listEl.querySelector('[data-active]');
|
|
201
|
+
if (prev) prev.removeAttribute('data-active');
|
|
202
|
+
|
|
203
|
+
const target = [...options].find(el => parseInt(el.dataset.idx) === idx);
|
|
204
|
+
if (target) {
|
|
205
|
+
target.setAttribute('data-active', '');
|
|
206
|
+
target.scrollIntoView({ block: 'nearest' });
|
|
207
|
+
this.#activeIdx = idx;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
#moveActive(dir) {
|
|
212
|
+
const options = [...this.#listEl.querySelectorAll('[role="option"]:not([aria-disabled])')];
|
|
213
|
+
if (!options.length) return;
|
|
214
|
+
|
|
215
|
+
const currentEl = this.#listEl.querySelector('[data-active]');
|
|
216
|
+
const currentPos = currentEl ? options.indexOf(currentEl) : -1;
|
|
217
|
+
let next = currentPos + dir;
|
|
218
|
+
if (next < 0) next = options.length - 1;
|
|
219
|
+
if (next >= options.length) next = 0;
|
|
220
|
+
|
|
221
|
+
this.#activate(parseInt(options[next].dataset.idx));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#select(item) {
|
|
225
|
+
this.dispatchEvent(new CustomEvent('select', {
|
|
226
|
+
bubbles: true,
|
|
227
|
+
detail: { value: item.value, label: item.label },
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
#selectActive() {
|
|
232
|
+
const active = this.#listEl.querySelector('[data-active]');
|
|
233
|
+
if (!active) return;
|
|
234
|
+
const value = active.dataset.value;
|
|
235
|
+
const label = active.querySelector('[data-text]')?.textContent || '';
|
|
236
|
+
this.dispatchEvent(new CustomEvent('select', {
|
|
237
|
+
bubbles: true,
|
|
238
|
+
detail: { value, label },
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// ── Events ──
|
|
243
|
+
|
|
244
|
+
#onInput = () => {
|
|
245
|
+
this.#renderItems(this.#inputEl.value);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
#onKeydown = (e) => {
|
|
249
|
+
switch (e.key) {
|
|
250
|
+
case 'ArrowDown':
|
|
251
|
+
e.preventDefault();
|
|
252
|
+
this.#moveActive(1);
|
|
253
|
+
break;
|
|
254
|
+
case 'ArrowUp':
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
this.#moveActive(-1);
|
|
257
|
+
break;
|
|
258
|
+
case 'Enter':
|
|
259
|
+
e.preventDefault();
|
|
260
|
+
this.#selectActive();
|
|
261
|
+
break;
|
|
262
|
+
case 'Tab':
|
|
263
|
+
e.preventDefault();
|
|
264
|
+
this.#selectActive();
|
|
265
|
+
break;
|
|
266
|
+
case 'Escape':
|
|
267
|
+
e.preventDefault();
|
|
268
|
+
this.dispatchEvent(new Event('dismiss', { bubbles: true }));
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
disconnected() {
|
|
274
|
+
this.removeEventListener('keydown', this.#onKeydown);
|
|
275
|
+
this.#inputEl?.removeEventListener('input', this.#onInput);
|
|
276
|
+
this.#inputEl = null;
|
|
277
|
+
this.#listEl = null;
|
|
278
|
+
this.#footerEl = null;
|
|
279
|
+
this.#bound = false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
customElements.define('command-ui', AdiaCommand);
|
|
284
|
+
export { AdiaCommand };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Generated by scripts/migrate-yamls-to-v1.mjs — migrated to v1 contract.
|
|
2
|
+
# Edit this file; run `npm run build:components` to regenerate a2ui.json.
|
|
3
|
+
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
4
|
+
name: AdiaCommand
|
|
5
|
+
tag: command-ui
|
|
6
|
+
component: Command
|
|
7
|
+
category: container
|
|
8
|
+
version: 1
|
|
9
|
+
description: Searchable command palette with keyboard navigation.
|
|
10
|
+
props:
|
|
11
|
+
open:
|
|
12
|
+
description: Whether the command palette is visible
|
|
13
|
+
type: boolean
|
|
14
|
+
default: false
|
|
15
|
+
reflect: true
|
|
16
|
+
placeholder:
|
|
17
|
+
description: Placeholder text for the search input
|
|
18
|
+
type: string
|
|
19
|
+
default: Type a command...
|
|
20
|
+
events:
|
|
21
|
+
dismiss:
|
|
22
|
+
description: Fired when Escape is pressed
|
|
23
|
+
select:
|
|
24
|
+
description: Fired when an item is selected. Detail contains { value, label, item }.
|
|
25
|
+
slots:
|
|
26
|
+
empty:
|
|
27
|
+
description: Empty state shown when no items match
|
|
28
|
+
footer:
|
|
29
|
+
description: Keyboard hint bar
|
|
30
|
+
list:
|
|
31
|
+
description: Container for command items and groups
|
|
32
|
+
search:
|
|
33
|
+
description: Search input with combobox role
|
|
34
|
+
states:
|
|
35
|
+
- name: idle
|
|
36
|
+
description: Default, ready for interaction.
|
|
37
|
+
traits: []
|
|
38
|
+
tokens: {}
|
|
39
|
+
a2ui:
|
|
40
|
+
rules: []
|
|
41
|
+
anti_patterns: []
|
|
42
|
+
examples:
|
|
43
|
+
- name: basic-command
|
|
44
|
+
description: Basic Command usage
|
|
45
|
+
a2ui: >-
|
|
46
|
+
[
|
|
47
|
+
{
|
|
48
|
+
"id": "root",
|
|
49
|
+
"component": "Card",
|
|
50
|
+
"children": [
|
|
51
|
+
"sec"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "sec",
|
|
56
|
+
"component": "Section",
|
|
57
|
+
"children": [
|
|
58
|
+
"comp"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "comp",
|
|
63
|
+
"component": "Command",
|
|
64
|
+
"placeholder": "Enter command..."
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
keywords:
|
|
68
|
+
- command
|
|
69
|
+
- assistant
|
|
70
|
+
- copilot
|
|
71
|
+
- ai
|
|
72
|
+
- prompt
|
|
73
|
+
- console
|
|
74
|
+
- menu
|
|
75
|
+
- terminal
|
|
76
|
+
- search
|
|
77
|
+
- find
|
|
78
|
+
- lookup
|
|
79
|
+
- autocomplete
|
|
80
|
+
- typeahead
|
|
81
|
+
- spotlight
|
|
82
|
+
- omnibar
|
|
83
|
+
- combobox
|
|
84
|
+
- palette
|
|
85
|
+
- shortcut
|
|
86
|
+
- hotkey
|
|
87
|
+
- keyboard
|
|
88
|
+
- keybinding
|
|
89
|
+
synonyms:
|
|
90
|
+
ai:
|
|
91
|
+
- chat
|
|
92
|
+
- streaming
|
|
93
|
+
- response
|
|
94
|
+
- command
|
|
95
|
+
assistant:
|
|
96
|
+
- chat
|
|
97
|
+
- streaming
|
|
98
|
+
- response
|
|
99
|
+
- command
|
|
100
|
+
autocomplete:
|
|
101
|
+
- search
|
|
102
|
+
- command
|
|
103
|
+
- palette
|
|
104
|
+
- tag
|
|
105
|
+
combobox:
|
|
106
|
+
- search
|
|
107
|
+
- command
|
|
108
|
+
- select
|
|
109
|
+
command:
|
|
110
|
+
- command
|
|
111
|
+
- palette
|
|
112
|
+
- kbd
|
|
113
|
+
- shortcut
|
|
114
|
+
console:
|
|
115
|
+
- dashboard
|
|
116
|
+
- table
|
|
117
|
+
- data
|
|
118
|
+
- sidebar
|
|
119
|
+
- command
|
|
120
|
+
copilot:
|
|
121
|
+
- chat
|
|
122
|
+
- streaming
|
|
123
|
+
- response
|
|
124
|
+
- command
|
|
125
|
+
find:
|
|
126
|
+
- search
|
|
127
|
+
- filter
|
|
128
|
+
- command
|
|
129
|
+
hotkey:
|
|
130
|
+
- kbd
|
|
131
|
+
- shortcut
|
|
132
|
+
- command
|
|
133
|
+
keybinding:
|
|
134
|
+
- kbd
|
|
135
|
+
- shortcut
|
|
136
|
+
- command
|
|
137
|
+
keyboard:
|
|
138
|
+
- kbd
|
|
139
|
+
- shortcut
|
|
140
|
+
- command
|
|
141
|
+
lookup:
|
|
142
|
+
- search
|
|
143
|
+
- filter
|
|
144
|
+
- command
|
|
145
|
+
menu:
|
|
146
|
+
- nav
|
|
147
|
+
- sidebar
|
|
148
|
+
- popover
|
|
149
|
+
- menu
|
|
150
|
+
- command
|
|
151
|
+
omnibar:
|
|
152
|
+
- command
|
|
153
|
+
- palette
|
|
154
|
+
- search
|
|
155
|
+
palette:
|
|
156
|
+
- color
|
|
157
|
+
- picker
|
|
158
|
+
- command
|
|
159
|
+
- palette
|
|
160
|
+
prompt:
|
|
161
|
+
- chat
|
|
162
|
+
- streaming
|
|
163
|
+
- command
|
|
164
|
+
- palette
|
|
165
|
+
search:
|
|
166
|
+
- search
|
|
167
|
+
- filter
|
|
168
|
+
- command
|
|
169
|
+
- palette
|
|
170
|
+
shortcut:
|
|
171
|
+
- kbd
|
|
172
|
+
- shortcut
|
|
173
|
+
- command
|
|
174
|
+
spotlight:
|
|
175
|
+
- command
|
|
176
|
+
- palette
|
|
177
|
+
- search
|
|
178
|
+
terminal:
|
|
179
|
+
- code
|
|
180
|
+
- block
|
|
181
|
+
- command
|
|
182
|
+
typeahead:
|
|
183
|
+
- search
|
|
184
|
+
- command
|
|
185
|
+
- palette
|
|
186
|
+
related: []
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://adiaui.dev/a2ui/v0_9/components/DescriptionList.json",
|
|
4
|
+
"title": "DescriptionList",
|
|
5
|
+
"description": "Semantic key-value list (dl/dt/dd). Preserves native HTML semantics for screen readers and SSR. Layout supports stacked (default) or inline.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"allOf": [
|
|
8
|
+
{
|
|
9
|
+
"$ref": "common_types.json#/$defs/ComponentCommon"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"$ref": "common_types.json#/$defs/CatalogComponentCommon"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"properties": {
|
|
16
|
+
"items": {
|
|
17
|
+
"description": "Optional JSON array of {term, description} — alternative to declarative <dt>/<dd> children",
|
|
18
|
+
"type": "array",
|
|
19
|
+
"default": []
|
|
20
|
+
},
|
|
21
|
+
"align": {
|
|
22
|
+
"description": "Alignment for inline layout — between = term left, value right.",
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": [
|
|
25
|
+
"start",
|
|
26
|
+
"between"
|
|
27
|
+
],
|
|
28
|
+
"default": "start"
|
|
29
|
+
},
|
|
30
|
+
"component": {
|
|
31
|
+
"const": "DescriptionList"
|
|
32
|
+
},
|
|
33
|
+
"layout": {
|
|
34
|
+
"description": "stacked: term above description. inline: term and description on one row.",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"enum": [
|
|
37
|
+
"stacked",
|
|
38
|
+
"inline"
|
|
39
|
+
],
|
|
40
|
+
"default": "stacked"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": [
|
|
44
|
+
"component"
|
|
45
|
+
],
|
|
46
|
+
"unevaluatedProperties": false,
|
|
47
|
+
"x-adiaui": {
|
|
48
|
+
"anti_patterns": [],
|
|
49
|
+
"category": "display",
|
|
50
|
+
"events": {},
|
|
51
|
+
"examples": [],
|
|
52
|
+
"keywords": [
|
|
53
|
+
"description list",
|
|
54
|
+
"key value",
|
|
55
|
+
"metadata",
|
|
56
|
+
"specs",
|
|
57
|
+
"properties",
|
|
58
|
+
"summary",
|
|
59
|
+
"details",
|
|
60
|
+
"dl"
|
|
61
|
+
],
|
|
62
|
+
"name": "AdiaDescriptionList",
|
|
63
|
+
"related": [],
|
|
64
|
+
"slots": {
|
|
65
|
+
"[object Object]": {
|
|
66
|
+
"description": "Child content region for the `[object Object]` slot."
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"states": [
|
|
70
|
+
{
|
|
71
|
+
"description": "Default, ready for interaction.",
|
|
72
|
+
"name": "idle"
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"synonyms": {
|
|
76
|
+
"description-list": [
|
|
77
|
+
"description list",
|
|
78
|
+
"key value list",
|
|
79
|
+
"spec list",
|
|
80
|
+
"metadata list",
|
|
81
|
+
"property list"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"tag": "description-list-ui",
|
|
85
|
+
"tokens": {},
|
|
86
|
+
"traits": [],
|
|
87
|
+
"version": 1
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@scope (description-list-ui) {
|
|
2
|
+
:where(:scope) {
|
|
3
|
+
/* ── Layout ── */
|
|
4
|
+
--description-list-gap-row: var(--a-space-2);
|
|
5
|
+
--description-list-gap-column: var(--a-space-3);
|
|
6
|
+
--description-list-term-min-width: 8rem;
|
|
7
|
+
|
|
8
|
+
/* ── Typography ── */
|
|
9
|
+
--description-list-term-font-size: var(--a-ui-sm);
|
|
10
|
+
--description-list-term-weight: var(--a-weight-medium);
|
|
11
|
+
--description-list-desc-font-size: var(--a-ui-sm);
|
|
12
|
+
--description-list-desc-weight: var(--a-weight-normal);
|
|
13
|
+
|
|
14
|
+
/* ── Colors ── */
|
|
15
|
+
--description-list-term-fg: var(--a-fg-muted);
|
|
16
|
+
--description-list-desc-fg: var(--a-fg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:scope {
|
|
20
|
+
/* ── Base ── */
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
display: grid;
|
|
23
|
+
gap: var(--description-list-gap-row) var(--description-list-gap-column);
|
|
24
|
+
margin: 0;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Default stacked: term above desc. Each pair in its own implicit row. */
|
|
29
|
+
:scope {
|
|
30
|
+
grid-template-columns: 1fr;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
[data-dl-term],
|
|
34
|
+
dt {
|
|
35
|
+
margin: 0;
|
|
36
|
+
font-size: var(--description-list-term-font-size);
|
|
37
|
+
font-weight: var(--description-list-term-weight);
|
|
38
|
+
color: var(--description-list-term-fg);
|
|
39
|
+
line-height: 1.3;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-dl-desc],
|
|
43
|
+
dd {
|
|
44
|
+
margin: 0;
|
|
45
|
+
font-size: var(--description-list-desc-font-size);
|
|
46
|
+
font-weight: var(--description-list-desc-weight);
|
|
47
|
+
color: var(--description-list-desc-fg);
|
|
48
|
+
line-height: 1.4;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Separate pairs with extra gap when stacked */
|
|
52
|
+
:scope[layout="stacked"] [data-dl-desc]:not(:last-child),
|
|
53
|
+
:scope[layout="stacked"] dd:not(:last-child) {
|
|
54
|
+
margin-bottom: var(--description-list-gap-row);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Inline: term and desc on one row */
|
|
58
|
+
:scope[layout="inline"] {
|
|
59
|
+
grid-template-columns: minmax(var(--description-list-term-min-width), max-content) 1fr;
|
|
60
|
+
align-items: baseline;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:scope[layout="inline"][align="between"] [data-dl-desc],
|
|
64
|
+
:scope[layout="inline"][align="between"] dd {
|
|
65
|
+
text-align: end;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Size handled by the universal [size] attribute scaling --a-ui-size;
|
|
69
|
+
components pick up font-size from token chain automatically. */
|
|
70
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <description-list-ui> — Semantic dl/dt/dd wrapper for key-value metadata.
|
|
3
|
+
*
|
|
4
|
+
* Pure layout component. Renders terms and descriptions in a grid.
|
|
5
|
+
*
|
|
6
|
+
* Declarative use (recommended — preserves semantics for SSR + AT):
|
|
7
|
+
* <description-list-ui>
|
|
8
|
+
* <dt>Status</dt><dd>Active</dd>
|
|
9
|
+
* <dt>Plan</dt><dd>Pro</dd>
|
|
10
|
+
* </description-list-ui>
|
|
11
|
+
*
|
|
12
|
+
* Programmatic use:
|
|
13
|
+
* <description-list-ui
|
|
14
|
+
* items='[{"term":"Status","description":"Active"}]'></description-list-ui>
|
|
15
|
+
*
|
|
16
|
+
* Props:
|
|
17
|
+
* layout — "stacked" (term above, default) | "inline" (term : value on one row)
|
|
18
|
+
* align — "start" (default) | "between" (space-between for inline layout)
|
|
19
|
+
* items — optional JSON array of {term, description} pairs
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { AdiaElement } from '@core/element.js';
|
|
23
|
+
|
|
24
|
+
class AdiaDescriptionList extends AdiaElement {
|
|
25
|
+
static properties = {
|
|
26
|
+
layout: { type: String, default: 'stacked', reflect: true },
|
|
27
|
+
align: { type: String, default: 'start', reflect: true },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
static template = () => null;
|
|
31
|
+
|
|
32
|
+
connected() {
|
|
33
|
+
// Use the native <dl> role by wrapping or using the tag directly —
|
|
34
|
+
// since we're a custom element, we set role explicitly.
|
|
35
|
+
this.setAttribute('role', 'list');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
const items = this.#resolveItems();
|
|
40
|
+
if (!items.length) return; // preserve declarative children
|
|
41
|
+
|
|
42
|
+
this.innerHTML = items.map(({ term, description }) => `
|
|
43
|
+
<dt data-dl-term>${this.#escape(term)}</dt>
|
|
44
|
+
<dd data-dl-desc>${this.#escape(description)}</dd>
|
|
45
|
+
`).join('');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#resolveItems() {
|
|
49
|
+
if (Array.isArray(this._items) && this._items.length) return this._items;
|
|
50
|
+
const attr = this.getAttribute('items');
|
|
51
|
+
if (attr) {
|
|
52
|
+
try {
|
|
53
|
+
const parsed = JSON.parse(attr);
|
|
54
|
+
if (Array.isArray(parsed)) return parsed;
|
|
55
|
+
} catch { /* fall through */ }
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set items(v) {
|
|
61
|
+
this._items = Array.isArray(v) ? v : [];
|
|
62
|
+
this.render();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get items() {
|
|
66
|
+
return this._items || [];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#escape(s) {
|
|
70
|
+
return String(s == null ? '' : s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
customElements.define('description-list-ui', AdiaDescriptionList);
|
|
75
|
+
export { AdiaDescriptionList };
|