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/ASSISTANT.md
CHANGED
|
@@ -28,7 +28,7 @@ const view = (
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
The component takes a constrained height from its parent container; standard installation still needs `createMeowUI` and `standardTheme.cssText`, and does not depend on Rossovia's CSS or controller. Messages and the composer share one reading column, and the return-to-latest action anchors only to the message region. Activity appears beside the container when wide and becomes a single native modal dialog when narrow, without re-mounting messages and drafts.
|
|
31
|
-
The return-to-latest action
|
|
31
|
+
The return-to-latest action floats over the lower edge of the message viewport, so showing or hiding it never resizes the transcript or moves the reading position. While history is being read it may cover the bottom of one line; only the button itself takes the pointer, and the composer still has its own region.
|
|
32
32
|
|
|
33
33
|
A turn reads as the reader's question in a fill bubble and the reply as plain text, with no visible names or times; those stay in the message header for assistive technology. The composer is one rounded bar (attach, draft, trailing choices, send). Its history button gathers every question the reader asked into one column over the blurred transcript; choosing one closes the column and brings that turn to the top of the reading area without moving the host page, and Escape returns focus to the button. `history={false}` removes the button and column. A host `id` names the column for `aria-controls`.
|
|
34
34
|
|
|
@@ -47,7 +47,7 @@ A finished reply carries a quiet action row: Copy (built in; it copies the reply
|
|
|
47
47
|
|
|
48
48
|
## Content and local customization
|
|
49
49
|
|
|
50
|
-
Message `parts` include `text`, `code`, `process`, `attachments`, `tool`, and `task`. `text` is safe Markdown by default: raw HTML and images are shown as text, and only explicit HTTP, HTTPS, and mailto links navigate; code parts use the shared `CodeBlock`. Processes use native disclosure, and process steps take only normalized titles, descriptions, status text, and visual tone. A process may also carry `state` (the same execution states as tool and task parts): its header then shows the shared state badge after the title, with `statusText` as a quiet fact beside it. Whether the badge exists is fixed by the part's first value; later states update its tone and word in place. Without `state` the header shows the title and `statusText` alone.
|
|
50
|
+
Message `parts` include `text`, `code`, `process`, `attachments`, `tool`, and `task`. `text` is safe Markdown by default: raw HTML and images are shown as text, and only explicit HTTP, HTTPS, and mailto links navigate; code parts use the shared `CodeBlock`. Text renders through the shared `Markdown` blocks: while a message has `status: "streaming"`, its last text part completes half-typed markers in its open tail, and finished blocks are never rewritten, so a reader's selection in them survives. Fenced code in text is drawn with the same `CodeBlock` as code parts, with highlighting and copy. Processes use native disclosure, and process steps take only normalized titles, descriptions, status text, and visual tone. A process may also carry `state` (the same execution states as tool and task parts): its header then shows the shared state badge after the title, with `statusText` as a quiet fact beside it. Whether the badge exists is fixed by the part's first value; later states update its tone and word in place. Without `state` the header shows the title and `statusText` alone.
|
|
51
51
|
|
|
52
52
|
`renderPart` can replace just one part, and returning `undefined` uses the default implementation; `renderWorkDetail` replaces only the detail body. `composerTrailing` and `headerActions` hold local controls without replacing the whole page. Custom components still consume ancestor Context in the original render tree and do not create another renderer root.
|
|
53
53
|
|
package/AUTHORING.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Authoring components the Meowland way
|
|
2
|
+
|
|
3
|
+
This guide is for application authors who know shadcn/ui and Tailwind. It shows how to write a
|
|
4
|
+
component with MeowJSX, address its parts with MeowCSS, and use Meowtail's built-in theme values.
|
|
5
|
+
The worked examples have typechecked counterparts in
|
|
6
|
+
[tests/fixtures/authoring](tests/fixtures/authoring/), and
|
|
7
|
+
[authoring.test.tsx](tests/unit/theme/authoring.test.tsx) renders them and audits their styles.
|
|
8
|
+
|
|
9
|
+
Library contributors also follow [AGENTS.md](AGENTS.md).
|
|
10
|
+
|
|
11
|
+
## Step 0: use what exists
|
|
12
|
+
|
|
13
|
+
Most shadcn components already exist here with the same anatomy. Reach for these before writing
|
|
14
|
+
anything:
|
|
15
|
+
|
|
16
|
+
| shadcn/ui | Meowtail |
|
|
17
|
+
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
18
|
+
| Button | `Button` (`primary`, `outline`, `quiet`, `accent`, `danger`, `stop`), `IconButton` |
|
|
19
|
+
| Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, CardAction | the same names |
|
|
20
|
+
| Badge | `Badge`, `Tag`, `Pill` |
|
|
21
|
+
| Alert | `Alert` |
|
|
22
|
+
| Dialog, AlertDialog, Sheet | `Dialog`, `Modal`, `RiskConfirmation`, `Drawer` |
|
|
23
|
+
| Tabs, ToggleGroup | `Tabs`, `SegmentedControl`, `ChoiceGroup` |
|
|
24
|
+
| Input, Textarea, Select, Checkbox, Switch, Slider, Label + FormField | `Input`, `Textarea`, `Select` / `ChoiceSelect`, `Checkbox`, `Switch`, `Slider`, `Field`, `FieldGroup` |
|
|
25
|
+
| Tooltip, Popover, HoverCard | `Tooltip`, `Popover`, `HoverCard` |
|
|
26
|
+
| DropdownMenu, ContextMenu | `MenuButton`, `Menu`, `ContextMenu` |
|
|
27
|
+
| Separator, Skeleton, Avatar, Accordion, Table, Breadcrumb, Progress | the same names |
|
|
28
|
+
| Sonner / Toast | `Toast` |
|
|
29
|
+
| Sidebar | `NavList`, `IconRail` |
|
|
30
|
+
| Kbd, Spinner, AspectRatio, Empty | `ShortcutKeys`, `Spinner`, `AspectRatio`, `EmptyState` |
|
|
31
|
+
| `flex gap-*`, `grid grid-cols-*` | `Stack`, `Inline`, `Grid` with `gap="compact" \| "normal" \| "relaxed"` |
|
|
32
|
+
| `<p className="text-muted-foreground text-sm">` | `Text variant="secondary" \| "caption" \| "eyebrow"` |
|
|
33
|
+
| `prose` (typography plugin) | `Prose` |
|
|
34
|
+
|
|
35
|
+
Write a component when the library does not have its shape. Business components such as a plan
|
|
36
|
+
badge, a stat card or a settings row belong to the host.
|
|
37
|
+
|
|
38
|
+
## The translation
|
|
39
|
+
|
|
40
|
+
| shadcn + Tailwind | Meowland |
|
|
41
|
+
| --------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| A function component that re-renders | An ordinary function whose setup runs once per mount; bound Signals carry later updates |
|
|
43
|
+
| `data-slot="card-title"` | `meta.parts` and `ref={context.parts.title}` |
|
|
44
|
+
| `cva({ variants })` + `VariantProps` | `defineOptions` + `meta.style: defineStyleProps(...)`, `ThemedProps` and `options.when(...)` in CSS |
|
|
45
|
+
| Utility classes in `className` | `className={[ui.p.group, ui.bg.fill]}` or `cx(ui.p.group, ui.bg.fill)` |
|
|
46
|
+
| The Tailwind scale | Typed roles in `ui` and `uiTokens` |
|
|
47
|
+
| `dark:` variants | Color tokens carry light/dark pairs; nested scheme regions resolve their own values |
|
|
48
|
+
| `hover:`, `focus-visible:`, `disabled:` | Native CSS states and finite theme values that retain their state rules |
|
|
49
|
+
| `cn()` | Public `cx` from `meowcss`; stylesheet order and the CSS cascade decide conflicts |
|
|
50
|
+
| Radix primitives | Meowtail's behavior components; native elements first for a new primitive |
|
|
51
|
+
| Tailwind preflight | The standard theme's foundation within a Meowland region |
|
|
52
|
+
| A lint plugin for class names | `auditCSS(fragment, standardAuditRules)` checks painted values |
|
|
53
|
+
|
|
54
|
+
## Components and parts
|
|
55
|
+
|
|
56
|
+
A component is a function with static metadata. The second argument supplies that mount's lifecycle
|
|
57
|
+
and finite part bindings. Register the function itself; declaring metadata does not register it.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { h, type Context, type Props, type RefBinding } from "meowjsx";
|
|
61
|
+
import type {} from "meowjsx/web";
|
|
62
|
+
|
|
63
|
+
interface StatCardProps extends Props {
|
|
64
|
+
label: string;
|
|
65
|
+
value: string;
|
|
66
|
+
ref?: RefBinding<HTMLElement>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function StatCard(
|
|
70
|
+
{ label, value, children, ref, ...props }: StatCardProps,
|
|
71
|
+
context: Context<typeof StatCard>,
|
|
72
|
+
) {
|
|
73
|
+
return (
|
|
74
|
+
<section {...props} ref={[context.parts.root, ref]}>
|
|
75
|
+
<p ref={context.parts.label}>{label}</p>
|
|
76
|
+
<strong ref={context.parts.value}>{value}</strong>
|
|
77
|
+
<div ref={context.parts.delta}>{children}</div>
|
|
78
|
+
</section>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
StatCard.meta = {
|
|
82
|
+
name: "app-stat-card",
|
|
83
|
+
parts: ["root", "label", "value", "delta"],
|
|
84
|
+
} as const;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Part bindings preserve component identity and original props before mounting. They add no wrapper
|
|
88
|
+
or component instance. A ref array can also contain local callbacks, nested forwarded refs and
|
|
89
|
+
false/nullish omissions. Callbacks run in order, and their synchronous cleanups run in reverse order.
|
|
90
|
+
Static HTML reads part identity without invoking callbacks.
|
|
91
|
+
|
|
92
|
+
Setup still runs only once. Type a changing prop as `MaybeSignal<T>` and pass the Signal through to
|
|
93
|
+
its text, attribute or child binding. An event handler reads the live value with `unwrap` or
|
|
94
|
+
`.value`. A setup-time `unwrap` reads once and does not make a plain variable reactive.
|
|
95
|
+
|
|
96
|
+
## Wiring
|
|
97
|
+
|
|
98
|
+
Register the component families the host renders, and assemble its styles with the standard theme:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { createRuntime } from "meowjsx";
|
|
102
|
+
import { createMeowUI, meowUIComponents } from "meowtail";
|
|
103
|
+
import { extendStandardTheme } from "meowtail/theme";
|
|
104
|
+
import { mountStyles } from "meowcss/web";
|
|
105
|
+
import { PlanBadge } from "./plan-badge";
|
|
106
|
+
import { StatCard } from "./stat-card";
|
|
107
|
+
import { ListRow } from "./list-row";
|
|
108
|
+
|
|
109
|
+
const runtime = createRuntime({
|
|
110
|
+
plugins: [createMeowUI({ components: [...meowUIComponents, PlanBadge, StatCard, ListRow] })],
|
|
111
|
+
});
|
|
112
|
+
const appTheme = extendStandardTheme({
|
|
113
|
+
styles: [planBadgeStyles, statCardStyles, listRowStyles],
|
|
114
|
+
});
|
|
115
|
+
const removeStyles = mountStyles(document, appTheme.cssText);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For a small host, pass a narrow list such as `[Button, PlanBadge]` instead of the complete
|
|
119
|
+
`meowUIComponents` catalog. The selective factory does not import the complete catalog or its
|
|
120
|
+
optional engines. Register nested component families that the composition renders as well.
|
|
121
|
+
|
|
122
|
+
Prefix host metadata names (`app-badge`, for example). The registry layers by name, so registering
|
|
123
|
+
a host component as `card` replaces the library identity with that name. Install one style-props
|
|
124
|
+
adapter through `createMeowUI`; a separate runtime plugin can also list component functions.
|
|
125
|
+
|
|
126
|
+
`extendStandardTheme` keeps the foundation first, standard component rules before host fragments,
|
|
127
|
+
and the shared utility sheet last. Part descriptors use zero-specificity selectors; complete rules
|
|
128
|
+
retain their ordinary specificity. Class order in `cx` does not override stylesheet order.
|
|
129
|
+
|
|
130
|
+
## Class values and theme rules
|
|
131
|
+
|
|
132
|
+
`ui` is Meowtail's built-in catalog. A value carries both a CSS class and its declarations, so it
|
|
133
|
+
works on an instance and inside a theme rule:
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { cx } from "meowcss";
|
|
137
|
+
import { ui } from "meowtail/theme";
|
|
138
|
+
|
|
139
|
+
const panel = cx(ui.p.panel, ui.bg.raised, ui.radius.xl);
|
|
140
|
+
<div className={["host-panel", panel]} />;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import type { StatCard } from "./stat-card";
|
|
145
|
+
import { css, parts } from "meowcss/meowjsx";
|
|
146
|
+
import { cx } from "meowcss";
|
|
147
|
+
import { ui, uiTokens } from "meowtail/theme";
|
|
148
|
+
|
|
149
|
+
const card = parts<typeof StatCard>("app-stat-card");
|
|
150
|
+
export const statCardStyles = css`
|
|
151
|
+
${card.root} {
|
|
152
|
+
${cx(ui.surface.raised, ui.p.panel)}
|
|
153
|
+
display: grid;
|
|
154
|
+
gap: ${uiTokens.space.group};
|
|
155
|
+
}
|
|
156
|
+
${card.label} {
|
|
157
|
+
${ui.text.eyebrow}
|
|
158
|
+
margin: 0;
|
|
159
|
+
}
|
|
160
|
+
${card.value} {
|
|
161
|
+
${ui.text.title}
|
|
162
|
+
font-variant-numeric: tabular-nums;
|
|
163
|
+
}
|
|
164
|
+
${card.delta} {
|
|
165
|
+
${ui.text.caption}
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The theme imports only the component's type. `parts<typeof StatCard>("app-stat-card")` checks the
|
|
171
|
+
name and available members without loading that component's implementation. Within a `cx` composite,
|
|
172
|
+
values from one catalog expand in that catalog's stylesheet order. Separate CSS interpolations keep
|
|
173
|
+
ordinary CSS order. A plain external class string has no declarations, so a composite containing one
|
|
174
|
+
cannot be expanded inside a rule.
|
|
175
|
+
|
|
176
|
+
Class lists preserve order and omit `false`, `null`, `undefined` and empty strings. Lists can be
|
|
177
|
+
nested and can contain Signals. Use `cx` when a reusable composite should also retain declarations.
|
|
178
|
+
Keep hover, focus, disabled, responsive rules and one-off geometry in CSS; no condition language or
|
|
179
|
+
source scanning is needed.
|
|
180
|
+
|
|
181
|
+
## Options with variants
|
|
182
|
+
|
|
183
|
+
Components and themes share an options object from a module that imports neither implementation nor
|
|
184
|
+
assembled theme:
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
// plan-badge.options.ts
|
|
188
|
+
import { defineOptions } from "meowcss";
|
|
189
|
+
export const planBadgeOptions = defineOptions("app-plan-badge", {
|
|
190
|
+
tone: ["free", "pro", "trial"],
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
// plan-badge.tsx
|
|
196
|
+
import { h, type Context, type Props } from "meowjsx";
|
|
197
|
+
import { defineStyleProps, type ThemedProps } from "meowcss/meowjsx";
|
|
198
|
+
import { planBadgeOptions } from "./plan-badge.options";
|
|
199
|
+
|
|
200
|
+
interface PlanBadgeProps extends Props, ThemedProps<typeof planBadgeOptions> {}
|
|
201
|
+
|
|
202
|
+
export function PlanBadge({ ref, ...props }: PlanBadgeProps, context: Context<typeof PlanBadge>) {
|
|
203
|
+
return <span {...props} ref={[context.parts.root, ref]} />;
|
|
204
|
+
}
|
|
205
|
+
PlanBadge.meta = {
|
|
206
|
+
name: "app-plan-badge",
|
|
207
|
+
parts: ["root"],
|
|
208
|
+
style: defineStyleProps(planBadgeOptions, { defaults: { tone: "free" } }),
|
|
209
|
+
} as const;
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
// plan-badge.styles.ts
|
|
214
|
+
import type { PlanBadge } from "./plan-badge";
|
|
215
|
+
import { css, parts } from "meowcss/meowjsx";
|
|
216
|
+
import { ui, uiTokens } from "meowtail/theme";
|
|
217
|
+
import { planBadgeOptions } from "./plan-badge.options";
|
|
218
|
+
|
|
219
|
+
const badge = parts<typeof PlanBadge>("app-plan-badge");
|
|
220
|
+
export const planBadgeStyles = css`
|
|
221
|
+
${badge.root} {
|
|
222
|
+
${ui.text.caption}
|
|
223
|
+
display: inline-flex;
|
|
224
|
+
padding: 2px ${uiTokens.space.group};
|
|
225
|
+
border-radius: ${uiTokens.radius.sm};
|
|
226
|
+
${planBadgeOptions.when({ tone: "pro" })} {
|
|
227
|
+
background: ${uiTokens.action.primary};
|
|
228
|
+
color: ${uiTokens.action.onPrimary};
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
`;
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`<PlanBadge tone="pro">` carries `data-option-app-plan-badge-tone="pro"`; the adapter consumes the
|
|
235
|
+
`tone` prop. `defineStyleProps` validates defaults, and registration validates that carrier parts
|
|
236
|
+
exist. Token assembly rejects conflicting definitions for the same option attribute. It does not
|
|
237
|
+
compare the component with an independently authored theme schema; share the options object.
|
|
238
|
+
|
|
239
|
+
## The floor
|
|
240
|
+
|
|
241
|
+
The foundation gives a Meowland region border-box sizing, contained media, a mono code face,
|
|
242
|
+
inherited control type and shared focus defaults. It does not reset headings, lists or margins.
|
|
243
|
+
Use `Text` for copy and `Prose` for reading content.
|
|
244
|
+
|
|
245
|
+
Theme values keep materials, typography and state behavior on the existing token roles. A part's
|
|
246
|
+
geometry stays beside that selector, where its exceptions can be reviewed. Dark colors resolve at
|
|
247
|
+
the nearest scheme region without rebuilding component instances.
|
|
248
|
+
|
|
249
|
+
Audit application fragments with the same rules as the standard theme:
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import { auditCSS } from "meowcss";
|
|
253
|
+
import { standardAuditRules } from "meowtail/theme";
|
|
254
|
+
|
|
255
|
+
test("app styles stay on the standard scales", () => {
|
|
256
|
+
for (const fragment of appStyles) expect(auditCSS(fragment, standardAuditRules)).toEqual([]);
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The audit reports literal colors, durations, type sizes, line heights, weights and radii with their
|
|
261
|
+
selector and line. Token references, derived lengths, masks, `0` and `50%` pass. Accept a deliberate
|
|
262
|
+
exception through `allow` and keep its reason beside it. Spacing is not audited: part geometry can
|
|
263
|
+
use off-ramp lengths.
|
|
264
|
+
|
|
265
|
+
Icons follow [Which icon where](src/icons/README.md#which-icon-where). Each intent has one icon;
|
|
266
|
+
leading icons name the type, trailing icons name an action, and state uses the shared status marker.
|
|
267
|
+
Check a new composition in the real component scene, including focus, disabled state, a narrow
|
|
268
|
+
viewport and both themes. Type and audit checks do not establish those observations.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,121 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- `createMeowUITheme({ theme, config })` from `meowtail/web` is a runtime plugin that delivers a
|
|
6
|
+
theme to every Web mount: the stylesheet (shared per document through `meowcss/web`
|
|
7
|
+
`mountStyles`), the theme attributes on the container and the focus-modality tracker, all
|
|
8
|
+
released by `unmount()`. A browser page is now `createMeowUI` plus `createMeowUITheme` in one
|
|
9
|
+
`plugins` list and MeowJSX's `render`. It is built on MeowJSX's new `prepareContainer` plugin hook,
|
|
10
|
+
refuses a second themed mount into one container and containers inside a shadow root, and stays
|
|
11
|
+
out of bundles that only register components. By default it also owns the page: the document
|
|
12
|
+
element takes the theme's canvas and CSS `color-scheme`, so a dark scheme no longer renders light
|
|
13
|
+
text on a white page; `page: false` leaves an embedded region's ground to its host. See the
|
|
14
|
+
[design](../../docs/designs/2026-11-03-theme-delivery-plugin.md).
|
|
15
|
+
|
|
16
|
+
- The package ships `AUTHORING.md`, which the README links as the guide for host components; an
|
|
17
|
+
agent or author can read it from `node_modules/meowtail` at the installed version.
|
|
18
|
+
|
|
19
|
+
- `HoverCard` copy feedback no longer covers the card. On success the copy cue turns into a check and
|
|
20
|
+
`copiedLabel` for 1.5 seconds; on failure the message takes its own line under the content and
|
|
21
|
+
stays until the next attempt or the card closes. The `feedback` part stays the live status, and
|
|
22
|
+
is visible only for a failure.
|
|
23
|
+
|
|
24
|
+
- A `HoverCard` with `copyText` shows a copy cue (the `copy` icon and `copyLabel`) at the end of its
|
|
25
|
+
first line, so a reader can see that a click or tap copies. The cue is hidden from assistive
|
|
26
|
+
technology; the card's accessible name already says `Copy: <text>`. New parts: `body` wraps the
|
|
27
|
+
host content and `hint` is the cue; a card without `copyText` renders as before.
|
|
28
|
+
|
|
29
|
+
- `Popover` answers a resize of its pane or anchor on the next animation frame and fits the pane in
|
|
30
|
+
whole pixels. A pane squeezed by a short viewport no longer refits itself inside its own
|
|
31
|
+
ResizeObserver callback, which the browser reported as a ResizeObserver loop error while a
|
|
32
|
+
phone's press animation moved the trigger by fractions of a pixel.
|
|
33
|
+
|
|
34
|
+
- The `HoverCard` `preview` variant pads its content like the compact card instead of leaving the
|
|
35
|
+
text against the card edges, and a host narrower than 480px gets no 24px side inset, so on a phone
|
|
36
|
+
the card lines up with the host instead of shifting right of the trigger.
|
|
37
|
+
|
|
38
|
+
- `HoverCard` works on touch: a tap opens the card and it stays open after the finger lifts (iOS
|
|
39
|
+
Safari closed it within 120 ms because the lifted touch counted as the pointer leaving). A second
|
|
40
|
+
tap on the trigger, an outside tap or Escape closes it.
|
|
41
|
+
|
|
42
|
+
- `PathLabel` elides the start of the directory with an ellipsis instead of fading it under a mask,
|
|
43
|
+
and keeps the whole file name until the name alone is wider than the slot, where it ends in an
|
|
44
|
+
ellipsis. The `data-path-clipped` attribute and its resize observer are gone.
|
|
45
|
+
|
|
46
|
+
- `HoverCard`, `ShortcutKeys` and `StateDot` each have their own story (`hover-card`,
|
|
47
|
+
`shortcut-keys`, `state-dot`); `reference-primitives` now shows `PathLabel` alone.
|
|
48
|
+
|
|
49
|
+
- NavList group titles read as navigation headings: sentence case at `type.caption`, weight 600,
|
|
50
|
+
primary ink, instead of the small-caps label. Menu and ChoiceSelect group headings keep the
|
|
51
|
+
small-caps label.
|
|
52
|
+
|
|
53
|
+
- `SearchInput` draws the native clear button in the theme (the close glyph at `icon.small` in
|
|
54
|
+
tertiary ink, darker on hover) instead of the browser's default control.
|
|
55
|
+
|
|
56
|
+
- Stories follow one metadata convention (AGENTS.md, "Story metadata"): the catalog category as
|
|
57
|
+
`group`, a fixed `groupOrder`, the documented export as `component`, and `<Name> · <Scenario>`
|
|
58
|
+
titles. `COMPONENTS.md` family tables list `Components` and `Parts` separately.
|
|
59
|
+
|
|
60
|
+
- Polish `CodeBlock`: the header names the language (`ts` reads TypeScript; `codeLanguageName`
|
|
61
|
+
exposes the mapping), soft wrap and copy are compact icon buttons, a successful copy shows a check
|
|
62
|
+
and is announced without adding a line, and a failure shows one danger line aligned with the code.
|
|
63
|
+
Header text and code share one start edge with a tighter gap, and wide host actions wrap to their
|
|
64
|
+
own row on narrow surfaces. Streamed code keeps its last highlight instead of flashing back to
|
|
65
|
+
plain text. Add the `text-wrap` semantic icon.
|
|
66
|
+
|
|
67
|
+
- Add `Markdown`, the public form of the Assistant's safe Markdown renderer, with
|
|
68
|
+
`repairMarkdownTail`, `markdownBlocks`, `renderMarkdown` and `safeMarkdownLink`. Text renders
|
|
69
|
+
block by block, so streamed chunks no longer rewrite finished blocks or drop a selection in them;
|
|
70
|
+
`streaming` hides half-typed markers in the open tail, and `renderCode` can draw fences with
|
|
71
|
+
`CodeBlock`. The Assistant's text uses the same renderer and repairs the tail of the part a
|
|
72
|
+
streaming message is still writing. Fenced code in Assistant text now uses the shared
|
|
73
|
+
`CodeBlock`, like code parts.
|
|
74
|
+
|
|
75
|
+
- Add `Autocomplete` (suggestions for free text), `TokenField` (several values entered as
|
|
76
|
+
host-resolved tokens), `TreeView` (hierarchy with the tree keyboard model), `CommandPalette`
|
|
77
|
+
(search and run host commands), `Form` (native validation, busy, outcome and actions) and
|
|
78
|
+
`Chart` (bar and line charts with a legend, keyboard readout and data table), with
|
|
79
|
+
`commandMatches`, `admitSeries`, `niceTicks`, `chartSeriesLimit` and `treeViewLevel`. The
|
|
80
|
+
contracts are in the selected-targets design.
|
|
81
|
+
|
|
82
|
+
- Add `Pagination` (L1) and `paginationEntries`: Previous/Next with numbered pages and gaps for a
|
|
83
|
+
known total, or the page fact and a host `hasNext` for an unknown one. The host owns the page,
|
|
84
|
+
loading and records; `busy` and boundaries keep focus on the control.
|
|
85
|
+
|
|
86
|
+
- The invalid-field focus halo selects its focus states with `:where()` instead of `:is()`, so a
|
|
87
|
+
bundler writes no legacy `:-moz-any()` copy that iOS Safari would match on any focused container.
|
|
88
|
+
|
|
89
|
+
- Add the `meowtail/web` entry with `installFocusModality(document)` and `focusModalityScript`.
|
|
90
|
+
They record whether the last input was a pointer or a key, and after a pointer the theme hides
|
|
91
|
+
outline focus rings until the next keystroke, so Safari no longer rings what a script focused
|
|
92
|
+
after a tap. Text entry keeps its focus state. Without the tracker, rings follow `:focus-visible`
|
|
93
|
+
as before. The theme root also turns off the browser's tap highlight; Button and the chat record
|
|
94
|
+
parts no longer set it themselves.
|
|
95
|
+
|
|
96
|
+
- Remove the `DoodleCat` illustration and its public export.
|
|
97
|
+
|
|
98
|
+
- Add `journalTheme`, a second concrete theme for blogs and long-form reading, assembled from the
|
|
99
|
+
standard rules with Journal values for the same `ui` roles. Export `journalUiTokenValues`,
|
|
100
|
+
`journalUiTokens`, `journalThemeTokens`, `standardUiTokenValues` and the `UiTokenValues` /
|
|
101
|
+
`TokenValues` types so a theme values every role and nothing else.
|
|
102
|
+
- Add `uiTokens.type.display`, `type.reading`, `type.readingSize`, `type.weight.display`,
|
|
103
|
+
`type.quoteStyle` and `ink.reading`. Titles and Prose headings use `display` at `weight.display`;
|
|
104
|
+
Prose copy and `ui.text.reading` use `reading` at `readingSize`; Prose copy takes `ink.reading` under
|
|
105
|
+
`ink.primary` headings, and quotations take `quoteStyle`. The standard values are the UI face, the
|
|
106
|
+
body size, `semibold`, `ink.primary` and `normal`, so the standard theme renders as before; this
|
|
107
|
+
reverses the earlier removal of `type.display` only as a theme role, not as a standard serif.
|
|
108
|
+
- Add `EntryList` and `Entry` (L1) for content entries such as posts, notes and releases: a kicker,
|
|
109
|
+
a heading that can link to the entry, a standfirst and its facts, separated by hairlines on the
|
|
110
|
+
surrounding surface. An Entry is a list item in an EntryList and an article alone, and its heading
|
|
111
|
+
level follows the region. `size="feature"` marks the lead entry.
|
|
112
|
+
- Add `meowTheme`, a red-and-black recolor of the standard theme after the Meowland mark: black
|
|
113
|
+
ink, actions and inverse surfaces with one red accent. Only colors differ from the standard values.
|
|
114
|
+
Export `meowUiTokenValues`, `meowUiTokens` and `meowThemeTokens`.
|
|
115
|
+
- The Meowbook gallery's Theme control switches every story between Standard, Journal and Meow.
|
|
116
|
+
- Add `journalFonts` and the `ThemeFont` type: the Fontsource packages that carry the faces Journal
|
|
117
|
+
names. Meowtail ships no font files. The gallery paints Journal stories with those faces.
|
|
118
|
+
|
|
3
119
|
## 0.3.0-alpha.0
|
|
4
120
|
|
|
5
121
|
Local breaking authoring candidate; no npm release is implied. It includes the previous unreleased
|