meowtail 0.1.0 → 0.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT-COMPONENTS.md +117 -0
- package/ASSISTANT.md +39 -19
- package/JSON.md +12 -5
- package/README.md +462 -349
- package/THIRD_PARTY_NOTICES.md +8 -0
- package/dist/src/chat/assistant-composer.js +3 -5
- package/dist/src/chat/assistant-content.d.ts +2 -0
- package/dist/src/chat/assistant-content.js +51 -3
- package/dist/src/chat/assistant-types.d.ts +39 -1
- package/dist/src/chat/assistant.d.ts +1 -1
- package/dist/src/chat/assistant.js +6 -3
- package/dist/src/chat/attachments.js +9 -5
- package/dist/src/chat/composer-panel.d.ts +17 -0
- package/dist/src/chat/composer-panel.js +12 -0
- package/dist/src/chat/composer.d.ts +2 -0
- package/dist/src/chat/composer.js +5 -2
- package/dist/src/chat/conversation.d.ts +4 -1
- package/dist/src/chat/conversation.js +7 -4
- package/dist/src/chat/index.d.ts +5 -2
- package/dist/src/chat/index.js +2 -0
- package/dist/src/chat/message-list.js +1 -1
- package/dist/src/chat/message.js +3 -3
- package/dist/src/chat/question.js +1 -1
- package/dist/src/chat/sources.js +1 -1
- package/dist/src/chat/task.d.ts +29 -0
- package/dist/src/chat/task.js +53 -0
- package/dist/src/chat/tool-call.d.ts +33 -8
- package/dist/src/chat/tool-call.js +70 -26
- package/dist/src/components/action-rail.d.ts +19 -0
- package/dist/src/components/action-rail.js +13 -0
- package/dist/src/components/add-button.js +1 -1
- package/dist/src/components/alert.d.ts +2 -0
- package/dist/src/components/alert.js +2 -1
- package/dist/src/components/app-bar.d.ts +17 -0
- package/dist/src/components/app-bar.js +10 -0
- package/dist/src/components/breadcrumb.js +1 -1
- package/dist/src/components/choice-select.js +1 -1
- package/dist/src/components/code-block.js +6 -6
- package/dist/src/components/credential-source.js +12 -12
- package/dist/src/components/diff-block.js +1 -1
- package/dist/src/components/grid.js +1 -0
- package/dist/src/components/hover-card.js +2 -2
- package/dist/src/components/image-lightbox.js +3 -3
- package/dist/src/components/image-preview.js +1 -1
- package/dist/src/components/index.d.ts +4 -0
- package/dist/src/components/index.js +4 -0
- package/dist/src/components/inline.js +1 -0
- package/dist/src/components/json-block.js +2 -2
- package/dist/src/components/json-tree.js +3 -3
- package/dist/src/components/layout-item.js +2 -1
- package/dist/src/components/layout-types.d.ts +1 -1
- package/dist/src/components/list-group.d.ts +1 -1
- package/dist/src/components/menu.js +5 -5
- package/dist/src/components/meta-row.d.ts +33 -0
- package/dist/src/components/meta-row.js +45 -0
- package/dist/src/components/output-block.d.ts +5 -3
- package/dist/src/components/output-block.js +35 -25
- package/dist/src/components/page-frame.d.ts +6 -2
- package/dist/src/components/page-frame.js +2 -2
- package/dist/src/components/path-picker.js +4 -4
- package/dist/src/components/process-group.d.ts +2 -2
- package/dist/src/components/rail-item.d.ts +2 -2
- package/dist/src/components/rail-section.d.ts +1 -1
- package/dist/src/components/read-block.js +2 -2
- package/dist/src/components/resource-card.d.ts +1 -1
- package/dist/src/components/resource-link.d.ts +1 -1
- package/dist/src/components/search-block.js +2 -3
- package/dist/src/components/stack.js +1 -0
- package/dist/src/components/status.d.ts +16 -0
- package/dist/src/components/status.js +8 -0
- package/dist/src/components/terminal-block.js +6 -6
- package/dist/src/components/web-block.js +3 -3
- package/dist/src/components/work-card.d.ts +2 -2
- package/dist/src/components/work-card.js +1 -1
- package/dist/src/icons/README.md +13 -2
- package/dist/src/icons/icon-frame.d.ts +11 -0
- package/dist/src/icons/icon-frame.js +4 -0
- package/dist/src/icons/icon-source.d.ts +17 -0
- package/dist/src/icons/icon-source.js +6 -0
- package/dist/src/icons/icon.d.ts +44 -37
- package/dist/src/icons/icon.js +55 -128
- package/dist/src/icons/index.d.ts +1 -0
- package/dist/src/icons/index.js +1 -0
- package/dist/src/icons/lucide.d.ts +1 -0
- package/dist/src/icons/lucide.js +4 -0
- package/dist/src/json/catalog.d.ts +88 -2
- package/dist/src/json/catalog.js +33 -1
- package/dist/src/registry/index.d.ts +54 -4
- package/dist/src/registry/index.js +16 -2
- package/dist/src/shared/execution-state.d.ts +7 -0
- package/dist/src/shared/execution-state.js +36 -0
- package/dist/src/theme/base.styles.js +15 -0
- package/dist/src/theme/chat/assistant.styles.js +21 -9
- package/dist/src/theme/chat/composer-panel.styles.d.ts +1 -0
- package/dist/src/theme/chat/composer-panel.styles.js +44 -0
- package/dist/src/theme/chat/composer.styles.js +39 -7
- package/dist/src/theme/chat/conversation.styles.js +15 -7
- package/dist/src/theme/chat/records.styles.js +79 -7
- package/dist/src/theme/chat/task.styles.d.ts +1 -0
- package/dist/src/theme/chat/task.styles.js +87 -0
- package/dist/src/theme/components/action-rail.styles.d.ts +1 -0
- package/dist/src/theme/components/action-rail.styles.js +47 -0
- package/dist/src/theme/components/alert.styles.js +42 -1
- package/dist/src/theme/components/app-bar.styles.d.ts +1 -0
- package/dist/src/theme/components/app-bar.styles.js +48 -0
- package/dist/src/theme/components/card.styles.js +9 -3
- package/dist/src/theme/components/code-block.styles.js +7 -0
- package/dist/src/theme/components/dialog.styles.js +7 -0
- package/dist/src/theme/components/field.styles.js +4 -0
- package/dist/src/theme/components/list-group.styles.js +10 -11
- package/dist/src/theme/components/meta-row.styles.d.ts +1 -0
- package/dist/src/theme/components/meta-row.styles.js +66 -0
- package/dist/src/theme/components/output-block.styles.js +17 -0
- package/dist/src/theme/components/page-frame.styles.js +7 -1
- package/dist/src/theme/components/page-header.styles.js +7 -0
- package/dist/src/theme/components/resource-card.styles.js +15 -3
- package/dist/src/theme/components/status.styles.d.ts +1 -0
- package/dist/src/theme/components/status.styles.js +25 -0
- package/dist/src/theme/components/tag.styles.js +3 -3
- package/dist/src/theme/components/toolbar.styles.js +7 -0
- package/dist/src/theme/index.d.ts +148 -0
- package/dist/src/theme/index.js +173 -159
- package/dist/src/theme/palette.d.ts +1 -1
- package/dist/src/theme/palette.js +1 -1
- package/dist/src/theme/shared/code-highlight.styles.js +1 -1
- package/dist/src/theme/shared/code-highlight.tokens.d.ts +6 -6
- package/dist/src/theme/shared/code-highlight.tokens.js +6 -6
- package/dist/src/theme/tokens.d.ts +7 -7
- package/dist/src/theme/tokens.js +14 -8
- package/package.json +17 -6
|
@@ -1,40 +1,84 @@
|
|
|
1
|
-
import { defineComponent, h } from "meowjsx";
|
|
1
|
+
import { defineComponent, h, unwrap, } from "meowjsx";
|
|
2
2
|
import { Icon } from "../icons/icon.js";
|
|
3
|
+
import { Button } from "../components/button.js";
|
|
4
|
+
import { OutputBlock } from "../components/output-block.js";
|
|
5
|
+
import { executionStateLabel } from "../shared/execution-state.js";
|
|
3
6
|
export const chatToolCallContract = {
|
|
4
7
|
name: "chat-tool-call",
|
|
5
|
-
parts: [
|
|
8
|
+
parts: [
|
|
9
|
+
"root",
|
|
10
|
+
"header",
|
|
11
|
+
"icon",
|
|
12
|
+
"label",
|
|
13
|
+
"summary",
|
|
14
|
+
"status",
|
|
15
|
+
"chevron",
|
|
16
|
+
"detail",
|
|
17
|
+
"body",
|
|
18
|
+
"input",
|
|
19
|
+
"output",
|
|
20
|
+
"outputSummary",
|
|
21
|
+
"actions",
|
|
22
|
+
],
|
|
6
23
|
};
|
|
7
|
-
export const ChatToolCall = defineComponent(chatToolCallContract, ({ children, label, summary, state = "complete", statusLabel, detail, icon, collapsible = false, onActivate, className, ...props }, context) => {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
24
|
+
export const ChatToolCall = defineComponent(chatToolCallContract, ({ children, label, summary, state = "complete", statusLabel, detail, icon, input, output, outputSummary, maxLines, collapsible = false, onActivate, onRetry, onCancel, canRetry = true, canCancel = true, retryDisabled = false, cancelDisabled = false, labels, className, ...props }, context) => {
|
|
25
|
+
const derived = (read) => {
|
|
26
|
+
const value = context.signal(read());
|
|
27
|
+
context.effect(() => {
|
|
28
|
+
value.value = read();
|
|
29
|
+
});
|
|
30
|
+
return value;
|
|
31
|
+
};
|
|
32
|
+
const copy = {
|
|
33
|
+
input: "Input",
|
|
34
|
+
output: "Output",
|
|
35
|
+
emptyInput: "No input content",
|
|
36
|
+
emptyOutput: "Empty output",
|
|
37
|
+
retry: "Retry",
|
|
38
|
+
cancel: "Cancel",
|
|
39
|
+
...labels,
|
|
40
|
+
};
|
|
41
|
+
const status = derived(() => unwrap(statusLabel) ?? executionStateLabel(unwrap(state)));
|
|
42
|
+
// Preserve the existing quiet completion default without interpreting missing data as success.
|
|
43
|
+
const quietStatus = derived(() => unwrap(state) === "complete" && !unwrap(statusLabel));
|
|
44
|
+
// One interactive header: activation never also toggles an in-place disclosure.
|
|
14
45
|
const reveals = collapsible && onActivate === undefined;
|
|
15
46
|
const interactive = reveals || onActivate !== undefined;
|
|
47
|
+
const payload = (kind, text) => context.part(kind, "div", { hidden: derived(() => unwrap(text) === undefined) }, h(OutputBlock, {
|
|
48
|
+
title: copy[kind],
|
|
49
|
+
rows: derived(() => {
|
|
50
|
+
const value = unwrap(text);
|
|
51
|
+
return value === undefined || value === "" ? [] : value.split("\n");
|
|
52
|
+
}),
|
|
53
|
+
copyText: derived(() => unwrap(text) ?? ""),
|
|
54
|
+
emptyText: kind === "input" ? copy.emptyInput : copy.emptyOutput,
|
|
55
|
+
maxLines,
|
|
56
|
+
wrap: true,
|
|
57
|
+
}));
|
|
58
|
+
const hasBody = children !== undefined ||
|
|
59
|
+
input !== undefined ||
|
|
60
|
+
output !== undefined ||
|
|
61
|
+
outputSummary !== undefined ||
|
|
62
|
+
onRetry !== undefined ||
|
|
63
|
+
onCancel !== undefined;
|
|
16
64
|
return context.part("root", reveals ? "details" : "div", {
|
|
17
65
|
...props,
|
|
18
66
|
className,
|
|
19
67
|
"data-tool-state": state,
|
|
20
|
-
"data-tool-default-complete": quietStatus ? "true" : undefined,
|
|
68
|
+
"data-tool-default-complete": derived(() => (quietStatus.value ? "true" : undefined)),
|
|
21
69
|
"data-tool-interactive": interactive ? "true" : undefined,
|
|
22
70
|
"data-tool-collapsible": reveals ? "true" : undefined,
|
|
23
|
-
}, context.part("header", onActivate !== undefined ? "button" : reveals ? "summary" : "div", onActivate !== undefined ? { type: "button", onClick: onActivate } : null, context.part("icon", "span", { "aria-hidden": "true" }, icon ?? h(Icon, { name: "wrench" })), context.part("label", "strong", null, label), summary
|
|
71
|
+
}, context.part("header", onActivate !== undefined ? "button" : reveals ? "summary" : "div", onActivate !== undefined ? { type: "button", onClick: onActivate } : null, context.part("icon", "span", { "aria-hidden": "true" }, icon ?? h(Icon, { name: "wrench" })), context.part("label", "strong", null, label), summary !== undefined
|
|
72
|
+
? context.part("summary", "span", { title: summary, hidden: derived(() => !unwrap(summary)) }, summary)
|
|
73
|
+
: null, context.part("status", "span", null, status), interactive
|
|
24
74
|
? context.part("chevron", "span", { "aria-hidden": "true" }, h(Icon, { name: "chevron-right" }))
|
|
25
|
-
: null), detail ? context.part("detail", "p", null, detail) : null,
|
|
75
|
+
: null), detail ? context.part("detail", "p", null, detail) : null, hasBody
|
|
76
|
+
? context.part("body", "div", null, input !== undefined ? payload("input", input) : null, outputSummary !== undefined
|
|
77
|
+
? context.part("outputSummary", "p", { hidden: derived(() => !unwrap(outputSummary)) }, outputSummary)
|
|
78
|
+
: null, output !== undefined ? payload("output", output) : null, children, onRetry || onCancel
|
|
79
|
+
? context.part("actions", "div", {
|
|
80
|
+
hidden: derived(() => !(onRetry && unwrap(canRetry)) && !(onCancel && unwrap(canCancel))),
|
|
81
|
+
}, onRetry ? (h(Button, { variant: "outline", size: "small", hidden: derived(() => !unwrap(canRetry)), disabled: derived(() => !unwrap(canRetry) || unwrap(retryDisabled)), onClick: onRetry }, copy.retry)) : null, onCancel ? (h(Button, { variant: "quiet", size: "small", hidden: derived(() => !unwrap(canCancel)), disabled: derived(() => !unwrap(canCancel) || unwrap(cancelDisabled)), onClick: onCancel }, copy.cancel)) : null)
|
|
82
|
+
: null)
|
|
83
|
+
: null);
|
|
26
84
|
});
|
|
27
|
-
function stateLabel(state) {
|
|
28
|
-
switch (state) {
|
|
29
|
-
case "running":
|
|
30
|
-
return "运行中";
|
|
31
|
-
case "waiting":
|
|
32
|
-
return "等待中";
|
|
33
|
-
case "error":
|
|
34
|
-
return "出错";
|
|
35
|
-
case "unknown":
|
|
36
|
-
return "结果未确认";
|
|
37
|
-
default:
|
|
38
|
-
return "已完成";
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Child, type Props } from "meowjsx";
|
|
2
|
+
export declare const actionRailContract: {
|
|
3
|
+
readonly name: "action-rail";
|
|
4
|
+
readonly parts: readonly ["root", "leading", "trailing", "submit"];
|
|
5
|
+
};
|
|
6
|
+
export interface ActionRailProps extends Props {
|
|
7
|
+
/** Actions anchored to the start of the row. */
|
|
8
|
+
leading?: Child;
|
|
9
|
+
/** Selection or secondary actions that stay together before the submit action. */
|
|
10
|
+
trailing?: Child;
|
|
11
|
+
/** The final action; flexible leading and trailing actions wrap to keep it visible. */
|
|
12
|
+
submit?: Child;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* An action row with wrapping groups. The rail owns order, start/end anchoring, the gap between
|
|
17
|
+
* groups and the rule that the submit action stays visible; callers pass actions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ActionRail: import("meowjsx").Component<ActionRailProps, "action-rail", "leading" | "root" | "submit" | "trailing">;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineComponent } from "meowjsx";
|
|
2
|
+
export const actionRailContract = {
|
|
3
|
+
name: "action-rail",
|
|
4
|
+
parts: ["root", "leading", "trailing", "submit"],
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* An action row with wrapping groups. The rail owns order, start/end anchoring, the gap between
|
|
8
|
+
* groups and the rule that the submit action stays visible; callers pass actions.
|
|
9
|
+
*/
|
|
10
|
+
export const ActionRail = defineComponent(actionRailContract, ({ leading, trailing, submit, children, className, ...props }, context) => {
|
|
11
|
+
void children;
|
|
12
|
+
return context.part("root", "div", { ...props, className }, context.part("leading", "div", null, leading), context.part("trailing", "div", null, trailing), context.part("submit", "div", null, submit));
|
|
13
|
+
});
|
|
@@ -2,12 +2,14 @@ import { type Child, type Props } from "meowjsx";
|
|
|
2
2
|
import { type ThemedProps } from "meowcss/meowjsx";
|
|
3
3
|
export declare const alertOptions: import("meowcss").Options<{
|
|
4
4
|
readonly tone: readonly ["info", "success", "warning", "danger"];
|
|
5
|
+
readonly layout: readonly ["block", "bar"];
|
|
5
6
|
}>;
|
|
6
7
|
export declare const alertContract: {
|
|
7
8
|
readonly name: "alert";
|
|
8
9
|
readonly parts: readonly ["root", "title", "body", "actions"];
|
|
9
10
|
readonly styleProps: import("meowcss/meowjsx").StylePropsBinding<import("meowcss").Options<{
|
|
10
11
|
readonly tone: readonly ["info", "success", "warning", "danger"];
|
|
12
|
+
readonly layout: readonly ["block", "bar"];
|
|
11
13
|
}>>;
|
|
12
14
|
};
|
|
13
15
|
export interface AlertProps extends Props, ThemedProps<typeof alertOptions> {
|
|
@@ -3,12 +3,13 @@ import { defineOptions } from "meowcss";
|
|
|
3
3
|
import { defineStyleProps } from "meowcss/meowjsx";
|
|
4
4
|
export const alertOptions = defineOptions("alert", {
|
|
5
5
|
tone: ["info", "success", "warning", "danger"],
|
|
6
|
+
layout: ["block", "bar"],
|
|
6
7
|
});
|
|
7
8
|
export const alertContract = {
|
|
8
9
|
name: "alert",
|
|
9
10
|
parts: ["root", "title", "body", "actions"],
|
|
10
11
|
styleProps: defineStyleProps(alertOptions, {
|
|
11
|
-
defaults: { tone: "info" },
|
|
12
|
+
defaults: { tone: "info", layout: "block" },
|
|
12
13
|
parts: ["root", "title"],
|
|
13
14
|
}),
|
|
14
15
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Child, type Props } from "meowjsx";
|
|
2
|
+
export declare const appBarContract: {
|
|
3
|
+
readonly name: "app-bar";
|
|
4
|
+
readonly parts: readonly ["root", "identity", "title", "status", "actions"];
|
|
5
|
+
};
|
|
6
|
+
export interface AppBarProps extends Props {
|
|
7
|
+
title: Child;
|
|
8
|
+
/** A short status line under the title, typically ChatStatus. */
|
|
9
|
+
status?: Child;
|
|
10
|
+
actions?: Child;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Compact application chrome: one title, one optional status line, and the
|
|
15
|
+
* actions that belong to the whole screen. The page body keeps its own scroll.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AppBar: import("meowjsx").Component<AppBarProps, "app-bar", "actions" | "identity" | "root" | "status" | "title">;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineComponent } from "meowjsx";
|
|
2
|
+
export const appBarContract = {
|
|
3
|
+
name: "app-bar",
|
|
4
|
+
parts: ["root", "identity", "title", "status", "actions"],
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Compact application chrome: one title, one optional status line, and the
|
|
8
|
+
* actions that belong to the whole screen. The page body keeps its own scroll.
|
|
9
|
+
*/
|
|
10
|
+
export const AppBar = defineComponent(appBarContract, ({ title, status, actions, className, ...props }, context) => context.part("root", "header", { ...props, className }, context.part("identity", "div", null, context.part("title", "h1", null, title), status !== undefined && status !== null ? context.part("status", "div", null, status) : null), actions ? context.part("actions", "div", null, actions) : null));
|
|
@@ -3,7 +3,7 @@ export const breadcrumbContract = {
|
|
|
3
3
|
name: "breadcrumb",
|
|
4
4
|
parts: ["root", "list", "item", "link", "current", "separator"],
|
|
5
5
|
};
|
|
6
|
-
export const Breadcrumb = defineComponent(breadcrumbContract, ({ items, label = "
|
|
6
|
+
export const Breadcrumb = defineComponent(breadcrumbContract, ({ items, label = "Current location", className, ...props }, context) => context.part("root", "nav", { ...props, className, "aria-label": label }, context.part("list", "ol", null, items.map((item, index) => context.part("item", "li", null, index ? context.part("separator", "span", { "aria-hidden": "true" }, "/") : null, index === items.length - 1
|
|
7
7
|
? context.part("current", "span", { "aria-current": "page" }, item.label)
|
|
8
8
|
: item.href
|
|
9
9
|
? context.part("link", "a", { href: item.href }, item.label)
|
|
@@ -20,7 +20,7 @@ export const choiceSelectContract = {
|
|
|
20
20
|
};
|
|
21
21
|
let nextChoiceId = 0;
|
|
22
22
|
/** Single-choice listbox. Form participation remains native; data fetching belongs to callers. */
|
|
23
|
-
export const ChoiceSelect = defineComponent(choiceSelectContract, ({ options, value, defaultValue = "", onValueChange, name, id = `choice-${++nextChoiceId}`, disabled = false, required = false, placeholder = "
|
|
23
|
+
export const ChoiceSelect = defineComponent(choiceSelectContract, ({ options, value, defaultValue = "", onValueChange, name, id = `choice-${++nextChoiceId}`, disabled = false, required = false, placeholder = "Select an option", searchable = false, searchPlaceholder = "Search options", emptyMessage = "No matching options", className, placement = "bottom", align = "start", matchTriggerWidth = true, ...props }, context) => {
|
|
24
24
|
const selected = context.signal(value === undefined ? defaultValue : unwrap(value));
|
|
25
25
|
const open = context.signal(false);
|
|
26
26
|
const caption = context.signal(placeholder);
|
|
@@ -27,11 +27,11 @@ export const CodeBlock = defineComponent(codeBlockContract, ({ code, language, d
|
|
|
27
27
|
else
|
|
28
28
|
await copyTextToClipboard(code);
|
|
29
29
|
if (!disposed)
|
|
30
|
-
feedback.value = "
|
|
30
|
+
feedback.value = "Copied";
|
|
31
31
|
}
|
|
32
32
|
catch {
|
|
33
33
|
if (!disposed)
|
|
34
|
-
feedback.value = "
|
|
34
|
+
feedback.value = "Copy failed; select the code and copy it manually.";
|
|
35
35
|
}
|
|
36
36
|
finally {
|
|
37
37
|
if (!disposed)
|
|
@@ -40,15 +40,15 @@ export const CodeBlock = defineComponent(codeBlockContract, ({ code, language, d
|
|
|
40
40
|
};
|
|
41
41
|
return context.part("root", "figure", props, [
|
|
42
42
|
context.part("header", "figcaption", {}, [
|
|
43
|
-
context.part("language", "span", {}, language?.trim() || "
|
|
43
|
+
context.part("language", "span", {}, language?.trim() || "Code"),
|
|
44
44
|
context.part("actions", "div", {}, [
|
|
45
45
|
h(Button, { variant: "quiet", size: "small", "aria-pressed": wrap, onClick: () => {
|
|
46
46
|
wrap.value = wrap.value === "true" ? "false" : "true";
|
|
47
|
-
} }, "
|
|
48
|
-
h(Button, { variant: "quiet", size: "small", disabled: copying, onClick: copy }, "
|
|
47
|
+
} }, "Soft wrap"),
|
|
48
|
+
h(Button, { variant: "quiet", size: "small", disabled: copying, onClick: copy }, "Copy code"),
|
|
49
49
|
]),
|
|
50
50
|
]),
|
|
51
|
-
context.part("content", "pre", { tabIndex: 0, "aria-label": "
|
|
51
|
+
context.part("content", "pre", { tabIndex: 0, "aria-label": "Code content", "data-wrap": wrap }, context.part("code", "code", {
|
|
52
52
|
ref: () => {
|
|
53
53
|
let active = true;
|
|
54
54
|
void highlightCode(code, language).then((spans) => {
|
|
@@ -8,27 +8,27 @@ import { Stack } from "./stack.js";
|
|
|
8
8
|
export function CredentialSource(props) {
|
|
9
9
|
const { id, disabled } = props;
|
|
10
10
|
return (h(Stack, { gap: "compact" },
|
|
11
|
-
h(Field, { label: "API Key
|
|
11
|
+
h(Field, { label: "API Key source", htmlFor: `${id}-source` },
|
|
12
12
|
h(Select, { id: `${id}-source`, value: props.source, disabled: disabled, onChange: (event) => props.onSourceChange(event.target.value) },
|
|
13
|
-
h("option", { value: "stored" }, "
|
|
14
|
-
h("option", { value: "environment" }, "
|
|
13
|
+
h("option", { value: "stored" }, "Enter an API key"),
|
|
14
|
+
h("option", { value: "environment" }, "Use an environment variable"))),
|
|
15
15
|
props.source === "environment" ? (h(Stack, { gap: "compact" },
|
|
16
|
-
h(Field, { label: "
|
|
17
|
-
h(Input, { id: `${id}-environment`, value: props.environmentName, disabled: disabled, autoComplete: "off", list: `${id}-variables`, placeholder: "
|
|
16
|
+
h(Field, { label: "Environment variable name", htmlFor: `${id}-environment`, description: "Stores only the variable name reference; never copies the key. Reads the service runtime environment, independent of the browser machine." },
|
|
17
|
+
h(Input, { id: `${id}-environment`, value: props.environmentName, disabled: disabled, autoComplete: "off", list: `${id}-variables`, placeholder: "For example, KIMI_API_KEY", onInput: (event) => props.onEnvironmentChange(event.target.value) })),
|
|
18
18
|
h("datalist", { id: `${id}-variables` }, props.variables?.map((variable) => (h("option", { value: variable.name })))),
|
|
19
|
-
h(Button, { type: "button", variant: "outline", style: { alignSelf: "start" }, disabled: disabled, onClick: props.onCheck }, "
|
|
19
|
+
h(Button, { type: "button", variant: "outline", style: { alignSelf: "start" }, disabled: disabled, onClick: props.onCheck }, "Check environment variable"),
|
|
20
20
|
props.variables?.map((variable) => (h("span", null,
|
|
21
21
|
variable.name,
|
|
22
22
|
" \u00B7",
|
|
23
23
|
" ",
|
|
24
24
|
variable.available === null
|
|
25
|
-
? "
|
|
25
|
+
? "Read from the WorkCell runtime environment"
|
|
26
26
|
: variable.available
|
|
27
|
-
? "
|
|
28
|
-
: "
|
|
29
|
-
h("span", null, "
|
|
30
|
-
h(Button, { type: "button", variant: "outline", style: { alignSelf: "start" }, disabled: disabled, onClick: props.onReplace }, "
|
|
27
|
+
? "Available"
|
|
28
|
+
: "Not set"))))) : props.keepStored && props.hasStored ? (h(Stack, { gap: "compact" },
|
|
29
|
+
h("span", null, "Saved API Key"),
|
|
30
|
+
h(Button, { type: "button", variant: "outline", style: { alignSelf: "start" }, disabled: disabled, onClick: props.onReplace }, "Replace API Key"))) : (h(Field, { label: "API Key", htmlFor: `${id}-key`, description: "Saved to the credential store; never shown again after saving." },
|
|
31
31
|
h(Input, { id: `${id}-key`, type: "password", value: props.apiKey, disabled: disabled, autoComplete: "new-password", onInput: (event) => props.onKeyChange(event.target.value) }),
|
|
32
|
-
props.hasStored && props.onKeep ? (h(Button, { type: "button", variant: "outline", disabled: disabled, onClick: props.onKeep }, "
|
|
32
|
+
props.hasStored && props.onKeep ? (h(Button, { type: "button", variant: "outline", disabled: disabled, onClick: props.onKeep }, "Keep the saved API Key")) : null)),
|
|
33
33
|
props.status ? h("span", { role: "status" }, props.status) : null));
|
|
34
34
|
}
|
|
@@ -14,7 +14,7 @@ export function diffBlockText(files) {
|
|
|
14
14
|
export const DiffBlock = defineComponent(diffBlockContract, ({ files, maxLines, onCopy, ...props }, context) => {
|
|
15
15
|
const added = files.reduce((sum, file) => sum + file.lines.filter((line) => line.kind === "added").length, 0);
|
|
16
16
|
const removed = files.reduce((sum, file) => sum + file.lines.filter((line) => line.kind === "removed").length, 0);
|
|
17
|
-
return context.part("root", "div", props, h(OutputBlock, { title:
|
|
17
|
+
return context.part("root", "div", props, h(OutputBlock, { title: `Changes · +${added} −${removed}`, maxLines: maxLines, onCopy: onCopy, copyText: diffBlockText(files), rows: files.flatMap((file) => [
|
|
18
18
|
context.part("path", "div", {}, file.path),
|
|
19
19
|
...file.lines.map((line) => context.part("line", "div", { "data-diff-kind": line.kind }, [
|
|
20
20
|
marker[line.kind],
|
|
@@ -6,7 +6,7 @@ export const hoverCardContract = {
|
|
|
6
6
|
parts: ["root", "content", "feedback"],
|
|
7
7
|
};
|
|
8
8
|
/** Selectable preview. Popover owns positioning, Escape, outside dismissal and focus. */
|
|
9
|
-
export const HoverCard = defineComponent(hoverCardContract, ({ id, trigger, content, openDelay = 500, disabled = false, className, variant = "compact", widthAnchor, copyText, copyLabel = "
|
|
9
|
+
export const HoverCard = defineComponent(hoverCardContract, ({ id, trigger, content, openDelay = 500, disabled = false, className, variant = "compact", widthAnchor, copyText, copyLabel = "Copy", copiedLabel = "Copied", onCopy, }, context) => {
|
|
10
10
|
const open = context.signal(false);
|
|
11
11
|
let timer;
|
|
12
12
|
let hovered = false;
|
|
@@ -53,7 +53,7 @@ export const HoverCard = defineComponent(hoverCardContract, ({ id, trigger, cont
|
|
|
53
53
|
}
|
|
54
54
|
catch {
|
|
55
55
|
if (alive && open.value && session === copySession)
|
|
56
|
-
feedback.value = "
|
|
56
|
+
feedback.value = "Copy failed; select the text and try again.";
|
|
57
57
|
}
|
|
58
58
|
finally {
|
|
59
59
|
copying = false;
|
|
@@ -5,7 +5,7 @@ export const imageLightboxContract = {
|
|
|
5
5
|
parts: ["root", "trigger", "dialog", "image", "caption", "close"],
|
|
6
6
|
};
|
|
7
7
|
/** Native modal top layer keeps the preview independent of transformed ancestors. */
|
|
8
|
-
export const ImageLightbox = defineComponent(imageLightboxContract, ({ src, alt, caption, trigger = "
|
|
8
|
+
export const ImageLightbox = defineComponent(imageLightboxContract, ({ src, alt, caption, trigger = "Preview image", onClose, ...props }, context) => {
|
|
9
9
|
let dialog;
|
|
10
10
|
let opener;
|
|
11
11
|
return context.part("root", "div", props, [
|
|
@@ -20,7 +20,7 @@ export const ImageLightbox = defineComponent(imageLightboxContract, ({ src, alt,
|
|
|
20
20
|
onClick: () => dialog?.showModal(),
|
|
21
21
|
}, trigger),
|
|
22
22
|
context.part("dialog", "dialog", {
|
|
23
|
-
"aria-label": alt || "
|
|
23
|
+
"aria-label": alt || "Image preview",
|
|
24
24
|
ref: (node) => {
|
|
25
25
|
dialog = node;
|
|
26
26
|
return () => {
|
|
@@ -41,7 +41,7 @@ export const ImageLightbox = defineComponent(imageLightboxContract, ({ src, alt,
|
|
|
41
41
|
context.part("close", "button", {
|
|
42
42
|
type: "button",
|
|
43
43
|
autoFocus: true,
|
|
44
|
-
"aria-label": "
|
|
44
|
+
"aria-label": "Close image preview",
|
|
45
45
|
onClick: () => dialog?.close(),
|
|
46
46
|
}, "×"),
|
|
47
47
|
context.part("image", "div", null, h(ImagePreview, { src: src, alt: alt })),
|
|
@@ -5,7 +5,7 @@ export const imagePreviewContract = {
|
|
|
5
5
|
parts: ["root", "image", "status"],
|
|
6
6
|
};
|
|
7
7
|
/** Passive media display; navigation, preview activation and URL authorization belong to the host. */
|
|
8
|
-
export const ImagePreview = defineComponent(imagePreviewContract, ({ src, alt, loading = "lazy", loadingLabel = "
|
|
8
|
+
export const ImagePreview = defineComponent(imagePreviewContract, ({ src, alt, loading = "lazy", loadingLabel = "Loading image", failedLabel = "Failed to load image", onLoad, onError, ...props }, context) => {
|
|
9
9
|
const state = context.signal("loading");
|
|
10
10
|
return context.part("root", "span", { ...props, "data-image-state": state }, [
|
|
11
11
|
context.part("image", "img", {
|
|
@@ -17,6 +17,8 @@ export { Field, type FieldProps, fieldContract } from "./field.js";
|
|
|
17
17
|
export { CredentialSource, type CredentialSourceProps } from "./credential-source.js";
|
|
18
18
|
export { IconButton, type IconButtonProps, iconButtonContract, iconButtonOptions, } from "./icon-button.js";
|
|
19
19
|
export { Toolbar, type ToolbarProps, toolbarContract } from "./toolbar.js";
|
|
20
|
+
export { ActionRail, type ActionRailProps, actionRailContract } from "./action-rail.js";
|
|
21
|
+
export { MetaRow, type MetaItem, type MetaRowProps, metaRowContract, metaRowOptions, } from "./meta-row.js";
|
|
20
22
|
export { Input, type InputProps, inputContract } from "./input.js";
|
|
21
23
|
export { Checkbox, type CheckboxProps, checkboxContract } from "./checkbox.js";
|
|
22
24
|
export { Switch, type SwitchProps, switchContract } from "./switch.js";
|
|
@@ -31,6 +33,7 @@ export { Separator, type SeparatorProps, separatorContract } from "./separator.j
|
|
|
31
33
|
export { Textarea, type TextareaProps, textareaContract } from "./textarea.js";
|
|
32
34
|
export { Stack, type StackProps, stackContract } from "./stack.js";
|
|
33
35
|
export { PageFrame, type PageFrameProps, pageFrameContract, pageFrameOptions } from "./page-frame.js";
|
|
36
|
+
export { AppBar, type AppBarProps, appBarContract } from "./app-bar.js";
|
|
34
37
|
export { mountRegionLayout, regionLayoutContract, type RegionRoots, type RegionLayoutSurface, type RegionLayoutOptions, } from "./region-layout.js";
|
|
35
38
|
export { validateRegionLayout, type RegionDescription, type RegionLayoutDescription, } from "./region-layout-types.js";
|
|
36
39
|
export { LayoutItem, type LayoutItemProps, layoutItemContract } from "./layout-item.js";
|
|
@@ -68,6 +71,7 @@ export { SearchBlock, searchBlockContract, type SearchBlockProps, type SearchFil
|
|
|
68
71
|
export { Pill, pillContract, type PillProps } from "./pill.js";
|
|
69
72
|
export { ImagePreview, imagePreviewContract, type ImagePreviewProps } from "./image-preview.js";
|
|
70
73
|
export { StatusDot, type StatusDotProps, type StatusDotState, statusDotContract, statusDotOptions, } from "./status-dot.js";
|
|
74
|
+
export { Status, type StatusProps, statusContract } from "./status.js";
|
|
71
75
|
export { Tag, type TagProps, tagContract, tagOptions } from "./tag.js";
|
|
72
76
|
export { ProcessGroup, type ProcessGroupProps, processGroupContract } from "./process-group.js";
|
|
73
77
|
export { ProcessStep, type ProcessStepProps, processStepContract } from "./process-step.js";
|
|
@@ -17,6 +17,8 @@ export { Field, fieldContract } from "./field.js";
|
|
|
17
17
|
export { CredentialSource } from "./credential-source.js";
|
|
18
18
|
export { IconButton, iconButtonContract, iconButtonOptions, } from "./icon-button.js";
|
|
19
19
|
export { Toolbar, toolbarContract } from "./toolbar.js";
|
|
20
|
+
export { ActionRail, actionRailContract } from "./action-rail.js";
|
|
21
|
+
export { MetaRow, metaRowContract, metaRowOptions, } from "./meta-row.js";
|
|
20
22
|
export { Input, inputContract } from "./input.js";
|
|
21
23
|
export { Checkbox, checkboxContract } from "./checkbox.js";
|
|
22
24
|
export { Switch, switchContract } from "./switch.js";
|
|
@@ -31,6 +33,7 @@ export { Separator, separatorContract } from "./separator.js";
|
|
|
31
33
|
export { Textarea, textareaContract } from "./textarea.js";
|
|
32
34
|
export { Stack, stackContract } from "./stack.js";
|
|
33
35
|
export { PageFrame, pageFrameContract, pageFrameOptions } from "./page-frame.js";
|
|
36
|
+
export { AppBar, appBarContract } from "./app-bar.js";
|
|
34
37
|
export { mountRegionLayout, regionLayoutContract, } from "./region-layout.js";
|
|
35
38
|
export { validateRegionLayout, } from "./region-layout-types.js";
|
|
36
39
|
export { LayoutItem, layoutItemContract } from "./layout-item.js";
|
|
@@ -67,6 +70,7 @@ export { SearchBlock, searchBlockContract, } from "./search-block.js";
|
|
|
67
70
|
export { Pill, pillContract } from "./pill.js";
|
|
68
71
|
export { ImagePreview, imagePreviewContract } from "./image-preview.js";
|
|
69
72
|
export { StatusDot, statusDotContract, statusDotOptions, } from "./status-dot.js";
|
|
73
|
+
export { Status, statusContract } from "./status.js";
|
|
70
74
|
export { Tag, tagContract, tagOptions } from "./tag.js";
|
|
71
75
|
export { ProcessGroup, processGroupContract } from "./process-group.js";
|
|
72
76
|
export { ProcessStep, processStepContract } from "./process-step.js";
|
|
@@ -19,7 +19,7 @@ export const JsonBlock = defineComponent(jsonBlockContract, ({ text, payload, la
|
|
|
19
19
|
JSON.parse(text);
|
|
20
20
|
}
|
|
21
21
|
catch {
|
|
22
|
-
error = "JSON
|
|
22
|
+
error = "Invalid JSON; showing the original text.";
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
@@ -28,7 +28,7 @@ export const JsonBlock = defineComponent(jsonBlockContract, ({ text, payload, la
|
|
|
28
28
|
}
|
|
29
29
|
catch {
|
|
30
30
|
content = String(payload);
|
|
31
|
-
error = "
|
|
31
|
+
error = "Cannot serialize to JSON; showing the value's text representation.";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
body.value = [
|
|
@@ -37,11 +37,11 @@ export const JsonTree = defineComponent(jsonTreeContract, ({ data, label = "JSON
|
|
|
37
37
|
try {
|
|
38
38
|
await (onCopy ?? copyTextToClipboard)(JSON.stringify(data, null, 2));
|
|
39
39
|
if (alive)
|
|
40
|
-
feedback.value = "
|
|
40
|
+
feedback.value = "Copied";
|
|
41
41
|
}
|
|
42
42
|
catch {
|
|
43
43
|
if (alive)
|
|
44
|
-
feedback.value = "
|
|
44
|
+
feedback.value = "Copy failed";
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
const copyButton = context.part("copy", "button", {
|
|
@@ -50,7 +50,7 @@ export const JsonTree = defineComponent(jsonTreeContract, ({ data, label = "JSON
|
|
|
50
50
|
event.stopPropagation();
|
|
51
51
|
void copy();
|
|
52
52
|
},
|
|
53
|
-
"aria-label":
|
|
53
|
+
"aria-label": `Copy ${label}`,
|
|
54
54
|
}, h(Icon, { name: "copy", size: 12 }));
|
|
55
55
|
const summary = container
|
|
56
56
|
? `${Array.isArray(data) ? "Array" : "Object"}(${Object.keys(data).length})`
|
|
@@ -9,8 +9,9 @@ export const LayoutItem = defineComponent(layoutItemContract, ({ as = "div", gro
|
|
|
9
9
|
style: layoutStyle(props.style, {
|
|
10
10
|
flexGrow: grow ? 1 : 0,
|
|
11
11
|
flexShrink: shrink ? 1 : 0,
|
|
12
|
-
flexBasis: basis,
|
|
12
|
+
flexBasis: typeof basis === "number" ? `${basis}px` : basis,
|
|
13
13
|
alignSelf,
|
|
14
14
|
minWidth: 0,
|
|
15
|
+
minHeight: 0,
|
|
15
16
|
}),
|
|
16
17
|
}, children));
|
|
@@ -5,7 +5,7 @@ export declare const layoutOptions: import("meowcss").Options<{
|
|
|
5
5
|
readonly rowGap: readonly ["auto", "none", "compact", "normal", "relaxed"];
|
|
6
6
|
readonly columnGap: readonly ["auto", "none", "compact", "normal", "relaxed"];
|
|
7
7
|
}>;
|
|
8
|
-
export type LayoutElement = "div" | "section" | "nav" | "main" | "aside" | "header" | "footer" | "article" | "ol";
|
|
8
|
+
export type LayoutElement = "div" | "span" | "section" | "nav" | "main" | "aside" | "header" | "footer" | "article" | "ol";
|
|
9
9
|
export type LayoutGap = (typeof layoutOptions.axes.gap)[number];
|
|
10
10
|
export type LayoutAlign = "start" | "center" | "end" | "stretch" | "baseline";
|
|
11
11
|
export type LayoutJustify = "start" | "center" | "end" | "between";
|
|
@@ -14,7 +14,7 @@ export declare const listRowContract: {
|
|
|
14
14
|
};
|
|
15
15
|
export interface ListRowProps extends Props {
|
|
16
16
|
title: Child;
|
|
17
|
-
/** Tags beside the title, such as "CLI" or "
|
|
17
|
+
/** Tags beside the title, such as "CLI" or "Default". */
|
|
18
18
|
tags?: Child;
|
|
19
19
|
description?: Child;
|
|
20
20
|
/** A state in words with its dot; the row's only status. */
|
|
@@ -152,11 +152,11 @@ export const Menu = defineComponent(menuContract, ({ id, trigger, items, open, o
|
|
|
152
152
|
if (event.key === "End")
|
|
153
153
|
next = rows.length - 1;
|
|
154
154
|
if (event.key === "Tab") {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
// Dismiss the whole action surface, then let native Tab continue from
|
|
156
|
+
// its restored trigger. Moving focus must never activate an action.
|
|
157
|
+
request(false);
|
|
158
|
+
closeAncestors?.();
|
|
159
|
+
event.stopPropagation();
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
if (event.key.length === 1 && event.key !== " ") {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ThemedProps } from "meowcss/meowjsx";
|
|
2
|
+
import { type Child, type Props } from "meowjsx";
|
|
3
|
+
export declare const metaRowOptions: import("meowcss").Options<{
|
|
4
|
+
readonly align: readonly ["start", "center"];
|
|
5
|
+
readonly progressTone: readonly ["neutral", "accent"];
|
|
6
|
+
}>;
|
|
7
|
+
export declare const metaRowContract: {
|
|
8
|
+
readonly name: "meta-row";
|
|
9
|
+
readonly parts: readonly ["root", "item", "icon", "label", "separator", "progress"];
|
|
10
|
+
readonly styleProps: import("meowcss/meowjsx").StylePropsBinding<import("meowcss").Options<{
|
|
11
|
+
readonly align: readonly ["start", "center"];
|
|
12
|
+
readonly progressTone: readonly ["neutral", "accent"];
|
|
13
|
+
}>>;
|
|
14
|
+
};
|
|
15
|
+
export interface MetaItem {
|
|
16
|
+
/** Decorative glyph that helps identify the fact. */
|
|
17
|
+
icon?: Child;
|
|
18
|
+
/** Short, scannable fact text. */
|
|
19
|
+
label: Child;
|
|
20
|
+
}
|
|
21
|
+
export interface MetaRowProps extends Props, ThemedProps<typeof metaRowOptions> {
|
|
22
|
+
items: readonly MetaItem[];
|
|
23
|
+
/** Finite values clamp to 0–100; non-finite values omit the progress segment. */
|
|
24
|
+
progress?: number;
|
|
25
|
+
/** Accessible name for the progress segment. */
|
|
26
|
+
progressLabel?: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A page-level fact row. Items keep separators, wrap instead of clipping, and
|
|
31
|
+
* carry facts as text; the optional progress segment is one more fact.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MetaRow: import("meowjsx").Component<MetaRowProps, "meta-row", "icon" | "item" | "label" | "progress" | "root" | "separator">;
|