jac-client 0.2.3__py3-none-any.whl → 0.2.4__py3-none-any.whl

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 (176) hide show
  1. jac_client/examples/all-in-one/assets/workers/worker.py +5 -0
  2. jac_client/tests/conftest.py +281 -0
  3. jac_client/tests/test_cli.py +755 -0
  4. jac_client/tests/test_it.py +347 -67
  5. {jac_client-0.2.3.dist-info → jac_client-0.2.4.dist-info}/METADATA +28 -30
  6. jac_client-0.2.4.dist-info/RECORD +10 -0
  7. {jac_client-0.2.3.dist-info → jac_client-0.2.4.dist-info}/WHEEL +2 -1
  8. jac_client-0.2.4.dist-info/entry_points.txt +4 -0
  9. jac_client-0.2.4.dist-info/top_level.txt +1 -0
  10. jac_client/docs/README.md +0 -689
  11. jac_client/docs/advanced-state.md +0 -1265
  12. jac_client/docs/asset-serving/intro.md +0 -209
  13. jac_client/docs/assets/pipe_line-v2.svg +0 -32
  14. jac_client/docs/assets/pipe_line.png +0 -0
  15. jac_client/docs/file-system/app.jac.md +0 -121
  16. jac_client/docs/file-system/backend-frontend.md +0 -217
  17. jac_client/docs/file-system/intro.md +0 -72
  18. jac_client/docs/file-system/nested-imports.md +0 -348
  19. jac_client/docs/guide-example/intro.md +0 -115
  20. jac_client/docs/guide-example/step-01-setup.md +0 -270
  21. jac_client/docs/guide-example/step-02-components.md +0 -416
  22. jac_client/docs/guide-example/step-03-styling.md +0 -478
  23. jac_client/docs/guide-example/step-04-todo-ui.md +0 -477
  24. jac_client/docs/guide-example/step-05-local-state.md +0 -530
  25. jac_client/docs/guide-example/step-06-events.md +0 -749
  26. jac_client/docs/guide-example/step-07-effects.md +0 -468
  27. jac_client/docs/guide-example/step-08-walkers.md +0 -534
  28. jac_client/docs/guide-example/step-09-authentication.md +0 -586
  29. jac_client/docs/guide-example/step-10-routing.md +0 -539
  30. jac_client/docs/guide-example/step-11-final.md +0 -963
  31. jac_client/docs/imports.md +0 -1141
  32. jac_client/docs/lifecycle-hooks.md +0 -773
  33. jac_client/docs/routing.md +0 -659
  34. jac_client/docs/styling/intro.md +0 -249
  35. jac_client/docs/styling/js-styling.md +0 -367
  36. jac_client/docs/styling/material-ui.md +0 -341
  37. jac_client/docs/styling/pure-css.md +0 -299
  38. jac_client/docs/styling/sass.md +0 -403
  39. jac_client/docs/styling/styled-components.md +0 -395
  40. jac_client/docs/styling/tailwind.md +0 -298
  41. jac_client/examples/all-in-one/.babelrc +0 -9
  42. jac_client/examples/all-in-one/README.md +0 -16
  43. jac_client/examples/all-in-one/app.jac +0 -426
  44. jac_client/examples/all-in-one/assets/burger.png +0 -0
  45. jac_client/examples/all-in-one/button.jac +0 -7
  46. jac_client/examples/all-in-one/components/button.jac +0 -7
  47. jac_client/examples/all-in-one/package.json +0 -29
  48. jac_client/examples/all-in-one/styles.css +0 -26
  49. jac_client/examples/all-in-one/vite.config.js +0 -28
  50. jac_client/examples/asset-serving/css-with-image/.babelrc +0 -9
  51. jac_client/examples/asset-serving/css-with-image/README.md +0 -91
  52. jac_client/examples/asset-serving/css-with-image/app.jac +0 -88
  53. jac_client/examples/asset-serving/css-with-image/assets/burger.png +0 -0
  54. jac_client/examples/asset-serving/css-with-image/package.json +0 -28
  55. jac_client/examples/asset-serving/css-with-image/styles.css +0 -26
  56. jac_client/examples/asset-serving/css-with-image/vite.config.js +0 -28
  57. jac_client/examples/asset-serving/image-asset/.babelrc +0 -9
  58. jac_client/examples/asset-serving/image-asset/README.md +0 -119
  59. jac_client/examples/asset-serving/image-asset/app.jac +0 -55
  60. jac_client/examples/asset-serving/image-asset/assets/burger.png +0 -0
  61. jac_client/examples/asset-serving/image-asset/package.json +0 -28
  62. jac_client/examples/asset-serving/image-asset/styles.css +0 -26
  63. jac_client/examples/asset-serving/image-asset/vite.config.js +0 -28
  64. jac_client/examples/asset-serving/import-alias/.babelrc +0 -9
  65. jac_client/examples/asset-serving/import-alias/README.md +0 -83
  66. jac_client/examples/asset-serving/import-alias/app.jac +0 -111
  67. jac_client/examples/asset-serving/import-alias/assets/burger.png +0 -0
  68. jac_client/examples/asset-serving/import-alias/package.json +0 -28
  69. jac_client/examples/asset-serving/import-alias/vite.config.js +0 -28
  70. jac_client/examples/basic/.babelrc +0 -9
  71. jac_client/examples/basic/README.md +0 -16
  72. jac_client/examples/basic/app.jac +0 -21
  73. jac_client/examples/basic/package.json +0 -27
  74. jac_client/examples/basic/vite.config.js +0 -27
  75. jac_client/examples/basic-auth/.babelrc +0 -9
  76. jac_client/examples/basic-auth/README.md +0 -16
  77. jac_client/examples/basic-auth/app.jac +0 -308
  78. jac_client/examples/basic-auth/package.json +0 -27
  79. jac_client/examples/basic-auth/vite.config.js +0 -27
  80. jac_client/examples/basic-auth-with-router/.babelrc +0 -9
  81. jac_client/examples/basic-auth-with-router/README.md +0 -60
  82. jac_client/examples/basic-auth-with-router/app.jac +0 -464
  83. jac_client/examples/basic-auth-with-router/package.json +0 -28
  84. jac_client/examples/basic-auth-with-router/vite.config.js +0 -27
  85. jac_client/examples/basic-full-stack/.babelrc +0 -9
  86. jac_client/examples/basic-full-stack/README.md +0 -18
  87. jac_client/examples/basic-full-stack/app.jac +0 -320
  88. jac_client/examples/basic-full-stack/package.json +0 -28
  89. jac_client/examples/basic-full-stack/vite.config.js +0 -27
  90. jac_client/examples/css-styling/js-styling/.babelrc +0 -9
  91. jac_client/examples/css-styling/js-styling/README.md +0 -183
  92. jac_client/examples/css-styling/js-styling/app.jac +0 -84
  93. jac_client/examples/css-styling/js-styling/package.json +0 -28
  94. jac_client/examples/css-styling/js-styling/styles.js +0 -100
  95. jac_client/examples/css-styling/js-styling/vite.config.js +0 -27
  96. jac_client/examples/css-styling/material-ui/.babelrc +0 -9
  97. jac_client/examples/css-styling/material-ui/README.md +0 -16
  98. jac_client/examples/css-styling/material-ui/app.jac +0 -122
  99. jac_client/examples/css-styling/material-ui/package.json +0 -32
  100. jac_client/examples/css-styling/material-ui/vite.config.js +0 -27
  101. jac_client/examples/css-styling/pure-css/.babelrc +0 -9
  102. jac_client/examples/css-styling/pure-css/README.md +0 -16
  103. jac_client/examples/css-styling/pure-css/app.jac +0 -64
  104. jac_client/examples/css-styling/pure-css/package.json +0 -28
  105. jac_client/examples/css-styling/pure-css/styles.css +0 -111
  106. jac_client/examples/css-styling/pure-css/vite.config.js +0 -27
  107. jac_client/examples/css-styling/sass-example/.babelrc +0 -9
  108. jac_client/examples/css-styling/sass-example/README.md +0 -16
  109. jac_client/examples/css-styling/sass-example/app.jac +0 -64
  110. jac_client/examples/css-styling/sass-example/package.json +0 -29
  111. jac_client/examples/css-styling/sass-example/styles.scss +0 -153
  112. jac_client/examples/css-styling/sass-example/vite.config.js +0 -27
  113. jac_client/examples/css-styling/styled-components/.babelrc +0 -9
  114. jac_client/examples/css-styling/styled-components/README.md +0 -16
  115. jac_client/examples/css-styling/styled-components/app.jac +0 -71
  116. jac_client/examples/css-styling/styled-components/package.json +0 -29
  117. jac_client/examples/css-styling/styled-components/styled.js +0 -90
  118. jac_client/examples/css-styling/styled-components/vite.config.js +0 -27
  119. jac_client/examples/css-styling/tailwind-example/.babelrc +0 -9
  120. jac_client/examples/css-styling/tailwind-example/README.md +0 -16
  121. jac_client/examples/css-styling/tailwind-example/app.jac +0 -63
  122. jac_client/examples/css-styling/tailwind-example/global.css +0 -1
  123. jac_client/examples/css-styling/tailwind-example/package.json +0 -30
  124. jac_client/examples/css-styling/tailwind-example/vite.config.js +0 -29
  125. jac_client/examples/full-stack-with-auth/.babelrc +0 -9
  126. jac_client/examples/full-stack-with-auth/README.md +0 -16
  127. jac_client/examples/full-stack-with-auth/app.jac +0 -722
  128. jac_client/examples/full-stack-with-auth/package.json +0 -28
  129. jac_client/examples/full-stack-with-auth/vite.config.js +0 -29
  130. jac_client/examples/little-x/app.jac +0 -724
  131. jac_client/examples/little-x/package.json +0 -23
  132. jac_client/examples/little-x/submit-button.jac +0 -8
  133. jac_client/examples/nested-folders/nested-advance/.babelrc +0 -9
  134. jac_client/examples/nested-folders/nested-advance/ButtonRoot.jac +0 -11
  135. jac_client/examples/nested-folders/nested-advance/README.md +0 -77
  136. jac_client/examples/nested-folders/nested-advance/app.jac +0 -35
  137. jac_client/examples/nested-folders/nested-advance/level1/ButtonSecondL.jac +0 -19
  138. jac_client/examples/nested-folders/nested-advance/level1/Card.jac +0 -43
  139. jac_client/examples/nested-folders/nested-advance/level1/level2/ButtonThirdL.jac +0 -25
  140. jac_client/examples/nested-folders/nested-advance/package.json +0 -29
  141. jac_client/examples/nested-folders/nested-advance/vite.config.js +0 -28
  142. jac_client/examples/nested-folders/nested-basic/.babelrc +0 -9
  143. jac_client/examples/nested-folders/nested-basic/README.md +0 -183
  144. jac_client/examples/nested-folders/nested-basic/app.jac +0 -13
  145. jac_client/examples/nested-folders/nested-basic/app.js +0 -7
  146. jac_client/examples/nested-folders/nested-basic/button.jac +0 -7
  147. jac_client/examples/nested-folders/nested-basic/components/button.jac +0 -7
  148. jac_client/examples/nested-folders/nested-basic/package.json +0 -28
  149. jac_client/examples/nested-folders/nested-basic/vite.config.js +0 -27
  150. jac_client/examples/with-router/.babelrc +0 -9
  151. jac_client/examples/with-router/README.md +0 -17
  152. jac_client/examples/with-router/app.jac +0 -323
  153. jac_client/examples/with-router/package.json +0 -28
  154. jac_client/examples/with-router/vite.config.js +0 -27
  155. jac_client/plugin/cli.py +0 -244
  156. jac_client/plugin/client.py +0 -152
  157. jac_client/plugin/client_runtime.jac +0 -234
  158. jac_client/plugin/vite_client_bundle.py +0 -503
  159. jac_client/tests/fixtures/basic-app/app.jac +0 -23
  160. jac_client/tests/fixtures/cl_file/app.cl.jac +0 -48
  161. jac_client/tests/fixtures/cl_file/app.jac +0 -15
  162. jac_client/tests/fixtures/client_app_with_antd/app.jac +0 -34
  163. jac_client/tests/fixtures/js_import/app.jac +0 -34
  164. jac_client/tests/fixtures/js_import/utils.js +0 -21
  165. jac_client/tests/fixtures/package-lock.json +0 -329
  166. jac_client/tests/fixtures/package.json +0 -11
  167. jac_client/tests/fixtures/relative_import/app.jac +0 -11
  168. jac_client/tests/fixtures/relative_import/button.jac +0 -7
  169. jac_client/tests/fixtures/spawn_test/app.jac +0 -129
  170. jac_client/tests/fixtures/test_fragments_spread/app.jac +0 -67
  171. jac_client/tests/test_asset_examples.py +0 -322
  172. jac_client/tests/test_cl.py +0 -530
  173. jac_client/tests/test_create_jac_app.py +0 -131
  174. jac_client/tests/test_nested_file.py +0 -374
  175. jac_client-0.2.3.dist-info/RECORD +0 -171
  176. jac_client-0.2.3.dist-info/entry_points.txt +0 -4
@@ -1,341 +0,0 @@
1
- # Material-UI
2
-
3
- Comprehensive React component library with Material Design for Jac applications.
4
-
5
- ## Overview
6
-
7
- Material-UI (MUI) provides pre-built, accessible React components following Material Design principles. This approach is perfect for:
8
- - Rapid application development
9
- - Consistent Material Design
10
- - Accessible components out of the box
11
- - Enterprise applications
12
-
13
- ## Example
14
-
15
- See the complete working example: [`examples/css-styling/material-ui/`](../../examples/css-styling/material-ui/)
16
-
17
- ## Quick Start
18
-
19
- ### 1. Install Material-UI
20
-
21
- Add to `package.json`:
22
-
23
- ```json
24
- {
25
- "dependencies": {
26
- "@mui/material": "^5.15.0",
27
- "@mui/icons-material": "^5.15.0"
28
- }
29
- }
30
- ```
31
-
32
- ### 2. Import Components
33
-
34
- In your Jac file:
35
-
36
- ```jac
37
- # Pages
38
- cl import from react {useState, useEffect}
39
- cl import from "@mui/material/Button" { default as Button }
40
- cl import from "@mui/material/Card" { default as Card }
41
- cl import from "@mui/material/CardContent" { default as CardContent }
42
- cl import from "@mui/material/Box" { default as Box }
43
- cl import from "@mui/icons-material/Add" { default as AddIcon }
44
- cl import from "@mui/icons-material/Remove" { default as RemoveIcon }
45
-
46
- cl {
47
- def app() -> any {
48
- return <Box sx={{"display": "flex", "justifyContent": "center"}}>
49
- <Card>
50
- <CardContent>
51
- <Button variant="contained" onClick={handleIncrement}>
52
- <AddIcon />
53
- </Button>
54
- </CardContent>
55
- </Card>
56
- </Box>;
57
- }
58
- }
59
- ```
60
-
61
- ## Key Features
62
-
63
- ### Theming
64
-
65
- Material-UI comes with a built-in theme system:
66
-
67
- ```javascript
68
- import { ThemeProvider, createTheme } from '@mui/material/styles';
69
-
70
- const theme = createTheme({
71
- palette: {
72
- primary: {
73
- main: '#1976d2',
74
- },
75
- secondary: {
76
- main: '#dc004e',
77
- },
78
- },
79
- typography: {
80
- fontFamily: 'Roboto, Arial, sans-serif',
81
- },
82
- spacing: 8, // 8px base unit
83
- });
84
-
85
- // Wrap your app
86
- <ThemeProvider theme={theme}>
87
- <App />
88
- </ThemeProvider>
89
- ```
90
-
91
- ### sx Prop
92
-
93
- Use the `sx` prop for styling:
94
-
95
- ```jac
96
- <Box sx={{
97
- display: "flex",
98
- justifyContent: "center",
99
- alignItems: "center",
100
- minHeight: "100vh",
101
- backgroundColor: "background.default"
102
- }}>
103
- <Card sx={{
104
- maxWidth: 400,
105
- padding: 2
106
- }}>
107
- Content
108
- </Card>
109
- </Box>
110
- ```
111
-
112
- ### Component Variants
113
-
114
- Use built-in variants:
115
-
116
- ```jac
117
- <Button variant="contained" color="primary">Contained</Button>
118
- <Button variant="outlined" color="secondary">Outlined</Button>
119
- <Button variant="text">Text</Button>
120
- ```
121
-
122
- ## Common Components
123
-
124
- ### Layout Components
125
-
126
- ```jac
127
- # Box - Container component
128
- <Box sx={{"display": "flex", "gap": 2}}>
129
- <Box>Item 1</Box>
130
- <Box>Item 2</Box>
131
- </Box>
132
-
133
- # Grid - Responsive grid system
134
- cl import from "@mui/material/Grid" { default as Grid }
135
- <Grid container spacing={2}>
136
- <Grid item xs={12} md={6}>Column 1</Grid>
137
- <Grid item xs={12} md={6}>Column 2</Grid>
138
- </Grid>
139
-
140
- # Stack - Flexbox container
141
- cl import from "@mui/material/Stack" { default as Stack }
142
- <Stack direction="row" spacing={2}>
143
- <Button>Button 1</Button>
144
- <Button>Button 2</Button>
145
- </Stack>
146
- ```
147
-
148
- ### Input Components
149
-
150
- ```jac
151
- # TextField
152
- cl import from "@mui/material/TextField" { default as TextField }
153
- <TextField label="Name" variant="outlined" />
154
-
155
- # Button
156
- <Button variant="contained" color="primary" onClick={handleClick}>
157
- Click Me
158
- </Button>
159
-
160
- # Select
161
- cl import from "@mui/material/Select" { default as Select }
162
- cl import from "@mui/material/MenuItem" { default as MenuItem }
163
- <Select value={value} onChange={handleChange}>
164
- <MenuItem value="option1">Option 1</MenuItem>
165
- <MenuItem value="option2">Option 2</MenuItem>
166
- </Select>
167
- ```
168
-
169
- ### Feedback Components
170
-
171
- ```jac
172
- # Card
173
- <Card>
174
- <CardContent>
175
- <Typography variant="h5">Card Title</Typography>
176
- <Typography variant="body2">Card content</Typography>
177
- </CardContent>
178
- </Card>
179
-
180
- # Dialog
181
- cl import from "@mui/material/Dialog" { default as Dialog }
182
- cl import from "@mui/material/DialogTitle" { default as DialogTitle }
183
- <Dialog open={open} onClose={handleClose}>
184
- <DialogTitle>Dialog Title</DialogTitle>
185
- </Dialog>
186
-
187
- # Snackbar
188
- cl import from "@mui/material/Snackbar" { default as Snackbar }
189
- cl import from "@mui/material/Alert" { default as Alert }
190
- <Snackbar open={open} autoHideDuration={6000}>
191
- <Alert severity="success">Success message!</Alert>
192
- </Snackbar>
193
- ```
194
-
195
- ## Best Practices
196
-
197
- ### 1. Use sx Prop
198
-
199
- For component-specific styling:
200
-
201
- ```jac
202
- <Box sx={{
203
- display: "flex",
204
- justifyContent: "center",
205
- padding: 2,
206
- backgroundColor: "primary.main"
207
- }}>
208
- ```
209
-
210
- ### 2. Leverage Variants
211
-
212
- Use built-in variants when possible:
213
-
214
- ```jac
215
- <Button variant="contained" color="primary">Primary</Button>
216
- <Typography variant="h1">Heading</Typography>
217
- ```
218
-
219
- ### 3. Theme Customization
220
-
221
- Customize theme for brand colors:
222
-
223
- ```javascript
224
- const theme = createTheme({
225
- palette: {
226
- primary: {
227
- main: '#your-brand-color',
228
- },
229
- },
230
- });
231
- ```
232
-
233
- ### 4. Accessibility
234
-
235
- MUI components are accessible by default:
236
-
237
- ```jac
238
- <Button aria-label="Add item">
239
- <AddIcon />
240
- </Button>
241
- ```
242
-
243
- ### 5. Icons
244
-
245
- Use @mui/icons-material for consistent icons:
246
-
247
- ```jac
248
- cl import from "@mui/icons-material/Add" { default as AddIcon }
249
- cl import from "@mui/icons-material/Delete" { default as DeleteIcon }
250
- cl import from "@mui/icons-material/Edit" { default as EditIcon }
251
- ```
252
-
253
- ## Advantages
254
-
255
- - **Pre-built, accessible components**
256
- - **Consistent Material Design**
257
- - **Comprehensive component library**
258
- - **Built-in theming system**
259
- - **TypeScript support**
260
- - **Active community** and documentation
261
- - **Production-ready** components
262
-
263
- ## Limitations
264
-
265
- - **Larger bundle size**
266
- - **Material Design aesthetic** (may not fit all brands)
267
- - **Learning curve** for component API
268
- - **Less flexibility** than custom CSS
269
- - **Requires JavaScript** for styling
270
-
271
- ## When to Use
272
-
273
- Choose Material-UI when:
274
-
275
- - You want pre-built components
276
- - You need accessible components
277
- - You prefer Material Design
278
- - You're building enterprise applications
279
- - You want to focus on functionality over styling
280
- - You need comprehensive component library
281
-
282
- ## Import Syntax
283
-
284
- MUI components are imported from their specific packages:
285
-
286
- ```jac
287
- # Material components
288
- cl import from "@mui/material/Button" { default as Button }
289
- cl import from "@mui/material/Card" { default as Card }
290
-
291
- # Icons
292
- cl import from "@mui/icons-material/Add" { default as AddIcon }
293
- cl import from "@mui/icons-material/Delete" { default as DeleteIcon }
294
-
295
- # Multiple imports
296
- cl import from "@mui/material" {
297
- Button,
298
- Card,
299
- CardContent,
300
- Box
301
- }
302
- ```
303
-
304
- ## Theming Example
305
-
306
- ```javascript
307
- // theme.js
308
- import { createTheme } from '@mui/material/styles';
309
-
310
- export const theme = createTheme({
311
- palette: {
312
- mode: 'light',
313
- primary: {
314
- main: '#1976d2',
315
- },
316
- secondary: {
317
- main: '#dc004e',
318
- },
319
- },
320
- typography: {
321
- fontFamily: 'Roboto, Arial, sans-serif',
322
- h1: {
323
- fontSize: '2.5rem',
324
- },
325
- },
326
- spacing: 8,
327
- });
328
- ```
329
-
330
- ## Next Steps
331
-
332
- - Explore [Material-UI Documentation](https://mui.com/)
333
- - Check out [Chakra UI](./chakra-ui.md) for alternative component library (coming soon)
334
- - Learn about [Ant Design](./ant-design.md) for enterprise components (coming soon)
335
- - See [Styled Components](./styled-components.md) for CSS-in-JS approach
336
-
337
- ## Resources
338
-
339
- - [Material-UI Documentation](https://mui.com/)
340
- - [Material-UI Components](https://mui.com/material-ui/getting-started/)
341
- - [Material Design Guidelines](https://m3.material.io/)
@@ -1,299 +0,0 @@
1
- # Pure CSS
2
-
3
- Traditional CSS with external stylesheets. The most straightforward styling approach for Jac applications.
4
-
5
- ## Overview
6
-
7
- Pure CSS is the foundation of web styling. You write CSS in a separate file and import it into your Jac code. This approach is perfect for:
8
- - Simple projects
9
- - Learning CSS fundamentals
10
- - Maximum control over styling
11
- - Minimal dependencies
12
-
13
- ## Example
14
-
15
- See the complete working example: [`examples/css-styling/pure-css/`](../../examples/css-styling/pure-css/)
16
-
17
- ## Quick Start
18
-
19
- ### 1. Create CSS File
20
-
21
- Create a `styles.css` file in your project:
22
-
23
- ```css
24
- .container {
25
- display: flex;
26
- justify-content: center;
27
- align-items: center;
28
- min-height: 100vh;
29
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
30
- }
31
-
32
- .card {
33
- background: white;
34
- border-radius: 20px;
35
- box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
36
- padding: 40px;
37
- min-width: 400px;
38
- text-align: center;
39
- }
40
-
41
- .title {
42
- font-size: 2rem;
43
- color: #667eea;
44
- margin: 0 0 10px 0;
45
- font-weight: 600;
46
- }
47
- ```
48
-
49
- ### 2. Import CSS in Jac
50
-
51
- In your Jac file, import the CSS file:
52
-
53
- ```jac
54
- # Pages
55
- cl import from react {useState, useEffect}
56
- cl import ".styles.css";
57
-
58
- cl {
59
- def app() -> any {
60
- let [count, setCount] = useState(0);
61
-
62
- return <div className="container">
63
- <div className="card">
64
- <h1 className="title">Counter Application</h1>
65
- <p>Count: {count}</p>
66
- </div>
67
- </div>;
68
- }
69
- }
70
- ```
71
-
72
- ### 3. Use Class Names
73
-
74
- Apply CSS classes using the `className` prop:
75
-
76
- ```jac
77
- return <div className="container">
78
- <div className="card">
79
- <h1 className="title">Counter Application</h1>
80
- </div>
81
- </div>;
82
- ```
83
-
84
- ### 4. Dynamic Classes
85
-
86
- Dynamically construct class names based on state:
87
-
88
- ```jac
89
- let countClass = "countDisplay " + ("positive" if count > 0 else "negative" if count < 0 else "zero");
90
-
91
- return <div className={countClass}>{count}</div>;
92
- ```
93
-
94
- ## Import Syntax
95
-
96
- CSS files are imported using the `cl import` syntax:
97
-
98
- ```jac
99
- cl import ".styles.css";
100
- ```
101
-
102
- This compiles to:
103
-
104
- ```javascript
105
- import "./styles.css";
106
- ```
107
-
108
- Vite automatically processes CSS imports and extracts them to a separate CSS file during the build process.
109
-
110
- ## Best Practices
111
-
112
- ### 1. Organize Your CSS
113
-
114
- Use comments to separate sections:
115
-
116
- ```css
117
- /* ============================================
118
- Container Styles
119
- ============================================ */
120
- .container {
121
- /* styles */
122
- }
123
-
124
- /* ============================================
125
- Card Styles
126
- ============================================ */
127
- .card {
128
- /* styles */
129
- }
130
- ```
131
-
132
- ### 2. Use Semantic Class Names
133
-
134
- Make class names descriptive and meaningful:
135
-
136
- ```css
137
- /* Good */
138
- .button-primary { }
139
- .card-header { }
140
- .navigation-menu { }
141
-
142
- /* Avoid */
143
- .btn1 { }
144
- .div1 { }
145
- .red { }
146
- ```
147
-
148
- ### 3. Use CSS Variables for Theming
149
-
150
- Leverage CSS custom properties for theming:
151
-
152
- ```css
153
- :root {
154
- --primary-color: #007bff;
155
- --secondary-color: #6c757d;
156
- --spacing-unit: 1rem;
157
- }
158
-
159
- .button {
160
- background-color: var(--primary-color);
161
- padding: var(--spacing-unit);
162
- }
163
- ```
164
-
165
- ### 4. Mobile-First Design
166
-
167
- Design for mobile, then enhance for desktop:
168
-
169
- ```css
170
- /* Mobile first */
171
- .container {
172
- padding: 1rem;
173
- }
174
-
175
- /* Desktop */
176
- @media (min-width: 768px) {
177
- .container {
178
- padding: 2rem;
179
- }
180
- }
181
- ```
182
-
183
- ### 5. Avoid Inline Styles
184
-
185
- Keep styles in the CSS file for maintainability:
186
-
187
- ```jac
188
- // Avoid
189
- <div style={{"padding": "1rem", "color": "blue"}}>
190
-
191
- // Prefer
192
- <div className="container">
193
- ```
194
-
195
- ## Advantages
196
-
197
- - **No build step required** for CSS
198
- - **Easy to understand** and maintain
199
- - **Works with any CSS framework**
200
- - **Minimal dependencies**
201
- - **Great browser support**
202
- - **Familiar syntax** for developers
203
-
204
- ## Limitations
205
-
206
- - **No variables or nesting** (use CSS variables for theming)
207
- - **No preprocessing features**
208
- - **Global scope** (use BEM or similar for scoping)
209
- - **No dynamic styling** based on props
210
- - **Manual organization** required
211
-
212
- ## When to Use
213
-
214
- Choose Pure CSS when:
215
-
216
- - You're building a simple application
217
- - You want minimal dependencies
218
- - You prefer traditional CSS workflow
219
- - You're learning CSS fundamentals
220
- - You need maximum control
221
- - You want to avoid build complexity
222
-
223
- ## CSS Variables (Custom Properties)
224
-
225
- Use CSS custom properties for theming and dynamic values:
226
-
227
- ```css
228
- :root {
229
- --primary: #007bff;
230
- --secondary: #6c757d;
231
- --success: #28a745;
232
- --danger: #dc3545;
233
- --spacing-sm: 0.5rem;
234
- --spacing-md: 1rem;
235
- --spacing-lg: 2rem;
236
- }
237
-
238
- .button {
239
- background-color: var(--primary);
240
- padding: var(--spacing-md);
241
- }
242
-
243
- .button-success {
244
- background-color: var(--success);
245
- }
246
- ```
247
-
248
- ## Responsive Design
249
-
250
- Use media queries for responsive layouts:
251
-
252
- ```css
253
- .container {
254
- padding: 1rem;
255
- }
256
-
257
- @media (min-width: 768px) {
258
- .container {
259
- padding: 2rem;
260
- }
261
- }
262
-
263
- @media (min-width: 1024px) {
264
- .container {
265
- padding: 3rem;
266
- }
267
- }
268
- ```
269
-
270
- ## Naming Conventions
271
-
272
- ### BEM (Block Element Modifier)
273
-
274
- ```css
275
- .card { } /* Block */
276
- .card__header { } /* Element */
277
- .card__header--highlighted { } /* Modifier */
278
- ```
279
-
280
- ### Utility Classes
281
-
282
- ```css
283
- .text-center { text-align: center; }
284
- .mt-1 { margin-top: 0.25rem; }
285
- .p-2 { padding: 0.5rem; }
286
- ```
287
-
288
- ## Next Steps
289
-
290
- - Learn about [CSS Variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) for advanced theming
291
- - Explore [Sass/SCSS](./sass.md) for preprocessing features
292
- - Check out [Tailwind CSS](./tailwind.md) for utility-first approach
293
- - See [CSS Modules](./css-modules.md) for scoped styles (coming soon)
294
-
295
- ## Resources
296
-
297
- - [MDN CSS Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS)
298
- - [CSS Tricks](https://css-tricks.com/)
299
- - [Can I Use](https://caniuse.com/) - Browser compatibility