@stdex/create 0.0.0-stage → 1.2.0

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +66 -2
  3. package/README_EN.md +67 -0
  4. package/package.json +40 -3
  5. package/src/eslint.config.js +2 -0
  6. package/src/index.js +233 -0
  7. package/templates/base/eslint.config.js +2 -0
  8. package/templates/base/index.js +3 -0
  9. package/templates/base/package.json +16 -0
  10. package/templates/miniprogram/README.md +27 -0
  11. package/templates/miniprogram/_gitignore +3 -0
  12. package/templates/miniprogram/eslint.config.cjs +25 -0
  13. package/templates/miniprogram/gulpfile.js +81 -0
  14. package/templates/miniprogram/package.json +22 -0
  15. package/templates/miniprogram/project.config.json +31 -0
  16. package/templates/miniprogram/project.private.config.json +8 -0
  17. package/templates/miniprogram/src/app.json +16 -0
  18. package/templates/miniprogram/src/app.scss +0 -0
  19. package/templates/miniprogram/src/app.ts +6 -0
  20. package/templates/miniprogram/src/lib/app-data.ts +46 -0
  21. package/templates/miniprogram/src/pages/index/index.json +3 -0
  22. package/templates/miniprogram/src/pages/index/index.scss +11 -0
  23. package/templates/miniprogram/src/pages/index/index.ts +13 -0
  24. package/templates/miniprogram/src/pages/index/index.wxml +1 -0
  25. package/templates/miniprogram/src/sitemap.json +9 -0
  26. package/templates/miniprogram/tsconfig.json +11 -0
  27. package/templates/miniprogram/typings/index.d.ts +5 -0
  28. package/templates/miniprogram/typings/types/index.d.ts +1 -0
  29. package/templates/miniprogram/typings/types/wx/index.d.ts +162 -0
  30. package/templates/miniprogram/typings/types/wx/lib.wx.api.d.ts +32387 -0
  31. package/templates/miniprogram/typings/types/wx/lib.wx.app.d.ts +400 -0
  32. package/templates/miniprogram/typings/types/wx/lib.wx.behavior.d.ts +68 -0
  33. package/templates/miniprogram/typings/types/wx/lib.wx.canvas.d.ts +2623 -0
  34. package/templates/miniprogram/typings/types/wx/lib.wx.cloud.d.ts +1016 -0
  35. package/templates/miniprogram/typings/types/wx/lib.wx.component.d.ts +700 -0
  36. package/templates/miniprogram/typings/types/wx/lib.wx.event.d.ts +1436 -0
  37. package/templates/miniprogram/typings/types/wx/lib.wx.page.d.ts +272 -0
  38. package/templates/miniprogram/typings/types/wx/lib.wx.phys3D.d.ts +409 -0
  39. package/templates/miniprogram/typings/types/wx/lib.wx.wasm.d.ts +152 -0
  40. package/templates/miniprogram/typings/types/wx/lib.wx.xr-frame.d.ts +15631 -0
  41. package/templates/miniprogram/variables.json +11 -0
  42. package/templates/service/README.md +64 -0
  43. package/templates/service/_env +1 -0
  44. package/templates/service/_gitignore +5 -0
  45. package/templates/service/eslint.config.js +2 -0
  46. package/templates/service/package.json +48 -0
  47. package/templates/service/prisma/schema.prisma +40 -0
  48. package/templates/service/prisma/sql/demoTypedSql.sql +1 -0
  49. package/templates/service/prisma.config.ts +12 -0
  50. package/templates/service/setup.js +4 -0
  51. package/templates/service/src/cache.ts +28 -0
  52. package/templates/service/src/config.ts +49 -0
  53. package/templates/service/src/controllers/common.ts +43 -0
  54. package/templates/service/src/controllers/demo-school.ts +7 -0
  55. package/templates/service/src/controllers/demo-student.ts +7 -0
  56. package/templates/service/src/controllers/index.ts +15 -0
  57. package/templates/service/src/database.ts +52 -0
  58. package/templates/service/src/index.ts +15 -0
  59. package/templates/service/src/logger.ts +10 -0
  60. package/templates/service/src/routes/demo-school.ts +9 -0
  61. package/templates/service/src/routes/index.ts +3 -0
  62. package/templates/service/src/routes/router.ts +42 -0
  63. package/templates/service/src/tasks/common.ts +25 -0
  64. package/templates/service/src/tasks/demo-school.ts +10 -0
  65. package/templates/service/src/tasks/index.ts +1 -0
  66. package/templates/service/tsconfig.build.json +9 -0
  67. package/templates/service/tsconfig.json +10 -0
  68. package/templates/site/_gitignore +3 -0
  69. package/templates/site/_pnpm-workspace.yaml +4 -0
  70. package/templates/site/eslint.config.js +19 -0
  71. package/templates/site/package.json +41 -0
  72. package/templates/site/public/favicon.png +0 -0
  73. package/templates/site/src/app/header.tsx +31 -0
  74. package/templates/site/src/app/index.tsx +38 -0
  75. package/templates/site/src/app/layout.tsx +63 -0
  76. package/templates/site/src/app/menu.tsx +115 -0
  77. package/templates/site/src/app/router.tsx +50 -0
  78. package/templates/site/src/app/style.css +9 -0
  79. package/templates/site/src/assets/logo.png +0 -0
  80. package/templates/site/src/components/Breadcrumb.tsx +47 -0
  81. package/templates/site/src/components/DevStatus.tsx +14 -0
  82. package/templates/site/src/index.html +13 -0
  83. package/templates/site/src/index.tsx +5 -0
  84. package/templates/site/src/lib/config.ts +6 -0
  85. package/templates/site/src/lib/init-dayjs.ts +8 -0
  86. package/templates/site/src/lib/logging.ts +5 -0
  87. package/templates/site/src/views/dashboard.tsx +7 -0
  88. package/templates/site/src/views/school-detail.tsx +13 -0
  89. package/templates/site/src/views/school-ranking.tsx +7 -0
  90. package/templates/site/src/views/schools.tsx +43 -0
  91. package/templates/site/src/views/setting.tsx +7 -0
  92. package/templates/site/src/views/student-score.tsx +7 -0
  93. package/templates/site/src/views/students.tsx +7 -0
  94. package/templates/site/tsconfig.json +10 -0
  95. package/templates/site/vite.config.js +60 -0
@@ -0,0 +1,400 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) 2023 Tencent, Inc. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8
+ of the Software, and to permit persons to whom the Software is furnished to do
9
+ so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ ***************************************************************************** */
22
+
23
+ declare namespace WechatMiniprogram.App {
24
+ type SceneValues =
25
+ | 1000
26
+ | 1001
27
+ | 1005
28
+ | 1006
29
+ | 1007
30
+ | 1008
31
+ | 1010
32
+ | 1011
33
+ | 1012
34
+ | 1013
35
+ | 1014
36
+ | 1017
37
+ | 1019
38
+ | 1020
39
+ | 1022
40
+ | 1023
41
+ | 1024
42
+ | 1025
43
+ | 1026
44
+ | 1027
45
+ | 1028
46
+ | 1029
47
+ | 1030
48
+ | 1031
49
+ | 1032
50
+ | 1034
51
+ | 1035
52
+ | 1036
53
+ | 1037
54
+ | 1038
55
+ | 1039
56
+ | 1042
57
+ | 1043
58
+ | 1044
59
+ | 1045
60
+ | 1046
61
+ | 1047
62
+ | 1048
63
+ | 1049
64
+ | 1052
65
+ | 1053
66
+ | 1054
67
+ | 1056
68
+ | 1057
69
+ | 1058
70
+ | 1059
71
+ | 1060
72
+ | 1064
73
+ | 1065
74
+ | 1067
75
+ | 1068
76
+ | 1069
77
+ | 1071
78
+ | 1072
79
+ | 1073
80
+ | 1074
81
+ | 1077
82
+ | 1078
83
+ | 1079
84
+ | 1081
85
+ | 1082
86
+ | 1084
87
+ | 1088
88
+ | 1089
89
+ | 1090
90
+ | 1091
91
+ | 1092
92
+ | 1095
93
+ | 1096
94
+ | 1097
95
+ | 1099
96
+ | 1100
97
+ | 1101
98
+ | 1102
99
+ | 1103
100
+ | 1104
101
+ | 1106
102
+ | 1107
103
+ | 1113
104
+ | 1114
105
+ | 1119
106
+ | 1120
107
+ | 1121
108
+ | 1124
109
+ | 1125
110
+ | 1126
111
+ | 1129
112
+ | 1131
113
+ | 1133
114
+ | 1135
115
+ | 1144
116
+ | 1145
117
+ | 1146
118
+ | 1148
119
+ | 1150
120
+ | 1151
121
+ | 1152
122
+ | 1153
123
+ | 1154
124
+ | 1155
125
+ | 1157
126
+ | 1158
127
+ | 1160
128
+ | 1167
129
+ | 1168
130
+ | 1169
131
+ | 1171
132
+ | 1173
133
+ | 1175
134
+ | 1176
135
+ | 1177
136
+ | 1178
137
+ | 1179
138
+ | 1181
139
+ | 1183
140
+ | 1184
141
+ | 1185
142
+ | 1186
143
+ | 1187
144
+ | 1189
145
+ | 1191
146
+ | 1192
147
+ | 1193
148
+ | 1194
149
+ | 1195
150
+ | 1196
151
+ | 1197
152
+ | 1198
153
+ | 1200
154
+ | 1201
155
+ | 1202
156
+ | 1203
157
+ | 1206
158
+ | 1207
159
+ | 1208
160
+ | 1212
161
+ | 1215
162
+ | 1216
163
+ | 1223
164
+ | 1228
165
+ | 1231
166
+
167
+ interface LaunchShowOption {
168
+ /** 打开小程序的路径 */
169
+ path: string
170
+ /** 打开小程序的query */
171
+ query: IAnyObject
172
+ /** 打开小程序的场景值
173
+ * - 1000:其他
174
+ * - 1001:发现栏小程序主入口,「最近使用」列表(基础库 2.2.4 版本起包含「我的小程序」列表)
175
+ * - 1005:微信首页顶部搜索框的搜索结果页
176
+ * - 1006:发现栏小程序主入口搜索框的搜索结果页
177
+ * - 1007:单人聊天会话中的小程序消息卡片
178
+ * - 1008:群聊会话中的小程序消息卡片
179
+ * - 1010:收藏夹
180
+ * - 1011:扫描二维码
181
+ * - 1012:长按图片识别二维码
182
+ * - 1013:扫描手机相册中选取的二维码
183
+ * - 1014:小程序订阅消息(与 1107 相同)
184
+ * - 1017:前往小程序体验版的入口页
185
+ * - 1019:微信钱包(微信客户端 7.0.0 版本改为支付入口)
186
+ * - 1020:公众号 profile 页相关小程序列表(已废弃)
187
+ * - 1022:聊天顶部置顶小程序入口(微信客户端 6.6.1 版本起废弃)
188
+ * - 1023:安卓系统桌面图标
189
+ * - 1024:小程序 profile 页
190
+ * - 1025:扫描一维码
191
+ * - 1026:发现栏小程序主入口,「附近的小程序」列表
192
+ * - 1027:微信首页顶部搜索框搜索结果页「使用过的小程序」列表
193
+ * - 1028:我的卡包
194
+ * - 1029:小程序中的卡券详情页
195
+ * - 1030:自动化测试下打开小程序
196
+ * - 1031:长按图片识别一维码
197
+ * - 1032:扫描手机相册中选取的一维码
198
+ * - 1034:微信支付完成页
199
+ * - 1035:公众号自定义菜单
200
+ * - 1036:App 分享消息卡片
201
+ * - 1037:小程序打开小程序
202
+ * - 1038:从另一个小程序返回
203
+ * - 1039:摇电视
204
+ * - 1042:添加好友搜索框的搜索结果页
205
+ * - 1043:公众号模板消息
206
+ * - 1044:带 shareTicket 的小程序消息卡片 [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html)
207
+ * - 1045:朋友圈广告
208
+ * - 1046:朋友圈广告详情页
209
+ * - 1047:扫描小程序码
210
+ * - 1048:长按图片识别小程序码
211
+ * - 1049:扫描手机相册中选取的小程序码
212
+ * - 1052:卡券的适用门店列表
213
+ * - 1053:搜一搜的结果页
214
+ * - 1054:顶部搜索框小程序快捷入口(微信客户端版本 6.7.4 起废弃)
215
+ * - 1056:聊天顶部音乐播放器右上角菜单
216
+ * - 1057:钱包中的银行卡详情页
217
+ * - 1058:公众号文章
218
+ * - 1059:体验版小程序绑定邀请页
219
+ * - 1060:微信支付完成页(与 1034 相同)
220
+ * - 1064:微信首页连 Wi-Fi 状态栏
221
+ * - 1065:URL scheme [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-scheme.html)
222
+ * - 1067:公众号文章广告
223
+ * - 1068:附近小程序列表广告(已废弃)
224
+ * - 1069:移动应用通过 openSDK 进入微信,打开小程序
225
+ * - 1071:钱包中的银行卡列表页
226
+ * - 1072:二维码收款页面
227
+ * - 1073:客服消息列表下发的小程序消息卡片
228
+ * - 1074:公众号会话下发的小程序消息卡片
229
+ * - 1077:摇周边
230
+ * - 1078:微信连 Wi-Fi 成功提示页
231
+ * - 1079:微信游戏中心
232
+ * - 1081:客服消息下发的文字链
233
+ * - 1082:公众号会话下发的文字链
234
+ * - 1084:朋友圈广告原生页
235
+ * - 1088:会话中查看系统消息,打开小程序
236
+ * - 1089:微信聊天主界面下拉,「最近使用」栏(基础库 2.2.4 版本起包含「我的小程序」栏)
237
+ * - 1090:长按小程序右上角菜单唤出最近使用历史
238
+ * - 1091:公众号文章商品卡片
239
+ * - 1092:城市服务入口
240
+ * - 1095:小程序广告组件
241
+ * - 1096:聊天记录,打开小程序
242
+ * - 1097:微信支付签约原生页,打开小程序
243
+ * - 1099:页面内嵌插件
244
+ * - 1100:红包封面详情页打开小程序
245
+ * - 1101:远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)
246
+ * - 1102:公众号 profile 页服务预览
247
+ * - 1103:发现栏小程序主入口,「我的小程序」列表(基础库 2.2.4 版本起废弃)
248
+ * - 1104:微信聊天主界面下拉,「我的小程序」栏(基础库 2.2.4 版本起废弃)
249
+ * - 1106:聊天主界面下拉,从顶部搜索结果页,打开小程序
250
+ * - 1107:订阅消息,打开小程序
251
+ * - 1113:安卓手机负一屏,打开小程序(三星)
252
+ * - 1114:安卓手机侧边栏,打开小程序(三星)
253
+ * - 1119:【企业微信】工作台内打开小程序
254
+ * - 1120:【企业微信】个人资料页内打开小程序
255
+ * - 1121:【企业微信】聊天加号附件框内打开小程序
256
+ * - 1124:扫“一物一码”打开小程序
257
+ * - 1125:长按图片识别“一物一码”
258
+ * - 1126:扫描手机相册中选取的“一物一码”
259
+ * - 1129:微信爬虫访问 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html)
260
+ * - 1131:浮窗(8.0 版本起仅包含被动浮窗)
261
+ * - 1133:硬件设备打开小程序 [详情](https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/)
262
+ * - 1135:小程序 profile 页相关小程序列表,打开小程序
263
+ * - 1144:公众号文章 - 视频贴片
264
+ * - 1145:发现栏 - 发现小程序
265
+ * - 1146:地理位置信息打开出行类小程序
266
+ * - 1148:卡包-交通卡,打开小程序
267
+ * - 1150:扫一扫商品条码结果页打开小程序
268
+ * - 1151:发现栏 - 我的订单
269
+ * - 1152:订阅号视频打开小程序
270
+ * - 1153:“识物”结果页打开小程序
271
+ * - 1154:朋友圈内打开“单页模式”
272
+ * - 1155:“单页模式”打开小程序
273
+ * - 1157:服务号会话页打开小程序
274
+ * - 1158:群工具打开小程序
275
+ * - 1160:群待办
276
+ * - 1167:H5 通过开放标签打开小程序 [详情](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html)
277
+ * - 1168:移动应用直接运行小程序
278
+ * - 1169:发现栏小程序主入口,各个生活服务入口(例如快递服务、出行服务等)
279
+ * - 1171:微信运动记录(仅安卓)
280
+ * - 1173:聊天素材用小程序打开 [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/material/support_material.html)
281
+ * - 1175:视频号主页商店入口
282
+ * - 1176:视频号直播间主播打开小程序
283
+ * - 1177:视频号直播商品
284
+ * - 1178:在电脑打开手机上打开的小程序
285
+ * - 1179:#话题页打开小程序
286
+ * - 1181:网站应用打开 PC 小程序
287
+ * - 1183:PC 微信 - 小程序面板 - 发现小程序 - 搜索
288
+ * - 1184:视频号链接打开小程序
289
+ * - 1185:群公告
290
+ * - 1186:收藏 - 笔记
291
+ * - 1187:浮窗(8.0 版本起)
292
+ * - 1189:表情雨广告
293
+ * - 1191:视频号活动
294
+ * - 1192:企业微信联系人 profile 页
295
+ * - 1193:视频号主页服务菜单打开小程序
296
+ * - 1194:URL Link [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-link.html)
297
+ * - 1195:视频号主页商品 tab
298
+ * - 1196:个人状态打开小程序
299
+ * - 1197:视频号主播从直播间返回小游戏
300
+ * - 1198:视频号开播界面打开小游戏
301
+ * - 1200:视频号广告打开小程序
302
+ * - 1201:视频号广告详情页打开小程序
303
+ * - 1202:企微客服号会话打开小程序卡片
304
+ * - 1203:微信小程序压测工具的请求
305
+ * - 1206:视频号小游戏直播间打开小游戏
306
+ * - 1207:企微客服号会话打开小程序文字链
307
+ * - 1208:聊天打开商品卡片
308
+ * - 1212:青少年模式申请页打开小程序
309
+ * - 1215:广告预约打开小程序
310
+ * - 1216:视频号订单中心打开小程序
311
+ * - 1223:安卓桌面 Widget 打开小程序
312
+ * - 1228:视频号原生广告组件打开小程序
313
+ * - 1231:动态消息提醒入口打开小程序
314
+ */
315
+ scene: SceneValues
316
+ /** shareTicket,详见 [获取更多转发信息]((转发#获取更多转发信息)) */
317
+ shareTicket: string
318
+ /** 当场景为由从另一个小程序或公众号或App打开时,返回此字段 */
319
+ referrerInfo?: ReferrerInfo
320
+ }
321
+
322
+ interface PageNotFoundOption {
323
+ /** 不存在页面的路径 */
324
+ path: string
325
+ /** 打开不存在页面的 query */
326
+ query: IAnyObject
327
+ /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
328
+ isEntryPage: boolean
329
+ }
330
+
331
+ interface Option {
332
+ /** 生命周期回调—监听小程序初始化
333
+ *
334
+ * 小程序初始化完成时触发,全局只触发一次。
335
+ */
336
+ onLaunch(options: LaunchShowOption): void
337
+ /** 生命周期回调—监听小程序显示
338
+ *
339
+ * 小程序启动,或从后台进入前台显示时
340
+ */
341
+ onShow(options: LaunchShowOption): void
342
+ /** 生命周期回调—监听小程序隐藏
343
+ *
344
+ * 小程序从前台进入后台时
345
+ */
346
+ onHide(): void
347
+ /** 错误监听函数
348
+ *
349
+ * 小程序发生脚本错误,或者 api
350
+ */
351
+ onError(/** 错误信息,包含堆栈 */ error: string): void
352
+ /** 页面不存在监听函数
353
+ *
354
+ * 小程序要打开的页面不存在时触发,会带上页面信息回调该函数
355
+ *
356
+ * **注意:**
357
+ * 1. 如果开发者没有添加 `onPageNotFound` 监听,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
358
+ * 2. 如果 `onPageNotFound` 回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再回调 `onPageNotFound`。
359
+ *
360
+ * 最低基础库: 1.9.90
361
+ */
362
+ onPageNotFound(options: PageNotFoundOption): void
363
+ /**
364
+ * 小程序有未处理的 Promise 拒绝时触发。也可以使用 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 绑定监听。注意事项请参考 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)。
365
+ * **参数**:与 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 一致
366
+ */
367
+ onUnhandledRejection: OnUnhandledRejectionCallback
368
+ /**
369
+ * 系统切换主题时触发。也可以使用 wx.onThemeChange 绑定监听。
370
+ *
371
+ * 最低基础库: 2.11.0
372
+ */
373
+ onThemeChange: OnThemeChangeCallback
374
+ }
375
+
376
+ type Instance<T extends IAnyObject> = Option & T
377
+ type Options<T extends IAnyObject> = Partial<Option> &
378
+ T &
379
+ ThisType<Instance<T>>
380
+ type TrivialInstance = Instance<IAnyObject>
381
+
382
+ interface Constructor {
383
+ <T extends IAnyObject>(options: Options<T>): void
384
+ }
385
+
386
+ interface GetAppOption {
387
+ /** 在 `App` 未定义时返回默认实现。当App被调用时,默认实现中定义的属性会被覆盖合并到App中。一般用于独立分包
388
+ *
389
+ * 最低基础库: 2.2.4
390
+ */
391
+ allowDefault?: boolean
392
+ }
393
+
394
+ interface GetApp {
395
+ <T extends IAnyObject = IAnyObject>(opts?: GetAppOption): Instance<T>
396
+ }
397
+ }
398
+
399
+ declare let App: WechatMiniprogram.App.Constructor
400
+ declare let getApp: WechatMiniprogram.App.GetApp
@@ -0,0 +1,68 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) 2023 Tencent, Inc. All rights reserved.
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the "Software"), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8
+ of the Software, and to permit persons to whom the Software is furnished to do
9
+ so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ ***************************************************************************** */
22
+
23
+ declare namespace WechatMiniprogram.Behavior {
24
+ type BehaviorIdentifier = string
25
+ type Instance<
26
+ TData extends DataOption,
27
+ TProperty extends PropertyOption,
28
+ TMethod extends MethodOption,
29
+ TCustomInstanceProperty extends IAnyObject = Record<string, never>
30
+ > = Component.Instance<TData, TProperty, TMethod, TCustomInstanceProperty>
31
+ type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject>
32
+ type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject>
33
+ type Options<
34
+ TData extends DataOption,
35
+ TProperty extends PropertyOption,
36
+ TMethod extends MethodOption,
37
+ TCustomInstanceProperty extends IAnyObject = Record<string, never>
38
+ > = Partial<Data<TData>> &
39
+ Partial<Property<TProperty>> &
40
+ Partial<Method<TMethod>> &
41
+ Partial<OtherOption> &
42
+ Partial<Lifetimes> &
43
+ ThisType<Instance<TData, TProperty, TMethod, TCustomInstanceProperty>>
44
+ interface Constructor {
45
+ <
46
+ TData extends DataOption,
47
+ TProperty extends PropertyOption,
48
+ TMethod extends MethodOption,
49
+ TCustomInstanceProperty extends IAnyObject = Record<string, never>
50
+ >(
51
+ options: Options<TData, TProperty, TMethod, TCustomInstanceProperty>
52
+ ): BehaviorIdentifier
53
+ }
54
+
55
+ type DataOption = Component.DataOption
56
+ type PropertyOption = Component.PropertyOption
57
+ type MethodOption = Component.MethodOption
58
+ type Data<D extends DataOption> = Component.Data<D>
59
+ type Property<P extends PropertyOption> = Component.Property<P>
60
+ type Method<M extends MethodOption> = Component.Method<M>
61
+
62
+ type DefinitionFilter = Component.DefinitionFilter
63
+ type Lifetimes = Component.Lifetimes
64
+
65
+ type OtherOption = Omit<Component.OtherOption, 'options'>
66
+ }
67
+ /** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
68
+ declare let Behavior: WechatMiniprogram.Behavior.Constructor