jsbox-cview 1.0.0 → 1.1.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/dist/components/alert/input-alert.js +39 -0
- package/dist/components/alert/login-alert.js +45 -0
- package/dist/components/alert/plain-alert.js +25 -0
- package/dist/components/alert/uialert.js +89 -0
- package/dist/components/artificial-flowlayout.js +258 -0
- package/dist/components/base.js +43 -0
- package/dist/components/custom-navigation-bar.js +519 -0
- package/dist/components/dialogs/dialog-sheet.js +67 -0
- package/dist/components/dialogs/form-dialog.js +24 -0
- package/dist/components/dialogs/list-dialog.js +87 -0
- package/dist/components/dialogs/text-dialog.js +31 -0
- package/dist/components/dynamic-itemsize-matrix.js +129 -0
- package/dist/components/dynamic-preference-listview.js +557 -0
- package/dist/components/dynamic-rowheight-list.js +44 -0
- package/dist/components/enhanced-imageview.js +114 -0
- package/dist/components/image-pager.js +157 -0
- package/dist/components/page-control.js +76 -0
- package/dist/components/pageviewer-titlebar.js +143 -0
- package/dist/components/pageviewer.js +96 -0
- package/dist/components/rotating-view.js +102 -0
- package/dist/components/searchbar.js +322 -0
- package/dist/components/sheet.js +82 -0
- package/dist/components/single-views.js +429 -0
- package/dist/components/spinners/loading-double-rings.js +104 -0
- package/dist/components/spinners/loading-dual-ring.js +82 -0
- package/dist/components/spinners/loading-wedges.js +104 -0
- package/dist/components/spinners/spinner-androidstyle.js +248 -0
- package/dist/components/static-preference-listview.js +798 -0
- package/dist/components/symbol-button.js +79 -0
- package/dist/components/tabbar.js +357 -0
- package/dist/controller/base-controller.js +178 -0
- package/dist/controller/controller-router.js +68 -0
- package/dist/controller/pageviewer-controller.js +63 -0
- package/dist/controller/presented-page-controller.js +48 -0
- package/dist/controller/splitview-controller.js +252 -0
- package/dist/controller/tabbar-controller.js +74 -0
- package/dist/index.js +58 -0
- package/dist/test.js +1 -0
- package/dist/utils/colors.js +15 -0
- package/dist/utils/cvid.js +28 -0
- package/dist/utils/l10n.js +44 -0
- package/dist/utils/path.js +107 -0
- package/dist/utils/rect.js +72 -0
- package/dist/utils/uitools.js +95 -0
- package/index.ts +42 -0
- package/package.json +4 -3
- package/tsconfig.json +5 -3
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 实现单个视图的定义
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Runtime = exports.Code = exports.Chart = exports.Lottie = exports.Markdown = exports.Canvas = exports.Picker = exports.DatePicker = exports.Gradient = exports.Blur = exports.Matrix = exports.List = exports.Web = exports.Map = exports.Menu = exports.Tab = exports.Stack = exports.Scroll = exports.Video = exports.Image = exports.Text = exports.Stepper = exports.Gallery = exports.Progress = exports.Spinner = exports.Switch = exports.Slider = exports.Input = exports.Button = exports.Label = exports.MaskView = exports.ContentView = exports.RootView = exports.SingleView = void 0;
|
|
7
|
+
const base_1 = require("./base");
|
|
8
|
+
class SingleView extends base_1.Base {
|
|
9
|
+
constructor({ type, props, layout, events, views }) {
|
|
10
|
+
super();
|
|
11
|
+
this._type = type || "view";
|
|
12
|
+
this._props = props;
|
|
13
|
+
this._layout = layout;
|
|
14
|
+
this._events = events;
|
|
15
|
+
this._views = views;
|
|
16
|
+
this._defineView = () => {
|
|
17
|
+
return {
|
|
18
|
+
type: this._type,
|
|
19
|
+
props: Object.assign(Object.assign({}, this._props), { id: this.id }),
|
|
20
|
+
layout: this._layout,
|
|
21
|
+
events: this._events,
|
|
22
|
+
views: this._views
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.SingleView = SingleView;
|
|
28
|
+
class RootView extends SingleView {
|
|
29
|
+
constructor({ layout = $layout.fill, events, views }) {
|
|
30
|
+
super({
|
|
31
|
+
type: "view",
|
|
32
|
+
props: { bgcolor: $color("clear") },
|
|
33
|
+
layout,
|
|
34
|
+
events,
|
|
35
|
+
views
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.RootView = RootView;
|
|
40
|
+
class ContentView extends SingleView {
|
|
41
|
+
constructor({ props, layout = $layout.fillSafeArea, events = {}, views }) {
|
|
42
|
+
super({
|
|
43
|
+
type: "view",
|
|
44
|
+
props: Object.assign({ bgcolor: $color("primarySurface") }, props),
|
|
45
|
+
layout,
|
|
46
|
+
events,
|
|
47
|
+
views
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.ContentView = ContentView;
|
|
52
|
+
/**
|
|
53
|
+
* 遮挡视图,使得下面的view无法操作并且整体变暗。
|
|
54
|
+
* 设计上此视图不单独使用,而是作为一个子视图
|
|
55
|
+
* events:
|
|
56
|
+
* - tapped 点击事件,通常用于dismiss
|
|
57
|
+
*/
|
|
58
|
+
class MaskView extends SingleView {
|
|
59
|
+
constructor({ props, layout = $layout.fill, events, views }) {
|
|
60
|
+
super({
|
|
61
|
+
type: "view",
|
|
62
|
+
props: Object.assign(Object.assign({ bgcolor: $rgba(0, 0, 0, 0.2) }, props), { userInteractionEnabled: true }),
|
|
63
|
+
layout,
|
|
64
|
+
events,
|
|
65
|
+
views
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.MaskView = MaskView;
|
|
70
|
+
class Label extends SingleView {
|
|
71
|
+
constructor({ props, layout, events, views }) {
|
|
72
|
+
super({
|
|
73
|
+
type: "label",
|
|
74
|
+
props,
|
|
75
|
+
layout,
|
|
76
|
+
events,
|
|
77
|
+
views
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.Label = Label;
|
|
82
|
+
class Button extends SingleView {
|
|
83
|
+
constructor({ props, layout, events, views }) {
|
|
84
|
+
super({
|
|
85
|
+
type: "button",
|
|
86
|
+
props,
|
|
87
|
+
layout,
|
|
88
|
+
events,
|
|
89
|
+
views
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.Button = Button;
|
|
94
|
+
class Input extends SingleView {
|
|
95
|
+
constructor({ props, layout, events, views }) {
|
|
96
|
+
super({
|
|
97
|
+
type: "input",
|
|
98
|
+
props,
|
|
99
|
+
layout,
|
|
100
|
+
events,
|
|
101
|
+
views
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.Input = Input;
|
|
106
|
+
class Slider extends SingleView {
|
|
107
|
+
constructor({ props, layout, events, views }) {
|
|
108
|
+
super({
|
|
109
|
+
type: "slider",
|
|
110
|
+
props,
|
|
111
|
+
layout,
|
|
112
|
+
events,
|
|
113
|
+
views
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.Slider = Slider;
|
|
118
|
+
class Switch extends SingleView {
|
|
119
|
+
constructor({ props, layout, events, views }) {
|
|
120
|
+
super({
|
|
121
|
+
type: "switch",
|
|
122
|
+
props,
|
|
123
|
+
layout,
|
|
124
|
+
events,
|
|
125
|
+
views
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.Switch = Switch;
|
|
130
|
+
class Spinner extends SingleView {
|
|
131
|
+
constructor({ props, layout, events, views }) {
|
|
132
|
+
super({
|
|
133
|
+
type: "spinner",
|
|
134
|
+
props,
|
|
135
|
+
layout,
|
|
136
|
+
events,
|
|
137
|
+
views
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.Spinner = Spinner;
|
|
142
|
+
class Progress extends SingleView {
|
|
143
|
+
constructor({ props, layout, events, views }) {
|
|
144
|
+
super({
|
|
145
|
+
type: "progress",
|
|
146
|
+
props,
|
|
147
|
+
layout,
|
|
148
|
+
events,
|
|
149
|
+
views
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
exports.Progress = Progress;
|
|
154
|
+
class Gallery extends SingleView {
|
|
155
|
+
constructor({ props, layout, events, views }) {
|
|
156
|
+
super({
|
|
157
|
+
type: "gallery",
|
|
158
|
+
props,
|
|
159
|
+
layout,
|
|
160
|
+
events,
|
|
161
|
+
views
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.Gallery = Gallery;
|
|
166
|
+
class Stepper extends SingleView {
|
|
167
|
+
constructor({ props, layout, events, views }) {
|
|
168
|
+
super({
|
|
169
|
+
type: "stepper",
|
|
170
|
+
props,
|
|
171
|
+
layout,
|
|
172
|
+
events,
|
|
173
|
+
views
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.Stepper = Stepper;
|
|
178
|
+
class Text extends SingleView {
|
|
179
|
+
constructor({ props, layout, events, views }) {
|
|
180
|
+
super({
|
|
181
|
+
type: "text",
|
|
182
|
+
props,
|
|
183
|
+
layout,
|
|
184
|
+
events,
|
|
185
|
+
views
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.Text = Text;
|
|
190
|
+
class Image extends SingleView {
|
|
191
|
+
constructor({ props, layout, events, views }) {
|
|
192
|
+
super({
|
|
193
|
+
type: "image",
|
|
194
|
+
props,
|
|
195
|
+
layout,
|
|
196
|
+
events,
|
|
197
|
+
views
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.Image = Image;
|
|
202
|
+
class Video extends SingleView {
|
|
203
|
+
constructor({ props, layout, events, views }) {
|
|
204
|
+
super({
|
|
205
|
+
type: "video",
|
|
206
|
+
props,
|
|
207
|
+
layout,
|
|
208
|
+
events,
|
|
209
|
+
views
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.Video = Video;
|
|
214
|
+
class Scroll extends SingleView {
|
|
215
|
+
constructor({ props, layout, events, views }) {
|
|
216
|
+
super({
|
|
217
|
+
type: "scroll",
|
|
218
|
+
props,
|
|
219
|
+
layout,
|
|
220
|
+
events,
|
|
221
|
+
views
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.Scroll = Scroll;
|
|
226
|
+
class Stack extends SingleView {
|
|
227
|
+
constructor({ props, layout, events, views }) {
|
|
228
|
+
super({
|
|
229
|
+
type: "stack",
|
|
230
|
+
props,
|
|
231
|
+
layout,
|
|
232
|
+
events,
|
|
233
|
+
views
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.Stack = Stack;
|
|
238
|
+
class Tab extends SingleView {
|
|
239
|
+
constructor({ props, layout, events, views }) {
|
|
240
|
+
super({
|
|
241
|
+
type: "tab",
|
|
242
|
+
props,
|
|
243
|
+
layout,
|
|
244
|
+
events,
|
|
245
|
+
views
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
exports.Tab = Tab;
|
|
250
|
+
class Menu extends SingleView {
|
|
251
|
+
constructor({ props, layout, events, views }) {
|
|
252
|
+
super({
|
|
253
|
+
type: "menu",
|
|
254
|
+
props,
|
|
255
|
+
layout,
|
|
256
|
+
events,
|
|
257
|
+
views
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.Menu = Menu;
|
|
262
|
+
class Map extends SingleView {
|
|
263
|
+
constructor({ props, layout, events, views }) {
|
|
264
|
+
super({
|
|
265
|
+
type: "map",
|
|
266
|
+
props,
|
|
267
|
+
layout,
|
|
268
|
+
events,
|
|
269
|
+
views
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.Map = Map;
|
|
274
|
+
class Web extends SingleView {
|
|
275
|
+
constructor({ props, layout, events, views }) {
|
|
276
|
+
super({
|
|
277
|
+
type: "web",
|
|
278
|
+
props,
|
|
279
|
+
layout,
|
|
280
|
+
events,
|
|
281
|
+
views
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.Web = Web;
|
|
286
|
+
class List extends SingleView {
|
|
287
|
+
constructor({ props, layout, events, views }) {
|
|
288
|
+
super({
|
|
289
|
+
type: "list",
|
|
290
|
+
props,
|
|
291
|
+
layout,
|
|
292
|
+
events,
|
|
293
|
+
views
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
exports.List = List;
|
|
298
|
+
class Matrix extends SingleView {
|
|
299
|
+
constructor({ props, layout, events, views }) {
|
|
300
|
+
super({
|
|
301
|
+
type: "matrix",
|
|
302
|
+
props,
|
|
303
|
+
layout,
|
|
304
|
+
events,
|
|
305
|
+
views
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
exports.Matrix = Matrix;
|
|
310
|
+
class Blur extends SingleView {
|
|
311
|
+
constructor({ props, layout, events, views }) {
|
|
312
|
+
super({
|
|
313
|
+
type: "blur",
|
|
314
|
+
props,
|
|
315
|
+
layout,
|
|
316
|
+
events,
|
|
317
|
+
views
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
exports.Blur = Blur;
|
|
322
|
+
class Gradient extends SingleView {
|
|
323
|
+
constructor({ props, layout, events, views }) {
|
|
324
|
+
super({
|
|
325
|
+
type: "gradient",
|
|
326
|
+
props,
|
|
327
|
+
layout,
|
|
328
|
+
events,
|
|
329
|
+
views
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
exports.Gradient = Gradient;
|
|
334
|
+
class DatePicker extends SingleView {
|
|
335
|
+
constructor({ props, layout, events, views }) {
|
|
336
|
+
super({
|
|
337
|
+
type: "date-picker",
|
|
338
|
+
props,
|
|
339
|
+
layout,
|
|
340
|
+
events,
|
|
341
|
+
views
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
exports.DatePicker = DatePicker;
|
|
346
|
+
class Picker extends SingleView {
|
|
347
|
+
constructor({ props, layout, events, views }) {
|
|
348
|
+
super({
|
|
349
|
+
type: "picker",
|
|
350
|
+
props,
|
|
351
|
+
layout,
|
|
352
|
+
events,
|
|
353
|
+
views
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
exports.Picker = Picker;
|
|
358
|
+
class Canvas extends SingleView {
|
|
359
|
+
constructor({ props, layout, events, views }) {
|
|
360
|
+
super({
|
|
361
|
+
type: "canvas",
|
|
362
|
+
props,
|
|
363
|
+
layout,
|
|
364
|
+
events,
|
|
365
|
+
views
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
exports.Canvas = Canvas;
|
|
370
|
+
class Markdown extends SingleView {
|
|
371
|
+
constructor({ props, layout, events, views }) {
|
|
372
|
+
super({
|
|
373
|
+
type: "markdown",
|
|
374
|
+
props,
|
|
375
|
+
layout,
|
|
376
|
+
events,
|
|
377
|
+
views
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
exports.Markdown = Markdown;
|
|
382
|
+
class Lottie extends SingleView {
|
|
383
|
+
constructor({ props, layout, events, views }) {
|
|
384
|
+
super({
|
|
385
|
+
type: "lottie",
|
|
386
|
+
props,
|
|
387
|
+
layout,
|
|
388
|
+
events,
|
|
389
|
+
views
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
exports.Lottie = Lottie;
|
|
394
|
+
class Chart extends SingleView {
|
|
395
|
+
constructor({ props, layout, events, views }) {
|
|
396
|
+
super({
|
|
397
|
+
type: "chart",
|
|
398
|
+
props,
|
|
399
|
+
layout,
|
|
400
|
+
events,
|
|
401
|
+
views
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
exports.Chart = Chart;
|
|
406
|
+
class Code extends SingleView {
|
|
407
|
+
constructor({ props, layout, events, views }) {
|
|
408
|
+
super({
|
|
409
|
+
type: "code",
|
|
410
|
+
props,
|
|
411
|
+
layout,
|
|
412
|
+
events,
|
|
413
|
+
views
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
exports.Code = Code;
|
|
418
|
+
class Runtime extends SingleView {
|
|
419
|
+
constructor({ props, layout, events, views }) {
|
|
420
|
+
super({
|
|
421
|
+
type: "runtime",
|
|
422
|
+
props,
|
|
423
|
+
layout,
|
|
424
|
+
events,
|
|
425
|
+
views
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
exports.Runtime = Runtime;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* # cview LoadingDoubleRings
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DoubleRings = void 0;
|
|
16
|
+
const base_1 = require("../base");
|
|
17
|
+
class CanvasComponet extends base_1.Base {
|
|
18
|
+
constructor({ tintColor, startAngle, radiusReduction }) {
|
|
19
|
+
super();
|
|
20
|
+
this._tintColor = tintColor;
|
|
21
|
+
this.startAngle = startAngle;
|
|
22
|
+
this._radiusReduction = radiusReduction;
|
|
23
|
+
this._defineView = () => {
|
|
24
|
+
return {
|
|
25
|
+
type: "canvas",
|
|
26
|
+
props: {
|
|
27
|
+
id: this.id
|
|
28
|
+
},
|
|
29
|
+
layout: $layout.fill,
|
|
30
|
+
events: {
|
|
31
|
+
draw: (view, ctx) => {
|
|
32
|
+
ctx.strokeColor = this._tintColor;
|
|
33
|
+
const radius = Math.min(view.frame.width, view.frame.height);
|
|
34
|
+
ctx.setLineWidth(20);
|
|
35
|
+
ctx.setLineCap(1);
|
|
36
|
+
ctx.setLineJoin(1);
|
|
37
|
+
ctx.addArc(radius / 2, radius / 2, radius / 2 - 20 - this._radiusReduction, this.startAngle, this.startAngle + (Math.PI * 2 * 1) / 4, true);
|
|
38
|
+
ctx.strokePath();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
redraw() {
|
|
45
|
+
this.view.ocValue().invoke("setNeedsDisplay");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class DoubleRings extends base_1.Base {
|
|
49
|
+
constructor({ colors = [$color("#f5542e"), $color("#f2c327")], layout }) {
|
|
50
|
+
super();
|
|
51
|
+
const interval = 1 / 60;
|
|
52
|
+
this._defineView = () => {
|
|
53
|
+
const canvas1 = new CanvasComponet({
|
|
54
|
+
tintColor: colors[0],
|
|
55
|
+
radiusReduction: 0,
|
|
56
|
+
startAngle: (-Math.PI * 3) / 4
|
|
57
|
+
});
|
|
58
|
+
const canvas2 = new CanvasComponet({
|
|
59
|
+
tintColor: colors[0],
|
|
60
|
+
radiusReduction: 0,
|
|
61
|
+
startAngle: Math.PI / 4
|
|
62
|
+
});
|
|
63
|
+
const canvas3 = new CanvasComponet({
|
|
64
|
+
tintColor: colors[1],
|
|
65
|
+
radiusReduction: 25,
|
|
66
|
+
startAngle: -Math.PI / 4
|
|
67
|
+
});
|
|
68
|
+
const canvas4 = new CanvasComponet({
|
|
69
|
+
tintColor: colors[1],
|
|
70
|
+
radiusReduction: 25,
|
|
71
|
+
startAngle: (Math.PI * 3) / 4
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
type: "view",
|
|
75
|
+
props: {
|
|
76
|
+
id: this.id
|
|
77
|
+
},
|
|
78
|
+
views: [
|
|
79
|
+
canvas1.definition,
|
|
80
|
+
canvas2.definition,
|
|
81
|
+
canvas3.definition,
|
|
82
|
+
canvas4.definition
|
|
83
|
+
],
|
|
84
|
+
layout,
|
|
85
|
+
events: {
|
|
86
|
+
ready: (sender) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
while (sender.super) {
|
|
88
|
+
canvas1.startAngle += Math.PI * interval * -2;
|
|
89
|
+
canvas1.redraw();
|
|
90
|
+
canvas2.startAngle += Math.PI * interval * -2;
|
|
91
|
+
canvas2.redraw();
|
|
92
|
+
canvas3.startAngle += Math.PI * interval * 2;
|
|
93
|
+
canvas3.redraw();
|
|
94
|
+
canvas4.startAngle += Math.PI * interval * 2;
|
|
95
|
+
canvas4.redraw();
|
|
96
|
+
yield $wait(interval);
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.DoubleRings = DoubleRings;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* # cview LoadingDualRing
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DualRing = void 0;
|
|
16
|
+
const base_1 = require("../base");
|
|
17
|
+
class CanvasComponet extends base_1.Base {
|
|
18
|
+
constructor({ tintColor, startAngle }) {
|
|
19
|
+
super();
|
|
20
|
+
this._tintColor = tintColor;
|
|
21
|
+
this.startAngle = startAngle;
|
|
22
|
+
this._defineView = () => {
|
|
23
|
+
return {
|
|
24
|
+
type: "canvas",
|
|
25
|
+
props: {
|
|
26
|
+
id: this.id
|
|
27
|
+
},
|
|
28
|
+
layout: $layout.fill,
|
|
29
|
+
events: {
|
|
30
|
+
draw: (view, ctx) => {
|
|
31
|
+
ctx.strokeColor = this._tintColor;
|
|
32
|
+
const radius = Math.min(view.frame.width, view.frame.height);
|
|
33
|
+
ctx.setLineWidth(20);
|
|
34
|
+
ctx.setLineCap(1);
|
|
35
|
+
ctx.setLineJoin(1);
|
|
36
|
+
ctx.addArc(radius / 2, radius / 2, radius / 2 - 20, this.startAngle, this.startAngle + (Math.PI * 2 * 1) / 4, true);
|
|
37
|
+
ctx.strokePath();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
redraw() {
|
|
44
|
+
this.view.ocValue().invoke("setNeedsDisplay");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class DualRing extends base_1.Base {
|
|
48
|
+
constructor({ colors = [$color("#f5542e"), $color("#f2c327")], layout }) {
|
|
49
|
+
super();
|
|
50
|
+
const interval = 1 / 60;
|
|
51
|
+
this._defineView = () => {
|
|
52
|
+
const canvas1 = new CanvasComponet({
|
|
53
|
+
tintColor: colors[0],
|
|
54
|
+
startAngle: (-Math.PI * 3) / 4
|
|
55
|
+
});
|
|
56
|
+
const canvas2 = new CanvasComponet({
|
|
57
|
+
tintColor: colors[1],
|
|
58
|
+
startAngle: Math.PI / 4
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
type: "view",
|
|
62
|
+
props: {
|
|
63
|
+
id: this.id
|
|
64
|
+
},
|
|
65
|
+
views: [canvas1.definition, canvas2.definition],
|
|
66
|
+
layout,
|
|
67
|
+
events: {
|
|
68
|
+
ready: (sender) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
while (sender.super) {
|
|
70
|
+
canvas1.startAngle += Math.PI * interval * 2;
|
|
71
|
+
canvas1.redraw();
|
|
72
|
+
canvas2.startAngle += Math.PI * interval * 2;
|
|
73
|
+
canvas2.redraw();
|
|
74
|
+
yield $wait(interval);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.DualRing = DualRing;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* # cview LoadingWedges
|
|
4
|
+
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Wedges = void 0;
|
|
16
|
+
const base_1 = require("../base");
|
|
17
|
+
class CanvasComponet extends base_1.Base {
|
|
18
|
+
constructor({ tintColor, startAngle }) {
|
|
19
|
+
super();
|
|
20
|
+
this._tintColor = tintColor;
|
|
21
|
+
this.startAngle = startAngle;
|
|
22
|
+
this._defineView = () => {
|
|
23
|
+
return {
|
|
24
|
+
type: "canvas",
|
|
25
|
+
props: {
|
|
26
|
+
id: this.id,
|
|
27
|
+
alpha: 0.8
|
|
28
|
+
},
|
|
29
|
+
layout: $layout.fill,
|
|
30
|
+
events: {
|
|
31
|
+
draw: (view, ctx) => {
|
|
32
|
+
ctx.fillColor = this._tintColor;
|
|
33
|
+
const radius = Math.min(view.frame.width, view.frame.height);
|
|
34
|
+
ctx.addArc(radius / 2, radius / 2, radius / 2, this.startAngle, this.startAngle + (Math.PI * 2 * 1) / 4, true);
|
|
35
|
+
ctx.addLineToPoint(radius / 2, radius / 2);
|
|
36
|
+
ctx.closePath();
|
|
37
|
+
ctx.fillPath();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
redraw() {
|
|
44
|
+
this.view.ocValue().invoke("setNeedsDisplay");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class Wedges extends base_1.Base {
|
|
48
|
+
constructor({ colors = [
|
|
49
|
+
$color("#f5542e"),
|
|
50
|
+
$color("#f2c327"),
|
|
51
|
+
$color("#008b6e"),
|
|
52
|
+
$color("#00aede")
|
|
53
|
+
], layout }) {
|
|
54
|
+
super();
|
|
55
|
+
const interval = 1 / 60;
|
|
56
|
+
this._defineView = () => {
|
|
57
|
+
const canvas1 = new CanvasComponet({
|
|
58
|
+
tintColor: colors[0],
|
|
59
|
+
startAngle: -Math.PI / 2
|
|
60
|
+
});
|
|
61
|
+
const canvas2 = new CanvasComponet({
|
|
62
|
+
tintColor: colors[1],
|
|
63
|
+
startAngle: 0
|
|
64
|
+
});
|
|
65
|
+
const canvas3 = new CanvasComponet({
|
|
66
|
+
tintColor: colors[2],
|
|
67
|
+
startAngle: Math.PI / 2
|
|
68
|
+
});
|
|
69
|
+
const canvas4 = new CanvasComponet({
|
|
70
|
+
tintColor: colors[3],
|
|
71
|
+
startAngle: Math.PI
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
type: "view",
|
|
75
|
+
props: {
|
|
76
|
+
id: this.id
|
|
77
|
+
},
|
|
78
|
+
views: [
|
|
79
|
+
canvas1.definition,
|
|
80
|
+
canvas2.definition,
|
|
81
|
+
canvas3.definition,
|
|
82
|
+
canvas4.definition
|
|
83
|
+
],
|
|
84
|
+
layout,
|
|
85
|
+
events: {
|
|
86
|
+
ready: (sender) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
while (sender.super) {
|
|
88
|
+
canvas1.startAngle += Math.PI * interval * 4;
|
|
89
|
+
canvas1.redraw();
|
|
90
|
+
canvas2.startAngle += Math.PI * interval * 3;
|
|
91
|
+
canvas2.redraw();
|
|
92
|
+
canvas3.startAngle += Math.PI * interval * 2;
|
|
93
|
+
canvas3.redraw();
|
|
94
|
+
canvas4.startAngle += Math.PI * interval * 1;
|
|
95
|
+
canvas4.redraw();
|
|
96
|
+
yield $wait(interval);
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.Wedges = Wedges;
|