@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,115 @@
|
|
|
1
|
+
@scope (action-list-ui) {
|
|
2
|
+
:where(:scope) {
|
|
3
|
+
--action-list-gap: var(--a-space-0-5);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:scope {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: var(--action-list-gap);
|
|
11
|
+
margin: 0;
|
|
12
|
+
padding: 0;
|
|
13
|
+
list-style: none;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@scope (action-item-ui) {
|
|
18
|
+
:where(:scope) {
|
|
19
|
+
/* Reuse menu-item visual language for consistency */
|
|
20
|
+
--action-item-gap: var(--a-space-2);
|
|
21
|
+
--action-item-px: var(--a-space-2);
|
|
22
|
+
--action-item-py: var(--a-space-1-5);
|
|
23
|
+
--action-item-radius: var(--a-radius-md);
|
|
24
|
+
|
|
25
|
+
--action-item-bg: transparent;
|
|
26
|
+
--action-item-fg: var(--a-fg-subtle);
|
|
27
|
+
--action-item-fg-hover: var(--a-fg-strong);
|
|
28
|
+
--action-item-bg-hover: var(--a-bg-muted);
|
|
29
|
+
--action-item-fg-disabled: var(--a-fg-muted);
|
|
30
|
+
--action-item-icon-fg: var(--a-fg-muted);
|
|
31
|
+
--action-item-icon-fg-hover: var(--a-fg);
|
|
32
|
+
--action-item-danger-fg: var(--a-danger-bg);
|
|
33
|
+
--action-item-danger-bg: var(--a-danger-muted);
|
|
34
|
+
|
|
35
|
+
--action-item-font-size: var(--a-ui-size);
|
|
36
|
+
--action-item-icon-size: var(--action-item-font-size);
|
|
37
|
+
|
|
38
|
+
--action-item-focus-ring: var(--a-focus-ring);
|
|
39
|
+
|
|
40
|
+
--action-item-duration: var(--a-duration-fast);
|
|
41
|
+
--action-item-easing: var(--a-easing);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:scope {
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: var(--action-item-gap);
|
|
49
|
+
padding: var(--action-item-py) var(--action-item-px);
|
|
50
|
+
border-radius: var(--action-item-radius);
|
|
51
|
+
font-size: var(--action-item-font-size);
|
|
52
|
+
background: var(--action-item-bg);
|
|
53
|
+
color: var(--action-item-fg);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
user-select: none;
|
|
56
|
+
outline: none;
|
|
57
|
+
transition:
|
|
58
|
+
background var(--action-item-duration) var(--action-item-easing),
|
|
59
|
+
color var(--action-item-duration) var(--action-item-easing);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:scope:hover,
|
|
63
|
+
:scope:focus-visible {
|
|
64
|
+
background: var(--action-item-bg-hover);
|
|
65
|
+
color: var(--action-item-fg-hover);
|
|
66
|
+
}
|
|
67
|
+
:scope:focus-visible {
|
|
68
|
+
box-shadow: var(--action-item-focus-ring);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Icon (leading) */
|
|
72
|
+
[slot="icon"] {
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
--a-icon-size: var(--action-item-icon-size);
|
|
75
|
+
color: var(--action-item-icon-fg);
|
|
76
|
+
transition: color var(--action-item-duration) var(--action-item-easing);
|
|
77
|
+
}
|
|
78
|
+
:scope:hover [slot="icon"],
|
|
79
|
+
:scope:focus-visible [slot="icon"] {
|
|
80
|
+
color: var(--action-item-icon-fg-hover);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Text */
|
|
84
|
+
[slot="text"] {
|
|
85
|
+
flex: 1;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
text-overflow: ellipsis;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Default slot (trailing content: kbd, badge, chevron) pushed to far right */
|
|
93
|
+
> :not([slot="icon"]):not([slot="text"]) {
|
|
94
|
+
flex-shrink: 0;
|
|
95
|
+
margin-inline-start: auto;
|
|
96
|
+
color: var(--action-item-icon-fg);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Variant: danger (destructive action) — only remaps tokens */
|
|
100
|
+
:scope[variant="danger"] {
|
|
101
|
+
--action-item-fg: var(--action-item-danger-fg);
|
|
102
|
+
--action-item-fg-hover: var(--action-item-danger-fg);
|
|
103
|
+
--action-item-icon-fg: var(--action-item-danger-fg);
|
|
104
|
+
--action-item-icon-fg-hover: var(--action-item-danger-fg);
|
|
105
|
+
--action-item-bg-hover: var(--action-item-danger-bg);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Disabled — only remaps tokens */
|
|
109
|
+
:scope[disabled] {
|
|
110
|
+
--action-item-fg: var(--action-item-fg-disabled);
|
|
111
|
+
--action-item-icon-fg: var(--action-item-fg-disabled);
|
|
112
|
+
pointer-events: none;
|
|
113
|
+
cursor: not-allowed;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <action-list-ui>
|
|
3
|
+
* <action-item-ui icon="plus" text="New Project" value="new"></action-item-ui>
|
|
4
|
+
* <action-item-ui icon="users" text="Invite Team" value="invite"></action-item-ui>
|
|
5
|
+
* <action-item-ui icon="download" text="Export Data" value="export"></action-item-ui>
|
|
6
|
+
* </action-list-ui>
|
|
7
|
+
*
|
|
8
|
+
* Inline (non-dropdown) list of command actions. Think of it as a menu that
|
|
9
|
+
* stays open — useful for quick-actions cards, settings rails, sidebar shortcuts.
|
|
10
|
+
*
|
|
11
|
+
* Differs from <menu-ui> (which renders in a popover) and <list-ui> (which is
|
|
12
|
+
* passive — no hover/click semantics).
|
|
13
|
+
*
|
|
14
|
+
* Fires `action` CustomEvent with { value, text, item } when an item is clicked
|
|
15
|
+
* or activated via keyboard (Enter / Space). Keyboard nav: ArrowUp/Down, Home/End.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { AdiaElement } from '@core/element.js';
|
|
19
|
+
|
|
20
|
+
class AdiaActionList extends AdiaElement {
|
|
21
|
+
static properties = {};
|
|
22
|
+
static template = () => null;
|
|
23
|
+
|
|
24
|
+
#bound = false;
|
|
25
|
+
|
|
26
|
+
connected() {
|
|
27
|
+
this.setAttribute('role', 'list');
|
|
28
|
+
if (!this.#bound) {
|
|
29
|
+
this.#bound = true;
|
|
30
|
+
this.addEventListener('click', this.#onClick);
|
|
31
|
+
this.addEventListener('keydown', this.#onKey);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
disconnected() {
|
|
36
|
+
this.removeEventListener('click', this.#onClick);
|
|
37
|
+
this.removeEventListener('keydown', this.#onKey);
|
|
38
|
+
this.#bound = false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#items() {
|
|
42
|
+
return Array.from(this.querySelectorAll(':scope > action-item-ui:not([disabled])'));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#onClick = (e) => {
|
|
46
|
+
const item = e.target.closest('action-item-ui');
|
|
47
|
+
if (!item || item.hasAttribute('disabled')) return;
|
|
48
|
+
if (!this.contains(item)) return;
|
|
49
|
+
this.dispatchEvent(new CustomEvent('action', {
|
|
50
|
+
bubbles: true,
|
|
51
|
+
detail: { value: item.getAttribute('value') || '', text: item.getAttribute('text') || item.textContent.trim(), item },
|
|
52
|
+
}));
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
#onKey = (e) => {
|
|
56
|
+
const items = this.#items();
|
|
57
|
+
if (!items.length) return;
|
|
58
|
+
const active = document.activeElement?.closest?.('action-item-ui');
|
|
59
|
+
const i = active ? items.indexOf(active) : -1;
|
|
60
|
+
const focus = (idx) => {
|
|
61
|
+
const next = items[(idx + items.length) % items.length];
|
|
62
|
+
next?.focus?.({ preventScroll: true });
|
|
63
|
+
};
|
|
64
|
+
switch (e.key) {
|
|
65
|
+
case 'ArrowDown': e.preventDefault(); focus(i + 1); break;
|
|
66
|
+
case 'ArrowUp': e.preventDefault(); focus(i - 1); break;
|
|
67
|
+
case 'Home': e.preventDefault(); focus(0); break;
|
|
68
|
+
case 'End': e.preventDefault(); focus(items.length - 1); break;
|
|
69
|
+
case 'Enter':
|
|
70
|
+
case ' ': {
|
|
71
|
+
if (active) { e.preventDefault(); active.click(); }
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
customElements.define('action-list-ui', AdiaActionList);
|
|
79
|
+
|
|
80
|
+
class AdiaActionItem extends AdiaElement {
|
|
81
|
+
static properties = {
|
|
82
|
+
icon: { type: String, default: '', reflect: true },
|
|
83
|
+
text: { type: String, default: '', reflect: true },
|
|
84
|
+
value: { type: String, default: '', reflect: true },
|
|
85
|
+
variant: { type: String, default: 'default', reflect: true },
|
|
86
|
+
disabled: { type: Boolean, default: false, reflect: true },
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
static template = () => null;
|
|
90
|
+
|
|
91
|
+
connected() {
|
|
92
|
+
this.setAttribute('role', 'listitem');
|
|
93
|
+
if (!this.hasAttribute('tabindex')) this.setAttribute('tabindex', '0');
|
|
94
|
+
this.#stamp();
|
|
95
|
+
this.#syncAria();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#stamp() {
|
|
99
|
+
if (this.querySelector('[slot="text"]')) return;
|
|
100
|
+
|
|
101
|
+
if (this.icon) {
|
|
102
|
+
const iconEl = document.createElement('icon-ui');
|
|
103
|
+
iconEl.setAttribute('slot', 'icon');
|
|
104
|
+
iconEl.setAttribute('name', this.icon);
|
|
105
|
+
this.appendChild(iconEl);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.text) {
|
|
109
|
+
const span = document.createElement('span');
|
|
110
|
+
span.setAttribute('slot', 'text');
|
|
111
|
+
span.textContent = this.text;
|
|
112
|
+
this.appendChild(span);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
#syncAria() {
|
|
117
|
+
if (this.disabled) {
|
|
118
|
+
this.setAttribute('aria-disabled', 'true');
|
|
119
|
+
this.setAttribute('tabindex', '-1');
|
|
120
|
+
} else {
|
|
121
|
+
this.removeAttribute('aria-disabled');
|
|
122
|
+
this.setAttribute('tabindex', '0');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
render() {
|
|
127
|
+
const iconEl = this.querySelector('[slot="icon"]');
|
|
128
|
+
if (this.icon) {
|
|
129
|
+
if (iconEl) iconEl.setAttribute('name', this.icon);
|
|
130
|
+
else {
|
|
131
|
+
const el = document.createElement('icon-ui');
|
|
132
|
+
el.setAttribute('slot', 'icon');
|
|
133
|
+
el.setAttribute('name', this.icon);
|
|
134
|
+
this.prepend(el);
|
|
135
|
+
}
|
|
136
|
+
} else if (iconEl) {
|
|
137
|
+
iconEl.remove();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const textEl = this.querySelector('[slot="text"]');
|
|
141
|
+
if (textEl) textEl.textContent = this.text;
|
|
142
|
+
|
|
143
|
+
this.#syncAria();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
customElements.define('action-item-ui', AdiaActionItem);
|
|
148
|
+
|
|
149
|
+
export { AdiaActionList, AdiaActionItem };
|
|
@@ -0,0 +1,56 @@
|
|
|
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: AdiaActionList
|
|
5
|
+
tag: action-list-ui
|
|
6
|
+
component: ActionList
|
|
7
|
+
category: navigation
|
|
8
|
+
version: 1
|
|
9
|
+
description: Inline list of command actions with keyboard navigation. Fires action event when an
|
|
10
|
+
item is clicked or activated via keyboard.
|
|
11
|
+
props: {}
|
|
12
|
+
events:
|
|
13
|
+
action:
|
|
14
|
+
description: "Fired on action."
|
|
15
|
+
slots:
|
|
16
|
+
default (action-item-ui children):
|
|
17
|
+
description: "Child content region for the `default (action-item-ui children)` slot."
|
|
18
|
+
states:
|
|
19
|
+
- name: idle
|
|
20
|
+
description: Default, ready for interaction.
|
|
21
|
+
traits: []
|
|
22
|
+
tokens: {}
|
|
23
|
+
a2ui:
|
|
24
|
+
rules: []
|
|
25
|
+
anti_patterns: []
|
|
26
|
+
examples:
|
|
27
|
+
- name: basic-action-list
|
|
28
|
+
description: Basic ActionList usage
|
|
29
|
+
a2ui: >-
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
"id": "root",
|
|
33
|
+
"component": "Card",
|
|
34
|
+
"children": [
|
|
35
|
+
"sec"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "sec",
|
|
40
|
+
"component": "Section",
|
|
41
|
+
"children": [
|
|
42
|
+
"comp"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "comp",
|
|
47
|
+
"component": "ActionList"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
keywords:
|
|
51
|
+
- actionlist
|
|
52
|
+
- action-list
|
|
53
|
+
- action
|
|
54
|
+
- list
|
|
55
|
+
synonyms: {}
|
|
56
|
+
related: []
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://adiaui.dev/a2ui/v0_9/components/AgentArtifact.json",
|
|
4
|
+
"title": "AgentArtifact",
|
|
5
|
+
"description": "Inline container for structured agent artifacts (A2UI, JSON, tickets).",
|
|
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
|
+
"title": {
|
|
17
|
+
"description": "Header title.",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": ""
|
|
20
|
+
},
|
|
21
|
+
"collapsed": {
|
|
22
|
+
"description": "Start collapsed.",
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": false
|
|
25
|
+
},
|
|
26
|
+
"component": {
|
|
27
|
+
"const": "AgentArtifact"
|
|
28
|
+
},
|
|
29
|
+
"icon": {
|
|
30
|
+
"description": "icon-ui name in header.",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": ""
|
|
33
|
+
},
|
|
34
|
+
"kind": {
|
|
35
|
+
"description": "Uppercase badge label.",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"default": ""
|
|
38
|
+
},
|
|
39
|
+
"tone": {
|
|
40
|
+
"description": "neutral | accent | warning | danger",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"default": "neutral"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": [
|
|
46
|
+
"component"
|
|
47
|
+
],
|
|
48
|
+
"unevaluatedProperties": false,
|
|
49
|
+
"x-adiaui": {
|
|
50
|
+
"anti_patterns": [],
|
|
51
|
+
"category": "agent",
|
|
52
|
+
"events": {
|
|
53
|
+
"artifact-toggle": {
|
|
54
|
+
"description": "Fired on artifact-toggle."
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"examples": [
|
|
58
|
+
{
|
|
59
|
+
"description": "Artifact with a code body and two actions.",
|
|
60
|
+
"a2ui": "[\n {\n \"id\": \"root\",\n \"component\": \"AgentArtifact\",\n \"title\": \"product-card\",\n \"kind\": \"A2UI\",\n \"icon\": \"layout\"\n }\n]",
|
|
61
|
+
"name": "basic"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"keywords": [
|
|
65
|
+
"artifact",
|
|
66
|
+
"container",
|
|
67
|
+
"inline",
|
|
68
|
+
"preview",
|
|
69
|
+
"attachment"
|
|
70
|
+
],
|
|
71
|
+
"name": "AdiaAgentArtifact",
|
|
72
|
+
"related": [
|
|
73
|
+
"card-ui",
|
|
74
|
+
"code-ui"
|
|
75
|
+
],
|
|
76
|
+
"slots": {
|
|
77
|
+
"default": {
|
|
78
|
+
"description": "Default slot — primary child content."
|
|
79
|
+
},
|
|
80
|
+
"primary": {
|
|
81
|
+
"description": "Child content region for the `primary` slot."
|
|
82
|
+
},
|
|
83
|
+
"secondary": {
|
|
84
|
+
"description": "Child content region for the `secondary` slot."
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"states": [
|
|
88
|
+
{
|
|
89
|
+
"description": "Default, ready for interaction.",
|
|
90
|
+
"name": "idle"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"synonyms": {},
|
|
94
|
+
"tag": "agent-artifact-ui",
|
|
95
|
+
"tokens": {},
|
|
96
|
+
"traits": [],
|
|
97
|
+
"version": 1
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@scope (agent-artifact-ui) {
|
|
2
|
+
:where(:scope) {
|
|
3
|
+
/* ── Layout ── */
|
|
4
|
+
--agent-artifact-radius: var(--a-radius);
|
|
5
|
+
--agent-artifact-padding: var(--a-space-3);
|
|
6
|
+
--agent-artifact-header-padding-y: var(--a-space-2);
|
|
7
|
+
--agent-artifact-header-padding-x: var(--a-space-3);
|
|
8
|
+
--agent-artifact-gap: var(--a-space-2);
|
|
9
|
+
|
|
10
|
+
/* ── Colors ── */
|
|
11
|
+
--agent-artifact-bg: var(--a-bg-subtle);
|
|
12
|
+
--agent-artifact-fg: var(--a-fg);
|
|
13
|
+
--agent-artifact-fg-muted: var(--a-fg-muted);
|
|
14
|
+
--agent-artifact-border: var(--a-border-subtle);
|
|
15
|
+
--agent-artifact-header-bg: var(--a-bg);
|
|
16
|
+
|
|
17
|
+
/* ── Typography ── */
|
|
18
|
+
--agent-artifact-title-size: var(--a-ui-md);
|
|
19
|
+
--agent-artifact-title-weight: var(--a-weight-medium);
|
|
20
|
+
|
|
21
|
+
/* ── Motion ── */
|
|
22
|
+
--agent-artifact-duration: var(--a-duration-fast);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:scope {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
border: 1px solid var(--agent-artifact-border);
|
|
29
|
+
border-radius: var(--agent-artifact-radius);
|
|
30
|
+
background: var(--agent-artifact-bg);
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
min-width: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:scope[tone="accent"] { --agent-artifact-border: var(--a-accent-bg); }
|
|
36
|
+
:scope[tone="warning"] { --agent-artifact-border: var(--a-warning-bg); }
|
|
37
|
+
:scope[tone="danger"] { --agent-artifact-border: var(--a-danger-bg); }
|
|
38
|
+
|
|
39
|
+
[data-artifact-header] {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: var(--agent-artifact-gap);
|
|
43
|
+
padding: var(--agent-artifact-header-padding-y) var(--agent-artifact-header-padding-x);
|
|
44
|
+
background: var(--agent-artifact-header-bg);
|
|
45
|
+
border-block-end: 1px solid var(--agent-artifact-border);
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
user-select: none;
|
|
48
|
+
min-width: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-artifact-icon] {
|
|
52
|
+
flex-shrink: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-artifact-title] {
|
|
56
|
+
flex: 1;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
text-overflow: ellipsis;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
font-size: var(--agent-artifact-title-size);
|
|
62
|
+
font-weight: var(--agent-artifact-title-weight);
|
|
63
|
+
color: var(--agent-artifact-fg);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* [data-artifact-kind] is a <badge-ui size="sm"> — it brings its own pill
|
|
67
|
+
chrome (bg, radius, size, weight). We only tweak tracking so the
|
|
68
|
+
uppercase kind reads as a tag, not a label. */
|
|
69
|
+
[data-artifact-kind] {
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
letter-spacing: 0.04em;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-artifact-actions] {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
gap: var(--a-space-1);
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[data-artifact-chevron] {
|
|
82
|
+
flex-shrink: 0;
|
|
83
|
+
transition: transform var(--agent-artifact-duration);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
[data-artifact-body] {
|
|
87
|
+
padding: var(--agent-artifact-padding);
|
|
88
|
+
min-width: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:scope[collapsed] [data-artifact-header] {
|
|
92
|
+
border-block-end: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <agent-artifact-ui> — Inline container for a structured agent artifact.
|
|
3
|
+
*
|
|
4
|
+
* Wraps an artifact (A2UI UI, JSON blob, ticket, code, etc.) with a compact
|
|
5
|
+
* header showing a title + icon + optional kind badge, and two action slots:
|
|
6
|
+
* "primary" (e.g. "Open in canvas") and "secondary" (e.g. "Download"). The
|
|
7
|
+
* artifact body goes in the default slot.
|
|
8
|
+
*
|
|
9
|
+
* The host can attach any node (code-ui, canvas-ui, div, etc.) as the body.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* <agent-artifact-ui title="product-card" kind="A2UI" icon="layout">
|
|
13
|
+
* <button-ui slot="primary" text="Open in canvas" icon="arrows-out-simple"></button-ui>
|
|
14
|
+
* <button-ui slot="secondary" text="Copy" icon="copy"></button-ui>
|
|
15
|
+
* <code-ui language="json">{…}</code-ui>
|
|
16
|
+
* </agent-artifact-ui>
|
|
17
|
+
*
|
|
18
|
+
* Attributes:
|
|
19
|
+
* title — header title (string)
|
|
20
|
+
* kind — small uppercase badge, e.g. "A2UI", "JSON", "TICKET"
|
|
21
|
+
* icon — icon-ui name for the header
|
|
22
|
+
* collapsed — start collapsed (body hidden)
|
|
23
|
+
* tone — neutral (default) | accent | warning | danger
|
|
24
|
+
*
|
|
25
|
+
* Events:
|
|
26
|
+
* artifact-toggle — detail: { collapsed }
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { AdiaElement } from '@core/element.js';
|
|
30
|
+
|
|
31
|
+
const TONE_TO_BADGE_VARIANT = {
|
|
32
|
+
neutral: 'default',
|
|
33
|
+
accent: 'accent',
|
|
34
|
+
warning: 'warning',
|
|
35
|
+
danger: 'danger',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
class AdiaAgentArtifact extends AdiaElement {
|
|
39
|
+
static properties = {
|
|
40
|
+
title: { type: String, default: '', reflect: true },
|
|
41
|
+
kind: { type: String, default: '', reflect: true },
|
|
42
|
+
icon: { type: String, default: '', reflect: true },
|
|
43
|
+
collapsed: { type: Boolean, default: false, reflect: true },
|
|
44
|
+
tone: { type: String, default: 'neutral', reflect: true },
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
static template = () => null;
|
|
48
|
+
|
|
49
|
+
#headerEl = null;
|
|
50
|
+
#iconEl = null;
|
|
51
|
+
#titleEl = null;
|
|
52
|
+
#kindEl = null;
|
|
53
|
+
#chevronEl = null;
|
|
54
|
+
#bodyEl = null;
|
|
55
|
+
|
|
56
|
+
connected() {
|
|
57
|
+
this.#build();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
disconnected() {
|
|
61
|
+
this.#headerEl?.removeEventListener('click', this.#onHeaderClick);
|
|
62
|
+
this.#headerEl = this.#iconEl = this.#titleEl = null;
|
|
63
|
+
this.#kindEl = this.#chevronEl = this.#bodyEl = null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#onHeaderClick = (e) => {
|
|
67
|
+
// Ignore clicks that land on header action buttons
|
|
68
|
+
if (e.target.closest('[slot="primary"], [slot="secondary"]')) return;
|
|
69
|
+
this.collapsed = !this.collapsed;
|
|
70
|
+
this.dispatchEvent(new CustomEvent('artifact-toggle', {
|
|
71
|
+
bubbles: true, detail: { collapsed: this.collapsed },
|
|
72
|
+
}));
|
|
73
|
+
this.render();
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
render() {
|
|
77
|
+
if (!this.#headerEl) return;
|
|
78
|
+
|
|
79
|
+
if (this.#iconEl) {
|
|
80
|
+
if (this.icon) { this.#iconEl.setAttribute('name', this.icon); this.#iconEl.hidden = false; }
|
|
81
|
+
else { this.#iconEl.hidden = true; }
|
|
82
|
+
}
|
|
83
|
+
if (this.#titleEl) {
|
|
84
|
+
this.#titleEl.textContent = this.title || '';
|
|
85
|
+
this.#titleEl.hidden = !this.title;
|
|
86
|
+
}
|
|
87
|
+
if (this.#kindEl) {
|
|
88
|
+
this.#kindEl.setAttribute('text', (this.kind || '').toUpperCase());
|
|
89
|
+
this.#kindEl.setAttribute('variant', TONE_TO_BADGE_VARIANT[this.tone] || 'default');
|
|
90
|
+
this.#kindEl.hidden = !this.kind;
|
|
91
|
+
}
|
|
92
|
+
if (this.#chevronEl) {
|
|
93
|
+
this.#chevronEl.setAttribute('name', this.collapsed ? 'caret-right' : 'caret-down');
|
|
94
|
+
}
|
|
95
|
+
if (this.#bodyEl) {
|
|
96
|
+
this.#bodyEl.hidden = this.collapsed;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#build() {
|
|
101
|
+
// We operate in a slotted model: the author's children that match
|
|
102
|
+
// slot="primary"/slot="secondary" live in the header; the rest is body.
|
|
103
|
+
// We build scaffolding DOM around those children without reparenting.
|
|
104
|
+
//
|
|
105
|
+
// To keep the Light-DOM approach consistent, we wrap existing children
|
|
106
|
+
// into a body container if one isn't already present.
|
|
107
|
+
|
|
108
|
+
// Capture any existing non-slotted children to put into the body wrapper
|
|
109
|
+
const existingBodyNodes = Array.from(this.childNodes).filter((n) => {
|
|
110
|
+
if (n.nodeType === 1) {
|
|
111
|
+
const slot = /** @type {Element} */ (n).getAttribute?.('slot') || '';
|
|
112
|
+
return slot !== 'primary' && slot !== 'secondary';
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Clear — we'll rebuild, preserving slotted action buttons
|
|
118
|
+
const primaryBtns = this.querySelectorAll(':scope > [slot="primary"]');
|
|
119
|
+
const secondaryBtns = this.querySelectorAll(':scope > [slot="secondary"]');
|
|
120
|
+
|
|
121
|
+
this.innerHTML = '';
|
|
122
|
+
|
|
123
|
+
// Header
|
|
124
|
+
this.#headerEl = document.createElement('div');
|
|
125
|
+
this.#headerEl.setAttribute('data-artifact-header', '');
|
|
126
|
+
this.#headerEl.addEventListener('click', this.#onHeaderClick);
|
|
127
|
+
|
|
128
|
+
this.#iconEl = document.createElement('icon-ui');
|
|
129
|
+
this.#iconEl.setAttribute('data-artifact-icon', '');
|
|
130
|
+
this.#iconEl.setAttribute('color', 'muted');
|
|
131
|
+
if (this.icon) this.#iconEl.setAttribute('name', this.icon);
|
|
132
|
+
else this.#iconEl.hidden = true;
|
|
133
|
+
|
|
134
|
+
this.#titleEl = document.createElement('span');
|
|
135
|
+
this.#titleEl.setAttribute('data-artifact-title', '');
|
|
136
|
+
if (this.title) this.#titleEl.textContent = this.title;
|
|
137
|
+
else this.#titleEl.hidden = true;
|
|
138
|
+
|
|
139
|
+
this.#kindEl = document.createElement('badge-ui');
|
|
140
|
+
this.#kindEl.setAttribute('data-artifact-kind', '');
|
|
141
|
+
this.#kindEl.setAttribute('size', 'sm');
|
|
142
|
+
this.#kindEl.setAttribute('variant', TONE_TO_BADGE_VARIANT[this.tone] || 'default');
|
|
143
|
+
if (this.kind) this.#kindEl.setAttribute('text', this.kind.toUpperCase());
|
|
144
|
+
else this.#kindEl.hidden = true;
|
|
145
|
+
|
|
146
|
+
const actions = document.createElement('span');
|
|
147
|
+
actions.setAttribute('data-artifact-actions', '');
|
|
148
|
+
for (const btn of secondaryBtns) actions.appendChild(btn);
|
|
149
|
+
for (const btn of primaryBtns) actions.appendChild(btn);
|
|
150
|
+
|
|
151
|
+
this.#chevronEl = document.createElement('icon-ui');
|
|
152
|
+
this.#chevronEl.setAttribute('color', 'muted');
|
|
153
|
+
this.#chevronEl.setAttribute('data-artifact-chevron', '');
|
|
154
|
+
this.#chevronEl.setAttribute('name', this.collapsed ? 'caret-right' : 'caret-down');
|
|
155
|
+
|
|
156
|
+
this.#headerEl.append(this.#iconEl, this.#titleEl, this.#kindEl, actions, this.#chevronEl);
|
|
157
|
+
|
|
158
|
+
// Body
|
|
159
|
+
this.#bodyEl = document.createElement('div');
|
|
160
|
+
this.#bodyEl.setAttribute('data-artifact-body', '');
|
|
161
|
+
for (const n of existingBodyNodes) this.#bodyEl.appendChild(n);
|
|
162
|
+
if (this.collapsed) this.#bodyEl.hidden = true;
|
|
163
|
+
|
|
164
|
+
this.append(this.#headerEl, this.#bodyEl);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
customElements.define('agent-artifact-ui', AdiaAgentArtifact);
|
|
169
|
+
export { AdiaAgentArtifact };
|