@tociva/tailng-cdk 0.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.
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # @tociva/tailng-cdk
2
+
3
+ Headless Angular utilities and primitives used by Tailng components.
4
+
5
+ This package contains logic-only building blocks such as overlays,
6
+ focus management, keyboard handling, and signal-based utilities.
7
+
8
+ ## Installation
9
+ ```bash
10
+ npm install @tociva/tailng-cdk
@@ -0,0 +1,26 @@
1
+ "use strict";
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("./util/coerce"), exports);
18
+ __exportStar(require("./util/option-list.util"), exports);
19
+ __exportStar(require("./a11y"), exports);
20
+ __exportStar(require("./keyboard"), exports);
21
+ __exportStar(require("./scroll"), exports);
22
+
23
+ /**
24
+ * Generated bundle index. Do not edit.
25
+ */
26
+ //# sourceMappingURL=tociva-tailng-cdk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tociva-tailng-cdk.mjs","sources":["../../../../libs/cdk/src/public-api.ts","../../../../libs/cdk/src/tociva-tailng-cdk.ts"],"sourcesContent":["export * from './util/coerce';\nexport * from './util/option-list.util';\nexport * from './a11y';\nexport * from './keyboard';\nexport * from './scroll';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA,CAAA;AACA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA,CAAA;AACA,YAAA,CAAA,OAAA,CAAA,QAAA,CAAA,EAAA,OAAA,CAAA;AACA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA,CAAA;AACA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA,CAAA;;ACJA;;AAEG"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@tociva/tailng-cdk",
3
+ "version": "0.1.0",
4
+ "description": "Headless Angular utilities and primitives for Tailng",
5
+ "license": "MIT",
6
+ "sideEffects": false,
7
+ "peerDependencies": {
8
+ "@angular/core": "^21.0.0",
9
+ "@angular/common": "^21.0.0"
10
+ },
11
+ "dependencies": {
12
+ "tslib": "^2.6.0"
13
+ },
14
+ "keywords": [
15
+ "angular",
16
+ "cdk",
17
+ "headless",
18
+ "signals",
19
+ "tailng"
20
+ ],
21
+ "module": "fesm2022/tociva-tailng-cdk.mjs",
22
+ "typings": "types/tociva-tailng-cdk.d.ts",
23
+ "exports": {
24
+ "./package.json": {
25
+ "default": "./package.json"
26
+ },
27
+ ".": {
28
+ "types": "./types/tociva-tailng-cdk.d.ts",
29
+ "default": "./fesm2022/tociva-tailng-cdk.mjs"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,77 @@
1
+ import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';
2
+ import * as _angular_core from '@angular/core';
3
+ import { OnDestroy } from '@angular/core';
4
+
5
+ declare const coerceBoolean: (value: unknown) => boolean;
6
+
7
+ type OptionTplContext<T> = {
8
+ $implicit: T;
9
+ index: number;
10
+ active: boolean;
11
+ };
12
+
13
+ type TailngFocusTrapOptions = {
14
+ /** CDK 21 signature uses this boolean */
15
+ deferCaptureElements?: boolean;
16
+ /** tailng behavior */
17
+ autoCapture?: boolean;
18
+ /** tailng behavior */
19
+ restoreFocus?: boolean;
20
+ };
21
+ type TailngFocusTrapHandle = {
22
+ trap: FocusTrap;
23
+ activate: () => void;
24
+ destroy: () => void;
25
+ };
26
+ declare const createTailngFocusTrap: (factory: FocusTrapFactory, element: HTMLElement, options?: TailngFocusTrapOptions) => TailngFocusTrapHandle;
27
+
28
+ declare class TailngFocusTrapDirective implements OnDestroy {
29
+ /** Enable / disable focus trapping */
30
+ readonly tngFocusTrap: _angular_core.InputSignal<boolean>;
31
+ /** CDK 21: FocusTrapFactory.create(element, deferCaptureElements?: boolean) */
32
+ readonly deferCaptureElements: _angular_core.InputSignal<boolean>;
33
+ /** tailng behavior */
34
+ readonly autoCapture: _angular_core.InputSignal<boolean>;
35
+ /** tailng behavior */
36
+ readonly restoreFocus: _angular_core.InputSignal<boolean>;
37
+ private readonly host;
38
+ private readonly injector;
39
+ private readonly focusTrapFactory;
40
+ private handle;
41
+ constructor();
42
+ private enable;
43
+ private disable;
44
+ ngOnDestroy(): void;
45
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TailngFocusTrapDirective, never>;
46
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TailngFocusTrapDirective, "[tngFocusTrap]", never, { "tngFocusTrap": { "alias": "tngFocusTrap"; "required": false; "isSignal": true; }; "deferCaptureElements": { "alias": "deferCaptureElements"; "required": false; "isSignal": true; }; "autoCapture": { "alias": "autoCapture"; "required": false; "isSignal": true; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
47
+ }
48
+
49
+ type KeyboardAction = {
50
+ type: 'move';
51
+ index: number;
52
+ } | {
53
+ type: 'select';
54
+ index: number;
55
+ } | {
56
+ type: 'close';
57
+ } | {
58
+ type: 'noop';
59
+ };
60
+ interface KeyboardNavigationState {
61
+ activeIndex: number;
62
+ itemCount: number;
63
+ loop?: boolean;
64
+ }
65
+ declare function handleListKeyboardEvent(event: KeyboardEvent, state: KeyboardNavigationState): KeyboardAction;
66
+
67
+ interface ScrollActiveIntoViewOptions {
68
+ container: HTMLElement | null | undefined;
69
+ activeIndex: number;
70
+ itemSelector?: string;
71
+ behavior?: ScrollBehavior;
72
+ }
73
+ declare function scrollActiveIntoView({ container, activeIndex, itemSelector, behavior, }: ScrollActiveIntoViewOptions): void;
74
+
75
+ export { TailngFocusTrapDirective, coerceBoolean, createTailngFocusTrap, handleListKeyboardEvent, scrollActiveIntoView };
76
+ export type { KeyboardAction, KeyboardNavigationState, OptionTplContext, ScrollActiveIntoViewOptions, TailngFocusTrapHandle, TailngFocusTrapOptions };
77
+ //# sourceMappingURL=tociva-tailng-cdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tociva-tailng-cdk.d.ts","sources":["../../../../libs/cdk/src/util/coerce.ts","../../../../libs/cdk/src/util/option-list.util.ts","../../../../libs/cdk/src/a11y/focus-trap/focus-trap.util.ts","../../../../libs/cdk/src/a11y/focus-trap/focus-trap.directive.ts","../../../../libs/cdk/src/keyboard/keyboard-navigation.ts","../../../../libs/cdk/src/scroll/scroll-active-into-view.ts"],"sourcesContent":[null,null,null,null,null,null],"names":[],"mappings":";;;;AAAA,cAAA,aAAA;;ACAM,KAAA,gBAAA;;;;;;ACEA,KAAA,sBAAA;;;;;;;;AAWA,KAAA,qBAAA;;;;;AAMN,cAAA,qBAAA,YAAA,gBAAA,WAAA,WAAA,YAAA,sBAAA,KAAA,qBAAA;;ACFA,cAAA,wBAAA,YAAA,SAAA;;2BAMuB,aAAA,CAAA,WAAA;;mCAGQ,aAAA,CAAA,WAAA;;0BAGT,aAAA,CAAA,WAAA;;2BAGC,aAAA,CAAA,WAAA;AAErB;AACA;AAGA;;;AAoBA;AAgBA;AAKA;;;AAGD;;ACjFK,KAAA,cAAA;;;;;;;;;;;;;;;AAUL;AAED,iBAAA,uBAAA,QAAA,aAAA,SAAA,uBAAA,GAAA,cAAA;;;ACZE,eAAA,WAAA;;;;AAID;AAED,iBAAA,oBAAA,sDAAA,2BAAA;;;;"}