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.
- package/AGENT-COMPONENTS.md +65 -65
- package/ASSISTANT.md +35 -35
- package/JSON.md +11 -11
- package/README.md +413 -385
- package/THIRD_PARTY_NOTICES.md +8 -0
- package/dist/src/chat/assistant-composer.js +58 -98
- package/dist/src/chat/assistant-content.d.ts +1 -3
- package/dist/src/chat/assistant-content.js +36 -44
- package/dist/src/chat/assistant-markdown.js +4 -8
- package/dist/src/chat/assistant-question.js +13 -14
- package/dist/src/chat/assistant.js +27 -26
- package/dist/src/chat/attachments.d.ts +3 -2
- package/dist/src/chat/attachments.js +43 -34
- package/dist/src/chat/composer-panel.d.ts +16 -0
- package/dist/src/chat/composer-panel.js +11 -0
- package/dist/src/chat/composer.d.ts +7 -3
- package/dist/src/chat/composer.js +71 -22
- package/dist/src/chat/conversation.js +2 -2
- package/dist/src/chat/index.d.ts +1 -0
- package/dist/src/chat/index.js +1 -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.js +9 -15
- package/dist/src/chat/tool-call.js +7 -14
- package/dist/src/components/accordion.d.ts +24 -0
- package/dist/src/components/accordion.js +50 -0
- 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/avatar.d.ts +22 -0
- package/dist/src/components/avatar.js +44 -0
- package/dist/src/components/breadcrumb.js +1 -1
- package/dist/src/components/checkbox.d.ts +6 -2
- package/dist/src/components/checkbox.js +36 -8
- package/dist/src/components/choice-group.d.ts +1 -0
- package/dist/src/components/choice-group.js +12 -17
- package/dist/src/components/choice-select.d.ts +3 -1
- package/dist/src/components/choice-select.js +56 -54
- package/dist/src/components/code-block.d.ts +3 -3
- package/dist/src/components/code-block.js +31 -27
- package/dist/src/components/context-menu.d.ts +16 -0
- package/dist/src/components/context-menu.js +49 -0
- package/dist/src/components/credential-source.js +12 -12
- package/dist/src/components/diff-block.js +1 -1
- package/dist/src/components/disclosure.d.ts +2 -2
- package/dist/src/components/disclosure.js +1 -1
- 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 +12 -0
- package/dist/src/components/index.js +12 -0
- package/dist/src/components/json-block.js +2 -2
- package/dist/src/components/json-tree.js +3 -3
- package/dist/src/components/link.d.ts +13 -0
- package/dist/src/components/link.js +9 -0
- package/dist/src/components/list-group.d.ts +1 -1
- package/dist/src/components/menu-button.d.ts +13 -0
- package/dist/src/components/menu-button.js +10 -0
- package/dist/src/components/menu.d.ts +4 -0
- package/dist/src/components/menu.js +3 -3
- package/dist/src/components/meta-row.d.ts +34 -0
- package/dist/src/components/meta-row.js +61 -0
- package/dist/src/components/nav-item.js +2 -5
- package/dist/src/components/number-input.d.ts +29 -0
- package/dist/src/components/number-input.js +137 -0
- package/dist/src/components/output-block.js +8 -15
- 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 +9 -14
- package/dist/src/components/pill.js +2 -5
- package/dist/src/components/popover.js +4 -4
- package/dist/src/components/process-group.d.ts +2 -2
- package/dist/src/components/progress.d.ts +15 -0
- package/dist/src/components/progress.js +12 -0
- 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/risk-confirmation.js +2 -5
- package/dist/src/components/search-block.js +2 -3
- package/dist/src/components/segmented-control.js +3 -3
- package/dist/src/components/skeleton-boundary.js +4 -7
- package/dist/src/components/slider.d.ts +22 -0
- package/dist/src/components/slider.js +49 -0
- package/dist/src/components/table.d.ts +41 -0
- package/dist/src/components/table.js +146 -0
- package/dist/src/components/tabs.d.ts +1 -1
- package/dist/src/components/tabs.js +11 -20
- package/dist/src/components/terminal-block.js +6 -6
- package/dist/src/components/text-shimmer.js +2 -5
- 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/registry/index.d.ts +99 -5
- package/dist/src/registry/index.js +28 -3
- package/dist/src/shared/execution-state.js +7 -7
- package/dist/src/theme/chat/composer-panel.styles.d.ts +1 -0
- package/dist/src/theme/chat/composer-panel.styles.js +47 -0
- package/dist/src/theme/chat/composer.styles.js +69 -60
- package/dist/src/theme/chat/task.styles.js +5 -6
- package/dist/src/theme/components/accordion.styles.d.ts +1 -0
- package/dist/src/theme/components/accordion.styles.js +63 -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/avatar.styles.d.ts +1 -0
- package/dist/src/theme/components/avatar.styles.js +52 -0
- package/dist/src/theme/components/button.styles.js +9 -0
- package/dist/src/theme/components/card.styles.js +2 -0
- package/dist/src/theme/components/code-block.styles.js +7 -0
- package/dist/src/theme/components/context-menu.styles.d.ts +1 -0
- package/dist/src/theme/components/context-menu.styles.js +14 -0
- package/dist/src/theme/components/dialog.styles.js +7 -0
- package/dist/src/theme/components/link.styles.d.ts +1 -0
- package/dist/src/theme/components/link.styles.js +33 -0
- package/dist/src/theme/components/list-group.styles.js +1 -0
- package/dist/src/theme/components/menu.styles.js +9 -3
- 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/number-input.styles.d.ts +1 -0
- package/dist/src/theme/components/number-input.styles.js +106 -0
- package/dist/src/theme/components/output-block.styles.js +9 -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/progress.styles.d.ts +1 -0
- package/dist/src/theme/components/progress.styles.js +71 -0
- package/dist/src/theme/components/resource-card.styles.js +7 -0
- package/dist/src/theme/components/slider.styles.d.ts +1 -0
- package/dist/src/theme/components/slider.styles.js +129 -0
- package/dist/src/theme/components/table.styles.d.ts +1 -0
- package/dist/src/theme/components/table.styles.js +156 -0
- package/dist/src/theme/components/tag.styles.js +3 -3
- package/dist/src/theme/components/toggle.styles.js +10 -0
- package/dist/src/theme/components/toolbar.styles.js +7 -0
- package/dist/src/theme/index.d.ts +15 -15
- package/dist/src/theme/index.js +24 -0
- package/dist/src/theme/palette.d.ts +1 -1
- package/dist/src/theme/palette.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 +9 -4
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { defineComponent, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, unwrap, } from "meowjsx";
|
|
2
2
|
export const navItemContract = {
|
|
3
3
|
name: "nav-item",
|
|
4
4
|
parts: ["root", "icon", "label", "badge"],
|
|
5
5
|
};
|
|
6
6
|
export const NavItem = defineComponent(navItemContract, ({ label, icon, badge, active = false, className, ...props }, context) => {
|
|
7
|
-
const current =
|
|
8
|
-
context.effect(() => {
|
|
9
|
-
current.value = unwrap(active) ? "page" : undefined;
|
|
10
|
-
});
|
|
7
|
+
const current = derived(() => (unwrap(active) ? "page" : undefined));
|
|
11
8
|
return context.part("root", "button", {
|
|
12
9
|
...props,
|
|
13
10
|
type: props.type ?? "button",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type MaybeSignal, type Props } from "meowjsx";
|
|
2
|
+
export declare const numberInputContract: {
|
|
3
|
+
readonly name: "number-input";
|
|
4
|
+
readonly parts: readonly ["root", "decrement", "control", "increment"];
|
|
5
|
+
};
|
|
6
|
+
export interface NumberInputProps extends Props {
|
|
7
|
+
value?: MaybeSignal<number | undefined>;
|
|
8
|
+
defaultValue?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
/** Decimal places of a committed value. When omitted, derived from step. */
|
|
13
|
+
precision?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
name?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
onValueChange?: (value: number | undefined) => void;
|
|
20
|
+
onChange?: (event: Event) => void;
|
|
21
|
+
onInput?: (event: Event) => void;
|
|
22
|
+
onBlur?: (event: FocusEvent) => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function numberPrecision(step: number, precision?: number): number;
|
|
26
|
+
export declare function formatNumber(value: number, precision: number): string;
|
|
27
|
+
export declare function clampNumber(value: number, min: number, max: number, step: number, origin: number): number;
|
|
28
|
+
/** A number the user can type or step. Clamping and formatting happen on commit. */
|
|
29
|
+
export declare const NumberInput: import("meowjsx").Component<NumberInputProps, "number-input", "control" | "decrement" | "increment" | "root">;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { defineComponent, derived, h, unwrap, } from "meowjsx";
|
|
2
|
+
import { Icon } from "../icons/icon.js";
|
|
3
|
+
export const numberInputContract = {
|
|
4
|
+
name: "number-input",
|
|
5
|
+
parts: ["root", "decrement", "control", "increment"],
|
|
6
|
+
};
|
|
7
|
+
export function numberPrecision(step, precision) {
|
|
8
|
+
if (precision !== undefined)
|
|
9
|
+
return Math.max(0, Math.floor(precision));
|
|
10
|
+
if (!Number.isFinite(step) || step <= 0)
|
|
11
|
+
return 0;
|
|
12
|
+
const text = String(step);
|
|
13
|
+
const index = text.indexOf(".");
|
|
14
|
+
return index < 0 ? 0 : text.length - index - 1;
|
|
15
|
+
}
|
|
16
|
+
export function formatNumber(value, precision) {
|
|
17
|
+
if (!Number.isFinite(value))
|
|
18
|
+
return "";
|
|
19
|
+
return value.toFixed(precision);
|
|
20
|
+
}
|
|
21
|
+
export function clampNumber(value, min, max, step, origin) {
|
|
22
|
+
const lo = Number.isFinite(min) ? min : -Infinity;
|
|
23
|
+
const hi = Number.isFinite(max) ? max : Infinity;
|
|
24
|
+
let next = Math.min(hi, Math.max(lo, value));
|
|
25
|
+
if (Number.isFinite(step) && step > 0 && Number.isFinite(origin)) {
|
|
26
|
+
next = origin + Math.round((next - origin) / step) * step;
|
|
27
|
+
next = Math.min(hi, Math.max(lo, next));
|
|
28
|
+
}
|
|
29
|
+
return next;
|
|
30
|
+
}
|
|
31
|
+
function parseInput(text) {
|
|
32
|
+
const trimmed = text.trim();
|
|
33
|
+
if (trimmed === "" || trimmed === "-" || trimmed === "+" || trimmed === ".")
|
|
34
|
+
return undefined;
|
|
35
|
+
const next = Number(trimmed);
|
|
36
|
+
return Number.isFinite(next) ? next : undefined;
|
|
37
|
+
}
|
|
38
|
+
/** A number the user can type or step. Clamping and formatting happen on commit. */
|
|
39
|
+
export const NumberInput = defineComponent(numberInputContract, ({ value, defaultValue, min, max, step = 1, precision, disabled, readOnly, required, name, id, onValueChange, className, onChange, onInput, onBlur, ...props }, context) => {
|
|
40
|
+
const places = numberPrecision(step, precision);
|
|
41
|
+
const lower = min ?? Number.NEGATIVE_INFINITY;
|
|
42
|
+
const upper = max ?? Number.POSITIVE_INFINITY;
|
|
43
|
+
const origin = Number.isFinite(lower) ? lower : 0;
|
|
44
|
+
const local = context.signal(value === undefined ? defaultValue : unwrap(value));
|
|
45
|
+
const current = value !== undefined ? value : local;
|
|
46
|
+
const readValue = () => unwrap(current);
|
|
47
|
+
const editing = context.signal(false);
|
|
48
|
+
const draft = context.signal("");
|
|
49
|
+
const formatted = (next) => next === undefined ? "" : formatNumber(next, places);
|
|
50
|
+
const text = derived(() => (editing.value ? draft.value : formatted(readValue())));
|
|
51
|
+
const assign = (next) => {
|
|
52
|
+
if (value === undefined)
|
|
53
|
+
local.value = next;
|
|
54
|
+
onValueChange?.(next);
|
|
55
|
+
};
|
|
56
|
+
const commit = (raw) => {
|
|
57
|
+
const parsed = parseInput(raw);
|
|
58
|
+
if (parsed === undefined) {
|
|
59
|
+
assign(undefined);
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const next = clampNumber(parsed, lower, upper, step, origin);
|
|
63
|
+
assign(next);
|
|
64
|
+
return next;
|
|
65
|
+
};
|
|
66
|
+
const nudge = (direction) => {
|
|
67
|
+
if (disabled || readOnly)
|
|
68
|
+
return;
|
|
69
|
+
editing.value = false;
|
|
70
|
+
const base = readValue() ??
|
|
71
|
+
(direction > 0 ? (Number.isFinite(lower) ? lower : 0) : Number.isFinite(upper) ? upper : 0);
|
|
72
|
+
const next = clampNumber(base + direction * step, lower, upper, step, origin);
|
|
73
|
+
assign(next);
|
|
74
|
+
};
|
|
75
|
+
return context.part("root", "div", { className }, context.part("decrement", "button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
disabled: disabled || readOnly,
|
|
78
|
+
tabIndex: -1,
|
|
79
|
+
"aria-label": "Decrease",
|
|
80
|
+
onClick: () => nudge(-1),
|
|
81
|
+
}, h(Icon, { name: "minus", size: 16 })), context.part("control", "input", {
|
|
82
|
+
...props,
|
|
83
|
+
id,
|
|
84
|
+
name,
|
|
85
|
+
type: "text",
|
|
86
|
+
inputMode: "decimal",
|
|
87
|
+
autoComplete: "off",
|
|
88
|
+
role: "spinbutton",
|
|
89
|
+
disabled,
|
|
90
|
+
readOnly,
|
|
91
|
+
required,
|
|
92
|
+
value: text,
|
|
93
|
+
"aria-valuenow": text,
|
|
94
|
+
"aria-valuemin": Number.isFinite(lower) ? lower : undefined,
|
|
95
|
+
"aria-valuemax": Number.isFinite(upper) ? upper : undefined,
|
|
96
|
+
onInput: (event) => {
|
|
97
|
+
const input = event.currentTarget;
|
|
98
|
+
editing.value = true;
|
|
99
|
+
draft.value = input.value;
|
|
100
|
+
onInput?.(event);
|
|
101
|
+
},
|
|
102
|
+
onChange: (event) => {
|
|
103
|
+
onChange?.(event);
|
|
104
|
+
},
|
|
105
|
+
onBlur: (event) => {
|
|
106
|
+
const input = event.currentTarget;
|
|
107
|
+
const next = commit(input.value);
|
|
108
|
+
editing.value = false;
|
|
109
|
+
// A controlled owner that stays empty must clear a parsed draft immediately.
|
|
110
|
+
if (value !== undefined && next !== undefined && unwrap(value) === undefined)
|
|
111
|
+
input.value = "";
|
|
112
|
+
onBlur?.(event);
|
|
113
|
+
},
|
|
114
|
+
onKeyDown: (event) => {
|
|
115
|
+
if (event.isComposing || disabled || readOnly)
|
|
116
|
+
return;
|
|
117
|
+
if (event.key === "ArrowUp") {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
nudge(1);
|
|
120
|
+
}
|
|
121
|
+
else if (event.key === "ArrowDown") {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
nudge(-1);
|
|
124
|
+
}
|
|
125
|
+
else if (event.key === "Enter") {
|
|
126
|
+
commit(event.currentTarget.value);
|
|
127
|
+
editing.value = false;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
}), context.part("increment", "button", {
|
|
131
|
+
type: "button",
|
|
132
|
+
disabled: disabled || readOnly,
|
|
133
|
+
tabIndex: -1,
|
|
134
|
+
"aria-label": "Increase",
|
|
135
|
+
onClick: () => nudge(1),
|
|
136
|
+
}, h(Icon, { name: "plus", size: 16 })));
|
|
137
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, h, unwrap, } from "meowjsx";
|
|
2
2
|
import { copyTextToClipboard } from "../clipboard.js";
|
|
3
3
|
export const outputBlockContract = {
|
|
4
4
|
name: "output-block",
|
|
@@ -11,14 +11,7 @@ export function outputWindow(length, maxLines = 16) {
|
|
|
11
11
|
const tail = Math.floor(limit / 2);
|
|
12
12
|
return { head, tail, hidden: Math.max(0, length - limit) };
|
|
13
13
|
}
|
|
14
|
-
export const OutputBlock = defineComponent(outputBlockContract, ({ title, rows, copyText, maxLines, wrap = false, emptyText = "
|
|
15
|
-
const derived = (read) => {
|
|
16
|
-
const value = context.signal(read());
|
|
17
|
-
context.effect(() => {
|
|
18
|
-
value.value = read();
|
|
19
|
-
});
|
|
20
|
-
return value;
|
|
21
|
-
};
|
|
14
|
+
export const OutputBlock = defineComponent(outputBlockContract, ({ title, rows, copyText, maxLines, wrap = false, emptyText = "No content", onCopy, ...props }, context) => {
|
|
22
15
|
const feedback = context.signal("");
|
|
23
16
|
const busy = context.signal(false);
|
|
24
17
|
let disposed = false;
|
|
@@ -32,11 +25,11 @@ export const OutputBlock = defineComponent(outputBlockContract, ({ title, rows,
|
|
|
32
25
|
try {
|
|
33
26
|
await (onCopy ?? copyTextToClipboard)(unwrap(copyText));
|
|
34
27
|
if (!disposed)
|
|
35
|
-
feedback.value = "
|
|
28
|
+
feedback.value = "Copied";
|
|
36
29
|
}
|
|
37
30
|
catch {
|
|
38
31
|
if (!disposed)
|
|
39
|
-
feedback.value = "
|
|
32
|
+
feedback.value = "Copy failed; select the text manually.";
|
|
40
33
|
}
|
|
41
34
|
finally {
|
|
42
35
|
if (!disposed)
|
|
@@ -48,9 +41,9 @@ export const OutputBlock = defineComponent(outputBlockContract, ({ title, rows,
|
|
|
48
41
|
return context.part("root", "section", { ...props, "data-output-wrap": wrap ? "true" : undefined }, [
|
|
49
42
|
context.part("header", "div", {}, [
|
|
50
43
|
context.part("title", "div", {}, title),
|
|
51
|
-
context.part("actions", "button", { type: "button", disabled: busy, onClick: copy }, "
|
|
44
|
+
context.part("actions", "button", { type: "button", disabled: busy, onClick: copy }, "Copy"),
|
|
52
45
|
]),
|
|
53
|
-
context.part("body", "div", { tabIndex: 0, "aria-label": "
|
|
46
|
+
context.part("body", "div", { tabIndex: 0, "aria-label": "Output content" }, [
|
|
54
47
|
derived(() => {
|
|
55
48
|
const values = unwrap(rows);
|
|
56
49
|
return values.length === 0
|
|
@@ -59,8 +52,8 @@ export const OutputBlock = defineComponent(outputBlockContract, ({ title, rows,
|
|
|
59
52
|
}),
|
|
60
53
|
context.part("fold", "details", { hidden: derived(() => window.value.hidden === 0) }, [
|
|
61
54
|
context.part("toggle", "summary", {}, [
|
|
62
|
-
h("span", { "data-fold-closed": true }, derived(() =>
|
|
63
|
-
h("span", { "data-fold-open": true }, "
|
|
55
|
+
h("span", { "data-fold-closed": true }, derived(() => `Show the ${window.value.hidden} hidden middle lines`)),
|
|
56
|
+
h("span", { "data-fold-open": true }, "Hide the middle lines"),
|
|
64
57
|
]),
|
|
65
58
|
derived(() => {
|
|
66
59
|
const values = unwrap(rows);
|
|
@@ -6,7 +6,7 @@ export declare const pageFrameOptions: import("meowcss").Options<{
|
|
|
6
6
|
}>;
|
|
7
7
|
export declare const pageFrameContract: {
|
|
8
8
|
readonly name: "page-frame";
|
|
9
|
-
readonly parts: readonly ["root", "toolbar", "header", "body"];
|
|
9
|
+
readonly parts: readonly ["root", "toolbar", "header", "notice", "body", "footer"];
|
|
10
10
|
readonly styleProps: import("meowcss/meowjsx").StylePropsBinding<import("meowcss").Options<{
|
|
11
11
|
readonly variant: readonly ["page", "workspace"];
|
|
12
12
|
readonly scrollOwner: readonly ["content", "layout"];
|
|
@@ -15,7 +15,11 @@ export declare const pageFrameContract: {
|
|
|
15
15
|
export interface PageFrameProps extends Props, ThemedProps<typeof pageFrameOptions> {
|
|
16
16
|
header?: Child;
|
|
17
17
|
toolbar?: Child;
|
|
18
|
+
/** A full-width status or alert row between the header and the body. */
|
|
19
|
+
notice?: Child;
|
|
20
|
+
/** A persistent region after the body, typically a composer or action bar. */
|
|
21
|
+
footer?: Child;
|
|
18
22
|
className?: string;
|
|
19
23
|
}
|
|
20
24
|
/** The parent owns page chrome; its body receives only the remaining space. */
|
|
21
|
-
export declare const PageFrame: import("meowjsx").Component<PageFrameProps, "page-frame", "body" | "header" | "root" | "toolbar">;
|
|
25
|
+
export declare const PageFrame: import("meowjsx").Component<PageFrameProps, "page-frame", "body" | "footer" | "header" | "notice" | "root" | "toolbar">;
|
|
@@ -7,10 +7,10 @@ export const pageFrameOptions = defineOptions("page-frame", {
|
|
|
7
7
|
});
|
|
8
8
|
export const pageFrameContract = {
|
|
9
9
|
name: "page-frame",
|
|
10
|
-
parts: ["root", "toolbar", "header", "body"],
|
|
10
|
+
parts: ["root", "toolbar", "header", "notice", "body", "footer"],
|
|
11
11
|
styleProps: defineStyleProps(pageFrameOptions, {
|
|
12
12
|
defaults: { variant: "page", scrollOwner: "content" },
|
|
13
13
|
}),
|
|
14
14
|
};
|
|
15
15
|
/** The parent owns page chrome; its body receives only the remaining space. */
|
|
16
|
-
export const PageFrame = defineComponent(pageFrameContract, ({ header, toolbar, children, className, ...props }, context) => context.part("root", "section", { ...props, className }, toolbar ? context.part("toolbar", "div", null, toolbar) : null, header ? context.part("header", "div", null, header) : null, context.part("body", "div", null, children)));
|
|
16
|
+
export const PageFrame = defineComponent(pageFrameContract, ({ header, toolbar, notice, footer, children, className, ...props }, context) => context.part("root", "section", { ...props, className }, toolbar ? context.part("toolbar", "div", null, toolbar) : null, header ? context.part("header", "div", null, header) : null, notice ? context.part("notice", "div", null, notice) : null, context.part("body", "div", null, children), footer ? context.part("footer", "div", null, footer) : null));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { batch, defineComponent, h, unwrap, } from "meowjsx";
|
|
1
|
+
import { batch, defineComponent, derived, h, unwrap, } from "meowjsx";
|
|
2
2
|
import { Button } from "./button.js";
|
|
3
3
|
import { Input } from "./input.js";
|
|
4
4
|
const messages = {
|
|
5
|
-
file: "
|
|
6
|
-
directory: "
|
|
7
|
-
pending: "
|
|
8
|
-
failed: "
|
|
5
|
+
file: "Browse files…",
|
|
6
|
+
directory: "Browse directories…",
|
|
7
|
+
pending: "Choosing…",
|
|
8
|
+
failed: "Could not open the picker; try again or enter a path manually.",
|
|
9
9
|
};
|
|
10
10
|
export const pathPickerContract = {
|
|
11
11
|
name: "path-picker",
|
|
@@ -15,19 +15,14 @@ export const pathPickerContract = {
|
|
|
15
15
|
export const PathPicker = defineComponent(pathPickerContract, ({ label, value, onValueChange, onChoose, kind = "file", disabled = false, readOnly = false, className, children: _children, ...props }, context) => {
|
|
16
16
|
const pending = context.signal(false);
|
|
17
17
|
const feedback = context.signal("");
|
|
18
|
-
const locked =
|
|
19
|
-
const buttonDisabled =
|
|
20
|
-
const buttonLabel =
|
|
18
|
+
const locked = derived(() => unwrap(readOnly) || pending.value);
|
|
19
|
+
const buttonDisabled = derived(() => unwrap(disabled) || unwrap(readOnly) || pending.value);
|
|
20
|
+
const buttonLabel = derived(() => (pending.value ? messages.pending : messages[kind]));
|
|
21
21
|
let disposed = false;
|
|
22
22
|
let button;
|
|
23
23
|
context.onCleanup(() => {
|
|
24
24
|
disposed = true;
|
|
25
25
|
});
|
|
26
|
-
context.effect(() => {
|
|
27
|
-
locked.value = unwrap(readOnly) || pending.value;
|
|
28
|
-
buttonDisabled.value = unwrap(disabled) || unwrap(readOnly) || pending.value;
|
|
29
|
-
buttonLabel.value = pending.value ? messages.pending : messages[kind];
|
|
30
|
-
});
|
|
31
26
|
const choose = async () => {
|
|
32
27
|
if (!onChoose || disposed || buttonDisabled.value)
|
|
33
28
|
return;
|
|
@@ -49,7 +44,7 @@ export const PathPicker = defineComponent(pathPickerContract, ({ label, value, o
|
|
|
49
44
|
}
|
|
50
45
|
finally {
|
|
51
46
|
if (!disposed) {
|
|
52
|
-
//
|
|
47
|
+
// The button's disabled property updates in the signal subscriber, so flush it before focus.
|
|
53
48
|
batch(() => {
|
|
54
49
|
pending.value = false;
|
|
55
50
|
});
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { defineComponent, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, unwrap, } from "meowjsx";
|
|
2
2
|
export const pillContract = { name: "pill", parts: ["root"] };
|
|
3
3
|
/** A capsule fact, or a native button when supplied an action. Selection belongs to its caller. */
|
|
4
4
|
export const Pill = defineComponent(pillContract, ({ active = false, onClick, children, ...props }, context) => {
|
|
5
|
-
const selected =
|
|
6
|
-
context.effect(() => {
|
|
7
|
-
selected.value = String(unwrap(active));
|
|
8
|
-
});
|
|
5
|
+
const selected = derived(() => String(unwrap(active)));
|
|
9
6
|
return context.part("root", onClick ? "button" : "span", {
|
|
10
7
|
...props,
|
|
11
8
|
...(onClick ? { type: "button", onClick } : {}),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, isSignal, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, isSignal, unwrap, } from "meowjsx";
|
|
2
2
|
import { autoUpdate, computePosition, offset, flip, shift, size } from "@floating-ui/dom";
|
|
3
3
|
import { activeElementInRoot, elementByIdInRoot } from "../shared/dom-root.js";
|
|
4
4
|
export const popoverContract = {
|
|
@@ -10,8 +10,9 @@ const layers = new WeakMap();
|
|
|
10
10
|
const dismissedEvents = new WeakSet();
|
|
11
11
|
export const Popover = defineComponent(popoverContract, ({ id, triggerId = `${id}-trigger`, trigger, open, defaultOpen = false, onOpenChange, matchTriggerWidth = false, align = "start", placement = "bottom", anchorRect, anchorElement, role, labelledBy, onKeyDown, children, className, }, context) => {
|
|
12
12
|
const local = context.signal(defaultOpen);
|
|
13
|
-
|
|
14
|
-
const
|
|
13
|
+
// A signal object is controlled even when its current value is false.
|
|
14
|
+
const state = open !== undefined ? open : local;
|
|
15
|
+
const expanded = derived(() => String(unwrap(state)));
|
|
15
16
|
let panel;
|
|
16
17
|
let anchor = null;
|
|
17
18
|
let restore = true;
|
|
@@ -22,7 +23,6 @@ export const Popover = defineComponent(popoverContract, ({ id, triggerId = `${id
|
|
|
22
23
|
return;
|
|
23
24
|
anchor ??= elementByIdInRoot(panel, triggerId);
|
|
24
25
|
const next = unwrap(state);
|
|
25
|
-
expanded.value = String(next);
|
|
26
26
|
const shown = panel.matches(":popover-open");
|
|
27
27
|
const stack = layers.get(panel.ownerDocument) ?? [];
|
|
28
28
|
layers.set(panel.ownerDocument, stack);
|
|
@@ -4,9 +4,9 @@ export declare const processGroupContract: {
|
|
|
4
4
|
readonly parts: readonly ["root", "summary", "chevron", "title", "status", "trailing", "body"];
|
|
5
5
|
};
|
|
6
6
|
export interface ProcessGroupProps extends Props {
|
|
7
|
-
/** The group's name and size, for example "
|
|
7
|
+
/** The group's name and size, for example "Process · 3 steps". */
|
|
8
8
|
title: Child;
|
|
9
|
-
/** Outcome in words, for example "
|
|
9
|
+
/** Outcome in words, for example "Completed · 4.2s". */
|
|
10
10
|
status?: Child;
|
|
11
11
|
/** Right-aligned summary of the steps, usually one StatusDot per step. */
|
|
12
12
|
trailing?: Child;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type MaybeSignal, type Props } from "meowjsx";
|
|
2
|
+
export declare const progressContract: {
|
|
3
|
+
readonly name: "progress";
|
|
4
|
+
readonly parts: readonly ["root", "bar"];
|
|
5
|
+
};
|
|
6
|
+
export interface ProgressProps extends Props {
|
|
7
|
+
/** Accessible name. Spinner remains the wait with no known amount. */
|
|
8
|
+
label: MaybeSignal<string>;
|
|
9
|
+
/** Omit for an indeterminate bar. Finite values are handed to the native progress element. */
|
|
10
|
+
value?: MaybeSignal<number>;
|
|
11
|
+
max?: MaybeSignal<number>;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Native progress: a known amount, or an indeterminate bar when value is omitted. */
|
|
15
|
+
export declare const Progress: import("meowjsx").Component<ProgressProps, "progress", "bar" | "root">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineComponent } from "meowjsx";
|
|
2
|
+
export const progressContract = {
|
|
3
|
+
name: "progress",
|
|
4
|
+
parts: ["root", "bar"],
|
|
5
|
+
};
|
|
6
|
+
/** Native progress: a known amount, or an indeterminate bar when value is omitted. */
|
|
7
|
+
export const Progress = defineComponent(progressContract, ({ label, value, max = 1, className, ...props }, context) => context.part("root", "div", { className }, context.part("bar", "progress", {
|
|
8
|
+
...props,
|
|
9
|
+
...(value === undefined ? {} : { value }),
|
|
10
|
+
max,
|
|
11
|
+
"aria-label": label,
|
|
12
|
+
})));
|
|
@@ -13,9 +13,9 @@ export interface RailItemProps extends Props {
|
|
|
13
13
|
* attribute on the item, so a host can set or clear it at runtime without re-rendering.
|
|
14
14
|
*/
|
|
15
15
|
dot?: "warning" | "accent";
|
|
16
|
-
/** Text or count at the end, visible while the rail is expanded: a count, "
|
|
16
|
+
/** Text or count at the end, visible while the rail is expanded: a count, "In progress". */
|
|
17
17
|
meta?: Child;
|
|
18
|
-
/** "accent" marks activity happening now, such as "
|
|
18
|
+
/** "accent" marks activity happening now, such as "In progress"; otherwise the meta is a quiet fact. */
|
|
19
19
|
metaTone?: "accent";
|
|
20
20
|
/** A route renders an anchor; an action renders a button. */
|
|
21
21
|
href?: string;
|
|
@@ -4,7 +4,7 @@ export declare const railSectionContract: {
|
|
|
4
4
|
readonly parts: readonly ["root", "heading", "items", "shortcut"];
|
|
5
5
|
};
|
|
6
6
|
export interface RailSectionProps extends Props {
|
|
7
|
-
/** Eyebrow shown while the rail is expanded, for example "
|
|
7
|
+
/** Eyebrow shown while the rail is expanded, for example "Expanded". */
|
|
8
8
|
label: string;
|
|
9
9
|
/** While collapsed, the whole section is this one icon, pointing at `href`. */
|
|
10
10
|
icon: Child;
|
|
@@ -19,7 +19,7 @@ export function readHighlightLines(spans) {
|
|
|
19
19
|
return rows;
|
|
20
20
|
}
|
|
21
21
|
/** Displays a supplied file window; never opens the named path. */
|
|
22
|
-
export const ReadBlock = defineComponent(readBlockContract, ({ label = "
|
|
22
|
+
export const ReadBlock = defineComponent(readBlockContract, ({ label = "File content", lines, totalLines, lang, maxLines, onCopy, ...props }, context) => {
|
|
23
23
|
const raw = lines.map((line) => line.text).join("\n");
|
|
24
24
|
const content = lines.map((line) => context.signal(line.text || "\u200b"));
|
|
25
25
|
let disposed = false;
|
|
@@ -76,7 +76,7 @@ export const ReadBlock = defineComponent(readBlockContract, ({ label = "文件
|
|
|
76
76
|
},
|
|
77
77
|
}, h(OutputBlock, { title: h("span", null,
|
|
78
78
|
label,
|
|
79
|
-
totalLines !== undefined ? ` ·
|
|
79
|
+
totalLines !== undefined ? ` · Showing ${lines.length} / ${totalLines} lines` : ""), maxLines: maxLines, onCopy: onCopy, copyText: raw, rows: lines.map((line, index) => (h("div", { "data-read-highlight": line.highlighted ? "true" : undefined },
|
|
80
80
|
context.part("number", "span", { "aria-hidden": "true" }, String(line.number)),
|
|
81
81
|
context.part("text", "span", {}, content[index])))) }));
|
|
82
82
|
});
|
|
@@ -5,7 +5,7 @@ export declare const resourceCardContract: {
|
|
|
5
5
|
};
|
|
6
6
|
export interface ResourceCardProps extends Props {
|
|
7
7
|
title: Child;
|
|
8
|
-
/** What kind of thing it is, for example "Channel ·
|
|
8
|
+
/** What kind of thing it is, for example "Channel · Message card". */
|
|
9
9
|
subtitle?: Child;
|
|
10
10
|
icon?: Child;
|
|
11
11
|
/** The state in words with its dot. */
|
|
@@ -5,7 +5,7 @@ export declare const resourceLinkContract: {
|
|
|
5
5
|
};
|
|
6
6
|
export interface ResourceLinkProps extends Props {
|
|
7
7
|
title: Child;
|
|
8
|
-
/** Where it lives and which version, for example "docs/records ·
|
|
8
|
+
/** Where it lives and which version, for example "docs/records · Revision 1". */
|
|
9
9
|
detail?: Child;
|
|
10
10
|
icon?: Child;
|
|
11
11
|
/** Replaces the arrow, for a state the reader should see before opening. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, isSignal, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, h, isSignal, unwrap, } from "meowjsx";
|
|
2
2
|
import { Dialog, DialogPanel, DialogHeader, DialogActions } from "./dialog.js";
|
|
3
3
|
import { Checkbox } from "./checkbox.js";
|
|
4
4
|
import { Button } from "./button.js";
|
|
@@ -8,10 +8,7 @@ export const riskConfirmationContract = {
|
|
|
8
8
|
};
|
|
9
9
|
/** One host-requested acknowledgement; it never decides which actions need confirmation. */
|
|
10
10
|
export const RiskConfirmation = defineComponent(riskConfirmationContract, ({ id, open, title, description, acknowledgeLabel, cancelLabel, confirmLabel, acknowledged, disabled = false, onAcknowledgedChange, onCancel, onConfirm, className, }, context) => {
|
|
11
|
-
const blocked =
|
|
12
|
-
context.effect(() => {
|
|
13
|
-
blocked.value = unwrap(disabled) || !unwrap(acknowledged);
|
|
14
|
-
});
|
|
11
|
+
const blocked = derived(() => unwrap(disabled) || !unwrap(acknowledged));
|
|
15
12
|
return context.part("root", "div", { className }, h(Dialog, { labelledBy: `${id}-title`, describedBy: `${id}-description`, onCancel: (event) => {
|
|
16
13
|
event.preventDefault();
|
|
17
14
|
onCancel();
|
|
@@ -29,12 +29,11 @@ export const SearchBlock = defineComponent(searchBlockContract, (props, context)
|
|
|
29
29
|
...(hidden ? file.matches.slice(0, head) : file.matches).map(renderMatch),
|
|
30
30
|
hidden ? (h("details", null,
|
|
31
31
|
h("summary", null,
|
|
32
|
-
"\u4E2D\u95F4 ",
|
|
33
32
|
hidden,
|
|
34
|
-
"
|
|
33
|
+
" matches in the middle"),
|
|
35
34
|
file.matches.slice(head, file.matches.length - tail).map(renderMatch))) : null,
|
|
36
35
|
...(hidden ? file.matches.slice(file.matches.length - tail) : []).map(renderMatch),
|
|
37
36
|
]);
|
|
38
37
|
});
|
|
39
|
-
return context.part("root", "div", rest, h(OutputBlock, { title:
|
|
38
|
+
return context.part("root", "div", rest, h(OutputBlock, { title: `Search · showing ${shown} / ${total}${truncated ? " · results truncated" : ""}`, rows: rows, copyText: searchBlockText(props), maxLines: maxLines, onCopy: onCopy, emptyText: "No results" }));
|
|
40
39
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, unwrap, } from "meowjsx";
|
|
2
2
|
export const segmentedControlContract = {
|
|
3
3
|
name: "segmented-control",
|
|
4
4
|
parts: ["root", "legend", "options", "option", "input", "label"],
|
|
@@ -6,12 +6,12 @@ export const segmentedControlContract = {
|
|
|
6
6
|
/** A single choice, using native radio keyboard semantics; tabs remain a separate component. */
|
|
7
7
|
export const SegmentedControl = defineComponent(segmentedControlContract, ({ id, name = id, form, label, value, options, onValueChange, disabled, className }, context) => {
|
|
8
8
|
const inputs = new Map();
|
|
9
|
+
// Form reset and a rejected change flip the native radio before the signal does.
|
|
9
10
|
const reconcile = () => {
|
|
10
11
|
const selected = unwrap(value);
|
|
11
12
|
for (const [key, input] of inputs)
|
|
12
13
|
input.checked = selected === key;
|
|
13
14
|
};
|
|
14
|
-
context.effect(reconcile);
|
|
15
15
|
return context.part("root", "fieldset", {
|
|
16
16
|
id,
|
|
17
17
|
form,
|
|
@@ -42,7 +42,7 @@ export const SegmentedControl = defineComponent(segmentedControlContract, ({ id,
|
|
|
42
42
|
name,
|
|
43
43
|
form,
|
|
44
44
|
value: option.value,
|
|
45
|
-
checked: unwrap(value) === option.value,
|
|
45
|
+
checked: derived(() => unwrap(value) === option.value),
|
|
46
46
|
disabled: option.disabled,
|
|
47
47
|
ref: (input) => {
|
|
48
48
|
inputs.set(option.value, input);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, unwrap, } from "meowjsx";
|
|
2
2
|
import { createSkeletonController, useWebObservation } from "meowjsx/web";
|
|
3
3
|
export const skeletonBoundaryContract = {
|
|
4
4
|
name: "skeleton-boundary",
|
|
@@ -8,9 +8,9 @@ export const skeletonBoundaryContract = {
|
|
|
8
8
|
export const SkeletonBoundary = defineComponent(skeletonBoundaryContract, ({ active, label, children, ...props }, context) => {
|
|
9
9
|
const observation = useWebObservation();
|
|
10
10
|
const mounted = context.signal(null);
|
|
11
|
-
const busy =
|
|
12
|
-
const busyAttribute =
|
|
13
|
-
const announcement =
|
|
11
|
+
const busy = derived(() => unwrap(active));
|
|
12
|
+
const busyAttribute = derived(() => String(unwrap(active)));
|
|
13
|
+
const announcement = derived(() => (unwrap(active) ? label : ""));
|
|
14
14
|
let controller;
|
|
15
15
|
const clear = () => {
|
|
16
16
|
controller?.dispose();
|
|
@@ -18,9 +18,6 @@ export const SkeletonBoundary = defineComponent(skeletonBoundaryContract, ({ act
|
|
|
18
18
|
};
|
|
19
19
|
context.effect(() => {
|
|
20
20
|
const loading = unwrap(active);
|
|
21
|
-
busy.value = loading;
|
|
22
|
-
busyAttribute.value = String(loading);
|
|
23
|
-
announcement.value = loading ? label : "";
|
|
24
21
|
const element = mounted.value;
|
|
25
22
|
if (!element)
|
|
26
23
|
return;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type MaybeSignal, type Props } from "meowjsx";
|
|
2
|
+
export declare const sliderContract: {
|
|
3
|
+
readonly name: "slider";
|
|
4
|
+
readonly parts: readonly ["root", "control", "track", "thumb", "value"];
|
|
5
|
+
};
|
|
6
|
+
export interface SliderProps extends Props {
|
|
7
|
+
/** Accessible name for the native range control. */
|
|
8
|
+
label: string;
|
|
9
|
+
value?: MaybeSignal<number>;
|
|
10
|
+
defaultValue?: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
step?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
name?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
onValueChange?: (value: number) => void;
|
|
18
|
+
onInput?: (event: Event) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Native range control. The visible figure is the same value assistive technology reads. */
|
|
22
|
+
export declare const Slider: import("meowjsx").Component<SliderProps, "slider", "control" | "root" | "thumb" | "track" | "value">;
|