@motifx/core 1.0.1 → 1.2.0-rc.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/dist/chunks/{core-DfzGo_Ti.cjs → core-SS-LXi1V.cjs} +3722 -1338
- package/dist/chunks/core-SS-LXi1V.cjs.map +1 -0
- package/dist/chunks/{core-DxINgP83.esm.js → core-vVL0WG0n.esm.js} +3527 -1173
- package/dist/chunks/core-vVL0WG0n.esm.js.map +1 -0
- package/dist/devtools.cjs +1 -1
- package/dist/devtools.cjs.map +1 -1
- package/dist/devtools.esm.js +1 -1
- package/dist/devtools.esm.js.map +1 -1
- package/dist/index.cjs +87 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -24
- package/dist/index.d.ts +55 -24
- package/dist/index.esm.js +42 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +1943 -1172
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/jsx-runtime.cjs.map +1 -1
- package/dist/jsx-runtime.d.cts +17 -3
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/core-BDvHkZLQ.esm.js +0 -1601
- package/dist/chunks/core-BDvHkZLQ.esm.js.map +0 -1
- package/dist/chunks/core-DXGu4dNE.cjs +0 -1642
- package/dist/chunks/core-DXGu4dNE.cjs.map +0 -1
- package/dist/chunks/core-DfzGo_Ti.cjs.map +0 -1
- package/dist/chunks/core-DxINgP83.esm.js.map +0 -1
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 {
|
|
@@ -159,6 +160,8 @@ interface TransitionProps {
|
|
|
159
160
|
leaveToClass?: string;
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
type TransitionMode = 'concurrent' | 'out-in' | 'in-out';
|
|
164
|
+
|
|
162
165
|
interface IHtmlElement extends HTMLElement {
|
|
163
166
|
}
|
|
164
167
|
interface IElement extends Node {
|
|
@@ -197,6 +200,7 @@ interface ComponentBaseOptions<TProps> {
|
|
|
197
200
|
out: CSSTransitionInfo;
|
|
198
201
|
};
|
|
199
202
|
name: string;
|
|
203
|
+
mode?: TransitionMode;
|
|
200
204
|
classes?: TransitionProps;
|
|
201
205
|
activeCssCancel: (() => void) | null;
|
|
202
206
|
activeCssPhase: 'enter' | 'leave' | null;
|
|
@@ -229,9 +233,11 @@ type HtmlElementEvents = {
|
|
|
229
233
|
type ElementTypes = Node | Element | HTMLElement | Text | DocumentFragment | Comment | HTMLDivElement;
|
|
230
234
|
declare class controlAttribute<ElementType extends ElementTypes> implements IAttribute<ComponentBase<ElementType, any>> {
|
|
231
235
|
private _parent;
|
|
232
|
-
private
|
|
233
|
-
private
|
|
236
|
+
private _attrMapStore?;
|
|
237
|
+
private _watchersStore?;
|
|
234
238
|
constructor(parent: ComponentBase<ElementType, any>);
|
|
239
|
+
private get _attrMap();
|
|
240
|
+
private get _watchers();
|
|
235
241
|
/** @deprecated Tek kaynak `_attrMap`; geriye dönük okuma için türetilmiş görünüm. */
|
|
236
242
|
get attributes(): {
|
|
237
243
|
name: string;
|
|
@@ -285,7 +291,7 @@ declare class ComponentMotif<TSelf extends ComponentBase = ComponentBase, TProps
|
|
|
285
291
|
stopAnimations(): Promise<void>;
|
|
286
292
|
}
|
|
287
293
|
|
|
288
|
-
type IBaseProp<T extends any> = OptionalParams<T> & {
|
|
294
|
+
type IBaseProp<T extends any> = OptionalParams<T> & MotifDomEventProps & {
|
|
289
295
|
childs?: any[];
|
|
290
296
|
options?: any;
|
|
291
297
|
onElementCreating?(): any;
|
|
@@ -311,6 +317,13 @@ interface IDisposeOptions {
|
|
|
311
317
|
deep?: boolean;
|
|
312
318
|
skipLeaveTransition?: boolean;
|
|
313
319
|
}
|
|
320
|
+
interface SiblingsApi {
|
|
321
|
+
all: () => ComponentBase[] | undefined;
|
|
322
|
+
next: () => ComponentBase | undefined;
|
|
323
|
+
prev: () => ComponentBase | undefined;
|
|
324
|
+
nextAll: () => any;
|
|
325
|
+
prevAll: () => any;
|
|
326
|
+
}
|
|
314
327
|
declare abstract class ComponentBase<TElement extends ElementType = any, TProps extends object = any> extends Disposable {
|
|
315
328
|
readonly motif: ComponentMotif<this, TProps>;
|
|
316
329
|
element: TElement;
|
|
@@ -375,18 +388,16 @@ declare abstract class ComponentBase<TElement extends ElementType = any, TProps
|
|
|
375
388
|
dispose(options?: IDisposeOptions): Promise<void>;
|
|
376
389
|
private _disposeCore;
|
|
377
390
|
disposeAsync(options?: IDisposeOptions): Promise<void>;
|
|
378
|
-
private _disposeAsyncCore;
|
|
379
391
|
using<T>(waitable: Promise<any>, onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => never | PromiseLike<never>) | undefined | null): void;
|
|
380
392
|
doWork<T>(waitable: Promise<T> | PromiseLike<T>): Promise<T>;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
prevAll: () => any;
|
|
387
|
-
};
|
|
393
|
+
private _siblingsApi?;
|
|
394
|
+
private _siblingsSet?;
|
|
395
|
+
get siblings(): SiblingsApi;
|
|
396
|
+
set siblings(value: SiblingsApi);
|
|
397
|
+
private _createSiblingsApi;
|
|
388
398
|
get serviceProvider(): ServiceProvider | null;
|
|
389
|
-
getService<T
|
|
399
|
+
getService<T>(token: abstract new (...args: any[]) => T): T | null;
|
|
400
|
+
getService<T = any>(token: string | symbol | object): T | null;
|
|
390
401
|
$(selector: string): {
|
|
391
402
|
fromDom: () => any;
|
|
392
403
|
fromComponent: () => ComponentBase<any, any>[];
|
|
@@ -439,7 +450,7 @@ declare class Frame extends Component {
|
|
|
439
450
|
current: ComponentBase | ComponentBase[] | null;
|
|
440
451
|
isBusy: boolean;
|
|
441
452
|
constructor(props?: any);
|
|
442
|
-
dispose(): Promise<void>;
|
|
453
|
+
dispose(options?: IDisposeOptions): Promise<void>;
|
|
443
454
|
flush(): Promise<void>;
|
|
444
455
|
previouspage: any;
|
|
445
456
|
navigate(page: ComponentBase | ComponentBase[], keepOldControl?: boolean): Promise<void>;
|
|
@@ -487,10 +498,12 @@ declare class TransportTo extends Component<any, {
|
|
|
487
498
|
private _slotRegisteredListener?;
|
|
488
499
|
private _slotUnregisteredListener?;
|
|
489
500
|
private _transported;
|
|
501
|
+
private _countedLive;
|
|
490
502
|
constructor(props: {
|
|
491
503
|
name: string;
|
|
492
504
|
});
|
|
493
505
|
private _handleSlotChange;
|
|
506
|
+
private _rememberTransported;
|
|
494
507
|
private _clearChildrenFromSlot;
|
|
495
508
|
initializeComponent(sender: ComponentBase): void;
|
|
496
509
|
onDisposing(sender: ComponentBase, e: EventArgs): void;
|
|
@@ -638,6 +651,7 @@ declare class ControlCollection {
|
|
|
638
651
|
add(...control: ComponentBase[]): ComponentBase[];
|
|
639
652
|
add(index?: number, ...control: ComponentBase[]): ComponentBase[];
|
|
640
653
|
insert(index?: number, ...controls: ComponentBase[]): ComponentBase[];
|
|
654
|
+
private _insertOne;
|
|
641
655
|
remove(control: ComponentBase): void;
|
|
642
656
|
detach(control: ComponentBase): Promise<void>;
|
|
643
657
|
silentDetach(control: ComponentBase, unlinkOnly?: boolean): void;
|
|
@@ -809,6 +823,11 @@ declare const motifMessages: {
|
|
|
809
823
|
MJX121: (compiled: number, runtime: number) => string;
|
|
810
824
|
MJX122: (hook: string) => string;
|
|
811
825
|
MJX123: (event: string) => string;
|
|
826
|
+
MJX124: (key: string) => string;
|
|
827
|
+
MJX125: (key: string) => string;
|
|
828
|
+
MJX126: () => string;
|
|
829
|
+
MJX127: (got: string) => string;
|
|
830
|
+
MJX128: (cls: string, member: string, how: "method" | "field" | "replaced") => string;
|
|
812
831
|
MJX201: () => string;
|
|
813
832
|
MJX202: (key: unknown, index: number) => string;
|
|
814
833
|
MJX203: (max: number) => string;
|
|
@@ -1007,8 +1026,10 @@ declare class ServiceProvider {
|
|
|
1007
1026
|
constructor(services: ServiceCollection, parent?: ServiceProvider, root?: ServiceProvider);
|
|
1008
1027
|
createScope(name?: string): ServiceProvider;
|
|
1009
1028
|
enableAutoDisposeTransients(enable?: boolean): this;
|
|
1010
|
-
get<T
|
|
1011
|
-
|
|
1029
|
+
get<T>(token: abstract new (...args: any[]) => T): T;
|
|
1030
|
+
get<T = any>(token: string | symbol | object): T;
|
|
1031
|
+
getAsync<T>(token: abstract new (...args: any[]) => T): Promise<T>;
|
|
1032
|
+
getAsync<T = any>(token: string | symbol | object): Promise<T>;
|
|
1012
1033
|
getAllServices(): ServiceCollection;
|
|
1013
1034
|
private _releaseIfUnused;
|
|
1014
1035
|
private _scopeFor;
|
|
@@ -1304,6 +1325,7 @@ declare class RouterLink extends Component<any, RouterLinkOptions> {
|
|
|
1304
1325
|
onBuilt(sender: ComponentBase, e: EventArgs): void;
|
|
1305
1326
|
}
|
|
1306
1327
|
|
|
1328
|
+
type ApplicationState = 'initializing' | 'running' | 'disposing' | 'disposed';
|
|
1307
1329
|
declare class ApplicationBuilder {
|
|
1308
1330
|
services: ServiceCollection;
|
|
1309
1331
|
constructor();
|
|
@@ -1341,6 +1363,9 @@ declare class Application {
|
|
|
1341
1363
|
provider: ServiceProvider;
|
|
1342
1364
|
static get main(): Application;
|
|
1343
1365
|
constructor(provider: ServiceProvider);
|
|
1366
|
+
private _state;
|
|
1367
|
+
private _disposing?;
|
|
1368
|
+
get state(): ApplicationState;
|
|
1344
1369
|
private _middlewares;
|
|
1345
1370
|
private _beforeEachGuards;
|
|
1346
1371
|
readonly router: Router;
|
|
@@ -1354,7 +1379,10 @@ declare class Application {
|
|
|
1354
1379
|
attach(component: Component): void;
|
|
1355
1380
|
detach(component: Component): void;
|
|
1356
1381
|
appendToMainHost(component: Node): void;
|
|
1357
|
-
dispose(): void
|
|
1382
|
+
dispose(): Promise<void>;
|
|
1383
|
+
useTransitions(options: {
|
|
1384
|
+
mode?: TransitionMode;
|
|
1385
|
+
}): Application;
|
|
1358
1386
|
use(callback: (ctx: RouteResolveContext, next: () => Promise<void>) => any): Application;
|
|
1359
1387
|
useGuard(guard: NavigationGuard): Application;
|
|
1360
1388
|
private urlRoutingModule;
|
|
@@ -1410,16 +1438,19 @@ declare function Injectable(options?: {
|
|
|
1410
1438
|
lifetime?: ServiceLifetime;
|
|
1411
1439
|
deps?: any[];
|
|
1412
1440
|
}): (target: any, context?: ClassDecoratorContext) => void;
|
|
1413
|
-
declare function FromService<T
|
|
1441
|
+
declare function FromService<T>(token: abstract new (...args: any[]) => T): T;
|
|
1442
|
+
declare function FromService<T = any>(token: string | symbol | object): T;
|
|
1414
1443
|
|
|
1415
1444
|
type AsyncOrSync<T> = Promise<T> | T;
|
|
1416
|
-
interface
|
|
1445
|
+
interface ResilienceContext {
|
|
1417
1446
|
[key: string]: any;
|
|
1418
1447
|
}
|
|
1419
|
-
type
|
|
1448
|
+
type Context = ResilienceContext;
|
|
1449
|
+
type ResilienceAction<T> = (ctx?: ResilienceContext) => AsyncOrSync<T>;
|
|
1450
|
+
type Action<T> = ResilienceAction<T>;
|
|
1420
1451
|
type ShouldHandlePredicate = (err: any) => boolean;
|
|
1421
|
-
|
|
1422
|
-
|
|
1452
|
+
interface ResiliencePolicy {
|
|
1453
|
+
execute<T>(action: ResilienceAction<T>, ctx?: ResilienceContext): Promise<T>;
|
|
1423
1454
|
}
|
|
1424
1455
|
interface RetryOptions {
|
|
1425
1456
|
retries?: number;
|
|
@@ -1453,8 +1484,8 @@ interface FallbackOptions<T> {
|
|
|
1453
1484
|
fallback: (err: any, ctx?: Context) => AsyncOrSync<T>;
|
|
1454
1485
|
shouldHandle?: ShouldHandlePredicate;
|
|
1455
1486
|
}
|
|
1456
|
-
declare function decorate<T>(policy:
|
|
1457
|
-
declare class Resilience {
|
|
1487
|
+
declare function decorate<T>(policy: ResiliencePolicy, fn: ResilienceAction<T>): (ctx?: ResilienceContext) => Promise<T>;
|
|
1488
|
+
declare class Resilience implements ResiliencePolicy {
|
|
1458
1489
|
static get create(): Resilience;
|
|
1459
1490
|
private resiliences;
|
|
1460
1491
|
retry: (opts?: RetryOptions) => Resilience;
|
|
@@ -1467,4 +1498,4 @@ declare class Resilience {
|
|
|
1467
1498
|
}
|
|
1468
1499
|
|
|
1469
1500
|
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 };
|
|
1470
|
-
export type { AnyEvents, AppLifecycleEventArgs, AppLifecycleState, AsyncTrackingToken, Bind, CSSTransitionInfo, ComponentBaseOptions, CustomParameters, EffectFn, ElementType, Event$1 as Event, EventArgs, Group, HtmlElementEvents, IAttribute, IBaseProp, IClass, IDisposable, IDisposableTracker, IDisposeOptions, IElement, IHtmlElement, IsOptional, LazyOptions, LazyRetryOptions, MotifErrorCode, NavigationDirection, NavigationGuard, NavigationGuardContext, NavigationOptions, OptionalParams, ReadonlySignal, RedirectTarget, ResolveResult, RouteControl, RouteInfo, RouteItem, RouteItemBase, RouteRedirect, RouteResolveContext, Router, RouterClassingSettings, RouterEvents, RouterNavigatedEventArgs, RouterOptions, RouterValidateEventArgs, RouterViewProps, ScrollMemoryOptions, ServiceDescriptor, ServiceLifetime, StackEntryInfo, StackOptions, StackSwipeBackOptions, StackTransitionContext, TransitionProps, TransportOptions, VirtualizationDataRequest, VirtualizationDataResponse, VirtualizationProps, VirtualizationState };
|
|
1501
|
+
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,7 +1,5 @@
|
|
|
1
|
-
import { C as Component, A as Application, f as findAppendableComponent, a as ComponentBase, n as notifyDeactivated,
|
|
2
|
-
export {
|
|
3
|
-
import { m as motifError, r as reportWarning, u as untracked, e as effect, a as reportError, M as MotifError, f as formatMotifMessage } from './chunks/core-BDvHkZLQ.esm.js';
|
|
4
|
-
export { C as Computed, E as ErrorHandler, L as LazyComputed, n as LinkedList, N as NodeTypes, S as Signal, b as asyncTracking, c as clearModel, d as configureReactivityLeakMonitor, g as createComputed, h as createLazyComputed, i as createSignal, j as deepClone, k as dom, l as errorHandler, o as reactive, s as safeCall, p as safeCallAsync, q as safeCallSilent, t as setUnexpectedErrorHandler, v as useModel } from './chunks/core-BDvHkZLQ.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';
|
|
5
3
|
|
|
6
4
|
class NameValuePair {
|
|
7
5
|
Key;
|
|
@@ -56,10 +54,11 @@ class List {
|
|
|
56
54
|
}
|
|
57
55
|
;
|
|
58
56
|
remove(item) {
|
|
57
|
+
const index = this.__list.indexOf(item);
|
|
58
|
+
if (index === -1)
|
|
59
|
+
return [];
|
|
59
60
|
this._map.delete(item);
|
|
60
|
-
this.__list.splice(
|
|
61
|
-
item = null;
|
|
62
|
-
return [];
|
|
61
|
+
return this.__list.splice(index, 1);
|
|
63
62
|
}
|
|
64
63
|
;
|
|
65
64
|
indexOf(item) {
|
|
@@ -86,7 +85,7 @@ class List {
|
|
|
86
85
|
this.__list?.forEach(callbackfn);
|
|
87
86
|
}
|
|
88
87
|
ReverseClone() {
|
|
89
|
-
return this.__list.reverse();
|
|
88
|
+
return this.__list.slice().reverse();
|
|
90
89
|
}
|
|
91
90
|
filter(callbackfn) {
|
|
92
91
|
return this.__list.filter(callbackfn);
|
|
@@ -113,8 +112,7 @@ class Dictionary {
|
|
|
113
112
|
}
|
|
114
113
|
OnItemAdded;
|
|
115
114
|
removeIndex(index) {
|
|
116
|
-
|
|
117
|
-
return i;
|
|
115
|
+
return this.__values.removeIndex(index);
|
|
118
116
|
}
|
|
119
117
|
;
|
|
120
118
|
remove(Key) {
|
|
@@ -244,20 +242,16 @@ class ContentBlock extends Component {
|
|
|
244
242
|
// } else {
|
|
245
243
|
// var cb = ContentBodyCollectionHandable.get(props.target);
|
|
246
244
|
// if (cb) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (cb) {
|
|
250
|
-
control.motif.options["ownerContentBlock"] = this;
|
|
251
|
-
cb.controls.add(control);
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
this.controls.onAddBeforeBuild = (control) => {
|
|
245
|
+
const forward = (control) => {
|
|
246
|
+
this.motif.trigger('controladded', { control });
|
|
255
247
|
var cb = ContentBodyCollectionHandable.get(this.props.target);
|
|
256
248
|
if (cb) {
|
|
257
249
|
control.motif.options["ownerContentBlock"] = this;
|
|
258
250
|
cb.controls.add(control);
|
|
259
251
|
}
|
|
260
252
|
};
|
|
253
|
+
this.controls.onAdd = forward;
|
|
254
|
+
this.controls.onAddBeforeBuild = forward;
|
|
261
255
|
if (this.childs) {
|
|
262
256
|
this.controls.add(...this.childs);
|
|
263
257
|
}
|
|
@@ -301,7 +295,9 @@ class ContentBody extends Component {
|
|
|
301
295
|
this.context.fire(changeBodyCollectionHandler);
|
|
302
296
|
}
|
|
303
297
|
ondisposing(sender) {
|
|
304
|
-
ContentBodyCollectionHandable.
|
|
298
|
+
if (ContentBodyCollectionHandable.get(this.props.name) === this) {
|
|
299
|
+
ContentBodyCollectionHandable.delete(this.props.name);
|
|
300
|
+
}
|
|
305
301
|
}
|
|
306
302
|
}
|
|
307
303
|
|
|
@@ -333,7 +329,7 @@ class Transport extends Component {
|
|
|
333
329
|
initializeComponent(sender) {
|
|
334
330
|
TransportRegistry.registerSlot(this.props.name, this);
|
|
335
331
|
this.onDisposing = () => {
|
|
336
|
-
(this.controls.items || []).forEach(child => {
|
|
332
|
+
[...(this.controls.items || [])].forEach(child => {
|
|
337
333
|
this.controls.remove(child);
|
|
338
334
|
child.dispose?.();
|
|
339
335
|
});
|
|
@@ -341,7 +337,7 @@ class Transport extends Component {
|
|
|
341
337
|
};
|
|
342
338
|
}
|
|
343
339
|
clearSlot() {
|
|
344
|
-
(this.controls.items || []).forEach(child => {
|
|
340
|
+
[...(this.controls.items || [])].forEach(child => {
|
|
345
341
|
this.controls.remove(child);
|
|
346
342
|
child.dispose?.();
|
|
347
343
|
});
|
|
@@ -355,7 +351,7 @@ class Transporter {
|
|
|
355
351
|
if (child.parent === newParent && newParent.controls.items.includes(child))
|
|
356
352
|
return;
|
|
357
353
|
if (child.parent && child.parent !== newParent) {
|
|
358
|
-
child.parent.controls.
|
|
354
|
+
child.parent.controls.silentDetach(child, true);
|
|
359
355
|
}
|
|
360
356
|
if (options.owner) {
|
|
361
357
|
child.motif.options.ownerTransporter = options.owner;
|
|
@@ -418,8 +414,11 @@ class TransportTo extends Component {
|
|
|
418
414
|
_slotRegisteredListener;
|
|
419
415
|
_slotUnregisteredListener;
|
|
420
416
|
_transported = [];
|
|
417
|
+
_countedLive = false;
|
|
421
418
|
constructor(props) {
|
|
422
419
|
super('div', props);
|
|
420
|
+
contentBlocks.live++;
|
|
421
|
+
this._countedLive = true;
|
|
423
422
|
}
|
|
424
423
|
_handleSlotChange = (eventArgs) => {
|
|
425
424
|
if (eventArgs.name === this.props.name) {
|
|
@@ -429,9 +428,17 @@ class TransportTo extends Component {
|
|
|
429
428
|
}
|
|
430
429
|
const all = [...(this.childs || []), ...this.controls.items];
|
|
431
430
|
Transporter.transportMany(all, slot);
|
|
432
|
-
this.
|
|
431
|
+
this._rememberTransported(all);
|
|
433
432
|
}
|
|
434
433
|
};
|
|
434
|
+
_rememberTransported(children) {
|
|
435
|
+
const kept = this._transported.filter(c => !c.isDisposed);
|
|
436
|
+
for (const child of children) {
|
|
437
|
+
if (!kept.includes(child))
|
|
438
|
+
kept.push(child);
|
|
439
|
+
}
|
|
440
|
+
this._transported = kept;
|
|
441
|
+
}
|
|
435
442
|
_clearChildrenFromSlot = (slot) => {
|
|
436
443
|
(this.childs || []).forEach(child => {
|
|
437
444
|
slot.controls.remove(child);
|
|
@@ -450,7 +457,7 @@ class TransportTo extends Component {
|
|
|
450
457
|
}
|
|
451
458
|
const all = [...(this.childs || []), ...this.controls.items];
|
|
452
459
|
Transporter.transportMany(all, slot);
|
|
453
|
-
this.
|
|
460
|
+
this._rememberTransported(all);
|
|
454
461
|
}
|
|
455
462
|
this._slotRegisteredListener = Application.main.on(SLOT_REGISTERED_EVENT, this._handleSlotChange);
|
|
456
463
|
this._slotUnregisteredListener = Application.main.on(SLOT_UNREGISTERED_EVENT, (eventArgs) => {
|
|
@@ -459,9 +466,11 @@ class TransportTo extends Component {
|
|
|
459
466
|
}
|
|
460
467
|
});
|
|
461
468
|
this._onAddRef = (child) => {
|
|
469
|
+
this.motif.trigger('controladded', { control: child });
|
|
462
470
|
const currentSlot = TransportRegistry.getSlot(this.props.name);
|
|
463
471
|
if (currentSlot) {
|
|
464
472
|
Transporter.transport(child, currentSlot);
|
|
473
|
+
this._rememberTransported([child]);
|
|
465
474
|
}
|
|
466
475
|
};
|
|
467
476
|
this._onRemoveRef = (child) => {
|
|
@@ -469,17 +478,20 @@ class TransportTo extends Component {
|
|
|
469
478
|
if (currentSlot) {
|
|
470
479
|
currentSlot.controls.remove(child);
|
|
471
480
|
}
|
|
481
|
+
this._transported = this._transported.filter(c => c !== child);
|
|
472
482
|
};
|
|
473
483
|
this.controls.onAdd = this._onAddRef;
|
|
474
484
|
this.controls.onRemove = this._onRemoveRef;
|
|
475
485
|
}
|
|
476
486
|
onDisposing(sender, e) {
|
|
487
|
+
if (this._countedLive) {
|
|
488
|
+
this._countedLive = false;
|
|
489
|
+
contentBlocks.live--;
|
|
490
|
+
}
|
|
477
491
|
const currentSlot = TransportRegistry.getSlot(this.props.name);
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
child.dispose();
|
|
482
|
-
});
|
|
492
|
+
for (const child of this._transported || []) {
|
|
493
|
+
currentSlot?.controls.remove(child);
|
|
494
|
+
child.dispose();
|
|
483
495
|
}
|
|
484
496
|
if (this._slotRegisteredListener) {
|
|
485
497
|
Application.main.off(SLOT_REGISTERED_EVENT, this._handleSlotChange);
|
|
@@ -1343,7 +1355,7 @@ class RateLimiterPolicy extends Policy {
|
|
|
1343
1355
|
super();
|
|
1344
1356
|
this.tokensPerInterval = opts.tokensPerInterval ?? 1;
|
|
1345
1357
|
this.intervalMs = opts.intervalMs ?? 1000;
|
|
1346
|
-
this.capacity = opts.capacity ??
|
|
1358
|
+
this.capacity = opts.capacity ?? this.tokensPerInterval;
|
|
1347
1359
|
this.tokens = this.capacity;
|
|
1348
1360
|
this.lastRefill = Date.now();
|
|
1349
1361
|
}
|