@vectoriox/iox-builder 1.4.31 → 1.4.32

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.
@@ -314,6 +314,8 @@ class DragEngineService {
314
314
  this.ids$ = new BehaviorSubject([]);
315
315
  this.isDragging$ = new BehaviorSubject(false);
316
316
  this.deepTarget$ = new BehaviorSubject(null);
317
+ /** Emits the dropped/inserted ComponentNode after every successful drop. */
318
+ this.dropComplete$ = new Subject();
317
319
  // ── Active drag state ─────────────────────────────────────
318
320
  this._isDragging = false;
319
321
  this._payload = null;
@@ -355,6 +357,7 @@ class DragEngineService {
355
357
  if (config) {
356
358
  children.splice(insertIndex, 0, config);
357
359
  cdr.detectChanges();
360
+ this.dropComplete$.next(config);
358
361
  }
359
362
  afterDrop?.();
360
363
  return;
@@ -369,15 +372,19 @@ class DragEngineService {
369
372
  this.getCdr(payload.sourceId)?.detectChanges();
370
373
  }
371
374
  children.splice(insertIndex, 0, item);
375
+ cdr.detectChanges();
376
+ this.dropComplete$.next(item);
372
377
  }
373
378
  else {
374
379
  // Source not in the drop-zone registry → came from an external panel
375
380
  // (e.g. the built-in blocks panel stores one pre-built node object and
376
381
  // reuses it across drags). Deep-clone with fresh IDs so each drop
377
382
  // produces a fully independent node, preventing shared CSS rules.
378
- children.splice(insertIndex, 0, deepCloneNode(item));
383
+ const cloned = deepCloneNode(item);
384
+ children.splice(insertIndex, 0, cloned);
385
+ cdr.detectChanges();
386
+ this.dropComplete$.next(cloned);
379
387
  }
380
- cdr.detectChanges();
381
388
  afterDrop?.();
382
389
  return;
383
390
  }
@@ -387,6 +394,7 @@ class DragEngineService {
387
394
  children.splice(currentIdx, 1);
388
395
  children.splice(adjustedIdx, 0, item);
389
396
  cdr.detectChanges();
397
+ this.dropComplete$.next(item);
390
398
  }
391
399
  afterDrop?.();
392
400
  }
@@ -3286,11 +3294,14 @@ class BuilderComponent {
3286
3294
  this.dsRegistry.setDataSources(this.dataSources);
3287
3295
  this.dragEngine.setScale(this.viewportService.getScale());
3288
3296
  this.sub = this.panelEventService.subscribe((panelEvent) => this.handlePanelEvents(panelEvent));
3289
- this.panelEventService.emit(PanelEventTypes.PANEL_OPEN, PanelTypes.STYLES);
3290
- this.dragEngine.isDragging$.subscribe((v) => {
3297
+ this.sub.add(this.dragEngine.isDragging$.subscribe((v) => {
3291
3298
  this.isDragging = v;
3292
3299
  this.cdr.markForCheck();
3293
- });
3300
+ }));
3301
+ this.sub.add(this.dragEngine.dropComplete$.subscribe((node) => {
3302
+ this._selectAfterDrop(node);
3303
+ }));
3304
+ this.panelEventService.emit(PanelEventTypes.PANEL_OPEN, PanelTypes.STYLES);
3294
3305
  this.viewportSub = this.viewportService.state$.subscribe(state => {
3295
3306
  this.activeDevice = state.device;
3296
3307
  this.activeZoom = Math.round(state.scale * 100);
@@ -3440,12 +3451,15 @@ class BuilderComponent {
3440
3451
  if (!config)
3441
3452
  return;
3442
3453
  this.layout.splice(insertIndex, 0, config);
3454
+ this.cdr.markForCheck();
3455
+ this._selectAfterDrop(config);
3443
3456
  }
3444
3457
  else {
3445
3458
  const clone = this.deepCloneWithNewIds(payload.data);
3446
3459
  this.layout.splice(insertIndex, 0, clone);
3460
+ this.cdr.markForCheck();
3461
+ this._selectAfterDrop(clone);
3447
3462
  }
3448
- this.cdr.markForCheck();
3449
3463
  return;
3450
3464
  }
3451
3465
  const item = payload.data;
@@ -3454,6 +3468,7 @@ class BuilderComponent {
3454
3468
  const clone = this.deepCloneWithNewIds(item);
3455
3469
  this.layout.splice(insertIndex, 0, clone);
3456
3470
  this.cdr.markForCheck();
3471
+ this._selectAfterDrop(clone);
3457
3472
  return;
3458
3473
  }
3459
3474
  if (payload.sourceId && payload.sourceId !== 'canvas-preview') {
@@ -3468,6 +3483,7 @@ class BuilderComponent {
3468
3483
  }
3469
3484
  this.layout.splice(insertIndex, 0, item);
3470
3485
  this.cdr.markForCheck();
3486
+ this._selectAfterDrop(item);
3471
3487
  return;
3472
3488
  }
3473
3489
  // Same-container reorder (canvas root).
@@ -3477,6 +3493,7 @@ class BuilderComponent {
3477
3493
  this.layout.splice(currentIdx, 1);
3478
3494
  this.layout.splice(adjustedIdx, 0, item);
3479
3495
  this.cdr.markForCheck();
3496
+ this._selectAfterDrop(item);
3480
3497
  }
3481
3498
  }
3482
3499
  onModeChange(mode) {
@@ -3549,6 +3566,19 @@ class BuilderComponent {
3549
3566
  this.selectPanel(PanelTypes.STYLES);
3550
3567
  this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node: event.node, componentRef: event.componentRef });
3551
3568
  }
3569
+ _selectAfterDrop(node) {
3570
+ // Wait one tick for Angular to render the new component and register it
3571
+ // in the overlay before attempting to select it.
3572
+ setTimeout(() => {
3573
+ const ref = this.overlayService.getNodeRef(node);
3574
+ if (!ref)
3575
+ return;
3576
+ this.selectedItem = node;
3577
+ this.overlayService.setSelect(ref.element, node.type, this.activeMode, node, ref.componentRef);
3578
+ this.selectPanel(PanelTypes.STYLES);
3579
+ this.panelEventService.emit(PanelEventTypes.ELEMENT_SELECT, { node, componentRef: ref.componentRef });
3580
+ });
3581
+ }
3552
3582
  handleMouseEnter(event) {
3553
3583
  if (this.isDragging || this.activeMode === BuilderMode.Pan)
3554
3584
  return;
@@ -3917,7 +3947,7 @@ class SectionComponent {
3917
3947
  </ng-container>
3918
3948
  </div>
3919
3949
  </div>
3920
- `, isInline: true, styles: [".section-root{position:relative;box-sizing:border-box}.section-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0}.section-placeholder i{font-size:22px}.section-child{min-width:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: RenderDirective, selector: "[ioxRender]", inputs: ["ioxRender"], outputs: ["onClick", "onMouseEnter", "onMouseLeave"] }, { kind: "directive", type: IoxDraggableDirective, selector: "[ioxDraggable]", inputs: ["ioxDragData", "ioxDragSourceId"] }, { kind: "directive", type: IoxDropzoneDirective, selector: "[ioxDropzone]", inputs: ["ioxDropzoneId", "ioxDropzoneData", "ioxDropzonePostDrop"], outputs: ["ioxDrop"] }] }); }
3950
+ `, isInline: true, styles: [".section-root{position:relative;box-sizing:border-box}.section-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0;opacity:0;transition:opacity .15s}.section-root:hover .section-placeholder,.section-root.iox-drag-over .section-placeholder{opacity:1}.section-placeholder i{font-size:22px}.section-child{min-width:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: RenderDirective, selector: "[ioxRender]", inputs: ["ioxRender"], outputs: ["onClick", "onMouseEnter", "onMouseLeave"] }, { kind: "directive", type: IoxDraggableDirective, selector: "[ioxDraggable]", inputs: ["ioxDragData", "ioxDragSourceId"] }, { kind: "directive", type: IoxDropzoneDirective, selector: "[ioxDropzone]", inputs: ["ioxDropzoneId", "ioxDropzoneData", "ioxDropzonePostDrop"], outputs: ["ioxDrop"] }] }); }
3921
3951
  }
3922
3952
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: SectionComponent, decorators: [{
3923
3953
  type: Component,
@@ -3947,7 +3977,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
3947
3977
  </ng-container>
3948
3978
  </div>
3949
3979
  </div>
3950
- `, standalone: false, styles: [".section-root{position:relative;box-sizing:border-box}.section-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0}.section-placeholder i{font-size:22px}.section-child{min-width:0}\n"] }]
3980
+ `, standalone: false, styles: [".section-root{position:relative;box-sizing:border-box}.section-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0;opacity:0;transition:opacity .15s}.section-root:hover .section-placeholder,.section-root.iox-drag-over .section-placeholder{opacity:1}.section-placeholder i{font-size:22px}.section-child{min-width:0}\n"] }]
3951
3981
  }], ctorParameters: () => [{ type: DragEngineService }, { type: i0.ChangeDetectorRef }], propDecorators: { children: [{
3952
3982
  type: Input
3953
3983
  }], style: [{
@@ -4026,7 +4056,7 @@ class BuilderContainerComponent {
4026
4056
  @case ('li') { <li class="container-root" [ngClass]="['iox-node-' + nodeId, listOrientation === 'horizontal' ? 'is-horizontal' : '']" ioxDropzone [ioxDropzoneId]="dropListId" [ioxDropzoneData]="children" (ioxDrop)="onDrop($event)"><ng-container [ngTemplateOutlet]="dropContent"></ng-container></li> }
4027
4057
  @default { <div class="container-root" [ngClass]="['iox-node-' + nodeId, listOrientation === 'horizontal' ? 'is-horizontal' : '']" ioxDropzone [ioxDropzoneId]="dropListId" [ioxDropzoneData]="children" (ioxDrop)="onDrop($event)"><ng-container [ngTemplateOutlet]="dropContent"></ng-container></div> }
4028
4058
  }
4029
- `, isInline: true, styles: [".container-root{position:relative;box-sizing:border-box}.container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0}.container-placeholder i{font-size:18px}.container-child{min-width:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RenderDirective, selector: "[ioxRender]", inputs: ["ioxRender"], outputs: ["onClick", "onMouseEnter", "onMouseLeave"] }, { kind: "directive", type: IoxDraggableDirective, selector: "[ioxDraggable]", inputs: ["ioxDragData", "ioxDragSourceId"] }, { kind: "directive", type: IoxDropzoneDirective, selector: "[ioxDropzone]", inputs: ["ioxDropzoneId", "ioxDropzoneData", "ioxDropzonePostDrop"], outputs: ["ioxDrop"] }] }); }
4059
+ `, isInline: true, styles: [".container-root{position:relative;box-sizing:border-box}.container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0;opacity:0;transition:opacity .15s}.container-root:hover .container-placeholder,.container-root.iox-drag-over .container-placeholder{opacity:1}.container-placeholder i{font-size:18px}.container-child{min-width:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RenderDirective, selector: "[ioxRender]", inputs: ["ioxRender"], outputs: ["onClick", "onMouseEnter", "onMouseLeave"] }, { kind: "directive", type: IoxDraggableDirective, selector: "[ioxDraggable]", inputs: ["ioxDragData", "ioxDragSourceId"] }, { kind: "directive", type: IoxDropzoneDirective, selector: "[ioxDropzone]", inputs: ["ioxDropzoneId", "ioxDropzoneData", "ioxDropzonePostDrop"], outputs: ["ioxDrop"] }] }); }
4030
4060
  }
4031
4061
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BuilderContainerComponent, decorators: [{
4032
4062
  type: Component,
@@ -4062,7 +4092,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
4062
4092
  @case ('li') { <li class="container-root" [ngClass]="['iox-node-' + nodeId, listOrientation === 'horizontal' ? 'is-horizontal' : '']" ioxDropzone [ioxDropzoneId]="dropListId" [ioxDropzoneData]="children" (ioxDrop)="onDrop($event)"><ng-container [ngTemplateOutlet]="dropContent"></ng-container></li> }
4063
4093
  @default { <div class="container-root" [ngClass]="['iox-node-' + nodeId, listOrientation === 'horizontal' ? 'is-horizontal' : '']" ioxDropzone [ioxDropzoneId]="dropListId" [ioxDropzoneData]="children" (ioxDrop)="onDrop($event)"><ng-container [ngTemplateOutlet]="dropContent"></ng-container></div> }
4064
4094
  }
4065
- `, standalone: false, styles: [".container-root{position:relative;box-sizing:border-box}.container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0}.container-placeholder i{font-size:18px}.container-child{min-width:0}\n"] }]
4095
+ `, standalone: false, styles: [".container-root{position:relative;box-sizing:border-box}.container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;z-index:0;opacity:0;transition:opacity .15s}.container-root:hover .container-placeholder,.container-root.iox-drag-over .container-placeholder{opacity:1}.container-placeholder i{font-size:18px}.container-child{min-width:0}\n"] }]
4066
4096
  }], ctorParameters: () => [{ type: DragEngineService }, { type: i0.ChangeDetectorRef }], propDecorators: { children: [{
4067
4097
  type: Input
4068
4098
  }], style: [{
@@ -4161,7 +4191,7 @@ class BuilderLinkedContainerComponent {
4161
4191
  </ng-container>
4162
4192
  </div>
4163
4193
  </a>
4164
- `, isInline: true, styles: [".linked-container-root{display:block;position:relative;box-sizing:border-box;text-decoration:none;color:inherit;cursor:pointer}.linked-container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none}.linked-container-placeholder i{font-size:18px}.linked-container-child{min-width:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: RenderDirective, selector: "[ioxRender]", inputs: ["ioxRender"], outputs: ["onClick", "onMouseEnter", "onMouseLeave"] }, { kind: "directive", type: IoxDraggableDirective, selector: "[ioxDraggable]", inputs: ["ioxDragData", "ioxDragSourceId"] }, { kind: "directive", type: IoxDropzoneDirective, selector: "[ioxDropzone]", inputs: ["ioxDropzoneId", "ioxDropzoneData", "ioxDropzonePostDrop"], outputs: ["ioxDrop"] }] }); }
4194
+ `, isInline: true, styles: [".linked-container-root{display:block;position:relative;box-sizing:border-box;text-decoration:none;color:inherit;cursor:pointer}.linked-container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;opacity:0;transition:opacity .15s}.linked-container-root:hover .linked-container-placeholder,.linked-container-root.iox-drag-over .linked-container-placeholder{opacity:1}.linked-container-placeholder i{font-size:18px}.linked-container-child{min-width:0}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: RenderDirective, selector: "[ioxRender]", inputs: ["ioxRender"], outputs: ["onClick", "onMouseEnter", "onMouseLeave"] }, { kind: "directive", type: IoxDraggableDirective, selector: "[ioxDraggable]", inputs: ["ioxDragData", "ioxDragSourceId"] }, { kind: "directive", type: IoxDropzoneDirective, selector: "[ioxDropzone]", inputs: ["ioxDropzoneId", "ioxDropzoneData", "ioxDropzonePostDrop"], outputs: ["ioxDrop"] }] }); }
4165
4195
  }
4166
4196
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: BuilderLinkedContainerComponent, decorators: [{
4167
4197
  type: Component,
@@ -4194,7 +4224,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
4194
4224
  </ng-container>
4195
4225
  </div>
4196
4226
  </a>
4197
- `, standalone: false, styles: [".linked-container-root{display:block;position:relative;box-sizing:border-box;text-decoration:none;color:inherit;cursor:pointer}.linked-container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none}.linked-container-placeholder i{font-size:18px}.linked-container-child{min-width:0}\n"] }]
4227
+ `, standalone: false, styles: [".linked-container-root{display:block;position:relative;box-sizing:border-box;text-decoration:none;color:inherit;cursor:pointer}.linked-container-placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.5rem;border:1.5px dashed rgba(100,116,139,.35);border-radius:4px;color:#64748b80;font-size:12px;pointer-events:none;-webkit-user-select:none;user-select:none;opacity:0;transition:opacity .15s}.linked-container-root:hover .linked-container-placeholder,.linked-container-root.iox-drag-over .linked-container-placeholder{opacity:1}.linked-container-placeholder i{font-size:18px}.linked-container-child{min-width:0}\n"] }]
4198
4228
  }], ctorParameters: () => [{ type: DragEngineService }, { type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: undefined, decorators: [{
4199
4229
  type: Optional
4200
4230
  }, {