@ng-atomic/core 19.0.0-preview.8 → 19.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/fesm2022/ng-atomic-core.mjs +220 -158
- package/fesm2022/ng-atomic-core.mjs.map +1 -1
- package/index.d.ts +235 -1
- package/package.json +2 -11
- package/README.md +0 -70
- package/lib/action-store.d.ts +0 -24
- package/lib/action.d.ts +0 -29
- package/lib/debug/debug.directive.d.ts +0 -16
- package/lib/debug/index.d.ts +0 -1
- package/lib/effect.d.ts +0 -41
- package/lib/index.d.ts +0 -10
- package/lib/injectable-component.d.ts +0 -40
- package/lib/input.d.ts +0 -5
- package/lib/ng-atomic-component.d.ts +0 -15
- package/lib/ng-atomic-debug.d.ts +0 -6
- package/lib/route.d.ts +0 -4
- package/lib/signals.d.ts +0 -15
package/index.d.ts
CHANGED
|
@@ -1 +1,235 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnChanges, SimpleChanges, Type, ComponentRef, ElementRef, ApplicationRef, Injector, Provider, EventEmitter, InputSignal, Signal, computed, CreateComputedOptions, PipeTransform, InjectionToken } from '@angular/core';
|
|
3
|
+
import { ClassConstructor } from 'class-transformer';
|
|
4
|
+
import { JsonSchema } from 'json-schema-library';
|
|
5
|
+
import { ActivatedRoute, LoadChildrenCallback, Routes, Route } from '@angular/router';
|
|
6
|
+
|
|
7
|
+
interface Action<T = any> {
|
|
8
|
+
id: string;
|
|
9
|
+
payload?: T;
|
|
10
|
+
name?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
children?: Action<T>[];
|
|
15
|
+
meta?: {
|
|
16
|
+
componentId?: string | number | null;
|
|
17
|
+
} | any;
|
|
18
|
+
}
|
|
19
|
+
type ActionsFactory<T = any> = (...args: any[]) => Action<T>[];
|
|
20
|
+
/** @deprecated */
|
|
21
|
+
type Actions = ActionsFactory | Action[];
|
|
22
|
+
type NavActions = Action[][] | Action[];
|
|
23
|
+
type ItemActions<T = any> = (item: T) => Action[];
|
|
24
|
+
declare function resolveActions(actions: Actions, ...args: any[]): Action<any>[];
|
|
25
|
+
declare function wrapActions(actions: Actions): ActionsFactory;
|
|
26
|
+
interface CreateActionsOptions<P extends object = any> {
|
|
27
|
+
validator?: (item: P) => null | string | string[];
|
|
28
|
+
name?: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
}
|
|
31
|
+
type ActionFactory<P extends object = any> = (payload?: P, meta?: CreateActionsOptions) => Action<P>;
|
|
32
|
+
declare function createAction<P extends object = any>(type: string, schema: JsonSchema | ClassConstructor<P>, options?: CreateActionsOptions<P>): {
|
|
33
|
+
validate: (item: P) => null | string | string[];
|
|
34
|
+
create: ActionFactory<P>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
declare class NgAtomicActionLogger {
|
|
38
|
+
log(action: Action, scope?: string): void;
|
|
39
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicActionLogger, never>;
|
|
40
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgAtomicActionLogger>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type TypeFactoryAsync<T> = () => Promise<Type<T>>;
|
|
44
|
+
type TypeFactory<T> = () => (Type<T> | Promise<Type<T>>);
|
|
45
|
+
type TypeOrTypeFactory<T> = Type<T> | TypeFactory<T>;
|
|
46
|
+
declare const TOKEN = "\u0394tkn";
|
|
47
|
+
declare function provideComponent<ABS = any, IMPL = any>(abstract: Type<ABS>, typeOrFactory: TypeOrTypeFactory<IMPL>): {
|
|
48
|
+
provide: any;
|
|
49
|
+
useValue: () => Promise<Type<IMPL>>;
|
|
50
|
+
};
|
|
51
|
+
declare function makeProvideComopnentConfigure<Store = any, Component = any>(abstract: Type<Store>): (typeOrFactory: TypeOrTypeFactory<Component>) => {
|
|
52
|
+
provide: any;
|
|
53
|
+
useValue: () => Promise<Type<Component>>;
|
|
54
|
+
};
|
|
55
|
+
declare function TokenizedType(): <T extends Type<any>>(type: T) => void;
|
|
56
|
+
declare function getToken(type: Type<any>): any;
|
|
57
|
+
declare enum HostType {
|
|
58
|
+
Dir = "\u0275dir",
|
|
59
|
+
Cmp = "\u0275cmp"
|
|
60
|
+
}
|
|
61
|
+
type IO = {
|
|
62
|
+
propName: string;
|
|
63
|
+
templateName: string;
|
|
64
|
+
};
|
|
65
|
+
declare function getMeta<T>(type: Type<T>): unknown;
|
|
66
|
+
declare function getInputs<T>(type: Type<T>): IO[];
|
|
67
|
+
declare function getOutputs<T>(type: Type<T>): IO[];
|
|
68
|
+
declare function getInputsByComponentRef<T extends {} = any>(cmp: ComponentRef<T>): IO[];
|
|
69
|
+
declare function getOutputsByInstance<T extends {} = any>(cmp: ComponentRef<T>): IO[];
|
|
70
|
+
declare class InjectableComponent<T = any> implements OnInit, OnChanges {
|
|
71
|
+
#private;
|
|
72
|
+
readonly injectable: i0.InputSignalWithTransform<any, any>;
|
|
73
|
+
readonly __action: i0.OutputEmitterRef<Action<any>>;
|
|
74
|
+
get propNames(): string[];
|
|
75
|
+
get injected(): T | null;
|
|
76
|
+
proxyFakeComputedInputs(): void;
|
|
77
|
+
constructor();
|
|
78
|
+
ngOnInit(): void;
|
|
79
|
+
ngOnChanges(simpleChanges: SimpleChanges): void;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InjectableComponent<any>, never>;
|
|
81
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<InjectableComponent<any>, never, never, { "injectable": { "alias": "injectable"; "required": false; "isSignal": true; }; }, { "__action": "action"; }, never, never, true, never>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
declare class DebugDirective implements OnInit {
|
|
85
|
+
protected el: ElementRef<HTMLElement>;
|
|
86
|
+
protected platformId: Object;
|
|
87
|
+
protected isDebug: i0.InputSignal<boolean>;
|
|
88
|
+
protected label: i0.InputSignal<string>;
|
|
89
|
+
ngOnInit(): void;
|
|
90
|
+
protected createLabelElement(options: {
|
|
91
|
+
label: string;
|
|
92
|
+
color: string;
|
|
93
|
+
}): void;
|
|
94
|
+
protected createOutline(color: string): void;
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DebugDirective, never>;
|
|
96
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DebugDirective, "debug", never, { "isDebug": { "alias": "isDebug"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare class NgAtomicHostActionStore {
|
|
100
|
+
protected readonly logger: NgAtomicActionLogger;
|
|
101
|
+
readonly root: NgAtomicRootActionStore;
|
|
102
|
+
readonly appRef: ApplicationRef;
|
|
103
|
+
readonly route: ActivatedRoute;
|
|
104
|
+
readonly injector: Injector;
|
|
105
|
+
dispatch(action: Action, context: ActionContext): Promise<void>;
|
|
106
|
+
protected dispatchToParentInjector(action: Action, context: ActionContext, injector?: Injector): Promise<void>;
|
|
107
|
+
protected isBootstrapOrRouteComponent(context: ActionContext): boolean;
|
|
108
|
+
protected isRouteComponent(context: ActionContext): boolean;
|
|
109
|
+
protected isBootstrapComponent(context: ActionContext): boolean;
|
|
110
|
+
registerRootEffectEntries(component: NgAtomicComponent): void;
|
|
111
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicHostActionStore, never>;
|
|
112
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgAtomicHostActionStore, never, never, {}, {}, never, never, true, never>;
|
|
113
|
+
}
|
|
114
|
+
declare class NgAtomicComponent<T = any> extends InjectableComponent<T> {
|
|
115
|
+
#private;
|
|
116
|
+
protected readonly actionStore: NgAtomicHostActionStore;
|
|
117
|
+
protected readonly logger: NgAtomicActionLogger;
|
|
118
|
+
readonly __injector: Injector;
|
|
119
|
+
readonly __action: i0.OutputEmitterRef<Action<any>>;
|
|
120
|
+
get selector(): any;
|
|
121
|
+
constructor();
|
|
122
|
+
dispatch(action_: Action, scope?: string, componentId?: string | number | null): Promise<void>;
|
|
123
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicComponent<any>, never>;
|
|
124
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgAtomicComponent<any>, never, never, {}, { "__action": "action"; }, never, never, true, [{ directive: typeof NgAtomicHostActionStore; inputs: {}; outputs: {}; }, { directive: typeof DebugDirective; inputs: {}; outputs: {}; }]>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
interface EffectProps {
|
|
128
|
+
dispatch: boolean;
|
|
129
|
+
scopes: string[];
|
|
130
|
+
accessor: (action: Action) => any;
|
|
131
|
+
}
|
|
132
|
+
declare const DEFAULT_EFFECT_PROPS: EffectProps;
|
|
133
|
+
declare function normalizeEffectProps(props?: Partial<EffectProps & {
|
|
134
|
+
scope?: string;
|
|
135
|
+
}>): {
|
|
136
|
+
dispatch: boolean;
|
|
137
|
+
scopes: string[];
|
|
138
|
+
accessor: (action: Action) => any;
|
|
139
|
+
} & {
|
|
140
|
+
dispatch?: boolean;
|
|
141
|
+
scopes?: string[];
|
|
142
|
+
accessor?: (action: Action) => any;
|
|
143
|
+
scope?: string;
|
|
144
|
+
};
|
|
145
|
+
interface EffectContext {
|
|
146
|
+
hostInjector: Injector;
|
|
147
|
+
}
|
|
148
|
+
interface ActionContext {
|
|
149
|
+
scope: 'root' | 'host' | string;
|
|
150
|
+
component?: NgAtomicComponent;
|
|
151
|
+
}
|
|
152
|
+
type EffectFactory = (hostInjector?: Injector) => Effect;
|
|
153
|
+
type EffectResult = {
|
|
154
|
+
dispatch: boolean;
|
|
155
|
+
};
|
|
156
|
+
interface EffectEntry {
|
|
157
|
+
actionIds: string | string[];
|
|
158
|
+
effectFactory?: EffectFactory;
|
|
159
|
+
props?: EffectProps;
|
|
160
|
+
context?: EffectContext;
|
|
161
|
+
}
|
|
162
|
+
interface ResolvedEffectEntry {
|
|
163
|
+
effectFactory: () => Effect;
|
|
164
|
+
props: EffectProps;
|
|
165
|
+
}
|
|
166
|
+
declare function provideEffect(ActionIds: string[] | string, _effectFactory: (factoryInjector: Injector) => Effect, props?: Partial<EffectProps & {
|
|
167
|
+
scope?: string;
|
|
168
|
+
}>): Provider;
|
|
169
|
+
declare function injectEffectEntries(injector?: Injector): {
|
|
170
|
+
context: {
|
|
171
|
+
hostInjector: Injector;
|
|
172
|
+
scope: any;
|
|
173
|
+
};
|
|
174
|
+
actionIds: string | string[];
|
|
175
|
+
effectFactory?: EffectFactory;
|
|
176
|
+
props?: EffectProps;
|
|
177
|
+
}[];
|
|
178
|
+
declare function getEffectEntries(target: any): EffectEntry[];
|
|
179
|
+
type Effect = (payload?: any, context?: ActionContext) => any | Promise<any>;
|
|
180
|
+
declare function Effect(actionId: string, props?: Partial<EffectProps & {
|
|
181
|
+
scope?: string;
|
|
182
|
+
}>): (target: any, _: string, descriptor: PropertyDescriptor) => void;
|
|
183
|
+
declare class EffectResolver {
|
|
184
|
+
protected readonly effectEntryMap: Map<string, ResolvedEffectEntry>;
|
|
185
|
+
register(effectEntry: EffectEntry): void;
|
|
186
|
+
registerMany(entries: EffectEntry[]): void;
|
|
187
|
+
resolve(actionId: string, scope?: string): ResolvedEffectEntry | null;
|
|
188
|
+
private makeKey;
|
|
189
|
+
}
|
|
190
|
+
declare function applyEffect(resolver: EffectResolver, action: Action, context: ActionContext): Promise<EffectResult>;
|
|
191
|
+
|
|
192
|
+
declare class NgAtomicRootActionStore {
|
|
193
|
+
protected readonly logger: NgAtomicActionLogger;
|
|
194
|
+
protected readonly actions$: EventEmitter<Action<any>>;
|
|
195
|
+
protected readonly resolver: EffectResolver;
|
|
196
|
+
constructor();
|
|
197
|
+
dispatch(action: Action): Promise<void>;
|
|
198
|
+
register(effectEntry: EffectEntry): void;
|
|
199
|
+
registerMany(effectEntries: EffectEntry[]): void;
|
|
200
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicRootActionStore, never>;
|
|
201
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NgAtomicRootActionStore>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
type InputSignalType<T> = T extends InputSignal<infer U> ? U : never;
|
|
205
|
+
declare function applyToInput<T, K extends keyof T>(instance: T, propName: K, value: InputSignalType<T[K]>): void;
|
|
206
|
+
declare function updateInput<T, K extends keyof T>(instance: T, propName: K, updater: (value: InputSignalType<T[K]>) => InputSignalType<T[K]>): void;
|
|
207
|
+
|
|
208
|
+
declare function wrapLoadChildren(loadChildrenCallback: LoadChildrenCallback): Promise<Routes>;
|
|
209
|
+
declare function recursiveWrapRoute(route: Route, ...wrappers: ((route: Route) => Route)[]): Route;
|
|
210
|
+
declare function recursiveWrapRoutes(routes: Routes, ...wrappers: ((route: Route) => Route)[]): Routes;
|
|
211
|
+
|
|
212
|
+
declare function proxyFakeComputedInputValueFn(inputValueFn: any): any;
|
|
213
|
+
declare function computeFake<T>(valueOrFakeComputed: T): T;
|
|
214
|
+
declare function isSignalOrFakeComputed<T>(value: any): value is (Signal<T> | ReturnType<typeof computed<T>>);
|
|
215
|
+
declare function computeFakeV2<T>(valueOrFakeComputed: Signal<T> | T): T;
|
|
216
|
+
declare function proxyFakeComputedInputs(target: any, inputs: string[]): void;
|
|
217
|
+
declare const FAKE_COMPUTED: unique symbol;
|
|
218
|
+
declare function compute(target: any, propName: string): void;
|
|
219
|
+
declare function fakeComputed<T>(computation: () => T, options?: CreateComputedOptions<T>): T;
|
|
220
|
+
declare function _computed<T>(computation: () => T, options?: CreateComputedOptions<T>): T;
|
|
221
|
+
declare function isFakeComputed(_computed: any): _computed is ReturnType<typeof computed>;
|
|
222
|
+
declare class CallPipe implements PipeTransform {
|
|
223
|
+
transform<T>(value: Signal<T> | T): T;
|
|
224
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CallPipe, never>;
|
|
225
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CallPipe, "call", true>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare const NG_ATOMIC_DEBUG: InjectionToken<boolean>;
|
|
229
|
+
declare function withNgAtomicDebug(): {
|
|
230
|
+
provide: InjectionToken<boolean>;
|
|
231
|
+
useValue: boolean;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export { CallPipe, DEFAULT_EFFECT_PROPS, DebugDirective, Effect, EffectResolver, FAKE_COMPUTED, HostType, InjectableComponent, NG_ATOMIC_DEBUG, NgAtomicActionLogger, NgAtomicComponent, NgAtomicHostActionStore, NgAtomicRootActionStore, TOKEN, TokenizedType, _computed, applyEffect, applyToInput, compute, computeFake, computeFakeV2, createAction, fakeComputed, getEffectEntries, getInputs, getInputsByComponentRef, getMeta, getOutputs, getOutputsByInstance, getToken, injectEffectEntries, isFakeComputed, isSignalOrFakeComputed, makeProvideComopnentConfigure, normalizeEffectProps, provideComponent, provideEffect, proxyFakeComputedInputValueFn, proxyFakeComputedInputs, recursiveWrapRoute, recursiveWrapRoutes, resolveActions, updateInput, withNgAtomicDebug, wrapActions, wrapLoadChildren };
|
|
235
|
+
export type { Action, ActionContext, ActionFactory, Actions, ActionsFactory, CreateActionsOptions, EffectContext, EffectEntry, EffectProps, EffectResult, ItemActions, NavActions, TypeFactory, TypeFactoryAsync, TypeOrTypeFactory };
|
package/package.json
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-atomic/core",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.1.0",
|
|
4
4
|
"homepage": "https://github.com/xx-machina/plaform/tree/main/packages/@ng-atomic/core",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/xx-machina/plaform.git"
|
|
8
8
|
},
|
|
9
|
-
"peerDependencies": {
|
|
10
|
-
"@angular/core": "19.1.4",
|
|
11
|
-
"@angular/common": "19.1.4",
|
|
12
|
-
"@angular/router": "19.1.4",
|
|
13
|
-
"ajv": "^8.17.1",
|
|
14
|
-
"class-transformer": "^0.5.1",
|
|
15
|
-
"class-validator": "^0.14.0",
|
|
16
|
-
"json-schema-library": "^10.0.0-rc2",
|
|
17
|
-
"rxjs": "^7.8.0"
|
|
18
|
-
},
|
|
9
|
+
"peerDependencies": {},
|
|
19
10
|
"dependencies": {
|
|
20
11
|
"tslib": "^2.3.0"
|
|
21
12
|
},
|
package/README.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# @ng-atomic/core
|
|
2
|
-
`@ng-atomic/core` is a library that enables dependency injection for components.
|
|
3
|
-
|
|
4
|
-
## Install
|
|
5
|
-
```sh
|
|
6
|
-
$ npm i @ng-atomic/core
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
```ts
|
|
11
|
-
import { Component, Directive, inject, input } from '@angular/core';
|
|
12
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
13
|
-
import { Effect, TokenizedType, provideComponent, InjectableComponent } from '@ng-atomic/core';
|
|
14
|
-
import { NgAtomicComponent } from '@ng-atomic/core';
|
|
15
|
-
import 'zone.js';
|
|
16
|
-
|
|
17
|
-
export enum ActionId {
|
|
18
|
-
CREATE = 'Create',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@TokenizedType()
|
|
22
|
-
@Directive({ standalone: true, selector: 'example' })
|
|
23
|
-
export class ExampleComponentStore extends InjectableComponent {
|
|
24
|
-
static readonly ActionId = ActionId;
|
|
25
|
-
readonly name = input<string>('');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
@Component({
|
|
29
|
-
standalone: true,
|
|
30
|
-
selector: `example`,
|
|
31
|
-
template: `
|
|
32
|
-
<div>{{ store.name() }}</div>
|
|
33
|
-
<button (click)="onClick()">ADD</button>
|
|
34
|
-
`,
|
|
35
|
-
hostDirectives: [
|
|
36
|
-
{
|
|
37
|
-
directive: ExampleComponentStore,
|
|
38
|
-
inputs: ['name'],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
})
|
|
42
|
-
export class ExampleComponent extends NgAtomicComponent {
|
|
43
|
-
protected readonly store = inject(ExampleComponentStore);
|
|
44
|
-
|
|
45
|
-
protected onClick() {
|
|
46
|
-
this.dispatch({ id: ActionId.CREATE, payload: 'ADD' });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@Component({
|
|
51
|
-
selector: 'app-root',
|
|
52
|
-
standalone: true,
|
|
53
|
-
imports: [ExampleComponentStore],
|
|
54
|
-
template: `
|
|
55
|
-
<example [name]="'test'" (action)="dispatch($event)" injectable/>
|
|
56
|
-
`,
|
|
57
|
-
providers: [provideComponent(ExampleComponentStore, () => ExampleComponent)],
|
|
58
|
-
})
|
|
59
|
-
export class App extends NgAtomicComponent {
|
|
60
|
-
@Effect(ExampleComponentStore.ActionId.CREATE)
|
|
61
|
-
protected create() {
|
|
62
|
-
alert('created!!');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
bootstrapApplication(App);
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
# LISENCE
|
|
70
|
-
MIT
|
package/lib/action-store.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, Injector } from "@angular/core";
|
|
2
|
-
import { Action } from "./action";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class NgAtomicActionLogger {
|
|
5
|
-
log(action: Action, scope?: string): void;
|
|
6
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicActionLogger, never>;
|
|
7
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NgAtomicActionLogger>;
|
|
8
|
-
}
|
|
9
|
-
export declare class NgAtomicRootActionStore {
|
|
10
|
-
protected logger: NgAtomicActionLogger;
|
|
11
|
-
protected readonly _actions$: EventEmitter<Action<any>>;
|
|
12
|
-
readonly actions$: import("rxjs").Observable<Action<any>>;
|
|
13
|
-
constructor();
|
|
14
|
-
dispatch(action: Action): void;
|
|
15
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicRootActionStore, never>;
|
|
16
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NgAtomicRootActionStore>;
|
|
17
|
-
}
|
|
18
|
-
export declare class NgAtomicInjectorActionStore {
|
|
19
|
-
#private;
|
|
20
|
-
protected logger: NgAtomicActionLogger;
|
|
21
|
-
dispatch(injector: Injector, action: Action, hostInjector?: Injector): Promise<void>;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicInjectorActionStore, never>;
|
|
23
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NgAtomicInjectorActionStore>;
|
|
24
|
-
}
|
package/lib/action.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ClassConstructor } from "class-transformer";
|
|
2
|
-
import { JsonSchema } from "json-schema-library";
|
|
3
|
-
export interface Action<T = any> {
|
|
4
|
-
id: string;
|
|
5
|
-
payload?: T;
|
|
6
|
-
name?: string;
|
|
7
|
-
icon?: string;
|
|
8
|
-
color?: string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
children?: Action<T>[];
|
|
11
|
-
meta?: {
|
|
12
|
-
componentId?: string | number | null;
|
|
13
|
-
} | any;
|
|
14
|
-
}
|
|
15
|
-
export type ActionsFactory<T = any> = (...args: any[]) => Action<T>[];
|
|
16
|
-
/** @deprecated */
|
|
17
|
-
export type Actions = ActionsFactory | Action[];
|
|
18
|
-
export declare function resolveActions(actions: Actions, ...args: any[]): Action<any>[];
|
|
19
|
-
export declare function wrapActions(actions: Actions): ActionsFactory;
|
|
20
|
-
export interface CreateActionsOptions<P extends object = any> {
|
|
21
|
-
validator?: (item: P) => null | string | string[];
|
|
22
|
-
name?: string;
|
|
23
|
-
icon?: string;
|
|
24
|
-
}
|
|
25
|
-
export type ActionFactory<P extends object = any> = (payload?: P, meta?: CreateActionsOptions) => Action<P>;
|
|
26
|
-
export declare function createAction<P extends object = any>(type: string, schema: JsonSchema | ClassConstructor<P>, options?: CreateActionsOptions<P>): {
|
|
27
|
-
validate: (item: P) => null | string | string[];
|
|
28
|
-
create: ActionFactory<P>;
|
|
29
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ElementRef, OnInit } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class DebugDirective implements OnInit {
|
|
4
|
-
protected el: ElementRef<HTMLElement>;
|
|
5
|
-
protected platformId: Object;
|
|
6
|
-
protected isDebug: import("@angular/core").InputSignal<boolean>;
|
|
7
|
-
protected label: import("@angular/core").InputSignal<string>;
|
|
8
|
-
ngOnInit(): void;
|
|
9
|
-
protected createLabelElement(options: {
|
|
10
|
-
label: string;
|
|
11
|
-
color: string;
|
|
12
|
-
}): void;
|
|
13
|
-
protected createOutline(color: string): void;
|
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DebugDirective, never>;
|
|
15
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DebugDirective, "debug", never, { "isDebug": { "alias": "isDebug"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
16
|
-
}
|
package/lib/debug/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './debug.directive';
|
package/lib/effect.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Injector, Provider } from "@angular/core";
|
|
2
|
-
import { Action } from "./action";
|
|
3
|
-
export interface EffectProps {
|
|
4
|
-
dispatch: boolean;
|
|
5
|
-
scope: string;
|
|
6
|
-
accessor: (action: Action) => any;
|
|
7
|
-
}
|
|
8
|
-
export declare class EffectMap extends Map<string, {
|
|
9
|
-
key: string;
|
|
10
|
-
props: EffectProps;
|
|
11
|
-
}> {
|
|
12
|
-
get(key: string, scope?: string): {
|
|
13
|
-
key: string;
|
|
14
|
-
props: EffectProps;
|
|
15
|
-
};
|
|
16
|
-
set(key: string, value: {
|
|
17
|
-
key: string;
|
|
18
|
-
props: EffectProps;
|
|
19
|
-
}): this;
|
|
20
|
-
has(key: string, scope?: string): boolean;
|
|
21
|
-
private makeKey;
|
|
22
|
-
}
|
|
23
|
-
export declare function Effect(id: string, { dispatch, scope, accessor, }?: Partial<EffectProps>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
24
|
-
export interface EffectFunctionOptions {
|
|
25
|
-
dispatch?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface EffectContext {
|
|
28
|
-
injector?: Injector;
|
|
29
|
-
}
|
|
30
|
-
export type EffectFunction = (payload?: any, context?: EffectContext) => any | Promise<any>;
|
|
31
|
-
export type EffectFunctionFactory = (hostInjector?: Injector) => EffectFunction;
|
|
32
|
-
export interface EffectEntry {
|
|
33
|
-
actionIds: string | string[];
|
|
34
|
-
effectFactory?: EffectFunctionFactory;
|
|
35
|
-
options?: EffectFunctionOptions;
|
|
36
|
-
}
|
|
37
|
-
export declare const EFFECT_ENTRY: InjectionToken<EffectEntry>;
|
|
38
|
-
export declare function provideEffect(ActionIds: string[] | string, _effectFactory: (injector: Injector) => EffectFunction, options?: EffectFunctionOptions): Provider;
|
|
39
|
-
export declare function injectEffectReducer(injector?: Injector): (action: Action, hostInjector: Injector) => Promise<{
|
|
40
|
-
dispatch: boolean;
|
|
41
|
-
}>;
|
package/lib/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './action-store';
|
|
2
|
-
export * from './action';
|
|
3
|
-
export * from './effect';
|
|
4
|
-
export * from './injectable-component';
|
|
5
|
-
export * from './input';
|
|
6
|
-
export * from './route';
|
|
7
|
-
export * from './ng-atomic-component';
|
|
8
|
-
export * from './signals';
|
|
9
|
-
export * from './debug';
|
|
10
|
-
export * from './ng-atomic-debug';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ComponentRef, SimpleChanges, Type, EventEmitter } from "@angular/core";
|
|
2
|
-
import { OnInit, OnChanges } from "@angular/core";
|
|
3
|
-
import { Action } from "./action";
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export type TypeFactoryAsync<T> = () => Promise<Type<T>>;
|
|
6
|
-
export type TypeFactory<T> = () => (Type<T> | Promise<Type<T>>);
|
|
7
|
-
export declare const TOKEN = "\u0394tkn";
|
|
8
|
-
export declare function provideComponent<ABS = any, IMPL = any>(abstract: Type<ABS>, typeOrFactory: Type<IMPL> | TypeFactory<IMPL>): {
|
|
9
|
-
provide: any;
|
|
10
|
-
useValue: () => Promise<Type<IMPL>>;
|
|
11
|
-
};
|
|
12
|
-
export declare function TokenizedType(): <T extends Type<any>>(type: T) => void;
|
|
13
|
-
export declare function getToken(type: Type<any>): any;
|
|
14
|
-
export declare enum HostType {
|
|
15
|
-
Dir = "\u0275dir",
|
|
16
|
-
Cmp = "\u0275cmp"
|
|
17
|
-
}
|
|
18
|
-
type IO = {
|
|
19
|
-
propName: string;
|
|
20
|
-
templateName: string;
|
|
21
|
-
};
|
|
22
|
-
export declare function getMeta<T>(type: Type<T>): unknown;
|
|
23
|
-
export declare function getInputs<T>(type: Type<T>): IO[];
|
|
24
|
-
export declare function getOutputs<T>(type: Type<T>): IO[];
|
|
25
|
-
export declare function getInputsByComponentRef<T extends {} = any>(cmp: ComponentRef<T>): IO[];
|
|
26
|
-
export declare function getOutputsByInstance<T extends {} = any>(cmp: ComponentRef<T>): IO[];
|
|
27
|
-
export declare class InjectableComponent<T = any> implements OnInit, OnChanges {
|
|
28
|
-
#private;
|
|
29
|
-
readonly injectable: import("@angular/core").InputSignalWithTransform<any, any>;
|
|
30
|
-
readonly __action: EventEmitter<Action<any>>;
|
|
31
|
-
dispatch(action: Action): void;
|
|
32
|
-
get propNames(): string[];
|
|
33
|
-
proxyFakeComputedInputs(): void;
|
|
34
|
-
constructor();
|
|
35
|
-
ngOnInit(): void;
|
|
36
|
-
ngOnChanges(simpleChanges: SimpleChanges): void;
|
|
37
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<InjectableComponent<any>, never>;
|
|
38
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<InjectableComponent<any>, never, never, { "injectable": { "alias": "injectable"; "required": false; "isSignal": true; }; }, { "__action": "action"; }, never, never, true, never>;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
package/lib/input.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InputSignal } from '@angular/core';
|
|
2
|
-
type InputSignalType<T> = T extends InputSignal<infer U> ? U : never;
|
|
3
|
-
export declare function applyToInput<T, K extends keyof T>(instance: T, propName: K, value: InputSignalType<T[K]>): void;
|
|
4
|
-
export declare function updateInput<T, K extends keyof T>(instance: T, propName: K, updater: (value: InputSignalType<T[K]>) => InputSignalType<T[K]>): void;
|
|
5
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Injector } from "@angular/core";
|
|
2
|
-
import { Action } from "./action";
|
|
3
|
-
import { InjectableComponent } from "./injectable-component";
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
import * as i1 from "./debug/debug.directive";
|
|
6
|
-
export declare class NgAtomicComponent<T = any> extends InjectableComponent<T> {
|
|
7
|
-
#private;
|
|
8
|
-
__injector: Injector;
|
|
9
|
-
get selector(): any;
|
|
10
|
-
constructor();
|
|
11
|
-
dispatch(action: Action, scope?: string, componentId?: string | number | null): Promise<void>;
|
|
12
|
-
protected effect(action: Action, scope?: string): Promise<boolean>;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicComponent<any>, never>;
|
|
14
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgAtomicComponent<any>, never, never, {}, {}, never, never, true, [{ directive: typeof i1.DebugDirective; inputs: {}; outputs: {}; }]>;
|
|
15
|
-
}
|
package/lib/ng-atomic-debug.d.ts
DELETED
package/lib/route.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { LoadChildrenCallback, Route, Routes } from '@angular/router';
|
|
2
|
-
export declare function wrapLoadChildren(loadChildrenCallback: LoadChildrenCallback): Promise<Routes>;
|
|
3
|
-
export declare function recursiveWrapRoute(route: Route, ...wrappers: ((route: Route) => Route)[]): Route;
|
|
4
|
-
export declare function recursiveWrapRoutes(routes: Routes, ...wrappers: ((route: Route) => Route)[]): Routes;
|
package/lib/signals.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { CreateComputedOptions, Signal, computed, PipeTransform } from "@angular/core";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare function proxyFakeComputedInputValueFn(inputValueFn: any): any;
|
|
4
|
-
export declare function computeFake<T>(valueOrFakeComputed: T): T;
|
|
5
|
-
export declare function proxyFakeComputedInputs(target: any, inputs: string[]): void;
|
|
6
|
-
export declare const FAKE_COMPUTED: unique symbol;
|
|
7
|
-
export declare function compute(target: any, propName: string): void;
|
|
8
|
-
export declare function fakeComputed<T>(computation: () => T, options?: CreateComputedOptions<T>): T;
|
|
9
|
-
export declare function _computed<T>(computation: () => T, options?: CreateComputedOptions<T>): T;
|
|
10
|
-
export declare function isFakeComputed(_computed: any): _computed is ReturnType<typeof computed>;
|
|
11
|
-
export declare class CallPipe implements PipeTransform {
|
|
12
|
-
transform<T>(value: Signal<T> | T): T;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CallPipe, never>;
|
|
14
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<CallPipe, "call", true>;
|
|
15
|
-
}
|