@hyalo/angular 0.1.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/CHANGELOG.md +95 -41
  2. package/README.md +46 -32
  3. package/fesm2022/hyalo-angular-accordion.mjs +6 -6
  4. package/fesm2022/hyalo-angular-accordion.mjs.map +1 -1
  5. package/fesm2022/hyalo-angular-alert.mjs +171 -0
  6. package/fesm2022/hyalo-angular-alert.mjs.map +1 -0
  7. package/fesm2022/hyalo-angular-aspect-ratio.mjs +64 -0
  8. package/fesm2022/hyalo-angular-aspect-ratio.mjs.map +1 -0
  9. package/fesm2022/hyalo-angular-avatar.mjs +169 -0
  10. package/fesm2022/hyalo-angular-avatar.mjs.map +1 -0
  11. package/fesm2022/hyalo-angular-badge.mjs +268 -0
  12. package/fesm2022/hyalo-angular-badge.mjs.map +1 -0
  13. package/fesm2022/hyalo-angular-bento.mjs +132 -0
  14. package/fesm2022/hyalo-angular-bento.mjs.map +1 -0
  15. package/fesm2022/hyalo-angular-blocks.mjs +985 -0
  16. package/fesm2022/hyalo-angular-blocks.mjs.map +1 -0
  17. package/fesm2022/hyalo-angular-border-beam.mjs +73 -0
  18. package/fesm2022/hyalo-angular-border-beam.mjs.map +1 -0
  19. package/fesm2022/hyalo-angular-breadcrumb.mjs +77 -0
  20. package/fesm2022/hyalo-angular-breadcrumb.mjs.map +1 -0
  21. package/fesm2022/hyalo-angular-button-group.mjs +90 -0
  22. package/fesm2022/hyalo-angular-button-group.mjs.map +1 -0
  23. package/fesm2022/hyalo-angular-button.mjs +4 -3
  24. package/fesm2022/hyalo-angular-button.mjs.map +1 -1
  25. package/fesm2022/hyalo-angular-card.mjs +2 -2
  26. package/fesm2022/hyalo-angular-card.mjs.map +1 -1
  27. package/fesm2022/hyalo-angular-carousel.mjs +709 -0
  28. package/fesm2022/hyalo-angular-carousel.mjs.map +1 -0
  29. package/fesm2022/hyalo-angular-chapter-nav.mjs +336 -0
  30. package/fesm2022/hyalo-angular-chapter-nav.mjs.map +1 -0
  31. package/fesm2022/hyalo-angular-chart-engine-DSJop6He.mjs +5 -0
  32. package/fesm2022/hyalo-angular-chart-engine-DSJop6He.mjs.map +1 -0
  33. package/fesm2022/hyalo-angular-chart.mjs +391 -0
  34. package/fesm2022/hyalo-angular-chart.mjs.map +1 -0
  35. package/fesm2022/hyalo-angular-choice.mjs +2 -1
  36. package/fesm2022/hyalo-angular-choice.mjs.map +1 -1
  37. package/fesm2022/hyalo-angular-code-block-highlight-B20d5C76.mjs +40 -0
  38. package/fesm2022/hyalo-angular-code-block-highlight-B20d5C76.mjs.map +1 -0
  39. package/fesm2022/hyalo-angular-code-block.mjs +161 -0
  40. package/fesm2022/hyalo-angular-code-block.mjs.map +1 -0
  41. package/fesm2022/hyalo-angular-command.mjs +193 -0
  42. package/fesm2022/hyalo-angular-command.mjs.map +1 -0
  43. package/fesm2022/hyalo-angular-copy.mjs +138 -0
  44. package/fesm2022/hyalo-angular-copy.mjs.map +1 -0
  45. package/fesm2022/hyalo-angular-core.mjs +424 -0
  46. package/fesm2022/hyalo-angular-core.mjs.map +1 -0
  47. package/fesm2022/hyalo-angular-description-list.mjs +57 -0
  48. package/fesm2022/hyalo-angular-description-list.mjs.map +1 -0
  49. package/fesm2022/hyalo-angular-dialog.mjs +51 -22
  50. package/fesm2022/hyalo-angular-dialog.mjs.map +1 -1
  51. package/fesm2022/hyalo-angular-divider.mjs +66 -0
  52. package/fesm2022/hyalo-angular-divider.mjs.map +1 -0
  53. package/fesm2022/hyalo-angular-empty-state.mjs +123 -0
  54. package/fesm2022/hyalo-angular-empty-state.mjs.map +1 -0
  55. package/fesm2022/hyalo-angular-field.mjs +41 -9
  56. package/fesm2022/hyalo-angular-field.mjs.map +1 -1
  57. package/fesm2022/hyalo-angular-filter.mjs +309 -0
  58. package/fesm2022/hyalo-angular-filter.mjs.map +1 -0
  59. package/fesm2022/hyalo-angular-hotspot.mjs +225 -0
  60. package/fesm2022/hyalo-angular-hotspot.mjs.map +1 -0
  61. package/fesm2022/hyalo-angular-hover-card.mjs +233 -0
  62. package/fesm2022/hyalo-angular-hover-card.mjs.map +1 -0
  63. package/fesm2022/hyalo-angular-icon.mjs +42 -0
  64. package/fesm2022/hyalo-angular-icon.mjs.map +1 -1
  65. package/fesm2022/hyalo-angular-image-compare.mjs +168 -0
  66. package/fesm2022/hyalo-angular-image-compare.mjs.map +1 -0
  67. package/fesm2022/hyalo-angular-interaction.mjs +32 -41
  68. package/fesm2022/hyalo-angular-interaction.mjs.map +1 -1
  69. package/fesm2022/hyalo-angular-kbd.mjs +41 -0
  70. package/fesm2022/hyalo-angular-kbd.mjs.map +1 -0
  71. package/fesm2022/hyalo-angular-lightbox.mjs +228 -0
  72. package/fesm2022/hyalo-angular-lightbox.mjs.map +1 -0
  73. package/fesm2022/hyalo-angular-link.mjs +42 -0
  74. package/fesm2022/hyalo-angular-link.mjs.map +1 -0
  75. package/fesm2022/hyalo-angular-list.mjs +131 -0
  76. package/fesm2022/hyalo-angular-list.mjs.map +1 -0
  77. package/fesm2022/hyalo-angular-marquee.mjs +197 -0
  78. package/fesm2022/hyalo-angular-marquee.mjs.map +1 -0
  79. package/fesm2022/hyalo-angular-menu.mjs +423 -0
  80. package/fesm2022/hyalo-angular-menu.mjs.map +1 -0
  81. package/fesm2022/hyalo-angular-mesh.mjs +126 -0
  82. package/fesm2022/hyalo-angular-mesh.mjs.map +1 -0
  83. package/fesm2022/hyalo-angular-motion.mjs +620 -0
  84. package/fesm2022/hyalo-angular-motion.mjs.map +1 -0
  85. package/fesm2022/hyalo-angular-navbar.mjs +1 -1
  86. package/fesm2022/hyalo-angular-navbar.mjs.map +1 -1
  87. package/fesm2022/hyalo-angular-navigation-menu.mjs +222 -0
  88. package/fesm2022/hyalo-angular-navigation-menu.mjs.map +1 -0
  89. package/fesm2022/hyalo-angular-number-ticker.mjs +174 -0
  90. package/fesm2022/hyalo-angular-number-ticker.mjs.map +1 -0
  91. package/fesm2022/hyalo-angular-overlay.mjs +71 -2
  92. package/fesm2022/hyalo-angular-overlay.mjs.map +1 -1
  93. package/fesm2022/hyalo-angular-pagination.mjs +187 -0
  94. package/fesm2022/hyalo-angular-pagination.mjs.map +1 -0
  95. package/fesm2022/hyalo-angular-popover.mjs +34 -5
  96. package/fesm2022/hyalo-angular-popover.mjs.map +1 -1
  97. package/fesm2022/hyalo-angular-progress.mjs +209 -0
  98. package/fesm2022/hyalo-angular-progress.mjs.map +1 -0
  99. package/fesm2022/hyalo-angular-progressive-blur.mjs +73 -0
  100. package/fesm2022/hyalo-angular-progressive-blur.mjs.map +1 -0
  101. package/fesm2022/hyalo-angular-refraction-renderer-5ZA-kfsA.mjs +186 -0
  102. package/fesm2022/hyalo-angular-refraction-renderer-5ZA-kfsA.mjs.map +1 -0
  103. package/fesm2022/hyalo-angular-refraction.mjs +178 -0
  104. package/fesm2022/hyalo-angular-refraction.mjs.map +1 -0
  105. package/fesm2022/hyalo-angular-scroll-area.mjs +93 -0
  106. package/fesm2022/hyalo-angular-scroll-area.mjs.map +1 -0
  107. package/fesm2022/hyalo-angular-scroll-to-top.mjs +127 -0
  108. package/fesm2022/hyalo-angular-scroll-to-top.mjs.map +1 -0
  109. package/fesm2022/hyalo-angular-segmented.mjs +1 -1
  110. package/fesm2022/hyalo-angular-segmented.mjs.map +1 -1
  111. package/fesm2022/hyalo-angular-select.mjs +112 -15
  112. package/fesm2022/hyalo-angular-select.mjs.map +1 -1
  113. package/fesm2022/hyalo-angular-sidebar.mjs +241 -0
  114. package/fesm2022/hyalo-angular-sidebar.mjs.map +1 -0
  115. package/fesm2022/hyalo-angular-skeleton.mjs +131 -0
  116. package/fesm2022/hyalo-angular-skeleton.mjs.map +1 -0
  117. package/fesm2022/hyalo-angular-sparkline.mjs +110 -0
  118. package/fesm2022/hyalo-angular-sparkline.mjs.map +1 -0
  119. package/fesm2022/hyalo-angular-split-text.mjs +126 -0
  120. package/fesm2022/hyalo-angular-split-text.mjs.map +1 -0
  121. package/fesm2022/hyalo-angular-stat.mjs +193 -0
  122. package/fesm2022/hyalo-angular-stat.mjs.map +1 -0
  123. package/fesm2022/hyalo-angular-stepper.mjs +254 -0
  124. package/fesm2022/hyalo-angular-stepper.mjs.map +1 -0
  125. package/fesm2022/hyalo-angular-table.mjs +335 -0
  126. package/fesm2022/hyalo-angular-table.mjs.map +1 -0
  127. package/fesm2022/hyalo-angular-tabs.mjs +1 -1
  128. package/fesm2022/hyalo-angular-tabs.mjs.map +1 -1
  129. package/fesm2022/hyalo-angular-theme.mjs +1 -1
  130. package/fesm2022/hyalo-angular-theme.mjs.map +1 -1
  131. package/fesm2022/hyalo-angular-timeline.mjs +157 -0
  132. package/fesm2022/hyalo-angular-timeline.mjs.map +1 -0
  133. package/fesm2022/hyalo-angular-toast.mjs +2 -1
  134. package/fesm2022/hyalo-angular-toast.mjs.map +1 -1
  135. package/fesm2022/hyalo-angular.mjs +2 -473
  136. package/package.json +198 -2
  137. package/styles/parts/field.css +44 -36
  138. package/styles/parts/glass.css +2 -0
  139. package/styles/parts/motion.css +19 -0
  140. package/styles/parts/typography.css +17 -0
  141. package/types/hyalo-angular-accordion.d.ts +1 -1
  142. package/types/hyalo-angular-alert.d.ts +47 -0
  143. package/types/hyalo-angular-aspect-ratio.d.ts +13 -0
  144. package/types/hyalo-angular-avatar.d.ts +39 -0
  145. package/types/hyalo-angular-badge.d.ts +82 -0
  146. package/types/hyalo-angular-bento.d.ts +25 -0
  147. package/types/hyalo-angular-blocks.d.ts +272 -0
  148. package/types/hyalo-angular-border-beam.d.ts +15 -0
  149. package/types/hyalo-angular-breadcrumb.d.ts +22 -0
  150. package/types/hyalo-angular-button-group.d.ts +19 -0
  151. package/types/hyalo-angular-button.d.ts +4 -3
  152. package/types/hyalo-angular-card.d.ts +1 -1
  153. package/types/hyalo-angular-carousel.d.ts +147 -0
  154. package/types/hyalo-angular-chapter-nav.d.ts +79 -0
  155. package/types/hyalo-angular-chart.d.ts +90 -0
  156. package/types/hyalo-angular-code-block.d.ts +46 -0
  157. package/types/hyalo-angular-command.d.ts +41 -0
  158. package/types/hyalo-angular-copy.d.ts +39 -0
  159. package/types/hyalo-angular-core.d.ts +210 -0
  160. package/types/hyalo-angular-description-list.d.ts +16 -0
  161. package/types/hyalo-angular-dialog.d.ts +2 -1
  162. package/types/hyalo-angular-divider.d.ts +12 -0
  163. package/types/hyalo-angular-empty-state.d.ts +30 -0
  164. package/types/hyalo-angular-field.d.ts +10 -4
  165. package/types/hyalo-angular-filter.d.ts +122 -0
  166. package/types/hyalo-angular-hotspot.d.ts +70 -0
  167. package/types/hyalo-angular-hover-card.d.ts +47 -0
  168. package/types/hyalo-angular-image-compare.d.ts +55 -0
  169. package/types/hyalo-angular-kbd.d.ts +5 -0
  170. package/types/hyalo-angular-lightbox.d.ts +67 -0
  171. package/types/hyalo-angular-link.d.ts +5 -0
  172. package/types/hyalo-angular-list.d.ts +30 -0
  173. package/types/hyalo-angular-marquee.d.ts +48 -0
  174. package/types/hyalo-angular-menu.d.ts +105 -0
  175. package/types/hyalo-angular-mesh.d.ts +36 -0
  176. package/types/hyalo-angular-motion.d.ts +218 -0
  177. package/types/hyalo-angular-navigation-menu.d.ts +47 -0
  178. package/types/hyalo-angular-number-ticker.d.ts +52 -0
  179. package/types/hyalo-angular-overlay.d.ts +9 -0
  180. package/types/hyalo-angular-pagination.d.ts +59 -0
  181. package/types/hyalo-angular-popover.d.ts +10 -0
  182. package/types/hyalo-angular-progress.d.ts +46 -0
  183. package/types/hyalo-angular-progressive-blur.d.ts +14 -0
  184. package/types/hyalo-angular-refraction.d.ts +46 -0
  185. package/types/hyalo-angular-scroll-area.d.ts +18 -0
  186. package/types/hyalo-angular-scroll-to-top.d.ts +31 -0
  187. package/types/hyalo-angular-segmented.d.ts +1 -1
  188. package/types/hyalo-angular-select.d.ts +49 -3
  189. package/types/hyalo-angular-sidebar.d.ts +57 -0
  190. package/types/hyalo-angular-skeleton.d.ts +34 -0
  191. package/types/hyalo-angular-sparkline.d.ts +19 -0
  192. package/types/hyalo-angular-split-text.d.ts +24 -0
  193. package/types/hyalo-angular-stat.d.ts +56 -0
  194. package/types/hyalo-angular-stepper.d.ts +63 -0
  195. package/types/hyalo-angular-table.d.ts +125 -0
  196. package/types/hyalo-angular-timeline.d.ts +36 -0
  197. package/types/hyalo-angular.d.ts +2 -345
  198. package/fesm2022/hyalo-angular.mjs.map +0 -1
@@ -0,0 +1,424 @@
1
+ import * as i0 from "@angular/core";
2
+ import { DOCUMENT, DestroyRef, Directive, ElementRef, Injectable, InjectionToken, PLATFORM_ID, afterNextRender, afterRenderEffect, booleanAttribute, computed, effect, inject, input, signal } from "@angular/core";
3
+ import { FocusMonitor, _IdGenerator } from "@angular/cdk/a11y";
4
+ import { isPlatformBrowser } from "@angular/common";
5
+ const DEFAULTS = {
6
+ material: "frosted",
7
+ size: "md",
8
+ tone: "primary"
9
+ };
10
+ const HY_CONFIG = new InjectionToken("HY_CONFIG", {
11
+ providedIn: "root",
12
+ factory: () => DEFAULTS
13
+ });
14
+ function provideHyalo(config = {}) {
15
+ return {
16
+ provide: HY_CONFIG,
17
+ useFactory: () => {
18
+ return {
19
+ ...inject(HY_CONFIG, {
20
+ skipSelf: true,
21
+ optional: true
22
+ }) ?? DEFAULTS,
23
+ ...config
24
+ };
25
+ }
26
+ };
27
+ }
28
+ function injectId(prefix) {
29
+ return inject(_IdGenerator).getId(`hy-${prefix}-`);
30
+ }
31
+ function injectIsBrowser() {
32
+ return isPlatformBrowser(inject(PLATFORM_ID));
33
+ }
34
+ function matchesMedia(query) {
35
+ return typeof matchMedia === "function" && matchMedia(query).matches;
36
+ }
37
+ function detectFidelity(nav) {
38
+ if (nav.connection?.saveData) return "low";
39
+ const memory = nav.deviceMemory ?? 8, cores = nav.hardwareConcurrency ?? 8;
40
+ if (memory <= 2 || cores <= 2) return "low";
41
+ if (memory <= 4 || cores <= 4 || matchesMedia("(pointer: coarse)")) return "medium";
42
+ return "high";
43
+ }
44
+ var HyFidelity = class HyFidelity {
45
+ config = inject(HY_CONFIG);
46
+ document = inject(DOCUMENT);
47
+ detectedTier = signal("medium", ...ngDevMode ? [{ debugName: "detectedTier" }] : /* istanbul ignore next */ []);
48
+ selectedTier = signal(this.config.fidelity ?? null, ...ngDevMode ? [{ debugName: "selectedTier" }] : /* istanbul ignore next */ []);
49
+ detected = this.detectedTier.asReadonly();
50
+ override = this.selectedTier.asReadonly();
51
+ tier = computed(() => this.selectedTier() ?? this.detectedTier(), ...ngDevMode ? [{ debugName: "tier" }] : /* istanbul ignore next */ []);
52
+ constructor() {
53
+ if (!injectIsBrowser()) return;
54
+ afterNextRender(() => this.detectedTier.set(detectFidelity(navigator)));
55
+ effect(() => this.document.documentElement.setAttribute("data-hy-fidelity", this.tier()));
56
+ }
57
+ setTier(tier) {
58
+ this.selectedTier.set(tier);
59
+ }
60
+ static ɵfac = i0.ɵɵngDeclareFactory({
61
+ minVersion: "12.0.0",
62
+ version: "22.2.3",
63
+ ngImport: i0,
64
+ type: HyFidelity,
65
+ deps: [],
66
+ target: i0.ɵɵFactoryTarget.Injectable
67
+ });
68
+ static ɵprov = i0.ɵɵngDeclareInjectable({
69
+ minVersion: "12.0.0",
70
+ version: "22.2.3",
71
+ ngImport: i0,
72
+ type: HyFidelity,
73
+ providedIn: "root"
74
+ });
75
+ };
76
+ i0.ɵɵngDeclareClassMetadata({
77
+ minVersion: "12.0.0",
78
+ version: "22.2.3",
79
+ ngImport: i0,
80
+ type: HyFidelity,
81
+ decorators: [{
82
+ type: Injectable,
83
+ args: [{ providedIn: "root" }]
84
+ }],
85
+ ctorParameters: () => []
86
+ });
87
+ var HyAppearance = class HyAppearance {
88
+ material = signal(null, ...ngDevMode ? [{ debugName: "material" }] : /* istanbul ignore next */ []);
89
+ static ɵfac = i0.ɵɵngDeclareFactory({
90
+ minVersion: "12.0.0",
91
+ version: "22.2.3",
92
+ ngImport: i0,
93
+ type: HyAppearance,
94
+ deps: [],
95
+ target: i0.ɵɵFactoryTarget.Injectable
96
+ });
97
+ static ɵprov = i0.ɵɵngDeclareInjectable({
98
+ minVersion: "12.0.0",
99
+ version: "22.2.3",
100
+ ngImport: i0,
101
+ type: HyAppearance,
102
+ providedIn: "root"
103
+ });
104
+ };
105
+ i0.ɵɵngDeclareClassMetadata({
106
+ minVersion: "12.0.0",
107
+ version: "22.2.3",
108
+ ngImport: i0,
109
+ type: HyAppearance,
110
+ decorators: [{
111
+ type: Injectable,
112
+ args: [{ providedIn: "root" }]
113
+ }]
114
+ });
115
+ var HyLocale = class HyLocale {
116
+ locale = signal(inject(HY_CONFIG).locale ?? "en", ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
117
+ setLocale(value) {
118
+ this.locale.set(Intl.getCanonicalLocales(value)[0] ?? "en");
119
+ }
120
+ static ɵfac = i0.ɵɵngDeclareFactory({
121
+ minVersion: "12.0.0",
122
+ version: "22.2.3",
123
+ ngImport: i0,
124
+ type: HyLocale,
125
+ deps: [],
126
+ target: i0.ɵɵFactoryTarget.Injectable
127
+ });
128
+ static ɵprov = i0.ɵɵngDeclareInjectable({
129
+ minVersion: "12.0.0",
130
+ version: "22.2.3",
131
+ ngImport: i0,
132
+ type: HyLocale,
133
+ providedIn: "root"
134
+ });
135
+ };
136
+ i0.ɵɵngDeclareClassMetadata({
137
+ minVersion: "12.0.0",
138
+ version: "22.2.3",
139
+ ngImport: i0,
140
+ type: HyLocale,
141
+ decorators: [{
142
+ type: Injectable,
143
+ args: [{ providedIn: "root" }]
144
+ }]
145
+ });
146
+ var HyMaterialDirective = class HyMaterialDirective {
147
+ config = inject(HY_CONFIG);
148
+ appearance = inject(HyAppearance);
149
+ fidelity = inject(HyFidelity);
150
+ material = input(void 0, {
151
+ ...ngDevMode ? { debugName: "material" } : /* istanbul ignore next */ {},
152
+ alias: "hyMaterial"
153
+ });
154
+ thickness = input("regular", ...ngDevMode ? [{ debugName: "thickness" }] : /* istanbul ignore next */ []);
155
+ resolved = computed(() => {
156
+ if (this.fidelity.tier() === "low") return "solid";
157
+ return this.appearance.material() ?? (this.material() || this.config.material);
158
+ }, ...ngDevMode ? [{ debugName: "resolved" }] : /* istanbul ignore next */ []);
159
+ static ɵfac = i0.ɵɵngDeclareFactory({
160
+ minVersion: "12.0.0",
161
+ version: "22.2.3",
162
+ ngImport: i0,
163
+ type: HyMaterialDirective,
164
+ deps: [],
165
+ target: i0.ɵɵFactoryTarget.Directive
166
+ });
167
+ static ɵdir = i0.ɵɵngDeclareDirective({
168
+ minVersion: "17.1.0",
169
+ version: "22.2.3",
170
+ type: HyMaterialDirective,
171
+ isStandalone: true,
172
+ selector: "[hyMaterial]",
173
+ inputs: {
174
+ material: {
175
+ classPropertyName: "material",
176
+ publicName: "hyMaterial",
177
+ isSignal: true,
178
+ isRequired: false,
179
+ transformFunction: null
180
+ },
181
+ thickness: {
182
+ classPropertyName: "thickness",
183
+ publicName: "thickness",
184
+ isSignal: true,
185
+ isRequired: false,
186
+ transformFunction: null
187
+ }
188
+ },
189
+ host: {
190
+ properties: {
191
+ "attr.data-material": "resolved()",
192
+ "attr.data-thickness": "thickness() === \"regular\" ? null : thickness()"
193
+ },
194
+ classAttribute: "hy-glass"
195
+ },
196
+ ngImport: i0
197
+ });
198
+ };
199
+ i0.ɵɵngDeclareClassMetadata({
200
+ minVersion: "12.0.0",
201
+ version: "22.2.3",
202
+ ngImport: i0,
203
+ type: HyMaterialDirective,
204
+ decorators: [{
205
+ type: Directive,
206
+ args: [{
207
+ selector: "[hyMaterial]",
208
+ host: {
209
+ class: "hy-glass",
210
+ "[attr.data-material]": "resolved()",
211
+ "[attr.data-thickness]": "thickness() === \"regular\" ? null : thickness()"
212
+ }
213
+ }]
214
+ }],
215
+ propDecorators: {
216
+ material: [{
217
+ type: i0.Input,
218
+ args: [{
219
+ isSignal: true,
220
+ alias: "hyMaterial",
221
+ required: false
222
+ }]
223
+ }],
224
+ thickness: [{
225
+ type: i0.Input,
226
+ args: [{
227
+ isSignal: true,
228
+ alias: "thickness",
229
+ required: false
230
+ }]
231
+ }]
232
+ }
233
+ });
234
+ var HyInteractive = class HyInteractive {
235
+ host = inject(ElementRef);
236
+ focusMonitor = inject(FocusMonitor);
237
+ hovered = signal(false, ...ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []);
238
+ pressed = signal(false, ...ngDevMode ? [{ debugName: "pressed" }] : /* istanbul ignore next */ []);
239
+ focusVisible = signal(false, ...ngDevMode ? [{ debugName: "focusVisible" }] : /* istanbul ignore next */ []);
240
+ constructor() {
241
+ afterNextRender(() => {
242
+ this.focusMonitor.monitor(this.host).subscribe((origin) => {
243
+ this.focusVisible.set(origin === "keyboard");
244
+ });
245
+ });
246
+ inject(DestroyRef).onDestroy(() => this.focusMonitor.stopMonitoring(this.host));
247
+ }
248
+ onEnter(event) {
249
+ if (event.pointerType !== "touch") this.hovered.set(true);
250
+ }
251
+ static ɵfac = i0.ɵɵngDeclareFactory({
252
+ minVersion: "12.0.0",
253
+ version: "22.2.3",
254
+ ngImport: i0,
255
+ type: HyInteractive,
256
+ deps: [],
257
+ target: i0.ɵɵFactoryTarget.Directive
258
+ });
259
+ static ɵdir = i0.ɵɵngDeclareDirective({
260
+ minVersion: "14.0.0",
261
+ version: "22.2.3",
262
+ type: HyInteractive,
263
+ isStandalone: true,
264
+ selector: "[hyInteractive]",
265
+ host: {
266
+ listeners: {
267
+ "pointerenter": "onEnter($event)",
268
+ "pointerleave": "hovered.set(false); pressed.set(false)",
269
+ "pointerdown": "pressed.set(true)",
270
+ "pointerup": "pressed.set(false)",
271
+ "pointercancel": "pressed.set(false)"
272
+ },
273
+ properties: {
274
+ "attr.data-hover": "hovered() || null",
275
+ "attr.data-press": "pressed() || null",
276
+ "attr.data-focus-visible": "focusVisible() || null"
277
+ }
278
+ },
279
+ ngImport: i0
280
+ });
281
+ };
282
+ i0.ɵɵngDeclareClassMetadata({
283
+ minVersion: "12.0.0",
284
+ version: "22.2.3",
285
+ ngImport: i0,
286
+ type: HyInteractive,
287
+ decorators: [{
288
+ type: Directive,
289
+ args: [{
290
+ selector: "[hyInteractive]",
291
+ host: {
292
+ "[attr.data-hover]": "hovered() || null",
293
+ "[attr.data-press]": "pressed() || null",
294
+ "[attr.data-focus-visible]": "focusVisible() || null",
295
+ "(pointerenter)": "onEnter($event)",
296
+ "(pointerleave)": "hovered.set(false); pressed.set(false)",
297
+ "(pointerdown)": "pressed.set(true)",
298
+ "(pointerup)": "pressed.set(false)",
299
+ "(pointercancel)": "pressed.set(false)"
300
+ }
301
+ }]
302
+ }],
303
+ ctorParameters: () => []
304
+ });
305
+ function trackIndicator(container, selected) {
306
+ const ready = signal(false, ...ngDevMode ? [{ debugName: "ready" }] : /* istanbul ignore next */ []);
307
+ const size = signal(0, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
308
+ const destroyRef = inject(DestroyRef);
309
+ let frame = 0;
310
+ destroyRef.onDestroy(() => {
311
+ if (frame) cancelAnimationFrame(frame);
312
+ });
313
+ afterNextRender(() => {
314
+ const row = container()?.nativeElement;
315
+ if (!row || typeof ResizeObserver !== "function") return;
316
+ const observer = new ResizeObserver(() => size.update((v) => v + 1));
317
+ observer.observe(row);
318
+ destroyRef.onDestroy(() => observer.disconnect());
319
+ });
320
+ afterRenderEffect({
321
+ earlyRead: () => {
322
+ size();
323
+ const row = container()?.nativeElement;
324
+ const item = selected();
325
+ if (!row || !item) return null;
326
+ const rowRect = row.getBoundingClientRect();
327
+ const rect = item.getBoundingClientRect();
328
+ const scale = row.offsetWidth ? rowRect.width / row.offsetWidth : 1;
329
+ return {
330
+ row,
331
+ x: (rect.left - rowRect.left) / scale + row.scrollLeft,
332
+ size: rect.width / scale
333
+ };
334
+ },
335
+ write: (measured) => {
336
+ const m = measured();
337
+ if (!m) return;
338
+ m.row.style.setProperty("--hy-ind-x", `${m.x}px`);
339
+ m.row.style.setProperty("--hy-ind-size", `${m.size}px`);
340
+ if (!ready() && !frame) frame = requestAnimationFrame(() => {
341
+ frame = 0;
342
+ ready.set(true);
343
+ });
344
+ }
345
+ });
346
+ return ready.asReadonly();
347
+ }
348
+ function normalizeDigits(value) {
349
+ return value.replace(/[\u0660-\u0669\u06f0-\u06f9]/gu, (digit) => String(digit.charCodeAt(0) - (digit.charCodeAt(0) >= 1776 ? 1776 : 1632)));
350
+ }
351
+ var HyDigits = class HyDigits {
352
+ hyDigits = input(true, {
353
+ ...ngDevMode ? { debugName: "hyDigits" } : /* istanbul ignore next */ {},
354
+ transform: booleanAttribute
355
+ });
356
+ el = inject(ElementRef).nativeElement;
357
+ normalize(event) {
358
+ if (!this.hyDigits() || "isComposing" in event && event.isComposing) return;
359
+ const before = this.el.value;
360
+ const after = normalizeDigits(before);
361
+ if (before === after) return;
362
+ const start = this.el.selectionStart, end = this.el.selectionEnd;
363
+ this.el.value = after;
364
+ if (start !== null && end !== null) this.el.setSelectionRange(start, end);
365
+ this.el.dispatchEvent(new Event("input", { bubbles: true }));
366
+ }
367
+ static ɵfac = i0.ɵɵngDeclareFactory({
368
+ minVersion: "12.0.0",
369
+ version: "22.2.3",
370
+ ngImport: i0,
371
+ type: HyDigits,
372
+ deps: [],
373
+ target: i0.ɵɵFactoryTarget.Directive
374
+ });
375
+ static ɵdir = i0.ɵɵngDeclareDirective({
376
+ minVersion: "17.1.0",
377
+ version: "22.2.3",
378
+ type: HyDigits,
379
+ isStandalone: true,
380
+ selector: "input[hyDigits],textarea[hyDigits]",
381
+ inputs: { hyDigits: {
382
+ classPropertyName: "hyDigits",
383
+ publicName: "hyDigits",
384
+ isSignal: true,
385
+ isRequired: false,
386
+ transformFunction: null
387
+ } },
388
+ host: { listeners: {
389
+ "input": "normalize($event)",
390
+ "compositionend": "normalize($event)"
391
+ } },
392
+ ngImport: i0
393
+ });
394
+ };
395
+ i0.ɵɵngDeclareClassMetadata({
396
+ minVersion: "12.0.0",
397
+ version: "22.2.3",
398
+ ngImport: i0,
399
+ type: HyDigits,
400
+ decorators: [{
401
+ type: Directive,
402
+ args: [{
403
+ selector: "input[hyDigits],textarea[hyDigits]",
404
+ host: {
405
+ "(input)": "normalize($event)",
406
+ "(compositionend)": "normalize($event)"
407
+ }
408
+ }]
409
+ }],
410
+ propDecorators: { hyDigits: [{
411
+ type: i0.Input,
412
+ args: [{
413
+ isSignal: true,
414
+ alias: "hyDigits",
415
+ required: false
416
+ }]
417
+ }] }
418
+ });
419
+ function normalizeSearch(value, locale) {
420
+ return value.normalize("NFKD").replace(/[\u0300-\u036f]/gu, "").replace(/\u064a/gu, "ی").replace(/\u0643/gu, "ک").toLocaleLowerCase(locale);
421
+ }
422
+ export { HY_CONFIG, HyAppearance, HyDigits, HyFidelity, HyInteractive, HyLocale, HyMaterialDirective, detectFidelity, injectId, normalizeDigits, normalizeSearch, provideHyalo, injectIsBrowser as ɵinjectIsBrowser, matchesMedia as ɵmatchesMedia, trackIndicator as ɵtrackIndicator };
423
+
424
+ //# sourceMappingURL=hyalo-angular-core.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyalo-angular-core.mjs","names":[],"sources":["../../../projects/hyalo/core/lib/core/config.ts","../../../projects/hyalo/core/lib/core/ids.ts","../../../projects/hyalo/core/lib/core/platform.ts","../../../projects/hyalo/core/lib/fidelity/fidelity.ts","../../../projects/hyalo/core/appearance.ts","../../../projects/hyalo/core/lib/material/material.ts","../../../projects/hyalo/core/lib/interaction/state.ts","../../../projects/hyalo/core/lib/core/indicator.ts","../../../projects/hyalo/core/digits.ts","../../../projects/hyalo/core/search.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\r\nimport type { HyFidelityTier, HyMaterial, HySize, HyTone } from './axes';\r\nimport type { HyGsapLoader } from './gsap';\r\n\r\n/** Global defaults read by every Hyalo component. */\r\nexport interface HyConfig {\r\n readonly locale?: string;\r\n /** Default material for glass surfaces. */\r\n readonly material: HyMaterial;\r\n /** Default control size. */\r\n readonly size: HySize;\r\n /** Default tone for buttons and other coloured controls. */\r\n readonly tone: HyTone;\r\n /**\r\n * Forces a fidelity tier instead of detecting it. Handy for tests,\r\n * screenshots and low-end kiosks.\r\n */\r\n readonly fidelity?: HyFidelityTier;\r\n /**\r\n * Loads GSAP on demand. Without it, Hyalo falls back to CSS transitions,\r\n * so GSAP stays an optional dependency.\r\n *\r\n * ```ts\r\n * provideHyalo({ gsap: () => import('gsap').then((m) => m.gsap) })\r\n * ```\r\n */\r\n readonly gsap?: HyGsapLoader;\r\n /**\r\n * Maps a palette name to its stylesheet URL for HyPalette. Defaults to\r\n * `palette-<name>.css`, which is what a non-injected `bundleName` entry\r\n * in angular.json produces.\r\n */\r\n readonly paletteHref?: (name: string) => string;\r\n}\r\n\r\nconst DEFAULTS: HyConfig = {\r\n material: 'frosted',\r\n size: 'md',\r\n tone: 'primary',\r\n};\r\n\r\n/** Resolved Hyalo configuration. Use {@link provideHyalo} to change it. */\r\nexport const HY_CONFIG = new InjectionToken<HyConfig>('HY_CONFIG', {\r\n providedIn: 'root',\r\n factory: () => DEFAULTS,\r\n});\r\n\r\n/**\r\n * Sets Hyalo defaults. Works in `app.config.ts` and in a component's\r\n * `providers`, where it merges with whatever the parent injector provides.\r\n * That makes it easy to switch one section of a page to `solid`, for example.\r\n */\r\nexport function provideHyalo(config: Partial<HyConfig> = {}): Provider {\r\n return {\r\n provide: HY_CONFIG,\r\n useFactory: (): HyConfig => {\r\n const parent = inject(HY_CONFIG, { skipSelf: true, optional: true }) ?? DEFAULTS;\r\n return { ...parent, ...config };\r\n },\r\n };\r\n}\r\n","import { inject } from '@angular/core';\r\nimport { _IdGenerator } from '@angular/cdk/a11y';\r\n\r\n/**\r\n * Returns a unique id with the given prefix. The counter is per application,\r\n * so the server and the client produce the same ids during hydration.\r\n */\r\nexport function injectId(prefix: string): string {\r\n return inject(_IdGenerator).getId(`hy-${prefix}-`);\r\n}\r\n","import { PLATFORM_ID, inject } from '@angular/core';\r\nimport { isPlatformBrowser } from '@angular/common';\r\n\r\n/** True in the browser, false during server rendering. Call in an injection context. */\r\nexport function injectIsBrowser(): boolean {\r\n return isPlatformBrowser(inject(PLATFORM_ID));\r\n}\r\n\r\n/** Reads a media query once. Always false on the server. */\r\nexport function matchesMedia(query: string): boolean {\r\n return typeof matchMedia === 'function' && matchMedia(query).matches;\r\n}\r\n","import {\r\n DOCUMENT,\r\n Injectable,\r\n afterNextRender,\r\n computed,\r\n effect,\r\n inject,\r\n signal,\r\n} from '@angular/core';\r\nimport { HY_CONFIG } from '../core/config';\r\nimport type { HyFidelityTier } from '../core/axes';\r\nimport { injectIsBrowser, matchesMedia } from '../core/platform';\r\nexport type { HyFidelityTier };\r\ninterface NavigatorHints {\r\n readonly deviceMemory?: number;\r\n readonly hardwareConcurrency?: number;\r\n readonly connection?: { readonly saveData?: boolean };\r\n}\r\nexport function detectFidelity(nav: NavigatorHints): HyFidelityTier {\r\n if (nav.connection?.saveData) return 'low';\r\n const memory = nav.deviceMemory ?? 8,\r\n cores = nav.hardwareConcurrency ?? 8;\r\n if (memory <= 2 || cores <= 2) return 'low';\r\n if (memory <= 4 || cores <= 4 || matchesMedia('(pointer: coarse)')) return 'medium';\r\n return 'high';\r\n}\r\n@Injectable({ providedIn: 'root' })\r\nexport class HyFidelity {\r\n private readonly config = inject(HY_CONFIG);\r\n private readonly document = inject(DOCUMENT);\r\n private readonly detectedTier = signal<HyFidelityTier>('medium');\r\n private readonly selectedTier = signal<HyFidelityTier | null>(this.config.fidelity ?? null);\r\n readonly detected = this.detectedTier.asReadonly();\r\n readonly override = this.selectedTier.asReadonly();\r\n readonly tier = computed(() => this.selectedTier() ?? this.detectedTier());\r\n constructor() {\r\n if (!injectIsBrowser()) return;\r\n afterNextRender(() => this.detectedTier.set(detectFidelity(navigator as NavigatorHints)));\r\n effect(() => this.document.documentElement.setAttribute('data-hy-fidelity', this.tier()));\r\n }\r\n setTier(tier: HyFidelityTier | null): void {\r\n this.selectedTier.set(tier);\r\n }\r\n}\r\n","import { HY_CONFIG } from './lib/core/config';\r\nimport { Injectable, inject, signal } from '@angular/core';\r\nimport type { HyMaterial } from './lib/core/axes';\r\n\r\n/** Scoped preview override; null preserves each component's own material choice. */\r\n@Injectable({ providedIn: 'root' })\r\nexport class HyAppearance {\r\n readonly material = signal<HyMaterial | null>(null);\r\n}\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class HyLocale {\r\n readonly locale = signal(inject(HY_CONFIG).locale ?? 'en');\r\n setLocale(value: string): void {\r\n this.locale.set(Intl.getCanonicalLocales(value)[0] ?? 'en');\r\n }\r\n}\r\n","import { Directive, computed, inject, input } from '@angular/core';\r\nimport { HY_CONFIG } from '../core/config';\r\nimport type { HyMaterial, HyThickness } from '../core/axes';\r\nimport { HyFidelity } from '../fidelity/fidelity';\r\nimport { HyAppearance } from '../../appearance';\r\n\r\n/**\r\n * Turns any element into a glass surface.\r\n *\r\n * ```html\r\n * <aside hyMaterial=\"clear\">...</aside>\r\n * <section hyMaterial thickness=\"thick\">...</section>\r\n * ```\r\n *\r\n * The look lives in CSS (`.hy-glass[data-material]`), so effects stay cheap\r\n * and themeable. On the low fidelity tier every material renders as `solid`,\r\n * because backdrop blur is the most expensive thing on the page.\r\n */\r\n@Directive({\r\n selector: '[hyMaterial]',\r\n host: {\r\n class: 'hy-glass',\r\n '[attr.data-material]': 'resolved()',\r\n '[attr.data-thickness]': 'thickness() === \"regular\" ? null : thickness()',\r\n },\r\n})\r\nexport class HyMaterialDirective {\r\n private readonly config = inject(HY_CONFIG);\r\n private readonly appearance = inject(HyAppearance);\r\n private readonly fidelity = inject(HyFidelity);\r\n\r\n /** The material. An empty attribute uses the configured default. */\r\n readonly material = input<HyMaterial | '' | undefined>(undefined, { alias: 'hyMaterial' });\r\n /** How heavy the glass reads. Use `thick` for large surfaces. */\r\n readonly thickness = input<HyThickness>('regular');\r\n\r\n /** The material that is actually rendered after fidelity is applied. */\r\n readonly resolved = computed<HyMaterial>(() => {\r\n if (this.fidelity.tier() === 'low') return 'solid';\r\n return this.appearance.material() ?? (this.material() || this.config.material);\r\n });\r\n}\r\n","import { Directive, DestroyRef, ElementRef, afterNextRender, inject, signal } from '@angular/core';\r\nimport { FocusMonitor } from '@angular/cdk/a11y';\r\n\r\n/**\r\n * Mirrors interaction state to data attributes so glass effects can stay in\r\n * CSS: `data-hover`, `data-press` and `data-focus-visible`.\r\n *\r\n * Hover is only reported for mouse and pen, so touch screens never get a\r\n * stuck hover state.\r\n */\r\n@Directive({\r\n selector: '[hyInteractive]',\r\n host: {\r\n '[attr.data-hover]': 'hovered() || null',\r\n '[attr.data-press]': 'pressed() || null',\r\n '[attr.data-focus-visible]': 'focusVisible() || null',\r\n '(pointerenter)': 'onEnter($event)',\r\n '(pointerleave)': 'hovered.set(false); pressed.set(false)',\r\n '(pointerdown)': 'pressed.set(true)',\r\n '(pointerup)': 'pressed.set(false)',\r\n '(pointercancel)': 'pressed.set(false)',\r\n },\r\n})\r\nexport class HyInteractive {\r\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\r\n private readonly focusMonitor = inject(FocusMonitor);\r\n\r\n protected readonly hovered = signal(false);\r\n protected readonly pressed = signal(false);\r\n protected readonly focusVisible = signal(false);\r\n\r\n constructor() {\r\n afterNextRender(() => {\r\n this.focusMonitor.monitor(this.host).subscribe((origin) => {\r\n this.focusVisible.set(origin === 'keyboard');\r\n });\r\n });\r\n inject(DestroyRef).onDestroy(() => this.focusMonitor.stopMonitoring(this.host));\r\n }\r\n\r\n protected onEnter(event: PointerEvent): void {\r\n if (event.pointerType !== 'touch') this.hovered.set(true);\r\n }\r\n}\r\n","import {\n DestroyRef,\n ElementRef,\n afterNextRender,\n afterRenderEffect,\n inject,\n signal,\n type Signal,\n} from '@angular/core';\n\n/**\n * Keeps a sliding indicator under the selected item of a row by writing\n * `--hy-ind-x` and `--hy-ind-size` on the row. The offset is physical (from\n * the left edge) and the indicator is placed physically too, so the same\n * numbers work in both directions.\n *\n * Returns a signal that turns true after the first placement, so CSS can\n * enable the transition only from then on.\n */\nexport function trackIndicator(\n container: Signal<ElementRef<HTMLElement> | undefined>,\n selected: () => HTMLElement | null,\n): Signal<boolean> {\n const ready = signal(false);\n // Bumped when the row resizes, for example after web fonts load.\n const size = signal(0);\n const destroyRef = inject(DestroyRef);\n let frame = 0;\n destroyRef.onDestroy(() => {\n if (frame) cancelAnimationFrame(frame);\n });\n\n afterNextRender(() => {\n const row = container()?.nativeElement;\n if (!row || typeof ResizeObserver !== 'function') return;\n const observer = new ResizeObserver(() => size.update((v) => v + 1));\n observer.observe(row);\n destroyRef.onDestroy(() => observer.disconnect());\n });\n\n afterRenderEffect({\n earlyRead: () => {\n size();\n const row = container()?.nativeElement;\n const item = selected();\n if (!row || !item) return null;\n const rowRect = row.getBoundingClientRect();\n const rect = item.getBoundingClientRect();\n // Rects are in screen pixels, after any zoom or scale on an ancestor,\n // but the custom properties are read in the row's own pixels.\n const scale = row.offsetWidth ? rowRect.width / row.offsetWidth : 1;\n return {\n row,\n x: (rect.left - rowRect.left) / scale + row.scrollLeft,\n size: rect.width / scale,\n };\n },\n write: (measured) => {\n const m = measured();\n if (!m) return;\n m.row.style.setProperty('--hy-ind-x', `${m.x}px`);\n m.row.style.setProperty('--hy-ind-size', `${m.size}px`);\n if (!ready() && !frame)\n frame = requestAnimationFrame(() => {\n frame = 0;\n ready.set(true);\n });\n },\n });\n\n return ready.asReadonly();\n}\n","import { booleanAttribute, Directive, ElementRef, inject, input } from '@angular/core';\r\n\r\nexport function normalizeDigits(value: string): string {\r\n return value.replace(/[\\u0660-\\u0669\\u06f0-\\u06f9]/gu, (digit) =>\r\n String(digit.charCodeAt(0) - (digit.charCodeAt(0) >= 0x06f0 ? 0x06f0 : 0x0660)),\r\n );\r\n}\r\n\r\n/** Keeps identifier strings intact, including leading zeros; it does not parse numbers. */\r\n@Directive({\r\n selector: 'input[hyDigits],textarea[hyDigits]',\r\n host: {\r\n '(input)': 'normalize($event)',\r\n '(compositionend)': 'normalize($event)',\r\n },\r\n})\r\nexport class HyDigits {\r\n readonly hyDigits = input(true, { transform: booleanAttribute });\r\n private readonly el =\r\n inject<ElementRef<HTMLInputElement | HTMLTextAreaElement>>(ElementRef).nativeElement;\r\n protected normalize(event: Event): void {\r\n if (!this.hyDigits() || ('isComposing' in event && event.isComposing)) return;\r\n const before = this.el.value;\r\n const after = normalizeDigits(before);\r\n if (before === after) return;\r\n const start = this.el.selectionStart,\r\n end = this.el.selectionEnd;\r\n this.el.value = after;\r\n if (start !== null && end !== null) this.el.setSelectionRange(start, end);\r\n // Re-dispatch after normalization so every value accessor sees the canonical text.\r\n this.el.dispatchEvent(new Event('input', { bubbles: true }));\r\n }\r\n}\r\n","export function normalizeSearch(value: string, locale?: string): string {\r\n return value\r\n .normalize('NFKD')\r\n .replace(/[\\u0300-\\u036f]/gu, '')\r\n .replace(/\\u064a/gu, '\\u06cc')\r\n .replace(/\\u0643/gu, '\\u06a9')\r\n .toLocaleLowerCase(locale);\r\n}\r\n"],"mappings":";;;;AAmCA,MAAM,WAAqB;CACzB,UAAU;CACV,MAAM;CACN,MAAM;AACP;AAGD,MAAa,YAAY,IAAI,eAAyB,aAAa;CACjE,YAAY;CACZ,eAAe;AAChB,CAAA;AAOD,SAAgB,aAAa,SAA4B,CAAA,GAAE;CACzD,OAAO;EACL,SAAS;EACT,kBAA2B;GAEzB,OAAO;IAAE,GADM,OAAO,WAAW;KAAE,UAAU;KAAM,UAAU;IAAI,CAAE,KAAK;IACpD,GAAG;GAAM;EAC/B;CACD;AACH;ACrDA,SAAgB,SAAS,QAAc;CACrC,OAAO,OAAO,YAAY,CAAC,CAAC,MAAM,MAAM,OAAM,EAAG;AACnD;ACLA,SAAgB,kBAAe;CAC7B,OAAO,kBAAkB,OAAO,WAAW,CAAC;AAC9C;AAGA,SAAgB,aAAa,OAAa;CACxC,OAAO,OAAO,eAAe,cAAc,WAAW,KAAK,CAAC,CAAC;AAC/D;ACOA,SAAgB,eAAe,KAAmB;CAChD,IAAI,IAAI,YAAY,UAAU,OAAO;CACrC,MAAM,SAAS,IAAI,gBAAgB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,MAAA;CAAQ,YAAA,CAAA;EAPpB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM;IACJ,WAAW;IACX,oBAAoB;GACrB;EACF,CAAA;;;;;;;;;;;ACfD,SAAgB,gBAAgB,OAAe,QAAe;CAC5D,OAAO,MACJ,UAAU,MAAM,CAAC,CACjB,QAAQ,qBAAqB,EAAE,CAAC,CAChC,QAAQ,YAAY,GAAQ,CAAC,CAC7B,QAAQ,YAAY,GAAQ,CAAC,CAC7B,kBAAkB,MAAM;AAC7B"}
@@ -0,0 +1,57 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, input } from "@angular/core";
3
+ var HyDescriptionList = class HyDescriptionList {
4
+ items = input.required(...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
5
+ static ɵfac = i0.ɵɵngDeclareFactory({
6
+ minVersion: "12.0.0",
7
+ version: "22.2.3",
8
+ ngImport: i0,
9
+ type: HyDescriptionList,
10
+ deps: [],
11
+ target: i0.ɵɵFactoryTarget.Component
12
+ });
13
+ static ɵcmp = i0.ɵɵngDeclareComponent({
14
+ minVersion: "17.0.0",
15
+ version: "22.2.3",
16
+ type: HyDescriptionList,
17
+ isStandalone: true,
18
+ selector: "hy-description-list",
19
+ inputs: { items: {
20
+ classPropertyName: "items",
21
+ publicName: "items",
22
+ isSignal: true,
23
+ isRequired: true,
24
+ transformFunction: null
25
+ } },
26
+ ngImport: i0,
27
+ template: "<dl>\r\n @for (item of items(); track $index) {\r\n <div>\r\n <dt>{{ item.term }}</dt>\r\n <dd>{{ item.detail }}</dd>\r\n </div>\r\n }\r\n</dl>\r\n",
28
+ styles: [":host{display:block}dl{margin:0}dl>div{display:grid;grid-template-columns:minmax(7rem,1fr) minmax(0,2fr);gap:1rem;padding-block:1rem;border-block-end:1px solid var(--hy-line)}dt{color:var(--hy-ink-2)}dd{margin:0;color:var(--hy-ink);overflow-wrap:anywhere}@media(max-width:30rem){dl>div{grid-template-columns:1fr;gap:.25rem}}\n"],
29
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
30
+ });
31
+ };
32
+ i0.ɵɵngDeclareClassMetadata({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.3",
35
+ ngImport: i0,
36
+ type: HyDescriptionList,
37
+ decorators: [{
38
+ type: Component,
39
+ args: [{
40
+ selector: "hy-description-list",
41
+ changeDetection: ChangeDetectionStrategy.OnPush,
42
+ template: "<dl>\r\n @for (item of items(); track $index) {\r\n <div>\r\n <dt>{{ item.term }}</dt>\r\n <dd>{{ item.detail }}</dd>\r\n </div>\r\n }\r\n</dl>\r\n",
43
+ styles: [":host{display:block}dl{margin:0}dl>div{display:grid;grid-template-columns:minmax(7rem,1fr) minmax(0,2fr);gap:1rem;padding-block:1rem;border-block-end:1px solid var(--hy-line)}dt{color:var(--hy-ink-2)}dd{margin:0;color:var(--hy-ink);overflow-wrap:anywhere}@media(max-width:30rem){dl>div{grid-template-columns:1fr;gap:.25rem}}\n"]
44
+ }]
45
+ }],
46
+ propDecorators: { items: [{
47
+ type: i0.Input,
48
+ args: [{
49
+ isSignal: true,
50
+ alias: "items",
51
+ required: true
52
+ }]
53
+ }] }
54
+ });
55
+ export { HyDescriptionList };
56
+
57
+ //# sourceMappingURL=hyalo-angular-description-list.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hyalo-angular-description-list.mjs","names":[],"sources":["../../../projects/hyalo/description-list/description-list.ts","../../../projects/hyalo/description-list/description-list.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\nexport interface HyDescription {\r\n readonly term: string;\r\n readonly detail: string;\r\n}\r\n@Component({\r\n selector: 'hy-description-list',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n templateUrl: './description-list.html',\r\n styleUrl: './description-list.css',\r\n})\r\nexport class HyDescriptionList {\r\n readonly items = input.required<readonly HyDescription[]>();\r\n}\r\n","<dl>\r\n @for (item of items(); track $index) {\r\n <div>\r\n <dt>{{ item.term }}</dt>\r\n <dd>{{ item.detail }}</dd>\r\n </div>\r\n }\r\n</dl>\r\n"],"mappings":";;AAWA,IAAa,oBAAb,MAAa,kBAAiB;CACnB,QAAQ,MAAM,SAAoC,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CADhD,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,OAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UCX9B;EAQA,QAAA,CAAA,wUAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;ADGa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAN7B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAqB,iBACd,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wUAAA;EAAA,CAAA"}
@@ -1,7 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { ChangeDetectionStrategy, Component, Directive, ElementRef, Injectable, InjectionToken, Injector, afterNextRender, inject, input } from "@angular/core";
3
3
  import { filter, firstValueFrom } from "rxjs";
4
- import { HyFidelity, HyMotion, HySpring, HyVelocityTracker, MOTION, SPRINGS, injectId, project, rubberband } from "@hyalo/angular";
4
+ import { HyMotion, HySpring, HyVelocityTracker, MOTION, SPRINGS, project, rubberband } from "@hyalo/angular/motion";
5
+ import { HyFidelity, injectId } from "@hyalo/angular/core";
5
6
  import { Dialog } from "@angular/cdk/dialog";
6
7
  import { HyButton } from "@hyalo/angular/button";
7
8
  import { createGlobalPositionStrategy } from "@angular/cdk/overlay";
@@ -225,6 +226,10 @@ const HY_DIALOG_PARTS = [
225
226
  const SLOP = 10;
226
227
  const INTERACTIVE = "button, a[href], input, select, textarea, label, summary, [contenteditable], [role=\"slider\"], [tabindex]:not([tabindex=\"-1\"])";
227
228
  function driveSheet(panel, backdrop, side, host) {
229
+ const lifetime = new ((panel.ownerDocument.defaultView?.AbortController) ?? AbortController)();
230
+ let disposed = false;
231
+ let resize;
232
+ let clickTimer;
228
233
  const vertical = side === "bottom";
229
234
  const rtl = getComputedStyle(panel).direction === "rtl";
230
235
  const sign = vertical ? 1 : side === "end" !== rtl ? 1 : -1;
@@ -242,13 +247,16 @@ function driveSheet(panel, backdrop, side, host) {
242
247
  const spring = new HySpring(0, paint);
243
248
  panel.style.translate = vertical ? "0 100%" : `${sign * 100}% 0`;
244
249
  if (backdrop) backdrop.style.opacity = "0";
245
- requestAnimationFrame(() => {
250
+ let enterFrame = requestAnimationFrame(() => {
251
+ enterFrame = 0;
246
252
  spring.set(size());
247
253
  spring.to(0, SPRINGS.settle);
248
254
  });
249
255
  let closing = false;
250
256
  const exit = (finish) => {
251
- if (panel.ownerDocument.hidden) {
257
+ cancelAnimationFrame(enterFrame);
258
+ enterFrame = 0;
259
+ if (disposed || panel.ownerDocument.hidden) {
252
260
  spring.stop();
253
261
  finish();
254
262
  return;
@@ -264,9 +272,12 @@ function driveSheet(panel, backdrop, side, host) {
264
272
  grabber.className = "hy-drawer__grabber";
265
273
  grabber.setAttribute("aria-hidden", "true");
266
274
  panel.prepend(grabber);
267
- if (typeof ResizeObserver === "function") new ResizeObserver(() => {
268
- panel.style.touchAction = panel.scrollHeight > panel.clientHeight + 1 ? "" : "none";
269
- }).observe(panel);
275
+ if (typeof ResizeObserver === "function") {
276
+ resize = new ResizeObserver(() => {
277
+ panel.style.touchAction = panel.scrollHeight > panel.clientHeight + 1 ? "" : "none";
278
+ });
279
+ resize.observe(panel);
280
+ }
270
281
  }
271
282
  let press = null;
272
283
  const tracker = new HyVelocityTracker();
@@ -304,7 +315,7 @@ function driveSheet(panel, backdrop, side, host) {
304
315
  };
305
316
  press = p;
306
317
  if (spring.running) grab(p, e);
307
- });
318
+ }, { signal: lifetime.signal });
308
319
  panel.addEventListener("pointermove", (e) => {
309
320
  if (!press || e.pointerId !== press.id) return;
310
321
  const moved = along(e) - press.x;
@@ -321,22 +332,24 @@ function driveSheet(panel, backdrop, side, host) {
321
332
  const offset = press.from + moved;
322
333
  tracker.add(offset);
323
334
  spring.set(offset);
324
- });
335
+ }, { signal: lifetime.signal });
336
+ const swallow = (click) => {
337
+ click.stopPropagation();
338
+ click.preventDefault();
339
+ };
325
340
  const release = (e) => {
326
341
  if (!press || e.pointerId !== press.id) return;
327
342
  const wasDragging = press.dragging;
328
343
  press = null;
329
344
  if (!wasDragging) return;
330
345
  delete panel.dataset["dragging"];
331
- const swallow = (click) => {
332
- click.stopPropagation();
333
- click.preventDefault();
334
- };
335
346
  panel.addEventListener("click", swallow, {
336
347
  capture: true,
337
- once: true
348
+ once: true,
349
+ signal: lifetime.signal
338
350
  });
339
- setTimeout(() => panel.removeEventListener("click", swallow, { capture: true }));
351
+ clearTimeout(clickTimer);
352
+ clickTimer = setTimeout(() => panel.removeEventListener("click", swallow, { capture: true }));
340
353
  const velocity = e.type === "pointercancel" ? 0 : tracker.velocity();
341
354
  const full = size();
342
355
  const landing = spring.value + project(velocity);
@@ -345,9 +358,21 @@ function driveSheet(panel, backdrop, side, host) {
345
358
  if (out && host.dismissible) host.close();
346
359
  else spring.to(0, SPRINGS.settle);
347
360
  };
348
- panel.addEventListener("pointerup", release);
349
- panel.addEventListener("pointercancel", release);
350
- return exit;
361
+ panel.addEventListener("pointerup", release, { signal: lifetime.signal });
362
+ panel.addEventListener("pointercancel", release, { signal: lifetime.signal });
363
+ return {
364
+ exit,
365
+ destroy: () => {
366
+ if (disposed) return;
367
+ disposed = true;
368
+ cancelAnimationFrame(enterFrame);
369
+ spring.stop();
370
+ resize?.disconnect();
371
+ lifetime.abort();
372
+ clearTimeout(clickTimer);
373
+ press = null;
374
+ }
375
+ };
351
376
  }
352
377
  function openSurface(cdk, motion, fidelity, content, config, extra) {
353
378
  let ref;
@@ -384,11 +409,15 @@ function openSurface(cdk, motion, fidelity, content, config, extra) {
384
409
  container.classList.add("hy-glass");
385
410
  container.dataset["material"] = fidelity.tier() === "low" ? "solid" : config.material ?? "frosted";
386
411
  container.dataset["thickness"] = "thick";
387
- if (extra.sheet && !motion.reduced()) hyRef.exit = driveSheet(container, cdkRef.overlayRef.backdropElement, extra.sheet, {
388
- dismissible,
389
- close: () => hyRef.close(),
390
- cancelClose: () => hyRef.cancelClose()
391
- });
412
+ if (extra.sheet && !motion.reduced()) {
413
+ const driver = driveSheet(container, cdkRef.overlayRef.backdropElement, extra.sheet, {
414
+ dismissible,
415
+ close: () => hyRef.close(),
416
+ cancelClose: () => hyRef.cancelClose()
417
+ });
418
+ hyRef.exit = driver.exit;
419
+ cdkRef.closed.subscribe(() => driver.destroy());
420
+ }
392
421
  }
393
422
  if (dismissible) {
394
423
  cdkRef.backdropClick.subscribe(() => hyRef.close());