@nanahoshi/mona-ui 0.27.2 → 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.
Files changed (208) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/popup.md +1 -1
  3. package/docs/api/theme.md +2 -2
  4. package/docs/chart.md +14 -0
  5. package/docs/editor.md +2 -0
  6. package/docs/installation.md +147 -15
  7. package/docs/introduction.md +37 -15
  8. package/docs/theming-built-in-themes.md +67 -0
  9. package/docs/theming-custom-colors.md +274 -0
  10. package/docs/theming-custom-themes.md +168 -0
  11. package/docs/theming.md +164 -248
  12. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  13. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  14. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  15. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  16. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  17. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  18. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  19. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  20. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  21. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  22. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  23. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  24. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  25. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  26. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  27. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  28. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  29. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  30. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  31. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  32. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  33. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  34. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  35. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  37. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  38. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  39. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  40. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  41. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  42. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  49. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  50. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  51. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  52. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  53. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  54. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  55. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  56. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  57. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  58. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  59. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  60. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  61. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  62. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  63. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  65. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  66. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  67. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  68. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  70. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  71. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  72. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  73. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  74. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  75. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  76. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  77. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  78. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  79. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  80. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  81. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  82. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  83. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  84. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  85. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  86. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  87. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  88. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  89. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  90. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  91. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  92. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  93. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  94. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  95. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  96. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  97. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  98. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  99. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  100. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  101. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  102. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  103. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  104. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  105. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  106. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  107. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  108. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  109. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  110. package/llms.txt +6 -2
  111. package/package.json +62 -23
  112. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  113. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  114. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  115. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  116. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  117. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  118. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  119. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  120. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  121. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  122. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  123. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  124. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  125. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  126. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  127. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  128. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  129. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  130. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  131. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  132. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  133. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  134. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  135. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  136. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  137. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  138. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  139. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  140. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  141. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  142. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  143. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  144. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  145. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  146. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  147. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  148. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  149. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  150. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  151. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  152. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  153. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  154. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  155. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  156. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  157. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  158. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  159. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  168. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  169. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  170. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  171. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  172. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  173. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  174. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  175. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  176. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  177. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  178. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  179. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  180. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  181. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  182. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  183. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  184. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  185. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  186. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  187. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  188. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  189. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  190. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  191. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  192. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  193. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  194. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  195. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  196. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  197. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  198. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  199. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  200. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  201. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  202. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  203. package/types/nanahoshi-mona-ui.d.ts +1 -2
  204. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  205. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  206. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  207. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  208. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,47 +1,39 @@
1
- import * as i1 from '@angular/cdk/a11y';
2
- import { LiveAnnouncer, A11yModule } from '@angular/cdk/a11y';
3
- import * as i0 from '@angular/core';
4
- import { signal, inject, computed, input, output, booleanAttribute, model, effect, untracked, afterRenderEffect, Component, Directive, Injector, Renderer2, contentChild, TemplateRef, viewChild, DestroyRef, afterNextRender, ElementRef } from '@angular/core';
5
- import { ImmutableSet } from '@mirei/ts-collections';
6
- import { formatNumber, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
7
- import { createElementControlId, positionGlobalOverlay, inertOutside } from '@nanahoshi/mona-ui/internal';
8
- import { cva } from 'class-variance-authority';
9
- import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
10
- import { PopupService } from '@nanahoshi/mona-ui/popup';
11
- import { merge, take } from 'rxjs';
12
- import { LucideSearch } from '@lucide/angular';
13
-
14
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
15
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
1
+ import * as i1 from "@angular/cdk/a11y";
2
+ import { A11yModule, LiveAnnouncer } from "@angular/cdk/a11y";
3
+ import * as i0 from "@angular/core";
4
+ import { Component, DestroyRef, Directive, ElementRef, Injector, Renderer2, TemplateRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, effect, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
5
+ import { ImmutableSet } from "@mirei/ts-collections";
6
+ import { MonaI18nService, formatNumber } from "@nanahoshi/mona-ui/i18n";
7
+ import { createElementControlId, inertOutside, positionGlobalOverlay } from "@nanahoshi/mona-ui/internal";
8
+ import { cva } from "class-variance-authority";
9
+ import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
10
+ import { PopupService } from "@nanahoshi/mona-ui/popup";
11
+ import { merge, take } from "rxjs";
12
+ import { LucideSearch } from "@lucide/angular";
16
13
  function localizeNumber(value, options) {
17
- return formatNumber(value, "en-US", options);
14
+ return formatNumber(value, "en-US", options);
18
15
  }
19
16
  const COMMAND_DEFAULT_MESSAGES = {
20
- dialogLabel: "Command menu",
21
- inputLabel: "Search commands",
22
- listLabel: "Results",
23
- loading: "Loading",
24
- noResults: "No results found",
25
- placeholder: "Type a command or search…",
26
- resultsAvailable: (count) => count === 1 ? `${localizeNumber(count)} result available` : `${localizeNumber(count)} results available`
17
+ dialogLabel: "Command menu",
18
+ inputLabel: "Search commands",
19
+ listLabel: "Results",
20
+ loading: "Loading",
21
+ noResults: "No results found",
22
+ placeholder: "Type a command or search…",
23
+ resultsAvailable: (count) => count === 1 ? `${localizeNumber(count)} result available` : `${localizeNumber(count)} results available`
27
24
  };
28
-
29
25
  const commandBaseThemeVariants = cva(`
30
26
  flex max-h-[inherit] min-h-0 w-full flex-col overflow-hidden
31
27
  bg-[var(--mona-command-background,var(--color-surface))] text-foreground
32
28
  border border-border-subtle
33
29
  `, {
34
- variants: {
35
- rounded: {
36
- none: "rounded-none",
37
- small: "rounded-sm",
38
- medium: "rounded-md",
39
- large: "rounded-lg"
40
- }
41
- },
42
- defaultVariants: {
43
- rounded: "medium"
44
- }
30
+ variants: { rounded: {
31
+ none: "rounded-none",
32
+ small: "rounded-sm",
33
+ medium: "rounded-md",
34
+ large: "rounded-lg"
35
+ } },
36
+ defaultVariants: { rounded: "medium" }
45
37
  });
46
38
  const commandInputThemeVariants = cva(`
47
39
  flex shrink-0 items-center gap-2 border-b border-border-subtle px-3
@@ -83,842 +75,1451 @@ const commandDialogPanelThemeVariants = cva(`
83
75
  flex max-h-[inherit] min-h-0 w-full flex-col overflow-hidden rounded-md shadow-(--shadow-overlay)
84
76
  outline-none focus-visible:outline-hidden
85
77
  `);
86
-
87
78
  const MARKS = /\p{M}/gu;
88
- /** Lowers case and removes accents, so "cafe" finds "Café". */
89
79
  const fold = (text) => text.normalize("NFKD").replace(MARKS, "").toLowerCase();
90
80
  const tokenize = (query) => fold(query).split(/\s+/).filter(Boolean);
91
- /**
92
- * The default filter: an item stays when every word of the query appears in its value or keywords, ignoring case and
93
- * accents.
94
- */
95
81
  const defaultCommandFilter = (query, item) => {
96
- const text = fold([item.value, ...item.keywords].join("\n"));
97
- return tokenize(query).every(token => text.includes(token));
82
+ const text = fold([item.value, ...item.keywords].join("\n"));
83
+ return tokenize(query).every((token) => text.includes(token));
98
84
  };
99
- /**
100
- * Splits a text into the parts a query matches and the parts it doesn't. Folding can change a string's length, so
101
- * each folded character remembers where it came from, and a match always covers whole source characters.
102
- */
103
85
  const splitByQuery = (text, query) => {
104
- const tokens = tokenize(query);
105
- if (tokens.length === 0) {
106
- return [{ match: false, text }];
107
- }
108
- let folded = "";
109
- const starts = [];
110
- const ends = [];
111
- let offset = 0;
112
- for (const character of text) {
113
- const start = offset;
114
- offset += character.length;
115
- const piece = fold(character);
116
- if (piece.length === 0 && ends.length > 0) {
117
- // A combining mark belongs to the character before it.
118
- ends[ends.length - 1] = offset;
119
- }
120
- for (let index = 0; index < piece.length; index++) {
121
- starts.push(start);
122
- ends.push(offset);
123
- }
124
- folded += piece;
125
- }
126
- const matched = new Array(text.length).fill(false);
127
- for (const token of tokens) {
128
- let index = folded.indexOf(token);
129
- while (index !== -1) {
130
- matched.fill(true, starts[index], ends[index + token.length - 1]);
131
- index = folded.indexOf(token, index + token.length);
132
- }
133
- }
134
- const parts = [];
135
- let partStart = 0;
136
- for (let index = 1; index <= text.length; index++) {
137
- if (index === text.length || matched[index] !== matched[partStart]) {
138
- parts.push({ match: matched[partStart], text: text.slice(partStart, index) });
139
- partStart = index;
140
- }
141
- }
142
- return parts;
86
+ const tokens = tokenize(query);
87
+ if (tokens.length === 0) return [{
88
+ match: false,
89
+ text
90
+ }];
91
+ let folded = "";
92
+ const starts = [];
93
+ const ends = [];
94
+ let offset = 0;
95
+ for (const character of text) {
96
+ const start = offset;
97
+ offset += character.length;
98
+ const piece = fold(character);
99
+ if (piece.length === 0 && ends.length > 0) ends[ends.length - 1] = offset;
100
+ for (let index = 0; index < piece.length; index++) {
101
+ starts.push(start);
102
+ ends.push(offset);
103
+ }
104
+ folded += piece;
105
+ }
106
+ const matched = new Array(text.length).fill(false);
107
+ for (const token of tokens) {
108
+ let index = folded.indexOf(token);
109
+ while (index !== -1) {
110
+ matched.fill(true, starts[index], ends[index + token.length - 1]);
111
+ index = folded.indexOf(token, index + token.length);
112
+ }
113
+ }
114
+ const parts = [];
115
+ let partStart = 0;
116
+ for (let index = 1; index <= text.length; index++) if (index === text.length || matched[index] !== matched[partStart]) {
117
+ parts.push({
118
+ match: matched[partStart],
119
+ text: text.slice(partStart, index)
120
+ });
121
+ partStart = index;
122
+ }
123
+ return parts;
143
124
  };
144
-
145
- /**
146
- * A searchable list of actions or options, operated from one input. It works inline, in a popover, or in a
147
- * `mona-command-dialog`. It only runs what the consumer asks for: choosing an item emits an event, and nothing closes
148
- * or navigates by itself.
149
- */
150
- class CommandComponent {
151
- #activeItem;
152
- #i18n;
153
- #inputElement;
154
- #items;
155
- #liveAnnouncer;
156
- #visibleItems;
157
- constructor() {
158
- this.#activeItem = signal(null, /* @ts-ignore */
159
- ...(ngDevMode ? [{ debugName: "#activeItem" }] : /* istanbul ignore next */ []));
160
- this.#i18n = inject(MonaI18nService);
161
- this.#inputElement = signal(null, /* @ts-ignore */
162
- ...(ngDevMode ? [{ debugName: "#inputElement" }] : /* istanbul ignore next */ []));
163
- this.#items = signal(ImmutableSet.create(), /* @ts-ignore */
164
- ...(ngDevMode ? [{ debugName: "#items" }] : /* istanbul ignore next */ []));
165
- this.#liveAnnouncer = inject(LiveAnnouncer);
166
- this.#visibleItems = computed(() => this.#items()
167
- .where(item => item.visible())
168
- .toArray(), /* @ts-ignore */
169
- ...(ngDevMode ? [{ debugName: "#visibleItems" }] : /* istanbul ignore next */ []));
170
- this.baseClass = computed(() => commandBaseThemeVariants({ rounded: this.rounded() }), /* @ts-ignore */
171
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
172
- /**
173
- * The item Enter would choose.
174
- * @internal
175
- */
176
- this.activeItem = this.#activeItem.asReadonly();
177
- /**
178
- * @description What counts as a match while `filterMode` is `"auto"`.
179
- * @default defaultCommandFilter
180
- */
181
- this.filter = input(defaultCommandFilter, /* @ts-ignore */
182
- ...(ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []));
183
- /** @description Whether the component filters the items, or the consumer supplies only the matching ones. */
184
- this.filterMode = input("auto", /* @ts-ignore */
185
- ...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
186
- /**
187
- * Whether there's nothing to show for the current query.
188
- * @internal
189
- */
190
- this.isEmpty = computed(() => this.query().trim() !== "" && !this.loading() && this.resultCount() === 0, /* @ts-ignore */
191
- ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
192
- /** @description Emits when any item is chosen, with the pointer or with Enter. */
193
- this.itemSelect = output();
194
- /**
195
- * The id the input points at with `aria-controls`.
196
- * @internal
197
- */
198
- this.listId = createElementControlId();
199
- /** @description Whether results are on their way. Shows `mona-command-loading` and holds back the empty state. */
200
- this.loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
201
- /** @description Whether the arrow keys wrap around at the ends of the list. */
202
- this.loop = input(true, { ...(ngDevMode ? { debugName: "loop" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
203
- /** @internal */
204
- this.messages = this.#i18n.componentMessages("command", COMMAND_DEFAULT_MESSAGES);
205
- /** @description The text in the input. */
206
- this.query = model("", /* @ts-ignore */
207
- ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
208
- /**
209
- * How many items are showing.
210
- * @internal
211
- */
212
- this.resultCount = computed(() => this.#visibleItems().length, /* @ts-ignore */
213
- ...(ngDevMode ? [{ debugName: "resultCount" }] : /* istanbul ignore next */ []));
214
- /** @description The corner radius. */
215
- this.rounded = input("medium", /* @ts-ignore */
216
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
217
- this.#keepAnItemActive();
218
- this.#announceResults();
219
- }
220
- /** Moves focus to the input. */
221
- focus() {
222
- this.#inputElement()?.focus();
223
- }
224
- /**
225
- * Whether an item shows for the current query.
226
- * @internal
227
- */
228
- matches(item) {
229
- const query = this.query().trim();
230
- if (this.filterMode() === "manual" || query === "") {
231
- return true;
232
- }
233
- return this.filter()(query, { keywords: item.keywords(), value: item.value() });
234
- }
235
- /**
236
- * Moves the active item, skipping disabled ones.
237
- * @internal
238
- */
239
- move(step) {
240
- const items = this.#enabledInOrder();
241
- if (items.length === 0) {
242
- return;
243
- }
244
- const active = this.#activeItem();
245
- const current = active ? items.indexOf(active) : -1;
246
- let next = current === -1 ? (step === 1 ? 0 : items.length - 1) : current + step;
247
- if (next < 0 || next >= items.length) {
248
- if (!this.loop()) {
249
- return;
250
- }
251
- next = next < 0 ? items.length - 1 : 0;
252
- }
253
- this.#activeItem.set(items[next]);
254
- items[next].scrollIntoView();
255
- }
256
- /** @internal */
257
- register(item) {
258
- this.#items.update(items => items.add(item));
259
- }
260
- /** @internal */
261
- registerInput(element) {
262
- this.#inputElement.set(element);
263
- }
264
- /**
265
- * Chooses the active item.
266
- * @internal
267
- */
268
- selectActive(event) {
269
- const item = this.#activeItem();
270
- if (item) {
271
- this.selectItem(item, event);
272
- }
273
- }
274
- /** @internal */
275
- selectItem(item, event) {
276
- if (item.disabled()) {
277
- return;
278
- }
279
- const selection = { originalEvent: event, value: item.value() };
280
- item.itemSelect.emit(selection);
281
- this.itemSelect.emit(selection);
282
- }
283
- /** @internal */
284
- setActive(item) {
285
- if (!item.disabled()) {
286
- this.#activeItem.set(item);
287
- }
288
- }
289
- /** @internal */
290
- unregister(item) {
291
- this.#items.update(items => items.remove(item));
292
- }
293
- /**
294
- * Announces the outcome of a search. The live region is the CDK's, at the end of the document, so it never becomes
295
- * part of the list. The active item needs no announcement: `aria-activedescendant` does that.
296
- */
297
- #announceResults() {
298
- let lastState = "";
299
- effect(() => {
300
- const query = this.query().trim();
301
- const count = this.resultCount();
302
- const loading = this.loading();
303
- untracked(() => {
304
- if (loading) {
305
- return;
306
- }
307
- const state = query === "" ? "" : `${query}\u0000${count}`;
308
- if (state === lastState) {
309
- return;
310
- }
311
- lastState = state;
312
- if (query !== "") {
313
- const messages = this.messages();
314
- void this.#liveAnnouncer.announce(count === 0 ? messages.noResults : messages.resultsAvailable(count), "polite");
315
- }
316
- });
317
- });
318
- }
319
- /** The items that can be chosen, in the order they're on the page, whatever order they were created in. */
320
- #enabledInOrder() {
321
- return this.#visibleItems()
322
- .filter(item => !item.disabled())
323
- .sort((first, second) => first.compareOrder(second));
324
- }
325
- /**
326
- * Enter always has something to choose while there are results: a new query starts from the first one, and new
327
- * results keep the active item as long as it's still among them. This runs after rendering because it reads the
328
- * items' order from the page.
329
- */
330
- #keepAnItemActive() {
331
- let lastQuery = "";
332
- afterRenderEffect(() => {
333
- const query = this.query();
334
- const visible = this.#visibleItems();
335
- untracked(() => {
336
- const active = this.#activeItem();
337
- const queryChanged = query !== lastQuery;
338
- lastQuery = query;
339
- if (!queryChanged && active && visible.includes(active) && !active.disabled()) {
340
- return;
341
- }
342
- const first = this.#enabledInOrder().at(0) ?? null;
343
- this.#activeItem.set(first);
344
- if (queryChanged) {
345
- first?.scrollListToTop();
346
- }
347
- });
348
- });
349
- }
350
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
351
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: CommandComponent, isStandalone: true, selector: "mona-command", inputs: { filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, loop: { classPropertyName: "loop", publicName: "loop", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect", query: "queryChange" }, host: { properties: { "class": "baseClass()" } }, ngImport: i0, template: "<ng-content />", isInline: true }); }
352
- }
353
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandComponent, decorators: [{
354
- type: Component,
355
- args: [{
356
- selector: "mona-command",
357
- template: "<ng-content />",
358
- host: {
359
- "[class]": "baseClass()"
360
- }
361
- }]
362
- }], ctorParameters: () => [], propDecorators: { filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], loop: [{ type: i0.Input, args: [{ isSignal: true, alias: "loop", required: false }] }], query: [{ type: i0.Input, args: [{ isSignal: true, alias: "query", required: false }] }, { type: i0.Output, args: ["queryChange"] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }] } });
363
-
364
- /** Marks the template a `mona-command-dialog` renders while it's open. */
365
- class CommandDialogContentDirective {
366
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandDialogContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
367
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: CommandDialogContentDirective, isStandalone: true, selector: "ng-template[monaCommandDialogContent]", ngImport: i0 }); }
368
- }
369
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandDialogContentDirective, decorators: [{
370
- type: Directive,
371
- args: [{
372
- selector: "ng-template[monaCommandDialogContent]"
373
- }]
374
- }] });
375
-
125
+ var CommandComponent = class CommandComponent {
126
+ #activeItem;
127
+ #i18n;
128
+ #inputElement;
129
+ #items;
130
+ #liveAnnouncer;
131
+ #visibleItems;
132
+ constructor() {
133
+ this.#activeItem = signal(null, ...ngDevMode ? [{ debugName: "#activeItem" }] : /* istanbul ignore next */ []);
134
+ this.#i18n = inject(MonaI18nService);
135
+ this.#inputElement = signal(null, ...ngDevMode ? [{ debugName: "#inputElement" }] : /* istanbul ignore next */ []);
136
+ this.#items = signal(ImmutableSet.create(), ...ngDevMode ? [{ debugName: "#items" }] : /* istanbul ignore next */ []);
137
+ this.#liveAnnouncer = inject(LiveAnnouncer);
138
+ this.#visibleItems = computed(() => this.#items().where((item) => item.visible()).toArray(), ...ngDevMode ? [{ debugName: "#visibleItems" }] : /* istanbul ignore next */ []);
139
+ this.baseClass = computed(() => commandBaseThemeVariants({ rounded: this.rounded() }), ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
140
+ this.activeItem = this.#activeItem.asReadonly();
141
+ this.filter = input(defaultCommandFilter, ...ngDevMode ? [{ debugName: "filter" }] : /* istanbul ignore next */ []);
142
+ this.filterMode = input("auto", ...ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []);
143
+ this.isEmpty = computed(() => this.query().trim() !== "" && !this.loading() && this.resultCount() === 0, ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
144
+ this.itemSelect = output();
145
+ this.listId = createElementControlId();
146
+ this.loading = input(false, {
147
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
148
+ transform: booleanAttribute
149
+ });
150
+ this.loop = input(true, {
151
+ ...ngDevMode ? { debugName: "loop" } : /* istanbul ignore next */ {},
152
+ transform: booleanAttribute
153
+ });
154
+ this.messages = this.#i18n.componentMessages("command", COMMAND_DEFAULT_MESSAGES);
155
+ this.query = model("", ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
156
+ this.resultCount = computed(() => this.#visibleItems().length, ...ngDevMode ? [{ debugName: "resultCount" }] : /* istanbul ignore next */ []);
157
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
158
+ this.#keepAnItemActive();
159
+ this.#announceResults();
160
+ }
161
+ focus() {
162
+ this.#inputElement()?.focus();
163
+ }
164
+ matches(item) {
165
+ const query = this.query().trim();
166
+ if (this.filterMode() === "manual" || query === "") return true;
167
+ return this.filter()(query, {
168
+ keywords: item.keywords(),
169
+ value: item.value()
170
+ });
171
+ }
172
+ move(step) {
173
+ const items = this.#enabledInOrder();
174
+ if (items.length === 0) return;
175
+ const active = this.#activeItem();
176
+ const current = active ? items.indexOf(active) : -1;
177
+ let next = current === -1 ? step === 1 ? 0 : items.length - 1 : current + step;
178
+ if (next < 0 || next >= items.length) {
179
+ if (!this.loop()) return;
180
+ next = next < 0 ? items.length - 1 : 0;
181
+ }
182
+ this.#activeItem.set(items[next]);
183
+ items[next].scrollIntoView();
184
+ }
185
+ register(item) {
186
+ this.#items.update((items) => items.add(item));
187
+ }
188
+ registerInput(element) {
189
+ this.#inputElement.set(element);
190
+ }
191
+ selectActive(event) {
192
+ const item = this.#activeItem();
193
+ if (item) this.selectItem(item, event);
194
+ }
195
+ selectItem(item, event) {
196
+ if (item.disabled()) return;
197
+ const selection = {
198
+ originalEvent: event,
199
+ value: item.value()
200
+ };
201
+ item.itemSelect.emit(selection);
202
+ this.itemSelect.emit(selection);
203
+ }
204
+ setActive(item) {
205
+ if (!item.disabled()) this.#activeItem.set(item);
206
+ }
207
+ unregister(item) {
208
+ this.#items.update((items) => items.remove(item));
209
+ }
210
+ #announceResults() {
211
+ let lastState = "";
212
+ effect(() => {
213
+ const query = this.query().trim();
214
+ const count = this.resultCount();
215
+ const loading = this.loading();
216
+ untracked(() => {
217
+ if (loading) return;
218
+ const state = query === "" ? "" : `${query}\u0000${count}`;
219
+ if (state === lastState) return;
220
+ lastState = state;
221
+ if (query !== "") {
222
+ const messages = this.messages();
223
+ this.#liveAnnouncer.announce(count === 0 ? messages.noResults : messages.resultsAvailable(count), "polite");
224
+ }
225
+ });
226
+ });
227
+ }
228
+ #enabledInOrder() {
229
+ return this.#visibleItems().filter((item) => !item.disabled()).sort((first, second) => first.compareOrder(second));
230
+ }
231
+ #keepAnItemActive() {
232
+ let lastQuery = "";
233
+ afterRenderEffect(() => {
234
+ const query = this.query();
235
+ const visible = this.#visibleItems();
236
+ untracked(() => {
237
+ const active = this.#activeItem();
238
+ const queryChanged = query !== lastQuery;
239
+ lastQuery = query;
240
+ if (!queryChanged && active && visible.includes(active) && !active.disabled()) return;
241
+ const first = this.#enabledInOrder().at(0) ?? null;
242
+ this.#activeItem.set(first);
243
+ if (queryChanged) first?.scrollListToTop();
244
+ });
245
+ });
246
+ }
247
+ static {
248
+ this.ɵfac = i0.ɵɵngDeclareFactory({
249
+ minVersion: "12.0.0",
250
+ version: "22.2.6",
251
+ ngImport: i0,
252
+ type: CommandComponent,
253
+ deps: [],
254
+ target: i0.ɵɵFactoryTarget.Component
255
+ });
256
+ }
257
+ static {
258
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
259
+ minVersion: "17.1.0",
260
+ version: "22.2.6",
261
+ type: CommandComponent,
262
+ isStandalone: true,
263
+ selector: "mona-command",
264
+ inputs: {
265
+ filter: {
266
+ classPropertyName: "filter",
267
+ publicName: "filter",
268
+ isSignal: true,
269
+ isRequired: false,
270
+ transformFunction: null
271
+ },
272
+ filterMode: {
273
+ classPropertyName: "filterMode",
274
+ publicName: "filterMode",
275
+ isSignal: true,
276
+ isRequired: false,
277
+ transformFunction: null
278
+ },
279
+ loading: {
280
+ classPropertyName: "loading",
281
+ publicName: "loading",
282
+ isSignal: true,
283
+ isRequired: false,
284
+ transformFunction: null
285
+ },
286
+ loop: {
287
+ classPropertyName: "loop",
288
+ publicName: "loop",
289
+ isSignal: true,
290
+ isRequired: false,
291
+ transformFunction: null
292
+ },
293
+ query: {
294
+ classPropertyName: "query",
295
+ publicName: "query",
296
+ isSignal: true,
297
+ isRequired: false,
298
+ transformFunction: null
299
+ },
300
+ rounded: {
301
+ classPropertyName: "rounded",
302
+ publicName: "rounded",
303
+ isSignal: true,
304
+ isRequired: false,
305
+ transformFunction: null
306
+ }
307
+ },
308
+ outputs: {
309
+ itemSelect: "itemSelect",
310
+ query: "queryChange"
311
+ },
312
+ host: { properties: { "class": "baseClass()" } },
313
+ ngImport: i0,
314
+ template: "<ng-content />",
315
+ isInline: true
316
+ });
317
+ }
318
+ };
319
+ i0.ɵɵngDeclareClassMetadata({
320
+ minVersion: "12.0.0",
321
+ version: "22.2.6",
322
+ ngImport: i0,
323
+ type: CommandComponent,
324
+ decorators: [{
325
+ type: Component,
326
+ args: [{
327
+ selector: "mona-command",
328
+ template: "<ng-content />",
329
+ host: { "[class]": "baseClass()" }
330
+ }]
331
+ }],
332
+ ctorParameters: () => [],
333
+ propDecorators: {
334
+ filter: [{
335
+ type: i0.Input,
336
+ args: [{
337
+ isSignal: true,
338
+ alias: "filter",
339
+ required: false
340
+ }]
341
+ }],
342
+ filterMode: [{
343
+ type: i0.Input,
344
+ args: [{
345
+ isSignal: true,
346
+ alias: "filterMode",
347
+ required: false
348
+ }]
349
+ }],
350
+ itemSelect: [{
351
+ type: i0.Output,
352
+ args: ["itemSelect"]
353
+ }],
354
+ loading: [{
355
+ type: i0.Input,
356
+ args: [{
357
+ isSignal: true,
358
+ alias: "loading",
359
+ required: false
360
+ }]
361
+ }],
362
+ loop: [{
363
+ type: i0.Input,
364
+ args: [{
365
+ isSignal: true,
366
+ alias: "loop",
367
+ required: false
368
+ }]
369
+ }],
370
+ query: [{
371
+ type: i0.Input,
372
+ args: [{
373
+ isSignal: true,
374
+ alias: "query",
375
+ required: false
376
+ }]
377
+ }, {
378
+ type: i0.Output,
379
+ args: ["queryChange"]
380
+ }],
381
+ rounded: [{
382
+ type: i0.Input,
383
+ args: [{
384
+ isSignal: true,
385
+ alias: "rounded",
386
+ required: false
387
+ }]
388
+ }]
389
+ }
390
+ });
391
+ var CommandDialogContentDirective = class CommandDialogContentDirective {
392
+ static {
393
+ this.ɵfac = i0.ɵɵngDeclareFactory({
394
+ minVersion: "12.0.0",
395
+ version: "22.2.6",
396
+ ngImport: i0,
397
+ type: CommandDialogContentDirective,
398
+ deps: [],
399
+ target: i0.ɵɵFactoryTarget.Directive
400
+ });
401
+ }
402
+ static {
403
+ this.ɵdir = i0.ɵɵngDeclareDirective({
404
+ minVersion: "14.0.0",
405
+ version: "22.2.6",
406
+ type: CommandDialogContentDirective,
407
+ isStandalone: true,
408
+ selector: "ng-template[monaCommandDialogContent]",
409
+ ngImport: i0
410
+ });
411
+ }
412
+ };
413
+ i0.ɵɵngDeclareClassMetadata({
414
+ minVersion: "12.0.0",
415
+ version: "22.2.6",
416
+ ngImport: i0,
417
+ type: CommandDialogContentDirective,
418
+ decorators: [{
419
+ type: Directive,
420
+ args: [{ selector: "ng-template[monaCommandDialogContent]" }]
421
+ }]
422
+ });
376
423
  const APPLE_PLATFORM = /mac|iphone|ipad|ipod/i;
377
424
  const EDITABLE = "input, textarea, select, [contenteditable]:not([contenteditable='false'])";
378
425
  const isApplePlatform = (view) => APPLE_PLATFORM.test(view?.navigator.platform ?? "");
379
426
  const parseShortcut = (shortcut, apple) => {
380
- const parts = shortcut.toLowerCase().split("+");
381
- const has = (name) => parts.slice(0, -1).includes(name);
382
- return {
383
- alt: has("alt"),
384
- control: has("ctrl") || (has("mod") && !apple),
385
- key: parts.at(-1) ?? "",
386
- meta: has("meta") || (has("mod") && apple),
387
- shift: has("shift")
388
- };
427
+ const parts = shortcut.toLowerCase().split("+");
428
+ const has = (name) => parts.slice(0, -1).includes(name);
429
+ return {
430
+ alt: has("alt"),
431
+ control: has("ctrl") || has("mod") && !apple,
432
+ key: parts.at(-1) ?? "",
433
+ meta: has("meta") || has("mod") && apple,
434
+ shift: has("shift")
435
+ };
389
436
  };
390
- /** Whether a key press is this shortcut. A shortcut without Ctrl, Alt or Meta doesn't fire while the user is typing. */
391
437
  const matchesShortcut = (event, shortcut, apple) => {
392
- const parsed = parseShortcut(shortcut, apple);
393
- if (event.key?.toLowerCase() !== parsed.key ||
394
- event.altKey !== parsed.alt ||
395
- event.ctrlKey !== parsed.control ||
396
- event.metaKey !== parsed.meta ||
397
- event.shiftKey !== parsed.shift) {
398
- return false;
399
- }
400
- if (parsed.alt || parsed.control || parsed.meta) {
401
- return true;
402
- }
403
- return !(event.target instanceof Element && event.target.closest(EDITABLE));
438
+ const parsed = parseShortcut(shortcut, apple);
439
+ if (event.key?.toLowerCase() !== parsed.key || event.altKey !== parsed.alt || event.ctrlKey !== parsed.control || event.metaKey !== parsed.meta || event.shiftKey !== parsed.shift) return false;
440
+ if (parsed.alt || parsed.control || parsed.meta) return true;
441
+ return !(event.target instanceof Element && event.target.closest(EDITABLE));
404
442
  };
405
443
  const appleKey = (part) => {
406
- switch (part) {
407
- case "alt":
408
- return { name: "Option", symbol: "\u2325" };
409
- case "ctrl":
410
- return { name: "Control", symbol: "\u2303" };
411
- case "meta":
412
- case "mod":
413
- return { name: "Command", symbol: "\u2318" };
414
- case "shift":
415
- return { name: "Shift", symbol: "\u21E7" };
416
- default:
417
- return null;
418
- }
444
+ switch (part) {
445
+ case "alt": return {
446
+ name: "Option",
447
+ symbol: "⌥"
448
+ };
449
+ case "ctrl": return {
450
+ name: "Control",
451
+ symbol: "⌃"
452
+ };
453
+ case "meta":
454
+ case "mod": return {
455
+ name: "Command",
456
+ symbol: "⌘"
457
+ };
458
+ case "shift": return {
459
+ name: "Shift",
460
+ symbol: "⇧"
461
+ };
462
+ default: return null;
463
+ }
419
464
  };
420
465
  const otherKey = (part) => {
421
- switch (part) {
422
- case "alt":
423
- return { name: "Alt", symbol: "Alt" };
424
- case "ctrl":
425
- case "mod":
426
- return { name: "Control", symbol: "Ctrl" };
427
- case "meta":
428
- return { name: "Meta", symbol: "Meta" };
429
- case "shift":
430
- return { name: "Shift", symbol: "Shift" };
431
- default:
432
- return null;
433
- }
466
+ switch (part) {
467
+ case "alt": return {
468
+ name: "Alt",
469
+ symbol: "Alt"
470
+ };
471
+ case "ctrl":
472
+ case "mod": return {
473
+ name: "Control",
474
+ symbol: "Ctrl"
475
+ };
476
+ case "meta": return {
477
+ name: "Meta",
478
+ symbol: "Meta"
479
+ };
480
+ case "shift": return {
481
+ name: "Shift",
482
+ symbol: "Shift"
483
+ };
484
+ default: return null;
485
+ }
434
486
  };
435
- /** The keys of a shortcut as the platform writes them: `mod+k` is Ctrl and K, or Command and K on Apple devices. */
436
- const describeShortcut = (shortcut, apple) => shortcut
437
- .toLowerCase()
438
- .split("+")
439
- .map(part => {
440
- const modifier = apple ? appleKey(part) : otherKey(part);
441
- const key = part.length === 1 ? part.toUpperCase() : part.charAt(0).toUpperCase() + part.slice(1);
442
- return modifier ?? { name: key, symbol: key };
487
+ const describeShortcut = (shortcut, apple) => shortcut.toLowerCase().split("+").map((part) => {
488
+ const modifier = apple ? appleKey(part) : otherKey(part);
489
+ const key = part.length === 1 ? part.toUpperCase() : part.charAt(0).toUpperCase() + part.slice(1);
490
+ return modifier ?? {
491
+ name: key,
492
+ symbol: key
493
+ };
443
494
  });
444
-
445
495
  const VIEWPORT_MARGIN = "2rem";
446
- const TOP_OF_VIEWPORT = 0.12;
447
- /**
448
- * A modal for a `mona-command`. It stays near the top of the page instead of centering, so the input doesn't jump as
449
- * results come and go, and the `mona-command` inside is created each time it opens, so it starts with an empty query.
450
- */
451
- class CommandDialogComponent {
452
- #document;
453
- #i18n;
454
- #injector;
455
- #popupService;
456
- #renderer;
457
- #popupRef;
458
- constructor() {
459
- this.#document = inject(DOCUMENT);
460
- this.#i18n = inject(MonaI18nService);
461
- this.#injector = inject(Injector);
462
- this.#popupService = inject(PopupService);
463
- this.#renderer = inject(Renderer2);
464
- this.#popupRef = null;
465
- this.content = contentChild(CommandDialogContentDirective, { ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), read: TemplateRef });
466
- this.messages = this.#i18n.componentMessages("command", COMMAND_DEFAULT_MESSAGES);
467
- this.panel = viewChild.required("panel", /* @ts-ignore */
468
- ...(ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []));
469
- this.panelClass = computed(() => commandDialogPanelThemeVariants(), /* @ts-ignore */
470
- ...(ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []));
471
- /** @description The accessible name of the dialog. */
472
- this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
473
- /** @description Whether the dialog is open. */
474
- this.open = model(false, /* @ts-ignore */
475
- ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
476
- /**
477
- * @description A key combination that opens and closes the dialog from anywhere on the page, such as `mod+k`.
478
- * `mod` is Command on Apple devices and Ctrl elsewhere. Nothing is bound unless this is set.
479
- */
480
- this.shortcut = input(null, /* @ts-ignore */
481
- ...(ngDevMode ? [{ debugName: "shortcut" }] : /* istanbul ignore next */ []));
482
- /** @description The dialog's width. It never gets wider than the viewport. */
483
- this.width = input("36rem", /* @ts-ignore */
484
- ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
485
- effect(() => {
486
- const open = this.open();
487
- untracked(() => {
488
- if (open && !this.#popupRef) {
489
- this.#show();
490
- }
491
- else if (!open && this.#popupRef) {
492
- this.#popupRef.close();
493
- }
494
- });
495
- });
496
- effect(onCleanup => {
497
- const shortcut = this.shortcut();
498
- if (shortcut) {
499
- onCleanup(untracked(() => this.#listenFor(shortcut)));
500
- }
501
- });
502
- inject(DestroyRef).onDestroy(() => this.#popupRef?.close());
503
- }
504
- #listenFor(shortcut) {
505
- const apple = isApplePlatform(this.#document.defaultView);
506
- return this.#renderer.listen(this.#document, "keydown", (event) => {
507
- if (!event.repeat && !event.isComposing && matchesShortcut(event, shortcut, apple)) {
508
- event.preventDefault();
509
- this.open.update(open => !open);
510
- }
511
- });
512
- }
513
- #show() {
514
- const top = Math.round((this.#document.defaultView?.innerHeight ?? 0) * TOP_OF_VIEWPORT);
515
- const popupRef = this.#popupService.create({
516
- anchor: this.#document.body,
517
- backdropClass: ["fixed", "inset-0", "bg-background/50", "transition-opacity", "z-40", "backdrop-blur-xs"],
518
- blockScroll: true,
519
- closeOnBackdropClick: true,
520
- closeOnEscape: true,
521
- closeOnOutsideClick: false,
522
- content: this.panel(),
523
- hasBackdrop: true,
524
- maxHeight: `calc(100dvh - ${2 * top}px)`,
525
- maxWidth: `calc(100dvw - ${VIEWPORT_MARGIN})`,
526
- popupWrapperClass: "mona-popup-constrain-height",
527
- positionStrategy: "global",
528
- width: this.width()
529
- });
530
- this.#popupRef = popupRef;
531
- positionGlobalOverlay(popupRef.overlayRef, { top });
532
- afterNextRender({
533
- write: () => popupRef.overlayRef.hostElement.querySelector("[role='combobox']")?.focus()
534
- }, { injector: this.#injector });
535
- const release = inertOutside(popupRef.overlayRef.hostElement);
536
- merge(popupRef.closeStart, popupRef.closed)
537
- .pipe(take(1))
538
- .subscribe(() => {
539
- release();
540
- this.#popupRef = null;
541
- this.open.set(false);
542
- });
543
- }
544
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
545
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: CommandDialogComponent, isStandalone: true, selector: "mona-command-dialog", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, shortcut: { classPropertyName: "shortcut", publicName: "shortcut", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { properties: { "attr.aria-label": "null" }, classAttribute: "hidden" }, queries: [{ propertyName: "content", first: true, predicate: CommandDialogContentDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #panel>\n <div\n cdkTrapFocus\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"ariaLabel() || messages().dialogLabel\"\n [class]=\"panelClass()\">\n <ng-container [ngTemplateOutlet]=\"content() ?? null\" />\n </div>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
546
- }
547
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandDialogComponent, decorators: [{
548
- type: Component,
549
- args: [{ selector: "mona-command-dialog", imports: [A11yModule, NgTemplateOutlet], host: {
550
- "[attr.aria-label]": "null",
551
- class: "hidden"
552
- }, template: "<ng-template #panel>\n <div\n cdkTrapFocus\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"ariaLabel() || messages().dialogLabel\"\n [class]=\"panelClass()\">\n <ng-container [ngTemplateOutlet]=\"content() ?? null\" />\n </div>\n</ng-template>\n" }]
553
- }], ctorParameters: () => [], propDecorators: { content: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CommandDialogContentDirective), { ...{ read: TemplateRef }, isSignal: true }] }], panel: [{ type: i0.ViewChild, args: ["panel", { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], shortcut: [{ type: i0.Input, args: [{ isSignal: true, alias: "shortcut", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
554
-
555
- /** Shows while a query has no results. Its content replaces the default message. */
556
- class CommandEmptyComponent {
557
- constructor() {
558
- this.root = inject(CommandComponent);
559
- this.statusClass = computed(() => commandStatusThemeVariants(), /* @ts-ignore */
560
- ...(ngDevMode ? [{ debugName: "statusClass" }] : /* istanbul ignore next */ []));
561
- }
562
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
563
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CommandEmptyComponent, isStandalone: true, selector: "mona-command-empty", host: { classAttribute: "contents" }, ngImport: i0, template: "@if (root.isEmpty()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().noResults }}</ng-content>\n </div>\n}\n" }); }
564
- }
565
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandEmptyComponent, decorators: [{
566
- type: Component,
567
- args: [{ selector: "mona-command-empty", host: {
568
- class: "contents"
569
- }, template: "@if (root.isEmpty()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().noResults }}</ng-content>\n </div>\n}\n" }]
570
- }] });
571
-
572
- /** A strip below the list, for key hints or links. */
573
- class CommandFooterComponent {
574
- constructor() {
575
- this.hostClass = computed(() => commandFooterThemeVariants(), /* @ts-ignore */
576
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
577
- }
578
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
579
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: CommandFooterComponent, isStandalone: true, selector: "mona-command-footer", host: { properties: { "class": "hostClass()" } }, ngImport: i0, template: "<ng-content />", isInline: true }); }
580
- }
581
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandFooterComponent, decorators: [{
582
- type: Component,
583
- args: [{
584
- selector: "mona-command-footer",
585
- template: "<ng-content />",
586
- host: {
587
- "[class]": "hostClass()"
588
- }
589
- }]
590
- }] });
591
-
592
- /** A titled set of items. It hides itself while none of its items show. */
593
- class CommandGroupComponent {
594
- constructor() {
595
- this.#items = signal(ImmutableSet.create(), /* @ts-ignore */
596
- ...(ngDevMode ? [{ debugName: "#items" }] : /* istanbul ignore next */ []));
597
- this.headingClass = computed(() => commandGroupHeadingThemeVariants(), /* @ts-ignore */
598
- ...(ngDevMode ? [{ debugName: "headingClass" }] : /* istanbul ignore next */ []));
599
- this.headingId = createElementControlId();
600
- this.hostClass = computed(() => commandGroupThemeVariants(), /* @ts-ignore */
601
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
602
- this.visible = computed(() => this.#items().any(item => item.visible()), /* @ts-ignore */
603
- ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
604
- /** @description The title above the group's items. */
605
- this.heading = input(/* @ts-ignore */
606
- ...(ngDevMode ? [undefined, { debugName: "heading" }] : /* istanbul ignore next */ []));
607
- }
608
- #items;
609
- /** @internal */
610
- register(item) {
611
- this.#items.update(items => items.add(item));
612
- }
613
- /** @internal */
614
- unregister(item) {
615
- this.#items.update(items => items.remove(item));
616
- }
617
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
618
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CommandGroupComponent, isStandalone: true, selector: "mona-command-group", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "heading() ? headingId : null", "class": "hostClass()", "class.hidden": "!visible()" } }, ngImport: i0, template: "@if (heading()) {\n <div [class]=\"headingClass()\" [id]=\"headingId\">{{ heading() }}</div>\n}\n<ng-content />\n" }); }
619
- }
620
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandGroupComponent, decorators: [{
621
- type: Component,
622
- args: [{ selector: "mona-command-group", host: {
623
- role: "group",
624
- "[attr.aria-labelledby]": "heading() ? headingId : null",
625
- "[class]": "hostClass()",
626
- "[class.hidden]": "!visible()"
627
- }, template: "@if (heading()) {\n <div [class]=\"headingClass()\" [id]=\"headingId\">{{ heading() }}</div>\n}\n<ng-content />\n" }]
628
- }], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }] } });
629
-
630
- /** A strip above or below the input, for filters or a title. */
631
- class CommandHeaderComponent {
632
- constructor() {
633
- this.hostClass = computed(() => commandHeaderThemeVariants(), /* @ts-ignore */
634
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
635
- }
636
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
637
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: CommandHeaderComponent, isStandalone: true, selector: "mona-command-header", host: { properties: { "class": "hostClass()" } }, ngImport: i0, template: "<ng-content />", isInline: true }); }
638
- }
639
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandHeaderComponent, decorators: [{
640
- type: Component,
641
- args: [{
642
- selector: "mona-command-header",
643
- template: "<ng-content />",
644
- host: {
645
- "[class]": "hostClass()"
646
- }
647
- }]
648
- }] });
649
-
650
- /** Shows a text with the parts the query matches marked. Marks the query's words, however the item was matched. */
651
- class CommandHighlightComponent {
652
- constructor() {
653
- this.#root = inject(CommandComponent);
654
- this.markClass = computed(() => commandHighlightMarkThemeVariants(), /* @ts-ignore */
655
- ...(ngDevMode ? [{ debugName: "markClass" }] : /* istanbul ignore next */ []));
656
- this.parts = computed(() => splitByQuery(this.text(), this.#root.query()), /* @ts-ignore */
657
- ...(ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []));
658
- /** @description The text to show. */
659
- this.text = input.required(/* @ts-ignore */
660
- ...(ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []));
661
- }
662
- #root;
663
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandHighlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
664
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CommandHighlightComponent, isStandalone: true, selector: "mona-command-highlight", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@for (part of parts(); track $index) {\n @if (part.match) {\n <mark [class]=\"markClass()\">{{ part.text }}</mark>\n } @else {\n <span>{{ part.text }}</span>\n }\n}\n" }); }
665
- }
666
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandHighlightComponent, decorators: [{
667
- type: Component,
668
- args: [{ selector: "mona-command-highlight", template: "@for (part of parts(); track $index) {\n @if (part.match) {\n <mark [class]=\"markClass()\">{{ part.text }}</mark>\n } @else {\n <span>{{ part.text }}</span>\n }\n}\n" }]
669
- }], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: true }] }] } });
670
-
671
- /**
672
- * The search field of a `mona-command`. Focus stays here while the arrow keys move through the list, so typing always
673
- * continues the search.
674
- */
675
- class CommandInputComponent {
676
- constructor() {
677
- this.field = viewChild.required("field", /* @ts-ignore */
678
- ...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
679
- this.fieldClass = computed(() => commandInputFieldThemeVariants(), /* @ts-ignore */
680
- ...(ngDevMode ? [{ debugName: "fieldClass" }] : /* istanbul ignore next */ []));
681
- this.hostClass = computed(() => commandInputThemeVariants(), /* @ts-ignore */
682
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
683
- this.iconClass = computed(() => commandInputIconThemeVariants(), /* @ts-ignore */
684
- ...(ngDevMode ? [{ debugName: "iconClass" }] : /* istanbul ignore next */ []));
685
- this.root = inject(CommandComponent);
686
- /** @description The accessible name of the field. */
687
- this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
688
- /** @description The text shown while the field is empty. */
689
- this.placeholder = input(/* @ts-ignore */
690
- ...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
691
- afterNextRender({ read: () => this.root.registerInput(this.field().nativeElement) });
692
- }
693
- onInput(event) {
694
- this.root.query.set(event.target.value);
695
- }
696
- onKeydown(event) {
697
- // While an input method composes text, these keys belong to it. Enter there confirms the composition.
698
- if (event.isComposing) {
699
- return;
700
- }
701
- switch (event.key) {
702
- case "ArrowDown":
703
- event.preventDefault();
704
- this.root.move(1);
705
- break;
706
- case "ArrowUp":
707
- event.preventDefault();
708
- this.root.move(-1);
709
- break;
710
- case "Enter":
711
- event.preventDefault();
712
- this.root.selectActive(event);
713
- break;
714
- }
715
- }
716
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
717
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: CommandInputComponent, isStandalone: true, selector: "mona-command-input", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-label": "null", "class": "hostClass()" } }, viewQueries: [{ propertyName: "field", first: true, predicate: ["field"], descendants: true, isSignal: true }], ngImport: i0, template: "<svg lucideSearch aria-hidden=\"true\" [class]=\"iconClass()\" [size]=\"16\"></svg>\n<input\n #field\n type=\"text\"\n role=\"combobox\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n spellcheck=\"false\"\n [attr.aria-activedescendant]=\"root.activeItem()?.id ?? null\"\n [attr.aria-controls]=\"root.listId\"\n [attr.aria-expanded]=\"root.resultCount() > 0\"\n [attr.aria-label]=\"ariaLabel() || root.messages().inputLabel\"\n [attr.placeholder]=\"placeholder() ?? root.messages().placeholder\"\n [class]=\"fieldClass()\"\n [value]=\"root.query()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\" />\n", dependencies: [{ kind: "component", type: LucideSearch, selector: "svg[lucideSearch]" }] }); }
718
- }
719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandInputComponent, decorators: [{
720
- type: Component,
721
- args: [{ selector: "mona-command-input", imports: [LucideSearch], host: {
722
- "[attr.aria-label]": "null",
723
- "[class]": "hostClass()"
724
- }, template: "<svg lucideSearch aria-hidden=\"true\" [class]=\"iconClass()\" [size]=\"16\"></svg>\n<input\n #field\n type=\"text\"\n role=\"combobox\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n spellcheck=\"false\"\n [attr.aria-activedescendant]=\"root.activeItem()?.id ?? null\"\n [attr.aria-controls]=\"root.listId\"\n [attr.aria-expanded]=\"root.resultCount() > 0\"\n [attr.aria-label]=\"ariaLabel() || root.messages().inputLabel\"\n [attr.placeholder]=\"placeholder() ?? root.messages().placeholder\"\n [class]=\"fieldClass()\"\n [value]=\"root.query()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\" />\n" }]
725
- }], ctorParameters: () => [], propDecorators: { field: [{ type: i0.ViewChild, args: ["field", { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
726
-
727
- /** One action or option in a `mona-command`. What it shows is its content; what it's found by is its value. */
728
- class CommandItemComponent {
729
- #element;
730
- #group;
731
- #root;
732
- constructor() {
733
- this.#element = inject(ElementRef);
734
- this.#group = inject(CommandGroupComponent, { optional: true });
735
- this.#root = inject(CommandComponent);
736
- this.active = computed(() => this.#root.activeItem() === this, /* @ts-ignore */
737
- ...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
738
- this.hostClass = computed(() => commandItemThemeVariants(), /* @ts-ignore */
739
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
740
- /** @description Whether the item shows but can't be chosen. */
741
- this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
742
- /** @internal */
743
- this.id = createElementControlId();
744
- /** @description Emits when this item is chosen, with the pointer or with Enter. */
745
- this.itemSelect = output();
746
- /** @description Other words the item should be found by, such as synonyms. */
747
- this.keywords = input([], /* @ts-ignore */
748
- ...(ngDevMode ? [{ debugName: "keywords" }] : /* istanbul ignore next */ []));
749
- /** @description What the item is found by, and what the select event carries. */
750
- this.value = input.required(/* @ts-ignore */
751
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
752
- /**
753
- * Whether the item shows for the current query.
754
- * @internal
755
- */
756
- this.visible = computed(() => this.#root.matches(this), /* @ts-ignore */
757
- ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
758
- this.#root.register(this);
759
- this.#group?.register(this);
760
- inject(DestroyRef).onDestroy(() => {
761
- this.#root.unregister(this);
762
- this.#group?.unregister(this);
763
- });
764
- }
765
- /**
766
- * Negative when this item comes before the other on the page.
767
- * @internal
768
- */
769
- compareOrder(other) {
770
- const position = this.#element.nativeElement.compareDocumentPosition(other.#element.nativeElement);
771
- return position & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
772
- }
773
- /** @internal */
774
- scrollIntoView() {
775
- this.#element.nativeElement.scrollIntoView({ block: "nearest" });
776
- }
777
- /**
778
- * Back to the top rather than to this item, so the first group's heading shows too.
779
- * @internal
780
- */
781
- scrollListToTop() {
782
- const list = this.#element.nativeElement.closest("[role='listbox']");
783
- if (list) {
784
- list.scrollTop = 0;
785
- }
786
- }
787
- onClick(event) {
788
- this.#root.selectItem(this, event);
789
- }
790
- /** Not `mouseenter`: that also fires when the list scrolls under a resting pointer, which would steal the active item. */
791
- onPointerMove() {
792
- this.#root.setActive(this);
793
- }
794
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
795
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: CommandItemComponent, isStandalone: true, selector: "mona-command-item", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, keywords: { classPropertyName: "keywords", publicName: "keywords", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { itemSelect: "itemSelect" }, host: { attributes: { "role": "option" }, listeners: { "click": "onClick($event)", "mousedown": "$event.preventDefault()", "pointermove": "onPointerMove()" }, properties: { "attr.aria-disabled": "disabled() || null", "attr.aria-selected": "active()", "attr.data-active": "active()", "attr.data-disabled": "disabled() || null", "class": "hostClass()", "class.hidden": "!visible()", "id": "id" } }, ngImport: i0, template: "<ng-content />", isInline: true }); }
796
- }
797
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandItemComponent, decorators: [{
798
- type: Component,
799
- args: [{
800
- selector: "mona-command-item",
801
- template: "<ng-content />",
802
- host: {
803
- role: "option",
804
- "[attr.aria-disabled]": "disabled() || null",
805
- "[attr.aria-selected]": "active()",
806
- "[attr.data-active]": "active()",
807
- "[attr.data-disabled]": "disabled() || null",
808
- "[class]": "hostClass()",
809
- "[class.hidden]": "!visible()",
810
- "[id]": "id",
811
- "(click)": "onClick($event)",
812
- "(mousedown)": "$event.preventDefault()",
813
- "(pointermove)": "onPointerMove()"
814
- }
815
- }]
816
- }], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], itemSelect: [{ type: i0.Output, args: ["itemSelect"] }], keywords: [{ type: i0.Input, args: [{ isSignal: true, alias: "keywords", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }] } });
817
-
818
- /**
819
- * Holds the items of a `mona-command`, and scrolls them. The empty and loading states sit outside the listbox, which
820
- * may only contain options and groups.
821
- */
822
- class CommandListComponent {
823
- constructor() {
824
- this.listClass = computed(() => commandListThemeVariants(), /* @ts-ignore */
825
- ...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
826
- this.root = inject(CommandComponent);
827
- /** @description The accessible name of the list. */
828
- this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
829
- }
830
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
831
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: CommandListComponent, isStandalone: true, selector: "mona-command-list", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-label": "null" }, classAttribute: "flex min-h-0 flex-1 flex-col" }, ngImport: i0, template: "<ng-content select=\"mona-command-empty, mona-command-loading\" />\n<div\n role=\"listbox\"\n [attr.aria-busy]=\"root.loading() || null\"\n [attr.aria-label]=\"ariaLabel() || root.messages().listLabel\"\n [class]=\"listClass()\"\n [class.hidden]=\"root.resultCount() === 0\"\n [id]=\"root.listId\">\n <ng-content />\n</div>\n" }); }
832
- }
833
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandListComponent, decorators: [{
834
- type: Component,
835
- args: [{ selector: "mona-command-list", host: {
836
- "[attr.aria-label]": "null",
837
- class: "flex min-h-0 flex-1 flex-col"
838
- }, template: "<ng-content select=\"mona-command-empty, mona-command-loading\" />\n<div\n role=\"listbox\"\n [attr.aria-busy]=\"root.loading() || null\"\n [attr.aria-label]=\"ariaLabel() || root.messages().listLabel\"\n [class]=\"listClass()\"\n [class.hidden]=\"root.resultCount() === 0\"\n [id]=\"root.listId\">\n <ng-content />\n</div>\n" }]
839
- }], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
840
-
841
- /** Shows while the `mona-command` is `loading`. Its content replaces the default message. */
842
- class CommandLoadingComponent {
843
- constructor() {
844
- this.root = inject(CommandComponent);
845
- this.statusClass = computed(() => commandStatusThemeVariants(), /* @ts-ignore */
846
- ...(ngDevMode ? [{ debugName: "statusClass" }] : /* istanbul ignore next */ []));
847
- }
848
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
849
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CommandLoadingComponent, isStandalone: true, selector: "mona-command-loading", host: { classAttribute: "contents" }, ngImport: i0, template: "@if (root.loading()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().loading }}</ng-content>\n </div>\n}\n" }); }
850
- }
851
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandLoadingComponent, decorators: [{
852
- type: Component,
853
- args: [{ selector: "mona-command-loading", host: {
854
- class: "contents"
855
- }, template: "@if (root.loading()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().loading }}</ng-content>\n </div>\n}\n" }]
856
- }] });
857
-
858
- /**
859
- * A line between items. It's only visual, because a listbox can't contain a separator role. It hides while the
860
- * component filters, when it would divide nothing.
861
- */
862
- class CommandSeparatorComponent {
863
- constructor() {
864
- this.#root = inject(CommandComponent);
865
- this.hidden = computed(() => this.#root.filterMode() === "auto" && this.#root.query().trim() !== "", /* @ts-ignore */
866
- ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
867
- this.hostClass = computed(() => commandSeparatorThemeVariants(), /* @ts-ignore */
868
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
869
- }
870
- #root;
871
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
872
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.6", type: CommandSeparatorComponent, isStandalone: true, selector: "mona-command-separator", host: { attributes: { "aria-hidden": "true" }, properties: { "class": "hostClass()", "class.hidden": "hidden()" } }, ngImport: i0, template: "", isInline: true }); }
873
- }
874
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandSeparatorComponent, decorators: [{
875
- type: Component,
876
- args: [{
877
- selector: "mona-command-separator",
878
- template: "",
879
- host: {
880
- "aria-hidden": "true",
881
- "[class]": "hostClass()",
882
- "[class.hidden]": "hidden()"
883
- }
884
- }]
885
- }] });
886
-
887
- /**
888
- * Shows an item's shortcut the way the platform writes it. It's only a hint: binding the keys stays with the consumer,
889
- * who knows what they do.
890
- */
891
- class CommandShortcutComponent {
892
- constructor() {
893
- this.#apple = isApplePlatform(inject(DOCUMENT).defaultView);
894
- this.hostClass = computed(() => commandShortcutThemeVariants(), /* @ts-ignore */
895
- ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
896
- this.keyClass = computed(() => commandShortcutKeyThemeVariants(), /* @ts-ignore */
897
- ...(ngDevMode ? [{ debugName: "keyClass" }] : /* istanbul ignore next */ []));
898
- this.parts = computed(() => describeShortcut(this.keys(), this.#apple), /* @ts-ignore */
899
- ...(ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []));
900
- /** @description The keys, joined with `+`, such as `mod+k`. `mod` is Command on Apple devices and Ctrl elsewhere. */
901
- this.keys = input.required(/* @ts-ignore */
902
- ...(ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []));
903
- }
904
- #apple;
905
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandShortcutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
906
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: CommandShortcutComponent, isStandalone: true, selector: "mona-command-shortcut", inputs: { keys: { classPropertyName: "keys", publicName: "keys", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "hostClass()" } }, ngImport: i0, template: "@for (key of parts(); track $index) {\n <kbd aria-hidden=\"true\" [class]=\"keyClass()\">{{ key.symbol }}</kbd>\n <span class=\"sr-only\">{{ key.name }}</span>\n}\n" }); }
907
- }
908
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: CommandShortcutComponent, decorators: [{
909
- type: Component,
910
- args: [{ selector: "mona-command-shortcut", host: {
911
- "[class]": "hostClass()"
912
- }, template: "@for (key of parts(); track $index) {\n <kbd aria-hidden=\"true\" [class]=\"keyClass()\">{{ key.symbol }}</kbd>\n <span class=\"sr-only\">{{ key.name }}</span>\n}\n" }]
913
- }], propDecorators: { keys: [{ type: i0.Input, args: [{ isSignal: true, alias: "keys", required: true }] }] } });
914
-
915
- /*
916
- * Public API Surface of @nanahoshi/mona-ui/command
917
- */
918
-
919
- /**
920
- * Generated bundle index. Do not edit.
921
- */
922
-
496
+ const TOP_OF_VIEWPORT = .12;
497
+ var CommandDialogComponent = class CommandDialogComponent {
498
+ #document;
499
+ #i18n;
500
+ #injector;
501
+ #popupService;
502
+ #renderer;
503
+ #popupRef;
504
+ constructor() {
505
+ this.#document = inject(DOCUMENT);
506
+ this.#i18n = inject(MonaI18nService);
507
+ this.#injector = inject(Injector);
508
+ this.#popupService = inject(PopupService);
509
+ this.#renderer = inject(Renderer2);
510
+ this.#popupRef = null;
511
+ this.content = contentChild(CommandDialogContentDirective, {
512
+ ...ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {},
513
+ read: TemplateRef
514
+ });
515
+ this.messages = this.#i18n.componentMessages("command", COMMAND_DEFAULT_MESSAGES);
516
+ this.panel = viewChild.required("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
517
+ this.panelClass = computed(() => commandDialogPanelThemeVariants(), ...ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []);
518
+ this.ariaLabel = input(void 0, {
519
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
520
+ alias: "aria-label"
521
+ });
522
+ this.open = model(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
523
+ this.shortcut = input(null, ...ngDevMode ? [{ debugName: "shortcut" }] : /* istanbul ignore next */ []);
524
+ this.width = input("36rem", ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
525
+ effect(() => {
526
+ const open = this.open();
527
+ untracked(() => {
528
+ if (open && !this.#popupRef) this.#show();
529
+ else if (!open && this.#popupRef) this.#popupRef.close();
530
+ });
531
+ });
532
+ effect((onCleanup) => {
533
+ const shortcut = this.shortcut();
534
+ if (shortcut) onCleanup(untracked(() => this.#listenFor(shortcut)));
535
+ });
536
+ inject(DestroyRef).onDestroy(() => this.#popupRef?.close());
537
+ }
538
+ #listenFor(shortcut) {
539
+ const apple = isApplePlatform(this.#document.defaultView);
540
+ return this.#renderer.listen(this.#document, "keydown", (event) => {
541
+ if (!event.repeat && !event.isComposing && matchesShortcut(event, shortcut, apple)) {
542
+ event.preventDefault();
543
+ this.open.update((open) => !open);
544
+ }
545
+ });
546
+ }
547
+ #show() {
548
+ const top = Math.round((this.#document.defaultView?.innerHeight ?? 0) * TOP_OF_VIEWPORT);
549
+ const popupRef = this.#popupService.create({
550
+ anchor: this.#document.body,
551
+ backdropClass: [
552
+ "fixed",
553
+ "inset-0",
554
+ "bg-background/50",
555
+ "transition-opacity",
556
+ "z-40",
557
+ "backdrop-blur-xs"
558
+ ],
559
+ blockScroll: true,
560
+ closeOnBackdropClick: true,
561
+ closeOnEscape: true,
562
+ closeOnOutsideClick: false,
563
+ content: this.panel(),
564
+ hasBackdrop: true,
565
+ maxHeight: `calc(100dvh - ${2 * top}px)`,
566
+ maxWidth: `calc(100dvw - ${VIEWPORT_MARGIN})`,
567
+ popupWrapperClass: "mona-popup-constrain-height",
568
+ positionStrategy: "global",
569
+ width: this.width()
570
+ });
571
+ this.#popupRef = popupRef;
572
+ positionGlobalOverlay(popupRef.overlayRef, { top });
573
+ afterNextRender({ write: () => popupRef.overlayRef.hostElement.querySelector("[role='combobox']")?.focus() }, { injector: this.#injector });
574
+ const release = inertOutside(popupRef.overlayRef.hostElement);
575
+ merge(popupRef.closeStart, popupRef.closed).pipe(take(1)).subscribe(() => {
576
+ release();
577
+ this.#popupRef = null;
578
+ this.open.set(false);
579
+ });
580
+ }
581
+ static {
582
+ this.ɵfac = i0.ɵɵngDeclareFactory({
583
+ minVersion: "12.0.0",
584
+ version: "22.2.6",
585
+ ngImport: i0,
586
+ type: CommandDialogComponent,
587
+ deps: [],
588
+ target: i0.ɵɵFactoryTarget.Component
589
+ });
590
+ }
591
+ static {
592
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
593
+ minVersion: "17.2.0",
594
+ version: "22.2.6",
595
+ type: CommandDialogComponent,
596
+ isStandalone: true,
597
+ selector: "mona-command-dialog",
598
+ inputs: {
599
+ ariaLabel: {
600
+ classPropertyName: "ariaLabel",
601
+ publicName: "aria-label",
602
+ isSignal: true,
603
+ isRequired: false,
604
+ transformFunction: null
605
+ },
606
+ open: {
607
+ classPropertyName: "open",
608
+ publicName: "open",
609
+ isSignal: true,
610
+ isRequired: false,
611
+ transformFunction: null
612
+ },
613
+ shortcut: {
614
+ classPropertyName: "shortcut",
615
+ publicName: "shortcut",
616
+ isSignal: true,
617
+ isRequired: false,
618
+ transformFunction: null
619
+ },
620
+ width: {
621
+ classPropertyName: "width",
622
+ publicName: "width",
623
+ isSignal: true,
624
+ isRequired: false,
625
+ transformFunction: null
626
+ }
627
+ },
628
+ outputs: { open: "openChange" },
629
+ host: {
630
+ properties: { "attr.aria-label": "null" },
631
+ classAttribute: "hidden"
632
+ },
633
+ queries: [{
634
+ propertyName: "content",
635
+ first: true,
636
+ predicate: CommandDialogContentDirective,
637
+ descendants: true,
638
+ read: TemplateRef,
639
+ isSignal: true
640
+ }],
641
+ viewQueries: [{
642
+ propertyName: "panel",
643
+ first: true,
644
+ predicate: ["panel"],
645
+ descendants: true,
646
+ isSignal: true
647
+ }],
648
+ ngImport: i0,
649
+ template: "<ng-template #panel>\n <div\n cdkTrapFocus\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"ariaLabel() || messages().dialogLabel\"\n [class]=\"panelClass()\">\n <ng-container [ngTemplateOutlet]=\"content() ?? null\" />\n </div>\n</ng-template>\n",
650
+ dependencies: [
651
+ {
652
+ kind: "ngmodule",
653
+ type: A11yModule
654
+ },
655
+ {
656
+ kind: "directive",
657
+ type: i1.CdkTrapFocus,
658
+ selector: "[cdkTrapFocus]",
659
+ inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"],
660
+ exportAs: ["cdkTrapFocus"]
661
+ },
662
+ {
663
+ kind: "directive",
664
+ type: NgTemplateOutlet,
665
+ selector: "[ngTemplateOutlet]",
666
+ inputs: [
667
+ "ngTemplateOutletContext",
668
+ "ngTemplateOutlet",
669
+ "ngTemplateOutletInjector"
670
+ ]
671
+ }
672
+ ]
673
+ });
674
+ }
675
+ };
676
+ i0.ɵɵngDeclareClassMetadata({
677
+ minVersion: "12.0.0",
678
+ version: "22.2.6",
679
+ ngImport: i0,
680
+ type: CommandDialogComponent,
681
+ decorators: [{
682
+ type: Component,
683
+ args: [{
684
+ selector: "mona-command-dialog",
685
+ imports: [A11yModule, NgTemplateOutlet],
686
+ host: {
687
+ "[attr.aria-label]": "null",
688
+ class: "hidden"
689
+ },
690
+ template: "<ng-template #panel>\n <div\n cdkTrapFocus\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"ariaLabel() || messages().dialogLabel\"\n [class]=\"panelClass()\">\n <ng-container [ngTemplateOutlet]=\"content() ?? null\" />\n </div>\n</ng-template>\n"
691
+ }]
692
+ }],
693
+ ctorParameters: () => [],
694
+ propDecorators: {
695
+ content: [{
696
+ type: i0.ContentChild,
697
+ args: [i0.forwardRef(() => CommandDialogContentDirective), {
698
+ read: TemplateRef,
699
+ isSignal: true
700
+ }]
701
+ }],
702
+ panel: [{
703
+ type: i0.ViewChild,
704
+ args: ["panel", { isSignal: true }]
705
+ }],
706
+ ariaLabel: [{
707
+ type: i0.Input,
708
+ args: [{
709
+ isSignal: true,
710
+ alias: "aria-label",
711
+ required: false
712
+ }]
713
+ }],
714
+ open: [{
715
+ type: i0.Input,
716
+ args: [{
717
+ isSignal: true,
718
+ alias: "open",
719
+ required: false
720
+ }]
721
+ }, {
722
+ type: i0.Output,
723
+ args: ["openChange"]
724
+ }],
725
+ shortcut: [{
726
+ type: i0.Input,
727
+ args: [{
728
+ isSignal: true,
729
+ alias: "shortcut",
730
+ required: false
731
+ }]
732
+ }],
733
+ width: [{
734
+ type: i0.Input,
735
+ args: [{
736
+ isSignal: true,
737
+ alias: "width",
738
+ required: false
739
+ }]
740
+ }]
741
+ }
742
+ });
743
+ var CommandEmptyComponent = class CommandEmptyComponent {
744
+ constructor() {
745
+ this.root = inject(CommandComponent);
746
+ this.statusClass = computed(() => commandStatusThemeVariants(), ...ngDevMode ? [{ debugName: "statusClass" }] : /* istanbul ignore next */ []);
747
+ }
748
+ static {
749
+ this.ɵfac = i0.ɵɵngDeclareFactory({
750
+ minVersion: "12.0.0",
751
+ version: "22.2.6",
752
+ ngImport: i0,
753
+ type: CommandEmptyComponent,
754
+ deps: [],
755
+ target: i0.ɵɵFactoryTarget.Component
756
+ });
757
+ }
758
+ static {
759
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
760
+ minVersion: "17.0.0",
761
+ version: "22.2.6",
762
+ type: CommandEmptyComponent,
763
+ isStandalone: true,
764
+ selector: "mona-command-empty",
765
+ host: { classAttribute: "contents" },
766
+ ngImport: i0,
767
+ template: "@if (root.isEmpty()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().noResults }}</ng-content>\n </div>\n}\n"
768
+ });
769
+ }
770
+ };
771
+ i0.ɵɵngDeclareClassMetadata({
772
+ minVersion: "12.0.0",
773
+ version: "22.2.6",
774
+ ngImport: i0,
775
+ type: CommandEmptyComponent,
776
+ decorators: [{
777
+ type: Component,
778
+ args: [{
779
+ selector: "mona-command-empty",
780
+ host: { class: "contents" },
781
+ template: "@if (root.isEmpty()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().noResults }}</ng-content>\n </div>\n}\n"
782
+ }]
783
+ }]
784
+ });
785
+ var CommandFooterComponent = class CommandFooterComponent {
786
+ constructor() {
787
+ this.hostClass = computed(() => commandFooterThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
788
+ }
789
+ static {
790
+ this.ɵfac = i0.ɵɵngDeclareFactory({
791
+ minVersion: "12.0.0",
792
+ version: "22.2.6",
793
+ ngImport: i0,
794
+ type: CommandFooterComponent,
795
+ deps: [],
796
+ target: i0.ɵɵFactoryTarget.Component
797
+ });
798
+ }
799
+ static {
800
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
801
+ minVersion: "14.0.0",
802
+ version: "22.2.6",
803
+ type: CommandFooterComponent,
804
+ isStandalone: true,
805
+ selector: "mona-command-footer",
806
+ host: { properties: { "class": "hostClass()" } },
807
+ ngImport: i0,
808
+ template: "<ng-content />",
809
+ isInline: true
810
+ });
811
+ }
812
+ };
813
+ i0.ɵɵngDeclareClassMetadata({
814
+ minVersion: "12.0.0",
815
+ version: "22.2.6",
816
+ ngImport: i0,
817
+ type: CommandFooterComponent,
818
+ decorators: [{
819
+ type: Component,
820
+ args: [{
821
+ selector: "mona-command-footer",
822
+ template: "<ng-content />",
823
+ host: { "[class]": "hostClass()" }
824
+ }]
825
+ }]
826
+ });
827
+ var CommandGroupComponent = class CommandGroupComponent {
828
+ constructor() {
829
+ this.#items = signal(ImmutableSet.create(), ...ngDevMode ? [{ debugName: "#items" }] : /* istanbul ignore next */ []);
830
+ this.headingClass = computed(() => commandGroupHeadingThemeVariants(), ...ngDevMode ? [{ debugName: "headingClass" }] : /* istanbul ignore next */ []);
831
+ this.headingId = createElementControlId();
832
+ this.hostClass = computed(() => commandGroupThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
833
+ this.visible = computed(() => this.#items().any((item) => item.visible()), ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
834
+ this.heading = input(...ngDevMode ? [void 0, { debugName: "heading" }] : /* istanbul ignore next */ []);
835
+ }
836
+ #items;
837
+ register(item) {
838
+ this.#items.update((items) => items.add(item));
839
+ }
840
+ unregister(item) {
841
+ this.#items.update((items) => items.remove(item));
842
+ }
843
+ static {
844
+ this.ɵfac = i0.ɵɵngDeclareFactory({
845
+ minVersion: "12.0.0",
846
+ version: "22.2.6",
847
+ ngImport: i0,
848
+ type: CommandGroupComponent,
849
+ deps: [],
850
+ target: i0.ɵɵFactoryTarget.Component
851
+ });
852
+ }
853
+ static {
854
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
855
+ minVersion: "17.0.0",
856
+ version: "22.2.6",
857
+ type: CommandGroupComponent,
858
+ isStandalone: true,
859
+ selector: "mona-command-group",
860
+ inputs: { heading: {
861
+ classPropertyName: "heading",
862
+ publicName: "heading",
863
+ isSignal: true,
864
+ isRequired: false,
865
+ transformFunction: null
866
+ } },
867
+ host: {
868
+ attributes: { "role": "group" },
869
+ properties: {
870
+ "attr.aria-labelledby": "heading() ? headingId : null",
871
+ "class": "hostClass()",
872
+ "class.hidden": "!visible()"
873
+ }
874
+ },
875
+ ngImport: i0,
876
+ template: "@if (heading()) {\n <div [class]=\"headingClass()\" [id]=\"headingId\">{{ heading() }}</div>\n}\n<ng-content />\n"
877
+ });
878
+ }
879
+ };
880
+ i0.ɵɵngDeclareClassMetadata({
881
+ minVersion: "12.0.0",
882
+ version: "22.2.6",
883
+ ngImport: i0,
884
+ type: CommandGroupComponent,
885
+ decorators: [{
886
+ type: Component,
887
+ args: [{
888
+ selector: "mona-command-group",
889
+ host: {
890
+ role: "group",
891
+ "[attr.aria-labelledby]": "heading() ? headingId : null",
892
+ "[class]": "hostClass()",
893
+ "[class.hidden]": "!visible()"
894
+ },
895
+ template: "@if (heading()) {\n <div [class]=\"headingClass()\" [id]=\"headingId\">{{ heading() }}</div>\n}\n<ng-content />\n"
896
+ }]
897
+ }],
898
+ propDecorators: { heading: [{
899
+ type: i0.Input,
900
+ args: [{
901
+ isSignal: true,
902
+ alias: "heading",
903
+ required: false
904
+ }]
905
+ }] }
906
+ });
907
+ var CommandHeaderComponent = class CommandHeaderComponent {
908
+ constructor() {
909
+ this.hostClass = computed(() => commandHeaderThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
910
+ }
911
+ static {
912
+ this.ɵfac = i0.ɵɵngDeclareFactory({
913
+ minVersion: "12.0.0",
914
+ version: "22.2.6",
915
+ ngImport: i0,
916
+ type: CommandHeaderComponent,
917
+ deps: [],
918
+ target: i0.ɵɵFactoryTarget.Component
919
+ });
920
+ }
921
+ static {
922
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
923
+ minVersion: "14.0.0",
924
+ version: "22.2.6",
925
+ type: CommandHeaderComponent,
926
+ isStandalone: true,
927
+ selector: "mona-command-header",
928
+ host: { properties: { "class": "hostClass()" } },
929
+ ngImport: i0,
930
+ template: "<ng-content />",
931
+ isInline: true
932
+ });
933
+ }
934
+ };
935
+ i0.ɵɵngDeclareClassMetadata({
936
+ minVersion: "12.0.0",
937
+ version: "22.2.6",
938
+ ngImport: i0,
939
+ type: CommandHeaderComponent,
940
+ decorators: [{
941
+ type: Component,
942
+ args: [{
943
+ selector: "mona-command-header",
944
+ template: "<ng-content />",
945
+ host: { "[class]": "hostClass()" }
946
+ }]
947
+ }]
948
+ });
949
+ var CommandHighlightComponent = class CommandHighlightComponent {
950
+ constructor() {
951
+ this.#root = inject(CommandComponent);
952
+ this.markClass = computed(() => commandHighlightMarkThemeVariants(), ...ngDevMode ? [{ debugName: "markClass" }] : /* istanbul ignore next */ []);
953
+ this.parts = computed(() => splitByQuery(this.text(), this.#root.query()), ...ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []);
954
+ this.text = input.required(...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
955
+ }
956
+ #root;
957
+ static {
958
+ this.ɵfac = i0.ɵɵngDeclareFactory({
959
+ minVersion: "12.0.0",
960
+ version: "22.2.6",
961
+ ngImport: i0,
962
+ type: CommandHighlightComponent,
963
+ deps: [],
964
+ target: i0.ɵɵFactoryTarget.Component
965
+ });
966
+ }
967
+ static {
968
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
969
+ minVersion: "17.0.0",
970
+ version: "22.2.6",
971
+ type: CommandHighlightComponent,
972
+ isStandalone: true,
973
+ selector: "mona-command-highlight",
974
+ inputs: { text: {
975
+ classPropertyName: "text",
976
+ publicName: "text",
977
+ isSignal: true,
978
+ isRequired: true,
979
+ transformFunction: null
980
+ } },
981
+ ngImport: i0,
982
+ template: "@for (part of parts(); track $index) {\n @if (part.match) {\n <mark [class]=\"markClass()\">{{ part.text }}</mark>\n } @else {\n <span>{{ part.text }}</span>\n }\n}\n"
983
+ });
984
+ }
985
+ };
986
+ i0.ɵɵngDeclareClassMetadata({
987
+ minVersion: "12.0.0",
988
+ version: "22.2.6",
989
+ ngImport: i0,
990
+ type: CommandHighlightComponent,
991
+ decorators: [{
992
+ type: Component,
993
+ args: [{
994
+ selector: "mona-command-highlight",
995
+ template: "@for (part of parts(); track $index) {\n @if (part.match) {\n <mark [class]=\"markClass()\">{{ part.text }}</mark>\n } @else {\n <span>{{ part.text }}</span>\n }\n}\n"
996
+ }]
997
+ }],
998
+ propDecorators: { text: [{
999
+ type: i0.Input,
1000
+ args: [{
1001
+ isSignal: true,
1002
+ alias: "text",
1003
+ required: true
1004
+ }]
1005
+ }] }
1006
+ });
1007
+ var CommandInputComponent = class CommandInputComponent {
1008
+ constructor() {
1009
+ this.field = viewChild.required("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
1010
+ this.fieldClass = computed(() => commandInputFieldThemeVariants(), ...ngDevMode ? [{ debugName: "fieldClass" }] : /* istanbul ignore next */ []);
1011
+ this.hostClass = computed(() => commandInputThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
1012
+ this.iconClass = computed(() => commandInputIconThemeVariants(), ...ngDevMode ? [{ debugName: "iconClass" }] : /* istanbul ignore next */ []);
1013
+ this.root = inject(CommandComponent);
1014
+ this.ariaLabel = input(void 0, {
1015
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
1016
+ alias: "aria-label"
1017
+ });
1018
+ this.placeholder = input(...ngDevMode ? [void 0, { debugName: "placeholder" }] : /* istanbul ignore next */ []);
1019
+ afterNextRender({ read: () => this.root.registerInput(this.field().nativeElement) });
1020
+ }
1021
+ onInput(event) {
1022
+ this.root.query.set(event.target.value);
1023
+ }
1024
+ onKeydown(event) {
1025
+ if (event.isComposing) return;
1026
+ switch (event.key) {
1027
+ case "ArrowDown":
1028
+ event.preventDefault();
1029
+ this.root.move(1);
1030
+ break;
1031
+ case "ArrowUp":
1032
+ event.preventDefault();
1033
+ this.root.move(-1);
1034
+ break;
1035
+ case "Enter":
1036
+ event.preventDefault();
1037
+ this.root.selectActive(event);
1038
+ }
1039
+ }
1040
+ static {
1041
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1042
+ minVersion: "12.0.0",
1043
+ version: "22.2.6",
1044
+ ngImport: i0,
1045
+ type: CommandInputComponent,
1046
+ deps: [],
1047
+ target: i0.ɵɵFactoryTarget.Component
1048
+ });
1049
+ }
1050
+ static {
1051
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1052
+ minVersion: "17.2.0",
1053
+ version: "22.2.6",
1054
+ type: CommandInputComponent,
1055
+ isStandalone: true,
1056
+ selector: "mona-command-input",
1057
+ inputs: {
1058
+ ariaLabel: {
1059
+ classPropertyName: "ariaLabel",
1060
+ publicName: "aria-label",
1061
+ isSignal: true,
1062
+ isRequired: false,
1063
+ transformFunction: null
1064
+ },
1065
+ placeholder: {
1066
+ classPropertyName: "placeholder",
1067
+ publicName: "placeholder",
1068
+ isSignal: true,
1069
+ isRequired: false,
1070
+ transformFunction: null
1071
+ }
1072
+ },
1073
+ host: { properties: {
1074
+ "attr.aria-label": "null",
1075
+ "class": "hostClass()"
1076
+ } },
1077
+ viewQueries: [{
1078
+ propertyName: "field",
1079
+ first: true,
1080
+ predicate: ["field"],
1081
+ descendants: true,
1082
+ isSignal: true
1083
+ }],
1084
+ ngImport: i0,
1085
+ template: "<svg lucideSearch aria-hidden=\"true\" [class]=\"iconClass()\" [size]=\"16\"></svg>\n<input\n #field\n type=\"text\"\n role=\"combobox\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n spellcheck=\"false\"\n [attr.aria-activedescendant]=\"root.activeItem()?.id ?? null\"\n [attr.aria-controls]=\"root.listId\"\n [attr.aria-expanded]=\"root.resultCount() > 0\"\n [attr.aria-label]=\"ariaLabel() || root.messages().inputLabel\"\n [attr.placeholder]=\"placeholder() ?? root.messages().placeholder\"\n [class]=\"fieldClass()\"\n [value]=\"root.query()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\" />\n",
1086
+ dependencies: [{
1087
+ kind: "component",
1088
+ type: LucideSearch,
1089
+ selector: "svg[lucideSearch]"
1090
+ }]
1091
+ });
1092
+ }
1093
+ };
1094
+ i0.ɵɵngDeclareClassMetadata({
1095
+ minVersion: "12.0.0",
1096
+ version: "22.2.6",
1097
+ ngImport: i0,
1098
+ type: CommandInputComponent,
1099
+ decorators: [{
1100
+ type: Component,
1101
+ args: [{
1102
+ selector: "mona-command-input",
1103
+ imports: [LucideSearch],
1104
+ host: {
1105
+ "[attr.aria-label]": "null",
1106
+ "[class]": "hostClass()"
1107
+ },
1108
+ template: "<svg lucideSearch aria-hidden=\"true\" [class]=\"iconClass()\" [size]=\"16\"></svg>\n<input\n #field\n type=\"text\"\n role=\"combobox\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n aria-autocomplete=\"list\"\n spellcheck=\"false\"\n [attr.aria-activedescendant]=\"root.activeItem()?.id ?? null\"\n [attr.aria-controls]=\"root.listId\"\n [attr.aria-expanded]=\"root.resultCount() > 0\"\n [attr.aria-label]=\"ariaLabel() || root.messages().inputLabel\"\n [attr.placeholder]=\"placeholder() ?? root.messages().placeholder\"\n [class]=\"fieldClass()\"\n [value]=\"root.query()\"\n (input)=\"onInput($event)\"\n (keydown)=\"onKeydown($event)\" />\n"
1109
+ }]
1110
+ }],
1111
+ ctorParameters: () => [],
1112
+ propDecorators: {
1113
+ field: [{
1114
+ type: i0.ViewChild,
1115
+ args: ["field", { isSignal: true }]
1116
+ }],
1117
+ ariaLabel: [{
1118
+ type: i0.Input,
1119
+ args: [{
1120
+ isSignal: true,
1121
+ alias: "aria-label",
1122
+ required: false
1123
+ }]
1124
+ }],
1125
+ placeholder: [{
1126
+ type: i0.Input,
1127
+ args: [{
1128
+ isSignal: true,
1129
+ alias: "placeholder",
1130
+ required: false
1131
+ }]
1132
+ }]
1133
+ }
1134
+ });
1135
+ var CommandItemComponent = class CommandItemComponent {
1136
+ #element;
1137
+ #group;
1138
+ #root;
1139
+ constructor() {
1140
+ this.#element = inject(ElementRef);
1141
+ this.#group = inject(CommandGroupComponent, { optional: true });
1142
+ this.#root = inject(CommandComponent);
1143
+ this.active = computed(() => this.#root.activeItem() === this, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
1144
+ this.hostClass = computed(() => commandItemThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
1145
+ this.disabled = input(false, {
1146
+ ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
1147
+ transform: booleanAttribute
1148
+ });
1149
+ this.id = createElementControlId();
1150
+ this.itemSelect = output();
1151
+ this.keywords = input([], ...ngDevMode ? [{ debugName: "keywords" }] : /* istanbul ignore next */ []);
1152
+ this.value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
1153
+ this.visible = computed(() => this.#root.matches(this), ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
1154
+ this.#root.register(this);
1155
+ this.#group?.register(this);
1156
+ inject(DestroyRef).onDestroy(() => {
1157
+ this.#root.unregister(this);
1158
+ this.#group?.unregister(this);
1159
+ });
1160
+ }
1161
+ compareOrder(other) {
1162
+ return this.#element.nativeElement.compareDocumentPosition(other.#element.nativeElement) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
1163
+ }
1164
+ scrollIntoView() {
1165
+ this.#element.nativeElement.scrollIntoView({ block: "nearest" });
1166
+ }
1167
+ scrollListToTop() {
1168
+ const list = this.#element.nativeElement.closest("[role='listbox']");
1169
+ if (list) list.scrollTop = 0;
1170
+ }
1171
+ onClick(event) {
1172
+ this.#root.selectItem(this, event);
1173
+ }
1174
+ onPointerMove() {
1175
+ this.#root.setActive(this);
1176
+ }
1177
+ static {
1178
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1179
+ minVersion: "12.0.0",
1180
+ version: "22.2.6",
1181
+ ngImport: i0,
1182
+ type: CommandItemComponent,
1183
+ deps: [],
1184
+ target: i0.ɵɵFactoryTarget.Component
1185
+ });
1186
+ }
1187
+ static {
1188
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1189
+ minVersion: "17.1.0",
1190
+ version: "22.2.6",
1191
+ type: CommandItemComponent,
1192
+ isStandalone: true,
1193
+ selector: "mona-command-item",
1194
+ inputs: {
1195
+ disabled: {
1196
+ classPropertyName: "disabled",
1197
+ publicName: "disabled",
1198
+ isSignal: true,
1199
+ isRequired: false,
1200
+ transformFunction: null
1201
+ },
1202
+ keywords: {
1203
+ classPropertyName: "keywords",
1204
+ publicName: "keywords",
1205
+ isSignal: true,
1206
+ isRequired: false,
1207
+ transformFunction: null
1208
+ },
1209
+ value: {
1210
+ classPropertyName: "value",
1211
+ publicName: "value",
1212
+ isSignal: true,
1213
+ isRequired: true,
1214
+ transformFunction: null
1215
+ }
1216
+ },
1217
+ outputs: { itemSelect: "itemSelect" },
1218
+ host: {
1219
+ attributes: { "role": "option" },
1220
+ listeners: {
1221
+ "click": "onClick($event)",
1222
+ "mousedown": "$event.preventDefault()",
1223
+ "pointermove": "onPointerMove()"
1224
+ },
1225
+ properties: {
1226
+ "attr.aria-disabled": "disabled() || null",
1227
+ "attr.aria-selected": "active()",
1228
+ "attr.data-active": "active()",
1229
+ "attr.data-disabled": "disabled() || null",
1230
+ "class": "hostClass()",
1231
+ "class.hidden": "!visible()",
1232
+ "id": "id"
1233
+ }
1234
+ },
1235
+ ngImport: i0,
1236
+ template: "<ng-content />",
1237
+ isInline: true
1238
+ });
1239
+ }
1240
+ };
1241
+ i0.ɵɵngDeclareClassMetadata({
1242
+ minVersion: "12.0.0",
1243
+ version: "22.2.6",
1244
+ ngImport: i0,
1245
+ type: CommandItemComponent,
1246
+ decorators: [{
1247
+ type: Component,
1248
+ args: [{
1249
+ selector: "mona-command-item",
1250
+ template: "<ng-content />",
1251
+ host: {
1252
+ role: "option",
1253
+ "[attr.aria-disabled]": "disabled() || null",
1254
+ "[attr.aria-selected]": "active()",
1255
+ "[attr.data-active]": "active()",
1256
+ "[attr.data-disabled]": "disabled() || null",
1257
+ "[class]": "hostClass()",
1258
+ "[class.hidden]": "!visible()",
1259
+ "[id]": "id",
1260
+ "(click)": "onClick($event)",
1261
+ "(mousedown)": "$event.preventDefault()",
1262
+ "(pointermove)": "onPointerMove()"
1263
+ }
1264
+ }]
1265
+ }],
1266
+ ctorParameters: () => [],
1267
+ propDecorators: {
1268
+ disabled: [{
1269
+ type: i0.Input,
1270
+ args: [{
1271
+ isSignal: true,
1272
+ alias: "disabled",
1273
+ required: false
1274
+ }]
1275
+ }],
1276
+ itemSelect: [{
1277
+ type: i0.Output,
1278
+ args: ["itemSelect"]
1279
+ }],
1280
+ keywords: [{
1281
+ type: i0.Input,
1282
+ args: [{
1283
+ isSignal: true,
1284
+ alias: "keywords",
1285
+ required: false
1286
+ }]
1287
+ }],
1288
+ value: [{
1289
+ type: i0.Input,
1290
+ args: [{
1291
+ isSignal: true,
1292
+ alias: "value",
1293
+ required: true
1294
+ }]
1295
+ }]
1296
+ }
1297
+ });
1298
+ var CommandListComponent = class CommandListComponent {
1299
+ constructor() {
1300
+ this.listClass = computed(() => commandListThemeVariants(), ...ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []);
1301
+ this.root = inject(CommandComponent);
1302
+ this.ariaLabel = input(void 0, {
1303
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
1304
+ alias: "aria-label"
1305
+ });
1306
+ }
1307
+ static {
1308
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1309
+ minVersion: "12.0.0",
1310
+ version: "22.2.6",
1311
+ ngImport: i0,
1312
+ type: CommandListComponent,
1313
+ deps: [],
1314
+ target: i0.ɵɵFactoryTarget.Component
1315
+ });
1316
+ }
1317
+ static {
1318
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1319
+ minVersion: "17.1.0",
1320
+ version: "22.2.6",
1321
+ type: CommandListComponent,
1322
+ isStandalone: true,
1323
+ selector: "mona-command-list",
1324
+ inputs: { ariaLabel: {
1325
+ classPropertyName: "ariaLabel",
1326
+ publicName: "aria-label",
1327
+ isSignal: true,
1328
+ isRequired: false,
1329
+ transformFunction: null
1330
+ } },
1331
+ host: {
1332
+ properties: { "attr.aria-label": "null" },
1333
+ classAttribute: "flex min-h-0 flex-1 flex-col"
1334
+ },
1335
+ ngImport: i0,
1336
+ template: "<ng-content select=\"mona-command-empty, mona-command-loading\" />\n<div\n role=\"listbox\"\n [attr.aria-busy]=\"root.loading() || null\"\n [attr.aria-label]=\"ariaLabel() || root.messages().listLabel\"\n [class]=\"listClass()\"\n [class.hidden]=\"root.resultCount() === 0\"\n [id]=\"root.listId\">\n <ng-content />\n</div>\n"
1337
+ });
1338
+ }
1339
+ };
1340
+ i0.ɵɵngDeclareClassMetadata({
1341
+ minVersion: "12.0.0",
1342
+ version: "22.2.6",
1343
+ ngImport: i0,
1344
+ type: CommandListComponent,
1345
+ decorators: [{
1346
+ type: Component,
1347
+ args: [{
1348
+ selector: "mona-command-list",
1349
+ host: {
1350
+ "[attr.aria-label]": "null",
1351
+ class: "flex min-h-0 flex-1 flex-col"
1352
+ },
1353
+ template: "<ng-content select=\"mona-command-empty, mona-command-loading\" />\n<div\n role=\"listbox\"\n [attr.aria-busy]=\"root.loading() || null\"\n [attr.aria-label]=\"ariaLabel() || root.messages().listLabel\"\n [class]=\"listClass()\"\n [class.hidden]=\"root.resultCount() === 0\"\n [id]=\"root.listId\">\n <ng-content />\n</div>\n"
1354
+ }]
1355
+ }],
1356
+ propDecorators: { ariaLabel: [{
1357
+ type: i0.Input,
1358
+ args: [{
1359
+ isSignal: true,
1360
+ alias: "aria-label",
1361
+ required: false
1362
+ }]
1363
+ }] }
1364
+ });
1365
+ var CommandLoadingComponent = class CommandLoadingComponent {
1366
+ constructor() {
1367
+ this.root = inject(CommandComponent);
1368
+ this.statusClass = computed(() => commandStatusThemeVariants(), ...ngDevMode ? [{ debugName: "statusClass" }] : /* istanbul ignore next */ []);
1369
+ }
1370
+ static {
1371
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1372
+ minVersion: "12.0.0",
1373
+ version: "22.2.6",
1374
+ ngImport: i0,
1375
+ type: CommandLoadingComponent,
1376
+ deps: [],
1377
+ target: i0.ɵɵFactoryTarget.Component
1378
+ });
1379
+ }
1380
+ static {
1381
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1382
+ minVersion: "17.0.0",
1383
+ version: "22.2.6",
1384
+ type: CommandLoadingComponent,
1385
+ isStandalone: true,
1386
+ selector: "mona-command-loading",
1387
+ host: { classAttribute: "contents" },
1388
+ ngImport: i0,
1389
+ template: "@if (root.loading()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().loading }}</ng-content>\n </div>\n}\n"
1390
+ });
1391
+ }
1392
+ };
1393
+ i0.ɵɵngDeclareClassMetadata({
1394
+ minVersion: "12.0.0",
1395
+ version: "22.2.6",
1396
+ ngImport: i0,
1397
+ type: CommandLoadingComponent,
1398
+ decorators: [{
1399
+ type: Component,
1400
+ args: [{
1401
+ selector: "mona-command-loading",
1402
+ host: { class: "contents" },
1403
+ template: "@if (root.loading()) {\n <div [class]=\"statusClass()\">\n <ng-content>{{ root.messages().loading }}</ng-content>\n </div>\n}\n"
1404
+ }]
1405
+ }]
1406
+ });
1407
+ var CommandSeparatorComponent = class CommandSeparatorComponent {
1408
+ constructor() {
1409
+ this.#root = inject(CommandComponent);
1410
+ this.hidden = computed(() => this.#root.filterMode() === "auto" && this.#root.query().trim() !== "", ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
1411
+ this.hostClass = computed(() => commandSeparatorThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
1412
+ }
1413
+ #root;
1414
+ static {
1415
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1416
+ minVersion: "12.0.0",
1417
+ version: "22.2.6",
1418
+ ngImport: i0,
1419
+ type: CommandSeparatorComponent,
1420
+ deps: [],
1421
+ target: i0.ɵɵFactoryTarget.Component
1422
+ });
1423
+ }
1424
+ static {
1425
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1426
+ minVersion: "14.0.0",
1427
+ version: "22.2.6",
1428
+ type: CommandSeparatorComponent,
1429
+ isStandalone: true,
1430
+ selector: "mona-command-separator",
1431
+ host: {
1432
+ attributes: { "aria-hidden": "true" },
1433
+ properties: {
1434
+ "class": "hostClass()",
1435
+ "class.hidden": "hidden()"
1436
+ }
1437
+ },
1438
+ ngImport: i0,
1439
+ template: "",
1440
+ isInline: true
1441
+ });
1442
+ }
1443
+ };
1444
+ i0.ɵɵngDeclareClassMetadata({
1445
+ minVersion: "12.0.0",
1446
+ version: "22.2.6",
1447
+ ngImport: i0,
1448
+ type: CommandSeparatorComponent,
1449
+ decorators: [{
1450
+ type: Component,
1451
+ args: [{
1452
+ selector: "mona-command-separator",
1453
+ template: "",
1454
+ host: {
1455
+ "aria-hidden": "true",
1456
+ "[class]": "hostClass()",
1457
+ "[class.hidden]": "hidden()"
1458
+ }
1459
+ }]
1460
+ }]
1461
+ });
1462
+ var CommandShortcutComponent = class CommandShortcutComponent {
1463
+ constructor() {
1464
+ this.#apple = isApplePlatform(inject(DOCUMENT).defaultView);
1465
+ this.hostClass = computed(() => commandShortcutThemeVariants(), ...ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []);
1466
+ this.keyClass = computed(() => commandShortcutKeyThemeVariants(), ...ngDevMode ? [{ debugName: "keyClass" }] : /* istanbul ignore next */ []);
1467
+ this.parts = computed(() => describeShortcut(this.keys(), this.#apple), ...ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []);
1468
+ this.keys = input.required(...ngDevMode ? [{ debugName: "keys" }] : /* istanbul ignore next */ []);
1469
+ }
1470
+ #apple;
1471
+ static {
1472
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1473
+ minVersion: "12.0.0",
1474
+ version: "22.2.6",
1475
+ ngImport: i0,
1476
+ type: CommandShortcutComponent,
1477
+ deps: [],
1478
+ target: i0.ɵɵFactoryTarget.Component
1479
+ });
1480
+ }
1481
+ static {
1482
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1483
+ minVersion: "17.0.0",
1484
+ version: "22.2.6",
1485
+ type: CommandShortcutComponent,
1486
+ isStandalone: true,
1487
+ selector: "mona-command-shortcut",
1488
+ inputs: { keys: {
1489
+ classPropertyName: "keys",
1490
+ publicName: "keys",
1491
+ isSignal: true,
1492
+ isRequired: true,
1493
+ transformFunction: null
1494
+ } },
1495
+ host: { properties: { "class": "hostClass()" } },
1496
+ ngImport: i0,
1497
+ template: "@for (key of parts(); track $index) {\n <kbd aria-hidden=\"true\" [class]=\"keyClass()\">{{ key.symbol }}</kbd>\n <span class=\"sr-only\">{{ key.name }}</span>\n}\n"
1498
+ });
1499
+ }
1500
+ };
1501
+ i0.ɵɵngDeclareClassMetadata({
1502
+ minVersion: "12.0.0",
1503
+ version: "22.2.6",
1504
+ ngImport: i0,
1505
+ type: CommandShortcutComponent,
1506
+ decorators: [{
1507
+ type: Component,
1508
+ args: [{
1509
+ selector: "mona-command-shortcut",
1510
+ host: { "[class]": "hostClass()" },
1511
+ template: "@for (key of parts(); track $index) {\n <kbd aria-hidden=\"true\" [class]=\"keyClass()\">{{ key.symbol }}</kbd>\n <span class=\"sr-only\">{{ key.name }}</span>\n}\n"
1512
+ }]
1513
+ }],
1514
+ propDecorators: { keys: [{
1515
+ type: i0.Input,
1516
+ args: [{
1517
+ isSignal: true,
1518
+ alias: "keys",
1519
+ required: true
1520
+ }]
1521
+ }] }
1522
+ });
923
1523
  export { COMMAND_DEFAULT_MESSAGES, CommandComponent, CommandDialogComponent, CommandDialogContentDirective, CommandEmptyComponent, CommandFooterComponent, CommandGroupComponent, CommandHeaderComponent, CommandHighlightComponent, CommandInputComponent, CommandItemComponent, CommandListComponent, CommandLoadingComponent, CommandSeparatorComponent, CommandShortcutComponent, defaultCommandFilter };
924
- //# sourceMappingURL=nanahoshi-mona-ui-command.mjs.map
1524
+
1525
+ //# sourceMappingURL=nanahoshi-mona-ui-command.mjs.map