@design.estate/dees-wcctools 3.7.0 → 3.8.0

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.
@@ -42002,9 +42002,9 @@ __runInitializers(_init2, 1, _WccContextmenu);
42002
42002
  var WccContextmenu = _WccContextmenu;
42003
42003
 
42004
42004
  // ts_web/elements/wcc-sidebar.ts
42005
- var _isHidden_dec, _isResizing_dec2, _sidebarWidth_dec2, _pinnedItems_dec, _searchQuery_dec, _collapsedSections_dec, _expandedElements_dec, _isNative_dec2, _dashboardRef_dec, _selectedType_dec, _selectedItem_dec, _a3, _WccSidebar_decorators, _init3, _selectedItem, _selectedType, _dashboardRef, _isNative2, _expandedElements, _collapsedSections, _searchQuery, _pinnedItems, _sidebarWidth2, _isResizing2, _isHidden;
42005
+ var _isMenuScrolled_dec, _isHidden_dec, _isResizing_dec2, _sidebarWidth_dec2, _pinnedItems_dec, _searchQuery_dec, _collapsedSections_dec, _expandedElements_dec, _isNative_dec2, _dashboardRef_dec, _selectedType_dec, _selectedItem_dec, _a3, _WccSidebar_decorators, _init3, _selectedItem, _selectedType, _dashboardRef, _isNative2, _expandedElements, _collapsedSections, _searchQuery, _pinnedItems, _sidebarWidth2, _isResizing2, _isHidden, _isMenuScrolled;
42006
42006
  _WccSidebar_decorators = [t4("wcc-sidebar")];
42007
- var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ attribute: false })], _selectedType_dec = [n5({ attribute: false })], _dashboardRef_dec = [n5()], _isNative_dec2 = [n5()], _expandedElements_dec = [r5()], _collapsedSections_dec = [r5()], _searchQuery_dec = [n5()], _pinnedItems_dec = [n5({ attribute: false })], _sidebarWidth_dec2 = [n5({ type: Number })], _isResizing_dec2 = [r5()], _isHidden_dec = [r5()], _a3) {
42007
+ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ attribute: false })], _selectedType_dec = [n5({ attribute: false })], _dashboardRef_dec = [n5()], _isNative_dec2 = [n5()], _expandedElements_dec = [r5()], _collapsedSections_dec = [r5()], _searchQuery_dec = [n5()], _pinnedItems_dec = [n5({ attribute: false })], _sidebarWidth_dec2 = [n5({ type: Number })], _isResizing_dec2 = [r5()], _isHidden_dec = [r5()], _isMenuScrolled_dec = [r5()], _a3) {
42008
42008
  constructor() {
42009
42009
  super(...arguments);
42010
42010
  __privateAdd(this, _selectedItem, __runInitializers(_init3, 8, this)), __runInitializers(_init3, 11, this);
@@ -42018,6 +42018,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42018
42018
  __privateAdd(this, _sidebarWidth2, __runInitializers(_init3, 40, this, 200)), __runInitializers(_init3, 43, this);
42019
42019
  __privateAdd(this, _isResizing2, __runInitializers(_init3, 44, this, false)), __runInitializers(_init3, 47, this);
42020
42020
  __privateAdd(this, _isHidden, __runInitializers(_init3, 48, this, false)), __runInitializers(_init3, 51, this);
42021
+ __privateAdd(this, _isMenuScrolled, __runInitializers(_init3, 52, this, false)), __runInitializers(_init3, 55, this);
42021
42022
  __publicField(this, "sectionsInitialized", false);
42022
42023
  // ============ Resize functionality ============
42023
42024
  __publicField(this, "startResize", (e10) => {
@@ -42053,6 +42054,12 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42053
42054
  document.addEventListener("mouseup", onMouseUp);
42054
42055
  });
42055
42056
  }
42057
+ /**
42058
+ * Returns the scrollable container element (.menu) for external scroll management
42059
+ */
42060
+ get scrollableContainer() {
42061
+ return this.shadowRoot?.querySelector(".menu");
42062
+ }
42056
42063
  render() {
42057
42064
  return b2`
42058
42065
  <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" rel="stylesheet" />
@@ -42092,6 +42099,15 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42092
42099
 
42093
42100
  .sidebar-header {
42094
42101
  flex-shrink: 0;
42102
+ transition: box-shadow 0.2s ease, border-color 0.2s ease;
42103
+ border-bottom: 1px solid transparent;
42104
+ position: relative;
42105
+ z-index: 1;
42106
+ }
42107
+
42108
+ .sidebar-header.scrolled {
42109
+ box-shadow: 0 8px 24px -2px rgba(0, 0, 0, 1);
42110
+ border-bottom-color: var(--border);
42095
42111
  }
42096
42112
 
42097
42113
  .menu {
@@ -42405,6 +42421,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42405
42421
  color: #555;
42406
42422
  padding: 0.125rem 0.625rem 0.25rem;
42407
42423
  display: block;
42424
+ cursor: context-menu;
42408
42425
  }
42409
42426
 
42410
42427
  .item-group .selectOption {
@@ -42412,6 +42429,15 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42412
42429
  margin-right: 0.25rem;
42413
42430
  }
42414
42431
 
42432
+ .item-group.group-highlight {
42433
+ background: rgba(59, 130, 246, 0.15);
42434
+ transition: background 0.3s ease;
42435
+ }
42436
+
42437
+ .item-group.group-filter-match {
42438
+ border-color: rgba(245, 158, 11, 0.5);
42439
+ }
42440
+
42415
42441
  /* Resize handle */
42416
42442
  .resize-handle {
42417
42443
  position: absolute;
@@ -42433,7 +42459,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42433
42459
  background: var(--primary);
42434
42460
  }
42435
42461
  </style>
42436
- <div class="sidebar-header">
42462
+ <div class="sidebar-header ${this.isMenuScrolled ? "scrolled" : ""}">
42437
42463
  <div class="search-container">
42438
42464
  <input
42439
42465
  type="text"
@@ -42450,7 +42476,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42450
42476
  </div>
42451
42477
  ${this.renderPinnedSection()}
42452
42478
  </div>
42453
- <div class="menu">
42479
+ <div class="menu" @scroll=${this.handleMenuScroll}>
42454
42480
  ${this.renderSections()}
42455
42481
  </div>
42456
42482
  <div
@@ -42493,12 +42519,46 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42493
42519
  }
42494
42520
  showContextMenu(e10, sectionName, itemName) {
42495
42521
  const isPinned = this.isPinned(sectionName, itemName);
42496
- WccContextmenu.show(e10, [
42522
+ const section = this.dashboardRef?.sections?.find((s8) => s8.name === sectionName);
42523
+ const sectionEntries = section ? getSectionItems(section) : [];
42524
+ const foundEntry = sectionEntries.find(([name]) => name === itemName);
42525
+ const item = foundEntry?.[1];
42526
+ const groups = item ? this.getElementGroups(item) : [];
42527
+ const menuItems = [
42497
42528
  {
42498
42529
  name: isPinned ? "Unpin" : "Pin",
42499
42530
  iconName: isPinned ? "push_pin" : "push_pin",
42500
42531
  action: () => this.togglePin(sectionName, itemName)
42501
42532
  }
42533
+ ];
42534
+ if (groups.length > 0) {
42535
+ menuItems.push({
42536
+ name: "Show in Group:",
42537
+ iconName: "folder",
42538
+ action: () => {
42539
+ },
42540
+ disabled: true
42541
+ });
42542
+ for (const groupName of groups) {
42543
+ menuItems.push({
42544
+ name: groupName,
42545
+ iconName: "label",
42546
+ action: () => this.scrollToGroup(sectionName, groupName)
42547
+ });
42548
+ }
42549
+ }
42550
+ WccContextmenu.show(e10, menuItems);
42551
+ }
42552
+ showGroupContextMenu(e10, groupName) {
42553
+ WccContextmenu.show(e10, [
42554
+ {
42555
+ name: `Show "${groupName}"`,
42556
+ iconName: "filter_alt",
42557
+ action: () => {
42558
+ this.searchQuery = groupName;
42559
+ this.dispatchEvent(new CustomEvent("searchChanged", { detail: this.searchQuery }));
42560
+ }
42561
+ }
42502
42562
  ]);
42503
42563
  }
42504
42564
  /**
@@ -42537,7 +42597,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42537
42597
  ${pinnedEntries.map(({ sectionName, itemName, item, section }) => {
42538
42598
  const isSelected = this.selectedItem === item;
42539
42599
  const type5 = section.type === "elements" ? "element" : "page";
42540
- const icon = section.type === "elements" ? "featured_video" : "insert_drive_file";
42600
+ const icon = section.type === "elements" ? this.getElementGroups(item).length > 1 ? "library_books" : "featured_video" : "insert_drive_file";
42541
42601
  return b2`
42542
42602
  <div
42543
42603
  class="selectOption ${isSelected ? "selected" : ""}"
@@ -42566,7 +42626,13 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42566
42626
  this.initCollapsedSections();
42567
42627
  return this.dashboardRef.sections.map((section) => {
42568
42628
  const entries = getSectionItems(section);
42569
- const filteredEntries = entries.filter(([name]) => this.matchesSearch(name));
42629
+ const filteredEntries = entries.filter(([name, item]) => {
42630
+ if (this.matchesSearch(name)) return true;
42631
+ const rawGroups = item.demoGroups;
42632
+ if (!rawGroups) return false;
42633
+ const groups = Array.isArray(rawGroups) ? rawGroups : [rawGroups];
42634
+ return groups.some((g3) => this.matchesSearch(g3));
42635
+ });
42570
42636
  if (filteredEntries.length === 0 && this.searchQuery) {
42571
42637
  return null;
42572
42638
  }
@@ -42592,7 +42658,13 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42592
42658
  */
42593
42659
  renderSectionItems(section) {
42594
42660
  const entries = getSectionItems(section);
42595
- const filteredEntries = entries.filter(([name]) => this.matchesSearch(name));
42661
+ const filteredEntries = entries.filter(([name, item]) => {
42662
+ if (this.matchesSearch(name)) return true;
42663
+ const rawGroups = item.demoGroups;
42664
+ if (!rawGroups) return false;
42665
+ const groups = Array.isArray(rawGroups) ? rawGroups : [rawGroups];
42666
+ return groups.some((g3) => this.matchesSearch(g3));
42667
+ });
42596
42668
  if (section.type === "pages") {
42597
42669
  return filteredEntries.map(([pageName, item]) => {
42598
42670
  const isPinned = this.isPinned(section.name, pageName);
@@ -42614,11 +42686,14 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42614
42686
  const groupedItems = /* @__PURE__ */ new Map();
42615
42687
  for (const entry of filteredEntries) {
42616
42688
  const [, item] = entry;
42617
- const group = item.demoGroup || null;
42618
- if (!groupedItems.has(group)) {
42619
- groupedItems.set(group, []);
42689
+ const rawGroups = item.demoGroups;
42690
+ const groups = rawGroups ? Array.isArray(rawGroups) ? rawGroups : [rawGroups] : [null];
42691
+ for (const group of groups) {
42692
+ if (!groupedItems.has(group)) {
42693
+ groupedItems.set(group, []);
42694
+ }
42695
+ groupedItems.get(group).push(entry);
42620
42696
  }
42621
- groupedItems.get(group).push(entry);
42622
42697
  }
42623
42698
  const renderItems = [];
42624
42699
  const ungrouped = groupedItems.get(null) || [];
@@ -42627,8 +42702,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42627
42702
  }
42628
42703
  for (const [groupName, items] of groupedItems) {
42629
42704
  if (groupName === null) continue;
42630
- const firstElementName = items[0]?.[0] || "";
42631
- renderItems.push({ type: "group", groupName, items, sortKey: firstElementName.toLowerCase() });
42705
+ renderItems.push({ type: "group", groupName, items, sortKey: groupName.toLowerCase() });
42632
42706
  }
42633
42707
  renderItems.sort((a4, b4) => a4.sortKey.localeCompare(b4.sortKey));
42634
42708
  return renderItems.map((item) => {
@@ -42636,8 +42710,11 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42636
42710
  return this.renderElementItem(item.entry, section);
42637
42711
  } else {
42638
42712
  return b2`
42639
- <div class="item-group">
42640
- <span class="item-group-legend">${item.groupName}</span>
42713
+ <div class="item-group ${this.isGroupFilterMatch(item.groupName) ? "group-filter-match" : ""}" data-group="${item.groupName}">
42714
+ <span
42715
+ class="item-group-legend"
42716
+ @contextmenu=${(e10) => this.showGroupContextMenu(e10, item.groupName)}
42717
+ >${item.groupName}</span>
42641
42718
  ${item.items.map((entry) => this.renderElementItem(entry, section))}
42642
42719
  </div>
42643
42720
  `;
@@ -42688,6 +42765,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42688
42765
  ` : null}
42689
42766
  `;
42690
42767
  } else {
42768
+ const icon = this.getElementGroups(item).length > 1 ? "library_books" : "featured_video";
42691
42769
  return b2`
42692
42770
  <div
42693
42771
  class="selectOption ${isSelected ? "selected" : ""} ${isPinned ? "pinned" : ""}"
@@ -42697,7 +42775,7 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42697
42775
  }}
42698
42776
  @contextmenu=${(e10) => this.showContextMenu(e10, section.name, elementName)}
42699
42777
  >
42700
- <i class="material-symbols-outlined">featured_video</i>
42778
+ <i class="material-symbols-outlined">${icon}</i>
42701
42779
  <div class="text">${this.highlightMatch(elementName)}</div>
42702
42780
  </div>
42703
42781
  `;
@@ -42730,10 +42808,37 @@ var WccSidebar = class extends (_a3 = DeesElement, _selectedItem_dec = [n5({ att
42730
42808
  this.searchQuery = "";
42731
42809
  this.dispatchEvent(new CustomEvent("searchChanged", { detail: this.searchQuery }));
42732
42810
  }
42811
+ handleMenuScroll(e10) {
42812
+ const target = e10.target;
42813
+ this.isMenuScrolled = target.scrollTop > 0;
42814
+ }
42733
42815
  matchesSearch(name) {
42734
42816
  if (!this.searchQuery) return true;
42735
42817
  return name.toLowerCase().includes(this.searchQuery.toLowerCase());
42736
42818
  }
42819
+ isGroupFilterMatch(groupName) {
42820
+ return !!this.searchQuery && groupName.toLowerCase() === this.searchQuery.toLowerCase();
42821
+ }
42822
+ getElementGroups(item) {
42823
+ const raw2 = item?.demoGroups;
42824
+ if (!raw2) return [];
42825
+ return Array.isArray(raw2) ? raw2 : [raw2];
42826
+ }
42827
+ scrollToGroup(sectionName, groupName) {
42828
+ this.collapsedSections.delete(sectionName);
42829
+ this.searchQuery = "";
42830
+ this.requestUpdate();
42831
+ this.updateComplete.then(() => {
42832
+ const groupEl = this.shadowRoot?.querySelector(
42833
+ `.item-group[data-group="${groupName}"]`
42834
+ );
42835
+ if (groupEl) {
42836
+ groupEl.scrollIntoView({ behavior: "smooth", block: "center" });
42837
+ groupEl.classList.add("group-highlight");
42838
+ setTimeout(() => groupEl.classList.remove("group-highlight"), 1500);
42839
+ }
42840
+ });
42841
+ }
42737
42842
  highlightMatch(text8) {
42738
42843
  if (!this.searchQuery) return b2`${text8}`;
42739
42844
  const lowerText = text8.toLowerCase();
@@ -42819,6 +42924,7 @@ _pinnedItems = new WeakMap();
42819
42924
  _sidebarWidth2 = new WeakMap();
42820
42925
  _isResizing2 = new WeakMap();
42821
42926
  _isHidden = new WeakMap();
42927
+ _isMenuScrolled = new WeakMap();
42822
42928
  __decorateElement(_init3, 4, "selectedItem", _selectedItem_dec, WccSidebar, _selectedItem);
42823
42929
  __decorateElement(_init3, 4, "selectedType", _selectedType_dec, WccSidebar, _selectedType);
42824
42930
  __decorateElement(_init3, 4, "dashboardRef", _dashboardRef_dec, WccSidebar, _dashboardRef);
@@ -42830,6 +42936,7 @@ __decorateElement(_init3, 4, "pinnedItems", _pinnedItems_dec, WccSidebar, _pinne
42830
42936
  __decorateElement(_init3, 4, "sidebarWidth", _sidebarWidth_dec2, WccSidebar, _sidebarWidth2);
42831
42937
  __decorateElement(_init3, 4, "isResizing", _isResizing_dec2, WccSidebar, _isResizing2);
42832
42938
  __decorateElement(_init3, 4, "isHidden", _isHidden_dec, WccSidebar, _isHidden);
42939
+ __decorateElement(_init3, 4, "isMenuScrolled", _isMenuScrolled_dec, WccSidebar, _isMenuScrolled);
42833
42940
  WccSidebar = __decorateElement(_init3, 0, "WccSidebar", _WccSidebar_decorators, WccSidebar);
42834
42941
  __runInitializers(_init3, 1, WccSidebar);
42835
42942
 
@@ -45544,10 +45651,13 @@ var WccDashboard2 = class extends (_a7 = DeesElement, _sections_dec = [n5()], _s
45544
45651
  this.scrollListenersAttached = true;
45545
45652
  }
45546
45653
  if (wccSidebar) {
45547
- wccSidebar.addEventListener("scroll", () => {
45548
- this.sidebarScrollY = wccSidebar.scrollTop;
45549
- this.debouncedScrollUpdate();
45550
- });
45654
+ const scrollContainer = wccSidebar.scrollableContainer;
45655
+ if (scrollContainer) {
45656
+ scrollContainer.addEventListener("scroll", () => {
45657
+ this.sidebarScrollY = scrollContainer.scrollTop;
45658
+ this.debouncedScrollUpdate();
45659
+ });
45660
+ }
45551
45661
  }
45552
45662
  }
45553
45663
  debouncedScrollUpdate() {
@@ -45589,7 +45699,10 @@ var WccDashboard2 = class extends (_a7 = DeesElement, _sections_dec = [n5()], _s
45589
45699
  wccFrame.scrollTop = this.frameScrollY;
45590
45700
  }
45591
45701
  if (wccSidebar && this.sidebarScrollY > 0) {
45592
- wccSidebar.scrollTop = this.sidebarScrollY;
45702
+ const scrollContainer = wccSidebar.scrollableContainer;
45703
+ if (scrollContainer) {
45704
+ scrollContainer.scrollTop = this.sidebarScrollY;
45705
+ }
45593
45706
  }
45594
45707
  this.scrollPositionsApplied = true;
45595
45708
  }
@@ -46413,7 +46526,7 @@ _label = new WeakMap();
46413
46526
  __decorateElement(_init17, 4, "label", _label_dec, TestButtonPrimary, _label);
46414
46527
  TestButtonPrimary = __decorateElement(_init17, 0, "TestButtonPrimary", _TestButtonPrimary_decorators, TestButtonPrimary);
46415
46528
  // This groups the element with other "Buttons" in the sidebar
46416
- __publicField(TestButtonPrimary, "demoGroup", "Buttons");
46529
+ __publicField(TestButtonPrimary, "demoGroups", "Buttons");
46417
46530
  __publicField(TestButtonPrimary, "demo", () => b2`
46418
46531
  <test-button-primary>Click Me</test-button-primary>
46419
46532
  `);
@@ -46456,7 +46569,7 @@ _label2 = new WeakMap();
46456
46569
  __decorateElement(_init18, 4, "label", _label_dec2, TestButtonSecondary, _label2);
46457
46570
  TestButtonSecondary = __decorateElement(_init18, 0, "TestButtonSecondary", _TestButtonSecondary_decorators, TestButtonSecondary);
46458
46571
  // Same group as test-button-primary - they'll appear together
46459
- __publicField(TestButtonSecondary, "demoGroup", "Buttons");
46572
+ __publicField(TestButtonSecondary, "demoGroups", "Buttons");
46460
46573
  __publicField(TestButtonSecondary, "demo", () => b2`
46461
46574
  <test-button-secondary>Secondary Action</test-button-secondary>
46462
46575
  `);
@@ -46499,7 +46612,7 @@ _label3 = new WeakMap();
46499
46612
  __decorateElement(_init19, 4, "label", _label_dec3, TestButtonDanger, _label3);
46500
46613
  TestButtonDanger = __decorateElement(_init19, 0, "TestButtonDanger", _TestButtonDanger_decorators, TestButtonDanger);
46501
46614
  // Same group as other buttons
46502
- __publicField(TestButtonDanger, "demoGroup", "Buttons");
46615
+ __publicField(TestButtonDanger, "demoGroups", "Buttons");
46503
46616
  __publicField(TestButtonDanger, "demo", () => b2`
46504
46617
  <test-button-danger>Delete</test-button-danger>
46505
46618
  `);
@@ -46552,7 +46665,7 @@ __decorateElement(_init20, 4, "placeholder", _placeholder_dec, TestInputText, _p
46552
46665
  __decorateElement(_init20, 4, "value", _value_dec, TestInputText, _value);
46553
46666
  TestInputText = __decorateElement(_init20, 0, "TestInputText", _TestInputText_decorators, TestInputText);
46554
46667
  // Different group - "Inputs"
46555
- __publicField(TestInputText, "demoGroup", "Inputs");
46668
+ __publicField(TestInputText, "demoGroups", "Inputs");
46556
46669
  __publicField(TestInputText, "demo", () => b2`
46557
46670
  <test-input-text placeholder="Enter text..."></test-input-text>
46558
46671
  `);
@@ -46608,7 +46721,7 @@ __decorateElement(_init21, 4, "label", _label_dec4, TestInputCheckbox, _label4);
46608
46721
  __decorateElement(_init21, 4, "checked", _checked_dec, TestInputCheckbox, _checked);
46609
46722
  TestInputCheckbox = __decorateElement(_init21, 0, "TestInputCheckbox", _TestInputCheckbox_decorators, TestInputCheckbox);
46610
46723
  // Same group as test-input-text
46611
- __publicField(TestInputCheckbox, "demoGroup", "Inputs");
46724
+ __publicField(TestInputCheckbox, "demoGroups", ["Inputs", "A Second Group"]);
46612
46725
  __publicField(TestInputCheckbox, "demo", () => b2`
46613
46726
  <test-input-checkbox label="Accept terms and conditions"></test-input-checkbox>
46614
46727
  `);