clickgo 3.0.7-dev8 → 3.1.0-dev9
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 +1 -1
- package/dist/app/demo/app.js +93 -0
- package/dist/app/demo/form/control/form/form.js +21 -20
- package/dist/app/demo/form/control/form/form.xml +3 -3
- package/dist/app/demo/form/main.js +20 -10
- package/dist/app/demo/form/main.xml +1 -1
- package/dist/app/task/app.js +46 -0
- package/dist/app/task/form/bar/bar.js +84 -88
- package/dist/app/task/form/bar/bar.xml +4 -5
- package/dist/clickgo.js +1 -10
- package/dist/clickgo.ts +0 -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/index.js +105 -56
- package/dist/index.ts +164 -59
- package/dist/lib/control.js +363 -240
- package/dist/lib/control.ts +497 -284
- package/dist/lib/core.js +313 -228
- package/dist/lib/core.ts +400 -255
- package/dist/lib/dom.ts +1 -3
- package/dist/lib/form.js +398 -928
- package/dist/lib/form.ts +630 -1075
- package/dist/lib/fs.js +42 -39
- package/dist/lib/fs.ts +45 -41
- package/dist/lib/native.ts +3 -0
- package/dist/lib/task.js +705 -182
- package/dist/lib/task.ts +775 -200
- package/dist/lib/theme.ts +2 -2
- package/dist/lib/tool.js +58 -48
- package/dist/lib/tool.ts +79 -64
- package/dist/theme/familiar.cgt +0 -0
- package/package.json +5 -7
- package/types/index.d.ts +274 -325
- package/dist/app/demo/config.json +0 -106
- package/dist/app/task/config.json +0 -32
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.
|
|
12
|
+
exports.launcher = exports.AbstractBoot = 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
|
}
|
|
@@ -22,62 +22,111 @@ function getPlatform() {
|
|
|
22
22
|
return exports.clickgo.getPlatform();
|
|
23
23
|
}
|
|
24
24
|
exports.getPlatform = getPlatform;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
class AbstractBoot {
|
|
26
|
+
onError() {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
onScreenResize() {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
onConfigChanged() {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
onFormCreated() {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
onFormRemoved() {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
onFormTitleChanged() {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
onFormIconChanged() {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
onFormStateMinChanged() {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
onFormStateMaxChanged() {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
onFormShowChanged() {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
onFormFocused() {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
onFormBlurred() {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
onFormFlash() {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
onTaskStarted() {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
onTaskEnded() {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
onLauncherFolderNameChanged() {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
27
74
|
}
|
|
28
|
-
exports.
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
exports.AbstractBoot = AbstractBoot;
|
|
76
|
+
function launcher(boot) {
|
|
77
|
+
(function () {
|
|
78
|
+
var _a;
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const paths = [
|
|
81
|
+
loader.cdn + '/npm/vue@3.2.40/dist/vue.global.prod.min.js'
|
|
82
|
+
];
|
|
83
|
+
let ro = true;
|
|
84
|
+
if (!(window.ResizeObserver)) {
|
|
85
|
+
ro = false;
|
|
86
|
+
paths.push(loader.cdn + '/npm/@juggle/resize-observer@3.4.0/lib/exports/resize-observer.umd.min.js');
|
|
87
|
+
}
|
|
88
|
+
yield loader.loadScripts(paths);
|
|
89
|
+
if (!ro) {
|
|
90
|
+
window.ResizeObserverEntry = window.ResizeObserver.ResizeObserverEntry;
|
|
91
|
+
window.ResizeObserver = window.ResizeObserver.ResizeObserver;
|
|
92
|
+
}
|
|
93
|
+
const map = {
|
|
94
|
+
'jszip': loader.cdn + '/npm/jszip@3.10.0/dist/jszip.min'
|
|
95
|
+
};
|
|
96
|
+
const after = '?' + Math.random().toString();
|
|
97
|
+
const files = yield loader.sniffFiles('clickgo.js', {
|
|
98
|
+
'dir': __dirname + '/',
|
|
99
|
+
'after': after,
|
|
100
|
+
'afterIgnore': new RegExp('^' + loader.cdn.replace(/\./g, '\\.')),
|
|
101
|
+
'map': map
|
|
102
|
+
});
|
|
103
|
+
const cg = loader.require('clickgo', files, {
|
|
104
|
+
'dir': __dirname + '/',
|
|
105
|
+
'map': map
|
|
106
|
+
})[0];
|
|
107
|
+
try {
|
|
108
|
+
const style = yield (yield fetch(__dirname + '/global.css' + (!__dirname.startsWith(loader.cdn) ? after : ''))).text();
|
|
109
|
+
(_a = document.getElementById('cg-global')) === null || _a === void 0 ? void 0 : _a.insertAdjacentHTML('afterbegin', style);
|
|
110
|
+
}
|
|
111
|
+
catch (_b) {
|
|
112
|
+
alert(`ClickGo: "${__dirname}/global.css'" failed.`);
|
|
113
|
+
}
|
|
114
|
+
exports.clickgo = cg;
|
|
115
|
+
exports.control = cg.control;
|
|
116
|
+
exports.core = cg.core;
|
|
117
|
+
exports.dom = cg.dom;
|
|
118
|
+
exports.form = cg.form;
|
|
119
|
+
exports.fs = cg.fs;
|
|
120
|
+
exports.native = cg.native;
|
|
121
|
+
exports.task = cg.task;
|
|
122
|
+
exports.theme = cg.theme;
|
|
123
|
+
exports.tool = cg.tool;
|
|
124
|
+
exports.zip = cg.zip;
|
|
125
|
+
exports.core.boot = boot;
|
|
126
|
+
yield boot.main();
|
|
58
127
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
'map': map
|
|
62
|
-
})[0];
|
|
63
|
-
try {
|
|
64
|
-
const style = yield (yield fetch(__dirname + '/global.css' + (!__dirname.startsWith(loader.cdn) ? after : ''))).text();
|
|
65
|
-
(_a = document.getElementById('cg-global')) === null || _a === void 0 ? void 0 : _a.insertAdjacentHTML('afterbegin', style);
|
|
66
|
-
}
|
|
67
|
-
catch (_b) {
|
|
68
|
-
alert(`ClickGo: "${__dirname}/global.css'" failed.`);
|
|
69
|
-
}
|
|
70
|
-
exports.clickgo = cg;
|
|
71
|
-
exports.control = cg.control;
|
|
72
|
-
exports.core = cg.core;
|
|
73
|
-
exports.dom = cg.dom;
|
|
74
|
-
exports.form = cg.form;
|
|
75
|
-
exports.fs = cg.fs;
|
|
76
|
-
exports.native = cg.native;
|
|
77
|
-
exports.task = cg.task;
|
|
78
|
-
exports.theme = cg.theme;
|
|
79
|
-
exports.tool = cg.tool;
|
|
80
|
-
exports.zip = cg.zip;
|
|
128
|
+
})().catch(function () {
|
|
129
|
+
return;
|
|
81
130
|
});
|
|
82
131
|
}
|
|
83
|
-
exports.
|
|
132
|
+
exports.launcher = launcher;
|
package/dist/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// npm publish --tag dev --access public
|
|
2
|
+
import * as types from '~/types';
|
|
2
3
|
|
|
3
4
|
// --- 以下不会真正加载,最终会在底部进行赋值 ---
|
|
4
5
|
export let clickgo: typeof import('./clickgo');
|
|
@@ -26,66 +27,170 @@ export function getPlatform(): NodeJS.Platform | 'web' {
|
|
|
26
27
|
return clickgo.getPlatform();
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
/** --- 全局类 --- */
|
|
31
|
+
export abstract class AbstractBoot {
|
|
32
|
+
|
|
33
|
+
/** --- 入口文件 --- */
|
|
34
|
+
public abstract main(): void | Promise<void>;
|
|
35
|
+
|
|
36
|
+
/** --- 全局错误事件 --- */
|
|
37
|
+
public onError(taskId: number, formId: number, error: Error, info: string): void | Promise<void>;
|
|
38
|
+
public onError(): void {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** --- 屏幕大小改变事件 --- */
|
|
43
|
+
public onScreenResize(): void | Promise<void>;
|
|
44
|
+
public onScreenResize(): void {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** --- 系统配置变更事件 --- */
|
|
49
|
+
public onConfigChanged<T extends types.IConfig, TK extends keyof T>(n: TK, v: T[TK]): void | Promise<void>;
|
|
50
|
+
public onConfigChanged(): void {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** --- 窗体创建事件 --- */
|
|
55
|
+
public onFormCreated(taskId: number, formId: number, title: string, icon: string): void | Promise<void>;
|
|
56
|
+
public onFormCreated(): void {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** --- 窗体销毁事件 */
|
|
61
|
+
public onFormRemoved(taskId: number, formId: number, title: string, icon: string): void | Promise<void>;
|
|
62
|
+
public onFormRemoved(): void {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** --- 窗体标题改变事件 */
|
|
67
|
+
public onFormTitleChanged(taskId: number, formId: number, title: string): void | Promise<void>;
|
|
68
|
+
public onFormTitleChanged(): void | Promise<void> {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** --- 窗体图标改变事件 --- */
|
|
73
|
+
public onFormIconChanged(taskId: number, formId: number, icon: string): void | Promise<void>;
|
|
74
|
+
public onFormIconChanged(): void | Promise<void> {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** --- 窗体最小化状态改变事件 --- */
|
|
79
|
+
public onFormStateMinChanged(taskId: number, formId: number, state: boolean): void | Promise<void>;
|
|
80
|
+
public onFormStateMinChanged(): void {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** --- 窗体最大化状态改变事件 --- */
|
|
85
|
+
public onFormStateMaxChanged(taskId: number, formId: number, state: boolean): void | Promise<void>;
|
|
86
|
+
public onFormStateMaxChanged(): void {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** --- 窗体显示状态改变事件 --- */
|
|
91
|
+
public onFormShowChanged(taskId: number, formId: number, state: boolean): void | Promise<void>;
|
|
92
|
+
public onFormShowChanged(): void {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** --- 窗体获得焦点事件 --- */
|
|
97
|
+
public onFormFocused(taskId: number, formId: number): void | Promise<void>;
|
|
98
|
+
public onFormFocused(): void {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** --- 窗体丢失焦点事件 --- */
|
|
103
|
+
public onFormBlurred(taskId: number, formId: number): void | Promise<void>;
|
|
104
|
+
public onFormBlurred(): void {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** --- 窗体闪烁事件 --- */
|
|
109
|
+
public onFormFlash(taskId: number, formId: number): void | Promise<void>;
|
|
110
|
+
public onFormFlash(): void {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** --- 任务开始事件 --- */
|
|
115
|
+
public onTaskStarted(taskId: number): void | Promise<void>;
|
|
116
|
+
public onTaskStarted(): void | Promise<void> {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** --- 任务结束事件 --- */
|
|
121
|
+
public onTaskEnded(taskId: number): void | Promise<void>;
|
|
122
|
+
public onTaskEnded(): void | Promise<void> {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** --- launcher 文件夹名称修改事件 --- */
|
|
127
|
+
public onLauncherFolderNameChanged(id: string, name: string): void | Promise<void>;
|
|
128
|
+
public onLauncherFolderNameChanged(): void {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
34
132
|
}
|
|
35
133
|
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
134
|
+
export function launcher(boot: AbstractBoot): void {
|
|
135
|
+
(async function() {
|
|
136
|
+
// --- 通过标签加载库 ---
|
|
137
|
+
const paths: string[] = [
|
|
138
|
+
loader.cdn + '/npm/vue@3.2.40/dist/vue.global.prod.min.js'
|
|
139
|
+
];
|
|
140
|
+
// --- 判断 ResizeObserver 是否存在 ---
|
|
141
|
+
let ro = true;
|
|
142
|
+
// ResizeObserver = undefined;
|
|
143
|
+
if (!((window as any).ResizeObserver)) {
|
|
144
|
+
ro = false;
|
|
145
|
+
paths.push(loader.cdn + '/npm/@juggle/resize-observer@3.4.0/lib/exports/resize-observer.umd.min.js');
|
|
146
|
+
}
|
|
147
|
+
// --- 加载 vue 以及必要库 ---
|
|
148
|
+
await loader.loadScripts(paths);
|
|
149
|
+
// --- 处理 ResizeObserver ---
|
|
150
|
+
if (!ro) {
|
|
151
|
+
(window as any).ResizeObserverEntry = (window as any).ResizeObserver.ResizeObserverEntry;
|
|
152
|
+
(window as any).ResizeObserver = (window as any).ResizeObserver.ResizeObserver;
|
|
153
|
+
}
|
|
154
|
+
// --- map 加载库 ---
|
|
155
|
+
const map: Record<string, string> = {
|
|
156
|
+
'jszip': loader.cdn + '/npm/jszip@3.10.0/dist/jszip.min'
|
|
157
|
+
};
|
|
158
|
+
// --- 加载 clickgo 主程序 ---
|
|
159
|
+
const after = '?' + Math.random().toString();
|
|
160
|
+
const files = await loader.sniffFiles('clickgo.js', {
|
|
161
|
+
'dir': __dirname + '/',
|
|
162
|
+
'after': after,
|
|
163
|
+
'afterIgnore': new RegExp('^' + loader.cdn.replace(/\./g, '\\.')),
|
|
164
|
+
'map': map
|
|
165
|
+
});
|
|
166
|
+
const cg = loader.require('clickgo', files, {
|
|
167
|
+
'dir': __dirname + '/',
|
|
168
|
+
'map': map
|
|
169
|
+
})[0] as typeof import('../dist/clickgo');
|
|
170
|
+
// --- 加载 clickgo 的 global css ---
|
|
171
|
+
try {
|
|
172
|
+
const style = await (await fetch(__dirname + '/global.css' + (!__dirname.startsWith(loader.cdn) ? after : ''))).text();
|
|
173
|
+
document.getElementById('cg-global')?.insertAdjacentHTML('afterbegin', style);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
alert(`ClickGo: "${__dirname}/global.css'" failed.`);
|
|
177
|
+
}
|
|
178
|
+
// --- 设置一些项目 ---
|
|
179
|
+
clickgo = cg;
|
|
180
|
+
control = cg.control;
|
|
181
|
+
core = cg.core;
|
|
182
|
+
dom = cg.dom;
|
|
183
|
+
form = cg.form;
|
|
184
|
+
fs = cg.fs;
|
|
185
|
+
native = cg.native;
|
|
186
|
+
task = cg.task;
|
|
187
|
+
theme = cg.theme;
|
|
188
|
+
tool = cg.tool;
|
|
189
|
+
zip = cg.zip;
|
|
190
|
+
core.boot = boot;
|
|
191
|
+
// --- 执行回调 ---
|
|
192
|
+
await boot.main();
|
|
193
|
+
})().catch(function() {
|
|
194
|
+
return;
|
|
66
195
|
});
|
|
67
|
-
const cg = loader.require('clickgo', files, {
|
|
68
|
-
'dir': __dirname + '/',
|
|
69
|
-
'map': map
|
|
70
|
-
})[0] as typeof import('../dist/clickgo');
|
|
71
|
-
// --- 加载 clickgo 的 global css ---
|
|
72
|
-
try {
|
|
73
|
-
const style = await (await fetch(__dirname + '/global.css' + (!__dirname.startsWith(loader.cdn) ? after : ''))).text();
|
|
74
|
-
document.getElementById('cg-global')?.insertAdjacentHTML('afterbegin', style);
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
alert(`ClickGo: "${__dirname}/global.css'" failed.`);
|
|
78
|
-
}
|
|
79
|
-
// --- 设置一些项目 ---
|
|
80
|
-
clickgo = cg;
|
|
81
|
-
control = cg.control;
|
|
82
|
-
core = cg.core;
|
|
83
|
-
dom = cg.dom;
|
|
84
|
-
form = cg.form;
|
|
85
|
-
fs = cg.fs;
|
|
86
|
-
native = cg.native;
|
|
87
|
-
task = cg.task;
|
|
88
|
-
theme = cg.theme;
|
|
89
|
-
tool = cg.tool;
|
|
90
|
-
zip = cg.zip;
|
|
91
196
|
}
|