@design.estate/dees-wcctools 1.0.92 → 1.0.93

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.
@@ -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: (element: HTMLElement) => void | Promise<void>;
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
- // Find the first element child (excluding text nodes)
28
+ // Get all slotted elements
29
29
  const slottedElements = this.children;
30
30
  if (slottedElements.length > 0 && this.runAfterRender) {
31
- const firstElement = slottedElements[0];
32
- // Call the runAfterRender function with the element
31
+ // Call the runAfterRender function with all slotted elements
33
32
  try {
34
- await this.runAfterRender(firstElement);
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVtb3Rvb2xzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfZGVtb3Rvb2xzL2RlbW90b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLGFBQWEsRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLFFBQVEsRUFBdUIsTUFBTSw2Qk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tBQUssQ0FBQywwQkFBMEIsRUFBRSxLQUFLLENBQUMsQ0FBQztZQUNuRCxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7O0FBaENNO0lBRE4sUUFBUSxDQUFDLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxDQUFDOzt1REFDMkM7QUFGL0QsZUFBZTtJQUQzQixhQUFhLENBQUMsa0JBQWtCLENBQUM7R0FDckIsZUFBZSxDQW1DM0IifQ==
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@design.estate/dees-wcctools",
3
- "version": "1.0.92",
3
+ "version": "1.0.93",
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
- "./demoTools": "./dist_ts_demotools"
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 { DeesDemoWrapper } from '@design.estate/dees-wcctools/demoTools';
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=${(element) => {
38
- // Do something with the rendered element
39
- element.setAttribute('data-demo', 'true');
40
- console.log('Element rendered:', element);
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 the rendered element instance after mounting
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 element is fully rendered
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/demoTools';
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 (element: MyComponent) => {
187
- // Access the rendered component instance
188
- console.log('Component mounted:', element);
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
- element.value = 'Test value';
192
- await element.updateComplete;
195
+ myComponent.value = 'Test value';
196
+ await myComponent.updateComplete;
193
197
 
194
198
  // Trigger methods
195
- element.handleClick();
199
+ myComponent.handleClick();
196
200
 
197
- // Assert component state
198
- if (element.isValid) {
199
- console.log('Component validation passed');
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=${(el) => {
308
- // Set up complex property handling
309
- el.addEventListener('property-change', (e) => {
310
- console.log('Property changed:', e.detail);
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 element renders
350
- - Receives the first child element as parameter
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 the rendered element
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/demoTools
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