@nanahoshi/mona-ui 0.27.1 → 0.28.0
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/docs/api/auto-complete.md +67 -0
- package/docs/api/avatar.md +31 -0
- package/docs/api/breadcrumb.md +74 -0
- package/docs/api/button-group.md +71 -0
- package/docs/api/button.md +84 -0
- package/docs/api/calendar.md +123 -0
- package/docs/api/card.md +97 -0
- package/docs/api/chart.md +4380 -0
- package/docs/api/check-box.md +70 -0
- package/docs/api/chip.md +55 -0
- package/docs/api/circular-progress-bar.md +71 -0
- package/docs/api/collapsible.md +71 -0
- package/docs/api/color-gradient.md +54 -0
- package/docs/api/color-palette.md +52 -0
- package/docs/api/color-picker.md +89 -0
- package/docs/api/combo-box.md +69 -0
- package/docs/api/command.md +282 -0
- package/docs/api/common.md +599 -0
- package/docs/api/contextmenu.md +239 -0
- package/docs/api/date-input.md +119 -0
- package/docs/api/date-picker.md +67 -0
- package/docs/api/datetime-picker.md +72 -0
- package/docs/api/dialog.md +291 -0
- package/docs/api/dropdown-button.md +248 -0
- package/docs/api/dropdown-list.md +72 -0
- package/docs/api/dropdowns.md +172 -0
- package/docs/api/editor.md +117 -0
- package/docs/api/expansion-panel.md +85 -0
- package/docs/api/fieldset.md +33 -0
- package/docs/api/filter.md +116 -0
- package/docs/api/grid.md +1445 -0
- package/docs/api/i18n.md +1699 -0
- package/docs/api/label.md +58 -0
- package/docs/api/list-box.md +301 -0
- package/docs/api/list-view.md +294 -0
- package/docs/api/list.md +119 -0
- package/docs/api/locales.md +134 -0
- package/docs/api/menubar.md +275 -0
- package/docs/api/multi-select.md +92 -0
- package/docs/api/notification.md +164 -0
- package/docs/api/numeric-text-box.md +130 -0
- package/docs/api/otp-input.md +100 -0
- package/docs/api/pager.md +371 -0
- package/docs/api/placeholder.md +18 -0
- package/docs/api/popover.md +170 -0
- package/docs/api/popup-menu.md +328 -0
- package/docs/api/popup.md +299 -0
- package/docs/api/progress-bar.md +79 -0
- package/docs/api/query.md +367 -0
- package/docs/api/radio-button.md +113 -0
- package/docs/api/rating.md +187 -0
- package/docs/api/scroll-view.md +93 -0
- package/docs/api/segmented.md +114 -0
- package/docs/api/sheet.md +65 -0
- package/docs/api/sidebar.md +583 -0
- package/docs/api/skeleton.md +26 -0
- package/docs/api/slider.md +173 -0
- package/docs/api/spinner.md +132 -0
- package/docs/api/split-button.md +261 -0
- package/docs/api/splitter.md +57 -0
- package/docs/api/stepper.md +148 -0
- package/docs/api/switch.md +78 -0
- package/docs/api/tabs.md +139 -0
- package/docs/api/text-area.md +20 -0
- package/docs/api/text-box.md +106 -0
- package/docs/api/theme.md +627 -0
- package/docs/api/time-picker.md +69 -0
- package/docs/api/time-selector.md +54 -0
- package/docs/api/tooltip.md +112 -0
- package/docs/api/tree-view.md +631 -0
- package/docs/api/window.md +245 -0
- package/docs/auto-complete.md +28 -329
- package/docs/avatar.md +4 -24
- package/docs/breadcrumb.md +10 -65
- package/docs/button-group.md +7 -60
- package/docs/button.md +8 -67
- package/docs/calendar.md +16 -121
- package/docs/card.md +16 -79
- package/docs/chart-bar.md +16 -234
- package/docs/chart-financial.md +10 -121
- package/docs/chart-funnel.md +13 -176
- package/docs/chart-heatmap.md +15 -131
- package/docs/chart-line-area.md +12 -137
- package/docs/chart-pie.md +17 -221
- package/docs/chart-radar.md +13 -129
- package/docs/chart-radial.md +13 -211
- package/docs/chart-scatter.md +6 -74
- package/docs/chart-treemap.md +14 -196
- package/docs/chart.md +168 -1892
- package/docs/checkbox.md +5 -61
- package/docs/chip.md +7 -42
- package/docs/circular-progress-bar.md +9 -61
- package/docs/collapsible.md +5 -87
- package/docs/color-gradient.md +8 -81
- package/docs/color-palette.md +7 -69
- package/docs/color-picker.md +9 -105
- package/docs/combo-box.md +28 -331
- package/docs/command.md +25 -236
- package/docs/contextmenu.md +15 -140
- package/docs/date-picker.md +7 -110
- package/docs/datetime-picker.md +7 -129
- package/docs/decimal-textbox.md +6 -69
- package/docs/dialog.md +23 -263
- package/docs/dropdown-button.md +15 -146
- package/docs/dropdown-list.md +29 -332
- package/docs/editor.md +10 -164
- package/docs/expansion-panel.md +7 -69
- package/docs/fieldset.md +5 -24
- package/docs/grid-columns.md +12 -92
- package/docs/grid-editing.md +29 -291
- package/docs/grid-grouping.md +11 -50
- package/docs/grid-rows.md +10 -74
- package/docs/grid-selection.md +7 -36
- package/docs/grid-server.md +8 -293
- package/docs/grid-sorting-filtering.md +10 -333
- package/docs/grid-state-export.md +17 -228
- package/docs/grid.md +23 -216
- package/docs/input.md +7 -19
- package/docs/installation.md +147 -15
- package/docs/introduction.md +37 -15
- package/docs/label.md +8 -39
- package/docs/list-box.md +21 -253
- package/docs/list-view.md +25 -232
- package/docs/menubar.md +21 -167
- package/docs/multi-select.md +31 -350
- package/docs/notification.md +17 -116
- package/docs/numeric-textbox.md +9 -78
- package/docs/otp-input.md +9 -95
- package/docs/pager.md +19 -239
- package/docs/placeholder.md +5 -18
- package/docs/popover.md +13 -123
- package/docs/popup-menu.md +22 -243
- package/docs/popup.md +24 -248
- package/docs/progress-bar.md +10 -75
- package/docs/radio-button.md +8 -96
- package/docs/range-slider.md +9 -82
- package/docs/rating.md +15 -163
- package/docs/scroll-view.md +9 -86
- package/docs/segmented.md +8 -90
- package/docs/sheet.md +10 -74
- package/docs/sidebar-menus.md +20 -155
- package/docs/sidebar-state.md +16 -134
- package/docs/sidebar.md +18 -218
- package/docs/skeleton.md +5 -26
- package/docs/slider.md +9 -97
- package/docs/spinner.md +15 -95
- package/docs/split-button.md +21 -166
- package/docs/splitter.md +9 -56
- package/docs/stepper.md +13 -127
- package/docs/switch.md +8 -58
- package/docs/tabs.md +13 -111
- package/docs/textarea.md +4 -13
- package/docs/textbox.md +10 -77
- package/docs/theming-built-in-themes.md +67 -0
- package/docs/theming-custom-colors.md +274 -0
- package/docs/theming-custom-themes.md +168 -0
- package/docs/theming.md +164 -248
- package/docs/time-picker.md +7 -112
- package/docs/tooltip-directive.md +12 -96
- package/docs/tooltip.md +12 -96
- package/docs/tree-view.md +42 -495
- package/docs/window.md +19 -230
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
- package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
- package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -389
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
- package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
- package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -740
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -254
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -729
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
- package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
- package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5068
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
- package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
- package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
- package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
- package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
- package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
- package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
- package/llms.txt +80 -2
- package/package.json +62 -23
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
- package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
- package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
- package/types/nanahoshi-mona-ui-button.d.ts +227 -166
- package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
- package/types/nanahoshi-mona-ui-card.d.ts +125 -111
- package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
- package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
- package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
- package/types/nanahoshi-mona-ui-collapsible.d.ts +105 -87
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
- package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
- package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
- package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
- package/types/nanahoshi-mona-ui-command.d.ts +279 -191
- package/types/nanahoshi-mona-ui-common.d.ts +360 -385
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
- package/types/nanahoshi-mona-ui-date-input.d.ts +97 -97
- package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
- package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +255 -235
- package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
- package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
- package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
- package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
- package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
- package/types/nanahoshi-mona-ui-i18n.d.ts +999 -1052
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
- package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
- package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
- package/types/nanahoshi-mona-ui-label.d.ts +108 -78
- package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
- package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
- package/types/nanahoshi-mona-ui-list.d.ts +2 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
- package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
- package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
- package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
- package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
- package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
- package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
- package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
- package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
- package/types/nanahoshi-mona-ui-query.d.ts +82 -88
- package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
- package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
- package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
- package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
- package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
- package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
- package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
- package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
- package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
- package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
- package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
- package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
- package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
- package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
- package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
- package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
- package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
- package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
- package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
- package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
- package/types/nanahoshi-mona-ui-window.d.ts +494 -399
- package/types/nanahoshi-mona-ui.d.ts +1 -2
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
- package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
|
@@ -1,686 +1,751 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { classInputToClass } from
|
|
5
|
-
import { MonaI18nService } from
|
|
6
|
-
import { twMerge } from
|
|
7
|
-
import { cva } from
|
|
8
|
-
import { LiveAnnouncer } from
|
|
9
|
-
import { Subject, defer,
|
|
10
|
-
import { v4 } from
|
|
11
|
-
|
|
12
|
-
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
13
|
-
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ApplicationRef, Component, DOCUMENT, ElementRef, Injectable, Injector, RendererFactory2, booleanAttribute, computed, createComponent, inject, input, isDevMode, output } from "@angular/core";
|
|
3
|
+
import { LucideDynamicIcon, LucideLoader } from "@lucide/angular";
|
|
4
|
+
import { classInputToClass } from "@nanahoshi/mona-ui/common";
|
|
5
|
+
import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
import { LiveAnnouncer } from "@angular/cdk/a11y";
|
|
9
|
+
import { Subject, defer, finalize, takeUntil } from "rxjs";
|
|
10
|
+
import { v4 } from "uuid";
|
|
14
11
|
const SPINNER_DEFAULT_MESSAGES = {
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
cancel: "Cancel",
|
|
13
|
+
loading: "Loading"
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
const spinnerThemeVariants = cva("inline-flex items-center justify-center flex-none aspect-square relative text-current select-none", {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
variants: { size: {
|
|
17
|
+
small: "w-3 h-3",
|
|
18
|
+
medium: "w-4 h-4",
|
|
19
|
+
large: "w-6 h-6"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { size: "medium" }
|
|
22
|
+
});
|
|
23
|
+
var SpinnerComponent = class SpinnerComponent {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.#i18n = inject(MonaI18nService);
|
|
26
|
+
this.baseClass = computed(() => {
|
|
27
|
+
const variantClass = spinnerThemeVariants({ size: this.size() });
|
|
28
|
+
return twMerge(variantClass, this.userClass());
|
|
29
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
30
|
+
this.loaderIcon = LucideLoader;
|
|
31
|
+
this.messages = this.#i18n.componentMessages("spinner", SPINNER_DEFAULT_MESSAGES);
|
|
32
|
+
this.pixelSize = computed(() => {
|
|
33
|
+
switch (this.size()) {
|
|
34
|
+
case "small": return 12;
|
|
35
|
+
case "large": return 24;
|
|
36
|
+
default: return 16;
|
|
37
|
+
}
|
|
38
|
+
}, ...ngDevMode ? [{ debugName: "pixelSize" }] : /* istanbul ignore next */ []);
|
|
39
|
+
this.appearance = input("default", ...ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []);
|
|
40
|
+
this.ariaLabel = input(void 0, {
|
|
41
|
+
...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
|
|
42
|
+
alias: "aria-label"
|
|
43
|
+
});
|
|
44
|
+
this.decorative = input(false, {
|
|
45
|
+
...ngDevMode ? { debugName: "decorative" } : /* istanbul ignore next */ {},
|
|
46
|
+
transform: booleanAttribute
|
|
47
|
+
});
|
|
48
|
+
this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
49
|
+
this.userClass = input("", {
|
|
50
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
51
|
+
alias: "class",
|
|
52
|
+
transform: (value) => classInputToClass(value)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
#i18n;
|
|
56
|
+
static {
|
|
57
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
58
|
+
minVersion: "12.0.0",
|
|
59
|
+
version: "22.2.6",
|
|
60
|
+
ngImport: i0,
|
|
61
|
+
type: SpinnerComponent,
|
|
62
|
+
deps: [],
|
|
63
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
static {
|
|
67
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
68
|
+
minVersion: "17.0.0",
|
|
69
|
+
version: "22.2.6",
|
|
70
|
+
type: SpinnerComponent,
|
|
71
|
+
isStandalone: true,
|
|
72
|
+
selector: "mona-spinner",
|
|
73
|
+
inputs: {
|
|
74
|
+
appearance: {
|
|
75
|
+
classPropertyName: "appearance",
|
|
76
|
+
publicName: "appearance",
|
|
77
|
+
isSignal: true,
|
|
78
|
+
isRequired: false,
|
|
79
|
+
transformFunction: null
|
|
80
|
+
},
|
|
81
|
+
ariaLabel: {
|
|
82
|
+
classPropertyName: "ariaLabel",
|
|
83
|
+
publicName: "aria-label",
|
|
84
|
+
isSignal: true,
|
|
85
|
+
isRequired: false,
|
|
86
|
+
transformFunction: null
|
|
87
|
+
},
|
|
88
|
+
decorative: {
|
|
89
|
+
classPropertyName: "decorative",
|
|
90
|
+
publicName: "decorative",
|
|
91
|
+
isSignal: true,
|
|
92
|
+
isRequired: false,
|
|
93
|
+
transformFunction: null
|
|
94
|
+
},
|
|
95
|
+
size: {
|
|
96
|
+
classPropertyName: "size",
|
|
97
|
+
publicName: "size",
|
|
98
|
+
isSignal: true,
|
|
99
|
+
isRequired: false,
|
|
100
|
+
transformFunction: null
|
|
101
|
+
},
|
|
102
|
+
userClass: {
|
|
103
|
+
classPropertyName: "userClass",
|
|
104
|
+
publicName: "class",
|
|
105
|
+
isSignal: true,
|
|
106
|
+
isRequired: false,
|
|
107
|
+
transformFunction: null
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
host: { properties: {
|
|
111
|
+
"attr.aria-hidden": "decorative() ? 'true' : null",
|
|
112
|
+
"attr.aria-label": "decorative() ? null : (ariaLabel() || messages().loading)",
|
|
113
|
+
"attr.role": "decorative() ? null : 'img'",
|
|
114
|
+
"class": "baseClass()"
|
|
115
|
+
} },
|
|
116
|
+
ngImport: i0,
|
|
117
|
+
template: "@switch (appearance()) {\n @case (\"default\") {\n <svg [lucideIcon]=\"loaderIcon\" [size]=\"pixelSize()\" class=\"size-full animate-[spin_1.5s_linear_infinite] motion-reduce:animate-none\"></svg>\n }\n @case (\"pulsing\") {\n <span class=\"mona-spinner-pulsing-container\">\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-2\"></span>\n </span>\n }\n @case (\"pulsing-triad\") {\n <span class=\"mona-spinner-pulsing-triad-container\">\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-3\"></span>\n </span>\n }\n @case (\"pulsing-ring\") {\n <span class=\"mona-spinner-pulsing-ring-container\">\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-3\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-4\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-5\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-6\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-7\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-8\"></span>\n </span>\n }\n @case (\"converging-spinner\") {\n <span class=\"mona-spinner-converge-container\">\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-1\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-2\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-3\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-4\"></span>\n </span>\n }\n}\n",
|
|
118
|
+
styles: [":host{display:inline-flex;vertical-align:middle}.mona-spinner-pulsing-container{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.mona-spinner-pulsing-segment{position:absolute;inset:0;border-radius:9999px;background-color:currentColor;opacity:.6;animation:mona-spinner-pulse 1.2s cubic-bezier(0,.2,.8,1) infinite}.mona-spinner-pulsing-2{animation-delay:-.6s}@keyframes mona-spinner-pulse{0%{transform:scale(.1);opacity:.9}50%{transform:scale(.6);opacity:.5}to{transform:scale(1);opacity:0}}.mona-spinner-pulsing-triad-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-triad-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.4s ease-in-out infinite}.mona-spinner-pulsing-triad-1{top:0;left:34%;animation-delay:-.933s}.mona-spinner-pulsing-triad-2{bottom:0;left:0;animation-delay:-.467s}.mona-spinner-pulsing-triad-3{bottom:0;right:0;animation-delay:0s}@keyframes mona-spinner-dot-pulse{0%,to{transform:scale(.4);opacity:.4}50%{transform:scale(1);opacity:1}}.mona-spinner-pulsing-ring-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-ring-segment{position:absolute;width:22%;height:22%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.6s ease-in-out infinite}.mona-spinner-pulsing-ring-1{top:5%;left:39%;animation-delay:0s}.mona-spinner-pulsing-ring-2{top:14.96%;left:63.04%;animation-delay:-.2s}.mona-spinner-pulsing-ring-3{top:39%;left:73%;animation-delay:-.4s}.mona-spinner-pulsing-ring-4{top:63.04%;left:63.04%;animation-delay:-.6s}.mona-spinner-pulsing-ring-5{top:73%;left:39%;animation-delay:-.8s}.mona-spinner-pulsing-ring-6{top:63.04%;left:14.96%;animation-delay:-1s}.mona-spinner-pulsing-ring-7{top:39%;left:5%;animation-delay:-1.2s}.mona-spinner-pulsing-ring-8{top:14.96%;left:14.96%;animation-delay:-1.4s}.mona-spinner-converge-container{position:relative;width:100%;height:100%;animation:mona-spinner-rotate 1.5s linear infinite}.mona-spinner-converge-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-converge 1.5s ease-in-out infinite}.mona-spinner-converge-1{top:0;left:0}.mona-spinner-converge-2{top:0;right:0}.mona-spinner-converge-3{bottom:0;right:0}.mona-spinner-converge-4{bottom:0;left:0}@keyframes mona-spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes mona-spinner-converge{0%,to{transform:scale(1)}50%{transform:scale(.4)}}@media(prefers-reduced-motion:reduce){.mona-spinner-pulsing-segment,.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment,.mona-spinner-converge-container,.mona-spinner-converge-segment{animation:none!important}.mona-spinner-pulsing-segment{opacity:.6;transform:scale(.85)}.mona-spinner-pulsing-2{opacity:.3;transform:scale(.5)}.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment{opacity:.7;transform:scale(.8)}}@media(forced-colors:active){[data-segment]{background-color:CanvasText}}\n"],
|
|
119
|
+
dependencies: [{
|
|
120
|
+
kind: "component",
|
|
121
|
+
type: LucideDynamicIcon,
|
|
122
|
+
selector: "svg[lucideIcon]",
|
|
123
|
+
inputs: ["lucideIcon"]
|
|
124
|
+
}]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
129
|
+
minVersion: "12.0.0",
|
|
130
|
+
version: "22.2.6",
|
|
131
|
+
ngImport: i0,
|
|
132
|
+
type: SpinnerComponent,
|
|
133
|
+
decorators: [{
|
|
134
|
+
type: Component,
|
|
135
|
+
args: [{
|
|
136
|
+
selector: "mona-spinner",
|
|
137
|
+
imports: [LucideDynamicIcon],
|
|
138
|
+
host: {
|
|
139
|
+
"[attr.aria-hidden]": "decorative() ? 'true' : null",
|
|
140
|
+
"[attr.aria-label]": "decorative() ? null : (ariaLabel() || messages().loading)",
|
|
141
|
+
"[attr.role]": "decorative() ? null : 'img'",
|
|
142
|
+
"[class]": "baseClass()"
|
|
143
|
+
},
|
|
144
|
+
template: "@switch (appearance()) {\n @case (\"default\") {\n <svg [lucideIcon]=\"loaderIcon\" [size]=\"pixelSize()\" class=\"size-full animate-[spin_1.5s_linear_infinite] motion-reduce:animate-none\"></svg>\n }\n @case (\"pulsing\") {\n <span class=\"mona-spinner-pulsing-container\">\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-2\"></span>\n </span>\n }\n @case (\"pulsing-triad\") {\n <span class=\"mona-spinner-pulsing-triad-container\">\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-3\"></span>\n </span>\n }\n @case (\"pulsing-ring\") {\n <span class=\"mona-spinner-pulsing-ring-container\">\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-3\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-4\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-5\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-6\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-7\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-8\"></span>\n </span>\n }\n @case (\"converging-spinner\") {\n <span class=\"mona-spinner-converge-container\">\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-1\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-2\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-3\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-4\"></span>\n </span>\n }\n}\n",
|
|
145
|
+
styles: [":host{display:inline-flex;vertical-align:middle}.mona-spinner-pulsing-container{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.mona-spinner-pulsing-segment{position:absolute;inset:0;border-radius:9999px;background-color:currentColor;opacity:.6;animation:mona-spinner-pulse 1.2s cubic-bezier(0,.2,.8,1) infinite}.mona-spinner-pulsing-2{animation-delay:-.6s}@keyframes mona-spinner-pulse{0%{transform:scale(.1);opacity:.9}50%{transform:scale(.6);opacity:.5}to{transform:scale(1);opacity:0}}.mona-spinner-pulsing-triad-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-triad-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.4s ease-in-out infinite}.mona-spinner-pulsing-triad-1{top:0;left:34%;animation-delay:-.933s}.mona-spinner-pulsing-triad-2{bottom:0;left:0;animation-delay:-.467s}.mona-spinner-pulsing-triad-3{bottom:0;right:0;animation-delay:0s}@keyframes mona-spinner-dot-pulse{0%,to{transform:scale(.4);opacity:.4}50%{transform:scale(1);opacity:1}}.mona-spinner-pulsing-ring-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-ring-segment{position:absolute;width:22%;height:22%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.6s ease-in-out infinite}.mona-spinner-pulsing-ring-1{top:5%;left:39%;animation-delay:0s}.mona-spinner-pulsing-ring-2{top:14.96%;left:63.04%;animation-delay:-.2s}.mona-spinner-pulsing-ring-3{top:39%;left:73%;animation-delay:-.4s}.mona-spinner-pulsing-ring-4{top:63.04%;left:63.04%;animation-delay:-.6s}.mona-spinner-pulsing-ring-5{top:73%;left:39%;animation-delay:-.8s}.mona-spinner-pulsing-ring-6{top:63.04%;left:14.96%;animation-delay:-1s}.mona-spinner-pulsing-ring-7{top:39%;left:5%;animation-delay:-1.2s}.mona-spinner-pulsing-ring-8{top:14.96%;left:14.96%;animation-delay:-1.4s}.mona-spinner-converge-container{position:relative;width:100%;height:100%;animation:mona-spinner-rotate 1.5s linear infinite}.mona-spinner-converge-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-converge 1.5s ease-in-out infinite}.mona-spinner-converge-1{top:0;left:0}.mona-spinner-converge-2{top:0;right:0}.mona-spinner-converge-3{bottom:0;right:0}.mona-spinner-converge-4{bottom:0;left:0}@keyframes mona-spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes mona-spinner-converge{0%,to{transform:scale(1)}50%{transform:scale(.4)}}@media(prefers-reduced-motion:reduce){.mona-spinner-pulsing-segment,.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment,.mona-spinner-converge-container,.mona-spinner-converge-segment{animation:none!important}.mona-spinner-pulsing-segment{opacity:.6;transform:scale(.85)}.mona-spinner-pulsing-2{opacity:.3;transform:scale(.5)}.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment{opacity:.7;transform:scale(.8)}}@media(forced-colors:active){[data-segment]{background-color:CanvasText}}\n"]
|
|
146
|
+
}]
|
|
147
|
+
}],
|
|
148
|
+
propDecorators: {
|
|
149
|
+
appearance: [{
|
|
150
|
+
type: i0.Input,
|
|
151
|
+
args: [{
|
|
152
|
+
isSignal: true,
|
|
153
|
+
alias: "appearance",
|
|
154
|
+
required: false
|
|
155
|
+
}]
|
|
156
|
+
}],
|
|
157
|
+
ariaLabel: [{
|
|
158
|
+
type: i0.Input,
|
|
159
|
+
args: [{
|
|
160
|
+
isSignal: true,
|
|
161
|
+
alias: "aria-label",
|
|
162
|
+
required: false
|
|
163
|
+
}]
|
|
164
|
+
}],
|
|
165
|
+
decorative: [{
|
|
166
|
+
type: i0.Input,
|
|
167
|
+
args: [{
|
|
168
|
+
isSignal: true,
|
|
169
|
+
alias: "decorative",
|
|
170
|
+
required: false
|
|
171
|
+
}]
|
|
172
|
+
}],
|
|
173
|
+
size: [{
|
|
174
|
+
type: i0.Input,
|
|
175
|
+
args: [{
|
|
176
|
+
isSignal: true,
|
|
177
|
+
alias: "size",
|
|
178
|
+
required: false
|
|
179
|
+
}]
|
|
180
|
+
}],
|
|
181
|
+
userClass: [{
|
|
182
|
+
type: i0.Input,
|
|
183
|
+
args: [{
|
|
184
|
+
isSignal: true,
|
|
185
|
+
alias: "class",
|
|
186
|
+
required: false
|
|
187
|
+
}]
|
|
188
|
+
}]
|
|
189
|
+
}
|
|
30
190
|
});
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @description
|
|
34
|
-
* An indeterminate loading indicator primitive for communicating ongoing activity.
|
|
35
|
-
* Supports multiple appearances and standard sizes. It's a named image, so it's found when a screen reader reaches it,
|
|
36
|
-
* not announced. To announce loading, use `SpinnerService` or a live region that's already on the page.
|
|
37
|
-
*/
|
|
38
|
-
class SpinnerComponent {
|
|
39
|
-
constructor() {
|
|
40
|
-
this.#i18n = inject(MonaI18nService);
|
|
41
|
-
this.baseClass = computed(() => {
|
|
42
|
-
const variantClass = spinnerThemeVariants({ size: this.size() });
|
|
43
|
-
return twMerge(variantClass, this.userClass());
|
|
44
|
-
}, /* @ts-ignore */
|
|
45
|
-
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
46
|
-
this.loaderIcon = LucideLoader;
|
|
47
|
-
this.messages = this.#i18n.componentMessages("spinner", SPINNER_DEFAULT_MESSAGES);
|
|
48
|
-
this.pixelSize = computed(() => {
|
|
49
|
-
switch (this.size()) {
|
|
50
|
-
case "small":
|
|
51
|
-
return 12;
|
|
52
|
-
case "large":
|
|
53
|
-
return 24;
|
|
54
|
-
case "medium":
|
|
55
|
-
default:
|
|
56
|
-
return 16;
|
|
57
|
-
}
|
|
58
|
-
}, /* @ts-ignore */
|
|
59
|
-
...(ngDevMode ? [{ debugName: "pixelSize" }] : /* istanbul ignore next */ []));
|
|
60
|
-
/**
|
|
61
|
-
* @description Visual appearance of the spinner animation.
|
|
62
|
-
* @default "default"
|
|
63
|
-
*/
|
|
64
|
-
this.appearance = input("default", /* @ts-ignore */
|
|
65
|
-
...(ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []));
|
|
66
|
-
/**
|
|
67
|
-
* @description Accessible name of the spinner when it is not decorative.
|
|
68
|
-
* When not set, falls back to the localized loading text.
|
|
69
|
-
* @default undefined
|
|
70
|
-
*/
|
|
71
|
-
this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
|
|
72
|
-
/**
|
|
73
|
-
* @description When `true`, removes the `img` role and hides the spinner from assistive technology with `aria-hidden="true"`.
|
|
74
|
-
* Useful when visible text says the same thing, or a parent element already manages loading semantics (such as
|
|
75
|
-
* `aria-busy="true"` on a button).
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
this.decorative = input(false, { ...(ngDevMode ? { debugName: "decorative" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
79
|
-
/**
|
|
80
|
-
* @description Size preset controlling the dimensions of the indicator.
|
|
81
|
-
* @default "medium"
|
|
82
|
-
*/
|
|
83
|
-
this.size = input("medium", /* @ts-ignore */
|
|
84
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
85
|
-
/**
|
|
86
|
-
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
87
|
-
* @default ""
|
|
88
|
-
*/
|
|
89
|
-
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class",
|
|
90
|
-
transform: value => classInputToClass(value) });
|
|
91
|
-
}
|
|
92
|
-
#i18n;
|
|
93
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
94
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SpinnerComponent, isStandalone: true, selector: "mona-spinner", inputs: { appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, decorative: { classPropertyName: "decorative", publicName: "decorative", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-hidden": "decorative() ? 'true' : null", "attr.aria-label": "decorative() ? null : (ariaLabel() || messages().loading)", "attr.role": "decorative() ? null : 'img'", "class": "baseClass()" } }, ngImport: i0, template: "@switch (appearance()) {\n @case (\"default\") {\n <svg [lucideIcon]=\"loaderIcon\" [size]=\"pixelSize()\" class=\"size-full animate-[spin_1.5s_linear_infinite] motion-reduce:animate-none\"></svg>\n }\n @case (\"pulsing\") {\n <span class=\"mona-spinner-pulsing-container\">\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-2\"></span>\n </span>\n }\n @case (\"pulsing-triad\") {\n <span class=\"mona-spinner-pulsing-triad-container\">\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-3\"></span>\n </span>\n }\n @case (\"pulsing-ring\") {\n <span class=\"mona-spinner-pulsing-ring-container\">\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-3\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-4\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-5\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-6\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-7\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-8\"></span>\n </span>\n }\n @case (\"converging-spinner\") {\n <span class=\"mona-spinner-converge-container\">\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-1\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-2\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-3\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-4\"></span>\n </span>\n }\n}\n", styles: [":host{display:inline-flex;vertical-align:middle}.mona-spinner-pulsing-container{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.mona-spinner-pulsing-segment{position:absolute;inset:0;border-radius:9999px;background-color:currentColor;opacity:.6;animation:mona-spinner-pulse 1.2s cubic-bezier(0,.2,.8,1) infinite}.mona-spinner-pulsing-2{animation-delay:-.6s}@keyframes mona-spinner-pulse{0%{transform:scale(.1);opacity:.9}50%{transform:scale(.6);opacity:.5}to{transform:scale(1);opacity:0}}.mona-spinner-pulsing-triad-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-triad-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.4s ease-in-out infinite}.mona-spinner-pulsing-triad-1{top:0;left:34%;animation-delay:-.933s}.mona-spinner-pulsing-triad-2{bottom:0;left:0;animation-delay:-.467s}.mona-spinner-pulsing-triad-3{bottom:0;right:0;animation-delay:0s}@keyframes mona-spinner-dot-pulse{0%,to{transform:scale(.4);opacity:.4}50%{transform:scale(1);opacity:1}}.mona-spinner-pulsing-ring-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-ring-segment{position:absolute;width:22%;height:22%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.6s ease-in-out infinite}.mona-spinner-pulsing-ring-1{top:5%;left:39%;animation-delay:0s}.mona-spinner-pulsing-ring-2{top:14.96%;left:63.04%;animation-delay:-.2s}.mona-spinner-pulsing-ring-3{top:39%;left:73%;animation-delay:-.4s}.mona-spinner-pulsing-ring-4{top:63.04%;left:63.04%;animation-delay:-.6s}.mona-spinner-pulsing-ring-5{top:73%;left:39%;animation-delay:-.8s}.mona-spinner-pulsing-ring-6{top:63.04%;left:14.96%;animation-delay:-1s}.mona-spinner-pulsing-ring-7{top:39%;left:5%;animation-delay:-1.2s}.mona-spinner-pulsing-ring-8{top:14.96%;left:14.96%;animation-delay:-1.4s}.mona-spinner-converge-container{position:relative;width:100%;height:100%;animation:mona-spinner-rotate 1.5s linear infinite}.mona-spinner-converge-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-converge 1.5s ease-in-out infinite}.mona-spinner-converge-1{top:0;left:0}.mona-spinner-converge-2{top:0;right:0}.mona-spinner-converge-3{bottom:0;right:0}.mona-spinner-converge-4{bottom:0;left:0}@keyframes mona-spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes mona-spinner-converge{0%,to{transform:scale(1)}50%{transform:scale(.4)}}@media(prefers-reduced-motion:reduce){.mona-spinner-pulsing-segment,.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment,.mona-spinner-converge-container,.mona-spinner-converge-segment{animation:none!important}.mona-spinner-pulsing-segment{opacity:.6;transform:scale(.85)}.mona-spinner-pulsing-2{opacity:.3;transform:scale(.5)}.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment{opacity:.7;transform:scale(.8)}}@media(forced-colors:active){[data-segment]{background-color:CanvasText}}\n"], dependencies: [{ kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] }); }
|
|
95
|
-
}
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
97
|
-
type: Component,
|
|
98
|
-
args: [{ selector: "mona-spinner", imports: [LucideDynamicIcon], host: {
|
|
99
|
-
"[attr.aria-hidden]": "decorative() ? 'true' : null",
|
|
100
|
-
"[attr.aria-label]": "decorative() ? null : (ariaLabel() || messages().loading)",
|
|
101
|
-
"[attr.role]": "decorative() ? null : 'img'",
|
|
102
|
-
"[class]": "baseClass()"
|
|
103
|
-
}, template: "@switch (appearance()) {\n @case (\"default\") {\n <svg [lucideIcon]=\"loaderIcon\" [size]=\"pixelSize()\" class=\"size-full animate-[spin_1.5s_linear_infinite] motion-reduce:animate-none\"></svg>\n }\n @case (\"pulsing\") {\n <span class=\"mona-spinner-pulsing-container\">\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-segment mona-spinner-pulsing-2\"></span>\n </span>\n }\n @case (\"pulsing-triad\") {\n <span class=\"mona-spinner-pulsing-triad-container\">\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-triad-segment mona-spinner-pulsing-triad-3\"></span>\n </span>\n }\n @case (\"pulsing-ring\") {\n <span class=\"mona-spinner-pulsing-ring-container\">\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-1\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-2\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-3\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-4\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-5\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-6\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-7\"></span>\n <span data-segment class=\"mona-spinner-pulsing-ring-segment mona-spinner-pulsing-ring-8\"></span>\n </span>\n }\n @case (\"converging-spinner\") {\n <span class=\"mona-spinner-converge-container\">\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-1\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-2\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-3\"></span>\n <span data-segment class=\"mona-spinner-converge-segment mona-spinner-converge-4\"></span>\n </span>\n }\n}\n", styles: [":host{display:inline-flex;vertical-align:middle}.mona-spinner-pulsing-container{position:relative;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.mona-spinner-pulsing-segment{position:absolute;inset:0;border-radius:9999px;background-color:currentColor;opacity:.6;animation:mona-spinner-pulse 1.2s cubic-bezier(0,.2,.8,1) infinite}.mona-spinner-pulsing-2{animation-delay:-.6s}@keyframes mona-spinner-pulse{0%{transform:scale(.1);opacity:.9}50%{transform:scale(.6);opacity:.5}to{transform:scale(1);opacity:0}}.mona-spinner-pulsing-triad-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-triad-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.4s ease-in-out infinite}.mona-spinner-pulsing-triad-1{top:0;left:34%;animation-delay:-.933s}.mona-spinner-pulsing-triad-2{bottom:0;left:0;animation-delay:-.467s}.mona-spinner-pulsing-triad-3{bottom:0;right:0;animation-delay:0s}@keyframes mona-spinner-dot-pulse{0%,to{transform:scale(.4);opacity:.4}50%{transform:scale(1);opacity:1}}.mona-spinner-pulsing-ring-container{position:relative;width:100%;height:100%}.mona-spinner-pulsing-ring-segment{position:absolute;width:22%;height:22%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-dot-pulse 1.6s ease-in-out infinite}.mona-spinner-pulsing-ring-1{top:5%;left:39%;animation-delay:0s}.mona-spinner-pulsing-ring-2{top:14.96%;left:63.04%;animation-delay:-.2s}.mona-spinner-pulsing-ring-3{top:39%;left:73%;animation-delay:-.4s}.mona-spinner-pulsing-ring-4{top:63.04%;left:63.04%;animation-delay:-.6s}.mona-spinner-pulsing-ring-5{top:73%;left:39%;animation-delay:-.8s}.mona-spinner-pulsing-ring-6{top:63.04%;left:14.96%;animation-delay:-1s}.mona-spinner-pulsing-ring-7{top:39%;left:5%;animation-delay:-1.2s}.mona-spinner-pulsing-ring-8{top:14.96%;left:14.96%;animation-delay:-1.4s}.mona-spinner-converge-container{position:relative;width:100%;height:100%;animation:mona-spinner-rotate 1.5s linear infinite}.mona-spinner-converge-segment{position:absolute;width:32%;height:32%;border-radius:9999px;background-color:currentColor;animation:mona-spinner-converge 1.5s ease-in-out infinite}.mona-spinner-converge-1{top:0;left:0}.mona-spinner-converge-2{top:0;right:0}.mona-spinner-converge-3{bottom:0;right:0}.mona-spinner-converge-4{bottom:0;left:0}@keyframes mona-spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes mona-spinner-converge{0%,to{transform:scale(1)}50%{transform:scale(.4)}}@media(prefers-reduced-motion:reduce){.mona-spinner-pulsing-segment,.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment,.mona-spinner-converge-container,.mona-spinner-converge-segment{animation:none!important}.mona-spinner-pulsing-segment{opacity:.6;transform:scale(.85)}.mona-spinner-pulsing-2{opacity:.3;transform:scale(.5)}.mona-spinner-pulsing-triad-segment,.mona-spinner-pulsing-ring-segment{opacity:.7;transform:scale(.8)}}@media(forced-colors:active){[data-segment]{background-color:CanvasText}}\n"] }]
|
|
104
|
-
}], propDecorators: { appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], decorative: [{ type: i0.Input, args: [{ isSignal: true, alias: "decorative", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
105
|
-
|
|
106
191
|
const spinnerOverlayThemeVariants = cva(`
|
|
107
192
|
isolate flex items-center justify-center
|
|
108
193
|
pointer-events-auto select-none
|
|
109
194
|
bg-background/60 backdrop-blur-xs
|
|
110
195
|
text-foreground
|
|
111
196
|
`, {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
},
|
|
118
|
-
defaultVariants: {
|
|
119
|
-
fullPage: false
|
|
120
|
-
}
|
|
197
|
+
variants: { fullPage: {
|
|
198
|
+
true: "fixed inset-0",
|
|
199
|
+
false: "absolute inset-0"
|
|
200
|
+
} },
|
|
201
|
+
defaultVariants: { fullPage: false }
|
|
121
202
|
});
|
|
122
|
-
|
|
123
|
-
/** Sits above `.cdk-overlay-container`, so a spinner started from a dialog isn't under that dialog. */
|
|
124
203
|
const FULL_PAGE_Z_INDEX = 1001;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
class
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SpinnerService, decorators: [{
|
|
671
|
-
type: Injectable,
|
|
672
|
-
args: [{
|
|
673
|
-
providedIn: "root"
|
|
674
|
-
}]
|
|
675
|
-
}] });
|
|
676
|
-
|
|
677
|
-
/*
|
|
678
|
-
* Public API Surface of @nanahoshi/mona-ui/spinner
|
|
679
|
-
*/
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* Generated bundle index. Do not edit.
|
|
683
|
-
*/
|
|
684
|
-
|
|
204
|
+
var SpinnerOverlayComponent = class SpinnerOverlayComponent {
|
|
205
|
+
constructor() {
|
|
206
|
+
this.#hostElementRef = inject(ElementRef);
|
|
207
|
+
this.#i18n = inject(MonaI18nService);
|
|
208
|
+
this.#focusOrigin = null;
|
|
209
|
+
this.baseClass = computed(() => {
|
|
210
|
+
return spinnerOverlayThemeVariants({ fullPage: this.fullPage() });
|
|
211
|
+
}, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
|
|
212
|
+
this.effectiveCancelText = computed(() => {
|
|
213
|
+
return this.cancelText() ?? this.messages().cancel;
|
|
214
|
+
}, ...ngDevMode ? [{ debugName: "effectiveCancelText" }] : /* istanbul ignore next */ []);
|
|
215
|
+
this.effectiveZIndex = computed(() => {
|
|
216
|
+
const customZIndex = this.zIndex();
|
|
217
|
+
if (customZIndex !== void 0) return customZIndex;
|
|
218
|
+
return this.fullPage() ? FULL_PAGE_Z_INDEX : 1;
|
|
219
|
+
}, ...ngDevMode ? [{ debugName: "effectiveZIndex" }] : /* istanbul ignore next */ []);
|
|
220
|
+
this.messages = this.#i18n.componentMessages("spinner", SPINNER_DEFAULT_MESSAGES);
|
|
221
|
+
this.appearance = input("default", ...ngDevMode ? [{ debugName: "appearance" }] : /* istanbul ignore next */ []);
|
|
222
|
+
this.cancel = output();
|
|
223
|
+
this.cancelText = input(void 0, ...ngDevMode ? [{ debugName: "cancelText" }] : /* istanbul ignore next */ []);
|
|
224
|
+
this.cancellable = input(false, ...ngDevMode ? [{ debugName: "cancellable" }] : /* istanbul ignore next */ []);
|
|
225
|
+
this.fullPage = input(false, ...ngDevMode ? [{ debugName: "fullPage" }] : /* istanbul ignore next */ []);
|
|
226
|
+
this.size = input("medium", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
227
|
+
this.text = input(void 0, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
228
|
+
this.zIndex = input(void 0, ...ngDevMode ? [{ debugName: "zIndex" }] : /* istanbul ignore next */ []);
|
|
229
|
+
}
|
|
230
|
+
#hostElementRef;
|
|
231
|
+
#i18n;
|
|
232
|
+
#focusOrigin;
|
|
233
|
+
returnFocus() {
|
|
234
|
+
const host = this.#hostElementRef.nativeElement;
|
|
235
|
+
if (host.contains(host.ownerDocument.activeElement)) this.#focusOrigin?.focus({ preventScroll: true });
|
|
236
|
+
}
|
|
237
|
+
onCancel() {
|
|
238
|
+
this.cancel.emit();
|
|
239
|
+
}
|
|
240
|
+
onFocusIn(event) {
|
|
241
|
+
const origin = event.relatedTarget;
|
|
242
|
+
if (origin && !this.#hostElementRef.nativeElement.contains(origin)) this.#focusOrigin = origin;
|
|
243
|
+
}
|
|
244
|
+
static {
|
|
245
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
246
|
+
minVersion: "12.0.0",
|
|
247
|
+
version: "22.2.6",
|
|
248
|
+
ngImport: i0,
|
|
249
|
+
type: SpinnerOverlayComponent,
|
|
250
|
+
deps: [],
|
|
251
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
static {
|
|
255
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
256
|
+
minVersion: "17.0.0",
|
|
257
|
+
version: "22.2.6",
|
|
258
|
+
type: SpinnerOverlayComponent,
|
|
259
|
+
isStandalone: true,
|
|
260
|
+
selector: "mona-spinner-overlay",
|
|
261
|
+
inputs: {
|
|
262
|
+
appearance: {
|
|
263
|
+
classPropertyName: "appearance",
|
|
264
|
+
publicName: "appearance",
|
|
265
|
+
isSignal: true,
|
|
266
|
+
isRequired: false,
|
|
267
|
+
transformFunction: null
|
|
268
|
+
},
|
|
269
|
+
cancelText: {
|
|
270
|
+
classPropertyName: "cancelText",
|
|
271
|
+
publicName: "cancelText",
|
|
272
|
+
isSignal: true,
|
|
273
|
+
isRequired: false,
|
|
274
|
+
transformFunction: null
|
|
275
|
+
},
|
|
276
|
+
cancellable: {
|
|
277
|
+
classPropertyName: "cancellable",
|
|
278
|
+
publicName: "cancellable",
|
|
279
|
+
isSignal: true,
|
|
280
|
+
isRequired: false,
|
|
281
|
+
transformFunction: null
|
|
282
|
+
},
|
|
283
|
+
fullPage: {
|
|
284
|
+
classPropertyName: "fullPage",
|
|
285
|
+
publicName: "fullPage",
|
|
286
|
+
isSignal: true,
|
|
287
|
+
isRequired: false,
|
|
288
|
+
transformFunction: null
|
|
289
|
+
},
|
|
290
|
+
size: {
|
|
291
|
+
classPropertyName: "size",
|
|
292
|
+
publicName: "size",
|
|
293
|
+
isSignal: true,
|
|
294
|
+
isRequired: false,
|
|
295
|
+
transformFunction: null
|
|
296
|
+
},
|
|
297
|
+
text: {
|
|
298
|
+
classPropertyName: "text",
|
|
299
|
+
publicName: "text",
|
|
300
|
+
isSignal: true,
|
|
301
|
+
isRequired: false,
|
|
302
|
+
transformFunction: null
|
|
303
|
+
},
|
|
304
|
+
zIndex: {
|
|
305
|
+
classPropertyName: "zIndex",
|
|
306
|
+
publicName: "zIndex",
|
|
307
|
+
isSignal: true,
|
|
308
|
+
isRequired: false,
|
|
309
|
+
transformFunction: null
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
outputs: { cancel: "cancel" },
|
|
313
|
+
host: {
|
|
314
|
+
listeners: { "focusin": "onFocusIn($event)" },
|
|
315
|
+
properties: {
|
|
316
|
+
"class": "baseClass()",
|
|
317
|
+
"style.z-index": "effectiveZIndex()"
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
ngImport: i0,
|
|
321
|
+
template: "<div class=\"flex flex-col items-center justify-center gap-2.5 p-4 text-sm font-medium text-foreground text-center\">\n <mona-spinner [appearance]=\"appearance()\" [size]=\"size()\" [decorative]=\"true\"></mona-spinner>\n\n @if (text()) {\n <span class=\"max-w-xs wrap-anywhere\">{{ text() }}</span>\n } @else {\n <span class=\"sr-only\">{{ messages().loading }}</span>\n }\n\n @if (cancellable()) {\n <button\n type=\"button\"\n (click)=\"onCancel()\"\n class=\"mt-1 inline-flex items-center justify-center rounded-md border border-border bg-background px-2.5 py-1 text-xs font-medium text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator cursor-pointer transition-colors\"\n >\n {{ effectiveCancelText() }}\n </button>\n }\n</div>\n",
|
|
322
|
+
dependencies: [{
|
|
323
|
+
kind: "component",
|
|
324
|
+
type: SpinnerComponent,
|
|
325
|
+
selector: "mona-spinner",
|
|
326
|
+
inputs: [
|
|
327
|
+
"appearance",
|
|
328
|
+
"aria-label",
|
|
329
|
+
"decorative",
|
|
330
|
+
"size",
|
|
331
|
+
"class"
|
|
332
|
+
]
|
|
333
|
+
}]
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
338
|
+
minVersion: "12.0.0",
|
|
339
|
+
version: "22.2.6",
|
|
340
|
+
ngImport: i0,
|
|
341
|
+
type: SpinnerOverlayComponent,
|
|
342
|
+
decorators: [{
|
|
343
|
+
type: Component,
|
|
344
|
+
args: [{
|
|
345
|
+
selector: "mona-spinner-overlay",
|
|
346
|
+
imports: [SpinnerComponent],
|
|
347
|
+
host: {
|
|
348
|
+
"[class]": "baseClass()",
|
|
349
|
+
"[style.z-index]": "effectiveZIndex()",
|
|
350
|
+
"(focusin)": "onFocusIn($event)"
|
|
351
|
+
},
|
|
352
|
+
template: "<div class=\"flex flex-col items-center justify-center gap-2.5 p-4 text-sm font-medium text-foreground text-center\">\n <mona-spinner [appearance]=\"appearance()\" [size]=\"size()\" [decorative]=\"true\"></mona-spinner>\n\n @if (text()) {\n <span class=\"max-w-xs wrap-anywhere\">{{ text() }}</span>\n } @else {\n <span class=\"sr-only\">{{ messages().loading }}</span>\n }\n\n @if (cancellable()) {\n <button\n type=\"button\"\n (click)=\"onCancel()\"\n class=\"mt-1 inline-flex items-center justify-center rounded-md border border-border bg-background px-2.5 py-1 text-xs font-medium text-foreground shadow-xs hover:bg-accent hover:text-accent-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator cursor-pointer transition-colors\"\n >\n {{ effectiveCancelText() }}\n </button>\n }\n</div>\n"
|
|
353
|
+
}]
|
|
354
|
+
}],
|
|
355
|
+
propDecorators: {
|
|
356
|
+
appearance: [{
|
|
357
|
+
type: i0.Input,
|
|
358
|
+
args: [{
|
|
359
|
+
isSignal: true,
|
|
360
|
+
alias: "appearance",
|
|
361
|
+
required: false
|
|
362
|
+
}]
|
|
363
|
+
}],
|
|
364
|
+
cancel: [{
|
|
365
|
+
type: i0.Output,
|
|
366
|
+
args: ["cancel"]
|
|
367
|
+
}],
|
|
368
|
+
cancelText: [{
|
|
369
|
+
type: i0.Input,
|
|
370
|
+
args: [{
|
|
371
|
+
isSignal: true,
|
|
372
|
+
alias: "cancelText",
|
|
373
|
+
required: false
|
|
374
|
+
}]
|
|
375
|
+
}],
|
|
376
|
+
cancellable: [{
|
|
377
|
+
type: i0.Input,
|
|
378
|
+
args: [{
|
|
379
|
+
isSignal: true,
|
|
380
|
+
alias: "cancellable",
|
|
381
|
+
required: false
|
|
382
|
+
}]
|
|
383
|
+
}],
|
|
384
|
+
fullPage: [{
|
|
385
|
+
type: i0.Input,
|
|
386
|
+
args: [{
|
|
387
|
+
isSignal: true,
|
|
388
|
+
alias: "fullPage",
|
|
389
|
+
required: false
|
|
390
|
+
}]
|
|
391
|
+
}],
|
|
392
|
+
size: [{
|
|
393
|
+
type: i0.Input,
|
|
394
|
+
args: [{
|
|
395
|
+
isSignal: true,
|
|
396
|
+
alias: "size",
|
|
397
|
+
required: false
|
|
398
|
+
}]
|
|
399
|
+
}],
|
|
400
|
+
text: [{
|
|
401
|
+
type: i0.Input,
|
|
402
|
+
args: [{
|
|
403
|
+
isSignal: true,
|
|
404
|
+
alias: "text",
|
|
405
|
+
required: false
|
|
406
|
+
}]
|
|
407
|
+
}],
|
|
408
|
+
zIndex: [{
|
|
409
|
+
type: i0.Input,
|
|
410
|
+
args: [{
|
|
411
|
+
isSignal: true,
|
|
412
|
+
alias: "zIndex",
|
|
413
|
+
required: false
|
|
414
|
+
}]
|
|
415
|
+
}]
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
const ANNOUNCE_INTERVAL = 5e3;
|
|
419
|
+
var SpinnerService = class SpinnerService {
|
|
420
|
+
#appRef = inject(ApplicationRef);
|
|
421
|
+
#document = inject(DOCUMENT);
|
|
422
|
+
#i18n = inject(MonaI18nService);
|
|
423
|
+
#injector = inject(Injector);
|
|
424
|
+
#liveAnnouncer = inject(LiveAnnouncer);
|
|
425
|
+
#messages = this.#i18n.componentMessages("spinner", SPINNER_DEFAULT_MESSAGES);
|
|
426
|
+
#renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
427
|
+
#requests = /* @__PURE__ */ new Map();
|
|
428
|
+
#targetStates = /* @__PURE__ */ new Set();
|
|
429
|
+
#targets = /* @__PURE__ */ new WeakMap();
|
|
430
|
+
hide(refOrId) {
|
|
431
|
+
const id = typeof refOrId === "string" ? refOrId : refOrId.id;
|
|
432
|
+
this.#closeRequest(id);
|
|
433
|
+
}
|
|
434
|
+
ngOnDestroy() {
|
|
435
|
+
for (const request of this.#requests.values()) {
|
|
436
|
+
this.#clearRequestTimers(request);
|
|
437
|
+
if (!request.cancellationHandled) request.cancelledSubject.complete();
|
|
438
|
+
}
|
|
439
|
+
this.#requests.clear();
|
|
440
|
+
for (const targetState of [...this.#targetStates]) this.#teardownTarget(targetState);
|
|
441
|
+
}
|
|
442
|
+
show(options) {
|
|
443
|
+
const id = options?.id ?? `spinner-${v4()}`;
|
|
444
|
+
if (this.#requests.has(id)) this.#closeRequest(id);
|
|
445
|
+
const resolvedTargets = options && "target" in options ? this.#normalizeTargets(options.target) : [this.#document.body];
|
|
446
|
+
const cancellableOpt = options?.cancellable;
|
|
447
|
+
const isCancellable = !!cancellableOpt;
|
|
448
|
+
const cancelText = typeof cancellableOpt === "object" && cancellableOpt.text ? cancellableOpt.text : void 0;
|
|
449
|
+
const onCancel = typeof cancellableOpt === "object" ? cancellableOpt.onCancel : void 0;
|
|
450
|
+
const cancelledSubject = new Subject();
|
|
451
|
+
const request = {
|
|
452
|
+
activatedAt: Date.now(),
|
|
453
|
+
announceTimer: null,
|
|
454
|
+
announcedAt: null,
|
|
455
|
+
announcedText: null,
|
|
456
|
+
appearance: options?.appearance ?? "default",
|
|
457
|
+
cancellationHandled: false,
|
|
458
|
+
cancellable: isCancellable,
|
|
459
|
+
cancelText,
|
|
460
|
+
delayTimer: null,
|
|
461
|
+
id,
|
|
462
|
+
onCancel,
|
|
463
|
+
options: options ?? {},
|
|
464
|
+
registeredAt: Date.now(),
|
|
465
|
+
size: options?.size ?? "medium",
|
|
466
|
+
status: "PENDING",
|
|
467
|
+
cancelledSubject,
|
|
468
|
+
targets: resolvedTargets,
|
|
469
|
+
text: options?.text
|
|
470
|
+
};
|
|
471
|
+
this.#requests.set(id, request);
|
|
472
|
+
const immediateTargets = [];
|
|
473
|
+
const delayedTargets = [];
|
|
474
|
+
for (const target of resolvedTargets) {
|
|
475
|
+
const targetState = this.#getOrCreateTargetState(target);
|
|
476
|
+
targetState.pendingRequestIds.add(id);
|
|
477
|
+
if (targetState.componentRef != null) immediateTargets.push(target);
|
|
478
|
+
else delayedTargets.push(target);
|
|
479
|
+
}
|
|
480
|
+
if (immediateTargets.length > 0) this.#activateRequestOnTargets(request, immediateTargets);
|
|
481
|
+
const delay = options?.delay ?? 0;
|
|
482
|
+
if (delayedTargets.length > 0) {
|
|
483
|
+
if (delay > 0) request.delayTimer = setTimeout(() => {
|
|
484
|
+
request.delayTimer = null;
|
|
485
|
+
if (request.status !== "CLOSED") this.#activateRequestOnTargets(request, delayedTargets);
|
|
486
|
+
}, delay);
|
|
487
|
+
else this.#activateRequestOnTargets(request, delayedTargets);
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
id,
|
|
491
|
+
cancelled$: cancelledSubject.asObservable(),
|
|
492
|
+
close: () => this.#closeRequest(id),
|
|
493
|
+
update: (update) => this.#updateRequest(id, update)
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
track(source, options) {
|
|
497
|
+
return defer(() => {
|
|
498
|
+
const ref = this.show(options);
|
|
499
|
+
return source.pipe(takeUntil(ref.cancelled$), finalize(() => ref.close()));
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
#activateRequestOnTargets(request, targets) {
|
|
503
|
+
if (request.status === "CLOSED") return;
|
|
504
|
+
request.status = "VISIBLE";
|
|
505
|
+
request.activatedAt = Date.now();
|
|
506
|
+
for (const target of targets) {
|
|
507
|
+
const targetState = this.#getOrCreateTargetState(target);
|
|
508
|
+
targetState.activeRequestIds.add(request.id);
|
|
509
|
+
targetState.minimumVisibleDuration = Math.max(targetState.minimumVisibleDuration, request.options.minimumVisibleDuration ?? 0);
|
|
510
|
+
this.#updateTargetOverlay(targetState);
|
|
511
|
+
}
|
|
512
|
+
if (request.announcedAt === null) this.#announce(request);
|
|
513
|
+
}
|
|
514
|
+
#announce(request) {
|
|
515
|
+
const text = request.text || this.#messages().loading;
|
|
516
|
+
if (text !== request.announcedText) {
|
|
517
|
+
request.announcedAt = Date.now();
|
|
518
|
+
request.announcedText = text;
|
|
519
|
+
this.#liveAnnouncer.announce(text, "polite");
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
#announceUpdate(request) {
|
|
523
|
+
if (request.announcedAt === null || request.announceTimer != null) return;
|
|
524
|
+
const wait = request.announcedAt + ANNOUNCE_INTERVAL - Date.now();
|
|
525
|
+
if (wait <= 0) this.#announce(request);
|
|
526
|
+
else request.announceTimer = setTimeout(() => {
|
|
527
|
+
request.announceTimer = null;
|
|
528
|
+
this.#announce(request);
|
|
529
|
+
}, wait);
|
|
530
|
+
}
|
|
531
|
+
#cancelRequest(requestId) {
|
|
532
|
+
const request = this.#requests.get(requestId);
|
|
533
|
+
if (!request || request.cancellationHandled || request.status === "CLOSED") return;
|
|
534
|
+
request.cancellationHandled = true;
|
|
535
|
+
request.cancelledSubject.next();
|
|
536
|
+
request.cancelledSubject.complete();
|
|
537
|
+
try {
|
|
538
|
+
if (request.onCancel) request.onCancel();
|
|
539
|
+
} finally {
|
|
540
|
+
this.#closeRequest(requestId);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
#clearRequestTimers(request) {
|
|
544
|
+
if (request.delayTimer != null) {
|
|
545
|
+
clearTimeout(request.delayTimer);
|
|
546
|
+
request.delayTimer = null;
|
|
547
|
+
}
|
|
548
|
+
if (request.announceTimer != null) {
|
|
549
|
+
clearTimeout(request.announceTimer);
|
|
550
|
+
request.announceTimer = null;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
#closeRequest(requestId) {
|
|
554
|
+
const request = this.#requests.get(requestId);
|
|
555
|
+
if (!request || request.status === "CLOSED") return;
|
|
556
|
+
request.status = "CLOSED";
|
|
557
|
+
this.#clearRequestTimers(request);
|
|
558
|
+
if (!request.cancellationHandled) request.cancelledSubject.complete();
|
|
559
|
+
this.#requests.delete(requestId);
|
|
560
|
+
for (const target of request.targets) {
|
|
561
|
+
const targetState = this.#targets.get(target);
|
|
562
|
+
if (!targetState) continue;
|
|
563
|
+
targetState.pendingRequestIds.delete(requestId);
|
|
564
|
+
targetState.activeRequestIds.delete(requestId);
|
|
565
|
+
if (targetState.activeRequestIds.size > 0) this.#updateTargetOverlay(targetState);
|
|
566
|
+
else if (targetState.pendingRequestIds.size === 0) {
|
|
567
|
+
const minDuration = targetState.minimumVisibleDuration;
|
|
568
|
+
if (minDuration > 0 && targetState.visibleSince != null && targetState.componentRef != null) {
|
|
569
|
+
const remaining = minDuration - (Date.now() - targetState.visibleSince);
|
|
570
|
+
if (remaining > 0) {
|
|
571
|
+
if (targetState.minDurationTimer != null) clearTimeout(targetState.minDurationTimer);
|
|
572
|
+
targetState.componentRef.instance.returnFocus();
|
|
573
|
+
targetState.componentRef.setInput("cancellable", false);
|
|
574
|
+
targetState.componentRef.changeDetectorRef.detectChanges();
|
|
575
|
+
targetState.minDurationTimer = setTimeout(() => {
|
|
576
|
+
targetState.minDurationTimer = null;
|
|
577
|
+
if (targetState.activeRequestIds.size === 0 && targetState.pendingRequestIds.size === 0) this.#teardownTarget(targetState);
|
|
578
|
+
}, remaining);
|
|
579
|
+
} else this.#teardownTarget(targetState);
|
|
580
|
+
} else this.#teardownTarget(targetState);
|
|
581
|
+
} else if (targetState.componentRef != null) for (const pendingId of targetState.pendingRequestIds) {
|
|
582
|
+
const pending = this.#requests.get(pendingId);
|
|
583
|
+
if (pending) this.#activateRequestOnTargets(pending, [target]);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
#getOrCreateTargetState(target) {
|
|
588
|
+
const isFullPage = target === this.#document.body;
|
|
589
|
+
let state = this.#targets.get(target);
|
|
590
|
+
if (!state) {
|
|
591
|
+
const originalAriaBusy = target.getAttribute("aria-busy");
|
|
592
|
+
const originalInlinePosition = target.style.position;
|
|
593
|
+
state = {
|
|
594
|
+
activeRequestIds: /* @__PURE__ */ new Set(),
|
|
595
|
+
cancelSubscription: null,
|
|
596
|
+
changedPosition: false,
|
|
597
|
+
componentRef: null,
|
|
598
|
+
isFullPage,
|
|
599
|
+
minDurationTimer: null,
|
|
600
|
+
minimumVisibleDuration: 0,
|
|
601
|
+
originalAriaBusy,
|
|
602
|
+
originalInlinePosition,
|
|
603
|
+
pendingRequestIds: /* @__PURE__ */ new Set(),
|
|
604
|
+
target
|
|
605
|
+
};
|
|
606
|
+
this.#targets.set(target, state);
|
|
607
|
+
this.#targetStates.add(state);
|
|
608
|
+
}
|
|
609
|
+
if (!isFullPage) this.#renderer.setAttribute(target, "aria-busy", "true");
|
|
610
|
+
if (state.minDurationTimer != null) {
|
|
611
|
+
clearTimeout(state.minDurationTimer);
|
|
612
|
+
state.minDurationTimer = null;
|
|
613
|
+
}
|
|
614
|
+
return state;
|
|
615
|
+
}
|
|
616
|
+
#getWinningRequestForTarget(targetState) {
|
|
617
|
+
let winningRequest = null;
|
|
618
|
+
for (const requestId of targetState.activeRequestIds) {
|
|
619
|
+
const req = this.#requests.get(requestId);
|
|
620
|
+
if (req && req.status === "VISIBLE") {
|
|
621
|
+
if (!winningRequest || req.activatedAt >= winningRequest.activatedAt) winningRequest = req;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
return winningRequest;
|
|
625
|
+
}
|
|
626
|
+
#normalizeTargets(target) {
|
|
627
|
+
const rawList = Array.isArray(target) ? target : [target];
|
|
628
|
+
const result = [];
|
|
629
|
+
for (const item of rawList) {
|
|
630
|
+
const element = this.#toElement(item);
|
|
631
|
+
if (element) result.push(element);
|
|
632
|
+
}
|
|
633
|
+
if (isDevMode() && (result.length === 0 || result.length !== rawList.length)) console.error("SpinnerService: a target didn't resolve to an element, so no overlay shows on it. Leave target out for a full-page spinner.");
|
|
634
|
+
return result;
|
|
635
|
+
}
|
|
636
|
+
#teardownTarget(targetState) {
|
|
637
|
+
if (targetState.minDurationTimer != null) {
|
|
638
|
+
clearTimeout(targetState.minDurationTimer);
|
|
639
|
+
targetState.minDurationTimer = null;
|
|
640
|
+
}
|
|
641
|
+
targetState.cancelSubscription?.unsubscribe();
|
|
642
|
+
targetState.cancelSubscription = null;
|
|
643
|
+
if (targetState.componentRef != null) {
|
|
644
|
+
targetState.componentRef.instance.returnFocus();
|
|
645
|
+
this.#appRef.detachView(targetState.componentRef.hostView);
|
|
646
|
+
targetState.componentRef.destroy();
|
|
647
|
+
targetState.componentRef = null;
|
|
648
|
+
}
|
|
649
|
+
this.#targets.delete(targetState.target);
|
|
650
|
+
this.#targetStates.delete(targetState);
|
|
651
|
+
if (!targetState.isFullPage) {
|
|
652
|
+
if (targetState.originalAriaBusy === null) this.#renderer.removeAttribute(targetState.target, "aria-busy");
|
|
653
|
+
else this.#renderer.setAttribute(targetState.target, "aria-busy", targetState.originalAriaBusy);
|
|
654
|
+
}
|
|
655
|
+
if (targetState.changedPosition) {
|
|
656
|
+
if (targetState.target.style.position === "relative") this.#renderer.setStyle(targetState.target, "position", targetState.originalInlinePosition || null);
|
|
657
|
+
targetState.changedPosition = false;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
#toElement(item) {
|
|
661
|
+
const isElement = (value) => value?.nodeType === 1;
|
|
662
|
+
if (isElement(item)) return item;
|
|
663
|
+
const nativeElement = item?.nativeElement;
|
|
664
|
+
return isElement(nativeElement) ? nativeElement : null;
|
|
665
|
+
}
|
|
666
|
+
#updateRequest(requestId, update) {
|
|
667
|
+
const request = this.#requests.get(requestId);
|
|
668
|
+
if (!request || request.status === "CLOSED") return;
|
|
669
|
+
if (update.appearance !== void 0) request.appearance = update.appearance;
|
|
670
|
+
if (update.size !== void 0) request.size = update.size;
|
|
671
|
+
if (update.text !== void 0) request.text = update.text;
|
|
672
|
+
for (const target of request.targets) {
|
|
673
|
+
const targetState = this.#targets.get(target);
|
|
674
|
+
if (targetState) this.#updateTargetOverlay(targetState);
|
|
675
|
+
}
|
|
676
|
+
if (update.text !== void 0) this.#announceUpdate(request);
|
|
677
|
+
}
|
|
678
|
+
#updateOverlayInputs(componentRef, winner, targetState) {
|
|
679
|
+
componentRef.setInput("appearance", winner.appearance);
|
|
680
|
+
componentRef.setInput("size", winner.size);
|
|
681
|
+
componentRef.setInput("text", winner.text);
|
|
682
|
+
componentRef.setInput("cancellable", winner.cancellable);
|
|
683
|
+
componentRef.setInput("cancelText", winner.cancelText);
|
|
684
|
+
componentRef.setInput("fullPage", targetState.isFullPage);
|
|
685
|
+
componentRef.setInput("zIndex", winner.options.zIndex);
|
|
686
|
+
}
|
|
687
|
+
#updateTargetOverlay(targetState) {
|
|
688
|
+
const winner = this.#getWinningRequestForTarget(targetState);
|
|
689
|
+
if (!winner) return;
|
|
690
|
+
if (!targetState.componentRef) {
|
|
691
|
+
if (!targetState.isFullPage) {
|
|
692
|
+
const defaultView = this.#document.defaultView;
|
|
693
|
+
if ((defaultView ? defaultView.getComputedStyle(targetState.target).position : "static") === "static") {
|
|
694
|
+
this.#renderer.setStyle(targetState.target, "position", "relative");
|
|
695
|
+
targetState.changedPosition = true;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const compRef = createComponent(SpinnerOverlayComponent, {
|
|
699
|
+
environmentInjector: this.#appRef.injector,
|
|
700
|
+
elementInjector: this.#injector
|
|
701
|
+
});
|
|
702
|
+
this.#updateOverlayInputs(compRef, winner, targetState);
|
|
703
|
+
targetState.cancelSubscription = compRef.instance.cancel.subscribe(() => {
|
|
704
|
+
const currentWinner = this.#getWinningRequestForTarget(targetState);
|
|
705
|
+
if (currentWinner) this.#cancelRequest(currentWinner.id);
|
|
706
|
+
});
|
|
707
|
+
this.#appRef.attachView(compRef.hostView);
|
|
708
|
+
this.#renderer.appendChild(targetState.target, compRef.location.nativeElement);
|
|
709
|
+
compRef.changeDetectorRef.detectChanges();
|
|
710
|
+
targetState.componentRef = compRef;
|
|
711
|
+
targetState.visibleSince = Date.now();
|
|
712
|
+
} else {
|
|
713
|
+
const compRef = targetState.componentRef;
|
|
714
|
+
if (!winner.cancellable) compRef.instance.returnFocus();
|
|
715
|
+
this.#updateOverlayInputs(compRef, winner, targetState);
|
|
716
|
+
compRef.changeDetectorRef.detectChanges();
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
static {
|
|
720
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
721
|
+
minVersion: "12.0.0",
|
|
722
|
+
version: "22.2.6",
|
|
723
|
+
ngImport: i0,
|
|
724
|
+
type: SpinnerService,
|
|
725
|
+
deps: [],
|
|
726
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
static {
|
|
730
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
731
|
+
minVersion: "12.0.0",
|
|
732
|
+
version: "22.2.6",
|
|
733
|
+
ngImport: i0,
|
|
734
|
+
type: SpinnerService,
|
|
735
|
+
providedIn: "root"
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
740
|
+
minVersion: "12.0.0",
|
|
741
|
+
version: "22.2.6",
|
|
742
|
+
ngImport: i0,
|
|
743
|
+
type: SpinnerService,
|
|
744
|
+
decorators: [{
|
|
745
|
+
type: Injectable,
|
|
746
|
+
args: [{ providedIn: "root" }]
|
|
747
|
+
}]
|
|
748
|
+
});
|
|
685
749
|
export { SPINNER_DEFAULT_MESSAGES, SpinnerComponent, SpinnerService };
|
|
686
|
-
|
|
750
|
+
|
|
751
|
+
//# sourceMappingURL=nanahoshi-mona-ui-spinner.mjs.map
|