clickgo 3.6.7 → 3.8.0
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 +13 -2
- package/dist/app/demo/config.json +11 -1
- package/dist/app/demo/form/control/arteditor/arteditor.js +65 -0
- package/dist/app/demo/form/control/arteditor/arteditor.xml +12 -0
- package/dist/app/demo/form/control/arteditor/img.js +51 -0
- package/dist/app/demo/form/control/arteditor/img.xml +6 -0
- package/dist/app/demo/form/control/iconview/iconview.js +5 -0
- package/dist/app/demo/form/control/iconview/iconview.xml +14 -13
- package/dist/app/demo/form/control/text/text.js +2 -0
- package/dist/app/demo/form/control/text/text.xml +8 -4
- package/dist/app/demo/form/control/tuieditor/tuieditor.js +39 -0
- package/dist/app/demo/form/control/tuieditor/tuieditor.xml +13 -0
- package/dist/app/demo/form/event/form/form.js +7 -0
- package/dist/app/demo/form/event/form/form.xml +15 -15
- package/dist/app/demo/form/main.js +15 -0
- package/dist/app/demo/form/main.xml +3 -0
- package/dist/app/demo/form/method/aform/aform.js +1 -0
- package/dist/app/demo/form/method/aform/aform.xml +10 -0
- package/dist/app/demo/form/method/core/core.js +5 -0
- package/dist/app/demo/form/method/core/core.xml +2 -1
- package/dist/app/demo/form/method/form/form.js +16 -0
- package/dist/app/demo/form/method/form/form.xml +38 -27
- package/dist/app/demo/form/method/storage/storage.js +85 -0
- package/dist/app/demo/form/method/storage/storage.xml +18 -0
- package/dist/app/demo/res/marker.svg +0 -1
- package/dist/clickgo.js +3 -2
- package/dist/clickgo.ts +2 -1
- package/dist/control/arteditor.cgc +0 -0
- package/dist/control/box.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/echarts.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/html.cgc +0 -0
- package/dist/control/iconview.cgc +0 -0
- package/dist/control/map.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/page.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/table.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/control/tuieditor.cgc +0 -0
- package/dist/control/xterm.cgc +0 -0
- package/dist/ext/toastui-editor-all.min.js +24 -0
- package/dist/global.css +1 -1
- package/dist/index.js +4 -1
- package/dist/index.ts +7 -0
- package/dist/lib/control.js +5 -14
- package/dist/lib/control.ts +7 -10
- package/dist/lib/core.js +71 -16
- package/dist/lib/core.ts +66 -7
- package/dist/lib/dom.js +20 -2
- package/dist/lib/dom.ts +34 -11
- package/dist/lib/form.js +111 -40
- package/dist/lib/form.ts +139 -38
- package/dist/lib/fs.js +2 -2
- package/dist/lib/fs.ts +2 -2
- package/dist/lib/storage.js +207 -0
- package/dist/lib/storage.ts +218 -0
- package/dist/lib/task.js +38 -3
- package/dist/lib/task.ts +42 -7
- package/dist/theme/byterun.cgt +0 -0
- package/dist/theme/familiar.cgt +0 -0
- package/dist/theme/light.cgt +0 -0
- package/package.json +1 -1
- package/types/index.d.ts +3 -2
package/dist/lib/task.ts
CHANGED
|
@@ -507,6 +507,9 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
507
507
|
getHash: function(): string {
|
|
508
508
|
return core.getHash();
|
|
509
509
|
},
|
|
510
|
+
getHost: function(): string {
|
|
511
|
+
return core.getHost();
|
|
512
|
+
},
|
|
510
513
|
location: function(url: string): boolean {
|
|
511
514
|
return core.location(url, taskId);
|
|
512
515
|
},
|
|
@@ -549,7 +552,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
549
552
|
getWatchCount: function(taskId?: number): number {
|
|
550
553
|
return dom.getWatchCount(taskId);
|
|
551
554
|
},
|
|
552
|
-
watch: function(el: HTMLElement, cb: () => void
|
|
555
|
+
watch: function(el: HTMLElement, cb: (mutations: MutationRecord[]) => void | Promise<void>, mode: 'child' | 'childsub' | 'style' | 'default' = 'default', immediate: boolean = false): void {
|
|
553
556
|
dom.watch(el, cb, mode, immediate, taskId);
|
|
554
557
|
},
|
|
555
558
|
unwatch: function(el: HTMLElement): void {
|
|
@@ -561,7 +564,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
561
564
|
watchStyle: function(
|
|
562
565
|
el: HTMLElement,
|
|
563
566
|
name: string | string[],
|
|
564
|
-
cb: (name: string, value: string, old: string) => void
|
|
567
|
+
cb: (name: string, value: string, old: string) => void | Promise<void>,
|
|
565
568
|
immediate: boolean = false
|
|
566
569
|
): void {
|
|
567
570
|
dom.watchStyle(el, name, cb, immediate);
|
|
@@ -572,7 +575,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
572
575
|
watchProperty: function(
|
|
573
576
|
el: HTMLElement,
|
|
574
577
|
name: string | string[],
|
|
575
|
-
cb: (name: string, value: string) => void
|
|
578
|
+
cb: (name: string, value: string) => void | Promise<void>,
|
|
576
579
|
immediate: boolean = false
|
|
577
580
|
): void {
|
|
578
581
|
dom.watchProperty(el, name, cb, immediate);
|
|
@@ -633,6 +636,9 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
633
636
|
findParentByClass: function(el: HTMLElement, name: string): HTMLElement | null {
|
|
634
637
|
return dom.findParentByClass(el, name);
|
|
635
638
|
},
|
|
639
|
+
findParentByTag(el: HTMLElement, name: string): HTMLElement | null {
|
|
640
|
+
return dom.findParentByTag(el, name);
|
|
641
|
+
},
|
|
636
642
|
siblings: function(el: HTMLElement): HTMLElement[] {
|
|
637
643
|
return dom.siblings(el);
|
|
638
644
|
},
|
|
@@ -690,6 +696,15 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
690
696
|
setActivePanel: function(panelId: number, formId: number): boolean {
|
|
691
697
|
return form.setActivePanel(panelId, formId, taskId);
|
|
692
698
|
},
|
|
699
|
+
hash: function(hash: string, formId: number): boolean {
|
|
700
|
+
return form.hash(hash, formId);
|
|
701
|
+
},
|
|
702
|
+
getHash: function(formId: number): string {
|
|
703
|
+
return form.getHash(formId);
|
|
704
|
+
},
|
|
705
|
+
hashBack: function(formId: number): boolean {
|
|
706
|
+
return form.hashBack(formId);
|
|
707
|
+
},
|
|
693
708
|
changeFocus: function(fid: number = 0): void {
|
|
694
709
|
form.changeFocus(fid);
|
|
695
710
|
},
|
|
@@ -919,8 +934,28 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
919
934
|
return native.isMax();
|
|
920
935
|
}
|
|
921
936
|
},
|
|
937
|
+
'storage': {
|
|
938
|
+
get: function(key: string): any {
|
|
939
|
+
return clickgo.storage.get(key, taskId);
|
|
940
|
+
},
|
|
941
|
+
set: function(key: string, val: string | number | any[] | Record<string, any>): boolean {
|
|
942
|
+
return clickgo.storage.set(key, val, taskId);
|
|
943
|
+
},
|
|
944
|
+
remove: function(key: string): boolean {
|
|
945
|
+
return clickgo.storage.remove(key, taskId);
|
|
946
|
+
},
|
|
947
|
+
list: function(): Record<string, number> {
|
|
948
|
+
return clickgo.storage.list(taskId);
|
|
949
|
+
},
|
|
950
|
+
all: function(): Record<string, number> {
|
|
951
|
+
return clickgo.storage.all();
|
|
952
|
+
},
|
|
953
|
+
clear: function(path: string): Promise<number> {
|
|
954
|
+
return clickgo.storage.clear(path);
|
|
955
|
+
}
|
|
956
|
+
},
|
|
922
957
|
'task': {
|
|
923
|
-
getFocus(): number | null {
|
|
958
|
+
getFocus: function(): number | null {
|
|
924
959
|
return focusId;
|
|
925
960
|
},
|
|
926
961
|
onFrame: function(fun: () => void | Promise<void>, opt: any = {}): number {
|
|
@@ -1151,7 +1186,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
1151
1186
|
return code;
|
|
1152
1187
|
};
|
|
1153
1188
|
app.files['/invoke/clickgo.js'] = `module.exports = invokeClickgo;`;
|
|
1154
|
-
/** --- .cga
|
|
1189
|
+
/** --- .cga 文件,或者以 / 结尾的路径 --- */
|
|
1155
1190
|
const path = opt.path ?? ((typeof url === 'string') ? url : '/runtime/' + tool.random(8, tool.RANDOM_LUN) + '.cga');
|
|
1156
1191
|
const lio = path.endsWith('.cga') ? path.lastIndexOf('/') : path.slice(0, -1).lastIndexOf('/');
|
|
1157
1192
|
const current = path.slice(0, lio);
|
|
@@ -1505,14 +1540,14 @@ export async function checkPermission(
|
|
|
1505
1540
|
const path = item.slice(3, -1);
|
|
1506
1541
|
html += '<div style="margin-top: 10px;">' +
|
|
1507
1542
|
(locale[core.config.locale]?.fs ?? locale['en'].fs) + ' ' + tool.escapeHTML(path) + ' ' + (item.endsWith('r') ? (locale[core.config.locale]?.readonly ?? locale['en'].readonly) : (locale[core.config.locale]?.['read-write'] ?? locale['en']['read-write'])) +
|
|
1508
|
-
'<div style="color:
|
|
1543
|
+
'<div style="color: hsl(0,0%,60%);">' + tool.escapeHTML(item) + '</div>' +
|
|
1509
1544
|
'</div>';
|
|
1510
1545
|
continue;
|
|
1511
1546
|
}
|
|
1512
1547
|
const lang = (locale as any)[core.config.locale]?.[item] ?? (locale as any)['en'][item];
|
|
1513
1548
|
html += '<div style="margin-top: 10px;">' +
|
|
1514
1549
|
(lang ?? locale[core.config.locale]?.unknown ?? locale['en'].unknown) +
|
|
1515
|
-
'<div style="color:
|
|
1550
|
+
'<div style="color: hsl(0,0%,60%);">' + tool.escapeHTML(item) + '</div>' +
|
|
1516
1551
|
'</div>';
|
|
1517
1552
|
}
|
|
1518
1553
|
if (await form.superConfirm(html)) {
|
package/dist/theme/byterun.cgt
CHANGED
|
Binary file
|
package/dist/theme/familiar.cgt
CHANGED
|
Binary file
|
package/dist/theme/light.cgt
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * as dom from '../dist/lib/dom';
|
|
|
4
4
|
export * as form from '../dist/lib/form';
|
|
5
5
|
export * as fs from '../dist/lib/fs';
|
|
6
6
|
export * as native from '../dist/lib/native';
|
|
7
|
+
export * as storage from '../dist/lib/storage';
|
|
7
8
|
export * as task from '../dist/lib/task';
|
|
8
9
|
export * as theme from '../dist/lib/theme';
|
|
9
10
|
export * as tool from '../dist/lib/tool';
|
|
@@ -85,7 +86,7 @@ export interface IAvailArea {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
/** --- 全局事件类型 --- */
|
|
88
|
-
export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'formShowInSystemTaskChange' | 'taskStarted' | 'taskEnded' | 'launcherFolderNameChanged' | 'hashChanged';
|
|
89
|
+
export type TGlobalEvent = 'error' | 'screenResize' | 'configChanged' | 'formCreated' | 'formRemoved' | 'formTitleChanged' | 'formIconChanged' | 'formStateMinChanged' | 'formStateMaxChanged' | 'formShowChanged' | 'formFocused' | 'formBlurred' | 'formFlash' | 'formShowInSystemTaskChange' | 'formHashChange' | 'taskStarted' | 'taskEnded' | 'launcherFolderNameChanged' | 'hashChanged';
|
|
89
90
|
|
|
90
91
|
/** --- 现场下载 app 的参数 --- */
|
|
91
92
|
export interface ICoreFetchAppOptions {
|
|
@@ -435,7 +436,7 @@ export interface ITaskRunOptions {
|
|
|
435
436
|
'permissions'?: string[];
|
|
436
437
|
/** --- 给 task 传值 --- */
|
|
437
438
|
'data'?: Record<string, any>;
|
|
438
|
-
/** --- 执行文件的基路径,一般在传入 APP 包时使用,以 .cga
|
|
439
|
+
/** --- 执行文件的基路径,一般在传入 APP 包时使用,以 .cga 结尾或以 / 结尾的路径 --- */
|
|
439
440
|
'path'?: string;
|
|
440
441
|
}
|
|
441
442
|
|