pasika 0.1.4 → 0.2.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.
Files changed (72) hide show
  1. package/README.md +40 -55
  2. package/dist/eslint/pasika/index.d.ts +18 -0
  3. package/dist/eslint/pasika/index.js +21 -3
  4. package/dist/eslint/pasika/rules/enforce-barrel-exports.d.ts +9 -0
  5. package/dist/eslint/pasika/rules/enforce-barrel-exports.js +78 -0
  6. package/dist/eslint/pasika/rules/enforce-cn-merge.d.ts +9 -0
  7. package/dist/eslint/pasika/rules/enforce-cn-merge.js +84 -0
  8. package/dist/eslint/pasika/rules/enforce-cva-variant-props.d.ts +9 -0
  9. package/dist/eslint/pasika/rules/enforce-cva-variant-props.js +76 -0
  10. package/dist/eslint/pasika/rules/filename-case.d.ts +2 -0
  11. package/dist/eslint/pasika/rules/filename-case.js +100 -0
  12. package/dist/eslint/pasika/rules/import-boundaries.d.ts +2 -0
  13. package/dist/eslint/pasika/rules/{organization-imports.js → import-boundaries.js} +11 -1
  14. package/dist/eslint/pasika/rules/no-arbitrary-tailwind.d.ts +9 -0
  15. package/dist/eslint/pasika/rules/no-arbitrary-tailwind.js +107 -0
  16. package/dist/eslint/pasika/rules/no-mixed-concerns.d.ts +9 -0
  17. package/dist/eslint/pasika/rules/no-mixed-concerns.js +84 -0
  18. package/package.json +5 -16
  19. package/claude/hooks/.vulyk +0 -3
  20. package/claude/hooks/AGENTS.md +0 -3
  21. package/claude/hooks/CLAUDE.md +0 -1
  22. package/claude/hooks/claude-hooks.md +0 -30
  23. package/claude/hooks/notification.sh +0 -38
  24. package/claude/hooks/protect-files.sh +0 -21
  25. package/claude/hooks/status-line/index.js +0 -57
  26. package/claude/scripts/render-settings.ts +0 -223
  27. package/claude/settings.base.json +0 -38
  28. package/dist/claude/scripts/render-settings.js +0 -145
  29. package/dist/eslint/pasika/rules/organization-imports.d.ts +0 -2
  30. package/dist/eslint.config.js +0 -7
  31. package/dist/scripts/pasika.js +0 -59
  32. package/docs/agent-conventions.md +0 -21
  33. package/docs/claude/hooks.md +0 -30
  34. package/docs/code-organization-guide/code-organization-guide.md +0 -65
  35. package/docs/code-organization-guide/references/application-architecture-reference.md +0 -107
  36. package/docs/code-organization-guide/rules/component-placement-rule.md +0 -135
  37. package/docs/code-organization-guide/rules/configuration-rule.md +0 -42
  38. package/docs/code-organization-guide/rules/constants-rule.md +0 -77
  39. package/docs/code-organization-guide/rules/exports-and-imports-rule.md +0 -81
  40. package/docs/code-organization-guide/rules/folder-nesting-rule.md +0 -83
  41. package/docs/code-organization-guide/rules/hook-extraction-rule.md +0 -142
  42. package/docs/code-organization-guide/rules/interactive-component-rule.md +0 -100
  43. package/docs/code-organization-guide/rules/jsx-hygiene-rule.md +0 -68
  44. package/docs/code-organization-guide/rules/locales-rule.md +0 -55
  45. package/docs/code-organization-guide/rules/nameable-visual-concept-rule.md +0 -66
  46. package/docs/code-organization-guide/rules/native-prop-forwarding-rule.md +0 -38
  47. package/docs/code-organization-guide/rules/no-mixed-concerns-rule.md +0 -64
  48. package/docs/code-organization-guide/rules/repeated-structure-rule.md +0 -93
  49. package/docs/code-organization-guide/rules/smart-vs-dumb-component-rule.md +0 -116
  50. package/docs/code-organization-guide/rules/sole-state-owner-rule.md +0 -102
  51. package/docs/code-organization-guide/rules/types-and-schemas-rule.md +0 -138
  52. package/docs/code-organization-guide/rules/utilities-rule.md +0 -87
  53. package/docs/documentation-guide/_templates/guide.md +0 -19
  54. package/docs/documentation-guide/_templates/reference.md +0 -17
  55. package/docs/documentation-guide/_templates/rule.md +0 -21
  56. package/docs/documentation-guide/documentation-guide.md +0 -13
  57. package/docs/documentation-guide/references/documentation-types-reference.md +0 -9
  58. package/docs/documentation-guide/rules/guide-creation-rule.md +0 -112
  59. package/docs/documentation-guide/rules/reference-creation-rule.md +0 -132
  60. package/docs/documentation-guide/rules/rule-creation-rule.md +0 -81
  61. package/docs/documentation-guide/rules/template-usage-rule.md +0 -48
  62. package/docs/shadcn-theme.md +0 -121
  63. package/docs/styling-guide/rules/class-composition-rule.md +0 -32
  64. package/docs/styling-guide/rules/color-role-naming-rule.md +0 -115
  65. package/docs/styling-guide/rules/component-state-rule.md +0 -26
  66. package/docs/styling-guide/rules/component-variant-rule.md +0 -128
  67. package/docs/styling-guide/rules/global-style-system-rule.md +0 -63
  68. package/docs/styling-guide/rules/style-placement-rule.md +0 -49
  69. package/docs/styling-guide/rules/tailwind-utility-rule.md +0 -48
  70. package/docs/styling-guide/rules/theme-and-utility-definition-rule.md +0 -129
  71. package/docs/styling-guide/rules/theme-token-rule.md +0 -32
  72. package/docs/styling-guide/styling-guide.md +0 -17
@@ -1,115 +0,0 @@
1
- # Color Role Naming Rule
2
-
3
- Color names should reveal what a utility is safe to do, while keeping broadly reusable colors pleasant to use. This rule makes background-only colors, readable text colors, and complete treatments distinct without adding ceremony to general-purpose colors.
4
-
5
- - A color that is intentionally reusable across background, text, border, ring, or other CSS properties MUST use its role name without a property suffix.
6
- - A color intended only for a background MUST use the `-canvas` suffix, and a color intended only for readable text MUST use the `-ink` suffix.
7
- - A `*-canvas` or `*-ink` value MUST remain a private CSS variable and be exposed only through its matching property-specific custom utility.
8
- - `base-canvas` and `base-ink` MUST be applied only by the document body or the project's global base layer as the default page pair.
9
- - A repeated canvas, ink, and related treatment MUST become a `surface-*` custom utility that owns the complete treatment.
10
- - A general-purpose color backed by runtime-selectable theme variables MUST use `@theme inline` so Tailwind utilities remain stable while values change.
11
- - A one-off background MAY use a `*-canvas` utility directly when it does not form a repeated named surface.
12
-
13
- ## Incorrect — Property-Specific Colors Exposed Broadly
14
-
15
- ```css
16
- @theme {
17
- --color-primary-background: #d87943;
18
- --color-primary-text: #ffffff;
19
- }
20
- ```
21
-
22
- ```tsx
23
- <main className="bg-page text-page-text" />
24
- <button className="bg-primary-background text-primary-text">Save</button>
25
- ```
26
-
27
- Why: the names are inconsistent, the document defaults can be applied anywhere, and the repeated button treatment has no single owner.
28
-
29
- ## Correct — Color Roles Expose Their Intended API
30
-
31
- ```css
32
- :root {
33
- --base-canvas: #ffffff;
34
- --base-ink: #111827;
35
- --primary: #d87943;
36
- --primary-canvas: #d87943;
37
- --primary-ink: #ffffff;
38
- }
39
-
40
- .dark {
41
- --base-canvas: #111827;
42
- --base-ink: #f9fafb;
43
- --primary: #f1a06e;
44
- --primary-canvas: #f1a06e;
45
- --primary-ink: #111827;
46
- }
47
-
48
- @theme {
49
- --*: initial;
50
- --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.15);
51
- }
52
-
53
- @theme inline {
54
- --color-primary: var(--primary);
55
- }
56
-
57
- @utility bg-base-canvas {
58
- @apply bg-(--base-canvas);
59
- }
60
-
61
- @utility text-base-ink {
62
- @apply text-(--base-ink);
63
- }
64
-
65
- @utility bg-primary-canvas {
66
- @apply bg-(--primary-canvas);
67
- }
68
-
69
- @utility text-primary-ink {
70
- @apply text-(--primary-ink);
71
- }
72
-
73
- @utility surface-primary {
74
- @apply bg-primary-canvas text-primary-ink shadow-sm;
75
-
76
- &:hover {
77
- @apply brightness-105;
78
- }
79
- }
80
-
81
- @layer base {
82
- body {
83
- @apply bg-base-canvas text-base-ink;
84
- }
85
- }
86
- ```
87
-
88
- ```tsx
89
- // `primary` is useful for more than one CSS property.
90
- <a className="text-primary" />
91
- <button className="surface-primary">Save</button>
92
-
93
- // This background is a one-off rather than a named surface.
94
- <aside className="bg-primary-canvas text-primary-ink" />
95
- ```
96
-
97
- Why: general-purpose colors stay suffix-free, property-specific colors reveal their role, the page defaults have one owner, and the reusable primary treatment owns its colors and behavior together.
98
-
99
- ## Promotion Path
100
-
101
- Promote styling only as its reuse or design meaning grows:
102
-
103
- ```txt
104
- Tailwind utility -> theme color -> paired color -> surface utility -> component variant
105
- ```
106
-
107
- ## When To Create a Named Surface
108
-
109
- Create a named `surface-*` utility when one or more of these signals applies:
110
-
111
- - The combination repeats in multiple places.
112
- - The combination has a clear product or design meaning.
113
- - Designers refer to the combination as a named treatment.
114
- - The combination needs to stay consistent across components.
115
- - The treatment includes more than color, such as a border, hover state, or shadow.
@@ -1,26 +0,0 @@
1
- # Component State Rule
2
-
3
- Visual state communicates whether a component can be used and what will happen when it is used. This rule keeps that feedback owned by the component rather than reconstructed by every caller.
4
-
5
- - A component MUST provide a visually distinguishable treatment for every state it supports, including hover, focus, active, disabled, selected, loading, and error states when applicable.
6
- - Components MUST keep state styling with the component or its variant definition when the state is intrinsic to its behavior.
7
- - Components SHOULD use native semantic elements and attributes so browser, keyboard, and assistive-technology behavior matches the visual state.
8
- - Components MAY accept state props when the state is controlled by their parent.
9
-
10
- ## Incorrect — State Styled Only with Classes
11
-
12
- ```tsx
13
- <Button className={isSaving ? "pointer-events-none opacity-50" : ""}>Save</Button>
14
- ```
15
-
16
- Why: every caller has to reconstruct the saving or disabled treatment, and the button does not receive a semantic disabled state.
17
-
18
- ## Correct — State Exposed Through Component Props
19
-
20
- ```tsx
21
- <Button disabled={isSaving} loading={isSaving}>
22
- Save
23
- </Button>
24
- ```
25
-
26
- Why: the component owns its loading and disabled treatment through a stable API, and the same ownership applies to every other state it supports.
@@ -1,128 +0,0 @@
1
- # Component Variant Rule
2
-
3
- When callers choose between a component's visual appearances, the styling definition and TypeScript API need one source of truth. This rule uses CVA for named choices and reserves `cn` for standalone boolean conditions.
4
-
5
- - A component that lets callers choose between named visual appearances MUST define those choices with `cva`.
6
- - Component variant prop types MUST be derived with `VariantProps<typeof componentVariants>`.
7
- - Component props MUST NOT manually duplicate a union already defined by the CVA configuration.
8
- - A boolean appearance input MUST use conditional `cn()` when it only adds or removes one standalone class treatment.
9
- - A boolean appearance input MUST use a CVA variant when both boolean values have explicit treatments or when the boolean participates in a compound variant.
10
- - A component MUST NOT expose separate class-name props for internal elements to vary their appearance.
11
- - A component MAY expose structured content slots when callers need to provide content rather than alter internal styling.
12
-
13
- ## Incorrect — Variant Union Duplicated by Hand
14
-
15
- ```tsx
16
- const buttonVariants = cva("inline-flex items-center", {
17
- variants: {
18
- size: {
19
- sm: "h-8 px-3",
20
- lg: "h-11 px-5",
21
- },
22
- },
23
- });
24
-
25
- type ButtonProps = React.ComponentProps<"button"> & {
26
- size?: "sm" | "lg";
27
- };
28
- ```
29
-
30
- Why: the accepted `size` values now live in both CVA and a handwritten prop union, so either side can change without the other.
31
-
32
- ## Correct — Props Derived from CVA
33
-
34
- ```tsx
35
- const buttonVariants = cva("inline-flex items-center", {
36
- variants: {
37
- size: {
38
- sm: "h-8 px-3",
39
- lg: "h-11 px-5",
40
- },
41
- tone: {
42
- primary: "surface-primary",
43
- danger: "surface-danger",
44
- },
45
- },
46
- defaultVariants: {
47
- size: "sm",
48
- tone: "primary",
49
- },
50
- });
51
-
52
- type ButtonProps = React.ComponentProps<"button"> & VariantProps<typeof buttonVariants>;
53
-
54
- export default function Button({ size, tone, className, ...props }: ButtonProps): React.JSX.Element {
55
- return <button className={cn(buttonVariants({ size, tone }), className)} {...props} />;
56
- }
57
- ```
58
-
59
- Why: the CVA definition owns the accepted values, defaults, and classes, while `VariantProps` derives the public TypeScript API from the same source.
60
-
61
- ## Incorrect — Standalone Boolean Added to CVA
62
-
63
- ```tsx
64
- const buttonVariants = cva("inline-flex", {
65
- variants: {
66
- loading: {
67
- true: "cursor-wait opacity-70",
68
- false: "",
69
- },
70
- },
71
- });
72
- ```
73
-
74
- Why: one boolean merely adds a standalone treatment and has no compound relationship, so CVA adds configuration without a styling matrix.
75
-
76
- ## Correct — Standalone Boolean Uses `cn`
77
-
78
- ```tsx
79
- <button className={cn(buttonVariants({ size, tone }), loading && "cursor-wait opacity-70", className)} />
80
- ```
81
-
82
- Why: the named appearance choices stay in CVA while the independent boolean remains a direct conditional class.
83
-
84
- ## Incorrect — Compound Boolean Styling Split Across Conditions
85
-
86
- ```tsx
87
- <button
88
- className={cn(
89
- buttonVariants({ tone }),
90
- loading && "cursor-wait",
91
- loading && tone === "primary" && "surface-primary-loading",
92
- loading && tone === "danger" && "surface-danger-loading",
93
- )}
94
- />
95
- ```
96
-
97
- Why: the boolean changes treatment according to another variant, but the styling matrix is spread across conditional expressions outside CVA.
98
-
99
- ## Correct — Boolean with Compound Styling Uses CVA
100
-
101
- ```tsx
102
- const buttonVariants = cva("inline-flex", {
103
- variants: {
104
- tone: {
105
- primary: "surface-primary",
106
- danger: "surface-danger",
107
- },
108
- loading: {
109
- true: "cursor-wait",
110
- false: "cursor-default",
111
- },
112
- },
113
- compoundVariants: [
114
- {
115
- tone: "primary",
116
- loading: true,
117
- className: "surface-primary-loading",
118
- },
119
- {
120
- tone: "danger",
121
- loading: true,
122
- className: "surface-danger-loading",
123
- },
124
- ],
125
- });
126
- ```
127
-
128
- Why: both boolean values have explicit treatment and loading changes by tone, so CVA owns the complete styling matrix.
@@ -1,63 +0,0 @@
1
- # Global Style System Rule
2
-
3
- Global CSS is the integration point for Tailwind registration, the project theme, base styles, and imported style domains. This rule keeps one active entry point and a predictable ownership order.
4
-
5
- - A repository MUST have one active global stylesheet that owns Tailwind registration and imports every global style domain it uses.
6
- - The global stylesheet MUST reset the default Tailwind theme and register the project's explicit theme values.
7
- - Static theme values MUST live directly in `@theme`, while selector-driven variable mappings MUST live in `@theme inline`.
8
- - Global CSS MUST be ordered as imports, Tailwind and custom-variant registration, theme definitions and selectors, custom utilities, base styles, keyframes, then unavoidable global selectors.
9
- - Imported global style domains MUST have one owner and MUST NOT duplicate theme values or utilities defined by another domain.
10
-
11
- ## Incorrect — Global Styles Split Across Unrelated Files
12
-
13
- ```css
14
- /* Theme values and component recipes compete across unrelated files. */
15
- .save-button {
16
- @apply bg-primary;
17
- }
18
-
19
- @theme {
20
- --color-primary: #7c3aed;
21
- }
22
- ```
23
-
24
- Why: a component recipe sits globally beside an unreset theme, and the stylesheet does not establish a clear integration order.
25
-
26
- ## Correct — One Global Stylesheet Owns the System
27
-
28
- ```css
29
- @import "tailwindcss";
30
-
31
- @custom-variant dark (&:where(.dark, .dark *));
32
-
33
- @theme {
34
- --*: initial;
35
- --spacing: 0.25rem;
36
- }
37
-
38
- :root {
39
- --base-canvas: #ffffff;
40
- --base-ink: #111827;
41
- }
42
-
43
- .dark {
44
- --base-canvas: #111827;
45
- --base-ink: #ffffff;
46
- }
47
-
48
- @utility bg-base-canvas {
49
- @apply bg-(--base-canvas);
50
- }
51
-
52
- @utility text-base-ink {
53
- @apply text-(--base-ink);
54
- }
55
-
56
- @layer base {
57
- body {
58
- @apply bg-base-canvas text-base-ink;
59
- }
60
- }
61
- ```
62
-
63
- Why: one entry point registers Tailwind, resets the theme, defines selector-driven values, exposes intended utilities, and applies document defaults in a predictable order.
@@ -1,49 +0,0 @@
1
- # Style Placement Rule
2
-
3
- Every project-owned style needs one implementation owner. This rule decides whether styling belongs beside component markup, in a named custom utility, or behind an unavoidable global selector.
4
-
5
- - Single-use component styling MUST stay colocated in the component through Tailwind utility classes or a local class constant.
6
- - A reusable behavior or treatment that has a stable design meaning MUST become a named custom utility.
7
- - A third-party selector, rich-content selector, document-state selector, browser selector, or pseudo-element-heavy effect that controlled JSX cannot own MAY use an unavoidable global selector.
8
- - An unavoidable global selector MUST compose project-owned declarations with `@apply`.
9
- - Component recipes MUST NOT become global selectors merely to shorten markup.
10
- - Literal arbitrary values MUST NOT replace missing project tokens or named utilities in component markup.
11
-
12
- ## Incorrect — Component Recipe Defined Globally
13
-
14
- ```css
15
- /* globals.css */
16
- .settings-save-button {
17
- @apply inline-flex rounded-lg px-3 py-2;
18
- }
19
- ```
20
-
21
- Why: a one-off component recipe is separated from the markup that owns it and creates a global selector to maintain.
22
-
23
- ## Correct — Single-Use Styling Kept with the Component
24
-
25
- ```tsx
26
- <button className="inline-flex rounded-lg px-3 py-2">Save</button>
27
- ```
28
-
29
- Why: the local treatment stays with its component, while global selectors remain reserved for markup or browser behavior that controlled JSX cannot own.
30
-
31
- ## Incorrect — Raw Declarations in an Unavoidable Selector
32
-
33
- ```css
34
- .external-player .controls {
35
- display: none;
36
- }
37
- ```
38
-
39
- Why: third-party markup justifies the global selector, but the project-owned declaration still bypasses Tailwind composition.
40
-
41
- ## Correct — Global Selector Uses `@apply`
42
-
43
- ```css
44
- .external-player .controls {
45
- @apply hidden;
46
- }
47
- ```
48
-
49
- Why: the global selector owns an unavoidable third-party boundary while its declaration stays inside the project's Tailwind system.
@@ -1,48 +0,0 @@
1
- # Tailwind Utility Rule
2
-
3
- Utility classes are most useful when they describe a component's local layout and appearance directly beside the element they affect. This rule prevents abstractions from hiding simple styling decisions.
4
-
5
- - Component markup MUST use static Tailwind utility classes for local layout, spacing, typography, and straightforward visual styling.
6
- - Components MUST NOT construct Tailwind class names from runtime fragments such as `bg-${color}`.
7
- - Components MUST use the closest project token or built-in utility for a static design value.
8
- - Components MUST NOT use literal arbitrary-value classes such as `top-[13px]` or `text-[#50d71e]` for project-owned styling.
9
- - A missing static design value MUST become an explicit project token or a named custom utility instead of an arbitrary literal in markup.
10
- - A CSS custom property MAY use Tailwind's custom-property shorthand when a named utility intentionally exposes that property-specific value.
11
-
12
- ## Incorrect — Tailwind Classes Constructed at Runtime
13
-
14
- ```tsx
15
- <div className={`p-${spacing} bg-${tone}`} />
16
- ```
17
-
18
- Why: the class scanner cannot reliably see runtime-built utility names, and the available styles depend on runtime string construction.
19
-
20
- ## Correct — Static Tailwind Classes
21
-
22
- ```tsx
23
- <div className="bg-muted p-4" />
24
- ```
25
-
26
- Why: the utilities are statically discoverable and show the element's local treatment where it is rendered.
27
-
28
- ## Incorrect — Literal Arbitrary Design Value
29
-
30
- ```tsx
31
- <div className="top-[13px]" />
32
- ```
33
-
34
- Why: the design value is hidden in markup and cannot be tracked as part of the project's explicit token set.
35
-
36
- ## Correct — Explicit Project Token
37
-
38
- ```css
39
- @theme {
40
- --spacing-floating-offset: 0.8125rem;
41
- }
42
- ```
43
-
44
- ```tsx
45
- <div className="top-floating-offset" />
46
- ```
47
-
48
- Why: the named token makes the static design value searchable and gives every consumer one stable utility.
@@ -1,129 +0,0 @@
1
- # Theme and Utility Definition Rule
2
-
3
- Tailwind theme namespaces generate broad utility APIs, while custom utilities expose one intentional treatment. This rule resets unused defaults and chooses the narrowest public API for every project-owned design value.
4
-
5
- - The project MUST reset Tailwind's default theme with `--*: initial` and explicitly define every theme value it uses.
6
- - A static design value intended to generate a Tailwind utility namespace MUST be defined through `@theme`.
7
- - A static theme value MUST be defined directly in plain `@theme` when it has no runtime variable indirection.
8
- - A theme value that references a CSS variable changed by a theme selector or custom variant MUST be mapped through `@theme inline`.
9
- - A property-specific value MUST remain a private CSS variable and be exposed through one named `@utility` rather than a broad theme namespace.
10
- - A repeated multi-property treatment MUST be defined through one named `@utility`.
11
- - Project-owned style declarations inside `@utility` and unavoidable global selectors MUST use `@apply`.
12
- - A custom utility MUST use Tailwind custom-property or arbitrary-property utility syntax through `@apply` when no named built-in utility represents the property value.
13
- - A custom utility that owns interaction behavior MUST keep its hover, active, focus, and disabled treatments in the same utility block.
14
- - Component markup MUST NOT contain literal arbitrary values in place of missing project tokens or utilities.
15
-
16
- ## Incorrect — Default Theme Kept and Property-Specific Color Exposed Broadly
17
-
18
- ```css
19
- @theme {
20
- --color-header-ink: var(--header-ink);
21
- }
22
- ```
23
-
24
- ```tsx
25
- <h1 className="text-header-ink">Title</h1>
26
- <div className="bg-header-ink" />
27
- ```
28
-
29
- Why: the default theme remains active, and registering a text-only color in `--color-*` also creates unintended background, border, ring, and other color utilities.
30
-
31
- ## Correct — Custom Theme and Property-Specific Utility
32
-
33
- ```css
34
- :root {
35
- --header-ink: #111827;
36
- }
37
-
38
- @theme {
39
- --*: initial;
40
- --spacing: 0.25rem;
41
- --font-body: Inter, sans-serif;
42
- }
43
-
44
- @utility text-header {
45
- @apply text-(--header-ink);
46
- }
47
- ```
48
-
49
- ```tsx
50
- <h1 className="text-header">Title</h1>
51
- ```
52
-
53
- Why: only explicitly defined theme values remain available, while the private header color exposes exactly one text utility.
54
-
55
- ## Incorrect — Runtime Theme Variable Mapped Without `inline`
56
-
57
- ```css
58
- :root {
59
- --primary: #7c3aed;
60
- }
61
-
62
- .dark {
63
- --primary: #a78bfa;
64
- }
65
-
66
- @theme {
67
- --color-primary: var(--primary);
68
- }
69
- ```
70
-
71
- Why: the public token uses runtime variable indirection without the inline mapping intended for selector-driven theme values.
72
-
73
- ## Correct — Runtime Theme Variable Mapped Inline
74
-
75
- ```css
76
- :root {
77
- --primary: #7c3aed;
78
- }
79
-
80
- .dark {
81
- --primary: #a78bfa;
82
- }
83
-
84
- @theme inline {
85
- --color-primary: var(--primary);
86
- }
87
- ```
88
-
89
- Why: generated color utilities reference the selector-driven runtime value directly.
90
-
91
- ## Incorrect — Treatment Split Across Utilities and Raw Declarations
92
-
93
- ```css
94
- @utility surface-primary {
95
- background-color: var(--primary-canvas);
96
- }
97
-
98
- @utility surface-primary-hover {
99
- background-color: var(--primary-canvas-hover);
100
- }
101
- ```
102
-
103
- ```tsx
104
- <button className="surface-primary hover:surface-primary-hover">Save</button>
105
- ```
106
-
107
- Why: the treatment is split across public utilities, its state is reconstructed in markup, and project-owned declarations bypass Tailwind composition.
108
-
109
- ## Correct — Complete Treatment Composed with `@apply`
110
-
111
- ```css
112
- @utility surface-primary {
113
- @apply rounded-md bg-(--primary-canvas) px-3 py-2 text-(--primary-ink);
114
-
115
- &:hover {
116
- @apply bg-(--primary-canvas-hover);
117
- }
118
-
119
- &:focus-visible {
120
- @apply outline-2 outline-(--focus-ring);
121
- }
122
- }
123
- ```
124
-
125
- ```tsx
126
- <button className="surface-primary">Save</button>
127
- ```
128
-
129
- Why: the named utility owns the complete treatment and composes every project-owned declaration through Tailwind.
@@ -1,32 +0,0 @@
1
- # Theme Token Rule
2
-
3
- Application chrome must remain themeable, while artwork, user content, data, and faithful external visuals may carry color as content. This rule gives shared interface decisions semantic names without turning content colors into interface tokens.
4
-
5
- - Application chrome MUST use semantic project tokens and readable canvas/ink pairs.
6
- - Shared interface colors, surfaces, borders, typography roles, and reusable measurements MUST use semantic project tokens.
7
- - Components MUST NOT use palette utilities or literal colors for ordinary navigation, forms, dialogs, controls, status feedback, or focus treatment when a semantic role exists.
8
- - A new semantic token MUST represent a recurring interface meaning that existing roles cannot express.
9
- - Token names SHOULD describe purpose rather than a palette value or one component's implementation.
10
- - Content, artwork, user-selected media, data visualization, and faithful third-party visual reproductions MAY use literal colors when color is part of the content itself.
11
- - Opacity modifiers SHOULD express interaction and layering differences without creating a new semantic token.
12
-
13
- ## Incorrect — Palette Colors Used for Interface Controls
14
-
15
- ```tsx
16
- <Button className="bg-purple-600 text-white hover:bg-purple-500">Save</Button>
17
- <input className="border-[#6b7280] focus:ring-[#7c3aed]" />
18
- ```
19
-
20
- Why: ordinary controls are tied to palette and literal values instead of the project's semantic action, canvas, ink, border, and focus roles.
21
-
22
- ## Correct — Semantic Tokens Used for Interface Controls
23
-
24
- ```tsx
25
- <Button tone="primary">Save</Button>
26
- <input className="border-border focus-visible:ring-focus/50" />
27
-
28
- // A product preview preserves the external brand color as content.
29
- <ProductPreview brandColor="#1db954" />
30
- ```
31
-
32
- Why: ordinary interface styling uses the component API and semantic roles, while the faithful external visual retains the content color that defines it.
@@ -1,17 +0,0 @@
1
- # Styling Guide
2
-
3
- This guide keeps component styling predictable without making consumers learn a component's DOM or a project's CSS internals. Use it whenever you add or change UI styling.
4
-
5
- ## How To Style a Component
6
-
7
- Use this workflow when implementing a component or changing one of its visual treatments.
8
-
9
- 1. Follow the [Tailwind Utility Rule](rules/tailwind-utility-rule.md) so ordinary, local styling stays visible beside the markup it affects.
10
- 2. Follow the [Class Composition Rule](rules/class-composition-rule.md) so conditional and consumer-supplied classes merge predictably.
11
- 3. Follow the [Component Variant Rule](rules/component-variant-rule.md) so supported internal appearances are a typed component API.
12
- 4. Follow the [Color Role Naming Rule](rules/color-role-naming-rule.md) so color utilities state whether they supply a general color, a background, readable text, or a complete surface.
13
- 5. Follow the [Theme and Utility Definition Rule](rules/theme-and-utility-definition-rule.md) so CSS-first theme tokens and custom utilities expose only the intended API.
14
- 6. Follow the [Theme Token Rule](rules/theme-token-rule.md) so application chrome, content visuals, and shared measurements use the right kind of value.
15
- 7. Follow the [Global Style System Rule](rules/global-style-system-rule.md) so global CSS has one source of truth and a clear ownership boundary.
16
- 8. Follow the [Style Placement Rule](rules/style-placement-rule.md) so reusable styling has one appropriate owner.
17
- 9. Follow the [Component State Rule](rules/component-state-rule.md) so interaction, disabled, selected, loading, and error states stay coherent.