lexgui 8.1.2 → 8.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/build/components/AlertDialog.d.ts +7 -7
  2. package/build/components/Avatar.d.ts +15 -0
  3. package/build/components/Counter.d.ts +9 -9
  4. package/build/components/Dialog.d.ts +20 -20
  5. package/build/components/Footer.d.ts +14 -14
  6. package/build/components/Menubar.d.ts +59 -59
  7. package/build/components/NodeTree.d.ts +26 -1
  8. package/build/components/Vector.d.ts +1 -0
  9. package/build/core/Area.d.ts +143 -143
  10. package/build/core/Event.d.ts +0 -20
  11. package/build/core/Namespace.js +1 -1
  12. package/build/core/Namespace.js.map +1 -1
  13. package/build/core/Panel.d.ts +538 -538
  14. package/build/extensions/AssetView.d.ts +137 -136
  15. package/build/extensions/AssetView.js +193 -155
  16. package/build/extensions/AssetView.js.map +1 -1
  17. package/build/extensions/Audio.js +163 -163
  18. package/build/extensions/Audio.js.map +1 -1
  19. package/build/extensions/CodeEditor.d.ts +358 -350
  20. package/build/extensions/CodeEditor.js +302 -270
  21. package/build/extensions/CodeEditor.js.map +1 -1
  22. package/build/extensions/DocMaker.d.ts +27 -27
  23. package/build/extensions/DocMaker.js +15 -11
  24. package/build/extensions/DocMaker.js.map +1 -1
  25. package/build/extensions/GraphEditor.js +2754 -2760
  26. package/build/extensions/GraphEditor.js.map +1 -1
  27. package/build/extensions/ImUi.js +227 -227
  28. package/build/extensions/Timeline.d.ts +668 -670
  29. package/build/extensions/Timeline.js +71 -79
  30. package/build/extensions/Timeline.js.map +1 -1
  31. package/build/extensions/VideoEditor.d.ts +38 -16
  32. package/build/extensions/VideoEditor.js +294 -180
  33. package/build/extensions/VideoEditor.js.map +1 -1
  34. package/build/extensions/index.d.ts +8 -8
  35. package/build/extensions/index.js +10 -10
  36. package/build/index.all.d.ts +2 -2
  37. package/build/index.css.d.ts +3 -4
  38. package/build/index.d.ts +57 -56
  39. package/build/lexgui.all.js +1877 -1520
  40. package/build/lexgui.all.js.map +1 -1
  41. package/build/lexgui.all.min.js +1 -1
  42. package/build/lexgui.all.module.js +1875 -1516
  43. package/build/lexgui.all.module.js.map +1 -1
  44. package/build/lexgui.all.module.min.js +1 -1
  45. package/build/lexgui.css +6123 -5556
  46. package/build/lexgui.js +997 -814
  47. package/build/lexgui.js.map +1 -1
  48. package/build/lexgui.min.css +2 -3
  49. package/build/lexgui.min.js +1 -1
  50. package/build/lexgui.module.js +995 -810
  51. package/build/lexgui.module.js.map +1 -1
  52. package/build/lexgui.module.min.js +1 -1
  53. package/changelog.md +65 -2
  54. package/demo.js +167 -65
  55. package/examples/all-components.html +40 -55
  56. package/examples/asset-view.html +27 -0
  57. package/examples/code-editor.html +12 -1
  58. package/examples/dialogs.html +13 -2
  59. package/examples/editor.html +9 -49
  60. package/examples/index.html +2 -2
  61. package/examples/side-bar.html +1 -1
  62. package/examples/timeline.html +2 -2
  63. package/examples/video-editor.html +1 -1
  64. package/examples/video-editor2.html +2 -2
  65. package/package.json +7 -4
@@ -9,7 +9,7 @@ LX.extensions.push('AssetView');
9
9
  const Area = LX.Area;
10
10
  LX.Panel;
11
11
  LX.NodeTree;
12
- LX.TreeEvent;
12
+ LX.Tree;
13
13
  /**
14
14
  * @class AssetView
15
15
  * @description Asset container with Tree for file system
@@ -51,9 +51,7 @@ class AssetView {
51
51
  allowMultipleSelection = false;
52
52
  previewActions = [];
53
53
  contextMenu = [];
54
- onRefreshContent = null;
55
54
  itemContextMenuOptions = null;
56
- onItemDragged = null;
57
55
  _assetsPerPage = 24;
58
56
  get assetsPerPage() {
59
57
  return this._assetsPerPage;
@@ -92,8 +90,6 @@ class AssetView {
92
90
  this.allowMultipleSelection = options.allowMultipleSelection ?? this.allowMultipleSelection;
93
91
  this.previewActions = options.previewActions ?? [];
94
92
  this.itemContextMenuOptions = options.itemContextMenuOptions;
95
- this.onRefreshContent = options.onRefreshContent;
96
- this.onItemDragged = options.onItemDragged;
97
93
  this.gridScale = options.gridScale ?? this.gridScale;
98
94
  if (this.gridScale !== 1.0) {
99
95
  const r = document.querySelector(':root');
@@ -154,8 +150,7 @@ class AssetView {
154
150
  this.currentData = this.data;
155
151
  this.path = ['@'];
156
152
  if (!this.skipBrowser) {
157
- this.tree.refresh({ id: '/', children: this.data, type: 'folder',
158
- metadata: { uid: LX.guidGenerator() } });
153
+ this.tree.refresh({ id: '/', children: this.data, type: 'folder', metadata: { uid: LX.guidGenerator() } });
159
154
  }
160
155
  this._refreshContent();
161
156
  }
@@ -239,10 +234,8 @@ class AssetView {
239
234
  });
240
235
  itemEl.appendChild(checkbox);
241
236
  }
242
- let title = document.createElement('span');
243
- title.className = 'lexassettitle';
244
- title.innerText = item.id;
245
- itemEl.appendChild(title);
237
+ // Asset title
238
+ LX.makeElement('span', 'lexassettitle absolute w-full h-8 bottom-0 text-sm bg-card text-card-foreground cursor-pointer text-center content-center block px-3 py-0.5 truncate z-1 pointer-events-none', item.id, itemEl);
246
239
  if (!this.skipPreview) {
247
240
  if (item.type === 'video') {
248
241
  const itemVideo = LX.makeElement('video', 'absolute left-0 top-0 w-full border-none pointer-events-none', '', itemEl);
@@ -330,7 +323,6 @@ class AssetView {
330
323
  userInitiated: true
331
324
  };
332
325
  onDblClick(event);
333
- // event.multiple = !!e.shiftKey;
334
326
  }
335
327
  else if (!isDoubleClick && onSelect !== undefined) {
336
328
  const event = {
@@ -339,7 +331,6 @@ class AssetView {
339
331
  userInitiated: true
340
332
  };
341
333
  onSelect(event);
342
- // event.multiple = !!e.shiftKey;
343
334
  }
344
335
  });
345
336
  itemEl.addEventListener('contextmenu', function (e) {
@@ -350,23 +341,21 @@ class AssetView {
350
341
  const options = [
351
342
  {
352
343
  name: (multiple > 1) ? (multiple + ' selected') : item.id,
353
- icon: LX.makeIcon('CircleSmall', { svgClass: `fill-current fg-${typeColor}` }),
344
+ icon: LX.makeIcon('CircleSmall', { svgClass: `fill-current text-${typeColor}` }),
354
345
  className: 'text-sm',
355
346
  disabled: true
356
347
  },
357
348
  null
358
349
  ];
359
350
  if (multiple <= 1) {
360
- options.push({ name: 'Rename', icon: 'TextCursor',
361
- callback: that._renameItemPopover.bind(that, item) });
351
+ options.push({ name: 'Rename', icon: 'TextCursor', callback: that._renameItemPopover.bind(that, item) });
362
352
  }
363
353
  if (!isFolder) {
364
354
  options.push({ name: 'Clone', icon: 'Copy', callback: that._requestCloneItem.bind(that, item) });
365
355
  }
366
356
  options.push({ name: 'Move', icon: 'FolderInput', callback: () => that._moveItem(item) });
367
357
  if (type == 'Script' && LX.has('CodeEditor')) {
368
- options.push({ name: 'Open in Editor', icon: 'Code',
369
- callback: that._openScriptInEditor.bind(that, item) });
358
+ options.push({ name: 'Open in Editor', icon: 'Code', callback: that._openScriptInEditor.bind(that, item) });
370
359
  }
371
360
  if (that.itemContextMenuOptions) {
372
361
  options.push(null);
@@ -376,7 +365,7 @@ class AssetView {
376
365
  options.push({ name: o.name, icon: o.icon, callback: o.callback?.bind(that, item) });
377
366
  }
378
367
  }
379
- options.push(null, { name: 'Delete', icon: 'Trash2', className: 'fg-error',
368
+ options.push(null, { name: 'Delete', icon: 'Trash2', className: 'text-destructive',
380
369
  callback: that._requestDeleteItem.bind(that, item) });
381
370
  LX.addClass(that.contentPanel.root, 'pointer-events-none');
382
371
  LX.addDropdownMenu(e.target, options, { side: 'right', align: 'start', event: e, onBlur: () => {
@@ -530,20 +519,20 @@ class AssetView {
530
519
  return;
531
520
  this.nextData.push(this.currentFolder);
532
521
  this._enterFolder(this.prevData.pop(), false);
533
- }, { buttonClass: 'bg-none', title: 'Go Back', tooltip: true, icon: 'ArrowLeft' });
522
+ }, { buttonClass: 'ghost', title: 'Go Back', tooltip: true, icon: 'ArrowLeft' });
534
523
  panel.addButton(null, 'GoForwardButton', () => {
535
524
  if (!this.nextData.length || !this.currentFolder)
536
525
  return;
537
526
  this._enterFolder(this.nextData.pop());
538
- }, { buttonClass: 'bg-none', title: 'Go Forward', tooltip: true, icon: 'ArrowRight' });
527
+ }, { buttonClass: 'ghost', title: 'Go Forward', tooltip: true, icon: 'ArrowRight' });
539
528
  panel.addButton(null, 'GoUpButton', () => {
540
529
  const parentFolder = this.currentFolder?.parent;
541
530
  if (parentFolder)
542
531
  this._enterFolder(parentFolder);
543
- }, { buttonClass: 'bg-none', title: 'Go Upper Folder', tooltip: true, icon: 'ArrowUp' });
544
- panel.addButton(null, 'GoUpButton', () => {
545
- this._refreshContent();
546
- }, { buttonClass: 'bg-none', title: 'Refresh', tooltip: true, icon: 'Refresh' });
532
+ }, { buttonClass: 'ghost', title: 'Go Upper Folder', tooltip: true, icon: 'ArrowUp' });
533
+ panel.addButton(null, 'RefreshButton', () => {
534
+ this._refreshContent(undefined, undefined, true);
535
+ }, { buttonClass: 'ghost', title: 'Refresh', tooltip: true, icon: 'Refresh' });
547
536
  }
548
537
  _createTreePanel(area) {
549
538
  if (this.leftPanel) {
@@ -555,61 +544,90 @@ class AssetView {
555
544
  this._createNavigationBar(this.leftPanel);
556
545
  const treeData = { id: '/', children: this.data };
557
546
  const tree = this.leftPanel.addTree('Content Browser', treeData, {
558
- // icons: tree_icons,
559
547
  filter: false,
560
- onlyFolders: this.onlyFolders,
561
- onevent: (event) => {
562
- let node = event.node;
563
- let value = event.value;
564
- switch (event.type) {
565
- case LX.TreeEvent.NODE_SELECTED:
566
- {
567
- if (event.multiple) {
568
- return;
569
- }
570
- if (!node.parent) {
571
- if (this.currentFolder) {
572
- this.prevData.push(this.currentFolder);
573
- }
574
- this.currentFolder = undefined;
575
- this.currentData = this.data;
576
- this._refreshContent();
577
- this._updatePath();
578
- }
579
- else {
580
- this._enterFolder(node.type === 'folder' ? node : node.parent);
581
- this._previewAsset(node);
582
- if (node.type !== 'folder') {
583
- this.content.querySelectorAll('.lexassetitem').forEach((i) => i.classList.remove('selected'));
584
- const dom = node.domEl;
585
- dom?.classList.add('selected');
586
- }
587
- this.selectedItem = node;
588
- }
589
- break;
590
- }
591
- case LX.TreeEvent.NODE_DRAGGED:
592
- {
593
- if (node.parent) {
594
- const idx = node.parent.children.indexOf(node);
595
- node.parent.children.splice(idx, 1);
596
- }
597
- if (!value.children) {
598
- value.children = [];
599
- }
600
- value.children.push(node);
601
- node.parent = value;
602
- node.dir = value.children;
603
- if (this.onItemDragged) {
604
- this.onItemDragged(node, value);
605
- }
606
- this._refreshContent();
607
- break;
608
- }
548
+ onlyFolders: this.onlyFolders
549
+ });
550
+ this._subscribeTreeEvents(tree);
551
+ this.tree = tree.innerTree;
552
+ }
553
+ _subscribeTreeEvents(tree) {
554
+ // If some of these events we don't have to call "resolve" since the AV itself
555
+ // will update the data and refresh when necessary
556
+ tree.on('select', (event, resolve) => {
557
+ if (event.items.length > 1) { // Do nothing if multiple selection
558
+ return;
559
+ }
560
+ const node = event.items[0];
561
+ if (!node.parent) {
562
+ if (this.currentFolder) {
563
+ this.prevData.push(this.currentFolder);
564
+ }
565
+ this.currentFolder = undefined;
566
+ this.currentData = this.data;
567
+ this._refreshContent();
568
+ this._updatePath();
569
+ }
570
+ else {
571
+ this._enterFolder(node.type === 'folder' ? node : node.parent);
572
+ this._previewAsset(node);
573
+ if (node.type !== 'folder') {
574
+ this.content.querySelectorAll('.lexassetitem').forEach((i) => i.classList.remove('selected'));
575
+ const dom = node.domEl;
576
+ dom?.classList.add('selected');
609
577
  }
578
+ this.selectedItem = node;
610
579
  }
611
580
  });
612
- this.tree = tree.innerTree;
581
+ tree.on('beforeMove', (event, resolve) => {
582
+ const onBeforeNodeDragged = this._callbacks['beforeNodeDragged'];
583
+ const onNodeDragged = this._callbacks['nodeDragged'];
584
+ const node = event.items[0];
585
+ const value = event.to;
586
+ const av_resolve = (...args) => {
587
+ if (node.parent) {
588
+ const idx = node.parent.children.indexOf(node);
589
+ node.parent.children.splice(idx, 1);
590
+ }
591
+ if (!value.children) {
592
+ value.children = [];
593
+ }
594
+ value.children.push(node);
595
+ node.parent = value;
596
+ node.dir = value.children;
597
+ // Resolve Tree move event
598
+ resolve(...args);
599
+ // Fire AV drag event, and not catch the onMove Tree vent
600
+ const av_event = {
601
+ type: 'node-drag',
602
+ items: [node],
603
+ to: value,
604
+ userInitiated: true
605
+ };
606
+ if (onNodeDragged)
607
+ onNodeDragged(av_event, ...args);
608
+ this._refreshContent();
609
+ };
610
+ if (onBeforeNodeDragged) {
611
+ const av_event = {
612
+ type: 'node-drag',
613
+ items: [node],
614
+ to: value,
615
+ userInitiated: true
616
+ };
617
+ onBeforeNodeDragged(av_event, av_resolve);
618
+ }
619
+ else {
620
+ av_resolve();
621
+ }
622
+ });
623
+ tree.on('beforeDelete', (event, resolve) => {
624
+ const node = event.items[0];
625
+ this._requestDeleteItem(node);
626
+ });
627
+ tree.on('beforeRename', (event, resolve) => {
628
+ const node = event.items[0];
629
+ this._requestRenameItem(node, event.newName, true);
630
+ });
613
631
  }
614
632
  _setContentLayout(layoutMode) {
615
633
  this.layout = layoutMode;
@@ -647,17 +665,14 @@ class AssetView {
647
665
  { name: 'Name', icon: 'ALargeSmall', callback: () => this._sortData('id') },
648
666
  { name: 'Type', icon: 'Type', callback: () => this._sortData('type') },
649
667
  null,
650
- { name: 'Ascending', icon: 'SortAsc',
651
- callback: () => this._sortData(undefined, AssetView.CONTENT_SORT_ASC) },
652
- { name: 'Descending', icon: 'SortDesc',
653
- callback: () => this._sortData(undefined, AssetView.CONTENT_SORT_DESC) }
668
+ { name: 'Ascending', icon: 'SortAsc', callback: () => this._sortData(undefined, AssetView.CONTENT_SORT_ASC) },
669
+ { name: 'Descending', icon: 'SortDesc', callback: () => this._sortData(undefined, AssetView.CONTENT_SORT_DESC) }
654
670
  ], { side: 'bottom', align: 'start' });
655
671
  };
656
672
  const _onChangeView = (value, event) => {
657
673
  LX.addDropdownMenu(event.target, [
658
674
  { name: 'Grid', icon: 'LayoutGrid', callback: () => this._setContentLayout(AssetView.LAYOUT_GRID) },
659
- { name: 'Compact', icon: 'LayoutList',
660
- callback: () => this._setContentLayout(AssetView.LAYOUT_COMPACT) },
675
+ { name: 'Compact', icon: 'LayoutList', callback: () => this._setContentLayout(AssetView.LAYOUT_COMPACT) },
661
676
  { name: 'List', icon: 'List', callback: () => this._setContentLayout(AssetView.LAYOUT_LIST) }
662
677
  ], { side: 'bottom', align: 'start' });
663
678
  };
@@ -669,8 +684,8 @@ class AssetView {
669
684
  this._createNavigationBar(this.toolsPanel);
670
685
  }
671
686
  this.toolsPanel.sameLine();
672
- const sortButton = this.toolsPanel.addButton(null, '', _onSort.bind(this), { title: 'Sort',
673
- tooltip: true, icon: (this.sortMode === AssetView.CONTENT_SORT_ASC) ? 'SortAsc' : 'SortDesc' });
687
+ const sortButton = this.toolsPanel.addButton(null, '', _onSort.bind(this), { title: 'Sort', tooltip: true,
688
+ icon: (this.sortMode === AssetView.CONTENT_SORT_ASC) ? 'SortAsc' : 'SortDesc' });
674
689
  this.toolsPanel.addButton(null, '', _onChangeView.bind(this), { title: 'View', tooltip: true,
675
690
  icon: (this.layout === AssetView.LAYOUT_GRID) ? 'LayoutGrid' : 'LayoutList' });
676
691
  this.toolsPanel.addSelect(null, typeEntries, this.filter ?? typeEntries[0], (v) => {
@@ -692,7 +707,7 @@ class AssetView {
692
707
  this.contentPanel.attach(this.content);
693
708
  if (!this.skipBrowser) {
694
709
  this.contentPanel.addText(null, this.path.join('/'), null, {
695
- inputClass: 'bg-none fg-quinary text-end',
710
+ inputClass: 'bg-none text-muted-foreground text-sm text-end',
696
711
  disabled: true,
697
712
  signal: '@on_folder_change'
698
713
  });
@@ -741,48 +756,68 @@ class AssetView {
741
756
  // default case, only check include
742
757
  return (name) => name.toLowerCase().includes(q.toLowerCase());
743
758
  }
744
- _refreshContent(searchValue, filter) {
745
- const isCompactLayout = this.layout == AssetView.LAYOUT_COMPACT;
746
- const isListLayout = this.layout == AssetView.LAYOUT_LIST;
747
- this.filter = filter ?? (this.filter ?? 'None');
748
- this.searchValue = searchValue ?? (this.searchValue ?? '');
749
- this.content.innerHTML = '';
750
- this.content.className = `lexassetscontent${isCompactLayout ? ' compact' : (isListLayout ? ' list' : '')}`;
751
- if (!this.currentData.length) {
752
- return;
753
- }
754
- const fr = new FileReader();
755
- const nameFilterFn = this._makeNameFilterFn(this.searchValue);
756
- const filteredData = this.currentData.filter((_i) => {
757
- const typeMatch = this.filter !== 'None' ? _i.type.toLowerCase() === this.filter.toLowerCase() : true;
758
- const nameMatch = nameFilterFn(_i.id);
759
- return typeMatch && nameMatch;
760
- });
761
- this._paginator?.setPages(Math.max(Math.ceil(filteredData.length / this.assetsPerPage), 1));
762
- // Show all data if using filters
763
- const start = this._paginator ? (this._paginator.page - 1) * this.assetsPerPage : 0;
764
- const end = this._paginator ? Math.min(start + this.assetsPerPage, filteredData.length) : filteredData.length;
765
- for (let i = start; i < end; ++i) {
766
- let item = filteredData[i];
767
- if (item.path) {
768
- LX.request({ url: item.path, dataType: 'blob', success: (f) => {
769
- item.metadata.bytesize = f.size;
770
- fr.readAsDataURL(f);
771
- fr.onload = (e) => {
772
- const target = e.currentTarget;
773
- item.src = target.result; // This is a base64 string...
774
- item.metadata.path = item.path;
775
- delete item.path;
776
- this._refreshContent(searchValue, filter);
777
- };
778
- } });
759
+ _refreshContent(searchValue, filter, userInitiated = false) {
760
+ const onBeforeRefreshContent = this._callbacks['beforeRefreshContent'];
761
+ const onRefreshContent = this._callbacks['refreshContent'];
762
+ const resolve = (...args) => {
763
+ const isCompactLayout = this.layout == AssetView.LAYOUT_COMPACT;
764
+ const isListLayout = this.layout == AssetView.LAYOUT_LIST;
765
+ this.filter = filter ?? (this.filter ?? 'None');
766
+ this.searchValue = searchValue ?? (this.searchValue ?? '');
767
+ this.content.innerHTML = '';
768
+ this.content.className = `lexassetscontent${isCompactLayout ? ' compact' : (isListLayout ? ' list' : '')}`;
769
+ if (!this.currentData.length) {
770
+ return;
779
771
  }
780
- else {
781
- item.domEl = this.addItem(item, undefined, false);
772
+ const fr = new FileReader();
773
+ const nameFilterFn = this._makeNameFilterFn(this.searchValue);
774
+ const filteredData = this.currentData.filter((_i) => {
775
+ const typeMatch = this.filter !== 'None' ? _i.type.toLowerCase() === this.filter.toLowerCase() : true;
776
+ const nameMatch = nameFilterFn(_i.id);
777
+ return typeMatch && nameMatch;
778
+ });
779
+ this._paginator?.setPages(Math.max(Math.ceil(filteredData.length / this.assetsPerPage), 1));
780
+ // Show all data if using filters
781
+ const start = this._paginator ? (this._paginator.page - 1) * this.assetsPerPage : 0;
782
+ const end = this._paginator ? Math.min(start + this.assetsPerPage, filteredData.length) : filteredData.length;
783
+ for (let i = start; i < end; ++i) {
784
+ let item = filteredData[i];
785
+ if (item.path) {
786
+ LX.request({ url: item.path, dataType: 'blob', success: (f) => {
787
+ item.metadata.bytesize = f.size;
788
+ fr.readAsDataURL(f);
789
+ fr.onload = (e) => {
790
+ const target = e.currentTarget;
791
+ item.src = target.result; // This is a base64 string...
792
+ item.metadata.path = item.path;
793
+ delete item.path;
794
+ this._refreshContent(searchValue, filter);
795
+ };
796
+ } });
797
+ }
798
+ else {
799
+ item.domEl = this.addItem(item, undefined, false);
800
+ }
782
801
  }
802
+ const event = {
803
+ type: 'refresh-content',
804
+ search: [this.searchValue, this.filter],
805
+ items: filteredData.slice(start, end),
806
+ userInitiated
807
+ };
808
+ if (onRefreshContent)
809
+ onRefreshContent(event, ...args);
810
+ };
811
+ if (onBeforeRefreshContent) {
812
+ const event = {
813
+ type: 'refresh-content',
814
+ search: [this.searchValue, this.filter],
815
+ userInitiated
816
+ };
817
+ onBeforeRefreshContent(event, resolve);
783
818
  }
784
- if (this.onRefreshContent) {
785
- this.onRefreshContent(searchValue, filter);
819
+ else {
820
+ resolve();
786
821
  }
787
822
  }
788
823
  _previewAsset(file) {
@@ -935,6 +970,7 @@ class AssetView {
935
970
  if (mustRefresh) {
936
971
  this._processData(this.data);
937
972
  this._refreshContent();
973
+ this.tree?.select(this.currentFolder.id);
938
974
  }
939
975
  this._updatePath();
940
976
  }
@@ -1037,6 +1073,7 @@ class AssetView {
1037
1073
  this.tree?.refresh();
1038
1074
  this._moveItemDialog?.destroy();
1039
1075
  this._movingItem = undefined;
1076
+ this.previewPanel?.clear();
1040
1077
  }
1041
1078
  _moveItem(item, defaultFolder) {
1042
1079
  if (this._moveItemDialog) {
@@ -1051,16 +1088,16 @@ class AssetView {
1051
1088
  for (let pi of (targetFolder.children ?? targetFolder)) {
1052
1089
  const row = LX.makeContainer(['100%', 'auto'], 'flex flex-row px-1 items-center', '', container);
1053
1090
  const isFolder = pi.type === 'folder';
1054
- const rowItem = LX.makeContainer(['100%', 'auto'], `move-item flex flex-row gap-1 py-1 px-3 cursor-pointer ${isFolder ? 'fg-primary font-medium' : 'fg-quinary'} rounded-xxl ${isFolder ? 'hover:bg-secondary' : 'hover:bg-primary'}`, `${isFolder ? LX.makeIcon('FolderOpen', { svgClass: '' }).innerHTML : ''}${pi.id}`, row);
1091
+ const rowItem = LX.makeContainer(['100%', 'auto'], `move-item flex flex-row gap-1 py-1 px-3 cursor-pointer items-center ${isFolder ? 'text-foreground font-medium' : 'text-muted-foreground'} rounded-2xl ${isFolder ? 'hover:bg-accent' : 'hover:bg-muted'}`, `${isFolder ? LX.makeIcon('FolderOpen', { svgClass: '' }).innerHTML : ''}${pi.id}`, row);
1055
1092
  if (isFolder) {
1056
1093
  rowItem.addEventListener('click', () => {
1057
- container.querySelectorAll('.move-item').forEach((el) => LX.removeClass(el, 'bg-quinary'));
1058
- LX.addClass(rowItem, 'bg-quinary');
1094
+ container.querySelectorAll('.move-item').forEach((el) => LX.removeClass(el, 'bg-primary text-primary-foreground'));
1095
+ LX.addClass(rowItem, 'bg-primary text-primary-foreground');
1059
1096
  targetFolder = pi;
1060
1097
  });
1061
1098
  const fPathButton = new LX.Button(null, 'FPathButton', () => {
1062
1099
  _openFolder(pi, container);
1063
- }, { icon: 'ChevronRight', className: 'ml-auto h-8', buttonClass: 'bg-none hover:bg-secondary' });
1100
+ }, { icon: 'ChevronRight', className: 'ml-auto h-8', buttonClass: 'ghost' });
1064
1101
  row.appendChild(fPathButton.root);
1065
1102
  }
1066
1103
  }
@@ -1094,33 +1131,29 @@ class AssetView {
1094
1131
  p.attach(area);
1095
1132
  const content = LX.makeContainer(['auto', '100%'], 'flex flex-auto-fill flex-col overflow-scroll py-2 gap-1', ``);
1096
1133
  {
1097
- const headerPanel = area.addPanel({ className: 'p-2 border-bottom flex flex-auto', height: 'auto' });
1134
+ const headerPanel = area.addPanel({ className: 'p-2 border-b-color flex flex-auto-keep', height: 'auto' });
1098
1135
  headerPanel.sameLine(2, 'w-full');
1099
1136
  headerPanel.addButton(null, 'BackButton', () => {
1100
1137
  if (targetFolder && targetFolder.parent)
1101
1138
  _openFolder(targetFolder.parent, content);
1102
- }, { icon: 'ArrowLeft', title: 'Back', tooltip: true, className: 'flex-auto',
1103
- buttonClass: 'bg-none hover:bg-secondary' });
1139
+ }, { icon: 'ArrowLeft', title: 'Back', tooltip: true, className: 'flex-auto-keep', buttonClass: 'ghost' });
1104
1140
  bcContainer = LX.makeElement('div');
1105
- headerPanel.addContent('ITEM_MOVE_PATH', bcContainer, { signal: '@item_move_path',
1106
- className: 'flex-auto-fill' });
1141
+ headerPanel.addContent('ITEM_MOVE_PATH', bcContainer, { signal: '@item_move_path', className: 'flex-auto-fill' });
1107
1142
  }
1108
1143
  area.attach(content);
1109
1144
  _openFolder(defaultFolder ?? this.data, content);
1110
1145
  {
1111
- const footerPanel = area.addPanel({ className: 'p-2 border-top flex flex-auto justify-between',
1112
- height: 'auto' });
1146
+ const footerPanel = area.addPanel({ className: 'p-2 border-t-color flex flex-auto-keep justify-between', height: 'auto' });
1113
1147
  footerPanel.addButton(null, 'NewFolderButton', () => {
1114
1148
  this._requestCreateFolder(targetFolder);
1115
- }, { width: 'auto', icon: 'FolderPlus', title: 'Create Folder', tooltip: true, className: 'ml-2',
1116
- buttonClass: 'bg-none hover:bg-secondary' });
1149
+ }, { width: 'auto', icon: 'FolderPlus', title: 'Create Folder', tooltip: true, className: 'ml-2', buttonClass: 'ghost' });
1117
1150
  footerPanel.sameLine(2, 'mr-2');
1118
1151
  footerPanel.addButton(null, 'Cancel', () => {
1119
1152
  this._moveItemDialog.close();
1120
- }, { buttonClass: 'bg-none fg-error' });
1153
+ }, { buttonClass: 'ghost text-destructive' });
1121
1154
  footerPanel.addButton(null, 'Move', () => {
1122
1155
  this._requestMoveItemToFolder(item, targetFolder);
1123
- }, { className: '', buttonClass: 'contrast' });
1156
+ }, { className: '', buttonClass: 'primary' });
1124
1157
  }
1125
1158
  }, { modal: true, size: ['616px', '500px'], closable: true, onBeforeClose: () => {
1126
1159
  delete this._moveItemDialog;
@@ -1218,12 +1251,12 @@ class AssetView {
1218
1251
  }
1219
1252
  return maxN === -1 ? originalName : `${base} (${maxN + 1})${ext}`;
1220
1253
  }
1221
- _requestRenameItem(item, newName) {
1254
+ _requestRenameItem(item, newName, treeEvent = false) {
1222
1255
  const onBeforeRename = this._callbacks['beforeRename'];
1223
1256
  const onRename = this._callbacks['rename'];
1224
1257
  const oldName = item.id;
1225
1258
  const resolve = (...args) => {
1226
- this._renameItem(item, newName);
1259
+ this._renameItem(item, newName, treeEvent ? item.dir : this.currentData);
1227
1260
  const event = {
1228
1261
  type: 'rename',
1229
1262
  items: [item],
@@ -1248,21 +1281,25 @@ class AssetView {
1248
1281
  resolve();
1249
1282
  }
1250
1283
  }
1251
- _renameItem(item, newName) {
1252
- const idx = this.currentData.indexOf(item);
1284
+ _renameItem(item, newName, data) {
1285
+ data = data ?? this.currentData;
1286
+ const idx = data.indexOf(item);
1253
1287
  if (idx < 0) {
1254
1288
  return;
1255
1289
  }
1256
- const wasSelected = LX.hasClass(item.domEl, 'selected');
1257
- const hoverTitle = this.content.querySelector(`#floatingTitle_${item.id.replace(/\s/g, '_').replaceAll('.', '_')}`);
1258
- if (hoverTitle)
1259
- hoverTitle.remove();
1260
- item.domEl?.remove();
1261
- item.id = newName;
1262
- item.domEl = this.addItem(item, idx * 2);
1263
- if (wasSelected) {
1264
- this._previewAsset(item);
1290
+ // It could be a Tree event, so maybe the elements is not created yet
1291
+ if (item.domEl) {
1292
+ const wasSelected = LX.hasClass(item.domEl, 'selected');
1293
+ const hoverTitle = this.content.querySelector(`#floatingTitle_${item.id.replace(/\s/g, '_').replaceAll('.', '_')}`);
1294
+ if (hoverTitle)
1295
+ hoverTitle.remove();
1296
+ item.domEl?.remove();
1297
+ item.domEl = this.addItem(item, idx * 2);
1298
+ if (wasSelected) {
1299
+ this._previewAsset(item);
1300
+ }
1265
1301
  }
1302
+ item.id = newName;
1266
1303
  this.tree?.refresh();
1267
1304
  this._processData(this.data);
1268
1305
  }
@@ -1284,7 +1321,7 @@ class AssetView {
1284
1321
  });
1285
1322
  panel.addButton(null, 'Save', () => {
1286
1323
  onRename(newName);
1287
- }, { buttonClass: 'contrast' });
1324
+ }, { buttonClass: 'primary' });
1288
1325
  const p = new LX.Popover(item.domEl, [panel], { align: 'center', side: 'bottom', sideOffset: -128 });
1289
1326
  }
1290
1327
  _requestCreateFolder(folder) {
@@ -1322,14 +1359,15 @@ class AssetView {
1322
1359
  if (!folder) {
1323
1360
  throw ('_createFolder: Something went wrong!');
1324
1361
  }
1362
+ const dir = folder.children ?? folder;
1325
1363
  const newFolder = {
1326
- id: this._getClonedName('New Folder', folder.children),
1364
+ id: this._getClonedName('New Folder', dir),
1327
1365
  type: 'folder',
1328
1366
  children: [],
1329
1367
  parent: this.currentFolder,
1330
1368
  metadata: {}
1331
1369
  };
1332
- folder.children.push(newFolder);
1370
+ dir.push(newFolder);
1333
1371
  this._refreshContent();
1334
1372
  this.tree?.refresh();
1335
1373
  if (this._moveItemDialog && this._movingItem) {