meowtail 0.2.0-alpha.0 → 0.2.0-alpha.2

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.
Files changed (163) hide show
  1. package/AGENT-COMPONENTS.md +65 -65
  2. package/ASSISTANT.md +35 -35
  3. package/JSON.md +11 -11
  4. package/README.md +413 -385
  5. package/THIRD_PARTY_NOTICES.md +8 -0
  6. package/dist/src/chat/assistant-composer.js +58 -98
  7. package/dist/src/chat/assistant-content.d.ts +1 -3
  8. package/dist/src/chat/assistant-content.js +36 -44
  9. package/dist/src/chat/assistant-markdown.js +4 -8
  10. package/dist/src/chat/assistant-question.js +13 -14
  11. package/dist/src/chat/assistant.js +27 -26
  12. package/dist/src/chat/attachments.d.ts +3 -2
  13. package/dist/src/chat/attachments.js +43 -34
  14. package/dist/src/chat/composer-panel.d.ts +16 -0
  15. package/dist/src/chat/composer-panel.js +11 -0
  16. package/dist/src/chat/composer.d.ts +7 -3
  17. package/dist/src/chat/composer.js +71 -22
  18. package/dist/src/chat/conversation.js +2 -2
  19. package/dist/src/chat/index.d.ts +1 -0
  20. package/dist/src/chat/index.js +1 -0
  21. package/dist/src/chat/message-list.js +1 -1
  22. package/dist/src/chat/message.js +3 -3
  23. package/dist/src/chat/question.js +1 -1
  24. package/dist/src/chat/sources.js +1 -1
  25. package/dist/src/chat/task.js +9 -15
  26. package/dist/src/chat/tool-call.js +7 -14
  27. package/dist/src/components/accordion.d.ts +24 -0
  28. package/dist/src/components/accordion.js +50 -0
  29. package/dist/src/components/action-rail.d.ts +19 -0
  30. package/dist/src/components/action-rail.js +13 -0
  31. package/dist/src/components/add-button.js +1 -1
  32. package/dist/src/components/alert.d.ts +2 -0
  33. package/dist/src/components/alert.js +2 -1
  34. package/dist/src/components/app-bar.d.ts +17 -0
  35. package/dist/src/components/app-bar.js +10 -0
  36. package/dist/src/components/avatar.d.ts +22 -0
  37. package/dist/src/components/avatar.js +44 -0
  38. package/dist/src/components/breadcrumb.js +1 -1
  39. package/dist/src/components/checkbox.d.ts +6 -2
  40. package/dist/src/components/checkbox.js +36 -8
  41. package/dist/src/components/choice-group.d.ts +1 -0
  42. package/dist/src/components/choice-group.js +12 -17
  43. package/dist/src/components/choice-select.d.ts +3 -1
  44. package/dist/src/components/choice-select.js +56 -54
  45. package/dist/src/components/code-block.d.ts +3 -3
  46. package/dist/src/components/code-block.js +31 -27
  47. package/dist/src/components/context-menu.d.ts +16 -0
  48. package/dist/src/components/context-menu.js +49 -0
  49. package/dist/src/components/credential-source.js +12 -12
  50. package/dist/src/components/diff-block.js +1 -1
  51. package/dist/src/components/disclosure.d.ts +2 -2
  52. package/dist/src/components/disclosure.js +1 -1
  53. package/dist/src/components/hover-card.js +2 -2
  54. package/dist/src/components/image-lightbox.js +3 -3
  55. package/dist/src/components/image-preview.js +1 -1
  56. package/dist/src/components/index.d.ts +12 -0
  57. package/dist/src/components/index.js +12 -0
  58. package/dist/src/components/json-block.js +2 -2
  59. package/dist/src/components/json-tree.js +3 -3
  60. package/dist/src/components/link.d.ts +13 -0
  61. package/dist/src/components/link.js +9 -0
  62. package/dist/src/components/list-group.d.ts +1 -1
  63. package/dist/src/components/menu-button.d.ts +13 -0
  64. package/dist/src/components/menu-button.js +10 -0
  65. package/dist/src/components/menu.d.ts +4 -0
  66. package/dist/src/components/menu.js +3 -3
  67. package/dist/src/components/meta-row.d.ts +34 -0
  68. package/dist/src/components/meta-row.js +61 -0
  69. package/dist/src/components/nav-item.js +2 -5
  70. package/dist/src/components/number-input.d.ts +29 -0
  71. package/dist/src/components/number-input.js +137 -0
  72. package/dist/src/components/output-block.js +8 -15
  73. package/dist/src/components/page-frame.d.ts +6 -2
  74. package/dist/src/components/page-frame.js +2 -2
  75. package/dist/src/components/path-picker.js +9 -14
  76. package/dist/src/components/pill.js +2 -5
  77. package/dist/src/components/popover.js +4 -4
  78. package/dist/src/components/process-group.d.ts +2 -2
  79. package/dist/src/components/progress.d.ts +15 -0
  80. package/dist/src/components/progress.js +12 -0
  81. package/dist/src/components/rail-item.d.ts +2 -2
  82. package/dist/src/components/rail-section.d.ts +1 -1
  83. package/dist/src/components/read-block.js +2 -2
  84. package/dist/src/components/resource-card.d.ts +1 -1
  85. package/dist/src/components/resource-link.d.ts +1 -1
  86. package/dist/src/components/risk-confirmation.js +2 -5
  87. package/dist/src/components/search-block.js +2 -3
  88. package/dist/src/components/segmented-control.js +3 -3
  89. package/dist/src/components/skeleton-boundary.js +4 -7
  90. package/dist/src/components/slider.d.ts +22 -0
  91. package/dist/src/components/slider.js +49 -0
  92. package/dist/src/components/table.d.ts +41 -0
  93. package/dist/src/components/table.js +146 -0
  94. package/dist/src/components/tabs.d.ts +1 -1
  95. package/dist/src/components/tabs.js +11 -20
  96. package/dist/src/components/terminal-block.js +6 -6
  97. package/dist/src/components/text-shimmer.js +2 -5
  98. package/dist/src/components/web-block.js +3 -3
  99. package/dist/src/components/work-card.d.ts +2 -2
  100. package/dist/src/components/work-card.js +1 -1
  101. package/dist/src/icons/README.md +13 -2
  102. package/dist/src/icons/icon-frame.d.ts +11 -0
  103. package/dist/src/icons/icon-frame.js +4 -0
  104. package/dist/src/icons/icon-source.d.ts +17 -0
  105. package/dist/src/icons/icon-source.js +6 -0
  106. package/dist/src/icons/icon.d.ts +44 -37
  107. package/dist/src/icons/icon.js +55 -128
  108. package/dist/src/icons/index.d.ts +1 -0
  109. package/dist/src/icons/index.js +1 -0
  110. package/dist/src/icons/lucide.d.ts +1 -0
  111. package/dist/src/icons/lucide.js +4 -0
  112. package/dist/src/registry/index.d.ts +99 -5
  113. package/dist/src/registry/index.js +28 -3
  114. package/dist/src/shared/execution-state.js +7 -7
  115. package/dist/src/theme/chat/composer-panel.styles.d.ts +1 -0
  116. package/dist/src/theme/chat/composer-panel.styles.js +47 -0
  117. package/dist/src/theme/chat/composer.styles.js +69 -60
  118. package/dist/src/theme/chat/task.styles.js +5 -6
  119. package/dist/src/theme/components/accordion.styles.d.ts +1 -0
  120. package/dist/src/theme/components/accordion.styles.js +63 -0
  121. package/dist/src/theme/components/action-rail.styles.d.ts +1 -0
  122. package/dist/src/theme/components/action-rail.styles.js +47 -0
  123. package/dist/src/theme/components/alert.styles.js +42 -1
  124. package/dist/src/theme/components/app-bar.styles.d.ts +1 -0
  125. package/dist/src/theme/components/app-bar.styles.js +48 -0
  126. package/dist/src/theme/components/avatar.styles.d.ts +1 -0
  127. package/dist/src/theme/components/avatar.styles.js +52 -0
  128. package/dist/src/theme/components/button.styles.js +9 -0
  129. package/dist/src/theme/components/card.styles.js +2 -0
  130. package/dist/src/theme/components/code-block.styles.js +7 -0
  131. package/dist/src/theme/components/context-menu.styles.d.ts +1 -0
  132. package/dist/src/theme/components/context-menu.styles.js +14 -0
  133. package/dist/src/theme/components/dialog.styles.js +7 -0
  134. package/dist/src/theme/components/link.styles.d.ts +1 -0
  135. package/dist/src/theme/components/link.styles.js +33 -0
  136. package/dist/src/theme/components/list-group.styles.js +1 -0
  137. package/dist/src/theme/components/menu.styles.js +9 -3
  138. package/dist/src/theme/components/meta-row.styles.d.ts +1 -0
  139. package/dist/src/theme/components/meta-row.styles.js +66 -0
  140. package/dist/src/theme/components/number-input.styles.d.ts +1 -0
  141. package/dist/src/theme/components/number-input.styles.js +106 -0
  142. package/dist/src/theme/components/output-block.styles.js +9 -0
  143. package/dist/src/theme/components/page-frame.styles.js +7 -1
  144. package/dist/src/theme/components/page-header.styles.js +7 -0
  145. package/dist/src/theme/components/progress.styles.d.ts +1 -0
  146. package/dist/src/theme/components/progress.styles.js +71 -0
  147. package/dist/src/theme/components/resource-card.styles.js +7 -0
  148. package/dist/src/theme/components/slider.styles.d.ts +1 -0
  149. package/dist/src/theme/components/slider.styles.js +129 -0
  150. package/dist/src/theme/components/table.styles.d.ts +1 -0
  151. package/dist/src/theme/components/table.styles.js +156 -0
  152. package/dist/src/theme/components/tag.styles.js +3 -3
  153. package/dist/src/theme/components/toggle.styles.js +10 -0
  154. package/dist/src/theme/components/toolbar.styles.js +7 -0
  155. package/dist/src/theme/index.d.ts +15 -15
  156. package/dist/src/theme/index.js +24 -0
  157. package/dist/src/theme/palette.d.ts +1 -1
  158. package/dist/src/theme/palette.js +1 -1
  159. package/dist/src/theme/shared/code-highlight.tokens.d.ts +6 -6
  160. package/dist/src/theme/shared/code-highlight.tokens.js +6 -6
  161. package/dist/src/theme/tokens.d.ts +7 -7
  162. package/dist/src/theme/tokens.js +14 -8
  163. package/package.json +9 -4
@@ -1,11 +1,11 @@
1
- import { type Props } from "meowjsx";
1
+ import { type MaybeSignal, type Props } from "meowjsx";
2
2
  export declare const codeBlockContract: {
3
3
  readonly name: "code-block";
4
4
  readonly parts: readonly ["root", "header", "language", "actions", "content", "code", "feedback"];
5
5
  };
6
6
  export interface CodeBlockProps extends Props {
7
- code: string;
8
- language?: string;
7
+ code: MaybeSignal<string>;
8
+ language?: MaybeSignal<string | undefined>;
9
9
  defaultWrap?: boolean;
10
10
  /** Hosts may supply a clipboard implementation; the default uses the browser clipboard. */
11
11
  onCopy?: (code: string) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { defineComponent, h } from "meowjsx";
1
+ import { defineComponent, derived, h, unwrap, } from "meowjsx";
2
2
  import { Button } from "./button.js";
3
3
  import { copyTextToClipboard } from "../clipboard.js";
4
4
  import { highlightCode } from "../syntax-highlight.js";
@@ -11,27 +11,48 @@ export const CodeBlock = defineComponent(codeBlockContract, ({ code, language, d
11
11
  const wrap = context.signal(defaultWrap ? "true" : "false");
12
12
  const copying = context.signal(false);
13
13
  const feedback = context.signal("");
14
- const highlighted = context.signal(code);
14
+ const highlighted = context.signal(unwrap(code));
15
+ const languageLabel = derived(() => unwrap(language)?.trim() || "Code");
15
16
  let disposed = false;
16
17
  context.onCleanup(() => {
17
18
  disposed = true;
18
19
  });
20
+ context.effect(() => {
21
+ const currentCode = unwrap(code);
22
+ const currentLanguage = unwrap(language);
23
+ highlighted.value = currentCode;
24
+ let active = true;
25
+ void highlightCode(currentCode, currentLanguage).then((spans) => {
26
+ if (!active || disposed || !spans)
27
+ return;
28
+ highlighted.value = spans.map((span) => (h("span", { style: {
29
+ color: span.color,
30
+ fontStyle: (span.fontStyle ?? 0) & 1 ? "italic" : undefined,
31
+ fontWeight: (span.fontStyle ?? 0) & 2 ? "bold" : undefined,
32
+ textDecoration: (span.fontStyle ?? 0) & 4 ? "underline" : undefined,
33
+ } }, span.text)));
34
+ });
35
+ return () => {
36
+ active = false;
37
+ };
38
+ });
19
39
  const copy = async () => {
20
40
  if (copying.value)
21
41
  return;
22
42
  copying.value = true;
23
43
  feedback.value = "";
44
+ const text = unwrap(code);
24
45
  try {
25
46
  if (onCopy)
26
- await onCopy(code);
47
+ await onCopy(text);
27
48
  else
28
- await copyTextToClipboard(code);
49
+ await copyTextToClipboard(text);
29
50
  if (!disposed)
30
- feedback.value = "已复制";
51
+ feedback.value = "Copied";
31
52
  }
32
53
  catch {
33
54
  if (!disposed)
34
- feedback.value = "复制失败,请选择代码后手动复制。";
55
+ feedback.value = "Copy failed; select the code and copy it manually.";
35
56
  }
36
57
  finally {
37
58
  if (!disposed)
@@ -40,32 +61,15 @@ export const CodeBlock = defineComponent(codeBlockContract, ({ code, language, d
40
61
  };
41
62
  return context.part("root", "figure", props, [
42
63
  context.part("header", "figcaption", {}, [
43
- context.part("language", "span", {}, language?.trim() || "代码"),
64
+ context.part("language", "span", {}, languageLabel),
44
65
  context.part("actions", "div", {}, [
45
66
  h(Button, { variant: "quiet", size: "small", "aria-pressed": wrap, onClick: () => {
46
67
  wrap.value = wrap.value === "true" ? "false" : "true";
47
- } }, "\u81EA\u52A8\u6362\u884C"),
48
- h(Button, { variant: "quiet", size: "small", disabled: copying, onClick: copy }, "\u590D\u5236\u4EE3\u7801"),
68
+ } }, "Soft wrap"),
69
+ h(Button, { variant: "quiet", size: "small", disabled: copying, onClick: copy }, "Copy code"),
49
70
  ]),
50
71
  ]),
51
- context.part("content", "pre", { tabIndex: 0, "aria-label": "代码内容", "data-wrap": wrap }, context.part("code", "code", {
52
- ref: () => {
53
- let active = true;
54
- void highlightCode(code, language).then((spans) => {
55
- if (!active || disposed || !spans)
56
- return;
57
- highlighted.value = spans.map((span) => (h("span", { style: {
58
- color: span.color,
59
- fontStyle: (span.fontStyle ?? 0) & 1 ? "italic" : undefined,
60
- fontWeight: (span.fontStyle ?? 0) & 2 ? "bold" : undefined,
61
- textDecoration: (span.fontStyle ?? 0) & 4 ? "underline" : undefined,
62
- } }, span.text)));
63
- });
64
- return () => {
65
- active = false;
66
- };
67
- },
68
- }, highlighted)),
72
+ context.part("content", "pre", { tabIndex: 0, "aria-label": "Code content", "data-wrap": wrap }, context.part("code", "code", null, highlighted)),
69
73
  context.part("feedback", "span", { role: "status", "aria-live": "polite" }, feedback),
70
74
  ]);
71
75
  });
@@ -0,0 +1,16 @@
1
+ import { type Child, type MaybeSignal, type Props } from "meowjsx";
2
+ import { type MenuEntry } from "./menu.js";
3
+ export declare const contextMenuContract: {
4
+ readonly name: "context-menu";
5
+ readonly parts: readonly ["root"];
6
+ };
7
+ export interface ContextMenuProps extends Props {
8
+ id: string;
9
+ items: readonly MenuEntry[];
10
+ open?: MaybeSignal<boolean>;
11
+ onOpenChange?: (open: boolean) => void;
12
+ className?: string;
13
+ children?: Child;
14
+ }
15
+ /** Right-click or Shift+F10 opens the existing Menu, including nested items. */
16
+ export declare const ContextMenu: import("meowjsx").Component<ContextMenuProps, "context-menu", "root">;
@@ -0,0 +1,49 @@
1
+ import { defineComponent, h, unwrap, } from "meowjsx";
2
+ import { Menu } from "./menu.js";
3
+ export const contextMenuContract = {
4
+ name: "context-menu",
5
+ parts: ["root"],
6
+ };
7
+ /** Right-click or Shift+F10 opens the existing Menu, including nested items. */
8
+ export const ContextMenu = defineComponent(contextMenuContract, ({ id, items, open, onOpenChange, className, children, ...props }, context) => {
9
+ const local = context.signal(false);
10
+ const state = open !== undefined ? open : local;
11
+ let point = { x: 0, y: 0 };
12
+ const request = (next) => {
13
+ if (open === undefined)
14
+ local.value = next;
15
+ onOpenChange?.(next);
16
+ };
17
+ const openAt = (x, y) => {
18
+ const reopen = unwrap(state);
19
+ point = { x, y };
20
+ if (reopen) {
21
+ request(false);
22
+ queueMicrotask(() => request(true));
23
+ return;
24
+ }
25
+ request(true);
26
+ };
27
+ return (h(Menu, { id: id, items: items, open: state, onOpenChange: request, anchorRect: () => new DOMRect(point.x, point.y, 0, 0), trigger: (bindings) => context.part("root", "div", {
28
+ ...props,
29
+ id: bindings.id,
30
+ "aria-controls": bindings["aria-controls"],
31
+ "aria-expanded": bindings["aria-expanded"],
32
+ "aria-haspopup": bindings["aria-haspopup"],
33
+ className,
34
+ tabIndex: -1,
35
+ onContextMenu: (event) => {
36
+ event.preventDefault();
37
+ openAt(event.clientX, event.clientY);
38
+ },
39
+ onKeyDown: (event) => {
40
+ if (event.isComposing || event.altKey || event.ctrlKey || event.metaKey)
41
+ return;
42
+ if (event.key === "ContextMenu" || (event.key === "F10" && event.shiftKey)) {
43
+ event.preventDefault();
44
+ const box = event.currentTarget.getBoundingClientRect();
45
+ openAt(box.left, box.bottom);
46
+ }
47
+ },
48
+ }, children) }));
49
+ });
@@ -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 \u6765\u6E90", htmlFor: `${id}-source` },
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" }, "\u8F93\u5165 API Key"),
14
- h("option", { value: "environment" }, "\u4F7F\u7528\u73AF\u5883\u53D8\u91CF"))),
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: "\u73AF\u5883\u53D8\u91CF\u540D", htmlFor: `${id}-environment`, description: "\u53EA\u4FDD\u5B58\u53D8\u91CF\u540D\u5F15\u7528\uFF0C\u4E0D\u590D\u5236 Key\u3002\u8BFB\u53D6\u670D\u52A1\u8FD0\u884C\u73AF\u5883\uFF0C\u4E0E\u6D4F\u89C8\u5668\u6240\u5728\u673A\u5668\u65E0\u5173\u3002" },
17
- h(Input, { id: `${id}-environment`, value: props.environmentName, disabled: disabled, autoComplete: "off", list: `${id}-variables`, placeholder: "\u4F8B\u5982 KIMI_API_KEY", onInput: (event) => props.onEnvironmentChange(event.target.value) })),
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 }, "\u68C0\u67E5\u73AF\u5883\u53D8\u91CF"),
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
- ? "在 WorkCell 运行环境中读取"
25
+ ? "Read from the WorkCell runtime environment"
26
26
  : variable.available
27
- ? "可用"
28
- : "未设置"))))) : props.keepStored && props.hasStored ? (h(Stack, { gap: "compact" },
29
- h("span", null, "\u5DF2\u4FDD\u5B58 API Key"),
30
- h(Button, { type: "button", variant: "outline", style: { alignSelf: "start" }, disabled: disabled, onClick: props.onReplace }, "\u66FF\u6362 API Key"))) : (h(Field, { label: "API Key", htmlFor: `${id}-key`, description: "\u4FDD\u5B58\u5230\u51ED\u636E\u5E93\uFF0C\u4FDD\u5B58\u540E\u4E0D\u56DE\u663E\u3002" },
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 }, "\u4FDD\u7559\u5DF2\u4FDD\u5B58\u7684 API Key")) : null)),
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: `变更 · +${added} −${removed}`, maxLines: maxLines, onCopy: onCopy, copyText: diffBlockText(files), rows: files.flatMap((file) => [
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],
@@ -1,11 +1,11 @@
1
- import { type Child, type Props } from "meowjsx";
1
+ import { type Child, type MaybeSignal, type Props } from "meowjsx";
2
2
  export declare const disclosureContract: {
3
3
  readonly name: "disclosure";
4
4
  readonly parts: readonly ["root", "summary", "icon", "content"];
5
5
  };
6
6
  export interface DisclosureProps extends Props {
7
7
  summary: Child;
8
- open?: boolean;
8
+ open?: MaybeSignal<boolean>;
9
9
  onToggle?: (event: Event) => void;
10
10
  className?: string;
11
11
  summaryClassName?: string;
@@ -1,4 +1,4 @@
1
- import { defineComponent, h } from "meowjsx";
1
+ import { defineComponent, h, } from "meowjsx";
2
2
  import { Icon } from "../icons/icon.js";
3
3
  export const disclosureContract = {
4
4
  name: "disclosure",
@@ -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 = "复制", copiedLabel = "已复制", onCopy, }, context) => {
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 = "预览图片", onClose, ...props }, context) => {
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 = "正在加载图片", failedLabel = "图片加载失败", onLoad, onError, ...props }, context) => {
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,8 +17,15 @@ 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";
23
+ export { NumberInput, type NumberInputProps, numberInputContract, clampNumber, formatNumber, numberPrecision, } from "./number-input.js";
21
24
  export { Checkbox, type CheckboxProps, checkboxContract } from "./checkbox.js";
25
+ export { Slider, type SliderProps, sliderContract } from "./slider.js";
26
+ export { Progress, type ProgressProps, progressContract } from "./progress.js";
27
+ export { Avatar, type AvatarProps, avatarContract, avatarOptions, initialsFromName, } from "./avatar.js";
28
+ export { Link, type LinkProps, linkContract } from "./link.js";
22
29
  export { Switch, type SwitchProps, switchContract } from "./switch.js";
23
30
  export { Select, type SelectProps, selectContract } from "./select.js";
24
31
  export { ChoiceSelect, type ChoiceSelectProps, type ChoiceOption, choiceSelectContract, } from "./choice-select.js";
@@ -26,11 +33,14 @@ export { Popover, type PopoverProps, type PopoverTriggerBindings, popoverContrac
26
33
  export { SearchInput, type SearchInputProps, searchInputContract } from "./search-input.js";
27
34
  export { PathPicker, type PathPickerProps, pathPickerContract } from "./path-picker.js";
28
35
  export { Disclosure, type DisclosureProps, disclosureContract } from "./disclosure.js";
36
+ export { Accordion, type AccordionProps, type AccordionItem, type AccordionType, type AccordionValue, accordionContract, } from "./accordion.js";
37
+ export { Table, type TableProps, type TableColumn, type TableRow, type TableSort, type TableSortDirection, tableContract, } from "./table.js";
29
38
  export { NavItem, type NavItemProps, navItemContract } from "./nav-item.js";
30
39
  export { Separator, type SeparatorProps, separatorContract } from "./separator.js";
31
40
  export { Textarea, type TextareaProps, textareaContract } from "./textarea.js";
32
41
  export { Stack, type StackProps, stackContract } from "./stack.js";
33
42
  export { PageFrame, type PageFrameProps, pageFrameContract, pageFrameOptions } from "./page-frame.js";
43
+ export { AppBar, type AppBarProps, appBarContract } from "./app-bar.js";
34
44
  export { mountRegionLayout, regionLayoutContract, type RegionRoots, type RegionLayoutSurface, type RegionLayoutOptions, } from "./region-layout.js";
35
45
  export { validateRegionLayout, type RegionDescription, type RegionLayoutDescription, } from "./region-layout-types.js";
36
46
  export { LayoutItem, type LayoutItemProps, layoutItemContract } from "./layout-item.js";
@@ -60,6 +70,8 @@ export { PathLabel, pathLabelContract } from "./path-label.js";
60
70
  export { StateDot, stateDotContract } from "./state-dot.js";
61
71
  export { HoverCard, hoverCardContract } from "./hover-card.js";
62
72
  export { Menu, menuContract, type MenuProps, type MenuEntry, type MenuAction, type MenuTriggerBindings, } from "./menu.js";
73
+ export { MenuButton, type MenuButtonProps } from "./menu-button.js";
74
+ export { ContextMenu, type ContextMenuProps, contextMenuContract } from "./context-menu.js";
63
75
  export { Toast, toastContract, type ToastProps } from "./toast.js";
64
76
  export { TerminalBlock, terminalBlockContract, type TerminalBlockProps } from "./terminal-block.js";
65
77
  export { ReadBlock, readBlockContract, type ReadBlockProps, type ReadBlockLine, } from "./read-block.js";
@@ -17,8 +17,15 @@ 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";
23
+ export { NumberInput, numberInputContract, clampNumber, formatNumber, numberPrecision, } from "./number-input.js";
21
24
  export { Checkbox, checkboxContract } from "./checkbox.js";
25
+ export { Slider, sliderContract } from "./slider.js";
26
+ export { Progress, progressContract } from "./progress.js";
27
+ export { Avatar, avatarContract, avatarOptions, initialsFromName, } from "./avatar.js";
28
+ export { Link, linkContract } from "./link.js";
22
29
  export { Switch, switchContract } from "./switch.js";
23
30
  export { Select, selectContract } from "./select.js";
24
31
  export { ChoiceSelect, choiceSelectContract, } from "./choice-select.js";
@@ -26,11 +33,14 @@ export { Popover, popoverContract, } from "./popover.js";
26
33
  export { SearchInput, searchInputContract } from "./search-input.js";
27
34
  export { PathPicker, pathPickerContract } from "./path-picker.js";
28
35
  export { Disclosure, disclosureContract } from "./disclosure.js";
36
+ export { Accordion, accordionContract, } from "./accordion.js";
37
+ export { Table, tableContract, } from "./table.js";
29
38
  export { NavItem, navItemContract } from "./nav-item.js";
30
39
  export { Separator, separatorContract } from "./separator.js";
31
40
  export { Textarea, textareaContract } from "./textarea.js";
32
41
  export { Stack, stackContract } from "./stack.js";
33
42
  export { PageFrame, pageFrameContract, pageFrameOptions } from "./page-frame.js";
43
+ export { AppBar, appBarContract } from "./app-bar.js";
34
44
  export { mountRegionLayout, regionLayoutContract, } from "./region-layout.js";
35
45
  export { validateRegionLayout, } from "./region-layout-types.js";
36
46
  export { LayoutItem, layoutItemContract } from "./layout-item.js";
@@ -59,6 +69,8 @@ export { PathLabel, pathLabelContract } from "./path-label.js";
59
69
  export { StateDot, stateDotContract } from "./state-dot.js";
60
70
  export { HoverCard, hoverCardContract } from "./hover-card.js";
61
71
  export { Menu, menuContract, } from "./menu.js";
72
+ export { MenuButton } from "./menu-button.js";
73
+ export { ContextMenu, contextMenuContract } from "./context-menu.js";
62
74
  export { Toast, toastContract } from "./toast.js";
63
75
  export { TerminalBlock, terminalBlockContract } from "./terminal-block.js";
64
76
  export { ReadBlock, readBlockContract, } from "./read-block.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 = "无法序列化为 JSON,显示值的文本表示。";
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": `复制 ${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})`
@@ -0,0 +1,13 @@
1
+ import { type Props } from "meowjsx";
2
+ export declare const linkContract: {
3
+ readonly name: "link";
4
+ readonly parts: readonly ["root"];
5
+ };
6
+ export interface LinkProps extends Props {
7
+ href: string;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Themed inline text link. Whole-row references to an openable object stay with ResourceLink.
12
+ */
13
+ export declare const Link: import("meowjsx").Component<LinkProps, "link", "root">;
@@ -0,0 +1,9 @@
1
+ import { defineComponent } from "meowjsx";
2
+ export const linkContract = {
3
+ name: "link",
4
+ parts: ["root"],
5
+ };
6
+ /**
7
+ * Themed inline text link. Whole-row references to an openable object stay with ResourceLink.
8
+ */
9
+ export const Link = defineComponent(linkContract, ({ className, children, ...props }, context) => context.part("root", "a", { ...props, className }, children));
@@ -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. */
@@ -0,0 +1,13 @@
1
+ import { type Child, type MaybeSignal } from "meowjsx";
2
+ import { type ButtonProps } from "./button.js";
3
+ import { type MenuEntry } from "./menu.js";
4
+ export interface MenuButtonProps extends Omit<ButtonProps, "id" | "onClick"> {
5
+ id: string;
6
+ items: readonly MenuEntry[];
7
+ open?: MaybeSignal<boolean>;
8
+ onOpenChange?: (open: boolean) => void;
9
+ align?: "start" | "end";
10
+ children?: Child;
11
+ }
12
+ /** A button that opens the existing Menu below it, including nested items. */
13
+ export declare function MenuButton({ id, items, open, onOpenChange, align, children, ...button }: MenuButtonProps): Child;
@@ -0,0 +1,10 @@
1
+ import { h } from "meowjsx";
2
+ import { Button } from "./button.js";
3
+ import { Icon } from "../icons/icon.js";
4
+ import { Menu } from "./menu.js";
5
+ /** A button that opens the existing Menu below it, including nested items. */
6
+ export function MenuButton({ id, items, open, onOpenChange, align, children, ...button }) {
7
+ return (h(Menu, { id: id, items: items, open: open, onOpenChange: onOpenChange, align: align, trigger: (bindings) => (h(Button, { ...button, ...bindings },
8
+ children,
9
+ h(Icon, { name: "chevron-down", size: 16 }))) }));
10
+ }
@@ -30,6 +30,10 @@ export interface MenuProps extends Props {
30
30
  open?: MaybeSignal<boolean>;
31
31
  onOpenChange?: (open: boolean) => void;
32
32
  align?: "start" | "end";
33
+ /** Position against a point such as a right-click, instead of the trigger box. */
34
+ anchorRect?: () => DOMRect;
35
+ /** Element whose layout defines a custom rect; observed by the same autoUpdate. */
36
+ anchorElement?: () => HTMLElement | null;
33
37
  className?: string;
34
38
  }
35
39
  export declare const menuContract: {
@@ -6,9 +6,9 @@ export const menuContract = {
6
6
  name: "menu",
7
7
  parts: ["root", "item", "icon", "label", "shortcut", "group", "heading", "separator", "branch"],
8
8
  };
9
- export const Menu = defineComponent(menuContract, ({ id, trigger, items, open, onOpenChange, align, className, placement = "bottom", closeAncestors, }, context) => {
9
+ export const Menu = defineComponent(menuContract, ({ id, trigger, items, open, onOpenChange, align, className, placement = "bottom", closeAncestors, anchorRect, anchorElement, }, context) => {
10
10
  const local = context.signal(false);
11
- const state = open ?? local;
11
+ const state = open !== undefined ? open : local;
12
12
  let root;
13
13
  let search = "";
14
14
  let searchTime = 0;
@@ -178,7 +178,7 @@ export const Menu = defineComponent(menuContract, ({ id, trigger, items, open, o
178
178
  rows[next]?.focus();
179
179
  }
180
180
  };
181
- return (h(Popover, { id: id, open: state, align: align, placement: placement, onOpenChange: (next) => {
181
+ return (h(Popover, { id: id, open: state, align: align, placement: placement, anchorRect: anchorRect, anchorElement: anchorElement, onOpenChange: (next) => {
182
182
  request(next);
183
183
  if (next)
184
184
  focusEdge();
@@ -0,0 +1,34 @@
1
+ import { type ThemedProps } from "meowcss/meowjsx";
2
+ import { type Child, type MaybeSignal, 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
+ /** Plain arrays are fixed for the mount. A signal keeps the row live. */
23
+ items: MaybeSignal<readonly MetaItem[]>;
24
+ /** Finite values clamp to 0–100; non-finite values omit the progress segment. A signal stays live. */
25
+ progress?: MaybeSignal<number | undefined>;
26
+ /** Accessible name for the progress segment. */
27
+ progressLabel?: string;
28
+ className?: string;
29
+ }
30
+ /**
31
+ * A page-level fact row. Items keep separators, wrap instead of clipping, and
32
+ * carry facts as text; the optional progress segment is one more fact.
33
+ */
34
+ export declare const MetaRow: import("meowjsx").Component<MetaRowProps, "meta-row", "icon" | "item" | "label" | "progress" | "root" | "separator">;
@@ -0,0 +1,61 @@
1
+ import { defineOptions } from "meowcss";
2
+ import { defineStyleProps } from "meowcss/meowjsx";
3
+ import { defineComponent, derived, h, keyed, unwrap, } from "meowjsx";
4
+ export const metaRowOptions = defineOptions("meta-row", {
5
+ align: ["start", "center"],
6
+ progressTone: ["neutral", "accent"],
7
+ });
8
+ export const metaRowContract = {
9
+ name: "meta-row",
10
+ parts: ["root", "item", "icon", "label", "separator", "progress"],
11
+ styleProps: defineStyleProps(metaRowOptions, {
12
+ defaults: { align: "start", progressTone: "neutral" },
13
+ }),
14
+ };
15
+ /**
16
+ * A page-level fact row. Items keep separators, wrap instead of clipping, and
17
+ * carry facts as text; the optional progress segment is one more fact.
18
+ */
19
+ export const MetaRow = defineComponent(metaRowContract, ({ items, progress, progressLabel = "Progress", children: hostChildren, className, ...props }, context) => {
20
+ void hostChildren;
21
+ const entries = derived(() => unwrap(items).map((item, index) => ({ item, key: index })));
22
+ const percent = derived(() => {
23
+ const next = unwrap(progress);
24
+ if (next === undefined || !Number.isFinite(next))
25
+ return undefined;
26
+ return Math.max(0, Math.min(100, Math.round(next)));
27
+ });
28
+ const rows = keyed(entries, (entry) => entry.key, (entry) => {
29
+ const item = context.part("item", "span", null, derived(() => {
30
+ const icon = entry.value.item.icon;
31
+ if (icon === undefined || icon === null)
32
+ return null;
33
+ return context.part("icon", "span", null, icon);
34
+ }), context.part("label", "span", null, derived(() => entry.value.item.label)));
35
+ // Index keys stay with their position, so the first row never owns a separator.
36
+ if (entry.value.key === 0)
37
+ return item;
38
+ return [
39
+ context.part("separator", "span", { "aria-hidden": "true" }, "·"),
40
+ item,
41
+ ];
42
+ });
43
+ // The segment is omitted until progress is finite, matching the static contract.
44
+ const progressSegment = derived(() => {
45
+ const value = percent.value;
46
+ if (value === undefined)
47
+ return null;
48
+ const bar = context.part("progress", "span", {
49
+ role: "progressbar",
50
+ "aria-label": progressLabel,
51
+ "aria-valuemin": 0,
52
+ "aria-valuemax": 100,
53
+ "aria-valuenow": value,
54
+ style: { "--meta-progress": `${value}%` },
55
+ }, h("span", { "aria-hidden": "true" }, `${value}%`));
56
+ return unwrap(items).length > 0
57
+ ? [context.part("separator", "span", { "aria-hidden": "true" }, "·"), bar]
58
+ : bar;
59
+ });
60
+ return context.part("root", "div", { ...props, className }, rows, progressSegment);
61
+ });