@hanzo/ui 8.0.6 → 8.0.8

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.
Files changed (200) hide show
  1. package/dist/ThemeToggleNext-7727UR5W.js +4 -0
  2. package/dist/ThemeToggleNext-7727UR5W.js.map +1 -0
  3. package/dist/ThemeToggleNext-ICB5KL5J.cjs +19 -0
  4. package/dist/ThemeToggleNext-ICB5KL5J.cjs.map +1 -0
  5. package/dist/billing.cjs +15 -0
  6. package/dist/billing.cjs.map +1 -0
  7. package/{types → dist}/billing.d.ts +0 -1
  8. package/dist/billing.js +4 -0
  9. package/dist/billing.js.map +1 -0
  10. package/dist/canvas.cjs +15 -0
  11. package/dist/canvas.cjs.map +1 -0
  12. package/dist/canvas.d.ts +1 -0
  13. package/dist/canvas.js +4 -0
  14. package/dist/canvas.js.map +1 -0
  15. package/{types → dist}/cd/layout.d.ts +0 -1
  16. package/{types → dist}/cd/status.d.ts +0 -1
  17. package/{types → dist}/cd/time.d.ts +0 -1
  18. package/{types → dist}/cd/types.d.ts +0 -1
  19. package/dist/chunk-42CU5GSF.js +98 -0
  20. package/dist/chunk-42CU5GSF.js.map +1 -0
  21. package/dist/chunk-GDGVXU7W.js +1999 -0
  22. package/dist/chunk-GDGVXU7W.js.map +1 -0
  23. package/dist/chunk-HSPMQQVJ.cjs +2066 -0
  24. package/dist/chunk-HSPMQQVJ.cjs.map +1 -0
  25. package/dist/chunk-YBXVUV7P.cjs +103 -0
  26. package/dist/chunk-YBXVUV7P.cjs.map +1 -0
  27. package/dist/dashboard.cjs +15 -0
  28. package/dist/dashboard.cjs.map +1 -0
  29. package/dist/dashboard.d.ts +1 -0
  30. package/dist/dashboard.js +4 -0
  31. package/dist/dashboard.js.map +1 -0
  32. package/dist/data.cjs +15 -0
  33. package/dist/data.cjs.map +1 -0
  34. package/dist/data.d.ts +1 -0
  35. package/dist/data.js +4 -0
  36. package/dist/data.js.map +1 -0
  37. package/dist/gitops.cjs +15 -0
  38. package/dist/gitops.cjs.map +1 -0
  39. package/dist/gitops.d.ts +1 -0
  40. package/dist/gitops.js +4 -0
  41. package/dist/gitops.js.map +1 -0
  42. package/dist/index.cjs +291 -0
  43. package/dist/index.cjs.map +1 -0
  44. package/{types → dist}/index.d.ts +0 -1
  45. package/dist/index.js +6 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/network.cjs +15 -0
  48. package/dist/network.cjs.map +1 -0
  49. package/{types → dist}/network.d.ts +0 -1
  50. package/dist/network.js +4 -0
  51. package/dist/network.js.map +1 -0
  52. package/dist/primitives/bases/data/index.cjs +15 -0
  53. package/dist/primitives/bases/data/index.cjs.map +1 -0
  54. package/dist/primitives/bases/data/index.d.ts +1 -0
  55. package/dist/primitives/bases/data/index.js +4 -0
  56. package/dist/primitives/bases/data/index.js.map +1 -0
  57. package/{types → dist}/product/AppHeader.d.ts +0 -1
  58. package/{types → dist}/product/BrandMark.d.ts +0 -1
  59. package/{types → dist}/product/Charts.d.ts +0 -1
  60. package/{types → dist}/product/ComboBox.d.ts +0 -1
  61. package/{types → dist}/product/DataTable.d.ts +0 -1
  62. package/{types → dist}/product/Donut.d.ts +0 -1
  63. package/{types → dist}/product/EmptyState.d.ts +0 -1
  64. package/{types → dist}/product/FadeIn.d.ts +0 -1
  65. package/{types → dist}/product/Field.d.ts +0 -1
  66. package/{types → dist}/product/HanzoMark.d.ts +0 -1
  67. package/{types → dist}/product/Metric.d.ts +0 -1
  68. package/{types → dist}/product/OrgSwitcher.d.ts +0 -1
  69. package/{types → dist}/product/PageHeader.d.ts +0 -1
  70. package/{types → dist}/product/PrimaryButton.d.ts +0 -1
  71. package/{types → dist}/product/ProductIcon.d.ts +0 -1
  72. package/{types → dist}/product/ProviderLogo.d.ts +0 -1
  73. package/{types → dist}/product/Reorder.d.ts +0 -1
  74. package/{types → dist}/product/SelectMenu.d.ts +7 -6
  75. package/{types → dist}/product/SlideOver.d.ts +0 -1
  76. package/{types → dist}/product/StatusTag.d.ts +0 -1
  77. package/dist/product/ThemeToggle.d.ts +21 -0
  78. package/dist/product/ThemeToggleNext.d.ts +4 -0
  79. package/{types → dist}/product/Toast.d.ts +0 -1
  80. package/{types → dist}/product/color.d.ts +0 -1
  81. package/{types → dist}/product/combobox/filter.d.ts +0 -1
  82. package/dist/product/index.cjs +278 -0
  83. package/dist/product/index.cjs.map +1 -0
  84. package/{types → dist}/product/index.d.ts +2 -1
  85. package/dist/product/index.js +5 -0
  86. package/dist/product/index.js.map +1 -0
  87. package/dist/product/menu/ContextMenu.d.ts +21 -0
  88. package/dist/product/menu/DropdownMenu.d.ts +29 -0
  89. package/dist/product/menu/FloatingMenu.d.ts +36 -0
  90. package/dist/product/menu/index.d.ts +5 -0
  91. package/dist/product/menu/items.d.ts +68 -0
  92. package/dist/product/menu/portal-theme.d.ts +28 -0
  93. package/dist/product/menu/roving.d.ts +8 -0
  94. package/{types → dist}/product/scope.d.ts +0 -1
  95. package/{types → dist}/product/surfaces.data.d.ts +0 -1
  96. package/dist/usage.cjs +15 -0
  97. package/dist/usage.cjs.map +1 -0
  98. package/dist/usage.d.ts +1 -0
  99. package/dist/usage.js +4 -0
  100. package/dist/usage.js.map +1 -0
  101. package/dist/wallet.cjs +15 -0
  102. package/dist/wallet.cjs.map +1 -0
  103. package/{types → dist}/wallet.d.ts +0 -1
  104. package/dist/wallet.js +4 -0
  105. package/dist/wallet.js.map +1 -0
  106. package/package.json +58 -32
  107. package/src/billing.ts +0 -9
  108. package/src/canvas.ts +0 -11
  109. package/src/cd/layout.ts +0 -184
  110. package/src/cd/status.ts +0 -158
  111. package/src/cd/time.ts +0 -52
  112. package/src/cd/types.ts +0 -318
  113. package/src/dashboard.ts +0 -8
  114. package/src/data.ts +0 -12
  115. package/src/gitops.ts +0 -5
  116. package/src/gui-env.d.ts +0 -27
  117. package/src/index.ts +0 -22
  118. package/src/network.ts +0 -11
  119. package/src/primitives/bases/data/index.ts +0 -13
  120. package/src/product/AppHeader.tsx +0 -183
  121. package/src/product/BrandMark.tsx +0 -27
  122. package/src/product/Charts.tsx +0 -471
  123. package/src/product/ComboBox.tsx +0 -147
  124. package/src/product/DataTable.tsx +0 -99
  125. package/src/product/Donut.tsx +0 -83
  126. package/src/product/EmptyState.tsx +0 -129
  127. package/src/product/FadeIn.tsx +0 -38
  128. package/src/product/Field.tsx +0 -160
  129. package/src/product/HanzoMark.tsx +0 -31
  130. package/src/product/Metric.tsx +0 -253
  131. package/src/product/OrgSwitcher.tsx +0 -332
  132. package/src/product/PageHeader.tsx +0 -31
  133. package/src/product/PrimaryButton.tsx +0 -17
  134. package/src/product/ProductIcon.tsx +0 -61
  135. package/src/product/ProviderLogo.tsx +0 -137
  136. package/src/product/Reorder.test.ts +0 -41
  137. package/src/product/Reorder.tsx +0 -110
  138. package/src/product/SelectMenu.tsx +0 -94
  139. package/src/product/SlideOver.tsx +0 -197
  140. package/src/product/StatusTag.tsx +0 -49
  141. package/src/product/ThemeToggle.tsx +0 -25
  142. package/src/product/Toast.tsx +0 -166
  143. package/src/product/color.ts +0 -17
  144. package/src/product/combobox/filter.test.ts +0 -51
  145. package/src/product/combobox/filter.ts +0 -39
  146. package/src/product/index.ts +0 -70
  147. package/src/product/scope.test.ts +0 -92
  148. package/src/product/scope.ts +0 -123
  149. package/src/product/surfaces.data.ts +0 -42
  150. package/src/usage.ts +0 -8
  151. package/src/wallet.ts +0 -11
  152. package/types/billing.d.ts.map +0 -1
  153. package/types/canvas.d.ts +0 -2
  154. package/types/canvas.d.ts.map +0 -1
  155. package/types/cd/layout.d.ts.map +0 -1
  156. package/types/cd/status.d.ts.map +0 -1
  157. package/types/cd/time.d.ts.map +0 -1
  158. package/types/cd/types.d.ts.map +0 -1
  159. package/types/dashboard.d.ts +0 -2
  160. package/types/dashboard.d.ts.map +0 -1
  161. package/types/data.d.ts +0 -2
  162. package/types/data.d.ts.map +0 -1
  163. package/types/gitops.d.ts +0 -2
  164. package/types/gitops.d.ts.map +0 -1
  165. package/types/index.d.ts.map +0 -1
  166. package/types/network.d.ts.map +0 -1
  167. package/types/primitives/bases/data/index.d.ts +0 -2
  168. package/types/primitives/bases/data/index.d.ts.map +0 -1
  169. package/types/product/AppHeader.d.ts.map +0 -1
  170. package/types/product/BrandMark.d.ts.map +0 -1
  171. package/types/product/Charts.d.ts.map +0 -1
  172. package/types/product/ComboBox.d.ts.map +0 -1
  173. package/types/product/DataTable.d.ts.map +0 -1
  174. package/types/product/Donut.d.ts.map +0 -1
  175. package/types/product/EmptyState.d.ts.map +0 -1
  176. package/types/product/FadeIn.d.ts.map +0 -1
  177. package/types/product/Field.d.ts.map +0 -1
  178. package/types/product/HanzoMark.d.ts.map +0 -1
  179. package/types/product/Metric.d.ts.map +0 -1
  180. package/types/product/OrgSwitcher.d.ts.map +0 -1
  181. package/types/product/PageHeader.d.ts.map +0 -1
  182. package/types/product/PrimaryButton.d.ts.map +0 -1
  183. package/types/product/ProductIcon.d.ts.map +0 -1
  184. package/types/product/ProviderLogo.d.ts.map +0 -1
  185. package/types/product/Reorder.d.ts.map +0 -1
  186. package/types/product/SelectMenu.d.ts.map +0 -1
  187. package/types/product/SlideOver.d.ts.map +0 -1
  188. package/types/product/StatusTag.d.ts.map +0 -1
  189. package/types/product/ThemeToggle.d.ts +0 -2
  190. package/types/product/ThemeToggle.d.ts.map +0 -1
  191. package/types/product/Toast.d.ts.map +0 -1
  192. package/types/product/color.d.ts.map +0 -1
  193. package/types/product/combobox/filter.d.ts.map +0 -1
  194. package/types/product/index.d.ts.map +0 -1
  195. package/types/product/scope.d.ts.map +0 -1
  196. package/types/product/surfaces.data.d.ts.map +0 -1
  197. package/types/usage.d.ts +0 -2
  198. package/types/usage.d.ts.map +0 -1
  199. package/types/wallet.d.ts.map +0 -1
  200. /package/{src → dist}/styles/hanzo-motion.css +0 -0
@@ -0,0 +1,4 @@
1
+ 'use client';
2
+ export { ThemeToggleNext, ThemeToggleNext_default as default } from './chunk-42CU5GSF.js';
3
+ //# sourceMappingURL=ThemeToggleNext-7727UR5W.js.map
4
+ //# sourceMappingURL=ThemeToggleNext-7727UR5W.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ThemeToggleNext-7727UR5W.js"}
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var chunkYBXVUV7P_cjs = require('./chunk-YBXVUV7P.cjs');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "ThemeToggleNext", {
11
+ enumerable: true,
12
+ get: function () { return chunkYBXVUV7P_cjs.ThemeToggleNext; }
13
+ });
14
+ Object.defineProperty(exports, "default", {
15
+ enumerable: true,
16
+ get: function () { return chunkYBXVUV7P_cjs.ThemeToggleNext_default; }
17
+ });
18
+ //# sourceMappingURL=ThemeToggleNext-ICB5KL5J.cjs.map
19
+ //# sourceMappingURL=ThemeToggleNext-ICB5KL5J.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ThemeToggleNext-ICB5KL5J.cjs"}
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var billing = require('@hanzo/ui-shadcn/billing');
5
+
6
+
7
+
8
+ Object.keys(billing).forEach(function (k) {
9
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
10
+ enumerable: true,
11
+ get: function () { return billing[k]; }
12
+ });
13
+ });
14
+ //# sourceMappingURL=billing.cjs.map
15
+ //# sourceMappingURL=billing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"billing.cjs","sourcesContent":[]}
@@ -1,2 +1 @@
1
1
  export * from '@hanzo/ui-shadcn/billing';
2
- //# sourceMappingURL=billing.d.ts.map
@@ -0,0 +1,4 @@
1
+ 'use client';
2
+ export * from '@hanzo/ui-shadcn/billing';
3
+ //# sourceMappingURL=billing.js.map
4
+ //# sourceMappingURL=billing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"billing.js","sourcesContent":[]}
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var canvas = require('@hanzo/canvas');
5
+
6
+
7
+
8
+ Object.keys(canvas).forEach(function (k) {
9
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
10
+ enumerable: true,
11
+ get: function () { return canvas[k]; }
12
+ });
13
+ });
14
+ //# sourceMappingURL=canvas.cjs.map
15
+ //# sourceMappingURL=canvas.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"canvas.cjs","sourcesContent":[]}
@@ -0,0 +1 @@
1
+ export * from '@hanzo/canvas';
package/dist/canvas.js ADDED
@@ -0,0 +1,4 @@
1
+ 'use client';
2
+ export * from '@hanzo/canvas';
3
+ //# sourceMappingURL=canvas.js.map
4
+ //# sourceMappingURL=canvas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"canvas.js","sourcesContent":[]}
@@ -54,4 +54,3 @@ export interface GraphLayout {
54
54
  * per input node (input order preserved in the result array) plus content bounds.
55
55
  */
56
56
  export declare function layoutTree(nodes: LayoutNode[], edges: LayoutEdge[], opts?: LayoutOptions): GraphLayout;
57
- //# sourceMappingURL=layout.d.ts.map
@@ -47,4 +47,3 @@ export declare function worstSync(statuses: SyncStatus[]): SyncStatus;
47
47
  * caller may hand a hue that's already `rgba(...)`).
48
48
  */
49
49
  export declare function withAlpha(hex: string, alpha: number): string;
50
- //# sourceMappingURL=status.d.ts.map
@@ -12,4 +12,3 @@ export declare function relativeTime(epochMs: number | undefined | null, now?: n
12
12
  export declare function toEpochMs(v: string | number | undefined | null): number | undefined;
13
13
  /** Relative time for a string/number timestamp (parses, then formats). */
14
14
  export declare function relativeTimeOf(v: string | number | undefined | null, now?: number): string;
15
- //# sourceMappingURL=time.d.ts.map
@@ -266,4 +266,3 @@ export interface OperationResponse {
266
266
  export interface AppListResponse {
267
267
  items: AppSummary[];
268
268
  }
269
- //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,98 @@
1
+ 'use client';
2
+ import { useThemeSetting } from '@hanzogui/next-theme';
3
+ import { lazy, useState, Suspense, Component } from 'react';
4
+ import { Button } from '@hanzo/gui';
5
+ import { Sun, Moon } from '@hanzogui/lucide-icons-2';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ // src/product/ThemeToggleNext.tsx
9
+ var STORAGE_KEY = "theme";
10
+ function readDomTheme() {
11
+ if (typeof document === "undefined") return void 0;
12
+ const el = document.documentElement;
13
+ if (el.classList.contains("dark")) return "dark";
14
+ if (el.classList.contains("light")) return "light";
15
+ try {
16
+ const ls = window.localStorage.getItem(STORAGE_KEY);
17
+ if (ls === "light" || ls === "dark") return ls;
18
+ } catch {
19
+ }
20
+ return void 0;
21
+ }
22
+ function applyDomTheme(next) {
23
+ if (typeof document === "undefined") return;
24
+ const el = document.documentElement;
25
+ el.classList.toggle("dark", next === "dark");
26
+ el.classList.toggle("light", next === "light");
27
+ el.style.colorScheme = next;
28
+ try {
29
+ window.localStorage.setItem(STORAGE_KEY, next);
30
+ } catch {
31
+ }
32
+ }
33
+ function AgnosticThemeToggle({
34
+ theme,
35
+ defaultTheme,
36
+ onToggle,
37
+ onThemeChange,
38
+ size = "$2",
39
+ label
40
+ }) {
41
+ const controlled = theme !== void 0;
42
+ const [internal, setInternal] = useState(() => theme ?? defaultTheme ?? readDomTheme() ?? "dark");
43
+ const current = controlled ? theme : internal;
44
+ const isDark = current === "dark";
45
+ const toggle = () => {
46
+ const next = isDark ? "light" : "dark";
47
+ if (!controlled) {
48
+ setInternal(next);
49
+ applyDomTheme(next);
50
+ }
51
+ onToggle?.(next);
52
+ onThemeChange?.(next);
53
+ };
54
+ return /* @__PURE__ */ jsx(
55
+ Button,
56
+ {
57
+ size,
58
+ chromeless: true,
59
+ icon: isDark ? /* @__PURE__ */ jsx(Sun, { size: 16 }) : /* @__PURE__ */ jsx(Moon, { size: 16 }),
60
+ onPress: toggle,
61
+ "aria-label": label ?? (isDark ? "Switch to light theme" : "Switch to dark theme")
62
+ }
63
+ );
64
+ }
65
+ var NextThemeToggle = lazy(() => import('./ThemeToggleNext-7727UR5W.js'));
66
+ var NextThemeBoundary = class extends Component {
67
+ state = { failed: false };
68
+ static getDerivedStateFromError() {
69
+ return { failed: true };
70
+ }
71
+ render() {
72
+ return this.state.failed ? this.props.fallback : this.props.children;
73
+ }
74
+ };
75
+ function ThemeToggle(props) {
76
+ const injected = props.theme !== void 0 || props.onToggle !== void 0 || props.onThemeChange !== void 0;
77
+ if (injected) return /* @__PURE__ */ jsx(AgnosticThemeToggle, { ...props });
78
+ const fallback = /* @__PURE__ */ jsx(AgnosticThemeToggle, { ...props });
79
+ return /* @__PURE__ */ jsx(NextThemeBoundary, { fallback, children: /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsx(NextThemeToggle, { size: props.size, label: props.label }) }) });
80
+ }
81
+ function ThemeToggleNext({ size, label }) {
82
+ const { current, resolvedTheme, set } = useThemeSetting();
83
+ const isDark = (resolvedTheme ?? current ?? "dark") !== "light";
84
+ return /* @__PURE__ */ jsx(
85
+ AgnosticThemeToggle,
86
+ {
87
+ theme: isDark ? "dark" : "light",
88
+ onToggle: (next) => set(next),
89
+ size,
90
+ label
91
+ }
92
+ );
93
+ }
94
+ var ThemeToggleNext_default = ThemeToggleNext;
95
+
96
+ export { AgnosticThemeToggle, ThemeToggle, ThemeToggleNext, ThemeToggleNext_default };
97
+ //# sourceMappingURL=chunk-42CU5GSF.js.map
98
+ //# sourceMappingURL=chunk-42CU5GSF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/product/ThemeToggle.tsx","../src/product/ThemeToggleNext.tsx"],"names":["jsx"],"mappings":";;;;;;;AAqCA,IAAM,WAAA,GAAc,OAAA;AAEpB,SAAS,YAAA,GA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AAA,CAAM,QAAA;AAAA,EAC9D;AACF,CAAA;AAEO,SAAS,YAAY,KAAA,EAAyB;AACnD,EAAA,MAAM,QAAA,GACJ,MAAM,KAAA,KAAU,MAAA,IAAa,MAAM,QAAA,KAAa,MAAA,IAAa,MAAM,aAAA,KAAkB,MAAA;AACvF,EAAA,IAAI,QAAA,EAAU,uBAAO,GAAA,CAAC,mBAAA,EAAA,EAAqB,GAAG,KAAA,EAAO,CAAA;AAIrD,EAAA,MAAM,QAAA,mBAAW,GAAA,CAAC,mBAAA,EAAA,EAAqB,GAAG,KAAA,EAAO,CAAA;AACjD,EAAA,uBACE,GAAA,CAAC,iBAAA,EAAA,EAAkB,QAAA,EACjB,QAAA,kBAAA,GAAA,CAAC,YAAS,QAAA,EACR,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAM,MAAM,IAAA,EAAM,KAAA,EAAO,KAAA,CAAM,KAAA,EAAO,GACzD,CAAA,EACF,CAAA;AAEJ;AC1HA,SAAS,eAAA,CAAgB,EAAE,IAAA,EAAM,KAAA,EAAM,EAA6C;AAClF,EAAA,MAAM,EAAE,OAAA,EAAS,aAAA,EAAe,GAAA,KAAQ,eAAA,EAAgB;AACxD,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,OAAA,IAAW,MAAA,MAAY,OAAA;AACxD,EAAA,uBACEA,GAAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,SAAS,MAAA,GAAS,OAAA;AAAA,MACzB,QAAA,EAAU,CAAC,IAAA,KAAS,GAAA,CAAI,IAAI,CAAA;AAAA,MAC5B,IAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;AAEA,IAAO,uBAAA,GAAQ","file":"chunk-42CU5GSF.js","sourcesContent":["'use client'\n\n/**\n * ThemeToggle — flips between dark and light. Framework-agnostic by default so\n * Vite / Tauri / Express hosts can use it with NO Next dependency:\n *\n * • Controlled: <ThemeToggle theme={theme} onToggle={setTheme} /> (host owns theme)\n * • Uncontrolled (agnostic): <ThemeToggle onThemeChange={fn} /> (toggles the DOM\n * `.dark` class + persists to localStorage)\n * • Uncontrolled (no props): <ThemeToggle /> (console/Next —\n * falls back to the OPTIONAL @hanzogui/next-theme path;\n * if it cannot load, degrades to the agnostic DOM toggle)\n *\n * Shows the action's target icon (a sun in dark mode, a moon in light mode).\n */\nimport type { ReactNode } from 'react'\nimport { Component, Suspense, lazy, useState } from 'react'\nimport { Button } from '@hanzo/gui'\nimport { Moon, Sun } from '@hanzogui/lucide-icons-2'\n\nexport type ThemeMode = 'light' | 'dark'\n\nexport type ThemeToggleProps = {\n /** Controlled theme. Pair with `onToggle`/`onThemeChange` to fully control it. */\n theme?: ThemeMode\n /** Seed for uncontrolled mode (default: read from the DOM `.dark` class, else 'dark'). */\n defaultTheme?: ThemeMode\n /** Called with the next theme on toggle (alias of `onThemeChange`). */\n onToggle?: (next: ThemeMode) => void\n /** Called with the next theme on toggle. */\n onThemeChange?: (next: ThemeMode) => void\n /** @hanzo/gui Button size token (default \"$2\"). */\n size?: string\n /** aria-label override. */\n label?: string\n}\n\nconst STORAGE_KEY = 'theme'\n\nfunction readDomTheme(): ThemeMode | undefined {\n if (typeof document === 'undefined') return undefined\n const el = document.documentElement\n if (el.classList.contains('dark')) return 'dark'\n if (el.classList.contains('light')) return 'light'\n try {\n const ls = window.localStorage.getItem(STORAGE_KEY)\n if (ls === 'light' || ls === 'dark') return ls\n } catch {\n /* localStorage may be unavailable */\n }\n return undefined\n}\n\nfunction applyDomTheme(next: ThemeMode): void {\n if (typeof document === 'undefined') return\n const el = document.documentElement\n el.classList.toggle('dark', next === 'dark')\n el.classList.toggle('light', next === 'light')\n el.style.colorScheme = next\n try {\n window.localStorage.setItem(STORAGE_KEY, next)\n } catch {\n /* ignore */\n }\n}\n\n/**\n * The framework-agnostic toggle button. Controlled when `theme` is provided; otherwise\n * self-managed via the DOM `.dark` class. No framework dependency — safe on any host.\n */\nexport function AgnosticThemeToggle({\n theme,\n defaultTheme,\n onToggle,\n onThemeChange,\n size = '$2',\n label,\n}: ThemeToggleProps) {\n const controlled = theme !== undefined\n const [internal, setInternal] = useState<ThemeMode>(() => theme ?? defaultTheme ?? readDomTheme() ?? 'dark')\n const current: ThemeMode = controlled ? (theme as ThemeMode) : internal\n const isDark = current === 'dark'\n\n const toggle = () => {\n const next: ThemeMode = isDark ? 'light' : 'dark'\n if (!controlled) {\n setInternal(next)\n applyDomTheme(next)\n }\n onToggle?.(next)\n onThemeChange?.(next)\n }\n\n return (\n <Button\n size={size as never}\n chromeless\n icon={isDark ? <Sun size={16} /> : <Moon size={16} />}\n onPress={toggle}\n aria-label={label ?? (isDark ? 'Switch to light theme' : 'Switch to dark theme')}\n />\n )\n}\n\n// @hanzogui/next-theme is an OPTIONAL dependency — loaded only on the uncontrolled,\n// no-props path (console/Next). Lazily code-split so non-Next hosts never need it at\n// runtime; if it fails to load, the boundary below degrades to the agnostic toggle.\nconst NextThemeToggle = lazy(() => import('./ThemeToggleNext'))\n\nclass NextThemeBoundary extends Component<{ fallback: ReactNode; children: ReactNode }, { failed: boolean }> {\n state = { failed: false }\n static getDerivedStateFromError() {\n return { failed: true }\n }\n render() {\n return this.state.failed ? this.props.fallback : this.props.children\n }\n}\n\nexport function ThemeToggle(props: ThemeToggleProps) {\n const injected =\n props.theme !== undefined || props.onToggle !== undefined || props.onThemeChange !== undefined\n if (injected) return <AgnosticThemeToggle {...props} />\n\n // No props → keep the existing console/Next behaviour via the optional next-theme\n // path, degrading to the agnostic DOM toggle if it is not installed.\n const fallback = <AgnosticThemeToggle {...props} />\n return (\n <NextThemeBoundary fallback={fallback}>\n <Suspense fallback={fallback}>\n <NextThemeToggle size={props.size} label={props.label} />\n </Suspense>\n </NextThemeBoundary>\n )\n}\n","'use client'\n\n/**\n * ThemeToggleNext — the @hanzogui/next-theme binding (console / Next). This is the ONLY\n * module that imports @hanzogui/next-theme, so it stays an OPTIONAL dependency: the base\n * ThemeToggle lazy-loads it (default export) and non-Next hosts never pull it in unless\n * they import this component directly. UI is delegated to the framework-agnostic button\n * in controlled mode, so every toggle looks identical.\n */\nimport { useThemeSetting } from '@hanzogui/next-theme'\nimport { AgnosticThemeToggle, type ThemeToggleProps } from './ThemeToggle'\n\nfunction ThemeToggleNext({ size, label }: Pick<ThemeToggleProps, 'size' | 'label'>) {\n const { current, resolvedTheme, set } = useThemeSetting()\n const isDark = (resolvedTheme ?? current ?? 'dark') !== 'light'\n return (\n <AgnosticThemeToggle\n theme={isDark ? 'dark' : 'light'}\n onToggle={(next) => set(next)}\n size={size}\n label={label}\n />\n )\n}\n\nexport default ThemeToggleNext\nexport { ThemeToggleNext }\n"]}