@design.estate/dees-wcctools 3.5.0 → 3.5.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.0",
3
+ "version": "3.5.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.0',
6
+ version: '3.5.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
  }
@@ -66,6 +66,10 @@ export class WccDashboard extends DeesElement {
66
66
  @property({ attribute: false })
67
67
  accessor pinnedItems: Set<string> = new Set();
68
68
 
69
+ // Sidebar width (resizable)
70
+ @property({ type: Number })
71
+ accessor sidebarWidth: number = 200;
72
+
69
73
  // Derived from selectedViewport - no need for separate property
70
74
  public get isNative(): boolean {
71
75
  return this.selectedViewport === 'native';
@@ -127,6 +131,7 @@ export class WccDashboard extends DeesElement {
127
131
  .selectedItem=${this.selectedItem}
128
132
  .searchQuery=${this.searchQuery}
129
133
  .pinnedItems=${this.pinnedItems}
134
+ .sidebarWidth=${this.sidebarWidth}
130
135
  .isNative=${this.isNative}
131
136
  @selectedType=${(eventArg) => {
132
137
  this.selectedType = eventArg.detail;
@@ -145,6 +150,15 @@ export class WccDashboard extends DeesElement {
145
150
  this.pinnedItems = eventArg.detail;
146
151
  this.updateUrlWithScrollState();
147
152
  }}
153
+ @widthChanged=${async (eventArg: CustomEvent) => {
154
+ this.sidebarWidth = eventArg.detail;
155
+ this.updateUrlWithScrollState();
156
+ const frame = await this.wccFrame;
157
+ if (frame) {
158
+ frame.sidebarWidth = eventArg.detail;
159
+ frame.requestUpdate();
160
+ }
161
+ }}
148
162
  ></wcc-sidebar>
149
163
  <wcc-properties
150
164
  .dashboardRef=${this}
@@ -153,6 +167,7 @@ export class WccDashboard extends DeesElement {
153
167
  .selectedViewport=${this.selectedViewport}
154
168
  .selectedTheme=${this.selectedTheme}
155
169
  .isNative=${this.isNative}
170
+ .sidebarWidth=${this.sidebarWidth}
156
171
  @selectedViewport=${(eventArg) => {
157
172
  this.selectedViewport = eventArg.detail;
158
173
  this.scheduleUpdate();
@@ -171,7 +186,7 @@ export class WccDashboard extends DeesElement {
171
186
  this.toggleNative();
172
187
  }}
173
188
  ></wcc-properties>
174
- <wcc-frame id="wccFrame" viewport=${this.selectedViewport} .isNative=${this.isNative}>
189
+ <wcc-frame id="wccFrame" viewport=${this.selectedViewport} .isNative=${this.isNative} .sidebarWidth=${this.sidebarWidth}>
175
190
  </wcc-frame>
176
191
  `;
177
192
  }
@@ -247,6 +262,7 @@ export class WccDashboard extends DeesElement {
247
262
  const frameScrollY = routeInfo.queryParams.frameScrollY;
248
263
  const sidebarScrollY = routeInfo.queryParams.sidebarScrollY;
249
264
  const pinned = routeInfo.queryParams.pinned;
265
+ const sidebarWidth = routeInfo.queryParams.sidebarWidth;
250
266
 
251
267
  if (search) {
252
268
  this.searchQuery = search;
@@ -269,10 +285,19 @@ export class WccDashboard extends DeesElement {
269
285
  } else if (this.pinnedItems.size > 0) {
270
286
  this.pinnedItems = new Set();
271
287
  }
288
+ if (sidebarWidth) {
289
+ this.sidebarWidth = parseInt(sidebarWidth, 10);
290
+ }
272
291
 
273
- // Apply scroll positions after a short delay to ensure DOM is ready
274
- setTimeout(() => {
292
+ // Apply scroll positions and update frame after a short delay to ensure DOM is ready
293
+ setTimeout(async () => {
275
294
  this.applyScrollPositions();
295
+ // Ensure frame gets the sidebarWidth
296
+ const frame = await this.wccFrame;
297
+ if (frame) {
298
+ frame.sidebarWidth = this.sidebarWidth;
299
+ frame.requestUpdate();
300
+ }
276
301
  }, 100);
277
302
  } else {
278
303
  this.searchQuery = '';
@@ -326,6 +351,7 @@ export class WccDashboard extends DeesElement {
326
351
  const frameScrollY = routeInfo.queryParams.frameScrollY;
327
352
  const sidebarScrollY = routeInfo.queryParams.sidebarScrollY;
328
353
  const pinned = routeInfo.queryParams.pinned;
354
+ const sidebarWidth = routeInfo.queryParams.sidebarWidth;
329
355
 
330
356
  if (search) {
331
357
  this.searchQuery = search;
@@ -348,6 +374,9 @@ export class WccDashboard extends DeesElement {
348
374
  } else if (this.pinnedItems.size > 0) {
349
375
  this.pinnedItems = new Set();
350
376
  }
377
+ if (sidebarWidth) {
378
+ this.sidebarWidth = parseInt(sidebarWidth, 10);
379
+ }
351
380
 
352
381
  // Apply scroll positions after a short delay to ensure DOM is ready
353
382
  setTimeout(() => {
@@ -444,6 +473,9 @@ export class WccDashboard extends DeesElement {
444
473
  if (this.pinnedItems.size > 0) {
445
474
  queryParams.set('pinned', Array.from(this.pinnedItems).join(','));
446
475
  }
476
+ if (this.sidebarWidth !== 200) {
477
+ queryParams.set('sidebarWidth', this.sidebarWidth.toString());
478
+ }
447
479
 
448
480
  const queryString = queryParams.toString();
449
481
  const fullUrl = queryString ? `${baseUrl}?${queryString}` : baseUrl;
@@ -507,6 +539,9 @@ export class WccDashboard extends DeesElement {
507
539
  if (this.pinnedItems.size > 0) {
508
540
  queryParams.set('pinned', Array.from(this.pinnedItems).join(','));
509
541
  }
542
+ if (this.sidebarWidth !== 200) {
543
+ queryParams.set('sidebarWidth', this.sidebarWidth.toString());
544
+ }
510
545
 
511
546
  const queryString = queryParams.toString();
512
547
  const fullUrl = queryString ? `${baseUrl}?${queryString}` : baseUrl;
@@ -19,13 +19,18 @@ export class WccFrame extends DeesElement {
19
19
  @property({ type: Boolean })
20
20
  accessor isNative: boolean = false;
21
21
 
22
+ @property({ type: Number })
23
+ accessor sidebarWidth: number = 200;
24
+
25
+ @property({ type: Boolean })
26
+ accessor isResizing: boolean = false;
27
+
22
28
  public static styles = [
23
29
  css`
24
30
  :host {
25
31
  border: 10px solid #ffaeaf;
26
32
  position: absolute;
27
33
  background: ${cssManager.bdTheme('#333', '#000')};
28
- left: 200px;
29
34
  right: 0px;
30
35
  top: 0px;
31
36
  overflow-y: auto;
@@ -55,9 +60,9 @@ export class WccFrame extends DeesElement {
55
60
  ` : `
56
61
  bottom: ${this.advancedEditorOpen ? '400px' : '100px'};
57
62
  border: 10px solid #ffaeaf;
58
- left: 200px;
63
+ left: ${this.sidebarWidth}px;
59
64
  `}
60
- transition: all 0.3s ease;
65
+ transition: ${this.isResizing ? 'none' : 'all 0.3s ease'};
61
66
  ${this.isNative ? 'padding: 0px;' : (() => {
62
67
  switch (this.viewport) {
63
68
  case 'desktop':
@@ -67,19 +72,19 @@ export class WccFrame extends DeesElement {
67
72
  case 'tablet':
68
73
  return `
69
74
  padding: 0px ${
70
- (document.body.clientWidth - 200 - domtools.breakpoints.tablet) / 2
75
+ (document.body.clientWidth - this.sidebarWidth - domtools.breakpoints.tablet) / 2
71
76
  }px;
72
77
  `;
73
78
  case 'phablet':
74
79
  return `
75
80
  padding: 0px ${
76
- (document.body.clientWidth - 200 - domtools.breakpoints.phablet) / 2
81
+ (document.body.clientWidth - this.sidebarWidth - domtools.breakpoints.phablet) / 2
77
82
  }px;
78
83
  `;
79
84
  case 'phone':
80
85
  return `
81
86
  padding: 0px ${
82
- (document.body.clientWidth - 200 - domtools.breakpoints.phone) / 2
87
+ (document.body.clientWidth - this.sidebarWidth - domtools.breakpoints.phone) / 2
83
88
  }px;
84
89
  `;
85
90
  }
@@ -37,6 +37,9 @@ export class WccProperties extends DeesElement {
37
37
  @property()
38
38
  accessor isNative: boolean = false;
39
39
 
40
+ @property({ type: Number })
41
+ accessor sidebarWidth: number = 200;
42
+
40
43
  @state()
41
44
  accessor propertyContent: TemplateResult[] = [];
42
45
 
@@ -89,7 +92,7 @@ export class WccProperties extends DeesElement {
89
92
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
90
93
  box-sizing: border-box;
91
94
  position: absolute;
92
- left: 200px;
95
+ left: ${this.sidebarWidth}px;
93
96
  height: ${this.editingProperties.length > 0 ? 100 + this.editorHeight : 100}px;
94
97
  bottom: 0px;
95
98
  right: 0px;
@@ -36,6 +36,14 @@ export class WccSidebar extends DeesElement {
36
36
  @property({ attribute: false })
37
37
  accessor pinnedItems: Set<string> = new Set();
38
38
 
39
+ // Sidebar width (resizable)
40
+ @property({ type: Number })
41
+ accessor sidebarWidth: number = 200;
42
+
43
+ // Track if currently resizing
44
+ @state()
45
+ accessor isResizing: boolean = false;
46
+
39
47
  private sectionsInitialized = false;
40
48
 
41
49
  public render(): TemplateResult {
@@ -66,7 +74,7 @@ export class WccSidebar extends DeesElement {
66
74
  box-sizing: border-box;
67
75
  position: absolute;
68
76
  left: 0px;
69
- width: 200px;
77
+ width: ${this.sidebarWidth}px;
70
78
  top: 0px;
71
79
  bottom: 0px;
72
80
  overflow-y: auto;
@@ -167,6 +175,10 @@ export class WccSidebar extends DeesElement {
167
175
  grid-template-columns: 16px 1fr;
168
176
  }
169
177
 
178
+ .selectOption.folder .text {
179
+ margin-left: 4px;
180
+ }
181
+
170
182
  .selectOption .expand-icon {
171
183
  font-size: 14px;
172
184
  opacity: 0.5;
@@ -321,13 +333,17 @@ export class WccSidebar extends DeesElement {
321
333
  opacity: 0.8;
322
334
  }
323
335
 
324
- /* Section tag for pinned items */
336
+ /* Section tag pill for pinned items */
325
337
  .section-tag {
326
- font-size: 0.55rem;
327
- color: #555;
338
+ font-size: 0.5rem;
339
+ color: #888;
328
340
  margin-left: auto;
329
341
  text-transform: uppercase;
330
- letter-spacing: 0.03em;
342
+ letter-spacing: 0.02em;
343
+ background: rgba(255, 255, 255, 0.06);
344
+ padding: 0.15rem 0.4rem;
345
+ border-radius: 9999px;
346
+ white-space: nowrap;
331
347
  }
332
348
 
333
349
  /* Group container */
@@ -352,6 +368,27 @@ export class WccSidebar extends DeesElement {
352
368
  margin-left: 0.25rem;
353
369
  margin-right: 0.25rem;
354
370
  }
371
+
372
+ /* Resize handle */
373
+ .resize-handle {
374
+ position: absolute;
375
+ top: 0;
376
+ right: 0;
377
+ bottom: 0;
378
+ width: 4px;
379
+ cursor: col-resize;
380
+ background: transparent;
381
+ transition: background 0.15s ease;
382
+ z-index: 10;
383
+ }
384
+
385
+ .resize-handle:hover {
386
+ background: rgba(59, 130, 246, 0.3);
387
+ }
388
+
389
+ .resize-handle.active {
390
+ background: var(--primary);
391
+ }
355
392
  </style>
356
393
  <div class="search-container">
357
394
  <input
@@ -366,6 +403,10 @@ export class WccSidebar extends DeesElement {
366
403
  ${this.renderPinnedSection()}
367
404
  ${this.renderSections()}
368
405
  </div>
406
+ <div
407
+ class="resize-handle ${this.isResizing ? 'active' : ''}"
408
+ @mousedown=${this.startResize}
409
+ ></div>
369
410
  `;
370
411
  }
371
412
 
@@ -429,6 +470,7 @@ export class WccSidebar extends DeesElement {
429
470
  const isCollapsed = this.collapsedSections.has('__pinned__');
430
471
 
431
472
  // Collect pinned items with their original section info
473
+ // Pinned items are NOT filtered by search - they always remain visible
432
474
  const pinnedEntries: Array<{ sectionName: string; itemName: string; item: any; section: IWccSection }> = [];
433
475
 
434
476
  for (const key of this.pinnedItems) {
@@ -443,10 +485,7 @@ export class WccSidebar extends DeesElement {
443
485
  }
444
486
  }
445
487
 
446
- // Filter by search
447
- const filteredEntries = pinnedEntries.filter(e => this.matchesSearch(e.itemName));
448
-
449
- if (filteredEntries.length === 0 && this.searchQuery) {
488
+ if (pinnedEntries.length === 0) {
450
489
  return null;
451
490
  }
452
491
 
@@ -460,7 +499,7 @@ export class WccSidebar extends DeesElement {
460
499
  <span>Pinned</span>
461
500
  </div>
462
501
  <div class="section-content ${isCollapsed ? 'collapsed' : ''}">
463
- ${filteredEntries.map(({ sectionName, itemName, item, section }) => {
502
+ ${pinnedEntries.map(({ sectionName, itemName, item, section }) => {
464
503
  const isSelected = this.selectedItem === item;
465
504
  const type = section.type === 'elements' ? 'element' : 'page';
466
505
  const icon = section.type === 'elements' ? 'featured_video' : 'insert_drive_file';
@@ -717,6 +756,51 @@ export class WccSidebar extends DeesElement {
717
756
  }
718
757
  }
719
758
 
759
+ // ============ Resize functionality ============
760
+
761
+ private startResize = (e: MouseEvent) => {
762
+ e.preventDefault();
763
+ this.isResizing = true;
764
+ const startX = e.clientX;
765
+ const startWidth = this.sidebarWidth;
766
+
767
+ // Cache references once at start
768
+ const frame = this.dashboardRef?.shadowRoot?.querySelector('wcc-frame') as any;
769
+ const properties = this.dashboardRef?.shadowRoot?.querySelector('wcc-properties') as any;
770
+
771
+ // Disable frame transition during resize
772
+ if (frame) {
773
+ frame.isResizing = true;
774
+ }
775
+
776
+ const onMouseMove = (e: MouseEvent) => {
777
+ const newWidth = Math.min(400, Math.max(150, startWidth + (e.clientX - startX)));
778
+ this.sidebarWidth = newWidth;
779
+ // Update frame and properties directly
780
+ if (frame) {
781
+ frame.sidebarWidth = newWidth;
782
+ }
783
+ if (properties) {
784
+ properties.sidebarWidth = newWidth;
785
+ }
786
+ };
787
+
788
+ const onMouseUp = () => {
789
+ this.isResizing = false;
790
+ document.removeEventListener('mousemove', onMouseMove);
791
+ document.removeEventListener('mouseup', onMouseUp);
792
+ // Re-enable frame transition
793
+ if (frame) {
794
+ frame.isResizing = false;
795
+ }
796
+ // Dispatch event on release for URL persistence
797
+ this.dispatchEvent(new CustomEvent('widthChanged', { detail: this.sidebarWidth }));
798
+ };
799
+
800
+ document.addEventListener('mousemove', onMouseMove);
801
+ document.addEventListener('mouseup', onMouseUp);
802
+ };
803
+
720
804
  public selectItem(
721
805
  typeArg: TElementType,
722
806
  itemNameArg: string,