@design.estate/dees-wcctools 1.0.92 → 1.0.94
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_ts_demotools/demotools.d.ts +1 -1
- package/dist_ts_demotools/demotools.js +4 -5
- package/package.json +2 -2
- package/readme.hints.md +15 -7
- package/readme.md +25 -17
- package/readme.plan.md +12 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DeesElement, type TemplateResult } from '@design.estate/dees-element';
|
|
2
2
|
export declare class DeesDemoWrapper extends DeesElement {
|
|
3
|
-
runAfterRender: (
|
|
3
|
+
runAfterRender: (children: HTMLCollection) => void | Promise<void>;
|
|
4
4
|
static styles: import("@design.estate/dees-element").CSSResult[];
|
|
5
5
|
render(): TemplateResult;
|
|
6
6
|
firstUpdated(): Promise<void>;
|
|
@@ -25,13 +25,12 @@ let DeesDemoWrapper = class DeesDemoWrapper extends DeesElement {
|
|
|
25
25
|
await this.updateComplete;
|
|
26
26
|
// Wait a bit for slotted content to render
|
|
27
27
|
await new Promise(resolve => setTimeout(resolve, 50));
|
|
28
|
-
//
|
|
28
|
+
// Get all slotted elements
|
|
29
29
|
const slottedElements = this.children;
|
|
30
30
|
if (slottedElements.length > 0 && this.runAfterRender) {
|
|
31
|
-
|
|
32
|
-
// Call the runAfterRender function with the element
|
|
31
|
+
// Call the runAfterRender function with all slotted elements
|
|
33
32
|
try {
|
|
34
|
-
await this.runAfterRender(
|
|
33
|
+
await this.runAfterRender(slottedElements);
|
|
35
34
|
}
|
|
36
35
|
catch (error) {
|
|
37
36
|
console.error('Error in runAfterRender:', error);
|
|
@@ -47,4 +46,4 @@ DeesDemoWrapper = __decorate([
|
|
|
47
46
|
customElement('dees-demowrapper')
|
|
48
47
|
], DeesDemoWrapper);
|
|
49
48
|
export { DeesDemoWrapper };
|
|
50
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJza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ztZQUNuRCxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7O0FBaENNO0lBRE4sUUFBUSxDQUFDLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxDQUFDOzt1REFDMkM7QUFGL0QsZUFBZTtJQUQzQixhQUFhLENBQUMsa0JBQWtCLENBQUM7R0FDckIsZUFBZSxDQW1DM0IifQ==
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design.estate/dees-wcctools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.94",
|
|
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": {
|
|
7
7
|
".": "./dist_ts_web/index.js",
|
|
8
|
-
"./
|
|
8
|
+
"./demotools": "./dist_ts_demotools"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"scripts": {
|
package/readme.hints.md
CHANGED
|
@@ -30,22 +30,30 @@ A utility component for wrapping demo elements with post-render functionality.
|
|
|
30
30
|
|
|
31
31
|
**Usage:**
|
|
32
32
|
```typescript
|
|
33
|
-
import
|
|
33
|
+
import * as demoTools from '@design.estate/dees-wcctools/demotools';
|
|
34
34
|
|
|
35
35
|
// In your demo function:
|
|
36
36
|
demo: () => html`
|
|
37
|
-
<dees-demowrapper .runAfterRender=${(
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
<dees-demowrapper .runAfterRender=${(children: HTMLCollection) => {
|
|
38
|
+
// Access all slotted elements
|
|
39
|
+
const firstElement = children[0] as HTMLElement;
|
|
40
|
+
firstElement.setAttribute('data-demo', 'true');
|
|
41
|
+
console.log('All slotted elements:', children);
|
|
42
|
+
|
|
43
|
+
// Work with multiple elements
|
|
44
|
+
Array.from(children).forEach(child => {
|
|
45
|
+
console.log('Element rendered:', child);
|
|
46
|
+
});
|
|
41
47
|
}}>
|
|
42
48
|
<my-custom-element></my-custom-element>
|
|
49
|
+
<div>Additional content</div>
|
|
43
50
|
</dees-demowrapper>
|
|
44
51
|
`
|
|
45
52
|
```
|
|
46
53
|
|
|
47
54
|
**Features:**
|
|
48
55
|
- Wraps demo elements without affecting layout (uses `display: contents`)
|
|
49
|
-
- Provides access to
|
|
56
|
+
- Provides access to ALL slotted elements via HTMLCollection after mounting
|
|
50
57
|
- Supports async operations in runAfterRender callback
|
|
51
|
-
- Automatically handles timing to ensure
|
|
58
|
+
- Automatically handles timing to ensure elements are fully rendered
|
|
59
|
+
- Can handle multiple slotted elements, not just the first one
|
package/readme.md
CHANGED
|
@@ -178,28 +178,33 @@ public static styles = [
|
|
|
178
178
|
The demo tools provide enhanced testing capabilities:
|
|
179
179
|
|
|
180
180
|
```typescript
|
|
181
|
-
import * as demoTools from '@design.estate/dees-wcctools/
|
|
181
|
+
import * as demoTools from '@design.estate/dees-wcctools/demotools';
|
|
182
182
|
|
|
183
183
|
@customElement('my-component')
|
|
184
184
|
export class MyComponent extends DeesElement {
|
|
185
185
|
public static demo = () => html`
|
|
186
|
-
<dees-demowrapper .runAfterRender=${async (
|
|
187
|
-
// Access
|
|
188
|
-
console.log('
|
|
186
|
+
<dees-demowrapper .runAfterRender=${async (children: HTMLCollection) => {
|
|
187
|
+
// Access all slotted elements
|
|
188
|
+
console.log('Slotted elements:', children.length);
|
|
189
|
+
|
|
190
|
+
// Access specific element (e.g., first child)
|
|
191
|
+
const myComponent = children[0] as MyComponent;
|
|
192
|
+
console.log('Component mounted:', myComponent);
|
|
189
193
|
|
|
190
194
|
// Simulate user interactions
|
|
191
|
-
|
|
192
|
-
await
|
|
195
|
+
myComponent.value = 'Test value';
|
|
196
|
+
await myComponent.updateComplete;
|
|
193
197
|
|
|
194
198
|
// Trigger methods
|
|
195
|
-
|
|
199
|
+
myComponent.handleClick();
|
|
196
200
|
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
console.log(
|
|
200
|
-
}
|
|
201
|
+
// Work with multiple elements if present
|
|
202
|
+
Array.from(children).forEach((child, index) => {
|
|
203
|
+
console.log(`Child ${index}:`, child.tagName);
|
|
204
|
+
});
|
|
201
205
|
}}>
|
|
202
206
|
<my-component></my-component>
|
|
207
|
+
<div>Additional content</div>
|
|
203
208
|
</dees-demowrapper>
|
|
204
209
|
`;
|
|
205
210
|
}
|
|
@@ -304,10 +309,12 @@ For complex property types, implement custom logic in your demo:
|
|
|
304
309
|
|
|
305
310
|
```typescript
|
|
306
311
|
public static demo = () => html`
|
|
307
|
-
<dees-demowrapper .runAfterRender=${(
|
|
308
|
-
// Set up complex property handling
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
<dees-demowrapper .runAfterRender=${(children) => {
|
|
313
|
+
// Set up complex property handling for all children
|
|
314
|
+
Array.from(children).forEach(child => {
|
|
315
|
+
child.addEventListener('property-change', (e) => {
|
|
316
|
+
console.log('Property changed:', e.detail);
|
|
317
|
+
});
|
|
311
318
|
});
|
|
312
319
|
}}>
|
|
313
320
|
<my-component></my-component>
|
|
@@ -346,9 +353,10 @@ Initialize the WCC Tools dashboard.
|
|
|
346
353
|
### DeesDemoWrapper
|
|
347
354
|
Component for wrapping demos with post-render logic.
|
|
348
355
|
|
|
349
|
-
- `runAfterRender`: Function called after the wrapped
|
|
350
|
-
- Receives the
|
|
356
|
+
- `runAfterRender`: Function called after the wrapped elements render
|
|
357
|
+
- Receives the complete HTMLCollection of all slotted elements
|
|
351
358
|
- Supports async operations
|
|
359
|
+
- Access individual elements via array index or Array.from()
|
|
352
360
|
|
|
353
361
|
## Browser Support
|
|
354
362
|
- Chrome/Edge (latest)
|
package/readme.plan.md
CHANGED
|
@@ -34,11 +34,11 @@ The properties panel has timing issues detecting rendered elements because:
|
|
|
34
34
|
## Created DeesDemoWrapper Component
|
|
35
35
|
- Location: ts_demotools/demotools.ts
|
|
36
36
|
- Allows wrapping demo elements with post-render functionality
|
|
37
|
-
- Provides runAfterRender callback that receives
|
|
37
|
+
- Provides runAfterRender callback that receives ALL slotted elements as HTMLCollection
|
|
38
38
|
- Uses display: contents to not affect layout
|
|
39
39
|
- Handles timing automatically with 50ms delay after firstUpdated
|
|
40
40
|
- Supports both sync and async callbacks
|
|
41
|
-
- Exports available at @design.estate/dees-wcctools/
|
|
41
|
+
- Exports available at @design.estate/dees-wcctools/demotools (lowercase)
|
|
42
42
|
|
|
43
43
|
# Documentation Update (COMPLETED)
|
|
44
44
|
|
|
@@ -50,4 +50,13 @@ The properties panel has timing issues detecting rendered elements because:
|
|
|
50
50
|
- Best practices and guidelines
|
|
51
51
|
- API reference
|
|
52
52
|
- Browser support information
|
|
53
|
-
- Complete examples for all major features
|
|
53
|
+
- Complete examples for all major features
|
|
54
|
+
|
|
55
|
+
# Enhanced DemoWrapper (COMPLETED)
|
|
56
|
+
|
|
57
|
+
## Modified runAfterRender callback:
|
|
58
|
+
- Now receives HTMLCollection of ALL slotted elements instead of just the first one
|
|
59
|
+
- Allows access to complete slotted DOM structure
|
|
60
|
+
- Updated documentation with correct import path (lowercase 'demotools')
|
|
61
|
+
- Examples show how to work with multiple slotted elements
|
|
62
|
+
- Maintains backward compatibility by accessing elements via index
|