@ngxsmk/cdk 1.0.0 → 1.2.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.
- package/autofocus/autofocus.d.ts +19 -0
- package/autofocus/autofocus.d.ts.map +1 -0
- package/autofocus/index.d.ts +2 -0
- package/autofocus/index.d.ts.map +1 -0
- package/autofocus/ngxsmk-cdk-autofocus.d.ts.map +1 -0
- package/{types/ngxsmk-cdk-click-outside.d.ts → click-outside/click-outside.d.ts} +4 -6
- package/click-outside/click-outside.d.ts.map +1 -0
- package/click-outside/index.d.ts +2 -0
- package/click-outside/index.d.ts.map +1 -0
- package/click-outside/ngxsmk-cdk-click-outside.d.ts.map +1 -0
- package/esm2022/autofocus/autofocus.mjs +44 -0
- package/esm2022/autofocus/index.mjs +2 -0
- package/esm2022/autofocus/ngxsmk-cdk-autofocus.mjs +5 -0
- package/esm2022/click-outside/click-outside.mjs +38 -0
- package/esm2022/click-outside/index.mjs +2 -0
- package/esm2022/click-outside/ngxsmk-cdk-click-outside.mjs +5 -0
- package/esm2022/focus-trap/focus-trap.mjs +69 -0
- package/esm2022/focus-trap/index.mjs +2 -0
- package/esm2022/focus-trap/ngxsmk-cdk-focus-trap.mjs +5 -0
- package/esm2022/focusable/focusable.mjs +15 -0
- package/esm2022/focusable/index.mjs +2 -0
- package/esm2022/focusable/ngxsmk-cdk-focusable.mjs +5 -0
- package/esm2022/intersection-observer/index.mjs +2 -0
- package/esm2022/intersection-observer/intersection-observer.mjs +56 -0
- package/esm2022/intersection-observer/ngxsmk-cdk-intersection-observer.mjs +5 -0
- package/esm2022/live-announcer/index.mjs +2 -0
- package/esm2022/live-announcer/live-announcer.mjs +59 -0
- package/esm2022/live-announcer/ngxsmk-cdk-live-announcer.mjs +5 -0
- package/esm2022/media-query/index.mjs +2 -0
- package/esm2022/media-query/media-query.mjs +22 -0
- package/esm2022/media-query/ngxsmk-cdk-media-query.mjs +5 -0
- package/esm2022/ngxsmk-cdk.mjs +5 -0
- package/esm2022/public-api.mjs +15 -0
- package/esm2022/resize-observer/index.mjs +2 -0
- package/esm2022/resize-observer/ngxsmk-cdk-resize-observer.mjs +5 -0
- package/esm2022/resize-observer/resize-observer.mjs +59 -0
- package/esm2022/scroll-lock/index.mjs +2 -0
- package/esm2022/scroll-lock/ngxsmk-cdk-scroll-lock.mjs +5 -0
- package/esm2022/scroll-lock/scroll-lock.mjs +45 -0
- package/esm2022/testing/a11y.mjs +17 -0
- package/esm2022/testing/index.mjs +2 -0
- package/esm2022/testing/ngxsmk-cdk-testing.mjs +5 -0
- package/esm2022/visually-hidden/index.mjs +2 -0
- package/esm2022/visually-hidden/ngxsmk-cdk-visually-hidden.mjs +5 -0
- package/esm2022/visually-hidden/visually-hidden.mjs +34 -0
- package/fesm2022/ngxsmk-cdk-autofocus.mjs +51 -0
- package/fesm2022/ngxsmk-cdk-autofocus.mjs.map +1 -0
- package/fesm2022/ngxsmk-cdk-click-outside.mjs +6 -6
- package/fesm2022/ngxsmk-cdk-click-outside.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk-focus-trap.mjs +14 -10
- package/fesm2022/ngxsmk-cdk-focus-trap.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk-focusable.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk-intersection-observer.mjs +63 -0
- package/fesm2022/ngxsmk-cdk-intersection-observer.mjs.map +1 -0
- package/fesm2022/ngxsmk-cdk-live-announcer.mjs +8 -6
- package/fesm2022/ngxsmk-cdk-live-announcer.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk-media-query.mjs +1 -2
- package/fesm2022/ngxsmk-cdk-media-query.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk-resize-observer.mjs +66 -0
- package/fesm2022/ngxsmk-cdk-resize-observer.mjs.map +1 -0
- package/fesm2022/ngxsmk-cdk-scroll-lock.mjs +10 -10
- package/fesm2022/ngxsmk-cdk-scroll-lock.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk-testing.mjs +24 -0
- package/fesm2022/ngxsmk-cdk-testing.mjs.map +1 -0
- package/fesm2022/ngxsmk-cdk-visually-hidden.mjs +3 -3
- package/fesm2022/ngxsmk-cdk-visually-hidden.mjs.map +1 -1
- package/fesm2022/ngxsmk-cdk.mjs +11 -266
- package/fesm2022/ngxsmk-cdk.mjs.map +1 -1
- package/focus-trap/focus-trap.d.ts +19 -0
- package/focus-trap/focus-trap.d.ts.map +1 -0
- package/focus-trap/index.d.ts +2 -0
- package/focus-trap/index.d.ts.map +1 -0
- package/focus-trap/ngxsmk-cdk-focus-trap.d.ts.map +1 -0
- package/focusable/focusable.d.ts +5 -0
- package/focusable/focusable.d.ts.map +1 -0
- package/focusable/index.d.ts +2 -0
- package/focusable/index.d.ts.map +1 -0
- package/focusable/ngxsmk-cdk-focusable.d.ts.map +1 -0
- package/index.d.ts +6 -0
- package/intersection-observer/index.d.ts +2 -0
- package/intersection-observer/index.d.ts.map +1 -0
- package/intersection-observer/intersection-observer.d.ts +22 -0
- package/intersection-observer/intersection-observer.d.ts.map +1 -0
- package/intersection-observer/ngxsmk-cdk-intersection-observer.d.ts.map +1 -0
- package/live-announcer/index.d.ts +2 -0
- package/live-announcer/index.d.ts.map +1 -0
- package/{types/ngxsmk-cdk-live-announcer.d.ts → live-announcer/live-announcer.d.ts} +4 -7
- package/live-announcer/live-announcer.d.ts.map +1 -0
- package/live-announcer/ngxsmk-cdk-live-announcer.d.ts.map +1 -0
- package/media-query/index.d.ts +2 -0
- package/media-query/index.d.ts.map +1 -0
- package/{types/ngxsmk-cdk-media-query.d.ts → media-query/media-query.d.ts} +2 -4
- package/media-query/media-query.d.ts.map +1 -0
- package/media-query/ngxsmk-cdk-media-query.d.ts.map +1 -0
- package/ngxsmk-cdk.d.ts.map +1 -0
- package/package.json +51 -12
- package/public-api.d.ts +12 -0
- package/public-api.d.ts.map +1 -0
- package/resize-observer/index.d.ts +2 -0
- package/resize-observer/index.d.ts.map +1 -0
- package/resize-observer/ngxsmk-cdk-resize-observer.d.ts.map +1 -0
- package/resize-observer/resize-observer.d.ts +20 -0
- package/resize-observer/resize-observer.d.ts.map +1 -0
- package/scroll-lock/index.d.ts +2 -0
- package/scroll-lock/index.d.ts.map +1 -0
- package/scroll-lock/ngxsmk-cdk-scroll-lock.d.ts.map +1 -0
- package/{types/ngxsmk-cdk-scroll-lock.d.ts → scroll-lock/scroll-lock.d.ts} +3 -5
- package/scroll-lock/scroll-lock.d.ts.map +1 -0
- package/testing/a11y.d.ts +6 -0
- package/testing/a11y.d.ts.map +1 -0
- package/testing/index.d.ts +2 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/ngxsmk-cdk-testing.d.ts.map +1 -0
- package/visually-hidden/index.d.ts +2 -0
- package/visually-hidden/index.d.ts.map +1 -0
- package/visually-hidden/ngxsmk-cdk-visually-hidden.d.ts.map +1 -0
- package/{types/ngxsmk-cdk-visually-hidden.d.ts → visually-hidden/visually-hidden.d.ts} +3 -5
- package/visually-hidden/visually-hidden.d.ts.map +1 -0
- package/types/ngxsmk-cdk-focus-trap.d.ts +0 -21
- package/types/ngxsmk-cdk-focusable.d.ts +0 -6
- package/types/ngxsmk-cdk.d.ts +0 -96
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, DestroyRef, input, output, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Emits when the host element's dimensions change.
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <div [ngxsmkResizeObserver] (resized)="onResize($event)">…</div>
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
class NgxsmkResizeObserver {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.elementRef = inject(ElementRef);
|
|
14
|
+
this.destroyRef = inject(DestroyRef);
|
|
15
|
+
this.debounceMs = input(0);
|
|
16
|
+
this.resized = output();
|
|
17
|
+
this.observer = null;
|
|
18
|
+
this.timeoutId = null;
|
|
19
|
+
if (typeof window === 'undefined' || !('ResizeObserver' in window)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.observer = new ResizeObserver((entries) => {
|
|
23
|
+
const entry = entries[0];
|
|
24
|
+
if (!entry) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const debounce = this.debounceMs();
|
|
28
|
+
if (debounce > 0) {
|
|
29
|
+
if (this.timeoutId) {
|
|
30
|
+
clearTimeout(this.timeoutId);
|
|
31
|
+
}
|
|
32
|
+
this.timeoutId = setTimeout(() => {
|
|
33
|
+
this.resized.emit(entry);
|
|
34
|
+
}, debounce);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.resized.emit(entry);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
this.observer.observe(this.elementRef.nativeElement);
|
|
41
|
+
this.destroyRef.onDestroy(() => {
|
|
42
|
+
if (this.timeoutId) {
|
|
43
|
+
clearTimeout(this.timeoutId);
|
|
44
|
+
}
|
|
45
|
+
if (this.observer) {
|
|
46
|
+
this.observer.disconnect();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkResizeObserver, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
51
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.0", type: NgxsmkResizeObserver, isStandalone: true, selector: "[ngxsmkResizeObserver]", inputs: { debounceMs: { classPropertyName: "debounceMs", publicName: "debounceMs", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { resized: "resized" }, ngImport: i0 }); }
|
|
52
|
+
}
|
|
53
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkResizeObserver, decorators: [{
|
|
54
|
+
type: Directive,
|
|
55
|
+
args: [{
|
|
56
|
+
standalone: true,
|
|
57
|
+
selector: '[ngxsmkResizeObserver]',
|
|
58
|
+
}]
|
|
59
|
+
}], ctorParameters: () => [] });
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Generated bundle index. Do not edit.
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
export { NgxsmkResizeObserver };
|
|
66
|
+
//# sourceMappingURL=ngxsmk-cdk-resize-observer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngxsmk-cdk-resize-observer.mjs","sources":["../../../../packages/cdk/resize-observer/resize-observer.ts","../../../../packages/cdk/resize-observer/ngxsmk-cdk-resize-observer.ts"],"sourcesContent":["import { DestroyRef, Directive, ElementRef, inject, input, output } from '@angular/core';\n\n/**\n * Emits when the host element's dimensions change.\n *\n * ```html\n * <div [ngxsmkResizeObserver] (resized)=\"onResize($event)\">…</div>\n * ```\n */\n@Directive({\n standalone: true,\n selector: '[ngxsmkResizeObserver]',\n})\nexport class NgxsmkResizeObserver {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n\n readonly debounceMs = input<number>(0);\n readonly resized = output<ResizeObserverEntry>();\n\n private observer: ResizeObserver | null = null;\n private timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (typeof window === 'undefined' || !('ResizeObserver' in window)) {\n return;\n }\n\n this.observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (!entry) {\n return;\n }\n\n const debounce = this.debounceMs();\n if (debounce > 0) {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n this.timeoutId = setTimeout(() => {\n this.resized.emit(entry);\n }, debounce);\n } else {\n this.resized.emit(entry);\n }\n });\n\n this.observer.observe(this.elementRef.nativeElement);\n\n this.destroyRef.onDestroy(() => {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n if (this.observer) {\n this.observer.disconnect();\n }\n });\n }\n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,QAAA,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,MAAK;AAC7B,YAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AAClB,gBAAA,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;YAC9B;AACA,YAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,gBAAA,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAC5B;AACF,QAAA,CAAC,CAAC;IACJ;8GA5CW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,QAAQ,EAAE,wBAAwB;AACnC,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -8,19 +8,19 @@ import { DOCUMENT } from '@angular/common';
|
|
|
8
8
|
* prevent layout shift.
|
|
9
9
|
*/
|
|
10
10
|
class NgxsmkScrollLock {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
constructor() {
|
|
12
|
+
this.document = inject(DOCUMENT);
|
|
13
|
+
this.locks = 0;
|
|
14
|
+
this.previousOverflow = '';
|
|
15
|
+
this.previousPaddingRight = '';
|
|
16
|
+
}
|
|
15
17
|
lock() {
|
|
16
18
|
if (this.locks++ > 0) {
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
const body = this.document.body;
|
|
20
22
|
const window = this.document.defaultView;
|
|
21
|
-
const scrollbar = window
|
|
22
|
-
? window.innerWidth - this.document.documentElement.clientWidth
|
|
23
|
-
: 0;
|
|
23
|
+
const scrollbar = window ? window.innerWidth - this.document.documentElement.clientWidth : 0;
|
|
24
24
|
this.previousOverflow = body.style.overflow;
|
|
25
25
|
this.previousPaddingRight = body.style.paddingRight;
|
|
26
26
|
body.style.overflow = 'hidden';
|
|
@@ -36,10 +36,10 @@ class NgxsmkScrollLock {
|
|
|
36
36
|
body.style.overflow = this.previousOverflow;
|
|
37
37
|
body.style.paddingRight = this.previousPaddingRight;
|
|
38
38
|
}
|
|
39
|
-
static
|
|
40
|
-
static
|
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkScrollLock, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
40
|
+
static { this.ɵ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: "
|
|
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
|
}] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxsmk-cdk-scroll-lock.mjs","sources":["../../../../packages/cdk/scroll-lock/scroll-lock.ts","../../../../packages/cdk/scroll-lock/ngxsmk-cdk-scroll-lock.ts"],"sourcesContent":["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
|
|
1
|
+
{"version":3,"file":"ngxsmk-cdk-scroll-lock.mjs","sources":["../../../../packages/cdk/scroll-lock/scroll-lock.ts","../../../../packages/cdk/scroll-lock/ngxsmk-cdk-scroll-lock.ts"],"sourcesContent":["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 ? window.innerWidth - this.document.documentElement.clientWidth : 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","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;;;;AAIG;MAEU,gBAAgB,CAAA;AAD7B,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QACpC,IAAA,CAAA,KAAK,GA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AA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA,CAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACRlC;;AAEG;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as axe from 'axe-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runs axe-core analysis on the provided HTML element and throws an error if any accessibility
|
|
5
|
+
* violations are detected.
|
|
6
|
+
*/
|
|
7
|
+
async function expectNoA11yViolations(element) {
|
|
8
|
+
const results = await axe.run(element);
|
|
9
|
+
if (results.violations.length > 0) {
|
|
10
|
+
const formatted = results.violations
|
|
11
|
+
.map((v) => `[${v.id}] ${v.help}\n - Help URL: ${v.helpUrl}\n - Nodes affected:\n${v.nodes
|
|
12
|
+
.map((n) => ` * ${n.html}`)
|
|
13
|
+
.join('\n')}`)
|
|
14
|
+
.join('\n\n');
|
|
15
|
+
throw new Error(`Accessibility violations detected:\n\n${formatted}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generated bundle index. Do not edit.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export { expectNoA11yViolations };
|
|
24
|
+
//# sourceMappingURL=ngxsmk-cdk-testing.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngxsmk-cdk-testing.mjs","sources":["../../../../packages/cdk/testing/a11y.ts","../../../../packages/cdk/testing/ngxsmk-cdk-testing.ts"],"sourcesContent":["import * as axe from 'axe-core';\n\n/**\n * Runs axe-core analysis on the provided HTML element and throws an error if any accessibility\n * violations are detected.\n */\nexport async function expectNoA11yViolations(element: HTMLElement): Promise<void> {\n const results = await axe.run(element);\n if (results.violations.length > 0) {\n const formatted = results.violations\n .map(\n (v) =>\n `[${v.id}] ${v.help}\\n - Help URL: ${v.helpUrl}\\n - Nodes affected:\\n${v.nodes\n .map((n) => ` * ${n.html}`)\n .join('\\n')}`,\n )\n .join('\\n\\n');\n throw new Error(`Accessibility violations detected:\\n\\n${formatted}`);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAEA;;;AAGG;AACI,eAAe,sBAAsB,CAAC,OAAoB,EAAA;IAC/D,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;IACtC,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACjC,QAAA,MAAM,SAAS,GAAG,OAAO,CAAC;aACvB,GAAG,CACF,CAAC,CAAC,KACA,CAAA,CAAA,EAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAA,gBAAA,EAAmB,CAAC,CAAC,OAAO,CAAA,uBAAA,EAA0B,CAAC,CAAC;aACxE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAA,MAAA,EAAS,CAAC,CAAC,IAAI,CAAA,CAAE;AAC5B,aAAA,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE;aAElB,IAAI,CAAC,MAAM,CAAC;AACf,QAAA,MAAM,IAAI,KAAK,CAAC,yCAAyC,SAAS,CAAA,CAAE,CAAC;IACvE;AACF;;ACnBA;;AAEG;;;;"}
|
|
@@ -9,10 +9,10 @@ import { Directive } from '@angular/core';
|
|
|
9
9
|
* ```
|
|
10
10
|
*/
|
|
11
11
|
class NgxsmkVisuallyHidden {
|
|
12
|
-
static
|
|
13
|
-
static
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.0", ngImport: i0, type: NgxsmkVisuallyHidden, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
13
|
+
static { this.ɵ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: "
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngxsmk-cdk-visually-hidden.mjs","sources":["../../../../packages/cdk/visually-hidden/visually-hidden.ts","../../../../packages/cdk/visually-hidden/ngxsmk-cdk-visually-hidden.ts"],"sourcesContent":["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 * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;AAMG;MAkBU,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"ngxsmk-cdk-visually-hidden.mjs","sources":["../../../../packages/cdk/visually-hidden/visually-hidden.ts","../../../../packages/cdk/visually-hidden/ngxsmk-cdk-visually-hidden.ts"],"sourcesContent":["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 * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;AAMG;MAkBU,oBAAoB,CAAA;8GAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,wNAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAjBhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;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;;;;"}
|
package/fesm2022/ngxsmk-cdk.mjs
CHANGED
|
@@ -1,267 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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';
|
|
8
|
+
export * from '@ngxsmk/cdk/intersection-observer';
|
|
9
|
+
export * from '@ngxsmk/cdk/resize-observer';
|
|
10
|
+
export * from '@ngxsmk/cdk/autofocus';
|
|
11
|
+
export * from '@ngxsmk/cdk/testing';
|
|
265
12
|
|
|
266
13
|
/*
|
|
267
14
|
* Public API Surface of @ngxsmk/cdk
|
|
@@ -270,6 +17,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
270
17
|
/**
|
|
271
18
|
* Generated bundle index. Do not edit.
|
|
272
19
|
*/
|
|
273
|
-
|
|
274
|
-
export { FOCUSABLE_SELECTOR, NgxsmkClickOutside, NgxsmkFocusTrap, NgxsmkLiveAnnouncer, NgxsmkScrollLock, NgxsmkVisuallyHidden, getFocusable, injectMediaQuery };
|
|
275
20
|
//# 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,CAA0B,UAAU,CAAC;IAE1D,kBAAkB,GAAG,MAAM,EAAS;AAE7C,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AACjC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAErC,QAAA,MAAM,aAAa,GAAG,CAAC,KAAY,KAAI;AACrC,YAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAqB;AAC1C,YAAA,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACvD,gBAAA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,K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AC,YAAY,GAAG,IAAI,CAAC,oBAAoB;IACrD;uGA/BW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cADH,MAAM,EAAA,CAAA;;2FACnB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAD5B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACNlC;;;;;;AAMG;MAkBU,oBAAoB,CAAA;uGAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,wNAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAjBhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;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';\nexport * from '@ngxsmk/cdk/intersection-observer';\nexport * from '@ngxsmk/cdk/resize-observer';\nexport * from '@ngxsmk/cdk/autofocus';\nexport * from '@ngxsmk/cdk/testing';\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 @@
|
|
|
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,CAIlE"}
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/intersection-observer/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* Monitors the visibility of an element relative to the viewport or a parent container.
|
|
4
|
+
*
|
|
5
|
+
* ```html
|
|
6
|
+
* <div [ngxsmkIntersectionObserver] (intersecting)="onIntersect($event)">…</div>
|
|
7
|
+
* ```
|
|
8
|
+
*/
|
|
9
|
+
export declare class NgxsmkIntersectionObserver {
|
|
10
|
+
private readonly elementRef;
|
|
11
|
+
private readonly destroyRef;
|
|
12
|
+
readonly rootMargin: import("@angular/core").InputSignal<string>;
|
|
13
|
+
readonly threshold: import("@angular/core").InputSignal<number | number[]>;
|
|
14
|
+
readonly intersecting: import("@angular/core").OutputEmitterRef<boolean>;
|
|
15
|
+
readonly intersection: import("@angular/core").OutputEmitterRef<IntersectionObserverEntry>;
|
|
16
|
+
private observer;
|
|
17
|
+
constructor();
|
|
18
|
+
private cleanup;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxsmkIntersectionObserver, never>;
|
|
20
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxsmkIntersectionObserver, "[ngxsmkIntersectionObserver]", never, { "rootMargin": { "alias": "rootMargin"; "required": false; "isSignal": true; }; "threshold": { "alias": "threshold"; "required": false; "isSignal": true; }; }, { "intersecting": "intersecting"; "intersection": "intersection"; }, never, never, true, never>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=intersection-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intersection-observer.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/intersection-observer/intersection-observer.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH,qBAIa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+C;IAC1E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsB;IAEjD,QAAQ,CAAC,UAAU,8CAAwB;IAC3C,QAAQ,CAAC,SAAS,yDAA+B;IAEjD,QAAQ,CAAC,YAAY,oDAAqB;IAC1C,QAAQ,CAAC,YAAY,sEAAuC;IAE5D,OAAO,CAAC,QAAQ,CAAqC;;IA8BrD,OAAO,CAAC,OAAO;yCAxCJ,0BAA0B;2CAA1B,0BAA0B;CA8CtC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngxsmk-cdk-intersection-observer.d.ts","sourceRoot":"","sources":["../../../../packages/cdk/intersection-observer/ngxsmk-cdk-intersection-observer.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,SAAS,CAAC"}
|