@vokality/design-system 3.0.0 → 3.0.1
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@vokality/design-system`. The package follows [semantic versioning](https://semver.org); see CONTRIBUTING.md for what counts as breaking.
|
|
4
4
|
|
|
5
|
+
## 3.0.1 — 2026-10-17
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- A bundled `vokality-design-system` Agent Skill with version-matched guidance for composing the existing React components, Radix contracts, tokens, localization, Markdown editing, chat and reduced motion.
|
|
9
|
+
- An explicit `vokality-skill` command to link the installed skill into a consuming project’s `.agents/skills` directory without overwriting existing skills. Package installation does not register skills automatically.
|
|
10
|
+
- Packed-package checks for the skill, its referenced documentation and typed usage examples, plus setup, upgrade and collision handling.
|
|
11
|
+
|
|
5
12
|
## 3.0.0 — 2026-10-17
|
|
6
13
|
|
|
7
14
|
### Added
|
package/README.md
CHANGED
|
@@ -169,6 +169,20 @@ The design guide and every component's page ship with the package, so they match
|
|
|
169
169
|
- `node_modules/@vokality/design-system/docs/brand.md`: principles, color, type, layout, writing.
|
|
170
170
|
- `node_modules/@vokality/design-system/docs/components/<Name>/README.md`: anatomy, states, props, accessibility and rules for each component.
|
|
171
171
|
|
|
172
|
+
## Agent skill
|
|
173
|
+
|
|
174
|
+
The package includes a standard [Agent Skill](https://agentskills.io/specification) with version-matched integration guidance. After installing the package, run this **once from your consuming project root** to register it for Codex:
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
bun run vokality-skill
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The opt-in command creates `.agents/skills/vokality-design-system` as a link to the installed package’s `skills/vokality-design-system` directory. It follows the logical `node_modules` path, including hoisted workspace dependencies, so package upgrades update the guidance without copying it. Use `bun run vokality-skill --project <project-root>` to select a project explicitly. Existing files or other skills are never replaced. Installation itself runs no skill setup and changes no agent instructions.
|
|
181
|
+
|
|
182
|
+
Codex supports [project-local and symlinked skills](https://learn.chatgpt.com/docs/build-skills). It can select this skill when relevant, or you can invoke `$vokality-design-system`. For another Agent Skills-compatible tool, register the same bundled folder using that tool’s documented discovery location. The skill points to the shipped component docs, tokens and declarations; those remain the API source of truth. It does not install checks or enforce application code automatically.
|
|
183
|
+
|
|
184
|
+
On Unix, the relative link can be committed when the team shares the dependency layout. On Windows the command uses a directory junction; keep that machine-local path untracked. Remove the link to unregister the skill; do not remove its target in `node_modules`.
|
|
185
|
+
|
|
172
186
|
## Develop
|
|
173
187
|
|
|
174
188
|
```sh
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { access, lstat, mkdir, readFile, readlink, realpath, symlink } from "node:fs/promises";
|
|
3
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
const skillName = "vokality-design-system";
|
|
6
|
+
const usage = "Usage: vokality-skill [--project <project-root>]\nLinks the installed package skill into .agents/skills/vokality-design-system.\nRun explicitly from a project with package.json; existing skills are never replaced.";
|
|
7
|
+
|
|
8
|
+
async function installedSkill(project) {
|
|
9
|
+
for (let directory = project; ; directory = dirname(directory)) {
|
|
10
|
+
const packageRoot = join(directory, "node_modules", "@vokality", "design-system");
|
|
11
|
+
let manifest;
|
|
12
|
+
try {
|
|
13
|
+
manifest = JSON.parse(await readFile(join(packageRoot, "package.json"), "utf8"));
|
|
14
|
+
} catch (error) {
|
|
15
|
+
if (error.code !== "ENOENT") throw error;
|
|
16
|
+
if (dirname(directory) === directory) break;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (manifest?.name !== "@vokality/design-system" || typeof manifest.version !== "string") {
|
|
20
|
+
throw new Error(`Invalid design-system package at ${packageRoot}`);
|
|
21
|
+
}
|
|
22
|
+
const target = join(packageRoot, "skills", skillName);
|
|
23
|
+
await access(join(target, "SKILL.md")).catch(() => {
|
|
24
|
+
throw new Error(`The installed @vokality/design-system@${manifest.version} has no bundled skill. Upgrade the package first.`);
|
|
25
|
+
});
|
|
26
|
+
return { target, version: manifest.version };
|
|
27
|
+
}
|
|
28
|
+
throw new Error("Install @vokality/design-system in this project before linking its skill.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function main() {
|
|
32
|
+
const args = process.argv.slice(2);
|
|
33
|
+
if (args.length === 1 && ["--help", "-h"].includes(args[0])) {
|
|
34
|
+
console.log(usage);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (args.length !== 0 && (args.length !== 2 || args[0] !== "--project" || !args[1] || args[1].startsWith("--"))) {
|
|
38
|
+
throw new Error(usage);
|
|
39
|
+
}
|
|
40
|
+
const project = resolve(args[1] ?? process.cwd());
|
|
41
|
+
await access(join(project, "package.json")).catch(() => {
|
|
42
|
+
throw new Error(`No package.json at ${project}. Run from the project root or pass --project <project-root>.`);
|
|
43
|
+
});
|
|
44
|
+
const { target, version } = await installedSkill(project);
|
|
45
|
+
const destination = join(project, ".agents", "skills", skillName);
|
|
46
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
47
|
+
const physicalParent = await realpath(dirname(destination));
|
|
48
|
+
const existing = await lstat(destination).catch((error) => {
|
|
49
|
+
if (error.code === "ENOENT") return null;
|
|
50
|
+
throw error;
|
|
51
|
+
});
|
|
52
|
+
if (existing) {
|
|
53
|
+
if (!existing.isSymbolicLink() || resolve(physicalParent, await readlink(destination)) !== target) {
|
|
54
|
+
throw new Error(`A different skill already exists at ${destination}. Move it yourself before linking; nothing was replaced.`);
|
|
55
|
+
}
|
|
56
|
+
console.log(`Already linked @vokality/design-system@${version}: ${destination}`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// Keep the logical node_modules path: package-manager store paths change on upgrades.
|
|
60
|
+
const linkTarget = process.platform === "win32" ? target : relative(physicalParent, target);
|
|
61
|
+
await symlink(linkTarget, destination, process.platform === "win32" ? "junction" : "dir");
|
|
62
|
+
console.log(`Linked @vokality/design-system@${version}: ${destination}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main().catch((error) => {
|
|
66
|
+
console.error(error.message);
|
|
67
|
+
process.exitCode = 1;
|
|
68
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vokality/design-system",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Vokality's design system: tokens, themes and React components for every Vokality project.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"private": false,
|
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
"README.md",
|
|
50
50
|
"CHANGELOG.md",
|
|
51
51
|
"docs/brand.md",
|
|
52
|
-
"docs/components/*/README.md"
|
|
52
|
+
"docs/components/*/README.md",
|
|
53
|
+
"skills",
|
|
54
|
+
"bin/vokality-skill.mjs"
|
|
53
55
|
],
|
|
54
56
|
"sideEffects": [
|
|
55
57
|
"*.css"
|
|
@@ -118,5 +120,8 @@
|
|
|
118
120
|
"prosemirror-state": "1.4.4",
|
|
119
121
|
"prosemirror-view": "1.42.6",
|
|
120
122
|
"radix-ui": "1.8.0"
|
|
123
|
+
},
|
|
124
|
+
"bin": {
|
|
125
|
+
"vokality-skill": "./bin/vokality-skill.mjs"
|
|
121
126
|
}
|
|
122
127
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vokality-design-system
|
|
3
|
+
description: Build and update Vokality interfaces with the installed @vokality/design-system package. Use for component selection, layouts, forms, themes, localization, rich-text editing, and chat surfaces in projects using this package or explicitly requesting Vokality styling.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vokality design system
|
|
7
|
+
|
|
8
|
+
Use the installed package's components and visual language within the user's requested scope. Keep the application's framework, router, data ownership, and existing conventions unless the task requires changing them.
|
|
9
|
+
|
|
10
|
+
## Start with the installed contract
|
|
11
|
+
|
|
12
|
+
If this skill was registered through a symlink, resolve its physical directory in the installed package before following relative links. The `../../README.md` and `../../docs/` paths below are relative to that real skill directory, not the application's `.agents/skills` directory.
|
|
13
|
+
|
|
14
|
+
1. Read the relevant sections of the [package README](../../README.md) and [brand guide](../../docs/brand.md).
|
|
15
|
+
2. Find the component in the README, then read its `../../docs/components/ComponentName/README.md`. Check the installed public declarations for exact props and ref types before coding; component-specific contracts take precedence over broad descriptions in the brand guide.
|
|
16
|
+
3. Compose existing components before creating a new control. Use `Stack`, `Inline`, and `Grid` for layout; `Heading` and `Text` for interface copy; `Prose` for rendered long-form content. Use semantic `as` elements where appropriate.
|
|
17
|
+
|
|
18
|
+
Do not deep-import `src/` or `dist/`, invent props from another component library, or add a parallel UI kit to implement an existing component. The examples in [references/examples.tsx](references/examples.tsx) compile against the public package API; read them when implementing forms, Markdown editing, or conversations.
|
|
19
|
+
|
|
20
|
+
## Imports and presentation
|
|
21
|
+
|
|
22
|
+
- Import `@vokality/design-system/vokality.css` once at the application's stylesheet entry. Core components and their prop types come from `@vokality/design-system`.
|
|
23
|
+
- Use the direct entrypoints `@vokality/design-system/localization`, `@vokality/design-system/rich-text`, `@vokality/design-system/chat-widget`, `@vokality/design-system/chat-inbox`, and `@vokality/design-system/chat-models` for those features. Keep type imports explicit. These features are not root exports.
|
|
24
|
+
- Use existing tokens such as `var(--background)`, `var(--foreground)`, `var(--primary)`, `var(--border-subtle)`, and `var(--space-lg)` for application CSS. Prefer component variants and layout props over overriding internal selectors. Corners are square, surfaces have thin outlines, and orange identifies the primary action or selection. Avoid decorative shadows and gradients.
|
|
25
|
+
- Write labels in sentence case; styles provide uppercase presentation. Use the supplied icons and accessible labels. User-authored emoji belong in rich text; interface copy follows the brand guide.
|
|
26
|
+
- Preserve the current theme preference. Themes are `dark`, `light`, and `contrast` through `data-theme`; compact density uses `data-density="compact"`. Put attributes on `html` when portalled content must inherit them. Use [ThemeScript and useTheme](../../docs/components/ThemeScript/README.md) when adding theme switching, with matching options for server initialization and client changes.
|
|
27
|
+
- In Tailwind v4 applications, follow the README's stylesheet order and token mapping. Do not introduce Tailwind or replace the application's styling setup merely to use the package.
|
|
28
|
+
|
|
29
|
+
## Behavior, forms, and React
|
|
30
|
+
|
|
31
|
+
The fully supplied Radix controls already own keyboard interaction, focus, selection, dismissal, gestures, timers, and native form integration. Compose and style them through their public props. Do not add a second keyboard/focus engine, synthetic input-event targets, or wrapper-owned default-selection policy. Composite controls such as `Combobox` and `DatePicker` already compose their required behavior too; use their documented APIs.
|
|
32
|
+
|
|
33
|
+
- [Checkbox](../../docs/components/Checkbox/README.md) uses `onCheckedChange(boolean | "indeterminate")`; [Switch](../../docs/components/Switch/README.md) uses `onCheckedChange(boolean)`. Their refs and DOM callbacks target buttons, not native checkbox inputs. Map state explicitly only when the application's domain requires it.
|
|
34
|
+
- [RadioGroup](../../docs/components/RadioGroup/README.md) uses `onValueChange(string)`, `Select` uses `onChange(value, option)`, and `SegmentedControl` uses `onChange(value)`. Supply `value` or `defaultValue` when selection is intended. Native `Input` and standalone `Radio` keep native input events.
|
|
35
|
+
- [Field](../../docs/components/Field/README.md) labels one control and wires its ID, hint, and error attributes. Checkbox and Switch provide their own labels; RadioGroup provides a legend. Give form controls names and use their documented `required` and `disabled` props. Submit through the form's native event and `FormData`; a save action needs `type="submit"` because `Button` defaults to `button`.
|
|
36
|
+
- Choose controlled `value` plus its change callback, or uncontrolled `defaultValue`; do not synchronize both through an effect. Keep handlers and stateful composition in the framework's client boundary. Preserve React 18.2+ compatibility, server-safe rendering, and actual DOM ref types. Do not access browser globals or read/write refs during render.
|
|
37
|
+
- For server-rendered Calendar/DatePicker output, pass the same explicit `today` value on server and client when their day or time zone may differ. Read the component docs for date-string and locale contracts.
|
|
38
|
+
|
|
39
|
+
## Locale and content ownership
|
|
40
|
+
|
|
41
|
+
Use [LocaleProvider](../../docs/components/LocaleProvider/README.md) from the localization entrypoint for built-in labels and formatting. It supports scoped, typed message overrides and reaches portals. Explicit label props remain application copy. Keep placeholders, custom emoji labels, and server-provided content in the application's language. Use the exported formatting helpers rather than constructing localized number or date strings by hand.
|
|
42
|
+
|
|
43
|
+
For [RichTextEditor](../../docs/components/RichTextEditor/README.md), store a CommonMark Markdown string. `value`/`onChange` are Markdown, not HTML or editor JSON; serialization may normalize equivalent syntax. Use `toolbar="minimal"` for a small writing-first composer when appropriate. The application owns persistence and rendering saved Markdown; `Prose` supplies reading styles, not a parser.
|
|
44
|
+
|
|
45
|
+
Attachments are opt-in through `onUploadAttachment(file, { signal })`, returning a durable `{ name, url }`. Reuse the application's upload service, validate unknown responses at that service boundary, honor cancellation, and enforce upload policy on the server. The editor handles upload feedback, cancel/retry, safe URL checks, and Markdown links. Removing a link does not delete its server asset. Use `onUploadPendingChange` when an external send action must wait for uploads.
|
|
46
|
+
|
|
47
|
+
For [ChatWidget](../../docs/components/ChatWidget/README.md) and [ChatInbox](../../docs/components/ChatInbox/README.md), supply typed `ChatMessage`/`ChatThread` data with stable IDs. Message `content` is a render-ready React node; a string displays as text. Use the application's established safe Markdown renderer if formatted incoming content is needed. The composer emits Markdown.
|
|
48
|
+
|
|
49
|
+
`composer.onSend` synchronously accepts a draft; the application owns async transport, streaming, pending/error state, retry callbacks, and persistence. An uncontrolled draft clears after normal callback return. Clear a controlled draft explicitly after application acceptance. Inbox selection is controlled, Back emits `null`, and switching threads resets uncontrolled drafts and cancels pending uploads. Keep controlled drafts by thread ID if navigation must preserve them. Do not invent an AI backend or upload endpoint for a presentation task.
|
|
50
|
+
|
|
51
|
+
## Motion and verification
|
|
52
|
+
|
|
53
|
+
Keep the package's existing motion and reduced-motion handling. Chat already uses Motion for panel entry/exit and newly added messages while Radix retains interaction ownership. Avoid animating existing history, stacking a second transition on an overlay, or adding timers to retain content. Any requested application motion should be brief and stop under reduced motion.
|
|
54
|
+
|
|
55
|
+
Run the host application's relevant type, lint, and behavioral checks. Verify changed UI at its narrow container size and with long real content, keyboard focus, disabled/loading/error states, and the themes or density affected by the task. Check portalled content and short viewport containment when changing overlays. Keep verification proportional to the change; do not expand a component task into an application rewrite.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Button, Checkbox, Field, Input, RadioGroup, Stack, Switch } from "@vokality/design-system";
|
|
5
|
+
import { LocaleProvider } from "@vokality/design-system/localization";
|
|
6
|
+
import { RichTextEditor } from "@vokality/design-system/rich-text";
|
|
7
|
+
import type { RichTextUpload } from "@vokality/design-system/rich-text";
|
|
8
|
+
import { ChatWidget } from "@vokality/design-system/chat-widget";
|
|
9
|
+
import { ChatInbox } from "@vokality/design-system/chat-inbox";
|
|
10
|
+
import type { ChatComposerOptions, ChatMessage, ChatThread } from "@vokality/design-system/chat-models";
|
|
11
|
+
|
|
12
|
+
// Import @vokality/design-system/vokality.css once in the application entry.
|
|
13
|
+
// Upload and persistence callbacks below belong to the application, not the UI.
|
|
14
|
+
interface NotesFormProps {
|
|
15
|
+
initialMarkdown: string;
|
|
16
|
+
uploadAttachment?: RichTextUpload;
|
|
17
|
+
onSave: (data: FormData) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function NotesForm({ initialMarkdown, uploadAttachment, onSave }: NotesFormProps) {
|
|
21
|
+
const [markdown, setMarkdown] = useState(initialMarkdown);
|
|
22
|
+
const [notify, setNotify] = useState(false);
|
|
23
|
+
const [uploadPending, setUploadPending] = useState(false);
|
|
24
|
+
return (
|
|
25
|
+
<LocaleProvider locale="en-US">
|
|
26
|
+
<Stack as="form" gap="lg" onSubmit={(event) => {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
if (uploadPending) return;
|
|
29
|
+
onSave(new FormData(event.currentTarget));
|
|
30
|
+
}}>
|
|
31
|
+
<Field label="Subject">
|
|
32
|
+
<Input name="subject" required />
|
|
33
|
+
</Field>
|
|
34
|
+
<Field label="Notes" hint="Formatting and attachments are saved as Markdown.">
|
|
35
|
+
<RichTextEditor name="notes" value={markdown} onChange={setMarkdown} onUploadAttachment={uploadAttachment} onUploadPendingChange={setUploadPending} />
|
|
36
|
+
</Field>
|
|
37
|
+
<RadioGroup label="Visibility" name="visibility" defaultValue="team" options={[
|
|
38
|
+
{ value: "team", label: "Team" },
|
|
39
|
+
{ value: "private", label: "Only me" },
|
|
40
|
+
]} />
|
|
41
|
+
<Checkbox label="Notify the team" name="notify" checked={notify} onCheckedChange={(next) => {
|
|
42
|
+
// This domain is binary. Preserve "indeterminate" in domains that need it.
|
|
43
|
+
setNotify(next === true);
|
|
44
|
+
}} />
|
|
45
|
+
<Button type="submit" disabled={uploadPending}>Save notes</Button>
|
|
46
|
+
</Stack>
|
|
47
|
+
</LocaleProvider>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Switch applies an immediate setting through its boolean callback.
|
|
52
|
+
export function EmailSetting({ enabled, onChange }: { enabled: boolean; onChange: (enabled: boolean) => void }) {
|
|
53
|
+
return <Switch label="Weekly summary email" checked={enabled} onCheckedChange={onChange} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface SupportWidgetProps {
|
|
57
|
+
messages: readonly ChatMessage[];
|
|
58
|
+
sending: boolean;
|
|
59
|
+
// Accept synchronously; the application manages the eventual transport result.
|
|
60
|
+
acceptMessage: (markdown: string) => void;
|
|
61
|
+
retryMessage: (messageId: string) => void;
|
|
62
|
+
uploadAttachment?: RichTextUpload;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function SupportWidget({ messages, sending, acceptMessage, retryMessage, uploadAttachment }: SupportWidgetProps) {
|
|
66
|
+
const [draft, setDraft] = useState("");
|
|
67
|
+
return (
|
|
68
|
+
<ChatWidget title="Support" messages={messages} onRetryMessage={retryMessage} composer={{
|
|
69
|
+
value: draft,
|
|
70
|
+
onChange: setDraft,
|
|
71
|
+
sending,
|
|
72
|
+
onUploadAttachment: uploadAttachment,
|
|
73
|
+
onSend(markdown) {
|
|
74
|
+
acceptMessage(markdown);
|
|
75
|
+
// A controlled draft clears only when the application acknowledges it.
|
|
76
|
+
setDraft("");
|
|
77
|
+
},
|
|
78
|
+
}} />
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface SupportInboxProps {
|
|
83
|
+
threads: readonly ChatThread[];
|
|
84
|
+
selectedThreadId: string | null;
|
|
85
|
+
onSelectThread: (threadId: string | null) => void;
|
|
86
|
+
// These messages and this composer must belong to the selected thread.
|
|
87
|
+
messages: readonly ChatMessage[];
|
|
88
|
+
// Supply value/onChange backed by thread IDs to preserve drafts on navigation.
|
|
89
|
+
composer: ChatComposerOptions;
|
|
90
|
+
retryMessage: (messageId: string) => void;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function SupportInbox({ threads, selectedThreadId, onSelectThread, messages, composer, retryMessage }: SupportInboxProps) {
|
|
94
|
+
return <ChatInbox title="Inbox" threads={threads} selectedThreadId={selectedThreadId} onSelectThread={onSelectThread} messages={messages} composer={composer} onRetryMessage={retryMessage} />;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// content is ready to render. A Markdown string here would display as text.
|
|
98
|
+
export const welcomeMessage: ChatMessage = {
|
|
99
|
+
id: "support-welcome",
|
|
100
|
+
direction: "incoming",
|
|
101
|
+
author: { name: "Support" },
|
|
102
|
+
content: <p>What can we help you with?</p>,
|
|
103
|
+
};
|