create-mettle-app 1.9.2 → 1.9.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mettle-app",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "license": "MIT",
5
5
  "author": "maomincoding",
6
6
  "bin": {
@@ -9,10 +9,9 @@
9
9
  },
10
10
  "devDependencies": {
11
11
  "vite": "^6.1.0",
12
- "vite-plugin-mettle": "^1.8.0",
13
- "mettle-jsx-runtime": "^1.2.0"
12
+ "vite-plugin-mettle": "^1.8.1"
14
13
  },
15
14
  "dependencies": {
16
- "mettle": "^1.7.6"
15
+ "mettle": "^1.8.3"
17
16
  }
18
17
  }
@@ -1,6 +1,5 @@
1
1
  import { createApp } from 'mettle';
2
- import Home from './template/home';
3
- import List from './components/list';
2
+ import Home from './views/home';
4
3
  import './style/app.css';
5
4
 
6
5
  function App() {
@@ -9,7 +8,6 @@ function App() {
9
8
  <h1>Hello mettle.js</h1>
10
9
  <div class='app-tool'>
11
10
  <Home />
12
- <List />
13
11
  </div>
14
12
  </div>
15
13
  );
@@ -9,11 +9,10 @@
9
9
  },
10
10
  "devDependencies": {
11
11
  "vite": "^6.1.0",
12
- "vite-plugin-mettle": "^1.8.0",
13
- "mettle-jsx-runtime": "^1.2.0"
12
+ "vite-plugin-mettle": "^1.8.1"
14
13
  },
15
14
  "dependencies": {
16
- "mettle": "^1.7.6",
15
+ "mettle": "^1.8.3",
17
16
  "mettle-router": "^0.6.2"
18
17
  }
19
18
  }
@@ -1,9 +1,8 @@
1
- import { signal, produce, batch, computed } from 'mettle';
1
+ import { signal, batch } from 'mettle';
2
2
  import { linkTo } from 'mettle-router';
3
3
 
4
4
  export default function Home() {
5
5
  const msg = signal('hello');
6
- const arr = signal([1, 2]);
7
6
  const count = signal(3);
8
7
 
9
8
  function goAbout() {
@@ -20,20 +19,14 @@ export default function Home() {
20
19
  batch(() => {
21
20
  msg.value = 'world';
22
21
  count.value++;
23
- arr.value = produce(arr.value, (draft) => {
24
- draft.unshift(count.value);
25
- });
26
22
  });
27
23
  }
28
24
 
29
- const list = computed(() => arr.value.map((item) => <li key={item}>{item}</li>));
30
-
31
25
  return (
32
26
  <>
33
27
  <button onClick={goAbout}>goAbout</button>
34
28
  <h1>Home</h1>
35
29
  <p onClick={useChange}>{msg.value}</p>
36
- <ul>{list.value}</ul>
37
30
  </>
38
31
  );
39
32
  }
@@ -10,11 +10,10 @@
10
10
  "devDependencies": {
11
11
  "typescript": "~5.7.2",
12
12
  "vite": "^6.1.0",
13
- "vite-plugin-mettle": "^1.8.0",
14
- "mettle-jsx-runtime": "^1.2.0"
13
+ "vite-plugin-mettle": "^1.8.1"
15
14
  },
16
15
  "dependencies": {
17
- "mettle": "^1.7.6",
16
+ "mettle": "^1.8.3",
18
17
  "mettle-router": "^0.6.2"
19
18
  }
20
19
  }
@@ -1,8 +1,8 @@
1
1
  import { resetView } from 'mettle';
2
2
  import { initRouter } from 'mettle-router';
3
3
 
4
- import Home from '../template/home';
5
- import About from '../template/about';
4
+ import Home from '../views/home';
5
+ import About from '../views/about';
6
6
 
7
7
  const router = initRouter(
8
8
  [
@@ -15,7 +15,7 @@ const router = initRouter(
15
15
  template: About,
16
16
  },
17
17
  ],
18
- resetView
18
+ resetView,
19
19
  );
20
20
 
21
21
  export default router;
@@ -1,9 +1,8 @@
1
- import { signal, produce, batch, computed } from 'mettle';
1
+ import { signal, batch } from 'mettle';
2
2
  import { linkTo } from 'mettle-router';
3
3
 
4
4
  export default function Home() {
5
5
  const msg = signal('hello');
6
- const arr = signal([1, 2]);
7
6
  const count = signal(3);
8
7
 
9
8
  function goAbout() {
@@ -20,20 +19,14 @@ export default function Home() {
20
19
  batch(() => {
21
20
  msg.value = 'world';
22
21
  count.value++;
23
- arr.value = produce(arr.value, (draft: any) => {
24
- draft.unshift(count.value);
25
- });
26
22
  });
27
23
  }
28
24
 
29
- const list = computed(() => arr.value.map((item: any) => <li key={item}>{item}</li>));
30
-
31
25
  return (
32
26
  <>
33
27
  <button onClick={goAbout}>goAbout</button>
34
28
  <h1>Home</h1>
35
29
  <p onClick={useChange}>{msg.value}</p>
36
- <ul>{list.value}</ul>
37
30
  </>
38
31
  );
39
32
  }
@@ -10,10 +10,9 @@
10
10
  "devDependencies": {
11
11
  "typescript": "~5.7.2",
12
12
  "vite": "^6.1.0",
13
- "vite-plugin-mettle": "^1.8.0",
14
- "mettle-jsx-runtime": "^1.2.0"
13
+ "vite-plugin-mettle": "^1.8.1"
15
14
  },
16
15
  "dependencies": {
17
- "mettle": "^1.7.6"
16
+ "mettle": "^1.8.3"
18
17
  }
19
18
  }
@@ -1,6 +1,5 @@
1
1
  import { createApp } from 'mettle';
2
- import Home from './template/home';
3
- import List from './components/list';
2
+ import Home from './views/home';
4
3
  import './style/app.css';
5
4
 
6
5
  function App() {
@@ -9,7 +8,6 @@ function App() {
9
8
  <h1>Hello mettle.js</h1>
10
9
  <div class='app-tool'>
11
10
  <Home />
12
- <List />
13
11
  </div>
14
12
  </div>
15
13
  );
@@ -1,40 +0,0 @@
1
- import { signal, produce } from 'mettle';
2
- import style from '../style/list.module.css';
3
-
4
- export default function List() {
5
- const arr = signal([1, 2]);
6
- const count = signal(3);
7
-
8
- function usePush() {
9
- arr.value = produce(arr.value, (draft) => {
10
- draft.push(count.value++);
11
- });
12
- }
13
-
14
- function useUnshift() {
15
- arr.value = produce(arr.value, (draft) => {
16
- draft.unshift(count.value++);
17
- });
18
- }
19
-
20
- function useDel() {
21
- arr.value = produce(arr.value, (draft) => {
22
- draft.splice(1, 1);
23
- });
24
- }
25
-
26
- return (
27
- <>
28
- <div class={style.listInner}>
29
- <button onClick={useUnshift}>Unshift</button>
30
- <button onClick={usePush}>Push</button>
31
- <button onClick={useDel}>Del</button>
32
- </div>
33
- <ul class={style.listInner}>
34
- {arr.value.map((item) => (
35
- <li key={item}>{item}</li>
36
- ))}
37
- </ul>
38
- </>
39
- );
40
- }
@@ -1,27 +0,0 @@
1
- .listInner{
2
- padding: 0;
3
- margin: 0;
4
- width: 400px;
5
- }
6
- .listInner li {
7
- list-style: none;
8
- text-align: center;
9
- font-weight: bold;
10
- padding: 10px;
11
- margin: 10px 0;
12
- background-color: #6c2de4;
13
- color: #fff;
14
- border-radius: 20px;
15
- animation: my1 1s ease-in;
16
- }
17
- .listInner button {
18
- margin-top: 30px;
19
- }
20
- @keyframes my1 {
21
- from {
22
- opacity: 0.2;
23
- }
24
- to {
25
- opacity: 1;
26
- }
27
- }
@@ -1,40 +0,0 @@
1
- import { signal, produce } from 'mettle';
2
- import style from '../style/list.module.css';
3
-
4
- export default function List() {
5
- const arr = signal([1, 2]);
6
- const count = signal(3);
7
-
8
- function usePush() {
9
- arr.value = produce(arr.value, (draft: any) => {
10
- draft.push(count.value++);
11
- });
12
- }
13
-
14
- function useUnshift() {
15
- arr.value = produce(arr.value, (draft: any) => {
16
- draft.unshift(count.value++);
17
- });
18
- }
19
-
20
- function useDel() {
21
- arr.value = produce(arr.value, (draft: any) => {
22
- draft.splice(1, 1);
23
- });
24
- }
25
-
26
- return (
27
- <>
28
- <div class={style.listInner}>
29
- <button onClick={useUnshift}>Unshift</button>
30
- <button onClick={usePush}>Push</button>
31
- <button onClick={useDel}>Del</button>
32
- </div>
33
- <ul class={style.listInner}>
34
- {arr.value.map((item: any) => (
35
- <li key={item}>{item}</li>
36
- ))}
37
- </ul>
38
- </>
39
- );
40
- }
@@ -1,27 +0,0 @@
1
- .listInner{
2
- padding: 0;
3
- margin: 0;
4
- width: 400px;
5
- }
6
- .listInner li {
7
- list-style: none;
8
- text-align: center;
9
- font-weight: bold;
10
- padding: 10px;
11
- margin: 10px 0;
12
- background-color: #6c2de4;
13
- color: #fff;
14
- border-radius: 20px;
15
- animation: my1 1s ease-in;
16
- }
17
- .listInner button {
18
- margin-top: 30px;
19
- }
20
- @keyframes my1 {
21
- from {
22
- opacity: 0.2;
23
- }
24
- to {
25
- opacity: 1;
26
- }
27
- }