meowtail 0.4.0-alpha.4 → 0.4.0-alpha.6
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/ASSISTANT.md +1 -1
- package/CHANGELOG.md +37 -0
- package/COMPONENTS.md +3 -2
- package/README.md +77 -2
- package/dist/src/chat/assistant-composer.js +1 -10
- package/dist/src/chat/assistant-types.d.ts +6 -0
- package/dist/src/chat/composer-triggers.d.ts +70 -0
- package/dist/src/chat/composer-triggers.js +35 -0
- package/dist/src/chat/composer.d.ts +24 -4
- package/dist/src/chat/composer.js +288 -8
- package/dist/src/chat/index.d.ts +1 -0
- package/dist/src/chat/index.js +1 -0
- package/dist/src/components/button.d.ts +3 -1
- package/dist/src/components/button.js +16 -1
- package/dist/src/components/choice-select.d.ts +5 -2
- package/dist/src/components/choice-select.js +7 -3
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/item.d.ts +7 -2
- package/dist/src/components/item.js +4 -4
- package/dist/src/components/stat.d.ts +24 -0
- package/dist/src/components/stat.js +15 -0
- package/dist/src/registry/index.d.ts +5 -1
- package/dist/src/registry/index.js +2 -0
- package/dist/src/theme/base.styles.js +5 -0
- package/dist/src/theme/chat/composer.styles.js +98 -0
- package/dist/src/theme/components/button.styles.js +25 -11
- package/dist/src/theme/components/choice-select.styles.js +19 -4
- package/dist/src/theme/components/item.styles.js +13 -5
- package/dist/src/theme/components/nav-list.styles.js +2 -0
- package/dist/src/theme/components/output-block.styles.js +35 -10
- package/dist/src/theme/components/stat.styles.d.ts +1 -0
- package/dist/src/theme/components/stat.styles.js +54 -0
- package/dist/src/theme/doodle.tokens.d.ts +120 -58
- package/dist/src/theme/doodle.tokens.js +50 -27
- package/dist/src/theme/index.d.ts +428 -30
- package/dist/src/theme/index.js +18 -0
- package/dist/src/theme/journal.tokens.d.ts +62 -0
- package/dist/src/theme/journal.tokens.js +2 -0
- package/dist/src/theme/meow.tokens.d.ts +62 -0
- package/dist/src/theme/meow.tokens.js +2 -0
- package/dist/src/theme/ottr.tokens.d.ts +62 -0
- package/dist/src/theme/ottr.tokens.js +1 -0
- package/dist/src/theme/pine.tokens.d.ts +426 -0
- package/dist/src/theme/pine.tokens.js +126 -0
- package/dist/src/theme/tokens.d.ts +70 -0
- package/dist/src/theme/tokens.js +35 -0
- package/dist/src/theme/utilities.js +1 -1
- package/package.json +2 -2
|
@@ -1,28 +1,232 @@
|
|
|
1
1
|
import { defineStyleProps } from "meowcss/meowjsx";
|
|
2
|
-
import { h } from "meowjsx";
|
|
3
|
-
import { derived, unwrap } from "meowjsx/signal";
|
|
2
|
+
import { h, keyed } from "meowjsx";
|
|
3
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
4
|
+
import { Popover } from "../components/popover.js";
|
|
5
|
+
import { elementByIdInRoot } from "../shared/dom-root.js";
|
|
6
|
+
import { elementId } from "../shared/element-id.js";
|
|
7
|
+
import { findComposerTrigger, insertComposerSuggestion, } from "./composer-triggers.js";
|
|
4
8
|
import { chatComposerOptions } from "./composer.options.js";
|
|
5
9
|
import { Icon } from "../icons/icon.js";
|
|
6
|
-
|
|
7
|
-
|
|
10
|
+
const sameMatch = (a, b) => a === b || (!!a && !!b && a.index === b.index && a.char === b.char && a.query === b.query);
|
|
11
|
+
/** The message input of a conversation, with attachments, choices, suggestions and send. */
|
|
12
|
+
export function ChatComposer({ value, defaultValue = "", onValueChange, placeholder = "Write a message…", inputLabel = "Message", attachments, trailing, hint, hintId, submitLabel = "Send", submitContent, disabled = false, readOnly = false, submitDisabled = false, submitOn = "none", triggers = [], suggestionPlacement = "top", loadingMessage = "Loading suggestions", onSubmit, onInput, children, className, ref, ...props }, context) {
|
|
13
|
+
const local = signal(defaultValue);
|
|
14
|
+
const current = value !== undefined ? value : local;
|
|
8
15
|
const submitBlocked = disabled === true
|
|
9
16
|
? true
|
|
10
17
|
: typeof disabled === "boolean"
|
|
11
18
|
? submitDisabled
|
|
12
19
|
: derived(() => Boolean(unwrap(disabled)) || Boolean(unwrap(submitDisabled)));
|
|
20
|
+
const blocked = () => Boolean(unwrap(disabled)) || Boolean(unwrap(readOnly)) || Boolean(unwrap(submitDisabled));
|
|
21
|
+
const hasTriggers = triggers.length > 0;
|
|
22
|
+
// Ids only exist where the suggestion list needs them, so plain composers render as before.
|
|
23
|
+
const baseId = hasTriggers ? elementId("chat-composer") : "";
|
|
24
|
+
const surfaceId = `${baseId}-surface`;
|
|
25
|
+
const listId = `${baseId}-suggestions`;
|
|
13
26
|
let field;
|
|
27
|
+
let submitButton;
|
|
28
|
+
let alive = true;
|
|
29
|
+
context.onCleanup(() => {
|
|
30
|
+
alive = false;
|
|
31
|
+
});
|
|
14
32
|
const resize = () => {
|
|
15
33
|
if (!field?.isConnected)
|
|
16
34
|
return;
|
|
17
35
|
field.style.height = "auto";
|
|
18
36
|
field.style.height = `${field.scrollHeight}px`;
|
|
19
37
|
};
|
|
38
|
+
// The trigger occurrence under the caret, and the one the reader dismissed.
|
|
39
|
+
const match = signal(null);
|
|
40
|
+
let dismissed = null;
|
|
41
|
+
const items = signal([]);
|
|
42
|
+
const loading = signal(false);
|
|
43
|
+
const settled = signal(false);
|
|
44
|
+
const picked = signal(undefined);
|
|
45
|
+
const evaluate = (fromPaste = false) => {
|
|
46
|
+
if (!triggers.length)
|
|
47
|
+
return;
|
|
48
|
+
const element = field;
|
|
49
|
+
const usable = element &&
|
|
50
|
+
element.isConnected &&
|
|
51
|
+
element.ownerDocument.activeElement === element &&
|
|
52
|
+
!unwrap(disabled) &&
|
|
53
|
+
!unwrap(readOnly);
|
|
54
|
+
const found = usable && element.selectionStart === element.selectionEnd
|
|
55
|
+
? findComposerTrigger(element.value, element.selectionStart, triggers)
|
|
56
|
+
: null;
|
|
57
|
+
const trigger = found ? triggers.find((candidate) => candidate.char === found.char) : undefined;
|
|
58
|
+
let next = found && trigger ? { ...found, trigger } : null;
|
|
59
|
+
if (dismissed && (!next || next.index !== dismissed.index || next.char !== dismissed.char))
|
|
60
|
+
dismissed = null;
|
|
61
|
+
// A paste never opens a list; it dismisses the occurrence it lands in.
|
|
62
|
+
if (next && fromPaste && !sameMatch(match.value, next))
|
|
63
|
+
dismissed = next;
|
|
64
|
+
if (next && dismissed)
|
|
65
|
+
next = null;
|
|
66
|
+
if (!sameMatch(match.value, next)) {
|
|
67
|
+
if (match.value?.index !== next?.index || match.value?.char !== next?.char)
|
|
68
|
+
picked.value = undefined;
|
|
69
|
+
match.value = next;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const close = () => {
|
|
73
|
+
if (match.value)
|
|
74
|
+
dismissed = { index: match.value.index, char: match.value.char };
|
|
75
|
+
match.value = null;
|
|
76
|
+
};
|
|
77
|
+
// Lookup: a synchronous result re-runs when Signals the host read change; a late result is dropped.
|
|
78
|
+
let lookup;
|
|
79
|
+
context.effect(() => {
|
|
80
|
+
const active = match.value;
|
|
81
|
+
lookup?.abort();
|
|
82
|
+
lookup = undefined;
|
|
83
|
+
if (!active || unwrap(active.trigger.disabled ?? false)) {
|
|
84
|
+
items.value = [];
|
|
85
|
+
loading.value = false;
|
|
86
|
+
settled.value = false;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const controller = new AbortController();
|
|
90
|
+
lookup = controller;
|
|
91
|
+
const result = active.trigger.suggest(active.query, { signal: controller.signal });
|
|
92
|
+
if (typeof result.then !== "function") {
|
|
93
|
+
items.value = result;
|
|
94
|
+
loading.value = false;
|
|
95
|
+
settled.value = true;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
loading.value = true;
|
|
99
|
+
settled.value = false;
|
|
100
|
+
void Promise.resolve(result).then((list) => {
|
|
101
|
+
if (!alive || lookup !== controller)
|
|
102
|
+
return;
|
|
103
|
+
items.value = list;
|
|
104
|
+
loading.value = false;
|
|
105
|
+
settled.value = true;
|
|
106
|
+
}, () => {
|
|
107
|
+
if (!alive || lookup !== controller)
|
|
108
|
+
return;
|
|
109
|
+
items.value = [];
|
|
110
|
+
loading.value = false;
|
|
111
|
+
settled.value = true;
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
context.onCleanup(() => lookup?.abort());
|
|
115
|
+
const enabledItems = () => items.value.filter((item) => !item.disabled);
|
|
116
|
+
const activeId = derived(() => {
|
|
117
|
+
const list = enabledItems();
|
|
118
|
+
return (list.find((item) => item.id === picked.value) ?? list[0])?.id;
|
|
119
|
+
});
|
|
120
|
+
const emptyMessage = derived(() => match.value?.trigger.emptyMessage);
|
|
121
|
+
const showEmpty = derived(() => settled.value && items.value.length === 0 && emptyMessage.value !== undefined);
|
|
122
|
+
const open = derived(() => match.value !== null &&
|
|
123
|
+
!unwrap(match.value.trigger.disabled ?? false) &&
|
|
124
|
+
(items.value.length > 0 || loading.value || showEmpty.value));
|
|
125
|
+
const optionIds = new Map();
|
|
126
|
+
const optionId = (key) => {
|
|
127
|
+
let known = optionIds.get(key);
|
|
128
|
+
if (!known)
|
|
129
|
+
optionIds.set(key, (known = elementId(`${baseId}-option`)));
|
|
130
|
+
return known;
|
|
131
|
+
};
|
|
132
|
+
const announcement = derived(() => {
|
|
133
|
+
if (!open.value)
|
|
134
|
+
return "";
|
|
135
|
+
if (loading.value)
|
|
136
|
+
return loadingMessage;
|
|
137
|
+
if (showEmpty.value)
|
|
138
|
+
return emptyMessage.value ?? "";
|
|
139
|
+
const count = items.value.length;
|
|
140
|
+
return `${match.value.trigger.label}: ${count} ${count === 1 ? "suggestion" : "suggestions"}`;
|
|
141
|
+
});
|
|
142
|
+
const write = (text) => {
|
|
143
|
+
if (value === undefined)
|
|
144
|
+
local.value = text;
|
|
145
|
+
onValueChange?.(text);
|
|
146
|
+
};
|
|
147
|
+
const accept = (suggestion) => {
|
|
148
|
+
const active = match.value;
|
|
149
|
+
const element = field;
|
|
150
|
+
if (!active || !element || suggestion.disabled)
|
|
151
|
+
return;
|
|
152
|
+
const next = insertComposerSuggestion(element.value, active, suggestion);
|
|
153
|
+
write(next.text);
|
|
154
|
+
// A controlled host that ignores the change still sees the field match its own value.
|
|
155
|
+
element.value = value === undefined ? next.text : unwrap(current);
|
|
156
|
+
element.setSelectionRange(next.caret, next.caret);
|
|
157
|
+
resize();
|
|
158
|
+
match.value = null;
|
|
159
|
+
dismissed = null;
|
|
160
|
+
evaluate();
|
|
161
|
+
active.trigger.onAccept?.(suggestion);
|
|
162
|
+
};
|
|
163
|
+
const reveal = (key) => {
|
|
164
|
+
queueMicrotask(() => {
|
|
165
|
+
if (!alive || !field)
|
|
166
|
+
return;
|
|
167
|
+
elementByIdInRoot(field, optionId(key))?.scrollIntoView?.({ block: "nearest" });
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
const move = (step) => {
|
|
171
|
+
const list = enabledItems();
|
|
172
|
+
if (!list.length)
|
|
173
|
+
return;
|
|
174
|
+
const index = list.findIndex((item) => item.id === activeId.value);
|
|
175
|
+
const next = list[(index + step + list.length) % list.length];
|
|
176
|
+
picked.value = next.id;
|
|
177
|
+
reveal(next.id);
|
|
178
|
+
};
|
|
179
|
+
const keydown = (event) => {
|
|
180
|
+
if (event.isComposing || event.keyCode === 229)
|
|
181
|
+
return;
|
|
182
|
+
if (open.value) {
|
|
183
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
move(event.key === "ArrowDown" ? 1 : -1);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if ((event.key === "Enter" || event.key === "Tab") && !event.altKey) {
|
|
189
|
+
const chosen = enabledItems().find((item) => item.id === activeId.value);
|
|
190
|
+
if (chosen) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
accept(chosen);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (event.key === "Escape") {
|
|
197
|
+
event.preventDefault();
|
|
198
|
+
close();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (event.key !== "Enter" || submitOn === "none" || event.altKey)
|
|
203
|
+
return;
|
|
204
|
+
const modifier = event.metaKey || event.ctrlKey;
|
|
205
|
+
const wanted = submitOn === "enter" ? !event.shiftKey && !modifier : modifier;
|
|
206
|
+
if (!wanted)
|
|
207
|
+
return;
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
if (blocked())
|
|
210
|
+
return;
|
|
211
|
+
const form = field?.form;
|
|
212
|
+
if (form && submitButton)
|
|
213
|
+
form.requestSubmit(submitButton);
|
|
214
|
+
};
|
|
20
215
|
const parts = context.parts;
|
|
21
216
|
const inputRef = (textarea) => {
|
|
22
217
|
field = textarea;
|
|
23
218
|
const stop = context.effect(() => {
|
|
24
|
-
unwrap(
|
|
219
|
+
unwrap(current);
|
|
25
220
|
resize();
|
|
221
|
+
// Text the host changed (a cleared draft, a removed reference) moves the occurrence too.
|
|
222
|
+
queueMicrotask(() => {
|
|
223
|
+
if (alive)
|
|
224
|
+
evaluate();
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
const stopState = context.effect(() => {
|
|
228
|
+
if (unwrap(disabled) || unwrap(readOnly))
|
|
229
|
+
match.value = null;
|
|
26
230
|
});
|
|
27
231
|
const onResizeInput = () => resize();
|
|
28
232
|
textarea.addEventListener("input", onResizeInput);
|
|
@@ -32,22 +236,88 @@ export function ChatComposer({ value = "", placeholder = "Write a message…", i
|
|
|
32
236
|
if (textarea.isConnected)
|
|
33
237
|
resize();
|
|
34
238
|
});
|
|
239
|
+
const form = textarea.form;
|
|
240
|
+
let timer;
|
|
241
|
+
// Native reset restores the attribute default; the owner signal follows it.
|
|
242
|
+
const reset = (event) => {
|
|
243
|
+
clearTimeout(timer);
|
|
244
|
+
timer = setTimeout(() => {
|
|
245
|
+
if (!alive || event.defaultPrevented)
|
|
246
|
+
return;
|
|
247
|
+
write(defaultValue);
|
|
248
|
+
textarea.value = unwrap(current);
|
|
249
|
+
match.value = null;
|
|
250
|
+
resize();
|
|
251
|
+
}, 0);
|
|
252
|
+
};
|
|
253
|
+
form?.addEventListener("reset", reset);
|
|
35
254
|
return () => {
|
|
36
255
|
stop();
|
|
256
|
+
stopState();
|
|
257
|
+
clearTimeout(timer);
|
|
258
|
+
form?.removeEventListener("reset", reset);
|
|
37
259
|
textarea.removeEventListener("input", onResizeInput);
|
|
38
260
|
observer?.disconnect();
|
|
39
261
|
field = undefined;
|
|
40
262
|
};
|
|
41
263
|
};
|
|
42
264
|
return (h("form", { ...props, className: className, onSubmit: onSubmit, ref: [parts.root, ref] },
|
|
43
|
-
h("div", { ref: parts.surface },
|
|
265
|
+
h("div", { id: hasTriggers ? surfaceId : undefined, ref: parts.surface },
|
|
44
266
|
attachments ? h("div", { ref: parts.attachments }, attachments) : null,
|
|
45
267
|
h("div", { ref: parts.field },
|
|
46
|
-
h("textarea", { "data-chat-input": true, name: "message", rows: 1, value:
|
|
268
|
+
h("textarea", { "data-chat-input": true, name: "message", rows: 1, value: current, placeholder: placeholder, "aria-label": inputLabel, "aria-describedby": hint && hintId ? hintId : undefined, "aria-autocomplete": hasTriggers ? "list" : undefined, "aria-haspopup": hasTriggers ? "listbox" : undefined, "aria-controls": hasTriggers ? derived(() => (open.value ? listId : undefined)) : undefined, "aria-activedescendant": hasTriggers
|
|
269
|
+
? derived(() => open.value && activeId.value !== undefined
|
|
270
|
+
? optionId(activeId.value)
|
|
271
|
+
: undefined)
|
|
272
|
+
: undefined, disabled: disabled, readOnly: readOnly, onInput: (event) => {
|
|
273
|
+
const text = event.currentTarget.value;
|
|
274
|
+
if (value === undefined)
|
|
275
|
+
local.value = text;
|
|
276
|
+
onValueChange?.(text);
|
|
277
|
+
onInput?.(event);
|
|
278
|
+
evaluate(event.inputType === "insertFromPaste");
|
|
279
|
+
}, onKeyDown: keydown, onKeyUp: (event) => {
|
|
280
|
+
if (["ArrowLeft", "ArrowRight", "Home", "End", "PageUp", "PageDown"].includes(event.key))
|
|
281
|
+
evaluate();
|
|
282
|
+
else if (!open.value && (event.key === "ArrowUp" || event.key === "ArrowDown"))
|
|
283
|
+
evaluate();
|
|
284
|
+
}, onPointerUp: () => evaluate(), onFocus: () => evaluate(), onBlur: () => {
|
|
285
|
+
match.value = null;
|
|
286
|
+
}, ref: [parts.input, inputRef] })),
|
|
47
287
|
h("div", { ref: parts.actions },
|
|
48
288
|
children,
|
|
49
289
|
trailing ? h("div", { ref: parts.trailing }, trailing) : null,
|
|
50
|
-
h("button", { type: "submit", disabled: submitBlocked, "aria-label": submitLabel, ref:
|
|
290
|
+
h("button", { type: "submit", disabled: submitBlocked, "aria-label": submitLabel, ref: [
|
|
291
|
+
parts.submit,
|
|
292
|
+
(element) => {
|
|
293
|
+
submitButton = element;
|
|
294
|
+
},
|
|
295
|
+
] }, submitContent ?? h(Icon, { name: "arrow-up" })))),
|
|
296
|
+
hasTriggers ? (h("div", { ref: parts.suggestions },
|
|
297
|
+
h(Popover, {
|
|
298
|
+
id: `${baseId}-popup`,
|
|
299
|
+
triggerId: surfaceId,
|
|
300
|
+
open,
|
|
301
|
+
onOpenChange: (next) => {
|
|
302
|
+
if (!next)
|
|
303
|
+
close();
|
|
304
|
+
},
|
|
305
|
+
matchTriggerWidth: true,
|
|
306
|
+
placement: suggestionPlacement,
|
|
307
|
+
trigger: () => null,
|
|
308
|
+
children: [
|
|
309
|
+
h("div", { id: listId, role: "listbox", "aria-label": derived(() => match.value?.trigger.label ?? "Suggestions"), ref: parts.suggestionList }, keyed(items, (item) => item.id, (item) => (h("div", { id: optionId(item.value.id), role: "option", "aria-selected": derived(() => String(activeId.value === item.value.id)), "aria-disabled": derived(() => (item.value.disabled ? "true" : undefined)),
|
|
310
|
+
// Keep focus in the textarea; a pointer choice does not blur it.
|
|
311
|
+
onMouseDown: (event) => event.preventDefault(), onClick: () => accept(item.value), ref: parts.suggestion },
|
|
312
|
+
derived(() => item.value.leading !== undefined && item.value.leading !== null ? (h("span", { ref: parts.suggestionLeading }, item.value.leading)) : null),
|
|
313
|
+
h("span", { ref: parts.suggestionCopy },
|
|
314
|
+
h("span", { ref: parts.suggestionLabel }, derived(() => item.value.label)),
|
|
315
|
+
h("span", { hidden: derived(() => !item.value.description), ref: parts.suggestionDescription }, derived(() => item.value.description ?? ""))),
|
|
316
|
+
h("span", { hidden: derived(() => !item.value.meta), ref: parts.suggestionMeta }, derived(() => item.value.meta ?? "")))))),
|
|
317
|
+
h("p", { hidden: derived(() => !loading.value && !showEmpty.value), ref: parts.suggestionStatus }, derived(() => (loading.value ? loadingMessage : (emptyMessage.value ?? "")))),
|
|
318
|
+
],
|
|
319
|
+
}),
|
|
320
|
+
h("span", { role: "status", "aria-live": "polite", ref: parts.announcement }, announcement))) : null,
|
|
51
321
|
hint ? (h("span", { id: hintId, ref: parts.hint }, hint)) : null));
|
|
52
322
|
}
|
|
53
323
|
ChatComposer.meta = {
|
|
@@ -62,6 +332,16 @@ ChatComposer.meta = {
|
|
|
62
332
|
"actions",
|
|
63
333
|
"trailing",
|
|
64
334
|
"submit",
|
|
335
|
+
"suggestions",
|
|
336
|
+
"suggestionList",
|
|
337
|
+
"suggestion",
|
|
338
|
+
"suggestionLeading",
|
|
339
|
+
"suggestionCopy",
|
|
340
|
+
"suggestionLabel",
|
|
341
|
+
"suggestionDescription",
|
|
342
|
+
"suggestionMeta",
|
|
343
|
+
"suggestionStatus",
|
|
344
|
+
"announcement",
|
|
65
345
|
],
|
|
66
346
|
style: defineStyleProps(chatComposerOptions, {
|
|
67
347
|
defaults: { layout: "stacked", surface: "default" },
|
package/dist/src/chat/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ChatAttachments, type ChatAttachmentItem, type ChatAttachmentsProps } from "./attachments.js";
|
|
2
2
|
export { ChatComposer, type ChatComposerProps, type ChatComposerInput, type ChatComposerSubmit, } from "./composer.js";
|
|
3
|
+
export { findComposerTrigger, insertComposerSuggestion, composerQueryLimit, type ComposerSuggestion, type ComposerSuggestContext, type ComposerTrigger, type ComposerTriggerMatch, } from "./composer-triggers.js";
|
|
3
4
|
export { chatComposerOptions } from "./composer.options.js";
|
|
4
5
|
export { ComposerPanel, type ComposerPanelProps } from "./composer-panel.js";
|
|
5
6
|
export { ChatFrame, type ChatFrameProps } from "./frame.js";
|
package/dist/src/chat/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ChatAttachments } from "./attachments.js";
|
|
2
2
|
export { ChatComposer, } from "./composer.js";
|
|
3
|
+
export { findComposerTrigger, insertComposerSuggestion, composerQueryLimit, } from "./composer-triggers.js";
|
|
3
4
|
export { chatComposerOptions } from "./composer.options.js";
|
|
4
5
|
export { ComposerPanel } from "./composer-panel.js";
|
|
5
6
|
export { ChatFrame } from "./frame.js";
|
|
@@ -4,9 +4,11 @@ import { buttonOptions } from "./button.options.js";
|
|
|
4
4
|
export { buttonOptions } from "./button.options.js";
|
|
5
5
|
export interface ButtonProps extends Props, ThemedProps<typeof buttonOptions> {
|
|
6
6
|
className?: Props["className"];
|
|
7
|
+
/** Use a native link for navigation while keeping the shared action appearance. */
|
|
8
|
+
href?: string;
|
|
7
9
|
}
|
|
8
10
|
/** Triggers one action, in one of six levels and three sizes. */
|
|
9
|
-
export declare function Button({ children, className, ref, ...props }: ButtonProps, context: Context<typeof Button>): import("meowjsx").VNode;
|
|
11
|
+
export declare function Button({ children, className, href, ref, ...props }: ButtonProps, context: Context<typeof Button>): import("meowjsx").VNode;
|
|
10
12
|
export declare namespace Button {
|
|
11
13
|
var meta: {
|
|
12
14
|
readonly name: "button";
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { h } from "meowjsx";
|
|
2
|
+
import { isSignal, mapSignal, unwrap } from "meowjsx/signal";
|
|
2
3
|
import { defineStyleProps } from "meowcss/meowjsx";
|
|
3
4
|
import { buttonOptions } from "./button.options.js";
|
|
4
5
|
export { buttonOptions } from "./button.options.js";
|
|
5
6
|
/** Triggers one action, in one of six levels and three sizes. */
|
|
6
|
-
export function Button({ children, className, ref, ...props }, context) {
|
|
7
|
+
export function Button({ children, className, href, ref, ...props }, context) {
|
|
8
|
+
if (href !== undefined) {
|
|
9
|
+
const { type: _type, disabled, tabIndex, onClick, ...link } = props;
|
|
10
|
+
const whenDisabled = (read) => isSignal(disabled)
|
|
11
|
+
? mapSignal(disabled, (value) => read(Boolean(value)))
|
|
12
|
+
: read(Boolean(disabled));
|
|
13
|
+
return (h("a", { ...link, href: whenDisabled((disabled) => (disabled ? undefined : href)), role: whenDisabled((disabled) => (disabled ? "link" : undefined)), "aria-disabled": whenDisabled((disabled) => (disabled ? "true" : undefined)), tabIndex: whenDisabled((disabled) => (disabled ? -1 : tabIndex)), className: className, ref: [context.parts.root, ref], onClick: (event) => {
|
|
14
|
+
if (unwrap(disabled)) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
}
|
|
18
|
+
else if (typeof onClick === "function")
|
|
19
|
+
onClick(event);
|
|
20
|
+
} }, children));
|
|
21
|
+
}
|
|
7
22
|
return (h("button", { ...props, type: props.type ?? "button", className: className, ref: [context.parts.root, ref] }, children));
|
|
8
23
|
}
|
|
9
24
|
Button.meta = {
|
|
@@ -3,6 +3,8 @@ import { type MaybeSignal } from "meowjsx/signal";
|
|
|
3
3
|
export interface ChoiceOption {
|
|
4
4
|
value: string;
|
|
5
5
|
label: string;
|
|
6
|
+
/** One supporting line under the label in the list, such as a model's context size. */
|
|
7
|
+
description?: string;
|
|
6
8
|
disabled?: boolean;
|
|
7
9
|
group?: string;
|
|
8
10
|
}
|
|
@@ -15,7 +17,8 @@ export interface ChoiceSelectProps extends Props {
|
|
|
15
17
|
onValueChange?: (value: string) => void;
|
|
16
18
|
name?: string;
|
|
17
19
|
id?: string;
|
|
18
|
-
|
|
20
|
+
/** A Signal stays live, so a choice can follow a pending submit. */
|
|
21
|
+
disabled?: MaybeSignal<boolean>;
|
|
19
22
|
required?: boolean;
|
|
20
23
|
placeholder?: string;
|
|
21
24
|
searchable?: boolean;
|
|
@@ -31,6 +34,6 @@ export declare function ChoiceSelect({ options, hidden, value, defaultValue, onV
|
|
|
31
34
|
export declare namespace ChoiceSelect {
|
|
32
35
|
var meta: {
|
|
33
36
|
readonly name: "choice-select";
|
|
34
|
-
readonly parts: readonly ["root", "trigger", "value", "indicator", "list", "group", "option", "native", "validation", "search", "empty"];
|
|
37
|
+
readonly parts: readonly ["root", "trigger", "value", "indicator", "list", "group", "option", "optionLabel", "description", "native", "validation", "search", "empty"];
|
|
35
38
|
};
|
|
36
39
|
}
|
|
@@ -51,7 +51,7 @@ export function ChoiceSelect({ options, hidden, value, defaultValue = "", onValu
|
|
|
51
51
|
};
|
|
52
52
|
const choose = (index) => {
|
|
53
53
|
const option = readOptions()[index];
|
|
54
|
-
if (disabled || !option || option.disabled)
|
|
54
|
+
if (unwrap(disabled) || !option || option.disabled)
|
|
55
55
|
return;
|
|
56
56
|
if (value === undefined)
|
|
57
57
|
local.value = option.value;
|
|
@@ -78,7 +78,7 @@ export function ChoiceSelect({ options, hidden, value, defaultValue = "", onValu
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
const keydown = (event) => {
|
|
81
|
-
if (disabled || event.isComposing)
|
|
81
|
+
if (unwrap(disabled) || event.isComposing)
|
|
82
82
|
return;
|
|
83
83
|
const enabled = enabledOptions();
|
|
84
84
|
const inSearch = event.target === searchElement;
|
|
@@ -274,7 +274,9 @@ export function ChoiceSelect({ options, hidden, value, defaultValue = "", onValu
|
|
|
274
274
|
return (h("button", { type: "button", role: "option", tabIndex: -1, disabled: derived(() => row.value.kind === "option" && Boolean(row.value.option.disabled)), hidden: derived(() => row.value.kind === "option" ? !matches(row.value.option) : true), "aria-disabled": derived(() => row.value.kind === "option" && row.value.option.disabled ? "true" : undefined), "aria-selected": derived(() => String(row.value.kind === "option" && readValue() === row.value.option.value)), "data-choice-index": derived(() => row.value.kind === "option" ? row.value.index : -1), onClick: () => {
|
|
275
275
|
if (row.value.kind === "option")
|
|
276
276
|
choose(row.value.index);
|
|
277
|
-
}, ref: [context.parts.option] },
|
|
277
|
+
}, ref: [context.parts.option] },
|
|
278
|
+
h("span", { ref: [context.parts.optionLabel] }, derived(() => (row.value.kind === "option" ? row.value.option.label : ""))),
|
|
279
|
+
h("span", { hidden: derived(() => row.value.kind !== "option" || !row.value.option.description), ref: [context.parts.description] }, derived(() => row.value.kind === "option" ? (row.value.option.description ?? "") : ""))));
|
|
278
280
|
})),
|
|
279
281
|
searchable ? (h("p", { hidden: hasResults, role: "status", ref: [context.parts.empty] }, emptyMessage)) : null,
|
|
280
282
|
],
|
|
@@ -306,6 +308,8 @@ ChoiceSelect.meta = {
|
|
|
306
308
|
"list",
|
|
307
309
|
"group",
|
|
308
310
|
"option",
|
|
311
|
+
"optionLabel",
|
|
312
|
+
"description",
|
|
309
313
|
"native",
|
|
310
314
|
"validation",
|
|
311
315
|
"search",
|
|
@@ -41,6 +41,7 @@ export { Accordion, type AccordionProps, type AccordionItem, type AccordionType,
|
|
|
41
41
|
export { Table, type TableProps, type TableColumn, type TableRow, type TableSort, type TableSortDirection, } from "./table.js";
|
|
42
42
|
export { NavItem, type NavItemProps } from "./nav-item.js";
|
|
43
43
|
export { Separator, type SeparatorProps } from "./separator.js";
|
|
44
|
+
export { Stat, type StatProps } from "./stat.js";
|
|
44
45
|
export { Textarea, type TextareaProps } from "./textarea.js";
|
|
45
46
|
export { Stack, type StackProps } from "./stack.js";
|
|
46
47
|
export { PageFrame, type PageFrameProps, pageFrameOptions } from "./page-frame.js";
|
|
@@ -41,6 +41,7 @@ export { Accordion, } from "./accordion.js";
|
|
|
41
41
|
export { Table, } from "./table.js";
|
|
42
42
|
export { NavItem } from "./nav-item.js";
|
|
43
43
|
export { Separator } from "./separator.js";
|
|
44
|
+
export { Stat } from "./stat.js";
|
|
44
45
|
export { Textarea } from "./textarea.js";
|
|
45
46
|
export { Stack } from "./stack.js";
|
|
46
47
|
export { PageFrame, pageFrameOptions } from "./page-frame.js";
|
|
@@ -4,6 +4,11 @@ import { itemOptions } from "./item.options.js";
|
|
|
4
4
|
export { itemOptions } from "./item.options.js";
|
|
5
5
|
export interface ItemProps extends Props, ThemedProps<typeof itemOptions> {
|
|
6
6
|
as?: "div" | "button";
|
|
7
|
+
/**
|
|
8
|
+
* Makes the whole item a link to this destination, overriding `as`. A selected link item is the
|
|
9
|
+
* current destination and carries `aria-current="page"`; routing stays with the host.
|
|
10
|
+
*/
|
|
11
|
+
href?: string;
|
|
7
12
|
title: Child;
|
|
8
13
|
description?: Child;
|
|
9
14
|
leading?: Child;
|
|
@@ -12,8 +17,8 @@ export interface ItemProps extends Props, ThemedProps<typeof itemOptions> {
|
|
|
12
17
|
selected?: boolean;
|
|
13
18
|
className?: Props["className"];
|
|
14
19
|
}
|
|
15
|
-
/** A single readable destination. Button content must not contain nested controls. */
|
|
16
|
-
export declare function Item({ as, title, description, leading, trailing, meta, selected, className, children, ...props }: ItemProps, context: Context<typeof Item>): import("meowjsx").VNode;
|
|
20
|
+
/** A single readable destination. Button and link content must not contain nested controls. */
|
|
21
|
+
export declare function Item({ as, href, title, description, leading, trailing, meta, selected, className, children, ...props }: ItemProps, context: Context<typeof Item>): import("meowjsx").VNode;
|
|
17
22
|
export declare namespace Item {
|
|
18
23
|
var meta: {
|
|
19
24
|
readonly name: "item";
|
|
@@ -2,10 +2,10 @@ import { defineStyleProps } from "meowcss/meowjsx";
|
|
|
2
2
|
import { h } from "meowjsx";
|
|
3
3
|
import { itemOptions } from "./item.options.js";
|
|
4
4
|
export { itemOptions } from "./item.options.js";
|
|
5
|
-
/** A single readable destination. Button content must not contain nested controls. */
|
|
6
|
-
export function Item({ as = "div", title, description, leading, trailing, meta, selected, className, children, ...props }, context) {
|
|
7
|
-
const Tag = as;
|
|
8
|
-
return (h(Tag, { type:
|
|
5
|
+
/** A single readable destination. Button and link content must not contain nested controls. */
|
|
6
|
+
export function Item({ as = "div", href, title, description, leading, trailing, meta, selected, className, children, ...props }, context) {
|
|
7
|
+
const Tag = href !== undefined ? "a" : as;
|
|
8
|
+
return (h(Tag, { type: Tag === "button" ? "button" : undefined, href: href, "aria-current": href !== undefined && selected ? "page" : undefined, ...props, className: className, "data-selected": selected ? "true" : undefined, ref: [context.parts.root, props.ref] },
|
|
9
9
|
leading != null ? h("span", { ref: [context.parts.leading] }, leading) : null,
|
|
10
10
|
h("span", { ref: [context.parts.content] },
|
|
11
11
|
meta != null ? h("span", { ref: [context.parts.meta] }, meta) : null,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Child, type Context, type Props } from "meowjsx";
|
|
2
|
+
export interface StatProps extends Props {
|
|
3
|
+
/** What the figure counts, in sentence case: "Active runs". */
|
|
4
|
+
label: Child;
|
|
5
|
+
/** The figure itself. Pass "unknown" (or the host's word for it) when the value cannot be read. */
|
|
6
|
+
value: Child;
|
|
7
|
+
/** One supporting fact under the figure, such as its scope or when it was read. */
|
|
8
|
+
detail?: Child;
|
|
9
|
+
/** Makes the whole summary a link to the records it counts; routing stays with the host. */
|
|
10
|
+
href?: string;
|
|
11
|
+
className?: Props["className"];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One summary figure: a short label, the figure, and an optional supporting fact. The figure is
|
|
15
|
+
* the largest text in the block and is never colored; a state belongs in a Status beside it.
|
|
16
|
+
* Hosts place several Stats in a Grid, a Card, or a toolbar strip.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Stat({ label, value, detail, href, className, children, ref, ...props }: StatProps, context: Context<typeof Stat>): import("meowjsx").VNode;
|
|
19
|
+
export declare namespace Stat {
|
|
20
|
+
var meta: {
|
|
21
|
+
readonly name: "stat";
|
|
22
|
+
readonly parts: readonly ["root", "label", "value", "detail"];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
/**
|
|
3
|
+
* One summary figure: a short label, the figure, and an optional supporting fact. The figure is
|
|
4
|
+
* the largest text in the block and is never colored; a state belongs in a Status beside it.
|
|
5
|
+
* Hosts place several Stats in a Grid, a Card, or a toolbar strip.
|
|
6
|
+
*/
|
|
7
|
+
export function Stat({ label, value, detail, href, className, children, ref, ...props }, context) {
|
|
8
|
+
const Tag = href !== undefined ? "a" : "div";
|
|
9
|
+
return (h(Tag, { ...props, href: href, className: className, ref: [context.parts.root, ref] },
|
|
10
|
+
h("span", { ref: context.parts.label }, label),
|
|
11
|
+
h("span", { ref: context.parts.value }, value),
|
|
12
|
+
detail !== undefined && detail !== null && detail !== false ? (h("span", { ref: context.parts.detail }, detail)) : null,
|
|
13
|
+
children));
|
|
14
|
+
}
|
|
15
|
+
Stat.meta = { name: "stat", parts: ["root", "label", "value", "detail"] };
|
|
@@ -97,6 +97,7 @@ export declare const MeowUIComponent: {
|
|
|
97
97
|
readonly Textarea: "textarea";
|
|
98
98
|
readonly Field: "field";
|
|
99
99
|
readonly Separator: "separator";
|
|
100
|
+
readonly Stat: "stat";
|
|
100
101
|
readonly Dialog: "dialog";
|
|
101
102
|
readonly DialogPanel: "dialog-panel";
|
|
102
103
|
readonly DialogHeader: "dialog-header";
|
|
@@ -146,7 +147,7 @@ export declare const MeowUIComponent: {
|
|
|
146
147
|
readonly Drawer: "drawer";
|
|
147
148
|
};
|
|
148
149
|
/** The full built-in catalog, separated from the selective plugin factory. */
|
|
149
|
-
export declare const meowUIComponents: readonly [typeof Components.PageFrame, typeof Components.AppBar, typeof RegionLayoutShell, typeof Components.Pill, typeof Components.ImagePreview, typeof Components.SegmentedControl, typeof Components.TextShimmer, typeof Components.RiskConfirmation, typeof Components.WebBlock, typeof Components.JsonTree, typeof Components.JsonBlock, typeof Components.ImageLightbox, typeof Components.ShortcutKeys, typeof Components.PathLabel, typeof Components.StateDot, typeof Components.HoverCard, typeof Components.Menu, typeof Components.ContextMenu, typeof Components.Toast, typeof OutputBlock, typeof Components.TerminalBlock, typeof Components.ReadBlock, typeof Components.DiffBlock, typeof Components.SearchBlock, typeof Components.Checkbox, typeof Components.Switch, typeof Components.Slider, typeof Components.Progress, typeof Components.Avatar, typeof Components.Link, typeof Components.Text, typeof Components.Prose, typeof Components.TaskList, typeof Components.Accordion, typeof Components.Table, typeof Components.NumberInput, typeof Components.CodeBlock, typeof Components.MermaidDiagram, typeof Components.ChoiceGroup, typeof Chat.ChatQuestion, typeof Components.Item, typeof Chat.ChatBubble, typeof Chat.ChatConversation, typeof Components.Tabs, typeof Components.Breadcrumb, typeof Components.Pagination, typeof Components.Markdown, typeof Components.Chart, typeof Components.Form, typeof Components.CommandPalette, typeof Components.TreeView, typeof Components.TokenField, typeof Components.Autocomplete, typeof Components.Alert, typeof Components.Skeleton, typeof Components.SkeletonBoundary, typeof Components.Spinner, typeof Components.Stack, typeof Components.LayoutItem, typeof Components.DescriptionList, typeof Components.DescriptionItem, typeof Components.Inline, typeof Components.Grid, typeof Components.Container, typeof Components.CardHeader, typeof Components.CardTitle, typeof Components.CardDescription, typeof Components.CardContent, typeof Components.CardFooter, typeof Components.CardAction, typeof Components.FieldGroup, typeof Components.AspectRatio, typeof Components.Tooltip, typeof Components.Button, typeof Components.IconButton, typeof Components.Toolbar, typeof Components.ActionRail, typeof Components.ActionRow, typeof Components.MetaRow, typeof Components.EmptyState, typeof Components.Card, typeof Components.Badge, typeof Components.Input, typeof Components.Select, typeof Components.ChoiceSelect, typeof Components.Popover, typeof Components.SearchInput, typeof Components.PathPicker, typeof Components.Disclosure, typeof Components.Textarea, typeof Components.Field, typeof Components.Separator, typeof Components.Dialog, typeof Components.DialogPanel, typeof Components.DialogHeader, typeof Components.DialogActions, typeof Components.NavItem, typeof Chat.ChatFrame, typeof Chat.AssistantView, typeof AssistantSteps, typeof AssistantMarkdown, typeof AssistantComposer, typeof AssistantQuestionView, typeof Chat.ChatAttachments, typeof Chat.ChatProcess, typeof Chat.ChatReasoning, typeof Chat.ChatSources, typeof Chat.ChatHeader, typeof Chat.ChatStatus, typeof Chat.ChatMessageList, typeof Chat.ChatMessage, typeof Chat.ChatMessageActions, typeof Chat.ChatComposer, typeof Chat.ComposerPanel, typeof Chat.ChatToolCall, typeof Chat.ChatTask, typeof Components.StatusDot, typeof Components.Status, typeof Components.Tag, typeof Components.ProcessGroup, typeof Components.ProcessStep, typeof Components.WorkCard, typeof Components.IconRail, typeof Components.RailItem, typeof Components.RailSection, typeof Components.DetailSection, typeof Components.Timeline, typeof Components.TimelineItem, typeof Components.EntryList, typeof Components.Entry, typeof Components.ResourceLink, typeof Components.Page, typeof Components.PageHeader, typeof Components.Section, typeof Components.NavList, typeof Components.Modal, typeof Components.WindowTitleBar, typeof Components.ListGroup, typeof Components.ListRow, typeof Components.ResourceCard, typeof Components.Drawer];
|
|
150
|
+
export declare const meowUIComponents: readonly [typeof Components.PageFrame, typeof Components.AppBar, typeof RegionLayoutShell, typeof Components.Pill, typeof Components.ImagePreview, typeof Components.SegmentedControl, typeof Components.TextShimmer, typeof Components.RiskConfirmation, typeof Components.WebBlock, typeof Components.JsonTree, typeof Components.JsonBlock, typeof Components.ImageLightbox, typeof Components.ShortcutKeys, typeof Components.PathLabel, typeof Components.StateDot, typeof Components.HoverCard, typeof Components.Menu, typeof Components.ContextMenu, typeof Components.Toast, typeof OutputBlock, typeof Components.TerminalBlock, typeof Components.ReadBlock, typeof Components.DiffBlock, typeof Components.SearchBlock, typeof Components.Checkbox, typeof Components.Switch, typeof Components.Slider, typeof Components.Progress, typeof Components.Avatar, typeof Components.Link, typeof Components.Text, typeof Components.Prose, typeof Components.TaskList, typeof Components.Accordion, typeof Components.Table, typeof Components.NumberInput, typeof Components.CodeBlock, typeof Components.MermaidDiagram, typeof Components.ChoiceGroup, typeof Chat.ChatQuestion, typeof Components.Item, typeof Chat.ChatBubble, typeof Chat.ChatConversation, typeof Components.Tabs, typeof Components.Breadcrumb, typeof Components.Pagination, typeof Components.Markdown, typeof Components.Chart, typeof Components.Form, typeof Components.CommandPalette, typeof Components.TreeView, typeof Components.TokenField, typeof Components.Autocomplete, typeof Components.Alert, typeof Components.Skeleton, typeof Components.SkeletonBoundary, typeof Components.Spinner, typeof Components.Stack, typeof Components.LayoutItem, typeof Components.DescriptionList, typeof Components.DescriptionItem, typeof Components.Inline, typeof Components.Grid, typeof Components.Container, typeof Components.CardHeader, typeof Components.CardTitle, typeof Components.CardDescription, typeof Components.CardContent, typeof Components.CardFooter, typeof Components.CardAction, typeof Components.FieldGroup, typeof Components.AspectRatio, typeof Components.Tooltip, typeof Components.Button, typeof Components.IconButton, typeof Components.Toolbar, typeof Components.ActionRail, typeof Components.ActionRow, typeof Components.MetaRow, typeof Components.EmptyState, typeof Components.Card, typeof Components.Badge, typeof Components.Input, typeof Components.Select, typeof Components.ChoiceSelect, typeof Components.Popover, typeof Components.SearchInput, typeof Components.PathPicker, typeof Components.Disclosure, typeof Components.Textarea, typeof Components.Field, typeof Components.Separator, typeof Components.Stat, typeof Components.Dialog, typeof Components.DialogPanel, typeof Components.DialogHeader, typeof Components.DialogActions, typeof Components.NavItem, typeof Chat.ChatFrame, typeof Chat.AssistantView, typeof AssistantSteps, typeof AssistantMarkdown, typeof AssistantComposer, typeof AssistantQuestionView, typeof Chat.ChatAttachments, typeof Chat.ChatProcess, typeof Chat.ChatReasoning, typeof Chat.ChatSources, typeof Chat.ChatHeader, typeof Chat.ChatStatus, typeof Chat.ChatMessageList, typeof Chat.ChatMessage, typeof Chat.ChatMessageActions, typeof Chat.ChatComposer, typeof Chat.ComposerPanel, typeof Chat.ChatToolCall, typeof Chat.ChatTask, typeof Components.StatusDot, typeof Components.Status, typeof Components.Tag, typeof Components.ProcessGroup, typeof Components.ProcessStep, typeof Components.WorkCard, typeof Components.IconRail, typeof Components.RailItem, typeof Components.RailSection, typeof Components.DetailSection, typeof Components.Timeline, typeof Components.TimelineItem, typeof Components.EntryList, typeof Components.Entry, typeof Components.ResourceLink, typeof Components.Page, typeof Components.PageHeader, typeof Components.Section, typeof Components.NavList, typeof Components.Modal, typeof Components.WindowTitleBar, typeof Components.ListGroup, typeof Components.ListRow, typeof Components.ResourceCard, typeof Components.Drawer];
|
|
150
151
|
type ComponentParts<C> = C extends {
|
|
151
152
|
readonly meta: {
|
|
152
153
|
readonly parts: readonly (infer Part extends string)[];
|
|
@@ -415,6 +416,9 @@ declare module "meowjsx" {
|
|
|
415
416
|
separator: {
|
|
416
417
|
parts: ComponentParts<typeof import("../components/separator.js").Separator>;
|
|
417
418
|
};
|
|
419
|
+
stat: {
|
|
420
|
+
parts: ComponentParts<typeof import("../components/stat.js").Stat>;
|
|
421
|
+
};
|
|
418
422
|
dialog: {
|
|
419
423
|
parts: ComponentParts<typeof import("../components/dialog.js").Dialog>;
|
|
420
424
|
};
|
|
@@ -97,6 +97,7 @@ export const MeowUIComponent = {
|
|
|
97
97
|
Textarea: "textarea",
|
|
98
98
|
Field: "field",
|
|
99
99
|
Separator: "separator",
|
|
100
|
+
Stat: "stat",
|
|
100
101
|
Dialog: "dialog",
|
|
101
102
|
DialogPanel: "dialog-panel",
|
|
102
103
|
DialogHeader: "dialog-header",
|
|
@@ -239,6 +240,7 @@ export const meowUIComponents = [
|
|
|
239
240
|
Components.Textarea,
|
|
240
241
|
Components.Field,
|
|
241
242
|
Components.Separator,
|
|
243
|
+
Components.Stat,
|
|
242
244
|
Components.Dialog,
|
|
243
245
|
Components.DialogPanel,
|
|
244
246
|
Components.DialogHeader,
|
|
@@ -32,6 +32,8 @@ export const foundationStyles = css `
|
|
|
32
32
|
dark one. Only the theme plugin marks a page; an embedded region keeps its host's ground. */
|
|
33
33
|
:where(html[${pageAttribute}][data-meowui-scope]) {
|
|
34
34
|
background-color: ${uiTokens.surface.canvas};
|
|
35
|
+
background-image: ${uiTokens.canvas.wash};
|
|
36
|
+
background-attachment: fixed;
|
|
35
37
|
color-scheme: light;
|
|
36
38
|
}
|
|
37
39
|
:where(html[${pageAttribute}][data-meowui-color-scheme="dark"]) {
|
|
@@ -48,6 +50,9 @@ export const foundationStyles = css `
|
|
|
48
50
|
) {
|
|
49
51
|
box-sizing: border-box;
|
|
50
52
|
}
|
|
53
|
+
:where([data-meowui-theme-root="meowui"]) ::selection {
|
|
54
|
+
background-color: ${uiTokens.canvas.selection};
|
|
55
|
+
}
|
|
51
56
|
:where([data-meowui-theme-root="meowui"] :is(img, video)) {
|
|
52
57
|
max-width: 100%;
|
|
53
58
|
}
|