@tft/interact 21.0.6 → 21.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Pipe, InjectionToken, inject, RendererFactory2, NgZone, Injectable, ElementRef, Input, Directive, Renderer2, EventEmitter, Output, HostBinding, TemplateRef, HostListener, ViewContainerRef, DOCUMENT, ContentChild, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
2
+ import { Pipe, InjectionToken, inject, RendererFactory2, NgZone, Injectable, ElementRef, input, Directive, Renderer2, output, signal, computed, effect, TemplateRef, HostListener, ViewContainerRef, DOCUMENT, ContentChild, NgModule } from '@angular/core';
4
3
  import interact from 'interactjs';
5
4
  import { BehaviorSubject, combineLatest, Subject } from 'rxjs';
6
5
  import { shareReplay, tap, map, scan } from 'rxjs/operators';
@@ -16,13 +15,13 @@ class ArrayOfNPipe {
16
15
  return new Array(length).fill(length).map((x, i) => i);
17
16
  }
18
17
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ArrayOfNPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
19
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.6", ngImport: i0, type: ArrayOfNPipe, isStandalone: false, name: "arrayOfN" }); }
18
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.6", ngImport: i0, type: ArrayOfNPipe, isStandalone: true, name: "arrayOfN" }); }
20
19
  }
21
20
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ArrayOfNPipe, decorators: [{
22
21
  type: Pipe,
23
22
  args: [{
24
23
  name: 'arrayOfN',
25
- standalone: false
24
+ standalone: true,
26
25
  }]
27
26
  }] });
28
27
 
@@ -250,59 +249,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
250
249
  class AccountForScaleDirective {
251
250
  constructor() {
252
251
  this.el = inject(ElementRef);
253
- // this setup allows consumers to set x, y scale independently or just set them both with scale
254
- this.scale = 1;
252
+ this.scale = input(1, ...(ngDevMode ? [{ debugName: "scale" }] : []));
255
253
  }
256
254
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AccountForScaleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
257
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: AccountForScaleDirective, isStandalone: false, selector: "[tftAccountForScale]", inputs: { scale: "scale" }, ngImport: i0 }); }
255
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: AccountForScaleDirective, isStandalone: true, selector: "[tftAccountForScale]", inputs: { scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
258
256
  }
259
257
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AccountForScaleDirective, decorators: [{
260
258
  type: Directive,
261
259
  args: [{
262
260
  selector: '[tftAccountForScale]',
263
- standalone: false
261
+ standalone: true,
264
262
  }]
265
- }], propDecorators: { scale: [{
266
- type: Input
267
- }] } });
263
+ }], propDecorators: { scale: [{ type: i0.Input, args: [{ isSignal: true, alias: "scale", required: false }] }] } });
268
264
 
269
265
  class DropzoneDirective {
266
+ ngOnInit() {
267
+ this.dropzone = this.connectDropzoneEvents(this.el.nativeElement, this.dropzoneConfig());
268
+ this._registeredId.set(this.interactService.addRegistryToSystem(this.dropzoneId()));
269
+ }
270
270
  constructor() {
271
271
  this.el = inject(ElementRef);
272
272
  this.renderer = inject(Renderer2);
273
273
  this.interactService = inject(InteractService);
274
274
  this.account_for_scale_dir = inject(AccountForScaleDirective, { optional: true });
275
- this.dropzoneConfig = {};
276
- this.position = 'relative';
277
- // proxies to pass interact events through to consumer of directive
278
- this.dropActivate = new EventEmitter();
279
- this.dragEnter = new EventEmitter();
280
- this.dragLeave = new EventEmitter();
281
- this.dragDrop = new EventEmitter();
282
- }
283
- get scale() {
284
- return this.account_for_scale_dir?.scale;
285
- }
286
- ngOnInit() {
287
- // connects
288
- this.dropzone = this.connectDropzoneEvents(this.el.nativeElement, this.dropzoneConfig);
289
- this.dropzoneId = this.interactService.addRegistryToSystem(this.dropzoneId);
290
- }
291
- ngOnChanges(changes) {
292
- if (!changes.dropzoneConfig || !this.dropzone)
293
- return;
294
- // this.dropzone.unset();
295
- // this.dropzone = this.connectDropzoneEvents(this.el.nativeElement, this.dropzoneConfig)
296
- this.dropzone.dropzone(this.dropzoneConfig);
275
+ this.dropzoneId = input(...(ngDevMode ? [undefined, { debugName: "dropzoneId" }] : []));
276
+ this.dropzoneConfig = input({}, ...(ngDevMode ? [{ debugName: "dropzoneConfig" }] : []));
277
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
278
+ this.dropzoneData = input(...(ngDevMode ? [undefined, { debugName: "dropzoneData" }] : []));
279
+ this.position = input('relative', ...(ngDevMode ? [{ debugName: "position" }] : []));
280
+ this.dropActivate = output();
281
+ this.dragEnter = output();
282
+ this.dragLeave = output();
283
+ this.dragDrop = output();
284
+ /** The actual registered ID — may differ from the dropzoneId input if none was provided. Drives [id] host binding. */
285
+ this._registeredId = signal(null, ...(ngDevMode ? [{ debugName: "_registeredId" }] : []));
286
+ this.scale = computed(() => this.account_for_scale_dir?.scale(), ...(ngDevMode ? [{ debugName: "scale" }] : []));
287
+ effect(() => {
288
+ const config = this.dropzoneConfig();
289
+ if (!this.dropzone)
290
+ return;
291
+ this.dropzone.dropzone(config);
292
+ });
297
293
  }
298
294
  /**
299
- * Connects element to interacts dropzone events and returns a reference to the interactable
300
- * @param nativeElement the element to tie drop events to
301
- * @param dropzoneConfig the interact configuration to use when connecting
302
- */
295
+ * Connects element to interact's dropzone events and returns a reference to the interactable
296
+ */
303
297
  connectDropzoneEvents(nativeElement, dropzoneConfig) {
304
298
  return interact(nativeElement).dropzone(dropzoneConfig)
305
- // TODO: investigate when this fires in different scenarios
306
299
  .on('dropactivate', (event) => {
307
300
  this.dropActivate.emit(this.mapDropzoneEvent(event));
308
301
  })
@@ -322,12 +315,11 @@ class DropzoneDirective {
322
315
  }
323
316
  /**
324
317
  * Maps the drop event emitted by interact to something a little easier to use
325
- * @param event the drop event emitted by interact, extended with extra fields we added to
326
318
  */
327
319
  mapDropzoneEvent(event) {
328
320
  const zoneElement = event.target;
329
321
  const dragElement = event.relatedTarget?.dragRef?.previewRef;
330
- const scale = this.scale;
322
+ const scale = this.scale();
331
323
  const positionInDropTarget = zoneElement && dragElement
332
324
  ? this.interactService.calculatePositionInElement(zoneElement, dragElement, scale)
333
325
  : null;
@@ -336,60 +328,41 @@ class DropzoneDirective {
336
328
  dragRef: dragElement.dragRef,
337
329
  dragOrigin: dragElement.dragOrigin,
338
330
  dropTarget: event.relatedTarget.dropTarget,
339
- positionInDropTarget
331
+ positionInDropTarget,
340
332
  };
341
333
  }
342
334
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DropzoneDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
343
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: DropzoneDirective, isStandalone: false, selector: "[tftDropzone]", inputs: { dropzoneId: "dropzoneId", dropzoneConfig: "dropzoneConfig", dropzoneData: "dropzoneData", position: "position" }, outputs: { dropActivate: "dropActivate", dragEnter: "dragEnter", dragLeave: "dragLeave", dragDrop: "dragDrop" }, host: { properties: { "id": "dropzoneId", "style.position": "this.position" } }, usesOnChanges: true, ngImport: i0 }); }
335
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: DropzoneDirective, isStandalone: true, selector: "[tftDropzone]", inputs: { dropzoneId: { classPropertyName: "dropzoneId", publicName: "dropzoneId", isSignal: true, isRequired: false, transformFunction: null }, dropzoneConfig: { classPropertyName: "dropzoneConfig", publicName: "dropzoneConfig", isSignal: true, isRequired: false, transformFunction: null }, dropzoneData: { classPropertyName: "dropzoneData", publicName: "dropzoneData", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dropActivate: "dropActivate", dragEnter: "dragEnter", dragLeave: "dragLeave", dragDrop: "dragDrop" }, host: { properties: { "id": "_registeredId()", "style.position": "position()" } }, ngImport: i0 }); }
344
336
  }
345
337
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DropzoneDirective, decorators: [{
346
338
  type: Directive,
347
339
  args: [{
348
340
  selector: '[tftDropzone]',
341
+ standalone: true,
349
342
  host: {
350
- '[id]': 'dropzoneId'
343
+ '[id]': '_registeredId()',
344
+ '[style.position]': 'position()',
351
345
  },
352
- standalone: false
353
346
  }]
354
- }], propDecorators: { dropzoneId: [{
355
- type: Input
356
- }], dropzoneConfig: [{
357
- type: Input
358
- }], dropzoneData: [{
359
- type: Input
360
- }], position: [{
361
- type: Input
362
- }, {
363
- type: HostBinding,
364
- args: ['style.position']
365
- }], dropActivate: [{
366
- type: Output
367
- }], dragEnter: [{
368
- type: Output
369
- }], dragLeave: [{
370
- type: Output
371
- }], dragDrop: [{
372
- type: Output
373
- }] } });
347
+ }], ctorParameters: () => [], propDecorators: { dropzoneId: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropzoneId", required: false }] }], dropzoneConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropzoneConfig", required: false }] }], dropzoneData: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropzoneData", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], dropActivate: [{ type: i0.Output, args: ["dropActivate"] }], dragEnter: [{ type: i0.Output, args: ["dragEnter"] }], dragLeave: [{ type: i0.Output, args: ["dragLeave"] }], dragDrop: [{ type: i0.Output, args: ["dragDrop"] }] } });
374
348
 
375
349
  const TFT_DRAG_PREVIEW = new InjectionToken('DragPreviewDirective');
376
350
  class DragPreviewDirective {
377
351
  constructor() {
378
352
  this.templateRef = inject(TemplateRef);
353
+ this.dragData = input(...(ngDevMode ? [undefined, { debugName: "dragData" }] : []));
379
354
  }
380
355
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DragPreviewDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
381
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: DragPreviewDirective, isStandalone: false, selector: "ng-template[tftDragPreview]", inputs: { dragData: "dragData" }, ngImport: i0 }); }
356
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: DragPreviewDirective, isStandalone: true, selector: "ng-template[tftDragPreview]", inputs: { dragData: { classPropertyName: "dragData", publicName: "dragData", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
382
357
  }
383
358
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DragPreviewDirective, decorators: [{
384
359
  type: Directive,
385
360
  args: [{
386
361
  // eslint-disable-next-line @angular-eslint/directive-selector
387
362
  selector: 'ng-template[tftDragPreview]',
388
- standalone: false
363
+ standalone: true,
389
364
  }]
390
- }], propDecorators: { dragData: [{
391
- type: Input
392
- }] } });
365
+ }], propDecorators: { dragData: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragData", required: false }] }] } });
393
366
 
394
367
  /** Gets the closest ancestor of an element that matches a selector. */
395
368
  function getClosestMatchingAncestor(element, selector) {
@@ -439,26 +412,18 @@ class DragRootDirective {
439
412
  this.account_for_scale_dir = inject(AccountForScaleDirective, { optional: true, self: true });
440
413
  }
441
414
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DragRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
442
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: DragRootDirective, isStandalone: false, selector: "[tftDragRoot]", exportAs: ["tftDragRoot"], ngImport: i0 }); }
415
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: DragRootDirective, isStandalone: true, selector: "[tftDragRoot]", exportAs: ["tftDragRoot"], ngImport: i0 }); }
443
416
  }
444
417
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DragRootDirective, decorators: [{
445
418
  type: Directive,
446
419
  args: [{
447
420
  selector: '[tftDragRoot]',
448
421
  exportAs: 'tftDragRoot',
449
- standalone: false
422
+ standalone: true,
450
423
  }]
451
424
  }] });
452
425
 
453
- ;
454
- /**
455
- * Use to apply scale to the element and tell the drag and resize directives to account for the scale when
456
- * @example <div tftAccountForScale [scale]="2.5"> <div tftDraggable> </div> </div>
457
- * @note if `dragRoot` is used this directive should be used on the same element to ensure that the drag
458
- * element accounts for scale
459
- */
460
426
  class AutoScrollDirective {
461
- // this setup allows consumers to set x, y scale independently or just set them both with scale
462
427
  scroll(scrollEvent) {
463
428
  const target = scrollEvent.target;
464
429
  const { scrollTop, scrollLeft } = target;
@@ -466,16 +431,13 @@ class AutoScrollDirective {
466
431
  }
467
432
  constructor() {
468
433
  this.el = inject(ElementRef);
469
- /**
470
- * Limit minimum time between scroll events in milliseconds
471
- */
472
- this.autoScrollConfig = {
434
+ this.autoScrollConfig = input({
473
435
  margin: 50,
474
436
  distance: 3,
475
437
  interval: 50,
476
438
  speed: 300,
477
- enabled: true
478
- };
439
+ enabled: true,
440
+ }, ...(ngDevMode ? [{ debugName: "autoScrollConfig" }] : []));
479
441
  this.scrollDeltaObserver = new Subject();
480
442
  const el = this.el;
481
443
  const { scrollTop, scrollLeft } = el.nativeElement;
@@ -489,17 +451,15 @@ class AutoScrollDirective {
489
451
  this.scrollObserver.subscribe();
490
452
  }
491
453
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AutoScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
492
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: AutoScrollDirective, isStandalone: false, selector: "[tftAutoScroll]", inputs: { autoScrollConfig: "autoScrollConfig" }, host: { listeners: { "scroll": "scroll($event)" } }, ngImport: i0 }); }
454
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: AutoScrollDirective, isStandalone: true, selector: "[tftAutoScroll]", inputs: { autoScrollConfig: { classPropertyName: "autoScrollConfig", publicName: "autoScrollConfig", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "scroll": "scroll($event)" } }, ngImport: i0 }); }
493
455
  }
494
456
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: AutoScrollDirective, decorators: [{
495
457
  type: Directive,
496
458
  args: [{
497
459
  selector: '[tftAutoScroll]',
498
- standalone: false
460
+ standalone: true,
499
461
  }]
500
- }], ctorParameters: () => [], propDecorators: { autoScrollConfig: [{
501
- type: Input
502
- }], scroll: [{
462
+ }], ctorParameters: () => [], propDecorators: { autoScrollConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoScrollConfig", required: false }] }], scroll: [{
503
463
  type: HostListener,
504
464
  args: ['scroll', ['$event']]
505
465
  }] } });
@@ -517,66 +477,61 @@ class DraggableDirective {
517
477
  this.dropzone_dir = inject(DropzoneDirective, { optional: true, skipSelf: true });
518
478
  this.drag_root_dir = inject(DragRootDirective, { optional: true, skipSelf: true });
519
479
  this.auto_scroll_dir = inject(AutoScrollDirective, { optional: true, skipSelf: true });
520
- /* zIndex while dragging*/
521
- this.dragZIndex = 10000;
522
- this.enableDragDefault = true;
480
+ this.x = input(...(ngDevMode ? [undefined, { debugName: "x" }] : []));
481
+ this.y = input(...(ngDevMode ? [undefined, { debugName: "y" }] : []));
482
+ /** zIndex while dragging */
483
+ this.dragZIndex = input(10000, ...(ngDevMode ? [{ debugName: "dragZIndex" }] : []));
484
+ /** zIndex while at rest */
485
+ this.zIndex = input(...(ngDevMode ? [undefined, { debugName: "zIndex" }] : []));
486
+ this.dragData = input(...(ngDevMode ? [undefined, { debugName: "dragData" }] : []));
487
+ this.enableDragDefault = input(true, ...(ngDevMode ? [{ debugName: "enableDragDefault" }] : []));
523
488
  /**
524
489
  * @deprecated replaced by 'dragDisabled' property, please migrate before v13
525
490
  */
526
- this.disabled = false;
527
- this.dragDisabled = false;
528
- this.showPlaceholder = false;
529
- // pipes all interact events to event emitters
530
- this.dragStart = new EventEmitter();
531
- this.dragMove = new EventEmitter();
532
- this.dragInertiaStart = new EventEmitter();
533
- this.dragEnd = new EventEmitter();
534
- }
535
- // check all the different places for scale
536
- get scale() {
537
- return this.account_for_scale_dir?.scale || this.drag_root_dir?.account_for_scale_dir?.scale || this.dragRoot?.account_for_scale_dir?.scale || 1;
491
+ this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
492
+ this.dragDisabled = input(false, ...(ngDevMode ? [{ debugName: "dragDisabled" }] : []));
493
+ this.dragConfig = input(...(ngDevMode ? [undefined, { debugName: "dragConfig" }] : []));
494
+ this.showPlaceholder = input(false, ...(ngDevMode ? [{ debugName: "showPlaceholder" }] : []));
495
+ /**
496
+ * The element we want to prepend the drag element to.
497
+ * Use `tftDragRoot` directive on a parent element to set custom root element
498
+ * @default document.body
499
+ */
500
+ this.dragRoot = input(...(ngDevMode ? [undefined, { debugName: "dragRoot" }] : []));
501
+ this.dragStart = output();
502
+ this.dragMove = output();
503
+ this.dragInertiaStart = output();
504
+ this.dragEnd = output();
505
+ this.scale = computed(() => this.account_for_scale_dir?.scale() || this.drag_root_dir?.account_for_scale_dir?.scale() || this.dragRoot()?.account_for_scale_dir?.scale() || 1, ...(ngDevMode ? [{ debugName: "scale" }] : []));
506
+ effect(() => {
507
+ this.alignPositionWithInputs(this.x(), this.y());
508
+ });
509
+ effect(() => {
510
+ const disabled = this.disabled();
511
+ this.dragConfig();
512
+ this.dragDisabled();
513
+ if (disabled) {
514
+ console.warn(`It looks like your using the 'disabled' input on a tftDraggable directive, it has been deprecated and is replaced with 'dragDisabled', please migrate by v13`);
515
+ }
516
+ if (!this.interactable)
517
+ return;
518
+ this.setDragConfig();
519
+ });
538
520
  }
539
521
  ngOnInit() {
540
- this.interactable = this.initiateDragEvents(this.dragConfig, this.el.nativeElement);
541
- this.dragRootEl = (this.dragRoot?.el?.nativeElement || this.drag_root_dir?.el?.nativeElement) || this._document.body;
542
- // register with parent dropzone if it exists, otherwise use default
543
- // this gives us a place on the registry to store our drag items that don't have a dropzone
544
- this.registryId = this.dropzone_dir?.dropzoneId || DEFAULT_REGISTRY_ID;
545
- // add draggable to directory and store its id
522
+ this.interactable = this.initiateDragEvents(this.dragConfig(), this.el.nativeElement);
523
+ this.dragRootEl = (this.dragRoot()?.el?.nativeElement || this.drag_root_dir?.el?.nativeElement) || this._document.body;
524
+ this.registryId = this.dropzone_dir?._registeredId() || DEFAULT_REGISTRY_ID;
546
525
  this.interactableId = this.interactService.addDraggableToRegistry(this.registryId, this.interactableId);
547
- this.alignPositionWithInputs(this.x, this.y);
548
- // cache subscription to interactable state so we can unsubscribe onDestroy
526
+ this.alignPositionWithInputs(this.x(), this.y());
549
527
  this.interactableState = this.interactService
550
528
  .getInteractableState(this.interactableId, this.registryId);
551
- // keep our cached position values in line with our drag state
552
- this.interactableSubscription = this.interactableState.subscribe((state) => {
553
- this.y = state.y;
554
- this.x = state.x;
555
- });
529
+ this.interactableSubscription = this.interactableState.subscribe();
556
530
  this.setDragConfig();
557
531
  }
558
- // TODO: watch config here as well and update interactable
559
- ngOnChanges(changes) {
560
- // we do this here instead of using a setter on the input so that it
561
- // will only run once when there is a change to x and y
562
- if (changes.y || changes.x) {
563
- this.alignPositionWithInputs(this.x, this.y);
564
- }
565
- if (changes.dragConfig || changes.disabled || changes.dragDisabled) {
566
- if (!this.interactable)
567
- return;
568
- this.setDragConfig();
569
- }
570
- /**
571
- * @deprecated remove this in v13
572
- */
573
- if (changes.disabled) {
574
- console.warn(`It looks like your using the 'disabled' input on a tftDraggable directive, it has been deprecated and is replaced with 'dragDisabled', please migrate by v13`);
575
- }
576
- }
577
532
  setDragConfig() {
578
- const enabled = !(this.disabled || this.dragDisabled);
579
- const dragConfig = { ...this.dragConfig, enabled };
533
+ const enabled = !(this.disabled() || this.dragDisabled());
534
+ const dragConfig = { ...this.dragConfig(), enabled };
580
535
  this.interactable.draggable(dragConfig);
581
536
  }
582
537
  ngAfterViewInit() {
@@ -586,20 +541,19 @@ class DraggableDirective {
586
541
  }
587
542
  }
588
543
  ngOnDestroy() {
589
- // clean up state and subscriptions related to destroyed component
590
544
  this.interactableSubscription.unsubscribe();
591
545
  this.interactService.destroyInteractable(this.interactableId, this.registryId);
592
546
  }
593
547
  dragMoveListener(event, element) {
594
548
  const { dx, dy } = event;
595
- const scale = this.scale;
549
+ const scale = this.scale();
596
550
  const deltaX = scale ? dx / scale : dx;
597
551
  const deltaY = scale ? dy / scale : dy;
598
552
  this.interactService.updateDeltas(this.interactableId, this.registryId, { deltaX, deltaY }, element);
599
553
  }
600
554
  setDragStyles(dragElement) {
601
555
  this.renderer.setStyle(dragElement, 'touch-action', 'none');
602
- this.renderer.setStyle(dragElement, 'z-index', this.dragZIndex);
556
+ this.renderer.setStyle(dragElement, 'z-index', this.dragZIndex());
603
557
  this.renderer.setStyle(dragElement, 'position', 'absolute');
604
558
  // Prevents highlighting text if dragging over, which will interrupt the next drag action
605
559
  this.renderer.setStyle(dragElement, 'user-select', 'none');
@@ -612,7 +566,7 @@ class DraggableDirective {
612
566
  mapDragEvent(event) {
613
567
  const { target, dropzone } = event;
614
568
  const dropzoneElement = dropzone?.target || target.dropTarget?.el.nativeElement;
615
- const scale = this.scale;
569
+ const scale = this.scale();
616
570
  const positionInDropTarget = target && dropzoneElement
617
571
  ? this.interactService.calculatePositionInElement(dropzoneElement, this.previewRef, scale)
618
572
  : null;
@@ -621,14 +575,13 @@ class DraggableDirective {
621
575
  dragRef: this,
622
576
  dragOrigin: target.dragOrigin,
623
577
  dropTarget: target.dropTarget,
624
- positionInDropTarget
578
+ positionInDropTarget,
625
579
  };
626
580
  }
627
581
  setPosition(x, y) {
628
582
  this.interactService.updatePosition(this.interactableId, this.registryId, { x, y }, this.el.nativeElement);
629
583
  }
630
584
  alignPositionWithInputs(x, y) {
631
- // short circuit if positions aren't numbers or if they haven't changed
632
585
  if (!this.isValidPosition(x, y))
633
586
  return;
634
587
  this.interactService.updatePosition(this.interactableId, this.registryId, { x, y }, this.el.nativeElement);
@@ -636,27 +589,24 @@ class DraggableDirective {
636
589
  isValidPosition(x, y) {
637
590
  return this.isNumeric(x) && this.isNumeric(y);
638
591
  }
639
- // We use use this instead of isNaN here to try and help performance
640
- // We should be able to reliably restrict to numbers or falsey values
641
592
  isNumeric(num) {
642
593
  return typeof num === 'number' && !isNaN(num);
643
594
  }
644
595
  initiateDragEvents(dragConfig, nativeElement) {
645
596
  const defaultDragConfig = {
646
597
  ...dragConfig,
647
- enabled: !(this.disabled || this.dragDisabled),
598
+ enabled: !(this.disabled() || this.dragDisabled()),
648
599
  ...(this.auto_scroll_dir && {
649
600
  autoScroll: {
650
- ...this.auto_scroll_dir.autoScrollConfig,
651
- container: this.auto_scroll_dir.el.nativeElement
652
- }
653
- })
601
+ ...this.auto_scroll_dir.autoScrollConfig(),
602
+ container: this.auto_scroll_dir.el.nativeElement,
603
+ },
604
+ }),
654
605
  };
655
606
  return interact(nativeElement).draggable(defaultDragConfig)
656
607
  .on('dragstart', (event) => {
657
608
  const interaction = event.interaction;
658
- // check if we should append drag element to body
659
- if (this.enableDragDefault && interaction.pointerIsDown) {
609
+ if (this.enableDragDefault() && interaction.pointerIsDown) {
660
610
  if (this._previewTemplate) {
661
611
  const viewRef = this._viewContainerRef.createEmbeddedView(this._previewTemplate.templateRef);
662
612
  this.previewRef = getRootNode(viewRef, this._document);
@@ -667,26 +617,24 @@ class DraggableDirective {
667
617
  this.addDragPropertiesToElement(this.previewRef);
668
618
  this.setDragStyles(this.previewRef);
669
619
  this.dragRootEl.prepend(this.previewRef);
670
- const scale = this.account_for_scale_dir?.scale || this.dragRoot?.account_for_scale_dir?.scale || 1;
620
+ const scale = this.account_for_scale_dir?.scale() || this.dragRoot()?.account_for_scale_dir?.scale() || 1;
671
621
  const { x, y } = this.interactService.calculatePositionInElement(this.dragRootEl, nativeElement, scale);
672
622
  this.interactService.updatePosition(this.interactableId, this.registryId, { x, y }, this.previewRef);
673
- if (!this.showPlaceholder) {
623
+ if (!this.showPlaceholder()) {
674
624
  this.renderer.setStyle(this.el.nativeElement, 'display', 'none');
675
625
  }
676
626
  }
677
- // subscribe to scroll events if they are there, by only subscribing on dragstart we avoid wasting subscriptions on interactables that aren't be dragged
678
627
  if (this.auto_scroll_dir) {
679
628
  this.subscribeToScrollEvents();
680
629
  }
681
630
  this.dragStart.emit(this.mapDragEvent(event));
682
631
  })
683
632
  .on('dragmove', (event) => {
684
- if (this.enableDragDefault) {
633
+ if (this.enableDragDefault()) {
685
634
  const dragElement = this.dropzone_dir && this.previewRef || nativeElement;
686
635
  this.dragMoveListener(event, dragElement);
687
636
  }
688
- const mappedEvent = this.mapDragEvent(event);
689
- this.dragMove.emit(mappedEvent);
637
+ this.dragMove.emit(this.mapDragEvent(event));
690
638
  })
691
639
  .on('draginertiastart', (event) => {
692
640
  this.dragInertiaStart.emit(this.mapDragEvent(event));
@@ -699,12 +647,10 @@ class DraggableDirective {
699
647
  }
700
648
  this.renderer.setStyle(this.el.nativeElement, 'display', '');
701
649
  this.dragEnd.emit(mappedEvent);
702
- // unsubscribe from scroll events if subscribed
703
650
  if (this.auto_scroll_dir) {
704
651
  this.scrollEventsSubscription.unsubscribe();
705
652
  }
706
653
  if (this.el.nativeElement !== this.previewRef) {
707
- // we do this in a timeout, so that we don't remove before the dropzone can get the boundingElementRect
708
654
  setTimeout(() => {
709
655
  this.dragRootEl.removeChild(this.previewRef);
710
656
  });
@@ -713,86 +659,41 @@ class DraggableDirective {
713
659
  }
714
660
  subscribeToScrollEvents() {
715
661
  this.scrollEventsSubscription = this.auto_scroll_dir.scrollDeltaObserver.subscribe(({ scrollLeft, scrollTop }) => {
716
- const deltaX = this.scale ? scrollLeft / this.scale : scrollLeft;
717
- const deltaY = this.scale ? scrollTop / this.scale : scrollTop;
662
+ const deltaX = this.scale() ? scrollLeft / this.scale() : scrollLeft;
663
+ const deltaY = this.scale() ? scrollTop / this.scale() : scrollTop;
718
664
  this.interactService.updateDeltas(this.interactableId, this.registryId, { deltaX, deltaY }, this.previewRef);
719
665
  });
720
666
  }
721
667
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DraggableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
722
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: DraggableDirective, isStandalone: false, selector: "[tftDraggable]", inputs: { x: "x", y: "y", dragZIndex: "dragZIndex", zIndex: "zIndex", interactableId: "interactableId", dragData: "dragData", enableDragDefault: "enableDragDefault", disabled: "disabled", dragDisabled: "dragDisabled", dragConfig: "dragConfig", showPlaceholder: "showPlaceholder", dragRoot: "dragRoot" }, outputs: { dragStart: "dragStart", dragMove: "dragMove", dragInertiaStart: "dragInertiaStart", dragEnd: "dragEnd" }, host: { properties: { "style.touchAction": "this.dragDisabled ? \"auto\" : \"none\"", "style.position": "\"absolute\"", "id": "interactableId" } }, queries: [{ propertyName: "_previewTemplate", first: true, predicate: DragPreviewDirective, descendants: true }], usesOnChanges: true, ngImport: i0 }); }
668
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: DraggableDirective, isStandalone: true, selector: "[tftDraggable]", inputs: { x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: false, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: false, transformFunction: null }, dragZIndex: { classPropertyName: "dragZIndex", publicName: "dragZIndex", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, dragData: { classPropertyName: "dragData", publicName: "dragData", isSignal: true, isRequired: false, transformFunction: null }, enableDragDefault: { classPropertyName: "enableDragDefault", publicName: "enableDragDefault", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, dragDisabled: { classPropertyName: "dragDisabled", publicName: "dragDisabled", isSignal: true, isRequired: false, transformFunction: null }, dragConfig: { classPropertyName: "dragConfig", publicName: "dragConfig", isSignal: true, isRequired: false, transformFunction: null }, showPlaceholder: { classPropertyName: "showPlaceholder", publicName: "showPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, dragRoot: { classPropertyName: "dragRoot", publicName: "dragRoot", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dragStart: "dragStart", dragMove: "dragMove", dragInertiaStart: "dragInertiaStart", dragEnd: "dragEnd" }, host: { properties: { "style.user-select": "dragDisabled() ? \"auto\" : \"none\"", "style.touch-action": "dragDisabled() ? \"auto\" : \"none\"", "style.position": "\"absolute\"", "id": "interactableId" } }, queries: [{ propertyName: "_previewTemplate", first: true, predicate: DragPreviewDirective, descendants: true }], ngImport: i0 }); }
723
669
  }
724
670
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: DraggableDirective, decorators: [{
725
671
  type: Directive,
726
672
  args: [{
727
673
  selector: '[tftDraggable]',
728
- // eslint-disable-next-line @angular-eslint/no-host-metadata-property
674
+ standalone: true,
729
675
  host: {
730
- '[style.touchAction]': 'this.dragDisabled ? "auto" : "none"',
676
+ '[style.user-select]': 'dragDisabled() ? "auto" : "none"',
677
+ '[style.touch-action]': 'dragDisabled() ? "auto" : "none"',
731
678
  '[style.position]': '"absolute"',
732
679
  '[id]': 'interactableId',
733
680
  },
734
- standalone: false
735
681
  }]
736
- }], propDecorators: { x: [{
737
- type: Input
738
- }], y: [{
739
- type: Input
740
- }], dragZIndex: [{
741
- type: Input
742
- }], zIndex: [{
743
- type: Input
744
- }], interactableId: [{
745
- type: Input
746
- }], dragData: [{
747
- type: Input
748
- }], enableDragDefault: [{
749
- type: Input
750
- }], disabled: [{
751
- type: Input
752
- }], dragDisabled: [{
753
- type: Input
754
- }], dragConfig: [{
755
- type: Input
756
- }], showPlaceholder: [{
757
- type: Input
758
- }], dragRoot: [{
759
- type: Input
760
- }], dragStart: [{
761
- type: Output
762
- }], dragMove: [{
763
- type: Output
764
- }], dragInertiaStart: [{
765
- type: Output
766
- }], dragEnd: [{
767
- type: Output
768
- }], _previewTemplate: [{
682
+ }], ctorParameters: () => [], propDecorators: { x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: false }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: false }] }], dragZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragZIndex", required: false }] }], zIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "zIndex", required: false }] }], dragData: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragData", required: false }] }], enableDragDefault: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableDragDefault", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], dragDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragDisabled", required: false }] }], dragConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragConfig", required: false }] }], showPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "showPlaceholder", required: false }] }], dragRoot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragRoot", required: false }] }], dragStart: [{ type: i0.Output, args: ["dragStart"] }], dragMove: [{ type: i0.Output, args: ["dragMove"] }], dragInertiaStart: [{ type: i0.Output, args: ["dragInertiaStart"] }], dragEnd: [{ type: i0.Output, args: ["dragEnd"] }], _previewTemplate: [{
769
683
  type: ContentChild,
770
684
  args: [DragPreviewDirective]
771
685
  }] } });
772
686
  /**
773
687
  * Component utils
774
688
  */
775
- // create a clone of the component passed in and add it to the root component
776
689
  function cloneElement(element) {
777
690
  const clone = element.cloneNode(true);
778
691
  clone.removeAttribute('id');
779
692
  return clone;
780
693
  }
781
- function getPreviewInsertionPoint(documentRef) {
782
- // We can't use the body if the user is in fullscreen mode,
783
- // because the preview will render under the fullscreen element.
784
- return documentRef.fullscreenElement ||
785
- documentRef.webkitFullscreenElement ||
786
- documentRef.mozFullScreenElement ||
787
- documentRef.msFullscreenElement ||
788
- documentRef.body;
789
- }
790
694
 
791
695
  /** @dynamic */
792
696
  class ResizableDirective {
793
- get scale() {
794
- return this.account_for_scale_dir?.scale || this.drag_root_dir?.account_for_scale_dir?.scale;
795
- }
796
697
  constructor() {
797
698
  this.el = inject(ElementRef);
798
699
  this._document = inject(DOCUMENT);
@@ -803,77 +704,69 @@ class ResizableDirective {
803
704
  this.draggable_dir = inject(DraggableDirective, { optional: true });
804
705
  this.dropzone_dir = inject(DropzoneDirective, { optional: true, skipSelf: true });
805
706
  this.auto_scroll_dir = inject(AutoScrollDirective, { optional: true, skipSelf: true });
806
- this.enableResizeDefault = true;
807
- // TODO: should this be an input with default or should consuming user set display in styles each time
808
- this.position = 'absolute';
809
- this.resizeDisabled = false;
810
- this.resizeStart = new EventEmitter();
811
- this.resizeMove = new EventEmitter();
812
- this.resizeInertiaStart = new EventEmitter();
813
- this.resizeEnd = new EventEmitter();
707
+ this.enableResizeDefault = input(true, ...(ngDevMode ? [{ debugName: "enableResizeDefault" }] : []));
708
+ this.position = input('absolute', ...(ngDevMode ? [{ debugName: "position" }] : []));
709
+ this.resizeConfig = input(...(ngDevMode ? [undefined, { debugName: "resizeConfig" }] : []));
710
+ this.interactableId = input(...(ngDevMode ? [undefined, { debugName: "interactableId" }] : []));
711
+ this.width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : []));
712
+ this.height = input(...(ngDevMode ? [undefined, { debugName: "height" }] : []));
713
+ this.resizeDisabled = input(false, ...(ngDevMode ? [{ debugName: "resizeDisabled" }] : []));
714
+ this.resizeStart = output();
715
+ this.resizeMove = output();
716
+ this.resizeInertiaStart = output();
717
+ this.resizeEnd = output();
814
718
  this.defaultConfig = {
815
- edges: { left: true, right: true, bottom: true, top: true }
719
+ edges: { left: true, right: true, bottom: true, top: true },
816
720
  };
817
721
  this.activeEdges = { left: false, right: false, top: false, bottom: false };
818
- const drag_root_dir = this.drag_root_dir;
819
- this.dragRootEl = drag_root_dir?.el?.nativeElement || this._document.body;
722
+ this.scale = computed(() => this.account_for_scale_dir?.scale() || this.drag_root_dir?.account_for_scale_dir?.scale(), ...(ngDevMode ? [{ debugName: "scale" }] : []));
723
+ this.dragRootEl = this.drag_root_dir?.el?.nativeElement || this._document.body;
724
+ effect(() => {
725
+ this.resizeConfig();
726
+ this.resizeDisabled();
727
+ if (!this.interactable)
728
+ return;
729
+ this.interactable.resizable({ ...this.resizeConfig(), enabled: !this.resizeDisabled() });
730
+ });
731
+ effect(() => {
732
+ this.alignDimensionsWithInputs(this.width(), this.height());
733
+ });
820
734
  }
821
735
  ngOnInit() {
822
736
  this.addResizePropertiesToElement(this.el.nativeElement);
823
- // we check for a dropzone, we use its id as the registry id if there is on
824
- // otherwise, we use DEFAULT_REGISTRY_ID as a registry id. This allows us to keep our interactable
825
- // drag state organized by dropzones.
826
- this.registryId = this.dropzone_dir?.dropzoneId || DEFAULT_REGISTRY_ID;
827
- this.interactableId = this.draggable_dir?.interactableId || this.interactService.addDraggableToRegistry(this.registryId, this.interactableId);
828
- this.interactable = this.initiateResizeEvents({ ...this.defaultConfig, ...this.resizeConfig }, this.el.nativeElement);
829
- this.alignDimensionsWithInputs(this.width, this.height);
737
+ this.registryId = this.dropzone_dir?._registeredId() || DEFAULT_REGISTRY_ID;
738
+ this._interactableId = this.draggable_dir?.interactableId || this.interactService.addDraggableToRegistry(this.registryId, this.interactableId());
739
+ this.interactable = this.initiateResizeEvents({ ...this.defaultConfig, ...this.resizeConfig() }, this.el.nativeElement);
740
+ this.alignDimensionsWithInputs(this.width(), this.height());
830
741
  this.interactableSubscription = this.interactService
831
- .getInteractableState(this.interactableId, this.registryId)
742
+ .getInteractableState(this._interactableId, this.registryId)
832
743
  .subscribe();
833
744
  }
834
- ngOnChanges(changes) {
835
- if ((changes.resizeConfig || changes.resizeDisabled) && this.interactable) {
836
- this.interactable.resizable({ ...this.resizeConfig, enabled: !this.resizeDisabled, });
837
- }
838
- if (changes.width || changes.height) {
839
- this.alignDimensionsWithInputs(this.width, this.height);
840
- }
841
- }
842
745
  ngOnDestroy() {
843
746
  this.interactableSubscription.unsubscribe();
844
- this.interactService.destroyInteractable(this.interactableId, this.registryId);
747
+ this.interactService.destroyInteractable(this._interactableId, this.registryId);
845
748
  }
846
749
  resizeListener(event) {
847
750
  const element = this.el.nativeElement;
848
- const scale = this.scale;
751
+ const scale = this.scale();
849
752
  const { deltaRect } = event;
850
753
  const deltaX = deltaRect.left / scale;
851
754
  const deltaY = deltaRect.top / scale;
852
- // We get the width and height directly from the native element because
853
- // the event dimension can get out of sync when resizing with autoScroll
854
755
  const rect = element.getBoundingClientRect();
855
756
  const width = (rect.width + deltaRect.width) / scale;
856
757
  const height = (rect.height + deltaRect.height) / scale;
857
- this.interactService.updateSize(this.interactableId, this.registryId, { deltaX, deltaY, width, height }, this.el.nativeElement);
758
+ this.interactService.updateSize(this._interactableId, this.registryId, { deltaX, deltaY, width, height }, this.el.nativeElement);
858
759
  }
859
- /**
860
- * hook elements into interacts resize event listeners
861
- * we spread the configs so that the consuming component only overwrites the
862
- * pieces that it explicitly indicates
863
- * @param resizeConfig
864
- * @param nativeElement
865
- */
866
760
  initiateResizeEvents(resizeConfig, nativeElement) {
867
- // TODO: This should try and get interactable from tft_draggable if it exists
868
761
  const defaultResizeConfig = {
869
762
  ...resizeConfig,
870
- enabled: !this.resizeDisabled,
763
+ enabled: !this.resizeDisabled(),
871
764
  ...(this.auto_scroll_dir && {
872
765
  autoScroll: {
873
- ...this.auto_scroll_dir.autoScrollConfig,
874
- container: this.auto_scroll_dir.el.nativeElement
875
- }
876
- })
766
+ ...this.auto_scroll_dir.autoScrollConfig(),
767
+ container: this.auto_scroll_dir.el.nativeElement,
768
+ },
769
+ }),
877
770
  };
878
771
  const interactable = this.draggable_dir?.interactable || interact(nativeElement);
879
772
  return interactable.resizable(defaultResizeConfig)
@@ -885,11 +778,10 @@ class ResizableDirective {
885
778
  this.resizeStart.emit(this.mapResizeEvent(event));
886
779
  })
887
780
  .on('resizemove', (event) => {
888
- if (this.enableResizeDefault) {
781
+ if (this.enableResizeDefault()) {
889
782
  this.resizeListener(event);
890
783
  }
891
- const mappedEvent = this.mapResizeEvent(event);
892
- this.resizeMove.emit(mappedEvent);
784
+ this.resizeMove.emit(this.mapResizeEvent(event));
893
785
  })
894
786
  .on('resizeinertiastart', (event) => this.resizeInertiaStart.emit(this.mapResizeEvent(event)))
895
787
  .on('resizeend', (event) => {
@@ -903,7 +795,7 @@ class ResizableDirective {
903
795
  mapResizeEvent(event) {
904
796
  const target = this.el.nativeElement;
905
797
  const relatedTarget = this.draggable_dir?.dropzone_dir?.el.nativeElement;
906
- const scale = this.scale;
798
+ const scale = this.scale();
907
799
  const positionInDropTarget = target && relatedTarget
908
800
  ? this.interactService.calculatePositionInElement(relatedTarget, target, scale)
909
801
  : null;
@@ -916,19 +808,19 @@ class ResizableDirective {
916
808
  positionInDropTarget,
917
809
  size: {
918
810
  width: target.clientWidth / scale,
919
- height: target.clientHeight / scale
920
- }
811
+ height: target.clientHeight / scale,
812
+ },
921
813
  };
922
814
  }
923
815
  alignDimensionsWithInputs(width, height) {
924
- this.interactService.updateSize(this.interactableId, this.registryId, { deltaX: 0, deltaY: 0, width, height }, this.el.nativeElement);
816
+ this.interactService.updateSize(this._interactableId, this.registryId, { deltaX: 0, deltaY: 0, width, height }, this.el.nativeElement);
925
817
  }
926
818
  addResizePropertiesToElement(nativeElement) {
927
819
  this.renderer.setProperty(nativeElement, 'resizeRef', this);
928
820
  }
929
821
  subscribeToScrollEvents() {
930
822
  this.scrollEventsSubscription = this.auto_scroll_dir.scrollDeltaObserver.subscribe(({ scrollLeft, scrollTop }) => {
931
- const scale = this.scale;
823
+ const scale = this.scale();
932
824
  const target = this.el.nativeElement;
933
825
  const { width: prevWidth, height: prevHeight } = target.getBoundingClientRect();
934
826
  const deltaHeight = scrollTop * (this.activeEdges.top ? -1 : this.activeEdges.bottom ? 1 : 0);
@@ -937,52 +829,28 @@ class ResizableDirective {
937
829
  const width = (prevWidth + deltaWidth) / scale;
938
830
  const deltaX = this.activeEdges.left ? (scrollLeft / scale) : 0;
939
831
  const deltaY = this.activeEdges.top ? (scrollTop / scale) : 0;
940
- this.interactService.updateSize(this.interactableId, this.registryId, { deltaX, deltaY, width, height }, this.el.nativeElement);
832
+ this.interactService.updateSize(this._interactableId, this.registryId, { deltaX, deltaY, width, height }, this.el.nativeElement);
941
833
  });
942
834
  }
943
835
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ResizableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
944
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: ResizableDirective, isStandalone: false, selector: "[tftResizable]", inputs: { enableResizeDefault: "enableResizeDefault", position: "position", resizeConfig: "resizeConfig", interactableId: "interactableId", width: "width", height: "height", resizeDisabled: "resizeDisabled" }, outputs: { resizeStart: "resizeStart", resizeMove: "resizeMove", resizeInertiaStart: "resizeInertiaStart", resizeEnd: "resizeEnd" }, host: { properties: { "style.touchAction": "this.resizeDisabled ? \"auto\" : \"none\"", "style.position": "position", "style.boxSizing": "\"border-box\"" } }, usesOnChanges: true, ngImport: i0 }); }
836
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: ResizableDirective, isStandalone: true, selector: "[tftResizable]", inputs: { enableResizeDefault: { classPropertyName: "enableResizeDefault", publicName: "enableResizeDefault", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, resizeConfig: { classPropertyName: "resizeConfig", publicName: "resizeConfig", isSignal: true, isRequired: false, transformFunction: null }, interactableId: { classPropertyName: "interactableId", publicName: "interactableId", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, resizeDisabled: { classPropertyName: "resizeDisabled", publicName: "resizeDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { resizeStart: "resizeStart", resizeMove: "resizeMove", resizeInertiaStart: "resizeInertiaStart", resizeEnd: "resizeEnd" }, host: { properties: { "style.touch-action": "resizeDisabled() ? \"auto\" : \"none\"", "style.position": "position()", "style.box-sizing": "\"border-box\"" } }, ngImport: i0 }); }
945
837
  }
946
838
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ResizableDirective, decorators: [{
947
839
  type: Directive,
948
840
  args: [{
949
841
  selector: '[tftResizable]',
842
+ standalone: true,
950
843
  // eslint-disable-next-line @angular-eslint/no-host-metadata-property
951
844
  host: {
952
- // prevents touch events from colliding with with mouse events
953
- // on touch screen
954
- '[style.touchAction]': 'this.resizeDisabled ? "auto" : "none"',
845
+ // prevents touch events from colliding with mouse events on touch screen
846
+ '[style.touch-action]': 'resizeDisabled() ? "auto" : "none"',
955
847
  // default to absolute here to accommodate likely use cases
956
- // consuming component can easily over ride with position input
957
- '[style.position]': 'position',
848
+ '[style.position]': 'position()',
958
849
  // follows interactjs suggested practices
959
- '[style.boxSizing]': '"border-box"',
850
+ '[style.box-sizing]': '"border-box"',
960
851
  },
961
- standalone: false
962
852
  }]
963
- }], ctorParameters: () => [], propDecorators: { enableResizeDefault: [{
964
- type: Input
965
- }], position: [{
966
- type: Input
967
- }], resizeConfig: [{
968
- type: Input
969
- }], interactableId: [{
970
- type: Input
971
- }], width: [{
972
- type: Input
973
- }], height: [{
974
- type: Input
975
- }], resizeDisabled: [{
976
- type: Input
977
- }], resizeStart: [{
978
- type: Output
979
- }], resizeMove: [{
980
- type: Output
981
- }], resizeInertiaStart: [{
982
- type: Output
983
- }], resizeEnd: [{
984
- type: Output
985
- }] } });
853
+ }], ctorParameters: () => [], propDecorators: { enableResizeDefault: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableResizeDefault", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], resizeConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeConfig", required: false }] }], interactableId: [{ type: i0.Input, args: [{ isSignal: true, alias: "interactableId", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], resizeDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeDisabled", required: false }] }], resizeStart: [{ type: i0.Output, args: ["resizeStart"] }], resizeMove: [{ type: i0.Output, args: ["resizeMove"] }], resizeInertiaStart: [{ type: i0.Output, args: ["resizeInertiaStart"] }], resizeEnd: [{ type: i0.Output, args: ["resizeEnd"] }] } });
986
854
 
987
855
  /** @dynamic */
988
856
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -990,35 +858,32 @@ class GesturableDirective {
990
858
  constructor() {
991
859
  this.el = inject(ElementRef);
992
860
  this.draggable_dir = inject(DraggableDirective, { optional: true });
993
- this.gestureDisabled = false;
994
- // pipes all interact events to event emitters
995
- this.gestureStart = new EventEmitter();
996
- this.gestureMove = new EventEmitter();
997
- this.gestureEnd = new EventEmitter();
998
- }
999
- ngOnInit() {
1000
- this.gesturableId = this.draggable_dir?.interactableId || 'id';
1001
- this.interactable = this.initiateGestureEvents(this.gestureConfig, this.el.nativeElement);
1002
- this.setGestureConfig();
1003
- }
1004
- // TODO: watch config here as well and update interactable
1005
- ngOnChanges(changes) {
1006
- // we do this here instead of using a setter on the input so that it
1007
- // will only run once when there is a change to x and y
1008
- if (changes.gestureConfig || changes.gestureDisabled) {
861
+ this.gesturableId = input(...(ngDevMode ? [undefined, { debugName: "gesturableId" }] : []));
862
+ this.gestureDisabled = input(false, ...(ngDevMode ? [{ debugName: "gestureDisabled" }] : []));
863
+ this.gestureConfig = input(...(ngDevMode ? [undefined, { debugName: "gestureConfig" }] : []));
864
+ this.gestureStart = output();
865
+ this.gestureMove = output();
866
+ this.gestureEnd = output();
867
+ effect(() => {
868
+ this.gestureConfig();
869
+ this.gestureDisabled();
1009
870
  if (!this.interactable)
1010
871
  return;
1011
872
  this.setGestureConfig();
1012
- }
873
+ });
874
+ }
875
+ ngOnInit() {
876
+ this.interactable = this.initiateGestureEvents(this.gestureConfig(), this.el.nativeElement);
877
+ this.setGestureConfig();
1013
878
  }
1014
879
  setGestureConfig() {
1015
- const enabled = !this.gestureDisabled;
1016
- const gestureConfig = { ...this.gestureConfig, enabled };
880
+ const enabled = !this.gestureDisabled();
881
+ const gestureConfig = { ...this.gestureConfig(), enabled };
1017
882
  this.interactable.gesturable(gestureConfig);
1018
883
  }
1019
884
  initiateGestureEvents(gestureConfig, nativeElement) {
1020
885
  const defaultConfig = {
1021
- enabled: !this.gestureDisabled,
886
+ enabled: !this.gestureDisabled(),
1022
887
  };
1023
888
  const interactable = this.draggable_dir?.interactable || interact(nativeElement);
1024
889
  return interactable.gesturable({ ...defaultConfig, ...gestureConfig })
@@ -1033,58 +898,187 @@ class GesturableDirective {
1033
898
  });
1034
899
  }
1035
900
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: GesturableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1036
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: GesturableDirective, isStandalone: false, selector: "[tftGesturable]", inputs: { gesturableId: "gesturableId", gestureDisabled: "gestureDisabled", gestureConfig: "gestureConfig" }, outputs: { gestureStart: "gestureStart", gestureMove: "gestureMove", gestureEnd: "gestureEnd" }, host: { properties: { "id": "gesturableId" } }, usesOnChanges: true, ngImport: i0 }); }
901
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: GesturableDirective, isStandalone: true, selector: "[tftGesturable]", inputs: { gesturableId: { classPropertyName: "gesturableId", publicName: "gesturableId", isSignal: true, isRequired: false, transformFunction: null }, gestureDisabled: { classPropertyName: "gestureDisabled", publicName: "gestureDisabled", isSignal: true, isRequired: false, transformFunction: null }, gestureConfig: { classPropertyName: "gestureConfig", publicName: "gestureConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gestureStart: "gestureStart", gestureMove: "gestureMove", gestureEnd: "gestureEnd" }, host: { properties: { "id": "gesturableId()" } }, ngImport: i0 }); }
1037
902
  }
1038
903
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: GesturableDirective, decorators: [{
1039
904
  type: Directive,
1040
905
  args: [{
1041
906
  selector: '[tftGesturable]',
1042
- // eslint-disable-next-line @angular-eslint/no-host-metadata-property
907
+ standalone: true,
1043
908
  host: {
1044
- // '[style.touchAction]': 'this.gestureDisabled ? "auto" : "none"',
1045
- '[id]': 'gesturableId',
909
+ // '[style.touch-action]': 'gestureDisabled() ? "auto" : "none"',
910
+ '[id]': 'gesturableId()',
1046
911
  },
1047
- standalone: false
1048
912
  }]
1049
- }], propDecorators: { gesturableId: [{
1050
- type: Input
1051
- }], gestureDisabled: [{
1052
- type: Input
1053
- }], gestureConfig: [{
1054
- type: Input
1055
- }], gestureStart: [{
1056
- type: Output
1057
- }], gestureMove: [{
1058
- type: Output
1059
- }], gestureEnd: [{
1060
- type: Output
1061
- }] } });
913
+ }], ctorParameters: () => [], propDecorators: { gesturableId: [{ type: i0.Input, args: [{ isSignal: true, alias: "gesturableId", required: false }] }], gestureDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "gestureDisabled", required: false }] }], gestureConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "gestureConfig", required: false }] }], gestureStart: [{ type: i0.Output, args: ["gestureStart"] }], gestureMove: [{ type: i0.Output, args: ["gestureMove"] }], gestureEnd: [{ type: i0.Output, args: ["gestureEnd"] }] } });
1062
914
 
1063
915
  class ApplyScaleDirective {
1064
916
  constructor() {
1065
917
  this.el = inject(ElementRef);
1066
- this._scale = 1;
918
+ this.scale = input(1, ...(ngDevMode ? [{ debugName: "scale" }] : []));
1067
919
  }
1068
- // this setup allows consumers to set x, y scale independently or just set them both with scale
1069
- set scale(val) {
1070
- this._scale;
1071
- this.fontSize = `${val}px`;
1072
- }
1073
- ;
1074
920
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ApplyScaleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1075
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.6", type: ApplyScaleDirective, isStandalone: false, selector: "[tftApplyScale]", inputs: { scale: "scale" }, host: { properties: { "style.fontSize": "this.fontSize" } }, ngImport: i0 }); }
921
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: ApplyScaleDirective, isStandalone: true, selector: "[tftApplyScale]", inputs: { scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.font-size": "scale() + \"px\"" } }, ngImport: i0 }); }
1076
922
  }
1077
923
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: ApplyScaleDirective, decorators: [{
1078
924
  type: Directive,
1079
925
  args: [{
1080
926
  selector: '[tftApplyScale]',
1081
- standalone: false
927
+ standalone: true,
928
+ host: {
929
+ '[style.font-size]': 'scale() + "px"',
930
+ },
931
+ }]
932
+ }], propDecorators: { scale: [{ type: i0.Input, args: [{ isSignal: true, alias: "scale", required: false }] }] } });
933
+
934
+ /**
935
+ * Directive that handles lasso (drag-to-select) interaction geometry.
936
+ * Manages mouse tracking, the visual selection rectangle, and click suppression.
937
+ * Domain-specific hit-testing (what got selected) is the consumer's responsibility:
938
+ * listen to `(lassoCommit)` with the viewport-space bounding rect and query your own elements.
939
+ *
940
+ * Usage:
941
+ * ```html
942
+ * <div tftLasso #lasso="tftLasso" [scale]="scale"
943
+ * (lassoStart)="onStart()" (lassoCommit)="onCommit($event)">
944
+ * @if (lasso.lassoDisplayRect(); as r) {
945
+ * <div class="lasso-rect" [style.left.px]="r.x" [style.top.px]="r.y"
946
+ * [style.width.px]="r.w" [style.height.px]="r.h"></div>
947
+ * }
948
+ * </div>
949
+ * ```
950
+ */
951
+ class LassoDirective {
952
+ constructor() {
953
+ this.host = inject((ElementRef));
954
+ /** Scale factor applied to the host element — used to convert viewport px to container-local px. */
955
+ this.scale = input(1, ...(ngDevMode ? [{ debugName: "scale" }] : []));
956
+ /** When true, lasso interaction is disabled. */
957
+ this.lassoDisabled = input(false, ...(ngDevMode ? [{ debugName: "lassoDisabled" }] : []));
958
+ /** Emitted on pointerdown (before any drag). Use to clear previous selection state. */
959
+ this.lassoStart = output();
960
+ /**
961
+ * Emitted on pointerup when the drag exceeded the 5 px threshold.
962
+ * Rect is in viewport (clientX/Y) space — pass directly to getBoundingClientRect comparisons.
963
+ */
964
+ this.lassoCommit = output();
965
+ // -------------------------------------------------------------------------
966
+ // Internal state
967
+ // -------------------------------------------------------------------------
968
+ this._startVP = null;
969
+ this._currentVP = null;
970
+ this._startLocal = signal(null, ...(ngDevMode ? [{ debugName: "_startLocal" }] : []));
971
+ this._currentLocal = signal(null, ...(ngDevMode ? [{ debugName: "_currentLocal" }] : []));
972
+ this._suppressNextClick = false;
973
+ this._activePointerId = null;
974
+ /** True while a lasso drag is in progress. */
975
+ this.isLassoing = signal(false, ...(ngDevMode ? [{ debugName: "isLassoing" }] : []));
976
+ /**
977
+ * Rectangle in container-local CSS pixels (pre-divided by scale) — bind directly to
978
+ * [style.left.px], [style.top.px], [style.width.px], [style.height.px].
979
+ * Null when no drag is in progress.
980
+ */
981
+ this.lassoDisplayRect = computed(() => {
982
+ const s = this._startLocal();
983
+ const c = this._currentLocal();
984
+ if (!s || !c || !this.isLassoing())
985
+ return null;
986
+ return {
987
+ x: Math.min(s.x, c.x),
988
+ y: Math.min(s.y, c.y),
989
+ w: Math.abs(c.x - s.x),
990
+ h: Math.abs(c.y - s.y),
991
+ };
992
+ }, ...(ngDevMode ? [{ debugName: "lassoDisplayRect" }] : []));
993
+ }
994
+ toLocal(vpX, vpY) {
995
+ const rect = this.host.nativeElement.getBoundingClientRect();
996
+ return {
997
+ x: (vpX - rect.left) / this.scale(),
998
+ y: (vpY - rect.top) / this.scale(),
999
+ };
1000
+ }
1001
+ // -------------------------------------------------------------------------
1002
+ // Event handling
1003
+ // -------------------------------------------------------------------------
1004
+ onPointerDown(e) {
1005
+ if (this.lassoDisabled())
1006
+ return;
1007
+ if (e.target !== e.currentTarget)
1008
+ return; // ignore clicks on children
1009
+ this._activePointerId = e.pointerId;
1010
+ this.host.nativeElement.setPointerCapture(e.pointerId); // track movement outside element bounds
1011
+ this._startVP = { x: e.clientX, y: e.clientY };
1012
+ this._currentVP = { x: e.clientX, y: e.clientY };
1013
+ this._startLocal.set(this.toLocal(e.clientX, e.clientY));
1014
+ this._currentLocal.set(this.toLocal(e.clientX, e.clientY));
1015
+ this.isLassoing.set(true);
1016
+ this.lassoStart.emit();
1017
+ e.preventDefault();
1018
+ }
1019
+ onPointerMove(e) {
1020
+ if (!this.isLassoing() || e.pointerId !== this._activePointerId)
1021
+ return;
1022
+ this._currentVP = { x: e.clientX, y: e.clientY };
1023
+ this._currentLocal.set(this.toLocal(e.clientX, e.clientY));
1024
+ }
1025
+ onPointerUp(e) {
1026
+ if (!this.isLassoing() || e.pointerId !== this._activePointerId)
1027
+ return;
1028
+ this.isLassoing.set(false);
1029
+ this._activePointerId = null;
1030
+ const s = this._startVP;
1031
+ const c = this._currentVP;
1032
+ this._startVP = null;
1033
+ this._currentVP = null;
1034
+ this._startLocal.set(null);
1035
+ this._currentLocal.set(null);
1036
+ // Treat tiny drags (< 5 px) as background clicks — clear, don't commit
1037
+ if (Math.abs(c.x - s.x) < 5 && Math.abs(c.y - s.y) < 5)
1038
+ return;
1039
+ this._suppressNextClick = true;
1040
+ this.lassoCommit.emit({
1041
+ left: Math.min(s.x, c.x),
1042
+ right: Math.max(s.x, c.x),
1043
+ top: Math.min(s.y, c.y),
1044
+ bottom: Math.max(s.y, c.y),
1045
+ });
1046
+ }
1047
+ /** Suppresses the click event that fires immediately after a real lasso drag ends. */
1048
+ onClick(e) {
1049
+ if (this._suppressNextClick) {
1050
+ this._suppressNextClick = false;
1051
+ e.stopPropagation();
1052
+ }
1053
+ }
1054
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: LassoDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1055
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: LassoDirective, isStandalone: true, selector: "[tftLasso]", inputs: { scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, lassoDisabled: { classPropertyName: "lassoDisabled", publicName: "lassoDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { lassoStart: "lassoStart", lassoCommit: "lassoCommit" }, host: { listeners: { "pointerdown": "onPointerDown($event)", "pointermove": "onPointerMove($event)", "pointerup": "onPointerUp($event)", "pointercancel": "onPointerUp($event)", "click": "onClick($event)" }, properties: { "style.touch-action": "lassoDisabled() ? \"auto\" : \"none\"" } }, exportAs: ["tftLasso"], ngImport: i0 }); }
1056
+ }
1057
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: LassoDirective, decorators: [{
1058
+ type: Directive,
1059
+ args: [{
1060
+ selector: '[tftLasso]',
1061
+ exportAs: 'tftLasso',
1062
+ standalone: true,
1063
+ host: {
1064
+ '[style.touch-action]': 'lassoDisabled() ? "auto" : "none"',
1065
+ },
1082
1066
  }]
1083
- }], propDecorators: { scale: [{
1084
- type: Input
1085
- }], fontSize: [{
1086
- type: HostBinding,
1087
- args: ['style.fontSize']
1067
+ }], propDecorators: { scale: [{ type: i0.Input, args: [{ isSignal: true, alias: "scale", required: false }] }], lassoDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "lassoDisabled", required: false }] }], lassoStart: [{ type: i0.Output, args: ["lassoStart"] }], lassoCommit: [{ type: i0.Output, args: ["lassoCommit"] }], onPointerDown: [{
1068
+ type: HostListener,
1069
+ args: ['pointerdown', ['$event']]
1070
+ }], onPointerMove: [{
1071
+ type: HostListener,
1072
+ args: ['pointermove', ['$event']]
1073
+ }], onPointerUp: [{
1074
+ type: HostListener,
1075
+ args: ['pointerup', ['$event']]
1076
+ }, {
1077
+ type: HostListener,
1078
+ args: ['pointercancel', ['$event']]
1079
+ }], onClick: [{
1080
+ type: HostListener,
1081
+ args: ['click', ['$event']]
1088
1082
  }] } });
1089
1083
 
1090
1084
  const EXPORTS = [
@@ -1097,8 +1091,14 @@ const EXPORTS = [
1097
1091
  AccountForScaleDirective,
1098
1092
  ApplyScaleDirective,
1099
1093
  DragPreviewDirective,
1094
+ LassoDirective,
1100
1095
  ArrayOfNPipe,
1101
1096
  ];
1097
+ /**
1098
+ * @deprecated All directives are now standalone. Import them directly instead of using InteractModule.
1099
+ * InteractModule will be removed in the next major version.
1100
+ * `InteractModule.forRoot()` is still supported for providing InteractService configuration.
1101
+ */
1102
1102
  class InteractModule {
1103
1103
  static forRoot(config) {
1104
1104
  const defaultConfig = { cssDimensionUnit: 'px' };
@@ -1106,12 +1106,12 @@ class InteractModule {
1106
1106
  ngModule: InteractModule,
1107
1107
  providers: [
1108
1108
  { provide: INTERACT_ROOT_CONFIG, useValue: { ...defaultConfig, ...config } },
1109
- InteractService
1110
- ]
1109
+ InteractService,
1110
+ ],
1111
1111
  };
1112
1112
  }
1113
1113
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: InteractModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1114
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.6", ngImport: i0, type: InteractModule, declarations: [DraggableDirective,
1114
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.6", ngImport: i0, type: InteractModule, imports: [DraggableDirective,
1115
1115
  ResizableDirective,
1116
1116
  DropzoneDirective,
1117
1117
  GesturableDirective,
@@ -1120,7 +1120,8 @@ class InteractModule {
1120
1120
  AccountForScaleDirective,
1121
1121
  ApplyScaleDirective,
1122
1122
  DragPreviewDirective,
1123
- ArrayOfNPipe], imports: [CommonModule], exports: [DraggableDirective,
1123
+ LassoDirective,
1124
+ ArrayOfNPipe], exports: [DraggableDirective,
1124
1125
  ResizableDirective,
1125
1126
  DropzoneDirective,
1126
1127
  GesturableDirective,
@@ -1129,20 +1130,15 @@ class InteractModule {
1129
1130
  AccountForScaleDirective,
1130
1131
  ApplyScaleDirective,
1131
1132
  DragPreviewDirective,
1133
+ LassoDirective,
1132
1134
  ArrayOfNPipe] }); }
1133
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: InteractModule, imports: [CommonModule] }); }
1135
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: InteractModule }); }
1134
1136
  }
1135
1137
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: InteractModule, decorators: [{
1136
1138
  type: NgModule,
1137
1139
  args: [{
1138
- imports: [CommonModule],
1139
- // providers: [{ provide: INTERACT_ROOT_CONFIG, useValue: 'px' }],
1140
- declarations: [
1141
- ...EXPORTS,
1142
- ],
1143
- exports: [
1144
- ...EXPORTS
1145
- ]
1140
+ imports: [...EXPORTS],
1141
+ exports: [...EXPORTS],
1146
1142
  }]
1147
1143
  }] });
1148
1144
 
@@ -1150,5 +1146,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImpor
1150
1146
  * Generated bundle index. Do not edit.
1151
1147
  */
1152
1148
 
1153
- export { AccountForScaleDirective, ApplyScaleDirective, ArrayOfNPipe, AutoScrollDirective, DEFAULT_REGISTRY_ID, DragPreviewDirective, DragRootDirective, DraggableDirective, DropzoneDirective, GesturableDirective, INTERACT_ROOT_CONFIG, InteractModule, ResizableDirective, TFT_DRAG_PREVIEW, cloneElement$1 as cloneElement, defaultDelta, defaultPosition, defaultSize, getClosestMatchingAncestor, getRootNode };
1149
+ export { AccountForScaleDirective, ApplyScaleDirective, ArrayOfNPipe, AutoScrollDirective, DEFAULT_REGISTRY_ID, DragPreviewDirective, DragRootDirective, DraggableDirective, DropzoneDirective, GesturableDirective, INTERACT_ROOT_CONFIG, InteractModule, LassoDirective, ResizableDirective, TFT_DRAG_PREVIEW, cloneElement$1 as cloneElement, defaultDelta, defaultPosition, defaultSize, getClosestMatchingAncestor, getRootNode };
1154
1150
  //# sourceMappingURL=tft-interact.mjs.map