@ui-sdk/web 0.0.0-stage → 0.1.0-beta.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/LICENSE +202 -0
- package/README.md +10 -2
- package/browser/web/accordion.js +1 -0
- package/browser/web/alert-dialog.js +1 -0
- package/browser/web/autocomplete.js +1 -0
- package/browser/web/avatar.js +1 -0
- package/browser/web/button.js +1 -0
- package/browser/web/calendar.js +1 -0
- package/browser/web/carousel.js +1 -0
- package/browser/web/checkbox.js +1 -0
- package/browser/web/chunks/0eRGibL6.js +1 -0
- package/browser/web/chunks/2bIEUO6_.js +1 -0
- package/browser/web/chunks/5A9w2ULz.js +1 -0
- package/browser/web/chunks/5RSyydjV.js +1 -0
- package/browser/web/chunks/9pWTy2wl.js +1 -0
- package/browser/web/chunks/B0f2j6zz.js +1 -0
- package/browser/web/chunks/B1rux6br.js +1 -0
- package/browser/web/chunks/B3-APaNf.js +1 -0
- package/browser/web/chunks/B7EgSgjQ.js +1 -0
- package/browser/web/chunks/B8QcOzJU.js +1 -0
- package/browser/web/chunks/BFueEkwm.js +3 -0
- package/browser/web/chunks/BJj3oS29.js +1 -0
- package/browser/web/chunks/BNSvTCpr.js +1 -0
- package/browser/web/chunks/BPD0kAZB.js +1 -0
- package/browser/web/chunks/BQeduZqT.js +1 -0
- package/browser/web/chunks/B_CVFyiz.js +1 -0
- package/browser/web/chunks/B_ns1YHO.js +1 -0
- package/browser/web/chunks/BcwkVTsR.js +1 -0
- package/browser/web/chunks/BeaQ6TYM.js +1 -0
- package/browser/web/chunks/BgBB013u.js +1 -0
- package/browser/web/chunks/BgsKhHDm.js +1 -0
- package/browser/web/chunks/BjMcbuhi.js +9 -0
- package/browser/web/chunks/Bjiy_F2N.js +1 -0
- package/browser/web/chunks/BqScCLwv.js +1 -0
- package/browser/web/chunks/BqX3Utqx.js +1 -0
- package/browser/web/chunks/BtVkQf3z.js +1 -0
- package/browser/web/chunks/By30h-7B.js +1 -0
- package/browser/web/chunks/C1zqYpy2.js +1 -0
- package/browser/web/chunks/C436juFf.js +1 -0
- package/browser/web/chunks/C4_bULs1.js +1 -0
- package/browser/web/chunks/C4omqJEz.js +1 -0
- package/browser/web/chunks/C7tt0T3n.js +1 -0
- package/browser/web/chunks/C8w7s5dg.js +1 -0
- package/browser/web/chunks/CElY4erO.js +1 -0
- package/browser/web/chunks/CFODo-m2.js +1 -0
- package/browser/web/chunks/CL4wjam9.js +1 -0
- package/browser/web/chunks/CMg-8UVf.js +1 -0
- package/browser/web/chunks/COWKfakj.js +1 -0
- package/browser/web/chunks/CQBU0qZ4.js +1 -0
- package/browser/web/chunks/CV6uABgc.js +1 -0
- package/browser/web/chunks/C_SWFpWQ.js +1 -0
- package/browser/web/chunks/C_Uanbrl.js +1 -0
- package/browser/web/chunks/Ce_CSanC.js +1 -0
- package/browser/web/chunks/Cg-ZmRhS.js +1 -0
- package/browser/web/chunks/Cgf2wPI_.js +1 -0
- package/browser/web/chunks/Cuep_3Vf.js +1 -0
- package/browser/web/chunks/D02PaHn6.js +1 -0
- package/browser/web/chunks/D5LiaI5R.js +1 -0
- package/browser/web/chunks/D9UgVYvF.js +1 -0
- package/browser/web/chunks/DC08tnkE.js +2 -0
- package/browser/web/chunks/DG8YGSvu.js +1 -0
- package/browser/web/chunks/DIQd0FYD.js +1 -0
- package/browser/web/chunks/DMLqacE8.js +1 -0
- package/browser/web/chunks/DSUI3yI-.js +1 -0
- package/browser/web/chunks/DT3Hb76X.js +1 -0
- package/browser/web/chunks/DY75g3-W.js +1 -0
- package/browser/web/chunks/DZpNQKZ9.js +1 -0
- package/browser/web/chunks/Db-W1wrC.js +1 -0
- package/browser/web/chunks/Dc1xK3Ii.js +1 -0
- package/browser/web/chunks/DdF6awFs.js +1 -0
- package/browser/web/chunks/DdaCLml8.js +1 -0
- package/browser/web/chunks/Dh8MLjQO.js +1 -0
- package/browser/web/chunks/DiuslJRy.js +1 -0
- package/browser/web/chunks/DjRcw3Y0.js +1 -0
- package/browser/web/chunks/Djdv-16J.js +1 -0
- package/browser/web/chunks/DnFXe_lF.js +1 -0
- package/browser/web/chunks/DneGv1oC.js +1 -0
- package/browser/web/chunks/DsVxP-p-.js +1 -0
- package/browser/web/chunks/DwDilCo2.js +1 -0
- package/browser/web/chunks/DwV48AXv.js +1 -0
- package/browser/web/chunks/F37aF4-L.js +1 -0
- package/browser/web/chunks/LyB6XIbN.js +1 -0
- package/browser/web/chunks/NKnbYGjC.js +1 -0
- package/browser/web/chunks/Vk-rVi16.js +1 -0
- package/browser/web/chunks/XsM0J1Ex.js +1 -0
- package/browser/web/chunks/asSN9iEp.js +1 -0
- package/browser/web/chunks/c-AjHfdF.js +1 -0
- package/browser/web/chunks/dR-12TPY.js +1 -0
- package/browser/web/chunks/hR4xM0EC.js +1 -0
- package/browser/web/chunks/hqOaBxAg.js +1 -0
- package/browser/web/chunks/kMKqqeG4.js +1 -0
- package/browser/web/chunks/kXboBcfi.js +1 -0
- package/browser/web/chunks/l4aQIg22.js +1 -0
- package/browser/web/chunks/tJC0JSU4.js +1 -0
- package/browser/web/chunks/wHdS_QYM.js +1 -0
- package/browser/web/chunks/yv8dTvNI.js +1 -0
- package/browser/web/chunks/yw9M3nfi.js +1 -0
- package/browser/web/collapsible.js +1 -0
- package/browser/web/color-picker.js +1 -0
- package/browser/web/combobox.js +2 -0
- package/browser/web/command.js +1 -0
- package/browser/web/core.js +5 -0
- package/browser/web/date-input.js +1 -0
- package/browser/web/date-picker.js +1 -0
- package/browser/web/dialog.js +1 -0
- package/browser/web/drawer.js +1 -0
- package/browser/web/field.js +1 -0
- package/browser/web/file-input.js +1 -0
- package/browser/web/hover-card.js +1 -0
- package/browser/web/image-cropper.js +1 -0
- package/browser/web/input.js +1 -0
- package/browser/web/label.js +1 -0
- package/browser/web/listbox.js +1 -0
- package/browser/web/menu.js +1 -0
- package/browser/web/menubar.js +1 -0
- package/browser/web/meter.js +1 -0
- package/browser/web/navigation-menu.js +1 -0
- package/browser/web/number-input.js +1 -0
- package/browser/web/otp-input.js +2 -0
- package/browser/web/overlays.js +1 -0
- package/browser/web/pagination.js +1 -0
- package/browser/web/password-input.js +1 -0
- package/browser/web/popover.js +1 -0
- package/browser/web/preferences.js +1 -0
- package/browser/web/progress.js +1 -0
- package/browser/web/radio.js +1 -0
- package/browser/web/rating.js +1 -0
- package/browser/web/resizable.js +1 -0
- package/browser/web/scroll-area.js +1 -0
- package/browser/web/segmented-control.js +1 -0
- package/browser/web/select.js +1 -0
- package/browser/web/separator.js +1 -0
- package/browser/web/slider.js +1 -0
- package/browser/web/switch.js +1 -0
- package/browser/web/tabs.js +1 -0
- package/browser/web/textarea.js +1 -0
- package/browser/web/time-input.js +1 -0
- package/browser/web/timeline.js +1 -0
- package/browser/web/toast.js +1 -0
- package/browser/web/toggle.js +1 -0
- package/browser/web/token-input.js +8 -0
- package/browser/web/toolbar.js +1 -0
- package/browser/web/tooltip.js +1 -0
- package/browser/web/tree.js +1 -0
- package/browser/web/trigger-menu.js +4 -0
- package/browser/web/waterfall.js +1 -0
- package/browser/web.css +3378 -0
- package/browser/web.js +3 -0
- package/custom-elements.json +32315 -0
- package/dist/accordion.d.ts +2 -0
- package/dist/accordion.js +57 -0
- package/dist/action.d.ts +16 -0
- package/dist/action.js +39 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +7 -0
- package/dist/autocomplete.d.ts +2 -0
- package/dist/autocomplete.js +120 -0
- package/dist/autoload.d.ts +18 -0
- package/dist/autoload.js +63 -0
- package/dist/avatar.d.ts +2 -0
- package/dist/avatar.js +27 -0
- package/dist/browser-core.d.ts +2 -0
- package/dist/browser-core.js +8 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +35 -0
- package/dist/calendar.d.ts +23 -0
- package/dist/calendar.js +429 -0
- package/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +54 -0
- package/dist/checkbox.d.ts +4 -0
- package/dist/checkbox.js +75 -0
- package/dist/collapsible.d.ts +2 -0
- package/dist/collapsible.js +28 -0
- package/dist/color-picker.d.ts +2 -0
- package/dist/color-picker.js +64 -0
- package/dist/combobox.d.ts +2 -0
- package/dist/combobox.js +334 -0
- package/dist/command.d.ts +2 -0
- package/dist/command.js +122 -0
- package/dist/date-input.d.ts +3 -0
- package/dist/date-input.js +87 -0
- package/dist/date-picker.d.ts +2 -0
- package/dist/date-picker.js +174 -0
- package/dist/default-text.d.ts +3 -0
- package/dist/default-text.js +24 -0
- package/dist/define-element.d.ts +404 -0
- package/dist/define-element.js +1489 -0
- package/dist/dialog.d.ts +3 -0
- package/dist/dialog.js +94 -0
- package/dist/drawer.d.ts +2 -0
- package/dist/drawer.js +96 -0
- package/dist/entries/accordion.d.ts +3 -0
- package/dist/entries/accordion.js +7 -0
- package/dist/entries/alert-dialog.d.ts +3 -0
- package/dist/entries/alert-dialog.js +13 -0
- package/dist/entries/autocomplete.d.ts +3 -0
- package/dist/entries/autocomplete.js +7 -0
- package/dist/entries/avatar.d.ts +2 -0
- package/dist/entries/avatar.js +3 -0
- package/dist/entries/button.d.ts +2 -0
- package/dist/entries/button.js +3 -0
- package/dist/entries/calendar.d.ts +3 -0
- package/dist/entries/calendar.js +7 -0
- package/dist/entries/carousel.d.ts +3 -0
- package/dist/entries/carousel.js +7 -0
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.js +15 -0
- package/dist/entries/collapsible.d.ts +3 -0
- package/dist/entries/collapsible.js +7 -0
- package/dist/entries/color-picker.d.ts +3 -0
- package/dist/entries/color-picker.js +7 -0
- package/dist/entries/combobox.d.ts +3 -0
- package/dist/entries/combobox.js +7 -0
- package/dist/entries/command.d.ts +3 -0
- package/dist/entries/command.js +7 -0
- package/dist/entries/date-input.d.ts +3 -0
- package/dist/entries/date-input.js +7 -0
- package/dist/entries/date-picker.d.ts +3 -0
- package/dist/entries/date-picker.js +7 -0
- package/dist/entries/dialog.d.ts +3 -0
- package/dist/entries/dialog.js +7 -0
- package/dist/entries/drawer.d.ts +3 -0
- package/dist/entries/drawer.js +8 -0
- package/dist/entries/field.d.ts +2 -0
- package/dist/entries/field.js +3 -0
- package/dist/entries/file-input.d.ts +3 -0
- package/dist/entries/file-input.js +13 -0
- package/dist/entries/hover-card.d.ts +3 -0
- package/dist/entries/hover-card.js +7 -0
- package/dist/entries/image-cropper.d.ts +3 -0
- package/dist/entries/image-cropper.js +7 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.js +8 -0
- package/dist/entries/label.d.ts +2 -0
- package/dist/entries/label.js +3 -0
- package/dist/entries/listbox.d.ts +3 -0
- package/dist/entries/listbox.js +7 -0
- package/dist/entries/menu.d.ts +3 -0
- package/dist/entries/menu.js +7 -0
- package/dist/entries/menubar.d.ts +3 -0
- package/dist/entries/menubar.js +7 -0
- package/dist/entries/meter.d.ts +2 -0
- package/dist/entries/meter.js +3 -0
- package/dist/entries/navigation-menu.d.ts +3 -0
- package/dist/entries/navigation-menu.js +7 -0
- package/dist/entries/number-input.d.ts +3 -0
- package/dist/entries/number-input.js +7 -0
- package/dist/entries/otp-input.d.ts +3 -0
- package/dist/entries/otp-input.js +7 -0
- package/dist/entries/overlays.d.ts +2 -0
- package/dist/entries/overlays.js +3 -0
- package/dist/entries/pagination.d.ts +3 -0
- package/dist/entries/pagination.js +11 -0
- package/dist/entries/password-input.d.ts +3 -0
- package/dist/entries/password-input.js +7 -0
- package/dist/entries/popover.d.ts +3 -0
- package/dist/entries/popover.js +7 -0
- package/dist/entries/preferences.d.ts +3 -0
- package/dist/entries/preferences.js +13 -0
- package/dist/entries/progress.d.ts +2 -0
- package/dist/entries/progress.js +3 -0
- package/dist/entries/radio.d.ts +3 -0
- package/dist/entries/radio.js +7 -0
- package/dist/entries/rating.d.ts +3 -0
- package/dist/entries/rating.js +8 -0
- package/dist/entries/resizable.d.ts +3 -0
- package/dist/entries/resizable.js +11 -0
- package/dist/entries/scroll-area.d.ts +3 -0
- package/dist/entries/scroll-area.js +7 -0
- package/dist/entries/segmented-control.d.ts +3 -0
- package/dist/entries/segmented-control.js +7 -0
- package/dist/entries/select.d.ts +3 -0
- package/dist/entries/select.js +7 -0
- package/dist/entries/separator.d.ts +2 -0
- package/dist/entries/separator.js +3 -0
- package/dist/entries/slider.d.ts +3 -0
- package/dist/entries/slider.js +7 -0
- package/dist/entries/switch.d.ts +3 -0
- package/dist/entries/switch.js +7 -0
- package/dist/entries/tabs.d.ts +3 -0
- package/dist/entries/tabs.js +7 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.js +7 -0
- package/dist/entries/time-input.d.ts +3 -0
- package/dist/entries/time-input.js +7 -0
- package/dist/entries/timeline.d.ts +3 -0
- package/dist/entries/timeline.js +7 -0
- package/dist/entries/toast.d.ts +2 -0
- package/dist/entries/toast.js +3 -0
- package/dist/entries/toggle.d.ts +3 -0
- package/dist/entries/toggle.js +12 -0
- package/dist/entries/token-input.d.ts +3 -0
- package/dist/entries/token-input.js +17 -0
- package/dist/entries/toolbar.d.ts +3 -0
- package/dist/entries/toolbar.js +7 -0
- package/dist/entries/tooltip.d.ts +3 -0
- package/dist/entries/tooltip.js +7 -0
- package/dist/entries/tree.d.ts +3 -0
- package/dist/entries/tree.js +17 -0
- package/dist/entries/trigger-menu.d.ts +3 -0
- package/dist/entries/trigger-menu.js +11 -0
- package/dist/entries/waterfall.d.ts +3 -0
- package/dist/entries/waterfall.js +11 -0
- package/dist/events.d.ts +1658 -0
- package/dist/events.js +0 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +101 -0
- package/dist/file-input.d.ts +2 -0
- package/dist/file-input.js +140 -0
- package/dist/forward-attributes.d.ts +2 -0
- package/dist/forward-attributes.js +22 -0
- package/dist/history.d.ts +2 -0
- package/dist/history.js +11 -0
- package/dist/hover-card.d.ts +2 -0
- package/dist/hover-card.js +31 -0
- package/dist/image-cropper.d.ts +2 -0
- package/dist/image-cropper.js +66 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +269 -0
- package/dist/input.d.ts +3 -0
- package/dist/input.js +69 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +11 -0
- package/dist/list.d.ts +40 -0
- package/dist/list.js +192 -0
- package/dist/listbox.d.ts +2 -0
- package/dist/listbox.js +84 -0
- package/dist/menu.d.ts +4 -0
- package/dist/menu.js +295 -0
- package/dist/menubar.d.ts +4 -0
- package/dist/menubar.js +30 -0
- package/dist/meter.d.ts +2 -0
- package/dist/meter.js +22 -0
- package/dist/navigation-menu.d.ts +2 -0
- package/dist/navigation-menu.js +114 -0
- package/dist/number-input.d.ts +2 -0
- package/dist/number-input.js +73 -0
- package/dist/observe.d.ts +2 -0
- package/dist/observe.js +7 -0
- package/dist/otp-input.d.ts +2 -0
- package/dist/otp-input.js +72 -0
- package/dist/overlays.d.ts +13 -0
- package/dist/overlays.js +156 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/pagination.js +127 -0
- package/dist/password-input.d.ts +2 -0
- package/dist/password-input.js +57 -0
- package/dist/popover.d.ts +2 -0
- package/dist/popover.js +64 -0
- package/dist/popup.d.ts +40 -0
- package/dist/popup.js +112 -0
- package/dist/preferences.d.ts +2 -0
- package/dist/preferences.js +56 -0
- package/dist/progress.d.ts +2 -0
- package/dist/progress.js +22 -0
- package/dist/radio.d.ts +2 -0
- package/dist/radio.js +33 -0
- package/dist/rating.d.ts +2 -0
- package/dist/rating.js +64 -0
- package/dist/resizable.d.ts +2 -0
- package/dist/resizable.js +42 -0
- package/dist/scroll-area.d.ts +2 -0
- package/dist/scroll-area.js +45 -0
- package/dist/segmented-control.d.ts +2 -0
- package/dist/segmented-control.js +28 -0
- package/dist/select.d.ts +2 -0
- package/dist/select.js +239 -0
- package/dist/separator.d.ts +2 -0
- package/dist/separator.js +11 -0
- package/dist/slider.d.ts +2 -0
- package/dist/slider.js +77 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +37 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +27 -0
- package/dist/toast.d.ts +20 -0
- package/dist/toast.js +177 -0
- package/dist/toggle.d.ts +3 -0
- package/dist/toggle.js +64 -0
- package/dist/token-input.d.ts +2 -0
- package/dist/token-input.js +103 -0
- package/dist/toolbar.d.ts +2 -0
- package/dist/toolbar.js +36 -0
- package/dist/tooltip.d.ts +2 -0
- package/dist/tooltip.js +35 -0
- package/dist/tree.d.ts +2 -0
- package/dist/tree.js +147 -0
- package/dist/trigger-menu.d.ts +2 -0
- package/dist/trigger-menu.js +133 -0
- package/dist/waterfall.d.ts +2 -0
- package/dist/waterfall.js +140 -0
- package/docs/README.md +89 -0
- package/docs/agents.md +1523 -0
- package/docs/components/accordion.md +1401 -0
- package/docs/components/alert-dialog.md +788 -0
- package/docs/components/autocomplete.md +1692 -0
- package/docs/components/avatar.md +261 -0
- package/docs/components/button.md +441 -0
- package/docs/components/calendar.md +1536 -0
- package/docs/components/carousel.md +1055 -0
- package/docs/components/checkbox.md +1045 -0
- package/docs/components/collapsible.md +535 -0
- package/docs/components/color-picker.md +651 -0
- package/docs/components/combobox.md +3274 -0
- package/docs/components/command.md +1431 -0
- package/docs/components/date-input.md +563 -0
- package/docs/components/date-picker.md +1136 -0
- package/docs/components/dialog.md +1360 -0
- package/docs/components/drawer.md +1201 -0
- package/docs/components/field.md +519 -0
- package/docs/components/file-input.md +617 -0
- package/docs/components/hover-card.md +486 -0
- package/docs/components/image-cropper.md +489 -0
- package/docs/components/input.md +327 -0
- package/docs/components/label.md +208 -0
- package/docs/components/listbox.md +1015 -0
- package/docs/components/menu.md +1212 -0
- package/docs/components/menubar.md +460 -0
- package/docs/components/meter.md +298 -0
- package/docs/components/navigation-menu.md +1573 -0
- package/docs/components/number-input.md +1087 -0
- package/docs/components/otp-input.md +558 -0
- package/docs/components/pagination.md +639 -0
- package/docs/components/password-input.md +649 -0
- package/docs/components/popover.md +1433 -0
- package/docs/components/preferences.md +243 -0
- package/docs/components/progress.md +406 -0
- package/docs/components/radio.md +855 -0
- package/docs/components/rating.md +431 -0
- package/docs/components/resizable.md +866 -0
- package/docs/components/scroll-area.md +898 -0
- package/docs/components/segmented-control.md +421 -0
- package/docs/components/select.md +1957 -0
- package/docs/components/separator.md +238 -0
- package/docs/components/slider.md +1018 -0
- package/docs/components/switch.md +583 -0
- package/docs/components/tabs.md +948 -0
- package/docs/components/textarea.md +331 -0
- package/docs/components/time-input.md +235 -0
- package/docs/components/timeline.md +622 -0
- package/docs/components/toast.md +1223 -0
- package/docs/components/toggle.md +522 -0
- package/docs/components/token-input.md +854 -0
- package/docs/components/toolbar.md +815 -0
- package/docs/components/tooltip.md +860 -0
- package/docs/components/tree.md +1243 -0
- package/docs/components/trigger-menu.md +1110 -0
- package/docs/components/waterfall.md +709 -0
- package/docs/controllers.md +66 -0
- package/docs/core.md +8027 -0
- package/docs/custom-parts.md +91 -0
- package/docs/first-component.md +88 -0
- package/docs/forms.md +125 -0
- package/docs/installation.md +141 -0
- package/docs/introduction.md +32 -0
- package/docs/lists-and-menus.md +166 -0
- package/docs/llms.txt +1566 -0
- package/docs/parts-and-composition.md +57 -0
- package/docs/popups.md +92 -0
- package/docs/rendering.md +71 -0
- package/docs/server-rendering.md +118 -0
- package/docs/state-and-events.md +134 -0
- package/docs/styling-and-animation.md +104 -0
- package/docs/utilities/async-options.md +332 -0
- package/docs/utilities/shortcuts.md +184 -0
- package/html-custom-data.json +14792 -0
- package/package.json +302 -3
package/dist/rating.d.ts
ADDED
package/dist/rating.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/rating.ts
|
|
2
|
+
import { rating } from "@ui-sdk/core/rating";
|
|
3
|
+
import { createParts } from "./define-element.js";
|
|
4
|
+
import { element, templateOf } from "./list.js";
|
|
5
|
+
var owner = "ui-rating";
|
|
6
|
+
function defineRatingElements() {
|
|
7
|
+
createParts(rating, {
|
|
8
|
+
root: {
|
|
9
|
+
tag: owner,
|
|
10
|
+
formAssociated: true,
|
|
11
|
+
state: {
|
|
12
|
+
value: {
|
|
13
|
+
get: (api) => api.getValue(),
|
|
14
|
+
set: (api, value) => api.setValue(value)
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
api: ["getValue", "setValue", "focus"],
|
|
18
|
+
render(el, { api }) {
|
|
19
|
+
renderStars(el, api);
|
|
20
|
+
const observer = new MutationObserver(() => renderStars(el, api));
|
|
21
|
+
observer.observe(el, { attributeFilter: ["max", "step"] });
|
|
22
|
+
return () => observer.disconnect();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
item: "ui-rating-item",
|
|
26
|
+
radio: "ui-rating-radio"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function renderStars(el, api) {
|
|
30
|
+
const items = [...el.querySelectorAll(":scope > ui-rating-item")];
|
|
31
|
+
const max = api.internal.max();
|
|
32
|
+
for (const item of items.slice(max)) {
|
|
33
|
+
item.remove();
|
|
34
|
+
}
|
|
35
|
+
for (let index = 1; index <= max; index++) {
|
|
36
|
+
let item = items[index - 1];
|
|
37
|
+
if (!item) {
|
|
38
|
+
item = element(
|
|
39
|
+
"ui-rating-item",
|
|
40
|
+
{ index: String(index) },
|
|
41
|
+
void 0,
|
|
42
|
+
templateOf(el)
|
|
43
|
+
);
|
|
44
|
+
el.append(item);
|
|
45
|
+
}
|
|
46
|
+
if (item.getAttribute("index") !== String(index)) {
|
|
47
|
+
item.setAttribute("index", String(index));
|
|
48
|
+
}
|
|
49
|
+
renderRadios(item, api.internal.values(index).map(String));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function renderRadios(item, values) {
|
|
53
|
+
const radios = [...item.querySelectorAll(":scope > ui-rating-radio")];
|
|
54
|
+
if (radios.map((radio) => radio.getAttribute("value")).join() === values.join()) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const radio of radios) {
|
|
58
|
+
radio.remove();
|
|
59
|
+
}
|
|
60
|
+
item.append(...values.map((value) => element("ui-rating-radio", { value })));
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
defineRatingElements
|
|
64
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/resizable.ts
|
|
2
|
+
import { resizable } from "@ui-sdk/core/resizable";
|
|
3
|
+
import { createParts } from "./define-element.js";
|
|
4
|
+
function defineResizableElements() {
|
|
5
|
+
createParts(resizable, {
|
|
6
|
+
root: {
|
|
7
|
+
tag: "ui-resizable",
|
|
8
|
+
display: "block",
|
|
9
|
+
// `layout` is live: setting the property or the attribute resizes the
|
|
10
|
+
// panels, like the controller, and fires `layoutchange`. A layout can't be
|
|
11
|
+
// cleared, so removing the attribute leaves the panels where they are.
|
|
12
|
+
state: {
|
|
13
|
+
layout: {
|
|
14
|
+
get: (api) => api.getLayout(),
|
|
15
|
+
set: (api, layout) => {
|
|
16
|
+
if (Array.isArray(layout)) {
|
|
17
|
+
api.setLayout(layout);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
api: [
|
|
23
|
+
"getLayout",
|
|
24
|
+
"setLayout",
|
|
25
|
+
"collapse",
|
|
26
|
+
"expand",
|
|
27
|
+
"resize",
|
|
28
|
+
"isCollapsed"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
panel: {
|
|
32
|
+
tag: "ui-resizable-panel",
|
|
33
|
+
display: "block",
|
|
34
|
+
// Its `id` keys its size in a saved layout.
|
|
35
|
+
kinds: { id: "string" }
|
|
36
|
+
},
|
|
37
|
+
handle: { tag: "ui-resizable-handle", display: "block" }
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
defineResizableElements
|
|
42
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/scroll-area.ts
|
|
2
|
+
import { scrollArea } from "@ui-sdk/core/scroll-area";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
var owner = "ui-scroll-area";
|
|
5
|
+
var thumbAxis = (el) => {
|
|
6
|
+
const orientation = el.closest("ui-scroll-area-scrollbar")?.getAttribute("orientation") ?? "vertical";
|
|
7
|
+
return { id: orientation, orientation };
|
|
8
|
+
};
|
|
9
|
+
function defineScrollAreaElements() {
|
|
10
|
+
createParts(scrollArea, {
|
|
11
|
+
root: {
|
|
12
|
+
tag: owner,
|
|
13
|
+
display: "block",
|
|
14
|
+
api: [
|
|
15
|
+
"scrollToEnd",
|
|
16
|
+
"scrollToStart",
|
|
17
|
+
"isAtEnd",
|
|
18
|
+
"isAtStart",
|
|
19
|
+
"isSticking"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
viewport: { tag: "ui-scroll-area-viewport", display: "block" },
|
|
23
|
+
content: { tag: "ui-scroll-area-content", display: "block" },
|
|
24
|
+
scrollbar: {
|
|
25
|
+
tag: "ui-scroll-area-scrollbar",
|
|
26
|
+
display: "block",
|
|
27
|
+
context: (el) => ({ id: el.getAttribute("orientation") ?? "vertical" })
|
|
28
|
+
},
|
|
29
|
+
thumb: {
|
|
30
|
+
tag: "ui-scroll-area-thumb",
|
|
31
|
+
display: "block",
|
|
32
|
+
context: thumbAxis
|
|
33
|
+
},
|
|
34
|
+
corner: { tag: "ui-scroll-area-corner", display: "block" },
|
|
35
|
+
// A wrapper, so the button stays a real button with its built-in behavior.
|
|
36
|
+
"scroll-to-end": {
|
|
37
|
+
tag: "ui-scroll-area-scroll-to-end",
|
|
38
|
+
display: "contents",
|
|
39
|
+
target: wrappedButton
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
defineScrollAreaElements
|
|
45
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/segmented-control.ts
|
|
2
|
+
import {
|
|
3
|
+
segmentedControl
|
|
4
|
+
} from "@ui-sdk/core/segmented-control";
|
|
5
|
+
import { createParts } from "./define-element.js";
|
|
6
|
+
function defineSegmentedControlElements() {
|
|
7
|
+
createParts(segmentedControl, {
|
|
8
|
+
root: {
|
|
9
|
+
tag: "ui-segmented-control",
|
|
10
|
+
defaults: { loop: true },
|
|
11
|
+
display: "block",
|
|
12
|
+
formAssociated: true,
|
|
13
|
+
state: {
|
|
14
|
+
value: {
|
|
15
|
+
get: (api) => api.getValue(),
|
|
16
|
+
set: (api, value) => api.setValue(value)
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
api: ["getValue", "setValue", "focus"]
|
|
20
|
+
},
|
|
21
|
+
// Form-associated, so a <label> around or pointing at an item checks it.
|
|
22
|
+
item: { tag: "ui-segmented-control-item", formAssociated: true },
|
|
23
|
+
indicator: "ui-segmented-control-indicator"
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
defineSegmentedControlElements
|
|
28
|
+
};
|
package/dist/select.d.ts
ADDED
package/dist/select.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// src/select.ts
|
|
2
|
+
import {
|
|
3
|
+
select
|
|
4
|
+
} from "@ui-sdk/core/select";
|
|
5
|
+
import {
|
|
6
|
+
selectAllKey,
|
|
7
|
+
selectItemIcons,
|
|
8
|
+
selectSelectAll
|
|
9
|
+
} from "@ui-sdk/core/renderer";
|
|
10
|
+
import {
|
|
11
|
+
autoId,
|
|
12
|
+
createParts,
|
|
13
|
+
wrappedButton,
|
|
14
|
+
wrappedChild
|
|
15
|
+
} from "./define-element.js";
|
|
16
|
+
import { popupKinds, popupState, sheetPortal } from "./popup.js";
|
|
17
|
+
import {
|
|
18
|
+
adoptDefaultValue,
|
|
19
|
+
copy,
|
|
20
|
+
itemText,
|
|
21
|
+
listAttribute,
|
|
22
|
+
renderData,
|
|
23
|
+
renderListItems,
|
|
24
|
+
stashedEmpty,
|
|
25
|
+
templateOf,
|
|
26
|
+
valuesOf
|
|
27
|
+
} from "./list.js";
|
|
28
|
+
var owner = "ui-select";
|
|
29
|
+
var generated = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
var automatic = /* @__PURE__ */ new WeakSet();
|
|
31
|
+
var markupLists = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
function defineSelectElements() {
|
|
33
|
+
createParts(select, {
|
|
34
|
+
root: {
|
|
35
|
+
tag: owner,
|
|
36
|
+
defaults: { loop: true, dismissible: true },
|
|
37
|
+
formAssociated: true,
|
|
38
|
+
display: "contents",
|
|
39
|
+
kinds: popupKinds,
|
|
40
|
+
// A filter function is a property; the attribute takes the named modes.
|
|
41
|
+
properties: ["filter"],
|
|
42
|
+
options: (el) => {
|
|
43
|
+
const data = el;
|
|
44
|
+
const multiple = el.hasAttribute("multiple") && el.getAttribute("multiple") !== "false";
|
|
45
|
+
const start = el.getAttribute("default-value") ?? el.getAttribute("value");
|
|
46
|
+
const items = data.items ?? optionItems(el);
|
|
47
|
+
const toValues = (keys) => valuesOf(keys, items, data.itemToValue);
|
|
48
|
+
return {
|
|
49
|
+
items,
|
|
50
|
+
...(typeof data.filter === "function" || data.filter === false) && {
|
|
51
|
+
filter: data.filter
|
|
52
|
+
},
|
|
53
|
+
itemToValue: data.itemToValue,
|
|
54
|
+
itemToLabel: data.itemToLabel,
|
|
55
|
+
isItemEqualToValue: data.isItemEqualToValue,
|
|
56
|
+
container: void 0,
|
|
57
|
+
...start !== null && {
|
|
58
|
+
defaultValue: multiple ? toValues(listAttribute(start)) : toValues([start])[0]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
state: {
|
|
63
|
+
value: {
|
|
64
|
+
get: (api) => api.getValue(),
|
|
65
|
+
// A string names items by key, comma-separated with multiple.
|
|
66
|
+
set: (api, value) => {
|
|
67
|
+
if (typeof value !== "string") {
|
|
68
|
+
return api.setValue(value);
|
|
69
|
+
}
|
|
70
|
+
const keys = api.internal.options().multiple ? listAttribute(value) : [value];
|
|
71
|
+
const found = keys.map(
|
|
72
|
+
(key) => api.internal.listbox.valueOf(key) ?? key
|
|
73
|
+
);
|
|
74
|
+
api.setValue(
|
|
75
|
+
api.internal.options().multiple ? found : found[0] ?? null
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
query: {
|
|
80
|
+
get: (api) => api.getQuery(),
|
|
81
|
+
set: (api, query) => api.setQuery(query ?? "")
|
|
82
|
+
},
|
|
83
|
+
...popupState
|
|
84
|
+
},
|
|
85
|
+
api: [
|
|
86
|
+
"isOpen",
|
|
87
|
+
"setOpen",
|
|
88
|
+
"open",
|
|
89
|
+
"close",
|
|
90
|
+
"toggle",
|
|
91
|
+
"getValue",
|
|
92
|
+
"setValue",
|
|
93
|
+
"clear",
|
|
94
|
+
"getQuery",
|
|
95
|
+
"setQuery",
|
|
96
|
+
"focus"
|
|
97
|
+
],
|
|
98
|
+
portal: sheetPortal("ui-select-viewport"),
|
|
99
|
+
// Runs again whenever `items` is set.
|
|
100
|
+
render(el, { api, subscribe }) {
|
|
101
|
+
const target = el;
|
|
102
|
+
const toKey = api.internal.keyOf;
|
|
103
|
+
const items = target.items ?? optionItems(el);
|
|
104
|
+
const content = generated.get(el);
|
|
105
|
+
const template = templateOf(el);
|
|
106
|
+
if (!items) {
|
|
107
|
+
content?.remove();
|
|
108
|
+
generated.delete(el);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
adoptDefaultValue(el, items, api);
|
|
112
|
+
if (content) {
|
|
113
|
+
content.replaceChildren(
|
|
114
|
+
...renderListItems("ui-select", items, toKey, template)
|
|
115
|
+
);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const markup = el.querySelector(":scope > ui-select-content");
|
|
119
|
+
if (markup && !markupLists.has(el)) {
|
|
120
|
+
markupLists.set(el, markup.querySelector("ui-select-list"));
|
|
121
|
+
}
|
|
122
|
+
if (markupLists.has(el)) {
|
|
123
|
+
renderSearched(target, api);
|
|
124
|
+
return subscribe(() => renderSearched(target, api));
|
|
125
|
+
}
|
|
126
|
+
const created = copy(template, "ui-select-content", false);
|
|
127
|
+
created.append(...renderListItems("ui-select", items, toKey, template));
|
|
128
|
+
generated.set(el, created);
|
|
129
|
+
el.append(created);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
label: { tag: "ui-select-label", display: "block" },
|
|
133
|
+
// A wrapper, so the trigger stays a real button. An empty button shows the value.
|
|
134
|
+
trigger: {
|
|
135
|
+
tag: "ui-select-trigger",
|
|
136
|
+
display: "contents",
|
|
137
|
+
target: wrappedButton,
|
|
138
|
+
render(el) {
|
|
139
|
+
const target = wrappedButton(el);
|
|
140
|
+
if (target && !target.childNodes.length) {
|
|
141
|
+
target.append(document.createElement("ui-select-value"));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
value: {
|
|
146
|
+
tag: "ui-select-value",
|
|
147
|
+
rebind: ["placeholder", "maxLabels", "getMoreLabel"],
|
|
148
|
+
render(el) {
|
|
149
|
+
if (!el.childNodes.length && !el.hasAttribute("as-child")) {
|
|
150
|
+
automatic.add(el);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
context: (el) => ({ text: automatic.has(el) }),
|
|
154
|
+
kinds: { text: null }
|
|
155
|
+
},
|
|
156
|
+
clear: {
|
|
157
|
+
tag: "ui-select-clear",
|
|
158
|
+
display: "contents",
|
|
159
|
+
target: wrappedButton
|
|
160
|
+
},
|
|
161
|
+
content: { tag: "ui-select-content", kinds: popupKinds },
|
|
162
|
+
list: { tag: "ui-select-list", display: "block" },
|
|
163
|
+
// A wrapper, so the search field stays a real input.
|
|
164
|
+
input: {
|
|
165
|
+
tag: "ui-select-input",
|
|
166
|
+
display: "contents",
|
|
167
|
+
target: wrappedChild("input")
|
|
168
|
+
},
|
|
169
|
+
empty: { tag: "ui-select-empty", ...stashedEmpty },
|
|
170
|
+
status: { tag: "ui-select-status", display: "block" },
|
|
171
|
+
// Its text, with what the search matched in <mark>. It holds text only.
|
|
172
|
+
"item-text": { tag: "ui-select-item-text", ...itemText },
|
|
173
|
+
// Selects every item that matches, in its <ui-select-group> or in the whole list.
|
|
174
|
+
"select-all": {
|
|
175
|
+
tag: "ui-select-select-all",
|
|
176
|
+
display: "block",
|
|
177
|
+
feature: selectSelectAll,
|
|
178
|
+
context: (el) => {
|
|
179
|
+
const group = el.closest("ui-select-group");
|
|
180
|
+
return { id: selectAllKey(group ? autoId(group) : void 0) };
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
item: { tag: "ui-select-item", display: "block", properties: ["value"] },
|
|
184
|
+
"item-indicator": "ui-select-item-indicator",
|
|
185
|
+
// An icon inside an item. Screen readers, typeahead and the search skip it.
|
|
186
|
+
"item-icon": { tag: "ui-select-item-icon", feature: selectItemIcons },
|
|
187
|
+
// The selected item's icon, copied from its <ui-select-item-icon>, like before the value in the trigger.
|
|
188
|
+
"value-icon": { tag: "ui-select-value-icon", feature: selectItemIcons },
|
|
189
|
+
group: { tag: "ui-select-group", display: "block" },
|
|
190
|
+
"group-label": { tag: "ui-select-group-label", display: "block" },
|
|
191
|
+
separator: { tag: "ui-select-separator", display: "block" },
|
|
192
|
+
arrow: { tag: "ui-select-arrow", display: "block" }
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function renderSearched(el, api) {
|
|
196
|
+
const list = markupLists.get(el);
|
|
197
|
+
const items = el.items ?? optionItems(el);
|
|
198
|
+
if (!list || !items) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const visible = api.internal.listbox.visibleData()?.list ?? items;
|
|
202
|
+
renderData(list, "ui-select", visible, templateOf(el), api.internal.keyOf);
|
|
203
|
+
}
|
|
204
|
+
var fromOptions = /* @__PURE__ */ new WeakMap();
|
|
205
|
+
function optionItems(el) {
|
|
206
|
+
if (!fromOptions.has(el)) {
|
|
207
|
+
fromOptions.set(el, readOptions(el));
|
|
208
|
+
}
|
|
209
|
+
return fromOptions.get(el);
|
|
210
|
+
}
|
|
211
|
+
function readOptions(el) {
|
|
212
|
+
const children = Array.from(el.children).filter(
|
|
213
|
+
(child) => child.localName === "option" || child.localName === "optgroup"
|
|
214
|
+
);
|
|
215
|
+
if (!children.length) {
|
|
216
|
+
return void 0;
|
|
217
|
+
}
|
|
218
|
+
const read = (option) => ({
|
|
219
|
+
value: option.value,
|
|
220
|
+
label: option.label || option.textContent?.trim() || option.value,
|
|
221
|
+
disabled: option.disabled || void 0
|
|
222
|
+
});
|
|
223
|
+
const items = children.map((child) => {
|
|
224
|
+
;
|
|
225
|
+
child.hidden = true;
|
|
226
|
+
if (child instanceof HTMLOptGroupElement) {
|
|
227
|
+
return {
|
|
228
|
+
type: "group",
|
|
229
|
+
label: child.label,
|
|
230
|
+
items: Array.from(child.querySelectorAll("option")).map(read)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return read(child);
|
|
234
|
+
});
|
|
235
|
+
return items;
|
|
236
|
+
}
|
|
237
|
+
export {
|
|
238
|
+
defineSelectElements
|
|
239
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/separator.ts
|
|
2
|
+
import { separator } from "@ui-sdk/core/separator";
|
|
3
|
+
import { createParts } from "./define-element.js";
|
|
4
|
+
function defineSeparatorElements() {
|
|
5
|
+
createParts(separator, {
|
|
6
|
+
root: { tag: "ui-separator", display: "block" }
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
defineSeparatorElements
|
|
11
|
+
};
|
package/dist/slider.d.ts
ADDED
package/dist/slider.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// src/slider.ts
|
|
2
|
+
import { attrs, partState } from "@ui-sdk/core/renderer";
|
|
3
|
+
import { slider } from "@ui-sdk/core/slider";
|
|
4
|
+
import { showDefaultText } from "./default-text.js";
|
|
5
|
+
import { createParts } from "./define-element.js";
|
|
6
|
+
import { forwardAttributes } from "./forward-attributes.js";
|
|
7
|
+
var owner = "ui-slider";
|
|
8
|
+
function thumbIndex(el) {
|
|
9
|
+
const own = el.closest("ui-slider-thumb");
|
|
10
|
+
if (!own) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
const explicit = own.getAttribute("index");
|
|
14
|
+
const root = own.closest(owner);
|
|
15
|
+
const thumbs = root ? Array.from(root.querySelectorAll("ui-slider-thumb")) : [own];
|
|
16
|
+
const index = explicit === null ? Math.max(0, thumbs.indexOf(own)) : Number(explicit);
|
|
17
|
+
return { index, id: String(index) };
|
|
18
|
+
}
|
|
19
|
+
var inputAttributes = ["aria-label", "aria-labelledby", "aria-describedby"];
|
|
20
|
+
function defineSliderElements() {
|
|
21
|
+
createParts(slider, {
|
|
22
|
+
root: {
|
|
23
|
+
tag: owner,
|
|
24
|
+
display: "block",
|
|
25
|
+
formAssociated: true,
|
|
26
|
+
// The framework adapters pass it, never an attribute or a property.
|
|
27
|
+
kinds: { thumbInputId: null },
|
|
28
|
+
state: {
|
|
29
|
+
value: {
|
|
30
|
+
get: (api) => api.getValue(),
|
|
31
|
+
set: (api, value) => api.setValue(value)
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
api: ["getValue", "setValue", "focus"],
|
|
35
|
+
// Empty values show the formatted value, and inside a thumb, that thumb's.
|
|
36
|
+
render(el, instance) {
|
|
37
|
+
return showDefaultText(el, instance, "ui-slider-value", (value) => {
|
|
38
|
+
if (!value.closest("ui-slider-thumb")) {
|
|
39
|
+
return partState(instance.part("value", {})).text;
|
|
40
|
+
}
|
|
41
|
+
return String(
|
|
42
|
+
attrs(instance.part("thumb-input", thumbIndex(value)))["aria-valuetext"]
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
control: { tag: "ui-slider-control", display: "block" },
|
|
48
|
+
track: { tag: "ui-slider-track", display: "block" },
|
|
49
|
+
indicator: { tag: "ui-slider-indicator", display: "block" },
|
|
50
|
+
thumb: {
|
|
51
|
+
tag: "ui-slider-thumb",
|
|
52
|
+
display: "block",
|
|
53
|
+
context: thumbIndex,
|
|
54
|
+
// Adds the range input that takes focus, named by the thumb's own label.
|
|
55
|
+
render(el) {
|
|
56
|
+
if (el.querySelector(":scope > ui-slider-thumb-input")) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const wrapper = document.createElement("ui-slider-thumb-input");
|
|
60
|
+
const input = document.createElement("input");
|
|
61
|
+
forwardAttributes(el, input, inputAttributes);
|
|
62
|
+
wrapper.append(input);
|
|
63
|
+
el.append(wrapper);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"thumb-input": {
|
|
67
|
+
tag: "ui-slider-thumb-input",
|
|
68
|
+
display: "contents",
|
|
69
|
+
context: thumbIndex,
|
|
70
|
+
target: (el) => el.querySelector("input")
|
|
71
|
+
},
|
|
72
|
+
value: { tag: "ui-slider-value", display: "block" }
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
defineSliderElements
|
|
77
|
+
};
|
package/dist/tabs.d.ts
ADDED
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/tabs.ts
|
|
2
|
+
import { tabs } from "@ui-sdk/core/tabs";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
function defineTabsElements() {
|
|
5
|
+
createParts(tabs, {
|
|
6
|
+
root: {
|
|
7
|
+
tag: "ui-tabs",
|
|
8
|
+
display: "block",
|
|
9
|
+
defaults: { loop: true },
|
|
10
|
+
// `value` is live: setting the property or the attribute selects a tab,
|
|
11
|
+
// like a controller, and fires `valuechange`.
|
|
12
|
+
state: {
|
|
13
|
+
value: {
|
|
14
|
+
get: (api) => api.getValue(),
|
|
15
|
+
set: (api, value) => api.setValue(value)
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
api: ["getValue", "setValue", "select", "focus"]
|
|
19
|
+
},
|
|
20
|
+
list: { tag: "ui-tabs-list", display: "block" },
|
|
21
|
+
// A wrapper, so the tab stays a real button with its built-in behavior. It
|
|
22
|
+
// has no role, so the tab list still sees its tabs as direct children.
|
|
23
|
+
tab: {
|
|
24
|
+
tag: "ui-tabs-tab",
|
|
25
|
+
display: "contents",
|
|
26
|
+
target: wrappedButton,
|
|
27
|
+
render: (el) => el.setAttribute("role", "none")
|
|
28
|
+
},
|
|
29
|
+
// An icon inside a tab's button. Screen readers skip it.
|
|
30
|
+
"tab-icon": "ui-tabs-tab-icon",
|
|
31
|
+
indicator: { tag: "ui-tabs-indicator", display: "block" },
|
|
32
|
+
panel: { tag: "ui-tabs-panel", display: "block" }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
defineTabsElements
|
|
37
|
+
};
|
package/dist/timeline.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/timeline.ts
|
|
2
|
+
import { timeline } from "@ui-sdk/core/timeline";
|
|
3
|
+
import { createParts } from "./define-element.js";
|
|
4
|
+
function defineTimelineElements() {
|
|
5
|
+
createParts(timeline, {
|
|
6
|
+
root: {
|
|
7
|
+
tag: "ui-timeline",
|
|
8
|
+
display: "block",
|
|
9
|
+
defaults: { loop: true },
|
|
10
|
+
api: ["focus"]
|
|
11
|
+
},
|
|
12
|
+
item: { tag: "ui-timeline-item", display: "block" },
|
|
13
|
+
marker: { tag: "ui-timeline-marker", display: "block" },
|
|
14
|
+
connector: { tag: "ui-timeline-connector", display: "block" },
|
|
15
|
+
// Binds to the `<time>` inside it, so its `datetime` stays machine readable.
|
|
16
|
+
time: {
|
|
17
|
+
tag: "ui-timeline-time",
|
|
18
|
+
display: "block",
|
|
19
|
+
target: (el) => el.querySelector(":scope > time") ?? el
|
|
20
|
+
},
|
|
21
|
+
title: { tag: "ui-timeline-title", display: "block" },
|
|
22
|
+
description: { tag: "ui-timeline-description", display: "block" }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
defineTimelineElements
|
|
27
|
+
};
|
package/dist/toast.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createToaster as createCoreToaster, type Toaster } from "@ui-sdk/core/toast";
|
|
2
|
+
/**
|
|
3
|
+
* What toasts can say on the web: text, or a node.
|
|
4
|
+
* @stable
|
|
5
|
+
*/
|
|
6
|
+
type ToastContent = string | Node;
|
|
7
|
+
declare function defineToastElements(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Shows a toast from anywhere: `toast("Saved")`, `toast.success(...)`,
|
|
10
|
+
* `toast.promise(save(), { loading, success, error })`. Content is text or a node.
|
|
11
|
+
* @stable
|
|
12
|
+
*/
|
|
13
|
+
declare const toast: Toaster<ToastContent>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a queue of toasts and the function that adds to it, for a second
|
|
16
|
+
* region with its own toasts. Pass it to that region as `toaster`.
|
|
17
|
+
* @stable
|
|
18
|
+
*/
|
|
19
|
+
declare const createToaster: <Content = ToastContent>(options?: Parameters<typeof createCoreToaster>[0]) => Toaster<Content>;
|
|
20
|
+
export { createToaster, defineToastElements, toast, type ToastContent };
|