@mhmo91/schmancy 0.5.46 → 0.5.47

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.
Files changed (53) hide show
  1. package/ai/content-drawer.md +22 -11
  2. package/ai/sheet.md +32 -47
  3. package/dist/ai/content-drawer.md +22 -11
  4. package/dist/ai/sheet.md +32 -47
  5. package/dist/area.component-DAPQYHtN.cjs.map +1 -1
  6. package/dist/area.component-DUGxsL2-.js.map +1 -1
  7. package/dist/{avatar-CcHlQTbR.js → avatar-hoEk1kwv.js} +28 -40
  8. package/dist/avatar-hoEk1kwv.js.map +1 -0
  9. package/dist/{avatar-D93Sjal-.cjs → avatar-hzSHTXXv.cjs} +8 -8
  10. package/dist/avatar-hzSHTXXv.cjs.map +1 -0
  11. package/dist/badge.cjs +1 -1
  12. package/dist/badge.js +1 -1
  13. package/dist/content-drawer.cjs +1 -1
  14. package/dist/content-drawer.js +1 -1
  15. package/dist/{email-recipients-C-5ER5TU.js → email-recipients-DPpv0qRr.js} +4 -4
  16. package/dist/email-recipients-DPpv0qRr.js.map +1 -0
  17. package/dist/{email-recipients-DRxGI7gT.cjs → email-recipients-Uogc-X_3.cjs} +3 -3
  18. package/dist/email-recipients-Uogc-X_3.cjs.map +1 -0
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +4 -4
  21. package/dist/mailbox.cjs +1 -1
  22. package/dist/mailbox.js +1 -1
  23. package/dist/nav-drawer.cjs +1 -1
  24. package/dist/nav-drawer.js +1 -1
  25. package/dist/navigation-bar.cjs +1 -1
  26. package/dist/navigation-bar.js +1 -1
  27. package/dist/{sheet-vJ5lJw8A.cjs → sheet-CcVGEdfr.cjs} +10 -6
  28. package/dist/sheet-CcVGEdfr.cjs.map +1 -0
  29. package/dist/{sheet-PXddkPIR.js → sheet-D5-XmZs5.js} +36 -28
  30. package/dist/sheet-D5-XmZs5.js.map +1 -0
  31. package/dist/sheet.cjs +1 -1
  32. package/dist/sheet.js +2 -2
  33. package/dist/sheet.service-C66WNur0.js +80 -0
  34. package/dist/sheet.service-C66WNur0.js.map +1 -0
  35. package/dist/sheet.service-iUShtJp1.cjs +2 -0
  36. package/dist/sheet.service-iUShtJp1.cjs.map +1 -0
  37. package/dist/teleport.cjs +1 -1
  38. package/dist/teleport.js +1 -1
  39. package/package.json +1 -1
  40. package/types/src/area/router.types.d.ts +5 -1
  41. package/types/src/content-drawer/drawer.service.d.ts +2 -6
  42. package/types/src/mailbox/email-editor.d.ts +1 -1
  43. package/types/src/sheet/sheet.service.d.ts +2 -11
  44. package/dist/avatar-CcHlQTbR.js.map +0 -1
  45. package/dist/avatar-D93Sjal-.cjs.map +0 -1
  46. package/dist/email-recipients-C-5ER5TU.js.map +0 -1
  47. package/dist/email-recipients-DRxGI7gT.cjs.map +0 -1
  48. package/dist/sheet-PXddkPIR.js.map +0 -1
  49. package/dist/sheet-vJ5lJw8A.cjs.map +0 -1
  50. package/dist/sheet.service-BxvWBGsJ.cjs +0 -2
  51. package/dist/sheet.service-BxvWBGsJ.cjs.map +0 -1
  52. package/dist/sheet.service-lXqUf6n5.js +0 -87
  53. package/dist/sheet.service-lXqUf6n5.js.map +0 -1
@@ -10,18 +10,18 @@ import { schmancyContentDrawer } from '@schmancy/content-drawer'
10
10
 
11
11
  ### `push(options)`
12
12
 
13
- Push a component to the drawer. Automatically resolves different component types.
13
+ Push a component to the drawer. Component types are passed directly to the area router - no resolution happens in the drawer service.
14
14
 
15
15
  **Parameters:**
16
16
 
17
17
  - `options: ComponentType | DrawerPushOptions`
18
18
 
19
- **ComponentType formats:**
19
+ **ComponentType formats (matches area router API):**
20
20
 
21
21
  - `string` - HTML tag name (e.g., `'demo-button'`)
22
22
  - `HTMLElement` - Component instance (e.g., `new MyComponent()`)
23
- - `() => HTMLElement` - Factory function
24
- - `() => Promise<{default: any}>` - Async import
23
+ - `CustomElementConstructor` - Component class (e.g., `UserDetails`)
24
+ - `LazyComponent<any>` - Lazy import (e.g., `lazy(() => import('./my-component'))`)
25
25
 
26
26
  **DrawerPushOptions object:**
27
27
 
@@ -43,17 +43,18 @@ schmancyContentDrawer.push('demo-button')
43
43
  // HTMLElement instance
44
44
  schmancyContentDrawer.push(new UserDetail())
45
45
 
46
+ // Component class (constructor)
47
+ schmancyContentDrawer.push(UserDetails)
48
+
46
49
  // With options object (recommended)
47
50
  schmancyContentDrawer.push({
48
- component: new UserDetail(),
51
+ component: UserDetails,
49
52
  props: { userId: '123' }
50
53
  })
51
54
 
52
- // Factory function
53
- schmancyContentDrawer.push(() => new MyComponent())
54
-
55
- // Async import
56
- schmancyContentDrawer.push(() => import('./my-component'))
55
+ // Lazy import
56
+ import { lazy } from '@schmancy/area'
57
+ schmancyContentDrawer.push(lazy(() => import('./my-component')))
57
58
  ```
58
59
 
59
60
  ### `render(ref, component, title?)`
@@ -100,6 +101,15 @@ schmancyContentDrawer.dimiss(window)
100
101
  - `open: 'open' | 'close'` - Auto-managed based on mode
101
102
  - `mode: 'push' | 'overlay'` - Auto-switches at 936px breakpoint
102
103
 
104
+ ## How It Works
105
+
106
+ The drawer service is a simple passthrough to the area router:
107
+
108
+ 1. **Push mode (desktop)**: Calls `area.push()` with your component
109
+ 2. **Overlay mode (mobile)**: Calls `sheet.open()` with your component
110
+
111
+ Component resolution is handled entirely by the area router - the drawer service just dispatches events.
112
+
103
113
  ## Example
104
114
 
105
115
  ```typescript
@@ -109,8 +119,9 @@ html`
109
119
  <schmancy-list>
110
120
  ${items.map(item => html`
111
121
  <schmancy-list-item @click=${() => {
122
+ // Pass component class directly - area router handles instantiation
112
123
  schmancyContentDrawer.push({
113
- component: new ItemDetail(),
124
+ component: ItemDetail,
114
125
  props: { item }
115
126
  })
116
127
  }}>
package/ai/sheet.md CHANGED
@@ -2,10 +2,7 @@
2
2
 
3
3
  The sheet component provides a sliding panel overlay that can be used for forms, details views, or any content that needs to be displayed in a drawer-style interface.
4
4
 
5
- **Important Note about Templates**: The sheet service now only accepts HTMLElement components. If you're using Lit's `html` template literals, you need to either:
6
- 1. Create a wrapper element and use innerHTML (for simple content)
7
- 2. Create a custom element class (for complex interactions)
8
- 3. Use the `render` function from Lit to render into a container element
5
+ **Component Resolution**: The sheet service uses the area router for component resolution, supporting the same component types as `area.push()` and `schmancyContentDrawer.push()`.
9
6
 
10
7
  ```js
11
8
  // Import Options
@@ -14,17 +11,22 @@ import { sheet, $sheet } from '@schmancy/index';
14
11
 
15
12
  // Sheet Service API
16
13
  $sheet.open({
17
- component: HTMLElement, // Content to display (must be an HTMLElement)
14
+ component: ComponentType, // Component to display (same types as area router)
18
15
  uid?: string, // Unique identifier for the sheet
19
16
  position?: 'side' | 'bottom', // Position (default: responsive based on screen size)
20
17
  persist?: boolean, // Keep sheet in DOM after closing (default: false)
21
18
  close?: () => void, // Callback when sheet closes
22
19
  lock?: boolean, // Prevent dismissal via ESC/overlay click (default: false)
23
- handleHistory?: boolean, // Integrate with browser back button (default: true)
24
- title?: string, // Sheet title
25
- header?: 'hidden' | 'visible' // Header visibility (default: 'visible')
20
+ onBeforeOpen?: (component: HTMLElement) => void, // Called before sheet opens
21
+ onAfterOpen?: (component: HTMLElement) => void // Called after sheet opens
26
22
  }) -> void
27
23
 
24
+ // ComponentType (matches area router):
25
+ // - string - HTML tag name (e.g., 'my-element')
26
+ // - HTMLElement - Component instance (e.g., new MyElement())
27
+ // - CustomElementConstructor - Component class (e.g., MyElement)
28
+ // - LazyComponent<any> - Lazy import (e.g., lazy(() => import('./my-element')))
29
+
28
30
  // Service Methods
29
31
  $sheet.dismiss(uid?: string) // Close specific sheet or most recent if no uid
30
32
  $sheet.isOpen(uid: string) // Check if a sheet is open
@@ -45,9 +47,9 @@ SchmancySheetPosition.Bottom // Bottom sheet (mobile)
45
47
  title="Sheet Title"
46
48
  header="visible|hidden"
47
49
  @close=${handleClose}>
48
-
49
- <!-- Main content goes in default slot -->
50
- <div>Sheet content goes here</div>
50
+
51
+ <!-- Content managed by area router -->
52
+ <!-- Use sheet.open() to push components -->
51
53
  </schmancy-sheet>
52
54
 
53
55
  // Sheet Header Component
@@ -59,49 +61,32 @@ SchmancySheetPosition.Bottom // Bottom sheet (mobile)
59
61
 
60
62
  // Examples
61
63
 
62
- // 1. Basic Sheet with Form - Using a wrapper element for template content
64
+ // 1. HTMLElement Instance (backward compatible)
63
65
  const formContent = document.createElement('div');
64
66
  formContent.className = 'p-6';
65
- formContent.innerHTML = `
66
- <schmancy-typography type="headline" token="md" class="mb-4">
67
- User Details
68
- </schmancy-typography>
69
- <schmancy-form>
70
- <schmancy-input label="Name" value="John Doe"></schmancy-input>
71
- <schmancy-input label="Email" value="john@example.com"></schmancy-input>
72
- <schmancy-button type="submit">Save</schmancy-button>
73
- </schmancy-form>
74
- `;
67
+ formContent.innerHTML = '<h1>User Details</h1>';
68
+ $sheet.open({ component: formContent });
75
69
 
76
- $sheet.open({
77
- component: formContent,
78
- title: "Edit User"
79
- });
70
+ // 2. Component Class (NEW!)
71
+ class UserDetails extends HTMLElement {
72
+ connectedCallback() {
73
+ this.innerHTML = '<div>User details content</div>';
74
+ }
75
+ }
76
+ customElements.define('user-details', UserDetails);
77
+ $sheet.open({ component: UserDetails });
78
+
79
+ // 3. String Tag (NEW!)
80
+ $sheet.open({ component: 'user-details' });
80
81
 
81
- // 2. Using HTMLElement Component
82
- const myComponent = document.createElement('my-custom-element');
82
+ // 4. Lazy Import (NEW!)
83
+ import { lazy } from '@schmancy/area';
83
84
  $sheet.open({
84
- component: myComponent,
85
- uid: 'my-custom-element', // Will reuse existing sheet if already open
86
- persist: true, // Keep in DOM after closing
87
- title: "Custom Component"
85
+ component: lazy(() => import('./components/user-details')),
86
+ uid: 'user-details-sheet'
88
87
  });
89
88
 
90
- // 3. Sheet with Lock (using Lit render for interactive content)
91
- import { render, html } from 'lit';
92
-
93
- const lockContent = document.createElement('div');
94
- render(html`
95
- <div class="p-6">
96
- <schmancy-typography type="body" token="lg">
97
- This action requires confirmation. Please complete the form.
98
- </schmancy-typography>
99
- <schmancy-button @click=${() => $sheet.dismiss()}>
100
- Complete Action
101
- </schmancy-button>
102
- </div>
103
- `, lockContent);
104
-
89
+ // 5. With Options
105
90
  $sheet.open({
106
91
  component: lockContent,
107
92
  lock: true,
@@ -10,18 +10,18 @@ import { schmancyContentDrawer } from '@schmancy/content-drawer'
10
10
 
11
11
  ### `push(options)`
12
12
 
13
- Push a component to the drawer. Automatically resolves different component types.
13
+ Push a component to the drawer. Component types are passed directly to the area router - no resolution happens in the drawer service.
14
14
 
15
15
  **Parameters:**
16
16
 
17
17
  - `options: ComponentType | DrawerPushOptions`
18
18
 
19
- **ComponentType formats:**
19
+ **ComponentType formats (matches area router API):**
20
20
 
21
21
  - `string` - HTML tag name (e.g., `'demo-button'`)
22
22
  - `HTMLElement` - Component instance (e.g., `new MyComponent()`)
23
- - `() => HTMLElement` - Factory function
24
- - `() => Promise<{default: any}>` - Async import
23
+ - `CustomElementConstructor` - Component class (e.g., `UserDetails`)
24
+ - `LazyComponent<any>` - Lazy import (e.g., `lazy(() => import('./my-component'))`)
25
25
 
26
26
  **DrawerPushOptions object:**
27
27
 
@@ -43,17 +43,18 @@ schmancyContentDrawer.push('demo-button')
43
43
  // HTMLElement instance
44
44
  schmancyContentDrawer.push(new UserDetail())
45
45
 
46
+ // Component class (constructor)
47
+ schmancyContentDrawer.push(UserDetails)
48
+
46
49
  // With options object (recommended)
47
50
  schmancyContentDrawer.push({
48
- component: new UserDetail(),
51
+ component: UserDetails,
49
52
  props: { userId: '123' }
50
53
  })
51
54
 
52
- // Factory function
53
- schmancyContentDrawer.push(() => new MyComponent())
54
-
55
- // Async import
56
- schmancyContentDrawer.push(() => import('./my-component'))
55
+ // Lazy import
56
+ import { lazy } from '@schmancy/area'
57
+ schmancyContentDrawer.push(lazy(() => import('./my-component')))
57
58
  ```
58
59
 
59
60
  ### `render(ref, component, title?)`
@@ -100,6 +101,15 @@ schmancyContentDrawer.dimiss(window)
100
101
  - `open: 'open' | 'close'` - Auto-managed based on mode
101
102
  - `mode: 'push' | 'overlay'` - Auto-switches at 936px breakpoint
102
103
 
104
+ ## How It Works
105
+
106
+ The drawer service is a simple passthrough to the area router:
107
+
108
+ 1. **Push mode (desktop)**: Calls `area.push()` with your component
109
+ 2. **Overlay mode (mobile)**: Calls `sheet.open()` with your component
110
+
111
+ Component resolution is handled entirely by the area router - the drawer service just dispatches events.
112
+
103
113
  ## Example
104
114
 
105
115
  ```typescript
@@ -109,8 +119,9 @@ html`
109
119
  <schmancy-list>
110
120
  ${items.map(item => html`
111
121
  <schmancy-list-item @click=${() => {
122
+ // Pass component class directly - area router handles instantiation
112
123
  schmancyContentDrawer.push({
113
- component: new ItemDetail(),
124
+ component: ItemDetail,
114
125
  props: { item }
115
126
  })
116
127
  }}>
package/dist/ai/sheet.md CHANGED
@@ -2,10 +2,7 @@
2
2
 
3
3
  The sheet component provides a sliding panel overlay that can be used for forms, details views, or any content that needs to be displayed in a drawer-style interface.
4
4
 
5
- **Important Note about Templates**: The sheet service now only accepts HTMLElement components. If you're using Lit's `html` template literals, you need to either:
6
- 1. Create a wrapper element and use innerHTML (for simple content)
7
- 2. Create a custom element class (for complex interactions)
8
- 3. Use the `render` function from Lit to render into a container element
5
+ **Component Resolution**: The sheet service uses the area router for component resolution, supporting the same component types as `area.push()` and `schmancyContentDrawer.push()`.
9
6
 
10
7
  ```js
11
8
  // Import Options
@@ -14,17 +11,22 @@ import { sheet, $sheet } from '@schmancy/index';
14
11
 
15
12
  // Sheet Service API
16
13
  $sheet.open({
17
- component: HTMLElement, // Content to display (must be an HTMLElement)
14
+ component: ComponentType, // Component to display (same types as area router)
18
15
  uid?: string, // Unique identifier for the sheet
19
16
  position?: 'side' | 'bottom', // Position (default: responsive based on screen size)
20
17
  persist?: boolean, // Keep sheet in DOM after closing (default: false)
21
18
  close?: () => void, // Callback when sheet closes
22
19
  lock?: boolean, // Prevent dismissal via ESC/overlay click (default: false)
23
- handleHistory?: boolean, // Integrate with browser back button (default: true)
24
- title?: string, // Sheet title
25
- header?: 'hidden' | 'visible' // Header visibility (default: 'visible')
20
+ onBeforeOpen?: (component: HTMLElement) => void, // Called before sheet opens
21
+ onAfterOpen?: (component: HTMLElement) => void // Called after sheet opens
26
22
  }) -> void
27
23
 
24
+ // ComponentType (matches area router):
25
+ // - string - HTML tag name (e.g., 'my-element')
26
+ // - HTMLElement - Component instance (e.g., new MyElement())
27
+ // - CustomElementConstructor - Component class (e.g., MyElement)
28
+ // - LazyComponent<any> - Lazy import (e.g., lazy(() => import('./my-element')))
29
+
28
30
  // Service Methods
29
31
  $sheet.dismiss(uid?: string) // Close specific sheet or most recent if no uid
30
32
  $sheet.isOpen(uid: string) // Check if a sheet is open
@@ -45,9 +47,9 @@ SchmancySheetPosition.Bottom // Bottom sheet (mobile)
45
47
  title="Sheet Title"
46
48
  header="visible|hidden"
47
49
  @close=${handleClose}>
48
-
49
- <!-- Main content goes in default slot -->
50
- <div>Sheet content goes here</div>
50
+
51
+ <!-- Content managed by area router -->
52
+ <!-- Use sheet.open() to push components -->
51
53
  </schmancy-sheet>
52
54
 
53
55
  // Sheet Header Component
@@ -59,49 +61,32 @@ SchmancySheetPosition.Bottom // Bottom sheet (mobile)
59
61
 
60
62
  // Examples
61
63
 
62
- // 1. Basic Sheet with Form - Using a wrapper element for template content
64
+ // 1. HTMLElement Instance (backward compatible)
63
65
  const formContent = document.createElement('div');
64
66
  formContent.className = 'p-6';
65
- formContent.innerHTML = `
66
- <schmancy-typography type="headline" token="md" class="mb-4">
67
- User Details
68
- </schmancy-typography>
69
- <schmancy-form>
70
- <schmancy-input label="Name" value="John Doe"></schmancy-input>
71
- <schmancy-input label="Email" value="john@example.com"></schmancy-input>
72
- <schmancy-button type="submit">Save</schmancy-button>
73
- </schmancy-form>
74
- `;
67
+ formContent.innerHTML = '<h1>User Details</h1>';
68
+ $sheet.open({ component: formContent });
75
69
 
76
- $sheet.open({
77
- component: formContent,
78
- title: "Edit User"
79
- });
70
+ // 2. Component Class (NEW!)
71
+ class UserDetails extends HTMLElement {
72
+ connectedCallback() {
73
+ this.innerHTML = '<div>User details content</div>';
74
+ }
75
+ }
76
+ customElements.define('user-details', UserDetails);
77
+ $sheet.open({ component: UserDetails });
78
+
79
+ // 3. String Tag (NEW!)
80
+ $sheet.open({ component: 'user-details' });
80
81
 
81
- // 2. Using HTMLElement Component
82
- const myComponent = document.createElement('my-custom-element');
82
+ // 4. Lazy Import (NEW!)
83
+ import { lazy } from '@schmancy/area';
83
84
  $sheet.open({
84
- component: myComponent,
85
- uid: 'my-custom-element', // Will reuse existing sheet if already open
86
- persist: true, // Keep in DOM after closing
87
- title: "Custom Component"
85
+ component: lazy(() => import('./components/user-details')),
86
+ uid: 'user-details-sheet'
88
87
  });
89
88
 
90
- // 3. Sheet with Lock (using Lit render for interactive content)
91
- import { render, html } from 'lit';
92
-
93
- const lockContent = document.createElement('div');
94
- render(html`
95
- <div class="p-6">
96
- <schmancy-typography type="body" token="lg">
97
- This action requires confirmation. Please complete the form.
98
- </schmancy-typography>
99
- <schmancy-button @click=${() => $sheet.dismiss()}>
100
- Complete Action
101
- </schmancy-button>
102
- </div>
103
- `, lockContent);
104
-
89
+ // 5. With Options
105
90
  $sheet.open({
106
91
  component: lockContent,
107
92
  lock: true,