@design.estate/dees-wcctools 1.0.97 → 1.0.99

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": "1.0.97",
3
+ "version": "1.0.99",
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": {
package/readme.hints.md CHANGED
@@ -25,9 +25,11 @@ The properties panel had timing issues detecting rendered elements because:
25
25
 
26
26
  ### Code Flow
27
27
  1. Dashboard renders element demo into viewport using `render(anonItem.demo(), viewport)`
28
- 2. Properties panel waits, then searches recursively for the element instance
29
- 3. If not found, retries with delays to handle async rendering
30
- 4. Once found, extracts and displays element properties
28
+ 2. Properties panel waits 200ms for demo wrappers to run and set initial values
29
+ 3. Searches recursively for the element instance
30
+ 4. If not found, retries with delays to handle async rendering
31
+ 5. Once found, extracts and displays element properties
32
+ 6. Uses property binding (`.value=`) instead of attribute binding to prevent input events during initialization
31
33
 
32
34
  ## Demo Tools
33
35
 
package/readme.plan.md CHANGED
@@ -85,4 +85,16 @@ These test various scenarios:
85
85
  - Complex data type display and editing
86
86
  - Element detection inside dees-demowrapper
87
87
  - Error handling for problematic values
88
- - Deep nesting and shadow DOM traversal
88
+ - Deep nesting and shadow DOM traversal
89
+
90
+ # Fixed Demo Value Overwriting (COMPLETED)
91
+
92
+ ## Issue:
93
+ Properties panel was overwriting values set by demo functions
94
+
95
+ ## Solution:
96
+ 1. Changed from attribute binding (`value=`) to property binding (`.value=`)
97
+ 2. This prevents browser from firing input events during initialization
98
+ 3. Added proper number parsing for number inputs
99
+ 4. Increased initial wait to 200ms for demo wrappers to complete
100
+ 5. Simplified select element handling to use property binding
@@ -1,8 +1,8 @@
1
1
  /**
2
- * autocreated commitinfo by @pushrocks/commitinfo
2
+ * autocreated commitinfo by @push.rocks/commitinfo
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-wcctools',
6
- version: '1.0.90',
6
+ version: '1.0.99',
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
  }
@@ -38,6 +38,12 @@ export class WccDashboard extends DeesElement {
38
38
  @property()
39
39
  public warning: string = null;
40
40
 
41
+ @property()
42
+ public frameScrollY: number = 0;
43
+
44
+ @property()
45
+ public sidebarScrollY: number = 0;
46
+
41
47
  @queryAsync('wcc-frame')
42
48
  public wccFrame: Promise<WccFrame>;
43
49
 
@@ -113,6 +119,12 @@ export class WccDashboard extends DeesElement {
113
119
 
114
120
  public async firstUpdated() {
115
121
  this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
122
+
123
+ // Set up scroll listeners after DOM is ready
124
+ setTimeout(() => {
125
+ this.setupScrollListeners();
126
+ }, 500);
127
+
116
128
  this.domtools.router.on(
117
129
  '/wcctools-route/:itemType/:itemName/:viewport/:theme',
118
130
  async (routeInfo) => {
@@ -125,6 +137,25 @@ export class WccDashboard extends DeesElement {
125
137
  } else if (routeInfo.params.itemType === 'page') {
126
138
  this.selectedItem = this.pages[routeInfo.params.itemName];
127
139
  }
140
+
141
+ // Restore scroll positions from query parameters
142
+ if (routeInfo.queryParams) {
143
+ const frameScrollY = routeInfo.queryParams.frameScrollY;
144
+ const sidebarScrollY = routeInfo.queryParams.sidebarScrollY;
145
+
146
+ if (frameScrollY) {
147
+ this.frameScrollY = parseInt(frameScrollY);
148
+ }
149
+ if (sidebarScrollY) {
150
+ this.sidebarScrollY = parseInt(sidebarScrollY);
151
+ }
152
+
153
+ // Apply scroll positions after a short delay to ensure DOM is ready
154
+ setTimeout(() => {
155
+ this.applyScrollPositions();
156
+ }, 100);
157
+ }
158
+
128
159
  const domtoolsInstance = await plugins.deesDomtools.elementBasic.setup();
129
160
  this.selectedTheme === 'bright'
130
161
  ? domtoolsInstance.themeManager.goBright()
@@ -136,7 +167,6 @@ export class WccDashboard extends DeesElement {
136
167
  public async updated(changedPropertiesArg: Map<string, any>) {
137
168
  this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
138
169
  await this.domtools.router._handleRouteState();
139
- const storeElement = this.selectedItem;
140
170
  const wccFrame: WccFrame = this.shadowRoot.querySelector('wcc-frame');
141
171
 
142
172
  if (changedPropertiesArg.has('selectedItemName')) {
@@ -173,8 +203,82 @@ export class WccDashboard extends DeesElement {
173
203
  }
174
204
 
175
205
  public buildUrl() {
176
- this.domtools.router.pushUrl(
177
- `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedViewport}/${this.selectedTheme}`
178
- );
206
+ const baseUrl = `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedViewport}/${this.selectedTheme}`;
207
+ const queryParams = new URLSearchParams();
208
+
209
+ if (this.frameScrollY > 0) {
210
+ queryParams.set('frameScrollY', this.frameScrollY.toString());
211
+ }
212
+ if (this.sidebarScrollY > 0) {
213
+ queryParams.set('sidebarScrollY', this.sidebarScrollY.toString());
214
+ }
215
+
216
+ const queryString = queryParams.toString();
217
+ const fullUrl = queryString ? `${baseUrl}?${queryString}` : baseUrl;
218
+
219
+ this.domtools.router.pushUrl(fullUrl);
220
+ }
221
+
222
+ private scrollUpdateTimeout: NodeJS.Timeout;
223
+
224
+ public async setupScrollListeners() {
225
+ const wccFrame = await this.wccFrame;
226
+ const wccSidebar = this.shadowRoot.querySelector('wcc-sidebar');
227
+
228
+ if (wccFrame) {
229
+ // The frame element itself is the scrollable container
230
+ wccFrame.addEventListener('scroll', () => {
231
+ this.frameScrollY = wccFrame.scrollTop;
232
+ this.debouncedScrollUpdate();
233
+ });
234
+ }
235
+
236
+ if (wccSidebar) {
237
+ // The sidebar element itself is the scrollable container
238
+ wccSidebar.addEventListener('scroll', () => {
239
+ this.sidebarScrollY = wccSidebar.scrollTop;
240
+ this.debouncedScrollUpdate();
241
+ });
242
+ }
243
+ }
244
+
245
+ private debouncedScrollUpdate() {
246
+ clearTimeout(this.scrollUpdateTimeout);
247
+ this.scrollUpdateTimeout = setTimeout(() => {
248
+ this.updateUrlWithScrollState();
249
+ }, 300);
250
+ }
251
+
252
+ private updateUrlWithScrollState() {
253
+ const baseUrl = `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedViewport}/${this.selectedTheme}`;
254
+ const queryParams = new URLSearchParams();
255
+
256
+ if (this.frameScrollY > 0) {
257
+ queryParams.set('frameScrollY', this.frameScrollY.toString());
258
+ }
259
+ if (this.sidebarScrollY > 0) {
260
+ queryParams.set('sidebarScrollY', this.sidebarScrollY.toString());
261
+ }
262
+
263
+ const queryString = queryParams.toString();
264
+ const fullUrl = queryString ? `${baseUrl}?${queryString}` : baseUrl;
265
+
266
+ // Use replaceState to update URL without navigation
267
+ window.history.replaceState(null, '', fullUrl);
268
+ }
269
+
270
+ public async applyScrollPositions() {
271
+ const wccFrame = await this.wccFrame;
272
+ const wccSidebar = this.shadowRoot.querySelector('wcc-sidebar');
273
+
274
+ if (wccFrame && this.frameScrollY > 0) {
275
+ // The frame element itself is the scrollable container
276
+ wccFrame.scrollTop = this.frameScrollY;
277
+ }
278
+
279
+ if (wccSidebar && this.sidebarScrollY > 0) {
280
+ // The sidebar element itself is the scrollable container
281
+ wccSidebar.scrollTop = this.sidebarScrollY;
282
+ }
179
283
  }
180
284
  }
@@ -309,8 +309,8 @@ export class WccProperties extends DeesElement {
309
309
  console.log(anonItem.elementProperties);
310
310
  const wccFrame = await this.dashboardRef.wccFrame;
311
311
 
312
- // Wait for render to complete
313
- await new Promise(resolve => setTimeout(resolve, 100));
312
+ // Wait for render to complete and any demo wrappers to run
313
+ await new Promise(resolve => setTimeout(resolve, 200));
314
314
 
315
315
  // Try to find the element with recursive search
316
316
  const viewport = await wccFrame.getViewportElement();
@@ -370,7 +370,7 @@ export class WccProperties extends DeesElement {
370
370
  case 'String':
371
371
  return html`<input
372
372
  type="text"
373
- value=${firstFoundInstantiatedElement[key]}
373
+ .value=${firstFoundInstantiatedElement[key] || ''}
374
374
  @input="${(eventArg: any) => {
375
375
  firstFoundInstantiatedElement[key] = eventArg.target.value;
376
376
  }}"
@@ -378,14 +378,15 @@ export class WccProperties extends DeesElement {
378
378
  case 'Number':
379
379
  return html`<input
380
380
  type="number"
381
- value=${firstFoundInstantiatedElement[key]}
381
+ .value=${firstFoundInstantiatedElement[key] ?? ''}
382
382
  @input="${(eventArg: any) => {
383
- firstFoundInstantiatedElement[key] = eventArg.target.value;
383
+ firstFoundInstantiatedElement[key] = parseFloat(eventArg.target.value) || 0;
384
384
  }}"
385
385
  />`;
386
386
  case 'Enum':
387
387
  const enumValues: any[] = getEnumValues(property);
388
388
  return html`<select
389
+ .value=${firstFoundInstantiatedElement[key] || ''}
389
390
  @change="${(eventArg: any) => {
390
391
  firstFoundInstantiatedElement[key] = eventArg.target.value;
391
392
  }}"
@@ -393,8 +394,7 @@ export class WccProperties extends DeesElement {
393
394
  ${enumValues.map((valueArg) => {
394
395
  return html`
395
396
  <option
396
- ?selected=${valueArg === firstFoundInstantiatedElement[key] ? true : false}
397
- name="${valueArg}"
397
+ value="${valueArg}"
398
398
  >
399
399
  ${valueArg}
400
400
  </option>