clickgo 3.0.2-dev3 → 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 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
 
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/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);
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);
package/dist/lib/form.js CHANGED
@@ -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
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.0.2-dev3",
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",
@@ -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