jac-client 0.2.0__py3-none-any.whl → 0.2.3__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 (154) hide show
  1. jac_client/docs/README.md +50 -20
  2. jac_client/docs/advanced-state.md +13 -14
  3. jac_client/docs/asset-serving/intro.md +209 -0
  4. jac_client/docs/assets/pipe_line-v2.svg +32 -0
  5. jac_client/docs/file-system/app.jac.md +121 -0
  6. jac_client/docs/file-system/backend-frontend.md +217 -0
  7. jac_client/docs/file-system/intro.md +72 -0
  8. jac_client/docs/file-system/nested-imports.md +348 -0
  9. jac_client/docs/guide-example/intro.md +11 -13
  10. jac_client/docs/guide-example/step-01-setup.md +30 -20
  11. jac_client/docs/guide-example/step-02-components.md +24 -24
  12. jac_client/docs/guide-example/step-03-styling.md +24 -24
  13. jac_client/docs/guide-example/step-04-todo-ui.md +17 -17
  14. jac_client/docs/guide-example/step-05-local-state.md +23 -23
  15. jac_client/docs/guide-example/step-06-events.md +23 -24
  16. jac_client/docs/guide-example/step-07-effects.md +27 -28
  17. jac_client/docs/guide-example/step-08-walkers.md +23 -23
  18. jac_client/docs/guide-example/step-09-authentication.md +18 -18
  19. jac_client/docs/guide-example/step-10-routing.md +20 -21
  20. jac_client/docs/guide-example/step-11-final.md +34 -35
  21. jac_client/docs/imports.md +4 -5
  22. jac_client/docs/lifecycle-hooks.md +12 -13
  23. jac_client/docs/routing.md +21 -22
  24. jac_client/docs/styling/intro.md +249 -0
  25. jac_client/docs/styling/js-styling.md +367 -0
  26. jac_client/docs/styling/material-ui.md +341 -0
  27. jac_client/docs/styling/pure-css.md +299 -0
  28. jac_client/docs/styling/sass.md +403 -0
  29. jac_client/docs/styling/styled-components.md +395 -0
  30. jac_client/docs/styling/tailwind.md +298 -0
  31. jac_client/examples/all-in-one/.babelrc +9 -0
  32. jac_client/examples/all-in-one/README.md +16 -0
  33. jac_client/examples/all-in-one/app.jac +426 -0
  34. jac_client/examples/all-in-one/assets/burger.png +0 -0
  35. jac_client/examples/all-in-one/button.jac +7 -0
  36. jac_client/examples/all-in-one/components/button.jac +7 -0
  37. jac_client/examples/all-in-one/package.json +29 -0
  38. jac_client/examples/all-in-one/styles.css +26 -0
  39. jac_client/examples/all-in-one/vite.config.js +28 -0
  40. jac_client/examples/asset-serving/css-with-image/.babelrc +9 -0
  41. jac_client/examples/asset-serving/css-with-image/README.md +91 -0
  42. jac_client/examples/asset-serving/css-with-image/app.jac +88 -0
  43. jac_client/examples/asset-serving/css-with-image/assets/burger.png +0 -0
  44. jac_client/examples/asset-serving/css-with-image/package.json +28 -0
  45. jac_client/examples/asset-serving/css-with-image/styles.css +26 -0
  46. jac_client/examples/asset-serving/css-with-image/vite.config.js +28 -0
  47. jac_client/examples/asset-serving/image-asset/.babelrc +9 -0
  48. jac_client/examples/asset-serving/image-asset/README.md +119 -0
  49. jac_client/examples/asset-serving/image-asset/app.jac +55 -0
  50. jac_client/examples/asset-serving/image-asset/assets/burger.png +0 -0
  51. jac_client/examples/asset-serving/image-asset/package.json +28 -0
  52. jac_client/examples/asset-serving/image-asset/styles.css +26 -0
  53. jac_client/examples/asset-serving/image-asset/vite.config.js +28 -0
  54. jac_client/examples/asset-serving/import-alias/.babelrc +9 -0
  55. jac_client/examples/asset-serving/import-alias/README.md +83 -0
  56. jac_client/examples/asset-serving/import-alias/app.jac +111 -0
  57. jac_client/examples/asset-serving/import-alias/assets/burger.png +0 -0
  58. jac_client/examples/asset-serving/import-alias/package.json +28 -0
  59. jac_client/examples/asset-serving/import-alias/vite.config.js +28 -0
  60. jac_client/examples/basic/app.jac +14 -9
  61. jac_client/examples/basic/package.json +1 -1
  62. jac_client/examples/basic/vite.config.js +0 -1
  63. jac_client/examples/basic-auth/package.json +1 -1
  64. jac_client/examples/basic-auth/vite.config.js +0 -1
  65. jac_client/examples/basic-auth-with-router/package.json +1 -1
  66. jac_client/examples/basic-auth-with-router/vite.config.js +0 -1
  67. jac_client/examples/basic-full-stack/package.json +1 -1
  68. jac_client/examples/basic-full-stack/vite.config.js +0 -1
  69. jac_client/examples/css-styling/js-styling/.babelrc +9 -0
  70. jac_client/examples/css-styling/js-styling/README.md +183 -0
  71. jac_client/examples/css-styling/js-styling/app.jac +84 -0
  72. jac_client/examples/css-styling/js-styling/package.json +28 -0
  73. jac_client/examples/css-styling/js-styling/styles.js +100 -0
  74. jac_client/examples/css-styling/js-styling/vite.config.js +27 -0
  75. jac_client/examples/css-styling/material-ui/.babelrc +9 -0
  76. jac_client/examples/css-styling/material-ui/README.md +16 -0
  77. jac_client/examples/css-styling/material-ui/app.jac +122 -0
  78. jac_client/examples/css-styling/material-ui/package.json +32 -0
  79. jac_client/examples/css-styling/material-ui/vite.config.js +27 -0
  80. jac_client/examples/css-styling/pure-css/.babelrc +9 -0
  81. jac_client/examples/css-styling/pure-css/README.md +16 -0
  82. jac_client/examples/css-styling/pure-css/app.jac +64 -0
  83. jac_client/examples/css-styling/pure-css/package.json +28 -0
  84. jac_client/examples/css-styling/pure-css/styles.css +111 -0
  85. jac_client/examples/css-styling/pure-css/vite.config.js +27 -0
  86. jac_client/examples/css-styling/sass-example/.babelrc +9 -0
  87. jac_client/examples/css-styling/sass-example/README.md +16 -0
  88. jac_client/examples/css-styling/sass-example/app.jac +64 -0
  89. jac_client/examples/css-styling/sass-example/package.json +29 -0
  90. jac_client/examples/css-styling/sass-example/styles.scss +153 -0
  91. jac_client/examples/css-styling/sass-example/vite.config.js +27 -0
  92. jac_client/examples/css-styling/styled-components/.babelrc +9 -0
  93. jac_client/examples/css-styling/styled-components/README.md +16 -0
  94. jac_client/examples/css-styling/styled-components/app.jac +71 -0
  95. jac_client/examples/css-styling/styled-components/package.json +29 -0
  96. jac_client/examples/css-styling/styled-components/styled.js +90 -0
  97. jac_client/examples/css-styling/styled-components/vite.config.js +27 -0
  98. jac_client/examples/css-styling/tailwind-example/.babelrc +9 -0
  99. jac_client/examples/css-styling/tailwind-example/README.md +16 -0
  100. jac_client/examples/css-styling/tailwind-example/app.jac +63 -0
  101. jac_client/examples/css-styling/tailwind-example/global.css +1 -0
  102. jac_client/examples/css-styling/tailwind-example/package.json +30 -0
  103. jac_client/examples/css-styling/tailwind-example/vite.config.js +29 -0
  104. jac_client/examples/full-stack-with-auth/app.jac +20 -33
  105. jac_client/examples/full-stack-with-auth/package.json +1 -1
  106. jac_client/examples/full-stack-with-auth/vite.config.js +0 -1
  107. jac_client/examples/little-x/app.jac +327 -218
  108. jac_client/examples/little-x/submit-button.jac +1 -1
  109. jac_client/examples/nested-folders/nested-advance/.babelrc +9 -0
  110. jac_client/examples/nested-folders/nested-advance/ButtonRoot.jac +11 -0
  111. jac_client/examples/nested-folders/nested-advance/README.md +77 -0
  112. jac_client/examples/nested-folders/nested-advance/app.jac +35 -0
  113. jac_client/examples/nested-folders/nested-advance/level1/ButtonSecondL.jac +19 -0
  114. jac_client/examples/nested-folders/nested-advance/level1/Card.jac +43 -0
  115. jac_client/examples/nested-folders/nested-advance/level1/level2/ButtonThirdL.jac +25 -0
  116. jac_client/examples/nested-folders/nested-advance/package.json +29 -0
  117. jac_client/examples/nested-folders/nested-advance/vite.config.js +28 -0
  118. jac_client/examples/nested-folders/nested-basic/.babelrc +9 -0
  119. jac_client/examples/nested-folders/nested-basic/README.md +183 -0
  120. jac_client/examples/nested-folders/nested-basic/app.jac +13 -0
  121. jac_client/examples/nested-folders/nested-basic/app.js +7 -0
  122. jac_client/examples/nested-folders/nested-basic/button.jac +7 -0
  123. jac_client/examples/nested-folders/nested-basic/components/button.jac +7 -0
  124. jac_client/examples/nested-folders/nested-basic/package.json +28 -0
  125. jac_client/examples/nested-folders/nested-basic/vite.config.js +27 -0
  126. jac_client/examples/with-router/app.jac +1 -1
  127. jac_client/examples/with-router/package.json +1 -1
  128. jac_client/examples/with-router/vite.config.js +0 -1
  129. jac_client/plugin/cli.py +7 -2
  130. jac_client/plugin/client.py +68 -5
  131. jac_client/plugin/client_runtime.jac +1 -1
  132. jac_client/plugin/vite_client_bundle.py +162 -14
  133. jac_client/tests/__init__.py +0 -1
  134. jac_client/tests/fixtures/basic-app/app.jac +7 -2
  135. jac_client/tests/fixtures/cl_file/app.cl.jac +48 -0
  136. jac_client/tests/fixtures/cl_file/app.jac +15 -0
  137. jac_client/tests/fixtures/client_app_with_antd/app.jac +14 -8
  138. jac_client/tests/fixtures/js_import/app.jac +19 -15
  139. jac_client/tests/fixtures/js_import/utils.js +0 -1
  140. jac_client/tests/fixtures/package.json +1 -1
  141. jac_client/tests/fixtures/relative_import/app.jac +4 -6
  142. jac_client/tests/fixtures/relative_import/button.jac +7 -6
  143. jac_client/tests/fixtures/spawn_test/app.jac +1 -5
  144. jac_client/tests/fixtures/test_fragments_spread/app.jac +24 -10
  145. jac_client/tests/test_asset_examples.py +322 -0
  146. jac_client/tests/test_cl.py +480 -426
  147. jac_client/tests/test_create_jac_app.py +125 -133
  148. jac_client/tests/test_it.py +329 -0
  149. jac_client/tests/test_nested_file.py +374 -0
  150. {jac_client-0.2.0.dist-info → jac_client-0.2.3.dist-info}/METADATA +11 -3
  151. jac_client-0.2.3.dist-info/RECORD +171 -0
  152. jac_client-0.2.0.dist-info/RECORD +0 -72
  153. {jac_client-0.2.0.dist-info → jac_client-0.2.3.dist-info}/WHEEL +0 -0
  154. {jac_client-0.2.0.dist-info → jac_client-0.2.3.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,395 @@
1
+ # Styled Components
2
+
3
+ CSS-in-JS library with component-scoped styles and dynamic styling for Jac applications.
4
+
5
+ ## Overview
6
+
7
+ Styled Components allows you to write CSS-in-JS using template literals. Styles are scoped to components and can be dynamic based on props. This approach is perfect for:
8
+ - Component-scoped styles
9
+ - Dynamic styling based on props
10
+ - CSS-in-JS with full CSS features
11
+ - React component libraries
12
+
13
+ ## Example
14
+
15
+ See the complete working example: [`examples/css-styling/styled-components/`](../../examples/css-styling/styled-components/)
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Install styled-components
20
+
21
+ Add to `package.json`:
22
+
23
+ ```json
24
+ {
25
+ "dependencies": {
26
+ "styled-components": "^6.1.13"
27
+ }
28
+ }
29
+ ```
30
+
31
+ ### 2. Create Styled Components
32
+
33
+ Create `styled.js`:
34
+
35
+ ```javascript
36
+ import styled from "styled-components";
37
+
38
+ export const Container = styled.div`
39
+ min-height: 100vh;
40
+ background: linear-gradient(to bottom right, #dbeafe, #e0e7ff);
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ padding: 1rem;
45
+ `;
46
+
47
+ export const Card = styled.div`
48
+ background-color: #ffffff;
49
+ border-radius: 1rem;
50
+ box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
51
+ padding: 2rem;
52
+ max-width: 28rem;
53
+ width: 100%;
54
+ `;
55
+
56
+ export const Button = styled.button`
57
+ color: #ffffff;
58
+ font-weight: bold;
59
+ padding: 0.75rem 1.5rem;
60
+ border-radius: 0.5rem;
61
+ background-color: ${props => props.bgColor};
62
+
63
+ &:hover {
64
+ transform: scale(1.05);
65
+ }
66
+
67
+ &:active {
68
+ transform: scale(0.95);
69
+ }
70
+ `;
71
+ ```
72
+
73
+ ### 3. Import and Use in Jac
74
+
75
+ ```jac
76
+ # Pages
77
+ cl import from react {useState, useEffect}
78
+ cl import from .styled {
79
+ Container,
80
+ Card,
81
+ Button
82
+ }
83
+
84
+ cl {
85
+ def app() -> any {
86
+ return <Container>
87
+ <Card>
88
+ <Button bgColor="#ef4444" onClick={handleClick}>
89
+ Click Me
90
+ </Button>
91
+ </Card>
92
+ </Container>;
93
+ }
94
+ }
95
+ ```
96
+
97
+ ## Key Features
98
+
99
+ ### Dynamic Styling with Props
100
+
101
+ Styled components can access props for dynamic styling:
102
+
103
+ ```javascript
104
+ const Button = styled.button`
105
+ background-color: ${props => props.bgColor || '#007bff'};
106
+ color: ${props => props.primary ? 'white' : 'black'};
107
+ padding: ${props => props.large ? '1rem 2rem' : '0.75rem 1.5rem'};
108
+ `;
109
+ ```
110
+
111
+ ### Pseudo-classes
112
+
113
+ Use CSS pseudo-classes:
114
+
115
+ ```javascript
116
+ const Button = styled.button`
117
+ background-color: #007bff;
118
+
119
+ &:hover {
120
+ background-color: #0056b3;
121
+ transform: scale(1.05);
122
+ }
123
+
124
+ &:active {
125
+ transform: scale(0.95);
126
+ }
127
+
128
+ &:focus {
129
+ outline: 2px solid #007bff;
130
+ outline-offset: 2px;
131
+ }
132
+ `;
133
+ ```
134
+
135
+ ### Media Queries
136
+
137
+ Responsive design with media queries:
138
+
139
+ ```javascript
140
+ const Container = styled.div`
141
+ padding: 1rem;
142
+
143
+ @media (min-width: 768px) {
144
+ padding: 2rem;
145
+ }
146
+
147
+ @media (min-width: 1024px) {
148
+ padding: 3rem;
149
+ }
150
+ `;
151
+ ```
152
+
153
+ ### Theming
154
+
155
+ Use ThemeProvider for global themes:
156
+
157
+ ```javascript
158
+ import { ThemeProvider } from 'styled-components';
159
+
160
+ const theme = {
161
+ colors: {
162
+ primary: '#007bff',
163
+ secondary: '#6c757d',
164
+ success: '#28a745',
165
+ },
166
+ spacing: {
167
+ sm: '0.5rem',
168
+ md: '1rem',
169
+ lg: '2rem',
170
+ }
171
+ };
172
+
173
+ // In your app
174
+ <ThemeProvider theme={theme}>
175
+ <App />
176
+ </ThemeProvider>
177
+ ```
178
+
179
+ Access theme in styled components:
180
+
181
+ ```javascript
182
+ const Button = styled.button`
183
+ background-color: ${props => props.theme.colors.primary};
184
+ padding: ${props => props.theme.spacing.md};
185
+ `;
186
+ ```
187
+
188
+ ## Best Practices
189
+
190
+ ### 1. Component Naming
191
+
192
+ Use PascalCase for styled components:
193
+
194
+ ```javascript
195
+ // Good
196
+ const PrimaryButton = styled.button`...`;
197
+ const CardHeader = styled.div`...`;
198
+
199
+ // Avoid
200
+ const button = styled.button`...`;
201
+ const card_header = styled.div`...`;
202
+ ```
203
+
204
+ ### 2. Extract Common Styles
205
+
206
+ Create base components and extend them:
207
+
208
+ ```javascript
209
+ const ButtonBase = styled.button`
210
+ color: #ffffff;
211
+ font-weight: bold;
212
+ padding: 0.75rem 1.5rem;
213
+ border-radius: 0.5rem;
214
+ border: none;
215
+ cursor: pointer;
216
+ `;
217
+
218
+ const PrimaryButton = styled(ButtonBase)`
219
+ background-color: #007bff;
220
+
221
+ &:hover {
222
+ background-color: #0056b3;
223
+ }
224
+ `;
225
+
226
+ const SecondaryButton = styled(ButtonBase)`
227
+ background-color: #6c757d;
228
+
229
+ &:hover {
230
+ background-color: #545b62;
231
+ }
232
+ `;
233
+ ```
234
+
235
+ ### 3. Use Props Wisely
236
+
237
+ Keep prop-based styling simple:
238
+
239
+ ```javascript
240
+ // Good
241
+ const Button = styled.button`
242
+ background-color: ${props => props.variant === 'primary' ? '#007bff' : '#6c757d'};
243
+ `;
244
+
245
+ // Avoid complex logic in template literals
246
+ const Button = styled.button`
247
+ background-color: ${props => {
248
+ if (props.variant === 'primary') {
249
+ if (props.disabled) return '#ccc';
250
+ return '#007bff';
251
+ }
252
+ // ... too complex
253
+ }};
254
+ `;
255
+ ```
256
+
257
+ ### 4. Organize Files
258
+
259
+ Group related styled components together:
260
+
261
+ ```javascript
262
+ // components/Button.styled.js
263
+ export const Button = styled.button`...`;
264
+ export const ButtonGroup = styled.div`...`;
265
+
266
+ // components/Card.styled.js
267
+ export const Card = styled.div`...`;
268
+ export const CardHeader = styled.div`...`;
269
+ export const CardBody = styled.div`...`;
270
+ ```
271
+
272
+ ### 5. Performance
273
+
274
+ Use `React.memo` for expensive styled components:
275
+
276
+ ```javascript
277
+ const ExpensiveComponent = React.memo(styled.div`
278
+ /* complex styles */
279
+ `);
280
+ ```
281
+
282
+ ## Advanced Patterns
283
+
284
+ ### Extending Components
285
+
286
+ Extend existing styled components:
287
+
288
+ ```javascript
289
+ const Button = styled.button`
290
+ padding: 0.75rem 1.5rem;
291
+ border-radius: 0.5rem;
292
+ `;
293
+
294
+ const PrimaryButton = styled(Button)`
295
+ background-color: #007bff;
296
+ color: white;
297
+ `;
298
+
299
+ const LargeButton = styled(Button)`
300
+ padding: 1rem 2rem;
301
+ font-size: 1.25rem;
302
+ `;
303
+ ```
304
+
305
+ ### Conditional Rendering
306
+
307
+ Use conditional logic in styles:
308
+
309
+ ```javascript
310
+ const Container = styled.div`
311
+ display: ${props => props.hidden ? 'none' : 'flex'};
312
+ opacity: ${props => props.disabled ? 0.5 : 1};
313
+ pointer-events: ${props => props.disabled ? 'none' : 'auto'};
314
+ `;
315
+ ```
316
+
317
+ ### Animations
318
+
319
+ Use CSS animations:
320
+
321
+ ```javascript
322
+ const FadeIn = styled.div`
323
+ animation: fadeIn 0.5s ease-in;
324
+
325
+ @keyframes fadeIn {
326
+ from {
327
+ opacity: 0;
328
+ transform: translateY(-10px);
329
+ }
330
+ to {
331
+ opacity: 1;
332
+ transform: translateY(0);
333
+ }
334
+ }
335
+ `;
336
+ ```
337
+
338
+ ## Advantages
339
+
340
+ - **Component-scoped styles** (no CSS conflicts)
341
+ - **Dynamic styling** based on props
342
+ - **Full CSS features** (pseudo-classes, media queries)
343
+ - **Type-safe** with TypeScript
344
+ - **Automatic vendor prefixing**
345
+ - **Dead code elimination**
346
+ - **No class name collisions**
347
+
348
+ ## Limitations
349
+
350
+ - **Runtime overhead** (styles generated at runtime)
351
+ - **Learning curve** for CSS-in-JS
352
+ - **Larger bundle size** than CSS
353
+ - **Requires JavaScript** for styling
354
+ - **Debugging** can be harder
355
+
356
+ ## When to Use
357
+
358
+ Choose Styled Components when:
359
+
360
+ - You want component-scoped styles
361
+ - You need dynamic styling based on props
362
+ - You prefer CSS-in-JS approach
363
+ - You're building component libraries
364
+ - You want full CSS features in JavaScript
365
+ - You want to avoid class name conflicts
366
+
367
+ ## Import Syntax
368
+
369
+ Styled components are imported as JavaScript modules:
370
+
371
+ ```jac
372
+ cl import from .styled {
373
+ Container,
374
+ Card,
375
+ Button
376
+ }
377
+ ```
378
+
379
+ For external packages:
380
+
381
+ ```jac
382
+ cl import from "styled-components" { default as styled }
383
+ ```
384
+
385
+ ## Next Steps
386
+
387
+ - Explore [Emotion](./emotion.md) for similar CSS-in-JS (coming soon)
388
+ - Check out [Vanilla Extract](./vanilla-extract.md) for zero-runtime CSS-in-JS (coming soon)
389
+ - Learn about [JavaScript Styling](./js-styling.md) for inline styles
390
+ - See [CSS Modules](./css-modules.md) for scoped CSS (coming soon)
391
+
392
+ ## Resources
393
+
394
+ - [Styled Components Documentation](https://styled-components.com/docs)
395
+ - [Styled Components Best Practices](https://styled-components.com/docs/basics#styling-any-component)
@@ -0,0 +1,298 @@
1
+ # Tailwind CSS
2
+
3
+ Utility-first CSS framework for rapid UI development in Jac applications.
4
+
5
+ ## Overview
6
+
7
+ Tailwind CSS provides low-level utility classes that you can compose to build custom designs. This approach is perfect for:
8
+ - Rapid UI development
9
+ - Consistent design systems
10
+ - Responsive designs
11
+ - Modern, utility-based styling
12
+
13
+ ## Example
14
+
15
+ See the complete working example: [`examples/css-styling/tailwind-example/`](../../examples/css-styling/tailwind-example/)
16
+
17
+ ## Quick Start
18
+
19
+ ### 1. Install Tailwind CSS
20
+
21
+ Add to `package.json`:
22
+
23
+ ```json
24
+ {
25
+ "devDependencies": {
26
+ "@tailwindcss/vite": "^4.0.0"
27
+ }
28
+ }
29
+ ```
30
+
31
+ ### 2. Configure Vite
32
+
33
+ Update `vite.config.js`:
34
+
35
+ ```javascript
36
+ import { defineConfig } from "vite";
37
+ import tailwindcss from '@tailwindcss/vite'
38
+
39
+ export default defineConfig({
40
+ plugins: [tailwindcss()],
41
+ // ... other config
42
+ });
43
+ ```
44
+
45
+ ### 3. Add Tailwind Directives
46
+
47
+ Create `global.css`:
48
+
49
+ ```css
50
+ @import "tailwindcss";
51
+ ```
52
+
53
+ ### 4. Import CSS in Jac
54
+
55
+ ```jac
56
+ # Pages
57
+ cl import from react {useState, useEffect}
58
+ cl import ".global.css";
59
+
60
+ cl {
61
+ def app() -> any {
62
+ return <div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
63
+ <h1 className="text-3xl font-bold">Hello, Tailwind!</h1>
64
+ </div>;
65
+ }
66
+ }
67
+ ```
68
+
69
+ ## Using Utility Classes
70
+
71
+ ### Spacing
72
+
73
+ ```jac
74
+ <div className="p-4 m-2 gap-4">
75
+ {/* padding: 1rem, margin: 0.5rem, gap: 1rem */}
76
+ </div>
77
+ ```
78
+
79
+ ### Colors
80
+
81
+ ```jac
82
+ <div className="bg-blue-500 text-white hover:bg-blue-600">
83
+ {/* Blue background, white text, darker blue on hover */}
84
+ </div>
85
+ ```
86
+
87
+ ### Layout
88
+
89
+ ```jac
90
+ <div className="flex items-center justify-center">
91
+ {/* Flexbox with centered items */}
92
+ </div>
93
+ ```
94
+
95
+ ### Responsive
96
+
97
+ ```jac
98
+ <div className="text-sm md:text-lg lg:text-xl">
99
+ {/* Small on mobile, large on tablet, xl on desktop */}
100
+ </div>
101
+ ```
102
+
103
+ ## Dynamic Classes
104
+
105
+ Combine static and dynamic classes:
106
+
107
+ ```jac
108
+ let countColorClass = "text-gray-800" if count == 0 else ("text-green-600" if count > 0 else "text-red-600");
109
+
110
+ return <div className={"text-6xl font-bold " + countColorClass + " transition-colors duration-300"}>
111
+ {count}
112
+ </div>;
113
+ ```
114
+
115
+ ## Common Utility Patterns
116
+
117
+ ### Buttons
118
+
119
+ ```jac
120
+ <button className="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded">
121
+ Click Me
122
+ </button>
123
+ ```
124
+
125
+ ### Cards
126
+
127
+ ```jac
128
+ <div className="bg-white rounded-lg shadow-lg p-6">
129
+ <h2 className="text-2xl font-bold mb-4">Card Title</h2>
130
+ <p className="text-gray-600">Card content</p>
131
+ </div>
132
+ ```
133
+
134
+ ### Flexbox Layouts
135
+
136
+ ```jac
137
+ <div className="flex flex-col md:flex-row gap-4">
138
+ <div className="flex-1">Column 1</div>
139
+ <div className="flex-1">Column 2</div>
140
+ </div>
141
+ ```
142
+
143
+ ### Grid Layouts
144
+
145
+ ```jac
146
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
147
+ <div>Item 1</div>
148
+ <div>Item 2</div>
149
+ <div>Item 3</div>
150
+ </div>
151
+ ```
152
+
153
+ ## Best Practices
154
+
155
+ ### 1. Use Responsive Prefixes
156
+
157
+ Design mobile-first with responsive breakpoints:
158
+
159
+ ```jac
160
+ <div className="text-sm md:text-base lg:text-lg">
161
+ Responsive text
162
+ </div>
163
+ ```
164
+
165
+ ### 2. Combine Utilities
166
+
167
+ Chain multiple utilities for complex styles:
168
+
169
+ ```jac
170
+ <button className="bg-blue-500 hover:bg-blue-600 text-white font-bold py-3 px-6 rounded-lg shadow-lg transition-all duration-200 transform hover:scale-105">
171
+ Button
172
+ </button>
173
+ ```
174
+
175
+ ### 3. Use Hover/Focus States
176
+
177
+ Leverage pseudo-class variants:
178
+
179
+ ```jac
180
+ <button className="bg-blue-500 hover:bg-blue-600 focus:ring-2 focus:ring-blue-300">
181
+ Interactive Button
182
+ </button>
183
+ ```
184
+
185
+ ### 4. Leverage Transitions
186
+
187
+ Add smooth transitions:
188
+
189
+ ```jac
190
+ <div className="transition-all duration-200 hover:scale-105">
191
+ Hoverable element
192
+ </div>
193
+ ```
194
+
195
+ ### 5. Use Arbitrary Values
196
+
197
+ For custom values:
198
+
199
+ ```jac
200
+ <div className="w-[500px] h-[300px] bg-[#1da1f2]">
201
+ Custom dimensions and color
202
+ </div>
203
+ ```
204
+
205
+ ## Configuration
206
+
207
+ Customize Tailwind in `tailwind.config.js`:
208
+
209
+ ```javascript
210
+ export default {
211
+ theme: {
212
+ extend: {
213
+ colors: {
214
+ 'brand': '#your-color',
215
+ },
216
+ spacing: {
217
+ '128': '32rem',
218
+ },
219
+ },
220
+ },
221
+ }
222
+ ```
223
+
224
+ ## Advantages
225
+
226
+ - **Rapid development** with utility classes
227
+ - **Consistent design system**
228
+ - **Responsive by default**
229
+ - **Small bundle size** (unused classes are purged)
230
+ - **Great documentation** and ecosystem
231
+ - **Highly customizable**
232
+
233
+ ## Limitations
234
+
235
+ - **Can get verbose** with many classes
236
+ - **Learning curve** for utility-first approach
237
+ - **Less semantic** than component-based CSS
238
+ - **Requires build step**
239
+ - **HTML can get cluttered**
240
+
241
+ ## When to Use
242
+
243
+ Choose Tailwind CSS when:
244
+
245
+ - You want to build UIs quickly
246
+ - You prefer utility classes over custom CSS
247
+ - You need a consistent design system
248
+ - You're building modern, responsive designs
249
+ - You want a small bundle size
250
+ - You prefer configuration over writing CSS
251
+
252
+ ## Purging Unused Classes
253
+
254
+ Tailwind automatically removes unused classes in production builds, keeping bundle size small. No configuration needed with Vite plugin.
255
+
256
+ ## Customization
257
+
258
+ ### Custom Colors
259
+
260
+ ```javascript
261
+ // tailwind.config.js
262
+ export default {
263
+ theme: {
264
+ extend: {
265
+ colors: {
266
+ 'brand-blue': '#1e40af',
267
+ 'brand-purple': '#7c3aed',
268
+ },
269
+ },
270
+ },
271
+ }
272
+ ```
273
+
274
+ ### Custom Spacing
275
+
276
+ ```javascript
277
+ theme: {
278
+ extend: {
279
+ spacing: {
280
+ '18': '4.5rem',
281
+ '88': '22rem',
282
+ },
283
+ },
284
+ }
285
+ ```
286
+
287
+ ## Next Steps
288
+
289
+ - Explore [Tailwind CSS Documentation](https://tailwindcss.com/docs)
290
+ - Check out [UnoCSS](./unocss.md) for similar utility-first approach (coming soon)
291
+ - Learn about [CSS Modules](./css-modules.md) for component-scoped styles (coming soon)
292
+ - See [Pure CSS](./pure-css.md) for traditional CSS approach
293
+
294
+ ## Resources
295
+
296
+ - [Tailwind CSS Documentation](https://tailwindcss.com/docs)
297
+ - [Tailwind UI Components](https://tailwindui.com/)
298
+ - [Tailwind Play](https://play.tailwindcss.com/) - Online playground
@@ -0,0 +1,9 @@
1
+
2
+ {
3
+ "presets": [[
4
+ "@babel/preset-env",
5
+ {
6
+ "modules": false
7
+ }
8
+ ], "@babel/preset-react"]
9
+ }
@@ -0,0 +1,16 @@
1
+ # all-in-one
2
+
3
+ ## Running Jac Code
4
+
5
+ make sure node modules are installed:
6
+ ```bash
7
+ npm install
8
+ ```
9
+
10
+ To run your Jac code, use the Jac CLI:
11
+
12
+ ```bash
13
+ jac serve app.jac
14
+ ```
15
+
16
+ Happy coding with Jac!