clickgo 3.0.0-dev → 3.0.3-dev4
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 +17 -25
- package/dist/app/task/config.json +3 -0
- package/dist/clickgo.js +14 -11
- package/dist/clickgo.ts +13 -8
- package/dist/control/common.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/global.css +1 -1
- package/dist/index.js +11 -16
- package/dist/index.ts +13 -14
- package/dist/lib/core.js +19 -22
- package/dist/lib/core.ts +19 -21
- package/dist/lib/dom.js +4 -2
- package/dist/lib/dom.ts +4 -2
- package/dist/lib/form.js +31 -11
- package/dist/lib/form.ts +32 -12
- package/dist/lib/native.js +35 -1
- package/dist/lib/native.ts +38 -1
- package/dist/lib/task.js +25 -8
- package/dist/lib/task.ts +26 -7
- package/dist/lib/zip.ts +1 -1
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +11 -6
- package/types/index.d.ts +19 -4
- package/types/dev.d.ts +0 -30
package/README.md
CHANGED
|
@@ -5,41 +5,33 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/clickgo "Stable Version")
|
|
6
6
|
[](https://www.npmjs.com/package/clickgo "Development Version")
|
|
7
7
|
[](https://www.npmjs.com/package/clickgo "Beta Version")
|
|
8
|
-
[](https://github.com/maiyun/clickgo/blob/master/LICENSE)
|
|
9
|
+
[](https://github.com/maiyun/clickgo/issues)
|
|
10
|
+
[](https://github.com/maiyun/clickgo/releases "Stable Release")
|
|
11
|
+
[](https://github.com/maiyun/clickgo/releases "Pre-Release")
|
|
12
12
|
|
|
13
13
|
Quickly and easily create a beautiful console interface.
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Load the module loader first, and then load it using the module loader.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
**Development Version**
|
|
22
|
-
|
|
23
|
-
```html
|
|
24
|
-
<script src="index.js"></script>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Production Version**
|
|
19
|
+
**index.html**
|
|
28
20
|
|
|
29
21
|
```html
|
|
30
|
-
<script src="
|
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.2.0/dist/loader.min.js?path=index"></script>
|
|
31
23
|
```
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
**index.js**
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
```typescript
|
|
28
|
+
import * as clickgo from 'clickgo';
|
|
29
|
+
(async function() {
|
|
30
|
+
await clickgo.init();
|
|
31
|
+
await clickgo.task.run('xxx');
|
|
32
|
+
})().catch((e) => {
|
|
33
|
+
console.log(e);
|
|
34
|
+
});
|
|
43
35
|
```
|
|
44
36
|
|
|
45
37
|
### NPM
|
|
@@ -58,7 +50,7 @@ $ npm i clickgo@dev --save
|
|
|
58
50
|
|
|
59
51
|
## Note
|
|
60
52
|
|
|
61
|
-
ClickGo demand loading Vue, jszip, resize-observer, but **DO NOT** reference these JS and CSS files. ClickGo will automatically reference. You only need to
|
|
53
|
+
ClickGo demand loading Vue, jszip, resize-observer, but **DO NOT** reference these JS and CSS files. ClickGo will automatically reference. You only need to import "clickgo" module.
|
|
62
54
|
|
|
63
55
|
## Demo
|
|
64
56
|
|
package/dist/clickgo.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
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.
|
|
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;
|
|
7
7
|
}
|
|
8
8
|
exports.getVersion = getVersion;
|
|
9
|
-
const native = navigator.userAgent.
|
|
9
|
+
const native = navigator.userAgent.includes('electron') ? true : false;
|
|
10
10
|
function getNative() {
|
|
11
11
|
return native;
|
|
12
12
|
}
|
|
13
13
|
exports.getNative = getNative;
|
|
14
|
+
let platform = 'web';
|
|
15
|
+
if (native) {
|
|
16
|
+
const reg = /electron\/(.+?) (.+?)\//.exec(navigator.userAgent);
|
|
17
|
+
if (reg) {
|
|
18
|
+
platform = reg[2];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function getPlatform() {
|
|
22
|
+
return platform;
|
|
23
|
+
}
|
|
24
|
+
exports.getPlatform = getPlatform;
|
|
14
25
|
let safe = true;
|
|
15
26
|
function setSafe(val) {
|
|
16
27
|
safe = val;
|
|
@@ -20,15 +31,7 @@ function getSafe() {
|
|
|
20
31
|
return safe;
|
|
21
32
|
}
|
|
22
33
|
exports.getSafe = getSafe;
|
|
23
|
-
|
|
24
|
-
function setCdn(val) {
|
|
25
|
-
cdn = val;
|
|
26
|
-
}
|
|
27
|
-
exports.setCdn = setCdn;
|
|
28
|
-
function getCdn() {
|
|
29
|
-
return cdn;
|
|
30
|
-
}
|
|
31
|
-
exports.getCdn = getCdn;
|
|
34
|
+
exports.vue = window.Vue;
|
|
32
35
|
exports.control = require("./lib/control");
|
|
33
36
|
exports.core = require("./lib/core");
|
|
34
37
|
exports.dom = require("./lib/dom");
|
package/dist/clickgo.ts
CHANGED
|
@@ -18,11 +18,22 @@ export function getVersion(): string {
|
|
|
18
18
|
return version;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const native = navigator.userAgent.
|
|
21
|
+
const native = navigator.userAgent.includes('electron') ? true : false;
|
|
22
22
|
export function getNative(): boolean {
|
|
23
23
|
return native;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
let platform: NodeJS.Platform | 'web' = 'web';
|
|
27
|
+
if (native) {
|
|
28
|
+
const reg = /electron\/(.+?) (.+?)\//.exec(navigator.userAgent);
|
|
29
|
+
if (reg) {
|
|
30
|
+
platform = reg[2] as any;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function getPlatform(): NodeJS.Platform | 'web' {
|
|
34
|
+
return platform;
|
|
35
|
+
}
|
|
36
|
+
|
|
26
37
|
let safe = true;
|
|
27
38
|
export function setSafe(val: boolean): void {
|
|
28
39
|
safe = val;
|
|
@@ -31,13 +42,7 @@ export function getSafe(): boolean {
|
|
|
31
42
|
return safe;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
|
-
|
|
35
|
-
export function setCdn(val: string): void {
|
|
36
|
-
cdn = val;
|
|
37
|
-
}
|
|
38
|
-
export function getCdn(): string {
|
|
39
|
-
return cdn;
|
|
40
|
-
}
|
|
45
|
+
export const vue: import('../types/index').IVueObject = (window as any).Vue;
|
|
41
46
|
|
|
42
47
|
export * as control from './lib/control';
|
|
43
48
|
export * as core from './lib/core';
|
package/dist/control/common.cgc
CHANGED
|
Binary file
|
package/dist/control/form.cgc
CHANGED
|
Binary file
|
package/dist/control/monaco.cgc
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/control/task.cgc
CHANGED
|
Binary file
|
package/dist/global.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#cg-wrap{--cg:hsl(20, 100%,
|
|
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}
|
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.
|
|
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
|
}
|
|
@@ -18,6 +18,10 @@ function getNative() {
|
|
|
18
18
|
return exports.clickgo.getNative();
|
|
19
19
|
}
|
|
20
20
|
exports.getNative = getNative;
|
|
21
|
+
function getPlatform() {
|
|
22
|
+
return exports.clickgo.getPlatform();
|
|
23
|
+
}
|
|
24
|
+
exports.getPlatform = getPlatform;
|
|
21
25
|
function setSafe(val) {
|
|
22
26
|
exports.clickgo.setSafe(val);
|
|
23
27
|
}
|
|
@@ -26,24 +30,16 @@ function getSafe() {
|
|
|
26
30
|
return exports.clickgo.getSafe();
|
|
27
31
|
}
|
|
28
32
|
exports.getSafe = getSafe;
|
|
29
|
-
function
|
|
30
|
-
exports.clickgo.setCdn(val);
|
|
31
|
-
}
|
|
32
|
-
exports.setCdn = setCdn;
|
|
33
|
-
function getCdn() {
|
|
34
|
-
return exports.clickgo.getCdn();
|
|
35
|
-
}
|
|
36
|
-
exports.getCdn = getCdn;
|
|
37
|
-
function init(cdn = 'https://cdn.jsdelivr.net') {
|
|
33
|
+
function init() {
|
|
38
34
|
var _a;
|
|
39
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
36
|
const paths = [
|
|
41
|
-
cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
|
|
37
|
+
loader.cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
|
|
42
38
|
];
|
|
43
39
|
let ro = true;
|
|
44
40
|
if (!(window.ResizeObserver)) {
|
|
45
41
|
ro = false;
|
|
46
|
-
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');
|
|
47
43
|
}
|
|
48
44
|
yield loader.loadScripts(paths);
|
|
49
45
|
if (!ro) {
|
|
@@ -51,22 +47,21 @@ function init(cdn = 'https://cdn.jsdelivr.net') {
|
|
|
51
47
|
window.ResizeObserver = window.ResizeObserver.ResizeObserver;
|
|
52
48
|
}
|
|
53
49
|
const map = {
|
|
54
|
-
'jszip': cdn + '/npm/jszip@3.10.0/dist/jszip.min'
|
|
50
|
+
'jszip': loader.cdn + '/npm/jszip@3.10.0/dist/jszip.min'
|
|
55
51
|
};
|
|
56
52
|
const after = '?' + Math.random().toString();
|
|
57
53
|
const files = yield loader.sniffFiles('clickgo.js', {
|
|
58
54
|
'dir': __dirname + '/',
|
|
59
55
|
'after': after,
|
|
60
|
-
'afterIgnore': new RegExp('^' + cdn.replace(/\./g, '\\.')),
|
|
56
|
+
'afterIgnore': new RegExp('^' + loader.cdn.replace(/\./g, '\\.')),
|
|
61
57
|
'map': map
|
|
62
58
|
});
|
|
63
59
|
const cg = loader.require('clickgo', files, {
|
|
64
60
|
'dir': __dirname + '/',
|
|
65
61
|
'map': map
|
|
66
62
|
})[0];
|
|
67
|
-
cg.setCdn(cdn);
|
|
68
63
|
try {
|
|
69
|
-
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();
|
|
70
65
|
(_a = document.getElementById('cg-global')) === null || _a === void 0 ? void 0 : _a.insertAdjacentHTML('afterbegin', style);
|
|
71
66
|
}
|
|
72
67
|
catch (_b) {
|
package/dist/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// npm publish --tag dev --access public
|
|
2
|
+
|
|
1
3
|
// --- 以下不会真正加载,最终会在底部进行赋值 ---
|
|
2
4
|
export let clickgo: typeof import('./clickgo');
|
|
3
5
|
export let control: typeof import('./lib/control');
|
|
@@ -10,6 +12,7 @@ export let task: typeof import('./lib/task');
|
|
|
10
12
|
export let theme: typeof import('./lib/theme');
|
|
11
13
|
export let tool: typeof import('./lib/tool');
|
|
12
14
|
export let zip: typeof import('./lib/zip');
|
|
15
|
+
export let vue: import('../types/index').IVueObject;
|
|
13
16
|
|
|
14
17
|
export function getVersion(): string {
|
|
15
18
|
return clickgo.getVersion();
|
|
@@ -19,6 +22,10 @@ export function getNative(): boolean {
|
|
|
19
22
|
return clickgo.getNative();
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
export function getPlatform(): NodeJS.Platform | 'web' {
|
|
26
|
+
return clickgo.getPlatform();
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
export function setSafe(val: boolean): void {
|
|
23
30
|
clickgo.setSafe(val);
|
|
24
31
|
}
|
|
@@ -26,24 +33,17 @@ export function getSafe(): boolean {
|
|
|
26
33
|
return clickgo.getSafe();
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
export function
|
|
30
|
-
clickgo.setCdn(val);
|
|
31
|
-
}
|
|
32
|
-
export function getCdn(): string {
|
|
33
|
-
return clickgo.getCdn();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export async function init(cdn: string = 'https://cdn.jsdelivr.net'): Promise<void> {
|
|
36
|
+
export async function init(): Promise<void> {
|
|
37
37
|
// --- 通过标签加载库 ---
|
|
38
38
|
const paths: string[] = [
|
|
39
|
-
cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
|
|
39
|
+
loader.cdn + '/npm/vue@3.2.31/dist/vue.global.min.js'
|
|
40
40
|
];
|
|
41
41
|
// --- 判断 ResizeObserver 是否存在 ---
|
|
42
42
|
let ro = true;
|
|
43
43
|
// ResizeObserver = undefined;
|
|
44
44
|
if (!((window as any).ResizeObserver)) {
|
|
45
45
|
ro = false;
|
|
46
|
-
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');
|
|
47
47
|
}
|
|
48
48
|
// --- 加载 vue 以及必要库 ---
|
|
49
49
|
await loader.loadScripts(paths);
|
|
@@ -54,24 +54,23 @@ export async function init(cdn: string = 'https://cdn.jsdelivr.net'): Promise<vo
|
|
|
54
54
|
}
|
|
55
55
|
// --- map 加载库 ---
|
|
56
56
|
const map: Record<string, string> = {
|
|
57
|
-
'jszip': cdn + '/npm/jszip@3.10.0/dist/jszip.min'
|
|
57
|
+
'jszip': loader.cdn + '/npm/jszip@3.10.0/dist/jszip.min'
|
|
58
58
|
};
|
|
59
59
|
// --- 加载 clickgo 主程序 ---
|
|
60
60
|
const after = '?' + Math.random().toString();
|
|
61
61
|
const files = await loader.sniffFiles('clickgo.js', {
|
|
62
62
|
'dir': __dirname + '/',
|
|
63
63
|
'after': after,
|
|
64
|
-
'afterIgnore': new RegExp('^' + cdn.replace(/\./g, '\\.')),
|
|
64
|
+
'afterIgnore': new RegExp('^' + loader.cdn.replace(/\./g, '\\.')),
|
|
65
65
|
'map': map
|
|
66
66
|
});
|
|
67
67
|
const cg = loader.require('clickgo', files, {
|
|
68
68
|
'dir': __dirname + '/',
|
|
69
69
|
'map': map
|
|
70
70
|
})[0] as typeof import('../dist/clickgo');
|
|
71
|
-
cg.setCdn(cdn);
|
|
72
71
|
// --- 加载 clickgo 的 global css ---
|
|
73
72
|
try {
|
|
74
|
-
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();
|
|
75
74
|
document.getElementById('cg-global')?.insertAdjacentHTML('afterbegin', style);
|
|
76
75
|
}
|
|
77
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");
|
|
@@ -25,7 +25,7 @@ const configOrigin = {
|
|
|
25
25
|
'desktop.wallpaper': null,
|
|
26
26
|
'desktop.path': null
|
|
27
27
|
};
|
|
28
|
-
exports.config =
|
|
28
|
+
exports.config = clickgo.vue.reactive({
|
|
29
29
|
'locale': 'en',
|
|
30
30
|
'task.position': 'bottom',
|
|
31
31
|
'task.pin': {},
|
|
@@ -34,7 +34,8 @@ exports.config = Vue.reactive({
|
|
|
34
34
|
'desktop.wallpaper': null,
|
|
35
35
|
'desktop.path': null
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
exports.cdn = '';
|
|
38
|
+
clickgo.vue.watch(exports.config, function () {
|
|
38
39
|
for (const key in configOrigin) {
|
|
39
40
|
if (exports.config[key] !== undefined) {
|
|
40
41
|
continue;
|
|
@@ -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(
|
|
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);
|
|
@@ -515,32 +516,28 @@ function fetchApp(url, opt = {}) {
|
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
518
|
if (cga) {
|
|
518
|
-
|
|
519
|
+
try {
|
|
519
520
|
const blob = yield fs.getContent(url, {
|
|
520
521
|
'current': current,
|
|
521
|
-
progress: (loaded, total) => {
|
|
522
|
-
|
|
522
|
+
'progress': (loaded, total) => {
|
|
523
|
+
if (opt.notifyId) {
|
|
524
|
+
form.notifyProgress(opt.notifyId, loaded / total);
|
|
525
|
+
}
|
|
526
|
+
if (opt.progress) {
|
|
527
|
+
opt.progress(loaded, total);
|
|
528
|
+
}
|
|
523
529
|
}
|
|
524
530
|
});
|
|
525
|
-
if ((blob === null) ||
|
|
531
|
+
if ((blob === null) || typeof blob === 'string') {
|
|
526
532
|
return null;
|
|
527
533
|
}
|
|
528
|
-
|
|
534
|
+
if (opt.notifyId) {
|
|
535
|
+
form.notifyProgress(opt.notifyId, 1);
|
|
536
|
+
}
|
|
529
537
|
return (yield readApp(blob)) || null;
|
|
530
538
|
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
const blob = yield fs.getContent(url, {
|
|
534
|
-
'current': current
|
|
535
|
-
});
|
|
536
|
-
if ((blob === null) || typeof blob === 'string') {
|
|
537
|
-
return null;
|
|
538
|
-
}
|
|
539
|
-
return (yield readApp(blob)) || null;
|
|
540
|
-
}
|
|
541
|
-
catch (_a) {
|
|
542
|
-
return null;
|
|
543
|
-
}
|
|
539
|
+
catch (_a) {
|
|
540
|
+
return null;
|
|
544
541
|
}
|
|
545
542
|
}
|
|
546
543
|
let config;
|
package/dist/lib/core.ts
CHANGED
|
@@ -30,7 +30,7 @@ const configOrigin: types.IConfig = {
|
|
|
30
30
|
'desktop.wallpaper': null,
|
|
31
31
|
'desktop.path': null
|
|
32
32
|
};
|
|
33
|
-
export const config: types.IConfig =
|
|
33
|
+
export const config: types.IConfig = clickgo.vue.reactive({
|
|
34
34
|
'locale': 'en',
|
|
35
35
|
'task.position': 'bottom',
|
|
36
36
|
'task.pin': {},
|
|
@@ -40,7 +40,9 @@ export const config: types.IConfig = Vue.reactive({
|
|
|
40
40
|
'desktop.path': null
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
export const cdn = '';
|
|
44
|
+
|
|
45
|
+
clickgo.vue.watch(config, function() {
|
|
44
46
|
// --- 检测有没有缺少的 config key ---
|
|
45
47
|
for (const key in configOrigin) {
|
|
46
48
|
if ((config as any)[key] !== undefined) {
|
|
@@ -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(
|
|
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);
|
|
@@ -577,32 +579,28 @@ export async function fetchApp(url: string, opt: types.ICoreFetchAppOptions = {}
|
|
|
577
579
|
|
|
578
580
|
// --- 如果是 cga 文件,直接读取并交给 readApp 函数处理 ---
|
|
579
581
|
if (cga) {
|
|
580
|
-
|
|
582
|
+
try {
|
|
581
583
|
const blob = await fs.getContent(url, {
|
|
582
584
|
'current': current,
|
|
583
|
-
progress: (loaded, total): void => {
|
|
584
|
-
|
|
585
|
+
'progress': (loaded: number, total: number): void => {
|
|
586
|
+
if (opt.notifyId) {
|
|
587
|
+
form.notifyProgress(opt.notifyId, loaded / total);
|
|
588
|
+
}
|
|
589
|
+
if (opt.progress) {
|
|
590
|
+
opt.progress(loaded, total) as unknown;
|
|
591
|
+
}
|
|
585
592
|
}
|
|
586
593
|
});
|
|
587
|
-
if ((blob === null) ||
|
|
594
|
+
if ((blob === null) || typeof blob === 'string') {
|
|
588
595
|
return null;
|
|
589
596
|
}
|
|
590
|
-
|
|
597
|
+
if (opt.notifyId) {
|
|
598
|
+
form.notifyProgress(opt.notifyId, 1);
|
|
599
|
+
}
|
|
591
600
|
return await readApp(blob) || null;
|
|
592
601
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const blob = await fs.getContent(url, {
|
|
596
|
-
'current': current
|
|
597
|
-
});
|
|
598
|
-
if ((blob === null) || typeof blob === 'string') {
|
|
599
|
-
return null;
|
|
600
|
-
}
|
|
601
|
-
return await readApp(blob) || null;
|
|
602
|
-
}
|
|
603
|
-
catch {
|
|
604
|
-
return null;
|
|
605
|
-
}
|
|
602
|
+
catch {
|
|
603
|
+
return null;
|
|
606
604
|
}
|
|
607
605
|
}
|
|
608
606
|
// --- 加载目录 ---
|
package/dist/lib/dom.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fullscreen = exports.siblingsData = exports.siblings = exports.findParentByClass = exports.findParentByData = exports.bindResize = exports.bindMove = exports.is = exports.bindDrag = exports.bindLong = exports.allowEvent = exports.bindGesture = exports.bindDown = exports.isWatchStyle = exports.watchStyle = exports.clearWatch = exports.unwatch = exports.watch = exports.clearWatchSize = exports.unwatchSize = exports.watchSize = exports.getSize = exports.getStyleCount = exports.removeStyle = exports.pushStyle = exports.removeFromStyleList = exports.createToStyleList = exports.hasTouchButMouse = exports.setGlobalCursor = void 0;
|
|
4
|
+
const clickgo = require("../clickgo");
|
|
4
5
|
const form = require("./form");
|
|
5
6
|
const core = require("./core");
|
|
6
7
|
const topClass = ['#cg-form-list', '#cg-pop-list', '#cg-system', '#cg-simpletask'];
|
|
@@ -16,7 +17,8 @@ styleList.style.display = 'none';
|
|
|
16
17
|
document.getElementsByTagName('body')[0].appendChild(styleList);
|
|
17
18
|
styleList.insertAdjacentHTML('beforeend', '<style id=\'cg-global-cursor\'></style>');
|
|
18
19
|
styleList.insertAdjacentHTML('beforeend', `<style id='cg-global'>
|
|
19
|
-
${classUnfold()} {-webkit-user-select: none; user-select: none; position: fixed;
|
|
20
|
+
${classUnfold()} {-webkit-user-select: none; user-select: none; position: fixed; cursor: default; box-sizing: border-box;}
|
|
21
|
+
${topClass.slice(0, 3).join(', ')} {left: 0; top: 0; width: 0; height: 0;}
|
|
20
22
|
${classUnfold('img')} {vertical-align: bottom;}
|
|
21
23
|
${classUnfold('::selection')} {background-color: rgba(0, 0, 0, .1);}
|
|
22
24
|
${classUnfold('*')}, ${classUnfold('*::after')}, ${classUnfold('*::before')} {box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); flex-shrink: 0;}
|
|
@@ -1001,7 +1003,7 @@ function bindDrag(e, opt) {
|
|
|
1001
1003
|
});
|
|
1002
1004
|
}
|
|
1003
1005
|
exports.bindDrag = bindDrag;
|
|
1004
|
-
exports.is =
|
|
1006
|
+
exports.is = clickgo.vue.reactive({
|
|
1005
1007
|
'move': false,
|
|
1006
1008
|
'shift': false,
|
|
1007
1009
|
'ctrl': false
|
package/dist/lib/dom.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import * as types from '../../types';
|
|
17
|
+
import * as clickgo from '../clickgo';
|
|
17
18
|
import * as form from './form';
|
|
18
19
|
import * as core from './core';
|
|
19
20
|
|
|
@@ -36,7 +37,8 @@ styleList.style.display = 'none';
|
|
|
36
37
|
document.getElementsByTagName('body')[0].appendChild(styleList);
|
|
37
38
|
styleList.insertAdjacentHTML('beforeend', '<style id=\'cg-global-cursor\'></style>');
|
|
38
39
|
styleList.insertAdjacentHTML('beforeend', `<style id='cg-global'>
|
|
39
|
-
${classUnfold()} {-webkit-user-select: none; user-select: none; position: fixed;
|
|
40
|
+
${classUnfold()} {-webkit-user-select: none; user-select: none; position: fixed; cursor: default; box-sizing: border-box;}
|
|
41
|
+
${topClass.slice(0, 3).join(', ')} {left: 0; top: 0; width: 0; height: 0;}
|
|
40
42
|
${classUnfold('img')} {vertical-align: bottom;}
|
|
41
43
|
${classUnfold('::selection')} {background-color: rgba(0, 0, 0, .1);}
|
|
42
44
|
${classUnfold('*')}, ${classUnfold('*::after')}, ${classUnfold('*::before')} {box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); flex-shrink: 0;}
|
|
@@ -1217,7 +1219,7 @@ export function bindDrag(e: MouseEvent | TouchEvent, opt: { 'el': HTMLElement; '
|
|
|
1217
1219
|
}
|
|
1218
1220
|
|
|
1219
1221
|
/** --- 目前是否已绑定了 bindMove --- */
|
|
1220
|
-
export const is =
|
|
1222
|
+
export const is = clickgo.vue.reactive({
|
|
1221
1223
|
'move': false,
|
|
1222
1224
|
'shift': false,
|
|
1223
1225
|
'ctrl': false
|
package/dist/lib/form.js
CHANGED
|
@@ -67,12 +67,18 @@ const elements = {
|
|
|
67
67
|
'init': function () {
|
|
68
68
|
this.wrap.id = 'cg-wrap';
|
|
69
69
|
document.getElementsByTagName('body')[0].appendChild(this.wrap);
|
|
70
|
-
if (clickgo.getNative()) {
|
|
70
|
+
if (clickgo.getNative() && (clickgo.getPlatform() === 'win32')) {
|
|
71
71
|
this.wrap.addEventListener('mouseenter', function () {
|
|
72
|
-
native.send('cg-mouse-ignore',
|
|
72
|
+
native.send('cg-mouse-ignore', JSON.stringify({
|
|
73
|
+
'token': native.getToken(),
|
|
74
|
+
'param': false
|
|
75
|
+
}));
|
|
73
76
|
});
|
|
74
77
|
this.wrap.addEventListener('mouseleave', function () {
|
|
75
|
-
native.send('cg-mouse-ignore',
|
|
78
|
+
native.send('cg-mouse-ignore', JSON.stringify({
|
|
79
|
+
'token': native.getToken(),
|
|
80
|
+
'param': true
|
|
81
|
+
}));
|
|
76
82
|
});
|
|
77
83
|
}
|
|
78
84
|
this.list.id = 'cg-form-list';
|
|
@@ -123,7 +129,7 @@ const elements = {
|
|
|
123
129
|
}, {
|
|
124
130
|
'passive': false
|
|
125
131
|
});
|
|
126
|
-
this.simpleSystemtask.id = 'cg-
|
|
132
|
+
this.simpleSystemtask.id = 'cg-simpletask';
|
|
127
133
|
this.simpleSystemtask.addEventListener('contextmenu', function (e) {
|
|
128
134
|
e.preventDefault();
|
|
129
135
|
});
|
|
@@ -133,8 +139,8 @@ const elements = {
|
|
|
133
139
|
}, {
|
|
134
140
|
'passive': false
|
|
135
141
|
});
|
|
136
|
-
const
|
|
137
|
-
'template': '<div v-for="(item, formId) of forms" class="cg-
|
|
142
|
+
const simpletaskApp = clickgo.vue.createApp({
|
|
143
|
+
'template': '<div v-for="(item, formId) of forms" class="cg-simpletask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simpletask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
138
144
|
'data': function () {
|
|
139
145
|
return {
|
|
140
146
|
'forms': {}
|
|
@@ -169,7 +175,7 @@ const elements = {
|
|
|
169
175
|
exports.simpleSystemTaskRoot = this;
|
|
170
176
|
}
|
|
171
177
|
});
|
|
172
|
-
|
|
178
|
+
simpletaskApp.mount('#cg-simpletask');
|
|
173
179
|
}
|
|
174
180
|
};
|
|
175
181
|
elements.init();
|
|
@@ -1089,12 +1095,12 @@ function create(opt) {
|
|
|
1089
1095
|
getNative() {
|
|
1090
1096
|
return clickgo.getNative();
|
|
1091
1097
|
},
|
|
1098
|
+
getPlatform() {
|
|
1099
|
+
return clickgo.getPlatform();
|
|
1100
|
+
},
|
|
1092
1101
|
getSafe() {
|
|
1093
1102
|
return clickgo.getSafe();
|
|
1094
1103
|
},
|
|
1095
|
-
getCdn() {
|
|
1096
|
-
return clickgo.getCdn();
|
|
1097
|
-
},
|
|
1098
1104
|
'control': {
|
|
1099
1105
|
read: function (blob) {
|
|
1100
1106
|
return clickgo.control.read(blob);
|
|
@@ -1102,6 +1108,7 @@ function create(opt) {
|
|
|
1102
1108
|
},
|
|
1103
1109
|
'core': {
|
|
1104
1110
|
'config': clickgo.core.config,
|
|
1111
|
+
'cdn': loader.cdn,
|
|
1105
1112
|
initModules: function (names) {
|
|
1106
1113
|
return clickgo.core.initModules(names);
|
|
1107
1114
|
},
|
|
@@ -1448,6 +1455,18 @@ function create(opt) {
|
|
|
1448
1455
|
},
|
|
1449
1456
|
clearListener: function () {
|
|
1450
1457
|
clickgo.native.clearListener(taskId);
|
|
1458
|
+
},
|
|
1459
|
+
max: function () {
|
|
1460
|
+
clickgo.native.max();
|
|
1461
|
+
},
|
|
1462
|
+
min: function () {
|
|
1463
|
+
clickgo.native.min();
|
|
1464
|
+
},
|
|
1465
|
+
restore: function () {
|
|
1466
|
+
clickgo.native.restore();
|
|
1467
|
+
},
|
|
1468
|
+
size: function (width, height) {
|
|
1469
|
+
clickgo.native.size(width, height);
|
|
1451
1470
|
}
|
|
1452
1471
|
},
|
|
1453
1472
|
'task': {
|
|
@@ -1468,6 +1487,7 @@ function create(opt) {
|
|
|
1468
1487
|
},
|
|
1469
1488
|
run: function (url, opt = {}) {
|
|
1470
1489
|
opt.taskId = taskId;
|
|
1490
|
+
opt.main = false;
|
|
1471
1491
|
return clickgo.task.run(url, opt);
|
|
1472
1492
|
},
|
|
1473
1493
|
end: function (tid) {
|
|
@@ -1849,7 +1869,7 @@ function create(opt) {
|
|
|
1849
1869
|
dom.pushStyle(taskId, style, 'form', formId);
|
|
1850
1870
|
}
|
|
1851
1871
|
const rtn = yield new Promise(function (resolve) {
|
|
1852
|
-
const vapp =
|
|
1872
|
+
const vapp = clickgo.vue.createApp({
|
|
1853
1873
|
'template': layout.replace(/^<cg-form/, '<cg-form ref="form"'),
|
|
1854
1874
|
'data': function () {
|
|
1855
1875
|
return tool.clone(data);
|
package/dist/lib/form.ts
CHANGED
|
@@ -111,12 +111,18 @@ const elements: {
|
|
|
111
111
|
/** --- clickgo 所有的 div wrap --- */
|
|
112
112
|
this.wrap.id = 'cg-wrap';
|
|
113
113
|
document.getElementsByTagName('body')[0].appendChild(this.wrap);
|
|
114
|
-
if (clickgo.getNative()) {
|
|
114
|
+
if (clickgo.getNative() && (clickgo.getPlatform() === 'win32')) {
|
|
115
115
|
this.wrap.addEventListener('mouseenter', function() {
|
|
116
|
-
native.send('cg-mouse-ignore',
|
|
116
|
+
native.send('cg-mouse-ignore', JSON.stringify({
|
|
117
|
+
'token': native.getToken(),
|
|
118
|
+
'param': false
|
|
119
|
+
}));
|
|
117
120
|
});
|
|
118
121
|
this.wrap.addEventListener('mouseleave', function() {
|
|
119
|
-
native.send('cg-mouse-ignore',
|
|
122
|
+
native.send('cg-mouse-ignore', JSON.stringify({
|
|
123
|
+
'token': native.getToken(),
|
|
124
|
+
'param': true
|
|
125
|
+
}));
|
|
120
126
|
});
|
|
121
127
|
}
|
|
122
128
|
|
|
@@ -187,8 +193,8 @@ const elements: {
|
|
|
187
193
|
'passive': false
|
|
188
194
|
});
|
|
189
195
|
|
|
190
|
-
// --- 添加 cg-
|
|
191
|
-
this.simpleSystemtask.id = 'cg-
|
|
196
|
+
// --- 添加 cg-simpletask 的 dom ---
|
|
197
|
+
this.simpleSystemtask.id = 'cg-simpletask';
|
|
192
198
|
this.simpleSystemtask.addEventListener('contextmenu', function(e): void {
|
|
193
199
|
e.preventDefault();
|
|
194
200
|
});
|
|
@@ -199,8 +205,8 @@ const elements: {
|
|
|
199
205
|
}, {
|
|
200
206
|
'passive': false
|
|
201
207
|
});
|
|
202
|
-
const
|
|
203
|
-
'template': '<div v-for="(item, formId) of forms" class="cg-
|
|
208
|
+
const simpletaskApp = clickgo.vue.createApp({
|
|
209
|
+
'template': '<div v-for="(item, formId) of forms" class="cg-simpletask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simpletask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
204
210
|
'data': function() {
|
|
205
211
|
return {
|
|
206
212
|
'forms': {}
|
|
@@ -235,7 +241,7 @@ const elements: {
|
|
|
235
241
|
simpleSystemTaskRoot = this;
|
|
236
242
|
}
|
|
237
243
|
});
|
|
238
|
-
|
|
244
|
+
simpletaskApp.mount('#cg-simpletask');
|
|
239
245
|
}
|
|
240
246
|
};
|
|
241
247
|
elements.init();
|
|
@@ -1365,12 +1371,12 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
|
|
|
1365
1371
|
getNative(): boolean {
|
|
1366
1372
|
return clickgo.getNative();
|
|
1367
1373
|
},
|
|
1374
|
+
getPlatform(): string {
|
|
1375
|
+
return clickgo.getPlatform();
|
|
1376
|
+
},
|
|
1368
1377
|
getSafe(): boolean {
|
|
1369
1378
|
return clickgo.getSafe();
|
|
1370
1379
|
},
|
|
1371
|
-
getCdn(): string {
|
|
1372
|
-
return clickgo.getCdn();
|
|
1373
|
-
},
|
|
1374
1380
|
'control': {
|
|
1375
1381
|
read: function(blob: Blob): Promise<false | types.TControl> {
|
|
1376
1382
|
return clickgo.control.read(blob);
|
|
@@ -1378,6 +1384,7 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
|
|
|
1378
1384
|
},
|
|
1379
1385
|
'core': {
|
|
1380
1386
|
'config': clickgo.core.config,
|
|
1387
|
+
'cdn': loader.cdn,
|
|
1381
1388
|
initModules: function(names: string | string[]): Promise<number> {
|
|
1382
1389
|
return clickgo.core.initModules(names);
|
|
1383
1390
|
},
|
|
@@ -1762,6 +1769,18 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
|
|
|
1762
1769
|
},
|
|
1763
1770
|
clearListener: function(): void {
|
|
1764
1771
|
clickgo.native.clearListener(taskId);
|
|
1772
|
+
},
|
|
1773
|
+
max: function(): void {
|
|
1774
|
+
clickgo.native.max();
|
|
1775
|
+
},
|
|
1776
|
+
min: function(): void {
|
|
1777
|
+
clickgo.native.min();
|
|
1778
|
+
},
|
|
1779
|
+
restore: function(): void {
|
|
1780
|
+
clickgo.native.restore();
|
|
1781
|
+
},
|
|
1782
|
+
size: function(width: number, height: number): void {
|
|
1783
|
+
clickgo.native.size(width, height);
|
|
1765
1784
|
}
|
|
1766
1785
|
},
|
|
1767
1786
|
'task': {
|
|
@@ -1789,6 +1808,7 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
|
|
|
1789
1808
|
},
|
|
1790
1809
|
run: function(url: string, opt: types.ITaskRunOptions = {}): Promise<number> {
|
|
1791
1810
|
opt.taskId = taskId;
|
|
1811
|
+
opt.main = false;
|
|
1792
1812
|
return clickgo.task.run(url, opt);
|
|
1793
1813
|
},
|
|
1794
1814
|
end: function(tid: number): boolean {
|
|
@@ -2208,7 +2228,7 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
|
|
|
2208
2228
|
'vapp': types.IVueApp;
|
|
2209
2229
|
'vroot': types.IVForm;
|
|
2210
2230
|
} = await new Promise(function(resolve) {
|
|
2211
|
-
const vapp =
|
|
2231
|
+
const vapp = clickgo.vue.createApp({
|
|
2212
2232
|
'template': layout!.replace(/^<cg-form/, '<cg-form ref="form"'),
|
|
2213
2233
|
'data': function() {
|
|
2214
2234
|
return tool.clone(data);
|
package/dist/lib/native.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cgInnerReceive = exports.cgInnerGetSends = exports.clearListener = exports.off = exports.once = exports.on = exports.send = exports.getListeners = void 0;
|
|
3
|
+
exports.cgInnerReceive = exports.cgInnerGetSends = exports.size = exports.restore = exports.min = exports.max = exports.clearListener = exports.off = exports.once = exports.on = exports.send = exports.getListeners = exports.getToken = void 0;
|
|
4
4
|
const clickgo = require("../clickgo");
|
|
5
5
|
let sendId = 0;
|
|
6
6
|
let sendList = [];
|
|
7
7
|
const listeners = {};
|
|
8
|
+
const token = (Math.random() * 100000000000000 * (100 + Math.round(Math.random() * (999 - 100)))).toString(32);
|
|
9
|
+
function getToken() {
|
|
10
|
+
return token;
|
|
11
|
+
}
|
|
12
|
+
exports.getToken = getToken;
|
|
8
13
|
function getListeners() {
|
|
9
14
|
const list = [];
|
|
10
15
|
for (const name in listeners) {
|
|
@@ -93,6 +98,35 @@ function clearListener(taskId) {
|
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
exports.clearListener = clearListener;
|
|
101
|
+
function max() {
|
|
102
|
+
send('cg-set-state', JSON.stringify({
|
|
103
|
+
'token': token,
|
|
104
|
+
'state': 'max'
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
exports.max = max;
|
|
108
|
+
function min() {
|
|
109
|
+
send('cg-set-state', JSON.stringify({
|
|
110
|
+
'token': token,
|
|
111
|
+
'state': 'min'
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
exports.min = min;
|
|
115
|
+
function restore() {
|
|
116
|
+
send('cg-set-state', JSON.stringify({
|
|
117
|
+
'token': token,
|
|
118
|
+
'state': 'restore'
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
exports.restore = restore;
|
|
122
|
+
function size(width, height) {
|
|
123
|
+
send('cg-set-size', JSON.stringify({
|
|
124
|
+
'token': token,
|
|
125
|
+
'width': width,
|
|
126
|
+
'height': height
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
exports.size = size;
|
|
96
130
|
function cgInnerGetSends() {
|
|
97
131
|
const json = JSON.stringify(sendList);
|
|
98
132
|
sendList = [];
|
package/dist/lib/native.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import * as clickgo from '../clickgo';
|
|
17
17
|
|
|
18
|
+
/** --- 最后一个 send ID --- */
|
|
18
19
|
let sendId = 0;
|
|
19
20
|
// --- sendList 一定会被清理 ---
|
|
20
21
|
let sendList: Array<{
|
|
@@ -31,6 +32,14 @@ const listeners: Record<string, Array<{
|
|
|
31
32
|
'handler': (param?: string) => void | Promise<void>;
|
|
32
33
|
}>> = {};
|
|
33
34
|
|
|
35
|
+
const token = (Math.random() * 100000000000000 * (100 + Math.round(Math.random() * (999 - 100)))).toString(32);
|
|
36
|
+
/**
|
|
37
|
+
* --- 获取 native 通讯 token,app 模式下无效 ---
|
|
38
|
+
*/
|
|
39
|
+
export function getToken(): string {
|
|
40
|
+
return token;
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
/**
|
|
35
44
|
* --- 获取已经创建的监听列表 ---
|
|
36
45
|
*/
|
|
@@ -123,7 +132,7 @@ export function once(
|
|
|
123
132
|
}
|
|
124
133
|
|
|
125
134
|
/**
|
|
126
|
-
* --- 取消监听 native 指令
|
|
135
|
+
* --- 取消监听 native 指令 ---
|
|
127
136
|
* @param name 指令名
|
|
128
137
|
* @param handler 绑定监听时的回调函数
|
|
129
138
|
* @param taskId 校验 taskId,为空则不校验,但 App 模式下无效
|
|
@@ -170,6 +179,34 @@ export function clearListener(taskId?: number): void {
|
|
|
170
179
|
}
|
|
171
180
|
}
|
|
172
181
|
|
|
182
|
+
// --- 常见操作 ---
|
|
183
|
+
|
|
184
|
+
export function max(): void {
|
|
185
|
+
send('cg-set-state', JSON.stringify({
|
|
186
|
+
'token': token,
|
|
187
|
+
'state': 'max'
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
export function min(): void {
|
|
191
|
+
send('cg-set-state', JSON.stringify({
|
|
192
|
+
'token': token,
|
|
193
|
+
'state': 'min'
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
export function restore(): void {
|
|
197
|
+
send('cg-set-state', JSON.stringify({
|
|
198
|
+
'token': token,
|
|
199
|
+
'state': 'restore'
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
export function size(width: number, height: number): void {
|
|
203
|
+
send('cg-set-size', JSON.stringify({
|
|
204
|
+
'token': token,
|
|
205
|
+
'width': width,
|
|
206
|
+
'height': height
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
|
|
173
210
|
// --- 以下为供 native 调用的内部函数 ---
|
|
174
211
|
|
|
175
212
|
// --- 将 send 值全部提交给 native ---
|
package/dist/lib/task.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.refreshSystemPosition = exports.clearSystem = exports.setSystem = exports.systemTaskInfo = exports.sleep = exports.removeTimer = exports.createTimer = exports.clearLocaleLang = exports.setLocaleLang = exports.setLocale = exports.clearLocale = exports.loadLocale = exports.loadLocaleData = exports.end = exports.run = exports.getList = exports.get = exports.offFrame = exports.onFrame = exports.lastId = exports.list = void 0;
|
|
13
|
+
const clickgo = require("../clickgo");
|
|
13
14
|
const core = require("./core");
|
|
14
15
|
const control = require("./control");
|
|
15
16
|
const dom = require("./dom");
|
|
@@ -144,7 +145,7 @@ function getList() {
|
|
|
144
145
|
}
|
|
145
146
|
exports.getList = getList;
|
|
146
147
|
function run(url, opt = {}) {
|
|
147
|
-
var _a, _b, _c;
|
|
148
|
+
var _a, _b, _c, _d;
|
|
148
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
150
|
let ntask = null;
|
|
150
151
|
if (opt.taskId) {
|
|
@@ -157,10 +158,10 @@ function run(url, opt = {}) {
|
|
|
157
158
|
if (opt.icon) {
|
|
158
159
|
icon = opt.icon;
|
|
159
160
|
}
|
|
160
|
-
if (opt.
|
|
161
|
-
opt.
|
|
161
|
+
if (opt.notify === undefined) {
|
|
162
|
+
opt.notify = true;
|
|
162
163
|
}
|
|
163
|
-
const notifyId = opt.
|
|
164
|
+
const notifyId = opt.notify ? form.notify({
|
|
164
165
|
'title': (_b = (_a = localeData[core.config.locale]) === null || _a === void 0 ? void 0 : _a.loading) !== null && _b !== void 0 ? _b : localeData['en'].loading,
|
|
165
166
|
'content': url,
|
|
166
167
|
'icon': icon,
|
|
@@ -188,13 +189,14 @@ function run(url, opt = {}) {
|
|
|
188
189
|
'id': taskId,
|
|
189
190
|
'app': app,
|
|
190
191
|
'customTheme': false,
|
|
191
|
-
'locale':
|
|
192
|
+
'locale': clickgo.vue.reactive({
|
|
192
193
|
'lang': '',
|
|
193
194
|
'data': {}
|
|
194
195
|
}),
|
|
195
196
|
'icon': (_c = app.icon) !== null && _c !== void 0 ? _c : icon,
|
|
196
197
|
'path': url,
|
|
197
198
|
'files': files,
|
|
199
|
+
'main': (_d = opt.main) !== null && _d !== void 0 ? _d : false,
|
|
198
200
|
'permissions': {},
|
|
199
201
|
'forms': {},
|
|
200
202
|
'objectURLs': [],
|
|
@@ -258,7 +260,7 @@ function run(url, opt = {}) {
|
|
|
258
260
|
const data = JSON.parse(lcontent);
|
|
259
261
|
loadLocaleData(locale, data, '', task.id);
|
|
260
262
|
}
|
|
261
|
-
catch (
|
|
263
|
+
catch (_e) {
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
}
|
|
@@ -274,6 +276,13 @@ function run(url, opt = {}) {
|
|
|
274
276
|
core.trigger('taskEnded', task.id);
|
|
275
277
|
return f - 100;
|
|
276
278
|
}
|
|
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
|
+
}
|
|
277
286
|
if (app.config.style && app.files[app.config.style + '.css']) {
|
|
278
287
|
const style = app.files[app.config.style + '.css'];
|
|
279
288
|
const r = tool.stylePrepend(style, 'cg-task' + task.id.toString() + '_');
|
|
@@ -301,6 +310,9 @@ function run(url, opt = {}) {
|
|
|
301
310
|
yield theme.load(undefined, task.id);
|
|
302
311
|
}
|
|
303
312
|
}
|
|
313
|
+
if (task.id === 1) {
|
|
314
|
+
clickgo.native.send('cg-init', clickgo.native.getToken());
|
|
315
|
+
}
|
|
304
316
|
return task.id;
|
|
305
317
|
});
|
|
306
318
|
}
|
|
@@ -310,6 +322,11 @@ function end(taskId) {
|
|
|
310
322
|
if (!task) {
|
|
311
323
|
return true;
|
|
312
324
|
}
|
|
325
|
+
if (clickgo.getNative() && task.main) {
|
|
326
|
+
clickgo.native.send('cg-main-close', JSON.stringify({
|
|
327
|
+
'token': clickgo.native.getToken()
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
313
330
|
const fid = form.getMaxZIndexID({
|
|
314
331
|
'taskIds': [task.id]
|
|
315
332
|
});
|
|
@@ -520,12 +537,12 @@ function sleep(fun, delay, taskId, formId) {
|
|
|
520
537
|
});
|
|
521
538
|
}
|
|
522
539
|
exports.sleep = sleep;
|
|
523
|
-
exports.systemTaskInfo =
|
|
540
|
+
exports.systemTaskInfo = clickgo.vue.reactive({
|
|
524
541
|
'taskId': 0,
|
|
525
542
|
'formId': 0,
|
|
526
543
|
'length': 0
|
|
527
544
|
});
|
|
528
|
-
|
|
545
|
+
clickgo.vue.watch(exports.systemTaskInfo, function (n, o) {
|
|
529
546
|
var _a, _b;
|
|
530
547
|
const originKeys = ['taskId', 'formId', 'length'];
|
|
531
548
|
for (const key of originKeys) {
|
package/dist/lib/task.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import * as types from '../../types';
|
|
17
|
+
import * as clickgo from '../clickgo';
|
|
17
18
|
import * as core from './core';
|
|
18
19
|
import * as control from './control';
|
|
19
20
|
import * as dom from './dom';
|
|
@@ -192,7 +193,7 @@ export function getList(): Record<string, types.ITaskInfo> {
|
|
|
192
193
|
/**
|
|
193
194
|
* --- 运行一个应用 ---
|
|
194
195
|
* @param url app 路径(以 / 为结尾的路径或以 .cga 结尾的文件)
|
|
195
|
-
* @param opt 选项,icon:图标,progress:显示进度条,taskId:所属任务,App 模式下无效
|
|
196
|
+
* @param opt 选项,icon:图标,progress:显示进度条,main:native模式下的主进程,App 模式下无效,taskId:所属任务,App 模式下无效
|
|
196
197
|
*/
|
|
197
198
|
export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise<number> {
|
|
198
199
|
/** --- 是否是在任务当中启动的任务 --- */
|
|
@@ -209,10 +210,10 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
209
210
|
if (opt.icon) {
|
|
210
211
|
icon = opt.icon;
|
|
211
212
|
}
|
|
212
|
-
if (opt.
|
|
213
|
-
opt.
|
|
213
|
+
if (opt.notify === undefined) {
|
|
214
|
+
opt.notify = true;
|
|
214
215
|
}
|
|
215
|
-
const notifyId: number | undefined = opt.
|
|
216
|
+
const notifyId: number | undefined = opt.notify ? form.notify({
|
|
216
217
|
'title': localeData[core.config.locale]?.loading ?? localeData['en'].loading,
|
|
217
218
|
'content': url,
|
|
218
219
|
'icon': icon,
|
|
@@ -242,13 +243,14 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
242
243
|
'id': taskId,
|
|
243
244
|
'app': app,
|
|
244
245
|
'customTheme': false,
|
|
245
|
-
'locale':
|
|
246
|
+
'locale': clickgo.vue.reactive({
|
|
246
247
|
'lang': '',
|
|
247
248
|
'data': {}
|
|
248
249
|
}),
|
|
249
250
|
'icon': app.icon ?? icon,
|
|
250
251
|
'path': url,
|
|
251
252
|
'files': files,
|
|
253
|
+
'main': opt.main ?? false,
|
|
252
254
|
|
|
253
255
|
'permissions': {},
|
|
254
256
|
'forms': {},
|
|
@@ -337,6 +339,13 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
337
339
|
core.trigger('taskEnded', task.id);
|
|
338
340
|
return f - 100;
|
|
339
341
|
}
|
|
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
|
+
}
|
|
340
349
|
// --- 设置 global style(如果 form 创建失败,就不设置 global style 了) ---
|
|
341
350
|
if (app.config.style && app.files[app.config.style + '.css']) {
|
|
342
351
|
const style = app.files[app.config.style + '.css'] as string;
|
|
@@ -367,6 +376,10 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}): Promise
|
|
|
367
376
|
await theme.load(undefined, task.id);
|
|
368
377
|
}
|
|
369
378
|
}
|
|
379
|
+
// --- 给 native 发送任务启动成功的消息 ---
|
|
380
|
+
if (task.id === 1) {
|
|
381
|
+
clickgo.native.send('cg-init', clickgo.native.getToken());
|
|
382
|
+
}
|
|
370
383
|
return task.id;
|
|
371
384
|
}
|
|
372
385
|
|
|
@@ -379,6 +392,12 @@ export function end(taskId: number): boolean {
|
|
|
379
392
|
if (!task) {
|
|
380
393
|
return true;
|
|
381
394
|
}
|
|
395
|
+
// --- 如果是 native 模式 ---
|
|
396
|
+
if (clickgo.getNative() && task.main) {
|
|
397
|
+
clickgo.native.send('cg-main-close', JSON.stringify({
|
|
398
|
+
'token': clickgo.native.getToken()
|
|
399
|
+
}));
|
|
400
|
+
}
|
|
382
401
|
// --- 获取最大的 z index 窗体,并让他获取焦点 ---
|
|
383
402
|
const fid = form.getMaxZIndexID({
|
|
384
403
|
'taskIds': [task.id]
|
|
@@ -661,13 +680,13 @@ export function sleep(fun: () => void | Promise<void>, delay: number, taskId?: n
|
|
|
661
680
|
}
|
|
662
681
|
|
|
663
682
|
/** --- task 的信息 --- */
|
|
664
|
-
export const systemTaskInfo: types.ISystemTaskInfo =
|
|
683
|
+
export const systemTaskInfo: types.ISystemTaskInfo = clickgo.vue.reactive({
|
|
665
684
|
'taskId': 0,
|
|
666
685
|
'formId': 0,
|
|
667
686
|
'length': 0
|
|
668
687
|
});
|
|
669
688
|
|
|
670
|
-
|
|
689
|
+
clickgo.vue.watch(systemTaskInfo, function(n: any, o: any) {
|
|
671
690
|
const originKeys = ['taskId', 'formId', 'length'];
|
|
672
691
|
// --- 检测有没有缺少的 key ---
|
|
673
692
|
for (const key of originKeys) {
|
package/dist/lib/zip.ts
CHANGED
|
@@ -278,7 +278,7 @@ export class Zip {
|
|
|
278
278
|
*/
|
|
279
279
|
private _refreshList(): void {
|
|
280
280
|
const list: Record<string, Record<string, types.IZipItem>> = {};
|
|
281
|
-
this._zip.forEach(function(relativePath, item) {
|
|
281
|
+
this._zip.forEach(function(relativePath: string, item: jszip.JSZipObject) {
|
|
282
282
|
if (relativePath.startsWith('/')) {
|
|
283
283
|
relativePath = relativePath.slice(1);
|
|
284
284
|
}
|
package/dist/theme/familiar.cgt
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clickgo",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3-dev4",
|
|
4
4
|
"description": "Background interface, software interface, mobile phone APP interface operation library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deskrt",
|
|
7
7
|
"ui",
|
|
8
8
|
"clickgo"
|
|
9
9
|
],
|
|
10
|
-
"main": "dist/
|
|
10
|
+
"main": "dist/index.js",
|
|
11
11
|
"author": "hanguoshuai",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"types": "./types/index.d.ts",
|
|
14
14
|
"scripts": {
|
|
15
|
-
"native": "electron ./dist/test/native"
|
|
15
|
+
"native": "electron ./dist/test/native",
|
|
16
|
+
"native2": "electron ./dist/test/native/index2",
|
|
17
|
+
"native3": "electron ./dist/test/native/index3",
|
|
18
|
+
"native4": "electron ./dist/test/native/index4"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
|
-
"@litert/loader": "^3.
|
|
21
|
+
"@litert/loader": "^3.3.0",
|
|
19
22
|
"@types/node": "^17.0.21",
|
|
20
23
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
21
24
|
"@typescript-eslint/parser": "^5.17.0",
|
|
22
|
-
"electron": "^
|
|
25
|
+
"electron": "^19.0.8",
|
|
23
26
|
"eslint": "^8.12.0",
|
|
24
|
-
"jszip": "^3.10.0",
|
|
25
27
|
"typescript": "^4.6.4"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"jszip": "^3.10.0"
|
|
26
31
|
}
|
|
27
32
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -11,12 +11,11 @@ export let zip: typeof import('../dist/lib/zip');
|
|
|
11
11
|
|
|
12
12
|
export function getVersion(): string;
|
|
13
13
|
export function getNative(): boolean;
|
|
14
|
+
export function getPlatform(): NodeJS.Platform | 'web';
|
|
14
15
|
export function setSafe(val: boolean): void;
|
|
15
16
|
export function getSafe(): boolean;
|
|
16
|
-
export function setCdn(val: string): void;
|
|
17
|
-
export function getCdn(): string;
|
|
18
17
|
|
|
19
|
-
export function init(
|
|
18
|
+
export function init(): Promise<void>;
|
|
20
19
|
|
|
21
20
|
// --- core 核心 ---
|
|
22
21
|
|
|
@@ -84,6 +83,7 @@ export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCre
|
|
|
84
83
|
export interface ICoreFetchAppOptions {
|
|
85
84
|
'notifyId'?: number;
|
|
86
85
|
'current'?: string;
|
|
86
|
+
'progress'?: (loaded: number, total: number) => void | Promise<void>;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/** --- 应用文件包 --- */
|
|
@@ -341,7 +341,10 @@ export interface ISystemTaskInfo {
|
|
|
341
341
|
|
|
342
342
|
export interface ITaskRunOptions {
|
|
343
343
|
'icon'?: string;
|
|
344
|
-
'progress'?:
|
|
344
|
+
'progress'?: (loaded: number, total: number) => void | Promise<void>;
|
|
345
|
+
'notify'?: boolean;
|
|
346
|
+
'main'?: boolean;
|
|
347
|
+
'sync'?: boolean;
|
|
345
348
|
'taskId'?: number;
|
|
346
349
|
}
|
|
347
350
|
|
|
@@ -367,6 +370,7 @@ export interface ITask {
|
|
|
367
370
|
/** --- 当前 app 运行路径,末尾包含 / --- */
|
|
368
371
|
'path': string;
|
|
369
372
|
'files': Record<string, Blob | string>;
|
|
373
|
+
'main': boolean;
|
|
370
374
|
|
|
371
375
|
/** --- 已申请的权限列表 --- */
|
|
372
376
|
'permissions': Record<string, any>;
|
|
@@ -614,6 +618,17 @@ export interface IVControl extends IVue {
|
|
|
614
618
|
|
|
615
619
|
// --- vue ---
|
|
616
620
|
|
|
621
|
+
export interface IVueObject {
|
|
622
|
+
createApp(opt: any): IVueApp;
|
|
623
|
+
ref<T extends number | string>(obj: T): { 'value': T; };
|
|
624
|
+
reactive<T>(obj: T): T;
|
|
625
|
+
watch(
|
|
626
|
+
v: any,
|
|
627
|
+
cb: (n: any, o: any) => void | Promise<void>,
|
|
628
|
+
opt: Record<string, string | boolean>
|
|
629
|
+
): void;
|
|
630
|
+
}
|
|
631
|
+
|
|
617
632
|
export type IVueOptionMergeFunction = (to: unknown, from: unknown, instance: IVue) => any;
|
|
618
633
|
|
|
619
634
|
export interface IVueConfig {
|
package/types/dev.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
declare module 'clickgo' {
|
|
2
|
-
export const control: typeof import('../dist/lib/control');
|
|
3
|
-
export const core: typeof import('../dist/lib/core');
|
|
4
|
-
export const dom: typeof import('../dist/lib/Dom');
|
|
5
|
-
export const form: typeof import('../dist/lib/Form');
|
|
6
|
-
export const fs: typeof import('../dist/lib/fs');
|
|
7
|
-
export const native: typeof import('../dist/lib/native');
|
|
8
|
-
export const task: typeof import('../dist/lib/task');
|
|
9
|
-
export const theme: typeof import('../dist/lib/theme');
|
|
10
|
-
export const tool: typeof import('../dist/lib/tool');
|
|
11
|
-
export const zip: typeof import('../dist/lib/zip');
|
|
12
|
-
|
|
13
|
-
export function getVersion(): string;
|
|
14
|
-
export function getNative(): boolean;
|
|
15
|
-
export function setSafe(val: boolean): void;
|
|
16
|
-
export function getSafe(): boolean;
|
|
17
|
-
export function setCdn(val: string): void;
|
|
18
|
-
export function getCdn(): string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
declare namespace Vue {
|
|
22
|
-
export function createApp(opt: any): import('./index').IVueApp;
|
|
23
|
-
export function ref<T extends number | string>(obj: T): { 'value': T; };
|
|
24
|
-
export function reactive<T>(obj: T): T;
|
|
25
|
-
export function watch(
|
|
26
|
-
v: any,
|
|
27
|
-
cb: (n: any, o: any) => void | Promise<void>,
|
|
28
|
-
opt: Record<string, string | boolean>
|
|
29
|
-
): void;
|
|
30
|
-
}
|