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.
Files changed (67) hide show
  1. package/README.md +13 -2
  2. package/dist/app/demo/config.json +11 -1
  3. package/dist/app/demo/form/control/arteditor/arteditor.js +65 -0
  4. package/dist/app/demo/form/control/arteditor/arteditor.xml +12 -0
  5. package/dist/app/demo/form/control/arteditor/img.js +51 -0
  6. package/dist/app/demo/form/control/arteditor/img.xml +6 -0
  7. package/dist/app/demo/form/control/iconview/iconview.js +5 -0
  8. package/dist/app/demo/form/control/iconview/iconview.xml +14 -13
  9. package/dist/app/demo/form/control/text/text.js +2 -0
  10. package/dist/app/demo/form/control/text/text.xml +8 -4
  11. package/dist/app/demo/form/control/tuieditor/tuieditor.js +39 -0
  12. package/dist/app/demo/form/control/tuieditor/tuieditor.xml +13 -0
  13. package/dist/app/demo/form/event/form/form.js +7 -0
  14. package/dist/app/demo/form/event/form/form.xml +15 -15
  15. package/dist/app/demo/form/main.js +15 -0
  16. package/dist/app/demo/form/main.xml +3 -0
  17. package/dist/app/demo/form/method/aform/aform.js +1 -0
  18. package/dist/app/demo/form/method/aform/aform.xml +10 -0
  19. package/dist/app/demo/form/method/core/core.js +5 -0
  20. package/dist/app/demo/form/method/core/core.xml +2 -1
  21. package/dist/app/demo/form/method/form/form.js +16 -0
  22. package/dist/app/demo/form/method/form/form.xml +38 -27
  23. package/dist/app/demo/form/method/storage/storage.js +85 -0
  24. package/dist/app/demo/form/method/storage/storage.xml +18 -0
  25. package/dist/app/demo/res/marker.svg +0 -1
  26. package/dist/clickgo.js +3 -2
  27. package/dist/clickgo.ts +2 -1
  28. package/dist/control/arteditor.cgc +0 -0
  29. package/dist/control/box.cgc +0 -0
  30. package/dist/control/common.cgc +0 -0
  31. package/dist/control/desc.cgc +0 -0
  32. package/dist/control/echarts.cgc +0 -0
  33. package/dist/control/form.cgc +0 -0
  34. package/dist/control/html.cgc +0 -0
  35. package/dist/control/iconview.cgc +0 -0
  36. package/dist/control/map.cgc +0 -0
  37. package/dist/control/monaco.cgc +0 -0
  38. package/dist/control/nav.cgc +0 -0
  39. package/dist/control/page.cgc +0 -0
  40. package/dist/control/property.cgc +0 -0
  41. package/dist/control/table.cgc +0 -0
  42. package/dist/control/task.cgc +0 -0
  43. package/dist/control/tuieditor.cgc +0 -0
  44. package/dist/control/xterm.cgc +0 -0
  45. package/dist/ext/toastui-editor-all.min.js +24 -0
  46. package/dist/global.css +1 -1
  47. package/dist/index.js +4 -1
  48. package/dist/index.ts +7 -0
  49. package/dist/lib/control.js +5 -14
  50. package/dist/lib/control.ts +7 -10
  51. package/dist/lib/core.js +71 -16
  52. package/dist/lib/core.ts +66 -7
  53. package/dist/lib/dom.js +20 -2
  54. package/dist/lib/dom.ts +34 -11
  55. package/dist/lib/form.js +111 -40
  56. package/dist/lib/form.ts +139 -38
  57. package/dist/lib/fs.js +2 -2
  58. package/dist/lib/fs.ts +2 -2
  59. package/dist/lib/storage.js +207 -0
  60. package/dist/lib/storage.ts +218 -0
  61. package/dist/lib/task.js +38 -3
  62. package/dist/lib/task.ts +42 -7
  63. package/dist/theme/byterun.cgt +0 -0
  64. package/dist/theme/familiar.cgt +0 -0
  65. package/dist/theme/light.cgt +0 -0
  66. package/package.json +1 -1
  67. 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, mode: 'child' | 'childsub' | 'style' | 'default' = 'default', immediate: boolean = false): 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: var(--system-border-color);">' + tool.escapeHTML(item) + '</div>' +
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: var(--system-border-color);">' + tool.escapeHTML(item) + '</div>' +
1550
+ '<div style="color: hsl(0,0%,60%);">' + tool.escapeHTML(item) + '</div>' +
1516
1551
  '</div>';
1517
1552
  }
1518
1553
  if (await form.superConfirm(html)) {
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.6.7",
3
+ "version": "3.8.0",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",
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