@xenosystem/blocks 0.25.0 → 0.26.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.
@@ -5,15 +5,149 @@ import {
5
5
  import "../chunk-2KG3PWR4.js";
6
6
 
7
7
  // src/shell/PlatformShell.tsx
8
- import { useState } from "react";
8
+ import { useState as useState2 } from "react";
9
9
  import {
10
+ PLATFORM_MODES as PLATFORM_MODES2,
10
11
  buildPlatformThemeCssVars,
11
- getClosestPlatformTheme,
12
- normalizePlatformBrightness
12
+ getClosestPlatformTheme as getClosestPlatformTheme2,
13
+ getPlatformMode,
14
+ normalizePlatformBrightness as normalizePlatformBrightness2
13
15
  } from "@xenosystem/elements/tokens";
14
16
 
15
- // src/shell/PlatformUpdatePill.tsx
17
+ // src/shell/ModeSwitcherLayer.tsx
18
+ import { useEffect, useRef } from "react";
19
+ import { PLATFORM_MODES } from "@xenosystem/elements/tokens";
16
20
  import { jsx, jsxs } from "react/jsx-runtime";
21
+ function ModeSwitcherLayer({
22
+ open,
23
+ onClose,
24
+ activeModeId,
25
+ onSelectMode,
26
+ modes = PLATFORM_MODES,
27
+ enableShortcuts = true,
28
+ className
29
+ }) {
30
+ const gridRef = useRef(null);
31
+ useEffect(() => {
32
+ if (!enableShortcuts || typeof window === "undefined") return;
33
+ const onKeyDown = (e) => {
34
+ if (e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
35
+ const digit = Number(e.key);
36
+ if (Number.isInteger(digit) && digit >= 0 && digit < modes.length) {
37
+ const target = modes[digit];
38
+ if (target) {
39
+ e.preventDefault();
40
+ onSelectMode(target.id);
41
+ if (open) onClose();
42
+ }
43
+ }
44
+ } else if (e.key === "Escape" && open) {
45
+ e.preventDefault();
46
+ onClose();
47
+ }
48
+ };
49
+ window.addEventListener("keydown", onKeyDown);
50
+ return () => window.removeEventListener("keydown", onKeyDown);
51
+ }, [enableShortcuts, modes, onSelectMode, open, onClose]);
52
+ useEffect(() => {
53
+ if (!open) return;
54
+ const activeBtn = gridRef.current?.querySelector('[aria-pressed="true"]');
55
+ activeBtn?.focus();
56
+ }, [open]);
57
+ if (!open) return null;
58
+ const onCardKeyDown = (e, index) => {
59
+ const buttons = gridRef.current?.querySelectorAll(".xeno-ps-mode-card");
60
+ if (!buttons || buttons.length === 0) return;
61
+ let next = -1;
62
+ if (e.key === "ArrowRight") next = (index + 1) % buttons.length;
63
+ else if (e.key === "ArrowLeft") next = (index - 1 + buttons.length) % buttons.length;
64
+ else if (e.key === "ArrowDown") next = (index + 4) % buttons.length;
65
+ else if (e.key === "ArrowUp") next = (index - 4 + buttons.length) % buttons.length;
66
+ if (next >= 0) {
67
+ e.preventDefault();
68
+ buttons[next]?.focus();
69
+ }
70
+ };
71
+ return /* @__PURE__ */ jsx(
72
+ "div",
73
+ {
74
+ className: className ? `xeno-ps-mode-backdrop ${className}` : "xeno-ps-mode-backdrop",
75
+ "data-xeno-node": "mode-switcher-layer",
76
+ "data-xeno-actions": "select-mode,close",
77
+ onMouseDown: (e) => {
78
+ if (e.target === e.currentTarget) onClose();
79
+ },
80
+ children: /* @__PURE__ */ jsxs(
81
+ "div",
82
+ {
83
+ className: "xeno-ps-mode-dialog",
84
+ role: "dialog",
85
+ "aria-modal": "true",
86
+ "aria-label": "Switch XENO Platform mode",
87
+ children: [
88
+ /* @__PURE__ */ jsxs("div", { className: "xeno-ps-mode-head", children: [
89
+ /* @__PURE__ */ jsxs("div", { children: [
90
+ /* @__PURE__ */ jsx("div", { className: "xeno-ps-mode-title", children: "Workspace Mode" }),
91
+ /* @__PURE__ */ jsx("div", { className: "xeno-ps-mode-sub", children: "Press Alt+0 through Alt+7 anywhere to switch instantly" })
92
+ ] }),
93
+ /* @__PURE__ */ jsx(
94
+ "button",
95
+ {
96
+ type: "button",
97
+ className: "sb-ib",
98
+ "aria-label": "Close mode switcher",
99
+ onClick: onClose,
100
+ children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2.5 2.5l7 7M9.5 2.5l-7 7" }) })
101
+ }
102
+ )
103
+ ] }),
104
+ /* @__PURE__ */ jsx("div", { ref: gridRef, className: "xeno-ps-mode-grid", children: modes.map((mode, idx) => {
105
+ const isActive = mode.id === activeModeId;
106
+ return /* @__PURE__ */ jsxs(
107
+ "button",
108
+ {
109
+ type: "button",
110
+ className: "xeno-ps-mode-card",
111
+ "aria-pressed": isActive,
112
+ "data-active": isActive ? "true" : void 0,
113
+ "data-mode-id": mode.id,
114
+ onKeyDown: (e) => onCardKeyDown(e, idx),
115
+ onClick: () => {
116
+ onSelectMode(mode.id);
117
+ onClose();
118
+ },
119
+ children: [
120
+ /* @__PURE__ */ jsxs("div", { className: "xeno-ps-mode-card-top", children: [
121
+ /* @__PURE__ */ jsx(
122
+ "span",
123
+ {
124
+ className: "xeno-ps-mode-swatch",
125
+ style: { background: mode.color },
126
+ "aria-hidden": "true"
127
+ }
128
+ ),
129
+ /* @__PURE__ */ jsx("span", { className: "xeno-ps-mode-name", children: mode.name }),
130
+ /* @__PURE__ */ jsx("kbd", { className: "xeno-ps-mode-kbd", children: mode.shortcut })
131
+ ] }),
132
+ /* @__PURE__ */ jsx("div", { className: "xeno-ps-mode-summary", children: mode.summary }),
133
+ /* @__PURE__ */ jsxs("div", { className: "xeno-ps-mode-count", children: [
134
+ mode.productCount,
135
+ " products"
136
+ ] })
137
+ ]
138
+ },
139
+ mode.id
140
+ );
141
+ }) })
142
+ ]
143
+ }
144
+ )
145
+ }
146
+ );
147
+ }
148
+
149
+ // src/shell/PlatformUpdatePill.tsx
150
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
17
151
  function sanitizeErrorCode(code) {
18
152
  const cleaned = code.replace(/[^A-Za-z0-9_.-]/g, "").slice(0, 32);
19
153
  return cleaned || "UNKNOWN";
@@ -40,7 +174,7 @@ function PlatformUpdatePill({
40
174
  switch (status.state) {
41
175
  case "idle": {
42
176
  if (!onCheckForUpdates) return null;
43
- return /* @__PURE__ */ jsx(
177
+ return /* @__PURE__ */ jsx2(
44
178
  "button",
45
179
  {
46
180
  type: "button",
@@ -49,12 +183,12 @@ function PlatformUpdatePill({
49
183
  "data-no-drag": "true",
50
184
  "aria-label": "Check for updates",
51
185
  onClick: onCheckForUpdates,
52
- children: /* @__PURE__ */ jsx("span", { children: "Check updates" })
186
+ children: /* @__PURE__ */ jsx2("span", { children: "Check updates" })
53
187
  }
54
188
  );
55
189
  }
56
190
  case "checking": {
57
- return /* @__PURE__ */ jsxs(
191
+ return /* @__PURE__ */ jsxs2(
58
192
  "button",
59
193
  {
60
194
  type: "button",
@@ -65,15 +199,15 @@ function PlatformUpdatePill({
65
199
  "aria-live": "polite",
66
200
  "aria-label": "Checking for updates",
67
201
  children: [
68
- /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
69
- /* @__PURE__ */ jsx("span", { children: "Checking\u2026" })
202
+ /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
203
+ /* @__PURE__ */ jsx2("span", { children: "Checking\u2026" })
70
204
  ]
71
205
  }
72
206
  );
73
207
  }
74
208
  case "up-to-date": {
75
209
  const ver = formatVersion(status.version);
76
- return /* @__PURE__ */ jsxs(
210
+ return /* @__PURE__ */ jsxs2(
77
211
  "button",
78
212
  {
79
213
  type: "button",
@@ -85,15 +219,15 @@ function PlatformUpdatePill({
85
219
  title: onCheckForUpdates ? `Up to date (${ver}) \u2014 click to re-check` : `Up to date (${ver})`,
86
220
  onClick: onCheckForUpdates,
87
221
  children: [
88
- /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
89
- /* @__PURE__ */ jsx("span", { children: ver || "Up to date" })
222
+ /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
223
+ /* @__PURE__ */ jsx2("span", { children: ver || "Up to date" })
90
224
  ]
91
225
  }
92
226
  );
93
227
  }
94
228
  case "available": {
95
229
  const ver = formatVersion(status.version);
96
- return /* @__PURE__ */ jsxs(
230
+ return /* @__PURE__ */ jsxs2(
97
231
  "button",
98
232
  {
99
233
  type: "button",
@@ -104,8 +238,8 @@ function PlatformUpdatePill({
104
238
  "aria-label": `Download update ${ver}`.trim(),
105
239
  onClick: onDownloadUpdate,
106
240
  children: [
107
- /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
108
- /* @__PURE__ */ jsx("span", { children: ver ? `Update ${ver}` : "Update available" })
241
+ /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
242
+ /* @__PURE__ */ jsx2("span", { children: ver ? `Update ${ver}` : "Update available" })
109
243
  ]
110
244
  }
111
245
  );
@@ -113,7 +247,7 @@ function PlatformUpdatePill({
113
247
  case "downloading": {
114
248
  const pct = clampPercent(status.percent);
115
249
  const ver = formatVersion(status.version);
116
- return /* @__PURE__ */ jsxs(
250
+ return /* @__PURE__ */ jsxs2(
117
251
  "button",
118
252
  {
119
253
  type: "button",
@@ -124,15 +258,15 @@ function PlatformUpdatePill({
124
258
  "aria-live": "polite",
125
259
  "aria-label": pct !== void 0 ? `Downloading update ${ver} (${pct}%)` : `Downloading update ${ver}`,
126
260
  children: [
127
- /* @__PURE__ */ jsx("span", { children: pct !== void 0 ? `Downloading ${pct}%` : "Downloading\u2026" }),
128
- pct !== void 0 ? /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-bar", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-fill", style: { width: `${pct}%` } }) }) : null
261
+ /* @__PURE__ */ jsx2("span", { children: pct !== void 0 ? `Downloading ${pct}%` : "Downloading\u2026" }),
262
+ pct !== void 0 ? /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-bar", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-fill", style: { width: `${pct}%` } }) }) : null
129
263
  ]
130
264
  }
131
265
  );
132
266
  }
133
267
  case "ready": {
134
268
  const ver = formatVersion(status.version);
135
- return /* @__PURE__ */ jsx(
269
+ return /* @__PURE__ */ jsx2(
136
270
  "button",
137
271
  {
138
272
  type: "button",
@@ -142,12 +276,12 @@ function PlatformUpdatePill({
142
276
  disabled: !onInstallAndRestart,
143
277
  "aria-label": ver ? `Restart to install update ${ver}` : "Restart to update",
144
278
  onClick: onInstallAndRestart,
145
- children: /* @__PURE__ */ jsx("span", { children: "Restart to update" })
279
+ children: /* @__PURE__ */ jsx2("span", { children: "Restart to update" })
146
280
  }
147
281
  );
148
282
  }
149
283
  case "signed-out": {
150
- return /* @__PURE__ */ jsxs(
284
+ return /* @__PURE__ */ jsxs2(
151
285
  "button",
152
286
  {
153
287
  type: "button",
@@ -158,14 +292,14 @@ function PlatformUpdatePill({
158
292
  "aria-label": "Sign in for updates",
159
293
  onClick: onSignIn,
160
294
  children: [
161
- /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
162
- /* @__PURE__ */ jsx("span", { children: "Sign in for updates" })
295
+ /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
296
+ /* @__PURE__ */ jsx2("span", { children: "Sign in for updates" })
163
297
  ]
164
298
  }
165
299
  );
166
300
  }
167
301
  case "not-entitled": {
168
- return /* @__PURE__ */ jsxs(
302
+ return /* @__PURE__ */ jsxs2(
169
303
  "button",
170
304
  {
171
305
  type: "button",
@@ -176,15 +310,15 @@ function PlatformUpdatePill({
176
310
  "aria-label": "Manage plan for updates",
177
311
  onClick: onManagePlan,
178
312
  children: [
179
- /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
180
- /* @__PURE__ */ jsx("span", { children: "Manage plan" })
313
+ /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
314
+ /* @__PURE__ */ jsx2("span", { children: "Manage plan" })
181
315
  ]
182
316
  }
183
317
  );
184
318
  }
185
319
  case "error": {
186
320
  const safeCode = sanitizeErrorCode(status.code);
187
- return /* @__PURE__ */ jsxs(
321
+ return /* @__PURE__ */ jsxs2(
188
322
  "button",
189
323
  {
190
324
  type: "button",
@@ -196,8 +330,8 @@ function PlatformUpdatePill({
196
330
  title: onCheckForUpdates ? `Update error (${safeCode}) \u2014 click to retry` : `Update error (${safeCode})`,
197
331
  onClick: onCheckForUpdates,
198
332
  children: [
199
- /* @__PURE__ */ jsx("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
200
- /* @__PURE__ */ jsx("span", { children: "Update failed" })
333
+ /* @__PURE__ */ jsx2("span", { className: "xeno-ps-update-pip", "aria-hidden": "true" }),
334
+ /* @__PURE__ */ jsx2("span", { children: "Update failed" })
201
335
  ]
202
336
  }
203
337
  );
@@ -205,6 +339,75 @@ function PlatformUpdatePill({
205
339
  }
206
340
  }
207
341
 
342
+ // src/shell/RailPopover.tsx
343
+ import { useEffect as useEffect2, useRef as useRef2 } from "react";
344
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
345
+ function RailPopover({
346
+ open,
347
+ title,
348
+ subtitle,
349
+ items,
350
+ activeItemId,
351
+ onSelectItem,
352
+ onClose
353
+ }) {
354
+ const ref = useRef2(null);
355
+ useEffect2(() => {
356
+ if (!open) return;
357
+ const onPointer = (e) => {
358
+ if (!ref.current?.contains(e.target)) onClose();
359
+ };
360
+ const onKey = (e) => {
361
+ if (e.key === "Escape") onClose();
362
+ };
363
+ document.addEventListener("mousedown", onPointer);
364
+ document.addEventListener("keydown", onKey);
365
+ return () => {
366
+ document.removeEventListener("mousedown", onPointer);
367
+ document.removeEventListener("keydown", onKey);
368
+ };
369
+ }, [open, onClose]);
370
+ if (!open) return null;
371
+ return /* @__PURE__ */ jsxs3(
372
+ "div",
373
+ {
374
+ ref,
375
+ className: "xeno-ps-rail-pop",
376
+ role: "dialog",
377
+ "aria-label": `${title} navigation`,
378
+ "data-xeno-node": "rail-flyout-popover",
379
+ children: [
380
+ /* @__PURE__ */ jsx3("div", { className: "xeno-ps-rail-pop-head", children: /* @__PURE__ */ jsxs3("div", { className: "xeno-ps-rail-pop-ttl", children: [
381
+ title,
382
+ subtitle ? /* @__PURE__ */ jsx3("small", { children: subtitle }) : null
383
+ ] }) }),
384
+ /* @__PURE__ */ jsx3("div", { className: "xeno-ps-rail-pop-body", children: items.map((item) => {
385
+ const isCurrent = item.active !== void 0 ? item.active : item.id === activeItemId;
386
+ return /* @__PURE__ */ jsxs3(
387
+ "button",
388
+ {
389
+ type: "button",
390
+ className: "sb-row",
391
+ disabled: item.disabled,
392
+ "aria-current": isCurrent ? "true" : void 0,
393
+ onClick: () => {
394
+ onSelectItem?.(item.id);
395
+ onClose();
396
+ },
397
+ children: [
398
+ item.icon != null ? /* @__PURE__ */ jsx3("span", { className: "sb-row-icon", "aria-hidden": "true", children: item.icon }) : null,
399
+ /* @__PURE__ */ jsx3("span", { className: "sb-row-label", children: item.label }),
400
+ item.meta != null ? /* @__PURE__ */ jsx3("span", { className: "meta", children: item.meta }) : null
401
+ ]
402
+ },
403
+ item.id
404
+ );
405
+ }) })
406
+ ]
407
+ }
408
+ );
409
+ }
410
+
208
411
  // src/shell/styles.ts
209
412
  var STYLE_ELEMENT_ID = "xeno-platform-shell-block-styles";
210
413
  var PLATFORM_SHELL_CSS = `
@@ -266,17 +469,15 @@ var PLATFORM_SHELL_CSS = `
266
469
  .xeno-ps-root .xeno-app-rail::after {
267
470
  content: '';
268
471
  position: absolute;
269
- right: 0;
270
- top: 0;
271
- bottom: 0;
472
+ inset-inline-end: 0;
473
+ inset-block: 0;
272
474
  width: 1px;
273
475
  background: var(--xeno-rail-stroke);
274
- transition: top 260ms var(--xeno-ease-open), bottom 260ms var(--xeno-ease-open);
476
+ transition: inset-block 260ms var(--xeno-ease-open);
275
477
  }
276
478
 
277
479
  .xeno-ps-root .xeno-app-shell[data-sidebar='open'] .xeno-app-rail::after {
278
- top: calc(var(--xeno-layout-flare) + 1px);
279
- bottom: calc(var(--xeno-layout-flare) + 1px);
480
+ inset-block: calc(var(--xeno-layout-flare) + 1px);
280
481
  }
281
482
 
282
483
  .xeno-ps-root .xeno-app-rail-logo {
@@ -395,7 +596,9 @@ var PLATFORM_SHELL_CSS = `
395
596
  position: relative;
396
597
  flex: none;
397
598
  width: calc(var(--xeno-layout-sidebar-w) + var(--xeno-layout-gap));
398
- padding: var(--xeno-layout-gap-y) 0 var(--xeno-layout-gap-y) var(--xeno-layout-gap);
599
+ padding-block: var(--xeno-layout-gap-y);
600
+ padding-inline-start: var(--xeno-layout-gap);
601
+ padding-inline-end: 0;
399
602
  display: flex;
400
603
  min-height: 0;
401
604
  z-index: 20;
@@ -416,7 +619,7 @@ var PLATFORM_SHELL_CSS = `
416
619
  .xeno-ps-root .xeno-app-slot::after {
417
620
  content: '';
418
621
  position: absolute;
419
- left: 0;
622
+ inset-inline-start: 0;
420
623
  width: calc(var(--xeno-fr) + 1px);
421
624
  height: calc(var(--xeno-fr) + 1px);
422
625
  pointer-events: none;
@@ -445,6 +648,28 @@ var PLATFORM_SHELL_CSS = `
445
648
  );
446
649
  }
447
650
 
651
+ [dir='rtl'] .xeno-ps-root .xeno-app-slot::before,
652
+ .xeno-ps-root[dir='rtl'] .xeno-app-slot::before {
653
+ background: radial-gradient(
654
+ circle at 0% 100%,
655
+ transparent calc(var(--xeno-fr) - 0.4px),
656
+ var(--xeno-rail-stroke) var(--xeno-fr),
657
+ var(--xeno-rail-stroke) calc(var(--xeno-fr) + 0.6px),
658
+ var(--xeno-rail-bg) calc(var(--xeno-fr) + 1px)
659
+ );
660
+ }
661
+
662
+ [dir='rtl'] .xeno-ps-root .xeno-app-slot::after,
663
+ .xeno-ps-root[dir='rtl'] .xeno-app-slot::after {
664
+ background: radial-gradient(
665
+ circle at 0% 0%,
666
+ transparent calc(var(--xeno-fr) - 0.4px),
667
+ var(--xeno-rail-stroke) var(--xeno-fr),
668
+ var(--xeno-rail-stroke) calc(var(--xeno-fr) + 0.6px),
669
+ var(--xeno-rail-bg) calc(var(--xeno-fr) + 1px)
670
+ );
671
+ }
672
+
448
673
  .xeno-ps-root .xeno-app-sidebar {
449
674
  flex: 1 1 auto;
450
675
  display: flex;
@@ -835,12 +1060,271 @@ var PLATFORM_SHELL_CSS = `
835
1060
  display: inline-flex;
836
1061
  align-items: center;
837
1062
  gap: 2px;
838
- margin-left: 4px;
839
- padding-left: 6px;
840
- border-left: 1px solid var(--xeno-border-subtle);
1063
+ margin-inline-start: 4px;
1064
+ padding-inline-start: 6px;
1065
+ border-inline-start: 1px solid var(--xeno-border-subtle);
1066
+ flex: none;
1067
+ }
1068
+
1069
+ /* \u2500\u2500 21-Stop Brightness Popover, Rail Flyout & 8-Mode Switcher Layer \u2500\u2500\u2500\u2500\u2500\u2500 */
1070
+ .xeno-ps-pop-wrap {
1071
+ position: relative;
1072
+ display: inline-flex;
1073
+ align-items: center;
1074
+ }
1075
+
1076
+ .xeno-ps-theme-pop {
1077
+ position: absolute;
1078
+ top: calc(100% + 6px);
1079
+ inset-inline-end: 0;
1080
+ z-index: 80;
1081
+ width: 224px;
1082
+ padding: 10px 12px;
1083
+ border-radius: 10px;
1084
+ background: var(--xeno-elevated, var(--xeno-surface));
1085
+ border: 1px solid var(--xeno-border-strong, var(--xeno-border));
1086
+ box-shadow: var(--xeno-pop, none);
1087
+ display: flex;
1088
+ flex-direction: column;
1089
+ gap: 8px;
1090
+ }
1091
+
1092
+ .xeno-ps-theme-pop-head {
1093
+ display: flex;
1094
+ align-items: center;
1095
+ justify-content: space-between;
1096
+ font-size: 11.5px;
1097
+ font-weight: 600;
1098
+ color: var(--xeno-text);
1099
+ }
1100
+
1101
+ .xeno-ps-theme-pop-val {
1102
+ font-variant-numeric: tabular-nums;
1103
+ color: var(--xeno-muted-text);
1104
+ font-size: 11px;
1105
+ }
1106
+
1107
+ .xeno-ps-theme-presets {
1108
+ display: grid;
1109
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1110
+ gap: 4px;
1111
+ }
1112
+
1113
+ .xeno-ps-theme-preset {
1114
+ appearance: none;
1115
+ height: 24px;
1116
+ border-radius: 6px;
1117
+ border: 1px solid var(--xeno-border);
1118
+ background: var(--xeno-control);
1119
+ color: var(--xeno-muted-text);
1120
+ font-size: 11px;
1121
+ font-weight: 500;
1122
+ cursor: pointer;
1123
+ }
1124
+
1125
+ .xeno-ps-theme-preset:hover {
1126
+ color: var(--xeno-text);
1127
+ background: var(--xeno-hover-strong);
1128
+ }
1129
+
1130
+ .xeno-ps-theme-preset[data-active='true'] {
1131
+ background: var(--xeno-accent);
1132
+ color: var(--xeno-accent-text);
1133
+ border-color: transparent;
1134
+ font-weight: 600;
1135
+ }
1136
+
1137
+ .xeno-ps-theme-slider-row {
1138
+ display: flex;
1139
+ align-items: center;
1140
+ }
1141
+
1142
+ .xeno-ps-theme-range {
1143
+ width: 100%;
1144
+ accent-color: var(--xeno-accent);
1145
+ cursor: pointer;
1146
+ }
1147
+
1148
+ .xeno-ps-mode-trigger {
1149
+ appearance: none;
1150
+ display: inline-flex;
1151
+ align-items: center;
1152
+ gap: 6px;
1153
+ height: 26px;
1154
+ padding-inline: 8px;
1155
+ border-radius: 6px;
1156
+ border: 1px solid var(--xeno-border);
1157
+ background: var(--xeno-control);
1158
+ color: var(--xeno-text);
1159
+ font-size: 11.5px;
1160
+ font-weight: 600;
1161
+ cursor: pointer;
1162
+ flex: none;
1163
+ }
1164
+
1165
+ .xeno-ps-mode-trigger:hover {
1166
+ background: var(--xeno-hover-strong);
1167
+ }
1168
+
1169
+ .xeno-ps-mode-swatch {
1170
+ width: 7px;
1171
+ height: 7px;
1172
+ border-radius: 2px;
841
1173
  flex: none;
842
1174
  }
843
1175
 
1176
+ .xeno-ps-mode-backdrop {
1177
+ position: fixed;
1178
+ inset: 0;
1179
+ z-index: 90;
1180
+ display: grid;
1181
+ place-items: center;
1182
+ padding: 20px;
1183
+ background: color-mix(in srgb, var(--xeno-canvas) 74%, transparent);
1184
+ }
1185
+
1186
+ .xeno-ps-mode-dialog {
1187
+ width: min(720px, 100%);
1188
+ border-radius: 14px;
1189
+ background: var(--xeno-surface);
1190
+ border: 1px solid var(--xeno-border-strong, var(--xeno-border));
1191
+ box-shadow: var(--xeno-pop, none);
1192
+ overflow: hidden;
1193
+ display: flex;
1194
+ flex-direction: column;
1195
+ }
1196
+
1197
+ .xeno-ps-mode-head {
1198
+ display: flex;
1199
+ align-items: center;
1200
+ justify-content: space-between;
1201
+ gap: 12px;
1202
+ padding: 12px 14px;
1203
+ border-bottom: 1px solid var(--xeno-border-subtle);
1204
+ }
1205
+
1206
+ .xeno-ps-mode-title {
1207
+ font-size: 13.5px;
1208
+ font-weight: 600;
1209
+ color: var(--xeno-text);
1210
+ }
1211
+
1212
+ .xeno-ps-mode-sub {
1213
+ font-size: 11.5px;
1214
+ color: var(--xeno-muted-text);
1215
+ margin-top: 2px;
1216
+ }
1217
+
1218
+ .xeno-ps-mode-grid {
1219
+ display: grid;
1220
+ grid-template-columns: repeat(4, minmax(0, 1fr));
1221
+ gap: 8px;
1222
+ padding: 12px;
1223
+ }
1224
+
1225
+ .xeno-ps-mode-card {
1226
+ appearance: none;
1227
+ display: flex;
1228
+ flex-direction: column;
1229
+ gap: 6px;
1230
+ padding: 10px;
1231
+ border-radius: 10px;
1232
+ border: 1px solid var(--xeno-border);
1233
+ background: var(--xeno-canvas);
1234
+ color: var(--xeno-text);
1235
+ text-align: start;
1236
+ cursor: pointer;
1237
+ transition: background 120ms ease, border-color 120ms ease;
1238
+ }
1239
+
1240
+ .xeno-ps-mode-card:hover {
1241
+ background: var(--xeno-hover);
1242
+ border-color: var(--xeno-border-strong, var(--xeno-border));
1243
+ }
1244
+
1245
+ .xeno-ps-mode-card[data-active='true'] {
1246
+ background: var(--xeno-control);
1247
+ border-color: var(--xeno-accent);
1248
+ }
1249
+
1250
+ .xeno-ps-mode-card-top {
1251
+ display: flex;
1252
+ align-items: center;
1253
+ gap: 6px;
1254
+ }
1255
+
1256
+ .xeno-ps-mode-name {
1257
+ font-size: 12.5px;
1258
+ font-weight: 600;
1259
+ flex: 1 1 auto;
1260
+ }
1261
+
1262
+ .xeno-ps-mode-kbd {
1263
+ font-size: 10px;
1264
+ padding: 1px 5px;
1265
+ border-radius: 4px;
1266
+ border: 1px solid var(--xeno-border);
1267
+ background: var(--xeno-surface);
1268
+ color: var(--xeno-muted-text);
1269
+ }
1270
+
1271
+ .xeno-ps-mode-summary {
1272
+ font-size: 11px;
1273
+ line-height: 1.35;
1274
+ color: var(--xeno-muted-text);
1275
+ }
1276
+
1277
+ .xeno-ps-mode-count {
1278
+ font-size: 10.5px;
1279
+ color: var(--xeno-dim-text);
1280
+ margin-top: auto;
1281
+ font-variant-numeric: tabular-nums;
1282
+ }
1283
+
1284
+ .xeno-ps-rail-pop {
1285
+ position: absolute;
1286
+ top: 56px;
1287
+ inset-inline-start: calc(var(--xeno-layout-rail-w) + 8px);
1288
+ z-index: 70;
1289
+ width: 224px;
1290
+ border-radius: 12px;
1291
+ background: var(--xeno-surface);
1292
+ border: 1px solid var(--xeno-border-strong, var(--xeno-border));
1293
+ box-shadow: var(--xeno-pop, none);
1294
+ overflow: hidden;
1295
+ }
1296
+
1297
+ .xeno-ps-rail-pop-head {
1298
+ padding: 10px 12px;
1299
+ border-bottom: 1px solid var(--xeno-border-subtle);
1300
+ }
1301
+
1302
+ .xeno-ps-rail-pop-ttl {
1303
+ font-size: 12.5px;
1304
+ font-weight: 600;
1305
+ color: var(--xeno-text);
1306
+ }
1307
+
1308
+ .xeno-ps-rail-pop-ttl small {
1309
+ display: block;
1310
+ font-weight: 400;
1311
+ font-size: 10.5px;
1312
+ color: var(--xeno-dim-text);
1313
+ }
1314
+
1315
+ .xeno-ps-rail-pop-body {
1316
+ padding: 6px;
1317
+ display: flex;
1318
+ flex-direction: column;
1319
+ gap: 2px;
1320
+ }
1321
+
1322
+ @media (max-width: 640px) {
1323
+ .xeno-ps-mode-grid {
1324
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1325
+ }
1326
+ }
1327
+
844
1328
  .xeno-ps-win-btn {
845
1329
  appearance: none;
846
1330
  width: 28px;
@@ -921,8 +1405,134 @@ function ensurePlatformShellStyles() {
921
1405
  document.head.appendChild(style);
922
1406
  }
923
1407
 
1408
+ // src/shell/ThemeBrightnessPopover.tsx
1409
+ import { useEffect as useEffect3, useRef as useRef3, useState } from "react";
1410
+ import {
1411
+ PLATFORM_BRIGHTNESS_STEP,
1412
+ PLATFORM_THEME_OPTIONS,
1413
+ getClosestPlatformTheme,
1414
+ normalizePlatformBrightness
1415
+ } from "@xenosystem/elements/tokens";
1416
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1417
+ function labelFor(position) {
1418
+ const closest = getClosestPlatformTheme(position);
1419
+ if (closest === "dim") return "Dim";
1420
+ if (closest === "light") return "Light";
1421
+ return "Dark";
1422
+ }
1423
+ function ThemeBrightnessPopover({
1424
+ position,
1425
+ onChange,
1426
+ className
1427
+ }) {
1428
+ const [open, setOpen] = useState(false);
1429
+ const rootRef = useRef3(null);
1430
+ const norm = normalizePlatformBrightness(position);
1431
+ useEffect3(() => {
1432
+ if (!open) return;
1433
+ const onPointer = (e) => {
1434
+ if (!rootRef.current?.contains(e.target)) setOpen(false);
1435
+ };
1436
+ const onKey = (e) => {
1437
+ if (e.key === "Escape") setOpen(false);
1438
+ };
1439
+ document.addEventListener("mousedown", onPointer);
1440
+ document.addEventListener("keydown", onKey);
1441
+ return () => {
1442
+ document.removeEventListener("mousedown", onPointer);
1443
+ document.removeEventListener("keydown", onKey);
1444
+ };
1445
+ }, [open]);
1446
+ return /* @__PURE__ */ jsxs4(
1447
+ "div",
1448
+ {
1449
+ ref: rootRef,
1450
+ className: className ? `xeno-ps-pop-wrap ${className}` : "xeno-ps-pop-wrap",
1451
+ "data-no-drag": "true",
1452
+ "data-xeno-node": "theme-brightness-control",
1453
+ "data-xeno-actions": "toggle-theme-popover,set-brightness",
1454
+ children: [
1455
+ /* @__PURE__ */ jsxs4(
1456
+ "button",
1457
+ {
1458
+ type: "button",
1459
+ className: "xeno-ps-theme-btn",
1460
+ "aria-haspopup": "dialog",
1461
+ "aria-expanded": open,
1462
+ "aria-label": `Theme brightness (${labelFor(norm)} ${norm}%)`,
1463
+ title: `Theme: ${labelFor(norm)} (${norm}%)`,
1464
+ onClick: () => setOpen((v) => !v),
1465
+ children: [
1466
+ /* @__PURE__ */ jsxs4(
1467
+ "svg",
1468
+ {
1469
+ width: "12",
1470
+ height: "12",
1471
+ viewBox: "0 0 16 16",
1472
+ fill: "none",
1473
+ stroke: "currentColor",
1474
+ strokeWidth: "1.5",
1475
+ "aria-hidden": "true",
1476
+ children: [
1477
+ /* @__PURE__ */ jsx4("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2.5" }),
1478
+ /* @__PURE__ */ jsx4("path", { d: "M8 2v12" })
1479
+ ]
1480
+ }
1481
+ ),
1482
+ /* @__PURE__ */ jsx4("span", { className: "xeno-ps-theme-label", children: labelFor(norm) })
1483
+ ]
1484
+ }
1485
+ ),
1486
+ open ? /* @__PURE__ */ jsxs4(
1487
+ "div",
1488
+ {
1489
+ className: "xeno-ps-theme-pop",
1490
+ role: "dialog",
1491
+ "aria-label": "Theme brightness controls",
1492
+ children: [
1493
+ /* @__PURE__ */ jsxs4("div", { className: "xeno-ps-theme-pop-head", children: [
1494
+ /* @__PURE__ */ jsx4("span", { children: "Brightness" }),
1495
+ /* @__PURE__ */ jsxs4("span", { className: "xeno-ps-theme-pop-val", children: [
1496
+ norm,
1497
+ "%"
1498
+ ] })
1499
+ ] }),
1500
+ /* @__PURE__ */ jsx4("div", { className: "xeno-ps-theme-presets", role: "group", "aria-label": "Theme presets", children: PLATFORM_THEME_OPTIONS.map((opt) => /* @__PURE__ */ jsx4(
1501
+ "button",
1502
+ {
1503
+ type: "button",
1504
+ className: "xeno-ps-theme-preset",
1505
+ "data-active": norm === opt.position ? "true" : void 0,
1506
+ "aria-pressed": norm === opt.position,
1507
+ onClick: () => onChange(opt.position),
1508
+ children: opt.label
1509
+ },
1510
+ opt.id
1511
+ )) }),
1512
+ /* @__PURE__ */ jsx4("div", { className: "xeno-ps-theme-slider-row", children: /* @__PURE__ */ jsx4(
1513
+ "input",
1514
+ {
1515
+ type: "range",
1516
+ className: "xeno-ps-theme-range",
1517
+ min: 0,
1518
+ max: 100,
1519
+ step: PLATFORM_BRIGHTNESS_STEP,
1520
+ value: norm,
1521
+ "aria-label": "Continuous theme brightness",
1522
+ "aria-valuetext": `${labelFor(norm)} ${norm}%`,
1523
+ onChange: (e) => onChange(Number(e.target.value))
1524
+ }
1525
+ ) })
1526
+ ]
1527
+ }
1528
+ ) : null
1529
+ ]
1530
+ }
1531
+ );
1532
+ }
1533
+
924
1534
  // src/shell/WindowControls.tsx
925
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
1535
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
926
1536
  function WindowControls({
927
1537
  onMinimize,
928
1538
  onMaximize,
@@ -935,7 +1545,7 @@ function WindowControls({
935
1545
  className
936
1546
  }) {
937
1547
  if (!onMinimize && !onMaximize && !onClose) return null;
938
- return /* @__PURE__ */ jsxs2(
1548
+ return /* @__PURE__ */ jsxs5(
939
1549
  "div",
940
1550
  {
941
1551
  className: className ? `xeno-ps-win ${className}` : "xeno-ps-win",
@@ -943,7 +1553,7 @@ function WindowControls({
943
1553
  "aria-label": "Window controls",
944
1554
  "data-no-drag": "true",
945
1555
  children: [
946
- onMinimize ? /* @__PURE__ */ jsx2(
1556
+ onMinimize ? /* @__PURE__ */ jsx5(
947
1557
  "button",
948
1558
  {
949
1559
  type: "button",
@@ -952,7 +1562,7 @@ function WindowControls({
952
1562
  "aria-label": minimizeLabel,
953
1563
  title: minimizeLabel,
954
1564
  onClick: onMinimize,
955
- children: /* @__PURE__ */ jsx2(
1565
+ children: /* @__PURE__ */ jsx5(
956
1566
  "svg",
957
1567
  {
958
1568
  width: "10",
@@ -962,12 +1572,12 @@ function WindowControls({
962
1572
  stroke: "currentColor",
963
1573
  strokeWidth: "1.25",
964
1574
  "aria-hidden": "true",
965
- children: /* @__PURE__ */ jsx2("path", { d: "M1.5 5.5h7" })
1575
+ children: /* @__PURE__ */ jsx5("path", { d: "M1.5 5.5h7" })
966
1576
  }
967
1577
  )
968
1578
  }
969
1579
  ) : null,
970
- onMaximize ? /* @__PURE__ */ jsx2(
1580
+ onMaximize ? /* @__PURE__ */ jsx5(
971
1581
  "button",
972
1582
  {
973
1583
  type: "button",
@@ -976,7 +1586,7 @@ function WindowControls({
976
1586
  "aria-label": isMaximized ? restoreLabel : maximizeLabel,
977
1587
  title: isMaximized ? restoreLabel : maximizeLabel,
978
1588
  onClick: onMaximize,
979
- children: isMaximized ? /* @__PURE__ */ jsxs2(
1589
+ children: isMaximized ? /* @__PURE__ */ jsxs5(
980
1590
  "svg",
981
1591
  {
982
1592
  width: "10",
@@ -987,11 +1597,11 @@ function WindowControls({
987
1597
  strokeWidth: "1.15",
988
1598
  "aria-hidden": "true",
989
1599
  children: [
990
- /* @__PURE__ */ jsx2("rect", { x: "1.5", y: "3", width: "5.5", height: "5.5", rx: "1" }),
991
- /* @__PURE__ */ jsx2("path", { d: "M3.5 3V2a1 1 0 0 1 1-1H8a1 1 0 0 1 1 1v3.5a1 1 0 0 1-1 1H7" })
1600
+ /* @__PURE__ */ jsx5("rect", { x: "1.5", y: "3", width: "5.5", height: "5.5", rx: "1" }),
1601
+ /* @__PURE__ */ jsx5("path", { d: "M3.5 3V2a1 1 0 0 1 1-1H8a1 1 0 0 1 1 1v3.5a1 1 0 0 1-1 1H7" })
992
1602
  ]
993
1603
  }
994
- ) : /* @__PURE__ */ jsx2(
1604
+ ) : /* @__PURE__ */ jsx5(
995
1605
  "svg",
996
1606
  {
997
1607
  width: "10",
@@ -1001,12 +1611,12 @@ function WindowControls({
1001
1611
  stroke: "currentColor",
1002
1612
  strokeWidth: "1.15",
1003
1613
  "aria-hidden": "true",
1004
- children: /* @__PURE__ */ jsx2("rect", { x: "1.75", y: "1.75", width: "6.5", height: "6.5", rx: "1" })
1614
+ children: /* @__PURE__ */ jsx5("rect", { x: "1.75", y: "1.75", width: "6.5", height: "6.5", rx: "1" })
1005
1615
  }
1006
1616
  )
1007
1617
  }
1008
1618
  ) : null,
1009
- onClose ? /* @__PURE__ */ jsx2(
1619
+ onClose ? /* @__PURE__ */ jsx5(
1010
1620
  "button",
1011
1621
  {
1012
1622
  type: "button",
@@ -1015,7 +1625,7 @@ function WindowControls({
1015
1625
  "aria-label": closeLabel,
1016
1626
  title: closeLabel,
1017
1627
  onClick: onClose,
1018
- children: /* @__PURE__ */ jsx2(
1628
+ children: /* @__PURE__ */ jsx5(
1019
1629
  "svg",
1020
1630
  {
1021
1631
  width: "10",
@@ -1025,7 +1635,7 @@ function WindowControls({
1025
1635
  stroke: "currentColor",
1026
1636
  strokeWidth: "1.25",
1027
1637
  "aria-hidden": "true",
1028
- children: /* @__PURE__ */ jsx2("path", { d: "M2 2l6 6M8 2L2 8" })
1638
+ children: /* @__PURE__ */ jsx5("path", { d: "M2 2l6 6M8 2L2 8" })
1029
1639
  }
1030
1640
  )
1031
1641
  }
@@ -1036,16 +1646,16 @@ function WindowControls({
1036
1646
  }
1037
1647
 
1038
1648
  // src/shell/PlatformShell.tsx
1039
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
1649
+ import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1040
1650
  var THEME_STOP_CYCLE = [0, 50, 100];
1041
1651
  function nextThemeStop(currentPosition) {
1042
- const norm = normalizePlatformBrightness(currentPosition);
1652
+ const norm = normalizePlatformBrightness2(currentPosition);
1043
1653
  if (norm < 25) return THEME_STOP_CYCLE[1];
1044
1654
  if (norm < 75) return THEME_STOP_CYCLE[2];
1045
1655
  return THEME_STOP_CYCLE[0];
1046
1656
  }
1047
1657
  function themeLabelFor(position) {
1048
- const closest = getClosestPlatformTheme(position);
1658
+ const closest = getClosestPlatformTheme2(position);
1049
1659
  if (closest === "dim") return "Dim";
1050
1660
  if (closest === "light") return "Light";
1051
1661
  return "Dark";
@@ -1082,6 +1692,13 @@ function PlatformShell({
1082
1692
  onSignIn,
1083
1693
  onManagePlan,
1084
1694
  themeToggle = false,
1695
+ themeControlMode = "popover",
1696
+ activeModeId,
1697
+ onSelectMode,
1698
+ modes = PLATFORM_MODES2,
1699
+ modeSwitcherOpen: controlledModeOpen,
1700
+ onModeSwitcherOpenChange,
1701
+ enableModeShortcuts = true,
1085
1702
  accountSlot,
1086
1703
  onMinimize,
1087
1704
  onMaximize,
@@ -1092,21 +1709,30 @@ function PlatformShell({
1092
1709
  label = "XENO Platform Shell",
1093
1710
  className
1094
1711
  }) {
1095
- useState(() => {
1712
+ useState2(() => {
1096
1713
  ensurePlatformShellStyles();
1097
1714
  return null;
1098
1715
  });
1099
- const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultSidebarOpen);
1716
+ const [uncontrolledOpen, setUncontrolledOpen] = useState2(defaultSidebarOpen);
1717
+ const [uncontrolledModeOpen, setUncontrolledModeOpen] = useState2(false);
1718
+ const [railFlyoutId, setRailFlyoutId] = useState2(null);
1100
1719
  const hasSidebar = sidebarContent != null || sidebarSections.length > 0 || sidebarTitle != null || sidebarFooter != null;
1101
1720
  const isSidebarOpen = hasSidebar ? controlledSidebarOpen ?? uncontrolledOpen : false;
1721
+ const isModeSwitcherOpen = controlledModeOpen ?? uncontrolledModeOpen;
1722
+ const setModeOpen = (next) => {
1723
+ if (controlledModeOpen === void 0) setUncontrolledModeOpen(next);
1724
+ onModeSwitcherOpenChange?.(next);
1725
+ };
1726
+ const activeMode = activeModeId ? getPlatformMode(activeModeId) : void 0;
1727
+ const activeFlyoutItem = railFlyoutId ? railItems.find((item) => item.id === railFlyoutId && item.flyoutItems && item.flyoutItems.length > 0) : void 0;
1102
1728
  const toggleSidebar = () => {
1103
1729
  if (!hasSidebar) return;
1104
1730
  const next = !isSidebarOpen;
1105
1731
  if (controlledSidebarOpen === void 0) setUncontrolledOpen(next);
1106
1732
  onSidebarOpenChange?.(next);
1107
1733
  };
1108
- const normalizedPosition = normalizePlatformBrightness(themePosition);
1109
- const resolvedTheme = getClosestPlatformTheme(normalizedPosition);
1734
+ const normalizedPosition = normalizePlatformBrightness2(themePosition);
1735
+ const resolvedTheme = getClosestPlatformTheme2(normalizedPosition);
1110
1736
  const themeVars = buildPlatformThemeCssVars(normalizedPosition);
1111
1737
  const rootStyle = {
1112
1738
  ...themeVars,
@@ -1114,232 +1740,297 @@ function PlatformShell({
1114
1740
  colorScheme: resolvedTheme === "light" ? "light" : "dark"
1115
1741
  };
1116
1742
  const rootClass = className ? `xeno xeno-ps-root ${className}` : "xeno xeno-ps-root";
1117
- return /* @__PURE__ */ jsx3(
1743
+ return /* @__PURE__ */ jsxs6(
1118
1744
  "div",
1119
1745
  {
1120
1746
  className: rootClass,
1121
1747
  "data-layout": "platform",
1122
1748
  "data-theme": resolvedTheme,
1123
1749
  "data-theme-position": String(normalizedPosition),
1750
+ "data-xeno-node": "platform-shell",
1751
+ "data-xeno-actions": "toggle-sidebar,select-section,set-brightness,switch-mode",
1124
1752
  style: rootStyle,
1125
1753
  "aria-label": label,
1126
- children: /* @__PURE__ */ jsxs3(
1127
- "div",
1128
- {
1129
- className: "xeno-app-shell",
1130
- "data-sidebar": isSidebarOpen ? "open" : "closed",
1131
- children: [
1132
- /* @__PURE__ */ jsxs3("nav", { className: "xeno-app-rail", "aria-label": "Primary rail", children: [
1133
- brandIcon != null ? /* @__PURE__ */ jsx3(
1134
- "button",
1135
- {
1136
- type: "button",
1137
- className: "xeno-app-rail-logo",
1138
- "aria-label": hasSidebar ? isSidebarOpen ? `Collapse ${brandLabel ?? "navigation"} sidebar` : `Expand ${brandLabel ?? "navigation"} sidebar` : brandLabel ?? "Home",
1139
- "aria-expanded": hasSidebar ? isSidebarOpen : void 0,
1140
- title: brandLabel,
1141
- onClick: toggleSidebar,
1142
- children: brandIcon
1143
- }
1144
- ) : null,
1145
- railItems.map((item) => {
1146
- const isActive = item.id === activeSectionId;
1147
- return /* @__PURE__ */ jsxs3(
1148
- "button",
1149
- {
1150
- type: "button",
1151
- className: "xeno-app-rail-btn",
1152
- disabled: item.disabled,
1153
- "aria-label": item.label,
1154
- "aria-current": isActive ? "page" : void 0,
1155
- title: item.label,
1156
- onClick: () => onSelectSection?.(item.id),
1157
- children: [
1158
- item.icon,
1159
- item.tone ? /* @__PURE__ */ jsx3(
1160
- "span",
1161
- {
1162
- className: "xeno-app-rail-dot",
1163
- "data-tone": item.tone,
1164
- "aria-hidden": "true"
1165
- }
1166
- ) : null,
1167
- item.badge != null ? /* @__PURE__ */ jsx3("span", { className: "xeno-app-rail-badge", "aria-hidden": "true", children: item.badge }) : null
1168
- ]
1169
- },
1170
- item.id
1171
- );
1172
- }),
1173
- /* @__PURE__ */ jsx3("div", { className: "xeno-app-rail-grow" }),
1174
- railFooter != null ? /* @__PURE__ */ jsx3("div", { className: "xeno-app-rail-footer", children: railFooter }) : null
1175
- ] }),
1176
- hasSidebar ? /* @__PURE__ */ jsx3("div", { className: "xeno-app-slot", "aria-hidden": !isSidebarOpen, children: /* @__PURE__ */ jsxs3("aside", { className: "xeno-app-sidebar", "aria-label": "Workspace sidebar", children: [
1177
- sidebarTitle != null || sidebarSubtitle != null ? /* @__PURE__ */ jsxs3("div", { className: "sb-head", children: [
1178
- /* @__PURE__ */ jsxs3("div", { className: "sb-head-ttl", children: [
1179
- sidebarTitle,
1180
- sidebarSubtitle != null ? /* @__PURE__ */ jsx3("small", { children: sidebarSubtitle }) : null
1181
- ] }),
1182
- /* @__PURE__ */ jsx3(
1754
+ children: [
1755
+ /* @__PURE__ */ jsxs6(
1756
+ "div",
1757
+ {
1758
+ className: "xeno-app-shell",
1759
+ "data-sidebar": isSidebarOpen ? "open" : "closed",
1760
+ children: [
1761
+ /* @__PURE__ */ jsxs6("nav", { className: "xeno-app-rail", "aria-label": "Primary rail", children: [
1762
+ brandIcon != null ? /* @__PURE__ */ jsx6(
1183
1763
  "button",
1184
1764
  {
1185
1765
  type: "button",
1186
- className: "sb-ib",
1187
- "aria-label": "Collapse sidebar",
1188
- title: "Collapse sidebar",
1766
+ className: "xeno-app-rail-logo",
1767
+ "aria-label": hasSidebar ? isSidebarOpen ? `Collapse ${brandLabel ?? "navigation"} sidebar` : `Expand ${brandLabel ?? "navigation"} sidebar` : brandLabel ?? "Home",
1768
+ "aria-expanded": hasSidebar ? isSidebarOpen : void 0,
1769
+ title: brandLabel,
1189
1770
  onClick: toggleSidebar,
1190
- children: /* @__PURE__ */ jsx3(
1191
- "svg",
1192
- {
1193
- width: "14",
1194
- height: "14",
1195
- viewBox: "0 0 16 16",
1196
- fill: "none",
1197
- stroke: "currentColor",
1198
- strokeWidth: "1.5",
1199
- strokeLinecap: "round",
1200
- strokeLinejoin: "round",
1201
- "aria-hidden": "true",
1202
- children: /* @__PURE__ */ jsx3("path", { d: "M10 4L6 8l4 4" })
1203
- }
1204
- )
1771
+ children: brandIcon
1205
1772
  }
1206
- )
1207
- ] }) : null,
1208
- /* @__PURE__ */ jsx3("div", { className: "sb-body", children: sidebarContent != null ? sidebarContent : sidebarSections.map((section, idx) => /* @__PURE__ */ jsxs3("div", { children: [
1209
- section.title ? /* @__PURE__ */ jsx3("div", { className: "sb-grp", children: section.title }) : null,
1210
- section.items.map((row) => {
1211
- const isCurrent = row.active !== void 0 ? row.active : row.id === activeSidebarItemId;
1212
- return /* @__PURE__ */ jsxs3(
1773
+ ) : null,
1774
+ railItems.map((item) => {
1775
+ const isActive = item.id === activeSectionId;
1776
+ return /* @__PURE__ */ jsxs6(
1213
1777
  "button",
1214
1778
  {
1215
1779
  type: "button",
1216
- className: "sb-row",
1217
- disabled: row.disabled,
1218
- "aria-current": isCurrent ? "true" : void 0,
1219
- onClick: () => onSelectSidebarItem?.(row.id),
1780
+ className: "xeno-app-rail-btn",
1781
+ disabled: item.disabled,
1782
+ "aria-label": item.label,
1783
+ "aria-current": isActive ? "page" : void 0,
1784
+ title: item.label,
1785
+ onClick: () => {
1786
+ onSelectSection?.(item.id);
1787
+ if (!isSidebarOpen && item.flyoutItems && item.flyoutItems.length > 0) {
1788
+ setRailFlyoutId((prev) => prev === item.id ? null : item.id);
1789
+ } else {
1790
+ setRailFlyoutId(null);
1791
+ }
1792
+ },
1220
1793
  children: [
1221
- row.icon != null ? /* @__PURE__ */ jsx3("span", { className: "sb-row-icon", "aria-hidden": "true", children: row.icon }) : null,
1222
- /* @__PURE__ */ jsx3("span", { className: "sb-row-label", children: row.label }),
1223
- row.meta != null ? /* @__PURE__ */ jsx3("span", { className: "meta", children: row.meta }) : null
1794
+ item.icon,
1795
+ item.tone ? /* @__PURE__ */ jsx6(
1796
+ "span",
1797
+ {
1798
+ className: "xeno-app-rail-dot",
1799
+ "data-tone": item.tone,
1800
+ "aria-hidden": "true"
1801
+ }
1802
+ ) : null,
1803
+ item.badge != null ? /* @__PURE__ */ jsx6("span", { className: "xeno-app-rail-badge", "aria-hidden": "true", children: item.badge }) : null
1224
1804
  ]
1225
1805
  },
1226
- row.id
1806
+ item.id
1227
1807
  );
1228
- })
1229
- ] }, section.id ?? section.title ?? `sec-${idx}`)) }),
1230
- sidebarFooter != null ? /* @__PURE__ */ jsx3("div", { className: "sb-foot", children: sidebarFooter }) : null
1231
- ] }) }) : null,
1232
- /* @__PURE__ */ jsx3("main", { className: "xeno-app-main", children: /* @__PURE__ */ jsxs3("section", { className: "xeno-app-plate", children: [
1233
- !hideTopbar ? /* @__PURE__ */ jsxs3(
1234
- "header",
1808
+ }),
1809
+ /* @__PURE__ */ jsx6("div", { className: "xeno-app-rail-grow" }),
1810
+ railFooter != null ? /* @__PURE__ */ jsx6("div", { className: "xeno-app-rail-footer", children: railFooter }) : null
1811
+ ] }),
1812
+ activeFlyoutItem && activeFlyoutItem.flyoutItems ? /* @__PURE__ */ jsx6(
1813
+ RailPopover,
1235
1814
  {
1236
- className: "plate-topbar",
1237
- "data-drag-region": desktopDragRegion ? "true" : void 0,
1238
- children: [
1239
- /* @__PURE__ */ jsxs3("div", { className: "plate-topbar-left", children: [
1240
- hasSidebar && !isSidebarOpen && brandIcon == null ? /* @__PURE__ */ jsx3(
1241
- "button",
1242
- {
1243
- type: "button",
1244
- className: "sb-ib",
1245
- "aria-label": "Expand sidebar",
1246
- title: "Expand sidebar",
1247
- onClick: toggleSidebar,
1248
- children: /* @__PURE__ */ jsx3(
1249
- "svg",
1250
- {
1251
- width: "14",
1252
- height: "14",
1253
- viewBox: "0 0 16 16",
1254
- fill: "none",
1255
- stroke: "currentColor",
1256
- strokeWidth: "1.5",
1257
- strokeLinecap: "round",
1258
- strokeLinejoin: "round",
1259
- "aria-hidden": "true",
1260
- children: /* @__PURE__ */ jsx3("path", { d: "M6 4l4 4-4 4" })
1261
- }
1262
- )
1263
- }
1264
- ) : null,
1265
- /* @__PURE__ */ jsx3("div", { className: "plate-crumb", children: breadcrumb != null ? breadcrumb : /* @__PURE__ */ jsxs3(Fragment, { children: [
1266
- brandLabel ? /* @__PURE__ */ jsx3("span", { className: "plate-crumb-brand", children: brandLabel }) : null,
1267
- brandLabel && sectionLabel ? /* @__PURE__ */ jsx3("span", { className: "plate-crumb-sep", "aria-hidden": "true", children: "/" }) : null,
1268
- sectionLabel ? /* @__PURE__ */ jsx3("span", { className: "plate-crumb-section", children: sectionLabel }) : null
1269
- ] }) })
1270
- ] }),
1271
- modeSlot != null ? /* @__PURE__ */ jsx3("div", { className: "plate-topbar-center", "data-no-drag": "true", children: modeSlot }) : null,
1272
- /* @__PURE__ */ jsxs3("div", { className: "plate-topbar-right", children: [
1273
- headerActions,
1274
- updateState ? /* @__PURE__ */ jsx3(
1275
- PlatformUpdatePill,
1815
+ open: true,
1816
+ title: activeFlyoutItem.label,
1817
+ items: activeFlyoutItem.flyoutItems,
1818
+ activeItemId: activeSidebarItemId,
1819
+ onSelectItem: onSelectSidebarItem,
1820
+ onClose: () => setRailFlyoutId(null)
1821
+ }
1822
+ ) : null,
1823
+ hasSidebar ? /* @__PURE__ */ jsx6("div", { className: "xeno-app-slot", "aria-hidden": !isSidebarOpen, children: /* @__PURE__ */ jsxs6("aside", { className: "xeno-app-sidebar", "aria-label": "Workspace sidebar", children: [
1824
+ sidebarTitle != null || sidebarSubtitle != null ? /* @__PURE__ */ jsxs6("div", { className: "sb-head", children: [
1825
+ /* @__PURE__ */ jsxs6("div", { className: "sb-head-ttl", children: [
1826
+ sidebarTitle,
1827
+ sidebarSubtitle != null ? /* @__PURE__ */ jsx6("small", { children: sidebarSubtitle }) : null
1828
+ ] }),
1829
+ /* @__PURE__ */ jsx6(
1830
+ "button",
1831
+ {
1832
+ type: "button",
1833
+ className: "sb-ib",
1834
+ "aria-label": "Collapse sidebar",
1835
+ title: "Collapse sidebar",
1836
+ onClick: toggleSidebar,
1837
+ children: /* @__PURE__ */ jsx6(
1838
+ "svg",
1276
1839
  {
1277
- status: updateState,
1278
- onCheckForUpdates,
1279
- onDownloadUpdate,
1280
- onInstallAndRestart,
1281
- onSignIn,
1282
- onManagePlan
1840
+ width: "14",
1841
+ height: "14",
1842
+ viewBox: "0 0 16 16",
1843
+ fill: "none",
1844
+ stroke: "currentColor",
1845
+ strokeWidth: "1.5",
1846
+ strokeLinecap: "round",
1847
+ strokeLinejoin: "round",
1848
+ "aria-hidden": "true",
1849
+ children: /* @__PURE__ */ jsx6("path", { d: "M10 4L6 8l4 4" })
1283
1850
  }
1284
- ) : null,
1285
- themeToggle && onThemePositionChange ? /* @__PURE__ */ jsxs3(
1286
- "button",
1287
- {
1288
- type: "button",
1289
- className: "xeno-ps-theme-btn",
1290
- "data-no-drag": "true",
1291
- "aria-label": `Switch theme (currently ${themeLabelFor(normalizedPosition)})`,
1292
- title: `Theme: ${themeLabelFor(normalizedPosition)} (${normalizedPosition}%)`,
1293
- onClick: () => onThemePositionChange(nextThemeStop(normalizedPosition)),
1294
- children: [
1295
- /* @__PURE__ */ jsxs3(
1851
+ )
1852
+ }
1853
+ )
1854
+ ] }) : null,
1855
+ /* @__PURE__ */ jsx6("div", { className: "sb-body", children: sidebarContent != null ? sidebarContent : sidebarSections.map((section, idx) => /* @__PURE__ */ jsxs6("div", { children: [
1856
+ section.title ? /* @__PURE__ */ jsx6("div", { className: "sb-grp", children: section.title }) : null,
1857
+ section.items.map((row) => {
1858
+ const isCurrent = row.active !== void 0 ? row.active : row.id === activeSidebarItemId;
1859
+ return /* @__PURE__ */ jsxs6(
1860
+ "button",
1861
+ {
1862
+ type: "button",
1863
+ className: "sb-row",
1864
+ disabled: row.disabled,
1865
+ "aria-current": isCurrent ? "true" : void 0,
1866
+ onClick: () => onSelectSidebarItem?.(row.id),
1867
+ children: [
1868
+ row.icon != null ? /* @__PURE__ */ jsx6("span", { className: "sb-row-icon", "aria-hidden": "true", children: row.icon }) : null,
1869
+ /* @__PURE__ */ jsx6("span", { className: "sb-row-label", children: row.label }),
1870
+ row.meta != null ? /* @__PURE__ */ jsx6("span", { className: "meta", children: row.meta }) : null
1871
+ ]
1872
+ },
1873
+ row.id
1874
+ );
1875
+ })
1876
+ ] }, section.id ?? section.title ?? `sec-${idx}`)) }),
1877
+ sidebarFooter != null ? /* @__PURE__ */ jsx6("div", { className: "sb-foot", children: sidebarFooter }) : null
1878
+ ] }) }) : null,
1879
+ /* @__PURE__ */ jsx6("main", { className: "xeno-app-main", children: /* @__PURE__ */ jsxs6("section", { className: "xeno-app-plate", children: [
1880
+ !hideTopbar ? /* @__PURE__ */ jsxs6(
1881
+ "header",
1882
+ {
1883
+ className: "plate-topbar",
1884
+ "data-drag-region": desktopDragRegion ? "true" : void 0,
1885
+ children: [
1886
+ /* @__PURE__ */ jsxs6("div", { className: "plate-topbar-left", children: [
1887
+ hasSidebar && !isSidebarOpen && brandIcon == null ? /* @__PURE__ */ jsx6(
1888
+ "button",
1889
+ {
1890
+ type: "button",
1891
+ className: "sb-ib",
1892
+ "aria-label": "Expand sidebar",
1893
+ title: "Expand sidebar",
1894
+ onClick: toggleSidebar,
1895
+ children: /* @__PURE__ */ jsx6(
1296
1896
  "svg",
1297
1897
  {
1298
- width: "12",
1299
- height: "12",
1898
+ width: "14",
1899
+ height: "14",
1300
1900
  viewBox: "0 0 16 16",
1301
1901
  fill: "none",
1302
1902
  stroke: "currentColor",
1303
1903
  strokeWidth: "1.5",
1904
+ strokeLinecap: "round",
1905
+ strokeLinejoin: "round",
1304
1906
  "aria-hidden": "true",
1305
- children: [
1306
- /* @__PURE__ */ jsx3("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2.5" }),
1307
- /* @__PURE__ */ jsx3("path", { d: "M8 2v12" })
1308
- ]
1907
+ children: /* @__PURE__ */ jsx6("path", { d: "M6 4l4 4-4 4" })
1309
1908
  }
1310
- ),
1311
- /* @__PURE__ */ jsx3("span", { className: "xeno-ps-theme-label", children: themeLabelFor(normalizedPosition) })
1312
- ]
1313
- }
1314
- ) : null,
1315
- accountSlot,
1316
- /* @__PURE__ */ jsx3(
1317
- WindowControls,
1318
- {
1319
- onMinimize,
1320
- onMaximize,
1321
- onClose,
1322
- isMaximized
1323
- }
1324
- )
1325
- ] })
1326
- ]
1327
- }
1328
- ) : null,
1329
- /* @__PURE__ */ jsx3("div", { className: "plate-body", children })
1330
- ] }) })
1331
- ]
1332
- }
1333
- )
1909
+ )
1910
+ }
1911
+ ) : null,
1912
+ /* @__PURE__ */ jsx6("div", { className: "plate-crumb", children: breadcrumb != null ? breadcrumb : /* @__PURE__ */ jsxs6(Fragment, { children: [
1913
+ brandLabel ? /* @__PURE__ */ jsx6("span", { className: "plate-crumb-brand", children: brandLabel }) : null,
1914
+ brandLabel && sectionLabel ? /* @__PURE__ */ jsx6("span", { className: "plate-crumb-sep", "aria-hidden": "true", children: "/" }) : null,
1915
+ sectionLabel ? /* @__PURE__ */ jsx6("span", { className: "plate-crumb-section", children: sectionLabel }) : null
1916
+ ] }) })
1917
+ ] }),
1918
+ modeSlot != null ? /* @__PURE__ */ jsx6("div", { className: "plate-topbar-center", "data-no-drag": "true", children: modeSlot }) : null,
1919
+ /* @__PURE__ */ jsxs6("div", { className: "plate-topbar-right", children: [
1920
+ headerActions,
1921
+ updateState ? /* @__PURE__ */ jsx6(
1922
+ PlatformUpdatePill,
1923
+ {
1924
+ status: updateState,
1925
+ onCheckForUpdates,
1926
+ onDownloadUpdate,
1927
+ onInstallAndRestart,
1928
+ onSignIn,
1929
+ onManagePlan
1930
+ }
1931
+ ) : null,
1932
+ activeMode && onSelectMode ? /* @__PURE__ */ jsxs6(
1933
+ "button",
1934
+ {
1935
+ type: "button",
1936
+ className: "xeno-ps-mode-trigger",
1937
+ "data-no-drag": "true",
1938
+ "aria-haspopup": "dialog",
1939
+ "aria-expanded": isModeSwitcherOpen,
1940
+ "aria-label": `Workspace mode: ${activeMode.name}`,
1941
+ onClick: () => setModeOpen(!isModeSwitcherOpen),
1942
+ children: [
1943
+ /* @__PURE__ */ jsx6(
1944
+ "span",
1945
+ {
1946
+ className: "xeno-ps-mode-swatch",
1947
+ style: { background: activeMode.color },
1948
+ "aria-hidden": "true"
1949
+ }
1950
+ ),
1951
+ /* @__PURE__ */ jsx6("span", { children: activeMode.name })
1952
+ ]
1953
+ }
1954
+ ) : null,
1955
+ themeToggle && onThemePositionChange ? themeControlMode === "cycle" ? /* @__PURE__ */ jsxs6(
1956
+ "button",
1957
+ {
1958
+ type: "button",
1959
+ className: "xeno-ps-theme-btn",
1960
+ "data-no-drag": "true",
1961
+ "aria-label": `Switch theme (currently ${themeLabelFor(normalizedPosition)})`,
1962
+ title: `Theme: ${themeLabelFor(normalizedPosition)} (${normalizedPosition}%)`,
1963
+ onClick: () => onThemePositionChange(nextThemeStop(normalizedPosition)),
1964
+ children: [
1965
+ /* @__PURE__ */ jsxs6(
1966
+ "svg",
1967
+ {
1968
+ width: "12",
1969
+ height: "12",
1970
+ viewBox: "0 0 16 16",
1971
+ fill: "none",
1972
+ stroke: "currentColor",
1973
+ strokeWidth: "1.5",
1974
+ "aria-hidden": "true",
1975
+ children: [
1976
+ /* @__PURE__ */ jsx6("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2.5" }),
1977
+ /* @__PURE__ */ jsx6("path", { d: "M8 2v12" })
1978
+ ]
1979
+ }
1980
+ ),
1981
+ /* @__PURE__ */ jsx6("span", { className: "xeno-ps-theme-label", children: themeLabelFor(normalizedPosition) })
1982
+ ]
1983
+ }
1984
+ ) : /* @__PURE__ */ jsx6(
1985
+ ThemeBrightnessPopover,
1986
+ {
1987
+ position: normalizedPosition,
1988
+ onChange: onThemePositionChange
1989
+ }
1990
+ ) : null,
1991
+ accountSlot,
1992
+ /* @__PURE__ */ jsx6(
1993
+ WindowControls,
1994
+ {
1995
+ onMinimize,
1996
+ onMaximize,
1997
+ onClose,
1998
+ isMaximized
1999
+ }
2000
+ )
2001
+ ] })
2002
+ ]
2003
+ }
2004
+ ) : null,
2005
+ /* @__PURE__ */ jsx6("div", { className: "plate-body", children })
2006
+ ] }) })
2007
+ ]
2008
+ }
2009
+ ),
2010
+ activeModeId && onSelectMode ? /* @__PURE__ */ jsx6(
2011
+ ModeSwitcherLayer,
2012
+ {
2013
+ open: isModeSwitcherOpen,
2014
+ onClose: () => setModeOpen(false),
2015
+ activeModeId,
2016
+ onSelectMode,
2017
+ modes,
2018
+ enableShortcuts: enableModeShortcuts
2019
+ }
2020
+ ) : null
2021
+ ]
1334
2022
  }
1335
2023
  );
1336
2024
  }
1337
2025
  export {
2026
+ ModeSwitcherLayer,
1338
2027
  PLATFORM_SHELL_BLOCK_MANIFEST,
1339
2028
  PLATFORM_SHELL_CSS,
1340
2029
  PLATFORM_SHELL_PANEL_ID,
1341
2030
  PlatformShell,
1342
2031
  PlatformUpdatePill,
2032
+ RailPopover,
2033
+ ThemeBrightnessPopover,
1343
2034
  WindowControls,
1344
2035
  ensurePlatformShellStyles
1345
2036
  };