@harperfast/template-vanilla-studio 1.4.2 → 1.4.4
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.
- package/eslint.config.js +23 -0
- package/package.json +6 -2
- package/test/counter.test.js +15 -0
- package/web/counter.js +7 -0
- package/web/index.html +1 -1
- package/web/index.js +4 -2
- package/web/styles.css +31 -31
package/eslint.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
js.configs.recommended,
|
|
6
|
+
{
|
|
7
|
+
languageOptions: {
|
|
8
|
+
globals: {
|
|
9
|
+
...globals.browser,
|
|
10
|
+
...globals.node,
|
|
11
|
+
},
|
|
12
|
+
ecmaVersion: 'latest',
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
'no-unused-vars': 'warn',
|
|
17
|
+
'no-console': 'off',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
ignores: ['node_modules/'],
|
|
22
|
+
},
|
|
23
|
+
];
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harperfast/template-vanilla-studio",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": "github:HarperFast/create-harper",
|
|
6
6
|
"scripts": {},
|
|
7
7
|
"devDependencies": {
|
|
8
|
+
"@eslint/js": "^10.0.1",
|
|
8
9
|
"dotenv-cli": "^11.0.0",
|
|
9
|
-
"
|
|
10
|
+
"eslint": "^10.0.2",
|
|
11
|
+
"globals": "^17.4.0",
|
|
12
|
+
"harperdb": "^4.7.20",
|
|
13
|
+
"prettier": "^3.8.1"
|
|
10
14
|
}
|
|
11
15
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { test } from 'node:test';
|
|
3
|
+
import { decrement, increment } from '../web/counter.js';
|
|
4
|
+
|
|
5
|
+
test('increment function', () => {
|
|
6
|
+
assert.strictEqual(increment(0), 1);
|
|
7
|
+
assert.strictEqual(increment(1), 2);
|
|
8
|
+
assert.strictEqual(increment(-1), 0);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('decrement function', () => {
|
|
12
|
+
assert.strictEqual(decrement(0), -1);
|
|
13
|
+
assert.strictEqual(decrement(1), 0);
|
|
14
|
+
assert.strictEqual(decrement(-1), -2);
|
|
15
|
+
});
|
package/web/counter.js
ADDED
package/web/index.html
CHANGED
package/web/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { decrement, increment } from './counter.js';
|
|
2
|
+
|
|
1
3
|
let count = 0;
|
|
2
4
|
const counterDisplay = document.getElementById('count');
|
|
3
5
|
const decrementButton = document.getElementById('decrement');
|
|
@@ -8,11 +10,11 @@ function updateDisplay() {
|
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
decrementButton.addEventListener('click', () => {
|
|
11
|
-
count
|
|
13
|
+
count = decrement(count);
|
|
12
14
|
updateDisplay();
|
|
13
15
|
});
|
|
14
16
|
|
|
15
17
|
incrementButton.addEventListener('click', () => {
|
|
16
|
-
count
|
|
18
|
+
count = increment(count);
|
|
17
19
|
updateDisplay();
|
|
18
20
|
});
|
package/web/styles.css
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
body {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
font-family: Arial, sans-serif;
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 100vh;
|
|
7
|
+
margin: 0;
|
|
8
|
+
background-color: #f5f5f5;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
main {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
text-align: center;
|
|
13
|
+
background-color: white;
|
|
14
|
+
padding: 2rem;
|
|
15
|
+
border-radius: 8px;
|
|
16
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.count {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
font-size: 4rem;
|
|
21
|
+
margin: 1rem 0;
|
|
22
|
+
color: #333;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.counter-controls {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
gap: 1rem;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
button {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
font-size: 1.5rem;
|
|
33
|
+
width: 3rem;
|
|
34
|
+
height: 3rem;
|
|
35
|
+
border: none;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transition: background-color 0.2s;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.decrement {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
background-color: #ff6b6b;
|
|
43
|
+
color: white;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.decrement:hover {
|
|
47
|
-
|
|
47
|
+
background-color: #ff5252;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.increment {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
background-color: #4ecdc4;
|
|
52
|
+
color: white;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.increment:hover {
|
|
56
|
-
|
|
56
|
+
background-color: #39b2a9;
|
|
57
57
|
}
|