@stacksjs/components 0.2.91 → 0.2.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.
@@ -0,0 +1,86 @@
1
+ <script server>
2
+ import { resolveIconColor, resolveSidebarTheme } from './themes'
3
+
4
+ export const id = $props.id || ''
5
+ export const label = $props.label || ''
6
+ export const icon = $props.icon || ''
7
+ export const iconColor = $props.iconColor || ''
8
+ export const image = $props.image || ''
9
+ export const href = $props.href || ''
10
+ export const count = $props.count ?? $props.badge ?? ''
11
+ export const active = $props.active ?? false
12
+ export const disabled = $props.disabled ?? false
13
+ export const expandable = $props.expandable ?? false
14
+ export const expanded = $props.expanded ?? true
15
+ export const depth = $props.depth || 0
16
+ export const parents = $props.parents || ''
17
+ export const theme = $props.theme || $props.variant || 'macos'
18
+
19
+ const themeStyle = resolveSidebarTheme(theme).item
20
+
21
+ export const rowClasses = [
22
+ themeStyle.base,
23
+ disabled ? themeStyle.disabled : themeStyle.hover,
24
+ disabled ? '' : themeStyle.pressed,
25
+ active ? themeStyle.active : '',
26
+ ].filter(Boolean).join(' ')
27
+
28
+ export const disclosureClasses = themeStyle.disclosure
29
+ export const chevronClasses = themeStyle.chevron
30
+ export const iconSlotClasses = themeStyle.iconSlot
31
+ export const iconClasses = `${icon} ${themeStyle.icon}`
32
+ export const imageClasses = themeStyle.image
33
+ export const labelClasses = themeStyle.label
34
+ export const countClasses = themeStyle.count
35
+
36
+ // Nested rows are indented; the icon tint accepts macOS system color names
37
+ // ("blue", "yellow", …) or any CSS color.
38
+ export const indentStyle = depth > 0 ? `padding-left: ${depth * themeStyle.indentPerLevel}px` : ''
39
+ const tint = resolveIconColor(iconColor)
40
+ export const iconStyle = tint ? `color: ${tint}` : ''
41
+ export const isLink = Boolean(href) && !disabled
42
+ </script>
43
+
44
+ <div
45
+ data-sidebar-row
46
+ data-item-id="{{ id }}"
47
+ @if(parents)data-parents="{{ parents }}"@endif
48
+ @if(expandable)data-expanded="{{ expanded ? 'true' : 'false' }}"@endif
49
+ @if(indentStyle)style="{{ indentStyle }}"@endif
50
+ >
51
+ @if(isLink)
52
+ <a href="{{ href }}" data-sidebar-item data-label="{{ label }}" class="{{ rowClasses }}" @if(active)data-active="true" aria-current="page"@endif>
53
+ <span class="{{ disclosureClasses }}" @if(expandable)data-sidebar-disclosure role="button" aria-label="Toggle {{ label }}"@endif>
54
+ @if(expandable)
55
+ <span class="{{ chevronClasses }}" aria-hidden="true"></span>
56
+ @endif
57
+ </span>
58
+ @if(image)
59
+ <span class="{{ iconSlotClasses }}"><img src="{{ image }}" alt="" class="{{ imageClasses }}" /></span>
60
+ @elseif(icon)
61
+ <span class="{{ iconSlotClasses }}"><span class="{{ iconClasses }}" @if(iconStyle)style="{{ iconStyle }}"@endif aria-hidden="true"></span></span>
62
+ @endif
63
+ <span class="{{ labelClasses }}">{{ label }}</span>
64
+ @if(count !== '' && count !== null && count !== undefined)
65
+ <span class="{{ countClasses }}">{{ count }}</span>
66
+ @endif
67
+ </a>
68
+ @else
69
+ <button type="button" data-sidebar-item data-label="{{ label }}" class="{{ rowClasses }}" @if(active)data-active="true" aria-current="page"@endif @if(disabled)data-disabled disabled aria-disabled="true"@endif>
70
+ <span class="{{ disclosureClasses }}" @if(expandable)data-sidebar-disclosure role="button" aria-label="Toggle {{ label }}"@endif>
71
+ @if(expandable)
72
+ <span class="{{ chevronClasses }}" aria-hidden="true"></span>
73
+ @endif
74
+ </span>
75
+ @if(image)
76
+ <span class="{{ iconSlotClasses }}"><img src="{{ image }}" alt="" class="{{ imageClasses }}" /></span>
77
+ @elseif(icon)
78
+ <span class="{{ iconSlotClasses }}"><span class="{{ iconClasses }}" @if(iconStyle)style="{{ iconStyle }}"@endif aria-hidden="true"></span></span>
79
+ @endif
80
+ <span class="{{ labelClasses }}">{{ label }}</span>
81
+ @if(count !== '' && count !== null && count !== undefined)
82
+ <span class="{{ countClasses }}">{{ count }}</span>
83
+ @endif
84
+ </button>
85
+ @endif
86
+ </div>
@@ -0,0 +1,83 @@
1
+ <script server>
2
+ import { resolveSidebarTheme } from './themes'
3
+
4
+ export const id = $props.id || ''
5
+ export const label = $props.label || ''
6
+ export const items = $props.items || []
7
+ export const collapsible = $props.collapsible ?? true
8
+ export const collapsed = $props.collapsed ?? false
9
+ export const theme = $props.theme || $props.variant || 'macos'
10
+
11
+ const themeStyle = resolveSidebarTheme(theme)
12
+ export const headerClasses = themeStyle.sectionHeader + (collapsible ? ' cursor-default' : '')
13
+ export const chevronClasses = themeStyle.sectionChevron
14
+ export const groupClasses = themeStyle.sectionGroup
15
+
16
+ // Components can't render themselves recursively, so the item tree is
17
+ // flattened into ready-to-render rows here. Each row remembers its depth
18
+ // and ancestor ids — the Sidebar controller uses those to collapse whole
19
+ // subtrees.
20
+ function flatten(list, depth = 0, parents = []) {
21
+ return list.flatMap((item) => {
22
+ const children = item.children || []
23
+ const row = {
24
+ id: item.id,
25
+ label: item.label,
26
+ icon: item.icon || '',
27
+ iconColor: item.iconColor || '',
28
+ image: item.image || '',
29
+ href: item.href || '',
30
+ count: item.count ?? item.badge ?? '',
31
+ active: item.active === true,
32
+ disabled: item.disabled === true,
33
+ expandable: children.length > 0 || item.expandable === true,
34
+ expanded: item.expanded !== false,
35
+ depth,
36
+ parents: parents.join('/'),
37
+ }
38
+ return [row, ...flatten(children, depth + 1, [...parents, item.id])]
39
+ })
40
+ }
41
+
42
+ export const rows = flatten(items)
43
+ </script>
44
+
45
+ <section
46
+ data-sidebar-section
47
+ data-section-id="{{ id }}"
48
+ data-expanded="{{ collapsed ? 'false' : 'true' }}"
49
+ >
50
+ @if(label)
51
+ @if(collapsible)
52
+ <button type="button" data-sidebar-section-header class="{{ headerClasses }}" aria-expanded="{{ collapsed ? 'false' : 'true' }}">
53
+ <span class="truncate">{{ label }}</span>
54
+ <span data-sidebar-section-chevron class="{{ chevronClasses }}" aria-hidden="true"></span>
55
+ </button>
56
+ @else
57
+ <div class="{{ headerClasses }}">
58
+ <span class="truncate">{{ label }}</span>
59
+ </div>
60
+ @endif
61
+ @endif
62
+
63
+ <div class="{{ groupClasses }}" role="group" @if(label)aria-label="{{ label }}"@endif>
64
+ @foreach(rows as row)
65
+ <SidebarItem
66
+ :id="row.id"
67
+ :label="row.label"
68
+ :icon="row.icon"
69
+ :iconColor="row.iconColor"
70
+ :image="row.image"
71
+ :href="row.href"
72
+ :count="row.count"
73
+ :active="row.active"
74
+ :disabled="row.disabled"
75
+ :expandable="row.expandable"
76
+ :expanded="row.expanded"
77
+ :depth="row.depth"
78
+ :parents="row.parents"
79
+ :theme="theme"
80
+ />
81
+ @endforeach
82
+ </div>
83
+ </section>
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- // ../../../../../../../tmp/stx-components-build-SknOIC/stubs/stub-0.js
2
+ // ../../../../../../../tmp/stx-components-build-ptvQRK/stubs/stub-0.js
3
3
  var stub_0_default = { __stx: true, src: "./components/CodeBlock.stx" };
4
- // ../../../../../../../tmp/stx-components-build-SknOIC/stubs/stub-1.js
4
+ // ../../../../../../../tmp/stx-components-build-ptvQRK/stubs/stub-1.js
5
5
  var stub_1_default = { __stx: true, src: "./components/Footer.stx" };
6
- // ../../../../../../../tmp/stx-components-build-SknOIC/stubs/stub-2.js
6
+ // ../../../../../../../tmp/stx-components-build-ptvQRK/stubs/stub-2.js
7
7
  var stub_2_default = { __stx: true, src: "./components/Hero.stx" };
8
- // ../../../../../../../tmp/stx-components-build-SknOIC/stubs/stub-3.js
8
+ // ../../../../../../../tmp/stx-components-build-ptvQRK/stubs/stub-3.js
9
9
  var stub_3_default = { __stx: true, src: "./components/Installation.stx" };
10
10
  // src/composables/useCopyCode.ts
11
11
  function useCopyCode(options) {
@@ -1132,15 +1132,167 @@ var RadioGroupOption_default = "./RadioGroupOption-s1d6r221.stx";
1132
1132
  // src/ui/select/Select.stx
1133
1133
  var Select_default = "./Select-1vnd0brz.stx";
1134
1134
  // src/ui/sidebar/Sidebar.stx
1135
- var Sidebar_default = "./Sidebar-0jzasrmt.stx";
1136
- // src/ui/sidebar/SidebarSection.stx
1137
- var SidebarSection_default = "./SidebarSection-g195cb4f.stx";
1138
- // src/ui/sidebar/SidebarItem.stx
1139
- var SidebarItem_default = "./SidebarItem-h53sgqzz.stx";
1140
- // src/ui/sidebar/SidebarHeader.stx
1141
- var SidebarHeader_default = "./SidebarHeader-ywpmx14d.stx";
1135
+ var Sidebar_default = "./Sidebar-4hn7vw4n.stx";
1142
1136
  // src/ui/sidebar/SidebarFooter.stx
1143
- var SidebarFooter_default = "./SidebarFooter-zsfsgcxb.stx";
1137
+ var SidebarFooter_default = "./SidebarFooter-0aegr99p.stx";
1138
+ // src/ui/sidebar/SidebarHeader.stx
1139
+ var SidebarHeader_default = "./SidebarHeader-ed5wb13t.stx";
1140
+ // src/ui/sidebar/SidebarItem.stx
1141
+ var SidebarItem_default = "./SidebarItem-gtrcw4ky.stx";
1142
+ // src/ui/sidebar/SidebarSection.stx
1143
+ var SidebarSection_default = "./SidebarSection-qf8fhy55.stx";
1144
+ // src/ui/sidebar/themes.ts
1145
+ var macosColors = {
1146
+ blue: "#0088ff",
1147
+ red: "#ff383c",
1148
+ pink: "#ff2d55",
1149
+ orange: "#ff8d28",
1150
+ yellow: "#ffcc00",
1151
+ green: "#34c759",
1152
+ teal: "#00c3d0",
1153
+ cyan: "#00c0e8",
1154
+ indigo: "#6155f5",
1155
+ purple: "#cb30e0",
1156
+ brown: "#ac7f5e",
1157
+ gray: "#8e8e93"
1158
+ };
1159
+ var macos = {
1160
+ pane: [
1161
+ "bg-white/55 dark:bg-[#1e1e23]/55",
1162
+ "backdrop-blur-[60px] backdrop-saturate-[1.8]",
1163
+ "text-black dark:text-white",
1164
+ "select-none"
1165
+ ].join(" "),
1166
+ layers: {
1167
+ shimmerRim: true
1168
+ },
1169
+ scrollArea: "flex-1 overflow-y-auto overflow-x-hidden px-[10px] pb-[10px]",
1170
+ sectionHeader: [
1171
+ "group/section flex w-full items-center",
1172
+ "pl-[8px] pr-[6px] pt-[16px] pb-[5px]",
1173
+ "text-[11px] font-semibold leading-[13px]",
1174
+ "text-[#3c3c43]/60 dark:text-[#ebebf5]/60"
1175
+ ].join(" "),
1176
+ sectionChevron: [
1177
+ "i-f7-chevron-down h-[11px] w-[11px] ml-auto",
1178
+ "text-[#3c3c43]/45 dark:text-[#ebebf5]/45",
1179
+ "opacity-0 group-hover/section:opacity-100 transition-opacity duration-150",
1180
+ "transition-transform duration-200"
1181
+ ].join(" "),
1182
+ sectionGroup: "flex flex-col gap-[2px]",
1183
+ item: {
1184
+ base: [
1185
+ "flex w-full items-center",
1186
+ "h-[30px] rounded-[9px] pl-[4px] pr-[8px]",
1187
+ "text-[13px] leading-[16px] font-normal",
1188
+ "text-black dark:text-white",
1189
+ "transition-colors duration-150 ease-out",
1190
+ "cursor-default"
1191
+ ].join(" "),
1192
+ hover: "hover:bg-black/4 dark:hover:bg-white/6",
1193
+ active: "bg-black/8 dark:bg-white/14",
1194
+ pressed: "active:bg-black/10 dark:active:bg-white/18",
1195
+ disabled: "opacity-40 pointer-events-none",
1196
+ disclosure: "flex h-[16px] w-[18px] shrink-0 items-center justify-center",
1197
+ chevron: [
1198
+ "i-f7-chevron-right h-[11px] w-[11px]",
1199
+ "text-[#3c3c43]/55 dark:text-[#ebebf5]/55",
1200
+ "transition-transform duration-200 ease-out"
1201
+ ].join(" "),
1202
+ iconSlot: "flex h-[20px] w-[22px] shrink-0 items-center justify-center mr-[7px]",
1203
+ icon: "h-[17px] w-[17px]",
1204
+ image: "h-[20px] w-[20px] rounded-[4px] object-cover shadow-sm",
1205
+ label: "flex-1 truncate text-left",
1206
+ count: [
1207
+ "ml-[8px] shrink-0 tabular-nums",
1208
+ "text-[13px] leading-[16px]",
1209
+ "text-[#3c3c43]/60 dark:text-[#ebebf5]/60"
1210
+ ].join(" "),
1211
+ indentPerLevel: 16
1212
+ }
1213
+ };
1214
+ var workspace = {
1215
+ pane: "bg-[#f4f4f3] dark:bg-neutral-950 text-zinc-950 dark:text-white select-none",
1216
+ layers: {},
1217
+ scrollArea: "flex-1 overflow-y-auto overflow-x-hidden px-5 py-5",
1218
+ sectionHeader: "group/section flex w-full items-center gap-2.5 px-4 pb-2 pt-5 text-[13px] font-semibold uppercase tracking-[0.12em] text-zinc-400 dark:text-zinc-500",
1219
+ sectionChevron: "i-f7-chevron-down h-3 w-3 ml-auto opacity-0 group-hover/section:opacity-100 transition-opacity duration-150 transition-transform duration-200",
1220
+ sectionGroup: "flex flex-col space-y-1",
1221
+ item: {
1222
+ base: "flex w-full items-center gap-3 rounded-[16px] px-3.5 py-2 text-[14px] leading-tight transition-colors duration-150",
1223
+ hover: "hover:bg-[#ececea] hover:text-zinc-950 dark:hover:bg-white/10",
1224
+ active: "bg-[#e7e7e5] text-zinc-950 dark:bg-white/12 dark:text-white",
1225
+ pressed: "active:bg-[#e2e2e0] dark:active:bg-white/15",
1226
+ disabled: "opacity-50 pointer-events-none",
1227
+ disclosure: "flex h-4 w-4 shrink-0 items-center justify-center",
1228
+ chevron: "i-f7-chevron-right h-3 w-3 opacity-50 transition-transform duration-200",
1229
+ iconSlot: "flex h-5 w-5 shrink-0 items-center justify-center",
1230
+ icon: "h-[18px] w-[18px] text-zinc-500 dark:text-zinc-500",
1231
+ image: "h-5 w-5 rounded object-cover",
1232
+ label: "flex-1 truncate text-left text-zinc-700 dark:text-zinc-300",
1233
+ count: "ml-auto grid h-5 min-w-5 place-items-center rounded-full bg-white/70 px-1.5 text-[11px] font-medium text-zinc-500 shadow-sm dark:bg-white/10 dark:text-zinc-400",
1234
+ indentPerLevel: 12
1235
+ }
1236
+ };
1237
+ var desktop = {
1238
+ pane: "bg-[#f3f3f1]/48 dark:bg-neutral-950/32 backdrop-blur-3xl backdrop-saturate-150 text-zinc-950 dark:text-white select-none",
1239
+ layers: {
1240
+ tint: "bg-[linear-gradient(112deg,rgba(255,255,255,0.20)_0%,rgba(255,255,255,0.04)_45%,rgba(226,226,222,0.16)_100%)] dark:bg-[linear-gradient(112deg,rgba(255,255,255,0.08)_0%,rgba(255,255,255,0.02)_46%,rgba(255,255,255,0.06)_100%)]"
1241
+ },
1242
+ scrollArea: "flex-1 overflow-y-auto overflow-x-hidden px-5 py-2",
1243
+ sectionHeader: "group/section flex w-full items-center gap-2.5 px-3 pb-1.5 pt-3 rounded-[14px] text-[12px] font-semibold uppercase tracking-[0.10em] text-zinc-500/80 dark:text-zinc-400/80",
1244
+ sectionChevron: "i-f7-chevron-down h-3 w-3 ml-auto opacity-0 group-hover/section:opacity-100 transition-opacity duration-150 transition-transform duration-200",
1245
+ sectionGroup: "flex flex-col space-y-1",
1246
+ item: {
1247
+ base: "flex w-full items-center gap-3 rounded-[14px] px-3 py-1.5 text-[13.5px] leading-tight transition-colors duration-150",
1248
+ hover: "hover:bg-white/38 hover:text-zinc-950 dark:hover:bg-white/10",
1249
+ active: "bg-[#e8e8e6]/90 text-zinc-950 dark:bg-white/12 dark:text-white",
1250
+ pressed: "active:bg-white/50 dark:active:bg-white/15",
1251
+ disabled: "opacity-50 pointer-events-none",
1252
+ disclosure: "flex h-4 w-4 shrink-0 items-center justify-center",
1253
+ chevron: "i-f7-chevron-right h-3 w-3 opacity-50 transition-transform duration-200",
1254
+ iconSlot: "flex h-5 w-5 shrink-0 items-center justify-center",
1255
+ icon: "h-[18px] w-[18px] text-zinc-600 dark:text-zinc-400",
1256
+ image: "h-5 w-5 rounded object-cover",
1257
+ label: "flex-1 truncate text-left text-zinc-700 dark:text-zinc-300",
1258
+ count: "ml-auto grid h-5 min-w-5 place-items-center rounded-full bg-white/72 px-1.5 text-[11px] font-medium text-zinc-500 shadow-sm dark:bg-white/10 dark:text-zinc-400",
1259
+ indentPerLevel: 12
1260
+ }
1261
+ };
1262
+ var solid = {
1263
+ ...macos,
1264
+ pane: "bg-stone-100 dark:bg-neutral-900 text-black dark:text-white select-none",
1265
+ layers: {}
1266
+ };
1267
+ var transparent = {
1268
+ ...macos,
1269
+ pane: "bg-transparent text-black dark:text-white select-none",
1270
+ layers: {}
1271
+ };
1272
+ var vibrancy = {
1273
+ ...macos,
1274
+ pane: "bg-white/50 dark:bg-black/40 backdrop-blur-3xl backdrop-saturate-200 text-black dark:text-white select-none",
1275
+ layers: {}
1276
+ };
1277
+ var sidebarThemes = {
1278
+ macos,
1279
+ tahoe: macos,
1280
+ "macos-tahoe": macos,
1281
+ "macos-latest": macos,
1282
+ workspace,
1283
+ desktop,
1284
+ solid,
1285
+ transparent,
1286
+ vibrancy
1287
+ };
1288
+ function resolveSidebarTheme(name) {
1289
+ return sidebarThemes[name || "macos"] || sidebarThemes.macos;
1290
+ }
1291
+ function resolveIconColor(color) {
1292
+ if (!color)
1293
+ return;
1294
+ return macosColors[color] || color;
1295
+ }
1144
1296
  // src/ui/skeleton/Skeleton.stx
1145
1297
  var Skeleton_default = "./Skeleton-v1pwa8nr.stx";
1146
1298
  // src/ui/spinner/Spinner.stx
@@ -3699,12 +3851,15 @@ export {
3699
3851
  t,
3700
3852
  storage,
3701
3853
  staggerAnimation,
3854
+ sidebarThemes,
3702
3855
  setTitle,
3703
3856
  setMeta,
3704
3857
  setLink,
3705
3858
  setI18n,
3706
3859
  setErrorHandler,
3707
3860
  sequenceAnimations,
3861
+ resolveSidebarTheme,
3862
+ resolveIconColor,
3708
3863
  removeAnimation,
3709
3864
  preloadModules,
3710
3865
  preloadModule,
@@ -3715,6 +3870,7 @@ export {
3715
3870
  numberFormats,
3716
3871
  n,
3717
3872
  moveFocus,
3873
+ macosColors,
3718
3874
  loadLocaleMessages,
3719
3875
  linear,
3720
3876
  lazyLoadModule,
@@ -1,155 +1,115 @@
1
- // Types
1
+ /**
2
+ * One navigation row.
3
+ *
4
+ * ```ts
5
+ * { id: 'icloud', label: 'iCloud', icon: 'i-f7-tray', iconColor: 'blue', count: 248, active: true }
6
+ * ```
7
+ */
2
8
  export declare interface SidebarItemData {
3
9
  id: string
4
10
  label: string
5
11
  icon?: string
12
+ iconColor?: string
13
+ image?: string
6
14
  href?: string
15
+ count?: string | number
7
16
  badge?: string | number
8
17
  active?: boolean
9
18
  disabled?: boolean
19
+ children?: SidebarItemData[]
20
+ expandable?: boolean
21
+ expanded?: boolean
10
22
  }
23
+ /** A titled group of rows (e.g. "Favorites"). Untitled when `label` is empty. */
11
24
  export declare interface SidebarSectionData {
12
25
  id: string
13
- label: string
14
- icon?: string
26
+ label?: string
15
27
  items: SidebarItemData[]
16
- expanded?: boolean
17
28
  collapsible?: boolean
29
+ collapsed?: boolean
18
30
  }
19
31
  export declare interface SidebarProps {
20
32
  sections?: SidebarSectionData[]
21
- collapsed?: boolean
22
- collapsible?: boolean
33
+ theme?: SidebarThemeChoice
34
+ variant?: SidebarThemeChoice
23
35
  width?: number
24
- minWidth?: number
25
- collapseMode?: 'rail' | 'hidden'
26
- variant?: SidebarVariant
27
- placement?: 'fixed' | 'sticky' | 'static'
28
36
  position?: 'left' | 'right'
37
+ placement?: 'fixed' | 'sticky' | 'static'
29
38
  bordered?: boolean
30
- materialOpacity?: number
31
- materialDarkOpacity?: number
32
- materialScheme?: 'system' | 'light' | 'dark'
39
+ collapsed?: boolean
40
+ collapsible?: boolean
41
+ collapseMode?: 'hidden' | 'rail'
42
+ minWidth?: number
33
43
  persistKey?: string
34
44
  shellSelector?: string
35
45
  widthVar?: string
36
46
  collapsedClass?: string
37
- nativeMaterialCollapse?: boolean
38
47
  className?: string
39
48
  onCollapse?: (collapsed: boolean) => void
40
49
  onSectionToggle?: (sectionId: string) => void
50
+ onItemToggle?: (event: { id: string, expanded: boolean }) => void
41
51
  onItemClick?: (item: SidebarItemData, event: Event) => void
42
52
  }
43
53
  export declare interface SidebarSectionProps {
44
54
  id: string
45
- label: string
46
- icon?: string
55
+ label?: string
47
56
  items: SidebarItemData[]
48
- expanded?: boolean
49
57
  collapsible?: boolean
50
- showLabel?: boolean
51
- variant?: SidebarVariant
52
- onToggle?: (id: string) => void
53
- onItemClick?: (item: SidebarItemData, event: Event) => void
58
+ collapsed?: boolean
59
+ theme?: SidebarThemeChoice
54
60
  }
55
- export declare interface SidebarItemProps {
61
+ export declare interface SidebarItemProps extends SidebarItemData {
62
+ depth?: number
63
+ parents?: string
64
+ theme?: SidebarThemeChoice
65
+ }
66
+ /** A floating toolbar or footer action button. */
67
+ export declare interface SidebarActionData {
56
68
  id: string
69
+ icon: string
57
70
  label: string
58
- icon?: string
59
- href?: string
60
- badge?: string | number
61
- active?: boolean
62
- disabled?: boolean
63
- indent?: boolean
64
- variant?: SidebarVariant
65
- onClick?: (event: Event) => void
66
71
  }
67
72
  export declare interface SidebarHeaderProps {
73
+ theme?: SidebarThemeChoice
74
+ showWindowControls?: boolean
75
+ actions?: SidebarActionData[]
76
+ showSearch?: boolean
77
+ searchPlaceholder?: string
68
78
  title?: string
69
79
  subtitle?: string
70
80
  logo?: string
71
- logoIcon?: string
72
- showWindowControls?: boolean | 'auto'
73
- showNavigationControls?: boolean
74
- showSearch?: boolean
75
- searchPlaceholder?: string
76
- searchValue?: string
77
- collapsed?: boolean
78
- variant?: SidebarVariant
81
+ onAction?: (actionId: string) => void
79
82
  onSearch?: (value: string) => void
83
+ onWindowControl?: (action: 'close' | 'minimize' | 'zoom') => void
80
84
  }
81
85
  export declare interface SidebarFooterProps {
82
- showSettings?: boolean
83
- showThemeToggle?: boolean
84
- settingsHref?: string
85
- settingsLabel?: string
86
- collapsed?: boolean
87
- variant?: SidebarVariant
88
- actions?: Array<{
89
- label: string
90
- icon?: string
91
- href?: string
92
- onClick?: () => void
93
- }>
94
- onThemeToggle?: () => void
95
- }
96
- /**
97
- * Native Sidebar Configuration
98
- *
99
- * Used to configure the native macOS sidebar when running with Craft's --native-sidebar flag.
100
- * The sidebar uses NSOutlineView with vibrancy for a true Tahoe-style appearance.
101
- */
102
- export declare interface NativeSidebarConfig {
103
- variant?: SidebarVariant
104
- material?: SidebarMaterial
105
- backgroundEffect?: SidebarBackgroundEffect
106
- allowsVibrancy?: boolean
107
- materialOpacity?: number
108
- materialDarkOpacity?: number
109
- materialScheme?: 'system' | 'light' | 'dark'
110
- header?: {
111
- title?: string
112
- subtitle?: string
113
- icon?: string
114
- }
115
- searchPlaceholder?: string
116
- sections: NativeSidebarSection[]
117
- minWidth?: number
118
- maxWidth?: number
119
- canCollapse?: boolean
120
- }
121
- export declare interface NativeSidebarSection {
122
- id: string
123
- title: string
124
- collapsible?: boolean
125
- collapsed?: boolean
126
- items: NativeSidebarItem[]
127
- }
128
- export declare interface NativeSidebarItem {
129
- id: string
130
- label: string
131
- icon?: string
132
- badge?: string | number
133
- tintColor?: string
134
- selected?: boolean
135
- disabled?: boolean
136
- children?: NativeSidebarItem[]
137
- data?: Record<string, unknown>
86
+ theme?: SidebarThemeChoice
87
+ avatar?: string
88
+ name?: string
89
+ detail?: string
90
+ actions?: SidebarActionData[]
91
+ onProfileClick?: () => void
92
+ onAction?: (actionId: string) => void
138
93
  }
139
94
  /**
140
- * Craft sidebar selection event
141
- * Passed to window.craft._sidebarSelectHandler when user clicks a sidebar item
95
+ * Sidebar themes. `macos` recreates the sidebar of the latest macOS
96
+ * (Tahoe, macOS 26/27) translucent material, Liquid Glass edge shimmer,
97
+ * 30px rows with 9px-radius highlights and plain gray counts. `tahoe`,
98
+ * `macos-tahoe` and `macos-latest` are aliases of `macos`. The remaining
99
+ * names are legacy looks kept for backwards compatibility.
142
100
  */
143
- export declare interface SidebarSelectEvent {
144
- itemId: string
145
- item: NativeSidebarItem
146
- sectionId?: string
147
- }
148
- export type SidebarVariant = 'tahoe' | 'vibrancy' | 'solid' | 'transparent' | 'workspace' | 'desktop';
149
- export type SidebarMaterial = 'auto' | 'sidebar' | 'hud' | 'popover' | 'content';
150
- export type SidebarBackgroundEffect = 'none' | 'vibrancy' | 'shimmer';
101
+ export type SidebarThemeChoice = | 'macos'
102
+ | 'macos-tahoe'
103
+ | 'macos-latest'
104
+ | 'tahoe'
105
+ | 'vibrancy'
106
+ | 'solid'
107
+ | 'transparent'
108
+ | 'workspace'
109
+ | 'desktop';
151
110
  export { default as Sidebar } from './Sidebar.stx';
152
- export { default as SidebarSection } from './SidebarSection.stx';
153
- export { default as SidebarItem } from './SidebarItem.stx';
154
- export { default as SidebarHeader } from './SidebarHeader.stx';
155
111
  export { default as SidebarFooter } from './SidebarFooter.stx';
112
+ export { default as SidebarHeader } from './SidebarHeader.stx';
113
+ export { default as SidebarItem } from './SidebarItem.stx';
114
+ export { default as SidebarSection } from './SidebarSection.stx';
115
+ export * from './themes';
@@ -0,0 +1,74 @@
1
+ export declare function resolveSidebarTheme(name?: string): SidebarTheme;
2
+ /**
3
+ * Resolve an item's icon tint. Accepts a macOS system color name
4
+ * (`"blue"`, `"red"`, …) or any CSS color, and falls back to the
5
+ * theme's default icon color when unset.
6
+ */
7
+ export declare function resolveIconColor(color?: string): string | undefined;
8
+ /**
9
+ * Sidebar theme registry
10
+ *
11
+ * Every visual decision the sidebar makes lives here, expressed as utility
12
+ * classes, so a theme can be read top-to-bottom like a spec sheet.
13
+ *
14
+ * The flagship theme is `macos` — a faithful recreation of the sidebar in
15
+ * the latest macOS (Tahoe, macOS 26/27 "Liquid Glass"). Its metrics were
16
+ * measured from native apps (Mail, Music, Notes) at @2x:
17
+ *
18
+ * row pitch 32px = 30px row + 2px gap · highlight radius 9px
19
+ * label 13px · count 13px secondary gray · section header 11px semibold
20
+ * icon 17px in a fixed 22px slot · disclosure gutter 18px · child indent 16px
21
+ *
22
+ * Legacy themes (`workspace`, `desktop`, `solid`, `transparent`, `vibrancy`)
23
+ * are preserved verbatim from the previous variant maps. `tahoe` now aliases
24
+ * `macos` — it always meant "look like macOS", and now it actually does.
25
+ */
26
+ /** macOS system colors (light appearance) for tinting sidebar icons. */
27
+ export declare const macosColors: {
28
+ blue: '#0088ff';
29
+ red: '#ff383c';
30
+ pink: '#ff2d55';
31
+ orange: '#ff8d28';
32
+ yellow: '#ffcc00';
33
+ green: '#34c759';
34
+ teal: '#00c3d0';
35
+ cyan: '#00c0e8';
36
+ indigo: '#6155f5';
37
+ purple: '#cb30e0';
38
+ brown: '#ac7f5e';
39
+ gray: '#8e8e93'
40
+ };
41
+ export declare const sidebarThemes: {
42
+ 'tahoe': unknown;
43
+ 'macos-tahoe': unknown;
44
+ 'macos-latest': unknown
45
+ };
46
+ /** Class groups a sidebar theme provides. All values are utility classes. */
47
+ export declare interface SidebarTheme {
48
+ pane: string
49
+ layers: {
50
+ shimmerRim?: boolean
51
+ tint?: string
52
+ }
53
+ scrollArea: string
54
+ sectionHeader: string
55
+ sectionChevron: string
56
+ sectionGroup: string
57
+ item: {
58
+ base: string
59
+ hover: string
60
+ active: string
61
+ pressed: string
62
+ disabled: string
63
+ disclosure: string
64
+ chevron: string
65
+ iconSlot: string
66
+ icon: string
67
+ image: string
68
+ label: string
69
+ count: string
70
+ indentPerLevel: number
71
+ }
72
+ }
73
+ export type MacosColor = keyof typeof macosColors;
74
+ export type SidebarThemeName = keyof typeof sidebarThemes;