clickgo 3.0.0-dev → 3.0.1-dev2
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/clickgo.js +2 -1
- package/dist/clickgo.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.ts +3 -0
- package/dist/lib/core.js +2 -2
- package/dist/lib/core.ts +2 -2
- package/dist/lib/form.js +2 -2
- package/dist/lib/form.ts +2 -2
- package/dist/lib/task.js +4 -3
- package/dist/lib/task.ts +4 -3
- package/dist/lib/zip.ts +1 -1
- package/package.json +5 -3
- package/types/index.d.ts +11 -0
- 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/MaiyunNET/ClickGo/blob/master/LICENSE)
|
|
9
|
+
[](https://github.com/MaiyunNET/ClickGo/issues)
|
|
10
|
+
[](https://github.com/MaiyunNET/ClickGo/releases "Stable Release")
|
|
11
|
+
[](https://github.com/MaiyunNET/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,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.getCdn = exports.setCdn = exports.getSafe = exports.setSafe = 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.getCdn = exports.setCdn = exports.getSafe = exports.setSafe = exports.getNative = exports.getVersion = void 0;
|
|
4
4
|
const version = '3.0.0';
|
|
5
5
|
function getVersion() {
|
|
6
6
|
return version;
|
|
@@ -29,6 +29,7 @@ function getCdn() {
|
|
|
29
29
|
return cdn;
|
|
30
30
|
}
|
|
31
31
|
exports.getCdn = getCdn;
|
|
32
|
+
exports.vue = window.Vue;
|
|
32
33
|
exports.control = require("./lib/control");
|
|
33
34
|
exports.core = require("./lib/core");
|
|
34
35
|
exports.dom = require("./lib/dom");
|
package/dist/clickgo.ts
CHANGED
|
@@ -39,6 +39,8 @@ export function getCdn(): string {
|
|
|
39
39
|
return cdn;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
export const vue: import('../types/index').IVueObject = (window as any).Vue;
|
|
43
|
+
|
|
42
44
|
export * as control from './lib/control';
|
|
43
45
|
export * as core from './lib/core';
|
|
44
46
|
export * as dom from './lib/dom';
|
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.getNative = exports.getVersion = 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.getCdn = exports.setCdn = exports.getSafe = exports.setSafe = 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
|
}
|
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();
|
package/dist/lib/core.js
CHANGED
|
@@ -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,7 @@ exports.config = Vue.reactive({
|
|
|
34
34
|
'desktop.wallpaper': null,
|
|
35
35
|
'desktop.path': null
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
clickgo.vue.watch(exports.config, function () {
|
|
38
38
|
for (const key in configOrigin) {
|
|
39
39
|
if (exports.config[key] !== undefined) {
|
|
40
40
|
continue;
|
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,7 @@ export const config: types.IConfig = Vue.reactive({
|
|
|
40
40
|
'desktop.path': null
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
clickgo.vue.watch(config, function() {
|
|
44
44
|
// --- 检测有没有缺少的 config key ---
|
|
45
45
|
for (const key in configOrigin) {
|
|
46
46
|
if ((config as any)[key] !== undefined) {
|
package/dist/lib/form.js
CHANGED
|
@@ -133,7 +133,7 @@ const elements = {
|
|
|
133
133
|
}, {
|
|
134
134
|
'passive': false
|
|
135
135
|
});
|
|
136
|
-
const simpleSystemtaskApp =
|
|
136
|
+
const simpleSystemtaskApp = clickgo.vue.createApp({
|
|
137
137
|
'template': '<div v-for="(item, formId) of forms" class="cg-simplesystemtask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simplesystemtask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
138
138
|
'data': function () {
|
|
139
139
|
return {
|
|
@@ -1849,7 +1849,7 @@ function create(opt) {
|
|
|
1849
1849
|
dom.pushStyle(taskId, style, 'form', formId);
|
|
1850
1850
|
}
|
|
1851
1851
|
const rtn = yield new Promise(function (resolve) {
|
|
1852
|
-
const vapp =
|
|
1852
|
+
const vapp = clickgo.vue.createApp({
|
|
1853
1853
|
'template': layout.replace(/^<cg-form/, '<cg-form ref="form"'),
|
|
1854
1854
|
'data': function () {
|
|
1855
1855
|
return tool.clone(data);
|
package/dist/lib/form.ts
CHANGED
|
@@ -199,7 +199,7 @@ const elements: {
|
|
|
199
199
|
}, {
|
|
200
200
|
'passive': false
|
|
201
201
|
});
|
|
202
|
-
const simpleSystemtaskApp =
|
|
202
|
+
const simpleSystemtaskApp = clickgo.vue.createApp({
|
|
203
203
|
'template': '<div v-for="(item, formId) of forms" class="cg-simplesystemtask-item" @click="click(parseInt(formId))"><div v-if="item.icon" class="cg-simplesystemtask-icon" :style="{\'background-image\': \'url(\' + item.icon + \')\'}"></div><div>{{item.title}}</div></div>',
|
|
204
204
|
'data': function() {
|
|
205
205
|
return {
|
|
@@ -2208,7 +2208,7 @@ export async function create(opt: string | types.IFormCreateOptions): Promise<nu
|
|
|
2208
2208
|
'vapp': types.IVueApp;
|
|
2209
2209
|
'vroot': types.IVForm;
|
|
2210
2210
|
} = await new Promise(function(resolve) {
|
|
2211
|
-
const vapp =
|
|
2211
|
+
const vapp = clickgo.vue.createApp({
|
|
2212
2212
|
'template': layout!.replace(/^<cg-form/, '<cg-form ref="form"'),
|
|
2213
2213
|
'data': function() {
|
|
2214
2214
|
return tool.clone(data);
|
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");
|
|
@@ -188,7 +189,7 @@ 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
|
}),
|
|
@@ -520,12 +521,12 @@ function sleep(fun, delay, taskId, formId) {
|
|
|
520
521
|
});
|
|
521
522
|
}
|
|
522
523
|
exports.sleep = sleep;
|
|
523
|
-
exports.systemTaskInfo =
|
|
524
|
+
exports.systemTaskInfo = clickgo.vue.reactive({
|
|
524
525
|
'taskId': 0,
|
|
525
526
|
'formId': 0,
|
|
526
527
|
'length': 0
|
|
527
528
|
});
|
|
528
|
-
|
|
529
|
+
clickgo.vue.watch(exports.systemTaskInfo, function (n, o) {
|
|
529
530
|
var _a, _b;
|
|
530
531
|
const originKeys = ['taskId', 'formId', 'length'];
|
|
531
532
|
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';
|
|
@@ -242,7 +243,7 @@ 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
|
}),
|
|
@@ -661,13 +662,13 @@ export function sleep(fun: () => void | Promise<void>, delay: number, taskId?: n
|
|
|
661
662
|
}
|
|
662
663
|
|
|
663
664
|
/** --- task 的信息 --- */
|
|
664
|
-
export const systemTaskInfo: types.ISystemTaskInfo =
|
|
665
|
+
export const systemTaskInfo: types.ISystemTaskInfo = clickgo.vue.reactive({
|
|
665
666
|
'taskId': 0,
|
|
666
667
|
'formId': 0,
|
|
667
668
|
'length': 0
|
|
668
669
|
});
|
|
669
670
|
|
|
670
|
-
|
|
671
|
+
clickgo.vue.watch(systemTaskInfo, function(n: any, o: any) {
|
|
671
672
|
const originKeys = ['taskId', 'formId', 'length'];
|
|
672
673
|
// --- 检测有没有缺少的 key ---
|
|
673
674
|
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/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clickgo",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-dev2",
|
|
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",
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"@typescript-eslint/parser": "^5.17.0",
|
|
22
22
|
"electron": "^18.3.4",
|
|
23
23
|
"eslint": "^8.12.0",
|
|
24
|
-
"jszip": "^3.10.0",
|
|
25
24
|
"typescript": "^4.6.4"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"jszip": "^3.10.0"
|
|
26
28
|
}
|
|
27
29
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -614,6 +614,17 @@ export interface IVControl extends IVue {
|
|
|
614
614
|
|
|
615
615
|
// --- vue ---
|
|
616
616
|
|
|
617
|
+
export interface IVueObject {
|
|
618
|
+
createApp(opt: any): IVueApp;
|
|
619
|
+
ref<T extends number | string>(obj: T): { 'value': T; };
|
|
620
|
+
reactive<T>(obj: T): T;
|
|
621
|
+
watch(
|
|
622
|
+
v: any,
|
|
623
|
+
cb: (n: any, o: any) => void | Promise<void>,
|
|
624
|
+
opt: Record<string, string | boolean>
|
|
625
|
+
): void;
|
|
626
|
+
}
|
|
627
|
+
|
|
617
628
|
export type IVueOptionMergeFunction = (to: unknown, from: unknown, instance: IVue) => any;
|
|
618
629
|
|
|
619
630
|
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
|
-
}
|