@design.estate/dees-wcctools 3.2.0 → 3.4.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.
@@ -41663,9 +41663,9 @@ __publicField(WccFrame, "styles", [
41663
41663
  __runInitializers(_init, 1, WccFrame);
41664
41664
 
41665
41665
  // ts_web/elements/wcc-sidebar.ts
41666
- var _expandedElements_dec, _isNative_dec2, _dashboardRef_dec, _selectedType_dec, _selectedItem_dec, _a2, _WccSidebar_decorators, _init2, _selectedItem, _selectedType, _dashboardRef, _isNative2, _expandedElements;
41666
+ var _searchQuery_dec, _collapsedSections_dec, _expandedElements_dec, _isNative_dec2, _dashboardRef_dec, _selectedType_dec, _selectedItem_dec, _a2, _WccSidebar_decorators, _init2, _selectedItem, _selectedType, _dashboardRef, _isNative2, _expandedElements, _collapsedSections, _searchQuery;
41667
41667
  _WccSidebar_decorators = [t4("wcc-sidebar")];
41668
- var WccSidebar = class extends (_a2 = DeesElement, _selectedItem_dec = [n5({ attribute: false })], _selectedType_dec = [n5({ attribute: false })], _dashboardRef_dec = [n5()], _isNative_dec2 = [n5()], _expandedElements_dec = [r5()], _a2) {
41668
+ var WccSidebar = class extends (_a2 = 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()], _a2) {
41669
41669
  constructor() {
41670
41670
  super(...arguments);
41671
41671
  __privateAdd(this, _selectedItem, __runInitializers(_init2, 8, this)), __runInitializers(_init2, 11, this);
@@ -41673,6 +41673,9 @@ var WccSidebar = class extends (_a2 = DeesElement, _selectedItem_dec = [n5({ att
41673
41673
  __privateAdd(this, _dashboardRef, __runInitializers(_init2, 16, this)), __runInitializers(_init2, 19, this);
41674
41674
  __privateAdd(this, _isNative2, __runInitializers(_init2, 20, this, false)), __runInitializers(_init2, 23, this);
41675
41675
  __privateAdd(this, _expandedElements, __runInitializers(_init2, 24, this, /* @__PURE__ */ new Set())), __runInitializers(_init2, 27, this);
41676
+ __privateAdd(this, _collapsedSections, __runInitializers(_init2, 28, this, /* @__PURE__ */ new Set())), __runInitializers(_init2, 31, this);
41677
+ __privateAdd(this, _searchQuery, __runInitializers(_init2, 32, this, "")), __runInitializers(_init2, 35, this);
41678
+ __publicField(this, "sectionsInitialized", false);
41676
41679
  }
41677
41680
  render() {
41678
41681
  return x`
@@ -41715,7 +41718,7 @@ var WccSidebar = class extends (_a2 = DeesElement, _selectedItem_dec = [n5({ att
41715
41718
  padding: 0.5rem 0;
41716
41719
  }
41717
41720
 
41718
- h3 {
41721
+ .section-header {
41719
41722
  padding: 0.3rem 0.75rem;
41720
41723
  font-size: 0.65rem;
41721
41724
  font-weight: 500;
@@ -41727,12 +41730,45 @@ var WccSidebar = class extends (_a2 = DeesElement, _selectedItem_dec = [n5({ att
41727
41730
  background: rgba(59, 130, 246, 0.03);
41728
41731
  border-bottom: 1px solid var(--border);
41729
41732
  border-top: 1px solid var(--border);
41733
+ display: flex;
41734
+ align-items: center;
41735
+ gap: 0.5rem;
41736
+ cursor: pointer;
41737
+ user-select: none;
41738
+ transition: all 0.15s ease;
41730
41739
  }
41731
41740
 
41732
- h3:first-child {
41741
+ .section-header:first-child {
41733
41742
  margin-top: 0;
41734
41743
  }
41735
41744
 
41745
+ .section-header:hover {
41746
+ background: rgba(59, 130, 246, 0.08);
41747
+ }
41748
+
41749
+ .section-header .expand-icon {
41750
+ font-size: 14px;
41751
+ opacity: 0.5;
41752
+ transition: transform 0.2s ease;
41753
+ }
41754
+
41755
+ .section-header.collapsed .expand-icon {
41756
+ transform: rotate(-90deg);
41757
+ }
41758
+
41759
+ .section-header .section-icon {
41760
+ font-size: 14px;
41761
+ opacity: 0.6;
41762
+ }
41763
+
41764
+ .section-content {
41765
+ overflow: hidden;
41766
+ }
41767
+
41768
+ .section-content.collapsed {
41769
+ display: none;
41770
+ }
41771
+
41736
41772
  .material-symbols-outlined {
41737
41773
  font-family: 'Material Symbols Outlined';
41738
41774
  font-weight: normal;
@@ -41864,85 +41900,179 @@ var WccSidebar = class extends (_a2 = DeesElement, _selectedItem_dec = [n5({ att
41864
41900
  ::-webkit-scrollbar-thumb:hover {
41865
41901
  background: rgba(255, 255, 255, 0.2);
41866
41902
  }
41903
+
41904
+ .search-container {
41905
+ padding: 0.5rem;
41906
+ border-bottom: 1px solid var(--border);
41907
+ }
41908
+
41909
+ .search-input {
41910
+ width: 100%;
41911
+ box-sizing: border-box;
41912
+ background: var(--input);
41913
+ border: 1px solid var(--border);
41914
+ border-radius: var(--radius);
41915
+ padding: 0.5rem 0.75rem;
41916
+ color: var(--foreground);
41917
+ font-size: 0.75rem;
41918
+ font-family: inherit;
41919
+ outline: none;
41920
+ transition: border-color 0.15s ease;
41921
+ }
41922
+
41923
+ .search-input:focus {
41924
+ border-color: var(--primary);
41925
+ }
41926
+
41927
+ .search-input::placeholder {
41928
+ color: var(--muted-foreground);
41929
+ }
41930
+
41931
+ .highlight {
41932
+ background: rgba(59, 130, 246, 0.3);
41933
+ border-radius: 2px;
41934
+ }
41867
41935
  </style>
41936
+ <div class="search-container">
41937
+ <input
41938
+ type="text"
41939
+ class="search-input"
41940
+ placeholder="Search..."
41941
+ .value=${this.searchQuery}
41942
+ @input=${this.handleSearchInput}
41943
+ />
41944
+ </div>
41868
41945
  <div class="menu">
41869
- <h3>Pages</h3>
41870
- ${(() => {
41871
- const pages = Object.keys(this.dashboardRef.pages);
41872
- return pages.map((pageName) => {
41873
- const item = this.dashboardRef.pages[pageName];
41946
+ ${this.renderSections()}
41947
+ </div>
41948
+ `;
41949
+ }
41950
+ /**
41951
+ * Initialize collapsed sections from section config
41952
+ */
41953
+ initCollapsedSections() {
41954
+ if (this.sectionsInitialized) return;
41955
+ const collapsed = /* @__PURE__ */ new Set();
41956
+ for (const section of this.dashboardRef.sections) {
41957
+ if (section.collapsed) {
41958
+ collapsed.add(section.name);
41959
+ }
41960
+ }
41961
+ this.collapsedSections = collapsed;
41962
+ this.sectionsInitialized = true;
41963
+ }
41964
+ /**
41965
+ * Render all sections
41966
+ */
41967
+ renderSections() {
41968
+ this.initCollapsedSections();
41969
+ return this.dashboardRef.sections.map((section, index2) => {
41970
+ const entries = getSectionItems(section);
41971
+ const filteredEntries = entries.filter(([name]) => this.matchesSearch(name));
41972
+ if (filteredEntries.length === 0 && this.searchQuery) {
41973
+ return null;
41974
+ }
41975
+ const isCollapsed = this.collapsedSections.has(section.name);
41976
+ const sectionIcon = section.icon || (section.type === "pages" ? "insert_drive_file" : "widgets");
41977
+ return x`
41978
+ <div
41979
+ class="section-header ${isCollapsed ? "collapsed" : ""}"
41980
+ @click=${() => this.toggleSectionCollapsed(section.name)}
41981
+ >
41982
+ <i class="material-symbols-outlined expand-icon">expand_more</i>
41983
+ ${section.icon ? x`<i class="material-symbols-outlined section-icon">${section.icon}</i>` : null}
41984
+ <span>${section.name}</span>
41985
+ </div>
41986
+ <div class="section-content ${isCollapsed ? "collapsed" : ""}">
41987
+ ${this.renderSectionItems(section)}
41988
+ </div>
41989
+ `;
41990
+ });
41991
+ }
41992
+ /**
41993
+ * Render items for a section
41994
+ */
41995
+ renderSectionItems(section) {
41996
+ const entries = getSectionItems(section);
41997
+ const filteredEntries = entries.filter(([name]) => this.matchesSearch(name));
41998
+ if (section.type === "pages") {
41999
+ return filteredEntries.map(([pageName, item]) => {
41874
42000
  return x`
41875
- <div
41876
- class="selectOption ${this.selectedItem === item ? "selected" : null}"
41877
- @click=${async () => {
41878
- const domtools2 = await dist_ts_exports25.DomTools.setupDomTools();
41879
- this.selectItem("page", pageName, item, 0);
42001
+ <div
42002
+ class="selectOption ${this.selectedItem === item ? "selected" : ""}"
42003
+ @click=${async () => {
42004
+ await dist_ts_exports25.DomTools.setupDomTools();
42005
+ this.selectItem("page", pageName, item, 0, section);
41880
42006
  }}
41881
- >
41882
- <i class="material-symbols-outlined">insert_drive_file</i>
41883
- <div class="text">${pageName}</div>
41884
- </div>
41885
- `;
42007
+ >
42008
+ <i class="material-symbols-outlined">insert_drive_file</i>
42009
+ <div class="text">${this.highlightMatch(pageName)}</div>
42010
+ </div>
42011
+ `;
41886
42012
  });
41887
- })()}
41888
- <h3>Elements</h3>
41889
- ${(() => {
41890
- const elements = Object.keys(this.dashboardRef.elements);
41891
- return elements.map((elementName) => {
41892
- const item = this.dashboardRef.elements[elementName];
41893
- const demoCount = item.demo ? getDemoCount(item.demo) : 0;
41894
- const isMultiDemo = item.demo && hasMultipleDemos(item.demo);
42013
+ } else {
42014
+ return filteredEntries.map(([elementName, item]) => {
42015
+ const anonItem = item;
42016
+ const demoCount = anonItem.demo ? getDemoCount(anonItem.demo) : 0;
42017
+ const isMultiDemo = anonItem.demo && hasMultipleDemos(anonItem.demo);
41895
42018
  const isExpanded = this.expandedElements.has(elementName);
41896
42019
  const isSelected = this.selectedItem === item;
41897
42020
  if (isMultiDemo) {
41898
42021
  return x`
41899
- <div
41900
- class="selectOption folder ${isExpanded ? "expanded" : ""} ${isSelected ? "selected" : ""}"
41901
- @click=${() => this.toggleExpanded(elementName)}
41902
- >
41903
- <i class="material-symbols-outlined expand-icon">chevron_right</i>
41904
- <i class="material-symbols-outlined">folder</i>
41905
- <div class="text">${elementName}</div>
41906
- </div>
41907
- ${isExpanded ? x`
41908
- <div class="demo-children">
41909
- ${Array.from({ length: demoCount }, (_3, i9) => {
42022
+ <div
42023
+ class="selectOption folder ${isExpanded ? "expanded" : ""} ${isSelected ? "selected" : ""}"
42024
+ @click=${() => this.toggleExpanded(elementName)}
42025
+ >
42026
+ <i class="material-symbols-outlined expand-icon">chevron_right</i>
42027
+ <i class="material-symbols-outlined">folder</i>
42028
+ <div class="text">${this.highlightMatch(elementName)}</div>
42029
+ </div>
42030
+ ${isExpanded ? x`
42031
+ <div class="demo-children">
42032
+ ${Array.from({ length: demoCount }, (_3, i9) => {
41910
42033
  const demoIndex = i9;
41911
42034
  const isThisDemoSelected = isSelected && this.dashboardRef.selectedDemoIndex === demoIndex;
41912
42035
  return x`
41913
- <div
41914
- class="demo-child ${isThisDemoSelected ? "selected" : ""}"
41915
- @click=${async () => {
42036
+ <div
42037
+ class="demo-child ${isThisDemoSelected ? "selected" : ""}"
42038
+ @click=${async () => {
41916
42039
  await dist_ts_exports25.DomTools.setupDomTools();
41917
- this.selectItem("element", elementName, item, demoIndex);
42040
+ this.selectItem("element", elementName, item, demoIndex, section);
41918
42041
  }}
41919
- >
41920
- <i class="material-symbols-outlined">play_circle</i>
41921
- <div class="text">demo${demoIndex + 1}</div>
41922
- </div>
41923
- `;
42042
+ >
42043
+ <i class="material-symbols-outlined">play_circle</i>
42044
+ <div class="text">demo${demoIndex + 1}</div>
42045
+ </div>
42046
+ `;
41924
42047
  })}
41925
- </div>
41926
- ` : null}
41927
- `;
42048
+ </div>
42049
+ ` : null}
42050
+ `;
41928
42051
  } else {
41929
42052
  return x`
41930
- <div
41931
- class="selectOption ${isSelected ? "selected" : null}"
41932
- @click=${async () => {
42053
+ <div
42054
+ class="selectOption ${isSelected ? "selected" : ""}"
42055
+ @click=${async () => {
41933
42056
  await dist_ts_exports25.DomTools.setupDomTools();
41934
- this.selectItem("element", elementName, item, 0);
42057
+ this.selectItem("element", elementName, item, 0, section);
41935
42058
  }}
41936
- >
41937
- <i class="material-symbols-outlined">featured_video</i>
41938
- <div class="text">${elementName}</div>
41939
- </div>
41940
- `;
42059
+ >
42060
+ <i class="material-symbols-outlined">featured_video</i>
42061
+ <div class="text">${this.highlightMatch(elementName)}</div>
42062
+ </div>
42063
+ `;
41941
42064
  }
41942
42065
  });
41943
- })()}
41944
- </div>
41945
- `;
42066
+ }
42067
+ }
42068
+ toggleSectionCollapsed(sectionName) {
42069
+ const newSet = new Set(this.collapsedSections);
42070
+ if (newSet.has(sectionName)) {
42071
+ newSet.delete(sectionName);
42072
+ } else {
42073
+ newSet.add(sectionName);
42074
+ }
42075
+ this.collapsedSections = newSet;
41946
42076
  }
41947
42077
  toggleExpanded(elementName) {
41948
42078
  const newSet = new Set(this.expandedElements);
@@ -41953,32 +42083,60 @@ var WccSidebar = class extends (_a2 = DeesElement, _selectedItem_dec = [n5({ att
41953
42083
  }
41954
42084
  this.expandedElements = newSet;
41955
42085
  }
42086
+ handleSearchInput(e10) {
42087
+ const input = e10.target;
42088
+ this.searchQuery = input.value;
42089
+ this.dispatchEvent(new CustomEvent("searchChanged", { detail: this.searchQuery }));
42090
+ }
42091
+ matchesSearch(name) {
42092
+ if (!this.searchQuery) return true;
42093
+ return name.toLowerCase().includes(this.searchQuery.toLowerCase());
42094
+ }
42095
+ highlightMatch(text8) {
42096
+ if (!this.searchQuery) return x`${text8}`;
42097
+ const lowerText = text8.toLowerCase();
42098
+ const lowerQuery = this.searchQuery.toLowerCase();
42099
+ const index2 = lowerText.indexOf(lowerQuery);
42100
+ if (index2 === -1) return x`${text8}`;
42101
+ const before = text8.slice(0, index2);
42102
+ const match2 = text8.slice(index2, index2 + this.searchQuery.length);
42103
+ const after = text8.slice(index2 + this.searchQuery.length);
42104
+ return x`${before}<span class="highlight">${match2}</span>${after}`;
42105
+ }
41956
42106
  updated(changedProperties) {
41957
42107
  super.updated(changedProperties);
41958
42108
  if (changedProperties.has("selectedItem") && this.selectedItem) {
41959
- const elementName = Object.keys(this.dashboardRef.elements).find(
41960
- (name) => this.dashboardRef.elements[name] === this.selectedItem
41961
- );
41962
- if (elementName) {
41963
- const item = this.dashboardRef.elements[elementName];
41964
- if (item.demo && hasMultipleDemos(item.demo)) {
41965
- if (!this.expandedElements.has(elementName)) {
41966
- const newSet = new Set(this.expandedElements);
41967
- newSet.add(elementName);
41968
- this.expandedElements = newSet;
42109
+ for (const section of this.dashboardRef.sections) {
42110
+ if (section.type !== "elements") continue;
42111
+ const entries = getSectionItems(section);
42112
+ const found = entries.find(([_3, item]) => item === this.selectedItem);
42113
+ if (found) {
42114
+ const [elementName, item] = found;
42115
+ const anonItem = item;
42116
+ if (anonItem.demo && hasMultipleDemos(anonItem.demo)) {
42117
+ if (!this.expandedElements.has(elementName)) {
42118
+ const newSet = new Set(this.expandedElements);
42119
+ newSet.add(elementName);
42120
+ this.expandedElements = newSet;
42121
+ }
41969
42122
  }
42123
+ break;
41970
42124
  }
41971
42125
  }
41972
42126
  }
41973
42127
  }
41974
- selectItem(typeArg, itemNameArg, itemArg, demoIndex = 0) {
42128
+ selectItem(typeArg, itemNameArg, itemArg, demoIndex = 0, section) {
41975
42129
  console.log("selected item");
41976
42130
  console.log(itemNameArg);
41977
42131
  console.log(itemArg);
41978
42132
  console.log("demo index:", demoIndex);
42133
+ console.log("section:", section?.name);
41979
42134
  this.selectedItem = itemArg;
41980
42135
  this.selectedType = typeArg;
41981
42136
  this.dashboardRef.selectedDemoIndex = demoIndex;
42137
+ if (section) {
42138
+ this.dashboardRef.selectedSection = section;
42139
+ }
41982
42140
  this.dispatchEvent(
41983
42141
  new CustomEvent("selectedType", {
41984
42142
  detail: typeArg
@@ -42004,11 +42162,15 @@ _selectedType = new WeakMap();
42004
42162
  _dashboardRef = new WeakMap();
42005
42163
  _isNative2 = new WeakMap();
42006
42164
  _expandedElements = new WeakMap();
42165
+ _collapsedSections = new WeakMap();
42166
+ _searchQuery = new WeakMap();
42007
42167
  __decorateElement(_init2, 4, "selectedItem", _selectedItem_dec, WccSidebar, _selectedItem);
42008
42168
  __decorateElement(_init2, 4, "selectedType", _selectedType_dec, WccSidebar, _selectedType);
42009
42169
  __decorateElement(_init2, 4, "dashboardRef", _dashboardRef_dec, WccSidebar, _dashboardRef);
42010
42170
  __decorateElement(_init2, 4, "isNative", _isNative_dec2, WccSidebar, _isNative2);
42011
42171
  __decorateElement(_init2, 4, "expandedElements", _expandedElements_dec, WccSidebar, _expandedElements);
42172
+ __decorateElement(_init2, 4, "collapsedSections", _collapsedSections_dec, WccSidebar, _collapsedSections);
42173
+ __decorateElement(_init2, 4, "searchQuery", _searchQuery_dec, WccSidebar, _searchQuery);
42012
42174
  WccSidebar = __decorateElement(_init2, 0, "WccSidebar", _WccSidebar_decorators, WccSidebar);
42013
42175
  __runInitializers(_init2, 1, WccSidebar);
42014
42176
 
@@ -44320,39 +44482,65 @@ WccProperties = __decorateElement(_init5, 0, "WccProperties", _WccProperties_dec
44320
44482
  __runInitializers(_init5, 1, WccProperties);
44321
44483
 
44322
44484
  // ts_web/elements/wcc-dashboard.ts
44323
- var _wccFrame_dec, _warning_dec2, _elements_dec, _pages_dec, _selectedTheme_dec2, _selectedViewport_dec2, _selectedDemoIndex_dec, _selectedItem_dec3, _selectedItemName_dec, _selectedType_dec2, _a6, _WccDashboard_decorators, _init6, _selectedType2, _selectedItemName, _selectedItem3, _selectedDemoIndex, _selectedViewport2, _selectedTheme2, _pages, _elements, _warning2, _wccFrame;
44485
+ var _wccFrame_dec, _warning_dec2, _searchQuery_dec2, _selectedTheme_dec2, _selectedViewport_dec2, _selectedDemoIndex_dec, _selectedItem_dec3, _selectedItemName_dec, _selectedType_dec2, _selectedSection_dec, _sections_dec, _a6, _WccDashboard_decorators, _init6, _sections, _selectedSection, _selectedType2, _selectedItemName, _selectedItem3, _selectedDemoIndex, _selectedViewport2, _selectedTheme2, _searchQuery2, _warning2, _wccFrame;
44486
+ var getSectionItems = (section) => {
44487
+ let entries = Object.entries(section.items);
44488
+ if (section.filter) {
44489
+ entries = entries.filter(([name, item]) => section.filter(name, item));
44490
+ }
44491
+ if (section.sort) {
44492
+ entries.sort(section.sort);
44493
+ }
44494
+ return entries;
44495
+ };
44324
44496
  _WccDashboard_decorators = [t4("wcc-dashboard")];
44325
- var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()], _selectedItemName_dec = [n5()], _selectedItem_dec3 = [n5()], _selectedDemoIndex_dec = [n5({ type: Number })], _selectedViewport_dec2 = [n5()], _selectedTheme_dec2 = [n5()], _pages_dec = [n5()], _elements_dec = [n5()], _warning_dec2 = [n5()], _wccFrame_dec = [r7("wcc-frame")], _a6) {
44326
- constructor(elementsArg, pagesArg) {
44497
+ var WccDashboard2 = class extends (_a6 = DeesElement, _sections_dec = [n5()], _selectedSection_dec = [n5()], _selectedType_dec2 = [n5()], _selectedItemName_dec = [n5()], _selectedItem_dec3 = [n5()], _selectedDemoIndex_dec = [n5({ type: Number })], _selectedViewport_dec2 = [n5()], _selectedTheme_dec2 = [n5()], _searchQuery_dec2 = [n5()], _warning_dec2 = [n5()], _wccFrame_dec = [r7("wcc-frame")], _a6) {
44498
+ constructor(config2) {
44327
44499
  super();
44328
- __privateAdd(this, _selectedType2, __runInitializers(_init6, 8, this)), __runInitializers(_init6, 11, this);
44329
- __privateAdd(this, _selectedItemName, __runInitializers(_init6, 12, this)), __runInitializers(_init6, 15, this);
44330
- __privateAdd(this, _selectedItem3, __runInitializers(_init6, 16, this)), __runInitializers(_init6, 19, this);
44331
- __privateAdd(this, _selectedDemoIndex, __runInitializers(_init6, 20, this, 0)), __runInitializers(_init6, 23, this);
44332
- __privateAdd(this, _selectedViewport2, __runInitializers(_init6, 24, this, "desktop")), __runInitializers(_init6, 27, this);
44333
- __privateAdd(this, _selectedTheme2, __runInitializers(_init6, 28, this, "dark")), __runInitializers(_init6, 31, this);
44334
- __privateAdd(this, _pages, __runInitializers(_init6, 32, this, {})), __runInitializers(_init6, 35, this);
44335
- __privateAdd(this, _elements, __runInitializers(_init6, 36, this, {})), __runInitializers(_init6, 39, this);
44336
- __privateAdd(this, _warning2, __runInitializers(_init6, 40, this, null)), __runInitializers(_init6, 43, this);
44500
+ __privateAdd(this, _sections, __runInitializers(_init6, 8, this, [])), __runInitializers(_init6, 11, this);
44501
+ __privateAdd(this, _selectedSection, __runInitializers(_init6, 12, this, null)), __runInitializers(_init6, 15, this);
44502
+ __privateAdd(this, _selectedType2, __runInitializers(_init6, 16, this)), __runInitializers(_init6, 19, this);
44503
+ __privateAdd(this, _selectedItemName, __runInitializers(_init6, 20, this)), __runInitializers(_init6, 23, this);
44504
+ __privateAdd(this, _selectedItem3, __runInitializers(_init6, 24, this)), __runInitializers(_init6, 27, this);
44505
+ __privateAdd(this, _selectedDemoIndex, __runInitializers(_init6, 28, this, 0)), __runInitializers(_init6, 31, this);
44506
+ __privateAdd(this, _selectedViewport2, __runInitializers(_init6, 32, this, "desktop")), __runInitializers(_init6, 35, this);
44507
+ __privateAdd(this, _selectedTheme2, __runInitializers(_init6, 36, this, "dark")), __runInitializers(_init6, 39, this);
44508
+ __privateAdd(this, _searchQuery2, __runInitializers(_init6, 40, this, "")), __runInitializers(_init6, 43, this);
44509
+ __privateAdd(this, _warning2, __runInitializers(_init6, 44, this, null)), __runInitializers(_init6, 47, this);
44337
44510
  __publicField(this, "frameScrollY", 0);
44338
44511
  __publicField(this, "sidebarScrollY", 0);
44339
44512
  __publicField(this, "scrollPositionsApplied", false);
44340
- __privateAdd(this, _wccFrame, __runInitializers(_init6, 44, this)), __runInitializers(_init6, 47, this);
44513
+ __privateAdd(this, _wccFrame, __runInitializers(_init6, 48, this)), __runInitializers(_init6, 51, this);
44341
44514
  __publicField(this, "scrollUpdateTimeout");
44342
44515
  __publicField(this, "scrollListenersAttached", false);
44343
- if (elementsArg) {
44344
- this.elements = elementsArg;
44345
- console.log("got elements:");
44346
- console.log(this.elements);
44347
- }
44348
- if (pagesArg) {
44349
- this.pages = pagesArg;
44516
+ if (config2 && config2.sections) {
44517
+ this.sections = config2.sections;
44518
+ console.log("got sections:", this.sections.map((s8) => s8.name));
44350
44519
  }
44351
44520
  }
44352
44521
  // Derived from selectedViewport - no need for separate property
44353
44522
  get isNative() {
44354
44523
  return this.selectedViewport === "native";
44355
44524
  }
44525
+ /**
44526
+ * Find an item by name across all sections, returns the item and its section
44527
+ */
44528
+ findItemByName(name) {
44529
+ for (const section of this.sections) {
44530
+ const entries = getSectionItems(section);
44531
+ const found = entries.find(([itemName]) => itemName === name);
44532
+ if (found) {
44533
+ return { item: found[1], section };
44534
+ }
44535
+ }
44536
+ return null;
44537
+ }
44538
+ /**
44539
+ * Find a section by name (URL-decoded)
44540
+ */
44541
+ findSectionByName(name) {
44542
+ return this.sections.find((s8) => s8.name === name) || null;
44543
+ }
44356
44544
  render() {
44357
44545
  return x`
44358
44546
  <style>
@@ -44368,6 +44556,7 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44368
44556
  <wcc-sidebar
44369
44557
  .dashboardRef=${this}
44370
44558
  .selectedItem=${this.selectedItem}
44559
+ .searchQuery=${this.searchQuery}
44371
44560
  .isNative=${this.isNative}
44372
44561
  @selectedType=${(eventArg) => {
44373
44562
  this.selectedType = eventArg.detail;
@@ -44377,6 +44566,10 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44377
44566
  }}
44378
44567
  @selectedItem=${(eventArg) => {
44379
44568
  this.selectedItem = eventArg.detail;
44569
+ }}
44570
+ @searchChanged=${(eventArg) => {
44571
+ this.searchQuery = eventArg.detail;
44572
+ this.updateUrlWithScrollState();
44380
44573
  }}
44381
44574
  ></wcc-sidebar>
44382
44575
  <wcc-properties
@@ -44433,21 +44626,41 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44433
44626
  this.setupScrollListeners();
44434
44627
  }, 500);
44435
44628
  this.domtools.router.on(
44436
- "/wcctools-route/:itemType/:itemName/:demoIndex/:viewport/:theme",
44629
+ "/wcctools-route/:sectionName/:itemName/:demoIndex/:viewport/:theme",
44437
44630
  async (routeInfo) => {
44438
- this.selectedType = routeInfo.params.itemType;
44631
+ const sectionName = decodeURIComponent(routeInfo.params.sectionName);
44632
+ this.selectedSection = this.findSectionByName(sectionName);
44439
44633
  this.selectedItemName = routeInfo.params.itemName;
44440
44634
  this.selectedDemoIndex = parseInt(routeInfo.params.demoIndex) || 0;
44441
44635
  this.selectedViewport = routeInfo.params.viewport;
44442
44636
  this.selectedTheme = routeInfo.params.theme;
44443
- if (routeInfo.params.itemType === "element") {
44444
- this.selectedItem = this.elements[routeInfo.params.itemName];
44445
- } else if (routeInfo.params.itemType === "page") {
44446
- this.selectedItem = this.pages[routeInfo.params.itemName];
44637
+ if (this.selectedSection) {
44638
+ const entries = getSectionItems(this.selectedSection);
44639
+ const found = entries.find(([name]) => name === routeInfo.params.itemName);
44640
+ if (found) {
44641
+ this.selectedItem = found[1];
44642
+ this.selectedType = this.selectedSection.type === "elements" ? "element" : "page";
44643
+ }
44644
+ } else {
44645
+ const legacyType = routeInfo.params.sectionName;
44646
+ if (legacyType === "element" || legacyType === "page") {
44647
+ this.selectedType = legacyType;
44648
+ const result = this.findItemByName(routeInfo.params.itemName);
44649
+ if (result) {
44650
+ this.selectedItem = result.item;
44651
+ this.selectedSection = result.section;
44652
+ }
44653
+ }
44447
44654
  }
44448
44655
  if (routeInfo.queryParams) {
44656
+ const search2 = routeInfo.queryParams.search;
44449
44657
  const frameScrollY = routeInfo.queryParams.frameScrollY;
44450
44658
  const sidebarScrollY = routeInfo.queryParams.sidebarScrollY;
44659
+ if (search2) {
44660
+ this.searchQuery = search2;
44661
+ } else {
44662
+ this.searchQuery = "";
44663
+ }
44451
44664
  if (frameScrollY) {
44452
44665
  this.frameScrollY = parseInt(frameScrollY);
44453
44666
  }
@@ -44457,27 +44670,49 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44457
44670
  setTimeout(() => {
44458
44671
  this.applyScrollPositions();
44459
44672
  }, 100);
44673
+ } else {
44674
+ this.searchQuery = "";
44460
44675
  }
44461
44676
  const domtoolsInstance = await dist_ts_exports25.elementBasic.setup();
44462
44677
  this.selectedTheme === "bright" ? domtoolsInstance.themeManager.goBright() : domtoolsInstance.themeManager.goDark();
44463
44678
  }
44464
44679
  );
44465
44680
  this.domtools.router.on(
44466
- "/wcctools-route/:itemType/:itemName/:viewport/:theme",
44681
+ "/wcctools-route/:sectionName/:itemName/:viewport/:theme",
44467
44682
  async (routeInfo) => {
44468
- this.selectedType = routeInfo.params.itemType;
44683
+ const sectionName = decodeURIComponent(routeInfo.params.sectionName);
44684
+ this.selectedSection = this.findSectionByName(sectionName);
44469
44685
  this.selectedItemName = routeInfo.params.itemName;
44470
44686
  this.selectedDemoIndex = 0;
44471
44687
  this.selectedViewport = routeInfo.params.viewport;
44472
44688
  this.selectedTheme = routeInfo.params.theme;
44473
- if (routeInfo.params.itemType === "element") {
44474
- this.selectedItem = this.elements[routeInfo.params.itemName];
44475
- } else if (routeInfo.params.itemType === "page") {
44476
- this.selectedItem = this.pages[routeInfo.params.itemName];
44689
+ if (this.selectedSection) {
44690
+ const entries = getSectionItems(this.selectedSection);
44691
+ const found = entries.find(([name]) => name === routeInfo.params.itemName);
44692
+ if (found) {
44693
+ this.selectedItem = found[1];
44694
+ this.selectedType = this.selectedSection.type === "elements" ? "element" : "page";
44695
+ }
44696
+ } else {
44697
+ const legacyType = routeInfo.params.sectionName;
44698
+ if (legacyType === "element" || legacyType === "page") {
44699
+ this.selectedType = legacyType;
44700
+ const result = this.findItemByName(routeInfo.params.itemName);
44701
+ if (result) {
44702
+ this.selectedItem = result.item;
44703
+ this.selectedSection = result.section;
44704
+ }
44705
+ }
44477
44706
  }
44478
44707
  if (routeInfo.queryParams) {
44708
+ const search2 = routeInfo.queryParams.search;
44479
44709
  const frameScrollY = routeInfo.queryParams.frameScrollY;
44480
44710
  const sidebarScrollY = routeInfo.queryParams.sidebarScrollY;
44711
+ if (search2) {
44712
+ this.searchQuery = search2;
44713
+ } else {
44714
+ this.searchQuery = "";
44715
+ }
44481
44716
  if (frameScrollY) {
44482
44717
  this.frameScrollY = parseInt(frameScrollY);
44483
44718
  }
@@ -44487,6 +44722,8 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44487
44722
  setTimeout(() => {
44488
44723
  this.applyScrollPositions();
44489
44724
  }, 100);
44725
+ } else {
44726
+ this.searchQuery = "";
44490
44727
  }
44491
44728
  const domtoolsInstance = await dist_ts_exports25.elementBasic.setup();
44492
44729
  this.selectedTheme === "bright" ? domtoolsInstance.themeManager.goBright() : domtoolsInstance.themeManager.goDark();
@@ -44542,8 +44779,12 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44542
44779
  }
44543
44780
  }
44544
44781
  buildUrl() {
44545
- const baseUrl = `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedDemoIndex}/${this.selectedViewport}/${this.selectedTheme}`;
44782
+ const sectionName = this.selectedSection ? encodeURIComponent(this.selectedSection.name) : this.selectedType;
44783
+ const baseUrl = `/wcctools-route/${sectionName}/${this.selectedItemName}/${this.selectedDemoIndex}/${this.selectedViewport}/${this.selectedTheme}`;
44546
44784
  const queryParams = new URLSearchParams();
44785
+ if (this.searchQuery) {
44786
+ queryParams.set("search", this.searchQuery);
44787
+ }
44547
44788
  if (this.frameScrollY > 0) {
44548
44789
  queryParams.set("frameScrollY", this.frameScrollY.toString());
44549
44790
  }
@@ -44581,8 +44822,12 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44581
44822
  }, 300);
44582
44823
  }
44583
44824
  updateUrlWithScrollState() {
44584
- const baseUrl = `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedDemoIndex}/${this.selectedViewport}/${this.selectedTheme}`;
44825
+ const sectionName = this.selectedSection ? encodeURIComponent(this.selectedSection.name) : this.selectedType;
44826
+ const baseUrl = `/wcctools-route/${sectionName}/${this.selectedItemName}/${this.selectedDemoIndex}/${this.selectedViewport}/${this.selectedTheme}`;
44585
44827
  const queryParams = new URLSearchParams();
44828
+ if (this.searchQuery) {
44829
+ queryParams.set("search", this.searchQuery);
44830
+ }
44586
44831
  if (this.frameScrollY > 0) {
44587
44832
  queryParams.set("frameScrollY", this.frameScrollY.toString());
44588
44833
  }
@@ -44609,36 +44854,65 @@ var WccDashboard2 = class extends (_a6 = DeesElement, _selectedType_dec2 = [n5()
44609
44854
  }
44610
44855
  };
44611
44856
  _init6 = __decoratorStart(_a6);
44857
+ _sections = new WeakMap();
44858
+ _selectedSection = new WeakMap();
44612
44859
  _selectedType2 = new WeakMap();
44613
44860
  _selectedItemName = new WeakMap();
44614
44861
  _selectedItem3 = new WeakMap();
44615
44862
  _selectedDemoIndex = new WeakMap();
44616
44863
  _selectedViewport2 = new WeakMap();
44617
44864
  _selectedTheme2 = new WeakMap();
44618
- _pages = new WeakMap();
44619
- _elements = new WeakMap();
44865
+ _searchQuery2 = new WeakMap();
44620
44866
  _warning2 = new WeakMap();
44621
44867
  _wccFrame = new WeakMap();
44868
+ __decorateElement(_init6, 4, "sections", _sections_dec, WccDashboard2, _sections);
44869
+ __decorateElement(_init6, 4, "selectedSection", _selectedSection_dec, WccDashboard2, _selectedSection);
44622
44870
  __decorateElement(_init6, 4, "selectedType", _selectedType_dec2, WccDashboard2, _selectedType2);
44623
44871
  __decorateElement(_init6, 4, "selectedItemName", _selectedItemName_dec, WccDashboard2, _selectedItemName);
44624
44872
  __decorateElement(_init6, 4, "selectedItem", _selectedItem_dec3, WccDashboard2, _selectedItem3);
44625
44873
  __decorateElement(_init6, 4, "selectedDemoIndex", _selectedDemoIndex_dec, WccDashboard2, _selectedDemoIndex);
44626
44874
  __decorateElement(_init6, 4, "selectedViewport", _selectedViewport_dec2, WccDashboard2, _selectedViewport2);
44627
44875
  __decorateElement(_init6, 4, "selectedTheme", _selectedTheme_dec2, WccDashboard2, _selectedTheme2);
44628
- __decorateElement(_init6, 4, "pages", _pages_dec, WccDashboard2, _pages);
44629
- __decorateElement(_init6, 4, "elements", _elements_dec, WccDashboard2, _elements);
44876
+ __decorateElement(_init6, 4, "searchQuery", _searchQuery_dec2, WccDashboard2, _searchQuery2);
44630
44877
  __decorateElement(_init6, 4, "warning", _warning_dec2, WccDashboard2, _warning2);
44631
44878
  __decorateElement(_init6, 4, "wccFrame", _wccFrame_dec, WccDashboard2, _wccFrame);
44632
44879
  WccDashboard2 = __decorateElement(_init6, 0, "WccDashboard", _WccDashboard_decorators, WccDashboard2);
44633
44880
  __runInitializers(_init6, 1, WccDashboard2);
44634
44881
 
44635
44882
  // ts_web/index.ts
44636
- var setupWccTools = (elementsArg, pagesArg) => {
44883
+ var convertLegacyToConfig = (elementsArg, pagesArg) => {
44884
+ const sections = [];
44885
+ if (pagesArg && Object.keys(pagesArg).length > 0) {
44886
+ sections.push({
44887
+ name: "Pages",
44888
+ type: "pages",
44889
+ items: pagesArg
44890
+ });
44891
+ }
44892
+ if (elementsArg && Object.keys(elementsArg).length > 0) {
44893
+ sections.push({
44894
+ name: "Elements",
44895
+ type: "elements",
44896
+ items: elementsArg
44897
+ });
44898
+ }
44899
+ return { sections };
44900
+ };
44901
+ var isWccConfig = (arg) => {
44902
+ return arg && typeof arg === "object" && "sections" in arg && Array.isArray(arg.sections);
44903
+ };
44904
+ var setupWccTools = (configOrElements, pagesArg) => {
44905
+ let config2;
44906
+ if (isWccConfig(configOrElements)) {
44907
+ config2 = configOrElements;
44908
+ } else {
44909
+ config2 = convertLegacyToConfig(configOrElements, pagesArg);
44910
+ }
44637
44911
  let hasRun = false;
44638
44912
  const runWccToolsSetup = async () => {
44639
44913
  if (document.readyState === "complete" && !hasRun) {
44640
44914
  hasRun = true;
44641
- const wccTools = new WccDashboard2(elementsArg, pagesArg);
44915
+ const wccTools = new WccDashboard2(config2);
44642
44916
  document.querySelector("body").append(wccTools);
44643
44917
  }
44644
44918
  };