@ikas/component-cli 0.85.0 → 0.87.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/dist/commands/create.js
CHANGED
|
@@ -61,7 +61,7 @@ async function createProject(projectName) {
|
|
|
61
61
|
{ template: "create/gitignore", dest: ".gitignore" },
|
|
62
62
|
{ template: "create/mcp.json", dest: ".mcp.json" },
|
|
63
63
|
{ template: "create/README.md", dest: "README.md", vars },
|
|
64
|
-
{ template: "create/
|
|
64
|
+
{ template: "create/claude-md", dest: "CLAUDE.md" },
|
|
65
65
|
{ template: "create/cursorrules", dest: ".cursorrules" },
|
|
66
66
|
{ template: "create/src/global.css", dest: "src/global.css" },
|
|
67
67
|
{ template: "create/src/global-types.ts", dest: "src/global-types.ts" },
|
package/package.json
CHANGED
|
@@ -96,7 +96,7 @@ src/
|
|
|
96
96
|
- Custom enum types are exported from `src/global-types.ts` (auto-generated). Sub-components can import them: `import type { MyEnum } from "../../global-types";`
|
|
97
97
|
- CSS: use `@import "../../sub-components/ProductCard/styles.css";` in parent styles.css
|
|
98
98
|
- TSX: use `import ProductCard from "../../sub-components/ProductCard";`
|
|
99
|
-
- Sub-components
|
|
99
|
+
- Sub-components should be wrapped with `observer()` from `@ikas/component-utils`
|
|
100
100
|
- Sub-components can be shared across multiple parent sections
|
|
101
101
|
|
|
102
102
|
```tsx
|
|
@@ -121,7 +121,7 @@ export default MySection;
|
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
```tsx
|
|
124
|
-
// Only use observer() on extracted SUB-COMPONENTS
|
|
124
|
+
// Only use observer() on extracted SUB-COMPONENTS
|
|
125
125
|
import { observer } from "@ikas/component-utils";
|
|
126
126
|
|
|
127
127
|
const CartBadge = observer(function CartBadge() {
|
|
@@ -209,7 +209,7 @@ For button loading states, use two separate props:
|
|
|
209
209
|
- `submitButtonText` (default: "Sign In")
|
|
210
210
|
- `submittingButtonText` (default: "Signing in...")
|
|
211
211
|
|
|
212
|
-
Group text props under a "Texts" propGroup
|
|
212
|
+
Group text props under a "Texts" propGroup or another specific text group name.
|
|
213
213
|
|
|
214
214
|
## Sections vs Components
|
|
215
215
|
|
|
@@ -223,7 +223,7 @@ Group text props under a "Texts" propGroup when the component has 5+ props.
|
|
|
223
223
|
|
|
224
224
|
## Prop Groups
|
|
225
225
|
|
|
226
|
-
Organize props into collapsible groups in the editor sidebar. Use prop groups when a component has
|
|
226
|
+
Organize props into collapsible groups in the editor sidebar. Use prop groups when a component has props that are related to each other.
|
|
227
227
|
|
|
228
228
|
### Config Format
|
|
229
229
|
- Define groups in `propGroups` array on the component in `ikas.config.json`
|
|
@@ -240,13 +240,13 @@ Organize props into collapsible groups in the editor sidebar. Use prop groups wh
|
|
|
240
240
|
- `config remove-prop-group --component "Name" --id content` — remove group (props become ungrouped)
|
|
241
241
|
|
|
242
242
|
### When to Use
|
|
243
|
-
-
|
|
243
|
+
- props that are related to each other → group related props
|
|
244
244
|
- Sections with content + style props → separate "Content" and "Appearance" groups
|
|
245
245
|
- Complex sections → use nested groups (e.g., "Style" → "Colors", "Typography")
|
|
246
246
|
|
|
247
247
|
## Workflow Addition
|
|
248
248
|
|
|
249
|
-
When building a section with
|
|
249
|
+
When building a section with props that are related to each other, organize into prop groups after defining props:
|
|
250
250
|
```bash
|
|
251
251
|
npx ikas-component config add-prop-group --component "Name" --id content --name "Content"
|
|
252
252
|
npx ikas-component config update-prop --component "Name" --prop title --group content
|
|
@@ -57,16 +57,15 @@ These commands update `ikas.config.json`, `types.ts`, and `global-types.ts` auto
|
|
|
57
57
|
- `src/components/` = registered in ikas.config.json. `src/sub-components/` = internal helpers (NOT in ikas.config.json)
|
|
58
58
|
- Sub-components do NOT have `types.ts` — define `Props` inline in `index.tsx`
|
|
59
59
|
- Custom enum types are exported from `src/global-types.ts` (auto-generated). Sub-components can import them: `import type { MyEnum } from "../../global-types";`
|
|
60
|
-
- CSS: `@import "../../sub-components/ProductCard/styles.css";` in parent styles.css
|
|
61
60
|
- TSX: `import ProductCard from "../../sub-components/ProductCard";`
|
|
62
|
-
- Sub-components
|
|
61
|
+
- Sub-components should be wrapped with `observer()` from `@ikas/component-utils`
|
|
63
62
|
- Sub-components can be shared across multiple parent sections
|
|
64
63
|
- NEVER create flat .tsx files inside a component folder
|
|
65
64
|
|
|
66
65
|
## Key Patterns
|
|
67
66
|
- Root components are automatically reactive (ikas runtime uses autorun). Do NOT use observer() on root exports.
|
|
68
67
|
Pattern: `export function MySection({ title }: Props) { ... }` + `export default MySection;`
|
|
69
|
-
Only use observer() on
|
|
68
|
+
Only use observer() on sub-components.
|
|
70
69
|
- Null safety: storefront models can be null — always check before accessing
|
|
71
70
|
- Mutations: addItemToCart() etc. mutate MobX observables in-place — no return capture needed
|
|
72
71
|
- COMPONENT & COMPONENT_LIST props: slot-based child components rendered via `<IkasComponentRenderer>`
|
|
@@ -83,7 +82,7 @@ empty states, loading messages, form labels) MUST be TEXT props with defaultValu
|
|
|
83
82
|
Wrong: `<h1>Sign In</h1>`
|
|
84
83
|
Correct: `<h1>{title}</h1>` with `title` as TEXT prop (defaultValue: "Sign In")
|
|
85
84
|
For button loading states, use two separate props (e.g., `submitButtonText` + `submittingButtonText`).
|
|
86
|
-
Group text props under a "Texts" propGroup
|
|
85
|
+
Group text props under a "Texts" propGroup or another specific text group name.
|
|
87
86
|
|
|
88
87
|
## Sections vs Components
|
|
89
88
|
- Sections = page-level containers (Header, Hero, Product Grid, Footer)
|
|
@@ -95,7 +94,7 @@ Group text props under a "Texts" propGroup when the component has 5+ props.
|
|
|
95
94
|
Defaults to "component". Use <div> root element. Props interface: Props.
|
|
96
95
|
|
|
97
96
|
## Prop Groups
|
|
98
|
-
Organize
|
|
97
|
+
Organize props that are related to each other into collapsible groups in editor sidebar.
|
|
99
98
|
- Define groups in `propGroups` on component in ikas.config.json
|
|
100
99
|
- Assign props via `groupId` on each prop
|
|
101
100
|
- Nest 1 level deep with `children`
|