@tplc/wot 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/components/wd-qr-code/common/cache.js +1 -0
- package/components/wd-qr-code/common/queue.js +41 -0
- package/components/wd-qr-code/common/types/cache.d.ts +3 -0
- package/components/wd-qr-code/common/types/queue.d.ts +4 -0
- package/components/wd-qr-code/js_sdk/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/Program.js +21 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/Shader.js +22 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/Texture.js +22 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/wd-qr-code/js_sdk/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/wd-qr-code/js_sdk/gcanvas/env/canvas.js +74 -0
- package/components/wd-qr-code/js_sdk/gcanvas/env/image.js +96 -0
- package/components/wd-qr-code/js_sdk/gcanvas/env/tool.js +24 -0
- package/components/wd-qr-code/js_sdk/gcanvas/index.js +39 -0
- package/components/wd-qr-code/js_sdk/uqrcode/uqrcode.js +1980 -0
- package/components/wd-qr-code/types.ts +38 -0
- package/components/wd-qr-code/wd-qr-code.vue +1050 -0
- package/package.json +9 -6
- package/types/components/wd-qr-code/types.d.ts +84 -0
- package/types/components/wd-qr-code/wd-qr-code.vue.d.ts +199 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.26](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.60...v0.1.26) (2024-11-20)
|
|
6
|
+
|
|
5
7
|
### [0.1.24](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.57...v0.1.24) (2024-11-07)
|
|
6
8
|
|
|
7
9
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cacheImageList = [];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function Queue() {
|
|
2
|
+
let waitingQueue = this.waitingQueue = [];
|
|
3
|
+
let isRunning = this.isRunning = false; // 记录是否有未完成的任务
|
|
4
|
+
|
|
5
|
+
function execute(task, resolve, reject) {
|
|
6
|
+
task()
|
|
7
|
+
.then((data) => {
|
|
8
|
+
resolve(data);
|
|
9
|
+
})
|
|
10
|
+
.catch((e) => {
|
|
11
|
+
reject(e);
|
|
12
|
+
})
|
|
13
|
+
.finally(() => {
|
|
14
|
+
// 等待任务队列中如果有任务,则触发它;否则设置isRunning = false,表示无任务状态
|
|
15
|
+
if (waitingQueue.length) {
|
|
16
|
+
const next = waitingQueue.shift();
|
|
17
|
+
execute(next.task, next.resolve, next.reject);
|
|
18
|
+
} else {
|
|
19
|
+
isRunning = false;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
this.exec = function(task) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
if (isRunning) {
|
|
26
|
+
waitingQueue.push({
|
|
27
|
+
task,
|
|
28
|
+
resolve,
|
|
29
|
+
reject
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
isRunning = true;
|
|
33
|
+
execute(task, resolve, reject);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* 队列实例,某些平台一起使用多个组件时需要通过队列逐一绘制,否则部分绘制方法异常,nvue端的iOS gcanvas尤其明显,在不通过队列绘制时会出现图片丢失的情况 */
|
|
40
|
+
export const queueDraw = new Queue();
|
|
41
|
+
export const queueLoadImage = new Queue();
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const isWeex = typeof WXEnvironment !== 'undefined';
|
|
2
|
+
const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform);
|
|
3
|
+
const isWeexAndroid = isWeex && !isWeexIOS;
|
|
4
|
+
|
|
5
|
+
import GLmethod from '../context-webgl/GLmethod';
|
|
6
|
+
|
|
7
|
+
const GCanvasModule =
|
|
8
|
+
(typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) :
|
|
9
|
+
(typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {};
|
|
10
|
+
|
|
11
|
+
let isDebugging = false;
|
|
12
|
+
|
|
13
|
+
let isComboDisabled = false;
|
|
14
|
+
|
|
15
|
+
const logCommand = (function () {
|
|
16
|
+
const methodQuery = [];
|
|
17
|
+
Object.keys(GLmethod).forEach(key => {
|
|
18
|
+
methodQuery[GLmethod[key]] = key;
|
|
19
|
+
})
|
|
20
|
+
const queryMethod = (id) => {
|
|
21
|
+
return methodQuery[parseInt(id)] || 'NotFoundMethod';
|
|
22
|
+
}
|
|
23
|
+
const logCommand = (id, cmds) => {
|
|
24
|
+
const mId = cmds.split(',')[0];
|
|
25
|
+
const mName = queryMethod(mId);
|
|
26
|
+
console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`);
|
|
27
|
+
}
|
|
28
|
+
return logCommand;
|
|
29
|
+
})();
|
|
30
|
+
|
|
31
|
+
function joinArray(arr, sep) {
|
|
32
|
+
let res = '';
|
|
33
|
+
for (let i = 0; i < arr.length; i++) {
|
|
34
|
+
if (i !== 0) {
|
|
35
|
+
res += sep;
|
|
36
|
+
}
|
|
37
|
+
res += arr[i];
|
|
38
|
+
}
|
|
39
|
+
return res;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const commandsCache = {}
|
|
43
|
+
|
|
44
|
+
const GBridge = {
|
|
45
|
+
|
|
46
|
+
callEnable: (ref, configArray) => {
|
|
47
|
+
|
|
48
|
+
commandsCache[ref] = [];
|
|
49
|
+
|
|
50
|
+
return GCanvasModule.enable({
|
|
51
|
+
componentId: ref,
|
|
52
|
+
config: configArray
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
callEnableDebug: () => {
|
|
57
|
+
isDebugging = true;
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
callEnableDisableCombo: () => {
|
|
61
|
+
isComboDisabled = true;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
callSetContextType: function (componentId, context_type) {
|
|
65
|
+
GCanvasModule.setContextType(context_type, componentId);
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
callReset: function(id){
|
|
69
|
+
GCanvasModule.resetComponent && canvasModule.resetComponent(componentId);
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
render: isWeexIOS ? function (componentId) {
|
|
73
|
+
return GCanvasModule.extendCallNative({
|
|
74
|
+
contextId: componentId,
|
|
75
|
+
type: 0x60000001
|
|
76
|
+
});
|
|
77
|
+
} : function (componentId) {
|
|
78
|
+
return callGCanvasLinkNative(componentId, 0x60000001, 'render');
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
render2d: isWeexIOS ? function (componentId, commands, callback) {
|
|
82
|
+
|
|
83
|
+
if (isDebugging) {
|
|
84
|
+
console.log('>>> >>> render2d ===');
|
|
85
|
+
console.log('>>> commands: ' + commands);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
GCanvasModule.render([commands, callback?true:false], componentId, callback);
|
|
89
|
+
|
|
90
|
+
} : function (componentId, commands,callback) {
|
|
91
|
+
|
|
92
|
+
if (isDebugging) {
|
|
93
|
+
console.log('>>> >>> render2d ===');
|
|
94
|
+
console.log('>>> commands: ' + commands);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
callGCanvasLinkNative(componentId, 0x20000001, commands);
|
|
98
|
+
if(callback){
|
|
99
|
+
callback();
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) {
|
|
104
|
+
|
|
105
|
+
throw 'should not be here anymore ' + cmdArgs;
|
|
106
|
+
|
|
107
|
+
} : function (componentId, cmdArgs) {
|
|
108
|
+
|
|
109
|
+
throw 'should not be here anymore ' + cmdArgs;
|
|
110
|
+
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
flushNative: isWeexIOS ? function (componentId) {
|
|
115
|
+
|
|
116
|
+
const cmdArgs = joinArray(commandsCache[componentId], ';');
|
|
117
|
+
commandsCache[componentId] = [];
|
|
118
|
+
|
|
119
|
+
if (isDebugging) {
|
|
120
|
+
console.log('>>> >>> flush native ===');
|
|
121
|
+
console.log('>>> commands: ' + cmdArgs);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const result = GCanvasModule.extendCallNative({
|
|
125
|
+
"contextId": componentId,
|
|
126
|
+
"type": 0x60000000,
|
|
127
|
+
"args": cmdArgs
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const res = result && result.result;
|
|
131
|
+
|
|
132
|
+
if (isDebugging) {
|
|
133
|
+
console.log('>>> result: ' + res);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return res;
|
|
137
|
+
|
|
138
|
+
} : function (componentId) {
|
|
139
|
+
|
|
140
|
+
const cmdArgs = joinArray(commandsCache[componentId], ';');
|
|
141
|
+
commandsCache[componentId] = [];
|
|
142
|
+
|
|
143
|
+
if (isDebugging) {
|
|
144
|
+
console.log('>>> >>> flush native ===');
|
|
145
|
+
console.log('>>> commands: ' + cmdArgs);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs);
|
|
149
|
+
|
|
150
|
+
if (isDebugging) {
|
|
151
|
+
console.log('>>> result: ' + result);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return result;
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
callNative: function (componentId, cmdArgs, cache) {
|
|
158
|
+
|
|
159
|
+
if (isDebugging) {
|
|
160
|
+
logCommand(componentId, cmdArgs);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
commandsCache[componentId].push(cmdArgs);
|
|
164
|
+
|
|
165
|
+
if (!cache || isComboDisabled) {
|
|
166
|
+
return GBridge.flushNative(componentId);
|
|
167
|
+
} else {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
texImage2D(componentId, ...args) {
|
|
173
|
+
if (isWeexIOS) {
|
|
174
|
+
if (args.length === 6) {
|
|
175
|
+
const [target, level, internalformat, format, type, image] = args;
|
|
176
|
+
GBridge.callNative(
|
|
177
|
+
componentId,
|
|
178
|
+
GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src
|
|
179
|
+
)
|
|
180
|
+
} else if (args.length === 9) {
|
|
181
|
+
const [target, level, internalformat, width, height, border, format, type, image] = args;
|
|
182
|
+
GBridge.callNative(
|
|
183
|
+
componentId,
|
|
184
|
+
GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' +
|
|
185
|
+
+ format + ',' + type + ',' + (image ? image.src : 0)
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
} else if (isWeexAndroid) {
|
|
189
|
+
if (args.length === 6) {
|
|
190
|
+
const [target, level, internalformat, format, type, image] = args;
|
|
191
|
+
GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src);
|
|
192
|
+
} else if (args.length === 9) {
|
|
193
|
+
const [target, level, internalformat, width, height, border, format, type, image] = args;
|
|
194
|
+
GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) {
|
|
200
|
+
if (isWeexIOS) {
|
|
201
|
+
if (arguments.length === 8) {
|
|
202
|
+
GBridge.callNative(
|
|
203
|
+
componentId,
|
|
204
|
+
GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
} else if (isWeexAndroid) {
|
|
208
|
+
GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src);
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
bindImageTexture(componentId, src, imageId) {
|
|
213
|
+
GCanvasModule.bindImageTexture([src, imageId], componentId);
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
perloadImage([url, id], callback) {
|
|
217
|
+
GCanvasModule.preLoadImage([url, id], function (image) {
|
|
218
|
+
image.url = url;
|
|
219
|
+
image.id = id;
|
|
220
|
+
callback(image);
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
measureText(text, fontStyle, componentId) {
|
|
225
|
+
return GCanvasModule.measureText([text, fontStyle], componentId);
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
getImageData (componentId, x, y, w, h, callback) {
|
|
229
|
+
GCanvasModule.getImageData([x, y,w,h],componentId,callback);
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
putImageData (componentId, data, x, y, w, h, callback) {
|
|
233
|
+
GCanvasModule.putImageData([x, y,w,h,data],componentId,callback);
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){
|
|
237
|
+
GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export default GBridge;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class FillStyleLinearGradient {
|
|
2
|
+
|
|
3
|
+
constructor(x0, y0, x1, y1) {
|
|
4
|
+
this._start_pos = { _x: x0, _y: y0 };
|
|
5
|
+
this._end_pos = { _x: x1, _y: y1 };
|
|
6
|
+
this._stop_count = 0;
|
|
7
|
+
this._stops = [0, 0, 0, 0, 0];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
addColorStop = function (pos, color) {
|
|
11
|
+
if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
|
|
12
|
+
this._stops[this._stop_count] = { _pos: pos, _color: color };
|
|
13
|
+
this._stop_count++;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default FillStyleLinearGradient;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class FillStyleRadialGradient {
|
|
2
|
+
constructor(x0, y0, r0, x1, y1, r1) {
|
|
3
|
+
this._start_pos = { _x: x0, _y: y0, _r: r0 };
|
|
4
|
+
this._end_pos = { _x: x1, _y: y1, _r: r1 };
|
|
5
|
+
this._stop_count = 0;
|
|
6
|
+
this._stops = [0, 0, 0, 0, 0];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
addColorStop(pos, color) {
|
|
10
|
+
if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) {
|
|
11
|
+
this._stops[this._stop_count] = { _pos: pos, _color: color };
|
|
12
|
+
this._stop_count++;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default FillStyleRadialGradient;
|