jsbox-cview 1.6.6 → 1.6.8

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 (141) hide show
  1. package/README.md +4 -0
  2. package/dist/components/alert/input-alert.d.ts +22 -0
  3. package/dist/components/alert/login-alert.d.ts +21 -0
  4. package/dist/components/alert/plain-alert.d.ts +15 -0
  5. package/dist/components/alert/uialert.d.ts +29 -0
  6. package/{components/base.ts → dist/components/base.d.ts} +9 -28
  7. package/dist/components/custom-navigation-bar.d.ts +117 -0
  8. package/dist/components/dialogs/dialog-sheet.d.ts +46 -0
  9. package/dist/components/dialogs/dialog-sheet.js +4 -2
  10. package/dist/components/dialogs/form-dialog.d.ts +15 -0
  11. package/dist/components/dialogs/list-dialog.d.ts +23 -0
  12. package/dist/components/dialogs/list-dialog.js +1 -1
  13. package/dist/components/dialogs/text-dialog.d.ts +13 -0
  14. package/dist/components/dynamic-contextmenu-view.d.ts +40 -0
  15. package/dist/components/dynamic-itemsize-matrix.d.ts +79 -0
  16. package/dist/components/dynamic-itemsize-matrix.js +1 -0
  17. package/dist/components/dynamic-itemsize-section-matrix.d.ts +115 -0
  18. package/dist/components/dynamic-preference-listview.d.ts +63 -0
  19. package/dist/components/dynamic-rowheight-list.d.ts +38 -0
  20. package/dist/components/enhanced-imageview.d.ts +41 -0
  21. package/dist/components/flowlayout.d.ts +63 -0
  22. package/dist/components/image-pager.d.ts +49 -0
  23. package/dist/components/oc-webview.d.ts +64 -0
  24. package/dist/components/page-control.d.ts +45 -0
  25. package/dist/components/pageviewer-titlebar.d.ts +48 -0
  26. package/dist/components/pageviewer.d.ts +41 -0
  27. package/dist/components/pageviewer.js +12 -3
  28. package/dist/components/refresh-button.d.ts +25 -0
  29. package/dist/components/rotating-view.d.ts +45 -0
  30. package/dist/components/searchbar.d.ts +118 -0
  31. package/dist/components/sheet.d.ts +42 -0
  32. package/dist/components/single-views.d.ts +289 -0
  33. package/dist/components/spinners/loading-dual-ring.d.ts +18 -0
  34. package/dist/components/spinners/loading-wedges.d.ts +15 -0
  35. package/dist/components/spinners/spinner-androidstyle.d.ts +30 -0
  36. package/dist/components/static-preference-listview.d.ts +389 -0
  37. package/dist/components/symbol-button.d.ts +39 -0
  38. package/dist/components/tabbar.d.ts +140 -0
  39. package/dist/controller/base-controller.d.ts +108 -0
  40. package/dist/controller/base-controller.js +10 -25
  41. package/dist/controller/controller-router.d.ts +48 -0
  42. package/dist/controller/controller-router.js +2 -1
  43. package/dist/controller/controller-status.d.ts +16 -0
  44. package/dist/controller/controller-status.js +19 -0
  45. package/dist/controller/pageviewer-controller.d.ts +38 -0
  46. package/dist/controller/pageviewer-controller.js +32 -3
  47. package/dist/controller/presented-page-controller.d.ts +41 -0
  48. package/dist/controller/splitview-controller.d.ts +90 -0
  49. package/dist/controller/splitview-controller.js +5 -0
  50. package/dist/controller/tabbar-controller.d.ts +49 -0
  51. package/dist/controller/tabbar-controller.js +2 -3
  52. package/{index.ts → dist/index.d.ts} +2 -0
  53. package/dist/index.js +2 -0
  54. package/dist/utils/colors.d.ts +7 -0
  55. package/dist/utils/cvid.d.ts +11 -0
  56. package/dist/utils/l10n.d.ts +1 -0
  57. package/dist/utils/path.d.ts +8 -0
  58. package/dist/utils/rect.d.ts +38 -0
  59. package/dist/utils/uitools.d.ts +75 -0
  60. package/package.json +20 -6
  61. package/.prettierignore +0 -6
  62. package/.prettierrc +0 -3
  63. package/components/alert/input-alert.ts +0 -64
  64. package/components/alert/login-alert.ts +0 -66
  65. package/components/alert/plain-alert.ts +0 -39
  66. package/components/alert/uialert.ts +0 -107
  67. package/components/custom-navigation-bar.ts +0 -579
  68. package/components/dialogs/dialog-sheet.ts +0 -111
  69. package/components/dialogs/form-dialog.ts +0 -63
  70. package/components/dialogs/list-dialog.ts +0 -119
  71. package/components/dialogs/text-dialog.ts +0 -44
  72. package/components/dynamic-contextmenu-view.ts +0 -115
  73. package/components/dynamic-itemsize-matrix.ts +0 -206
  74. package/components/dynamic-itemsize-section-matrix.ts +0 -363
  75. package/components/dynamic-preference-listview.ts +0 -684
  76. package/components/dynamic-rowheight-list.ts +0 -77
  77. package/components/enhanced-imageview.ts +0 -132
  78. package/components/flowlayout.ts +0 -248
  79. package/components/image-pager.ts +0 -180
  80. package/components/oc-webview.ts +0 -177
  81. package/components/page-control.ts +0 -93
  82. package/components/pageviewer-titlebar.ts +0 -166
  83. package/components/pageviewer.ts +0 -125
  84. package/components/refresh-button.ts +0 -83
  85. package/components/rotating-view.ts +0 -133
  86. package/components/searchbar.ts +0 -398
  87. package/components/sheet.ts +0 -104
  88. package/components/single-views.ts +0 -956
  89. package/components/spinners/loading-dual-ring.ts +0 -97
  90. package/components/spinners/loading-wedges.ts +0 -106
  91. package/components/spinners/spinner-androidstyle.ts +0 -269
  92. package/components/static-preference-listview.ts +0 -1282
  93. package/components/symbol-button.ts +0 -108
  94. package/components/tabbar.ts +0 -453
  95. package/controller/base-controller.ts +0 -214
  96. package/controller/controller-router.ts +0 -73
  97. package/controller/pageviewer-controller.ts +0 -93
  98. package/controller/presented-page-controller.ts +0 -76
  99. package/controller/splitview-controller.ts +0 -359
  100. package/controller/tabbar-controller.ts +0 -131
  101. package/dist/test/custom-navigation-bar.js +0 -40
  102. package/dist/test/dialog-sheet.js +0 -40
  103. package/dist/test/dynamic-contextmenu-view.js +0 -66
  104. package/dist/test/dynamic-itemsize-matrix.js +0 -74
  105. package/dist/test/dynamic-itemsize-section-matrix.js +0 -138
  106. package/dist/test/dynamic-preference-listview.js +0 -150
  107. package/dist/test/flowlayout.js +0 -76
  108. package/dist/test/form-dialog.js +0 -51
  109. package/dist/test/oc-webview.js +0 -195
  110. package/dist/test/pageviewer-controller.js +0 -20
  111. package/dist/test/pageviewer-titlebar.js +0 -18
  112. package/dist/test/pageviewer.js +0 -32
  113. package/dist/test/refresh-button.js +0 -26
  114. package/dist/test/searchbar.js +0 -36
  115. package/dist/test/splitview-controller.js +0 -41
  116. package/dist/test/static-preference-listview.js +0 -143
  117. package/dist/test/tabbar-controller.js +0 -48
  118. package/test/custom-navigation-bar.ts +0 -40
  119. package/test/dialog-sheet.ts +0 -40
  120. package/test/dynamic-contextmenu-view.ts +0 -67
  121. package/test/dynamic-itemsize-matrix.ts +0 -74
  122. package/test/dynamic-itemsize-section-matrix.ts +0 -142
  123. package/test/dynamic-preference-listview.ts +0 -151
  124. package/test/flowlayout.ts +0 -79
  125. package/test/form-dialog.ts +0 -48
  126. package/test/oc-webview.ts +0 -197
  127. package/test/pageviewer-controller.ts +0 -21
  128. package/test/pageviewer-titlebar.ts +0 -18
  129. package/test/pageviewer.ts +0 -31
  130. package/test/refresh-button.ts +0 -26
  131. package/test/searchbar.ts +0 -38
  132. package/test/splitview-controller.ts +0 -42
  133. package/test/static-preference-listview.ts +0 -142
  134. package/test/tabbar-controller.ts +0 -49
  135. package/tsconfig.json +0 -122
  136. package/utils/colors.ts +0 -17
  137. package/utils/cvid.ts +0 -32
  138. package/utils/l10n.ts +0 -42
  139. package/utils/path.ts +0 -97
  140. package/utils/rect.ts +0 -90
  141. package/utils/uitools.ts +0 -122
@@ -1,97 +0,0 @@
1
- import { Base } from "../base";
2
-
3
- class CanvasComponet extends Base<UICanvasView, UiTypes.CanvasOptions> {
4
- _tintColor: UIColor;
5
- startAngle: number;
6
- _defineView: () => UiTypes.CanvasOptions;
7
- constructor({ tintColor, startAngle }: { tintColor: UIColor; startAngle: number }) {
8
- super();
9
- this._tintColor = tintColor;
10
- this.startAngle = startAngle;
11
- this._defineView = () => {
12
- return {
13
- type: "canvas",
14
- props: {
15
- id: this.id,
16
- },
17
- layout: $layout.fill,
18
- events: {
19
- draw: (view, ctx) => {
20
- ctx.strokeColor = this._tintColor;
21
- const radius = Math.min(view.frame.width, view.frame.height);
22
- ctx.setLineWidth(20);
23
- ctx.setLineCap(1);
24
- ctx.setLineJoin(1);
25
- ctx.addArc(
26
- radius / 2,
27
- radius / 2,
28
- radius / 2 - 20,
29
- this.startAngle,
30
- this.startAngle + (Math.PI * 2 * 1) / 4,
31
- false,
32
- );
33
- ctx.strokePath();
34
- },
35
- },
36
- };
37
- };
38
- }
39
-
40
- redraw() {
41
- this.view.ocValue().invoke("setNeedsDisplay");
42
- }
43
- }
44
-
45
- /**
46
- * 两个圆环旋转的加载动画
47
- *
48
- * 这是一个示例组件,由于帧数有限而且不稳定,不建议在实际项目中使用。
49
- *
50
- */
51
- export class DualRing extends Base<UIView, UiTypes.ViewOptions> {
52
- _defineView: () => UiTypes.ViewOptions;
53
-
54
- /**
55
- * @param colors 颜色(必须是2个),默认为 [$color("#f5542e"), $color("#f2c327")]
56
- * @param layout 布局
57
- */
58
- constructor({
59
- colors = [$color("#f5542e"), $color("#f2c327")],
60
- layout,
61
- }: {
62
- colors?: UIColor[];
63
- layout: (make: MASConstraintMaker, view: UIView) => void;
64
- }) {
65
- super();
66
- const interval = 1 / 60;
67
- this._defineView = () => {
68
- const canvas1 = new CanvasComponet({
69
- tintColor: colors[0],
70
- startAngle: (-Math.PI * 3) / 4,
71
- });
72
- const canvas2 = new CanvasComponet({
73
- tintColor: colors[1],
74
- startAngle: Math.PI / 4,
75
- });
76
- return {
77
- type: "view",
78
- props: {
79
- id: this.id,
80
- },
81
- views: [canvas1.definition, canvas2.definition],
82
- layout,
83
- events: {
84
- ready: async (sender) => {
85
- while (sender.super) {
86
- canvas1.startAngle += Math.PI * interval * 2;
87
- canvas1.redraw();
88
- canvas2.startAngle += Math.PI * interval * 2;
89
- canvas2.redraw();
90
- await $wait(interval);
91
- }
92
- },
93
- },
94
- };
95
- };
96
- }
97
- }
@@ -1,106 +0,0 @@
1
- import { Base } from "../base";
2
-
3
- class CanvasComponet extends Base<UICanvasView, UiTypes.CanvasOptions> {
4
- _tintColor: UIColor;
5
- startAngle: number;
6
- _defineView: () => UiTypes.CanvasOptions;
7
- constructor({ tintColor, startAngle }: { tintColor: UIColor; startAngle: number }) {
8
- super();
9
- this._tintColor = tintColor;
10
- this.startAngle = startAngle;
11
- this._defineView = () => {
12
- return {
13
- type: "canvas",
14
- props: {
15
- id: this.id,
16
- alpha: 0.8,
17
- },
18
- layout: $layout.fill,
19
- events: {
20
- draw: (view, ctx) => {
21
- ctx.fillColor = this._tintColor;
22
- const radius = Math.min(view.frame.width, view.frame.height);
23
- ctx.addArc(
24
- radius / 2,
25
- radius / 2,
26
- radius / 2,
27
- this.startAngle,
28
- this.startAngle + (Math.PI * 2 * 1) / 4,
29
- true,
30
- );
31
- ctx.addLineToPoint(radius / 2, radius / 2);
32
- ctx.closePath();
33
- ctx.fillPath();
34
- },
35
- },
36
- };
37
- };
38
- }
39
-
40
- redraw() {
41
- this.view.ocValue().invoke("setNeedsDisplay");
42
- }
43
- }
44
-
45
- /**
46
- * 饼图加载动画, 4个颜色的饼图以不同的速度旋转,产生华丽的效果
47
- */
48
- export class Wedges extends Base<UIView, UiTypes.ViewOptions> {
49
- _defineView: () => UiTypes.ViewOptions;
50
-
51
- /**
52
- * @param colors 饼图颜色(必须是4个颜色)
53
- * @param layout 布局
54
- */
55
- constructor({
56
- colors = [$color("#f5542e"), $color("#f2c327"), $color("#008b6e"), $color("#00aede")],
57
- layout,
58
- }: {
59
- colors?: UIColor[];
60
- layout: (make: MASConstraintMaker, view: UIView) => void;
61
- }) {
62
- super();
63
- const interval = 1 / 60;
64
- this._defineView = () => {
65
- const canvas1 = new CanvasComponet({
66
- tintColor: colors[0],
67
- startAngle: -Math.PI / 2,
68
- });
69
- const canvas2 = new CanvasComponet({
70
- tintColor: colors[1],
71
- startAngle: 0,
72
- });
73
- const canvas3 = new CanvasComponet({
74
- tintColor: colors[2],
75
- startAngle: Math.PI / 2,
76
- });
77
- const canvas4 = new CanvasComponet({
78
- tintColor: colors[3],
79
- startAngle: Math.PI,
80
- });
81
- return {
82
- type: "view",
83
- props: {
84
- id: this.id,
85
- },
86
- views: [canvas1.definition, canvas2.definition, canvas3.definition, canvas4.definition],
87
- layout,
88
- events: {
89
- ready: async (sender) => {
90
- while (sender.super) {
91
- canvas1.startAngle += Math.PI * interval * 4;
92
- canvas1.redraw();
93
- canvas2.startAngle += Math.PI * interval * 3;
94
- canvas2.redraw();
95
- canvas3.startAngle += Math.PI * interval * 2;
96
- canvas3.redraw();
97
- canvas4.startAngle += Math.PI * interval * 1;
98
- canvas4.redraw();
99
- await $wait(interval);
100
- }
101
- },
102
- },
103
- };
104
- };
105
- }
106
- }
@@ -1,269 +0,0 @@
1
- import { Base } from "../base";
2
-
3
- interface AndroidStyleSpinnerProps {
4
- id?: string;
5
- weight: number;
6
- diameter: number;
7
- color: UIColor;
8
- bgcolor: UIColor;
9
- }
10
-
11
- /**
12
- * 安卓风格的加载指示器, 基于Lottie实现, 效果是一个圆环一边旋转一边缩放。
13
- * 由于帧数有限,不建议在大视图上使用。
14
- */
15
- export class AndroidStyleSpinner extends Base<UILottieView, UiTypes.LottieOptions> {
16
- private _props: AndroidStyleSpinnerProps;
17
- _defineView: () => UiTypes.LottieOptions;
18
-
19
- /**
20
- * @param props AndroidStyleSpinnerProps
21
- * - id?: string 可以重新指定 id,以供 list 或者 matrix 的 template 使用
22
- * - weight: number
23
- * - diameter: number
24
- * - color: UIColor, 默认 gray
25
- * - bgcolor: UIColor, 默认 clear
26
- * @param layout 可选布局,默认居中
27
- */
28
- constructor({
29
- props,
30
- layout,
31
- }: {
32
- props: Partial<AndroidStyleSpinnerProps>;
33
- layout?: (make: MASConstraintMaker, view: UILottieView) => void;
34
- }) {
35
- super();
36
- this._props = {
37
- weight: 2,
38
- diameter: 24,
39
- color: $color("gray"),
40
- bgcolor: $color("clear"),
41
- ...props,
42
- };
43
- this._defineView = () => {
44
- const weight = this._props.weight;
45
- const color = this._props.color;
46
- const r = color.components.red / 255;
47
- const g = color.components.green / 255;
48
- const b = color.components.blue / 255;
49
- const a = color.components.alpha;
50
- const json = {
51
- v: "5.5.7",
52
- fr: 60,
53
- ip: 0,
54
- op: 120,
55
- w: 24,
56
- h: 24,
57
- nm: "spinner",
58
- ddd: 0,
59
- assets: [],
60
- layers: [
61
- {
62
- ddd: 0,
63
- ind: 1,
64
- ty: 4,
65
- nm: "circle",
66
- sr: 1,
67
- ks: {
68
- o: { a: 0, k: 100, ix: 11 },
69
- r: {
70
- a: 1,
71
- k: [
72
- {
73
- i: { x: [0.833], y: [0.833] },
74
- o: { x: [0.167], y: [0.167] },
75
- t: 0,
76
- s: [0],
77
- },
78
- {
79
- t: 119,
80
- s: [720],
81
- },
82
- ],
83
- ix: 10,
84
- },
85
- p: { a: 0, k: [12, 12, 0], ix: 2 },
86
- a: { a: 0, k: [1, 1, 0], ix: 1 },
87
- s: { a: 0, k: [100, 100, 100], ix: 6 },
88
- },
89
- ao: 0,
90
- shapes: [
91
- {
92
- ty: "gr",
93
- it: [
94
- {
95
- ind: 0,
96
- ty: "sh",
97
- ix: 1,
98
- ks: {
99
- a: 0,
100
- k: {
101
- i: [
102
- [0, -5.523],
103
- [5.523, 0],
104
- [0, 5.523],
105
- [-5.523, 0],
106
- ],
107
- o: [
108
- [0, 5.523],
109
- [-5.523, 0],
110
- [0, -5.523],
111
- [5.523, 0],
112
- ],
113
- v: [
114
- [11, 1],
115
- [1, 11],
116
- [-9, 1],
117
- [1, -9],
118
- ],
119
- c: true,
120
- },
121
- ix: 2,
122
- },
123
- nm: "Path 1",
124
- mn: "ADBE Vector Shape - Group",
125
- hd: false,
126
- },
127
- {
128
- ty: "mm",
129
- mm: 3,
130
- nm: "Merge Paths 1",
131
- mn: "ADBE Vector Filter - Merge",
132
- hd: false,
133
- },
134
- {
135
- ty: "tm",
136
- s: {
137
- a: 1,
138
- k: [
139
- {
140
- i: { x: [0.833], y: [0.833] },
141
- o: { x: [0.167], y: [0.167] },
142
- t: 0,
143
- s: [0],
144
- },
145
- {
146
- i: { x: [0.833], y: [0.833] },
147
- o: { x: [0.167], y: [0.167] },
148
- t: 60,
149
- s: [0],
150
- },
151
- {
152
- i: { x: [0.833], y: [0.833] },
153
- o: { x: [0.167], y: [0.167] },
154
- t: 90,
155
- s: [60],
156
- },
157
- {
158
- t: 119,
159
- s: [100],
160
- },
161
- ],
162
- ix: 1,
163
- },
164
- e: {
165
- a: 1,
166
- k: [
167
- {
168
- i: { x: [0.833], y: [0.833] },
169
- o: { x: [0.167], y: [0.167] },
170
- t: 0,
171
- s: [0],
172
- },
173
- {
174
- i: { x: [0.833], y: [0.833] },
175
- o: { x: [0.167], y: [0.167] },
176
- t: 30,
177
- s: [70],
178
- },
179
- {
180
- i: { x: [0.833], y: [0.833] },
181
- o: { x: [0.167], y: [0.167] },
182
- t: 60,
183
- s: [90],
184
- },
185
- {
186
- i: { x: [0.833], y: [0.833] },
187
- o: { x: [0.167], y: [0.167] },
188
- t: 90,
189
- s: [90],
190
- },
191
- {
192
- t: 119,
193
- s: [99],
194
- },
195
- ],
196
- ix: 2,
197
- },
198
- o: { a: 0, k: 0, ix: 3 },
199
- m: 1,
200
- ix: 3,
201
- nm: "Trim Paths 1",
202
- mn: "ADBE Vector Filter - Trim",
203
- hd: false,
204
- },
205
- {
206
- ty: "st",
207
- c: { a: 0, k: [r, g, b, a], ix: 3 },
208
- o: { a: 0, k: 100, ix: 4 },
209
- w: { a: 0, k: weight, ix: 5 },
210
- lc: 2,
211
- lj: 1,
212
- ml: 4,
213
- bm: 0,
214
- nm: "Stroke 1",
215
- mn: "ADBE Vector Graphic - Stroke",
216
- hd: false,
217
- },
218
- {
219
- ty: "tr",
220
- p: { a: 0, k: [0, 0], ix: 2 },
221
- a: { a: 0, k: [0, 0], ix: 1 },
222
- s: { a: 0, k: [100, 100], ix: 3 },
223
- r: { a: 0, k: 0, ix: 6 },
224
- o: { a: 0, k: 100, ix: 7 },
225
- sk: { a: 0, k: 0, ix: 4 },
226
- sa: { a: 0, k: 0, ix: 5 },
227
- nm: "Transform",
228
- },
229
- ],
230
- nm: "circle",
231
- np: 4,
232
- cix: 2,
233
- bm: 0,
234
- ix: 1,
235
- mn: "ADBE Vector Group",
236
- hd: false,
237
- },
238
- ],
239
- ip: 0,
240
- op: 120,
241
- st: 0,
242
- bm: 0,
243
- },
244
- ],
245
- markers: [],
246
- };
247
- return {
248
- type: "lottie",
249
- props: {
250
- loop: true,
251
- contentMode: 1,
252
- circular: true,
253
- json,
254
- bgcolor: this._props.bgcolor,
255
- id: this._props.id || this.id,
256
- },
257
- layout:
258
- layout ||
259
- ((make, view) => {
260
- make.size.equalTo($size(this._props.diameter, this._props.diameter));
261
- make.center.equalTo(view.super);
262
- }),
263
- events: {
264
- ready: (sender) => sender.play({}),
265
- },
266
- };
267
- };
268
- }
269
- }