@ember-joinery/primitives 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +472 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +11 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/combobox-list.d.ts +59 -0
- package/declarations/-private/combobox-list.d.ts.map +1 -0
- package/declarations/-private/command-score.d.ts +33 -0
- package/declarations/-private/command-score.d.ts.map +1 -0
- package/declarations/-private/delay-group.d.ts +47 -0
- package/declarations/-private/delay-group.d.ts.map +1 -0
- package/declarations/-private/dialog.d.ts +180 -0
- package/declarations/-private/dialog.d.ts.map +1 -0
- package/declarations/-private/form-control.d.ts +70 -0
- package/declarations/-private/form-control.d.ts.map +1 -0
- package/declarations/-private/form-data.d.ts +14 -0
- package/declarations/-private/form-data.d.ts.map +1 -0
- package/declarations/-private/hover-intent.d.ts +48 -0
- package/declarations/-private/hover-intent.d.ts.map +1 -0
- package/declarations/-private/image-loading.d.ts +77 -0
- package/declarations/-private/image-loading.d.ts.map +1 -0
- package/declarations/-private/indicator.d.ts +27 -0
- package/declarations/-private/indicator.d.ts.map +1 -0
- package/declarations/-private/instances.d.ts +11 -0
- package/declarations/-private/instances.d.ts.map +1 -0
- package/declarations/-private/layout-styles.d.ts +34 -0
- package/declarations/-private/layout-styles.d.ts.map +1 -0
- package/declarations/-private/menu.d.ts +616 -0
- package/declarations/-private/menu.d.ts.map +1 -0
- package/declarations/-private/observers.d.ts +35 -0
- package/declarations/-private/observers.d.ts.map +1 -0
- package/declarations/-private/popper.d.ts +149 -0
- package/declarations/-private/popper.d.ts.map +1 -0
- package/declarations/-private/presence-chart.d.ts +39 -0
- package/declarations/-private/presence-chart.d.ts.map +1 -0
- package/declarations/-private/promise-state.d.ts +41 -0
- package/declarations/-private/promise-state.d.ts.map +1 -0
- package/declarations/-private/scroll-end.d.ts +16 -0
- package/declarations/-private/scroll-end.d.ts.map +1 -0
- package/declarations/-private/scroll-visibility.d.ts +68 -0
- package/declarations/-private/scroll-visibility.d.ts.map +1 -0
- package/declarations/-private/toast.d.ts +119 -0
- package/declarations/-private/toast.d.ts.map +1 -0
- package/declarations/-private/typeahead-search.d.ts +29 -0
- package/declarations/-private/typeahead-search.d.ts.map +1 -0
- package/declarations/accordion.d.ts +284 -0
- package/declarations/accordion.d.ts.map +1 -0
- package/declarations/alert-dialog.d.ts +80 -0
- package/declarations/alert-dialog.d.ts.map +1 -0
- package/declarations/anchor/component.d.ts +63 -0
- package/declarations/anchor/component.d.ts.map +1 -0
- package/declarations/anchor/index.d.ts +7 -0
- package/declarations/anchor/index.d.ts.map +1 -0
- package/declarations/anchor/middleware.d.ts +46 -0
- package/declarations/anchor/middleware.d.ts.map +1 -0
- package/declarations/anchor/modifier.d.ts +34 -0
- package/declarations/anchor/modifier.d.ts.map +1 -0
- package/declarations/anchor/options.d.ts +112 -0
- package/declarations/anchor/options.d.ts.map +1 -0
- package/declarations/anchor/position.d.ts +36 -0
- package/declarations/anchor/position.d.ts.map +1 -0
- package/declarations/anchor.d.ts +2 -0
- package/declarations/as.d.ts +33 -0
- package/declarations/as.d.ts.map +1 -0
- package/declarations/aspect-ratio.d.ts +34 -0
- package/declarations/aspect-ratio.d.ts.map +1 -0
- package/declarations/avatar.d.ts +178 -0
- package/declarations/avatar.d.ts.map +1 -0
- package/declarations/body-class.d.ts +30 -0
- package/declarations/body-class.d.ts.map +1 -0
- package/declarations/breadcrumb.d.ts +64 -0
- package/declarations/breadcrumb.d.ts.map +1 -0
- package/declarations/calendar/dates.d.ts +142 -0
- package/declarations/calendar/dates.d.ts.map +1 -0
- package/declarations/calendar/index.d.ts +59 -0
- package/declarations/calendar/index.d.ts.map +1 -0
- package/declarations/calendar/state.d.ts +415 -0
- package/declarations/calendar/state.d.ts.map +1 -0
- package/declarations/calendar.d.ts +3 -0
- package/declarations/checkbox.d.ts +71 -0
- package/declarations/checkbox.d.ts.map +1 -0
- package/declarations/collapsible.d.ts +216 -0
- package/declarations/collapsible.d.ts.map +1 -0
- package/declarations/color-scheme.d.ts +115 -0
- package/declarations/color-scheme.d.ts.map +1 -0
- package/declarations/combobox.d.ts +569 -0
- package/declarations/combobox.d.ts.map +1 -0
- package/declarations/command.d.ts +410 -0
- package/declarations/command.d.ts.map +1 -0
- package/declarations/context-menu.d.ts +155 -0
- package/declarations/context-menu.d.ts.map +1 -0
- package/declarations/controllable-state.d.ts +85 -0
- package/declarations/controllable-state.d.ts.map +1 -0
- package/declarations/dialog.d.ts +80 -0
- package/declarations/dialog.d.ts.map +1 -0
- package/declarations/direction.d.ts +55 -0
- package/declarations/direction.d.ts.map +1 -0
- package/declarations/dismiss.d.ts +111 -0
- package/declarations/dismiss.d.ts.map +1 -0
- package/declarations/dom-context.d.ts +74 -0
- package/declarations/dom-context.d.ts.map +1 -0
- package/declarations/drawer/controller.d.ts +174 -0
- package/declarations/drawer/controller.d.ts.map +1 -0
- package/declarations/drawer/index.d.ts +105 -0
- package/declarations/drawer/index.d.ts.map +1 -0
- package/declarations/drawer/machine.d.ts +139 -0
- package/declarations/drawer/machine.d.ts.map +1 -0
- package/declarations/drawer/parts.d.ts +85 -0
- package/declarations/drawer/parts.d.ts.map +1 -0
- package/declarations/drawer.d.ts +2 -0
- package/declarations/dropdown-menu.d.ts +169 -0
- package/declarations/dropdown-menu.d.ts.map +1 -0
- package/declarations/external-link.d.ts +26 -0
- package/declarations/external-link.d.ts.map +1 -0
- package/declarations/file-drop.d.ts +119 -0
- package/declarations/file-drop.d.ts.map +1 -0
- package/declarations/focus-scope.d.ts +105 -0
- package/declarations/focus-scope.d.ts.map +1 -0
- package/declarations/focus.d.ts +114 -0
- package/declarations/focus.d.ts.map +1 -0
- package/declarations/head.d.ts +20 -0
- package/declarations/head.d.ts.map +1 -0
- package/declarations/heading.d.ts +59 -0
- package/declarations/heading.d.ts.map +1 -0
- package/declarations/hero.d.ts +32 -0
- package/declarations/hero.d.ts.map +1 -0
- package/declarations/hide-others.d.ts +35 -0
- package/declarations/hide-others.d.ts.map +1 -0
- package/declarations/hover-card.d.ts +148 -0
- package/declarations/hover-card.d.ts.map +1 -0
- package/declarations/i18n.d.ts +47 -0
- package/declarations/i18n.d.ts.map +1 -0
- package/declarations/id.d.ts +15 -0
- package/declarations/id.d.ts.map +1 -0
- package/declarations/iframe.d.ts +12 -0
- package/declarations/iframe.d.ts.map +1 -0
- package/declarations/incremental-each.d.ts +81 -0
- package/declarations/incremental-each.d.ts.map +1 -0
- package/declarations/index.d.ts +108 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/input-otp.d.ts +201 -0
- package/declarations/input-otp.d.ts.map +1 -0
- package/declarations/keys.d.ts +50 -0
- package/declarations/keys.d.ts.map +1 -0
- package/declarations/label.d.ts +36 -0
- package/declarations/label.d.ts.map +1 -0
- package/declarations/layer.d.ts +56 -0
- package/declarations/layer.d.ts.map +1 -0
- package/declarations/link-helper.d.ts +73 -0
- package/declarations/link-helper.d.ts.map +1 -0
- package/declarations/link.d.ts +60 -0
- package/declarations/link.d.ts.map +1 -0
- package/declarations/load.d.ts +47 -0
- package/declarations/load.d.ts.map +1 -0
- package/declarations/menubar.d.ts +231 -0
- package/declarations/menubar.d.ts.map +1 -0
- package/declarations/message-scroller/components.d.ts +229 -0
- package/declarations/message-scroller/components.d.ts.map +1 -0
- package/declarations/message-scroller/geometry.d.ts +95 -0
- package/declarations/message-scroller/geometry.d.ts.map +1 -0
- package/declarations/message-scroller/index.d.ts +4 -0
- package/declarations/message-scroller/index.d.ts.map +1 -0
- package/declarations/message-scroller/state.d.ts +124 -0
- package/declarations/message-scroller/state.d.ts.map +1 -0
- package/declarations/message-scroller.d.ts +2 -0
- package/declarations/messages.d.ts +166 -0
- package/declarations/messages.d.ts.map +1 -0
- package/declarations/narrowing.d.ts +24 -0
- package/declarations/narrowing.d.ts.map +1 -0
- package/declarations/native-form.d.ts +56 -0
- package/declarations/native-form.d.ts.map +1 -0
- package/declarations/native-value.d.ts +47 -0
- package/declarations/native-value.d.ts.map +1 -0
- package/declarations/navigation-menu.d.ts +406 -0
- package/declarations/navigation-menu.d.ts.map +1 -0
- package/declarations/on-resize.d.ts +32 -0
- package/declarations/on-resize.d.ts.map +1 -0
- package/declarations/part.d.ts +99 -0
- package/declarations/part.d.ts.map +1 -0
- package/declarations/popover.d.ts +236 -0
- package/declarations/popover.d.ts.map +1 -0
- package/declarations/portal/index.d.ts +3 -0
- package/declarations/portal/index.d.ts.map +1 -0
- package/declarations/portal/portal.d.ts +46 -0
- package/declarations/portal/portal.d.ts.map +1 -0
- package/declarations/portal/targets.d.ts +40 -0
- package/declarations/portal/targets.d.ts.map +1 -0
- package/declarations/portal.d.ts +2 -0
- package/declarations/presence.d.ts +80 -0
- package/declarations/presence.d.ts.map +1 -0
- package/declarations/progress.d.ts +98 -0
- package/declarations/progress.d.ts.map +1 -0
- package/declarations/proper-links.d.ts +69 -0
- package/declarations/proper-links.d.ts.map +1 -0
- package/declarations/qp.d.ts +55 -0
- package/declarations/qp.d.ts.map +1 -0
- package/declarations/questionnaire/components.d.ts +348 -0
- package/declarations/questionnaire/components.d.ts.map +1 -0
- package/declarations/questionnaire/index.d.ts +4 -0
- package/declarations/questionnaire/index.d.ts.map +1 -0
- package/declarations/questionnaire/state.d.ts +400 -0
- package/declarations/questionnaire/state.d.ts.map +1 -0
- package/declarations/questionnaire/utils.d.ts +65 -0
- package/declarations/questionnaire/utils.d.ts.map +1 -0
- package/declarations/questionnaire.d.ts +2 -0
- package/declarations/radio-group.d.ts +115 -0
- package/declarations/radio-group.d.ts.map +1 -0
- package/declarations/rating.d.ts +214 -0
- package/declarations/rating.d.ts.map +1 -0
- package/declarations/resizable/components.d.ts +107 -0
- package/declarations/resizable/components.d.ts.map +1 -0
- package/declarations/resizable/index.d.ts +4 -0
- package/declarations/resizable/index.d.ts.map +1 -0
- package/declarations/resizable/layout.d.ts +93 -0
- package/declarations/resizable/layout.d.ts.map +1 -0
- package/declarations/resizable/state.d.ts +211 -0
- package/declarations/resizable/state.d.ts.map +1 -0
- package/declarations/resizable.d.ts +2 -0
- package/declarations/resize-observer.d.ts +40 -0
- package/declarations/resize-observer.d.ts.map +1 -0
- package/declarations/roving-focus.d.ts +204 -0
- package/declarations/roving-focus.d.ts.map +1 -0
- package/declarations/scroll-area/components.d.ts +125 -0
- package/declarations/scroll-area/components.d.ts.map +1 -0
- package/declarations/scroll-area/index.d.ts +3 -0
- package/declarations/scroll-area/index.d.ts.map +1 -0
- package/declarations/scroll-area/state.d.ts +147 -0
- package/declarations/scroll-area/state.d.ts.map +1 -0
- package/declarations/scroll-area.d.ts +2 -0
- package/declarations/scroll-lock.d.ts +69 -0
- package/declarations/scroll-lock.d.ts.map +1 -0
- package/declarations/scroller.d.ts +71 -0
- package/declarations/scroller.d.ts.map +1 -0
- package/declarations/select.d.ts +459 -0
- package/declarations/select.d.ts.map +1 -0
- package/declarations/separator.d.ts +71 -0
- package/declarations/separator.d.ts.map +1 -0
- package/declarations/service.d.ts +83 -0
- package/declarations/service.d.ts.map +1 -0
- package/declarations/shadowed.d.ts +63 -0
- package/declarations/shadowed.d.ts.map +1 -0
- package/declarations/slider.d.ts +283 -0
- package/declarations/slider.d.ts.map +1 -0
- package/declarations/sticky-footer.d.ts +43 -0
- package/declarations/sticky-footer.d.ts.map +1 -0
- package/declarations/store.d.ts +47 -0
- package/declarations/store.d.ts.map +1 -0
- package/declarations/switch.d.ts +76 -0
- package/declarations/switch.d.ts.map +1 -0
- package/declarations/tabs.d.ts +250 -0
- package/declarations/tabs.d.ts.map +1 -0
- package/declarations/toast/icons.d.ts +29 -0
- package/declarations/toast/icons.d.ts.map +1 -0
- package/declarations/toast/index.d.ts +4 -0
- package/declarations/toast/index.d.ts.map +1 -0
- package/declarations/toast/item.d.ts +162 -0
- package/declarations/toast/item.d.ts.map +1 -0
- package/declarations/toast/state.d.ts +276 -0
- package/declarations/toast/state.d.ts.map +1 -0
- package/declarations/toast/styles.d.ts +20 -0
- package/declarations/toast/styles.d.ts.map +1 -0
- package/declarations/toast/toaster.d.ts +173 -0
- package/declarations/toast/toaster.d.ts.map +1 -0
- package/declarations/toast.d.ts +2 -0
- package/declarations/toggle-group.d.ts +161 -0
- package/declarations/toggle-group.d.ts.map +1 -0
- package/declarations/toggle.d.ts +70 -0
- package/declarations/toggle.d.ts.map +1 -0
- package/declarations/tooltip.d.ts +227 -0
- package/declarations/tooltip.d.ts.map +1 -0
- package/declarations/typeahead.d.ts +97 -0
- package/declarations/typeahead.d.ts.map +1 -0
- package/declarations/viewport.d.ts +109 -0
- package/declarations/viewport.d.ts.map +1 -0
- package/declarations/visually-hidden.d.ts +42 -0
- package/declarations/visually-hidden.d.ts.map +1 -0
- package/declarations/zoetrope.d.ts +120 -0
- package/declarations/zoetrope.d.ts.map +1 -0
- package/dist/accordion.js +367 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert-dialog.js +122 -0
- package/dist/alert-dialog.js.map +1 -0
- package/dist/anchor.js +2 -0
- package/dist/anchor.js.map +1 -0
- package/dist/as.js +60 -0
- package/dist/as.js.map +1 -0
- package/dist/aspect-ratio.js +59 -0
- package/dist/aspect-ratio.js.map +1 -0
- package/dist/avatar.js +464 -0
- package/dist/avatar.js.map +1 -0
- package/dist/body-class.js +57 -0
- package/dist/body-class.js.map +1 -0
- package/dist/breadcrumb.js +59 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/calendar.js +1494 -0
- package/dist/calendar.js.map +1 -0
- package/dist/checkbox.js +81 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/collapsible.js +255 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/color-scheme.js +306 -0
- package/dist/color-scheme.js.map +1 -0
- package/dist/combobox.js +1413 -0
- package/dist/combobox.js.map +1 -0
- package/dist/command.js +1054 -0
- package/dist/command.js.map +1 -0
- package/dist/component-DqLt83fo.js +886 -0
- package/dist/component-DqLt83fo.js.map +1 -0
- package/dist/components-CWfg0cFs.js +1745 -0
- package/dist/components-CWfg0cFs.js.map +1 -0
- package/dist/components-DBWszEI3.js +1285 -0
- package/dist/components-DBWszEI3.js.map +1 -0
- package/dist/components-DI8Azu05.js +1542 -0
- package/dist/components-DI8Azu05.js.map +1 -0
- package/dist/components-F0Ini448.js +875 -0
- package/dist/components-F0Ini448.js.map +1 -0
- package/dist/context-menu.js +207 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/controllable-state.js +134 -0
- package/dist/controllable-state.js.map +1 -0
- package/dist/delay-group-B1K03gBL.js +75 -0
- package/dist/delay-group-B1K03gBL.js.map +1 -0
- package/dist/dialog-3gfz_8NA.js +349 -0
- package/dist/dialog-3gfz_8NA.js.map +1 -0
- package/dist/dialog.js +57 -0
- package/dist/dialog.js.map +1 -0
- package/dist/direction.js +75 -0
- package/dist/direction.js.map +1 -0
- package/dist/dismiss.js +329 -0
- package/dist/dismiss.js.map +1 -0
- package/dist/dom-context.js +104 -0
- package/dist/dom-context.js.map +1 -0
- package/dist/drawer.js +1456 -0
- package/dist/drawer.js.map +1 -0
- package/dist/dropdown-menu.js +201 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/external-link.js +21 -0
- package/dist/external-link.js.map +1 -0
- package/dist/file-drop.js +183 -0
- package/dist/file-drop.js.map +1 -0
- package/dist/focus-scope.js +292 -0
- package/dist/focus-scope.js.map +1 -0
- package/dist/focus.js +307 -0
- package/dist/focus.js.map +1 -0
- package/dist/form-control-Ca_KHSKK.js +177 -0
- package/dist/form-control-Ca_KHSKK.js.map +1 -0
- package/dist/head.js +25 -0
- package/dist/head.js.map +1 -0
- package/dist/heading.js +152 -0
- package/dist/heading.js.map +1 -0
- package/dist/hero.js +36 -0
- package/dist/hero.js.map +1 -0
- package/dist/hide-others.js +108 -0
- package/dist/hide-others.js.map +1 -0
- package/dist/hover-card.js +246 -0
- package/dist/hover-card.js.map +1 -0
- package/dist/hover-intent-Bxb83fgX.js +92 -0
- package/dist/hover-intent-Bxb83fgX.js.map +1 -0
- package/dist/i18n.js +72 -0
- package/dist/i18n.js.map +1 -0
- package/dist/id.js +24 -0
- package/dist/id.js.map +1 -0
- package/dist/iframe.js +19 -0
- package/dist/iframe.js.map +1 -0
- package/dist/incremental-each.js +181 -0
- package/dist/incremental-each.js.map +1 -0
- package/dist/index.js +87 -0
- package/dist/index.js.map +1 -0
- package/dist/indicator-sYuRuFJA.js +26 -0
- package/dist/indicator-sYuRuFJA.js.map +1 -0
- package/dist/input-otp.js +611 -0
- package/dist/input-otp.js.map +1 -0
- package/dist/keys.js +65 -0
- package/dist/keys.js.map +1 -0
- package/dist/label.js +41 -0
- package/dist/label.js.map +1 -0
- package/dist/layer.js +157 -0
- package/dist/layer.js.map +1 -0
- package/dist/layout-styles-DY86so8a.js +81 -0
- package/dist/layout-styles-DY86so8a.js.map +1 -0
- package/dist/link-helper.js +122 -0
- package/dist/link-helper.js.map +1 -0
- package/dist/link.js +39 -0
- package/dist/link.js.map +1 -0
- package/dist/load.js +54 -0
- package/dist/load.js.map +1 -0
- package/dist/menu-Da1LFCet.js +1109 -0
- package/dist/menu-Da1LFCet.js.map +1 -0
- package/dist/menubar.js +357 -0
- package/dist/menubar.js.map +1 -0
- package/dist/message-scroller.js +2 -0
- package/dist/message-scroller.js.map +1 -0
- package/dist/messages.js +168 -0
- package/dist/messages.js.map +1 -0
- package/dist/narrowing.js +29 -0
- package/dist/narrowing.js.map +1 -0
- package/dist/native-form.js +134 -0
- package/dist/native-form.js.map +1 -0
- package/dist/native-value.js +125 -0
- package/dist/native-value.js.map +1 -0
- package/dist/navigation-menu.js +872 -0
- package/dist/navigation-menu.js.map +1 -0
- package/dist/observers-aItWe029.js +113 -0
- package/dist/observers-aItWe029.js.map +1 -0
- package/dist/on-resize.js +47 -0
- package/dist/on-resize.js.map +1 -0
- package/dist/part.js +291 -0
- package/dist/part.js.map +1 -0
- package/dist/popover.js +419 -0
- package/dist/popover.js.map +1 -0
- package/dist/popper-BbTzV8dP.js +323 -0
- package/dist/popper-BbTzV8dP.js.map +1 -0
- package/dist/portal-U554WDI9.js +214 -0
- package/dist/portal-U554WDI9.js.map +1 -0
- package/dist/portal.js +2 -0
- package/dist/portal.js.map +1 -0
- package/dist/presence.js +243 -0
- package/dist/presence.js.map +1 -0
- package/dist/progress.js +106 -0
- package/dist/progress.js.map +1 -0
- package/dist/promise-state-BMi2zVoT.js +91 -0
- package/dist/promise-state-BMi2zVoT.js.map +1 -0
- package/dist/proper-links.js +136 -0
- package/dist/proper-links.js.map +1 -0
- package/dist/qp.js +77 -0
- package/dist/qp.js.map +1 -0
- package/dist/questionnaire.js +2 -0
- package/dist/questionnaire.js.map +1 -0
- package/dist/radio-group.js +149 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/rating.js +261 -0
- package/dist/rating.js.map +1 -0
- package/dist/resizable.js +2 -0
- package/dist/resizable.js.map +1 -0
- package/dist/resize-observer.js +85 -0
- package/dist/resize-observer.js.map +1 -0
- package/dist/roving-focus.js +355 -0
- package/dist/roving-focus.js.map +1 -0
- package/dist/scroll-area.js +2 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/scroll-end-Cer8JSIB.js +87 -0
- package/dist/scroll-end-Cer8JSIB.js.map +1 -0
- package/dist/scroll-lock.js +267 -0
- package/dist/scroll-lock.js.map +1 -0
- package/dist/scroller.js +117 -0
- package/dist/scroller.js.map +1 -0
- package/dist/select.js +1223 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.js +80 -0
- package/dist/separator.js.map +1 -0
- package/dist/service.js +160 -0
- package/dist/service.js.map +1 -0
- package/dist/shadowed.js +70 -0
- package/dist/shadowed.js.map +1 -0
- package/dist/slider.js +586 -0
- package/dist/slider.js.map +1 -0
- package/dist/sticky-footer.js +40 -0
- package/dist/sticky-footer.js.map +1 -0
- package/dist/store-BjiAd-KP.js +93 -0
- package/dist/store-BjiAd-KP.js.map +1 -0
- package/dist/store.js +4 -0
- package/dist/store.js.map +1 -0
- package/dist/switch.js +58 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.js +458 -0
- package/dist/tabs.js.map +1 -0
- package/dist/toast.js +2 -0
- package/dist/toast.js.map +1 -0
- package/dist/toaster-DwprFZ1J.js +1518 -0
- package/dist/toaster-DwprFZ1J.js.map +1 -0
- package/dist/toggle-group.js +221 -0
- package/dist/toggle-group.js.map +1 -0
- package/dist/toggle.js +78 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.js +422 -0
- package/dist/tooltip.js.map +1 -0
- package/dist/typeahead.js +233 -0
- package/dist/typeahead.js.map +1 -0
- package/dist/viewport.js +138 -0
- package/dist/viewport.js.map +1 -0
- package/dist/visually-hidden.js +49 -0
- package/dist/visually-hidden.js.map +1 -0
- package/dist/zoetrope.js +336 -0
- package/dist/zoetrope.js.map +1 -0
- package/package.json +101 -3
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import Helper from '@ember/component/helper';
|
|
2
|
+
import { service } from '@ember/service';
|
|
3
|
+
import { handleLink } from './proper-links.js';
|
|
4
|
+
import { isString } from '@sindresorhus/is';
|
|
5
|
+
import { g, i } from 'decorator-transforms/runtime';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Whether `href` goes to another origin than the page's. A path (`/about`), a hash (`#top`) or
|
|
9
|
+
* a query (`?tab=2`) never does. It is ember-primitives' `isExternal`, from `helpers/link`.
|
|
10
|
+
*/
|
|
11
|
+
function isExternalLink(href) {
|
|
12
|
+
if (!href) return false;
|
|
13
|
+
if (href.startsWith('#') || href.startsWith('/') || href.startsWith('?')) return false;
|
|
14
|
+
try {
|
|
15
|
+
return new URL(href, location.href).origin !== location.origin;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The app-relative path of `path` (which includes the rootURL), or `undefined` outside the app. */
|
|
22
|
+
function withoutRoot(path, rootURL) {
|
|
23
|
+
const root = rootURL.endsWith('/') ? rootURL : `${rootURL}/`;
|
|
24
|
+
if (path === root.slice(0, -1)) return '/';
|
|
25
|
+
if (!path.startsWith(root)) return undefined;
|
|
26
|
+
return `/${path.slice(root.length)}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The values of a route's dynamic segments, outermost route first, for `router.isActive`. It is
|
|
30
|
+
* ember-primitives' `getParams`.
|
|
31
|
+
*/
|
|
32
|
+
function dynamicSegments(info) {
|
|
33
|
+
const params = [];
|
|
34
|
+
let current = info;
|
|
35
|
+
while (current?.parent) {
|
|
36
|
+
if (current.params) params.unshift(current.params);
|
|
37
|
+
current = current.parent;
|
|
38
|
+
}
|
|
39
|
+
return params.flatMap(segment => Object.values(segment));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Whether `href` is the current route. By default the path decides, query params aside:
|
|
44
|
+
* `/forum/1` is active on `/forum/1` and `/forum/1?sort=new`. `includeQueryParams` makes query
|
|
45
|
+
* params count (`true` for all, or the names of the ones that count), and `activeOnSubPaths`
|
|
46
|
+
* makes the routes below count too. A link to another origin, or outside the app's `rootURL`,
|
|
47
|
+
* is never active. It is ember-primitives' `isActive`, from `helpers/link`.
|
|
48
|
+
*/
|
|
49
|
+
function isActiveLink(router, href, includeQueryParams = false, activeOnSubPaths = false) {
|
|
50
|
+
if (!href || isExternalLink(href)) return false;
|
|
51
|
+
const url = new URL(href, location.href);
|
|
52
|
+
const rootURL = router.rootURL ?? '/';
|
|
53
|
+
const path = withoutRoot(url.pathname, rootURL);
|
|
54
|
+
if (path === undefined) return false;
|
|
55
|
+
if (!includeQueryParams) {
|
|
56
|
+
const root = rootURL.endsWith('/') ? rootURL : `${rootURL}/`;
|
|
57
|
+
let info;
|
|
58
|
+
try {
|
|
59
|
+
info = router.recognize(`${root}${path.slice(1)}`);
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (!info) return false;
|
|
64
|
+
const name = activeOnSubPaths ? info.name.replace(/\.index$/, '') : info.name;
|
|
65
|
+
return router.isActive(name, ...dynamicSegments(info));
|
|
66
|
+
}
|
|
67
|
+
const currentPath = router.currentURL?.split('?')[0]?.split('#')[0];
|
|
68
|
+
if (!currentPath) return false;
|
|
69
|
+
const onPath = activeOnSubPaths ? currentPath === path || currentPath.startsWith(path.endsWith('/') ? path : `${path}/`) : currentPath === path;
|
|
70
|
+
if (!onPath) return false;
|
|
71
|
+
const current = router.currentRoute?.queryParams ?? {};
|
|
72
|
+
const linked = url.searchParams;
|
|
73
|
+
const names = includeQueryParams === true ? new Set([...Object.keys(current), ...linked.keys()]) : new Set(includeQueryParams);
|
|
74
|
+
for (const name of names) {
|
|
75
|
+
const value = current[name];
|
|
76
|
+
const now = value === undefined || value === null ? null : String(value);
|
|
77
|
+
if (linked.get(name) !== now) return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* What an app needs to know about a link to render it: whether it leaves the app
|
|
84
|
+
* (`isExternal`), whether it is the current route (`isActive`, for an active style or
|
|
85
|
+
* `aria-current`), and a click handler that routes it (`handleClick`).
|
|
86
|
+
*
|
|
87
|
+
* {{#let (link "/settings" activeOnSubPaths=true) as |l|}}
|
|
88
|
+
* <a href="/settings" aria-current={{if l.isActive "page"}} {{on "click" l.handleClick}}>
|
|
89
|
+
* Settings
|
|
90
|
+
* </a>
|
|
91
|
+
* {{/let}}
|
|
92
|
+
*
|
|
93
|
+
* It is ember-primitives' `link` helper (`helpers/link`), which its `Link` component renders
|
|
94
|
+
* with.
|
|
95
|
+
*/
|
|
96
|
+
class Link extends Helper {
|
|
97
|
+
static {
|
|
98
|
+
g(this.prototype, "router", [service]);
|
|
99
|
+
}
|
|
100
|
+
#router = (i(this, "router"), void 0);
|
|
101
|
+
compute([href], {
|
|
102
|
+
includeActiveQueryParams = false,
|
|
103
|
+
activeOnSubPaths = false
|
|
104
|
+
}) {
|
|
105
|
+
if (!isString(href)) throw new Error('Joinery: (link) needs the href');
|
|
106
|
+
const router = this.router;
|
|
107
|
+
return {
|
|
108
|
+
isExternal: isExternalLink(href),
|
|
109
|
+
get isActive() {
|
|
110
|
+
return isActiveLink(router, href, includeActiveQueryParams, activeOnSubPaths);
|
|
111
|
+
},
|
|
112
|
+
handleClick: event => {
|
|
113
|
+
const anchor = event.currentTarget;
|
|
114
|
+
if (anchor instanceof HTMLAnchorElement) handleLink(router, anchor, event);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const link = Link;
|
|
120
|
+
|
|
121
|
+
export { dynamicSegments, isActiveLink, isExternalLink, link };
|
|
122
|
+
//# sourceMappingURL=link-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-helper.js","sources":["../src/link-helper.ts"],"sourcesContent":["import Helper from '@ember/component/helper'\nimport { service } from '@ember/service'\nimport type RouterService from '@ember/routing/router-service'\nimport { handleLink } from './proper-links.ts'\nimport { isString } from '@sindresorhus/is'\n\nexport interface LinkOptions {\n /**\n * Whether the query params count towards `isActive`: `true` for all of them (the link is\n * active only when the current URL's query params match the link's), or the names of the\n * ones that count. Default `false`: the path alone decides.\n */\n includeActiveQueryParams?: boolean | string[]\n /**\n * Whether the link is active on the routes below it too: `/forum/1` on `/forum/1/posts`.\n * Default `false`: only the route itself.\n */\n activeOnSubPaths?: boolean\n}\n\nexport interface LinkState {\n /** Whether `href` goes to another origin, so following it leaves the app. */\n readonly isExternal: boolean\n /** Whether `href` is the current route (see the options). Reactive. Never for an external link. */\n readonly isActive: boolean\n /**\n * A click handler for the `<a>`, for an app without `properLinks`: it makes a click on a link\n * to one of the app's routes a transition. `{{on \"click\" l.handleClick}}`.\n */\n handleClick: (event: MouseEvent) => void\n}\n\nexport interface LinkSignature {\n Args: {\n Positional: [href: string]\n Named: LinkOptions\n }\n Return: LinkState\n}\n\n/**\n * Whether `href` goes to another origin than the page's. A path (`/about`), a hash (`#top`) or\n * a query (`?tab=2`) never does. It is ember-primitives' `isExternal`, from `helpers/link`.\n */\nexport function isExternalLink(href: string): boolean {\n if (!href) return false\n if (href.startsWith('#') || href.startsWith('/') || href.startsWith('?')) return false\n try {\n return new URL(href, location.href).origin !== location.origin\n } catch {\n return false\n }\n}\n\n/** The app-relative path of `path` (which includes the rootURL), or `undefined` outside the app. */\nfunction withoutRoot(path: string, rootURL: string): string | undefined {\n const root = rootURL.endsWith('/') ? rootURL : `${rootURL}/`\n if (path === root.slice(0, -1)) return '/'\n if (!path.startsWith(root)) return undefined\n return `/${path.slice(root.length)}`\n}\n\ntype RouteInfo = NonNullable<ReturnType<RouterService['recognize']>>\n\n/**\n * The values of a route's dynamic segments, outermost route first, for `router.isActive`. It is\n * ember-primitives' `getParams`.\n */\nexport function dynamicSegments(info: RouteInfo | null): unknown[] {\n const params: Record<string, unknown>[] = []\n let current: RouteInfo | null = info\n while (current?.parent) {\n if (current.params) params.unshift(current.params)\n current = current.parent\n }\n return params.flatMap(segment => Object.values(segment))\n}\n\n/**\n * Whether `href` is the current route. By default the path decides, query params aside:\n * `/forum/1` is active on `/forum/1` and `/forum/1?sort=new`. `includeQueryParams` makes query\n * params count (`true` for all, or the names of the ones that count), and `activeOnSubPaths`\n * makes the routes below count too. A link to another origin, or outside the app's `rootURL`,\n * is never active. It is ember-primitives' `isActive`, from `helpers/link`.\n */\nexport function isActiveLink(\n router: RouterService,\n href: string,\n includeQueryParams: boolean | string[] = false,\n activeOnSubPaths = false,\n): boolean {\n if (!href || isExternalLink(href)) return false\n const url = new URL(href, location.href)\n const rootURL = router.rootURL ?? '/'\n const path = withoutRoot(url.pathname, rootURL)\n if (path === undefined) return false\n\n if (!includeQueryParams) {\n const root = rootURL.endsWith('/') ? rootURL : `${rootURL}/`\n let info: RouteInfo | null\n try {\n info = router.recognize(`${root}${path.slice(1)}`)\n } catch {\n return false\n }\n if (!info) return false\n const name = activeOnSubPaths ? info.name.replace(/\\.index$/, '') : info.name\n return router.isActive(name, ...(dynamicSegments(info) as []))\n }\n\n const currentPath = router.currentURL?.split('?')[0]?.split('#')[0]\n if (!currentPath) return false\n const onPath = activeOnSubPaths\n ? currentPath === path || currentPath.startsWith(path.endsWith('/') ? path : `${path}/`)\n : currentPath === path\n if (!onPath) return false\n\n const current = router.currentRoute?.queryParams ?? {}\n const linked = url.searchParams\n const names =\n includeQueryParams === true\n ? new Set([...Object.keys(current), ...linked.keys()])\n : new Set(includeQueryParams)\n for (const name of names) {\n const value = current[name]\n const now = value === undefined || value === null ? null : String(value)\n if (linked.get(name) !== now) return false\n }\n return true\n}\n\n/**\n * What an app needs to know about a link to render it: whether it leaves the app\n * (`isExternal`), whether it is the current route (`isActive`, for an active style or\n * `aria-current`), and a click handler that routes it (`handleClick`).\n *\n * {{#let (link \"/settings\" activeOnSubPaths=true) as |l|}}\n * <a href=\"/settings\" aria-current={{if l.isActive \"page\"}} {{on \"click\" l.handleClick}}>\n * Settings\n * </a>\n * {{/let}}\n *\n * It is ember-primitives' `link` helper (`helpers/link`), which its `Link` component renders\n * with.\n */\nclass Link extends Helper<LinkSignature> {\n @service declare router: RouterService\n\n compute(\n [href]: [string],\n { includeActiveQueryParams = false, activeOnSubPaths = false }: LinkOptions,\n ): LinkState {\n if (!isString(href)) throw new Error('Joinery: (link) needs the href')\n const router = this.router\n return {\n isExternal: isExternalLink(href),\n get isActive() {\n return isActiveLink(router, href, includeActiveQueryParams, activeOnSubPaths)\n },\n handleClick: (event: MouseEvent) => {\n const anchor = event.currentTarget\n if (anchor instanceof HTMLAnchorElement) handleLink(router, anchor, event)\n },\n }\n }\n}\n\nexport const link = Link\n"],"names":["isExternalLink","href","startsWith","URL","location","origin","withoutRoot","path","rootURL","root","endsWith","slice","undefined","length","dynamicSegments","info","params","current","parent","unshift","flatMap","segment","Object","values","isActiveLink","router","includeQueryParams","activeOnSubPaths","url","pathname","recognize","name","replace","isActive","currentPath","currentURL","split","onPath","currentRoute","queryParams","linked","searchParams","names","Set","keys","value","now","String","get","Link","Helper","g","prototype","service","i","compute","includeActiveQueryParams","isString","Error","isExternal","handleClick","event","anchor","currentTarget","HTMLAnchorElement","handleLink","link"],"mappings":"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"}
|
package/dist/link.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hash } from '@ember/helper';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
3
|
+
import { ExternalLink } from './external-link.js';
|
|
4
|
+
import { link } from './link-helper.js';
|
|
5
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
6
|
+
import { setComponentTemplate } from '@ember/component';
|
|
7
|
+
import templateOnly from '@ember/component/template-only';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* An `<a>` that knows where the user is, as ember-primitives' `Link`: on the current route it
|
|
11
|
+
* has `aria-current` and `data-active="true"`, a click on it is a transition (so it works in an
|
|
12
|
+
* app without `properLinks`), and an `@href` on another origin makes it an
|
|
13
|
+
* [`ExternalLink`](./external-link.gts), which opens in a new tab.
|
|
14
|
+
*
|
|
15
|
+
* <nav aria-label="Main">
|
|
16
|
+
* <Link @href="/">Home</Link>
|
|
17
|
+
* <Link @href="/forum" @activeOnSubPaths={{true}}>Forum</Link>
|
|
18
|
+
* <Link @href="https://developer.mozilla.org" as |a|>
|
|
19
|
+
* MDN {{#if a.isExternal}}<span aria-hidden="true">↗</span>{{/if}}
|
|
20
|
+
* </Link>
|
|
21
|
+
* </nav>
|
|
22
|
+
*
|
|
23
|
+
* `aria-current` is `page` on the current route. A link with `@activeOnSubPaths` marks a section
|
|
24
|
+
* rather than one page, so wherever it is active, on its own route as well as the ones below it,
|
|
25
|
+
* `aria-current` is `true`, as in ember-primitives. It needs the app's router, so it renders
|
|
26
|
+
* inside an app (or a test with `setupRouting`).
|
|
27
|
+
*/
|
|
28
|
+
const Link = setComponentTemplate(precompileTemplate("{{#let (link @href includeActiveQueryParams=@includeActiveQueryParams activeOnSubPaths=@activeOnSubPaths) as |l|}}\n {{#if l.isExternal}}\n <ExternalLink href={{@href}} data-test-jn=\"link\" data-test-jn-name={{@name}} ...attributes>\n {{yield (hash isExternal=true isActive=false)}}\n </ExternalLink>\n {{else}}\n <a href={{if @href @href \"##missing##\"}} data-active={{if l.isActive \"true\"}} aria-current={{if l.isActive (if @activeOnSubPaths \"true\" \"page\")}} data-test-jn=\"link\" data-test-jn-name={{@name}} {{on \"click\" l.handleClick}} ...attributes>\n {{yield (hash isExternal=false isActive=l.isActive)}}\n </a>\n {{/if}}\n{{/let}}", {
|
|
29
|
+
strictMode: true,
|
|
30
|
+
scope: () => ({
|
|
31
|
+
link,
|
|
32
|
+
ExternalLink,
|
|
33
|
+
hash,
|
|
34
|
+
on
|
|
35
|
+
})
|
|
36
|
+
}), templateOnly());
|
|
37
|
+
|
|
38
|
+
export { Link };
|
|
39
|
+
//# sourceMappingURL=link.js.map
|
package/dist/link.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../src/link.gts"],"sourcesContent":["import { hash } from '@ember/helper'\nimport { on } from '@ember/modifier'\nimport type { TOC } from '@ember/component/template-only'\nimport { ExternalLink } from './external-link.gts'\nimport { link } from './link-helper.ts'\n\n/** What `<Link>` yields: whether its `@href` leaves the app, and whether it is the current page. */\nexport interface LinkStatus {\n /**\n * Whether `@href` is on another origin, so the link leaves the app (it then opens in a new\n * tab). For telling the user, with an icon or a word.\n */\n isExternal: boolean\n /**\n * Whether `@href` is the current route (see `@includeActiveQueryParams` and\n * `@activeOnSubPaths`), for styling the link's content. Never for an external link.\n */\n isActive: boolean\n}\n\nexport interface LinkComponentSignature {\n Args: {\n /** Where the link goes: a path with the app's `rootURL` (`/settings`), or a URL. */\n href: string\n /**\n * Whether the query params count towards the active state: `true` for all of them (the\n * link is active only when the current URL's query params match its own), or the names of\n * the ones that count. Without it, the path alone decides.\n */\n includeActiveQueryParams?: true | string[]\n /**\n * Whether the link is also active on the routes below its own: `/forum/1` on\n * `/forum/1/posts`. Without it, only on its own route.\n */\n activeOnSubPaths?: true\n /** Its name, for its harness (`data-test-jn-name`). */\n name?: string\n }\n Blocks: {\n /** The link's content, given whether it leaves the app and whether it is the current page. */\n default: [LinkStatus]\n }\n /** The `<a>`. */\n Element: HTMLAnchorElement\n}\n\n/**\n * An `<a>` that knows where the user is, as ember-primitives' `Link`: on the current route it\n * has `aria-current` and `data-active=\"true\"`, a click on it is a transition (so it works in an\n * app without `properLinks`), and an `@href` on another origin makes it an\n * [`ExternalLink`](./external-link.gts), which opens in a new tab.\n *\n * <nav aria-label=\"Main\">\n * <Link @href=\"/\">Home</Link>\n * <Link @href=\"/forum\" @activeOnSubPaths={{true}}>Forum</Link>\n * <Link @href=\"https://developer.mozilla.org\" as |a|>\n * MDN {{#if a.isExternal}}<span aria-hidden=\"true\">↗</span>{{/if}}\n * </Link>\n * </nav>\n *\n * `aria-current` is `page` on the current route. A link with `@activeOnSubPaths` marks a section\n * rather than one page, so wherever it is active, on its own route as well as the ones below it,\n * `aria-current` is `true`, as in ember-primitives. It needs the app's router, so it renders\n * inside an app (or a test with `setupRouting`).\n */\nexport const Link: TOC<LinkComponentSignature> = <template>\n {{#let\n (link\n @href includeActiveQueryParams=@includeActiveQueryParams activeOnSubPaths=@activeOnSubPaths\n )\n as |l|\n }}\n {{#if l.isExternal}}\n <ExternalLink href={{@href}} data-test-jn=\"link\" data-test-jn-name={{@name}} ...attributes>\n {{yield (hash isExternal=true isActive=false)}}\n </ExternalLink>\n {{else}}\n <a\n href={{if @href @href \"##missing##\"}}\n data-active={{if l.isActive \"true\"}}\n aria-current={{if l.isActive (if @activeOnSubPaths \"true\" \"page\")}}\n data-test-jn=\"link\"\n data-test-jn-name={{@name}}\n {{on \"click\" l.handleClick}}\n ...attributes\n >\n {{yield (hash isExternal=false isActive=l.isActive)}}\n </a>\n {{/if}}\n {{/let}}\n</template>\n"],"names":["Link","setComponentTemplate","precompileTemplate","strictMode","scope","link","ExternalLink","hash","on","templateOnly"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;;;;;;AAkBC;MACYA,IAAU,GAAAC,oBAAA,CAA0BC,kBAAA,CAAA,kqBAAA,EAyBjD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,IAAA;IAAAC,YAAA;IAAAC,IAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;"}
|
package/dist/load.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { P as PromiseState, u as unwrapModule } from './promise-state-BMi2zVoT.js';
|
|
3
|
+
import { isNewable } from './narrowing.js';
|
|
4
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
|
+
import { setComponentTemplate } from '@ember/component';
|
|
6
|
+
|
|
7
|
+
/** What `load` takes: a component (or a module whose default export is one), or a way to get it. */
|
|
8
|
+
/**
|
|
9
|
+
* A component that loads another, for splitting a bundle by hand: it shows its `<:loading>`
|
|
10
|
+
* block while an `import()` (or any promise) is pending, `<:error>` if it fails, and the
|
|
11
|
+
* loaded component once it is there.
|
|
12
|
+
*
|
|
13
|
+
* const Chart = load(() => import('./revenue-chart.gts'))
|
|
14
|
+
*
|
|
15
|
+
* <template>
|
|
16
|
+
* <Chart>
|
|
17
|
+
* <:loading>Loading the chart…</:loading>
|
|
18
|
+
* <:error as |error|>The chart didn't load: {{error.reason}}</:error>
|
|
19
|
+
* <:success as |RevenueChart|><RevenueChart @year={{2026}} /></:success>
|
|
20
|
+
* </Chart>
|
|
21
|
+
* </template>
|
|
22
|
+
*
|
|
23
|
+
* It takes a component, a promise of one, or a function returning either, and an imported
|
|
24
|
+
* module stands for its default export. A function is called the first time the component
|
|
25
|
+
* renders, and only then; the result is kept, so later renders show it at once. Tests wait
|
|
26
|
+
* for the promise. It is ember-primitives' `load`, which is reactiveweb's `getPromiseState` in
|
|
27
|
+
* a component.
|
|
28
|
+
*
|
|
29
|
+
* @param source the component, or a promise or function that gives it
|
|
30
|
+
*/
|
|
31
|
+
function load(source) {
|
|
32
|
+
let state;
|
|
33
|
+
// A class component is a function, but it is the value itself, not a way to get it.
|
|
34
|
+
const input = isNewable(source) ? () => source : source;
|
|
35
|
+
const stateOf = () => state ??= new PromiseState(input, unwrapModule);
|
|
36
|
+
class Load extends Component {
|
|
37
|
+
get state() {
|
|
38
|
+
return stateOf();
|
|
39
|
+
}
|
|
40
|
+
/** What the `<:success>` block gets: the loaded component, with the signature asked for. */
|
|
41
|
+
get loaded() {
|
|
42
|
+
return this.state.resolved;
|
|
43
|
+
}
|
|
44
|
+
static {
|
|
45
|
+
setComponentTemplate(precompileTemplate("{{#if this.state.isLoading}}\n {{yield to=\"loading\"}}\n{{else if this.state.error}}\n {{yield this.state.error to=\"error\"}}\n{{else if this.state.resolved}}\n {{#if (has-block \"success\")}}\n {{yield this.loaded to=\"success\"}}\n {{else}}\n <this.state.resolved />\n {{/if}}\n{{/if}}", {
|
|
46
|
+
strictMode: true
|
|
47
|
+
}), this);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return Load;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { load };
|
|
54
|
+
//# sourceMappingURL=load.js.map
|
package/dist/load.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sources":["../src/load.gts"],"sourcesContent":["import Component from '@glimmer/component'\nimport type { ComponentLike } from '@glint/template'\nimport {\n PromiseState,\n unwrapModule,\n type LoadError,\n type LoadState,\n} from './-private/promise-state.ts'\nimport { isNewable } from './narrowing.ts'\n\nexport type { LoadError, LoadState }\n\nexport interface LoadSignature<Expected = { Args: any }> {\n Blocks: {\n /** While the promise is pending. Nothing renders here for a value that isn't a promise. */\n loading: []\n /** If the function threw or the promise rejected: `{ reason, original }`. */\n error: [error: LoadError]\n /**\n * Once loaded, with what was loaded: `<:success as |Loaded|><Loaded @id={{1}} /></:success>`.\n * Without this block, the loaded component renders on its own, with no arguments.\n */\n success?: [component: ComponentLike<Expected>]\n }\n}\n\n/** What `load` takes: a component (or a module whose default export is one), or a way to get it. */\nexport type LoadSource = unknown | Promise<unknown> | (() => unknown) | (() => Promise<unknown>)\n\n/**\n * A component that loads another, for splitting a bundle by hand: it shows its `<:loading>`\n * block while an `import()` (or any promise) is pending, `<:error>` if it fails, and the\n * loaded component once it is there.\n *\n * const Chart = load(() => import('./revenue-chart.gts'))\n *\n * <template>\n * <Chart>\n * <:loading>Loading the chart…</:loading>\n * <:error as |error|>The chart didn't load: {{error.reason}}</:error>\n * <:success as |RevenueChart|><RevenueChart @year={{2026}} /></:success>\n * </Chart>\n * </template>\n *\n * It takes a component, a promise of one, or a function returning either, and an imported\n * module stands for its default export. A function is called the first time the component\n * renders, and only then; the result is kept, so later renders show it at once. Tests wait\n * for the promise. It is ember-primitives' `load`, which is reactiveweb's `getPromiseState` in\n * a component.\n *\n * @param source the component, or a promise or function that gives it\n */\nexport function load<Expected = { Args: any }>(\n source: LoadSource,\n): ComponentLike<LoadSignature<Expected>> {\n let state: PromiseState<ComponentLike> | undefined\n // A class component is a function, but it is the value itself, not a way to get it.\n const input = isNewable(source) ? () => source : source\n const stateOf = () => (state ??= new PromiseState<ComponentLike>(input, unwrapModule as never))\n\n class Load extends Component<LoadSignature<Expected>> {\n get state(): LoadState<ComponentLike> {\n return stateOf()\n }\n\n /** What the `<:success>` block gets: the loaded component, with the signature asked for. */\n get loaded(): ComponentLike<Expected> {\n return this.state.resolved as unknown as ComponentLike<Expected>\n }\n\n <template>\n {{#if this.state.isLoading}}\n {{yield to=\"loading\"}}\n {{else if this.state.error}}\n {{yield this.state.error to=\"error\"}}\n {{else if this.state.resolved}}\n {{#if (has-block \"success\")}}\n {{yield this.loaded to=\"success\"}}\n {{else}}\n <this.state.resolved />\n {{/if}}\n {{/if}}\n </template>\n }\n\n return Load\n}\n"],"names":["load","source","state","input","isNewable","stateOf","PromiseState","unwrapModule","Load","Component","loaded","resolved","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;AA0BA;AAGA;;;;;;;;;;;;;;;;;;;;;;;AAuBO,SAASA,IAAAA,CACdC,MAAkB,EACW;AAC7B,EAAA,IAAIC,KAA8C;AAClD;EACA,MAAMC,KAAA,GAAQC,SAAA,CAAUH,MAAA,CAAA,GAAU,MAAMA,MAAA,GAASA,MAAA;AACjD,EAAA,MAAMI,OAAA,GAAUA,MAAOH,KAAA,KAAU,IAAII,aAA4BH,KAAA,EAAOI,YAAqB,CAAC;EAE9F,MAAMC,IAAA,SAAaC,UAAwB;IACzC,IAAIP,KAAAA,GAAkC;MACpC,OAAOG,OAAA,EAAA;AACT,IAAA;AAEA;IACA,IAAIK,MAAAA,GAAkC;AACpC,MAAA,OAAO,IAAI,CAACR,KAAK,CAACS,QAAQ;AAC5B,IAAA;AAEA,IAAA;MAAAC,oBAAA,CAAAC,kBAAA,CAAA,8SAAA,EAYA;QAAAC,UAAA,EAAA;OAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAEA,EAAA,OAAON,IAAA;AACT;;"}
|