@agnos-ui/angular-headless
Advanced tools
Comparing version 0.3.1 to 0.4.0-next.0
import type { Widget, WidgetFactory, WidgetProps } from '@agnos-ui/core/types'; | ||
import type { Partial2Levels, WidgetsConfigStore, WidgetsConfig as CoreWidgetsConfig } from '@agnos-ui/core/config'; | ||
import type { Partial2Levels, WidgetsConfigStore, WidgetsConfig } from '@agnos-ui/core/config'; | ||
import type { ReadableSignal } from '@amadeus-it-group/tansu'; | ||
import type { FactoryProvider } from '@angular/core'; | ||
import { InjectionToken } from '@angular/core'; | ||
import type { AdaptPropsSlots, AngularWidget } from './types'; | ||
import type { AngularWidget } from './types'; | ||
export * from '@agnos-ui/core/config'; | ||
export type WidgetsConfig = { | ||
[WidgetName in keyof CoreWidgetsConfig]: AdaptPropsSlots<CoreWidgetsConfig[WidgetName]>; | ||
}; | ||
type AdaptParentConfig<Config> = (config: Partial2Levels<Config>) => Partial2Levels<Config>; | ||
@@ -39,5 +36,5 @@ type InjectWidgetsConfig<Config> = (config?: Partial2Levels<Config>) => WidgetsConfigStore<Config>; | ||
}; | ||
export declare const widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<WidgetsConfig>>, provideWidgetsConfig: (adaptParentConfig?: AdaptParentConfig<WidgetsConfig> | undefined) => FactoryProvider, injectWidgetConfig: <N extends keyof CoreWidgetsConfig>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>, injectWidgetsConfig: InjectWidgetsConfig<WidgetsConfig>, callWidgetFactory: <W extends Widget<object, object, object, object, object>>({ factory, widgetName, defaultConfig, events, afterInit, }: { | ||
export declare const widgetsConfigInjectionToken: InjectionToken<WidgetsConfigStore<WidgetsConfig>>, provideWidgetsConfig: (adaptParentConfig?: AdaptParentConfig<WidgetsConfig> | undefined) => FactoryProvider, injectWidgetConfig: <N extends keyof WidgetsConfig>(widgetName: N) => ReadableSignal<Partial<WidgetsConfig[N]> | undefined>, injectWidgetsConfig: InjectWidgetsConfig<WidgetsConfig>, callWidgetFactory: <W extends Widget<object, object, object, object, object>>({ factory, widgetName, defaultConfig, events, afterInit, }: { | ||
factory: WidgetFactory<W>; | ||
widgetName?: keyof CoreWidgetsConfig | null | undefined; | ||
widgetName?: keyof WidgetsConfig | null | undefined; | ||
defaultConfig?: Partial<WidgetProps<W>> | ReadableSignal<Partial<WidgetProps<W>> | undefined> | undefined; | ||
@@ -44,0 +41,0 @@ events?: Pick<WidgetProps<W>, keyof WidgetProps<W> & `on${string}`> | undefined; |
@@ -23,3 +23,12 @@ export * from './services/siblingsInert'; | ||
export * from './utils/coercion'; | ||
export * from './slotDefault.directive'; | ||
export * from './slot.directive'; | ||
export * from './content-as-slot.directive'; | ||
export * from './components/toast/index'; | ||
export * from './components/slider/index'; | ||
export * from './components/select/index'; | ||
export * from './components/rating/index'; | ||
export * from './components/progressbar/index'; | ||
export * from './components/pagination/index'; | ||
export * from './components/modal/index'; | ||
export * from './components/alert/index'; | ||
export * from './components/accordion/index'; |
@@ -1,10 +0,1 @@ | ||
export * from './components/accordion'; | ||
export * from './components/alert'; | ||
export * from './components/modal'; | ||
export * from './components/pagination'; | ||
export * from './components/progressbar'; | ||
export * from './components/rating'; | ||
export * from './components/select'; | ||
export * from './components/slider'; | ||
export * from './components/toast'; | ||
export * from './generated'; |
{ | ||
"name": "@agnos-ui/angular-headless", | ||
"description": "Headless widget library for Angular.", | ||
"version": "0.3.1", | ||
"version": "0.4.0-next.0", | ||
"type": "module", | ||
@@ -15,9 +15,9 @@ "exports": { | ||
"peerDependencies": { | ||
"@amadeus-it-group/tansu": "*", | ||
"@angular/common": "*", | ||
"@angular/core": "*" | ||
"@amadeus-it-group/tansu": "^1.0.0", | ||
"@angular/common": "^18.0.4", | ||
"@angular/core": "^18.0.4" | ||
}, | ||
"dependencies": { | ||
"@agnos-ui/core": "0.3.1", | ||
"tslib": "^2.6.2" | ||
"@agnos-ui/core": "0.4.0-next.0", | ||
"tslib": "^2.6.3" | ||
}, | ||
@@ -24,0 +24,0 @@ "sideEffects": false, |
@@ -15,3 +15,3 @@ import type { OnChanges, OnDestroy, SimpleChanges } from '@angular/core'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<SlotDirective<any>, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<SlotDirective<any>, "[auSlot]", never, { "slot": { "alias": "auSlot"; "required": false; }; "props": { "alias": "auSlotProps"; "required": false; }; }, {}, never, never, true, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<SlotDirective<any>, "[auSlot]", never, { "slot": { "alias": "auSlot"; "required": false; }; "props": { "alias": "auSlotProps"; "required": true; }; }, {}, never, never, true, never>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { ContextWidget, SlotContent as CoreSlotContent, Widget, WidgetFactory, WidgetProps, WidgetSlotContext, WidgetState } from '@agnos-ui/core/types'; | ||
import type { ContextWidget, SlotContent as CoreSlotContent, Widget, WidgetProps, WidgetState, Extends } from '@agnos-ui/core/types'; | ||
import type { Signal, TemplateRef, Type } from '@angular/core'; | ||
@@ -13,10 +13,2 @@ import * as i0 from "@angular/core"; | ||
export type SlotContent<Props extends object = object> = CoreSlotContent<Props> | TemplateRef<Props> | Type<unknown> | ComponentTemplate<Props, any, any>; | ||
export type AdaptSlotContentProps<Props extends Record<string, any>> = Props extends WidgetSlotContext<infer U> ? WidgetSlotContext<AdaptWidgetSlots<U>> & AdaptPropsSlots<Omit<Props, keyof WidgetSlotContext<any>>> : AdaptPropsSlots<Props>; | ||
export type AdaptPropsSlots<Props> = Omit<Props, `slot${string}`> & { | ||
[K in keyof Props & `slot${string}`]: Props[K] extends CoreSlotContent<infer U> ? SlotContent<AdaptSlotContentProps<U>> : Props[K]; | ||
}; | ||
export type AdaptWidgetFactories<T> = { | ||
[K in keyof T]: T[K] extends WidgetFactory<infer U> ? WidgetFactory<AdaptWidgetSlots<U>> : T[K]; | ||
}; | ||
export type AdaptWidgetSlots<W extends Widget> = Widget<AdaptPropsSlots<WidgetProps<W>>, AdaptPropsSlots<WidgetState<W>>, AdaptWidgetFactories<W['api']>, W['actions'], W['directives']>; | ||
export declare abstract class SlotComponent<W extends Widget> { | ||
@@ -28,2 +20,3 @@ state: WidgetState<W>; | ||
} | ||
export type IsSlotContent<T> = Extends<T, SlotContent<any>> | Extends<SlotContent<any>, T> extends 1 ? T : 0; | ||
export type AngularWidget<W extends Widget> = W & { | ||
@@ -35,4 +28,4 @@ initialized: Promise<void>; | ||
patchSlots(slots: { | ||
[K in keyof WidgetProps<W> & `slot${string}`]: WidgetProps<W>[K] extends SlotContent<infer U> ? TemplateRef<U> | undefined : never; | ||
[K in keyof WidgetProps<W> as IsSlotContent<WidgetProps<W>[K]> extends 0 ? never : K]: WidgetProps<W>[K] extends SlotContent<infer U> ? TemplateRef<U> | undefined : never; | ||
}): void; | ||
}; |
@@ -29,3 +29,3 @@ import type { Directive as AgnosUIDirective, DirectiveAndParam, DirectivesAndOptParam } from '@agnos-ui/core/types'; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<UseMultiDirective<any>, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<UseMultiDirective<any>, "[auUseMulti]", never, { "useMulti": { "alias": "auUseMulti"; "required": false; }; }, {}, never, never, true, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<UseMultiDirective<any>, "[auUseMulti]", never, { "useMulti": { "alias": "auUseMulti"; "required": true; }; }, {}, never, never, true, never>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
207297
93
1816
+ Added@agnos-ui/core@0.4.0-next.0(transitive)
+ Added@amadeus-it-group/tansu@1.0.0(transitive)
+ Added@angular/common@18.2.13(transitive)
+ Added@angular/core@18.2.13(transitive)
+ Addedzone.js@0.14.10(transitive)
- Removed@agnos-ui/core@0.3.1(transitive)
- Removed@amadeus-it-group/tansu@2.0.0(transitive)
- Removed@angular/common@19.1.4(transitive)
- Removed@angular/core@19.1.4(transitive)
- Removedzone.js@0.15.0(transitive)
Updated@agnos-ui/core@0.4.0-next.0
Updatedtslib@^2.6.3