Commit 03ba3a08 authored by wildfirecode's avatar wildfirecode

1

parent 5d4ed155
declare namespace SvgaPlayer{
export enum Event {
/**
* 每帧的监听
*/
ENTER_FRAME = "onEnterFrame",
/**
* 最后一帧的监听
*/
END_FRAME = "onEndFrame"
}
export class EventDispatcher {
protected eventTypes: any;
constructor();
addEventListener(type: string, listener: Function, context?: any): this;
/**
* 监听一次
* @param type
* @param listener
* @param context
* @param useCapture
*/
once(type: string, listener: Function, context?: any): this;
dispatchEvent(event: string, data?: any): boolean;
/**
* 移除对应类型的侦听
* @method removeEventListener
* @public
* @since 1.0.0
* @param {string} type 要移除的侦听类型
* @param {Function} listener 及侦听时绑定的回调方法
* @param context listener和context都相等的才移除,默认自身
*/
removeEventListener(type: string, listener: Function, context?: any): this;
/**
* 移除对象中所有的侦听
* @method removeAllEventListener
* @public
* @since 1.0.0
*/
removeAllEventListener(): void;
hasEventListener(type: string): boolean;
destroy(): void;
}
export class MovieClip extends EventDispatcher {
private transform;
private dirty;
x: number;
y: number;
scaleX: number;
scaleY: number;
/**
* 角度制
*/
rotation: number;
anchorX: number;
anchorY: number;
/**
* 锁步将按时间间隔来执行动画
*/
lockStep: boolean;
/**
* mc的当前帧,从1开始
* @property currentFrame
* @public
* @since 1.0.0
* @type {number}
* @default 1
* @readonly
*/
readonly currentFrame: number;
/**
* @property _curFrame
* @type {number}
* @private
* @since 2.0.0
* @default 1
*/
private _curFrame;
/**
* 当前动画是否处于播放状态
* @property isPlaying
* @readOnly
* @public
* @since 1.0.0
* @type {boolean}
* @default true
* @readonly
*/
readonly isPlaying: boolean;
/**
* @property _isPlaying
* @type {boolean}
* @private
* @since 2.0.0
* @default true
*/
private _isPlaying;
/**
* 动画的播放方向,是顺着播还是在倒着播
* @property isFront
* @public
* @since 1.0.0
* @type {boolean}
* @default true
* @readonly
*/
readonly isFront: boolean;
/**
* @property _isFront
* @type {boolean}
* @private
* @default true
*/
private _isFront;
/**
* 当前动画的总帧数
* @property totalFrames
* @public
* @since 1.0.0
* @type {number}
* @default 1
* @readonly
*/
readonly totalFrames: number;
readonly videoWidth: number;
readonly videoHeight: number;
/**
* 锁步的时间间隔,按fps定,毫秒
*/
private timeInterval;
/**
* 前提引擎按60设置
*/
private deltaFrame;
/**
* 中间帧计时
*/
private frameCount;
/**
* 动画数据
*/
videoItem: SvgaParser.VideoEntity;
/**
* 构造函数
* @method MovieClip
* @public
* @param mv VideoEntity格式,这里不给了
*/
constructor(mv: SvgaParser.VideoEntity);
/**
* 可以手动用init,
* @param mv
*/
init(mv: SvgaParser.VideoEntity): void;
/**
* 调用止方法将停止当前帧
* @method stop
* @public
* @since 1.0.0
*/
stop(): void;
/**
* 将播放头向后移一帧并停在下一帧,如果本身在最后一帧则不做任何反应
* @method nextFrame
* @since 1.0.0
* @public
*/
nextFrame(): void;
/**
* 将播放头向前移一帧并停在下一帧,如果本身在第一帧则不做任何反应
* @method prevFrame
* @since 1.0.0
* @public
*/
prevFrame(): void;
/**
* 将播放头跳转到指定帧并停在那一帧,如果本身在第一帧则不做任何反应
* @method gotoAndStop
* @public
* @since 1.0.0
* @param {number} frameIndex 批定帧的帧数或指定帧的标签名
*/
gotoAndStop(frameIndex: number): void;
/**
* 如果当前时间轴停在某一帧,调用此方法将继续播放.
* @method play
* @public
* @since 1.0.0
*/
play(isFront?: boolean): void;
/**
* @property _lastFrame
* @type {number}
* @private
* @default 0
*/
private _lastFrame;
/**
* 刚执行到的帧数,用于帧监听时判断用,刚好执行到当前帧,而不是之前保留的状态
* 不是60fps的videoItem的中间有几帧curFrame会不变,判断只执行一次监听时会出错,刚好动画满帧60fps时就无所谓
*/
readonly isInTimeFrame: boolean;
/**
* 将播放头跳转到指定帧并从那一帧开始继续播放
* @method gotoAndPlay
* @public
* @since 1.0.0
* @param {number} frameIndex 批定帧的帧数或指定帧的标签名
* @param {boolean} isFront 跳到指定帧后是向前播放, 还是向后播放.不设置些参数将默认向前播放
*/
gotoAndPlay(frameIndex: number, isFront?: boolean): void;
/**
* 记录的startAniRange对应的fun
*/
private startAniRangeFun;
/**
* 优先级最高,会覆盖
* @param beginFrame 默认1
* @param endFrame 默认 this.totalFrames
* @param loops 默认1 0
*/
startAniRange(beginFrame?: number, endFrame?: number, loops?: number, callback?: Function): void;
/**
* 开始时间,每次有play的时候就需要重置now
* 锁步思想,设置开始时间,后面每帧实际时间与开始时间相减,得到当前帧数
*
*/
private startTime;
/**
* 开始时的frame
*/
private startFrame;
/**
* 与startFrame相间隔的帧数量,绝对值
*/
private lastDeltaFrame;
/**
* 锁步时的每次end的标识
*/
private _endMark;
commonDeltaTime: number;
updateFrame(): void;
private getCurFrameWhenLockStep;
/**
* 修改自身位置
*/
updateTransform(): void;
destroy(): void;
}
export const _bitmapCache: {};
export class SvgaStage extends EventDispatcher {
/**
* 用于 requestAnimationFrame,cancelAnimationFrame ,createImage
*/
private canvas;
private context;
private children;
resolution: number;
/**
*
* @param canvas 渲染的canvas
* @param resolution canvas和显示对象的尺寸比例
*/
constructor(canvas: any, resolution?: number);
addChild(mv: MovieClip): MovieClip;
addChildAt(mv: MovieClip, index?: number): MovieClip;
removeChild(mv: MovieClip): MovieClip;
removeChildAt(index: number): any;
removeAllChildren(): MovieClip[];
/**
* 将所有MovieClip画到canvas上
*/
render(): void;
private drawSprite;
flush(): void;
}
export const loadSvga: typeof SvgaParser.loadSvga;}
declare module "svga-player" {export = SvgaPlayer;}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
# SvgaParser
1.0.2版本支持web版本解析,包体小,web应用尽量用这个
1.1.0及以后版本同时支持web和微信小程序及淘宝小程序解析
(淘宝小程序使用,链接必须使用阿里系的白名单域名,或者云存储cloud://链接)
其他版本都是坏的
单纯将svga文件解析成动画图片及动画数据。
### 网页使用
```html
<script type="text/javascript" src="../build/svgaParser.min.js"></script>
<script>
SvgaParser.loadSvga("./svga/step1-1.svga", (v) => {
console.log(v)
}, (err) => { console.log(err) })
</script>
```
### npm使用
```js
npm install svga-parser
import { loadSvga } from "svga-parser";
loadSvga("./svga/step1-1.svga", (v) => {
console.log(v)
}, (err) => { console.log(err) })
```
declare module SvgaParser {
/**
* 加载方法
* @param url 资源路径
* @param success
* @param failure
*/
export function loadSvga(url: string, success: (videoItem: VideoEntity) => void, failure: (err: string) => void): void;
/**
* 导出只是当作类型接口用
*/
export interface VideoEntity {
/**
* SVGA 文件版本
*/
version: string;
/**
* 影片尺寸
*/
videoSize: {
width: number;
height: number;
};
/**
* 帧率,60,30等每秒
*/
FPS: number;
/**
* 总帧数
*/
frames: number;
/**
* base64图片数据记录
*/
images: {
[key: string]: string
};
/**
* 图片是否已被缓存,缓存全局,注意名字覆盖
*/
hasBeenCached: boolean;
/**
* sprite对象数据
*/
sprites: SpriteEntity[];
}
interface SpriteEntity {
/**
* 标识
*/
matteKey: string;
/**
* 图片key值
*/
imageKey: string;
/**
* 帧数据数组
*/
frames: FrameEntity[];
}
/**
* 还有很多其他数据,暂不需要,比如矢量路径和遮罩路径暂时都无
*/
interface FrameEntity {
/**
* 透明度
*/
alpha: number;
/**
* 2维矩阵数据
*/
transform: {
a: number,
b: number,
c: number,
d: number,
tx: number,
ty: number,
};
}
}
declare module "svga-parser" { export = SvgaParser; }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"_from": "svga-parser@^1.1.0",
"_id": "svga-parser@1.1.0",
"_inBundle": false,
"_integrity": "sha512-OjjtzPGC1ZdCWSWvldhXcB0CAz4ZOeoWEp0P9l4Lz7UtLM9f+DAYAYXKCXBWnRZvJevgkY/gniO/Bt89X0cKKw==",
"_location": "/@mrkwon/svga-player/svga-parser",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "svga-parser@^1.1.0",
"name": "svga-parser",
"escapedName": "svga-parser",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/@mrkwon/svga-player"
],
"_resolved": "https://registry.npmjs.org/svga-parser/-/svga-parser-1.1.0.tgz",
"_shasum": "b17815ac0c1a0e01a86c91bb97f834dad60275e9",
"_spec": "svga-parser@^1.1.0",
"_where": "D:\\duibaGame\\测试项目0527\\taobaominiTest\\client\\node_modules\\@mrkwon\\svga-player",
"author": {
"name": "MrKwon"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "1.0.2版本支持web版本解析,包体小,web应用尽量用这个",
"devDependencies": {
"eval5": "^1.4.5",
"protobufjs": "^6.8.0",
"ts-loader": "^4.0.0",
"typescript": "^2.7.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.3.2"
},
"keywords": [
"svga"
],
"license": "ISC",
"main": "build/svgaParser.min.js",
"name": "svga-parser",
"scripts": {
"build": "webpack",
"dev": "webpack -w",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
},
"types": "build/SvgaParser.d.ts",
"version": "1.1.0"
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="full-screen" content="true" />
<meta name="screen-orientation" content="portrait" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<!-- <meta name="viewport" content="width=device-width,minimum-scale=1.0,user-scalable=no"> -->
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: white;
}
/* .top {
width: 100%;
height: 100px;
} */
</style>
</head>
<body>
<script type="text/javascript" src="../build/svgaParser.min.js"></script>
<script>
SvgaParser.loadSvga("./svga/step1-1.svga", (v) => {
console.log(v)
}, (err) => { console.log(err) })
</script>
</body>
</html>
\ No newline at end of file
{
"_from": "@mrkwon/svga-player",
"_id": "@mrkwon/svga-player@1.0.0",
"_inBundle": false,
"_integrity": "sha512-CpeV+rP/Xa91CzHEv9WEyu+lXiyWOhLyas8OHYVE0BMGxpzsd39VCOZpXFMHfrw9324VrTvBdXmZnUfbmhYHLQ==",
"_location": "/@mrkwon/svga-player",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "@mrkwon/svga-player",
"name": "@mrkwon/svga-player",
"escapedName": "@mrkwon%2fsvga-player",
"scope": "@mrkwon",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/@mrkwon/svga-player/-/svga-player-1.0.0.tgz",
"_shasum": "19cd96b3119893ad3af1b83bb0f32e682f97aa30",
"_spec": "@mrkwon/svga-player",
"_where": "D:\\duibaGame\\测试项目0527\\taobaominiTest\\client",
"author": {
"name": "MrKwon"
},
"bundleDependencies": false,
"dependencies": {
"svga-parser": "^1.1.0"
},
"deprecated": false,
"description": "",
"devDependencies": {
"ts-loader": "^4.0.0",
"typescript": "^2.7.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.3.2"
},
"keywords": [
"svga",
"player",
"canvas"
],
"license": "ISC",
"main": "build/svgaPlayer.min.js",
"name": "@mrkwon/svga-player",
"scripts": {
"build": "webpack",
"declare": "node scripts/declare.js src/index.ts",
"dev": "webpack -w",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
},
"types": "build/SvgaPlayer.d.ts",
"version": "1.0.0"
}
/**
* 淘宝小程序使用
*/
import { loadSvga, SvgaStage, MovieClip } from "svga-player"
Page({
onCanvasReady() {
this.canvas = my.createCanvas({
id: 'canvas',
success: (canvas) => {
var systemInfo = my.getSystemInfoSync();
//适配尺寸
canvas.width = 750 * systemInfo.pixelRatio;
canvas.height = 500 * systemInfo.pixelRatio;
//创建一个动画容器,一个canvas
var svgaStage = new SvgaStage(canvas);
//加载动画数据
loadSvga("./angel.svga", function (videoItem) {
//实例化动画
var mv = new MovieClip(videoItem);
//添加进动画容器
svgaStage.addChild(mv)
//可设置canvas的尺寸,尽量自行适配,canva实际尺寸和canvas的style尺寸
canvas.width = mv.videoWidth;
canvas.height = mv.videoHeight;
//一些api的方法
mv.stop();
setTimeout(() => {
mv.gotoAndPlay(1, false)
}, 200)
setTimeout(() => {
mv.startAniRange(1, mv.totalFrames / 2, 2, () => {
console.log(112)
})
}, 2000)
}, function (error) {
alert(error);
})
//再加一个
loadSvga("./step1-1.svga", function (videoItem) {
var mv = new MovieClip(videoItem);
svgaStage.addChild(mv)
}, function (error) {
alert(error);
})
}
});
}
})
\ No newline at end of file
<html>
<body style="text-align: center">
<div>
<!-- <div id="testCanvas" style="background-color: #000000; width: 500px; height: 500px; margin: auto"></div> -->
<canvas id="testCanvas" width="500" height="500" style="background-color: #000000; "></canvas>
</div>
<script src="../build/svgaPlayer.min.js"></script>
<script>
window.onload = function () {
var canvas = document.getElementById("testCanvas");
//创建一个动画容器,一个canvas
var svgaStage = new SvgaPlayer.SvgaStage(canvas)
//加载动画数据
SvgaPlayer.loadSvga("./angel.svga", function (videoItem) {
//实例化动画
var mv = new SvgaPlayer.MovieClip(videoItem);
//添加进动画容器
svgaStage.addChild(mv)
//可设置canvas的尺寸,尽量自行适配,canva实际尺寸和canvas的style尺寸
canvas.width = mv.videoWidth;
canvas.height = mv.videoHeight;
//一些api的方法
mv.stop();
setTimeout(() => {
mv.gotoAndPlay(1, false)
}, 200)
setTimeout(() => {
mv.startAniRange(1, mv.totalFrames / 2, 2, () => {
console.log(112)
})
}, 2000)
// mv.rotation = 45
// mv.x= 100
// mv.scaleX=1.5
// mv.y= 200
mv.anchorX= 750/2;
mv.anchorY= 750/2;
setInterval(()=>{
mv.rotation+=1
},16.7)
}, function (error) {
alert(error.message);
})
//再加一个
SvgaPlayer.loadSvga("./step1-1.svga", function (videoItem) {
var mv = new SvgaPlayer.MovieClip(videoItem);
svgaStage.addChild(mv)
}, function (error) {
alert(error);
})
}
</script>
</body>
</html>
\ No newline at end of file
# lottie
lottie 动画库适配小程序的版本。
> lottie 的相关介绍与动画生成方法等请参考 [官方说明](https://github.com/airbnb/lottie-web)
> 依赖手淘版本 >= 9.7.0 的环境
## 使用
可参考该[代码片段](https://gw.alicdn.com/bao/uploaded/TB1In6gDxD1gK0jSZFsXXbldVXa.zip?spm=a1z3i.a4.0.0.cf98eb1dV4rJNg&file=TB1In6gDxD1gK0jSZFsXXbldVXa.zip),大致步骤如下:<br />
1. 通过 npm 安装:
```
npm install --save @tbminiapp/lottie-miniapp
```
2. 传入 canvas 对象用于适配
```
<canvas id="canvas" width="610" height="610" class="canvas" type="webgl" />
```
```javascript
import lottie from "@tbminiapp/lottie-miniapp";
import animationData from "../../json/catrim";
Page({
onReady() {},
init() {
this.canvas = my._createCanvas({
id: "canvas",
success: (canvas) => {
this.canvas = canvas;
console.log("canvas=====", canvas);
lottie.setup(canvas);
this.ani = lottie.loadAnimation({
loop: true,
autoplay: true,
// path:'https://gw.alipayobjects.com/os/lottie-asset/coupon-tip/data.json/data-80154.json',
animationData,
rendererSettings: {
context: canvas.getContext("2d"),
},
});
},
});
},
play() {
this.ani.play();
},
pause() {
this.ani.pause();
},
});
```
3. 使用 lottie 接口
```
lottie.setup(canvas)
lottie.loadAnimation({
...
})
```
## 接口
目前提供两个接口:<br />**lottie.setup(canvas)**<br />需要在任何 lottie 接口调用之前调用,传入 canvas 对象<br />**lottie.loadAnimation(options)**<br />与原来的 [loadAnimation](https://github.com/airbnb/lottie-web/wiki/loadAnimation-options) 有些不同,支持的参数有:
- loop
- autoplay
- animationData
- path (只支持网络地址)
- rendererSettings.context (必填)
## 说明
- 本项目是以 npm 的方式依赖原 lottie-web 项目,若原项目有新版本,可直接改变依赖的版本号。
- 本项目依赖手淘  9.7.0 里性能更好的 canvas 实现,由于还有些小问题没有正式开放,但目前用在此处暂无发现问题。
- 由于小程序本身不支持动态执行脚本,因此 lottie 的 expression 功能也是不支持的。
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"_from": "@tbminiapp/lottie-miniapp",
"_id": "@tbminiapp/lottie-miniapp@0.0.3",
"_inBundle": false,
"_integrity": "sha512-fwkXfLviTdf1aSFp4q1drNRcPv4lx9FBGZ4Gy5qclhBfut146GhLDFERIPOmUWOhwtTfyTCbazYKzMBL4aiGWw==",
"_location": "/@tbminiapp/lottie-miniapp",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "@tbminiapp/lottie-miniapp",
"name": "@tbminiapp/lottie-miniapp",
"escapedName": "@tbminiapp%2flottie-miniapp",
"scope": "@tbminiapp",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/@tbminiapp/lottie-miniapp/-/lottie-miniapp-0.0.3.tgz",
"_shasum": "9a569ac8fa71c566bed80846dcd9d1192b33f6fb",
"_spec": "@tbminiapp/lottie-miniapp",
"_where": "D:\\淘宝小程序\\浏览器开发兼容\\client",
"bundleDependencies": false,
"deprecated": false,
"description": "lottie for miniprogram",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"eslint": "^6.1.0",
"eslint-loader": "^2.2.1",
"lottie-web": "5.5.7",
"string-replace-loader": "^2.2.0",
"webpack": "^4.39.1",
"webpack-cli": "^3.3.6"
},
"files": [
"miniprogram_dist"
],
"keywords": [
"lottie",
"miniprogram"
],
"license": "MIT",
"main": "miniprogram_dist/index.js",
"miniprogram": "miniprogram_dist",
"name": "@tbminiapp/lottie-miniapp",
"scripts": {
"build": "webpack --mode=production",
"dev": "webpack --mode=development",
"lint": "eslint \"src/**/*.js\""
},
"version": "0.0.3"
}
This diff is collapsed.
{
"_from": "@tbmp/mp-cloud-sdk@*",
"_id": "@tbmp/mp-cloud-sdk@1.3.8",
"_inBundle": false,
"_integrity": "sha512-oEO3/scR66LhUwEdrm9JABi2DIUgbblVc4TyiA2PkLd1TY+nj2o7zKY80qZxnsRqMiFvOjBidp4ANlt3I16+/A==",
"_location": "/@tbmp/mp-cloud-sdk",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@tbmp/mp-cloud-sdk@*",
"name": "@tbmp/mp-cloud-sdk",
"escapedName": "@tbmp%2fmp-cloud-sdk",
"scope": "@tbmp",
"rawSpec": "*",
"saveSpec": null,
"fetchSpec": "*"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/@tbmp/mp-cloud-sdk/-/mp-cloud-sdk-1.3.8.tgz",
"_shasum": "f4aecf78ba5cf7d37690d26adec45fcbdaa1785d",
"_spec": "@tbmp/mp-cloud-sdk@*",
"_where": "D:\\duibaGame\\测试项目0527\\taobaominiTest\\client",
"author": "",
"bundleDependencies": false,
"deprecated": false,
"description": "",
"gitHead": "e3a5de54cabae149d2d58ead97f8c68d56b59f55",
"license": "ISC",
"main": "index.js",
"name": "@tbmp/mp-cloud-sdk",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"types": "./types/platforms/mp/index.d.ts",
"version": "1.3.8"
}
import { Db } from "./db";
export interface IFindOptions {
/**
* 查询的文档数量限制
*/
limit?: number;
/**
* 跳过的文档数量
*/
skip?: number;
/**
* 排序规则
*/
sort?: object;
/**
* 查询后过滤的字段
*/
projection?: object;
}
export declare class CollectionReference {
/**
* 初始化
*
* @internal
*
* @param db - 数据库的引用
* @param coll - 集合名称
*/
private _db;
private _coll;
constructor(db: Db, coll: string);
/**
* 读取集合名字
*/
readonly name: string;
/**
* 对集合执行聚合查询
* @param pipeline 聚合查询对象
*/
aggregate(pipeline: object | object[]): Promise<any>;
/**
* 获取集合中复合条件的记录数量
* @param filter 过滤条件
*/
count(filter: object): Promise<any>;
/**
* 删除集合中的一批记录
* @param filter 过滤条件
*/
deleteMany(filter: object): Promise<any>;
/**
* 查找集合中符合条件的所有记录
* @param filter 过滤条件
* @param options 查询配置项
*/
find(filter: any, options?: IFindOptions): Promise<any>;
/**
* 替换一条数据
* @param filter 过滤条件
* @param data 新数据
*/
replaceOne(filter: object, data: object): Promise<any>;
/**
* 在集合中添加一条记录
* @param data 带插入的数据
*/
insertOne(data: object): Promise<any>;
/**
* 在集合中添加一批记录
* @param data 待插入的数据,只能为数组
*/
insertMany(data: object[]): Promise<any>;
/**
*
* @param filter 过滤条件
* @param data 更新规则
*
*/
updateMany(filter: object, data: object): Promise<any>;
}
import { CollectionReference } from "./collection";
import { IAsyncInvokeOptions } from "../../shared/types";
import { ICloudService } from "../interface/cloudService";
export declare class Db extends ICloudService {
/**
* 获取集合的引用
*
* @param collName - 集合名称
*/
collection(collName: string): CollectionReference;
/**
* 创建集合
*/
createCollection(name: string, options: {
collName: string;
} & IAsyncInvokeOptions): Promise<any>;
dbRequest(action?: string, params?: any): Promise<any>;
}
import { IAsyncInvokeOptions } from '../../shared/types';
import { ICloudService } from '../interface/cloudService';
export interface ICallFunctionOptions extends IAsyncInvokeOptions {
name: string;
data: any;
}
export interface IInvokeMethod {
(IAsyncInvokeOptions: any): void;
}
export default class CloudFunction extends ICloudService {
invoke(name: string, data?: object, handler?: string): Promise<any>;
private fcRequest;
}
import { Request } from "../../shared/request";
export interface ICloudServiceOptions {
env?: 'test' | 'online' | 'pre';
}
export declare abstract class ICloudService {
options: ICloudServiceOptions;
request: Request;
constructor(options: ICloudServiceOptions, request: Request);
init?(): void;
}
import Powermsg from '@ali/lib-powermsg-sdk';
import { Env } from '../../shared/types';
export default class Client {
env: Env;
pmg: Powermsg;
deviceId: string;
initing: boolean;
queue: (() => void)[];
config: any;
constructor(env: Env);
init: () => Promise<any>;
onMessage: (callback: any) => Promise<() => void>;
private createPwgInstance;
}
import { ICloudService, ICloudServiceOptions } from "../interface/cloudService";
import Client from './client';
import Server from './server';
export default class Message extends ICloudService {
server: Server;
client: Client;
constructor(options: ICloudServiceOptions);
}
import { Request } from '../../shared/request';
import { Env } from "../../../packages/mp-cloud-node-sdk/types/shared/types";
interface IPushOptions {
subType: number;
deviceId?: string;
data: object;
pushType: string;
}
export default class Server {
env: Env;
request: Request;
constructor(env: Env, request: Request);
push(options: IPushOptions): Promise<any>;
}
export {};
import {ICloudService} from "../../interface/cloudService";
export default class Application extends ICloudService {
httpRequest(options: {path: string, params?: any, body?: any, headers?: any, method?: string, exts?: any}): Promise<any>;
}
import {ICloudService} from "../../interface/cloudService";
export default class Process extends ICloudService {
invoke(options: { api: string, data?: any, headers?: any }): Promise<any>;
private topRequest;
}
import {ICloudService} from "../../interface/cloudService";
export default class Qimen extends ICloudService {
invoke(options: { api: string, data?: any, targetAppKey?: any, headers?: any }): Promise<any>;
private topRequest;
}
import {ICloudService} from "../../interface/cloudService";
export default class Top extends ICloudService {
invoke(options: { api: string, data?: any, headers?: any, authScope?: string }): Promise<any>;
private topRequest;
}
import { IRequestOptions } from "../../../shared/request";
export default class Top {
client: any;
context: IRequestOptions;
constructor(context: IRequestOptions);
invoke(apiName: string, data?: any, httpHeaders?: any): Promise<any>;
}
import { IAsyncInvokeOptions } from "../../shared/types";
import { ICloudService } from "../interface/cloudService";
export interface IUploadFileOptions extends IAsyncInvokeOptions {
/**
* 选择到的本地文件路径
*/
filePath: string;
/**
* 文件类型, image/audio/video
*/
fileType: FileTypes;
/**
* 云存储文件名可带路径, 如a/xxx.jpg
*/
fileName?: string;
/**
* web环境上传 file对象
*/
file?: any;
}
export interface IDownloadFileOptions extends IAsyncInvokeOptions {
fileType?: FileTypes;
fileId: string;
}
export interface ITempFileURLOptions extends IAsyncInvokeOptions {
fileList: string[];
}
export declare type IDeleteFileOptions = IDownloadFileOptions;
export declare type FileTypes = "image" | "video" | "audio";
export default class CloudStorage extends ICloudService {
private parseUploadResult;
private parsePostUploadResult;
private parseAusUploadResult;
/**
* 文件上传
* 1.获取上传配置
* 2.调用my.api上传
* 3.建立存储关系
* @param options
*/
uploadFile(options: IUploadFileOptions): Promise<any>;
/**
* 删除文件
* @param options
*/
deleteFile(options: IDeleteFileOptions): Promise<boolean>;
/**
* 根据文件id(cloud://)获取授权的url
* @param options
*/
getTempFileURL(options: IAsyncInvokeOptions & {
fileType: string;
fileId: string | string[];
}): Promise<any>;
/**
* 从服务端获取文件并在本地读取
* @param options
*/
readRemoteFile(options: IAsyncInvokeOptions & {
url: string;
}): Promise<ArrayBuffer>;
/**
* 存储的请求代理, 统一sdk环境和存储环境
* @param action
* @param data
* @param requestType
*/
private storageRequest;
}
import { Cloud } from '../mp';
declare const cloudInstance: Cloud;
export default cloudInstance;
import { Cloud as MpCloud } from '../mp';
import { ICloudOptions } from '../../shared/types';
import Client from '../../core/message/client';
import { IProxy } from '../../shared/request';
export declare class Cloud extends MpCloud {
message: {
client: Client;
};
init(options: ICloudOptions, proxy: IProxy): Promise<boolean>;
}
declare const _default: Cloud;
export default _default;
import {IProxy} from '../../shared/request';
import {ICloudOptions} from '../../shared/types';
import CloudFunction from '../../core/functions';
import CloudStorage from '../../core/storage';
import Db from '../../core/db';
import Top from '../../core/openApi/client/top';
import Qimen from '../../core/openApi/client/qimen';
import Process from '../../core/openApi/client/process';
import Application from '../../core/openApi/client/application';
export declare class Cloud {
function: CloudFunction;
file: CloudStorage;
db: Db;
topApi: Top;
qimenApi: Qimen;
processApi: Process;
application: Application;
init(options: ICloudOptions, proxy?: IProxy): Promise<boolean>;
}
declare const _default: Cloud;
export default _default;
import { IProxy, IRequestOptions } from '../../shared/request';
import { ICloudOptions } from '../../shared/types';
import CloudFunction from '../../core/functions';
import Database from '../../core/db';
import Server from '../../core/message/server';
import Top from '../../core/openApi/server/top';
export declare class Cloud {
private _options;
db: Database;
function: CloudFunction;
message: {
server: Server;
};
private request;
topApi: Top;
setEnv(env: any): void;
init(options: ICloudOptions & IRequestOptions, proxy: IProxy): void;
}
export declare function cloud(context: any, options: ICloudOptions): Cloud;
export declare const BASE_APIS: {
GET_SESSION: string;
GET_SECRET: string;
};
export declare const STORAGE_KEYS: {
SECRET: string;
};
export declare const ENV_CONFIG: {
pre: {
gw: string;
};
online: {
gw: string;
};
};
import { IAsyncInvokeOptions } from "./types";
export declare function invokeCallback(options: IAsyncInvokeOptions, asyncTask: Promise<any>): Promise<void>;
export declare function myApiPromisify(method: (options: any) => void, options?: any): Promise<any>;
export declare function getUserId(): Promise<string>;
export declare function noop(): void;
export declare function invokeTaskCallback(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function safeAccess(props: any, keys: string[] | string, def?: any): any;
export declare function getValue(key: string): Promise<any>;
export declare function setValue(key: string, data: any): Promise<any>;
export interface IRequestOptions {
appKey?: string,
sourceAppKey?: string,
requestAppKey?:string,
miniappId?: string,
sourceMiniAppId?: string,
appOwnerOpenId?: string,
signSecret?: string;
sessionKey?: string;
requestId?: string;
cloudId?: string;
openId?: string;
unionId?: string;
userNick?: string,
mixNick?: string,
session?: string;
accessToken?: string;
env?: string;
}
export declare enum RequestTypes {
MTOP = 1,
MY = 2,
GATEWAY = 3
}
export interface IGatewayResponse {
error_response: {
code: string;
};
}
export interface IRequestDetail {
url: string;
data?: any;
rawData?: any;
method?: string;
headers?: any;
dataType?: string;
v?: string;
__is_retry_task__?: boolean;
env?: string;
mtopOptions?: any;
}
export interface IProxyOptions {
gatewayUrl?: string;
dataProxyGatewayUrl?: string;
}
export declare abstract class IProxy {
options: IProxyOptions;
abstract apply(task: IRequestDetail, requestType?: RequestTypes): Promise<any>;
constructor(options?: IProxyOptions);
}
export declare class Request {
networkType?: string;
options: IRequestOptions;
tasks: {
detail: IRequestDetail;
success?: (res: any) => void;
fail?: (res: any) => void;
}[];
proxy: IProxy;
inited: boolean;
pauseExecTask: boolean;
init(options: IRequestOptions, proxy: IProxy): Promise<void>;
listenNetworkChange(): Promise<void>;
static getRequestType(url: string): RequestTypes;
/**
* 验证响应结果, 特定情况下重试请求
* @param res
*/
private verifyResponse;
private tryThrowError;
private sendGatewayRequest;
flushGatewayRequestQueue(reject?: boolean): void;
exec(detail: IRequestDetail, requestType?: RequestTypes): Promise<any>;
/**
*
* @param url 网关请求
* @param method 请求方法
* @param queryString
* @param headers mc_开头的http header
* @param content json body
*/
private getHttpRequestSign;
/**
* 对网关请求签名
* @param detail
*/
private createGatewayRequest;
}
export declare const request: Request;
export interface ICallback {
(res: any): void;
}
export interface IHttpRequestOptions extends IAsyncInvokeOptions {
url: string;
method?: string;
headers?: any;
data?: any;
dataType?: string;
}
export declare type Env = 'test' | 'pre' | 'online';
export declare type Envs = {
database: Env;
file: Env;
function: Env;
message: Env;
};
export interface ICloudOptions {
env?: Env | Envs;
appKey?: string;
}
declare global {
interface Window {
}
var my: {
httpRequest: (options: IHttpRequestOptions) => void;
sendMtop: (options: any) => void;
alert: (options: {
title?: string;
content?: string;
}) => void;
};
var NODE_PLATFORM: boolean;
var SDK_VERSION: string;
}
export interface IAsyncInvokeOptions {
success?: ICallback;
fail?: ICallback;
complete?: ICallback;
}
export declare type AsyncInvokeResult = Promise<any> | void;
export declare type Constructor<T = {}> = new (...args: any[]) => T;
import { IAsyncInvokeOptions, Env, Envs } from "./types";
export declare function noop(): void;
export declare function invokeTaskCallback(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
export declare function safeAccess(props: any, keys: string[] | string, def?: any): any;
export declare function invokeCallback(options: IAsyncInvokeOptions, asyncTask: Promise<any>): Promise<void>;
export declare function myApiPromisify(method: (options: any) => void, options?: any): Promise<any>;
export declare function getUserId(): Promise<string>;
export declare function getEnvs(env: Env | Envs): Envs;
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"_from": "fyge-tbmini@^1.0.7",
"_id": "fyge-tbmini@1.0.7",
"_inBundle": false,
"_integrity": "sha512-SCJZHp1YhzTiC+i0r89JSaNAfFQkeD+8LKoBEMMfK7kqht1sqsmbh90WPMVN2rgbMYig+tld9cyNWZyHgHX2cg==",
"_location": "/fyge-tbmini",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "fyge-tbmini@^1.0.7",
"name": "fyge-tbmini",
"escapedName": "fyge-tbmini",
"rawSpec": "^1.0.7",
"saveSpec": null,
"fetchSpec": "^1.0.7"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/fyge-tbmini/-/fyge-tbmini-1.0.7.tgz",
"_shasum": "f941978581d0a5b10caf3e9f9ef10c2ed70db88b",
"_spec": "fyge-tbmini@^1.0.7",
"_where": "D:\\duibaGame\\测试项目0527\\taobaominiTest\\client",
"author": {
"name": "MrKwon"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "淘宝小程序canvas渲染引擎",
"devDependencies": {
"ts-loader": "^4.0.0",
"typescript": "^2.7.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.3.2"
},
"keywords": [
"淘宝小程序,canvas,webgl"
],
"license": "ISC",
"main": "./build/fyge.min.js",
"name": "fyge-tbmini",
"scripts": {
"build": "webpack",
"declare": "node scripts/declare.js src/index.ts",
"dev": "webpack -w",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
},
"types": "./build/FYGE.d.ts",
"version": "1.0.7"
}
1.0.2版本支持web版本解析,包体小
1.0.8版本同时支持web和微信小程序及淘宝小程序解析
\ No newline at end of file
declare module SvgaParser {
/**
* 加载方法
* @param url 资源路径
* @param success
* @param failure
*/
export function loadSvga(url: string, success: (videoItem: VideoEntity) => void, failure: (err: string) => void): void;
/**
* 导出只是当作类型接口用
*/
export interface VideoEntity {
/**
* SVGA 文件版本
*/
version: string;
/**
* 影片尺寸
*/
videoSize: {
width: number;
height: number;
};
/**
* 帧率,60,30等每秒
*/
FPS: number;
/**
* 总帧数
*/
frames: number;
/**
* base64图片数据记录
*/
images: {
[key: string]: string
};
/**
* 图片是否已被缓存,缓存全局,注意名字覆盖
*/
hasBeenCached: boolean;
/**
* sprite对象数据
*/
sprites: SpriteEntity[];
}
interface SpriteEntity {
/**
* 标识
*/
matteKey: string;
/**
* 图片key值
*/
imageKey: string;
/**
* 帧数据数组
*/
frames: FrameEntity[];
}
/**
* 还有很多其他数据,暂不需要,比如矢量路径和遮罩路径暂时都无
*/
interface FrameEntity {
/**
* 透明度
*/
alpha: number;
/**
* 2维矩阵数据
*/
transform: {
a: number,
b: number,
c: number,
d: number,
tx: number,
ty: number,
};
}
}
declare module "svga-parser" { export = SvgaParser; }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"_from": "svga-parser@^1.0.7",
"_id": "svga-parser@1.0.8",
"_inBundle": false,
"_integrity": "sha512-xEj8YdNhm11KmV9rIiKkLOrMGlhrs9qmaGO+j8tNCZ1L9omXBTqmRc3xX6SJXOjUx47cS9tVMaYrBbYKPask3g==",
"_location": "/svga-parser",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "svga-parser@^1.0.7",
"name": "svga-parser",
"escapedName": "svga-parser",
"rawSpec": "^1.0.7",
"saveSpec": null,
"fetchSpec": "^1.0.7"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/svga-parser/-/svga-parser-1.0.8.tgz",
"_shasum": "7c8d13b96227c91bd82c1243a0826b16e6a22194",
"_spec": "svga-parser@^1.0.7",
"_where": "D:\\淘宝小程序\\浏览器开发兼容\\client",
"author": {
"name": "MrKwon"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "1.0.2版本支持web版本解析,包体小\r 1.0.8版本同时支持web和微信小程序及淘宝小程序解析",
"devDependencies": {
"eval5": "^1.4.5",
"protobufjs": "^6.8.0",
"ts-loader": "^4.0.0",
"typescript": "^2.7.2",
"uglifyjs-webpack-plugin": "^2.1.2",
"webpack": "^4.1.0",
"webpack-cli": "^3.3.2"
},
"keywords": [
"svga"
],
"license": "ISC",
"main": "build/svgaParser.min.js",
"name": "svga-parser",
"scripts": {
"build": "webpack",
"dev": "webpack -w",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch"
},
"types": "build/SvgaParser.d.ts",
"version": "1.0.8"
}
{
"name": "",
"version": "1.0.0",
"main": "",
"license": "MIT",
"dependencies": {
"@mrkwon/svga-player": "^1.0.3",
"@tbminiapp/lottie-miniapp": "0.0.3",
"@tbmp/mp-cloud-sdk": "^1.3.8",
"fyge-tbmini": "^1.2.0",
"svga-parser": "^1.1.0"
}
}
"name": "",
"version": "1.0.0",
"main": "",
"license": "MIT",
"dependencies": {
"@mrkwon/svga-player": "^1.0.3",
"@tbminiapp/lottie-miniapp": "0.0.3",
"@tbmp/mp-cloud-sdk": "^1.3.8",
"fyge-tbmini": "^1.2.1",
"svga-parser": "^1.1.0"
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment