@foblex/flow 17.5.6 → 17.5.8

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.
@@ -7242,6 +7242,9 @@ class EventExtensions {
7242
7242
  static passiveListener() {
7243
7243
  return EventExtensions.passiveEventListener({ passive: true });
7244
7244
  }
7245
+ static activeCaptureListener() {
7246
+ return EventExtensions.passiveEventListener({ passive: false, capture: true });
7247
+ }
7245
7248
  static emptyListener() {
7246
7249
  return () => {
7247
7250
  };
@@ -7274,10 +7277,10 @@ class DragAndDropBase {
7274
7277
  const isSyntheticEvent = this.isSyntheticEvent(event);
7275
7278
  const isFakeEvent = isFakeMousedownFromScreenReader(event);
7276
7279
  const mouseEvent = new IMouseEvent(event);
7277
- this.pointerDownElement = mouseEvent.targetElement;
7278
- if (isSyntheticEvent || isFakeEvent || this.disabled) {
7280
+ if (isSyntheticEvent || isFakeEvent || this.disabled || this.isDragStarted) {
7279
7281
  return;
7280
7282
  }
7283
+ this.pointerDownElement = mouseEvent.targetElement;
7281
7284
  let result = this.onPointerDown(mouseEvent);
7282
7285
  if (result) {
7283
7286
  this.dragStartTime = Date.now();
@@ -7286,21 +7289,25 @@ class DragAndDropBase {
7286
7289
  this.document?.addEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
7287
7290
  this.document?.addEventListener('mousemove', this.onMouseMove);
7288
7291
  this.document?.addEventListener('pointerup', this.onPointerUpEvent);
7292
+ this.document?.addEventListener('pointercancel', this.onPointerUpEvent, EventExtensions.activeCaptureListener());
7293
+ this.document?.addEventListener('contextmenu', this.onContextMenuDuringDrag, EventExtensions.activeCaptureListener());
7289
7294
  });
7290
7295
  this.mouseListeners = () => {
7291
7296
  this.document?.removeEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
7292
7297
  this.document?.removeEventListener('mousemove', this.onMouseMove);
7293
7298
  this.document?.removeEventListener('pointerup', this.onPointerUpEvent);
7299
+ this.document?.removeEventListener('pointercancel', this.onPointerUpEvent, EventExtensions.activeCaptureListener());
7300
+ this.document?.removeEventListener('contextmenu', this.onContextMenuDuringDrag, EventExtensions.activeCaptureListener());
7294
7301
  };
7295
7302
  }
7296
7303
  };
7297
7304
  onTouchDown = (event) => {
7298
7305
  const isFakeEvent = isFakeTouchstartFromScreenReader(event);
7299
7306
  const touchEvent = new ITouchDownEvent(event);
7300
- this.pointerDownElement = touchEvent.targetElement;
7301
- if (isFakeEvent || this.disabled) {
7307
+ if (isFakeEvent || this.disabled || this.isDragStarted) {
7302
7308
  return;
7303
7309
  }
7310
+ this.pointerDownElement = touchEvent.targetElement;
7304
7311
  let result = this.onPointerDown(touchEvent);
7305
7312
  if (result) {
7306
7313
  this.dragStartTime = Date.now();
@@ -7309,11 +7316,15 @@ class DragAndDropBase {
7309
7316
  this.document?.addEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
7310
7317
  this.document?.addEventListener('touchmove', this.onTouchMove);
7311
7318
  this.document?.addEventListener('pointerup', this.onPointerUpEvent);
7319
+ this.document?.addEventListener('pointercancel', this.onPointerUpEvent, EventExtensions.activeCaptureListener());
7320
+ this.document?.addEventListener('contextmenu', this.onContextMenuDuringDrag, EventExtensions.activeCaptureListener());
7312
7321
  });
7313
7322
  this.touchListeners = () => {
7314
7323
  this.document?.removeEventListener('selectstart', this.onSelectStart, EventExtensions.activeListener());
7315
7324
  this.document?.removeEventListener('touchmove', this.onTouchMove);
7316
7325
  this.document?.removeEventListener('pointerup', this.onPointerUpEvent);
7326
+ this.document?.removeEventListener('pointercancel', this.onPointerUpEvent, EventExtensions.activeCaptureListener());
7327
+ this.document?.removeEventListener('contextmenu', this.onContextMenuDuringDrag, EventExtensions.activeCaptureListener());
7317
7328
  };
7318
7329
  }
7319
7330
  };
@@ -7387,6 +7398,11 @@ class DragAndDropBase {
7387
7398
  this.mouseListeners();
7388
7399
  this.mouseListeners = EventExtensions.emptyListener();
7389
7400
  }
7401
+ onContextMenuDuringDrag = (e) => {
7402
+ if (this.isDragStarted) {
7403
+ e.preventDefault();
7404
+ }
7405
+ };
7390
7406
  }
7391
7407
  function isTouchEvent(event) {
7392
7408
  return event.type[0] === 't';
@@ -10082,6 +10098,8 @@ class FCanvasChangeEvent {
10082
10098
  const F_CANVAS = new InjectionToken('F_CANVAS');
10083
10099
  class FCanvasBase {
10084
10100
  transform = TransformModelExtensions.default();
10101
+ _fCanvasChange = new FChannel();
10102
+ _destroyRef = inject(DestroyRef);
10085
10103
  getPosition() {
10086
10104
  return this.transform.position;
10087
10105
  }
@@ -10089,7 +10107,12 @@ class FCanvasBase {
10089
10107
  this.transform.position = position;
10090
10108
  }
10091
10109
  emitCanvasChangeEvent() {
10092
- this.fCanvasChange.emit(new FCanvasChangeEvent(PointExtensions.sum(this.transform.position, this.transform.scaledPosition), this.transform.scale));
10110
+ this._fCanvasChange.notify();
10111
+ }
10112
+ subscribeOnCanvasChange() {
10113
+ new FChannelHub(this._fCanvasChange).pipe(debounceTime(this.debounce())).listen(this._destroyRef, () => {
10114
+ this.fCanvasChange.emit(new FCanvasChangeEvent(PointExtensions.sum(this.transform.position, this.transform.scaledPosition), this.transform.scale));
10115
+ });
10093
10116
  }
10094
10117
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FCanvasBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
10095
10118
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FCanvasBase, ngImport: i0 });
@@ -10106,6 +10129,8 @@ class FCanvasComponent extends FCanvasBase {
10106
10129
  fCanvasChange = output();
10107
10130
  position = input(PointExtensions.initialize(), { transform: PointExtensions.castToPoint });
10108
10131
  scale = input(1, { transform: numberAttribute });
10132
+ debounceTime = input(0, { transform: numberAttribute });
10133
+ debounce = computed(() => this.debounceTime() < 0 ? 0 : this.debounceTime());
10109
10134
  get hostElement() {
10110
10135
  return this._elementReference.nativeElement;
10111
10136
  }
@@ -10120,6 +10145,7 @@ class FCanvasComponent extends FCanvasBase {
10120
10145
  this._fMediator.execute(new AddCanvasToStoreRequest(this));
10121
10146
  this._positionChange();
10122
10147
  this._scaleChange();
10148
+ super.subscribeOnCanvasChange();
10123
10149
  }
10124
10150
  _positionChange() {
10125
10151
  effect(() => {
@@ -10175,7 +10201,7 @@ class FCanvasComponent extends FCanvasBase {
10175
10201
  this._fMediator.execute(new RemoveCanvasFromStoreRequest());
10176
10202
  }
10177
10203
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FCanvasComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
10178
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.13", type: FCanvasComponent, isStandalone: true, selector: "f-canvas", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fCanvasChange: "fCanvasChange" }, host: { classAttribute: "f-component f-canvas" }, providers: [
10204
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "18.2.13", type: FCanvasComponent, isStandalone: true, selector: "f-canvas", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, scale: { classPropertyName: "scale", publicName: "scale", isSignal: true, isRequired: false, transformFunction: null }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fCanvasChange: "fCanvasChange" }, host: { classAttribute: "f-component f-canvas" }, providers: [
10179
10205
  { provide: F_CANVAS, useExisting: FCanvasComponent }
10180
10206
  ], viewQueries: [{ propertyName: "fGroupsContainer", first: true, predicate: ["fGroupsContainer"], descendants: true, isSignal: true }, { propertyName: "fNodesContainer", first: true, predicate: ["fNodesContainer"], descendants: true, isSignal: true }, { propertyName: "fConnectionsContainer", first: true, predicate: ["fConnectionsContainer"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-container>\n <div #fGroupsContainer>\n <ng-content select=\"[fGroup]\"></ng-content>\n </div>\n <div #fConnectionsContainer>\n <ng-content select=\"f-snap-connection\"></ng-content>\n <ng-content select=\"f-connection\"></ng-content>\n <ng-content select=\"f-connection-for-create\"></ng-content>\n </div>\n\n <div #fNodesContainer>\n <ng-content select=\"[fNode]\"></ng-content>\n </div>\n</ng-container>\n", styles: [":host{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}:host.f-scaled-animate{transition:transform .09s}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
10181
10207
  }