@design.estate/dees-wcctools 3.6.0 → 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.6.0",
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.6.0',
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
  }
@@ -647,27 +647,43 @@ export class WccSidebar extends DeesElement {
647
647
  groupedItems.get(group)!.push(entry);
648
648
  }
649
649
 
650
- 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 };
651
655
 
652
- // Render ungrouped items first
656
+ const renderItems: RenderItem[] = [];
657
+
658
+ // Add ungrouped items
653
659
  const ungrouped = groupedItems.get(null) || [];
654
660
  for (const entry of ungrouped) {
655
- result.push(this.renderElementItem(entry, section));
661
+ renderItems.push({ type: 'element', entry, sortKey: entry[0].toLowerCase() });
656
662
  }
657
663
 
658
- // Render grouped items
664
+ // Add groups (sorted by their first element's name)
659
665
  for (const [groupName, items] of groupedItems) {
660
666
  if (groupName === null) continue;
661
-
662
- result.push(html`
663
- <div class="item-group">
664
- <span class="item-group-legend">${groupName}</span>
665
- ${items.map((entry) => this.renderElementItem(entry, section))}
666
- </div>
667
- `);
667
+ const firstElementName = items[0]?.[0] || '';
668
+ renderItems.push({ type: 'group', groupName, items, sortKey: firstElementName.toLowerCase() });
668
669
  }
669
670
 
670
- 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
+ });
671
687
  }
672
688
  }
673
689