@classic-homes/theme-svelte 1.16.0 → 1.18.0
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/__tests__/alert-dialog-dismiss.test.js +54 -0
- package/dist/__tests__/dropdown-trigger.test.js +39 -0
- package/dist/__tests__/sidebar-docs-parity.test.js +134 -0
- package/dist/__tests__/sidebar-items.test.js +59 -0
- package/dist/__tests__/sidebar-mobile.test.js +13 -0
- package/dist/lib/components/AlertDialog.svelte +19 -2
- package/dist/lib/components/Button.svelte +1 -31
- package/dist/lib/components/Button.svelte.d.ts +9 -6
- package/dist/lib/components/DropdownMenu.svelte +35 -1
- package/dist/lib/components/DropdownMenu.svelte.d.ts +13 -0
- package/dist/lib/components/button-variants.d.ts +119 -0
- package/dist/lib/components/button-variants.js +29 -0
- package/dist/lib/components/layout/DashboardLayout.svelte +44 -12
- package/dist/lib/components/layout/DashboardLayout.svelte.d.ts +4 -0
- package/dist/lib/components/layout/Sidebar.svelte +38 -25
- package/dist/lib/components/layout/Sidebar.svelte.d.ts +5 -0
- package/dist/lib/components/layout/sidebar/SidebarFlyout.svelte +54 -32
- package/dist/lib/components/layout/sidebar/SidebarNavItem.svelte +68 -37
- package/dist/lib/components/layout/sidebar/SidebarNavItem.svelte.d.ts +5 -0
- package/dist/lib/components/layout/sidebar/SidebarSection.svelte +21 -4
- package/dist/lib/components/layout/sidebar/SidebarSection.svelte.d.ts +4 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/stores/sidebar.svelte.d.ts +10 -4
- package/dist/lib/stores/sidebar.svelte.js +25 -4
- package/package.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
// Core UI Components
|
|
10
10
|
export { default as Button } from './components/Button.svelte';
|
|
11
|
+
export { buttonVariants } from './components/button-variants.js';
|
|
11
12
|
export { default as Input } from './components/Input.svelte';
|
|
12
13
|
export { default as PasswordInput } from './components/PasswordInput.svelte';
|
|
13
14
|
export { default as Label } from './components/Label.svelte';
|
|
@@ -13,6 +13,12 @@ declare class SidebarStore {
|
|
|
13
13
|
expandedSections: Set<string>;
|
|
14
14
|
expandedItems: Set<string>;
|
|
15
15
|
pinnedItems: Set<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Whether expand/collapse should animate. False until the frame after `initialize`,
|
|
18
|
+
* so restoring saved sections (and any defaults or reveals applied on mount) appears
|
|
19
|
+
* at once instead of every section sliding open on each page load.
|
|
20
|
+
*/
|
|
21
|
+
animate: boolean;
|
|
16
22
|
/**
|
|
17
23
|
* Whether the store has been initialized
|
|
18
24
|
*/
|
|
@@ -59,13 +65,13 @@ declare class SidebarStore {
|
|
|
59
65
|
*/
|
|
60
66
|
setMobile(isMobile: boolean): void;
|
|
61
67
|
/**
|
|
62
|
-
* Toggle section expansion state
|
|
68
|
+
* Toggle section expansion state. When expanding, sections in `collapseOnExpand` close.
|
|
63
69
|
*/
|
|
64
|
-
toggleSection(sectionId: string): void;
|
|
70
|
+
toggleSection(sectionId: string, collapseOnExpand?: string[]): void;
|
|
65
71
|
/**
|
|
66
|
-
* Toggle item expansion state
|
|
72
|
+
* Toggle item expansion state. When expanding, items in `collapseOnExpand` close.
|
|
67
73
|
*/
|
|
68
|
-
toggleItem(itemId: string): void;
|
|
74
|
+
toggleItem(itemId: string, collapseOnExpand?: string[]): void;
|
|
69
75
|
/**
|
|
70
76
|
* Check if a section is expanded
|
|
71
77
|
*/
|
|
@@ -27,6 +27,12 @@ class SidebarStore {
|
|
|
27
27
|
this.expandedSections = $state(new Set());
|
|
28
28
|
this.expandedItems = $state(new Set());
|
|
29
29
|
this.pinnedItems = $state(new Set());
|
|
30
|
+
/**
|
|
31
|
+
* Whether expand/collapse should animate. False until the frame after `initialize`,
|
|
32
|
+
* so restoring saved sections (and any defaults or reveals applied on mount) appears
|
|
33
|
+
* at once instead of every section sliding open on each page load.
|
|
34
|
+
*/
|
|
35
|
+
this.animate = $state(false);
|
|
30
36
|
_SidebarStore_initialized.set(this, false);
|
|
31
37
|
_SidebarStore_loadedFromStorage.set(this, false);
|
|
32
38
|
_SidebarStore_loadedExpansionFromStorage.set(this, false);
|
|
@@ -114,6 +120,13 @@ class SidebarStore {
|
|
|
114
120
|
catch {
|
|
115
121
|
// localStorage not available
|
|
116
122
|
}
|
|
123
|
+
// Two frames: effects that apply defaults run after this one, before the next paint.
|
|
124
|
+
if (typeof requestAnimationFrame === 'function') {
|
|
125
|
+
requestAnimationFrame(() => requestAnimationFrame(() => (this.animate = true)));
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.animate = true;
|
|
129
|
+
}
|
|
117
130
|
}
|
|
118
131
|
/**
|
|
119
132
|
* Get the current app ID
|
|
@@ -160,29 +173,37 @@ class SidebarStore {
|
|
|
160
173
|
}
|
|
161
174
|
}
|
|
162
175
|
/**
|
|
163
|
-
* Toggle section expansion state
|
|
176
|
+
* Toggle section expansion state. When expanding, sections in `collapseOnExpand` close.
|
|
164
177
|
*/
|
|
165
|
-
toggleSection(sectionId) {
|
|
178
|
+
toggleSection(sectionId, collapseOnExpand = []) {
|
|
166
179
|
const newSet = new Set(this.expandedSections);
|
|
167
180
|
if (newSet.has(sectionId)) {
|
|
168
181
|
newSet.delete(sectionId);
|
|
169
182
|
}
|
|
170
183
|
else {
|
|
171
184
|
newSet.add(sectionId);
|
|
185
|
+
// Accordion behaviour: opening one closes these (its siblings)
|
|
186
|
+
for (const id of collapseOnExpand)
|
|
187
|
+
if (id !== sectionId)
|
|
188
|
+
newSet.delete(id);
|
|
172
189
|
}
|
|
173
190
|
this.expandedSections = newSet;
|
|
174
191
|
__classPrivateFieldGet(this, _SidebarStore_instances, "m", _SidebarStore_persistExpansion).call(this);
|
|
175
192
|
}
|
|
176
193
|
/**
|
|
177
|
-
* Toggle item expansion state
|
|
194
|
+
* Toggle item expansion state. When expanding, items in `collapseOnExpand` close.
|
|
178
195
|
*/
|
|
179
|
-
toggleItem(itemId) {
|
|
196
|
+
toggleItem(itemId, collapseOnExpand = []) {
|
|
180
197
|
const newSet = new Set(this.expandedItems);
|
|
181
198
|
if (newSet.has(itemId)) {
|
|
182
199
|
newSet.delete(itemId);
|
|
183
200
|
}
|
|
184
201
|
else {
|
|
185
202
|
newSet.add(itemId);
|
|
203
|
+
// Accordion behaviour: opening one closes these (its siblings)
|
|
204
|
+
for (const id of collapseOnExpand)
|
|
205
|
+
if (id !== itemId)
|
|
206
|
+
newSet.delete(id);
|
|
186
207
|
}
|
|
187
208
|
this.expandedItems = newSet;
|
|
188
209
|
__classPrivateFieldGet(this, _SidebarStore_instances, "m", _SidebarStore_persistExpansion).call(this);
|