@dfosco/storyboard-core 2.6.0 → 2.7.1
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/package.json
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<script lang="ts">
|
|
12
12
|
import { buildPrototypeIndex } from '../../viewfinder.js'
|
|
13
|
+
import { getLocal, setLocal } from '../../localStorage.js'
|
|
13
14
|
import Octicon from './Octicon.svelte'
|
|
14
15
|
|
|
15
16
|
interface Props {
|
|
@@ -77,15 +78,24 @@
|
|
|
77
78
|
const sortedProtos = $derived(prototypeIndex.sorted?.[sortBy]?.prototypes ?? ungroupedProtos)
|
|
78
79
|
const sortedFolders = $derived(prototypeIndex.sorted?.[sortBy]?.folders ?? folders)
|
|
79
80
|
|
|
80
|
-
// Expanded state —
|
|
81
|
-
|
|
81
|
+
// Expanded state — persisted in localStorage
|
|
82
|
+
const EXPANDED_KEY = 'viewfinder.expanded'
|
|
83
|
+
|
|
84
|
+
function loadExpanded(): Record<string, boolean> {
|
|
85
|
+
const raw = getLocal(EXPANDED_KEY)
|
|
86
|
+
if (!raw) return {}
|
|
87
|
+
try { return JSON.parse(raw) } catch { return {} }
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let expanded: Record<string, boolean> = $state(loadExpanded())
|
|
82
91
|
|
|
83
92
|
function isExpanded(dirName: string): boolean {
|
|
84
|
-
return expanded[dirName] ??
|
|
93
|
+
return expanded[dirName] ?? false
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
function toggle(dirName: string) {
|
|
88
97
|
expanded[dirName] = !isExpanded(dirName)
|
|
98
|
+
setLocal(EXPANDED_KEY, JSON.stringify(expanded))
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
function protoRoute(dirName: string): string {
|
|
@@ -192,7 +202,7 @@
|
|
|
192
202
|
class:sortButtonActive={sortBy === 'updated'}
|
|
193
203
|
onclick={() => sortBy = 'updated'}
|
|
194
204
|
>
|
|
195
|
-
<Octicon name="clock" size={14}
|
|
205
|
+
<Octicon name="clock" size={14} color="var(--fgColor-muted)" />
|
|
196
206
|
Last updated
|
|
197
207
|
</button>
|
|
198
208
|
<button
|
|
@@ -200,7 +210,7 @@
|
|
|
200
210
|
class:sortButtonActive={sortBy === 'title'}
|
|
201
211
|
onclick={() => sortBy = 'title'}
|
|
202
212
|
>
|
|
203
|
-
<Octicon name="sort-asc" size={14}
|
|
213
|
+
<Octicon name="sort-asc" size={14} color="var(--fgColor-muted)" />
|
|
204
214
|
Title A–Z
|
|
205
215
|
</button>
|
|
206
216
|
</div>
|
|
@@ -458,7 +468,7 @@
|
|
|
458
468
|
display: inline-flex;
|
|
459
469
|
align-items: center;
|
|
460
470
|
border-radius: 9999px;
|
|
461
|
-
gap:
|
|
471
|
+
gap: 6px;
|
|
462
472
|
padding: 6px 10px;
|
|
463
473
|
font-size: 12px;
|
|
464
474
|
font-family: inherit;
|