@atlasng/cdk 0.0.2

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,29 @@
1
+ # @atlasng/cdk
2
+
3
+ A low-level Angular Component Development Kit (CDK) that provides primitive building blocks for constructing higher-level UI components. This library contains abstract base classes, structural directives, behavioral utilities, and accessibility primitives used across the AtlasNG component family.
4
+
5
+ ## Overview
6
+
7
+ The CDK enables library and application authors to:
8
+
9
+ - **Compose Behaviors**: Apply reusable behavioral mixins and abstract base classes to custom components
10
+ - **Accessibility Primitives**: Leverage focus management, keyboard navigation, and ARIA utilities out of the box
11
+ - **Overlay & Positioning**: Position floating elements (tooltips, dropdowns, dialogs) with a flexible positioning engine
12
+ - **Portal System**: Render Angular templates and components into arbitrary DOM locations
13
+ - **Interaction Utilities**: Detect and respond to pointer events, scroll, and resize across component boundaries
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @atlasng/cdk
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### TODO: Overlay & Positioning
24
+
25
+ ### TODO: Portal System
26
+
27
+ ### TODO: Focus & Keyboard Navigation
28
+
29
+ ### TODO: Abstract Base Classes
@@ -0,0 +1,53 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, EnvironmentInjector, DestroyRef, createComponent, Injectable } from '@angular/core';
3
+
4
+ /**
5
+ * Service to load stylesheets dynamically into the application.
6
+ * Used to load shared and/or directive associated stylesheets.
7
+ *
8
+ * This code was adapted from an internal Angular CDK service.
9
+ * The original code can be found at: {@link https://github.com/angular/components/blob/v21.2.10/src/cdk/private/style-loader.ts}
10
+ */
11
+ class StyleLoader {
12
+ /** Reference to the environment injector. */
13
+ environmentInjector = inject(EnvironmentInjector);
14
+ /** Set of loaded style provider components. */
15
+ loaders = new Set();
16
+ /** List of created component references. */
17
+ refs = [];
18
+ /**
19
+ * Initialize the style loader and register cleanup logic.
20
+ */
21
+ constructor() {
22
+ inject(DestroyRef).onDestroy(() => {
23
+ this.refs.forEach((ref) => ref.destroy());
24
+ });
25
+ }
26
+ /**
27
+ * Loads a stylesheet component if it hasn't been loaded already.
28
+ *
29
+ * @param loader Style provider component to load.
30
+ */
31
+ load(loader) {
32
+ if (!this.loaders.has(loader)) {
33
+ const ref = createComponent(loader, { environmentInjector: this.environmentInjector });
34
+ this.loaders.add(loader);
35
+ this.refs.push(ref);
36
+ }
37
+ }
38
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: StyleLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
39
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: StyleLoader, providedIn: 'root' });
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: StyleLoader, decorators: [{
42
+ type: Injectable,
43
+ args: [{
44
+ providedIn: 'root',
45
+ }]
46
+ }], ctorParameters: () => [] });
47
+
48
+ /**
49
+ * Generated bundle index. Do not edit.
50
+ */
51
+
52
+ export { StyleLoader };
53
+ //# sourceMappingURL=atlasng-cdk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlasng-cdk.mjs","sources":["../../../../libs/cdk/src/lib/style-loader.ts","../../../../libs/cdk/src/atlasng-cdk.ts"],"sourcesContent":["import {\n ComponentRef,\n createComponent,\n DestroyRef,\n EnvironmentInjector,\n inject,\n Injectable,\n Type,\n} from '@angular/core';\n\n/**\n * Service to load stylesheets dynamically into the application.\n * Used to load shared and/or directive associated stylesheets.\n *\n * This code was adapted from an internal Angular CDK service.\n * The original code can be found at: {@link https://github.com/angular/components/blob/v21.2.10/src/cdk/private/style-loader.ts}\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleLoader {\n /** Reference to the environment injector. */\n private readonly environmentInjector = inject(EnvironmentInjector);\n /** Set of loaded style provider components. */\n private readonly loaders = new Set<Type<unknown>>();\n /** List of created component references. */\n private readonly refs: ComponentRef<unknown>[] = [];\n\n /**\n * Initialize the style loader and register cleanup logic.\n */\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.refs.forEach((ref) => ref.destroy());\n });\n }\n\n /**\n * Loads a stylesheet component if it hasn't been loaded already.\n *\n * @param loader Style provider component to load.\n */\n load(loader: Type<unknown>): void {\n if (!this.loaders.has(loader)) {\n const ref = createComponent(loader, { environmentInjector: this.environmentInjector });\n this.loaders.add(loader);\n this.refs.push(ref);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAUA;;;;;;AAMG;MAIU,WAAW,CAAA;;AAEL,IAAA,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC;;AAEjD,IAAA,OAAO,GAAG,IAAI,GAAG,EAAiB;;IAElC,IAAI,GAA4B,EAAE;AAEnD;;AAEG;AACH,IAAA,WAAA,GAAA;AACE,QAAA,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,MAAK;AAChC,YAAA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;AAC3C,QAAA,CAAC,CAAC;IACJ;AAEA;;;;AAIG;AACH,IAAA,IAAI,CAAC,MAAqB,EAAA;QACxB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;AAC7B,YAAA,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC;AACtF,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;AACxB,YAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACrB;IACF;uGA5BW,WAAW,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAX,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,cAFV,MAAM,EAAA,CAAA;;2FAEP,WAAW,EAAA,UAAA,EAAA,CAAA;kBAHvB,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACnBD;;AAEG;;;;"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@atlasng/cdk",
3
+ "version": "0.0.2",
4
+ "peerDependencies": {
5
+ "@angular/core": "^21.2.6"
6
+ },
7
+ "sideEffects": false,
8
+ "module": "fesm2022/atlasng-cdk.mjs",
9
+ "typings": "types/atlasng-cdk.d.ts",
10
+ "exports": {
11
+ "./package.json": {
12
+ "default": "./package.json"
13
+ },
14
+ ".": {
15
+ "types": "./types/atlasng-cdk.d.ts",
16
+ "default": "./fesm2022/atlasng-cdk.mjs"
17
+ }
18
+ },
19
+ "type": "module",
20
+ "dependencies": {
21
+ "tslib": "^2.3.0"
22
+ }
23
+ }
@@ -0,0 +1,32 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Type } from '@angular/core';
3
+
4
+ /**
5
+ * Service to load stylesheets dynamically into the application.
6
+ * Used to load shared and/or directive associated stylesheets.
7
+ *
8
+ * This code was adapted from an internal Angular CDK service.
9
+ * The original code can be found at: {@link https://github.com/angular/components/blob/v21.2.10/src/cdk/private/style-loader.ts}
10
+ */
11
+ declare class StyleLoader {
12
+ /** Reference to the environment injector. */
13
+ private readonly environmentInjector;
14
+ /** Set of loaded style provider components. */
15
+ private readonly loaders;
16
+ /** List of created component references. */
17
+ private readonly refs;
18
+ /**
19
+ * Initialize the style loader and register cleanup logic.
20
+ */
21
+ constructor();
22
+ /**
23
+ * Loads a stylesheet component if it hasn't been loaded already.
24
+ *
25
+ * @param loader Style provider component to load.
26
+ */
27
+ load(loader: Type<unknown>): void;
28
+ static ɵfac: i0.ɵɵFactoryDeclaration<StyleLoader, never>;
29
+ static ɵprov: i0.ɵɵInjectableDeclaration<StyleLoader>;
30
+ }
31
+
32
+ export { StyleLoader };