@julianoczkowski/create-trimble-app 2.0.1 → 2.0.2

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.
@@ -0,0 +1,291 @@
1
+ # AGENTS.MD
2
+
3
+ You are a **Modus 2 Design System specialist** working on a React 19 + Vite boilerplate with Trimble's Modus Web Components. You write TypeScript code using Tailwind CSS 3 and React Router, following strict design system compliance.
4
+
5
+ ## Commands
6
+
7
+ Run these commands during development:
8
+
9
+ ```bash
10
+ npm run dev # Start development server (Vite)
11
+ npm run build # Type-check + production build
12
+ npm run lint # ESLint
13
+ npm run lint:all # All design system checks (run before commits)
14
+ ```
15
+
16
+ ### Lint Commands (Design System Compliance)
17
+
18
+ ```bash
19
+ npm run lint:colors # Detect non-Modus color usage
20
+ npm run lint:icons # Validate Modus icon patterns
21
+ npm run lint:semantic # Check for semantic HTML violations
22
+ npm run lint:styles # Detect inline style violations
23
+ npm run lint:borders # Check border utility compliance
24
+ npm run lint:opacity # Validate opacity utility usage
25
+ npm run lint:icon-names # Verify icon names are valid
26
+ npm run type-check # TypeScript type checking
27
+ ```
28
+
29
+ ## Project Structure
30
+
31
+ ```
32
+ src/
33
+ pages/ # Your application pages (start with HomePage.tsx)
34
+ components/ # Modus wrapper components (React wrappers for web components)
35
+ contexts/ # React contexts (ThemeContext.tsx)
36
+ dev/ # Dev Panel (development only, excluded in production)
37
+ demos/ # 48 component demo pages (development reference)
38
+ dev-pages/ # Reference pages (colors, icons, component gallery)
39
+ .cursor/
40
+ rules/ # AI rules - see modus-react-master.mdc as master index
41
+ skills/ # Reusable skill definitions
42
+ scripts/ # Lint and validation scripts
43
+ ```
44
+
45
+ ## Tech Stack
46
+
47
+ - **React 19** with TypeScript
48
+ - **Vite** for build tooling
49
+ - **Tailwind CSS 3** with design system tokens
50
+ - **@trimble-oss/moduswebcomponents-react** - Modus Web Components
51
+ - **@trimble-oss/modus-icons** - Icon library
52
+ - **React Router** for navigation
53
+
54
+ ## Code Style
55
+
56
+ ### Colors - Design System Only
57
+
58
+ ```tsx
59
+ // CORRECT: Design system colors
60
+ <div className="bg-background text-foreground">
61
+ <div className="bg-primary text-primary-foreground">
62
+ <div className="bg-destructive text-destructive-foreground">
63
+ <div className="bg-success text-muted-foreground">
64
+ <div className="hover:bg-primary/90">
65
+
66
+ // WRONG: Generic Tailwind colors
67
+ <div className="bg-blue-500"> // Never use
68
+ <div className="text-gray-600"> // Never use
69
+ <div style={{ color: '#0063a3' }}> // Never use
70
+ ```
71
+
72
+ ### Icons - Modus Icons Only
73
+
74
+ ```tsx
75
+ // CORRECT: Modus icons
76
+ <i className="modus-icons">settings</i>
77
+ <i className="modus-icons">check</i>
78
+ <i className="modus-icons">warning</i>
79
+
80
+ // WRONG: Other icon libraries
81
+ <FontAwesomeIcon icon={faCog} /> // Never use
82
+ <MdSettings /> // Never use
83
+ import { FiSettings } from 'react-icons/fi' // Never use
84
+ ```
85
+
86
+ ### HTML Elements - div Only
87
+
88
+ ```tsx
89
+ // CORRECT: div-based structure
90
+ <div className="text-2xl font-bold">Heading</div>
91
+ <div className="text-sm text-muted-foreground">Paragraph text</div>
92
+ <div className="flex gap-4">Container</div>
93
+
94
+ // WRONG: Semantic HTML elements
95
+ <h1>Heading</h1> // Never use
96
+ <p>Paragraph</p> // Never use
97
+ <section>Content</section> // Never use
98
+ <span>Inline</span> // Never use
99
+
100
+ // EXCEPTION: <i> for icons only
101
+ <i className="modus-icons">icon_name</i>
102
+ ```
103
+
104
+ ### Borders - Directional Utilities
105
+
106
+ ```tsx
107
+ // CORRECT: Directional border utilities
108
+ <div className="border-bottom-default">
109
+ <div className="border-top-default">
110
+ <div className="border-default"> // All sides
111
+ <div className="border-success">
112
+ <div className="border-destructive">
113
+
114
+ // WRONG: Tailwind border pattern
115
+ <div className="border-b border-default"> // Never use this pattern
116
+ <div className="border-gray-300"> // Never use generic colors
117
+ ```
118
+
119
+ ### Opacity - Custom Utilities
120
+
121
+ ```tsx
122
+ // CORRECT: Custom opacity utilities
123
+ <div className="text-foreground-80"> // 80% opacity
124
+ <div className="text-foreground-60"> // 60% opacity
125
+ <div className="bg-background-90"> // 90% opacity
126
+
127
+ // WRONG: Tailwind opacity syntax (doesn't work with CSS vars)
128
+ <div className="text-foreground/80"> // Will not work
129
+ ```
130
+
131
+ ## Critical Patterns
132
+
133
+ ### Checkbox Value Inversion Bug
134
+
135
+ The `value` property from `inputChange` event is inverted. Always invert:
136
+
137
+ ```tsx
138
+ const handleCheckboxChange = (event: CustomEvent) => {
139
+ const actualChecked = !event.detail.value; // MUST invert
140
+ setIsChecked(actualChecked);
141
+ };
142
+ ```
143
+
144
+ ### Select Component
145
+
146
+ Use `ModusDropdownMenu` instead of `ModusSelect` for reliable React event handling:
147
+
148
+ ```tsx
149
+ // CORRECT: ModusDropdownMenu
150
+ <ModusDropdownMenu
151
+ options={options}
152
+ onOptionSelected={handleSelect}
153
+ />
154
+
155
+ // AVOID: ModusSelect has event handling issues in React
156
+ <ModusWcSelect />
157
+ ```
158
+
159
+ ### Modal Implementation
160
+
161
+ Use `forwardRef` with `useImperativeHandle` for modal control:
162
+
163
+ ```tsx
164
+ const ModusModal = forwardRef((props, ref) => {
165
+ const containerRef = useRef<HTMLDivElement>(null);
166
+
167
+ useImperativeHandle(ref, () => ({
168
+ open: () => {
169
+ const dialog = containerRef.current?.querySelector('dialog');
170
+ dialog?.showModal();
171
+ },
172
+ close: () => {
173
+ const dialog = containerRef.current?.querySelector('dialog');
174
+ dialog?.close();
175
+ }
176
+ }));
177
+
178
+ return <div ref={containerRef}><ModusWcModal {...props} /></div>;
179
+ });
180
+ ```
181
+
182
+ ### Component State Management
183
+
184
+ Let Modus components manage their own state:
185
+
186
+ ```tsx
187
+ // CORRECT: Let accordion manage its own state
188
+ <ModusAccordion allowMultiple>
189
+ <ModusAccordionItem header="Section 1">Content</ModusAccordionItem>
190
+ </ModusAccordion>
191
+
192
+ // WRONG: Controlling state from React
193
+ const [openItem, setOpenItem] = useState(null);
194
+ <ModusAccordion expandedItems={openItem}> // Avoid this pattern
195
+ ```
196
+
197
+ ## Theme System
198
+
199
+ 6 available themes set via `data-theme` on `<html>`:
200
+
201
+ - `modus-classic-light`, `modus-classic-dark`
202
+ - `modus-modern-light`, `modus-modern-dark`
203
+ - `connect-light`, `connect-dark`
204
+
205
+ ```tsx
206
+ document.documentElement.setAttribute('data-theme', 'modus-modern-light');
207
+ ```
208
+
209
+ ## Boundaries
210
+
211
+ ### Always Do
212
+
213
+ - Run `npm run lint:all` before committing code
214
+ - Use design system colors exclusively (`bg-background`, `text-foreground`, etc.)
215
+ - Use Modus icons exclusively (`<i className="modus-icons">`)
216
+ - Use `<div>` elements for all content (except `<i>` for icons)
217
+ - Use directional border utilities (`border-bottom-default`)
218
+ - Use custom opacity utilities (`text-foreground-80`)
219
+ - Invert checkbox `value` property in event handlers
220
+ - Use `useRef` + `useEffect` for web component event listeners
221
+ - Let Modus components manage their own internal state
222
+ - Test components in all 6 themes
223
+
224
+ ### Ask First
225
+
226
+ - Creating new wrapper components in `src/components/`
227
+ - Modifying theme configuration in `ThemeContext.tsx`
228
+ - Changes to Dev Panel architecture (`src/dev/`)
229
+ - Adding new lint rules or scripts
230
+ - Changes to Tailwind configuration
231
+
232
+ ### Never Do
233
+
234
+ - Use generic Tailwind colors (`bg-blue-500`, `text-gray-600`)
235
+ - Use non-Modus icon libraries (Font Awesome, Material Icons, Heroicons, Lucide)
236
+ - Use semantic HTML elements (`h1`, `p`, `section`, `span`, `header`, `footer`, `nav`, `main`, `aside`, `article`)
237
+ - Use `border-b border-default` pattern (use `border-bottom-default` instead)
238
+ - Use hardcoded hex/RGB color values
239
+ - Use `text-foreground/80` opacity syntax (use `text-foreground-80`)
240
+ - Use emojis in code or UI
241
+ - Control Modus component state from React `useState`
242
+ - Commit code with lint violations
243
+ - Modify vendor directories or `node_modules`
244
+ - Commit secrets, API keys, or `.env` files
245
+
246
+ ## Rules Reference
247
+
248
+ For detailed patterns and examples, see `.cursor/rules/modus-react-master.mdc` as the master index:
249
+
250
+ ### Design System Rules
251
+ - `modus-color-usage-react` - Complete color system guide
252
+ - `modus-icons-react` - Icon usage patterns
253
+ - `border-usage-guidelines` - Border utilities
254
+ - `modus-opacity-utilities-react` - Opacity utilities
255
+ - `modus-themes-react` - Theme implementation
256
+
257
+ ### Component Rules
258
+ - `modus-accordion-state-management-react` - Accordion patterns
259
+ - `modus-button-group-usage-react` - Button group styling
260
+ - `modus-checkbox-value-inversion-react` - Checkbox bug handling
261
+ - `modus-modal-implementation-react` - Modal patterns
262
+ - `modus-navbar-side-navigation-react` - Navigation integration
263
+ - `modus-select-vs-dropdown-menu-react` - Dropdown patterns
264
+
265
+ ### Integration Rules
266
+ - `modus-react-integration` - React + Modus integration
267
+ - `modus-react-best-practices` - Best practices guide
268
+ - `modus-react-key-warnings` - React key prop patterns
269
+ - `modus-semantic-html-react` - div-only approach
270
+
271
+ ### Workflow Rules
272
+ - `development-workflow-react` - Linting and quality checks
273
+ - `chrome-devtools-testing-react` - Browser testing
274
+
275
+ ## Dev Panel
276
+
277
+ Toggle with `Ctrl+Shift+D` or floating button. Available only in development mode (`VITE_DEV_PANEL=true`).
278
+
279
+ Routes:
280
+ - `/dev/colors` - Color palette reference
281
+ - `/dev/icons` - Icon library browser
282
+ - `/dev/components` - Component gallery
283
+ - `/dev/demos/*` - Individual component demos
284
+
285
+ ## Git Workflow
286
+
287
+ 1. Make changes following design system rules
288
+ 2. Run `npm run lint:all` to verify compliance
289
+ 3. Fix any violations before committing
290
+ 4. Create focused commits with clear messages
291
+ 5. Reference component names in commit messages when applicable