@motifx/core 1.1.0 → 1.2.0-rc.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.
package/dist/index.d.cts CHANGED
@@ -1,3 +1,4 @@
1
+ import { MotifDomEventProps } from './jsx-runtime.cjs';
1
2
  export { AnyFunctionalComponent, JSX, MotifBaseProps, MotifBindable, MotifClass, MotifComponentConstructor, MotifComponentType, MotifFunctionalComponent, MotifFunctionalComponentBasic, MotifStyle, MotifValue, __attr } from './jsx-runtime.cjs';
2
3
 
3
4
  interface IDisposable {
@@ -290,7 +291,7 @@ declare class ComponentMotif<TSelf extends ComponentBase = ComponentBase, TProps
290
291
  stopAnimations(): Promise<void>;
291
292
  }
292
293
 
293
- type IBaseProp<T extends any> = OptionalParams<T> & {
294
+ type IBaseProp<T extends any> = OptionalParams<T> & MotifDomEventProps & {
294
295
  childs?: any[];
295
296
  options?: any;
296
297
  onElementCreating?(): any;
@@ -395,7 +396,10 @@ declare abstract class ComponentBase<TElement extends ElementType = any, TProps
395
396
  set siblings(value: SiblingsApi);
396
397
  private _createSiblingsApi;
397
398
  get serviceProvider(): ServiceProvider | null;
398
- getService<T = any>(token: any): T | null;
399
+ getService<T>(token: (abstract new (...args: any) => T) | {
400
+ prototype: T;
401
+ }): T | null;
402
+ getService<T = any>(token: string | symbol | object): T | null;
399
403
  $(selector: string): {
400
404
  fromDom: () => any;
401
405
  fromComponent: () => ComponentBase<any, any>[];
@@ -821,9 +825,11 @@ declare const motifMessages: {
821
825
  MJX121: (compiled: number, runtime: number) => string;
822
826
  MJX122: (hook: string) => string;
823
827
  MJX123: (event: string) => string;
824
- MJX124: () => string;
828
+ MJX124: (key: string) => string;
825
829
  MJX125: (key: string) => string;
826
830
  MJX126: () => string;
831
+ MJX127: (got: string) => string;
832
+ MJX128: (cls: string, member: string, how: "method" | "field" | "replaced") => string;
827
833
  MJX201: () => string;
828
834
  MJX202: (key: unknown, index: number) => string;
829
835
  MJX203: (max: number) => string;
@@ -1002,7 +1008,9 @@ declare function createSignal<T>(initialValue: T): Signal<T>;
1002
1008
  declare function createComputed<T>(getter: () => T): Computed<T>;
1003
1009
  declare function createLazyComputed<T>(getter: () => T): LazyComputed<T>;
1004
1010
 
1005
- declare function inject<T>(token: abstract new (...args: any[]) => T): T;
1011
+ declare function inject<T>(token: (abstract new (...args: any) => T) | {
1012
+ prototype: T;
1013
+ }): T;
1006
1014
  declare function inject<T = any>(token: string | symbol | object): T;
1007
1015
  declare class ServiceProvider {
1008
1016
  private services;
@@ -1022,8 +1030,14 @@ declare class ServiceProvider {
1022
1030
  constructor(services: ServiceCollection, parent?: ServiceProvider, root?: ServiceProvider);
1023
1031
  createScope(name?: string): ServiceProvider;
1024
1032
  enableAutoDisposeTransients(enable?: boolean): this;
1025
- get<T = any>(token: any): T;
1026
- getAsync<T = any>(token: any): Promise<T>;
1033
+ get<T>(token: (abstract new (...args: any) => T) | {
1034
+ prototype: T;
1035
+ }): T;
1036
+ get<T = any>(token: string | symbol | object): T;
1037
+ getAsync<T>(token: (abstract new (...args: any) => T) | {
1038
+ prototype: T;
1039
+ }): Promise<T>;
1040
+ getAsync<T = any>(token: string | symbol | object): Promise<T>;
1027
1041
  getAllServices(): ServiceCollection;
1028
1042
  private _releaseIfUnused;
1029
1043
  private _scopeFor;
@@ -1319,6 +1333,7 @@ declare class RouterLink extends Component<any, RouterLinkOptions> {
1319
1333
  onBuilt(sender: ComponentBase, e: EventArgs): void;
1320
1334
  }
1321
1335
 
1336
+ type ApplicationState = 'initializing' | 'running' | 'disposing' | 'disposed';
1322
1337
  declare class ApplicationBuilder {
1323
1338
  services: ServiceCollection;
1324
1339
  constructor();
@@ -1356,6 +1371,9 @@ declare class Application {
1356
1371
  provider: ServiceProvider;
1357
1372
  static get main(): Application;
1358
1373
  constructor(provider: ServiceProvider);
1374
+ private _state;
1375
+ private _disposing?;
1376
+ get state(): ApplicationState;
1359
1377
  private _middlewares;
1360
1378
  private _beforeEachGuards;
1361
1379
  readonly router: Router;
@@ -1369,7 +1387,7 @@ declare class Application {
1369
1387
  attach(component: Component): void;
1370
1388
  detach(component: Component): void;
1371
1389
  appendToMainHost(component: Node): void;
1372
- dispose(): void;
1390
+ dispose(): Promise<void>;
1373
1391
  useTransitions(options: {
1374
1392
  mode?: TransitionMode;
1375
1393
  }): Application;
@@ -1428,7 +1446,10 @@ declare function Injectable(options?: {
1428
1446
  lifetime?: ServiceLifetime;
1429
1447
  deps?: any[];
1430
1448
  }): (target: any, context?: ClassDecoratorContext) => void;
1431
- declare function FromService<T = any>(token: any): T;
1449
+ declare function FromService<T>(token: (abstract new (...args: any) => T) | {
1450
+ prototype: T;
1451
+ }): T;
1452
+ declare function FromService<T = any>(token: string | symbol | object): T;
1432
1453
 
1433
1454
  type AsyncOrSync<T> = Promise<T> | T;
1434
1455
  interface ResilienceContext {
@@ -1487,4 +1508,4 @@ declare class Resilience implements ResiliencePolicy {
1487
1508
  }
1488
1509
 
1489
1510
  export { Application, ApplicationBuilder, Component, ComponentBase, ComponentMotif, Computed, ContentBlock, ContentBody, ControlCollection, Dictionary, Disposable, DisposableStore, Emitter, ErrorHandler, FNComponent, FragmentNode, Frame, FromService, Injectable, Lazy, LazyComputed, LinkedList, List, MotifError, NameValuePair, NodeTypes, Query, Resilience, RouterLink, RouterView, ServiceCollection, ServiceProvider, Signal, Transport, TransportTo, Transporter, Virtualization, asyncTracking, clearModel, configureReactivityLeakMonitor, createComputed, createLazyComputed, createSignal, decorate, deepClone, disposableCore, dom, effect, errorHandler, inject, motifCompiled, motifComponent, motifFragment, preProcessing, reactive, read, safeCall, safeCallAsync, safeCallSilent, setUnexpectedErrorHandler, toDisposable, toGetter, untracked, useApplication, useModel, useNavigation };
1490
- export type { AnyEvents, AppLifecycleEventArgs, AppLifecycleState, AsyncTrackingToken, Bind, BulkheadOptions, CSSTransitionInfo, CircuitBreakerOptions, CircuitState, ComponentBaseOptions, CustomParameters, EffectFn, ElementType, Event$1 as Event, EventArgs, FallbackOptions, Group, HtmlElementEvents, IAttribute, IBaseProp, IClass, IDisposable, IDisposableTracker, IDisposeOptions, IElement, IHtmlElement, IsOptional, LazyOptions, LazyRetryOptions, MotifErrorCode, NavigationDirection, NavigationGuard, NavigationGuardContext, NavigationOptions, OptionalParams, RateLimiterOptions, ReadonlySignal, RedirectTarget, ResilienceAction, ResilienceContext, ResiliencePolicy, ResolveResult, RetryOptions, RouteControl, RouteInfo, RouteItem, RouteItemBase, RouteRedirect, RouteResolveContext, Router, RouterClassingSettings, RouterEvents, RouterNavigatedEventArgs, RouterOptions, RouterValidateEventArgs, RouterViewProps, ScrollMemoryOptions, ServiceDescriptor, ServiceLifetime, StackEntryInfo, StackOptions, StackSwipeBackOptions, StackTransitionContext, TimeoutOptions, TransitionMode, TransitionProps, TransportOptions, VirtualizationDataRequest, VirtualizationDataResponse, VirtualizationProps, VirtualizationState };
1511
+ export type { AnyEvents, AppLifecycleEventArgs, AppLifecycleState, ApplicationState, AsyncTrackingToken, Bind, BulkheadOptions, CSSTransitionInfo, CircuitBreakerOptions, CircuitState, ComponentBaseOptions, CustomParameters, EffectFn, ElementType, Event$1 as Event, EventArgs, FallbackOptions, Group, HtmlElementEvents, IAttribute, IBaseProp, IClass, IDisposable, IDisposableTracker, IDisposeOptions, IElement, IHtmlElement, IsOptional, LazyOptions, LazyRetryOptions, MotifErrorCode, NavigationDirection, NavigationGuard, NavigationGuardContext, NavigationOptions, OptionalParams, RateLimiterOptions, ReadonlySignal, RedirectTarget, ResilienceAction, ResilienceContext, ResiliencePolicy, ResolveResult, RetryOptions, RouteControl, RouteInfo, RouteItem, RouteItemBase, RouteRedirect, RouteResolveContext, Router, RouterClassingSettings, RouterEvents, RouterNavigatedEventArgs, RouterOptions, RouterValidateEventArgs, RouterViewProps, ScrollMemoryOptions, ServiceDescriptor, ServiceLifetime, StackEntryInfo, StackOptions, StackSwipeBackOptions, StackTransitionContext, TimeoutOptions, TransitionMode, TransitionProps, TransportOptions, VirtualizationDataRequest, VirtualizationDataResponse, VirtualizationProps, VirtualizationState };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { MotifDomEventProps } from './jsx-runtime.js';
1
2
  export { AnyFunctionalComponent, JSX, MotifBaseProps, MotifBindable, MotifClass, MotifComponentConstructor, MotifComponentType, MotifFunctionalComponent, MotifFunctionalComponentBasic, MotifStyle, MotifValue, __attr } from './jsx-runtime.js';
2
3
 
3
4
  interface IDisposable {
@@ -290,7 +291,7 @@ declare class ComponentMotif<TSelf extends ComponentBase = ComponentBase, TProps
290
291
  stopAnimations(): Promise<void>;
291
292
  }
292
293
 
293
- type IBaseProp<T extends any> = OptionalParams<T> & {
294
+ type IBaseProp<T extends any> = OptionalParams<T> & MotifDomEventProps & {
294
295
  childs?: any[];
295
296
  options?: any;
296
297
  onElementCreating?(): any;
@@ -395,7 +396,10 @@ declare abstract class ComponentBase<TElement extends ElementType = any, TProps
395
396
  set siblings(value: SiblingsApi);
396
397
  private _createSiblingsApi;
397
398
  get serviceProvider(): ServiceProvider | null;
398
- getService<T = any>(token: any): T | null;
399
+ getService<T>(token: (abstract new (...args: any) => T) | {
400
+ prototype: T;
401
+ }): T | null;
402
+ getService<T = any>(token: string | symbol | object): T | null;
399
403
  $(selector: string): {
400
404
  fromDom: () => any;
401
405
  fromComponent: () => ComponentBase<any, any>[];
@@ -821,9 +825,11 @@ declare const motifMessages: {
821
825
  MJX121: (compiled: number, runtime: number) => string;
822
826
  MJX122: (hook: string) => string;
823
827
  MJX123: (event: string) => string;
824
- MJX124: () => string;
828
+ MJX124: (key: string) => string;
825
829
  MJX125: (key: string) => string;
826
830
  MJX126: () => string;
831
+ MJX127: (got: string) => string;
832
+ MJX128: (cls: string, member: string, how: "method" | "field" | "replaced") => string;
827
833
  MJX201: () => string;
828
834
  MJX202: (key: unknown, index: number) => string;
829
835
  MJX203: (max: number) => string;
@@ -1002,7 +1008,9 @@ declare function createSignal<T>(initialValue: T): Signal<T>;
1002
1008
  declare function createComputed<T>(getter: () => T): Computed<T>;
1003
1009
  declare function createLazyComputed<T>(getter: () => T): LazyComputed<T>;
1004
1010
 
1005
- declare function inject<T>(token: abstract new (...args: any[]) => T): T;
1011
+ declare function inject<T>(token: (abstract new (...args: any) => T) | {
1012
+ prototype: T;
1013
+ }): T;
1006
1014
  declare function inject<T = any>(token: string | symbol | object): T;
1007
1015
  declare class ServiceProvider {
1008
1016
  private services;
@@ -1022,8 +1030,14 @@ declare class ServiceProvider {
1022
1030
  constructor(services: ServiceCollection, parent?: ServiceProvider, root?: ServiceProvider);
1023
1031
  createScope(name?: string): ServiceProvider;
1024
1032
  enableAutoDisposeTransients(enable?: boolean): this;
1025
- get<T = any>(token: any): T;
1026
- getAsync<T = any>(token: any): Promise<T>;
1033
+ get<T>(token: (abstract new (...args: any) => T) | {
1034
+ prototype: T;
1035
+ }): T;
1036
+ get<T = any>(token: string | symbol | object): T;
1037
+ getAsync<T>(token: (abstract new (...args: any) => T) | {
1038
+ prototype: T;
1039
+ }): Promise<T>;
1040
+ getAsync<T = any>(token: string | symbol | object): Promise<T>;
1027
1041
  getAllServices(): ServiceCollection;
1028
1042
  private _releaseIfUnused;
1029
1043
  private _scopeFor;
@@ -1319,6 +1333,7 @@ declare class RouterLink extends Component<any, RouterLinkOptions> {
1319
1333
  onBuilt(sender: ComponentBase, e: EventArgs): void;
1320
1334
  }
1321
1335
 
1336
+ type ApplicationState = 'initializing' | 'running' | 'disposing' | 'disposed';
1322
1337
  declare class ApplicationBuilder {
1323
1338
  services: ServiceCollection;
1324
1339
  constructor();
@@ -1356,6 +1371,9 @@ declare class Application {
1356
1371
  provider: ServiceProvider;
1357
1372
  static get main(): Application;
1358
1373
  constructor(provider: ServiceProvider);
1374
+ private _state;
1375
+ private _disposing?;
1376
+ get state(): ApplicationState;
1359
1377
  private _middlewares;
1360
1378
  private _beforeEachGuards;
1361
1379
  readonly router: Router;
@@ -1369,7 +1387,7 @@ declare class Application {
1369
1387
  attach(component: Component): void;
1370
1388
  detach(component: Component): void;
1371
1389
  appendToMainHost(component: Node): void;
1372
- dispose(): void;
1390
+ dispose(): Promise<void>;
1373
1391
  useTransitions(options: {
1374
1392
  mode?: TransitionMode;
1375
1393
  }): Application;
@@ -1428,7 +1446,10 @@ declare function Injectable(options?: {
1428
1446
  lifetime?: ServiceLifetime;
1429
1447
  deps?: any[];
1430
1448
  }): (target: any, context?: ClassDecoratorContext) => void;
1431
- declare function FromService<T = any>(token: any): T;
1449
+ declare function FromService<T>(token: (abstract new (...args: any) => T) | {
1450
+ prototype: T;
1451
+ }): T;
1452
+ declare function FromService<T = any>(token: string | symbol | object): T;
1432
1453
 
1433
1454
  type AsyncOrSync<T> = Promise<T> | T;
1434
1455
  interface ResilienceContext {
@@ -1487,4 +1508,4 @@ declare class Resilience implements ResiliencePolicy {
1487
1508
  }
1488
1509
 
1489
1510
  export { Application, ApplicationBuilder, Component, ComponentBase, ComponentMotif, Computed, ContentBlock, ContentBody, ControlCollection, Dictionary, Disposable, DisposableStore, Emitter, ErrorHandler, FNComponent, FragmentNode, Frame, FromService, Injectable, Lazy, LazyComputed, LinkedList, List, MotifError, NameValuePair, NodeTypes, Query, Resilience, RouterLink, RouterView, ServiceCollection, ServiceProvider, Signal, Transport, TransportTo, Transporter, Virtualization, asyncTracking, clearModel, configureReactivityLeakMonitor, createComputed, createLazyComputed, createSignal, decorate, deepClone, disposableCore, dom, effect, errorHandler, inject, motifCompiled, motifComponent, motifFragment, preProcessing, reactive, read, safeCall, safeCallAsync, safeCallSilent, setUnexpectedErrorHandler, toDisposable, toGetter, untracked, useApplication, useModel, useNavigation };
1490
- export type { AnyEvents, AppLifecycleEventArgs, AppLifecycleState, AsyncTrackingToken, Bind, BulkheadOptions, CSSTransitionInfo, CircuitBreakerOptions, CircuitState, ComponentBaseOptions, CustomParameters, EffectFn, ElementType, Event$1 as Event, EventArgs, FallbackOptions, Group, HtmlElementEvents, IAttribute, IBaseProp, IClass, IDisposable, IDisposableTracker, IDisposeOptions, IElement, IHtmlElement, IsOptional, LazyOptions, LazyRetryOptions, MotifErrorCode, NavigationDirection, NavigationGuard, NavigationGuardContext, NavigationOptions, OptionalParams, RateLimiterOptions, ReadonlySignal, RedirectTarget, ResilienceAction, ResilienceContext, ResiliencePolicy, ResolveResult, RetryOptions, RouteControl, RouteInfo, RouteItem, RouteItemBase, RouteRedirect, RouteResolveContext, Router, RouterClassingSettings, RouterEvents, RouterNavigatedEventArgs, RouterOptions, RouterValidateEventArgs, RouterViewProps, ScrollMemoryOptions, ServiceDescriptor, ServiceLifetime, StackEntryInfo, StackOptions, StackSwipeBackOptions, StackTransitionContext, TimeoutOptions, TransitionMode, TransitionProps, TransportOptions, VirtualizationDataRequest, VirtualizationDataResponse, VirtualizationProps, VirtualizationState };
1511
+ export type { AnyEvents, AppLifecycleEventArgs, AppLifecycleState, ApplicationState, AsyncTrackingToken, Bind, BulkheadOptions, CSSTransitionInfo, CircuitBreakerOptions, CircuitState, ComponentBaseOptions, CustomParameters, EffectFn, ElementType, Event$1 as Event, EventArgs, FallbackOptions, Group, HtmlElementEvents, IAttribute, IBaseProp, IClass, IDisposable, IDisposableTracker, IDisposeOptions, IElement, IHtmlElement, IsOptional, LazyOptions, LazyRetryOptions, MotifErrorCode, NavigationDirection, NavigationGuard, NavigationGuardContext, NavigationOptions, OptionalParams, RateLimiterOptions, ReadonlySignal, RedirectTarget, ResilienceAction, ResilienceContext, ResiliencePolicy, ResolveResult, RetryOptions, RouteControl, RouteInfo, RouteItem, RouteItemBase, RouteRedirect, RouteResolveContext, Router, RouterClassingSettings, RouterEvents, RouterNavigatedEventArgs, RouterOptions, RouterValidateEventArgs, RouterViewProps, ScrollMemoryOptions, ServiceDescriptor, ServiceLifetime, StackEntryInfo, StackOptions, StackSwipeBackOptions, StackTransitionContext, TimeoutOptions, TransitionMode, TransitionProps, TransportOptions, VirtualizationDataRequest, VirtualizationDataResponse, VirtualizationProps, VirtualizationState };
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { m as motifError, C as Component, r as reportWarning, A as Application, c as contentBlocks, f as findAppendableComponent, u as untracked, e as effect, a as reportError, b as ComponentBase, n as notifyDeactivated, d as autoRegistry, M as MotifError, g as formatMotifMessage } from './chunks/core-BGdhUeHu.esm.js';
2
- export { h as ApplicationBuilder, k as ComponentMotif, l as Computed, p as ControlCollection, D as Disposable, x as DisposableStore, E as Emitter, B as ErrorHandler, F as FNComponent, G as FragmentNode, H as Frame, L as Lazy, J as LazyComputed, K as LinkedList, Q as NodeTypes, S as RouterView, W as ServiceCollection, X as ServiceProvider, Z as Signal, i as asyncTracking, j as clearModel, o as configureReactivityLeakMonitor, q as createComputed, s as createLazyComputed, t as createSignal, v as deepClone, w as disposableCore, y as dom, z as errorHandler, I as inject, N as motifCompiled, O as motifComponent, P as motifFragment, R as reactive, T as safeCall, U as safeCallAsync, V as safeCallSilent, Y as setUnexpectedErrorHandler, _ as toDisposable, $ as useApplication, a0 as useModel, a1 as useNavigation } from './chunks/core-BGdhUeHu.esm.js';
1
+ import { m as motifError, C as Component, r as reportWarning, A as Application, c as contentBlocks, f as findAppendableComponent, u as untracked, e as effect, a as reportError, b as ComponentBase, n as notifyDeactivated, d as autoRegistry, M as MotifError, g as formatMotifMessage } from './chunks/core-vVL0WG0n.esm.js';
2
+ export { h as ApplicationBuilder, k as ComponentMotif, l as Computed, p as ControlCollection, D as Disposable, x as DisposableStore, E as Emitter, B as ErrorHandler, F as FNComponent, G as FragmentNode, H as Frame, L as Lazy, J as LazyComputed, K as LinkedList, Q as NodeTypes, S as RouterView, W as ServiceCollection, X as ServiceProvider, Z as Signal, i as asyncTracking, j as clearModel, o as configureReactivityLeakMonitor, q as createComputed, s as createLazyComputed, t as createSignal, v as deepClone, w as disposableCore, y as dom, z as errorHandler, I as inject, N as motifCompiled, O as motifComponent, P as motifFragment, R as reactive, T as safeCall, U as safeCallAsync, V as safeCallSilent, Y as setUnexpectedErrorHandler, _ as toDisposable, $ as useApplication, a0 as useModel, a1 as useNavigation } from './chunks/core-vVL0WG0n.esm.js';
3
3
 
4
4
  class NameValuePair {
5
5
  Key;