@wangs-ui/skills 1.3.0-alpha.2 → 1.3.0-alpha.9
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 +2 -5
- package/dist/bin.js +1 -1
- package/dist/index.js +1 -1
- package/dist/skills/craft-theme/SKILL.md +62 -0
- package/dist/skills/create-form/SKILL.md +23 -15
- package/dist/skills/data-table/SKILL.md +19 -12
- package/dist/skills/dialog-modal/SKILL.md +15 -7
- package/dist/skills/i18n-usage/SKILL.md +15 -8
- package/dist/skills/layout-navigation/SKILL.md +15 -8
- package/dist/skills/universal-layout/SKILL.md +87 -0
- package/dist/skills/wangs-ui-components/SKILL.md +23 -15
- package/dist/{src-DDi-O7tk.js → src-BvsMfJmb.js} +20 -12
- package/package.json +1 -1
- package/skills/craft-theme/SKILL.md +62 -0
- package/skills/create-form/SKILL.md +23 -15
- package/skills/data-table/SKILL.md +19 -12
- package/skills/dialog-modal/SKILL.md +15 -7
- package/skills/i18n-usage/SKILL.md +15 -8
- package/skills/layout-navigation/SKILL.md +15 -8
- package/skills/universal-layout/SKILL.md +87 -0
- package/skills/wangs-ui-components/SKILL.md +23 -15
|
@@ -16,19 +16,26 @@ Do **NOT** guess layout block slots, sidebar item interfaces, or breadcrumb prop
|
|
|
16
16
|
### Inspect Layout & Navigation Contracts:
|
|
17
17
|
|
|
18
18
|
```json
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
get_component_api({ "id": "applayout" })
|
|
20
|
+
get_component_api({ "id": "sidebar" })
|
|
21
|
+
get_component_api({ "id": "breadcrumb" })
|
|
22
|
+
get_component_api({ "id": "tabs" })
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Read Curated Layout Documentation:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
get_documentation({ "id": "applayout" })
|
|
29
|
+
get_documentation({ "id": "sidebar" })
|
|
23
30
|
```
|
|
24
31
|
|
|
25
32
|
### Inspect Live Story Implementations:
|
|
26
33
|
|
|
27
34
|
```json
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
get_component_examples({ "component": "applayout", "variant": "TopNavbar" })
|
|
36
|
+
get_component_examples({ "component": "sidebar", "variant": "WithSubMenu" })
|
|
37
|
+
get_component_examples({ "component": "breadcrumb", "variant": "Default" })
|
|
38
|
+
get_component_examples({ "component": "tabs", "variant": "Default" })
|
|
32
39
|
```
|
|
33
40
|
|
|
34
41
|
### Inspect Knowledge Graph & Usages:
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: universal-layout
|
|
3
|
+
description: Universal layout primitives (Box, Flex, Stack, Grid, Container, Section) with ResponsiveValue patterns for Web and React Native in Wangs UI.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Universal Layout Primitives
|
|
7
|
+
|
|
8
|
+
Use this skill when arranging page structure, spacing, or responsive grids with
|
|
9
|
+
`@wangs-ui/foundation/layout`.
|
|
10
|
+
For app shells (sidebar, breadcrumb, tabs), see the `layout-navigation` skill instead.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. MCP Inspection Protocol (Mandatory Single Source of Truth)
|
|
15
|
+
|
|
16
|
+
Do **NOT** guess layout prop names, spacing scales, or breakpoint keys. Query the MCP
|
|
17
|
+
server dynamically:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
list_catalog({ "category": "layout" })
|
|
21
|
+
get_component_api({ "id": "layout:box" })
|
|
22
|
+
get_component_api({ "id": "layout:grid" })
|
|
23
|
+
get_documentation({ "id": "layout-stack" })
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Resolve shared types before writing responsive props:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
resolve_type_definition({ "name": "ResponsiveValue" })
|
|
30
|
+
resolve_type_definition({ "name": "SpacingKey" })
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. Choosing the Right Primitive
|
|
36
|
+
|
|
37
|
+
1. **Stack (VStack)** — default for vertical flows (forms, cards, page sections).
|
|
38
|
+
Fixed `column` direction, uniform `gap`, optional auto-`separator`.
|
|
39
|
+
2. **HStack** — horizontal rows with vertical centering (avatar + label + action,
|
|
40
|
+
toolbar clusters). Fixed `row` direction.
|
|
41
|
+
3. **Flex** — only when you need explicit `direction`, `wrap`, `align`, or `justify`
|
|
42
|
+
control beyond what Stack/HStack fix. Prefer Stack/HStack otherwise.
|
|
43
|
+
4. **Grid** — two-dimensional placement or multi-column flows:
|
|
44
|
+
- explicit `columns={{ compact: 1, medium: 2, expanded: 4 }}` for fixed column counts;
|
|
45
|
+
- `minItemWidth` for auto-fit (columns grow/shrink with container width, no media query);
|
|
46
|
+
- `GridItem` with `colSpan` / `rowSpan` for featured tiles.
|
|
47
|
+
5. **Box** — leaf-level spacing/sizing wrapper (`p`, `m`, `radius`, `overflow`), or
|
|
48
|
+
polymorphic `as="section" | "main" | "article"` for landmarks.
|
|
49
|
+
6. **Container / Section** — page-level rhythm only: `Container` bounds max-width
|
|
50
|
+
(`size`, default `'xl'`) with consistent horizontal padding; `Section` sets
|
|
51
|
+
vertical rhythm (`space: 'sm' | 'md' | 'lg'`, default `'md'`). Never nest
|
|
52
|
+
`Container` inside `Container`.
|
|
53
|
+
7. **ZStack** — overlays (badge on card, status dot on avatar, hero overlay).
|
|
54
|
+
8. **AspectRatio / Bleed / Spacer** — media frames (`ratio`), full-bleed breakouts
|
|
55
|
+
inside padded containers (`Bleed`), and flexible fillers in stacks (`Spacer`).
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 3. Mandatory Implementation Rules
|
|
60
|
+
|
|
61
|
+
1. **ResponsiveValue everywhere**: scalar for static (`gap={4}`), object for
|
|
62
|
+
adaptive (`gap={{ compact: 2, medium: 4, expanded: 6 }}`,
|
|
63
|
+
`columns={{ compact: 1, medium: 2, expanded: 4 }}`). Breakpoints are
|
|
64
|
+
`compact` (mobile-first base), `medium` (`md:`), `expanded` (`lg:`).
|
|
65
|
+
2. **Separators, not manual dividers**: `<Stack separator={<Divider />}>` inserts
|
|
66
|
+
dividers between children with no trailing element. Never hand-place a divider
|
|
67
|
+
after every child.
|
|
68
|
+
3. **Spacing scale**: `gap`/`p`/`m` use `SpacingKey` (Tailwind numeric scale,
|
|
69
|
+
1 unit = 4px). Never pass raw pixel strings to spacing props.
|
|
70
|
+
4. **Strict subpath imports**:
|
|
71
|
+
```tsx
|
|
72
|
+
import { Stack, HStack, Grid, Container } from '@wangs-ui/foundation/layout';
|
|
73
|
+
```
|
|
74
|
+
5. **Translate visible labels** inside layout children via `t('...')` from
|
|
75
|
+
`@wangs-ui/react-i18n` (layout props themselves are never translated).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 4. Anti-Patterns (Forbidden)
|
|
80
|
+
|
|
81
|
+
1. **Gap vs margin**: NEVER hardcode `marginBottom`/`mb-*` on children inside a
|
|
82
|
+
Stack/Flex/Grid to fake spacing — always use the parent's `gap`/`gapX`/`gapY`.
|
|
83
|
+
Margins collapse unpredictably and break `separator` insertion.
|
|
84
|
+
2. **No nested Containers** and no `Container` for non-page content (cards, modals).
|
|
85
|
+
3. **No `Flex` with hardcoded `flexDirection` styles** when `Stack`/`HStack` express it.
|
|
86
|
+
4. **No raw media queries** for `direction`/`gap`/`columns` — use `ResponsiveValue`.
|
|
87
|
+
5. **No `Grid` for one-dimensional lists** — that is `Stack`/`HStack` territory.
|
|
@@ -15,28 +15,34 @@ Do **NOT** guess component props, Pass-Through (`pt`) slots, or event names. Alw
|
|
|
15
15
|
|
|
16
16
|
```mermaid
|
|
17
17
|
graph TD
|
|
18
|
-
A[Identify Component Needed] --> B[
|
|
19
|
-
B --> C
|
|
20
|
-
C
|
|
21
|
-
|
|
22
|
-
D
|
|
23
|
-
E -->
|
|
18
|
+
A[Identify Component Needed] --> B[list_catalog to confirm the id]
|
|
19
|
+
B --> C[get_component_api for the typed contract]
|
|
20
|
+
C --> D{Need live story / variant code?}
|
|
21
|
+
D -->|Yes| E[get_component_examples]
|
|
22
|
+
D -->|No| F[get_documentation for curated guidance]
|
|
23
|
+
E --> G[Check Graphify: query_graph]
|
|
24
|
+
F --> G
|
|
25
|
+
G --> H[Implement Component with Subpath Imports]
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
### Discovery Steps:
|
|
27
29
|
|
|
28
30
|
1. **Inspect Component Contract & Props**:
|
|
29
31
|
```json
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
get_component_api({ "id": "button" })
|
|
33
|
+
get_component_api({ "id": "input" })
|
|
34
|
+
get_component_api({ "id": "datatable" })
|
|
33
35
|
```
|
|
34
|
-
2. **Inspect
|
|
36
|
+
2. **Inspect Curated Documentation**:
|
|
35
37
|
```json
|
|
36
|
-
|
|
37
|
-
get-documentation-for-story({ "id": "datatable", "storyName": "ServerPagination" })
|
|
38
|
+
get_documentation({ "id": "button" })
|
|
38
39
|
```
|
|
39
|
-
3. **Inspect
|
|
40
|
+
3. **Inspect Live Usage & Story Variants**:
|
|
41
|
+
```json
|
|
42
|
+
get_component_examples({ "component": "button", "variant": "Sizes" })
|
|
43
|
+
get_component_examples({ "component": "datatable", "variant": "CursorPagination" })
|
|
44
|
+
```
|
|
45
|
+
4. **Inspect Relationships & Real Usages in Graph**:
|
|
40
46
|
```json
|
|
41
47
|
query_graph({ "query": "DataTable" })
|
|
42
48
|
query_graph({ "query": "usePT" })
|
|
@@ -104,5 +110,7 @@ Never write raw HTML elements when a Wangs UI primitive exists:
|
|
|
104
110
|
|
|
105
111
|
### Spacing Tokens
|
|
106
112
|
|
|
107
|
-
-
|
|
108
|
-
-
|
|
113
|
+
- Flat numeric scale, Tailwind-aligned (1 unit = 4px): `0`, `0.5`, `1`, `1.5`, `2`, `2.5`, `3`, `3.5`, `4`…`16` (e.g. `4` = 16px)
|
|
114
|
+
- Web: use numeric utilities directly — Gap: `gap-4`, Padding: `px-4 py-1.5`
|
|
115
|
+
- Native: read pixel values via `useTheme().spacing` (e.g. `spacing[4] === 16`)
|
|
116
|
+
- Responsiveness via `ResponsiveValue<T>` size props and `<Show>`, not per-density spacing tokens
|