@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/calendar.js
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
// src/calendar.ts
|
|
2
|
+
import {
|
|
3
|
+
calendar
|
|
4
|
+
} from "@ui-sdk/core/calendar";
|
|
5
|
+
import { partState } from "@ui-sdk/core/renderer";
|
|
6
|
+
import {
|
|
7
|
+
claimTag,
|
|
8
|
+
definePart,
|
|
9
|
+
createParts,
|
|
10
|
+
findOwner,
|
|
11
|
+
instanceOf,
|
|
12
|
+
ownButton,
|
|
13
|
+
parseAttribute,
|
|
14
|
+
setDisplay
|
|
15
|
+
} from "./define-element.js";
|
|
16
|
+
import { element } from "./list.js";
|
|
17
|
+
var owner = "ui-calendar, ui-date-picker";
|
|
18
|
+
var calendarLiveState = {
|
|
19
|
+
value: {
|
|
20
|
+
get: (api) => api.getValue(),
|
|
21
|
+
set: (api, value) => api.setValue(value)
|
|
22
|
+
},
|
|
23
|
+
month: {
|
|
24
|
+
get: (api) => api.getMonth(),
|
|
25
|
+
set: (api, month) => api.setMonth(month)
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function defineCalendarElements() {
|
|
29
|
+
createParts(calendar, {
|
|
30
|
+
root: {
|
|
31
|
+
tag: "ui-calendar",
|
|
32
|
+
display: "block",
|
|
33
|
+
defaults: { showOutsideDays: true },
|
|
34
|
+
// `unavailable` as a property takes any matcher, like `{ weekday: [0, 6] }`.
|
|
35
|
+
properties: ["unavailable"],
|
|
36
|
+
state: calendarLiveState,
|
|
37
|
+
api: [
|
|
38
|
+
"getValue",
|
|
39
|
+
"setValue",
|
|
40
|
+
"getMonth",
|
|
41
|
+
"setMonth",
|
|
42
|
+
"previous",
|
|
43
|
+
"next",
|
|
44
|
+
"focus"
|
|
45
|
+
],
|
|
46
|
+
render(el, instance) {
|
|
47
|
+
if (!checkedForContent.has(el)) {
|
|
48
|
+
checkedForContent.add(el);
|
|
49
|
+
if (!el.firstElementChild) {
|
|
50
|
+
renderDefaultCalendar(el, el);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return renderCalendarParts(el, instance);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
defineCalendarParts(calendar, "ui-date-picker");
|
|
58
|
+
}
|
|
59
|
+
function defineCalendarParts(primitive, also) {
|
|
60
|
+
const owners = [also];
|
|
61
|
+
definePart(primitive, "heading", {
|
|
62
|
+
tag: "ui-calendar-heading",
|
|
63
|
+
owners,
|
|
64
|
+
display: "block",
|
|
65
|
+
render(el) {
|
|
66
|
+
if (!el.hasAttribute("role")) {
|
|
67
|
+
el.setAttribute("role", "heading");
|
|
68
|
+
}
|
|
69
|
+
if (!el.hasAttribute("aria-level")) {
|
|
70
|
+
el.setAttribute("aria-level", "2");
|
|
71
|
+
}
|
|
72
|
+
scheduleRefresh(el);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
definePart(primitive, "previous", {
|
|
76
|
+
tag: "ui-calendar-previous",
|
|
77
|
+
owners,
|
|
78
|
+
display: "contents",
|
|
79
|
+
target: stepButton("\u2039")
|
|
80
|
+
});
|
|
81
|
+
definePart(primitive, "next", {
|
|
82
|
+
tag: "ui-calendar-next",
|
|
83
|
+
owners,
|
|
84
|
+
display: "contents",
|
|
85
|
+
target: stepButton("\u203A")
|
|
86
|
+
});
|
|
87
|
+
for (const [tag, slot] of selectParts) {
|
|
88
|
+
definePart(primitive, slot, {
|
|
89
|
+
tag,
|
|
90
|
+
owners,
|
|
91
|
+
display: "contents",
|
|
92
|
+
target: ownSelect,
|
|
93
|
+
render: scheduleRefresh
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
definePart(primitive, "grid", {
|
|
97
|
+
tag: "ui-calendar-grid",
|
|
98
|
+
owners,
|
|
99
|
+
display: "table",
|
|
100
|
+
context: (el) => ({ id: String(gridOffset(el)) }),
|
|
101
|
+
render(el) {
|
|
102
|
+
if (!el.firstElementChild) {
|
|
103
|
+
el.append(element("ui-calendar-weekdays"), element("ui-calendar-weeks"));
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
changed(el) {
|
|
107
|
+
for (const part of el.querySelectorAll(
|
|
108
|
+
"ui-calendar-weekdays, ui-calendar-weeks"
|
|
109
|
+
)) {
|
|
110
|
+
scheduleRefresh(part);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
definePart(primitive, "weekdays", {
|
|
115
|
+
tag: "ui-calendar-weekdays",
|
|
116
|
+
owners,
|
|
117
|
+
display: "table-header-group",
|
|
118
|
+
target: weekdaysRow,
|
|
119
|
+
context: (el) => ({ id: String(gridOffset(el)) }),
|
|
120
|
+
render(el) {
|
|
121
|
+
el.setAttribute("role", "rowgroup");
|
|
122
|
+
scheduleRefresh(el);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
definePart(primitive, "weekday", {
|
|
126
|
+
tag: "ui-calendar-weekday",
|
|
127
|
+
owners,
|
|
128
|
+
display: "table-cell",
|
|
129
|
+
context: (el) => ({ id: `${gridOffset(el)}-${el.getAttribute("index")}` })
|
|
130
|
+
});
|
|
131
|
+
defineWeeksElement();
|
|
132
|
+
definePart(primitive, "week", {
|
|
133
|
+
tag: "ui-calendar-week",
|
|
134
|
+
owners,
|
|
135
|
+
display: "table-row"
|
|
136
|
+
});
|
|
137
|
+
definePart(primitive, "day", {
|
|
138
|
+
tag: "ui-calendar-day",
|
|
139
|
+
owners,
|
|
140
|
+
display: "table-cell",
|
|
141
|
+
context: (el) => ({ offset: gridOffset(el) })
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function defineWeeksElement() {
|
|
145
|
+
if (!claimTag("ui-calendar-weeks")) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
setDisplay("ui-calendar-weeks", "table-row-group");
|
|
149
|
+
setDisplay("ui-calendar-weekdays > :not(template)", "table-row");
|
|
150
|
+
setDisplay("ui-calendar-week > [role=gridcell]", "table-cell");
|
|
151
|
+
customElements.define(
|
|
152
|
+
"ui-calendar-weeks",
|
|
153
|
+
class extends HTMLElement {
|
|
154
|
+
connectedCallback() {
|
|
155
|
+
this.setAttribute("role", "rowgroup");
|
|
156
|
+
scheduleRefresh(this);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
var checkedForContent = /* @__PURE__ */ new WeakSet();
|
|
162
|
+
var defaultContainers = /* @__PURE__ */ new WeakMap();
|
|
163
|
+
var stateParts = /* @__PURE__ */ new WeakMap();
|
|
164
|
+
var renderedGrids = /* @__PURE__ */ new WeakMap();
|
|
165
|
+
var renderedKeys = /* @__PURE__ */ new WeakMap();
|
|
166
|
+
function renderDefaultCalendar(container, calendar2) {
|
|
167
|
+
defaultContainers.set(calendar2, container);
|
|
168
|
+
const header = element("div");
|
|
169
|
+
header.append(
|
|
170
|
+
element("ui-calendar-previous"),
|
|
171
|
+
element("ui-calendar-heading"),
|
|
172
|
+
element("ui-calendar-next")
|
|
173
|
+
);
|
|
174
|
+
container.append(header);
|
|
175
|
+
}
|
|
176
|
+
function renderCalendarParts(calendar2, instance) {
|
|
177
|
+
const update = () => refresh(calendar2);
|
|
178
|
+
update();
|
|
179
|
+
return instance.subscribe(update);
|
|
180
|
+
}
|
|
181
|
+
var stepButton = (arrow) => ownButton((button) => button.textContent = arrow);
|
|
182
|
+
function weekdaysRow(el) {
|
|
183
|
+
const written = el.querySelector(":scope > :not(template)");
|
|
184
|
+
if (written) {
|
|
185
|
+
return written;
|
|
186
|
+
}
|
|
187
|
+
const row = element("div");
|
|
188
|
+
el.append(row);
|
|
189
|
+
return row;
|
|
190
|
+
}
|
|
191
|
+
var selectParts = [
|
|
192
|
+
["ui-calendar-month-select", "month-select"],
|
|
193
|
+
["ui-calendar-year-select", "year-select"]
|
|
194
|
+
];
|
|
195
|
+
function ownSelect(el) {
|
|
196
|
+
const written = el.querySelector(":scope > select");
|
|
197
|
+
if (written) {
|
|
198
|
+
return written;
|
|
199
|
+
}
|
|
200
|
+
const select = element("select");
|
|
201
|
+
select.append(...el.childNodes);
|
|
202
|
+
el.append(select);
|
|
203
|
+
return select;
|
|
204
|
+
}
|
|
205
|
+
var gridOffset = (el) => {
|
|
206
|
+
const offset = parseAttribute(
|
|
207
|
+
"number",
|
|
208
|
+
el.closest("ui-calendar-grid")?.getAttribute("offset") ?? null
|
|
209
|
+
);
|
|
210
|
+
return typeof offset === "number" ? offset : 0;
|
|
211
|
+
};
|
|
212
|
+
var ownText = /* @__PURE__ */ new WeakSet();
|
|
213
|
+
function writeLabel(el, label) {
|
|
214
|
+
if (!ownText.has(el)) {
|
|
215
|
+
if (el.firstElementChild || el.textContent?.trim()) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
ownText.add(el);
|
|
219
|
+
}
|
|
220
|
+
const text = label();
|
|
221
|
+
if (el.textContent !== text) {
|
|
222
|
+
el.textContent = text;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function templatedPart(container, tagName, attributes) {
|
|
226
|
+
const template = container.querySelector(":scope > template")?.content.firstElementChild;
|
|
227
|
+
const part = template?.localName === tagName ? template.cloneNode(true) : element(tagName);
|
|
228
|
+
for (const [name, value] of Object.entries(attributes)) {
|
|
229
|
+
part.setAttribute(name, value);
|
|
230
|
+
}
|
|
231
|
+
return part;
|
|
232
|
+
}
|
|
233
|
+
function place(parent, el, previous) {
|
|
234
|
+
const current = previous ? previous.nextElementSibling : parent.firstElementChild;
|
|
235
|
+
if (current === el) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (previous) {
|
|
239
|
+
previous.after(el);
|
|
240
|
+
} else {
|
|
241
|
+
parent.prepend(el);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
var scheduled = /* @__PURE__ */ new WeakSet();
|
|
245
|
+
function scheduleRefresh(part) {
|
|
246
|
+
const calendar2 = findOwner(part, owner);
|
|
247
|
+
if (!calendar2) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
let parts = stateParts.get(calendar2);
|
|
251
|
+
if (!parts) {
|
|
252
|
+
stateParts.set(calendar2, parts = /* @__PURE__ */ new Set());
|
|
253
|
+
}
|
|
254
|
+
parts.add(part);
|
|
255
|
+
if (scheduled.has(calendar2)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
scheduled.add(calendar2);
|
|
259
|
+
queueMicrotask(() => {
|
|
260
|
+
scheduled.delete(calendar2);
|
|
261
|
+
refresh(calendar2);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function refresh(calendar2) {
|
|
265
|
+
const instance = instanceOf(calendar2);
|
|
266
|
+
if (!instance) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
matchMonths(calendar2);
|
|
270
|
+
const parts = stateParts.get(calendar2);
|
|
271
|
+
if (!parts) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
for (const el of parts) {
|
|
275
|
+
if (!el.isConnected || findOwner(el, owner) !== calendar2) {
|
|
276
|
+
parts.delete(el);
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
if (el.localName === "ui-calendar-heading") {
|
|
280
|
+
writeLabel(
|
|
281
|
+
el,
|
|
282
|
+
() => partState(instance.part("heading")).label
|
|
283
|
+
);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const select = selectParts.find(([tagName]) => tagName === el.localName);
|
|
287
|
+
if (select) {
|
|
288
|
+
renderOptions(el, instance, select[1]);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const offset = gridOffset(el);
|
|
292
|
+
const grid = partState(
|
|
293
|
+
instance.part("grid", { offset, id: String(offset) })
|
|
294
|
+
);
|
|
295
|
+
if (el.localName === "ui-calendar-weeks") {
|
|
296
|
+
renderWeeks(el, instance, offset, grid);
|
|
297
|
+
} else {
|
|
298
|
+
renderWeekdays(el, calendar2, instance, offset, grid);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
var ownOptions = /* @__PURE__ */ new WeakSet();
|
|
303
|
+
var renderedOptions = /* @__PURE__ */ new WeakMap();
|
|
304
|
+
function renderOptions(el, instance, slot) {
|
|
305
|
+
const select = el.querySelector(":scope > select");
|
|
306
|
+
const state = partState(instance.part(slot));
|
|
307
|
+
if (!select || renderedOptions.get(select) === state) {
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
renderedOptions.set(select, state);
|
|
311
|
+
if (!ownOptions.has(select)) {
|
|
312
|
+
if (select.options.length) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
ownOptions.add(select);
|
|
316
|
+
}
|
|
317
|
+
select.replaceChildren(
|
|
318
|
+
...state.options.map(
|
|
319
|
+
(option) => element(
|
|
320
|
+
"option",
|
|
321
|
+
{ value: String(option.value), disabled: option.disabled },
|
|
322
|
+
option.label
|
|
323
|
+
)
|
|
324
|
+
)
|
|
325
|
+
);
|
|
326
|
+
select.value = String(state.value);
|
|
327
|
+
}
|
|
328
|
+
function matchMonths(calendar2) {
|
|
329
|
+
const container = defaultContainers.get(calendar2);
|
|
330
|
+
if (!container) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const months = parseAttribute("number", calendar2.getAttribute("months"));
|
|
334
|
+
const count = Number.isFinite(months) ? Math.max(1, Math.floor(months)) : 1;
|
|
335
|
+
const grids = container.querySelectorAll(":scope > ui-calendar-grid");
|
|
336
|
+
for (let offset = grids.length; offset < count; offset++) {
|
|
337
|
+
container.append(element("ui-calendar-grid", { offset: String(offset) }));
|
|
338
|
+
}
|
|
339
|
+
for (let offset = count; offset < grids.length; offset++) {
|
|
340
|
+
grids[offset].remove();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
var renderedFormats = /* @__PURE__ */ new WeakMap();
|
|
344
|
+
function renderWeekdays(weekdays, calendar2, instance, offset, grid) {
|
|
345
|
+
const row = weekdays.querySelector(":scope > :not(template)");
|
|
346
|
+
const format = calendar2.getAttribute("weekday-format");
|
|
347
|
+
if (!row || renderedGrids.get(weekdays) === grid && renderedFormats.get(weekdays) === format) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
renderedGrids.set(weekdays, grid);
|
|
351
|
+
renderedFormats.set(weekdays, format);
|
|
352
|
+
if (!row.firstElementChild) {
|
|
353
|
+
row.append(
|
|
354
|
+
...grid.weekdays.map(
|
|
355
|
+
(_, index) => templatedPart(weekdays, "ui-calendar-weekday", { index: String(index) })
|
|
356
|
+
)
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
for (const weekday of row.querySelectorAll(":scope > ui-calendar-weekday")) {
|
|
360
|
+
const index = Number(weekday.getAttribute("index"));
|
|
361
|
+
writeLabel(
|
|
362
|
+
weekday,
|
|
363
|
+
() => partState(
|
|
364
|
+
instance.part("weekday", { index, id: `${offset}-${index}` })
|
|
365
|
+
).label
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
function renderWeeks(weeks, instance, offset, grid) {
|
|
370
|
+
if (renderedGrids.get(weeks) === grid) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
renderedGrids.set(weeks, grid);
|
|
374
|
+
const rows = /* @__PURE__ */ new Map();
|
|
375
|
+
const cells = /* @__PURE__ */ new Map();
|
|
376
|
+
for (const row of weeks.children) {
|
|
377
|
+
const key = renderedKeys.get(row);
|
|
378
|
+
if (key === void 0) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
rows.set(key, row);
|
|
382
|
+
for (const cell of row.children) {
|
|
383
|
+
const cellKey = renderedKeys.get(cell);
|
|
384
|
+
if (cellKey !== void 0) {
|
|
385
|
+
cells.set(cellKey, cell);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
let previousRow = weeks.querySelector(":scope > template");
|
|
390
|
+
for (const week of grid.weeks) {
|
|
391
|
+
const rowKey = week[0].date;
|
|
392
|
+
const row = rows.get(rowKey) ?? element("ui-calendar-week");
|
|
393
|
+
rows.delete(rowKey);
|
|
394
|
+
renderedKeys.set(row, rowKey);
|
|
395
|
+
place(weeks, row, previousRow);
|
|
396
|
+
previousRow = row;
|
|
397
|
+
let previousCell = null;
|
|
398
|
+
for (const cell of week) {
|
|
399
|
+
const cellKey = cell.hidden ? `hidden ${cell.date}` : cell.date;
|
|
400
|
+
const el = cells.get(cellKey) ?? createCell(weeks, cell);
|
|
401
|
+
cells.delete(cellKey);
|
|
402
|
+
renderedKeys.set(el, cellKey);
|
|
403
|
+
place(row, el, previousCell);
|
|
404
|
+
previousCell = el;
|
|
405
|
+
if (!cell.hidden) {
|
|
406
|
+
writeLabel(el, () => dayLabel(instance, cell.date, offset));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
for (const cell of cells.values()) {
|
|
411
|
+
cell.remove();
|
|
412
|
+
}
|
|
413
|
+
for (const row of rows.values()) {
|
|
414
|
+
row.remove();
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
function createCell(weeks, cell) {
|
|
418
|
+
if (cell.hidden) {
|
|
419
|
+
return element("span", { role: "gridcell" });
|
|
420
|
+
}
|
|
421
|
+
return templatedPart(weeks, "ui-calendar-day", { value: cell.date });
|
|
422
|
+
}
|
|
423
|
+
var dayLabel = (instance, value, offset) => partState(instance.part("day", { value, offset })).label;
|
|
424
|
+
export {
|
|
425
|
+
defineCalendarElements,
|
|
426
|
+
defineCalendarParts,
|
|
427
|
+
renderCalendarParts,
|
|
428
|
+
renderDefaultCalendar
|
|
429
|
+
};
|
package/dist/carousel.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/carousel.ts
|
|
2
|
+
import { carousel } from "@ui-sdk/core/carousel";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
var wrapper = { display: "contents", target: wrappedButton };
|
|
5
|
+
function defineCarouselElements() {
|
|
6
|
+
createParts(carousel, {
|
|
7
|
+
root: {
|
|
8
|
+
tag: "ui-carousel",
|
|
9
|
+
display: "block",
|
|
10
|
+
defaults: { drag: true },
|
|
11
|
+
// `page` and `playing` are live: setting the property or the attribute
|
|
12
|
+
// pages or rotates, like a controller, and fires the change event.
|
|
13
|
+
state: {
|
|
14
|
+
page: {
|
|
15
|
+
get: (api) => api.getPage(),
|
|
16
|
+
set: (api, page) => api.setPage(Number(page))
|
|
17
|
+
},
|
|
18
|
+
playing: {
|
|
19
|
+
get: (api) => api.isPlaying(),
|
|
20
|
+
set: (api, playing) => api.setPlaying(!!playing)
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
api: [
|
|
24
|
+
"getPage",
|
|
25
|
+
"getPageCount",
|
|
26
|
+
"setPage",
|
|
27
|
+
"next",
|
|
28
|
+
"previous",
|
|
29
|
+
"canNext",
|
|
30
|
+
"canPrevious",
|
|
31
|
+
"getProgress",
|
|
32
|
+
"isPlaying",
|
|
33
|
+
"setPlaying",
|
|
34
|
+
"play",
|
|
35
|
+
"pause"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
viewport: { tag: "ui-carousel-viewport", display: "block" },
|
|
39
|
+
content: { tag: "ui-carousel-content", display: "block" },
|
|
40
|
+
item: { tag: "ui-carousel-item", display: "block" },
|
|
41
|
+
previous: { tag: "ui-carousel-previous", ...wrapper },
|
|
42
|
+
next: { tag: "ui-carousel-next", ...wrapper },
|
|
43
|
+
"play-toggle": { tag: "ui-carousel-play-toggle", ...wrapper },
|
|
44
|
+
"indicator-group": { tag: "ui-carousel-indicator-group", display: "block" },
|
|
45
|
+
indicator: {
|
|
46
|
+
tag: "ui-carousel-indicator",
|
|
47
|
+
...wrapper,
|
|
48
|
+
render: (el) => el.setAttribute("role", "none")
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
defineCarouselElements
|
|
54
|
+
};
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/checkbox.ts
|
|
2
|
+
import {
|
|
3
|
+
checkbox,
|
|
4
|
+
checkboxGroup
|
|
5
|
+
} from "@ui-sdk/core/checkbox";
|
|
6
|
+
import { switchPrimitive } from "@ui-sdk/core/switch";
|
|
7
|
+
import { createParts, instanceOf } from "./define-element.js";
|
|
8
|
+
var toggleApi = [
|
|
9
|
+
"getChecked",
|
|
10
|
+
"setChecked",
|
|
11
|
+
"toggle",
|
|
12
|
+
"focus"
|
|
13
|
+
];
|
|
14
|
+
function defineCheckboxElements() {
|
|
15
|
+
createParts(checkbox, {
|
|
16
|
+
root: {
|
|
17
|
+
tag: "ui-checkbox",
|
|
18
|
+
formAssociated: true,
|
|
19
|
+
// Its group is the one around it, never an attribute or a property.
|
|
20
|
+
kinds: { group: null },
|
|
21
|
+
options: (el) => ({
|
|
22
|
+
// Read when needed, since the group may upgrade after the checkbox.
|
|
23
|
+
group: () => instanceOf(
|
|
24
|
+
el.parentElement?.closest("ui-checkbox-group")
|
|
25
|
+
)?.api
|
|
26
|
+
}),
|
|
27
|
+
state: {
|
|
28
|
+
checked: {
|
|
29
|
+
get: (api) => api.getChecked(),
|
|
30
|
+
set: (api, checked) => api.setChecked(checked)
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
api: toggleApi
|
|
34
|
+
},
|
|
35
|
+
indicator: "ui-checkbox-indicator"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function defineCheckboxGroupElements() {
|
|
39
|
+
createParts(checkboxGroup, {
|
|
40
|
+
root: {
|
|
41
|
+
tag: "ui-checkbox-group",
|
|
42
|
+
self: "group",
|
|
43
|
+
display: "block",
|
|
44
|
+
formAssociated: true,
|
|
45
|
+
state: {
|
|
46
|
+
value: {
|
|
47
|
+
get: (api) => api.getValue(),
|
|
48
|
+
set: (api, value) => api.setValue(value ?? [])
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
api: ["getValue", "setValue", "focus"]
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function defineSwitchElements() {
|
|
56
|
+
createParts(switchPrimitive, {
|
|
57
|
+
root: {
|
|
58
|
+
tag: "ui-switch",
|
|
59
|
+
formAssociated: true,
|
|
60
|
+
state: {
|
|
61
|
+
checked: {
|
|
62
|
+
get: (api) => api.getChecked(),
|
|
63
|
+
set: (api, checked) => api.setChecked(!!checked)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
api: toggleApi
|
|
67
|
+
},
|
|
68
|
+
thumb: { tag: "ui-switch-thumb", display: "block" }
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
defineCheckboxElements,
|
|
73
|
+
defineCheckboxGroupElements,
|
|
74
|
+
defineSwitchElements
|
|
75
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/collapsible.ts
|
|
2
|
+
import { collapsible } from "@ui-sdk/core/collapsible";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
function defineCollapsibleElements() {
|
|
5
|
+
createParts(collapsible, {
|
|
6
|
+
root: {
|
|
7
|
+
tag: "ui-collapsible",
|
|
8
|
+
display: "block",
|
|
9
|
+
state: {
|
|
10
|
+
open: {
|
|
11
|
+
get: (api) => api.isOpen(),
|
|
12
|
+
set: (api, open) => api.setOpen(!!open)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
api: ["isOpen", "setOpen", "open", "close", "toggle", "focus"]
|
|
16
|
+
},
|
|
17
|
+
// A wrapper, so the trigger stays a real button with its built-in behavior.
|
|
18
|
+
trigger: {
|
|
19
|
+
tag: "ui-collapsible-trigger",
|
|
20
|
+
display: "contents",
|
|
21
|
+
target: wrappedButton
|
|
22
|
+
},
|
|
23
|
+
panel: { tag: "ui-collapsible-panel", display: "block" }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
defineCollapsibleElements
|
|
28
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/color-picker.ts
|
|
2
|
+
import { colorPicker } from "@ui-sdk/core/color-picker";
|
|
3
|
+
import { createParts, ownButton } from "./define-element.js";
|
|
4
|
+
function own(tag) {
|
|
5
|
+
return (el) => {
|
|
6
|
+
const written = el.querySelector(tag);
|
|
7
|
+
if (written) {
|
|
8
|
+
return written;
|
|
9
|
+
}
|
|
10
|
+
const made = el.ownerDocument.createElement(tag);
|
|
11
|
+
el.append(made);
|
|
12
|
+
return made;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function defineColorPickerElements() {
|
|
16
|
+
createParts(colorPicker, {
|
|
17
|
+
root: {
|
|
18
|
+
tag: "ui-color-picker",
|
|
19
|
+
display: "block",
|
|
20
|
+
formAssociated: true,
|
|
21
|
+
state: {
|
|
22
|
+
value: {
|
|
23
|
+
get: (api) => api.getValue(),
|
|
24
|
+
set: (api, value) => api.setValue(value)
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
api: ["getValue", "setValue", "focus"]
|
|
28
|
+
},
|
|
29
|
+
area: { tag: "ui-color-picker-area", display: "block" },
|
|
30
|
+
"area-thumb": { tag: "ui-color-picker-area-thumb", display: "block" },
|
|
31
|
+
"area-canvas": {
|
|
32
|
+
tag: "ui-color-picker-area-canvas",
|
|
33
|
+
display: "contents",
|
|
34
|
+
target: own("canvas")
|
|
35
|
+
},
|
|
36
|
+
slider: { tag: "ui-color-picker-slider", display: "block" },
|
|
37
|
+
"slider-thumb": { tag: "ui-color-picker-slider-thumb", display: "block" },
|
|
38
|
+
input: {
|
|
39
|
+
tag: "ui-color-picker-input",
|
|
40
|
+
display: "contents",
|
|
41
|
+
target: own("input")
|
|
42
|
+
},
|
|
43
|
+
"channel-input": {
|
|
44
|
+
tag: "ui-color-picker-channel-input",
|
|
45
|
+
display: "contents",
|
|
46
|
+
target: own("input")
|
|
47
|
+
},
|
|
48
|
+
swatch: { tag: "ui-color-picker-swatch", display: "block" },
|
|
49
|
+
"eye-dropper": {
|
|
50
|
+
tag: "ui-color-picker-eye-dropper",
|
|
51
|
+
display: "contents",
|
|
52
|
+
target: ownButton()
|
|
53
|
+
},
|
|
54
|
+
swatches: { tag: "ui-color-picker-swatches", display: "block" },
|
|
55
|
+
"swatch-item": {
|
|
56
|
+
tag: "ui-color-picker-swatch-item",
|
|
57
|
+
display: "contents",
|
|
58
|
+
target: ownButton()
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
defineColorPickerElements
|
|
64
|
+
};
|