@nanahoshi/mona-ui 0.1.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 (134) hide show
  1. package/README.md +25 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
  3. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
  4. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
  5. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
  6. package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
  7. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
  8. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
  9. package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
  10. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
  11. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
  12. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
  13. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
  14. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
  15. package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
  16. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
  17. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
  18. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
  19. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
  20. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
  21. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
  22. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
  23. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
  24. package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
  25. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
  26. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
  27. package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
  28. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
  29. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
  30. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
  31. package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
  32. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
  33. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
  34. package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
  35. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
  36. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
  37. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
  38. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
  39. package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
  40. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
  41. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
  42. package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
  43. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
  44. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
  45. package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
  46. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
  47. package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
  48. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
  49. package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
  50. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
  51. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
  52. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
  53. package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
  54. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
  55. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
  56. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
  57. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
  58. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
  59. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
  60. package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
  61. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
  62. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
  63. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
  64. package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
  65. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
  66. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
  67. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
  68. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
  69. package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
  70. package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
  71. package/package.json +289 -0
  72. package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
  73. package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
  74. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
  75. package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
  76. package/types/nanahoshi-mona-ui-button.d.ts +111 -0
  77. package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
  78. package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
  79. package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
  80. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
  81. package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
  82. package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
  83. package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
  84. package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
  85. package/types/nanahoshi-mona-ui-common.d.ts +386 -0
  86. package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
  87. package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
  88. package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
  89. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
  90. package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
  91. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
  92. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
  93. package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
  94. package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
  95. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
  96. package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
  97. package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
  98. package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
  99. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
  100. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
  101. package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
  102. package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
  103. package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
  104. package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
  105. package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
  106. package/types/nanahoshi-mona-ui-list.d.ts +1 -0
  107. package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
  108. package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
  109. package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
  110. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
  111. package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
  112. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
  113. package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
  114. package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
  115. package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
  116. package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
  117. package/types/nanahoshi-mona-ui-query.d.ts +89 -0
  118. package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
  119. package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
  120. package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
  121. package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
  122. package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
  123. package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
  124. package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
  125. package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
  126. package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
  127. package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
  128. package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
  129. package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
  130. package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
  131. package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
  132. package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
  133. package/types/nanahoshi-mona-ui-window.d.ts +295 -0
  134. package/types/nanahoshi-mona-ui.d.ts +2 -0
@@ -0,0 +1,379 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, Renderer2, input, effect, Directive } from '@angular/core';
3
+ import { forEach, compact } from '@mirei/ts-collections';
4
+ import { Observable, timer, take, debounceTime, map, merge, scan, filter } from 'rxjs';
5
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
+ import { isIterable } from 'rxjs/internal/util/isIterable';
7
+
8
+ class AttributeBinderDirective {
9
+ #element;
10
+ #renderer;
11
+ constructor() {
12
+ this.#element = inject(ElementRef);
13
+ this.#renderer = inject(Renderer2);
14
+ this.attributes = input({}, { ...(ngDevMode ? { debugName: "attributes" } : /* istanbul ignore next */ {}), alias: "monaAttributeBinder" });
15
+ effect(() => {
16
+ const attributes = this.attributes();
17
+ for (const [key, value] of Object.entries(attributes)) {
18
+ if (value == null || value === false) {
19
+ this.#renderer.removeAttribute(this.#element.nativeElement, key);
20
+ }
21
+ else {
22
+ const attributeValue = typeof value === "boolean" ? String(value) : value;
23
+ this.#renderer.setAttribute(this.#element.nativeElement, key, attributeValue);
24
+ }
25
+ }
26
+ });
27
+ }
28
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AttributeBinderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
29
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: AttributeBinderDirective, isStandalone: true, selector: "[monaAttributeBinder]", inputs: { attributes: { classPropertyName: "attributes", publicName: "monaAttributeBinder", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
30
+ }
31
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AttributeBinderDirective, decorators: [{
32
+ type: Directive,
33
+ args: [{
34
+ selector: "[monaAttributeBinder]"
35
+ }]
36
+ }], ctorParameters: () => [], propDecorators: { attributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "monaAttributeBinder", required: false }] }] } });
37
+
38
+ const isValidHex = (hex) => {
39
+ return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(hex);
40
+ };
41
+ const isValidHsla = (hslaText) => {
42
+ return /^hsla?\(\s*(\d{1,2}|[1-2]\d{2}|3[0-5]\d|360)\s*,\s*(\d{1,2}|100)%\s*,\s*(\d{1,2}|100)%\s*(?:,\s*(0|1|0?\.\d+))?\s*\)$/.test(hslaText);
43
+ };
44
+ const isValidRgb = (rgbText) => {
45
+ return /^rgba?\(\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/.test(rgbText);
46
+ };
47
+
48
+ const hex2rgba = (hex) => {
49
+ let r = 0, g = 0, b = 0, a = 255;
50
+ if (hex.length == 4 || hex.length == 5) {
51
+ r = parseInt(hex[1] + hex[1], 16);
52
+ g = parseInt(hex[2] + hex[2], 16);
53
+ b = parseInt(hex[3] + hex[3], 16);
54
+ if (hex.length == 5) {
55
+ a = parseInt(hex[4] + hex[4], 16);
56
+ }
57
+ }
58
+ else if (hex.length == 7 || hex.length == 9) {
59
+ r = parseInt(hex.slice(1, 3), 16);
60
+ g = parseInt(hex.slice(3, 5), 16);
61
+ b = parseInt(hex.slice(5, 7), 16);
62
+ if (hex.length == 9) {
63
+ a = parseInt(hex.slice(7, 9), 16);
64
+ }
65
+ }
66
+ return { r: r, g: g, b: b, a: a };
67
+ };
68
+
69
+ const hsla2hsva = (hue, saturation, lightness, alpha) => {
70
+ if (hue == null || saturation == null || lightness == null) {
71
+ return { h: 0, s: 0, v: 0, a: 255 };
72
+ }
73
+ const h = hue;
74
+ const s = saturation / 100;
75
+ const l = lightness / 100;
76
+ const v = l + s * Math.min(l, 1 - l);
77
+ const sv = v === 0 ? 0 : 2 * (1 - l / v);
78
+ return {
79
+ h: h,
80
+ s: sv * 100,
81
+ v: v * 100,
82
+ a: alpha ?? 255
83
+ };
84
+ };
85
+
86
+ const hsva2rgba = (hue, saturation, value, alpha) => {
87
+ if (hue == null || saturation == null || value == null) {
88
+ return { r: 0, g: 0, b: 0, a: 255 };
89
+ }
90
+ const h = hue;
91
+ const s = saturation / 100;
92
+ const v = value / 100;
93
+ const f = (n, k = (n + h / 60) % 6) => v - v * s * Math.max(0, Math.min(k, 4 - k, 1));
94
+ return {
95
+ r: Math.round(f(5) * 255),
96
+ g: Math.round(f(3) * 255),
97
+ b: Math.round(f(1) * 255),
98
+ a: alpha ?? 255
99
+ };
100
+ };
101
+
102
+ const rgba2hex = (r, g, b, a) => {
103
+ if (r == null || g == null || b == null || a == null) {
104
+ return "";
105
+ }
106
+ let rHex = r.toString(16);
107
+ let gHex = g.toString(16);
108
+ let bHex = b.toString(16);
109
+ let aHex = a.toString(16);
110
+ if (rHex.length == 1)
111
+ rHex = "0" + rHex;
112
+ if (gHex.length == 1)
113
+ gHex = "0" + gHex;
114
+ if (bHex.length == 1)
115
+ bHex = "0" + bHex;
116
+ if (aHex.length == 1)
117
+ aHex = "0" + aHex;
118
+ return `#${rHex}${gHex}${bHex}${aHex.toUpperCase() !== "FF" ? aHex : ""}`;
119
+ };
120
+
121
+ const rgba2hsla = (red, green, blue, alpha) => {
122
+ if (red == null || green == null || blue == null) {
123
+ return { h: 0, s: 0, l: 0, a: 255 };
124
+ }
125
+ const r = red / 255;
126
+ const g = green / 255;
127
+ const b = blue / 255;
128
+ const max = Math.max(r, g, b);
129
+ const min = Math.min(r, g, b);
130
+ let h = 0;
131
+ let s;
132
+ const l = (max + min) / 2;
133
+ const d = max - min;
134
+ if (d === 0) {
135
+ h = s = 0;
136
+ }
137
+ else {
138
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
139
+ switch (max) {
140
+ case r:
141
+ h = (g - b) / d + (g < b ? 6 : 0);
142
+ break;
143
+ case g:
144
+ h = (b - r) / d + 2;
145
+ break;
146
+ case b:
147
+ h = (r - g) / d + 4;
148
+ break;
149
+ }
150
+ h /= 6;
151
+ }
152
+ return {
153
+ h: Math.round(h * 360),
154
+ s: Math.round(s * 100),
155
+ l: Math.round(l * 100),
156
+ a: alpha ?? 255
157
+ };
158
+ };
159
+
160
+ const rgba2hsva = (r, g, b, a) => {
161
+ if (r == null || g == null || b == null) {
162
+ return { h: 0, s: 0, v: 0, a: 255 };
163
+ }
164
+ r = r / 255;
165
+ g = g / 255;
166
+ b = b / 255;
167
+ const max = Math.max(r, g, b);
168
+ const min = Math.min(r, g, b);
169
+ let h = 0;
170
+ let s;
171
+ const v = max;
172
+ const d = max - min;
173
+ s = max === 0 ? 0 : d / max;
174
+ if (max !== min) {
175
+ if (max === r) {
176
+ h = (g - b) / d + (g < b ? 6 : 0);
177
+ }
178
+ else if (max === g) {
179
+ h = (b - r) / d + 2;
180
+ }
181
+ else if (max === b) {
182
+ h = (r - g) / d + 4;
183
+ }
184
+ h /= 6;
185
+ }
186
+ return {
187
+ h: Math.round(h * 360),
188
+ s: Math.round(s * 100),
189
+ v: Math.round(v * 100),
190
+ a: a ?? 255
191
+ };
192
+ };
193
+
194
+ const string2Hsla = (hslText) => {
195
+ const match = RegExp(/^hsla?\(\s*(\d{1,2}|[1-2]\d{2}|3[0-5]\d|360)\s*,\s*(\d{1,2}|100)%\s*,\s*(\d{1,2}|100)%\s*(?:,\s*(0|1|0?\.\d+))?\s*\)$/).exec(hslText);
196
+ if (match) {
197
+ return {
198
+ h: parseInt(match[1]),
199
+ s: parseInt(match[2]),
200
+ l: parseInt(match[3]),
201
+ a: match[4] ? Math.round(parseFloat(match[4]) * 255) : 255
202
+ };
203
+ }
204
+ return { h: 0, s: 0, l: 0, a: 255 };
205
+ };
206
+
207
+ const string2rgba = (rgbText) => {
208
+ const match = RegExp(/^rgba?\(\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\s*,\s*(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/).exec(rgbText);
209
+ if (match) {
210
+ return {
211
+ r: parseInt(match[1]),
212
+ g: parseInt(match[2]),
213
+ b: parseInt(match[3]),
214
+ a: match[4] ? Math.round(parseFloat(match[4]) * 255) : 255
215
+ };
216
+ }
217
+ return { r: 0, g: 0, b: 0, a: 255 };
218
+ };
219
+
220
+ /**
221
+ * Generates a unique control ID for an element.
222
+ * The ID consists of a prefix, a random hexadecimal string, and a suffix.
223
+ * @param {number} [level=0] - The nesting level of the element. This increases the length of the generated ID.
224
+ * @param {number} [length=7] - The base length of the random part of the ID.
225
+ * @returns {string} A unique control ID string for use for elements.
226
+ */
227
+ const createElementControlId = (level = 0, length = 7) => {
228
+ const idLength = length + level;
229
+ const prefix = "mona-";
230
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
231
+ const array = new Uint8Array(Math.ceil(idLength / 2));
232
+ crypto.getRandomValues(array);
233
+ const randomId = Array.from(array, byte => byte.toString(16).padStart(2, "0"))
234
+ .join("")
235
+ .substring(0, idLength);
236
+ return `${prefix}:${randomId}:`;
237
+ }
238
+ let hex = "";
239
+ const chars = "0123456789abcdef";
240
+ for (let i = 0; i < idLength; i++) {
241
+ hex += chars[Math.floor(Math.random() * 16)];
242
+ }
243
+ return `${prefix}:${hex}:`;
244
+ };
245
+
246
+ function focusElement(host, element) {
247
+ if (element instanceof ElementRef) {
248
+ element.nativeElement.focus();
249
+ }
250
+ else if (element instanceof HTMLElement) {
251
+ element.focus();
252
+ }
253
+ else {
254
+ const elements = host.querySelectorAll(element);
255
+ if (elements.length > 0) {
256
+ elements[0].focus();
257
+ }
258
+ }
259
+ }
260
+
261
+ const rxFromResize = (target, options) => {
262
+ return new Observable(observer => {
263
+ const elements = Array.isArray(target) ? target : [target];
264
+ for (const element of elements) {
265
+ if (!(element instanceof Element)) {
266
+ observer.error(new TypeError("target must be an Element or an iterable of Elements"));
267
+ return;
268
+ }
269
+ }
270
+ const resizeObserver = new ResizeObserver(entries => observer.next(entries));
271
+ forEach(elements, e => resizeObserver.observe(e, options));
272
+ return () => resizeObserver.disconnect();
273
+ });
274
+ };
275
+
276
+ const rxTimeout = (destroyRef, fn, delay = 0) => {
277
+ timer(delay)
278
+ .pipe(takeUntilDestroyed(destroyRef), take(1))
279
+ .subscribe(() => fn());
280
+ };
281
+
282
+ const restoreOverlayScroll = (overlayRef, element) => {
283
+ requestAnimationFrame(() => {
284
+ const scrollableContent = findScrollableElement(overlayRef.overlayElement);
285
+ const scrollTop = scrollableContent?.scrollTop ?? 0;
286
+ const width = element.getBoundingClientRect().width;
287
+ overlayRef.updatePosition();
288
+ overlayRef.updateSize({ width });
289
+ requestAnimationFrame(() => {
290
+ if (scrollableContent) {
291
+ scrollableContent.scrollTop = scrollTop;
292
+ }
293
+ });
294
+ });
295
+ };
296
+ const findScrollableElement = (container) => {
297
+ const virtualViewport = container.querySelector(".cdk-virtual-scroll-viewport");
298
+ if (virtualViewport) {
299
+ return virtualViewport;
300
+ }
301
+ const scrollable = container.querySelector("ul, [style*='overflow']");
302
+ if (scrollable && scrollable.scrollHeight > scrollable.clientHeight) {
303
+ return scrollable;
304
+ }
305
+ if (container.scrollHeight > container.clientHeight) {
306
+ return container;
307
+ }
308
+ return null;
309
+ };
310
+
311
+ const setWindowStyles = (element, settings) => {
312
+ if (!element) {
313
+ return;
314
+ }
315
+ const classes = isIterable(settings.windowClass) ? [...settings.windowClass] : [settings.windowClass];
316
+ compact(classes).forEach(className => element.classList.add(className));
317
+ const minWidth = settings.minWidth ? `${settings.minWidth}px` : "";
318
+ const minHeight = settings.minHeight ? `${settings.minHeight}px` : "";
319
+ const maxWidth = settings.maxWidth ? `${settings.maxWidth}px` : "";
320
+ const maxHeight = settings.maxHeight ? `${settings.maxHeight}px` : "";
321
+ const top = settings.top ? `${settings.top}px` : `calc(50% - ${element.getBoundingClientRect().height / 2}px)`;
322
+ const left = settings.left ? `${settings.left}px` : `calc(50% - ${element.getBoundingClientRect().width / 2}px)`;
323
+ const position = "absolute";
324
+ Object.assign(element.style, { left, maxHeight, maxWidth, minHeight, minWidth, position, top });
325
+ };
326
+
327
+ /**
328
+ * Converts a number or a string into a CSS-compliant value.
329
+ * - If the input is a number (e.g., 100), it appends 'px'.
330
+ * - If the input is a numeric string (e.g., "100"), it appends 'px'.
331
+ * - If the input is a string with a unit (e.g., "100px", "10rem"), it returns it as is.
332
+ *
333
+ * @param value The number or string to convert.
334
+ * @returns A CSS-compliant string value.
335
+ */
336
+ const toCssValue = (value) => {
337
+ if (value == null || value === "") {
338
+ return "";
339
+ }
340
+ if (typeof value === "number" || isFinite(Number(value))) {
341
+ return value === 0 ? "0" : `${value}px`;
342
+ }
343
+ return String(value);
344
+ };
345
+
346
+ var NavigationKeys;
347
+ (function (NavigationKeys) {
348
+ NavigationKeys["ArrowUp"] = "ArrowUp";
349
+ NavigationKeys["ArrowDown"] = "ArrowDown";
350
+ NavigationKeys["ArrowLeft"] = "ArrowLeft";
351
+ NavigationKeys["ArrowRight"] = "ArrowRight";
352
+ NavigationKeys["Enter"] = "Enter";
353
+ NavigationKeys["Escape"] = "Escape";
354
+ NavigationKeys["Home"] = "Home";
355
+ NavigationKeys["End"] = "End";
356
+ NavigationKeys["PageDown"] = "PageDown";
357
+ NavigationKeys["PageUp"] = "PageUp";
358
+ NavigationKeys["Space"] = " ";
359
+ })(NavigationKeys || (NavigationKeys = {}));
360
+ const NavigationKeysList = Object.keys(NavigationKeys);
361
+ const isNavigationKey = (key) => {
362
+ return NavigationKeysList.includes(key);
363
+ };
364
+
365
+ const isTypeaheadKey = (key) => {
366
+ return /^[a-zA-Z0-9\-_\s]$/.test(key);
367
+ };
368
+ const setupTypeahead = (typeaheadKey$) => {
369
+ const resetTrigger$ = typeaheadKey$.pipe(debounceTime(200), map(() => ({ type: "reset", value: "" })));
370
+ const keypress$ = typeaheadKey$.pipe(map(key => ({ type: "key", value: key })));
371
+ return merge(keypress$, resetTrigger$).pipe(scan((buffer, action) => (action.type === "reset" ? "" : buffer + action.value.toLowerCase()), ""), filter(buffer => buffer.length > 0));
372
+ };
373
+
374
+ /**
375
+ * Generated bundle index. Do not edit.
376
+ */
377
+
378
+ export { AttributeBinderDirective, NavigationKeys, NavigationKeysList, createElementControlId, focusElement, hex2rgba, hsla2hsva, hsva2rgba, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setWindowStyles, setupTypeahead, string2Hsla, string2rgba, toCssValue };
379
+ //# sourceMappingURL=nanahoshi-mona-ui-internal.mjs.map