@squadbase/vantage 0.1.1 → 0.2.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.
Files changed (53) hide show
  1. package/README.md +2 -2
  2. package/dist/{chunk-YLAB6UQS.js → chunk-46QI6GFC.js} +2 -2
  3. package/dist/{chunk-YLAB6UQS.js.map → chunk-46QI6GFC.js.map} +1 -1
  4. package/dist/{chunk-7IPAXPPY.js → chunk-EHPJXDJU.js} +2 -2
  5. package/dist/chunk-EHPJXDJU.js.map +1 -0
  6. package/dist/{chunk-WQZYXXQW.js → chunk-JC6MT5UU.js} +26 -3
  7. package/dist/chunk-JC6MT5UU.js.map +1 -0
  8. package/dist/{chunk-5L2MH2NG.js → chunk-UHZ7XSAN.js} +3 -3
  9. package/dist/chunk-UHZ7XSAN.js.map +1 -0
  10. package/dist/cli.js +19 -11
  11. package/dist/cli.js.map +1 -1
  12. package/dist/client/index.js +1 -1
  13. package/dist/client/index.js.map +1 -1
  14. package/dist/components/index.d.ts +7 -1
  15. package/dist/components/index.js +109 -22
  16. package/dist/components/index.js.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/markdown/index.js.map +1 -1
  21. package/dist/query/index.js.map +1 -1
  22. package/dist/router/index.d.ts +1 -1
  23. package/dist/router/index.js +1 -1
  24. package/dist/router/index.js.map +1 -1
  25. package/dist/server/node.js +1 -1
  26. package/dist/server/node.js.map +1 -1
  27. package/dist/ui/index.d.ts +1 -1
  28. package/dist/ui/index.js +1 -1
  29. package/dist/ui/index.js.map +1 -1
  30. package/dist/vite/index.js +2 -2
  31. package/docs/en/agent-skills.md +12 -8
  32. package/docs/en/changelog.md +133 -0
  33. package/docs/en/cli-reference.md +1 -1
  34. package/docs/en/components.md +2 -2
  35. package/docs/en/parts/echart.md +18 -11
  36. package/docs/en/routing.md +0 -4
  37. package/docs/en/ui/select.md +16 -10
  38. package/docs/index.json +27 -5
  39. package/docs/ja/agent-skills.md +13 -9
  40. package/docs/ja/changelog.md +124 -0
  41. package/docs/ja/cli-reference.md +1 -1
  42. package/docs/ja/components.md +2 -2
  43. package/docs/ja/parts/echart.md +16 -9
  44. package/docs/ja/routing.md +0 -4
  45. package/docs/ja/ui/select.md +17 -10
  46. package/package.json +1 -1
  47. package/skills/vantage-add-feature/SKILL.md +0 -1
  48. package/skills/vantage-app/SKILL.md +65 -236
  49. package/skills/vantage-pitfalls/SKILL.md +21 -24
  50. package/templates/AGENTS.md +48 -26
  51. package/dist/chunk-5L2MH2NG.js.map +0 -1
  52. package/dist/chunk-7IPAXPPY.js.map +0 -1
  53. package/dist/chunk-WQZYXXQW.js.map +0 -1
@@ -0,0 +1,133 @@
1
+ # Changelog
2
+
3
+ > What changed in each Vantage release, newest first. Still a prototype (0.x), so APIs may change between releases.
4
+
5
+ What changed in each Vantage release. Newest is on top.
6
+
7
+ > [!NOTE]
8
+ > Still a prototype (**0.x**). While on 0.x, **minor is effectively the major** — a
9
+ > minor release may include backwards-incompatible changes. A patch is limited to
10
+ > backwards-compatible additions and bug fixes.
11
+
12
+ ## v0.2.1
13
+
14
+ Charts now follow the theme tokens, and `Select` works out the value-to-label
15
+ map for you. Both are backwards-compatible.
16
+
17
+ > [!NOTE]
18
+ > **Chart colours change.** Charts without an explicit `option.color` used to paint
19
+ > in ECharts' own defaults; they now use the theme's `--chart-1` through
20
+ > `--chart-5`. Charts that set `option.color` are unaffected.
21
+
22
+ ### Changed
23
+
24
+ - **[`EChart`](parts/echart) follows the theme tokens** — series
25
+ come from `--chart-1` through `--chart-5`, while axes, legend and tooltip are
26
+ built from the text and border tokens, and a light/dark switch is picked up.
27
+ ECharts can't read CSS variables *while painting*, so the tokens are resolved
28
+ once at init. Set `option.color` to override just the series — axes keep
29
+ following the tokens. To paint the whole chart yourself, pass the `theme` prop
30
+ (that turns token-following off entirely).
31
+ - **[`Select`](ui/select) no longer needs `items`** — Base UI's
32
+ `SelectValue` renders the raw selected *value*, so a trigger would read
33
+ `kanto` where the list said "Kanto". Vantage now derives the map from your
34
+ `SelectItem`s. **An explicit `items` still wins**, so existing code is
35
+ unchanged (keep passing it when a separate component returns the options).
36
+
37
+ ### Fixed
38
+
39
+ - The `SegmentedControl` example in `useSearchParam`'s JSDoc passed a
40
+ non-existent `onValueChange` prop (it's `onChange`).
41
+ - Refreshed the bundled `AGENTS.md` and Skills: `vantage add ui|block` can copy
42
+ only `data-table` and `sales-overview`; the mode follows from whether `server/`
43
+ exists rather than being a "promote the SPA to fullstack" procedure; and look
44
+ for already-placed Skills before adding them. A placed `AGENTS.md` is synced by
45
+ `vantage upgrade`.
46
+
47
+ ## v0.2.0
48
+
49
+ Makes the destination of `vantage add skill` selectable, and drops the `.js`
50
+ specifier convention for relative imports. This carries one backwards-incompatible
51
+ change (the default destination), so per the 0.x policy it goes out as a minor.
52
+
53
+ Apps pinned to `"@squadbase/vantage": "^0.1.0"` will not pick up 0.2.0 — bump the
54
+ range to `^0.2.0`.
55
+
56
+ > [!WARNING]
57
+ > **The default destination of `vantage add skill` changed.** It used to always
58
+ > write into `.claude/skills/`; skills now land **directly under the project
59
+ > root**. Pass `--dir .claude/skills` to keep the old location. Copies you already
60
+ > placed stay where they are — you only need the flag when refreshing them.
61
+
62
+ ### Changed
63
+
64
+ - **`vantage add skill --dir <path>`** — the destination is now a flag. The path
65
+ resolves from the project root (`--root` is honored) and absolute paths work
66
+ too. Use `--dir .claude/skills` for Claude Code to discover them automatically,
67
+ or whatever directory another agent expects
68
+ (see [Agents and Skills](agent-skills)).
69
+ - **Dropped the `.js` specifier convention for relative imports** — writing
70
+ `./components/revenue-chart.js` is no longer required
71
+ (`./components/revenue-chart` is fine). Vantage code always goes through Vite
72
+ or tsup, and TypeScript resolves it with `moduleResolution: "Bundler"`, so
73
+ nothing ever handed a raw specifier to Node. **Existing imports with `.js`
74
+ keep working** — there is nothing to rewrite.
75
+
76
+ ## v0.1.1
77
+
78
+ Adds hooks for the route list, URL-synced state, and API calls, and fixes two
79
+ dev-time issues. Everything here is backwards-compatible.
80
+
81
+ ### Added
82
+
83
+ - **Routing hooks** — `useRoutes()` / `useCurrentRoute()` in
84
+ [`@squadbase/vantage/router`](routing). They hand you the file-based route
85
+ list directly, so you can build navigation without maintaining it by hand.
86
+ - **URL-synced state** — `useSearchParam` (always a string; writing the default
87
+ or `null` removes the key) and `useSearchState<T>` for JSON values with
88
+ functional updates. Keep filter and tab state in the URL.
89
+ - **API-calling hooks** — `useApiQuery` / `useApiMutation` in
90
+ [`@squadbase/vantage/query`](data-fetching). They call `server/api` with
91
+ JSON, normalizing errors as `HttpError` → `ApiError` (`status` / `body` /
92
+ `requestId`).
93
+ - **`navLabel` on `definePage`** — a field to set the navigation display name
94
+ independently of the page title (see [Pages and metadata](pages-and-metadata)).
95
+
96
+ ### Fixed
97
+
98
+ - **Dev SPA fallback** — visiting a URL like `/sales` directly made Vite show a
99
+ `No matching HTML proxy module found` error overlay (the page itself still
100
+ rendered). The injected-script ids are now derived from the shell document's
101
+ URL.
102
+ - **Queries stuck in `paused`** — when the browser's offline heuristic wrongly
103
+ reported offline, a failed query would stall instead of erroring and the page
104
+ never left its loading state. The managed `QueryClient` now uses
105
+ `networkMode: "always"` (the heuristic is meaningless for a dashboard hitting
106
+ its own origin).
107
+
108
+ ## v0.1.0
109
+
110
+ The first prototype release — the full foundation of a config-free React
111
+ dashboard framework.
112
+
113
+ ### Added
114
+
115
+ - **Config-free foundation** — built on Vite 8. You write `index.tsx`; Vantage
116
+ owns routing, React, TanStack Query, Tailwind v4, the UI kit, the dev server,
117
+ the optional API server, and the build.
118
+ - **File-based routing** — a `*.tsx` with a default export is a route,
119
+ `_layout.tsx` is a layout, `_404.tsx` / `_error.tsx` handle not-found / error,
120
+ and `[param].tsx` is a dynamic route (see [Routing](routing)).
121
+ - **Optional API server** — add `server/api/**` to enable a backend that runs
122
+ identically in `dev` and in the production build (see
123
+ [API and server](api-and-server)).
124
+ - **UI kit and components** — Tailwind v4, shadcn/ui (Base UI variant), and
125
+ composite dashboard components built on top (see [UI and theming](ui-and-theming)).
126
+ - **CLI** — `dev` / `build` / `preview` / `check` / `routes` / `add` / `upgrade`
127
+ (see [CLI reference](cli-reference)).
128
+ - **Bundled docs and search** — `vantage docs` prints the package's guide and
129
+ component reference offline, and `vantage search` searches the same content
130
+ with BM25.
131
+ - **Distribution for agents** — `vantage add agents` places an `AGENTS.md`, and
132
+ `vantage add skill` installs the Claude Code Agent Skills into your app (see
133
+ [Agents and Skills](agent-skills)).
@@ -13,7 +13,7 @@
13
13
  | `vantage preview` | Run the production build locally (fullstack default `:4173`; spa via Vite preview) |
14
14
  | `vantage check` | Static checks (routes, boundaries, forbidden files). Exit 1 on error |
15
15
  | `vantage routes` | Print the page + API URL map |
16
- | `vantage add <kind> <name>` | Scaffold or place a `page` / `api` / `ui` / `block` / `skill` / `agents` (`--force` to overwrite) |
16
+ | `vantage add <kind> <name>` | Scaffold or place a `page` / `api` / `ui` / `block` / `skill` / `agents` (`--force` to overwrite; `skill` takes `--dir` for the destination) |
17
17
  | `vantage docs [name]` | Show the bundled guide and component reference |
18
18
  | `vantage search <query>` | Search that same reference in full text (natural language or `--regex`) |
19
19
  | `vantage doctor` | Diagnose environment / installation health |
@@ -42,8 +42,8 @@ from the Radix build, four differences matter.
42
42
  - **[`ToggleGroup`](ui/toggle-group)'s `value` is an array.** For single choice, use
43
43
  [`SegmentedControl`](parts/segmented-control).
44
44
  - **[`Select`](ui/select)'s `onValueChange` gives `string | null`.** You need a
45
- `null` guard. And `SelectValue` shows the raw value by default pass the value-to-label map as
46
- `items` to get labels.
45
+ `null` guard. The value-to-label `items` map is derived from your `SelectItem`s automatically, so
46
+ you rarely write it (only when a separate component returns the options).
47
47
 
48
48
  State is expressed as `data-open` / `data-checked` rather than `data-state="open"`. Vantage's
49
49
  `theme.css` declares custom variants that accept both spellings, so classes like
@@ -1,10 +1,11 @@
1
1
  # EChart
2
2
 
3
- > A thin Apache ECharts wrapper. Set colours in your option.
3
+ > A thin Apache ECharts wrapper whose colours follow the theme tokens.
4
4
 
5
- A thin wrapper around Apache ECharts. It only handles the canvas lifecycle (init, resize, dispose),
6
- the loading overlay, event subscriptions and PNG export. **The palette and axes do not auto-follow
7
- the theme** set colours inside `option`, or pass an ECharts theme to `theme`.
5
+ A thin wrapper around Apache ECharts. It handles the canvas lifecycle (init, resize, dispose), the
6
+ loading overlay, event subscriptions and PNG export. **Colours follow the theme tokens** series
7
+ come from `--chart-1` through `--chart-5`, while axes, legend and tooltip are built from the text
8
+ and border tokens. A light/dark switch is picked up too.
8
9
 
9
10
  ```tsx
10
11
  import { EChart } from "@squadbase/vantage/components";
@@ -16,16 +17,21 @@ import type { EChartsOption } from "@squadbase/vantage/components";
16
17
  | `option` | `EChartsOption` | The ECharts option, passed straight through. |
17
18
  | `height` | `string \| number` | Height; a number means px. `className` works too. |
18
19
  | `loading` | `boolean` | Show ECharts' loading overlay. |
19
- | `theme` | `string \| object` | The theme passed to `echarts.init` (a name or a registered theme). |
20
+ | `theme` | `string \| object` | The theme passed to `echarts.init` (a name or a registered theme). Passing one turns token-following off. |
20
21
  | `onEvents` | `Record<string, (params: unknown) => void>` | Subscribe to ECharts events such as `click`. |
21
22
  | `ariaLabel` | `string` | A description of the chart. |
22
23
  | `actions` | `boolean` | Show actions such as save-as-image. |
23
24
  | `fileName` | `string` | File name used when saving. |
24
25
 
25
- ## Setting the palette
26
+ ## Overriding the palette
26
27
 
27
- Series colours come from `option.color`. To match the theme's `--chart-1` through `--chart-5`, pass
28
- the resolved values ECharts paints to canvas and cannot read CSS variables.
28
+ By default the theme's `--chart-1` through `--chart-5` become the series colours. ECharts can't read
29
+ CSS variables *while painting*, but `EChart` resolves the tokens once at init with
30
+ `getComputedStyle` and passes them in as an ECharts theme. It watches for the `.dark` class going on
31
+ and off, and re-reads the tokens when it changes.
32
+
33
+ To give series their own colours, set `option.color` (or `series[].itemStyle.color`). Your option
34
+ wins over the theme, so **axes, legend and tooltip keep following the tokens**.
29
35
 
30
36
  ```ts
31
37
  const option: EChartsOption = {
@@ -34,9 +40,10 @@ const option: EChartsOption = {
34
40
  };
35
41
  ```
36
42
 
37
- To reuse a palette across charts, register a theme with
38
- [`echarts.registerTheme`](https://echarts.apache.org/en/api.html#echarts.registerTheme) and pass its
39
- name to the `theme` prop.
43
+ To paint the whole chart with a theme of your own, register it with
44
+ [`echarts.registerTheme`](https://echarts.apache.org/en/api.html#echarts.registerTheme) and pass the
45
+ name (or the theme object) to `theme`. That turns token-following off entirely — including the
46
+ light/dark switch.
40
47
 
41
48
  ## Keeping the legend off the plot
42
49
 
@@ -33,10 +33,6 @@ server/ API (its presence enables the server)
33
33
  public/ Static assets
34
34
  ```
35
35
 
36
- > [!NOTE]
37
- > Imports between files use **runtime `.js` specifiers** (e.g. `./components/revenue-chart.js`) —
38
- > required for ESM Node resolution.
39
-
40
36
  ## The three spellings of a dynamic param
41
37
 
42
38
  The same param appears in three spellings depending on where it is. **They must match.**
@@ -39,24 +39,30 @@ import {
39
39
  > <Select onValueChange={(value) => value !== null && setRegion(value)}>
40
40
  > ```
41
41
 
42
- > [!WARNING]
43
- > `SelectValue` shows the **raw selected `value`** by default — it never looks inside `SelectItem`.
44
- > With `value="kanto"` the trigger reads `kanto`, not "Kanto". Give `Select` the value-to-label map
45
- > via `items`.
42
+ > [!NOTE]
43
+ > Base UI's `SelectValue` renders the **raw selected `value`** — it never looks inside `SelectItem`.
44
+ > With `value="kanto"` the trigger would read `kanto`.
46
45
  >
47
- > ```tsx
48
- > const regions = { hokkaido: "Hokkaido", kanto: "Kanto", kansai: "Kansai" };
46
+ > Vantage's `Select` **absorbs that quirk**: it walks its children, collects each `SelectItem`'s
47
+ > `value` label pair and hands them to Base UI as `items`, so the code below puts "Kanto" in the
48
+ > trigger. It's the same treatment `SegmentedControl` gives `ToggleGroup`'s array API.
49
49
  >
50
- > <Select items={regions} value={region} onValueChange={…}>
50
+ > ```tsx
51
+ > <Select value={region} onValueChange={…}>
51
52
  > <SelectTrigger><SelectValue placeholder="Pick a region" /></SelectTrigger>
52
- >
53
+ > <SelectContent>
54
+ > <SelectItem value="kanto">Kanto</SelectItem>
55
+ > </SelectContent>
53
56
  > </Select>;
54
57
  > ```
55
58
  >
56
- > If you'd rather not carry `items`, a function child on `SelectValue` does the same job.
59
+ > Only `SelectItem`s **written in place** are picked up (a `map` over them counts). When the options
60
+ > come back from a separate component, pass `items` yourself — an explicit `items` always wins.
57
61
  >
58
62
  > ```tsx
59
- > <SelectValue>{(value) => regions[value] ?? "Pick a region"}</SelectValue>
63
+ > const regions = { hokkaido: "Hokkaido", kanto: "Kanto", kansai: "Kansai" };
64
+ >
65
+ > <Select items={regions} value={region} onValueChange={…}>
60
66
  > ```
61
67
 
62
68
  `SelectContent` opens over the trigger with the selected item aligned to it. For a plain dropdown
package/docs/index.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
2
+ "schemaVersion": 2,
3
3
  "generatedFrom": "docs/content",
4
4
  "docs": [
5
5
  {
@@ -108,10 +108,21 @@
108
108
  "section": "guide",
109
109
  "sectionTitle": "ガイド",
110
110
  "title": "エージェントと Skills",
111
- "description": "Vantage に同梱された Claude Code の Agent Skills。vantage add skill でアプリの .claude/skills/ に配置し、エージェントに手順を伴うワークフローを教える。",
111
+ "description": "Vantage に同梱された Claude Code の Agent Skills。vantage add skill でアプリに配置し(既定はルート直下、--dir .claude/skills などに変更)、エージェントに手順を伴うワークフローを教える。",
112
112
  "file": "ja/agent-skills.md",
113
113
  "order": 9
114
114
  },
115
+ {
116
+ "slug": "changelog",
117
+ "lang": "ja",
118
+ "section": "guide",
119
+ "sectionTitle": "ガイド",
120
+ "title": "変更履歴",
121
+ "description": "Vantage のリリースごとの変更点。新しいものが上。まだプロトタイプ(0.x)のため、リリース間で API が変わることがあります。",
122
+ "file": "ja/changelog.md",
123
+ "order": 10,
124
+ "searchable": false
125
+ },
115
126
  {
116
127
  "slug": "components",
117
128
  "lang": "ja",
@@ -538,7 +549,7 @@
538
549
  "section": "components/parts",
539
550
  "sectionTitle": "@squadbase/vantage/components",
540
551
  "title": "EChart",
541
- "description": "Apache ECharts の薄いラッパー。配色は option で指定する。",
552
+ "description": "Apache ECharts の薄いラッパー。配色はテーマトークンに追従する。",
542
553
  "file": "ja/parts/echart.md",
543
554
  "order": 4
544
555
  },
@@ -778,10 +789,21 @@
778
789
  "section": "guide",
779
790
  "sectionTitle": "Guide",
780
791
  "title": "Agents and Skills",
781
- "description": "The Claude Code agent skills bundled with Vantage. Place them into your app's .claude/skills/ with vantage add skill to teach agents step-by-step workflows.",
792
+ "description": "The Claude Code agent skills bundled with Vantage. Place them into your app with vantage add skill (the project root by default, or anywhere via --dir, e.g. .claude/skills) to teach agents step-by-step workflows.",
782
793
  "file": "en/agent-skills.md",
783
794
  "order": 9
784
795
  },
796
+ {
797
+ "slug": "changelog",
798
+ "lang": "en",
799
+ "section": "guide",
800
+ "sectionTitle": "Guide",
801
+ "title": "Changelog",
802
+ "description": "What changed in each Vantage release, newest first. Still a prototype (0.x), so APIs may change between releases.",
803
+ "file": "en/changelog.md",
804
+ "order": 10,
805
+ "searchable": false
806
+ },
785
807
  {
786
808
  "slug": "components",
787
809
  "lang": "en",
@@ -1208,7 +1230,7 @@
1208
1230
  "section": "components/parts",
1209
1231
  "sectionTitle": "@squadbase/vantage/components",
1210
1232
  "title": "EChart",
1211
- "description": "A thin Apache ECharts wrapper. Set colours in your option.",
1233
+ "description": "A thin Apache ECharts wrapper whose colours follow the theme tokens.",
1212
1234
  "file": "en/parts/echart.md",
1213
1235
  "order": 4
1214
1236
  },
@@ -1,6 +1,6 @@
1
1
  # エージェントと Skills
2
2
 
3
- > Vantage に同梱された Claude Code の Agent Skills。vantage add skill でアプリの .claude/skills/ に配置し、エージェントに手順を伴うワークフローを教える。
3
+ > Vantage に同梱された Claude Code の Agent Skills。vantage add skill でアプリに配置し(既定はルート直下、--dir .claude/skills などに変更)、エージェントに手順を伴うワークフローを教える。
4
4
 
5
5
  Vantage は **Claude Code の Agent Skills** を同梱しています。Skill は「手順を伴うワークフロー」を、
6
6
  エージェントが必要なときだけ呼び出せる形にしたものです。UI キットや CLI の使い方といった
@@ -18,16 +18,18 @@ Vantage は **Claude Code の Agent Skills** を同梱しています。Skill
18
18
 
19
19
  ## 配置する
20
20
 
21
- Skill のソースは `@squadbase/vantage` パッケージに同梱されています。`vantage add skill` で、
22
- 対象アプリの `.claude/skills/` にコピーします。
21
+ Skill のソースは `@squadbase/vantage` パッケージに同梱されています。`vantage add skill`
22
+ 対象アプリにコピーします。配置先は既定で**プロジェクトルート直下**で、`--dir` で変えられます。
23
23
 
24
24
  ```bash
25
- vantage add skill --all # 同梱スキルをすべて配置
26
- vantage add skill vantage-app # 名前を指定して1つだけ配置
27
- vantage add skill vantage-app --force # 既存を上書き
25
+ vantage add skill --all # 同梱スキルをすべて、ルート直下に配置
26
+ vantage add skill vantage-app # 名前を指定して1つだけ配置
27
+ vantage add skill --all --dir .claude/skills # Claude Code が読む場所に配置
28
+ vantage add skill vantage-app --force # 既存を上書き
28
29
  ```
29
30
 
30
- 配置後のレイアウト:
31
+ `--dir` のパスはプロジェクトルートからの相対で解決されます(絶対パスも可)。Claude Code に
32
+ 自動認識させるなら `.claude/skills/` に置きます:
31
33
 
32
34
  ```text
33
35
  your-app/
@@ -41,7 +43,8 @@ your-app/
41
43
  ```
42
44
 
43
45
  `.claude/skills/` は Claude Code が自動で認識します。エージェントはタスクに応じて、対応する
44
- Skill の手順を読み込んで実行します。
46
+ Skill の手順を読み込んで実行します。他のエージェントに読ませる場合は、そのツールが期待する
47
+ ディレクトリを `--dir` に渡してください。
45
48
 
46
49
  > [!NOTE]
47
50
  > `.claude/` はツール用の設定であり、アプリのコードではありません。`vantage check` の静的診断は
@@ -51,7 +54,8 @@ Skill の手順を読み込んで実行します。
51
54
 
52
55
  - **source-of-truth はパッケージ内**にあります。Skill はフレームワークのバージョンと一緒に
53
56
  配布・更新されるため、`@squadbase/vantage` を上げれば最新の手順が手に入ります。配置済みの
54
- コピーを更新したいときは `vantage add skill --all --force` を実行します。
57
+ コピーを更新したいときは、配置したときと同じ `--dir` を付けて
58
+ `vantage add skill --all --force` を実行します。
55
59
  - **Squadbase テンプレートには配置済み**です。テンプレートから作ったアプリには、最初から
56
60
  `.claude/skills/` が入っています。手で作ったアプリには `vantage add skill` で足してください。
57
61
 
@@ -0,0 +1,124 @@
1
+ # 変更履歴
2
+
3
+ > Vantage のリリースごとの変更点。新しいものが上。まだプロトタイプ(0.x)のため、リリース間で API が変わることがあります。
4
+
5
+ Vantage のリリースごとの変更点です。新しいものが上に来ます。
6
+
7
+ > [!NOTE]
8
+ > まだプロトタイプ(**0.x**)です。0.x の間は **minor が実質のメジャー**扱いで、後方互換性の
9
+ > ない変更は minor で入ることがあります。patch は後方互換の機能追加とバグ修正のみです。
10
+
11
+ ## v0.2.1
12
+
13
+ チャートをテーマトークンに追従させ、`Select` の値とラベルの対応を Vantage 側で組むように
14
+ しました。API はどちらも後方互換です。
15
+
16
+ > [!NOTE]
17
+ > **チャートの配色が変わります。** これまで `option.color` を書いていないチャートは ECharts の
18
+ > 既定色で描かれていましたが、テーマの `--chart-1` 〜 `--chart-5` で描かれるようになります。
19
+ > 自分で `option.color` を指定しているチャートは今までどおりです。
20
+
21
+ ### 変更
22
+
23
+ - **[`EChart`](parts/echart) がテーマトークンに追従するようになりました** ―
24
+ 系列色は `--chart-1` 〜 `--chart-5`、軸・凡例・ツールチップは文字色と境界色のトークンから
25
+ 組まれ、ライト / ダークの切り替えにも追いかけます。ECharts が CSS 変数を読めないのは
26
+ **キャンバスの描画中**の話なので、init のタイミングでトークンの実値を解決しています。
27
+ 系列の色だけ変えたいときは `option.color` で上書きでき、その場合も軸まわりの追従は
28
+ 残ります。チャート全体を自前のテーマで描きたいときは `theme` プロップを渡してください
29
+ (このときトークン追従は完全に無効になります)。
30
+ - **[`Select`](ui/select) の `items` を書かなくてよくなりました** ―
31
+ Base UI の `SelectValue` は選択中の *value* をそのまま描く部品で、値とラベルが違うと
32
+ トリガーに `kanto` のような生の値が出ていました。`SelectItem` から対応表を組む処理を
33
+ Vantage 側に入れたので、普通に書けばラベルが出ます。**明示した `items` は今までどおり
34
+ 優先される**ので、既存のコードはそのまま動きます(項目を別のコンポーネントが返している
35
+ 場合は、これまでどおり `items` を渡してください)。
36
+
37
+ ### 修正
38
+
39
+ - `useSearchParam` の JSDoc に載せていた `SegmentedControl` の例が、存在しない
40
+ `onValueChange` を渡していました(正しくは `onChange`)。
41
+ - 同梱の `AGENTS.md` と Skill を更新しました ― `vantage add ui|block` でコピーできるのが
42
+ `data-table` と `sales-overview` の 2 つだけであること、モードは `server/` の有無で決まり
43
+ 「SPA から fullstack へ昇格する」手順ではないこと、配置済みの Skill を先に探すこと。
44
+ 配置済みの `AGENTS.md` は `vantage upgrade` で同期されます。
45
+
46
+ ## v0.2.0
47
+
48
+ `vantage add skill` の配置先を選べるようにし、相対 import の `.js` 指定子の規約を廃止しました。
49
+ 後方互換でない変更(既定の配置先)を含むため、0.x の方針に従って minor を上げています。
50
+
51
+ 依存を `"@squadbase/vantage": "^0.1.0"` と書いているアプリには 0.2.0 は入りません。
52
+ `^0.2.0` に上げてください。
53
+
54
+ > [!WARNING]
55
+ > **`vantage add skill` の既定の配置先が変わりました。** これまで常に `.claude/skills/` へ
56
+ > 出していましたが、既定は**プロジェクトルート直下**になります。これまでと同じ場所に置くには
57
+ > `--dir .claude/skills` を明示してください。配置済みのコピーはそのまま残るので、更新する
58
+ > ときだけ `--dir` を付け直す形になります。
59
+
60
+ ### 変更
61
+
62
+ - **`vantage add skill --dir <path>`** ― 配置先をコマンドで指定できるようになりました。
63
+ パスはプロジェクトルート(`--root` を尊重)からの相対で解決され、絶対パスも渡せます。
64
+ Claude Code に自動認識させたい場合は `--dir .claude/skills`、他のエージェント向けには
65
+ そのツールが期待するディレクトリを指定します(→ [エージェントと Skills](agent-skills))。
66
+ - **相対 import の `.js` 指定子の規約を廃止** ― `./components/revenue-chart.js` のように
67
+ 拡張子を書く必要はなくなりました(`./components/revenue-chart` で構いません)。Vantage の
68
+ コードは常に Vite / tsup を通り、TypeScript も `moduleResolution: "Bundler"` で解決する
69
+ ため、Node が生の指定子を読む経路がそもそもありませんでした。**既存の `.js` 付きの
70
+ import はそのまま動きます** ― 書き換えは不要です。
71
+
72
+ ## v0.1.1
73
+
74
+ 一覧・URL 状態・API 呼び出しの hook を追加し、開発時の 2 つの不具合を修正しました。
75
+ すべて後方互換です。
76
+
77
+ ### 追加
78
+
79
+ - **ルーティングの hook** ― `useRoutes()` / `useCurrentRoute()` を
80
+ [`@squadbase/vantage/router`](routing) に追加。ファイルベースルーティングの一覧を
81
+ そのまま受け取り、ナビゲーションを手で二重管理せずに組めます。
82
+ - **URL 同期の状態** ― `useSearchParam`(常に文字列。既定値/`null` を書くとキーを消す)と、
83
+ JSON 値と関数更新に対応した `useSearchState<T>` を追加。フィルタやタブの状態を URL に置けます。
84
+ - **API 呼び出しの hook** ― `useApiQuery` / `useApiMutation` を
85
+ [`@squadbase/vantage/query`](data-fetching) に追加。`server/api` を JSON で呼び、
86
+ エラーは `HttpError` → `ApiError`(`status` / `body` / `requestId`)に正規化されます。
87
+ - **`definePage` の `navLabel`** ― ナビゲーションに出す表示名を、ページのタイトルと
88
+ 独立して指定できるフィールドを追加(→ [ページとメタデータ](pages-and-metadata))。
89
+
90
+ ### 修正
91
+
92
+ - **dev の SPA フォールバック** ― `/sales` のような URL に直接アクセスすると、Vite が
93
+ `No matching HTML proxy module found` のエラーオーバーレイを出していた問題を修正
94
+ (ページ自体は描画されていました)。注入スクリプトの id をシェル文書の URL から
95
+ 導くようにしました。
96
+ - **クエリが `paused` のまま止まる** ― ブラウザのオフライン判定が誤って offline を返すと、
97
+ 失敗したクエリがエラーにならず停止し、ページが読み込み表示から戻らないことがありました。
98
+ 管理された `QueryClient` の `networkMode` を `"always"` にして解消(自オリジンの API を
99
+ 叩くダッシュボードでは、この判定に意味がありません)。
100
+
101
+ ## v0.1.0
102
+
103
+ 最初のプロトタイプリリース。設定ファイル不要(config-free)な React ダッシュボード
104
+ フレームワークの土台一式です。
105
+
106
+ ### 追加
107
+
108
+ - **config-free な土台** ― Vite 8 の上に構築。アプリ作者が書くのは `index.tsx` だけで、
109
+ ルーティング・React・TanStack Query・Tailwind v4・UI キット・開発サーバー・
110
+ オプションの API サーバー・ビルドはすべて Vantage が所有します。
111
+ - **ファイルベースルーティング** ― `*.tsx`(デフォルトエクスポート)がルートに、
112
+ `_layout.tsx` がレイアウトに、`_404.tsx` / `_error.tsx` が not-found / error に、
113
+ `[param].tsx` が動的ルートになります(→ [ルーティング](routing))。
114
+ - **オプションの API サーバー** ― `server/api/**` を足すとバックエンドが有効になり、
115
+ `dev` と本番ビルドで同一に動きます(→ [API とサーバー](api-and-server))。
116
+ - **UI キットとコンポーネント** ― Tailwind v4、shadcn/ui(Base UI 版)、その上に組んだ
117
+ ダッシュボード向けの複合コンポーネント(→ [UI とテーマ](ui-and-theming))。
118
+ - **CLI** ― `dev` / `build` / `preview` / `check` / `routes` / `add` / `upgrade`
119
+ (→ [CLI リファレンス](cli-reference))。
120
+ - **同梱ドキュメントと検索** ― `vantage docs` がパッケージ同梱のガイドとコンポーネント
121
+ リファレンスをオフラインで表示し、`vantage search` が同じ内容を BM25 で検索します。
122
+ - **エージェント向けの配布物** ― `vantage add agents` が `AGENTS.md` を、
123
+ `vantage add skill` が Claude Code の Agent Skills をアプリへ配置します
124
+ (→ [エージェントと Skills](agent-skills))。
@@ -13,7 +13,7 @@
13
13
  | `vantage preview` | 本番ビルドをローカルで起動(fullstack は既定 `:4173`、spa は Vite プレビュー) |
14
14
  | `vantage check` | 静的検査(ルート・境界・禁止ファイル)。エラーがあれば exit 1 |
15
15
  | `vantage routes` | ページ + API の URL マップを表示 |
16
- | `vantage add <kind> <name>` | `page` / `api` / `ui` / `block` / `skill` / `agents` を雛形生成・配置(`--force` で上書き) |
16
+ | `vantage add <kind> <name>` | `page` / `api` / `ui` / `block` / `skill` / `agents` を雛形生成・配置(`--force` で上書き、`skill` は `--dir` で配置先を指定) |
17
17
  | `vantage docs [name]` | 同梱のガイド + コンポーネントリファレンスを表示 |
18
18
  | `vantage search <query>` | 同じリファレンスを全文検索(自然言語 or `--regex`) |
19
19
  | `vantage doctor` | 環境・インストールの健全性を診断 |
@@ -42,8 +42,8 @@ Radix UI から [Base UI](https://base-ui.com) へ切り替えており、Vantag
42
42
  - **[`ToggleGroup`](ui/toggle-group) の `value` は配列。** 単一選択にしたいときは
43
43
  [`SegmentedControl`](parts/segmented-control) を使ってください。
44
44
  - **[`Select`](ui/select) の `onValueChange` は `string | null`。** `null` のガードが
45
- 要ります。また `SelectValue` は既定で選択中の値をそのまま表示するので、ラベルを出すには
46
- `items` に対応表を渡します。
45
+ 要ります。値とラベルが違うときの `items` は Vantage 側が `SelectItem` から自動で組むので、
46
+ 通常は書かなくて済みます(別コンポーネントが項目を返す形のときだけ明示)。
47
47
 
48
48
  状態は `data-state="open"` ではなく `data-open` / `data-checked` のような属性で表現されます。
49
49
  Vantage の `theme.css` は両方の綴りを受ける custom variant を定義しているので、
@@ -1,10 +1,11 @@
1
1
  # EChart
2
2
 
3
- > Apache ECharts の薄いラッパー。配色は option で指定する。
3
+ > Apache ECharts の薄いラッパー。配色はテーマトークンに追従する。
4
4
 
5
5
  Apache ECharts をそのまま使えるようにした薄いラッパーです。キャンバスの初期化・リサイズ・破棄と、
6
- ローディング表示・イベント購読・PNG 保存だけを面倒みます。**配色や軸の見た目はテーマに自動追従
7
- しません** `option` の中で色を決めるか、`theme` に ECharts のテーマを渡してください。
6
+ ローディング表示・イベント購読・PNG 保存を面倒みます。**配色はテーマトークンに追従します** —
7
+ 系列色は `--chart-1` `--chart-5`、軸・凡例・ツールチップは文字色と境界色のトークンから組まれ、
8
+ ライト / ダークの切り替えにも追いかけます。
8
9
 
9
10
  ```tsx
10
11
  import { EChart } from "@squadbase/vantage/components";
@@ -16,16 +17,21 @@ import type { EChartsOption } from "@squadbase/vantage/components";
16
17
  | `option` | `EChartsOption` | ECharts の option。そのまま渡す。 |
17
18
  | `height` | `string \| number` | 高さ。数値は px。`className` で決めても良い。 |
18
19
  | `loading` | `boolean` | ECharts のローディング表示を出す。 |
19
- | `theme` | `string \| object` | `echarts.init` に渡すテーマ(名前または登録済みテーマ)。 |
20
+ | `theme` | `string \| object` | `echarts.init` に渡すテーマ(名前または登録済みテーマ)。渡すとトークン追従は無効になる。 |
20
21
  | `onEvents` | `Record<string, (params: unknown) => void>` | ECharts のイベント購読(`click` など)。 |
21
22
  | `ariaLabel` | `string` | チャートの説明。 |
22
23
  | `actions` | `boolean` | 画像保存などの操作を出す。 |
23
24
  | `fileName` | `string` | 保存時のファイル名。 |
24
25
 
25
- ## 配色を決める
26
+ ## 配色を上書きする
26
27
 
27
- 系列の色は `option.color` で指定します。テーマの `--chart-1` 〜 `--chart-5` に揃えたいときは、
28
- ECharts はキャンバス描画で CSS 変数を読めないため、色の実値を渡してください。
28
+ 既定ではテーマの `--chart-1` 〜 `--chart-5` がそのまま系列色になります。ECharts は**描画中**には
29
+ CSS 変数を読めませんが、`EChart` init のタイミングで `getComputedStyle` からトークンの実値を
30
+ 解決し、ECharts のテーマとして渡しています。`.dark` の付け外しを見張っていて、切り替われば
31
+ 読み直します。
32
+
33
+ 系列に固有の色を当てたいときは `option.color`(または `series[].itemStyle.color`)で上書きします。
34
+ option はテーマより優先されるので、**軸・凡例・ツールチップのトークン追従は残ります**。
29
35
 
30
36
  ```ts
31
37
  const option: EChartsOption = {
@@ -34,8 +40,9 @@ const option: EChartsOption = {
34
40
  };
35
41
  ```
36
42
 
37
- 複数チャートで配色を使い回すなら、[`echarts.registerTheme`](https://echarts.apache.org/en/api.html#echarts.registerTheme)
38
- でテーマを登録し、その名前を `theme` プロップに渡すのが簡潔です。
43
+ チャート全体を自前のテーマで描きたいときは、[`echarts.registerTheme`](https://echarts.apache.org/en/api.html#echarts.registerTheme)
44
+ で登録したテーマ名(またはテーマオブジェクト)を `theme` プロップに渡します。この場合は
45
+ トークン追従が**完全に無効**になり、明暗の切り替えにも追従しなくなります。
39
46
 
40
47
  ## 凡例と重ならないようにする
41
48
 
@@ -33,10 +33,6 @@ server/ API(存在するとサーバーが有効になる)
33
33
  public/ 静的アセット
34
34
  ```
35
35
 
36
- > [!NOTE]
37
- > ファイル間の import は **ランタイムの `.js` 指定子**を使います(例: `./components/revenue-chart.js`)。
38
- > ESM の Node 解決に必要です。
39
-
40
36
  ## 動的パラメータの 3 つの綴り
41
37
 
42
38
  同じパラメータが、場所によって 3 つの綴りで現れます。**必ず一致させます。**