@design.estate/dees-wcctools 1.0.94 → 1.0.95

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: (children: HTMLCollection) => void | Promise<void>;
3
+ runAfterRender: (wrapperElement: DeesDemoWrapper) => void | Promise<void>;
4
4
  static styles: import("@design.estate/dees-element").CSSResult[];
5
5
  render(): TemplateResult;
6
6
  firstUpdated(): Promise<void>;
@@ -25,12 +25,13 @@ 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
- // Get all slotted elements
29
- const slottedElements = this.children;
30
- if (slottedElements.length > 0 && this.runAfterRender) {
31
- // Call the runAfterRender function with all slotted elements
28
+ // Check if there are slotted elements and runAfterRender is defined
29
+ if (this.children.length > 0 && this.runAfterRender) {
30
+ // Call the runAfterRender function with the wrapper element itself
31
+ // Note: querySelector/querySelectorAll will work on slotted content
32
+ // because slotted elements remain in the light DOM as children
32
33
  try {
33
- await this.runAfterRender(slottedElements);
34
+ await this.runAfterRender(this);
34
35
  }
35
36
  catch (error) {
36
37
  console.error('Error in runAfterRender:', error);
@@ -46,4 +47,4 @@ DeesDemoWrapper = __decorate([
46
47
  customElement('dees-demowrapper')
47
48
  ], DeesDemoWrapper);
48
49
  export { DeesDemoWrapper };
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVtb3Rvb2xzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfZGVtb3Rvb2xzL2RlbW90b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsV0FBVy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0FBQyxLQUFLLENBQUMsMEJBQTBCLEVBQUUsS0FBSyxDQUFDLENBQUM7WUFDbkQsQ0FBQztRQUNILENBQUM7SUFDSCxDQUFDOztBQWpDTTtJQUROLFFBQVEsQ0FBQyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQUUsQ0FBQzs7dURBQ2tEO0FBRnRFLGVBQWU7SUFEM0IsYUFBYSxDQUFDLGtCQUFrQixDQUFDO0dBQ3JCLGVBQWUsQ0FvQzNCIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-wcctools",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
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": {
@@ -8,12 +8,6 @@
8
8
  "./demotools": "./dist_ts_demotools"
9
9
  },
10
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
- },
17
11
  "author": "Lossless GmbH",
18
12
  "license": "UNLICENSED",
19
13
  "dependencies": {
@@ -57,5 +51,10 @@
57
51
  "element testing",
58
52
  "page development"
59
53
  ],
60
- "packageManager": "pnpm@10.11.0+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
61
- }
54
+ "scripts": {
55
+ "test": "(npm run build)",
56
+ "build": "(tsbuild tsfolders --allowimplicitany && tsbundle element)",
57
+ "watch": "tswatch element",
58
+ "buildDocs": "tsdoc"
59
+ }
60
+ }
package/readme.hints.md CHANGED
@@ -34,16 +34,22 @@ 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=${(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);
37
+ <dees-demowrapper .runAfterRender=${(wrapper) => {
38
+ // Use querySelector for specific elements
39
+ const myElement = wrapper.querySelector('my-custom-element');
40
+ myElement?.setAttribute('data-demo', 'true');
42
41
 
43
- // Work with multiple elements
44
- Array.from(children).forEach(child => {
45
- console.log('Element rendered:', child);
42
+ // Access all children
43
+ console.log('All children:', wrapper.children);
44
+
45
+ // Use querySelectorAll for multiple elements
46
+ wrapper.querySelectorAll('div').forEach(div => {
47
+ console.log('Found div:', div);
46
48
  });
49
+
50
+ // Full DOM API available
51
+ const firstChild = wrapper.firstElementChild;
52
+ const hasClass = wrapper.querySelector('.my-class');
47
53
  }}>
48
54
  <my-custom-element></my-custom-element>
49
55
  <div>Additional content</div>
@@ -53,7 +59,8 @@ demo: () => html`
53
59
 
54
60
  **Features:**
55
61
  - Wraps demo elements without affecting layout (uses `display: contents`)
56
- - Provides access to ALL slotted elements via HTMLCollection after mounting
62
+ - Provides the wrapper element itself with full DOM API access
63
+ - Use querySelector/querySelectorAll for powerful element selection
64
+ - Access children via wrapper.children property
57
65
  - Supports async operations in runAfterRender callback
58
- - Automatically handles timing to ensure elements are fully rendered
59
- - Can handle multiple slotted elements, not just the first one
66
+ - Automatically handles timing to ensure elements are fully rendered
package/readme.md CHANGED
@@ -183,23 +183,24 @@ import * as demoTools from '@design.estate/dees-wcctools/demotools';
183
183
  @customElement('my-component')
184
184
  export class MyComponent extends DeesElement {
185
185
  public static demo = () => html`
186
- <dees-demowrapper .runAfterRender=${async (children: HTMLCollection) => {
187
- // Access all slotted elements
188
- console.log('Slotted elements:', children.length);
186
+ <dees-demowrapper .runAfterRender=${async (wrapper) => {
187
+ // Use querySelector to find specific elements
188
+ const myComponent = wrapper.querySelector('my-component') as MyComponent;
189
+ console.log('Component found:', myComponent);
189
190
 
190
- // Access specific element (e.g., first child)
191
- const myComponent = children[0] as MyComponent;
192
- console.log('Component mounted:', myComponent);
191
+ // Access all children via wrapper.children
192
+ console.log('Total children:', wrapper.children.length);
193
+
194
+ // Use querySelectorAll for multiple elements
195
+ const allDivs = wrapper.querySelectorAll('div');
196
+ console.log('Found divs:', allDivs.length);
193
197
 
194
198
  // Simulate user interactions
195
199
  myComponent.value = 'Test value';
196
200
  await myComponent.updateComplete;
197
201
 
198
- // Trigger methods
199
- myComponent.handleClick();
200
-
201
- // Work with multiple elements if present
202
- Array.from(children).forEach((child, index) => {
202
+ // Work with all children
203
+ Array.from(wrapper.children).forEach((child, index) => {
203
204
  console.log(`Child ${index}:`, child.tagName);
204
205
  });
205
206
  }}>
@@ -309,12 +310,18 @@ For complex property types, implement custom logic in your demo:
309
310
 
310
311
  ```typescript
311
312
  public static demo = () => html`
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) => {
313
+ <dees-demowrapper .runAfterRender=${(wrapper) => {
314
+ // Use querySelector to target specific elements
315
+ const component = wrapper.querySelector('my-component');
316
+ if (component) {
317
+ component.addEventListener('property-change', (e) => {
316
318
  console.log('Property changed:', e.detail);
317
319
  });
320
+ }
321
+
322
+ // Or handle all elements of a type
323
+ wrapper.querySelectorAll('my-component').forEach(el => {
324
+ el.addEventListener('click', () => console.log('Clicked!'));
318
325
  });
319
326
  }}>
320
327
  <my-component></my-component>
@@ -354,9 +361,10 @@ Initialize the WCC Tools dashboard.
354
361
  Component for wrapping demos with post-render logic.
355
362
 
356
363
  - `runAfterRender`: Function called after the wrapped elements render
357
- - Receives the complete HTMLCollection of all slotted elements
364
+ - Receives the wrapper element itself, providing full DOM API access
365
+ - Use `wrapper.querySelector()` and `wrapper.querySelectorAll()` for element selection
366
+ - Access children via `wrapper.children` property
358
367
  - Supports async operations
359
- - Access individual elements via array index or Array.from()
360
368
 
361
369
  ## Browser Support
362
370
  - Chrome/Edge (latest)
package/readme.plan.md CHANGED
@@ -55,8 +55,10 @@ The properties panel has timing issues detecting rendered elements because:
55
55
  # Enhanced DemoWrapper (COMPLETED)
56
56
 
57
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
58
+ - Now receives the wrapper element itself instead of just children
59
+ - Provides full DOM API access (querySelector, querySelectorAll, etc.)
60
+ - querySelector works on slotted content (light DOM children)
61
+ - Access children via wrapper.children property
60
62
  - 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
63
+ - Examples show how to use querySelector for powerful element selection
64
+ - Added clarifying comment about querySelector working on slotted content