@stacksjs/components 0.2.118 → 0.2.120

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/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- // ../../../../../../../tmp/stx-components-build-aVrCGd/stubs/stub-0.js
2
+ // ../../../../../../../tmp/stx-components-build-KdF6nL/stubs/stub-0.js
3
3
  var stub_0_default = { __stx: true, src: "./components/CodeBlock.stx" };
4
- // ../../../../../../../tmp/stx-components-build-aVrCGd/stubs/stub-1.js
4
+ // ../../../../../../../tmp/stx-components-build-KdF6nL/stubs/stub-1.js
5
5
  var stub_1_default = { __stx: true, src: "./components/Footer.stx" };
6
- // ../../../../../../../tmp/stx-components-build-aVrCGd/stubs/stub-2.js
6
+ // ../../../../../../../tmp/stx-components-build-KdF6nL/stubs/stub-2.js
7
7
  var stub_2_default = { __stx: true, src: "./components/Hero.stx" };
8
- // ../../../../../../../tmp/stx-components-build-aVrCGd/stubs/stub-3.js
8
+ // ../../../../../../../tmp/stx-components-build-KdF6nL/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,23 @@ 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-hjazqxv8.stx";
1135
+ var Sidebar_default = "./Sidebar-vgckg8f7.stx";
1136
1136
  // src/ui/sidebar/SidebarFooter.stx
1137
- var SidebarFooter_default = "./SidebarFooter-0aegr99p.stx";
1137
+ var SidebarFooter_default = "./SidebarFooter-s7skj92y.stx";
1138
1138
  // src/ui/sidebar/SidebarHeader.stx
1139
- var SidebarHeader_default = "./SidebarHeader-ed5wb13t.stx";
1139
+ var SidebarHeader_default = "./SidebarHeader-sa9mtdst.stx";
1140
1140
  // src/ui/sidebar/SidebarItem.stx
1141
1141
  var SidebarItem_default = "./SidebarItem-9rvbwhxr.stx";
1142
+ // src/ui/sidebar/SidebarPinned.stx
1143
+ var SidebarPinned_default = "./SidebarPinned-tvj28bm0.stx";
1142
1144
  // src/ui/sidebar/SidebarSection.stx
1143
1145
  var SidebarSection_default = "./SidebarSection-qf8fhy55.stx";
1146
+ // src/ui/sidebar/SidebarSpace.stx
1147
+ var SidebarSpace_default = "./SidebarSpace-61b662jx.stx";
1148
+ // src/ui/sidebar/SidebarSpaces.stx
1149
+ var SidebarSpaces_default = "./SidebarSpaces-gq3mx984.stx";
1150
+ // src/ui/sidebar/SidebarSpaceSwitcher.stx
1151
+ var SidebarSpaceSwitcher_default = "./SidebarSpaceSwitcher-882njcxq.stx";
1144
1152
  // src/ui/sidebar/themes.ts
1145
1153
  var macosColors = {
1146
1154
  blue: "#0088ff",
@@ -1262,6 +1270,67 @@ var desktop = {
1262
1270
  indentPerLevel: 12
1263
1271
  }
1264
1272
  };
1273
+ var arc = {
1274
+ selection: "classes",
1275
+ pane: [
1276
+ "bg-[#f7f5f1]/92 dark:bg-[#1a1a1c]/92",
1277
+ "backdrop-blur-[40px] backdrop-saturate-[160%]",
1278
+ "text-[#2c2a28] dark:text-[#ededf0]",
1279
+ "select-none"
1280
+ ].join(" "),
1281
+ layers: {
1282
+ tint: [
1283
+ "bg-[linear-gradient(180deg,var(--stx-sidebar-tint,rgba(255,251,242,0.55))_0%,rgba(255,255,255,0)_38%)]",
1284
+ "dark:bg-[linear-gradient(180deg,var(--stx-sidebar-tint,rgba(255,255,255,0.05))_0%,rgba(255,255,255,0)_42%)]"
1285
+ ].join(" ")
1286
+ },
1287
+ scrollArea: "flex-1 overflow-y-auto overflow-x-hidden px-[8px] pb-[8px]",
1288
+ sectionHeader: [
1289
+ "group/section flex w-full items-center",
1290
+ "px-[8px] pt-[14px] pb-[4px]",
1291
+ "text-[11px] font-medium leading-[13px]",
1292
+ "opacity-55"
1293
+ ].join(" "),
1294
+ sectionChevron: [
1295
+ "i-f7-chevron-down h-[10px] w-[10px] ml-auto",
1296
+ "opacity-0 group-hover/section:opacity-100 transition-opacity duration-150",
1297
+ "transition-transform duration-200"
1298
+ ].join(" "),
1299
+ sectionGroup: "flex flex-col space-y-[2px]",
1300
+ item: {
1301
+ base: [
1302
+ "flex w-full items-center",
1303
+ "h-[30px] rounded-[8px] pl-[6px] pr-[8px]",
1304
+ "text-[13px] leading-[16px] font-normal",
1305
+ "text-current",
1306
+ "transition-[background-color,box-shadow,color] duration-150 ease-out",
1307
+ "cursor-default"
1308
+ ].join(" "),
1309
+ hover: "hover:bg-white/55 dark:hover:bg-white/8",
1310
+ active: [
1311
+ "bg-white dark:bg-white/14",
1312
+ "font-medium",
1313
+ "shadow-[0_1px_2px_rgba(0,0,0,0.08)] dark:shadow-[0_1px_2px_rgba(0,0,0,0.35)]",
1314
+ "ring-1 ring-black/5 dark:ring-white/8"
1315
+ ].join(" "),
1316
+ pressed: "active:bg-white/80 dark:active:bg-white/18",
1317
+ disabled: "opacity-40 pointer-events-none",
1318
+ disclosure: "flex h-[16px] w-[16px] shrink-0 items-center justify-center",
1319
+ chevron: [
1320
+ "i-f7-chevron-right h-[10px] w-[10px] opacity-45",
1321
+ "transition-transform duration-200 ease-out"
1322
+ ].join(" "),
1323
+ iconSlot: "flex h-[18px] w-[18px] shrink-0 items-center justify-center mr-[8px]",
1324
+ icon: "h-[16px] w-[16px]",
1325
+ image: "h-[18px] w-[18px] rounded-[5px] object-cover shadow-sm",
1326
+ label: "flex-1 truncate text-left",
1327
+ count: [
1328
+ "ml-[8px] shrink-0 tabular-nums",
1329
+ "text-[12px] leading-[16px] opacity-45"
1330
+ ].join(" "),
1331
+ indentPerLevel: 14
1332
+ }
1333
+ };
1265
1334
  var solid = {
1266
1335
  ...macos,
1267
1336
  pane: "bg-stone-100 dark:bg-neutral-900 text-black dark:text-white select-none",
@@ -1282,6 +1351,7 @@ var sidebarThemes = {
1282
1351
  tahoe: macos,
1283
1352
  "macos-tahoe": macos,
1284
1353
  "macos-latest": macos,
1354
+ arc,
1285
1355
  workspace,
1286
1356
  desktop,
1287
1357
  solid,
@@ -1296,6 +1366,82 @@ function resolveIconColor(color) {
1296
1366
  return;
1297
1367
  return macosColors[color] || color;
1298
1368
  }
1369
+
1370
+ // src/ui/sidebar/spaces.ts
1371
+ var NEUTRAL_SEED = macosColors.gray;
1372
+ function mix(color, percent, into) {
1373
+ return `color-mix(in oklab, ${color} ${percent}%, ${into})`;
1374
+ }
1375
+ function deriveSpaceTint(seed) {
1376
+ return {
1377
+ light: {
1378
+ from: mix(seed, 16, "#ffffff"),
1379
+ to: mix(seed, 34, "#ffffff"),
1380
+ ink: mix(seed, 22, "#17171b"),
1381
+ accent: mix(seed, 88, "#2a2a30")
1382
+ },
1383
+ dark: {
1384
+ from: mix(seed, 26, "#101014"),
1385
+ to: mix(seed, 14, "#08080b"),
1386
+ ink: mix(seed, 12, "#f4f4f7"),
1387
+ accent: mix(seed, 74, "#ffffff")
1388
+ }
1389
+ };
1390
+ }
1391
+ function resolveSpaceTint(tint) {
1392
+ if (!tint)
1393
+ return deriveSpaceTint(NEUTRAL_SEED);
1394
+ if (typeof tint !== "string")
1395
+ return tint;
1396
+ return deriveSpaceTint(macosColors[tint] || tint);
1397
+ }
1398
+ function spaceTintVars(tint) {
1399
+ return [
1400
+ `--stx-space-light-from: ${tint.light.from}`,
1401
+ `--stx-space-light-to: ${tint.light.to}`,
1402
+ `--stx-space-light-ink: ${tint.light.ink}`,
1403
+ `--stx-space-light-accent: ${tint.light.accent}`,
1404
+ `--stx-space-dark-from: ${tint.dark.from}`,
1405
+ `--stx-space-dark-to: ${tint.dark.to}`,
1406
+ `--stx-space-dark-ink: ${tint.dark.ink}`,
1407
+ `--stx-space-dark-accent: ${tint.dark.accent}`
1408
+ ].join("; ");
1409
+ }
1410
+ function normalizeAction(action, spaceId, role, fallbackIcon) {
1411
+ if (!action || !action.label)
1412
+ return null;
1413
+ return {
1414
+ id: action.id || `${spaceId}-${role}`,
1415
+ label: action.label,
1416
+ icon: action.icon || fallbackIcon
1417
+ };
1418
+ }
1419
+ function normalizeSpace(space) {
1420
+ const tint = resolveSpaceTint(space.tint);
1421
+ return {
1422
+ id: space.id,
1423
+ label: space.label || "",
1424
+ icon: space.icon || "",
1425
+ pinned: space.pinned || [],
1426
+ sections: space.sections || [],
1427
+ action: normalizeAction(space.action, space.id, "action", "i-f7-plus"),
1428
+ clear: normalizeAction(space.clear, space.id, "clear", "i-f7-arrow-down"),
1429
+ tint,
1430
+ style: spaceTintVars(tint)
1431
+ };
1432
+ }
1433
+ function normalizeSpaces(spaces) {
1434
+ return (spaces || []).map(normalizeSpace);
1435
+ }
1436
+ function spaceIndexOf(spaces, id) {
1437
+ if (!id)
1438
+ return 0;
1439
+ const index = spaces.findIndex((space) => space.id === id);
1440
+ return index === -1 ? 0 : index;
1441
+ }
1442
+ function spaceTintPayload(spaces) {
1443
+ return spaces.map((space) => space.tint);
1444
+ }
1299
1445
  // src/ui/skeleton/Skeleton.stx
1300
1446
  var Skeleton_default = "./Skeleton-v1pwa8nr.stx";
1301
1447
  // src/ui/spinner/Spinner.stx
@@ -3854,6 +4000,9 @@ export {
3854
4000
  t,
3855
4001
  storage,
3856
4002
  staggerAnimation,
4003
+ spaceTintVars,
4004
+ spaceTintPayload,
4005
+ spaceIndexOf,
3857
4006
  sidebarThemes,
3858
4007
  setTitle,
3859
4008
  setMeta,
@@ -3861,6 +4010,7 @@ export {
3861
4010
  setI18n,
3862
4011
  setErrorHandler,
3863
4012
  sequenceAnimations,
4013
+ resolveSpaceTint,
3864
4014
  resolveSidebarTheme,
3865
4015
  resolveIconColor,
3866
4016
  removeAnimation,
@@ -3871,6 +4021,8 @@ export {
3871
4021
  pluralRules,
3872
4022
  numberInputPropSchema,
3873
4023
  numberFormats,
4024
+ normalizeSpaces,
4025
+ normalizeSpace,
3874
4026
  n,
3875
4027
  moveFocus,
3876
4028
  macosColors,
@@ -3933,6 +4085,7 @@ export {
3933
4085
  easeInBack,
3934
4086
  devAssert,
3935
4087
  detectLanguage,
4088
+ deriveSpaceTint,
3936
4089
  defaultTheme,
3937
4090
  dateTimeFormats,
3938
4091
  d,
@@ -3995,7 +4148,11 @@ export {
3995
4148
  Spinner_default as Spinner,
3996
4149
  Skeleton_default as Skeleton,
3997
4150
  Signup_default as Signup,
4151
+ SidebarSpaces_default as SidebarSpaces,
4152
+ SidebarSpaceSwitcher_default as SidebarSpaceSwitcher,
4153
+ SidebarSpace_default as SidebarSpace,
3998
4154
  SidebarSection_default as SidebarSection,
4155
+ SidebarPinned_default as SidebarPinned,
3999
4156
  SidebarItem_default as SidebarItem,
4000
4157
  SidebarHeader_default as SidebarHeader,
4001
4158
  SidebarFooter_default as SidebarFooter,
@@ -1,35 +1,15 @@
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
- */
8
- export declare interface SidebarItemData {
9
- id: string
10
- label: string
11
- icon?: string
12
- iconColor?: string
13
- image?: string
14
- href?: string
15
- count?: string | number
16
- badge?: string | number
17
- active?: boolean
18
- disabled?: boolean
19
- children?: SidebarItemData[]
20
- expandable?: boolean
21
- expanded?: boolean
22
- }
23
- /** A titled group of rows (e.g. "Favorites"). Untitled when `label` is empty. */
24
- export declare interface SidebarSectionData {
25
- id: string
26
- label?: string
27
- items: SidebarItemData[]
28
- collapsible?: boolean
29
- collapsed?: boolean
30
- }
1
+ import type { SidebarItemData, SidebarSectionData } from './rows';
2
+ import type { SidebarSpaceChangeEvent, SidebarSpaceData } from './spaces';
31
3
  export declare interface SidebarProps {
32
4
  sections?: SidebarSectionData[]
5
+ spaces?: SidebarSpaceData[]
6
+ space?: string
7
+ showSpaceSwitcher?: boolean
8
+ showSpaceAdd?: boolean
9
+ spaceAddLabel?: string
10
+ spacePersistKey?: string
11
+ onSpaceChange?: (event: SidebarSpaceChangeEvent) => void
12
+ onSpaceAdd?: () => void
33
13
  theme?: SidebarThemeChoice
34
14
  variant?: SidebarThemeChoice
35
15
  width?: number
@@ -45,6 +25,7 @@ export declare interface SidebarProps {
45
25
  widthVar?: string
46
26
  collapsedClass?: string
47
27
  className?: string
28
+ followSystemAppearance?: boolean
48
29
  onCollapse?: (collapsed: boolean) => void
49
30
  onSectionToggle?: (sectionId: string) => void
50
31
  onItemToggle?: (event: { id: string, expanded: boolean }) => void
@@ -105,5 +86,11 @@ export { default as Sidebar } from './Sidebar.stx';
105
86
  export { default as SidebarFooter } from './SidebarFooter.stx';
106
87
  export { default as SidebarHeader } from './SidebarHeader.stx';
107
88
  export { default as SidebarItem } from './SidebarItem.stx';
89
+ export { default as SidebarPinned } from './SidebarPinned.stx';
108
90
  export { default as SidebarSection } from './SidebarSection.stx';
91
+ export { default as SidebarSpace } from './SidebarSpace.stx';
92
+ export { default as SidebarSpaces } from './SidebarSpaces.stx';
93
+ export { default as SidebarSpaceSwitcher } from './SidebarSpaceSwitcher.stx';
94
+ export * from './rows';
95
+ export * from './spaces';
109
96
  export * from './themes';
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The shapes a sidebar's rows are described with.
3
+ *
4
+ * These live apart from `index.ts` because both the barrel and `spaces.ts`
5
+ * need them: a space carries sections exactly like a plain sidebar does. With
6
+ * the definitions in the barrel, the leaf had to import from it and the two
7
+ * modules formed a cycle — legal for types, but it drags the whole public
8
+ * surface into any program that touches one small module.
9
+ *
10
+ * `index.ts` re-exports everything here, so this split is invisible to callers.
11
+ *
12
+ * @module
13
+ */
14
+ /**
15
+ * One navigation row.
16
+ *
17
+ * ```ts
18
+ * { id: 'icloud', label: 'iCloud', icon: 'i-f7-tray', iconColor: 'blue', count: 248, active: true }
19
+ * ```
20
+ */
21
+ export declare interface SidebarItemData {
22
+ id: string
23
+ label: string
24
+ icon?: string
25
+ iconColor?: string
26
+ image?: string
27
+ href?: string
28
+ count?: string | number
29
+ badge?: string | number
30
+ active?: boolean
31
+ disabled?: boolean
32
+ children?: SidebarItemData[]
33
+ expandable?: boolean
34
+ expanded?: boolean
35
+ }
36
+ /** A titled group of rows (e.g. "Favorites"). Untitled when `label` is empty. */
37
+ export declare interface SidebarSectionData {
38
+ id: string
39
+ label?: string
40
+ items: SidebarItemData[]
41
+ collapsible?: boolean
42
+ collapsed?: boolean
43
+ }
@@ -0,0 +1,105 @@
1
+ import type { SidebarSectionData } from './rows';
2
+ /**
3
+ * Build a full light/dark palette from one seed color.
4
+ *
5
+ * The percentages are the tuning surface of the whole feature, so they are
6
+ * worth stating plainly. In light appearance the panel stays *pale* — 16% and
7
+ * 34% of the seed — because Arc's spaces are washes, not fills; anything
8
+ * stronger and the white selection cards stop reading as raised. The ink is
9
+ * the seed pulled almost to black (22% seed) so text keeps a hint of the
10
+ * space's hue without losing contrast. In dark appearance the relationship
11
+ * inverts: the seed is mixed *into* near-black for the panel and *into* white
12
+ * for the ink and accent, which keeps a dark space recognizably the same color
13
+ * as its light counterpart rather than a different one.
14
+ */
15
+ export declare function deriveSpaceTint(seed: string): SidebarSpaceTint;
16
+ /**
17
+ * Resolve a space's `tint` prop to a palette.
18
+ *
19
+ * Accepts a macOS system color name, any CSS color, or a pre-built palette.
20
+ * Unset falls back to the neutral seed.
21
+ */
22
+ export declare function resolveSpaceTint(tint?: string | SidebarSpaceTint): SidebarSpaceTint;
23
+ /**
24
+ * Render a palette as inline custom properties.
25
+ *
26
+ * Both appearances are published at once. `Sidebar.stx` maps them onto the
27
+ * four registered properties it actually paints with, choosing per
28
+ * `prefers-color-scheme`, so the correct appearance is already right in the
29
+ * server-rendered HTML.
30
+ */
31
+ export declare function spaceTintVars(tint: SidebarSpaceTint): string;
32
+ /** Normalize one space so template bindings stay plain property reads. */
33
+ export declare function normalizeSpace(space: SidebarSpaceData): NormalizedSidebarSpace;
34
+ export declare function normalizeSpaces(spaces: SidebarSpaceData[]): NormalizedSidebarSpace[];
35
+ /**
36
+ * Index of `id` within `spaces`, or 0 when it is missing.
37
+ *
38
+ * Falling back to the first space rather than to -1 is deliberate: a stale
39
+ * persisted id or a typo should open the sidebar on *something*, never on a
40
+ * blank track scrolled past its own content.
41
+ */
42
+ export declare function spaceIndexOf(spaces: NormalizedSidebarSpace[], id?: string): number;
43
+ /**
44
+ * The per-space palettes the client controller needs to repaint the pane.
45
+ *
46
+ * Only the colors travel — markup, sections and actions are already in the
47
+ * DOM, so re-serializing them would just bloat the attribute.
48
+ */
49
+ export declare function spaceTintPayload(spaces: NormalizedSidebarSpace[]): SidebarSpaceTint[];
50
+ /** The four surfaces a space paints, in one appearance. */
51
+ export declare interface SidebarSpaceTintColors {
52
+ from: string
53
+ to: string
54
+ ink: string
55
+ accent: string
56
+ }
57
+ /** A space's palette in both appearances. */
58
+ export declare interface SidebarSpaceTint {
59
+ light: SidebarSpaceTintColors
60
+ dark: SidebarSpaceTintColors
61
+ }
62
+ /** A tile in a space's pinned grid — Arc's favorites row. */
63
+ export declare interface SidebarPinnedItemData {
64
+ id: string
65
+ label: string
66
+ icon?: string
67
+ image?: string
68
+ iconColor?: string
69
+ href?: string
70
+ }
71
+ /** A single labelled action row (Arc's "+ New Tab", Notes' "+ New Note"). */
72
+ export declare interface SidebarSpaceActionData {
73
+ id?: string
74
+ label: string
75
+ icon?: string
76
+ }
77
+ /** One scene in a swipeable sidebar. */
78
+ export declare interface SidebarSpaceData {
79
+ id: string
80
+ label?: string
81
+ icon?: string
82
+ tint?: string | SidebarSpaceTint
83
+ pinned?: SidebarPinnedItemData[]
84
+ sections?: SidebarSectionData[]
85
+ action?: SidebarSpaceActionData
86
+ clear?: SidebarSpaceActionData
87
+ }
88
+ /** Payload of the `spaceChange` event. */
89
+ export declare interface SidebarSpaceChangeEvent {
90
+ id: string
91
+ index: number
92
+ source: 'swipe' | 'switcher' | 'keyboard' | 'native' | 'restore' | 'api'
93
+ }
94
+ /** A space with its palette resolved and its inline custom properties built. */
95
+ export declare interface NormalizedSidebarSpace {
96
+ id: string
97
+ label: string
98
+ icon: string
99
+ pinned: SidebarPinnedItemData[]
100
+ sections: SidebarSectionData[]
101
+ action: SidebarSpaceActionData | null
102
+ clear: SidebarSpaceActionData | null
103
+ tint: SidebarSpaceTint
104
+ style: string
105
+ }
@@ -30,6 +30,11 @@ export declare function resolveIconColor(color?: string): string | undefined;
30
30
  * when the window resigns key it falls back to a neutral fill with the label
31
31
  * left dark. Icons desaturate to gray in the same non-key state.
32
32
  *
33
+ * The other first-class theme is `arc`, a recreation of the Arc browser's
34
+ * sidebar. It inverts the macOS selection model — a raised white card on a
35
+ * warm tinted panel instead of an accent fill on gray — so it uses the
36
+ * `classes` selection model rather than `accent`. See its own block below.
37
+ *
33
38
  * Legacy themes (`workspace`, `desktop`, `solid`, `transparent`, `vibrancy`)
34
39
  * are preserved verbatim from the previous variant maps. `tahoe` now aliases
35
40
  * `macos` — it always meant "look like macOS", and now it actually does.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.118",
4
+ "version": "0.2.120",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -63,8 +63,8 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@cwcss/crosswind": "^0.2.12",
66
- "@stacksjs/stx": "0.2.118",
67
- "bun-plugin-stx": "0.2.118",
66
+ "@stacksjs/stx": "0.2.120",
67
+ "bun-plugin-stx": "0.2.120",
68
68
  "ts-syntax-highlighter": "^0.2.1"
69
69
  },
70
70
  "devDependencies": {