@design.estate/dees-wcctools 1.0.88 → 1.0.91
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/dist_bundle/bundle.js +13932 -6907
- package/dist_bundle/bundle.js.map +4 -4
- package/dist_ts_demotools/demotools.d.ts +7 -0
- package/dist_ts_demotools/demotools.js +50 -0
- package/dist_ts_demotools/index.d.ts +1 -0
- package/dist_ts_demotools/index.js +2 -0
- package/dist_ts_demotools/plugins.d.ts +2 -0
- package/dist_ts_demotools/plugins.js +3 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/elements/wcc-dashboard.d.ts +1 -1
- package/dist_ts_web/elements/wcc-dashboard.js +6 -3
- package/dist_ts_web/elements/wcc-properties.d.ts +1 -0
- package/dist_ts_web/elements/wcc-properties.js +36 -8
- package/dist_watch/bundle.js +38223 -12926
- package/dist_watch/bundle.js.map +4 -4
- package/package.json +13 -10
- package/readme.hints.md +51 -1
- package/readme.plan.md +41 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/elements/wcc-dashboard.ts +5 -2
- package/ts_web/elements/wcc-properties.ts +47 -7
- package/ts_web/tspublish.json +3 -0
package/package.json
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-wcctools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.91",
|
|
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
|
-
"
|
|
7
|
-
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist_ts_web/index.js",
|
|
8
|
+
"./demoTools": "./dist_ts_demotools"
|
|
9
|
+
},
|
|
8
10
|
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "(npm run build)",
|
|
13
|
+
"build": "(tsbuild tsfolders --allowimplicitany && tsbundle element)",
|
|
14
|
+
"watch": "tswatch element",
|
|
15
|
+
"buildDocs": "tsdoc"
|
|
16
|
+
},
|
|
9
17
|
"author": "Lossless GmbH",
|
|
10
18
|
"license": "UNLICENSED",
|
|
11
19
|
"dependencies": {
|
|
@@ -49,10 +57,5 @@
|
|
|
49
57
|
"element testing",
|
|
50
58
|
"page development"
|
|
51
59
|
],
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
"build": "(tsbuild element --web --allowimplicitany && tsbundle element)",
|
|
55
|
-
"watch": "tswatch element",
|
|
56
|
-
"buildDocs": "tsdoc"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
60
|
+
"packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
|
|
61
|
+
}
|
package/readme.hints.md
CHANGED
|
@@ -1 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
# Project Hints and Findings
|
|
2
|
+
|
|
3
|
+
## Properties Panel Element Detection Issue (Fixed)
|
|
4
|
+
|
|
5
|
+
### Problem
|
|
6
|
+
The properties panel had timing issues detecting rendered elements because:
|
|
7
|
+
1. Elements are rendered asynchronously via lit's `render()` function in the dashboard component
|
|
8
|
+
2. The properties panel tried to find elements immediately without waiting for render completion
|
|
9
|
+
3. Element search only looked at direct children of the viewport, missing nested elements or those inside shadow DOM
|
|
10
|
+
|
|
11
|
+
### Solution Implemented
|
|
12
|
+
1. Added a 100ms initial delay to allow render completion
|
|
13
|
+
2. Implemented recursive element search that:
|
|
14
|
+
- Searches through nested children up to 5 levels deep
|
|
15
|
+
- Checks shadow roots of elements
|
|
16
|
+
- Handles complex DOM structures
|
|
17
|
+
3. Added retry mechanism with up to 5 attempts (200ms between retries)
|
|
18
|
+
4. Improved error messages to show retry count
|
|
19
|
+
|
|
20
|
+
### Code Flow
|
|
21
|
+
1. Dashboard renders element demo into viewport using `render(anonItem.demo(), viewport)`
|
|
22
|
+
2. Properties panel waits, then searches recursively for the element instance
|
|
23
|
+
3. If not found, retries with delays to handle async rendering
|
|
24
|
+
4. Once found, extracts and displays element properties
|
|
25
|
+
|
|
26
|
+
## Demo Tools
|
|
27
|
+
|
|
28
|
+
### DeesDemoWrapper Component
|
|
29
|
+
A utility component for wrapping demo elements with post-render functionality.
|
|
30
|
+
|
|
31
|
+
**Usage:**
|
|
32
|
+
```typescript
|
|
33
|
+
import { DeesDemoWrapper } from '@design.estate/dees-wcctools/demoTools';
|
|
34
|
+
|
|
35
|
+
// In your demo function:
|
|
36
|
+
demo: () => html`
|
|
37
|
+
<dees-demowrapper .runAfterRender=${(element) => {
|
|
38
|
+
// Do something with the rendered element
|
|
39
|
+
element.setAttribute('data-demo', 'true');
|
|
40
|
+
console.log('Element rendered:', element);
|
|
41
|
+
}}>
|
|
42
|
+
<my-custom-element></my-custom-element>
|
|
43
|
+
</dees-demowrapper>
|
|
44
|
+
`
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Features:**
|
|
48
|
+
- Wraps demo elements without affecting layout (uses `display: contents`)
|
|
49
|
+
- Provides access to the rendered element instance after mounting
|
|
50
|
+
- Supports async operations in runAfterRender callback
|
|
51
|
+
- Automatically handles timing to ensure element is fully rendered
|
package/readme.plan.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Fix Properties Panel Element Detection (COMPLETED)
|
|
2
|
+
|
|
3
|
+
To fix the element detection issue, reread CLAUDE.md first.
|
|
4
|
+
|
|
5
|
+
## Problem Analysis
|
|
6
|
+
The properties panel has timing issues detecting rendered elements because:
|
|
7
|
+
1. Elements are rendered asynchronously via lit's `render()` in the dashboard
|
|
8
|
+
2. Properties panel tries to find elements immediately without waiting for render completion
|
|
9
|
+
3. Element search only looks at direct children, missing nested/shadow DOM elements
|
|
10
|
+
|
|
11
|
+
## Implementation Plan
|
|
12
|
+
|
|
13
|
+
### 1. Add proper synchronization ✅
|
|
14
|
+
- Add a delay or await render completion before element detection
|
|
15
|
+
- Use MutationObserver or lit's updateComplete promises
|
|
16
|
+
|
|
17
|
+
### 2. Improve element search algorithm ✅
|
|
18
|
+
- Search recursively through all descendants, not just direct children
|
|
19
|
+
- Handle shadow DOM boundaries properly
|
|
20
|
+
- Support elements wrapped in containers
|
|
21
|
+
|
|
22
|
+
### 3. Add retry mechanism ✅
|
|
23
|
+
- If element not found, retry after a delay
|
|
24
|
+
- Add maximum retry attempts to prevent infinite loops
|
|
25
|
+
- Clear error state when element is eventually found
|
|
26
|
+
|
|
27
|
+
## Code Changes Required
|
|
28
|
+
1. Modify `wcc-properties.ts` createProperties() method ✅
|
|
29
|
+
2. Add element search utility function ✅
|
|
30
|
+
3. Improve error handling and user feedback ✅
|
|
31
|
+
|
|
32
|
+
# Demo Wrapper Implementation (COMPLETED)
|
|
33
|
+
|
|
34
|
+
## Created DeesDemoWrapper Component
|
|
35
|
+
- Location: ts_demotools/demotools.ts
|
|
36
|
+
- Allows wrapping demo elements with post-render functionality
|
|
37
|
+
- Provides runAfterRender callback that receives the rendered element
|
|
38
|
+
- Uses display: contents to not affect layout
|
|
39
|
+
- Handles timing automatically with 50ms delay after firstUpdated
|
|
40
|
+
- Supports both sync and async callbacks
|
|
41
|
+
- Exports available at @design.estate/dees-wcctools/demoTools
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@design.estate/dees-wcctools',
|
|
6
|
-
version: '1.0.
|
|
6
|
+
version: '1.0.90',
|
|
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
|
}
|
|
@@ -76,7 +76,6 @@ export class WccDashboard extends DeesElement {
|
|
|
76
76
|
this.selectedType = eventArg.detail;
|
|
77
77
|
}}
|
|
78
78
|
@selectedItemName=${(eventArg) => {
|
|
79
|
-
document.title = eventArg.detail;
|
|
80
79
|
this.selectedItemName = eventArg.detail;
|
|
81
80
|
}}
|
|
82
81
|
@selectedItem=${(eventArg) => {
|
|
@@ -134,12 +133,16 @@ export class WccDashboard extends DeesElement {
|
|
|
134
133
|
);
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
public async updated() {
|
|
136
|
+
public async updated(changedPropertiesArg: Map<string, any>) {
|
|
138
137
|
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
|
|
139
138
|
await this.domtools.router._handleRouteState();
|
|
140
139
|
const storeElement = this.selectedItem;
|
|
141
140
|
const wccFrame: WccFrame = this.shadowRoot.querySelector('wcc-frame');
|
|
142
141
|
|
|
142
|
+
if (changedPropertiesArg.has('selectedItemName')) {
|
|
143
|
+
document.title = this.selectedItemName;
|
|
144
|
+
};
|
|
145
|
+
|
|
143
146
|
if (this.selectedType === 'page' && this.selectedItem) {
|
|
144
147
|
if (typeof this.selectedItem === 'function') {
|
|
145
148
|
console.log('slotting page.');
|
|
@@ -226,6 +226,31 @@ export class WccProperties extends DeesElement {
|
|
|
226
226
|
`;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
private async findElementRecursively(container: Element, elementClass: any, maxDepth: number = 5): Promise<HTMLElement | null> {
|
|
230
|
+
if (maxDepth <= 0) return null;
|
|
231
|
+
|
|
232
|
+
// Check direct children
|
|
233
|
+
for (const child of Array.from(container.children)) {
|
|
234
|
+
if (child instanceof elementClass) {
|
|
235
|
+
return child as HTMLElement;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Check shadow roots of children
|
|
240
|
+
for (const child of Array.from(container.children)) {
|
|
241
|
+
if (child.shadowRoot) {
|
|
242
|
+
const found = await this.findElementRecursively(child.shadowRoot as any, elementClass, maxDepth - 1);
|
|
243
|
+
if (found) return found;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Also check nested children
|
|
247
|
+
const found = await this.findElementRecursively(child, elementClass, maxDepth - 1);
|
|
248
|
+
if (found) return found;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
|
|
229
254
|
public async createProperties() {
|
|
230
255
|
console.log('creating properties for:');
|
|
231
256
|
console.log(this.selectedItem);
|
|
@@ -275,15 +300,30 @@ export class WccProperties extends DeesElement {
|
|
|
275
300
|
}
|
|
276
301
|
console.log(anonItem.elementProperties);
|
|
277
302
|
const wccFrame = await this.dashboardRef.wccFrame;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
303
|
+
|
|
304
|
+
// Wait for render to complete
|
|
305
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
306
|
+
|
|
307
|
+
// Try to find the element with recursive search
|
|
308
|
+
const viewport = await wccFrame.getViewportElement();
|
|
309
|
+
let firstFoundInstantiatedElement: HTMLElement = await this.findElementRecursively(
|
|
310
|
+
viewport,
|
|
311
|
+
this.selectedItem as any
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
// Retry logic if element not found
|
|
315
|
+
let retries = 0;
|
|
316
|
+
while (!firstFoundInstantiatedElement && retries < 5) {
|
|
317
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
318
|
+
firstFoundInstantiatedElement = await this.findElementRecursively(
|
|
319
|
+
viewport,
|
|
320
|
+
this.selectedItem as any
|
|
321
|
+
);
|
|
322
|
+
retries++;
|
|
284
323
|
}
|
|
324
|
+
|
|
285
325
|
if (!firstFoundInstantiatedElement) {
|
|
286
|
-
this.warning = `no first instantiated element found for >>${anonItem.name}
|
|
326
|
+
this.warning = `no first instantiated element found for >>${anonItem.name}<< after ${retries} retries`;
|
|
287
327
|
return;
|
|
288
328
|
}
|
|
289
329
|
const classProperties: Map<string, any> = anonItem.elementProperties;
|