create-rue 0.7.2 → 0.7.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/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /*! create-rue v0.7.2 | MIT */
2
+ /*! create-rue v0.7.3 | MIT */
3
3
  import { createRequire } from "node:module";
4
4
  import * as fs from "node:fs";
5
5
  import * as path from "node:path";
@@ -1979,7 +1979,7 @@ function inferPackageManager() {
1979
1979
  //#endregion
1980
1980
  //#region package.json
1981
1981
  var name = "create-rue";
1982
- var version = "0.7.2";
1982
+ var version = "0.7.3";
1983
1983
  //#endregion
1984
1984
  //#region index.ts
1985
1985
  const language = await getLanguage(fileURLToPath(new URL("./locales", import.meta.url)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rue",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "🛠️ The recommended way to start a Vite-powered Rue project",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/hunzhiwange/create-rue#readme",
@@ -0,0 +1 @@
1
+ declare const __SSR__: boolean
@@ -72,7 +72,7 @@ const getStoredTodos = (): TodoItem[] => {
72
72
  }
73
73
 
74
74
  return parsed.filter(
75
- (item) =>
75
+ item =>
76
76
  item &&
77
77
  typeof item.id === 'number' &&
78
78
  typeof item.title === 'string' &&
@@ -121,7 +121,7 @@ const EditingTitleInput: FC<{
121
121
  initialTitle: string
122
122
  onSave: (title: string) => void
123
123
  onCancel: () => void
124
- }> = (props) => {
124
+ }> = props => {
125
125
  const [title, setTitle] = useState(props.initialTitle)
126
126
 
127
127
  return (
@@ -170,17 +170,17 @@ const TodoApp: FC = () => {
170
170
  )
171
171
 
172
172
  const counts = computed(() => ({
173
- total: todos.value.filter((item) => !item.archived).length,
174
- todo: todos.value.filter((item) => !item.archived && item.status === 'todo').length,
175
- doing: todos.value.filter((item) => !item.archived && item.status === 'doing').length,
176
- done: todos.value.filter((item) => !item.archived && item.status === 'done').length,
177
- archived: todos.value.filter((item) => item.archived).length,
173
+ total: todos.value.filter(item => !item.archived).length,
174
+ todo: todos.value.filter(item => !item.archived && item.status === 'todo').length,
175
+ doing: todos.value.filter(item => !item.archived && item.status === 'doing').length,
176
+ done: todos.value.filter(item => !item.archived && item.status === 'done').length,
177
+ archived: todos.value.filter(item => item.archived).length,
178
178
  }))
179
179
 
180
180
  const visibleTodos = computed(() => {
181
181
  const keyword = search.value.trim().toLowerCase()
182
182
 
183
- return todos.value.filter((item) => {
183
+ return todos.value.filter(item => {
184
184
  const matchesKeyword = !keyword || item.title.toLowerCase().includes(keyword)
185
185
  if (!matchesKeyword) {
186
186
  return false
@@ -222,20 +222,20 @@ const TodoApp: FC = () => {
222
222
  }
223
223
 
224
224
  const removeTodo = (id: number) => {
225
- todos.value = todos.value.filter((item) => item.id !== id)
225
+ todos.value = todos.value.filter(item => item.id !== id)
226
226
  if (editingId.value === id) {
227
227
  editingId.value = null
228
228
  }
229
229
  }
230
230
 
231
231
  const updateStatus = (id: number, status: TodoStatus) => {
232
- todos.value = todos.value.map((item) =>
232
+ todos.value = todos.value.map(item =>
233
233
  item.id === id ? { ...item, status, archived: false } : item,
234
234
  )
235
235
  }
236
236
 
237
237
  const toggleArchived = (id: number) => {
238
- todos.value = todos.value.map((item) =>
238
+ todos.value = todos.value.map(item =>
239
239
  item.id === id ? { ...item, archived: !item.archived } : item,
240
240
  )
241
241
  }
@@ -253,7 +253,7 @@ const TodoApp: FC = () => {
253
253
  return
254
254
  }
255
255
 
256
- todos.value = todos.value.map((item) => (item.id === id ? { ...item, title } : item))
256
+ todos.value = todos.value.map(item => (item.id === id ? { ...item, title } : item))
257
257
  cancelEditing()
258
258
  }
259
259
 
@@ -332,7 +332,7 @@ const TodoApp: FC = () => {
332
332
  </div>
333
333
 
334
334
  <div className="flex flex-wrap gap-2">
335
- {filterOptions.map((filter) => (
335
+ {filterOptions.map(filter => (
336
336
  <button
337
337
  key={filter.key}
338
338
  className={`btn btn-sm ${
@@ -367,103 +367,99 @@ const TodoApp: FC = () => {
367
367
  </section>
368
368
 
369
369
  <section className="grid gap-4">
370
- {visibleTodos.get().length ? (
371
- visibleTodos.get().map((item) => {
372
- const meta = statusMeta[item.status]
373
- const isEditing = editingId.value === item.id
374
-
375
- return (
376
- <article
377
- key={item.id}
378
- className={`card border bg-base-100 shadow-sm transition-all ${meta.cardClass} ${
379
- item.archived ? 'opacity-75' : 'hover:-translate-y-0.5 hover:shadow-md'
380
- }`}
381
- >
382
- <div className="card-body gap-4">
383
- <div className="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
384
- <div className="flex-1 space-y-3">
385
- <div className="flex flex-wrap items-center gap-2">
386
- <span
387
- className={`inline-block h-2.5 w-2.5 rounded-full ${meta.dotClass}`}
388
- ></span>
389
- <span className={meta.badgeClass}>{meta.label}</span>
390
- {item.archived && (
391
- <span className="badge badge-secondary badge-outline">已归档</span>
392
- )}
393
- <span className="text-xs text-base-content/50">
394
- 创建于 {item.createdAt}
395
- </span>
396
- </div>
397
-
398
- {!isEditing && (
399
- <h2
400
- className={`text-xl font-semibold ${
401
- item.status === 'done'
402
- ? 'text-base-content/50 line-through'
403
- : 'text-base-content'
404
- }`}
405
- >
406
- {item.title}
407
- </h2>
370
+ {visibleTodos.get().map(item => {
371
+ const meta = statusMeta[item.status]
372
+ const isEditing = editingId.value === item.id
373
+
374
+ return (
375
+ <article
376
+ key={`${item.id}-${item.title}-${item.status}-${item.archived ? 'archived' : 'active'}-${
377
+ isEditing ? 'editing' : 'view'
378
+ }`}
379
+ className={`card border bg-base-100 shadow-sm transition-all ${meta.cardClass} ${
380
+ item.archived ? 'opacity-75' : 'hover:-translate-y-0.5 hover:shadow-md'
381
+ }`}
382
+ >
383
+ <div className="card-body gap-4">
384
+ <div className="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
385
+ <div className="flex-1 space-y-3">
386
+ <div className="flex flex-wrap items-center gap-2">
387
+ <span
388
+ className={`inline-block h-2.5 w-2.5 rounded-full ${meta.dotClass}`}
389
+ ></span>
390
+ <span className={meta.badgeClass}>{meta.label}</span>
391
+ {item.archived && (
392
+ <span className="badge badge-secondary badge-outline">已归档</span>
408
393
  )}
409
-
410
- {isEditing && (
411
- <EditingTitleInput
412
- key={item.id}
413
- initialTitle={item.title}
414
- onSave={(title) => saveEditing(item.id, title)}
415
- onCancel={cancelEditing}
416
- />
417
- )}
418
-
419
- <div className="flex flex-wrap gap-2">
420
- {statusOptions.map((option) => (
421
- <button
422
- key={option.key}
423
- className={`btn btn-xs ${
424
- item.status === option.key
425
- ? 'btn-neutral'
426
- : 'btn-ghost border border-base-300'
427
- }`}
428
- onClick={() => updateStatus(item.id, option.key)}
429
- >
430
- {option.label}
431
- </button>
432
- ))}
433
- </div>
394
+ <span className="text-xs text-base-content/50">创建于 {item.createdAt}</span>
434
395
  </div>
435
396
 
436
- <div className="flex flex-wrap gap-2 lg:justify-end">
437
- {!isEditing && (
397
+ {!isEditing && (
398
+ <h2
399
+ className={`text-xl font-semibold ${
400
+ item.status === 'done'
401
+ ? 'text-base-content/50 line-through'
402
+ : 'text-base-content'
403
+ }`}
404
+ >
405
+ {item.title}
406
+ </h2>
407
+ )}
408
+
409
+ {isEditing && (
410
+ <EditingTitleInput
411
+ key={item.id}
412
+ initialTitle={item.title}
413
+ onSave={title => saveEditing(item.id, title)}
414
+ onCancel={cancelEditing}
415
+ />
416
+ )}
417
+
418
+ <div className="flex flex-wrap gap-2">
419
+ {statusOptions.map(option => (
438
420
  <button
439
- className="btn btn-sm btn-outline"
440
- onClick={() => startEditing(item)}
421
+ key={option.key}
422
+ className={`btn btn-xs ${
423
+ item.status === option.key
424
+ ? 'btn-neutral'
425
+ : 'btn-ghost border border-base-300'
426
+ }`}
427
+ onClick={() => updateStatus(item.id, option.key)}
441
428
  >
442
- 改名
429
+ {option.label}
443
430
  </button>
444
- )}
445
- <button
446
- className="btn btn-sm btn-outline btn-secondary"
447
- onClick={() => toggleArchived(item.id)}
448
- >
449
- {item.archived ? '恢复' : '归档'}
450
- </button>
451
- <button
452
- className="btn btn-sm btn-outline btn-error"
453
- onClick={() => removeTodo(item.id)}
454
- >
455
- 删除
456
- </button>
431
+ ))}
457
432
  </div>
458
433
  </div>
434
+
435
+ <div className="flex flex-wrap gap-2 lg:justify-end">
436
+ {!isEditing && (
437
+ <button className="btn btn-sm btn-outline" onClick={() => startEditing(item)}>
438
+ 改名
439
+ </button>
440
+ )}
441
+ <button
442
+ className="btn btn-sm btn-outline btn-secondary"
443
+ onClick={() => toggleArchived(item.id)}
444
+ >
445
+ {item.archived ? '恢复' : '归档'}
446
+ </button>
447
+ <button
448
+ className="btn btn-sm btn-outline btn-error"
449
+ onClick={() => removeTodo(item.id)}
450
+ >
451
+ 删除
452
+ </button>
453
+ </div>
459
454
  </div>
460
- </article>
461
- )
462
- })
463
- ) : (
455
+ </div>
456
+ </article>
457
+ )
458
+ })}
459
+ {!visibleTodos.get().length && (
464
460
  <div className="card border border-dashed border-base-300 bg-base-100 shadow-sm">
465
461
  <div className="card-body items-center py-14 text-center">
466
- <h2 className="text-xl font-semibold">当前筛选下没有任务</h2>
462
+ <h3 className="text-xl font-semibold">当前筛选下没有任务</h3>
467
463
  <p className="max-w-md text-sm leading-6 text-base-content/70">
468
464
  试试切换筛选、搜索关键字,或者直接新增一条任务。
469
465
  </p>
@@ -27,6 +27,7 @@
27
27
  "@tailwindcss/typography": "^0.5.19",
28
28
  "@tailwindcss/vite": "^4.1.17",
29
29
  "@types/node": "^24.10.1",
30
+ "daisyui": "^5.5.23",
30
31
  "oxfmt": "^0.42.0",
31
32
  "oxlint": "^1.57.0",
32
33
  "typescript": "^5.9.3",
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "target": "ES2020",
4
4
  "module": "ESNext",
5
- "lib": ["DOM", "DOM.Iterable", "ES2020"],
5
+ "lib": ["DOM", "DOM.Iterable", "ES2021"],
6
6
  "strict": true,
7
7
  "skipLibCheck": true,
8
8
  "moduleResolution": "bundler",
@@ -2,9 +2,19 @@ import { defineConfig } from 'vite'
2
2
  import VitePluginRue from '@rue-js/vite-plugin-rue'
3
3
  import wasm from 'vite-plugin-wasm'
4
4
  import tailwindcss from '@tailwindcss/vite'
5
+ import { createRequire } from 'node:module'
6
+
7
+ const require = createRequire(import.meta.url)
8
+ const runtimeDomEntry = require.resolve('@rue-js/runtime/src/dom.ts')
5
9
 
6
10
  export default defineConfig({
7
11
  resolve: {
12
+ alias: [
13
+ {
14
+ find: '@rue-js/runtime/dom',
15
+ replacement: runtimeDomEntry,
16
+ },
17
+ ],
8
18
  conditions: ['import', 'module', 'browser', 'default'],
9
19
  },
10
20
  plugins: [