@cakejp/design-system 0.5.0 → 0.7.0
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 +60 -0
- package/CLAUDE.md +26 -131
- package/README.md +5 -0
- package/bin/init.js +2 -2
- package/contracts/components.json +50 -5
- package/contracts/rules.json +66 -10
- package/dist/index.css +1 -1
- package/dist/index.js +1361 -1194
- package/dist/types/components/foundations/icon-badge.d.ts +18 -0
- package/dist/types/components/primitives/container.d.ts +18 -0
- package/dist/types/components/primitives/list-item.d.ts +4 -1
- package/dist/types/components/primitives/section-header.d.ts +9 -1
- package/dist/types/components/primitives/section.d.ts +26 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +5 -6
- package/src/preset-standalone.css +15 -0
- package/src/preset.css +9 -0
- package/templates/AGENTS.md +1 -1
- package/templates/CLAUDE.md +1 -1
- package/tokens.json +22 -7
- package/AGENTS.md +0 -144
- package/PUBLISHING.md +0 -106
- package/RELEASE.md +0 -205
- package/component-registry.json +0 -1149
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* 丸いアイコンバッジ。アイコンを淡いアクセント背景の円で囲む装飾要素。
|
|
5
|
+
* Card の見出しやリスト項目の先頭に置く「丸アイコン」をDS部品化したもの。
|
|
6
|
+
*
|
|
7
|
+
* 設計上の約束:
|
|
8
|
+
* - **外側 margin を持たない。** 縦間隔は親(Card の `flex-col gap-4`=16px 等)に委ねる。
|
|
9
|
+
* バッジ側に `mt-/mb-` を内蔵すると Card の gap と二重がけになり間延びするため。
|
|
10
|
+
* - アイコン色は `currentColor`(= `--Object-Accent-Primary`)を継承する。
|
|
11
|
+
* 中の Lucide / iconsax アイコンに `color` を渡す必要はない。
|
|
12
|
+
* - 内部 SVG のサイズはバッジが固定する(md=20px / lg=38px)。アイコン側の `size` は不要。
|
|
13
|
+
*/
|
|
14
|
+
declare const iconBadgeVariants: (props?: {
|
|
15
|
+
size?: "lg" | "md";
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp) => string;
|
|
17
|
+
declare function IconBadge({ className, size, ...props }: React.ComponentProps<"div"> & VariantProps<typeof iconBadgeVariants>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { IconBadge, iconBadgeVariants };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* Container — ページ最大幅と左右余白の唯一の担い手。
|
|
5
|
+
*
|
|
6
|
+
* 中央寄せ(`mx-auto`)+ max-width + 左右 gutter だけを持つ薄いレイアウト primitive。
|
|
7
|
+
*
|
|
8
|
+
* 設計上の約束:
|
|
9
|
+
* - **左右 padding は Container だけが持つ。** これを使うコンポーネント/親(Section 等)は
|
|
10
|
+
* 自身で左右 padding を持たない。両方が持つと「左右余白の二重がけ」になる(実バグ)。
|
|
11
|
+
* - 縦余白・背景色は持たない(それは Section の責務)。
|
|
12
|
+
*/
|
|
13
|
+
declare const containerVariants: (props?: {
|
|
14
|
+
size?: "page" | "narrow" | "wide" | "fluid";
|
|
15
|
+
gutter?: "none" | "default" | "tight";
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp) => string;
|
|
17
|
+
declare function Container({ className, size, gutter, ...props }: React.ComponentProps<"div"> & VariantProps<typeof containerVariants>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { Container, containerVariants };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export interface ListItemProps extends React.HTMLAttributes<
|
|
2
|
+
export interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
3
|
/** メインタイトル */
|
|
4
4
|
title: string;
|
|
5
5
|
/** キャプション(サブテキスト) */
|
|
@@ -55,6 +55,9 @@ export interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
55
55
|
* - アイコン付き: `<ListItem title="注文履歴" leftIcon={<Icon />} size="lg" />`
|
|
56
56
|
* - トグル行: `<ListItem title="通知設定" rightType="toggle" toggleChecked={true} />`
|
|
57
57
|
* - テキスト値付き: `<ListItem title="言語" rightType="text" rightText="日本語" />`
|
|
58
|
+
*
|
|
59
|
+
* `href` か `onClick` を渡すとインタラクティブ行になり、hover 背景と focus リングが付く。
|
|
60
|
+
* 表示専用(href/onClick なし)の行は状態スタイルが付かない。
|
|
58
61
|
*/
|
|
59
62
|
declare function ListItem({ title, caption, rightType, rightText, badgeCount, toggleChecked, onToggleChange, leftIcon, leftImageUrl, size, selected, showBorder, showBadgeDot, href, className, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
60
63
|
export { ListItem };
|
|
@@ -25,6 +25,13 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
25
25
|
size?: SectionHeaderSize;
|
|
26
26
|
/** 見出しのHTML要素を上書き(デフォルトは size に応じて h1〜h6 を自動選択) */
|
|
27
27
|
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span";
|
|
28
|
+
/**
|
|
29
|
+
* 配置。`start`(既定)はタイトル+もっと見るの左寄せリスト見出し。
|
|
30
|
+
* `center` はランディング/ガイド系の中央寄せ大見出し(eyebrow + title + subtitle を中央寄せ)。
|
|
31
|
+
*/
|
|
32
|
+
align?: "start" | "center";
|
|
33
|
+
/** タイトルの上に置くスロット(Badge 等の eyebrow ラベル)。中央寄せ見出しで特に有用。 */
|
|
34
|
+
eyebrow?: React.ReactNode;
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* セクションヘッダーコンポーネント
|
|
@@ -46,6 +53,7 @@ export interface SectionHeaderProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
46
53
|
* - `as` で見出しレベルを上書き可能(同一ページに h1 が複数必要な場合など)
|
|
47
54
|
* - `moreHref` 指定時はタイトル+サブタイトル全体がリンクになる(クリック領域拡大)
|
|
48
55
|
* - `action` に任意の ReactNode(Button 等)を渡して右側にアクションを配置可能
|
|
56
|
+
* - `align="center"` でランディング/ガイド系の中央寄せ大見出しに切替(`eyebrow` に Badge 等を載せられる)
|
|
49
57
|
*/
|
|
50
|
-
declare function SectionHeader({ className, title, subtitle, moreHref, moreLabel, onMoreClick, action, onPrev, onNext, prevDisabled, nextDisabled, size, as, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
declare function SectionHeader({ className, title, subtitle, moreHref, moreLabel, onMoreClick, action, onPrev, onNext, prevDisabled, nextDisabled, size, as, align, eyebrow, ...props }: SectionHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
51
59
|
export { SectionHeader };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
/**
|
|
4
|
+
* Section — 全幅の縦リズム+(任意で)背景色付きの帯。
|
|
5
|
+
*
|
|
6
|
+
* 設計上の約束:
|
|
7
|
+
* - **左右 padding を持たない。** 左右余白は中身の {@link Container} が唯一の担い手。
|
|
8
|
+
* 背景色は Section(全幅)が持ち、中央寄せは Container が持つ ── この分担により
|
|
9
|
+
* 「背景帯は画面端まで、コンテンツは中央寄せ」が二重がけなしで成立する。
|
|
10
|
+
* - 縦余白は SP/PC ペアで `--Space-Section-*` トークンを消費する(rem 直書きの撲滅)。
|
|
11
|
+
*
|
|
12
|
+
* 推奨パターン:
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Section spacing="lg" background="subtle">
|
|
15
|
+
* <Container>
|
|
16
|
+
* <SectionHeader align="center" title="…" />
|
|
17
|
+
* </Container>
|
|
18
|
+
* </Section>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const sectionVariants: (props?: {
|
|
22
|
+
spacing?: "sm" | "lg" | "xl" | "md";
|
|
23
|
+
background?: "none" | "accent-subtle" | "subtle";
|
|
24
|
+
} & import("class-variance-authority/types").ClassProp) => string;
|
|
25
|
+
declare function Section({ className, spacing, background, ...props }: React.ComponentProps<"section"> & VariantProps<typeof sectionVariants>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export { Section, sectionVariants };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
|
|
|
22
22
|
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/foundations/dropdown-menu";
|
|
23
23
|
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./components/foundations/form";
|
|
24
24
|
export { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/foundations/hover-card";
|
|
25
|
+
export { IconBadge, iconBadgeVariants } from "./components/foundations/icon-badge";
|
|
25
26
|
export { Input } from "./components/foundations/input";
|
|
26
27
|
export { Label } from "./components/foundations/label";
|
|
27
28
|
export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger } from "./components/foundations/menubar";
|
|
@@ -75,6 +76,8 @@ export { ProgressSteps } from "./components/primitives/progress-steps";
|
|
|
75
76
|
export { QuantitySelector } from "./components/primitives/quantity-selector";
|
|
76
77
|
export { SearchBar } from "./components/primitives/search-bar";
|
|
77
78
|
export { SearchPanel } from "./components/primitives/search-panel";
|
|
79
|
+
export { Container, containerVariants } from "./components/primitives/container";
|
|
80
|
+
export { Section, sectionVariants } from "./components/primitives/section";
|
|
78
81
|
export { SectionHeader } from "./components/primitives/section-header";
|
|
79
82
|
export { ShareButtons } from "./components/primitives/share-buttons";
|
|
80
83
|
export { SideNav } from "./components/primitives/side-nav";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cakejp/design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cake.jp Design System — UI コンポーネント・カラートークン・タイポグラフィ",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -31,15 +31,11 @@
|
|
|
31
31
|
"cakejp-ds": "./bin/init.js"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
|
-
"AGENTS.md",
|
|
35
34
|
"CHANGELOG.md",
|
|
36
35
|
"CLAUDE.md",
|
|
37
36
|
"CLAUDE_PRODUCTION.md",
|
|
38
37
|
"MIGRATION.md",
|
|
39
|
-
"PUBLISHING.md",
|
|
40
|
-
"RELEASE.md",
|
|
41
38
|
"bin",
|
|
42
|
-
"component-registry.json",
|
|
43
39
|
"contracts",
|
|
44
40
|
"dist",
|
|
45
41
|
"scripts/codemod",
|
|
@@ -81,6 +77,7 @@
|
|
|
81
77
|
"build": "tsc -b && vite build",
|
|
82
78
|
"build:lib": "vite build --config vite.config.lib.ts && tsc --project tsconfig.lib.json && tsc-alias --project tsconfig.lib.json",
|
|
83
79
|
"prepack": "npm run build:lib",
|
|
80
|
+
"prepare": "npm run build:lib",
|
|
84
81
|
"postinstall": "node ./bin/init.js postinstall",
|
|
85
82
|
"lint": "eslint .",
|
|
86
83
|
"preview": "vite preview",
|
|
@@ -88,8 +85,10 @@
|
|
|
88
85
|
"build-storybook": "storybook build",
|
|
89
86
|
"lint:scratch": "bash scripts/lint-scratch.sh",
|
|
90
87
|
"lint:reuse": "bash scripts/check-story-reuse.sh",
|
|
88
|
+
"lint:border": "node scripts/check-border-color.mjs",
|
|
91
89
|
"generate:lint-rules": "node scripts/generate-lint-rules.mjs",
|
|
92
|
-
"
|
|
90
|
+
"generate:lookup": "node scripts/generate-component-lookup.mjs",
|
|
91
|
+
"check": "tsc --noEmit && bash scripts/check-deps.sh && bash scripts/check-drift.sh && bash scripts/lint-scratch.sh && bash scripts/check-story-reuse.sh && bash scripts/check-responsive.sh && node scripts/check-border-color.mjs && bash scripts/lint-scratch.sh --components && bash scripts/check-generated-drift.sh",
|
|
93
92
|
"test": "vitest run --config vitest.config.ts"
|
|
94
93
|
},
|
|
95
94
|
"dependencies": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* - Semantic カラートークン(--Text-*, --Surface-*, --Border-* 等)
|
|
19
19
|
* - ダークモード自動切替(.dark クラス)
|
|
20
20
|
* - shadcn bridge トークン(--primary, --foreground 等)
|
|
21
|
+
* - spacing / セクション余白トークン
|
|
21
22
|
* - シャドウ・角丸トークン
|
|
22
23
|
*
|
|
23
24
|
* タイポグラフィ(typo-*)は Tailwind v4 の @utility に依存するため、
|
|
@@ -33,6 +34,20 @@
|
|
|
33
34
|
|
|
34
35
|
/* --- Bridge: Semantic → shadcn tokens --- */
|
|
35
36
|
:root {
|
|
37
|
+
--spacing-1: 0.25rem; /* 4px - scale 1 */
|
|
38
|
+
--spacing-2: 0.5rem; /* 8px - scale 2 */
|
|
39
|
+
--spacing-3: 0.75rem; /* 12px - scale 3 */
|
|
40
|
+
--spacing-4: 1rem; /* 16px - scale 4 */
|
|
41
|
+
--spacing-5: 1.25rem; /* 20px - interpolated */
|
|
42
|
+
--spacing-6: 1.5rem; /* 24px - scale 6 */
|
|
43
|
+
|
|
44
|
+
--Space-Section-xs: 2rem; /* 32px - セクション間ギャップSP / カード上下 */
|
|
45
|
+
--Space-Section-sm: 2.5rem; /* 40px - セクションpadding SP */
|
|
46
|
+
--Space-Section-md: 3rem; /* 48px - Final CTA 上 */
|
|
47
|
+
--Space-Section-lg: 3.5rem; /* 56px - セクションpadding PC */
|
|
48
|
+
--Space-Section-xl: 4rem; /* 64px - HERO上下 / Final CTA下SP */
|
|
49
|
+
--Space-Section-2xl: 5rem; /* 80px - Final CTA下PC */
|
|
50
|
+
|
|
36
51
|
--radius: 0.625rem;
|
|
37
52
|
|
|
38
53
|
--background: var(--Surface-Primary);
|
package/src/preset.css
CHANGED
|
@@ -189,6 +189,15 @@
|
|
|
189
189
|
--spacing-5: 1.25rem; /* 20px - interpolated */
|
|
190
190
|
--spacing-6: 1.5rem; /* 24px - scale 6 */
|
|
191
191
|
|
|
192
|
+
/* Section 余白 tier(セクション縦リズム・8の倍数。spacing.scale の 24px 上限を超える領域)
|
|
193
|
+
用途別の意味的トークン。Section プリミティブと、生CSS/HTML モックの rem 直書き置換に使う。 */
|
|
194
|
+
--Space-Section-xs: 2rem; /* 32px - セクション間ギャップSP / カード上下 */
|
|
195
|
+
--Space-Section-sm: 2.5rem; /* 40px - セクションpadding SP */
|
|
196
|
+
--Space-Section-md: 3rem; /* 48px - Final CTA 上 */
|
|
197
|
+
--Space-Section-lg: 3.5rem; /* 56px - セクションpadding PC */
|
|
198
|
+
--Space-Section-xl: 4rem; /* 64px - HERO上下 / Final CTA下SP */
|
|
199
|
+
--Space-Section-2xl: 5rem; /* 80px - Final CTA下PC */
|
|
200
|
+
|
|
192
201
|
--radius: 0.625rem;
|
|
193
202
|
|
|
194
203
|
--background: var(--Surface-Primary);
|
package/templates/AGENTS.md
CHANGED
|
@@ -11,7 +11,7 @@ Codex(および他の AI エージェント)は UI 作業を始める前に
|
|
|
11
11
|
|
|
12
12
|
| ファイル | 内容 |
|
|
13
13
|
|---------|------|
|
|
14
|
-
| `node_modules/@cakejp/design-system/
|
|
14
|
+
| `node_modules/@cakejp/design-system/CLAUDE.md` | DS 利用ガイド・禁止パターン |
|
|
15
15
|
| `node_modules/@cakejp/design-system/contracts/components.json` | 全コンポーネントの定義・バリアント |
|
|
16
16
|
| `node_modules/@cakejp/design-system/contracts/rules.json` | 禁止パターン・アクセシビリティ要件 |
|
|
17
17
|
| `node_modules/@cakejp/design-system/tokens.json` | カラー・余白・角丸・影・タイポ |
|
package/templates/CLAUDE.md
CHANGED
|
@@ -11,7 +11,7 @@ Codex(および他の AI エージェント)は UI 作業を始める前に
|
|
|
11
11
|
|
|
12
12
|
| ファイル | 内容 |
|
|
13
13
|
|---------|------|
|
|
14
|
-
| `node_modules/@cakejp/design-system/
|
|
14
|
+
| `node_modules/@cakejp/design-system/CLAUDE.md` | DS 利用ガイド・禁止パターン |
|
|
15
15
|
| `node_modules/@cakejp/design-system/contracts/components.json` | 全コンポーネントの定義・バリアント |
|
|
16
16
|
| `node_modules/@cakejp/design-system/contracts/rules.json` | 禁止パターン・アクセシビリティ要件 |
|
|
17
17
|
| `node_modules/@cakejp/design-system/tokens.json` | カラー・余白・角丸・影・タイポ |
|
package/tokens.json
CHANGED
|
@@ -96,6 +96,15 @@
|
|
|
96
96
|
"3": { "px": 12, "usage": "セクション内要素間" },
|
|
97
97
|
"4": { "px": 16, "usage": "セクション間" },
|
|
98
98
|
"6": { "px": 24, "usage": "ダイアログ内パディング" }
|
|
99
|
+
},
|
|
100
|
+
"section": {
|
|
101
|
+
"comment": "セクション縦リズム tier(8の倍数)。preset.css の --Space-Section-* に対応。Section プリミティブが SP/PC ペアで消費する。scale(最大24px) を超える領域専用",
|
|
102
|
+
"xs": { "px": 32, "var": "--Space-Section-xs", "usage": "セクション間ギャップSP / カード上下" },
|
|
103
|
+
"sm": { "px": 40, "var": "--Space-Section-sm", "usage": "セクションpadding SP" },
|
|
104
|
+
"md": { "px": 48, "var": "--Space-Section-md", "usage": "Final CTA 上" },
|
|
105
|
+
"lg": { "px": 56, "var": "--Space-Section-lg", "usage": "セクションpadding PC" },
|
|
106
|
+
"xl": { "px": 64, "var": "--Space-Section-xl", "usage": "HERO上下 / Final CTA下SP" },
|
|
107
|
+
"2xl": { "px": 80, "var": "--Space-Section-2xl", "usage": "Final CTA下PC" }
|
|
99
108
|
}
|
|
100
109
|
},
|
|
101
110
|
|
|
@@ -113,15 +122,21 @@
|
|
|
113
122
|
"md": "calc(var(--radius) - 2px)",
|
|
114
123
|
"lg": "var(--radius)",
|
|
115
124
|
"xl": "calc(var(--radius) + 4px)",
|
|
116
|
-
"
|
|
125
|
+
"2xl": "calc(var(--radius) + 8px)",
|
|
126
|
+
"3xl": "calc(var(--radius) + 12px)",
|
|
127
|
+
"4xl": "calc(var(--radius) + 16px)",
|
|
128
|
+
"base": "0.625rem",
|
|
129
|
+
"_comment": "--radius=10px 基準。px換算: sm=6 md=8 lg=10 xl=14 2xl=18 3xl=22 4xl=26。利用可は xs(2,Tailwind既定)〜2xl + full。3xl/4xl は定義のみで利用禁止(rules.json AI7)"
|
|
117
130
|
},
|
|
118
131
|
|
|
119
132
|
"shadow": {
|
|
120
|
-
"md": "0
|
|
121
|
-
"lg": "
|
|
122
|
-
"menu": "
|
|
123
|
-
"tooltip": "
|
|
124
|
-
"dialog": "
|
|
125
|
-
"modal": "
|
|
133
|
+
"md": "0px 7px 7px 0px rgba(0, 0, 0, 0.07), 0px 2px 16px 0px rgba(0, 0, 0, 0.12)",
|
|
134
|
+
"lg": "0px 12px 32px -4px rgba(24, 39, 75, 0.12), 0px 8px 16px -6px rgba(24, 39, 75, 0.12), 0px 1px 4px 1px rgba(0, 0, 0, 0.2)",
|
|
135
|
+
"menu": "var(--shadow-md)",
|
|
136
|
+
"tooltip": "0px 8px 8px -4px rgba(24, 39, 75, 0.08), 0px 4px 6px -4px rgba(24, 39, 75, 0.12)",
|
|
137
|
+
"dialog": "var(--shadow-lg)",
|
|
138
|
+
"modal": "var(--shadow-lg)",
|
|
139
|
+
"overlay": "0 24px 80px rgba(24, 39, 75, 0.16)",
|
|
140
|
+
"_comment": "preset.css の --shadow-* と同期(正)。md/lg は Tailwind 既定を DS 値に再定義済み。xl/2xl は使用禁止(rules.json R53)"
|
|
126
141
|
}
|
|
127
142
|
}
|
package/AGENTS.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
# Cake.jp Design System — AGENTS.md(Codex向け)
|
|
2
|
-
|
|
3
|
-
## このDSについて
|
|
4
|
-
|
|
5
|
-
Cake.jp のフロントエンドとデザインシステムを正式に接続する統合デザインシステム。
|
|
6
|
-
EC / BtoC / コマース向け。**3-tier 構造で 104 コンポーネント**:
|
|
7
|
-
- foundations: 46個(shadcn ベース汎用 UI)
|
|
8
|
-
- primitives: 35個(業界汎用パターン・jobboard 等他事業でも再利用可)
|
|
9
|
-
- ec: 23個(Cake.jp / EC 事業特化)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## 必須: セッション開始時に読み込むファイル
|
|
14
|
-
|
|
15
|
-
Codex はファイルを自動読み込みしないため、**タスク開始前に以下を明示的に読み込むこと**:
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
1. contracts/rules.json # 禁止パターン・アクセシビリティ要件
|
|
19
|
-
2. contracts/components.json # 全104コンポーネント定義(3-tier)
|
|
20
|
-
3. tokens.json # カラー・タイポグラフィ・スペーシングトークン
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
本番実装・新規コンポーネント作成の場合はさらに:
|
|
24
|
-
```
|
|
25
|
-
4. CLAUDE_PRODUCTION.md # 本番参照ルール・Figmaチェックリスト
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## 技術スタック
|
|
31
|
-
|
|
32
|
-
- React 19 + TypeScript
|
|
33
|
-
- Vite(ビルド)
|
|
34
|
-
- **Tailwind CSS v4**(`@import "tailwindcss"` 構文。`@tailwind base` / `@tailwind components` は v3 記法で**使用禁止**)
|
|
35
|
-
- shadcn/ui(Radix UI ベース、Cake.jp テーマ適用済み)
|
|
36
|
-
- Storybook(`@storybook/react-vite`)
|
|
37
|
-
- CVA(class-variance-authority)でバリアント管理
|
|
38
|
-
- **Lucide React + iconsax-react**(アイコン。`heroicons` `phosphor-icons` への置き換え禁止)
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## ディレクトリ構成
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
src/
|
|
46
|
-
├── components/
|
|
47
|
-
│ ├── foundations/ # shadcn ベース汎用 UI(46個・全事業共通)
|
|
48
|
-
│ ├── primitives/ # 業界汎用パターン(35個・jobboard等他事業でも再利用可)
|
|
49
|
-
│ ├── ec/ # Cake.jp / EC 事業特化(23個・商品・配送・クーポン等)
|
|
50
|
-
│ └── pages/ # ページ単位のストーリー
|
|
51
|
-
├── prototypes/ # /mock スキルで生成されたプロトタイプ
|
|
52
|
-
├── lib/
|
|
53
|
-
│ └── utils.ts # cn() ユーティリティ
|
|
54
|
-
└── index.css # カラートークン定義 + Tailwind 設定
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 3層構造の依存ルール
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
ec/ ← Cake.jp 特化(最上位)
|
|
61
|
-
↓
|
|
62
|
-
primitives/ ← 業界汎用パターン
|
|
63
|
-
↓
|
|
64
|
-
foundations/ ← shadcn ベース(最下位)
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
- `foundations/` は他層に依存しない
|
|
68
|
-
- `primitives/` は `foundations/` のみ参照可
|
|
69
|
-
- `ec/` は `foundations/` と `primitives/` を参照可
|
|
70
|
-
- **逆方向の依存は禁止**(`bash scripts/check-deps.sh` で検証)
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## ❌ スクラッチコード禁止ルール(強制)
|
|
75
|
-
|
|
76
|
-
### 書く前ゲート
|
|
77
|
-
|
|
78
|
-
以下のいずれかを書こうとしたら**手を止めて** `contracts/components.json` と Storybook で同等パターンを探すこと:
|
|
79
|
-
|
|
80
|
-
| 書こうとしているもの | 確認先 |
|
|
81
|
-
|-------------------|--------|
|
|
82
|
-
| `::before` / `::after` 装飾(バー・ドット・矢印) | SectionHeader, Chip, Badge, ListItem の variants |
|
|
83
|
-
| `rgba(...)` / `#xxxxxx` ハードコードカラー | `tokens.json` のトークン名を使う |
|
|
84
|
-
| `box-shadow: ...` カスタム影 | `tokens.json` の `shadow.*` |
|
|
85
|
-
| `border-radius: ...px` カスタム角丸 | `tokens.json` の `radius.*` |
|
|
86
|
-
| カスタムフォントサイズ・ウェイト | `tokens.json` の `typography.*` |
|
|
87
|
-
|
|
88
|
-
DSに存在しない場合のみカスタム実装を許可。その場合はコメントで理由を記載すること。
|
|
89
|
-
|
|
90
|
-
### 書いた後ゲート(強制)
|
|
91
|
-
|
|
92
|
-
**.tsx / .css / .module.css を編集したら必ず実行**:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
bash scripts/lint-scratch.sh
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
エラーが出たら修正してから次のタスクに進むこと。**エラーありのまま完了報告禁止。**
|
|
99
|
-
|
|
100
|
-
**コンポーネントを追加・削除したら必ず実行**:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
bash scripts/check-drift.sh # contracts と実ファイルの一致を検証
|
|
104
|
-
bash scripts/check-deps.sh # 3-tier 依存方向違反を検出
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
`contracts/components.json` の `meta.counts` と実ファイル数が一致していること、
|
|
108
|
-
foundations → primitives → ec の依存方向が正しいことを確認すること。
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## コンポーネント追加時のチェックリスト
|
|
113
|
-
|
|
114
|
-
- [ ] `src/index.tsx` にエクスポートを追加
|
|
115
|
-
- [ ] `contracts/components.json` にコンポーネント定義を追加
|
|
116
|
-
- [ ] `contracts/components.json` の `meta.counts` を更新
|
|
117
|
-
- [ ] `bash scripts/check-drift.sh` を実行して乖離がないことを確認
|
|
118
|
-
- [ ] Storybook のストーリーファイル(`.stories.tsx`)を作成
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## ドキュメント構成
|
|
123
|
-
|
|
124
|
-
| ファイル | 内容 |
|
|
125
|
-
|---------|------|
|
|
126
|
-
| **AGENTS.md**(本ファイル) | Codex向け。セッション開始時の読み込み指示・編集後コマンドを明記 |
|
|
127
|
-
| **CLAUDE.md** | Claude Code向け概要(フック自動実行) |
|
|
128
|
-
| **contracts/components.json** | 全104コンポーネントの構造化定義(3-tier・バリアント・アクセシビリティ要件) |
|
|
129
|
-
| **contracts/rules.json** | 禁止パターン・アクセシビリティ要件・タイポグラフィ定義 |
|
|
130
|
-
| **tokens.json** | カラー・スペーシング・シャドウトークンの機械可読定義 |
|
|
131
|
-
| **CLAUDE_PRODUCTION.md** | 本番実装参照ルール・Figmaチェックリスト(Cake.jp固有) |
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## 重要な制約(AI生成コードの典型的な誤り)
|
|
136
|
-
|
|
137
|
-
`contracts/rules.json` の `aiPatterns` セクションで詳細を確認すること。主な注意点:
|
|
138
|
-
|
|
139
|
-
- **価格表記**: `¥{数字,区切り}(税込)` — `円` `税込み` `(税込)` は禁止
|
|
140
|
-
- **日付表記**: `M月D日(曜日)` — `YYYY/MM/DD` や英語表記禁止
|
|
141
|
-
- **aria-label**: 日本語で記述 — 英語 aria-label 禁止
|
|
142
|
-
- **input type="date"**: 使用禁止 — PopoverとCalendarを組み合わせる
|
|
143
|
-
- **Tag に onClick**: 禁止 — 押せるものは Chip を使う
|
|
144
|
-
- **SectionHeader 手書き**: 禁止 — `SectionHeader` コンポーネントを使う
|
package/PUBLISHING.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# 公開とタグ付け(人向けクイックガイド)
|
|
2
|
-
|
|
3
|
-
@cakejp/design-system を npm に公開する方法と、Git タグの仕組みについて。
|
|
4
|
-
|
|
5
|
-
詳しい運用ルール(曜日・週次フロー等)は [`RELEASE.md`](./RELEASE.md) を参照。
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## 結論 — やること
|
|
10
|
-
|
|
11
|
-
1. **main に変更をマージ**(PR 経由)
|
|
12
|
-
2. **`package.json` の `version` を上げる**(例: `0.3.3` → `0.3.4`)
|
|
13
|
-
3. **`gh workflow run publish.yml -f dry_run=false`** を実行
|
|
14
|
-
→ 自動で npm publish + Git タグ作成(`v0.3.4`)まで一気にやる
|
|
15
|
-
|
|
16
|
-
タグは **手動で打たない**。Action が自動で作る。
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## アクション(GitHub Actions)の実行方法
|
|
21
|
-
|
|
22
|
-
### A. GitHub の Web UI からポチる
|
|
23
|
-
|
|
24
|
-
1. https://github.com/flashpark/cake-design-system にアクセス
|
|
25
|
-
2. 上の「**Actions**」タブをクリック
|
|
26
|
-
3. 左サイドバーの「**Publish to npm**」を選択
|
|
27
|
-
4. 右上の「**Run workflow**」ボタン
|
|
28
|
-
5. ダイアログで `Branch: main` のまま、`Dry run` のチェックは外す
|
|
29
|
-
6. 緑の「**Run workflow**」を押す
|
|
30
|
-
|
|
31
|
-
### B. ターミナルから一発
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# 念のため事前確認(npm publish --dry-run のみ実行、本番に影響なし)
|
|
35
|
-
gh workflow run publish.yml -f dry_run=true
|
|
36
|
-
|
|
37
|
-
# 本番 publish + タグ作成
|
|
38
|
-
gh workflow run publish.yml -f dry_run=false
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## タグ付けはどうなってる?
|
|
44
|
-
|
|
45
|
-
### 自動
|
|
46
|
-
|
|
47
|
-
`gh workflow run publish.yml` 実行時に **デフォルトで Git タグ `v{version}` が自動作成・push** される。
|
|
48
|
-
|
|
49
|
-
- `package.json` の `version: 0.3.4` で実行 → `v0.3.4` タグが main にぶら下がる
|
|
50
|
-
- 既にタグ存在する場合は skip(重複エラーにならない)
|
|
51
|
-
|
|
52
|
-
### 手動で打ちたいケース
|
|
53
|
-
|
|
54
|
-
通常は不要。やるなら:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
git tag v0.3.4
|
|
58
|
-
git push origin v0.3.4
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### タグを作らずに publish したい
|
|
62
|
-
|
|
63
|
-
`tag_after_publish: false` を指定:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
gh workflow run publish.yml -f dry_run=false -f tag_after_publish=false
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 何が公開されたか確認
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
# npm に反映されたか
|
|
75
|
-
npm view @cakejp/design-system version
|
|
76
|
-
# → 例: 0.3.4
|
|
77
|
-
|
|
78
|
-
# 全 version 一覧
|
|
79
|
-
npm view @cakejp/design-system versions
|
|
80
|
-
|
|
81
|
-
# タグ一覧
|
|
82
|
-
git fetch --tags origin
|
|
83
|
-
git tag --list | sort -V
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
公開直後は npm のキャッシュ反映に **30〜90 秒**かかる。
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## トラブルシュート
|
|
91
|
-
|
|
92
|
-
| 症状 | 確認 |
|
|
93
|
-
|------|------|
|
|
94
|
-
| Action 実行できない | Settings > Actions > Workflow permissions が `Read and write` か |
|
|
95
|
-
| publish が失敗する | NPM_TOKEN が有効期限切れの可能性 |
|
|
96
|
-
| タグが作られない | Workflow ログで「Create release tag」step を確認 |
|
|
97
|
-
| 「金曜にやるな」と怒られる | [`RELEASE.md`](./RELEASE.md) の Read-Only Friday ルール参照 |
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## 関連ドキュメント
|
|
102
|
-
|
|
103
|
-
- [`RELEASE.md`](./RELEASE.md) — 詳細運用ルール(曜日・チェックリスト・緊急 hotfix 等)
|
|
104
|
-
- [`CHANGELOG.md`](./CHANGELOG.md) — 各バージョンの変更履歴
|
|
105
|
-
- [`MIGRATION.md`](./MIGRATION.md) — メジャーバージョンの移行手順
|
|
106
|
-
- [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) — Workflow 定義
|