@ng-atomic/core 16.2.0 → 16.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ng-atomic-core.mjs","sources":["../../../../../packages/@ng-atomic/core/src/lib/action-store.ts","../../../../../packages/@ng-atomic/core/src/lib/action.ts","../../../../../packages/@ng-atomic/core/src/lib/effect.ts","../../../../../packages/@ng-atomic/core/src/lib/injectable-component.ts","../../../../../packages/@ng-atomic/core/src/lib/component-store.ts","../../../../../packages/@ng-atomic/core/src/ng-atomic-core.ts"],"sourcesContent":["import { EventEmitter, Injectable } from \"@angular/core\";\nimport { Action } from \"./action\";\n\n@Injectable({providedIn: 'root'})\nexport class NgAtomicRootActionStore {\n readonly actions$ = new EventEmitter<Action>();\n\n constructor() {\n this.actions$.subscribe(action => this.log(action, 'root'));\n }\n\n dispatch(action: Action) {\n this.actions$.emit(action);\n }\n\n log(action: Action, scope: string = 'default') {\n console.debug(action, scope);\n }\n}\n","export interface Action<T = any> {\n id: string;\n payload?: T;\n name?: string;\n icon?: string;\n color?: string;\n disabled?: boolean;\n children?: Action<T>[],\n}\n\nexport type Actions = ((...args: any[]) => Action[]) | Action[];\n\nexport function resolveActions(actions: Actions, ...args: any[]) {\n if (typeof actions === 'function') {\n return actions(...args);\n }\n return actions;\n}\n","import { Action } from \"./action\";\n\nexport interface EffectProps {\n dispatch: boolean;\n scope: string;\n accessor: <T = any>(action: Action) => T;\n}\n\nexport class EffectMap extends Map<string, {key: string, props: EffectProps}> {\n override get(key: string, scope = 'default'): { key: string; props: EffectProps; } {\n return super.get(this.makeKey(key, scope))!; \n }\n\n override set(key: string, value: { key: string; props: EffectProps; }): this {\n return super.set(this.makeKey(key, value.props.scope), value);\n }\n\n override has(key: string, scope = 'default'): boolean {\n return super.has(this.makeKey(key, scope));\n }\n\n private makeKey(key: string, scope = 'default') {\n return `[${scope}]#${key}`;\n }\n}\n\nexport function Effect(id: string, {\n dispatch = false,\n scope = 'default',\n accessor = (action: Action) => action.payload,\n}: Partial<EffectProps> = {}) {\n return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {\n target['_effectMap'] ??= new EffectMap();\n target['_effectMap'].set(id, {key: propertyKey, props: {dispatch, scope, accessor}});\n };\n}\n","import { ComponentMirror, ComponentRef, DestroyRef, Directive, ElementRef, EmbeddedViewRef, EventEmitter, Injector, Input, Output, SimpleChange, SimpleChanges, Type, ViewContainerRef, inject } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { reflectComponentType } from \"@angular/core\";\nimport { Action } from \"./action\";\nimport { NgAtomicComponentStore } from \"./component-store\";\n\nexport type TypeFactoryAsync<T> = () => Promise<Type<T>>;\n\nexport type TypeFactory<T> = () => (Type<T> | Promise<Type<T>>);\n\nexport function provideComponent<ABS = any, IMPL = any>(\n abstract: Type<ABS>,\n typeOrFactory: Type<IMPL> | TypeFactory<IMPL>,\n) {\n async function loadComponentType(): Promise<Type<IMPL>> {\n if (typeof typeOrFactory === 'function' && !typeOrFactory.prototype) {\n return await (typeOrFactory as TypeFactory<IMPL>)();\n } else {\n return typeOrFactory as Type<IMPL>;\n }\n };\n return { provide: (abstract as any)['TOKEN'], useValue: loadComponentType };\n}\n\nexport enum HostType {\n Dir = 'ɵdir',\n Cmp = 'ɵcmp',\n}\n\ntype IO = {propName: string, templateName: string};\n\nexport function getMeta<T>(type: Type<T>) {\n return (type as any)[HostType.Cmp] || (type as any)[HostType.Dir];\n}\n\nexport function getInputs<T>(type: Type<T>): IO[] {\n return Object.entries<string>(getMeta(type)['inputs'])\n .map(([propName, templateName]) => ({propName, templateName}));\n}\n\nexport function getOutputs<T>(type: Type<T>): IO[] {\n return Object.entries<string>(getMeta(type)['outputs'])\n .map(([propName, templateName]) => ({propName, templateName}));\n}\n\nexport function getInputsByComponentRef<T extends {} = any>(cmp: ComponentRef<T>): IO[] {\n return getInputs(cmp.instance.constructor as Type<T>);\n}\n\nexport function getOutputsByInstance<T extends {} = any>(cmp: ComponentRef<T>): IO[] {\n return getOutputs(cmp.instance.constructor as Type<T>);\n}\n\n@Directive({ standalone: true })\nexport abstract class InjectableComponent<T extends NgAtomicComponentStore = any> {\n readonly #outlet = inject(ViewContainerRef);\n readonly #injector = inject(Injector);\n readonly #destroy$ = inject(DestroyRef);\n readonly #el = inject(ElementRef);\n #component: ComponentRef<T> | null = null;\n #componentMirror: ComponentMirror<T> | null = null;\n\n #setAttribute() {\n const hostElement = (this.#component!.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement;\n const attributes: NamedNodeMap = this.#el.nativeElement.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i)!;\n if (attr.name.startsWith('_ngcontent')) {\n hostElement.setAttribute(attr.name, attr.value);\n }\n }\n }\n\n #bindInputs() {\n // for (const input of this.#componentMirror!.inputs) {\n // if (input.propName === 'injectable') return;\n // this.#component!.setInput(input.propName, (this as any)[input.propName]);\n // }\n\n for (const input of getInputs(this.constructor as Type<T>)) {\n if (input.propName === 'injectable') return;\n this.#component!.setInput(input.propName, (this as any)[input.propName]);\n }\n }\n\n #bindOutputs() {\n // for (const output of this.#componentMirror!.outputs) {\n // (this.#component!.instance as any)[output.templateName].pipe(\n // takeUntilDestroyed(this.#destroy$)\n // ).subscribe((value: any) => (this as any)[output.templateName].emit(value));\n // }\n\n for (const output of getOutputs(this.constructor as Type<T>)) {\n (this.#component!.instance as any)[output.templateName]?.pipe(\n takeUntilDestroyed(this.#destroy$)\n ).subscribe((value: any) => {\n console.debug('output=>>', output.templateName, value);\n (this as any)[output.templateName].emit(value);\n });\n }\n }\n\n ngOnInit() {\n if (this.injectable) {\n this.#injector.get<TypeFactoryAsync<T>>((this.constructor as any)['TOKEN'])().then(type => {\n this.#component = this.#outlet.createComponent(type);\n this.#componentMirror = reflectComponentType(type);\n this.#bindInputs();\n this.#bindOutputs();\n this.#setAttribute();\n });\n }\n }\n\n ngOnChanges(simpleChanges: SimpleChanges) {\n if (this.injectable && this.#componentMirror) {\n // for (const input of this.#componentMirror.inputs) {\n // if (input.propName === 'injectable') return;\n // const change = simpleChanges[input.propName] as SimpleChange;\n // if (change) {\n // this.#component!.setInput(input.propName, change.currentValue);\n // }\n // }\n\n for (const input of getInputs(this.constructor as Type<T>)) {\n if (input.propName === 'injectable') return;\n const change = simpleChanges[input.propName] as SimpleChange;\n if (change) {\n this.#component!.setInput(input.propName, change.currentValue);\n }\n }\n }\n }\n\n @Input({transform: (value: any) => value === '' ? true : value})\n private injectable = false;\n\n @Output()\n protected action = new EventEmitter<Action>();\n}\n","import { DestroyRef, Directive, EventEmitter, inject } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { Action } from \"./action\";\nimport { InjectableComponent } from \"./injectable-component\";\nimport { EffectMap } from \"./effect\";\nimport { NgAtomicRootActionStore } from \"./action-store\";\n\n@Directive({ standalone: true })\nexport class NgAtomicComponentStore {\n readonly action = new EventEmitter<Action>();\n}\n\n@Directive({ standalone: true })\nexport class NgAtomicComponent extends InjectableComponent {\n // @ts-ignore\n protected _effectMap: EffectMap;\n protected root = inject(NgAtomicRootActionStore);\n #destroy$ = inject(DestroyRef);\n\n constructor() {\n super();\n this.root.actions$.pipe(\n takeUntilDestroyed(this.#destroy$),\n ).subscribe(action => this.#effect(action, 'root'));\n }\n\n dispatch(action: Action, scope = 'default') {\n this.root.log(action, scope);\n const effect = this.#effect(action, scope);\n if (scope === 'root' && (!effect?.props || effect?.props?.dispatch)) {\n this.root.actions$.emit(action);\n } else if (!effect?.props || effect?.props?.dispatch) {\n this.action.emit(action);\n }\n }\n\n #effect(action: Action, scope = 'default') {\n const effect = (this._effectMap ?? new EffectMap()).get(action.id, scope);\n if (effect?.key && effect?.props?.scope === scope) {\n (this as any)[effect?.key](effect.props.accessor(action));\n }\n return effect;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"m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ic-core.mjs","sources":["../../../../../packages/@ng-atomic/core/src/lib/action-store.ts","../../../../../packages/@ng-atomic/core/src/lib/action.ts","../../../../../packages/@ng-atomic/core/src/lib/effect.ts","../../../../../packages/@ng-atomic/core/src/lib/signals.ts","../../../../../packages/@ng-atomic/core/src/lib/injectable-component.ts","../../../../../packages/@ng-atomic/core/src/lib/ng-atomic-debug.ts","../../../../../packages/@ng-atomic/core/src/lib/debug/debug.directive.ts","../../../../../packages/@ng-atomic/core/src/lib/ng-atomic-component.ts","../../../../../packages/@ng-atomic/core/src/ng-atomic-core.ts"],"sourcesContent":["import { EventEmitter, Injectable } from \"@angular/core\";\nimport { Action } from \"./action\";\n\n@Injectable({providedIn: 'root'})\nexport class NgAtomicRootActionStore {\n readonly actions$ = new EventEmitter<Action>();\n\n constructor() {\n this.actions$.subscribe(action => this.log(action, 'root'));\n }\n\n dispatch(action: Action) {\n this.actions$.emit(action);\n }\n\n log(action: Action, scope: string = 'default') {\n console.debug(action, scope);\n }\n}\n","export interface Action<T = any> {\n id: string;\n payload?: T;\n name?: string;\n icon?: string;\n color?: string;\n disabled?: boolean;\n children?: Action<T>[],\n meta?: {componentId?: string | number | null} | any;\n}\n\nexport type ActionsFactory<T = any> = (...args: any[]) => Action<T>[];\n\nexport type Actions = ActionsFactory | Action[];\n\nexport function resolveActions(actions: Actions, ...args: any[]) {\n if (typeof actions === 'function') {\n return actions(...args);\n }\n return actions;\n}\n\nexport function wrapActions(actions: Actions): ActionsFactory {\n return typeof actions === 'function' ? actions : () => actions;\n}\n","import { Injectable, InjectionToken, Injector, Provider, inject, runInInjectionContext } from \"@angular/core\";\nimport { Action } from \"./action\";\n\nexport interface EffectProps {\n dispatch: boolean;\n scope: string;\n accessor: (action: Action) => any;\n}\n\nexport class EffectMap extends Map<string, {key: string, props: EffectProps}> {\n override get(key: string, scope = 'default'): { key: string; props: EffectProps; } {\n return super.get(this.makeKey(key, scope))!; \n }\n\n override set(key: string, value: { key: string; props: EffectProps; }): this {\n return super.set(this.makeKey(key, value.props.scope), value);\n }\n\n override has(key: string, scope = 'default'): boolean {\n return super.has(this.makeKey(key, scope));\n }\n\n private makeKey(key: string, scope = 'default') {\n return `[${scope}]#${key}`;\n }\n}\n\nexport function Effect(id: string, {\n dispatch = false,\n scope = 'default',\n accessor = (action: Action) => action.payload,\n}: Partial<EffectProps> = {}) {\n return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {\n target['_effectMap'] ??= new EffectMap();\n target['_effectMap'].set(id, {key: propertyKey, props: {dispatch, scope, accessor}});\n };\n}\n\nexport interface EffectFunctionOptions {\n dispatch?: boolean;\n}\n\nexport interface EffectContext {\n injector?: Injector;\n}\n\nexport type EffectFunction = (payload?: any, context?: EffectContext) => any | Promise<any>;\nexport type EffectFunctionFactory = (hostInjector?: Injector) => EffectFunction;\n\nexport interface EffectEntry {\n\tactionIds: string | string[];\n effectFactory?: EffectFunctionFactory;\n options?: EffectFunctionOptions;\n}\n\nexport const EFFECT_ENTRY = new InjectionToken<EffectEntry>('EFFECT_ENTRY');\n\nexport function provideEffect(\n ActionIds: string[] | string,\n _effectFactory: (injector: Injector) => EffectFunction,\n options: EffectFunctionOptions = {dispatch: false},\n): Provider {\n\treturn {\n\t\tprovide: EFFECT_ENTRY,\n\t\tuseFactory: (injector: Injector) => {\n const effectFactory = (hostInjector: Injector) => {\n return runInInjectionContext(hostInjector, () => _effectFactory(injector));\n };\n return { actionIds: ActionIds, effectFactory, options };\n },\n\t\tmulti: true,\n\t\tdeps: [Injector]\n\t};\n}\n\nexport function injectEffectEntries(): EffectEntry[] {\n\treturn inject<EffectEntry[]>(EFFECT_ENTRY, {optional: true}) ?? [];\n}\n\nfunction buildEffectEntryMap(injector: Injector, effectEntries: EffectEntry[]) {\n const effectEntryMap = new Map<string, {effect: EffectFunction, options: EffectFunctionOptions}>();\n\n for (const entry of effectEntries) {\n const ids = Array.isArray(entry.actionIds) ? entry.actionIds : [entry.actionIds];\n for (const id of ids) {\n const effect = () => entry.effectFactory(injector);\n effectEntryMap.set(id, { effect, options: entry.options });\n }\n }\n\n return effectEntryMap;\n}\n\n@Injectable()\nexport class EffectReducer {\n readonly injector = inject(Injector);\n\treadonly effectEntries = injectEffectEntries();\n readonly effectEntryMap = buildEffectEntryMap(this.injector, this.effectEntries);\n\n\tasync reduce(action: Action): Promise<EffectFunctionOptions> {\n const entry = this.effectEntryMap.get(action.id);\n if (entry) {\n await runInInjectionContext(this.injector, () => {\n return entry?.effect()(action.payload, {injector: this.injector});\n });\n return this.effectEntryMap.get(action.id)?.options ?? {dispatch: false};\n }\n return {dispatch: true};\n\t}\n}\n\nexport function injectEffectReducer() {\n const injector = inject(Injector);\n\tconst effectEntries = injectEffectEntries();\n const effectEntryMap = buildEffectEntryMap(injector, effectEntries);\n\n return async (action: Action) => {\n const entry = effectEntryMap.get(action.id);\n if (entry) {\n await runInInjectionContext(injector, () => {\n return entry?.effect()(action.payload, {injector: injector});\n });\n return effectEntryMap.get(action.id)?.options ?? {dispatch: false};\n }\n return {dispatch: true};\n\t}\n}\n","import { CreateComputedOptions, Pipe, Signal, computed, isSignal } from \"@angular/core\";\n\nfunction call<T>(valueOrSignal: Signal<T> | T): T {\n return isSignal(valueOrSignal) ? call(valueOrSignal()) : valueOrSignal;\n}\n\nexport function proxyFakeComputedInputValueFn(inputValueFn: any) {\n return new Proxy(inputValueFn, {\n apply: function (target, _, args) {\n return computeFake(target(...args));\n }\n });\n}\n\nexport function computeFake(valueOrFakeComputed: any) {\n return isFakeComputed(valueOrFakeComputed) ? valueOrFakeComputed() : valueOrFakeComputed;\n}\n\nexport function proxyFakeComputedInputs(target: any, inputs: string[]) {\n inputs.filter(input => isSignal(target[input])).forEach(input => {\n target[input] = proxyFakeComputedInputValueFn(target[input]);\n });\n}\n\nexport const FAKE_COMPUTED = /* @__PURE__ */ Symbol('FAKE_COMPUTED');\n\nexport function compute(target: any, propName: string) {\n let inputValueFn: any;\n Object.defineProperty(target, propName, {\n get() {\n return new Proxy(inputValueFn, {\n apply: function (target, _, args) {\n const valueOrSignal: any = target(...args);\n return isSignal(valueOrSignal) ? valueOrSignal() : valueOrSignal;\n }\n });\n },\n set(value) {\n inputValueFn = value;\n },\n });\n}\n\nexport function fakeComputed<T>(computation: () => T, options?: CreateComputedOptions<T>): T {\n const _computed = computed(computation, options) as never as T;\n _computed[FAKE_COMPUTED] = true;\n return _computed;\n}\n\nexport function _computed<T>(computation: () => T, options?: CreateComputedOptions<T>): T {\n return fakeComputed(computation, options);\n}\n\nexport function isFakeComputed(_computed: any): _computed is ReturnType<typeof computed> {\n return !!_computed?.[FAKE_COMPUTED];\n}\n\n@Pipe({ name: 'call', standalone: true, pure: true})\nexport class CallPipe {\n transform<T>(value: Signal<T> | T): T {\n return call(value);\n }\n}\n","import { ComponentMirror, ComponentRef, DestroyRef, Directive, ɵoutput, ElementRef, EmbeddedViewRef, InjectionToken, Injector, SimpleChange, SimpleChanges, Type, ViewContainerRef, inject, input, PLATFORM_ID } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { reflectComponentType } from \"@angular/core\";\nimport { Action } from \"./action\";\n\nexport type TypeFactoryAsync<T> = () => Promise<Type<T>>;\n\nexport type TypeFactory<T> = () => (Type<T> | Promise<Type<T>>);\nimport { proxyFakeComputedInputs } from \"./signals\";\nimport { isPlatformBrowser } from \"@angular/common\";\n\nexport const TOKEN = 'Δtkn';\n\nexport function provideComponent<ABS = any, IMPL = any>(\n abstract: Type<ABS>,\n typeOrFactory: Type<IMPL> | TypeFactory<IMPL>,\n) {\n async function loadComponentType(): Promise<Type<IMPL>> {\n if (typeof typeOrFactory === 'function' && !typeOrFactory.prototype) {\n return await (typeOrFactory as TypeFactory<IMPL>)();\n } else {\n return typeOrFactory as Type<IMPL>;\n }\n };\n return { provide: (abstract as any)[TOKEN], useValue: loadComponentType };\n}\n\nexport function TokenizedType() {\n return function <T extends Type<any>>(type: T) {\n (type as any)[TOKEN] = new InjectionToken<T>(type.name);\n };\n}\n\nexport function getToken(type: Type<any>) {\n return (type as any)[TOKEN];\n}\n\nexport enum HostType {\n Dir = 'ɵdir',\n Cmp = 'ɵcmp',\n}\n\ntype IO = {propName: string, templateName: string};\n\nexport function getMeta<T>(type: Type<T>) {\n return (type as any)[HostType.Cmp] || (type as any)[HostType.Dir];\n}\n\nexport function getInputs<T>(type: Type<T>): IO[] {\n return Object.entries<string>(getMeta(type)['inputs'])\n .map(([templateName, [propName]]) => ({propName, templateName}));\n}\n\nexport function getOutputs<T>(type: Type<T>): IO[] {\n const meta = getMeta(type);\n return Object.entries<string>(meta['outputs'])\n .map(([templateName, propName]) => ({propName, templateName}));\n}\n\nexport function getInputsByComponentRef<T extends {} = any>(cmp: ComponentRef<T>): IO[] {\n return getInputs(cmp.instance.constructor as Type<T>);\n}\n\nexport function getOutputsByInstance<T extends {} = any>(cmp: ComponentRef<T>): IO[] {\n return getOutputs(cmp.instance.constructor as Type<T>);\n}\n\n@Directive({\n standalone: true,\n // host: {ngSkipHydration: 'true'}\n})\nexport class InjectableComponent<T = any> {\n readonly #platformId = inject(PLATFORM_ID);\n readonly #viewContainerRef = inject(ViewContainerRef);\n readonly #injector = inject(Injector);\n readonly #destroyRef = inject(DestroyRef);\n readonly #el: ElementRef<HTMLElement> = inject(ElementRef);\n #component: ComponentRef<T> | null = null;\n #componentMirror: ComponentMirror<T> | null = null;\n\n readonly injectable = input(false, {transform: (value: any) => value === '' ? true : value, alias: 'injectable'});\n readonly __action = ɵoutput<Action>({alias: 'action'});\n\n dispatch(action: Action) {\n this.__action.emit(action);\n }\n\n get #inputs(): IO[] {\n const abs = getInputs(this.constructor as Type<T>);\n return abs;\n }\n\n get #outputs(): IO[] {\n const abs = getOutputs(this.constructor as Type<T>);\n return abs;\n // const impl = this.#componentMirror!.outputs;\n // return abs.filter(abstractOutput => impl.some(implOutput => implOutput.templateName === abstractOutput.templateName));\n }\n\n #setAttribute() {\n const hostElement = (this.#component!.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement;\n const attributes: NamedNodeMap = this.#el.nativeElement.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i)!;\n if (attr.name === 'injectable') {\n hostElement.setAttribute('injected', '');\n } else {\n hostElement.setAttribute(attr.name, attr.value);\n }\n }\n }\n\n #bindInputs() {\n for (const input of this.#inputs) {\n if (input.propName === 'injectable') continue;\n const valueOrInputValueFn = this[input.propName];\n const value = typeof valueOrInputValueFn === 'function' ? valueOrInputValueFn() : valueOrInputValueFn;\n this.#component!.setInput(input.templateName, value);\n }\n }\n\n get propNames() {\n return this.#inputs.map(input => input.propName);\n }\n\n proxyFakeComputedInputs() {\n proxyFakeComputedInputs(this, this.propNames);\n }\n\n #bindOutputs() {\n for (const output of this.#outputs) {\n (this.#component!.instance as any)[output.propName]?.pipe(\n takeUntilDestroyed(this.#destroyRef)\n ).subscribe((value: any) => this[output.propName].emit(value));\n }\n }\n\n #bindEvents() {\n for (const name of ['click']) {\n this.#component.injector.get(ElementRef).nativeElement.addEventListener(name, (event) => {\n this.#el.nativeElement.dispatchEvent(new Event(name, {}));\n });\n }\n }\n \n constructor() {\n this.proxyFakeComputedInputs();\n }\n\n ngOnInit() {\n if (this.injectable() && isPlatformBrowser(this.#platformId)) {\n this.#injector.get<TypeFactoryAsync<T>>(getToken(this.constructor as any))().then(type => {\n this.#component = this.#viewContainerRef.createComponent(type, {\n projectableNodes: [\n Array.from(this.#el.nativeElement.childNodes)\n ],\n });\n this.#componentMirror = reflectComponentType(type);\n this.#bindInputs();\n this.#bindOutputs();\n this.#bindEvents();\n this.#setAttribute();\n // this.#viewContainerRef.remove(0);\n this.#component.changeDetectorRef.detectChanges();\n // this.#el.nativeElement.remove();\n });\n }\n this.proxyFakeComputedInputs();\n }\n\n ngOnChanges(simpleChanges: SimpleChanges) {\n if (this.injectable() && this.#componentMirror) {\n for (const input of this.#inputs) {\n if (input.propName === 'injectable') return;\n const change = simpleChanges[input.propName] as SimpleChange;\n if (change) {\n this.#component!.setInput(input.propName, change.currentValue);\n }\n }\n }\n }\n}\n","import { InjectionToken } from \"@angular/core\";\n\nexport const NG_ATOMIC_DEBUG = new InjectionToken<boolean>('NG_ATOMIC_DEBUG');\nexport function withNgAtomicDebug() {\n return {provide: NG_ATOMIC_DEBUG, useValue: true};\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Directive, ElementRef, PLATFORM_ID, inject } from '@angular/core';\nimport { NG_ATOMIC_DEBUG } from '../ng-atomic-debug';\n\nconst DEBUG_CONFIG = {\n outline: '1px',\n colors: {\n 'templates': '#f00',\n 'organisms': '#0f0',\n 'molecules': '#00f',\n 'atoms': '#ff0',\n 'frames': 'transparent',\n 'default': '#000',\n },\n excludes: ['frames', 'app', 'pages', 'atoms'],\n};\n\n@Directive({standalone: true, selector: 'debug'})\nexport class DebugDirective {\n protected el: ElementRef<HTMLElement> = inject(ElementRef);\n protected platformId = inject(PLATFORM_ID);\n protected isDebug = inject(NG_ATOMIC_DEBUG, {optional: true}) ?? false;\n\n ngOnInit() {\n if (isPlatformBrowser(this.platformId) && this.isDebug) {\n const name = this.el.nativeElement.tagName.toLowerCase();\n const type = name.split('-')[0];\n if (DEBUG_CONFIG.excludes.includes(type)) return;\n const color = DEBUG_CONFIG.colors?.[type] ?? DEBUG_CONFIG.colors.default;\n\n // 1pxのアウトラインを設定\n this.el.nativeElement.style.outline = `${DEBUG_CONFIG.outline} solid ${color}`;\n\n // 疑似要素でコンポーネント名を表示\n const labelEl = this.createLabelElement({\n name: `${name}${this.el.nativeElement.hasAttribute('injected') ? '[injected]' : ''}`,\n color\n });\n this.el.nativeElement.style.outlineOffset = '-1px';\n this.el.nativeElement.style.position = 'relative';\n this.el.nativeElement.appendChild(labelEl);\n }\n }\n\n protected createLabelElement(options: {\n name: string\n color: string\n }): HTMLElement {\n const content = document.createElement('span');\n content.textContent = options.name;\n content.style.backgroundColor = `${options.color}`;\n content.style.color = '#fff';\n content.style.padding = '2px 4px';\n content.style.position = 'absolute';\n content.style.fontSize = '10px';\n content.style.top = '0';\n content.style.left = '0';\n content.style.zIndex = '9999';\n content.style.lineHeight = '1.5em';\n content.style.whiteSpace = 'nowrap';\n return content;\n }\n}","import { DestroyRef, Directive, ElementRef, inject } from \"@angular/core\";\nimport { takeUntilDestroyed } from \"@angular/core/rxjs-interop\";\nimport { Action } from \"./action\";\nimport { InjectableComponent } from \"./injectable-component\";\nimport { EffectMap, injectEffectEntries, injectEffectReducer } from \"./effect\";\nimport { NgAtomicRootActionStore } from \"./action-store\";\nimport { DebugDirective } from './debug';\n\n@Directive({\n standalone: true,\n hostDirectives: [\n DebugDirective,\n ],\n})\nexport class NgAtomicComponent<T = any> extends InjectableComponent<T> {\n protected effectEntries = injectEffectEntries();\n protected reducer = injectEffectReducer();\n protected _effectMap: EffectMap;\n protected root = inject(NgAtomicRootActionStore);\n #destroyRef = inject(DestroyRef);\n #el = inject(ElementRef);\n\n constructor() {\n super();\n this.root.actions$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(action => {\n this.#effect(action, 'root');\n });\n }\n\n async dispatch(action: Action, scope = 'default', componentId: string | number | null = null) {\n const selector = this.#el.nativeElement.tagName.toLowerCase();\n const _action = {...action, meta: {componentId, selector}};\n\n const props = await this.reducer(_action);\n if (props?.dispatch === false) return;\n\n const effect = this.#effect(_action, scope);\n this.root.log(_action, scope);\n\n if (scope === 'root' && (!effect?.props || effect?.props?.dispatch)) {\n this.root.actions$.emit(_action);\n } else if (!effect?.props || effect?.props?.dispatch) {\n super.dispatch(_action);\n }\n }\n\n #effect(action: Action, scope = 'default') {\n const effect = (this._effectMap ?? new EffectMap()).get(action.id, scope);\n if (effect?.key && effect?.props?.scope === scope) {\n this[effect.key](effect.props.accessor(action));\n }\n return effect;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵoutput","i1.DebugDirective"],"mappings":";;;;;MAIa,uBAAuB,CAAA;AACzB,IAAA,QAAQ,GAAG,IAAI,YAAY,E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AAA,SAAA,EAAAC,cAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAN7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,cAAc,EAAE;wBACd,cAAc;AACf,qBAAA;AACF,iBAAA,CAAA;;;ACbD;;AAEG;;;;"}
package/lib/action.d.ts CHANGED
@@ -6,6 +6,11 @@ export interface Action<T = any> {
6
6
  color?: string;
7
7
  disabled?: boolean;
8
8
  children?: Action<T>[];
9
+ meta?: {
10
+ componentId?: string | number | null;
11
+ } | any;
9
12
  }
10
- export type Actions = ((...args: any[]) => Action[]) | Action[];
13
+ export type ActionsFactory<T = any> = (...args: any[]) => Action<T>[];
14
+ export type Actions = ActionsFactory | Action[];
11
15
  export declare function resolveActions(actions: Actions, ...args: any[]): Action<any>[];
16
+ export declare function wrapActions(actions: Actions): ActionsFactory;
@@ -0,0 +1,14 @@
1
+ import { ElementRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class DebugDirective {
4
+ protected el: ElementRef<HTMLElement>;
5
+ protected platformId: Object;
6
+ protected isDebug: boolean;
7
+ ngOnInit(): void;
8
+ protected createLabelElement(options: {
9
+ name: string;
10
+ color: string;
11
+ }): HTMLElement;
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<DebugDirective, never>;
13
+ static ɵdir: i0.ɵɵDirectiveDeclaration<DebugDirective, "debug", never, {}, {}, never, never, true, never>;
14
+ }
@@ -0,0 +1 @@
1
+ export * from './debug.directive';
package/lib/effect.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ import { InjectionToken, Injector, Provider } from "@angular/core";
1
2
  import { Action } from "./action";
3
+ import * as i0 from "@angular/core";
2
4
  export interface EffectProps {
3
5
  dispatch: boolean;
4
6
  scope: string;
5
- accessor: <T = any>(action: Action) => T;
7
+ accessor: (action: Action) => any;
6
8
  }
7
9
  export declare class EffectMap extends Map<string, {
8
10
  key: string;
@@ -20,3 +22,31 @@ export declare class EffectMap extends Map<string, {
20
22
  private makeKey;
21
23
  }
22
24
  export declare function Effect(id: string, { dispatch, scope, accessor, }?: Partial<EffectProps>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
25
+ export interface EffectFunctionOptions {
26
+ dispatch?: boolean;
27
+ }
28
+ export interface EffectContext {
29
+ injector?: Injector;
30
+ }
31
+ export type EffectFunction = (payload?: any, context?: EffectContext) => any | Promise<any>;
32
+ export type EffectFunctionFactory = (hostInjector?: Injector) => EffectFunction;
33
+ export interface EffectEntry {
34
+ actionIds: string | string[];
35
+ effectFactory?: EffectFunctionFactory;
36
+ options?: EffectFunctionOptions;
37
+ }
38
+ export declare const EFFECT_ENTRY: InjectionToken<EffectEntry>;
39
+ export declare function provideEffect(ActionIds: string[] | string, _effectFactory: (injector: Injector) => EffectFunction, options?: EffectFunctionOptions): Provider;
40
+ export declare function injectEffectEntries(): EffectEntry[];
41
+ export declare class EffectReducer {
42
+ readonly injector: Injector;
43
+ readonly effectEntries: EffectEntry[];
44
+ readonly effectEntryMap: Map<string, {
45
+ effect: EffectFunction;
46
+ options: EffectFunctionOptions;
47
+ }>;
48
+ reduce(action: Action): Promise<EffectFunctionOptions>;
49
+ static ɵfac: i0.ɵɵFactoryDeclaration<EffectReducer, never>;
50
+ static ɵprov: i0.ɵɵInjectableDeclaration<EffectReducer>;
51
+ }
52
+ export declare function injectEffectReducer(): (action: Action) => Promise<EffectFunctionOptions>;
package/lib/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export * from './action-store';
2
2
  export * from './action';
3
3
  export * from './effect';
4
- export * from './component-store';
5
4
  export * from './injectable-component';
5
+ export * from './ng-atomic-component';
6
+ export * from './signals';
7
+ export * from './debug';
8
+ export * from './ng-atomic-debug';
@@ -1,13 +1,15 @@
1
- import { ComponentRef, EventEmitter, SimpleChanges, Type } from "@angular/core";
1
+ import { ComponentRef, SimpleChanges, Type } from "@angular/core";
2
2
  import { Action } from "./action";
3
- import { NgAtomicComponentStore } from "./component-store";
4
3
  import * as i0 from "@angular/core";
5
4
  export type TypeFactoryAsync<T> = () => Promise<Type<T>>;
6
5
  export type TypeFactory<T> = () => (Type<T> | Promise<Type<T>>);
6
+ export declare const TOKEN = "\u0394tkn";
7
7
  export declare function provideComponent<ABS = any, IMPL = any>(abstract: Type<ABS>, typeOrFactory: Type<IMPL> | TypeFactory<IMPL>): {
8
8
  provide: any;
9
9
  useValue: () => Promise<Type<IMPL>>;
10
10
  };
11
+ export declare function TokenizedType(): <T extends Type<any>>(type: T) => void;
12
+ export declare function getToken(type: Type<any>): any;
11
13
  export declare enum HostType {
12
14
  Dir = "\u0275dir",
13
15
  Cmp = "\u0275cmp"
@@ -21,14 +23,17 @@ export declare function getInputs<T>(type: Type<T>): IO[];
21
23
  export declare function getOutputs<T>(type: Type<T>): IO[];
22
24
  export declare function getInputsByComponentRef<T extends {} = any>(cmp: ComponentRef<T>): IO[];
23
25
  export declare function getOutputsByInstance<T extends {} = any>(cmp: ComponentRef<T>): IO[];
24
- export declare abstract class InjectableComponent<T extends NgAtomicComponentStore = any> {
26
+ export declare class InjectableComponent<T = any> {
25
27
  #private;
28
+ readonly injectable: import("@angular/core").InputSignalWithTransform<any, any>;
29
+ readonly __action: import("@angular/core").ɵOutputEmitter<Action<any>>;
30
+ dispatch(action: Action): void;
31
+ get propNames(): string[];
32
+ proxyFakeComputedInputs(): void;
33
+ constructor();
26
34
  ngOnInit(): void;
27
35
  ngOnChanges(simpleChanges: SimpleChanges): void;
28
- private injectable;
29
- protected action: EventEmitter<Action<any>>;
30
36
  static ɵfac: i0.ɵɵFactoryDeclaration<InjectableComponent<any>, never>;
31
- static ɵdir: i0.ɵɵDirectiveDeclaration<InjectableComponent<any>, never, never, { "injectable": { "alias": "injectable"; "required": false; }; }, { "action": "action"; }, never, never, true, never>;
32
- static ngAcceptInputType_injectable: any;
37
+ static ɵdir: i0.ɵɵDirectiveDeclaration<InjectableComponent<any>, never, never, { "injectable": { "alias": "injectable"; "required": false; "isSignal": true; }; }, { "__action": "action"; }, never, never, true, never>;
33
38
  }
34
39
  export {};
@@ -0,0 +1,17 @@
1
+ import { Action } from "./action";
2
+ import { InjectableComponent } from "./injectable-component";
3
+ import { EffectMap } from "./effect";
4
+ import { NgAtomicRootActionStore } from "./action-store";
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "./debug/debug.directive";
7
+ export declare class NgAtomicComponent<T = any> extends InjectableComponent<T> {
8
+ #private;
9
+ protected effectEntries: import("./effect").EffectEntry[];
10
+ protected reducer: (action: Action<any>) => Promise<import("./effect").EffectFunctionOptions>;
11
+ protected _effectMap: EffectMap;
12
+ protected root: NgAtomicRootActionStore;
13
+ constructor();
14
+ dispatch(action: Action, scope?: string, componentId?: string | number | null): Promise<void>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicComponent<any>, never>;
16
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgAtomicComponent<any>, never, never, {}, {}, never, never, true, [{ directive: typeof i1.DebugDirective; inputs: {}; outputs: {}; }]>;
17
+ }
@@ -0,0 +1,6 @@
1
+ import { InjectionToken } from "@angular/core";
2
+ export declare const NG_ATOMIC_DEBUG: InjectionToken<boolean>;
3
+ export declare function withNgAtomicDebug(): {
4
+ provide: InjectionToken<boolean>;
5
+ useValue: boolean;
6
+ };
@@ -0,0 +1,15 @@
1
+ import { CreateComputedOptions, Signal, computed } from "@angular/core";
2
+ import * as i0 from "@angular/core";
3
+ export declare function proxyFakeComputedInputValueFn(inputValueFn: any): any;
4
+ export declare function computeFake(valueOrFakeComputed: any): any;
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 {
12
+ transform<T>(value: Signal<T> | T): T;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<CallPipe, never>;
14
+ static ɵpipe: i0.ɵɵPipeDeclaration<CallPipe, "call", true>;
15
+ }
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@ng-atomic/core",
3
- "version": "16.2.0",
3
+ "version": "16.3.1",
4
+ "homepage": "https://github.com/nontangent/machina/tree/main/packages/@ng-atomic/core",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/nontangent/machina.git"
8
+ },
4
9
  "peerDependencies": {
5
10
  "@angular/core": "^16.0.0"
6
11
  },
@@ -1,50 +0,0 @@
1
- import { DestroyRef, Directive, EventEmitter, inject } from "@angular/core";
2
- import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
3
- import { InjectableComponent } from "./injectable-component";
4
- import { EffectMap } from "./effect";
5
- import { NgAtomicRootActionStore } from "./action-store";
6
- import * as i0 from "@angular/core";
7
- export class NgAtomicComponentStore {
8
- constructor() {
9
- this.action = new EventEmitter();
10
- }
11
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgAtomicComponentStore, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
12
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: NgAtomicComponentStore, isStandalone: true, ngImport: i0 }); }
13
- }
14
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgAtomicComponentStore, decorators: [{
15
- type: Directive,
16
- args: [{ standalone: true }]
17
- }] });
18
- export class NgAtomicComponent extends InjectableComponent {
19
- #destroy$;
20
- constructor() {
21
- super();
22
- this.root = inject(NgAtomicRootActionStore);
23
- this.#destroy$ = inject(DestroyRef);
24
- this.root.actions$.pipe(takeUntilDestroyed(this.#destroy$)).subscribe(action => this.#effect(action, 'root'));
25
- }
26
- dispatch(action, scope = 'default') {
27
- this.root.log(action, scope);
28
- const effect = this.#effect(action, scope);
29
- if (scope === 'root' && (!effect?.props || effect?.props?.dispatch)) {
30
- this.root.actions$.emit(action);
31
- }
32
- else if (!effect?.props || effect?.props?.dispatch) {
33
- this.action.emit(action);
34
- }
35
- }
36
- #effect(action, scope = 'default') {
37
- const effect = (this._effectMap ?? new EffectMap()).get(action.id, scope);
38
- if (effect?.key && effect?.props?.scope === scope) {
39
- this[effect?.key](effect.props.accessor(action));
40
- }
41
- return effect;
42
- }
43
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgAtomicComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
44
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: NgAtomicComponent, isStandalone: true, usesInheritance: true, ngImport: i0 }); }
45
- }
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NgAtomicComponent, decorators: [{
47
- type: Directive,
48
- args: [{ standalone: true }]
49
- }], ctorParameters: function () { return []; } });
50
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LXN0b3JlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvQG5nLWF0b21pYy9jb3JlL3NyYy9saWIvY29tcG9uZW50LXN0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDNUUsT0FBTyxFQUFFLGtCQUFrQixFQUFFLE1BQU0s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MuI2Rlc3Ryb3kkKSxcbiAgICApLnN1YnNjcmliZShhY3Rpb24gPT4gdGhpcy4jZWZmZWN0KGFjdGlvbiwgJ3Jvb3QnKSk7XG4gIH1cblxuICBkaXNwYXRjaChhY3Rpb246IEFjdGlvbiwgc2NvcGUgPSAnZGVmYXVsdCcpIHtcbiAgICB0aGlzLnJvb3QubG9nKGFjdGlvbiwgc2NvcGUpO1xuICAgIGNvbnN0IGVmZmVjdCA9IHRoaXMuI2VmZmVjdChhY3Rpb24sIHNjb3BlKTtcbiAgICBpZiAoc2NvcGUgPT09ICdyb290JyAmJiAoIWVmZmVjdD8ucHJvcHMgfHwgZWZmZWN0Py5wcm9wcz8uZGlzcGF0Y2gpKSB7XG4gICAgICB0aGlzLnJvb3QuYWN0aW9ucyQuZW1pdChhY3Rpb24pO1xuICAgIH0gZWxzZSBpZiAoIWVmZmVjdD8ucHJvcHMgfHwgZWZmZWN0Py5wcm9wcz8uZGlzcGF0Y2gpIHtcbiAgICAgIHRoaXMuYWN0aW9uLmVtaXQoYWN0aW9uKTtcbiAgICB9XG4gIH1cblxuICAjZWZmZWN0KGFjdGlvbjogQWN0aW9uLCBzY29wZSA9ICdkZWZhdWx0Jykge1xuICAgIGNvbnN0IGVmZmVjdCA9ICh0aGlzLl9lZmZlY3RNYXAgPz8gbmV3IEVmZmVjdE1hcCgpKS5nZXQoYWN0aW9uLmlkLCBzY29wZSk7XG4gICAgaWYgKGVmZmVjdD8ua2V5ICYmIGVmZmVjdD8ucHJvcHM/LnNjb3BlID09PSBzY29wZSkge1xuICAgICAgKHRoaXMgYXMgYW55KVtlZmZlY3Q/LmtleV0oZWZmZWN0LnByb3BzLmFjY2Vzc29yKGFjdGlvbikpO1xuICAgIH1cbiAgICByZXR1cm4gZWZmZWN0O1xuICB9XG59XG4iXX0=
@@ -1,20 +0,0 @@
1
- import { EventEmitter } from "@angular/core";
2
- import { Action } from "./action";
3
- import { InjectableComponent } from "./injectable-component";
4
- import { EffectMap } from "./effect";
5
- import { NgAtomicRootActionStore } from "./action-store";
6
- import * as i0 from "@angular/core";
7
- export declare class NgAtomicComponentStore {
8
- readonly action: EventEmitter<Action<any>>;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicComponentStore, never>;
10
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgAtomicComponentStore, never, never, {}, {}, never, never, true, never>;
11
- }
12
- export declare class NgAtomicComponent extends InjectableComponent {
13
- #private;
14
- protected _effectMap: EffectMap;
15
- protected root: NgAtomicRootActionStore;
16
- constructor();
17
- dispatch(action: Action, scope?: string): void;
18
- static ɵfac: i0.ɵɵFactoryDeclaration<NgAtomicComponent, never>;
19
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgAtomicComponent, never, never, {}, {}, never, never, true, never>;
20
- }