@design.estate/dees-wcctools 1.0.91 โ†’ 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVtb3Rvb2xzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfZGVtb3Rvb2xzL2RlbW90b29scy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLGFBQWEsRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLFFBQVEsRUFBdUIsTUFBTS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FDLEtBQUssQ0FBQywwQkFBMEIsRUFBRSxLQUFLLENBQUMsQ0FBQztZQUNuRCxDQUFDO1FBQ0gsQ0FBQztJQUNILENBQUM7O0FBaENNO0lBRE4sUUFBUSxDQUFDLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxDQUFDOzt1REFDMkM7QUFGL0QsZUFBZTtJQUQzQixhQUFhLENBQUMsa0JBQWtCLENBQUM7R0FDckIsZUFBZSxDQW1DM0IifQ==
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@design.estate/dees-wcctools",
3
- "version": "1.0.91",
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
@@ -1,101 +1,368 @@
1
1
  # @design.estate/dees-wcctools
2
- wcc tools for creating element catalogues
2
+ Web Component Development Tools - A powerful framework for building, testing, and documenting web components
3
3
 
4
- ## Install
5
- To install `@design.estate/dees-wcctools`, you can use npm:
4
+ ## Overview
5
+ `@design.estate/dees-wcctools` provides a comprehensive development environment for web components, featuring:
6
+ - ๐ŸŽจ Interactive component catalogue with live preview
7
+ - ๐Ÿ”ง Real-time property editing
8
+ - ๐ŸŒ“ Theme switching (light/dark modes)
9
+ - ๐Ÿ“ฑ Responsive viewport testing
10
+ - ๐Ÿงช Advanced demo tools for component testing
11
+ - ๐Ÿš€ Zero-config setup with TypeScript and Lit support
12
+
13
+ ## Installation
6
14
 
7
15
  ```bash
8
- npm install @design.estate/dees-wcctools --save
16
+ # Using npm
17
+ npm install @design.estate/dees-wcctools --save-dev
18
+
19
+ # Using pnpm (recommended)
20
+ pnpm add -D @design.estate/dees-wcctools
9
21
  ```
10
22
 
11
- ## Usage
12
- The `@design.estate/dees-wcctools` package provides a set of tools for creating element catalogues using Web Components. It leverages LitElement for creating custom elements and provides a structured way to showcase and test these elements in various environments and themes.
23
+ ## Quick Start
13
24
 
14
- ### Setting Up
15
- First, ensure that your project is set up to use TypeScript and ESM syntax. This guide assumes you have a basic understanding of TypeScript and modern JavaScript development practices.
25
+ ### 1. Create Your Component
16
26
 
17
- Start by importing the necessary tools from `@design.estate/dees-wcctools` in your main TypeScript file.
27
+ ```typescript
28
+ import { DeesElement, customElement, html, css, property } from '@design.estate/dees-element';
29
+
30
+ @customElement('my-button')
31
+ export class MyButton extends DeesElement {
32
+ // Define a demo for the catalogue
33
+ public static demo = () => html`
34
+ <my-button .label=${'Click me!'} .variant=${'primary'}></my-button>
35
+ `;
36
+
37
+ @property({ type: String })
38
+ public label: string = 'Button';
39
+
40
+ @property({ type: String })
41
+ public variant: 'primary' | 'secondary' = 'primary';
42
+
43
+ public static styles = [
44
+ css`
45
+ :host {
46
+ display: inline-block;
47
+ }
48
+ button {
49
+ padding: 8px 16px;
50
+ border-radius: 4px;
51
+ border: none;
52
+ font-size: 14px;
53
+ cursor: pointer;
54
+ transition: all 0.3s;
55
+ }
56
+ button.primary {
57
+ background: #007bff;
58
+ color: white;
59
+ }
60
+ button.secondary {
61
+ background: #6c757d;
62
+ color: white;
63
+ }
64
+ button:hover {
65
+ opacity: 0.9;
66
+ }
67
+ `
68
+ ];
69
+
70
+ public render() {
71
+ return html`
72
+ <button class="${this.variant}">
73
+ ${this.label}
74
+ </button>
75
+ `;
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### 2. Set Up Your Catalogue
18
81
 
19
82
  ```typescript
83
+ // catalogue.ts
20
84
  import { setupWccTools } from '@design.estate/dees-wcctools';
85
+ import { html } from 'lit';
86
+
87
+ // Import your components
88
+ import './components/my-button.js';
89
+ import './components/my-card.js';
90
+
91
+ // Define elements for the catalogue
92
+ const elements = {
93
+ 'my-button': MyButton,
94
+ 'my-card': MyCard,
95
+ };
96
+
97
+ // Optionally define pages
98
+ const pages = {
99
+ 'home': () => html`
100
+ <div style="padding: 20px;">
101
+ <h1>Welcome to My Component Library</h1>
102
+ <p>Browse components using the sidebar.</p>
103
+ </div>
104
+ `,
105
+ 'getting-started': () => html`
106
+ <div style="padding: 20px;">
107
+ <h2>Getting Started</h2>
108
+ <p>Installation and usage instructions...</p>
109
+ </div>
110
+ `,
111
+ };
112
+
113
+ // Initialize the catalogue
114
+ setupWccTools(elements, pages);
21
115
  ```
22
116
 
23
- ### Defining Custom Elements
24
- Define your custom elements using LitElement. Here's a simple example of an element:
117
+ ### 3. Create an HTML Entry Point
118
+
119
+ ```html
120
+ <!DOCTYPE html>
121
+ <html>
122
+ <head>
123
+ <title>Component Catalogue</title>
124
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
125
+ </head>
126
+ <body style="margin: 0; padding: 0;">
127
+ <script type="module" src="./catalogue.js"></script>
128
+ </body>
129
+ </html>
130
+ ```
25
131
 
26
- ```typescript
27
- import { LitElement, html, customElement } from 'lit';
132
+ ## Features
28
133
 
29
- @customElement('my-element')
30
- class MyElement extends LitElement {
31
- render() {
32
- return html`<p>Hello, world!</p>`;
33
- }
134
+ ### ๐ŸŽฏ Live Property Editing
135
+ The properties panel automatically detects and allows editing of:
136
+ - **String** properties with text inputs
137
+ - **Number** properties with number inputs
138
+ - **Boolean** properties with checkboxes
139
+ - **Enum** properties with select dropdowns
140
+ - **Object** and **Array** properties (read-only display)
141
+
142
+ ### ๐Ÿ“ฑ Viewport Testing
143
+ Test your components across different screen sizes:
144
+ - **Phone** (320px width)
145
+ - **Phablet** (600px width)
146
+ - **Tablet** (768px width)
147
+ - **Desktop** (full width)
148
+
149
+ ### ๐ŸŒ“ Theme Support
150
+ Components automatically adapt to light/dark themes using the `goBright` property:
151
+
152
+ ```typescript
153
+ public render() {
154
+ return html`
155
+ <div class="${this.goBright ? 'light-theme' : 'dark-theme'}">
156
+ <!-- Your component content -->
157
+ </div>
158
+ `;
34
159
  }
35
160
  ```
36
161
 
37
- ### Bootstrapping the WCCTools Dashboard
38
- To showcase your elements, `@design.estate/dees-wcctools` provides a handy way to bootstrap a dashboard where your elements can be registered and displayed.
162
+ Or use CSS custom properties:
163
+ ```typescript
164
+ import { cssManager } from '@design.estate/dees-element';
165
+
166
+ public static styles = [
167
+ css`
168
+ :host {
169
+ color: ${cssManager.bdTheme('#000', '#fff')};
170
+ background: ${cssManager.bdTheme('#fff', '#000')};
171
+ }
172
+ `
173
+ ];
174
+ ```
175
+
176
+ ### ๐Ÿงช Advanced Demo Tools
39
177
 
40
- Create a bootstrap function in your main file or a separate module:
178
+ The demo tools provide enhanced testing capabilities:
41
179
 
42
180
  ```typescript
43
- async function bootstrapWCCTools() {
44
- // Define your elements here
45
- const elements = {
46
- 'my-element': MyElement, // Assuming MyElement is imported
47
- };
48
-
49
- // Optionally, define pages as functions returning Lit HTML Templates
50
- const pages = {
51
- home: () => html`<h1>Welcome to My Element Catalogue</h1>`,
52
- };
53
-
54
- // Setup the WCCTools dashboard
55
- setupWccTools(elements, pages);
181
+ import * as demoTools from '@design.estate/dees-wcctools/demotools';
182
+
183
+ @customElement('my-component')
184
+ export class MyComponent extends DeesElement {
185
+ public static demo = () => html`
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);
193
+
194
+ // Simulate user interactions
195
+ myComponent.value = 'Test value';
196
+ await myComponent.updateComplete;
197
+
198
+ // Trigger methods
199
+ myComponent.handleClick();
200
+
201
+ // Work with multiple elements if present
202
+ Array.from(children).forEach((child, index) => {
203
+ console.log(`Child ${index}:`, child.tagName);
204
+ });
205
+ }}>
206
+ <my-component></my-component>
207
+ <div>Additional content</div>
208
+ </dees-demowrapper>
209
+ `;
56
210
  }
57
211
  ```
58
212
 
59
- Call this function to initialize your catalogue:
213
+ ### ๐ŸŽญ Container Queries Support
214
+
215
+ Components can respond to their container size:
216
+
217
+ ```typescript
218
+ public static styles = [
219
+ css`
220
+ @container wccToolsViewport (min-width: 768px) {
221
+ :host {
222
+ flex-direction: row;
223
+ }
224
+ }
225
+
226
+ @container wccToolsViewport (max-width: 767px) {
227
+ :host {
228
+ flex-direction: column;
229
+ }
230
+ }
231
+ `
232
+ ];
233
+ ```
234
+
235
+ ## Component Guidelines
60
236
 
237
+ ### Required for Catalogue Display
238
+ 1. Components must expose a static `demo` property returning a Lit template
239
+ 2. Use `@property()` decorators for properties you want to be editable
240
+ 3. Export component classes for proper detection
241
+
242
+ ### Best Practices
61
243
  ```typescript
62
- bootstrapWCCTools();
244
+ @customElement('best-practice-component')
245
+ export class BestPracticeComponent extends DeesElement {
246
+ // โœ… Static demo property
247
+ public static demo = () => html`
248
+ <best-practice-component
249
+ .complexProp=${{ key: 'value' }}
250
+ simpleAttribute="test"
251
+ ></best-practice-component>
252
+ `;
253
+
254
+ // โœ… Typed properties with defaults
255
+ @property({ type: String })
256
+ public title: string = 'Default Title';
257
+
258
+ // โœ… Complex property without attribute
259
+ @property({ attribute: false })
260
+ public complexProp: { key: string } = { key: 'default' };
261
+
262
+ // โœ… Enum with proper typing
263
+ @property({ type: String })
264
+ public variant: 'small' | 'medium' | 'large' = 'medium';
265
+ }
266
+ ```
267
+
268
+ ## URL Routing
269
+
270
+ The catalogue uses URL routing for deep linking:
63
271
  ```
272
+ /wcctools-route/:type/:name/:viewport/:theme
64
273
 
65
- ### Configurations and Customizations
66
- The `setupWccTools` function accepts two arguments: `elements` and `pages`.
274
+ Example:
275
+ /wcctools-route/element/my-button/desktop/dark
276
+ /wcctools-route/page/home/tablet/bright
277
+ ```
67
278
 
68
- - `elements`: An object where keys are element tags (e.g., 'my-element') and values are the corresponding class definitions.
69
- - `pages`: An optional object where keys are page identifiers and values are functions returning Lit HTML templates.
279
+ ## Development Workflow
70
280
 
71
- ### Testing Elements
72
- Once the dashboard is set up, navigate to your project in a web browser. You'll see a sidebar listing all registered elements and pages. Clicking on an element name will display it in the main view, allowing you to interact with it and see it in action.
281
+ ### Build and Watch
282
+ ```json
283
+ {
284
+ "scripts": {
285
+ "build": "tsbuild tsfolders --allowimplicitany && tsbundle element",
286
+ "watch": "tswatch element",
287
+ "serve": "http-server ./dist"
288
+ }
289
+ }
290
+ ```
291
+
292
+ ### Project Structure
293
+ ```
294
+ my-components/
295
+ โ”œโ”€โ”€ src/
296
+ โ”‚ โ”œโ”€โ”€ components/
297
+ โ”‚ โ”‚ โ”œโ”€โ”€ my-button.ts
298
+ โ”‚ โ”‚ โ””โ”€โ”€ my-card.ts
299
+ โ”‚ โ””โ”€โ”€ catalogue.ts
300
+ โ”œโ”€โ”€ dist/
301
+ โ”œโ”€โ”€ index.html
302
+ โ””โ”€โ”€ package.json
303
+ ```
73
304
 
74
- ### Theme and Environment Testing
75
- The dashboard also provides options for testing your elements in different environments (e.g., desktop, tablet) and themes (light or dark). This helps ensure that your elements are versatile and adaptable to varying conditions.
305
+ ## Advanced Features
76
306
 
77
- ### Expanding Your Catalogue
78
- To add more elements to your catalogue, simply extend the `elements` object and rerun `bootstrapWCCTools()`. This modular approach makes it easy to maintain and expand your element catalogue.
307
+ ### Custom Property Handlers
308
+ For complex property types, implement custom logic in your demo:
79
309
 
80
- ### Leveraging TypeScript
81
- Using TypeScript allows you to enforce typing and build more reliable web components. Define properties with decorators, and use TypeScript's features to enhance your component development process.
310
+ ```typescript
311
+ 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) => {
316
+ console.log('Property changed:', e.detail);
317
+ });
318
+ });
319
+ }}>
320
+ <my-component></my-component>
321
+ </dees-demowrapper>
322
+ `;
323
+ ```
82
324
 
325
+ ### Responsive Testing Helpers
83
326
  ```typescript
84
- import { LitElement, property, html, customElement } from 'lit';
327
+ import * as domtools from '@design.estate/dees-domtools';
85
328
 
86
- @customElement('typed-element')
87
- class TypedElement extends LitElement {
88
- @property({type: String})
89
- name: string = 'World';
329
+ public static styles = [
330
+ // Media query helpers
331
+ domtools.breakpoints.cssForPhone(css`
332
+ :host { font-size: 14px; }
333
+ `),
90
334
 
91
- render() {
92
- return html`<p>Hello, ${this.name}!</p>`;
93
- }
94
- }
335
+ domtools.breakpoints.cssForTablet(css`
336
+ :host { font-size: 16px; }
337
+ `),
338
+
339
+ domtools.breakpoints.cssForDesktop(css`
340
+ :host { font-size: 18px; }
341
+ `)
342
+ ];
95
343
  ```
96
344
 
97
- ### Conclusion
98
- `@design.estate/dees-wcctools` provides a powerful, flexible platform for developing, showcasing, and testing web components. By leveraging modern development practices like TypeScript and LitElement, you can build a robust catalogue of reusable web components ready for any project.
345
+ ## API Reference
346
+
347
+ ### setupWccTools(elements, pages?)
348
+ Initialize the WCC Tools dashboard.
349
+
350
+ - `elements`: Object mapping element names to element classes
351
+ - `pages`: Optional object mapping page names to template functions
352
+
353
+ ### DeesDemoWrapper
354
+ Component for wrapping demos with post-render logic.
355
+
356
+ - `runAfterRender`: Function called after the wrapped elements render
357
+ - Receives the complete HTMLCollection of all slotted elements
358
+ - Supports async operations
359
+ - Access individual elements via array index or Array.from()
360
+
361
+ ## Browser Support
362
+ - Chrome/Edge (latest)
363
+ - Firefox (latest)
364
+ - Safari (latest)
365
+ - Mobile browsers with Web Components support
99
366
 
100
367
  ## License and Legal Information
101
368
 
@@ -114,4 +381,4 @@ Registered at District court Bremen HRB 35230 HB, Germany
114
381
 
115
382
  For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
116
383
 
117
- By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
384
+ By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
package/readme.plan.md CHANGED
@@ -34,8 +34,29 @@ 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
+
43
+ # Documentation Update (COMPLETED)
44
+
45
+ ## Updated readme.md with:
46
+ - Comprehensive overview with feature highlights
47
+ - Quick start guide with code examples
48
+ - Detailed feature documentation
49
+ - Advanced demo tools usage
50
+ - Best practices and guidelines
51
+ - API reference
52
+ - Browser support information
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