cloud-ide-element 1.0.12 → 1.0.13

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.
@@ -3375,841 +3375,361 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
3375
3375
  }]
3376
3376
  }], ctorParameters: () => [] });
3377
3377
 
3378
- class KeyboardShortcutService {
3379
- shortcuts = new Map();
3380
- overrides = new Map();
3381
- keydownListener;
3382
- constructor() {
3383
- this.setupGlobalListener();
3378
+ class CideEleFloatingContainerService {
3379
+ injector;
3380
+ containers = signal(new Map(), ...(ngDevMode ? [{ debugName: "containers" }] : []));
3381
+ nextZIndex = signal(1000, ...(ngDevMode ? [{ debugName: "nextZIndex" }] : []));
3382
+ instanceCounter = signal(0, ...(ngDevMode ? [{ debugName: "instanceCounter" }] : []));
3383
+ // Dynamic component management
3384
+ componentRegistry = new Map();
3385
+ activeComponents = new Map();
3386
+ constructor(injector) {
3387
+ this.injector = injector;
3388
+ // Keyboard shortcuts are registered by FloatingContainerShortcutsService independently
3384
3389
  }
3385
- ngOnDestroy() {
3386
- this.removeGlobalListener();
3390
+ // Computed properties
3391
+ visibleContainers = computed(() => Array.from(this.containers().values()).filter(container => container.isVisible), ...(ngDevMode ? [{ debugName: "visibleContainers" }] : []));
3392
+ minimizedContainers = computed(() => Array.from(this.containers().values()).filter(container => container.isMinimized), ...(ngDevMode ? [{ debugName: "minimizedContainers" }] : []));
3393
+ maximizedContainers = computed(() => Array.from(this.containers().values()).filter(container => container.isMaximized), ...(ngDevMode ? [{ debugName: "maximizedContainers" }] : []));
3394
+ // Container management methods
3395
+ show(config) {
3396
+ const containerId = config.id || this.generateId();
3397
+ const instanceId = this.generateInstanceId(config.componentId || 'default');
3398
+ // Get the highest z-index and add 1 to bring new container to front
3399
+ const maxZIndex = this.getMaxZIndex();
3400
+ const zIndex = maxZIndex + 1;
3401
+ const now = new Date();
3402
+ const container = {
3403
+ id: containerId,
3404
+ config: { ...config, id: containerId },
3405
+ isVisible: true,
3406
+ isMinimized: false,
3407
+ isMaximized: false,
3408
+ zIndex,
3409
+ instanceId,
3410
+ componentType: config.componentId || 'default',
3411
+ createdAt: now,
3412
+ lastAccessed: now
3413
+ };
3414
+ this.containers.update(containers => {
3415
+ const newContainers = new Map(containers);
3416
+ newContainers.set(containerId, container);
3417
+ return newContainers;
3418
+ });
3419
+ this.nextZIndex.update(z => z + 1);
3420
+ return containerId;
3387
3421
  }
3388
- /**
3389
- * Register a new keyboard shortcut
3390
- */
3391
- register(shortcut) {
3392
- this.shortcuts.set(shortcut.id, shortcut);
3393
- console.log(`⌨️ [KeyboardShortcut] Registered shortcut: ${shortcut.id} (${this.getKeyDescription(shortcut)})`);
3422
+ hide(containerId) {
3423
+ this.containers.update(containers => {
3424
+ const newContainers = new Map(containers);
3425
+ const container = newContainers.get(containerId);
3426
+ if (container) {
3427
+ container.isVisible = false;
3428
+ newContainers.set(containerId, container);
3429
+ }
3430
+ return newContainers;
3431
+ });
3394
3432
  }
3395
3433
  /**
3396
- * Override an existing shortcut with new key combination
3434
+ * Get the maximum z-index among all visible containers
3397
3435
  */
3398
- override(shortcutId, newKey, options) {
3399
- const originalShortcut = this.shortcuts.get(shortcutId);
3400
- if (!originalShortcut) {
3401
- console.warn(`⚠️ [KeyboardShortcut] Cannot override shortcut '${shortcutId}' - not found`);
3402
- return;
3436
+ getMaxZIndex() {
3437
+ const containers = this.containers();
3438
+ let maxZIndex = 1000; // Base z-index
3439
+ for (const container of containers.values()) {
3440
+ if (container.isVisible && container.zIndex > maxZIndex) {
3441
+ maxZIndex = container.zIndex;
3442
+ }
3403
3443
  }
3404
- const override = {
3405
- shortcutId,
3406
- newKey,
3407
- newCtrlKey: options?.ctrlKey,
3408
- newAltKey: options?.altKey,
3409
- newShiftKey: options?.shiftKey,
3410
- newMetaKey: options?.metaKey
3411
- };
3412
- this.overrides.set(shortcutId, override);
3413
- console.log(`🔄 [KeyboardShortcut] Override registered for '${shortcutId}': ${this.getKeyDescription({ ...originalShortcut, ...options, key: newKey })}`);
3414
- }
3415
- /**
3416
- * Remove a shortcut
3417
- */
3418
- unregister(shortcutId) {
3419
- this.shortcuts.delete(shortcutId);
3420
- this.overrides.delete(shortcutId);
3421
- console.log(`🗑️ [KeyboardShortcut] Removed shortcut: ${shortcutId}`);
3444
+ return maxZIndex;
3422
3445
  }
3423
3446
  /**
3424
- * Remove override for a shortcut (restore original key combination)
3447
+ * Bring a container to the front (highest z-index)
3425
3448
  */
3426
- removeOverride(shortcutId) {
3427
- this.overrides.delete(shortcutId);
3428
- console.log(`🔄 [KeyboardShortcut] Override removed for: ${shortcutId}`);
3449
+ bringToFront(containerId) {
3450
+ const maxZIndex = this.getMaxZIndex();
3451
+ const newZIndex = maxZIndex + 1;
3452
+ console.log(`🎯 [FloatingContainer] Bringing container '${containerId}' to front`);
3453
+ console.log(`🎯 [FloatingContainer] Current max z-index: ${maxZIndex}, new z-index: ${newZIndex}`);
3454
+ this.containers.update(containers => {
3455
+ const newContainers = new Map(containers);
3456
+ const container = newContainers.get(containerId);
3457
+ if (container) {
3458
+ const oldZIndex = container.zIndex;
3459
+ container.zIndex = newZIndex;
3460
+ container.lastAccessed = new Date();
3461
+ newContainers.set(containerId, container);
3462
+ console.log(`🎯 [FloatingContainer] Container '${containerId}' z-index updated: ${oldZIndex} → ${newZIndex}`);
3463
+ }
3464
+ else {
3465
+ console.warn(`⚠️ [FloatingContainer] Container '${containerId}' not found!`);
3466
+ }
3467
+ return newContainers;
3468
+ });
3429
3469
  }
3430
- /**
3431
- * Get all registered shortcuts
3432
- */
3433
- getAllShortcuts() {
3434
- return Array.from(this.shortcuts.values());
3470
+ minimize(containerId) {
3471
+ this.containers.update(containers => {
3472
+ const newContainers = new Map(containers);
3473
+ const container = newContainers.get(containerId);
3474
+ if (container) {
3475
+ container.isMinimized = !container.isMinimized;
3476
+ newContainers.set(containerId, container);
3477
+ }
3478
+ return newContainers;
3479
+ });
3435
3480
  }
3436
- /**
3437
- * Get shortcuts by category or filter
3438
- */
3439
- getShortcuts(filter) {
3440
- const shortcuts = this.getAllShortcuts();
3441
- return filter ? shortcuts.filter(filter) : shortcuts;
3481
+ maximize(containerId) {
3482
+ this.containers.update(containers => {
3483
+ const newContainers = new Map(containers);
3484
+ const container = newContainers.get(containerId);
3485
+ if (container) {
3486
+ container.isMaximized = !container.isMaximized;
3487
+ newContainers.set(containerId, container);
3488
+ }
3489
+ return newContainers;
3490
+ });
3442
3491
  }
3443
- /**
3444
- * Check if a shortcut is registered
3445
- */
3446
- hasShortcut(shortcutId) {
3447
- return this.shortcuts.has(shortcutId);
3492
+ getContainer(containerId) {
3493
+ return this.containers().get(containerId);
3448
3494
  }
3449
- /**
3450
- * Get shortcut information
3451
- */
3452
- getShortcut(shortcutId) {
3453
- return this.shortcuts.get(shortcutId);
3495
+ isVisible(containerId) {
3496
+ const container = this.getContainer(containerId);
3497
+ return container ? container.isVisible : false;
3454
3498
  }
3455
- /**
3456
- * Clear all shortcuts
3457
- */
3458
- clearAll() {
3459
- this.shortcuts.clear();
3460
- this.overrides.clear();
3461
- console.log(`🧹 [KeyboardShortcut] All shortcuts cleared`);
3499
+ isMinimized(containerId) {
3500
+ const container = this.getContainer(containerId);
3501
+ return container ? container.isMinimized : false;
3462
3502
  }
3463
- /**
3464
- * Set up global keyboard listener
3465
- */
3466
- setupGlobalListener() {
3467
- this.keydownListener = (event) => {
3468
- this.handleKeydown(event);
3469
- };
3470
- document.addEventListener('keydown', this.keydownListener);
3471
- console.log(`🎧 [KeyboardShortcut] Global keyboard listener attached`);
3503
+ isMaximized(containerId) {
3504
+ const container = this.getContainer(containerId);
3505
+ return container ? container.isMaximized : false;
3472
3506
  }
3473
- /**
3474
- * Remove global keyboard listener
3475
- */
3476
- removeGlobalListener() {
3477
- if (this.keydownListener) {
3478
- document.removeEventListener('keydown', this.keydownListener);
3479
- this.keydownListener = undefined;
3480
- console.log(`🎧 [KeyboardShortcut] Global keyboard listener removed`);
3481
- }
3507
+ hideAll() {
3508
+ this.containers.update(containers => {
3509
+ const newContainers = new Map(containers);
3510
+ for (const [id, container] of newContainers) {
3511
+ container.isVisible = false;
3512
+ newContainers.set(id, container);
3513
+ }
3514
+ return newContainers;
3515
+ });
3482
3516
  }
3483
- /**
3484
- * Handle keydown events
3485
- */
3486
- handleKeydown(event) {
3487
- for (const [shortcutId, shortcut] of this.shortcuts) {
3488
- if (this.matchesShortcut(event, shortcut)) {
3489
- // Check for override
3490
- const override = this.overrides.get(shortcutId);
3491
- if (override && !this.matchesOverride(event, override)) {
3492
- continue; // Skip if override doesn't match
3493
- }
3494
- if (shortcut.preventDefault !== false) {
3495
- event.preventDefault();
3496
- }
3497
- if (shortcut.stopPropagation) {
3498
- event.stopPropagation();
3517
+ minimizeAll() {
3518
+ this.containers.update(containers => {
3519
+ const newContainers = new Map(containers);
3520
+ for (const [id, container] of newContainers) {
3521
+ if (container.isVisible) {
3522
+ container.isMinimized = true;
3523
+ newContainers.set(id, container);
3499
3524
  }
3500
- console.log(`⌨️ [KeyboardShortcut] Executing shortcut: ${shortcutId}`);
3501
- shortcut.action();
3502
- break; // Only execute one shortcut per keydown
3503
3525
  }
3504
- }
3526
+ return newContainers;
3527
+ });
3505
3528
  }
3506
- /**
3507
- * Check if event matches shortcut
3508
- */
3509
- matchesShortcut(event, shortcut) {
3510
- return event.key === shortcut.key &&
3511
- (shortcut.ctrlKey === undefined || event.ctrlKey === shortcut.ctrlKey) &&
3512
- (shortcut.altKey === undefined || event.altKey === shortcut.altKey) &&
3513
- (shortcut.shiftKey === undefined || event.shiftKey === shortcut.shiftKey) &&
3514
- (shortcut.metaKey === undefined || event.metaKey === shortcut.metaKey);
3529
+ generateId() {
3530
+ return `floating-container-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
3515
3531
  }
3516
- /**
3517
- * Check if event matches override
3518
- */
3519
- matchesOverride(event, override) {
3520
- return event.key === override.newKey &&
3521
- (override.newCtrlKey === undefined || event.ctrlKey === override.newCtrlKey) &&
3522
- (override.newAltKey === undefined || event.altKey === override.newAltKey) &&
3523
- (override.newShiftKey === undefined || event.shiftKey === override.newShiftKey) &&
3524
- (override.newMetaKey === undefined || event.metaKey === override.newMetaKey);
3532
+ generateInstanceId(componentType) {
3533
+ const counter = this.instanceCounter() + 1;
3534
+ this.instanceCounter.update(c => c + 1);
3535
+ return `${componentType}-instance-${counter}-${Date.now()}`;
3525
3536
  }
3526
- /**
3527
- * Get human-readable key description
3528
- */
3529
- getKeyDescription(shortcut) {
3530
- const modifiers = [];
3531
- if (shortcut.ctrlKey)
3532
- modifiers.push('Ctrl');
3533
- if (shortcut.altKey)
3534
- modifiers.push('Alt');
3535
- if (shortcut.shiftKey)
3536
- modifiers.push('Shift');
3537
- if (shortcut.metaKey)
3538
- modifiers.push('Meta');
3539
- return [...modifiers, shortcut.key].join(' + ');
3537
+ // Multiple instance management methods
3538
+ getInstancesByComponentType(componentType) {
3539
+ return Array.from(this.containers().values())
3540
+ .filter(container => container.componentType === componentType);
3540
3541
  }
3541
- /**
3542
- * Get key description for a shortcut ID
3543
- */
3544
- getKeyDescriptionForShortcut(shortcutId) {
3545
- const shortcut = this.shortcuts.get(shortcutId);
3546
- if (!shortcut)
3547
- return 'Not found';
3548
- const override = this.overrides.get(shortcutId);
3549
- if (override) {
3550
- return this.getKeyDescription({
3551
- key: override.newKey,
3552
- ctrlKey: override.newCtrlKey,
3553
- altKey: override.newAltKey,
3554
- shiftKey: override.newShiftKey,
3555
- metaKey: override.newMetaKey
3556
- });
3557
- }
3558
- return this.getKeyDescription(shortcut);
3542
+ getActiveInstancesByComponentType(componentType) {
3543
+ return Array.from(this.containers().values())
3544
+ .filter(container => container.componentType === componentType && container.isVisible);
3559
3545
  }
3560
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: KeyboardShortcutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3561
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: KeyboardShortcutService, providedIn: 'root' });
3562
- }
3563
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: KeyboardShortcutService, decorators: [{
3564
- type: Injectable,
3565
- args: [{
3566
- providedIn: 'root'
3567
- }]
3568
- }], ctorParameters: () => [] });
3569
-
3570
- class FloatingContainerShortcutsService {
3571
- keyboardShortcutService = inject(KeyboardShortcutService);
3572
- containerService = inject(CideEleFloatingContainerService);
3573
- // Z-index layers for different container states
3574
- Z_INDEX_LAYERS = {
3575
- HIDDEN: 100, // Hidden containers (behind everything)
3576
- BACKGROUND: 1000, // Background containers
3577
- NORMAL: 2000, // Normal visible containers
3578
- FOCUSED: 3000, // Focused containers
3579
- MODAL: 4000, // Modal containers
3580
- TOOLTIP: 5000 // Tooltips and overlays
3581
- };
3582
- constructor() {
3583
- this.registerDefaultShortcuts();
3546
+ getInstanceCount(componentType) {
3547
+ return this.getInstancesByComponentType(componentType).length;
3584
3548
  }
3585
- /**
3586
- * Register default floating container shortcuts
3587
- */
3588
- registerDefaultShortcuts() {
3589
- console.log('🎯 [FloatingContainerShortcuts] Registering default shortcuts');
3590
- // Alt + 1, Alt + 2, etc. - Focus specific containers
3591
- this.registerNumberShortcuts();
3592
- // Alt + N - New container
3593
- this.keyboardShortcutService.register({
3594
- id: 'floating-container-new',
3595
- key: 'n',
3596
- altKey: true,
3597
- description: 'Create new floating container',
3598
- action: () => this.openNewContainer(),
3599
- preventDefault: true
3600
- });
3601
- // Alt + P - Previous container
3602
- this.keyboardShortcutService.register({
3603
- id: 'floating-container-previous',
3604
- key: 'p',
3605
- altKey: true,
3606
- description: 'Focus previous container',
3607
- action: () => this.focusPreviousContainer(),
3608
- preventDefault: true
3609
- });
3610
- // Alt + H - Hide all containers
3611
- this.keyboardShortcutService.register({
3612
- id: 'floating-container-hide-all',
3613
- key: 'h',
3614
- altKey: true,
3615
- description: 'Hide all containers',
3616
- action: () => this.hideAllContainers(),
3617
- preventDefault: true
3618
- });
3619
- // Alt + S - Show all containers
3620
- this.keyboardShortcutService.register({
3621
- id: 'floating-container-show-all',
3622
- key: 's',
3623
- altKey: true,
3624
- description: 'Show all containers',
3625
- action: () => this.showAllContainers(),
3626
- preventDefault: true
3627
- });
3628
- // Alt + M - Minimize all containers
3629
- this.keyboardShortcutService.register({
3630
- id: 'floating-container-minimize-all',
3631
- key: 'm',
3632
- altKey: true,
3633
- description: 'Minimize all containers',
3634
- action: () => this.minimizeAllContainers(),
3635
- preventDefault: true
3636
- });
3637
- // Alt + W - Close current container
3638
- this.keyboardShortcutService.register({
3639
- id: 'floating-container-close-current',
3640
- key: 'w',
3641
- altKey: true,
3642
- description: 'Close current container',
3643
- action: () => this.closeCurrentContainer(),
3644
- preventDefault: true
3645
- });
3646
- // Alt + D - Duplicate current container
3647
- this.keyboardShortcutService.register({
3648
- id: 'floating-container-duplicate',
3649
- key: 'd',
3650
- altKey: true,
3651
- description: 'Duplicate current container',
3652
- action: () => this.duplicateCurrentContainer(),
3653
- preventDefault: true
3549
+ getActiveInstanceCount(componentType) {
3550
+ return this.getActiveInstancesByComponentType(componentType).length;
3551
+ }
3552
+ // Close all instances of a component type
3553
+ closeAllInstancesOfType(componentType) {
3554
+ const instances = this.getInstancesByComponentType(componentType);
3555
+ instances.forEach(instance => {
3556
+ this.hide(instance.id);
3654
3557
  });
3655
- // Alt + T - Toggle container visibility
3656
- this.keyboardShortcutService.register({
3657
- id: 'floating-container-toggle-visibility',
3658
- key: 't',
3659
- altKey: true,
3660
- description: 'Toggle container visibility',
3661
- action: () => this.toggleContainerVisibility(),
3662
- preventDefault: true
3558
+ }
3559
+ // Minimize all instances of a component type
3560
+ minimizeAllInstancesOfType(componentType) {
3561
+ const instances = this.getActiveInstancesByComponentType(componentType);
3562
+ instances.forEach(instance => {
3563
+ this.minimize(instance.id);
3663
3564
  });
3664
- // Alt + O - Open file uploader
3665
- this.keyboardShortcutService.register({
3666
- id: 'floating-container-open-file-uploader',
3667
- key: 'o',
3668
- altKey: true,
3669
- description: 'Open file uploader',
3670
- action: () => this.openFileUploader(),
3671
- preventDefault: true
3565
+ }
3566
+ // Bring all instances of a component type to front
3567
+ bringAllInstancesToFront(componentType) {
3568
+ const instances = this.getActiveInstancesByComponentType(componentType);
3569
+ instances.forEach(instance => {
3570
+ this.bringToFront(instance.id);
3672
3571
  });
3673
- // Alt + R - Open entity rights sharing
3674
- this.keyboardShortcutService.register({
3675
- id: 'floating-container-open-entity-rights',
3676
- key: 'r',
3677
- altKey: true,
3678
- description: 'Open entity rights sharing',
3679
- action: () => this.openEntityRightsSharing(),
3680
- preventDefault: true
3572
+ }
3573
+ // Get instance by unique instance ID
3574
+ getInstanceByInstanceId(instanceId) {
3575
+ return Array.from(this.containers().values())
3576
+ .find(container => container.instanceId === instanceId);
3577
+ }
3578
+ // Update last accessed time
3579
+ updateLastAccessed(containerId) {
3580
+ this.containers.update(containers => {
3581
+ const newContainers = new Map(containers);
3582
+ const container = newContainers.get(containerId);
3583
+ if (container) {
3584
+ container.lastAccessed = new Date();
3585
+ newContainers.set(containerId, container);
3586
+ }
3587
+ return newContainers;
3681
3588
  });
3682
- console.log('✅ [FloatingContainerShortcuts] Default shortcuts registered');
3683
3589
  }
3590
+ // ===== DYNAMIC COMPONENT MANAGEMENT =====
3684
3591
  /**
3685
- * Register number shortcuts (Alt + 1, Alt + 2, etc.)
3592
+ * Register a component for dynamic loading
3686
3593
  */
3687
- registerNumberShortcuts() {
3688
- for (let i = 1; i <= 9; i++) {
3689
- this.keyboardShortcutService.register({
3690
- id: `floating-container-focus-${i}`,
3691
- key: i.toString(),
3692
- altKey: true,
3693
- description: `Focus container ${i}`,
3694
- action: () => this.focusContainerByIndex(i - 1),
3695
- preventDefault: true
3696
- });
3697
- }
3594
+ registerComponent(componentId, componentType) {
3595
+ this.componentRegistry.set(componentId, componentType);
3698
3596
  }
3699
3597
  /**
3700
- * Open new floating container
3598
+ * Unregister a component
3701
3599
  */
3702
- openNewContainer() {
3703
- console.log('🎯 [FloatingContainerShortcuts] Opening new container');
3704
- const containerId = this.containerService.show({
3705
- id: 'new-container-' + Date.now(),
3706
- title: 'New Container',
3707
- width: '400px',
3708
- height: '300px'
3709
- });
3710
- console.log('✅ [FloatingContainerShortcuts] New container created:', containerId);
3600
+ unregisterComponent(componentId) {
3601
+ this.componentRegistry.delete(componentId);
3711
3602
  }
3712
3603
  /**
3713
- * Focus previous container
3604
+ * Get registered component type
3714
3605
  */
3715
- focusPreviousContainer() {
3716
- console.log('🎯 [FloatingContainerShortcuts] Focusing previous container');
3717
- const containers = this.containerService.visibleContainers();
3718
- if (containers.length > 0) {
3719
- // For now, just focus the last container
3720
- const previousIndex = containers.length - 1;
3721
- this.containerService.bringToFront(containers[previousIndex].id);
3722
- }
3606
+ getComponentType(componentId) {
3607
+ return this.componentRegistry.get(componentId);
3723
3608
  }
3724
3609
  /**
3725
- * Hide all containers
3610
+ * Check if component is registered
3726
3611
  */
3727
- hideAllContainers() {
3728
- console.log('🎯 [FloatingContainerShortcuts] Hiding all containers');
3729
- const containers = this.containerService.visibleContainers();
3730
- containers.forEach(container => {
3731
- this.containerService.setZIndex(container.id, this.Z_INDEX_LAYERS.HIDDEN);
3732
- });
3733
- console.log('✅ [FloatingContainerShortcuts] All containers hidden');
3612
+ isComponentRegistered(componentId) {
3613
+ return this.componentRegistry.has(componentId);
3734
3614
  }
3735
3615
  /**
3736
- * Show all containers
3616
+ * Get registered component IDs
3737
3617
  */
3738
- showAllContainers() {
3739
- console.log('🎯 [FloatingContainerShortcuts] Showing all containers');
3740
- const containers = this.containerService.visibleContainers();
3741
- containers.forEach((container, index) => {
3742
- this.containerService.setZIndex(container.id, this.Z_INDEX_LAYERS.NORMAL + index);
3743
- });
3744
- console.log('✅ [FloatingContainerShortcuts] All containers shown');
3618
+ getRegisteredComponentIds() {
3619
+ return Array.from(this.componentRegistry.keys());
3745
3620
  }
3746
3621
  /**
3747
- * Minimize all containers
3622
+ * Create and load component dynamically
3748
3623
  */
3749
- minimizeAllContainers() {
3750
- console.log('🎯 [FloatingContainerShortcuts] Minimizing all containers');
3751
- const containers = this.containerService.visibleContainers();
3752
- containers.forEach(container => {
3753
- // Implement minimize logic here
3754
- console.log('📦 [FloatingContainerShortcuts] Minimizing container:', container.id);
3755
- });
3756
- console.log('✅ [FloatingContainerShortcuts] All containers minimized');
3624
+ loadComponent(componentId, viewContainer, config) {
3625
+ const componentType = this.componentRegistry.get(componentId);
3626
+ if (!componentType) {
3627
+ return null;
3628
+ }
3629
+ try {
3630
+ viewContainer.clear();
3631
+ const componentRef = viewContainer.createComponent(componentType, {
3632
+ injector: this.injector
3633
+ });
3634
+ // Set inputs if provided
3635
+ if (config?.inputs) {
3636
+ Object.keys(config.inputs).forEach(key => {
3637
+ if (componentRef.instance && typeof componentRef.instance === 'object' && key in componentRef.instance) {
3638
+ componentRef.instance[key] = config.inputs[key];
3639
+ }
3640
+ });
3641
+ }
3642
+ // Set outputs if provided
3643
+ if (config?.outputs) {
3644
+ Object.keys(config.outputs).forEach(key => {
3645
+ if (componentRef.instance && typeof componentRef.instance === 'object' && key in componentRef.instance) {
3646
+ const output = componentRef.instance[key];
3647
+ if (output && typeof output.subscribe === 'function') {
3648
+ output.subscribe(config.outputs[key]);
3649
+ }
3650
+ }
3651
+ });
3652
+ }
3653
+ this.activeComponents.set(componentId, componentRef);
3654
+ return componentRef;
3655
+ }
3656
+ catch (error) {
3657
+ return null;
3658
+ }
3757
3659
  }
3758
3660
  /**
3759
- * Focus container by index
3661
+ * Destroy component
3760
3662
  */
3761
- focusContainerByIndex(index) {
3762
- console.log('🎯 [FloatingContainerShortcuts] Focusing container at index:', index);
3763
- const containers = this.containerService.visibleContainers();
3764
- if (containers[index]) {
3765
- this.containerService.bringToFront(containers[index].id);
3766
- console.log('✅ [FloatingContainerShortcuts] Container focused:', containers[index].id);
3767
- }
3768
- else {
3769
- console.warn('⚠️ [FloatingContainerShortcuts] Container not found at index:', index);
3663
+ destroyComponent(componentId) {
3664
+ const componentRef = this.activeComponents.get(componentId);
3665
+ if (componentRef) {
3666
+ componentRef.destroy();
3667
+ this.activeComponents.delete(componentId);
3770
3668
  }
3771
3669
  }
3772
3670
  /**
3773
- * Open file uploader
3671
+ * Get active component count
3774
3672
  */
3775
- openFileUploader() {
3776
- console.log('🎯 [FloatingContainerShortcuts] Opening file uploader');
3777
- // Implement file uploader opening logic here
3778
- console.log('✅ [FloatingContainerShortcuts] File uploader opened');
3673
+ getActiveComponentCount() {
3674
+ return this.activeComponents.size;
3779
3675
  }
3780
3676
  /**
3781
- * Open entity rights sharing
3677
+ * Clear all active components
3782
3678
  */
3783
- openEntityRightsSharing() {
3784
- console.log('🎯 [FloatingContainerShortcuts] Opening entity rights sharing');
3785
- // Implement entity rights sharing opening logic here
3786
- console.log('✅ [FloatingContainerShortcuts] Entity rights sharing opened');
3679
+ clearActiveComponents() {
3680
+ this.activeComponents.forEach(componentRef => componentRef.destroy());
3681
+ this.activeComponents.clear();
3787
3682
  }
3683
+ // ===== CONTAINER MANAGER FUNCTIONALITY =====
3788
3684
  /**
3789
- * Duplicate current container
3685
+ * Get config signal for a container
3790
3686
  */
3791
- duplicateCurrentContainer() {
3792
- console.log('🎯 [FloatingContainerShortcuts] Duplicating current container');
3793
- const containers = this.containerService.visibleContainers();
3794
- if (containers.length > 0) {
3795
- const containerToDuplicate = containers[containers.length - 1]; // Use last container
3796
- const newContainerId = this.containerService.show({
3797
- id: 'duplicate-' + Date.now(),
3798
- title: `${containerToDuplicate.config.title} (Copy)`,
3799
- width: containerToDuplicate.config.width,
3800
- height: containerToDuplicate.config.height
3801
- });
3802
- console.log('✅ [FloatingContainerShortcuts] Container duplicated:', newContainerId);
3803
- }
3804
- else {
3805
- console.warn('⚠️ [FloatingContainerShortcuts] No container to duplicate');
3806
- }
3687
+ getConfigSignal(config) {
3688
+ return signal(config);
3807
3689
  }
3808
3690
  /**
3809
- * Close current container
3691
+ * Get minimized signal for a container
3810
3692
  */
3811
- closeCurrentContainer() {
3812
- console.log('🎯 [FloatingContainerShortcuts] Closing current container');
3813
- const containers = this.containerService.visibleContainers();
3814
- if (containers.length > 0) {
3815
- const containerToClose = containers[containers.length - 1]; // Use last container
3816
- this.containerService.hide(containerToClose.id);
3817
- console.log('✅ [FloatingContainerShortcuts] Container closed:', containerToClose.id);
3818
- }
3819
- else {
3820
- console.warn('⚠️ [FloatingContainerShortcuts] No container to close');
3821
- }
3693
+ getMinimizedSignal(containerId) {
3694
+ return computed(() => {
3695
+ const container = this.getContainer(containerId);
3696
+ return container?.isMinimized || false;
3697
+ });
3822
3698
  }
3823
3699
  /**
3824
- * Toggle container visibility
3700
+ * Get maximized signal for a container
3825
3701
  */
3826
- toggleContainerVisibility() {
3827
- console.log('🎯 [FloatingContainerShortcuts] Toggling container visibility');
3828
- const containers = this.containerService.visibleContainers();
3829
- if (containers.length > 0) {
3830
- const containerToToggle = containers[containers.length - 1]; // Use last container
3831
- const currentZIndex = this.containerService.getZIndexSignal(containerToToggle.id)();
3832
- if (currentZIndex === this.Z_INDEX_LAYERS.HIDDEN) {
3833
- this.containerService.setZIndex(containerToToggle.id, this.Z_INDEX_LAYERS.NORMAL);
3834
- console.log('✅ [FloatingContainerShortcuts] Container shown:', containerToToggle.id);
3835
- }
3836
- else {
3837
- this.containerService.setZIndex(containerToToggle.id, this.Z_INDEX_LAYERS.HIDDEN);
3838
- console.log('✅ [FloatingContainerShortcuts] Container hidden:', containerToToggle.id);
3839
- }
3840
- }
3841
- else {
3842
- console.warn('⚠️ [FloatingContainerShortcuts] No container to toggle');
3843
- }
3844
- }
3845
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: FloatingContainerShortcutsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3846
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: FloatingContainerShortcutsService, providedIn: 'root' });
3847
- }
3848
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: FloatingContainerShortcutsService, decorators: [{
3849
- type: Injectable,
3850
- args: [{
3851
- providedIn: 'root'
3852
- }]
3853
- }], ctorParameters: () => [] });
3854
-
3855
- class CideEleFloatingContainerService {
3856
- injector;
3857
- shortcutsService;
3858
- containers = signal(new Map(), ...(ngDevMode ? [{ debugName: "containers" }] : []));
3859
- nextZIndex = signal(1000, ...(ngDevMode ? [{ debugName: "nextZIndex" }] : []));
3860
- instanceCounter = signal(0, ...(ngDevMode ? [{ debugName: "instanceCounter" }] : []));
3861
- // Dynamic component management
3862
- componentRegistry = new Map();
3863
- activeComponents = new Map();
3864
- constructor(injector, shortcutsService) {
3865
- this.injector = injector;
3866
- this.shortcutsService = shortcutsService;
3867
- // Keyboard shortcuts are automatically registered by FloatingContainerShortcutsService
3868
- console.log('🎯 [FloatingContainerService] Shortcuts service injected and shortcuts registered');
3869
- }
3870
- // Computed properties
3871
- visibleContainers = computed(() => Array.from(this.containers().values()).filter(container => container.isVisible), ...(ngDevMode ? [{ debugName: "visibleContainers" }] : []));
3872
- minimizedContainers = computed(() => Array.from(this.containers().values()).filter(container => container.isMinimized), ...(ngDevMode ? [{ debugName: "minimizedContainers" }] : []));
3873
- maximizedContainers = computed(() => Array.from(this.containers().values()).filter(container => container.isMaximized), ...(ngDevMode ? [{ debugName: "maximizedContainers" }] : []));
3874
- // Container management methods
3875
- show(config) {
3876
- const containerId = config.id || this.generateId();
3877
- const instanceId = this.generateInstanceId(config.componentId || 'default');
3878
- // Get the highest z-index and add 1 to bring new container to front
3879
- const maxZIndex = this.getMaxZIndex();
3880
- const zIndex = maxZIndex + 1;
3881
- const now = new Date();
3882
- const container = {
3883
- id: containerId,
3884
- config: { ...config, id: containerId },
3885
- isVisible: true,
3886
- isMinimized: false,
3887
- isMaximized: false,
3888
- zIndex,
3889
- instanceId,
3890
- componentType: config.componentId || 'default',
3891
- createdAt: now,
3892
- lastAccessed: now
3893
- };
3894
- this.containers.update(containers => {
3895
- const newContainers = new Map(containers);
3896
- newContainers.set(containerId, container);
3897
- return newContainers;
3702
+ getMaximizedSignal(containerId) {
3703
+ return computed(() => {
3704
+ const container = this.getContainer(containerId);
3705
+ return container?.isMaximized || false;
3898
3706
  });
3899
- this.nextZIndex.update(z => z + 1);
3900
- return containerId;
3901
3707
  }
3902
- hide(containerId) {
3903
- this.containers.update(containers => {
3904
- const newContainers = new Map(containers);
3905
- const container = newContainers.get(containerId);
3906
- if (container) {
3907
- container.isVisible = false;
3908
- newContainers.set(containerId, container);
3909
- }
3910
- return newContainers;
3708
+ getZIndexSignal(containerId) {
3709
+ return computed(() => {
3710
+ const container = this.getContainer(containerId);
3711
+ const zIndex = container?.zIndex || 1000;
3712
+ console.log(`🎯 [FloatingContainer] Z-index signal for '${containerId}': ${zIndex}`);
3713
+ return zIndex;
3911
3714
  });
3912
3715
  }
3913
3716
  /**
3914
- * Get the maximum z-index among all visible containers
3915
- */
3916
- getMaxZIndex() {
3917
- const containers = this.containers();
3918
- let maxZIndex = 1000; // Base z-index
3919
- for (const container of containers.values()) {
3920
- if (container.isVisible && container.zIndex > maxZIndex) {
3921
- maxZIndex = container.zIndex;
3922
- }
3923
- }
3924
- return maxZIndex;
3925
- }
3926
- /**
3927
- * Bring a container to the front (highest z-index)
3717
+ * Set z-index for a specific container
3928
3718
  */
3929
- bringToFront(containerId) {
3930
- const maxZIndex = this.getMaxZIndex();
3931
- const newZIndex = maxZIndex + 1;
3932
- console.log(`🎯 [FloatingContainer] Bringing container '${containerId}' to front`);
3933
- console.log(`🎯 [FloatingContainer] Current max z-index: ${maxZIndex}, new z-index: ${newZIndex}`);
3719
+ setZIndex(containerId, zIndex) {
3720
+ console.log(`🎯 [FloatingContainer] Setting z-index for '${containerId}' to ${zIndex}`);
3934
3721
  this.containers.update(containers => {
3935
3722
  const newContainers = new Map(containers);
3936
3723
  const container = newContainers.get(containerId);
3937
3724
  if (container) {
3938
3725
  const oldZIndex = container.zIndex;
3939
- container.zIndex = newZIndex;
3726
+ container.zIndex = zIndex;
3940
3727
  container.lastAccessed = new Date();
3941
3728
  newContainers.set(containerId, container);
3942
- console.log(`🎯 [FloatingContainer] Container '${containerId}' z-index updated: ${oldZIndex} → ${newZIndex}`);
3729
+ console.log(`🎯 [FloatingContainer] Container '${containerId}' z-index updated: ${oldZIndex} → ${zIndex}`);
3943
3730
  }
3944
3731
  else {
3945
- console.warn(`⚠️ [FloatingContainer] Container '${containerId}' not found!`);
3946
- }
3947
- return newContainers;
3948
- });
3949
- }
3950
- minimize(containerId) {
3951
- this.containers.update(containers => {
3952
- const newContainers = new Map(containers);
3953
- const container = newContainers.get(containerId);
3954
- if (container) {
3955
- container.isMinimized = !container.isMinimized;
3956
- newContainers.set(containerId, container);
3957
- }
3958
- return newContainers;
3959
- });
3960
- }
3961
- maximize(containerId) {
3962
- this.containers.update(containers => {
3963
- const newContainers = new Map(containers);
3964
- const container = newContainers.get(containerId);
3965
- if (container) {
3966
- container.isMaximized = !container.isMaximized;
3967
- newContainers.set(containerId, container);
3968
- }
3969
- return newContainers;
3970
- });
3971
- }
3972
- getContainer(containerId) {
3973
- return this.containers().get(containerId);
3974
- }
3975
- isVisible(containerId) {
3976
- const container = this.getContainer(containerId);
3977
- return container ? container.isVisible : false;
3978
- }
3979
- isMinimized(containerId) {
3980
- const container = this.getContainer(containerId);
3981
- return container ? container.isMinimized : false;
3982
- }
3983
- isMaximized(containerId) {
3984
- const container = this.getContainer(containerId);
3985
- return container ? container.isMaximized : false;
3986
- }
3987
- hideAll() {
3988
- this.containers.update(containers => {
3989
- const newContainers = new Map(containers);
3990
- for (const [id, container] of newContainers) {
3991
- container.isVisible = false;
3992
- newContainers.set(id, container);
3993
- }
3994
- return newContainers;
3995
- });
3996
- }
3997
- minimizeAll() {
3998
- this.containers.update(containers => {
3999
- const newContainers = new Map(containers);
4000
- for (const [id, container] of newContainers) {
4001
- if (container.isVisible) {
4002
- container.isMinimized = true;
4003
- newContainers.set(id, container);
4004
- }
4005
- }
4006
- return newContainers;
4007
- });
4008
- }
4009
- generateId() {
4010
- return `floating-container-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
4011
- }
4012
- generateInstanceId(componentType) {
4013
- const counter = this.instanceCounter() + 1;
4014
- this.instanceCounter.update(c => c + 1);
4015
- return `${componentType}-instance-${counter}-${Date.now()}`;
4016
- }
4017
- // Multiple instance management methods
4018
- getInstancesByComponentType(componentType) {
4019
- return Array.from(this.containers().values())
4020
- .filter(container => container.componentType === componentType);
4021
- }
4022
- getActiveInstancesByComponentType(componentType) {
4023
- return Array.from(this.containers().values())
4024
- .filter(container => container.componentType === componentType && container.isVisible);
4025
- }
4026
- getInstanceCount(componentType) {
4027
- return this.getInstancesByComponentType(componentType).length;
4028
- }
4029
- getActiveInstanceCount(componentType) {
4030
- return this.getActiveInstancesByComponentType(componentType).length;
4031
- }
4032
- // Close all instances of a component type
4033
- closeAllInstancesOfType(componentType) {
4034
- const instances = this.getInstancesByComponentType(componentType);
4035
- instances.forEach(instance => {
4036
- this.hide(instance.id);
4037
- });
4038
- }
4039
- // Minimize all instances of a component type
4040
- minimizeAllInstancesOfType(componentType) {
4041
- const instances = this.getActiveInstancesByComponentType(componentType);
4042
- instances.forEach(instance => {
4043
- this.minimize(instance.id);
4044
- });
4045
- }
4046
- // Bring all instances of a component type to front
4047
- bringAllInstancesToFront(componentType) {
4048
- const instances = this.getActiveInstancesByComponentType(componentType);
4049
- instances.forEach(instance => {
4050
- this.bringToFront(instance.id);
4051
- });
4052
- }
4053
- // Get instance by unique instance ID
4054
- getInstanceByInstanceId(instanceId) {
4055
- return Array.from(this.containers().values())
4056
- .find(container => container.instanceId === instanceId);
4057
- }
4058
- // Update last accessed time
4059
- updateLastAccessed(containerId) {
4060
- this.containers.update(containers => {
4061
- const newContainers = new Map(containers);
4062
- const container = newContainers.get(containerId);
4063
- if (container) {
4064
- container.lastAccessed = new Date();
4065
- newContainers.set(containerId, container);
4066
- }
4067
- return newContainers;
4068
- });
4069
- }
4070
- // ===== DYNAMIC COMPONENT MANAGEMENT =====
4071
- /**
4072
- * Register a component for dynamic loading
4073
- */
4074
- registerComponent(componentId, componentType) {
4075
- this.componentRegistry.set(componentId, componentType);
4076
- }
4077
- /**
4078
- * Unregister a component
4079
- */
4080
- unregisterComponent(componentId) {
4081
- this.componentRegistry.delete(componentId);
4082
- }
4083
- /**
4084
- * Get registered component type
4085
- */
4086
- getComponentType(componentId) {
4087
- return this.componentRegistry.get(componentId);
4088
- }
4089
- /**
4090
- * Check if component is registered
4091
- */
4092
- isComponentRegistered(componentId) {
4093
- return this.componentRegistry.has(componentId);
4094
- }
4095
- /**
4096
- * Get registered component IDs
4097
- */
4098
- getRegisteredComponentIds() {
4099
- return Array.from(this.componentRegistry.keys());
4100
- }
4101
- /**
4102
- * Create and load component dynamically
4103
- */
4104
- loadComponent(componentId, viewContainer, config) {
4105
- const componentType = this.componentRegistry.get(componentId);
4106
- if (!componentType) {
4107
- return null;
4108
- }
4109
- try {
4110
- viewContainer.clear();
4111
- const componentRef = viewContainer.createComponent(componentType, {
4112
- injector: this.injector
4113
- });
4114
- // Set inputs if provided
4115
- if (config?.inputs) {
4116
- Object.keys(config.inputs).forEach(key => {
4117
- if (componentRef.instance && typeof componentRef.instance === 'object' && key in componentRef.instance) {
4118
- componentRef.instance[key] = config.inputs[key];
4119
- }
4120
- });
4121
- }
4122
- // Set outputs if provided
4123
- if (config?.outputs) {
4124
- Object.keys(config.outputs).forEach(key => {
4125
- if (componentRef.instance && typeof componentRef.instance === 'object' && key in componentRef.instance) {
4126
- const output = componentRef.instance[key];
4127
- if (output && typeof output.subscribe === 'function') {
4128
- output.subscribe(config.outputs[key]);
4129
- }
4130
- }
4131
- });
4132
- }
4133
- this.activeComponents.set(componentId, componentRef);
4134
- return componentRef;
4135
- }
4136
- catch (error) {
4137
- return null;
4138
- }
4139
- }
4140
- /**
4141
- * Destroy component
4142
- */
4143
- destroyComponent(componentId) {
4144
- const componentRef = this.activeComponents.get(componentId);
4145
- if (componentRef) {
4146
- componentRef.destroy();
4147
- this.activeComponents.delete(componentId);
4148
- }
4149
- }
4150
- /**
4151
- * Get active component count
4152
- */
4153
- getActiveComponentCount() {
4154
- return this.activeComponents.size;
4155
- }
4156
- /**
4157
- * Clear all active components
4158
- */
4159
- clearActiveComponents() {
4160
- this.activeComponents.forEach(componentRef => componentRef.destroy());
4161
- this.activeComponents.clear();
4162
- }
4163
- // ===== CONTAINER MANAGER FUNCTIONALITY =====
4164
- /**
4165
- * Get config signal for a container
4166
- */
4167
- getConfigSignal(config) {
4168
- return signal(config);
4169
- }
4170
- /**
4171
- * Get minimized signal for a container
4172
- */
4173
- getMinimizedSignal(containerId) {
4174
- return computed(() => {
4175
- const container = this.getContainer(containerId);
4176
- return container?.isMinimized || false;
4177
- });
4178
- }
4179
- /**
4180
- * Get maximized signal for a container
4181
- */
4182
- getMaximizedSignal(containerId) {
4183
- return computed(() => {
4184
- const container = this.getContainer(containerId);
4185
- return container?.isMaximized || false;
4186
- });
4187
- }
4188
- getZIndexSignal(containerId) {
4189
- return computed(() => {
4190
- const container = this.getContainer(containerId);
4191
- const zIndex = container?.zIndex || 1000;
4192
- console.log(`🎯 [FloatingContainer] Z-index signal for '${containerId}': ${zIndex}`);
4193
- return zIndex;
4194
- });
4195
- }
4196
- /**
4197
- * Set z-index for a specific container
4198
- */
4199
- setZIndex(containerId, zIndex) {
4200
- console.log(`🎯 [FloatingContainer] Setting z-index for '${containerId}' to ${zIndex}`);
4201
- this.containers.update(containers => {
4202
- const newContainers = new Map(containers);
4203
- const container = newContainers.get(containerId);
4204
- if (container) {
4205
- const oldZIndex = container.zIndex;
4206
- container.zIndex = zIndex;
4207
- container.lastAccessed = new Date();
4208
- newContainers.set(containerId, container);
4209
- console.log(`🎯 [FloatingContainer] Container '${containerId}' z-index updated: ${oldZIndex} → ${zIndex}`);
4210
- }
4211
- else {
4212
- console.warn(`⚠️ [FloatingContainer] Container '${containerId}' not found for z-index update!`);
3732
+ console.warn(`⚠️ [FloatingContainer] Container '${containerId}' not found for z-index update!`);
4213
3733
  }
4214
3734
  return newContainers;
4215
3735
  });
@@ -4254,7 +3774,7 @@ class CideEleFloatingContainerService {
4254
3774
  onMaximize(containerId) {
4255
3775
  this.maximize(containerId);
4256
3776
  }
4257
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleFloatingContainerService, deps: [{ token: i0.Injector }, { token: FloatingContainerShortcutsService }], target: i0.ɵɵFactoryTarget.Injectable });
3777
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleFloatingContainerService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
4258
3778
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleFloatingContainerService, providedIn: 'root' });
4259
3779
  }
4260
3780
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: CideEleFloatingContainerService, decorators: [{
@@ -4262,7 +3782,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
4262
3782
  args: [{
4263
3783
  providedIn: 'root'
4264
3784
  }]
4265
- }], ctorParameters: () => [{ type: i0.Injector }, { type: FloatingContainerShortcutsService }] });
3785
+ }], ctorParameters: () => [{ type: i0.Injector }] });
4266
3786
 
4267
3787
  class CideEleFloatingFileUploaderService {
4268
3788
  containerService = inject(CideEleFloatingContainerService);
@@ -6065,9 +5585,201 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
6065
5585
  type: Output
6066
5586
  }] } });
6067
5587
 
6068
- /**
6069
- <!-- Basic horizontal (left-right) layout -->
6070
- <div class="panel-container">
5588
+ class KeyboardShortcutService {
5589
+ shortcuts = new Map();
5590
+ overrides = new Map();
5591
+ keydownListener;
5592
+ constructor() {
5593
+ this.setupGlobalListener();
5594
+ }
5595
+ ngOnDestroy() {
5596
+ this.removeGlobalListener();
5597
+ }
5598
+ /**
5599
+ * Register a new keyboard shortcut
5600
+ */
5601
+ register(shortcut) {
5602
+ this.shortcuts.set(shortcut.id, shortcut);
5603
+ console.log(`⌨️ [KeyboardShortcut] Registered shortcut: ${shortcut.id} (${this.getKeyDescription(shortcut)})`);
5604
+ }
5605
+ /**
5606
+ * Override an existing shortcut with new key combination
5607
+ */
5608
+ override(shortcutId, newKey, options) {
5609
+ const originalShortcut = this.shortcuts.get(shortcutId);
5610
+ if (!originalShortcut) {
5611
+ console.warn(`⚠️ [KeyboardShortcut] Cannot override shortcut '${shortcutId}' - not found`);
5612
+ return;
5613
+ }
5614
+ const override = {
5615
+ shortcutId,
5616
+ newKey,
5617
+ newCtrlKey: options?.ctrlKey,
5618
+ newAltKey: options?.altKey,
5619
+ newShiftKey: options?.shiftKey,
5620
+ newMetaKey: options?.metaKey
5621
+ };
5622
+ this.overrides.set(shortcutId, override);
5623
+ console.log(`🔄 [KeyboardShortcut] Override registered for '${shortcutId}': ${this.getKeyDescription({ ...originalShortcut, ...options, key: newKey })}`);
5624
+ }
5625
+ /**
5626
+ * Remove a shortcut
5627
+ */
5628
+ unregister(shortcutId) {
5629
+ this.shortcuts.delete(shortcutId);
5630
+ this.overrides.delete(shortcutId);
5631
+ console.log(`🗑️ [KeyboardShortcut] Removed shortcut: ${shortcutId}`);
5632
+ }
5633
+ /**
5634
+ * Remove override for a shortcut (restore original key combination)
5635
+ */
5636
+ removeOverride(shortcutId) {
5637
+ this.overrides.delete(shortcutId);
5638
+ console.log(`🔄 [KeyboardShortcut] Override removed for: ${shortcutId}`);
5639
+ }
5640
+ /**
5641
+ * Get all registered shortcuts
5642
+ */
5643
+ getAllShortcuts() {
5644
+ return Array.from(this.shortcuts.values());
5645
+ }
5646
+ /**
5647
+ * Get shortcuts by category or filter
5648
+ */
5649
+ getShortcuts(filter) {
5650
+ const shortcuts = this.getAllShortcuts();
5651
+ return filter ? shortcuts.filter(filter) : shortcuts;
5652
+ }
5653
+ /**
5654
+ * Check if a shortcut is registered
5655
+ */
5656
+ hasShortcut(shortcutId) {
5657
+ return this.shortcuts.has(shortcutId);
5658
+ }
5659
+ /**
5660
+ * Get shortcut information
5661
+ */
5662
+ getShortcut(shortcutId) {
5663
+ return this.shortcuts.get(shortcutId);
5664
+ }
5665
+ /**
5666
+ * Clear all shortcuts
5667
+ */
5668
+ clearAll() {
5669
+ this.shortcuts.clear();
5670
+ this.overrides.clear();
5671
+ console.log(`🧹 [KeyboardShortcut] All shortcuts cleared`);
5672
+ }
5673
+ /**
5674
+ * Set up global keyboard listener
5675
+ */
5676
+ setupGlobalListener() {
5677
+ this.keydownListener = (event) => {
5678
+ this.handleKeydown(event);
5679
+ };
5680
+ document.addEventListener('keydown', this.keydownListener);
5681
+ console.log(`🎧 [KeyboardShortcut] Global keyboard listener attached`);
5682
+ }
5683
+ /**
5684
+ * Remove global keyboard listener
5685
+ */
5686
+ removeGlobalListener() {
5687
+ if (this.keydownListener) {
5688
+ document.removeEventListener('keydown', this.keydownListener);
5689
+ this.keydownListener = undefined;
5690
+ console.log(`🎧 [KeyboardShortcut] Global keyboard listener removed`);
5691
+ }
5692
+ }
5693
+ /**
5694
+ * Handle keydown events
5695
+ */
5696
+ handleKeydown(event) {
5697
+ for (const [shortcutId, shortcut] of this.shortcuts) {
5698
+ if (this.matchesShortcut(event, shortcut)) {
5699
+ // Check for override
5700
+ const override = this.overrides.get(shortcutId);
5701
+ if (override && !this.matchesOverride(event, override)) {
5702
+ continue; // Skip if override doesn't match
5703
+ }
5704
+ if (shortcut.preventDefault !== false) {
5705
+ event.preventDefault();
5706
+ }
5707
+ if (shortcut.stopPropagation) {
5708
+ event.stopPropagation();
5709
+ }
5710
+ console.log(`⌨️ [KeyboardShortcut] Executing shortcut: ${shortcutId}`);
5711
+ shortcut.action();
5712
+ break; // Only execute one shortcut per keydown
5713
+ }
5714
+ }
5715
+ }
5716
+ /**
5717
+ * Check if event matches shortcut
5718
+ */
5719
+ matchesShortcut(event, shortcut) {
5720
+ return event.key === shortcut.key &&
5721
+ (shortcut.ctrlKey === undefined || event.ctrlKey === shortcut.ctrlKey) &&
5722
+ (shortcut.altKey === undefined || event.altKey === shortcut.altKey) &&
5723
+ (shortcut.shiftKey === undefined || event.shiftKey === shortcut.shiftKey) &&
5724
+ (shortcut.metaKey === undefined || event.metaKey === shortcut.metaKey);
5725
+ }
5726
+ /**
5727
+ * Check if event matches override
5728
+ */
5729
+ matchesOverride(event, override) {
5730
+ return event.key === override.newKey &&
5731
+ (override.newCtrlKey === undefined || event.ctrlKey === override.newCtrlKey) &&
5732
+ (override.newAltKey === undefined || event.altKey === override.newAltKey) &&
5733
+ (override.newShiftKey === undefined || event.shiftKey === override.newShiftKey) &&
5734
+ (override.newMetaKey === undefined || event.metaKey === override.newMetaKey);
5735
+ }
5736
+ /**
5737
+ * Get human-readable key description
5738
+ */
5739
+ getKeyDescription(shortcut) {
5740
+ const modifiers = [];
5741
+ if (shortcut.ctrlKey)
5742
+ modifiers.push('Ctrl');
5743
+ if (shortcut.altKey)
5744
+ modifiers.push('Alt');
5745
+ if (shortcut.shiftKey)
5746
+ modifiers.push('Shift');
5747
+ if (shortcut.metaKey)
5748
+ modifiers.push('Meta');
5749
+ return [...modifiers, shortcut.key].join(' + ');
5750
+ }
5751
+ /**
5752
+ * Get key description for a shortcut ID
5753
+ */
5754
+ getKeyDescriptionForShortcut(shortcutId) {
5755
+ const shortcut = this.shortcuts.get(shortcutId);
5756
+ if (!shortcut)
5757
+ return 'Not found';
5758
+ const override = this.overrides.get(shortcutId);
5759
+ if (override) {
5760
+ return this.getKeyDescription({
5761
+ key: override.newKey,
5762
+ ctrlKey: override.newCtrlKey,
5763
+ altKey: override.newAltKey,
5764
+ shiftKey: override.newShiftKey,
5765
+ metaKey: override.newMetaKey
5766
+ });
5767
+ }
5768
+ return this.getKeyDescription(shortcut);
5769
+ }
5770
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: KeyboardShortcutService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5771
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: KeyboardShortcutService, providedIn: 'root' });
5772
+ }
5773
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: KeyboardShortcutService, decorators: [{
5774
+ type: Injectable,
5775
+ args: [{
5776
+ providedIn: 'root'
5777
+ }]
5778
+ }], ctorParameters: () => [] });
5779
+
5780
+ /**
5781
+ <!-- Basic horizontal (left-right) layout -->
5782
+ <div class="panel-container">
6071
5783
  <div class="left-panel">
6072
5784
  Left Panel Content
6073
5785
  </div>
@@ -10654,8 +10366,294 @@ i0.ɵɵngDeclareClassMetadataAsync({ minVersion: "18.0.0", version: "20.1.7", ng
10654
10366
  ` }]
10655
10367
  }], ctorParameters: null, propDecorators: null }) });
10656
10368
 
10369
+ class FloatingContainerShortcutsService {
10370
+ keyboardShortcutService = inject(KeyboardShortcutService);
10371
+ containerService = inject(CideEleFloatingContainerService);
10372
+ // Z-index layers for different container states
10373
+ Z_INDEX_LAYERS = {
10374
+ HIDDEN: 100, // Hidden containers (behind everything)
10375
+ BACKGROUND: 1000, // Background containers
10376
+ NORMAL: 2000, // Normal visible containers
10377
+ FOCUSED: 3000, // Focused containers
10378
+ MODAL: 4000, // Modal containers
10379
+ TOOLTIP: 5000 // Tooltips and overlays
10380
+ };
10381
+ constructor() {
10382
+ this.registerDefaultShortcuts();
10383
+ }
10384
+ /**
10385
+ * Register default floating container shortcuts
10386
+ */
10387
+ registerDefaultShortcuts() {
10388
+ console.log('🎯 [FloatingContainerShortcuts] Registering default shortcuts');
10389
+ // Alt + 1, Alt + 2, etc. - Focus specific containers
10390
+ this.registerNumberShortcuts();
10391
+ // Alt + N - New container
10392
+ this.keyboardShortcutService.register({
10393
+ id: 'floating-container-new',
10394
+ key: 'n',
10395
+ altKey: true,
10396
+ description: 'Create new floating container',
10397
+ action: () => this.openNewContainer(),
10398
+ preventDefault: true
10399
+ });
10400
+ // Alt + P - Previous container
10401
+ this.keyboardShortcutService.register({
10402
+ id: 'floating-container-previous',
10403
+ key: 'p',
10404
+ altKey: true,
10405
+ description: 'Focus previous container',
10406
+ action: () => this.focusPreviousContainer(),
10407
+ preventDefault: true
10408
+ });
10409
+ // Alt + H - Hide all containers
10410
+ this.keyboardShortcutService.register({
10411
+ id: 'floating-container-hide-all',
10412
+ key: 'h',
10413
+ altKey: true,
10414
+ description: 'Hide all containers',
10415
+ action: () => this.hideAllContainers(),
10416
+ preventDefault: true
10417
+ });
10418
+ // Alt + S - Show all containers
10419
+ this.keyboardShortcutService.register({
10420
+ id: 'floating-container-show-all',
10421
+ key: 's',
10422
+ altKey: true,
10423
+ description: 'Show all containers',
10424
+ action: () => this.showAllContainers(),
10425
+ preventDefault: true
10426
+ });
10427
+ // Alt + M - Minimize all containers
10428
+ this.keyboardShortcutService.register({
10429
+ id: 'floating-container-minimize-all',
10430
+ key: 'm',
10431
+ altKey: true,
10432
+ description: 'Minimize all containers',
10433
+ action: () => this.minimizeAllContainers(),
10434
+ preventDefault: true
10435
+ });
10436
+ // Alt + W - Close current container
10437
+ this.keyboardShortcutService.register({
10438
+ id: 'floating-container-close-current',
10439
+ key: 'w',
10440
+ altKey: true,
10441
+ description: 'Close current container',
10442
+ action: () => this.closeCurrentContainer(),
10443
+ preventDefault: true
10444
+ });
10445
+ // Alt + D - Duplicate current container
10446
+ this.keyboardShortcutService.register({
10447
+ id: 'floating-container-duplicate',
10448
+ key: 'd',
10449
+ altKey: true,
10450
+ description: 'Duplicate current container',
10451
+ action: () => this.duplicateCurrentContainer(),
10452
+ preventDefault: true
10453
+ });
10454
+ // Alt + T - Toggle container visibility
10455
+ this.keyboardShortcutService.register({
10456
+ id: 'floating-container-toggle-visibility',
10457
+ key: 't',
10458
+ altKey: true,
10459
+ description: 'Toggle container visibility',
10460
+ action: () => this.toggleContainerVisibility(),
10461
+ preventDefault: true
10462
+ });
10463
+ // Alt + O - Open file uploader
10464
+ this.keyboardShortcutService.register({
10465
+ id: 'floating-container-open-file-uploader',
10466
+ key: 'o',
10467
+ altKey: true,
10468
+ description: 'Open file uploader',
10469
+ action: () => this.openFileUploader(),
10470
+ preventDefault: true
10471
+ });
10472
+ // Alt + R - Open entity rights sharing
10473
+ this.keyboardShortcutService.register({
10474
+ id: 'floating-container-open-entity-rights',
10475
+ key: 'r',
10476
+ altKey: true,
10477
+ description: 'Open entity rights sharing',
10478
+ action: () => this.openEntityRightsSharing(),
10479
+ preventDefault: true
10480
+ });
10481
+ console.log('✅ [FloatingContainerShortcuts] Default shortcuts registered');
10482
+ }
10483
+ /**
10484
+ * Register number shortcuts (Alt + 1, Alt + 2, etc.)
10485
+ */
10486
+ registerNumberShortcuts() {
10487
+ for (let i = 1; i <= 9; i++) {
10488
+ this.keyboardShortcutService.register({
10489
+ id: `floating-container-focus-${i}`,
10490
+ key: i.toString(),
10491
+ altKey: true,
10492
+ description: `Focus container ${i}`,
10493
+ action: () => this.focusContainerByIndex(i - 1),
10494
+ preventDefault: true
10495
+ });
10496
+ }
10497
+ }
10498
+ /**
10499
+ * Open new floating container
10500
+ */
10501
+ openNewContainer() {
10502
+ console.log('🎯 [FloatingContainerShortcuts] Opening new container');
10503
+ const containerId = this.containerService.show({
10504
+ id: 'new-container-' + Date.now(),
10505
+ title: 'New Container',
10506
+ width: '400px',
10507
+ height: '300px'
10508
+ });
10509
+ console.log('✅ [FloatingContainerShortcuts] New container created:', containerId);
10510
+ }
10511
+ /**
10512
+ * Focus previous container
10513
+ */
10514
+ focusPreviousContainer() {
10515
+ console.log('🎯 [FloatingContainerShortcuts] Focusing previous container');
10516
+ const containers = this.containerService.visibleContainers();
10517
+ if (containers.length > 0) {
10518
+ // For now, just focus the last container
10519
+ const previousIndex = containers.length - 1;
10520
+ this.containerService.bringToFront(containers[previousIndex].id);
10521
+ }
10522
+ }
10523
+ /**
10524
+ * Hide all containers
10525
+ */
10526
+ hideAllContainers() {
10527
+ console.log('🎯 [FloatingContainerShortcuts] Hiding all containers');
10528
+ const containers = this.containerService.visibleContainers();
10529
+ containers.forEach(container => {
10530
+ this.containerService.setZIndex(container.id, this.Z_INDEX_LAYERS.HIDDEN);
10531
+ });
10532
+ console.log('✅ [FloatingContainerShortcuts] All containers hidden');
10533
+ }
10534
+ /**
10535
+ * Show all containers
10536
+ */
10537
+ showAllContainers() {
10538
+ console.log('🎯 [FloatingContainerShortcuts] Showing all containers');
10539
+ const containers = this.containerService.visibleContainers();
10540
+ containers.forEach((container, index) => {
10541
+ this.containerService.setZIndex(container.id, this.Z_INDEX_LAYERS.NORMAL + index);
10542
+ });
10543
+ console.log('✅ [FloatingContainerShortcuts] All containers shown');
10544
+ }
10545
+ /**
10546
+ * Minimize all containers
10547
+ */
10548
+ minimizeAllContainers() {
10549
+ console.log('🎯 [FloatingContainerShortcuts] Minimizing all containers');
10550
+ const containers = this.containerService.visibleContainers();
10551
+ containers.forEach(container => {
10552
+ // Implement minimize logic here
10553
+ console.log('📦 [FloatingContainerShortcuts] Minimizing container:', container.id);
10554
+ });
10555
+ console.log('✅ [FloatingContainerShortcuts] All containers minimized');
10556
+ }
10557
+ /**
10558
+ * Focus container by index
10559
+ */
10560
+ focusContainerByIndex(index) {
10561
+ console.log('🎯 [FloatingContainerShortcuts] Focusing container at index:', index);
10562
+ const containers = this.containerService.visibleContainers();
10563
+ if (containers[index]) {
10564
+ this.containerService.bringToFront(containers[index].id);
10565
+ console.log('✅ [FloatingContainerShortcuts] Container focused:', containers[index].id);
10566
+ }
10567
+ else {
10568
+ console.warn('⚠️ [FloatingContainerShortcuts] Container not found at index:', index);
10569
+ }
10570
+ }
10571
+ /**
10572
+ * Open file uploader
10573
+ */
10574
+ openFileUploader() {
10575
+ console.log('🎯 [FloatingContainerShortcuts] Opening file uploader');
10576
+ // Implement file uploader opening logic here
10577
+ console.log('✅ [FloatingContainerShortcuts] File uploader opened');
10578
+ }
10579
+ /**
10580
+ * Open entity rights sharing
10581
+ */
10582
+ openEntityRightsSharing() {
10583
+ console.log('🎯 [FloatingContainerShortcuts] Opening entity rights sharing');
10584
+ // Implement entity rights sharing opening logic here
10585
+ console.log('✅ [FloatingContainerShortcuts] Entity rights sharing opened');
10586
+ }
10587
+ /**
10588
+ * Duplicate current container
10589
+ */
10590
+ duplicateCurrentContainer() {
10591
+ console.log('🎯 [FloatingContainerShortcuts] Duplicating current container');
10592
+ const containers = this.containerService.visibleContainers();
10593
+ if (containers.length > 0) {
10594
+ const containerToDuplicate = containers[containers.length - 1]; // Use last container
10595
+ const newContainerId = this.containerService.show({
10596
+ id: 'duplicate-' + Date.now(),
10597
+ title: `${containerToDuplicate.config.title} (Copy)`,
10598
+ width: containerToDuplicate.config.width,
10599
+ height: containerToDuplicate.config.height
10600
+ });
10601
+ console.log('✅ [FloatingContainerShortcuts] Container duplicated:', newContainerId);
10602
+ }
10603
+ else {
10604
+ console.warn('⚠️ [FloatingContainerShortcuts] No container to duplicate');
10605
+ }
10606
+ }
10607
+ /**
10608
+ * Close current container
10609
+ */
10610
+ closeCurrentContainer() {
10611
+ console.log('🎯 [FloatingContainerShortcuts] Closing current container');
10612
+ const containers = this.containerService.visibleContainers();
10613
+ if (containers.length > 0) {
10614
+ const containerToClose = containers[containers.length - 1]; // Use last container
10615
+ this.containerService.hide(containerToClose.id);
10616
+ console.log('✅ [FloatingContainerShortcuts] Container closed:', containerToClose.id);
10617
+ }
10618
+ else {
10619
+ console.warn('⚠️ [FloatingContainerShortcuts] No container to close');
10620
+ }
10621
+ }
10622
+ /**
10623
+ * Toggle container visibility
10624
+ */
10625
+ toggleContainerVisibility() {
10626
+ console.log('🎯 [FloatingContainerShortcuts] Toggling container visibility');
10627
+ const containers = this.containerService.visibleContainers();
10628
+ if (containers.length > 0) {
10629
+ const containerToToggle = containers[containers.length - 1]; // Use last container
10630
+ const currentZIndex = this.containerService.getZIndexSignal(containerToToggle.id)();
10631
+ if (currentZIndex === this.Z_INDEX_LAYERS.HIDDEN) {
10632
+ this.containerService.setZIndex(containerToToggle.id, this.Z_INDEX_LAYERS.NORMAL);
10633
+ console.log('✅ [FloatingContainerShortcuts] Container shown:', containerToToggle.id);
10634
+ }
10635
+ else {
10636
+ this.containerService.setZIndex(containerToToggle.id, this.Z_INDEX_LAYERS.HIDDEN);
10637
+ console.log('✅ [FloatingContainerShortcuts] Container hidden:', containerToToggle.id);
10638
+ }
10639
+ }
10640
+ else {
10641
+ console.warn('⚠️ [FloatingContainerShortcuts] No container to toggle');
10642
+ }
10643
+ }
10644
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: FloatingContainerShortcutsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
10645
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: FloatingContainerShortcutsService, providedIn: 'root' });
10646
+ }
10647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: FloatingContainerShortcutsService, decorators: [{
10648
+ type: Injectable,
10649
+ args: [{
10650
+ providedIn: 'root'
10651
+ }]
10652
+ }], ctorParameters: () => [] });
10653
+
10657
10654
  class CideEleFloatingFeaturesService {
10658
10655
  containerService = inject(CideEleFloatingContainerService);
10656
+ shortcutsService = inject(FloatingContainerShortcutsService);
10659
10657
  constructor() {
10660
10658
  // File uploader is handled by its own dedicated service
10661
10659
  // Entity rights sharing is handled by its own dedicated service