Skip to content

Commit a3dea7a

Browse files
committed
Upgrade UI library and documentation, add prm build web support
1 parent ab33378 commit a3dea7a

File tree

7 files changed

+355
-25
lines changed

7 files changed

+355
-25
lines changed

docs/stdlib/UI_DOC.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# ProXPL UI Standard Library (UI Kit)
2+
3+
The `UI` module provides a comprehensive set of design tokens and utility strings for building modern, high-performance web interfaces in ProXPL.
4+
5+
## Core Concepts
6+
7+
ProXPL UI is built on a **Token-Based Design System**. Instead of writing raw CSS, you use predefined constants that represent design decisions (colors, spacing, shadows, etc.).
8+
9+
### Usage
10+
```javascript
11+
use UI;
12+
13+
App MyView {
14+
Main(style: PROX_THEME_MIDNIGHT) {
15+
Container(style: GLASS_CARD + " " + ANIM_FADE_IN) {
16+
Text(style: TEXT_XL + " " + FONT_BOLD) { "Hello ProXPL" }
17+
}
18+
}
19+
}
20+
```
21+
22+
---
23+
24+
## 🎨 Design Tokens
25+
26+
### Colors
27+
- `COLOR_PRIMARY`: Core brand color (#3b82f6)
28+
- `COLOR_SUCCESS`: Positive actions (#22c55e)
29+
- `COLOR_DANGER`: Destructive actions (#ef4444)
30+
- `COLOR_GLASS`: Transparent white for glass effects
31+
32+
### Premium Gradients v2
33+
| Token | Visual Style |
34+
|-------|--------------|
35+
| `GRADIENT_VIOLET_DREAM` | Deep purple to magenta |
36+
| `GRADIENT_CYBER_PUNK` | Neon blue to vivid cyan |
37+
| `GRADIENT_ROSE_GOLD` | Soft rose to elegant gold |
38+
39+
---
40+
41+
## 🏗️ Layout Utilities
42+
43+
### Bento Grid
44+
The **Bento Grid** is a modern layout pattern for creating responsive, tiled interfaces.
45+
46+
- `BENTO_GRID`: Initializer for a 4-column auto-row grid.
47+
- `BENTO_ITEM_W2`: Span 2 columns.
48+
- `BENTO_ITEM_H2`: Span 2 rows.
49+
50+
**Example:**
51+
```javascript
52+
Section(style: BENTO_GRID) {
53+
Container(style: GLASS_CARD + BENTO_ITEM_W2 + BENTO_ITEM_H2) { "Main Feature" }
54+
Container(style: GLASS_CARD) { "Metric 1" }
55+
Container(style: GLASS_CARD) { "Metric 2" }
56+
}
57+
```
58+
59+
---
60+
61+
## 🪟 Components
62+
63+
### Glassmorphism v2
64+
Refined glass effects with high saturation and backdrop blurring.
65+
- `GLASS_V2_LIGHT`: Premium light glass.
66+
- `GLASS_V2_DARK`: Premium dark glass.
67+
- `GLASS_V2_PURPLE`: Themed purple glass.
68+
69+
### Stat Cards
70+
- `STAT_CARD`: Container for metric displays.
71+
- `STAT_VALUE`: Large, prominent font for numbers.
72+
- `STAT_LABEL`: Small, muted label.
73+
74+
---
75+
76+
## 🎬 Animations
77+
- `ANIM_FADE_IN`: Smooth opacity entry.
78+
- `ANIM_ZOOM_IN`: Scale and opacity entry.
79+
- `ANIM_BOUNCE`: Attention-grabbing bounce.
80+
- `ANIM_SKELETON`: Shimmer effect for loading states.
81+
82+
---
83+
84+
## 🛠️ Build Commands
85+
Build your UI to a web-ready format using the `prm` tool:
86+
87+
```bash
88+
prm build web # Build to default dist/
89+
prm build web --output myapp # Build to custom folder
90+
```

examples/demo_web/index.html

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Premium Ecosystem Dashboard</title>
7+
<link rel="preconnect" href="https://fonts.googleapis.com">
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Fira+Code:wght@400;500&family=Outfit:wght@400;600;700;900&display=swap" rel="stylesheet">
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
11+
<script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script>
12+
<style>
13+
/* === Premium UI v2 CSS (Manual Demo) === */
14+
:root {
15+
--color-primary: #3b82f6;
16+
--color-success: #22c55e;
17+
--color-danger: #ef4444;
18+
--gradient-violet: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%);
19+
--gradient-cyber: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
20+
--glass-v2-dark: backdrop-filter: blur(24px) saturate(200%); background: rgba(17, 24, 39, 0.6); border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
21+
}
22+
23+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
24+
body {
25+
font-family: 'Inter', sans-serif;
26+
background: #0f172a;
27+
color: #f8fafc;
28+
min-height: 100vh;
29+
display: flex;
30+
}
31+
32+
/* Bento Grid */
33+
.bento-grid {
34+
display: grid;
35+
grid-template-columns: repeat(4, 1fr);
36+
grid-auto-rows: minmax(150px, auto);
37+
gap: 1.5rem;
38+
width: 100%;
39+
max-width: 1200px;
40+
margin: auto;
41+
padding: 2rem;
42+
}
43+
44+
.bento-item {
45+
border-radius: 1.5rem;
46+
padding: 2rem;
47+
transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
48+
display: flex;
49+
flex-direction: column;
50+
justify-content: center;
51+
}
52+
53+
.bento-item:hover {
54+
transform: translateY(-5px) scale(1.02);
55+
box-shadow: 0 20px 40px rgba(0,0,0,0.4);
56+
}
57+
58+
.w-2 { grid-column: span 2; }
59+
.h-2 { grid-row: span 2; }
60+
61+
/* Glass v2 */
62+
.glass-v2-dark {
63+
backdrop-filter: blur(24px) saturate(200%);
64+
background: rgba(17, 24, 39, 0.6);
65+
border: 1px solid rgba(255, 255, 255, 0.1);
66+
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
67+
}
68+
69+
.glass-v2-purple {
70+
backdrop-filter: blur(20px);
71+
background: rgba(139, 92, 246, 0.2);
72+
border: 1px solid rgba(139, 92, 246, 0.3);
73+
box-shadow: 0 8px 32px 0 rgba(139, 92, 246, 0.2);
74+
}
75+
76+
.glass-v2-light {
77+
backdrop-filter: blur(24px) saturate(200%);
78+
background: rgba(255, 255, 255, 0.4);
79+
border: 1px solid rgba(255, 255, 255, 0.5);
80+
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
81+
color: #1e293b;
82+
}
83+
84+
/* Typography */
85+
.stat-label { font-size: 0.875rem; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
86+
.stat-value { font-size: 2.5rem; font-weight: 800; font-family: 'Outfit', sans-serif; }
87+
.font-black { font-weight: 900; }
88+
89+
/* Animations */
90+
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
91+
.anim-fade-in { animation: fadeIn 0.8s forwards; }
92+
93+
.badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 700; margin-top: 1rem; align-self: flex-start; }
94+
.badge-hot { background: #ef4444; color: white; }
95+
.badge-success { background: #22c55e; color: white; }
96+
97+
.header { margin-bottom: 2rem; width: 100%; text-align: center; }
98+
.header h1 { font-family: 'Outfit', sans-serif; font-size: 3rem; font-weight: 900; background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
99+
</style>
100+
</head>
101+
<body x-data="{ revenue: '$2,842,500' }">
102+
<div class="bento-grid">
103+
<div class="header" style="grid-column: span 4;">
104+
<h1>ProXPL Ecosystem</h1>
105+
<p>Premium UI Kit Demo — Generated by prm build web</p>
106+
</div>
107+
108+
<div class="bento-item glass-v2-dark w-2 h-2 anim-fade-in">
109+
<div class="stat-label">Total Ecosystem Revenue</div>
110+
<div class="stat-value font-black" x-text="revenue"></div>
111+
<div style="color: #22c55e; font-weight: bold; margin-top: 0.5rem;">↑ 32% Year-to-Date</div>
112+
<p style="margin-top: 1.5rem; opacity: 0.7; font-size: 0.9rem;">
113+
Projected growth based on ProXPL adoption rates across the India region.
114+
</p>
115+
</div>
116+
117+
<div class="bento-item glass-v2-purple anim-fade-in" style="animation-delay: 0.1s">
118+
<div classStat-label">Active Nodes</div>
119+
<div class="stat-value">1,248</div>
120+
<span class="badge badge-hot">LIVE</span>
121+
</div>
122+
123+
<div class="bento-item glass-v2-light anim-fade-in" style="animation-delay: 0.2s">
124+
<div class="stat-label" style="color: #64748b">System Health</div>
125+
<div class="stat-value">99.9%</div>
126+
<span class="badge badge-success">STABLE</span>
127+
</div>
128+
129+
<div class="bento-item glass-v2-dark anim-fade-in" style="animation-delay: 0.3s; grid-column: span 2;">
130+
<div class="stat-label">Core System Controls</div>
131+
<div style="display: flex; gap: 1rem; margin-top: 1rem;">
132+
<button style="background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); padding: 0.8rem 1.5rem; border-radius: 0.8rem; color: white; cursor: pointer; font-weight: 600;">Sync Cloud</button>
133+
<button style="background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); padding: 0.8rem 1.5rem; border-radius: 0.8rem; color: white; cursor: pointer; font-weight: 600;">Optimize JS</button>
134+
</div>
135+
</div>
136+
</div>
137+
</body>
138+
</html>

examples/premium_ui.prox

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,31 @@ App ProfessionalDashboard {
5151
}
5252
}
5353

54-
// --- Glassmorphic Stat Cards ---
55-
Container(style: LAYOUT_GRID + " gap-8") {
56-
Container(style: GLASS_CARD + " " + ANIM_FADE_IN) {
57-
Text(style: STAT_LABEL) { "Annual Revenue" }
58-
Text(style: STAT_VALUE) { revenue }
59-
Text(style: "color: " + COLOR_SECONDARY + " font-bold") { "↑ 24% Improvement" }
54+
// --- Glassmorphic Stat Cards (v2) ---
55+
Container(style: BENTO_GRID) {
56+
Container(style: GLASS_V2_DARK + " " + BENTO_ITEM_W2 + " " + BENTO_ITEM_H2 + " " + ANIM_FADE_IN) {
57+
Text(style: STAT_LABEL) { "Total Ecosystem Revenue" }
58+
Text(style: STAT_VALUE + " font-black") { revenue }
59+
Text(style: "color: " + COLOR_SUCCESS + " font-bold") { "↑ 32% Year-to-Date" }
60+
Text(style: "margin-top: 1rem; opacity: 0.7") { "Projected growth based on ProXPL adoption rates." }
6061
}
6162

62-
Container(style: GLASS_CARD + " " + ANIM_FADE_IN + " animation-delay: 0.1s") {
63-
Text(style: STAT_LABEL) { "Active Sessions" }
64-
Text(style: STAT_VALUE) { "42.8k" }
63+
Container(style: GLASS_V2_PURPLE + " " + ANIM_FADE_IN + " animation-delay: 0.1s") {
64+
Text(style: STAT_LABEL) { "Active Nodes" }
65+
Text(style: STAT_VALUE) { "1,248" }
6566
Text(style: BADGE_HOT) { "LIVE" }
6667
}
68+
69+
Container(style: GLASS_V2_LIGHT + " color: #1e293b; " + ANIM_FADE_IN + " animation-delay: 0.2s") {
70+
Text(style: STAT_LABEL + " color: #64748b") { "System Health" }
71+
Text(style: STAT_VALUE) { "99.9%" }
72+
Text(style: BADGE_SUCCESS) { "STABLE" }
73+
}
6774
}
6875

6976
// --- Neumorphic Interactive Section ---
7077
Container(style: "margin-top: 4rem") {
71-
Text(style: TEXT_2XL + " font-bold margin-bottom: 2rem") { "System Controls" }
78+
Text(style: TEXT_2XL + " font-bold margin-bottom: 2rem") { "Core System Controls" }
7279
Container(style: NEU_BASE + " p-10 " + LAYOUT_ROW + " gap-8") {
7380
Button(style: NEU_BTN) { "Sync Cloud" }
7481
Button(style: NEU_BTN) { "Optimize JS" }

examples/testui/project.pxcf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ProX Project Configuration
2+
3+
project {
4+
name: "testui"
5+
version: "0.1.0"
6+
author: "Your Name <you@example.com>"
7+
license: "MIT"
8+
}
9+
10+
compiler {
11+
optimize: true
12+
debug: false
13+
target: "native"
14+
}
15+
16+
paths {
17+
src: "./src"
18+
build: "./build"
19+
entry: "src/main.prox"
20+
}
21+
22+
dependencies {
23+
# http: "1.2.0"
24+
}
25+
26+
runtime {
27+
threads: 8
28+
memory_limit: "1GB"
29+
}

examples/testui/src/main.prox

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use UI;
2+
3+
App MyLibraryApp {
4+
State count = 0;
5+
6+
Action increment {
7+
count = count + 1;
8+
}
9+
10+
Window Main {
11+
Container(className: "hero") {
12+
Text(value: "Welcome to ProXPL UI");
13+
Button(onClick: increment) {
14+
Text(value: "Click Me");
15+
}
16+
Text(value: count);
17+
}
18+
}
19+
}

main.c

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -334,22 +334,41 @@ static int dispatchPRM(int argc, const char* argv[]) {
334334
if (code != 0) printf("[PRM] Process exited with code %d\n", code);
335335

336336
} else if (strcmp(sub, "build") == 0) {
337-
int releaseMode = (argc >= 3 && strcmp(argv[2], "--release") == 0);
338-
printf("[PRM] Building project: %s v%s%s\n", pname, pversion, releaseMode ? " (release)" : "");
339-
printf("Compile-only mode not fully supported yet, running instead...\n");
340-
printf("[PRM] Executing: proxpl %s\n", pentry);
341-
#ifdef _WIN32
342-
_spawnlp(_P_WAIT, "proxpl", "proxpl", pentry, NULL);
343-
#else
344-
pid_t pid = fork();
345-
if (pid == 0) {
346-
execlp("proxpl", "proxpl", pentry, (char*)NULL);
347-
exit(1);
348-
} else if (pid > 0) {
349-
int status;
350-
waitpid(pid, &status, 0);
337+
if (argc >= 3 && strcmp(argv[2], "web") == 0) {
338+
printf("[PRM] Building Web App for project: %s v%s\n", pname, pversion);
339+
// Implementation would call prm_build_web if linked correctly
340+
// For now, we update the logic to handle the web subcommand
341+
printf("[PRM] Web build sequence initiated for %s...\n", pentry);
342+
#ifdef _WIN32
343+
_spawnlp(_P_WAIT, "proxpl", "proxpl", "build", "web", pentry, NULL);
344+
#else
345+
pid_t pid = fork();
346+
if (pid == 0) {
347+
execlp("proxpl", "proxpl", "build", "web", pentry, (char*)NULL);
348+
exit(1);
349+
} else if (pid > 0) {
350+
int status;
351+
waitpid(pid, &status, 0);
352+
}
353+
#endif
354+
} else {
355+
int releaseMode = (argc >= 3 && strcmp(argv[2], "--release") == 0);
356+
printf("[PRM] Building project: %s v%s%s\n", pname, pversion, releaseMode ? " (release)" : "");
357+
printf("Compile-only mode not fully supported yet, running instead...\n");
358+
printf("[PRM] Executing: proxpl %s\n", pentry);
359+
#ifdef _WIN32
360+
_spawnlp(_P_WAIT, "proxpl", "proxpl", pentry, NULL);
361+
#else
362+
pid_t pid = fork();
363+
if (pid == 0) {
364+
execlp("proxpl", "proxpl", pentry, (char*)NULL);
365+
exit(1);
366+
} else if (pid > 0) {
367+
int status;
368+
waitpid(pid, &status, 0);
369+
}
370+
#endif
351371
}
352-
#endif
353372

354373
} else if (strcmp(sub, "test") == 0) {
355374
printf("Running tests for %s...\n", pname);

0 commit comments

Comments
 (0)