@vistagenic/vista 0.3.4 → 0.3.6

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.
@@ -431,9 +431,8 @@ async function attachFlightPayload(page, flightData, _cwd) {
431
431
  return;
432
432
  page.flightData = flightData;
433
433
  page.html = injectInlineFlightBootstrap(page.html, flightData);
434
- if (page.shellHtml) {
435
- page.shellHtml = injectInlineFlightBootstrap(page.shellHtml, flightData);
436
- }
434
+ // PPR shells are loading-only. Inlining the full-page Flight would leak
435
+ // resumed content (e.g. ppr-page-content) into the shell response.
437
436
  }
438
437
  function getCSSLinks(cwd) {
439
438
  const links = ['<link rel="stylesheet" href="/styles.css" />'];
@@ -1,2 +1,3 @@
1
1
  export { ThemeProvider, applyTheme, useTheme, type ResolvedTheme, type ThemeMode } from './theme-provider';
2
2
  export { ThemeScript } from './theme-script';
3
+ export { ThemeToggle, type ThemeToggleProps } from './theme-toggle';
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ThemeScript = exports.useTheme = exports.applyTheme = exports.ThemeProvider = void 0;
3
+ exports.ThemeToggle = exports.ThemeScript = exports.useTheme = exports.applyTheme = exports.ThemeProvider = void 0;
4
4
  var theme_provider_1 = require("./theme-provider");
5
5
  Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_provider_1.ThemeProvider; } });
6
6
  Object.defineProperty(exports, "applyTheme", { enumerable: true, get: function () { return theme_provider_1.applyTheme; } });
7
7
  Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return theme_provider_1.useTheme; } });
8
8
  var theme_script_1 = require("./theme-script");
9
9
  Object.defineProperty(exports, "ThemeScript", { enumerable: true, get: function () { return theme_script_1.ThemeScript; } });
10
+ var theme_toggle_1 = require("./theme-toggle");
11
+ Object.defineProperty(exports, "ThemeToggle", { enumerable: true, get: function () { return theme_toggle_1.ThemeToggle; } });
@@ -2,9 +2,11 @@
2
2
  * React-server entry for `vista/theme`.
3
3
  *
4
4
  * ThemeScript is a real Server Component (inline blocking script).
5
- * ThemeProvider/useTheme are Client Components; the compile hook turns
6
- * `theme-provider` into a Flight client proxy under `--conditions react-server`.
5
+ * ThemeProvider/useTheme/ThemeToggle are Client Components; the compile hook
6
+ * turns those modules into Flight client proxies under `--conditions react-server`.
7
7
  */
8
8
  export { ThemeScript } from './theme-script';
9
9
  export { ThemeProvider, applyTheme, useTheme } from './theme-provider';
10
+ export { ThemeToggle } from './theme-toggle';
10
11
  export type { ResolvedTheme, ThemeMode } from './theme-provider';
12
+ export type { ThemeToggleProps } from './theme-toggle';
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useTheme = exports.applyTheme = exports.ThemeProvider = exports.ThemeScript = void 0;
3
+ exports.ThemeToggle = exports.useTheme = exports.applyTheme = exports.ThemeProvider = exports.ThemeScript = void 0;
4
4
  /**
5
5
  * React-server entry for `vista/theme`.
6
6
  *
7
7
  * ThemeScript is a real Server Component (inline blocking script).
8
- * ThemeProvider/useTheme are Client Components; the compile hook turns
9
- * `theme-provider` into a Flight client proxy under `--conditions react-server`.
8
+ * ThemeProvider/useTheme/ThemeToggle are Client Components; the compile hook
9
+ * turns those modules into Flight client proxies under `--conditions react-server`.
10
10
  */
11
11
  var theme_script_1 = require("./theme-script");
12
12
  Object.defineProperty(exports, "ThemeScript", { enumerable: true, get: function () { return theme_script_1.ThemeScript; } });
@@ -14,3 +14,5 @@ var theme_provider_1 = require("./theme-provider");
14
14
  Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return theme_provider_1.ThemeProvider; } });
15
15
  Object.defineProperty(exports, "applyTheme", { enumerable: true, get: function () { return theme_provider_1.applyTheme; } });
16
16
  Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return theme_provider_1.useTheme; } });
17
+ var theme_toggle_1 = require("./theme-toggle");
18
+ Object.defineProperty(exports, "ThemeToggle", { enumerable: true, get: function () { return theme_toggle_1.ThemeToggle; } });
@@ -0,0 +1,5 @@
1
+ export interface ThemeToggleProps {
2
+ compact?: boolean;
3
+ className?: string;
4
+ }
5
+ export declare function ThemeToggle({ compact, className }: ThemeToggleProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ThemeToggle = ThemeToggle;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const theme_provider_1 = require("./theme-provider");
7
+ function Icon(props) {
8
+ return ((0, jsx_runtime_1.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round", className: "h-full w-full", "aria-hidden": "true", ...props }));
9
+ }
10
+ function SystemIcon() {
11
+ return ((0, jsx_runtime_1.jsxs)(Icon, { children: [(0, jsx_runtime_1.jsx)("rect", { x: "3.5", y: "4.5", width: "17", height: "12", rx: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M8 19.5h8" })] }));
12
+ }
13
+ function SunIcon() {
14
+ return ((0, jsx_runtime_1.jsxs)(Icon, { children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "4" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 3v2.2M12 18.8V21M4.9 4.9l1.6 1.6M17.5 17.5l1.6 1.6M3 12h2.2M18.8 12H21M4.9 19.1l1.6-1.6M17.5 6.5l1.6-1.6" })] }));
15
+ }
16
+ function MoonIcon() {
17
+ return ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)("path", { d: "M16.5 13.5A7 7 0 0 1 10.2 4.4 7.2 7.2 0 1 0 19.6 14.8 7 7 0 0 1 16.5 13.5z" }) }));
18
+ }
19
+ const OPTIONS = [
20
+ { value: 'system', label: 'System', icon: SystemIcon },
21
+ { value: 'light', label: 'Light', icon: SunIcon },
22
+ { value: 'dark', label: 'Dark', icon: MoonIcon },
23
+ ];
24
+ function ThemeToggle({ compact = false, className }) {
25
+ const { mounted, theme, setTheme } = (0, theme_provider_1.useTheme)();
26
+ const rootClassName = [
27
+ 'inline-flex items-center gap-1 rounded-full border border-border/80 bg-panel-elevated/90 p-1 shadow-[0_10px_30px_rgba(15,23,42,0.08)] backdrop-blur',
28
+ className,
29
+ ]
30
+ .filter(Boolean)
31
+ .join(' ');
32
+ return ((0, jsx_runtime_1.jsx)("div", { className: rootClassName, "aria-label": "Theme switcher", children: OPTIONS.map((option) => {
33
+ const isActive = theme === option.value;
34
+ const IconNode = option.icon;
35
+ return ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => setTheme(option.value), className: `inline-flex items-center justify-center gap-2 rounded-full py-2 text-xs font-medium transition-colors ${isActive
36
+ ? 'bg-foreground text-background'
37
+ : 'text-muted-foreground hover:bg-background/80 hover:text-foreground'} ${compact ? 'px-2.5' : 'px-3'}`, "aria-pressed": isActive, title: mounted ? option.label : undefined, children: [(0, jsx_runtime_1.jsx)("span", { className: "inline-flex h-3.5 w-3.5 items-center justify-center", children: (0, jsx_runtime_1.jsx)(IconNode, {}) }), !compact ? (0, jsx_runtime_1.jsx)("span", { children: option.label }) : null] }, option.value));
38
+ }) }));
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vistagenic/vista",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "The React Framework for Visionaries - Rust-powered SSR with Server Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",