@harperfast/template-vanilla-studio 1.4.3 → 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.
@@ -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",
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
- "harperdb": "^4.7.15"
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
@@ -0,0 +1,7 @@
1
+ export function increment(value) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value) {
6
+ return value - 1;
7
+ }
package/web/index.html CHANGED
@@ -23,6 +23,6 @@
23
23
  </div>
24
24
  </main>
25
25
 
26
- <script src="index.js"></script>
26
+ <script type="module" src="index.js"></script>
27
27
  </body>
28
28
  </html>
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
- 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;
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
- 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);
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
- font-size: 4rem;
21
- margin: 1rem 0;
22
- color: #333;
20
+ font-size: 4rem;
21
+ margin: 1rem 0;
22
+ color: #333;
23
23
  }
24
24
 
25
25
  .counter-controls {
26
- display: flex;
27
- justify-content: center;
28
- gap: 1rem;
26
+ display: flex;
27
+ justify-content: center;
28
+ gap: 1rem;
29
29
  }
30
30
 
31
31
  button {
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;
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
- background-color: #ff6b6b;
43
- color: white;
42
+ background-color: #ff6b6b;
43
+ color: white;
44
44
  }
45
45
 
46
46
  .decrement:hover {
47
- background-color: #ff5252;
47
+ background-color: #ff5252;
48
48
  }
49
49
 
50
50
  .increment {
51
- background-color: #4ecdc4;
52
- color: white;
51
+ background-color: #4ecdc4;
52
+ color: white;
53
53
  }
54
54
 
55
55
  .increment:hover {
56
- background-color: #39b2a9;
56
+ background-color: #39b2a9;
57
57
  }