clickgo 3.0.2-dev3 → 3.0.5-dev6

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/README.md CHANGED
@@ -5,10 +5,10 @@
5
5
  [![npm version](https://img.shields.io/npm/v/clickgo.svg?colorB=brightgreen)](https://www.npmjs.com/package/clickgo "Stable Version")
6
6
  [![npm version](https://img.shields.io/npm/v/clickgo/dev.svg)](https://www.npmjs.com/package/clickgo "Development Version")
7
7
  [![npm version](https://img.shields.io/npm/v/clickgo/beta.svg)](https://www.npmjs.com/package/clickgo "Beta Version")
8
- [![License](https://img.shields.io/github/license/maiyun/ClickGo.svg)](https://github.com/MaiyunNET/ClickGo/blob/master/LICENSE)
9
- [![GitHub issues](https://img.shields.io/github/issues/maiyun/ClickGo.svg)](https://github.com/MaiyunNET/ClickGo/issues)
10
- [![GitHub Releases](https://img.shields.io/github/release/maiyun/ClickGo.svg)](https://github.com/MaiyunNET/ClickGo/releases "Stable Release")
11
- [![GitHub Pre-Releases](https://img.shields.io/github/release/maiyun/ClickGo/all.svg)](https://github.com/MaiyunNET/ClickGo/releases "Pre-Release")
8
+ [![License](https://img.shields.io/github/license/maiyun/clickgo.svg)](https://github.com/maiyun/clickgo/blob/master/LICENSE)
9
+ [![GitHub issues](https://img.shields.io/github/issues/maiyun/clickgo.svg)](https://github.com/maiyun/clickgo/issues)
10
+ [![GitHub Releases](https://img.shields.io/github/release/maiyun/clickgo.svg)](https://github.com/maiyun/clickgo/releases "Stable Release")
11
+ [![GitHub Pre-Releases](https://img.shields.io/github/release/maiyun/clickgo/all.svg)](https://github.com/maiyun/clickgo/releases "Pre-Release")
12
12
 
13
13
  Quickly and easily create a beautiful console interface.
14
14
 
@@ -19,7 +19,7 @@ Load the module loader first, and then load it using the module loader.
19
19
  **index.html**
20
20
 
21
21
  ```html
22
- <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.2.0/dist/loader.min.js?path=index"></script>
22
+ <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.3.0/dist/loader.min.js?path=index&npm={'clickgo':'3.0.5-dev6'}"></script>
23
23
  ```
24
24
 
25
25
  **index.js**
package/dist/clickgo.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zip = exports.tool = exports.theme = exports.task = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.vue = exports.getCdn = exports.setCdn = exports.getSafe = exports.setSafe = exports.getPlatform = exports.getNative = exports.getVersion = void 0;
3
+ exports.zip = exports.tool = exports.theme = exports.task = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.vue = exports.getSafe = exports.setSafe = exports.getPlatform = exports.getNative = exports.getVersion = void 0;
4
4
  const version = '3.0.0';
5
5
  function getVersion() {
6
6
  return version;
@@ -31,15 +31,6 @@ function getSafe() {
31
31
  return safe;
32
32
  }
33
33
  exports.getSafe = getSafe;
34
- let cdn = '';
35
- function setCdn(val) {
36
- cdn = val;
37
- }
38
- exports.setCdn = setCdn;
39
- function getCdn() {
40
- return cdn;
41
- }
42
- exports.getCdn = getCdn;
43
34
  exports.vue = window.Vue;
44
35
  exports.control = require("./lib/control");
45
36
  exports.core = require("./lib/core");
package/dist/clickgo.ts CHANGED
@@ -42,14 +42,6 @@ export function getSafe(): boolean {
42
42
  return safe;
43
43
  }
44
44
 
45
- let cdn = '';
46
- export function setCdn(val: string): void {
47
- cdn = val;
48
- }
49
- export function getCdn(): string {
50
- return cdn;
51
- }
52
-
53
45
  export const vue: import('../types/index').IVueObject = (window as any).Vue;
54
46
 
55
47
  export * as control from './lib/control';
Binary file
package/dist/global.css CHANGED
@@ -1 +1 @@
1
- #cg-wrap{--cg:hsl(20, 100%, 65%);--success:hsl(150, 100%, 40%);--success-hover:hsl(150, 100%, 45%);--success-active:hsl(150, 100%, 30%);--success-focus:hsl(150, 100%, 35%);--success-disabled:hsl(150, 0%, 40%);--info:hsl(210, 100%, 50%);--info-hover:hsl(210, 100%, 60%);--info-active:hsl(210, 100%, 40%);--info-focus:hsl(210, 100%, 45%);--info-disabled:hsl(210, 0%, 50%);--warning:hsl(20, 100%, 70%);--warning-hover:hsl(20, 100%, 80%);--warning-active:hsl(20, 100%, 60%);--warning-focus:hsl(20, 100%, 65%);--warning-disabled:hsl(20, 0%, 70%);--danger:hsl(350, 100%, 50%);--danger-hover:hsl(350, 100%, 70%);--danger-active:hsl(350, 100%, 40%);--danger-focus:hsl(350, 100%, 45%);--danger-disabled:hsl(350, 0%, 50%);--system-color:hsl(0, 0%, 95%);--system-background:hsla(0, 0%, 0%, .5);--face:hsl(0, 0%, 95%);--g-color:hsl(0, 0%, 20%);--g-color-hover:hsl(0, 0%, 30%);--g-color-active:hsl(0, 0%, 10%);--g-color-focus:hsl(0, 0%, 15%);--g-color-disabled:hsl(0, 0%, 60%);--g-background:hsl(0, 0%, 95%);--g-background-hover:hsl(0, 0%, 100%);--g-background-active:hsl(0, 0%, 85%);--g-background-kp:hsl(0, 0%, 80%);--g-background-opacity:hsl(0, 0%, 50%, .2);--g-background-focus:hsl(0, 0%, 97.5%);--g-background-disabled:hsl(0, 0%, 75%);--g-border-color:hsl(0, 0%, 40%);--g-border-color-hover:hsl(0, 0%, 50%);--g-border-color-active:hsl(0, 0%, 30%);--g-border-color-focus:hsl(0, 0%, 35%);--g-border-color-disabled:hsl(0, 0%, 60%);--g-plain-color:var(--g-color);--g-plain-color-hover:var(--g-color-hover);--g-plain-color-active:var(--g-color-active);--g-plain-color-focus:var(--g-color-focus);--g-plain-color-disabled:var(--g-color-disabled);--g-plain-background:hsl(0, 0%, 100%);--g-plain-background-hover:hsl(0, 0%, 98%);--g-plain-background-active:hsl(0, 0%, 95%);--g-plain-background-focus:var(--g-plain-background);--g-plain-background-disabled:hsl(0, 0%, 95%);--g-plain-border-color:hsl(0, 0%, 70%);--g-plain-border-color-hover:hsl(0, 0%, 80%);--g-plain-border-color-active:hsl(0, 0%, 60%);--g-plain-border-color-focus:hsl(0, 0%, 65%);--g-plain-border-color-disabled:hsl(0, 0%, 60%)}#cg-form-list{z-index:20020000}#cg-pop-list{z-index:20020001}#cg-simpletask{z-index:20020002}#cg-system{z-index:20020003}#cg-rectangle{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:3px;box-shadow:0 0 10px rgba(0,0,0,.25);background:rgba(255,255,255,.05);pointer-events:none;opacity:0}#cg-circular{z-index:20020004;box-sizing:border-box;position:fixed;border:solid 3px var(--cg);border-radius:50%;filter:drop-shadow(0 0 3px var(--cg));pointer-events:none;opacity:0}#cg-gesture{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:50%;pointer-events:none;opacity:0;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);transform:scale(0);width:20px;height:20px}#cg-gesture.done{background:rgba(255,255,255,.3);border:solid 3px rgba(0,0,0,.3)}#cg-drag{box-sizing:border-box;position:fixed;border-radius:3px;z-index:20020004;pointer-events:none;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);opacity:0;display:flex;justify-content:center;align-items:center}[data-cg-pop]{position:fixed;box-shadow:0px 5px 20px rgba(0,0,0,.25);transition:.1s ease-out;transition-property:transform,opacity;transform:translateY(-10px);opacity:0}[data-cg-pop]:not([data-cg-open]){pointer-events:none}[data-cg-pop][data-cg-open]{transform:translateY(0px);opacity:1}.cg-system-notify{background:var(--system-background);position:fixed;padding:15px;border-radius:3px;right:0;top:0;width:280px;font-size:14px;display:flex;transition:.1s ease-out;transition-property:transform,opacity;overflow:hidden;color:#f6f6f6;box-shadow:0 5px 20px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1)}.cg-system-icon{margin-right:10px;width:16px;height:16px;border-radius:50%}.cg-system-icon.cg-primary{background:var(--success)}.cg-system-icon.cg-info{background:var(--info)}.cg-system-icon.cg-warning{background:var(--warning)}.cg-system-icon.cg-danger{background:var(--danger)}.cg-system-icon.cg-progress{background:var(--cg)}.cg-system-notify-title{font-size:16px;font-weight:bold;padding-bottom:10px}.cg-system-notify-content{line-height:1.5;word-break:break-word}.cg-system-notify-progress{position:absolute;bottom:0;left:0;border-radius:1px;background:var(--cg);transition:width 1s ease-out;width:0%;height:2px}#cg-simpletask{bottom:-46px;width:100%;height:46px;top:initial;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1);padding:5px 0 5px 5px;display:flex;color:var(--system-color);transition:bottom .1s ease-out;overflow-x:auto}#cg-simpletask::-webkit-scrollbar{display:none}.cg-simpletask-item{background:rgba(0,0,0,.05);border-radius:3px;padding:10px;display:flex;align-items:center;margin-right:5px}.cg-simpletask-item:hover{background:rgba(0,0,0,.1)}.cg-simpletask-item:active{background:rgba(0,0,0,.2)}.cg-simpletask-icon{margin-right:5px;background-size:cover;width:16px;height:16px}
1
+ #cg-wrap{--cg:hsl(20, 100%, 65%);--success:hsl(150, 100%, 40%);--success-hover:hsl(150, 100%, 45%);--success-active:hsl(150, 100%, 30%);--success-focus:hsl(150, 100%, 35%);--success-disabled:hsl(150, 0%, 40%);--info:hsl(210, 100%, 50%);--info-hover:hsl(210, 100%, 60%);--info-active:hsl(210, 100%, 40%);--info-focus:hsl(210, 100%, 45%);--info-disabled:hsl(210, 0%, 50%);--warning:hsl(20, 100%, 70%);--warning-hover:hsl(20, 100%, 80%);--warning-active:hsl(20, 100%, 60%);--warning-focus:hsl(20, 100%, 65%);--warning-disabled:hsl(20, 0%, 70%);--danger:hsl(350, 100%, 50%);--danger-hover:hsl(350, 100%, 70%);--danger-active:hsl(350, 100%, 40%);--danger-focus:hsl(350, 100%, 45%);--danger-disabled:hsl(350, 0%, 50%);--system-color:hsl(0, 0%, 95%);--system-background:hsla(0, 0%, 0%, .5);--face:hsl(0, 0%, 95%);--g-color:hsl(0, 0%, 20%);--g-color-hover:hsl(0, 0%, 30%);--g-color-active:hsl(0, 0%, 10%);--g-color-focus:hsl(0, 0%, 15%);--g-color-disabled:hsl(0, 0%, 60%);--g-background:hsl(0, 0%, 95%);--g-background-hover:hsl(0, 0%, 100%);--g-background-active:hsl(0, 0%, 85%);--g-background-kp:hsl(0, 0%, 80%);--g-background-opacity:hsl(0, 0%, 50%, .2);--g-background-focus:hsl(0, 0%, 97.5%);--g-background-disabled:hsl(0, 0%, 75%);--g-border-color:hsl(0, 0%, 40%);--g-border-color-hover:hsl(0, 0%, 50%);--g-border-color-active:hsl(0, 0%, 30%);--g-border-color-focus:hsl(0, 0%, 35%);--g-border-color-disabled:hsl(0, 0%, 60%);--g-plain-color:var(--g-color);--g-plain-color-hover:var(--g-color-hover);--g-plain-color-active:var(--g-color-active);--g-plain-color-focus:var(--g-color-focus);--g-plain-color-disabled:var(--g-color-disabled);--g-plain-background:hsl(0, 0%, 100%);--g-plain-background-hover:hsl(0, 0%, 98%);--g-plain-background-active:hsl(0, 0%, 95%);--g-plain-background-focus:var(--g-plain-background);--g-plain-background-disabled:hsl(0, 0%, 95%);--g-plain-border-color:hsl(0, 0%, 70%);--g-plain-border-color-hover:hsl(0, 0%, 80%);--g-plain-border-color-active:hsl(0, 0%, 60%);--g-plain-border-color-focus:hsl(0, 0%, 65%);--g-plain-border-color-disabled:hsl(0, 0%, 60%)}#cg-form-list{z-index:20020000}#cg-pop-list{z-index:20020001}#cg-simpletask{z-index:20020002}#cg-system{z-index:20020003}#cg-rectangle{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:3px;box-shadow:0 0 10px rgba(0,0,0,.25);background:rgba(255,255,255,.05);pointer-events:none;opacity:0}#cg-circular{z-index:20020004;box-sizing:border-box;position:fixed;border:solid 3px var(--cg);border-radius:50%;filter:drop-shadow(0 0 3px var(--cg));pointer-events:none;opacity:0}#cg-gesture{z-index:20020004;box-sizing:border-box;position:fixed;border-radius:50%;pointer-events:none;opacity:0;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);transform:scale(0);width:20px;height:20px}#cg-gesture.done{background:rgba(255,255,255,.3);border:solid 3px rgba(0,0,0,.3)}#cg-drag{box-sizing:border-box;position:fixed;border-radius:3px;z-index:20020004;pointer-events:none;background:var(--system-background);box-shadow:0 5px 20px rgba(0,0,0,.25);opacity:0;display:flex;justify-content:center;align-items:center}[data-cg-pop]{position:fixed;box-shadow:0px 5px 20px rgba(0,0,0,.25);transition:.1s ease-out;transition-property:transform,opacity;transform:translateY(-10px);opacity:0}[data-cg-pop]:not([data-cg-open]){pointer-events:none}[data-cg-pop][data-cg-open]{transform:translateY(0px);opacity:1}.cg-system-notify{background:var(--system-background);position:fixed;padding:15px;border-radius:3px;right:0;top:0;width:280px;font-size:14px;display:flex;transition:.1s ease-out;transition-property:transform,opacity;overflow:hidden;color:#f6f6f6;box-shadow:0 5px 20px rgba(0,0,0,.25);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1)}.cg-system-icon{margin-right:10px;width:16px;height:16px;border-radius:50%}.cg-system-icon.cg-primary{background:var(--success)}.cg-system-icon.cg-info{background:var(--info)}.cg-system-icon.cg-warning{background:var(--warning)}.cg-system-icon.cg-danger{background:var(--danger)}.cg-system-icon.cg-progress{background:var(--cg)}.cg-system-notify-title{font-size:16px;font-weight:bold;padding-bottom:10px}.cg-system-notify-content{line-height:1.5;word-break:break-word}.cg-system-notify-progress{position:absolute;bottom:0;left:0;border-radius:1px;background:var(--cg);transition:width 1s ease-out;width:0%;height:2px}#cg-simpletask{left:0;bottom:-46px;width:100%;height:46px;top:initial;background:var(--system-background);-webkit-backdrop-filter:blur(30px) brightness(1.1);backdrop-filter:blur(30px) brightness(1.1);padding:5px 0 5px 5px;display:flex;color:var(--system-color);transition:bottom .1s ease-out;overflow-x:auto}#cg-simpletask::-webkit-scrollbar{display:none}.cg-simpletask-item{background:rgba(0,0,0,.05);border-radius:3px;padding:10px;display:flex;align-items:center;margin-right:5px}.cg-simpletask-item:hover{background:rgba(0,0,0,.1)}.cg-simpletask-item:active{background:rgba(0,0,0,.2)}.cg-simpletask-icon{margin-right:5px;background-size:cover;width:16px;height:16px}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.init = exports.getCdn = exports.setCdn = exports.getSafe = exports.setSafe = exports.getPlatform = exports.getNative = exports.getVersion = exports.vue = exports.zip = exports.tool = exports.theme = exports.task = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.clickgo = void 0;
12
+ exports.init = exports.getSafe = exports.setSafe = exports.getPlatform = exports.getNative = exports.getVersion = exports.vue = exports.zip = exports.tool = exports.theme = exports.task = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.clickgo = void 0;
13
13
  function getVersion() {
14
14
  return exports.clickgo.getVersion();
15
15
  }
@@ -30,24 +30,16 @@ function getSafe() {
30
30
  return exports.clickgo.getSafe();
31
31
  }
32
32
  exports.getSafe = getSafe;
33
- function setCdn(val) {
34
- exports.clickgo.setCdn(val);
35
- }
36
- exports.setCdn = setCdn;
37
- function getCdn() {
38
- return exports.clickgo.getCdn();
39
- }
40
- exports.getCdn = getCdn;
41
- function init(cdn = 'https://cdn.jsdelivr.net') {
33
+ function init() {
42
34
  var _a;
43
35
  return __awaiter(this, void 0, void 0, function* () {
44
36
  const paths = [
45
- cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
37
+ loader.cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
46
38
  ];
47
39
  let ro = true;
48
40
  if (!(window.ResizeObserver)) {
49
41
  ro = false;
50
- paths.push(cdn + '/npm/@juggle/resize-observer@3.3.1/lib/exports/resize-observer.umd.min.js');
42
+ paths.push(loader.cdn + '/npm/@juggle/resize-observer@3.3.1/lib/exports/resize-observer.umd.min.js');
51
43
  }
52
44
  yield loader.loadScripts(paths);
53
45
  if (!ro) {
@@ -55,22 +47,21 @@ function init(cdn = 'https://cdn.jsdelivr.net') {
55
47
  window.ResizeObserver = window.ResizeObserver.ResizeObserver;
56
48
  }
57
49
  const map = {
58
- 'jszip': cdn + '/npm/jszip@3.10.0/dist/jszip.min'
50
+ 'jszip': loader.cdn + '/npm/jszip@3.10.0/dist/jszip.min'
59
51
  };
60
52
  const after = '?' + Math.random().toString();
61
53
  const files = yield loader.sniffFiles('clickgo.js', {
62
54
  'dir': __dirname + '/',
63
55
  'after': after,
64
- 'afterIgnore': new RegExp('^' + cdn.replace(/\./g, '\\.')),
56
+ 'afterIgnore': new RegExp('^' + loader.cdn.replace(/\./g, '\\.')),
65
57
  'map': map
66
58
  });
67
59
  const cg = loader.require('clickgo', files, {
68
60
  'dir': __dirname + '/',
69
61
  'map': map
70
62
  })[0];
71
- cg.setCdn(cdn);
72
63
  try {
73
- const style = yield (yield fetch(__dirname + '/global.css' + (!__dirname.startsWith(cdn) ? after : ''))).text();
64
+ const style = yield (yield fetch(__dirname + '/global.css' + (!__dirname.startsWith(loader.cdn) ? after : ''))).text();
74
65
  (_a = document.getElementById('cg-global')) === null || _a === void 0 ? void 0 : _a.insertAdjacentHTML('afterbegin', style);
75
66
  }
76
67
  catch (_b) {
package/dist/index.ts CHANGED
@@ -33,24 +33,17 @@ export function getSafe(): boolean {
33
33
  return clickgo.getSafe();
34
34
  }
35
35
 
36
- export function setCdn(val: string): void {
37
- clickgo.setCdn(val);
38
- }
39
- export function getCdn(): string {
40
- return clickgo.getCdn();
41
- }
42
-
43
- export async function init(cdn: string = 'https://cdn.jsdelivr.net'): Promise<void> {
36
+ export async function init(): Promise<void> {
44
37
  // --- 通过标签加载库 ---
45
38
  const paths: string[] = [
46
- cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
39
+ loader.cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
47
40
  ];
48
41
  // --- 判断 ResizeObserver 是否存在 ---
49
42
  let ro = true;
50
43
  // ResizeObserver = undefined;
51
44
  if (!((window as any).ResizeObserver)) {
52
45
  ro = false;
53
- paths.push(cdn + '/npm/@juggle/resize-observer@3.3.1/lib/exports/resize-observer.umd.min.js');
46
+ paths.push(loader.cdn + '/npm/@juggle/resize-observer@3.3.1/lib/exports/resize-observer.umd.min.js');
54
47
  }
55
48
  // --- 加载 vue 以及必要库 ---
56
49
  await loader.loadScripts(paths);
@@ -61,24 +54,23 @@ export async function init(cdn: string = 'https://cdn.jsdelivr.net'): Promise<vo
61
54
  }
62
55
  // --- map 加载库 ---
63
56
  const map: Record<string, string> = {
64
- 'jszip': cdn + '/npm/jszip@3.10.0/dist/jszip.min'
57
+ 'jszip': loader.cdn + '/npm/jszip@3.10.0/dist/jszip.min'
65
58
  };
66
59
  // --- 加载 clickgo 主程序 ---
67
60
  const after = '?' + Math.random().toString();
68
61
  const files = await loader.sniffFiles('clickgo.js', {
69
62
  'dir': __dirname + '/',
70
63
  'after': after,
71
- 'afterIgnore': new RegExp('^' + cdn.replace(/\./g, '\\.')),
64
+ 'afterIgnore': new RegExp('^' + loader.cdn.replace(/\./g, '\\.')),
72
65
  'map': map
73
66
  });
74
67
  const cg = loader.require('clickgo', files, {
75
68
  'dir': __dirname + '/',
76
69
  'map': map
77
70
  })[0] as typeof import('../dist/clickgo');
78
- cg.setCdn(cdn);
79
71
  // --- 加载 clickgo 的 global css ---
80
72
  try {
81
- const style = await (await fetch(__dirname + '/global.css' + (!__dirname.startsWith(cdn) ? after : ''))).text();
73
+ const style = await (await fetch(__dirname + '/global.css' + (!__dirname.startsWith(loader.cdn) ? after : ''))).text();
82
74
  document.getElementById('cg-global')?.insertAdjacentHTML('afterbegin', style);
83
75
  }
84
76
  catch {
package/dist/lib/core.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.removeSystemEventListener = exports.setSystemEventListener = exports.globalEvents = exports.getModule = exports.initModules = exports.regModule = exports.config = void 0;
12
+ exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.removeSystemEventListener = exports.setSystemEventListener = exports.globalEvents = exports.getModule = exports.initModules = exports.regModule = exports.cdn = exports.config = void 0;
13
13
  const clickgo = require("../clickgo");
14
14
  const fs = require("./fs");
15
15
  const form = require("./form");
@@ -34,6 +34,7 @@ exports.config = clickgo.vue.reactive({
34
34
  'desktop.wallpaper': null,
35
35
  'desktop.path': null
36
36
  });
37
+ exports.cdn = '';
37
38
  clickgo.vue.watch(exports.config, function () {
38
39
  for (const key in configOrigin) {
39
40
  if (exports.config[key] !== undefined) {
@@ -87,7 +88,7 @@ const modules = {
87
88
  func: function () {
88
89
  return __awaiter(this, void 0, void 0, function* () {
89
90
  return new Promise(function (resolve, reject) {
90
- fetch(clickgo.getCdn() + '/npm/monaco-editor@0.33.0/min/vs/loader.js').then(function (r) {
91
+ fetch(loader.cdn + '/npm/monaco-editor@0.33.0/min/vs/loader.js').then(function (r) {
91
92
  return r.blob();
92
93
  }).then(function (b) {
93
94
  return tool.blob2DataUrl(b);
@@ -496,7 +497,6 @@ function fetchApp(url, opt = {}) {
496
497
  if (!opt.current.endsWith('/')) {
497
498
  return null;
498
499
  }
499
- current = opt.current.slice(0, -1);
500
500
  if (!url.startsWith('/')) {
501
501
  url = '/current/' + url;
502
502
  }
@@ -505,11 +505,10 @@ function fetchApp(url, opt = {}) {
505
505
  if (!url.startsWith('/clickgo/') && !url.startsWith('/storage/') && !url.startsWith('/mounted/')) {
506
506
  current = tool.urlResolve(window.location.href, url);
507
507
  if (cga) {
508
- current = current.slice(0, -cga.length - 1);
508
+ current = current.slice(0, -cga.length);
509
509
  url = '/current/' + cga;
510
510
  }
511
511
  else {
512
- current = current.slice(0, -1);
513
512
  url = '/current/';
514
513
  }
515
514
  }
@@ -556,6 +555,7 @@ function fetchApp(url, opt = {}) {
556
555
  fs.getContent(url + file.slice(1), {
557
556
  'current': current
558
557
  }).then(function (blob) {
558
+ var _a;
559
559
  return __awaiter(this, void 0, void 0, function* () {
560
560
  if (blob === null || typeof blob === 'string') {
561
561
  clickgo.form.notify({
@@ -573,6 +573,7 @@ function fetchApp(url, opt = {}) {
573
573
  files[file] = blob;
574
574
  }
575
575
  ++loaded;
576
+ (_a = opt.progress) === null || _a === void 0 ? void 0 : _a.call(opt, loaded, total);
576
577
  if (opt.notifyId) {
577
578
  form.notifyProgress(opt.notifyId, loaded / total);
578
579
  }
@@ -582,7 +583,9 @@ function fetchApp(url, opt = {}) {
582
583
  resolve();
583
584
  });
584
585
  }).catch(function () {
586
+ var _a;
585
587
  ++loaded;
588
+ (_a = opt.progress) === null || _a === void 0 ? void 0 : _a.call(opt, loaded, total);
586
589
  if (opt.notifyId) {
587
590
  form.notifyProgress(opt.notifyId, loaded / total);
588
591
  }
@@ -615,8 +618,8 @@ function getAvailArea() {
615
618
  return {
616
619
  'left': 0,
617
620
  'top': 0,
618
- 'width': document.body.clientWidth,
619
- 'height': document.body.clientHeight - 46
621
+ 'width': window.innerWidth,
622
+ 'height': window.innerHeight - 46
620
623
  };
621
624
  }
622
625
  else {
@@ -628,29 +631,29 @@ function getAvailArea() {
628
631
  case 'left': {
629
632
  left = task.systemTaskInfo.length;
630
633
  top = 0;
631
- width = document.body.clientWidth - task.systemTaskInfo.length;
632
- height = document.body.clientHeight;
634
+ width = window.innerWidth - task.systemTaskInfo.length;
635
+ height = window.innerHeight;
633
636
  break;
634
637
  }
635
638
  case 'right': {
636
639
  left = 0;
637
640
  top = 0;
638
- width = document.body.clientWidth - task.systemTaskInfo.length;
639
- height = document.body.clientHeight;
641
+ width = window.innerWidth - task.systemTaskInfo.length;
642
+ height = window.innerHeight;
640
643
  break;
641
644
  }
642
645
  case 'top': {
643
646
  left = 0;
644
647
  top = task.systemTaskInfo.length;
645
- width = document.body.clientWidth;
646
- height = document.body.clientHeight - task.systemTaskInfo.length;
648
+ width = window.innerWidth;
649
+ height = window.innerHeight - task.systemTaskInfo.length;
647
650
  break;
648
651
  }
649
652
  case 'bottom': {
650
653
  left = 0;
651
654
  top = 0;
652
- width = document.body.clientWidth;
653
- height = document.body.clientHeight - task.systemTaskInfo.length;
655
+ width = window.innerWidth;
656
+ height = window.innerHeight - task.systemTaskInfo.length;
654
657
  }
655
658
  }
656
659
  return {
package/dist/lib/core.ts CHANGED
@@ -40,6 +40,8 @@ export const config: types.IConfig = clickgo.vue.reactive({
40
40
  'desktop.path': null
41
41
  });
42
42
 
43
+ export const cdn = '';
44
+
43
45
  clickgo.vue.watch(config, function() {
44
46
  // --- 检测有没有缺少的 config key ---
45
47
  for (const key in configOrigin) {
@@ -97,7 +99,7 @@ const modules: Record<string, { func: () => any | Promise<any>; 'obj': null | an
97
99
  'monaco': {
98
100
  func: async function() {
99
101
  return new Promise(function(resolve, reject) {
100
- fetch(clickgo.getCdn() + '/npm/monaco-editor@0.33.0/min/vs/loader.js').then(function(r) {
102
+ fetch(loader.cdn + '/npm/monaco-editor@0.33.0/min/vs/loader.js').then(function(r) {
101
103
  return r.blob();
102
104
  }).then(function(b) {
103
105
  return tool.blob2DataUrl(b);
@@ -538,7 +540,7 @@ export async function readApp(blob: Blob): Promise<false | types.IApp> {
538
540
  /**
539
541
  * --- 从网址下载应用,App 模式下本方法不可用 ---
540
542
  * @param url 对于当前网页的相对、绝对路径,以 / 结尾的目录或 .cga 结尾的文件 ---
541
- * @param opt,notifyId:显示进度条的 notify id,current:设置则以设置的为准,否则以 location 为准 ---
543
+ * @param opt,notifyId:显示进度条的 notify id,current:设置则以设置的为准,以 / 结尾,否则以 location 为准 ---
542
544
  */
543
545
  export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}): Promise<null | types.IApp> {
544
546
  /** --- 若是 cga 文件,则是 cga 的文件名,含 .cga --- */
@@ -556,7 +558,6 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
556
558
  if (!opt.current.endsWith('/')) {
557
559
  return null;
558
560
  }
559
- current = opt.current.slice(0, -1);
560
561
  if (!url.startsWith('/')) {
561
562
  url = '/current/' + url;
562
563
  }
@@ -565,11 +566,10 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
565
566
  if (!url.startsWith('/clickgo/') && !url.startsWith('/storage/') && !url.startsWith('/mounted/')) {
566
567
  current = tool.urlResolve(window.location.href, url);
567
568
  if (cga) {
568
- current = current.slice(0, -cga.length - 1);
569
+ current = current.slice(0, -cga.length);
569
570
  url = '/current/' + cga;
570
571
  }
571
572
  else {
572
- current = current.slice(0, -1);
573
573
  url = '/current/';
574
574
  }
575
575
  }
@@ -637,6 +637,7 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
637
637
  files[file] = blob;
638
638
  }
639
639
  ++loaded;
640
+ opt.progress?.(loaded, total) as unknown;
640
641
  if (opt.notifyId) {
641
642
  form.notifyProgress(opt.notifyId, loaded / total);
642
643
  }
@@ -646,6 +647,7 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
646
647
  resolve();
647
648
  }).catch(function() {
648
649
  ++loaded;
650
+ opt.progress?.(loaded, total) as unknown;
649
651
  if (opt.notifyId) {
650
652
  form.notifyProgress(opt.notifyId, loaded / total);
651
653
  }
@@ -680,8 +682,8 @@ export function getAvailArea(): types.IAvailArea {
680
682
  return {
681
683
  'left': 0,
682
684
  'top': 0,
683
- 'width': document.body.clientWidth,
684
- 'height': document.body.clientHeight - 46
685
+ 'width': window.innerWidth,
686
+ 'height': window.innerHeight - 46
685
687
  };
686
688
  }
687
689
  else {
@@ -693,29 +695,29 @@ export function getAvailArea(): types.IAvailArea {
693
695
  case 'left': {
694
696
  left = task.systemTaskInfo.length;
695
697
  top = 0;
696
- width = document.body.clientWidth - task.systemTaskInfo.length;
697
- height = document.body.clientHeight;
698
+ width = window.innerWidth - task.systemTaskInfo.length;
699
+ height = window.innerHeight;
698
700
  break;
699
701
  }
700
702
  case 'right': {
701
703
  left = 0;
702
704
  top = 0;
703
- width = document.body.clientWidth - task.systemTaskInfo.length;
704
- height = document.body.clientHeight;
705
+ width = window.innerWidth - task.systemTaskInfo.length;
706
+ height = window.innerHeight;
705
707
  break;
706
708
  }
707
709
  case 'top': {
708
710
  left = 0;
709
711
  top = task.systemTaskInfo.length;
710
- width = document.body.clientWidth;
711
- height = document.body.clientHeight - task.systemTaskInfo.length;
712
+ width = window.innerWidth;
713
+ height = window.innerHeight - task.systemTaskInfo.length;
712
714
  break;
713
715
  }
714
716
  case 'bottom': {
715
717
  left = 0;
716
718
  top = 0;
717
- width = document.body.clientWidth;
718
- height = document.body.clientHeight - task.systemTaskInfo.length;
719
+ width = window.innerWidth;
720
+ height = window.innerHeight - task.systemTaskInfo.length;
719
721
  }
720
722
  }
721
723
  return {
package/dist/lib/form.js CHANGED
@@ -781,7 +781,7 @@ function showPop(el, pop, direction, opt = {}) {
781
781
  left = bcr.left + bcr.width - 2;
782
782
  top = bcr.top - 2;
783
783
  }
784
- if (width + left > document.body.clientWidth) {
784
+ if (width + left > window.innerWidth) {
785
785
  if (direction === 'v') {
786
786
  left = bcr.left + bcr.width - width;
787
787
  }
@@ -789,7 +789,7 @@ function showPop(el, pop, direction, opt = {}) {
789
789
  left = bcr.left - width + 2;
790
790
  }
791
791
  }
792
- if (height + top > document.body.clientHeight) {
792
+ if (height + top > window.innerHeight) {
793
793
  if (direction === 'v') {
794
794
  top = bcr.top - height;
795
795
  }
@@ -815,10 +815,10 @@ function showPop(el, pop, direction, opt = {}) {
815
815
  }
816
816
  left = x + 5;
817
817
  top = y + 7;
818
- if (width + left > document.body.clientWidth) {
818
+ if (width + left > window.innerWidth) {
819
819
  left = x - width - 5;
820
820
  }
821
- if (height + top > document.body.clientHeight) {
821
+ if (height + top > window.innerHeight) {
822
822
  top = y - height - 5;
823
823
  }
824
824
  }
@@ -1101,9 +1101,6 @@ function create(opt) {
1101
1101
  getSafe() {
1102
1102
  return clickgo.getSafe();
1103
1103
  },
1104
- getCdn() {
1105
- return clickgo.getCdn();
1106
- },
1107
1104
  'control': {
1108
1105
  read: function (blob) {
1109
1106
  return clickgo.control.read(blob);
@@ -1111,6 +1108,7 @@ function create(opt) {
1111
1108
  },
1112
1109
  'core': {
1113
1110
  'config': clickgo.core.config,
1111
+ 'cdn': loader.cdn,
1114
1112
  initModules: function (names) {
1115
1113
  return clickgo.core.initModules(names);
1116
1114
  },
package/dist/lib/form.ts CHANGED
@@ -1000,7 +1000,7 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
1000
1000
  top = bcr.top - 2;
1001
1001
  }
1002
1002
  // --- 检查水平是否出框 ---
1003
- if (width + left > document.body.clientWidth) {
1003
+ if (width + left > window.innerWidth) {
1004
1004
  if (direction === 'v') {
1005
1005
  // --- 垂直弹出 ---
1006
1006
  left = bcr.left + bcr.width - width;
@@ -1011,7 +1011,7 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
1011
1011
  }
1012
1012
  }
1013
1013
  // --- 检测垂直是否出框 ---
1014
- if (height + top > document.body.clientHeight) {
1014
+ if (height + top > window.innerHeight) {
1015
1015
  if (direction === 'v') {
1016
1016
  top = bcr.top - height;
1017
1017
  }
@@ -1038,11 +1038,11 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
1038
1038
  left = x + 5;
1039
1039
  top = y + 7;
1040
1040
  // --- 水平 ---
1041
- if (width + left > document.body.clientWidth) {
1041
+ if (width + left > window.innerWidth) {
1042
1042
  left = x - width - 5;
1043
1043
  }
1044
1044
  // --- 垂直 ---
1045
- if (height + top > document.body.clientHeight) {
1045
+ if (height + top > window.innerHeight) {
1046
1046
  top = y - height - 5;
1047
1047
  }
1048
1048
  }
@@ -1377,9 +1377,6 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
1377
1377
  getSafe(): boolean {
1378
1378
  return clickgo.getSafe();
1379
1379
  },
1380
- getCdn(): string {
1381
- return clickgo.getCdn();
1382
- },
1383
1380
  'control': {
1384
1381
  read: function(blob: Blob): Promise<false | types.TControl> {
1385
1382
  return clickgo.control.read(blob);
@@ -1387,6 +1384,7 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
1387
1384
  },
1388
1385
  'core': {
1389
1386
  'config': clickgo.core.config,
1387
+ 'cdn': loader.cdn,
1390
1388
  initModules: function(names: string | string[]): Promise<number> {
1391
1389
  return clickgo.core.initModules(names);
1392
1390
  },
package/dist/lib/task.js CHANGED
@@ -170,7 +170,8 @@ function run(url, opt = {}) {
170
170
  }) : undefined;
171
171
  const app = yield core.fetchApp(url, {
172
172
  'notifyId': notifyId,
173
- 'current': ntask ? ntask.path : undefined
173
+ 'current': ntask ? ntask.path : undefined,
174
+ 'progress': opt.progress
174
175
  });
175
176
  if (notifyId) {
176
177
  setTimeout(function () {
@@ -276,13 +277,6 @@ function run(url, opt = {}) {
276
277
  core.trigger('taskEnded', task.id);
277
278
  return f - 100;
278
279
  }
279
- if (clickgo.getNative() && opt.sync) {
280
- f.vroot.$refs.form.isNativeSync = true;
281
- window.addEventListener('resize', function () {
282
- f.vroot.$refs.form.setPropData('width', window.innerWidth);
283
- f.vroot.$refs.form.setPropData('height', window.innerHeight);
284
- });
285
- }
286
280
  if (app.config.style && app.files[app.config.style + '.css']) {
287
281
  const style = app.files[app.config.style + '.css'];
288
282
  const r = tool.stylePrepend(style, 'cg-task' + task.id.toString() + '_');
@@ -313,6 +307,18 @@ function run(url, opt = {}) {
313
307
  if (task.id === 1) {
314
308
  clickgo.native.send('cg-init', clickgo.native.getToken());
315
309
  }
310
+ if (clickgo.getNative() && opt.sync) {
311
+ f.vroot.$refs.form.isNativeSync = true;
312
+ clickgo.native.send('cg-set-size', JSON.stringify({
313
+ 'token': clickgo.native.getToken(),
314
+ 'width': f.vroot.$refs.form.widthData,
315
+ 'height': f.vroot.$refs.form.heightData
316
+ }));
317
+ window.addEventListener('resize', function () {
318
+ f.vroot.$refs.form.setPropData('width', window.innerWidth);
319
+ f.vroot.$refs.form.setPropData('height', window.innerHeight);
320
+ });
321
+ }
316
322
  return task.id;
317
323
  });
318
324
  }
@@ -656,12 +662,12 @@ function refreshSystemPosition() {
656
662
  case 'left':
657
663
  case 'right': {
658
664
  form.vroot.$refs.form.setPropData('width', 'auto');
659
- form.vroot.$refs.form.setPropData('height', document.body.clientHeight);
665
+ form.vroot.$refs.form.setPropData('height', window.innerHeight);
660
666
  break;
661
667
  }
662
668
  case 'top':
663
669
  case 'bottom': {
664
- form.vroot.$refs.form.setPropData('width', document.body.clientWidth);
670
+ form.vroot.$refs.form.setPropData('width', window.innerWidth);
665
671
  form.vroot.$refs.form.setPropData('height', 'auto');
666
672
  break;
667
673
  }
@@ -676,7 +682,7 @@ function refreshSystemPosition() {
676
682
  }
677
683
  case 'right': {
678
684
  exports.systemTaskInfo.length = form.vroot.$el.offsetWidth;
679
- form.vroot.$refs.form.setPropData('left', document.body.clientWidth - exports.systemTaskInfo.length);
685
+ form.vroot.$refs.form.setPropData('left', window.innerWidth - exports.systemTaskInfo.length);
680
686
  form.vroot.$refs.form.setPropData('top', 0);
681
687
  break;
682
688
  }
@@ -689,7 +695,7 @@ function refreshSystemPosition() {
689
695
  case 'bottom': {
690
696
  exports.systemTaskInfo.length = form.vroot.$el.offsetHeight;
691
697
  form.vroot.$refs.form.setPropData('left', 0);
692
- form.vroot.$refs.form.setPropData('top', document.body.clientHeight - exports.systemTaskInfo.length);
698
+ form.vroot.$refs.form.setPropData('top', window.innerHeight - exports.systemTaskInfo.length);
693
699
  break;
694
700
  }
695
701
  }
package/dist/lib/task.ts CHANGED
@@ -222,7 +222,8 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
222
222
  }) : undefined;
223
223
  const app: types.IApp | null = await core.fetchApp(url, {
224
224
  'notifyId': notifyId,
225
- 'current': ntask ? ntask.path : undefined
225
+ 'current': ntask ? ntask.path : undefined,
226
+ 'progress': opt.progress
226
227
  });
227
228
  if (notifyId) {
228
229
  setTimeout(function(): void {
@@ -339,13 +340,6 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
339
340
  core.trigger('taskEnded', task.id);
340
341
  return f - 100;
341
342
  }
342
- if (clickgo.getNative() && opt.sync) {
343
- f.vroot.$refs.form.isNativeSync = true;
344
- window.addEventListener('resize', function(): void {
345
- f.vroot.$refs.form.setPropData('width', window.innerWidth);
346
- f.vroot.$refs.form.setPropData('height', window.innerHeight);
347
- });
348
- }
349
343
  // --- 设置 global style(如果 form 创建失败,就不设置 global style 了) ---
350
344
  if (app.config.style && app.files[app.config.style + '.css']) {
351
345
  const style = app.files[app.config.style + '.css'] as string;
@@ -380,6 +374,19 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
380
374
  if (task.id === 1) {
381
375
  clickgo.native.send('cg-init', clickgo.native.getToken());
382
376
  }
377
+ // --- 提交 sync ---
378
+ if (clickgo.getNative() && opt.sync) {
379
+ f.vroot.$refs.form.isNativeSync = true;
380
+ clickgo.native.send('cg-set-size', JSON.stringify({
381
+ 'token': clickgo.native.getToken(),
382
+ 'width': f.vroot.$refs.form.widthData,
383
+ 'height': f.vroot.$refs.form.heightData
384
+ }));
385
+ window.addEventListener('resize', function(): void {
386
+ f.vroot.$refs.form.setPropData('width', window.innerWidth);
387
+ f.vroot.$refs.form.setPropData('height', window.innerHeight);
388
+ });
389
+ }
383
390
  return task.id;
384
391
  }
385
392
 
@@ -815,12 +822,12 @@ export function refreshSystemPosition(): void {
815
822
  case 'left':
816
823
  case 'right': {
817
824
  form.vroot.$refs.form.setPropData('width', 'auto');
818
- form.vroot.$refs.form.setPropData('height', document.body.clientHeight);
825
+ form.vroot.$refs.form.setPropData('height', window.innerHeight);
819
826
  break;
820
827
  }
821
828
  case 'top':
822
829
  case 'bottom': {
823
- form.vroot.$refs.form.setPropData('width', document.body.clientWidth);
830
+ form.vroot.$refs.form.setPropData('width', window.innerWidth);
824
831
  form.vroot.$refs.form.setPropData('height', 'auto');
825
832
  break;
826
833
  }
@@ -835,7 +842,7 @@ export function refreshSystemPosition(): void {
835
842
  }
836
843
  case 'right': {
837
844
  systemTaskInfo.length = form.vroot.$el.offsetWidth;
838
- form.vroot.$refs.form.setPropData('left', document.body.clientWidth - systemTaskInfo.length);
845
+ form.vroot.$refs.form.setPropData('left', window.innerWidth - systemTaskInfo.length);
839
846
  form.vroot.$refs.form.setPropData('top', 0);
840
847
  break;
841
848
  }
@@ -848,7 +855,7 @@ export function refreshSystemPosition(): void {
848
855
  case 'bottom': {
849
856
  systemTaskInfo.length = form.vroot.$el.offsetHeight;
850
857
  form.vroot.$refs.form.setPropData('left', 0);
851
- form.vroot.$refs.form.setPropData('top', document.body.clientHeight - systemTaskInfo.length);
858
+ form.vroot.$refs.form.setPropData('top', window.innerHeight - systemTaskInfo.length);
852
859
  break;
853
860
  }
854
861
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.0.2-dev3",
3
+ "version": "3.0.5-dev6",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",
@@ -18,7 +18,7 @@
18
18
  "native4": "electron ./dist/test/native/index4"
19
19
  },
20
20
  "devDependencies": {
21
- "@litert/loader": "^3.2.0",
21
+ "@litert/loader": "^3.3.0",
22
22
  "@types/node": "^17.0.21",
23
23
  "@typescript-eslint/eslint-plugin": "^5.17.0",
24
24
  "@typescript-eslint/parser": "^5.17.0",
package/types/index.d.ts CHANGED
@@ -14,10 +14,8 @@ export function getNative(): boolean;
14
14
  export function getPlatform(): NodeJS.Platform | 'web';
15
15
  export function setSafe(val: boolean): void;
16
16
  export function getSafe(): boolean;
17
- export function setCdn(val: string): void;
18
- export function getCdn(): string;
19
17
 
20
- export function init(cdn?: string): Promise<void>;
18
+ export function init(): Promise<void>;
21
19
 
22
20
  // --- core 核心 ---
23
21