@magmonium/one 0.4.30 → 0.4.31

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 (78) hide show
  1. package/assets/docs/en/app-release.md +0 -11
  2. package/assets/i18n/en.json +2 -0
  3. package/fesm2022/magmonium-one-attribute-value-CLBOZcme.mjs +255 -0
  4. package/fesm2022/magmonium-one-attribute-value-CLBOZcme.mjs.map +1 -0
  5. package/fesm2022/magmonium-one-base-checkbox-D7NYJdU3.mjs +77 -0
  6. package/fesm2022/magmonium-one-base-checkbox-D7NYJdU3.mjs.map +1 -0
  7. package/fesm2022/magmonium-one-base-dropdown-CEDsqaPz.mjs +604 -0
  8. package/fesm2022/magmonium-one-base-dropdown-CEDsqaPz.mjs.map +1 -0
  9. package/fesm2022/magmonium-one-base-input-BOaD-WIi.mjs +183 -0
  10. package/fesm2022/magmonium-one-base-input-BOaD-WIi.mjs.map +1 -0
  11. package/fesm2022/magmonium-one-base-text-D6p6_vsb.mjs +94 -0
  12. package/fesm2022/magmonium-one-base-text-D6p6_vsb.mjs.map +1 -0
  13. package/fesm2022/magmonium-one-button-rVNnp6G8.mjs +1281 -0
  14. package/fesm2022/magmonium-one-button-rVNnp6G8.mjs.map +1 -0
  15. package/fesm2022/magmonium-one-checkbox-rj4XHxb3.mjs +365 -0
  16. package/fesm2022/magmonium-one-checkbox-rj4XHxb3.mjs.map +1 -0
  17. package/fesm2022/magmonium-one-color-utl-CirPzUFk.mjs +449 -0
  18. package/fesm2022/magmonium-one-color-utl-CirPzUFk.mjs.map +1 -0
  19. package/fesm2022/magmonium-one-directives-DOBENX_K.mjs +1285 -0
  20. package/fesm2022/magmonium-one-directives-DOBENX_K.mjs.map +1 -0
  21. package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs +65 -0
  22. package/fesm2022/magmonium-one-file.service-Bo06pU3_.mjs.map +1 -0
  23. package/fesm2022/magmonium-one-group-Cue4x6tD.mjs +428 -0
  24. package/fesm2022/magmonium-one-group-Cue4x6tD.mjs.map +1 -0
  25. package/fesm2022/magmonium-one-header-DPVnaEOV.mjs +380 -0
  26. package/fesm2022/magmonium-one-header-DPVnaEOV.mjs.map +1 -0
  27. package/fesm2022/magmonium-one-icon-Dso-9RMN.mjs +833 -0
  28. package/fesm2022/magmonium-one-icon-Dso-9RMN.mjs.map +1 -0
  29. package/fesm2022/magmonium-one-image-editor-C7AtzEf6.mjs +438 -0
  30. package/fesm2022/magmonium-one-image-editor-C7AtzEf6.mjs.map +1 -0
  31. package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs +116 -0
  32. package/fesm2022/magmonium-one-image-frame-BTSaUSAi.mjs.map +1 -0
  33. package/fesm2022/magmonium-one-input-DqHPorA1.mjs +39 -0
  34. package/fesm2022/magmonium-one-input-DqHPorA1.mjs.map +1 -0
  35. package/fesm2022/magmonium-one-label-B30Q4Vut.mjs +574 -0
  36. package/fesm2022/magmonium-one-label-B30Q4Vut.mjs.map +1 -0
  37. package/fesm2022/magmonium-one-m-ref-Dt0DCm8X.mjs +147 -0
  38. package/fesm2022/magmonium-one-m-ref-Dt0DCm8X.mjs.map +1 -0
  39. package/fesm2022/magmonium-one-menu-BBOnOK4M.mjs +887 -0
  40. package/fesm2022/magmonium-one-menu-BBOnOK4M.mjs.map +1 -0
  41. package/fesm2022/magmonium-one-multi-range-DCOwngql.mjs +458 -0
  42. package/fesm2022/magmonium-one-multi-range-DCOwngql.mjs.map +1 -0
  43. package/fesm2022/magmonium-one-options-asset-D8Gg1yNl.mjs +97 -0
  44. package/fesm2022/magmonium-one-options-asset-D8Gg1yNl.mjs.map +1 -0
  45. package/fesm2022/magmonium-one-otp-DLF7Pq94.mjs +261 -0
  46. package/fesm2022/magmonium-one-otp-DLF7Pq94.mjs.map +1 -0
  47. package/fesm2022/magmonium-one-password-BSOU4RI0.mjs +217 -0
  48. package/fesm2022/magmonium-one-password-BSOU4RI0.mjs.map +1 -0
  49. package/fesm2022/magmonium-one-radio-CYnWLXPZ.mjs +111 -0
  50. package/fesm2022/magmonium-one-radio-CYnWLXPZ.mjs.map +1 -0
  51. package/fesm2022/magmonium-one-range-CmmZAr57.mjs +216 -0
  52. package/fesm2022/magmonium-one-range-CmmZAr57.mjs.map +1 -0
  53. package/fesm2022/magmonium-one-rolldown-runtime-DpJrqANO.mjs +11 -0
  54. package/fesm2022/magmonium-one-selector-DDnBYNLr.mjs +1065 -0
  55. package/fesm2022/magmonium-one-selector-DDnBYNLr.mjs.map +1 -0
  56. package/fesm2022/magmonium-one-size-converter-B-UubQQ0.mjs +1057 -0
  57. package/fesm2022/magmonium-one-size-converter-B-UubQQ0.mjs.map +1 -0
  58. package/fesm2022/magmonium-one-text-FXb-RyBh.mjs +406 -0
  59. package/fesm2022/magmonium-one-text-FXb-RyBh.mjs.map +1 -0
  60. package/fesm2022/magmonium-one-text-output-D2XQWyL0.mjs +296 -0
  61. package/fesm2022/magmonium-one-text-output-D2XQWyL0.mjs.map +1 -0
  62. package/fesm2022/magmonium-one-theme-a7GlFbzE.mjs +1 -0
  63. package/fesm2022/magmonium-one-toggle-C0eTrtkt.mjs +231 -0
  64. package/fesm2022/magmonium-one-toggle-C0eTrtkt.mjs.map +1 -0
  65. package/fesm2022/magmonium-one.mjs +49231 -2
  66. package/fesm2022/magmonium-one.mjs.map +1 -1
  67. package/package.json +8 -8
  68. package/types/magmonium-one.d.ts +13801 -9516
  69. package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs +0 -290
  70. package/fesm2022/magmonium-one-image-editor-QPOy7XQt.mjs.map +0 -1
  71. package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs +0 -41583
  72. package/fesm2022/magmonium-one-magmonium-one-BTi-rHpF.mjs.map +0 -1
  73. package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs +0 -201
  74. package/fesm2022/magmonium-one-otp-BcNCgGpz.mjs.map +0 -1
  75. package/fesm2022/magmonium-one-password-BDcSzmV_.mjs +0 -105
  76. package/fesm2022/magmonium-one-password-BDcSzmV_.mjs.map +0 -1
  77. package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs +0 -62
  78. package/fesm2022/magmonium-one-toggle-bLWTwEHE.mjs.map +0 -1
@@ -0,0 +1,1065 @@
1
+ import { G as MODAL_STORE_REF } from "./magmonium-one-size-converter-B-UubQQ0.mjs";
2
+ import "./magmonium-one-file.service-Bo06pU3_.mjs";
3
+ import { m as ThemeStore } from "./magmonium-one-color-utl-CirPzUFk.mjs";
4
+ import "./magmonium-one-theme-a7GlFbzE.mjs";
5
+ import * as i0 from "@angular/core";
6
+ import { ApplicationRef, DOCUMENT, DestroyRef, Directive, ElementRef, EnvironmentInjector, HostListener, Injectable, RendererFactory2, computed, createComponent, inject, input, linkedSignal, output, signal } from "@angular/core";
7
+ import { Observable } from "rxjs";
8
+ const MOBILE_QUERY = "(max-width: 767px)";
9
+ const TABLET_QUERY = "(min-width: 768px) and (max-width: 1199px)";
10
+ const DESKTOP_QUERY = "(min-width: 1200px)";
11
+ const TOUCH_QUERY = "(pointer: coarse)";
12
+ var DeviceService = class DeviceService {
13
+ isMobile = signal(this.matches(MOBILE_QUERY), ...ngDevMode ? [{ debugName: "isMobile" }] : /* istanbul ignore next */ []);
14
+ isTablet = signal(this.matches(TABLET_QUERY), ...ngDevMode ? [{ debugName: "isTablet" }] : /* istanbul ignore next */ []);
15
+ isDesktop = signal(this.matches(DESKTOP_QUERY), ...ngDevMode ? [{ debugName: "isDesktop" }] : /* istanbul ignore next */ []);
16
+ isTouch = signal(this.matches(TOUCH_QUERY), ...ngDevMode ? [{ debugName: "isTouch" }] : /* istanbul ignore next */ []);
17
+ destroyRef = inject(DestroyRef);
18
+ constructor() {
19
+ this.listen(MOBILE_QUERY, this.isMobile);
20
+ this.listen(TABLET_QUERY, this.isTablet);
21
+ this.listen(DESKTOP_QUERY, this.isDesktop);
22
+ this.listen(TOUCH_QUERY, this.isTouch);
23
+ }
24
+ matches(query) {
25
+ return typeof window !== "undefined" && window.matchMedia(query).matches;
26
+ }
27
+ listen(query, sig) {
28
+ if (typeof window === "undefined") return;
29
+ const mql = window.matchMedia(query);
30
+ const handler = (e) => sig.set(e.matches);
31
+ mql.addEventListener("change", handler);
32
+ this.destroyRef.onDestroy(() => mql.removeEventListener("change", handler));
33
+ }
34
+ static ɵfac = i0.ɵɵngDeclareFactory({
35
+ minVersion: "12.0.0",
36
+ version: "22.2.1",
37
+ ngImport: i0,
38
+ type: DeviceService,
39
+ deps: [],
40
+ target: i0.ɵɵFactoryTarget.Injectable
41
+ });
42
+ static ɵprov = i0.ɵɵngDeclareInjectable({
43
+ minVersion: "12.0.0",
44
+ version: "22.2.1",
45
+ ngImport: i0,
46
+ type: DeviceService,
47
+ providedIn: "root"
48
+ });
49
+ };
50
+ i0.ɵɵngDeclareClassMetadata({
51
+ minVersion: "12.0.0",
52
+ version: "22.2.1",
53
+ ngImport: i0,
54
+ type: DeviceService,
55
+ decorators: [{
56
+ type: Injectable,
57
+ args: [{ providedIn: "root" }]
58
+ }],
59
+ ctorParameters: () => []
60
+ });
61
+ var DomService = class DomService {
62
+ fullscreen = signal(false, ...ngDevMode ? [{ debugName: "fullscreen" }] : /* istanbul ignore next */ []);
63
+ document = inject(DOCUMENT);
64
+ applicationRef = inject(ApplicationRef);
65
+ renderer;
66
+ rendererFactory = inject(RendererFactory2);
67
+ deviceService = inject(DeviceService);
68
+ animationDuration = 300;
69
+ constructor() {
70
+ this.renderer = this.rendererFactory.createRenderer(null, null);
71
+ }
72
+ create({ component, className, styles, id, parentClassName, parentStyles, bindings }) {
73
+ if (this.document.querySelector(`#${id}`)) return;
74
+ const componentRef = createComponent(component, {
75
+ environmentInjector: this.applicationRef.injector,
76
+ bindings
77
+ });
78
+ this.applicationRef.attachView(componentRef.hostView);
79
+ const child = this.document.createElement("div");
80
+ child.className = className;
81
+ this.applyStyles(child, styles);
82
+ if (id) child.id = id;
83
+ this.renderer.appendChild(child, componentRef.hostView.rootNodes[0]);
84
+ if (parentClassName) {
85
+ this.append({
86
+ className: parentClassName,
87
+ child,
88
+ styles: parentStyles
89
+ });
90
+ return componentRef;
91
+ }
92
+ this.renderer.appendChild(this.document.querySelector("body"), child);
93
+ return componentRef;
94
+ }
95
+ destroy({ componentRef, parentClassName, id, className }) {
96
+ const parent = parentClassName ? this.document?.querySelector(`.${parentClassName}`) : void 0;
97
+ const elm = parent ? id ? parent.querySelector(`#${id}`) : parent.querySelector(`.${className}`) : this.document?.querySelector(`.${className}`) ?? this.document?.querySelector(`#${id}`);
98
+ if (!elm) return;
99
+ if (componentRef) {
100
+ this.applicationRef.detachView(componentRef.hostView);
101
+ componentRef.destroy();
102
+ }
103
+ elm.remove();
104
+ }
105
+ addBodyScroll() {
106
+ this.document.body.style.overflow = "auto";
107
+ }
108
+ removeBodyScroll() {
109
+ this.document.body.style.overflow = "hidden";
110
+ }
111
+ toggleFullScreen = () => {
112
+ const doc = this.document;
113
+ const docEl = doc.documentElement;
114
+ if (doc.fullscreenElement || doc.webkitFullscreenElement) {
115
+ (doc.exitFullscreen?.bind(doc) ?? doc.webkitExitFullscreen?.bind(doc))?.();
116
+ this.fullscreen.set(false);
117
+ } else {
118
+ (docEl.requestFullscreen?.bind(docEl) ?? docEl.webkitRequestFullscreen?.bind(docEl))?.();
119
+ this.fullscreen.set(true);
120
+ }
121
+ };
122
+ showHideScroll = (className) => {
123
+ const element = this.document.querySelector(`.${className}`);
124
+ this.document.body.style.overflow = element ? "hidden" : "auto";
125
+ };
126
+ toggleBodyScroll = () => {
127
+ const isHidden = this.document.body.style.overflow === "hidden";
128
+ this.document.body.style.overflow = isHidden ? "auto" : "hidden";
129
+ };
130
+ remove = (id, parentClassName, componentRef) => {
131
+ const element = this.document.querySelector(`.${parentClassName}`)?.querySelector(`#${id}`);
132
+ if (!element) return;
133
+ element.style.transition = `opacity ${this.animationDuration}ms ease`;
134
+ element.style.opacity = "0";
135
+ setTimeout(() => {
136
+ if (componentRef) {
137
+ this.applicationRef.detachView(componentRef.hostView);
138
+ componentRef.destroy();
139
+ }
140
+ element.remove();
141
+ }, this.animationDuration);
142
+ };
143
+ updateStyle = (className, styles) => {
144
+ const element = this.document.querySelector(`.${className}`);
145
+ if (!element || !styles) return;
146
+ this.applyStyles(element, styles);
147
+ };
148
+ updateStyleById = ({ id, parentClassName, styles }) => {
149
+ const element = (parentClassName ? this.document.querySelector(`.${parentClassName}`) : this.document)?.querySelector(`#${id}`);
150
+ if (!element || !styles) return;
151
+ this.applyStyles(element, styles);
152
+ };
153
+ positionRelativeTo = (element, boundary) => {
154
+ const positionClass = Array.from(element.classList).find((cls) => [
155
+ "top-left",
156
+ "top-right",
157
+ "bottom-left",
158
+ "bottom-right"
159
+ ].includes(cls));
160
+ this.applyPositionFromClass(element, boundary, positionClass ?? "bottom-left");
161
+ };
162
+ createDom = (html, className, boundary) => {
163
+ let element = this.document.querySelector(`.${className}`);
164
+ if (!element) {
165
+ element = this.document.createElement("div");
166
+ element.className = className;
167
+ this.renderer.appendChild(this.document.body, element);
168
+ }
169
+ element.innerHTML = html;
170
+ if (boundary) this.positionRelativeTo(element, boundary);
171
+ return element;
172
+ };
173
+ observeMutations = (targetNode, config = {
174
+ childList: true,
175
+ subtree: true
176
+ }) => {
177
+ return new Observable((subscriber) => {
178
+ const observer = new MutationObserver((mutations) => {
179
+ subscriber.next(mutations);
180
+ });
181
+ observer.observe(targetNode, config);
182
+ return () => observer.disconnect();
183
+ });
184
+ };
185
+ cleanup = (parentClassName) => {
186
+ const parent = this.document.querySelector(`.${parentClassName}`);
187
+ if (parent) parent.remove();
188
+ };
189
+ createAndAppend = (config) => {
190
+ const { boundary, ...createConfig } = config;
191
+ const componentRef = this.create(createConfig);
192
+ if (componentRef && boundary) {
193
+ const wrapper = componentRef.hostView.rootNodes[0]?.parentElement;
194
+ if (wrapper) this.positionRelativeTo(wrapper, boundary);
195
+ }
196
+ return componentRef;
197
+ };
198
+ applyStyles(element, styles) {
199
+ if (!styles) return;
200
+ Object.entries(styles).forEach(([property, value]) => {
201
+ this.renderer.setStyle(element, property, value);
202
+ });
203
+ }
204
+ append({ className, styles, child }) {
205
+ const parentClass = `.${className}`;
206
+ let parentElement = this.document.querySelector(parentClass);
207
+ if (!parentElement) {
208
+ parentElement = this.document.createElement("div");
209
+ parentElement.className = className;
210
+ this.applyStyles(parentElement, styles);
211
+ this.renderer.appendChild(this.document.querySelector("body"), parentElement);
212
+ }
213
+ this.renderer.appendChild(parentElement, child);
214
+ }
215
+ applyPositionFromClass = (element, boundary, positionClass) => {
216
+ const isMobile = this.deviceService.isMobile();
217
+ const styles = { position: "absolute" };
218
+ if (isMobile) {
219
+ styles["left"] = "0";
220
+ styles["right"] = "0";
221
+ styles["bottom"] = "0";
222
+ } else switch (positionClass) {
223
+ case "top-left":
224
+ styles["top"] = `${boundary.top}px`;
225
+ styles["left"] = `${boundary.left}px`;
226
+ break;
227
+ case "top-right":
228
+ styles["top"] = `${boundary.top}px`;
229
+ styles["left"] = `${boundary.right}px`;
230
+ break;
231
+ case "bottom-right":
232
+ styles["top"] = `${boundary.bottom}px`;
233
+ styles["left"] = `${boundary.right}px`;
234
+ break;
235
+ default:
236
+ styles["top"] = `${boundary.bottom}px`;
237
+ styles["left"] = `${boundary.left}px`;
238
+ }
239
+ Object.entries(styles).forEach(([prop, val]) => {
240
+ this.renderer.setStyle(element, prop, val);
241
+ });
242
+ };
243
+ static ɵfac = i0.ɵɵngDeclareFactory({
244
+ minVersion: "12.0.0",
245
+ version: "22.2.1",
246
+ ngImport: i0,
247
+ type: DomService,
248
+ deps: [],
249
+ target: i0.ɵɵFactoryTarget.Injectable
250
+ });
251
+ static ɵprov = i0.ɵɵngDeclareInjectable({
252
+ minVersion: "12.0.0",
253
+ version: "22.2.1",
254
+ ngImport: i0,
255
+ type: DomService,
256
+ providedIn: "root"
257
+ });
258
+ };
259
+ i0.ɵɵngDeclareClassMetadata({
260
+ minVersion: "12.0.0",
261
+ version: "22.2.1",
262
+ ngImport: i0,
263
+ type: DomService,
264
+ decorators: [{
265
+ type: Injectable,
266
+ args: [{ providedIn: "root" }]
267
+ }],
268
+ ctorParameters: () => []
269
+ });
270
+ var ScrollService = class ScrollService {
271
+ scrollTop = signal(0, ...ngDevMode ? [{ debugName: "scrollTop" }] : /* istanbul ignore next */ []);
272
+ constructor() {
273
+ this.setupWindowScroll();
274
+ }
275
+ setupWindowScroll() {
276
+ const onScroll = (event) => {
277
+ let top = 0;
278
+ if (event?.target && event.target !== document && event.target !== window) top = event.target.scrollTop;
279
+ else top = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
280
+ this.scrollTop.set(top);
281
+ };
282
+ window.addEventListener("scroll", onScroll, {
283
+ passive: true,
284
+ capture: true
285
+ });
286
+ onScroll();
287
+ }
288
+ static ɵfac = i0.ɵɵngDeclareFactory({
289
+ minVersion: "12.0.0",
290
+ version: "22.2.1",
291
+ ngImport: i0,
292
+ type: ScrollService,
293
+ deps: [],
294
+ target: i0.ɵɵFactoryTarget.Injectable
295
+ });
296
+ static ɵprov = i0.ɵɵngDeclareInjectable({
297
+ minVersion: "12.0.0",
298
+ version: "22.2.1",
299
+ ngImport: i0,
300
+ type: ScrollService,
301
+ providedIn: "root"
302
+ });
303
+ };
304
+ i0.ɵɵngDeclareClassMetadata({
305
+ minVersion: "12.0.0",
306
+ version: "22.2.1",
307
+ ngImport: i0,
308
+ type: ScrollService,
309
+ decorators: [{
310
+ type: Injectable,
311
+ args: [{ providedIn: "root" }]
312
+ }],
313
+ ctorParameters: () => []
314
+ });
315
+ var OverlayService = class OverlayService {
316
+ appRef = inject(ApplicationRef);
317
+ injector = inject(EnvironmentInjector);
318
+ overlayContainer;
319
+ open(component, config) {
320
+ if (!this.overlayContainer || !document.body.contains(this.overlayContainer)) {
321
+ this.overlayContainer = document.createElement("div");
322
+ this.overlayContainer.className = "overlay-container";
323
+ document.body.appendChild(this.overlayContainer);
324
+ }
325
+ const backdrop = document.createElement("div");
326
+ backdrop.className = config.backdropClass || "overlay-backdrop";
327
+ this.overlayContainer.appendChild(backdrop);
328
+ const wrapper = document.createElement("div");
329
+ wrapper.className = "overlay-wrapper";
330
+ this.overlayContainer.appendChild(wrapper);
331
+ const componentRef = createComponent(component, {
332
+ environmentInjector: this.injector,
333
+ hostElement: wrapper,
334
+ bindings: config.bindings || []
335
+ });
336
+ this.appRef.attachView(componentRef.hostView);
337
+ this.position(wrapper, config.triggerElement, config.offsetY || 4);
338
+ return new OverlayRef(componentRef, backdrop, wrapper, this.overlayContainer, config.triggerElement, config.offsetY || 4, config.closeOnFocusOut ?? false);
339
+ }
340
+ position(element, trigger, offsetY) {
341
+ const triggerRect = trigger.getBoundingClientRect();
342
+ const viewportWidth = window.innerWidth;
343
+ const viewportHeight = window.innerHeight;
344
+ element.style.position = "fixed";
345
+ element.style.zIndex = "9999";
346
+ element.style.visibility = "hidden";
347
+ element.style.display = "block";
348
+ const elementRect = element.getBoundingClientRect();
349
+ element.style.visibility = "";
350
+ const shouldConsiderHorizontal = elementRect.width - triggerRect.width > 150;
351
+ let position = "bottom";
352
+ let left = triggerRect.left;
353
+ let top = triggerRect.bottom + offsetY;
354
+ if (shouldConsiderHorizontal) {
355
+ const spaceRight = viewportWidth - triggerRect.right;
356
+ const spaceLeft = triggerRect.left;
357
+ const spaceBottom = viewportHeight - triggerRect.bottom;
358
+ if (spaceRight >= elementRect.width + offsetY) {
359
+ position = "right";
360
+ left = triggerRect.right + offsetY;
361
+ top = triggerRect.top;
362
+ } else if (spaceLeft >= elementRect.width + offsetY) {
363
+ position = "left";
364
+ left = triggerRect.left - elementRect.width - offsetY;
365
+ top = triggerRect.top;
366
+ } else if (spaceBottom >= elementRect.height + offsetY) {
367
+ position = "bottom";
368
+ left = Math.max(offsetY, Math.min(triggerRect.left, viewportWidth - elementRect.width - offsetY));
369
+ top = triggerRect.bottom + offsetY;
370
+ } else {
371
+ position = "top";
372
+ left = Math.max(offsetY, Math.min(triggerRect.left, viewportWidth - elementRect.width - offsetY));
373
+ top = triggerRect.top - elementRect.height - offsetY;
374
+ }
375
+ } else {
376
+ const spaceBottom = viewportHeight - triggerRect.bottom;
377
+ const spaceTop = triggerRect.top;
378
+ if (spaceBottom >= elementRect.height + offsetY) {
379
+ position = "bottom";
380
+ left = triggerRect.left;
381
+ top = triggerRect.bottom + offsetY;
382
+ } else if (spaceTop >= elementRect.height + offsetY) {
383
+ position = "top";
384
+ left = triggerRect.left;
385
+ top = triggerRect.top - elementRect.height - offsetY;
386
+ } else {
387
+ position = "bottom";
388
+ left = triggerRect.left;
389
+ top = triggerRect.bottom + offsetY;
390
+ }
391
+ element.style.width = `${triggerRect.width}px`;
392
+ }
393
+ element.style.left = `${left}px`;
394
+ element.style.top = `${top}px`;
395
+ element.setAttribute("data-position", position);
396
+ }
397
+ static ɵfac = i0.ɵɵngDeclareFactory({
398
+ minVersion: "12.0.0",
399
+ version: "22.2.1",
400
+ ngImport: i0,
401
+ type: OverlayService,
402
+ deps: [],
403
+ target: i0.ɵɵFactoryTarget.Injectable
404
+ });
405
+ static ɵprov = i0.ɵɵngDeclareInjectable({
406
+ minVersion: "12.0.0",
407
+ version: "22.2.1",
408
+ ngImport: i0,
409
+ type: OverlayService,
410
+ providedIn: "root"
411
+ });
412
+ };
413
+ i0.ɵɵngDeclareClassMetadata({
414
+ minVersion: "12.0.0",
415
+ version: "22.2.1",
416
+ ngImport: i0,
417
+ type: OverlayService,
418
+ decorators: [{
419
+ type: Injectable,
420
+ args: [{ providedIn: "root" }]
421
+ }]
422
+ });
423
+ var OverlayRef = class {
424
+ componentRef;
425
+ backdrop;
426
+ wrapper;
427
+ container;
428
+ trigger;
429
+ offsetY;
430
+ closeOnFocusOut;
431
+ repositionHandler;
432
+ backdropClickPromise;
433
+ backdropClickResolve;
434
+ backdropClickHandler;
435
+ focusOutPromise;
436
+ focusOutResolve;
437
+ triggerFocusOutHandler;
438
+ overlayFocusOutHandler;
439
+ constructor(componentRef, backdrop, wrapper, container, trigger, offsetY, closeOnFocusOut) {
440
+ this.componentRef = componentRef;
441
+ this.backdrop = backdrop;
442
+ this.wrapper = wrapper;
443
+ this.container = container;
444
+ this.trigger = trigger;
445
+ this.offsetY = offsetY;
446
+ this.closeOnFocusOut = closeOnFocusOut;
447
+ this.repositionHandler = () => this.updatePosition();
448
+ window.addEventListener("scroll", this.repositionHandler, true);
449
+ window.addEventListener("resize", this.repositionHandler);
450
+ this.backdropClickPromise = new Promise((resolve) => {
451
+ this.backdropClickResolve = resolve;
452
+ });
453
+ this.backdropClickHandler = () => {
454
+ if (this.backdropClickResolve) this.backdropClickResolve();
455
+ };
456
+ this.backdrop.addEventListener("click", this.backdropClickHandler);
457
+ this.focusOutPromise = new Promise((resolve) => {
458
+ this.focusOutResolve = resolve;
459
+ });
460
+ if (this.closeOnFocusOut) {
461
+ this.triggerFocusOutHandler = (event) => {
462
+ this.handleFocusOut(event, "trigger");
463
+ };
464
+ this.overlayFocusOutHandler = (event) => {
465
+ this.handleFocusOut(event, "overlay");
466
+ };
467
+ this.trigger.addEventListener("focusout", this.triggerFocusOutHandler);
468
+ this.wrapper.addEventListener("focusout", this.overlayFocusOutHandler);
469
+ }
470
+ }
471
+ backdropClick() {
472
+ return this.backdropClickPromise;
473
+ }
474
+ focusOut() {
475
+ return this.focusOutPromise;
476
+ }
477
+ dispose() {
478
+ window.removeEventListener("scroll", this.repositionHandler, true);
479
+ window.removeEventListener("resize", this.repositionHandler);
480
+ if (this.backdrop && this.backdropClickHandler) this.backdrop.removeEventListener("click", this.backdropClickHandler);
481
+ if (this.closeOnFocusOut) {
482
+ if (this.trigger && this.triggerFocusOutHandler) this.trigger.removeEventListener("focusout", this.triggerFocusOutHandler);
483
+ if (this.wrapper && this.overlayFocusOutHandler) this.wrapper.removeEventListener("focusout", this.overlayFocusOutHandler);
484
+ }
485
+ if (this.componentRef) this.componentRef.destroy();
486
+ if (this.backdrop && this.backdrop.parentNode) this.backdrop.parentNode.removeChild(this.backdrop);
487
+ if (this.wrapper && this.wrapper.parentNode) this.wrapper.parentNode.removeChild(this.wrapper);
488
+ if (this.container && this.container.children.length === 0) {
489
+ if (this.container.parentNode) this.container.parentNode.removeChild(this.container);
490
+ }
491
+ }
492
+ handleFocusOut(event, _source) {
493
+ const relatedTarget = event.relatedTarget;
494
+ if (!relatedTarget) {
495
+ setTimeout(() => {
496
+ const activeElement = document.activeElement;
497
+ if (!activeElement || activeElement === document.body) return;
498
+ const focusInTrigger = this.trigger?.contains(activeElement);
499
+ const focusInOverlay = this.wrapper?.contains(activeElement);
500
+ if (!focusInTrigger && !focusInOverlay) {
501
+ if (this.focusOutResolve) this.focusOutResolve();
502
+ }
503
+ }, 0);
504
+ return;
505
+ }
506
+ const focusStaysInTrigger = this.trigger.contains(relatedTarget);
507
+ const focusStaysInOverlay = this.wrapper.contains(relatedTarget);
508
+ if (!focusStaysInTrigger && !focusStaysInOverlay) {
509
+ if (this.focusOutResolve) this.focusOutResolve();
510
+ }
511
+ }
512
+ updatePosition() {
513
+ const triggerRect = this.trigger.getBoundingClientRect();
514
+ const viewportWidth = window.innerWidth;
515
+ const viewportHeight = window.innerHeight;
516
+ const elementRect = this.wrapper.getBoundingClientRect();
517
+ const shouldConsiderHorizontal = elementRect.width - triggerRect.width > 150;
518
+ let left = triggerRect.left;
519
+ let top = triggerRect.bottom + this.offsetY;
520
+ let position = "bottom";
521
+ if (shouldConsiderHorizontal) {
522
+ const spaceRight = viewportWidth - triggerRect.right;
523
+ const spaceLeft = triggerRect.left;
524
+ const spaceBottom = viewportHeight - triggerRect.bottom;
525
+ if (spaceRight >= elementRect.width + this.offsetY) {
526
+ position = "right";
527
+ left = triggerRect.right + this.offsetY;
528
+ top = triggerRect.top;
529
+ } else if (spaceLeft >= elementRect.width + this.offsetY) {
530
+ position = "left";
531
+ left = triggerRect.left - elementRect.width - this.offsetY;
532
+ top = triggerRect.top;
533
+ } else if (spaceBottom >= elementRect.height + this.offsetY) {
534
+ position = "bottom";
535
+ left = Math.max(this.offsetY, Math.min(triggerRect.left, viewportWidth - elementRect.width - this.offsetY));
536
+ top = triggerRect.bottom + this.offsetY;
537
+ } else {
538
+ position = "top";
539
+ left = Math.max(this.offsetY, Math.min(triggerRect.left, viewportWidth - elementRect.width - this.offsetY));
540
+ top = triggerRect.top - elementRect.height - this.offsetY;
541
+ }
542
+ this.wrapper.style.width = "";
543
+ } else {
544
+ const spaceBottom = viewportHeight - triggerRect.bottom;
545
+ const spaceTop = triggerRect.top;
546
+ if (spaceBottom >= elementRect.height + this.offsetY) {
547
+ position = "bottom";
548
+ left = triggerRect.left;
549
+ top = triggerRect.bottom + this.offsetY;
550
+ } else if (spaceTop >= elementRect.height + this.offsetY) {
551
+ position = "top";
552
+ left = triggerRect.left;
553
+ top = triggerRect.top - elementRect.height - this.offsetY;
554
+ } else {
555
+ position = "bottom";
556
+ left = triggerRect.left;
557
+ top = triggerRect.bottom + this.offsetY;
558
+ }
559
+ this.wrapper.style.width = `${triggerRect.width}px`;
560
+ }
561
+ this.wrapper.style.left = `${left}px`;
562
+ this.wrapper.style.top = `${top}px`;
563
+ this.wrapper.setAttribute("data-position", position);
564
+ }
565
+ };
566
+ var ThemeService = class ThemeService {
567
+ themeStore = inject(ThemeStore);
568
+ color = computed(() => this.themeStore.color(), ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
569
+ theme = computed(() => this.themeStore.theme(), ...ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []);
570
+ static ɵfac = i0.ɵɵngDeclareFactory({
571
+ minVersion: "12.0.0",
572
+ version: "22.2.1",
573
+ ngImport: i0,
574
+ type: ThemeService,
575
+ deps: [],
576
+ target: i0.ɵɵFactoryTarget.Injectable
577
+ });
578
+ static ɵprov = i0.ɵɵngDeclareInjectable({
579
+ minVersion: "12.0.0",
580
+ version: "22.2.1",
581
+ ngImport: i0,
582
+ type: ThemeService,
583
+ providedIn: "root"
584
+ });
585
+ };
586
+ i0.ɵɵngDeclareClassMetadata({
587
+ minVersion: "12.0.0",
588
+ version: "22.2.1",
589
+ ngImport: i0,
590
+ type: ThemeService,
591
+ decorators: [{
592
+ type: Injectable,
593
+ args: [{ providedIn: "root" }]
594
+ }]
595
+ });
596
+ var Direction;
597
+ (function(Direction) {
598
+ Direction["TOP"] = "top";
599
+ Direction["BOTTOM"] = "bottom";
600
+ Direction["LEFT"] = "left";
601
+ Direction["RIGHT"] = "right";
602
+ Direction["CENTER"] = "center";
603
+ Direction["UP_DOWN"] = "up-down";
604
+ })(Direction || (Direction = {}));
605
+ function isOutOfViewport(boundary) {
606
+ const margin = 8;
607
+ return boundary.top + boundary.height + margin < 0 || boundary.left + boundary.width + margin < 0 || boundary.bottom - margin > window.innerHeight || boundary.right - margin > window.innerWidth;
608
+ }
609
+ function calculatePosition(boundary, direction, width = "250px", height = "300px", align) {
610
+ const margin = 8;
611
+ const viewport = {
612
+ width: window.innerWidth,
613
+ height: window.innerHeight
614
+ };
615
+ const contentWidth = parseInt(width) || 250;
616
+ const contentHeight = parseInt(height) || 0;
617
+ const space = {
618
+ top: boundary.top,
619
+ bottom: viewport.height - boundary.bottom,
620
+ left: boundary.left,
621
+ right: viewport.width - boundary.right
622
+ };
623
+ const centerX = boundary.left + boundary.width / 2;
624
+ const centerY = boundary.top + boundary.height / 2;
625
+ direction = detectBestDirection(space, {
626
+ width: contentWidth,
627
+ height: contentHeight
628
+ }, direction);
629
+ const horizontalLeft = align === "right" ? calculateRightAlignedPosition(boundary.right, contentWidth, viewport.width) : align === "left" ? calculateLeftAlignedPosition(boundary.left, contentWidth, viewport.width) : calculateHorizontalPosition(centerX, contentWidth, viewport.width);
630
+ return {
631
+ [Direction.TOP]: {
632
+ top: "unset",
633
+ bottom: `${viewport.height - boundary.top + margin}px`,
634
+ "max-height": `${Math.max(space.top - 16, 0)}px`,
635
+ left: horizontalLeft
636
+ },
637
+ [Direction.BOTTOM]: {
638
+ top: `${boundary.bottom + margin}px`,
639
+ bottom: "unset",
640
+ "max-height": `${Math.max(space.bottom - 16, 0)}px`,
641
+ left: horizontalLeft
642
+ },
643
+ [Direction.LEFT]: {
644
+ right: `${viewport.width - boundary.left + margin}px`,
645
+ top: calculateVerticalPosition(centerY, contentHeight, viewport.height)
646
+ },
647
+ [Direction.RIGHT]: {
648
+ left: `${boundary.right + margin}px`,
649
+ top: calculateVerticalPosition(centerY, contentHeight, viewport.height)
650
+ },
651
+ [Direction.CENTER]: {
652
+ top: calculateVerticalPosition(centerY, contentHeight, viewport.height),
653
+ left: horizontalLeft
654
+ },
655
+ [Direction.UP_DOWN]: {
656
+ top: calculateVerticalPosition(centerY, contentHeight, viewport.height),
657
+ left: `${boundary.left}px`
658
+ }
659
+ }[direction] || {
660
+ top: calculateVerticalPosition(centerY, contentHeight, viewport.height),
661
+ left: horizontalLeft
662
+ };
663
+ }
664
+ function detectBestDirection(space, content, preferredDirection) {
665
+ const margin = 8;
666
+ const fits = (available, needed) => available >= needed + margin;
667
+ if (preferredDirection && preferredDirection !== Direction.UP_DOWN) {
668
+ if ({
669
+ [Direction.BOTTOM]: fits(space.bottom, content.height),
670
+ [Direction.TOP]: fits(space.top, content.height),
671
+ [Direction.LEFT]: fits(space.left, content.width),
672
+ [Direction.RIGHT]: fits(space.right, content.width)
673
+ }[preferredDirection]) return preferredDirection;
674
+ }
675
+ if (content.height <= 0) return Direction.BOTTOM;
676
+ if (fits(space.bottom, content.height)) return Direction.BOTTOM;
677
+ if (fits(space.top, content.height)) return Direction.TOP;
678
+ if (preferredDirection === Direction.UP_DOWN) return Direction.BOTTOM;
679
+ if (fits(space.right, content.width)) return Direction.RIGHT;
680
+ if (fits(space.left, content.width)) return Direction.LEFT;
681
+ return Direction.BOTTOM;
682
+ }
683
+ function calculateHorizontalPosition(center, width, viewportWidth) {
684
+ return calculatePosition1D(center, width, viewportWidth);
685
+ }
686
+ function calculateRightAlignedPosition(rightEdge, width, viewportWidth) {
687
+ const start = rightEdge - width;
688
+ if (start < 0) return "0px";
689
+ if (start + width > viewportWidth) return `${viewportWidth - width}px`;
690
+ return `${start}px`;
691
+ }
692
+ function calculateLeftAlignedPosition(leftEdge, width, viewportWidth) {
693
+ if (leftEdge < 0) return "0px";
694
+ if (leftEdge + width > viewportWidth) return `${viewportWidth - width}px`;
695
+ return `${leftEdge}px`;
696
+ }
697
+ function calculateVerticalPosition(center, height, viewportHeight) {
698
+ return calculatePosition1D(center, height, viewportHeight);
699
+ }
700
+ function calculatePosition1D(center, size, viewportSize) {
701
+ const start = center - size / 2;
702
+ if (start < 0) return "0px";
703
+ if (start + size > viewportSize) return `${viewportSize - size}px`;
704
+ return `${start}px`;
705
+ }
706
+ var SelectorDirective = class SelectorDirective {
707
+ static openSelector = {};
708
+ mSelector = input(void 0, ...ngDevMode ? [{ debugName: "mSelector" }] : /* istanbul ignore next */ []);
709
+ disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
710
+ opened = output();
711
+ closed = output();
712
+ deviceService = inject(DeviceService);
713
+ domService = inject(DomService);
714
+ modalStore = inject(MODAL_STORE_REF, { optional: true });
715
+ element = inject(ElementRef);
716
+ doc = inject(DOCUMENT);
717
+ componentRef;
718
+ modalId = signal(void 0, ...ngDevMode ? [{ debugName: "modalId" }] : /* istanbul ignore next */ []);
719
+ triggerFocusOutHandler;
720
+ boxFocusOutHandler;
721
+ outsideMouseDownHandler;
722
+ isCompact = () => this.deviceService.isMobile() || this.deviceService.isTablet() || this.deviceService.isTouch();
723
+ isOpen = linkedSignal({
724
+ ...ngDevMode ? { debugName: "isOpen" } : /* istanbul ignore next */ {},
725
+ source: () => ({
726
+ triggerMap: this.modalStore?.modalTriggerMap() ?? {},
727
+ id: this.modalId(),
728
+ isCompact: this.deviceService.isMobile() || this.deviceService.isTablet() || this.deviceService.isTouch()
729
+ }),
730
+ computation: ({ triggerMap, id, isCompact }, previous) => {
731
+ if (isCompact && id && !triggerMap[id]) {
732
+ this.closed.emit();
733
+ return false;
734
+ }
735
+ return previous?.value ?? false;
736
+ }
737
+ });
738
+ onClick(_e) {
739
+ if (this.disabled()) return;
740
+ if (this.isOpen()) {
741
+ this.close();
742
+ return;
743
+ }
744
+ this.open();
745
+ }
746
+ onArrowDown(event) {
747
+ if (this.disabled() || this.isOpen()) return;
748
+ event.preventDefault();
749
+ this.open();
750
+ }
751
+ onScroll(_event) {
752
+ this.handleViewportChange(_event);
753
+ }
754
+ ngOnDestroy() {
755
+ this.teardownFocusTracking();
756
+ this.close();
757
+ const selector = this.mSelector();
758
+ if (!selector) return;
759
+ if (SelectorDirective.openSelector[selector.base] === this) delete SelectorDirective.openSelector[selector.base];
760
+ }
761
+ close() {
762
+ if (!this.isOpen()) return;
763
+ this.teardownFocusTracking();
764
+ const selector = this.mSelector();
765
+ if (!selector) return;
766
+ const { base } = selector;
767
+ if (this.isCompact()) this.modalStore?.close(this.modalId());
768
+ else this.domService.destroy({
769
+ componentRef: this.componentRef,
770
+ parentClassName: "m-selector-box",
771
+ className: base
772
+ });
773
+ if (SelectorDirective.openSelector[base] === this) delete SelectorDirective.openSelector[base];
774
+ this.isOpen.set(false);
775
+ this.closed.emit();
776
+ }
777
+ open() {
778
+ if (this.isOpen()) return;
779
+ const base = this.mSelector()?.base;
780
+ if (!base) return;
781
+ if (SelectorDirective.openSelector[base] && SelectorDirective.openSelector[base] !== this) SelectorDirective.openSelector[base].close();
782
+ SelectorDirective.openSelector[base] = this;
783
+ if (this.isCompact()) this.openInModal();
784
+ else this.openInBox();
785
+ this.isOpen.set(true);
786
+ this.opened.emit();
787
+ }
788
+ openInBox = () => {
789
+ const selector = this.mSelector();
790
+ if (!selector) return;
791
+ const { component, base, bindings, dir, align, width, height } = selector;
792
+ const boundary = this.element.nativeElement.getBoundingClientRect();
793
+ const styles = { ...calculatePosition(boundary, dir, width, height, align) };
794
+ this.componentRef = this.domService.create({
795
+ component,
796
+ styles,
797
+ parentClassName: "m-selector-box",
798
+ className: base,
799
+ bindings
800
+ });
801
+ if (selector.matchTriggerWidth) this.alignToTrigger();
802
+ else if (!parseInt(height ?? "")) requestAnimationFrame(() => this.reflowAfterRender(boundary, selector));
803
+ requestAnimationFrame(() => this.setupFocusTracking());
804
+ };
805
+ reflowAfterRender(boundary, selector) {
806
+ const boxElement = this.getBoxElement();
807
+ if (!boxElement) return;
808
+ const actualHeight = boxElement.scrollHeight;
809
+ if (!actualHeight) return;
810
+ const { base, dir, align, width } = selector;
811
+ const style = calculatePosition(boundary, dir, width, `${actualHeight}px`, align);
812
+ this.domService.updateStyle(base, { ...style });
813
+ }
814
+ openInModal = () => {
815
+ const selector = this.mSelector();
816
+ if (!selector) return;
817
+ const { component, bindings } = selector;
818
+ this.modalId.set(this.modalStore?.open({
819
+ component,
820
+ bindings,
821
+ name: "bottom",
822
+ one: true,
823
+ config: { align: "bottom" }
824
+ }) ?? void 0);
825
+ };
826
+ getBoxElement() {
827
+ const base = this.mSelector()?.base;
828
+ if (!base) return null;
829
+ return this.doc.querySelector(`.m-selector-box .${base}`);
830
+ }
831
+ setupFocusTracking() {
832
+ this.triggerFocusOutHandler = (event) => this.handleFocusOut(event);
833
+ this.element.nativeElement.addEventListener("focusout", this.triggerFocusOutHandler);
834
+ const boxElement = this.getBoxElement();
835
+ if (boxElement) {
836
+ this.boxFocusOutHandler = (event) => this.handleFocusOut(event);
837
+ boxElement.addEventListener("focusout", this.boxFocusOutHandler);
838
+ }
839
+ this.outsideMouseDownHandler = (event) => this.handleOutsideMouseDown(event);
840
+ this.doc.addEventListener("mousedown", this.outsideMouseDownHandler);
841
+ }
842
+ teardownFocusTracking() {
843
+ if (this.triggerFocusOutHandler) {
844
+ this.element.nativeElement.removeEventListener("focusout", this.triggerFocusOutHandler);
845
+ this.triggerFocusOutHandler = void 0;
846
+ }
847
+ if (this.boxFocusOutHandler) {
848
+ this.getBoxElement()?.removeEventListener("focusout", this.boxFocusOutHandler);
849
+ this.boxFocusOutHandler = void 0;
850
+ }
851
+ if (this.outsideMouseDownHandler) {
852
+ this.doc.removeEventListener("mousedown", this.outsideMouseDownHandler);
853
+ this.outsideMouseDownHandler = void 0;
854
+ }
855
+ }
856
+ handleFocusOut(event) {
857
+ if (!this.isOpen()) return;
858
+ const relatedTarget = event.relatedTarget;
859
+ const triggerElement = this.element.nativeElement;
860
+ const boxElement = this.getBoxElement();
861
+ const selectorContainer = this.doc.querySelector(".m-selector-box");
862
+ if (!relatedTarget) {
863
+ setTimeout(() => {
864
+ if (!this.isOpen()) return;
865
+ const activeElement = this.doc.activeElement;
866
+ if (!activeElement || activeElement === this.doc.body) return;
867
+ const inTrigger = triggerElement.contains(activeElement);
868
+ const inBox = boxElement?.contains(activeElement) ?? false;
869
+ const inSelectorContainer = selectorContainer?.contains(activeElement) ?? false;
870
+ if (!inTrigger && !inBox && !inSelectorContainer) this.close();
871
+ }, 0);
872
+ return;
873
+ }
874
+ const inTrigger = triggerElement.contains(relatedTarget);
875
+ const inBox = boxElement?.contains(relatedTarget) ?? false;
876
+ const inSelectorContainer = selectorContainer?.contains(relatedTarget) ?? false;
877
+ if (!inTrigger && !inBox && !inSelectorContainer) this.close();
878
+ }
879
+ handleOutsideMouseDown(event) {
880
+ if (!this.isOpen()) return;
881
+ const target = event.target;
882
+ const triggerElement = this.element.nativeElement;
883
+ const boxElement = this.getBoxElement();
884
+ const inTrigger = triggerElement.contains(target);
885
+ const inBox = boxElement?.contains(target) ?? false;
886
+ if (inTrigger || inBox) return;
887
+ if (this.doc.querySelector(".m-selector-box")?.contains(target)) return;
888
+ this.close();
889
+ }
890
+ alignToTrigger() {
891
+ const boxElement = this.getBoxElement();
892
+ if (!boxElement) return;
893
+ const boundary = this.element.nativeElement.getBoundingClientRect();
894
+ const margin = 8;
895
+ const viewport = {
896
+ width: window.innerWidth,
897
+ height: window.innerHeight
898
+ };
899
+ const selector = this.mSelector();
900
+ const width = selector?.width || "250px";
901
+ const height = selector?.height || "300px";
902
+ const contentWidth = parseInt(width) || 250;
903
+ const contentHeight = parseInt(height) || 0;
904
+ const direction = detectBestDirection({
905
+ top: boundary.top,
906
+ bottom: viewport.height - boundary.bottom,
907
+ left: boundary.left,
908
+ right: viewport.width - boundary.right
909
+ }, {
910
+ width: contentWidth,
911
+ height: contentHeight
912
+ }, selector?.dir);
913
+ boxElement.style.width = `${boundary.width}px`;
914
+ boxElement.style.left = `${boundary.left}px`;
915
+ if (direction === Direction.TOP) {
916
+ boxElement.style.top = "unset";
917
+ boxElement.style.bottom = `${viewport.height - boundary.top + margin}px`;
918
+ boxElement.classList.add("open-upward");
919
+ } else {
920
+ boxElement.style.top = `${boundary.bottom + margin}px`;
921
+ boxElement.style.bottom = "unset";
922
+ boxElement.classList.remove("open-upward");
923
+ }
924
+ }
925
+ handleViewportChange(_event) {
926
+ const selector = this.mSelector();
927
+ if (!selector) return;
928
+ if (!this.isOpen() || this.isCompact()) return;
929
+ const boundary = this.element.nativeElement.getBoundingClientRect();
930
+ if (isOutOfViewport(boundary)) {
931
+ this.close();
932
+ return;
933
+ }
934
+ const { base, dir, align, width, height } = selector;
935
+ const style = calculatePosition(boundary, dir, width, height, align);
936
+ this.domService.updateStyle(base, { ...style });
937
+ if (selector.matchTriggerWidth) this.alignToTrigger();
938
+ }
939
+ static ɵfac = i0.ɵɵngDeclareFactory({
940
+ minVersion: "12.0.0",
941
+ version: "22.2.1",
942
+ ngImport: i0,
943
+ type: SelectorDirective,
944
+ deps: [],
945
+ target: i0.ɵɵFactoryTarget.Directive
946
+ });
947
+ static ɵdir = i0.ɵɵngDeclareDirective({
948
+ minVersion: "17.1.0",
949
+ version: "22.2.1",
950
+ type: SelectorDirective,
951
+ isStandalone: true,
952
+ selector: "[mSelector]",
953
+ inputs: {
954
+ mSelector: {
955
+ classPropertyName: "mSelector",
956
+ publicName: "mSelector",
957
+ isSignal: true,
958
+ isRequired: false,
959
+ transformFunction: null
960
+ },
961
+ disabled: {
962
+ classPropertyName: "disabled",
963
+ publicName: "disabled",
964
+ isSignal: true,
965
+ isRequired: false,
966
+ transformFunction: null
967
+ }
968
+ },
969
+ outputs: {
970
+ opened: "opened",
971
+ closed: "closed"
972
+ },
973
+ host: {
974
+ listeners: {
975
+ "click": "onClick($event)",
976
+ "keydown.enter": "onClick($event)",
977
+ "keydown.space": "onClick($event)",
978
+ "keydown.tab": "onClick($event)",
979
+ "focus": "onClick($event)",
980
+ "keydown.arrowdown": "onArrowDown($event)",
981
+ "window:scroll": "onScroll($event)",
982
+ "window:resize": "onScroll($event)"
983
+ },
984
+ properties: { "class.active": "isOpen()" }
985
+ },
986
+ exportAs: ["mSelector"],
987
+ ngImport: i0
988
+ });
989
+ };
990
+ i0.ɵɵngDeclareClassMetadata({
991
+ minVersion: "12.0.0",
992
+ version: "22.2.1",
993
+ ngImport: i0,
994
+ type: SelectorDirective,
995
+ decorators: [{
996
+ type: Directive,
997
+ args: [{
998
+ selector: "[mSelector]",
999
+ exportAs: "mSelector",
1000
+ host: { "[class.active]": "isOpen()" }
1001
+ }]
1002
+ }],
1003
+ propDecorators: {
1004
+ mSelector: [{
1005
+ type: i0.Input,
1006
+ args: [{
1007
+ isSignal: true,
1008
+ alias: "mSelector",
1009
+ required: false
1010
+ }]
1011
+ }],
1012
+ disabled: [{
1013
+ type: i0.Input,
1014
+ args: [{
1015
+ isSignal: true,
1016
+ alias: "disabled",
1017
+ required: false
1018
+ }]
1019
+ }],
1020
+ opened: [{
1021
+ type: i0.Output,
1022
+ args: ["opened"]
1023
+ }],
1024
+ closed: [{
1025
+ type: i0.Output,
1026
+ args: ["closed"]
1027
+ }],
1028
+ onClick: [
1029
+ {
1030
+ type: HostListener,
1031
+ args: ["click", ["$event"]]
1032
+ },
1033
+ {
1034
+ type: HostListener,
1035
+ args: ["keydown.enter", ["$event"]]
1036
+ },
1037
+ {
1038
+ type: HostListener,
1039
+ args: ["keydown.space", ["$event"]]
1040
+ },
1041
+ {
1042
+ type: HostListener,
1043
+ args: ["keydown.tab", ["$event"]]
1044
+ },
1045
+ {
1046
+ type: HostListener,
1047
+ args: ["focus", ["$event"]]
1048
+ }
1049
+ ],
1050
+ onArrowDown: [{
1051
+ type: HostListener,
1052
+ args: ["keydown.arrowdown", ["$event"]]
1053
+ }],
1054
+ onScroll: [{
1055
+ type: HostListener,
1056
+ args: ["window:scroll", ["$event"]]
1057
+ }, {
1058
+ type: HostListener,
1059
+ args: ["window:resize", ["$event"]]
1060
+ }]
1061
+ }
1062
+ });
1063
+ export { OverlayService as a, DeviceService as c, OverlayRef as i, Direction as n, ScrollService as o, ThemeService as r, DomService as s, SelectorDirective as t };
1064
+
1065
+ //# sourceMappingURL=magmonium-one-selector-DDnBYNLr.mjs.map