oipage 0.3.0 → 0.3.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +62 -56
  4. package/LICENSE +20 -20
  5. package/README.md +122 -122
  6. package/bin/options.js +73 -73
  7. package/bin/run +208 -208
  8. package/browserjs/getStyle/index.d.ts +10 -10
  9. package/browserjs/getStyle/index.js +12 -12
  10. package/browserjs/index.d.ts +12 -12
  11. package/browserjs/index.js +8 -8
  12. package/browserjs/onReady/index.d.ts +7 -7
  13. package/browserjs/onReady/index.js +7 -7
  14. package/browserjs/setStyle/index.d.ts +9 -9
  15. package/browserjs/setStyle/index.js +4 -4
  16. package/corejs/animation/index.d.ts +11 -11
  17. package/corejs/animation/index.js +101 -101
  18. package/corejs/index.d.ts +9 -9
  19. package/corejs/index.js +6 -6
  20. package/corejs/throttle/index.d.ts +30 -30
  21. package/corejs/throttle/index.js +49 -49
  22. package/nodejs/core/file.js +162 -162
  23. package/nodejs/core/image.js +4 -4
  24. package/nodejs/core/log.js +89 -89
  25. package/nodejs/core/network.js +39 -39
  26. package/nodejs/core/options.js +48 -48
  27. package/nodejs/core/remote.js +60 -60
  28. package/nodejs/core/responseFileList.js +27 -27
  29. package/nodejs/core/server.js +198 -189
  30. package/nodejs/data/404.js +51 -51
  31. package/nodejs/data/mime.types.js +111 -111
  32. package/nodejs/form/common.js +2 -2
  33. package/nodejs/form/index.js +79 -79
  34. package/nodejs/form/select.js +9 -9
  35. package/nodejs/index.js +57 -57
  36. package/nodejs/loader/simpleScss.js +247 -247
  37. package/nodejs/loader/xhtml.js +520 -520
  38. package/nodejs/reader/plain.js +20 -20
  39. package/package.json +33 -33
  40. package/stylecss/index.css +3 -3
  41. package/stylecss/normalize.css +93 -93
  42. package/stylecss/rasterize.css +317 -317
  43. package/stylecss/skeleton.css +16 -16
  44. package/types/get-options.d.ts +5 -5
  45. package/types/index.d.ts +186 -186
@@ -1,52 +1,52 @@
1
- const img_folder = require("./images/folder");
2
- const img_file = require("./images/file");
3
-
4
- module.exports = function (template) {
5
- return `<!DOCTYPE html>
6
- <html lang="zh-cn">
7
-
8
- <head>
9
- <meta charset="UTF-8">
10
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
12
- <title>404 Not Found</title>
13
- <style>
14
- body{
15
- margin: 0px;
16
- background-color:#fcfcfc;
17
- display: flex;
18
- flex-wrap:wrap;
19
- padding:100px;
20
- }
21
- body>a{
22
- text-decoration: none;
23
- padding:10px;
24
- color:#000000;
25
- text-align:center;
26
- width:100px;
27
- background-repeat: no-repeat;
28
- background-position: center 0px;
29
- padding-top: 65px;
30
- margin-top: 50px;
31
- font-size:12px;
32
- }
33
- body>a:hover{
34
- outline:1px solid #55b9e6;
35
- }
36
- body>a.folder{
37
- background-image:url('${img_folder}');
38
- }
39
- body>a.file{
40
- background-image:url('${img_file}');
41
- }
42
- </style>
43
- </head>
44
-
45
- <body>
46
-
47
- ${template}
48
-
49
- </body>
50
-
51
- </html>`;
1
+ const img_folder = require("./images/folder");
2
+ const img_file = require("./images/file");
3
+
4
+ module.exports = function (template) {
5
+ return `<!DOCTYPE html>
6
+ <html lang="zh-cn">
7
+
8
+ <head>
9
+ <meta charset="UTF-8">
10
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
11
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
12
+ <title>404 Not Found</title>
13
+ <style>
14
+ body{
15
+ margin: 0px;
16
+ background-color:#fcfcfc;
17
+ display: flex;
18
+ flex-wrap:wrap;
19
+ padding:100px;
20
+ }
21
+ body>a{
22
+ text-decoration: none;
23
+ padding:10px;
24
+ color:#000000;
25
+ text-align:center;
26
+ width:100px;
27
+ background-repeat: no-repeat;
28
+ background-position: center 0px;
29
+ padding-top: 65px;
30
+ margin-top: 50px;
31
+ font-size:12px;
32
+ }
33
+ body>a:hover{
34
+ outline:1px solid #55b9e6;
35
+ }
36
+ body>a.folder{
37
+ background-image:url('${img_folder}');
38
+ }
39
+ body>a.file{
40
+ background-image:url('${img_file}');
41
+ }
42
+ </style>
43
+ </head>
44
+
45
+ <body>
46
+
47
+ ${template}
48
+
49
+ </body>
50
+
51
+ </html>`;
52
52
  };
@@ -1,112 +1,112 @@
1
- module.exports = {
2
- "html": "text/html",
3
- "htm": "text/html",
4
- "shtml": "text/html",
5
- "css": "text/css",
6
- "xml": "text/xml",
7
- "gif": "image/gif",
8
- "jpeg": "image/jpeg",
9
- "jpg": "image/jpeg",
10
- "js": "application/javascript",
11
- "atom": "application/atom+xml",
12
- "rss": "application/rss+xml",
13
-
14
- "mml": "text/mathml",
15
- "txt": "text/plain",
16
- "jad": "text/vnd.sun.j2me.app-descriptor",
17
- "wml": "text/vnd.wap.wml",
18
- "htc": "text/x-component",
19
-
20
- "png": "image/png",
21
- "tif": "image/tiff",
22
- "tiff": "image/tiff",
23
- "wbmp": "image/vnd.wap.wbmp",
24
- "ico": "image/x-icon",
25
- "jng": "image/x-jng",
26
- "bmp": "image/x-ms-bmp",
27
- "svg": "image/svg+xml",
28
- "svgz": "image/svg+xml",
29
- "webp": "image/webp",
30
-
31
- "woff": "application/font-woff",
32
- "jar": "application/java-archive",
33
- "war": "application/java-archive",
34
- "ear": "application/java-archive",
35
- "json": "application/json",
36
- "hqx": "application/mac-binhex40",
37
- "doc": "application/msword",
38
- "pdf": "application/pdf",
39
- "ps": "application/postscript",
40
- "eps": "application/postscript",
41
- "ai": "application/postscript",
42
- "rtf": "application/rtf",
43
- "m3u8": "application/vnd.apple.mpegurl",
44
- "xls": "application/vnd.ms-excel",
45
- "eot": "application/vnd.ms-fontobject",
46
- "ppt": "application/vnd.ms-powerpoint",
47
- "wmlc": "application/vnd.wap.wmlc",
48
- "kml": "application/vnd.google-earth.kml+xml",
49
- "kmz": "application/vnd.google-earth.kmz",
50
- "7z": "application/x-7z-compressed",
51
- "cco": "application/x-cocoa",
52
- "jardiff": "application/x-java-archive-diff",
53
- "jnlp": "application/x-java-jnlp-file",
54
- "run": "application/x-makeself",
55
- "pl": "application/x-perl",
56
- "pm": "application/x-perl",
57
- "prc": "application/x-pilot",
58
- "pdb": "application/x-pilot",
59
- "rar": "application/x-rar-compressed",
60
- "rpm": "application/x-redhat-package-manager",
61
- "sea": "application/x-sea",
62
- "swf": "application/x-shockwave-flash",
63
- "sit": "application/x-stuffit",
64
- "tcl": "application/x-tcl",
65
- "tk": "application/x-tcl",
66
- "der": "application/x-x509-ca-cert",
67
- "pem": "application/x-x509-ca-cert",
68
- "crt": "application/x-x509-ca-cert",
69
- "xpi": "application/x-xpinstall",
70
- "xhtml": "application/xhtml+xml",
71
- "xspf": "application/xspf+xml",
72
- "zip": "application/zip",
73
-
74
- "bin": "application/octet-stream",
75
- "exe": "application/octet-stream",
76
- "dll": "application/octet-stream",
77
- "deb": "application/octet-stream",
78
- "dmg": "application/octet-stream",
79
- "iso": "application/octet-stream",
80
- "img": "application/octet-stream",
81
- "msi": "application/octet-stream",
82
- "msp": "application/octet-stream",
83
- "msm": "application/octet-stream",
84
-
85
- "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
86
- "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
87
- "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
88
-
89
- "mid": "audio/midi",
90
- "midi": "audio/midi",
91
- "kar": "audio/midi",
92
- "mp3": "audio/mpeg",
93
- "ogg": "audio/ogg",
94
- "m4a": "audio/x-m4a",
95
- "ra": "audio/x-realaudio",
96
-
97
- "3gpp": "video/3gpp",
98
- "3gp": "video/3gpp",
99
- "ts": "video/mp2t",
100
- "mp4": "video/mp4",
101
- "mpeg": "video/mpeg",
102
- "mpg": "video/mpeg",
103
- "mov": "video/quicktime",
104
- "webm": "video/webm",
105
- "flv": "video/x-flv",
106
- "m4v": "video/x-m4v",
107
- "mng": "video/x-mng",
108
- "asx": "video/x-ms-asf",
109
- "asf": "video/x-ms-asf",
110
- "wmv": "video/x-ms-wmv",
111
- "avi": "video/x-msvideo"
1
+ module.exports = {
2
+ "html": "text/html",
3
+ "htm": "text/html",
4
+ "shtml": "text/html",
5
+ "css": "text/css",
6
+ "xml": "text/xml",
7
+ "gif": "image/gif",
8
+ "jpeg": "image/jpeg",
9
+ "jpg": "image/jpeg",
10
+ "js": "application/javascript",
11
+ "atom": "application/atom+xml",
12
+ "rss": "application/rss+xml",
13
+
14
+ "mml": "text/mathml",
15
+ "txt": "text/plain",
16
+ "jad": "text/vnd.sun.j2me.app-descriptor",
17
+ "wml": "text/vnd.wap.wml",
18
+ "htc": "text/x-component",
19
+
20
+ "png": "image/png",
21
+ "tif": "image/tiff",
22
+ "tiff": "image/tiff",
23
+ "wbmp": "image/vnd.wap.wbmp",
24
+ "ico": "image/x-icon",
25
+ "jng": "image/x-jng",
26
+ "bmp": "image/x-ms-bmp",
27
+ "svg": "image/svg+xml",
28
+ "svgz": "image/svg+xml",
29
+ "webp": "image/webp",
30
+
31
+ "woff": "application/font-woff",
32
+ "jar": "application/java-archive",
33
+ "war": "application/java-archive",
34
+ "ear": "application/java-archive",
35
+ "json": "application/json",
36
+ "hqx": "application/mac-binhex40",
37
+ "doc": "application/msword",
38
+ "pdf": "application/pdf",
39
+ "ps": "application/postscript",
40
+ "eps": "application/postscript",
41
+ "ai": "application/postscript",
42
+ "rtf": "application/rtf",
43
+ "m3u8": "application/vnd.apple.mpegurl",
44
+ "xls": "application/vnd.ms-excel",
45
+ "eot": "application/vnd.ms-fontobject",
46
+ "ppt": "application/vnd.ms-powerpoint",
47
+ "wmlc": "application/vnd.wap.wmlc",
48
+ "kml": "application/vnd.google-earth.kml+xml",
49
+ "kmz": "application/vnd.google-earth.kmz",
50
+ "7z": "application/x-7z-compressed",
51
+ "cco": "application/x-cocoa",
52
+ "jardiff": "application/x-java-archive-diff",
53
+ "jnlp": "application/x-java-jnlp-file",
54
+ "run": "application/x-makeself",
55
+ "pl": "application/x-perl",
56
+ "pm": "application/x-perl",
57
+ "prc": "application/x-pilot",
58
+ "pdb": "application/x-pilot",
59
+ "rar": "application/x-rar-compressed",
60
+ "rpm": "application/x-redhat-package-manager",
61
+ "sea": "application/x-sea",
62
+ "swf": "application/x-shockwave-flash",
63
+ "sit": "application/x-stuffit",
64
+ "tcl": "application/x-tcl",
65
+ "tk": "application/x-tcl",
66
+ "der": "application/x-x509-ca-cert",
67
+ "pem": "application/x-x509-ca-cert",
68
+ "crt": "application/x-x509-ca-cert",
69
+ "xpi": "application/x-xpinstall",
70
+ "xhtml": "application/xhtml+xml",
71
+ "xspf": "application/xspf+xml",
72
+ "zip": "application/zip",
73
+
74
+ "bin": "application/octet-stream",
75
+ "exe": "application/octet-stream",
76
+ "dll": "application/octet-stream",
77
+ "deb": "application/octet-stream",
78
+ "dmg": "application/octet-stream",
79
+ "iso": "application/octet-stream",
80
+ "img": "application/octet-stream",
81
+ "msi": "application/octet-stream",
82
+ "msp": "application/octet-stream",
83
+ "msm": "application/octet-stream",
84
+
85
+ "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
86
+ "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
87
+ "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
88
+
89
+ "mid": "audio/midi",
90
+ "midi": "audio/midi",
91
+ "kar": "audio/midi",
92
+ "mp3": "audio/mpeg",
93
+ "ogg": "audio/ogg",
94
+ "m4a": "audio/x-m4a",
95
+ "ra": "audio/x-realaudio",
96
+
97
+ "3gpp": "video/3gpp",
98
+ "3gp": "video/3gpp",
99
+ "ts": "video/mp2t",
100
+ "mp4": "video/mp4",
101
+ "mpeg": "video/mpeg",
102
+ "mpg": "video/mpeg",
103
+ "mov": "video/quicktime",
104
+ "webm": "video/webm",
105
+ "flv": "video/x-flv",
106
+ "m4v": "video/x-m4v",
107
+ "mng": "video/x-mng",
108
+ "asx": "video/x-ms-asf",
109
+ "asf": "video/x-ms-asf",
110
+ "wmv": "video/x-ms-wmv",
111
+ "avi": "video/x-msvideo"
112
112
  };
@@ -1,3 +1,3 @@
1
- exports.getTitle = (title) => {
2
- return "➤ " + title;
1
+ exports.getTitle = (title) => {
2
+ return "➤ " + title;
3
3
  };
@@ -1,80 +1,80 @@
1
- const { getTitle } = require("./common");
2
- const { logView } = require("./select");
3
- const { linelog } = require("../core/log");
4
-
5
- module.exports = function (form) {
6
- const rl = require("readline").createInterface({
7
- input: process.stdin,
8
- output: process.stdout
9
- });
10
-
11
- return new Promise(function (resolve, reject) {
12
- let result = [], keyback = () => { };
13
-
14
- console.log("");
15
-
16
- process.stdin.on("keypress", (_str, key) => {
17
- keyback(key.name);
18
- });
19
-
20
- let getResult = (index) => {
21
- if (index >= form.length) {
22
- process.removeAllListeners("keypress");
23
- rl.close();
24
- resolve(result);
25
- } else {
26
- let item = form[index];
27
-
28
- // 文本输入
29
- if (item.type == "input") {
30
-
31
- rl.question(getTitle(item.label), (answer) => {
32
- result.push(answer);
33
- setTimeout(() => {
34
- console.log("");
35
- getResult(index + 1);
36
- }, 50);
37
- });
38
-
39
- }
40
-
41
- // 列表选择
42
- else if (item.type == "select") {
43
- let title = getTitle(item.label);
44
-
45
- let selectIndex = 0;
46
- logView(title, item.value, selectIndex);
47
- keyback = (keyname) => {
48
- if (keyname == "return") {
49
- result.push(selectIndex);
50
- keyback = () => { };
51
- linelog();
52
- setTimeout(() => {
53
- getResult(index + 1);
54
- }, 50);
55
- } else {
56
- if (keyname == "left" || keyname == "up") {
57
- if (selectIndex > 0) selectIndex -= 1;
58
- else selectIndex = item.value.length - 1;
59
- } else if (keyname == "right" || keyname == "down") {
60
- if (selectIndex < item.value.length - 1) selectIndex += 1;
61
- else selectIndex = 0;
62
- } else {
63
- return;
64
- }
65
- logView(title, item.value, selectIndex);
66
- }
67
- };
68
-
69
- }
70
-
71
- // 非法类型
72
- else {
73
- throw new Error("Illegal type!");
74
- }
75
- }
76
-
77
- };
78
- getResult(0);
79
- });
1
+ const { getTitle } = require("./common");
2
+ const { logView } = require("./select");
3
+ const { linelog } = require("../core/log");
4
+
5
+ module.exports = function (form) {
6
+ const rl = require("readline").createInterface({
7
+ input: process.stdin,
8
+ output: process.stdout
9
+ });
10
+
11
+ return new Promise(function (resolve, reject) {
12
+ let result = [], keyback = () => { };
13
+
14
+ console.log("");
15
+
16
+ process.stdin.on("keypress", (_str, key) => {
17
+ keyback(key.name);
18
+ });
19
+
20
+ let getResult = (index) => {
21
+ if (index >= form.length) {
22
+ process.removeAllListeners("keypress");
23
+ rl.close();
24
+ resolve(result);
25
+ } else {
26
+ let item = form[index];
27
+
28
+ // 文本输入
29
+ if (item.type == "input") {
30
+
31
+ rl.question(getTitle(item.label), (answer) => {
32
+ result.push(answer);
33
+ setTimeout(() => {
34
+ console.log("");
35
+ getResult(index + 1);
36
+ }, 50);
37
+ });
38
+
39
+ }
40
+
41
+ // 列表选择
42
+ else if (item.type == "select") {
43
+ let title = getTitle(item.label);
44
+
45
+ let selectIndex = 0;
46
+ logView(title, item.value, selectIndex);
47
+ keyback = (keyname) => {
48
+ if (keyname == "return") {
49
+ result.push(selectIndex);
50
+ keyback = () => { };
51
+ linelog();
52
+ setTimeout(() => {
53
+ getResult(index + 1);
54
+ }, 50);
55
+ } else {
56
+ if (keyname == "left" || keyname == "up") {
57
+ if (selectIndex > 0) selectIndex -= 1;
58
+ else selectIndex = item.value.length - 1;
59
+ } else if (keyname == "right" || keyname == "down") {
60
+ if (selectIndex < item.value.length - 1) selectIndex += 1;
61
+ else selectIndex = 0;
62
+ } else {
63
+ return;
64
+ }
65
+ logView(title, item.value, selectIndex);
66
+ }
67
+ };
68
+
69
+ }
70
+
71
+ // 非法类型
72
+ else {
73
+ throw new Error("Illegal type!");
74
+ }
75
+ }
76
+
77
+ };
78
+ getResult(0);
79
+ });
80
80
  };
@@ -1,10 +1,10 @@
1
- const { linelog } = require("../core/log");
2
-
3
- exports.logView = (title, list, index) => {
4
- let txtArray = [];
5
- for (let i = 0; i < list.length; i++) {
6
- txtArray.push(" " + (i == index ? "●" : "○") + " " + list[i]);
7
- }
8
-
9
- linelog(`${title}\n${txtArray.join("\n")}\n`);
1
+ const { linelog } = require("../core/log");
2
+
3
+ exports.logView = (title, list, index) => {
4
+ let txtArray = [];
5
+ for (let i = 0; i < list.length; i++) {
6
+ txtArray.push(" " + (i == index ? "●" : "○") + " " + list[i]);
7
+ }
8
+
9
+ linelog(`${title}\n${txtArray.join("\n")}\n`);
10
10
  };
package/nodejs/index.js CHANGED
@@ -1,58 +1,58 @@
1
- const { deleteSync, copySync, moveSync, listFileSync, listFolderSync, fullPathSync } = require('./core/file');
2
- const { log, warn, error, linelog, deeplog } = require('./core/log');
3
- const options = require('./core/options');
4
- const { get, post } = require('./core/remote');
5
- const network = require('./core/network');
6
- const mimeTypes = require('./data/mime.types');
7
- const server = require('./core/server');
8
- const { toBase64 } = require('./core/image');
9
-
10
- const simpleScss = require('./loader/simpleScss');
11
- const xhtml = require('./loader/xhtml');
12
-
13
- const plain = require('./reader/plain');
14
-
15
- const form = require('./form/index');
16
-
17
- module.exports = {
18
-
19
- // 命令行相关
20
- options,
21
-
22
- // 文件操作相关
23
- deleteSync, copySync, moveSync, listFileSync, listFolderSync, fullPathSync,
24
-
25
- // 图片相关
26
- toBase64,
27
-
28
- // 日志打印
29
- log, warn, error,
30
-
31
- // 单行打印
32
- linelog,
33
-
34
- // 进度打印
35
- process: deeplog, // 向下兼容
36
- deeplog,
37
-
38
- // 请求
39
- get, post,
40
-
41
- // 查看网络信息
42
- network,
43
-
44
- // 文件类型
45
- mimeTypes,
46
-
47
- // 服务器
48
- server,
49
-
50
- // 文件解析
51
- simpleScss, xhtml,
52
-
53
- // 文件读取
54
- plain,
55
-
56
- // 表单录入
57
- form
1
+ const { deleteSync, copySync, moveSync, listFileSync, listFolderSync, fullPathSync } = require('./core/file');
2
+ const { log, warn, error, linelog, deeplog } = require('./core/log');
3
+ const options = require('./core/options');
4
+ const { get, post } = require('./core/remote');
5
+ const network = require('./core/network');
6
+ const mimeTypes = require('./data/mime.types');
7
+ const server = require('./core/server');
8
+ const { toBase64 } = require('./core/image');
9
+
10
+ const simpleScss = require('./loader/simpleScss');
11
+ const xhtml = require('./loader/xhtml');
12
+
13
+ const plain = require('./reader/plain');
14
+
15
+ const form = require('./form/index');
16
+
17
+ module.exports = {
18
+
19
+ // 命令行相关
20
+ options,
21
+
22
+ // 文件操作相关
23
+ deleteSync, copySync, moveSync, listFileSync, listFolderSync, fullPathSync,
24
+
25
+ // 图片相关
26
+ toBase64,
27
+
28
+ // 日志打印
29
+ log, warn, error,
30
+
31
+ // 单行打印
32
+ linelog,
33
+
34
+ // 进度打印
35
+ process: deeplog, // 向下兼容
36
+ deeplog,
37
+
38
+ // 请求
39
+ get, post,
40
+
41
+ // 查看网络信息
42
+ network,
43
+
44
+ // 文件类型
45
+ mimeTypes,
46
+
47
+ // 服务器
48
+ server,
49
+
50
+ // 文件解析
51
+ simpleScss, xhtml,
52
+
53
+ // 文件读取
54
+ plain,
55
+
56
+ // 表单录入
57
+ form
58
58
  };