@mechane-ai/ui 0.2.2 → 0.3.0
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/README.md +34 -13
- package/dist/ai.js +315 -0
- package/dist/assets/stylex.css +1533 -360
- package/dist/cartesian-Bwt6ZnF5.js +847 -0
- package/dist/chart-input-Bti0gyzz.js +173 -0
- package/dist/charts/cartesian.js +1 -0
- package/dist/charts/distribution.js +1 -0
- package/dist/charts/graph.js +1 -0
- package/dist/charts/matrix.js +1 -0
- package/dist/charts.js +98 -93
- package/dist/code-BJp-g4Fw.js +172 -0
- package/dist/collections.js +666 -0
- package/dist/content/code.js +1 -0
- package/dist/content/diff.js +101 -0
- package/dist/content/link.js +1 -0
- package/dist/content/tree.js +77 -0
- package/dist/content-link-52aZVX3X.js +26 -0
- package/dist/content.js +367 -0
- package/dist/distribution-CViLvcPP.js +609 -0
- package/dist/graph-DAfo72ZD.js +230 -0
- package/dist/index.js +1 -1
- package/dist/layout.js +201 -160
- package/dist/matrix-B9dybkce.js +785 -0
- package/dist/packages/ai/src/approval.d.ts +29 -0
- package/dist/packages/ai/src/conversation.d.ts +34 -0
- package/dist/packages/ai/src/index.d.ts +10 -0
- package/dist/packages/ai/src/message.d.ts +19 -0
- package/dist/packages/ai/src/prompt-input.d.ts +25 -0
- package/dist/packages/ai/src/sources.d.ts +17 -0
- package/dist/packages/charts/src/cartesian/categorical.d.ts +43 -0
- package/dist/packages/charts/src/cartesian/index.d.ts +8 -0
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +11 -0
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +54 -0
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +9 -0
- package/dist/packages/charts/src/cartesian/time-series.d.ts +29 -0
- package/dist/packages/charts/src/chart-frame.d.ts +34 -0
- package/dist/packages/charts/src/chart-input.d.ts +10 -0
- package/dist/packages/charts/src/chart-theme.d.ts +48 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +14 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +135 -0
- package/dist/packages/charts/src/distribution/ecdf.d.ts +23 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +26 -0
- package/dist/packages/charts/src/distribution/index.d.ts +8 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +24 -0
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +22 -0
- package/dist/packages/charts/src/graph/index.d.ts +2 -0
- package/dist/packages/charts/src/graph/relation-graph.d.ts +45 -0
- package/dist/packages/charts/src/index.d.ts +13 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +7 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -0
- package/dist/packages/charts/src/matrix/index.d.ts +9 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/scatter-plot.d.ts +37 -0
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +20 -0
- package/dist/packages/charts/src/plot-width.d.ts +5 -0
- package/dist/packages/collections/src/calendar.d.ts +32 -0
- package/dist/packages/collections/src/collection-controls.d.ts +41 -0
- package/dist/packages/collections/src/command.d.ts +37 -0
- package/dist/packages/collections/src/data-table.d.ts +49 -0
- package/dist/packages/collections/src/date-range-picker.d.ts +16 -0
- package/dist/packages/collections/src/index.d.ts +13 -0
- package/dist/packages/content/src/code/code-block.d.ts +22 -0
- package/dist/packages/content/src/code/index.d.ts +2 -0
- package/dist/packages/content/src/code/use-highlighted-code.d.ts +9 -0
- package/dist/packages/content/src/content-link.d.ts +8 -0
- package/dist/packages/content/src/diff/diff-source.d.ts +32 -0
- package/dist/packages/content/src/diff/diff-viewer.d.ts +3 -0
- package/dist/packages/content/src/diff/index.d.ts +2 -0
- package/dist/packages/content/src/diff/pierre-diff.d.ts +14 -0
- package/dist/packages/content/src/index.d.ts +10 -0
- package/dist/packages/content/src/json-viewer.d.ts +11 -0
- package/dist/packages/content/src/link.d.ts +2 -0
- package/dist/packages/content/src/log-viewer.d.ts +9 -0
- package/dist/packages/content/src/markdown.d.ts +7 -0
- package/dist/packages/content/src/pierre-theme.d.ts +36 -0
- package/dist/packages/content/src/stack-trace.d.ts +16 -0
- package/dist/packages/content/src/tree/file-tree-types.d.ts +12 -0
- package/dist/packages/content/src/tree/file-tree.d.ts +3 -0
- package/dist/packages/content/src/tree/index.d.ts +2 -0
- package/dist/packages/content/src/tree/pierre-tree.d.ts +3 -0
- package/dist/packages/core/src/alert-dialog.d.ts +18 -0
- package/dist/packages/core/src/combobox.d.ts +81 -0
- package/dist/{control-state.d.ts → packages/core/src/control-state.d.ts} +18 -2
- package/dist/{copy-value.d.ts → packages/core/src/copy-value.d.ts} +2 -1
- package/dist/packages/core/src/details-controls.d.ts +23 -0
- package/dist/packages/core/src/disclosure.d.ts +33 -0
- package/dist/packages/core/src/field-styles.d.ts +66 -0
- package/dist/packages/core/src/form-controls.d.ts +81 -0
- package/dist/{forms.d.ts → packages/core/src/forms.d.ts} +1 -1
- package/dist/packages/core/src/index.d.ts +32 -0
- package/dist/packages/core/src/menu.d.ts +51 -0
- package/dist/packages/core/src/navigation.d.ts +24 -0
- package/dist/packages/core/src/popover.d.ts +24 -0
- package/dist/packages/core/src/popup-styles.d.ts +84 -0
- package/dist/packages/core/src/preview.d.ts +17 -0
- package/dist/packages/core/src/progress.d.ts +10 -0
- package/dist/packages/core/src/selection-styles.d.ts +110 -0
- package/dist/packages/core/src/selection.d.ts +57 -0
- package/dist/packages/core/src/skeleton.d.ts +18 -0
- package/dist/packages/core/src/theme.d.ts +16 -0
- package/dist/packages/core/src/toast.d.ts +28 -0
- package/dist/{tokens.stylex.d.ts → packages/core/src/tokens.stylex.d.ts} +60 -0
- package/dist/packages/core/src/trace.d.ts +35 -0
- package/dist/{layout → packages/layout/src}/index.d.ts +2 -0
- package/dist/{layout → packages/layout/src}/page-toolbar.d.ts +1 -1
- package/dist/packages/layout/src/resizable.d.ts +27 -0
- package/dist/{layout → packages/layout/src}/sidebar.d.ts +1 -1
- package/dist/pierre-diff-D3m4JCu0.js +66 -0
- package/dist/pierre-theme-CPlfl-AA.js +96 -0
- package/dist/pierre-tree-BaEkz16y.js +105 -0
- package/dist/plot-width--OgdohB5.js +18 -0
- package/dist/src-E7YRJBMO.js +2821 -0
- package/dist/tokens.js +118 -64
- package/package.json +67 -10
- package/{src → packages/core/src}/tokens.stylex.ts +64 -0
- package/dist/charts/index.d.ts +0 -2
- package/dist/index.d.ts +0 -16
- package/dist/src-Czfi0YQa.js +0 -1319
- /package/dist/{charts → packages/charts/src}/waterfall.d.ts +0 -0
- /package/dist/{inspector.d.ts → packages/collections/src/inspector.d.ts} +0 -0
- /package/dist/{list-footer.d.ts → packages/collections/src/list-footer.d.ts} +0 -0
- /package/dist/{table.d.ts → packages/collections/src/table.d.ts} +0 -0
- /package/dist/{accessibility.d.ts → packages/core/src/accessibility.d.ts} +0 -0
- /package/dist/{actions.d.ts → packages/core/src/actions.d.ts} +0 -0
- /package/dist/{dialog.d.ts → packages/core/src/dialog.d.ts} +0 -0
- /package/dist/{drawer.d.ts → packages/core/src/drawer.d.ts} +0 -0
- /package/dist/{loading.d.ts → packages/core/src/loading.d.ts} +0 -0
- /package/dist/{metrics.d.ts → packages/core/src/metrics.d.ts} +0 -0
- /package/dist/{overlay-styles.d.ts → packages/core/src/overlay-styles.d.ts} +0 -0
- /package/dist/{select.d.ts → packages/core/src/select.d.ts} +0 -0
- /package/dist/{skip-link.d.ts → packages/core/src/skip-link.d.ts} +0 -0
- /package/dist/{style-composition.d.ts → packages/core/src/style-composition.d.ts} +0 -0
- /package/dist/{surfaces.d.ts → packages/core/src/surfaces.d.ts} +0 -0
- /package/dist/{tabs.d.ts → packages/core/src/tabs.d.ts} +0 -0
- /package/dist/{text.d.ts → packages/core/src/text.d.ts} +0 -0
- /package/dist/{tooltip.d.ts → packages/core/src/tooltip.d.ts} +0 -0
- /package/dist/{layout → packages/layout/src}/app-shell.d.ts +0 -0
- /package/dist/{layout → packages/layout/src}/detail-page.d.ts +0 -0
- /package/dist/{layout → packages/layout/src}/frame.stylex.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mechane UI
|
|
2
2
|
|
|
3
|
-
React
|
|
3
|
+
React controls, content viewers, agent interfaces, layouts, and charts with a shared compact design. Mechane's Console
|
|
4
4
|
consumes this same package. Components receive values and callbacks; applications own routing, data, and identity.
|
|
5
5
|
|
|
6
6
|
## Install
|
|
@@ -37,18 +37,39 @@ export function Example() {
|
|
|
37
37
|
The package supplies compiled ESM, TypeScript declarations, and CSS. Ordinary React consumers need no StyleX compiler.
|
|
38
38
|
Applications install their own reset and fonts. Put reset rules in the `reset` CSS layer; the package's `mechane` layer
|
|
39
39
|
comes after it. Application styles and StyleX themes can override the package layer. The default theme is light, with
|
|
40
|
-
system fonts and a compact spacing scale.
|
|
40
|
+
system fonts and a compact spacing scale. Apply `themeProps.light` or `themeProps.dark` from the root entry to the
|
|
41
|
+
document root to choose a theme for both content and portaled controls. Applications own the preference.
|
|
41
42
|
|
|
42
43
|
## Entry points
|
|
43
44
|
|
|
44
|
-
| Import
|
|
45
|
-
|
|
|
46
|
-
| `@mechane-ai/ui`
|
|
47
|
-
| `@mechane-ai/ui/layout`
|
|
48
|
-
| `@mechane-ai/ui/
|
|
49
|
-
| `@mechane-ai/ui/
|
|
50
|
-
| `@mechane-ai/ui/
|
|
51
|
-
| `@mechane-ai/ui/
|
|
45
|
+
| Import | Responsibility |
|
|
46
|
+
| ------------------------------------ | -------------------------------------------------------------------- |
|
|
47
|
+
| `@mechane-ai/ui` | Controls, forms, text, feedback, generic Trace, and theme props. |
|
|
48
|
+
| `@mechane-ai/ui/layout` | Application shell, navigation, toolbars, details, and split panes. |
|
|
49
|
+
| `@mechane-ai/ui/collections` | Tables, inspectors, collection controls, dates, and scoped commands. |
|
|
50
|
+
| `@mechane-ai/ui/content` | Markdown, JSON, recorded logs, and stack traces. |
|
|
51
|
+
| `@mechane-ai/ui/content/link` | Safe content links without loading the Markdown renderer. |
|
|
52
|
+
| `@mechane-ai/ui/content/code` | CodeBlock with source-preserving highlighting. |
|
|
53
|
+
| `@mechane-ai/ui/content/diff` | DiffViewer for file changes and patches. |
|
|
54
|
+
| `@mechane-ai/ui/content/tree` | FileTree for paths, status, and controlled selection. |
|
|
55
|
+
| `@mechane-ai/ui/ai` | Conversations, messages, prompts, approvals, sources, and citations. |
|
|
56
|
+
| `@mechane-ai/ui/charts` | Shared chart parts and all chart families, including Waterfall. |
|
|
57
|
+
| `@mechane-ai/ui/charts/cartesian` | Time series, categorical bars, breakdowns, and treemaps. |
|
|
58
|
+
| `@mechane-ai/ui/charts/distribution` | Histograms, cumulative distributions, intervals, and ranked values. |
|
|
59
|
+
| `@mechane-ai/ui/charts/matrix` | Matrices, exact token highlights, and scatter plots. |
|
|
60
|
+
| `@mechane-ai/ui/charts/graph` | Read-only supplied relationships and node selection. |
|
|
61
|
+
| `@mechane-ai/ui/tokens` | Compiled token references for runtime styles. |
|
|
62
|
+
| `@mechane-ai/ui/tokens.stylex` | Direct definitions for StyleX authoring and themes. |
|
|
63
|
+
| `@mechane-ai/ui/styles.css` | Component styles and token defaults. |
|
|
64
|
+
|
|
65
|
+
These are modules of one package, with one version and stylesheet. Focused imports keep heavier families out of the core
|
|
66
|
+
entry. Content renderers initialize when used; applications do not configure a renderer worker pool or fetch syntax
|
|
67
|
+
grammars from a CDN. See the
|
|
68
|
+
[content guide](https://github.com/mechane-ai/mechane/blob/main/workspaces/core/docs/ui-content.md) for renderer assets
|
|
69
|
+
and fallback behavior.
|
|
70
|
+
|
|
71
|
+
When upgrading from 0.2, move `Table`, `Cell`, `Details`, `Inspector`, and `ListFooter` imports to `/collections`. The
|
|
72
|
+
layout, Waterfall, and token entry points retain their existing paths.
|
|
52
73
|
|
|
53
74
|
Use `render` for Base UI composition and named variants for appearance. Native attributes, events, and refs remain
|
|
54
75
|
available. Typed `xstyle` inputs allow placement styles compiled by the consuming application's StyleX setup.
|
|
@@ -66,9 +87,9 @@ source exports let Mechane and Storybook compile the canonical components with t
|
|
|
66
87
|
publication selects the compiled exports declared in `publishConfig`.
|
|
67
88
|
|
|
68
89
|
Run `pnpm --filter @mechane/console storybook` for the component catalog. The
|
|
69
|
-
[component guide](https://github.com/mechane-ai/mechane/blob/main/workspaces/core/docs/components.md) explains
|
|
70
|
-
composition, supported states, and browser review. Stories use synthetic inputs. The repository's existing
|
|
71
|
-
source and package boundaries; installation releases and UI releases have independent versions.
|
|
90
|
+
[component guide](https://github.com/mechane-ai/mechane/blob/main/workspaces/core/docs/components.md) explains family
|
|
91
|
+
selection, composition, supported states, and browser review. Stories use synthetic inputs. The repository's existing
|
|
92
|
+
checks cover source and package boundaries; installation releases and UI releases have independent versions.
|
|
72
93
|
|
|
73
94
|
The public repository publishes npm packages when an immutable `ui-vVERSION` GitHub release is published. The release
|
|
74
95
|
workflow rebuilds the reviewed archive and checks its digest before publishing with npm trusted publishing and
|
package/dist/ai.js
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { H as e, V as t, X as n, Y as r, it as i, m as a, ot as o, q as s } from "./src-E7YRJBMO.js";
|
|
2
|
+
import { t as c } from "./content-link-52aZVX3X.js";
|
|
3
|
+
import * as l from "@stylexjs/stylex";
|
|
4
|
+
import { createContext as u, useContext as d, useId as f, useRef as p } from "react";
|
|
5
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
6
|
+
import { ArrowDown as g, ArrowUp as _, ExternalLink as v, File as y, Square as b } from "lucide-react";
|
|
7
|
+
import { MessageScroller as x, useMessageScroller as S, useMessageScrollerScrollable as C } from "@shadcn/react/message-scroller";
|
|
8
|
+
// packages/ai/src/conversation.tsx
|
|
9
|
+
var w = u(void 0);
|
|
10
|
+
function T({ children: e, initialPosition: t = "end", follow: n = !0 }) {
|
|
11
|
+
let r = p(null);
|
|
12
|
+
return /* @__PURE__ */ m(w.Provider, {
|
|
13
|
+
value: r,
|
|
14
|
+
children: /* @__PURE__ */ m(x.Provider, {
|
|
15
|
+
autoScroll: n,
|
|
16
|
+
defaultScrollPosition: t,
|
|
17
|
+
children: /* @__PURE__ */ m(x.Root, {
|
|
18
|
+
className: "x1n2onr6 x78zum5 xdt5ytf x5yr21d x2lwn1j xeuugli x1l90twa xgl13c xoedhln x118kxxs x1hyyzld",
|
|
19
|
+
children: e
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function E({ label: e, children: t }) {
|
|
25
|
+
let n = d(w);
|
|
26
|
+
return /* @__PURE__ */ m(x.Viewport, {
|
|
27
|
+
ref: n,
|
|
28
|
+
"aria-label": e,
|
|
29
|
+
className: "x98rzlu x2lwn1j xeuugli x1odjw0f x1046ku7 x185mbhu x1fa2hmj xnktsf1 x9v5kkp x1m2ab5f x1bqaal",
|
|
30
|
+
children: t
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function D({ children: e, streaming: t = !1 }) {
|
|
34
|
+
return /* @__PURE__ */ m(x.Content, {
|
|
35
|
+
"aria-live": "polite",
|
|
36
|
+
"aria-relevant": "additions",
|
|
37
|
+
"aria-busy": t,
|
|
38
|
+
className: "x78zum5 xdt5ytf x179h1ev x1h65vws xeuugli",
|
|
39
|
+
children: e
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function O({ messageId: e, children: t }) {
|
|
43
|
+
return /* @__PURE__ */ m(x.Item, {
|
|
44
|
+
messageId: e,
|
|
45
|
+
className: "xeuugli xj0a0fe",
|
|
46
|
+
children: t
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function k({ label: e = "Jump to latest" }) {
|
|
50
|
+
let { scrollToEnd: t } = S(), { end: n } = C(), r = d(w);
|
|
51
|
+
return n ? /* @__PURE__ */ m("div", {
|
|
52
|
+
className: "x10l6tqk xjsifmk x1nrll8i xuuh30",
|
|
53
|
+
children: /* @__PURE__ */ h(i, {
|
|
54
|
+
onClick: () => {
|
|
55
|
+
t({ behavior: "instant" }), r?.current?.focus({ preventScroll: !0 });
|
|
56
|
+
},
|
|
57
|
+
children: [/* @__PURE__ */ m(g, {
|
|
58
|
+
size: 16,
|
|
59
|
+
"aria-hidden": !0
|
|
60
|
+
}), e]
|
|
61
|
+
})
|
|
62
|
+
}) : null;
|
|
63
|
+
}
|
|
64
|
+
var A = {
|
|
65
|
+
Root: T,
|
|
66
|
+
Viewport: E,
|
|
67
|
+
Content: D,
|
|
68
|
+
Item: O,
|
|
69
|
+
JumpToLatest: k
|
|
70
|
+
}, j = {
|
|
71
|
+
root: {
|
|
72
|
+
k1xSpc: "x78zum5",
|
|
73
|
+
kXwgrk: "xdt5ytf",
|
|
74
|
+
kOIVth: "xtmze7h",
|
|
75
|
+
k7Eaqz: "xeuugli",
|
|
76
|
+
kMwMTN: "xgl13c",
|
|
77
|
+
kMv6JI: "xoedhln",
|
|
78
|
+
kGuDYH: "x118kxxs",
|
|
79
|
+
kLWn49: "x1hyyzld",
|
|
80
|
+
$$css: !0
|
|
81
|
+
},
|
|
82
|
+
user: {
|
|
83
|
+
kmVPX3: "x1h65vws",
|
|
84
|
+
kMzoRj: "xmkeg23",
|
|
85
|
+
ksu8eU: "x1y0btm7",
|
|
86
|
+
kVAM5u: "x1yww3zy",
|
|
87
|
+
kaIpWk: "x1fa2hmj",
|
|
88
|
+
kWkggS: "x1m7rfvg",
|
|
89
|
+
$$css: !0
|
|
90
|
+
},
|
|
91
|
+
assistant: { $$css: !0 },
|
|
92
|
+
system: {
|
|
93
|
+
kMwMTN: "xv9cywu",
|
|
94
|
+
k8WAf4: "x4wz14",
|
|
95
|
+
$$css: !0
|
|
96
|
+
}
|
|
97
|
+
}, M = {
|
|
98
|
+
user: j.user,
|
|
99
|
+
assistant: j.assistant,
|
|
100
|
+
system: j.system
|
|
101
|
+
};
|
|
102
|
+
function N({ author: e, children: t, id: n, kind: r = "assistant", meta: i, actions: a, attachments: o }) {
|
|
103
|
+
return /* @__PURE__ */ h("article", {
|
|
104
|
+
id: n,
|
|
105
|
+
"aria-label": e,
|
|
106
|
+
...l.props(j.root, M[r]),
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ h("header", {
|
|
109
|
+
className: "x78zum5 x1pha0wt xf0fr40 x1a02dak xeuugli",
|
|
110
|
+
children: [/* @__PURE__ */ m("span", {
|
|
111
|
+
className: "xk50ysn xj0a0fe",
|
|
112
|
+
children: e
|
|
113
|
+
}), i !== void 0 && /* @__PURE__ */ m("div", {
|
|
114
|
+
className: "xv9cywu xut3y95 xam3yii",
|
|
115
|
+
children: i
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ m("div", {
|
|
119
|
+
className: "xeuugli xj0a0fe",
|
|
120
|
+
children: t
|
|
121
|
+
}),
|
|
122
|
+
o !== void 0 && /* @__PURE__ */ m("div", {
|
|
123
|
+
className: "x78zum5 x1a02dak x1qjc9v5 xf0fr40",
|
|
124
|
+
children: o
|
|
125
|
+
}),
|
|
126
|
+
a !== void 0 && /* @__PURE__ */ m("footer", {
|
|
127
|
+
className: "x78zum5 x1a02dak x6s0dn4 xf0fr40",
|
|
128
|
+
children: a
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function P({ name: e, description: t, href: n, actions: r }) {
|
|
134
|
+
return /* @__PURE__ */ h("div", {
|
|
135
|
+
className: "x78zum5 x6s0dn4 xtmze7h xeuugli x193iq5w x1i1dks5 xmkeg23 x1y0btm7 x1yww3zy x1fa2hmj x1l90twa xoedhln x118kxxs x1hyyzld",
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ m(y, {
|
|
138
|
+
size: 16,
|
|
139
|
+
"aria-hidden": !0,
|
|
140
|
+
className: "xv9cywu x2lah0s"
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ h("div", {
|
|
143
|
+
className: "x78zum5 xdt5ytf x1r8op4a xeuugli xj0a0fe",
|
|
144
|
+
children: [n === void 0 ? /* @__PURE__ */ m("span", { children: e }) : /* @__PURE__ */ m(c, {
|
|
145
|
+
href: n,
|
|
146
|
+
children: e
|
|
147
|
+
}), t !== void 0 && /* @__PURE__ */ m("span", {
|
|
148
|
+
className: "xv9cywu xut3y95 xam3yii",
|
|
149
|
+
children: t
|
|
150
|
+
})]
|
|
151
|
+
}),
|
|
152
|
+
r
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// packages/ai/src/prompt-input.tsx
|
|
157
|
+
function F({ label: e, value: t, onValueChange: n, onSubmit: a, name: o = "prompt", placeholder: c, maxLength: l, required: u = !0, pending: d = !1, disabled: p = !1, submitDisabled: g = !1, submitLabel: v = "Send message", pendingLabel: y = "Sending…", enterBehavior: x = "newline", description: S, error: C, controls: w, attachments: T, onStop: E, stopPending: D = !1, stopLabel: O = "Stop response" }) {
|
|
158
|
+
let k = f(), A = p || d;
|
|
159
|
+
function j(e) {
|
|
160
|
+
if (x !== "submit" || e.key !== "Enter" || e.repeat) return;
|
|
161
|
+
let t = e.altKey || e.ctrlKey || e.metaKey;
|
|
162
|
+
e.shiftKey || t || e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229 || (e.preventDefault(), !A && !g && E === void 0 && e.currentTarget.form?.requestSubmit());
|
|
163
|
+
}
|
|
164
|
+
function M(e) {
|
|
165
|
+
e.preventDefault(), !A && !g && E === void 0 && a(e);
|
|
166
|
+
}
|
|
167
|
+
return /* @__PURE__ */ h("form", {
|
|
168
|
+
onSubmit: M,
|
|
169
|
+
className: "x78zum5 xdt5ytf xtmze7h xeuugli",
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ h(s.Root, {
|
|
172
|
+
invalid: C !== void 0,
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ m(s.Label, { children: e }),
|
|
175
|
+
/* @__PURE__ */ m(r, {
|
|
176
|
+
name: o,
|
|
177
|
+
value: t,
|
|
178
|
+
onChange: (e) => n(e.currentTarget.value),
|
|
179
|
+
onKeyDown: j,
|
|
180
|
+
placeholder: c,
|
|
181
|
+
maxLength: l,
|
|
182
|
+
required: u,
|
|
183
|
+
disabled: p,
|
|
184
|
+
readOnly: d,
|
|
185
|
+
"aria-errormessage": C === void 0 ? void 0 : k
|
|
186
|
+
}),
|
|
187
|
+
S !== void 0 && /* @__PURE__ */ m(s.Description, { children: S }),
|
|
188
|
+
C !== void 0 && /* @__PURE__ */ m(s.Error, {
|
|
189
|
+
id: k,
|
|
190
|
+
match: !0,
|
|
191
|
+
role: "alert",
|
|
192
|
+
children: C
|
|
193
|
+
})
|
|
194
|
+
]
|
|
195
|
+
}),
|
|
196
|
+
T,
|
|
197
|
+
/* @__PURE__ */ h("div", {
|
|
198
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1qughib xtmze7h",
|
|
199
|
+
children: [/* @__PURE__ */ m("div", {
|
|
200
|
+
className: "x78zum5 x1a02dak x6s0dn4 xf0fr40 xeuugli",
|
|
201
|
+
children: w
|
|
202
|
+
}), E === void 0 ? /* @__PURE__ */ h(i, {
|
|
203
|
+
type: "submit",
|
|
204
|
+
variant: "solid",
|
|
205
|
+
disabled: p || g,
|
|
206
|
+
pending: d,
|
|
207
|
+
pendingLabel: y,
|
|
208
|
+
children: [/* @__PURE__ */ m(_, {
|
|
209
|
+
size: 16,
|
|
210
|
+
"aria-hidden": !0
|
|
211
|
+
}), v]
|
|
212
|
+
}) : /* @__PURE__ */ h(i, {
|
|
213
|
+
type: "button",
|
|
214
|
+
onClick: (e) => {
|
|
215
|
+
e.preventDefault(), E();
|
|
216
|
+
},
|
|
217
|
+
disabled: p,
|
|
218
|
+
pending: D,
|
|
219
|
+
pendingLabel: "Stopping…",
|
|
220
|
+
children: [/* @__PURE__ */ m(b, {
|
|
221
|
+
size: 14,
|
|
222
|
+
"aria-hidden": !0
|
|
223
|
+
}), O]
|
|
224
|
+
})]
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// packages/ai/src/approval.tsx
|
|
230
|
+
function I(e) {
|
|
231
|
+
return /* @__PURE__ */ h("section", {
|
|
232
|
+
"aria-label": e.title,
|
|
233
|
+
"data-request-id": e.requestId,
|
|
234
|
+
className: "x78zum5 xdt5ytf xtmze7h xeuugli x1h65vws xmkeg23 x1y0btm7 x1yww3zy x1fa2hmj x1l90twa xgl13c xoedhln x118kxxs x1hyyzld",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ m("h3", {
|
|
237
|
+
className: "x1ghz6dp x118kxxs x1hyyzld xk50ysn xj0a0fe",
|
|
238
|
+
children: e.title
|
|
239
|
+
}),
|
|
240
|
+
e.description !== void 0 && /* @__PURE__ */ m("p", {
|
|
241
|
+
className: "x1ghz6dp xv9cywu xj0a0fe",
|
|
242
|
+
children: e.description
|
|
243
|
+
}),
|
|
244
|
+
e.children,
|
|
245
|
+
e.status === "pending" ? /* @__PURE__ */ h(t, { children: [/* @__PURE__ */ m(i, {
|
|
246
|
+
variant: "solid",
|
|
247
|
+
onClick: e.onApprove,
|
|
248
|
+
disabled: e.disabled === !0 || e.busy !== void 0,
|
|
249
|
+
pending: e.busy === "approve",
|
|
250
|
+
pendingLabel: "Approving…",
|
|
251
|
+
children: e.approveLabel ?? "Approve"
|
|
252
|
+
}), /* @__PURE__ */ m(i, {
|
|
253
|
+
onClick: e.onDeny,
|
|
254
|
+
disabled: e.disabled === !0 || e.busy !== void 0,
|
|
255
|
+
pending: e.busy === "deny",
|
|
256
|
+
pendingLabel: "Denying…",
|
|
257
|
+
children: e.denyLabel ?? "Deny"
|
|
258
|
+
})] }) : /* @__PURE__ */ m(n, { children: e.statusLabel })
|
|
259
|
+
]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
// packages/ai/src/sources.tsx
|
|
263
|
+
function L({ sources: e, label: t = "Sources" }) {
|
|
264
|
+
return /* @__PURE__ */ h("section", {
|
|
265
|
+
"aria-label": t,
|
|
266
|
+
className: "x78zum5 xdt5ytf xf0fr40 xeuugli xoedhln x118kxxs x1hyyzld xgl13c",
|
|
267
|
+
children: [/* @__PURE__ */ m("h3", {
|
|
268
|
+
className: "x1ghz6dp x118kxxs x1hyyzld xk50ysn",
|
|
269
|
+
children: t
|
|
270
|
+
}), /* @__PURE__ */ m("ol", {
|
|
271
|
+
className: "x78zum5 xdt5ytf xtmze7h x1ghz6dp x1717udv x3ct3a4",
|
|
272
|
+
children: e.map((e) => /* @__PURE__ */ h("li", {
|
|
273
|
+
className: "x78zum5 xdt5ytf x1r8op4a xeuugli xj0a0fe",
|
|
274
|
+
children: [/* @__PURE__ */ h("span", {
|
|
275
|
+
className: "x3nfvp2 x1pha0wt xzwl0l2 x1a02dak",
|
|
276
|
+
children: [/* @__PURE__ */ m(c, {
|
|
277
|
+
href: e.href,
|
|
278
|
+
children: e.title
|
|
279
|
+
}), /* @__PURE__ */ m(v, {
|
|
280
|
+
size: 12,
|
|
281
|
+
"aria-hidden": !0,
|
|
282
|
+
className: "x2lah0s xv9cywu"
|
|
283
|
+
})]
|
|
284
|
+
}), e.description !== void 0 && /* @__PURE__ */ m("p", {
|
|
285
|
+
className: "x1ghz6dp xv9cywu xut3y95 xam3yii xj0a0fe",
|
|
286
|
+
children: e.description
|
|
287
|
+
})]
|
|
288
|
+
}, e.id))
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function R({ source: t, label: n }) {
|
|
293
|
+
return /* @__PURE__ */ m("span", {
|
|
294
|
+
className: "xt0psk2 x11njtxf xss6m8b",
|
|
295
|
+
children: /* @__PURE__ */ h(a.Root, { children: [/* @__PURE__ */ m(a.Trigger, {
|
|
296
|
+
render: /* @__PURE__ */ m(o, {}),
|
|
297
|
+
"aria-label": `Source ${n}: ${t.title}`,
|
|
298
|
+
children: n
|
|
299
|
+
}), /* @__PURE__ */ m(a.Portal, { children: /* @__PURE__ */ m(a.Positioner, {
|
|
300
|
+
side: "top",
|
|
301
|
+
children: /* @__PURE__ */ m(a.Popup, { children: /* @__PURE__ */ h(e, {
|
|
302
|
+
compact: !0,
|
|
303
|
+
children: [
|
|
304
|
+
/* @__PURE__ */ m(a.Title, { children: t.title }),
|
|
305
|
+
t.description !== void 0 && /* @__PURE__ */ m(a.Description, { children: t.description }),
|
|
306
|
+
/* @__PURE__ */ m(c, {
|
|
307
|
+
href: t.href,
|
|
308
|
+
children: "Open source"
|
|
309
|
+
})
|
|
310
|
+
]
|
|
311
|
+
}) })
|
|
312
|
+
}) })] })
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
export { I as Approval, A as Conversation, R as InlineCitation, N as Message, P as MessageAttachment, F as PromptInput, L as Sources };
|