@snap-rail/ui 0.4.0 → 0.4.2

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/lib/contract.js CHANGED
@@ -52,6 +52,12 @@ const UI_SLOT_MODES = {
52
52
  [UI_SLOT_IDS.settingsEntry]: "one",
53
53
  [UI_SLOT_IDS.settingsSurface]: "one"
54
54
  };
55
+ /** The window controls a layout exposes to its chrome contributions. */
56
+ const WINDOW_CONTROLS = [
57
+ "minimize",
58
+ "toggle-maximize",
59
+ "close"
60
+ ];
55
61
  /** Diagnostic kinds surfaced by the UI registry. */
56
62
  const UI_DIAGNOSTIC_KINDS = [
57
63
  "unknown-slot",
@@ -585,8 +591,10 @@ const UI_COMPONENTS = {
585
591
  "settings.nav-icon",
586
592
  "settings.group",
587
593
  "settings.group-title",
588
- "settings.content"
594
+ "settings.content",
595
+ "settings.page",
596
+ "settings.footer"
589
597
  ] }
590
598
  };
591
599
  //#endregion
592
- export { CUSTOM_SLOT_PATTERN, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, isValidSlotId };
600
+ export { CUSTOM_SLOT_PATTERN, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, WINDOW_CONTROLS, isValidSlotId };
package/lib/fallback.js CHANGED
@@ -265,6 +265,12 @@ const UI_SLOT_IDS = {
265
265
  settingsSurface: "settings.surface"
266
266
  };
267
267
  UI_SLOT_IDS.layout, UI_SLOT_IDS.titlebar, UI_SLOT_IDS.titlebarActions, UI_SLOT_IDS.sidebar, UI_SLOT_IDS.statusbar, UI_SLOT_IDS.overlay, UI_SLOT_IDS.ball, UI_SLOT_IDS.settingsEntry, UI_SLOT_IDS.settingsSurface;
268
+ /** The window controls a layout exposes to its chrome contributions. */
269
+ const WINDOW_CONTROLS = [
270
+ "minimize",
271
+ "toggle-maximize",
272
+ "close"
273
+ ];
268
274
  //#endregion
269
275
  //#region lib/types/pages.js
270
276
  /**
@@ -336,15 +342,14 @@ function Glyph(props) {
336
342
  children: props.children
337
343
  });
338
344
  }
339
- /** The fallback body. */
340
- function FallbackShell(props) {
341
- useUiVersion(props.ctx.ui);
342
- usePagesVersion(props.ctx);
343
- const active = props.ctx.pages.active();
344
- const control = (action) => {
345
- props.ctx.client.link.call("window.control", { action }).catch(() => {});
346
- };
347
- const header = jsxs("div", {
345
+ /**
346
+ * The fallback titlebar: the product name and the active page on the left; the
347
+ * contributed `shell.titlebar.actions`, the settings seat, and the window
348
+ * controls on the right. The whole bar is replaced when a plugin occupies
349
+ * `shell.titlebar` — that occupant then owns its own controls.
350
+ */
351
+ function DefaultTitlebar(props) {
352
+ return jsxs("div", {
348
353
  className: "snap-fallback-titlebar",
349
354
  style: {
350
355
  display: "flex",
@@ -358,7 +363,7 @@ function FallbackShell(props) {
358
363
  color: "var(--snap-color-muted)",
359
364
  fontSize: "var(--snap-text-sm)"
360
365
  },
361
- children: ["snap-rail", active !== void 0 ? ` · ${active.title}` : ""]
366
+ children: ["snap-rail", props.title !== void 0 ? ` · ${props.title}` : ""]
362
367
  }), jsxs("div", {
363
368
  style: {
364
369
  display: "flex",
@@ -366,6 +371,13 @@ function FallbackShell(props) {
366
371
  gap: 4
367
372
  },
368
373
  children: [
374
+ jsx(Slot$1, {
375
+ name: UI_SLOT_IDS.titlebarActions,
376
+ context: {
377
+ surface: "main",
378
+ controls: WINDOW_CONTROLS
379
+ }
380
+ }),
369
381
  jsx(Slot$1, {
370
382
  name: UI_SLOT_IDS.settingsEntry,
371
383
  context: {
@@ -377,23 +389,78 @@ function FallbackShell(props) {
377
389
  jsx(IconButton, {
378
390
  icon: jsx(Glyph, { children: "—" }),
379
391
  label: "最小化",
380
- onClick: () => control("minimize")
392
+ onClick: () => props.control("minimize")
381
393
  }),
382
394
  jsx(IconButton, {
383
395
  icon: jsx(Glyph, { children: "□" }),
384
396
  label: "最大化切换",
385
- onClick: () => control("toggle-maximize")
397
+ onClick: () => props.control("toggle-maximize")
386
398
  }),
387
399
  jsx(IconButton, {
388
400
  icon: jsx(Glyph, { children: "×" }),
389
401
  label: "关闭",
390
- onClick: () => control("close")
402
+ onClick: () => props.control("close")
391
403
  })
392
404
  ]
393
405
  })]
394
406
  });
407
+ }
408
+ /** The fallback body. */
409
+ function FallbackShell(props) {
410
+ useUiVersion(props.ctx.ui);
411
+ usePagesVersion(props.ctx);
412
+ const active = props.ctx.pages.active();
413
+ const control = (action) => {
414
+ props.ctx.client.link.call("window.control", { action }).catch(() => {});
415
+ };
416
+ const titlebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.titlebar).length > 0;
417
+ const sidebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.sidebar).length > 0;
418
+ const statusbarOccupied = props.ctx.ui.list(UI_SLOT_IDS.statusbar).length > 0;
419
+ const header = titlebarOccupied ? jsx(Slot$1, {
420
+ name: UI_SLOT_IDS.titlebar,
421
+ context: {
422
+ surface: "main",
423
+ controls: WINDOW_CONTROLS
424
+ }
425
+ }) : jsx(DefaultTitlebar, {
426
+ ctx: props.ctx,
427
+ title: active?.title,
428
+ control
429
+ });
430
+ const sidebar = sidebarOccupied ? jsx("div", {
431
+ className: "snap-fallback-sidebar",
432
+ style: {
433
+ display: "flex",
434
+ flexDirection: "column",
435
+ height: "100%",
436
+ minHeight: 0,
437
+ padding: "4px 8px"
438
+ },
439
+ children: jsx(Slot$1, {
440
+ name: UI_SLOT_IDS.sidebar,
441
+ context: { surface: "main" }
442
+ })
443
+ }) : void 0;
444
+ const statusbar = statusbarOccupied ? jsx("div", {
445
+ className: "snap-fallback-statusbar",
446
+ style: {
447
+ display: "flex",
448
+ alignItems: "center",
449
+ gap: 12,
450
+ minHeight: 28,
451
+ padding: "0 12px",
452
+ color: "var(--snap-color-muted)",
453
+ fontSize: "var(--snap-text-sm)"
454
+ },
455
+ children: jsx(Slot$1, {
456
+ name: UI_SLOT_IDS.statusbar,
457
+ context: { surface: "main" }
458
+ })
459
+ }) : void 0;
395
460
  return jsx(AppShell, {
396
461
  header,
462
+ ...sidebar !== void 0 ? { sidebar } : {},
463
+ ...statusbar !== void 0 ? { footer: statusbar } : {},
397
464
  children: active !== void 0 ? active.render() : jsx("div", {
398
465
  style: {
399
466
  display: "flex",
package/lib/index.js CHANGED
@@ -79,6 +79,12 @@ const UI_SLOT_MODES = {
79
79
  [UI_SLOT_IDS.settingsEntry]: "one",
80
80
  [UI_SLOT_IDS.settingsSurface]: "one"
81
81
  };
82
+ /** The window controls a layout exposes to its chrome contributions. */
83
+ const WINDOW_CONTROLS = [
84
+ "minimize",
85
+ "toggle-maximize",
86
+ "close"
87
+ ];
82
88
  /** Diagnostic kinds surfaced by the UI registry. */
83
89
  const UI_DIAGNOSTIC_KINDS = [
84
90
  "unknown-slot",
@@ -612,7 +618,9 @@ const UI_COMPONENTS = {
612
618
  "settings.nav-icon",
613
619
  "settings.group",
614
620
  "settings.group-title",
615
- "settings.content"
621
+ "settings.content",
622
+ "settings.page",
623
+ "settings.footer"
616
624
  ] }
617
625
  };
618
626
  //#endregion
@@ -3412,15 +3420,14 @@ function Glyph(props) {
3412
3420
  children: props.children
3413
3421
  });
3414
3422
  }
3415
- /** The fallback body. */
3416
- function FallbackShell(props) {
3417
- useUiVersion(props.ctx.ui);
3418
- usePagesVersion(props.ctx);
3419
- const active = props.ctx.pages.active();
3420
- const control = (action) => {
3421
- props.ctx.client.link.call("window.control", { action }).catch(() => {});
3422
- };
3423
- const header = jsxs("div", {
3423
+ /**
3424
+ * The fallback titlebar: the product name and the active page on the left; the
3425
+ * contributed `shell.titlebar.actions`, the settings seat, and the window
3426
+ * controls on the right. The whole bar is replaced when a plugin occupies
3427
+ * `shell.titlebar` — that occupant then owns its own controls.
3428
+ */
3429
+ function DefaultTitlebar(props) {
3430
+ return jsxs("div", {
3424
3431
  className: "snap-fallback-titlebar",
3425
3432
  style: {
3426
3433
  display: "flex",
@@ -3434,7 +3441,7 @@ function FallbackShell(props) {
3434
3441
  color: "var(--snap-color-muted)",
3435
3442
  fontSize: "var(--snap-text-sm)"
3436
3443
  },
3437
- children: ["snap-rail", active !== void 0 ? ` · ${active.title}` : ""]
3444
+ children: ["snap-rail", props.title !== void 0 ? ` · ${props.title}` : ""]
3438
3445
  }), jsxs("div", {
3439
3446
  style: {
3440
3447
  display: "flex",
@@ -3442,6 +3449,13 @@ function FallbackShell(props) {
3442
3449
  gap: 4
3443
3450
  },
3444
3451
  children: [
3452
+ jsx(Slot, {
3453
+ name: UI_SLOT_IDS.titlebarActions,
3454
+ context: {
3455
+ surface: "main",
3456
+ controls: WINDOW_CONTROLS
3457
+ }
3458
+ }),
3445
3459
  jsx(Slot, {
3446
3460
  name: UI_SLOT_IDS.settingsEntry,
3447
3461
  context: {
@@ -3453,23 +3467,78 @@ function FallbackShell(props) {
3453
3467
  jsx(IconButton, {
3454
3468
  icon: jsx(Glyph, { children: "—" }),
3455
3469
  label: "最小化",
3456
- onClick: () => control("minimize")
3470
+ onClick: () => props.control("minimize")
3457
3471
  }),
3458
3472
  jsx(IconButton, {
3459
3473
  icon: jsx(Glyph, { children: "□" }),
3460
3474
  label: "最大化切换",
3461
- onClick: () => control("toggle-maximize")
3475
+ onClick: () => props.control("toggle-maximize")
3462
3476
  }),
3463
3477
  jsx(IconButton, {
3464
3478
  icon: jsx(Glyph, { children: "×" }),
3465
3479
  label: "关闭",
3466
- onClick: () => control("close")
3480
+ onClick: () => props.control("close")
3467
3481
  })
3468
3482
  ]
3469
3483
  })]
3470
3484
  });
3485
+ }
3486
+ /** The fallback body. */
3487
+ function FallbackShell(props) {
3488
+ useUiVersion(props.ctx.ui);
3489
+ usePagesVersion(props.ctx);
3490
+ const active = props.ctx.pages.active();
3491
+ const control = (action) => {
3492
+ props.ctx.client.link.call("window.control", { action }).catch(() => {});
3493
+ };
3494
+ const titlebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.titlebar).length > 0;
3495
+ const sidebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.sidebar).length > 0;
3496
+ const statusbarOccupied = props.ctx.ui.list(UI_SLOT_IDS.statusbar).length > 0;
3497
+ const header = titlebarOccupied ? jsx(Slot, {
3498
+ name: UI_SLOT_IDS.titlebar,
3499
+ context: {
3500
+ surface: "main",
3501
+ controls: WINDOW_CONTROLS
3502
+ }
3503
+ }) : jsx(DefaultTitlebar, {
3504
+ ctx: props.ctx,
3505
+ title: active?.title,
3506
+ control
3507
+ });
3508
+ const sidebar = sidebarOccupied ? jsx("div", {
3509
+ className: "snap-fallback-sidebar",
3510
+ style: {
3511
+ display: "flex",
3512
+ flexDirection: "column",
3513
+ height: "100%",
3514
+ minHeight: 0,
3515
+ padding: "4px 8px"
3516
+ },
3517
+ children: jsx(Slot, {
3518
+ name: UI_SLOT_IDS.sidebar,
3519
+ context: { surface: "main" }
3520
+ })
3521
+ }) : void 0;
3522
+ const statusbar = statusbarOccupied ? jsx("div", {
3523
+ className: "snap-fallback-statusbar",
3524
+ style: {
3525
+ display: "flex",
3526
+ alignItems: "center",
3527
+ gap: 12,
3528
+ minHeight: 28,
3529
+ padding: "0 12px",
3530
+ color: "var(--snap-color-muted)",
3531
+ fontSize: "var(--snap-text-sm)"
3532
+ },
3533
+ children: jsx(Slot, {
3534
+ name: UI_SLOT_IDS.statusbar,
3535
+ context: { surface: "main" }
3536
+ })
3537
+ }) : void 0;
3471
3538
  return jsx(AppShell, {
3472
3539
  header,
3540
+ ...sidebar !== void 0 ? { sidebar } : {},
3541
+ ...statusbar !== void 0 ? { footer: statusbar } : {},
3473
3542
  children: active !== void 0 ? active.render() : jsx("div", {
3474
3543
  style: {
3475
3544
  display: "flex",
@@ -4824,6 +4893,39 @@ function SettingsEntry(props) {
4824
4893
  onClick: props.open
4825
4894
  });
4826
4895
  }
4896
+ /** The settings footer: the running app's version plus the copyright line,
4897
+ * pinned below the page area of every settings page. The version rides the
4898
+ * existing `update.state` snapshot (`app.getVersion()`, populated in dev
4899
+ * too); hosts without the update bridge — or bare contexts without client
4900
+ * services — simply get no footer instead of an error. */
4901
+ function SettingsFooter({ ctx }) {
4902
+ const [version, setVersion] = useState(void 0);
4903
+ useEffect(() => {
4904
+ let link;
4905
+ try {
4906
+ link = ctx.client.link;
4907
+ } catch {
4908
+ return;
4909
+ }
4910
+ let cancelled = false;
4911
+ link.call("update.state", {}).then((result) => {
4912
+ if (!cancelled && result.ok) setVersion(result.value.status.currentVersion);
4913
+ }).catch(() => void 0);
4914
+ return () => {
4915
+ cancelled = true;
4916
+ };
4917
+ }, [ctx]);
4918
+ if (version === void 0) return null;
4919
+ return jsxs("footer", {
4920
+ ...part("settings", "footer"),
4921
+ className: "snap-settings-footer",
4922
+ children: [jsxs("span", { children: ["snap-rail v", version] }), jsxs("span", { children: [
4923
+ "© ",
4924
+ (/* @__PURE__ */ new Date()).getFullYear(),
4925
+ " snap-rail · Apache-2.0"
4926
+ ] })]
4927
+ });
4928
+ }
4827
4929
  /** The default settings surface. */
4828
4930
  function SettingsSurface(props) {
4829
4931
  const { service, ctx } = props;
@@ -4897,14 +4999,18 @@ function SettingsSurface(props) {
4897
4999
  }), jsx("span", { children: page.title })]
4898
5000
  }, page.id))]
4899
5001
  }, group))
4900
- }), jsx("main", {
5002
+ }), jsxs("main", {
4901
5003
  ...part("settings", "content"),
4902
5004
  className: "snap-settings-content",
4903
5005
  "data-active-page": activeId,
4904
- children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
4905
- page: active.id,
4906
- children: active.render()
4907
- })
5006
+ children: [jsx("div", {
5007
+ ...part("settings", "page"),
5008
+ className: "snap-settings-page",
5009
+ children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
5010
+ page: active.id,
5011
+ children: active.render()
5012
+ })
5013
+ }), jsx(SettingsFooter, { ctx })]
4908
5014
  })]
4909
5015
  })]
4910
5016
  })
@@ -5281,4 +5387,4 @@ async function createClientRuntime(handle, options) {
5281
5387
  };
5282
5388
  }
5283
5389
  //#endregion
5284
- export { Alert, AlertDescription, AlertTitle, AppShell, Badge, Button, CUSTOM_SLOT_PATTERN, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartFrame, Checkbox, ClientProvider, Combobox, Controller, DEFAULT_DARK, DEFAULT_DARK_ID, DEFAULT_LIGHT, DEFAULT_LIGHT_ID, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DragScroll, EmptyState, Field, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormProvider, Grid, IconButton, Input, Label, Led, List, ListItem, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, NumberInput, Page, Panel, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Row, SchemaForm, ScrollArea, Section, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, Separator, SettingsEntry, SettingsSurface, Sheet, Skeleton, SkinsProvider, Slider, Slot, Spinner, Split, Stack, Switch, Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchSelect, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, UiProvider, Visualization, attachBallDrag, attachDragPan, chartThemeOf, cn, controlHeight, createClientRuntime, dismissToast, fallbackPlugin, isValidSlotId, literalValuesOf, pagesPlugin, part, schemaNodeOf, settingsPageInfo, settingsPlugin, skinTokenVar, skinsPlugin, slotsPlugin, space, toast, useActiveLayout, useChartTheme, useClient, useController, useFieldArray, useForm, useFormContext, useFormState, usePagesVersion, useSkinId, useSkinTokens, useSkins, useUi, useUiVersion, useWatch, zodResolver };
5390
+ export { Alert, AlertDescription, AlertTitle, AppShell, Badge, Button, CUSTOM_SLOT_PATTERN, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartFrame, Checkbox, ClientProvider, Combobox, Controller, DEFAULT_DARK, DEFAULT_DARK_ID, DEFAULT_LIGHT, DEFAULT_LIGHT_ID, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DragScroll, EmptyState, Field, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormProvider, Grid, IconButton, Input, Label, Led, List, ListItem, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuSeparator, MenuTrigger, NumberInput, Page, Panel, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Row, SchemaForm, ScrollArea, Section, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, Separator, SettingsEntry, SettingsSurface, Sheet, Skeleton, SkinsProvider, Slider, Slot, Spinner, Split, Stack, Switch, Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchSelect, UI_COMPONENTS, UI_DIAGNOSTIC_KINDS, UI_PROFILES, UI_SLOT_IDS, UI_SLOT_MODES, UiProvider, Visualization, WINDOW_CONTROLS, attachBallDrag, attachDragPan, chartThemeOf, cn, controlHeight, createClientRuntime, dismissToast, fallbackPlugin, isValidSlotId, literalValuesOf, pagesPlugin, part, schemaNodeOf, settingsPageInfo, settingsPlugin, skinTokenVar, skinsPlugin, slotsPlugin, space, toast, useActiveLayout, useChartTheme, useClient, useController, useFieldArray, useForm, useFormContext, useFormState, usePagesVersion, useSkinId, useSkinTokens, useSkins, useUi, useUiVersion, useWatch, zodResolver };
package/lib/runtime.js CHANGED
@@ -690,6 +690,12 @@ const UI_SLOT_MODES = {
690
690
  [UI_SLOT_IDS.settingsEntry]: "one",
691
691
  [UI_SLOT_IDS.settingsSurface]: "one"
692
692
  };
693
+ /** The window controls a layout exposes to its chrome contributions. */
694
+ const WINDOW_CONTROLS = [
695
+ "minimize",
696
+ "toggle-maximize",
697
+ "close"
698
+ ];
693
699
  //#endregion
694
700
  //#region lib/types/pages.js
695
701
  /**
@@ -989,15 +995,14 @@ function Glyph(props) {
989
995
  children: props.children
990
996
  });
991
997
  }
992
- /** The fallback body. */
993
- function FallbackShell(props) {
994
- useUiVersion(props.ctx.ui);
995
- usePagesVersion(props.ctx);
996
- const active = props.ctx.pages.active();
997
- const control = (action) => {
998
- props.ctx.client.link.call("window.control", { action }).catch(() => {});
999
- };
1000
- const header = jsxs("div", {
998
+ /**
999
+ * The fallback titlebar: the product name and the active page on the left; the
1000
+ * contributed `shell.titlebar.actions`, the settings seat, and the window
1001
+ * controls on the right. The whole bar is replaced when a plugin occupies
1002
+ * `shell.titlebar` — that occupant then owns its own controls.
1003
+ */
1004
+ function DefaultTitlebar(props) {
1005
+ return jsxs("div", {
1001
1006
  className: "snap-fallback-titlebar",
1002
1007
  style: {
1003
1008
  display: "flex",
@@ -1011,7 +1016,7 @@ function FallbackShell(props) {
1011
1016
  color: "var(--snap-color-muted)",
1012
1017
  fontSize: "var(--snap-text-sm)"
1013
1018
  },
1014
- children: ["snap-rail", active !== void 0 ? ` · ${active.title}` : ""]
1019
+ children: ["snap-rail", props.title !== void 0 ? ` · ${props.title}` : ""]
1015
1020
  }), jsxs("div", {
1016
1021
  style: {
1017
1022
  display: "flex",
@@ -1019,6 +1024,13 @@ function FallbackShell(props) {
1019
1024
  gap: 4
1020
1025
  },
1021
1026
  children: [
1027
+ jsx(Slot, {
1028
+ name: UI_SLOT_IDS.titlebarActions,
1029
+ context: {
1030
+ surface: "main",
1031
+ controls: WINDOW_CONTROLS
1032
+ }
1033
+ }),
1022
1034
  jsx(Slot, {
1023
1035
  name: UI_SLOT_IDS.settingsEntry,
1024
1036
  context: {
@@ -1030,23 +1042,78 @@ function FallbackShell(props) {
1030
1042
  jsx(IconButton, {
1031
1043
  icon: jsx(Glyph, { children: "—" }),
1032
1044
  label: "最小化",
1033
- onClick: () => control("minimize")
1045
+ onClick: () => props.control("minimize")
1034
1046
  }),
1035
1047
  jsx(IconButton, {
1036
1048
  icon: jsx(Glyph, { children: "□" }),
1037
1049
  label: "最大化切换",
1038
- onClick: () => control("toggle-maximize")
1050
+ onClick: () => props.control("toggle-maximize")
1039
1051
  }),
1040
1052
  jsx(IconButton, {
1041
1053
  icon: jsx(Glyph, { children: "×" }),
1042
1054
  label: "关闭",
1043
- onClick: () => control("close")
1055
+ onClick: () => props.control("close")
1044
1056
  })
1045
1057
  ]
1046
1058
  })]
1047
1059
  });
1060
+ }
1061
+ /** The fallback body. */
1062
+ function FallbackShell(props) {
1063
+ useUiVersion(props.ctx.ui);
1064
+ usePagesVersion(props.ctx);
1065
+ const active = props.ctx.pages.active();
1066
+ const control = (action) => {
1067
+ props.ctx.client.link.call("window.control", { action }).catch(() => {});
1068
+ };
1069
+ const titlebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.titlebar).length > 0;
1070
+ const sidebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.sidebar).length > 0;
1071
+ const statusbarOccupied = props.ctx.ui.list(UI_SLOT_IDS.statusbar).length > 0;
1072
+ const header = titlebarOccupied ? jsx(Slot, {
1073
+ name: UI_SLOT_IDS.titlebar,
1074
+ context: {
1075
+ surface: "main",
1076
+ controls: WINDOW_CONTROLS
1077
+ }
1078
+ }) : jsx(DefaultTitlebar, {
1079
+ ctx: props.ctx,
1080
+ title: active?.title,
1081
+ control
1082
+ });
1083
+ const sidebar = sidebarOccupied ? jsx("div", {
1084
+ className: "snap-fallback-sidebar",
1085
+ style: {
1086
+ display: "flex",
1087
+ flexDirection: "column",
1088
+ height: "100%",
1089
+ minHeight: 0,
1090
+ padding: "4px 8px"
1091
+ },
1092
+ children: jsx(Slot, {
1093
+ name: UI_SLOT_IDS.sidebar,
1094
+ context: { surface: "main" }
1095
+ })
1096
+ }) : void 0;
1097
+ const statusbar = statusbarOccupied ? jsx("div", {
1098
+ className: "snap-fallback-statusbar",
1099
+ style: {
1100
+ display: "flex",
1101
+ alignItems: "center",
1102
+ gap: 12,
1103
+ minHeight: 28,
1104
+ padding: "0 12px",
1105
+ color: "var(--snap-color-muted)",
1106
+ fontSize: "var(--snap-text-sm)"
1107
+ },
1108
+ children: jsx(Slot, {
1109
+ name: UI_SLOT_IDS.statusbar,
1110
+ context: { surface: "main" }
1111
+ })
1112
+ }) : void 0;
1048
1113
  return jsx(AppShell, {
1049
1114
  header,
1115
+ ...sidebar !== void 0 ? { sidebar } : {},
1116
+ ...statusbar !== void 0 ? { footer: statusbar } : {},
1050
1117
  children: active !== void 0 ? active.render() : jsx("div", {
1051
1118
  style: {
1052
1119
  display: "flex",
@@ -2650,6 +2717,39 @@ function SettingsEntry(props) {
2650
2717
  onClick: props.open
2651
2718
  });
2652
2719
  }
2720
+ /** The settings footer: the running app's version plus the copyright line,
2721
+ * pinned below the page area of every settings page. The version rides the
2722
+ * existing `update.state` snapshot (`app.getVersion()`, populated in dev
2723
+ * too); hosts without the update bridge — or bare contexts without client
2724
+ * services — simply get no footer instead of an error. */
2725
+ function SettingsFooter({ ctx }) {
2726
+ const [version, setVersion] = useState(void 0);
2727
+ useEffect(() => {
2728
+ let link;
2729
+ try {
2730
+ link = ctx.client.link;
2731
+ } catch {
2732
+ return;
2733
+ }
2734
+ let cancelled = false;
2735
+ link.call("update.state", {}).then((result) => {
2736
+ if (!cancelled && result.ok) setVersion(result.value.status.currentVersion);
2737
+ }).catch(() => void 0);
2738
+ return () => {
2739
+ cancelled = true;
2740
+ };
2741
+ }, [ctx]);
2742
+ if (version === void 0) return null;
2743
+ return jsxs("footer", {
2744
+ ...part("settings", "footer"),
2745
+ className: "snap-settings-footer",
2746
+ children: [jsxs("span", { children: ["snap-rail v", version] }), jsxs("span", { children: [
2747
+ "© ",
2748
+ (/* @__PURE__ */ new Date()).getFullYear(),
2749
+ " snap-rail · Apache-2.0"
2750
+ ] })]
2751
+ });
2752
+ }
2653
2753
  /** The default settings surface. */
2654
2754
  function SettingsSurface(props) {
2655
2755
  const { service, ctx } = props;
@@ -2723,14 +2823,18 @@ function SettingsSurface(props) {
2723
2823
  }), jsx("span", { children: page.title })]
2724
2824
  }, page.id))]
2725
2825
  }, group))
2726
- }), jsx("main", {
2826
+ }), jsxs("main", {
2727
2827
  ...part("settings", "content"),
2728
2828
  className: "snap-settings-content",
2729
2829
  "data-active-page": activeId,
2730
- children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
2731
- page: active.id,
2732
- children: active.render()
2733
- })
2830
+ children: [jsx("div", {
2831
+ ...part("settings", "page"),
2832
+ className: "snap-settings-page",
2833
+ children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
2834
+ page: active.id,
2835
+ children: active.render()
2836
+ })
2837
+ }), jsx(SettingsFooter, { ctx })]
2734
2838
  })]
2735
2839
  })]
2736
2840
  })
package/lib/settings.js CHANGED
@@ -1939,6 +1939,39 @@ function SettingsEntry(props) {
1939
1939
  onClick: props.open
1940
1940
  });
1941
1941
  }
1942
+ /** The settings footer: the running app's version plus the copyright line,
1943
+ * pinned below the page area of every settings page. The version rides the
1944
+ * existing `update.state` snapshot (`app.getVersion()`, populated in dev
1945
+ * too); hosts without the update bridge — or bare contexts without client
1946
+ * services — simply get no footer instead of an error. */
1947
+ function SettingsFooter({ ctx }) {
1948
+ const [version, setVersion] = useState(void 0);
1949
+ useEffect(() => {
1950
+ let link;
1951
+ try {
1952
+ link = ctx.client.link;
1953
+ } catch {
1954
+ return;
1955
+ }
1956
+ let cancelled = false;
1957
+ link.call("update.state", {}).then((result) => {
1958
+ if (!cancelled && result.ok) setVersion(result.value.status.currentVersion);
1959
+ }).catch(() => void 0);
1960
+ return () => {
1961
+ cancelled = true;
1962
+ };
1963
+ }, [ctx]);
1964
+ if (version === void 0) return null;
1965
+ return jsxs("footer", {
1966
+ ...part("settings", "footer"),
1967
+ className: "snap-settings-footer",
1968
+ children: [jsxs("span", { children: ["snap-rail v", version] }), jsxs("span", { children: [
1969
+ "© ",
1970
+ (/* @__PURE__ */ new Date()).getFullYear(),
1971
+ " snap-rail · Apache-2.0"
1972
+ ] })]
1973
+ });
1974
+ }
1942
1975
  /** The default settings surface. */
1943
1976
  function SettingsSurface(props) {
1944
1977
  const { service, ctx } = props;
@@ -2012,14 +2045,18 @@ function SettingsSurface(props) {
2012
2045
  }), jsx("span", { children: page.title })]
2013
2046
  }, page.id))]
2014
2047
  }, group))
2015
- }), jsx("main", {
2048
+ }), jsxs("main", {
2016
2049
  ...part("settings", "content"),
2017
2050
  className: "snap-settings-content",
2018
2051
  "data-active-page": activeId,
2019
- children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
2020
- page: active.id,
2021
- children: active.render()
2022
- })
2052
+ children: [jsx("div", {
2053
+ ...part("settings", "page"),
2054
+ className: "snap-settings-page",
2055
+ children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
2056
+ page: active.id,
2057
+ children: active.render()
2058
+ })
2059
+ }), jsx(SettingsFooter, { ctx })]
2023
2060
  })]
2024
2061
  })]
2025
2062
  })
@@ -54,8 +54,10 @@ export declare const UI_SLOT_MODES: {
54
54
  readonly "settings.entry": "one";
55
55
  readonly "settings.surface": "one";
56
56
  };
57
+ /** The window controls a layout exposes to its chrome contributions. */
58
+ export declare const WINDOW_CONTROLS: readonly ["minimize", "toggle-maximize", "close"];
57
59
  /** The operator-window controls a layout exposes to chrome contributions. */
58
- export type WindowControl = 'minimize' | 'toggle-maximize' | 'close';
60
+ export type WindowControl = (typeof WINDOW_CONTROLS)[number];
59
61
  /** The context a settings trigger receives from the layout that hosts it. */
60
62
  export interface SettingsEntryContext {
61
63
  /** `icon` for a glyph-only chrome button, `label` for a labelled action. */
@@ -89,11 +91,11 @@ export interface SlotContextMap {
89
91
  };
90
92
  'shell.titlebar': {
91
93
  surface: SurfaceId;
92
- controls: WindowControl;
94
+ controls: readonly WindowControl[];
93
95
  };
94
96
  'shell.titlebar.actions': {
95
97
  surface: SurfaceId;
96
- controls: WindowControl;
98
+ controls: readonly WindowControl[];
97
99
  };
98
100
  'shell.sidebar': {
99
101
  surface: SurfaceId;
@@ -363,7 +365,7 @@ export declare const UI_COMPONENTS: {
363
365
  readonly props: readonly ["state"];
364
366
  };
365
367
  readonly settings: {
366
- readonly parts: readonly ["settings.root", "settings.header", "settings.title", "settings.body", "settings.nav", "settings.nav-item", "settings.nav-icon", "settings.group", "settings.group-title", "settings.content"];
368
+ readonly parts: readonly ["settings.root", "settings.header", "settings.title", "settings.body", "settings.nav", "settings.nav-item", "settings.nav-icon", "settings.group", "settings.group-title", "settings.content", "settings.page", "settings.footer"];
367
369
  };
368
370
  };
369
371
  /** One semantic component name. */
@@ -48,6 +48,8 @@ export const UI_SLOT_MODES = {
48
48
  [UI_SLOT_IDS.settingsEntry]: 'one',
49
49
  [UI_SLOT_IDS.settingsSurface]: 'one',
50
50
  };
51
+ /** The window controls a layout exposes to its chrome contributions. */
52
+ export const WINDOW_CONTROLS = ['minimize', 'toggle-maximize', 'close'];
51
53
  /** Diagnostic kinds surfaced by the UI registry. */
52
54
  export const UI_DIAGNOSTIC_KINDS = [
53
55
  'unknown-slot',
@@ -246,6 +248,8 @@ export const UI_COMPONENTS = {
246
248
  'settings.group',
247
249
  'settings.group-title',
248
250
  'settings.content',
251
+ 'settings.page',
252
+ 'settings.footer',
249
253
  ],
250
254
  },
251
255
  };
@@ -5,6 +5,13 @@
5
5
  * suite layout with higher precedence replaces it and its disposal brings the
6
6
  * fallback back automatically.
7
7
  *
8
+ * It renders **every** slot it declares: `shell.titlebar` and
9
+ * `shell.titlebar.actions` in the window bar, `shell.sidebar` and
10
+ * `shell.statusbar` in the shell frame once something contributes to them,
11
+ * `settings.entry` next to the window controls. A slot declared but never
12
+ * rendered would swallow contributions without a trace, so the two lists stay
13
+ * in step.
14
+ *
8
15
  * @module @snap-rail/ui/fallback
9
16
  */
10
17
  import { type Plugin } from '@snap-rail/cordis';
@@ -1,12 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { AppShell, Button, EmptyState, IconButton } from "./components/index.js";
3
- import { UI_SLOT_IDS } from "./contract.js";
3
+ import { UI_SLOT_IDS, WINDOW_CONTROLS } from "./contract.js";
4
4
  import { usePagesVersion } from "./pages.js";
5
5
  import { Slot, useUiVersion } from "./slots.js";
6
6
  /** A compact glyph for the window controls. */
7
7
  function Glyph(props) {
8
8
  return _jsx("span", { "aria-hidden": "true", style: { lineHeight: 1 }, children: props.children });
9
9
  }
10
+ /**
11
+ * The fallback titlebar: the product name and the active page on the left; the
12
+ * contributed `shell.titlebar.actions`, the settings seat, and the window
13
+ * controls on the right. The whole bar is replaced when a plugin occupies
14
+ * `shell.titlebar` — that occupant then owns its own controls.
15
+ */
16
+ function DefaultTitlebar(props) {
17
+ return (_jsxs("div", { className: "snap-fallback-titlebar", style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', minHeight: 48, paddingLeft: 16 }, children: [_jsxs("span", { style: { color: 'var(--snap-color-muted)', fontSize: 'var(--snap-text-sm)' }, children: ["snap-rail", props.title !== undefined ? ` · ${props.title}` : ''] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [_jsx(Slot, { name: UI_SLOT_IDS.titlebarActions, context: { surface: 'main', controls: WINDOW_CONTROLS } }), _jsx(Slot, { name: UI_SLOT_IDS.settingsEntry, context: {
18
+ presentation: 'icon',
19
+ open: () => props.ctx.settings.open(),
20
+ isOpen: props.ctx.settings.isOpen(),
21
+ } }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u2014" }), label: "\u6700\u5C0F\u5316", onClick: () => props.control('minimize') }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u25A1" }), label: "\u6700\u5927\u5316\u5207\u6362", onClick: () => props.control('toggle-maximize') }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u00D7" }), label: "\u5173\u95ED", onClick: () => props.control('close') })] })] }));
22
+ }
10
23
  /** The fallback body. */
11
24
  function FallbackShell(props) {
12
25
  useUiVersion(props.ctx.ui);
@@ -15,12 +28,31 @@ function FallbackShell(props) {
15
28
  const control = (action) => {
16
29
  void props.ctx.client.link.call('window.control', { action }).catch(() => { });
17
30
  };
18
- const header = (_jsxs("div", { className: "snap-fallback-titlebar", style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', minHeight: 48, paddingLeft: 16 }, children: [_jsxs("span", { style: { color: 'var(--snap-color-muted)', fontSize: 'var(--snap-text-sm)' }, children: ["snap-rail", active !== undefined ? ` · ${active.title}` : ''] }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [_jsx(Slot, { name: UI_SLOT_IDS.settingsEntry, context: {
19
- presentation: 'icon',
20
- open: () => props.ctx.settings.open(),
21
- isOpen: props.ctx.settings.isOpen(),
22
- } }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u2014" }), label: "\u6700\u5C0F\u5316", onClick: () => control('minimize') }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u25A1" }), label: "\u6700\u5927\u5316\u5207\u6362", onClick: () => control('toggle-maximize') }), _jsx(IconButton, { icon: _jsx(Glyph, { children: "\u00D7" }), label: "\u5173\u95ED", onClick: () => control('close') })] })] }));
23
- return (_jsx(AppShell, { header: header, children: active !== undefined
31
+ // The window bar has one occupant (a layout-level replacement); the sidebar
32
+ // and statusbar are extension seats, so they only take space once something
33
+ // contributes — an empty strip would be a permanent visual tax on every
34
+ // installation that never uses them.
35
+ const titlebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.titlebar).length > 0;
36
+ const sidebarOccupied = props.ctx.ui.list(UI_SLOT_IDS.sidebar).length > 0;
37
+ const statusbarOccupied = props.ctx.ui.list(UI_SLOT_IDS.statusbar).length > 0;
38
+ const header = titlebarOccupied
39
+ ? _jsx(Slot, { name: UI_SLOT_IDS.titlebar, context: { surface: 'main', controls: WINDOW_CONTROLS } })
40
+ : _jsx(DefaultTitlebar, { ctx: props.ctx, title: active?.title, control: control });
41
+ const sidebar = sidebarOccupied
42
+ ? (_jsx("div", { className: "snap-fallback-sidebar", style: { display: 'flex', flexDirection: 'column', height: '100%', minHeight: 0, padding: '4px 8px' }, children: _jsx(Slot, { name: UI_SLOT_IDS.sidebar, context: { surface: 'main' } }) }))
43
+ : undefined;
44
+ const statusbar = statusbarOccupied
45
+ ? (_jsx("div", { className: "snap-fallback-statusbar", style: {
46
+ display: 'flex',
47
+ alignItems: 'center',
48
+ gap: 12,
49
+ minHeight: 28,
50
+ padding: '0 12px',
51
+ color: 'var(--snap-color-muted)',
52
+ fontSize: 'var(--snap-text-sm)',
53
+ }, children: _jsx(Slot, { name: UI_SLOT_IDS.statusbar, context: { surface: 'main' } }) }))
54
+ : undefined;
55
+ return (_jsx(AppShell, { header: header, ...sidebar !== undefined ? { sidebar } : {}, ...statusbar !== undefined ? { footer: statusbar } : {}, children: active !== undefined
24
56
  ? active.render()
25
57
  : (_jsx("div", { style: { display: 'flex', minHeight: '100%', alignItems: 'center', justifyContent: 'center', padding: 24 }, children: _jsx(EmptyState, { title: "\u5C1A\u672A\u6FC0\u6D3B\u4E1A\u52A1\u5957\u4EF6", action: _jsx(Button, { intent: "primary", onClick: () => props.ctx.settings.open('plugins'), children: "\u6253\u5F00\u8BBE\u7F6E" }) }) })) }));
26
58
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Component, useState, useSyncExternalStore } from 'react';
2
+ import { Component, useEffect, useState, useSyncExternalStore } from 'react';
3
3
  import { Button, Dialog, DialogContent, DialogTitle, EmptyState, IconButton, } from "./components/index.js";
4
4
  import { UI_SLOT_IDS } from "./contract.js";
5
5
  import { AppearancePage } from "./settings-pages/appearance.js";
@@ -42,6 +42,32 @@ export function SettingsEntry(props) {
42
42
  }
43
43
  return _jsx(IconButton, { icon: _jsx(GearIcon, {}), label: "\u8BBE\u7F6E", active: props.isOpen, onClick: props.open });
44
44
  }
45
+ /** The settings footer: the running app's version plus the copyright line,
46
+ * pinned below the page area of every settings page. The version rides the
47
+ * existing `update.state` snapshot (`app.getVersion()`, populated in dev
48
+ * too); hosts without the update bridge — or bare contexts without client
49
+ * services — simply get no footer instead of an error. */
50
+ function SettingsFooter({ ctx }) {
51
+ const [version, setVersion] = useState(undefined);
52
+ useEffect(() => {
53
+ let link;
54
+ try {
55
+ link = ctx.client.link;
56
+ }
57
+ catch {
58
+ return;
59
+ }
60
+ let cancelled = false;
61
+ void link.call('update.state', {}).then(result => {
62
+ if (!cancelled && result.ok)
63
+ setVersion(result.value.status.currentVersion);
64
+ }).catch(() => undefined);
65
+ return () => { cancelled = true; };
66
+ }, [ctx]);
67
+ if (version === undefined)
68
+ return null;
69
+ return (_jsxs("footer", { ...part('settings', 'footer'), className: "snap-settings-footer", children: [_jsxs("span", { children: ["snap-rail v", version] }), _jsxs("span", { children: ["\u00A9 ", new Date().getFullYear(), " snap-rail \u00B7 Apache-2.0"] })] }));
70
+ }
45
71
  /** The default settings surface. */
46
72
  export function SettingsSurface(props) {
47
73
  const { service, ctx } = props;
@@ -61,9 +87,9 @@ export function SettingsSurface(props) {
61
87
  bucket.push(page);
62
88
  }
63
89
  return (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: open, onOpenChange: next => { if (!next)
64
- service.close(); }, children: _jsx(DialogContent, { presentation: "fullscreen", showClose: false, children: _jsxs("div", { ...part('settings', 'root'), className: "snap-settings", children: [_jsxs("header", { ...part('settings', 'header'), className: "snap-settings-header", children: [_jsx(DialogTitle, { children: "\u8BBE\u7F6E" }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [_jsx(IconButton, { icon: _jsx(GearIcon, {}), label: "\u914D\u7F6E\u63D2\u4EF6\u6E90", onClick: () => setFeedOpen(true) }), _jsx(IconButton, { icon: _jsx(CloseIcon, {}), label: "\u5173\u95ED", onClick: () => service.close() })] })] }), _jsxs("div", { ...part('settings', 'body'), className: "snap-settings-body", children: [_jsx("nav", { ...part('settings', 'nav'), className: "snap-settings-nav", "aria-label": "\u8BBE\u7F6E\u9875", children: [...groups.entries()].map(([group, entries]) => (_jsxs("div", { ...part('settings', 'group'), className: "snap-settings-group", children: [_jsx("div", { ...part('settings', 'group-title'), className: "snap-settings-group-title", children: group }), entries.map(page => (_jsxs("button", { type: "button", ...part('settings', 'nav-item'), className: cn('snap-settings-nav-item', page.id === activeId && 'is-active'), "data-active": page.id === activeId || undefined, "aria-current": page.id === activeId ? 'page' : undefined, onClick: () => service.open(page.id), children: [page.icon !== undefined && _jsx("span", { ...part('settings', 'nav-icon'), children: page.icon }), _jsx("span", { children: page.title })] }, page.id)))] }, group))) }), _jsx("main", { ...part('settings', 'content'), className: "snap-settings-content", "data-active-page": activeId, children: active === undefined
65
- ? _jsx(EmptyState, { title: "\u6682\u65E0\u8BBE\u7F6E\u9875" })
66
- : _jsx(SettingsPageBoundary, { page: active.id, children: active.render() }) })] })] }) }) }), _jsx(PluginFeedDialog, { ctx: ctx, open: feedOpen, onOpenChange: setFeedOpen })] }));
90
+ service.close(); }, children: _jsx(DialogContent, { presentation: "fullscreen", showClose: false, children: _jsxs("div", { ...part('settings', 'root'), className: "snap-settings", children: [_jsxs("header", { ...part('settings', 'header'), className: "snap-settings-header", children: [_jsx(DialogTitle, { children: "\u8BBE\u7F6E" }), _jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 4 }, children: [_jsx(IconButton, { icon: _jsx(GearIcon, {}), label: "\u914D\u7F6E\u63D2\u4EF6\u6E90", onClick: () => setFeedOpen(true) }), _jsx(IconButton, { icon: _jsx(CloseIcon, {}), label: "\u5173\u95ED", onClick: () => service.close() })] })] }), _jsxs("div", { ...part('settings', 'body'), className: "snap-settings-body", children: [_jsx("nav", { ...part('settings', 'nav'), className: "snap-settings-nav", "aria-label": "\u8BBE\u7F6E\u9875", children: [...groups.entries()].map(([group, entries]) => (_jsxs("div", { ...part('settings', 'group'), className: "snap-settings-group", children: [_jsx("div", { ...part('settings', 'group-title'), className: "snap-settings-group-title", children: group }), entries.map(page => (_jsxs("button", { type: "button", ...part('settings', 'nav-item'), className: cn('snap-settings-nav-item', page.id === activeId && 'is-active'), "data-active": page.id === activeId || undefined, "aria-current": page.id === activeId ? 'page' : undefined, onClick: () => service.open(page.id), children: [page.icon !== undefined && _jsx("span", { ...part('settings', 'nav-icon'), children: page.icon }), _jsx("span", { children: page.title })] }, page.id)))] }, group))) }), _jsxs("main", { ...part('settings', 'content'), className: "snap-settings-content", "data-active-page": activeId, children: [_jsx("div", { ...part('settings', 'page'), className: "snap-settings-page", children: active === undefined
91
+ ? _jsx(EmptyState, { title: "\u6682\u65E0\u8BBE\u7F6E\u9875" })
92
+ : _jsx(SettingsPageBoundary, { page: active.id, children: active.render() }) }), _jsx(SettingsFooter, { ctx: ctx })] })] })] }) }) }), _jsx(PluginFeedDialog, { ctx: ctx, open: feedOpen, onOpenChange: setFeedOpen })] }));
67
93
  }
68
94
  /** Mount the settings registry and its default slot contributions. */
69
95
  const settingsPlugin = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@snap-rail/ui",
3
3
  "description": "The built-in UI substrate: semantic components, typed region slots, skins, settings and renderer runtime",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",
@@ -84,10 +84,10 @@
84
84
  "react": ">=19",
85
85
  "react-dom": ">=19",
86
86
  "zod": "^4.4.3",
87
+ "@snap-rail/connection": "^0.1.0",
87
88
  "@snap-rail/cordis": "^4.0.3",
88
89
  "@snap-rail/protocol": "^0.1.3",
89
- "@snap-rail/shell": "^0.2.4",
90
- "@snap-rail/connection": "^0.1.0"
90
+ "@snap-rail/shell": "^0.2.5"
91
91
  },
92
92
  "devDependencies": {
93
93
  "@types/react": "^19.2.14",
@@ -100,13 +100,13 @@
100
100
  "vitest": "^4.1.8",
101
101
  "zod": "^4.4.3",
102
102
  "@snap-rail/app-boot": "^0.1.3",
103
- "@snap-rail/client-kernel": "^0.1.2",
104
103
  "@snap-rail/connection": "^0.1.0",
105
104
  "@snap-rail/cordis": "^4.0.3",
106
105
  "@snap-rail/cordis-plugin-timer": "^1.1.3",
107
- "@snap-rail/protocol": "^0.1.3",
108
- "@snap-rail/shell": "^0.2.4",
109
- "@snap-rail/station-rpc": "^0.1.0"
106
+ "@snap-rail/client-kernel": "^0.1.2",
107
+ "@snap-rail/shell": "^0.2.5",
108
+ "@snap-rail/station-rpc": "^0.1.0",
109
+ "@snap-rail/protocol": "^0.1.3"
110
110
  },
111
111
  "snapRail": {
112
112
  "layer": "base",
@@ -337,11 +337,28 @@
337
337
  }
338
338
 
339
339
  [data-snap-part='settings.content'] {
340
+ display: flex;
341
+ flex-direction: column;
340
342
  flex: 1;
341
343
  min-width: 0;
344
+ min-height: 0;
345
+ overflow: hidden;
346
+ }
347
+
348
+ [data-snap-part='settings.page'] {
349
+ flex: 1;
350
+ min-height: 0;
342
351
  overflow: auto;
343
352
  }
344
353
 
354
+ [data-snap-part='settings.footer'] {
355
+ display: flex;
356
+ align-items: center;
357
+ justify-content: space-between;
358
+ gap: var(--snap-space-sm);
359
+ flex-shrink: 0;
360
+ }
361
+
345
362
  [data-snap-part='settings.nav-item'] {
346
363
  display: flex;
347
364
  align-items: center;
@@ -940,13 +940,20 @@
940
940
  box-shadow: inset 3px 0 0 var(--snap-color-primary);
941
941
  }
942
942
 
943
- :is([data-snap-skin='default-light'], [data-snap-skin='default-dark']) [data-snap-part='settings.content'] {
943
+ :is([data-snap-skin='default-light'], [data-snap-skin='default-dark']) [data-snap-part='settings.page'] {
944
944
  padding: var(--snap-space-lg);
945
945
  /* Deep bottom padding: the scrolled pane's last control must clear the
946
946
  * window edge instead of hanging sliced across it. */
947
947
  padding-bottom: var(--snap-space-xl);
948
948
  }
949
949
 
950
+ :is([data-snap-skin='default-light'], [data-snap-skin='default-dark']) [data-snap-part='settings.footer'] {
951
+ padding: var(--snap-space-sm) var(--snap-space-lg);
952
+ border-top: var(--snap-border-width) solid var(--snap-color-border);
953
+ color: var(--snap-color-muted);
954
+ font-size: var(--snap-text-xs);
955
+ }
956
+
950
957
  @keyframes snap-spin {
951
958
  to { transform: rotate(360deg); }
952
959
  }