feat(demo): add DeesDemoWrapper component for enhanced demo element handling

This commit is contained in:
Juergen Kunz
2025-06-16 13:18:13 +00:00
parent 6bdb8c78b7
commit 05934132a7
7 changed files with 99 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# Fix Properties Panel Element Detection
# Fix Properties Panel Element Detection (COMPLETED)
To fix the element detection issue, reread CLAUDE.md first.
@ -10,21 +10,32 @@ The properties panel has timing issues detecting rendered elements because:
## Implementation Plan
### 1. Add proper synchronization
### 1. Add proper synchronization
- Add a delay or await render completion before element detection
- Use MutationObserver or lit's updateComplete promises
### 2. Improve element search algorithm
### 2. Improve element search algorithm
- Search recursively through all descendants, not just direct children
- Handle shadow DOM boundaries properly
- Support elements wrapped in containers
### 3. Add retry mechanism
### 3. Add retry mechanism
- If element not found, retry after a delay
- Add maximum retry attempts to prevent infinite loops
- Clear error state when element is eventually found
## Code Changes Required
1. Modify `wcc-properties.ts` createProperties() method
2. Add element search utility function
3. Improve error handling and user feedback
1. Modify `wcc-properties.ts` createProperties() method
2. Add element search utility function
3. Improve error handling and user feedback
# Demo Wrapper Implementation (COMPLETED)
## Created DeesDemoWrapper Component
- Location: ts_demotools/demotools.ts
- Allows wrapping demo elements with post-render functionality
- Provides runAfterRender callback that receives the rendered element
- Uses display: contents to not affect layout
- Handles timing automatically with 50ms delay after firstUpdated
- Supports both sync and async callbacks
- Exports available at @design.estate/dees-wcctools/demoTools