@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,267 @@
|
|
|
1
|
+
/* ═══════════════════════════════════════════════════════════════
|
|
2
|
+
SWIPER-N — CSS-first carousel
|
|
3
|
+
Scroll-snap positioning, native ::scroll-marker dots,
|
|
4
|
+
::scroll-button prev/next, container-query responsive.
|
|
5
|
+
|
|
6
|
+
Structure (JS-stamped):
|
|
7
|
+
swiper-ui ← flex column wrapper
|
|
8
|
+
[data-swiper-track] ← grid scroll container
|
|
9
|
+
<slide children>
|
|
10
|
+
[data-swiper-dots] ← pagination dots (below track)
|
|
11
|
+
[data-swiper-btn prev] ← absolute left paddle
|
|
12
|
+
[data-swiper-btn next] ← absolute right paddle
|
|
13
|
+
═══════════════════════════════════════════════════════════════ */
|
|
14
|
+
|
|
15
|
+
@scope (swiper-ui) {
|
|
16
|
+
:where(:scope) {
|
|
17
|
+
/* ── Layout ── */
|
|
18
|
+
--swiper-gap: var(--a-gap);
|
|
19
|
+
--swiper-peek: var(--a-space-8);
|
|
20
|
+
--swiper-snap: start;
|
|
21
|
+
--swiper-columns: 1;
|
|
22
|
+
|
|
23
|
+
/* ── Pagination dots ── */
|
|
24
|
+
/* Component-intrinsic visual constant; no --a-space-* equivalent */
|
|
25
|
+
--swiper-dot-size: 6px;
|
|
26
|
+
--swiper-dot-gap: var(--a-space-2);
|
|
27
|
+
--swiper-dot-bg: var(--a-border);
|
|
28
|
+
--swiper-dot-bg-active: var(--a-fg);
|
|
29
|
+
--swiper-dot-radius: var(--a-radius-full);
|
|
30
|
+
|
|
31
|
+
/* ── Host vertical rhythm ── */
|
|
32
|
+
--swiper-gap-vertical: var(--a-space-3);
|
|
33
|
+
|
|
34
|
+
/* ── Native scroll-marker group padding ── */
|
|
35
|
+
--swiper-marker-group-py: var(--a-space-3);
|
|
36
|
+
|
|
37
|
+
/* ── Paddle bottom offset ── */
|
|
38
|
+
--swiper-btn-bottom: var(--a-space-3);
|
|
39
|
+
|
|
40
|
+
/* ── Autoplay pause button offset ── */
|
|
41
|
+
--swiper-pause-top: var(--a-space-2);
|
|
42
|
+
--swiper-pause-right: var(--a-space-2);
|
|
43
|
+
|
|
44
|
+
/* ── Paddles ── */
|
|
45
|
+
--swiper-btn-size: 3rem;
|
|
46
|
+
--swiper-btn-bg: transparent;
|
|
47
|
+
--swiper-btn-bg-hover: var(--a-bg-muted);
|
|
48
|
+
--swiper-btn-fg: var(--a-fg);
|
|
49
|
+
--swiper-btn-radius: var(--a-radius-full);
|
|
50
|
+
--swiper-btn-shadow: none;
|
|
51
|
+
--swiper-btn-offset: var(--a-space-2);
|
|
52
|
+
|
|
53
|
+
/* ── Motion ── */
|
|
54
|
+
--swiper-duration: var(--a-duration);
|
|
55
|
+
--swiper-easing: var(--a-easing);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* ── Host: flex column so dots sit below the scroll track ── */
|
|
59
|
+
|
|
60
|
+
:scope {
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
gap: var(--swiper-gap-vertical);
|
|
65
|
+
width: 100%;
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* ── Scroll track (JS wraps slides into this) ── */
|
|
70
|
+
|
|
71
|
+
:scope > [data-swiper-track] {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-auto-flow: column;
|
|
74
|
+
grid-auto-columns: calc(
|
|
75
|
+
(100% - (var(--swiper-columns) - 1) * var(--swiper-gap)) / var(--swiper-columns)
|
|
76
|
+
);
|
|
77
|
+
overflow-x: auto;
|
|
78
|
+
overflow-y: hidden;
|
|
79
|
+
scroll-snap-type: x mandatory;
|
|
80
|
+
scroll-behavior: smooth;
|
|
81
|
+
scrollbar-width: none;
|
|
82
|
+
-webkit-overflow-scrolling: touch;
|
|
83
|
+
gap: var(--swiper-gap);
|
|
84
|
+
container-type: inline-size;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:scope > [data-swiper-track]::-webkit-scrollbar { display: none; }
|
|
88
|
+
|
|
89
|
+
/* ── Slides ── */
|
|
90
|
+
|
|
91
|
+
:scope > [data-swiper-track] > * {
|
|
92
|
+
scroll-snap-align: var(--swiper-snap);
|
|
93
|
+
scroll-snap-stop: always;
|
|
94
|
+
min-width: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* ── Snap alignment ── */
|
|
98
|
+
|
|
99
|
+
:scope[snap="center"] { --swiper-snap: center; }
|
|
100
|
+
:scope[snap="end"] { --swiper-snap: end; }
|
|
101
|
+
|
|
102
|
+
/* ── Peek: show partial adjacent slides ── */
|
|
103
|
+
|
|
104
|
+
:scope[peek] > [data-swiper-track] {
|
|
105
|
+
padding-inline: var(--swiper-peek);
|
|
106
|
+
scroll-padding-inline: var(--swiper-peek);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* ── Explicit slides-per-view ── */
|
|
110
|
+
|
|
111
|
+
:scope[slides-per-view="1"] { --swiper-columns: 1; }
|
|
112
|
+
:scope[slides-per-view="2"] { --swiper-columns: 2; }
|
|
113
|
+
:scope[slides-per-view="3"] { --swiper-columns: 3; }
|
|
114
|
+
:scope[slides-per-view="4"] { --swiper-columns: 4; }
|
|
115
|
+
|
|
116
|
+
/* ── Responsive auto (container queries) ── */
|
|
117
|
+
|
|
118
|
+
:scope:not([slides-per-view]) {
|
|
119
|
+
--swiper-columns: 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@container (min-width: 640px) {
|
|
123
|
+
:scope:not([slides-per-view]) { --swiper-columns: 2; }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@container (min-width: 960px) {
|
|
127
|
+
:scope:not([slides-per-view]) { --swiper-columns: 3; }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* ── Native scroll markers (Chrome 135+) ── */
|
|
131
|
+
|
|
132
|
+
:scope > [data-swiper-track]::scroll-marker-group {
|
|
133
|
+
display: flex;
|
|
134
|
+
gap: var(--swiper-dot-gap);
|
|
135
|
+
justify-content: center;
|
|
136
|
+
padding-block: var(--swiper-marker-group-py);
|
|
137
|
+
position: sticky;
|
|
138
|
+
bottom: 0;
|
|
139
|
+
align-self: end;
|
|
140
|
+
grid-column: 1 / -1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:scope > [data-swiper-track] > *::scroll-marker {
|
|
144
|
+
content: '';
|
|
145
|
+
width: var(--swiper-dot-size);
|
|
146
|
+
height: var(--swiper-dot-size);
|
|
147
|
+
border-radius: var(--swiper-dot-radius);
|
|
148
|
+
background: var(--swiper-dot-bg);
|
|
149
|
+
border: none;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
transition: background var(--swiper-duration) var(--swiper-easing),
|
|
152
|
+
transform var(--swiper-duration) var(--swiper-easing);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:scope > [data-swiper-track] > *::scroll-marker:target-current {
|
|
156
|
+
background: var(--swiper-dot-bg-active);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* ── Native scroll buttons (Chrome 135+) ──
|
|
160
|
+
Disabled — we always stamp JS paddles for consistent
|
|
161
|
+
cross-browser appearance. Uncomment to use native instead. */
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
:scope > [data-swiper-track]::scroll-button(inline-start),
|
|
165
|
+
:scope > [data-swiper-track]::scroll-button(inline-end) {
|
|
166
|
+
position: absolute;
|
|
167
|
+
top: 50%;
|
|
168
|
+
transform: translateY(-50%);
|
|
169
|
+
width: var(--swiper-btn-size);
|
|
170
|
+
height: var(--swiper-btn-size);
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
border-radius: var(--swiper-btn-radius);
|
|
175
|
+
background: var(--swiper-btn-bg);
|
|
176
|
+
color: var(--swiper-btn-fg);
|
|
177
|
+
border: none;
|
|
178
|
+
box-shadow: var(--swiper-btn-shadow);
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
z-index: 2;
|
|
181
|
+
font-size: 1.25em;
|
|
182
|
+
transition: background var(--swiper-duration) var(--swiper-easing),
|
|
183
|
+
opacity var(--swiper-duration) var(--swiper-easing);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
:scope > [data-swiper-track]::scroll-button(inline-start) { content: '\2039'; left: var(--swiper-btn-offset); }
|
|
187
|
+
:scope > [data-swiper-track]::scroll-button(inline-end) { content: '\203A'; right: var(--swiper-btn-offset); }
|
|
188
|
+
|
|
189
|
+
:scope > [data-swiper-track]::scroll-button(inline-start):hover,
|
|
190
|
+
:scope > [data-swiper-track]::scroll-button(inline-end):hover {
|
|
191
|
+
background: var(--swiper-btn-bg-hover);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:scope > [data-swiper-track]::scroll-button(inline-start):disabled,
|
|
195
|
+
:scope > [data-swiper-track]::scroll-button(inline-end):disabled {
|
|
196
|
+
opacity: 0;
|
|
197
|
+
pointer-events: none;
|
|
198
|
+
}
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
/* ══════════════════════════════════════════════════════════
|
|
202
|
+
JS-stamped fallback paddles
|
|
203
|
+
Centered vertically on the track area only.
|
|
204
|
+
══════════════════════════════════════════════════════════ */
|
|
205
|
+
|
|
206
|
+
:scope > [data-swiper-btn] {
|
|
207
|
+
position: absolute;
|
|
208
|
+
top: 0;
|
|
209
|
+
bottom: var(--swiper-btn-bottom);
|
|
210
|
+
margin-block: auto;
|
|
211
|
+
height: fit-content;
|
|
212
|
+
z-index: 2;
|
|
213
|
+
--button-size: var(--swiper-btn-size);
|
|
214
|
+
--button-radius: var(--swiper-btn-radius);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
:scope > [data-swiper-prev] { left: var(--swiper-btn-offset); }
|
|
218
|
+
:scope > [data-swiper-next] { right: var(--swiper-btn-offset); }
|
|
219
|
+
|
|
220
|
+
/* ══════════════════════════════════════════════════════════
|
|
221
|
+
JS-stamped pagination dots
|
|
222
|
+
Normal flow below the track — not inside the scroll area.
|
|
223
|
+
══════════════════════════════════════════════════════════ */
|
|
224
|
+
|
|
225
|
+
:scope > [data-swiper-dots] {
|
|
226
|
+
display: flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
justify-content: center;
|
|
229
|
+
gap: var(--swiper-dot-gap);
|
|
230
|
+
min-height: 1.5rem;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
:scope > [data-swiper-dots] > button {
|
|
234
|
+
width: var(--swiper-dot-size);
|
|
235
|
+
height: var(--swiper-dot-size);
|
|
236
|
+
border-radius: var(--swiper-dot-radius);
|
|
237
|
+
background: var(--swiper-dot-bg);
|
|
238
|
+
border: none;
|
|
239
|
+
padding: calc((1rem - var(--swiper-dot-size)) / 2);
|
|
240
|
+
background-clip: content-box;
|
|
241
|
+
box-sizing: content-box;
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
transition: background var(--swiper-duration) var(--swiper-easing),
|
|
244
|
+
transform var(--swiper-duration) var(--swiper-easing);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
:scope > [data-swiper-dots] > button[aria-current="true"] {
|
|
248
|
+
background: var(--swiper-dot-bg-active);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* ── Autoplay indicator ── */
|
|
252
|
+
|
|
253
|
+
:scope[autoplay] > [data-swiper-pause] {
|
|
254
|
+
position: absolute;
|
|
255
|
+
top: var(--swiper-pause-top);
|
|
256
|
+
right: var(--swiper-pause-right);
|
|
257
|
+
z-index: 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* ── Reduced motion ── */
|
|
261
|
+
|
|
262
|
+
@media (prefers-reduced-motion: reduce) {
|
|
263
|
+
:scope > [data-swiper-track] {
|
|
264
|
+
scroll-behavior: auto;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* <swiper-ui autoplay interval="5000" peek>
|
|
3
|
+
* <img src="slide1.jpg" alt="Slide 1">
|
|
4
|
+
* <card-ui>...</card-ui>
|
|
5
|
+
* <div>Any content</div>
|
|
6
|
+
* </swiper-ui>
|
|
7
|
+
*
|
|
8
|
+
* CSS-first carousel. Scroll-snap does all positioning.
|
|
9
|
+
* JS handles: auto-advance, programmatic API, ARIA, fallback nav.
|
|
10
|
+
*
|
|
11
|
+
* On connect, wraps user children into a [data-swiper-track] scroll
|
|
12
|
+
* container so pagination dots can sit below (outside overflow).
|
|
13
|
+
*
|
|
14
|
+
* Native ::scroll-marker / ::scroll-button in Chrome 135+.
|
|
15
|
+
* JS-stamped button-ui fallback + dots in other browsers.
|
|
16
|
+
*
|
|
17
|
+
* Events:
|
|
18
|
+
* slide-change — { detail: { index, slide } }
|
|
19
|
+
* autoplay-pause — { detail: { reason } }
|
|
20
|
+
* autoplay-resume
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { AdiaElement } from '@core/element.js';
|
|
24
|
+
|
|
25
|
+
class AdiaSwiper extends AdiaElement {
|
|
26
|
+
static properties = {
|
|
27
|
+
autoplay: { type: Boolean, default: false, reflect: true },
|
|
28
|
+
interval: { type: Number, default: 5000, reflect: true },
|
|
29
|
+
noPauseOnHover: { type: Boolean, default: false, reflect: true, attribute: 'no-pause-on-hover' },
|
|
30
|
+
loop: { type: Boolean, default: false, reflect: true },
|
|
31
|
+
peek: { type: Boolean, default: false, reflect: true },
|
|
32
|
+
snap: { type: String, default: 'start', reflect: true },
|
|
33
|
+
gap: { type: String, default: '', reflect: true },
|
|
34
|
+
'slides-per-view': { type: String, default: '', reflect: true },
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
static template = () => null;
|
|
38
|
+
|
|
39
|
+
#track = null;
|
|
40
|
+
#timer = null;
|
|
41
|
+
#observer = null;
|
|
42
|
+
#activeIndex = 0;
|
|
43
|
+
#bound = false;
|
|
44
|
+
#fallbackNav = false;
|
|
45
|
+
|
|
46
|
+
get slides() {
|
|
47
|
+
if (!this.#track) return [];
|
|
48
|
+
return [...this.#track.children];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get activeIndex() { return this.#activeIndex; }
|
|
52
|
+
|
|
53
|
+
connected() {
|
|
54
|
+
// Wrap user children into a scroll track (once)
|
|
55
|
+
if (!this.#track) {
|
|
56
|
+
this.#track = document.createElement('div');
|
|
57
|
+
this.#track.setAttribute('data-swiper-track', '');
|
|
58
|
+
|
|
59
|
+
// Move all current children into the track
|
|
60
|
+
while (this.firstChild) {
|
|
61
|
+
this.#track.appendChild(this.firstChild);
|
|
62
|
+
}
|
|
63
|
+
this.appendChild(this.#track);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ARIA
|
|
67
|
+
this.setAttribute('role', 'region');
|
|
68
|
+
this.setAttribute('aria-roledescription', 'carousel');
|
|
69
|
+
if (!this.getAttribute('aria-label')) {
|
|
70
|
+
this.setAttribute('aria-label', 'Carousel');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.#labelSlides();
|
|
74
|
+
this.#setupObserver();
|
|
75
|
+
this.#setupFallbackNav();
|
|
76
|
+
|
|
77
|
+
if (!this.#bound) {
|
|
78
|
+
this.#bound = true;
|
|
79
|
+
|
|
80
|
+
// Pause on hover/focus (default on; suppress with [no-pause-on-hover])
|
|
81
|
+
if (!this.noPauseOnHover) {
|
|
82
|
+
this.addEventListener('pointerenter', this.#onPauseHover);
|
|
83
|
+
this.addEventListener('pointerleave', this.#onResumeHover);
|
|
84
|
+
this.addEventListener('focusin', this.#onPauseFocus);
|
|
85
|
+
this.addEventListener('focusout', this.#onResumeFocus);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Keyboard navigation
|
|
89
|
+
this.addEventListener('keydown', this.#onKeydown);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (this.autoplay) this.play();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
render() {
|
|
96
|
+
if (this.gap && this.#track) {
|
|
97
|
+
const space = `var(--a-space-${this.gap})`;
|
|
98
|
+
this.style.setProperty('--swiper-gap', space);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
disconnected() {
|
|
103
|
+
this.pause();
|
|
104
|
+
this.#observer?.disconnect();
|
|
105
|
+
this.#observer = null;
|
|
106
|
+
this.removeEventListener('pointerenter', this.#onPauseHover);
|
|
107
|
+
this.removeEventListener('pointerleave', this.#onResumeHover);
|
|
108
|
+
this.removeEventListener('focusin', this.#onPauseFocus);
|
|
109
|
+
this.removeEventListener('focusout', this.#onResumeFocus);
|
|
110
|
+
this.removeEventListener('keydown', this.#onKeydown);
|
|
111
|
+
this.#track = null;
|
|
112
|
+
this.#bound = false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// ── Public API ──
|
|
116
|
+
|
|
117
|
+
next() {
|
|
118
|
+
const slides = this.slides;
|
|
119
|
+
const nextIndex = Math.min(this.#activeIndex + 1, slides.length - 1);
|
|
120
|
+
if (nextIndex !== this.#activeIndex || this.loop) {
|
|
121
|
+
this.goTo(this.loop && nextIndex === this.#activeIndex ? 0 : nextIndex);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
prev() {
|
|
126
|
+
const slides = this.slides;
|
|
127
|
+
const prevIndex = Math.max(this.#activeIndex - 1, 0);
|
|
128
|
+
if (prevIndex !== this.#activeIndex || this.loop) {
|
|
129
|
+
this.goTo(this.loop && prevIndex === this.#activeIndex ? slides.length - 1 : prevIndex);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
goTo(index) {
|
|
134
|
+
const slides = this.slides;
|
|
135
|
+
const slide = slides[index];
|
|
136
|
+
if (slide && this.#track) {
|
|
137
|
+
this.#track.scrollTo({ left: slide.offsetLeft - this.#track.offsetLeft, behavior: 'smooth' });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
play() {
|
|
142
|
+
this.pause();
|
|
143
|
+
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
|
|
144
|
+
|
|
145
|
+
this.#timer = setInterval(() => {
|
|
146
|
+
const slides = this.slides;
|
|
147
|
+
const atEnd = this.#activeIndex >= slides.length - 1;
|
|
148
|
+
if (atEnd && this.loop) this.goTo(0);
|
|
149
|
+
else if (!atEnd) this.next();
|
|
150
|
+
else this.pause();
|
|
151
|
+
}, this.interval || 5000);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
pause() {
|
|
155
|
+
if (this.#timer) {
|
|
156
|
+
clearInterval(this.#timer);
|
|
157
|
+
this.#timer = null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ── Internal ──
|
|
162
|
+
|
|
163
|
+
#labelSlides() {
|
|
164
|
+
const slides = this.slides;
|
|
165
|
+
slides.forEach((slide, i) => {
|
|
166
|
+
slide.setAttribute('role', 'group');
|
|
167
|
+
slide.setAttribute('aria-roledescription', 'slide');
|
|
168
|
+
if (!slide.getAttribute('aria-label')) {
|
|
169
|
+
slide.setAttribute('aria-label', `${i + 1} of ${slides.length}`);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
#setupObserver() {
|
|
175
|
+
this.#observer = new IntersectionObserver(entries => {
|
|
176
|
+
for (const entry of entries) {
|
|
177
|
+
if (entry.isIntersecting && entry.intersectionRatio > 0.5) {
|
|
178
|
+
const slides = this.slides;
|
|
179
|
+
const index = slides.indexOf(entry.target);
|
|
180
|
+
if (index !== -1 && index !== this.#activeIndex) {
|
|
181
|
+
this.#activeIndex = index;
|
|
182
|
+
this.#updateFallbackDots();
|
|
183
|
+
this.dispatchEvent(new CustomEvent('slide-change', {
|
|
184
|
+
bubbles: true,
|
|
185
|
+
detail: { index, slide: entry.target },
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}, { root: this.#track, threshold: 0.5 });
|
|
191
|
+
|
|
192
|
+
for (const slide of this.slides) {
|
|
193
|
+
this.#observer.observe(slide);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
#setupFallbackNav() {
|
|
198
|
+
if (this.#fallbackNav) return;
|
|
199
|
+
this.#fallbackNav = true;
|
|
200
|
+
|
|
201
|
+
// Stamp prev/next paddles
|
|
202
|
+
const prev = document.createElement('button-ui');
|
|
203
|
+
prev.setAttribute('data-swiper-btn', '');
|
|
204
|
+
prev.setAttribute('data-swiper-prev', '');
|
|
205
|
+
prev.setAttribute('icon', 'caret-left');
|
|
206
|
+
prev.setAttribute('variant', 'ghost');
|
|
207
|
+
prev.setAttribute('aria-label', 'Previous slide');
|
|
208
|
+
prev.addEventListener('press', () => this.prev());
|
|
209
|
+
|
|
210
|
+
const next = document.createElement('button-ui');
|
|
211
|
+
next.setAttribute('data-swiper-btn', '');
|
|
212
|
+
next.setAttribute('data-swiper-next', '');
|
|
213
|
+
next.setAttribute('icon', 'caret-right');
|
|
214
|
+
next.setAttribute('variant', 'ghost');
|
|
215
|
+
next.setAttribute('aria-label', 'Next slide');
|
|
216
|
+
next.addEventListener('press', () => this.next());
|
|
217
|
+
|
|
218
|
+
this.appendChild(prev);
|
|
219
|
+
this.appendChild(next);
|
|
220
|
+
|
|
221
|
+
// Stamp pagination dots
|
|
222
|
+
const dots = document.createElement('div');
|
|
223
|
+
dots.setAttribute('data-swiper-dots', '');
|
|
224
|
+
dots.setAttribute('role', 'tablist');
|
|
225
|
+
dots.setAttribute('aria-label', 'Slide indicators');
|
|
226
|
+
|
|
227
|
+
this.slides.forEach((_, i) => {
|
|
228
|
+
const dot = document.createElement('button');
|
|
229
|
+
dot.setAttribute('role', 'tab');
|
|
230
|
+
dot.setAttribute('aria-label', `Slide ${i + 1}`);
|
|
231
|
+
if (i === 0) dot.setAttribute('aria-current', 'true');
|
|
232
|
+
dot.addEventListener('click', () => this.goTo(i));
|
|
233
|
+
dots.appendChild(dot);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
this.appendChild(dots);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
#updateFallbackDots() {
|
|
240
|
+
if (!this.#fallbackNav) return;
|
|
241
|
+
const dots = this.querySelector('[data-swiper-dots]');
|
|
242
|
+
if (!dots) return;
|
|
243
|
+
[...dots.children].forEach((dot, i) => {
|
|
244
|
+
dot.setAttribute('aria-current', i === this.#activeIndex ? 'true' : 'false');
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// ── Event handlers ──
|
|
249
|
+
|
|
250
|
+
#onPauseHover = () => {
|
|
251
|
+
if (this.#timer) {
|
|
252
|
+
this.pause();
|
|
253
|
+
this.dispatchEvent(new CustomEvent('autoplay-pause', { bubbles: true, detail: { reason: 'hover' } }));
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
#onResumeHover = () => {
|
|
258
|
+
if (this.autoplay && !this.#timer) {
|
|
259
|
+
this.play();
|
|
260
|
+
this.dispatchEvent(new CustomEvent('autoplay-resume', { bubbles: true }));
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
#onPauseFocus = () => {
|
|
265
|
+
if (this.#timer) {
|
|
266
|
+
this.pause();
|
|
267
|
+
this.dispatchEvent(new CustomEvent('autoplay-pause', { bubbles: true, detail: { reason: 'focus' } }));
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
#onResumeFocus = (e) => {
|
|
272
|
+
if (this.autoplay && !this.contains(e.relatedTarget)) {
|
|
273
|
+
this.play();
|
|
274
|
+
this.dispatchEvent(new CustomEvent('autoplay-resume', { bubbles: true }));
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
#onKeydown = (e) => {
|
|
279
|
+
if (e.key === 'ArrowRight') { e.preventDefault(); this.next(); }
|
|
280
|
+
if (e.key === 'ArrowLeft') { e.preventDefault(); this.prev(); }
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
customElements.define('swiper-ui', AdiaSwiper);
|
|
285
|
+
export { AdiaSwiper };
|