@hanzo/ui 8.0.28 → 8.0.32
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/backends/gui/button.d.ts +12 -0
- package/dist/backends/gui/button.d.ts.map +1 -1
- package/dist/backends/gui/button.js.map +1 -1
- package/dist/backends/gui/slot.cjs +11 -1
- package/dist/backends/gui/slot.d.ts +9 -0
- package/dist/backends/gui/slot.d.ts.map +1 -1
- package/dist/backends/gui/slot.js +9 -0
- package/dist/backends/gui/slot.js.map +1 -1
- package/dist/backends/gui/textarea.cjs +0 -8
- package/dist/backends/gui/textarea.d.ts +8 -1
- package/dist/backends/gui/textarea.d.ts.map +1 -1
- package/dist/backends/gui/textarea.js +0 -8
- package/dist/backends/gui/textarea.js.map +1 -1
- package/dist/chat/Code.cjs +70 -0
- package/dist/chat/Code.d.ts +25 -0
- package/dist/chat/Code.d.ts.map +1 -0
- package/dist/chat/Code.js +67 -0
- package/dist/chat/Code.js.map +1 -0
- package/dist/chat/Composer.cjs +56 -0
- package/dist/chat/Composer.d.ts +30 -0
- package/dist/chat/Composer.d.ts.map +1 -0
- package/dist/chat/Composer.js +53 -0
- package/dist/chat/Composer.js.map +1 -0
- package/dist/chat/Header.cjs +49 -0
- package/dist/chat/Header.d.ts +46 -0
- package/dist/chat/Header.d.ts.map +1 -0
- package/dist/chat/Header.js +43 -0
- package/dist/chat/Header.js.map +1 -0
- package/dist/chat/Message.cjs +27 -0
- package/dist/chat/Message.d.ts +14 -0
- package/dist/chat/Message.d.ts.map +1 -0
- package/dist/chat/Message.js +25 -0
- package/dist/chat/Message.js.map +1 -0
- package/dist/chat/Sidebar.cjs +81 -0
- package/dist/chat/Sidebar.d.ts +79 -0
- package/dist/chat/Sidebar.d.ts.map +1 -0
- package/dist/chat/Sidebar.js +71 -0
- package/dist/chat/Sidebar.js.map +1 -0
- package/dist/chat/Sources.cjs +25 -0
- package/dist/chat/Sources.d.ts +23 -0
- package/dist/chat/Sources.d.ts.map +1 -0
- package/dist/chat/Sources.js +22 -0
- package/dist/chat/Sources.js.map +1 -0
- package/dist/chat/Thread.cjs +42 -0
- package/dist/chat/Thread.d.ts +11 -0
- package/dist/chat/Thread.d.ts.map +1 -0
- package/dist/chat/Thread.js +40 -0
- package/dist/chat/Thread.js.map +1 -0
- package/dist/chat/index.cjs +58 -0
- package/dist/chat/index.d.ts +30 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +30 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/send.cjs +44 -0
- package/dist/chat/send.d.ts +32 -0
- package/dist/chat/send.d.ts.map +1 -0
- package/dist/chat/send.js +40 -0
- package/dist/chat/send.js.map +1 -0
- package/dist/chat/stick.cjs +19 -0
- package/dist/chat/stick.d.ts +24 -0
- package/dist/chat/stick.d.ts.map +1 -0
- package/dist/chat/stick.js +16 -0
- package/dist/chat/stick.js.map +1 -0
- package/package.json +8 -2
|
@@ -24,6 +24,18 @@ export type ButtonProps = Omit<ComponentProps<typeof Frame>, 'variant' | 'size'
|
|
|
24
24
|
size?: ButtonSize | null;
|
|
25
25
|
isLoading?: boolean;
|
|
26
26
|
children?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The DOM tooltip. Already reached the element -- every unrecognised prop is
|
|
29
|
+
* spread onto Frame, which forwards it -- but the Frame's props come from the
|
|
30
|
+
* cross-platform stack and name no DOM attribute, so passing it did not type.
|
|
31
|
+
* Callers either dropped the tooltip or re-declared the whole component as
|
|
32
|
+
* `any`, and the second hides every real error in the file.
|
|
33
|
+
*
|
|
34
|
+
* Declared here because it is true on web and harmless elsewhere: native
|
|
35
|
+
* ignores an attribute it does not know. Widening the type to match the
|
|
36
|
+
* behaviour beats asking ~60 call sites to work around it.
|
|
37
|
+
*/
|
|
38
|
+
title?: string;
|
|
27
39
|
};
|
|
28
40
|
declare function Button({ className, variant, size, asChild, isLoading, disabled, children, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
29
41
|
export { Button };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/button.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAiC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAK1F,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,GACN,SAAS,GACT,QAAQ,GACR,WAAW,CAAA;AAEf,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAqBjF,QAAA,MAAM,KAAK;;;;;;;;8CA8CT,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,gCAI5B;IAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,WAG1E,CAAA;AAEd,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC,GAAG;IAC9F,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC9B,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/button.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAiC,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAK1F,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,GACN,S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,CAAC,SAAS,EACvG,QAAQ,EAAE,QAAQ,IAAI,SAAS,KAC3B,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EACpC,SAAS,EAAE,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,KACnD,KAAK,aAER,SAAS,IAAI,KAAC,OAAO,IAAC,IAAI,EAAC,OAAO,GAAG,EACrC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,IAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,IAC3D,CACT,CAAA;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slot = void 0;
|
|
3
|
+
exports.tip = exports.slot = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Web-only slot marker. gui forwards unrecognised props to the DOM node and
|
|
6
6
|
* native drops them, so this is the cross-platform way to keep the `data-slot`
|
|
@@ -8,3 +8,13 @@ exports.slot = void 0;
|
|
|
8
8
|
*/
|
|
9
9
|
const slot = (name) => ({ 'data-slot': name });
|
|
10
10
|
exports.slot = slot;
|
|
11
|
+
/**
|
|
12
|
+
* Web-only tooltip marker, for the same reason as `slot`.
|
|
13
|
+
*
|
|
14
|
+
* `title` is a DOM attribute with no native equivalent, so gui does not type it
|
|
15
|
+
* — but it is the only hover affordance an icon-only control has on a pointer
|
|
16
|
+
* device. `aria-label` is NOT a substitute: it names the control for assistive
|
|
17
|
+
* tech and renders nothing on hover. Set both.
|
|
18
|
+
*/
|
|
19
|
+
const tip = (text) => ({ title: text });
|
|
20
|
+
exports.tip = tip;
|
|
@@ -4,4 +4,13 @@
|
|
|
4
4
|
* contract that app CSS and tests select on.
|
|
5
5
|
*/
|
|
6
6
|
export declare const slot: (name: string) => object;
|
|
7
|
+
/**
|
|
8
|
+
* Web-only tooltip marker, for the same reason as `slot`.
|
|
9
|
+
*
|
|
10
|
+
* `title` is a DOM attribute with no native equivalent, so gui does not type it
|
|
11
|
+
* — but it is the only hover affordance an icon-only control has on a pointer
|
|
12
|
+
* device. `aria-label` is NOT a substitute: it names the control for assistive
|
|
13
|
+
* tech and renders nothing on hover. Set both.
|
|
14
|
+
*/
|
|
15
|
+
export declare const tip: (text: string) => object;
|
|
7
16
|
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/slot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAgC,MAAM,CAAA"}
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/slot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,KAAgC,MAAM,CAAA;AAEvE;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,KAA0B,MAAM,CAAA"}
|
|
@@ -4,4 +4,13 @@
|
|
|
4
4
|
* contract that app CSS and tests select on.
|
|
5
5
|
*/
|
|
6
6
|
export const slot = (name) => ({ 'data-slot': name });
|
|
7
|
+
/**
|
|
8
|
+
* Web-only tooltip marker, for the same reason as `slot`.
|
|
9
|
+
*
|
|
10
|
+
* `title` is a DOM attribute with no native equivalent, so gui does not type it
|
|
11
|
+
* — but it is the only hover affordance an icon-only control has on a pointer
|
|
12
|
+
* device. `aria-label` is NOT a substitute: it names the control for assistive
|
|
13
|
+
* tech and renders nothing on hover. Set both.
|
|
14
|
+
*/
|
|
15
|
+
export const tip = (text) => ({ title: text });
|
|
7
16
|
//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/backends/gui/slot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../../src/backends/gui/slot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAW,CAAA;AAEvE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAW,CAAA"}
|
|
@@ -41,14 +41,6 @@ const gui_1 = require("@hanzo/gui");
|
|
|
41
41
|
/** Floor for the grown row count. */
|
|
42
42
|
const MIN_ROWS = 3;
|
|
43
43
|
const rowsOf = (v) => typeof v === "string" ? v.split("\n").length : 0;
|
|
44
|
-
/**
|
|
45
|
-
* Textarea — standard-token multiline field.
|
|
46
|
-
*
|
|
47
|
-
* Auto-grow is line-driven rather than DOM-measured, so web, native and desktop
|
|
48
|
-
* grow identically: the row count follows the value and gui's
|
|
49
|
-
* `textAreaSizeVariant` turns rows into height.
|
|
50
|
-
* `rows` is the floor, not a fixed size.
|
|
51
|
-
*/
|
|
52
44
|
const Textarea = /* @__PURE__ */ React.forwardRef(function Textarea({ rows, value, defaultValue, ...props }, ref) {
|
|
53
45
|
const [typed, setTyped] = React.useState(() => rowsOf(defaultValue));
|
|
54
46
|
const uncontrolled = value === undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { TextArea } from "@hanzo/gui";
|
|
2
3
|
/**
|
|
3
4
|
* Textarea — standard-token multiline field.
|
|
4
5
|
*
|
|
@@ -7,6 +8,12 @@ import * as React from "react";
|
|
|
7
8
|
* `textAreaSizeVariant` turns rows into height.
|
|
8
9
|
* `rows` is the floor, not a fixed size.
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Typed from the gui component it renders, exactly as `Input` is — the field
|
|
13
|
+
* takes `onChangeText`, not a DOM `change` event, and the DOM-only spelling was
|
|
14
|
+
* a type that never matched the runtime.
|
|
15
|
+
*/
|
|
16
|
+
export type TextareaProps = Omit<React.ComponentProps<typeof TextArea>, "children"> & Pick<React.ComponentProps<"textarea">, "onKeyDown" | "rows">;
|
|
17
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
11
18
|
export { Textarea };
|
|
12
19
|
//# sourceMappingURL=textarea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/textarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/textarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAQrC;;;;;;;GAOG;AACH;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EAAE,UAAU,CAAC,GACjF,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAE9D,QAAA,MAAM,QAAQ,wGA0Bb,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -5,14 +5,6 @@ import { TextArea } from "@hanzo/gui";
|
|
|
5
5
|
/** Floor for the grown row count. */
|
|
6
6
|
const MIN_ROWS = 3;
|
|
7
7
|
const rowsOf = (v) => typeof v === "string" ? v.split("\n").length : 0;
|
|
8
|
-
/**
|
|
9
|
-
* Textarea — standard-token multiline field.
|
|
10
|
-
*
|
|
11
|
-
* Auto-grow is line-driven rather than DOM-measured, so web, native and desktop
|
|
12
|
-
* grow identically: the row count follows the value and gui's
|
|
13
|
-
* `textAreaSizeVariant` turns rows into height.
|
|
14
|
-
* `rows` is the floor, not a fixed size.
|
|
15
|
-
*/
|
|
16
8
|
const Textarea = /* @__PURE__ */ React.forwardRef(function Textarea({ rows, value, defaultValue, ...props }, ref) {
|
|
17
9
|
const [typed, setTyped] = React.useState(() => rowsOf(defaultValue));
|
|
18
10
|
const uncontrolled = value === undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/backends/gui/textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qCAAqC;AACrC,MAAM,QAAQ,GAAG,CAAC,CAAA;AAElB,MAAM,MAAM,GAAG,CAAC,CAAU,EAAE,EAAE,CAC5B,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/backends/gui/textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qCAAqC;AACrC,MAAM,QAAQ,GAAG,CAAC,CAAA;AAElB,MAAM,MAAM,GAAG,CAAC,CAAU,EAAE,EAAE,CAC5B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GAAG,CAAC,CAAC,CAAC,CAAC,KAC5B,KAAiC,GACtC,CACH,CAAA;AACD,CAAC,CACF,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Code = Code;
|
|
5
|
+
exports.CopyButton = CopyButton;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* Code — a labelled, copyable code region.
|
|
9
|
+
*
|
|
10
|
+
* The language label and the controls live in a bar above the code, never
|
|
11
|
+
* floating over it: an overlaid copy button covers the first line, which is
|
|
12
|
+
* where the prompt or the import sits and the part most often being read.
|
|
13
|
+
*
|
|
14
|
+
* Highlighting is not here. Surfaces disagree on the highlighter (and on whether
|
|
15
|
+
* they want one at all), and a package that picked would either impose a large
|
|
16
|
+
* dependency or be bypassed. `children` is rendered as-is, so a surface can pass
|
|
17
|
+
* plain text or its own highlighted nodes.
|
|
18
|
+
*/
|
|
19
|
+
const gui_1 = require("@hanzo/gui");
|
|
20
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
21
|
+
const react_1 = require("react");
|
|
22
|
+
const slot_1 = require("../backends/gui/slot.cjs");
|
|
23
|
+
/** How long the copy control shows its confirmation, in ms. */
|
|
24
|
+
const CONFIRM = 2000;
|
|
25
|
+
/**
|
|
26
|
+
* Monospace stack, applied through `style` rather than a `$mono` token.
|
|
27
|
+
*
|
|
28
|
+
* There is no mono family in the token set — only `$body` and `$heading` — so a
|
|
29
|
+
* `fontFamily="$mono"` would not typecheck, and picking `$body` would set code
|
|
30
|
+
* in a proportional face, where columns stop aligning and l/1/I stop being
|
|
31
|
+
* distinguishable. The CSS variable is honoured when the host defines Geist
|
|
32
|
+
* Mono and falls back to the platform's own monospace when it does not.
|
|
33
|
+
*/
|
|
34
|
+
const MONO = {
|
|
35
|
+
fontFamily: 'var(--font-geist-mono, ui-monospace, SFMono-Regular, Menlo, monospace)',
|
|
36
|
+
};
|
|
37
|
+
function Code({ children, language = 'text', value, actions }) {
|
|
38
|
+
const text = value ?? (typeof children === 'string' ? children : '');
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('code'), width: "100%", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$color2", overflow: "hidden", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$1", px: "$3", py: "$1.5", borderBottomWidth: 1, borderColor: "$borderColor", children: [(0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", style: MONO, color: "$color10", children: language }), (0, jsx_runtime_1.jsx)(gui_1.XStack, { flex: 1 }), actions, text ? (0, jsx_runtime_1.jsx)(CopyButton, { value: text }) : null] }), (0, jsx_runtime_1.jsx)(gui_1.YStack, { px: "$3", py: "$2.5", children: (0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", style: MONO, lineHeight: 20, children: children }) })] }));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* CopyButton — copy with a confirmation tick.
|
|
43
|
+
*
|
|
44
|
+
* The tick is the point. A control that looks identical before and after leaves
|
|
45
|
+
* the reader unsure whether it fired, and the usual response is to press it
|
|
46
|
+
* again. Reverts after `CONFIRM`, and clears its timer on unmount so it cannot
|
|
47
|
+
* set state on a component that is gone.
|
|
48
|
+
*/
|
|
49
|
+
function CopyButton({ value, label = 'Copy' }) {
|
|
50
|
+
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
51
|
+
const timer = (0, react_1.useRef)(undefined);
|
|
52
|
+
(0, react_1.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
53
|
+
const copy = () => {
|
|
54
|
+
// Optional-chained rather than assumed: `navigator.clipboard` is undefined
|
|
55
|
+
// in insecure contexts and absent entirely on native, and these components
|
|
56
|
+
// are meant to run on both.
|
|
57
|
+
navigator?.clipboard
|
|
58
|
+
?.writeText(value)
|
|
59
|
+
.then(() => {
|
|
60
|
+
setCopied(true);
|
|
61
|
+
clearTimeout(timer.current);
|
|
62
|
+
timer.current = setTimeout(() => setCopied(false), CONFIRM);
|
|
63
|
+
})
|
|
64
|
+
.catch(() => {
|
|
65
|
+
// A refused clipboard needs no toast — the missing tick already says it,
|
|
66
|
+
// and an error dialog for a failed copy is louder than the failure.
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { width: 24, height: 24, items: "center", justify: "center", rounded: "$2", cursor: "pointer", opacity: 0.7, onPress: copy, role: "button", tabIndex: 0, "aria-label": copied ? 'Copied' : label, ...(0, slot_1.tip)(copied ? 'Copied' : label), hoverStyle: { bg: '$color4', opacity: 1 }, pressStyle: { bg: '$color5' }, children: copied ? (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: 14 }) : (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Copy, { size: 14 }) }));
|
|
70
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface CodeProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
/** Shown in the label bar. */
|
|
5
|
+
language?: string;
|
|
6
|
+
/** Raw text for the copy control. Falls back to `children` when it is a string. */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** Extra controls in the label bar, before copy. */
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function Code({ children, language, value, actions }: CodeProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export interface CopyButtonProps {
|
|
13
|
+
value: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* CopyButton — copy with a confirmation tick.
|
|
18
|
+
*
|
|
19
|
+
* The tick is the point. A control that looks identical before and after leaves
|
|
20
|
+
* the reader unsure whether it fired, and the usual response is to press it
|
|
21
|
+
* again. Reverts after `CONFIRM`, and clears its timer on unmount so it cannot
|
|
22
|
+
* set state on a component that is gone.
|
|
23
|
+
*/
|
|
24
|
+
export declare function CopyButton({ value, label }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=Code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/chat/Code.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAoBnE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oDAAoD;IACpD,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,SAAS,2CAoC9E;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,KAAc,EAAE,EAAE,eAAe,2CA2CpE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Code — a labelled, copyable code region.
|
|
5
|
+
*
|
|
6
|
+
* The language label and the controls live in a bar above the code, never
|
|
7
|
+
* floating over it: an overlaid copy button covers the first line, which is
|
|
8
|
+
* where the prompt or the import sits and the part most often being read.
|
|
9
|
+
*
|
|
10
|
+
* Highlighting is not here. Surfaces disagree on the highlighter (and on whether
|
|
11
|
+
* they want one at all), and a package that picked would either impose a large
|
|
12
|
+
* dependency or be bypassed. `children` is rendered as-is, so a surface can pass
|
|
13
|
+
* plain text or its own highlighted nodes.
|
|
14
|
+
*/
|
|
15
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
16
|
+
import { Check, Copy } from '@hanzogui/lucide-icons-2';
|
|
17
|
+
import { useEffect, useRef, useState } from 'react';
|
|
18
|
+
import { slot, tip } from '../backends/gui/slot.js';
|
|
19
|
+
/** How long the copy control shows its confirmation, in ms. */
|
|
20
|
+
const CONFIRM = 2000;
|
|
21
|
+
/**
|
|
22
|
+
* Monospace stack, applied through `style` rather than a `$mono` token.
|
|
23
|
+
*
|
|
24
|
+
* There is no mono family in the token set — only `$body` and `$heading` — so a
|
|
25
|
+
* `fontFamily="$mono"` would not typecheck, and picking `$body` would set code
|
|
26
|
+
* in a proportional face, where columns stop aligning and l/1/I stop being
|
|
27
|
+
* distinguishable. The CSS variable is honoured when the host defines Geist
|
|
28
|
+
* Mono and falls back to the platform's own monospace when it does not.
|
|
29
|
+
*/
|
|
30
|
+
const MONO = {
|
|
31
|
+
fontFamily: 'var(--font-geist-mono, ui-monospace, SFMono-Regular, Menlo, monospace)',
|
|
32
|
+
};
|
|
33
|
+
export function Code({ children, language = 'text', value, actions }) {
|
|
34
|
+
const text = value ?? (typeof children === 'string' ? children : '');
|
|
35
|
+
return (_jsxs(YStack, { ...slot('code'), width: "100%", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$color2", overflow: "hidden", children: [_jsxs(XStack, { items: "center", gap: "$1", px: "$3", py: "$1.5", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", style: MONO, color: "$color10", children: language }), _jsx(XStack, { flex: 1 }), actions, text ? _jsx(CopyButton, { value: text }) : null] }), _jsx(YStack, { px: "$3", py: "$2.5", children: _jsx(SizableText, { size: "$1", style: MONO, lineHeight: 20, children: children }) })] }));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* CopyButton — copy with a confirmation tick.
|
|
39
|
+
*
|
|
40
|
+
* The tick is the point. A control that looks identical before and after leaves
|
|
41
|
+
* the reader unsure whether it fired, and the usual response is to press it
|
|
42
|
+
* again. Reverts after `CONFIRM`, and clears its timer on unmount so it cannot
|
|
43
|
+
* set state on a component that is gone.
|
|
44
|
+
*/
|
|
45
|
+
export function CopyButton({ value, label = 'Copy' }) {
|
|
46
|
+
const [copied, setCopied] = useState(false);
|
|
47
|
+
const timer = useRef(undefined);
|
|
48
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
49
|
+
const copy = () => {
|
|
50
|
+
// Optional-chained rather than assumed: `navigator.clipboard` is undefined
|
|
51
|
+
// in insecure contexts and absent entirely on native, and these components
|
|
52
|
+
// are meant to run on both.
|
|
53
|
+
navigator?.clipboard
|
|
54
|
+
?.writeText(value)
|
|
55
|
+
.then(() => {
|
|
56
|
+
setCopied(true);
|
|
57
|
+
clearTimeout(timer.current);
|
|
58
|
+
timer.current = setTimeout(() => setCopied(false), CONFIRM);
|
|
59
|
+
})
|
|
60
|
+
.catch(() => {
|
|
61
|
+
// A refused clipboard needs no toast — the missing tick already says it,
|
|
62
|
+
// and an error dialog for a failed copy is louder than the failure.
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
return (_jsx(XStack, { width: 24, height: 24, items: "center", justify: "center", rounded: "$2", cursor: "pointer", opacity: 0.7, onPress: copy, role: "button", tabIndex: 0, "aria-label": copied ? 'Copied' : label, ...tip(copied ? 'Copied' : label), hoverStyle: { bg: '$color4', opacity: 1 }, pressStyle: { bg: '$color5' }, children: copied ? _jsx(Check, { size: 14 }) : _jsx(Copy, { size: 14 }) }));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=Code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.js","sourceRoot":"","sources":["../../src/chat/Code.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAE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C,IAAI,EACZ,MAAM,EAAC,SAAS,EAChB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,IAAI,EACb,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,gBACC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KACjC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,EAClC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,EACzC,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,YAE5B,MAAM,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,GAAI,GAC3C,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ASK = void 0;
|
|
5
|
+
exports.Composer = Composer;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* Composer — the one chat input for every Hanzo surface.
|
|
9
|
+
*
|
|
10
|
+
* Presentational and controlled: it owns no draft, no transport and no model
|
|
11
|
+
* state. `children` is the toolbar slot, which is where a surface puts its
|
|
12
|
+
* `ModelSelector`, attachment control or mode chips — that keeps the shell the
|
|
13
|
+
* same everywhere while the affordances stay per-surface.
|
|
14
|
+
*
|
|
15
|
+
* The send control is the same button in both states: it submits, and while a
|
|
16
|
+
* turn is in flight it stops. Two buttons in one place was the thing every
|
|
17
|
+
* surface got subtly different.
|
|
18
|
+
*/
|
|
19
|
+
const gui_1 = require("@hanzo/gui");
|
|
20
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
21
|
+
const gui_2 = require("../backends/gui/index.cjs");
|
|
22
|
+
const slot_1 = require("../backends/gui/slot.cjs");
|
|
23
|
+
const send_1 = require("./send.cjs");
|
|
24
|
+
const PAD = 8;
|
|
25
|
+
const MIN_ROWS = 1;
|
|
26
|
+
/**
|
|
27
|
+
* The resting placeholder.
|
|
28
|
+
*
|
|
29
|
+
* "Ask anything", not "Send a message" and not "Message <model>". It addresses
|
|
30
|
+
* the person rather than describing the mechanism, and being one constant string
|
|
31
|
+
* it never has to be recomputed or re-announced when the model or endpoint
|
|
32
|
+
* changes — which is what a model-named placeholder forces a surface to do.
|
|
33
|
+
*/
|
|
34
|
+
exports.ASK = 'Ask anything';
|
|
35
|
+
function Composer({ value, onChange, onSend, onStop, busy = false, disabled = false, placeholder = exports.ASK, rows = MIN_ROWS, children, hint, }) {
|
|
36
|
+
const sendable = (0, send_1.ready)(value, busy, disabled);
|
|
37
|
+
const keyed = (e) => {
|
|
38
|
+
const key = e.key ?? e.nativeEvent?.key ?? '';
|
|
39
|
+
const mods = {
|
|
40
|
+
shiftKey: e.shiftKey ?? e.nativeEvent?.shiftKey,
|
|
41
|
+
altKey: e.altKey ?? e.nativeEvent?.altKey,
|
|
42
|
+
metaKey: e.metaKey ?? e.nativeEvent?.metaKey,
|
|
43
|
+
ctrlKey: e.ctrlKey ?? e.nativeEvent?.ctrlKey,
|
|
44
|
+
isComposing: e.isComposing ?? e.nativeEvent?.isComposing,
|
|
45
|
+
// Safari's only honest IME signal on this keydown. Dropping it here would
|
|
46
|
+
// put the mid-candidate submit straight back, whatever `sends` checks.
|
|
47
|
+
keyCode: e.keyCode ?? e.nativeEvent?.keyCode,
|
|
48
|
+
};
|
|
49
|
+
if (!(0, send_1.sends)(key, mods))
|
|
50
|
+
return;
|
|
51
|
+
e.preventDefault?.();
|
|
52
|
+
if (sendable)
|
|
53
|
+
onSend();
|
|
54
|
+
};
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('composer'), width: "100%", rounded: "$5", borderWidth: 1, borderColor: "$borderColor", bg: "$background", p: PAD, gap: PAD, children: [(0, jsx_runtime_1.jsx)(gui_2.Textarea, { ...(0, slot_1.slot)('composer-field'), rows: rows, value: value, placeholder: placeholder, disabled: disabled, onChangeText: onChange, onKeyDown: keyed, borderWidth: 0, "aria-label": placeholder }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: PAD, children: [children, (0, jsx_runtime_1.jsx)(gui_1.XStack, { flex: 1 }), hint ? ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", color: "$color10", children: hint })) : null, (0, jsx_runtime_1.jsx)(gui_2.Button, { ...(0, slot_1.slot)('composer-send'), size: "sm", disabled: busy ? !onStop : !sendable, onPress: busy ? onStop : onSend, "aria-label": busy ? 'Stop' : 'Send', children: busy ? (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Square, { size: 14 }) : (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ArrowUp, { size: 16 }) })] })] }));
|
|
56
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The resting placeholder.
|
|
4
|
+
*
|
|
5
|
+
* "Ask anything", not "Send a message" and not "Message <model>". It addresses
|
|
6
|
+
* the person rather than describing the mechanism, and being one constant string
|
|
7
|
+
* it never has to be recomputed or re-announced when the model or endpoint
|
|
8
|
+
* changes — which is what a model-named placeholder forces a surface to do.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ASK = "Ask anything";
|
|
11
|
+
export interface ComposerProps {
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
/** Called when the draft is submitted. Clearing `value` is the host's job. */
|
|
15
|
+
onSend: () => void;
|
|
16
|
+
/** Called instead of `onSend` while `busy`. Omit to disable stopping. */
|
|
17
|
+
onStop?: () => void;
|
|
18
|
+
/** A turn is in flight: the send control becomes stop. */
|
|
19
|
+
busy?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** Row floor for the field. It grows with the draft from here. */
|
|
23
|
+
rows?: number;
|
|
24
|
+
/** Toolbar slot, rendered at the start of the footer row. */
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/** Hint shown at the end of the footer row. */
|
|
27
|
+
hint?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function Composer({ value, onChange, onSend, onStop, busy, disabled, placeholder, rows, children, hint, }: ComposerProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=Composer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Composer.d.ts","sourceRoot":"","sources":["../../src/chat/Composer.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,iBAAiB,CAAA;AAEjC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,8EAA8E;IAC9E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAY,EACZ,QAAgB,EAChB,WAAiB,EACjB,IAAe,EACf,QAAQ,EACR,IAAI,GACL,EAAE,aAAa,2CA8Df"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Composer — the one chat input for every Hanzo surface.
|
|
5
|
+
*
|
|
6
|
+
* Presentational and controlled: it owns no draft, no transport and no model
|
|
7
|
+
* state. `children` is the toolbar slot, which is where a surface puts its
|
|
8
|
+
* `ModelSelector`, attachment control or mode chips — that keeps the shell the
|
|
9
|
+
* same everywhere while the affordances stay per-surface.
|
|
10
|
+
*
|
|
11
|
+
* The send control is the same button in both states: it submits, and while a
|
|
12
|
+
* turn is in flight it stops. Two buttons in one place was the thing every
|
|
13
|
+
* surface got subtly different.
|
|
14
|
+
*/
|
|
15
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
16
|
+
import { ArrowUp, Square } from '@hanzogui/lucide-icons-2';
|
|
17
|
+
import { Button, Textarea } from '../backends/gui/index.js';
|
|
18
|
+
import { slot } from '../backends/gui/slot.js';
|
|
19
|
+
import { ready, sends } from './send.js';
|
|
20
|
+
const PAD = 8;
|
|
21
|
+
const MIN_ROWS = 1;
|
|
22
|
+
/**
|
|
23
|
+
* The resting placeholder.
|
|
24
|
+
*
|
|
25
|
+
* "Ask anything", not "Send a message" and not "Message <model>". It addresses
|
|
26
|
+
* the person rather than describing the mechanism, and being one constant string
|
|
27
|
+
* it never has to be recomputed or re-announced when the model or endpoint
|
|
28
|
+
* changes — which is what a model-named placeholder forces a surface to do.
|
|
29
|
+
*/
|
|
30
|
+
export const ASK = 'Ask anything';
|
|
31
|
+
export function Composer({ value, onChange, onSend, onStop, busy = false, disabled = false, placeholder = ASK, rows = MIN_ROWS, children, hint, }) {
|
|
32
|
+
const sendable = ready(value, busy, disabled);
|
|
33
|
+
const keyed = (e) => {
|
|
34
|
+
const key = e.key ?? e.nativeEvent?.key ?? '';
|
|
35
|
+
const mods = {
|
|
36
|
+
shiftKey: e.shiftKey ?? e.nativeEvent?.shiftKey,
|
|
37
|
+
altKey: e.altKey ?? e.nativeEvent?.altKey,
|
|
38
|
+
metaKey: e.metaKey ?? e.nativeEvent?.metaKey,
|
|
39
|
+
ctrlKey: e.ctrlKey ?? e.nativeEvent?.ctrlKey,
|
|
40
|
+
isComposing: e.isComposing ?? e.nativeEvent?.isComposing,
|
|
41
|
+
// Safari's only honest IME signal on this keydown. Dropping it here would
|
|
42
|
+
// put the mid-candidate submit straight back, whatever `sends` checks.
|
|
43
|
+
keyCode: e.keyCode ?? e.nativeEvent?.keyCode,
|
|
44
|
+
};
|
|
45
|
+
if (!sends(key, mods))
|
|
46
|
+
return;
|
|
47
|
+
e.preventDefault?.();
|
|
48
|
+
if (sendable)
|
|
49
|
+
onSend();
|
|
50
|
+
};
|
|
51
|
+
return (_jsxs(YStack, { ...slot('composer'), width: "100%", rounded: "$5", borderWidth: 1, borderColor: "$borderColor", bg: "$background", p: PAD, gap: PAD, children: [_jsx(Textarea, { ...slot('composer-field'), rows: rows, value: value, placeholder: placeholder, disabled: disabled, onChangeText: onChange, onKeyDown: keyed, borderWidth: 0, "aria-label": placeholder }), _jsxs(XStack, { items: "center", gap: PAD, children: [children, _jsx(XStack, { flex: 1 }), hint ? (_jsx(SizableText, { size: "$1", color: "$color10", children: hint })) : null, _jsx(Button, { ...slot('composer-send'), size: "sm", disabled: busy ? !onStop : !sendable, onPress: busy ? onStop : onSend, "aria-label": busy ? 'Stop' : 'Send', children: busy ? _jsx(Square, { size: 14 }) : _jsx(ArrowUp, { size: 16 }) })] })] }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=Composer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Composer.js","sourceRoot":"","sources":["../../src/chat/Composer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EA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,CAAC,CAAC,MAAM,gBACnB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,YAEjC,IAAI,CAAC,CAAC,CAAC,KAAC,MAAM,IAAC,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAE,EAAE,GAAI,GAC7C,IACF,IACF,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Header = Header;
|
|
5
|
+
exports.HeaderButton = HeaderButton;
|
|
6
|
+
exports.ShareButton = ShareButton;
|
|
7
|
+
exports.AsideToggle = AsideToggle;
|
|
8
|
+
exports.Aside = Aside;
|
|
9
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Header — the conversation title bar.
|
|
12
|
+
*
|
|
13
|
+
* Title on the left, `children` as the action slot on the right. The actions are
|
|
14
|
+
* a slot rather than a fixed set because what belongs there is per-surface:
|
|
15
|
+
* hanzo.chat shares and opens a details rail, the console shows the owning
|
|
16
|
+
* project, hanzo.app shows neither.
|
|
17
|
+
*/
|
|
18
|
+
const gui_1 = require("@hanzo/gui");
|
|
19
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
20
|
+
const slot_1 = require("../backends/gui/slot.cjs");
|
|
21
|
+
function Header({ title, onOpenMenu, children }) {
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('chat-header'), width: "100%", height: 48, shrink: 0, items: "center", gap: "$2", px: "$3", borderBottomWidth: 1, borderColor: "$borderColor", bg: "$background", children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$1", shrink: 1, children: [(0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$2", fontWeight: "500", numberOfLines: 1, children: title }), onOpenMenu ? ((0, jsx_runtime_1.jsx)(HeaderButton, { label: "Conversation options", onPress: onOpenMenu, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Ellipsis, { size: 16 }) })) : null] }), (0, jsx_runtime_1.jsx)(gui_1.XStack, { flex: 1 }), children] }));
|
|
23
|
+
}
|
|
24
|
+
function HeaderButton({ label, onPress, children }) {
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.XStack, { width: 32, height: 32, items: "center", justify: "center", rounded: "$3", cursor: "pointer", opacity: 0.7, onPress: onPress, role: "button", tabIndex: 0, "aria-label": label, ...(0, slot_1.tip)(label), hoverStyle: { bg: '$color4', opacity: 1 }, pressStyle: { bg: '$color5' }, children: children }));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* ShareButton — carries a word, unlike its neighbours.
|
|
29
|
+
*
|
|
30
|
+
* Sharing sends the conversation somewhere else and is not quietly undoable, so
|
|
31
|
+
* it reads as a label rather than a glyph. Everything reversible in this bar is
|
|
32
|
+
* an icon; this deliberately is not.
|
|
33
|
+
*/
|
|
34
|
+
function ShareButton({ label = 'Share', onPress }) {
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('chat-share'), items: "center", gap: "$1.5", px: "$2.5", py: "$1.5", rounded: "$3", cursor: "pointer", opacity: 0.8, onPress: onPress, role: "button", tabIndex: 0, hoverStyle: { bg: '$color4', opacity: 1 }, pressStyle: { bg: '$color5' }, children: [(0, jsx_runtime_1.jsx)(lucide_icons_2_1.Share2, { size: 14 }), (0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", fontWeight: "500", children: label })] }));
|
|
36
|
+
}
|
|
37
|
+
function AsideToggle({ label = 'Toggle details panel', onPress }) {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(HeaderButton, { label: label, onPress: onPress, children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.PanelRight, { size: 16 }) }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Aside — the right rail (sources, artifacts, run details).
|
|
42
|
+
*
|
|
43
|
+
* Its own column, not an overlay: an overlay would sit on top of the prose the
|
|
44
|
+
* reader is comparing it against, which is the one thing a citation panel must
|
|
45
|
+
* not do. Surfaces hide it at narrow widths by not rendering it.
|
|
46
|
+
*/
|
|
47
|
+
function Aside({ children, width = 320 }) {
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('chat-aside'), width: width, shrink: 0, height: "100%", p: "$3", gap: "$3", borderLeftWidth: 1, borderColor: "$borderColor", children: children }));
|
|
49
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface HeaderProps {
|
|
3
|
+
title: string;
|
|
4
|
+
/** Overflow menu next to the title. Omit to hide it. */
|
|
5
|
+
onOpenMenu?: () => void;
|
|
6
|
+
/** Action slot, rendered at the end of the row. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function Header({ title, onOpenMenu, children }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export interface HeaderButtonProps {
|
|
11
|
+
/** Required — the accessible name for an icon-only control. */
|
|
12
|
+
label: string;
|
|
13
|
+
onPress?: () => void;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function HeaderButton({ label, onPress, children }: HeaderButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export interface ShareButtonProps {
|
|
18
|
+
label?: string;
|
|
19
|
+
onPress?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ShareButton — carries a word, unlike its neighbours.
|
|
23
|
+
*
|
|
24
|
+
* Sharing sends the conversation somewhere else and is not quietly undoable, so
|
|
25
|
+
* it reads as a label rather than a glyph. Everything reversible in this bar is
|
|
26
|
+
* an icon; this deliberately is not.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ShareButton({ label, onPress }: ShareButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export interface AsideToggleProps {
|
|
30
|
+
label?: string;
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
}
|
|
33
|
+
export declare function AsideToggle({ label, onPress }: AsideToggleProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export interface AsideProps {
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
width?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Aside — the right rail (sources, artifacts, run details).
|
|
40
|
+
*
|
|
41
|
+
* Its own column, not an overlay: an overlay would sit on top of the prose the
|
|
42
|
+
* reader is comparing it against, which is the one thing a citation panel must
|
|
43
|
+
* not do. Surfaces hide it at narrow widths by not rendering it.
|
|
44
|
+
*/
|
|
45
|
+
export declare function Aside({ children, width }: AsideProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
//# sourceMappingURL=Header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/chat/Header.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,WAAW,2CAiClE;AAED,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO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