@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,470 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <noodles-ui editable show-ports>
|
|
3
|
+
* <div data-noodle-port="left right">Node A</div>
|
|
4
|
+
* <div data-noodle-port="top bottom">Node B</div>
|
|
5
|
+
* </noodles-ui>
|
|
6
|
+
*
|
|
7
|
+
* Renders SVG connection lines ("noodles") between children that declare
|
|
8
|
+
* ports via the data-noodle-port attribute (space-separated sides).
|
|
9
|
+
*
|
|
10
|
+
* Supports bezier, step, and straight curve modes.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { AdiaElement } from '@core/element.js';
|
|
14
|
+
|
|
15
|
+
let nextId = 0;
|
|
16
|
+
|
|
17
|
+
class AdiaNoodles extends AdiaElement {
|
|
18
|
+
static properties = {
|
|
19
|
+
editable: { type: Boolean, default: false, reflect: true },
|
|
20
|
+
color: { type: String, default: '', reflect: true },
|
|
21
|
+
strokeWidth: { type: Number, default: 2, reflect: true, attribute: 'stroke-width' },
|
|
22
|
+
tension: { type: Number, default: 0.5, reflect: true },
|
|
23
|
+
showPorts: { type: Boolean, default: false, reflect: true, attribute: 'show-ports' },
|
|
24
|
+
portSize: { type: Number, default: 10, attribute: 'port-size', reflect: true },
|
|
25
|
+
curve: { type: String, default: 'bezier', reflect: true },
|
|
26
|
+
animated: { type: Boolean, default: false, reflect: true },
|
|
27
|
+
readonly: { type: Boolean, default: false, reflect: true },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
static template = () => null;
|
|
31
|
+
|
|
32
|
+
#svg = null;
|
|
33
|
+
#connections = [];
|
|
34
|
+
#portIndicators = new Map(); // key: "elIndex:side" -> DOM element
|
|
35
|
+
#resizeObs = null;
|
|
36
|
+
#mutationObs = null;
|
|
37
|
+
#rafId = null;
|
|
38
|
+
#bound = false;
|
|
39
|
+
#dragState = null;
|
|
40
|
+
#dragPath = null;
|
|
41
|
+
|
|
42
|
+
// ── Public API ──────────────────────────────────────────────
|
|
43
|
+
|
|
44
|
+
get connections() {
|
|
45
|
+
return this.#connections.map(c => ({ ...c }));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
connect(from, to, fromPort = 'right', toPort = 'left') {
|
|
49
|
+
const id = `noodle-${++nextId}`;
|
|
50
|
+
const conn = { id, from, to, fromPort, toPort };
|
|
51
|
+
this.#connections.push(conn);
|
|
52
|
+
this.#scheduleUpdate();
|
|
53
|
+
this.dispatchEvent(new CustomEvent('noodle-connect', {
|
|
54
|
+
bubbles: true, detail: { ...conn },
|
|
55
|
+
}));
|
|
56
|
+
return id;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
disconnect(id) {
|
|
60
|
+
const idx = this.#connections.findIndex(c => c.id === id);
|
|
61
|
+
if (idx === -1) return;
|
|
62
|
+
const [conn] = this.#connections.splice(idx, 1);
|
|
63
|
+
this.#scheduleUpdate();
|
|
64
|
+
this.dispatchEvent(new CustomEvent('noodle-disconnect', {
|
|
65
|
+
bubbles: true, detail: { ...conn },
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setConnections(list) {
|
|
70
|
+
this.#connections = list.map(c => ({
|
|
71
|
+
id: c.id || `noodle-${++nextId}`,
|
|
72
|
+
from: c.from,
|
|
73
|
+
to: c.to,
|
|
74
|
+
fromPort: c.fromPort || 'right',
|
|
75
|
+
toPort: c.toPort || 'left',
|
|
76
|
+
}));
|
|
77
|
+
this.#scheduleUpdate();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
clear() {
|
|
81
|
+
this.#connections = [];
|
|
82
|
+
this.#scheduleUpdate();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
update() {
|
|
86
|
+
this.#performUpdate();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ── Lifecycle ───────────────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
connected() {
|
|
92
|
+
// Create the SVG overlay
|
|
93
|
+
this.#svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
94
|
+
this.#svg.setAttribute('data-noodle-svg', '');
|
|
95
|
+
this.prepend(this.#svg);
|
|
96
|
+
|
|
97
|
+
// Observers for child layout changes
|
|
98
|
+
this.#resizeObs = new ResizeObserver(() => this.#scheduleUpdate());
|
|
99
|
+
this.#mutationObs = new MutationObserver(() => {
|
|
100
|
+
this.#rebuildPortIndicators();
|
|
101
|
+
this.#scheduleUpdate();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
this.#resizeObs.observe(this);
|
|
105
|
+
this.#observeMutations();
|
|
106
|
+
|
|
107
|
+
// Observe each port-bearing child
|
|
108
|
+
for (const child of this.#getPortChildren()) {
|
|
109
|
+
this.#resizeObs.observe(child);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.#rebuildPortIndicators();
|
|
113
|
+
this.#scheduleUpdate();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
render() {
|
|
117
|
+
if (!this.#svg) return;
|
|
118
|
+
// Update SVG attributes from properties
|
|
119
|
+
if (this.color) {
|
|
120
|
+
this.#svg.style.setProperty('--noodles-stroke', this.color);
|
|
121
|
+
} else {
|
|
122
|
+
this.#svg.style.removeProperty('--noodles-stroke');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
disconnected() {
|
|
127
|
+
this.#resizeObs?.disconnect();
|
|
128
|
+
this.#mutationObs?.disconnect();
|
|
129
|
+
if (this.#rafId) cancelAnimationFrame(this.#rafId);
|
|
130
|
+
this.#rafId = null;
|
|
131
|
+
this.#clearPortIndicators();
|
|
132
|
+
this.#svg?.remove();
|
|
133
|
+
this.#svg = null;
|
|
134
|
+
this.#bound = false;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ── Update scheduling ───────────────────────────────────────
|
|
138
|
+
|
|
139
|
+
#scheduleUpdate() {
|
|
140
|
+
if (this.#rafId) return;
|
|
141
|
+
this.#rafId = requestAnimationFrame(() => {
|
|
142
|
+
this.#rafId = null;
|
|
143
|
+
this.#performUpdate();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#observeMutations() {
|
|
148
|
+
this.#mutationObs?.observe(this, {
|
|
149
|
+
childList: true,
|
|
150
|
+
subtree: true,
|
|
151
|
+
attributes: true,
|
|
152
|
+
attributeFilter: ['data-noodle-port', 'style'],
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#pauseMutations() {
|
|
157
|
+
this.#mutationObs?.disconnect();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
#performUpdate() {
|
|
161
|
+
if (!this.#svg) return;
|
|
162
|
+
this.#pauseMutations();
|
|
163
|
+
|
|
164
|
+
// Sync resize observer with current port children
|
|
165
|
+
const portChildren = this.#getPortChildren();
|
|
166
|
+
for (const child of portChildren) {
|
|
167
|
+
this.#resizeObs.observe(child);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Update port indicator positions
|
|
171
|
+
this.#updatePortIndicatorPositions();
|
|
172
|
+
|
|
173
|
+
// Render paths
|
|
174
|
+
const pathData = this.#connections.map(conn => {
|
|
175
|
+
const fromEl = this.#resolveElement(conn.from);
|
|
176
|
+
const toEl = this.#resolveElement(conn.to);
|
|
177
|
+
if (!fromEl || !toEl) return null;
|
|
178
|
+
|
|
179
|
+
const p1 = this.#getPortPosition(fromEl, conn.fromPort);
|
|
180
|
+
const p2 = this.#getPortPosition(toEl, conn.toPort);
|
|
181
|
+
if (!p1 || !p2) return null;
|
|
182
|
+
|
|
183
|
+
return { id: conn.id, d: this.#computePath(p1, p2, conn.fromPort, conn.toPort) };
|
|
184
|
+
}).filter(Boolean);
|
|
185
|
+
|
|
186
|
+
// Reconcile SVG path elements
|
|
187
|
+
const existing = new Map();
|
|
188
|
+
for (const path of this.#svg.querySelectorAll('path[data-noodle-id]')) {
|
|
189
|
+
existing.set(path.getAttribute('data-noodle-id'), path);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const activeIds = new Set(pathData.map(p => p.id));
|
|
193
|
+
|
|
194
|
+
// Remove stale paths
|
|
195
|
+
for (const [id, path] of existing) {
|
|
196
|
+
if (!activeIds.has(id)) path.remove();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Add/update paths
|
|
200
|
+
for (const { id, d } of pathData) {
|
|
201
|
+
let path = existing.get(id);
|
|
202
|
+
if (!path) {
|
|
203
|
+
path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
204
|
+
path.setAttribute('data-noodle-id', id);
|
|
205
|
+
this.#svg.appendChild(path);
|
|
206
|
+
}
|
|
207
|
+
path.setAttribute('d', d);
|
|
208
|
+
path.setAttribute('stroke-width', this.strokeWidth);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Render drag preview path
|
|
212
|
+
if (this.#dragState && this.#dragPath) {
|
|
213
|
+
let preview = this.#svg.querySelector('path[data-noodle-preview]');
|
|
214
|
+
if (!preview) {
|
|
215
|
+
preview = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
216
|
+
preview.setAttribute('data-noodle-preview', '');
|
|
217
|
+
preview.style.opacity = '0.5';
|
|
218
|
+
preview.style.strokeDasharray = '6 3';
|
|
219
|
+
this.#svg.appendChild(preview);
|
|
220
|
+
}
|
|
221
|
+
preview.setAttribute('d', this.#dragPath);
|
|
222
|
+
preview.setAttribute('stroke-width', this.strokeWidth);
|
|
223
|
+
} else {
|
|
224
|
+
this.#svg.querySelector('path[data-noodle-preview]')?.remove();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
this.#observeMutations();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// ── Element resolution ──────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
#resolveElement(ref) {
|
|
233
|
+
if (ref instanceof HTMLElement) return ref;
|
|
234
|
+
if (typeof ref === 'string') return this.querySelector(`#${CSS.escape(ref)}`);
|
|
235
|
+
if (typeof ref === 'number') return this.#getPortChildren()[ref] ?? null;
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#getPortChildren() {
|
|
240
|
+
return [...this.querySelectorAll('[data-noodle-port]')];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// ── Port position computation ──────────────────────────────
|
|
244
|
+
|
|
245
|
+
#getPortPosition(el, side) {
|
|
246
|
+
const left = el.offsetLeft;
|
|
247
|
+
const top = el.offsetTop;
|
|
248
|
+
const w = el.offsetWidth;
|
|
249
|
+
const h = el.offsetHeight;
|
|
250
|
+
|
|
251
|
+
switch (side) {
|
|
252
|
+
case 'left': return { x: left, y: top + h / 2 };
|
|
253
|
+
case 'right': return { x: left + w, y: top + h / 2 };
|
|
254
|
+
case 'top': return { x: left + w / 2, y: top };
|
|
255
|
+
case 'bottom': return { x: left + w / 2, y: top + h };
|
|
256
|
+
default: return { x: left + w / 2, y: top + h / 2 };
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// ── Path computation ───────────────────────────────────────
|
|
261
|
+
|
|
262
|
+
#computePath(p1, p2, fromSide, toSide) {
|
|
263
|
+
switch (this.curve) {
|
|
264
|
+
case 'step': return this.#stepPath(p1, p2);
|
|
265
|
+
case 'straight': return this.#straightPath(p1, p2);
|
|
266
|
+
case 'bezier':
|
|
267
|
+
default: return this.#bezierPath(p1, p2, fromSide, toSide);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
#bezierPath(p1, p2, fromSide, toSide) {
|
|
272
|
+
const dx = Math.abs(p2.x - p1.x);
|
|
273
|
+
const dy = Math.abs(p2.y - p1.y);
|
|
274
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
275
|
+
const offset = Math.max(50, dist * this.tension);
|
|
276
|
+
|
|
277
|
+
const c1 = this.#controlPoint(p1, fromSide, offset);
|
|
278
|
+
const c2 = this.#controlPoint(p2, toSide, offset);
|
|
279
|
+
|
|
280
|
+
return `M ${p1.x} ${p1.y} C ${c1.x} ${c1.y}, ${c2.x} ${c2.y}, ${p2.x} ${p2.y}`;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
#controlPoint(p, side, offset) {
|
|
284
|
+
switch (side) {
|
|
285
|
+
case 'left': return { x: p.x - offset, y: p.y };
|
|
286
|
+
case 'right': return { x: p.x + offset, y: p.y };
|
|
287
|
+
case 'top': return { x: p.x, y: p.y - offset };
|
|
288
|
+
case 'bottom': return { x: p.x, y: p.y + offset };
|
|
289
|
+
default: return { x: p.x + offset, y: p.y };
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
#stepPath(p1, p2) {
|
|
294
|
+
const midX = (p1.x + p2.x) / 2;
|
|
295
|
+
return `M ${p1.x} ${p1.y} L ${midX} ${p1.y} L ${midX} ${p2.y} L ${p2.x} ${p2.y}`;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
#straightPath(p1, p2) {
|
|
299
|
+
return `M ${p1.x} ${p1.y} L ${p2.x} ${p2.y}`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ── Port indicators ────────────────────────────────────────
|
|
303
|
+
|
|
304
|
+
#rebuildPortIndicators() {
|
|
305
|
+
this.#pauseMutations();
|
|
306
|
+
this.#clearPortIndicators();
|
|
307
|
+
|
|
308
|
+
const children = this.#getPortChildren();
|
|
309
|
+
for (const child of children) {
|
|
310
|
+
const sides = (child.getAttribute('data-noodle-port') || '').split(/\s+/).filter(Boolean);
|
|
311
|
+
for (const side of sides) {
|
|
312
|
+
const key = this.#portKey(child, side);
|
|
313
|
+
const dot = document.createElement('div');
|
|
314
|
+
dot.setAttribute('data-noodle-port-indicator', '');
|
|
315
|
+
dot.setAttribute('data-noodle-side', side);
|
|
316
|
+
dot.dataset.portElement = child.id || '';
|
|
317
|
+
|
|
318
|
+
if (this.editable) {
|
|
319
|
+
dot.addEventListener('pointerdown', (e) => this.#onPortPointerDown(e, child, side));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
this.appendChild(dot);
|
|
323
|
+
this.#portIndicators.set(key, dot);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
this.#updatePortIndicatorPositions();
|
|
328
|
+
this.#observeMutations();
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
#clearPortIndicators() {
|
|
332
|
+
for (const [, dot] of this.#portIndicators) {
|
|
333
|
+
dot.remove();
|
|
334
|
+
}
|
|
335
|
+
this.#portIndicators.clear();
|
|
336
|
+
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
#updatePortIndicatorPositions() {
|
|
340
|
+
const children = this.#getPortChildren();
|
|
341
|
+
for (const child of children) {
|
|
342
|
+
const sides = (child.getAttribute('data-noodle-port') || '').split(/\s+/).filter(Boolean);
|
|
343
|
+
for (const side of sides) {
|
|
344
|
+
const key = this.#portKey(child, side);
|
|
345
|
+
const dot = this.#portIndicators.get(key);
|
|
346
|
+
if (!dot) continue;
|
|
347
|
+
|
|
348
|
+
const pos = this.#getPortPosition(child, side);
|
|
349
|
+
dot.style.left = `${pos.x}px`;
|
|
350
|
+
dot.style.top = `${pos.y}px`;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
#portKey(el, side) {
|
|
356
|
+
// Use a stable identifier
|
|
357
|
+
if (!el._noodleId) el._noodleId = `_n${++nextId}`;
|
|
358
|
+
return `${el._noodleId}:${side}`;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// ── Drag to connect ────────────────────────────────────────
|
|
362
|
+
|
|
363
|
+
#onPortPointerDown = (e, fromEl, fromSide) => {
|
|
364
|
+
if (!this.editable || this.readonly) return;
|
|
365
|
+
e.preventDefault();
|
|
366
|
+
e.stopPropagation();
|
|
367
|
+
|
|
368
|
+
const dot = e.currentTarget;
|
|
369
|
+
dot.setPointerCapture(e.pointerId);
|
|
370
|
+
dot.setAttribute('data-noodle-dragging', '');
|
|
371
|
+
|
|
372
|
+
const startPos = this.#getPortPosition(fromEl, fromSide);
|
|
373
|
+
|
|
374
|
+
this.#dragState = { fromEl, fromSide, startPos, pointerId: e.pointerId };
|
|
375
|
+
this.#dragPath = null;
|
|
376
|
+
|
|
377
|
+
const onMove = (ev) => {
|
|
378
|
+
if (!this.#dragState) return;
|
|
379
|
+
const rect = this.getBoundingClientRect();
|
|
380
|
+
const mx = ev.clientX - rect.left;
|
|
381
|
+
const my = ev.clientY - rect.top;
|
|
382
|
+
|
|
383
|
+
this.#dragPath = this.#computePath(
|
|
384
|
+
startPos, { x: mx, y: my }, fromSide, this.#inferSide(startPos, { x: mx, y: my })
|
|
385
|
+
);
|
|
386
|
+
this.#scheduleUpdate();
|
|
387
|
+
|
|
388
|
+
// Highlight potential drop targets
|
|
389
|
+
this.#updateDropTargets(ev.clientX, ev.clientY, fromEl);
|
|
390
|
+
|
|
391
|
+
this.dispatchEvent(new CustomEvent('noodle-drag', {
|
|
392
|
+
bubbles: true,
|
|
393
|
+
detail: { from: fromEl, fromPort: fromSide, x: mx, y: my },
|
|
394
|
+
}));
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
const onUp = (ev) => {
|
|
398
|
+
dot.releasePointerCapture(ev.pointerId);
|
|
399
|
+
dot.removeAttribute('data-noodle-dragging');
|
|
400
|
+
dot.removeEventListener('pointermove', onMove);
|
|
401
|
+
dot.removeEventListener('pointerup', onUp);
|
|
402
|
+
|
|
403
|
+
// Check if dropped on a target port
|
|
404
|
+
const target = this.#findDropTarget(ev.clientX, ev.clientY, fromEl);
|
|
405
|
+
if (target) {
|
|
406
|
+
this.connect(fromEl, target.el, fromSide, target.side);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
this.#clearDropTargets();
|
|
410
|
+
this.#dragState = null;
|
|
411
|
+
this.#dragPath = null;
|
|
412
|
+
this.#scheduleUpdate();
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
dot.addEventListener('pointermove', onMove);
|
|
416
|
+
dot.addEventListener('pointerup', onUp);
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
#inferSide(from, to) {
|
|
420
|
+
const dx = to.x - from.x;
|
|
421
|
+
const dy = to.y - from.y;
|
|
422
|
+
if (Math.abs(dx) > Math.abs(dy)) {
|
|
423
|
+
return dx > 0 ? 'left' : 'right';
|
|
424
|
+
}
|
|
425
|
+
return dy > 0 ? 'top' : 'bottom';
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
#updateDropTargets(clientX, clientY, excludeEl) {
|
|
429
|
+
this.#clearDropTargets();
|
|
430
|
+
const target = this.#findDropTarget(clientX, clientY, excludeEl);
|
|
431
|
+
if (target?.dot) {
|
|
432
|
+
target.dot.setAttribute('data-noodle-drop-ready', '');
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
#findDropTarget(clientX, clientY, excludeEl) {
|
|
437
|
+
const hitRadius = this.portSize * 2;
|
|
438
|
+
let best = null;
|
|
439
|
+
let bestDist = Infinity;
|
|
440
|
+
|
|
441
|
+
for (const [key, dot] of this.#portIndicators) {
|
|
442
|
+
const rect = dot.getBoundingClientRect();
|
|
443
|
+
const cx = rect.left + rect.width / 2;
|
|
444
|
+
const cy = rect.top + rect.height / 2;
|
|
445
|
+
const dist = Math.sqrt((clientX - cx) ** 2 + (clientY - cy) ** 2);
|
|
446
|
+
|
|
447
|
+
// Parse the key to find the element
|
|
448
|
+
const [noodleId, side] = key.split(':');
|
|
449
|
+
const el = this.#getPortChildren().find(c => c._noodleId === noodleId);
|
|
450
|
+
if (!el || el === excludeEl) continue;
|
|
451
|
+
|
|
452
|
+
if (dist < hitRadius && dist < bestDist) {
|
|
453
|
+
bestDist = dist;
|
|
454
|
+
best = { el, side, dot };
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return best;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
#clearDropTargets() {
|
|
462
|
+
for (const [, dot] of this.#portIndicators) {
|
|
463
|
+
dot.removeAttribute('data-noodle-drop-ready');
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
customElements.define('noodles-ui', AdiaNoodles);
|
|
469
|
+
|
|
470
|
+
export { AdiaNoodles };
|
|
@@ -0,0 +1,123 @@
|
|
|
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: AdiaNoodles
|
|
5
|
+
tag: noodles-ui
|
|
6
|
+
component: Noodles
|
|
7
|
+
category: agent
|
|
8
|
+
version: 1
|
|
9
|
+
description: SVG connection lines (noodles) between children with declared ports. Supports bezier,
|
|
10
|
+
step, and straight curves.
|
|
11
|
+
props:
|
|
12
|
+
animated:
|
|
13
|
+
description: Flowing dash animation on noodles
|
|
14
|
+
type: boolean
|
|
15
|
+
default: false
|
|
16
|
+
color:
|
|
17
|
+
description: Noodle stroke color. Defaults to --a-accent
|
|
18
|
+
type: string
|
|
19
|
+
default: ""
|
|
20
|
+
curve:
|
|
21
|
+
description: Noodle curve style
|
|
22
|
+
type: string
|
|
23
|
+
default: bezier
|
|
24
|
+
enum:
|
|
25
|
+
- bezier
|
|
26
|
+
- step
|
|
27
|
+
- straight
|
|
28
|
+
disabled:
|
|
29
|
+
description: Disable the controller. Noodles render as dashed muted lines
|
|
30
|
+
type: boolean
|
|
31
|
+
default: false
|
|
32
|
+
reflect: true
|
|
33
|
+
editable:
|
|
34
|
+
description: Allow interactive creation/deletion of connections via drag
|
|
35
|
+
type: boolean
|
|
36
|
+
default: false
|
|
37
|
+
port-size:
|
|
38
|
+
description: Port indicator dot size in pixels
|
|
39
|
+
type: number
|
|
40
|
+
default: 10
|
|
41
|
+
portSize:
|
|
42
|
+
description: Port indicator size
|
|
43
|
+
type: number
|
|
44
|
+
default: 10
|
|
45
|
+
attribute: port-size
|
|
46
|
+
readonly:
|
|
47
|
+
description: View-only mode; disables drag/edit while keeping connections visible
|
|
48
|
+
type: boolean
|
|
49
|
+
default: false
|
|
50
|
+
reflect: true
|
|
51
|
+
show-ports:
|
|
52
|
+
description: Show port indicator dots. Defaults to true when editable
|
|
53
|
+
type: boolean
|
|
54
|
+
default: false
|
|
55
|
+
showPorts:
|
|
56
|
+
description: Show port indicators
|
|
57
|
+
type: boolean
|
|
58
|
+
default: false
|
|
59
|
+
attribute: show-ports
|
|
60
|
+
stroke-width:
|
|
61
|
+
description: Stroke width in pixels
|
|
62
|
+
type: number
|
|
63
|
+
default: 2
|
|
64
|
+
strokeWidth:
|
|
65
|
+
description: Line stroke width
|
|
66
|
+
type: number
|
|
67
|
+
default: 2
|
|
68
|
+
attribute: stroke-width
|
|
69
|
+
tension:
|
|
70
|
+
description: Bezier control point distance (0-1). Higher = wider curves
|
|
71
|
+
type: number
|
|
72
|
+
default: 0.5
|
|
73
|
+
events:
|
|
74
|
+
noodle-connect:
|
|
75
|
+
description: "Fired when a connection is created. detail: { id, from, to, fromPort, toPort }"
|
|
76
|
+
noodle-disconnect:
|
|
77
|
+
description: "Fired when a connection is removed. detail: { id, from, to, fromPort, toPort }"
|
|
78
|
+
noodle-drag:
|
|
79
|
+
description: "Fired during drag-to-connect. detail: { from, fromPort, x, y, reconnect }"
|
|
80
|
+
slots: {}
|
|
81
|
+
states:
|
|
82
|
+
- name: idle
|
|
83
|
+
description: Default, ready for interaction.
|
|
84
|
+
- name: disabled
|
|
85
|
+
description: Non-interactive; dimmed.
|
|
86
|
+
attribute: disabled
|
|
87
|
+
traits: []
|
|
88
|
+
tokens:
|
|
89
|
+
--noodles-duration:
|
|
90
|
+
description: Transition duration for noodle animations
|
|
91
|
+
--noodles-easing:
|
|
92
|
+
description: Easing function for noodle animations
|
|
93
|
+
a2ui:
|
|
94
|
+
rules: []
|
|
95
|
+
anti_patterns: []
|
|
96
|
+
examples:
|
|
97
|
+
- name: basic-noodles
|
|
98
|
+
description: Basic Noodles usage
|
|
99
|
+
a2ui: >-
|
|
100
|
+
[
|
|
101
|
+
{
|
|
102
|
+
"id": "root",
|
|
103
|
+
"component": "Card",
|
|
104
|
+
"children": [
|
|
105
|
+
"sec"
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"id": "sec",
|
|
110
|
+
"component": "Section",
|
|
111
|
+
"children": [
|
|
112
|
+
"comp"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "comp",
|
|
117
|
+
"component": "Noodles"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
keywords:
|
|
121
|
+
- noodles
|
|
122
|
+
synonyms: {}
|
|
123
|
+
related: []
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://adiaui.dev/a2ui/v0_9/components/OtpInput.json",
|
|
4
|
+
"title": "OtpInput",
|
|
5
|
+
"description": "One-time password input with individual digit boxes. Auto-advances on entry, backs up on delete.",
|
|
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
|
+
"component": {
|
|
17
|
+
"const": "OtpInput"
|
|
18
|
+
},
|
|
19
|
+
"disabled": {
|
|
20
|
+
"description": "Disables interaction",
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"default": false
|
|
23
|
+
},
|
|
24
|
+
"length": {
|
|
25
|
+
"description": "Number of digit boxes",
|
|
26
|
+
"type": "number",
|
|
27
|
+
"default": 6
|
|
28
|
+
},
|
|
29
|
+
"name": {
|
|
30
|
+
"description": "Form field name",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": ""
|
|
33
|
+
},
|
|
34
|
+
"separator": {
|
|
35
|
+
"description": "Position to insert a dash separator (0 = no separator)",
|
|
36
|
+
"type": "number",
|
|
37
|
+
"default": 0
|
|
38
|
+
},
|
|
39
|
+
"value": {
|
|
40
|
+
"description": "Current OTP value",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"default": ""
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": [
|
|
46
|
+
"component"
|
|
47
|
+
],
|
|
48
|
+
"unevaluatedProperties": false,
|
|
49
|
+
"x-adiaui": {
|
|
50
|
+
"anti_patterns": [],
|
|
51
|
+
"category": "input",
|
|
52
|
+
"events": {
|
|
53
|
+
"complete": {
|
|
54
|
+
"description": "Fired when all digits are filled. Detail contains { code }."
|
|
55
|
+
},
|
|
56
|
+
"input": {
|
|
57
|
+
"description": "Fired on every digit change"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"examples": [
|
|
61
|
+
{
|
|
62
|
+
"description": "OTP verification form with code input and submit button.",
|
|
63
|
+
"a2ui": "[\n {\n \"id\": \"root\",\n \"component\": \"Card\",\n \"children\": [\n \"hdr\",\n \"sec\"\n ]\n },\n {\n \"id\": \"hdr\",\n \"component\": \"Header\",\n \"children\": [\n \"title\",\n \"desc\"\n ]\n },\n {\n \"id\": \"title\",\n \"component\": \"Text\",\n \"slot\": \"heading\",\n \"textContent\": \"Verify Your Identity\"\n },\n {\n \"id\": \"desc\",\n \"component\": \"Text\",\n \"slot\": \"description\",\n \"textContent\": \"Enter the 6-digit code sent to your email.\"\n },\n {\n \"id\": \"sec\",\n \"component\": \"Section\",\n \"children\": [\n \"col\"\n ]\n },\n {\n \"id\": \"col\",\n \"component\": \"Column\",\n \"children\": [\n \"otp\",\n \"btn\"\n ],\n \"gap\": \"4\",\n \"align\": \"center\"\n },\n {\n \"id\": \"otp\",\n \"component\": \"OtpInput\",\n \"length\": 6\n },\n {\n \"id\": \"btn\",\n \"component\": \"Button\",\n \"text\": \"Verify\",\n \"variant\": \"primary\"\n }\n]",
|
|
64
|
+
"name": "otp-form"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"description": "OTP verification card with 6-digit code input, resend link, and a primary verify button in the footer. Richer than otp-form: includes resend affordance and card footer.",
|
|
68
|
+
"a2ui": "[\n {\n \"id\": \"root\",\n \"component\": \"Card\",\n \"children\": [\n \"hdr\",\n \"sec\",\n \"ftr\"\n ]\n },\n {\n \"id\": \"hdr\",\n \"component\": \"Header\",\n \"children\": [\n \"title\",\n \"desc\"\n ]\n },\n {\n \"id\": \"title\",\n \"component\": \"Text\",\n \"slot\": \"heading\",\n \"variant\": \"section\",\n \"textContent\": \"Verify Your Identity\"\n },\n {\n \"id\": \"desc\",\n \"component\": \"Text\",\n \"slot\": \"description\",\n \"variant\": \"caption\",\n \"textContent\": \"Enter the 6-digit code sent to your device\"\n },\n {\n \"id\": \"sec\",\n \"component\": \"Section\",\n \"children\": [\n \"col\"\n ]\n },\n {\n \"id\": \"col\",\n \"component\": \"Column\",\n \"gap\": \"4\",\n \"align\": \"center\",\n \"children\": [\n \"otp\",\n \"resend-row\"\n ]\n },\n {\n \"id\": \"otp\",\n \"component\": \"OtpInput\",\n \"length\": 6,\n \"name\": \"otp-code\"\n },\n {\n \"id\": \"resend-row\",\n \"component\": \"Row\",\n \"gap\": \"1\",\n \"align\": \"center\",\n \"children\": [\n \"resend-label\",\n \"resend-btn\"\n ]\n },\n {\n \"id\": \"resend-label\",\n \"component\": \"Text\",\n \"variant\": \"caption\",\n \"color\": \"muted\",\n \"textContent\": \"Didn't receive a code?\"\n },\n {\n \"id\": \"resend-btn\",\n \"component\": \"Button\",\n \"text\": \"Resend\",\n \"variant\": \"ghost\",\n \"size\": \"sm\"\n },\n {\n \"id\": \"ftr\",\n \"component\": \"Footer\",\n \"children\": [\n \"verify-btn\"\n ]\n },\n {\n \"id\": \"verify-btn\",\n \"component\": \"Button\",\n \"text\": \"Verify\",\n \"variant\": \"primary\",\n \"block\": true\n }\n]",
|
|
69
|
+
"name": "otp-verification"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"keywords": [
|
|
73
|
+
"otpinput",
|
|
74
|
+
"otp-input",
|
|
75
|
+
"otp",
|
|
76
|
+
"input"
|
|
77
|
+
],
|
|
78
|
+
"name": "AdiaOtpInput",
|
|
79
|
+
"related": [
|
|
80
|
+
"button"
|
|
81
|
+
],
|
|
82
|
+
"slots": {
|
|
83
|
+
"field": {
|
|
84
|
+
"description": "Container for the digit input boxes and optional separator"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"states": [
|
|
88
|
+
{
|
|
89
|
+
"description": "Default, ready for interaction.",
|
|
90
|
+
"name": "idle"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"description": "Non-interactive; dimmed.",
|
|
94
|
+
"attribute": "disabled",
|
|
95
|
+
"name": "disabled"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"synonyms": {},
|
|
99
|
+
"tag": "otp-input-ui",
|
|
100
|
+
"tokens": {},
|
|
101
|
+
"traits": [],
|
|
102
|
+
"version": 1
|
|
103
|
+
}
|
|
104
|
+
}
|