@design.estate/dees-wcctools 3.5.3 → 3.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-wcctools",
3
- "version": "3.5.3",
3
+ "version": "3.6.1",
4
4
  "private": false,
5
5
  "description": "A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.",
6
6
  "exports": {
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-wcctools',
6
- version: '3.5.3',
6
+ version: '3.6.1',
7
7
  description: 'A set of web component tools for creating element catalogues, enabling the structured development and documentation of custom elements and pages.'
8
8
  }
@@ -71,7 +71,8 @@ export class WccSidebar extends DeesElement {
71
71
  --ring: #3b82f6;
72
72
  --radius: 4px;
73
73
 
74
- display: ${this.isHidden ? 'none' : 'block'};
74
+ display: ${this.isHidden ? 'none' : 'flex'};
75
+ flex-direction: column;
75
76
  border-right: 1px solid rgba(255, 255, 255, 0.08);
76
77
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
77
78
  font-size: 14px;
@@ -81,13 +82,20 @@ export class WccSidebar extends DeesElement {
81
82
  width: ${this.sidebarWidth}px;
82
83
  top: 0px;
83
84
  bottom: 0px;
84
- overflow-y: auto;
85
- overflow-x: hidden;
85
+ overflow: hidden;
86
86
  background: var(--background);
87
87
  color: var(--foreground);
88
88
  }
89
89
 
90
+ .sidebar-header {
91
+ flex-shrink: 0;
92
+ }
93
+
90
94
  .menu {
95
+ flex: 1;
96
+ min-height: 0;
97
+ overflow-y: auto;
98
+ overflow-x: hidden;
91
99
  padding: 0.5rem 0;
92
100
  }
93
101
 
@@ -281,6 +289,7 @@ export class WccSidebar extends DeesElement {
281
289
  .search-container {
282
290
  padding: 0.5rem;
283
291
  border-bottom: 1px solid var(--border);
292
+ position: relative;
284
293
  }
285
294
 
286
295
  .search-input {
@@ -289,7 +298,7 @@ export class WccSidebar extends DeesElement {
289
298
  background: var(--input);
290
299
  border: 1px solid var(--border);
291
300
  border-radius: var(--radius);
292
- padding: 0.5rem 0.75rem;
301
+ padding: 0.5rem 1.75rem 0.5rem 0.75rem;
293
302
  color: var(--foreground);
294
303
  font-size: 0.75rem;
295
304
  font-family: inherit;
@@ -305,6 +314,33 @@ export class WccSidebar extends DeesElement {
305
314
  color: var(--muted-foreground);
306
315
  }
307
316
 
317
+ .search-clear {
318
+ position: absolute;
319
+ right: 0.75rem;
320
+ top: 50%;
321
+ transform: translateY(-50%);
322
+ background: none;
323
+ border: none;
324
+ padding: 0.25rem;
325
+ cursor: pointer;
326
+ color: var(--muted-foreground);
327
+ display: flex;
328
+ align-items: center;
329
+ justify-content: center;
330
+ border-radius: 2px;
331
+ transition: color 0.15s ease, background 0.15s ease;
332
+ }
333
+
334
+ .search-clear:hover {
335
+ color: var(--foreground);
336
+ background: rgba(255, 255, 255, 0.1);
337
+ }
338
+
339
+ .search-clear .material-symbols-outlined {
340
+ font-size: 14px;
341
+ opacity: 1;
342
+ }
343
+
308
344
  .highlight {
309
345
  background: rgba(59, 130, 246, 0.3);
310
346
  border-radius: 2px;
@@ -394,17 +430,24 @@ export class WccSidebar extends DeesElement {
394
430
  background: var(--primary);
395
431
  }
396
432
  </style>
397
- <div class="search-container">
398
- <input
399
- type="text"
400
- class="search-input"
401
- placeholder="Search..."
402
- .value=${this.searchQuery}
403
- @input=${this.handleSearchInput}
404
- />
433
+ <div class="sidebar-header">
434
+ <div class="search-container">
435
+ <input
436
+ type="text"
437
+ class="search-input"
438
+ placeholder="Search..."
439
+ .value=${this.searchQuery}
440
+ @input=${this.handleSearchInput}
441
+ />
442
+ ${this.searchQuery ? html`
443
+ <button class="search-clear" @click=${this.clearSearch}>
444
+ <i class="material-symbols-outlined">close</i>
445
+ </button>
446
+ ` : null}
447
+ </div>
448
+ ${this.renderPinnedSection()}
405
449
  </div>
406
450
  <div class="menu">
407
- ${this.renderPinnedSection()}
408
451
  ${this.renderSections()}
409
452
  </div>
410
453
  <div
@@ -604,27 +647,43 @@ export class WccSidebar extends DeesElement {
604
647
  groupedItems.get(group)!.push(entry);
605
648
  }
606
649
 
607
- const result: TemplateResult[] = [];
650
+ // Build a unified list of render items (ungrouped elements and groups)
651
+ // Each item has a sortKey (element name or first element name of group)
652
+ type RenderItem =
653
+ | { type: 'element'; entry: [string, any]; sortKey: string }
654
+ | { type: 'group'; groupName: string; items: Array<[string, any]>; sortKey: string };
608
655
 
609
- // Render ungrouped items first
656
+ const renderItems: RenderItem[] = [];
657
+
658
+ // Add ungrouped items
610
659
  const ungrouped = groupedItems.get(null) || [];
611
660
  for (const entry of ungrouped) {
612
- result.push(this.renderElementItem(entry, section));
661
+ renderItems.push({ type: 'element', entry, sortKey: entry[0].toLowerCase() });
613
662
  }
614
663
 
615
- // Render grouped items
664
+ // Add groups (sorted by their first element's name)
616
665
  for (const [groupName, items] of groupedItems) {
617
666
  if (groupName === null) continue;
618
-
619
- result.push(html`
620
- <div class="item-group">
621
- <span class="item-group-legend">${groupName}</span>
622
- ${items.map((entry) => this.renderElementItem(entry, section))}
623
- </div>
624
- `);
667
+ const firstElementName = items[0]?.[0] || '';
668
+ renderItems.push({ type: 'group', groupName, items, sortKey: firstElementName.toLowerCase() });
625
669
  }
626
670
 
627
- return result;
671
+ // Sort all items alphabetically by sortKey
672
+ renderItems.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
673
+
674
+ // Render in sorted order
675
+ return renderItems.map((item) => {
676
+ if (item.type === 'element') {
677
+ return this.renderElementItem(item.entry, section);
678
+ } else {
679
+ return html`
680
+ <div class="item-group">
681
+ <span class="item-group-legend">${item.groupName}</span>
682
+ ${item.items.map((entry) => this.renderElementItem(entry, section))}
683
+ </div>
684
+ `;
685
+ }
686
+ });
628
687
  }
629
688
  }
630
689
 
@@ -716,6 +775,11 @@ export class WccSidebar extends DeesElement {
716
775
  this.dispatchEvent(new CustomEvent('searchChanged', { detail: this.searchQuery }));
717
776
  }
718
777
 
778
+ private clearSearch() {
779
+ this.searchQuery = '';
780
+ this.dispatchEvent(new CustomEvent('searchChanged', { detail: this.searchQuery }));
781
+ }
782
+
719
783
  private matchesSearch(name: string): boolean {
720
784
  if (!this.searchQuery) return true;
721
785
  return name.toLowerCase().includes(this.searchQuery.toLowerCase());