@ssv/ngx.command 3.2.0 → 3.3.0-dev.82

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/README.md CHANGED
@@ -20,6 +20,7 @@ Choose the version corresponding to your Angular version:
20
20
 
21
21
  | Angular | library |
22
22
  | ------- | ------- |
23
+ | 17+ | 4.x+ |
23
24
  | 17+ | 3.x+ |
24
25
  | 10+ | 2.x+ |
25
26
  | 4 to 9 | 1.x+ |
@@ -163,7 +164,6 @@ export const appConfig: ApplicationConfig = {
163
164
  providers: [
164
165
  provideSsvCommandOptions({
165
166
  executingCssClass: "is-busy",
166
- hasDisabledDelay: false
167
167
  }),
168
168
  ],
169
169
  };
@@ -1,19 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, makeEnvironmentProviders, assertInInjectionContext, inject, Injector, DestroyRef, computed, isSignal, Renderer2, ElementRef, ChangeDetectorRef, Directive, Input, HostListener, NgModule } from '@angular/core';
3
- import { BehaviorSubject, Subject, Subscription, combineLatest, map, tap, filter, switchMap, of, finalize, take, catchError, EMPTY, concat, defer, distinctUntilChanged, delay, takeUntil } from 'rxjs';
4
- import { toObservable } from '@angular/core/rxjs-interop';
2
+ import { InjectionToken, assertInInjectionContext, inject, Injector, DestroyRef, signal, computed, isSignal, Renderer2, ElementRef, ChangeDetectorRef, input, effect, Directive, NgModule } from '@angular/core';
3
+ import { Subject, Subscription, filter, tap, switchMap, of, finalize, take, catchError, EMPTY, concat, defer, map, distinctUntilChanged, combineLatest } from 'rxjs';
4
+ import { toSignal } from '@angular/core/rxjs-interop';
5
5
  import { PristineChangeEvent, StatusChangeEvent } from '@angular/forms';
6
6
 
7
7
  const DEFAULT_OPTIONS = Object.freeze({
8
8
  executingCssClass: "executing",
9
9
  handleDisabled: true,
10
- hasDisabledDelay: false,
11
10
  });
12
11
  const COMMAND_OPTIONS = new InjectionToken("SSV_COMMAND_OPTIONS", {
13
12
  factory: () => DEFAULT_OPTIONS,
14
13
  });
15
14
  function provideSsvCommandOptions(options) {
16
- return makeEnvironmentProviders([
15
+ return [
17
16
  {
18
17
  provide: COMMAND_OPTIONS,
19
18
  useFactory: () => {
@@ -27,7 +26,7 @@ function provideSsvCommandOptions(options) {
27
26
  return opts;
28
27
  },
29
28
  },
30
- ]);
29
+ ];
31
30
  }
32
31
 
33
32
  /* eslint-disable @typescript-eslint/no-explicit-any */
@@ -48,7 +47,7 @@ function command(execute, canExecute$, opts) {
48
47
  const injector = opts?.injector ?? inject(Injector);
49
48
  const isAsync = opts?.isAsync ?? false;
50
49
  const destroyRef = injector.get(DestroyRef);
51
- const cmd = new Command(execute, canExecute$, isAsync);
50
+ const cmd = new Command(execute, canExecute$, isAsync, injector);
52
51
  cmd.autoDestroy = false;
53
52
  destroyRef.onDestroy(() => {
54
53
  // console.warn("[command::destroy]");
@@ -58,31 +57,16 @@ function command(execute, canExecute$, opts) {
58
57
  }
59
58
  /**
60
59
  * Command object used to encapsulate information which is needed to perform an action.
61
- * @deprecated Use {@link command} or {@link commandAsync} instead for creating instances.
60
+ *
62
61
  */
63
62
  class Command {
64
- /** Determines whether the command is currently executing, as a snapshot value. */
65
- get isExecuting() {
66
- return this._isExecuting;
67
- }
68
- /** Determines whether the command can execute or not, as a snapshot value. */
69
- get canExecute() {
70
- return this._canExecute;
71
- }
72
- /** Determines whether the command is currently executing, as an observable. */
73
- get isExecuting$() {
74
- return this._isExecuting$.asObservable();
75
- }
76
- /** Determines whether to auto destroy when having 0 subscribers. */
63
+ get isExecuting() { return this.$isExecuting(); }
64
+ get canExecute() { return this.$canExecute(); }
65
+ $isExecuting = signal(false, ...(ngDevMode ? [{ debugName: "$isExecuting" }] : []));
66
+ $canExecute = computed(() => !this.$isExecuting() && this._$canExecute(), ...(ngDevMode ? [{ debugName: "$canExecute" }] : []));
67
+ _$canExecute;
77
68
  autoDestroy = true;
78
- /** Determines whether the command can execute or not, as an observable. */
79
- canExecute$;
80
- _isExecuting$ = new BehaviorSubject(false);
81
- _isExecuting = false;
82
- _canExecute = true;
83
69
  executionPipe$ = new Subject();
84
- isExecuting$$ = Subscription.EMPTY;
85
- canExecute$$ = Subscription.EMPTY;
86
70
  executionPipe$$ = Subscription.EMPTY;
87
71
  subscribersCount = 0;
88
72
  /**
@@ -91,32 +75,19 @@ class Command {
91
75
  * @param execute Execute function to invoke - use `isAsync: true` when `Observable<any>`.
92
76
  * @param canExecute Observable which determines whether it can execute or not.
93
77
  * @param isAsync Indicates that the execute function is async e.g. Observable.
78
+ * @deprecated Use {@link command} or {@link commandAsync} instead for creating instances.
94
79
  */
95
80
  constructor(execute, canExecute$, isAsync, injector) {
96
81
  if (canExecute$) {
97
82
  const canExecute = typeof canExecute$ === "function"
98
83
  ? computed(canExecute$)
99
84
  : canExecute$;
100
- this.canExecute$ = combineLatest([
101
- this._isExecuting$,
102
- isSignal(canExecute) ? toObservable(canExecute, { injector }) : canExecute
103
- ]).pipe(map(([isExecuting, canExecuteResult]) => {
104
- // console.log("[command::combineLatest$] update!", { isExecuting, canExecuteResult });
105
- this._isExecuting = isExecuting;
106
- this._canExecute = !isExecuting && !!canExecuteResult;
107
- return this._canExecute;
108
- }));
109
- this.canExecute$$ = this.canExecute$.subscribe();
85
+ this._$canExecute = isSignal(canExecute)
86
+ ? canExecute
87
+ : toSignal(canExecute, { initialValue: false, injector });
110
88
  }
111
89
  else {
112
- this.canExecute$ = this._isExecuting$.pipe(map(x => {
113
- const canExecute = !x;
114
- this._canExecute = canExecute;
115
- return canExecute;
116
- }));
117
- this.isExecuting$$ = this._isExecuting$
118
- .pipe(tap(x => this._isExecuting = x))
119
- .subscribe();
90
+ this._$canExecute = signal(true, ...(ngDevMode ? [{ debugName: "_$canExecute" }] : []));
120
91
  }
121
92
  this.executionPipe$$ = this.buildExecutionPipe(execute, isAsync).subscribe();
122
93
  }
@@ -129,8 +100,6 @@ class Command {
129
100
  destroy() {
130
101
  // console.warn("[command::destroy]");
131
102
  this.executionPipe$$.unsubscribe();
132
- this.canExecute$$.unsubscribe();
133
- this.isExecuting$$.unsubscribe();
134
103
  }
135
104
  subscribe() {
136
105
  this.subscribersCount++;
@@ -145,9 +114,9 @@ class Command {
145
114
  buildExecutionPipe(execute, isAsync) {
146
115
  let pipe$ = this.executionPipe$.pipe(
147
116
  // tap(x => console.warn(">>>> executionPipe", this._canExecute)),
148
- filter(() => this._canExecute), tap(() => {
117
+ filter(() => this.$canExecute()), tap(() => {
149
118
  // console.log("[command::executionPipe$] do#1 - set execute", { args: x });
150
- this._isExecuting$.next(true);
119
+ this.$isExecuting.set(true);
151
120
  }));
152
121
  const execFn = isAsync
153
122
  ? switchMap(args => {
@@ -165,13 +134,14 @@ class Command {
165
134
  });
166
135
  pipe$ = pipe$.pipe(switchMap(args => of(args).pipe(execFn, finalize(() => {
167
136
  // console.log("[command::executionPipe$] finalize inner#1 - set idle");
168
- this._isExecuting$.next(false);
137
+ this.$isExecuting.set(false);
169
138
  }), take(1), catchError(error => {
170
139
  console.error("Unhandled execute error", error);
171
140
  return EMPTY;
172
141
  }))), tap(() => {
173
142
  // console.log("[command::executionPipe$] tap#2 - set idle");
174
- this._isExecuting$.next(false);
143
+ // this._isExecuting$.next(false);
144
+ this.$isExecuting.set(false);
175
145
  }));
176
146
  return pipe$;
177
147
  }
@@ -182,6 +152,9 @@ class Command {
182
152
  * @deprecated Use {@link commandAsync} instead.
183
153
  */
184
154
  class CommandAsync extends Command {
155
+ /**
156
+ * @deprecated Use {@link commandAsync} instead to create an instance.
157
+ */
185
158
  constructor(execute, canExecute$) {
186
159
  super(execute, canExecute$, true);
187
160
  }
@@ -273,120 +246,104 @@ function isAssumedType(x) {
273
246
  */
274
247
  const NAME_CAMEL$1 = "ssvCommand";
275
248
  // let nextUniqueId = 0;
276
- class CommandDirective {
249
+ class SsvCommand {
277
250
  // readonly id = `${NAME_CAMEL}-${nextUniqueId++}`;
278
- globalOptions = inject(COMMAND_OPTIONS);
279
- renderer = inject(Renderer2);
280
- element = inject(ElementRef);
281
- cdr = inject(ChangeDetectorRef);
282
- commandOrCreator;
283
- get commandOptions() { return this._commandOptions; }
284
- set commandOptions(value) {
285
- if (value === this._commandOptions) {
286
- return;
251
+ #options = inject(COMMAND_OPTIONS);
252
+ #renderer = inject(Renderer2);
253
+ #element = inject(ElementRef);
254
+ #cdr = inject(ChangeDetectorRef);
255
+ #injector = inject(Injector);
256
+ commandOrCreator = input.required(...(ngDevMode ? [{ debugName: "commandOrCreator", alias: `ssvCommand` }] : [{
257
+ alias: `ssvCommand`
258
+ }]));
259
+ ssvCommandOptions = input(this.#options, ...(ngDevMode ? [{ debugName: "ssvCommandOptions" }] : []));
260
+ commandOptions = computed(() => {
261
+ const value = this.ssvCommandOptions();
262
+ if (value === this.#options) {
263
+ return this.#options;
287
264
  }
288
- this._commandOptions = {
289
- ...this.globalOptions,
265
+ return {
266
+ ...this.#options,
290
267
  ...value,
291
268
  };
292
- }
293
- commandParams;
269
+ }, ...(ngDevMode ? [{ debugName: "commandOptions" }] : []));
270
+ ssvCommandParams = input(undefined, ...(ngDevMode ? [{ debugName: "ssvCommandParams" }] : []));
271
+ commandParams = computed(() => this.ssvCommandParams() || this.creatorParams, ...(ngDevMode ? [{ debugName: "commandParams" }] : []));
272
+ _hostClasses = computed(() => ["ssv-command", this.#executingClass()], ...(ngDevMode ? [{ debugName: "_hostClasses" }] : []));
273
+ #executingClass = computed(() => this._command.$isExecuting() ? this.commandOptions().executingCssClass : "", ...(ngDevMode ? [{ debugName: "#executingClass" }] : []));
274
+ creatorParams = [];
294
275
  get command() { return this._command; }
295
276
  _command;
296
- _commandOptions = this.globalOptions;
297
- _destroy$ = new Subject();
277
+ constructor() {
278
+ const destroyRef = inject(DestroyRef);
279
+ destroyRef.onDestroy(() => {
280
+ this._command?.unsubscribe();
281
+ });
282
+ effect(() => {
283
+ const canExecute = this._command.$canExecute();
284
+ this.trySetDisabled(!canExecute);
285
+ // console.log("[ssvCommand::canExecute$]", { canExecute: x });
286
+ this.#cdr.markForCheck();
287
+ });
288
+ }
298
289
  ngOnInit() {
299
- // console.log("[ssvCommand::init]", this.globalOptions);
300
- if (!this.commandOrCreator) {
301
- throw new Error(`${NAME_CAMEL$1}: [${NAME_CAMEL$1}] should be defined!`);
302
- }
303
- else if (isCommand(this.commandOrCreator)) {
304
- this._command = this.commandOrCreator;
290
+ const commandOrCreator = this.commandOrCreator();
291
+ // console.log("[ssvCommand::init]", this.#options);
292
+ if (isCommand(commandOrCreator)) {
293
+ this._command = commandOrCreator;
305
294
  }
306
- else if (isCommandCreator(this.commandOrCreator)) {
307
- const isAsync = this.commandOrCreator.isAsync || this.commandOrCreator.isAsync === undefined;
295
+ else if (isCommandCreator(commandOrCreator)) {
296
+ const isAsync = commandOrCreator.isAsync || commandOrCreator.isAsync === undefined;
297
+ this.creatorParams = commandOrCreator.params;
308
298
  // todo: find something like this for ivy (or angular10+)
309
299
  // const hostComponent = (this.viewContainer as any)._view.component;
310
- const execFn = this.commandOrCreator.execute.bind(this.commandOrCreator.host);
311
- this.commandParams = this.commandParams || this.commandOrCreator.params;
312
- const canExec = this.commandOrCreator.canExecute instanceof Function
313
- ? this.commandOrCreator.canExecute.bind(this.commandOrCreator.host, this.commandParams)()
314
- : this.commandOrCreator.canExecute;
300
+ const execFn = commandOrCreator.execute.bind(commandOrCreator.host);
301
+ const params = this.commandParams();
302
+ const canExec = commandOrCreator.canExecute instanceof Function
303
+ ? commandOrCreator.canExecute.bind(commandOrCreator.host, params)()
304
+ : commandOrCreator.canExecute;
315
305
  // console.log("[ssvCommand::init] command creator", {
316
- // firstParam: this.commandParams ? this.commandParams[0] : null,
317
- // params: this.commandParams
306
+ // firstParam: params ? params[0] : null,
307
+ // params
318
308
  // });
319
- this._command = new Command(execFn, canExec, isAsync);
309
+ this._command = command(execFn, canExec, { isAsync, injector: this.#injector });
320
310
  }
321
311
  else {
322
312
  throw new Error(`${NAME_CAMEL$1}: [${NAME_CAMEL$1}] is not defined properly!`);
323
313
  }
324
314
  this._command.subscribe();
325
- this._command.canExecute$.pipe(this.commandOptions.hasDisabledDelay
326
- ? delay(1)
327
- : tap(() => { }), tap(x => {
328
- this.trySetDisabled(!x);
329
- // console.log("[ssvCommand::canExecute$]", { canExecute: x });
330
- this.cdr.markForCheck();
331
- }), takeUntil(this._destroy$)).subscribe();
332
- if (this._command.isExecuting$) {
333
- this._command.isExecuting$.pipe(tap(x => {
334
- // console.log("[ssvCommand::isExecuting$]", x, this.commandOptions);
335
- if (x) {
336
- this.renderer.addClass(this.element.nativeElement, this.commandOptions.executingCssClass);
337
- }
338
- else {
339
- this.renderer.removeClass(this.element.nativeElement, this.commandOptions.executingCssClass);
340
- }
341
- }), takeUntil(this._destroy$)).subscribe();
342
- }
343
315
  }
344
- onClick() {
345
- // console.log("[ssvCommand::onClick]", this.commandParams);
346
- if (Array.isArray(this.commandParams)) {
347
- this._command.execute(...this.commandParams);
316
+ _handleClick() {
317
+ const commandParams = this.commandParams();
318
+ // console.log("[ssvCommand::onClick]", commandParams);
319
+ if (Array.isArray(commandParams)) {
320
+ this._command.execute(...commandParams);
348
321
  }
349
322
  else {
350
- this._command.execute(this.commandParams);
351
- }
352
- }
353
- ngOnDestroy() {
354
- // console.log("[ssvCommand::destroy]");
355
- this._destroy$.next();
356
- this._destroy$.complete();
357
- if (this._command) {
358
- this._command.unsubscribe();
323
+ this._command.execute(commandParams);
359
324
  }
360
325
  }
361
326
  trySetDisabled(disabled) {
362
- if (this.commandOptions.handleDisabled) {
327
+ if (this.commandOptions().handleDisabled) {
363
328
  // console.warn(">>>> disabled", { id: this.id, disabled });
364
- this.renderer.setProperty(this.element.nativeElement, "disabled", disabled);
329
+ this.#renderer.setProperty(this.#element.nativeElement, "disabled", disabled);
365
330
  }
366
331
  }
367
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CommandDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
368
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.9", type: CommandDirective, isStandalone: true, selector: "[ssvCommand]", inputs: { commandOrCreator: ["ssvCommand", "commandOrCreator"], commandOptions: ["ssvCommandOptions", "commandOptions"], commandParams: ["ssvCommandParams", "commandParams"] }, host: { listeners: { "click": "onClick()" } }, exportAs: ["ssvCommand"], ngImport: i0 });
332
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommand, deps: [], target: i0.ɵɵFactoryTarget.Directive });
333
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.7", type: SsvCommand, isStandalone: true, selector: "[ssvCommand]", inputs: { commandOrCreator: { classPropertyName: "commandOrCreator", publicName: "ssvCommand", isSignal: true, isRequired: true, transformFunction: null }, ssvCommandOptions: { classPropertyName: "ssvCommandOptions", publicName: "ssvCommandOptions", isSignal: true, isRequired: false, transformFunction: null }, ssvCommandParams: { classPropertyName: "ssvCommandParams", publicName: "ssvCommandParams", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "_handleClick()" }, properties: { "class": "_hostClasses()" } }, exportAs: ["ssvCommand"], ngImport: i0 });
369
334
  }
370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CommandDirective, decorators: [{
335
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommand, decorators: [{
371
336
  type: Directive,
372
337
  args: [{
373
338
  selector: `[${NAME_CAMEL$1}]`,
339
+ host: {
340
+ "[class]": "_hostClasses()",
341
+ "(click)": "_handleClick()",
342
+ },
374
343
  exportAs: NAME_CAMEL$1,
375
344
  standalone: true,
376
345
  }]
377
- }], propDecorators: { commandOrCreator: [{
378
- type: Input,
379
- args: [NAME_CAMEL$1]
380
- }], commandOptions: [{
381
- type: Input,
382
- args: [`${NAME_CAMEL$1}Options`]
383
- }], commandParams: [{
384
- type: Input,
385
- args: [`${NAME_CAMEL$1}Params`]
386
- }], onClick: [{
387
- type: HostListener,
388
- args: ["click"]
389
- }] } });
346
+ }], ctorParameters: () => [], propDecorators: { commandOrCreator: [{ type: i0.Input, args: [{ isSignal: true, alias: "ssvCommand", required: true }] }], ssvCommandOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "ssvCommandOptions", required: false }] }], ssvCommandParams: [{ type: i0.Input, args: [{ isSignal: true, alias: "ssvCommandParams", required: false }] }] } });
390
347
 
391
348
  const NAME_CAMEL = "ssvCommandRef";
392
349
  /**
@@ -406,53 +363,55 @@ const NAME_CAMEL = "ssvCommandRef";
406
363
  * ```
407
364
  *
408
365
  */
409
- class CommandRefDirective {
410
- commandCreator;
366
+ class SsvCommandRef {
367
+ #injector = inject(Injector);
368
+ commandCreator = input.required(...(ngDevMode ? [{ debugName: "commandCreator", alias: `ssvCommandRef` }] : [{
369
+ alias: `ssvCommandRef`
370
+ }]));
411
371
  get command() { return this._command; }
412
372
  _command;
373
+ constructor() {
374
+ const destroyRef = inject(DestroyRef);
375
+ destroyRef.onDestroy(() => {
376
+ this._command?.unsubscribe();
377
+ });
378
+ }
413
379
  ngOnInit() {
414
- if (isCommandCreator(this.commandCreator)) {
415
- const isAsync = this.commandCreator.isAsync || this.commandCreator.isAsync === undefined;
416
- const execFn = this.commandCreator.execute.bind(this.commandCreator.host);
417
- this._command = new Command(execFn, this.commandCreator.canExecute, isAsync);
380
+ if (isCommandCreator(this.commandCreator())) {
381
+ const commandCreator = this.commandCreator();
382
+ const isAsync = commandCreator.isAsync || commandCreator.isAsync === undefined;
383
+ const execFn = commandCreator.execute.bind(commandCreator.host);
384
+ this._command = command(execFn, commandCreator.canExecute, { isAsync, injector: this.#injector });
418
385
  }
419
386
  else {
420
387
  throw new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);
421
388
  }
422
389
  }
423
- ngOnDestroy() {
424
- // console.log("[commandRef::destroy]");
425
- if (this._command) {
426
- this._command.destroy();
427
- }
428
- }
429
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CommandRefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
430
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.9", type: CommandRefDirective, isStandalone: true, selector: "[ssvCommandRef]", inputs: { commandCreator: ["ssvCommandRef", "commandCreator"] }, exportAs: ["ssvCommandRef"], ngImport: i0 });
390
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommandRef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
391
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.7", type: SsvCommandRef, isStandalone: true, selector: "[ssvCommandRef]", inputs: { commandCreator: { classPropertyName: "commandCreator", publicName: "ssvCommandRef", isSignal: true, isRequired: true, transformFunction: null } }, exportAs: ["ssvCommandRef"], ngImport: i0 });
431
392
  }
432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: CommandRefDirective, decorators: [{
393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommandRef, decorators: [{
433
394
  type: Directive,
434
395
  args: [{
435
396
  selector: `[${NAME_CAMEL}]`,
436
397
  exportAs: NAME_CAMEL,
437
398
  standalone: true,
438
399
  }]
439
- }], propDecorators: { commandCreator: [{
440
- type: Input,
441
- args: [NAME_CAMEL]
442
- }] } });
400
+ }], ctorParameters: () => [], propDecorators: { commandCreator: [{ type: i0.Input, args: [{ isSignal: true, alias: "ssvCommandRef", required: true }] }] } });
443
401
 
444
402
  const EXPORTED_IMPORTS = [
445
- CommandDirective,
446
- CommandRefDirective
403
+ SsvCommand,
404
+ SsvCommandRef
447
405
  ];
406
+ /** @deprecated Use standalone instead. */
448
407
  class SsvCommandModule {
449
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: SsvCommandModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
450
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.9", ngImport: i0, type: SsvCommandModule, imports: [CommandDirective,
451
- CommandRefDirective], exports: [CommandDirective,
452
- CommandRefDirective] });
453
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: SsvCommandModule });
408
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommandModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
409
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.7", ngImport: i0, type: SsvCommandModule, imports: [SsvCommand,
410
+ SsvCommandRef], exports: [SsvCommand,
411
+ SsvCommandRef] });
412
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommandModule });
454
413
  }
455
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: SsvCommandModule, decorators: [{
414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: SsvCommandModule, decorators: [{
456
415
  type: NgModule,
457
416
  args: [{
458
417
  imports: [EXPORTED_IMPORTS],
@@ -460,11 +419,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImpor
460
419
  }]
461
420
  }] });
462
421
 
463
- const VERSION = "3.2.0";
422
+ const VERSION = "3.3.0-dev.82";
464
423
 
465
424
  /**
466
425
  * Generated bundle index. Do not edit.
467
426
  */
468
427
 
469
- export { COMMAND_OPTIONS, Command, CommandAsync, CommandDirective, CommandRefDirective, SsvCommandModule, VERSION, canExecuteFromNgForm, canExecuteFromSignals, command, commandAsync, isCommand, isCommandCreator, provideSsvCommandOptions };
428
+ export { COMMAND_OPTIONS, Command, CommandAsync, SsvCommand, SsvCommandModule, SsvCommandRef, VERSION, canExecuteFromNgForm, canExecuteFromSignals, command, commandAsync, isCommand, isCommandCreator, provideSsvCommandOptions };
470
429
  //# sourceMappingURL=ssv-ngx.command.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ssv-ngx.command.mjs","sources":["../../../../libs/ngx.command/src/command.options.ts","../../../../libs/ngx.command/src/command.ts","../../../../libs/ngx.command/src/command.util.ts","../../../../libs/ngx.command/src/command.directive.ts","../../../../libs/ngx.command/src/command-ref.directive.ts","../../../../libs/ngx.command/src/command.module.ts","../../../../libs/ngx.command/src/version.ts","../../../../libs/ngx.command/src/ssv-ngx.command.ts"],"sourcesContent":["import { type EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from \"@angular/core\";\n\nexport interface CommandOptions {\n\t/**\n\t * Css Class which gets added/removed on the Command element's host while Command `isExecuting$`.\n\t */\n\texecutingCssClass: string;\n\n\t/** Determines whether the disabled will be handled by the directive or not.\n\t * Disable handled by directive's doesn't always play nice when used with other component/pipe/directive and they also handle disabled.\n\t * This disables the handling manually and need to pass explicitly `[disabled]=\"!saveCmd.canExecute\"`.\n\t */\n\thandleDisabled: boolean;\n\n\t/** Determine whether to set a `delay(1)` when setting the disabled. Which might be needed when working with external\n\t * components/directives (such as material button)\n\t */\n\thasDisabledDelay: boolean;\n}\n\nconst DEFAULT_OPTIONS = Object.freeze<CommandOptions>({\n\texecutingCssClass: \"executing\",\n\thandleDisabled: true,\n\thasDisabledDelay: false,\n});\n\nexport const COMMAND_OPTIONS = new InjectionToken<CommandOptions>(\"SSV_COMMAND_OPTIONS\", {\n\tfactory: () => DEFAULT_OPTIONS,\n});\n\nexport function provideSsvCommandOptions(\n\toptions: Partial<CommandOptions> | ((defaults: Readonly<CommandOptions>) => Partial<CommandOptions>)\n): EnvironmentProviders {\n\treturn makeEnvironmentProviders([\n\t\t{\n\t\t\tprovide: COMMAND_OPTIONS,\n\t\t\tuseFactory: () => {\n\t\t\t\tlet opts = typeof options === \"function\" ? options(DEFAULT_OPTIONS) : options;\n\t\t\t\topts = opts\n\t\t\t\t\t? {\n\t\t\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\t\t\t...opts,\n\t\t\t\t\t}\n\t\t\t\t\t: DEFAULT_OPTIONS;\n\t\t\t\treturn opts;\n\t\t\t},\n\t\t},\n\t]);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n\tObservable, combineLatest, Subscription, Subject, BehaviorSubject, of, EMPTY,\n\ttap, map, filter, switchMap, catchError, finalize, take,\n} from \"rxjs\";\nimport type { ICommand } from \"./command.model\";\nimport { assertInInjectionContext, computed, DestroyRef, inject, Injector, isSignal, type Signal } from \"@angular/core\";\nimport { toObservable } from \"@angular/core/rxjs-interop\";\n\nexport type ExecuteFn = (...args: any[]) => unknown;\nexport type ExecuteAsyncFn = (...args: any[]) => Observable<unknown> | Promise<unknown>;\nexport type CanExecute = (() => boolean) | Signal<boolean> | Observable<boolean>;\n\nexport interface CommandCreateOptions {\n\tisAsync: boolean,\n\tinjector?: Injector;\n}\n\nconst COMMAND_ASYNC_DEFAULT_OPTIONS: CommandCreateOptions = { isAsync: true };\n\n/** Creates an async {@link Command}. Must be used within an injection context.\n * NOTE: this auto injects `DestroyRef` and handles auto destroy. {@link ICommand.autoDestroy} should not be used.\n */\nexport function commandAsync(\n\texecute: ExecuteAsyncFn,\n\tcanExecute$?: CanExecute,\n\topts?: Omit<CommandCreateOptions, \"isAsync\">,\n): Command {\n\treturn command(execute, canExecute$, opts ? { ...opts, ...COMMAND_ASYNC_DEFAULT_OPTIONS } : COMMAND_ASYNC_DEFAULT_OPTIONS);\n}\n\n/** Creates a {@link Command}. Must be used within an injection context.\n * NOTE: this auto injects `DestroyRef` and handles auto destroy. {@link ICommand.autoDestroy} should not be used.\n */\nexport function command(\n\texecute: ExecuteFn,\n\tcanExecute$?: CanExecute,\n\topts?: CommandCreateOptions,\n): Command {\n\tif (!opts?.injector) {\n\t\tassertInInjectionContext(command);\n\t}\n\tconst injector = opts?.injector ?? inject(Injector);\n\tconst isAsync = opts?.isAsync ?? false;\n\tconst destroyRef = injector.get(DestroyRef);\n\tconst cmd = new Command(execute, canExecute$, isAsync);\n\tcmd.autoDestroy = false;\n\n\tdestroyRef.onDestroy(() => {\n\t\t// console.warn(\"[command::destroy]\");\n\t\tcmd.destroy();\n\t});\n\treturn cmd;\n}\n\n/**\n * Command object used to encapsulate information which is needed to perform an action.\n * @deprecated Use {@link command} or {@link commandAsync} instead for creating instances.\n */\nexport class Command implements ICommand {\n\n\t/** Determines whether the command is currently executing, as a snapshot value. */\n\tget isExecuting(): boolean {\n\t\treturn this._isExecuting;\n\t}\n\n\t/** Determines whether the command can execute or not, as a snapshot value. */\n\tget canExecute(): boolean {\n\t\treturn this._canExecute;\n\t}\n\n\t/** Determines whether the command is currently executing, as an observable. */\n\tget isExecuting$(): Observable<boolean> {\n\t\treturn this._isExecuting$.asObservable();\n\t}\n\n\t/** Determines whether to auto destroy when having 0 subscribers. */\n\tautoDestroy = true;\n\n\t/** Determines whether the command can execute or not, as an observable. */\n\treadonly canExecute$: Observable<boolean>;\n\n\tprivate _isExecuting$ = new BehaviorSubject<boolean>(false);\n\tprivate _isExecuting = false;\n\tprivate _canExecute = true;\n\tprivate executionPipe$ = new Subject<unknown[] | undefined>();\n\tprivate isExecuting$$ = Subscription.EMPTY;\n\tprivate canExecute$$ = Subscription.EMPTY;\n\tprivate executionPipe$$ = Subscription.EMPTY;\n\tprivate subscribersCount = 0;\n\n\t/**\n\t * Creates an instance of Command.\n\t *\n\t * @param execute Execute function to invoke - use `isAsync: true` when `Observable<any>`.\n\t * @param canExecute Observable which determines whether it can execute or not.\n\t * @param isAsync Indicates that the execute function is async e.g. Observable.\n\t */\n\tconstructor(\n\t\texecute: ExecuteFn,\n\t\tcanExecute$?: CanExecute,\n\t\tisAsync?: boolean,\n\t\tinjector?: Injector,\n\t) {\n\t\tif (canExecute$) {\n\t\t\tconst canExecute = typeof canExecute$ === \"function\"\n\t\t\t\t? computed(canExecute$)\n\t\t\t\t: canExecute$;\n\t\t\tthis.canExecute$ = combineLatest([\n\t\t\t\tthis._isExecuting$,\n\t\t\t\tisSignal(canExecute) ? toObservable(canExecute, { injector }) : canExecute\n\t\t\t]).pipe(\n\t\t\t\tmap(([isExecuting, canExecuteResult]) => {\n\t\t\t\t\t// console.log(\"[command::combineLatest$] update!\", { isExecuting, canExecuteResult });\n\t\t\t\t\tthis._isExecuting = isExecuting;\n\t\t\t\t\tthis._canExecute = !isExecuting && !!canExecuteResult;\n\t\t\t\t\treturn this._canExecute;\n\t\t\t\t}),\n\t\t\t);\n\t\t\tthis.canExecute$$ = this.canExecute$.subscribe();\n\t\t} else {\n\t\t\tthis.canExecute$ = this._isExecuting$.pipe(\n\t\t\t\tmap(x => {\n\t\t\t\t\tconst canExecute = !x;\n\t\t\t\t\tthis._canExecute = canExecute;\n\t\t\t\t\treturn canExecute;\n\t\t\t\t})\n\t\t\t);\n\t\t\tthis.isExecuting$$ = this._isExecuting$\n\t\t\t\t.pipe(tap(x => this._isExecuting = x))\n\t\t\t\t.subscribe();\n\t\t}\n\t\tthis.executionPipe$$ = this.buildExecutionPipe(execute, isAsync).subscribe();\n\t}\n\n\t/** Execute function to invoke. */\n\texecute(...args: unknown[]): void {\n\t\t// console.warn(\"[command::execute]\", args);\n\t\tthis.executionPipe$.next(args);\n\t}\n\n\t/** Disposes all resources held by subscriptions. */\n\tdestroy(): void {\n\t\t// console.warn(\"[command::destroy]\");\n\t\tthis.executionPipe$$.unsubscribe();\n\t\tthis.canExecute$$.unsubscribe();\n\t\tthis.isExecuting$$.unsubscribe();\n\t}\n\n\tsubscribe(): void {\n\t\tthis.subscribersCount++;\n\t}\n\n\tunsubscribe(): void {\n\t\tthis.subscribersCount--;\n\t\t// console.log(\"[command::unsubscribe]\", { autoDestroy: this.autoDestroy, subscribersCount: this.subscribersCount });\n\t\tif (this.autoDestroy && this.subscribersCount <= 0) {\n\t\t\tthis.destroy();\n\t\t}\n\t}\n\n\tprivate buildExecutionPipe(execute: (...args: unknown[]) => any, isAsync?: boolean): Observable<unknown> {\n\t\tlet pipe$ = this.executionPipe$.pipe(\n\t\t\t// tap(x => console.warn(\">>>> executionPipe\", this._canExecute)),\n\t\t\tfilter(() => this._canExecute),\n\t\t\ttap(() => {\n\t\t\t\t// console.log(\"[command::executionPipe$] do#1 - set execute\", { args: x });\n\t\t\t\tthis._isExecuting$.next(true);\n\t\t\t})\n\t\t);\n\n\t\tconst execFn = isAsync\n\t\t\t? switchMap<unknown[] | undefined, any[]>(args => {\n\t\t\t\tif (args) {\n\t\t\t\t\treturn execute(...args);\n\t\t\t\t}\n\t\t\t\treturn execute();\n\t\t\t})\n\t\t\t: tap((args: unknown[] | undefined) => {\n\t\t\t\tif (args) {\n\t\t\t\t\texecute(...args);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\texecute();\n\t\t\t});\n\n\t\tpipe$ = pipe$.pipe(\n\t\t\tswitchMap(args => of(args).pipe(\n\t\t\t\texecFn,\n\t\t\t\tfinalize(() => {\n\t\t\t\t\t// console.log(\"[command::executionPipe$] finalize inner#1 - set idle\");\n\t\t\t\t\tthis._isExecuting$.next(false);\n\t\t\t\t}),\n\t\t\t\ttake(1),\n\t\t\t\tcatchError(error => {\n\t\t\t\t\tconsole.error(\"Unhandled execute error\", error);\n\t\t\t\t\treturn EMPTY;\n\t\t\t\t}),\n\t\t\t)),\n\t\t\ttap(\n\t\t\t\t() => {\n\t\t\t\t\t// console.log(\"[command::executionPipe$] tap#2 - set idle\");\n\t\t\t\t\tthis._isExecuting$.next(false);\n\t\t\t\t},\n\t\t\t)\n\t\t);\n\t\treturn pipe$;\n\t}\n\n}\n\n/**\n * Async Command object used to encapsulate information which is needed to perform an action,\n * which takes an execute function as Observable/Promise.\n * @deprecated Use {@link commandAsync} instead.\n */\nexport class CommandAsync extends Command {\n\n\tconstructor(\n\t\texecute: ExecuteAsyncFn,\n\t\tcanExecute$?: CanExecute,\n\t) {\n\t\tsuper(execute, canExecute$, true);\n\t}\n\n}\n","import { AbstractControl, PristineChangeEvent, StatusChangeEvent } from \"@angular/forms\";\nimport { Observable, map, distinctUntilChanged, filter, combineLatest, of, defer, concat } from \"rxjs\";\n\nimport { CommandCreator, ICommand } from \"./command.model\";\nimport { Command } from \"./command\";\nimport { type Signal, computed } from \"@angular/core\";\n\n/** Determines whether the arg object is of type `Command`. */\nexport function isCommand(arg: unknown): arg is ICommand {\n\treturn arg instanceof Command;\n}\n\n/** Determines whether the arg object is of type `CommandCreator`. */\nexport function isCommandCreator(arg: unknown): arg is CommandCreator {\n\tif (arg instanceof Command) {\n\t\treturn false;\n\t} else if (isAssumedType<CommandCreator>(arg) && arg.execute && arg.host) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport interface CanExecuteFormOptions {\n\t/** Determines whether to check for validity. (defaults: true) */\n\tvalidity?: boolean;\n\n\t/** Determines whether to check whether UI has been touched. (defaults: true) */\n\tdirty?: boolean;\n}\n\nconst CAN_EXECUTE_FORM_OPTIONS_DEFAULTS = Object.freeze<CanExecuteFormOptions>({\n\tvalidity: true,\n\tdirty: true,\n})\n\n/** Get can execute from form validity/pristine as an observable. */\nexport function canExecuteFromNgForm(\n\tform: AbstractControl,\n\toptions?: CanExecuteFormOptions\n): Observable<boolean> {\n\tconst opts: CanExecuteFormOptions = options ?\n\t\t{ ...CAN_EXECUTE_FORM_OPTIONS_DEFAULTS, ...options }\n\t\t: CAN_EXECUTE_FORM_OPTIONS_DEFAULTS;\n\n\tconst pristine$ = opts.dirty\n\t\t? concat(\n\t\t\tdefer(() => of(form.pristine)),\n\t\t\tform.events.pipe(\n\t\t\t\tfilter(x => x instanceof PristineChangeEvent),\n\t\t\t\tmap(x => x.pristine),\n\t\t\t)\n\t\t).pipe(distinctUntilChanged(),)\n\t\t: of(true);\n\n\tconst valid$ = opts.validity\n\t\t? concat(\n\t\t\tdefer(() => of(form.valid)),\n\t\t\tform.events.pipe(\n\t\t\t\tfilter(x => x instanceof StatusChangeEvent),\n\t\t\t\tmap(x => x.status === \"VALID\"),\n\t\t\t)\n\t\t).pipe(distinctUntilChanged(),)\n\t\t: of(true);\n\n\treturn combineLatest([pristine$, valid$]).pipe(\n\t\tmap(([pristine, valid]) => !!(!opts.validity || valid) && !!(!opts.dirty || !pristine)),\n\t\tdistinctUntilChanged(),\n\t);\n}\n\n/** Can executed based on valid/dirty signal inputs. */\nexport function canExecuteFromSignals(\n\tsignals: { valid: Signal<boolean>, dirty: Signal<boolean> },\n\toptions?: CanExecuteFormOptions\n): Signal<boolean> {\n\tconst opts: CanExecuteFormOptions = options ?\n\t\t{ ...CAN_EXECUTE_FORM_OPTIONS_DEFAULTS, ...options }\n\t\t: CAN_EXECUTE_FORM_OPTIONS_DEFAULTS;\n\treturn computed(() => !!(!opts.validity || signals.valid()) && !!(!opts.dirty || signals.dirty()));\n}\n\n\nfunction isAssumedType<T = Record<string, unknown>>(x: unknown): x is Partial<T> {\n\treturn x !== null && typeof x === \"object\";\n}\n","import {\n\tDirective,\n\tOnInit,\n\tOnDestroy,\n\tInput,\n\tHostListener,\n\tElementRef,\n\tRenderer2,\n\tChangeDetectorRef,\n\tinject,\n} from \"@angular/core\";\nimport { Subject, tap, delay, takeUntil } from \"rxjs\";\n\nimport { type CommandOptions, COMMAND_OPTIONS } from \"./command.options\";\nimport { Command } from \"./command\";\nimport { isCommand, isCommandCreator } from \"./command.util\";\nimport { CommandCreator, type ICommand } from \"./command.model\";\n\n/**\n * Controls the state of a component in sync with `Command`.\n *\n * @example\n * ### Most common usage\n * ```html\n * <button [ssvCommand]=\"saveCmd\">Save</button>\n * ```\n *\n *\n * ### Usage with options\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandOptions]=\"{executingCssClass: 'in-progress'}\">Save</button>\n * ```\n *\n *\n * ### Usage with params\n * This is useful for collections (loops) or using multiple actions with different args.\n * *NOTE: This will share the `isExecuting` when used with multiple controls.*\n *\n * #### With single param\n *\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandParams]=\"{id: 1}\">Save</button>\n * ```\n * *NOTE: if you have only 1 argument as an array, it should be enclosed within an array e.g. `[['apple', 'banana']]`,\n * else it will spread and you will `arg1: \"apple\", arg2: \"banana\"`*\n *\n * #### With multi params\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandParams]=\"[{id: 1}, 'hello', hero]\">Save</button>\n * ```\n *\n * ### Usage with Command Creator\n * This is useful for collections (loops) or using multiple actions with different args, whilst not sharing `isExecuting`.\n *\n *\n * ```html\n * <button [ssvCommand]=\"{host: this, execute: removeHero$, canExecute: isValid$, params: [hero, 1337, 'xx']}\">Save</button>\n * ```\n *\n */\n\nconst NAME_CAMEL = \"ssvCommand\";\n\n// let nextUniqueId = 0;\n\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n\texportAs: NAME_CAMEL,\n\tstandalone: true,\n})\nexport class CommandDirective implements OnInit, OnDestroy {\n\n\t// readonly id = `${NAME_CAMEL}-${nextUniqueId++}`;\n\tprivate readonly globalOptions = inject(COMMAND_OPTIONS);\n\tprivate readonly renderer = inject(Renderer2);\n\tprivate readonly element = inject(ElementRef);\n\tprivate readonly cdr = inject(ChangeDetectorRef);\n\n\t@Input(NAME_CAMEL) commandOrCreator: ICommand | CommandCreator | undefined;\n\n\t@Input(`${NAME_CAMEL}Options`)\n\tget commandOptions(): CommandOptions { return this._commandOptions; }\n\tset commandOptions(value: Partial<CommandOptions>) {\n\t\tif (value === this._commandOptions) {\n\t\t\treturn;\n\t\t}\n\t\tthis._commandOptions = {\n\t\t\t...this.globalOptions,\n\t\t\t...value,\n\t\t};\n\t}\n\n\t@Input(`${NAME_CAMEL}Params`) commandParams: unknown | unknown[];\n\n\tget command(): ICommand { return this._command; }\n\n\tprivate _command!: ICommand;\n\tprivate _commandOptions: CommandOptions = this.globalOptions;\n\tprivate _destroy$ = new Subject<void>();\n\n\tngOnInit(): void {\n\t\t// console.log(\"[ssvCommand::init]\", this.globalOptions);\n\t\tif (!this.commandOrCreator) {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] should be defined!`);\n\t\t} else if (isCommand(this.commandOrCreator)) {\n\t\t\tthis._command = this.commandOrCreator;\n\t\t} else if (isCommandCreator(this.commandOrCreator)) {\n\t\t\tconst isAsync = this.commandOrCreator.isAsync || this.commandOrCreator.isAsync === undefined;\n\n\t\t\t// todo: find something like this for ivy (or angular10+)\n\t\t\t// const hostComponent = (this.viewContainer as any)._view.component;\n\n\t\t\tconst execFn = this.commandOrCreator.execute.bind(this.commandOrCreator.host);\n\t\t\tthis.commandParams = this.commandParams || this.commandOrCreator.params;\n\n\t\t\tconst canExec = this.commandOrCreator.canExecute instanceof Function\n\t\t\t\t? this.commandOrCreator.canExecute.bind(this.commandOrCreator.host, this.commandParams)()\n\t\t\t\t: this.commandOrCreator.canExecute;\n\n\t\t\t// console.log(\"[ssvCommand::init] command creator\", {\n\t\t\t// \tfirstParam: this.commandParams ? this.commandParams[0] : null,\n\t\t\t// \tparams: this.commandParams\n\t\t\t// });\n\t\t\tthis._command = new Command(execFn, canExec, isAsync);\n\t\t} else {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);\n\t\t}\n\n\t\tthis._command.subscribe();\n\t\tthis._command.canExecute$.pipe(\n\t\t\tthis.commandOptions.hasDisabledDelay\n\t\t\t\t? delay(1)\n\t\t\t\t: tap(() => { /* stub */ }),\n\t\t\ttap(x => {\n\t\t\t\tthis.trySetDisabled(!x);\n\t\t\t\t// console.log(\"[ssvCommand::canExecute$]\", { canExecute: x });\n\t\t\t\tthis.cdr.markForCheck();\n\t\t\t}),\n\t\t\ttakeUntil(this._destroy$),\n\t\t).subscribe();\n\n\t\tif (this._command.isExecuting$) {\n\t\t\tthis._command.isExecuting$.pipe(\n\t\t\t\ttap(x => {\n\t\t\t\t\t// console.log(\"[ssvCommand::isExecuting$]\", x, this.commandOptions);\n\t\t\t\t\tif (x) {\n\t\t\t\t\t\tthis.renderer.addClass(\n\t\t\t\t\t\t\tthis.element.nativeElement,\n\t\t\t\t\t\t\tthis.commandOptions.executingCssClass\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.renderer.removeClass(\n\t\t\t\t\t\t\tthis.element.nativeElement,\n\t\t\t\t\t\t\tthis.commandOptions.executingCssClass\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\ttakeUntil(this._destroy$),\n\t\t\t).subscribe();\n\t\t}\n\t}\n\n\t@HostListener(\"click\")\n\tonClick(): void {\n\t\t// console.log(\"[ssvCommand::onClick]\", this.commandParams);\n\t\tif (Array.isArray(this.commandParams)) {\n\t\t\tthis._command.execute(...this.commandParams);\n\t\t} else {\n\t\t\tthis._command.execute(this.commandParams);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\t// console.log(\"[ssvCommand::destroy]\");\n\t\tthis._destroy$.next();\n\t\tthis._destroy$.complete();\n\t\tif (this._command) {\n\t\t\tthis._command.unsubscribe();\n\t\t}\n\t}\n\n\tprivate trySetDisabled(disabled: boolean) {\n\t\tif (this.commandOptions.handleDisabled) {\n\t\t\t// console.warn(\">>>> disabled\", { id: this.id, disabled });\n\t\t\tthis.renderer.setProperty(this.element.nativeElement, \"disabled\", disabled);\n\t\t}\n\t}\n\n}\n\n","import { Observable } from \"rxjs\";\nimport { Directive, OnInit, OnDestroy, Input } from \"@angular/core\";\n\nimport { ICommand, CommandCreator } from \"./command.model\";\nimport { isCommandCreator } from \"./command.util\";\nimport { Command } from \"./command\";\n\nconst NAME_CAMEL = \"ssvCommandRef\";\n\n/**\n * Command creator ref, directive which allows creating Command in the template\n * and associate it to a command (in order to share executions).\n * @example\n * ### Most common usage\n * ```html\n * <div #actionCmd=\"ssvCommandRef\" [ssvCommandRef]=\"{host: this, execute: removeHero$, canExecute: isValid$}\">\n * <button [ssvCommand]=\"actionCmd.command\" [ssvCommandParams]=\"hero\">\n * Remove\n * </button>\n * <button [ssvCommand]=\"actionCmd.command\" [ssvCommandParams]=\"hero\">\n * Remove\n * </button>\n * </div>\n * ```\n *\n */\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n\texportAs: NAME_CAMEL,\n\tstandalone: true,\n})\nexport class CommandRefDirective implements OnInit, OnDestroy {\n\n\t@Input(NAME_CAMEL) commandCreator: CommandCreator | undefined;\n\n\tget command(): ICommand { return this._command; }\n\tprivate _command!: ICommand;\n\n\tngOnInit(): void {\n\t\tif (isCommandCreator(this.commandCreator)) {\n\t\t\tconst isAsync = this.commandCreator.isAsync || this.commandCreator.isAsync === undefined;\n\n\t\t\tconst execFn = this.commandCreator.execute.bind(this.commandCreator.host);\n\t\t\tthis._command = new Command(execFn, this.commandCreator.canExecute as Observable<boolean> | undefined, isAsync);\n\t\t} else {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\t// console.log(\"[commandRef::destroy]\");\n\t\tif (this._command) {\n\t\t\tthis._command.destroy();\n\t\t}\n\t}\n\n}\n","import { NgModule } from \"@angular/core\";\n\nimport { CommandDirective } from \"./command.directive\";\nimport { CommandRefDirective } from \"./command-ref.directive\";\n\nconst EXPORTED_IMPORTS = [\n\tCommandDirective,\n\tCommandRefDirective\n];\n\n@NgModule({\n\timports: [EXPORTED_IMPORTS],\n\texports: [EXPORTED_IMPORTS]\n})\nexport class SsvCommandModule {\n\n}\n","export const VERSION = \"3.2.0\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["NAME_CAMEL"],"mappings":";;;;;;AAoBA,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAiB;AACrD,IAAA,iBAAiB,EAAE,WAAW;AAC9B,IAAA,cAAc,EAAE,IAAI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AC,gBAAgB,CAAC;AAC3B,iBAAA,CAAA;;;ACbM,MAAM,OAAO,GAAG;;ACAvB;;AAEG;;;;"}
1
+ {"version":3,"file":"ssv-ngx.command.mjs","sources":["../../../../libs/ngx.command/src/command.options.ts","../../../../libs/ngx.command/src/command.ts","../../../../libs/ngx.command/src/command.util.ts","../../../../libs/ngx.command/src/command.directive.ts","../../../../libs/ngx.command/src/command-ref.directive.ts","../../../../libs/ngx.command/src/command.module.ts","../../../../libs/ngx.command/src/version.ts","../../../../libs/ngx.command/src/ssv-ngx.command.ts"],"sourcesContent":["import { InjectionToken, type Provider } from \"@angular/core\";\n\nexport interface CommandOptions {\n\t/**\n\t * Css Class which gets added/removed on the Command element's host while Command `isExecuting$`.\n\t */\n\texecutingCssClass: string;\n\n\t/** Determines whether the disabled will be handled by the directive or not.\n\t * Disable handled by directive's doesn't always play nice when used with other component/pipe/directive and they also handle disabled.\n\t * This disables the handling manually and need to pass explicitly `[disabled]=\"!saveCmd.canExecute\"`.\n\t */\n\thandleDisabled: boolean;\n}\n\nconst DEFAULT_OPTIONS = Object.freeze<CommandOptions>({\n\texecutingCssClass: \"executing\",\n\thandleDisabled: true,\n});\n\nexport const COMMAND_OPTIONS = new InjectionToken<CommandOptions>(\"SSV_COMMAND_OPTIONS\", {\n\tfactory: () => DEFAULT_OPTIONS,\n});\n\nexport function provideSsvCommandOptions(\n\toptions: Partial<CommandOptions> | ((defaults: Readonly<CommandOptions>) => Partial<CommandOptions>)\n): Provider[] {\n\treturn [\n\t\t{\n\t\t\tprovide: COMMAND_OPTIONS,\n\t\t\tuseFactory: () => {\n\t\t\t\tlet opts = typeof options === \"function\" ? options(DEFAULT_OPTIONS) : options;\n\t\t\t\topts = opts\n\t\t\t\t\t? {\n\t\t\t\t\t\t...DEFAULT_OPTIONS,\n\t\t\t\t\t\t...opts,\n\t\t\t\t\t}\n\t\t\t\t\t: DEFAULT_OPTIONS;\n\t\t\t\treturn opts;\n\t\t\t},\n\t\t},\n\t];\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n\tObservable, Subscription, Subject, of, EMPTY,\n\ttap, filter, switchMap, catchError, finalize, take,\n} from \"rxjs\";\nimport { toSignal } from \"@angular/core/rxjs-interop\";\nimport type { CanExecute, ExecuteAsyncFn, ExecuteFn, ICommand } from \"./command.model\";\nimport { assertInInjectionContext, computed, DestroyRef, inject, Injector, isSignal, signal, type Signal } from \"@angular/core\";\n\nexport interface CommandCreateOptions {\n\tisAsync: boolean,\n\tinjector?: Injector;\n}\n\nconst COMMAND_ASYNC_DEFAULT_OPTIONS: CommandCreateOptions = { isAsync: true };\n\n/** Creates an async {@link Command}. Must be used within an injection context.\n * NOTE: this auto injects `DestroyRef` and handles auto destroy. {@link ICommand.autoDestroy} should not be used.\n */\nexport function commandAsync(\n\texecute: ExecuteAsyncFn,\n\tcanExecute$?: CanExecute,\n\topts?: Omit<CommandCreateOptions, \"isAsync\">,\n): Command {\n\treturn command(execute, canExecute$, opts ? { ...opts, ...COMMAND_ASYNC_DEFAULT_OPTIONS } : COMMAND_ASYNC_DEFAULT_OPTIONS);\n}\n\n/** Creates a {@link Command}. Must be used within an injection context.\n * NOTE: this auto injects `DestroyRef` and handles auto destroy. {@link ICommand.autoDestroy} should not be used.\n */\nexport function command(\n\texecute: ExecuteFn,\n\tcanExecute$?: CanExecute,\n\topts?: CommandCreateOptions,\n): Command {\n\tif (!opts?.injector) {\n\t\tassertInInjectionContext(command);\n\t}\n\tconst injector = opts?.injector ?? inject(Injector);\n\tconst isAsync = opts?.isAsync ?? false;\n\tconst destroyRef = injector.get(DestroyRef);\n\tconst cmd = new Command(execute, canExecute$, isAsync, injector);\n\tcmd.autoDestroy = false;\n\n\tdestroyRef.onDestroy(() => {\n\t\t// console.warn(\"[command::destroy]\");\n\t\tcmd.destroy();\n\t});\n\treturn cmd;\n}\n\n/**\n * Command object used to encapsulate information which is needed to perform an action.\n *\n */\nexport class Command implements ICommand {\n\n\tget isExecuting(): boolean { return this.$isExecuting(); }\n\n\tget canExecute(): boolean { return this.$canExecute(); }\n\n\treadonly $isExecuting = signal(false);\n\treadonly $canExecute = computed(() => !this.$isExecuting() && this._$canExecute());\n\n\tprivate readonly _$canExecute: Signal<boolean>;\n\n\tautoDestroy = true;\n\n\tprivate executionPipe$ = new Subject<unknown[] | undefined>();\n\tprivate executionPipe$$ = Subscription.EMPTY;\n\tprivate subscribersCount = 0;\n\n\t/**\n\t * Creates an instance of Command.\n\t *\n\t * @param execute Execute function to invoke - use `isAsync: true` when `Observable<any>`.\n\t * @param canExecute Observable which determines whether it can execute or not.\n\t * @param isAsync Indicates that the execute function is async e.g. Observable.\n\t * @deprecated Use {@link command} or {@link commandAsync} instead for creating instances.\n\t */\n\tconstructor(\n\t\texecute: ExecuteFn,\n\t\tcanExecute$?: CanExecute,\n\t\tisAsync?: boolean,\n\t\tinjector?: Injector,\n\t) {\n\t\tif (canExecute$) {\n\t\t\tconst canExecute = typeof canExecute$ === \"function\"\n\t\t\t\t? computed(canExecute$)\n\t\t\t\t: canExecute$;\n\t\t\tthis._$canExecute = isSignal(canExecute)\n\t\t\t\t? canExecute\n\t\t\t\t: toSignal(canExecute, { initialValue: false, injector });\n\t\t} else {\n\t\t\tthis._$canExecute = signal(true);\n\t\t}\n\t\tthis.executionPipe$$ = this.buildExecutionPipe(execute, isAsync).subscribe();\n\t}\n\n\t/** Execute function to invoke. */\n\texecute(...args: unknown[]): void {\n\t\t// console.warn(\"[command::execute]\", args);\n\t\tthis.executionPipe$.next(args);\n\t}\n\n\t/** Disposes all resources held by subscriptions. */\n\tdestroy(): void {\n\t\t// console.warn(\"[command::destroy]\");\n\t\tthis.executionPipe$$.unsubscribe();\n\t}\n\n\tsubscribe(): void {\n\t\tthis.subscribersCount++;\n\t}\n\n\tunsubscribe(): void {\n\t\tthis.subscribersCount--;\n\t\t// console.log(\"[command::unsubscribe]\", { autoDestroy: this.autoDestroy, subscribersCount: this.subscribersCount });\n\t\tif (this.autoDestroy && this.subscribersCount <= 0) {\n\t\t\tthis.destroy();\n\t\t}\n\t}\n\n\tprivate buildExecutionPipe(execute: (...args: unknown[]) => any, isAsync?: boolean): Observable<unknown> {\n\t\tlet pipe$ = this.executionPipe$.pipe(\n\t\t\t// tap(x => console.warn(\">>>> executionPipe\", this._canExecute)),\n\t\t\tfilter(() => this.$canExecute()),\n\t\t\ttap(() => {\n\t\t\t\t// console.log(\"[command::executionPipe$] do#1 - set execute\", { args: x });\n\t\t\t\tthis.$isExecuting.set(true);\n\t\t\t})\n\t\t);\n\n\t\tconst execFn = isAsync\n\t\t\t? switchMap<unknown[] | undefined, any[]>(args => {\n\t\t\t\tif (args) {\n\t\t\t\t\treturn execute(...args);\n\t\t\t\t}\n\t\t\t\treturn execute();\n\t\t\t})\n\t\t\t: tap((args: unknown[] | undefined) => {\n\t\t\t\tif (args) {\n\t\t\t\t\texecute(...args);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\texecute();\n\t\t\t});\n\n\t\tpipe$ = pipe$.pipe(\n\t\t\tswitchMap(args => of(args).pipe(\n\t\t\t\texecFn,\n\t\t\t\tfinalize(() => {\n\t\t\t\t\t// console.log(\"[command::executionPipe$] finalize inner#1 - set idle\");\n\t\t\t\t\tthis.$isExecuting.set(false);\n\t\t\t\t}),\n\t\t\t\ttake(1),\n\t\t\t\tcatchError(error => {\n\t\t\t\t\tconsole.error(\"Unhandled execute error\", error);\n\t\t\t\t\treturn EMPTY;\n\t\t\t\t}),\n\t\t\t)),\n\t\t\ttap(() => {\n\t\t\t\t// console.log(\"[command::executionPipe$] tap#2 - set idle\");\n\t\t\t\t// this._isExecuting$.next(false);\n\t\t\t\tthis.$isExecuting.set(false);\n\t\t\t}),\n\t\t);\n\t\treturn pipe$;\n\t}\n\n}\n\n/**\n * Async Command object used to encapsulate information which is needed to perform an action,\n * which takes an execute function as Observable/Promise.\n * @deprecated Use {@link commandAsync} instead.\n */\nexport class CommandAsync extends Command {\n\n\t/**\n\t * @deprecated Use {@link commandAsync} instead to create an instance.\n\t */\n\tconstructor(\n\t\texecute: ExecuteAsyncFn,\n\t\tcanExecute$?: CanExecute,\n\t) {\n\t\tsuper(execute, canExecute$, true);\n\t}\n\n}\n","import { AbstractControl, PristineChangeEvent, StatusChangeEvent } from \"@angular/forms\";\nimport { Observable, map, distinctUntilChanged, filter, combineLatest, of, defer, concat } from \"rxjs\";\n\nimport { CommandCreator, ICommand } from \"./command.model\";\nimport { Command } from \"./command\";\nimport { type Signal, computed } from \"@angular/core\";\n\n/** Determines whether the arg object is of type `Command`. */\nexport function isCommand(arg: unknown): arg is ICommand {\n\treturn arg instanceof Command;\n}\n\n/** Determines whether the arg object is of type `CommandCreator`. */\nexport function isCommandCreator(arg: unknown): arg is CommandCreator {\n\tif (arg instanceof Command) {\n\t\treturn false;\n\t} else if (isAssumedType<CommandCreator>(arg) && arg.execute && arg.host) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport interface CanExecuteFormOptions {\n\t/** Determines whether to check for validity. (defaults: true) */\n\tvalidity?: boolean;\n\n\t/** Determines whether to check whether UI has been touched. (defaults: true) */\n\tdirty?: boolean;\n}\n\nconst CAN_EXECUTE_FORM_OPTIONS_DEFAULTS = Object.freeze<CanExecuteFormOptions>({\n\tvalidity: true,\n\tdirty: true,\n})\n\n/** Get can execute from form validity/pristine as an observable. */\nexport function canExecuteFromNgForm(\n\tform: AbstractControl,\n\toptions?: CanExecuteFormOptions\n): Observable<boolean> {\n\tconst opts: CanExecuteFormOptions = options ?\n\t\t{ ...CAN_EXECUTE_FORM_OPTIONS_DEFAULTS, ...options }\n\t\t: CAN_EXECUTE_FORM_OPTIONS_DEFAULTS;\n\n\tconst pristine$ = opts.dirty\n\t\t? concat(\n\t\t\tdefer(() => of(form.pristine)),\n\t\t\tform.events.pipe(\n\t\t\t\tfilter(x => x instanceof PristineChangeEvent),\n\t\t\t\tmap(x => x.pristine),\n\t\t\t)\n\t\t).pipe(distinctUntilChanged(),)\n\t\t: of(true);\n\n\tconst valid$ = opts.validity\n\t\t? concat(\n\t\t\tdefer(() => of(form.valid)),\n\t\t\tform.events.pipe(\n\t\t\t\tfilter(x => x instanceof StatusChangeEvent),\n\t\t\t\tmap(x => x.status === \"VALID\"),\n\t\t\t)\n\t\t).pipe(distinctUntilChanged(),)\n\t\t: of(true);\n\n\treturn combineLatest([pristine$, valid$]).pipe(\n\t\tmap(([pristine, valid]) => !!(!opts.validity || valid) && !!(!opts.dirty || !pristine)),\n\t\tdistinctUntilChanged(),\n\t);\n}\n\n/** Can executed based on valid/dirty signal inputs. */\nexport function canExecuteFromSignals(\n\tsignals: { valid: Signal<boolean>, dirty: Signal<boolean> },\n\toptions?: CanExecuteFormOptions\n): Signal<boolean> {\n\tconst opts: CanExecuteFormOptions = options ?\n\t\t{ ...CAN_EXECUTE_FORM_OPTIONS_DEFAULTS, ...options }\n\t\t: CAN_EXECUTE_FORM_OPTIONS_DEFAULTS;\n\treturn computed(() => !!(!opts.validity || signals.valid()) && !!(!opts.dirty || signals.dirty()));\n}\n\n\nfunction isAssumedType<T = Record<string, unknown>>(x: unknown): x is Partial<T> {\n\treturn x !== null && typeof x === \"object\";\n}\n","import {\n\tDirective,\n\tOnInit,\n\tElementRef,\n\tRenderer2,\n\tChangeDetectorRef,\n\tinject,\n\teffect,\n\tinput,\n\tInjector,\n\tcomputed,\n\tDestroyRef,\n} from \"@angular/core\";\n\nimport { type CommandOptions, COMMAND_OPTIONS } from \"./command.options\";\nimport { command } from \"./command\";\nimport { isCommand, isCommandCreator } from \"./command.util\";\nimport { CommandCreator, type ICommand } from \"./command.model\";\n\n/**\n * Controls the state of a component in sync with `Command`.\n *\n * @example\n * ### Most common usage\n * ```html\n * <button [ssvCommand]=\"saveCmd\">Save</button>\n * ```\n *\n *\n * ### Usage with options\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandOptions]=\"{executingCssClass: 'in-progress'}\">Save</button>\n * ```\n *\n *\n * ### Usage with params\n * This is useful for collections (loops) or using multiple actions with different args.\n * *NOTE: This will share the `isExecuting` when used with multiple controls.*\n *\n * #### With single param\n *\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandParams]=\"{id: 1}\">Save</button>\n * ```\n * *NOTE: if you have only 1 argument as an array, it should be enclosed within an array e.g. `[['apple', 'banana']]`,\n * else it will spread and you will `arg1: \"apple\", arg2: \"banana\"`*\n *\n * #### With multi params\n * ```html\n * <button [ssvCommand]=\"saveCmd\" [ssvCommandParams]=\"[{id: 1}, 'hello', hero]\">Save</button>\n * ```\n *\n * ### Usage with Command Creator\n * This is useful for collections (loops) or using multiple actions with different args, whilst not sharing `isExecuting`.\n *\n *\n * ```html\n * <button [ssvCommand]=\"{host: this, execute: removeHero$, canExecute: isValid$, params: [hero, 1337, 'xx']}\">Save</button>\n * ```\n *\n */\n\nconst NAME_CAMEL = \"ssvCommand\";\n\n// let nextUniqueId = 0;\n\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n\thost: {\n\t\t\"[class]\": \"_hostClasses()\",\n\t\t\"(click)\": \"_handleClick()\",\n\t},\n\texportAs: NAME_CAMEL,\n\tstandalone: true,\n})\nexport class SsvCommand implements OnInit {\n\n\t// readonly id = `${NAME_CAMEL}-${nextUniqueId++}`;\n\treadonly #options = inject(COMMAND_OPTIONS);\n\treadonly #renderer = inject(Renderer2);\n\treadonly #element = inject(ElementRef);\n\treadonly #cdr = inject(ChangeDetectorRef);\n\treadonly #injector = inject(Injector);\n\n\treadonly commandOrCreator = input.required<ICommand | CommandCreator>({\n\t\talias: `ssvCommand`\n\t});\n\treadonly ssvCommandOptions = input<Partial<CommandOptions>>(this.#options);\n\treadonly commandOptions = computed<CommandOptions>(() => {\n\t\tconst value = this.ssvCommandOptions();\n\t\tif (value === this.#options) {\n\t\t\treturn this.#options;\n\t\t}\n\t\treturn {\n\t\t\t...this.#options,\n\t\t\t...value,\n\t\t};\n\t});\n\treadonly ssvCommandParams = input<unknown | unknown[]>(undefined);\n\treadonly commandParams = computed<unknown | unknown[]>(() => this.ssvCommandParams() || this.creatorParams);\n\treadonly _hostClasses = computed(() => [\"ssv-command\", this.#executingClass()]);\n\treadonly #executingClass = computed(() => this._command.$isExecuting() ? this.commandOptions().executingCssClass : \"\");\n\n\tprivate creatorParams: unknown | unknown[] = [];\n\n\tget command(): ICommand { return this._command; }\n\n\tprivate _command!: ICommand;\n\n\tconstructor() {\n\t\tconst destroyRef = inject(DestroyRef);\n\t\tdestroyRef.onDestroy(() => {\n\t\t\tthis._command?.unsubscribe();\n\t\t});\n\t\teffect(() => {\n\t\t\tconst canExecute = this._command.$canExecute();\n\t\t\tthis.trySetDisabled(!canExecute);\n\t\t\t// console.log(\"[ssvCommand::canExecute$]\", { canExecute: x });\n\t\t\tthis.#cdr.markForCheck();\n\t\t});\n\t}\n\n\tngOnInit(): void {\n\t\tconst commandOrCreator = this.commandOrCreator();\n\t\t// console.log(\"[ssvCommand::init]\", this.#options);\n\t\tif (isCommand(commandOrCreator)) {\n\t\t\tthis._command = commandOrCreator;\n\t\t} else if (isCommandCreator(commandOrCreator)) {\n\t\t\tconst isAsync = commandOrCreator.isAsync || commandOrCreator.isAsync === undefined;\n\t\t\tthis.creatorParams = commandOrCreator.params;\n\n\t\t\t// todo: find something like this for ivy (or angular10+)\n\t\t\t// const hostComponent = (this.viewContainer as any)._view.component;\n\n\t\t\tconst execFn = commandOrCreator.execute.bind(commandOrCreator.host);\n\t\t\tconst params = this.commandParams();\n\n\t\t\tconst canExec = commandOrCreator.canExecute instanceof Function\n\t\t\t\t? commandOrCreator.canExecute.bind(commandOrCreator.host, params)()\n\t\t\t\t: commandOrCreator.canExecute;\n\n\t\t\t// console.log(\"[ssvCommand::init] command creator\", {\n\t\t\t// \tfirstParam: params ? params[0] : null,\n\t\t\t// \tparams\n\t\t\t// });\n\n\t\t\tthis._command = command(execFn, canExec, { isAsync, injector: this.#injector });\n\t\t} else {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);\n\t\t}\n\n\t\tthis._command.subscribe();\n\t}\n\n\t_handleClick(): void {\n\t\tconst commandParams = this.commandParams();\n\t\t// console.log(\"[ssvCommand::onClick]\", commandParams);\n\t\tif (Array.isArray(commandParams)) {\n\t\t\tthis._command.execute(...commandParams);\n\t\t} else {\n\t\t\tthis._command.execute(commandParams);\n\t\t}\n\t}\n\n\tprivate trySetDisabled(disabled: boolean) {\n\t\tif (this.commandOptions().handleDisabled) {\n\t\t\t// console.warn(\">>>> disabled\", { id: this.id, disabled });\n\t\t\tthis.#renderer.setProperty(this.#element.nativeElement, \"disabled\", disabled);\n\t\t}\n\t}\n\n}\n\n","import { Directive, OnInit, inject, Injector, DestroyRef, input } from \"@angular/core\";\n\nimport type { ICommand, CommandCreator, CanExecute } from \"./command.model\";\nimport { isCommandCreator } from \"./command.util\";\nimport { command } from \"./command\";\n\nconst NAME_CAMEL = \"ssvCommandRef\";\n\n/**\n * Command creator ref, directive which allows creating Command in the template\n * and associate it to a command (in order to share executions).\n * @example\n * ### Most common usage\n * ```html\n * <div #actionCmd=\"ssvCommandRef\" [ssvCommandRef]=\"{host: this, execute: removeHero$, canExecute: isValid$}\">\n * <button [ssvCommand]=\"actionCmd.command\" [ssvCommandParams]=\"hero\">\n * Remove\n * </button>\n * <button [ssvCommand]=\"actionCmd.command\" [ssvCommandParams]=\"hero\">\n * Remove\n * </button>\n * </div>\n * ```\n *\n */\n@Directive({\n\tselector: `[${NAME_CAMEL}]`,\n\texportAs: NAME_CAMEL,\n\tstandalone: true,\n})\nexport class SsvCommandRef implements OnInit {\n\n\treadonly #injector = inject(Injector);\n\n\treadonly commandCreator = input.required<CommandCreator>({\n\t\talias: `ssvCommandRef`\n\t});\n\n\tget command(): ICommand { return this._command; }\n\tprivate _command!: ICommand;\n\n\tconstructor() {\n\t\tconst destroyRef = inject(DestroyRef);\n\t\tdestroyRef.onDestroy(() => {\n\t\t\tthis._command?.unsubscribe();\n\t\t});\n\t}\n\n\tngOnInit(): void {\n\t\tif (isCommandCreator(this.commandCreator())) {\n\t\t\tconst commandCreator = this.commandCreator();\n\t\t\tconst isAsync = commandCreator.isAsync || commandCreator.isAsync === undefined;\n\n\t\t\tconst execFn = commandCreator.execute.bind(commandCreator.host);\n\n\t\t\tthis._command = command(execFn, commandCreator.canExecute as CanExecute, { isAsync, injector: this.#injector });\n\t\t} else {\n\t\t\tthrow new Error(`${NAME_CAMEL}: [${NAME_CAMEL}] is not defined properly!`);\n\t\t}\n\t}\n\n}\n","import { NgModule } from \"@angular/core\";\n\nimport { SsvCommand } from \"./command.directive\";\nimport { SsvCommandRef } from \"./command-ref.directive\";\n\nconst EXPORTED_IMPORTS = [\n\tSsvCommand,\n\tSsvCommandRef\n];\n\n/** @deprecated Use standalone instead. */\n@NgModule({\n\timports: [EXPORTED_IMPORTS],\n\texports: [EXPORTED_IMPORTS]\n})\nexport class SsvCommandModule {\n\n}\n","export const VERSION = \"3.3.0-dev.82\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["NAME_CAMEL"],"mappings":";;;;;;AAeA,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAiB;AACrD,IAAA,iBAAiB,EAAE,WAAW;AAC9B,IAAA,cAAc,EAAE,IAAI;AACpB,CAAA,CAAC,CAAC;MAEU,eAAe,GAAG,IAAI,cAAc,CAAiB,qBAAqB,EAAE;AACxF,IAAA,OAAO,EAAE,MAAM,eAAe;AAC9B,CAAA,EAAE;AAEG,SAAU,wBAAwB,CACvC,OAAoG,EAAA;IAEpG,OAAO;AACN,QAAA;AACC,YAAA,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,MAAK;AAChB,gBAAA,IAAI,IAAI,GAAG,OAAO,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC;AAC9E,gBAAA,IAAI,GAAG,IAAI;AACV,sBAAE;AACD,wBAAA,GAAG,eAAe;AAClB,wBAAA,GAAG,IAAI;AACP,qBAAA;sB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