meowtail 0.3.0-alpha.0 → 0.4.0-alpha.0
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 +2 -1
- package/ASSISTANT.md +2 -1
- package/JSON.md +1 -1
- package/README.md +6 -5
- package/dist/src/chat/assistant-composer.js +8 -7
- package/dist/src/chat/assistant-content.d.ts +2 -1
- package/dist/src/chat/assistant-content.js +3 -2
- package/dist/src/chat/assistant-markdown.d.ts +2 -1
- package/dist/src/chat/assistant-markdown.js +2 -1
- package/dist/src/chat/assistant-question.d.ts +2 -1
- package/dist/src/chat/assistant-question.js +5 -4
- package/dist/src/chat/assistant-types.d.ts +2 -1
- package/dist/src/chat/assistant.js +6 -5
- package/dist/src/chat/attachments.d.ts +2 -1
- package/dist/src/chat/attachments.js +2 -1
- package/dist/src/chat/composer.d.ts +2 -1
- package/dist/src/chat/composer.js +2 -1
- package/dist/src/chat/conversation.js +2 -1
- package/dist/src/chat/reasoning.d.ts +2 -1
- package/dist/src/chat/reasoning.js +2 -1
- package/dist/src/chat/task.d.ts +2 -1
- package/dist/src/chat/task.js +2 -1
- package/dist/src/chat/tool-call.d.ts +2 -1
- package/dist/src/chat/tool-call.js +2 -1
- package/dist/src/components/accordion.d.ts +2 -1
- package/dist/src/components/accordion.js +3 -2
- package/dist/src/components/avatar.js +2 -1
- package/dist/src/components/checkbox.d.ts +2 -1
- package/dist/src/components/checkbox.js +2 -1
- package/dist/src/components/choice-group.d.ts +2 -1
- package/dist/src/components/choice-group.js +3 -2
- package/dist/src/components/choice-select.d.ts +2 -1
- package/dist/src/components/choice-select.js +7 -6
- package/dist/src/components/code-block.d.ts +2 -1
- package/dist/src/components/code-block.js +6 -5
- package/dist/src/components/context-menu.d.ts +2 -1
- package/dist/src/components/context-menu.js +3 -2
- package/dist/src/components/disclosure.d.ts +2 -1
- package/dist/src/components/drawer.d.ts +2 -1
- package/dist/src/components/drawer.js +2 -1
- package/dist/src/components/field.d.ts +2 -1
- package/dist/src/components/field.js +2 -1
- package/dist/src/components/hover-card.js +3 -2
- package/dist/src/components/icon-button.d.ts +2 -1
- package/dist/src/components/icon-rail.d.ts +2 -1
- package/dist/src/components/icon-rail.js +2 -1
- package/dist/src/components/image-preview.js +3 -2
- package/dist/src/components/json-block.js +2 -1
- package/dist/src/components/json-tree.js +3 -2
- package/dist/src/components/menu-button.d.ts +2 -1
- package/dist/src/components/menu.d.ts +2 -1
- package/dist/src/components/menu.js +4 -3
- package/dist/src/components/mermaid-diagram.d.ts +2 -1
- package/dist/src/components/mermaid-diagram.js +6 -5
- package/dist/src/components/meta-row.d.ts +2 -1
- package/dist/src/components/meta-row.js +2 -1
- package/dist/src/components/modal.d.ts +2 -1
- package/dist/src/components/modal.js +2 -1
- package/dist/src/components/nav-item.d.ts +2 -1
- package/dist/src/components/nav-item.js +2 -1
- package/dist/src/components/nav-list.d.ts +2 -1
- package/dist/src/components/nav-list.js +2 -1
- package/dist/src/components/number-input.d.ts +2 -1
- package/dist/src/components/number-input.js +5 -4
- package/dist/src/components/output-block.d.ts +2 -1
- package/dist/src/components/output-block.js +4 -3
- package/dist/src/components/path-picker.d.ts +2 -1
- package/dist/src/components/path-picker.js +4 -3
- package/dist/src/components/pill.d.ts +2 -1
- package/dist/src/components/pill.js +2 -1
- package/dist/src/components/popover.d.ts +2 -1
- package/dist/src/components/popover.js +3 -2
- package/dist/src/components/progress.d.ts +2 -1
- package/dist/src/components/read-block.js +2 -1
- package/dist/src/components/risk-confirmation.d.ts +2 -1
- package/dist/src/components/risk-confirmation.js +2 -1
- package/dist/src/components/search-input.d.ts +2 -1
- package/dist/src/components/segmented-control.d.ts +2 -1
- package/dist/src/components/segmented-control.js +2 -1
- package/dist/src/components/select.d.ts +2 -1
- package/dist/src/components/skeleton-boundary.d.ts +2 -1
- package/dist/src/components/skeleton-boundary.js +3 -2
- package/dist/src/components/slider.d.ts +2 -1
- package/dist/src/components/slider.js +3 -2
- package/dist/src/components/table.d.ts +2 -1
- package/dist/src/components/table.js +5 -4
- package/dist/src/components/tabs.d.ts +2 -1
- package/dist/src/components/tabs.js +4 -3
- package/dist/src/components/task-list.d.ts +2 -1
- package/dist/src/components/task-list.js +2 -1
- package/dist/src/components/text-shimmer.d.ts +2 -1
- package/dist/src/components/text-shimmer.js +2 -1
- package/dist/src/components/tooltip.js +2 -1
- package/dist/src/components/work-card.d.ts +2 -1
- package/package.json +6 -6
package/AGENT-COMPONENTS.md
CHANGED
|
@@ -32,7 +32,8 @@ This round fills two high-frequency joints: extending the existing `ChatToolCall
|
|
|
32
32
|
## Tool calls: separate data from execution actions
|
|
33
33
|
|
|
34
34
|
```tsx
|
|
35
|
-
import { h
|
|
35
|
+
import { h } from "meowjsx";
|
|
36
|
+
import { signal } from "meowjsx/signal";
|
|
36
37
|
import { ChatToolCall, type ChatExecutionState } from "meowtail/chat";
|
|
37
38
|
|
|
38
39
|
const state = signal<ChatExecutionState>("queued");
|
package/ASSISTANT.md
CHANGED
|
@@ -5,7 +5,8 @@ Status: the new composition is implemented, and the author's local behavior regr
|
|
|
5
5
|
`AssistantView` from `meowtail/chat` provides messages, safe Markdown, code, processes, inputs, attachments, model and thinking options, current activity, background work details, and unanswered questions. The default structure and visuals live in the library; the `assistant-complete` scene in Meowbook only supplies local data and actions.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
|
-
import { h
|
|
8
|
+
import { h } from "meowjsx";
|
|
9
|
+
import { signal } from "meowjsx/signal";
|
|
9
10
|
import { AssistantView, type AssistantDraft, type AssistantMessage } from "meowtail/chat";
|
|
10
11
|
|
|
11
12
|
const messages = signal<readonly AssistantMessage[]>([]);
|
package/JSON.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
import { createJsonView, parseJsonView } from "meowjsx/json";
|
|
7
|
-
import { signal, type ReadableSignal } from "meowjsx";
|
|
7
|
+
import { signal, type ReadableSignal } from "meowjsx/signal";
|
|
8
8
|
import type { AssistantDraft, AssistantMessage } from "meowtail/chat";
|
|
9
9
|
import { createMeowUICatalog } from "meowtail/json";
|
|
10
10
|
|
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ Application authors writing their own components (the shadcn/ui and Tailwind equ
|
|
|
16
16
|
|
|
17
17
|
## Runtime compatibility
|
|
18
18
|
|
|
19
|
-
The local `0.
|
|
20
|
-
`meowcss@^0.
|
|
19
|
+
The local `0.4.0-alpha.0` candidate requires `meowjsx@^0.3.0-alpha.0` and
|
|
20
|
+
`meowcss@^0.3.0-alpha.0`. It uses ordinary components with static `meta`, composed part/ref bindings
|
|
21
21
|
and the class-value theme API. Earlier package generations do not implement that authoring contract.
|
|
22
|
-
|
|
22
|
+
The published releases remain listed in the root README.
|
|
23
23
|
|
|
24
24
|
## Minimal browser integration
|
|
25
25
|
|
|
@@ -691,12 +691,13 @@ Static visuals use CSS. Use a shadow only when real DOM, instance state, listene
|
|
|
691
691
|
|
|
692
692
|
```ts
|
|
693
693
|
// Web shadow: context.element is a real Element.
|
|
694
|
+
import { signal } from "meowjsx/signal";
|
|
694
695
|
import { defineShadow } from "meowjsx/web";
|
|
695
696
|
|
|
696
697
|
runtime.use({
|
|
697
698
|
shadows: [
|
|
698
699
|
defineShadow(Button, "root", (props, context) => {
|
|
699
|
-
const active =
|
|
700
|
+
const active = signal(false);
|
|
700
701
|
context.effect(() => {
|
|
701
702
|
context.element.classList.toggle("is-active", active.value);
|
|
702
703
|
});
|
|
@@ -717,7 +718,7 @@ runtime.use({
|
|
|
717
718
|
});
|
|
718
719
|
```
|
|
719
720
|
|
|
720
|
-
Register centrally; do not generate wrapper components.
|
|
721
|
+
Register centrally; do not generate wrapper components. Shadows and components import `signal` from `meowjsx/signal` and share the `effect`/`onCleanup` lifecycle API.
|
|
721
722
|
Plugin uninstall blocks later application; instance cleanup for existing elements is handled by the unmount of their mount. Do not use
|
|
722
723
|
renderToHtml + innerHTML instead of browser mounting that needs a lifecycle.
|
|
723
724
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, isSignal, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
// Fragment is required by the classic JSX transform for conditional attachment controls.
|
|
3
4
|
// eslint-disable-next-line no-unused-vars
|
|
4
5
|
import { Fragment } from "meowjsx";
|
|
@@ -14,12 +15,12 @@ export function AssistantComposer({ options, trailing }, context) {
|
|
|
14
15
|
const controlled = options.draft !== undefined;
|
|
15
16
|
if (controlled && !options.onDraftChange && !options.readOnly)
|
|
16
17
|
throw new Error("A controlled Assistant draft requires onDraftChange or readOnly");
|
|
17
|
-
const local =
|
|
18
|
+
const local = signal(options.defaultDraft ?? { text: "", attachments: [] });
|
|
18
19
|
const draft = derived(() => (controlled ? unwrap(options.draft) : local.value));
|
|
19
20
|
const text = derived(() => draft.value.text);
|
|
20
|
-
const pending =
|
|
21
|
-
const attaching =
|
|
22
|
-
const feedback =
|
|
21
|
+
const pending = signal(false);
|
|
22
|
+
const attaching = signal(false);
|
|
23
|
+
const feedback = signal("");
|
|
23
24
|
const disabled = derived(() => options.readOnly || unwrap(options.disabled ?? false));
|
|
24
25
|
const submitDisabled = derived(() => disabled.value ||
|
|
25
26
|
pending.value ||
|
|
@@ -110,8 +111,8 @@ export function AssistantComposer({ options, trailing }, context) {
|
|
|
110
111
|
for (const url of urls)
|
|
111
112
|
URL.revokeObjectURL(url);
|
|
112
113
|
});
|
|
113
|
-
const localModel =
|
|
114
|
-
const localReasoning =
|
|
114
|
+
const localModel = signal(unwrap(options.models ?? [])[0]?.value ?? "");
|
|
115
|
+
const localReasoning = signal(unwrap(options.reasoningOptions ?? [])[0]?.value ?? "");
|
|
115
116
|
const modelsLive = options.models !== undefined && (isSignal(options.models) || options.models.length > 0);
|
|
116
117
|
const reasoningLive = options.reasoningOptions !== undefined &&
|
|
117
118
|
(isSignal(options.reasoningOptions) || options.reasoningOptions.length > 0);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Context
|
|
1
|
+
import { type Context } from "meowjsx";
|
|
2
|
+
import { type Signal } from "meowjsx/signal";
|
|
2
3
|
import type { AssistantLabels, AssistantMessage, AssistantMessagePart, AssistantProcessStep, AssistantViewProps } from "./assistant-types.js";
|
|
3
4
|
export declare function AssistantSteps({ steps }: {
|
|
4
5
|
steps: Signal<readonly AssistantProcessStep[]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, keyed } from "meowjsx";
|
|
2
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
// Fragment is required by the classic JSX transform for process status content.
|
|
3
4
|
// eslint-disable-next-line no-unused-vars
|
|
4
5
|
import { Fragment } from "meowjsx";
|
|
@@ -78,7 +79,7 @@ export function AssistantPartView({ value, message, renderPart, onToolAction, },
|
|
|
78
79
|
}
|
|
79
80
|
AssistantPartView.meta = { name: "assistant-part", parts: ["root"] };
|
|
80
81
|
function AssistantReplyActions({ value, labels, onMessageAction, }, context) {
|
|
81
|
-
const copied =
|
|
82
|
+
const copied = signal(false);
|
|
82
83
|
let timer;
|
|
83
84
|
context.onCleanup(() => clearTimeout(timer));
|
|
84
85
|
const text = () => value.value.parts.flatMap((part) => (part.kind === "text" ? [part.text] : [])).join("\n\n");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Context, type Props
|
|
1
|
+
import { type Context, type Props } from "meowjsx";
|
|
2
|
+
import { type Signal } from "meowjsx/signal";
|
|
2
3
|
export declare function assistantSafeLink(href: string): string | undefined;
|
|
3
4
|
/** Raw HTML and images are text. Only explicit safe external links become navigation. */
|
|
4
5
|
export declare const assistantMarkdown: (text: string) => string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived } from "meowjsx/signal";
|
|
2
3
|
import { Marked, Renderer } from "marked";
|
|
3
4
|
const escape = (text) => text.replace(/[&<>"']/g, (value) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[value]);
|
|
4
5
|
export function assistantSafeLink(href) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Context
|
|
1
|
+
import { type Context } from "meowjsx";
|
|
2
|
+
import { type Signal } from "meowjsx/signal";
|
|
2
3
|
import { type AssistantLabels, type AssistantQuestion, type AssistantViewProps } from "./assistant-types.js";
|
|
3
4
|
export declare function AssistantQuestionView({ value, onAnswer, onDismiss, labels, }: {
|
|
4
5
|
value: Signal<AssistantQuestion>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, keyed } from "meowjsx";
|
|
2
|
+
import { derived, signal } from "meowjsx/signal";
|
|
2
3
|
// Fragment is required by the classic JSX transform for question actions.
|
|
3
4
|
// eslint-disable-next-line no-unused-vars
|
|
4
5
|
import { Fragment } from "meowjsx";
|
|
@@ -8,9 +9,9 @@ import { Select } from "../components/select.js";
|
|
|
8
9
|
import { assistantCopy as defaultAssistantCopy, } from "./assistant-types.js";
|
|
9
10
|
export function AssistantQuestionView({ value, onAnswer, onDismiss, labels, }, context) {
|
|
10
11
|
const assistantCopy = { ...defaultAssistantCopy, ...labels };
|
|
11
|
-
const answer =
|
|
12
|
-
const sending =
|
|
13
|
-
const error =
|
|
12
|
+
const answer = signal("");
|
|
13
|
+
const sending = signal(false);
|
|
14
|
+
const error = signal("");
|
|
14
15
|
const disabled = derived(() => sending.value || value.value.state !== "open" || !onAnswer);
|
|
15
16
|
let disposed = false;
|
|
16
17
|
context.onCleanup(() => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IconName } from "../icons/icon.js";
|
|
2
|
-
import type { Child,
|
|
2
|
+
import type { Child, Props } from "meowjsx";
|
|
3
|
+
import type { MaybeSignal } from "meowjsx/signal";
|
|
3
4
|
import type { ChatAttachmentItem } from "./attachments.js";
|
|
4
5
|
import type { ChatMessageRole, ChatMessageStatus } from "./message.js";
|
|
5
6
|
import type { StatusDotState } from "../components/status-dot.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, keyed } from "meowjsx";
|
|
2
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
// Fragment is required by the classic JSX transform for header actions.
|
|
3
4
|
// eslint-disable-next-line no-unused-vars
|
|
4
5
|
import { Fragment } from "meowjsx";
|
|
@@ -72,11 +73,11 @@ export function AssistantView(options, context) {
|
|
|
72
73
|
const work = derived(() => unwrap(options.work ?? []));
|
|
73
74
|
const questions = derived(() => unwrap(options.questions ?? []));
|
|
74
75
|
const activity = derived(() => unwrap(options.activity));
|
|
75
|
-
const panelOpen =
|
|
76
|
-
const selected =
|
|
76
|
+
const panelOpen = signal(false);
|
|
77
|
+
const selected = signal("");
|
|
77
78
|
const selectedWork = derived(() => work.value.find((item) => item.id === selected.value));
|
|
78
|
-
const latestHidden =
|
|
79
|
-
const historyOpen =
|
|
79
|
+
const latestHidden = signal(true);
|
|
80
|
+
const historyOpen = signal(false);
|
|
80
81
|
const asked = derived(() => messages.value.flatMap((message) => {
|
|
81
82
|
if (message.role !== "user")
|
|
82
83
|
return [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, keyed } from "meowjsx";
|
|
2
|
+
import { derived } from "meowjsx/signal";
|
|
2
3
|
import { Icon } from "../icons/icon.js";
|
|
3
4
|
import { FileTypeIcon, fileExtension } from "../icons/file-type-icon.js";
|
|
4
5
|
import { ImagePreview } from "../components/image-preview.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type Context, type
|
|
1
|
+
import { type Child, type Context, type Props } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export type ChatComposerSubmit = (event: SubmitEvent) => void;
|
|
3
4
|
export type ChatComposerInput = (event: Event) => void;
|
|
4
5
|
export interface ChatComposerProps extends Props {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineStyleProps } from "meowcss/meowjsx";
|
|
2
|
-
import {
|
|
2
|
+
import { h } from "meowjsx";
|
|
3
|
+
import { derived, unwrap } from "meowjsx/signal";
|
|
3
4
|
import { chatComposerOptions } from "./composer.options.js";
|
|
4
5
|
import { Icon } from "../icons/icon.js";
|
|
5
6
|
/** The message input of a conversation, with attachments, model choice and send. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from "meowjsx";
|
|
2
|
+
import { signal } from "meowjsx/signal";
|
|
2
3
|
import { createChatScroll } from "./conversation-scroll.js";
|
|
3
4
|
/**
|
|
4
5
|
* A normal-flow action for hosts that already own transcript scrolling.
|
|
@@ -14,7 +15,7 @@ export function ChatConversationLatest({ children, ref, ...props }, context) {
|
|
|
14
15
|
* Do not combine with an application-owned scroll controller. Children can use ChatMessageList.
|
|
15
16
|
*/
|
|
16
17
|
export function ChatConversation({ children, ariaLabel = "Conversation reading area", latestLabel = "Back to latest message", ref, ...props }, context) {
|
|
17
|
-
const hidden =
|
|
18
|
+
const hidden = signal(true);
|
|
18
19
|
let jump;
|
|
19
20
|
const mount = (root) => {
|
|
20
21
|
let disposed = false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Context, type
|
|
1
|
+
import { type Context, type Props } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export interface ChatReasoningProps extends Props {
|
|
3
4
|
/** What the model is doing now, for example "Drafting the rollout policy". */
|
|
4
5
|
label: MaybeSignal<string>;
|
package/dist/src/chat/task.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type Context, type
|
|
1
|
+
import { type Child, type Context, type Props } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
import { type ChatExecutionState } from "../shared/execution-state.js";
|
|
3
4
|
export interface ChatTaskProgress {
|
|
4
5
|
value: number;
|
package/dist/src/chat/task.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, unwrap } from "meowjsx/signal";
|
|
2
3
|
import { Progress } from "../components/progress.js";
|
|
3
4
|
import { StatusDot } from "../components/status-dot.js";
|
|
4
5
|
import { executionStateLabel, executionStateTone, } from "../shared/execution-state.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type Context, type
|
|
1
|
+
import { type Child, type Context, type Props } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
import { type ChatExecutionState } from "../shared/execution-state.js";
|
|
3
4
|
/** The complete spelling remains supported for existing tool consumers. */
|
|
4
5
|
export type ChatToolCallState = ChatExecutionState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, unwrap } from "meowjsx/signal";
|
|
2
3
|
// Fragment is required by the classic JSX transform for tool header content.
|
|
3
4
|
// eslint-disable-next-line no-unused-vars
|
|
4
5
|
import { Fragment } from "meowjsx";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
import { Disclosure } from "./disclosure.js";
|
|
3
4
|
function asList(value, type) {
|
|
4
5
|
if (value === undefined)
|
|
@@ -26,7 +27,7 @@ function nextValue(current, type, id, open) {
|
|
|
26
27
|
}
|
|
27
28
|
/** Grouped disclosures. Items are fixed for the mount. Expansion is handed to the caller when `value` is set. */
|
|
28
29
|
export function Accordion({ items, type = "single", value, defaultValue, onValueChange, label, className, ref, ...props }, context) {
|
|
29
|
-
const local =
|
|
30
|
+
const local = signal(defaultValue ?? (type === "single" ? "" : []));
|
|
30
31
|
const current = value !== undefined ? value : local;
|
|
31
32
|
const readValue = () => unwrap(current);
|
|
32
33
|
const opened = items.map((item) => derived(() => isOpen(readValue(), type, item.id)));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineStyleProps } from "meowcss/meowjsx";
|
|
2
2
|
import { h } from "meowjsx";
|
|
3
|
+
import { signal } from "meowjsx/signal";
|
|
3
4
|
import { avatarOptions } from "./avatar.options.js";
|
|
4
5
|
export { avatarOptions } from "./avatar.options.js";
|
|
5
6
|
export function initialsFromName(name) {
|
|
@@ -17,7 +18,7 @@ export function initialsFromName(name) {
|
|
|
17
18
|
}
|
|
18
19
|
/** A face or the initials that remain when the image is missing. */
|
|
19
20
|
export function Avatar({ name, src, alt, className, ...props }, context) {
|
|
20
|
-
const failed =
|
|
21
|
+
const failed = signal(false);
|
|
21
22
|
return (h("span", { ...props, className: className, role: "img", "aria-label": name, ref: [context.parts.root, props.ref] },
|
|
22
23
|
h("span", { "aria-hidden": "true", ref: [context.parts.initials] }, initialsFromName(name)),
|
|
23
24
|
src ? (h("img", { src: src, alt: alt ?? "", hidden: failed, referrerPolicy: "no-referrer", onError: () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Props, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
interface NativeToggleProps extends Props {
|
|
3
4
|
checked?: MaybeSignal<boolean>;
|
|
4
5
|
defaultChecked?: boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
let nextChoiceGroupId = 0;
|
|
3
4
|
/** Visible single choices with native radio keyboard, validation and form semantics. */
|
|
4
5
|
export function ChoiceGroup({ options, label, hideLabel = false, id = `choice-group-${++nextChoiceGroupId}`, name = id, form, value, defaultValue = "", onValueChange, disabled = false, required = false, className, ...props }, context) {
|
|
5
|
-
const local =
|
|
6
|
+
const local = signal(defaultValue);
|
|
6
7
|
const current = value !== undefined ? value : local;
|
|
7
8
|
const readValue = () => unwrap(current);
|
|
8
9
|
const inputs = new Map();
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h, keyed } from "meowjsx";
|
|
2
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
import { Popover } from "./popover.js";
|
|
3
4
|
import { Icon } from "../icons/icon.js";
|
|
4
5
|
import { elementByIdInRoot } from "../shared/dom-root.js";
|
|
5
6
|
let nextChoiceId = 0;
|
|
6
7
|
/** Single-choice listbox. Form participation remains native; data fetching belongs to callers. */
|
|
7
8
|
export function ChoiceSelect({ options, hidden, value, defaultValue = "", onValueChange, name, id = `choice-${++nextChoiceId}`, disabled = false, required = false, placeholder = "Select an option", searchable = false, searchPlaceholder = "Search options", emptyMessage = "No matching options", className, placement = "bottom", align = "start", matchTriggerWidth = true, ...props }, context) {
|
|
8
|
-
const local =
|
|
9
|
+
const local = signal(defaultValue);
|
|
9
10
|
const current = value !== undefined ? value : local;
|
|
10
11
|
const readValue = () => unwrap(current);
|
|
11
12
|
const readOptions = () => unwrap(options);
|
|
12
|
-
const open =
|
|
13
|
-
const invalid =
|
|
14
|
-
const validation =
|
|
15
|
-
const query =
|
|
13
|
+
const open = signal(false);
|
|
14
|
+
const invalid = signal(undefined);
|
|
15
|
+
const validation = signal("");
|
|
16
|
+
const query = signal("");
|
|
16
17
|
let searchElement = null;
|
|
17
18
|
let triggerElement = null;
|
|
18
19
|
let nativeElement = null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type
|
|
1
|
+
import { type Child, type Props, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export interface CodeBlockProps extends Props {
|
|
3
4
|
code: MaybeSignal<string>;
|
|
4
5
|
language?: MaybeSignal<string | undefined>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
import { Button } from "./button.js";
|
|
3
4
|
import { copyTextToClipboard } from "../clipboard.js";
|
|
4
5
|
// The highlighter stays in this module. Themes use type-only component imports,
|
|
@@ -11,10 +12,10 @@ function provided(value) {
|
|
|
11
12
|
/** A block of code with its language, an optional title, soft wrap and copy. */
|
|
12
13
|
export function CodeBlock({ code, language, title, caption, actions, defaultWrap = false, onCopy, ref, ...props }, context) {
|
|
13
14
|
// These are enumerated attributes, not native boolean attributes such as disabled.
|
|
14
|
-
const wrap =
|
|
15
|
-
const copying =
|
|
16
|
-
const feedback =
|
|
17
|
-
const highlighted =
|
|
15
|
+
const wrap = signal(defaultWrap ? "true" : "false");
|
|
16
|
+
const copying = signal(false);
|
|
17
|
+
const feedback = signal("");
|
|
18
|
+
const highlighted = signal(unwrap(code));
|
|
18
19
|
const languageLabel = derived(() => unwrap(language)?.trim() || "Code");
|
|
19
20
|
let disposed = false;
|
|
20
21
|
context.onCleanup(() => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type
|
|
1
|
+
import { type Child, type Props, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
import { type MenuEntry } from "./menu.js";
|
|
3
4
|
export interface ContextMenuProps extends Props {
|
|
4
5
|
id: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { h
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { signal, unwrap } from "meowjsx/signal";
|
|
2
3
|
import { Menu } from "./menu.js";
|
|
3
4
|
/** Right-click or Shift+F10 opens the existing Menu, including nested items. */
|
|
4
5
|
export function ContextMenu({ id, items, open, onOpenChange, className, children, ...props }, context) {
|
|
5
|
-
const local =
|
|
6
|
+
const local = signal(false);
|
|
6
7
|
const state = open !== undefined ? open : local;
|
|
7
8
|
let point = { x: 0, y: 0 };
|
|
8
9
|
const request = (next) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type
|
|
1
|
+
import { type Child, type Props, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export interface DisclosureProps extends Props {
|
|
3
4
|
summary: Child;
|
|
4
5
|
open?: MaybeSignal<boolean>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type
|
|
1
|
+
import { type Child, type Props, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export interface DrawerProps extends Props {
|
|
3
4
|
/** Accessible name of the drawer. */
|
|
4
5
|
label: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type
|
|
1
|
+
import { type Child, type Props, type VNode, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export interface FieldProps extends Props {
|
|
3
4
|
label: Child;
|
|
4
5
|
description?: Child;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { derived, isSignal, mapSignal, unwrap } from "meowjsx/signal";
|
|
2
3
|
/** A labelled form control with optional help text and an error message. */
|
|
3
4
|
export function Field({ label, description, error, htmlFor, descriptionId, errorId, invalid, children, className, ref, ...props }, context) {
|
|
4
5
|
const hasDescription = isSignal(description)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from "meowjsx";
|
|
2
|
+
import { signal } from "meowjsx/signal";
|
|
2
3
|
import { Popover } from "./popover.js";
|
|
3
4
|
import { copyTextToClipboard } from "../clipboard.js";
|
|
4
5
|
/**
|
|
@@ -6,7 +7,7 @@ import { copyTextToClipboard } from "../clipboard.js";
|
|
|
6
7
|
* Popover owns positioning, Escape, outside dismissal and focus.
|
|
7
8
|
*/
|
|
8
9
|
export function HoverCard({ id, trigger, content, openDelay = 500, disabled = false, className, variant = "compact", widthAnchor, copyText, copyLabel = "Copy", copiedLabel = "Copied", onCopy, }, context) {
|
|
9
|
-
const open =
|
|
10
|
+
const open = signal(false);
|
|
10
11
|
let timer;
|
|
11
12
|
let hovered = false;
|
|
12
13
|
let focused = false;
|
|
@@ -16,7 +17,7 @@ export function HoverCard({ id, trigger, content, openDelay = 500, disabled = fa
|
|
|
16
17
|
let copying = false;
|
|
17
18
|
let copySession = {};
|
|
18
19
|
let feedbackTimer;
|
|
19
|
-
const feedback =
|
|
20
|
+
const feedback = signal("");
|
|
20
21
|
const clear = () => {
|
|
21
22
|
if (timer !== undefined)
|
|
22
23
|
clearTimeout(timer);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ThemedProps } from "meowcss/meowjsx";
|
|
2
|
-
import { type
|
|
2
|
+
import { type Props, type Context } from "meowjsx";
|
|
3
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
3
4
|
import { iconButtonOptions } from "./icon-button.options.js";
|
|
4
5
|
export { iconButtonOptions } from "./icon-button.options.js";
|
|
5
6
|
export interface IconButtonProps extends Props, ThemedProps<typeof iconButtonOptions> {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Child, type
|
|
1
|
+
import { type Child, type Props, type Context } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
2
3
|
export interface IconRailProps extends Props {
|
|
3
4
|
/** Accessible name of the navigation. */
|
|
4
5
|
label: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { isSignal, mapSignal } from "meowjsx/signal";
|
|
2
3
|
/**
|
|
3
4
|
* A narrow icon column that expands into a labelled drawer over the page. The column keeps its
|
|
4
5
|
* width in the layout, so expanding never reflows the content beside it.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { h
|
|
1
|
+
import { h } from "meowjsx";
|
|
2
|
+
import { mapSignal, signal } from "meowjsx/signal";
|
|
2
3
|
import { Icon } from "../icons/icon.js";
|
|
3
4
|
/** Passive media display; navigation, preview activation and URL authorization belong to the host. */
|
|
4
5
|
export function ImagePreview({ src, alt, loading = "lazy", loadingLabel = "Loading image", failedLabel = "Failed to load image", onLoad, onError, ...props }, context) {
|
|
5
|
-
const state =
|
|
6
|
+
const state = signal("loading");
|
|
6
7
|
return (h("span", { ...props, "data-image-state": state, ref: [context.parts.root, props.ref] }, [
|
|
7
8
|
h("img", { src: src, alt: alt, loading: loading, decoding: "async", referrerPolicy: "no-referrer", hidden: mapSignal(state, (value) => value === "failed"), onLoad: (event) => {
|
|
8
9
|
state.value = "ready";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { h } from "meowjsx";
|
|
2
|
+
import { signal } from "meowjsx/signal";
|
|
2
3
|
import { CodeBlock } from "./code-block.js";
|
|
3
4
|
/**
|
|
4
5
|
* A collapsible block that shows a JSON value as a tree. Serialization and rendering wait for
|
|
5
6
|
* expansion. Invalid text remains verbatim.
|
|
6
7
|
*/
|
|
7
8
|
export function JsonBlock({ text, payload, label = "JSON", defaultOpen = false, onCopy, ...props }, context) {
|
|
8
|
-
const body =
|
|
9
|
+
const body = signal(null);
|
|
9
10
|
let loaded = false;
|
|
10
11
|
const load = () => {
|
|
11
12
|
if (loaded)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { h } from "meowjsx";
|
|
2
|
+
import { signal } from "meowjsx/signal";
|
|
2
3
|
import { copyTextToClipboard } from "../clipboard.js";
|
|
3
4
|
import { Icon } from "../icons/icon.js";
|
|
4
5
|
/**
|
|
@@ -7,8 +8,8 @@ import { Icon } from "../icons/icon.js";
|
|
|
7
8
|
*/
|
|
8
9
|
export function JsonTree({ data, label = "JSON", defaultOpen = true, onCopy, ...props }, context) {
|
|
9
10
|
const container = data !== null && typeof data === "object";
|
|
10
|
-
const feedback =
|
|
11
|
-
const children =
|
|
11
|
+
const feedback = signal("");
|
|
12
|
+
const children = signal(null);
|
|
12
13
|
let loaded = false;
|
|
13
14
|
let alive = true;
|
|
14
15
|
context.onCleanup(() => {
|