create-weapp-vite 2.0.52 → 2.0.55

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 (137) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{src-DFc325BF.js → src-nL81L3Ai.js} +11 -9
  4. package/package.json +1 -1
  5. package/templates/default/package.json +3 -2
  6. package/templates/default/project.private.config.json +1 -1
  7. package/templates/default/src/app.json +2 -1
  8. package/templates/default/src/layouts/admin/index.json +3 -0
  9. package/templates/default/src/layouts/admin/index.scss +40 -0
  10. package/templates/default/src/layouts/admin/index.ts +1 -0
  11. package/templates/default/src/layouts/admin/index.wxml +10 -0
  12. package/templates/default/src/layouts/default/index.json +3 -0
  13. package/templates/default/src/layouts/default/index.scss +3 -0
  14. package/templates/default/src/layouts/default/index.ts +1 -0
  15. package/templates/default/src/layouts/default/index.wxml +3 -0
  16. package/templates/default/src/pages/index/index.ts +5 -0
  17. package/templates/default/src/pages/index/index.wxml +3 -0
  18. package/templates/default/src/pages/layouts/index.json +4 -0
  19. package/templates/default/src/pages/layouts/index.scss +68 -0
  20. package/templates/default/src/pages/layouts/index.ts +42 -0
  21. package/templates/default/src/pages/layouts/index.wxml +19 -0
  22. package/templates/default/tsconfig.json +8 -2
  23. package/templates/lib/package.json +6 -2
  24. package/templates/lib/project.private.config.json +1 -1
  25. package/templates/lib/src/app.json +2 -1
  26. package/templates/lib/src/layouts/admin/index.json +3 -0
  27. package/templates/lib/src/layouts/admin/index.scss +41 -0
  28. package/templates/lib/src/layouts/admin/index.ts +1 -0
  29. package/templates/lib/src/layouts/admin/index.wxml +10 -0
  30. package/templates/lib/src/layouts/default/index.json +3 -0
  31. package/templates/lib/src/layouts/default/index.scss +3 -0
  32. package/templates/lib/src/layouts/default/index.ts +1 -0
  33. package/templates/lib/src/layouts/default/index.wxml +3 -0
  34. package/templates/lib/src/pages/index/index.scss +14 -3
  35. package/templates/lib/src/pages/index/index.ts +5 -0
  36. package/templates/lib/src/pages/index/index.wxml +6 -0
  37. package/templates/lib/src/pages/layouts/index.json +4 -0
  38. package/templates/lib/src/pages/layouts/index.scss +70 -0
  39. package/templates/lib/src/pages/layouts/index.ts +44 -0
  40. package/templates/lib/src/pages/layouts/index.wxml +19 -0
  41. package/templates/lib/tsconfig.json +8 -2
  42. package/templates/lib/weapp-vite.lib.config.ts +5 -0
  43. package/templates/tailwindcss/package.json +3 -3
  44. package/templates/tailwindcss/project.private.config.json +1 -1
  45. package/templates/tailwindcss/src/app.json +2 -1
  46. package/templates/tailwindcss/src/layouts/admin/index.json +3 -0
  47. package/templates/tailwindcss/src/layouts/admin/index.scss +40 -0
  48. package/templates/tailwindcss/src/layouts/admin/index.ts +1 -0
  49. package/templates/tailwindcss/src/layouts/admin/index.wxml +10 -0
  50. package/templates/tailwindcss/src/layouts/default/index.json +3 -0
  51. package/templates/tailwindcss/src/layouts/default/index.scss +3 -0
  52. package/templates/tailwindcss/src/layouts/default/index.ts +1 -0
  53. package/templates/tailwindcss/src/layouts/default/index.wxml +3 -0
  54. package/templates/tailwindcss/src/pages/index/index.ts +5 -0
  55. package/templates/tailwindcss/src/pages/index/index.wxml +3 -0
  56. package/templates/tailwindcss/src/pages/layouts/index.json +4 -0
  57. package/templates/tailwindcss/src/pages/layouts/index.scss +1 -0
  58. package/templates/tailwindcss/src/pages/layouts/index.ts +33 -0
  59. package/templates/tailwindcss/src/pages/layouts/index.wxml +19 -0
  60. package/templates/tailwindcss/tsconfig.json +8 -2
  61. package/templates/tdesign/package.json +3 -3
  62. package/templates/tdesign/project.private.config.json +2 -2
  63. package/templates/tdesign/src/app.json +2 -1
  64. package/templates/tdesign/src/layouts/admin/index.json +3 -0
  65. package/templates/tdesign/src/layouts/admin/index.scss +40 -0
  66. package/templates/tdesign/src/layouts/admin/index.ts +1 -0
  67. package/templates/tdesign/src/layouts/admin/index.wxml +10 -0
  68. package/templates/tdesign/src/layouts/default/index.json +3 -0
  69. package/templates/tdesign/src/layouts/default/index.scss +3 -0
  70. package/templates/tdesign/src/layouts/default/index.ts +1 -0
  71. package/templates/tdesign/src/layouts/default/index.wxml +3 -0
  72. package/templates/tdesign/src/pages/index/index.ts +5 -0
  73. package/templates/tdesign/src/pages/index/index.wxml +3 -0
  74. package/templates/tdesign/src/pages/layouts/index.json +4 -0
  75. package/templates/tdesign/src/pages/layouts/index.scss +1 -0
  76. package/templates/tdesign/src/pages/layouts/index.ts +32 -0
  77. package/templates/tdesign/src/pages/layouts/index.wxml +16 -0
  78. package/templates/tdesign/tsconfig.json +8 -2
  79. package/templates/tdesign/vite.config.ts +9 -0
  80. package/templates/vant/package.json +3 -3
  81. package/templates/vant/project.private.config.json +1 -1
  82. package/templates/vant/src/app.json +2 -1
  83. package/templates/vant/src/layouts/admin/index.json +3 -0
  84. package/templates/vant/src/layouts/admin/index.scss +40 -0
  85. package/templates/vant/src/layouts/admin/index.ts +1 -0
  86. package/templates/vant/src/layouts/admin/index.wxml +10 -0
  87. package/templates/vant/src/layouts/default/index.json +3 -0
  88. package/templates/vant/src/layouts/default/index.scss +3 -0
  89. package/templates/vant/src/layouts/default/index.ts +1 -0
  90. package/templates/vant/src/layouts/default/index.wxml +3 -0
  91. package/templates/vant/src/pages/index/index.ts +5 -0
  92. package/templates/vant/src/pages/index/index.wxml +3 -0
  93. package/templates/vant/src/pages/layouts/index.json +4 -0
  94. package/templates/vant/src/pages/layouts/index.scss +3 -0
  95. package/templates/vant/src/pages/layouts/index.ts +35 -0
  96. package/templates/vant/src/pages/layouts/index.wxml +17 -0
  97. package/templates/vant/tsconfig.json +8 -2
  98. package/templates/vant/vite.config.ts +9 -0
  99. package/templates/wevu/package.json +4 -3
  100. package/templates/wevu/project.private.config.json +2 -2
  101. package/templates/wevu/src/layouts/admin.vue +75 -0
  102. package/templates/wevu/src/layouts/default.vue +17 -0
  103. package/templates/wevu/src/pages/index/index.vue +7 -0
  104. package/templates/wevu/src/pages/layouts/index.vue +171 -0
  105. package/templates/wevu/tsconfig.json +8 -2
  106. package/templates/wevu-tdesign/package.json +4 -4
  107. package/templates/wevu-tdesign/project.private.config.json +1 -1
  108. package/templates/wevu-tdesign/src/app.vue +1 -0
  109. package/templates/wevu-tdesign/src/components/KpiBoard/index.vue +4 -6
  110. package/templates/wevu-tdesign/src/hooks/useToast.ts +1 -1
  111. package/templates/wevu-tdesign/src/layouts/admin.vue +37 -0
  112. package/templates/wevu-tdesign/src/layouts/default.vue +17 -0
  113. package/templates/wevu-tdesign/src/pages/index/index.vue +10 -0
  114. package/templates/wevu-tdesign/src/pages/layouts/index.vue +96 -0
  115. package/templates/wevu-tdesign/src/subpackages/lab/index.vue +22 -6
  116. package/templates/wevu-tdesign/tsconfig.json +8 -2
  117. package/templates/wevu-tdesign/vite.config.ts +9 -0
  118. package/templates/default/tsconfig.app.json +0 -49
  119. package/templates/default/tsconfig.node.json +0 -33
  120. package/templates/lib/tsconfig.app.json +0 -49
  121. package/templates/lib/tsconfig.node.json +0 -33
  122. package/templates/tailwindcss/tsconfig.app.json +0 -49
  123. package/templates/tailwindcss/tsconfig.node.json +0 -33
  124. package/templates/tdesign/tsconfig.app.json +0 -52
  125. package/templates/tdesign/tsconfig.node.json +0 -33
  126. package/templates/vant/tsconfig.app.json +0 -52
  127. package/templates/vant/tsconfig.node.json +0 -33
  128. package/templates/wevu/src/components.d.ts +0 -25
  129. package/templates/wevu/src/typed-components.d.ts +0 -22
  130. package/templates/wevu/src/typed-router.d.ts +0 -67
  131. package/templates/wevu/tsconfig.app.json +0 -51
  132. package/templates/wevu/tsconfig.node.json +0 -33
  133. package/templates/wevu-tdesign/src/components.d.ts +0 -267
  134. package/templates/wevu-tdesign/src/typed-components.d.ts +0 -955
  135. package/templates/wevu-tdesign/src/typed-router.d.ts +0 -75
  136. package/templates/wevu-tdesign/tsconfig.app.json +0 -54
  137. package/templates/wevu-tdesign/tsconfig.node.json +0 -33
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as TemplateName, t as createProject } from "./src-DFc325BF.js";
1
+ import { n as TemplateName, t as createProject } from "./src-nL81L3Ai.js";
2
2
  import logger from "@weapp-core/logger";
3
3
  import fs from "fs-extra";
4
4
  import path from "node:path";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as TemplateName, t as createProject } from "./src-DFc325BF.js";
1
+ import { n as TemplateName, t as createProject } from "./src-nL81L3Ai.js";
2
2
  export { TemplateName, createProject };
@@ -4,10 +4,10 @@ import fs from "fs-extra";
4
4
  import path from "pathe";
5
5
  import https from "node:https";
6
6
  //#region ../weapp-vite/package.json
7
- var version$1 = "6.10.1";
7
+ var version$1 = "6.11.1";
8
8
  //#endregion
9
9
  //#region ../wevu/package.json
10
- var version = "6.10.1";
10
+ var version = "6.11.1";
11
11
  //#endregion
12
12
  //#region src/enums.ts
13
13
  let TemplateName = /* @__PURE__ */ function(TemplateName) {
@@ -31,8 +31,8 @@ const TEMPLATE_CATALOG = {
31
31
  "@egoist/tailwindcss-icons": "^1.9.2",
32
32
  "@iconify-json/mdi": "^1.2.3",
33
33
  "@mini-types/alipay": "^3.0.14",
34
- "@tailwindcss/postcss": "^4.2.1",
35
- "@tailwindcss/vite": "^4.2.1",
34
+ "@tailwindcss/postcss": "^4.2.2",
35
+ "@tailwindcss/vite": "^4.2.2",
36
36
  "@types/node": "^25.5.0",
37
37
  "@types/semver": "^7.7.1",
38
38
  "@vant/weapp": "^1.11.7",
@@ -52,7 +52,7 @@ const TEMPLATE_CATALOG = {
52
52
  "object-hash": "^3.0.0",
53
53
  "pkg-types": "^2.3.0",
54
54
  "sass-embedded": "^1.98.0",
55
- "tdesign-miniprogram": "^1.12.3",
55
+ "tdesign-miniprogram": "^1.13.0",
56
56
  "ts-morph": "^27.0.2",
57
57
  "vite-plugin-inspect": "^11.3.3",
58
58
  "vue-tsc": "^3.2.6",
@@ -64,13 +64,13 @@ const TEMPLATE_CATALOG = {
64
64
  echarts: "^6.0.0",
65
65
  esbuild: "^0.27.4",
66
66
  fdir: "^6.5.0",
67
- htmlparser2: "^10.1.0",
67
+ htmlparser2: "^12.0.0",
68
68
  lodash: "^4.17.23",
69
69
  merge: "^2.1.1",
70
70
  pathe: "^2.0.3",
71
71
  postcss: "^8.5.8",
72
72
  sass: "^1.98.0",
73
- tailwindcss: "^3.4.19",
73
+ tailwindcss: "^4.2.2",
74
74
  tslib: "^2.8.1",
75
75
  typescript: "^5.9.3",
76
76
  vite: "8.0.0",
@@ -78,13 +78,14 @@ const TEMPLATE_CATALOG = {
78
78
  zod: "^4.3.6"
79
79
  };
80
80
  const TEMPLATE_NAMED_CATALOG = {
81
- "tdesign-miniprogram-fixed": { "tdesign-miniprogram": "1.12.3" },
81
+ "tdesign-miniprogram-fixed": { "tdesign-miniprogram": "1.13.0" },
82
82
  "weapp-tailwindcss-fixed": { "weapp-tailwindcss": "4.10.3" },
83
83
  latest: {
84
84
  "miniprogram-api-typings": "^5.1.2",
85
85
  typescript: "latest"
86
86
  },
87
- tailwind4: { tailwindcss: "^4.2.1" }
87
+ tailwind3: { tailwindcss: "3.4.19" },
88
+ tailwind4: { tailwindcss: "^4.2.2" }
88
89
  };
89
90
  //#endregion
90
91
  //#region src/npm.ts
@@ -296,6 +297,7 @@ async function upsertTailwindcssVersion(pkgJson) {
296
297
  function upsertExistingDependencyVersion(pkgJson, packageName, resolvedVersion) {
297
298
  if (pkgJson.dependencies?.[packageName]) pkgJson.dependencies[packageName] = resolvedVersion;
298
299
  if (pkgJson.devDependencies?.[packageName]) pkgJson.devDependencies[packageName] = resolvedVersion;
300
+ if (pkgJson.peerDependencies?.[packageName]) pkgJson.peerDependencies[packageName] = resolvedVersion;
299
301
  }
300
302
  function toCaretVersion(version) {
301
303
  return version.startsWith("^") ? version : `^${version}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-weapp-vite",
3
3
  "type": "module",
4
- "version": "2.0.52",
4
+ "version": "2.0.55",
5
5
  "description": "create-weapp-vite",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite-template",
3
3
  "type": "module",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "private": true,
6
6
  "description": "原生微信小程序 weapp-vite 模板",
7
7
  "author": "ice breaker <1324318532@qq.com>",
@@ -20,7 +20,8 @@
20
20
  "dev:open": "weapp-vite dev -o",
21
21
  "build": "weapp-vite build",
22
22
  "open": "weapp-vite open",
23
- "g": "weapp-vite generate"
23
+ "g": "weapp-vite generate",
24
+ "postinstall": "weapp-vite prepare"
24
25
  },
25
26
  "devDependencies": {
26
27
  "miniprogram-api-typings": "catalog:",
@@ -2,7 +2,7 @@
2
2
  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
3
  "projectname": "weapp-vite-template",
4
4
  "setting": {
5
- "compileHotReLoad": false
5
+ "compileHotReLoad": true
6
6
  },
7
7
  "libVersion": "3.9.0"
8
8
  }
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/app.json",
3
3
  "pages": [
4
- "pages/index/index"
4
+ "pages/index/index",
5
+ "pages/layouts/index"
5
6
  ],
6
7
  "window": {},
7
8
  "style": "v2",
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,40 @@
1
+ .layout-admin {
2
+ min-height: 100%;
3
+ background:
4
+ radial-gradient(circle at top right, rgb(59 130 246 / 16%), transparent 30%),
5
+ linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
6
+ }
7
+
8
+ .layout-admin__hero {
9
+ padding: 36rpx 32rpx 32rpx;
10
+ color: #fff;
11
+ background: linear-gradient(145deg, #0f172a 0%, #2563eb 64%, #60a5fa 100%);
12
+ border-radius: 0 0 28rpx 28rpx;
13
+ }
14
+
15
+ .layout-admin__eyebrow {
16
+ display: inline-flex;
17
+ padding: 8rpx 16rpx;
18
+ font-size: 22rpx;
19
+ background: rgb(255 255 255 / 14%);
20
+ border-radius: 999rpx;
21
+ }
22
+
23
+ .layout-admin__title {
24
+ display: block;
25
+ margin-top: 18rpx;
26
+ font-size: 42rpx;
27
+ font-weight: 700;
28
+ }
29
+
30
+ .layout-admin__subtitle {
31
+ display: block;
32
+ margin-top: 12rpx;
33
+ font-size: 24rpx;
34
+ line-height: 1.7;
35
+ opacity: 0.92;
36
+ }
37
+
38
+ .layout-admin__body {
39
+ padding-bottom: 32rpx;
40
+ }
@@ -0,0 +1 @@
1
+ Component({})
@@ -0,0 +1,10 @@
1
+ <view class="layout-admin">
2
+ <view class="layout-admin__hero">
3
+ <text class="layout-admin__eyebrow">layouts/admin/index.wxml</text>
4
+ <text class="layout-admin__title">{{title || 'Native Admin Layout'}}</text>
5
+ <text class="layout-admin__subtitle">{{subtitle || '原生基础模板也支持 setPageLayout()。'}}</text>
6
+ </view>
7
+ <view class="layout-admin__body">
8
+ <slot />
9
+ </view>
10
+ </view>
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,3 @@
1
+ .layout-default {
2
+ min-height: 100%;
3
+ }
@@ -0,0 +1 @@
1
+ Component({})
@@ -0,0 +1,3 @@
1
+ <view class="layout-default">
2
+ <slot />
3
+ </view>
@@ -21,4 +21,9 @@ Page({
21
21
  // eslint-disable-next-line no-console
22
22
  console.log('on click')
23
23
  },
24
+ goToLayouts() {
25
+ wx.navigateTo({
26
+ url: '/pages/layouts/index',
27
+ })
28
+ },
24
29
  })
@@ -11,4 +11,7 @@
11
11
  docs="{{hello.docs}}"
12
12
  links="{{hello.links}}"
13
13
  />
14
+ <view style="padding: 24rpx 32rpx 48rpx;">
15
+ <button bindtap="goToLayouts">打开布局演示页</button>
16
+ </view>
14
17
  </view>
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "navigationBarTitleText": "布局能力"
4
+ }
@@ -0,0 +1,68 @@
1
+ .page {
2
+ box-sizing: border-box;
3
+ min-height: 100vh;
4
+ padding: 32rpx;
5
+ }
6
+
7
+ .hero,
8
+ .section {
9
+ padding: 28rpx;
10
+ margin-top: 20rpx;
11
+ background: rgb(255 255 255 / 94%);
12
+ border: 2rpx solid rgb(226 232 240 / 90%);
13
+ border-radius: 28rpx;
14
+ }
15
+
16
+ .hero {
17
+ margin-top: 0;
18
+ background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
19
+ }
20
+
21
+ .hero__eyebrow {
22
+ font-size: 22rpx;
23
+ font-weight: 600;
24
+ color: #1d4ed8;
25
+ }
26
+
27
+ .hero__title {
28
+ margin-top: 12rpx;
29
+ font-size: 38rpx;
30
+ font-weight: 700;
31
+ color: #0f172a;
32
+ }
33
+
34
+ .hero__desc,
35
+ .section-desc {
36
+ display: block;
37
+ margin-top: 12rpx;
38
+ font-size: 24rpx;
39
+ line-height: 1.7;
40
+ color: #475569;
41
+ }
42
+
43
+ .section-title {
44
+ font-size: 28rpx;
45
+ font-weight: 700;
46
+ color: #0f172a;
47
+ }
48
+
49
+ .action-btn {
50
+ margin-top: 16rpx;
51
+ color: #fff;
52
+ background: #0f172a;
53
+ border-radius: 999rpx;
54
+ }
55
+
56
+ .action-btn--primary {
57
+ background: #2563eb;
58
+ }
59
+
60
+ .action-btn--ghost {
61
+ color: #0f172a;
62
+ background: #e2e8f0;
63
+ }
64
+
65
+ .action-btn--light {
66
+ color: #1d4ed8;
67
+ background: #dbeafe;
68
+ }
@@ -0,0 +1,42 @@
1
+ import { setPageLayout } from 'weapp-vite/runtime'
2
+
3
+ Page({
4
+ data: {
5
+ currentLayout: 'default',
6
+ cards: [
7
+ {
8
+ title: 'default 布局',
9
+ desc: '页面默认命中 src/layouts/default 作为轻量外壳。',
10
+ },
11
+ {
12
+ title: 'admin 布局',
13
+ desc: '调用 setPageLayout("admin", props) 后会切换到命名布局。',
14
+ },
15
+ {
16
+ title: '关闭布局',
17
+ desc: '调用 setPageLayout(false) 可恢复为无布局状态。',
18
+ },
19
+ ],
20
+ },
21
+ onLoad() {
22
+ setPageLayout('default')
23
+ },
24
+ applyDefaultLayout() {
25
+ this.setData({ currentLayout: 'default' })
26
+ setPageLayout('default')
27
+ },
28
+ applyAdminLayout() {
29
+ this.setData({ currentLayout: 'admin' })
30
+ setPageLayout('admin', {
31
+ title: 'Native Console',
32
+ subtitle: '这个标题来自原生 Page 调用 setPageLayout()。',
33
+ })
34
+ },
35
+ clearLayout() {
36
+ this.setData({ currentLayout: 'none' })
37
+ setPageLayout(false)
38
+ },
39
+ backHome() {
40
+ wx.navigateTo({ url: '/pages/index/index' })
41
+ },
42
+ })
@@ -0,0 +1,19 @@
1
+ <view class="page">
2
+ <view class="hero">
3
+ <view class="hero__eyebrow">Native Layouts</view>
4
+ <view class="hero__title">基础模板已接入 layouts</view>
5
+ <view class="hero__desc">当前状态:{{currentLayout}}</view>
6
+ </view>
7
+
8
+ <view wx:for="{{cards}}" wx:key="title" class="section">
9
+ <view class="section-title">{{item.title}}</view>
10
+ <view class="section-desc">{{item.desc}}</view>
11
+ </view>
12
+
13
+ <view class="section">
14
+ <button class="action-btn" bindtap="applyDefaultLayout">使用 default 布局</button>
15
+ <button class="action-btn action-btn--primary" bindtap="applyAdminLayout">切到 admin 布局</button>
16
+ <button class="action-btn action-btn--ghost" bindtap="clearLayout">关闭布局</button>
17
+ <button class="action-btn action-btn--light" bindtap="backHome">返回首页</button>
18
+ </view>
19
+ </view>
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "references": [
3
3
  {
4
- "path": "./tsconfig.app.json"
4
+ "path": "./.weapp-vite/tsconfig.app.json"
5
5
  },
6
6
  {
7
- "path": "./tsconfig.node.json"
7
+ "path": "./.weapp-vite/tsconfig.server.json"
8
+ },
9
+ {
10
+ "path": "./.weapp-vite/tsconfig.node.json"
11
+ },
12
+ {
13
+ "path": "./.weapp-vite/tsconfig.shared.json"
8
14
  }
9
15
  ],
10
16
  "files": []
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite-lib-template",
3
3
  "type": "module",
4
- "version": "1.0.1",
4
+ "version": "2.0.1",
5
5
  "private": true,
6
6
  "description": "weapp-vite 组件库(lib 模式)模板",
7
7
  "author": "ice breaker <1324318532@qq.com>",
@@ -21,7 +21,11 @@
21
21
  "build": "weapp-vite build",
22
22
  "build:lib": "weapp-vite build --config weapp-vite.lib.config.ts",
23
23
  "open": "weapp-vite open",
24
- "g": "weapp-vite generate"
24
+ "g": "weapp-vite generate",
25
+ "postinstall": "weapp-vite prepare"
26
+ },
27
+ "peerDependencies": {
28
+ "wevu": "workspace:*"
25
29
  },
26
30
  "devDependencies": {
27
31
  "miniprogram-api-typings": "catalog:",
@@ -2,7 +2,7 @@
2
2
  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
3
  "projectname": "weapp-vite-lib-template",
4
4
  "setting": {
5
- "compileHotReLoad": false
5
+ "compileHotReLoad": true
6
6
  },
7
7
  "libVersion": "3.9.0"
8
8
  }
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/app.json",
3
3
  "pages": [
4
- "pages/index/index"
4
+ "pages/index/index",
5
+ "pages/layouts/index"
5
6
  ],
6
7
  "window": {},
7
8
  "style": "v2",
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,41 @@
1
+ .layout-admin {
2
+ min-height: 100%;
3
+ background:
4
+ radial-gradient(circle at top right, rgb(15 23 42 / 16%), transparent 28%),
5
+ linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
6
+ }
7
+
8
+ .layout-admin__hero {
9
+ padding: 36rpx 32rpx 32rpx;
10
+ color: #fff;
11
+ background: linear-gradient(145deg, #0f172a 0%, #2563eb 64%, #60a5fa 100%);
12
+ border-radius: 0 0 28rpx 28rpx;
13
+ box-shadow: 0 18rpx 42rpx rgb(37 99 235 / 16%);
14
+ }
15
+
16
+ .layout-admin__eyebrow {
17
+ display: inline-flex;
18
+ padding: 8rpx 16rpx;
19
+ font-size: 22rpx;
20
+ background: rgb(255 255 255 / 14%);
21
+ border-radius: 999rpx;
22
+ }
23
+
24
+ .layout-admin__title {
25
+ display: block;
26
+ margin-top: 18rpx;
27
+ font-size: 44rpx;
28
+ font-weight: 700;
29
+ }
30
+
31
+ .layout-admin__subtitle {
32
+ display: block;
33
+ margin-top: 12rpx;
34
+ font-size: 24rpx;
35
+ line-height: 1.7;
36
+ opacity: 0.92;
37
+ }
38
+
39
+ .layout-admin__body {
40
+ padding-bottom: 32rpx;
41
+ }
@@ -0,0 +1 @@
1
+ Component({})
@@ -0,0 +1,10 @@
1
+ <view class="layout-admin">
2
+ <view class="layout-admin__hero">
3
+ <text class="layout-admin__eyebrow">layouts/admin/index.wxml</text>
4
+ <text class="layout-admin__title">{{title || 'Library Admin Layout'}}</text>
5
+ <text class="layout-admin__subtitle">{{subtitle || '原生 Page 模板也可以通过 setPageLayout() 切换布局。'}}</text>
6
+ </view>
7
+ <view class="layout-admin__body">
8
+ <slot />
9
+ </view>
10
+ </view>
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,3 @@
1
+ .layout-default {
2
+ min-height: 100%;
3
+ }
@@ -0,0 +1 @@
1
+ Component({})
@@ -0,0 +1,3 @@
1
+ <view class="layout-default">
2
+ <slot />
3
+ </view>
@@ -7,12 +7,12 @@
7
7
  .hero {
8
8
  display: flex;
9
9
  flex-direction: column;
10
- align-items: center;
11
10
  gap: 12rpx;
11
+ align-items: center;
12
12
  padding: 24rpx;
13
- background: #ffffff;
13
+ background: #fff;
14
14
  border-radius: 24rpx;
15
- box-shadow: 0 12rpx 28rpx rgba(15, 23, 42, 0.08);
15
+ box-shadow: 0 12rpx 28rpx rgb(15 23 42 / 8%);
16
16
  }
17
17
 
18
18
  .logo {
@@ -32,6 +32,10 @@
32
32
  text-align: center;
33
33
  }
34
34
 
35
+ .subtitle--section {
36
+ text-align: left;
37
+ }
38
+
35
39
  .section {
36
40
  margin-top: 32rpx;
37
41
  }
@@ -48,3 +52,10 @@
48
52
  flex-direction: column;
49
53
  gap: 16rpx;
50
54
  }
55
+
56
+ .layout-btn {
57
+ margin-top: 16rpx;
58
+ color: #fff;
59
+ background: #2563eb;
60
+ border-radius: 999rpx;
61
+ }
@@ -17,4 +17,9 @@ Page({
17
17
  ],
18
18
  },
19
19
  },
20
+ goToLayouts() {
21
+ wx.navigateTo({
22
+ url: '/pages/layouts/index',
23
+ })
24
+ },
20
25
  })
@@ -23,4 +23,10 @@
23
23
  <sfc-both />
24
24
  </view>
25
25
  </view>
26
+
27
+ <view class="section">
28
+ <view class="section-title">Page layouts</view>
29
+ <view class="subtitle subtitle--section">原生页面也可使用 src/layouts 与 setPageLayout()。</view>
30
+ <button class="layout-btn" bindtap="goToLayouts">打开布局演示页</button>
31
+ </view>
26
32
  </view>
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "navigationBarTitleText": "布局能力"
4
+ }
@@ -0,0 +1,70 @@
1
+ .page {
2
+ box-sizing: border-box;
3
+ min-height: 100vh;
4
+ padding: 32rpx;
5
+ }
6
+
7
+ .hero,
8
+ .section {
9
+ padding: 28rpx;
10
+ margin-top: 20rpx;
11
+ background: rgb(255 255 255 / 94%);
12
+ border: 2rpx solid rgb(226 232 240 / 90%);
13
+ border-radius: 28rpx;
14
+ box-shadow: 0 12rpx 32rpx rgb(15 23 42 / 4%);
15
+ }
16
+
17
+ .hero {
18
+ margin-top: 0;
19
+ background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
20
+ border-color: #bfdbfe;
21
+ }
22
+
23
+ .hero__eyebrow {
24
+ font-size: 22rpx;
25
+ font-weight: 600;
26
+ color: #1d4ed8;
27
+ }
28
+
29
+ .hero__title {
30
+ margin-top: 12rpx;
31
+ font-size: 38rpx;
32
+ font-weight: 700;
33
+ color: #0f172a;
34
+ }
35
+
36
+ .hero__desc,
37
+ .section-desc {
38
+ display: block;
39
+ margin-top: 12rpx;
40
+ font-size: 24rpx;
41
+ line-height: 1.7;
42
+ color: #475569;
43
+ }
44
+
45
+ .section-title {
46
+ font-size: 28rpx;
47
+ font-weight: 700;
48
+ color: #0f172a;
49
+ }
50
+
51
+ .action-btn {
52
+ margin-top: 16rpx;
53
+ color: #fff;
54
+ background: #0f172a;
55
+ border-radius: 999rpx;
56
+ }
57
+
58
+ .action-btn--primary {
59
+ background: #2563eb;
60
+ }
61
+
62
+ .action-btn--ghost {
63
+ color: #0f172a;
64
+ background: #e2e8f0;
65
+ }
66
+
67
+ .action-btn--light {
68
+ color: #1d4ed8;
69
+ background: #dbeafe;
70
+ }