@tociva/tailng-cdk 0.11.0 → 0.12.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/fesm2022/tociva-tailng-cdk-a11y.mjs +79 -16
- package/fesm2022/tociva-tailng-cdk-a11y.mjs.map +1 -1
- package/fesm2022/tociva-tailng-cdk-keyboard.mjs +48 -16
- package/fesm2022/tociva-tailng-cdk-keyboard.mjs.map +1 -1
- package/fesm2022/tociva-tailng-cdk-scroll.mjs +21 -16
- package/fesm2022/tociva-tailng-cdk-scroll.mjs.map +1 -1
- package/fesm2022/tociva-tailng-cdk-util.mjs +3 -17
- package/fesm2022/tociva-tailng-cdk-util.mjs.map +1 -1
- package/fesm2022/tociva-tailng-cdk.mjs +15 -17
- package/fesm2022/tociva-tailng-cdk.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, inject, ElementRef, Injector, effect, runInInjectionContext, afterNextRender, Directive } from '@angular/core';
|
|
3
|
+
import { FocusTrapFactory } from '@angular/cdk/a11y';
|
|
4
|
+
|
|
5
|
+
const createTngFocusTrap = (factory, element, options = {}) => {
|
|
6
|
+
const previousActive = options.restoreFocus === false
|
|
7
|
+
? null
|
|
8
|
+
: document.activeElement;
|
|
9
|
+
// CDK 21: create(element, deferCaptureElements?: boolean)
|
|
10
|
+
const trap = factory.create(element, !!options.deferCaptureElements);
|
|
11
|
+
const activate = () => {
|
|
12
|
+
if (options.autoCapture !== false) {
|
|
13
|
+
trap.focusInitialElementWhenReady();
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const destroy = () => {
|
|
17
|
+
trap.destroy();
|
|
18
|
+
if (previousActive && typeof previousActive.focus === 'function') {
|
|
19
|
+
previousActive.focus();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return { trap, activate, destroy };
|
|
15
23
|
};
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
|
|
25
|
+
class TngFocusTrap {
|
|
26
|
+
/** Enable / disable focus trapping */
|
|
27
|
+
tngFocusTrap = input(true, ...(ngDevMode ? [{ debugName: "tngFocusTrap" }] : []));
|
|
28
|
+
/** CDK 21: FocusTrapFactory.create(element, deferCaptureElements?: boolean) */
|
|
29
|
+
deferCaptureElements = input(false, ...(ngDevMode ? [{ debugName: "deferCaptureElements" }] : []));
|
|
30
|
+
/** tailng behavior */
|
|
31
|
+
autoCapture = input(true, ...(ngDevMode ? [{ debugName: "autoCapture" }] : []));
|
|
32
|
+
/** tailng behavior */
|
|
33
|
+
restoreFocus = input(true, ...(ngDevMode ? [{ debugName: "restoreFocus" }] : []));
|
|
34
|
+
host = inject((ElementRef));
|
|
35
|
+
injector = inject(Injector);
|
|
36
|
+
// Inject CDK factory in injection context (field initializer)
|
|
37
|
+
focusTrapFactory = inject(FocusTrapFactory);
|
|
38
|
+
handle = null;
|
|
39
|
+
constructor() {
|
|
40
|
+
effect(() => {
|
|
41
|
+
const enabled = this.tngFocusTrap();
|
|
42
|
+
if (!enabled) {
|
|
43
|
+
this.disable();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
// afterNextRender needs injection context
|
|
47
|
+
runInInjectionContext(this.injector, () => {
|
|
48
|
+
afterNextRender(() => this.enable());
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
enable() {
|
|
53
|
+
if (this.handle)
|
|
54
|
+
return;
|
|
55
|
+
this.handle = createTngFocusTrap(this.focusTrapFactory, this.host.nativeElement, {
|
|
56
|
+
deferCaptureElements: this.deferCaptureElements(),
|
|
57
|
+
autoCapture: this.autoCapture(),
|
|
58
|
+
restoreFocus: this.restoreFocus(),
|
|
59
|
+
});
|
|
60
|
+
this.handle.activate();
|
|
61
|
+
}
|
|
62
|
+
disable() {
|
|
63
|
+
this.handle?.destroy();
|
|
64
|
+
this.handle = null;
|
|
65
|
+
}
|
|
66
|
+
ngOnDestroy() {
|
|
67
|
+
this.disable();
|
|
68
|
+
}
|
|
69
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TngFocusTrap, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
70
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.6", type: TngFocusTrap, isStandalone: true, selector: "[tngFocusTrap]", inputs: { tngFocusTrap: { classPropertyName: "tngFocusTrap", publicName: "tngFocusTrap", isSignal: true, isRequired: false, transformFunction: null }, deferCaptureElements: { classPropertyName: "deferCaptureElements", publicName: "deferCaptureElements", isSignal: true, isRequired: false, transformFunction: null }, autoCapture: { classPropertyName: "autoCapture", publicName: "autoCapture", isSignal: true, isRequired: false, transformFunction: null }, restoreFocus: { classPropertyName: "restoreFocus", publicName: "restoreFocus", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
71
|
+
}
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TngFocusTrap, decorators: [{
|
|
73
|
+
type: Directive,
|
|
74
|
+
args: [{
|
|
75
|
+
selector: '[tngFocusTrap]',
|
|
76
|
+
standalone: true,
|
|
77
|
+
}]
|
|
78
|
+
}], ctorParameters: () => [], propDecorators: { tngFocusTrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "tngFocusTrap", required: false }] }], deferCaptureElements: [{ type: i0.Input, args: [{ isSignal: true, alias: "deferCaptureElements", required: false }] }], autoCapture: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoCapture", required: false }] }], restoreFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "restoreFocus", required: false }] }] } });
|
|
18
79
|
|
|
19
80
|
/**
|
|
20
81
|
* Generated bundle index. Do not edit.
|
|
21
82
|
*/
|
|
83
|
+
|
|
84
|
+
export { TngFocusTrap, createTngFocusTrap };
|
|
22
85
|
//# sourceMappingURL=tociva-tailng-cdk-a11y.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tociva-tailng-cdk-a11y.mjs","sources":["../../../../libs/cdk/a11y/src/
|
|
1
|
+
{"version":3,"file":"tociva-tailng-cdk-a11y.mjs","sources":["../../../../libs/cdk/a11y/src/lib/focus-trap/focus-trap.util.ts","../../../../libs/cdk/a11y/src/lib/focus-trap/focus-trap.directive.ts","../../../../libs/cdk/a11y/src/tociva-tailng-cdk-a11y.ts"],"sourcesContent":["import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\n\nexport type TngFocusTrapOptions = {\n /** CDK 21 signature uses this boolean */\n deferCaptureElements?: boolean;\n\n /** tailng behavior */\n autoCapture?: boolean;\n\n /** tailng behavior */\n restoreFocus?: boolean;\n};\n\nexport type TngFocusTrapHandle = {\n trap: FocusTrap;\n activate: () => void;\n destroy: () => void;\n};\n\nexport const createTngFocusTrap = (\n factory: FocusTrapFactory,\n element: HTMLElement,\n options: TngFocusTrapOptions = {},\n): TngFocusTrapHandle => {\n const previousActive =\n options.restoreFocus === false\n ? null\n : (document.activeElement as HTMLElement | null);\n\n // CDK 21: create(element, deferCaptureElements?: boolean)\n const trap = factory.create(element, !!options.deferCaptureElements);\n\n const activate = () => {\n if (options.autoCapture !== false) {\n trap.focusInitialElementWhenReady();\n }\n };\n\n const destroy = () => {\n trap.destroy();\n if (previousActive && typeof previousActive.focus === 'function') {\n previousActive.focus();\n }\n };\n\n return { trap, activate, destroy };\n};\n","import {\n Directive,\n ElementRef,\n Injector,\n OnDestroy,\n afterNextRender,\n effect,\n inject,\n input,\n runInInjectionContext,\n} from '@angular/core';\nimport { FocusTrapFactory } from '@angular/cdk/a11y';\nimport {\n createTngFocusTrap,\n TngFocusTrapHandle,\n} from './focus-trap.util';\n\n@Directive({\n selector: '[tngFocusTrap]',\n standalone: true,\n})\nexport class TngFocusTrap implements OnDestroy {\n /** Enable / disable focus trapping */\n readonly tngFocusTrap = input(true);\n\n /** CDK 21: FocusTrapFactory.create(element, deferCaptureElements?: boolean) */\n readonly deferCaptureElements = input(false);\n\n /** tailng behavior */\n readonly autoCapture = input(true);\n\n /** tailng behavior */\n readonly restoreFocus = input(true);\n\n private readonly host = inject(ElementRef<HTMLElement>);\n private readonly injector = inject(Injector);\n\n // Inject CDK factory in injection context (field initializer)\n private readonly focusTrapFactory = inject(FocusTrapFactory);\n\n private handle: TngFocusTrapHandle | null = null;\n\n constructor() {\n effect(() => {\n const enabled = this.tngFocusTrap();\n\n if (!enabled) {\n this.disable();\n return;\n }\n\n // afterNextRender needs injection context\n runInInjectionContext(this.injector, () => {\n afterNextRender(() => this.enable());\n });\n });\n }\n\n private enable(): void {\n if (this.handle) return;\n\n this.handle = createTngFocusTrap(\n this.focusTrapFactory,\n this.host.nativeElement,\n {\n deferCaptureElements: this.deferCaptureElements(),\n autoCapture: this.autoCapture(),\n restoreFocus: this.restoreFocus(),\n },\n );\n\n this.handle.activate();\n }\n\n private disable(): void {\n this.handle?.destroy();\n this.handle = null;\n }\n\n ngOnDestroy(): void {\n this.disable();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAmBO,MAAM,kBAAkB,GAAG,CAChC,OAAyB,EACzB,OAAoB,EACpB,OAAA,GAA+B,EAAE,KACX;AACtB,IAAA,MAAM,cAAc,GAClB,OAAO,CAAC,YAAY,KAAK;AACvB,UAAE;AACF,UAAG,QAAQ,CAAC,aAAoC;;AAGpD,IAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;IAEpE,MAAM,QAAQ,GAAG,MAAK;AACpB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A,CAAA;;2FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACpBD;;AAEG;;;;"}
|
|
@@ -1,22 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
1
|
+
function handleListKeyboardEvent(event, state) {
|
|
2
|
+
const { activeIndex, itemCount, loop = false } = state;
|
|
3
|
+
if (itemCount <= 0) {
|
|
4
|
+
return { type: 'noop' };
|
|
7
5
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
switch (event.key) {
|
|
7
|
+
case 'ArrowDown': {
|
|
8
|
+
event.preventDefault();
|
|
9
|
+
const next = activeIndex < itemCount - 1
|
|
10
|
+
? activeIndex + 1
|
|
11
|
+
: loop
|
|
12
|
+
? 0
|
|
13
|
+
: activeIndex;
|
|
14
|
+
return { type: 'move', index: next };
|
|
15
|
+
}
|
|
16
|
+
case 'ArrowUp': {
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
const prev = activeIndex > 0
|
|
19
|
+
? activeIndex - 1
|
|
20
|
+
: loop
|
|
21
|
+
? itemCount - 1
|
|
22
|
+
: activeIndex;
|
|
23
|
+
return { type: 'move', index: prev };
|
|
24
|
+
}
|
|
25
|
+
case 'Home': {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
return { type: 'move', index: 0 };
|
|
28
|
+
}
|
|
29
|
+
case 'End': {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
return { type: 'move', index: itemCount - 1 };
|
|
32
|
+
}
|
|
33
|
+
case 'Enter': {
|
|
34
|
+
if (activeIndex >= 0 && activeIndex < itemCount) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
return { type: 'select', index: activeIndex };
|
|
37
|
+
}
|
|
38
|
+
return { type: 'noop' };
|
|
39
|
+
}
|
|
40
|
+
case 'Escape': {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return { type: 'close' };
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
return { type: 'noop' };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
18
48
|
|
|
19
49
|
/**
|
|
20
50
|
* Generated bundle index. Do not edit.
|
|
21
51
|
*/
|
|
52
|
+
|
|
53
|
+
export { handleListKeyboardEvent };
|
|
22
54
|
//# sourceMappingURL=tociva-tailng-cdk-keyboard.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tociva-tailng-cdk-keyboard.mjs","sources":["../../../../libs/cdk/keyboard/src/
|
|
1
|
+
{"version":3,"file":"tociva-tailng-cdk-keyboard.mjs","sources":["../../../../libs/cdk/keyboard/src/lib/keyboard-navigation.ts","../../../../libs/cdk/keyboard/src/tociva-tailng-cdk-keyboard.ts"],"sourcesContent":["\nexport type KeyboardAction =\n | { type: 'move'; index: number }\n | { type: 'select'; index: number }\n | { type: 'close' }\n | { type: 'noop' };\n\nexport interface KeyboardNavigationState {\n activeIndex: number;\n itemCount: number;\n loop?: boolean; // optional: wrap around\n}\n\nexport function handleListKeyboardEvent(\n event: KeyboardEvent,\n state: KeyboardNavigationState\n): KeyboardAction {\n const { activeIndex, itemCount, loop = false } = state;\n\n if (itemCount <= 0) {\n return { type: 'noop' };\n }\n\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault();\n\n const next =\n activeIndex < itemCount - 1\n ? activeIndex + 1\n : loop\n ? 0\n : activeIndex;\n\n return { type: 'move', index: next };\n }\n\n case 'ArrowUp': {\n event.preventDefault();\n\n const prev =\n activeIndex > 0\n ? activeIndex - 1\n : loop\n ? itemCount - 1\n : activeIndex;\n\n return { type: 'move', index: prev };\n }\n\n case 'Home': {\n event.preventDefault();\n return { type: 'move', index: 0 };\n }\n\n case 'End': {\n event.preventDefault();\n return { type: 'move', index: itemCount - 1 };\n }\n\n case 'Enter': {\n if (activeIndex >= 0 && activeIndex < itemCount) {\n event.preventDefault();\n return { type: 'select', index: activeIndex };\n }\n return { type: 'noop' };\n }\n\n case 'Escape': {\n event.preventDefault();\n return { type: 'close' };\n }\n\n default:\n return { type: 'noop' };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAaM,SAAU,uBAAuB,CACrC,KAAoB,EACpB,KAA8B,EAAA;IAE9B,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,KAAK;AAEtD,IAAA,IAAI,SAAS,IAAI,CAAC,EAAE;AAClB,QAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;IACzB;AAEA,IAAA,QAAQ,KAAK,CAAC,GAAG;QACf,KAAK,WAAW,EAAE;YAChB,KAAK,CAAC,cAAc,EAAE;AAEtB,YAAA,MAAM,IAAI,GACR,WAAW,GAAG,SAAS,GAAG;kBACtB,WAAW,GAAG;AAChB,kBAAE;AACA,sBAAE;sBACA,WAAW;YAEnB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QACtC;QAEA,KAAK,SAAS,EAAE;YACd,KAAK,CAAC,cAAc,EAAE;AAEtB,YAAA,MAAM,IAAI,GACR,WAAW,GAAG;kBACV,WAAW,GAAG;AAChB,kBAAE;sBACE,SAAS,GAAG;sBACZ,WAAW;YAEnB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;QACtC;QAEA,KAAK,MAAM,EAAE;YACX,KAAK,CAAC,cAAc,EAAE;YACtB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE;QACnC;QAEA,KAAK,KAAK,EAAE;YACV,KAAK,CAAC,cAAc,EAAE;YACtB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,CAAC,EAAE;QAC/C;QAEA,KAAK,OAAO,EAAE;YACZ,IAAI,WAAW,IAAI,CAAC,IAAI,WAAW,GAAG,SAAS,EAAE;gBAC/C,KAAK,CAAC,cAAc,EAAE;gBACtB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE;YAC/C;AACA,YAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;QACzB;QAEA,KAAK,QAAQ,EAAE;YACb,KAAK,CAAC,cAAc,EAAE;AACtB,YAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;QAC1B;AAEA,QAAA;AACE,YAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;;AAE7B;;AC5EA;;AAEG;;;;"}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function scrollActiveIntoView({ container, activeIndex, itemSelector = '[data-index]', behavior = 'auto', }) {
|
|
2
|
+
if (!container)
|
|
3
|
+
return;
|
|
4
|
+
if (activeIndex < 0)
|
|
5
|
+
return;
|
|
6
|
+
const item = container.querySelector(`${itemSelector}="${activeIndex}"`);
|
|
7
|
+
if (!item)
|
|
8
|
+
return;
|
|
9
|
+
const containerRect = container.getBoundingClientRect();
|
|
10
|
+
const itemRect = item.getBoundingClientRect();
|
|
11
|
+
// Already fully visible
|
|
12
|
+
if (itemRect.top >= containerRect.top &&
|
|
13
|
+
itemRect.bottom <= containerRect.bottom) {
|
|
14
|
+
return;
|
|
7
15
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports$1) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./lib"), exports);
|
|
16
|
+
item.scrollIntoView({
|
|
17
|
+
block: 'nearest',
|
|
18
|
+
behavior,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Generated bundle index. Do not edit.
|
|
21
24
|
*/
|
|
25
|
+
|
|
26
|
+
export { scrollActiveIntoView };
|
|
22
27
|
//# sourceMappingURL=tociva-tailng-cdk-scroll.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tociva-tailng-cdk-scroll.mjs","sources":["../../../../libs/cdk/scroll/src/
|
|
1
|
+
{"version":3,"file":"tociva-tailng-cdk-scroll.mjs","sources":["../../../../libs/cdk/scroll/src/lib/scroll-active-into-view.ts","../../../../libs/cdk/scroll/src/tociva-tailng-cdk-scroll.ts"],"sourcesContent":["export interface ScrollActiveIntoViewOptions {\n container: HTMLElement | null | undefined;\n activeIndex: number;\n itemSelector?: string; // default: [data-index]\n behavior?: ScrollBehavior; // default: 'auto'\n}\n\nexport function scrollActiveIntoView({\n container,\n activeIndex,\n itemSelector = '[data-index]',\n behavior = 'auto',\n}: ScrollActiveIntoViewOptions): void {\n if (!container) return;\n if (activeIndex < 0) return;\n\n const item = container.querySelector<HTMLElement>(\n `${itemSelector}=\"${activeIndex}\"`\n );\n\n if (!item) return;\n\n const containerRect = container.getBoundingClientRect();\n const itemRect = item.getBoundingClientRect();\n\n // Already fully visible\n if (\n itemRect.top >= containerRect.top &&\n itemRect.bottom <= containerRect.bottom\n ) {\n return;\n }\n\n item.scrollIntoView({\n block: 'nearest',\n behavior,\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAOM,SAAU,oBAAoB,CAAC,EACnC,SAAS,EACT,WAAW,EACX,YAAY,GAAG,cAAc,EAC7B,QAAQ,GAAG,MAAM,GACW,EAAA;AAC5B,IAAA,IAAI,CAAC,SAAS;QAAE;IAChB,IAAI,WAAW,GAAG,CAAC;QAAE;AAErB,IAAA,MAAM,IAAI,GAAG,SAAS,CAAC,aAAa,CAClC,CAAA,EAAG,YAAY,CAAA,EAAA,EAAK,WAAW,CAAA,CAAA,CAAG,CACnC;AAED,IAAA,IAAI,CAAC,IAAI;QAAE;AAEX,IAAA,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,EAAE;AACvD,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE;;AAG7C,IAAA,IACE,QAAQ,CAAC,GAAG,IAAI,aAAa,CAAC,GAAG;AACjC,QAAA,QAAQ,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,EACvC;QACA;IACF;IAEA,IAAI,CAAC,cAAc,CAAC;AAClB,QAAA,KAAK,EAAE,SAAS;QAChB,QAAQ;AACT,KAAA,CAAC;AACJ;;ACrCA;;AAEG;;;;"}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports$1) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./lib"), exports);
|
|
1
|
+
const coerceBoolean = (value) => value != null && `${value}` !== 'false';
|
|
18
2
|
|
|
19
3
|
/**
|
|
20
4
|
* Generated bundle index. Do not edit.
|
|
21
5
|
*/
|
|
6
|
+
|
|
7
|
+
export { coerceBoolean };
|
|
22
8
|
//# sourceMappingURL=tociva-tailng-cdk-util.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tociva-tailng-cdk-util.mjs","sources":["../../../../libs/cdk/util/src/
|
|
1
|
+
{"version":3,"file":"tociva-tailng-cdk-util.mjs","sources":["../../../../libs/cdk/util/src/lib/coerce.ts","../../../../libs/cdk/util/src/tociva-tailng-cdk-util.ts"],"sourcesContent":["export const coerceBoolean = (value: unknown): boolean => value != null && `${value}` !== 'false';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,GAAG,CAAC,KAAc,KAAc,KAAK,IAAI,IAAI,IAAI,CAAA,EAAG,KAAK,CAAA,CAAE,KAAK;;ACA1F;;AAEG;;;;"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./info/info.component"), exports);
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class TngInfo {
|
|
5
|
+
docsUrl = 'https://tailng.dev';
|
|
6
|
+
githubUrl = 'https://github.com/tociva/tailng';
|
|
7
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TngInfo, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: TngInfo, isStandalone: true, selector: "tng-info", ngImport: i0, template: "<div class=\"rounded border p-4 text-sm\">\n <h3 class=\"font-semibold\">tailng UI</h3>\n\n <p class=\"mt-2\">\n A modern Angular UI library powered by Tailwind CSS.\n </p>\n\n <ul class=\"mt-3 space-y-1\">\n <li>\n Docs:\n <a [href]=\"docsUrl\" target=\"_blank\" class=\"underline\">\n {{ docsUrl }}\n </a>\n </li>\n <li>\n GitHub:\n <a [href]=\"githubUrl\" target=\"_blank\" class=\"underline\">\n {{ githubUrl }}\n </a>\n </li>\n </ul>\n</div>" });
|
|
9
|
+
}
|
|
10
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TngInfo, decorators: [{
|
|
11
|
+
type: Component,
|
|
12
|
+
args: [{ standalone: true, selector: 'tng-info', template: "<div class=\"rounded border p-4 text-sm\">\n <h3 class=\"font-semibold\">tailng UI</h3>\n\n <p class=\"mt-2\">\n A modern Angular UI library powered by Tailwind CSS.\n </p>\n\n <ul class=\"mt-3 space-y-1\">\n <li>\n Docs:\n <a [href]=\"docsUrl\" target=\"_blank\" class=\"underline\">\n {{ docsUrl }}\n </a>\n </li>\n <li>\n GitHub:\n <a [href]=\"githubUrl\" target=\"_blank\" class=\"underline\">\n {{ githubUrl }}\n </a>\n </li>\n </ul>\n</div>" }]
|
|
13
|
+
}] });
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
16
|
* Generated bundle index. Do not edit.
|
|
21
17
|
*/
|
|
18
|
+
|
|
19
|
+
export { TngInfo };
|
|
22
20
|
//# sourceMappingURL=tociva-tailng-cdk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tociva-tailng-cdk.mjs","sources":["../../../../libs/cdk/src/
|
|
1
|
+
{"version":3,"file":"tociva-tailng-cdk.mjs","sources":["../../../../libs/cdk/src/info/info.component.ts","../../../../libs/cdk/src/info/info.component.html","../../../../libs/cdk/src/tociva-tailng-cdk.ts"],"sourcesContent":["import { Component } from '@angular/core';\n\n@Component({\n standalone: true,\n selector: 'tng-info',\n templateUrl: './info.component.html',\n})\nexport class TngInfo {\n readonly docsUrl = 'https://tailng.dev';\n readonly githubUrl = 'https://github.com/tociva/tailng';\n}","<div class=\"rounded border p-4 text-sm\">\n <h3 class=\"font-semibold\">tailng UI</h3>\n\n <p class=\"mt-2\">\n A modern Angular UI library powered by Tailwind CSS.\n </p>\n\n <ul class=\"mt-3 space-y-1\">\n <li>\n Docs:\n <a [href]=\"docsUrl\" target=\"_blank\" class=\"underline\">\n {{ docsUrl }}\n </a>\n </li>\n <li>\n GitHub:\n <a [href]=\"githubUrl\" target=\"_blank\" class=\"underline\">\n {{ githubUrl }}\n </a>\n </li>\n </ul>\n</div>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;MAOa,OAAO,CAAA;IACT,OAAO,GAAG,oBAAoB;IAC9B,SAAS,GAAG,kCAAkC;uGAF5C,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAP,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,OAAO,oECPpB,ggBAqBM,EAAA,CAAA;;2FDdO,OAAO,EAAA,UAAA,EAAA,CAAA;kBALnB,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,UAAA,EAAA,IAAI,YACN,UAAU,EAAA,QAAA,EAAA,ggBAAA,EAAA;;;AEJtB;;AAEG;;;;"}
|