@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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/accordion.ts
|
|
2
|
+
import { accordion } from "@ui-sdk/core/accordion";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
var heading = ":scope > :is(h1, h2, h3, h4, h5, h6)";
|
|
5
|
+
function defineAccordionElements() {
|
|
6
|
+
createParts(accordion, {
|
|
7
|
+
root: {
|
|
8
|
+
tag: "ui-accordion",
|
|
9
|
+
display: "block",
|
|
10
|
+
defaults: { collapsible: true },
|
|
11
|
+
state: {
|
|
12
|
+
value: {
|
|
13
|
+
get: (api) => api.getValue(),
|
|
14
|
+
set: (api, value) => api.setValue(value ?? [])
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
api: [
|
|
18
|
+
"getValue",
|
|
19
|
+
"setValue",
|
|
20
|
+
"isOpen",
|
|
21
|
+
"open",
|
|
22
|
+
"close",
|
|
23
|
+
"toggle",
|
|
24
|
+
"openAll",
|
|
25
|
+
"closeAll",
|
|
26
|
+
"focus"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
// Fires `openchange` and `openchangecomplete` with the item's open state.
|
|
30
|
+
item: { tag: "ui-accordion-item", display: "block" },
|
|
31
|
+
// Binds to the heading inside it. Without one, the element is the heading.
|
|
32
|
+
header: {
|
|
33
|
+
tag: "ui-accordion-header",
|
|
34
|
+
display: "block",
|
|
35
|
+
target: (el) => el.querySelector(heading) ?? el,
|
|
36
|
+
render(el) {
|
|
37
|
+
if (el.querySelector(heading)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
el.setAttribute("role", "heading");
|
|
41
|
+
if (!el.hasAttribute("aria-level")) {
|
|
42
|
+
el.setAttribute("aria-level", "3");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
// A wrapper, so the trigger stays a real button with its built-in behavior.
|
|
47
|
+
trigger: {
|
|
48
|
+
tag: "ui-accordion-trigger",
|
|
49
|
+
display: "contents",
|
|
50
|
+
target: wrappedButton
|
|
51
|
+
},
|
|
52
|
+
panel: { tag: "ui-accordion-panel", display: "block" }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
defineAccordionElements
|
|
57
|
+
};
|
package/dist/action.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ActionDetails } from "@ui-sdk/core";
|
|
2
|
+
import { canceledAction } from "@ui-sdk/core/renderer";
|
|
3
|
+
/**
|
|
4
|
+
* The `detail` of an `action` event: how the part was pressed, and `waitUntil()`.
|
|
5
|
+
* @stable
|
|
6
|
+
*/
|
|
7
|
+
type UiActionDetail = ActionDetails & {
|
|
8
|
+
/** Keeps the part pending until the Promise settles. A rejection becomes the part's error. */
|
|
9
|
+
waitUntil: (promise: Promise<unknown>) => void;
|
|
10
|
+
};
|
|
11
|
+
declare function waitList(): {
|
|
12
|
+
waitUntil: (promise: unknown) => void;
|
|
13
|
+
done: () => unknown[];
|
|
14
|
+
};
|
|
15
|
+
declare const actionOf: (el: HTMLElement) => (_event: Event | undefined, details: ActionDetails) => typeof canceledAction | Promise<unknown[]> | undefined;
|
|
16
|
+
export { actionOf, type UiActionDetail, waitList };
|
package/dist/action.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/action.ts
|
|
2
|
+
import { canceledAction } from "@ui-sdk/core/renderer";
|
|
3
|
+
function waitList() {
|
|
4
|
+
const waiting = [];
|
|
5
|
+
let dispatching = true;
|
|
6
|
+
const waitUntil = (promise) => {
|
|
7
|
+
if (!dispatching) {
|
|
8
|
+
throw new DOMException(
|
|
9
|
+
"waitUntil() can only be called while the event dispatches.",
|
|
10
|
+
"InvalidStateError"
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
waiting.push(promise);
|
|
14
|
+
};
|
|
15
|
+
const done = () => {
|
|
16
|
+
dispatching = false;
|
|
17
|
+
return waiting;
|
|
18
|
+
};
|
|
19
|
+
return { waitUntil, done };
|
|
20
|
+
}
|
|
21
|
+
var actionOf = (el) => (_event, details) => {
|
|
22
|
+
const { waitUntil, done } = waitList();
|
|
23
|
+
const proceed = el.dispatchEvent(
|
|
24
|
+
new CustomEvent("action", {
|
|
25
|
+
cancelable: true,
|
|
26
|
+
composed: true,
|
|
27
|
+
detail: { ...details, waitUntil }
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
const waiting = done();
|
|
31
|
+
if (!proceed) {
|
|
32
|
+
return canceledAction;
|
|
33
|
+
}
|
|
34
|
+
return waiting.length ? Promise.all(waiting) : void 0;
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
actionOf,
|
|
38
|
+
waitList
|
|
39
|
+
};
|
package/dist/agent.d.ts
ADDED
package/dist/agent.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// src/autocomplete.ts
|
|
2
|
+
import {
|
|
3
|
+
autocomplete
|
|
4
|
+
} from "@ui-sdk/core/autocomplete";
|
|
5
|
+
import { createParts, wrappedChild } from "./define-element.js";
|
|
6
|
+
import { copy, itemText, renderData, stashedEmpty, templateOf } from "./list.js";
|
|
7
|
+
import { popupKinds, popupState, sheetInputPortal } from "./popup.js";
|
|
8
|
+
var owner = "ui-autocomplete";
|
|
9
|
+
var lists = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function defineAutocompleteElements() {
|
|
11
|
+
createParts(autocomplete, {
|
|
12
|
+
root: {
|
|
13
|
+
tag: owner,
|
|
14
|
+
defaults: { loop: true, dismissible: true },
|
|
15
|
+
display: "contents",
|
|
16
|
+
kinds: popupKinds,
|
|
17
|
+
// A filter function is a property; the attribute takes the named modes.
|
|
18
|
+
properties: ["filter"],
|
|
19
|
+
options: (el) => {
|
|
20
|
+
const data = el;
|
|
21
|
+
return {
|
|
22
|
+
items: data.items,
|
|
23
|
+
...(typeof data.filter === "function" || data.filter === false) && {
|
|
24
|
+
filter: data.filter
|
|
25
|
+
},
|
|
26
|
+
container: void 0,
|
|
27
|
+
onSubmit: (value, { event }) => submitted(el, value, event)
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
state: {
|
|
31
|
+
value: {
|
|
32
|
+
get: (api) => api.getValue(),
|
|
33
|
+
set: (api, value) => api.setValue(value ?? "")
|
|
34
|
+
},
|
|
35
|
+
...popupState
|
|
36
|
+
},
|
|
37
|
+
api: [
|
|
38
|
+
"isOpen",
|
|
39
|
+
"setOpen",
|
|
40
|
+
"open",
|
|
41
|
+
"close",
|
|
42
|
+
"toggle",
|
|
43
|
+
"getValue",
|
|
44
|
+
"setValue",
|
|
45
|
+
"clear",
|
|
46
|
+
"focus"
|
|
47
|
+
],
|
|
48
|
+
// container="#id" renders the suggestions there. As a sheet, they sit in a
|
|
49
|
+
// viewport there and the field moves into its header.
|
|
50
|
+
portal: sheetInputPortal("ui-autocomplete-viewport"),
|
|
51
|
+
// Runs again whenever `items` is set. Data suggestions follow the text.
|
|
52
|
+
render(el, instance) {
|
|
53
|
+
const target = el;
|
|
54
|
+
renderSuggestions(target, instance.api);
|
|
55
|
+
return instance.subscribe(() => renderSuggestions(target, instance.api));
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
label: { tag: "ui-autocomplete-label", display: "block" },
|
|
59
|
+
// Wrappers, so the field stays a real input and the buttons real buttons.
|
|
60
|
+
input: {
|
|
61
|
+
tag: "ui-autocomplete-input",
|
|
62
|
+
display: "contents",
|
|
63
|
+
target: wrappedChild("input")
|
|
64
|
+
},
|
|
65
|
+
trigger: {
|
|
66
|
+
tag: "ui-autocomplete-trigger",
|
|
67
|
+
display: "contents",
|
|
68
|
+
target: wrappedChild("button")
|
|
69
|
+
},
|
|
70
|
+
clear: {
|
|
71
|
+
tag: "ui-autocomplete-clear",
|
|
72
|
+
display: "contents",
|
|
73
|
+
target: wrappedChild("button")
|
|
74
|
+
},
|
|
75
|
+
content: { tag: "ui-autocomplete-content", kinds: popupKinds },
|
|
76
|
+
list: { tag: "ui-autocomplete-list", display: "block" },
|
|
77
|
+
item: { tag: "ui-autocomplete-item", display: "block" },
|
|
78
|
+
// Its text, with what the field's text matched in <mark>. It holds text only.
|
|
79
|
+
"item-text": { tag: "ui-autocomplete-item-text", ...itemText },
|
|
80
|
+
// An icon inside a suggestion. Screen readers and filtering skip it.
|
|
81
|
+
"item-icon": "ui-autocomplete-item-icon",
|
|
82
|
+
group: { tag: "ui-autocomplete-group", display: "block" },
|
|
83
|
+
"group-label": { tag: "ui-autocomplete-group-label", display: "block" },
|
|
84
|
+
separator: { tag: "ui-autocomplete-separator", display: "block" },
|
|
85
|
+
empty: { tag: "ui-autocomplete-empty", ...stashedEmpty },
|
|
86
|
+
status: { tag: "ui-autocomplete-status", display: "block" },
|
|
87
|
+
arrow: { tag: "ui-autocomplete-arrow", display: "block" }
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function submitted(el, value, event) {
|
|
91
|
+
const submit = new CustomEvent("submit", {
|
|
92
|
+
cancelable: true,
|
|
93
|
+
composed: true,
|
|
94
|
+
detail: { value }
|
|
95
|
+
});
|
|
96
|
+
if (!el.dispatchEvent(submit)) {
|
|
97
|
+
event?.preventDefault();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function renderSuggestions(el, api) {
|
|
101
|
+
if (!el.items) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const template = templateOf(el);
|
|
105
|
+
let list = lists.get(el) ?? [
|
|
106
|
+
...el.querySelectorAll("ui-autocomplete-content ui-autocomplete-list")
|
|
107
|
+
].find((found) => found.closest("ui-autocomplete") === el);
|
|
108
|
+
if (!list) {
|
|
109
|
+
const created = copy(template, "ui-autocomplete-content", false);
|
|
110
|
+
list = copy(template, "ui-autocomplete-list", false);
|
|
111
|
+
created.append(list);
|
|
112
|
+
el.append(created);
|
|
113
|
+
}
|
|
114
|
+
lists.set(el, list);
|
|
115
|
+
const visible = api.internal.listbox.visibleData()?.list ?? el.items;
|
|
116
|
+
renderData(list, "ui-autocomplete", visible, template);
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
defineAutocompleteElements
|
|
120
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry that defines `tag`: the longest entry named like it, as
|
|
3
|
+
* `tabs` for <ui-tabs-tab> or `overlays` for <ui-overlay-host>.
|
|
4
|
+
*/
|
|
5
|
+
declare function entryOf(tag: string, entries: readonly string[]): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The folder a loader at `scriptUrl` loads components from: `web@1.2.0/`
|
|
8
|
+
* beside `web@1.2.0.js`. A query or hash on the script, like `?v=2`, isn't
|
|
9
|
+
* part of the folder's name.
|
|
10
|
+
*/
|
|
11
|
+
declare function componentsBase(scriptUrl: string): URL;
|
|
12
|
+
/**
|
|
13
|
+
* Imports the entry of every undefined `ui-` element in `root` from `base`,
|
|
14
|
+
* like `web/tabs.js`, then of every one added later, inside open shadow roots
|
|
15
|
+
* too.
|
|
16
|
+
*/
|
|
17
|
+
declare function autoload(base: URL, entries: readonly string[], root?: Document): () => void;
|
|
18
|
+
export { autoload, componentsBase, entryOf };
|
package/dist/autoload.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/autoload.ts
|
|
2
|
+
function entryOf(tag, entries) {
|
|
3
|
+
let match;
|
|
4
|
+
for (const entry of entries) {
|
|
5
|
+
const named = [entry, entry.replace(/s$/, "")].some(
|
|
6
|
+
(stem) => tag === `ui-${stem}` || tag.startsWith(`ui-${stem}-`)
|
|
7
|
+
);
|
|
8
|
+
if (named && entry.length > (match?.length ?? 0)) {
|
|
9
|
+
match = entry;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return match;
|
|
13
|
+
}
|
|
14
|
+
function componentsBase(scriptUrl) {
|
|
15
|
+
return new URL(new URL(scriptUrl).pathname.replace(/\.js$/, "/"), scriptUrl);
|
|
16
|
+
}
|
|
17
|
+
function autoload(base, entries, root = document) {
|
|
18
|
+
const requested = /* @__PURE__ */ new Set();
|
|
19
|
+
const shadowRoots = /* @__PURE__ */ new WeakSet();
|
|
20
|
+
const observer = new MutationObserver((records) => {
|
|
21
|
+
for (const record of records) {
|
|
22
|
+
for (const node of record.addedNodes) {
|
|
23
|
+
load(node);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const load = (node) => {
|
|
28
|
+
if (!(node instanceof Element)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (const element of [node, ...node.querySelectorAll("*")]) {
|
|
32
|
+
const shadowRoot = element.shadowRoot;
|
|
33
|
+
if (shadowRoot && !shadowRoots.has(shadowRoot)) {
|
|
34
|
+
shadowRoots.add(shadowRoot);
|
|
35
|
+
observer.observe(shadowRoot, { childList: true, subtree: true });
|
|
36
|
+
for (const child of shadowRoot.children) {
|
|
37
|
+
load(child);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const tag = element.localName;
|
|
41
|
+
if (!tag.startsWith("ui-") || customElements.get(tag)) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const entry = entryOf(tag, entries);
|
|
45
|
+
if (!entry || requested.has(entry)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
requested.add(entry);
|
|
49
|
+
void import(
|
|
50
|
+
/* @vite-ignore */
|
|
51
|
+
new URL(`${entry}.js`, base).href
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
load(root.documentElement);
|
|
56
|
+
observer.observe(root.documentElement, { childList: true, subtree: true });
|
|
57
|
+
return () => observer.disconnect();
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
autoload,
|
|
61
|
+
componentsBase,
|
|
62
|
+
entryOf
|
|
63
|
+
};
|
package/dist/avatar.d.ts
ADDED
package/dist/avatar.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/avatar.ts
|
|
2
|
+
import { avatar } from "@ui-sdk/core/avatar";
|
|
3
|
+
import { createParts } from "./define-element.js";
|
|
4
|
+
function defineAvatarElements() {
|
|
5
|
+
createParts(avatar, {
|
|
6
|
+
root: {
|
|
7
|
+
tag: "ui-avatar",
|
|
8
|
+
children: { image: (el) => el.querySelector(":scope > img") },
|
|
9
|
+
// The fallback may upgrade after the avatar binds, so its delay comes from markup.
|
|
10
|
+
options: (el) => ({
|
|
11
|
+
fallbackDelay: Number(
|
|
12
|
+
el.querySelector(":scope > ui-avatar-fallback")?.getAttribute("delay")
|
|
13
|
+
) || 0
|
|
14
|
+
}),
|
|
15
|
+
optionalChildren: ["image"],
|
|
16
|
+
kinds: { fallbackDelay: null }
|
|
17
|
+
},
|
|
18
|
+
fallback: {
|
|
19
|
+
tag: "ui-avatar-fallback",
|
|
20
|
+
// Also brings in the rule that keeps a hidden part hidden whatever display a class gives it.
|
|
21
|
+
display: "block"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
defineAvatarElements
|
|
27
|
+
};
|
package/dist/button.d.ts
ADDED
package/dist/button.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/button.ts
|
|
2
|
+
import { button } from "@ui-sdk/core/button";
|
|
3
|
+
import { actionOf } from "./action.js";
|
|
4
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
5
|
+
var authoredTypes = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
var isButtonType = (type) => type === "button" || type === "submit" || type === "reset";
|
|
7
|
+
function authoredType(el) {
|
|
8
|
+
const inner = wrappedButton(el);
|
|
9
|
+
if (!inner) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
const current = inner.getAttribute("type");
|
|
13
|
+
const authored = authoredTypes.get(inner);
|
|
14
|
+
const written = isButtonType(authored) ? authored : "button";
|
|
15
|
+
if (!authoredTypes.has(inner) || current !== written) {
|
|
16
|
+
authoredTypes.set(inner, current);
|
|
17
|
+
}
|
|
18
|
+
const type = authoredTypes.get(inner);
|
|
19
|
+
return isButtonType(type) ? type : void 0;
|
|
20
|
+
}
|
|
21
|
+
function defineButtonElements() {
|
|
22
|
+
createParts(button, {
|
|
23
|
+
root: {
|
|
24
|
+
tag: "ui-button",
|
|
25
|
+
target: wrappedButton,
|
|
26
|
+
display: "contents",
|
|
27
|
+
// The button's own type, as written, so <button type="submit"> stays a submit button.
|
|
28
|
+
kinds: { type: null },
|
|
29
|
+
options: (el) => ({ type: authoredType(el), action: actionOf(el) })
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
defineButtonElements
|
|
35
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrimitiveInstance } from "@ui-sdk/core";
|
|
2
|
+
import { calendar } from "@ui-sdk/core/calendar";
|
|
3
|
+
import type { datePicker } from "@ui-sdk/core/date-picker";
|
|
4
|
+
declare function defineCalendarElements(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Defines the calendar's parts, which work inside <ui-calendar> and inside
|
|
7
|
+
* <ui-date-picker-content>: with the calendar's primitive and the date
|
|
8
|
+
* picker as `also`, or the other way around, since both have these slots.
|
|
9
|
+
* Whichever runs first defines them.
|
|
10
|
+
*/
|
|
11
|
+
declare function defineCalendarParts(primitive: typeof calendar | typeof datePicker, also: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Fills `container` with Previous, the heading and Next, and keeps a grid in
|
|
14
|
+
* it for each month `calendar` shows, like a calendar or a date picker's
|
|
15
|
+
* content left empty.
|
|
16
|
+
*/
|
|
17
|
+
declare function renderDefaultCalendar(container: HTMLElement, calendar: HTMLElement): void;
|
|
18
|
+
/**
|
|
19
|
+
* Renders the parts of a calendar or a date picker from its state, now and on
|
|
20
|
+
* every change. Returns the unsubscribe, for the owner's `render` to return.
|
|
21
|
+
*/
|
|
22
|
+
declare function renderCalendarParts(calendar: HTMLElement, instance: PrimitiveInstance): () => void;
|
|
23
|
+
export { defineCalendarElements, defineCalendarParts, renderCalendarParts, renderDefaultCalendar, };
|