@hoox-sh/hoox-tui 0.3.0 → 0.3.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.
package/dist/main.js CHANGED
@@ -4312,7 +4312,6 @@ var init_src = __esm(() => {
4312
4312
  // src/main.tsx
4313
4313
  import { createCliRenderer } from "@opentui/core";
4314
4314
  import { createRoot } from "@opentui/react";
4315
- import { ToasterRenderable } from "@opentui-ui/toast";
4316
4315
 
4317
4316
  // src/app.tsx
4318
4317
  init_src();
@@ -5760,41 +5759,19 @@ function getSettingsConnectionSnapshot(env = process.env, config = {}) {
5760
5759
 
5761
5760
  // src/components/ui/toast.tsx
5762
5761
  init_src();
5763
- import { toast, TOAST_DURATION } from "@opentui-ui/toast";
5764
- var baseStyle = {
5765
- backgroundColor: Colors.card,
5766
- foregroundColor: Colors.foreground,
5767
- borderColor: Colors.border,
5768
- paddingX: 1,
5769
- paddingY: 0
5770
- };
5771
- var hooxTypeStyles = {
5772
- success: { borderColor: Colors.success },
5773
- error: { borderColor: Colors.error },
5774
- warning: { borderColor: Colors.warning },
5775
- info: { borderColor: Colors.highlight },
5776
- loading: { borderColor: Colors.dim }
5777
- };
5778
- function toastSuccess(message, options) {
5779
- return toast.success(message, {
5780
- ...options,
5781
- style: { ...baseStyle, ...hooxTypeStyles.success },
5782
- duration: options?.duration ?? TOAST_DURATION.SHORT
5783
- });
5762
+ var toastSeq = 0;
5763
+ function nextId() {
5764
+ toastSeq += 1;
5765
+ return `toast-noop-${toastSeq}`;
5784
5766
  }
5785
- function toastError(message, options) {
5786
- return toast.error(message, {
5787
- ...options,
5788
- style: { ...baseStyle, ...hooxTypeStyles.error },
5789
- duration: options?.duration ?? TOAST_DURATION.LONG
5790
- });
5767
+ function toastSuccess(_message, _options) {
5768
+ return nextId();
5791
5769
  }
5792
- function toastWarning(message, options) {
5793
- return toast.warning(message, {
5794
- ...options,
5795
- style: { ...baseStyle, ...hooxTypeStyles.warning },
5796
- duration: options?.duration ?? TOAST_DURATION.LONG
5797
- });
5770
+ function toastError(_message, _options) {
5771
+ return nextId();
5772
+ }
5773
+ function toastWarning(_message, _options) {
5774
+ return nextId();
5798
5775
  }
5799
5776
  var COPY_PREVIEW_MAX = 48;
5800
5777
  function messageCopiedToClipboard(text) {
@@ -20103,14 +20080,6 @@ async function main() {
20103
20080
  });
20104
20081
  renderer.on("resize", (_width, _height) => {});
20105
20082
  setRendererRef(renderer);
20106
- try {
20107
- const root = renderer.root;
20108
- root.add(new ToasterRenderable(renderer));
20109
- } catch (err) {
20110
- await tuiDevLog.warn("startup", "Toaster mount failed \u2014 toasts may no-op", {
20111
- error: err instanceof Error ? err.message : String(err)
20112
- });
20113
- }
20114
20083
  enableAutoCopyOnSelection(renderer);
20115
20084
  createRoot(renderer).render(/* @__PURE__ */ jsxDEV38(CrashRecoveryApp, {}, undefined, false, undefined, this));
20116
20085
  renderer.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoox-sh/hoox-tui",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Hoox algorithmic trading terminal operations center — OpenTUI dashboard",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
@@ -34,14 +34,17 @@
34
34
  "dependencies": {
35
35
  "@hoox-sh/hoox-shared": "^1.3.0",
36
36
  "@opentui-ui/dialog": "^0.1.2",
37
- "@opentui-ui/toast": "^0.0.5",
38
- "@opentui/core": "^0.5.1",
39
- "@opentui/react": "^0.5.1",
37
+ "@opentui/core": "0.5.1",
38
+ "@opentui/react": "0.5.1",
40
39
  "immer": "^11.1.8",
41
40
  "react": "^19.2.6",
42
41
  "smol-toml": "^1.6.1",
43
42
  "zustand": "^5.0.0"
44
43
  },
44
+ "overrides": {
45
+ "@opentui/core": "0.5.1",
46
+ "@opentui/react": "0.5.1"
47
+ },
45
48
  "devDependencies": {
46
49
  "@cloudflare/workers-types": "^5.20260708.1",
47
50
  "@hoox/test-utils": "^0.0.1",
@@ -4,15 +4,16 @@
4
4
  */
5
5
 
6
6
  /**
7
- * Thin wrappers around @opentui-ui/toast with Hoox color token defaults.
8
- * Provides toast helper functions (success, error, warning, info, loading)
9
- * pre-configured with Hoox design system colors and durations.
7
+ * Fail-closed toast helpers.
10
8
  *
11
- * All helpers use the global toast singleton from @opentui-ui/toast.
12
- * A ToasterRenderable must be initialized in the app root before calling
13
- * these functions (see app.tsx).
9
+ * `@opentui-ui/toast@0.0.5` peers on old OpenTUI and often installs a nested
10
+ * `@opentui/core` that re-registers env vars (e.g. OPENTUI_FORCE_WCWIDTH)
11
+ * with a conflicting schema — that hard-crashes `hoox-tui` on global install.
12
+ *
13
+ * We therefore never import `@opentui-ui/toast` at module load. Helpers are
14
+ * pure no-ops (return a stub id). Connection/auth UX uses the status bar
15
+ * and service-store alerts instead.
14
16
  */
15
- import { toast, TOAST_DURATION } from "@opentui-ui/toast";
16
17
  import { Colors } from "@hoox-sh/hoox-shared";
17
18
 
18
19
  // ── Types ──────────────────────────────────────────────────────────────────
@@ -29,128 +30,79 @@ export interface ToastOptions {
29
30
  action?: { label: string; onClick: () => void };
30
31
  /** Show a close button on the toast (default: false) */
31
32
  closeButton?: boolean;
33
+ /** Optional id when updating an existing toast */
34
+ id?: ToastId;
32
35
  }
33
36
 
34
37
  /** Returned toast ID for programmatic control */
35
38
  export type ToastId = string | number;
36
39
 
37
- // ── Hoox-styled toast style overrides ──────────────────────────────────────
38
-
39
- /** Base style shared across all toast types */
40
- const baseStyle = {
41
- backgroundColor: Colors.card,
42
- foregroundColor: Colors.foreground,
43
- borderColor: Colors.border,
44
- paddingX: 1,
45
- paddingY: 0,
46
- };
40
+ // Keep style tokens referenced so callers/tests can still import Colors path
41
+ // and so future re-enable of a compatible toast lib has defaults ready.
42
+ void Colors;
47
43
 
48
- /** Per-type border color overrides using Hoox design tokens */
49
- const hooxTypeStyles = {
50
- success: { borderColor: Colors.success },
51
- error: { borderColor: Colors.error },
52
- warning: { borderColor: Colors.warning },
53
- info: { borderColor: Colors.highlight },
54
- loading: { borderColor: Colors.dim },
55
- };
44
+ let toastSeq = 0;
45
+ function nextId(): ToastId {
46
+ toastSeq += 1;
47
+ return `toast-noop-${toastSeq}`;
48
+ }
56
49
 
57
- // ── Toast helper functions ─────────────────────────────────────────────────
50
+ // ── Toast helper functions (no-op, fail-closed) ────────────────────────────
58
51
 
59
52
  /**
60
53
  * Show a success toast notification.
61
- * Uses green border (Colors.success) and 3s auto-dismiss.
62
- *
63
- * @example
64
- * toastSuccess("Worker deployed successfully")
54
+ * Currently a no-op (see module doc) — status bar / alerts carry feedback.
65
55
  */
66
- export function toastSuccess(message: string, options?: ToastOptions): ToastId {
67
- return toast.success(message, {
68
- ...options,
69
- style: { ...baseStyle, ...hooxTypeStyles.success },
70
- duration: options?.duration ?? TOAST_DURATION.SHORT,
71
- });
56
+ export function toastSuccess(
57
+ _message: string,
58
+ _options?: ToastOptions
59
+ ): ToastId {
60
+ return nextId();
72
61
  }
73
62
 
74
63
  /**
75
64
  * Show an error toast notification.
76
- * Uses red border (Colors.error) and 6s auto-dismiss.
77
- *
78
- * @example
79
- * toastError("Failed to connect to API", { description: "Check your network" })
65
+ * Currently a no-op (see module doc).
80
66
  */
81
- export function toastError(message: string, options?: ToastOptions): ToastId {
82
- return toast.error(message, {
83
- ...options,
84
- style: { ...baseStyle, ...hooxTypeStyles.error },
85
- duration: options?.duration ?? TOAST_DURATION.LONG,
86
- });
67
+ export function toastError(_message: string, _options?: ToastOptions): ToastId {
68
+ return nextId();
87
69
  }
88
70
 
89
71
  /**
90
72
  * Show a warning toast notification.
91
- * Uses amber border (Colors.warning) and 6s auto-dismiss.
92
- *
93
- * @example
94
- * toastWarning("Rate limit approaching", { description: "Slow down requests" })
73
+ * Currently a no-op (see module doc).
95
74
  */
96
- export function toastWarning(message: string, options?: ToastOptions): ToastId {
97
- return toast.warning(message, {
98
- ...options,
99
- style: { ...baseStyle, ...hooxTypeStyles.warning },
100
- duration: options?.duration ?? TOAST_DURATION.LONG,
101
- });
75
+ export function toastWarning(
76
+ _message: string,
77
+ _options?: ToastOptions
78
+ ): ToastId {
79
+ return nextId();
102
80
  }
103
81
 
104
82
  /**
105
83
  * Show an info toast notification.
106
- * Uses accent border (Colors.accent, orange) and 4s auto-dismiss.
107
- *
108
- * @example
109
- * toastInfo("New version available", { action: { label: "Update", onClick: () => {} } })
84
+ * Currently a no-op (see module doc).
110
85
  */
111
- export function toastInfo(message: string, options?: ToastOptions): ToastId {
112
- return toast.info(message, {
113
- ...options,
114
- style: { ...baseStyle, ...hooxTypeStyles.info },
115
- duration: options?.duration ?? TOAST_DURATION.DEFAULT,
116
- });
86
+ export function toastInfo(_message: string, _options?: ToastOptions): ToastId {
87
+ return nextId();
117
88
  }
118
89
 
119
90
  /**
120
91
  * Show a persistent loading toast notification.
121
- * Uses muted border (Colors.muted) and does NOT auto-dismiss.
122
- * Returns the toast ID so it can be updated to success/error later.
123
- *
124
- * @example
125
- * const id = toastLoading("Deploying worker...")
126
- * try {
127
- * await deploy()
128
- * toastSuccess("Deployed!", { id })
129
- * } catch {
130
- * toastError("Deploy failed", { id })
131
- * }
92
+ * Currently a no-op (see module doc).
132
93
  */
133
94
  export function toastLoading(
134
- message: string,
135
- options?: Omit<ToastOptions, "duration">
95
+ _message: string,
96
+ _options?: Omit<ToastOptions, "duration">
136
97
  ): ToastId {
137
- return toast.loading(message, {
138
- ...options,
139
- style: { ...baseStyle, ...hooxTypeStyles.loading },
140
- duration: TOAST_DURATION.PERSISTENT,
141
- } as ToastOptions);
98
+ return nextId();
142
99
  }
143
100
 
144
101
  /**
145
- * Dismiss a specific toast or all toasts.
146
- * Thin wrapper around toast.dismiss().
147
- *
148
- * @example
149
- * dismissToast(id) // dismiss specific
150
- * dismissToast() // dismiss all
102
+ * Dismiss a specific toast or all toasts (no-op).
151
103
  */
152
- export function dismissToast(id?: ToastId): void {
153
- toast.dismiss(id as string | number | undefined);
104
+ export function dismissToast(_id?: ToastId): void {
105
+ // no-op
154
106
  }
155
107
 
156
108
  // ── Clipboard copy feedback ────────────────────────────────────────────────
package/src/main.tsx CHANGED
@@ -13,7 +13,6 @@
13
13
  */
14
14
  import { createCliRenderer } from "@opentui/core";
15
15
  import { createRoot } from "@opentui/react";
16
- import { ToasterRenderable } from "@opentui-ui/toast";
17
16
  import { CrashRecoveryApp } from "./app";
18
17
  import {
19
18
  Colors,
@@ -103,19 +102,11 @@ async function main() {
103
102
  // Set renderer ref so hooks + components can access it via getRendererRef()
104
103
  setRendererRef(renderer);
105
104
 
106
- // Mount toast host so connection/auth toasts actually render
107
- try {
108
- const root = (
109
- renderer as unknown as {
110
- root: { add: (node: unknown) => void };
111
- }
112
- ).root;
113
- root.add(new ToasterRenderable(renderer));
114
- } catch (err) {
115
- await tuiDevLog.warn("startup", "Toaster mount failed — toasts may no-op", {
116
- error: err instanceof Error ? err.message : String(err),
117
- });
118
- }
105
+ // Note: @opentui-ui/toast ToasterRenderable is intentionally NOT mounted.
106
+ // toast@0.0.5 peers on ancient @opentui and nests a second core that
107
+ // re-registers OPENTUI_FORCE_WCWIDTH (crash on global install). Connection
108
+ // feedback still surfaces via the status bar + service-store alerts.
109
+ // Toast helpers in components/ui/toast.tsx are fail-closed no-ops.
119
110
 
120
111
  // Mouse drag-select → clipboard (OSC 52 + system tools)
121
112
  enableAutoCopyOnSelection(