create-weapp-vite 2.3.15 → 2.3.16

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.
Files changed (66) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{src-D8uqfCKh.js → src-C8kzMXK7.js} +1 -1
  4. package/package.json +1 -1
  5. package/templates/wevu/README.md +3 -3
  6. package/templates/wevu/package.json +1 -1
  7. package/templates/wevu/src/app.vue +1 -60
  8. package/templates/wevu/src/pages/index/index.vue +26 -194
  9. package/templates/wevu/src/pages/layouts/index.vue +0 -18
  10. package/templates/wevu/weapp-vite.config.ts +0 -7
  11. package/templates/wevu-tdesign/README.md +3 -6
  12. package/templates/wevu-tdesign/package.json +1 -1
  13. package/templates/wevu-tdesign/project.private.config.json +0 -66
  14. package/templates/wevu-tdesign/src/app.vue +1 -73
  15. package/templates/wevu-tdesign/src/pages/index/index.vue +19 -362
  16. package/templates/wevu/src/components/InfoPanel/index.vue +0 -52
  17. package/templates/wevu/src/components/StatusPill/index.vue +0 -42
  18. package/templates/wevu/src/packageA/pages/workspace/index.vue +0 -137
  19. package/templates/wevu/src/packageB/pages/settings/index.vue +0 -131
  20. package/templates/wevu/src/pages/overview/index.vue +0 -149
  21. package/templates/wevu-tdesign/public/tabbar/ability-active.png +0 -0
  22. package/templates/wevu-tdesign/public/tabbar/ability.png +0 -0
  23. package/templates/wevu-tdesign/public/tabbar/data-active.png +0 -0
  24. package/templates/wevu-tdesign/public/tabbar/data.png +0 -0
  25. package/templates/wevu-tdesign/public/tabbar/form-active.png +0 -0
  26. package/templates/wevu-tdesign/public/tabbar/form.png +0 -0
  27. package/templates/wevu-tdesign/public/tabbar/home-active.png +0 -0
  28. package/templates/wevu-tdesign/public/tabbar/home.png +0 -0
  29. package/templates/wevu-tdesign/public/tabbar/list-active.png +0 -0
  30. package/templates/wevu-tdesign/public/tabbar/list.png +0 -0
  31. package/templates/wevu-tdesign/src/components/EmptyState/index.vue +0 -36
  32. package/templates/wevu-tdesign/src/components/FilterBar/index.vue +0 -64
  33. package/templates/wevu-tdesign/src/components/FormRow/index.vue +0 -43
  34. package/templates/wevu-tdesign/src/components/FormStep/index.vue +0 -48
  35. package/templates/wevu-tdesign/src/components/KpiBoard/index.vue +0 -145
  36. package/templates/wevu-tdesign/src/components/QuickActionGrid/index.vue +0 -79
  37. package/templates/wevu-tdesign/src/components/ResultCard/index.vue +0 -51
  38. package/templates/wevu-tdesign/src/components/SectionTitle/index.vue +0 -34
  39. package/templates/wevu-tdesign/src/components/TrendCard/index.vue +0 -101
  40. package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/BrokenCard.vue +0 -46
  41. package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/FixedExternalClassCard.vue +0 -50
  42. package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/RecommendedCard.vue +0 -53
  43. package/templates/wevu-tdesign/src/hooks/useDialog.ts +0 -205
  44. package/templates/wevu-tdesign/src/hooks/useFormBinder.ts +0 -17
  45. package/templates/wevu-tdesign/src/hooks/useLayoutFeedbackBridge.ts +0 -17
  46. package/templates/wevu-tdesign/src/hooks/usePullDownRefresh.ts +0 -12
  47. package/templates/wevu-tdesign/src/hooks/useToast.ts +0 -100
  48. package/templates/wevu-tdesign/src/layouts/admin.vue +0 -41
  49. package/templates/wevu-tdesign/src/layouts/default.vue +0 -23
  50. package/templates/wevu-tdesign/src/pages/ability/index.vue +0 -164
  51. package/templates/wevu-tdesign/src/pages/data/index.vue +0 -189
  52. package/templates/wevu-tdesign/src/pages/form/index.vue +0 -271
  53. package/templates/wevu-tdesign/src/pages/layout-feedback/components/FeedbackCallerCard.vue +0 -79
  54. package/templates/wevu-tdesign/src/pages/layout-feedback/index.vue +0 -211
  55. package/templates/wevu-tdesign/src/pages/layout-store/index.vue +0 -127
  56. package/templates/wevu-tdesign/src/pages/layouts/index.vue +0 -120
  57. package/templates/wevu-tdesign/src/pages/list/index.vue +0 -146
  58. package/templates/wevu-tdesign/src/stores/layoutInteractionDemo.ts +0 -129
  59. package/templates/wevu-tdesign/src/subpackages/ability/index.vue +0 -103
  60. package/templates/wevu-tdesign/src/subpackages/lab/class-binding/index.vue +0 -440
  61. package/templates/wevu-tdesign/src/subpackages/lab/index.vue +0 -169
  62. package/templates/wevu-tdesign/src/subpackages/lab/virtual-host-class/index.vue +0 -94
  63. package/templates/wevu-tdesign/src/types/action.ts +0 -14
  64. package/templates/wevu-tdesign/src/types/list.ts +0 -17
  65. package/templates/wevu-tdesign/src/utils/changeEvent.ts +0 -53
  66. package/templates/wevu-tdesign/src/utils/listFilters.ts +0 -34
@@ -1,94 +0,0 @@
1
- <script setup lang="ts">
2
- import BrokenCard from '@/components/VirtualHostClassDemo/BrokenCard.vue'
3
- import FixedExternalClassCard from '@/components/VirtualHostClassDemo/FixedExternalClassCard.vue'
4
- import RecommendedCard from '@/components/VirtualHostClassDemo/RecommendedCard.vue'
5
-
6
- definePageJson({
7
- navigationBarTitleText: 'virtualHost class demo',
8
- backgroundColor: '#f6f7fb',
9
- })
10
-
11
- const classCase = 'rounded-[20rpx] border border-red-500 bg-red-50 px-[20rpx] py-[16rpx] text-red-500'
12
- const inlineStyleCase = 'color:#2563eb;background:#dbeafe;padding:16rpx;border-radius:20rpx;border:2rpx solid #60a5fa;'
13
- </script>
14
-
15
- <template>
16
- <view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
17
- <view class="rounded-[28rpx] bg-linear-to-br from-[#f5f3ff] via-[#ffffff] to-[#eef2ff] p-[20rpx]">
18
- <text class="text-[32rpx] font-semibold text-[#1f1a3f]">
19
- virtualHost + class/style 透传实验
20
- </text>
21
- <text class="mt-[10rpx] block text-[22rpx] leading-[1.7] text-[#5b5b7b]">
22
- 当前模板已全局开启组件 `virtualHost: true` 和 `styleIsolation: 'apply-shared'`。本页用最小组件对比 4 种写法的实际效果。
23
- </text>
24
- </view>
25
-
26
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
27
- <text class="text-[28rpx] font-semibold text-[#1f1a3f]">
28
- 1. 仅 `apply-shared`,不做 class 透传
29
- </text>
30
- <text class="mt-[8rpx] block text-[22rpx] leading-[1.7] text-[#6f6b8a]">
31
- 组件标签上写 `class` / `style`,但组件内部根节点没有接收这些 attrs。
32
- </text>
33
- <view class="mt-[14rpx] flex flex-col gap-[14rpx]">
34
- <BrokenCard
35
- :class="classCase"
36
- title="BrokenCard"
37
- subtitle="预期应变红并出现红色边框,但实际不会。"
38
- />
39
- <BrokenCard
40
- :style="inlineStyleCase"
41
- title="BrokenCard style"
42
- subtitle="预期应变蓝并出现蓝色背景/边框,但实际不会。"
43
- />
44
- </view>
45
- </view>
46
-
47
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
48
- <text class="text-[28rpx] font-semibold text-[#1f1a3f]">
49
- 2. `defineOptions({ externalClasses: ['class'] })`
50
- </text>
51
- <text class="mt-[8rpx] block text-[22rpx] leading-[1.7] text-[#6f6b8a]">
52
- 这是你问的那种“继续用组件标签上的 `class`”方案。组件内部根节点必须显式写上 `class` 占位。
53
- </text>
54
- <view class="mt-[14rpx]">
55
- <FixedExternalClassCard
56
- :class="classCase"
57
- title="FixedExternalClassCard"
58
- subtitle="这一块应该会变红,并出现红色边框和浅红背景。"
59
- />
60
- </view>
61
- </view>
62
-
63
- <view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
64
- <text class="text-[28rpx] font-semibold text-[#1f1a3f]">
65
- 3. 推荐方案:`custom-class` + `rootStyle`
66
- </text>
67
- <text class="mt-[8rpx] block text-[22rpx] leading-[1.7] text-[#6f6b8a]">
68
- `class` 和 `style` 分开设计,避免把组件标签 attrs 是否透传这件事变成隐式行为。
69
- </text>
70
- <view class="mt-[14rpx] flex flex-col gap-[14rpx]">
71
- <RecommendedCard
72
- custom-class="rounded-[20rpx] border border-emerald-500 bg-emerald-50 px-[20rpx] py-[16rpx] text-emerald-600"
73
- title="RecommendedCard custom-class"
74
- subtitle="通过 externalClasses 显式接收类名。"
75
- />
76
- <RecommendedCard
77
- :root-style="inlineStyleCase"
78
- title="RecommendedCard rootStyle"
79
- subtitle="通过显式 prop 接收内联样式。"
80
- />
81
- </view>
82
- </view>
83
-
84
- <view class="mt-[18rpx] rounded-[24rpx] bg-[#1f1a3f] p-[20rpx] text-white">
85
- <text class="text-[26rpx] font-semibold">
86
- 结论
87
- </text>
88
- <text class="mt-[10rpx] block text-[22rpx] leading-[1.8] text-white/80">
89
- `virtualHost: true` 和 `styleIsolation: 'apply-shared'` 不会自动提供 Vue 式根节点 `class/style` fallthrough。
90
- 要么显式声明 `externalClasses` 并在根节点接入,要么把 `style` 做成显式 prop。
91
- </text>
92
- </view>
93
- </view>
94
- </template>
@@ -1,14 +0,0 @@
1
- export type ActionTone = 'brand' | 'neutral'
2
- export type ActionType = 'tab' | 'sub'
3
-
4
- export interface QuickActionItem {
5
- key: string
6
- title: string
7
- description?: string
8
- icon?: string
9
- tag?: string
10
- tone?: ActionTone
11
- disabled?: boolean
12
- path?: string
13
- type?: ActionType
14
- }
@@ -1,17 +0,0 @@
1
- export type ListStatus = 'processing' | 'pending' | 'done'
2
- export type StatusFilterValue = 'all' | ListStatus
3
-
4
- export interface ListItem {
5
- id: number
6
- title: string
7
- owner: string
8
- status: ListStatus
9
- deadline: string
10
- priority: string
11
- }
12
-
13
- export interface StatusFilter {
14
- value: StatusFilterValue
15
- label: string
16
- count?: number
17
- }
@@ -1,53 +0,0 @@
1
- type PrimitiveValue = string | number | boolean
2
-
3
- function hasSameType<T extends PrimitiveValue>(value: unknown, fallback: T): value is T {
4
- return typeof value === typeof fallback
5
- }
6
-
7
- /**
8
- * @description 从小程序组件变更事件中提取值,兼容值直传、detail 直传和 detail.value 结构。
9
- */
10
- export function resolveChangeValue<T extends PrimitiveValue>(event: unknown, fallback: T): T {
11
- if (hasSameType(event, fallback)) {
12
- return event
13
- }
14
-
15
- if (event && typeof event === 'object') {
16
- const payload = event as Record<string, any>
17
- if (hasSameType(payload.value, fallback)) {
18
- return payload.value
19
- }
20
-
21
- const detail = payload.detail
22
- if (hasSameType(detail, fallback)) {
23
- return detail
24
- }
25
-
26
- if (detail && typeof detail === 'object' && hasSameType(detail.value, fallback)) {
27
- return detail.value
28
- }
29
- }
30
-
31
- return fallback
32
- }
33
-
34
- /**
35
- * @description 从小程序组件变更事件中提取字符串值。
36
- */
37
- export function resolveStringChangeValue(event: unknown, fallback = '') {
38
- return resolveChangeValue(event, fallback)
39
- }
40
-
41
- /**
42
- * @description 从小程序组件变更事件中提取数字值。
43
- */
44
- export function resolveNumberChangeValue(event: unknown, fallback = 0) {
45
- return Number(resolveChangeValue(event, fallback))
46
- }
47
-
48
- /**
49
- * @description 从小程序组件变更事件中提取布尔值。
50
- */
51
- export function resolveBooleanChangeValue(event: unknown, fallback = false) {
52
- return Boolean(resolveChangeValue(event, fallback))
53
- }
@@ -1,34 +0,0 @@
1
- import type { ListItem, ListStatus, StatusFilter, StatusFilterValue } from '@/types/list'
2
-
3
- export function buildStatusFilters(items: ListItem[]): StatusFilter[] {
4
- const summary: Record<ListStatus, number> = {
5
- processing: 0,
6
- pending: 0,
7
- done: 0,
8
- }
9
-
10
- for (const item of items) {
11
- summary[item.status] += 1
12
- }
13
-
14
- return [
15
- { value: 'all', label: '全部', count: items.length },
16
- { value: 'processing', label: '进行中', count: summary.processing },
17
- { value: 'pending', label: '待启动', count: summary.pending },
18
- { value: 'done', label: '已完成', count: summary.done },
19
- ]
20
- }
21
-
22
- export function filterListItems(
23
- items: ListItem[],
24
- query: string,
25
- activeStatus: StatusFilterValue,
26
- ) {
27
- const keyword = query.trim()
28
-
29
- return items.filter((item) => {
30
- const matchStatus = activeStatus === 'all' || item.status === activeStatus
31
- const matchQuery = !keyword || item.title.includes(keyword) || item.owner.includes(keyword)
32
- return matchStatus && matchQuery
33
- })
34
- }