@ng-atomic/common 20.9.2 → 20.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ng-atomic-common-directives-active-control.mjs +9 -2
- package/fesm2022/ng-atomic-common-services-navigator-actions.mjs +24 -0
- package/fesm2022/ng-atomic-common.mjs +8 -1
- package/package.json +7 -3
- package/types/ng-atomic-common-directives-active-control.d.ts +3 -0
- package/types/ng-atomic-common-services-navigator-actions.d.ts +18 -0
- package/types/ng-atomic-common.d.ts +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, input, output, signal, effect, Directive } from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, output, signal, computed, effect, Directive } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
function resolveFocusTarget(ctx) {
|
|
5
5
|
return ctx.focusTargetSelector
|
|
@@ -327,6 +327,9 @@ class ActiveControlDirective {
|
|
|
327
327
|
this.eventCleanupFunctions = [];
|
|
328
328
|
this.scrollCleanupFunctions = [];
|
|
329
329
|
this.eventHandlersInitialized = false;
|
|
330
|
+
this.handlersInstalled = signal(false, ...(ngDevMode ? [{ debugName: "handlersInstalled" }] : []));
|
|
331
|
+
this.scrollPending = signal(true, ...(ngDevMode ? [{ debugName: "scrollPending" }] : []));
|
|
332
|
+
this.listenersReady = computed(() => this.handlersInstalled() && !this.scrollPending(), ...(ngDevMode ? [{ debugName: "listenersReady" }] : []));
|
|
330
333
|
effect(() => {
|
|
331
334
|
if (!this.eventHandlersInitialized) {
|
|
332
335
|
this.initTimer = setTimeout(() => this.initializeEventHandlers(), 100);
|
|
@@ -336,6 +339,7 @@ class ActiveControlDirective {
|
|
|
336
339
|
effect(() => {
|
|
337
340
|
const selectors = this.getScrollSelectors();
|
|
338
341
|
clearTimeout(this.scrollTimer);
|
|
342
|
+
this.scrollPending.set(true);
|
|
339
343
|
this.scrollTimer = setTimeout(() => this.setupScrollControls(selectors), 150);
|
|
340
344
|
});
|
|
341
345
|
}
|
|
@@ -356,6 +360,7 @@ class ActiveControlDirective {
|
|
|
356
360
|
alwaysActive: this.alwaysActive(),
|
|
357
361
|
});
|
|
358
362
|
this.eventCleanupFunctions.push(...eventHandlers.setupAll());
|
|
363
|
+
this.handlersInstalled.set(true);
|
|
359
364
|
}
|
|
360
365
|
setupScrollControls(selectors) {
|
|
361
366
|
this.scrollCleanupFunctions.forEach(cleanup => cleanup());
|
|
@@ -369,6 +374,7 @@ class ActiveControlDirective {
|
|
|
369
374
|
this.scrollCleanupFunctions.push(...scrollControl.setup());
|
|
370
375
|
});
|
|
371
376
|
}
|
|
377
|
+
this.scrollPending.set(false);
|
|
372
378
|
}
|
|
373
379
|
getScrollSelectors() {
|
|
374
380
|
const multiple = this.scrollSelectors();
|
|
@@ -379,7 +385,7 @@ class ActiveControlDirective {
|
|
|
379
385
|
return single ? [single] : [];
|
|
380
386
|
}
|
|
381
387
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ActiveControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
382
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: ActiveControlDirective, isStandalone: true, selector: "[appActiveControl]", inputs: { scrollSelector: { classPropertyName: "scrollSelector", publicName: "scrollSelector", isSignal: true, isRequired: false, transformFunction: null }, scrollSelectors: { classPropertyName: "scrollSelectors", publicName: "scrollSelectors", isSignal: true, isRequired: false, transformFunction: null }, disableStopPropagation: { classPropertyName: "disableStopPropagation", publicName: "disableStopPropagation", isSignal: true, isRequired: false, transformFunction: null }, disableTouchDeactivate: { classPropertyName: "disableTouchDeactivate", publicName: "disableTouchDeactivate", isSignal: true, isRequired: false, transformFunction: null }, disableScrollLock: { classPropertyName: "disableScrollLock", publicName: "disableScrollLock", isSignal: true, isRequired: false, transformFunction: null }, disableNodrag: { classPropertyName: "disableNodrag", publicName: "disableNodrag", isSignal: true, isRequired: false, transformFunction: null }, focusTargetSelector: { classPropertyName: "focusTargetSelector", publicName: "focusTargetSelector", isSignal: true, isRequired: false, transformFunction: null }, alwaysActive: { classPropertyName: "alwaysActive", publicName: "alwaysActive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeChange: "activeChange" }, host: { properties: { "class.active": "isActive()", "class.nodrag": "!disableNodrag()", "class.nowheel": "isActive()" } }, ngImport: i0 }); }
|
|
388
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: ActiveControlDirective, isStandalone: true, selector: "[appActiveControl]", inputs: { scrollSelector: { classPropertyName: "scrollSelector", publicName: "scrollSelector", isSignal: true, isRequired: false, transformFunction: null }, scrollSelectors: { classPropertyName: "scrollSelectors", publicName: "scrollSelectors", isSignal: true, isRequired: false, transformFunction: null }, disableStopPropagation: { classPropertyName: "disableStopPropagation", publicName: "disableStopPropagation", isSignal: true, isRequired: false, transformFunction: null }, disableTouchDeactivate: { classPropertyName: "disableTouchDeactivate", publicName: "disableTouchDeactivate", isSignal: true, isRequired: false, transformFunction: null }, disableScrollLock: { classPropertyName: "disableScrollLock", publicName: "disableScrollLock", isSignal: true, isRequired: false, transformFunction: null }, disableNodrag: { classPropertyName: "disableNodrag", publicName: "disableNodrag", isSignal: true, isRequired: false, transformFunction: null }, focusTargetSelector: { classPropertyName: "focusTargetSelector", publicName: "focusTargetSelector", isSignal: true, isRequired: false, transformFunction: null }, alwaysActive: { classPropertyName: "alwaysActive", publicName: "alwaysActive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeChange: "activeChange" }, host: { properties: { "class.active": "isActive()", "class.nodrag": "!disableNodrag()", "class.nowheel": "isActive()", "attr.data-active-control-ready": "listenersReady() ? \"\" : null" } }, ngImport: i0 }); }
|
|
383
389
|
}
|
|
384
390
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ActiveControlDirective, decorators: [{
|
|
385
391
|
type: Directive,
|
|
@@ -390,6 +396,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
390
396
|
'[class.active]': 'isActive()',
|
|
391
397
|
'[class.nodrag]': '!disableNodrag()',
|
|
392
398
|
'[class.nowheel]': 'isActive()',
|
|
399
|
+
'[attr.data-active-control-ready]': 'listenersReady() ? "" : null',
|
|
393
400
|
}
|
|
394
401
|
}]
|
|
395
402
|
}], ctorParameters: () => [], propDecorators: { scrollSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollSelector", required: false }] }], scrollSelectors: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollSelectors", required: false }] }], disableStopPropagation: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableStopPropagation", required: false }] }], disableTouchDeactivate: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableTouchDeactivate", required: false }] }], disableScrollLock: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableScrollLock", required: false }] }], disableNodrag: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableNodrag", required: false }] }], focusTargetSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusTargetSelector", required: false }] }], alwaysActive: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysActive", required: false }] }], activeChange: [{ type: i0.Output, args: ["activeChange"] }] } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, Injectable } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class NavigatorActionsService {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.entries = signal([], ...(ngDevMode ? [{ debugName: "entries" }] : []));
|
|
7
|
+
}
|
|
8
|
+
register(entry) {
|
|
9
|
+
this.entries.update((entries) => [...entries, entry]);
|
|
10
|
+
return () => this.entries.update((entries) => entries.filter((e) => e !== entry));
|
|
11
|
+
}
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NavigatorActionsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
13
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NavigatorActionsService, providedIn: 'root' }); }
|
|
14
|
+
}
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: NavigatorActionsService, decorators: [{
|
|
16
|
+
type: Injectable,
|
|
17
|
+
args: [{ providedIn: 'root' }]
|
|
18
|
+
}] });
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Generated bundle index. Do not edit.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export { NavigatorActionsService };
|
|
@@ -461,6 +461,9 @@ class ActiveControlDirective {
|
|
|
461
461
|
this.eventCleanupFunctions = [];
|
|
462
462
|
this.scrollCleanupFunctions = [];
|
|
463
463
|
this.eventHandlersInitialized = false;
|
|
464
|
+
this.handlersInstalled = signal(false, ...(ngDevMode ? [{ debugName: "handlersInstalled" }] : []));
|
|
465
|
+
this.scrollPending = signal(true, ...(ngDevMode ? [{ debugName: "scrollPending" }] : []));
|
|
466
|
+
this.listenersReady = computed(() => this.handlersInstalled() && !this.scrollPending(), ...(ngDevMode ? [{ debugName: "listenersReady" }] : []));
|
|
464
467
|
effect(() => {
|
|
465
468
|
if (!this.eventHandlersInitialized) {
|
|
466
469
|
this.initTimer = setTimeout(() => this.initializeEventHandlers(), 100);
|
|
@@ -470,6 +473,7 @@ class ActiveControlDirective {
|
|
|
470
473
|
effect(() => {
|
|
471
474
|
const selectors = this.getScrollSelectors();
|
|
472
475
|
clearTimeout(this.scrollTimer);
|
|
476
|
+
this.scrollPending.set(true);
|
|
473
477
|
this.scrollTimer = setTimeout(() => this.setupScrollControls(selectors), 150);
|
|
474
478
|
});
|
|
475
479
|
}
|
|
@@ -490,6 +494,7 @@ class ActiveControlDirective {
|
|
|
490
494
|
alwaysActive: this.alwaysActive(),
|
|
491
495
|
});
|
|
492
496
|
this.eventCleanupFunctions.push(...eventHandlers.setupAll());
|
|
497
|
+
this.handlersInstalled.set(true);
|
|
493
498
|
}
|
|
494
499
|
setupScrollControls(selectors) {
|
|
495
500
|
this.scrollCleanupFunctions.forEach(cleanup => cleanup());
|
|
@@ -503,6 +508,7 @@ class ActiveControlDirective {
|
|
|
503
508
|
this.scrollCleanupFunctions.push(...scrollControl.setup());
|
|
504
509
|
});
|
|
505
510
|
}
|
|
511
|
+
this.scrollPending.set(false);
|
|
506
512
|
}
|
|
507
513
|
getScrollSelectors() {
|
|
508
514
|
const multiple = this.scrollSelectors();
|
|
@@ -513,7 +519,7 @@ class ActiveControlDirective {
|
|
|
513
519
|
return single ? [single] : [];
|
|
514
520
|
}
|
|
515
521
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ActiveControlDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
516
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: ActiveControlDirective, isStandalone: true, selector: "[appActiveControl]", inputs: { scrollSelector: { classPropertyName: "scrollSelector", publicName: "scrollSelector", isSignal: true, isRequired: false, transformFunction: null }, scrollSelectors: { classPropertyName: "scrollSelectors", publicName: "scrollSelectors", isSignal: true, isRequired: false, transformFunction: null }, disableStopPropagation: { classPropertyName: "disableStopPropagation", publicName: "disableStopPropagation", isSignal: true, isRequired: false, transformFunction: null }, disableTouchDeactivate: { classPropertyName: "disableTouchDeactivate", publicName: "disableTouchDeactivate", isSignal: true, isRequired: false, transformFunction: null }, disableScrollLock: { classPropertyName: "disableScrollLock", publicName: "disableScrollLock", isSignal: true, isRequired: false, transformFunction: null }, disableNodrag: { classPropertyName: "disableNodrag", publicName: "disableNodrag", isSignal: true, isRequired: false, transformFunction: null }, focusTargetSelector: { classPropertyName: "focusTargetSelector", publicName: "focusTargetSelector", isSignal: true, isRequired: false, transformFunction: null }, alwaysActive: { classPropertyName: "alwaysActive", publicName: "alwaysActive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeChange: "activeChange" }, host: { properties: { "class.active": "isActive()", "class.nodrag": "!disableNodrag()", "class.nowheel": "isActive()" } }, ngImport: i0 }); }
|
|
522
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: ActiveControlDirective, isStandalone: true, selector: "[appActiveControl]", inputs: { scrollSelector: { classPropertyName: "scrollSelector", publicName: "scrollSelector", isSignal: true, isRequired: false, transformFunction: null }, scrollSelectors: { classPropertyName: "scrollSelectors", publicName: "scrollSelectors", isSignal: true, isRequired: false, transformFunction: null }, disableStopPropagation: { classPropertyName: "disableStopPropagation", publicName: "disableStopPropagation", isSignal: true, isRequired: false, transformFunction: null }, disableTouchDeactivate: { classPropertyName: "disableTouchDeactivate", publicName: "disableTouchDeactivate", isSignal: true, isRequired: false, transformFunction: null }, disableScrollLock: { classPropertyName: "disableScrollLock", publicName: "disableScrollLock", isSignal: true, isRequired: false, transformFunction: null }, disableNodrag: { classPropertyName: "disableNodrag", publicName: "disableNodrag", isSignal: true, isRequired: false, transformFunction: null }, focusTargetSelector: { classPropertyName: "focusTargetSelector", publicName: "focusTargetSelector", isSignal: true, isRequired: false, transformFunction: null }, alwaysActive: { classPropertyName: "alwaysActive", publicName: "alwaysActive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeChange: "activeChange" }, host: { properties: { "class.active": "isActive()", "class.nodrag": "!disableNodrag()", "class.nowheel": "isActive()", "attr.data-active-control-ready": "listenersReady() ? \"\" : null" } }, ngImport: i0 }); }
|
|
517
523
|
}
|
|
518
524
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ActiveControlDirective, decorators: [{
|
|
519
525
|
type: Directive,
|
|
@@ -524,6 +530,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
|
|
|
524
530
|
'[class.active]': 'isActive()',
|
|
525
531
|
'[class.nodrag]': '!disableNodrag()',
|
|
526
532
|
'[class.nowheel]': 'isActive()',
|
|
533
|
+
'[attr.data-active-control-ready]': 'listenersReady() ? "" : null',
|
|
527
534
|
}
|
|
528
535
|
}]
|
|
529
536
|
}], ctorParameters: () => [], propDecorators: { scrollSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollSelector", required: false }] }], scrollSelectors: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollSelectors", required: false }] }], disableStopPropagation: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableStopPropagation", required: false }] }], disableTouchDeactivate: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableTouchDeactivate", required: false }] }], disableScrollLock: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableScrollLock", required: false }] }], disableNodrag: [{ type: i0.Input, args: [{ isSignal: true, alias: "disableNodrag", required: false }] }], focusTargetSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusTargetSelector", required: false }] }], alwaysActive: [{ type: i0.Input, args: [{ isSignal: true, alias: "alwaysActive", required: false }] }], activeChange: [{ type: i0.Output, args: ["activeChange"] }] } });
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-atomic/common",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.20.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@nx-ddd/core": "20.
|
|
7
|
-
"@nx-ddd/common": "20.
|
|
6
|
+
"@nx-ddd/core": "20.20.4",
|
|
7
|
+
"@nx-ddd/common": "20.20.4"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"tslib": "^2.3.0"
|
|
@@ -231,6 +231,10 @@
|
|
|
231
231
|
"types": "./types/ng-atomic-common-services-navigation-history.d.ts",
|
|
232
232
|
"default": "./fesm2022/ng-atomic-common-services-navigation-history.mjs"
|
|
233
233
|
},
|
|
234
|
+
"./services/navigator-actions": {
|
|
235
|
+
"types": "./types/ng-atomic-common-services-navigator-actions.d.ts",
|
|
236
|
+
"default": "./fesm2022/ng-atomic-common-services-navigator-actions.mjs"
|
|
237
|
+
},
|
|
234
238
|
"./services/query-resolver": {
|
|
235
239
|
"types": "./types/ng-atomic-common-services-query-resolver.d.ts",
|
|
236
240
|
"default": "./fesm2022/ng-atomic-common-services-query-resolver.mjs"
|
|
@@ -18,6 +18,9 @@ declare class ActiveControlDirective implements OnDestroy {
|
|
|
18
18
|
private eventHandlersInitialized;
|
|
19
19
|
private initTimer?;
|
|
20
20
|
private scrollTimer?;
|
|
21
|
+
private readonly handlersInstalled;
|
|
22
|
+
private readonly scrollPending;
|
|
23
|
+
readonly listenersReady: _angular_core.Signal<boolean>;
|
|
21
24
|
constructor();
|
|
22
25
|
ngOnDestroy(): void;
|
|
23
26
|
private initializeEventHandlers;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Signal } from '@angular/core';
|
|
3
|
+
import { Action } from '@ng-atomic/core';
|
|
4
|
+
|
|
5
|
+
interface NavigatorActionsEntry {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
actions: Signal<Action[]>;
|
|
8
|
+
dispatch: (action: Action) => void;
|
|
9
|
+
}
|
|
10
|
+
declare class NavigatorActionsService {
|
|
11
|
+
readonly entries: i0.WritableSignal<NavigatorActionsEntry[]>;
|
|
12
|
+
register(entry: NavigatorActionsEntry): () => void;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NavigatorActionsService, never>;
|
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NavigatorActionsService>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { NavigatorActionsService };
|
|
18
|
+
export type { NavigatorActionsEntry };
|
|
@@ -46,6 +46,9 @@ declare class ActiveControlDirective implements OnDestroy {
|
|
|
46
46
|
private eventHandlersInitialized;
|
|
47
47
|
private initTimer?;
|
|
48
48
|
private scrollTimer?;
|
|
49
|
+
private readonly handlersInstalled;
|
|
50
|
+
private readonly scrollPending;
|
|
51
|
+
readonly listenersReady: _angular_core.Signal<boolean>;
|
|
49
52
|
constructor();
|
|
50
53
|
ngOnDestroy(): void;
|
|
51
54
|
private initializeEventHandlers;
|