jac-client 0.2.0__py3-none-any.whl → 0.2.1__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.
- jac_client/docs/README.md +31 -1
- jac_client/docs/asset-serving/intro.md +209 -0
- jac_client/docs/assets/pipe_line-v2.svg +32 -0
- jac_client/docs/file-system/intro.md +90 -0
- jac_client/docs/styling/intro.md +250 -0
- jac_client/docs/styling/js-styling.md +373 -0
- jac_client/docs/styling/material-ui.md +346 -0
- jac_client/docs/styling/pure-css.md +305 -0
- jac_client/docs/styling/sass.md +409 -0
- jac_client/docs/styling/styled-components.md +401 -0
- jac_client/docs/styling/tailwind.md +303 -0
- jac_client/examples/asset-serving/css-with-image/.babelrc +9 -0
- jac_client/examples/asset-serving/css-with-image/README.md +91 -0
- jac_client/examples/asset-serving/css-with-image/app.jac +67 -0
- jac_client/examples/asset-serving/css-with-image/assets/burger.png +0 -0
- jac_client/examples/asset-serving/css-with-image/package.json +28 -0
- jac_client/examples/asset-serving/css-with-image/styles.css +27 -0
- jac_client/examples/asset-serving/css-with-image/vite.config.js +29 -0
- jac_client/examples/asset-serving/image-asset/.babelrc +9 -0
- jac_client/examples/asset-serving/image-asset/README.md +119 -0
- jac_client/examples/asset-serving/image-asset/app.jac +43 -0
- jac_client/examples/asset-serving/image-asset/assets/burger.png +0 -0
- jac_client/examples/asset-serving/image-asset/package.json +28 -0
- jac_client/examples/asset-serving/image-asset/styles.css +27 -0
- jac_client/examples/asset-serving/image-asset/vite.config.js +29 -0
- jac_client/examples/asset-serving/import-alias/.babelrc +9 -0
- jac_client/examples/asset-serving/import-alias/README.md +83 -0
- jac_client/examples/asset-serving/import-alias/app.jac +57 -0
- jac_client/examples/asset-serving/import-alias/assets/burger.png +0 -0
- jac_client/examples/asset-serving/import-alias/package.json +28 -0
- jac_client/examples/asset-serving/import-alias/vite.config.js +29 -0
- jac_client/examples/css-styling/js-styling/.babelrc +9 -0
- jac_client/examples/css-styling/js-styling/README.md +183 -0
- jac_client/examples/css-styling/js-styling/app.jac +63 -0
- jac_client/examples/css-styling/js-styling/package.json +28 -0
- jac_client/examples/css-styling/js-styling/styles.js +100 -0
- jac_client/examples/css-styling/js-styling/vite.config.js +28 -0
- jac_client/examples/css-styling/material-ui/.babelrc +9 -0
- jac_client/examples/css-styling/material-ui/README.md +16 -0
- jac_client/examples/css-styling/material-ui/app.jac +82 -0
- jac_client/examples/css-styling/material-ui/package.json +32 -0
- jac_client/examples/css-styling/material-ui/vite.config.js +28 -0
- jac_client/examples/css-styling/pure-css/.babelrc +9 -0
- jac_client/examples/css-styling/pure-css/README.md +16 -0
- jac_client/examples/css-styling/pure-css/app.jac +63 -0
- jac_client/examples/css-styling/pure-css/package.json +28 -0
- jac_client/examples/css-styling/pure-css/styles.css +112 -0
- jac_client/examples/css-styling/pure-css/vite.config.js +28 -0
- jac_client/examples/css-styling/sass-example/.babelrc +9 -0
- jac_client/examples/css-styling/sass-example/README.md +16 -0
- jac_client/examples/css-styling/sass-example/app.jac +63 -0
- jac_client/examples/css-styling/sass-example/package.json +29 -0
- jac_client/examples/css-styling/sass-example/styles.scss +158 -0
- jac_client/examples/css-styling/sass-example/vite.config.js +28 -0
- jac_client/examples/css-styling/styled-components/.babelrc +9 -0
- jac_client/examples/css-styling/styled-components/README.md +16 -0
- jac_client/examples/css-styling/styled-components/app.jac +66 -0
- jac_client/examples/css-styling/styled-components/package.json +29 -0
- jac_client/examples/css-styling/styled-components/styled.js +91 -0
- jac_client/examples/css-styling/styled-components/vite.config.js +28 -0
- jac_client/examples/css-styling/tailwind-example/.babelrc +9 -0
- jac_client/examples/css-styling/tailwind-example/README.md +16 -0
- jac_client/examples/css-styling/tailwind-example/app.jac +64 -0
- jac_client/examples/css-styling/tailwind-example/global.css +1 -0
- jac_client/examples/css-styling/tailwind-example/package.json +30 -0
- jac_client/examples/css-styling/tailwind-example/vite.config.js +30 -0
- jac_client/examples/with-router/app.jac +1 -1
- jac_client/plugin/cli.py +5 -0
- jac_client/plugin/client.py +64 -3
- jac_client/plugin/vite_client_bundle.py +96 -1
- jac_client/tests/__init__.py +0 -1
- jac_client/tests/fixtures/cl_file/app.cl.jac +38 -0
- jac_client/tests/fixtures/cl_file/app.jac +15 -0
- jac_client/tests/fixtures/js_import/app.jac +1 -1
- jac_client/tests/fixtures/relative_import/button.jac +2 -2
- jac_client/tests/fixtures/test_fragments_spread/app.jac +2 -2
- jac_client/tests/test_asset_examples.py +339 -0
- jac_client/tests/test_cl.py +165 -87
- jac_client/tests/test_create_jac_app.py +40 -44
- {jac_client-0.2.0.dist-info → jac_client-0.2.1.dist-info}/METADATA +2 -2
- jac_client-0.2.1.dist-info/RECORD +140 -0
- jac_client-0.2.0.dist-info/RECORD +0 -72
- {jac_client-0.2.0.dist-info → jac_client-0.2.1.dist-info}/WHEEL +0 -0
- {jac_client-0.2.0.dist-info → jac_client-0.2.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Pages
|
|
2
|
+
cl import from react {useState, useEffect}
|
|
3
|
+
cl import ".styles.css";
|
|
4
|
+
|
|
5
|
+
cl {
|
|
6
|
+
def app() -> any {
|
|
7
|
+
let [count, setCount] = useState(0);
|
|
8
|
+
|
|
9
|
+
useEffect(lambda -> None {
|
|
10
|
+
console.log("Count changed: ", count);
|
|
11
|
+
}, [count]);
|
|
12
|
+
|
|
13
|
+
let handleIncrement = lambda e: any -> None {
|
|
14
|
+
setCount(count + 1);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let handleDecrement = lambda e: any -> None {
|
|
18
|
+
setCount(count - 1);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let handleReset = lambda e: any -> None {
|
|
22
|
+
setCount(0);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let countClass = "countDisplay " + ("positive" if count > 0 else "negative" if count < 0 else "zero");
|
|
26
|
+
|
|
27
|
+
return <div className="container">
|
|
28
|
+
<div className="card">
|
|
29
|
+
<h1 className="title">Counter Application</h1>
|
|
30
|
+
<div className="divider"></div>
|
|
31
|
+
|
|
32
|
+
<div className="counterSection">
|
|
33
|
+
<div className="label">Current Count</div>
|
|
34
|
+
<div className={countClass}>{count}</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div className="divider"></div>
|
|
38
|
+
|
|
39
|
+
<div className="buttonGroup">
|
|
40
|
+
<button
|
|
41
|
+
className="btn btnDecrement"
|
|
42
|
+
onClick={handleDecrement}>
|
|
43
|
+
-
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
className="btn btnReset"
|
|
47
|
+
onClick={handleReset}>
|
|
48
|
+
↻
|
|
49
|
+
</button>
|
|
50
|
+
<button
|
|
51
|
+
className="btn btnIncrement"
|
|
52
|
+
onClick={handleIncrement}>
|
|
53
|
+
+
|
|
54
|
+
</button>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className="hint">
|
|
58
|
+
Click the buttons to increment, decrement, or reset the counter
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-test-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run compile && vite build",
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"compile": "babel src --out-dir build --extensions \".jsx,.js\" --out-file-extension .js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "Jac application: my-test-app",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vite": "^6.4.1",
|
|
18
|
+
"@babel/cli": "^7.28.3",
|
|
19
|
+
"@babel/core": "^7.28.5",
|
|
20
|
+
"@babel/preset-env": "^7.28.5",
|
|
21
|
+
"@babel/preset-react": "^7.28.5"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"react": "^19.2.0",
|
|
25
|
+
"react-dom": "^19.2.0",
|
|
26
|
+
"react-router-dom": "^6.30.1"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
min-height: 100vh;
|
|
6
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
7
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.card {
|
|
11
|
+
background: white;
|
|
12
|
+
border-radius: 20px;
|
|
13
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
14
|
+
padding: 40px;
|
|
15
|
+
min-width: 400px;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.title {
|
|
20
|
+
font-size: 2rem;
|
|
21
|
+
color: #667eea;
|
|
22
|
+
margin: 0 0 10px 0;
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.divider {
|
|
27
|
+
height: 2px;
|
|
28
|
+
background: linear-gradient(90deg, transparent, #667eea, transparent);
|
|
29
|
+
margin: 20px 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.counterSection {
|
|
33
|
+
padding: 30px 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.label {
|
|
37
|
+
font-size: 1.2rem;
|
|
38
|
+
color: #666;
|
|
39
|
+
margin-bottom: 10px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.countDisplay {
|
|
43
|
+
font-size: 5rem;
|
|
44
|
+
font-weight: bold;
|
|
45
|
+
margin: 20px 0;
|
|
46
|
+
transition: color 0.3s ease;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.positive {
|
|
50
|
+
color: #4caf50;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.negative {
|
|
54
|
+
color: #f44336;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.zero {
|
|
58
|
+
color: #333;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.buttonGroup {
|
|
62
|
+
display: flex;
|
|
63
|
+
justify-content: space-around;
|
|
64
|
+
gap: 15px;
|
|
65
|
+
margin-top: 30px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.btn {
|
|
69
|
+
border: none;
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
width: 70px;
|
|
72
|
+
height: 70px;
|
|
73
|
+
font-size: 1.5rem;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
transition: all 0.3s ease;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
font-weight: bold;
|
|
80
|
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.btn:hover {
|
|
84
|
+
transform: translateY(-3px);
|
|
85
|
+
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.btn:active {
|
|
89
|
+
transform: translateY(0);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.btnDecrement {
|
|
93
|
+
background: linear-gradient(135deg, #f44336, #e91e63);
|
|
94
|
+
color: white;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.btnReset {
|
|
98
|
+
background: linear-gradient(135deg, #2196f3, #00bcd4);
|
|
99
|
+
color: white;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.btnIncrement {
|
|
103
|
+
background: linear-gradient(135deg, #4caf50, #8bc34a);
|
|
104
|
+
color: white;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.hint {
|
|
108
|
+
margin-top: 20px;
|
|
109
|
+
font-size: 0.9rem;
|
|
110
|
+
color: #999;
|
|
111
|
+
}
|
|
112
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
root: ".", // base folder
|
|
10
|
+
build: {
|
|
11
|
+
rollupOptions: {
|
|
12
|
+
input: "build/main.js", // your compiled entry file
|
|
13
|
+
output: {
|
|
14
|
+
entryFileNames: "client.[hash].js", // name of the final js file
|
|
15
|
+
assetFileNames: "[name].[ext]",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
outDir: "dist", // final bundled output
|
|
19
|
+
emptyOutDir: true,
|
|
20
|
+
},
|
|
21
|
+
publicDir: false,
|
|
22
|
+
resolve: {
|
|
23
|
+
alias: {
|
|
24
|
+
"@jac-client/utils": path.resolve(__dirname, "src/client_runtime.js"),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Pages
|
|
2
|
+
cl import from react {useState, useEffect}
|
|
3
|
+
cl import ".styles.scss";
|
|
4
|
+
|
|
5
|
+
cl {
|
|
6
|
+
def app() -> any {
|
|
7
|
+
let [count, setCount] = useState(0);
|
|
8
|
+
|
|
9
|
+
useEffect(lambda -> None {
|
|
10
|
+
console.log("Count changed: ", count);
|
|
11
|
+
}, [count]);
|
|
12
|
+
|
|
13
|
+
let handleIncrement = lambda e: any -> None {
|
|
14
|
+
setCount(count + 1);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let handleDecrement = lambda e: any -> None {
|
|
18
|
+
setCount(count - 1);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
let handleReset = lambda e: any -> None {
|
|
22
|
+
setCount(0);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let countClass = "countDisplay " + ("positive" if count > 0 else "negative" if count < 0 else "zero");
|
|
26
|
+
|
|
27
|
+
return <div className="container">
|
|
28
|
+
<div className="card">
|
|
29
|
+
<h1 className="title">Counter Application</h1>
|
|
30
|
+
<div className="divider"></div>
|
|
31
|
+
|
|
32
|
+
<div className="counterSection">
|
|
33
|
+
<div className="label">Current Count</div>
|
|
34
|
+
<div className={countClass}>{count}</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div className="divider"></div>
|
|
38
|
+
|
|
39
|
+
<div className="buttonGroup">
|
|
40
|
+
<button
|
|
41
|
+
className="btn btnDecrement"
|
|
42
|
+
onClick={handleDecrement}>
|
|
43
|
+
-
|
|
44
|
+
</button>
|
|
45
|
+
<button
|
|
46
|
+
className="btn btnReset"
|
|
47
|
+
onClick={handleReset}>
|
|
48
|
+
↻
|
|
49
|
+
</button>
|
|
50
|
+
<button
|
|
51
|
+
className="btn btnIncrement"
|
|
52
|
+
onClick={handleIncrement}>
|
|
53
|
+
+
|
|
54
|
+
</button>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div className="hint">
|
|
58
|
+
Click the buttons to increment, decrement, or reset the counter
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sass-example",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run compile && vite build",
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"compile": "babel src --out-dir build --extensions \".jsx,.js\" --out-file-extension .js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "Jac application: sass-example",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vite": "^6.4.1",
|
|
18
|
+
"@babel/cli": "^7.28.3",
|
|
19
|
+
"@babel/core": "^7.28.5",
|
|
20
|
+
"@babel/preset-env": "^7.28.5",
|
|
21
|
+
"@babel/preset-react": "^7.28.5",
|
|
22
|
+
"sass": "^1.77.8"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0",
|
|
27
|
+
"react-router-dom": "^6.30.1"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Sass Variables
|
|
2
|
+
$primary-gradient-start: #dbeafe;
|
|
3
|
+
$primary-gradient-end: #e0e7ff;
|
|
4
|
+
$white: #ffffff;
|
|
5
|
+
$gray-800: #1f2937;
|
|
6
|
+
$gray-600: #4b5563;
|
|
7
|
+
$gray-500: #6b7280;
|
|
8
|
+
$green-600: #16a34a;
|
|
9
|
+
$red-500: #ef4444;
|
|
10
|
+
$red-600: #dc2626;
|
|
11
|
+
|
|
12
|
+
// Mixins
|
|
13
|
+
@mixin flex-center {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@mixin button-base {
|
|
20
|
+
color: $white;
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
padding: 0.75rem 1.5rem;
|
|
23
|
+
border-radius: 0.5rem;
|
|
24
|
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
|
|
25
|
+
transition: all 0.2s ease;
|
|
26
|
+
font-size: 1.25rem;
|
|
27
|
+
border: none;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
transform: scale(1.05);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:active {
|
|
35
|
+
transform: scale(0.95);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@mixin gradient-divider {
|
|
40
|
+
height: 1px;
|
|
41
|
+
background: linear-gradient(to right, transparent, $gray-500, transparent);
|
|
42
|
+
margin-bottom: 1.5rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Container
|
|
46
|
+
.container {
|
|
47
|
+
min-height: 100vh;
|
|
48
|
+
background: linear-gradient(to bottom right, $primary-gradient-start, $primary-gradient-end);
|
|
49
|
+
@include flex-center;
|
|
50
|
+
padding: 1rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Card
|
|
54
|
+
.card {
|
|
55
|
+
background-color: $white;
|
|
56
|
+
border-radius: 1rem;
|
|
57
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
58
|
+
padding: 2rem;
|
|
59
|
+
max-width: 28rem;
|
|
60
|
+
width: 100%;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Title
|
|
64
|
+
.title {
|
|
65
|
+
font-size: 1.875rem;
|
|
66
|
+
font-weight: bold;
|
|
67
|
+
color: $gray-800;
|
|
68
|
+
text-align: center;
|
|
69
|
+
margin-bottom: 1.5rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Divider
|
|
73
|
+
.divider {
|
|
74
|
+
@include gradient-divider;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Counter Section
|
|
78
|
+
.counterSection {
|
|
79
|
+
text-align: center;
|
|
80
|
+
margin-bottom: 2rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.label {
|
|
84
|
+
font-size: 0.875rem;
|
|
85
|
+
font-weight: 600;
|
|
86
|
+
color: $gray-600;
|
|
87
|
+
margin-bottom: 0.5rem;
|
|
88
|
+
text-transform: uppercase;
|
|
89
|
+
letter-spacing: 0.05em;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Count Display with dynamic colors
|
|
93
|
+
.countDisplay {
|
|
94
|
+
font-size: 3.75rem;
|
|
95
|
+
font-weight: bold;
|
|
96
|
+
transition: color 0.3s ease;
|
|
97
|
+
|
|
98
|
+
&.zero {
|
|
99
|
+
color: $gray-800;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.positive {
|
|
103
|
+
color: $green-600;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.negative {
|
|
107
|
+
color: $red-600;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Button Group
|
|
112
|
+
.buttonGroup {
|
|
113
|
+
@include flex-center;
|
|
114
|
+
gap: 1rem;
|
|
115
|
+
margin-bottom: 1.5rem;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Buttons
|
|
119
|
+
.btn {
|
|
120
|
+
@include button-base;
|
|
121
|
+
|
|
122
|
+
&Decrement {
|
|
123
|
+
background-color: $red-500;
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
background-color: darken($red-500, 10%);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&Reset {
|
|
131
|
+
background-color: $gray-500;
|
|
132
|
+
|
|
133
|
+
&:hover {
|
|
134
|
+
background-color: darken($gray-500, 10%);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&Increment {
|
|
139
|
+
background-color: $green-600;
|
|
140
|
+
|
|
141
|
+
&:hover {
|
|
142
|
+
background-color: darken($green-600, 10%);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Hint
|
|
148
|
+
.hint {
|
|
149
|
+
text-align: center;
|
|
150
|
+
font-size: 0.875rem;
|
|
151
|
+
color: $gray-500;
|
|
152
|
+
font-style: italic;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
root: ".", // base folder
|
|
10
|
+
build: {
|
|
11
|
+
rollupOptions: {
|
|
12
|
+
input: "build/main.js", // your compiled entry file
|
|
13
|
+
output: {
|
|
14
|
+
entryFileNames: "client.[hash].js", // name of the final js file
|
|
15
|
+
assetFileNames: "[name].[ext]",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
outDir: "dist", // final bundled output
|
|
19
|
+
emptyOutDir: true,
|
|
20
|
+
},
|
|
21
|
+
publicDir: false,
|
|
22
|
+
resolve: {
|
|
23
|
+
alias: {
|
|
24
|
+
"@jac-client/utils": path.resolve(__dirname, "src/client_runtime.js"),
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Pages
|
|
2
|
+
cl import from react {useState, useEffect}
|
|
3
|
+
cl import from .styled {
|
|
4
|
+
Container,
|
|
5
|
+
Card,
|
|
6
|
+
Title,
|
|
7
|
+
Divider,
|
|
8
|
+
CounterSection,
|
|
9
|
+
Label,
|
|
10
|
+
CountDisplay,
|
|
11
|
+
ButtonGroup,
|
|
12
|
+
Button,
|
|
13
|
+
Hint
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
cl {
|
|
17
|
+
def app() -> any {
|
|
18
|
+
let [count, setCount] = useState(0);
|
|
19
|
+
|
|
20
|
+
useEffect(lambda -> None {
|
|
21
|
+
console.log("Count changed: ", count);
|
|
22
|
+
}, [count]);
|
|
23
|
+
|
|
24
|
+
let handleIncrement = lambda e: any -> None {
|
|
25
|
+
setCount(count + 1);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
let handleDecrement = lambda e: any -> None {
|
|
29
|
+
setCount(count - 1);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
let handleReset = lambda e: any -> None {
|
|
33
|
+
setCount(0);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return <Container>
|
|
37
|
+
<Card>
|
|
38
|
+
<Title>Counter Application</Title>
|
|
39
|
+
<Divider></Divider>
|
|
40
|
+
|
|
41
|
+
<CounterSection>
|
|
42
|
+
<Label>Current Count</Label>
|
|
43
|
+
<CountDisplay count={count}>{count}</CountDisplay>
|
|
44
|
+
</CounterSection>
|
|
45
|
+
|
|
46
|
+
<Divider></Divider>
|
|
47
|
+
|
|
48
|
+
<ButtonGroup>
|
|
49
|
+
<Button bgColor="#ef4444" onClick={handleDecrement}>
|
|
50
|
+
-
|
|
51
|
+
</Button>
|
|
52
|
+
<Button bgColor="#6b7280" onClick={handleReset}>
|
|
53
|
+
↻
|
|
54
|
+
</Button>
|
|
55
|
+
<Button bgColor="#22c55e" onClick={handleIncrement}>
|
|
56
|
+
+
|
|
57
|
+
</Button>
|
|
58
|
+
</ButtonGroup>
|
|
59
|
+
|
|
60
|
+
<Hint>
|
|
61
|
+
Click the buttons to increment, decrement, or reset the counter
|
|
62
|
+
</Hint>
|
|
63
|
+
</Card>
|
|
64
|
+
</Container>;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "styled-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run compile && vite build",
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"compile": "babel src --out-dir build --extensions \".jsx,.js\" --out-file-extension .js"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"description": "Jac application: styled-components",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vite": "^6.4.1",
|
|
18
|
+
"@babel/cli": "^7.28.3",
|
|
19
|
+
"@babel/core": "^7.28.5",
|
|
20
|
+
"@babel/preset-env": "^7.28.5",
|
|
21
|
+
"@babel/preset-react": "^7.28.5"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"react": "^19.2.0",
|
|
25
|
+
"react-dom": "^19.2.0",
|
|
26
|
+
"react-router-dom": "^6.30.1",
|
|
27
|
+
"styled-components": "^6.1.13"
|
|
28
|
+
}
|
|
29
|
+
}
|