clou-lang 0.3.6 → 0.4.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.
@@ -10,9 +10,10 @@ Clou code compiles to HTML/CSS/JS for websites, or runs directly in the terminal
10
10
  **Build:** `clou build mysite.clou`
11
11
  **Dev server:** `clou dev mysite.clou`
12
12
  **Deploy:** `clou deploy mysite.clou`
13
+ **Init project:** `clou init my-project`
13
14
  **Playground:** `clou playground`
14
15
 
15
- ## Website Mode — Full Syntax Reference (30+ Elements)
16
+ ## Website Mode — Full Syntax Reference (40+ Elements)
16
17
 
17
18
  ```clou
18
19
  // Variables
@@ -57,6 +58,23 @@ page "Title" at "/":
57
58
  space 40 // vertical spacing (px)
58
59
  code "let x = 1" // code block
59
60
  audio "song.mp3" // audio player
61
+ badge "NEW" // small colored label
62
+ avatar "photo.jpg" // circular profile image
63
+ stars 4 // star rating (0-5)
64
+ stars 4 "Great!" // star rating with label
65
+ tooltip "Hover me" "Extra info shows on hover"
66
+ typing "Hello World" // typewriter animation text
67
+ countdown "2026-12-31" // live countdown timer
68
+ countdown "2026-12-31" "New Year" // with label
69
+ embed "youtube.com/watch?v=..." // embed YouTube/iframe
70
+ search "Search..." // search bar with icon
71
+ darkmode // dark/light mode toggle button
72
+
73
+ // Carousel (image slider)
74
+ carousel:
75
+ image "slide1.jpg"
76
+ image "slide2.jpg"
77
+ image "slide3.jpg"
60
78
 
61
79
  // Forms & Input
62
80
  form:
@@ -96,6 +114,7 @@ page "Title" at "/":
96
114
  // Actions (inside buttons)
97
115
  button "Click me":
98
116
  show message "Alert text!"
117
+ toast "Saved!" // temporary notification
99
118
  open "modal-name"
100
119
  close "modal-name"
101
120
  toggle "element-id"
@@ -132,7 +151,7 @@ style:
132
151
  font Arial
133
152
  size 18
134
153
  gradient #color1 to #color2
135
- animate fade / slide / bounce / grow / glow
154
+ animate fade / slide / bounce / grow / glow / pulse / shake / float / typewrite
136
155
  big / huge / small / tiny
137
156
  full
138
157
  sticky
@@ -160,6 +179,20 @@ repeat 5:
160
179
  | `glass` | Glassmorphism, purple gradient |
161
180
  | `aurora` | Northern lights, cyan-purple |
162
181
 
182
+ ## Available Animations
183
+
184
+ | Animation | Effect |
185
+ |-----------|--------|
186
+ | `fade` | Fade in from transparent |
187
+ | `slide` | Slide up into view |
188
+ | `bounce` | Bounce down into place |
189
+ | `grow` | Scale up from small |
190
+ | `glow` | Pulsing brightness (infinite) |
191
+ | `pulse` | Scale pulse (infinite) |
192
+ | `shake` | Horizontal shake |
193
+ | `float` | Gentle floating up/down (infinite) |
194
+ | `typewrite` | Typewriter reveal with cursor |
195
+
163
196
  ## Terminal Mode — Full Syntax Reference
164
197
 
165
198
  ```clou
@@ -184,6 +217,21 @@ app "My App":
184
217
  set total to 10 * 2
185
218
  set half to 100 / 4
186
219
 
220
+ // Random
221
+ random 1 to 10 save as num
222
+
223
+ // HTTP Requests
224
+ fetch "https://api.example.com/data" save as response
225
+
226
+ // Interactive Menu
227
+ menu "Choose an option:":
228
+ option "Play Game":
229
+ print "Starting game..."
230
+ option "View Score":
231
+ print "Score: {score}"
232
+ option "Quit":
233
+ exit
234
+
187
235
  // Conditions
188
236
  if name is "Alex":
189
237
  print "Hi Alex!"
@@ -231,7 +279,7 @@ app "My App":
231
279
  6. **Templates**: Use templates for any repeated pattern (cards, sections, etc.)
232
280
  7. **Comments**: Use `//` for comments.
233
281
  8. **Keep it simple**: Clou's power is simplicity. Don't overcomplicate.
234
- 9. **Use new elements**: Prefer form/table/tabs/accordion when appropriate instead of plain boxes.
282
+ 9. **Use new elements**: Prefer form/table/tabs/accordion/carousel/stars/badge/search when appropriate.
235
283
 
236
284
  ## Example: Complete Website
237
285
 
@@ -247,22 +295,33 @@ template feature(emoji, title, desc):
247
295
 
248
296
  page "{brand}":
249
297
  theme "aurora"
298
+ darkmode
250
299
 
251
300
  navbar "{brand}":
252
301
  link "Features" to "#features"
253
302
  link "About" to "#about"
303
+ link "Contact" to "#contact"
254
304
 
255
305
  section "hero":
256
306
  center
257
307
  space 30
308
+ badge "NOW LIVE"
309
+ space 10
258
310
  heading "Build the Future":
259
311
  huge
260
312
  animate fade
261
313
  text "Simple tools for complex problems.":
262
314
  big
315
+ typing "Describe it once. Run it everywhere."
263
316
  space 20
264
- button "Get Started":
265
- show message "Welcome!"
317
+ row:
318
+ center
319
+ button "Get Started":
320
+ toast "Welcome aboard!"
321
+ button "Learn More":
322
+ go to "#features"
323
+ space 20
324
+ countdown "2026-12-31" "Launch Countdown"
266
325
  space 30
267
326
 
268
327
  section "features":
@@ -274,6 +333,18 @@ page "{brand}":
274
333
  use feature("⚡", "Fast", "Built for speed.")
275
334
  use feature("🔒", "Secure", "Safe by default.")
276
335
  use feature("🎨", "Beautiful", "Looks great.")
336
+ space 20
337
+ stars 5 "Rated by developers"
338
+
339
+ section "gallery":
340
+ center
341
+ heading "Screenshots":
342
+ huge
343
+ space 20
344
+ carousel:
345
+ image "screenshot1.jpg"
346
+ image "screenshot2.jpg"
347
+ image "screenshot3.jpg"
277
348
 
278
349
  section "about":
279
350
  heading "FAQ":
@@ -287,10 +358,29 @@ page "{brand}":
287
358
  panel "How do I start?":
288
359
  text "npm install -g clou-lang"
289
360
 
361
+ section "team":
362
+ center
363
+ heading "Our Team":
364
+ huge
365
+ space 20
366
+ grid:
367
+ card:
368
+ avatar "team1.jpg"
369
+ heading "Alex"
370
+ text "Founder"
371
+ stars 5
372
+ card:
373
+ avatar "team2.jpg"
374
+ heading "Sam"
375
+ text "Designer"
376
+ stars 4
377
+
290
378
  section "contact":
291
379
  center
292
380
  heading "Get in Touch"
293
381
  space 20
382
+ search "Search our docs..."
383
+ space 20
294
384
  form:
295
385
  input "Your name"
296
386
  input "Your email"
@@ -301,4 +391,34 @@ page "{brand}":
301
391
  text "© 2026 {brand} — Built with Clou"
302
392
  ```
303
393
 
304
- When the user asks you to build something with Clou, generate clean, well-structured Clou code following these patterns. Use the new elements (form, table, tabs, accordion, progress, dropdown, checkbox, textarea, slider, audio, code) where they make sense.
394
+ ## Example: Terminal App
395
+
396
+ ```clou
397
+ app "Number Guessing Game":
398
+ print color cyan "=== Number Guessing Game ==="
399
+ random 1 to 100 save as secret
400
+ set tries to "0"
401
+ set won to "false"
402
+
403
+ while won is "false":
404
+ ask "Guess a number (1-100):" save as guess
405
+ add 1 to tries
406
+
407
+ if guess is secret:
408
+ set won to "true"
409
+ print color green "Correct! You won in {tries} tries!"
410
+ else:
411
+ if guess greater than secret:
412
+ print color yellow "Too high!"
413
+ else:
414
+ print color yellow "Too low!"
415
+
416
+ menu "Play again?":
417
+ option "Yes":
418
+ print "Restarting..."
419
+ option "No":
420
+ print "Goodbye!"
421
+ exit
422
+ ```
423
+
424
+ When the user asks you to build something with Clou, generate clean, well-structured Clou code following these patterns. Use all available elements (40+) where they make sense.
package/bin/clou.js CHANGED
@@ -18,7 +18,7 @@ const args = process.argv.slice(2);
18
18
  function printHelp() {
19
19
  console.log(`
20
20
  ╔═══════════════════════════════════════╗
21
- ║ CLOU Language v0.3.5
21
+ ║ CLOU Language v0.4.0
22
22
  ║ Describe it once. Run everywhere. ║
23
23
  ╚═══════════════════════════════════════╝
24
24
 
@@ -29,6 +29,7 @@ function printHelp() {
29
29
  clou build <file.clou> -o <output> Build to specific file
30
30
  clou dev <file.clou> Start live dev server
31
31
  clou dev <file.clou> -p <port> Dev server on custom port
32
+ clou init <name> Create new project
32
33
  clou deploy <file.clou> Deploy to the web (surge)
33
34
  clou deploy <file.clou> --github Deploy to GitHub Pages
34
35
  clou deploy <file.clou> --netlify Deploy with Netlify
@@ -306,6 +307,93 @@ if (args[0] === 'playground' || args[0] === 'play') {
306
307
  return;
307
308
  }
308
309
 
310
+ // Handle init command
311
+ if (args[0] === 'init') {
312
+ const projectName = args[1] || 'my-clou-site';
313
+ const projectDir = path.resolve(projectName);
314
+
315
+ if (fs.existsSync(projectDir)) {
316
+ console.error(` Error: Directory "${projectName}" already exists.`);
317
+ process.exit(1);
318
+ }
319
+
320
+ fs.mkdirSync(projectDir, { recursive: true });
321
+
322
+ const template = `set brand to "${projectName}"
323
+
324
+ template feature(emoji, title, desc):
325
+ card:
326
+ icon "{emoji}"
327
+ heading "{title}"
328
+ text "{desc}"
329
+ animate slide
330
+
331
+ page "{brand}":
332
+ theme "midnight"
333
+
334
+ navbar "{brand}":
335
+ link "Home" to "#"
336
+ link "About" to "#about"
337
+ link "Contact" to "#contact"
338
+
339
+ section "hero":
340
+ center
341
+ space 30
342
+ heading "Welcome to {brand}":
343
+ huge
344
+ animate fade
345
+ text "Built with Clou — the simplest language ever.":
346
+ big
347
+ space 20
348
+ button "Get Started":
349
+ show message "Let's go!"
350
+ space 30
351
+
352
+ section "about":
353
+ center
354
+ heading "Features":
355
+ huge
356
+ space 20
357
+ grid:
358
+ use feature("⚡", "Fast", "Builds in milliseconds.")
359
+ use feature("🎨", "Beautiful", "10 themes included.")
360
+ use feature("🚀", "Easy Deploy", "One command to go live.")
361
+
362
+ section "contact":
363
+ center
364
+ heading "Contact":
365
+ huge
366
+ space 20
367
+ form:
368
+ input "Your name"
369
+ input "Your email"
370
+ textarea "Your message"
371
+ submit "Send"
372
+
373
+ footer:
374
+ text "© 2026 {brand} — Built with Clou"
375
+ `;
376
+
377
+ fs.writeFileSync(path.join(projectDir, 'index.clou'), template, 'utf-8');
378
+
379
+ console.log(`
380
+ ╔═══════════════════════════════════════╗
381
+ ║ CLOU Project Created! ║
382
+ ╚═══════════════════════════════════════╝
383
+
384
+ Created: ${projectName}/index.clou
385
+
386
+ Next steps:
387
+ cd ${projectName}
388
+ clou index.clou Build & open
389
+ clou dev index.clou Live dev server
390
+ clou deploy index.clou Deploy to the web
391
+
392
+ Happy building! 🚀
393
+ `);
394
+ process.exit(0);
395
+ }
396
+
309
397
  // Handle deploy command (before smart detection)
310
398
  if (args[0] === 'deploy') {
311
399
  const { ClouDeploy } = require('../src/deploy');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clou-lang",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "Clou - A programming language so simple, even kids can build websites and terminal apps",
5
5
  "main": "src/index.js",
6
6
  "bin": {