oipage 1.7.0 → 1.8.0-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 (101) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +9 -1
  4. package/LICENSE +20 -20
  5. package/README.md +1 -9
  6. package/bin/WebSocket/decodeWsFrame.js +43 -43
  7. package/bin/WebSocket/encodeWsFrame.js +28 -28
  8. package/bin/WebSocket/headersToJSON.js +26 -26
  9. package/bin/WebSocket/index.js +80 -80
  10. package/bin/data/mineTypes.json +104 -104
  11. package/bin/disk.js +42 -42
  12. package/bin/help.js +3 -0
  13. package/bin/intercept.js +15 -15
  14. package/bin/network.js +21 -21
  15. package/bin/run +5 -3
  16. package/bin/serve.d.ts +7 -0
  17. package/bin/serve.js +9 -1
  18. package/bin/template/404.html +186 -186
  19. package/bin/tools/deleteEmptyFolder.js +23 -23
  20. package/bin/tools/format.js +75 -75
  21. package/bin/tools/network.js +42 -42
  22. package/bin/tools/openBrowser.js +26 -0
  23. package/bin/tools/resolve404.js +83 -83
  24. package/bin/tools/resolveImport.js +88 -88
  25. package/bin/website-htmls/components/ui-select-file/index.html +7 -7
  26. package/bin/website-htmls/components/ui-select-file/index.js +37 -37
  27. package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
  28. package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
  29. package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
  30. package/bin/website-htmls/dialogs/imageSize/index.scss +138 -138
  31. package/bin/website-htmls/dialogs/index.js +52 -52
  32. package/bin/website-htmls/images/addFile.svg +1 -1
  33. package/bin/website-htmls/images/img-to-pdf.svg +1 -1
  34. package/bin/website-htmls/index.html +17 -17
  35. package/bin/website-htmls/main.js +13 -13
  36. package/bin/website-htmls/pages/App/index.html +6 -6
  37. package/bin/website-htmls/pages/App/index.js +22 -22
  38. package/bin/website-htmls/pages/App/index.scss +43 -43
  39. package/bin/website-htmls/pages/appStore/index.html +5 -24
  40. package/bin/website-htmls/pages/appStore/index.js +19 -19
  41. package/bin/website-htmls/pages/appStore/index.scss +6 -4
  42. package/bin/website-htmls/pages/chart/index.html +8 -8
  43. package/bin/website-htmls/pages/chart/index.js +72 -72
  44. package/bin/website-htmls/pages/chart/index.scss +73 -72
  45. package/bin/website-htmls/pages/home/index.html +22 -0
  46. package/bin/website-htmls/pages/home/index.js +20 -0
  47. package/bin/website-htmls/pages/home/index.scss +29 -0
  48. package/bin/website-htmls/pages/image-editor/index.html +27 -27
  49. package/bin/website-htmls/pages/image-editor/index.js +106 -106
  50. package/bin/website-htmls/pages/image-editor/index.scss +47 -45
  51. package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
  52. package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
  53. package/bin/website-htmls/pages/img-to-pdf/index.scss +4 -4
  54. package/bin/website-htmls/router.config.js +26 -19
  55. package/bin/website-htmls/styles/normalize.css +94 -94
  56. package/bin/website-plugins/intercept/chart.js +33 -33
  57. package/bin/website-plugins/intercept/getPackage.js +17 -17
  58. package/bin/website-plugins/intercept/head.js +8 -8
  59. package/bin/website-plugins/intercept/index.js +8 -8
  60. package/bin/website-plugins/intercept/oipage-vislite-intercept.js +30 -30
  61. package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +36 -36
  62. package/bin/website-plugins/loader/index.js +11 -11
  63. package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
  64. package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
  65. package/nodejs/animation/index.d.ts +19 -19
  66. package/nodejs/animation/index.js +112 -112
  67. package/nodejs/cmdlog/index.d.ts +20 -20
  68. package/nodejs/cmdlog/index.js +75 -75
  69. package/nodejs/disk/index.d.ts +47 -47
  70. package/nodejs/disk/index.js +165 -165
  71. package/nodejs/format/index.d.ts +29 -29
  72. package/nodejs/format/index.js +107 -107
  73. package/nodejs/json/index.d.ts +9 -9
  74. package/nodejs/json/index.js +206 -206
  75. package/nodejs/logform/index.d.ts +18 -18
  76. package/nodejs/logform/index.js +94 -94
  77. package/nodejs/reader/index.d.ts +32 -32
  78. package/nodejs/reader/index.js +20 -20
  79. package/nodejs/throttle/index.d.ts +30 -30
  80. package/nodejs/throttle/index.js +50 -50
  81. package/package.json +1 -1
  82. package/web/XMLHttpRequest/index.d.ts +17 -17
  83. package/web/XMLHttpRequest/index.js +60 -60
  84. package/web/animation/index.d.ts +19 -19
  85. package/web/animation/index.js +112 -112
  86. package/web/format/index.d.ts +29 -29
  87. package/web/format/index.js +107 -107
  88. package/web/json/index.d.ts +9 -9
  89. package/web/json/index.js +206 -206
  90. package/web/onReady/index.d.ts +7 -7
  91. package/web/onReady/index.js +8 -8
  92. package/web/performChunk/index.d.ts +4 -4
  93. package/web/performChunk/index.js +19 -19
  94. package/web/reader/index.d.ts +32 -32
  95. package/web/reader/index.js +20 -20
  96. package/web/style/index.d.ts +21 -21
  97. package/web/style/index.js +19 -19
  98. package/web/throttle/index.d.ts +30 -30
  99. package/web/throttle/index.js +50 -50
  100. package/snipping/chart.png +0 -0
  101. package/snipping/image-editor.png +0 -0
@@ -1,95 +1,95 @@
1
- /* 统一不同浏览器的基础样式 */
2
-
3
- html {
4
- /* 防止iPhone在坚屏转向横屏时放大文字 */
5
- -ms-text-size-adjust: 100%;
6
- -webkit-text-size-adjust: 100%;
7
- /* 统一行高 */
8
- line-height: 1.15;
9
- }
10
-
11
- button,
12
- input,
13
- select {
14
- /* 兼容部分手机下border不显示问题 */
15
- border: 1px solid #b2b2bd;
16
- }
17
-
18
- article,
19
- footer,
20
- header,
21
- nav,
22
- section {
23
- /* 修正旧浏览器未定义的块级元素 */
24
- display: block;
25
- }
26
-
27
- canvas,
28
- svg {
29
- /* 修正旧浏览器未定义的行内块元素 */
30
- display: inline-block;
31
- }
32
-
33
- * {
34
- /* 统一不同浏览器盒子尺寸计算方法 */
35
- box-sizing: border-box;
36
- }
37
-
38
- ::-ms-clear,
39
- ::-ms-reveal {
40
- /* 去掉IE浏览器输入框叉叉和眼睛 */
41
- display: none;
42
- }
43
-
44
- img {
45
- /* 针对火狐浏览器在img标签没有src时候的差异修复 */
46
- display: inline-block;
47
- }
48
-
49
- html {
50
- /* 设置默认字体为统一的安全字体 */
51
- font-family: sans-serif;
52
- }
53
-
54
- a {
55
- /* 默认去掉下划线 */
56
- text-decoration: none;
57
- }
58
-
59
- li {
60
- /* 去掉前置索引 */
61
- list-style-type: none;
62
- }
63
-
64
- ul,
65
- ol,
66
- li,
67
- p,
68
- h1,
69
- h2,
70
- h3,
71
- h4,
72
- h5,
73
- h6 {
74
- /* 去掉不喜欢的间距 */
75
- -webkit-margin-before: 0;
76
- -webkit-margin-after: 0;
77
- -webkit-padding-start: 0;
78
- /* 去掉不喜欢的间距,针对火狐浏览器等 */
79
- margin-block-end: 0;
80
- margin-block-start: 0;
81
- padding-inline-start: 0;
82
- /* 修改IE和其它浏览器不一致问题 */
83
- padding: 0;
84
- margin: 0;
85
- }
86
-
87
- body {
88
- /* 去掉默认的8px */
89
- margin: 0;
90
- }
91
-
92
- table {
93
- /* 设置默认表格边框合并为一个单一的边框 */
94
- border-collapse: collapse;
1
+ /* 统一不同浏览器的基础样式 */
2
+
3
+ html {
4
+ /* 防止iPhone在坚屏转向横屏时放大文字 */
5
+ -ms-text-size-adjust: 100%;
6
+ -webkit-text-size-adjust: 100%;
7
+ /* 统一行高 */
8
+ line-height: 1.15;
9
+ }
10
+
11
+ button,
12
+ input,
13
+ select {
14
+ /* 兼容部分手机下border不显示问题 */
15
+ border: 1px solid #b2b2bd;
16
+ }
17
+
18
+ article,
19
+ footer,
20
+ header,
21
+ nav,
22
+ section {
23
+ /* 修正旧浏览器未定义的块级元素 */
24
+ display: block;
25
+ }
26
+
27
+ canvas,
28
+ svg {
29
+ /* 修正旧浏览器未定义的行内块元素 */
30
+ display: inline-block;
31
+ }
32
+
33
+ * {
34
+ /* 统一不同浏览器盒子尺寸计算方法 */
35
+ box-sizing: border-box;
36
+ }
37
+
38
+ ::-ms-clear,
39
+ ::-ms-reveal {
40
+ /* 去掉IE浏览器输入框叉叉和眼睛 */
41
+ display: none;
42
+ }
43
+
44
+ img {
45
+ /* 针对火狐浏览器在img标签没有src时候的差异修复 */
46
+ display: inline-block;
47
+ }
48
+
49
+ html {
50
+ /* 设置默认字体为统一的安全字体 */
51
+ font-family: sans-serif;
52
+ }
53
+
54
+ a {
55
+ /* 默认去掉下划线 */
56
+ text-decoration: none;
57
+ }
58
+
59
+ li {
60
+ /* 去掉前置索引 */
61
+ list-style-type: none;
62
+ }
63
+
64
+ ul,
65
+ ol,
66
+ li,
67
+ p,
68
+ h1,
69
+ h2,
70
+ h3,
71
+ h4,
72
+ h5,
73
+ h6 {
74
+ /* 去掉不喜欢的间距 */
75
+ -webkit-margin-before: 0;
76
+ -webkit-margin-after: 0;
77
+ -webkit-padding-start: 0;
78
+ /* 去掉不喜欢的间距,针对火狐浏览器等 */
79
+ margin-block-end: 0;
80
+ margin-block-start: 0;
81
+ padding-inline-start: 0;
82
+ /* 修改IE和其它浏览器不一致问题 */
83
+ padding: 0;
84
+ margin: 0;
85
+ }
86
+
87
+ body {
88
+ /* 去掉默认的8px */
89
+ margin: 0;
90
+ }
91
+
92
+ table {
93
+ /* 设置默认表格边框合并为一个单一的边框 */
94
+ border-collapse: collapse;
95
95
  }
@@ -1,34 +1,34 @@
1
- const headFactory = require("./head.js");
2
-
3
- const head = headFactory();
4
-
5
- // 聊天
6
- module.exports = {
7
- test: /^\/chart\//,
8
- handler(request, response, wsHandler) {
9
- let url = decodeURIComponent(request.url);
10
-
11
- let requestData = "";
12
-
13
- request.on('data', (chunk) => {
14
- requestData += chunk;
15
- });
16
-
17
- request.on('end', () => {
18
-
19
- if (/sendMsg$/.test(url)) {
20
- wsHandler.notifyBrowser({
21
- payloadData: requestData
22
- });
23
- }
24
-
25
- head["Content-Type"] = "application/json;charset=utf-8";
26
- response.writeHead(200, head);
27
- response.write(JSON.stringify({
28
- code: "000000"
29
- }));
30
- response.end();
31
-
32
- });
33
- }
1
+ const headFactory = require("./head.js");
2
+
3
+ const head = headFactory();
4
+
5
+ // 聊天
6
+ module.exports = {
7
+ test: /^\/chart\//,
8
+ handler(request, response, wsHandler) {
9
+ let url = decodeURIComponent(request.url);
10
+
11
+ let requestData = "";
12
+
13
+ request.on('data', (chunk) => {
14
+ requestData += chunk;
15
+ });
16
+
17
+ request.on('end', () => {
18
+
19
+ if (/sendMsg$/.test(url)) {
20
+ wsHandler.notifyBrowser({
21
+ payloadData: requestData
22
+ });
23
+ }
24
+
25
+ head["Content-Type"] = "application/json;charset=utf-8";
26
+ response.writeHead(200, head);
27
+ response.write(JSON.stringify({
28
+ code: "000000"
29
+ }));
30
+ response.end();
31
+
32
+ });
33
+ }
34
34
  };
@@ -1,18 +1,18 @@
1
- const { readFileSync } = require("fs");
2
- const { join } = require("path");
3
- const { existsSync } = require("fs");
4
-
5
- module.exports = function (filpath) {
6
-
7
- let node_modulesPath = join(__dirname, "../../../node_modules");
8
-
9
- while (!existsSync(join(node_modulesPath, filpath)) && node_modulesPath != join(node_modulesPath, "../")) {
10
- node_modulesPath = join(node_modulesPath, "../");
11
- }
12
-
13
- let source = readFileSync(join(node_modulesPath, filpath), {
14
- encoding: "utf8"
15
- });
16
-
17
- return source;
1
+ const { readFileSync } = require("fs");
2
+ const { join } = require("path");
3
+ const { existsSync } = require("fs");
4
+
5
+ module.exports = function (filpath) {
6
+
7
+ let node_modulesPath = join(__dirname, "../../../node_modules");
8
+
9
+ while (!existsSync(join(node_modulesPath, filpath)) && node_modulesPath != join(node_modulesPath, "../")) {
10
+ node_modulesPath = join(node_modulesPath, "../");
11
+ }
12
+
13
+ let source = readFileSync(join(node_modulesPath, filpath), {
14
+ encoding: "utf8"
15
+ });
16
+
17
+ return source;
18
18
  };
@@ -1,9 +1,9 @@
1
- const pkg = require("../../../package.json");
2
-
3
- module.exports = function () {
4
- return {
5
- 'Access-Control-Allow-Origin': '*',
6
- 'Server': 'Powered by OIPage:website@' + pkg.version,
7
- 'Content-Type': 'text/plain;charset=utf-8'
8
- };
1
+ const pkg = require("../../../package.json");
2
+
3
+ module.exports = function () {
4
+ return {
5
+ 'Access-Control-Allow-Origin': '*',
6
+ 'Server': 'Powered by OIPage:website@' + pkg.version,
7
+ 'Content-Type': 'text/plain;charset=utf-8'
8
+ };
9
9
  };
@@ -1,9 +1,9 @@
1
- const OIPageZipaperIntercept = require("./oipage-zipaper-intercept.js");
2
- const OIPageVISLiteIntercept = require("./oipage-vislite-intercept.js");
3
- const ChartIntercept = require("./chart.js");
4
-
5
- module.exports = [
6
- OIPageZipaperIntercept,
7
- OIPageVISLiteIntercept,
8
- ChartIntercept
1
+ const OIPageZipaperIntercept = require("./oipage-zipaper-intercept.js");
2
+ const OIPageVISLiteIntercept = require("./oipage-vislite-intercept.js");
3
+ const ChartIntercept = require("./chart.js");
4
+
5
+ module.exports = [
6
+ OIPageZipaperIntercept,
7
+ OIPageVISLiteIntercept,
8
+ ChartIntercept
9
9
  ];
@@ -1,31 +1,31 @@
1
- const headFactory = require("./head.js");
2
- const getPackage = require("./getPackage.js");
3
-
4
- const head = headFactory();
5
-
6
- // VISLite库
7
- module.exports = {
8
- test: /^vislite$/,
9
- handler(request, response) {
10
- head["Content-Type"] = "application/javascript;charset=utf-8";
11
- head["ETag"] = "VISLite@v" + require("vislite/package.json").version;
12
-
13
- if (request.headers["if-none-match"] === head["ETag"]) {
14
- response.writeHead('304', head);
15
- response.end();
16
- console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Cache File: VISLite\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
17
- return;
18
- }
19
-
20
- response.writeHead(200, head);
21
-
22
- let source =getPackage("vislite/lib/index.umd.min.js");
23
-
24
- response.write(`let module = { exports: {} };
25
- let exports = module.exports;
26
- ${source}
27
- export let Canvas = module.exports.Canvas;
28
- `);
29
- response.end();
30
- }
1
+ const headFactory = require("./head.js");
2
+ const getPackage = require("./getPackage.js");
3
+
4
+ const head = headFactory();
5
+
6
+ // VISLite库
7
+ module.exports = {
8
+ test: /^vislite$/,
9
+ handler(request, response) {
10
+ head["Content-Type"] = "application/javascript;charset=utf-8";
11
+ head["ETag"] = "VISLite@v" + require("vislite/package.json").version;
12
+
13
+ if (request.headers["if-none-match"] === head["ETag"]) {
14
+ response.writeHead('304', head);
15
+ response.end();
16
+ console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Cache File: VISLite\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
17
+ return;
18
+ }
19
+
20
+ response.writeHead(200, head);
21
+
22
+ let source =getPackage("vislite/lib/index.umd.min.js");
23
+
24
+ response.write(`let module = { exports: {} };
25
+ let exports = module.exports;
26
+ ${source}
27
+ export let Canvas = module.exports.Canvas;
28
+ `);
29
+ response.end();
30
+ }
31
31
  };
@@ -1,37 +1,37 @@
1
- const headFactory = require("./head.js");
2
- const getPackage = require("./getPackage.js");
3
-
4
- const head = headFactory();
5
-
6
- // Zipaper框架
7
- module.exports = {
8
- test: /^zipaper$/,
9
- handler(request, response) {
10
- head["Content-Type"] = "application/javascript;charset=utf-8";
11
- head["ETag"] = "Zipaper@v" + require("zipaper/package.json").version;
12
-
13
- if (request.headers["if-none-match"] === head["ETag"]) {
14
- response.writeHead('304', head);
15
- response.end();
16
- console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Cache File: Zipaper\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
17
- return;
18
- }
19
-
20
- response.writeHead(200, head);
21
-
22
- let source = getPackage("zipaper/dist/Zipaper.min.js");
23
-
24
- response.write(`let module = { exports: {} };
25
- let exports = module.exports;
26
- ${source}
27
- export let createApp = exports.createApp;
28
- export let defineDirective = exports.defineDirective;
29
- export let defineElement = exports.defineElement;
30
- export let defineRouter = exports.defineRouter;
31
- export let ref = exports.ref;
32
- export let reactive = exports.reactive;
33
- export let watcher = exports.watcher;
34
- `);
35
- response.end();
36
- }
1
+ const headFactory = require("./head.js");
2
+ const getPackage = require("./getPackage.js");
3
+
4
+ const head = headFactory();
5
+
6
+ // Zipaper框架
7
+ module.exports = {
8
+ test: /^zipaper$/,
9
+ handler(request, response) {
10
+ head["Content-Type"] = "application/javascript;charset=utf-8";
11
+ head["ETag"] = "Zipaper@v" + require("zipaper/package.json").version;
12
+
13
+ if (request.headers["if-none-match"] === head["ETag"]) {
14
+ response.writeHead('304', head);
15
+ response.end();
16
+ console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Cache File: Zipaper\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
17
+ return;
18
+ }
19
+
20
+ response.writeHead(200, head);
21
+
22
+ let source = getPackage("zipaper/dist/Zipaper.min.js");
23
+
24
+ response.write(`let module = { exports: {} };
25
+ let exports = module.exports;
26
+ ${source}
27
+ export let createApp = exports.createApp;
28
+ export let defineDirective = exports.defineDirective;
29
+ export let defineElement = exports.defineElement;
30
+ export let defineRouter = exports.defineRouter;
31
+ export let ref = exports.ref;
32
+ export let reactive = exports.reactive;
33
+ export let watcher = exports.watcher;
34
+ `);
35
+ response.end();
36
+ }
37
37
  };
@@ -1,12 +1,12 @@
1
- const OIPageScssLoader = require("./oipage-scss-loader.js");
2
- const OIPageHtmlLoader = require("./oipage-html-loader.js");
3
-
4
- module.exports = {
5
- rules: [{
6
- test: /\.scss$/,
7
- use: OIPageScssLoader
8
- }, {
9
- test: /\.html$/,
10
- use: OIPageHtmlLoader
11
- }]
1
+ const OIPageScssLoader = require("./oipage-scss-loader.js");
2
+ const OIPageHtmlLoader = require("./oipage-html-loader.js");
3
+
4
+ module.exports = {
5
+ rules: [{
6
+ test: /\.scss$/,
7
+ use: OIPageScssLoader
8
+ }, {
9
+ test: /\.html$/,
10
+ use: OIPageHtmlLoader
11
+ }]
12
12
  };
@@ -1,8 +1,8 @@
1
- const { parseTemplate } = require("xhtml-to-json");
2
-
3
- module.exports = function (source) {
4
- if (this.entry) return source;
5
-
6
- this.setFileType("application/javascript");
7
- return `export default ${JSON.stringify(parseTemplate(source).toJson())}`;
1
+ const { parseTemplate } = require("xhtml-to-json");
2
+
3
+ module.exports = function (source) {
4
+ if (this.entry) return source;
5
+
6
+ this.setFileType("application/javascript");
7
+ return `export default ${JSON.stringify(parseTemplate(source).toJson())}`;
8
8
  };