@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/overlays.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// src/overlays.ts
|
|
2
|
+
import { toasterInternals } from "@ui-sdk/core/renderer";
|
|
3
|
+
import {
|
|
4
|
+
overlays as sharedOverlays
|
|
5
|
+
} from "@ui-sdk/core/overlays";
|
|
6
|
+
import { claimTag, whenGone } from "./define-element.js";
|
|
7
|
+
import { defineAlertDialogElements } from "./dialog.js";
|
|
8
|
+
import { defineToastElements } from "./toast.js";
|
|
9
|
+
import { createOverlays, overlays } from "@ui-sdk/core/overlays";
|
|
10
|
+
function element(tag, text) {
|
|
11
|
+
const el = document.createElement(tag);
|
|
12
|
+
if (text) {
|
|
13
|
+
el.textContent = text;
|
|
14
|
+
}
|
|
15
|
+
return el;
|
|
16
|
+
}
|
|
17
|
+
function toasterRegion(host, toaster) {
|
|
18
|
+
const region = element("ui-toast-region");
|
|
19
|
+
region.hosted = true;
|
|
20
|
+
region.toaster = toaster;
|
|
21
|
+
for (const [name, value] of Object.entries(host.toast?.attributes ?? {})) {
|
|
22
|
+
region.setAttribute(name, value);
|
|
23
|
+
}
|
|
24
|
+
if (host.toast?.template) {
|
|
25
|
+
region.append(host.toast.template.cloneNode(true));
|
|
26
|
+
}
|
|
27
|
+
const show = () => {
|
|
28
|
+
const placed = toasterInternals(toaster).hasPlacedRegion();
|
|
29
|
+
if (placed && region.isConnected) {
|
|
30
|
+
region.remove();
|
|
31
|
+
}
|
|
32
|
+
if (!placed && !region.isConnected) {
|
|
33
|
+
host.append(region);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const stop = toaster.subscribe(show);
|
|
37
|
+
show();
|
|
38
|
+
return () => {
|
|
39
|
+
stop();
|
|
40
|
+
region.remove();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function confirmDialog(host, entry) {
|
|
44
|
+
const question = entry.payload ?? {};
|
|
45
|
+
const dialog = element("ui-alert-dialog");
|
|
46
|
+
dialog.controller = entry.controller;
|
|
47
|
+
const content = element("ui-alert-dialog-content");
|
|
48
|
+
content.append(element("ui-alert-dialog-title", question.title));
|
|
49
|
+
if (question.description) {
|
|
50
|
+
content.append(element("ui-alert-dialog-description", question.description));
|
|
51
|
+
}
|
|
52
|
+
const actions = element("div");
|
|
53
|
+
const cancel = element("ui-alert-dialog-close");
|
|
54
|
+
cancel.append(element("button", question.cancelLabel ?? "Cancel"));
|
|
55
|
+
const agree = element("ui-alert-dialog-close");
|
|
56
|
+
agree.setAttribute("value", "confirm");
|
|
57
|
+
agree.append(element("button", question.confirmLabel ?? "Continue"));
|
|
58
|
+
actions.append(cancel, agree);
|
|
59
|
+
content.append(actions);
|
|
60
|
+
dialog.append(content);
|
|
61
|
+
dialog.addEventListener("openchangecomplete", (event) => {
|
|
62
|
+
if (event.detail.value === false) {
|
|
63
|
+
entry.done();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
host.append(dialog);
|
|
67
|
+
let opening = true;
|
|
68
|
+
const frame = requestAnimationFrame(() => {
|
|
69
|
+
opening = false;
|
|
70
|
+
entry.open();
|
|
71
|
+
});
|
|
72
|
+
return () => {
|
|
73
|
+
dialog.remove();
|
|
74
|
+
if (!opening) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
cancelAnimationFrame(frame);
|
|
78
|
+
entry.done();
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function defineOverlayHostElements() {
|
|
82
|
+
defineToastElements();
|
|
83
|
+
defineAlertDialogElements();
|
|
84
|
+
if (!claimTag("ui-overlay-host")) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
customElements.define(
|
|
88
|
+
"ui-overlay-host",
|
|
89
|
+
class extends HTMLElement {
|
|
90
|
+
#rendered = /* @__PURE__ */ new Map();
|
|
91
|
+
#stop;
|
|
92
|
+
#attached;
|
|
93
|
+
connectedCallback() {
|
|
94
|
+
const host = this;
|
|
95
|
+
const overlays2 = host.overlays ?? sharedOverlays;
|
|
96
|
+
if (this.#stop && overlays2 === this.#attached) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.#teardown();
|
|
100
|
+
this.#attached = overlays2;
|
|
101
|
+
const release = overlays2.attachHost();
|
|
102
|
+
const sync = () => {
|
|
103
|
+
const entries = overlays2.entries();
|
|
104
|
+
for (const [entry, remove] of this.#rendered) {
|
|
105
|
+
if (!entries.includes(entry)) {
|
|
106
|
+
remove();
|
|
107
|
+
this.#rendered.delete(entry);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
for (const entry of entries) {
|
|
111
|
+
if (this.#rendered.has(entry)) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (entry.type === "toaster") {
|
|
115
|
+
this.#rendered.set(
|
|
116
|
+
entry,
|
|
117
|
+
toasterRegion(
|
|
118
|
+
host,
|
|
119
|
+
entry.data.toaster
|
|
120
|
+
)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
if (entry.type === "confirm") {
|
|
124
|
+
this.#rendered.set(
|
|
125
|
+
entry,
|
|
126
|
+
confirmDialog(host, entry.data)
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const unsubscribe = overlays2.subscribe(sync);
|
|
132
|
+
sync();
|
|
133
|
+
this.#stop = () => {
|
|
134
|
+
unsubscribe();
|
|
135
|
+
release();
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
disconnectedCallback() {
|
|
139
|
+
whenGone(this, () => this.#teardown());
|
|
140
|
+
}
|
|
141
|
+
#teardown() {
|
|
142
|
+
this.#stop?.();
|
|
143
|
+
this.#stop = void 0;
|
|
144
|
+
for (const remove of this.#rendered.values()) {
|
|
145
|
+
remove();
|
|
146
|
+
}
|
|
147
|
+
this.#rendered.clear();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
createOverlays,
|
|
154
|
+
defineOverlayHostElements,
|
|
155
|
+
overlays
|
|
156
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// src/pagination.ts
|
|
2
|
+
import { pagination } from "@ui-sdk/core/pagination";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
import { element } from "./list.js";
|
|
5
|
+
var owner = "ui-pagination";
|
|
6
|
+
function definePaginationElements() {
|
|
7
|
+
createParts(pagination, {
|
|
8
|
+
root: {
|
|
9
|
+
tag: owner,
|
|
10
|
+
display: "block",
|
|
11
|
+
state: {
|
|
12
|
+
page: {
|
|
13
|
+
get: (api) => api.getPage(),
|
|
14
|
+
set: (api, page) => api.setPage(Number(page))
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
api: [
|
|
18
|
+
"getPage",
|
|
19
|
+
"getPageCount",
|
|
20
|
+
"setPage",
|
|
21
|
+
"next",
|
|
22
|
+
"previous",
|
|
23
|
+
"first",
|
|
24
|
+
"last"
|
|
25
|
+
],
|
|
26
|
+
// Lists follow the range.
|
|
27
|
+
render(el, { api, subscribe }) {
|
|
28
|
+
const render = () => renderLists(el, api);
|
|
29
|
+
render();
|
|
30
|
+
queueMicrotask(render);
|
|
31
|
+
return subscribe(render);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
list: { tag: "ui-pagination-list", display: "block" },
|
|
35
|
+
item: { tag: "ui-pagination-item", display: "block" },
|
|
36
|
+
link: {
|
|
37
|
+
tag: "ui-pagination-link",
|
|
38
|
+
display: "contents",
|
|
39
|
+
target: wrappedButton
|
|
40
|
+
},
|
|
41
|
+
previous: {
|
|
42
|
+
tag: "ui-pagination-previous",
|
|
43
|
+
display: "contents",
|
|
44
|
+
target: wrappedButton
|
|
45
|
+
},
|
|
46
|
+
next: {
|
|
47
|
+
tag: "ui-pagination-next",
|
|
48
|
+
display: "contents",
|
|
49
|
+
target: wrappedButton
|
|
50
|
+
},
|
|
51
|
+
first: {
|
|
52
|
+
tag: "ui-pagination-first",
|
|
53
|
+
display: "contents",
|
|
54
|
+
target: wrappedButton
|
|
55
|
+
},
|
|
56
|
+
last: {
|
|
57
|
+
tag: "ui-pagination-last",
|
|
58
|
+
display: "contents",
|
|
59
|
+
target: wrappedButton
|
|
60
|
+
},
|
|
61
|
+
ellipsis: { tag: "ui-pagination-ellipsis", display: "block" }
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
var renderedItems = /* @__PURE__ */ new WeakMap();
|
|
65
|
+
var itemOf = /* @__PURE__ */ new WeakMap();
|
|
66
|
+
function createEntry(list, item) {
|
|
67
|
+
const isPage = typeof item === "number";
|
|
68
|
+
const template = list.querySelector(
|
|
69
|
+
isPage ? ":scope > template:not([data-ellipsis])" : ":scope > template[data-ellipsis]"
|
|
70
|
+
);
|
|
71
|
+
const copy = template?.content.firstElementChild?.cloneNode(true);
|
|
72
|
+
if (!isPage) {
|
|
73
|
+
if (copy) {
|
|
74
|
+
return copy;
|
|
75
|
+
}
|
|
76
|
+
const entry = element("ui-pagination-item");
|
|
77
|
+
entry.append(element("ui-pagination-ellipsis", {}, "\u2026"));
|
|
78
|
+
return entry;
|
|
79
|
+
}
|
|
80
|
+
if (!copy) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
const link = copy.localName === "ui-pagination-link" ? copy : copy.querySelector("ui-pagination-link");
|
|
84
|
+
link?.setAttribute("page", String(item));
|
|
85
|
+
const content = link && wrappedButton(link);
|
|
86
|
+
if (content && !content.textContent?.trim()) {
|
|
87
|
+
content.textContent = String(item);
|
|
88
|
+
}
|
|
89
|
+
return copy;
|
|
90
|
+
}
|
|
91
|
+
function renderLists(el, api) {
|
|
92
|
+
const items = api.internal.items();
|
|
93
|
+
for (const list of el.querySelectorAll("ui-pagination-list")) {
|
|
94
|
+
const templates = list.querySelectorAll(":scope > template");
|
|
95
|
+
if (list.closest(owner) !== el || !templates.length || renderedItems.get(list) === items) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
renderedItems.set(list, items);
|
|
99
|
+
const existing = /* @__PURE__ */ new Map();
|
|
100
|
+
for (const child of [...list.children]) {
|
|
101
|
+
const item = itemOf.get(child);
|
|
102
|
+
if (item === void 0) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (items.includes(item)) {
|
|
106
|
+
existing.set(item, child);
|
|
107
|
+
} else {
|
|
108
|
+
child.remove();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let previous = templates[templates.length - 1];
|
|
112
|
+
for (const item of items) {
|
|
113
|
+
const entry = existing.get(item) ?? createEntry(list, item);
|
|
114
|
+
if (!entry) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
itemOf.set(entry, item);
|
|
118
|
+
if (previous.nextElementSibling !== entry) {
|
|
119
|
+
previous.after(entry);
|
|
120
|
+
}
|
|
121
|
+
previous = entry;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
definePaginationElements
|
|
127
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/password-input.ts
|
|
2
|
+
import {
|
|
3
|
+
passwordInput
|
|
4
|
+
} from "@ui-sdk/core/password-input";
|
|
5
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
6
|
+
var owner = "ui-password-input";
|
|
7
|
+
function definePasswordInputElements() {
|
|
8
|
+
createParts(passwordInput, {
|
|
9
|
+
root: {
|
|
10
|
+
tag: owner,
|
|
11
|
+
display: "block",
|
|
12
|
+
options: (el) => {
|
|
13
|
+
const input = el.querySelector("input");
|
|
14
|
+
const defaultValue = el.getAttribute("default-value");
|
|
15
|
+
if (input && defaultValue !== null && !input.hasAttribute("value")) {
|
|
16
|
+
input.defaultValue = defaultValue;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
controlId: input?.id || void 0,
|
|
20
|
+
autoComplete: input?.getAttribute("autocomplete") ?? void 0
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
// The input names them.
|
|
24
|
+
kinds: { controlId: null, autoComplete: null },
|
|
25
|
+
children: { control: (el) => el.querySelector("input") },
|
|
26
|
+
// The options above read these from the input, and follow them.
|
|
27
|
+
childProps: { attributes: ["autocomplete", "id"] },
|
|
28
|
+
state: {
|
|
29
|
+
value: {
|
|
30
|
+
get: (api) => api.getValue(),
|
|
31
|
+
set: (api, value) => api.setValue(value ?? "")
|
|
32
|
+
},
|
|
33
|
+
visible: {
|
|
34
|
+
get: (api) => api.isVisible(),
|
|
35
|
+
set: (api, visible) => api.setVisible(!!visible)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
api: [
|
|
39
|
+
"getValue",
|
|
40
|
+
"setValue",
|
|
41
|
+
"clear",
|
|
42
|
+
"isVisible",
|
|
43
|
+
"setVisible",
|
|
44
|
+
"toggleVisible",
|
|
45
|
+
"focus"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
toggle: {
|
|
49
|
+
tag: "ui-password-input-toggle",
|
|
50
|
+
display: "contents",
|
|
51
|
+
target: wrappedButton
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
definePasswordInputElements
|
|
57
|
+
};
|
package/dist/popover.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// src/popover.ts
|
|
2
|
+
import { popover } from "@ui-sdk/core/popover";
|
|
3
|
+
import { createParts, wrappedButton } from "./define-element.js";
|
|
4
|
+
import {
|
|
5
|
+
popupApi,
|
|
6
|
+
popupKinds,
|
|
7
|
+
popupState,
|
|
8
|
+
renderPopupTitle,
|
|
9
|
+
sheetPortal
|
|
10
|
+
} from "./popup.js";
|
|
11
|
+
var owner = "ui-popover";
|
|
12
|
+
function definePopoverElements() {
|
|
13
|
+
createParts(popover, {
|
|
14
|
+
root: {
|
|
15
|
+
tag: owner,
|
|
16
|
+
defaults: { dismissible: true },
|
|
17
|
+
kinds: popupKinds,
|
|
18
|
+
// `portal` handles the `container` attribute, so core never gets it.
|
|
19
|
+
options: () => ({ container: void 0 }),
|
|
20
|
+
state: popupState,
|
|
21
|
+
api: popupApi,
|
|
22
|
+
// container="#id" renders the popup there, and a sheet's viewport with it.
|
|
23
|
+
portal: sheetPortal("ui-popover-viewport")
|
|
24
|
+
},
|
|
25
|
+
// With `for="popover-id"`, it opens that popover from anywhere on the page.
|
|
26
|
+
trigger: {
|
|
27
|
+
tag: "ui-popover-trigger",
|
|
28
|
+
display: "contents",
|
|
29
|
+
target: wrappedButton
|
|
30
|
+
},
|
|
31
|
+
close: {
|
|
32
|
+
tag: "ui-popover-close",
|
|
33
|
+
display: "contents",
|
|
34
|
+
target: wrappedButton
|
|
35
|
+
},
|
|
36
|
+
// Shows the shortcut of the trigger it's in, or its own `shortcut`, when it has no text of its own.
|
|
37
|
+
shortcut: {
|
|
38
|
+
tag: "ui-popover-shortcut",
|
|
39
|
+
context: (el) => ({
|
|
40
|
+
shortcut: el.closest("ui-popover-trigger")?.getAttribute("shortcut") ?? void 0
|
|
41
|
+
})
|
|
42
|
+
},
|
|
43
|
+
content: { tag: "ui-popover-content", kinds: popupKinds },
|
|
44
|
+
title: {
|
|
45
|
+
tag: "ui-popover-title",
|
|
46
|
+
display: "block",
|
|
47
|
+
render: renderPopupTitle
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
tag: "ui-popover-description",
|
|
51
|
+
display: "block",
|
|
52
|
+
// A paragraph, like the p other frameworks render.
|
|
53
|
+
render(el) {
|
|
54
|
+
if (!el.hasAttribute("as-child") && !el.hasAttribute("role")) {
|
|
55
|
+
el.setAttribute("role", "paragraph");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
arrow: { tag: "ui-popover-arrow", display: "block" }
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
definePopoverElements
|
|
64
|
+
};
|
package/dist/popup.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const popupPortal: {
|
|
2
|
+
slots: string[];
|
|
3
|
+
container: (el: HTMLElement, part?: {
|
|
4
|
+
slot: string;
|
|
5
|
+
el?: HTMLElement;
|
|
6
|
+
}) => Element | DocumentFragment | null;
|
|
7
|
+
};
|
|
8
|
+
declare function sheetPortal(viewportTag: string, slots?: string[]): {
|
|
9
|
+
slots: string[];
|
|
10
|
+
container(el: HTMLElement, part: {
|
|
11
|
+
slot: string;
|
|
12
|
+
el?: HTMLElement;
|
|
13
|
+
props: Record<string, unknown>;
|
|
14
|
+
}): Element | DocumentFragment | null;
|
|
15
|
+
};
|
|
16
|
+
declare function sheetInputPortal(viewportTag: string): {
|
|
17
|
+
slots: string[];
|
|
18
|
+
container(el: HTMLElement, part: {
|
|
19
|
+
slot: string;
|
|
20
|
+
el?: HTMLElement;
|
|
21
|
+
props: Record<string, unknown>;
|
|
22
|
+
}): Element | DocumentFragment | null;
|
|
23
|
+
};
|
|
24
|
+
declare const popupKinds: {
|
|
25
|
+
readonly container: "string";
|
|
26
|
+
};
|
|
27
|
+
declare const popupApi: ("isOpen" | "setOpen" | "open" | "close" | "toggle" | "getPayload" | "focus")[];
|
|
28
|
+
declare const popupState: {
|
|
29
|
+
open: {
|
|
30
|
+
get: (api: {
|
|
31
|
+
isOpen: () => boolean;
|
|
32
|
+
}) => boolean;
|
|
33
|
+
set: (api: {
|
|
34
|
+
setOpen: (open: boolean) => void;
|
|
35
|
+
}, open: boolean) => void;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare const closesOnOutsidePress: (el: HTMLElement) => boolean;
|
|
39
|
+
declare function renderPopupTitle(el: HTMLElement): void;
|
|
40
|
+
export { closesOnOutsidePress, popupApi, popupKinds, popupPortal, popupState, renderPopupTitle, sheetInputPortal, sheetPortal, };
|
package/dist/popup.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/popup.ts
|
|
2
|
+
import { attrs, portalTarget, present } from "@ui-sdk/core/renderer";
|
|
3
|
+
import {
|
|
4
|
+
findContainer,
|
|
5
|
+
inheritedPortal,
|
|
6
|
+
instanceOf,
|
|
7
|
+
passPortalOn
|
|
8
|
+
} from "./define-element.js";
|
|
9
|
+
var popupPortal = {
|
|
10
|
+
slots: ["content"],
|
|
11
|
+
container: (el, part) => {
|
|
12
|
+
const own = part?.slot === "content" ? part.el?.getAttribute("container") ?? null : null;
|
|
13
|
+
const selector = own ?? el.getAttribute("container");
|
|
14
|
+
return selector ? findContainer(el, selector) : inheritedPortal(el);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var viewports = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
function sheetPortal(viewportTag, slots = popupPortal.slots) {
|
|
19
|
+
return {
|
|
20
|
+
slots,
|
|
21
|
+
container(el, part) {
|
|
22
|
+
const target = popupPortal.container(el, part);
|
|
23
|
+
const instance = instanceOf(el);
|
|
24
|
+
if (!instance || attrs(instance.part(part.slot, part.props))["data-presentation"] !== "sheet") {
|
|
25
|
+
return target;
|
|
26
|
+
}
|
|
27
|
+
let viewport = viewports.get(el);
|
|
28
|
+
if (!viewport) {
|
|
29
|
+
const created = el.ownerDocument.createElement(viewportTag);
|
|
30
|
+
created.setAttribute(
|
|
31
|
+
"data-slot",
|
|
32
|
+
attrs(instance.part("viewport", {}))["data-slot"] ?? ""
|
|
33
|
+
);
|
|
34
|
+
new MutationObserver(
|
|
35
|
+
() => created.hasChildNodes() || created.remove()
|
|
36
|
+
).observe(created, {
|
|
37
|
+
childList: true
|
|
38
|
+
});
|
|
39
|
+
viewports.set(el, created);
|
|
40
|
+
viewport = created;
|
|
41
|
+
}
|
|
42
|
+
const container = portalTarget(target);
|
|
43
|
+
const parent = container ?? el;
|
|
44
|
+
if (viewport.parentNode !== parent) {
|
|
45
|
+
parent.append(viewport);
|
|
46
|
+
}
|
|
47
|
+
passPortalOn(viewport, container);
|
|
48
|
+
return viewport;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var headers = /* @__PURE__ */ new WeakMap();
|
|
53
|
+
function sheetInputPortal(viewportTag) {
|
|
54
|
+
const sheet = sheetPortal(viewportTag);
|
|
55
|
+
return {
|
|
56
|
+
slots: [...sheet.slots, "input"],
|
|
57
|
+
container(el, part) {
|
|
58
|
+
if (part.slot !== "input") {
|
|
59
|
+
return sheet.container(el, part);
|
|
60
|
+
}
|
|
61
|
+
const instance = instanceOf(el);
|
|
62
|
+
const header = headers.get(el);
|
|
63
|
+
const parent = part.el?.parentElement ?? null;
|
|
64
|
+
const content = instance && present(instance.part("header", {})) && instance.api.internal.contentElement?.();
|
|
65
|
+
if (!instance || !content) {
|
|
66
|
+
header?.remove();
|
|
67
|
+
return parent === header ? null : parent;
|
|
68
|
+
}
|
|
69
|
+
const target = header ?? el.ownerDocument.createElement("div");
|
|
70
|
+
if (!header) {
|
|
71
|
+
target.setAttribute(
|
|
72
|
+
"data-slot",
|
|
73
|
+
attrs(instance.part("header", {}))["data-slot"] ?? ""
|
|
74
|
+
);
|
|
75
|
+
headers.set(el, target);
|
|
76
|
+
}
|
|
77
|
+
if (target.parentElement !== content) {
|
|
78
|
+
content.prepend(target);
|
|
79
|
+
}
|
|
80
|
+
return target;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
var popupKinds = { container: "string" };
|
|
85
|
+
var popupApi = ["isOpen", "setOpen", "open", "close", "toggle", "getPayload", "focus"];
|
|
86
|
+
var popupState = {
|
|
87
|
+
open: {
|
|
88
|
+
get: (api) => api.isOpen(),
|
|
89
|
+
set: (api, open) => api.setOpen(!!open)
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var closesOnOutsidePress = (el) => el.getAttribute("modal") !== "false";
|
|
93
|
+
function renderPopupTitle(el) {
|
|
94
|
+
if (el.hasAttribute("as-child") || el.hasAttribute("role")) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (el.querySelector("h1, h2, h3, h4, h5, h6, [role=heading]")) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
el.setAttribute("role", "heading");
|
|
101
|
+
el.setAttribute("aria-level", "2");
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
closesOnOutsidePress,
|
|
105
|
+
popupApi,
|
|
106
|
+
popupKinds,
|
|
107
|
+
popupPortal,
|
|
108
|
+
popupState,
|
|
109
|
+
renderPopupTitle,
|
|
110
|
+
sheetInputPortal,
|
|
111
|
+
sheetPortal
|
|
112
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/preferences.ts
|
|
2
|
+
import { claimTag, upgradeProperties, whenGone } from "./define-element.js";
|
|
3
|
+
function definePreferencesElements() {
|
|
4
|
+
if (!claimTag("ui-preferences")) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
customElements.define(
|
|
8
|
+
"ui-preferences",
|
|
9
|
+
class extends HTMLElement {
|
|
10
|
+
#preferences = [];
|
|
11
|
+
#stop;
|
|
12
|
+
get preferences() {
|
|
13
|
+
return this.#preferences;
|
|
14
|
+
}
|
|
15
|
+
set preferences(list) {
|
|
16
|
+
this.#preferences = list;
|
|
17
|
+
if (this.isConnected) {
|
|
18
|
+
this.#start();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
upgradeProperties(this, ["preferences"]);
|
|
23
|
+
this.style.display ||= "contents";
|
|
24
|
+
if (!this.#stop) {
|
|
25
|
+
this.#start();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
disconnectedCallback() {
|
|
29
|
+
whenGone(this, () => this.#teardown());
|
|
30
|
+
}
|
|
31
|
+
#start() {
|
|
32
|
+
this.#teardown();
|
|
33
|
+
const list = this.#preferences;
|
|
34
|
+
const write = () => {
|
|
35
|
+
for (const preference of list) {
|
|
36
|
+
;
|
|
37
|
+
(preference.global ? document.documentElement : this).setAttribute(
|
|
38
|
+
preference.attribute,
|
|
39
|
+
preference.get().value
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const stops = list.map((preference) => preference.subscribe(write));
|
|
44
|
+
write();
|
|
45
|
+
this.#stop = () => stops.forEach((stop) => stop());
|
|
46
|
+
}
|
|
47
|
+
#teardown() {
|
|
48
|
+
this.#stop?.();
|
|
49
|
+
this.#stop = void 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
definePreferencesElements
|
|
56
|
+
};
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/progress.ts
|
|
2
|
+
import { partState } from "@ui-sdk/core/renderer";
|
|
3
|
+
import { progress } from "@ui-sdk/core/progress";
|
|
4
|
+
import { showDefaultText } from "./default-text.js";
|
|
5
|
+
import { createParts } from "./define-element.js";
|
|
6
|
+
var valueText = (_, instance) => partState(instance.part("value")).text;
|
|
7
|
+
function defineProgressElements() {
|
|
8
|
+
createParts(progress, {
|
|
9
|
+
root: {
|
|
10
|
+
tag: "ui-progress",
|
|
11
|
+
display: "block",
|
|
12
|
+
render: (el, instance) => showDefaultText(el, instance, "ui-progress-value", valueText)
|
|
13
|
+
},
|
|
14
|
+
track: { tag: "ui-progress-track", display: "block" },
|
|
15
|
+
indicator: { tag: "ui-progress-indicator", display: "block" },
|
|
16
|
+
label: "ui-progress-label",
|
|
17
|
+
value: "ui-progress-value"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
defineProgressElements
|
|
22
|
+
};
|
package/dist/radio.d.ts
ADDED
package/dist/radio.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/radio.ts
|
|
2
|
+
import { radioGroup } from "@ui-sdk/core/radio";
|
|
3
|
+
import { createParts } from "./define-element.js";
|
|
4
|
+
var owner = "ui-radio-group";
|
|
5
|
+
function defineRadioGroupElements() {
|
|
6
|
+
createParts(radioGroup, {
|
|
7
|
+
root: {
|
|
8
|
+
tag: owner,
|
|
9
|
+
defaults: { loop: true },
|
|
10
|
+
self: "group",
|
|
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
|
+
radio: {
|
|
23
|
+
tag: "ui-radio",
|
|
24
|
+
// Each radio fills the root slot, since the element that owns the group fills `group`.
|
|
25
|
+
slot: "root",
|
|
26
|
+
formAssociated: true
|
|
27
|
+
},
|
|
28
|
+
indicator: "ui-radio-indicator"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
defineRadioGroupElements
|
|
33
|
+
};
|