clickgo 3.0.0-dev

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 (145) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/dist/app/demo/config.json +106 -0
  4. package/dist/app/demo/form/control/block/block.css +1 -0
  5. package/dist/app/demo/form/control/block/block.scss +17 -0
  6. package/dist/app/demo/form/control/block/block.xml +7 -0
  7. package/dist/app/demo/form/control/button/button.css +1 -0
  8. package/dist/app/demo/form/control/button/button.js +27 -0
  9. package/dist/app/demo/form/control/button/button.scss +18 -0
  10. package/dist/app/demo/form/control/button/button.xml +126 -0
  11. package/dist/app/demo/form/control/check/check.js +12 -0
  12. package/dist/app/demo/form/control/check/check.xml +13 -0
  13. package/dist/app/demo/form/control/dialog/dialog.js +8 -0
  14. package/dist/app/demo/form/control/dialog/dialog.xml +26 -0
  15. package/dist/app/demo/form/control/file/file.js +23 -0
  16. package/dist/app/demo/form/control/file/file.xml +25 -0
  17. package/dist/app/demo/form/control/form/form.css +1 -0
  18. package/dist/app/demo/form/control/form/form.js +38 -0
  19. package/dist/app/demo/form/control/form/form.scss +9 -0
  20. package/dist/app/demo/form/control/form/form.xml +28 -0
  21. package/dist/app/demo/form/control/greatview/greatview.css +1 -0
  22. package/dist/app/demo/form/control/greatview/greatview.js +92 -0
  23. package/dist/app/demo/form/control/greatview/greatview.scss +22 -0
  24. package/dist/app/demo/form/control/greatview/greatview.xml +89 -0
  25. package/dist/app/demo/form/control/img/img.xml +16 -0
  26. package/dist/app/demo/form/control/label/label.xml +11 -0
  27. package/dist/app/demo/form/control/list/list.css +1 -0
  28. package/dist/app/demo/form/control/list/list.js +194 -0
  29. package/dist/app/demo/form/control/list/list.scss +7 -0
  30. package/dist/app/demo/form/control/list/list.xml +91 -0
  31. package/dist/app/demo/form/control/loading/loading.xml +8 -0
  32. package/dist/app/demo/form/control/marquee/marquee.js +30 -0
  33. package/dist/app/demo/form/control/marquee/marquee.xml +36 -0
  34. package/dist/app/demo/form/control/menu/menu.js +8 -0
  35. package/dist/app/demo/form/control/menu/menu.xml +122 -0
  36. package/dist/app/demo/form/control/monaco/monaco.js +113 -0
  37. package/dist/app/demo/form/control/monaco/monaco.xml +27 -0
  38. package/dist/app/demo/form/control/overflow/overflow.css +1 -0
  39. package/dist/app/demo/form/control/overflow/overflow.js +70 -0
  40. package/dist/app/demo/form/control/overflow/overflow.scss +18 -0
  41. package/dist/app/demo/form/control/overflow/overflow.xml +98 -0
  42. package/dist/app/demo/form/control/property/property.js +129 -0
  43. package/dist/app/demo/form/control/property/property.xml +6 -0
  44. package/dist/app/demo/form/control/radio/radio.js +7 -0
  45. package/dist/app/demo/form/control/radio/radio.xml +12 -0
  46. package/dist/app/demo/form/control/scroll/scroll.js +14 -0
  47. package/dist/app/demo/form/control/scroll/scroll.xml +35 -0
  48. package/dist/app/demo/form/control/select/select.js +91 -0
  49. package/dist/app/demo/form/control/select/select.xml +74 -0
  50. package/dist/app/demo/form/control/tab/tab.js +75 -0
  51. package/dist/app/demo/form/control/tab/tab.xml +22 -0
  52. package/dist/app/demo/form/control/text/text.js +53 -0
  53. package/dist/app/demo/form/control/text/text.xml +37 -0
  54. package/dist/app/demo/form/control/view/view.css +1 -0
  55. package/dist/app/demo/form/control/view/view.js +73 -0
  56. package/dist/app/demo/form/control/view/view.scss +18 -0
  57. package/dist/app/demo/form/control/view/view.xml +94 -0
  58. package/dist/app/demo/form/event/form/form.css +1 -0
  59. package/dist/app/demo/form/event/form/form.js +129 -0
  60. package/dist/app/demo/form/event/form/form.scss +24 -0
  61. package/dist/app/demo/form/event/form/form.xml +16 -0
  62. package/dist/app/demo/form/event/screen/screen.js +51 -0
  63. package/dist/app/demo/form/event/screen/screen.xml +9 -0
  64. package/dist/app/demo/form/event/task/task.js +78 -0
  65. package/dist/app/demo/form/event/task/task.xml +20 -0
  66. package/dist/app/demo/form/main.css +1 -0
  67. package/dist/app/demo/form/main.js +25 -0
  68. package/dist/app/demo/form/main.scss +9 -0
  69. package/dist/app/demo/form/main.xml +49 -0
  70. package/dist/app/demo/form/method/core/core.js +25 -0
  71. package/dist/app/demo/form/method/core/core.xml +7 -0
  72. package/dist/app/demo/form/method/dom/dom.css +1 -0
  73. package/dist/app/demo/form/method/dom/dom.js +163 -0
  74. package/dist/app/demo/form/method/dom/dom.scss +10 -0
  75. package/dist/app/demo/form/method/dom/dom.xml +55 -0
  76. package/dist/app/demo/form/method/form/form.css +1 -0
  77. package/dist/app/demo/form/method/form/form.js +217 -0
  78. package/dist/app/demo/form/method/form/form.scss +3 -0
  79. package/dist/app/demo/form/method/form/form.xml +56 -0
  80. package/dist/app/demo/form/method/form/test.xml +5 -0
  81. package/dist/app/demo/form/method/fs/fs.js +88 -0
  82. package/dist/app/demo/form/method/fs/fs.xml +8 -0
  83. package/dist/app/demo/form/method/fs/text.js +15 -0
  84. package/dist/app/demo/form/method/fs/text.xml +3 -0
  85. package/dist/app/demo/form/method/task/locale1.json +3 -0
  86. package/dist/app/demo/form/method/task/locale2.json +3 -0
  87. package/dist/app/demo/form/method/task/task.js +153 -0
  88. package/dist/app/demo/form/method/task/task.xml +57 -0
  89. package/dist/app/demo/form/method/theme/theme.js +74 -0
  90. package/dist/app/demo/form/method/theme/theme.xml +9 -0
  91. package/dist/app/demo/form/method/tool/tool.js +64 -0
  92. package/dist/app/demo/form/method/tool/tool.xml +26 -0
  93. package/dist/app/demo/form/method/zip/zip.js +99 -0
  94. package/dist/app/demo/form/method/zip/zip.xml +12 -0
  95. package/dist/app/demo/global.css +3 -0
  96. package/dist/app/demo/res/icon.svg +1 -0
  97. package/dist/app/demo/res/img.jpg +0 -0
  98. package/dist/app/demo/res/r-1.svg +1 -0
  99. package/dist/app/demo/res/r-2.svg +1 -0
  100. package/dist/app/demo/res/sql.svg +1 -0
  101. package/dist/app/demo/res/txt.svg +1 -0
  102. package/dist/app/demo/res/zip.svg +1 -0
  103. package/dist/app/task/config.json +29 -0
  104. package/dist/app/task/form/bar/bar.js +299 -0
  105. package/dist/app/task/form/bar/bar.xml +47 -0
  106. package/dist/app/task/form/desktop/desktop.xml +1 -0
  107. package/dist/app/task/locale/en.json +11 -0
  108. package/dist/app/task/locale/ja.json +11 -0
  109. package/dist/app/task/locale/sc.json +11 -0
  110. package/dist/app/task/locale/tc.json +11 -0
  111. package/dist/clickgo.js +41 -0
  112. package/dist/clickgo.ts +51 -0
  113. package/dist/control/common.cgc +0 -0
  114. package/dist/control/form.cgc +0 -0
  115. package/dist/control/monaco.cgc +0 -0
  116. package/dist/control/property.cgc +0 -0
  117. package/dist/control/task.cgc +0 -0
  118. package/dist/global.css +1 -0
  119. package/dist/icon.png +0 -0
  120. package/dist/index.js +88 -0
  121. package/dist/index.ts +92 -0
  122. package/dist/lib/control.js +365 -0
  123. package/dist/lib/control.ts +428 -0
  124. package/dist/lib/core.js +668 -0
  125. package/dist/lib/core.ts +732 -0
  126. package/dist/lib/dom.js +1471 -0
  127. package/dist/lib/dom.ts +1785 -0
  128. package/dist/lib/form.js +2101 -0
  129. package/dist/lib/form.ts +2496 -0
  130. package/dist/lib/fs.js +849 -0
  131. package/dist/lib/fs.ts +995 -0
  132. package/dist/lib/native.js +138 -0
  133. package/dist/lib/native.ts +219 -0
  134. package/dist/lib/task.js +686 -0
  135. package/dist/lib/task.ts +842 -0
  136. package/dist/lib/theme.js +159 -0
  137. package/dist/lib/theme.ts +196 -0
  138. package/dist/lib/tool.js +501 -0
  139. package/dist/lib/tool.ts +620 -0
  140. package/dist/lib/zip.js +352 -0
  141. package/dist/lib/zip.ts +434 -0
  142. package/dist/theme/familiar.cgt +0 -0
  143. package/package.json +27 -0
  144. package/types/dev.d.ts +30 -0
  145. package/types/index.d.ts +673 -0
@@ -0,0 +1,434 @@
1
+ import * as jszip from 'jszip';
2
+ import * as types from '../../types';
3
+ import * as tool from './tool';
4
+
5
+ export class Zip {
6
+
7
+ /** --- zip 对象 --- */
8
+ private readonly _zip!: jszip;
9
+
10
+ /** --- 当前路径,以 / 开头以 / 结尾 --- */
11
+ private _path: string = '/';
12
+
13
+ public constructor(zip: jszip) {
14
+ this._zip = zip;
15
+ this._refreshList();
16
+ }
17
+
18
+ public async getContent(path: string): Promise<string | null>;
19
+ public async getContent<T extends types.TZipOutputType>(
20
+ path: string,
21
+ type: T): Promise<types.IZipOutputByType[T] | null>;
22
+ /**
23
+ * --- 读取完整文件 ---
24
+ * @param path 文件路径
25
+ * @param type 返回类型
26
+ */
27
+ public async getContent<T extends types.TZipOutputType>(path: string, type: T = 'string' as T): Promise<types.IZipOutputByType[T] | string | null> {
28
+ path = tool.urlResolve(this._path, path);
29
+ const f = this._zip.file(path.slice(1));
30
+ if (!f) {
31
+ return null;
32
+ }
33
+ if (type === 'string') {
34
+ return f.async('string');
35
+ }
36
+ else {
37
+ return f.async(type);
38
+ }
39
+ }
40
+
41
+ /**
42
+ * --- 写入文件内容 ---
43
+ * @param path 文件路径
44
+ * @param data 要写入的内容
45
+ * @param options 选项
46
+ */
47
+ public putContent<T extends types.TZipInputType>(path: string, data: types.IZipInputByType[T], options: { 'base64'?: boolean; 'binary'?: boolean; 'date'?: Date; } = {}): void {
48
+ path = tool.urlResolve(this._path, path);
49
+ this._zip.file(path.slice(1), data as jszip.InputType, {
50
+ 'base64': options.base64,
51
+ 'binary': options.binary,
52
+ 'date': options.date
53
+ });
54
+ this._refreshList();
55
+ }
56
+
57
+ /**
58
+ * --- 删除一个文件/文件夹(深度删除) ---
59
+ * @param path 要删除的文件路径
60
+ */
61
+ public unlink(path: string): void {
62
+ path = tool.urlResolve(this._path, path);
63
+ this._zip.remove(path.slice(1));
64
+ this._refreshList();
65
+ }
66
+
67
+ /**
68
+ * --- 获取对象是否存在,存在则返回 stats 对象,否则返回 null ---
69
+ * @param path 对象路径
70
+ * @param options 选项
71
+ */
72
+ public stats(path: string): types.IZipStats | null {
73
+ path = tool.urlResolve(this._path, path);
74
+ let dirpath = path.endsWith('/') ? path : path + '/';
75
+ if (!this._list[dirpath]) {
76
+ // --- 可能是文件 ---
77
+ if (path.endsWith('/')) {
78
+ // --- 不可能是文件 ---
79
+ return null;
80
+ }
81
+ const lio = path.lastIndexOf('/') + 1;
82
+ const dpath = path.slice(0, lio);
83
+ const fname = path.slice(lio);
84
+ if (!this._list[dpath]) {
85
+ // --- 上层目录不存在 ---
86
+ return null;
87
+ }
88
+ const file = this._list[dpath][fname];
89
+ if (!file) {
90
+ return null;
91
+ }
92
+ return {
93
+ 'date': file.date,
94
+ 'isFile': true,
95
+ 'isDirectory': false
96
+ };
97
+ }
98
+ else {
99
+ // --- 文件夹 ---
100
+ if (dirpath === '/') {
101
+ return {
102
+ 'date': new Date(),
103
+ 'isFile': false,
104
+ 'isDirectory': true
105
+ };
106
+ }
107
+ dirpath = dirpath.slice(0, -1);
108
+ const lio = dirpath.lastIndexOf('/') + 1;
109
+ const dpath = dirpath.slice(0, lio);
110
+ const fname = dirpath.slice(lio);
111
+ const pfolder = this._list[dpath];
112
+ const folder = pfolder[fname];
113
+ return {
114
+ 'date': folder.date,
115
+ 'isFile': false,
116
+ 'isDirectory': true
117
+ };
118
+ }
119
+ }
120
+
121
+ /**
122
+ * --- 判断是否是目录或目录是否存在,是的话返回 stats ---
123
+ * @param path 判断路径
124
+ */
125
+ public isDir(path: string): types.IZipStats | false {
126
+ const pstats = this.stats(path);
127
+ if (!pstats || !pstats.isDirectory) {
128
+ return false;
129
+ }
130
+ return pstats;
131
+ }
132
+
133
+ /**
134
+ * --- 判断是否是文件或文件是否存在,是的话返回 stats ---
135
+ * @param path 判断路径
136
+ */
137
+ public isFile(path: string): types.IZipStats | false {
138
+ const pstats = this.stats(path);
139
+ if (!pstats || !pstats.isFile) {
140
+ return false;
141
+ }
142
+ return pstats;
143
+ }
144
+
145
+ public readDir(path?: string, opt?: { 'hasChildren'?: boolean; 'hasDir'?: boolean; 'pathAsKey'?: false; }): types.IZipItem[];
146
+ public readDir(path?: string, opt?: { 'hasChildren'?: boolean; 'hasDir'?: boolean; 'pathAsKey': true; }): Record<string, types.IZipItem>;
147
+ /**
148
+ * --- 获取文件夹下文件列表 ---
149
+ * @param path 文件夹路径
150
+ * @param opt 选项
151
+ */
152
+ public readDir(path?: string, opt: { 'hasChildren'?: boolean; 'hasDir'?: boolean; 'pathAsKey'?: boolean; } = {}): Record<string, types.IZipItem> | types.IZipItem[] {
153
+ if (opt.hasChildren === undefined) {
154
+ opt.hasChildren = false;
155
+ }
156
+ if (opt.hasDir === undefined) {
157
+ opt.hasDir = true;
158
+ }
159
+ if (opt.pathAsKey === undefined) {
160
+ opt.pathAsKey = false;
161
+ }
162
+
163
+ if (!path) {
164
+ path = this._path;
165
+ }
166
+ else {
167
+ path = tool.urlResolve(this._path, path);
168
+ }
169
+ if (!path.endsWith('/')) {
170
+ path += '/';
171
+ }
172
+ const folder = this._zip.folder(path.slice(1));
173
+ if (!folder) {
174
+ return opt.pathAsKey ? {} : [];
175
+ }
176
+ if (!this._list[path]) {
177
+ return opt.pathAsKey ? {} : [];
178
+ }
179
+ if (!opt.hasChildren) {
180
+ if (opt.pathAsKey) {
181
+ return this._list[path];
182
+ }
183
+ const list: types.IZipItem[] = [];
184
+ for (const k in this._list[path]) {
185
+ list.push(this._list[path][k]);
186
+ }
187
+ return list;
188
+ }
189
+ // --- 定义 list ---
190
+ if (opt.pathAsKey) {
191
+ const list: Record<string, types.IZipItem> = {};
192
+ // --- 遍历子项 ---
193
+ for (const k in this._list[path]) {
194
+ const item = this._list[path][k];
195
+ if (item.isFile || opt.hasDir) {
196
+ list[item.path + item.name] = item;
197
+ }
198
+ if (item.isDirectory) {
199
+ Object.assign(list, this._readDir(item, {
200
+ 'hasDir': opt.hasDir,
201
+ 'pathAsKey': opt.pathAsKey
202
+ }));
203
+ }
204
+ }
205
+ return list;
206
+ }
207
+ else {
208
+ let list: types.IZipItem[] = [];
209
+ // --- 遍历子项 ---
210
+ for (const k in this._list[path]) {
211
+ const item = this._list[path][k];
212
+ if (item.isFile || opt.hasDir) {
213
+ list.push(item);
214
+ }
215
+ if (item.isDirectory) {
216
+ list = list.concat(this._readDir(item, {
217
+ 'hasDir': opt.hasDir,
218
+ 'pathAsKey': opt.pathAsKey
219
+ }));
220
+ }
221
+ }
222
+ return list;
223
+ }
224
+ }
225
+
226
+ private _readDir(item: types.IZipItem, opt: { 'hasDir'?: boolean; 'pathAsKey'?: false; }): types.IZipItem[];
227
+ private _readDir(item: types.IZipItem, opt: { 'hasDir'?: boolean; 'pathAsKey': true; }): Record<string, types.IZipItem>;
228
+ /**
229
+ * --- 根据 item 文件夹读取子层及所有子层项 ---
230
+ * @param item 文件夹
231
+ */
232
+ private _readDir(item: types.IZipItem, opt: { 'hasDir'?: boolean; 'pathAsKey'?: boolean; }): Record<string, types.IZipItem> | types.IZipItem[] {
233
+ if (opt.pathAsKey) {
234
+ const list: Record<string, types.IZipItem> = {};
235
+ if (!this._list[item.path + item.name + '/']) {
236
+ return {};
237
+ }
238
+ for (const k in this._list[item.path + item.name + '/']) {
239
+ const it = this._list[item.path + item.name + '/'][k];
240
+ if (it.isFile || opt.hasDir) {
241
+ list[it.path + it.name] = it;
242
+ }
243
+ if (it.isDirectory) {
244
+ Object.assign(list, this._readDir(it, {
245
+ 'hasDir': opt.hasDir,
246
+ 'pathAsKey': opt.pathAsKey
247
+ }));
248
+ }
249
+ }
250
+ return list;
251
+ }
252
+ else {
253
+ let list: types.IZipItem[] = [];
254
+ if (!this._list[item.path + item.name + '/']) {
255
+ return [];
256
+ }
257
+ for (const k in this._list[item.path + item.name + '/']) {
258
+ const it = this._list[item.path + item.name + '/'][k];
259
+ if (it.isFile || opt.hasDir) {
260
+ list.push(it);
261
+ }
262
+ if (it.isDirectory) {
263
+ list = list.concat(this._readDir(it, {
264
+ 'hasDir': opt.hasDir,
265
+ 'pathAsKey': opt.pathAsKey
266
+ }));
267
+ }
268
+ }
269
+ return list;
270
+ }
271
+ }
272
+
273
+ /** --- 目录列表缓存 --- */
274
+ private _list: Record<string, Record<string, types.IZipItem>> = {};
275
+
276
+ /**
277
+ * --- 重建目录列表缓存 ---
278
+ */
279
+ private _refreshList(): void {
280
+ const list: Record<string, Record<string, types.IZipItem>> = {};
281
+ this._zip.forEach(function(relativePath, item) {
282
+ if (relativePath.startsWith('/')) {
283
+ relativePath = relativePath.slice(1);
284
+ }
285
+ let parentPath = '/';
286
+ let name = '';
287
+ let s: number;
288
+ if (item.dir) {
289
+ s = relativePath.slice(0, -1).lastIndexOf('/');
290
+ }
291
+ else {
292
+ s = relativePath.lastIndexOf('/');
293
+ }
294
+ if (s !== -1) {
295
+ parentPath = '/' + relativePath.slice(0, s + 1);
296
+ name = relativePath.slice(s + 1);
297
+ }
298
+ else {
299
+ name = relativePath;
300
+ }
301
+ if (item.dir) {
302
+ name = name.slice(0, -1);
303
+ }
304
+ if (!list[parentPath]) {
305
+ list[parentPath] = {};
306
+ }
307
+ list[parentPath][name] = {
308
+ 'name': name,
309
+ 'date': item.date,
310
+ 'isFile': !item.dir,
311
+ 'isDirectory': item.dir,
312
+ 'path': parentPath
313
+ };
314
+ });
315
+ this._list = list;
316
+ }
317
+
318
+ /**
319
+ * --- 获取当前目录,末尾不带 / ---
320
+ * @return string
321
+ */
322
+ public pwd(): string {
323
+ return this._path.slice(0, -1);
324
+ }
325
+
326
+ /**
327
+ * --- 进入一个目录(不存在也能进入,需要自行判断) ---
328
+ * --- 返回进入后的路径值 ---
329
+ * @param dir 相对路径或绝对路径
330
+ */
331
+ public cd(dir: string): string {
332
+ this._path = tool.urlResolve(this._path, dir);
333
+ if (!this._path.endsWith('/')) {
334
+ this._path += '/';
335
+ }
336
+ return this._path;
337
+ }
338
+
339
+ /**
340
+ * --- 打包 zip ---
341
+ * @param options 选项
342
+ */
343
+ public generate<T extends types.TZipOutputType>(options: { 'type'?: T; 'level'?: number; 'onUpdate'?: (percent: number, currentFile: string | null) => void; } = {}): Promise<types.IZipOutputByType[T]> {
344
+ const opt: any = {};
345
+ if (options.type === undefined) {
346
+ opt.type = 'blob' as T;
347
+ }
348
+ else {
349
+ opt.type = options.type;
350
+ }
351
+ if (options.level === undefined) {
352
+ options.level = 9;
353
+ }
354
+ else if (options.level > 9) {
355
+ options.level = 9;
356
+ }
357
+ if (options.level > 0) {
358
+ opt.compression = 'DEFLATE';
359
+ }
360
+ return this._zip.generateAsync(opt, function(meta: types.IZipMetadata): void {
361
+ options.onUpdate?.(meta.percent, meta.currentFile);
362
+ });
363
+ }
364
+
365
+ /**
366
+ * --- 获取 path 和 string/Blob 对应的文件列表 ---
367
+ */
368
+ public getList(): Promise<Record<string, Blob | string>> {
369
+ return new Promise((resolve) => {
370
+ const files: Record<string, Blob | string> = {};
371
+ const list = this.readDir('/', {
372
+ 'hasChildren': true,
373
+ 'hasDir': false
374
+ });
375
+ let loaded = 0;
376
+ for (const file of list) {
377
+ const mime = tool.getMimeByPath(file.name);
378
+ if (['txt', 'json', 'js', 'css', 'xml', 'html'].includes(mime.ext)) {
379
+ this.getContent(file.path + file.name, 'string').then(function(fb) {
380
+ if (fb) {
381
+ files[file.path + file.name] = fb;
382
+ }
383
+ ++loaded;
384
+ if (loaded === list.length) {
385
+ resolve(files);
386
+ }
387
+ }).catch(function() {
388
+ ++loaded;
389
+ if (loaded === list.length) {
390
+ resolve(files);
391
+ }
392
+ });
393
+ }
394
+ else {
395
+ this.getContent(file.path + file.name, 'arraybuffer').then(function(fb) {
396
+ if (fb) {
397
+ files[file.path + file.name] = new Blob([fb], {
398
+ 'type': mime.mime
399
+ });
400
+ }
401
+ ++loaded;
402
+ if (loaded === list.length) {
403
+ resolve(files);
404
+ }
405
+ }).catch(function() {
406
+ ++loaded;
407
+ if (loaded === list.length) {
408
+ resolve(files);
409
+ }
410
+ });
411
+ }
412
+ }
413
+ return files;
414
+ });
415
+ }
416
+
417
+ }
418
+
419
+ /**
420
+ * --- 获取 zip 对象 ---
421
+ * @param data 对象数据
422
+ */
423
+ export async function get(data?: types.TZipInputFileFormat): Promise<Zip | null> {
424
+ const z = jszip();
425
+ try {
426
+ if (data) {
427
+ await z.loadAsync(data);
428
+ }
429
+ return new Zip(z);
430
+ }
431
+ catch {
432
+ return null;
433
+ }
434
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "clickgo",
3
+ "version": "3.0.0-dev",
4
+ "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
+ "keywords": [
6
+ "deskrt",
7
+ "ui",
8
+ "clickgo"
9
+ ],
10
+ "main": "dist/loader.js",
11
+ "author": "hanguoshuai",
12
+ "license": "Apache-2.0",
13
+ "types": "./types/index.d.ts",
14
+ "scripts": {
15
+ "native": "electron ./dist/test/native"
16
+ },
17
+ "devDependencies": {
18
+ "@litert/loader": "^3.2.0",
19
+ "@types/node": "^17.0.21",
20
+ "@typescript-eslint/eslint-plugin": "^5.17.0",
21
+ "@typescript-eslint/parser": "^5.17.0",
22
+ "electron": "^18.3.4",
23
+ "eslint": "^8.12.0",
24
+ "jszip": "^3.10.0",
25
+ "typescript": "^4.6.4"
26
+ }
27
+ }
package/types/dev.d.ts ADDED
@@ -0,0 +1,30 @@
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
+ }