111111111

This commit is contained in:
ranranran12123 2025-04-11 14:42:29 +08:00
parent 5a70e6f2bd
commit b06fdc9259
1134 changed files with 155895 additions and 7144 deletions

View File

@ -0,0 +1,20 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"mp-alipay" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

View File

@ -1 +1,6 @@
export const apiImageUrl = 'http://39.101.78.35:6271' // 测试服务器
//export const apiImageUrl = 'http://39.101.78.35:6271'
//export const apiImageUrl = 'http://localhost:9999'
//export const apiImageUrl = 'http://39.101.78.35:6448'
export const apiImageUrl = 'https://xiaokuaisong.shop:6448'

View File

@ -1,5 +1,4 @@
import App from './App'
// #ifndef VUE3
import Vue from 'vue'

View File

@ -3,6 +3,35 @@
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@dcloudio/types": {
"version": "3.4.14",
"resolved": "https://registry.npmmirror.com/@dcloudio/types/-/types-3.4.14.tgz",
"integrity": "sha512-VolQeZfTh8pQFsr2IlfIVX93blfvGTuBoJuZUc7iWOqtHV8gDrq6fXLhzsVlgZyuhhRZLOxlo33rkEqnY+ucAw==",
"peer": true
},
"node_modules/@dcloudio/uni-app": {
"version": "2.0.2-4020420240722004",
"resolved": "https://registry.npmmirror.com/@dcloudio/uni-app/-/uni-app-2.0.2-4020420240722004.tgz",
"integrity": "sha512-WzHNoEbOWkMWSW98AzWtexsLfaJfi/ujOHw7e8ffgYZVZYIyob2RGa3mQ61tb3j7/lZyRn48NsT2TXCc/ZaUxg==",
"peerDependencies": {
"@dcloudio/types": "^3.0.15",
"@vue/composition-api": "^1.7.0"
}
},
"node_modules/@socket.io/component-emitter": {
"version": "3.1.2",
"resolved": "https://registry.npmmirror.com/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
"integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA=="
},
"node_modules/@vue/composition-api": {
"version": "1.7.2",
"resolved": "https://registry.npmmirror.com/@vue/composition-api/-/composition-api-1.7.2.tgz",
"integrity": "sha512-M8jm9J/laYrYT02665HkZ5l2fWTK4dcVg3BsDHm/pfz+MjDYwX+9FUaZyGwEyXEDonQYRCo0H7aLgdklcIELjw==",
"peer": true,
"peerDependencies": {
"vue": ">= 2.5 < 2.7"
}
},
"node_modules/@vue/devtools-api": {
"version": "6.6.3",
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.3.tgz",
@ -38,6 +67,22 @@
"node": ">= 0.8"
}
},
"node_modules/debug": {
"version": "4.3.7",
"resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.7.tgz",
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -47,6 +92,26 @@
"node": ">=0.4.0"
}
},
"node_modules/engine.io-client": {
"version": "6.6.2",
"resolved": "https://registry.npmmirror.com/engine.io-client/-/engine.io-client-6.6.2.tgz",
"integrity": "sha512-TAr+NKeoVTjEVW8P3iHguO1LO6RlUz9O5Y8o7EY0fU+gY1NYqas7NN3slpFtbXEsLMHk0h90fJMfKjRkQ0qUIw==",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.1",
"engine.io-parser": "~5.2.1",
"ws": "~8.17.1",
"xmlhttprequest-ssl": "~2.1.1"
}
},
"node_modules/engine.io-parser": {
"version": "5.2.3",
"resolved": "https://registry.npmmirror.com/engine.io-parser/-/engine.io-parser-5.2.3.tgz",
"integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==",
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/follow-redirects": {
"version": "1.15.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
@ -102,6 +167,11 @@
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/pinia": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.2.0.tgz",
@ -134,6 +204,32 @@
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/socket.io-client": {
"version": "4.8.1",
"resolved": "https://registry.npmmirror.com/socket.io-client/-/socket.io-client-4.8.1.tgz",
"integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.2",
"engine.io-client": "~6.6.1",
"socket.io-parser": "~4.2.4"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/socket.io-parser": {
"version": "4.2.4",
"resolved": "https://registry.npmmirror.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
"integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==",
"dependencies": {
"@socket.io/component-emitter": "~3.1.0",
"debug": "~4.3.1"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/vue": {
"version": "2.6.14",
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.14.tgz",
@ -167,6 +263,34 @@
"optional": true
}
}
},
"node_modules/ws": {
"version": "8.17.1",
"resolved": "https://registry.npmmirror.com/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/xmlhttprequest-ssl": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
"integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==",
"engines": {
"node": ">=0.4.0"
}
}
}
}

13
uniapp04/node_modules/@dcloudio/types/.editorconfig generated vendored Normal file
View File

@ -0,0 +1,13 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
insert_final_newline = false

10
uniapp04/node_modules/@dcloudio/types/README.md generated vendored Normal file
View File

@ -0,0 +1,10 @@
# @dcloudio/types
uni-app 类型提示
## 操作流程
```shell
npm run test
npm run publish:patch
```

View File

@ -0,0 +1,247 @@
declare namespace string {
/**
* @description
* @module dom
*/
interface AttrString extends String {}
/**
* @description
* @module dom
*/
interface AttrValueString extends String {}
/**
* @description `class`
* @module dom
*/
interface ClassString extends String {}
/**
* @description `id`
* @module dom
*/
interface IDString extends String {}
/**
* @description
* @module dom
*/
interface HTMLEventString extends String {}
/**
* @description CSS颜色的值
* @module dom
*/
interface ColorString extends String {}
/**
* @description common模块 js文件路径
* @module vue
*/
interface RequireCommonString extends String {}
/**
* @description key值
* @module vue
*/
interface VueI18NKeyString extends String {}
/**
* @description vue默认参数data中的属性名称
* @module vue
*/
interface VueDataString extends String {}
/**
* @description vue组件中ref属性的值
* @module vue
*/
interface VueRefString extends String {}
/**
* @description vuex actions
* @module vue
*/
interface VuexDispatchString extends String {}
/**
* @description vuex mutations
* @module vue
*/
interface VuexCommitString extends String {}
/**
* @description vue, nvue, uvue页面文件的文件路径()
* @module vue
*/
interface PageURIString extends String {}
/**
* @description nvue页面文件的文件路径
* @module vue
*/
interface NPageURIString extends String {}
/**
* @description uvue页面文件的文件路径, uniappx中生效
* @module uniappx
*/
interface UPageURIString extends String {}
/**
* @description video id, uniappx中生效
* @module uniappx
*/
interface VideoIdString extends String {}
/**
* @description web-view id, uniappx中生效
* @module uniappx
*/
interface WebviewIdString extends String {}
/**
* @description uniCloud db schema中parentKey的值
* @module uniCloud
*/
interface ParentFieldString extends String {}
/**
* @description uniCloud db schema中required数组的值
* @module uniCloud
*/
interface SchemaFieldString extends String {}
/**
* @description uniCloud db schema中validateFunction的值
* @module uniCloud
*/
interface ValidateFunctionString extends String {}
/**
* @description uniCloud
* @module uniCloud
*/
interface CloudFunctionString extends String {}
/**
* @description uniCloud
* @module uniCloud
*/
interface CloudObjectString extends String {}
/**
* @description uniCloud
* @module uniCloud
*/
interface DBCollectionString extends String {}
/**
* @description uniCloud
* @module uniCloud
*/
interface DBFieldString extends String {}
/**
* @description uniCloud ,
* @module uniCloud
*/
interface JQLString extends String {}
/**
* @description CSS属性的名称
* @module jQuery
*/
interface cssPropertyString extends String {}
/**
* @description CSS某个属性的值
* @module jQuery
*/
interface cssPropertyValueString extends String {}
/**
* @description CSS选择器的名称
* @module jQuery
*/
interface cssSelectorString extends String {}
/**
* @description
* @module uri
*/
interface URIString extends String {}
/**
* @description css文件的文件路径(`.css`)
* @module uri
*/
interface CSSURIString extends String {}
/**
* @description js文件的文件路径(`.js`)
* @module uri
*/
interface JSURIString extends String {}
/**
* @description html文件的文件路径(`.html`)
* @module uri
*/
interface HTMLURIString extends String {}
/**
* @description markdown文件的文件路径(`.md`)
* @module uri
*/
interface MarkdownURIString extends String {}
/**
* @description js, ts, uts引用文件或模块的文件路径(vue,nvue,uvue中script标签内容), : `import xxx from 'xxx'`
* @module uri
*/
interface ScriptImportURIString extends String {}
/**
* @description css文件可以引用的文件的文件路径, `[".css"]` : `@import url('xxx.css')`
* @module uri
*/
interface CssImportURIString extends String {}
/**
* @description scss文件可以引用的文件的文件路径, `[".scss", ".css"]`, : `@import 'xxx.scss'`
* @module uri
*/
interface ScssImportURIString extends String {}
/**
* @description less文件可以引用的文件的文件路径, `[".less", ".css"]`, : `@import 'xxx.less'`
* @module uri
*/
interface LessImportURIString extends String {}
/**
* @description
* @module uri
*/
interface FontURIString extends String {}
/**
* @description
* @module uri
*/
interface ImageURIString extends String {}
/**
* @description
* @module uri
*/
interface AudioURIString extends String {}
/**
* @description
* @module uri
*/
interface VideoURIString extends String {}
}

View File

@ -0,0 +1 @@
/// <reference path="./HBuilderX.d.ts" />

View File

@ -0,0 +1,2 @@
/// <reference path="../hbuilder-x/index.d.ts" />
/// <reference path="./plus.d.ts" />

20746
uniapp04/node_modules/@dcloudio/types/html5plus/plus.d.ts generated vendored Normal file

File diff suppressed because it is too large Load Diff

2
uniapp04/node_modules/@dcloudio/types/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference path="./uni-app/index.d.ts" />
/// <reference path="./html5plus/plus.d.ts" />

30
uniapp04/node_modules/@dcloudio/types/package.json generated vendored Normal file
View File

@ -0,0 +1,30 @@
{
"name": "@dcloudio/types",
"version": "3.4.14",
"description": "uni-app types",
"typings": "index.d.ts",
"scripts": {
"tslint": "tslint --project ./ --fix",
"dtslint": "dtslint ./",
"test": "dtslint ./",
"build:wx": "node ./scripts/build-wx.js",
"build": "npm run build:wx && npm run build:promisify",
"prepublishOnly": "npm run test",
"build:promisify": "node ./scripts/build-promisify.js",
"publish:patch": "npm version patch && npm publish",
"publish:minor": "npm version minor && npm publish",
"publish:major": "npm version major && npm publish",
"postpublish": "npx cnpm sync @dcloudio/types"
},
"author": "fxy060608",
"license": "Apache-2.0",
"devDependencies": {
"@definitelytyped/dtslint": "^0.0.115",
"miniprogram-api-typings": "3.7.1",
"ts-morph": "^17.0.1",
"tslint": "^5.14.0",
"typescript": "5.0.4",
"vue": "2.6"
},
"packageManager": "pnpm@9.5.0+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
}

220
uniapp04/node_modules/@dcloudio/types/uni-app/app.d.ts generated vendored Normal file
View File

@ -0,0 +1,220 @@
declare namespace App {
interface ReferrerInfo {
/**
* App的 appId
*
* referrerInfo.appId
* - 1020 profile appId
* - 1035 appId
* - 1036App appId
* - 1037 appId
* - 1038 appId
* - 1043 appId
*/
appId: string;
/**
* scene=10371038
*/
extraData?: any;
}
interface LaunchShowOption {
/**
*
*/
path: string;
/**
* query
*/
query: AnyObject;
/**
*
* - 1001: 发现栏小程序主入口使2.2.4
* - 1005: 顶部搜索框的搜索结果页
* - 1006: 发现栏小程序主入口搜索框的搜索结果页
* - 1007: 单人聊天会话中的小程序消息卡片
* - 1008: 群聊会话中的小程序消息卡片
* - 1011: 扫描二维码
* - 1012: 长按图片识别二维码
* - 1013: 手机相册选取二维码
* - 1014: 小程序模板消息
* - 1017: 前往体验版的入口页
* - 1019: 微信钱包
* - 1020: 公众号 profile
* - 1022: 聊天顶部置顶小程序入口
* - 1023: 安卓系统桌面图标
* - 1024: 小程序 profile
* - 1025: 扫描一维码
* - 1026: 附近小程序列表
* - 1027: 顶部搜索框搜索结果页使
* - 1028: 我的卡包
* - 1029: 卡券详情页
* - 1030: 自动化测试下打开小程序
* - 1031: 长按图片识别一维码
* - 1032: 手机相册选取一维码
* - 1034: 微信支付完成页
* - 1035: 公众号自定义菜单
* - 1036: App
* - 1037: 小程序打开小程序
* - 1038: 从另一个小程序返回
* - 1039: 摇电视
* - 1042: 添加好友搜索框的搜索结果页
* - 1043: 公众号模板消息
* - 1044: shareTicket
* - 1045: 朋友圈广告
* - 1046: 朋友圈广告详情页
* - 1047: 扫描小程序码
* - 1048: 长按图片识别小程序码
* - 1049: 手机相册选取小程序码
* - 1052: 卡券的适用门店列表
* - 1053: 搜一搜的结果页
* - 1054: 顶部搜索框小程序快捷入口
* - 1056: 音乐播放器菜单
* - 1057: 钱包中的银行卡详情页
* - 1058: 公众号文章
* - 1059: 体验版小程序绑定邀请页
* - 1064: 微信连Wi-Fi状态栏
* - 1067: 公众号文章广告
* - 1068: 附近小程序列表广告
* - 1069: 移动应用
* - 1071: 钱包中的银行卡列表页
* - 1072: 二维码收款页面
* - 1073: 客服消息列表下发的小程序消息卡片
* - 1074: 公众号会话下发的小程序消息卡片
* - 1077: 摇周边
* - 1078: 连Wi-Fi成功页
* - 1079: 微信游戏中心
* - 1081: 客服消息下发的文字链
* - 1082: 公众号会话下发的文字链
* - 1084: 朋友圈广告原生页
* - 1089: 微信聊天主界面下拉使2.2.4
* - 1090: 长按小程序右上角菜单唤出最近使用历史
* - 1091: 公众号文章商品卡片
* - 1092: 城市服务入口
* - 1095: 小程序广告组件
* - 1096: 聊天记录
* - 1097: 微信支付签约页
* - 1099: 页面内嵌插件
* - 1102: 公众号 profile
* - 1103: 发现栏小程序主入口2.2.4
* - 1104: 微信聊天主界面下拉2.2.4
*/
scene: number;
/**
*
*/
shareTicket: string;
/**
* App打开时
*/
referrerInfo?: ReferrerInfo;
}
interface PageNotFoundOption {
/**
*
*/
path: string;
/**
* query
*/
query: AnyObject;
/**
*
*/
isEntryPage: boolean;
}
interface AppInstance<T extends AnyObject = {}> {
/**
*
* [https://uniapp.dcloud.io/collocation/App?id=globaldata](https://uniapp.dcloud.io/collocation/App?id=globaldata)
*/
globalData?: AnyObject;
/**
*
*
*
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onLaunch?(options?: LaunchShowOption): void;
/**
*
*
*
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onShow?(options?: LaunchShowOption): void;
/**
*
*
*
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onHide?(): void;
/**
*
* API
* @param error
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onError?(error: string): void;
/**
*
*
*
*
* ****
* 1. `onPageNotFound`
* 2. `onPageNotFound` `onPageNotFound`
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onPageNotFound?(options: PageNotFoundOption): void;
/**
* Promise
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onUnhandledRejection?(
options: UniNamespace.OnUnhandledRejectionCallbackResult
): void;
/**
*
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onThemeChange?(options: UniNamespace.OnThemeChangeCallbackResult): void;
/**
* nvue
*
* nvue 使 `uni.postMessage`
*
* : [https://uniapp.dcloud.io/collocation/frame/lifecycle](https://uniapp.dcloud.io/collocation/frame/lifecycle)
*/
onUniNViewMessage?(options: AnyObject): void;
}
type AppConstructor = <T extends AnyObject & AppInstance>(
options: AppInstance<T> & T,
) => void;
interface GetAppOption {
/**
* `App` App被调用时App中
*/
allowDefault: boolean;
}
type GetApp = <T extends AnyObject>(opts?: GetAppOption) => AppInstance<T> & T;
}
declare const getApp: App.GetApp;
declare const createApp: any;
declare const createPage: any;
declare const createComponent: any;

View File

@ -0,0 +1,9 @@
/// <reference path="../hbuilder-x/index.d.ts" />
/// <reference path="./uni-cloud-client/index.d.ts" />
/**
* uniCloud
*
* : [https://uniapp.dcloud.net.cn/uniCloud/](https://uniapp.dcloud.net.cn/uniCloud/)
*/
declare const uniCloud: UniCloudNamespace.UniCloud;

View File

@ -0,0 +1,7 @@
interface AnyObject {
[key: string]: any;
}
type KVInfer<T> = { [K in keyof T]: T[K] };
type Void<T> = T | undefined | null;

View File

@ -0,0 +1,11 @@
/// <reference path="../hbuilder-x/index.d.ts" />
/// <reference path="../html5plus/plus.d.ts" />
/// <reference path="./common.d.ts" />
/// <reference path="./app.d.ts" />
/// <reference path="./page.d.ts" />
/// <reference path="./uni/index.d.ts" />
/// <reference path="./uni-patches/index.d.ts" />
/// <reference path="./cloud.d.ts" />
import UniApp = UniNamespace;
import UniCloud = UniCloudNamespace;

496
uniapp04/node_modules/@dcloudio/types/uni-app/page.d.ts generated vendored Normal file
View File

@ -0,0 +1,496 @@
declare namespace Page {
interface CustomShareContent {
/**
*
*/
title?: string;
/**
* / path
*/
path?: string;
/**
* PNG及JPG 5:4使
*/
imageUrl?: string;
/**
* resolve resolve使
*/
promise?: Promise<{
/**
*
*/
title?: string;
/**
* / path
*/
path?: string;
/**
* PNG及JPG 5:4使
*/
imageUrl?: string;
}>;
/**
*
*/
desc?: string;
/**
* 28
*/
content?: string;
/**
* 750x825apFilePath base64
*/
bgImgUrl?: string;
/**
* 376x330
*/
scImgUrl?: string;
/**
* 5
*/
searchTip?: string;
/**
*
*/
success?: () => void;
/**
*
*/
fail?: () => void;
/**
* id
*/
templateId?: string;
/**
* PC端打开小程序加载的页面
*/
PCPath?: string;
/**
* PC端打开小程序加载的模式PC端打开小程序PCMode字段
*/
PCMode?: string;
/**
* PCQQQQ无法执行小程序时打开的H5页面
*/
generalWebpageUrl?: string;
/**
*
*/
entryDataHash?: string;
/**
* id使
*/
shareTemplateId?: string;
/**
* id需要不同的数据
*/
shareTemplateData?: string;
/**
*
*/
shareType?: string;
/**
* 1 - 2 - App9.0.0url参数url对应页面app里面的对应小程序
*/
type?: string;
/**
* Wxfriends,QQfriends,Wxmoments,QQzone,Sinaweibo
*/
channel?: string;
/**
* h5链接地址h5分享填写
*/
url?: string;
/**
* Wxfriends,QQfriends,Wxmoments,QQzone,Sinaweibo
*/
keyShareChannel?: string;
/**
* jdfile开头的格式
*/
localImageUrl?: string;
/**
* localImageUrlonlineImageUrl建议开发者使用时只传一个值 localImageUrl
*/
onlineImageUrl?: string;
}
interface ShareTimelineContent {
/**
*
*/
title?: string;
/**
* path?a=1&b=2 ?
*/
query?: string;
/**
* PNG JPG 1:1 Logo
*/
imageUrl?: string;
}
interface PageScrollOption {
/**
* px
*/
scrollTop: number;
}
interface ResizeOption {
/**
* px
*/
scrollTop: number;
/**
*
*/
size?: {
/**
*
*/
windowWidth: number;
/**
*
*/
windowHeight: number;
};
}
interface ShareAppMessageOption {
/**
*
*
* - `button`
* - `menu`
*/
from: "button" | "menu";
/**
* `from` `button` `target` `button` `undefined`
*/
target: any;
/**
* `<web-view>` `<web-view>` url
*/
webViewUrl?: string;
}
interface AddToFavoritesOption {
/**
*
*
* - `button`
* - `menu`
*/
from: "button" | "menu";
/**
* `<web-view>` `<web-view>` url
*/
webviewUrl: string;
}
interface CustomFavoritesContent {
/**
*
*/
title?: string;
/**
* query
*/
path?: string;
/**
* 11
*/
imageUrl?: string;
}
interface TabItemTapOption {
/**
* tabItem 0
*/
index: number;
/**
* tabItem
*/
pagePath: string;
/**
* tabItem
*/
text: string;
}
interface NavigationBarButtonTapOption {
/**
*
*/
index: number;
}
interface BackPressOption {
/**
* - backbutton Android
* - navigateBack API uni.navigateBack()
*/
from: 'backbutton' | 'navigateBack';
}
interface NavigationBarSearchInputEvent {
/**
*
*/
text: string;
}
interface PageInstanceBaseProps<D extends AnyObject = any> {
/**
* `String`
*/
route?: string;
/**
* webview对象实例 App
*/
$getAppWebview?: () => PlusWebviewWebviewObject;
/**
* Vue
*/
$vm?: any;
}
interface PageInstance<D extends AnyObject = any, T extends AnyObject = any> extends PageInstanceBaseProps<D> {
/**
*
*
* onInit
* @param query
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* },
* "mp": {
* "weixin": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "alipay": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "baidu": {
* "hostVer": ">=3.160.12",
* "uniVer": ">=3.1.0",
* "unixVer": "x"
* },
* "toutiao": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "lark": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "qq": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "kuaishou": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "jd": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* },
* "360": {
* "hostVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* },
* "quickapp": {
* "uniVer": "x",
* "unixVer": "x"
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/
onInit?(query?: AnyObject): void;
/**
*
*
* onLoad
* @param query
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onLoad?(query?: AnyObject): void;
/**
*
*
* /
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onShow?(): void;
/**
*
*
*
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onReady?(): void;
/**
*
*
* / `navigateTo` `tab`
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onHide?(): void;
/**
*
*
* `redirectTo` `navigateBack`
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onUnload?(): void;
/**
*
* - `pages.json` `enablePullDownRefresh`
* - `uni.startPullDownRefresh`
* - `uni.stopPullDownRefresh`
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onPullDownRefresh?(): void;
/**
*
* - `pages.json` `onReachBottomDistance`
* -
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onReachBottom?(): void;
/**
*
*
* `<button>` `open-type="share"`
* @param options
* @return
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onShareAppMessage?(options: ShareAppMessageOption): CustomShareContent | Promise<Omit<CustomShareContent, "promise">>;
/**
*
*
*
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onShareTimeline?(): ShareTimelineContent;
/**
*
*
*
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onAddToFavorites?(options: AddToFavoritesOption): CustomFavoritesContent;
/**
*
*
*
* @param options
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onPageScroll?(options: PageScrollOption): void;
/**
*
* @param options
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
* @uniPlatform {
* "App": {
* "baidu": {
* "hostVer": ">=3.160.12",
* "uniVer": ">=3.1.0",
* "unixVer": "x"
* }
* }
* }
*/
onResize?(options: ResizeOption): void;
/**
* tab tab
* @param options tab
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onTabItemTap?(options: TabItemTapOption): void;
/**
*
* @param options tab
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onNavigationBarButtonTap?(options: NavigationBarButtonTapOption): void;
/**
*
* @param options tab
* @return `true`
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onBackPress?(options: BackPressOption): any;
/**
*
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onNavigationBarSearchInputChanged?(event: NavigationBarSearchInputEvent): void;
/**
*
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onNavigationBarSearchInputConfirmed?(event: NavigationBarSearchInputEvent): void;
/**
*
*
* : [https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle](https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle)
*/
onNavigationBarSearchInputClicked?(): void;
}
type PageConstructor = <T extends AnyObject & PageInstance>(
options: PageInstance<AnyObject, T> & T,
) => void;
type GetCurrentPages = <T extends AnyObject = {}>() => Array<PageInstance<AnyObject, T> & T>;
}
declare const getCurrentPages: Page.GetCurrentPages;

View File

@ -0,0 +1,252 @@
declare namespace UniCloudNamespace {
interface CurrentUserInfo {
/**
* uid
*/
uid: string;
/**
*
*/
role: any[];
/**
*
*/
permission: any[];
}
interface UniCloudOptions {
/**
*
* - tencent: 选择腾讯云作为服务商
* - aliyun: 选择阿里云作为服务商
*/
provider: 'tencent' | 'aliyun';
/**
* ID
*/
spaceId: string;
/**
* clientSecret
*/
clientSecret?: string;
/**
*
*/
endpoint?: string;
}
interface UniError {
/**
*
*/
errSubject?: string;
/**
*
*/
errCode: number | string;
/**
*
*/
errMsg: string;
/**
* id方便排错
*/
requestId?: string;
/**
*
*/
detail?: any;
/**
*
*/
cause?: UniError;
}
interface CallFunctionResult {
/**
*
*/
result: any;
/**
*
*/
requestId?: string;
}
enum SECRET_TYPE {
/**
*
*/
none = 'none',
/**
*
*/
request = 'request',
/**
*
*/
response = 'response',
/**
*
*/
both = 'both'
}
interface CallFunctionOptions {
/**
*
*/
name: string | string.CloudFunctionString;
/**
*
*/
data?: any;
/**
*
* - none
* - request
* - response
* - both
*/
secretType?: keyof typeof SECRET_TYPE;
/**
*
*/
success?: (result: CallFunctionResult) => void;
/**
*
*/
fail?: (result: any) => void;
/**
*
*/
complete?: (result: CallFunctionResult) => void;
}
interface ImportObjectLoadingOptions {
/**
* loading界面文字
*/
text?: string;
/**
* loading是否显示透明遮罩
*/
mask?: boolean;
}
interface ImportObjectErrorOptions {
/**
* modal | toast
*/
type?: 'modal' | 'toast';
/**
* type为modal时生效
*/
retry?: boolean;
}
interface ParseSystemErrorOptions {
/**
*
*/
objectName: string;
/**
*
*/
methodName: string;
/**
*
*/
params: Array<any>;
/**
*
*/
errCode: string | number;
/**
*
*/
errMsg: string;
}
interface ParsedSystemErrorResult {
errMsg: string;
}
interface ImportObjectOptions {
/**
* ui
*/
customUI?: boolean;
/**
* loading界面配置
*/
loadingOptions?: ImportObjectLoadingOptions;
/**
*
*/
errorOptions?: ImportObjectErrorOptions;
/**
* 使
*/
secretMethods?: Record<string, keyof typeof SECRET_TYPE>;
/**
*
*/
parseSystemError?: (options: ParseSystemErrorOptions) => Promise<ParsedSystemErrorResult> | ParsedSystemErrorResult;
}
interface InitSecureNetworkByWeixinOptions {
/**
* uni-id-co的微信登录uni-id-co的secureNetworkHandshakeByWeixin不调用微信登录
*/
callLoginByWeixin?: boolean;
/**
* openiduni-id-co的任何方法
*/
openid?: string;
}
interface InitSecureNetworkByWeixinResponse {
code?: string;
}
interface UniCloud {
/** 用于快速开发datacom规范的组件 */
mixinDatacom: any;
/**
* uniCloud实例
*
* : [https://uniapp.dcloud.io/uniCloud/init](https://uniapp.dcloud.io/uniCloud/init)
*/
init(options: UniCloudOptions): UniCloud;
/**
* clientInfo信息
*
* : [https://doc.dcloud.net.cn/uniCloud/client-sdk.html#set-custom-client-info](https://doc.dcloud.net.cn/uniCloud/client-sdk.html#set-custom-client-info)
*/
setCustomClientInfo(options: object): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/cf-functions?id=clientcallfunction](https://uniapp.dcloud.io/uniCloud/cf-functions?id=clientcallfunction)
*/
callFunction(options: CallFunctionOptions): Promise<any>;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/cloud-obj](https://uniapp.dcloud.io/uniCloud/cloud-obj)
*/
importObject(objectName: string | string.CloudObjectString, importObjectOptions?: ImportObjectOptions): any;
/**
* token内的信息
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#client-getcurrentuserinfo](https://uniapp.dcloud.io/uniCloud/client-sdk.html#client-getcurrentuserinfo)
*/
getCurrentUserInfo(): CurrentUserInfo;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#client-getcurrentuserinfo](https://uniapp.dcloud.io/uniCloud/client-sdk.html#init-secure-network-by-weixin)
*/
initSecureNetworkByWeixin(options?: InitSecureNetworkByWeixinOptions): Promise<InitSecureNetworkByWeixinResponse>;
}
}

View File

@ -0,0 +1,54 @@
declare namespace UniCloudNamespace {
interface UserInfo {
/**
* uniCloud的唯一ID
*/
uid: string;
/**
* ID
*/
customUserId: string;
}
interface Auth {
/**
* getUserInfo
*
* : [https://uniapp.dcloud.io/uniCloud/authentication?id=authgetuserinfo](https://uniapp.dcloud.io/uniCloud/authentication?id=authgetuserinfo)
*/
getUserInfo(): UserInfo;
/**
* getLoginState() getLoginState() SDK undefined
*
* : [https://uniapp.dcloud.io/uniCloud/authentication?id=authgetloginstate](https://uniapp.dcloud.io/uniCloud/authentication?id=authgetloginstate)
*/
getLoginState(): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/authentication?id=authsigninanonymously](https://uniapp.dcloud.io/uniCloud/authentication?id=authsigninanonymously)
*/
signInAnonymously(): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/authentication?id=authsigninwithticket](https://uniapp.dcloud.io/uniCloud/authentication?id=authsigninwithticket)
*/
signInWithTicket(): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/authentication?id=authshouldrefreshaccesstoken](https://uniapp.dcloud.io/uniCloud/authentication?id=authshouldrefreshaccesstoken)
*/
shouldRefreshAccessToken(callback: (result: any) => void): void;
}
interface UniCloud {
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/authentication?id=custom-auth](https://uniapp.dcloud.io/uniCloud/authentication?id=custom-auth)
*/
customAuth(): Auth;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
declare namespace UniCloudNamespace {
interface UniCloudResponseEvent {
type: 'clientdb' | 'cloudobject' | 'cloudfunction';
content: any;
}
interface UniCloudNeedLoginEvent {
errCode: string | number;
errMsg: string;
uniIdRedirectUrl: string;
}
interface UniCloudRefreshTokenEvent {
token: string;
tokenExpired: number;
}
interface UniCloud {
/** 事件回调 */
on(eventName: string, callback: (result: any) => void): void;
/**
* clientDB的响应
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#on-response](https://uniapp.dcloud.io/uniCloud/client-sdk.html#on-response)
*/
onResponse(callback: (result?: UniCloudResponseEvent) => void): void;
/**
* clientDB的响应
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#off-response](https://uniapp.dcloud.io/uniCloud/client-sdk.html#off-response)
*/
offResponse(callback: (result?: UniCloudResponseEvent) => void): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#on-need-login](https://uniapp.dcloud.io/uniCloud/client-sdk.html#on-need-login)
*/
onNeedLogin(callback: (result?: UniCloudNeedLoginEvent) => void): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#off-need-login](https://uniapp.dcloud.io/uniCloud/client-sdk.html#off-need-login)
*/
offNeedLogin(callback: (result?: UniCloudNeedLoginEvent) => void): void;
/**
* token刷新事件
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#on-refresh-token](https://uniapp.dcloud.io/uniCloud/client-sdk.html#on-refresh-token)
*/
onRefreshToken(callback: (result?: UniCloudRefreshTokenEvent) => void): void;
/**
* token刷新事件
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#off-refresh-token](https://uniapp.dcloud.io/uniCloud/client-sdk.html#off-refresh-token)
*/
offRefreshToken(callback: (result: UniCloudRefreshTokenEvent) => void): void;
}
}

View File

@ -0,0 +1,7 @@
/// <reference path="custom-auth.d.ts" />
/// <reference path="database.d.ts" />
/// <reference path="event.d.ts" />
/// <reference path="interceptor.d.ts" />
/// <reference path="sse-channel.d.ts" />
/// <reference path="storage.d.ts" />
/// <reference path="websocket.d.ts" />

View File

@ -0,0 +1,52 @@
declare namespace UniCloudNamespace {
interface Interceptor {
invoke?: (result: any) => void;
success?: (result: any) => void;
fail?: (result: any) => void;
complete?: (result: any) => void;
}
interface BaseObjectInterceptorArgs {
objectName: string;
methodName: string;
params: string;
}
interface SuccessObjectInterceptorArgs extends BaseObjectInterceptorArgs {
result: any;
}
interface FailObjectInterceptorArgs extends BaseObjectInterceptorArgs {
error: UniError;
}
type CompleteObjectInterceptorArgs = SuccessObjectInterceptorArgs | FailObjectInterceptorArgs;
interface ObjectInterceptor {
invoke?: (result: BaseObjectInterceptorArgs) => void;
success?: (result: SuccessObjectInterceptorArgs) => void;
fail?: (result: FailObjectInterceptorArgs) => void;
complete?: (result: CompleteObjectInterceptorArgs) => void;
}
interface UniCloud {
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#add-interceptor](https://uniapp.dcloud.io/uniCloud/client-sdk.html#add-interceptor)
*/
addInterceptor(apiName: string, interceptor: Interceptor): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#remove-interceptor](https://uniapp.dcloud.io/uniCloud/client-sdk.html#remove-interceptor)
*/
removeInterceptor(apiName: string, interceptor?: Interceptor): void;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/client-sdk.html#intercept-object](https://uniapp.dcloud.io/uniCloud/client-sdk.html#intercept-object)
*/
interceptObject(interceptor: ObjectInterceptor): void;
}
}

View File

@ -0,0 +1,110 @@
declare namespace UniCloudNamespace {
class SSEChannel {
constructor();
/**
*
*
* [https://uniapp.dcloud.net.cn/uniCloud/sse-channel.html#channel-open](https://uniapp.dcloud.net.cn/uniCloud/sse-channel.html#channel-open)
*/
open: () => Promise<void>;
/**
*
*
* [https://uniapp.dcloud.net.cn/uniCloud/sse-channel.html#channel-close](https://uniapp.dcloud.net.cn/uniCloud/sse-channel.html#channel-close)
*/
close: () => void;
/**
*
*/
on(event: 'open', callback: () => any): void;
/**
*
*/
on(event: 'message', callback: (message?: any) => any): void;
/**
*
*/
on(event: 'end', callback: (message?: any) => any): void;
/**
*
*/
on(event: 'close', callback: () => any): void;
/**
*
*/
on(event: 'error', callback: (err?: any) => any): void;
/**
*
*/
addListener(event: 'open', callback: () => any): void;
/**
*
*/
addListener(event: 'message', callback: (message?: any) => any): void;
/**
*
*/
addListener(event: 'end', callback: (message?: any) => any): void;
/**
*
*/
addListener(event: 'close', callback: () => any): void;
/**
*
*/
addListener(event: 'error', callback: (err?: any) => any): void;
/**
*
*/
off(event: 'open', callback: () => any): void;
/**
*
*/
off(event: 'message', callback: (message?: any) => any): void;
/**
*
*/
off(event: 'end', callback: (message?: any) => any): void;
/**
*
*/
off(event: 'close', callback: () => any): void;
/**
*
*/
off(event: 'error', callback: (err?: any) => any): void;
/**
*
*/
removeListener(event: 'open', callback: () => any): void;
/**
*
*/
removeListener(event: 'message', callback: (message?: any) => any): void;
/**
*
*/
removeListener(event: 'end', callback: (message?: any) => any): void;
/**
*
*/
removeListener(event: 'close', callback: () => any): void;
/**
*
*/
removeListener(event: 'error', callback: (err?: any) => any): void;
/**
*
*/
removeAllListener(event: 'open' | 'message' | 'end' | 'close' | 'error'): void;
}
interface UniCloud {
/**
*
*
* [https://uniapp.dcloud.net.cn/uniCloud/sse-channel.html#create-sse-channel](https://uniapp.dcloud.net.cn/uniCloud/sse-channel.html#create-sse-channel)
*/
SSEChannel: SSEChannel;
}
}

View File

@ -0,0 +1,324 @@
declare namespace UniCloudNamespace {
interface GeneralCallbackResult {
/**
*
*/
errCode: string;
/**
*
*/
errMsg: string;
}
interface OnUploadProgressResult {
/**
*
*/
loaded: number;
/**
*
*/
total: number;
}
interface UploadFileResult {
/**
* ID访
*/
fileID: string;
}
interface UploadFileOptions {
/**
* foo/bar.jpgfoo/bar/baz.jpg
*/
cloudPath: string;
/**
*
*/
filePath: string;
/**
* cloudPath作为实际存储路径false
*/
cloudPathAsRealPath?: boolean;
/**
*
*/
onUploadProgress?: (result: OnUploadProgressResult) => void;
/**
*
*/
success?: (result: UploadFileResult) => void;
/**
*
*/
fail?: (result: GeneralCallbackResult) => void;
/**
*
*/
complete?: (result: UploadFileResult) => void;
}
interface DeleteFileItem {
/**
* fileID
*/
fileID: string;
/**
*
*/
code: string;
}
interface DeleteFileResult {
/**
* ID
*/
fileList: DeleteFileItem[];
}
interface DeleteFileOptions {
/**
* ID组成的数组
*/
fileList: any[];
/**
*
*/
success?: (result: DeleteFileResult) => void;
/**
*
*/
fail?: (result: GeneralCallbackResult) => void;
/**
*
*/
complete?: (result: DeleteFileResult) => void;
}
interface GetTempFileURLItem {
/**
* ID
*/
fileID: string;
/**
* SUCCESS
*/
code: string;
/**
* 访
*/
tempFileURL: string;
}
interface GetTempFileURLResult {
/**
*
*/
fileList: any[];
}
interface GetTempFileURLOptions {
/**
* ID组成的数组
*/
fileList: any[];
/**
*
*/
success?: (result: GetTempFileURLResult) => void;
/**
*
*/
fail?: (result: GeneralCallbackResult) => void;
/**
*
*/
complete?: (result: GetTempFileURLResult) => void;
}
interface ChooseAndUploadFileSuccessCallbackResult {
/**
*
*/
errMsg: string;
/**
*
*/
tempFilePaths: any[];
/**
* File
*/
tempFiles: any[];
}
interface ChooseAndUploadFileOnUploadProgressCallbackResult {
/**
*
*/
index: number;
/**
*
*/
loaded: number;
/**
*
*/
total: number;
/**
*
*/
tempFilePath: string;
/**
*
*/
tempFile: any;
}
interface ChooseAndUploadFileOnChooseFileCallbackResult {
/**
*
*/
errMsg: string;
/**
*
*/
tempFilePaths: any[];
/**
* File
*/
tempFiles: any[];
}
interface ChooseAndUploadFileOptions {
/**
*
* - image: 图片
* - video: 视频
* - all: 任意文件
*/
type: 'image' | 'video' | 'all';
/**
*
*/
count?: number;
/**
*
*/
extension?: any[];
/**
* original compressed
*/
sizeType?: string | string[];
/**
* album camera 使
*/
sourceType?: string | string[];
/**
*
* - front: 前置摄像头
* - back: 后置摄像头
*/
camera?: 'front' | 'back';
/**
* true
*/
compressed?: boolean;
/**
* 60
*/
maxDuration?: number;
/**
*
*/
onChooseFile?: (result: ChooseAndUploadFileOnChooseFileCallbackResult) => void;
/**
*
*/
onUploadProgress?: (result: ChooseAndUploadFileOnUploadProgressCallbackResult) => void;
/**
*
*/
success?: (result: ChooseAndUploadFileSuccessCallbackResult) => void;
/**
*
*/
fail?: (result: any) => void;
/**
*
*/
complete?: (result: any) => void;
}
interface GetFileInfoOptions {
fileList: Array<string>;
}
interface GetFileInfoResponseFileItem {
/**
* ID
*/
fileId: string;
/**
*
*/
gmtCreate: number;
/**
*
*/
gmtModified: number;
/**
*
*/
name: string;
/**
* Byte
*/
size: number;
/**
*
*/
type: string;
/**
* CDN加速访问下载链接
*/
url: string;
}
interface GetFileInfoResponse {
fileList: Array<GetFileInfoResponseFileItem>;
}
interface UniCloud {
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/storage?id=uploadfile](https://uniapp.dcloud.io/uniCloud/storage?id=uploadfile)
*/
uploadFile(options: UploadFileOptions): Promise<any>;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/storage?id=chooseanduploadfile](https://uniapp.dcloud.io/uniCloud/storage?id=chooseanduploadfile)
*/
chooseAndUploadFile(options: ChooseAndUploadFileOptions): Promise<any>;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/storage?id=deletefile](https://uniapp.dcloud.io/uniCloud/storage?id=deletefile)
*/
deleteFile(options: DeleteFileOptions): Promise<any>;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/storage?id=gettempfileurl](https://uniapp.dcloud.io/uniCloud/storage?id=gettempfileurl)
*/
getTempFileURL(options: GetTempFileURLOptions): Promise<any>;
/**
*
*
* : [https://uniapp.dcloud.io/uniCloud/storage?id=get-file-info](https://uniapp.dcloud.io/uniCloud/storage?id=get-file-info)
*/
getFileInfo(options: GetFileInfoOptions): Promise<GetFileInfoResponse>;
}
}

View File

@ -0,0 +1,21 @@
declare namespace UniCloudNamespace {
interface ConnectWebSocketOptions {
/**
* WebSocket云函数/
*/
name: string | string.CloudFunctionString;
/**
* , connection
*/
query?: Record<string, string>;
}
interface UniCloud {
/**
* WebSocket
*
* : [uniCloud.connectWebSocket](https://doc.dcloud.net.cn/uniCloud/websocket.html#unicloud-connectwebsocket)
*/
connectWebSocket(options: ConnectWebSocketOptions): UniApp.SocketTask;
}
}

View File

@ -0,0 +1,2 @@
/// <reference path="./base.d.ts" />
/// <reference path="./extension/index.d.ts" />

View File

@ -0,0 +1,2 @@
/// <reference path="./wx/index.d.ts" />
/// <reference path="./promisify/index.d.ts" />

View File

@ -0,0 +1,34 @@
declare namespace UniNamespace {
type PromisifySuccessResult<
P,
T extends {
success?: (...args: any[]) => void
},
R = void
> = P extends {
success: any
}
? R
: P extends { fail: any }
? R
: P extends { complete: any }
? R
: Promise<Parameters<Exclude<T['success'], undefined>>[0]>;
type ErrorFirstArray<T> = [any, T];
type PromisifySuccessResultLegacy<
P,
T extends {
success?: (...args: any[]) => void
}
> = P extends {
success: any
}
? void
: P extends { fail: any }
? void
: P extends { complete: any }
? void
: Promise<ErrorFirstArray<Parameters<Exclude<T['success'], undefined>>[0]>>;
}

View File

@ -0,0 +1,2 @@
/// <reference path="./common.d.ts" />
/// <reference path="./uni.d.ts" />

View File

@ -0,0 +1,140 @@
interface Uni {
startFacialRecognitionVerify<T extends UniNamespace.StartFacialRecognitionVerifyOption = UniNamespace.StartFacialRecognitionVerifyOption>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartFacialRecognitionVerifyOption>;
getBatteryInfo<T extends UniNamespace.GetBatteryInfoOption = UniNamespace.GetBatteryInfoOption>(option?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBatteryInfoOption>;
startWifi<T extends UniNamespace.StartWifiOption = UniNamespace.StartWifiOption>(option?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartWifiOption>;
stopWifi<T extends UniNamespace.StopWifiOption = UniNamespace.StopWifiOption>(option?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StopWifiOption>;
connectWifi<T extends UniNamespace.ConnectWifiOption = UniNamespace.ConnectWifiOption>(option: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ConnectWifiOption>;
getConnectedWifi<T extends UniNamespace.GetConnectedWifiOption = UniNamespace.GetConnectedWifiOption>(option?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetConnectedWifiOption>;
getWifiList<T extends UniNamespace.GetWifiListOption = UniNamespace.GetWifiListOption>(option?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetWifiListOption>;
configMTLS<T extends UniNamespace.ConfigMTLSOptions = UniNamespace.ConfigMTLSOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ConfigMTLSOptions>;
sendSocketMessage<T extends UniNamespace.SendSocketMessageOptions = UniNamespace.SendSocketMessageOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SendSocketMessageOptions>;
closeSocket<T extends UniNamespace.CloseSocketOptions = UniNamespace.CloseSocketOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CloseSocketOptions>;
chooseImage<T extends UniNamespace.ChooseImageOptions = UniNamespace.ChooseImageOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ChooseImageOptions>;
chooseFile<T extends UniNamespace.ChooseFileOptions = UniNamespace.ChooseFileOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ChooseFileOptions>;
previewImage<T extends UniNamespace.PreviewImageOptions = UniNamespace.PreviewImageOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.PreviewImageOptions>;
closePreviewImage<T extends UniNamespace.CallBackOptions = UniNamespace.CallBackOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CallBackOptions>;
getImageInfo<T extends UniNamespace.GetImageInfoOptions = UniNamespace.GetImageInfoOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetImageInfoOptions>;
saveImageToPhotosAlbum<T extends UniNamespace.SaveImageToPhotosAlbumOptions = UniNamespace.SaveImageToPhotosAlbumOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SaveImageToPhotosAlbumOptions>;
compressImage<T extends UniNamespace.CompressImageOptions = UniNamespace.CompressImageOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CompressImageOptions>;
chooseVideo<T extends UniNamespace.ChooseVideoOptions = UniNamespace.ChooseVideoOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ChooseVideoOptions>;
compressVideo<T extends UniNamespace.CompressVideoOptions = UniNamespace.CompressVideoOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CompressVideoOptions>;
getVideoInfo<T extends UniNamespace.GetVideoInfoOptions = UniNamespace.GetVideoInfoOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetVideoInfoOptions>;
openVideoEditor<T extends UniNamespace.OpenVideoEditorOptions = UniNamespace.OpenVideoEditorOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.OpenVideoEditorOptions>;
saveVideoToPhotosAlbum<T extends UniNamespace.SaveVideoToPhotosAlbumOptions = UniNamespace.SaveVideoToPhotosAlbumOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SaveVideoToPhotosAlbumOptions>;
saveFile<T extends UniNamespace.SaveFileOptions = UniNamespace.SaveFileOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SaveFileOptions>;
getFileInfo<T extends UniNamespace.GetFileInfoOptions = UniNamespace.GetFileInfoOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetFileInfoOptions>;
getSavedFileList<T extends UniNamespace.GetSavedFileListOptions = UniNamespace.GetSavedFileListOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetSavedFileListOptions>;
getSavedFileInfo<T extends UniNamespace.GetSavedFileInfoOptions = UniNamespace.GetSavedFileInfoOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetSavedFileInfoOptions>;
removeSavedFile<T extends UniNamespace.RemoveSavedFileOptions = UniNamespace.RemoveSavedFileOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.RemoveSavedFileOptions>;
openDocument<T extends UniNamespace.OpenDocumentOptions = UniNamespace.OpenDocumentOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.OpenDocumentOptions>;
setStorage<T extends UniNamespace.SetStorageOptions = UniNamespace.SetStorageOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetStorageOptions>;
getStorage<T = any, U extends UniNamespace.GetStorageOptions<T> = UniNamespace.GetStorageOptions<T>>(options: U): UniNamespace.PromisifySuccessResult<U, UniNamespace.GetStorageOptions<T>>;
getStorageInfo<T extends UniNamespace.GetStorageInfoOptions = UniNamespace.GetStorageInfoOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetStorageInfoOptions>;
removeStorage<T extends UniNamespace.RemoveStorageOptions = UniNamespace.RemoveStorageOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.RemoveStorageOptions>;
getLocation<T extends UniNamespace.GetLocationOptions = UniNamespace.GetLocationOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetLocationOptions>;
chooseLocation<T extends UniNamespace.ChooseLocationOptions = UniNamespace.ChooseLocationOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ChooseLocationOptions>;
openLocation<T extends UniNamespace.OpenLocationOptions = UniNamespace.OpenLocationOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.OpenLocationOptions>;
getSystemInfo<T extends UniNamespace.GetSystemInfoOptions = UniNamespace.GetSystemInfoOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetSystemInfoOptions>;
getNetworkType<T extends UniNamespace.GetNetworkTypeOptions = UniNamespace.GetNetworkTypeOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetNetworkTypeOptions>;
startAccelerometer<T extends UniNamespace.StartAccelerometerOptions = UniNamespace.StartAccelerometerOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartAccelerometerOptions>;
stopAccelerometer<T extends UniNamespace.StopAccelerometerOptions = UniNamespace.StopAccelerometerOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StopAccelerometerOptions>;
startCompass<T extends UniNamespace.StartCompassOptions = UniNamespace.StartCompassOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartCompassOptions>;
stopCompass<T extends UniNamespace.StopCompassOptions = UniNamespace.StopCompassOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StopCompassOptions>;
makePhoneCall<T extends UniNamespace.MakePhoneCallOptions = UniNamespace.MakePhoneCallOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.MakePhoneCallOptions>;
scanCode<T extends UniNamespace.ScanCodeOptions = UniNamespace.ScanCodeOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ScanCodeOptions>;
setClipboardData<T extends UniNamespace.SetClipboardDataOptions = UniNamespace.SetClipboardDataOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetClipboardDataOptions>;
getClipboardData<T extends UniNamespace.GetClipboardDataOptions = UniNamespace.GetClipboardDataOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetClipboardDataOptions>;
openAppAuthorizeSetting<T extends UniNamespace.CallBackOptions = UniNamespace.CallBackOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CallBackOptions>;
getSelectedTextRange<T extends UniNamespace.GetSelectedTextRangeOptions = UniNamespace.GetSelectedTextRangeOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetSelectedTextRangeOptions>;
setScreenBrightness<T extends UniNamespace.SetScreenBrightnessOptions = UniNamespace.SetScreenBrightnessOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetScreenBrightnessOptions>;
getScreenBrightness<T extends UniNamespace.GetScreenBrightnessOptions = UniNamespace.GetScreenBrightnessOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetScreenBrightnessOptions>;
setKeepScreenOn<T extends UniNamespace.SetKeepScreenOnOptions = UniNamespace.SetKeepScreenOnOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetKeepScreenOnOptions>;
vibrate<T extends UniNamespace.VibrateOptions = UniNamespace.VibrateOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.VibrateOptions>;
vibrateLong<T extends UniNamespace.VibrateLongOptions = UniNamespace.VibrateLongOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.VibrateLongOptions>;
vibrateShort<T extends UniNamespace.VibrateShortOptions = UniNamespace.VibrateShortOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.VibrateShortOptions>;
addPhoneContact<T extends UniNamespace.AddPhoneContactOptions = UniNamespace.AddPhoneContactOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.AddPhoneContactOptions>;
getBeacons<T extends UniNamespace.GetBeaconsOptions = UniNamespace.GetBeaconsOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBeaconsOptions>;
startBeaconDiscovery<T extends UniNamespace.StartBeaconDiscoveryOptions = UniNamespace.StartBeaconDiscoveryOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartBeaconDiscoveryOptions>;
stopBeaconDiscovery<T extends UniNamespace.StopBeaconDiscoveryOptions = UniNamespace.StopBeaconDiscoveryOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StopBeaconDiscoveryOptions>;
closeBluetoothAdapter<T extends UniNamespace.CloseBluetoothAdapterOptions = UniNamespace.CloseBluetoothAdapterOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CloseBluetoothAdapterOptions>;
getBluetoothAdapterState<T extends UniNamespace.GetBluetoothAdapterStateOptions = UniNamespace.GetBluetoothAdapterStateOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBluetoothAdapterStateOptions>;
getBluetoothDevices<T extends UniNamespace.GetBluetoothDevicesOptions = UniNamespace.GetBluetoothDevicesOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBluetoothDevicesOptions>;
getConnectedBluetoothDevices<T extends UniNamespace.GetConnectedBluetoothDevicesOptions = UniNamespace.GetConnectedBluetoothDevicesOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetConnectedBluetoothDevicesOptions>;
openBluetoothAdapter<T extends UniNamespace.OpenBluetoothAdapterOptions = UniNamespace.OpenBluetoothAdapterOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.OpenBluetoothAdapterOptions>;
startBluetoothDevicesDiscovery<T extends UniNamespace.StartBluetoothDevicesDiscoveryOptions = UniNamespace.StartBluetoothDevicesDiscoveryOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartBluetoothDevicesDiscoveryOptions>;
stopBluetoothDevicesDiscovery<T extends UniNamespace.StopBluetoothDevicesDiscoveryOptions = UniNamespace.StopBluetoothDevicesDiscoveryOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StopBluetoothDevicesDiscoveryOptions>;
closeBLEConnection<T extends UniNamespace.CloseBLEConnectionOptions = UniNamespace.CloseBLEConnectionOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CloseBLEConnectionOptions>;
createBLEConnection<T extends UniNamespace.CreateBLEConnectionOptions = UniNamespace.CreateBLEConnectionOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CreateBLEConnectionOptions>;
getBLEDeviceCharacteristics<T extends UniNamespace.GetBLEDeviceCharacteristicsOptions = UniNamespace.GetBLEDeviceCharacteristicsOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBLEDeviceCharacteristicsOptions>;
getBLEDeviceServices<T extends UniNamespace.GetBLEDeviceServicesOptions = UniNamespace.GetBLEDeviceServicesOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBLEDeviceServicesOptions>;
notifyBLECharacteristicValueChange<T extends UniNamespace.NotifyBLECharacteristicValueChangeOptions = UniNamespace.NotifyBLECharacteristicValueChangeOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.NotifyBLECharacteristicValueChangeOptions>;
readBLECharacteristicValue<T extends UniNamespace.ReadBLECharacteristicValueOptions = UniNamespace.ReadBLECharacteristicValueOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ReadBLECharacteristicValueOptions>;
writeBLECharacteristicValue<T extends UniNamespace.WriteBLECharacteristicValueOptions = UniNamespace.WriteBLECharacteristicValueOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.WriteBLECharacteristicValueOptions>;
setBLEMTU<T extends UniNamespace.SetBLEMTUOptions = UniNamespace.SetBLEMTUOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetBLEMTUOptions>;
getBLEDeviceRSSI<T extends UniNamespace.GetBLEDeviceRSSIOptions = UniNamespace.GetBLEDeviceRSSIOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetBLEDeviceRSSIOptions>;
showToast<T extends UniNamespace.ShowToastOptions = UniNamespace.ShowToastOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowToastOptions>;
showLoading<T extends UniNamespace.ShowLoadingOptions = UniNamespace.ShowLoadingOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowLoadingOptions>;
showModal<T extends UniNamespace.ShowModalOptions = UniNamespace.ShowModalOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowModalOptions>;
showActionSheet<T extends UniNamespace.ShowActionSheetOptions = UniNamespace.ShowActionSheetOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowActionSheetOptions>;
setNavigationBarTitle<T extends UniNamespace.SetNavigationBarTitleOptions = UniNamespace.SetNavigationBarTitleOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetNavigationBarTitleOptions>;
setNavigationBarColor<T extends UniNamespace.SetNavigationbarColorOptions = UniNamespace.SetNavigationbarColorOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetNavigationbarColorOptions>;
setTabBarItem<T extends UniNamespace.SetTabBarItemOptions = UniNamespace.SetTabBarItemOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetTabBarItemOptions>;
setTabBarStyle<T extends UniNamespace.SetTabBarStyleOptions = UniNamespace.SetTabBarStyleOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetTabBarStyleOptions>;
hideTabBar<T extends UniNamespace.HideTabBarOptions = UniNamespace.HideTabBarOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.HideTabBarOptions>;
showTabBar<T extends UniNamespace.ShowTabBarOptions = UniNamespace.ShowTabBarOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowTabBarOptions>;
setTabBarBadge<T extends UniNamespace.SetTabBarBadgeOptions = UniNamespace.SetTabBarBadgeOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetTabBarBadgeOptions>;
removeTabBarBadge<T extends UniNamespace.RemoveTabBarBadgeOptions = UniNamespace.RemoveTabBarBadgeOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.RemoveTabBarBadgeOptions>;
showTabBarRedDot<T extends UniNamespace.ShowTabBarRedDotOptions = UniNamespace.ShowTabBarRedDotOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowTabBarRedDotOptions>;
hideTabBarRedDot<T extends UniNamespace.HideTabBarRedDotOptions = UniNamespace.HideTabBarRedDotOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.HideTabBarRedDotOptions>;
navigateTo<T extends UniNamespace.NavigateToOptions = UniNamespace.NavigateToOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.NavigateToOptions>;
redirectTo<T extends UniNamespace.RedirectToOptions = UniNamespace.RedirectToOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.RedirectToOptions>;
reLaunch<T extends UniNamespace.ReLaunchOptions = UniNamespace.ReLaunchOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ReLaunchOptions>;
switchTab<T extends UniNamespace.SwitchTabOptions = UniNamespace.SwitchTabOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SwitchTabOptions>;
navigateBack<T extends UniNamespace.NavigateBackOptions = UniNamespace.NavigateBackOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.NavigateBackOptions>;
preloadPage<T extends UniNamespace.PreloadPageOptions = UniNamespace.PreloadPageOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.PreloadPageOptions>;
pageScrollTo<T extends UniNamespace.PageScrollToOptions = UniNamespace.PageScrollToOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.PageScrollToOptions>;
startPullDownRefresh<T extends UniNamespace.StartPullDownRefreshOptions = UniNamespace.StartPullDownRefreshOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartPullDownRefreshOptions>;
canvasToTempFilePath<T extends UniNamespace.CanvasToTempFilePathOptions = UniNamespace.CanvasToTempFilePathOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CanvasToTempFilePathOptions>;
canvasGetImageData<T extends UniNamespace.CanvasGetImageDataOptions = UniNamespace.CanvasGetImageDataOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CanvasGetImageDataOptions>;
canvasPutImageData<T extends UniNamespace.CanvasPutImageDataOptions = UniNamespace.CanvasPutImageDataOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CanvasPutImageDataOptions>;
showTopWindow<T extends UniNamespace.CommonOptions = UniNamespace.CommonOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CommonOptions>;
hideTopWindow<T extends UniNamespace.CommonOptions = UniNamespace.CommonOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CommonOptions>;
showLeftWindow<T extends UniNamespace.CommonOptions = UniNamespace.CommonOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CommonOptions>;
hideLeftWindow<T extends UniNamespace.CommonOptions = UniNamespace.CommonOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CommonOptions>;
showRightWindow<T extends UniNamespace.CommonOptions = UniNamespace.CommonOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CommonOptions>;
hideRightWindow<T extends UniNamespace.CommonOptions = UniNamespace.CommonOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CommonOptions>;
getProvider<T extends UniNamespace.GetProviderOptions = UniNamespace.GetProviderOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetProviderOptions>;
login<T extends UniNamespace.LoginOptions = UniNamespace.LoginOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.LoginOptions>;
checkSession<T extends UniNamespace.CheckSessionOptions = UniNamespace.CheckSessionOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CheckSessionOptions>;
getUserInfo<T extends UniNamespace.GetUserInfoOptions = UniNamespace.GetUserInfoOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetUserInfoOptions>;
getUserProfile<T extends UniNamespace.GetUserProfileOptions = UniNamespace.GetUserProfileOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetUserProfileOptions>;
preLogin<T extends UniNamespace.PreLoginOptions = UniNamespace.PreLoginOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.PreLoginOptions>;
getCheckBoxState<T extends UniNamespace.GetCheckBoxStateOptions = UniNamespace.GetCheckBoxStateOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetCheckBoxStateOptions>;
share<T extends UniNamespace.ShareOptions = UniNamespace.ShareOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShareOptions>;
shareWithSystem<T extends UniNamespace.ShareWithSystemOptions = UniNamespace.ShareWithSystemOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShareWithSystemOptions>;
getPushClientId<T extends UniNamespace.GetPushClientIdOptions = UniNamespace.GetPushClientIdOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetPushClientIdOptions>;
requestPayment<T extends UniNamespace.RequestPaymentOptions = UniNamespace.RequestPaymentOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.RequestPaymentOptions>;
authorize<T extends UniNamespace.AuthorizeOptions = UniNamespace.AuthorizeOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.AuthorizeOptions>;
openSetting<T extends UniNamespace.OpenSettingOptions = UniNamespace.OpenSettingOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.OpenSettingOptions>;
getSetting<T extends UniNamespace.GetSettingOptions = UniNamespace.GetSettingOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetSettingOptions>;
chooseAddress<T extends UniNamespace.ChooseAddressOptions = UniNamespace.ChooseAddressOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ChooseAddressOptions>;
chooseInvoiceTitle<T extends UniNamespace.ChooseInvoiceTitleOptions = UniNamespace.ChooseInvoiceTitleOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ChooseInvoiceTitleOptions>;
navigateToMiniProgram<T extends UniNamespace.NavigateToMiniProgramOptions = UniNamespace.NavigateToMiniProgramOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.NavigateToMiniProgramOptions>;
navigateBackMiniProgram<T extends UniNamespace.NavigateBackMiniProgramOptions = UniNamespace.NavigateBackMiniProgramOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.NavigateBackMiniProgramOptions>;
setEnableDebug<T extends UniNamespace.SetEnableDebugOptions = UniNamespace.SetEnableDebugOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetEnableDebugOptions>;
getExtConfig<T extends UniNamespace.GetExtConfigOptions = UniNamespace.GetExtConfigOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.GetExtConfigOptions>;
showShareMenu<T extends UniNamespace.ShowShareMenuOptions = UniNamespace.ShowShareMenuOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ShowShareMenuOptions>;
hideShareMenu<T extends UniNamespace.HideShareMenuOptions = UniNamespace.HideShareMenuOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.HideShareMenuOptions>;
setBackgroundColor<T extends UniNamespace.SetBackgroundColorOptions = UniNamespace.SetBackgroundColorOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetBackgroundColorOptions>;
setBackgroundTextStyle<T extends UniNamespace.SetBackgroundTextStyleOptions = UniNamespace.SetBackgroundTextStyleOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.SetBackgroundTextStyleOptions>;
startGyroscope<T extends UniNamespace.StartGyroscopeOptions = UniNamespace.StartGyroscopeOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartGyroscopeOptions>;
stopGyroscope<T extends UniNamespace.StopGyroscopeOptions = UniNamespace.StopGyroscopeOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StopGyroscopeOptions>;
loadFontFace<T extends UniNamespace.LoadFontFaceOptions = UniNamespace.LoadFontFaceOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.LoadFontFaceOptions>;
startSoterAuthentication<T extends UniNamespace.StartSoterAuthenticationOptions = UniNamespace.StartSoterAuthenticationOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.StartSoterAuthenticationOptions>;
checkIsSupportSoterAuthentication<T extends UniNamespace.CheckIsSupportSoterAuthenticationOptions = UniNamespace.CheckIsSupportSoterAuthenticationOptions>(options?: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CheckIsSupportSoterAuthenticationOptions>;
checkIsSoterEnrolledInDevice<T extends UniNamespace.CheckIsSoterEnrolledInDeviceOptions = UniNamespace.CheckIsSoterEnrolledInDeviceOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.CheckIsSoterEnrolledInDeviceOptions>;
connectSocket<T extends UniNamespace.ConnectSocketOption = UniNamespace.ConnectSocketOption>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.ConnectSocketOption, UniNamespace.SocketTask>;
request<T extends UniNamespace.RequestOptions = UniNamespace.RequestOptions>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.RequestOptions, UniNamespace.RequestTask>;
uploadFile<T extends UniNamespace.UploadFileOption = UniNamespace.UploadFileOption>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.UploadFileOption, UniNamespace.UploadTask>;
downloadFile<T extends UniNamespace.DownloadFileOption = UniNamespace.DownloadFileOption>(options: T): UniNamespace.PromisifySuccessResult<T, UniNamespace.DownloadFileOption, UniNamespace.DownloadTask>;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
declare namespace UniNamespace {
interface GeneralCallbackResult {
/**
*
*/
errMsg: string;
}
/**
*
*/
type OnAppErrorCallback = (
/** 错误信息,包含堆栈 */
error: string
) => void;
/**
* onError
*/
type OffAppErrorCallback = (res: GeneralCallbackResult) => void;
interface SourceError {
subject?: string;
code?: number;
message?: string;
cause?: SourceError | AggregateError;
}
// 聚合源错误信息
interface AggregateError extends SourceError {
errors: Array<SourceError | AggregateError>;
}
interface UniError {
errSubject: string;
errCode: number;
errMsg: string;
data?: object;
cause?: SourceError | AggregateError;
}
}
interface Uni {
/**
*
* `2.1.2`
*
* 使
*
* API [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
*
* : [https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
*/
onError(listener: UniNamespace.OnAppErrorCallback): void;
/**
*
* `2.1.2`
*
* 使
*
*
*
*
* : [https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
*/
offError(listener?: UniNamespace.OffAppErrorCallback): void;
}

View File

@ -0,0 +1,402 @@
import { AsyncOptions } from './Utils';
declare global {
namespace UniNamespace {
interface MapContext {
/**
* gcj02 uni.openLocation
*/
getCenterLocation(options: MapContextGetCenterLocationOptions): void;
/**
* map组件的show-location使用
*/
moveToLocation(options: MapContextMoveToLocationOptions): void;
/**
* marker
*/
translateMarker(options: MapContextTranslateMarkerOptions): void;
/**
*
*/
includePoints(options: MapContextIncludePointsOptions): void;
/**
*
*/
getRegion(options: MapContextGetRegionOptions): void;
/**
*
*/
getScale(options: MapContextGetScaleOptions): void;
/**
*
*/
addCustomLayer?: (options: MapContextAddCustomLayerOptions) => void;
/**
*
*/
addGroundOverlay(options: MapContextAddGroundOverlayOptions): void;
/**
* marker
*/
addMarkers(options: MapContextAddMarkersOptions): void;
/**
*
*/
fromScreenLocation?: (options: MapContextFromScreenLocationOptions) => void;
/**
*
*/
initMarkerCluster(options: MapContextInitMarkerClusterOptions): void;
/**
* 沿 marker marker moveAlong
*/
moveAlong(options: MapContextMoveAlongOptions): void;
/**
* APP选择导航
*/
openMapApp(options: MapContextOpenMapAppOptions): void;
/**
*
*/
removeCustomLayer(options: MapContextRemoveCustomLayerOptions): void;
/**
*
*/
removeGroundOverlay(options: MapContextRemoveGroundOverlayOptions): void;
/**
* marker
*/
removeMarkers(options: MapContextRemoveMarkersOptions): void;
/**
* (0.25~0.75)[0.5, 0.5]
*/
setCenterOffset?: (options: MapContextSetCenterOffsetOptions) => void;
/**
*
*/
toScreenLocation?: (options: MapContextToScreenLocationOptions) => void;
/**
*
*/
updateGroundOverlay(options: MapContextUpdateGroundOverlayOptions): void;
/**
*
*/
on(event: 'markerClusterCreate' | 'markerClusterClick', callback: (...args: any[]) => any): void;
/**
* plus.maps.Map
*/
$getAppMap(): any;
}
interface MapContextGetCenterLocationOptions extends AsyncOptions {
/**
* res = { longitude: "经度", latitude: "纬度"}
*/
success?: (result: LocationObject) => void;
}
interface MapContextMoveToLocationOptions extends AsyncOptions {
/**
* -90~90
*/
latitude?: number;
/**
* -180~180西
*/
longitude?: number;
}
interface LocationObject {
/**
* -90~90
*/
latitude: number;
/**
* -180~180西
*/
longitude: number;
}
interface MapContextTranslateMarkerOptions extends AsyncOptions {
/**
* marker
*/
markerId: number;
/**
* marker移动到的目标点
*/
destination: LocationObject;
/**
* marker
*/
autoRotate: boolean;
/**
* marker的旋转角度
*/
rotate: number;
/**
* false2.13.0
*/
moveWithRotate?: boolean;
/**
* 1000ms
*/
duration?: number;
/**
*
*/
animationEnd?: (result: any) => void;
}
interface MapContextIncludePointsOptions extends AsyncOptions {
/**
* [{latitude, longitude}]
*/
points: LocationObject[];
/**
* [,,,]padding一致padding参数
*/
padding?: number[];
}
interface MapContextGetRegionOptions extends AsyncOptions {
/**
* res = {southwest, northeast}西
*/
success?: (result: MapContextGetRegionResult) => void;
}
interface MapContextGetRegionResult {
/**
* 西
*/
southwest: LocationObject;
/**
*
*/
northeast: LocationObject;
}
interface MapContextGetScaleOptions extends AsyncOptions {
/**
* res = {scale}
*/
success?: (result: MapContextGetScaleResult) => void;
}
interface MapContextGetScaleResult {
/**
*
*/
scale: number;
}
interface MapContextAddCustomLayerOptions extends AsyncOptions {
/**
* id
*/
layerId: string;
}
interface MapContextAddGroundOverlayOptions extends AsyncOptions {
/**
* id
*/
id: string;
/**
*
*/
src: string;
/**
*
*/
bounds: Bounds;
/**
*
*/
visible?: boolean;
/**
*
*/
zIndex?: number;
/**
*
*/
opacity?: number;
}
interface Bounds {
/**
* 西
*/
southwest: LocationObject;
/**
*
*/
northeast: LocationObject;
}
interface MapContextAddMarkersOptions extends AsyncOptions {
/**
* map marker
*/
markers: any[];
/**
* marker
*/
clear: boolean;
}
interface MapContextFromScreenLocationOptions extends AsyncOptions {
/**
* x
*/
x: number;
/**
* y
*/
y: number;
/**
*
*/
success?: (result: LocationObject) => void;
}
interface MapContextInitMarkerClusterOptions extends AsyncOptions {
/**
*
*/
enableDefaultStyle: boolean;
/**
*
*/
zoomOnClick: boolean;
/**
*
*/
gridSize: number;
}
interface MapContextMoveAlongOptions extends AsyncOptions {
/**
* marker
*/
markerId: number;
/**
* {longitude, latitude}
*/
path: LocationObject[];
/**
* marker
*/
autoRotate?: boolean;
/**
*
*/
duration: number;
}
interface MapContextOpenMapAppOptions extends AsyncOptions {
/**
*
*/
destination: string;
/**
*
*/
latitude: number;
/**
*
*/
longitude: number;
}
interface MapContextRemoveCustomLayerOptions extends AsyncOptions {
/**
* id
*/
layerId: string;
}
interface MapContextRemoveGroundOverlayOptions extends AsyncOptions {
/**
* id
*/
id: string;
}
interface MapContextRemoveMarkersOptions extends AsyncOptions {
/**
* marker的id属性组成的数组
*/
markerIds: any[];
}
interface MapContextSetCenterOffsetOptions {
/**
*
*/
offset: number[];
/**
*
*/
success?: (result: any) => void;
/**
*
*/
fail?: (result: any) => void;
/**
*
*/
complete?: (result: any) => void;
}
interface MapContextToScreenLocationOptions extends AsyncOptions {
/**
*
*/
latitude: number;
/**
*
*/
longitude: number;
}
interface MapContextUpdateGroundOverlayOptions extends AsyncOptions {
/**
* id
*/
id: string;
/**
*
*/
src: string;
/**
*
*/
bounds: Bounds;
/**
*
*/
visible?: boolean;
/**
*
*/
zIndex?: number;
/**
*
*/
opacity?: number;
}
}
interface Uni {
/**
* map mapContext
*
* : [http://uniapp.dcloud.io/api/location/map?id=createmapcontext](http://uniapp.dcloud.io/api/location/map?id=createmapcontext)
*/
createMapContext(mapId: string, currentComponent?: any): UniNamespace.MapContext;
}
}

View File

@ -0,0 +1,24 @@
declare namespace UniNamespace {
interface OnThemeChangeCallbackResult {
/**
*
*/
theme: 'dark' | 'light';
}
type OnThemeChangeCallback = (res: OnThemeChangeCallbackResult) => void;
}
interface Uni {
/**
*
*
* : [https://uniapp.dcloud.net.cn/api/system/theme.html#onthemechange](https://uniapp.dcloud.net.cn/api/system/theme.html#onthemechange)
*/
onThemeChange(callback: UniNamespace.OnThemeChangeCallback): void;
/**
*
*
* : [https://uniapp.dcloud.net.cn/api/system/theme.html#offthemechange](https://uniapp.dcloud.net.cn/api/system/theme.html#offthemechange)
*/
offThemeChange(callback: UniNamespace.OnThemeChangeCallback): void;
}

View File

@ -0,0 +1,43 @@
declare namespace UniNamespace {
interface OnUnhandledRejectionCallbackResult {
/**
* Promise
*/
promise: Promise<any>;
/**
* Error
*/
reason: string;
}
/**
* Promise
*/
type OnUnhandledRejectionCallback = (result: OnUnhandledRejectionCallbackResult) => void;
}
interface Uni {
/**
* Promise `App.onUnhandledRejection`
*
* ****
*
*
* -
* - unhandledRejection Error
*
* `2.10.0`
*
* : [https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)
*/
onUnhandledRejection(callback: UniNamespace.OnUnhandledRejectionCallback): void;
/**
* Promise
*
* `2.10.0`
*
* : [https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html)
*/
offUnhandledRejection(callback: UniNamespace.OnUnhandledRejectionCallback): void;
}

View File

@ -0,0 +1,14 @@
export interface AsyncOptions {
/**
*
*/
success?: (result: any) => void;
/**
*
*/
fail?: (result: any) => void;
/**
*
*/
complete?: (result: any) => void;
}

View File

@ -0,0 +1,5 @@
/// <reference path="./ThemeChange.d.ts" />
/// <reference path="./UnhandledRejectiond.d.ts" />
/// <reference path="./Error.d.ts" />
/// <reference path="./MapContext.d.ts" />
/// <reference path="./request.d.ts" />

View File

@ -0,0 +1,200 @@
declare namespace UniNamespace {
interface RequestOptions {
/**
* url
*/
url: string;
/**
*
*/
data?: string | AnyObject | ArrayBuffer;
/**
* headerheader Referer
*/
header?: any;
/**
* GET
* OPTIONSGETHEADPOSTPUTDELETETRACECONNECT
*/
method?: 'OPTIONS' | 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'TRACE' | 'CONNECT';
/**
*
*/
timeout?: number;
/**
* json JSON.parse
*/
dataType?: string;
/**
* textarraybuffer
*/
responseType?: string;
/**
* ssl
*/
sslVerify?: boolean;
/**
*
*/
withCredentials?: boolean;
/**
* DNS解析时优先使用 ipv4
*/
firstIpv4?: boolean;
/**
* http2
*/
enableHttp2?: boolean;
/**
* quic
*/
enableQuic?: boolean;
/**
* cache
*/
enableCache?: boolean;
/**
* HttpDNS httpDNSServiceId HttpDNS [HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html)
*/
enableHttpDNS?: boolean;
/**
* HttpDNS Id HttpDNS [HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html)
*/
httpDNSServiceId?: boolean;
/**
* transfer-encoding chunked
*/
enableChunked?: boolean;
/**
* wifi下使用移动网络发送请求
*/
forceCellularNetwork?: boolean;
/**
* falseheaders中编辑cookie10.2.33
*/
enableCookie?: boolean;
/**
* [](https://smartprogram.baidu.com/docs/develop/extended/component-codeless/cloud-speed/introduction/)
*/
cloudCache?: object | boolean;
/**
*
*/
defer?: boolean;
success?: (result: RequestSuccessCallbackResult) => void;
/**
*
*/
fail?: (result: GeneralCallbackResult) => void;
/**
*
*/
complete?: (result: GeneralCallbackResult) => void;
}
interface RequestSuccessCallbackResult {
/**
*
*/
data: string | AnyObject | ArrayBuffer;
/**
* HTTP
*/
statusCode: number;
/**
* HTTP Response Header
*/
header: any;
/**
* cookies
*/
cookies: string[];
}
interface RequestTask {
/**
*
* @tutorial https://uniapp.dcloud.net.cn/api/request/request.html#request
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "9.0",
* "uniVer": "√",
* "unixVer": "3.9.0"
* }
* }
* }
* @example ```typescript
* var requestTask = uni.request({
* url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
* complete: ()=> {}
* });
* requestTask.abort();
* ```
*/
abort(): void;
/**
* HTTP Response Header
*/
onHeadersReceived(callback: (result: any) => void): void;
/**
* HTTP Response Header
*/
offHeadersReceived(callback: (result: any) => void): void;
}
}
interface Uni {
/**
*
*
* : [http://uniapp.dcloud.io/api/request/request?id=request](http://uniapp.dcloud.io/api/request/request?id=request)
* @tutorial https://uniapp.dcloud.net.cn/api/request/request.html
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "9.0",
* "uniVer": "√",
* "unixVer": "3.9.0"
* }
* }
* }
* @example ```typescript
* uni.request({
* url: "http://192.168.12.106:8080/postHalo",
* dataType: "json",
* responseType: "json",
* method: "POST",
* data: {
* platform: "ios",
* },
* // header: {
* // "Content-Type": "application/json",
* // },
* timeout: 6000,
* sslVerify: false,
* withCredentials: false,
* firstIpv4: false,
* success(res) {
* console.log("success :", res.data);
* },
* fail(e) {
* console.log(e);
* },
* complete(res) {
* console.log("complete :", res);
* },
* });
* ```
*/
request(options: UniNamespace.RequestOptions): UniNamespace.RequestTask;
}

View File

@ -0,0 +1,61 @@
declare namespace UniNamespace {
interface StartFacialRecognitionVerifyCallbackResult {
/**
* 0
*/
errCode: number;
/**
*
*/
errMsg: string;
/**
* /
*/
errSubject?: string;
/**
*
*/
cause?: any;
}
interface StartFacialRecognitionVerifyOption {
/**
*
*/
certifyId: string;
/**
*
*/
progressBarColor?: string;
/**
* UI朝向port land port
*/
screenOrientation?: string;
/**
*
*/
complete?: (result: StartFacialRecognitionVerifyCallbackResult) => void;
/**
*
*/
fail?: (result: StartFacialRecognitionVerifyCallbackResult) => void;
/**
*
*/
success?: (result: StartFacialRecognitionVerifyCallbackResult) => void;
}
}
interface Uni {
/**
* MetaInfo
*
* : [https://uniapp.dcloud.net.cn/uniCloud/frv/dev.html#get-meta-info](https://uniapp.dcloud.net.cn/uniCloud/frv/dev.html#get-meta-info)
*/
getFacialRecognitionMetaInfo(): string;
/**
*
*
* : [https://uniapp.dcloud.net.cn/uniCloud/frv/dev.html#start-frv](https://uniapp.dcloud.net.cn/uniCloud/frv/dev.html#start-frv)
*/
startFacialRecognitionVerify(options: UniNamespace.StartFacialRecognitionVerifyOption): void;
}

View File

@ -0,0 +1,23 @@
declare namespace UniNamespace {
interface OnMemoryWarningCallbackResult {
/**
* Android
*/
level: number;
}
type OnMemoryWarningCallback = (res: OnMemoryWarningCallbackResult) => void;
}
interface Uni {
/**
*
*
* : [https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning](https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning)
*/
onMemoryWarning(callback: UniNamespace.OnMemoryWarningCallback): void;
/**
* callback
*
* : [https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning](https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning)
*/
offMemoryWarning(callback?: UniNamespace.OnMemoryWarningCallback): void;
}

View File

@ -0,0 +1,18 @@
declare namespace UniNamespace {
type OnUserCaptureScreenCallback = (res?: { errMsg: string }) => void;
}
interface Uni {
/**
* 使
*
* : [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)
*/
onUserCaptureScreen(callback: UniNamespace.OnUserCaptureScreenCallback): void;
/**
*
*
* : [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)
*/
offUserCaptureScreen(callback: UniNamespace.OnUserCaptureScreenCallback): void;
}

View File

@ -0,0 +1,386 @@
declare namespace UniNamespace {
interface WifiError {
/**
*
*
* | | | |
* | - | - | - |
* | 0 | ok | |
* | 12000 | not init | `startWifi` |
* | 12001 | system not support | |
* | 12002 | password error Wi-Fi | |
* | 12003 | connection timeout | , Android |
* | 12004 | duplicate request | Wi-Fi |
* | 12005 | wifi not turned on | Android Wi-Fi |
* | 12006 | gps not turned on | Android GPS |
* | 12007 | user denied | Wi-Fi |
* | 12008 | invalid SSID | SSID |
* | 12009 | system config err | Wi-Fi |
* | 12010 | system internal error | errmsg |
* | 12011 | weapp in background | Wi-Fi |
* | 12013 | wifi config may be expired | Wi-Fi Wi-Fi Android |
* | 12014 | invalid WEP / WPA password | iOS WEP / WPA |
*/
errMsg: string;
/**
*
*
* | | | |
* | - | - | - |
* | 0 | ok | |
* | 12000 | not init | `startWifi` |
* | 12001 | system not support | |
* | 12002 | password error Wi-Fi | |
* | 12003 | connection timeout | , Android |
* | 12004 | duplicate request | Wi-Fi |
* | 12005 | wifi not turned on | Android Wi-Fi |
* | 12006 | gps not turned on | Android GPS |
* | 12007 | user denied | Wi-Fi |
* | 12008 | invalid SSID | SSID |
* | 12009 | system config err | Wi-Fi |
* | 12010 | system internal error | errmsg |
* | 12011 | weapp in background | Wi-Fi |
* | 12013 | wifi config may be expired | Wi-Fi Wi-Fi Android |
* | 12014 | invalid WEP / WPA password | iOS WEP / WPA |
*/
errCode: number;
}
/**
*
*/
type StartWifiCompleteCallback = (res: WifiError) => void;
/**
*
*/
type StartWifiFailCallback = (res: WifiError) => void;
/**
*
*/
type StartWifiSuccessCallback = (res: WifiError) => void;
interface StartWifiOption {
/**
*
*/
complete?: StartWifiCompleteCallback;
/**
*
*/
fail?: StartWifiFailCallback;
/**
*
*/
success?: StartWifiSuccessCallback;
}
/**
*
*/
type StopWifiCompleteCallback = (res: WifiError) => void;
/**
*
*/
type StopWifiFailCallback = (res: WifiError) => void;
/**
*
*/
type StopWifiSuccessCallback = (res: WifiError) => void;
interface StopWifiOption {
/**
*
*/
complete?: StopWifiCompleteCallback;
/**
*
*/
fail?: StopWifiFailCallback;
/**
*
*/
success?: StopWifiSuccessCallback;
}
/**
*
*/
type ConnectWifiCompleteCallback = (res: WifiError) => void;
/**
*
*/
type ConnectWifiFailCallback = (res: WifiError) => void;
/**
*
*/
type ConnectWifiSuccessCallback = (res: WifiError) => void;
interface ConnectWifiOption {
/**
* Wi-Fi SSID
*/
SSID: string;
/**
* Wi-Fi BSSID
*/
BSSID?: string;
/**
* Wi-Fi
*/
password: string;
/**
* `2.12.0`
*
*
*/
maunal?: boolean;
/**
* `2.22.0`
*
* Wi-Fi
*/
partialInfo?: boolean;
/**
*
*/
success?: ConnectWifiSuccessCallback;
/**
*
*/
fail?: ConnectWifiFailCallback;
/**
*
*/
complete?: ConnectWifiCompleteCallback;
}
interface WifiInfo {
/**
* Wi-Fi SSID
*/
SSID: string;
/**
* Wi-Fi BSSID
*/
BSSID: string;
/**
* Wi-Fi
*/
secure: boolean;
/**
* Wi-Fi , 0 100 iOS 0 1
*/
signalStrength: number;
/**
* Wi-Fi MHz
*/
frequency: number;
}
interface OnWifiConnectedListenerResult {
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#WifiInfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#WifiInfo)
*/
wifi: WifiInfo;
}
/**
* Wi-Fi
*/
type OnWifiConnectedCallback = (
result: OnWifiConnectedListenerResult
) => void;
/**
* onWifiConnected
*/
type OffWifiConnectedCallback = (
result: OnWifiConnectedListenerResult
) => void;
interface OnWifiConnectedWithPartialInfoListenerResult {
/**
*
* SSID WifiInfo
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#WifiInfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#WifiInfo)
*/
wifi: WifiInfo;
}
/**
* Wi-Fi
*/
type OnWifiConnectedWithPartialInfoCallback = (
result: OnWifiConnectedWithPartialInfoListenerResult
) => void;
interface GetConnectedWifiSuccessCallbackResult {
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#WifiInfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#WifiInfo)
*/
wifi: WifiInfo;
errMsg: string;
}
/**
*
*/
type GetConnectedWifiSuccessCallback = (
result: GetConnectedWifiSuccessCallbackResult
) => void;
/**
*
*/
type GetConnectedWifiFailCallback = (res: WifiError) => void;
/**
*
*/
type GetConnectedWifiCompleteCallback = (res: WifiError) => void;
interface GetConnectedWifiOption {
/**
* Wi-Fi
*/
partialInfo?: boolean;
/**
*
*/
success?: GetConnectedWifiSuccessCallback;
/**
*
*/
fail?: GetConnectedWifiFailCallback;
/**
*
*/
complete?: GetConnectedWifiCompleteCallback;
}
/**
*
*/
type GetWifiListSuccessCallback = (res: WifiError) => void;
/**
*
*/
type GetWifiListFailCallback = (res: WifiError) => void;
/**
*
*/
type GetWifiListCompleteCallback = (res: WifiError) => void;
interface GetWifiListOption {
/**
*
*/
success?: GetWifiListSuccessCallback;
/**
*
*/
fail?: GetWifiListFailCallback;
/**
*
*/
complete?: GetWifiListCompleteCallback;
}
interface OnGetWifiListListenerResult {
/**
* Wi-Fi
*/
wifiList: WifiInfo[];
}
/**
* Wi-Fi
*/
type OnGetWifiListCallback = (result: OnGetWifiListListenerResult) => void;
/**
* onGetWifiList
*/
type OffGetWifiListCallback = (result: OnGetWifiListListenerResult) => void;
/**
* onWifiConnectedWithPartialInfo
*/
type OffWifiConnectedWithPartialInfoCallback = (
result: OnWifiConnectedWithPartialInfoListenerResult
) => void;
}
interface Uni {
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi)
*/
startWifi(option?: UniNamespace.StartWifiOption): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi)
*/
stopWifi(option?: UniNamespace.StopWifiOption): void;
/**
* Wi-Fi Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#connectwifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#connectwifi)
*/
connectWifi(option: UniNamespace.ConnectWifiOption): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#onwificonnected](https://uniapp.dcloud.net.cn/api/system/wifi.html#onwificonnected)
*/
onWifiConnected(listener: UniNamespace.OnWifiConnectedCallback): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#offwificonnected](https://uniapp.dcloud.net.cn/api/system/wifi.html#offwificonnected)
*/
offWifiConnected(listener?: UniNamespace.OffWifiConnectedCallback): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#getconnectedwifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#getconnectedwifi)
*/
getConnectedWifi(option: UniNamespace.GetConnectedWifiOption): void;
/**
* Wi-Fi wifiList onGetWifiList
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#getwifilist](https://uniapp.dcloud.net.cn/api/system/wifi.html#getwifilist)
*/
getWifiList(option?: UniNamespace.GetWifiListOption): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#ongetwifilist](https://uniapp.dcloud.net.cn/api/system/wifi.html#ongetwifilist)
*/
onGetWifiList(listener: UniNamespace.OnGetWifiListCallback): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#offgetwifilist](https://uniapp.dcloud.net.cn/api/system/wifi.html#offgetwifilist)
*/
offGetWifiList(listener?: UniNamespace.OffGetWifiListCallback): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#onwificonnectedwithpartialinfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#onwificonnectedwithpartialinfo)
*/
onWifiConnectedWithPartialInfo(listener: UniNamespace.OnWifiConnectedWithPartialInfoCallback): void;
/**
* Wi-Fi
*
* : [https://uniapp.dcloud.net.cn/api/system/wifi.html#offwificonnectedwithpartialinfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#offwificonnectedwithpartialinfo)
*/
offWifiConnectedWithPartialInfo(listener?: UniNamespace.OffWifiConnectedWithPartialInfoCallback): void;
}

View File

@ -0,0 +1,37 @@
declare namespace UniNamespace {
interface GetBatteryInfoSuccessCallbackResult {
/**
*
*/
isCharging: boolean;
/**
* 1 - 100
*/
level: number;
errMsg: string;
}
interface GetBatteryInfoOption {
/**
*
*/
complete?: (result: any) => void;
/**
*
*/
fail?: (result: any) => void;
/**
*
*/
success?: (result: GetBatteryInfoSuccessCallbackResult) => void;
}
}
interface Uni {
/**
*
*
* : [https://uniapp.dcloud.net.cn/api/system/batteryInfo.html](https://uniapp.dcloud.net.cn/api/system/batteryInfo.html)
*/
getBatteryInfo(option?: UniNamespace.GetBatteryInfoOption): void;
}

View File

@ -0,0 +1,5 @@
/// <reference path="./getBatteryInfo.d.ts" />
/// <reference path="./MemoryWarning.d.ts" />
/// <reference path="./UserCaptureScreen.d.ts" />
/// <reference path="./Wifi.d.ts" />
/// <reference path="./FacialRecognition.d.ts" />

View File

@ -0,0 +1,3 @@
/// <reference path="./legacy/uni.d.ts" />
/// <reference path="./base/index.d.ts" />
/// <reference path="./ext/index.d.ts" />

File diff suppressed because it is too large Load Diff

202
uniapp04/node_modules/@dcloudio/uni-app/LICENSE generated vendored Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1 @@
export declare function init(): void;

28
uniapp04/node_modules/@dcloudio/uni-app/dist/app.js generated vendored Normal file
View File

@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.init = void 0;
var Vue = require("vue");
function init() {
var vueConstructor = (Vue.default ? Vue.default : Vue);
var defaultMergeHook = vueConstructor.config.optionMergeStrategies.mounted;
var onReadyFn;
vueConstructor.config.optionMergeStrategies.mounted = function Le(parentVal, childVal) {
var res = defaultMergeHook.call(this, parentVal, childVal);
if (Array.isArray(res)) {
var index = void 0;
if (onReadyFn) {
index = res.indexOf(onReadyFn);
}
else {
index = res.findIndex(function (fn) { return fn.toString().includes('onReady'); });
onReadyFn = res[index];
}
if (index !== -1) {
res.splice(index, 1);
res.push(onReadyFn);
}
}
return res;
};
}
exports.init = init;

View File

@ -0,0 +1,31 @@
/// <reference types="@dcloudio/types" />
/// <reference types="@dcloudio/types" />
/// <reference types="@dcloudio/types" />
/// <reference types="@dcloudio/types" />
import { ComponentInternalInstance } from '@vue/composition-api';
export { initUtsProxyClass, initUtsProxyFunction, initUtsIndexClassName, initUtsClassName, initUtsPackageName, } from './uts';
export declare const onShow: (callback: ((options?: App.LaunchShowOption) => void) | (() => void), target?: ComponentInternalInstance | null) => Function;
export declare const onHide: (callback: (() => void) | (() => void), target?: ComponentInternalInstance | null) => Function;
export declare const onLaunch: (callback: (options?: App.LaunchShowOption) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onError: (callback: (error: string) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onPageNotFound: (callback: (options: App.PageNotFoundOption) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onUnhandledRejection: (callback: (options: UniApp.OnUnhandledRejectionCallbackResult) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onThemeChange: (callback: (options: UniApp.OnThemeChangeCallbackResult) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onUniNViewMessage: (callback: (options: AnyObject) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onInit: (callback: (query?: AnyObject) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onLoad: (callback: (query?: AnyObject) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onReady: (callback: () => void, target?: ComponentInternalInstance | null) => Function;
export declare const onUnload: (callback: () => void, target?: ComponentInternalInstance | null) => Function;
export declare const onPullDownRefresh: (callback: () => void, target?: ComponentInternalInstance | null) => Function;
export declare const onReachBottom: (callback: () => void, target?: ComponentInternalInstance | null) => Function;
export declare const onShareAppMessage: (callback: (options: Page.ShareAppMessageOption) => Page.CustomShareContent, target?: ComponentInternalInstance | null) => Function;
export declare const onShareTimeline: (callback: () => Page.ShareTimelineContent, target?: ComponentInternalInstance | null) => Function;
export declare const onAddToFavorites: (callback: (options: Page.AddToFavoritesOption) => Page.CustomFavoritesContent, target?: ComponentInternalInstance | null) => Function;
export declare const onPageScroll: (callback: (options: Page.PageScrollOption) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onResize: (callback: (options: Page.PageScrollOption) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onTabItemTap: (callback: (options: Page.TabItemTapOption) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onNavigationBarButtonTap: (callback: (options: Page.NavigationBarButtonTapOption) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onBackPress: (callback: (options: Page.BackPressOption) => any, target?: ComponentInternalInstance | null) => Function;
export declare const onNavigationBarSearchInputChanged: (callback: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onNavigationBarSearchInputConfirmed: (callback: (event: Page.NavigationBarSearchInputEvent) => void, target?: ComponentInternalInstance | null) => Function;
export declare const onNavigationBarSearchInputClicked: (callback: () => void, target?: ComponentInternalInstance | null) => Function;

53
uniapp04/node_modules/@dcloudio/uni-app/dist/index.js generated vendored Normal file
View File

@ -0,0 +1,53 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onNavigationBarSearchInputClicked = exports.onNavigationBarSearchInputConfirmed = exports.onNavigationBarSearchInputChanged = exports.onBackPress = exports.onNavigationBarButtonTap = exports.onTabItemTap = exports.onResize = exports.onPageScroll = exports.onAddToFavorites = exports.onShareTimeline = exports.onShareAppMessage = exports.onReachBottom = exports.onPullDownRefresh = exports.onUnload = exports.onReady = exports.onLoad = exports.onInit = exports.onUniNViewMessage = exports.onThemeChange = exports.onUnhandledRejection = exports.onPageNotFound = exports.onError = exports.onLaunch = exports.onHide = exports.onShow = exports.initUtsPackageName = exports.initUtsClassName = exports.initUtsIndexClassName = exports.initUtsProxyFunction = exports.initUtsProxyClass = void 0;
var composition_api_1 = require("@vue/composition-api");
var app = require("./app");
var mp = require("./mp");
var uts_1 = require("./uts");
Object.defineProperty(exports, "initUtsProxyClass", { enumerable: true, get: function () { return uts_1.initUtsProxyClass; } });
Object.defineProperty(exports, "initUtsProxyFunction", { enumerable: true, get: function () { return uts_1.initUtsProxyFunction; } });
Object.defineProperty(exports, "initUtsIndexClassName", { enumerable: true, get: function () { return uts_1.initUtsIndexClassName; } });
Object.defineProperty(exports, "initUtsClassName", { enumerable: true, get: function () { return uts_1.initUtsClassName; } });
Object.defineProperty(exports, "initUtsPackageName", { enumerable: true, get: function () { return uts_1.initUtsPackageName; } });
var lifecycles = [];
var createLifeCycle = function (lifecycle) {
lifecycles.push(lifecycle);
var fn = (0, composition_api_1.createLifeCycle)(lifecycle);
return function (callback, target) {
return fn(callback, target);
};
};
if (typeof plus === 'object') {
app.init();
}
else if (typeof window === 'object' && 'document' in window) {
}
else {
mp.init(lifecycles);
}
exports.onShow = createLifeCycle('onShow');
exports.onHide = createLifeCycle('onHide');
exports.onLaunch = createLifeCycle('onLaunch');
exports.onError = createLifeCycle('onError');
exports.onPageNotFound = createLifeCycle('onPageNotFound');
exports.onUnhandledRejection = createLifeCycle('onUnhandledRejection');
exports.onThemeChange = createLifeCycle('onThemeChange');
exports.onUniNViewMessage = createLifeCycle('onUniNViewMessage');
exports.onInit = createLifeCycle('onInit');
exports.onLoad = createLifeCycle('onLoad');
exports.onReady = createLifeCycle('onReady');
exports.onUnload = createLifeCycle('onUnload');
exports.onPullDownRefresh = createLifeCycle('onPullDownRefresh');
exports.onReachBottom = createLifeCycle('onReachBottom');
exports.onShareAppMessage = createLifeCycle('onShareAppMessage');
exports.onShareTimeline = createLifeCycle('onShareTimeline');
exports.onAddToFavorites = createLifeCycle('onAddToFavorites');
exports.onPageScroll = createLifeCycle('onPageScroll');
exports.onResize = createLifeCycle('onResize');
exports.onTabItemTap = createLifeCycle('onTabItemTap');
exports.onNavigationBarButtonTap = createLifeCycle('onNavigationBarButtonTap');
exports.onBackPress = createLifeCycle('onBackPress');
exports.onNavigationBarSearchInputChanged = createLifeCycle('onNavigationBarSearchInputChanged');
exports.onNavigationBarSearchInputConfirmed = createLifeCycle('onNavigationBarSearchInputConfirmed');
exports.onNavigationBarSearchInputClicked = createLifeCycle('onNavigationBarSearchInputClicked');

1
uniapp04/node_modules/@dcloudio/uni-app/dist/mp.d.ts generated vendored Normal file
View File

@ -0,0 +1 @@
export declare function init(lifecycles: string[]): void;

55
uniapp04/node_modules/@dcloudio/uni-app/dist/mp.js generated vendored Normal file
View File

@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.init = void 0;
var vue_1 = require("vue");
function updateLifeCycle(lifecycles, setupLifecycles, fn) {
if (fn) {
if (fn.lifecycles) {
fn.lifecycles.forEach(function (item) {
if (!setupLifecycles.includes(item)) {
setupLifecycles.push(item);
}
});
}
else {
var fnString_1 = fn.toString();
lifecycles.forEach(function (item) {
if (!setupLifecycles.includes(item) && (new RegExp("\\b(".concat(item, ")\\b"))).test(fnString_1)) {
setupLifecycles.push(item);
}
});
}
}
}
function init(lifecycles) {
var setup = vue_1.default.config.optionMergeStrategies.setup;
var extend = vue_1.default.extend;
vue_1.default.extend = function () {
var extendedVue = extend.apply(this, arguments);
var newOptions = extendedVue.options;
var setup = newOptions.setup;
if (setup && setup.lifecycles) {
setup.lifecycles.forEach(function (item) {
newOptions[item] = newOptions[item] || [function noop() { }];
});
}
return extendedVue;
};
Object.defineProperty(vue_1.default.config.optionMergeStrategies, 'setup', {
set: function (fn) {
setup = fn;
},
get: function () {
return function (to, from) {
if (typeof setup === 'function') {
var newSetup = setup.apply(this, arguments);
newSetup.lifecycles = newSetup.lifecycles || [];
updateLifeCycle(lifecycles, newSetup.lifecycles, from);
updateLifeCycle(lifecycles, newSetup.lifecycles, to);
return newSetup;
}
};
}
});
}
exports.init = init;

View File

@ -0,0 +1,9 @@
export declare const extend: {
<T extends {}, U>(target: T, source: U): T & U;
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
(target: object, ...sources: any[]): any;
};
export declare const hasOwn: (val: object, key: string | symbol) => key is never;
export declare const isPlainObject: (val: unknown) => val is object;
export declare const capitalize: (str: string) => string;

23
uniapp04/node_modules/@dcloudio/uni-app/dist/utils.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.capitalize = exports.isPlainObject = exports.hasOwn = exports.extend = void 0;
exports.extend = Object.assign;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var hasOwn = function (val, key) { return hasOwnProperty.call(val, key); };
exports.hasOwn = hasOwn;
var objectToString = Object.prototype.toString;
var toTypeString = function (value) {
return objectToString.call(value);
};
var isPlainObject = function (val) {
return toTypeString(val) === '[object Object]';
};
exports.isPlainObject = isPlainObject;
var cacheStringFunction = function (fn) {
var cache = Object.create(null);
return (function (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str));
});
};
exports.capitalize = cacheStringFunction(function (str) { return str.charAt(0).toUpperCase() + str.slice(1); });

42
uniapp04/node_modules/@dcloudio/uni-app/dist/uts.d.ts generated vendored Normal file
View File

@ -0,0 +1,42 @@
export declare function normalizeArg(arg: unknown): unknown;
interface Parameter {
name: string;
type: string;
}
interface ProxyFunctionOptions {
main?: boolean;
package: string;
class: string;
name: string;
method?: string;
companion?: boolean;
params: Parameter[];
}
interface ProxyClassOptions {
package: string;
class: string;
constructor: {
params: Parameter[];
};
props: string[];
staticProps: string[];
methods: {
[name: string]: {
async?: boolean;
params: Parameter[];
};
};
staticMethods: {
[name: string]: {
async?: boolean;
params: Parameter[];
};
};
}
declare function initUtsStaticMethod(async: boolean, opts: ProxyFunctionOptions): (...args: unknown[]) => unknown;
export declare const initUtsProxyFunction: typeof initUtsStaticMethod;
export declare function initUtsProxyClass({ package: pkg, class: cls, constructor: { params: constructorParams }, methods, props, staticProps, staticMethods, }: ProxyClassOptions): any;
export declare function initUtsPackageName(name: string, is_uni_modules: boolean): string;
export declare function initUtsIndexClassName(moduleName: string, is_uni_modules: boolean): string;
export declare function initUtsClassName(moduleName: string, className: string, is_uni_modules: boolean): string;
export {};

208
uniapp04/node_modules/@dcloudio/uni-app/dist/uts.js generated vendored Normal file
View File

@ -0,0 +1,208 @@
"use strict";
exports.__esModule = true;
exports.initUtsClassName = exports.initUtsIndexClassName = exports.initUtsPackageName = exports.initUtsProxyClass = exports.initUtsProxyFunction = exports.normalizeArg = void 0;
var utils_1 = require("./utils");
var callbackId = 1;
var proxy;
var callbacks = {};
function normalizeArg(arg) {
if (typeof arg === 'function') {
// 查找该函数是否已缓存
var oldId = Object.keys(callbacks).find(function (id) { return callbacks[id] === arg; });
var id = oldId ? parseInt(oldId) : callbackId++;
callbacks[id] = arg;
return id;
}
else if ((0, utils_1.isPlainObject)(arg)) {
Object.keys(arg).forEach(function (name) {
;
arg[name] = normalizeArg(arg[name]);
});
}
return arg;
}
exports.normalizeArg = normalizeArg;
function initUtsInstanceMethod(async, opts, instanceId) {
return initProxyFunction(async, opts, instanceId);
}
function getProxy() {
if (!proxy) {
proxy = uni.requireNativePlugin('UTS-Proxy');
}
return proxy;
}
function resolveSyncResult(res) {
if (res.errMsg) {
throw new Error(res.errMsg);
}
return res.params;
}
function invokePropGetter(args) {
if (args.errMsg) {
throw new Error(args.errMsg);
}
delete args.errMsg;
return resolveSyncResult(getProxy().invokeSync(args, function () { }));
}
function initProxyFunction(async, _a, instanceId) {
var pkg = _a.package, cls = _a["class"], propOrMethod = _a.name, method = _a.method, companion = _a.companion, methodParams = _a.params, errMsg = _a.errMsg;
var invokeCallback = function (_a) {
var id = _a.id, name = _a.name, params = _a.params, keepAlive = _a.keepAlive;
var callback = callbacks[id];
if (callback) {
callback.apply(void 0, params);
if (!keepAlive) {
delete callbacks[id];
}
}
else {
console.error("".concat(pkg).concat(cls, ".").concat(propOrMethod, " ").concat(name, " is not found"));
}
};
var baseArgs = instanceId
? { id: instanceId, name: propOrMethod, method: methodParams }
: {
package: pkg,
"class": cls,
name: method || propOrMethod,
companion: companion,
method: methodParams
};
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (errMsg) {
throw new Error(errMsg);
}
var invokeArgs = (0, utils_1.extend)({}, baseArgs, {
params: args.map(function (arg) { return normalizeArg(arg); })
});
if (async) {
return new Promise(function (resolve, reject) {
getProxy().invokeAsync(invokeArgs, function (res) {
if (res.type !== 'return') {
invokeCallback(res);
}
else {
if (res.errMsg) {
reject(res.errMsg);
}
else {
resolve(res.params);
}
}
});
});
}
return resolveSyncResult(getProxy().invokeSync(invokeArgs, invokeCallback));
};
}
function initUtsStaticMethod(async, opts) {
if (opts.main && !opts.method) {
if (typeof plus !== 'undefined' && plus.os.name === 'iOS') {
opts.method = 's_' + opts.name;
}
}
return initProxyFunction(async, opts, 0);
}
exports.initUtsProxyFunction = initUtsStaticMethod;
function initUtsProxyClass(_a) {
var pkg = _a.package, cls = _a["class"], constructorParams = _a.constructor.params, methods = _a.methods, props = _a.props, staticProps = _a.staticProps, staticMethods = _a.staticMethods, errMsg = _a.errMsg;
var baseOptions = {
package: pkg,
"class": cls,
errMsg: errMsg
};
var ProxyClass = /** @class */ (function () {
function UtsClass() {
var params = [];
for (var _i = 0; _i < arguments.length; _i++) {
params[_i] = arguments[_i];
}
if (errMsg) {
throw new Error(errMsg);
}
var target = {};
// 初始化实例 ID
var instanceId = initProxyFunction(false, (0, utils_1.extend)({ name: 'constructor', params: constructorParams }, baseOptions), 0).apply(null, params);
if (!instanceId) {
throw new Error("new ".concat(cls, " is failed"));
}
return new Proxy(this, {
get: function (_, name) {
if (!target[name]) {
//实例方法
if ((0, utils_1.hasOwn)(methods, name)) {
var _a = methods[name], async = _a.async, params_1 = _a.params;
target[name] = initUtsInstanceMethod(!!async, (0, utils_1.extend)({
name: name,
params: params_1
}, baseOptions), instanceId);
}
else if (props.includes(name)) {
// 实例属性
return invokePropGetter({
id: instanceId,
name: name,
errMsg: errMsg
});
}
}
return target[name];
}
});
}
return UtsClass;
}());
var staticMethodCache = {};
return new Proxy(ProxyClass, {
get: function (target, name, receiver) {
if ((0, utils_1.hasOwn)(staticMethods, name)) {
if (!staticMethodCache[name]) {
var _a = staticMethods[name], async = _a.async, params = _a.params;
// 静态方法
staticMethodCache[name] = initUtsStaticMethod(!!async, (0, utils_1.extend)({ name: name, companion: true, params: params }, baseOptions));
}
return staticMethodCache[name];
}
if (staticProps.includes(name)) {
// 静态属性
return invokePropGetter((0, utils_1.extend)({ name: name, companion: true }, baseOptions));
}
return Reflect.get(target, name, receiver);
}
});
}
exports.initUtsProxyClass = initUtsProxyClass;
function initUtsPackageName(name, is_uni_modules) {
if (typeof plus !== 'undefined' && plus.os.name === 'Android') {
return 'uts.sdk.' + (is_uni_modules ? 'modules.' : '') + name;
}
return '';
}
exports.initUtsPackageName = initUtsPackageName;
function initUtsIndexClassName(moduleName, is_uni_modules) {
if (typeof plus === 'undefined') {
return '';
}
return initUtsClassName(moduleName, plus.os.name === 'iOS' ? 'IndexSwift' : 'IndexKt', is_uni_modules);
}
exports.initUtsIndexClassName = initUtsIndexClassName;
function initUtsClassName(moduleName, className, is_uni_modules) {
if (typeof plus === 'undefined') {
return '';
}
if (plus.os.name === 'Android') {
return className;
}
if (plus.os.name === 'iOS') {
return ('UTSSDK' +
(is_uni_modules ? 'Modules' : '') +
(0, utils_1.capitalize)(moduleName) +
(0, utils_1.capitalize)(className));
}
return '';
}
exports.initUtsClassName = initUtsClassName;

25
uniapp04/node_modules/@dcloudio/uni-app/package.json generated vendored Normal file
View File

@ -0,0 +1,25 @@
{
"name": "@dcloudio/uni-app",
"version": "2.0.2-4020420240722004",
"description": "uni-app composition-api",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/dcloudio/uni-app.git",
"directory": "packages/uni-app"
},
"scripts": {
"build": "tsc -p . "
},
"peerDependencies": {
"@dcloudio/types": "^3.0.15",
"@vue/composition-api": "^1.7.0"
},
"author": "fxy060608",
"license": "Apache-2.0",
"gitHead": "2d3e029c00dc153d1f9b01b3cf4e697470e01087",
"devDependencies": {
"@dcloudio/types": "^3.0.15",
"typescript": "^4.8.3"
}
}

View File

@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2014 Component contributors <dev@component.io>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,79 @@
# `@socket.io/component-emitter`
Event emitter component.
This project is a fork of the [`component-emitter`](https://github.com/sindresorhus/component-emitter) project, with [Socket.IO](https://socket.io/)-specific TypeScript typings.
## Installation
```
$ npm i @socket.io/component-emitter
```
## API
### Emitter(obj)
The `Emitter` may also be used as a mixin. For example
a "plain" object may become an emitter, or you may
extend an existing prototype.
As an `Emitter` instance:
```js
import { Emitter } from '@socket.io/component-emitter';
var emitter = new Emitter;
emitter.emit('something');
```
As a mixin:
```js
import { Emitter } from '@socket.io/component-emitter';
var user = { name: 'tobi' };
Emitter(user);
user.emit('im a user');
```
As a prototype mixin:
```js
import { Emitter } from '@socket.io/component-emitter';
Emitter(User.prototype);
```
### Emitter#on(event, fn)
Register an `event` handler `fn`.
### Emitter#once(event, fn)
Register a single-shot `event` handler `fn`,
removed immediately after it is invoked the
first time.
### Emitter#off(event, fn)
* Pass `event` and `fn` to remove a listener.
* Pass `event` to remove all listeners on that event.
* Pass nothing to remove all listeners on all events.
### Emitter#emit(event, ...)
Emit an `event` with variable option args.
### Emitter#listeners(event)
Return an array of callbacks, or an empty array.
### Emitter#hasListeners(event)
Check if this emitter has `event` handlers.
## License
MIT

View File

@ -0,0 +1,179 @@
/**
* An events map is an interface that maps event names to their value, which
* represents the type of the `on` listener.
*/
export interface EventsMap {
[event: string]: any;
}
/**
* The default events map, used if no EventsMap is given. Using this EventsMap
* is equivalent to accepting all event names, and any data.
*/
export interface DefaultEventsMap {
[event: string]: (...args: any[]) => void;
}
/**
* Returns a union type containing all the keys of an event map.
*/
export type EventNames<Map extends EventsMap> = keyof Map & (string | symbol);
/** The tuple type representing the parameters of an event listener */
export type EventParams<
Map extends EventsMap,
Ev extends EventNames<Map>
> = Parameters<Map[Ev]>;
/**
* The event names that are either in ReservedEvents or in UserEvents
*/
export type ReservedOrUserEventNames<
ReservedEventsMap extends EventsMap,
UserEvents extends EventsMap
> = EventNames<ReservedEventsMap> | EventNames<UserEvents>;
/**
* Type of a listener of a user event or a reserved event. If `Ev` is in
* `ReservedEvents`, the reserved event listener is returned.
*/
export type ReservedOrUserListener<
ReservedEvents extends EventsMap,
UserEvents extends EventsMap,
Ev extends ReservedOrUserEventNames<ReservedEvents, UserEvents>
> = FallbackToUntypedListener<
Ev extends EventNames<ReservedEvents>
? ReservedEvents[Ev]
: Ev extends EventNames<UserEvents>
? UserEvents[Ev]
: never
>;
/**
* Returns an untyped listener type if `T` is `never`; otherwise, returns `T`.
*
* This is a hack to mitigate https://github.com/socketio/socket.io/issues/3833.
* Needed because of https://github.com/microsoft/TypeScript/issues/41778
*/
type FallbackToUntypedListener<T> = [T] extends [never]
? (...args: any[]) => void | Promise<void>
: T;
/**
* Strictly typed version of an `EventEmitter`. A `TypedEventEmitter` takes type
* parameters for mappings of event names to event data types, and strictly
* types method calls to the `EventEmitter` according to these event maps.
*
* @typeParam ListenEvents - `EventsMap` of user-defined events that can be
* listened to with `on` or `once`
* @typeParam EmitEvents - `EventsMap` of user-defined events that can be
* emitted with `emit`
* @typeParam ReservedEvents - `EventsMap` of reserved events, that can be
* emitted by socket.io with `emitReserved`, and can be listened to with
* `listen`.
*/
export class Emitter<
ListenEvents extends EventsMap,
EmitEvents extends EventsMap,
ReservedEvents extends EventsMap = {}
> {
/**
* Adds the `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
on<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
ev: Ev,
listener: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Adds a one-time `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
once<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
ev: Ev,
listener: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Removes the `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
off<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
ev?: Ev,
listener?: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Emits an event.
*
* @param ev Name of the event
* @param args Values to send to listeners of this event
*/
emit<Ev extends EventNames<EmitEvents>>(
ev: Ev,
...args: EventParams<EmitEvents, Ev>
): this;
/**
* Emits a reserved event.
*
* This method is `protected`, so that only a class extending
* `StrictEventEmitter` can emit its own reserved events.
*
* @param ev Reserved event name
* @param args Arguments to emit along with the event
*/
protected emitReserved<Ev extends EventNames<ReservedEvents>>(
ev: Ev,
...args: EventParams<ReservedEvents, Ev>
): this;
/**
* Returns the listeners listening to an event.
*
* @param event Event name
* @returns Array of listeners subscribed to `event`
*/
listeners<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
event: Ev
): ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>[];
/**
* Returns true if there is a listener for this event.
*
* @param event Event name
* @returns boolean
*/
hasListeners<
Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
>(event: Ev): boolean;
/**
* Removes the `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
removeListener<
Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
>(
ev?: Ev,
listener?: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Removes all `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
*/
removeAllListeners<
Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
>(ev?: Ev): this;
}

View File

@ -0,0 +1,176 @@
/**
* Expose `Emitter`.
*/
exports.Emitter = Emitter;
/**
* Initialize a new `Emitter`.
*
* @api public
*/
function Emitter(obj) {
if (obj) return mixin(obj);
}
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
}
// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
// Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = new Array(arguments.length - 1)
, callbacks = this._callbacks['$' + event];
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
// alias used for reserved events (protected method)
Emitter.prototype.emitReserved = Emitter.prototype.emit;
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};

View File

@ -0,0 +1,4 @@
{
"name": "@socket.io/component-emitter",
"type": "commonjs"
}

View File

@ -0,0 +1,179 @@
/**
* An events map is an interface that maps event names to their value, which
* represents the type of the `on` listener.
*/
export interface EventsMap {
[event: string]: any;
}
/**
* The default events map, used if no EventsMap is given. Using this EventsMap
* is equivalent to accepting all event names, and any data.
*/
export interface DefaultEventsMap {
[event: string]: (...args: any[]) => void;
}
/**
* Returns a union type containing all the keys of an event map.
*/
export type EventNames<Map extends EventsMap> = keyof Map & (string | symbol);
/** The tuple type representing the parameters of an event listener */
export type EventParams<
Map extends EventsMap,
Ev extends EventNames<Map>
> = Parameters<Map[Ev]>;
/**
* The event names that are either in ReservedEvents or in UserEvents
*/
export type ReservedOrUserEventNames<
ReservedEventsMap extends EventsMap,
UserEvents extends EventsMap
> = EventNames<ReservedEventsMap> | EventNames<UserEvents>;
/**
* Type of a listener of a user event or a reserved event. If `Ev` is in
* `ReservedEvents`, the reserved event listener is returned.
*/
export type ReservedOrUserListener<
ReservedEvents extends EventsMap,
UserEvents extends EventsMap,
Ev extends ReservedOrUserEventNames<ReservedEvents, UserEvents>
> = FallbackToUntypedListener<
Ev extends EventNames<ReservedEvents>
? ReservedEvents[Ev]
: Ev extends EventNames<UserEvents>
? UserEvents[Ev]
: never
>;
/**
* Returns an untyped listener type if `T` is `never`; otherwise, returns `T`.
*
* This is a hack to mitigate https://github.com/socketio/socket.io/issues/3833.
* Needed because of https://github.com/microsoft/TypeScript/issues/41778
*/
type FallbackToUntypedListener<T> = [T] extends [never]
? (...args: any[]) => void | Promise<void>
: T;
/**
* Strictly typed version of an `EventEmitter`. A `TypedEventEmitter` takes type
* parameters for mappings of event names to event data types, and strictly
* types method calls to the `EventEmitter` according to these event maps.
*
* @typeParam ListenEvents - `EventsMap` of user-defined events that can be
* listened to with `on` or `once`
* @typeParam EmitEvents - `EventsMap` of user-defined events that can be
* emitted with `emit`
* @typeParam ReservedEvents - `EventsMap` of reserved events, that can be
* emitted by socket.io with `emitReserved`, and can be listened to with
* `listen`.
*/
export class Emitter<
ListenEvents extends EventsMap,
EmitEvents extends EventsMap,
ReservedEvents extends EventsMap = {}
> {
/**
* Adds the `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
on<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
ev: Ev,
listener: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Adds a one-time `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
once<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
ev: Ev,
listener: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Removes the `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
off<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
ev?: Ev,
listener?: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Emits an event.
*
* @param ev Name of the event
* @param args Values to send to listeners of this event
*/
emit<Ev extends EventNames<EmitEvents>>(
ev: Ev,
...args: EventParams<EmitEvents, Ev>
): this;
/**
* Emits a reserved event.
*
* This method is `protected`, so that only a class extending
* `StrictEventEmitter` can emit its own reserved events.
*
* @param ev Reserved event name
* @param args Arguments to emit along with the event
*/
protected emitReserved<Ev extends EventNames<ReservedEvents>>(
ev: Ev,
...args: EventParams<ReservedEvents, Ev>
): this;
/**
* Returns the listeners listening to an event.
*
* @param event Event name
* @returns Array of listeners subscribed to `event`
*/
listeners<Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>>(
event: Ev
): ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>[];
/**
* Returns true if there is a listener for this event.
*
* @param event Event name
* @returns boolean
*/
hasListeners<
Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
>(event: Ev): boolean;
/**
* Removes the `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
* @param listener Callback function
*/
removeListener<
Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
>(
ev?: Ev,
listener?: ReservedOrUserListener<ReservedEvents, ListenEvents, Ev>
): this;
/**
* Removes all `listener` function as an event listener for `ev`.
*
* @param ev Name of the event
*/
removeAllListeners<
Ev extends ReservedOrUserEventNames<ReservedEvents, ListenEvents>
>(ev?: Ev): this;
}

View File

@ -0,0 +1,169 @@
/**
* Initialize a new `Emitter`.
*
* @api public
*/
export function Emitter(obj) {
if (obj) return mixin(obj);
}
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/
function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
}
/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
.push(fn);
return this;
};
/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.once = function(event, fn){
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
on.fn = fn;
this.on(event, on);
return this;
};
/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/
Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
// specific event
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this;
// remove all handlers
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
}
// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
// Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
return this;
};
/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/
Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};
var args = new Array(arguments.length - 1)
, callbacks = this._callbacks['$' + event];
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
return this;
};
// alias used for reserved events (protected method)
Emitter.prototype.emitReserved = Emitter.prototype.emit;
/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/
Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
};
/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/
Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};

View File

@ -0,0 +1,4 @@
{
"name": "@socket.io/component-emitter",
"type": "module"
}

View File

@ -0,0 +1,28 @@
{
"name": "@socket.io/component-emitter",
"description": "Event emitter",
"version": "3.1.2",
"license": "MIT",
"devDependencies": {
"mocha": "*",
"should": "*"
},
"component": {
"scripts": {
"emitter/index.js": "index.js"
}
},
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/cjs/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/socketio/emitter.git"
},
"scripts": {
"test": "make test"
},
"files": [
"lib/"
]
}

21
uniapp04/node_modules/@vue/composition-api/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019-present, liximomo(X.L)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

558
uniapp04/node_modules/@vue/composition-api/README.md generated vendored Normal file
View File

@ -0,0 +1,558 @@
# @vue/composition-api
Vue 2 plugin for **Composition API**
[![npm](https://img.shields.io/npm/v/@vue/composition-api)](https://www.npmjs.com/package/@vue/composition-api)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vuejs/composition-api/test.yml)](https://github.com/vuejs/composition-api/actions?query=workflow%3A%22Build+%26+Test%22)
[![Minzipped size](https://badgen.net/bundlephobia/minzip/@vue/composition-api)](https://bundlephobia.com/result?p=@vue/composition-api)
English | [中文](./README.zh-CN.md) ・ [**Composition API Docs**](https://v3.vuejs.org/guide/composition-api-introduction.html)
> ⚠️ With the release of [Vue 2.7](https://blog.vuejs.org/posts/vue-2-7-naruto.html), which has Composition API built-in, **you no longer need this plugin**. Thereby this plugin has entered maintenance mode and will only support Vue 2.6 or earlier. This project will reach End of Life by the end of 2022.
## Installation
### NPM
```bash
npm install @vue/composition-api
# or
yarn add @vue/composition-api
```
You must install `@vue/composition-api` as a plugin via `Vue.use()` before you can use the [Composition API](https://composition-api.vuejs.org/) to compose your component.
```js
import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)
```
```js
// use the APIs
import { ref, reactive } from '@vue/composition-api'
```
> :bulb: When you migrate to Vue 3, just replacing `@vue/composition-api` to `vue` and your code should just work.
### CDN
Include `@vue/composition-api` after Vue and it will install itself automatically.
<!--cdn-links-start-->
```html
<script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script>
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.7.2"></script>
```
<!--cdn-links-end-->
`@vue/composition-api` will be exposed to global variable `window.VueCompositionAPI`.
```ts
const { ref, reactive } = VueCompositionAPI
```
## TypeScript Support
> TypeScript version **>4.2** is required
To let TypeScript properly infer types inside Vue component options, you need to define components with `defineComponent`
```ts
import { defineComponent } from '@vue/composition-api'
export default defineComponent({
// type inference enabled
})
```
### JSX/TSX
JSX is now officially supported on [vuejs/jsx](https://github.com/vuejs/jsx). You can enable it by following [this document](https://github.com/vuejs/jsx/tree/dev/packages/babel-preset-jsx#usage). A community maintained version can be found at [babel-preset-vca-jsx](https://github.com/luwanquan/babel-preset-vca-jsx) by [@luwanquan](https://github.com/luwanquan).
To support TSX, create a declaration file with the following content in your project.
```ts
// file: shim-tsx.d.ts
import Vue, { VNode } from 'vue';
import { ComponentRenderProxy } from '@vue/composition-api';
declare global {
namespace JSX {
interface Element extends VNode {}
interface ElementClass extends ComponentRenderProxy {}
interface ElementAttributesProperty {
$props: any; // specify the property name to use
}
interface IntrinsicElements {
[elem: string]: any;
}
}
}
```
## SSR
Even if there is no definitive Vue 3 API for SSR yet, this plugin implements the `onServerPrefetch` lifecycle hook that allows you to use the `serverPrefetch` hook found in the classic API.
```js
import { onServerPrefetch } from '@vue/composition-api'
export default {
setup(props, { ssrContext }) {
const result = ref()
onServerPrefetch(async () => {
result.value = await callApi(ssrContext.someId)
})
return {
result,
}
}
}
```
## Browser Compatibility
`@vue/composition-api` supports all modern browsers and IE11+. For lower versions IE you should install `WeakMap` polyfill (for example from `core-js` package).
## Limitations
> :white_check_mark: Support &nbsp;&nbsp;&nbsp;&nbsp;:x: Not Supported
### `Ref` Unwrap
<details>
<summary>
<b>Should NOT</b> use <code>ref</code> in a plain object when working with <code>Array</code>
</summary>
```js
const a = {
count: ref(0),
}
const b = reactive({
list: [a], // `a.count` will not unwrap!!
})
// no unwrap for `count`, `.value` is required
b.list[0].count.value === 0 // true
```
```js
const b = reactive({
list: [
{
count: ref(0), // no unwrap!!
},
],
})
// no unwrap for `count`, `.value` is required
b.list[0].count.value === 0 // true
```
</details>
<details>
<summary>
<b>Should</b> always use <code>ref</code> in a <code>reactive</code> when working with <code>Array</code>
</summary>
```js
const a = reactive({
list: [
reactive({
count: ref(0),
}),
]
})
// unwrapped
a.list[0].count === 0 // true
a.list.push(
reactive({
count: ref(1),
})
)
// unwrapped
a.list[1].count === 1 // true
```
</details>
### Template Refs
<details>
<summary>
✅ String ref && return it from <code>setup()</code>
</summary>
```html
<template>
<div ref="root"></div>
</template>
<script>
export default {
setup() {
const root = ref(null)
onMounted(() => {
// the DOM element will be assigned to the ref after initial render
console.log(root.value) // <div/>
})
return {
root,
}
},
}
</script>
```
</details>
<details>
<summary>
✅ String ref && return it from <code>setup()</code> && Render Function / JSX
</summary>
```jsx
export default {
setup() {
const root = ref(null)
onMounted(() => {
// the DOM element will be assigned to the ref after initial render
console.log(root.value) // <div/>
})
return {
root,
}
},
render() {
// with JSX
return () => <div ref="root" />
},
}
```
</details>
<details>
<summary>
❌ Function ref
</summary>
```html
<template>
<div :ref="el => root = el"></div>
</template>
<script>
export default {
setup() {
const root = ref(null)
return {
root,
}
},
}
</script>
```
</details>
<details>
<summary>
❌ Render Function / JSX in <code>setup()</code>
</summary>
```jsx
export default {
setup() {
const root = ref(null)
return () =>
h('div', {
ref: root,
})
// with JSX
return () => <div ref={root} />
},
}
```
</details>
<details>
<summary>
⚠️ <code>$refs</code> accessing workaround
</summary>
<br>
> :warning: **Warning**: The `SetupContext.refs` won't exist in `Vue 3.0`. `@vue/composition-api` provide it as a workaround here.
If you really want to use template refs in this case, you can access `vm.$refs` via `SetupContext.refs`
```jsx
export default {
setup(initProps, setupContext) {
const refs = setupContext.refs
onMounted(() => {
// the DOM element will be assigned to the ref after initial render
console.log(refs.root) // <div/>
})
return () =>
h('div', {
ref: 'root',
})
// with JSX
return () => <div ref="root" />
},
}
```
</details>
### Reactive
<details>
<summary>
⚠️ <code>reactive()</code> <b>mutates</b> the original object
</summary>
`reactive` uses `Vue.observable` underneath which will ***mutate*** the original object.
> :bulb: In Vue 3, it will return a new proxy object.
</details>
<details>
<summary>
⚠️ <code>set</code> and <code>del</code> workaround for adding and deleting reactive properties
</summary>
> ⚠️ Warning: `set` and `del` do NOT exist in Vue 3. We provide them as a workaround here, due to the limitation of [Vue 2.x reactivity system](https://vuejs.org/v2/guide/reactivity.html#For-Objects).
>
> In Vue 2, you will need to call `set` to track new keys on an `object`(similar to `Vue.set` but for `reactive objects` created by the Composition API). In Vue 3, you can just assign them like normal objects.
>
> Similarly, in Vue 2 you will need to call `del` to [ensure a key deletion triggers view updates](https://vuejs.org/v2/api/#Vue-delete) in reactive objects (similar to `Vue.delete` but for `reactive objects` created by the Composition API). In Vue 3 you can just delete them by calling `delete foo.bar`.
```ts
import { reactive, set, del } from '@vue/composition-api'
const a = reactive({
foo: 1
})
// add new reactive key
set(a, 'bar', 1)
// remove a key and trigger reactivity
del(a, 'bar')
```
</details>
### Watch
<details>
<summary>
<code>onTrack</code> and <code>onTrigger</code> are not available in <code>WatchOptions</code>
</summary>
```js
watch(() => {
/* ... */
}, {
immediate: true,
onTrack() {}, // not available
onTrigger() {}, // not available
})
```
</details>
### `createApp`
<details>
<summary>
⚠️ <code>createApp()</code> is global
</summary>
In Vue 3, `createApp()` is introduced to provide context(plugin, components, etc.) isolation between app instances. Due the design of Vue 2, in this plugin, we provide `createApp()` as a forward compatible API which is just an alias of the global.
```ts
const app1 = createApp(RootComponent1)
app1.component('Foo', Foo) // equivalent to Vue.component('Foo', Foo)
app1.use(VueRouter) // equivalent to Vue.use(VueRouter)
const app2 = createApp(RootComponent2)
app2.component('Bar', Bar) // equivalent to Vue.component('Bar', Bar)
```
</details>
### `createElement` / `h`
<details>
<summary>
⚠️ <code>createElement</code> / <code>h</code> workaround
</summary>
<br>
`createElement` / `h` in Vue 2 is only accessable in `render()` function. To use it outside of `render()`, you can explicitly bind a component instance to it.
> :warning: **Warning**: This ability is provided as a workaround Vue 2, it's not part of the Vue 3 API.
```jsx
import { h as _h } from '@vue/composition-api'
export default {
setup() {
const vm = getCurrentInstance()
const h = _h.bind(vm)
return () =>
h('div', {
ref: 'root',
})
},
}
```
</details>
### `shallowReadonly`
<details>
<summary>
⚠️ <code>shallowReadonly()</code> will create a new object and with the same root properties, new properties added will <b>not</b> be readonly or reactive.
</summary>
> :bulb: In Vue 3, it will return a new proxy object.
</details>
### `readonly`
<details>
<summary>
⚠️ <code>readonly()</code> provides <b>only type-level</b> readonly check.
</summary>
`readonly()` is provided as API alignment with Vue 3 on type-level only. Use <code>isReadonly()</code> on it or it's properties can not be guaranteed.
</details>
### `props`
<details>
<summary>
⚠️ <code>toRefs(props.foo)</code> will incorrectly warn when accessing nested levels of props. <br>
&nbsp;&nbsp;&nbsp;&nbsp;⚠️ <code>isReactive(props.foo)</code> will return false.
</summary>
```ts
defineComponent({
setup(props) {
const { bar } = toRefs(props.foo) // it will `warn`
// use this instead
const { foo } = toRefs(props)
const a = foo.value.bar
}
})
```
</details>
### `computed().effect`
<details>
<summary>
⚠️ <code>computed()</code> has a property <code>effect</code> set to <code>true</code> instead of a <code>ReactiveEffect<T></code>.
</summary>
Due to the difference in implementation, there is no such concept as a `ReactiveEffect` in `@vue/composition-api`. Therefore, `effect` is merely `true` to enable differentiating computed from refs:
```ts
function isComputed<T>(o: ComputedRef<T> | unknown): o is ComputedRef<T>
function isComputed(o: any): o is ComputedRef {
return !!(isRef(o) && o.effect)
}
```
</details>
### Missing APIs
The following APIs introduced in Vue 3 are not available in this plugin.
- `onRenderTracked`
- `onRenderTriggered`
- `isProxy`
### Reactive APIs in `data()`
<details>
<summary>
❌ Passing <code>ref</code>, <code>reactive</code> or other reactive apis to <code>data()</code> would not work.
</summary>
```jsx
export default {
data() {
return {
// will result { a: { value: 1 } } in template
a: ref(1),
}
},
}
```
</details>
### `emits` Options
<details>
<summary>
<code>emits</code> option is provided in type-level only, in order to align with Vue 3's type interface. Does NOT have actual effects on the code.
</summary>
```ts
defineComponent({
emits: {
// has no effects
submit: (eventOption) => {
if (...) {
return true
} else {
console.warn('Invalid submit event payload!')
return false
}
}
}
})
```
</details>
### Performance Impact
Due the limitation of Vue2's public API. `@vue/composition-api` inevitably introduces some performance overhead. Note that in most scenarios, this shouldn't be the source of performance issues.
You can check the [benchmark results](https://antfu.github.io/vue-composition-api-benchmark-results/) for more details.

View File

@ -0,0 +1,568 @@
# @vue/composition-api
用于提供 **组合式 API** 的 Vue 2 插件.
[![npm](https://img.shields.io/npm/v/@vue/composition-api)](https://www.npmjs.com/package/@vue/composition-api)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vuejs/composition-api/test.yml)](https://github.com/vuejs/composition-api/actions?query=workflow%3A%22Build+%26+Test%22)
[English](./README.md) | 中文 ・ [**组合式 API 文档**](https://v3.cn.vuejs.org/guide/composition-api-introduction.html)
> ⚠️ 随着 [Vue 2.7](https://blog.vuejs.org/posts/vue-2-7-naruto.html)的发布它内置了Composition API**你不再需要这个插件了**。因此这个插件已经进入维护模式将只支持Vue 2.6 或更早的版本。本项目将在 2022 年底达到生命终点EOL
## 安装
### NPM
```bash
npm install @vue/composition-api
# or
yarn add @vue/composition-api
```
在使用 `@vue/composition-api` 前,必须先通过 `Vue.use()` 进行安装。之后才可使用新的 [**组合式 API**](https://composition-api.vuejs.org/zh) 进行组件开发。
```js
import Vue from 'vue'
import VueCompositionAPI from '@vue/composition-api'
Vue.use(VueCompositionAPI)
```
```js
// 使用 API
import { ref, reactive } from '@vue/composition-api'
```
> :bulb: 当迁移到 Vue 3 时,只需简单的将 `@vue/composition-api` 替换成 `vue` 即可。你现有的代码几乎无需进行额外的改动。
### CDN
在 Vue 之后引入 `@vue/composition-api` ,插件将会自动完成安装。
<!--cdn-links-start-->
```html
<script src="https://cdn.jsdelivr.net/npm/vue@2.6"></script>
<script src="https://cdn.jsdelivr.net/npm/@vue/composition-api@1.7.2"></script>
```
<!--cdn-links-end-->
`@vue/composition-api` 将会暴露在全局变量 `window.VueCompositionAPI` 中。
```ts
const { ref, reactive } = VueCompositionAPI
```
## TypeScript 支持
> 本插件要求使用 TypeScript **4.2** 或以上版本
为了让 TypeScript 在 Vue 组件选项中正确地进行类型推导,我们必须使用 `defineComponent` 来定义组件:
```ts
import { defineComponent } from '@vue/composition-api'
export default defineComponent({
// 类型推断启用
})
```
### JSX/TSX
JSX 现已在 [vuejs/jsx](https://github.com/vuejs/jsx) 中官方支持。你可以根据[这篇文档](https://github.com/vuejs/jsx/tree/dev/packages/babel-preset-jsx#usage)开启支持。你也可以使用由 [@luwanquan](https://github.com/luwanquan) 维护的社区版本 [babel-preset-vca-jsx](https://github.com/luwanquan/babel-preset-vca-jsx)。
对于 TSX 支持,请在你的项目中创建如下声明文件:
```ts
// file: shim-tsx.d.ts
import Vue, { VNode } from 'vue';
import { ComponentRenderProxy } from '@vue/composition-api';
declare global {
namespace JSX {
interface Element extends VNode {}
interface ElementClass extends ComponentRenderProxy {}
interface ElementAttributesProperty {
$props: any; // specify the property name to use
}
interface IntrinsicElements {
[elem: string]: any;
}
}
}
```
## SSR
尽管 Vue 3 暂时没有给出确定的 SSR 的 API这个插件实现了 `onServerPrefetch` 生命周期钩子函数。这个钩子允许你使用传统 API 中的 `serverPrefetch` 函数。
```js
import { onServerPrefetch } from '@vue/composition-api'
export default {
setup(props, { ssrContext }) {
const result = ref()
onServerPrefetch(async () => {
result.value = await callApi(ssrContext.someId)
})
return {
result,
}
},
}
```
## 浏览器兼容性
`@vue/composition-api` 支持所有现代浏览器以及IE11+。对于更低版本的IE浏览器你需要安装`WeakMap` polyfill (例如使用 `core-js`库)。
## 限制
> :white_check_mark: 支持 &nbsp;&nbsp;&nbsp;&nbsp;:x: 不支持
### `Ref` 自动展开 (unwrap)
<details>
<summary>
<b>不要</b> 在数组中使用含有 <code>ref</code> 的普通对象
</summary>
```js
const a = {
count: ref(0),
}
const b = reactive({
list: [a], // `a.count` 不会自动展开!!
})
// `count` 不会自动展开, 须使用 `.value`
b.list[0].count.value === 0 // true
```
```js
const b = reactive({
list: [
{
count: ref(0), // 不会自动展开!!
},
],
})
// `count` 不会自动展开, 须使用 `.value`
b.list[0].count.value === 0 // true
```
</details>
<details>
<summary>
✅ 在数组中,<b>应该</b> 总是将 <code>ref</code> 存放到 <code>reactive</code> 对象中
</summary>
```js
const a = reactive({
count: ref(0),
})
const b = reactive({
list: [a],
})
// 自动展开
b.list[0].count === 0 // true
b.list.push(
reactive({
count: ref(1),
})
)
// 自动展开
b.list[1].count === 1 // true
```
</details>
### 模板 Refs
<details>
<summary>
✅ 在`模板`中使用字符串 ref &&<code>setup()</code> 返回 ref
</summary>
```html
<template>
<div ref="root"></div>
</template>
<script>
export default {
setup() {
const root = ref(null)
onMounted(() => {
// 在初次渲染后 DOM 元素会被赋值给 ref
console.log(root.value) // <div/>
})
return {
root,
}
},
}
</script>
```
</details>
<details>
<summary>
✅ 在<code>render()</code>中使用字符串 ref &&<code>setup()</code> 返回 ref
</summary>
```jsx
export default {
setup() {
const root = ref(null)
onMounted(() => {
// 在初次渲染后 DOM 元素会被赋值给 ref
console.log(root.value) // <div/>
})
return {
root,
}
},
render() {
// 使用 JSX
return () => <div ref="root" />
},
}
```
</details>
<details>
<summary>
❌ 函数式 ref
</summary>
```html
<template>
<div :ref="el => root = el"></div>
</template>
<script>
export default {
setup() {
const root = ref(null)
return {
root,
}
},
}
</script>
```
</details>
<details>
<summary>
❌ 在 <code>setup()</code> 中返回的`渲染函数 / JSX`
</summary>
```jsx
export default {
setup() {
const root = ref(null)
return () =>
h('div', {
ref: root,
})
// 使用 JSX
return () => <div ref={root} />
},
}
```
</details>
<details>
<summary>
⚠️ <code>$refs</code> 访问的变通方案
</summary>
> :warning: **警告**: `SetupContext.refs` 并非 `Vue 3.0` 的一部分, `@vue/composition-api` 将其暴露在 `SetupContext` 中只是临时提供一种变通方案。
如果你依然选择在 `setup()` 中写 `render` 函数,那么你可以使用 `SetupContext.refs` 来访问模板引用,它等价于 Vue 2.x 中的 `this.$refs`:
```js
export default {
setup(initProps, setupContext) {
const refs = setupContext.refs
onMounted(() => {
// 在初次渲染后 DOM 元素会被赋值给 ref
console.log(refs.root) // <div/>
})
return () =>
h('div', {
ref: 'root',
})
// 使用 JSX
return () => <div ref="root" />
},
}
```
如果项目使用了 TypeScript你还需要扩展 `SetupContext` 类型:
```ts
import Vue from 'vue'
declare module '@vue/composition-api' {
interface SetupContext {
readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] }
}
}
```
</details>
### Reactive
<details>
<summary>
⚠️ <code>reactive()</code> 会返回一个<b>修改过的</b>原始的对象
</summary>
此行为与 Vue 2 中的 `Vue.observable` 一致
> :bulb: 在 Vue 3 中,`reactive()` 会返回一个新的的代理对象
</details>
<details>
<summary>
⚠️ <code>set</code><code>del</code> 添加与刪除响应式属性变通方案
</summary>
> ⚠️ 警告: `set``del` 并非 Vue 3 的一部分。由于 [Vue 2.x 响应式系统的限制](https://vuejs.org/v2/guide/reactivity.html#For-Objects), 我们在这里提供它们作为一种变通方案。
> 在 Vue 2中你将需要调用`set` 去追踪`object`上新的属性 (与`Vue.set`类似,但用于由 Composition API 创建的`reactive objects`)。在 Vue 3 中,你只需要像对待普通对象一样直接为属性赋值即可。
>
> 同样地, 在 Vue 2 中你将需要调用`del`去 [确保响应式对象中属性的删除将触发视图更新](https://vuejs.org/v2/api/#Vue-delete) (与`Vue.delete`类似,但用于由 Composition API 创建的`reactive objects`)。在Vue3中你只需要通过调用 `delete foo.bar` 来删除它们。
```ts
import { reactive, set, del } from '@vue/composition-api'
const a = reactive({
foo: 1
})
// 添加新的响应式属性
set(a, 'bar', 1)
// 刪除属性并触发响应式更新
del(a, 'bar')
```
</details>
### Watch
<details>
<summary>
❌ 不支持 <code>onTrack</code><code>onTrigger</code> 选项
</summary>
```js
watch(
() => {
/* ... */
},
{
immediate: true,
onTrack() {}, // 不可用
onTrigger() {}, // 不可用
}
)
```
</details>
### `createApp`
<details>
<summary>
⚠️ <code>createApp()</code> 是全局的
</summary>
在 Vue3 中,引入了 `createApp()` 来隔离不同应用实例的上下文(plugin, components 等)。 由于 Vue2 的设计,在这个插件中,我们提供 `createApp()` 作为一个向前兼容的 API ,它只是全局的一个别名。
```ts
const app1 = createApp(RootComponent1)
app1.component('Foo', Foo) // 相当于 Vue.component('Foo', Foo)
app1.use(VueRouter) // 相当于 Vue.use(VueRouter)
const app2 = createApp(RootComponent2)
app2.component('Bar', Bar) // 相当于 Vue.component('Bar', Bar)
```
</details>
### `createElement` / `h`
<details>
<summary>
⚠️ <code>createElement</code> / <code>h</code> 变通方案
</summary>
<br>
在 Vue2中 `createElement` / `h` 只能通过 `render()` 函数访问。要在 `render()`之外使用它, 你可以显式地给它绑定一个组件实例。
> :warning: **警告**: 此功能是作为 Vue 2 的变通方法提供的,它不是 Vue 3 API 的一部分。
```jsx
import { h as _h } from '@vue/composition-api'
export default {
setup() {
const vm = getCurrentInstance()
const h = _h.bind(vm)
return () =>
h('div', {
ref: 'root',
})
},
}
```
</details>
### `shallowReadonly`
<details>
<summary>
⚠️ <code>shallowReadonly()</code> 会返回一个新的浅拷贝对象,在此之后新加的字段<b>将不会</b>获得只读或响应式状态。
</summary>
> :bulb: 在 Vue 3 中,`shallowReadonly()` 会返回一个新的的代理对象
</details>
### `readonly`
<details>
<summary>
⚠️ <code>readonly()</code> <b>只提供类型层面</b>的只读。
</summary>
`readonly()` 只在类型层面提供和 Vue 3 的对齐。在其返回值或其属性上使用 <code>isReadonly()</code> 检查的结果将无法保证。
</details>
### `props`
<details>
<summary>
⚠️ 当使用 <code>toRefs</code> 访问深层属性对象 (如 <code>toRefs(props.foo)</code> 时将会得到不正确的警告。<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⚠️ <code>isReactive(props.foo)</code> 将会返回 false。
</summary>
```ts
defineComponent({
setup(props) {
const { bar } = toRefs(props.foo) // it will `warn`
// use this instead
const { foo } = toRefs(props)
const a = foo.value.bar
}
})
```
</details>
### `computed().effect`
<details>
<summary>
⚠️ <code>computed()</code> 拥有一个被设置为 <code>true</code><code>effect</code> 属性,用来代替 <code>ReactiveEffect<T></code>
</summary>
由于实现上的不同, 在 `@vue/composition-api` 中没有 `ReactiveEffect` 这种概念。 因此, `effect``true` 只是为了能够区分 computed 和 refs:
```ts
function isComputed<T>(o: ComputedRef<T> | unknown): o is ComputedRef<T>
function isComputed(o: any): o is ComputedRef {
return !!(isRef(o) && o.effect)
}
```
</details>
### 缺失的 API
以下在 Vue 3 新引入的 API ,在本插件中暂不适用:
- `onRenderTracked`
- `onRenderTriggered`
- `isProxy`
### 在 `data()` 中使用组合式 API
<details>
<summary>
❌ 在 <code>data()</code> 中使用 <code>ref</code>, <code>reactive</code> 或其他组合式 API 将不会生效
</summary>
```jsx
export default {
data() {
return {
// 在模版中会成为 { a: { value: 1 } }
a: ref(1),
}
},
}
```
</details>
### `emit` 选项
<details>
<summary>
<code>emit</code> 仅因在类型定义中对齐 Vue3 的选项而提供,<b>不会</b>有任何效果。
</summary>
```ts
defineComponent({
emit: {
// 无效
submit: (eventOption) => {
if (...) {
return true
} else {
console.warn('Invalid submit event payload!')
return false
}
}
}
})
```
</details>
### 性能影响
由于 Vue 2 的公共 API 的限制,`@vue/composition-api` 不可避免地引入了额外的性能开销。除非在极端情况下,否则这并不会对你造成影响。
你可以查看这个 [跑分结果](https://antfu.github.io/vue-composition-api-benchmark-results/) 了解更多信息。

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,519 @@
import Vue$1, { VNode, VueConstructor, ComponentOptions, AsyncComponent, VNodeDirective, CreateElement } from 'vue';
import { Component as Component$1, AsyncComponent as AsyncComponent$1 } from 'vue/types/options';
import { VNodeChildren, VNode as VNode$1, VNodeData } from 'vue/types/vnode';
declare type Data = {
[key: string]: unknown;
};
declare type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
declare type ComponentObjectPropsOptions<P = Data> = {
[K in keyof P]: Prop<P[K]> | null;
};
declare type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
declare type DefaultFactory<T> = () => T | null | undefined;
interface PropOptions<T = any, D = T> {
type?: PropType<T> | true | null;
required?: boolean;
default?: D | DefaultFactory<D> | null | undefined | object;
validator?(value: unknown): boolean;
}
declare type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
declare type PropConstructor<T> = {
new (...args: any[]): T & object;
} | {
(): T;
} | {
new (...args: string[]): Function;
};
declare type RequiredKeys<T> = {
[K in keyof T]: T[K] extends {
required: true;
} | {
default: any;
} | BooleanConstructor | {
type: BooleanConstructor;
} ? K : never;
}[keyof T];
declare type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
declare type ExtractFunctionPropType<T extends Function, TArgs extends Array<any> = any[], TResult = any> = T extends (...args: TArgs) => TResult ? T : never;
declare type ExtractCorrectPropType<T> = T extends Function ? ExtractFunctionPropType<T> : Exclude<T, Function>;
declare type InferPropType<T> = T extends null ? any : T extends {
type: null | true;
} ? any : T extends ObjectConstructor | {
type: ObjectConstructor;
} ? Record<string, any> : T extends BooleanConstructor | {
type: BooleanConstructor;
} ? boolean : T extends DateConstructor | {
type: DateConstructor;
} ? Date : T extends FunctionConstructor | {
type: FunctionConstructor;
} ? Function : T extends Prop<infer V, infer D> ? unknown extends V ? D extends null | undefined ? V : D : ExtractCorrectPropType<V> : T;
declare type ExtractPropTypes<O> = {
[K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
} & {
[K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
};
declare type DefaultKeys<T> = {
[K in keyof T]: T[K] extends {
default: any;
} | BooleanConstructor | {
type: BooleanConstructor;
} ? T[K] extends {
type: BooleanConstructor;
required: true;
} ? never : K : never;
}[keyof T];
declare type ExtractDefaultPropTypes<O> = O extends object ? {
[K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
} : {};
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
declare type Slot = (...args: any[]) => VNode[];
declare type InternalSlots = {
[name: string]: Slot | undefined;
};
declare type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
declare type EmitsOptions = ObjectEmitsOptions | string[];
declare type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options, ReturnType extends void | Vue$1 = void> = Options extends Array<infer V> ? (event: V, ...args: any[]) => ReturnType : {} extends Options ? (event: string, ...args: any[]) => ReturnType : UnionToIntersection<{
[key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => ReturnType : (event: key, ...args: any[]) => ReturnType;
}[Event]>;
declare type ComponentRenderEmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options, T extends Vue$1 | void = void> = EmitFn<Options, Event, T>;
declare type Slots = Readonly<InternalSlots>;
interface SetupContext<E extends EmitsOptions = {}> {
attrs: Data;
slots: Slots;
emit: EmitFn<E>;
/**
* @deprecated not available in Vue 2
*/
expose: (exposed?: Record<string, any>) => void;
/**
* @deprecated not available in Vue 3
*/
readonly parent: ComponentInstance | null;
/**
* @deprecated not available in Vue 3
*/
readonly root: ComponentInstance;
/**
* @deprecated not available in Vue 3
*/
readonly listeners: {
[key in string]?: Function;
};
/**
* @deprecated not available in Vue 3
*/
readonly refs: {
[key: string]: Vue | Element | Vue[] | Element[];
};
}
/**
* We expose a subset of properties on the internal instance as they are
* useful for advanced external libraries and tools.
*/
declare interface ComponentInternalInstance {
uid: number;
type: Record<string, unknown>;
parent: ComponentInternalInstance | null;
root: ComponentInternalInstance;
/**
* Vnode representing this component in its parent's vdom tree
*/
vnode: VNode;
/**
* Root vnode of this component's own vdom tree
*/
/**
* The reactive effect for rendering and patching the component. Callable.
*/
update: Function;
data: Data;
props: Data;
attrs: Data;
refs: Data;
emit: EmitFn;
slots: InternalSlots;
emitted: Record<string, boolean> | null;
proxy: ComponentInstance;
isMounted: boolean;
isUnmounted: boolean;
isDeactivated: boolean;
}
declare function getCurrentInstance(): ComponentInternalInstance | null;
declare type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
[K in string & `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
} : T extends ObjectEmitsOptions ? {
[K in string & `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? T[Uncapitalize<C>] extends null ? (...args: any[]) => any : (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : never) => any : never;
} : {};
declare type ComponentInstance = InstanceType<VueConstructor>;
declare type ComponentRenderProxy<P = {}, // props type extracted from props option
B = {}, // raw bindings returned from setup()
D = {}, // return from data()
C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false> = {
$data: D;
$props: Readonly<MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults> : P & PublicProps>;
$attrs: Record<string, string>;
$emit: ComponentRenderEmitFn<Emits, keyof Emits, ComponentRenderProxy<P, B, D, C, M, Mixin, Extends, Emits, PublicProps, Defaults, MakeDefaultsOptional>>;
} & Readonly<P> & ShallowUnwrapRef<B> & D & M & ExtractComputedReturns<C> & Omit<Vue$1, '$data' | '$props' | '$attrs' | '$emit'>;
declare type VueConstructorProxy<PropsOptions, RawBindings, Data, Computed extends ComputedOptions, Methods extends MethodOptions, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, Props = ExtractPropTypes<PropsOptions> & ({} extends Emits ? {} : EmitsToProps<Emits>)> = Omit<VueConstructor, never> & {
new (...args: any[]): ComponentRenderProxy<Props, ShallowUnwrapRef<RawBindings>, Data, Computed, Methods, Mixin, Extends, Emits, Props, ExtractDefaultPropTypes<PropsOptions>, true>;
};
declare type DefaultData<V> = object | ((this: V) => object);
declare type DefaultMethods<V> = {
[key: string]: (this: V, ...args: any[]) => any;
};
declare type DefaultComputed = {
[key: string]: any;
};
declare type VueProxy<PropsOptions, RawBindings, Data = DefaultData<Vue$1>, Computed extends ComputedOptions = DefaultComputed, Methods extends MethodOptions = DefaultMethods<Vue$1>, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}> = ComponentOptions<Vue$1, ShallowUnwrapRef<RawBindings> & Data, Methods, Computed, PropsOptions, ExtractPropTypes<PropsOptions>> & VueConstructorProxy<PropsOptions, RawBindings, Data, Computed, Methods, Mixin, Extends, Emits>;
declare type ComponentPublicInstance<P = {}, // props type extracted from props option
B = {}, // raw bindings returned from setup()
D = {}, // return from data()
C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false> = {
$: ComponentInternalInstance;
$data: D;
$props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults> : P & PublicProps;
$attrs: Data;
$refs: Data;
$slots: Slots;
$root: ComponentPublicInstance | null;
$parent: ComponentPublicInstance | null;
$emit: EmitFn<E>;
$el: any;
$forceUpdate: () => void;
$nextTick: typeof nextTick;
$watch(source: string | Function, cb: Function, options?: WatchOptions): WatchStopHandle;
} & P & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M;
declare type ComputedGetter$1<T> = (ctx?: any) => T;
declare type ComputedSetter$1<T> = (v: T) => void;
interface WritableComputedOptions$1<T> {
get: ComputedGetter$1<T>;
set: ComputedSetter$1<T>;
}
declare type ComputedOptions = Record<string, ComputedGetter$1<any> | WritableComputedOptions$1<any>>;
interface MethodOptions {
[key: string]: Function;
}
declare type SetupFunction<Props, RawBindings = {}, Emits extends EmitsOptions = {}> = (this: void, props: Readonly<Props>, ctx: SetupContext<Emits>) => RawBindings | (() => VNode | null) | void;
interface ComponentOptionsBase<Props, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}> extends Omit<ComponentOptions<Vue$1, D, M, C, Props>, 'data' | 'computed' | 'method' | 'setup' | 'props'> {
[key: string]: any;
data?: (this: Props & Vue$1, vm: Props) => D;
computed?: C;
methods?: M;
}
declare type ExtractComputedReturns<T extends any> = {
[key in keyof T]: T[key] extends {
get: (...args: any[]) => infer TReturn;
} ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
};
declare type ComponentOptionsWithProps<PropsOptions = ComponentPropsOptions, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, Props = ExtractPropTypes<PropsOptions>> = ComponentOptionsBase<Props, D, C, M> & {
props?: PropsOptions;
emits?: Emits & ThisType<void>;
setup?: SetupFunction<Props, RawBindings, Emits>;
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M, Mixin, Extends, Emits>>;
declare type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, Props = Readonly<{
[key in PropNames]?: any;
}>> = ComponentOptionsBase<Props, D, C, M> & {
props?: PropNames[];
emits?: Emits & ThisType<void>;
setup?: SetupFunction<Props, RawBindings, Emits>;
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M, Mixin, Extends, Emits>>;
declare type ComponentOptionsWithoutProps<Props = {}, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}> = ComponentOptionsBase<Props, D, C, M> & {
props?: undefined;
emits?: Emits & ThisType<void>;
setup?: SetupFunction<Props, RawBindings, Emits>;
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M, Mixin, Extends, Emits>>;
declare type AnyObject = Record<string | number | symbol, any>;
declare type Equal<Left, Right> = (<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false;
declare type HasDefined<T> = Equal<T, unknown> extends true ? false : true;
/**
* overload 1: object format with no props
*/
declare function defineComponent<RawBindings, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}>(options: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M, Mixin, Extends, Emits>): VueProxy<{}, RawBindings, D, C, M, Mixin, Extends, Emits>;
/**
* overload 2: object format with array props declaration
* props inferred as `{ [key in PropNames]?: any }`
*
* return type is for Vetur and TSX support
*/
declare function defineComponent<PropNames extends string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, Emits>): VueProxy<Readonly<{
[key in PropNames]?: any;
}>, RawBindings, D, C, M, Mixin, Extends, Emits>;
/**
* overload 3: object format with object props declaration
*
* see `ExtractPropTypes` in './componentProps.ts'
*/
declare function defineComponent<Props, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: HasDefined<Props> extends true ? ComponentOptionsWithProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits, Props> : ComponentOptionsWithProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits>): VueProxy<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits>;
declare type Component = VueProxy<any, any, any, any, any>;
declare type ComponentOrComponentOptions = Component | ComponentOptionsWithoutProps | ComponentOptionsWithArrayProps | ComponentOptionsWithProps;
declare type AsyncComponentResolveResult<T = ComponentOrComponentOptions> = T | {
default: T;
};
declare type AsyncComponentLoader = () => Promise<AsyncComponentResolveResult>;
interface AsyncComponentOptions {
loader: AsyncComponentLoader;
loadingComponent?: ComponentOrComponentOptions;
errorComponent?: ComponentOrComponentOptions;
delay?: number;
timeout?: number;
suspensible?: boolean;
onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
}
declare function defineAsyncComponent(source: AsyncComponentLoader | AsyncComponentOptions): AsyncComponent;
declare type DirectiveModifiers = Record<string, boolean>;
interface DirectiveBinding<V> extends Readonly<VNodeDirective> {
readonly modifiers: DirectiveModifiers;
readonly value: V;
readonly oldValue: V | null;
}
declare type DirectiveHook<T = any, Prev = VNode | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode, prevVNode: Prev) => void;
interface ObjectDirective<T = any, V = any> {
bind?: DirectiveHook<T, any, V>;
inserted?: DirectiveHook<T, any, V>;
update?: DirectiveHook<T, any, V>;
componentUpdated?: DirectiveHook<T, any, V>;
unbind?: DirectiveHook<T, any, V>;
}
declare type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
declare type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
declare const Plugin: {
install: (Vue: VueConstructor) => void;
};
declare const _refBrand: unique symbol;
interface Ref<T = any> {
readonly [_refBrand]: true;
value: T;
}
interface WritableComputedRef<T> extends Ref<T> {
/**
* `effect` is added to be able to differentiate refs from computed properties.
* **Differently from Vue 3, it's just `true`**. This is because there is no equivalent
* of `ReactiveEffect<T>` in `@vue/composition-api`.
*/
effect: true;
}
interface ComputedRef<T = any> extends WritableComputedRef<T> {
readonly value: T;
}
declare type ToRefs<T = any> = {
[K in keyof T]: Ref<T[K]>;
};
declare type CollectionTypes = IterableCollections | WeakCollections;
declare type IterableCollections = Map<any, any> | Set<any>;
declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
declare type BaseTypes = string | number | boolean | Node | Window | Date;
declare type ShallowUnwrapRef<T> = {
[K in keyof T]: T[K] extends Ref<infer V> ? V : T[K];
};
declare type UnwrapRef<T> = T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref ? T : T extends Array<any> ? {
[K in keyof T]: UnwrapRefSimple<T[K]>;
} : T extends object ? {
[P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
} : T;
interface RefOption<T> {
get(): T;
set?(x: T): void;
}
declare class RefImpl<T> implements Ref<T> {
readonly [_refBrand]: true;
value: T;
constructor({ get, set }: RefOption<T>);
}
declare function createRef<T>(options: RefOption<T>, isReadonly?: boolean, isComputed?: boolean): RefImpl<T>;
declare function ref<T extends object>(raw: T): T extends Ref ? T : Ref<UnwrapRef<T>>;
declare function ref<T>(raw: T): Ref<UnwrapRef<T>>;
declare function ref<T = any>(): Ref<T | undefined>;
declare function isRef<T>(value: any): value is Ref<T>;
declare function unref<T>(ref: T | Ref<T>): T;
declare function toRefs<T extends object>(obj: T): ToRefs<T>;
declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
get: () => T;
set: (value: T) => void;
};
declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
declare function toRef<T extends object, K extends keyof T>(object: T, key: K): Ref<T[K]>;
declare function shallowRef<T extends object>(value: T): T extends Ref ? T : Ref<T>;
declare function shallowRef<T>(value: T): Ref<T>;
declare function shallowRef<T = any>(): Ref<T | undefined>;
declare function triggerRef(value: any): void;
declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
declare function isRaw(obj: any): boolean;
declare function isReactive(obj: any): boolean;
declare function shallowReactive<T extends object = any>(obj: T): T;
/**
* Make obj reactivity
*/
declare function reactive<T extends object>(obj: T): UnwrapRef<T>;
/**
* Make sure obj can't be a reactive
*/
declare function markRaw<T extends object>(obj: T): T;
declare function toRaw<T>(observed: T): T;
declare function isReadonly(obj: any): boolean;
declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
declare type Builtin = Primitive | Function | Date | Error | RegExp;
declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends {} ? {
readonly [K in keyof T]: DeepReadonly<T[K]>;
} : Readonly<T>;
declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
/**
* **In @vue/composition-api, `reactive` only provides type-level readonly check**
*
* Creates a readonly copy of the original object. Note the returned copy is not
* made reactive, but `readonly` can be called on an already reactive object.
*/
declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
declare function shallowReadonly<T extends object>(obj: T): Readonly<T>;
/**
* Set a property on an object. Adds the new property, triggers change
* notification and intercept it's subsequent access if the property doesn't
* already exist.
*/
declare function set<T>(target: AnyObject, key: any, val: T): T;
/**
* Delete a property and trigger change if necessary.
*/
declare function del(target: AnyObject, key: any): void;
declare const onBeforeMount: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onMounted: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onBeforeUpdate: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onUpdated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onBeforeUnmount: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onUnmounted: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onErrorCaptured: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onActivated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onDeactivated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare const onServerPrefetch: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
declare type WatchEffect = (onInvalidate: InvalidateCbRegistrator) => void;
declare type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
declare type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onInvalidate: InvalidateCbRegistrator) => any;
declare type MapSources<T, Immediate> = {
[K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
};
declare type MultiWatchSources = (WatchSource<unknown> | object)[];
interface WatchOptionsBase {
flush?: FlushMode;
}
declare type InvalidateCbRegistrator = (cb: () => void) => void;
declare type FlushMode = 'pre' | 'post' | 'sync';
interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
immediate?: Immediate;
deep?: boolean;
}
interface VueWatcher {
lazy: boolean;
get(): any;
teardown(): void;
run(): void;
value: any;
}
declare type WatchStopHandle = () => void;
declare function watchEffect(effect: WatchEffect, options?: WatchOptionsBase): WatchStopHandle;
declare function watchPostEffect(effect: WatchEffect): WatchStopHandle;
declare function watchSyncEffect(effect: WatchEffect): WatchStopHandle;
declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
declare type ComputedGetter<T> = (ctx?: any) => T;
declare type ComputedSetter<T> = (v: T) => void;
interface WritableComputedOptions<T> {
get: ComputedGetter<T>;
set: ComputedSetter<T>;
}
declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
interface InjectionKey<T> extends Symbol {
}
declare function provide<T>(key: InjectionKey<T> | string, value: T): void;
declare function inject<T>(key: InjectionKey<T> | string): T | undefined;
declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T;
declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T | (() => T), treatDefaultAsFactory?: true): T;
declare const useCssModule: (name?: string) => Record<string, string>;
/**
* @deprecated use `useCssModule` instead.
*/
declare const useCSSModule: (name?: string) => Record<string, string>;
interface App<T = any> {
config: VueConstructor['config'];
use: VueConstructor['use'];
mixin: VueConstructor['mixin'];
component: VueConstructor['component'];
directive(name: string): Directive | undefined;
directive(name: string, directive: Directive): this;
provide<T>(key: InjectionKey<T> | symbol | string, value: T): this;
mount: Vue$1['$mount'];
unmount: Vue$1['$destroy'];
}
declare function createApp(rootComponent: any, rootProps?: any): App;
declare type NextTick = Vue$1['$nextTick'];
declare const nextTick: NextTick;
interface H extends CreateElement {
(this: ComponentInternalInstance | null | undefined, tag?: string | Component$1<any, any, any, any> | AsyncComponent$1<any, any, any, any> | (() => Component$1), children?: VNodeChildren): VNode$1;
(this: ComponentInternalInstance | null | undefined, tag?: string | Component$1<any, any, any, any> | AsyncComponent$1<any, any, any, any> | (() => Component$1), data?: VNodeData, children?: VNodeChildren): VNode$1;
}
declare const createElement: H;
/**
* Displays a warning message (using console.error) with a stack trace if the
* function is called inside of active component.
*
* @param message warning message to be displayed
*/
declare function warn(message: string): void;
declare class EffectScopeImpl {
active: boolean;
effects: EffectScope[];
cleanups: (() => void)[];
constructor(vm: Vue);
run<T>(fn: () => T): T | undefined;
on(): void;
off(): void;
stop(): void;
}
declare class EffectScope extends EffectScopeImpl {
constructor(detached?: boolean);
}
declare function effectScope(detached?: boolean): EffectScope;
declare function getCurrentScope(): EffectScope | undefined;
declare function onScopeDispose(fn: () => void): void;
declare function useSlots(): SetupContext['slots'];
declare function useAttrs(): SetupContext['attrs'];
declare const version: string;
declare module 'vue/types/options' {
interface ComponentOptions<V extends Vue$1> {
setup?: SetupFunction<Data, Data>;
}
}
export { App, ComponentInstance, ComponentInternalInstance, ComponentPropsOptions, ComponentPublicInstance, ComponentRenderProxy, ComputedGetter, ComputedOptions, ComputedRef, ComputedSetter, Data, DeepReadonly, Directive, DirectiveBinding, DirectiveHook, DirectiveModifiers, EffectScope, ExtractDefaultPropTypes, ExtractPropTypes, FlushMode, FunctionDirective, InjectionKey, MethodOptions, ObjectDirective, PropOptions, PropType, Ref, SetupContext, SetupFunction, ShallowUnwrapRef, ToRefs, UnwrapNestedRefs, UnwrapRef, UnwrapRefSimple, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, computed, createApp, createRef, customRef, Plugin as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, createElement as h, inject, isRaw, isReactive, isReadonly, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCSSModule, useCssModule, useSlots, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect };

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

7
uniapp04/node_modules/@vue/composition-api/index.js generated vendored Normal file
View File

@ -0,0 +1,7 @@
'use strict'
if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/vue-composition-api.common.prod.js')
} else {
module.exports = require('./dist/vue-composition-api.common.js')
}

View File

@ -0,0 +1,97 @@
{
"name": "@vue/composition-api",
"version": "1.7.2",
"packageManager": "pnpm@8.6.12",
"description": "Provide logic composition capabilities for Vue.",
"keywords": [
"vue",
"composition-api"
],
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/composition-api.git"
},
"main": "./index.js",
"module": "./dist/vue-composition-api.mjs",
"unpkg": "./dist/vue-composition-api.prod.js",
"jsdelivr": "./dist/vue-composition-api.prod.js",
"types": "./dist/vue-composition-api.d.ts",
"exports": {
".": {
"import": "./dist/vue-composition-api.mjs",
"types": "./dist/vue-composition-api.d.ts",
"require": "./index.js"
},
"./*": "./*"
},
"author": {
"name": "liximomo",
"email": "liximomo@gmail.com"
},
"license": "MIT",
"sideEffects": false,
"files": [
"dist",
"index.js"
],
"scripts": {
"start": "rollup -c -w",
"build": "rimraf dist && rollup -c",
"lint": "prettier --write --parser typescript \"{src,test,test-dts}/**/*.ts?(x)\" && prettier --write \"{src,test}/**/*.js\"",
"test": "vitest",
"test:all": "pnpm run test && pnpm run test:dts",
"test:dts": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.vue3.json && pnpm run build && tsc -p ./test-dts/tsconfig.build.json",
"update-readme": "node ./scripts/update-readme.js",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && pnpm run update-readme && git add CHANGELOG.md README.*",
"release": "bumpp -x \"npm run changelog\" --all && npm publish",
"release-gh": "conventional-github-releaser -p angular",
"prepublishOnly": "npm run build"
},
"bugs": {
"url": "https://github.com/vuejs/composition-api/issues"
},
"homepage": "https://github.com/vuejs/composition-api#readme",
"peerDependencies": {
"vue": ">= 2.5 < 2.7"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@types/node": "^17.0.31",
"bumpp": "^9.1.1",
"conventional-changelog-cli": "^2.2.2",
"conventional-github-releaser": "^3.1.5",
"jsdom": "^20.0.0",
"lint-staged": "^14.0.0",
"prettier": "^3.0.1",
"rimraf": "^5.0.1",
"rollup": "^2.72.0",
"rollup-plugin-dts": "^4.2.1",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"simple-git-hooks": "^2.9.0",
"tslib": "^2.4.0",
"typescript": "^4.6.4",
"vitest": "^0.34.1",
"vue": "^2.6.14",
"vue3": "npm:vue@3.2.21",
"vue-router": "^3.5.3",
"vue-server-renderer": "^2.6.14"
},
"simple-git-hooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"prettier --write"
],
"*.ts?(x)": [
"prettier --parser=typescript --write"
]
},
"prettier": {
"semi": false,
"singleQuote": true,
"printWidth": 80
}
}

20
uniapp04/node_modules/debug/LICENSE generated vendored Normal file
View File

@ -0,0 +1,20 @@
(The MIT License)
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2018-2021 Josh Junon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the 'Software'), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

481
uniapp04/node_modules/debug/README.md generated vendored Normal file
View File

@ -0,0 +1,481 @@
# debug
[![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
A tiny JavaScript debugging utility modelled after Node.js core's debugging
technique. Works in Node.js and web browsers.
## Installation
```bash
$ npm install debug
```
## Usage
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
Example [_app.js_](./examples/node/app.js):
```js
var debug = require('debug')('http')
, http = require('http')
, name = 'My App';
// fake app
debug('booting %o', name);
http.createServer(function(req, res){
debug(req.method + ' ' + req.url);
res.end('hello\n');
}).listen(3000, function(){
debug('listening');
});
// fake worker of some kind
require('./worker');
```
Example [_worker.js_](./examples/node/worker.js):
```js
var a = require('debug')('worker:a')
, b = require('debug')('worker:b');
function work() {
a('doing lots of uninteresting work');
setTimeout(work, Math.random() * 1000);
}
work();
function workb() {
b('doing some work');
setTimeout(workb, Math.random() * 2000);
}
workb();
```
The `DEBUG` environment variable is then used to enable these based on space or
comma-delimited names.
Here are some examples:
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
#### Windows command prompt notes
##### CMD
On Windows the environment variable is set using the `set` command.
```cmd
set DEBUG=*,-not_this
```
Example:
```cmd
set DEBUG=* & node app.js
```
##### PowerShell (VS Code default)
PowerShell uses different syntax to set environment variables.
```cmd
$env:DEBUG = "*,-not_this"
```
Example:
```cmd
$env:DEBUG='app';node app.js
```
Then, run the program to be debugged as usual.
npm script example:
```js
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
```
## Namespace Colors
Every debug instance has a color generated for it based on its namespace name.
This helps when visually parsing the debug output to identify which debug instance
a debug line belongs to.
#### Node.js
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
otherwise debug will only use a small handful of basic colors.
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
#### Web Browser
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
option. These are WebKit web inspectors, Firefox ([since version
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
and the Firebug plugin for Firefox (any version).
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
## Millisecond diff
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
## Conventions
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
## Wildcards
The `*` character may be used as a wildcard. Suppose for example your library has
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
instead of listing all three with
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
You can also exclude specific debuggers by prefixing them with a "-" character.
For example, `DEBUG=*,-connect:*` would include all debuggers except those
starting with "connect:".
## Environment Variables
When running through Node.js, you can set a few environment variables that will
change the behavior of the debug logging:
| Name | Purpose |
|-----------|-------------------------------------------------|
| `DEBUG` | Enables/disables specific debugging namespaces. |
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
| `DEBUG_DEPTH` | Object inspection depth. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
__Note:__ The environment variables beginning with `DEBUG_` end up being
converted into an Options object that gets used with `%o`/`%O` formatters.
See the Node.js documentation for
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
for the complete list.
## Formatters
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
Below are the officially supported formatters:
| Formatter | Representation |
|-----------|----------------|
| `%O` | Pretty-print an Object on multiple lines. |
| `%o` | Pretty-print an Object all on a single line. |
| `%s` | String. |
| `%d` | Number (both integer and float). |
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
| `%%` | Single percent sign ('%'). This does not consume an argument. |
### Custom formatters
You can add custom formatters by extending the `debug.formatters` object.
For example, if you wanted to add support for rendering a Buffer as hex with
`%h`, you could do something like:
```js
const createDebug = require('debug')
createDebug.formatters.h = (v) => {
return v.toString('hex')
}
// …elsewhere
const debug = createDebug('foo')
debug('this is hex: %h', new Buffer('hello world'))
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
```
## Browser Support
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
if you don't want to build it yourself.
Debug's enable state is currently persisted by `localStorage`.
Consider the situation shown below where you have `worker:a` and `worker:b`,
and wish to debug both. You can enable this using `localStorage.debug`:
```js
localStorage.debug = 'worker:*'
```
And then refresh the page.
```js
a = debug('worker:a');
b = debug('worker:b');
setInterval(function(){
a('doing some work');
}, 1000);
setInterval(function(){
b('doing some work');
}, 1200);
```
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
<img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
## Output streams
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
Example [_stdout.js_](./examples/node/stdout.js):
```js
var debug = require('debug');
var error = debug('app:error');
// by default stderr is used
error('goes to stderr!');
var log = debug('app:log');
// set this namespace to log via console.log
log.log = console.log.bind(console); // don't forget to bind to console!
log('goes to stdout');
error('still goes to stderr!');
// set all output to go via console.info
// overrides all per-namespace log settings
debug.log = console.info.bind(console);
error('now goes to stdout via console.info');
log('still goes to stdout, but via console.info now');
```
## Extend
You can simply extend debugger
```js
const log = require('debug')('auth');
//creates new debug instance with extended namespace
const logSign = log.extend('sign');
const logLogin = log.extend('login');
log('hello'); // auth hello
logSign('hello'); //auth:sign hello
logLogin('hello'); //auth:login hello
```
## Set dynamically
You can also enable debug dynamically by calling the `enable()` method :
```js
let debug = require('debug');
console.log(1, debug.enabled('test'));
debug.enable('test');
console.log(2, debug.enabled('test'));
debug.disable();
console.log(3, debug.enabled('test'));
```
print :
```
1 false
2 true
3 false
```
Usage :
`enable(namespaces)`
`namespaces` can include modes separated by a colon and wildcards.
Note that calling `enable()` completely overrides previously set DEBUG variable :
```
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
=> false
```
`disable()`
Will disable all namespaces. The functions returns the namespaces currently
enabled (and skipped). This can be useful if you want to disable debugging
temporarily without knowing what was enabled to begin with.
For example:
```js
let debug = require('debug');
debug.enable('foo:*,-foo:bar');
let namespaces = debug.disable();
debug.enable(namespaces);
```
Note: There is no guarantee that the string will be identical to the initial
enable string, but semantically they will be identical.
## Checking whether a debug target is enabled
After you've created a debug instance, you can determine whether or not it is
enabled by checking the `enabled` property:
```javascript
const debug = require('debug')('http');
if (debug.enabled) {
// do stuff...
}
```
You can also manually toggle this property to force the debug instance to be
enabled or disabled.
## Usage in child processes
Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process.
For example:
```javascript
worker = fork(WORKER_WRAP_PATH, [workerPath], {
stdio: [
/* stdin: */ 0,
/* stdout: */ 'pipe',
/* stderr: */ 'pipe',
'ipc',
],
env: Object.assign({}, process.env, {
DEBUG_COLORS: 1 // without this settings, colors won't be shown
}),
});
worker.stderr.pipe(process.stderr, { end: false });
```
## Authors
- TJ Holowaychuk
- Nathan Rajlich
- Andrew Rhyne
- Josh Junon
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
## Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
## License
(The MIT License)
Copyright (c) 2014-2017 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
Copyright (c) 2018-2021 Josh Junon
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

60
uniapp04/node_modules/debug/package.json generated vendored Normal file
View File

@ -0,0 +1,60 @@
{
"name": "debug",
"version": "4.3.7",
"repository": {
"type": "git",
"url": "git://github.com/debug-js/debug.git"
},
"description": "Lightweight debugging utility for Node.js and the browser",
"keywords": [
"debug",
"log",
"debugger"
],
"files": [
"src",
"LICENSE",
"README.md"
],
"author": "Josh Junon (https://github.com/qix-)",
"contributors": [
"TJ Holowaychuk <tj@vision-media.ca>",
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
"Andrew Rhyne <rhyneandrew@gmail.com>"
],
"license": "MIT",
"scripts": {
"lint": "xo",
"test": "npm run test:node && npm run test:browser && npm run lint",
"test:node": "istanbul cover _mocha -- test.js test.node.js",
"test:browser": "karma start --single-run",
"test:coverage": "cat ./coverage/lcov.info | coveralls"
},
"dependencies": {
"ms": "^2.1.3"
},
"devDependencies": {
"brfs": "^2.0.1",
"browserify": "^16.2.3",
"coveralls": "^3.0.2",
"istanbul": "^0.4.5",
"karma": "^3.1.4",
"karma-browserify": "^6.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"mocha": "^5.2.0",
"mocha-lcov-reporter": "^1.2.0",
"sinon": "^14.0.0",
"xo": "^0.23.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
},
"main": "./src/index.js",
"browser": "./src/browser.js",
"engines": {
"node": ">=6.0"
}
}

271
uniapp04/node_modules/debug/src/browser.js generated vendored Normal file
View File

@ -0,0 +1,271 @@
/* eslint-env browser */
/**
* This is the web browser implementation of `debug()`.
*/
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.storage = localstorage();
exports.destroy = (() => {
let warned = false;
return () => {
if (!warned) {
warned = true;
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
}
};
})();
/**
* Colors.
*/
exports.colors = [
'#0000CC',
'#0000FF',
'#0033CC',
'#0033FF',
'#0066CC',
'#0066FF',
'#0099CC',
'#0099FF',
'#00CC00',
'#00CC33',
'#00CC66',
'#00CC99',
'#00CCCC',
'#00CCFF',
'#3300CC',
'#3300FF',
'#3333CC',
'#3333FF',
'#3366CC',
'#3366FF',
'#3399CC',
'#3399FF',
'#33CC00',
'#33CC33',
'#33CC66',
'#33CC99',
'#33CCCC',
'#33CCFF',
'#6600CC',
'#6600FF',
'#6633CC',
'#6633FF',
'#66CC00',
'#66CC33',
'#9900CC',
'#9900FF',
'#9933CC',
'#9933FF',
'#99CC00',
'#99CC33',
'#CC0000',
'#CC0033',
'#CC0066',
'#CC0099',
'#CC00CC',
'#CC00FF',
'#CC3300',
'#CC3333',
'#CC3366',
'#CC3399',
'#CC33CC',
'#CC33FF',
'#CC6600',
'#CC6633',
'#CC9900',
'#CC9933',
'#CCCC00',
'#CCCC33',
'#FF0000',
'#FF0033',
'#FF0066',
'#FF0099',
'#FF00CC',
'#FF00FF',
'#FF3300',
'#FF3333',
'#FF3366',
'#FF3399',
'#FF33CC',
'#FF33FF',
'#FF6600',
'#FF6633',
'#FF9900',
'#FF9933',
'#FFCC00',
'#FFCC33'
];
/**
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
* and the Firebug extension (any Firefox version) are known
* to support "%c" CSS customizations.
*
* TODO: add a `localStorage` variable to explicitly enable/disable colors
*/
// eslint-disable-next-line complexity
function useColors() {
// NB: In an Electron preload script, document will be defined but not fully
// initialized. Since we know we're in Chrome, we'll just detect this case
// explicitly
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
return true;
}
// Internet Explorer and Edge do not support colors.
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
return false;
}
let m;
// Is webkit? http://stackoverflow.com/a/16459606/376773
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
// Is firebug? http://stackoverflow.com/a/398120/376773
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
// Is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
// Double check webkit in userAgent just in case we are in a worker
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**
* Colorize log arguments if enabled.
*
* @api public
*/
function formatArgs(args) {
args[0] = (this.useColors ? '%c' : '') +
this.namespace +
(this.useColors ? ' %c' : ' ') +
args[0] +
(this.useColors ? '%c ' : ' ') +
'+' + module.exports.humanize(this.diff);
if (!this.useColors) {
return;
}
const c = 'color: ' + this.color;
args.splice(1, 0, c, 'color: inherit');
// The final "%c" is somewhat tricky, because there could be other
// arguments passed either before or after the %c, so we need to
// figure out the correct index to insert the CSS into
let index = 0;
let lastC = 0;
args[0].replace(/%[a-zA-Z%]/g, match => {
if (match === '%%') {
return;
}
index++;
if (match === '%c') {
// We only are interested in the *last* %c
// (the user may have provided their own)
lastC = index;
}
});
args.splice(lastC, 0, c);
}
/**
* Invokes `console.debug()` when available.
* No-op when `console.debug` is not a "function".
* If `console.debug` is not available, falls back
* to `console.log`.
*
* @api public
*/
exports.log = console.debug || console.log || (() => {});
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
try {
if (namespaces) {
exports.storage.setItem('debug', namespaces);
} else {
exports.storage.removeItem('debug');
}
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
let r;
try {
r = exports.storage.getItem('debug');
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
if (!r && typeof process !== 'undefined' && 'env' in process) {
r = process.env.DEBUG;
}
return r;
}
/**
* Localstorage attempts to return the localstorage.
*
* This is necessary because safari throws
* when a user disables cookies/localstorage
* and you attempt to access it.
*
* @return {LocalStorage}
* @api private
*/
function localstorage() {
try {
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
// The Browser also has localStorage in the global context.
return localStorage;
} catch (error) {
// Swallow
// XXX (@Qix-) should we be logging these?
}
}
module.exports = require('./common')(exports);
const {formatters} = module.exports;
/**
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
*/
formatters.j = function (v) {
try {
return JSON.stringify(v);
} catch (error) {
return '[UnexpectedJSONParseError]: ' + error.message;
}
};

274
uniapp04/node_modules/debug/src/common.js generated vendored Normal file
View File

@ -0,0 +1,274 @@
/**
* This is the common logic for both the Node.js and web browser
* implementations of `debug()`.
*/
function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = require('ms');
createDebug.destroy = destroy;
Object.keys(env).forEach(key => {
createDebug[key] = env[key];
});
/**
* The currently active debug mode names, and names to skip.
*/
createDebug.names = [];
createDebug.skips = [];
/**
* Map of special "%n" handling functions, for the debug "format" argument.
*
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
*/
createDebug.formatters = {};
/**
* Selects a color for a debug namespace
* @param {String} namespace The namespace string for the debug instance to be colored
* @return {Number|String} An ANSI color code for the given namespace
* @api private
*/
function selectColor(namespace) {
let hash = 0;
for (let i = 0; i < namespace.length; i++) {
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit integer
}
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
}
createDebug.selectColor = selectColor;
/**
* Create a debugger with the given `namespace`.
*
* @param {String} namespace
* @return {Function}
* @api public
*/
function createDebug(namespace) {
let prevTime;
let enableOverride = null;
let namespacesCache;
let enabledCache;
function debug(...args) {
// Disabled?
if (!debug.enabled) {
return;
}
const self = debug;
// Set `diff` timestamp
const curr = Number(new Date());
const ms = curr - (prevTime || curr);
self.diff = ms;
self.prev = prevTime;
self.curr = curr;
prevTime = curr;
args[0] = createDebug.coerce(args[0]);
if (typeof args[0] !== 'string') {
// Anything else let's inspect with %O
args.unshift('%O');
}
// Apply any `formatters` transformations
let index = 0;
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
// If we encounter an escaped % then don't increase the array index
if (match === '%%') {
return '%';
}
index++;
const formatter = createDebug.formatters[format];
if (typeof formatter === 'function') {
const val = args[index];
match = formatter.call(self, val);
// Now we need to remove `args[index]` since it's inlined in the `format`
args.splice(index, 1);
index--;
}
return match;
});
// Apply env-specific formatting (colors, etc.)
createDebug.formatArgs.call(self, args);
const logFn = self.log || createDebug.log;
logFn.apply(self, args);
}
debug.namespace = namespace;
debug.useColors = createDebug.useColors();
debug.color = createDebug.selectColor(namespace);
debug.extend = extend;
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
Object.defineProperty(debug, 'enabled', {
enumerable: true,
configurable: false,
get: () => {
if (enableOverride !== null) {
return enableOverride;
}
if (namespacesCache !== createDebug.namespaces) {
namespacesCache = createDebug.namespaces;
enabledCache = createDebug.enabled(namespace);
}
return enabledCache;
},
set: v => {
enableOverride = v;
}
});
// Env-specific initialization logic for debug instances
if (typeof createDebug.init === 'function') {
createDebug.init(debug);
}
return debug;
}
function extend(namespace, delimiter) {
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
newDebug.log = this.log;
return newDebug;
}
/**
* Enables a debug mode by namespaces. This can include modes
* separated by a colon and wildcards.
*
* @param {String} namespaces
* @api public
*/
function enable(namespaces) {
createDebug.save(namespaces);
createDebug.namespaces = namespaces;
createDebug.names = [];
createDebug.skips = [];
let i;
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
const len = split.length;
for (i = 0; i < len; i++) {
if (!split[i]) {
// ignore empty strings
continue;
}
namespaces = split[i].replace(/\*/g, '.*?');
if (namespaces[0] === '-') {
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
} else {
createDebug.names.push(new RegExp('^' + namespaces + '$'));
}
}
}
/**
* Disable debug output.
*
* @return {String} namespaces
* @api public
*/
function disable() {
const namespaces = [
...createDebug.names.map(toNamespace),
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
].join(',');
createDebug.enable('');
return namespaces;
}
/**
* Returns true if the given mode name is enabled, false otherwise.
*
* @param {String} name
* @return {Boolean}
* @api public
*/
function enabled(name) {
if (name[name.length - 1] === '*') {
return true;
}
let i;
let len;
for (i = 0, len = createDebug.skips.length; i < len; i++) {
if (createDebug.skips[i].test(name)) {
return false;
}
}
for (i = 0, len = createDebug.names.length; i < len; i++) {
if (createDebug.names[i].test(name)) {
return true;
}
}
return false;
}
/**
* Convert regexp to namespace
*
* @param {RegExp} regxep
* @return {String} namespace
* @api private
*/
function toNamespace(regexp) {
return regexp.toString()
.substring(2, regexp.toString().length - 2)
.replace(/\.\*\?$/, '*');
}
/**
* Coerce `val`.
*
* @param {Mixed} val
* @return {Mixed}
* @api private
*/
function coerce(val) {
if (val instanceof Error) {
return val.stack || val.message;
}
return val;
}
/**
* XXX DO NOT USE. This is a temporary stub function.
* XXX It WILL be removed in the next major release.
*/
function destroy() {
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
}
createDebug.enable(createDebug.load());
return createDebug;
}
module.exports = setup;

10
uniapp04/node_modules/debug/src/index.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
/**
* Detect Electron renderer / nwjs process, which is node, but we should
* treat as a browser.
*/
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
module.exports = require('./browser.js');
} else {
module.exports = require('./node.js');
}

263
uniapp04/node_modules/debug/src/node.js generated vendored Normal file
View File

@ -0,0 +1,263 @@
/**
* Module dependencies.
*/
const tty = require('tty');
const util = require('util');
/**
* This is the Node.js implementation of `debug()`.
*/
exports.init = init;
exports.log = log;
exports.formatArgs = formatArgs;
exports.save = save;
exports.load = load;
exports.useColors = useColors;
exports.destroy = util.deprecate(
() => {},
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
);
/**
* Colors.
*/
exports.colors = [6, 2, 3, 4, 5, 1];
try {
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
// eslint-disable-next-line import/no-extraneous-dependencies
const supportsColor = require('supports-color');
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
exports.colors = [
20,
21,
26,
27,
32,
33,
38,
39,
40,
41,
42,
43,
44,
45,
56,
57,
62,
63,
68,
69,
74,
75,
76,
77,
78,
79,
80,
81,
92,
93,
98,
99,
112,
113,
128,
129,
134,
135,
148,
149,
160,
161,
162,
163,
164,
165,
166,
167,
168,
169,
170,
171,
172,
173,
178,
179,
184,
185,
196,
197,
198,
199,
200,
201,
202,
203,
204,
205,
206,
207,
208,
209,
214,
215,
220,
221
];
}
} catch (error) {
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
}
/**
* Build up the default `inspectOpts` object from the environment variables.
*
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
*/
exports.inspectOpts = Object.keys(process.env).filter(key => {
return /^debug_/i.test(key);
}).reduce((obj, key) => {
// Camel-case
const prop = key
.substring(6)
.toLowerCase()
.replace(/_([a-z])/g, (_, k) => {
return k.toUpperCase();
});
// Coerce string value into JS value
let val = process.env[key];
if (/^(yes|on|true|enabled)$/i.test(val)) {
val = true;
} else if (/^(no|off|false|disabled)$/i.test(val)) {
val = false;
} else if (val === 'null') {
val = null;
} else {
val = Number(val);
}
obj[prop] = val;
return obj;
}, {});
/**
* Is stdout a TTY? Colored output is enabled when `true`.
*/
function useColors() {
return 'colors' in exports.inspectOpts ?
Boolean(exports.inspectOpts.colors) :
tty.isatty(process.stderr.fd);
}
/**
* Adds ANSI color escape codes if enabled.
*
* @api public
*/
function formatArgs(args) {
const {namespace: name, useColors} = this;
if (useColors) {
const c = this.color;
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
} else {
args[0] = getDate() + name + ' ' + args[0];
}
}
function getDate() {
if (exports.inspectOpts.hideDate) {
return '';
}
return new Date().toISOString() + ' ';
}
/**
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
*/
function log(...args) {
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
}
/**
* Save `namespaces`.
*
* @param {String} namespaces
* @api private
*/
function save(namespaces) {
if (namespaces) {
process.env.DEBUG = namespaces;
} else {
// If you set a process.env field to null or undefined, it gets cast to the
// string 'null' or 'undefined'. Just delete instead.
delete process.env.DEBUG;
}
}
/**
* Load `namespaces`.
*
* @return {String} returns the previously persisted debug modes
* @api private
*/
function load() {
return process.env.DEBUG;
}
/**
* Init logic for `debug` instances.
*
* Create a new `inspectOpts` object in case `useColors` is set
* differently for a particular `debug` instance.
*/
function init(debug) {
debug.inspectOpts = {};
const keys = Object.keys(exports.inspectOpts);
for (let i = 0; i < keys.length; i++) {
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
}
}
module.exports = require('./common')(exports);
const {formatters} = module.exports;
/**
* Map %o to `util.inspect()`, all on a single line.
*/
formatters.o = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts)
.split('\n')
.map(str => str.trim())
.join(' ');
};
/**
* Map %O to `util.inspect()`, allowing multiple lines if needed.
*/
formatters.O = function (v) {
this.inspectOpts.colors = this.useColors;
return util.inspect(v, this.inspectOpts);
};

22
uniapp04/node_modules/engine.io-client/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2014-present Guillermo Rauch and Socket.IO contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

331
uniapp04/node_modules/engine.io-client/README.md generated vendored Normal file
View File

@ -0,0 +1,331 @@
# Engine.IO client
[![Build Status](https://github.com/socketio/engine.io-client/workflows/CI/badge.svg?branch=main)](https://github.com/socketio/engine.io-client/actions)
[![NPM version](https://badge.fury.io/js/engine.io-client.svg)](http://badge.fury.io/js/engine.io-client)
This is the client for [Engine.IO](http://github.com/socketio/engine.io),
the implementation of transport-based cross-browser/cross-device
bi-directional communication layer for [Socket.IO](http://github.com/socketio/socket.io).
## How to use
### Standalone
You can find an `engine.io.js` file in this repository, which is a
standalone build you can use as follows:
```html
<script src="/path/to/engine.io.js"></script>
<script>
// eio = Socket
const socket = eio('ws://localhost');
socket.on('open', () => {
socket.on('message', (data) => {});
socket.on('close', () => {});
});
</script>
```
### With browserify
Engine.IO is a commonjs module, which means you can include it by using
`require` on the browser and package using [browserify](http://browserify.org/):
1. install the client package
```bash
$ npm install engine.io-client
```
1. write your app code
```js
const { Socket } = require('engine.io-client');
const socket = new Socket('ws://localhost');
socket.on('open', () => {
socket.on('message', (data) => {});
socket.on('close', () => {});
});
```
1. build your app bundle
```bash
$ browserify app.js > bundle.js
```
1. include on your page
```html
<script src="/path/to/bundle.js"></script>
```
### Sending and receiving binary
```html
<script src="/path/to/engine.io.js"></script>
<script>
const socket = eio('ws://localhost/');
socket.binaryType = 'blob';
socket.on('open', () => {
socket.send(new Int8Array(5));
socket.on('message', (blob) => {});
socket.on('close', () => {});
});
</script>
```
### Node.JS
Add `engine.io-client` to your `package.json` and then:
```js
const { Socket } = require('engine.io-client');
const socket = new Socket('ws://localhost');
socket.on('open', () => {
socket.on('message', (data) => {});
socket.on('close', () => {});
});
```
### Node.js with certificates
```js
const opts = {
key: fs.readFileSync('test/fixtures/client.key'),
cert: fs.readFileSync('test/fixtures/client.crt'),
ca: fs.readFileSync('test/fixtures/ca.crt')
};
const { Socket } = require('engine.io-client');
const socket = new Socket('ws://localhost', opts);
socket.on('open', () => {
socket.on('message', (data) => {});
socket.on('close', () => {});
});
```
### Node.js with extraHeaders
```js
const opts = {
extraHeaders: {
'X-Custom-Header-For-My-Project': 'my-secret-access-token',
'Cookie': 'user_session=NI2JlCKF90aE0sJZD9ZzujtdsUqNYSBYxzlTsvdSUe35ZzdtVRGqYFr0kdGxbfc5gUOkR9RGp20GVKza; path=/; expires=Tue, 07-Apr-2015 18:18:08 GMT; secure; HttpOnly'
}
};
const { Socket } = require('engine.io-client');
const socket = new Socket('ws://localhost', opts);
socket.on('open', () => {
socket.on('message', (data) => {});
socket.on('close', () => {});
});
```
In the browser, the [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) object does not support additional headers.
In case you want to add some headers as part of some authentication mechanism, you can use the `transportOptions` attribute.
Please note that in this case the headers won't be sent in the WebSocket upgrade request.
```js
// WILL NOT WORK in the browser
const socket = new Socket('http://localhost', {
extraHeaders: {
'X-Custom-Header-For-My-Project': 'will not be sent'
}
});
// WILL NOT WORK
const socket = new Socket('http://localhost', {
transports: ['websocket'], // polling is disabled
transportOptions: {
polling: {
extraHeaders: {
'X-Custom-Header-For-My-Project': 'will not be sent'
}
}
}
});
// WILL WORK
const socket = new Socket('http://localhost', {
transports: ['polling', 'websocket'],
transportOptions: {
polling: {
extraHeaders: {
'X-Custom-Header-For-My-Project': 'will be used'
}
}
}
});
```
## Features
- Lightweight
- Runs on browser and node.js seamlessly
- Transports are independent of `Engine`
- Easy to debug
- Easy to unit test
- Runs inside HTML5 WebWorker
- Can send and receive binary data
- Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer
in Node
- When XHR2 or WebSockets are used, binary is emitted directly. Otherwise
binary is encoded into base64 strings, and decoded when binary types are
supported.
- With browsers that don't support ArrayBuffer, an object { base64: true,
data: dataAsBase64String } is emitted on the `message` event.
## API
### Socket
The client class. Mixes in [Emitter](http://github.com/component/emitter).
Exposed as `eio` in the browser standalone build.
#### Properties
- `protocol` _(Number)_: protocol revision number
- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers,
and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's
supported.
#### Events
- `open`
- Fired upon successful connection.
- `message`
- Fired when data is received from the server.
- **Arguments**
- `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing
binary data
- `close`
- Fired upon disconnection. In compliance with the WebSocket API spec, this event may be
fired even if the `open` event does not occur (i.e. due to connection error or `close()`).
- `error`
- Fired when an error occurs.
- `flush`
- Fired upon completing a buffer flush
- `drain`
- Fired after `drain` event of transport if writeBuffer is empty
- `upgradeError`
- Fired if an error occurs with a transport we're trying to upgrade to.
- `upgrade`
- Fired upon upgrade success, after the new transport is set
- `ping`
- Fired upon receiving a ping packet.
- `pong`
- Fired upon _flushing_ a pong packet (ie: actual packet write out)
#### Methods
- **constructor**
- Initializes the client
- **Parameters**
- `String` uri
- `Object`: optional, options object
- **Options**
- `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only)
- `upgrade` (`Boolean`): defaults to true, whether the client should try
to upgrade the transport from long-polling to something better.
- `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary.
- `withCredentials` (`Boolean`): defaults to `false`, whether to include credentials (cookies, authorization headers, TLS client certificates, etc.) with cross-origin XHR polling requests.
- `timestampRequests` (`Boolean`): whether to add the timestamp with each
transport request. Note: polling requests are always stamped unless this
option is explicitly set to `false` (`false`)
- `timestampParam` (`String`): timestamp parameter (`t`)
- `path` (`String`): path to connect to, default is `/engine.io`
- `transports` (`Array`): a list of transports to try (in order).
Defaults to `['polling', 'websocket', 'webtransport']`. `Engine`
always attempts to connect directly with the first one, provided the
feature detection test for it passes.
- `transportOptions` (`Object`): hash of options, indexed by transport name, overriding the common options for the given transport
- `rememberUpgrade` (`Boolean`): defaults to false.
If true and if the previous websocket connection to the server succeeded,
the connection attempt will bypass the normal upgrade process and will initially
try websocket. A connection attempt following a transport error will use the
normal upgrade process. It is recommended you turn this on only when using
SSL/TLS connections, or if you know that your network does not block websockets.
- `pfx` (`String`|`Buffer`): Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information.
- `key` (`String`): Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information.
- `passphrase` (`String`): A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information.
- `cert` (`String`): Public x509 certificate to use. Can be used in Node.js client environment to manually specify certificate information.
- `ca` (`String`|`Array`): An authority certificate or array of authority certificates to check the remote host against.. Can be used in Node.js client environment to manually specify certificate information.
- `ciphers` (`String`): A string describing the ciphers to use or exclude. Consult the [cipher format list](http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT) for details on the format. Can be used in Node.js client environment to manually specify certificate information.
- `rejectUnauthorized` (`Boolean`): If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Can be used in Node.js client environment to manually specify certificate information.
- `perMessageDeflate` (`Object|Boolean`): parameters of the WebSocket permessage-deflate extension
(see [ws module](https://github.com/einaros/ws) api docs). Set to `false` to disable. (`true`)
- `threshold` (`Number`): data is compressed only if the byte size is above this value. This option is ignored on the browser. (`1024`)
- `extraHeaders` (`Object`): Headers that will be passed for each request to the server (via xhr-polling and via websockets). These values then can be used during handshake or for special proxies. Can only be used in Node.js client environment.
- `localAddress` (`String`): the local IP address to connect to
- `autoUnref` (`Boolean`): whether the transport should be `unref`'d upon creation. This calls `unref` on the underlying timers and sockets so that the program is allowed to exit if they are the only timers/sockets in the event system (Node.js only)
- `useNativeTimers` (`Boolean`): Whether to always use the native timeouts. This allows the client to reconnect when the native timeout functions are overridden, such as when mock clocks are installed with [`@sinonjs/fake-timers`](https://github.com/sinonjs/fake-timers).
- **Polling-only options**
- `requestTimeout` (`Number`): Timeout for xhr-polling requests in milliseconds (`0`)
- **Websocket-only options**
- `protocols` (`Array`): a list of subprotocols (see [MDN reference](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#Subprotocols))
- `closeOnBeforeunload` (`Boolean`): whether to silently close the connection when the [`beforeunload`](https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event) event is emitted in the browser (defaults to `false`)
- `send`
- Sends a message to the server
- **Parameters**
- `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send
- `Object`: optional, options object
- `Function`: optional, callback upon `drain`
- **Options**
- `compress` (`Boolean`): whether to compress sending data. This option is ignored and forced to be `true` on the browser. (`true`)
- `close`
- Disconnects the client.
### Transport
The transport class. Private. _Inherits from EventEmitter_.
#### Events
- `poll`: emitted by polling transports upon starting a new request
- `pollComplete`: emitted by polling transports upon completing a request
- `drain`: emitted by polling transports upon a buffer drain
## Tests
`engine.io-client` is used to test
[engine](http://github.com/socketio/engine.io). Running the `engine.io`
test suite ensures the client works and vice-versa.
Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can
run the tests locally using the following command.
```
./node_modules/.bin/zuul --local 8080 -- test/index.js
```
Additionally, `engine.io-client` has a standalone test suite you can run
with `make test` which will run node.js and browser tests. You must have zuul setup with
a saucelabs account.
## Support
The support channels for `engine.io-client` are the same as `socket.io`:
- irc.freenode.net **#socket.io**
- [Google Groups](http://groups.google.com/group/socket_io)
- [Website](http://socket.io)
## Development
To contribute patches, run tests or benchmarks, make sure to clone the
repository:
```bash
git clone git://github.com/socketio/engine.io-client.git
```
Then:
```bash
cd engine.io-client
npm install
```
See the `Tests` section above for how to run tests before submitting any patches.
## License
MIT - Copyright (c) 2014 Automattic, Inc.

View File

@ -0,0 +1,3 @@
import { Socket } from "./socket.js";
declare const _default: (uri: any, opts: any) => Socket;
export default _default;

View File

@ -0,0 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const socket_js_1 = require("./socket.js");
exports.default = (uri, opts) => new socket_js_1.Socket(uri, opts);

View File

@ -0,0 +1 @@
export declare const hasCORS: boolean;

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasCORS = void 0;
// imported from https://github.com/component/has-cors
let value = false;
try {
value = typeof XMLHttpRequest !== 'undefined' &&
'withCredentials' in new XMLHttpRequest();
}
catch (err) {
// if XMLHttp support is disabled in IE then it will throw
// when trying to create
}
exports.hasCORS = value;

View File

@ -0,0 +1,15 @@
/**
* Compiles a querystring
* Returns string representation of the object
*
* @param {Object}
* @api private
*/
export declare function encode(obj: any): string;
/**
* Parses a simple querystring into an object
*
* @param {String} qs
* @api private
*/
export declare function decode(qs: any): {};

View File

@ -0,0 +1,38 @@
"use strict";
// imported from https://github.com/galkn/querystring
/**
* Compiles a querystring
* Returns string representation of the object
*
* @param {Object}
* @api private
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.encode = encode;
exports.decode = decode;
function encode(obj) {
let str = '';
for (let i in obj) {
if (obj.hasOwnProperty(i)) {
if (str.length)
str += '&';
str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
}
}
return str;
}
/**
* Parses a simple querystring into an object
*
* @param {String} qs
* @api private
*/
function decode(qs) {
let qry = {};
let pairs = qs.split('&');
for (let i = 0, l = pairs.length; i < l; i++) {
let pair = pairs[i].split('=');
qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
}
return qry;
}

View File

@ -0,0 +1 @@
export declare function parse(str: string): any;

View File

@ -0,0 +1,67 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = parse;
// imported from https://github.com/galkn/parseuri
/**
* Parses a URI
*
* Note: we could also have used the built-in URL object, but it isn't supported on all platforms.
*
* See:
* - https://developer.mozilla.org/en-US/docs/Web/API/URL
* - https://caniuse.com/url
* - https://www.rfc-editor.org/rfc/rfc3986#appendix-B
*
* History of the parse() method:
* - first commit: https://github.com/socketio/socket.io-client/commit/4ee1d5d94b3906a9c052b459f1a818b15f38f91c
* - export into its own module: https://github.com/socketio/engine.io-client/commit/de2c561e4564efeb78f1bdb1ba39ef81b2822cb3
* - reimport: https://github.com/socketio/engine.io-client/commit/df32277c3f6d622eec5ed09f493cae3f3391d242
*
* @author Steven Levithan <stevenlevithan.com> (MIT license)
* @api private
*/
const re = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
const parts = [
'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'
];
function parse(str) {
if (str.length > 8000) {
throw "URI too long";
}
const src = str, b = str.indexOf('['), e = str.indexOf(']');
if (b != -1 && e != -1) {
str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
}
let m = re.exec(str || ''), uri = {}, i = 14;
while (i--) {
uri[parts[i]] = m[i] || '';
}
if (b != -1 && e != -1) {
uri.source = src;
uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
uri.ipv6uri = true;
}
uri.pathNames = pathNames(uri, uri['path']);
uri.queryKey = queryKey(uri, uri['query']);
return uri;
}
function pathNames(obj, path) {
const regx = /\/{2,9}/g, names = path.replace(regx, "/").split("/");
if (path.slice(0, 1) == '/' || path.length === 0) {
names.splice(0, 1);
}
if (path.slice(-1) == '/') {
names.splice(names.length - 1, 1);
}
return names;
}
function queryKey(uri, query) {
const data = {};
query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {
if ($1) {
data[$1] = $2;
}
});
return data;
}

View File

@ -0,0 +1,4 @@
export declare const nextTick: (cb: any, setTimeoutFn: any) => any;
export declare const globalThisShim: any;
export declare const defaultBinaryType = "arraybuffer";
export declare function createCookieJar(): void;

View File

@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultBinaryType = exports.globalThisShim = exports.nextTick = void 0;
exports.createCookieJar = createCookieJar;
exports.nextTick = (() => {
const isPromiseAvailable = typeof Promise === "function" && typeof Promise.resolve === "function";
if (isPromiseAvailable) {
return (cb) => Promise.resolve().then(cb);
}
else {
return (cb, setTimeoutFn) => setTimeoutFn(cb, 0);
}
})();
exports.globalThisShim = (() => {
if (typeof self !== "undefined") {
return self;
}
else if (typeof window !== "undefined") {
return window;
}
else {
return Function("return this")();
}
})();
exports.defaultBinaryType = "arraybuffer";
function createCookieJar() { }

View File

@ -0,0 +1,21 @@
export declare const nextTick: (callback: Function, ...args: any[]) => void;
export declare const globalThisShim: typeof globalThis;
export declare const defaultBinaryType = "nodebuffer";
export declare function createCookieJar(): CookieJar;
interface Cookie {
name: string;
value: string;
expires?: Date;
}
/**
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie
*/
export declare function parse(setCookieString: string): Cookie;
export declare class CookieJar {
private _cookies;
parseCookies(values: string[]): void;
get cookies(): IterableIterator<[string, Cookie]>;
addCookies(xhr: any): void;
appendCookies(headers: Headers): void;
}
export {};

Some files were not shown because too many files have changed in this diff Show More