@ngxsmk/cdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/{types/ngxsmk-cdk-click-outside.d.ts → click-outside/click-outside.d.ts} +4 -6
  2. package/click-outside/click-outside.d.ts.map +1 -0
  3. package/click-outside/index.d.ts +2 -0
  4. package/click-outside/index.d.ts.map +1 -0
  5. package/click-outside/ngxsmk-cdk-click-outside.d.ts.map +1 -0
  6. package/esm2022/click-outside/click-outside.mjs +38 -0
  7. package/esm2022/click-outside/index.mjs +2 -0
  8. package/esm2022/click-outside/ngxsmk-cdk-click-outside.mjs +5 -0
  9. package/esm2022/focus-trap/focus-trap.mjs +69 -0
  10. package/esm2022/focus-trap/index.mjs +2 -0
  11. package/esm2022/focus-trap/ngxsmk-cdk-focus-trap.mjs +5 -0
  12. package/esm2022/focusable/focusable.mjs +15 -0
  13. package/esm2022/focusable/index.mjs +2 -0
  14. package/esm2022/focusable/ngxsmk-cdk-focusable.mjs +5 -0
  15. package/esm2022/live-announcer/index.mjs +2 -0
  16. package/esm2022/live-announcer/live-announcer.mjs +57 -0
  17. package/esm2022/live-announcer/ngxsmk-cdk-live-announcer.mjs +5 -0
  18. package/esm2022/media-query/index.mjs +2 -0
  19. package/esm2022/media-query/media-query.mjs +22 -0
  20. package/esm2022/media-query/ngxsmk-cdk-media-query.mjs +5 -0
  21. package/esm2022/ngxsmk-cdk.mjs +5 -0
  22. package/esm2022/public-api.mjs +11 -0
  23. package/esm2022/scroll-lock/index.mjs +2 -0
  24. package/esm2022/scroll-lock/ngxsmk-cdk-scroll-lock.mjs +5 -0
  25. package/esm2022/scroll-lock/scroll-lock.mjs +45 -0
  26. package/esm2022/visually-hidden/index.mjs +2 -0
  27. package/esm2022/visually-hidden/ngxsmk-cdk-visually-hidden.mjs +5 -0
  28. package/esm2022/visually-hidden/visually-hidden.mjs +34 -0
  29. package/fesm2022/ngxsmk-cdk-click-outside.mjs +4 -4
  30. package/fesm2022/ngxsmk-cdk-focus-trap.mjs +10 -6
  31. package/fesm2022/ngxsmk-cdk-focus-trap.mjs.map +1 -1
  32. package/fesm2022/ngxsmk-cdk-live-announcer.mjs +3 -3
  33. package/fesm2022/ngxsmk-cdk-media-query.mjs +1 -2
  34. package/fesm2022/ngxsmk-cdk-media-query.mjs.map +1 -1
  35. package/fesm2022/ngxsmk-cdk-scroll-lock.mjs +3 -3
  36. package/fesm2022/ngxsmk-cdk-visually-hidden.mjs +3 -3
  37. package/fesm2022/ngxsmk-cdk.mjs +7 -266
  38. package/fesm2022/ngxsmk-cdk.mjs.map +1 -1
  39. package/focus-trap/focus-trap.d.ts +19 -0
  40. package/focus-trap/focus-trap.d.ts.map +1 -0
  41. package/focus-trap/index.d.ts +2 -0
  42. package/focus-trap/index.d.ts.map +1 -0
  43. package/focus-trap/ngxsmk-cdk-focus-trap.d.ts.map +1 -0
  44. package/focusable/focusable.d.ts +5 -0
  45. package/focusable/focusable.d.ts.map +1 -0
  46. package/focusable/index.d.ts +2 -0
  47. package/focusable/index.d.ts.map +1 -0
  48. package/focusable/ngxsmk-cdk-focusable.d.ts.map +1 -0
  49. package/index.d.ts +6 -0
  50. package/live-announcer/index.d.ts +2 -0
  51. package/live-announcer/index.d.ts.map +1 -0
  52. package/{types/ngxsmk-cdk-live-announcer.d.ts → live-announcer/live-announcer.d.ts} +4 -7
  53. package/live-announcer/live-announcer.d.ts.map +1 -0
  54. package/live-announcer/ngxsmk-cdk-live-announcer.d.ts.map +1 -0
  55. package/media-query/index.d.ts +2 -0
  56. package/media-query/index.d.ts.map +1 -0
  57. package/{types/ngxsmk-cdk-media-query.d.ts → media-query/media-query.d.ts} +2 -4
  58. package/media-query/media-query.d.ts.map +1 -0
  59. package/media-query/ngxsmk-cdk-media-query.d.ts.map +1 -0
  60. package/ngxsmk-cdk.d.ts.map +1 -0
  61. package/package.json +30 -15
  62. package/public-api.d.ts +8 -0
  63. package/public-api.d.ts.map +1 -0
  64. package/scroll-lock/index.d.ts +2 -0
  65. package/scroll-lock/index.d.ts.map +1 -0
  66. package/scroll-lock/ngxsmk-cdk-scroll-lock.d.ts.map +1 -0
  67. package/{types/ngxsmk-cdk-scroll-lock.d.ts → scroll-lock/scroll-lock.d.ts} +3 -5
  68. package/scroll-lock/scroll-lock.d.ts.map +1 -0
  69. package/visually-hidden/index.d.ts +2 -0
  70. package/visually-hidden/index.d.ts.map +1 -0
  71. package/visually-hidden/ngxsmk-cdk-visually-hidden.d.ts.map +1 -0
  72. package/{types/ngxsmk-cdk-visually-hidden.d.ts → visually-hidden/visually-hidden.d.ts} +3 -5
  73. package/visually-hidden/visually-hidden.d.ts.map +1 -0
  74. package/types/ngxsmk-cdk-focus-trap.d.ts +0 -21
  75. package/types/ngxsmk-cdk-focusable.d.ts +0 -6
  76. package/types/ngxsmk-cdk.d.ts +0 -96
@@ -36,10 +36,10 @@ class NgxsmkScrollLock {
36
36
  body.style.overflow = this.previousOverflow;
37
37
  body.style.paddingRight = this.previousPaddingRight;
38
38
  }
39
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkScrollLock, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
40
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkScrollLock, providedIn: 'root' });
39
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkScrollLock, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
40
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkScrollLock, providedIn: 'root' });
41
41
  }
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkScrollLock, decorators: [{
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkScrollLock, decorators: [{
43
43
  type: Injectable,
44
44
  args: [{ providedIn: 'root' }]
45
45
  }] });
@@ -9,10 +9,10 @@ import { Directive } from '@angular/core';
9
9
  * ```
10
10
  */
11
11
  class NgxsmkVisuallyHidden {
12
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkVisuallyHidden, deps: [], target: i0.ɵɵFactoryTarget.Directive });
13
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: NgxsmkVisuallyHidden, isStandalone: true, selector: "[ngxsmkVisuallyHidden]", host: { styleAttribute: "\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n clip-path: inset(100%);\n white-space: nowrap;\n " }, ngImport: i0 });
12
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkVisuallyHidden, deps: [], target: i0.ɵɵFactoryTarget.Directive });
13
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.0", type: NgxsmkVisuallyHidden, isStandalone: true, selector: "[ngxsmkVisuallyHidden]", host: { styleAttribute: "\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n clip-path: inset(100%);\n white-space: nowrap;\n " }, ngImport: i0 });
14
14
  }
15
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkVisuallyHidden, decorators: [{
15
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkVisuallyHidden, decorators: [{
16
16
  type: Directive,
17
17
  args: [{
18
18
  standalone: true,
@@ -1,267 +1,10 @@
1
- import { DOCUMENT } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { inject, ElementRef, output, DestroyRef, Directive, input, booleanAttribute, afterNextRender, Injectable, signal } from '@angular/core';
4
- import { getFocusable as getFocusable$1 } from '@ngxsmk/cdk/focusable';
5
-
6
- /**
7
- * Emits when a pointer press lands outside the host element.
8
- *
9
- * ```html
10
- * <div class="menu" (ngxsmkClickOutside)="close()">…</div>
11
- * ```
12
- */
13
- class NgxsmkClickOutside {
14
- host = inject(ElementRef);
15
- ngxsmkClickOutside = output();
16
- constructor() {
17
- const document = inject(DOCUMENT);
18
- const destroyRef = inject(DestroyRef);
19
- const onPointerDown = (event) => {
20
- const target = event.target;
21
- if (target && !this.host.nativeElement.contains(target)) {
22
- this.ngxsmkClickOutside.emit(event);
23
- }
24
- };
25
- // Capture phase so stopped propagation inside other widgets can't
26
- // swallow the outside press.
27
- document.addEventListener('pointerdown', onPointerDown, true);
28
- destroyRef.onDestroy(() => document.removeEventListener('pointerdown', onPointerDown, true));
29
- }
30
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkClickOutside, deps: [], target: i0.ɵɵFactoryTarget.Directive });
31
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: NgxsmkClickOutside, isStandalone: true, selector: "[ngxsmkClickOutside]", outputs: { ngxsmkClickOutside: "ngxsmkClickOutside" }, ngImport: i0 });
32
- }
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkClickOutside, decorators: [{
34
- type: Directive,
35
- args: [{
36
- standalone: true,
37
- selector: '[ngxsmkClickOutside]',
38
- }]
39
- }], ctorParameters: () => [], propDecorators: { ngxsmkClickOutside: [{ type: i0.Output, args: ["ngxsmkClickOutside"] }] } });
40
-
41
- /** Selector matching elements that can receive keyboard focus. */
42
- const FOCUSABLE_SELECTOR = [
43
- 'a[href]',
44
- 'button:not([disabled])',
45
- 'input:not([disabled]):not([type="hidden"])',
46
- 'select:not([disabled])',
47
- 'textarea:not([disabled])',
48
- '[tabindex]:not([tabindex="-1"])',
49
- '[contenteditable="true"]',
50
- ].join(', ');
51
- /** All keyboard-focusable elements inside `container`, in DOM order. */
52
- function getFocusable(container) {
53
- return Array.from(container.querySelectorAll(FOCUSABLE_SELECTOR)).filter((el) => el.offsetParent !== null || el === el.ownerDocument.activeElement);
54
- }
55
-
56
- /**
57
- * Traps Tab/Shift+Tab focus cycling inside the host element while active.
58
- * With `ngxsmkFocusTrapAutoCapture`, moves focus into the trap on init and
59
- * restores the previously focused element on destroy.
60
- */
61
- class NgxsmkFocusTrap {
62
- host = inject(ElementRef);
63
- document = inject(DOCUMENT);
64
- /** Set to `false` to disable the trap without removing the directive. */
65
- ngxsmkFocusTrap = input(true, { ...(ngDevMode ? { debugName: "ngxsmkFocusTrap" } : /* istanbul ignore next */ {}), transform: (v) => v === '' || v === true || v === 'true' });
66
- /** Focus the first focusable child on init; restore focus on destroy. */
67
- ngxsmkFocusTrapAutoCapture = input(false, { ...(ngDevMode ? { debugName: "ngxsmkFocusTrapAutoCapture" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
68
- constructor() {
69
- const previouslyFocused = this.document.activeElement;
70
- afterNextRender(() => {
71
- if (this.ngxsmkFocusTrapAutoCapture()) {
72
- const focusable = getFocusable$1(this.host.nativeElement);
73
- (focusable[0] ?? this.host.nativeElement).focus();
74
- }
75
- });
76
- inject(DestroyRef).onDestroy(() => {
77
- if (this.ngxsmkFocusTrapAutoCapture()) {
78
- previouslyFocused?.focus?.();
79
- }
80
- });
81
- }
82
- onKeydown(event) {
83
- if (event.key !== 'Tab' || !this.ngxsmkFocusTrap()) {
84
- return;
85
- }
86
- const focusable = getFocusable$1(this.host.nativeElement);
87
- if (focusable.length === 0) {
88
- event.preventDefault();
89
- return;
90
- }
91
- const first = focusable[0];
92
- const last = focusable[focusable.length - 1];
93
- const active = this.document.activeElement;
94
- if (event.shiftKey && (active === first || active === this.host.nativeElement)) {
95
- event.preventDefault();
96
- last.focus();
97
- }
98
- else if (!event.shiftKey && active === last) {
99
- event.preventDefault();
100
- first.focus();
101
- }
102
- }
103
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkFocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive });
104
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: NgxsmkFocusTrap, isStandalone: true, selector: "[ngxsmkFocusTrap]", inputs: { ngxsmkFocusTrap: { classPropertyName: "ngxsmkFocusTrap", publicName: "ngxsmkFocusTrap", isSignal: true, isRequired: false, transformFunction: null }, ngxsmkFocusTrapAutoCapture: { classPropertyName: "ngxsmkFocusTrapAutoCapture", publicName: "ngxsmkFocusTrapAutoCapture", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 });
105
- }
106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkFocusTrap, decorators: [{
107
- type: Directive,
108
- args: [{
109
- standalone: true,
110
- selector: '[ngxsmkFocusTrap]',
111
- host: {
112
- '(keydown)': 'onKeydown($event)',
113
- },
114
- }]
115
- }], ctorParameters: () => [], propDecorators: { ngxsmkFocusTrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxsmkFocusTrap", required: false }] }], ngxsmkFocusTrapAutoCapture: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngxsmkFocusTrapAutoCapture", required: false }] }] } });
116
-
117
- /**
118
- * Announces messages to screen readers through a visually hidden
119
- * `aria-live` region appended to the document body.
120
- */
121
- class NgxsmkLiveAnnouncer {
122
- document = inject(DOCUMENT);
123
- region = null;
124
- clearTimer = null;
125
- announce(message, politeness = 'polite') {
126
- const region = this.ensureRegion();
127
- region.setAttribute('aria-live', politeness);
128
- // Clear first so repeating the same message is re-announced.
129
- region.textContent = '';
130
- setTimeout(() => (region.textContent = message));
131
- if (this.clearTimer) {
132
- clearTimeout(this.clearTimer);
133
- }
134
- this.clearTimer = setTimeout(() => (region.textContent = ''), 10_000);
135
- }
136
- ngOnDestroy() {
137
- if (this.clearTimer) {
138
- clearTimeout(this.clearTimer);
139
- }
140
- this.region?.remove();
141
- }
142
- ensureRegion() {
143
- if (!this.region) {
144
- const region = this.document.createElement('div');
145
- region.setAttribute('aria-atomic', 'true');
146
- region.className = 'ngxsmk-live-announcer';
147
- Object.assign(region.style, {
148
- position: 'absolute',
149
- width: '1px',
150
- height: '1px',
151
- margin: '-1px',
152
- padding: '0',
153
- border: '0',
154
- overflow: 'hidden',
155
- clipPath: 'inset(100%)',
156
- whiteSpace: 'nowrap',
157
- });
158
- this.document.body.appendChild(region);
159
- this.region = region;
160
- }
161
- return this.region;
162
- }
163
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkLiveAnnouncer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
164
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkLiveAnnouncer, providedIn: 'root' });
165
- }
166
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkLiveAnnouncer, decorators: [{
167
- type: Injectable,
168
- args: [{ providedIn: 'root' }]
169
- }] });
170
-
171
- /**
172
- * Reactive media query. Must be called in an injection context.
173
- *
174
- * ```ts
175
- * private readonly isMobile = injectMediaQuery('(max-width: 767px)');
176
- * ```
177
- */
178
- function injectMediaQuery(query) {
179
- const window = inject(DOCUMENT).defaultView;
180
- const matches = signal(false, /* @ts-ignore */
181
- ...(ngDevMode ? [{ debugName: "matches" }] : /* istanbul ignore next */ []));
182
- const media = window?.matchMedia?.(query);
183
- if (media) {
184
- matches.set(media.matches);
185
- const listener = (event) => matches.set(event.matches);
186
- media.addEventListener('change', listener);
187
- inject(DestroyRef).onDestroy(() => media.removeEventListener('change', listener));
188
- }
189
- return matches.asReadonly();
190
- }
191
-
192
- /**
193
- * Locks body scrolling (for dialogs, drawers, sheets). Reference-counted so
194
- * nested overlays can lock independently; compensates for scrollbar width to
195
- * prevent layout shift.
196
- */
197
- class NgxsmkScrollLock {
198
- document = inject(DOCUMENT);
199
- locks = 0;
200
- previousOverflow = '';
201
- previousPaddingRight = '';
202
- lock() {
203
- if (this.locks++ > 0) {
204
- return;
205
- }
206
- const body = this.document.body;
207
- const window = this.document.defaultView;
208
- const scrollbar = window
209
- ? window.innerWidth - this.document.documentElement.clientWidth
210
- : 0;
211
- this.previousOverflow = body.style.overflow;
212
- this.previousPaddingRight = body.style.paddingRight;
213
- body.style.overflow = 'hidden';
214
- if (scrollbar > 0) {
215
- body.style.paddingRight = `${scrollbar}px`;
216
- }
217
- }
218
- unlock() {
219
- if (this.locks === 0 || --this.locks > 0) {
220
- return;
221
- }
222
- const body = this.document.body;
223
- body.style.overflow = this.previousOverflow;
224
- body.style.paddingRight = this.previousPaddingRight;
225
- }
226
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkScrollLock, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
227
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkScrollLock, providedIn: 'root' });
228
- }
229
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkScrollLock, decorators: [{
230
- type: Injectable,
231
- args: [{ providedIn: 'root' }]
232
- }] });
233
-
234
- /**
235
- * Hides the host visually while keeping it available to screen readers.
236
- *
237
- * ```html
238
- * <span ngxsmkVisuallyHidden>Opens in a new window</span>
239
- * ```
240
- */
241
- class NgxsmkVisuallyHidden {
242
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkVisuallyHidden, deps: [], target: i0.ɵɵFactoryTarget.Directive });
243
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: NgxsmkVisuallyHidden, isStandalone: true, selector: "[ngxsmkVisuallyHidden]", host: { styleAttribute: "\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n clip-path: inset(100%);\n white-space: nowrap;\n " }, ngImport: i0 });
244
- }
245
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NgxsmkVisuallyHidden, decorators: [{
246
- type: Directive,
247
- args: [{
248
- standalone: true,
249
- selector: '[ngxsmkVisuallyHidden]',
250
- host: {
251
- style: `
252
- position: absolute;
253
- width: 1px;
254
- height: 1px;
255
- margin: -1px;
256
- padding: 0;
257
- border: 0;
258
- overflow: hidden;
259
- clip-path: inset(100%);
260
- white-space: nowrap;
261
- `,
262
- },
263
- }]
264
- }] });
1
+ export * from '@ngxsmk/cdk/click-outside';
2
+ export * from '@ngxsmk/cdk/focusable';
3
+ export * from '@ngxsmk/cdk/focus-trap';
4
+ export * from '@ngxsmk/cdk/live-announcer';
5
+ export * from '@ngxsmk/cdk/media-query';
6
+ export * from '@ngxsmk/cdk/scroll-lock';
7
+ export * from '@ngxsmk/cdk/visually-hidden';
265
8
 
266
9
  /*
267
10
  * Public API Surface of @ngxsmk/cdk
@@ -270,6 +13,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
270
13
  /**
271
14
  * Generated bundle index. Do not edit.
272
15
  */
273
-
274
- export { FOCUSABLE_SELECTOR, NgxsmkClickOutside, NgxsmkFocusTrap, NgxsmkLiveAnnouncer, NgxsmkScrollLock, NgxsmkVisuallyHidden, getFocusable, injectMediaQuery };
275
16
  //# sourceMappingURL=ngxsmk-cdk.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngxsmk-cdk.mjs","sources":["../../../../packages/cdk/click-outside/click-outside.ts","../../../../packages/cdk/focusable/focusable.ts","../../../../packages/cdk/focus-trap/focus-trap.ts","../../../../packages/cdk/live-announcer/live-announcer.ts","../../../../packages/cdk/media-query/media-query.ts","../../../../packages/cdk/scroll-lock/scroll-lock.ts","../../../../packages/cdk/visually-hidden/visually-hidden.ts","../../../../packages/cdk/public-api.ts","../../../../packages/cdk/ngxsmk-cdk.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n inject,\n output,\n} from '@angular/core';\n\n/**\n * Emits when a pointer press lands outside the host element.\n *\n * ```html\n * <div class=\"menu\" (ngxsmkClickOutside)=\"close()\">…</div>\n * ```\n */\n@Directive({\n standalone: true,\n selector: '[ngxsmkClickOutside]',\n})\nexport class NgxsmkClickOutside {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly ngxsmkClickOutside = output<Event>();\n\n constructor() {\n const document = inject(DOCUMENT);\n const destroyRef = inject(DestroyRef);\n\n const onPointerDown = (event: Event) => {\n const target = event.target as Node | null;\n if (target && !this.host.nativeElement.contains(target)) {\n this.ngxsmkClickOutside.emit(event);\n }\n };\n\n // Capture phase so stopped propagation inside other widgets can't\n // swallow the outside press.\n document.addEventListener('pointerdown', onPointerDown, true);\n destroyRef.onDestroy(() =>\n document.removeEventListener('pointerdown', onPointerDown, true),\n );\n }\n}\n","/** Selector matching elements that can receive keyboard focus. */\nexport const FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled]):not([type=\"hidden\"])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n '[contenteditable=\"true\"]',\n].join(', ');\n\n/** All keyboard-focusable elements inside `container`, in DOM order. */\nexport function getFocusable(container: HTMLElement): HTMLElement[] {\n return Array.from(\n container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\n ).filter(\n (el) => el.offsetParent !== null || el === el.ownerDocument.activeElement,\n );\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n afterNextRender,\n booleanAttribute,\n inject,\n input,\n} from '@angular/core';\nimport { getFocusable } from '@ngxsmk/cdk/focusable';\n\n/**\n * Traps Tab/Shift+Tab focus cycling inside the host element while active.\n * With `ngxsmkFocusTrapAutoCapture`, moves focus into the trap on init and\n * restores the previously focused element on destroy.\n */\n@Directive({\n standalone: true,\n selector: '[ngxsmkFocusTrap]',\n host: {\n '(keydown)': 'onKeydown($event)',\n },\n})\nexport class NgxsmkFocusTrap {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly document = inject(DOCUMENT);\n\n /** Set to `false` to disable the trap without removing the directive. */\n readonly ngxsmkFocusTrap = input(true, {\n transform: (v: unknown) => v === '' || v === true || v === 'true',\n });\n\n /** Focus the first focusable child on init; restore focus on destroy. */\n readonly ngxsmkFocusTrapAutoCapture = input(false, {\n transform: booleanAttribute,\n });\n\n constructor() {\n const previouslyFocused = this.document.activeElement as HTMLElement | null;\n\n afterNextRender(() => {\n if (this.ngxsmkFocusTrapAutoCapture()) {\n const focusable = getFocusable(this.host.nativeElement);\n (focusable[0] ?? this.host.nativeElement).focus();\n }\n });\n\n inject(DestroyRef).onDestroy(() => {\n if (this.ngxsmkFocusTrapAutoCapture()) {\n previouslyFocused?.focus?.();\n }\n });\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key !== 'Tab' || !this.ngxsmkFocusTrap()) {\n return;\n }\n const focusable = getFocusable(this.host.nativeElement);\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = this.document.activeElement;\n\n if (event.shiftKey && (active === first || active === this.host.nativeElement)) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n }\n}\n","import { Injectable, OnDestroy, inject } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\nexport type AnnouncerPoliteness = 'polite' | 'assertive';\n\n/**\n * Announces messages to screen readers through a visually hidden\n * `aria-live` region appended to the document body.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgxsmkLiveAnnouncer implements OnDestroy {\n private readonly document = inject(DOCUMENT);\n private region: HTMLElement | null = null;\n private clearTimer: ReturnType<typeof setTimeout> | null = null;\n\n announce(message: string, politeness: AnnouncerPoliteness = 'polite'): void {\n const region = this.ensureRegion();\n region.setAttribute('aria-live', politeness);\n\n // Clear first so repeating the same message is re-announced.\n region.textContent = '';\n setTimeout(() => (region.textContent = message));\n\n if (this.clearTimer) {\n clearTimeout(this.clearTimer);\n }\n this.clearTimer = setTimeout(() => (region.textContent = ''), 10_000);\n }\n\n ngOnDestroy(): void {\n if (this.clearTimer) {\n clearTimeout(this.clearTimer);\n }\n this.region?.remove();\n }\n\n private ensureRegion(): HTMLElement {\n if (!this.region) {\n const region = this.document.createElement('div');\n region.setAttribute('aria-atomic', 'true');\n region.className = 'ngxsmk-live-announcer';\n Object.assign(region.style, {\n position: 'absolute',\n width: '1px',\n height: '1px',\n margin: '-1px',\n padding: '0',\n border: '0',\n overflow: 'hidden',\n clipPath: 'inset(100%)',\n whiteSpace: 'nowrap',\n });\n this.document.body.appendChild(region);\n this.region = region;\n }\n return this.region;\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n DestroyRef,\n Signal,\n inject,\n signal,\n} from '@angular/core';\n\n/**\n * Reactive media query. Must be called in an injection context.\n *\n * ```ts\n * private readonly isMobile = injectMediaQuery('(max-width: 767px)');\n * ```\n */\nexport function injectMediaQuery(query: string): Signal<boolean> {\n const window = inject(DOCUMENT).defaultView;\n const matches = signal(false);\n\n const media = window?.matchMedia?.(query);\n if (media) {\n matches.set(media.matches);\n const listener = (event: MediaQueryListEvent) => matches.set(event.matches);\n media.addEventListener('change', listener);\n inject(DestroyRef).onDestroy(() =>\n media.removeEventListener('change', listener),\n );\n }\n\n return matches.asReadonly();\n}\n","import { Injectable, inject } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\n\n/**\n * Locks body scrolling (for dialogs, drawers, sheets). Reference-counted so\n * nested overlays can lock independently; compensates for scrollbar width to\n * prevent layout shift.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgxsmkScrollLock {\n private readonly document = inject(DOCUMENT);\n private locks = 0;\n private previousOverflow = '';\n private previousPaddingRight = '';\n\n lock(): void {\n if (this.locks++ > 0) {\n return;\n }\n const body = this.document.body;\n const window = this.document.defaultView;\n const scrollbar = window\n ? window.innerWidth - this.document.documentElement.clientWidth\n : 0;\n\n this.previousOverflow = body.style.overflow;\n this.previousPaddingRight = body.style.paddingRight;\n body.style.overflow = 'hidden';\n if (scrollbar > 0) {\n body.style.paddingRight = `${scrollbar}px`;\n }\n }\n\n unlock(): void {\n if (this.locks === 0 || --this.locks > 0) {\n return;\n }\n const body = this.document.body;\n body.style.overflow = this.previousOverflow;\n body.style.paddingRight = this.previousPaddingRight;\n }\n}\n","import { Directive } from '@angular/core';\n\n/**\n * Hides the host visually while keeping it available to screen readers.\n *\n * ```html\n * <span ngxsmkVisuallyHidden>Opens in a new window</span>\n * ```\n */\n@Directive({\n standalone: true,\n selector: '[ngxsmkVisuallyHidden]',\n host: {\n style: `\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n border: 0;\n overflow: hidden;\n clip-path: inset(100%);\n white-space: nowrap;\n `,\n },\n})\nexport class NgxsmkVisuallyHidden {}\n","/*\n * Public API Surface of @ngxsmk/cdk\n */\n\nexport * from './click-outside';\nexport * from './focusable';\nexport * from './focus-trap';\nexport * from './live-announcer';\nexport * from './media-query';\nexport * from './scroll-lock';\nexport * from './visually-hidden';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["getFocusable"],"mappings":";;;;;AASA;;;;;;AAMG;MAKU,kBAAkB,CAAA;AACZ,IAAA,IAAI,GAAG,MAAM,CAA0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AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,wBAAwB;AAClC,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE;;;;;;;;;;AAUN,IAAA,CAAA;AACF,qBAAA;AACF,iBAAA;;;ACzBD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"ngxsmk-cdk.mjs","sources":["../../../../packages/cdk/public-api.ts","../../../../packages/cdk/ngxsmk-cdk.ts"],"sourcesContent":["/*\n * Public API Surface of @ngxsmk/cdk\n */\n\nexport * from '@ngxsmk/cdk/click-outside';\nexport * from '@ngxsmk/cdk/focusable';\nexport * from '@ngxsmk/cdk/focus-trap';\nexport * from '@ngxsmk/cdk/live-announcer';\nexport * from '@ngxsmk/cdk/media-query';\nexport * from '@ngxsmk/cdk/scroll-lock';\nexport * from '@ngxsmk/cdk/visually-hidden';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;;AAEG;;ACFH;;AAEG"}
@@ -0,0 +1,19 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * Traps Tab/Shift+Tab focus cycling inside the host element while active.
4
+ * With `ngxsmkFocusTrapAutoCapture`, moves focus into the trap on init and
5
+ * restores the previously focused element on destroy.
6
+ */
7
+ export declare class NgxsmkFocusTrap {
8
+ private readonly host;
9
+ private readonly document;
10
+ /** Set to `false` to disable the trap without removing the directive. */
11
+ readonly ngxsmkFocusTrap: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
12
+ /** Focus the first focusable child on init; restore focus on destroy. */
13
+ readonly ngxsmkFocusTrapAutoCapture: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
14
+ constructor();
15
+ protected onKeydown(event: KeyboardEvent): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsmkFocusTrap, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxsmkFocusTrap, "[ngxsmkFocusTrap]", never, { "ngxsmkFocusTrap": { "alias": "ngxsmkFocusTrap"; "required": false; "isSignal": true; }; "ngxsmkFocusTrapAutoCapture": { "alias": "ngxsmkFocusTrapAutoCapture"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
18
+ }
19
+ //# sourceMappingURL=focus-trap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focus-trap.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/focus-trap/focus-trap.ts"],"names":[],"mappings":";AAYA;;;;GAIG;AACH,qBAOa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+C;IACpE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAE7C,yEAAyE;IACzE,QAAQ,CAAC,eAAe,qEAErB;IAEH,yEAAyE;IACzE,QAAQ,CAAC,0BAA0B,qEAEhC;;IAmBH,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;yCA/BpC,eAAe;2CAAf,eAAe;CAqD3B"}
@@ -0,0 +1,2 @@
1
+ export * from './focus-trap';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/focus-trap/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxsmk-cdk-focus-trap.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/focus-trap/ngxsmk-cdk-focus-trap.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Selector matching elements that can receive keyboard focus. */
2
+ export declare const FOCUSABLE_SELECTOR: string;
3
+ /** All keyboard-focusable elements inside `container`, in DOM order. */
4
+ export declare function getFocusable(container: HTMLElement): HTMLElement[];
5
+ //# sourceMappingURL=focusable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusable.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/focusable/focusable.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,QAQnB,CAAC;AAEb,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,EAAE,CAMlE"}
@@ -0,0 +1,2 @@
1
+ export * from './focusable';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/focusable/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxsmk-cdk-focusable.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/focusable/ngxsmk-cdk-focusable.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@ngxsmk/cdk" />
5
+ export * from './public-api';
6
+ //# sourceMappingURL=ngxsmk-cdk.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from './live-announcer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/live-announcer/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -1,12 +1,11 @@
1
- import * as i0 from '@angular/core';
2
1
  import { OnDestroy } from '@angular/core';
3
-
4
- type AnnouncerPoliteness = 'polite' | 'assertive';
2
+ import * as i0 from "@angular/core";
3
+ export type AnnouncerPoliteness = 'polite' | 'assertive';
5
4
  /**
6
5
  * Announces messages to screen readers through a visually hidden
7
6
  * `aria-live` region appended to the document body.
8
7
  */
9
- declare class NgxsmkLiveAnnouncer implements OnDestroy {
8
+ export declare class NgxsmkLiveAnnouncer implements OnDestroy {
10
9
  private readonly document;
11
10
  private region;
12
11
  private clearTimer;
@@ -16,6 +15,4 @@ declare class NgxsmkLiveAnnouncer implements OnDestroy {
16
15
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxsmkLiveAnnouncer, never>;
17
16
  static ɵprov: i0.ɵɵInjectableDeclaration<NgxsmkLiveAnnouncer>;
18
17
  }
19
-
20
- export { NgxsmkLiveAnnouncer };
21
- export type { AnnouncerPoliteness };
18
+ //# sourceMappingURL=live-announcer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-announcer.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/live-announcer/live-announcer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAU,MAAM,eAAe,CAAC;;AAG9D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEzD;;;GAGG;AACH,qBACa,mBAAoB,YAAW,SAAS;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,UAAU,CAA8C;IAEhE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,mBAA8B,GAAG,IAAI;IAc3E,WAAW,IAAI,IAAI;IAOnB,OAAO,CAAC,YAAY;yCA1BT,mBAAmB;6CAAnB,mBAAmB;CA+C/B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxsmk-cdk-live-announcer.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/live-announcer/ngxsmk-cdk-live-announcer.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './media-query';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/media-query/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { Signal } from '@angular/core';
2
-
3
2
  /**
4
3
  * Reactive media query. Must be called in an injection context.
5
4
  *
@@ -7,6 +6,5 @@ import { Signal } from '@angular/core';
7
6
  * private readonly isMobile = injectMediaQuery('(max-width: 767px)');
8
7
  * ```
9
8
  */
10
- declare function injectMediaQuery(query: string): Signal<boolean>;
11
-
12
- export { injectMediaQuery };
9
+ export declare function injectMediaQuery(query: string): Signal<boolean>;
10
+ //# sourceMappingURL=media-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-query.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/media-query/media-query.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,MAAM,EAGP,MAAM,eAAe,CAAC;AAEvB;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAe/D"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxsmk-cdk-media-query.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/media-query/ngxsmk-cdk-media-query.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxsmk-cdk.d.ts","sourceRoot":"","sources":["../../../packages/cdk/ngxsmk-cdk.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngxsmk/cdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": ">=17.3.0",
@@ -14,43 +14,58 @@
14
14
  "access": "public"
15
15
  },
16
16
  "module": "fesm2022/ngxsmk-cdk.mjs",
17
- "typings": "types/ngxsmk-cdk.d.ts",
17
+ "typings": "index.d.ts",
18
18
  "exports": {
19
19
  "./package.json": {
20
20
  "default": "./package.json"
21
21
  },
22
22
  ".": {
23
- "types": "./types/ngxsmk-cdk.d.ts",
23
+ "types": "./index.d.ts",
24
+ "esm2022": "./esm2022/ngxsmk-cdk.mjs",
25
+ "esm": "./esm2022/ngxsmk-cdk.mjs",
24
26
  "default": "./fesm2022/ngxsmk-cdk.mjs"
25
27
  },
26
- "./click-outside": {
27
- "types": "./types/ngxsmk-cdk-click-outside.d.ts",
28
- "default": "./fesm2022/ngxsmk-cdk-click-outside.mjs"
29
- },
30
28
  "./focus-trap": {
31
- "types": "./types/ngxsmk-cdk-focus-trap.d.ts",
29
+ "types": "./focus-trap/index.d.ts",
30
+ "esm2022": "./esm2022/focus-trap/ngxsmk-cdk-focus-trap.mjs",
31
+ "esm": "./esm2022/focus-trap/ngxsmk-cdk-focus-trap.mjs",
32
32
  "default": "./fesm2022/ngxsmk-cdk-focus-trap.mjs"
33
33
  },
34
34
  "./focusable": {
35
- "types": "./types/ngxsmk-cdk-focusable.d.ts",
35
+ "types": "./focusable/index.d.ts",
36
+ "esm2022": "./esm2022/focusable/ngxsmk-cdk-focusable.mjs",
37
+ "esm": "./esm2022/focusable/ngxsmk-cdk-focusable.mjs",
36
38
  "default": "./fesm2022/ngxsmk-cdk-focusable.mjs"
37
39
  },
38
40
  "./live-announcer": {
39
- "types": "./types/ngxsmk-cdk-live-announcer.d.ts",
41
+ "types": "./live-announcer/index.d.ts",
42
+ "esm2022": "./esm2022/live-announcer/ngxsmk-cdk-live-announcer.mjs",
43
+ "esm": "./esm2022/live-announcer/ngxsmk-cdk-live-announcer.mjs",
40
44
  "default": "./fesm2022/ngxsmk-cdk-live-announcer.mjs"
41
45
  },
42
46
  "./media-query": {
43
- "types": "./types/ngxsmk-cdk-media-query.d.ts",
47
+ "types": "./media-query/index.d.ts",
48
+ "esm2022": "./esm2022/media-query/ngxsmk-cdk-media-query.mjs",
49
+ "esm": "./esm2022/media-query/ngxsmk-cdk-media-query.mjs",
44
50
  "default": "./fesm2022/ngxsmk-cdk-media-query.mjs"
45
51
  },
52
+ "./click-outside": {
53
+ "types": "./click-outside/index.d.ts",
54
+ "esm2022": "./esm2022/click-outside/ngxsmk-cdk-click-outside.mjs",
55
+ "esm": "./esm2022/click-outside/ngxsmk-cdk-click-outside.mjs",
56
+ "default": "./fesm2022/ngxsmk-cdk-click-outside.mjs"
57
+ },
46
58
  "./scroll-lock": {
47
- "types": "./types/ngxsmk-cdk-scroll-lock.d.ts",
59
+ "types": "./scroll-lock/index.d.ts",
60
+ "esm2022": "./esm2022/scroll-lock/ngxsmk-cdk-scroll-lock.mjs",
61
+ "esm": "./esm2022/scroll-lock/ngxsmk-cdk-scroll-lock.mjs",
48
62
  "default": "./fesm2022/ngxsmk-cdk-scroll-lock.mjs"
49
63
  },
50
64
  "./visually-hidden": {
51
- "types": "./types/ngxsmk-cdk-visually-hidden.d.ts",
65
+ "types": "./visually-hidden/index.d.ts",
66
+ "esm2022": "./esm2022/visually-hidden/ngxsmk-cdk-visually-hidden.mjs",
67
+ "esm": "./esm2022/visually-hidden/ngxsmk-cdk-visually-hidden.mjs",
52
68
  "default": "./fesm2022/ngxsmk-cdk-visually-hidden.mjs"
53
69
  }
54
- },
55
- "type": "module"
70
+ }
56
71
  }
@@ -0,0 +1,8 @@
1
+ export * from '@ngxsmk/cdk/click-outside';
2
+ export * from '@ngxsmk/cdk/focusable';
3
+ export * from '@ngxsmk/cdk/focus-trap';
4
+ export * from '@ngxsmk/cdk/live-announcer';
5
+ export * from '@ngxsmk/cdk/media-query';
6
+ export * from '@ngxsmk/cdk/scroll-lock';
7
+ export * from '@ngxsmk/cdk/visually-hidden';
8
+ //# sourceMappingURL=public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../../../packages/cdk/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './scroll-lock';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/scroll-lock/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngxsmk-cdk-scroll-lock.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/scroll-lock/ngxsmk-cdk-scroll-lock.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
@@ -1,11 +1,10 @@
1
- import * as i0 from '@angular/core';
2
-
1
+ import * as i0 from "@angular/core";
3
2
  /**
4
3
  * Locks body scrolling (for dialogs, drawers, sheets). Reference-counted so
5
4
  * nested overlays can lock independently; compensates for scrollbar width to
6
5
  * prevent layout shift.
7
6
  */
8
- declare class NgxsmkScrollLock {
7
+ export declare class NgxsmkScrollLock {
9
8
  private readonly document;
10
9
  private locks;
11
10
  private previousOverflow;
@@ -15,5 +14,4 @@ declare class NgxsmkScrollLock {
15
14
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxsmkScrollLock, never>;
16
15
  static ɵprov: i0.ɵɵInjectableDeclaration<NgxsmkScrollLock>;
17
16
  }
18
-
19
- export { NgxsmkScrollLock };
17
+ //# sourceMappingURL=scroll-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-lock.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/scroll-lock/scroll-lock.ts"],"names":[],"mappings":";AAGA;;;;GAIG;AACH,qBACa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,oBAAoB,CAAM;IAElC,IAAI,IAAI,IAAI;IAkBZ,MAAM,IAAI,IAAI;yCAxBH,gBAAgB;6CAAhB,gBAAgB;CAgC5B"}