@wangs-ui/skills 1.3.0-alpha.14 → 1.3.0-alpha.16

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 (62) hide show
  1. package/dist/bin.js +2 -2
  2. package/dist/index.js +1 -1
  3. package/dist/skills/wangs-ui/wangs-ui-components/SKILL.md +104 -0
  4. package/dist/{src-ilzo-M7u.js → src-t3vXV084.js} +119 -96
  5. package/package.json +1 -1
  6. package/skills/wangs-ui/wangs-ui-components/SKILL.md +104 -0
  7. package/dist/skills/wangs-ui-components/SKILL.md +0 -202
  8. package/skills/wangs-ui-components/SKILL.md +0 -202
  9. /package/dist/rules/{react19-checklist-and-reference.md → wangs-ui/react19-checklist-and-reference.md} +0 -0
  10. /package/dist/rules/{react19-compiler-render-patterns.md → wangs-ui/react19-compiler-render-patterns.md} +0 -0
  11. /package/dist/rules/{react19-naming-conventions.md → wangs-ui/react19-naming-conventions.md} +0 -0
  12. /package/dist/rules/{react19-no-manual-memoization.md → wangs-ui/react19-no-manual-memoization.md} +0 -0
  13. /package/dist/rules/{react19-primitives-typing.md → wangs-ui/react19-primitives-typing.md} +0 -0
  14. /package/dist/rules/{react19-props-typing.md → wangs-ui/react19-props-typing.md} +0 -0
  15. /package/dist/rules/{react19-purity-and-immutability.md → wangs-ui/react19-purity-and-immutability.md} +0 -0
  16. /package/dist/rules/{react19-tooling-and-opt-out.md → wangs-ui/react19-tooling-and-opt-out.md} +0 -0
  17. /package/dist/rules/{typescript-assertions-last-resort.md → wangs-ui/typescript-assertions-last-resort.md} +0 -0
  18. /package/dist/rules/{typescript-checklist-and-reference.md → wangs-ui/typescript-checklist-and-reference.md} +0 -0
  19. /package/dist/rules/{typescript-discriminated-unions.md → wangs-ui/typescript-discriminated-unions.md} +0 -0
  20. /package/dist/rules/{typescript-explicit-return-types.md → wangs-ui/typescript-explicit-return-types.md} +0 -0
  21. /package/dist/rules/{typescript-interface-vs-type.md → wangs-ui/typescript-interface-vs-type.md} +0 -0
  22. /package/dist/rules/{typescript-literal-unions-vs-enums.md → wangs-ui/typescript-literal-unions-vs-enums.md} +0 -0
  23. /package/dist/rules/{typescript-naming-conventions.md → wangs-ui/typescript-naming-conventions.md} +0 -0
  24. /package/dist/rules/{typescript-narrowing-over-casting.md → wangs-ui/typescript-narrowing-over-casting.md} +0 -0
  25. /package/dist/rules/{typescript-readonly-by-default.md → wangs-ui/typescript-readonly-by-default.md} +0 -0
  26. /package/dist/rules/{typescript-tsconfig-strictness.md → wangs-ui/typescript-tsconfig-strictness.md} +0 -0
  27. /package/dist/rules/{typescript-zero-any.md → wangs-ui/typescript-zero-any.md} +0 -0
  28. /package/dist/skills/{craft-theme → wangs-ui/craft-theme}/SKILL.md +0 -0
  29. /package/dist/skills/{create-form → wangs-ui/create-form}/SKILL.md +0 -0
  30. /package/dist/skills/{data-table → wangs-ui/data-table}/SKILL.md +0 -0
  31. /package/dist/skills/{dialog-modal → wangs-ui/dialog-modal}/SKILL.md +0 -0
  32. /package/dist/skills/{i18n-usage → wangs-ui/i18n-usage}/SKILL.md +0 -0
  33. /package/dist/skills/{layout-navigation → wangs-ui/layout-navigation}/SKILL.md +0 -0
  34. /package/dist/skills/{responsive-design → wangs-ui/responsive-design}/SKILL.md +0 -0
  35. /package/dist/skills/{universal-layout → wangs-ui/universal-layout}/SKILL.md +0 -0
  36. /package/rules/{react19-checklist-and-reference.md → wangs-ui/react19-checklist-and-reference.md} +0 -0
  37. /package/rules/{react19-compiler-render-patterns.md → wangs-ui/react19-compiler-render-patterns.md} +0 -0
  38. /package/rules/{react19-naming-conventions.md → wangs-ui/react19-naming-conventions.md} +0 -0
  39. /package/rules/{react19-no-manual-memoization.md → wangs-ui/react19-no-manual-memoization.md} +0 -0
  40. /package/rules/{react19-primitives-typing.md → wangs-ui/react19-primitives-typing.md} +0 -0
  41. /package/rules/{react19-props-typing.md → wangs-ui/react19-props-typing.md} +0 -0
  42. /package/rules/{react19-purity-and-immutability.md → wangs-ui/react19-purity-and-immutability.md} +0 -0
  43. /package/rules/{react19-tooling-and-opt-out.md → wangs-ui/react19-tooling-and-opt-out.md} +0 -0
  44. /package/rules/{typescript-assertions-last-resort.md → wangs-ui/typescript-assertions-last-resort.md} +0 -0
  45. /package/rules/{typescript-checklist-and-reference.md → wangs-ui/typescript-checklist-and-reference.md} +0 -0
  46. /package/rules/{typescript-discriminated-unions.md → wangs-ui/typescript-discriminated-unions.md} +0 -0
  47. /package/rules/{typescript-explicit-return-types.md → wangs-ui/typescript-explicit-return-types.md} +0 -0
  48. /package/rules/{typescript-interface-vs-type.md → wangs-ui/typescript-interface-vs-type.md} +0 -0
  49. /package/rules/{typescript-literal-unions-vs-enums.md → wangs-ui/typescript-literal-unions-vs-enums.md} +0 -0
  50. /package/rules/{typescript-naming-conventions.md → wangs-ui/typescript-naming-conventions.md} +0 -0
  51. /package/rules/{typescript-narrowing-over-casting.md → wangs-ui/typescript-narrowing-over-casting.md} +0 -0
  52. /package/rules/{typescript-readonly-by-default.md → wangs-ui/typescript-readonly-by-default.md} +0 -0
  53. /package/rules/{typescript-tsconfig-strictness.md → wangs-ui/typescript-tsconfig-strictness.md} +0 -0
  54. /package/rules/{typescript-zero-any.md → wangs-ui/typescript-zero-any.md} +0 -0
  55. /package/skills/{craft-theme → wangs-ui/craft-theme}/SKILL.md +0 -0
  56. /package/skills/{create-form → wangs-ui/create-form}/SKILL.md +0 -0
  57. /package/skills/{data-table → wangs-ui/data-table}/SKILL.md +0 -0
  58. /package/skills/{dialog-modal → wangs-ui/dialog-modal}/SKILL.md +0 -0
  59. /package/skills/{i18n-usage → wangs-ui/i18n-usage}/SKILL.md +0 -0
  60. /package/skills/{layout-navigation → wangs-ui/layout-navigation}/SKILL.md +0 -0
  61. /package/skills/{responsive-design → wangs-ui/responsive-design}/SKILL.md +0 -0
  62. /package/skills/{universal-layout → wangs-ui/universal-layout}/SKILL.md +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wangs-ui/skills",
3
- "version": "1.3.0-alpha.14",
3
+ "version": "1.3.0-alpha.16",
4
4
  "description": "CLI to install, update, and manage modular AI agent skills for Wangs UI React applications",
5
5
  "keywords": [
6
6
  "agents",
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: wangs-ui-components
3
+ description: MCP Discovery Protocol, modular subpath import map, and primitive substitution map for Wangs UI applications.
4
+ metadata:
5
+ owner: wangs-ui
6
+ ---
7
+
8
+ # Skill: Wangs UI Component Fundamentals & MCP Protocol
9
+
10
+ Use this skill to navigate the Wangs UI ecosystem. **MCP is the single source of truth** for all component APIs, props, variants, slots, and examples. Do not hardcode or assume props — always query MCP dynamically.
11
+
12
+ ---
13
+
14
+ ## 1. The MCP Discovery Protocol (Single Source of Truth)
15
+
16
+ Do **NOT** guess component props, Pass-Through (`pt`) slots, or event names. Always query the MCP server dynamically:
17
+
18
+ ```mermaid
19
+ graph TD
20
+ A[Identify Component / Primitive Needed] --> B[list_catalog to confirm name/id]
21
+ B --> C[get_component_api for typed contract]
22
+ B --> D[get_documentation for curated guidance]
23
+ C --> E{Need live story / variant code?}
24
+ D --> E
25
+ E -->|Yes| F[get_component_examples]
26
+ E -->|No| G[Implement with Subpath Import Map]
27
+ F --> G
28
+ ```
29
+
30
+ ### Discovery Steps:
31
+
32
+ 1. **Discover Catalog Entries**:
33
+ ```json
34
+ list_catalog({ "query": "button" })
35
+ list_catalog({ "category": "component" })
36
+ ```
37
+ 2. **Inspect Typed Contracts & Props** (`component` parameter):
38
+ ```json
39
+ get_component_api({ "component": "button" })
40
+ get_component_api({ "component": "datatable" })
41
+ get_component_api({ "component": "field" })
42
+ ```
43
+ 3. **Read Curated Narrative Documentation** (`id` parameter):
44
+ ```json
45
+ get_documentation({ "id": "button" })
46
+ get_documentation({ "id": "foundation" })
47
+ get_documentation({ "id": "form" })
48
+ ```
49
+ 4. **Fetch Live Storybook TSX Examples**:
50
+ ```json
51
+ get_component_examples({ "component": "button", "variant": "Sizes" })
52
+ get_component_examples({ "component": "datatable", "variant": "Basic" })
53
+ ```
54
+ 5. **Explore Knowledge Graph Relationships**:
55
+ ```json
56
+ query_graph({ "query": "DataTable" })
57
+ query_graph({ "query": "useForm" })
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 2. Modular Subpath Import Map
63
+
64
+ Always import via specific subpath modules to guarantee tree-shaking and avoid bundling entire packages:
65
+
66
+ | Ecosystem Layer | Subpath Pattern | Example Imports |
67
+ | :--- | :--- | :--- |
68
+ | **Core Primitives** | `@wangs-ui/react-core/primitive/<name>` | `Button`, `Input`, `Select`, `DataTable`, `Dialog`, `Modal`, `Field`, `Form`, `Card`, `Badge` |
69
+ | **Layout Primitives** | `@wangs-ui/foundation/layout` | `Stack`, `HStack`, `VStack`, `Flex`, `Grid`, `Box`, `Container`, `Section`, `ScrollArea` |
70
+ | **Typography Primitives** | `@wangs-ui/foundation/theme` | `Text`, `Code`, `Kbd`, `Link`, `Blockquote`, `List`, `Mark` |
71
+ | **Blocks & Shells** | `@wangs-ui/react-core/blocks/<name>` | `AppLayout`, `Sidebar`, `TableToolbar` |
72
+ | **Form Engine** | `@wangs-ui/form/core`, `@wangs-ui/form/react` | Headless form state, hooks, validation adapters |
73
+ | **Universal Navigation** | `@wangs-ui/react-navigation/web`, `@wangs-ui/react-navigation/native` | `buildGraph`, `paramRoute`, platform router bridges |
74
+ | **Theme & Providers** | `@wangs-ui/react-core/api`, `@wangs-ui/foundation/theme` | `WangsUiProvider`, `ThemeProvider`, `useTheme` |
75
+ | **Vector Icons** | `@wangs-ui/react-icons` | `SearchLine`, `AddLine`, `DeleteBin6Line`, `CheckLine` |
76
+ | **i18n & Localization** | `@wangs-ui/react-i18n` | `useI18n`, `t`, `WangsUiI18nProvider` |
77
+
78
+ ---
79
+
80
+ ## 3. Primitive Substitution Map
81
+
82
+ Zero raw HTML elements. Never write raw HTML tags when a Wangs UI primitive exists:
83
+
84
+ | Forbidden Raw HTML | Mandatory Wangs UI Primitive | Import Path | MCP Catalog / Doc ID |
85
+ | :--- | :--- | :--- | :--- |
86
+ | `<button>` | `Button` | `@wangs-ui/react-core/primitive/button` | `button` |
87
+ | `<input type="text">` | `Input` | `@wangs-ui/react-core/primitive/input` | `input` |
88
+ | `<input type="number">` | `NumberInput` | `@wangs-ui/react-core/primitive/numberinput` | `numberinput` |
89
+ | `<input type="checkbox">` | `Checkbox` | `@wangs-ui/react-core/primitive/checkbox` | `checkbox` |
90
+ | `<select>` | `Select` / `MultiSelect` | `@wangs-ui/react-core/primitive/select` | `select`, `multiselect` |
91
+ | `<textarea>` | `Textarea` | `@wangs-ui/react-core/primitive/textarea` | `textarea` |
92
+ | `<form>` | `Form` / `DialogForm` | `@wangs-ui/react-core/primitive/form` | `form`, `dialogform` |
93
+ | `<dialog>` / alert modal | `Modal` / `Dialog` | `@wangs-ui/react-core/primitive/modal` | `modal`, `dialog` |
94
+ | `<table>` | `DataTable` | `@wangs-ui/react-core/primitive/datatable` | `datatable` |
95
+ | `<div>` (layout / flex / grid) | `Stack`, `HStack`, `Flex`, `Grid`, `Box` | `@wangs-ui/foundation/layout` | `universal-layout` |
96
+ | `<div>` (surface card) | `Card` | `@wangs-ui/react-core/primitive/card` | `card` |
97
+ | Pill / status chip | `Badge` | `@wangs-ui/react-core/primitive/badge` | `badge` |
98
+ | `<h1>` - `<h6>` | `<Text variant="...">` | `@wangs-ui/foundation/theme` | `foundation` |
99
+ | `<p>`, `<span>` (body text) | `<Text variant="...">` | `@wangs-ui/foundation/theme` | `foundation` |
100
+ | `<a>` | `Link` | `@wangs-ui/foundation/theme` | `foundation` |
101
+ | `<code>` | `Code` | `@wangs-ui/foundation/theme` | `foundation` |
102
+ | `<kbd>` | `Kbd` | `@wangs-ui/foundation/theme` | `foundation` |
103
+ | `<blockquote>` | `Blockquote` | `@wangs-ui/foundation/theme` | `foundation` |
104
+ | `<ul>`, `<ol>` | `List` | `@wangs-ui/foundation/theme` | `foundation` |
@@ -1,202 +0,0 @@
1
- ---
2
- name: wangs-ui-components
3
- description: Foundational rules, subpath imports, design tokens, and the MCP Discovery Protocol for building React apps with Wangs UI.
4
- metadata:
5
- owner: wangs-ui
6
- ---
7
-
8
- # Skill: Wangs UI Component Fundamentals & MCP Protocol
9
-
10
- Use this skill whenever you write or modify UI components using Wangs UI (`@wangs-ui/react-core`, `@wangs-ui/foundation`, `@wangs-ui/react-icons`, `@wangs-ui/react-presets`, `@wangs-ui/form`).
11
-
12
- ---
13
-
14
- ## 1. The MCP Discovery Protocol (Mandatory Single Source of Truth)
15
-
16
- Do **NOT** guess component props, Pass-Through (`pt`) slots, or event names. Always query the MCP server dynamically to retrieve the current API signatures and live story implementations:
17
-
18
- ```mermaid
19
- graph TD
20
- A[Identify Component / Token Needed] --> B[list_catalog to confirm name/id]
21
- B --> C[get_component_api for typed contract]
22
- B --> D[get_documentation for curated guidance]
23
- C --> E{Need live story / variant code?}
24
- D --> E
25
- E -->|Yes| F[get_component_examples]
26
- E -->|No| G[Implement with Modular Subpaths]
27
- F --> G
28
- ```
29
-
30
- ### Discovery Steps:
31
-
32
- 1. **Confirm Available Components & Blocks**:
33
- ```json
34
- list_catalog({ "query": "button" })
35
- list_catalog({ "category": "component" })
36
- ```
37
- 2. **Inspect Component Contract & Props** (`component` parameter):
38
- ```json
39
- get_component_api({ "component": "button" })
40
- get_component_api({ "component": "input" })
41
- get_component_api({ "component": "datatable" })
42
- get_component_api({ "component": "modal" })
43
- ```
44
- 3. **Inspect Curated Documentation** (`id` parameter):
45
- ```json
46
- get_documentation({ "id": "foundation" })
47
- get_documentation({ "id": "button" })
48
- get_documentation({ "id": "form" })
49
- ```
50
- 4. **Inspect Live Usage & Story Variants**:
51
- ```json
52
- get_component_examples({ "component": "button", "variant": "Sizes" })
53
- get_component_examples({ "component": "datatable", "variant": "CursorPagination" })
54
- ```
55
- 5. **Query Knowledge Graph & Symbol Relationships**:
56
- ```json
57
- query_graph({ "query": "DataTable" })
58
- query_graph({ "query": "usePT" })
59
- ```
60
-
61
- ---
62
-
63
- ## 2. Modular Subpath Imports (Mandatory)
64
-
65
- Always import via specific subpaths to guarantee tree-shaking and avoid bundling entire packages:
66
-
67
- ```tsx
68
- // 1. Core Primitives (@wangs-ui/react-core/primitive/*)
69
- import Button from '@wangs-ui/react-core/primitive/button';
70
- import Input from '@wangs-ui/react-core/primitive/input';
71
- import NumberInput from '@wangs-ui/react-core/primitive/numberinput';
72
- import Textarea from '@wangs-ui/react-core/primitive/textarea';
73
- import Select from '@wangs-ui/react-core/primitive/select';
74
- import MultiSelect from '@wangs-ui/react-core/primitive/multiselect';
75
- import Checkbox from '@wangs-ui/react-core/primitive/checkbox';
76
- import Badge from '@wangs-ui/react-core/primitive/badge';
77
- import Card from '@wangs-ui/react-core/primitive/card';
78
- import DataTable from '@wangs-ui/react-core/primitive/datatable';
79
- import Modal from '@wangs-ui/react-core/primitive/modal';
80
- import Dialog from '@wangs-ui/react-core/primitive/dialog';
81
- import DialogForm from '@wangs-ui/react-core/primitive/dialogform';
82
- import { useForm, Form } from '@wangs-ui/react-core/primitive/form';
83
- import Field from '@wangs-ui/react-core/primitive/field';
84
-
85
- // 2. Layout Primitives (@wangs-ui/foundation/layout)
86
- import {
87
- Box,
88
- Flex,
89
- Stack,
90
- HStack,
91
- VStack,
92
- Grid,
93
- Container,
94
- Section,
95
- Show,
96
- } from '@wangs-ui/foundation/layout';
97
-
98
- // 3. Typography Primitives (@wangs-ui/foundation/theme)
99
- import { Text, Code, Kbd, Link, Mark, Blockquote, List } from '@wangs-ui/foundation/theme';
100
-
101
- // 4. Blocks & Navigation (@wangs-ui/react-core/blocks/*)
102
- import AppLayout from '@wangs-ui/react-core/blocks/applayout';
103
- import Sidebar from '@wangs-ui/react-core/blocks/sidebar';
104
- import TableToolbar from '@wangs-ui/react-core/blocks/tabletoolbar';
105
-
106
- // 5. Providers & System Hooks
107
- import { WangsUiProvider } from '@wangs-ui/react-core/api';
108
- import { ThemeProvider, useTheme } from '@wangs-ui/foundation/theme';
109
- import { useI18n } from '@wangs-ui/react-i18n';
110
-
111
- // 6. Vector Icons (@wangs-ui/react-icons)
112
- import { SearchLine, AddLine, DeleteBin6Line, CheckLine } from '@wangs-ui/react-icons';
113
- ```
114
-
115
- ---
116
-
117
- ## 3. Strict Primitive Substitution Rule
118
-
119
- Zero raw HTML elements. Never write raw HTML tags when a Wangs UI primitive exists:
120
-
121
- | Forbidden Raw HTML | Mandatory Wangs UI Primitive | Import Path | MCP Doc / Catalog ID |
122
- |:-------------------------------|:-----------------------------------------------------|:---------------------------------------------|:------------------------|
123
- | `<button>` | `Button` | `@wangs-ui/react-core/primitive/button` | `button` |
124
- | `<input type="text">` | `Input` | `@wangs-ui/react-core/primitive/input` | `input` |
125
- | `<input type="number">` | `NumberInput` | `@wangs-ui/react-core/primitive/numberinput` | `numberinput` |
126
- | `<input type="checkbox">` | `Checkbox` | `@wangs-ui/react-core/primitive/checkbox` | `checkbox` |
127
- | `<select>` | `Select` / `MultiSelect` | `@wangs-ui/react-core/primitive/select` | `select`, `multiselect` |
128
- | `<textarea>` | `Textarea` | `@wangs-ui/react-core/primitive/textarea` | `textarea` |
129
- | `<form>` | `Form` / `DialogForm` | `@wangs-ui/react-core/primitive/form` | `form`, `dialogform` |
130
- | `<dialog>` / alert modal | `Modal` / `Dialog` | `@wangs-ui/react-core/primitive/modal` | `modal`, `dialog` |
131
- | `<table>` | `DataTable` | `@wangs-ui/react-core/primitive/datatable` | `datatable` |
132
- | `<div>` (layout / flex / grid) | `Stack`, `HStack`, `Flex`, `Grid`, `Box` | `@wangs-ui/foundation/layout` | `universal-layout` |
133
- | `<div>` (surface card) | `Card` | `@wangs-ui/react-core/primitive/card` | `card` |
134
- | Pill / status chip | `Badge` | `@wangs-ui/react-core/primitive/badge` | `badge` |
135
- | `<h1>` - `<h6>` | `<Text variant="headline*">` / `display*` / `title*` | `@wangs-ui/foundation/theme` | `foundation` |
136
- | `<p>`, `<span>` (body text) | `<Text variant="body*">` / `label*` | `@wangs-ui/foundation/theme` | `foundation` |
137
- | `<a>` | `Link` | `@wangs-ui/foundation/theme` | `foundation` |
138
- | `<code>` | `Code` | `@wangs-ui/foundation/theme` | `foundation` |
139
- | `<kbd>` | `Kbd` | `@wangs-ui/foundation/theme` | `foundation` |
140
- | `<blockquote>` | `Blockquote` | `@wangs-ui/foundation/theme` | `foundation` |
141
- | `<ul>`, `<ol>` | `List` | `@wangs-ui/foundation/theme` | `foundation` |
142
-
143
- ---
144
-
145
- ## 4. Typography System & `<Text>` Primitive
146
-
147
- Wangs UI uses a unified typography token system with standard and emphasized variants. Do **NOT** use arbitrary text utilities (`text-[16px]`, `text-lg`) or obsolete `.heading-*` classes.
148
-
149
- ### Primary Typography Primitive: `<Text>`
150
-
151
- ```tsx
152
- import { Text } from '@wangs-ui/foundation/theme';
153
-
154
- // Headings & Displays
155
- <Text variant="displayMedium">Hero Title</Text>
156
- <Text variant="headlineLarge">Page Header</Text>
157
- <Text variant="titleMedium">Card Section Header</Text>
158
-
159
- // Body & Labels
160
- <Text variant="bodyMedium">Standard reading paragraph text.</Text>
161
- <Text variant="bodySmall" color="secondary">Helper caption text.</Text>
162
- <Text variant="labelLarge" weight="bold">Interactive button or badge label</Text>
163
-
164
- // Polymorphic HTML Tag Override (default maps automatically: display/headline -> h1/h2, body -> p, label -> span)
165
- <Text variant="titleMedium" as="h3">Custom Tag Title</Text>
166
- ```
167
-
168
- ### Typography Roles:
169
-
170
- - **Display**: Page heroes (`displayLarge`, `displayMedium`, `displaySmall`)
171
- - **Headline**: Screen and page titles (`headlineLarge`, `headlineMedium`, `headlineSmall`)
172
- - **Title**: Card and modal section headers (`titleLarge`, `titleMedium`, `titleSmall`)
173
- - **Body**: Main copy and paragraphs (`bodyLarge`, `bodyMedium`, `bodySmall`)
174
- - **Label**: Buttons, inputs, and badges (`labelLarge`, `labelMedium`, `labelSmall`)
175
- - Append `Emphasized` for high-emphasis weights (e.g. `headlineMediumEmphasized`, `titleLargeEmphasized`).
176
-
177
- ---
178
-
179
- ## 5. Spacing Scale & Theming Invariants
180
-
181
- ### Flat 4px Spacing Scale
182
-
183
- Keys follow the flat numeric Tailwind step (`1` unit `= 4px`):
184
- `0`, `0.5` (2px), `1` (4px), `1.5` (6px), `2` (8px), `2.5` (10px), `3` (12px), `3.5` (14px), `4` (16px), `5` (20px), `6` (24px), `8` (32px), `10` (40px), `12` (48px), `16` (64px).
185
-
186
- - **In Layout Primitives**: Pass keys directly: `<HStack gap="3" p="4">`
187
- - **In Tailwind Utilities**: Use standard numeric utilities: `p-4`, `gap-3`, `px-6`
188
- - **In React Native**: Read pixels via `useTheme().spacing`: `spacing[4] === 16`
189
-
190
- ### Theming & Dark Mode Invariants
191
-
192
- - **Theme Provider**: Wrap app root with `<ThemeProvider defaultPalette="blue" defaultMode="light">`.
193
- - **Engine Invariant**: **NEVER** override `:root`, `[data-mode='dark']`, or `--color-*` variables in custom CSS. Always customize themes via `ThemeProvider` or `WangsUiProvider.configOptions.preset`.
194
- - **Dark Mode**: Toggle only via `useTheme().setMode('dark' | 'light')` — never mutate `document.documentElement.classList`.
195
-
196
- ---
197
-
198
- ## 6. Layout Governance & Redundant Wrapper Rule
199
-
200
- 1. **Use Layout Primitives**: Arrange layouts using `Stack`, `HStack`, `VStack`, `Flex`, `Grid`, and `Box` from `@wangs-ui/foundation/layout`.
201
- 2. **Zero Redundant Wrappers**: Never wrap a single component in an unnecessary `<div>` or `<Box>` (e.g. `<div><DataTable /></div>` or `<Box><Card /></Box>`).
202
- 3. **No Inline Styling Overrides**: Component visual styling lives in global presets. Do not pass ad-hoc utility classes (`className="h-5 w-5"`, `rounded-lg`) directly to primitives or icons unless documented as an MCP exception.
@@ -1,202 +0,0 @@
1
- ---
2
- name: wangs-ui-components
3
- description: Foundational rules, subpath imports, design tokens, and the MCP Discovery Protocol for building React apps with Wangs UI.
4
- metadata:
5
- owner: wangs-ui
6
- ---
7
-
8
- # Skill: Wangs UI Component Fundamentals & MCP Protocol
9
-
10
- Use this skill whenever you write or modify UI components using Wangs UI (`@wangs-ui/react-core`, `@wangs-ui/foundation`, `@wangs-ui/react-icons`, `@wangs-ui/react-presets`, `@wangs-ui/form`).
11
-
12
- ---
13
-
14
- ## 1. The MCP Discovery Protocol (Mandatory Single Source of Truth)
15
-
16
- Do **NOT** guess component props, Pass-Through (`pt`) slots, or event names. Always query the MCP server dynamically to retrieve the current API signatures and live story implementations:
17
-
18
- ```mermaid
19
- graph TD
20
- A[Identify Component / Token Needed] --> B[list_catalog to confirm name/id]
21
- B --> C[get_component_api for typed contract]
22
- B --> D[get_documentation for curated guidance]
23
- C --> E{Need live story / variant code?}
24
- D --> E
25
- E -->|Yes| F[get_component_examples]
26
- E -->|No| G[Implement with Modular Subpaths]
27
- F --> G
28
- ```
29
-
30
- ### Discovery Steps:
31
-
32
- 1. **Confirm Available Components & Blocks**:
33
- ```json
34
- list_catalog({ "query": "button" })
35
- list_catalog({ "category": "component" })
36
- ```
37
- 2. **Inspect Component Contract & Props** (`component` parameter):
38
- ```json
39
- get_component_api({ "component": "button" })
40
- get_component_api({ "component": "input" })
41
- get_component_api({ "component": "datatable" })
42
- get_component_api({ "component": "modal" })
43
- ```
44
- 3. **Inspect Curated Documentation** (`id` parameter):
45
- ```json
46
- get_documentation({ "id": "foundation" })
47
- get_documentation({ "id": "button" })
48
- get_documentation({ "id": "form" })
49
- ```
50
- 4. **Inspect Live Usage & Story Variants**:
51
- ```json
52
- get_component_examples({ "component": "button", "variant": "Sizes" })
53
- get_component_examples({ "component": "datatable", "variant": "CursorPagination" })
54
- ```
55
- 5. **Query Knowledge Graph & Symbol Relationships**:
56
- ```json
57
- query_graph({ "query": "DataTable" })
58
- query_graph({ "query": "usePT" })
59
- ```
60
-
61
- ---
62
-
63
- ## 2. Modular Subpath Imports (Mandatory)
64
-
65
- Always import via specific subpaths to guarantee tree-shaking and avoid bundling entire packages:
66
-
67
- ```tsx
68
- // 1. Core Primitives (@wangs-ui/react-core/primitive/*)
69
- import Button from '@wangs-ui/react-core/primitive/button';
70
- import Input from '@wangs-ui/react-core/primitive/input';
71
- import NumberInput from '@wangs-ui/react-core/primitive/numberinput';
72
- import Textarea from '@wangs-ui/react-core/primitive/textarea';
73
- import Select from '@wangs-ui/react-core/primitive/select';
74
- import MultiSelect from '@wangs-ui/react-core/primitive/multiselect';
75
- import Checkbox from '@wangs-ui/react-core/primitive/checkbox';
76
- import Badge from '@wangs-ui/react-core/primitive/badge';
77
- import Card from '@wangs-ui/react-core/primitive/card';
78
- import DataTable from '@wangs-ui/react-core/primitive/datatable';
79
- import Modal from '@wangs-ui/react-core/primitive/modal';
80
- import Dialog from '@wangs-ui/react-core/primitive/dialog';
81
- import DialogForm from '@wangs-ui/react-core/primitive/dialogform';
82
- import { useForm, Form } from '@wangs-ui/react-core/primitive/form';
83
- import Field from '@wangs-ui/react-core/primitive/field';
84
-
85
- // 2. Layout Primitives (@wangs-ui/foundation/layout)
86
- import {
87
- Box,
88
- Flex,
89
- Stack,
90
- HStack,
91
- VStack,
92
- Grid,
93
- Container,
94
- Section,
95
- Show,
96
- } from '@wangs-ui/foundation/layout';
97
-
98
- // 3. Typography Primitives (@wangs-ui/foundation/theme)
99
- import { Text, Code, Kbd, Link, Mark, Blockquote, List } from '@wangs-ui/foundation/theme';
100
-
101
- // 4. Blocks & Navigation (@wangs-ui/react-core/blocks/*)
102
- import AppLayout from '@wangs-ui/react-core/blocks/applayout';
103
- import Sidebar from '@wangs-ui/react-core/blocks/sidebar';
104
- import TableToolbar from '@wangs-ui/react-core/blocks/tabletoolbar';
105
-
106
- // 5. Providers & System Hooks
107
- import { WangsUiProvider } from '@wangs-ui/react-core/api';
108
- import { ThemeProvider, useTheme } from '@wangs-ui/foundation/theme';
109
- import { useI18n } from '@wangs-ui/react-i18n';
110
-
111
- // 6. Vector Icons (@wangs-ui/react-icons)
112
- import { SearchLine, AddLine, DeleteBin6Line, CheckLine } from '@wangs-ui/react-icons';
113
- ```
114
-
115
- ---
116
-
117
- ## 3. Strict Primitive Substitution Rule
118
-
119
- Zero raw HTML elements. Never write raw HTML tags when a Wangs UI primitive exists:
120
-
121
- | Forbidden Raw HTML | Mandatory Wangs UI Primitive | Import Path | MCP Doc / Catalog ID |
122
- |:-------------------------------|:-----------------------------------------------------|:---------------------------------------------|:------------------------|
123
- | `<button>` | `Button` | `@wangs-ui/react-core/primitive/button` | `button` |
124
- | `<input type="text">` | `Input` | `@wangs-ui/react-core/primitive/input` | `input` |
125
- | `<input type="number">` | `NumberInput` | `@wangs-ui/react-core/primitive/numberinput` | `numberinput` |
126
- | `<input type="checkbox">` | `Checkbox` | `@wangs-ui/react-core/primitive/checkbox` | `checkbox` |
127
- | `<select>` | `Select` / `MultiSelect` | `@wangs-ui/react-core/primitive/select` | `select`, `multiselect` |
128
- | `<textarea>` | `Textarea` | `@wangs-ui/react-core/primitive/textarea` | `textarea` |
129
- | `<form>` | `Form` / `DialogForm` | `@wangs-ui/react-core/primitive/form` | `form`, `dialogform` |
130
- | `<dialog>` / alert modal | `Modal` / `Dialog` | `@wangs-ui/react-core/primitive/modal` | `modal`, `dialog` |
131
- | `<table>` | `DataTable` | `@wangs-ui/react-core/primitive/datatable` | `datatable` |
132
- | `<div>` (layout / flex / grid) | `Stack`, `HStack`, `Flex`, `Grid`, `Box` | `@wangs-ui/foundation/layout` | `universal-layout` |
133
- | `<div>` (surface card) | `Card` | `@wangs-ui/react-core/primitive/card` | `card` |
134
- | Pill / status chip | `Badge` | `@wangs-ui/react-core/primitive/badge` | `badge` |
135
- | `<h1>` - `<h6>` | `<Text variant="headline*">` / `display*` / `title*` | `@wangs-ui/foundation/theme` | `foundation` |
136
- | `<p>`, `<span>` (body text) | `<Text variant="body*">` / `label*` | `@wangs-ui/foundation/theme` | `foundation` |
137
- | `<a>` | `Link` | `@wangs-ui/foundation/theme` | `foundation` |
138
- | `<code>` | `Code` | `@wangs-ui/foundation/theme` | `foundation` |
139
- | `<kbd>` | `Kbd` | `@wangs-ui/foundation/theme` | `foundation` |
140
- | `<blockquote>` | `Blockquote` | `@wangs-ui/foundation/theme` | `foundation` |
141
- | `<ul>`, `<ol>` | `List` | `@wangs-ui/foundation/theme` | `foundation` |
142
-
143
- ---
144
-
145
- ## 4. Typography System & `<Text>` Primitive
146
-
147
- Wangs UI uses a unified typography token system with standard and emphasized variants. Do **NOT** use arbitrary text utilities (`text-[16px]`, `text-lg`) or obsolete `.heading-*` classes.
148
-
149
- ### Primary Typography Primitive: `<Text>`
150
-
151
- ```tsx
152
- import { Text } from '@wangs-ui/foundation/theme';
153
-
154
- // Headings & Displays
155
- <Text variant="displayMedium">Hero Title</Text>
156
- <Text variant="headlineLarge">Page Header</Text>
157
- <Text variant="titleMedium">Card Section Header</Text>
158
-
159
- // Body & Labels
160
- <Text variant="bodyMedium">Standard reading paragraph text.</Text>
161
- <Text variant="bodySmall" color="secondary">Helper caption text.</Text>
162
- <Text variant="labelLarge" weight="bold">Interactive button or badge label</Text>
163
-
164
- // Polymorphic HTML Tag Override (default maps automatically: display/headline -> h1/h2, body -> p, label -> span)
165
- <Text variant="titleMedium" as="h3">Custom Tag Title</Text>
166
- ```
167
-
168
- ### Typography Roles:
169
-
170
- - **Display**: Page heroes (`displayLarge`, `displayMedium`, `displaySmall`)
171
- - **Headline**: Screen and page titles (`headlineLarge`, `headlineMedium`, `headlineSmall`)
172
- - **Title**: Card and modal section headers (`titleLarge`, `titleMedium`, `titleSmall`)
173
- - **Body**: Main copy and paragraphs (`bodyLarge`, `bodyMedium`, `bodySmall`)
174
- - **Label**: Buttons, inputs, and badges (`labelLarge`, `labelMedium`, `labelSmall`)
175
- - Append `Emphasized` for high-emphasis weights (e.g. `headlineMediumEmphasized`, `titleLargeEmphasized`).
176
-
177
- ---
178
-
179
- ## 5. Spacing Scale & Theming Invariants
180
-
181
- ### Flat 4px Spacing Scale
182
-
183
- Keys follow the flat numeric Tailwind step (`1` unit `= 4px`):
184
- `0`, `0.5` (2px), `1` (4px), `1.5` (6px), `2` (8px), `2.5` (10px), `3` (12px), `3.5` (14px), `4` (16px), `5` (20px), `6` (24px), `8` (32px), `10` (40px), `12` (48px), `16` (64px).
185
-
186
- - **In Layout Primitives**: Pass keys directly: `<HStack gap="3" p="4">`
187
- - **In Tailwind Utilities**: Use standard numeric utilities: `p-4`, `gap-3`, `px-6`
188
- - **In React Native**: Read pixels via `useTheme().spacing`: `spacing[4] === 16`
189
-
190
- ### Theming & Dark Mode Invariants
191
-
192
- - **Theme Provider**: Wrap app root with `<ThemeProvider defaultPalette="blue" defaultMode="light">`.
193
- - **Engine Invariant**: **NEVER** override `:root`, `[data-mode='dark']`, or `--color-*` variables in custom CSS. Always customize themes via `ThemeProvider` or `WangsUiProvider.configOptions.preset`.
194
- - **Dark Mode**: Toggle only via `useTheme().setMode('dark' | 'light')` — never mutate `document.documentElement.classList`.
195
-
196
- ---
197
-
198
- ## 6. Layout Governance & Redundant Wrapper Rule
199
-
200
- 1. **Use Layout Primitives**: Arrange layouts using `Stack`, `HStack`, `VStack`, `Flex`, `Grid`, and `Box` from `@wangs-ui/foundation/layout`.
201
- 2. **Zero Redundant Wrappers**: Never wrap a single component in an unnecessary `<div>` or `<Box>` (e.g. `<div><DataTable /></div>` or `<Box><Card /></Box>`).
202
- 3. **No Inline Styling Overrides**: Component visual styling lives in global presets. Do not pass ad-hoc utility classes (`className="h-5 w-5"`, `rounded-lg`) directly to primitives or icons unless documented as an MCP exception.