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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineComponent, derived, unwrap, } from "meowjsx";
|
|
2
|
+
export const sliderContract = {
|
|
3
|
+
name: "slider",
|
|
4
|
+
parts: ["root", "control", "track", "thumb", "value"],
|
|
5
|
+
};
|
|
6
|
+
function asNumber(value, fallback) {
|
|
7
|
+
const next = Number(value);
|
|
8
|
+
return Number.isFinite(next) ? next : fallback;
|
|
9
|
+
}
|
|
10
|
+
/** Native range control. The visible figure is the same value assistive technology reads. */
|
|
11
|
+
export const Slider = defineComponent(sliderContract, ({ label, value, defaultValue, min = 0, max = 100, step = 1, disabled, name, id, onValueChange, className, onInput, ...props }, context) => {
|
|
12
|
+
const initial = value === undefined ? (defaultValue ?? min) : unwrap(value);
|
|
13
|
+
const local = context.signal(initial);
|
|
14
|
+
const current = value !== undefined ? value : local;
|
|
15
|
+
const readValue = () => unwrap(current);
|
|
16
|
+
const display = derived(() => String(readValue()));
|
|
17
|
+
const fill = derived(() => {
|
|
18
|
+
const next = readValue();
|
|
19
|
+
const range = max - min;
|
|
20
|
+
const pct = range <= 0 ? 0 : Math.min(100, Math.max(0, ((next - min) / range) * 100));
|
|
21
|
+
return `${pct}%`;
|
|
22
|
+
});
|
|
23
|
+
const commit = (event) => {
|
|
24
|
+
const input = event.currentTarget;
|
|
25
|
+
const next = asNumber(input.value, readValue());
|
|
26
|
+
if (value === undefined)
|
|
27
|
+
local.value = next;
|
|
28
|
+
onValueChange?.(next);
|
|
29
|
+
onInput?.(event);
|
|
30
|
+
if (value !== undefined)
|
|
31
|
+
input.value = String(unwrap(value));
|
|
32
|
+
};
|
|
33
|
+
return context.part("root", "div", {
|
|
34
|
+
className,
|
|
35
|
+
style: { "--slider-fill": fill },
|
|
36
|
+
}, context.part("control", "input", {
|
|
37
|
+
...props,
|
|
38
|
+
id,
|
|
39
|
+
name,
|
|
40
|
+
type: "range",
|
|
41
|
+
min,
|
|
42
|
+
max,
|
|
43
|
+
step,
|
|
44
|
+
disabled,
|
|
45
|
+
"aria-label": label,
|
|
46
|
+
value: display,
|
|
47
|
+
onInput: commit,
|
|
48
|
+
}), context.part("track", "span", { "aria-hidden": "true" }, context.part("thumb", "span", { "aria-hidden": "true" })), context.part("value", "output", { htmlFor: id, "aria-hidden": id ? undefined : "true" }, display));
|
|
49
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Child, type MaybeSignal, type Props } from "meowjsx";
|
|
2
|
+
export declare const tableContract: {
|
|
3
|
+
readonly name: "table";
|
|
4
|
+
readonly parts: readonly ["root", "scroller", "table", "header", "heading", "sort", "resize", "body", "row", "cell", "select"];
|
|
5
|
+
};
|
|
6
|
+
export type TableSortDirection = "asc" | "desc";
|
|
7
|
+
export interface TableSort {
|
|
8
|
+
columnId: string;
|
|
9
|
+
direction: TableSortDirection;
|
|
10
|
+
}
|
|
11
|
+
export interface TableColumn {
|
|
12
|
+
id: string;
|
|
13
|
+
header: Child;
|
|
14
|
+
width?: number;
|
|
15
|
+
minWidth?: number;
|
|
16
|
+
sortable?: boolean;
|
|
17
|
+
resizable?: boolean;
|
|
18
|
+
align?: "start" | "end";
|
|
19
|
+
}
|
|
20
|
+
export interface TableRow {
|
|
21
|
+
id: string;
|
|
22
|
+
cells: readonly Child[];
|
|
23
|
+
/** Accessible name for the row checkbox when the table is selectable. */
|
|
24
|
+
label?: string;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TableProps extends Props {
|
|
28
|
+
label: string;
|
|
29
|
+
columns: readonly TableColumn[];
|
|
30
|
+
rows: MaybeSignal<readonly TableRow[]>;
|
|
31
|
+
sort?: MaybeSignal<TableSort | undefined>;
|
|
32
|
+
defaultSort?: TableSort;
|
|
33
|
+
onSortChange?: (sort: TableSort) => void;
|
|
34
|
+
selected?: MaybeSignal<readonly string[]>;
|
|
35
|
+
defaultSelected?: readonly string[];
|
|
36
|
+
onSelectedChange?: (ids: readonly string[]) => void;
|
|
37
|
+
selectable?: boolean;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Data table. Sorting and selection are reported; row order and records stay with the caller. */
|
|
41
|
+
export declare const Table: import("meowjsx").Component<TableProps, "table", "body" | "cell" | "header" | "heading" | "resize" | "root" | "row" | "scroller" | "select" | "sort" | "table">;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { defineComponent, derived, h, keyed, unwrap, } from "meowjsx";
|
|
2
|
+
import { Checkbox } from "./checkbox.js";
|
|
3
|
+
import { Icon } from "../icons/icon.js";
|
|
4
|
+
export const tableContract = {
|
|
5
|
+
name: "table",
|
|
6
|
+
parts: [
|
|
7
|
+
"root",
|
|
8
|
+
"scroller",
|
|
9
|
+
"table",
|
|
10
|
+
"header",
|
|
11
|
+
"heading",
|
|
12
|
+
"sort",
|
|
13
|
+
"resize",
|
|
14
|
+
"body",
|
|
15
|
+
"row",
|
|
16
|
+
"cell",
|
|
17
|
+
"select",
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
const defaultMinWidth = 80;
|
|
21
|
+
function sortFor(column, current) {
|
|
22
|
+
if (!column.sortable)
|
|
23
|
+
return current;
|
|
24
|
+
if (current?.columnId !== column.id)
|
|
25
|
+
return { columnId: column.id, direction: "asc" };
|
|
26
|
+
return { columnId: column.id, direction: current.direction === "asc" ? "desc" : "asc" };
|
|
27
|
+
}
|
|
28
|
+
function ariaSort(column, current) {
|
|
29
|
+
if (!column.sortable)
|
|
30
|
+
return undefined;
|
|
31
|
+
if (current?.columnId !== column.id)
|
|
32
|
+
return "none";
|
|
33
|
+
return current.direction === "asc" ? "ascending" : "descending";
|
|
34
|
+
}
|
|
35
|
+
/** Data table. Sorting and selection are reported; row order and records stay with the caller. */
|
|
36
|
+
export const Table = defineComponent(tableContract, ({ label, columns, rows, sort, defaultSort, onSortChange, selected, defaultSelected = [], onSelectedChange, selectable = false, className, ...props }, context) => {
|
|
37
|
+
const localSort = context.signal(defaultSort);
|
|
38
|
+
const localSelected = context.signal(defaultSelected);
|
|
39
|
+
const rowsView = derived(() => unwrap(rows));
|
|
40
|
+
const sortState = derived(() => (sort === undefined ? localSort.value : unwrap(sort)));
|
|
41
|
+
const selectedState = derived(() => selected === undefined ? localSelected.value : unwrap(selected));
|
|
42
|
+
const widths = context.signal(Object.fromEntries(columns.flatMap((column) => column.width !== undefined ? [[column.id, column.width]] : [])));
|
|
43
|
+
const requestSort = (column) => {
|
|
44
|
+
const next = sortFor(column, sortState.value);
|
|
45
|
+
if (!next)
|
|
46
|
+
return;
|
|
47
|
+
if (sort === undefined)
|
|
48
|
+
localSort.value = next;
|
|
49
|
+
onSortChange?.(next);
|
|
50
|
+
};
|
|
51
|
+
const requestSelected = (ids) => {
|
|
52
|
+
if (selected === undefined)
|
|
53
|
+
localSelected.value = ids;
|
|
54
|
+
onSelectedChange?.(ids);
|
|
55
|
+
};
|
|
56
|
+
const toggleRow = (id, checked) => {
|
|
57
|
+
const next = new Set(selectedState.value);
|
|
58
|
+
if (checked)
|
|
59
|
+
next.add(id);
|
|
60
|
+
else
|
|
61
|
+
next.delete(id);
|
|
62
|
+
requestSelected([...next]);
|
|
63
|
+
};
|
|
64
|
+
const enabledIds = () => rowsView.value.filter((row) => !row.disabled).map((row) => row.id);
|
|
65
|
+
let resize;
|
|
66
|
+
const onResizeMove = (event) => {
|
|
67
|
+
if (!resize)
|
|
68
|
+
return;
|
|
69
|
+
const delta = event.clientX - resize.startX;
|
|
70
|
+
const next = Math.max(resize.minWidth, resize.startWidth + delta);
|
|
71
|
+
widths.value = { ...widths.value, [resize.id]: next };
|
|
72
|
+
};
|
|
73
|
+
const onResizeUp = (event) => {
|
|
74
|
+
if (!resize)
|
|
75
|
+
return;
|
|
76
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
77
|
+
resize = undefined;
|
|
78
|
+
};
|
|
79
|
+
const headerCell = (column) => {
|
|
80
|
+
const heading = column.sortable
|
|
81
|
+
? context.part("sort", "button", {
|
|
82
|
+
type: "button",
|
|
83
|
+
onClick: () => requestSort(column),
|
|
84
|
+
}, column.header, h("span", { hidden: derived(() => sortState.value?.columnId !== column.id || sortState.value.direction !== "asc") },
|
|
85
|
+
h(Icon, { name: "arrow-up", size: 12 })), h("span", { hidden: derived(() => sortState.value?.columnId !== column.id || sortState.value.direction !== "desc") },
|
|
86
|
+
h(Icon, { name: "arrow-down", size: 12 })))
|
|
87
|
+
: column.header;
|
|
88
|
+
return context.part("heading", "th", {
|
|
89
|
+
scope: "col",
|
|
90
|
+
"aria-sort": derived(() => ariaSort(column, sortState.value)),
|
|
91
|
+
"data-align": column.align,
|
|
92
|
+
style: derived(() => widths.value[column.id] !== undefined
|
|
93
|
+
? { width: `${widths.value[column.id]}px` }
|
|
94
|
+
: undefined),
|
|
95
|
+
}, heading, column.resizable === false
|
|
96
|
+
? null
|
|
97
|
+
: context.part("resize", "span", {
|
|
98
|
+
role: "separator",
|
|
99
|
+
"aria-orientation": "vertical",
|
|
100
|
+
"aria-label": "Resize column",
|
|
101
|
+
onPointerDown: (event) => {
|
|
102
|
+
if (event.button !== 0)
|
|
103
|
+
return;
|
|
104
|
+
event.preventDefault();
|
|
105
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
106
|
+
const startWidth = widths.value[column.id] ?? column.width ?? defaultMinWidth;
|
|
107
|
+
resize = {
|
|
108
|
+
id: column.id,
|
|
109
|
+
startX: event.clientX,
|
|
110
|
+
startWidth,
|
|
111
|
+
minWidth: column.minWidth ?? defaultMinWidth,
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
onPointerMove: onResizeMove,
|
|
115
|
+
onPointerUp: onResizeUp,
|
|
116
|
+
onPointerCancel: onResizeUp,
|
|
117
|
+
}));
|
|
118
|
+
};
|
|
119
|
+
return context.part("root", "div", { ...props, className }, context.part("scroller", "div", null, context.part("table", "table", { "aria-label": label }, context.part("header", "thead", null, context.part("row", "tr", null, selectable
|
|
120
|
+
? context.part("heading", "th", { scope: "col" }, context.part("select", "div", null, h(Checkbox, { label: "Select all rows", labelHidden: true, checked: derived(() => {
|
|
121
|
+
const enabled = enabledIds();
|
|
122
|
+
const chosen = selectedState.value;
|
|
123
|
+
return enabled.length > 0 && enabled.every((id) => chosen.includes(id));
|
|
124
|
+
}), indeterminate: derived(() => {
|
|
125
|
+
const enabled = enabledIds();
|
|
126
|
+
const count = enabled.filter((id) => selectedState.value.includes(id)).length;
|
|
127
|
+
return count > 0 && count < enabled.length;
|
|
128
|
+
}), onChange: (event) => {
|
|
129
|
+
const box = event.currentTarget;
|
|
130
|
+
requestSelected(box.checked ? enabledIds() : []);
|
|
131
|
+
} })))
|
|
132
|
+
: null, ...columns.map(headerCell))), context.part("body", "tbody", null, keyed(rowsView, (row) => row.id, (row) => context.part("row", "tr", {
|
|
133
|
+
"data-row-id": derived(() => row.value.id),
|
|
134
|
+
"data-selected": derived(() => selectedState.value.includes(row.value.id) ? "true" : undefined),
|
|
135
|
+
}, selectable
|
|
136
|
+
? context.part("cell", "td", { "data-table-select": "" }, context.part("select", "div", null, h(Checkbox, { label: derived(() => {
|
|
137
|
+
const current = row.value;
|
|
138
|
+
if (current.label)
|
|
139
|
+
return current.label;
|
|
140
|
+
const index = rowsView.value.findIndex((item) => item.id === current.id);
|
|
141
|
+
return `Select row ${index + 1}`;
|
|
142
|
+
}), labelHidden: true, disabled: derived(() => Boolean(row.value.disabled)), checked: derived(() => selectedState.value.includes(row.value.id)), onChange: (event) => {
|
|
143
|
+
toggleRow(row.value.id, event.currentTarget.checked);
|
|
144
|
+
} })))
|
|
145
|
+
: null, ...columns.map((column, index) => context.part("cell", "td", { "data-align": column.align }, derived(() => row.value.cells[index])))))))));
|
|
146
|
+
});
|
|
@@ -20,5 +20,5 @@ export interface TabsProps extends Props {
|
|
|
20
20
|
onValueChange?: (value: string) => void;
|
|
21
21
|
className?: string;
|
|
22
22
|
}
|
|
23
|
-
/** Horizontal tabs with automatic keyboard activation.
|
|
23
|
+
/** Horizontal tabs with automatic keyboard activation. Items are fixed for the mount, and panels stay mounted to preserve drafts. */
|
|
24
24
|
export declare const Tabs: import("meowjsx").Component<TabsProps, "tabs", "indicator" | "list" | "panel" | "root" | "tab">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, unwrap, } from "meowjsx";
|
|
2
2
|
import { tokenRef } from "meowcss";
|
|
3
3
|
export const tabsCount = tokenRef("tabs", "count");
|
|
4
4
|
export const tabsIndex = tokenRef("tabs", "index");
|
|
@@ -6,31 +6,22 @@ export const tabsContract = {
|
|
|
6
6
|
name: "tabs",
|
|
7
7
|
parts: ["root", "list", "indicator", "tab", "panel"],
|
|
8
8
|
};
|
|
9
|
-
/** Horizontal tabs with automatic keyboard activation.
|
|
9
|
+
/** Horizontal tabs with automatic keyboard activation. Items are fixed for the mount, and panels stay mounted to preserve drafts. */
|
|
10
10
|
export const Tabs = defineComponent(tabsContract, ({ id, label, items, value, defaultValue, onValueChange, className, ...props }, context) => {
|
|
11
11
|
const enabled = items.flatMap((item, index) => (item.disabled ? [] : [index]));
|
|
12
12
|
const local = context.signal(defaultValue ?? items[enabled[0] ?? -1]?.value ?? "");
|
|
13
13
|
const focus = context.signal(enabled[0] ?? -1);
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const current = value !== undefined ? value : local;
|
|
15
|
+
const activeIndex = derived(() => items.findIndex((item) => item.value === unwrap(current) && !item.disabled));
|
|
16
|
+
const indicatorIndex = derived(() => Math.max(0, activeIndex.value));
|
|
17
|
+
const indicatorHidden = derived(() => activeIndex.value < 0);
|
|
18
|
+
const selected = items.map((_, index) => derived(() => String(index === activeIndex.value)));
|
|
19
|
+
const hidden = items.map((_, index) => derived(() => index !== activeIndex.value));
|
|
20
|
+
const tabIndex = items.map((_, index) => derived(() => (index === focus.value ? 0 : -1)));
|
|
21
|
+
// Arrow keys set focus themselves. A host-driven value still moves the roving tabindex.
|
|
19
22
|
context.effect(() => {
|
|
20
|
-
const
|
|
21
|
-
const active = items.findIndex((item) => item.value === current && !item.disabled);
|
|
22
|
-
indicatorIndex.value = Math.max(0, active);
|
|
23
|
-
indicatorHidden.value = active < 0;
|
|
23
|
+
const active = activeIndex.value;
|
|
24
24
|
focus.value = active >= 0 ? active : (enabled[0] ?? -1);
|
|
25
|
-
for (const [index] of items.entries()) {
|
|
26
|
-
selected[index].value = String(index === active);
|
|
27
|
-
hidden[index].value = index !== active;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
context.effect(() => {
|
|
31
|
-
const focused = focus.value;
|
|
32
|
-
for (const [index] of items.entries())
|
|
33
|
-
tabIndex[index].value = index === focused ? 0 : -1;
|
|
34
25
|
});
|
|
35
26
|
const choose = (index) => {
|
|
36
27
|
const item = items[index];
|
|
@@ -60,14 +60,14 @@ export function terminalSpans(text) {
|
|
|
60
60
|
}
|
|
61
61
|
export const TerminalBlock = defineComponent(terminalBlockContract, ({ command, cwd, output = "", running = false, exitCode, signal, maxLines, copyText, onCopy, ...props }, context) => {
|
|
62
62
|
const status = running
|
|
63
|
-
? "
|
|
63
|
+
? "Running"
|
|
64
64
|
: signal
|
|
65
|
-
?
|
|
65
|
+
? `Signal ${signal}`
|
|
66
66
|
: exitCode === 0
|
|
67
|
-
? "
|
|
67
|
+
? "Completed"
|
|
68
68
|
: typeof exitCode === "number"
|
|
69
|
-
?
|
|
70
|
-
: "
|
|
69
|
+
? `Exit code ${exitCode}`
|
|
70
|
+
: "Unknown exit status";
|
|
71
71
|
const failed = !running && (Boolean(signal) || (typeof exitCode === "number" && exitCode !== 0));
|
|
72
72
|
const state = running ? "ongoing" : failed ? "error" : exitCode === 0 ? "done" : "warning";
|
|
73
73
|
const rows = output ? terminalSpans(output) : [];
|
|
@@ -94,7 +94,7 @@ export const TerminalBlock = defineComponent(terminalBlockContract, ({ command,
|
|
|
94
94
|
? context.part("status", "span", {
|
|
95
95
|
"data-terminal-error": failed ? "true" : undefined,
|
|
96
96
|
}, h(Pill, { style: "color:inherit" }, status))
|
|
97
|
-
: null), copyText: copyText ?? output, maxLines: maxLines, onCopy: onCopy, emptyText: running ? "
|
|
97
|
+
: null), copyText: copyText ?? output, maxLines: maxLines, onCopy: onCopy, emptyText: running ? "Waiting for output" : "No output", rows: rows.length
|
|
98
98
|
? rows.map((row) => row.map((span) => context.part("span", "span", {
|
|
99
99
|
"data-ansi-color": span.color,
|
|
100
100
|
"data-ansi-bold": span.bold ? "true" : undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, createContext, useContext, h, unwrap, } from "meowjsx";
|
|
1
|
+
import { defineComponent, derived, createContext, useContext, h, unwrap, } from "meowjsx";
|
|
2
2
|
const ShimmerContent = createContext(false);
|
|
3
3
|
export const textShimmerContract = {
|
|
4
4
|
name: "text-shimmer",
|
|
@@ -9,9 +9,6 @@ export const TextShimmer = defineComponent(textShimmerContract, ({ text, childre
|
|
|
9
9
|
const content = text ?? children;
|
|
10
10
|
if (useContext(ShimmerContent))
|
|
11
11
|
return context.part("content", "span", { ...props, className }, content);
|
|
12
|
-
const activity =
|
|
13
|
-
context.effect(() => {
|
|
14
|
-
activity.value = String(unwrap(active));
|
|
15
|
-
});
|
|
12
|
+
const activity = derived(() => String(unwrap(active)));
|
|
16
13
|
return context.part("root", "span", { ...props, className, "data-active": activity }, context.part("content", "span", { className: contentClassName }, h(ShimmerContent.Provider, { value: true }, content)), context.part("decoration", "span", { "aria-hidden": "true", inert: true }, context.part("content", "span", { className: contentClassName }, h(ShimmerContent.Provider, { value: true }, content))));
|
|
17
14
|
});
|
|
@@ -23,18 +23,18 @@ export const WebBlock = defineComponent(webBlockContract, (props, context) => {
|
|
|
23
23
|
return context.part("root", "section", { ...rest, "data-web-kind": kind }, kind === "fetch"
|
|
24
24
|
? [
|
|
25
25
|
link(props.url),
|
|
26
|
-
context.part("meta", "div", {}, `HTTP ${props.statusCode}${truncated ? " ·
|
|
26
|
+
context.part("meta", "div", {}, `HTTP ${props.statusCode}${truncated ? " · Content truncated" : ""}`),
|
|
27
27
|
]
|
|
28
28
|
: [
|
|
29
29
|
props.answer ? context.part("answer", "div", {}, props.answer) : null,
|
|
30
30
|
!props.answer && props.sources.length === 0
|
|
31
|
-
? context.part("meta", "div", {}, "
|
|
31
|
+
? context.part("meta", "div", {}, "No results")
|
|
32
32
|
: null,
|
|
33
33
|
context.part("sources", "ol", {}, props.sources.map((source, index) => context.part("source", "li", { value: index + 1 }, [
|
|
34
34
|
link(source.url, source.title),
|
|
35
35
|
source.snippet ? context.part("snippet", "div", {}, source.snippet) : null,
|
|
36
36
|
source.publishedAt ? context.part("meta", "div", {}, source.publishedAt) : null,
|
|
37
37
|
]))),
|
|
38
|
-
truncated ? context.part("meta", "div", {}, "
|
|
38
|
+
truncated ? context.part("meta", "div", {}, "Source list truncated") : null,
|
|
39
39
|
]);
|
|
40
40
|
});
|
|
@@ -8,9 +8,9 @@ export interface WorkCardProps extends Props {
|
|
|
8
8
|
title: Child;
|
|
9
9
|
/** What the dot says; the words in `status` stay the source of truth. */
|
|
10
10
|
state?: MaybeSignal<StatusDotState>;
|
|
11
|
-
/** Current status in words, for example "
|
|
11
|
+
/** Current status in words, for example "In progress: reviewing the record format". */
|
|
12
12
|
status?: Child;
|
|
13
|
-
/** A quiet extra fact after the status, for example "
|
|
13
|
+
/** A quiet extra fact after the status, for example "1 outcome linked". */
|
|
14
14
|
detail?: Child;
|
|
15
15
|
icon?: Child;
|
|
16
16
|
/** Label of the open affordance; the whole card is the control. */
|
|
@@ -6,6 +6,6 @@ export const workCardContract = {
|
|
|
6
6
|
parts: ["root", "icon", "copy", "title", "status", "statusText", "detail", "action"],
|
|
7
7
|
};
|
|
8
8
|
/** A work reference inside a conversation: one control that opens the work's details. */
|
|
9
|
-
export const WorkCard = defineComponent(workCardContract, ({ title, state = "unknown", status, detail, icon, action = "
|
|
9
|
+
export const WorkCard = defineComponent(workCardContract, ({ title, state = "unknown", status, detail, icon, action = "Details", className, children, ...props }, context) => context.part("root", "button", { type: "button", ...props, className }, context.part("icon", "span", { "aria-hidden": "true" }, icon ?? h(Icon, { name: "file-text" })), context.part("copy", "span", null, context.part("title", "strong", null, title), status !== undefined || detail !== undefined
|
|
10
10
|
? context.part("status", "span", null, h(StatusDot, { state: state, size: 6 }), context.part("statusText", "span", { "data-work-card-status": true }, status), detail ? context.part("detail", "span", null, detail) : null)
|
|
11
11
|
: null, children), context.part("action", "span", null, action, h(Icon, { name: "chevron-right", size: 14 }))));
|
package/dist/src/icons/README.md
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
# Functional icons
|
|
2
2
|
|
|
3
|
-
`Icon` renders
|
|
3
|
+
`Icon` renders meowtail's finite semantic icon set through native MeowJSX. The SVG geometry is imported from the pinned `lucide` dependency; no paths are copied into this package, except the optical override documented below. Upstream is ISC with inherited Feather MIT icons: the license is preserved in `LUCIDE-LICENSE` and summarized in `THIRD_PARTY_NOTICES.md`.
|
|
4
4
|
|
|
5
5
|
Use `<Icon name="copy" size={16} />` beside a text label. An icon-only button needs an accessible label on the button. For a standalone meaningful image, provide `label`; otherwise the SVG is decorative. All functional icons use a 24-unit viewBox, currentColor and round joins. SVG presentation attributes provide an 18px size and 2-unit stroke when unthemed; the active theme can override sizing and optical stroke weight through CSS templates using `uiTokens.iconSize` and `uiTokens.iconStroke`. There is no inline style locking these values. Keep brand artwork separate (`MeowlandMark`, `GithubIcon`, `DoodleCat`).
|
|
6
6
|
|
|
7
|
+
`IconName` and `iconNames` are the finite semantic inventory used by this library and its JSON contracts. For application icons outside that set, `IconSource` renders caller-supplied structural `IconNode` data through the same frame, size, and accessibility rules:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { IconSource } from "meowtail/icons";
|
|
11
|
+
import { Bell } from "meowtail/icons/lucide";
|
|
12
|
+
|
|
13
|
+
<IconSource source={Bell} size={16} label="Notifications" />;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`source` is trusted developer input, never untrusted JSON or user-generated markup, and is expected to follow the same 24-unit stroked-outline contract. The pinned Lucide pass-through at `meowtail/icons/lucide` provides the full Lucide surface; its icon names and API belong to Lucide and move only when this package's pinned dependency moves. Bundlers tree-shake unused icons; a native no-bundler import loads the upstream entry as a whole.
|
|
17
|
+
|
|
7
18
|
`ChatAttachments` uses the shared `file` shape to identify files; `ChatToolCall` uses `chevron-right` for disclosure and `arrow-up-right` for a non-collapsible operation. They remain decorative beside descriptive text. The theme controls geometry and disclosure rotation; these components do not substitute font glyphs for icons.
|
|
8
19
|
|
|
9
|
-
|
|
20
|
+
Import a node from `lucide` in `icon.tsx` and add one key to `shapes` when the library needs a new semantic icon; `IconName` and `iconNames` stay in sync automatically. Keep the dependency version, `LUCIDE-LICENSE`, and `THIRD_PARTY_NOTICES.md` in step with that change. `settings` keeps a local optical override because the upstream gear reads larger and rounder at the standard theme's 16px icon size. The UI Workshop renders the semantic inventory. Existing named icon components remain public convenience entry points for other applications.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Child } from "meowjsx";
|
|
2
|
+
/** Shared SVG frame for functional icons; the theme owns its optical stroke. */
|
|
3
|
+
export interface IconFrameProps {
|
|
4
|
+
size?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Omit for decorative icons. Icon-only controls should label the control itself. */
|
|
7
|
+
label?: string;
|
|
8
|
+
dataIcon?: string;
|
|
9
|
+
children?: Child;
|
|
10
|
+
}
|
|
11
|
+
export declare function IconFrame({ size, className, label, dataIcon, children, }: IconFrameProps): Child;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
export function IconFrame({ size = 18, className, label, dataIcon, children, }) {
|
|
3
|
+
return (h("svg", { className: ["meow-icon", className].filter(Boolean).join(" "), "data-icon": dataIcon, width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": label ? undefined : "true", role: label ? "img" : undefined, "aria-label": label, focusable: "false" }, children));
|
|
4
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Child } from "meowjsx";
|
|
2
|
+
/**
|
|
3
|
+
* Trusted structural icon data: ordered [tag, attributes] SVG pairs.
|
|
4
|
+
* The shape matches Lucide icon nodes and other plain SVG node data; never pass
|
|
5
|
+
* untrusted JSON or user-generated markup through this entry point.
|
|
6
|
+
*/
|
|
7
|
+
export type IconNode = ReadonlyArray<readonly [tag: string, attrs: Readonly<Record<string, string | number | undefined>>]>;
|
|
8
|
+
export interface IconSourceProps {
|
|
9
|
+
/** Icon node data supplied by the caller from its own trusted icon source. */
|
|
10
|
+
source: IconNode;
|
|
11
|
+
size?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Omit for decorative icons. Icon-only controls should label the control itself. */
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Render caller-supplied icon data through the shared functional-icon frame. */
|
|
17
|
+
export declare function IconSource({ source, size, className, label }: IconSourceProps): Child;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { IconFrame } from "./icon-frame.js";
|
|
3
|
+
/** Render caller-supplied icon data through the shared functional-icon frame. */
|
|
4
|
+
export function IconSource({ source, size, className, label }) {
|
|
5
|
+
return (h(IconFrame, { size: size, className: className, label: label }, source.map(([tag, attrs]) => h(tag, attrs))));
|
|
6
|
+
}
|
package/dist/src/icons/icon.d.ts
CHANGED
|
@@ -1,42 +1,49 @@
|
|
|
1
1
|
import { type Child } from "meowjsx";
|
|
2
|
+
declare const settings: () => import("meowjsx").VNode;
|
|
2
3
|
declare const shapes: {
|
|
3
|
-
terminal: () =>
|
|
4
|
-
menu: () =>
|
|
5
|
-
settings:
|
|
6
|
-
"arrow-up": () =>
|
|
7
|
-
"list-checks": () =>
|
|
8
|
-
"message-square": () =>
|
|
9
|
-
map: () =>
|
|
10
|
-
"user-round": () =>
|
|
11
|
-
"notebook-tabs": () =>
|
|
12
|
-
"refresh-cw": () =>
|
|
13
|
-
paperclip: () =>
|
|
14
|
-
"arrow-down": () =>
|
|
15
|
-
"arrow-left": () =>
|
|
16
|
-
"arrow-right": () =>
|
|
17
|
-
"arrow-up-right": () =>
|
|
18
|
-
"file-text": () =>
|
|
19
|
-
file: () =>
|
|
20
|
-
folder: () =>
|
|
21
|
-
"folder-open": () =>
|
|
22
|
-
copy: () =>
|
|
23
|
-
x: () =>
|
|
24
|
-
"chevron-down": () =>
|
|
25
|
-
"chevron-left": () =>
|
|
26
|
-
"chevron-right": () =>
|
|
27
|
-
"chevron-up": () =>
|
|
28
|
-
search: () =>
|
|
29
|
-
plus: () =>
|
|
30
|
-
minus: () =>
|
|
31
|
-
"panel-left": () =>
|
|
32
|
-
list: () =>
|
|
33
|
-
network: () =>
|
|
34
|
-
"external-link": () =>
|
|
35
|
-
brain: () =>
|
|
36
|
-
eye: () =>
|
|
37
|
-
wrench: () =>
|
|
38
|
-
"loader-circle": () =>
|
|
39
|
-
square: () =>
|
|
4
|
+
terminal: () => Child;
|
|
5
|
+
menu: () => Child;
|
|
6
|
+
settings: typeof settings;
|
|
7
|
+
"arrow-up": () => Child;
|
|
8
|
+
"list-checks": () => Child;
|
|
9
|
+
"message-square": () => Child;
|
|
10
|
+
map: () => Child;
|
|
11
|
+
"user-round": () => Child;
|
|
12
|
+
"notebook-tabs": () => Child;
|
|
13
|
+
"refresh-cw": () => Child;
|
|
14
|
+
paperclip: () => Child;
|
|
15
|
+
"arrow-down": () => Child;
|
|
16
|
+
"arrow-left": () => Child;
|
|
17
|
+
"arrow-right": () => Child;
|
|
18
|
+
"arrow-up-right": () => Child;
|
|
19
|
+
"file-text": () => Child;
|
|
20
|
+
file: () => Child;
|
|
21
|
+
folder: () => Child;
|
|
22
|
+
"folder-open": () => Child;
|
|
23
|
+
copy: () => Child;
|
|
24
|
+
x: () => Child;
|
|
25
|
+
"chevron-down": () => Child;
|
|
26
|
+
"chevron-left": () => Child;
|
|
27
|
+
"chevron-right": () => Child;
|
|
28
|
+
"chevron-up": () => Child;
|
|
29
|
+
search: () => Child;
|
|
30
|
+
plus: () => Child;
|
|
31
|
+
minus: () => Child;
|
|
32
|
+
"panel-left": () => Child;
|
|
33
|
+
list: () => Child;
|
|
34
|
+
network: () => Child;
|
|
35
|
+
"external-link": () => Child;
|
|
36
|
+
brain: () => Child;
|
|
37
|
+
eye: () => Child;
|
|
38
|
+
wrench: () => Child;
|
|
39
|
+
"loader-circle": () => Child;
|
|
40
|
+
square: () => Child;
|
|
41
|
+
mic: () => Child;
|
|
42
|
+
"shield-check": () => Child;
|
|
43
|
+
gauge: () => Child;
|
|
44
|
+
timer: () => Child;
|
|
45
|
+
database: () => Child;
|
|
46
|
+
history: () => Child;
|
|
40
47
|
};
|
|
41
48
|
export type IconName = keyof typeof shapes;
|
|
42
49
|
export declare const iconNames: IconName[];
|