oipage 1.7.0-alpha.7 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/FUNDING.yml +11 -11
- package/AUTHORS.txt +6 -6
- package/CHANGELOG +156 -159
- package/LICENSE +20 -20
- package/README.md +95 -95
- package/bin/WebSocket/decodeWsFrame.js +43 -43
- package/bin/WebSocket/encodeWsFrame.js +28 -28
- package/bin/WebSocket/headersToJSON.js +26 -26
- package/bin/WebSocket/index.js +80 -80
- package/bin/data/mineTypes.json +104 -104
- package/bin/disk.js +42 -42
- package/bin/help.js +45 -45
- package/bin/intercept.js +15 -15
- package/bin/network.js +21 -21
- package/bin/proxy.js +75 -75
- package/bin/run +129 -129
- package/bin/serve.d.ts +64 -64
- package/bin/serve.js +179 -179
- package/bin/template/404.html +186 -186
- package/bin/tools/deleteEmptyFolder.js +23 -23
- package/bin/tools/format.js +75 -75
- package/bin/tools/network.js +42 -42
- package/bin/tools/resolve404.js +83 -83
- package/bin/tools/resolveImport.js +88 -88
- package/bin/website-htmls/components/ui-select-file/index.html +7 -7
- package/bin/website-htmls/components/ui-select-file/index.js +37 -37
- package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
- package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
- package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
- package/bin/website-htmls/dialogs/imageSize/index.scss +138 -138
- package/bin/website-htmls/dialogs/index.js +52 -52
- package/bin/website-htmls/images/addFile.svg +1 -1
- package/bin/website-htmls/images/img-to-pdf.svg +1 -1
- package/bin/website-htmls/index.html +17 -17
- package/bin/website-htmls/main.js +13 -13
- package/bin/website-htmls/pages/App/index.html +6 -6
- package/bin/website-htmls/pages/App/index.js +22 -22
- package/bin/website-htmls/pages/App/index.scss +43 -43
- package/bin/website-htmls/pages/appStore/index.html +24 -24
- package/bin/website-htmls/pages/appStore/index.js +19 -19
- package/bin/website-htmls/pages/appStore/index.scss +41 -41
- package/bin/website-htmls/pages/chart/index.html +8 -8
- package/bin/website-htmls/pages/chart/index.js +72 -72
- package/bin/website-htmls/pages/chart/index.scss +72 -72
- package/bin/website-htmls/pages/image-editor/index.html +27 -27
- package/bin/website-htmls/pages/image-editor/index.js +106 -106
- package/bin/website-htmls/pages/image-editor/index.scss +45 -45
- package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
- package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
- package/bin/website-htmls/pages/img-to-pdf/index.scss +4 -4
- package/bin/website-htmls/router.config.js +19 -19
- package/bin/website-htmls/styles/normalize.css +94 -94
- package/bin/website-plugins/intercept/chart.js +33 -33
- package/bin/website-plugins/intercept/getPackage.js +17 -17
- package/bin/website-plugins/intercept/head.js +8 -8
- package/bin/website-plugins/intercept/index.js +8 -8
- package/bin/website-plugins/intercept/oipage-vislite-intercept.js +30 -30
- package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +36 -36
- package/bin/website-plugins/loader/index.js +11 -11
- package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
- package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
- package/nodejs/animation/index.d.ts +19 -19
- package/nodejs/animation/index.js +112 -112
- package/nodejs/cmdlog/index.d.ts +20 -20
- package/nodejs/cmdlog/index.js +75 -75
- package/nodejs/disk/index.d.ts +47 -47
- package/nodejs/disk/index.js +165 -165
- package/nodejs/format/index.d.ts +29 -29
- package/nodejs/format/index.js +107 -107
- package/nodejs/json/index.d.ts +9 -9
- package/nodejs/json/index.js +206 -206
- package/nodejs/logform/index.d.ts +18 -18
- package/nodejs/logform/index.js +94 -94
- package/nodejs/reader/index.d.ts +32 -32
- package/nodejs/reader/index.js +20 -20
- package/nodejs/throttle/index.d.ts +30 -30
- package/nodejs/throttle/index.js +50 -50
- package/package.json +45 -45
- package/types/index.d.ts +2 -4
- package/web/XMLHttpRequest/index.d.ts +17 -17
- package/web/XMLHttpRequest/index.js +60 -60
- package/web/animation/index.d.ts +19 -19
- package/web/animation/index.js +112 -112
- package/web/format/index.d.ts +29 -29
- package/web/format/index.js +107 -107
- package/web/json/index.d.ts +9 -9
- package/web/json/index.js +206 -206
- package/web/onReady/index.d.ts +7 -7
- package/web/onReady/index.js +8 -8
- package/web/performChunk/index.d.ts +4 -4
- package/web/performChunk/index.js +19 -19
- package/web/reader/index.d.ts +32 -32
- package/web/reader/index.js +20 -20
- package/web/style/index.d.ts +21 -21
- package/web/style/index.js +19 -19
- package/web/throttle/index.d.ts +30 -30
- package/web/throttle/index.js +50 -50
- package/nodejs/remote/index.d.ts +0 -39
- package/nodejs/remote/index.js +0 -91
package/web/style/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* style of OIPage v1.7.0
|
|
2
|
+
* style of OIPage v1.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/OIPage.git
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export function setStyle(el, styles) {
|
|
7
|
-
for (var key in styles) {
|
|
8
|
-
el.style[key] = styles[key];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function getStyle(el, name) {
|
|
13
|
-
|
|
14
|
-
// 获取结点的全部样式
|
|
15
|
-
var allStyle = document.defaultView && document.defaultView.getComputedStyle ?
|
|
16
|
-
document.defaultView.getComputedStyle(el, null) :
|
|
17
|
-
el.currentStyle;
|
|
18
|
-
|
|
19
|
-
// 如果没有指定属性名称,返回全部样式
|
|
20
|
-
return typeof name === 'string' ?
|
|
21
|
-
allStyle.getPropertyValue(name) :
|
|
22
|
-
allStyle;
|
|
23
|
-
|
|
6
|
+
export function setStyle(el, styles) {
|
|
7
|
+
for (var key in styles) {
|
|
8
|
+
el.style[key] = styles[key];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function getStyle(el, name) {
|
|
13
|
+
|
|
14
|
+
// 获取结点的全部样式
|
|
15
|
+
var allStyle = document.defaultView && document.defaultView.getComputedStyle ?
|
|
16
|
+
document.defaultView.getComputedStyle(el, null) :
|
|
17
|
+
el.currentStyle;
|
|
18
|
+
|
|
19
|
+
// 如果没有指定属性名称,返回全部样式
|
|
20
|
+
return typeof name === 'string' ?
|
|
21
|
+
allStyle.getPropertyValue(name) :
|
|
22
|
+
allStyle;
|
|
23
|
+
|
|
24
24
|
}
|
package/web/throttle/index.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export type throttleOpportunityType = "begin" | "end" | "wide"
|
|
2
|
-
|
|
3
|
-
export interface throttleOptionType {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 节流时长
|
|
7
|
-
*/
|
|
8
|
-
time?: number
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 是否持续节流
|
|
12
|
-
*/
|
|
13
|
-
keep?: boolean
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 执行时机
|
|
17
|
-
*
|
|
18
|
-
* begin(开始触发)、end(结束触发)、wide(第一次开始触发,其余结束触发)
|
|
19
|
-
*/
|
|
20
|
-
opportunity?: throttleOpportunityType
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 节流函数
|
|
26
|
-
*/
|
|
27
|
-
export interface throttleType {
|
|
28
|
-
(callback: Function, option?: throttleOptionType): Function
|
|
29
|
-
}
|
|
30
|
-
|
|
1
|
+
export type throttleOpportunityType = "begin" | "end" | "wide"
|
|
2
|
+
|
|
3
|
+
export interface throttleOptionType {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 节流时长
|
|
7
|
+
*/
|
|
8
|
+
time?: number
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 是否持续节流
|
|
12
|
+
*/
|
|
13
|
+
keep?: boolean
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 执行时机
|
|
17
|
+
*
|
|
18
|
+
* begin(开始触发)、end(结束触发)、wide(第一次开始触发,其余结束触发)
|
|
19
|
+
*/
|
|
20
|
+
opportunity?: throttleOpportunityType
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 节流函数
|
|
26
|
+
*/
|
|
27
|
+
export interface throttleType {
|
|
28
|
+
(callback: Function, option?: throttleOptionType): Function
|
|
29
|
+
}
|
|
30
|
+
|
|
31
31
|
export let throttle: throttleType
|
package/web/throttle/index.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* throttle of OIPage v1.7.0
|
|
2
|
+
* throttle of OIPage v1.7.0
|
|
3
3
|
* git+https://github.com/oi-contrib/OIPage.git
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export function throttle(callback, _option) {
|
|
7
|
-
|
|
8
|
-
// 缺省值
|
|
9
|
-
var option = {
|
|
10
|
-
time: 200,
|
|
11
|
-
keep: false,
|
|
12
|
-
opportunity: "end"
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// 校对
|
|
16
|
-
if (_option) {
|
|
17
|
-
for (var key in _option) {
|
|
18
|
-
option[key] = _option[key];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var hadInterval = false, hadClick = false, oneClick = false, arg;
|
|
23
|
-
return function () {
|
|
24
|
-
const _this = this;
|
|
25
|
-
arg = arguments;
|
|
26
|
-
|
|
27
|
-
// 如果前置任务都完成了
|
|
28
|
-
if (!hadInterval) {
|
|
29
|
-
if (option.opportunity != 'end') {
|
|
30
|
-
callback.apply(_this, arg);
|
|
31
|
-
}
|
|
32
|
-
hadInterval = true;
|
|
33
|
-
|
|
34
|
-
var interval = setInterval(() => {
|
|
35
|
-
if (hadClick) {
|
|
36
|
-
if (!option.keep) {
|
|
37
|
-
callback.apply(_this, arg);
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
if (option.opportunity != 'begin') {
|
|
41
|
-
if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
|
|
42
|
-
}
|
|
43
|
-
hadInterval = false;
|
|
44
|
-
oneClick = false;
|
|
45
|
-
clearInterval(interval);
|
|
46
|
-
}
|
|
47
|
-
hadClick = false;
|
|
48
|
-
}, option.time);
|
|
49
|
-
} else {
|
|
50
|
-
hadClick = true;
|
|
51
|
-
oneClick = true;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
};
|
|
6
|
+
export function throttle(callback, _option) {
|
|
7
|
+
|
|
8
|
+
// 缺省值
|
|
9
|
+
var option = {
|
|
10
|
+
time: 200,
|
|
11
|
+
keep: false,
|
|
12
|
+
opportunity: "end"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// 校对
|
|
16
|
+
if (_option) {
|
|
17
|
+
for (var key in _option) {
|
|
18
|
+
option[key] = _option[key];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var hadInterval = false, hadClick = false, oneClick = false, arg;
|
|
23
|
+
return function () {
|
|
24
|
+
const _this = this;
|
|
25
|
+
arg = arguments;
|
|
26
|
+
|
|
27
|
+
// 如果前置任务都完成了
|
|
28
|
+
if (!hadInterval) {
|
|
29
|
+
if (option.opportunity != 'end') {
|
|
30
|
+
callback.apply(_this, arg);
|
|
31
|
+
}
|
|
32
|
+
hadInterval = true;
|
|
33
|
+
|
|
34
|
+
var interval = setInterval(() => {
|
|
35
|
+
if (hadClick) {
|
|
36
|
+
if (!option.keep) {
|
|
37
|
+
callback.apply(_this, arg);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
if (option.opportunity != 'begin') {
|
|
41
|
+
if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
|
|
42
|
+
}
|
|
43
|
+
hadInterval = false;
|
|
44
|
+
oneClick = false;
|
|
45
|
+
clearInterval(interval);
|
|
46
|
+
}
|
|
47
|
+
hadClick = false;
|
|
48
|
+
}, option.time);
|
|
49
|
+
} else {
|
|
50
|
+
hadClick = true;
|
|
51
|
+
oneClick = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
};
|
|
55
55
|
}
|
package/nodejs/remote/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
interface resType {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 响应码
|
|
5
|
-
*/
|
|
6
|
-
status: number
|
|
7
|
-
|
|
8
|
-
type: "string" | "json" | "binary"
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 响应体
|
|
12
|
-
*/
|
|
13
|
-
data: string
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 响应头
|
|
17
|
-
*/
|
|
18
|
-
headers: {
|
|
19
|
-
[key: string]: any
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface getType {
|
|
24
|
-
(url: string, headers?: {
|
|
25
|
-
[key: string]: any
|
|
26
|
-
}): Promise<resType>
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export let get: getType
|
|
30
|
-
|
|
31
|
-
export interface postType {
|
|
32
|
-
(url: string, headers?: {
|
|
33
|
-
[key: string]: any
|
|
34
|
-
}, params?: {
|
|
35
|
-
[key: string]: any
|
|
36
|
-
}): Promise<resType>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export let post: postType
|
package/nodejs/remote/index.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* remote of OIPage v1.7.0-alpha.7
|
|
3
|
-
* git+https://github.com/oi-contrib/OIPage.git
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const https = require('https');
|
|
7
|
-
const http = require('http');
|
|
8
|
-
|
|
9
|
-
function remote(method, url, headers, param) {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
let handler = /^https/.test(url) ? https : http;
|
|
12
|
-
|
|
13
|
-
let execArray = /https*:\/\/([^\/]+)(.+)?/.exec(url);
|
|
14
|
-
let hostport = execArray[1].split(":");
|
|
15
|
-
|
|
16
|
-
// https://nodejs.org/download/release/v16.8.0/docs/api/http.html#http_http_request_options_callback
|
|
17
|
-
const req = handler.request({
|
|
18
|
-
hostname: hostport[0],
|
|
19
|
-
port: hostport[1] || 80,
|
|
20
|
-
path: execArray[2] || "/",
|
|
21
|
-
method,
|
|
22
|
-
headers
|
|
23
|
-
}, (res) => {
|
|
24
|
-
|
|
25
|
-
let _temp = (res.headers["content-type"] + "").split(";");
|
|
26
|
-
|
|
27
|
-
// 数据类型
|
|
28
|
-
let contentType = _temp[0];
|
|
29
|
-
|
|
30
|
-
// 数据编码
|
|
31
|
-
let contentEncoding = "";
|
|
32
|
-
if (_temp[1]) contentEncoding = _temp[1].replace("charset=", "")
|
|
33
|
-
else res.setEncoding("binary"); // 二进制
|
|
34
|
-
|
|
35
|
-
const chunks = []; // 用于存储接收到的数据块
|
|
36
|
-
let size = 0; // 用于跟踪接收到的数据总量
|
|
37
|
-
|
|
38
|
-
res.on('data', (chunk) => {
|
|
39
|
-
chunks.push(chunk); // 将接收到的数据块添加到数组中
|
|
40
|
-
size += chunk.length; // 更新已接收的数据总量
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
res.on('end', () => {
|
|
44
|
-
let data = Buffer.concat(chunks, size); // 将所有数据块合并为一个Buffer
|
|
45
|
-
let type = "binary"
|
|
46
|
-
|
|
47
|
-
// 如果有编码,认为是文本
|
|
48
|
-
if (contentEncoding) {
|
|
49
|
-
data = data.toString('utf8');
|
|
50
|
-
type = "string";
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// JSON文件
|
|
54
|
-
if (contentType === "application/json") {
|
|
55
|
-
try {
|
|
56
|
-
data = JSON.parse(data);
|
|
57
|
-
type = "json";
|
|
58
|
-
} catch (e) { }
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
resolve({
|
|
62
|
-
status: res.statusCode,
|
|
63
|
-
type,
|
|
64
|
-
data,
|
|
65
|
-
headers: res.headers
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (param) req.write(param);
|
|
72
|
-
|
|
73
|
-
req.on('error', (e) => {
|
|
74
|
-
reject(e);
|
|
75
|
-
});
|
|
76
|
-
req.end();
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// GET请求
|
|
81
|
-
function get(url, headers = {}) {
|
|
82
|
-
return remote("GET", url, headers)
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// POST请求
|
|
86
|
-
function post(url, headers = {}, params = {}) {
|
|
87
|
-
return remote("POST", url, headers, JSON.stringify(params));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
exports.get = get;
|
|
91
|
-
exports.post = post;
|