wad-lab 1.0.5 → 1.0.6
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/bin/index.js +9 -1
- package/package.json +1 -1
- package/templates/game-memory-cards/index.html +24 -0
- package/templates/game-memory-cards/script.js +90 -0
- package/templates/game-memory-cards/style.css +74 -0
- package/templates/game-rock-paper-scissors/index.html +35 -0
- package/templates/game-rock-paper-scissors/script.js +49 -0
- package/templates/game-rock-paper-scissors/style.css +67 -0
- package/templates/game-tic-tac-toe/index.html +30 -0
- package/templates/game-tic-tac-toe/script.js +82 -0
- package/templates/game-tic-tac-toe/style.css +66 -0
- package/templates/game-whack-a-mole/index.html +34 -0
- package/templates/game-whack-a-mole/script.js +83 -0
- package/templates/game-whack-a-mole/style.css +75 -0
- package/templates/vue-cart-router-pinia/index.html +12 -0
- package/templates/vue-cart-router-pinia/package.json +20 -0
- package/templates/vue-cart-router-pinia/src/App.vue +78 -0
- package/templates/vue-cart-router-pinia/src/main.js +9 -0
- package/templates/vue-cart-router-pinia/src/router/index.js +17 -0
- package/templates/vue-cart-router-pinia/src/stores/cartStore.js +58 -0
- package/templates/vue-cart-router-pinia/src/views/CartView.vue +139 -0
- package/templates/vue-cart-router-pinia/src/views/CheckoutView.vue +144 -0
- package/templates/vue-cart-router-pinia/src/views/ProductCatalogView.vue +73 -0
- package/templates/vue-cart-router-pinia/vite.config.js +6 -0
- package/templates/vue-memory-game/index.html +12 -0
- package/templates/vue-memory-game/package.json +19 -0
- package/templates/vue-memory-game/src/App.vue +106 -0
- package/templates/vue-memory-game/src/main.js +7 -0
- package/templates/vue-memory-game/src/stores/memoryStore.js +64 -0
- package/templates/vue-memory-game/vite.config.js +6 -0
- package/templates/vue-todo-pinia/index.html +12 -0
- package/templates/vue-todo-pinia/package.json +19 -0
- package/templates/vue-todo-pinia/src/App.vue +179 -0
- package/templates/vue-todo-pinia/src/main.js +7 -0
- package/templates/vue-todo-pinia/src/stores/todoStore.js +50 -0
- package/templates/vue-todo-pinia/vite.config.js +6 -0
- package/templates/vue-todo-router/index.html +12 -0
- package/templates/vue-todo-router/package.json +19 -0
- package/templates/vue-todo-router/src/App.vue +55 -0
- package/templates/vue-todo-router/src/data/todoState.js +38 -0
- package/templates/vue-todo-router/src/main.js +7 -0
- package/templates/vue-todo-router/src/router/index.js +17 -0
- package/templates/vue-todo-router/src/views/AddTodoView.vue +85 -0
- package/templates/vue-todo-router/src/views/TodoDetailView.vue +89 -0
- package/templates/vue-todo-router/src/views/TodoListView.vue +77 -0
- package/templates/vue-todo-router/vite.config.js +6 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { useRouter } from 'vue-router'
|
|
4
|
+
import { todoState } from '../data/todoState'
|
|
5
|
+
|
|
6
|
+
const router = useRouter()
|
|
7
|
+
const title = ref('')
|
|
8
|
+
const description = ref('')
|
|
9
|
+
|
|
10
|
+
function handleSubmit() {
|
|
11
|
+
todoState.addTodo(title.value, description.value)
|
|
12
|
+
router.push('/')
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div>
|
|
18
|
+
<h2>Add New Task</h2>
|
|
19
|
+
<form @submit.prevent="handleSubmit" class="add-form">
|
|
20
|
+
<div class="form-group">
|
|
21
|
+
<label for="title">Task Title:</label>
|
|
22
|
+
<input id="title" type="text" v-model="title" required placeholder="Enter task title" />
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="form-group">
|
|
26
|
+
<label for="desc">Description:</label>
|
|
27
|
+
<textarea id="desc" v-model="description" rows="3" placeholder="Enter optional details"></textarea>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="form-actions">
|
|
31
|
+
<button type="submit" class="btn btn-save">Save Task</button>
|
|
32
|
+
<router-link to="/" class="btn btn-cancel">Cancel</router-link>
|
|
33
|
+
</div>
|
|
34
|
+
</form>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
.add-form {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
gap: 12px;
|
|
43
|
+
max-width: 400px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.form-group {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 4px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
input, textarea {
|
|
53
|
+
padding: 8px;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
border: 1px solid #ccc;
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.form-actions {
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: 10px;
|
|
62
|
+
margin-top: 10px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.btn {
|
|
66
|
+
padding: 8px 16px;
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
text-decoration: none;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
border: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.btn-save {
|
|
75
|
+
background-color: #27ae60;
|
|
76
|
+
color: white;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.btn-cancel {
|
|
80
|
+
background-color: #95a5a6;
|
|
81
|
+
color: white;
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
4
|
+
import { todoState } from '../data/todoState'
|
|
5
|
+
|
|
6
|
+
const route = useRoute()
|
|
7
|
+
const router = useRouter()
|
|
8
|
+
|
|
9
|
+
const todo = computed(() => {
|
|
10
|
+
return todoState.getTodoById(route.params.id)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
function handleDelete() {
|
|
14
|
+
if (todo.value) {
|
|
15
|
+
todoState.deleteTodo(todo.value.id)
|
|
16
|
+
router.push('/')
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div v-if="todo" class="detail-card">
|
|
23
|
+
<h2>Task Details</h2>
|
|
24
|
+
<p><strong>ID:</strong> {{ todo.id }}</p>
|
|
25
|
+
<p><strong>Title:</strong> {{ todo.title }}</p>
|
|
26
|
+
<p><strong>Description:</strong> {{ todo.description || 'No description provided' }}</p>
|
|
27
|
+
<p><strong>Status:</strong> {{ todo.done ? 'Completed ✅' : 'Pending ⏳' }}</p>
|
|
28
|
+
|
|
29
|
+
<div class="actions">
|
|
30
|
+
<button type="button" class="btn btn-toggle" @click="todoState.toggleTodo(todo.id)">
|
|
31
|
+
Mark as {{ todo.done ? 'Pending' : 'Completed' }}
|
|
32
|
+
</button>
|
|
33
|
+
<button type="button" class="btn btn-delete" @click="handleDelete">Delete</button>
|
|
34
|
+
<router-link to="/" class="btn btn-back">Back to List</router-link>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<div v-else class="not-found">
|
|
38
|
+
<p>Task not found.</p>
|
|
39
|
+
<router-link to="/">Return to List</router-link>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style scoped>
|
|
44
|
+
.detail-card {
|
|
45
|
+
max-width: 450px;
|
|
46
|
+
border: 1px solid #ddd;
|
|
47
|
+
border-radius: 6px;
|
|
48
|
+
padding: 20px;
|
|
49
|
+
background-color: #fafafa;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.actions {
|
|
53
|
+
display: flex;
|
|
54
|
+
gap: 10px;
|
|
55
|
+
margin-top: 20px;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.btn {
|
|
60
|
+
padding: 8px 14px;
|
|
61
|
+
border: none;
|
|
62
|
+
border-radius: 4px;
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
text-decoration: none;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.btn-toggle {
|
|
69
|
+
background-color: #2980b9;
|
|
70
|
+
color: white;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.btn-delete {
|
|
74
|
+
background-color: #e74c3c;
|
|
75
|
+
color: white;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.btn-back {
|
|
79
|
+
background-color: #7f8c8d;
|
|
80
|
+
color: white;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.not-found {
|
|
86
|
+
padding: 20px;
|
|
87
|
+
text-align: center;
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { todoState } from '../data/todoState'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div>
|
|
7
|
+
<h2>Task List</h2>
|
|
8
|
+
<ul class="task-list">
|
|
9
|
+
<li v-for="item in todoState.todos" :key="item.id" class="task-item">
|
|
10
|
+
<label>
|
|
11
|
+
<input
|
|
12
|
+
type="checkbox"
|
|
13
|
+
:checked="item.done"
|
|
14
|
+
@change="todoState.toggleTodo(item.id)"
|
|
15
|
+
/>
|
|
16
|
+
<span :class="{ completed: item.done }">{{ item.title }}</span>
|
|
17
|
+
</label>
|
|
18
|
+
<div class="actions">
|
|
19
|
+
<router-link :to="'/todo/' + item.id" class="btn-link">View Details</router-link>
|
|
20
|
+
<button type="button" class="btn-del" @click="todoState.deleteTodo(item.id)">Delete</button>
|
|
21
|
+
</div>
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
|
|
25
|
+
<div v-if="todoState.todos.length === 0" class="empty">
|
|
26
|
+
No tasks available. Click "Add Task" to create one.
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<style scoped>
|
|
32
|
+
.task-list {
|
|
33
|
+
list-style: none;
|
|
34
|
+
padding: 0;
|
|
35
|
+
margin: 15px 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.task-item {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
align-items: center;
|
|
42
|
+
padding: 10px 0;
|
|
43
|
+
border-bottom: 1px solid #ddd;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.completed {
|
|
47
|
+
text-decoration: line-through;
|
|
48
|
+
color: #888;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.actions {
|
|
52
|
+
display: flex;
|
|
53
|
+
gap: 10px;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.btn-link {
|
|
58
|
+
color: #2980b9;
|
|
59
|
+
text-decoration: none;
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.btn-del {
|
|
64
|
+
background-color: #e74c3c;
|
|
65
|
+
color: white;
|
|
66
|
+
border: none;
|
|
67
|
+
padding: 4px 8px;
|
|
68
|
+
border-radius: 3px;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.empty {
|
|
73
|
+
text-align: center;
|
|
74
|
+
color: #888;
|
|
75
|
+
padding: 20px 0;
|
|
76
|
+
}
|
|
77
|
+
</style>
|