creoui 0.20.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/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # creoui
2
+
3
+ creoui の Web 向け Design Token + Component 配布パッケージ。
4
+
5
+ Creo ecosystem (creo-memories / vantage-point / fleetstage 他) の Web app に、 共通の **色 / 余白 / typography / radius / shadow** を **CSS custom properties** + **JavaScript 定数** + **28 個の class-based component CSS** として提供。
6
+
7
+ 単一の W3C Design Tokens (DTCG) から style-dictionary v4 で生成され、 どの consumer から読み込んでも Creo の **視覚的一貫性** が保たれる (Apple SPM / Rust crate も同 token SSOT から派生)。
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ bun add creoui
13
+ # or
14
+ npm install creoui
15
+ # or
16
+ pnpm add creoui
17
+ ```
18
+
19
+ ## Quick start (3 行)
20
+
21
+ ```ts
22
+ import 'creoui/tokens.css' // CSS variable + 8 theme + reduced-motion guard
23
+ import 'creoui/components.css' // 28 component (button / input / dialog / drawer 等)
24
+
25
+ document.documentElement.dataset.theme = 'mint-dark' // optional、 default は mint-dark
26
+ ```
27
+
28
+ これで `:root` に **350+ CSS 変数** + 28 component class が usable に。
29
+
30
+ ## Token catalog — 5 tier convention (v0.17.0 token / v0.18.0 attribute、 完全統一)
31
+
32
+ すべての dimension scale token + component attribute は **`xs / s / m / l / xl` の 5 tier** に統一。 `sm/md/lg` Tailwind 流命名は **完全廃止** (廃止 history は [`docs/migration/v0.14-to-v0.18.md`](https://github.com/chronista-club/creoui/blob/main/docs/migration/v0.14-to-v0.18.md))。
33
+
34
+ ### Dimension scale (5 tier)
35
+
36
+ | Category | Keys | 例 |
37
+ |---|---|---|
38
+ | `spacing.*` | `xs / s / m / l / xl` (4/8/18/24/32 px) | sibling 間 gap、 card 内側 padding |
39
+ | `margin.*` | `xs / s / m / l / xl` (8/16/18/40/64 px) | block 間 rhythm、 section break |
40
+ | `radius.*` | `none / xs / s / m / l / xl / full` | 4/8/15/22/28 px + special |
41
+ | `shadow.*` | `none / s / m / l / xl` | elevation (cards / popovers / modals) |
42
+ | `typography.size.*` | `xs / s / m / l / xl` (12/14/16/18/20 px) | body text |
43
+ | `typography.display.*` | `xs / s / m / l / xl` (24/32/44/56/72 px) | hero / heading |
44
+ | `typography.icon.*` | `xs / s / m / l / xl` (16/24/40/64/96 px) | icon font-size |
45
+
46
+ ### Layout primitives (v0.15+)
47
+
48
+ | Token | Keys | 用途 |
49
+ |---|---|---|
50
+ | `layout.container.*` | `xs / s / m / l / xl` (480/640/768/1024/1280 px) | page max-width |
51
+ | `layout.grid.col-min-*` | `xs / s / m / l / xl` (120/160/220/280/320 px) | auto-fit grid minmax |
52
+ | `layout.gap.*` | `tight / sibling / section / page` (semantic alias) | gap between elements |
53
+ | `layout.target.*` | `tap / focus / hit` (44/32/24 px) | a11y minimum size |
54
+
55
+ ### Color (8 theme + semantic)
56
+
57
+ | Token | Keys |
58
+ |---|---|
59
+ | `color.brand.*` | `primary / primary-hover / secondary / accent` |
60
+ | `color.semantic.*` | `success / warning / error / info` |
61
+ | `color.surface.*` | `bg / bg-subtle / fg / fg-subtle / scrim / scrim-modal` |
62
+ | `color.text.*` | `primary / secondary / tertiary / brand / link` |
63
+ | `color.themes.*` | 8 theme palettes (`mint-light` / `mint-dark` / `sora-*` / `contrast-*` / `oldschool-*`) |
64
+
65
+ theme 切替は `[data-theme="<id>"]` attribute で。 詳細は [`docs/design/theme-system.md`](https://github.com/chronista-club/creoui/blob/main/docs/design/theme-system.md)。
66
+
67
+ ### Typography family (v0.14+ mode-based)
68
+
69
+ | Token | Default | 用途 |
70
+ |---|---|---|
71
+ | `family.app` | JetBrainsMono Nerd Font + PlemolJP | App UI chrome (sidebar / button / dialog) |
72
+ | `family.read` | PlemolJP | 読み専用 (memory view / chat history / canvas) |
73
+ | `family.editor` | iA Writer Duo | textarea / Markdown editor |
74
+ | `family.editor-mono` | iA Writer Mono | 純粋 mono 派 |
75
+ | `family.editor-quattro` | iA Writer Quattro | semi-proportional 派 |
76
+ | `family.terminal` | family.app と同 stack (意味的に別) | xterm.js |
77
+
78
+ 加えて `family.{sans, mono, mono-{legible,retro,corporate,display}, display, icon}` の 8 traditional category が back compat で残置。
79
+
80
+ ## Usage 例
81
+
82
+ ### CSS で 5 tier convention の token を使う
83
+
84
+ ```css
85
+ .my-card {
86
+ /* spacing は xs / s / m / l / xl */
87
+ padding: var(--spacing-m);
88
+ gap: var(--spacing-s);
89
+
90
+ /* radius も 5 tier (+ none / full) */
91
+ border-radius: var(--radius-m);
92
+
93
+ /* shadow も 5 tier (+ none) */
94
+ box-shadow: var(--shadow-s);
95
+
96
+ /* typography size も 5 tier */
97
+ font-size: var(--typography-size-m);
98
+ font-family: var(--typography-family-app);
99
+ color: var(--color-text-primary);
100
+ background: var(--color-surface-bg);
101
+ }
102
+
103
+ .my-hero {
104
+ font-size: var(--typography-display-l);
105
+ font-weight: var(--typography-weight-semibold);
106
+ }
107
+ ```
108
+
109
+ ### JS 定数として参照
110
+
111
+ ```ts
112
+ import { ColorBrandPrimary, SpacingM, RadiusS } from 'creoui/tokens.js'
113
+
114
+ // Build time に値を埋め込みたい場合
115
+ console.log(ColorBrandPrimary) // 'oklch(...)'
116
+ console.log(SpacingM) // '18px'
117
+ ```
118
+
119
+ camelCase identifier (`SpacingM` 等) も 5 tier convention に揃う。 完全な型定義は同梱の `tokens.d.ts`。
120
+
121
+ ### Component class で 28 component を使う
122
+
123
+ ```html
124
+ <!-- Button -->
125
+ <button class="creo-btn" data-variant="primary">Save</button>
126
+ <button class="creo-btn" data-variant="ghost" data-size="s">Cancel</button>
127
+
128
+ <!-- Card with composition -->
129
+ <article class="creo-card" data-padding="m">
130
+ <h2>Title</h2>
131
+ <p>...</p>
132
+ </article>
133
+
134
+ <!-- Layout primitives (v0.15+) -->
135
+ <div class="creo-container" data-size="m">
136
+ <div class="creo-grid" data-cols="3" data-gap="m">
137
+ <article class="creo-card" data-padding="m">A</article>
138
+ <article class="creo-card" data-padding="m">B</article>
139
+ <article class="creo-card" data-padding="m">C</article>
140
+ </div>
141
+ </div>
142
+ ```
143
+
144
+ 28 component の完全 catalog は [docs site](https://creoui.in) (WIP) または [`docs/components/`](https://github.com/chronista-club/creoui/tree/main/docs/components) を参照。
145
+
146
+ > **note**: v0.18 で `data-size` / `data-padding` / `data-elevation` attribute も 5 tier 統一 (`s/m/l`)。 token と attribute の **convention drift は完全解消**。
147
+
148
+ ## A11y — `prefers-reduced-motion` 完全対応 (v0.15+)
149
+
150
+ 14 全 component が `@media (prefers-reduced-motion: reduce)` で transition / transform / animation を停止。 **consumer 側の追加作業なしで** WCAG 2.1 SC 2.3.3 (Animation from Interactions) + SC 2.3.1 (Three Flashes) 準拠。 switch thumb slide / button press / table sort indicator 等の spatial transform もすべて停止する。
151
+
152
+ ## 別 platform 向けパッケージ
153
+
154
+ 同じ token SSOT から:
155
+
156
+ | Platform | Package |
157
+ |---|---|
158
+ | Apple (iOS 17+ / macOS 14+ / watchOS 10+ / tvOS 17+) | SPM: `https://github.com/chronista-club/creoui` (target `Creoui`) |
159
+ | Rust | crates.io: `creoui` (Phase 2 で publish 予定、 現状 git/path 参照) |
160
+
161
+ ## Migration
162
+
163
+ 過去 release からの upgrade は [`docs/migration/v0.14-to-v0.18.md`](https://github.com/chronista-club/creoui/blob/main/docs/migration/v0.14-to-v0.18.md) を参照。 v0.17 以降は **5 tier convention 安定保証** (sm/md/lg 由来の rename はこれ以上発生しない設計)。
164
+
165
+ ## License
166
+
167
+ [Apache-2.0](https://github.com/chronista-club/creoui/blob/main/LICENSE)