@ikas/component-cli 0.83.0 → 0.86.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 (38) hide show
  1. package/dist/commands/create.d.ts.map +1 -1
  2. package/dist/commands/create.js +34 -793
  3. package/dist/commands/create.js.map +1 -1
  4. package/dist/utils/component-helpers.d.ts.map +1 -1
  5. package/dist/utils/component-helpers.js +9 -65
  6. package/dist/utils/component-helpers.js.map +1 -1
  7. package/dist/utils/observer-runtime.d.ts.map +1 -1
  8. package/dist/utils/observer-runtime.js +2 -37
  9. package/dist/utils/observer-runtime.js.map +1 -1
  10. package/dist/utils/template.d.ts +8 -0
  11. package/dist/utils/template.d.ts.map +1 -0
  12. package/dist/utils/template.js +24 -0
  13. package/dist/utils/template.js.map +1 -0
  14. package/package.json +3 -2
  15. package/templates/add/component.css +13 -0
  16. package/templates/add/component.tsx +12 -0
  17. package/templates/add/section.css +17 -0
  18. package/templates/add/section.tsx +14 -0
  19. package/templates/create/README.md +50 -0
  20. package/templates/create/claude-md +258 -0
  21. package/templates/create/cursorrules +107 -0
  22. package/templates/create/gitignore +5 -0
  23. package/templates/create/ikas.config.json +95 -0
  24. package/templates/create/mcp.json +10 -0
  25. package/templates/create/package.json +21 -0
  26. package/templates/create/src/components/ExampleComponent/index.tsx +22 -0
  27. package/templates/create/src/components/ExampleComponent/styles.css +36 -0
  28. package/templates/create/src/components/ExampleComponent/types.ts +7 -0
  29. package/templates/create/src/components/ExampleSection/index.tsx +14 -0
  30. package/templates/create/src/components/ExampleSection/styles.css +29 -0
  31. package/templates/create/src/components/ExampleSection/types.ts +6 -0
  32. package/templates/create/src/components/index.ts +2 -0
  33. package/templates/create/src/global-types.ts +5 -0
  34. package/templates/create/src/global.css +12 -0
  35. package/templates/create/src/ikas-component-utils.d.ts +3 -0
  36. package/templates/create/tsconfig.json +30 -0
  37. package/templates/create/vite.config.ts +15 -0
  38. package/templates/observer-runtime.js +34 -0
@@ -0,0 +1,258 @@
1
+ # ikas Code Components Project
2
+
3
+ You are building **Preact + TypeScript components for an e-commerce storefront**.
4
+ This project uses the ikas Code Components framework with an MCP server for API documentation.
5
+
6
+ **ALWAYS query MCP tools before writing code that uses storefront APIs.**
7
+ Never guess function signatures or type shapes — the MCP server is the source of truth.
8
+
9
+ ## CRITICAL: Auto-Generated Files
10
+
11
+ **NEVER manually create or edit `types.ts` or `global-types.ts`** — they are auto-generated by CLI commands.
12
+ Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage props.
13
+ These commands update `ikas.config.json`, `types.ts`, and `global-types.ts` automatically.
14
+
15
+ ## MCP Tools (12 tools)
16
+
17
+ ### Starting a New Section
18
+ | Tool | Purpose |
19
+ |------|---------|
20
+ | `get_section_template(sectionType)` | **Start here** — production-ready starter template (index.tsx + types.ts + styles.css + config) for common sections: header, footer, product-detail, product-list, cart, login, register, hero-banner, blog-post, faq, etc. |
21
+ | `get_framework_guide(topic)` | Framework docs — "ai-workflow", "common-pitfalls", "prop-types", "css-scoping", "form-handling", "imports", "sections-vs-components" |
22
+ | `get_code_example(task)` | Code examples — "add to cart", "variant selection", "image-handling", "product-detail-section", "cart-section" |
23
+
24
+ ### Looking Up APIs
25
+ | Tool | Purpose |
26
+ |------|---------|
27
+ | `search_docs(query)` | Search across all storefront API docs and framework guides |
28
+ | `get_function_doc(name)` | Full docs for a specific function (e.g. "addItemToCart", "Router.navigate") |
29
+ | `list_functions(category?)` | List functions by category: ProductDetail, Cart, ProductList, Navigation, Customer, Order, Image, Blog, Brand, Category, Pricing, Form, Validation, Pagination, Filtering |
30
+ | `get_prop_types()` | All available ikas.config.json prop types with TS types and examples |
31
+
32
+ ### Exploring Types
33
+ | Tool | Purpose |
34
+ |------|---------|
35
+ | `get_model_guide(model)` | **One-stop-shop** — type definition + all utility functions + examples + related types for a model (e.g. "IkasProduct", "IkasOrder") |
36
+ | `get_type_definition(name)` | Full definition of a type or enum (e.g. "IkasProduct", "IkasOrderStatus") |
37
+ | `get_functions_for_type(typeName)` | All utility functions for a type (e.g. "IkasImage") |
38
+ | `search_types(query)` | Search types/enums by keyword (e.g. "price", "address", "status") |
39
+ | `list_types(domain?, kind?)` | List all types, optionally filtered by domain ("product", "cart", "order") or kind ("type", "enum") |
40
+
41
+ ## CLI Commands
42
+
43
+ **Never edit ikas.config.json or types.ts manually** — use the CLI commands:
44
+
45
+ | Command | Purpose |
46
+ |---------|---------|
47
+ | `npx ikas-component config add-component --name "Name" --type section --props '[...]'` | **Primary** — create component with all props in one command |
48
+ | `npx ikas-component config add-component --name "Name" --type section` | Create component with no props (add later) |
49
+ | `npx ikas-component config add-prop --component "Name" --name title --displayName "Title" --type TEXT --required [--group content]` | Add a single prop incrementally |
50
+ | `npx ikas-component config update-prop --component "Name" --prop title --type RICH_TEXT [--group colors]` | Update a prop's type or group |
51
+ | `npx ikas-component config remove-prop --component "Name" --prop title` | Remove a prop |
52
+ | `npx ikas-component config remove-component --name "Name"` | Remove a component |
53
+ | `npx ikas-component config add-prop-group --component "Name" --id colors --name "Colors" [--description "..."] [--parent style]` | Create a prop group |
54
+ | `npx ikas-component config update-prop-group --component "Name" --id colors [--name "..."] [--description "..."]` | Update a prop group |
55
+ | `npx ikas-component config remove-prop-group --component "Name" --id colors` | Remove a prop group |
56
+ | `npx ikas-component config list` | List all components and their props |
57
+ | `npx ikas-component check --json` | Type-check all components, output errors as JSON |
58
+ | `npx ikas-component build` | Compile server.js + client.js + styles.css per component |
59
+ | `npx ikas-component dev` | Start dev server (Vite 5200 + WebSocket 5201) |
60
+
61
+ ## Workflow: Building a New Section
62
+
63
+ 1. `get_section_template("product-detail")` → get starter files + CLI command with --props
64
+ 2. Run the CLI command (creates component + props + types.ts in one step)
65
+ 3. Write `index.tsx` and `styles.css` using the template (do NOT edit types.ts — it's already generated)
66
+ 4. Look up APIs → `get_model_guide("IkasProduct")`, `get_function_doc("addItemToCart")`
67
+ 5. `npx ikas-component check --json` → fix type errors
68
+ 6. `npx ikas-component build` → verify clean build
69
+
70
+ ## Sub-Component Structure
71
+
72
+ **ALWAYS create sub-components in `src/sub-components/` with their own folder containing `index.tsx` and `styles.css`. NEVER create flat .tsx files inside a component folder.**
73
+
74
+ ```
75
+ src/
76
+ ├── components/
77
+ │ ├── ProductList/
78
+ │ │ ├── index.tsx # imports from ../../sub-components/...
79
+ │ │ ├── types.ts # auto-generated (CLI-managed)
80
+ │ │ └── styles.css # @import "../../sub-components/.../styles.css"
81
+ │ └── index.ts
82
+ ├── sub-components/
83
+ │ ├── ProductCard/
84
+ │ │ ├── index.tsx # sub-component with inline Props
85
+ │ │ └── styles.css
86
+ │ └── FilterSidebar/
87
+ │ ├── index.tsx
88
+ │ └── styles.css
89
+ ├── global.css # unscoped global styles
90
+ └── global-types.ts # auto-generated shared enum types
91
+ ```
92
+
93
+ **Key rules:**
94
+ - `src/components/` = registered in ikas.config.json. `src/sub-components/` = internal helpers (NOT in ikas.config.json)
95
+ - Sub-components do NOT have `types.ts` — define `Props` inline in `index.tsx`
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
+ - CSS: use `@import "../../sub-components/ProductCard/styles.css";` in parent styles.css
98
+ - TSX: use `import ProductCard from "../../sub-components/ProductCard";`
99
+ - Sub-components should be wrapped with `observer()` from `@ikas/component-utils`
100
+ - Sub-components can be shared across multiple parent sections
101
+
102
+ ```tsx
103
+ // src/sub-components/ProductCard/index.tsx — inline Props, no types.ts
104
+ import { IkasProduct, getSelectedProductVariant } from "@ikas/bp-storefront";
105
+
106
+ interface Props { product: IkasProduct; }
107
+
108
+ export default function ProductCard({ product }: Props) { ... }
109
+ ```
110
+
111
+ ## Key Patterns
112
+
113
+ ### Component Exports & Reactivity
114
+ ```tsx
115
+ // Root components are automatically reactive — the ikas runtime wraps them in autorun().
116
+ // Do NOT import or use observer() on root exports.
117
+ import { Props } from "./types";
118
+
119
+ export function MySection({ product }: Props) { ... }
120
+ export default MySection;
121
+ ```
122
+
123
+ ```tsx
124
+ // Only use observer() on extracted SUB-COMPONENTS
125
+ import { observer } from "@ikas/component-utils";
126
+
127
+ const CartBadge = observer(function CartBadge() {
128
+ const count = cartStore.order?.orderLineItems?.length ?? 0;
129
+ return <span>{count}</span>;
130
+ });
131
+ ```
132
+
133
+ ### Null Safety
134
+ ```tsx
135
+ // Storefront models can be null — always check before accessing
136
+ if (!product) return null;
137
+ const price = product.selectedVariant?.price?.formattedPrice ?? "";
138
+ ```
139
+
140
+ ### Mutations
141
+ ```tsx
142
+ // Functions like addItemToCart() mutate the model in-place (MobX observable)
143
+ // No need to capture return value — root components re-render automatically via autorun()
144
+ await addItemToCart({ product });
145
+ ```
146
+
147
+ ### COMPONENT & COMPONENT_LIST Props
148
+ These props let you create **slot-based** architectures where store owners can drag child components into your section/component from the editor.
149
+
150
+ - `COMPONENT` — a single child component slot (TS type: `any`)
151
+ - `COMPONENT_LIST` — a list of child components (TS type: `any`)
152
+
153
+ **Rendering:** Use the `<IkasComponentRenderer>` wrapper to render child components:
154
+ ```tsx
155
+ import { IkasComponentRenderer } from "@ikas/bp-storefront";
156
+ import { Props } from "./types";
157
+
158
+ export function MySection({ title, cardList, ...props }: Props) {
159
+ return (
160
+ <section>
161
+ <h2>{title}</h2>
162
+ <div className="cards">
163
+ {/* COMPONENT_LIST — render a list of child components */}
164
+ <IkasComponentRenderer
165
+ components={cardList as any[]}
166
+ parentProps={props}
167
+ />
168
+ </div>
169
+ </section>
170
+ );
171
+ }
172
+ export default MySection;
173
+ ```
174
+
175
+ **Key rules:**
176
+ - Always pass `parentProps={props}` so child components can access parent data via dynamic values
177
+ - Cast the prop value: `components={myList as any[]}` for COMPONENT_LIST, `components={[myComp] as any[]}` for COMPONENT
178
+ - `<IkasComponentRenderer>` handles rendering, styling, and reactivity of child components automatically
179
+
180
+ **Config example:**
181
+ ```json
182
+ {
183
+ "name": "cardList",
184
+ "displayName": "Card List",
185
+ "type": "COMPONENT_LIST"
186
+ }
187
+ ```
188
+
189
+ ### CSS Scoping
190
+ All CSS is auto-scoped with `.cc_{componentId}` prefix. Write plain class names — they are scoped at build time.
191
+
192
+ ### Preact Event Handling
193
+ Use `onInput` instead of `onChange` for text inputs (Preact behavior).
194
+
195
+ ### Import Source
196
+ ```tsx
197
+ import { addItemToCart, IkasProduct, IkasImage } from "@ikas/bp-storefront";
198
+ ```
199
+
200
+ ## No Static Text Rule
201
+
202
+ **CRITICAL: Never hardcode user-visible text in JSX.** All text strings (headings, button labels,
203
+ empty states, loading messages, form labels) MUST be TEXT props with defaultValues.
204
+
205
+ Wrong: `<h1>Sign In</h1>`
206
+ Correct: `<h1>{title}</h1>` with `title` as TEXT prop (defaultValue: "Sign In")
207
+
208
+ For button loading states, use two separate props:
209
+ - `submitButtonText` (default: "Sign In")
210
+ - `submittingButtonText` (default: "Signing in...")
211
+
212
+ Group text props under a "Texts" propGroup or another specific text group name.
213
+
214
+ ## Sections vs Components
215
+
216
+ - **Sections** = page-level, full-width containers (Header, Hero, Product Grid, Footer).
217
+ Set `"type": "section"` via CLI. Use `<section>` root element. Props interface: `Props`.
218
+ **Sections MUST always include a `backgroundColor` COLOR prop** (default: `#ffffff`).
219
+ Apply via inline style: `style={backgroundColor ? { backgroundColor } : undefined}`
220
+ Consider also adding `textColor` COLOR props for text elements directly on the section background.
221
+ - **Components** = child elements placed inside sections (buttons, cards, badges).
222
+ Defaults to `"component"`. Use `<div>` root element. Props interface: `Props`.
223
+
224
+ ## Prop Groups
225
+
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
+
228
+ ### Config Format
229
+ - Define groups in `propGroups` array on the component in `ikas.config.json`
230
+ - Assign props to groups via `groupId` on each prop
231
+ - Groups can nest 1 level deep via `children`
232
+ - Props without `groupId` appear ungrouped at root level
233
+ - Group IDs must be unique within a component
234
+
235
+ ### CLI Commands
236
+ - `config add-prop-group --component "Name" --id content --name "Content"` — create group
237
+ - `config add-prop-group --component "Name" --id colors --name "Colors" --parent style` — create nested group
238
+ - `config add-prop --component "Name" --name title --displayName "Title" --type TEXT --group content` — add prop to group
239
+ - `config update-prop --component "Name" --prop title --group colors` — move prop to different group
240
+ - `config remove-prop-group --component "Name" --id content` — remove group (props become ungrouped)
241
+
242
+ ### When to Use
243
+ - props that are related to each other → group related props
244
+ - Sections with content + style props → separate "Content" and "Appearance" groups
245
+ - Complex sections → use nested groups (e.g., "Style" → "Colors", "Typography")
246
+
247
+ ## Workflow Addition
248
+
249
+ When building a section with props that are related to each other, organize into prop groups after defining props:
250
+ ```bash
251
+ npx ikas-component config add-prop-group --component "Name" --id content --name "Content"
252
+ npx ikas-component config update-prop --component "Name" --prop title --group content
253
+ ```
254
+
255
+ ## Build Verification
256
+
257
+ IMPORTANT: After completing any task, always run `npx ikas-component build` (or `npm run build`) to check for
258
+ TypeScript and build errors. Fix any errors before considering the task done.
@@ -0,0 +1,107 @@
1
+ # ikas Code Components
2
+
3
+ You are building **Preact + TypeScript components for an e-commerce storefront**.
4
+ **ALWAYS query MCP tools before writing code that uses storefront APIs.**
5
+
6
+ ## CRITICAL: Auto-Generated Files
7
+
8
+ **NEVER manually create or edit `types.ts` or `global-types.ts`** — they are auto-generated by CLI commands.
9
+ Use `npx ikas-component config add-component --props '[...]'` or `npx ikas-component config add-prop` to manage props.
10
+ These commands update `ikas.config.json`, `types.ts`, and `global-types.ts` automatically.
11
+
12
+ ## MCP Tools (12 tools)
13
+
14
+ ### Starting a New Section
15
+ - get_section_template(sectionType) — **Start here** — production-ready starter template for common sections (header, footer, product-detail, product-list, cart, login, hero-banner, blog-post, faq, etc.)
16
+ - get_framework_guide(topic) — Framework docs ("ai-workflow", "common-pitfalls", "prop-types", "css-scoping", "form-handling", "imports")
17
+ - get_code_example(task) — Code examples ("add to cart", "variant selection", "image-handling")
18
+
19
+ ### Looking Up APIs
20
+ - search_docs(query) — Search all storefront API docs and framework guides
21
+ - get_function_doc(name) — Full docs for a function (e.g. "addItemToCart", "Router.navigate")
22
+ - list_functions(category?) — List functions by category (ProductDetail, Cart, ProductList, Navigation, Customer, Order, Image, Blog, Brand, Pricing, Form, Validation, Pagination, Filtering)
23
+ - get_prop_types() — All available ikas.config.json prop types
24
+
25
+ ### Exploring Types
26
+ - get_model_guide(model) — **One-stop-shop** — type def + utility functions + examples for a model (e.g. "IkasProduct", "IkasOrder")
27
+ - get_type_definition(name) — Full definition of a type or enum
28
+ - get_functions_for_type(typeName) — All utility functions for a type
29
+ - search_types(query) — Search types/enums by keyword ("price", "address", "status")
30
+ - list_types(domain?, kind?) — List all types, filter by domain or kind ("type"/"enum")
31
+
32
+ ## CLI Commands (never edit ikas.config.json or types.ts manually)
33
+ - npx ikas-component config add-component --name "Name" --type section --props '[...]' — **Primary** — create with all props in one command
34
+ - npx ikas-component config add-component --name "Name" --type section — Create component with no props
35
+ - npx ikas-component config add-prop --component "Name" --name title --displayName "Title" --type TEXT --required [--group content] — Add a prop incrementally
36
+ - npx ikas-component config update-prop --component "Name" --prop title --type RICH_TEXT [--group colors] — Update a prop or group
37
+ - npx ikas-component config remove-prop --component "Name" --prop title — Remove a prop
38
+ - npx ikas-component config remove-component --name "Name" — Remove a component
39
+ - npx ikas-component config add-prop-group --component "Name" --id colors --name "Colors" [--parent style] — Create a prop group
40
+ - npx ikas-component config update-prop-group --component "Name" --id colors [--name "..."] — Update a prop group
41
+ - npx ikas-component config remove-prop-group --component "Name" --id colors — Remove a prop group
42
+ - npx ikas-component config list — List all components and their props
43
+ - npx ikas-component check --json — Type-check all components
44
+ - npx ikas-component build — Compile server.js + client.js + styles.css per component
45
+ - npx ikas-component dev — Start dev server (Vite 5200 + WebSocket 5201)
46
+
47
+ ## Workflow: Building a New Section
48
+ 1. get_section_template("product-detail") → get starter files + CLI command with --props
49
+ 2. Run the CLI command (creates component + props + types.ts in one step)
50
+ 3. Write index.tsx and styles.css using the template (do NOT edit types.ts — it's already generated)
51
+ 4. Look up APIs: get_model_guide("IkasProduct"), get_function_doc("addItemToCart")
52
+ 5. npx ikas-component check --json → fix type errors
53
+ 6. npx ikas-component build → verify clean build
54
+
55
+ ## Sub-Component Structure
56
+ **ALWAYS create sub-components in `src/sub-components/` with their own folder containing `index.tsx` and `styles.css`.**
57
+ - `src/components/` = registered in ikas.config.json. `src/sub-components/` = internal helpers (NOT in ikas.config.json)
58
+ - Sub-components do NOT have `types.ts` — define `Props` inline in `index.tsx`
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
+ - TSX: `import ProductCard from "../../sub-components/ProductCard";`
61
+ - Sub-components should be wrapped with `observer()` from `@ikas/component-utils`
62
+ - Sub-components can be shared across multiple parent sections
63
+ - NEVER create flat .tsx files inside a component folder
64
+
65
+ ## Key Patterns
66
+ - Root components are automatically reactive (ikas runtime uses autorun). Do NOT use observer() on root exports.
67
+ Pattern: `export function MySection({ title }: Props) { ... }` + `export default MySection;`
68
+ Only use observer() on sub-components.
69
+ - Null safety: storefront models can be null — always check before accessing
70
+ - Mutations: addItemToCart() etc. mutate MobX observables in-place — no return capture needed
71
+ - COMPONENT & COMPONENT_LIST props: slot-based child components rendered via `<IkasComponentRenderer>`
72
+ `import { IkasComponentRenderer } from "@ikas/bp-storefront"`
73
+ `<IkasComponentRenderer components={myList as any[]} parentProps={props} />`
74
+ Always pass `parentProps={props}` so children can access parent data. Cast with `as any[]`.
75
+ - CSS: write plain class names — auto-scoped with .cc_{componentId} at build time
76
+ - Events: use onInput (not onChange) for text inputs (Preact behavior)
77
+ - Imports: `import { addItemToCart, IkasProduct } from "@ikas/bp-storefront"`
78
+
79
+ ## No Static Text Rule
80
+ **CRITICAL: Never hardcode user-visible text in JSX.** All text strings (headings, button labels,
81
+ empty states, loading messages, form labels) MUST be TEXT props with defaultValues.
82
+ Wrong: `<h1>Sign In</h1>`
83
+ Correct: `<h1>{title}</h1>` with `title` as TEXT prop (defaultValue: "Sign In")
84
+ For button loading states, use two separate props (e.g., `submitButtonText` + `submittingButtonText`).
85
+ Group text props under a "Texts" propGroup or another specific text group name.
86
+
87
+ ## Sections vs Components
88
+ - Sections = page-level containers (Header, Hero, Product Grid, Footer)
89
+ Set "type": "section" via CLI. Use <section> root element. Props interface: Props.
90
+ **Sections MUST always include a `backgroundColor` COLOR prop** (default: `#ffffff`).
91
+ Apply via inline style: `style={backgroundColor ? { backgroundColor } : undefined}`
92
+ Consider also adding `textColor` COLOR props for text elements directly on the section background.
93
+ - Components = child elements inside sections (buttons, cards, badges)
94
+ Defaults to "component". Use <div> root element. Props interface: Props.
95
+
96
+ ## Prop Groups
97
+ Organize props that are related to each other into collapsible groups in editor sidebar.
98
+ - Define groups in `propGroups` on component in ikas.config.json
99
+ - Assign props via `groupId` on each prop
100
+ - Nest 1 level deep with `children`
101
+ - Group IDs must be unique within a component
102
+ - CLI: add-prop-group, update-prop-group, remove-prop-group
103
+ - Add prop to group: add-prop --group <groupId> or update-prop --group <groupId>
104
+
105
+ ## Build Verification
106
+ IMPORTANT: After completing any task, always run `npx ikas-component build` (or `npm run build`)
107
+ to check for TypeScript and build errors. Fix any errors before considering the task done.
@@ -0,0 +1,5 @@
1
+ node_modules/
2
+ dist/
3
+ .DS_Store
4
+ *.log
5
+ asd
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "version": "1.0.0",
4
+ "projectId": "{{PROJECT_ID}}",
5
+ "globalStyles": "./src/global.css",
6
+ "components": [
7
+ {
8
+ "id": "{{EXAMPLE_COMPONENT_ID}}",
9
+ "name": "Example Component",
10
+ "entry": "./src/components/ExampleComponent/index.tsx",
11
+ "styles": "./src/components/ExampleComponent/styles.css",
12
+ "props": [
13
+ {
14
+ "name": "title",
15
+ "displayName": "Title",
16
+ "type": "TEXT",
17
+ "required": true,
18
+ "defaultValue": "Hello World",
19
+ "description": "The main title text"
20
+ },
21
+ {
22
+ "name": "description",
23
+ "displayName": "Description",
24
+ "type": "TEXT",
25
+ "required": false,
26
+ "defaultValue": "This is an example ikas code component built with Preact.",
27
+ "description": "The description text below the title"
28
+ },
29
+ {
30
+ "name": "showButton",
31
+ "displayName": "Show Button",
32
+ "type": "BOOLEAN",
33
+ "required": false,
34
+ "defaultValue": true,
35
+ "description": "Whether to show the action button"
36
+ },
37
+ {
38
+ "name": "buttonText",
39
+ "displayName": "Button Text",
40
+ "type": "TEXT",
41
+ "required": false,
42
+ "defaultValue": "Click Me",
43
+ "description": "The text displayed on the button"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "id": "{{EXAMPLE_SECTION_ID}}",
49
+ "name": "Example Section",
50
+ "entry": "./src/components/ExampleSection/index.tsx",
51
+ "styles": "./src/components/ExampleSection/styles.css",
52
+ "type": "section",
53
+ "props": [
54
+ {
55
+ "name": "heading",
56
+ "displayName": "Heading",
57
+ "type": "TEXT",
58
+ "required": true,
59
+ "defaultValue": "Welcome to Our Store",
60
+ "description": "The section heading text",
61
+ "groupId": "content"
62
+ },
63
+ {
64
+ "name": "subtitle",
65
+ "displayName": "Subtitle",
66
+ "type": "TEXT",
67
+ "required": false,
68
+ "defaultValue": "Discover our latest products and collections.",
69
+ "description": "The subtitle text below the heading",
70
+ "groupId": "content"
71
+ },
72
+ {
73
+ "name": "backgroundColor",
74
+ "displayName": "Background Color",
75
+ "type": "COLOR",
76
+ "required": false,
77
+ "description": "The section background color",
78
+ "groupId": "appearance"
79
+ }
80
+ ],
81
+ "propGroups": [
82
+ {
83
+ "id": "content",
84
+ "name": "Content",
85
+ "description": "Text and copy settings"
86
+ },
87
+ {
88
+ "id": "appearance",
89
+ "name": "Appearance",
90
+ "description": "Colors and visual style"
91
+ }
92
+ ]
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "mcpServers": {
3
+ "ikas-code-components": {
4
+ "command": "npx",
5
+ "args": [
6
+ "ikas-mcp"
7
+ ]
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "ikas-component dev",
7
+ "build": "ikas-component build",
8
+ "add": "ikas-component add",
9
+ "publish": "ikas-component publish"
10
+ },
11
+ "dependencies": {
12
+ "preact": "^10.19.3"
13
+ },
14
+ "devDependencies": {
15
+ "@ikas/component-cli": "*",
16
+ "@ikas/bp-storefront": "*",
17
+ "@ikas/code-components-mcp": "*",
18
+ "typescript": "^5.3.0",
19
+ "vite": "^5.0.0"
20
+ }
21
+ }
@@ -0,0 +1,22 @@
1
+ import { Props } from "./types";
2
+
3
+ export function ExampleComponent({
4
+ title,
5
+ description = "This is an example ikas code component built with Preact.",
6
+ showButton,
7
+ buttonText = "Click Me",
8
+ }: Props) {
9
+ return (
10
+ <div className="example-component">
11
+ <h1 className="example-title">{title}</h1>
12
+ <p className="example-description">{description}</p>
13
+ {showButton && (
14
+ <button className="example-button">
15
+ {buttonText}
16
+ </button>
17
+ )}
18
+ </div>
19
+ );
20
+ }
21
+
22
+ export default ExampleComponent;
@@ -0,0 +1,36 @@
1
+ .example-component {
2
+ padding: 24px;
3
+ border-radius: 8px;
4
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
5
+ color: white;
6
+ font-family: system-ui, -apple-system, sans-serif;
7
+ }
8
+
9
+ .example-title {
10
+ margin: 0 0 12px 0;
11
+ font-size: 28px;
12
+ font-weight: 700;
13
+ }
14
+
15
+ .example-description {
16
+ margin: 0 0 20px 0;
17
+ font-size: 16px;
18
+ opacity: 0.9;
19
+ }
20
+
21
+ .example-button {
22
+ padding: 12px 24px;
23
+ border: none;
24
+ border-radius: 6px;
25
+ background: white;
26
+ color: #667eea;
27
+ font-size: 16px;
28
+ font-weight: 600;
29
+ cursor: pointer;
30
+ transition: transform 0.2s, box-shadow 0.2s;
31
+ }
32
+
33
+ .example-button:hover {
34
+ transform: translateY(-2px);
35
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
36
+ }
@@ -0,0 +1,7 @@
1
+ // Auto-generated types based on ikas.config.json props
2
+ export interface Props {
3
+ title: string;
4
+ description?: string;
5
+ showButton?: boolean;
6
+ buttonText?: string;
7
+ }
@@ -0,0 +1,14 @@
1
+ import { Props } from "./types";
2
+
3
+ export function ExampleSection({ heading, subtitle, backgroundColor }: Props) {
4
+ return (
5
+ <section className="example-section" style={backgroundColor ? { backgroundColor } : undefined}>
6
+ <div className="example-section-inner">
7
+ <h2 className="example-section-heading">{heading}</h2>
8
+ {subtitle && <p className="example-section-subtitle">{subtitle}</p>}
9
+ </div>
10
+ </section>
11
+ );
12
+ }
13
+
14
+ export default ExampleSection;
@@ -0,0 +1,29 @@
1
+ .example-section {
2
+ width: 100%;
3
+ padding: 64px 24px;
4
+ background: #f8f9fa;
5
+ }
6
+
7
+ .example-section-inner {
8
+ max-width: 1200px;
9
+ margin: 0 auto;
10
+ text-align: center;
11
+ }
12
+
13
+ .example-section-heading {
14
+ margin: 0 0 16px 0;
15
+ font-size: 36px;
16
+ font-weight: 700;
17
+ color: #1a1a2e;
18
+ font-family: system-ui, -apple-system, sans-serif;
19
+ }
20
+
21
+ .example-section-subtitle {
22
+ margin: 0;
23
+ font-size: 18px;
24
+ color: #6b7280;
25
+ font-family: system-ui, -apple-system, sans-serif;
26
+ max-width: 600px;
27
+ margin-left: auto;
28
+ margin-right: auto;
29
+ }
@@ -0,0 +1,6 @@
1
+ // Auto-generated types based on ikas.config.json props
2
+ export interface Props {
3
+ heading: string;
4
+ subtitle?: string;
5
+ backgroundColor?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ export { ExampleComponent } from "./ExampleComponent/index";
2
+ export { ExampleSection } from "./ExampleSection/index";
@@ -0,0 +1,5 @@
1
+ // Auto-generated global type definitions for ikas code components.
2
+ // Custom enum types from the editor will appear here.
3
+ // This file is regenerated automatically — do not edit manually.
4
+
5
+ export {};
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Global styles for your ikas code components project.
3
+ * These styles are NOT scoped — they apply across all components.
4
+ * Use this for CSS resets, base typography, utility classes, or CSS variables.
5
+ *
6
+ * Loading order:
7
+ * 1. Global CSS (this file) — lowest specificity
8
+ * 2. Shared chunk CSS — multi-scope (.cc_a .sel, .cc_b .sel)
9
+ * 3. Component CSS — single scope (.cc_id .sel) — highest specificity
10
+ *
11
+ * Component-scoped styles naturally override these globals.
12
+ */
@@ -0,0 +1,3 @@
1
+ declare module "@ikas/component-utils" {
2
+ export function observer<T extends (props: any) => any>(component: T): T;
3
+ }