@snap-rail/ui 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
- import { createContext, useContext, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
4
+ import { createContext, useContext, useEffect, useId, useRef, useState } from "react";
5
5
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
6
6
  import * as PopoverPrimitive from "@radix-ui/react-popover";
7
- import * as ToastPrimitive from "@radix-ui/react-toast";
8
7
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
8
+ import { Toaster as Toaster$1, toast as toast$1 } from "sonner";
9
9
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
10
10
  import * as LabelPrimitive from "@radix-ui/react-label";
11
11
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
@@ -374,9 +374,10 @@ function NumberInput({ min, max, step = 1, size = "md", invalid = false, fieldCl
374
374
  //#endregion
375
375
  //#region lib/types/components/overlay.js
376
376
  /**
377
- * Overlay semantics over Radix: tooltips, popovers, dropdown menus, and
378
- * toasts. Behaviour/keyboard/focus handling stays here; skins target the
379
- * stable parts (`tooltip.*`, `popover.*`, `menu.*`, `toast.*`) and state
377
+ * Overlay semantics over Radix: tooltips, popovers, and dropdown menus; the
378
+ * toast queue runs on Sonner (the Radix toast primitive is deprecated
379
+ * upstream). Behaviour/keyboard/focus handling stays here; skins target the
380
+ * stable parts (`tooltip.*`, `popover.*`, `menu.*`) and Sonner's toast data
380
381
  * attributes. The imperative toast() helper pairs with the <Toaster/> the
381
382
  * runtime mounts in every surface root.
382
383
  *
@@ -543,102 +544,88 @@ function MenuSeparator({ className, ...props }) {
543
544
  ...part("menu", "separator")
544
545
  });
545
546
  }
546
- let toastNextId = 1;
547
- let toastRecords = [];
548
- const toastListeners = /* @__PURE__ */ new Set();
549
- function toastEmit() {
550
- for (const listener of toastListeners) listener();
551
- }
552
- function toastDismiss(id) {
553
- toastRecords = toastRecords.filter((record) => record.id !== id);
554
- toastEmit();
547
+ /** Stroke glyphs per intent (lucide-style 24-box, `currentColor`); the skin
548
+ * colours them through the toast's `[data-icon]`. */
549
+ const TOAST_INTENT_PATHS = {
550
+ neutral: jsxs(Fragment, { children: [
551
+ jsx("circle", {
552
+ cx: "12",
553
+ cy: "12",
554
+ r: "10"
555
+ }),
556
+ jsx("path", { d: "M12 16v-4" }),
557
+ jsx("path", { d: "M12 8h.01" })
558
+ ] }),
559
+ primary: jsxs(Fragment, { children: [
560
+ jsx("circle", {
561
+ cx: "12",
562
+ cy: "12",
563
+ r: "10"
564
+ }),
565
+ jsx("path", { d: "M12 16v-4" }),
566
+ jsx("path", { d: "M12 8h.01" })
567
+ ] }),
568
+ success: jsxs(Fragment, { children: [jsx("circle", {
569
+ cx: "12",
570
+ cy: "12",
571
+ r: "10"
572
+ }), jsx("path", { d: "m9 12 2 2 4-4" })] }),
573
+ warning: jsxs(Fragment, { children: [
574
+ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
575
+ jsx("path", { d: "M12 9v4" }),
576
+ jsx("path", { d: "M12 17h.01" })
577
+ ] }),
578
+ danger: jsxs(Fragment, { children: [
579
+ jsx("circle", {
580
+ cx: "12",
581
+ cy: "12",
582
+ r: "10"
583
+ }),
584
+ jsx("path", { d: "m15 9-6 6" }),
585
+ jsx("path", { d: "m9 9 6 6" })
586
+ ] })
587
+ };
588
+ function toastIcon(intent) {
589
+ return jsx("svg", {
590
+ viewBox: "0 0 24 24",
591
+ fill: "none",
592
+ stroke: "currentColor",
593
+ strokeWidth: 2,
594
+ strokeLinecap: "round",
595
+ strokeLinejoin: "round",
596
+ "aria-hidden": "true",
597
+ children: TOAST_INTENT_PATHS[intent]
598
+ });
555
599
  }
556
- /** Enqueue a toast on the runtime-mounted {@link Toaster}s. */
600
+ /** Enqueue a toast on the runtime-mounted {@link Toaster}s. Backed by Sonner
601
+ * (the Radix toast primitive is deprecated upstream): `success`/`warning`/
602
+ * `danger` map to the typed emitters, `neutral`/`primary` ride the plain one,
603
+ * and every toast carries an `snap-intent-*` class the skins target. */
557
604
  function toast(entry) {
558
- const id = toastNextId++;
559
- toastRecords = [...toastRecords, {
560
- ...entry,
561
- id
562
- }];
563
- toastEmit();
564
- return id;
605
+ const intent = entry.intent ?? "neutral";
606
+ const options = {
607
+ description: entry.description,
608
+ icon: toastIcon(intent),
609
+ duration: entry.duration === 0 ? Number.POSITIVE_INFINITY : entry.duration ?? 5e3,
610
+ className: `snap-intent-${intent}`
611
+ };
612
+ switch (intent) {
613
+ case "success": return toast$1.success(entry.title, options);
614
+ case "warning": return toast$1.warning(entry.title, options);
615
+ case "danger": return toast$1.error(entry.title, options);
616
+ default: return toast$1(entry.title, options);
617
+ }
565
618
  }
566
619
  /** Dismiss a queued toast by id. */
567
620
  function dismissToast(id) {
568
- toastDismiss(id);
621
+ toast$1.dismiss(id);
569
622
  }
570
623
  /** The runtime-mounted viewport: renders the shared toast queue. Pages never
571
624
  * mount this themselves — the runtime provides one per surface root. */
572
- function Toaster(props) {
573
- const records = useSyncExternalStore((onStoreChange) => {
574
- toastListeners.add(onStoreChange);
575
- return () => toastListeners.delete(onStoreChange);
576
- }, () => toastRecords, () => toastRecords);
577
- return jsxs(ToastPrimitive.Provider, {
578
- ...props,
579
- children: [records.map((record) => jsxs(ToastPrimitive.Root, {
580
- ...part("toast", "root"),
581
- className: "snap-toast",
582
- "data-intent": record.intent ?? "neutral",
583
- duration: record.duration ?? 5e3,
584
- onOpenChange: (open) => {
585
- if (!open) toastDismiss(record.id);
586
- },
587
- children: [
588
- jsx(ToastTitle, { children: record.title }),
589
- record.description !== void 0 && jsx(ToastDescription, { children: record.description }),
590
- jsx(ToastClose, { "aria-label": "关闭" })
591
- ]
592
- }, record.id)), jsx(ToastViewport, {})]
593
- });
594
- }
595
- /** The raw toast root for pages that manage their own open state. */
596
- const Toast = ToastPrimitive.Root;
597
- /** A toast title with its part tag. */
598
- function ToastTitle({ className, children, ...props }) {
599
- return jsx(ToastPrimitive.Title, {
600
- className: cn("snap-toast-title", className),
601
- ...props,
602
- ...part("toast", "title"),
603
- children
604
- });
605
- }
606
- /** A toast description with its part tag. */
607
- function ToastDescription({ className, children, ...props }) {
608
- return jsx(ToastPrimitive.Description, {
609
- className: cn("snap-toast-description", className),
610
- ...props,
611
- ...part("toast", "description"),
612
- children
613
- });
614
- }
615
- /** An interactive toast action (confirm/retry affordances). */
616
- function ToastAction({ className, children, ...props }) {
617
- return jsx(ToastPrimitive.Action, {
618
- className: cn("snap-toast-action", className),
619
- ...props,
620
- ...part("toast", "action"),
621
- children
622
- });
623
- }
624
- /** A toast dismissal button. */
625
- function ToastClose({ className, children, ...props }) {
626
- return jsx(ToastPrimitive.Close, {
627
- className: cn("snap-toast-close", className),
628
- ...props,
629
- ...part("toast", "close"),
630
- children: children ?? jsx("span", {
631
- "aria-hidden": "true",
632
- children: "×"
633
- })
634
- });
635
- }
636
- /** The toast viewport; only the runtime's {@link Toaster} mounts one. */
637
- function ToastViewport({ className, ...props }) {
638
- return jsx(ToastPrimitive.Viewport, {
639
- className: cn("snap-toast-viewport", className),
640
- ...props,
641
- ...part("toast", "viewport")
625
+ function Toaster() {
626
+ return jsx(Toaster$1, {
627
+ position: "bottom-right",
628
+ closeButton: true
642
629
  });
643
630
  }
644
631
  //#endregion
@@ -2192,4 +2179,4 @@ function TableEmpty({ colSpan, children }) {
2192
2179
  }) });
2193
2180
  }
2194
2181
  //#endregion
2195
- export { Alert, AlertDescription, AlertTitle, AppShell, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, Controller, 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, Sheet, Skeleton, Slider, Spinner, Split, Stack, Switch, Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toast, ToastAction, ToastClose, ToastDescription, ToastTitle, ToastViewport, Toaster, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchSelect, attachDragPan, cn, controlHeight, dismissToast, literalValuesOf, part, schemaNodeOf, space, toast, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch, zodResolver };
2182
+ export { Alert, AlertDescription, AlertTitle, AppShell, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, Controller, 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, Sheet, Skeleton, Slider, Spinner, Split, Stack, Switch, Table, TableBody, TableCell, TableEmpty, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TouchSelect, attachDragPan, cn, controlHeight, dismissToast, literalValuesOf, part, schemaNodeOf, space, toast, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch, zodResolver };
package/lib/contract.js CHANGED
@@ -342,17 +342,6 @@ const UI_COMPONENTS = {
342
342
  ],
343
343
  slots: ["trigger", "content"]
344
344
  },
345
- toast: {
346
- parts: [
347
- "toast.root",
348
- "toast.title",
349
- "toast.description",
350
- "toast.action",
351
- "toast.close",
352
- "toast.viewport"
353
- ],
354
- slots: ["action"]
355
- },
356
345
  progress: { parts: [
357
346
  "progress.root",
358
347
  "progress.track",
@@ -596,7 +585,9 @@ const UI_COMPONENTS = {
596
585
  "settings.nav-icon",
597
586
  "settings.group",
598
587
  "settings.group-title",
599
- "settings.content"
588
+ "settings.content",
589
+ "settings.page",
590
+ "settings.footer"
600
591
  ] }
601
592
  };
602
593
  //#endregion
package/lib/fallback.js CHANGED
@@ -4,8 +4,8 @@ import { Slot } from "@radix-ui/react-slot";
4
4
  import { Component, createContext, useContext, useSyncExternalStore } from "react";
5
5
  import "@radix-ui/react-dropdown-menu";
6
6
  import "@radix-ui/react-popover";
7
- import "@radix-ui/react-toast";
8
7
  import "@radix-ui/react-tooltip";
8
+ import "sonner";
9
9
  import "@radix-ui/react-checkbox";
10
10
  import "@radix-ui/react-label";
11
11
  import "@radix-ui/react-radio-group";
@@ -127,6 +127,39 @@ function IconButton({ icon, label, active = false, intent = "neutral", emphasis
127
127
  })
128
128
  });
129
129
  }
130
+ jsxs(Fragment, { children: [
131
+ jsx("circle", {
132
+ cx: "12",
133
+ cy: "12",
134
+ r: "10"
135
+ }),
136
+ jsx("path", { d: "M12 16v-4" }),
137
+ jsx("path", { d: "M12 8h.01" })
138
+ ] }), jsxs(Fragment, { children: [
139
+ jsx("circle", {
140
+ cx: "12",
141
+ cy: "12",
142
+ r: "10"
143
+ }),
144
+ jsx("path", { d: "M12 16v-4" }),
145
+ jsx("path", { d: "M12 8h.01" })
146
+ ] }), jsxs(Fragment, { children: [jsx("circle", {
147
+ cx: "12",
148
+ cy: "12",
149
+ r: "10"
150
+ }), jsx("path", { d: "m9 12 2 2 4-4" })] }), jsxs(Fragment, { children: [
151
+ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
152
+ jsx("path", { d: "M12 9v4" }),
153
+ jsx("path", { d: "M12 17h.01" })
154
+ ] }), jsxs(Fragment, { children: [
155
+ jsx("circle", {
156
+ cx: "12",
157
+ cy: "12",
158
+ r: "10"
159
+ }),
160
+ jsx("path", { d: "m15 9-6 6" }),
161
+ jsx("path", { d: "m9 9 6 6" })
162
+ ] });
130
163
  //#endregion
131
164
  //#region lib/types/components/feedback.js
132
165
  /** A centered empty/zero-state block. */
package/lib/index.js CHANGED
@@ -4,8 +4,8 @@ import * as SeparatorPrimitive from "@radix-ui/react-separator";
4
4
  import { Slot as Slot$1 } from "@radix-ui/react-slot";
5
5
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
6
6
  import * as PopoverPrimitive from "@radix-ui/react-popover";
7
- import * as ToastPrimitive from "@radix-ui/react-toast";
8
7
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
8
+ import { Toaster as Toaster$1, toast as toast$1 } from "sonner";
9
9
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
10
10
  import * as LabelPrimitive from "@radix-ui/react-label";
11
11
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
@@ -369,17 +369,6 @@ const UI_COMPONENTS = {
369
369
  ],
370
370
  slots: ["trigger", "content"]
371
371
  },
372
- toast: {
373
- parts: [
374
- "toast.root",
375
- "toast.title",
376
- "toast.description",
377
- "toast.action",
378
- "toast.close",
379
- "toast.viewport"
380
- ],
381
- slots: ["action"]
382
- },
383
372
  progress: { parts: [
384
373
  "progress.root",
385
374
  "progress.track",
@@ -623,7 +612,9 @@ const UI_COMPONENTS = {
623
612
  "settings.nav-icon",
624
613
  "settings.group",
625
614
  "settings.group-title",
626
- "settings.content"
615
+ "settings.content",
616
+ "settings.page",
617
+ "settings.footer"
627
618
  ] }
628
619
  };
629
620
  //#endregion
@@ -1320,9 +1311,10 @@ function NumberInput({ min, max, step = 1, size = "md", invalid = false, fieldCl
1320
1311
  //#endregion
1321
1312
  //#region lib/types/components/overlay.js
1322
1313
  /**
1323
- * Overlay semantics over Radix: tooltips, popovers, dropdown menus, and
1324
- * toasts. Behaviour/keyboard/focus handling stays here; skins target the
1325
- * stable parts (`tooltip.*`, `popover.*`, `menu.*`, `toast.*`) and state
1314
+ * Overlay semantics over Radix: tooltips, popovers, and dropdown menus; the
1315
+ * toast queue runs on Sonner (the Radix toast primitive is deprecated
1316
+ * upstream). Behaviour/keyboard/focus handling stays here; skins target the
1317
+ * stable parts (`tooltip.*`, `popover.*`, `menu.*`) and Sonner's toast data
1326
1318
  * attributes. The imperative toast() helper pairs with the <Toaster/> the
1327
1319
  * runtime mounts in every surface root.
1328
1320
  *
@@ -1489,102 +1481,88 @@ function MenuSeparator({ className, ...props }) {
1489
1481
  ...part("menu", "separator")
1490
1482
  });
1491
1483
  }
1492
- let toastNextId = 1;
1493
- let toastRecords = [];
1494
- const toastListeners = /* @__PURE__ */ new Set();
1495
- function toastEmit() {
1496
- for (const listener of toastListeners) listener();
1497
- }
1498
- function toastDismiss(id) {
1499
- toastRecords = toastRecords.filter((record) => record.id !== id);
1500
- toastEmit();
1484
+ /** Stroke glyphs per intent (lucide-style 24-box, `currentColor`); the skin
1485
+ * colours them through the toast's `[data-icon]`. */
1486
+ const TOAST_INTENT_PATHS = {
1487
+ neutral: jsxs(Fragment, { children: [
1488
+ jsx("circle", {
1489
+ cx: "12",
1490
+ cy: "12",
1491
+ r: "10"
1492
+ }),
1493
+ jsx("path", { d: "M12 16v-4" }),
1494
+ jsx("path", { d: "M12 8h.01" })
1495
+ ] }),
1496
+ primary: jsxs(Fragment, { children: [
1497
+ jsx("circle", {
1498
+ cx: "12",
1499
+ cy: "12",
1500
+ r: "10"
1501
+ }),
1502
+ jsx("path", { d: "M12 16v-4" }),
1503
+ jsx("path", { d: "M12 8h.01" })
1504
+ ] }),
1505
+ success: jsxs(Fragment, { children: [jsx("circle", {
1506
+ cx: "12",
1507
+ cy: "12",
1508
+ r: "10"
1509
+ }), jsx("path", { d: "m9 12 2 2 4-4" })] }),
1510
+ warning: jsxs(Fragment, { children: [
1511
+ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
1512
+ jsx("path", { d: "M12 9v4" }),
1513
+ jsx("path", { d: "M12 17h.01" })
1514
+ ] }),
1515
+ danger: jsxs(Fragment, { children: [
1516
+ jsx("circle", {
1517
+ cx: "12",
1518
+ cy: "12",
1519
+ r: "10"
1520
+ }),
1521
+ jsx("path", { d: "m15 9-6 6" }),
1522
+ jsx("path", { d: "m9 9 6 6" })
1523
+ ] })
1524
+ };
1525
+ function toastIcon(intent) {
1526
+ return jsx("svg", {
1527
+ viewBox: "0 0 24 24",
1528
+ fill: "none",
1529
+ stroke: "currentColor",
1530
+ strokeWidth: 2,
1531
+ strokeLinecap: "round",
1532
+ strokeLinejoin: "round",
1533
+ "aria-hidden": "true",
1534
+ children: TOAST_INTENT_PATHS[intent]
1535
+ });
1501
1536
  }
1502
- /** Enqueue a toast on the runtime-mounted {@link Toaster}s. */
1537
+ /** Enqueue a toast on the runtime-mounted {@link Toaster}s. Backed by Sonner
1538
+ * (the Radix toast primitive is deprecated upstream): `success`/`warning`/
1539
+ * `danger` map to the typed emitters, `neutral`/`primary` ride the plain one,
1540
+ * and every toast carries an `snap-intent-*` class the skins target. */
1503
1541
  function toast(entry) {
1504
- const id = toastNextId++;
1505
- toastRecords = [...toastRecords, {
1506
- ...entry,
1507
- id
1508
- }];
1509
- toastEmit();
1510
- return id;
1542
+ const intent = entry.intent ?? "neutral";
1543
+ const options = {
1544
+ description: entry.description,
1545
+ icon: toastIcon(intent),
1546
+ duration: entry.duration === 0 ? Number.POSITIVE_INFINITY : entry.duration ?? 5e3,
1547
+ className: `snap-intent-${intent}`
1548
+ };
1549
+ switch (intent) {
1550
+ case "success": return toast$1.success(entry.title, options);
1551
+ case "warning": return toast$1.warning(entry.title, options);
1552
+ case "danger": return toast$1.error(entry.title, options);
1553
+ default: return toast$1(entry.title, options);
1554
+ }
1511
1555
  }
1512
1556
  /** Dismiss a queued toast by id. */
1513
1557
  function dismissToast(id) {
1514
- toastDismiss(id);
1558
+ toast$1.dismiss(id);
1515
1559
  }
1516
1560
  /** The runtime-mounted viewport: renders the shared toast queue. Pages never
1517
1561
  * mount this themselves — the runtime provides one per surface root. */
1518
- function Toaster(props) {
1519
- const records = useSyncExternalStore((onStoreChange) => {
1520
- toastListeners.add(onStoreChange);
1521
- return () => toastListeners.delete(onStoreChange);
1522
- }, () => toastRecords, () => toastRecords);
1523
- return jsxs(ToastPrimitive.Provider, {
1524
- ...props,
1525
- children: [records.map((record) => jsxs(ToastPrimitive.Root, {
1526
- ...part("toast", "root"),
1527
- className: "snap-toast",
1528
- "data-intent": record.intent ?? "neutral",
1529
- duration: record.duration ?? 5e3,
1530
- onOpenChange: (open) => {
1531
- if (!open) toastDismiss(record.id);
1532
- },
1533
- children: [
1534
- jsx(ToastTitle, { children: record.title }),
1535
- record.description !== void 0 && jsx(ToastDescription, { children: record.description }),
1536
- jsx(ToastClose, { "aria-label": "关闭" })
1537
- ]
1538
- }, record.id)), jsx(ToastViewport, {})]
1539
- });
1540
- }
1541
- /** The raw toast root for pages that manage their own open state. */
1542
- const Toast = ToastPrimitive.Root;
1543
- /** A toast title with its part tag. */
1544
- function ToastTitle({ className, children, ...props }) {
1545
- return jsx(ToastPrimitive.Title, {
1546
- className: cn("snap-toast-title", className),
1547
- ...props,
1548
- ...part("toast", "title"),
1549
- children
1550
- });
1551
- }
1552
- /** A toast description with its part tag. */
1553
- function ToastDescription({ className, children, ...props }) {
1554
- return jsx(ToastPrimitive.Description, {
1555
- className: cn("snap-toast-description", className),
1556
- ...props,
1557
- ...part("toast", "description"),
1558
- children
1559
- });
1560
- }
1561
- /** An interactive toast action (confirm/retry affordances). */
1562
- function ToastAction({ className, children, ...props }) {
1563
- return jsx(ToastPrimitive.Action, {
1564
- className: cn("snap-toast-action", className),
1565
- ...props,
1566
- ...part("toast", "action"),
1567
- children
1568
- });
1569
- }
1570
- /** A toast dismissal button. */
1571
- function ToastClose({ className, children, ...props }) {
1572
- return jsx(ToastPrimitive.Close, {
1573
- className: cn("snap-toast-close", className),
1574
- ...props,
1575
- ...part("toast", "close"),
1576
- children: children ?? jsx("span", {
1577
- "aria-hidden": "true",
1578
- children: "×"
1579
- })
1580
- });
1581
- }
1582
- /** The toast viewport; only the runtime's {@link Toaster} mounts one. */
1583
- function ToastViewport({ className, ...props }) {
1584
- return jsx(ToastPrimitive.Viewport, {
1585
- className: cn("snap-toast-viewport", className),
1586
- ...props,
1587
- ...part("toast", "viewport")
1562
+ function Toaster() {
1563
+ return jsx(Toaster$1, {
1564
+ position: "bottom-right",
1565
+ closeButton: true
1588
1566
  });
1589
1567
  }
1590
1568
  //#endregion
@@ -4848,6 +4826,39 @@ function SettingsEntry(props) {
4848
4826
  onClick: props.open
4849
4827
  });
4850
4828
  }
4829
+ /** The settings footer: the running app's version plus the copyright line,
4830
+ * pinned below the page area of every settings page. The version rides the
4831
+ * existing `update.state` snapshot (`app.getVersion()`, populated in dev
4832
+ * too); hosts without the update bridge — or bare contexts without client
4833
+ * services — simply get no footer instead of an error. */
4834
+ function SettingsFooter({ ctx }) {
4835
+ const [version, setVersion] = useState(void 0);
4836
+ useEffect(() => {
4837
+ let link;
4838
+ try {
4839
+ link = ctx.client.link;
4840
+ } catch {
4841
+ return;
4842
+ }
4843
+ let cancelled = false;
4844
+ link.call("update.state", {}).then((result) => {
4845
+ if (!cancelled && result.ok) setVersion(result.value.status.currentVersion);
4846
+ }).catch(() => void 0);
4847
+ return () => {
4848
+ cancelled = true;
4849
+ };
4850
+ }, [ctx]);
4851
+ if (version === void 0) return null;
4852
+ return jsxs("footer", {
4853
+ ...part("settings", "footer"),
4854
+ className: "snap-settings-footer",
4855
+ children: [jsxs("span", { children: ["snap-rail v", version] }), jsxs("span", { children: [
4856
+ "© ",
4857
+ (/* @__PURE__ */ new Date()).getFullYear(),
4858
+ " snap-rail · Apache-2.0"
4859
+ ] })]
4860
+ });
4861
+ }
4851
4862
  /** The default settings surface. */
4852
4863
  function SettingsSurface(props) {
4853
4864
  const { service, ctx } = props;
@@ -4921,14 +4932,18 @@ function SettingsSurface(props) {
4921
4932
  }), jsx("span", { children: page.title })]
4922
4933
  }, page.id))]
4923
4934
  }, group))
4924
- }), jsx("main", {
4935
+ }), jsxs("main", {
4925
4936
  ...part("settings", "content"),
4926
4937
  className: "snap-settings-content",
4927
4938
  "data-active-page": activeId,
4928
- children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
4929
- page: active.id,
4930
- children: active.render()
4931
- })
4939
+ children: [jsx("div", {
4940
+ ...part("settings", "page"),
4941
+ className: "snap-settings-page",
4942
+ children: active === void 0 ? jsx(EmptyState, { title: "暂无设置页" }) : jsx(SettingsPageBoundary, {
4943
+ page: active.id,
4944
+ children: active.render()
4945
+ })
4946
+ }), jsx(SettingsFooter, { ctx })]
4932
4947
  })]
4933
4948
  })]
4934
4949
  })
@@ -5305,4 +5320,4 @@ async function createClientRuntime(handle, options) {
5305
5320
  };
5306
5321
  }
5307
5322
  //#endregion
5308
- 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, Toast, ToastAction, ToastClose, ToastDescription, ToastTitle, ToastViewport, 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 };
5323
+ 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 };