meowtail 0.4.0-alpha.0 → 0.4.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/ASSISTANT.md +2 -2
- package/AUTHORING.md +268 -0
- package/CHANGELOG.md +116 -0
- package/COMPONENTS.md +182 -140
- package/README.md +145 -34
- package/dist/src/chat/assistant-content.js +3 -1
- package/dist/src/chat/assistant-markdown.d.ts +8 -5
- package/dist/src/chat/assistant-markdown.js +11 -26
- package/dist/src/components/autocomplete.d.ts +47 -0
- package/dist/src/components/autocomplete.js +169 -0
- package/dist/src/components/card-title.d.ts +1 -0
- package/dist/src/components/card-title.js +2 -1
- package/dist/src/components/chart-scale.d.ts +46 -0
- package/dist/src/components/chart-scale.js +118 -0
- package/dist/src/components/chart.d.ts +38 -0
- package/dist/src/components/chart.js +210 -0
- package/dist/src/components/choice-group.js +2 -2
- package/dist/src/components/choice-select.js +2 -2
- package/dist/src/components/code-block.d.ts +3 -1
- package/dist/src/components/code-block.js +75 -16
- package/dist/src/components/command-palette.d.ts +44 -0
- package/dist/src/components/command-palette.js +198 -0
- package/dist/src/components/context-menu.d.ts +2 -1
- package/dist/src/components/context-menu.js +2 -1
- package/dist/src/components/credential-source.d.ts +2 -1
- package/dist/src/components/credential-source.js +2 -1
- package/dist/src/components/detail-section.d.ts +2 -1
- package/dist/src/components/detail-section.js +8 -3
- package/dist/src/components/dialog.d.ts +4 -1
- package/dist/src/components/dialog.js +7 -2
- package/dist/src/components/entry.d.ts +45 -0
- package/dist/src/components/entry.js +38 -0
- package/dist/src/components/entry.options.d.ts +4 -0
- package/dist/src/components/entry.options.js +3 -0
- package/dist/src/components/field-group.js +2 -2
- package/dist/src/components/field.d.ts +4 -0
- package/dist/src/components/field.js +15 -3
- package/dist/src/components/form.d.ts +34 -0
- package/dist/src/components/form.js +58 -0
- package/dist/src/components/heading-level.d.ts +9 -0
- package/dist/src/components/heading-level.js +12 -0
- package/dist/src/components/hover-card.d.ts +3 -2
- package/dist/src/components/hover-card.js +50 -15
- package/dist/src/components/index.d.ts +11 -1
- package/dist/src/components/index.js +11 -1
- package/dist/src/components/markdown-blocks.d.ts +27 -0
- package/dist/src/components/markdown-blocks.js +141 -0
- package/dist/src/components/markdown.d.ts +35 -0
- package/dist/src/components/markdown.js +35 -0
- 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 +2 -1
- package/dist/src/components/modal.js +2 -2
- package/dist/src/components/page.js +1 -1
- package/dist/src/components/pagination.d.ts +52 -0
- package/dist/src/components/pagination.js +89 -0
- package/dist/src/components/path-label.js +5 -27
- package/dist/src/components/popover.d.ts +2 -1
- package/dist/src/components/popover.js +33 -6
- package/dist/src/components/resource-card.d.ts +4 -1
- package/dist/src/components/resource-card.js +7 -2
- package/dist/src/components/risk-confirmation.d.ts +2 -1
- package/dist/src/components/risk-confirmation.js +2 -1
- package/dist/src/components/section.d.ts +1 -7
- package/dist/src/components/section.js +3 -8
- package/dist/src/components/segmented-control.d.ts +2 -1
- package/dist/src/components/segmented-control.js +2 -1
- package/dist/src/components/tabs.d.ts +2 -1
- package/dist/src/components/tabs.js +2 -1
- package/dist/src/components/token-field.d.ts +45 -0
- package/dist/src/components/token-field.js +175 -0
- package/dist/src/components/tooltip.d.ts +2 -1
- package/dist/src/components/tooltip.js +2 -1
- package/dist/src/components/tree-view.d.ts +39 -0
- package/dist/src/components/tree-view.js +244 -0
- package/dist/src/components/tree-view.options.d.ts +2 -0
- package/dist/src/components/tree-view.options.js +3 -0
- package/dist/src/icons/README.md +11 -10
- package/dist/src/icons/icon.d.ts +1 -0
- package/dist/src/icons/icon.js +2 -1
- package/dist/src/icons/index.d.ts +0 -1
- package/dist/src/icons/index.js +0 -1
- package/dist/src/registry/index.d.ts +41 -1
- package/dist/src/registry/index.js +20 -0
- package/dist/src/shared/element-id.d.ts +6 -0
- package/dist/src/shared/element-id.js +10 -0
- package/dist/src/shared/page-attribute.d.ts +5 -0
- package/dist/src/shared/page-attribute.js +5 -0
- package/dist/src/theme/base.styles.d.ts +2 -0
- package/dist/src/theme/base.styles.js +41 -4
- package/dist/src/theme/chat/assistant.styles.js +21 -1
- package/dist/src/theme/chat/attachments.styles.js +35 -6
- package/dist/src/theme/chat/composer.styles.js +30 -3
- package/dist/src/theme/chat/conversation.styles.js +13 -1
- package/dist/src/theme/chat/records.styles.js +10 -5
- package/dist/src/theme/components/autocomplete.styles.d.ts +1 -0
- package/dist/src/theme/components/autocomplete.styles.js +68 -0
- package/dist/src/theme/components/button.styles.js +0 -1
- package/dist/src/theme/components/card.styles.js +2 -1
- package/dist/src/theme/components/chart.styles.d.ts +1 -0
- package/dist/src/theme/components/chart.styles.js +173 -0
- package/dist/src/theme/components/code-block.styles.js +79 -38
- package/dist/src/theme/components/command-palette.styles.d.ts +1 -0
- package/dist/src/theme/components/command-palette.styles.js +143 -0
- package/dist/src/theme/components/dialog.styles.js +2 -1
- package/dist/src/theme/components/empty-state.styles.js +2 -1
- package/dist/src/theme/components/entry.styles.d.ts +1 -0
- package/dist/src/theme/components/entry.styles.js +86 -0
- package/dist/src/theme/components/form.styles.d.ts +1 -0
- package/dist/src/theme/components/form.styles.js +32 -0
- package/dist/src/theme/components/hover-card.styles.js +57 -12
- package/dist/src/theme/components/image-preview.styles.js +25 -0
- package/dist/src/theme/components/layout.styles.js +6 -0
- package/dist/src/theme/components/markdown.styles.d.ts +1 -0
- package/dist/src/theme/components/markdown.styles.js +10 -0
- package/dist/src/theme/components/nav-list.styles.js +6 -7
- package/dist/src/theme/components/pagination.styles.d.ts +1 -0
- package/dist/src/theme/components/pagination.styles.js +103 -0
- package/dist/src/theme/components/path-label.styles.js +19 -6
- package/dist/src/theme/components/resource-card.styles.js +2 -1
- package/dist/src/theme/components/search-input.styles.js +23 -0
- package/dist/src/theme/components/slider.styles.js +4 -0
- package/dist/src/theme/components/token-field.styles.d.ts +1 -0
- package/dist/src/theme/components/token-field.styles.js +109 -0
- package/dist/src/theme/components/tree-view.styles.d.ts +1 -0
- package/dist/src/theme/components/tree-view.styles.js +104 -0
- package/dist/src/theme/icons/icons.styles.js +0 -18
- package/dist/src/theme/index.d.ts +446 -9
- package/dist/src/theme/index.js +58 -1
- package/dist/src/theme/journal.tokens.d.ts +389 -0
- package/dist/src/theme/journal.tokens.js +181 -0
- package/dist/src/theme/meow.tokens.d.ts +362 -0
- package/dist/src/theme/meow.tokens.js +91 -0
- package/dist/src/theme/shared/field-surface.styles.js +11 -7
- package/dist/src/theme/shared/prose.styles.js +12 -4
- package/dist/src/theme/tokens.d.ts +286 -7
- package/dist/src/theme/tokens.js +15 -2
- package/dist/src/theme/utilities.js +4 -4
- package/dist/src/web/focus-modality.d.ts +20 -0
- package/dist/src/web/focus-modality.js +72 -0
- package/dist/src/web/index.d.ts +2 -0
- package/dist/src/web/index.js +2 -0
- package/dist/src/web/theme-plugin.d.ts +33 -0
- package/dist/src/web/theme-plugin.js +93 -0
- package/package.json +14 -6
- package/dist/src/icons/doodle-cat.d.ts +0 -5
- package/dist/src/icons/doodle-cat.js +0 -8
package/README.md
CHANGED
|
@@ -12,33 +12,41 @@ The presentation player, Reveal, media lifecycle, presentation content layouts,
|
|
|
12
12
|
|
|
13
13
|
This package's npm name is `meowtail`; existing APIs such as `createMeowUI`, `installMeowUI`, and `createMeowUICatalog`, along with runtime style identity, stay unchanged. Use the new package import path; do not derive new function names, `data-*` markers, or CSS variables from the package name.
|
|
14
14
|
|
|
15
|
+
Agents building an application with this package start with the
|
|
16
|
+
[Meowland skill](https://github.com/lidessen/meowland/blob/main/skills/meowland/SKILL.md) (`npx skills add lidessen/meowland --skill meowland`)
|
|
17
|
+
and the Markdown component pages listed in [meowland.dev/llms.txt](https://meowland.dev/llms.txt).
|
|
18
|
+
|
|
15
19
|
Application authors writing their own components (the shadcn/ui and Tailwind equivalents, the style floor and the audit) start with [Authoring](AUTHORING.md). See [Assistant](ASSISTANT.md) for the usage contract of the complete composition and [JSON catalog](JSON.md) for the finite JSON entry point. Implementation and independent acceptance of both are still in progress; the API descriptions and early artifact verification on this page do not equal a same-source acceptance pass for all current source code.
|
|
16
20
|
|
|
17
21
|
## Runtime compatibility
|
|
18
22
|
|
|
19
|
-
The
|
|
20
|
-
`
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
The `0.4.0-alpha.2` candidate requires `meowjsx@^0.3.0-alpha.1` and `meowcss@^0.3.0-alpha.2`:
|
|
24
|
+
`createMeowUITheme` runs on MeowJSX's `prepareContainer` hook and shares stylesheets through
|
|
25
|
+
MeowCSS's counted `mountStyles`. It uses ordinary components with static `meta`, composed part/ref
|
|
26
|
+
bindings and the class-value theme API. Earlier package generations do not implement that
|
|
27
|
+
authoring contract. The published releases remain listed in the root README.
|
|
23
28
|
|
|
24
29
|
## Minimal browser integration
|
|
25
30
|
|
|
26
|
-
In a browser entry point containing `<main id="app"></main>`,
|
|
27
|
-
|
|
31
|
+
In a browser entry point containing `<main id="app"></main>`, install two plugins on the runtime that
|
|
32
|
+
renders the page: `createMeowUI` registers the components and `createMeowUITheme` delivers the theme
|
|
33
|
+
to every Web mount. Rendering is then MeowJSX's own `render`.
|
|
28
34
|
|
|
29
35
|
```tsx
|
|
30
36
|
import { createRuntime, h } from "meowjsx";
|
|
31
37
|
import { createWebRenderer } from "meowjsx/web";
|
|
32
38
|
import { Button, Inline, Stack, createMeowUI } from "meowtail";
|
|
33
|
-
import { standardTheme
|
|
34
|
-
import {
|
|
39
|
+
import { standardTheme } from "meowtail/theme";
|
|
40
|
+
import { createMeowUITheme } from "meowtail/web";
|
|
35
41
|
|
|
36
42
|
const root = document.querySelector<HTMLElement>("#app");
|
|
37
43
|
if (!root) throw new Error("Missing app root");
|
|
38
|
-
const runtime = createRuntime(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
const runtime = createRuntime({
|
|
45
|
+
plugins: [
|
|
46
|
+
createMeowUI({ components: [Button, Inline, Stack] }),
|
|
47
|
+
createMeowUITheme({ theme: standardTheme }),
|
|
48
|
+
],
|
|
49
|
+
});
|
|
42
50
|
const mounted = createWebRenderer(runtime).render(
|
|
43
51
|
<Stack align="start">
|
|
44
52
|
<strong>Connection settings</strong>
|
|
@@ -50,17 +58,39 @@ const mounted = createWebRenderer(runtime).render(
|
|
|
50
58
|
root,
|
|
51
59
|
);
|
|
52
60
|
|
|
53
|
-
// Dispose with the host that owns this mount.
|
|
54
|
-
const dispose = () =>
|
|
55
|
-
mounted.unmount();
|
|
56
|
-
removeTheme();
|
|
57
|
-
removeStyles();
|
|
58
|
-
uninstall();
|
|
59
|
-
};
|
|
61
|
+
// Dispose with the host that owns this mount; it also releases the theme delivery.
|
|
62
|
+
const dispose = () => mounted.unmount();
|
|
60
63
|
```
|
|
61
64
|
|
|
65
|
+
For each mount, `createMeowUITheme` puts `theme.cssText` in the container's document (one shared
|
|
66
|
+
`<style>` per document), binds the theme attributes to the container (`config` selects the scheme
|
|
67
|
+
and other options; a Signal keeps it live) and installs the focus-modality tracker. It also owns the
|
|
68
|
+
page: the document element takes the same theme and selection and is marked `data-meowui-page`, so
|
|
69
|
+
the foundation styles paint it with `surface.canvas` and the matching CSS `color-scheme`, and a dark
|
|
70
|
+
scheme never sits on a white page. The first mount in a document sets the page's selection and the
|
|
71
|
+
last one releases it. A region embedded in a page whose ground belongs to the host passes
|
|
72
|
+
`page: false`. A second themed
|
|
73
|
+
render into the same container, or a container inside a shadow root, throws instead of leaving a
|
|
74
|
+
page half-styled. Registration alone (`createMeowUI` without the theme plugin) changes nothing in the
|
|
75
|
+
document, and a bundle that only registers components carries no theme delivery. Static output does
|
|
76
|
+
not run the theme plugin; deliver CSS at build time as described in
|
|
77
|
+
[Component installation and style delivery](#component-installation-and-style-delivery).
|
|
78
|
+
Hosts whose theme is assembled with extra CSS, or whose theme root is not the render container,
|
|
79
|
+
keep the explicit `mountStyles` and `applyTheme` steps.
|
|
80
|
+
|
|
81
|
+
`installFocusModality` from `meowtail/web` makes focus rings follow the keyboard. Browsers disagree on
|
|
82
|
+
`:focus-visible`: Safari also matches it when script moves focus after a tap, so a ring lands on
|
|
83
|
+
what the reader just touched. Like React Aria's input modality, the tracker records whether the last
|
|
84
|
+
input was a pointer or a key on the document element (`data-meowui-focus-modality`). After a pointer,
|
|
85
|
+
the theme hides every outline focus ring until the next keystroke. Text entry (text inputs, textarea,
|
|
86
|
+
select, `contenteditable`, `role="textbox"`) keeps its focus state either way, and a Menu keeps its
|
|
87
|
+
active row. `createMeowUITheme` installs it with each mount; a host without that plugin installs it
|
|
88
|
+
once per document, the canvas iframe of a gallery included; calls are counted.
|
|
89
|
+
A page rendered ahead of time inlines `focusModalityScript` instead. Without the tracker, rings follow
|
|
90
|
+
the browser's own `:focus-visible`. Styles inside shadow roots do not see the attribute.
|
|
91
|
+
|
|
62
92
|
The theme root provides an inheritable body font, font size, line height, and text color; local theme configuration inherits the outer typography, while components still own their own control and heading scales.
|
|
63
|
-
This does not include a global `html/body` margin reset
|
|
93
|
+
This does not include a global `html/body` margin reset or page whitespace, and does not automatically reset arbitrary `h1/h2/p`; the page background and color scheme come only from a page that `createMeowUITheme` owns.
|
|
64
94
|
Use `PageFrame` / `Container` for page space, `Stack` for related content, and `Inline` for a group of actions; the complete Assistant can use `AssistantView` directly, without rebuilding a page from bare Cards.
|
|
65
95
|
`CardHeader/Title/Content/Footer` express relationships inside a card, while native content follows document semantics; do not wrap every layer of content in its own surface.
|
|
66
96
|
Compare Meowbook's `buttons`, `card-composition`, and `workspace-composition`; they show action relationships, card structure, and a scrolling workspace respectively. A stress state does not mean the product must display all states at once.
|
|
@@ -76,6 +106,7 @@ src/
|
|
|
76
106
|
registry/ # Component catalog, meowjsx type declarations, and the installation entry point
|
|
77
107
|
shared/ # Small utilities shared inside components
|
|
78
108
|
theme/ # Standard theme token definitions and TS styles organized by part
|
|
109
|
+
web/ # Document-level browser behavior: the focus modality tracker
|
|
79
110
|
tests/
|
|
80
111
|
unit/ # Bun, grouped by components/chat/icons/shared/theme
|
|
81
112
|
types/ # Public type contracts using *.types.ts / *.types.tsx, verified by tsc
|
|
@@ -112,10 +143,14 @@ The original product's wiring and UI acceptance are historical evidence and cann
|
|
|
112
143
|
Shiki is reached only from the `CodeBlock` and `ReadBlock` modules. `JsonBlock` and `AssistantView` render a code surface, so importing either one pulls the same highlighter. Importing `standardTheme`, `createMeowUI`, or any other component does not. The package declares `sideEffects: false`, which lets a bundler drop those modules when their exports are unused. The highlighter stays on demand for a mounted code surface; it is not registered as a side effect of the theme.
|
|
113
144
|
|
|
114
145
|
`MermaidDiagram` draws Mermaid `source` as themed SVG with [Pele](https://pele.run), loaded on demand when a diagram mounts (each diagram type is its own chunk), so a host that never draws one does not bundle it. Pele's variables take the library's roles: shapes on the overlay rung with the control hairline, groups on the canvas rung, connectors in tertiary ink, emphasis in the accent and charts in `chartTokens` order. Charts follow the data-visualization rules: a pie reads as a donut with surface gaps and round legend dots, bars narrow to thin marks with a rounded end, line points are ringed in the surface, and grid and axes recede; text draws at the body size, and colors follow the scheme without a redraw. A Signal `source` redraws in place. Before the client mounts it, in server or static output, and when the source cannot be drawn, the component shows the source as text, with one error line on failure. Links, images and icons inside diagrams are off, and `limits` bounds the source (50,000 characters) and the edges (2,000) because drawing is synchronous. `title`, `caption`, `actions` and `onCopy` work as on `CodeBlock`; `zoom` (`"auto"` by default, fixed for the mount) shows zoom controls when the diagram is larger than its frame.
|
|
115
|
-
Wrapping changes only the display; copying preserves the original whitespace.
|
|
116
|
-
clipboard implementation, and the component does not execute code.
|
|
146
|
+
Wrapping changes only the display; copying preserves the original whitespace. Soft wrap and copy are compact icon buttons named for assistive technology; a successful copy turns the copy icon into a check named "Copied" for a moment and is announced, and a failed copy shows one danger line aligned with the code until the next try. The host can bind `onCopy` to another
|
|
147
|
+
clipboard implementation, and the component does not execute code. The header shows the language by name (`ts` reads TypeScript, `sh` reads Shell; `codeLanguageName` exposes the mapping, unknown ids stay as given), "Code" with no language, and `defaultWrap` sets the initial wrap state. Header text and code share one start edge; on a narrow surface, wide host actions move to their own row instead of squeezing the name. While `code` grows by appending, as when it streams, the previous highlight stays and the new text follows plainly until the next highlight, so it never flashes back to plain text.
|
|
117
148
|
Unknown languages or failed highlight loads keep a plain-text display.
|
|
118
149
|
|
|
150
|
+
`Markdown text` renders safe Markdown with the Assistant's content policy: raw HTML and images stay text and only explicit `http:`, `https:` and `mailto:` links navigate, in a new tab. Each top-level block is its own element, keyed by position and element, and is rewritten only when its own output changes, so a selection or copy in finished blocks survives streaming. With `streaming`, the open tail is completed before parsing (an unclosed code span, `**`, `~~` or `*` is closed and a half-typed link shows its text), and the root reports `aria-busy`; finished text is never repaired. `renderCode(block)` draws top-level fences, for example with `CodeBlock`, from a Signal of `{ code, language }`; without it fences stay a themed `pre`, so importing Markdown does not pull the highlighter. `repairMarkdownTail`, `markdownBlocks` and `renderMarkdown` expose the same steps.
|
|
151
|
+
|
|
152
|
+
`Chart type categories series` draws host data as bars (comparison, always from zero) or a line (trend), up to eight series in the fixed `chartTokens` order; later series are left out with a console warning, and values are padded or cut to the categories, with `null` as a missing value. A legend names every series when there are two or more, line markers differ by shape, the plot wrapper takes focus and reads each category through a polite status as the arrow keys move, and Show data opens every value as a `Table`. The width follows the container; `type` is fixed for the mount.
|
|
153
|
+
|
|
119
154
|
`Checkbox`, `Switch`, and `SegmentedControl` provide native form selection; `Tabs` handles switching panels that stay mounted.
|
|
120
155
|
A `Checkbox` can be `indeterminate` for a parent of mixed children; assistive technology reads `aria-checked="mixed"`.
|
|
121
156
|
`Slider` is a native range with a visible figure for the same value; `NumberInput` steps and clamps a number and formats the committed figure.
|
|
@@ -155,6 +190,14 @@ low-contrast disabled state); `Drawer` is a narrow-screen native modal panel tha
|
|
|
155
190
|
tightens its track and selected state to match the design draft. The narrow-screen `ChatComposer` stacked layout puts "add, input, send" on one row and keeps model selection below.
|
|
156
191
|
Every color, size, radius, shadow and duration is a role in one tree, `uiTokens` in `theme/tokens.ts` (surface, inverse, line, ink, state, action, control, accent, status, type, space, icon, radius, shadow, motion, layout, glyph; CSS names `--ui-<group>-<key>`). Accent expresses only "happening now" and "where you are", while the main action stays black and white. The rules for each group are in [AGENTS.md](AGENTS.md#design-system).
|
|
157
192
|
|
|
193
|
+
`EntryList` and `Entry` present content entries such as posts, notes, releases or results. An
|
|
194
|
+
`Entry` takes `title`, an optional `href` that the title links to, an `eyebrow` kicker (often the
|
|
195
|
+
date), a `description` standfirst and `meta` facts (for example a `MetaRow` byline);
|
|
196
|
+
`size="feature"` makes it the lead entry with a larger title and a reading-size standfirst. Its
|
|
197
|
+
heading level follows the surrounding `Page` or `Section`. Inside an `EntryList` it is a list item and
|
|
198
|
+
on its own an article; the list sits on the surrounding surface and opens each entry with a hairline,
|
|
199
|
+
with no box around the run.
|
|
200
|
+
|
|
158
201
|
`ChatToolCall` uses `label` for the action and `summary` for the short target still visible when collapsed; input/output are reactive lazy text,
|
|
159
202
|
and overlong results collapse through the shared `OutputBlock` and copy in full. queued/running/waiting/success/error/cancelled/unknown
|
|
160
203
|
each represent host facts, and complete stays for compatibility. onRetry/onCancel only notify the host; the component does not execute tools or update business state automatically.
|
|
@@ -260,7 +303,7 @@ Meowbook's "Layout composition · Text baseline and fixed actions" covers these
|
|
|
260
303
|
|
|
261
304
|
### Text and reading content
|
|
262
305
|
|
|
263
|
-
`Text` is one run of copy in a theme text role: `variant` is `body` (default), `secondary`, `caption`, or `eyebrow` (the small-caps group label used by menus
|
|
306
|
+
`Text` is one run of copy in a theme text role: `variant` is `body` (default), `secondary`, `caption`, or `eyebrow` (the small-caps group label used by menus and specimen labels), and `as` is `p` (default), `span`, or `div`. Emphasis and fine print keep their native `strong`, `em` and `small` inside it. Headings stay with `PageHeader`, `Page` and `Section`, field labels with `Field`, and code with the code components; Text has no tone, because state color belongs to `Status`, `Badge` and `Alert`, which carry non-color cues.
|
|
264
307
|
|
|
265
308
|
`Prose` holds long-form reading content: native `h2`–`h4`, paragraphs, lists, quotes, `pre`/`code`, rules, tables, links and images inside it take one reading rhythm, shared with chat message content and rendered assistant markdown. `measure="reading"` (default) caps lines at `uiTokens.layout.measure`; `measure="fill"` takes the parent's width; `as` is `div`, `article`, or `section`. Arranging controls and cards stays with Stack, Inline and Grid. Neither component joins the JSON catalog, and Meowslides keeps its own presentation typography.
|
|
266
309
|
|
|
@@ -294,7 +337,10 @@ actions and inputs inside values in one viewport, for checking shared columns, n
|
|
|
294
337
|
`Card` supports CardHeader, CardTitle, CardDescription, CardAction, CardContent, and CardFooter.
|
|
295
338
|
The default `variant="auto"` takes depth from the render tree Context: the standard theme presents the top level as an independent surface and blends descendants into the parent; an explicit variant takes precedence.
|
|
296
339
|
Depth follows the logical component tree, so an overlay does not automatically become a new root just because it visually leaves the parent card; overlay content that needs an independent surface uses surface explicitly.
|
|
297
|
-
|
|
340
|
+
CardTitle takes the heading level one below the surrounding `Page`, `Section`, `DetailSection` or `Dialog` heading (h2 at the
|
|
341
|
+
top); `as` (h2–h6) overrides it. The level follows that document structure, not card nesting. `DetailSection` and
|
|
342
|
+
`ResourceCard` titles follow the same rule, a `DetailSection` passes its level on to sections inside it, and `Dialog`
|
|
343
|
+
content starts at h3 below its h2 title.
|
|
298
344
|
Ordinary internal groups use the shared surface, standalone items can explicitly use `variant="surface"`, and `variant="embedded"` explicitly blends into the parent surface.
|
|
299
345
|
Nesting does not mean borders and shadows must be repeated. Complex content still uses Stack/Inline/Grid layout; do not turn Card into a universal layout component.
|
|
300
346
|
|
|
@@ -302,9 +348,11 @@ Nesting does not mean borders and shadows must be repeated. Complex content stil
|
|
|
302
348
|
`AspectRatio ratio={16/9}` controls layout ratio; the caller chooses media object-fit and clipping.
|
|
303
349
|
`Separator` keeps horizontal/vertical separator semantics.
|
|
304
350
|
|
|
305
|
-
`Tabs` uses
|
|
351
|
+
`Tabs` uses label and items (value/label/content/disabled) to create associated tabs/tabpanels;
|
|
306
352
|
it supports arrow keys, Home/End, a controlled value Signal, and defaultValue. Panels stay mounted when switching, so drafts are not lost.
|
|
307
353
|
`Breadcrumb items` is an array of label/href, and the last item marks the current location.
|
|
354
|
+
`Pagination page pageCount onPageChange` moves through a host-owned record set: a known total shows the first and last page, the current page with `siblings` on each side (default 1) and gaps, at a constant count; omitting `pageCount` keeps Previous/Next and the page fact (`pageStatus`), and `hasNext` says whether a later page exists. In a bar narrower than 32rem the theme shows the page fact in place of the numbered pages, so Previous and Next stay on one line. Clicks only call `onPageChange`. `busy` sets `aria-busy` and keeps the controls in place without acting; boundaries and busy use `aria-disabled`, so focus stays on the control. `paginationEntries(page, pageCount, siblings)` exposes the same window; a non-integer or out-of-range page fact throws `RangeError`.
|
|
355
|
+
`TreeView label items` explores a host hierarchy with the tree keyboard model: Up/Down through visible rows, Right/Left to open, close and climb, Home/End, `*` to open siblings and a letter to jump. `expanded`/`defaultExpanded`/`onExpandedChange` and `selected`/`defaultSelected`/`onSelectedChange` follow the controlled-or-local rule; one row holds the tab stop, disabled rows stay focusable but unselectable, and when the host collapses or removes the focused row, focus moves to its nearest visible ancestor. The chevron is pointer-only; no focusable control sits inside a row.
|
|
308
356
|
`Tooltip` uses `trigger(bindings)` to add text descriptions to named focusable controls; it appears after a mouse delay, appears immediately on keyboard focus,
|
|
309
357
|
and closes on Escape; do not put necessary information or interactive content only in a Tooltip—use Popover for the latter.
|
|
310
358
|
`Alert tone` expresses visual state, and `role` explicitly chooses status/alert; urgency is not inferred from color. `tone="neutral"` is the quiet notice: the same structure, tinted with the muted ink instead of a status color.
|
|
@@ -324,7 +372,7 @@ approach and does not force the component index on. Both approaches keep supplem
|
|
|
324
372
|
|
|
325
373
|
The native select control `Select` reuses browser option, keyboard, and form semantics and provides a `root` part; the theme decides visuals. It is used both for the Meowbook tool appearance and for scene theme selection. The control keeps native `size` (row count) semantics and does not reuse it as a visual size.
|
|
326
374
|
|
|
327
|
-
`Popover` is a non-modal general overlay; it does not set a menu role or trap focus by default. It requires
|
|
375
|
+
`Popover` is a non-modal general overlay; it does not set a menu role or trap focus by default. It requires
|
|
328
376
|
`trigger(bindings)`; the trigger button exposes the bindings, and content goes in children. It supports `open` Signal / `defaultOpen`,
|
|
329
377
|
`onOpenChange`, `align`, `matchTriggerWidth`, `role`, and `labelledBy`. `triggerId` can associate with an external Field.
|
|
330
378
|
It uses the browser Popover API's top-layer hosting and depends on browsers that support that API; positioning uses `@floating-ui/dom`'s
|
|
@@ -342,13 +390,16 @@ trigger. Error messages use the browser's native validation copy. Reset restores
|
|
|
342
390
|
The theme visually hides the native form carrier; a hidden input is not used to fake required validation. It provides no custom multiple selection or asynchronous search.
|
|
343
391
|
The parts are `root/trigger/value/indicator/list/group/option/native/validation`.
|
|
344
392
|
|
|
393
|
+
`Autocomplete suggestions value onValueChange` keeps focus in a real text input (`role="combobox"`) while the arrow keys move through the host's suggestions; Enter accepts the active one without submitting the form, and any other text stays valid. The host filters and loads; `loading` and `emptyMessage` sit in a status region beside the list. Native `name`, `required` and reset keep working, and a reset reaches a controlled host through `onValueChange`.
|
|
394
|
+
`TokenField tokens onAdd onRemove` enters several values: Enter, a separator or a paste calls `onAdd` with the trimmed text (return `false` to keep the draft), and the host resolves, deduplicates and updates `tokens`. Tokens are a labelled list with one tab stop; the first Backspace on an empty draft moves to the last token and the next removes it, and focus moves only after the host has removed it. `name` submits one value per token, and `required` uses the draft's custom validity.
|
|
395
|
+
|
|
345
396
|
- Basics: Button, AddButton, IconButton, MenuButton, Card, Badge, Avatar, Input, NumberInput,
|
|
346
397
|
Textarea, Select, Field, SearchInput, Slider, Progress, Link, Disclosure, Accordion, Table,
|
|
347
398
|
Separator, NavItem, EmptyState.
|
|
348
399
|
- Dialogs: Dialog, DialogPanel, DialogHeader, DialogActions.
|
|
349
400
|
- Chat: ChatFrame, ChatHeader, ChatStatus, ChatConversation, ChatMessageList, ChatMessage, ChatBubble,
|
|
350
401
|
ChatMessageActions, ChatComposer, ChatToolCall, ChatAttachments, ChatProcess, ChatSources.
|
|
351
|
-
- Icons: the finite semantic set `Icon` and `iconNames` sourced from the pinned Lucide dependency, caller-supplied `IconSource` and `IconNode`, and the `meowtail/icons/lucide` pass-through for application icons, plus MeowlandMark, AssistantMark,
|
|
402
|
+
- Icons: the finite semantic set `Icon` and `iconNames` sourced from the pinned Lucide dependency, caller-supplied `IconSource` and `IconNode`, and the `meowtail/icons/lucide` pass-through for application icons, plus MeowlandMark, AssistantMark, EmptyStack, NotesIcon, TasksIcon, SearchIcon, PlusIcon, GithubIcon, ExternalArrowIcon.
|
|
352
403
|
|
|
353
404
|
Icons outside the semantic set go through `IconSource` with structural `IconNode` data from a trusted source. The pinned pass-through at `meowtail/icons/lucide` re-exports the installed Lucide version, so an application can use any Lucide icon without adding its own icon dependency; JSON surfaces keep only the finite `iconNames` set:
|
|
354
405
|
|
|
@@ -362,13 +413,20 @@ import { Bell } from "meowtail/icons/lucide";
|
|
|
362
413
|
Before adding a component, confirm it can be reused in more than two applications or scenes; page components used once by an application should not be moved
|
|
363
414
|
here just to "extract" them.
|
|
364
415
|
|
|
365
|
-
|
|
366
|
-
|
|
416
|
+
Components that wire ARIA references (`Tabs`, `Popover`, `Menu`, `MenuButton`, `ContextMenu`, `HoverCard`, `Tooltip`,
|
|
417
|
+
`SegmentedControl`, `RiskConfirmation`, `CredentialSource`) take an optional `id` as the base of those references and
|
|
418
|
+
generate a document-unique one when it is omitted; pass `id` when the host must address the element.
|
|
419
|
+
|
|
420
|
+
`Field` associates its label through `htmlFor`. Without `htmlFor`, a single control child is labelled by its own
|
|
421
|
+
string `id`, or Field generates one and gives it to that child; a Signal `id` stays the host's and is not wired.
|
|
422
|
+
For a single control child, it merges visible description and error ids from that control id, `descriptionId`, or `errorId`
|
|
367
423
|
with the child's original `aria-describedby`, including a host Signal. It manages only its own ids.
|
|
368
424
|
Multiple control children and custom compositions require the caller to pass association attributes explicitly.
|
|
369
425
|
Top-level `description` and `error` Signals keep their message parts mounted and update content, `hidden`, and
|
|
370
426
|
associations without remounting the control, preserving drafts and focus. `null`, `undefined`, `false`, and `""`
|
|
371
427
|
are empty messages; `0` is content. Field does not inspect arbitrary VNodes, Promises, or nested Signals for DOM visibility.
|
|
428
|
+
|
|
429
|
+
`Form onSubmit` wraps the fields in a native form: constraint validation runs first and focuses the first invalid control (a hidden carrier such as ChoiceSelect's select hands focus to its visible control), then `onSubmit(data, event)` receives the `FormData` with the submitter. `busy` sets `aria-busy` and ignores further submits, `error` shows a danger alert and `status` a polite receipt; nothing is reset. Field and the host own `aria-invalid`. `onCancel` adds a `type="button"` Cancel, and `actions` replaces the row.
|
|
372
430
|
Explicit `invalid`, including `false` or a boolean Signal, takes precedence; otherwise a provided error derives the
|
|
373
431
|
live invalid state, clearing `aria-invalid` to `"false"` when the message empties. Without either input, the child's
|
|
374
432
|
original `aria-invalid` is preserved. Field supplies no validation, submission, focus management, or automatic announcement.
|
|
@@ -418,7 +476,7 @@ Bubble's `auto` reads the message role through Context and the theme decides the
|
|
|
418
476
|
|
|
419
477
|
`ChatConversation` is an optional scroll container, and the host must provide a constrained height.
|
|
420
478
|
It follows appended content when near the bottom, keeps position when scrolled up, and provides a return-to-latest button.
|
|
421
|
-
The return action
|
|
479
|
+
The return action floats over the lower edge of the viewport, so showing or hiding it never resizes the transcript; while history is being read it may cover the bottom of one line.
|
|
422
480
|
It does not implement history prepending, per-message anchors, or persisted reading restoration. Do not stack it on top of an existing application scroll controller;
|
|
423
481
|
the Dashboard keeps using its own controller. `ChatMessageList` still provides only message-record semantics.
|
|
424
482
|
|
|
@@ -473,6 +531,45 @@ The standard theme exports `standardTheme`, `standardOptions`, and typed `uiToke
|
|
|
473
531
|
are both defined in TypeScript; components match CSS through stable part markers and style options, and theme plugins no longer generate
|
|
474
532
|
visual class names. See TypeScript tokens and parameterized configuration (historical reference in the original product repository) for the complete design.
|
|
475
533
|
|
|
534
|
+
### Journal theme
|
|
535
|
+
|
|
536
|
+
`journalTheme` is a second concrete theme for blogs and long-form reading. It is assembled from the
|
|
537
|
+
same `standardThemeStyles` and supplies different values for the same `ui` roles
|
|
538
|
+
(`journalUiTokenValues`, compiled as `journalUiTokens`), after an editorial research site: warm paper
|
|
539
|
+
and ink, Newsreader titles and reading copy over Inter controls, JetBrains Mono code, an oxblood
|
|
540
|
+
accent, quiet hairlines, small radii and soft warm depth. Titles take a book weight (500), reading
|
|
541
|
+
copy is 19 / 33 in a softer ink under full-ink headings on a 680px column, and quotations are italic.
|
|
542
|
+
The theme names those fonts first and falls back to system faces. `journalFonts` lists the Fontsource
|
|
543
|
+
packages that carry them (Newsreader with its italic, Inter, JetBrains Mono); Meowtail ships no font
|
|
544
|
+
files, so the host installs those packages and loads them, for example by passing the list to
|
|
545
|
+
Meowpress as `fonts`.
|
|
546
|
+
Control heights, icon sizes and code sizes keep the standard values. Mount it instead of `standardTheme`; components, markup and heading structure do
|
|
547
|
+
not change.
|
|
548
|
+
|
|
549
|
+
```ts
|
|
550
|
+
mountStyles(document, journalTheme.cssText);
|
|
551
|
+
applyTheme(document.documentElement, journalTheme);
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Meow theme
|
|
555
|
+
|
|
556
|
+
`meowTheme` recolors the standard theme after the Meowland mark and changes nothing else. It is
|
|
557
|
+
assembled from the same `standardThemeStyles` with `meowUiTokenValues` (compiled as `meowUiTokens`):
|
|
558
|
+
black carries the page (ink, filled actions, Tooltip and Toast, and the ground in the dark scheme),
|
|
559
|
+
the mark's red (`#e71c22`) is the one accent for focus, selection, the current place and links, and
|
|
560
|
+
the light ground is the mark's warm paper. Type, spacing, radii, control heights, depth and motion
|
|
561
|
+
are the standard values.
|
|
562
|
+
|
|
563
|
+
```ts
|
|
564
|
+
mountStyles(document, meowTheme.cssText);
|
|
565
|
+
applyTheme(document.documentElement, meowTheme);
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
The three themes share one theme root name and one set of `--ui-*` variables, so a document mounts one of
|
|
569
|
+
them. `standardUiTokenValues` and the `UiTokenValues` type let a host value the same roles for its own
|
|
570
|
+
theme; a value tree that misses or adds a role does not typecheck. In Meowbook, the gallery's Theme
|
|
571
|
+
control paints every story with any of them, and `?theme=journal` or `?theme=meow` selects one in a link.
|
|
572
|
+
|
|
476
573
|
Style files use `<responsibility>.styles.ts`; the standard theme groups them by component and conversation responsibility, and application styles are maintained with application modules.
|
|
477
574
|
See the style file organization (historical reference in the original product repository) for naming, component family boundaries, and cascade organization.
|
|
478
575
|
Existing styles have been migrated to this specification, and historical conversation overrides have been merged back into the files owned by messages and the composer.
|
|
@@ -481,7 +578,7 @@ Existing styles have been migrated to this specification, and historical convers
|
|
|
481
578
|
|
|
482
579
|
Compose pages from the roles below. Their current values live in the role tree in
|
|
483
580
|
[theme tokens](src/theme/tokens.ts); component styles apply them to named parts.
|
|
484
|
-
Meowbook's [`design-language` panorama](stories/language.stories.tsx) puts typography, actions,
|
|
581
|
+
Meowbook's [`design-language` panorama](stories/review/language.stories.tsx) puts typography, actions,
|
|
485
582
|
navigation, fields, execution states, and conversation on one board. The
|
|
486
583
|
[`settings-workflow` scene](stories/settings-workflow.stories.tsx) shows a complete local edit,
|
|
487
584
|
validation, correction, and save sequence. These are composition references, not backend integrations.
|
|
@@ -491,7 +588,12 @@ validation, correction, and save sequence. These are composition references, not
|
|
|
491
588
|
Every piece of text is one style of the type ramp. A style binds a size to its line box, weight and
|
|
492
589
|
tracking; apply it with `ui.text[role]` from `meowtail/theme`, or with the matching
|
|
493
590
|
`uiTokens.type` size, `type.line.*` and `type.weight.*` tokens where a part sets them one by one.
|
|
494
|
-
|
|
591
|
+
Interface text uses `uiTokens.type.sans` and code uses `uiTokens.type.mono`. Titles take
|
|
592
|
+
`uiTokens.type.display` and Prose reading copy takes `uiTokens.type.reading` at `type.readingSize`; in
|
|
593
|
+
the standard theme those roles hold the UI face and the body size, and a theme such as Journal gives
|
|
594
|
+
them a serif and a larger reading size. `type.weight.display` sets the weight of display-face titles,
|
|
595
|
+
`ink.reading` the ink of Prose copy under `ink.primary` headings, and `type.quoteStyle` the style of
|
|
596
|
+
quotations; their standard values are `semibold`, `ink.primary` and `normal`. The standard audit rules reject
|
|
495
597
|
literal font sizes, line heights and weights, including inside the `font` shorthand.
|
|
496
598
|
|
|
497
599
|
| Style | Size / line / weight | Use |
|
|
@@ -566,7 +668,11 @@ These relationships inform composition; theme values and component behavior are
|
|
|
566
668
|
|
|
567
669
|
### Component installation and style delivery
|
|
568
670
|
|
|
569
|
-
|
|
671
|
+
A browser host normally installs both through the runtime, as in
|
|
672
|
+
[Minimal browser integration](#minimal-browser-integration). The pieces below are what those two
|
|
673
|
+
plugins do, and what a static host or a host with its own delivery uses directly.
|
|
674
|
+
|
|
675
|
+
`createMeowUI({ components })` registers
|
|
570
676
|
an explicit list of component functions and the style-props adapter. `standardTheme.cssText` provides
|
|
571
677
|
the complete CSS with variable declarations, component rules and built-in utility classes. A dynamic
|
|
572
678
|
host can assemble it like this:
|
|
@@ -607,8 +713,13 @@ A static host composes `standardTheme.cssText` with application CSS at build tim
|
|
|
607
713
|
and outputs root attributes through `themeAttributes(standardTheme, config)`. Styles can load before client-side
|
|
608
714
|
JavaScript runs. The Dashboard and Meowbook use this delivery path;
|
|
609
715
|
dynamic previews use `mountStyles(document, cssText)`, with the host holding the returned cleanup function.
|
|
716
|
+
A static host that bundles that `.css` file with Bun runs `removeLegacyIsFallbacks` from
|
|
717
|
+
`meowcss/bundle` over the output: Bun writes legacy `:-moz-any()` copies of the theme's `:is()`
|
|
718
|
+
rules, and iOS Safari matches one of them on every container of a focused control.
|
|
610
719
|
Source code maintains no `.css` files, and generated CSS is still a browser asset. Module imports themselves do not access the DOM;
|
|
611
|
-
`mountStyles`
|
|
720
|
+
`mountStyles` shares one `<style>` per document and stylesheet text across its holders, including
|
|
721
|
+
`createMeowUITheme`, and the last cleanup removes it; a host that assembles its own CSS text still
|
|
722
|
+
assembles it once per document.
|
|
612
723
|
|
|
613
724
|
### Root configuration and local overrides
|
|
614
725
|
|
|
@@ -39,7 +39,9 @@ export function AssistantPartView({ value, message, renderPart, onToolAction, },
|
|
|
39
39
|
const custom = renderPart ? derived(() => renderPart(value.value, message.value)) : undefined;
|
|
40
40
|
let fallback;
|
|
41
41
|
if (initial.kind === "text") {
|
|
42
|
-
const text = h(AssistantMarkdown, { text: derived(() => value.value.text)
|
|
42
|
+
const text = (h(AssistantMarkdown, { text: derived(() => value.value.text),
|
|
43
|
+
// Only the part still being written repairs its open tail.
|
|
44
|
+
streaming: derived(() => message.value.status === "streaming" && message.value.parts.at(-1) === value.value) }));
|
|
43
45
|
fallback = message.value.role === "user" ? h(ChatBubble, null, text) : text;
|
|
44
46
|
}
|
|
45
47
|
else if (initial.kind === "tool") {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type Context, type Props } from "meowjsx";
|
|
2
|
-
import { type
|
|
3
|
-
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
3
|
+
import { renderMarkdown, safeMarkdownLink } from "../components/markdown-blocks.js";
|
|
4
|
+
export declare const assistantSafeLink: typeof safeMarkdownLink;
|
|
4
5
|
/** Raw HTML and images are text. Only explicit safe external links become navigation. */
|
|
5
|
-
export declare const assistantMarkdown:
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export declare const assistantMarkdown: typeof renderMarkdown;
|
|
7
|
+
/** The Assistant's text: the shared Markdown blocks under the Assistant's own part. */
|
|
8
|
+
export declare function AssistantMarkdown({ text, streaming, ref, }: {
|
|
9
|
+
text: MaybeSignal<string>;
|
|
10
|
+
streaming?: MaybeSignal<boolean>;
|
|
8
11
|
ref?: Props["ref"];
|
|
9
12
|
}, context: Context<typeof AssistantMarkdown>): import("meowjsx").VNode;
|
|
10
13
|
export declare namespace AssistantMarkdown {
|
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import { h } from "meowjsx";
|
|
2
|
-
import { derived } from "meowjsx/signal";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const url = new URL(href);
|
|
8
|
-
return ["http:", "https:", "mailto:"].includes(url.protocol) ? url.href : undefined;
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
const renderer = new Renderer();
|
|
15
|
-
renderer.html = ({ text }) => escape(text);
|
|
16
|
-
renderer.image = ({ text }) => escape(text);
|
|
17
|
-
renderer.link = function ({ href, title, tokens }) {
|
|
18
|
-
const label = this.parser.parseInline(tokens);
|
|
19
|
-
const link = assistantSafeLink(href);
|
|
20
|
-
return link
|
|
21
|
-
? `<a href="${escape(link)}" target="_blank" rel="noreferrer"${title ? ` title="${escape(title)}"` : ""}>${label}</a>`
|
|
22
|
-
: label;
|
|
23
|
-
};
|
|
24
|
-
const markdown = new Marked({ renderer, gfm: true, breaks: true });
|
|
2
|
+
import { derived, mapSignal, unwrap } from "meowjsx/signal";
|
|
3
|
+
import { CodeBlock } from "../components/code-block.js";
|
|
4
|
+
import { markdownBlockChildren } from "../components/markdown.js";
|
|
5
|
+
import { renderMarkdown, safeMarkdownLink } from "../components/markdown-blocks.js";
|
|
6
|
+
export const assistantSafeLink = safeMarkdownLink;
|
|
25
7
|
/** Raw HTML and images are text. Only explicit safe external links become navigation. */
|
|
26
|
-
export const assistantMarkdown =
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
export const assistantMarkdown = renderMarkdown;
|
|
9
|
+
// Fences in text read like the Assistant's code parts: the shared CodeBlock, with copy.
|
|
10
|
+
const renderCode = (block) => (h(CodeBlock, { code: mapSignal(block, (value) => value.code), language: mapSignal(block, (value) => value.language) }));
|
|
11
|
+
/** The Assistant's text: the shared Markdown blocks under the Assistant's own part. */
|
|
12
|
+
export function AssistantMarkdown({ text, streaming = false, ref, }, context) {
|
|
13
|
+
return (h("div", { "aria-busy": derived(() => (unwrap(streaming) ? "true" : undefined)), ref: [context.parts.root, ref] }, markdownBlockChildren(text, streaming, renderCode, undefined)));
|
|
29
14
|
}
|
|
30
15
|
AssistantMarkdown.meta = { name: "assistant-markdown", parts: ["root"] };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Context, type Props } from "meowjsx";
|
|
2
|
+
import { type MaybeSignal } from "meowjsx/signal";
|
|
3
|
+
export interface AutocompleteSuggestion {
|
|
4
|
+
/** The text written into the field when the suggestion is accepted; unique in the list. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Shown instead of the value when given. */
|
|
7
|
+
label?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AutocompleteProps extends Props {
|
|
11
|
+
/** Id of the text input; also the base for the list ids. Generated when omitted. */
|
|
12
|
+
id?: string;
|
|
13
|
+
/** Controlled text. Omit it to keep a local draft that starts at defaultValue. */
|
|
14
|
+
value?: MaybeSignal<string>;
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/** Called for every edit and for an accepted suggestion. */
|
|
17
|
+
onValueChange?: (value: string) => void;
|
|
18
|
+
/** Host-filtered suggestions for the current text; the component never filters or fetches. */
|
|
19
|
+
suggestions: MaybeSignal<readonly AutocompleteSuggestion[]>;
|
|
20
|
+
/** Called after an accepted suggestion's value is written to the text. */
|
|
21
|
+
onAccept?: (suggestion: AutocompleteSuggestion) => void;
|
|
22
|
+
/** The host is looking up suggestions. Pass it (also as false) to enable the empty message. */
|
|
23
|
+
loading?: MaybeSignal<boolean>;
|
|
24
|
+
loadingMessage?: string;
|
|
25
|
+
/** Accessible name of the suggestion list. */
|
|
26
|
+
listLabel?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Shown when `loading` is given and false, the text is not empty and there are no suggestions.
|
|
29
|
+
*/
|
|
30
|
+
emptyMessage?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
disabled?: MaybeSignal<boolean>;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
placeholder?: string;
|
|
35
|
+
className?: Props["className"];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A text field that offers host suggestions without constraining the text. Focus stays in the
|
|
39
|
+
* input; the list is a popup listbox driven by the arrow keys.
|
|
40
|
+
*/
|
|
41
|
+
export declare function Autocomplete({ id, value, defaultValue, onValueChange, suggestions, onAccept, loading, loadingMessage, listLabel, emptyMessage, name, disabled, required, placeholder, className, ref, ...props }: AutocompleteProps, context: Context<typeof Autocomplete>): import("meowjsx").VNode;
|
|
42
|
+
export declare namespace Autocomplete {
|
|
43
|
+
var meta: {
|
|
44
|
+
readonly name: "autocomplete";
|
|
45
|
+
readonly parts: readonly ["root", "input", "list", "option", "label", "description", "status"];
|
|
46
|
+
};
|
|
47
|
+
}
|