@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 +11 -42
- package/package.json +7 -4
- package/src/components/ui/toast.tsx +44 -92
- package/src/main.tsx +5 -14
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
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
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
|
|
5786
|
-
return
|
|
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
|
|
5793
|
-
return
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
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.
|
|
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
|
|
38
|
-
"@opentui/
|
|
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
|
-
*
|
|
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
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
*
|
|
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(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
*
|
|
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(
|
|
82
|
-
return
|
|
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
|
-
*
|
|
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(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
*
|
|
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(
|
|
112
|
-
return
|
|
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
|
-
*
|
|
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
|
-
|
|
135
|
-
|
|
95
|
+
_message: string,
|
|
96
|
+
_options?: Omit<ToastOptions, "duration">
|
|
136
97
|
): ToastId {
|
|
137
|
-
return
|
|
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(
|
|
153
|
-
|
|
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
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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(
|