mozaic-mcp-server 2.1.1 → 2.3.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 (55) hide show
  1. package/README.md +15 -7
  2. package/SKILLS.md +75 -5
  3. package/bin/install-skills.js +2 -0
  4. package/data/mozaic.db +0 -0
  5. package/dist/__tests__/tools.integration.test.js +85 -0
  6. package/dist/__tests__/tools.integration.test.js.map +1 -1
  7. package/dist/index.js +115 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/parsers/freemarker-parser.d.ts +25 -0
  10. package/dist/parsers/freemarker-parser.d.ts.map +1 -0
  11. package/dist/parsers/freemarker-parser.js +299 -0
  12. package/dist/parsers/freemarker-parser.js.map +1 -0
  13. package/dist/parsers/web-components-parser.d.ts +3 -0
  14. package/dist/parsers/web-components-parser.d.ts.map +1 -0
  15. package/dist/parsers/web-components-parser.js +503 -0
  16. package/dist/parsers/web-components-parser.js.map +1 -0
  17. package/dist/tools/generate-freemarker.d.ts +32 -0
  18. package/dist/tools/generate-freemarker.d.ts.map +1 -0
  19. package/dist/tools/generate-freemarker.js +146 -0
  20. package/dist/tools/generate-freemarker.js.map +1 -0
  21. package/dist/tools/generate-webcomponent.d.ts +38 -0
  22. package/dist/tools/generate-webcomponent.d.ts.map +1 -0
  23. package/dist/tools/generate-webcomponent.js +83 -0
  24. package/dist/tools/generate-webcomponent.js.map +1 -0
  25. package/dist/tools/get-component-info.d.ts +1 -1
  26. package/dist/tools/get-component-info.d.ts.map +1 -1
  27. package/dist/tools/get-component-info.js +9 -1
  28. package/dist/tools/get-component-info.js.map +1 -1
  29. package/dist/tools/get-freemarker-info.d.ts +27 -0
  30. package/dist/tools/get-freemarker-info.d.ts.map +1 -0
  31. package/dist/tools/get-freemarker-info.js +161 -0
  32. package/dist/tools/get-freemarker-info.js.map +1 -0
  33. package/dist/tools/get-webcomponent-info.d.ts +52 -0
  34. package/dist/tools/get-webcomponent-info.d.ts.map +1 -0
  35. package/dist/tools/get-webcomponent-info.js +170 -0
  36. package/dist/tools/get-webcomponent-info.js.map +1 -0
  37. package/dist/tools/list-freemarker.d.ts +23 -0
  38. package/dist/tools/list-freemarker.d.ts.map +1 -0
  39. package/dist/tools/list-freemarker.js +97 -0
  40. package/dist/tools/list-freemarker.js.map +1 -0
  41. package/dist/tools/list-webcomponents.d.ts +32 -0
  42. package/dist/tools/list-webcomponents.d.ts.map +1 -0
  43. package/dist/tools/list-webcomponents.js +110 -0
  44. package/dist/tools/list-webcomponents.js.map +1 -0
  45. package/package.json +1 -1
  46. package/skills/mozaic-freemarker-builder/scripts/generate-component.sh +27 -0
  47. package/skills/mozaic-freemarker-builder/scripts/get-component.sh +28 -0
  48. package/skills/mozaic-freemarker-builder/scripts/list-components.sh +13 -0
  49. package/skills/mozaic-freemarker-builder/scripts/search-components.sh +14 -0
  50. package/skills/mozaic-freemarker-builder/skill.md +145 -0
  51. package/skills/mozaic-webcomponents-builder/scripts/generate-component.sh +67 -0
  52. package/skills/mozaic-webcomponents-builder/scripts/get-component.sh +105 -0
  53. package/skills/mozaic-webcomponents-builder/scripts/list-components.sh +42 -0
  54. package/skills/mozaic-webcomponents-builder/scripts/search-components.sh +34 -0
  55. package/skills/mozaic-webcomponents-builder/skill.md +292 -0
@@ -0,0 +1,145 @@
1
+ # Mozaic Freemarker Builder
2
+
3
+ Interactive Freemarker macro generator for Mozaic Design System. Help users discover, configure, and generate production-ready Freemarker template code with proper imports and configuration.
4
+
5
+ ## Activation
6
+
7
+ This skill activates when users:
8
+ - Ask about Freemarker components or macros
9
+ - Want to generate Freemarker template code
10
+ - Need help with Mozaic Freemarker implementation
11
+ - Mention ".ftl" files or Freemarker templates
12
+
13
+ ## Workflow
14
+
15
+ ### 1. Discovery Phase
16
+ Ask user what they want to build or which component they need:
17
+ ```bash
18
+ # List all Freemarker components
19
+ ./scripts/list-components.sh all
20
+
21
+ # List by category
22
+ ./scripts/list-components.sh form
23
+ ./scripts/list-components.sh navigation
24
+ ```
25
+
26
+ ### 2. Component Selection
27
+ Let user browse and select:
28
+ ```bash
29
+ # Search for specific component
30
+ ./scripts/search-components.sh "button"
31
+
32
+ # Get detailed component info
33
+ ./scripts/get-component.sh "button"
34
+ ```
35
+
36
+ ### 3. Configuration
37
+ Help user configure the component:
38
+ - Show available configuration options (props)
39
+ - Explain required vs optional parameters
40
+ - Provide examples of common configurations
41
+
42
+ ### 4. Code Generation
43
+ Generate ready-to-use Freemarker code:
44
+ ```bash
45
+ # Generate basic code
46
+ ./scripts/generate-component.sh "button"
47
+
48
+ # Generate with configuration
49
+ ./scripts/generate-component.sh "button" '{"color": "primary", "size": "m"}'
50
+
51
+ # Generate with content
52
+ ./scripts/generate-component.sh "button" '{"color": "accent"}' "Click Me"
53
+ ```
54
+
55
+ ## Output Format
56
+
57
+ Always provide:
58
+ 1. **Import statement** - Freemarker import directive
59
+ 2. **Configuration object** - <#assign config = {...}>
60
+ 3. **Macro invocation** - <@macroname.macroname config=config>...</@>
61
+ 4. **Installation info** - Maven dependency
62
+
63
+ Example output:
64
+ ```ftl
65
+ <#import "mozaic/button.ftl" as button>
66
+
67
+ <#assign configButton = {
68
+ "color": "primary",
69
+ "size": "m",
70
+ "outlined": false
71
+ }>
72
+
73
+ <@button.button config=configButton>
74
+ Click Me
75
+ </@button.button>
76
+ ```
77
+
78
+ ## Component Categories
79
+
80
+ - **action**: Buttons, links, icon buttons
81
+ - **form**: Text inputs, checkboxes, radio buttons, fields, file uploaders
82
+ - **feedback**: Notifications, messages, badges, flags, loaders, progress bars, toasters, tooltips
83
+ - **navigation**: Breadcrumbs, tabs, pagination, steppers, menus
84
+ - **layout**: Containers, dividers, modals, drawers, accordions, popovers
85
+ - **data-display**: Cards, tiles, images, avatars, logos, carousels, callouts, tags, ratings
86
+
87
+ ## Best Practices
88
+
89
+ 1. **Always import macros** at the top of .ftl files
90
+ 2. **Define configuration separately** using <#assign>
91
+ 3. **Use descriptive variable names** (e.g., configButton, configModal)
92
+ 4. **Set locale** with <#global locale="fr_FR"/> for i18n
93
+ 5. **Nested content** goes between opening and closing macro tags
94
+
95
+ ## Installation
96
+
97
+ Maven dependency:
98
+ ```xml
99
+ <dependency>
100
+ <groupId>com.adeo.mozaic</groupId>
101
+ <artifactId>mozaic-freemarker</artifactId>
102
+ <version>LATEST_VERSION</version>
103
+ </dependency>
104
+ ```
105
+
106
+ ## Documentation
107
+
108
+ Repository: https://github.com/adeo/mozaic-freemarker
109
+ Design System: https://mozaic.adeo.cloud/
110
+
111
+ ## Example Interaction
112
+
113
+ **User**: "I need a button for my Freemarker template"
114
+
115
+ **Assistant**: "I'll help you create a button with Mozaic Freemarker. Let me show you the available options..."
116
+
117
+ *Runs ./scripts/get-component.sh "button"*
118
+
119
+ "Here are the button configuration options:
120
+ - color: standard, accent, danger, ghost, inverse
121
+ - size: s, m (default), l
122
+ - outlined: boolean for outlined style
123
+ - loading: boolean for loading state
124
+
125
+ What style would you like?"
126
+
127
+ **User**: "Primary colored, medium size"
128
+
129
+ **Assistant**: *Generates code*
130
+
131
+ "Here's your Freemarker button code:
132
+ ```ftl
133
+ <#import "mozaic/button.ftl" as button>
134
+
135
+ <#assign configButton = {
136
+ "color": "primary",
137
+ "size": "m"
138
+ }>
139
+
140
+ <@button.button config=configButton>
141
+ Click Me
142
+ </@button.button>
143
+ ```
144
+
145
+ This will render a primary-colored, medium-sized button. You can customize the text between the tags."
@@ -0,0 +1,67 @@
1
+ #!/bin/bash
2
+ # Generate Web Component usage code
3
+ # Usage: ./generate-component.sh <component-slug> [attributes-json] [children]
4
+
5
+ COMPONENT_SLUG="$1"
6
+ ATTRIBUTES_JSON="${2:-{}}"
7
+ CHILDREN="$3"
8
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
9
+
10
+ if [ -z "$COMPONENT_SLUG" ]; then
11
+ echo "Error: Component slug required"
12
+ echo "Usage: $0 <component-slug> [attributes-json] [children]"
13
+ echo "Example: $0 button '{\"theme\":\"primary\",\"size\":\"m\"}' 'Click me'"
14
+ exit 1
15
+ fi
16
+
17
+ if [ ! -f "$DB_PATH" ]; then
18
+ echo "Error: Database not found at $DB_PATH"
19
+ echo "Please run: npx -p mozaic-mcp-server@latest adeo-mozaic-install-tools skills"
20
+ exit 1
21
+ fi
22
+
23
+ # Get component info
24
+ COMPONENT_NAME=$(sqlite3 "$DB_PATH" <<EOF
25
+ SELECT name FROM components
26
+ WHERE slug = '$COMPONENT_SLUG'
27
+ AND frameworks LIKE '%webcomponents%'
28
+ LIMIT 1;
29
+ EOF
30
+ )
31
+
32
+ if [ -z "$COMPONENT_NAME" ]; then
33
+ echo "Error: Web Component '$COMPONENT_SLUG' not found"
34
+ exit 1
35
+ fi
36
+
37
+ # Generate import statement
38
+ echo "// Import web component"
39
+ echo "import '@adeo/mozaic-web-components/${COMPONENT_SLUG}.js';"
40
+ echo ""
41
+ echo "// Usage in HTML"
42
+
43
+ # Build attributes string
44
+ ATTRS=""
45
+ if [ "$ATTRIBUTES_JSON" != "{}" ]; then
46
+ # Parse JSON and build attributes (simplified - in production use jq)
47
+ ATTRS=$(echo "$ATTRIBUTES_JSON" | sed 's/[{}"]//g' | sed 's/,/ /g' | sed 's/:/=/g')
48
+ fi
49
+
50
+ # Generate component tag
51
+ TAG_NAME="$COMPONENT_SLUG"
52
+
53
+ if [ -n "$CHILDREN" ]; then
54
+ if [ -n "$ATTRS" ]; then
55
+ echo "<${TAG_NAME} ${ATTRS}>"
56
+ else
57
+ echo "<${TAG_NAME}>"
58
+ fi
59
+ echo " ${CHILDREN}"
60
+ echo "</${TAG_NAME}>"
61
+ else
62
+ if [ -n "$ATTRS" ]; then
63
+ echo "<${TAG_NAME} ${ATTRS}></${TAG_NAME}>"
64
+ else
65
+ echo "<${TAG_NAME}></${TAG_NAME}>"
66
+ fi
67
+ fi
@@ -0,0 +1,105 @@
1
+ #!/bin/bash
2
+ # Get detailed information about a Web Component
3
+ # Usage: ./get-component.sh <component-slug>
4
+
5
+ COMPONENT_SLUG="$1"
6
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
7
+
8
+ if [ -z "$COMPONENT_SLUG" ]; then
9
+ echo "Error: Component slug required"
10
+ echo "Usage: $0 <component-slug>"
11
+ echo "Example: $0 button"
12
+ exit 1
13
+ fi
14
+
15
+ if [ ! -f "$DB_PATH" ]; then
16
+ echo "Error: Database not found at $DB_PATH"
17
+ echo "Please run: npx -p mozaic-mcp-server@latest adeo-mozaic-install-tools skills"
18
+ exit 1
19
+ fi
20
+
21
+ COMPONENT_INFO=$(sqlite3 "$DB_PATH" <<EOF
22
+ .mode json
23
+ SELECT * FROM components
24
+ WHERE slug = '$COMPONENT_SLUG'
25
+ AND frameworks LIKE '%webcomponents%'
26
+ LIMIT 1;
27
+ EOF
28
+ )
29
+
30
+ if [ -z "$COMPONENT_INFO" ] || [ "$COMPONENT_INFO" = "[]" ]; then
31
+ echo "Error: Web Component '$COMPONENT_SLUG' not found"
32
+ exit 1
33
+ fi
34
+
35
+ PROPS=$(sqlite3 "$DB_PATH" <<EOF
36
+ .mode json
37
+ SELECT name, type, default_value, required, description
38
+ FROM component_props
39
+ WHERE component_id = (
40
+ SELECT id FROM components WHERE slug = '$COMPONENT_SLUG' AND frameworks LIKE '%webcomponents%'
41
+ )
42
+ ORDER BY required DESC, name;
43
+ EOF
44
+ )
45
+ PROPS="${PROPS:-[]}"
46
+
47
+ SLOTS=$(sqlite3 "$DB_PATH" <<EOF
48
+ .mode json
49
+ SELECT name, description
50
+ FROM component_slots
51
+ WHERE component_id = (
52
+ SELECT id FROM components WHERE slug = '$COMPONENT_SLUG' AND frameworks LIKE '%webcomponents%'
53
+ )
54
+ ORDER BY name;
55
+ EOF
56
+ )
57
+ SLOTS="${SLOTS:-[]}"
58
+
59
+ EVENTS=$(sqlite3 "$DB_PATH" <<EOF
60
+ .mode json
61
+ SELECT name, payload, description
62
+ FROM component_events
63
+ WHERE component_id = (
64
+ SELECT id FROM components WHERE slug = '$COMPONENT_SLUG' AND frameworks LIKE '%webcomponents%'
65
+ )
66
+ ORDER BY name;
67
+ EOF
68
+ )
69
+ EVENTS="${EVENTS:-[]}"
70
+
71
+ EXAMPLES=$(sqlite3 "$DB_PATH" <<EOF
72
+ .mode json
73
+ SELECT title, code, description
74
+ FROM component_examples
75
+ WHERE component_id = (
76
+ SELECT id FROM components WHERE slug = '$COMPONENT_SLUG' AND frameworks LIKE '%webcomponents%'
77
+ )
78
+ AND framework = 'webcomponents'
79
+ ORDER BY id;
80
+ EOF
81
+ )
82
+ EXAMPLES="${EXAMPLES:-[]}"
83
+
84
+ CSS_CLASSES=$(sqlite3 "$DB_PATH" <<EOF
85
+ .mode json
86
+ SELECT class_name
87
+ FROM component_css_classes
88
+ WHERE component_id = (
89
+ SELECT id FROM components WHERE slug = '$COMPONENT_SLUG' AND frameworks LIKE '%webcomponents%'
90
+ )
91
+ ORDER BY class_name;
92
+ EOF
93
+ )
94
+ CSS_CLASSES="${CSS_CLASSES:-[]}"
95
+
96
+ cat <<EOF
97
+ {
98
+ "component": $COMPONENT_INFO,
99
+ "attributes": $PROPS,
100
+ "slots": $SLOTS,
101
+ "events": $EVENTS,
102
+ "examples": $EXAMPLES,
103
+ "cssProperties": $CSS_CLASSES
104
+ }
105
+ EOF
@@ -0,0 +1,42 @@
1
+ #!/bin/bash
2
+ # List Web Components by category
3
+ # Usage: ./list-components.sh [category]
4
+ # Categories: form, navigation, feedback, layout, data-display, action, all (default)
5
+
6
+ CATEGORY="${1:-all}"
7
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
8
+
9
+ # Check if database exists
10
+ if [ ! -f "$DB_PATH" ]; then
11
+ echo "Error: Database not found at $DB_PATH"
12
+ echo "Please run: npx -p mozaic-mcp-server@latest adeo-mozaic-install-tools skills"
13
+ exit 1
14
+ fi
15
+
16
+ # Query components by category
17
+ if [ "$CATEGORY" = "all" ]; then
18
+ sqlite3 "$DB_PATH" <<EOF
19
+ .mode json
20
+ SELECT
21
+ name,
22
+ slug,
23
+ category,
24
+ description
25
+ FROM components
26
+ WHERE frameworks LIKE '%webcomponents%'
27
+ ORDER BY category, name;
28
+ EOF
29
+ else
30
+ sqlite3 "$DB_PATH" <<EOF
31
+ .mode json
32
+ SELECT
33
+ name,
34
+ slug,
35
+ category,
36
+ description
37
+ FROM components
38
+ WHERE frameworks LIKE '%webcomponents%'
39
+ AND category = '$CATEGORY'
40
+ ORDER BY name;
41
+ EOF
42
+ fi
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+ # Search Web Components by name or description
3
+ # Usage: ./search-components.sh <query>
4
+
5
+ QUERY="$1"
6
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
7
+
8
+ if [ -z "$QUERY" ]; then
9
+ echo "Error: Search query required"
10
+ echo "Usage: $0 <query>"
11
+ echo "Example: $0 button"
12
+ exit 1
13
+ fi
14
+
15
+ if [ ! -f "$DB_PATH" ]; then
16
+ echo "Error: Database not found at $DB_PATH"
17
+ echo "Please run: npx -p mozaic-mcp-server@latest adeo-mozaic-install-tools skills"
18
+ exit 1
19
+ fi
20
+
21
+ sqlite3 "$DB_PATH" <<EOF
22
+ .mode json
23
+ SELECT name, slug, category, description
24
+ FROM components
25
+ WHERE frameworks LIKE '%webcomponents%'
26
+ AND (
27
+ name LIKE '%$QUERY%'
28
+ OR slug LIKE '%$QUERY%'
29
+ OR description LIKE '%$QUERY%'
30
+ OR category LIKE '%$QUERY%'
31
+ )
32
+ ORDER BY name
33
+ LIMIT 20;
34
+ EOF
@@ -0,0 +1,292 @@
1
+ ---
2
+ name: mozaic-webcomponents-builder
3
+ description: Interactive Web Components generator with Mozaic Design System. Helps discover, configure, and generate production-ready native web components with proper imports and usage patterns.
4
+ version: 1.0.0
5
+ allowed-tools:
6
+ - Bash
7
+ ---
8
+
9
+ # Mozaic Web Components Builder
10
+
11
+ An interactive assistant for building framework-agnostic applications with Mozaic Design System Web Components by ADEO. This skill helps you discover components, understand their attributes and events, generate ready-to-use HTML/JavaScript code, and set up installation properly.
12
+
13
+ ## What This Skill Does
14
+
15
+ 1. **Discover Web Components**: Browse Mozaic web components by category (forms, navigation, feedback, etc.)
16
+ 2. **Interactive Selection**: Propose component combinations based on your needs
17
+ 3. **Generate Code**: Create complete HTML with JavaScript imports and proper attribute usage
18
+ 4. **Installation Guidance**: Provide npm/yarn commands and import strategies (module vs script tag)
19
+ 5. **Attributes & Events**: Help configure component attributes and set up event listeners
20
+ 6. **Slots & CSS Properties**: Guide on using slots for content projection and CSS custom properties for theming
21
+
22
+ ## Shell Scripts Used
23
+
24
+ This skill uses shell scripts to query the local Mozaic database:
25
+ - `list-components.sh` - Browse available web components by category
26
+ - `get-component.sh` - Get detailed component information (attributes, slots, events, CSS properties)
27
+ - `search-components.sh` - Search components by name or description
28
+ - `generate-component.sh` - Generate web component usage code
29
+
30
+ Database location: `~/.claude/mozaic.db`
31
+
32
+ ## When to Use This Skill
33
+
34
+ Use this skill when you:
35
+ - Need framework-agnostic UI components (vanilla JS, server-rendered apps, micro-frontends)
36
+ - Want to build with native Web Components (Custom Elements v1)
37
+ - Need components that work across frameworks (React, Vue, Angular, Svelte)
38
+ - Are building progressive enhancement layers
39
+ - Want to explore available Mozaic web components
40
+ - Need help with component attributes, events, and slots
41
+ - Want installation and import guidance for web components
42
+
43
+ ## Interactive Workflow
44
+
45
+ ### Step 1: Understanding Your Needs
46
+
47
+ When you activate this skill, I'll ask:
48
+
49
+ **"What type of web component do you need to build?"**
50
+
51
+ Common options:
52
+ - A) Form (inputs, selects, checkboxes, validation)
53
+ - B) Navigation (tabs, breadcrumb, pagination, menu)
54
+ - C) Modal/Dialog (overlay, confirmation, alert)
55
+ - D) Button/Action (primary, secondary, with icons)
56
+ - E) Layout (cards, containers, dividers)
57
+ - F) Data Display (tables, lists, badges, tags)
58
+ - G) Feedback (notifications, loaders, progress bars)
59
+ - H) Other (describe your needs)
60
+
61
+ ### Step 2: Browse Available Components
62
+
63
+ Based on your answer, I'll use the `list-components.sh` script to show relevant web components.
64
+
65
+ **Example**:
66
+ ```
67
+ For forms, Mozaic offers these web components:
68
+ - mozaic-input (text, email, password fields)
69
+ - mozaic-select (dropdowns with single/multiple selection)
70
+ - mozaic-checkbox (checkbox with label)
71
+ - mozaic-radio (radio button)
72
+ - mozaic-toggle (switch control)
73
+ - mozaic-textarea (multi-line text input)
74
+ ```
75
+
76
+ ### Step 3: Component Details
77
+
78
+ I'll use the `get-component.sh` script to show:
79
+ - Available attributes (HTML attributes and properties)
80
+ - Slots for content projection
81
+ - Custom events you can listen to
82
+ - CSS custom properties for theming
83
+ - Usage examples
84
+
85
+ **Example**:
86
+ ```html
87
+ <!-- mozaic-button Attributes -->
88
+ <mozaic-button
89
+ theme="primary" <!-- Theme: primary, secondary, tertiary -->
90
+ size="m" <!-- Size: s, m, l -->
91
+ disabled="false" <!-- Disabled state -->
92
+ icon-left="arrow" <!-- Icon on left -->
93
+ full-width="false" <!-- Full width button -->
94
+ >
95
+ Click me
96
+ </mozaic-button>
97
+
98
+ <!-- Events -->
99
+ button.addEventListener('mozaic-click', (e) => {
100
+ console.log('Button clicked!', e.detail);
101
+ });
102
+
103
+ <!-- CSS Custom Properties -->
104
+ :root {
105
+ --mozaic-button-bg: #007bff;
106
+ --mozaic-button-text: #fff;
107
+ --mozaic-button-padding: 12px 24px;
108
+ }
109
+ ```
110
+
111
+ ### Step 4: Propose Component Combinations
112
+
113
+ I'll suggest 2-3 combinations that work well together:
114
+
115
+ **Example for "Login Form"**:
116
+
117
+ **Option 1: Simple Login Form**
118
+ ```html
119
+ <!-- Import components -->
120
+ <script type="module">
121
+ import '@adeo/mozaic-web-components/input.js';
122
+ import '@adeo/mozaic-web-components/button.js';
123
+ </script>
124
+
125
+ <!-- Usage -->
126
+ <form id="login-form">
127
+ <mozaic-input
128
+ label="Email"
129
+ type="email"
130
+ name="email"
131
+ required="true"
132
+ ></mozaic-input>
133
+
134
+ <mozaic-input
135
+ label="Password"
136
+ type="password"
137
+ name="password"
138
+ required="true"
139
+ ></mozaic-input>
140
+
141
+ <mozaic-button theme="primary" type="submit">
142
+ Login
143
+ </mozaic-button>
144
+ </form>
145
+ ```
146
+
147
+ **Option 2: Enhanced Login with Validation & Events**
148
+ ```html
149
+ <!-- Import components -->
150
+ <script type="module">
151
+ import '@adeo/mozaic-web-components/input.js';
152
+ import '@adeo/mozaic-web-components/button.js';
153
+ import '@adeo/mozaic-web-components/checkbox.js';
154
+ </script>
155
+
156
+ <!-- Usage -->
157
+ <form id="login-form">
158
+ <mozaic-input
159
+ id="email-input"
160
+ label="Email"
161
+ type="email"
162
+ name="email"
163
+ required="true"
164
+ error-message=""
165
+ ></mozaic-input>
166
+
167
+ <mozaic-input
168
+ id="password-input"
169
+ label="Password"
170
+ type="password"
171
+ name="password"
172
+ required="true"
173
+ error-message=""
174
+ ></mozaic-input>
175
+
176
+ <mozaic-checkbox
177
+ name="remember"
178
+ label="Remember me"
179
+ ></mozaic-checkbox>
180
+
181
+ <mozaic-button id="login-btn" theme="primary" type="submit">
182
+ Login
183
+ </mozaic-button>
184
+ </form>
185
+
186
+ <script>
187
+ const form = document.getElementById('login-form');
188
+ const emailInput = document.getElementById('email-input');
189
+ const passwordInput = document.getElementById('password-input');
190
+ const loginBtn = document.getElementById('login-btn');
191
+
192
+ // Listen to input changes
193
+ emailInput.addEventListener('mozaic-change', (e) => {
194
+ validateEmail(e.detail.value);
195
+ });
196
+
197
+ passwordInput.addEventListener('mozaic-change', (e) => {
198
+ validatePassword(e.detail.value);
199
+ });
200
+
201
+ // Form submission
202
+ form.addEventListener('submit', async (e) => {
203
+ e.preventDefault();
204
+ loginBtn.setAttribute('loading', 'true');
205
+
206
+ // Perform login
207
+ try {
208
+ await login(emailInput.value, passwordInput.value);
209
+ } finally {
210
+ loginBtn.setAttribute('loading', 'false');
211
+ }
212
+ });
213
+
214
+ function validateEmail(email) {
215
+ if (!email.includes('@')) {
216
+ emailInput.setAttribute('error-message', 'Invalid email format');
217
+ return false;
218
+ }
219
+ emailInput.removeAttribute('error-message');
220
+ return true;
221
+ }
222
+
223
+ function validatePassword(password) {
224
+ if (password.length < 8) {
225
+ passwordInput.setAttribute('error-message', 'Password must be at least 8 characters');
226
+ return false;
227
+ }
228
+ passwordInput.removeAttribute('error-message');
229
+ return true;
230
+ }
231
+ </script>
232
+ ```
233
+
234
+ **Option 3: Server-Side Rendered with Progressive Enhancement**
235
+ ```html
236
+ <!-- SSR-friendly - works without JavaScript, enhanced with JS -->
237
+ <form id="login-form" action="/login" method="POST">
238
+ <div class="form-field">
239
+ <label for="email">Email</label>
240
+ <input type="email" name="email" id="email" required>
241
+ </div>
242
+
243
+ <div class="form-field">
244
+ <label for="password">Password</label>
245
+ <input type="password" name="password" id="password" required>
246
+ </div>
247
+
248
+ <button type="submit">Login</button>
249
+ </form>
250
+
251
+ <!-- Progressive enhancement with web components -->
252
+ <script type="module">
253
+ import '@adeo/mozaic-web-components/input.js';
254
+ import '@adeo/mozaic-web-components/button.js';
255
+
256
+ // Enhance form when components are loaded
257
+ customElements.whenDefined('mozaic-input').then(() => {
258
+ enhanceForm();
259
+ });
260
+
261
+ function enhanceForm() {
262
+ const form = document.getElementById('login-form');
263
+ // Replace native inputs with web components
264
+ // Web components will read existing values
265
+ }
266
+ </script>
267
+ ```
268
+
269
+ ### Step 5: Refinement & Configuration
270
+
271
+ You can:
272
+ - Choose an option: "I like Option 2"
273
+ - Customize: "Add a forgot password link"
274
+ - Combine: "Use Option 1 but add event handling from Option 2"
275
+ - Request changes: "Make the button full width"
276
+ - Ask about features: "How do I add an icon to the button?"
277
+
278
+ ### Step 6: Generate Final Code
279
+
280
+ I'll use the `generate-component.sh` script to create complete code with:
281
+ - Import statements (ES modules or script tags)
282
+ - Component usage with proper attributes
283
+ - Event listener setup
284
+ - CSS custom property theming
285
+ - Accessibility attributes
286
+
287
+ ## Common Use Cases
288
+
289
+ ### 1. Creating a Contact Form
290
+
291
+ ```markdown
292
+ User: "I need a contact form with name, email, and message fields"