@oipage/cli 0.3.0-alpha.4 → 0.3.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 (74) hide show
  1. package/.github/FUNDING.yml +11 -11
  2. package/AUTHORS.txt +6 -6
  3. package/CHANGELOG +47 -47
  4. package/LICENSE +20 -20
  5. package/README.md +132 -132
  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 +106 -106
  10. package/bin/data/mineTypes.json +104 -104
  11. package/bin/disk.js +42 -42
  12. package/bin/help.js +55 -55
  13. package/bin/intercept.js +15 -15
  14. package/bin/network.js +21 -21
  15. package/bin/notebook/index.js +8 -8
  16. package/bin/proxy.js +82 -82
  17. package/bin/run +146 -146
  18. package/bin/serve.js +318 -318
  19. package/bin/template/404.html +184 -184
  20. package/bin/tools/deleteEmptyFolder.js +33 -33
  21. package/bin/tools/format.js +75 -75
  22. package/bin/tools/isBinary.js +83 -83
  23. package/bin/tools/network.js +42 -42
  24. package/bin/tools/openBrowser.js +34 -34
  25. package/bin/tools/resolve404.js +98 -98
  26. package/bin/tools/resolveImport.js +96 -96
  27. package/bin/website-htmls/components/ui-select-file/index.html +8 -8
  28. package/bin/website-htmls/components/ui-select-file/index.js +42 -42
  29. package/bin/website-htmls/components/ui-select-file/index.scss +44 -44
  30. package/bin/website-htmls/dialogs/imageSize/index.html +54 -54
  31. package/bin/website-htmls/dialogs/imageSize/index.js +53 -53
  32. package/bin/website-htmls/dialogs/imageSize/index.scss +140 -140
  33. package/bin/website-htmls/dialogs/index.js +52 -52
  34. package/bin/website-htmls/images/addFile.svg +1 -1
  35. package/bin/website-htmls/images/img-to-pdf.svg +1 -1
  36. package/bin/website-htmls/index.html +17 -17
  37. package/bin/website-htmls/main.js +13 -13
  38. package/bin/website-htmls/pages/App/index.html +6 -6
  39. package/bin/website-htmls/pages/App/index.js +22 -22
  40. package/bin/website-htmls/pages/App/index.scss +43 -43
  41. package/bin/website-htmls/pages/appStore/index.html +7 -7
  42. package/bin/website-htmls/pages/appStore/index.js +19 -19
  43. package/bin/website-htmls/pages/appStore/index.scss +54 -54
  44. package/bin/website-htmls/pages/chart/index.html +8 -8
  45. package/bin/website-htmls/pages/chart/index.js +72 -72
  46. package/bin/website-htmls/pages/chart/index.scss +71 -71
  47. package/bin/website-htmls/pages/home/index.html +19 -19
  48. package/bin/website-htmls/pages/home/index.js +19 -19
  49. package/bin/website-htmls/pages/home/index.scss +87 -87
  50. package/bin/website-htmls/pages/image-editor/index.html +27 -27
  51. package/bin/website-htmls/pages/image-editor/index.js +106 -106
  52. package/bin/website-htmls/pages/image-editor/index.scss +69 -69
  53. package/bin/website-htmls/pages/img-to-pdf/index.html +3 -3
  54. package/bin/website-htmls/pages/img-to-pdf/index.js +44 -44
  55. package/bin/website-htmls/pages/img-to-pdf/index.scss +9 -9
  56. package/bin/website-htmls/pages/recorder-screen/index.html +15 -15
  57. package/bin/website-htmls/pages/recorder-screen/index.js +227 -227
  58. package/bin/website-htmls/pages/recorder-screen/index.scss +52 -52
  59. package/bin/website-htmls/router.config.js +29 -29
  60. package/bin/website-htmls/styles/common.css +44 -44
  61. package/bin/website-htmls/styles/normalize.css +94 -94
  62. package/bin/website-plugins/intercept/chart.js +33 -33
  63. package/bin/website-plugins/intercept/getPackage.js +17 -17
  64. package/bin/website-plugins/intercept/head.js +8 -8
  65. package/bin/website-plugins/intercept/index.js +8 -8
  66. package/bin/website-plugins/intercept/oipage-vislite-intercept.js +55 -55
  67. package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +36 -36
  68. package/bin/website-plugins/loader/index.js +11 -11
  69. package/bin/website-plugins/loader/oipage-html-loader.js +7 -7
  70. package/bin/website-plugins/loader/oipage-scss-loader.js +149 -149
  71. package/docs/config.md +106 -106
  72. package/package.json +42 -42
  73. package/src/index.js +29 -29
  74. package/types/serve.d.ts +83 -83
@@ -1,55 +1,55 @@
1
- .appstore-view {
2
-
3
- header {
4
- height: 50px;
5
- line-height: 50px;
6
- background-color: white;
7
- box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
8
- background-image: url("./images/logo.png");
9
- background-size: auto 90%;
10
- background-repeat: no-repeat;
11
- background-position-x: 5px;
12
- padding-left: 55px;
13
- font-size: 18px;
14
- user-select: none;
15
-
16
- &>.btn {
17
- display: inline-block;
18
- cursor: pointer;
19
- font-weight: 400;
20
-
21
- &:hover {
22
- text-decoration: underline;
23
- font-weight: 800;
24
- }
25
- }
26
- }
27
-
28
- ul {
29
- text-align: left;
30
- padding: 20px 10px;
31
-
32
- &>li {
33
- text-align: center;
34
- display: inline-block;
35
- margin: 10px;
36
- width: 90px;
37
-
38
- &:hover {
39
- text-decoration: underline;
40
- cursor: pointer;
41
- }
42
-
43
- &>img {
44
- border-radius: 10px;
45
- width: 50px;
46
- }
47
-
48
- &>h2 {
49
- font-size: 14px;
50
- line-height: 2em;
51
- }
52
- }
53
- }
54
-
1
+ .appstore-view {
2
+
3
+ header {
4
+ height: 50px;
5
+ line-height: 50px;
6
+ background-color: white;
7
+ box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px;
8
+ background-image: url("./images/logo.png");
9
+ background-size: auto 90%;
10
+ background-repeat: no-repeat;
11
+ background-position-x: 5px;
12
+ padding-left: 55px;
13
+ font-size: 18px;
14
+ user-select: none;
15
+
16
+ &>.btn {
17
+ display: inline-block;
18
+ cursor: pointer;
19
+ font-weight: 400;
20
+
21
+ &:hover {
22
+ text-decoration: underline;
23
+ font-weight: 800;
24
+ }
25
+ }
26
+ }
27
+
28
+ ul {
29
+ text-align: left;
30
+ padding: 20px 10px;
31
+
32
+ &>li {
33
+ text-align: center;
34
+ display: inline-block;
35
+ margin: 10px;
36
+ width: 90px;
37
+
38
+ &:hover {
39
+ text-decoration: underline;
40
+ cursor: pointer;
41
+ }
42
+
43
+ &>img {
44
+ border-radius: 10px;
45
+ width: 50px;
46
+ }
47
+
48
+ &>h2 {
49
+ font-size: 14px;
50
+ line-height: 2em;
51
+ }
52
+ }
53
+ }
54
+
55
55
  }
@@ -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,72 +1,72 @@
1
- .chart-view {
2
- padding: 20px 12px 90px;
3
- box-sizing: border-box;
4
-
5
- .content {
6
- margin: 0 auto 12px;
7
- max-width: 720px;
8
- height: calc(100vh - 200px);
9
- background: #ffffff;
10
- border-radius: 12px;
11
- padding: 12px;
12
- overflow: auto;
13
- box-shadow: 0 8px 20px rgba(15,23,42,0.06);
14
- }
15
-
16
- .content::-webkit-scrollbar { width: 8px; }
17
- .content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 8px; }
18
-
19
- .item {
20
- display: flex;
21
- margin: 8px 0;
22
- width: 100%;
23
- justify-content: flex-start;
24
- }
25
-
26
- .item[tag="sender"] { justify-content: flex-end; }
27
-
28
- .item .text {
29
- background-color: #eef2ff;
30
- padding: 8px 12px;
31
- max-width: 68%;
32
- border-radius: 12px;
33
- font-size: 14px;
34
- word-break: break-word;
35
- }
36
-
37
- .item[tag="sender"] .text { background-color: #dcfce7; }
38
-
39
- .input {
40
- position: fixed;
41
- left: 50%;
42
- transform: translateX(-50%);
43
- bottom: 18px;
44
- width: calc(100% - 32px);
45
- max-width: 720px;
46
- display: flex;
47
- gap: 8px;
48
- background: transparent;
49
- }
50
-
51
- .input > input {
52
- flex: 1;
53
- border: 1px solid #e6e9ee;
54
- border-radius: 10px;
55
- padding: 8px 12px;
56
- box-sizing: border-box;
57
- }
58
-
59
- .input > button {
60
- width: 84px;
61
- border-radius: 10px;
62
- background: #111827;
63
- color: #fff;
64
- border: none;
65
- }
66
-
67
- @media (max-width: 480px) {
68
- .content { height: calc(100vh - 180px); padding: 10px; }
69
- .item .text { max-width: 78%; font-size: 13px; }
70
- .input { width: calc(100% - 24px); bottom: 12px; }
71
- }
1
+ .chart-view {
2
+ padding: 20px 12px 90px;
3
+ box-sizing: border-box;
4
+
5
+ .content {
6
+ margin: 0 auto 12px;
7
+ max-width: 720px;
8
+ height: calc(100vh - 200px);
9
+ background: #ffffff;
10
+ border-radius: 12px;
11
+ padding: 12px;
12
+ overflow: auto;
13
+ box-shadow: 0 8px 20px rgba(15,23,42,0.06);
14
+ }
15
+
16
+ .content::-webkit-scrollbar { width: 8px; }
17
+ .content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 8px; }
18
+
19
+ .item {
20
+ display: flex;
21
+ margin: 8px 0;
22
+ width: 100%;
23
+ justify-content: flex-start;
24
+ }
25
+
26
+ .item[tag="sender"] { justify-content: flex-end; }
27
+
28
+ .item .text {
29
+ background-color: #eef2ff;
30
+ padding: 8px 12px;
31
+ max-width: 68%;
32
+ border-radius: 12px;
33
+ font-size: 14px;
34
+ word-break: break-word;
35
+ }
36
+
37
+ .item[tag="sender"] .text { background-color: #dcfce7; }
38
+
39
+ .input {
40
+ position: fixed;
41
+ left: 50%;
42
+ transform: translateX(-50%);
43
+ bottom: 18px;
44
+ width: calc(100% - 32px);
45
+ max-width: 720px;
46
+ display: flex;
47
+ gap: 8px;
48
+ background: transparent;
49
+ }
50
+
51
+ .input > input {
52
+ flex: 1;
53
+ border: 1px solid #e6e9ee;
54
+ border-radius: 10px;
55
+ padding: 8px 12px;
56
+ box-sizing: border-box;
57
+ }
58
+
59
+ .input > button {
60
+ width: 84px;
61
+ border-radius: 10px;
62
+ background: #111827;
63
+ color: #fff;
64
+ border: none;
65
+ }
66
+
67
+ @media (max-width: 480px) {
68
+ .content { height: calc(100vh - 180px); padding: 10px; }
69
+ .item .text { max-width: 78%; font-size: 13px; }
70
+ .input { width: calc(100% - 24px); bottom: 12px; }
71
+ }
72
72
  }
@@ -1,20 +1,20 @@
1
- <div class="home-view">
2
- <ul role="list" class="home-list">
3
- <li role="listitem" z-on:click.prevent="goto" tag="chart">
4
- <img src="./images/chart.png" alt="群聊天" />
5
- <h2>群聊天</h2>
6
- </li>
7
- <li role="listitem" z-on:click="goto" tag="image-editor">
8
- <img src="./images/image-editor.png" alt="图片编辑器" />
9
- <h2>图片编辑器</h2>
10
- </li>
11
- <li role="listitem" z-on:click="goto" tag="img-to-pdf">
12
- <img src="./images/img-to-pdf.svg" alt="图片转PDF" />
13
- <h2>图片转PDF</h2>
14
- </li>
15
- <li role="listitem" z-on:click="goto" tag="recorder-screen">
16
- <img src="./images/recorder-screen.png" alt="屏幕录制" />
17
- <h2>屏幕录制</h2>
18
- </li>
19
- </ul>
1
+ <div class="home-view">
2
+ <ul role="list" class="home-list">
3
+ <li role="listitem" z-on:click.prevent="goto" tag="chart">
4
+ <img src="./images/chart.png" alt="群聊天" />
5
+ <h2>群聊天</h2>
6
+ </li>
7
+ <li role="listitem" z-on:click="goto" tag="image-editor">
8
+ <img src="./images/image-editor.png" alt="图片编辑器" />
9
+ <h2>图片编辑器</h2>
10
+ </li>
11
+ <li role="listitem" z-on:click="goto" tag="img-to-pdf">
12
+ <img src="./images/img-to-pdf.svg" alt="图片转PDF" />
13
+ <h2>图片转PDF</h2>
14
+ </li>
15
+ <li role="listitem" z-on:click="goto" tag="recorder-screen">
16
+ <img src="./images/recorder-screen.png" alt="屏幕录制" />
17
+ <h2>屏幕录制</h2>
18
+ </li>
19
+ </ul>
20
20
  </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("/appStore/" + 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("/appStore/" + target.getAttribute("tag"))
15
+ }
16
+ },
17
+ style: {
18
+ content: style
19
+ }
20
20
  })
@@ -1,88 +1,88 @@
1
- .home-view {
2
- max-width: 1100px;
3
- margin: 0 auto;
4
- padding: 24px 16px;
5
- box-sizing: border-box;
6
-
7
- ul {
8
- display: flex;
9
- flex-wrap: wrap;
10
- gap: 16px;
11
- justify-content: center;
12
- padding: 0;
13
- margin: 0;
14
- list-style: none;
15
- }
16
-
17
- ul > li {
18
- background: #ffffff;
19
- border-radius: 12px;
20
- box-shadow: 0 6px 18px rgba(15,23,42,0.06);
21
- padding: 14px;
22
- width: calc(50% - 16px);
23
- max-width: 130px;
24
- text-align: center;
25
- cursor: pointer;
26
- transition: transform .18s ease, box-shadow .18s ease;
27
- display: flex;
28
- flex-direction: column;
29
- align-items: center;
30
- gap: 8px;
31
- }
32
-
33
- ul > li:hover {
34
- transform: translateY(-6px);
35
- box-shadow: 0 10px 26px rgba(15,23,42,0.12);
36
- text-decoration: none;
37
- }
38
-
39
- ul > li > img {
40
- border-radius: 10px;
41
- width: 64px;
42
- height: 64px;
43
- object-fit: cover;
44
- }
45
-
46
- ul > li > h2 {
47
- font-size: 14px;
48
- line-height: 1.2;
49
- margin: 0;
50
- color: #111827;
51
- font-weight: 600;
52
- }
53
-
54
- @media (min-width: 768px) {
55
- ul > li {
56
- width: calc(33.333% - 16px);
57
- }
58
- }
59
-
60
- @media (min-width: 1024px) {
61
- ul > li {
62
- width: calc(25% - 16px);
63
- }
64
- }
65
-
66
- @media (max-width: 420px) {
67
- padding: 12px;
68
- ul > li {
69
- width: 100%;
70
- max-width: none;
71
- flex-direction: row;
72
- align-items: center;
73
- gap: 12px;
74
- padding: 12px;
75
- }
76
-
77
- ul > li > img {
78
- width: 48px;
79
- height: 48px;
80
- }
81
-
82
- ul > li > h2 {
83
- text-align: left;
84
- font-size: 15px;
85
- }
86
- }
87
-
1
+ .home-view {
2
+ max-width: 1100px;
3
+ margin: 0 auto;
4
+ padding: 24px 16px;
5
+ box-sizing: border-box;
6
+
7
+ ul {
8
+ display: flex;
9
+ flex-wrap: wrap;
10
+ gap: 16px;
11
+ justify-content: center;
12
+ padding: 0;
13
+ margin: 0;
14
+ list-style: none;
15
+ }
16
+
17
+ ul > li {
18
+ background: #ffffff;
19
+ border-radius: 12px;
20
+ box-shadow: 0 6px 18px rgba(15,23,42,0.06);
21
+ padding: 14px;
22
+ width: calc(50% - 16px);
23
+ max-width: 130px;
24
+ text-align: center;
25
+ cursor: pointer;
26
+ transition: transform .18s ease, box-shadow .18s ease;
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ gap: 8px;
31
+ }
32
+
33
+ ul > li:hover {
34
+ transform: translateY(-6px);
35
+ box-shadow: 0 10px 26px rgba(15,23,42,0.12);
36
+ text-decoration: none;
37
+ }
38
+
39
+ ul > li > img {
40
+ border-radius: 10px;
41
+ width: 64px;
42
+ height: 64px;
43
+ object-fit: cover;
44
+ }
45
+
46
+ ul > li > h2 {
47
+ font-size: 14px;
48
+ line-height: 1.2;
49
+ margin: 0;
50
+ color: #111827;
51
+ font-weight: 600;
52
+ }
53
+
54
+ @media (min-width: 768px) {
55
+ ul > li {
56
+ width: calc(33.333% - 16px);
57
+ }
58
+ }
59
+
60
+ @media (min-width: 1024px) {
61
+ ul > li {
62
+ width: calc(25% - 16px);
63
+ }
64
+ }
65
+
66
+ @media (max-width: 420px) {
67
+ padding: 12px;
68
+ ul > li {
69
+ width: 100%;
70
+ max-width: none;
71
+ flex-direction: row;
72
+ align-items: center;
73
+ gap: 12px;
74
+ padding: 12px;
75
+ }
76
+
77
+ ul > li > img {
78
+ width: 48px;
79
+ height: 48px;
80
+ }
81
+
82
+ ul > li > h2 {
83
+ text-align: left;
84
+ font-size: 15px;
85
+ }
86
+ }
87
+
88
88
  }