@mechane-ai/elements 0.12.0 → 0.14.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 +50 -11
- package/dist/ai.js +175 -148
- package/dist/{categorical-values-CTrHn9jH.js → categorical-values-BnWfIPlv.js} +3 -3
- package/dist/{chart-frame-38ES6kwK.js → chart-frame-Dm8UNfYD.js} +6 -6
- package/dist/{chart-input-C9fu7f1Q.js → chart-input-ceiMZYI-.js} +3 -3
- package/dist/charts/cartesian.js +16 -16
- package/dist/charts/distribution.js +6 -6
- package/dist/charts/graph.js +5 -5
- package/dist/charts/hierarchy.js +3 -3
- package/dist/charts/matrix.js +13 -13
- package/dist/charts/timeline.js +30 -30
- package/dist/charts.js +1 -1
- package/dist/{code-block-BjV2EFZS.js → code-block-D07N6mYS.js} +4 -4
- package/dist/collections.js +414 -395
- package/dist/constants.stylex-bbdiv1fD.js +83 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +5 -5
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +4 -4
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-C460m-O7.js → content-link-CEx2s1MU.js} +1 -1
- package/dist/content.js +5 -5
- package/dist/elements.css +71 -120
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +21 -21
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/layout.js +22 -22
- package/dist/navigation/commands.js +6 -6
- package/dist/navigation.js +30 -16
- package/dist/overlays.js +1 -1
- package/dist/packages/ai/src/approval.d.ts +1 -1
- package/dist/packages/ai/src/conversation.d.ts +4 -4
- package/dist/packages/ai/src/index.d.ts +2 -2
- package/dist/packages/ai/src/prompt-input.d.ts +9 -5
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +1 -1
- package/dist/packages/charts/src/cartesian/time-series.d.ts +2 -2
- package/dist/packages/charts/src/chart-frame.d.ts +2 -2
- package/dist/packages/collections/src/collection-controls.d.ts +8 -7
- package/dist/packages/collections/src/collection-scroll.d.ts +2 -2
- package/dist/packages/collections/src/data-table.d.ts +23 -6
- package/dist/packages/collections/src/index.d.ts +4 -5
- package/dist/packages/content/src/code/code-block.d.ts +4 -4
- package/dist/packages/content/src/diff/diff-source.d.ts +1 -1
- package/dist/packages/content/src/diff/pierre-diff.d.ts +2 -2
- package/dist/packages/content/src/markdown/markdown.d.ts +2 -2
- package/dist/packages/content/src/trace.d.ts +3 -3
- package/dist/packages/core/src/actions.d.ts +2 -2
- package/dist/packages/core/src/surfaces.d.ts +6 -6
- package/dist/packages/core/src/text.d.ts +2 -2
- package/dist/packages/feedback/src/async-region.d.ts +18 -10
- package/dist/packages/feedback/src/control-placeholders.d.ts +10 -5
- package/dist/packages/feedback/src/feedback.d.ts +2 -2
- package/dist/packages/feedback/src/index.d.ts +2 -3
- package/dist/packages/forms/src/form-actions.d.ts +2 -2
- package/dist/packages/forms/src/forms.d.ts +2 -2
- package/dist/packages/forms/src/selection-styles.d.ts +1 -1
- package/dist/packages/foundations/src/constants.stylex.d.ts +90 -0
- package/dist/packages/foundations/src/control-styles.d.ts +21 -0
- package/dist/packages/foundations/src/tokens.d.ts +2 -0
- package/dist/packages/foundations/src/tokens.stylex.d.ts +0 -85
- package/dist/packages/layout/src/app-shell.d.ts +2 -2
- package/dist/packages/layout/src/page-toolbar.d.ts +3 -3
- package/dist/packages/layout/src/record-page.d.ts +2 -2
- package/dist/packages/layout/src/resizable.d.ts +2 -2
- package/dist/packages/layout/src/sidebar.d.ts +6 -6
- package/dist/packages/layout/src/view-stack.d.ts +2 -2
- package/dist/packages/layout/src/workbench.d.ts +2 -2
- package/dist/packages/navigation/src/commands/command.d.ts +3 -3
- package/dist/packages/navigation/src/index.d.ts +2 -2
- package/dist/packages/navigation/src/page-navigation.d.ts +7 -2
- package/dist/packages/overlays/src/drawer.d.ts +2 -2
- package/dist/{pierre-diff-sUAU-xeL.js → pierre-diff-C_j0nxwS.js} +2 -2
- package/dist/pierre-theme-BUeJim8s.js +127 -0
- package/dist/{pierre-tree-DKN2eGlZ.js → pierre-tree-CBBDlJ_Y.js} +4 -4
- package/dist/{src-DOzle5d4.js → src-BkXlN6aZ.js} +180 -195
- package/dist/{src-CI6KtN2w.js → src-C9GQP3px.js} +353 -377
- package/dist/{src-3gzujMhN.js → src-CyJd2qSZ.js} +47 -33
- package/dist/{src-CVlgjAlw.js → src-d7EAi61b.js} +9 -9
- package/dist/theme.js +1 -1
- package/dist/tokens.js +3 -203
- package/dist/tokens.stylex-DTHHFbyl.js +128 -0
- package/package.json +4 -2
- package/packages/foundations/src/constants.stylex.ts +91 -0
- package/packages/foundations/src/tokens.stylex.ts +0 -88
- package/dist/packages/collections/src/table.d.ts +0 -17
- package/dist/packages/feedback/src/loading.d.ts +0 -7
- package/dist/pierre-theme-CBAncKdH.js +0 -126
package/README.md
CHANGED
|
@@ -77,7 +77,8 @@ Every path below belongs to `@mechane-ai/elements`. There is one package, versio
|
|
|
77
77
|
| `/theme` | Light and dark theme props. |
|
|
78
78
|
| `/csp` | Application-supplied content security policy configuration. |
|
|
79
79
|
| `/tokens` | Compiled token references for runtime styles. |
|
|
80
|
-
| `/tokens.stylex` |
|
|
80
|
+
| `/tokens.stylex` | Variable definitions for StyleX authoring and themes. |
|
|
81
|
+
| `/constants.stylex` | Compile-time conditions, palette values, layers, and shared geometry. |
|
|
81
82
|
| `/styles.css` | Component styles and token defaults. |
|
|
82
83
|
|
|
83
84
|
Focused entries keep renderer and chart dependencies out of basic controls. There is no all-components barrel. Renderers
|
|
@@ -98,10 +99,10 @@ Detail titles wrap; list metadata truncates. Sidebar items share contiguous hit
|
|
|
98
99
|
navigation and reserve the divided sidebar footer for persistent account controls. Use
|
|
99
100
|
`SidebarFooter layout="navigation"` for a group of commands; its intrinsic height keeps the scrolling navigation clear.
|
|
100
101
|
|
|
101
|
-
`AppShell
|
|
102
|
-
content mounted and measurable but removes it from keyboard and assistive-technology navigation. The
|
|
103
|
-
which view is active and when to unmount it; use this for a draft or reading position that must survive
|
|
104
|
-
`WorkbenchScroll` requires an accessible `label`; its `
|
|
102
|
+
`AppShell shouldFocus` temporarily hides navigation while retaining its expansion state. `ViewStack.Panel` keeps
|
|
103
|
+
inactive content mounted and measurable but removes it from keyboard and assistive-technology navigation. The
|
|
104
|
+
application owns which view is active and when to unmount it; use this for a draft or reading position that must survive
|
|
105
|
+
inspection. `WorkbenchScroll` requires an accessible `label`; its `isFlush` mode leaves list insets to the table. Its
|
|
105
106
|
`scrollRestorationId` identifies the actual scroll region for application-owned restoration.
|
|
106
107
|
|
|
107
108
|
Each `DataTable` column declares a role: `primary`, `text`, `status`, `number`, `timestamp`, or `actions`. Roles own
|
|
@@ -136,13 +137,35 @@ The default theme is light, with system fonts and a compact spacing scale. Impor
|
|
|
136
137
|
`@mechane-ai/elements/theme` and spread `themeProps.light` or `themeProps.dark` onto the document root. Portaled content
|
|
137
138
|
then inherits the same theme. The application owns the preference; no theme provider is required.
|
|
138
139
|
|
|
139
|
-
For custom StyleX themes, import
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
For custom StyleX styles and themes, import variables from `@mechane-ai/elements/tokens.stylex` and compile-time
|
|
141
|
+
constants from `@mechane-ai/elements/constants.stylex`. The archive preserves both defining paths. Variables retain the
|
|
142
|
+
same names as the packaged CSS; constants need their source compiled with the consuming styles. The ordinary `/tokens`
|
|
143
|
+
entry supplies runtime references and values for both groups.
|
|
144
|
+
|
|
145
|
+
With Vite and StyleX 0.19.1, configure the consumer as follows:
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import stylex from '@stylexjs/unplugin/vite';
|
|
149
|
+
import { defineConfig } from 'vite';
|
|
150
|
+
|
|
151
|
+
export default defineConfig({
|
|
152
|
+
plugins: [
|
|
153
|
+
stylex({
|
|
154
|
+
useCSSLayers: true,
|
|
155
|
+
debug: false,
|
|
156
|
+
runtimeInjection: false,
|
|
157
|
+
unstable_moduleResolution: { type: 'commonJS' },
|
|
158
|
+
externalPackages: ['@mechane-ai/elements'],
|
|
159
|
+
}),
|
|
160
|
+
],
|
|
161
|
+
resolve: { alias: [{ find: /^@mechane-ai\/elements\/tokens\.stylex$/, replacement: '@mechane-ai/elements/tokens' }] },
|
|
162
|
+
});
|
|
163
|
+
```
|
|
143
164
|
|
|
144
|
-
|
|
145
|
-
|
|
165
|
+
The bundler alias uses compiled variable references without re-emitting defaults over the selected theme. StyleX still
|
|
166
|
+
resolves the original defining path during compilation. Keep `/constants.stylex` direct so its metadata reaches the
|
|
167
|
+
compiler. Consumer styles can then use `[conditions.coarsePointer]` from that entry, and
|
|
168
|
+
`stylex.createTheme(colors, ...)` with `colors` from `/tokens.stylex`.
|
|
146
169
|
|
|
147
170
|
When an application's Content Security Policy requires nonces, wrap its component tree in `CSPProvider` from
|
|
148
171
|
`@mechane-ai/elements/csp` and pass the same request nonce used in its policy. Preserve that nonce during hydration.
|
|
@@ -154,6 +177,22 @@ structural styles in the published stylesheet, so the production package injects
|
|
|
154
177
|
initial-read failures and field validation local; retained-content refresh failures can use one notification with Retry.
|
|
155
178
|
The application owns stable notification IDs and dismissal on recovery or navigation.
|
|
156
179
|
|
|
180
|
+
## Loading content
|
|
181
|
+
|
|
182
|
+
Use `AsyncRegion` from `/feedback` with an explicit `pending`, `ready`, or `failed` state and a destination-specific
|
|
183
|
+
`placeholder`. Pending reserves that geometry immediately and reveals it after two seconds. Ready content enters in
|
|
184
|
+
80ms; ready-at-mount and failed content appear immediately. Reduced motion removes the fades. There is no minimum
|
|
185
|
+
loading duration, and ordinary callers do not configure timing.
|
|
186
|
+
|
|
187
|
+
Wrap a page in `LoadingScope` and pass its navigation `identity` to share one clock across dependent reads. Updating the
|
|
188
|
+
identity resets pending presentation without remounting ready children. Use `initialStartedAt` only to preserve elapsed
|
|
189
|
+
document loading time at hydration; later identities start their own clock. Keep refreshes in the ready state and retain
|
|
190
|
+
their content, focus, and drafts; display progress or failure alongside the last result.
|
|
191
|
+
|
|
192
|
+
Build placeholders from the same layouts as their destinations. `DataTablePlaceholder` accepts the real table's
|
|
193
|
+
`DataTableColumnLayout` definitions and optional decorative cells. The async region owns the loading announcement; its
|
|
194
|
+
placeholders must not contain interactive controls, invented records, or independent status announcements.
|
|
195
|
+
|
|
157
196
|
## Develop and release
|
|
158
197
|
|
|
159
198
|
From `workspaces/core`:
|
package/dist/ai.js
CHANGED
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import { C as e, E as t,
|
|
2
|
-
import { t as
|
|
3
|
-
import { r as
|
|
4
|
-
import { c as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { C as e, E as t, O as n, T as r, f as i, g as a, p as o, t as s, w as c } from "./src-CyJd2qSZ.js";
|
|
2
|
+
import { t as l } from "./content-link-CEx2s1MU.js";
|
|
3
|
+
import { r as u, t as d } from "./src-d7EAi61b.js";
|
|
4
|
+
import { c as f, d as p } from "./src-C9GQP3px.js";
|
|
5
|
+
import { c as m, u as h } from "./src-BkXlN6aZ.js";
|
|
6
|
+
import { t as g } from "./accessibility-C-aIZ1Yx.js";
|
|
7
|
+
import * as _ from "@stylexjs/stylex";
|
|
8
|
+
import { createContext as v, useContext as y, useId as b, useRef as x } from "react";
|
|
9
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
10
|
+
import { ArrowDown as w, ArrowUp as T, File as E, GitBranch as D, Square as O } from "lucide-react";
|
|
11
|
+
import { MessageScroller as k, useMessageScroller as A, useMessageScrollerScrollable as j } from "@shadcn/react/message-scroller";
|
|
11
12
|
// packages/ai/src/approval.tsx
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */
|
|
13
|
+
function M(t) {
|
|
14
|
+
return /* @__PURE__ */ C("section", {
|
|
14
15
|
"aria-label": t.title,
|
|
15
16
|
"data-request-id": t.requestId,
|
|
16
17
|
className: "x78zum5 xdt5ytf x1n8ia3y xeuugli x1c8xbx5 xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
17
18
|
children: [
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ S("h3", {
|
|
19
20
|
className: "x1ghz6dp xtqrqnz x1778rvt xk4h15q xj0a0fe",
|
|
20
21
|
children: t.title
|
|
21
22
|
}),
|
|
22
|
-
t.description !== void 0 && /* @__PURE__ */
|
|
23
|
+
t.description !== void 0 && /* @__PURE__ */ S("p", {
|
|
23
24
|
className: "x1ghz6dp x153jb6y xj0a0fe",
|
|
24
25
|
children: t.description
|
|
25
26
|
}),
|
|
26
27
|
t.children,
|
|
27
|
-
t.status === "pending" ? /* @__PURE__ */
|
|
28
|
+
t.status === "pending" ? /* @__PURE__ */ C(i, { children: [/* @__PURE__ */ S(e, {
|
|
28
29
|
variant: "solid",
|
|
29
30
|
onClick: t.onApprove,
|
|
30
|
-
disabled: t.
|
|
31
|
-
|
|
31
|
+
disabled: t.isDisabled === !0 || t.busy !== void 0,
|
|
32
|
+
isPending: t.busy === "approve",
|
|
32
33
|
pendingLabel: "Approving…",
|
|
33
34
|
children: t.approveLabel ?? "Approve"
|
|
34
|
-
}), /* @__PURE__ */
|
|
35
|
+
}), /* @__PURE__ */ S(e, {
|
|
35
36
|
onClick: t.onDeny,
|
|
36
|
-
disabled: t.
|
|
37
|
-
|
|
37
|
+
disabled: t.isDisabled === !0 || t.busy !== void 0,
|
|
38
|
+
isPending: t.busy === "deny",
|
|
38
39
|
pendingLabel: "Denying…",
|
|
39
40
|
children: t.denyLabel ?? "Deny"
|
|
40
|
-
})] }) : /* @__PURE__ */
|
|
41
|
+
})] }) : /* @__PURE__ */ S(s, { children: t.statusLabel })
|
|
41
42
|
]
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
// packages/ai/src/conversation.tsx
|
|
45
|
-
var
|
|
46
|
-
function
|
|
47
|
-
let i =
|
|
48
|
-
return /* @__PURE__ */
|
|
46
|
+
var N = v(void 0);
|
|
47
|
+
function P({ children: e, initialPosition: t = "end", shouldFollow: n = !0, viewportRef: r }) {
|
|
48
|
+
let i = x(null), a = r ?? i;
|
|
49
|
+
return /* @__PURE__ */ S(N.Provider, {
|
|
49
50
|
value: a,
|
|
50
|
-
children: /* @__PURE__ */
|
|
51
|
+
children: /* @__PURE__ */ S(k.Provider, {
|
|
51
52
|
autoScroll: n,
|
|
52
53
|
defaultScrollPosition: t,
|
|
53
|
-
children: /* @__PURE__ */
|
|
54
|
+
children: /* @__PURE__ */ S(k.Root, {
|
|
54
55
|
className: "x1n2onr6 x78zum5 xdt5ytf x5yr21d x2lwn1j xeuugli xpvm0e4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
55
56
|
children: e
|
|
56
57
|
})
|
|
57
58
|
})
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
let r =
|
|
62
|
-
return /* @__PURE__ */
|
|
61
|
+
function F({ label: e, children: t, scrollRestorationId: n }) {
|
|
62
|
+
let r = y(N);
|
|
63
|
+
return /* @__PURE__ */ S(k.Viewport, {
|
|
63
64
|
ref: r,
|
|
64
65
|
"aria-label": e,
|
|
65
66
|
"data-scroll-restoration-id": n,
|
|
@@ -67,8 +68,8 @@ function M({ label: e, children: t, scrollRestorationId: n }) {
|
|
|
67
68
|
children: t
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
-
return /* @__PURE__ */
|
|
71
|
+
function I({ children: e, isStreaming: t = !1 }) {
|
|
72
|
+
return /* @__PURE__ */ S(k.Content, {
|
|
72
73
|
"aria-live": "polite",
|
|
73
74
|
"aria-relevant": "additions",
|
|
74
75
|
"aria-busy": t,
|
|
@@ -76,50 +77,50 @@ function N({ children: e, streaming: t = !1 }) {
|
|
|
76
77
|
children: e
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
return /* @__PURE__ */
|
|
80
|
+
function L({ messageId: e, children: t }) {
|
|
81
|
+
return /* @__PURE__ */ S(k.Item, {
|
|
81
82
|
messageId: e,
|
|
82
83
|
className: "xeuugli xj0a0fe",
|
|
83
84
|
children: t
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
return /* @__PURE__ */
|
|
87
|
+
function R({ children: e }) {
|
|
88
|
+
return /* @__PURE__ */ S("div", {
|
|
88
89
|
className: "x9f619 x2lah0s xeuugli xh8yej3 xe10afn xvueqy4 xn9t2bk x1m92p3w",
|
|
89
90
|
children: e
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
let { end: t } =
|
|
94
|
-
return t ? /* @__PURE__ */
|
|
93
|
+
function z({ label: e = "Jump to latest" }) {
|
|
94
|
+
let { end: t } = j();
|
|
95
|
+
return t ? /* @__PURE__ */ S("div", {
|
|
95
96
|
className: "x10l6tqk xwthv0x x1nrll8i xuuh30 x1tv4vx4 xeuugli",
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
+
children: /* @__PURE__ */ S(B, { label: e })
|
|
97
98
|
}) : null;
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
-
let { scrollToEnd: r } =
|
|
101
|
-
return /* @__PURE__ */
|
|
100
|
+
function B({ label: t, onActivate: n }) {
|
|
101
|
+
let { scrollToEnd: r } = A(), i = y(N);
|
|
102
|
+
return /* @__PURE__ */ C(e, {
|
|
102
103
|
onClick: () => {
|
|
103
104
|
n?.(), requestAnimationFrame(() => {
|
|
104
105
|
let e = i?.current;
|
|
105
106
|
e != null && (r({ behavior: "instant" }), e.focus({ preventScroll: !0 }));
|
|
106
107
|
});
|
|
107
108
|
},
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
+
children: [/* @__PURE__ */ S(w, {
|
|
109
110
|
size: 14,
|
|
110
111
|
"aria-hidden": !0
|
|
111
112
|
}), t]
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
var
|
|
115
|
-
Root:
|
|
116
|
-
Viewport:
|
|
117
|
-
Content:
|
|
118
|
-
Item:
|
|
119
|
-
Controls:
|
|
120
|
-
LatestButton:
|
|
121
|
-
JumpToLatest:
|
|
122
|
-
},
|
|
115
|
+
var V = {
|
|
116
|
+
Root: P,
|
|
117
|
+
Viewport: F,
|
|
118
|
+
Content: I,
|
|
119
|
+
Item: L,
|
|
120
|
+
Controls: R,
|
|
121
|
+
LatestButton: B,
|
|
122
|
+
JumpToLatest: z
|
|
123
|
+
}, H = {
|
|
123
124
|
root: {
|
|
124
125
|
k1xSpc: "x78zum5",
|
|
125
126
|
kXwgrk: "xdt5ytf",
|
|
@@ -145,72 +146,72 @@ var R = {
|
|
|
145
146
|
k8WAf4: "xn9t2bk",
|
|
146
147
|
$$css: !0
|
|
147
148
|
}
|
|
148
|
-
},
|
|
149
|
-
user:
|
|
150
|
-
assistant:
|
|
151
|
-
system:
|
|
152
|
-
},
|
|
149
|
+
}, U = {
|
|
150
|
+
user: H.user,
|
|
151
|
+
assistant: H.assistant,
|
|
152
|
+
system: H.system
|
|
153
|
+
}, W = {
|
|
153
154
|
"x-default-marker": "x-default-marker",
|
|
154
155
|
$$css: !0
|
|
155
156
|
};
|
|
156
|
-
function
|
|
157
|
-
return /* @__PURE__ */
|
|
157
|
+
function G({ author: e, children: t, id: n, kind: r = "assistant", meta: i, avatar: a, actions: o, attachments: s }) {
|
|
158
|
+
return /* @__PURE__ */ C("article", {
|
|
158
159
|
id: n,
|
|
159
160
|
"aria-label": e,
|
|
160
|
-
...
|
|
161
|
+
..._.props(H.root, U[r], W),
|
|
161
162
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ C("header", {
|
|
163
164
|
className: "x78zum5 x6s0dn4 x1hnptsi x1a02dak xeuugli",
|
|
164
165
|
children: [
|
|
165
|
-
a !== void 0 && /* @__PURE__ */
|
|
166
|
+
a !== void 0 && /* @__PURE__ */ S("span", {
|
|
166
167
|
className: "x3nfvp2 x2lah0s",
|
|
167
168
|
children: a
|
|
168
169
|
}),
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ S("span", {
|
|
170
171
|
className: "xk4h15q xeuugli xj0a0fe",
|
|
171
172
|
children: e
|
|
172
173
|
}),
|
|
173
|
-
i !== void 0 && /* @__PURE__ */
|
|
174
|
+
i !== void 0 && /* @__PURE__ */ S("div", {
|
|
174
175
|
className: "x153jb6y xy8obcc xas2l8k xeuugli xj0a0fe",
|
|
175
176
|
children: i
|
|
176
177
|
})
|
|
177
178
|
]
|
|
178
179
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ S("div", {
|
|
180
181
|
className: "xeuugli xj0a0fe x1ytb0s6",
|
|
181
182
|
children: t
|
|
182
183
|
}),
|
|
183
|
-
s !== void 0 && /* @__PURE__ */
|
|
184
|
+
s !== void 0 && /* @__PURE__ */ S("div", {
|
|
184
185
|
className: "x78zum5 x1a02dak x1qjc9v5 x1hnptsi xeuugli",
|
|
185
186
|
children: s
|
|
186
187
|
}),
|
|
187
|
-
o !== void 0 && /* @__PURE__ */
|
|
188
|
-
className: "x78zum5 x1a02dak x6s0dn4 xeuugli xunmzkg x1hc1fzr
|
|
188
|
+
o !== void 0 && /* @__PURE__ */ S("footer", {
|
|
189
|
+
className: "x78zum5 x1a02dak x6s0dn4 xeuugli xunmzkg x1hc1fzr x12vu8c0 xtf8l8m x1thm12b",
|
|
189
190
|
children: o
|
|
190
191
|
})
|
|
191
192
|
]
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
-
return /* @__PURE__ */
|
|
195
|
+
function K({ name: e, description: t, href: n, actions: r }) {
|
|
196
|
+
return /* @__PURE__ */ C("div", {
|
|
196
197
|
className: "x78zum5 x1a02dak x6s0dn4 x1n8ia3y xeuugli x193iq5w x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xpvm0e4 x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
197
198
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ S(E, {
|
|
199
200
|
size: 16,
|
|
200
201
|
"aria-hidden": !0,
|
|
201
202
|
className: "x153jb6y x2lah0s"
|
|
202
203
|
}),
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ C("div", {
|
|
204
205
|
className: "x78zum5 xdt5ytf xfko13i x1slnebi xeuugli xj0a0fe",
|
|
205
|
-
children: [n === void 0 ? /* @__PURE__ */
|
|
206
|
+
children: [n === void 0 ? /* @__PURE__ */ S("span", { children: e }) : /* @__PURE__ */ S(l, {
|
|
206
207
|
href: n,
|
|
207
208
|
children: e
|
|
208
|
-
}), t !== void 0 && /* @__PURE__ */
|
|
209
|
+
}), t !== void 0 && /* @__PURE__ */ S("span", {
|
|
209
210
|
className: "x153jb6y xy8obcc xas2l8k xeuugli xj0a0fe",
|
|
210
211
|
children: t
|
|
211
212
|
})]
|
|
212
213
|
}),
|
|
213
|
-
r !== void 0 && /* @__PURE__ */
|
|
214
|
+
r !== void 0 && /* @__PURE__ */ S("div", {
|
|
214
215
|
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli",
|
|
215
216
|
children: r
|
|
216
217
|
})
|
|
@@ -218,158 +219,184 @@ function U({ name: e, description: t, href: n, actions: r }) {
|
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
221
|
// packages/ai/src/message-action.tsx
|
|
221
|
-
function
|
|
222
|
+
function q(e) {
|
|
222
223
|
if (e.kind === "link") {
|
|
223
|
-
let { kind: t, label:
|
|
224
|
-
return /* @__PURE__ */
|
|
224
|
+
let { kind: t, label: n, ...i } = e;
|
|
225
|
+
return /* @__PURE__ */ S(r, {
|
|
225
226
|
...i,
|
|
226
|
-
"aria-label":
|
|
227
|
+
"aria-label": n
|
|
227
228
|
});
|
|
228
229
|
}
|
|
229
|
-
let { kind: t, label:
|
|
230
|
-
return /* @__PURE__ */
|
|
230
|
+
let { kind: t, label: n, ...i } = e;
|
|
231
|
+
return /* @__PURE__ */ S(c, {
|
|
231
232
|
...i,
|
|
232
233
|
variant: "ghost",
|
|
233
|
-
"aria-label":
|
|
234
|
+
"aria-label": n
|
|
234
235
|
});
|
|
235
236
|
}
|
|
236
|
-
function
|
|
237
|
-
return /* @__PURE__ */
|
|
237
|
+
function J(e) {
|
|
238
|
+
return /* @__PURE__ */ C(d.Root, { children: [/* @__PURE__ */ S(d.Trigger, { render: q(e) }), /* @__PURE__ */ S(d.Portal, { children: /* @__PURE__ */ S(d.Positioner, { children: /* @__PURE__ */ S(d.Popup, { children: e.label }) }) })] });
|
|
238
239
|
}
|
|
239
240
|
// packages/ai/src/message-boundary.tsx
|
|
240
|
-
function
|
|
241
|
-
return /* @__PURE__ */
|
|
241
|
+
function Y({ label: e, children: t }) {
|
|
242
|
+
return /* @__PURE__ */ C(a.Root, {
|
|
242
243
|
className: "xeuugli x1kbiq1m xykt701 xpu655y",
|
|
243
|
-
children: [/* @__PURE__ */
|
|
244
|
+
children: [/* @__PURE__ */ C(a.Trigger, {
|
|
244
245
|
className: "xlqzeqv x1hnptsi x153jb6y xy8obcc xas2l8k xj57cvi",
|
|
245
|
-
children: [/* @__PURE__ */
|
|
246
|
+
children: [/* @__PURE__ */ S(D, {
|
|
246
247
|
size: 14,
|
|
247
248
|
"aria-hidden": !0,
|
|
248
249
|
className: "x2lah0s"
|
|
249
|
-
}), /* @__PURE__ */
|
|
250
|
+
}), /* @__PURE__ */ S("span", {
|
|
250
251
|
className: "xeuugli xj0a0fe",
|
|
251
252
|
children: e
|
|
252
253
|
})]
|
|
253
|
-
}), /* @__PURE__ */
|
|
254
|
+
}), /* @__PURE__ */ S(a.Panel, {
|
|
254
255
|
className: "x153jb6y xy8obcc xas2l8k",
|
|
255
256
|
children: t
|
|
256
257
|
})]
|
|
257
258
|
});
|
|
258
259
|
}
|
|
259
260
|
// packages/ai/src/prompt-input.tsx
|
|
260
|
-
var
|
|
261
|
+
var X = { action: {
|
|
261
262
|
keTefX: "xvc5jky",
|
|
262
263
|
$$css: !0
|
|
263
264
|
} };
|
|
264
|
-
function
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
function Z({ isCompact: e = !1 }) {
|
|
266
|
+
return /* @__PURE__ */ S("div", {
|
|
267
|
+
"aria-hidden": !0,
|
|
268
|
+
inert: !0,
|
|
269
|
+
className: "x78zum5 xdt5ytf x1hnptsi xeuugli xh8yej3 xe10afn xvueqy4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
270
|
+
children: /* @__PURE__ */ C("div", {
|
|
271
|
+
className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb x1gd1hh4 x1u8w8hx x14xc8xn x1nvizq4 xgzwmep",
|
|
272
|
+
children: [/* @__PURE__ */ S("div", {
|
|
273
|
+
..._.props(n.base, n.field, n.textarea, n.plainTextarea),
|
|
274
|
+
children: /* @__PURE__ */ S(p, {
|
|
275
|
+
lines: e ? 1 : 2,
|
|
276
|
+
width: "22ch"
|
|
277
|
+
})
|
|
278
|
+
}), /* @__PURE__ */ C("div", {
|
|
279
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi",
|
|
280
|
+
children: [/* @__PURE__ */ S("div", {
|
|
281
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli x12lumcd xy8obcc xas2l8k",
|
|
282
|
+
children: /* @__PURE__ */ S(p, { width: "8ch" })
|
|
283
|
+
}), /* @__PURE__ */ S(f, {
|
|
284
|
+
isIconOnly: !0,
|
|
285
|
+
xstyle: X.action
|
|
286
|
+
})]
|
|
287
|
+
})]
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function Q({ label: e, value: t, onValueChange: n, onSubmit: r, name: i = "prompt", placeholder: a, maxLength: o, required: s = !0, isPending: l = !1, disabled: u = !1, isSubmitDisabled: f = !1, submitLabel: p = "Send message", pendingLabel: v = "Sending…", enterBehavior: y = "newline", isCompact: x = !1, description: w, error: E, controls: D, attachments: k, onStop: A, isStopPending: j = !1, stopLabel: M = "Stop response" }) {
|
|
292
|
+
let N = b(), P = u || l, F = p;
|
|
293
|
+
A === void 0 ? l ? F = v : y === "submit" && (F = `${p} · Enter`) : F = j ? "Stopping…" : M;
|
|
267
294
|
function I(e) {
|
|
268
|
-
if (
|
|
295
|
+
if (y !== "submit" || e.key !== "Enter" || e.repeat) return;
|
|
269
296
|
let t = e.altKey || e.ctrlKey || e.metaKey;
|
|
270
|
-
e.shiftKey || t || e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229 || (e.preventDefault(), !P && !
|
|
297
|
+
e.shiftKey || t || e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229 || (e.preventDefault(), !P && !f && A === void 0 && e.currentTarget.form?.requestSubmit());
|
|
271
298
|
}
|
|
272
299
|
function L(e) {
|
|
273
|
-
e.preventDefault(), !P && !
|
|
300
|
+
e.preventDefault(), !P && !f && A === void 0 && r(e);
|
|
274
301
|
}
|
|
275
|
-
return /* @__PURE__ */
|
|
302
|
+
return /* @__PURE__ */ S("form", {
|
|
276
303
|
onSubmit: L,
|
|
277
304
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli xh8yej3 xe10afn xvueqy4 xbixft x1hz01jw xtqrqnz x1778rvt xj57cvi",
|
|
278
|
-
children: /* @__PURE__ */
|
|
279
|
-
invalid:
|
|
305
|
+
children: /* @__PURE__ */ C(m.Root, {
|
|
306
|
+
invalid: E !== void 0,
|
|
280
307
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
...
|
|
308
|
+
/* @__PURE__ */ S(m.Label, {
|
|
309
|
+
..._.props(g.hidden),
|
|
283
310
|
children: e
|
|
284
311
|
}),
|
|
285
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ C("div", {
|
|
286
313
|
...{
|
|
287
314
|
0: { className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb x1gd1hh4 x1u8w8hx x14xc8xn x1nvizq4 xgzwmep" },
|
|
288
315
|
1: { className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1mvvolr xmkeg23 x1y0btm7 xy32g2j x1r7kqkb x1gd1hh4 x1u8w8hx x14xc8xn x1nvizq4 xgzwmep x1oddvo6" }
|
|
289
|
-
}[
|
|
316
|
+
}[E !== void 0 | 0],
|
|
290
317
|
children: [
|
|
291
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ S(h, {
|
|
292
319
|
appearance: "plain",
|
|
293
|
-
rows:
|
|
294
|
-
|
|
320
|
+
rows: x ? 1 : 2,
|
|
321
|
+
isCompact: x,
|
|
295
322
|
name: i,
|
|
296
323
|
value: t,
|
|
297
324
|
onChange: (e) => n(e.currentTarget.value),
|
|
298
325
|
onKeyDown: I,
|
|
299
326
|
placeholder: a ?? e,
|
|
300
327
|
maxLength: o,
|
|
301
|
-
required:
|
|
302
|
-
disabled:
|
|
328
|
+
required: s,
|
|
329
|
+
disabled: u,
|
|
303
330
|
readOnly: l,
|
|
304
|
-
"aria-errormessage":
|
|
331
|
+
"aria-errormessage": E === void 0 ? void 0 : N
|
|
305
332
|
}),
|
|
306
333
|
k,
|
|
307
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ C("div", {
|
|
308
335
|
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi",
|
|
309
|
-
children: [
|
|
336
|
+
children: [D !== void 0 && /* @__PURE__ */ S("div", {
|
|
310
337
|
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli x12lumcd",
|
|
311
|
-
children:
|
|
312
|
-
}), /* @__PURE__ */
|
|
313
|
-
xstyle:
|
|
338
|
+
children: D
|
|
339
|
+
}), /* @__PURE__ */ C(d.Root, { children: [/* @__PURE__ */ S(d.Trigger, { render: A === void 0 ? /* @__PURE__ */ S(c, {
|
|
340
|
+
xstyle: X.action,
|
|
314
341
|
type: "submit",
|
|
315
342
|
variant: "solid",
|
|
316
|
-
"aria-label": l ?
|
|
317
|
-
disabled:
|
|
318
|
-
|
|
319
|
-
children: /* @__PURE__ */
|
|
343
|
+
"aria-label": l ? v : p,
|
|
344
|
+
disabled: u || f,
|
|
345
|
+
isPending: l,
|
|
346
|
+
children: /* @__PURE__ */ S(T, {
|
|
320
347
|
size: 16,
|
|
321
348
|
"aria-hidden": !0
|
|
322
349
|
})
|
|
323
|
-
}) : /* @__PURE__ */
|
|
324
|
-
xstyle:
|
|
350
|
+
}) : /* @__PURE__ */ S(c, {
|
|
351
|
+
xstyle: X.action,
|
|
325
352
|
type: "button",
|
|
326
353
|
"aria-label": j ? "Stopping…" : M,
|
|
327
354
|
onClick: (e) => {
|
|
328
355
|
e.preventDefault(), A();
|
|
329
356
|
},
|
|
330
|
-
disabled:
|
|
331
|
-
|
|
332
|
-
children: /* @__PURE__ */
|
|
357
|
+
disabled: u,
|
|
358
|
+
isPending: j,
|
|
359
|
+
children: /* @__PURE__ */ S(O, {
|
|
333
360
|
size: 14,
|
|
334
361
|
"aria-hidden": !0
|
|
335
362
|
})
|
|
336
|
-
}) }), /* @__PURE__ */
|
|
363
|
+
}) }), /* @__PURE__ */ S(d.Portal, { children: /* @__PURE__ */ S(d.Positioner, { children: /* @__PURE__ */ S(d.Popup, { children: F }) }) })] })]
|
|
337
364
|
})
|
|
338
365
|
]
|
|
339
366
|
}),
|
|
340
|
-
|
|
341
|
-
|
|
367
|
+
w !== void 0 && /* @__PURE__ */ S(m.Description, { children: w }),
|
|
368
|
+
E !== void 0 && /* @__PURE__ */ S(m.Error, {
|
|
342
369
|
id: N,
|
|
343
370
|
match: !0,
|
|
344
371
|
role: "alert",
|
|
345
|
-
children:
|
|
372
|
+
children: E
|
|
346
373
|
})
|
|
347
374
|
]
|
|
348
375
|
})
|
|
349
376
|
});
|
|
350
377
|
}
|
|
351
378
|
// packages/ai/src/sources.tsx
|
|
352
|
-
function
|
|
353
|
-
return /* @__PURE__ */
|
|
379
|
+
function $({ sources: e, label: t = "Sources" }) {
|
|
380
|
+
return /* @__PURE__ */ C("section", {
|
|
354
381
|
"aria-label": t,
|
|
355
382
|
className: "x78zum5 xdt5ytf x1hnptsi xeuugli x1hz01jw xtqrqnz x1778rvt xj57cvi xbixft",
|
|
356
383
|
children: [
|
|
357
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ S("h3", {
|
|
358
385
|
className: "x1ghz6dp xtqrqnz x1778rvt xk4h15q xj0a0fe",
|
|
359
386
|
children: t
|
|
360
387
|
}),
|
|
361
|
-
e.length === 0 && /* @__PURE__ */
|
|
388
|
+
e.length === 0 && /* @__PURE__ */ S("p", {
|
|
362
389
|
className: "x1ghz6dp x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
363
390
|
children: "No sources supplied."
|
|
364
391
|
}),
|
|
365
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ S("ol", {
|
|
366
393
|
className: "x78zum5 xdt5ytf x1n8ia3y x1ghz6dp x1717udv x3ct3a4",
|
|
367
|
-
children: e.map((e) => /* @__PURE__ */
|
|
394
|
+
children: e.map((e) => /* @__PURE__ */ C("li", {
|
|
368
395
|
className: "x78zum5 xdt5ytf xfko13i xeuugli xj0a0fe",
|
|
369
|
-
children: [/* @__PURE__ */
|
|
396
|
+
children: [/* @__PURE__ */ S("span", { children: /* @__PURE__ */ S(l, {
|
|
370
397
|
href: e.href,
|
|
371
398
|
children: e.title
|
|
372
|
-
}) }), e.description !== void 0 && /* @__PURE__ */
|
|
399
|
+
}) }), e.description !== void 0 && /* @__PURE__ */ S("p", {
|
|
373
400
|
className: "x1ghz6dp x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
374
401
|
children: e.description
|
|
375
402
|
})]
|
|
@@ -378,21 +405,21 @@ function Y({ sources: e, label: t = "Sources" }) {
|
|
|
378
405
|
]
|
|
379
406
|
});
|
|
380
407
|
}
|
|
381
|
-
function
|
|
382
|
-
return /* @__PURE__ */
|
|
408
|
+
function ee({ source: e, label: n }) {
|
|
409
|
+
return /* @__PURE__ */ S("span", {
|
|
383
410
|
className: "xt0psk2 x11njtxf xss6m8b",
|
|
384
|
-
children: /* @__PURE__ */
|
|
385
|
-
render: /* @__PURE__ */
|
|
411
|
+
children: /* @__PURE__ */ C(u.Root, { children: [/* @__PURE__ */ S(u.Trigger, {
|
|
412
|
+
render: /* @__PURE__ */ S(t, {}),
|
|
386
413
|
"aria-label": `Source ${n}: ${e.title}`,
|
|
387
414
|
children: n
|
|
388
|
-
}), /* @__PURE__ */
|
|
415
|
+
}), /* @__PURE__ */ S(u.Portal, { children: /* @__PURE__ */ S(u.Positioner, {
|
|
389
416
|
side: "top",
|
|
390
|
-
children: /* @__PURE__ */
|
|
391
|
-
|
|
417
|
+
children: /* @__PURE__ */ S(u.Popup, { children: /* @__PURE__ */ C(o, {
|
|
418
|
+
isCompact: !0,
|
|
392
419
|
children: [
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
e.description !== void 0 && /* @__PURE__ */
|
|
395
|
-
/* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ S(u.Title, { children: e.title }),
|
|
421
|
+
e.description !== void 0 && /* @__PURE__ */ S(u.Description, { children: e.description }),
|
|
422
|
+
/* @__PURE__ */ S(l, {
|
|
396
423
|
href: e.href,
|
|
397
424
|
children: "Open source"
|
|
398
425
|
})
|
|
@@ -401,4 +428,4 @@ function X({ source: e, label: n }) {
|
|
|
401
428
|
}) })] })
|
|
402
429
|
});
|
|
403
430
|
}
|
|
404
|
-
export {
|
|
431
|
+
export { M as Approval, V as Conversation, ee as InlineCitation, G as Message, J as MessageAction, K as MessageAttachment, Y as MessageBoundary, Q as PromptInput, Z as PromptInputPlaceholder, $ as Sources };
|