@raqm/ui 0.0.0-stage → 0.1.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 (178) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +28 -0
  4. package/README.md +126 -3
  5. package/combobox/README.md +17 -0
  6. package/fesm2022/raqm-ui-accordion.mjs +414 -0
  7. package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
  8. package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
  9. package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
  10. package/fesm2022/raqm-ui-alert.mjs +195 -0
  11. package/fesm2022/raqm-ui-alert.mjs.map +1 -0
  12. package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
  13. package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
  14. package/fesm2022/raqm-ui-attachment.mjs +435 -0
  15. package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
  16. package/fesm2022/raqm-ui-avatar.mjs +337 -0
  17. package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
  18. package/fesm2022/raqm-ui-badge.mjs +68 -0
  19. package/fesm2022/raqm-ui-badge.mjs.map +1 -0
  20. package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
  21. package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
  22. package/fesm2022/raqm-ui-button-group.mjs +138 -0
  23. package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
  24. package/fesm2022/raqm-ui-button.mjs +295 -0
  25. package/fesm2022/raqm-ui-button.mjs.map +1 -0
  26. package/fesm2022/raqm-ui-calendar.mjs +1394 -0
  27. package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
  28. package/fesm2022/raqm-ui-card.mjs +331 -0
  29. package/fesm2022/raqm-ui-card.mjs.map +1 -0
  30. package/fesm2022/raqm-ui-carousel.mjs +410 -0
  31. package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
  32. package/fesm2022/raqm-ui-checkbox.mjs +86 -0
  33. package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
  34. package/fesm2022/raqm-ui-collapsible.mjs +266 -0
  35. package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
  36. package/fesm2022/raqm-ui-combobox.mjs +1584 -0
  37. package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
  38. package/fesm2022/raqm-ui-command.mjs +1210 -0
  39. package/fesm2022/raqm-ui-command.mjs.map +1 -0
  40. package/fesm2022/raqm-ui-context-menu.mjs +723 -0
  41. package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
  42. package/fesm2022/raqm-ui-dialog.mjs +1214 -0
  43. package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
  44. package/fesm2022/raqm-ui-drawer.mjs +687 -0
  45. package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
  46. package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
  47. package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
  48. package/fesm2022/raqm-ui-empty.mjs +272 -0
  49. package/fesm2022/raqm-ui-empty.mjs.map +1 -0
  50. package/fesm2022/raqm-ui-field.mjs +517 -0
  51. package/fesm2022/raqm-ui-field.mjs.map +1 -0
  52. package/fesm2022/raqm-ui-hover-card.mjs +828 -0
  53. package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
  54. package/fesm2022/raqm-ui-input-group.mjs +270 -0
  55. package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
  56. package/fesm2022/raqm-ui-input-otp.mjs +788 -0
  57. package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
  58. package/fesm2022/raqm-ui-input.mjs +73 -0
  59. package/fesm2022/raqm-ui-input.mjs.map +1 -0
  60. package/fesm2022/raqm-ui-item.mjs +495 -0
  61. package/fesm2022/raqm-ui-item.mjs.map +1 -0
  62. package/fesm2022/raqm-ui-kbd.mjs +80 -0
  63. package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
  64. package/fesm2022/raqm-ui-label.mjs +44 -0
  65. package/fesm2022/raqm-ui-label.mjs.map +1 -0
  66. package/fesm2022/raqm-ui-menubar.mjs +536 -0
  67. package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
  68. package/fesm2022/raqm-ui-native-select.mjs +131 -0
  69. package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
  70. package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
  71. package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
  72. package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
  73. package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
  74. package/fesm2022/raqm-ui-pagination.mjs +440 -0
  75. package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
  76. package/fesm2022/raqm-ui-popover.mjs +1495 -0
  77. package/fesm2022/raqm-ui-popover.mjs.map +1 -0
  78. package/fesm2022/raqm-ui-progress.mjs +369 -0
  79. package/fesm2022/raqm-ui-progress.mjs.map +1 -0
  80. package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
  81. package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
  82. package/fesm2022/raqm-ui-radio-group.mjs +151 -0
  83. package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
  84. package/fesm2022/raqm-ui-resizable.mjs +439 -0
  85. package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
  86. package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
  87. package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
  88. package/fesm2022/raqm-ui-select.mjs +1073 -0
  89. package/fesm2022/raqm-ui-select.mjs.map +1 -0
  90. package/fesm2022/raqm-ui-separator.mjs +103 -0
  91. package/fesm2022/raqm-ui-separator.mjs.map +1 -0
  92. package/fesm2022/raqm-ui-sheet.mjs +411 -0
  93. package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
  94. package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
  95. package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
  96. package/fesm2022/raqm-ui-skeleton.mjs +50 -0
  97. package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
  98. package/fesm2022/raqm-ui-slider.mjs +609 -0
  99. package/fesm2022/raqm-ui-slider.mjs.map +1 -0
  100. package/fesm2022/raqm-ui-spinner.mjs +137 -0
  101. package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
  102. package/fesm2022/raqm-ui-switch.mjs +109 -0
  103. package/fesm2022/raqm-ui-switch.mjs.map +1 -0
  104. package/fesm2022/raqm-ui-table.mjs +271 -0
  105. package/fesm2022/raqm-ui-table.mjs.map +1 -0
  106. package/fesm2022/raqm-ui-tabs.mjs +536 -0
  107. package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
  108. package/fesm2022/raqm-ui-textarea.mjs +37 -0
  109. package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
  110. package/fesm2022/raqm-ui-toast.mjs +918 -0
  111. package/fesm2022/raqm-ui-toast.mjs.map +1 -0
  112. package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
  113. package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
  114. package/fesm2022/raqm-ui-toggle.mjs +158 -0
  115. package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
  116. package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
  117. package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
  118. package/fesm2022/raqm-ui.mjs +50 -0
  119. package/input-otp/README.md +12 -0
  120. package/package.json +275 -3
  121. package/styles/theme.css +4324 -0
  122. package/types/raqm-ui-accordion.d.ts +124 -0
  123. package/types/raqm-ui-alert-dialog.d.ts +81 -0
  124. package/types/raqm-ui-alert.d.ts +29 -0
  125. package/types/raqm-ui-aspect-ratio.d.ts +13 -0
  126. package/types/raqm-ui-attachment.d.ts +72 -0
  127. package/types/raqm-ui-avatar.d.ts +67 -0
  128. package/types/raqm-ui-badge.d.ts +20 -0
  129. package/types/raqm-ui-breadcrumb.d.ts +35 -0
  130. package/types/raqm-ui-button-group.d.ts +27 -0
  131. package/types/raqm-ui-button.d.ts +80 -0
  132. package/types/raqm-ui-calendar.d.ts +359 -0
  133. package/types/raqm-ui-card.d.ts +34 -0
  134. package/types/raqm-ui-carousel.d.ts +81 -0
  135. package/types/raqm-ui-checkbox.d.ts +24 -0
  136. package/types/raqm-ui-collapsible.d.ts +72 -0
  137. package/types/raqm-ui-combobox.d.ts +405 -0
  138. package/types/raqm-ui-command.d.ts +256 -0
  139. package/types/raqm-ui-context-menu.d.ts +196 -0
  140. package/types/raqm-ui-dialog.d.ts +232 -0
  141. package/types/raqm-ui-drawer.d.ts +121 -0
  142. package/types/raqm-ui-dropdown-menu.d.ts +319 -0
  143. package/types/raqm-ui-empty.d.ts +35 -0
  144. package/types/raqm-ui-field.d.ts +88 -0
  145. package/types/raqm-ui-hover-card.d.ts +139 -0
  146. package/types/raqm-ui-input-group.d.ts +45 -0
  147. package/types/raqm-ui-input-otp.d.ts +197 -0
  148. package/types/raqm-ui-input.d.ts +16 -0
  149. package/types/raqm-ui-item.d.ts +71 -0
  150. package/types/raqm-ui-kbd.d.ts +12 -0
  151. package/types/raqm-ui-label.d.ts +6 -0
  152. package/types/raqm-ui-menubar.d.ts +159 -0
  153. package/types/raqm-ui-native-select.d.ts +23 -0
  154. package/types/raqm-ui-navigation-menu.d.ts +230 -0
  155. package/types/raqm-ui-overlay-internal.d.ts +5 -0
  156. package/types/raqm-ui-pagination.d.ts +84 -0
  157. package/types/raqm-ui-popover.d.ts +235 -0
  158. package/types/raqm-ui-progress.d.ts +79 -0
  159. package/types/raqm-ui-questionnaire.d.ts +217 -0
  160. package/types/raqm-ui-radio-group.d.ts +48 -0
  161. package/types/raqm-ui-resizable.d.ts +98 -0
  162. package/types/raqm-ui-scroll-area.d.ts +132 -0
  163. package/types/raqm-ui-select.d.ts +205 -0
  164. package/types/raqm-ui-separator.d.ts +21 -0
  165. package/types/raqm-ui-sheet.d.ts +79 -0
  166. package/types/raqm-ui-sidebar.d.ts +285 -0
  167. package/types/raqm-ui-skeleton.d.ts +6 -0
  168. package/types/raqm-ui-slider.d.ts +129 -0
  169. package/types/raqm-ui-spinner.d.ts +32 -0
  170. package/types/raqm-ui-switch.d.ts +32 -0
  171. package/types/raqm-ui-table.d.ts +36 -0
  172. package/types/raqm-ui-tabs.d.ts +154 -0
  173. package/types/raqm-ui-textarea.d.ts +6 -0
  174. package/types/raqm-ui-toast.d.ts +190 -0
  175. package/types/raqm-ui-toggle-group.d.ts +167 -0
  176. package/types/raqm-ui-toggle.d.ts +42 -0
  177. package/types/raqm-ui-tooltip.d.ts +207 -0
  178. package/types/raqm-ui.d.ts +50 -0
@@ -0,0 +1,410 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, Directive, ElementRef, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, output, signal, untracked } from "@angular/core";
3
+ import EmblaCarousel from "embla-carousel";
4
+ var RaqmCarouselItemDirective = class RaqmCarouselItemDirective {
5
+ static ɵfac = i0.ɵɵngDeclareFactory({
6
+ minVersion: "12.0.0",
7
+ version: "22.2.2",
8
+ ngImport: i0,
9
+ type: RaqmCarouselItemDirective,
10
+ deps: [],
11
+ target: i0.ɵɵFactoryTarget.Directive
12
+ });
13
+ static ɵdir = i0.ɵɵngDeclareDirective({
14
+ minVersion: "14.0.0",
15
+ version: "22.2.2",
16
+ type: RaqmCarouselItemDirective,
17
+ isStandalone: true,
18
+ selector: "[raqm-carousel-item]",
19
+ host: {
20
+ attributes: {
21
+ "role": "group",
22
+ "aria-roledescription": "slide"
23
+ },
24
+ classAttribute: "raqm-carousel-item"
25
+ },
26
+ ngImport: i0
27
+ });
28
+ };
29
+ i0.ɵɵngDeclareClassMetadata({
30
+ minVersion: "12.0.0",
31
+ version: "22.2.2",
32
+ ngImport: i0,
33
+ type: RaqmCarouselItemDirective,
34
+ decorators: [{
35
+ type: Directive,
36
+ args: [{
37
+ selector: "[raqm-carousel-item]",
38
+ host: {
39
+ class: "raqm-carousel-item",
40
+ role: "group",
41
+ "aria-roledescription": "slide"
42
+ }
43
+ }]
44
+ }]
45
+ });
46
+ var RaqmCarouselContentComponent = class RaqmCarouselContentComponent {
47
+ element = inject(ElementRef);
48
+ static ɵfac = i0.ɵɵngDeclareFactory({
49
+ minVersion: "12.0.0",
50
+ version: "22.2.2",
51
+ ngImport: i0,
52
+ type: RaqmCarouselContentComponent,
53
+ deps: [],
54
+ target: i0.ɵɵFactoryTarget.Component
55
+ });
56
+ static ɵcmp = i0.ɵɵngDeclareComponent({
57
+ minVersion: "14.0.0",
58
+ version: "22.2.2",
59
+ type: RaqmCarouselContentComponent,
60
+ isStandalone: true,
61
+ selector: "[raqm-carousel-content]",
62
+ host: { classAttribute: "raqm-carousel-content" },
63
+ ngImport: i0,
64
+ template: "<div class=\"raqm-carousel-track\"><ng-content /></div>",
65
+ isInline: true,
66
+ styles: [":host{display:block;overflow:hidden}.raqm-carousel-track{display:flex;touch-action:pan-y pinch-zoom}\n"]
67
+ });
68
+ };
69
+ i0.ɵɵngDeclareClassMetadata({
70
+ minVersion: "12.0.0",
71
+ version: "22.2.2",
72
+ ngImport: i0,
73
+ type: RaqmCarouselContentComponent,
74
+ decorators: [{
75
+ type: Component,
76
+ args: [{
77
+ selector: "[raqm-carousel-content]",
78
+ template: "<div class=\"raqm-carousel-track\"><ng-content /></div>",
79
+ host: { class: "raqm-carousel-content" },
80
+ styles: [":host{display:block;overflow:hidden}.raqm-carousel-track{display:flex;touch-action:pan-y pinch-zoom}\n"]
81
+ }]
82
+ }]
83
+ });
84
+ var RaqmCarouselComponent = class RaqmCarouselComponent {
85
+ vertical = input(false, {
86
+ ...ngDevMode ? { debugName: "vertical" } : /* istanbul ignore next */ {},
87
+ transform: booleanAttribute
88
+ });
89
+ options = input({}, ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
90
+ plugins = input([], ...ngDevMode ? [{ debugName: "plugins" }] : /* istanbul ignore next */ []);
91
+ apiReady = output();
92
+ selectedIndexChange = output();
93
+ content = contentChild(RaqmCarouselContentComponent, {
94
+ ...ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {},
95
+ descendants: true
96
+ });
97
+ api = signal(void 0, ...ngDevMode ? [{ debugName: "api" }] : /* istanbul ignore next */ []);
98
+ index = signal(0, ...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
99
+ previousAvailable = signal(false, ...ngDevMode ? [{ debugName: "previousAvailable" }] : /* istanbul ignore next */ []);
100
+ nextAvailable = signal(false, ...ngDevMode ? [{ debugName: "nextAvailable" }] : /* istanbul ignore next */ []);
101
+ viewport;
102
+ update = (api) => {
103
+ const index = api.selectedScrollSnap();
104
+ if (index !== this.index()) {
105
+ this.index.set(index);
106
+ this.selectedIndexChange.emit(index);
107
+ }
108
+ this.previousAvailable.set(api.canScrollPrev());
109
+ this.nextAvailable.set(api.canScrollNext());
110
+ };
111
+ constructor() {
112
+ afterRenderEffect(() => {
113
+ const content = this.content();
114
+ const options = this.options();
115
+ const plugins = this.plugins();
116
+ const vertical = this.vertical();
117
+ const element = content?.element.nativeElement;
118
+ if (!element) {
119
+ untracked(() => {
120
+ this.api()?.destroy();
121
+ this.api.set(void 0);
122
+ this.viewport = void 0;
123
+ this.previousAvailable.set(false);
124
+ this.nextAvailable.set(false);
125
+ this.index.set(0);
126
+ });
127
+ return;
128
+ }
129
+ const direction = options.direction ?? (getComputedStyle(element).direction === "rtl" ? "rtl" : "ltr");
130
+ const effectiveOptions = {
131
+ ...options,
132
+ axis: vertical ? "y" : "x",
133
+ direction
134
+ };
135
+ untracked(() => {
136
+ const existing = this.api();
137
+ if (existing && this.viewport === element) existing.reInit(effectiveOptions, plugins);
138
+ else {
139
+ existing?.destroy();
140
+ const api = EmblaCarousel(element, effectiveOptions, plugins);
141
+ this.viewport = element;
142
+ api.on("select", this.update).on("reInit", this.update);
143
+ this.api.set(api);
144
+ this.update(api);
145
+ this.apiReady.emit(api);
146
+ }
147
+ });
148
+ });
149
+ }
150
+ ngOnDestroy() {
151
+ this.api()?.destroy();
152
+ }
153
+ canPrevious() {
154
+ return this.previousAvailable();
155
+ }
156
+ canNext() {
157
+ return this.nextAvailable();
158
+ }
159
+ previous() {
160
+ this.api()?.scrollPrev();
161
+ }
162
+ next() {
163
+ this.api()?.scrollNext();
164
+ }
165
+ go(index) {
166
+ this.api()?.scrollTo(index);
167
+ }
168
+ selectedScrollSnap() {
169
+ return this.api()?.selectedScrollSnap() ?? 0;
170
+ }
171
+ scrollSnapList() {
172
+ return this.api()?.scrollSnapList() ?? [];
173
+ }
174
+ onKey(event) {
175
+ if (event.target instanceof HTMLElement && (/^(INPUT|TEXTAREA|SELECT)$/.test(event.target.tagName) || event.target.isContentEditable)) return;
176
+ const rtl = (this.api()?.internalEngine().options.direction ?? getComputedStyle(event.currentTarget).direction) === "rtl";
177
+ const previous = this.vertical() ? "ArrowUp" : rtl ? "ArrowRight" : "ArrowLeft";
178
+ const next = this.vertical() ? "ArrowDown" : rtl ? "ArrowLeft" : "ArrowRight";
179
+ if (event.key === previous || event.key === next) {
180
+ event.preventDefault();
181
+ if (event.key === next) this.next();
182
+ else this.previous();
183
+ }
184
+ }
185
+ static ɵfac = i0.ɵɵngDeclareFactory({
186
+ minVersion: "12.0.0",
187
+ version: "22.2.2",
188
+ ngImport: i0,
189
+ type: RaqmCarouselComponent,
190
+ deps: [],
191
+ target: i0.ɵɵFactoryTarget.Component
192
+ });
193
+ static ɵcmp = i0.ɵɵngDeclareComponent({
194
+ minVersion: "17.2.0",
195
+ version: "22.2.2",
196
+ type: RaqmCarouselComponent,
197
+ isStandalone: true,
198
+ selector: "raqm-carousel",
199
+ inputs: {
200
+ vertical: {
201
+ classPropertyName: "vertical",
202
+ publicName: "vertical",
203
+ isSignal: true,
204
+ isRequired: false,
205
+ transformFunction: null
206
+ },
207
+ options: {
208
+ classPropertyName: "options",
209
+ publicName: "options",
210
+ isSignal: true,
211
+ isRequired: false,
212
+ transformFunction: null
213
+ },
214
+ plugins: {
215
+ classPropertyName: "plugins",
216
+ publicName: "plugins",
217
+ isSignal: true,
218
+ isRequired: false,
219
+ transformFunction: null
220
+ }
221
+ },
222
+ outputs: {
223
+ apiReady: "apiReady",
224
+ selectedIndexChange: "selectedIndexChange"
225
+ },
226
+ host: {
227
+ attributes: {
228
+ "role": "region",
229
+ "aria-roledescription": "carousel"
230
+ },
231
+ listeners: { "keydown": "onKey($event)" },
232
+ properties: { "attr.data-raqm-vertical": "vertical() ? \"\" : null" },
233
+ classAttribute: "raqm-carousel"
234
+ },
235
+ queries: [{
236
+ propertyName: "content",
237
+ first: true,
238
+ predicate: RaqmCarouselContentComponent,
239
+ descendants: true,
240
+ isSignal: true
241
+ }],
242
+ ngImport: i0,
243
+ template: "<ng-content />",
244
+ isInline: true,
245
+ styles: [":host{position:relative;display:block;min-inline-size:0}\n"],
246
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
247
+ });
248
+ };
249
+ i0.ɵɵngDeclareClassMetadata({
250
+ minVersion: "12.0.0",
251
+ version: "22.2.2",
252
+ ngImport: i0,
253
+ type: RaqmCarouselComponent,
254
+ decorators: [{
255
+ type: Component,
256
+ args: [{
257
+ selector: "raqm-carousel",
258
+ template: "<ng-content />",
259
+ changeDetection: ChangeDetectionStrategy.OnPush,
260
+ host: {
261
+ class: "raqm-carousel",
262
+ role: "region",
263
+ "aria-roledescription": "carousel",
264
+ "[attr.data-raqm-vertical]": "vertical() ? \"\" : null",
265
+ "(keydown)": "onKey($event)"
266
+ },
267
+ styles: [":host{position:relative;display:block;min-inline-size:0}\n"]
268
+ }]
269
+ }],
270
+ ctorParameters: () => [],
271
+ propDecorators: {
272
+ vertical: [{
273
+ type: i0.Input,
274
+ args: [{
275
+ isSignal: true,
276
+ alias: "vertical",
277
+ required: false
278
+ }]
279
+ }],
280
+ options: [{
281
+ type: i0.Input,
282
+ args: [{
283
+ isSignal: true,
284
+ alias: "options",
285
+ required: false
286
+ }]
287
+ }],
288
+ plugins: [{
289
+ type: i0.Input,
290
+ args: [{
291
+ isSignal: true,
292
+ alias: "plugins",
293
+ required: false
294
+ }]
295
+ }],
296
+ apiReady: [{
297
+ type: i0.Output,
298
+ args: ["apiReady"]
299
+ }],
300
+ selectedIndexChange: [{
301
+ type: i0.Output,
302
+ args: ["selectedIndexChange"]
303
+ }],
304
+ content: [{
305
+ type: i0.ContentChild,
306
+ args: [i0.forwardRef(() => RaqmCarouselContentComponent), {
307
+ descendants: true,
308
+ isSignal: true
309
+ }]
310
+ }]
311
+ }
312
+ });
313
+ var RaqmCarouselPreviousDirective = class RaqmCarouselPreviousDirective {
314
+ carousel = inject(RaqmCarouselComponent);
315
+ host = inject(ElementRef);
316
+ authoredDisabled = this.host.nativeElement.disabled;
317
+ unavailable = computed(() => this.authoredDisabled || !this.carousel.canPrevious(), ...ngDevMode ? [{ debugName: "unavailable" }] : /* istanbul ignore next */ []);
318
+ static ɵfac = i0.ɵɵngDeclareFactory({
319
+ minVersion: "12.0.0",
320
+ version: "22.2.2",
321
+ ngImport: i0,
322
+ type: RaqmCarouselPreviousDirective,
323
+ deps: [],
324
+ target: i0.ɵɵFactoryTarget.Directive
325
+ });
326
+ static ɵdir = i0.ɵɵngDeclareDirective({
327
+ minVersion: "14.0.0",
328
+ version: "22.2.2",
329
+ type: RaqmCarouselPreviousDirective,
330
+ isStandalone: true,
331
+ selector: "button[raqm-carousel-previous]",
332
+ host: {
333
+ attributes: { "type": "button" },
334
+ listeners: { "click": "carousel.previous()" },
335
+ properties: { "disabled": "unavailable()" }
336
+ },
337
+ ngImport: i0
338
+ });
339
+ };
340
+ i0.ɵɵngDeclareClassMetadata({
341
+ minVersion: "12.0.0",
342
+ version: "22.2.2",
343
+ ngImport: i0,
344
+ type: RaqmCarouselPreviousDirective,
345
+ decorators: [{
346
+ type: Directive,
347
+ args: [{
348
+ selector: "button[raqm-carousel-previous]",
349
+ host: {
350
+ type: "button",
351
+ "[disabled]": "unavailable()",
352
+ "(click)": "carousel.previous()"
353
+ }
354
+ }]
355
+ }]
356
+ });
357
+ var RaqmCarouselNextDirective = class RaqmCarouselNextDirective {
358
+ carousel = inject(RaqmCarouselComponent);
359
+ host = inject(ElementRef);
360
+ authoredDisabled = this.host.nativeElement.disabled;
361
+ unavailable = computed(() => this.authoredDisabled || !this.carousel.canNext(), ...ngDevMode ? [{ debugName: "unavailable" }] : /* istanbul ignore next */ []);
362
+ static ɵfac = i0.ɵɵngDeclareFactory({
363
+ minVersion: "12.0.0",
364
+ version: "22.2.2",
365
+ ngImport: i0,
366
+ type: RaqmCarouselNextDirective,
367
+ deps: [],
368
+ target: i0.ɵɵFactoryTarget.Directive
369
+ });
370
+ static ɵdir = i0.ɵɵngDeclareDirective({
371
+ minVersion: "14.0.0",
372
+ version: "22.2.2",
373
+ type: RaqmCarouselNextDirective,
374
+ isStandalone: true,
375
+ selector: "button[raqm-carousel-next]",
376
+ host: {
377
+ attributes: { "type": "button" },
378
+ listeners: { "click": "carousel.next()" },
379
+ properties: { "disabled": "unavailable()" }
380
+ },
381
+ ngImport: i0
382
+ });
383
+ };
384
+ i0.ɵɵngDeclareClassMetadata({
385
+ minVersion: "12.0.0",
386
+ version: "22.2.2",
387
+ ngImport: i0,
388
+ type: RaqmCarouselNextDirective,
389
+ decorators: [{
390
+ type: Directive,
391
+ args: [{
392
+ selector: "button[raqm-carousel-next]",
393
+ host: {
394
+ type: "button",
395
+ "[disabled]": "unavailable()",
396
+ "(click)": "carousel.next()"
397
+ }
398
+ }]
399
+ }]
400
+ });
401
+ const RaqmCarousel = [
402
+ RaqmCarouselComponent,
403
+ RaqmCarouselContentComponent,
404
+ RaqmCarouselItemDirective,
405
+ RaqmCarouselPreviousDirective,
406
+ RaqmCarouselNextDirective
407
+ ];
408
+ export { RaqmCarousel, RaqmCarouselComponent, RaqmCarouselContentComponent, RaqmCarouselItemDirective, RaqmCarouselNextDirective, RaqmCarouselPreviousDirective };
409
+
410
+ //# sourceMappingURL=raqm-ui-carousel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raqm-ui-carousel.mjs","names":[],"sources":["../../../projects/ui/carousel/carousel.ts","../../../projects/ui/carousel/public-api.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n Directive,\r\n ElementRef,\r\n afterRenderEffect,\r\n booleanAttribute,\r\n computed,\r\n contentChild,\r\n inject,\r\n input,\r\n InputSignal,\r\n output,\r\n signal,\r\n untracked,\r\n OnDestroy,\r\n} from '@angular/core';\r\nimport EmblaCarousel, {\r\n type EmblaCarouselType,\r\n type EmblaOptionsType,\r\n type EmblaPluginType,\r\n} from 'embla-carousel';\r\n\r\nexport type RaqmCarouselOptions = EmblaOptionsType;\r\n\r\n/** Raqm carousel item — a slide carrying `role=\"group\"` and `aria-roledescription=\"slide\"`; the app authors its accessible name. */\r\n@Directive({\r\n selector: '[raqm-carousel-item]',\r\n host: { class: 'raqm-carousel-item', role: 'group', 'aria-roledescription': 'slide' },\r\n})\r\nexport class RaqmCarouselItemDirective {}\r\n\r\n/** Raqm carousel content — the viewport that clips the track; track rules ship from the relationship partial. */\r\n@Component({\r\n selector: '[raqm-carousel-content]',\r\n template: '<div class=\"raqm-carousel-track\"><ng-content /></div>',\r\n styles: [\r\n `\r\n :host {\r\n display: block;\r\n overflow: hidden;\r\n }\r\n\r\n .raqm-carousel-track {\r\n display: flex;\r\n touch-action: pan-y pinch-zoom;\r\n }\r\n `,\r\n ],\r\n host: { class: 'raqm-carousel-content' },\r\n})\r\nexport class RaqmCarouselContentComponent {\r\n readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\r\n}\r\n\r\n/** Carousel root; `role=\"region\"` with an app-authored accessible name, and an authored `disabled` is never cleared. */\r\n@Component({\r\n selector: 'raqm-carousel',\r\n template: '<ng-content />',\r\n styleUrl: './carousel.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'raqm-carousel',\r\n role: 'region',\r\n 'aria-roledescription': 'carousel',\r\n '[attr.data-raqm-vertical]': 'vertical() ? \"\" : null',\r\n '(keydown)': 'onKey($event)',\r\n },\r\n})\r\nexport class RaqmCarouselComponent implements OnDestroy {\r\n /** A horizontal track by default; a bare `vertical` attribute selects the Y axis. */\r\n readonly vertical = input(false, { transform: booleanAttribute });\r\n readonly options: InputSignal<RaqmCarouselOptions> = input<RaqmCarouselOptions>({});\r\n readonly plugins: InputSignal<EmblaPluginType[]> = input<EmblaPluginType[]>([]);\r\n readonly apiReady = output<EmblaCarouselType>();\r\n readonly selectedIndexChange = output<number>();\r\n readonly content = contentChild(RaqmCarouselContentComponent, { descendants: true });\r\n readonly api = signal<EmblaCarouselType | undefined>(undefined);\r\n readonly index = signal(0);\r\n private readonly previousAvailable = signal(false);\r\n private readonly nextAvailable = signal(false);\r\n private viewport: HTMLElement | undefined;\r\n private readonly update = (api: EmblaCarouselType) => {\r\n const index = api.selectedScrollSnap();\r\n if (index !== this.index()) {\r\n this.index.set(index);\r\n this.selectedIndexChange.emit(index);\r\n }\r\n this.previousAvailable.set(api.canScrollPrev());\r\n this.nextAvailable.set(api.canScrollNext());\r\n };\r\n constructor() {\r\n afterRenderEffect(() => {\r\n const content = this.content();\r\n const options = this.options();\r\n const plugins = this.plugins();\r\n const vertical = this.vertical();\r\n const element = content?.element.nativeElement;\r\n if (!element) {\r\n untracked(() => {\r\n this.api()?.destroy();\r\n this.api.set(undefined);\r\n this.viewport = undefined;\r\n this.previousAvailable.set(false);\r\n this.nextAvailable.set(false);\r\n this.index.set(0);\r\n });\r\n return;\r\n }\r\n const direction =\r\n options.direction ?? (getComputedStyle(element).direction === 'rtl' ? 'rtl' : 'ltr');\r\n const effectiveOptions: EmblaOptionsType = {\r\n ...options,\r\n axis: vertical ? 'y' : 'x',\r\n direction,\r\n };\r\n untracked(() => {\r\n const existing = this.api();\r\n if (existing && this.viewport === element) {\r\n existing.reInit(effectiveOptions, plugins);\r\n } else {\r\n existing?.destroy();\r\n const api = EmblaCarousel(element, effectiveOptions, plugins);\r\n this.viewport = element;\r\n api.on('select', this.update).on('reInit', this.update);\r\n this.api.set(api);\r\n this.update(api);\r\n this.apiReady.emit(api);\r\n }\r\n });\r\n });\r\n }\r\n ngOnDestroy(): void {\r\n this.api()?.destroy();\r\n }\r\n canPrevious(): boolean {\r\n return this.previousAvailable();\r\n }\r\n canNext(): boolean {\r\n return this.nextAvailable();\r\n }\r\n previous(): void {\r\n this.api()?.scrollPrev();\r\n }\r\n next(): void {\r\n this.api()?.scrollNext();\r\n }\r\n go(index: number): void {\r\n this.api()?.scrollTo(index);\r\n }\r\n selectedScrollSnap(): number {\r\n return this.api()?.selectedScrollSnap() ?? 0;\r\n }\r\n scrollSnapList(): number[] {\r\n return this.api()?.scrollSnapList() ?? [];\r\n }\r\n protected onKey(event: KeyboardEvent): void {\r\n if (\r\n event.target instanceof HTMLElement &&\r\n (/^(INPUT|TEXTAREA|SELECT)$/.test(event.target.tagName) || event.target.isContentEditable)\r\n )\r\n return;\r\n const rtl =\r\n (this.api()?.internalEngine().options.direction ??\r\n getComputedStyle(event.currentTarget as HTMLElement).direction) === 'rtl';\r\n const previous = this.vertical() ? 'ArrowUp' : rtl ? 'ArrowRight' : 'ArrowLeft';\r\n const next = this.vertical() ? 'ArrowDown' : rtl ? 'ArrowLeft' : 'ArrowRight';\r\n if (event.key === previous || event.key === next) {\r\n event.preventDefault();\r\n if (event.key === next) this.next();\r\n else this.previous();\r\n }\r\n }\r\n}\r\n/** Raqm carousel previous — adds `type=\"button\"` and availability only; an authored `disabled` is never cleared and the accessible name stays app-owned. */\r\n@Directive({\r\n selector: 'button[raqm-carousel-previous]',\r\n host: {\r\n type: 'button',\r\n '[disabled]': 'unavailable()',\r\n '(click)': 'carousel.previous()',\r\n },\r\n})\r\nexport class RaqmCarouselPreviousDirective {\r\n protected readonly carousel = inject(RaqmCarouselComponent);\r\n private readonly host = inject<ElementRef<HTMLButtonElement>>(ElementRef);\r\n // Read at creation: availability can add to it but never removes it.\r\n private readonly authoredDisabled = this.host.nativeElement.disabled;\r\n protected readonly unavailable = computed(\r\n () => this.authoredDisabled || !this.carousel.canPrevious(),\r\n );\r\n}\r\n\r\n@Directive({\r\n selector: 'button[raqm-carousel-next]',\r\n host: { type: 'button', '[disabled]': 'unavailable()', '(click)': 'carousel.next()' },\r\n})\r\nexport class RaqmCarouselNextDirective {\r\n protected readonly carousel = inject(RaqmCarouselComponent);\r\n private readonly host = inject<ElementRef<HTMLButtonElement>>(ElementRef);\r\n private readonly authoredDisabled = this.host.nativeElement.disabled;\r\n protected readonly unavailable = computed(\r\n () => this.authoredDisabled || !this.carousel.canNext(),\r\n );\r\n}\r\n","import {\r\n RaqmCarouselComponent,\r\n RaqmCarouselContentComponent,\r\n RaqmCarouselItemDirective,\r\n RaqmCarouselPreviousDirective,\r\n RaqmCarouselNextDirective,\r\n} from './carousel';\r\n\r\nexport {\r\n RaqmCarouselComponent,\r\n RaqmCarouselContentComponent,\r\n RaqmCarouselItemDirective,\r\n RaqmCarouselPreviousDirective,\r\n RaqmCarouselNextDirective,\r\n};\r\nexport type { RaqmCarouselOptions } from './carousel';\r\n\r\nexport const RaqmCarousel = [\r\n RaqmCarouselComponent,\r\n RaqmCarouselContentComponent,\r\n RaqmCarouselItemDirective,\r\n RaqmCarouselPreviousDirective,\r\n RaqmCarouselNextDirective,\r\n] as const;\r\n"],"mappings":";;;AA8BA,IAAa,4BAAb,MAAa,0BAAyB;CAAzB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAyB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAzB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAyB,cAAA;EAAA,UAAA;EAAA,MAAA;GAAA,YAAA;IAAA,QAAA;IAAA,wBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAzB,GAAA,yBA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,UAAA;CAAA,CAAA;;AAA7B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA6B,YAAA,CAAA;EARzC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM;IACJ,MAAM;IACN,cAAc;IACd,WAAW;GACZ;EACF,CAAA;;;AAeD,IAAa,4BAAb,MAAa,0BAAyB;CACjB,WAAW,OAAO,qBAAqB;CACzC,OAAO,OAAsC,UAAU;CACvD,mBAAmB,KAAK,KAAK,cAAc;CACzC,cAAc,eACzB,KAAK,oBAAoB,CAAC,KAAK,SAAS,QAAO,GACtD,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CANU,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAyB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAzB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAyB,cAAA;EAAA,UAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,SAAA;GAAA,WAAA,EAAA,SAAA,kBAAA;GAAA,YAAA,EAAA,YAAA,gBAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAzB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAyB,YAAA,CAAA;EAJrC,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM;IAAE,MAAM;IAAU,cAAc;IAAiB,WAAW;GAAiB;EACpF,CAAA;;;ACnLD,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;AACQ"}
@@ -0,0 +1,86 @@
1
+ import * as i0 from "@angular/core";
2
+ import { Directive, ElementRef, forwardRef, inject } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
+ var RaqmCheckbox = class RaqmCheckbox {
5
+ host = inject(ElementRef);
6
+ onChange = () => {};
7
+ onTouched = () => {};
8
+ disabledStateFired = false;
9
+ constructor() {
10
+ const element = this.host.nativeElement;
11
+ if (!element.hasAttribute("type")) element.setAttribute("type", "checkbox");
12
+ }
13
+ writeValue(value) {
14
+ this.host.nativeElement.checked = !!value;
15
+ }
16
+ registerOnChange(fn) {
17
+ this.onChange = fn;
18
+ }
19
+ registerOnTouched(fn) {
20
+ this.onTouched = fn;
21
+ }
22
+ setDisabledState(isDisabled) {
23
+ if (this.disabledStateFired || isDisabled) this.host.nativeElement.disabled = isDisabled;
24
+ this.disabledStateFired = true;
25
+ }
26
+ handleChange(event) {
27
+ this.onChange(event.target.checked);
28
+ }
29
+ handleBlur() {
30
+ this.onTouched();
31
+ }
32
+ static ɵfac = i0.ɵɵngDeclareFactory({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.2",
35
+ ngImport: i0,
36
+ type: RaqmCheckbox,
37
+ deps: [],
38
+ target: i0.ɵɵFactoryTarget.Directive
39
+ });
40
+ static ɵdir = i0.ɵɵngDeclareDirective({
41
+ minVersion: "14.0.0",
42
+ version: "22.2.2",
43
+ type: RaqmCheckbox,
44
+ isStandalone: true,
45
+ selector: "input[raqm-checkbox]",
46
+ host: {
47
+ listeners: {
48
+ "change": "handleChange($event)",
49
+ "blur": "handleBlur()"
50
+ },
51
+ classAttribute: "raqm-checkbox"
52
+ },
53
+ providers: [{
54
+ provide: NG_VALUE_ACCESSOR,
55
+ useExisting: forwardRef(() => RaqmCheckbox),
56
+ multi: true
57
+ }],
58
+ ngImport: i0
59
+ });
60
+ };
61
+ i0.ɵɵngDeclareClassMetadata({
62
+ minVersion: "12.0.0",
63
+ version: "22.2.2",
64
+ ngImport: i0,
65
+ type: RaqmCheckbox,
66
+ decorators: [{
67
+ type: Directive,
68
+ args: [{
69
+ selector: "input[raqm-checkbox]",
70
+ host: {
71
+ class: "raqm-checkbox",
72
+ "(change)": "handleChange($event)",
73
+ "(blur)": "handleBlur()"
74
+ },
75
+ providers: [{
76
+ provide: NG_VALUE_ACCESSOR,
77
+ useExisting: forwardRef(() => RaqmCheckbox),
78
+ multi: true
79
+ }]
80
+ }]
81
+ }],
82
+ ctorParameters: () => []
83
+ });
84
+ export { RaqmCheckbox };
85
+
86
+ //# sourceMappingURL=raqm-ui-checkbox.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raqm-ui-checkbox.mjs","names":[],"sources":["../../../projects/ui/checkbox/checkbox.ts"],"sourcesContent":["import { Directive, ElementRef, forwardRef, inject } from '@angular/core';\r\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\r\n\r\n/**\r\n * Attaches the `raqm-checkbox` class to a native `<input>` and sets `type=\"checkbox\"` when absent.\r\n *\r\n * @remarks\r\n * Because the static `type` attribute is absent, Angular's checkbox validator does not match: with\r\n * Forms, use `Validators.requiredTrue` for a required checkbox.\r\n */\r\n@Directive({\r\n selector: 'input[raqm-checkbox]',\r\n host: {\r\n class: 'raqm-checkbox',\r\n '(change)': 'handleChange($event)',\r\n '(blur)': 'handleBlur()',\r\n },\r\n providers: [\r\n {\r\n provide: NG_VALUE_ACCESSOR,\r\n useExisting: forwardRef(() => RaqmCheckbox),\r\n multi: true,\r\n },\r\n ],\r\n})\r\nexport class RaqmCheckbox implements ControlValueAccessor {\r\n private readonly host = inject<ElementRef<HTMLInputElement>>(ElementRef);\r\n private onChange: (value: boolean) => void = () => {};\r\n private onTouched: () => void = () => {};\r\n private disabledStateFired = false;\r\n\r\n constructor() {\r\n const element = this.host.nativeElement;\r\n if (!element.hasAttribute('type')) {\r\n element.setAttribute('type', 'checkbox');\r\n }\r\n }\r\n\r\n writeValue(value: boolean | null | undefined): void {\r\n this.host.nativeElement.checked = !!value;\r\n }\r\n\r\n registerOnChange(fn: (value: boolean) => void): void {\r\n this.onChange = fn;\r\n }\r\n\r\n registerOnTouched(fn: () => void): void {\r\n this.onTouched = fn;\r\n }\r\n\r\n setDisabledState(isDisabled: boolean): void {\r\n // The first Forms pass always reports `false`; a static `disabled` attribute is only erased\r\n // once the control actually becomes disabled.\r\n if (this.disabledStateFired || isDisabled) {\r\n this.host.nativeElement.disabled = isDisabled;\r\n }\r\n this.disabledStateFired = true;\r\n }\r\n\r\n protected handleChange(event: Event): void {\r\n this.onChange((event.target as HTMLInputElement).checked);\r\n }\r\n\r\n protected handleBlur(): void {\r\n this.onTouched();\r\n }\r\n}\r\n"],"mappings":";;;AAyBA,IAAa,eAAb,MAAa,aAAY;CACN,OAAO,OAAqC,UAAU;CAC/D,iBAA0C,CAAE;CAC5C,kBAA6B,CAAE;CAC/B,qBAAqB;CAE7B,cAAA;EACE,MAAM,UAAU,KAAK,KAAK;EAC1B,IAAI,CAAC,QAAQ,aAAa,MAAM,GAC9B,QAAQ,aAAa,QAAQ,UAAU;CAE3C;CAEA,WAAW,OAAiC;EAC1C,KAAK,KAAK,cAAc,UAAU,CAAC,CAAC;CACtC;CAEA,iBAAiB,IAA4B;EAC3C,KAAK,WAAW;CAClB;CAEA,kBAAkB,IAAc;EAC9B,KAAK,YAAY;CACnB;CAEA,iBAAiB,YAAmB;EAGlC,IAAI,KAAK,sBAAsB,YAC7B,KAAK,KAAK,cAAc,WAAW;EAErC,KAAK,qBAAqB;CAC5B;CAEU,aAAa,OAAY;EACjC,KAAK,SAAU,MAAM,OAA4B,OAAO;CAC1D;CAEU,aAAU;EAClB,KAAK,UAAS;CAChB;CAxCW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAY,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAZ,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAY,cAAA;EAAA,UAAA;EAAA,MAAA;GAAA,WAAA;IAAA,UAAA;IAAA,QAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,WARZ,CACT;GACE,SAAS;GACT,aAAa,iBAAiB,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