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,14 +1,14 @@
1
- import { createApp } from "zipaper"
2
-
3
- import App from "./pages/App/index.js"
4
- import router from "./router.config.js"
5
- import dialogs from "./dialogs/index.js"
6
- import uiSelectFile from "./components/ui-select-file/index.js"
7
-
8
- // https://oi-contrib.github.io/Zipaper/index.html
9
-
10
- createApp(App)
11
- .use(router) // 路由
12
- .use(dialogs) // 弹框
13
- .component("ui-select-file", uiSelectFile)
1
+ import { createApp } from "zipaper"
2
+
3
+ import App from "./pages/App/index.js"
4
+ import router from "./router.config.js"
5
+ import dialogs from "./dialogs/index.js"
6
+ import uiSelectFile from "./components/ui-select-file/index.js"
7
+
8
+ // https://oi-contrib.github.io/Zipaper/index.html
9
+
10
+ createApp(App)
11
+ .use(router) // 路由
12
+ .use(dialogs) // 弹框
13
+ .component("ui-select-file", uiSelectFile)
14
14
  .mount(document.getElementById("root")) // 挂载到页面
@@ -1,7 +1,7 @@
1
- <router></router>
2
- <div id="dialog-root">
3
- <div class="mask" z-on:click="closeDialog"></div>
4
- </div>
5
- <a class="fork" href="https://github.com/oi-contrib/OIPage" target="_blank">
6
- Fork me on Github
1
+ <router></router>
2
+ <div id="dialog-root">
3
+ <div class="mask" z-on:click="closeDialog"></div>
4
+ </div>
5
+ <a class="fork" href="https://github.com/oi-contrib/OIPage" target="_blank">
6
+ Fork me on Github
7
7
  </a>
@@ -1,23 +1,23 @@
1
- import { defineElement } from "zipaper"
2
- import template from "./index.html"
3
- import style from "./index.scss"
4
-
5
- export default defineElement({
6
- template,
7
- data() {
8
- return {
9
-
10
- }
11
- },
12
- methods: {
13
-
14
- // 点击遮罩关闭弹框
15
- closeDialog() {
16
- this.$closeDialog()
17
- }
18
-
19
- },
20
- style: {
21
- content: style
22
- }
1
+ import { defineElement } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+
10
+ }
11
+ },
12
+ methods: {
13
+
14
+ // 点击遮罩关闭弹框
15
+ closeDialog() {
16
+ this.$closeDialog()
17
+ }
18
+
19
+ },
20
+ style: {
21
+ content: style
22
+ }
23
23
  })
@@ -1,44 +1,44 @@
1
- #dialog-root {
2
- width: 0;
3
- height: 0;
4
- position: fixed;
5
- left: 0;
6
- top: 0;
7
- z-index: 101;
8
-
9
- .mask {
10
- width: 100vw;
11
- height: 100vh;
12
- background-color: #0000004f;
13
-
14
- &:last-child {
15
- display: none;
16
- }
17
- }
18
-
19
- .content {
20
- display: none;
21
- position: absolute;
22
- left: 50vw;
23
- top: 50vh;
24
- transform: translateX(-50%) translateY(-50%);
25
-
26
- &:last-child {
27
- display: block;
28
- }
29
- }
30
- }
31
-
32
- .fork {
33
- line-height: 30px;
34
- position: fixed;
35
- background-color: #607D8B;
36
- text-align: center;
37
- color: white;
38
- outline: 2px dashed #607D8B;
39
- width: 200px;
40
- transform: rotate(45deg);
41
- right: -45px;
42
- top: 45px;
43
- z-index: 1;
1
+ #dialog-root {
2
+ width: 0;
3
+ height: 0;
4
+ position: fixed;
5
+ left: 0;
6
+ top: 0;
7
+ z-index: 101;
8
+
9
+ .mask {
10
+ width: 100vw;
11
+ height: 100vh;
12
+ background-color: #0000004f;
13
+
14
+ &:last-child {
15
+ display: none;
16
+ }
17
+ }
18
+
19
+ .content {
20
+ display: none;
21
+ position: absolute;
22
+ left: 50vw;
23
+ top: 50vh;
24
+ transform: translateX(-50%) translateY(-50%);
25
+
26
+ &:last-child {
27
+ display: block;
28
+ }
29
+ }
30
+ }
31
+
32
+ .fork {
33
+ line-height: 30px;
34
+ position: fixed;
35
+ background-color: #607D8B;
36
+ text-align: center;
37
+ color: white;
38
+ outline: 2px dashed #607D8B;
39
+ width: 200px;
40
+ transform: rotate(45deg);
41
+ right: -45px;
42
+ top: 45px;
43
+ z-index: 1;
44
44
  }
@@ -1,25 +1,6 @@
1
- <div class="appstore-view">
2
- <header>
3
- 应用市场
4
- </header>
5
- <ul>
6
- <li z-on:click.prevent="goto" tag="chart">
7
- <img src="./images/chart.png" />
8
- <h2>
9
- 群聊天
10
- </h2>
11
- </li>
12
- <li z-on:click="goto" tag="image-editor">
13
- <img src="./images/image-editor.png" />
14
- <h2>
15
- 图片编辑器
16
- </h2>
17
- </li>
18
- <li z-on:click="goto" tag="img-to-pdf">
19
- <img src="./images/img-to-pdf.svg" />
20
- <h2>
21
- 图片转PDF
22
- </h2>
23
- </li>
24
- </ul>
1
+ <div class="appstore-view">
2
+ <header>
3
+ 应用市场
4
+ </header>
5
+ <router></router>
25
6
  </div>
@@ -1,20 +1,20 @@
1
- import { defineElement, ref } from "zipaper"
2
- import template from "./index.html"
3
- import style from "./index.scss"
4
-
5
- export default defineElement({
6
- template,
7
- data() {
8
- return {
9
-
10
- }
11
- },
12
- methods: {
13
- goto(event, target) {
14
- this.$goto("/" + target.getAttribute("tag"))
15
- }
16
- },
17
- style: {
18
- content: style
19
- }
1
+ import { defineElement, ref } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+
10
+ }
11
+ },
12
+ methods: {
13
+ goto(event, target) {
14
+ this.$goto("/" + target.getAttribute("tag"))
15
+ }
16
+ },
17
+ style: {
18
+ content: style
19
+ }
20
20
  })
@@ -15,12 +15,14 @@
15
15
  }
16
16
 
17
17
  ul {
18
- text-align: center;
19
- padding: 50px 0;
18
+ text-align: left;
19
+ padding: 20px 10px;
20
20
 
21
21
  &>li {
22
+ text-align: center;
22
23
  display: inline-block;
23
- margin: 0 10px;
24
+ margin: 10px;
25
+ width: 90px;
24
26
 
25
27
  &:hover {
26
28
  text-decoration: underline;
@@ -29,7 +31,7 @@
29
31
 
30
32
  &>img {
31
33
  border-radius: 10px;
32
- width: 70px;
34
+ width: 50px;
33
35
  }
34
36
 
35
37
  &>h2 {
@@ -1,9 +1,9 @@
1
- <form z-on:submit.prevent="doSubmit">
2
- <div class="chart-view">
3
- <div class="content" id="chart-content-id"></div>
4
- <div class="input">
5
- <input placeholder="请输入内容......" z-model="msg" spellcheck="false" autocomplete="off" />
6
- <button type="submit">发送</button>
7
- </div>
8
- </div>
1
+ <form z-on:submit.prevent="doSubmit">
2
+ <div class="chart-view">
3
+ <div class="content" id="chart-content-id"></div>
4
+ <div class="input">
5
+ <input placeholder="请输入内容......" z-model="msg" spellcheck="false" autocomplete="off" />
6
+ <button type="submit">发送</button>
7
+ </div>
8
+ </div>
9
9
  </form>
@@ -1,73 +1,73 @@
1
- import { defineElement, ref } from "zipaper"
2
- import template from "./index.html"
3
- import style from "./index.scss"
4
-
5
- export default defineElement({
6
- template,
7
- data() {
8
- return {
9
- uniqueid: new Date().valueOf() + "#" + (Math.random() * 10000).toFixed(0),
10
- msg: ref("")
11
- }
12
- },
13
- created() {
14
-
15
- let ws = new WebSocket('ws://' + window.location.hostname + ':' + (+window.location.port + 1) + '/');
16
-
17
- // 连接成功
18
- ws.addEventListener('open', () => {
19
- ws.send('客户端和服务器建立连接成功!(' + this.uniqueid + ')');
20
- });
21
-
22
- // 监听来自服务器的数据
23
- ws.addEventListener('message', (event) => {
24
- let data = JSON.parse(event.data);
25
-
26
- let contentEl = document.getElementById("chart-content-id");
27
-
28
- let itemEl = document.createElement("div");
29
- contentEl.appendChild(itemEl);
30
-
31
- itemEl.setAttribute("class", "item");
32
-
33
- if (data.uniqueid === this.uniqueid) {
34
- itemEl.setAttribute("tag", "sender");
35
- } else {
36
- itemEl.setAttribute("tag", "receiver");
37
- }
38
-
39
- let textEl = document.createElement("div");
40
- textEl.innerText = data.msg;
41
- itemEl.appendChild(textEl);
42
- textEl.setAttribute("class", "text");
43
-
44
- itemEl.scrollIntoView({
45
- behavior: 'smooth',
46
- block: 'end',
47
- inline: 'nearest'
48
- });
49
- });
50
-
51
- },
52
- methods: {
53
- doSubmit() {
54
- fetch("./chart/sendMsg", {
55
- method: "POST",
56
- headers: {
57
- "Content-Type": "application/json;charset=utf-8"
58
- },
59
- body: JSON.stringify({
60
- msg: this.msg,
61
- uniqueid: this.uniqueid
62
- })
63
- }).then(() => {
64
- this.msg = "";
65
- }).catch(() => {
66
- alert("发送失败!");
67
- });
68
- }
69
- },
70
- style: {
71
- content: style
72
- }
1
+ import { defineElement, ref } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+ uniqueid: new Date().valueOf() + "#" + (Math.random() * 10000).toFixed(0),
10
+ msg: ref("")
11
+ }
12
+ },
13
+ created() {
14
+
15
+ let ws = new WebSocket('ws://' + window.location.hostname + ':' + (+window.location.port + 1) + '/');
16
+
17
+ // 连接成功
18
+ ws.addEventListener('open', () => {
19
+ ws.send('客户端和服务器建立连接成功!(' + this.uniqueid + ')');
20
+ });
21
+
22
+ // 监听来自服务器的数据
23
+ ws.addEventListener('message', (event) => {
24
+ let data = JSON.parse(event.data);
25
+
26
+ let contentEl = document.getElementById("chart-content-id");
27
+
28
+ let itemEl = document.createElement("div");
29
+ contentEl.appendChild(itemEl);
30
+
31
+ itemEl.setAttribute("class", "item");
32
+
33
+ if (data.uniqueid === this.uniqueid) {
34
+ itemEl.setAttribute("tag", "sender");
35
+ } else {
36
+ itemEl.setAttribute("tag", "receiver");
37
+ }
38
+
39
+ let textEl = document.createElement("div");
40
+ textEl.innerText = data.msg;
41
+ itemEl.appendChild(textEl);
42
+ textEl.setAttribute("class", "text");
43
+
44
+ itemEl.scrollIntoView({
45
+ behavior: 'smooth',
46
+ block: 'end',
47
+ inline: 'nearest'
48
+ });
49
+ });
50
+
51
+ },
52
+ methods: {
53
+ doSubmit() {
54
+ fetch("./chart/sendMsg", {
55
+ method: "POST",
56
+ headers: {
57
+ "Content-Type": "application/json;charset=utf-8"
58
+ },
59
+ body: JSON.stringify({
60
+ msg: this.msg,
61
+ uniqueid: this.uniqueid
62
+ })
63
+ }).then(() => {
64
+ this.msg = "";
65
+ }).catch(() => {
66
+ alert("发送失败!");
67
+ });
68
+ }
69
+ },
70
+ style: {
71
+ content: style
72
+ }
73
73
  })
@@ -1,73 +1,74 @@
1
- .chart-view {
2
- &>.content {
3
- position: fixed;
4
- width: 350px;
5
- height: calc(100% - 130px);
6
- border: 2px solid #000000;
7
- left: 50%;
8
- top: 50px;
9
- transform: translateX(-50%);
10
- padding: 5px;
11
- overflow: auto;
12
-
13
- &::-webkit-scrollbar {
14
- width: 0;
15
- height: 0;
16
- }
17
-
18
- &>.item {
19
- display: flex;
20
- padding: 5px;
21
-
22
- &[tag="sender"] {
23
- flex-direction: row-reverse;
24
- padding-left: 50px;
25
- }
26
-
27
- &[tag="receiver"] {
28
- flex-direction: row;
29
- padding-right: 50px;
30
- }
31
-
32
- &>.text {
33
- background-color: #dfdbdb;
34
- padding: 5px;
35
- width: fit-content;
36
- border-radius: 5px;
37
- font-size: 12px;
38
- }
39
- }
40
- }
41
-
42
- &>.input {
43
- position: fixed;
44
- width: 350px;
45
- height: 30px;
46
- left: 50%;
47
- bottom: 50px;
48
- transform: translateX(-50%);
49
- display: flex;
50
-
51
- &>input {
52
- flex-grow: 1;
53
- resize: none;
54
- outline: none;
55
- border: 2px solid #000000;
56
- border-top-width: 0;
57
- border-radius: 0;
58
- }
59
-
60
- &>button {
61
- width: 70px;
62
- cursor: pointer;
63
- background-color: #000000;
64
- color: white;
65
- outline: none;
66
- border: none;
67
-
68
- &:hover {
69
- text-decoration: underline;
70
- }
71
- }
72
- }
1
+ .chart-view {
2
+ &>.content {
3
+ position: fixed;
4
+ width: 350px;
5
+ height: calc(100% - 150px);
6
+ border: 2px solid #000000;
7
+ left: 50%;
8
+ top: 100px;
9
+ transform: translateX(-50%);
10
+ padding: 5px;
11
+ overflow: auto;
12
+ border-radius: 10px 10px 0 0;
13
+
14
+ &::-webkit-scrollbar {
15
+ width: 0;
16
+ height: 0;
17
+ }
18
+
19
+ &>.item {
20
+ display: flex;
21
+ padding: 5px;
22
+
23
+ &[tag="sender"] {
24
+ flex-direction: row-reverse;
25
+ padding-left: 50px;
26
+ }
27
+
28
+ &[tag="receiver"] {
29
+ flex-direction: row;
30
+ padding-right: 50px;
31
+ }
32
+
33
+ &>.text {
34
+ background-color: #dfdbdb;
35
+ padding: 5px;
36
+ width: fit-content;
37
+ border-radius: 5px;
38
+ font-size: 12px;
39
+ }
40
+ }
41
+ }
42
+
43
+ &>.input {
44
+ position: fixed;
45
+ width: 350px;
46
+ height: 30px;
47
+ left: 50%;
48
+ bottom: 50px;
49
+ transform: translateX(-50%);
50
+ display: flex;
51
+
52
+ &>input {
53
+ flex-grow: 1;
54
+ resize: none;
55
+ outline: none;
56
+ border: 2px solid #000000;
57
+ border-top-width: 0;
58
+ border-radius: 0;
59
+ }
60
+
61
+ &>button {
62
+ width: 70px;
63
+ cursor: pointer;
64
+ background-color: #000000;
65
+ color: white;
66
+ outline: none;
67
+ border: none;
68
+
69
+ &:hover {
70
+ text-decoration: underline;
71
+ }
72
+ }
73
+ }
73
74
  }
@@ -0,0 +1,22 @@
1
+ <div class="home-view">
2
+ <ul>
3
+ <li z-on:click.prevent="goto" tag="chart">
4
+ <img src="./images/chart.png" />
5
+ <h2>
6
+ 群聊天
7
+ </h2>
8
+ </li>
9
+ <li z-on:click="goto" tag="image-editor">
10
+ <img src="./images/image-editor.png" />
11
+ <h2>
12
+ 图片编辑器
13
+ </h2>
14
+ </li>
15
+ <li z-on:click="goto" tag="img-to-pdf">
16
+ <img src="./images/img-to-pdf.svg" />
17
+ <h2>
18
+ 图片转PDF
19
+ </h2>
20
+ </li>
21
+ </ul>
22
+ </div>
@@ -0,0 +1,20 @@
1
+ import { defineElement, ref } from "zipaper"
2
+ import template from "./index.html"
3
+ import style from "./index.scss"
4
+
5
+ export default defineElement({
6
+ template,
7
+ data() {
8
+ return {
9
+
10
+ }
11
+ },
12
+ methods: {
13
+ goto(event, target) {
14
+ this.$goto("/appStore/" + target.getAttribute("tag"))
15
+ }
16
+ },
17
+ style: {
18
+ content: style
19
+ }
20
+ })
@@ -0,0 +1,29 @@
1
+ .home-view {
2
+ ul {
3
+ text-align: left;
4
+ padding: 20px 10px;
5
+
6
+ &>li {
7
+ text-align: center;
8
+ display: inline-block;
9
+ margin: 10px;
10
+ width: 90px;
11
+
12
+ &:hover {
13
+ text-decoration: underline;
14
+ cursor: pointer;
15
+ }
16
+
17
+ &>img {
18
+ border-radius: 10px;
19
+ width: 50px;
20
+ }
21
+
22
+ &>h2 {
23
+ font-size: 14px;
24
+ line-height: 2em;
25
+ }
26
+ }
27
+ }
28
+
29
+ }