dishui 0.0.91 → 0.0.101
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/.release-verified.json +6 -0
- package/dist/ai.js +24 -0
- package/dist/components/Card/Metric2.js +11 -11
- package/dist/components/Card/Metric2.js.map +1 -1
- package/dist/components/Card/Ticket.d.ts +52 -0
- package/dist/components/Card/Ticket2.js +218 -0
- package/dist/components/Card/Ticket2.js.map +1 -0
- package/dist/components/Card/index.d.ts +32 -0
- package/dist/components/Card/index.js +211 -203
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/GroupButton/index.js +4 -4
- package/dist/components/GroupButton/index.js.map +1 -1
- package/dist/components/GroupedTable/index.js +10 -10
- package/dist/components/GroupedTable/index.js.map +1 -1
- package/dist/components/NavigationList/index.js +9 -9
- package/dist/components/NavigationList/index.js.map +1 -1
- package/dist/components/Section/index.js +11 -11
- package/dist/components/Section/index.js.map +1 -1
- package/dist/components/Skeleton/index.js +1 -1
- package/dist/components/Skeleton/index.js.map +1 -1
- package/dist/components/Table/index.js +6 -6
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/ai/AgentChat/index.d.ts +54 -0
- package/dist/components/ai/AgentChat/index.js +176 -0
- package/dist/components/ai/AgentChat/index.js.map +1 -0
- package/dist/components/ai/AgentRunCard/index.d.ts +38 -0
- package/dist/components/ai/AgentRunCard/index.js +100 -0
- package/dist/components/ai/AgentRunCard/index.js.map +1 -0
- package/dist/components/ai/AgentScreen/index.d.ts +50 -0
- package/dist/components/ai/AgentScreen/index.js +233 -0
- package/dist/components/ai/AgentScreen/index.js.map +1 -0
- package/dist/components/ai/ApprovalCard/index.d.ts +26 -0
- package/dist/components/ai/ApprovalCard/index.js +89 -0
- package/dist/components/ai/ApprovalCard/index.js.map +1 -0
- package/dist/components/ai/CodeView/index.d.ts +30 -0
- package/dist/components/ai/CodeView/index.js +149 -0
- package/dist/components/ai/CodeView/index.js.map +1 -0
- package/dist/components/ai/CommandSearch/index.d.ts +39 -0
- package/dist/components/ai/CommandSearch/index.js +217 -0
- package/dist/components/ai/CommandSearch/index.js.map +1 -0
- package/dist/components/ai/ContextCards/index.d.ts +42 -0
- package/dist/components/ai/ContextCards/index.js +106 -0
- package/dist/components/ai/ContextCards/index.js.map +1 -0
- package/dist/components/ai/DiffTable/index.d.ts +70 -0
- package/dist/components/ai/DiffTable/index.js +235 -0
- package/dist/components/ai/DiffTable/index.js.map +1 -0
- package/dist/components/ai/FilterTable/index.d.ts +35 -0
- package/dist/components/ai/FilterTable/index.js +86 -0
- package/dist/components/ai/FilterTable/index.js.map +1 -0
- package/dist/components/ai/FineTuneCard/index.d.ts +24 -0
- package/dist/components/ai/FineTuneCard/index.js +75 -0
- package/dist/components/ai/FineTuneCard/index.js.map +1 -0
- package/dist/components/ai/InsightCards/index.d.ts +23 -0
- package/dist/components/ai/InsightCards/index.js +64 -0
- package/dist/components/ai/InsightCards/index.js.map +1 -0
- package/dist/components/ai/IssueCard/index.d.ts +39 -0
- package/dist/components/ai/IssueCard/index.js +78 -0
- package/dist/components/ai/IssueCard/index.js.map +1 -0
- package/dist/components/ai/LoadingState/index.d.ts +22 -0
- package/dist/components/ai/LoadingState/index.js +80 -0
- package/dist/components/ai/LoadingState/index.js.map +1 -0
- package/dist/components/ai/PromptBar/index.d.ts +26 -0
- package/dist/components/ai/PromptBar/index.js +117 -0
- package/dist/components/ai/PromptBar/index.js.map +1 -0
- package/dist/components/ai/RecommendationCard/index.d.ts +44 -0
- package/dist/components/ai/RecommendationCard/index.js +142 -0
- package/dist/components/ai/RecommendationCard/index.js.map +1 -0
- package/dist/components/ai/RecordsTable/index.d.ts +65 -0
- package/dist/components/ai/RecordsTable/index.js +334 -0
- package/dist/components/ai/RecordsTable/index.js.map +1 -0
- package/dist/components/ai/SelectionActions/index.d.ts +19 -0
- package/dist/components/ai/SelectionActions/index.js +40 -0
- package/dist/components/ai/SelectionActions/index.js.map +1 -0
- package/dist/components/ai/StateFlow/index.d.ts +24 -0
- package/dist/components/ai/StateFlow/index.js +50 -0
- package/dist/components/ai/StateFlow/index.js.map +1 -0
- package/dist/components/ai/StreamingText/index.d.ts +44 -0
- package/dist/components/ai/StreamingText/index.js +211 -0
- package/dist/components/ai/StreamingText/index.js.map +1 -0
- package/dist/components/ai/TaskRows/index.d.ts +53 -0
- package/dist/components/ai/TaskRows/index.js +186 -0
- package/dist/components/ai/TaskRows/index.js.map +1 -0
- package/dist/components/ai/Thinking/index.d.ts +47 -0
- package/dist/components/ai/Thinking/index.js +197 -0
- package/dist/components/ai/Thinking/index.js.map +1 -0
- package/dist/components/ai/ToolChips/index.d.ts +21 -0
- package/dist/components/ai/ToolChips/index.js +63 -0
- package/dist/components/ai/ToolChips/index.js.map +1 -0
- package/dist/components/ai/index.d.ts +54 -0
- package/dist/components/ai/shared.d.ts +13 -0
- package/dist/components/ai/shared.js +25 -0
- package/dist/components/ai/shared.js.map +1 -0
- package/dist/components/pro/DataTable/rowDetailExtension.js +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/Flow/constants.js +3 -3
- package/dist/components/pro/Flow/constants.js.map +1 -1
- package/dist/components/pro/Flow/nodes/shapes.js +3 -3
- package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
- package/dist/components/pro/Flow/utils/themeColor.d.ts +2 -2
- package/dist/components/pro/Flow/utils/themeColor.js +2 -2
- package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
- package/dist/components/pro/Kanban/Kanban.d.ts +3 -0
- package/dist/components/pro/Kanban/Kanban.js +339 -0
- package/dist/components/pro/Kanban/Kanban.js.map +1 -0
- package/dist/components/pro/Kanban/Swimlanes.d.ts +3 -0
- package/dist/components/pro/Kanban/Swimlanes.js +60 -0
- package/dist/components/pro/Kanban/Swimlanes.js.map +1 -0
- package/dist/components/pro/Kanban/index.d.ts +5 -0
- package/dist/components/pro/Kanban/types.d.ts +103 -0
- package/dist/components/pro/Kanban/useKanbanDrag.d.ts +17 -0
- package/dist/components/pro/Kanban/useKanbanDrag.js +69 -0
- package/dist/components/pro/Kanban/useKanbanDrag.js.map +1 -0
- package/dist/components/pro/Kanban/utils.d.ts +13 -0
- package/dist/components/pro/Kanban/utils.js +48 -0
- package/dist/components/pro/Kanban/utils.js.map +1 -0
- package/dist/components/pro/RichTextEditor/AIRewrite.js +158 -127
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.d.ts +2 -0
- package/dist/components/pro/RichTextEditor/BlockHandle.js +156 -115
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js +136 -159
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -41
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +59 -53
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +48 -44
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +67 -63
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.d.ts +1 -0
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +182 -129
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.d.ts +1 -0
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +3 -3
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.d.ts +3 -0
- package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.js +31 -0
- package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.js.map +1 -0
- package/dist/components/pro/RichTextEditor/index.d.ts +1 -1
- package/dist/components/pro/RichTextEditor/types.d.ts +78 -11
- package/dist/components/pro/RichTextEditor/types.js +11 -0
- package/dist/components/pro/RichTextEditor/types.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/index-nostyled.d.ts +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +134 -107
- package/dist/kanban.js +5 -0
- package/dist/layouts/Sidebar.d.ts +16 -0
- package/dist/layouts/Sidebar.js +85 -52
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/utils/i18n.js +20 -0
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js +1 -1
- package/dist/utils/menu.js.map +1 -1
- package/package.json +14 -3
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { cn as e } from "../../../utils/cn.js";
|
|
2
|
+
import { AGENT_STATUS_LABEL as t, formatDuration as n, formatElapsed as r } from "../shared.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { useId as i, useState as a } from "react";
|
|
5
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ai/Thinking/index.tsx
|
|
7
|
+
var l = {
|
|
8
|
+
steps: "step",
|
|
9
|
+
reasoning: "reasoning",
|
|
10
|
+
search: "search",
|
|
11
|
+
coding: "coding"
|
|
12
|
+
}, u = () => /* @__PURE__ */ s("svg", {
|
|
13
|
+
width: "16",
|
|
14
|
+
height: "16",
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeWidth: "2",
|
|
19
|
+
strokeLinecap: "round",
|
|
20
|
+
strokeLinejoin: "round",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
children: /* @__PURE__ */ s("path", { d: "m6 9 6 6 6-6" })
|
|
23
|
+
}), d = () => /* @__PURE__ */ s("svg", {
|
|
24
|
+
width: "10",
|
|
25
|
+
height: "10",
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
fill: "none",
|
|
28
|
+
stroke: "currentColor",
|
|
29
|
+
strokeWidth: "3",
|
|
30
|
+
strokeLinecap: "round",
|
|
31
|
+
strokeLinejoin: "round",
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: /* @__PURE__ */ s("path", { d: "M20 6 9 17l-5-5" })
|
|
34
|
+
}), f = () => /* @__PURE__ */ s("svg", {
|
|
35
|
+
width: "10",
|
|
36
|
+
height: "10",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
fill: "none",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: "3",
|
|
41
|
+
strokeLinecap: "round",
|
|
42
|
+
strokeLinejoin: "round",
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
children: /* @__PURE__ */ s("path", { d: "M18 6 6 18M6 6l12 12" })
|
|
45
|
+
}), p = ({ status: n }) => /* @__PURE__ */ c("span", {
|
|
46
|
+
className: e("dishui-ai-thinking__marker", `dishui-ai-thinking__marker--${n}`),
|
|
47
|
+
title: t[n],
|
|
48
|
+
children: [
|
|
49
|
+
n === "completed" && /* @__PURE__ */ s(d, {}),
|
|
50
|
+
n === "failed" && /* @__PURE__ */ s(f, {}),
|
|
51
|
+
/* @__PURE__ */ s("span", {
|
|
52
|
+
className: "dishui-ai-thinking__sr",
|
|
53
|
+
children: t[n]
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
}), m = (e) => (e.domain ?? e.title).trim().charAt(0).toUpperCase(), h = ({ step: t, kind: n }) => {
|
|
57
|
+
let i = t.status ?? "completed";
|
|
58
|
+
return /* @__PURE__ */ c("li", {
|
|
59
|
+
className: e("dishui-ai-thinking__step", `dishui-ai-thinking__step--${n}`, `dishui-ai-thinking__step--${i}`),
|
|
60
|
+
children: [/* @__PURE__ */ s(p, { status: i }), /* @__PURE__ */ c("div", {
|
|
61
|
+
className: "dishui-ai-thinking__content",
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ c("div", {
|
|
64
|
+
className: "dishui-ai-thinking__step-row",
|
|
65
|
+
children: [/* @__PURE__ */ s("span", {
|
|
66
|
+
className: "dishui-ai-thinking__step-title",
|
|
67
|
+
children: t.title
|
|
68
|
+
}), t.durationMs !== void 0 && /* @__PURE__ */ s("span", {
|
|
69
|
+
className: "dishui-ai-thinking__step-duration",
|
|
70
|
+
children: r(t.durationMs)
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
t.detail !== void 0 && /* @__PURE__ */ s("div", {
|
|
74
|
+
className: "dishui-ai-thinking__detail",
|
|
75
|
+
children: t.detail
|
|
76
|
+
}),
|
|
77
|
+
n === "search" && t.results && t.results.length > 0 && /* @__PURE__ */ s("ul", {
|
|
78
|
+
className: "dishui-ai-thinking__results",
|
|
79
|
+
children: t.results.map((e) => {
|
|
80
|
+
let t = /* @__PURE__ */ c(o, { children: [
|
|
81
|
+
/* @__PURE__ */ s("span", {
|
|
82
|
+
className: "dishui-ai-thinking__result-initial",
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
children: m(e)
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ s("span", {
|
|
87
|
+
className: "dishui-ai-thinking__result-title",
|
|
88
|
+
children: e.title
|
|
89
|
+
}),
|
|
90
|
+
e.domain && /* @__PURE__ */ s("span", {
|
|
91
|
+
className: "dishui-ai-thinking__result-domain",
|
|
92
|
+
children: e.domain
|
|
93
|
+
})
|
|
94
|
+
] });
|
|
95
|
+
return /* @__PURE__ */ s("li", { children: e.url ? /* @__PURE__ */ s("a", {
|
|
96
|
+
className: "dishui-ai-thinking__result",
|
|
97
|
+
href: e.url,
|
|
98
|
+
target: "_blank",
|
|
99
|
+
rel: "noreferrer",
|
|
100
|
+
children: t
|
|
101
|
+
}) : /* @__PURE__ */ s("span", {
|
|
102
|
+
className: "dishui-ai-thinking__result",
|
|
103
|
+
children: t
|
|
104
|
+
}) }, `${e.url ?? ""}-${e.domain ?? ""}-${e.title}`);
|
|
105
|
+
})
|
|
106
|
+
}),
|
|
107
|
+
n === "coding" && t.code && /* @__PURE__ */ c("div", {
|
|
108
|
+
className: "dishui-ai-thinking__code",
|
|
109
|
+
children: [/* @__PURE__ */ c("div", {
|
|
110
|
+
className: "dishui-ai-thinking__code-header",
|
|
111
|
+
children: [/* @__PURE__ */ s("span", {
|
|
112
|
+
className: "dishui-ai-thinking__code-file",
|
|
113
|
+
children: t.code.file ?? "snippet"
|
|
114
|
+
}), t.code.language && /* @__PURE__ */ s("span", {
|
|
115
|
+
className: "dishui-ai-thinking__code-lang",
|
|
116
|
+
children: t.code.language
|
|
117
|
+
})]
|
|
118
|
+
}), /* @__PURE__ */ s("pre", {
|
|
119
|
+
className: "dishui-ai-thinking__code-body",
|
|
120
|
+
children: /* @__PURE__ */ s("code", { children: t.code.content })
|
|
121
|
+
})]
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
})]
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
function g({ steps: t, status: r, durationMs: o, title: d, expanded: f, defaultExpanded: p = !1, onExpandedChange: m, mode: g = "auto", className: _, ...v }) {
|
|
128
|
+
let [y, b] = a(p), x = f !== void 0, S = x ? f : y, C = i(), w = t.find((e) => e.status === "running"), T = (r ?? (w ? "thinking" : "done")) === "thinking", E = t.reduce((e, t) => t.durationMs === void 0 ? e : (e ?? 0) + t.durationMs, void 0), D = o ?? E, O = T ? "Thinking" : D === void 0 ? "Thought" : `Thought for ${n(D)}`, k = d !== void 0 && !T && D !== void 0, A = () => {
|
|
129
|
+
let e = !S;
|
|
130
|
+
x || b(e), m?.(e);
|
|
131
|
+
};
|
|
132
|
+
return /* @__PURE__ */ c("div", {
|
|
133
|
+
...v,
|
|
134
|
+
className: e("dishui-ai-thinking", T && "dishui-ai-thinking--thinking", S && "dishui-ai-thinking--expanded", _),
|
|
135
|
+
children: [/* @__PURE__ */ c("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
className: "dishui-ai-thinking__header",
|
|
138
|
+
"aria-expanded": S,
|
|
139
|
+
"aria-controls": C,
|
|
140
|
+
onClick: A,
|
|
141
|
+
children: [
|
|
142
|
+
T && /* @__PURE__ */ c("span", {
|
|
143
|
+
className: "dishui-ai-thinking__glyph",
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
children: [
|
|
146
|
+
/* @__PURE__ */ s("span", { className: "dishui-ai-thinking__cell" }),
|
|
147
|
+
/* @__PURE__ */ s("span", { className: "dishui-ai-thinking__cell" }),
|
|
148
|
+
/* @__PURE__ */ s("span", { className: "dishui-ai-thinking__cell" })
|
|
149
|
+
]
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ s("span", {
|
|
152
|
+
className: "dishui-ai-thinking__title",
|
|
153
|
+
children: d ?? O
|
|
154
|
+
}),
|
|
155
|
+
!S && T && w && /* @__PURE__ */ s("span", {
|
|
156
|
+
className: "dishui-ai-thinking__summary",
|
|
157
|
+
children: w.title
|
|
158
|
+
}),
|
|
159
|
+
!S && !T && t.length > 0 && /* @__PURE__ */ c("span", {
|
|
160
|
+
className: "dishui-ai-thinking__meta",
|
|
161
|
+
children: [
|
|
162
|
+
t.length,
|
|
163
|
+
" ",
|
|
164
|
+
t.length === 1 ? "step" : "steps"
|
|
165
|
+
]
|
|
166
|
+
}),
|
|
167
|
+
k && /* @__PURE__ */ s("span", {
|
|
168
|
+
className: "dishui-ai-thinking__meta",
|
|
169
|
+
children: n(D)
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ s("span", {
|
|
172
|
+
className: "dishui-ai-thinking__chevron",
|
|
173
|
+
"aria-hidden": "true",
|
|
174
|
+
children: /* @__PURE__ */ s(u, {})
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
}), /* @__PURE__ */ s("div", {
|
|
178
|
+
id: C,
|
|
179
|
+
className: "dishui-ai-thinking__body",
|
|
180
|
+
hidden: !S,
|
|
181
|
+
children: t.length === 0 ? /* @__PURE__ */ s("p", {
|
|
182
|
+
className: "dishui-ai-thinking__empty",
|
|
183
|
+
children: "No steps recorded."
|
|
184
|
+
}) : /* @__PURE__ */ s("ol", {
|
|
185
|
+
className: "dishui-ai-thinking__trace",
|
|
186
|
+
children: t.map((e) => /* @__PURE__ */ s(h, {
|
|
187
|
+
step: e,
|
|
188
|
+
kind: g === "auto" ? e.kind : l[g]
|
|
189
|
+
}, e.id))
|
|
190
|
+
})
|
|
191
|
+
})]
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { g as default };
|
|
196
|
+
|
|
197
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ai/Thinking/index.tsx"],"sourcesContent":["import React, { useId, useState } from 'react';\nimport { cn } from '../../../utils/cn';\nimport { formatDuration, formatElapsed, AGENT_STATUS_LABEL } from '../shared';\nimport type { AgentStatus } from '../shared';\nimport './Thinking.css';\n\nexport type ThinkingStepKind = 'step' | 'reasoning' | 'search' | 'coding';\nexport type ThinkingMode = 'steps' | 'reasoning' | 'search' | 'coding' | 'auto';\nexport type ThinkingStatus = 'thinking' | 'done';\n\nexport type ThinkingSearchResult = { title: string; url?: string; domain?: string };\nexport type ThinkingCode = { language?: string; content: string; file?: string };\n\nexport type ThinkingStep = {\n id: string;\n kind: ThinkingStepKind;\n title: React.ReactNode;\n detail?: React.ReactNode;\n /** Defaults to `completed`. */\n status?: AgentStatus;\n durationMs?: number;\n /** Result chips rendered by `search` steps. */\n results?: ThinkingSearchResult[];\n /** Code block rendered by `coding` steps. */\n code?: ThinkingCode;\n};\n\nexport type ThinkingProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'title'> & {\n steps: ThinkingStep[];\n /** Derived from the steps when omitted: any running step → `thinking`. */\n status?: ThinkingStatus;\n /** Total time; rendered as “Thought for 4s” once done. Falls back to the sum of step durations. */\n durationMs?: number;\n /** Overrides the default “Thinking” / “Thought for …” header text. */\n title?: React.ReactNode;\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n /** Rendering emphasis. `auto` renders each step by its own `kind`. */\n mode?: ThinkingMode;\n};\n\nconst MODE_KIND: Record<Exclude<ThinkingMode, 'auto'>, ThinkingStepKind> = {\n steps: 'step',\n reasoning: 'reasoning',\n search: 'search',\n coding: 'coding',\n};\n\nconst ChevronIcon = () => (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n);\nconst CheckIcon = () => (\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n);\nconst XIcon = () => (\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n);\n\nconst Marker: React.FC<{ status: AgentStatus }> = ({ status }) => (\n <span className={cn('dishui-ai-thinking__marker', `dishui-ai-thinking__marker--${status}`)} title={AGENT_STATUS_LABEL[status]}>\n {status === 'completed' && <CheckIcon />}\n {status === 'failed' && <XIcon />}\n <span className=\"dishui-ai-thinking__sr\">{AGENT_STATUS_LABEL[status]}</span>\n </span>\n);\n\nconst initialOf = (result: ThinkingSearchResult) => (result.domain ?? result.title).trim().charAt(0).toUpperCase();\n\nconst StepBody: React.FC<{ step: ThinkingStep; kind: ThinkingStepKind }> = ({ step, kind }) => {\n const status = step.status ?? 'completed';\n return (\n <li className={cn('dishui-ai-thinking__step', `dishui-ai-thinking__step--${kind}`, `dishui-ai-thinking__step--${status}`)}>\n <Marker status={status} />\n <div className=\"dishui-ai-thinking__content\">\n <div className=\"dishui-ai-thinking__step-row\">\n <span className=\"dishui-ai-thinking__step-title\">{step.title}</span>\n {step.durationMs !== undefined && <span className=\"dishui-ai-thinking__step-duration\">{formatElapsed(step.durationMs)}</span>}\n </div>\n {step.detail !== undefined && <div className=\"dishui-ai-thinking__detail\">{step.detail}</div>}\n {kind === 'search' && step.results && step.results.length > 0 && (\n <ul className=\"dishui-ai-thinking__results\">\n {step.results.map(result => {\n const inner = (\n <>\n <span className=\"dishui-ai-thinking__result-initial\" aria-hidden=\"true\">{initialOf(result)}</span>\n <span className=\"dishui-ai-thinking__result-title\">{result.title}</span>\n {result.domain && <span className=\"dishui-ai-thinking__result-domain\">{result.domain}</span>}\n </>\n );\n return (\n <li key={`${result.url ?? ''}-${result.domain ?? ''}-${result.title}`}>\n {result.url ? (\n <a className=\"dishui-ai-thinking__result\" href={result.url} target=\"_blank\" rel=\"noreferrer\">{inner}</a>\n ) : (\n <span className=\"dishui-ai-thinking__result\">{inner}</span>\n )}\n </li>\n );\n })}\n </ul>\n )}\n {kind === 'coding' && step.code && (\n <div className=\"dishui-ai-thinking__code\">\n <div className=\"dishui-ai-thinking__code-header\">\n <span className=\"dishui-ai-thinking__code-file\">{step.code.file ?? 'snippet'}</span>\n {step.code.language && <span className=\"dishui-ai-thinking__code-lang\">{step.code.language}</span>}\n </div>\n <pre className=\"dishui-ai-thinking__code-body\"><code>{step.code.content}</code></pre>\n </div>\n )}\n </div>\n </li>\n );\n};\n\n/**\n * Expandable reasoning trace. Collapsed by default; the header summarises the\n * currently running step while collapsed and reads “Thought for …” once done.\n */\nexport default function Thinking({\n steps,\n status: statusProp,\n durationMs,\n title,\n expanded: expandedProp,\n defaultExpanded = false,\n onExpandedChange,\n mode = 'auto',\n className,\n ...rest\n}: ThinkingProps) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const controlled = expandedProp !== undefined;\n const expanded = controlled ? expandedProp : internalExpanded;\n const bodyId = useId();\n\n const running = steps.find(step => step.status === 'running');\n const status: ThinkingStatus = statusProp ?? (running ? 'thinking' : 'done');\n const thinking = status === 'thinking';\n\n const stepDurations = steps.reduce<number | undefined>(\n (sum, step) => (step.durationMs === undefined ? sum : (sum ?? 0) + step.durationMs),\n undefined,\n );\n const totalMs = durationMs ?? stepDurations;\n\n const defaultTitle = thinking ? 'Thinking' : totalMs !== undefined ? `Thought for ${formatDuration(totalMs)}` : 'Thought';\n const showDurationMeta = title !== undefined && !thinking && totalMs !== undefined;\n\n const toggle = () => {\n const next = !expanded;\n if (!controlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n };\n\n return (\n <div\n {...rest}\n className={cn('dishui-ai-thinking', thinking && 'dishui-ai-thinking--thinking', expanded && 'dishui-ai-thinking--expanded', className)}\n >\n <button type=\"button\" className=\"dishui-ai-thinking__header\" aria-expanded={expanded} aria-controls={bodyId} onClick={toggle}>\n {thinking && (\n <span className=\"dishui-ai-thinking__glyph\" aria-hidden=\"true\">\n <span className=\"dishui-ai-thinking__cell\" />\n <span className=\"dishui-ai-thinking__cell\" />\n <span className=\"dishui-ai-thinking__cell\" />\n </span>\n )}\n <span className=\"dishui-ai-thinking__title\">{title ?? defaultTitle}</span>\n {!expanded && thinking && running && <span className=\"dishui-ai-thinking__summary\">{running.title}</span>}\n {!expanded && !thinking && steps.length > 0 && (\n <span className=\"dishui-ai-thinking__meta\">{steps.length} {steps.length === 1 ? 'step' : 'steps'}</span>\n )}\n {showDurationMeta && <span className=\"dishui-ai-thinking__meta\">{formatDuration(totalMs)}</span>}\n <span className=\"dishui-ai-thinking__chevron\" aria-hidden=\"true\"><ChevronIcon /></span>\n </button>\n <div id={bodyId} className=\"dishui-ai-thinking__body\" hidden={!expanded}>\n {steps.length === 0 ? (\n <p className=\"dishui-ai-thinking__empty\">No steps recorded.</p>\n ) : (\n <ol className=\"dishui-ai-thinking__trace\">\n {steps.map(step => (\n <StepBody key={step.id} step={step} kind={mode === 'auto' ? step.kind : MODE_KIND[mode]} />\n ))}\n </ol>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;AA0CA,IAAM,IAAqE;CACzE,OAAO;CACP,WAAW;CACX,QAAQ;CACR,QAAQ;AACV,GAEM,UACJ,kBAAC,OAAD;CAAK,OAAM;CAAK,QAAO;CAAK,SAAQ;CAAY,MAAK;CAAO,QAAO;CAAe,aAAY;CAAI,eAAc;CAAQ,gBAAe;CAAQ,eAAY;CACzJ,UAAA,kBAAC,QAAD,EAAM,GAAE,eAAgB,CAAA;AACrB,CAAA,GAED,UACJ,kBAAC,OAAD;CAAK,OAAM;CAAK,QAAO;CAAK,SAAQ;CAAY,MAAK;CAAO,QAAO;CAAe,aAAY;CAAI,eAAc;CAAQ,gBAAe;CAAQ,eAAY;CACzJ,UAAA,kBAAC,QAAD,EAAM,GAAE,kBAAmB,CAAA;AACxB,CAAA,GAED,UACJ,kBAAC,OAAD;CAAK,OAAM;CAAK,QAAO;CAAK,SAAQ;CAAY,MAAK;CAAO,QAAO;CAAe,aAAY;CAAI,eAAc;CAAQ,gBAAe;CAAQ,eAAY;CACzJ,UAAA,kBAAC,QAAD,EAAM,GAAE,uBAAwB,CAAA;AAC7B,CAAA,GAGD,KAA6C,EAAE,gBACnD,kBAAC,QAAD;CAAM,WAAW,EAAG,8BAA8B,+BAA+B,GAAQ;CAAG,OAAO,EAAmB;CAAtH,UAAA;EACG,MAAW,eAAe,kBAAC,GAAD,CAAY,CAAA;EACtC,MAAW,YAAY,kBAAC,GAAD,CAAQ,CAAA;EAChC,kBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA,EAAmB;EAAc,CAAA;CACvE;IAGF,KAAa,OAAkC,EAAO,UAA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us } from '../shared';
|
|
3
|
+
export type ToolChip = {
|
|
4
|
+
id: string;
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
status?: AgentStatus;
|
|
7
|
+
detail?: React.ReactNode;
|
|
8
|
+
duration?: string;
|
|
9
|
+
onRetry?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type ToolChipsProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
12
|
+
tools: ToolChip[];
|
|
13
|
+
expanded?: string[];
|
|
14
|
+
defaultExpanded?: string[];
|
|
15
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
16
|
+
labels?: Partial<Record<AgentStatus, string>> & {
|
|
17
|
+
retry?: string;
|
|
18
|
+
empty?: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default function ToolChips({ tools, expanded, defaultExpanded, onExpandedChange, labels, className, ...rest }: ToolChipsProps): React.JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cn as e } from "../../../utils/cn.js";
|
|
2
|
+
import { AGENT_STATUS_LABEL as t } from "../shared.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { useState as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/ai/ToolChips/index.tsx
|
|
7
|
+
var a = [];
|
|
8
|
+
function o({ tools: o, expanded: s, defaultExpanded: c = a, onExpandedChange: l, labels: u, className: d, ...f }) {
|
|
9
|
+
let [p, m] = n(c), h = s ?? p, g = (e) => {
|
|
10
|
+
let t = h.includes(e) ? h.filter((t) => t !== e) : [...h, e];
|
|
11
|
+
s === void 0 && m(t), l?.(t);
|
|
12
|
+
};
|
|
13
|
+
return o.length ? /* @__PURE__ */ r("div", {
|
|
14
|
+
...f,
|
|
15
|
+
className: e("dishui-ai-tool-chips", d),
|
|
16
|
+
children: o.map((n) => {
|
|
17
|
+
let a = n.status ?? "completed", o = h.includes(n.id), s = `tool-${n.id}-detail`;
|
|
18
|
+
return /* @__PURE__ */ i("div", {
|
|
19
|
+
className: e("dishui-ai-tool-chips__item", `dishui-ai-tool-chips__item--${a}`),
|
|
20
|
+
children: [/* @__PURE__ */ i("button", {
|
|
21
|
+
type: "button",
|
|
22
|
+
className: "dishui-ai-tool-chips__chip",
|
|
23
|
+
"aria-expanded": n.detail ? o : void 0,
|
|
24
|
+
"aria-controls": n.detail ? s : void 0,
|
|
25
|
+
onClick: () => n.detail && g(n.id),
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ r("span", {
|
|
28
|
+
className: "dishui-ai-tool-chips__mark",
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
children: a === "completed" ? "✓" : a === "failed" ? "!" : a === "running" ? "…" : "·"
|
|
31
|
+
}),
|
|
32
|
+
/* @__PURE__ */ r("span", { children: n.label }),
|
|
33
|
+
/* @__PURE__ */ r("span", {
|
|
34
|
+
className: "dishui-ai-tool-chips__status",
|
|
35
|
+
children: u?.[a] ?? t[a]
|
|
36
|
+
}),
|
|
37
|
+
n.duration && /* @__PURE__ */ r("span", {
|
|
38
|
+
className: "dishui-ai-tool-chips__duration",
|
|
39
|
+
children: n.duration
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}), n.detail && /* @__PURE__ */ i("div", {
|
|
43
|
+
id: s,
|
|
44
|
+
hidden: !o,
|
|
45
|
+
className: "dishui-ai-tool-chips__detail",
|
|
46
|
+
children: [n.detail, a === "failed" && n.onRetry && /* @__PURE__ */ r("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
onClick: n.onRetry,
|
|
49
|
+
children: u?.retry ?? "Retry"
|
|
50
|
+
})]
|
|
51
|
+
})]
|
|
52
|
+
}, n.id);
|
|
53
|
+
})
|
|
54
|
+
}) : /* @__PURE__ */ r("div", {
|
|
55
|
+
...f,
|
|
56
|
+
className: e("dishui-ai-tool-chips dishui-ai-tool-chips--empty", d),
|
|
57
|
+
children: u?.empty ?? "No tools used"
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { o as default };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ai/ToolChips/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { cn } from '../../../utils/cn';\nimport type { AgentStatus } from '../shared';\nimport { AGENT_STATUS_LABEL } from '../shared';\nimport './ToolChips.css';\n\nconst EMPTY_EXPANDED: string[] = [];\n\nexport type ToolChip = { id: string; label: React.ReactNode; status?: AgentStatus; detail?: React.ReactNode; duration?: string; onRetry?: () => void };\nexport type ToolChipsProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & { tools: ToolChip[]; expanded?: string[]; defaultExpanded?: string[]; onExpandedChange?: (ids: string[]) => void; labels?: Partial<Record<AgentStatus, string>> & { retry?: string; empty?: string } };\n\nexport default function ToolChips({ tools, expanded, defaultExpanded = EMPTY_EXPANDED, onExpandedChange, labels, className, ...rest }: ToolChipsProps) {\n const [internal, setInternal] = useState(defaultExpanded);\n const open = expanded ?? internal;\n const toggle = (id: string) => { const next = open.includes(id) ? open.filter(x => x !== id) : [...open, id]; if (expanded === undefined) setInternal(next); onExpandedChange?.(next); };\n if (!tools.length) return <div {...rest} className={cn('dishui-ai-tool-chips dishui-ai-tool-chips--empty', className)}>{labels?.empty ?? 'No tools used'}</div>;\n return <div {...rest} className={cn('dishui-ai-tool-chips', className)}>{tools.map(tool => { const status = tool.status ?? 'completed'; const isOpen = open.includes(tool.id); const panelId = `tool-${tool.id}-detail`; return <div key={tool.id} className={cn('dishui-ai-tool-chips__item', `dishui-ai-tool-chips__item--${status}`)}><button type=\"button\" className=\"dishui-ai-tool-chips__chip\" aria-expanded={tool.detail ? isOpen : undefined} aria-controls={tool.detail ? panelId : undefined} onClick={() => tool.detail && toggle(tool.id)}><span className=\"dishui-ai-tool-chips__mark\" aria-hidden=\"true\">{status === 'completed' ? '✓' : status === 'failed' ? '!' : status === 'running' ? '…' : '·'}</span><span>{tool.label}</span><span className=\"dishui-ai-tool-chips__status\">{labels?.[status] ?? AGENT_STATUS_LABEL[status]}</span>{tool.duration && <span className=\"dishui-ai-tool-chips__duration\">{tool.duration}</span>}</button>{tool.detail && <div id={panelId} hidden={!isOpen} className=\"dishui-ai-tool-chips__detail\">{tool.detail}{status === 'failed' && tool.onRetry && <button type=\"button\" onClick={tool.onRetry}>{labels?.retry ?? 'Retry'}</button>}</div>}</div>; })}</div>;\n}\n"],"mappings":";;;;;;AAMA,IAAM,IAA2B,CAAC;AAKlC,SAAwB,EAAU,EAAE,UAAO,aAAU,qBAAkB,GAAgB,qBAAkB,WAAQ,cAAW,GAAG,KAAwB;CACrJ,IAAM,CAAC,GAAU,KAAe,EAAS,CAAe,GAClD,IAAO,KAAY,GACnB,KAAU,MAAe;EAAE,IAAM,IAAO,EAAK,SAAS,CAAE,IAAI,EAAK,QAAO,MAAK,MAAM,CAAE,IAAI,CAAC,GAAG,GAAM,CAAE;EAAkD,AAA3C,MAAa,KAAA,KAAW,EAAY,CAAI,GAAG,IAAmB,CAAI;CAAG;CAEvL,OADK,EAAM,SACJ,kBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,EAAG,wBAAwB,CAAS;EAAI,UAAA,EAAM,KAAI,MAAQ;GAAE,IAAM,IAAS,EAAK,UAAU,aAAmB,IAAS,EAAK,SAAS,EAAK,EAAE,GAAS,IAAU,QAAQ,EAAK,GAAG;GAAU,OAAO,kBAAC,OAAD;IAAmB,WAAW,EAAG,8BAA8B,+BAA+B,GAAQ;IAAtG,UAAA,CAAyG,kBAAC,UAAD;KAAQ,MAAK;KAAS,WAAU;KAA6B,iBAAe,EAAK,SAAS,IAAS,KAAA;KAAW,iBAAe,EAAK,SAAS,IAAU,KAAA;KAAW,eAAe,EAAK,UAAU,EAAO,EAAK,EAAE;KAA5M,UAAA;MAA+M,kBAAC,QAAD;OAAM,WAAU;OAA6B,eAAY;OAAQ,UAAA,MAAW,cAAc,MAAM,MAAW,WAAW,MAAM,MAAW,YAAY,MAAM;MAAU,CAAA;MAAC,kBAAC,QAAD,EAAA,UAAO,EAAK,MAAY,CAAA;MAAC,kBAAC,QAAD;OAAM,WAAU;OAAgC,UAAA,IAAS,MAAW,EAAmB;MAAc,CAAA;MAAE,EAAK,YAAY,kBAAC,QAAD;OAAM,WAAU;OAAkC,UAAA,EAAK;MAAe,CAAA;KAAU;IAAE,CAAA,GAAA,EAAK,UAAU,kBAAC,OAAD;KAAK,IAAI;KAAS,QAAQ,CAAC;KAAQ,WAAU;KAA7C,UAAA,CAA6E,EAAK,QAAQ,MAAW,YAAY,EAAK,WAAW,kBAAC,UAAD;MAAQ,MAAK;MAAS,SAAS,EAAK;MAAU,UAAA,GAAQ,SAAS;KAAgB,CAAA,CAAO;IAAO,CAAA,CAAA;GAAl6B,GAAA,EAAK,EAA65B;EAAG,CAAC;CAAO,CAAA,IAD7nC,kBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,EAAG,oDAAoD,CAAS;EAAI,UAAA,GAAQ,SAAS;CAAqB,CAAA;AAEhK"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-native primitives: loading, thinking traces, approvals, tool chips,
|
|
3
|
+
* agent task rows, streaming answers and the surrounding chrome agents
|
|
4
|
+
* need to talk to humans. Also published as the `dishui/ai` subpath.
|
|
5
|
+
*/
|
|
6
|
+
export { formatElapsed, formatDuration, AGENT_STATUS_LABEL } from './shared';
|
|
7
|
+
export type { AgentStatus } from './shared';
|
|
8
|
+
export { default as LoadingState } from './LoadingState';
|
|
9
|
+
export type { LoadingStateProps, LoadingStateVariant } from './LoadingState';
|
|
10
|
+
export { default as Thinking } from './Thinking';
|
|
11
|
+
export type { ThinkingProps, ThinkingStep, ThinkingStepKind, ThinkingMode, ThinkingStatus, ThinkingSearchResult, ThinkingCode } from './Thinking';
|
|
12
|
+
export { default as StreamingText } from './StreamingText';
|
|
13
|
+
export type { StreamingTextProps, StreamingSource, StreamingAction, StreamingFeedback } from './StreamingText';
|
|
14
|
+
export { default as ApprovalCard } from './ApprovalCard';
|
|
15
|
+
export type { ApprovalCardProps, ApprovalOption } from './ApprovalCard';
|
|
16
|
+
export { default as ToolChips } from './ToolChips';
|
|
17
|
+
export type { ToolChipsProps, ToolChip } from './ToolChips';
|
|
18
|
+
export { default as TaskRows } from './TaskRows';
|
|
19
|
+
export type { TaskRowsProps, AgentTask, AgentSubtask, TaskRowsView, TaskRowsLabels } from './TaskRows';
|
|
20
|
+
export { default as AgentChat } from './AgentChat';
|
|
21
|
+
export type { AgentChatProps, AgentChatMessage, AgentChatReasoningStep, ChatThread, AgentChatLabels } from './AgentChat';
|
|
22
|
+
export { default as PromptBar } from './PromptBar';
|
|
23
|
+
export type { PromptBarProps, PromptAttachment } from './PromptBar';
|
|
24
|
+
export { default as RecommendationCard } from './RecommendationCard';
|
|
25
|
+
export { confidenceLevel } from './RecommendationCard';
|
|
26
|
+
export type { RecommendationCardProps, Recommendation, RecommendationAlternative, RecommendationCardLabels, ConfidenceLevel } from './RecommendationCard';
|
|
27
|
+
export { default as ContextCards } from './ContextCards';
|
|
28
|
+
export type { ContextCardsProps, ContextChunk, ContextSource, ContextSourceKind, ContextCardsLabels } from './ContextCards';
|
|
29
|
+
export { default as DiffTable } from './DiffTable';
|
|
30
|
+
export { isDiffCellChange, diffRowChange } from './DiffTable';
|
|
31
|
+
export type { DiffTableProps, DiffTableColumn, DiffCellValue, DiffCell, DiffRowChange, DiffRow, DiffDecision } from './DiffTable';
|
|
32
|
+
export { default as RecordsTable } from './RecordsTable';
|
|
33
|
+
export { STRENGTH_LABEL, strengthPercent, formatRelativeTime } from './RecordsTable';
|
|
34
|
+
export type { RecordsTableProps, RecordRow, RecordStrength, RecordsSortKey, RecordsSort } from './RecordsTable';
|
|
35
|
+
export { default as FilterTable } from './FilterTable';
|
|
36
|
+
export type { FilterTableProps, FilterTableColumn, FilterTableFilter } from './FilterTable';
|
|
37
|
+
export { default as CommandSearch } from './CommandSearch';
|
|
38
|
+
export type { CommandSearchProps, CommandSearchItem } from './CommandSearch';
|
|
39
|
+
export { default as StateFlow } from './StateFlow';
|
|
40
|
+
export type { StateFlowProps, StateFlowNode, StateFlowEdge } from './StateFlow';
|
|
41
|
+
export { default as InsightCards } from './InsightCards';
|
|
42
|
+
export type { InsightCardsProps, InsightCardItem } from './InsightCards';
|
|
43
|
+
export { default as CodeView } from './CodeView';
|
|
44
|
+
export type { CodeViewProps } from './CodeView';
|
|
45
|
+
export { default as FineTuneCard } from './FineTuneCard';
|
|
46
|
+
export type { FineTuneCardProps, FineTuneMetric } from './FineTuneCard';
|
|
47
|
+
export { default as SelectionActions } from './SelectionActions';
|
|
48
|
+
export type { SelectionActionsProps, SelectionAction } from './SelectionActions';
|
|
49
|
+
export { default as AgentScreen } from './AgentScreen';
|
|
50
|
+
export type { AgentScreenProps, AgentScreenStatus, AgentScreenLabels } from './AgentScreen';
|
|
51
|
+
export { default as IssueCard } from './IssueCard';
|
|
52
|
+
export type { IssueCardProps, IssueLabel, IssuePriority, IssueAccent } from './IssueCard';
|
|
53
|
+
export { default as AgentRunCard } from './AgentRunCard';
|
|
54
|
+
export type { AgentRunCardProps, AgentRunStatus, AgentRunMeta } from './AgentRunCard';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for the AI-native component set (`src/components/ai`).
|
|
3
|
+
* Keep this file dependency-free so every component can import it cheaply.
|
|
4
|
+
*/
|
|
5
|
+
/** Format elapsed milliseconds as `0.0s`, `12s`, `1m 04s`. */
|
|
6
|
+
export declare function formatElapsed(ms: number): string;
|
|
7
|
+
/** Format a duration for prose, e.g. `for 4s`, `for 1m 04s`. */
|
|
8
|
+
export declare function formatDuration(ms: number): string;
|
|
9
|
+
/** Status vocabulary shared by task rows, tool chips and thinking steps. */
|
|
10
|
+
export type AgentStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
11
|
+
export declare const AGENT_STATUS_LABEL: Record<AgentStatus, string>;
|
|
12
|
+
/** Clamp a number into `[min, max]`. */
|
|
13
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/components/ai/shared.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
(!Number.isFinite(e) || e < 0) && (e = 0);
|
|
4
|
+
let t = e / 1e3;
|
|
5
|
+
return t < 10 ? `${t.toFixed(1)}s` : t < 60 ? `${Math.floor(t)}s` : `${Math.floor(t / 60)}m ${Math.floor(t % 60).toString().padStart(2, "0")}s`;
|
|
6
|
+
}
|
|
7
|
+
function t(e) {
|
|
8
|
+
(!Number.isFinite(e) || e < 0) && (e = 0);
|
|
9
|
+
let t = Math.round(e / 1e3);
|
|
10
|
+
return t < 60 ? `${t}s` : `${Math.floor(t / 60)}m ${(t % 60).toString().padStart(2, "0")}s`;
|
|
11
|
+
}
|
|
12
|
+
var n = {
|
|
13
|
+
pending: "Pending",
|
|
14
|
+
running: "Running",
|
|
15
|
+
completed: "Completed",
|
|
16
|
+
failed: "Failed",
|
|
17
|
+
skipped: "Skipped"
|
|
18
|
+
};
|
|
19
|
+
function r(e, t, n) {
|
|
20
|
+
return Math.min(n, Math.max(t, e));
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { n as AGENT_STATUS_LABEL, r as clamp, t as formatDuration, e as formatElapsed };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","names":[],"sources":["../../../src/components/ai/shared.ts"],"sourcesContent":["/**\n * Shared helpers for the AI-native component set (`src/components/ai`).\n * Keep this file dependency-free so every component can import it cheaply.\n */\n\n/** Format elapsed milliseconds as `0.0s`, `12s`, `1m 04s`. */\nexport function formatElapsed(ms: number): string {\n if (!Number.isFinite(ms) || ms < 0) ms = 0;\n const seconds = ms / 1000;\n if (seconds < 10) return `${seconds.toFixed(1)}s`;\n if (seconds < 60) return `${Math.floor(seconds)}s`;\n const minutes = Math.floor(seconds / 60);\n const rest = Math.floor(seconds % 60);\n return `${minutes}m ${rest.toString().padStart(2, '0')}s`;\n}\n\n/** Format a duration for prose, e.g. `for 4s`, `for 1m 04s`. */\nexport function formatDuration(ms: number): string {\n if (!Number.isFinite(ms) || ms < 0) ms = 0;\n const seconds = Math.round(ms / 1000);\n if (seconds < 60) return `${seconds}s`;\n const minutes = Math.floor(seconds / 60);\n const rest = seconds % 60;\n return `${minutes}m ${rest.toString().padStart(2, '0')}s`;\n}\n\n/** Status vocabulary shared by task rows, tool chips and thinking steps. */\nexport type AgentStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';\n\nexport const AGENT_STATUS_LABEL: Record<AgentStatus, string> = {\n pending: 'Pending',\n running: 'Running',\n completed: 'Completed',\n failed: 'Failed',\n skipped: 'Skipped',\n};\n\n/** Clamp a number into `[min, max]`. */\nexport function clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n"],"mappings":";AAMA,SAAgB,EAAc,GAAoB;CAChD,CAAI,CAAC,OAAO,SAAS,CAAE,KAAK,IAAK,OAAG,IAAK;CACzC,IAAM,IAAU,IAAK;CAKrB,OAJI,IAAU,KAAW,GAAG,EAAQ,QAAQ,CAAC,EAAE,KAC3C,IAAU,KAAW,GAAG,KAAK,MAAM,CAAO,EAAE,KAGzC,GAFS,KAAK,MAAM,IAAU,EAE3B,EAAQ,IADL,KAAK,MAAM,IAAU,EACZ,CAAA,CAAK,SAAS,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE;AACzD;AAGA,SAAgB,EAAe,GAAoB;CACjD,CAAI,CAAC,OAAO,SAAS,CAAE,KAAK,IAAK,OAAG,IAAK;CACzC,IAAM,IAAU,KAAK,MAAM,IAAK,GAAI;CAIpC,OAHI,IAAU,KAAW,GAAG,EAAQ,KAG7B,GAFS,KAAK,MAAM,IAAU,EAE3B,EAAQ,KADL,IAAU,GAAA,CACI,SAAS,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE;AACzD;AAKA,IAAa,IAAkD;CAC7D,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,SAAS;AACX;AAGA,SAAgB,EAAM,GAAe,GAAa,GAAqB;CACrE,OAAO,KAAK,IAAI,GAAK,KAAK,IAAI,GAAK,CAAK,CAAC;AAC3C"}
|
|
@@ -6,7 +6,7 @@ function a({ render: a }) {
|
|
|
6
6
|
return e(() => ({
|
|
7
7
|
name: "row-detail",
|
|
8
8
|
wrapRow: (e, t) => o[t.rowId] ? /* @__PURE__ */ i(n, { children: [e, /* @__PURE__ */ r("tr", {
|
|
9
|
-
className: "table-row
|
|
9
|
+
className: "table-row dishui-table-card__detail",
|
|
10
10
|
children: /* @__PURE__ */ r("td", {
|
|
11
11
|
className: "table-cell p-0",
|
|
12
12
|
colSpan: 9999,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowDetailExtension.js","names":[],"sources":["../../../../src/components/pro/DataTable/rowDetailExtension.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport type { DataTableExtension, DataTableRowContext } from './extension';\n\nexport interface RowDetailOptions<T extends object> {\n /** 渲染展开后的行详情面板。 */\n render: (ctx: DataTableRowContext<T>) => React.ReactNode;\n}\n\n/**\n * 行详情(master/detail)扩展。\n *\n * 由于扩展是普通对象无法持有 React 状态,这里以 hook 工厂的形式返回一个绑定了\n * 展开状态的扩展。为每一行的第一列注入一个展开按钮(通过 `cell` 覆写),点击后\n * 在该行下方渲染一个详情面板(通过 `wrapRow`)。\n *\n * 使用方式:\n * ```tsx\n * const detail = useRowDetailExtension<Row>({\n * render: ({ row }) => <pre>{JSON.stringify(row, null, 2)}</pre>,\n * });\n * <DataTable data={data} columns={columns} extensions={[detail]} />\n * ```\n */\nexport function useRowDetailExtension<T extends object>({\n render,\n}: RowDetailOptions<T>): DataTableExtension<T> {\n const [open, setOpen] = useState<Record<string, boolean>>({});\n\n return useMemo<DataTableExtension<T>>(\n () => ({\n name: 'row-detail',\n wrapRow: (children, ctx) => {\n if (!open[ctx.rowId]) return children;\n return (\n <>\n {children}\n <tr className=\"table-row
|
|
1
|
+
{"version":3,"file":"rowDetailExtension.js","names":[],"sources":["../../../../src/components/pro/DataTable/rowDetailExtension.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport type { DataTableExtension, DataTableRowContext } from './extension';\n\nexport interface RowDetailOptions<T extends object> {\n /** 渲染展开后的行详情面板。 */\n render: (ctx: DataTableRowContext<T>) => React.ReactNode;\n}\n\n/**\n * 行详情(master/detail)扩展。\n *\n * 由于扩展是普通对象无法持有 React 状态,这里以 hook 工厂的形式返回一个绑定了\n * 展开状态的扩展。为每一行的第一列注入一个展开按钮(通过 `cell` 覆写),点击后\n * 在该行下方渲染一个详情面板(通过 `wrapRow`)。\n *\n * 使用方式:\n * ```tsx\n * const detail = useRowDetailExtension<Row>({\n * render: ({ row }) => <pre>{JSON.stringify(row, null, 2)}</pre>,\n * });\n * <DataTable data={data} columns={columns} extensions={[detail]} />\n * ```\n */\nexport function useRowDetailExtension<T extends object>({\n render,\n}: RowDetailOptions<T>): DataTableExtension<T> {\n const [open, setOpen] = useState<Record<string, boolean>>({});\n\n return useMemo<DataTableExtension<T>>(\n () => ({\n name: 'row-detail',\n wrapRow: (children, ctx) => {\n if (!open[ctx.rowId]) return children;\n return (\n <>\n {children}\n <tr className=\"table-row dishui-table-card__detail\">\n <td className=\"table-cell p-0\" colSpan={9999}>\n <div className=\"bg-base-200/60 p-4 border-l-4 border-primary\">\n {render(ctx)}\n </div>\n </td>\n </tr>\n </>\n );\n },\n rowProps: (ctx) =>\n ({\n 'data-detail-open': open[ctx.rowId] ? 'true' : undefined,\n }) as React.HTMLAttributes<HTMLTableRowElement>,\n // 通过右键菜单切换详情面板,避免占用列布局。\n contextMenu: (ctx) => [\n {\n key: 'toggle-detail',\n label: open[ctx.rowId] ? '收起详情' : '展开详情',\n onSelect: () =>\n setOpen((s) => ({ ...s, [ctx.rowId]: !s[ctx.rowId] })),\n },\n ],\n }),\n [open, render],\n );\n}\n"],"mappings":";;;AAuBA,SAAgB,EAAwC,EACpD,aAC2C;CAC3C,IAAM,CAAC,GAAM,KAAW,EAAkC,CAAC,CAAC;CAE5D,OAAO,SACI;EACH,MAAM;EACN,UAAU,GAAU,MACX,EAAK,EAAI,SAEV,kBAAA,GAAA,EAAA,UAAA,CACK,GACD,kBAAC,MAAD;GAAI,WAAU;GACV,UAAA,kBAAC,MAAD;IAAI,WAAU;IAAiB,SAAS;IACpC,UAAA,kBAAC,OAAD;KAAK,WAAU;KACV,UAAA,EAAO,CAAG;IACV,CAAA;GACL,CAAA;EACJ,CAAA,CACN,EAAA,CAAA,IAXuB;EAcjC,WAAW,OACN,EACG,oBAAoB,EAAK,EAAI,SAAS,SAAS,KAAA,EACnD;EAEJ,cAAc,MAAQ,CAClB;GACI,KAAK;GACL,OAAO,EAAK,EAAI,SAAS,SAAS;GAClC,gBACI,GAAS,OAAO;IAAE,GAAG;KAAI,EAAI,QAAQ,CAAC,EAAE,EAAI;GAAO,EAAE;EAC7D,CACJ;CACJ,IACA,CAAC,GAAM,CAAM,CACjB;AACJ"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
var e = "root", t = {
|
|
3
3
|
label: "Text",
|
|
4
4
|
fill: "theme:base-100",
|
|
5
|
-
stroke: "theme:base-
|
|
6
|
-
strokeWidth:
|
|
5
|
+
stroke: "theme:base-300",
|
|
6
|
+
strokeWidth: 1,
|
|
7
7
|
color: "theme:base-content",
|
|
8
8
|
fontSize: 14,
|
|
9
9
|
attributes: []
|
|
@@ -16,7 +16,7 @@ var e = "root", t = {
|
|
|
16
16
|
fontSize: 14,
|
|
17
17
|
attributes: []
|
|
18
18
|
}, r = {
|
|
19
|
-
strokeColor: "theme:base-
|
|
19
|
+
strokeColor: "theme:base-300",
|
|
20
20
|
strokeWidth: 2,
|
|
21
21
|
lineStyle: "solid",
|
|
22
22
|
markerEnd: "arrowclosed"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../../../src/components/pro/Flow/constants.ts"],"sourcesContent":["import type {\n FlowNodeData,\n FlowShapeType,\n FlowEdgeTypeName,\n FlowEdgeMarkerKind,\n FlowEdgeLineStyle,\n FlowEdgeDashDensity,\n FlowBorderStyle,\n GradientDirection,\n FlowDocument,\n FlowEdgeData,\n} from './types';\n\nexport const ROOT_CANVAS_ID = 'root';\n\nexport const DEFAULT_NODE_DATA: FlowNodeData = {\n label: 'Text',\n fill: 'theme:base-100',\n stroke: 'theme:base-
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../../src/components/pro/Flow/constants.ts"],"sourcesContent":["import type {\n FlowNodeData,\n FlowShapeType,\n FlowEdgeTypeName,\n FlowEdgeMarkerKind,\n FlowEdgeLineStyle,\n FlowEdgeDashDensity,\n FlowBorderStyle,\n GradientDirection,\n FlowDocument,\n FlowEdgeData,\n} from './types';\n\nexport const ROOT_CANVAS_ID = 'root';\n\nexport const DEFAULT_NODE_DATA: FlowNodeData = {\n label: 'Text',\n fill: 'theme:base-100',\n stroke: 'theme:base-300',\n strokeWidth: 1,\n color: 'theme:base-content',\n fontSize: 14,\n attributes: [],\n};\n\nexport const TEXT_NODE_DATA: FlowNodeData = {\n label: 'Label',\n fill: 'transparent',\n stroke: 'transparent',\n strokeWidth: 0,\n color: 'theme:base-content',\n fontSize: 14,\n attributes: [],\n};\n\nexport const DEFAULT_EDGE_DATA: FlowEdgeData = {\n strokeColor: 'theme:base-300',\n strokeWidth: 2,\n lineStyle: 'solid',\n markerEnd: 'arrowclosed',\n};\n\nexport const PALETTE_ITEMS: Array<{\n type: FlowShapeType;\n width: number;\n height: number;\n data: FlowNodeData;\n}> = [\n { type: 'shapeRect', width: 140, height: 72, data: { ...DEFAULT_NODE_DATA, label: 'Rectangle' } },\n { type: 'shapeRoundRect', width: 140, height: 72, data: { ...DEFAULT_NODE_DATA, label: 'Rounded' } },\n { type: 'shapeEllipse', width: 120, height: 120, data: { ...DEFAULT_NODE_DATA, label: 'Ellipse' } },\n { type: 'shapeDiamond', width: 120, height: 120, data: { ...DEFAULT_NODE_DATA, label: 'Diamond' } },\n { type: 'shapeDocument', width: 120, height: 80, data: { ...DEFAULT_NODE_DATA, label: 'Document' } },\n { type: 'shapeParallelogram', width: 140, height: 72, data: { ...DEFAULT_NODE_DATA, label: 'Parallelogram' } },\n { type: 'shapeTriangle', width: 120, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Triangle' } },\n { type: 'shapeTrapezoid', width: 140, height: 72, data: { ...DEFAULT_NODE_DATA, label: 'Trapezoid' } },\n { type: 'shapePentagon', width: 100, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Pentagon' } },\n { type: 'shapeHexagon', width: 120, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Hexagon' } },\n { type: 'shapeStar', width: 100, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Star' } },\n { type: 'shapeHexagram', width: 100, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Hexagram' } },\n { type: 'shapeRightTriangle', width: 120, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Right Triangle' } },\n { type: 'shapeCorner', width: 100, height: 100, data: { ...DEFAULT_NODE_DATA, label: 'Corner' } },\n { type: 'textLabel', width: 120, height: 40, data: { ...TEXT_NODE_DATA, label: 'Label' } },\n { type: 'animAnchor', width: 320, height: 240, data: { ...DEFAULT_NODE_DATA, label: 'Anchor', fill: 'transparent', stroke: '#8b5cf6', strokeWidth: 1.5, borderStyle: 'dashed' } },\n { type: 'flowGroup', width: 200, height: 160, data: { ...DEFAULT_NODE_DATA, label: 'Group', fill: '#f0f9ff', stroke: '#9ca3af', strokeWidth: 1.5, borderStyle: 'dotted', isGroup: true } },\n { type: 'geometryGroup', width: 200, height: 160, data: { ...DEFAULT_NODE_DATA, label: 'Geo Group', fill: '#fefce8', stroke: '#9ca3af', strokeWidth: 1.5, borderStyle: 'dashed', isGroup: true } },\n];\n\nexport const EDGE_TYPE_OPTIONS: FlowEdgeTypeName[] = [\n 'smoothstep',\n 'step',\n 'straight',\n 'simplebezier',\n];\n\nexport const EDGE_MARKER_OPTIONS: FlowEdgeMarkerKind[] = [\n 'none',\n 'arrow',\n 'arrowclosed',\n];\n\nexport const EDGE_LINE_STYLE_OPTIONS: FlowEdgeLineStyle[] = [\n 'solid',\n 'dashed',\n 'dotted',\n 'dynamic',\n];\n\nexport const BORDER_STYLE_OPTIONS: FlowBorderStyle[] = [\n 'solid',\n 'dashed',\n 'dotted',\n 'dynamic',\n];\n\nexport const DASH_DENSITY_OPTIONS: FlowEdgeDashDensity[] = [\n 'sparse',\n 'medium',\n 'dense',\n];\n\nexport const GRADIENT_DIRECTION_OPTIONS: Array<{\n value: GradientDirection;\n label: string;\n}> = [\n { value: 'to-r', label: 'Left → Right' },\n { value: 'to-l', label: 'Right → Left' },\n { value: 'to-b', label: 'Top → Bottom' },\n { value: 'to-t', label: 'Bottom → Top' },\n { value: 'to-br', label: 'Top-Left → Bottom-Right' },\n { value: 'to-tl', label: 'Bottom-Right → Top-Left' },\n { value: 'to-tr', label: 'Bottom-Left → Top-Right' },\n { value: 'to-bl', label: 'Top-Right → Bottom-Left' },\n];\n\nexport const MIN_ZOOM = 0.1;\nexport const MAX_ZOOM = 4;\nexport const DEFAULT_GRID_SIZE = 20;\nexport const ZOOM_SENSITIVITY = 0.001;\nexport const SNAP_THRESHOLD = 5;\nexport const HANDLE_SIZE = 8;\n\nexport function createEmptyDocument(): FlowDocument {\n return {\n canvases: { [ROOT_CANVAS_ID]: { nodes: [], edges: [], lines: [] } },\n stack: [ROOT_CANVAS_ID],\n };\n}\n"],"mappings":";AAaA,IAAa,IAAiB,QAEjB,IAAkC;CAC7C,OAAO;CACP,MAAM;CACN,QAAQ;CACR,aAAa;CACb,OAAO;CACP,U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,OAAO;EAAS,OAAO;CAA0B;CACnD;EAAE,OAAO;EAAS,OAAO;CAA0B;CACnD;EAAE,OAAO;EAAS,OAAO;CAA0B;AACrD,GAEa,IAAW;AAOxB,SAAgB,IAAoC;CAClD,OAAO;EACL,UAAU,GAAG,IAAiB;GAAE,OAAO,CAAC;GAAG,OAAO,CAAC;GAAG,OAAO,CAAC;EAAE,EAAE;EAClE,OAAO,CAAC,CAAc;CACxB;AACF"}
|
|
@@ -106,7 +106,7 @@ function c(e, t, r) {
|
|
|
106
106
|
}
|
|
107
107
|
function l(e, t, r) {
|
|
108
108
|
if (t.borderStyle === "none" || !t.stroke || t.stroke === "transparent" || t.strokeWidth <= 0) return;
|
|
109
|
-
let a = r ?? Math.min(
|
|
109
|
+
let a = r ?? Math.min(14, t.width * .1, t.height * .1), s = n(t.borderStyle, t.strokeWidth);
|
|
110
110
|
if (s) {
|
|
111
111
|
let n = t.borderStyle === "dynamic" ? t.dashOffset ?? 0 : 0;
|
|
112
112
|
o(e, i(t.width, t.height, a), s, n, t.stroke, t.strokeWidth);
|
|
@@ -122,7 +122,7 @@ function d(e, t) {
|
|
|
122
122
|
e.rect(0, 0, t.width, t.height), s(e, t), c(e, t, r(t.width, t.height));
|
|
123
123
|
}
|
|
124
124
|
function f(e, t) {
|
|
125
|
-
let n = Math.min(
|
|
125
|
+
let n = Math.min(14, t.width * .1, t.height * .1);
|
|
126
126
|
e.roundRect(0, 0, t.width, t.height, n), s(e, t), c(e, t, i(t.width, t.height, n));
|
|
127
127
|
}
|
|
128
128
|
function p(e, t) {
|
|
@@ -373,7 +373,7 @@ function A(e, t) {
|
|
|
373
373
|
}
|
|
374
374
|
function j(e, t, n) {
|
|
375
375
|
switch (e) {
|
|
376
|
-
case "shapeRoundRect": return Math.min(
|
|
376
|
+
case "shapeRoundRect": return Math.min(14, t * .1, n * .1);
|
|
377
377
|
case "mediaNode": return 6;
|
|
378
378
|
case "flowGroup":
|
|
379
379
|
case "geometryGroup": return Math.min(6, t * .04, n * .04);
|