@atlasng/core 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 +38 -0
- package/fesm2022/atlasng-core.mjs +59 -0
- package/fesm2022/atlasng-core.mjs.map +1 -0
- package/package.json +23 -0
- package/types/atlasng-core.d.ts +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @atlasng/core
|
|
2
|
+
|
|
3
|
+
The foundational Angular library for the AtlasNG platform. This library establishes the root application infrastructure — configuration providers, dependency injection tokens, environment handling, and base services that every application and library in the monorepo depends on.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The core library provides:
|
|
8
|
+
|
|
9
|
+
- **Application Bootstrap**: `provideAtlasNg()` and related provider functions for configuring the platform at startup
|
|
10
|
+
- **Environment Handling**: Typed environment configuration with support for development, staging, and production contexts
|
|
11
|
+
- **Base Services**: Root-level services for logging, error handling, and application lifecycle management
|
|
12
|
+
- **Interceptors & Guards**: HTTP interceptors and global route guards applied across all applications
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @atlasng/core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Configuration
|
|
23
|
+
|
|
24
|
+
Use `provideAtlasNg()` to configure the platform at application bootstrap:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { provideAtlasNg } from '@atlasng/core';
|
|
28
|
+
|
|
29
|
+
bootstrapApplication(AppComponent, {
|
|
30
|
+
providers: [provideAtlasNg()],
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### TODO: Environment Configuration
|
|
35
|
+
|
|
36
|
+
### TODO: Dependency Injection Tokens
|
|
37
|
+
|
|
38
|
+
### TODO: Error Handling
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { InjectionToken, inject, DOCUMENT } from '@angular/core';
|
|
2
|
+
export { DOCUMENT } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Injection token for the global {@link Window} object.
|
|
6
|
+
*/
|
|
7
|
+
const WINDOW = new InjectionToken('WINDOW', {
|
|
8
|
+
providedIn: 'root',
|
|
9
|
+
factory: () => {
|
|
10
|
+
const document = inject(DOCUMENT);
|
|
11
|
+
if (document.defaultView) {
|
|
12
|
+
return document.defaultView;
|
|
13
|
+
}
|
|
14
|
+
else if (typeof window !== 'undefined') {
|
|
15
|
+
return window;
|
|
16
|
+
}
|
|
17
|
+
throw new Error('No global "window" object available.');
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Injection token for the current {@link Location} object.
|
|
22
|
+
*/
|
|
23
|
+
const LOCATION = new InjectionToken('LOCATION', {
|
|
24
|
+
providedIn: 'root',
|
|
25
|
+
factory: () => inject(DOCUMENT).location,
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Injection token for the browser {@link CustomElementRegistry}, when available.
|
|
29
|
+
*/
|
|
30
|
+
const CUSTOM_ELEMENT_REGISTRY = new InjectionToken('CUSTOM_ELEMENT_REGISTRY', {
|
|
31
|
+
providedIn: 'root',
|
|
32
|
+
factory: () => {
|
|
33
|
+
const window = inject(WINDOW);
|
|
34
|
+
if (typeof window.customElements === 'object') {
|
|
35
|
+
return window.customElements;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Injection token for the browser {@link ResizeObserver} API, when available.
|
|
42
|
+
*/
|
|
43
|
+
const RESIZE_OBSERVER = new InjectionToken('RESIZE_OBSERVER', {
|
|
44
|
+
providedIn: 'root',
|
|
45
|
+
factory: () => {
|
|
46
|
+
const window = inject(WINDOW);
|
|
47
|
+
if (typeof window.ResizeObserver === 'function') {
|
|
48
|
+
return window.ResizeObserver;
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Generated bundle index. Do not edit.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
export { CUSTOM_ELEMENT_REGISTRY, LOCATION, RESIZE_OBSERVER, WINDOW };
|
|
59
|
+
//# sourceMappingURL=atlasng-core.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlasng-core.mjs","sources":["../../../../libs/core/src/lib/browser-tokens.ts","../../../../libs/core/src/atlasng-core.ts"],"sourcesContent":["import { DOCUMENT, inject, InjectionToken } from '@angular/core';\n\n/**\n * Re-export of Angular's platform-agnostic document token.\n */\nexport { DOCUMENT };\n\n/**\n * Injection token for the global {@link Window} object.\n */\nexport const WINDOW = new InjectionToken<Window & typeof globalThis>('WINDOW', {\n providedIn: 'root',\n factory: () => {\n const document = inject(DOCUMENT);\n if (document.defaultView) {\n return document.defaultView;\n } else if (typeof window !== 'undefined') {\n return window;\n }\n\n throw new Error('No global \"window\" object available.');\n },\n});\n\n/**\n * Injection token for the current {@link Location} object.\n */\nexport const LOCATION = new InjectionToken<Location>('LOCATION', {\n providedIn: 'root',\n factory: () => inject(DOCUMENT).location,\n});\n\n/**\n * Injection token for the browser {@link CustomElementRegistry}, when available.\n */\nexport const CUSTOM_ELEMENT_REGISTRY = new InjectionToken<CustomElementRegistry | undefined>(\n 'CUSTOM_ELEMENT_REGISTRY',\n {\n providedIn: 'root',\n factory: () => {\n const window = inject(WINDOW);\n if (typeof window.customElements === 'object') {\n return window.customElements;\n }\n\n return undefined;\n },\n },\n);\n\n/**\n * Injection token for the browser {@link ResizeObserver} API, when available.\n */\nexport const RESIZE_OBSERVER = new InjectionToken<typeof ResizeObserver | undefined>('RESIZE_OBSERVER', {\n providedIn: 'root',\n factory: () => {\n const window = inject(WINDOW);\n if (typeof window.ResizeObserver === 'function') {\n return window.ResizeObserver;\n }\n\n return undefined;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B;AAEA,QAAA,OAAO,SAAS;IAClB,CAAC;AACF,CAAA;;AC/DD;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlasng/core",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/core": "^21.2.6"
|
|
6
|
+
},
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"module": "fesm2022/atlasng-core.mjs",
|
|
9
|
+
"typings": "types/atlasng-core.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": {
|
|
12
|
+
"default": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./types/atlasng-core.d.ts",
|
|
16
|
+
"default": "./fesm2022/atlasng-core.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"tslib": "^2.3.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
export { DOCUMENT } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Injection token for the global {@link Window} object.
|
|
6
|
+
*/
|
|
7
|
+
declare const WINDOW: InjectionToken<Window & typeof globalThis>;
|
|
8
|
+
/**
|
|
9
|
+
* Injection token for the current {@link Location} object.
|
|
10
|
+
*/
|
|
11
|
+
declare const LOCATION: InjectionToken<Location>;
|
|
12
|
+
/**
|
|
13
|
+
* Injection token for the browser {@link CustomElementRegistry}, when available.
|
|
14
|
+
*/
|
|
15
|
+
declare const CUSTOM_ELEMENT_REGISTRY: InjectionToken<CustomElementRegistry | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Injection token for the browser {@link ResizeObserver} API, when available.
|
|
18
|
+
*/
|
|
19
|
+
declare const RESIZE_OBSERVER: InjectionToken<{
|
|
20
|
+
new (callback: ResizeObserverCallback): ResizeObserver;
|
|
21
|
+
prototype: ResizeObserver;
|
|
22
|
+
} | undefined>;
|
|
23
|
+
|
|
24
|
+
export { CUSTOM_ELEMENT_REGISTRY, LOCATION, RESIZE_OBSERVER, WINDOW };
|