@vue-lynx-example/todomvc 0.1.1 → 0.2.2

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/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026-present Xuan Huang (huxpro)
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # TodoMVC
2
2
 
3
- Classic [TodoMVC](https://todomvc.com) built with Vue 3 × Lynx using CSS Selector styling.
3
+ Classic [TodoMVC](https://todomvc.com) built with Vue 3 × Lynx using CSS Selector styling. This version features iteratively improved UI, layout, and scrolling behaviors matching the modern reference clone.
4
+
5
+ *(For the original unpolished version, see `examples/todomvc-day1`)*
4
6
 
5
7
  ## Features Exercised
6
8
 
package/lynx.config.ts CHANGED
@@ -1,7 +1,23 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
1
3
  import { defineConfig } from '@lynx-js/rspeedy';
2
4
  import { pluginVueLynx } from 'vue-lynx/plugin';
3
5
 
6
+ const exampleName = path.basename(path.dirname(fileURLToPath(import.meta.url)));
7
+
4
8
  export default defineConfig({
9
+ environments: {
10
+ web: {},
11
+ lynx: {},
12
+ },
13
+ output: {
14
+ assetPrefix: `https://vue.lynxjs.org/examples/${exampleName}/dist/`,
15
+ },
16
+ source: {
17
+ entry: {
18
+ main: './src/index.ts',
19
+ },
20
+ },
5
21
  plugins: [
6
22
  pluginVueLynx({
7
23
  optionsApi: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-lynx-example/todomvc",
3
- "version": "0.1.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "description": "TodoMVC built with Vue 3 × Lynx",
6
6
  "type": "module",
@@ -15,12 +15,8 @@
15
15
  "url": "https://github.com/Huxpro/vue-lynx",
16
16
  "directory": "examples/todomvc"
17
17
  },
18
- "scripts": {
19
- "build": "rspeedy build",
20
- "dev": "rspeedy dev"
21
- },
22
18
  "dependencies": {
23
- "vue-lynx": "workspace:*"
19
+ "vue-lynx": "0.2.0"
24
20
  },
25
21
  "devDependencies": {
26
22
  "@lynx-js/rspeedy": "^0.13.5",
@@ -29,5 +25,9 @@
29
25
  },
30
26
  "engines": {
31
27
  "node": ">=18"
28
+ },
29
+ "scripts": {
30
+ "build": "rspeedy build",
31
+ "dev": "rspeedy dev"
32
32
  }
33
- }
33
+ }
package/src/TodoApp.vue CHANGED
@@ -8,6 +8,9 @@ import TodoFooter from './TodoFooter.vue'
8
8
  // ── State ──────────────────────────────────────────────────
9
9
  const todos = ref([])
10
10
  const filter = ref('all')
11
+ const newTodo = ref('')
12
+ const editedTodoId = ref(null)
13
+ const editText = ref('')
11
14
 
12
15
  // ── Derived ────────────────────────────────────────────────
13
16
  const activeTodos = computed(() => todos.value.filter(t => !t.completed))
@@ -17,6 +20,15 @@ const filteredTodos = computed(() => {
17
20
  if (filter.value === 'completed') return completedTodos.value
18
21
  return todos.value
19
22
  })
23
+
24
+ const TODO_ROW_HEIGHT = 58;
25
+ const VIEWPORT_RESERVED_HEIGHT = 320;
26
+
27
+ const mainScrollHeight = computed(
28
+ () => `${filteredTodos.value.length * TODO_ROW_HEIGHT}px`,
29
+ )
30
+ const mainScrollMaxHeight = `calc(100vh - ${VIEWPORT_RESERVED_HEIGHT}px)`
31
+
20
32
  const allCompleted = computed(() =>
21
33
  todos.value.length > 0 && activeTodos.value.length === 0,
22
34
  )
@@ -28,9 +40,14 @@ function uuid() {
28
40
  }
29
41
 
30
42
  // ── Actions ────────────────────────────────────────────────
43
+ function updateNewTodo(value) {
44
+ newTodo.value = value
45
+ }
46
+
31
47
  function addTodo(title) {
32
48
  if (!title.trim()) return
33
49
  todos.value.push({ id: uuid(), title: title.trim(), completed: false })
50
+ newTodo.value = ''
34
51
  }
35
52
 
36
53
  function toggleTodo(todo) {
@@ -39,14 +56,36 @@ function toggleTodo(todo) {
39
56
 
40
57
  function deleteTodo(todo) {
41
58
  todos.value = todos.value.filter(t => t.id !== todo.id)
59
+ if (editedTodoId.value === todo.id) {
60
+ editedTodoId.value = null
61
+ editText.value = ''
62
+ }
63
+ }
64
+
65
+ function startEdit(todo) {
66
+ editedTodoId.value = todo.id
67
+ editText.value = todo.title
68
+ }
69
+
70
+ function updateEdit(value) {
71
+ editText.value = value
42
72
  }
43
73
 
44
- function editTodo(todo, newTitle) {
45
- if (!newTitle.trim()) {
74
+ function doneEdit(todo) {
75
+ if (editedTodoId.value !== todo.id) {
76
+ return
77
+ }
78
+
79
+ const title = editText.value.trim()
80
+ editedTodoId.value = null
81
+ editText.value = ''
82
+
83
+ if (!title) {
46
84
  deleteTodo(todo)
47
85
  return
48
86
  }
49
- todo.title = newTitle.trim()
87
+
88
+ todo.title = title
50
89
  }
51
90
 
52
91
  function toggleAll() {
@@ -64,47 +103,56 @@ function setFilter(f) {
64
103
  </script>
65
104
 
66
105
  <template>
67
- <view class="todoapp">
68
- <TodoHeader @add-todo="addTodo" />
69
-
70
- <view class="main" v-if="todos.length > 0">
71
- <!-- Toggle all -->
72
- <view class="toggle-all-container">
73
- <view
74
- class="toggle-all-btn"
75
- :class="{ 'all-completed': allCompleted }"
76
- @tap="toggleAll"
77
- >
78
- <text class="toggle-all-icon">✓</text>
79
- </view>
80
- <text class="toggle-all-label">Mark all as complete</text>
81
- </view>
106
+ <view class="page">
107
+ <view class="todoapp-shell">
108
+ <view class="todoapp">
109
+ <TodoHeader
110
+ :all-completed="allCompleted"
111
+ :has-todos="todos.length > 0"
112
+ :new-todo="newTodo"
113
+ @update-new-todo="updateNewTodo"
114
+ @add-todo="addTodo"
115
+ @toggle-all="toggleAll"
116
+ />
82
117
 
83
- <!-- Todo list -->
84
- <view class="todo-list">
85
- <TodoItem
86
- v-for="todo in filteredTodos"
87
- :key="todo.id"
88
- :todo="todo"
89
- @toggle="toggleTodo"
90
- @delete="deleteTodo"
91
- @edit="editTodo"
118
+ <scroll-view
119
+ v-if="todos.length > 0"
120
+ scroll-orientation="vertical"
121
+ :style="{ height: mainScrollHeight, maxHeight: mainScrollMaxHeight }"
122
+ >
123
+ <view class="main">
124
+ <!-- Todo list -->
125
+ <view class="todo-list">
126
+ <TodoItem
127
+ v-for="todo in filteredTodos"
128
+ :key="todo.id"
129
+ :todo="todo"
130
+ :editing="editedTodoId === todo.id"
131
+ :edit-text="editedTodoId === todo.id ? editText : todo.title"
132
+ @toggle="toggleTodo"
133
+ @delete="deleteTodo"
134
+ @start-edit="startEdit"
135
+ @update-edit="updateEdit"
136
+ @done-edit="doneEdit"
137
+ />
138
+ </view>
139
+ </view>
140
+ </scroll-view>
141
+
142
+ <TodoFooter
143
+ v-if="todos.length > 0"
144
+ :active-count="activeTodos.length"
145
+ :completed-count="completedTodos.length"
146
+ :current-filter="filter"
147
+ @set-filter="setFilter"
148
+ @clear-completed="clearCompleted"
92
149
  />
93
150
  </view>
94
151
  </view>
95
152
 
96
- <TodoFooter
97
- v-if="todos.length > 0"
98
- :active-count="activeTodos.length"
99
- :completed-count="completedTodos.length"
100
- :current-filter="filter"
101
- @set-filter="setFilter"
102
- @clear-completed="clearCompleted"
103
- />
104
-
105
153
  <!-- Info -->
106
154
  <view class="info">
107
- <text class="info-text">Tap a todo circle to toggle</text>
155
+ <text class="info-text">Tap the todo text to edit</text>
108
156
  <text class="info-text">Built with Vue 3 × Lynx</text>
109
157
  </view>
110
158
  </view>
@@ -10,9 +10,9 @@ function onClear() { emit('clear-completed') }
10
10
 
11
11
  <template>
12
12
  <view class="footer">
13
- <view :style="{ flexDirection: 'row' }">
14
- <text class="todo-count-number">{{ activeCount }}</text>
15
- <text class="todo-count"> {{ activeCount === 1 ? 'item' : 'items' }} left</text>
13
+ <view class="todo-count">
14
+ <text class="todo-count-strong">{{ activeCount }}</text>
15
+ <text class="todo-count-label"> {{ activeCount === 1 ? 'item' : 'items' }} left</text>
16
16
  </view>
17
17
 
18
18
  <view class="filters">
@@ -1,23 +1,59 @@
1
1
  <script setup>
2
- const emit = defineEmits(['add-todo'])
2
+ defineProps(['allCompleted', 'hasTodos', 'newTodo'])
3
+ const emit = defineEmits(['update-new-todo', 'add-todo', 'toggle-all'])
3
4
 
4
- function onConfirm(e) {
5
+ function onInput(e) {
5
6
  const value = e?.detail?.value ?? ''
7
+ emit('update-new-todo', value)
8
+ }
9
+
10
+ function onConfirm(e) {
11
+ let value = e?.detail?.value
12
+ if (value === undefined) {
13
+ value = ''
14
+ } else {
15
+ emit('update-new-todo', value)
16
+ }
17
+
6
18
  if (value.trim()) {
7
19
  emit('add-todo', value)
8
20
  }
9
21
  }
22
+
23
+ function onToggleAll() {
24
+ emit('toggle-all')
25
+ }
10
26
  </script>
11
27
 
12
28
  <template>
13
29
  <view class="header">
14
30
  <text class="title">todos</text>
15
- <input
16
- class="new-todo"
17
- type="text"
18
- placeholder="What needs to be done?"
19
- confirm-type="done"
20
- @confirm="onConfirm"
21
- />
31
+ <view class="new-todo-row">
32
+ <view
33
+ v-if="hasTodos"
34
+ class="header-toggle-all"
35
+ @tap="onToggleAll"
36
+ >
37
+ <text
38
+ class="header-toggle-all-icon"
39
+ :class="{ checked: allCompleted }"
40
+ >✓</text>
41
+ </view>
42
+ <view
43
+ v-else
44
+ class="header-toggle-all header-toggle-all-placeholder"
45
+ />
46
+
47
+ <input
48
+ class="new-todo with-toggle"
49
+ type="text"
50
+ :value="newTodo"
51
+ placeholder="What needs to be done?"
52
+ confirm-type="done"
53
+ autofocus
54
+ @input="onInput"
55
+ @confirm="onConfirm"
56
+ />
57
+ </view>
22
58
  </view>
23
59
  </template>
package/src/TodoItem.vue CHANGED
@@ -1,10 +1,6 @@
1
1
  <script setup>
2
- import { ref } from 'vue'
3
-
4
- const props = defineProps(['todo'])
5
- const emit = defineEmits(['toggle', 'delete', 'edit'])
6
-
7
- const editing = ref(false)
2
+ const props = defineProps(['todo', 'editing', 'editText'])
3
+ const emit = defineEmits(['toggle', 'delete', 'start-edit', 'update-edit', 'done-edit'])
8
4
 
9
5
  function onToggle() {
10
6
  emit('toggle', props.todo)
@@ -15,42 +11,53 @@ function onDelete() {
15
11
  }
16
12
 
17
13
  function startEdit() {
18
- editing.value = true
14
+ emit('start-edit', props.todo)
19
15
  }
20
16
 
21
- function onEditConfirm(e) {
17
+ function onEditInput(e) {
22
18
  const value = e?.detail?.value ?? ''
23
- editing.value = false
24
- emit('edit', props.todo, value)
19
+ emit('update-edit', value)
25
20
  }
26
21
 
27
- function cancelEdit() {
28
- editing.value = false
22
+ function onDoneEdit(e) {
23
+ if (e) {
24
+ const value = e?.detail?.value ?? ''
25
+ emit('update-edit', value)
26
+ }
27
+ emit('done-edit', props.todo)
29
28
  }
30
29
  </script>
31
30
 
32
31
  <template>
33
- <!-- Normal view -->
34
32
  <view
35
- v-if="!editing"
36
33
  class="todo-item"
37
- :class="{ completed: todo.completed }"
34
+ :class="{ completed: todo.completed, editing }"
38
35
  >
39
- <view class="todo-toggle" @tap="onToggle">
40
- <text v-if="todo.completed" class="checkmark">✓</text>
36
+ <!-- Normal view -->
37
+ <view
38
+ v-if="!editing"
39
+ class="todo-view"
40
+ >
41
+ <view class="todo-toggle" @tap="onToggle">
42
+ <text v-if="todo.completed" class="todo-toggle-icon">✓</text>
43
+ </view>
44
+ <view class="todo-label-hitbox" @tap="startEdit">
45
+ <text class="todo-label">{{ todo.title }}</text>
46
+ </view>
47
+ <text class="destroy" @tap="onDelete">✕</text>
41
48
  </view>
42
- <text class="todo-label" @longpress="startEdit">{{ todo.title }}</text>
43
- <text class="destroy" @tap="onDelete">✕</text>
44
- </view>
45
49
 
46
- <!-- Edit view -->
47
- <view v-else class="edit-container">
48
- <input
49
- class="edit-input"
50
- type="text"
51
- :value="todo.title"
52
- @confirm="onEditConfirm"
53
- @blur="cancelEdit"
54
- />
50
+ <!-- Edit view -->
51
+ <view v-else class="edit-container">
52
+ <input
53
+ class="edit-input"
54
+ type="text"
55
+ :value="editText"
56
+ autofocus
57
+ @input="onEditInput"
58
+ @confirm="onDoneEdit"
59
+ @blur="onDoneEdit"
60
+ />
61
+ </view>
55
62
  </view>
56
63
  </template>
package/src/todomvc.css CHANGED
@@ -11,12 +11,28 @@
11
11
 
12
12
  /* ─── App Container ─────────────────────────────────────── */
13
13
 
14
- .todoapp {
14
+ .page {
15
+ height: 100%;
16
+ background-color: #f5f5f5;
17
+ }
18
+
19
+ .todoapp-shell {
15
20
  display: flex;
16
- flex-direction: column;
17
- background-color: #fff;
18
- position: relative;
21
+ flex: 1;
22
+ align-items: center;
23
+ justify-content: flex-start;
24
+ width: 100%;
25
+ padding: 28px 16px 12px;
26
+ }
27
+
28
+ .todoapp {
19
29
  width: 100%;
30
+ max-width: 560px;
31
+ margin: 0 auto;
32
+ background-color: #ffffff;
33
+ box-shadow:
34
+ 0 2px 4px rgba(0, 0, 0, 0.16),
35
+ 0 24px 50px rgba(0, 0, 0, 0.08);
20
36
  }
21
37
 
22
38
  /* ─── Header ────────────────────────────────────────────── */
@@ -24,73 +40,78 @@
24
40
  .header {
25
41
  display: flex;
26
42
  flex-direction: column;
27
- align-items: center;
28
43
  padding-top: 12px;
44
+ width: 100%;
29
45
  }
30
46
 
31
47
  .header .title {
32
- font-size: 60px;
48
+ font-size: 72px;
49
+ line-height: 1;
33
50
  font-weight: 200;
34
51
  color: rgba(175, 47, 47, 0.15);
35
52
  text-align: center;
53
+ margin-bottom: 10px;
36
54
  }
37
55
 
38
- .new-todo {
39
- width: 90%;
40
- padding: 16px 16px 16px 16px;
41
- font-size: 18px;
42
- border: 1px solid #999;
43
- border-radius: 4px;
44
- margin-top: 8px;
45
- color: #4d4d4d;
46
- background-color: #fff;
47
- }
48
-
49
- /* ─── Main Section ──────────────────────────────────────── */
50
-
51
- .main {
52
- display: flex;
53
- flex-direction: column;
54
- border-top: 1px solid #e6e6e6;
55
- }
56
-
57
- /* Toggle All */
58
- .toggle-all-container {
56
+ .new-todo-row {
59
57
  display: flex;
60
58
  flex-direction: row;
61
59
  align-items: center;
62
- padding: 8px 16px;
63
- border-bottom: 1px solid #e6e6e6;
60
+ border-bottom: 1px solid #ededed;
61
+ background-color: rgba(0, 0, 0, 0.002);
62
+ box-shadow: inset 0 -2px 1px rgba(0, 0, 0, 0.03);
63
+ overflow: hidden;
64
+ width: 100%;
64
65
  }
65
66
 
66
- .toggle-all-btn {
67
- width: 36px;
68
- height: 36px;
67
+ .header-toggle-all {
69
68
  display: flex;
70
69
  align-items: center;
71
70
  justify-content: center;
72
- border-radius: 18px;
71
+ width: 58px;
72
+ min-height: 60px;
73
+ flex-shrink: 0;
73
74
  }
74
75
 
75
- .toggle-all-btn.all-completed {
76
- background-color: #737373;
76
+ .header-toggle-all-placeholder {
77
+ opacity: 0;
77
78
  }
78
79
 
79
- .toggle-all-icon {
80
- font-size: 20px;
80
+ .header-toggle-all-icon {
81
+ text-align: center;
82
+ font-size: 24px;
81
83
  color: #e6e6e6;
82
84
  }
83
85
 
84
- .toggle-all-btn.all-completed .toggle-all-icon {
85
- color: #fff;
86
+ .header-toggle-all-icon.checked {
87
+ color: #737373;
86
88
  }
87
89
 
88
- .toggle-all-label {
89
- font-size: 14px;
90
- color: #e6e6e6;
91
- margin-left: 8px;
90
+ .new-todo {
91
+ flex: 1;
92
+ width: auto;
93
+ min-height: 60px;
94
+ padding: 16px 18px;
95
+ border-width: 0;
96
+ color: #4d4d4d;
97
+ font-size: 24px;
98
+ overflow: hidden;
99
+ text-overflow: clip;
92
100
  }
93
101
 
102
+ .new-todo.with-toggle {
103
+ padding-left: 6px;
104
+ }
105
+
106
+ /* ─── Main Section ──────────────────────────────────────── */
107
+
108
+ .main {
109
+ display: flex;
110
+ flex-direction: column;
111
+ }
112
+
113
+ /* Toggle All */
114
+
94
115
  /* ─── Todo List ─────────────────────────────────────────── */
95
116
 
96
117
  .todo-list {
@@ -101,19 +122,26 @@
101
122
  /* ─── Todo Item ─────────────────────────────────────────── */
102
123
 
103
124
  .todo-item {
125
+ display: flex;
126
+ flex-direction: column;
127
+ background-color: #ffffff;
128
+ border-bottom: 1px solid #ededed;
129
+ }
130
+
131
+ .todo-view {
104
132
  display: flex;
105
133
  flex-direction: row;
106
134
  align-items: center;
107
- padding: 12px 16px;
108
- border-bottom: 1px solid #ededed;
135
+ min-height: 58px;
136
+ padding: 12px 18px;
109
137
  }
110
138
 
111
139
  /* Checkbox circle */
112
140
  .todo-toggle {
113
- width: 32px;
114
- height: 32px;
115
- border-radius: 16px;
116
- border: 2px solid #bddad5;
141
+ width: 34px;
142
+ height: 34px;
143
+ border-radius: 17px;
144
+ border: 1px solid #d9e6e4;
117
145
  display: flex;
118
146
  align-items: center;
119
147
  justify-content: center;
@@ -122,23 +150,24 @@
122
150
 
123
151
  .todo-item.completed .todo-toggle {
124
152
  border-color: #5dc2af;
125
- background-color: #5dc2af;
126
153
  }
127
154
 
128
- .checkmark {
155
+ .todo-toggle-icon {
129
156
  font-size: 18px;
130
- color: #fff;
131
- font-weight: 700;
157
+ color: #5dc2af;
132
158
  }
133
159
 
134
160
  /* Todo label */
135
- .todo-label {
161
+ .todo-label-hitbox {
136
162
  flex: 1;
137
- font-size: 18px;
138
- color: #4d4d4d;
139
- margin-left: 12px;
163
+ margin-left: 14px;
140
164
  margin-right: 12px;
141
- line-height: 1.4;
165
+ }
166
+
167
+ .todo-label {
168
+ font-size: 24px;
169
+ color: #4d4d4d;
170
+ line-height: 1.3;
142
171
  }
143
172
 
144
173
  .todo-item.completed .todo-label {
@@ -162,19 +191,28 @@
162
191
  .edit-container {
163
192
  display: flex;
164
193
  flex-direction: row;
165
- align-items: center;
166
- padding: 4px 16px;
194
+ padding: 0 0 0 52px;
167
195
  border-bottom: 1px solid #ededed;
196
+ overflow: hidden;
197
+ }
198
+
199
+ .todo-item.editing .edit-container {
200
+ border-bottom-width: 0;
168
201
  }
169
202
 
170
203
  .edit-input {
204
+ width: auto;
171
205
  flex: 1;
172
- font-size: 18px;
173
- padding: 12px;
174
- border: 1px solid #999;
175
- border-radius: 4px;
206
+ box-sizing: border-box;
207
+ min-height: 58px;
208
+ padding: 12px 16px;
209
+ border: 1px solid #999999;
210
+ background-color: #ffffff;
176
211
  color: #4d4d4d;
177
- background-color: #fff;
212
+ font-size: 24px;
213
+ box-shadow:
214
+ inset 0 -1px 5px rgba(0, 0, 0, 0.2),
215
+ 0 0 1px rgba(0, 0, 0, 0.12);
178
216
  }
179
217
 
180
218
  /* ─── Footer ────────────────────────────────────────────── */
@@ -183,20 +221,37 @@
183
221
  display: flex;
184
222
  flex-direction: row;
185
223
  align-items: center;
186
- padding: 10px 16px;
224
+ justify-content: space-between;
225
+ flex-wrap: wrap;
226
+ gap: 10px;
227
+ padding: 12px 16px;
228
+ color: #777777;
187
229
  border-top: 1px solid #e6e6e6;
230
+ box-shadow:
231
+ 0 1px 1px rgba(0, 0, 0, 0.08),
232
+ 0 8px 0 -3px #f6f6f6,
233
+ 0 9px 1px -3px rgba(0, 0, 0, 0.08),
234
+ 0 16px 0 -6px #f6f6f6,
235
+ 0 17px 2px -6px rgba(0, 0, 0, 0.08);
188
236
  }
189
237
 
190
238
  .todo-count {
191
- font-size: 13px;
192
- color: #777;
193
- flex-shrink: 0;
239
+ display: flex;
240
+ flex-direction: row;
241
+ align-items: center;
242
+ font-size: 14px;
243
+ color: #777777;
194
244
  }
195
245
 
196
- .todo-count-number {
246
+ .todo-count-strong {
247
+ font-size: 14px;
197
248
  font-weight: 700;
198
- font-size: 13px;
199
- color: #777;
249
+ color: #777777;
250
+ }
251
+
252
+ .todo-count-label {
253
+ font-size: 14px;
254
+ color: #777777;
200
255
  }
201
256
 
202
257
  /* Filter buttons */
@@ -205,15 +260,17 @@
205
260
  flex-direction: row;
206
261
  flex: 1;
207
262
  justify-content: center;
208
- gap: 4px;
263
+ flex-wrap: wrap;
264
+ gap: 8px;
265
+ min-width: 180px;
209
266
  }
210
267
 
211
268
  .filter-btn {
212
- font-size: 13px;
213
- color: #777;
214
269
  padding: 3px 8px;
215
270
  border: 1px solid transparent;
216
271
  border-radius: 3px;
272
+ color: #777777;
273
+ font-size: 14px;
217
274
  }
218
275
 
219
276
  .filter-btn.selected {
@@ -222,9 +279,8 @@
222
279
 
223
280
  /* Clear completed */
224
281
  .clear-completed {
225
- font-size: 13px;
226
- color: #777;
227
- flex-shrink: 0;
282
+ font-size: 14px;
283
+ color: #777777;
228
284
  }
229
285
 
230
286
  /* ─── Info Footer ───────────────────────────────────────── */
Binary file