jsbox-cview 1.6.0 → 1.6.2
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/.prettierignore +6 -0
- package/.prettierrc +3 -0
- package/components/alert/input-alert.ts +4 -17
- package/components/alert/login-alert.ts +4 -17
- package/components/alert/plain-alert.ts +4 -17
- package/components/alert/uialert.ts +6 -16
- package/components/base.ts +1 -4
- package/components/custom-navigation-bar.ts +13 -38
- package/components/dialogs/dialog-sheet.ts +4 -13
- package/components/dialogs/form-dialog.ts +3 -6
- package/components/dialogs/list-dialog.ts +2 -5
- package/components/dynamic-contextmenu-view.ts +11 -27
- package/components/dynamic-itemsize-matrix.ts +8 -12
- package/components/dynamic-preference-listview.ts +14 -35
- package/components/dynamic-rowheight-list.ts +3 -8
- package/components/enhanced-imageview.ts +4 -9
- package/components/flowlayout.ts +6 -14
- package/components/image-pager.ts +1 -2
- package/components/oc-webview.ts +6 -24
- package/components/page-control.ts +2 -7
- package/components/pageviewer-titlebar.ts +5 -15
- package/components/pageviewer.ts +4 -13
- package/components/rotating-view.ts +1 -3
- package/components/searchbar.ts +16 -56
- package/components/sheet.ts +4 -18
- package/components/single-views.ts +6 -36
- package/components/spinners/loading-dual-ring.ts +2 -8
- package/components/spinners/loading-wedges.ts +4 -20
- package/components/spinners/spinner-androidstyle.ts +2 -7
- package/components/static-preference-listview.ts +6 -26
- package/components/tabbar.ts +7 -20
- package/controller/base-controller.ts +2 -10
- package/controller/pageviewer-controller.ts +3 -11
- package/controller/presented-page-controller.ts +2 -8
- package/controller/splitview-controller.ts +7 -26
- package/controller/tabbar-controller.ts +3 -11
- package/dist/index.js +1 -0
- package/index.ts +1 -0
- package/package.json +3 -2
- package/test/dynamic-itemsize-matrix.ts +2 -7
- package/test/flowlayout.ts +3 -11
- package/test/static-preference-listview.ts +1 -4
- package/tsconfig.json +1 -2
- package/utils/cvid.ts +1 -2
- package/utils/path.ts +1 -4
- package/utils/uitools.ts +5 -8
|
@@ -161,13 +161,7 @@ export const selectableTypes = [
|
|
|
161
161
|
"action",
|
|
162
162
|
];
|
|
163
163
|
|
|
164
|
-
export const excludedTypes = [
|
|
165
|
-
"info",
|
|
166
|
-
"interactive-info",
|
|
167
|
-
"link",
|
|
168
|
-
"symbol-action",
|
|
169
|
-
"action",
|
|
170
|
-
];
|
|
164
|
+
export const excludedTypes = ["info", "interactive-info", "link", "symbol-action", "action"];
|
|
171
165
|
|
|
172
166
|
type PreferenceValues = { [key: string]: any };
|
|
173
167
|
|
|
@@ -210,7 +204,7 @@ abstract class Cell extends Base<UIView, UiTypes.ViewOptions> {
|
|
|
210
204
|
titleColor?: UIColor;
|
|
211
205
|
changedEvent?: () => void;
|
|
212
206
|
},
|
|
213
|
-
values: PreferenceValues
|
|
207
|
+
values: PreferenceValues,
|
|
214
208
|
) {
|
|
215
209
|
super();
|
|
216
210
|
this._key = key;
|
|
@@ -276,10 +270,7 @@ abstract class BaseStringCell extends Cell {
|
|
|
276
270
|
abstract _type: string;
|
|
277
271
|
_placeholder?: string;
|
|
278
272
|
_textColor?: UIColor;
|
|
279
|
-
constructor(
|
|
280
|
-
props: PrefsRowString | PrefsRowNumber | PrefsRowInteger,
|
|
281
|
-
values: PreferenceValues
|
|
282
|
-
) {
|
|
273
|
+
constructor(props: PrefsRowString | PrefsRowNumber | PrefsRowInteger, values: PreferenceValues) {
|
|
283
274
|
super(props, values);
|
|
284
275
|
const { placeholder, textColor } = props;
|
|
285
276
|
this._placeholder = placeholder;
|
|
@@ -514,14 +505,7 @@ class SliderCell extends Cell {
|
|
|
514
505
|
_thumbColor?: UIColor;
|
|
515
506
|
constructor(props: PrefsRowSlider, values: PreferenceValues) {
|
|
516
507
|
super(props, values);
|
|
517
|
-
const {
|
|
518
|
-
decimal = 1,
|
|
519
|
-
min = 0,
|
|
520
|
-
max = 1,
|
|
521
|
-
minColor = $color("systemLink"),
|
|
522
|
-
maxColor,
|
|
523
|
-
thumbColor,
|
|
524
|
-
} = props;
|
|
508
|
+
const { decimal = 1, min = 0, max = 1, minColor = $color("systemLink"), maxColor, thumbColor } = props;
|
|
525
509
|
this._decimal = decimal;
|
|
526
510
|
this._min = min;
|
|
527
511
|
this._max = max;
|
|
@@ -565,9 +549,7 @@ class SliderCell extends Cell {
|
|
|
565
549
|
},
|
|
566
550
|
events: {
|
|
567
551
|
changed: (sender) => {
|
|
568
|
-
const adjustedValue = parseFloat(
|
|
569
|
-
sender.value.toFixed(this._decimal)
|
|
570
|
-
);
|
|
552
|
+
const adjustedValue = parseFloat(sender.value.toFixed(this._decimal));
|
|
571
553
|
const label = sender.prev as UILabelView;
|
|
572
554
|
label.text = adjustedValue.toString();
|
|
573
555
|
if (this._key) {
|
|
@@ -576,9 +558,7 @@ class SliderCell extends Cell {
|
|
|
576
558
|
}
|
|
577
559
|
},
|
|
578
560
|
touchesEnded: (sender) => {
|
|
579
|
-
const adjustedValue = parseFloat(
|
|
580
|
-
sender.value.toFixed(this._decimal)
|
|
581
|
-
);
|
|
561
|
+
const adjustedValue = parseFloat(sender.value.toFixed(this._decimal));
|
|
582
562
|
this.value = adjustedValue;
|
|
583
563
|
if (this._changedEvent) this._changedEvent();
|
|
584
564
|
},
|
package/components/tabbar.ts
CHANGED
|
@@ -94,9 +94,7 @@ class ImageLabelCell extends Base<UIView, UiTypes.ViewOptions> {
|
|
|
94
94
|
|
|
95
95
|
set selected(selected) {
|
|
96
96
|
this._props.selected = selected;
|
|
97
|
-
const color = selected
|
|
98
|
-
? this._props.selectedSegmentTintColor
|
|
99
|
-
: this._props.defaultSegmentTintColor;
|
|
97
|
+
const color = selected ? this._props.selectedSegmentTintColor : this._props.defaultSegmentTintColor;
|
|
100
98
|
this.view.get("image").tintColor = color;
|
|
101
99
|
const label = this.view.get("label") as UILabelView;
|
|
102
100
|
label.textColor = color;
|
|
@@ -192,9 +190,7 @@ class ImageCell extends Base<UIView, UiTypes.ViewOptions> {
|
|
|
192
190
|
|
|
193
191
|
set selected(selected) {
|
|
194
192
|
this._props.selected = selected;
|
|
195
|
-
const color = selected
|
|
196
|
-
? this._props.selectedSegmentTintColor
|
|
197
|
-
: this._props.defaultSegmentTintColor;
|
|
193
|
+
const color = selected ? this._props.selectedSegmentTintColor : this._props.defaultSegmentTintColor;
|
|
198
194
|
this.view.get("image").tintColor = color;
|
|
199
195
|
}
|
|
200
196
|
|
|
@@ -235,10 +231,7 @@ class ImageCell extends Base<UIView, UiTypes.ViewOptions> {
|
|
|
235
231
|
* - hide(animated=true) 隐藏
|
|
236
232
|
* - show(animated=true) 显示
|
|
237
233
|
*/
|
|
238
|
-
export class TabBar extends Base<
|
|
239
|
-
UIView | UIBlurView,
|
|
240
|
-
UiTypes.ViewOptions | UiTypes.BlurOptions
|
|
241
|
-
> {
|
|
234
|
+
export class TabBar extends Base<UIView | UIBlurView, UiTypes.ViewOptions | UiTypes.BlurOptions> {
|
|
242
235
|
_props: {
|
|
243
236
|
height: number;
|
|
244
237
|
items: { symbol?: string; image?: UIImage; title?: string }[];
|
|
@@ -319,9 +312,7 @@ export class TabBar extends Base<
|
|
|
319
312
|
},
|
|
320
313
|
layout: (make, view) => {
|
|
321
314
|
make.left.right.bottom.inset(0);
|
|
322
|
-
make.top
|
|
323
|
-
.equalTo(view.super.safeAreaBottom)
|
|
324
|
-
.inset(-this._props.height);
|
|
315
|
+
make.top.equalTo(view.super.safeAreaBottom).inset(-this._props.height);
|
|
325
316
|
},
|
|
326
317
|
views: [line, stack],
|
|
327
318
|
events: {
|
|
@@ -345,9 +336,7 @@ export class TabBar extends Base<
|
|
|
345
336
|
},
|
|
346
337
|
layout: (make, view) => {
|
|
347
338
|
make.left.right.bottom.inset(0);
|
|
348
|
-
make.top
|
|
349
|
-
.equalTo(view.super.safeAreaBottom)
|
|
350
|
-
.inset(-this._props.height);
|
|
339
|
+
make.top.equalTo(view.super.safeAreaBottom).inset(-this._props.height);
|
|
351
340
|
},
|
|
352
341
|
views: [line, stack],
|
|
353
342
|
events: {
|
|
@@ -384,8 +373,7 @@ export class TabBar extends Base<
|
|
|
384
373
|
this.index = index;
|
|
385
374
|
if (this._events.changed) this._events.changed(this, index);
|
|
386
375
|
} else {
|
|
387
|
-
if (this._events.doubleTapped)
|
|
388
|
-
this._events.doubleTapped(this, index);
|
|
376
|
+
if (this._events.doubleTapped) this._events.doubleTapped(this, index);
|
|
389
377
|
}
|
|
390
378
|
},
|
|
391
379
|
},
|
|
@@ -405,8 +393,7 @@ export class TabBar extends Base<
|
|
|
405
393
|
this.index = index;
|
|
406
394
|
if (this._events.changed) this._events.changed(this, index);
|
|
407
395
|
} else {
|
|
408
|
-
if (this._events.doubleTapped)
|
|
409
|
-
this._events.doubleTapped(this, index);
|
|
396
|
+
if (this._events.doubleTapped) this._events.doubleTapped(this, index);
|
|
410
397
|
}
|
|
411
398
|
},
|
|
412
399
|
},
|
|
@@ -162,22 +162,14 @@ export class BaseController {
|
|
|
162
162
|
|
|
163
163
|
appear() {
|
|
164
164
|
// 只有status为loaded或者disappeared,才可以运行
|
|
165
|
-
if (
|
|
166
|
-
this._status !== controllerStatus.loaded &&
|
|
167
|
-
this._status !== controllerStatus.disappeared
|
|
168
|
-
)
|
|
169
|
-
return;
|
|
165
|
+
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.disappeared) return;
|
|
170
166
|
if (this._events.didAppear) this._events.didAppear(this);
|
|
171
167
|
this._status = controllerStatus.appeared;
|
|
172
168
|
}
|
|
173
169
|
|
|
174
170
|
disappear() {
|
|
175
171
|
// 只有status为loaded或者appeared,才可以运行
|
|
176
|
-
if (
|
|
177
|
-
this._status !== controllerStatus.loaded &&
|
|
178
|
-
this._status !== controllerStatus.appeared
|
|
179
|
-
)
|
|
180
|
-
return;
|
|
172
|
+
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.appeared) return;
|
|
181
173
|
if (this._events.didDisappear) this._events.didDisappear(this);
|
|
182
174
|
this._status = controllerStatus.disappeared;
|
|
183
175
|
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseController,
|
|
3
|
-
BaseControllerProps,
|
|
4
|
-
BaseControllerEvents,
|
|
5
|
-
} from "./base-controller";
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
6
2
|
import { PageViewer } from "../components/pageviewer";
|
|
7
3
|
import { PageViewerTitleBar } from "../components/pageviewer-titlebar";
|
|
8
|
-
import {
|
|
9
|
-
CustomNavigationBar,
|
|
10
|
-
NavigationBarProps,
|
|
11
|
-
} from "../components/custom-navigation-bar";
|
|
4
|
+
import { CustomNavigationBar, NavigationBarProps } from "../components/custom-navigation-bar";
|
|
12
5
|
|
|
13
6
|
interface PageViewerControllerProps extends BaseControllerProps {
|
|
14
7
|
items: { controller: BaseController; title: string }[];
|
|
@@ -66,8 +59,7 @@ export class PageViewerController extends BaseController {
|
|
|
66
59
|
make.top.equalTo(view.prev.bottom);
|
|
67
60
|
},
|
|
68
61
|
events: {
|
|
69
|
-
floatPageChanged: (cview, floatPage) =>
|
|
70
|
-
(this.cviews.titlebar.floatedIndex = floatPage),
|
|
62
|
+
floatPageChanged: (cview, floatPage) => (this.cviews.titlebar.floatedIndex = floatPage),
|
|
71
63
|
},
|
|
72
64
|
});
|
|
73
65
|
this.cviews.titlebar = new PageViewerTitleBar({
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseController,
|
|
3
|
-
BaseControllerProps,
|
|
4
|
-
BaseControllerEvents,
|
|
5
|
-
ControllerRootView,
|
|
6
|
-
} from "./base-controller";
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents, ControllerRootView } from "./base-controller";
|
|
7
2
|
import { Sheet } from "../components/sheet";
|
|
8
3
|
|
|
9
4
|
interface PresentedPageControllerProps extends BaseControllerProps {
|
|
@@ -59,8 +54,7 @@ export class PresentedPageController extends BaseController {
|
|
|
59
54
|
this._sheet = new Sheet<ControllerRootView, UIView, UiTypes.ViewOptions>({
|
|
60
55
|
presentMode: props?.presentMode ?? 1,
|
|
61
56
|
animated: props?.animated ?? true,
|
|
62
|
-
interactiveDismissalDisabled:
|
|
63
|
-
props?.interactiveDismissalDisabled || false,
|
|
57
|
+
interactiveDismissalDisabled: props?.interactiveDismissalDisabled || false,
|
|
64
58
|
bgcolor: props?.bgcolor || $color("secondarySurface"),
|
|
65
59
|
cview: this.rootView,
|
|
66
60
|
dismissalHandler: () => {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseController,
|
|
3
|
-
BaseControllerProps,
|
|
4
|
-
BaseControllerEvents,
|
|
5
|
-
} from "./base-controller";
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
6
2
|
import { Base } from "../components/base";
|
|
7
3
|
import { ContentView } from "../components/single-views";
|
|
8
4
|
import { cvid } from "../utils/cvid";
|
|
@@ -148,9 +144,7 @@ class MaskView extends Base<UIView, UiTypes.ViewOptions> {
|
|
|
148
144
|
.$alloc()
|
|
149
145
|
.$initWithTarget_action(object, "swipeEvent");
|
|
150
146
|
swipeGestureRecognizer.$setDirection(1 << 1); // 从右向左划动
|
|
151
|
-
const tapGestureRecognizer = $objc("UITapGestureRecognizer")
|
|
152
|
-
.$alloc()
|
|
153
|
-
.$initWithTarget_action(object, "tapEvent");
|
|
147
|
+
const tapGestureRecognizer = $objc("UITapGestureRecognizer").$alloc().$initWithTarget_action(object, "tapEvent");
|
|
154
148
|
view.ocValue().$addGestureRecognizer(tapGestureRecognizer);
|
|
155
149
|
view.ocValue().$addGestureRecognizer(swipeGestureRecognizer);
|
|
156
150
|
}
|
|
@@ -265,10 +259,7 @@ export class SplitViewController extends BaseController {
|
|
|
265
259
|
make.left.equalTo(view.prev.right);
|
|
266
260
|
make.width.equalTo(view.super);
|
|
267
261
|
},
|
|
268
|
-
views: [
|
|
269
|
-
props.items[0].controller.rootView.definition,
|
|
270
|
-
this.cviews.maskView.definition,
|
|
271
|
-
],
|
|
262
|
+
views: [props.items[0].controller.rootView.definition, this.cviews.maskView.definition],
|
|
272
263
|
});
|
|
273
264
|
this._screenEdgePanGestureObject = this._defineGestureObject(() => {
|
|
274
265
|
if (!this.sideBarShown && this._canShowSidebar) this.sideBarShown = true;
|
|
@@ -317,24 +308,14 @@ export class SplitViewController extends BaseController {
|
|
|
317
308
|
}
|
|
318
309
|
|
|
319
310
|
_renewScreenEdgePanGesture() {
|
|
320
|
-
const UIScreenEdgePanGestureRecognizer = $ui.controller.view
|
|
321
|
-
.ocValue()
|
|
322
|
-
.$gestureRecognizers()
|
|
323
|
-
.$firstObject();
|
|
311
|
+
const UIScreenEdgePanGestureRecognizer = $ui.controller.view.ocValue().$gestureRecognizers().$firstObject();
|
|
324
312
|
|
|
325
313
|
UIScreenEdgePanGestureRecognizer.invoke("removeTarget:action:", null, null);
|
|
326
|
-
const NewUIScreenEdgePanGestureRecognizer = $objc(
|
|
327
|
-
"UIScreenEdgePanGestureRecognizer"
|
|
328
|
-
)
|
|
314
|
+
const NewUIScreenEdgePanGestureRecognizer = $objc("UIScreenEdgePanGestureRecognizer")
|
|
329
315
|
.$alloc()
|
|
330
|
-
.$initWithTarget_action(
|
|
331
|
-
this._screenEdgePanGestureObject,
|
|
332
|
-
"screenEdgePanEvent"
|
|
333
|
-
);
|
|
316
|
+
.$initWithTarget_action(this._screenEdgePanGestureObject, "screenEdgePanEvent");
|
|
334
317
|
NewUIScreenEdgePanGestureRecognizer.$setEdges(1 << 1);
|
|
335
|
-
this.rootView.view
|
|
336
|
-
.ocValue()
|
|
337
|
-
.$addGestureRecognizer(NewUIScreenEdgePanGestureRecognizer);
|
|
318
|
+
this.rootView.view.ocValue().$addGestureRecognizer(NewUIScreenEdgePanGestureRecognizer);
|
|
338
319
|
}
|
|
339
320
|
|
|
340
321
|
_showSideBar() {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
BaseController,
|
|
3
|
-
BaseControllerProps,
|
|
4
|
-
BaseControllerEvents,
|
|
5
|
-
} from "./base-controller";
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
6
2
|
import { ContentView } from "../components/single-views";
|
|
7
3
|
import { TabBar } from "../components/tabbar";
|
|
8
4
|
|
|
@@ -88,9 +84,7 @@ export class TabBarController extends BaseController {
|
|
|
88
84
|
events: {
|
|
89
85
|
changed: (cview, index) => {
|
|
90
86
|
this.index = index;
|
|
91
|
-
this._props.items
|
|
92
|
-
.find((item) => item.controller.status === 2)
|
|
93
|
-
?.controller.disappear();
|
|
87
|
+
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
94
88
|
this._props.items[index].controller.appear();
|
|
95
89
|
events.changed?.(this, index);
|
|
96
90
|
},
|
|
@@ -127,9 +121,7 @@ export class TabBarController extends BaseController {
|
|
|
127
121
|
n.view.hidden = i !== num;
|
|
128
122
|
});
|
|
129
123
|
this._props.index = num;
|
|
130
|
-
this._props.items
|
|
131
|
-
.find((item) => item.controller.status === 2)
|
|
132
|
-
?.controller.disappear();
|
|
124
|
+
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
133
125
|
this._props.items[num].controller.appear();
|
|
134
126
|
}
|
|
135
127
|
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./components/dynamic-rowheight-list"), exports);
|
|
|
23
23
|
__exportStar(require("./components/enhanced-imageview"), exports);
|
|
24
24
|
__exportStar(require("./components/flowlayout"), exports);
|
|
25
25
|
__exportStar(require("./components/image-pager"), exports);
|
|
26
|
+
__exportStar(require("./components/oc-webview"), exports);
|
|
26
27
|
__exportStar(require("./components/page-control"), exports);
|
|
27
28
|
__exportStar(require("./components/pageviewer-titlebar"), exports);
|
|
28
29
|
__exportStar(require("./components/pageviewer"), exports);
|
package/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from "./components/dynamic-rowheight-list";
|
|
|
7
7
|
export * from "./components/enhanced-imageview";
|
|
8
8
|
export * from "./components/flowlayout";
|
|
9
9
|
export * from "./components/image-pager";
|
|
10
|
+
export * from "./components/oc-webview";
|
|
10
11
|
export * from "./components/page-control";
|
|
11
12
|
export * from "./components/pageviewer-titlebar";
|
|
12
13
|
export * from "./components/pageviewer";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsbox-cview",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "为 JSBox 设计的微型框架",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "^20.11.17",
|
|
21
21
|
"browserify": "^17.0.1",
|
|
22
|
-
"jsbox-types": "^
|
|
22
|
+
"jsbox-types": "^2.0.0",
|
|
23
|
+
"prettier": "^3.8.1"
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -55,13 +55,8 @@ const matrix = new DynamicItemSizeMatrix({
|
|
|
55
55
|
didScroll: (sender) => {
|
|
56
56
|
matrix.columns;
|
|
57
57
|
console.log(sender.contentOffset.y);
|
|
58
|
-
console.log(
|
|
59
|
-
|
|
60
|
-
);
|
|
61
|
-
console.log(
|
|
62
|
-
Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)) *
|
|
63
|
-
matrix.columns
|
|
64
|
-
);
|
|
58
|
+
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)));
|
|
59
|
+
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)) * matrix.columns);
|
|
65
60
|
},
|
|
66
61
|
},
|
|
67
62
|
});
|
package/test/flowlayout.ts
CHANGED
|
@@ -21,11 +21,7 @@ class FlowlayoutItem extends Label {
|
|
|
21
21
|
|
|
22
22
|
const flowlayout = new Flowlayout({
|
|
23
23
|
props: {
|
|
24
|
-
items: [
|
|
25
|
-
new FlowlayoutItem("Hello"),
|
|
26
|
-
new FlowlayoutItem("World"),
|
|
27
|
-
new FlowlayoutItem("Flowlayout"),
|
|
28
|
-
],
|
|
24
|
+
items: [new FlowlayoutItem("Hello"), new FlowlayoutItem("World"), new FlowlayoutItem("Flowlayout")],
|
|
29
25
|
spacing: 10,
|
|
30
26
|
itemHeight: 30,
|
|
31
27
|
fixedRows: 2,
|
|
@@ -68,15 +64,11 @@ $ui.render({
|
|
|
68
64
|
new FlowlayoutItem("New Item"),
|
|
69
65
|
new FlowlayoutItem("Hello"),
|
|
70
66
|
new FlowlayoutItem("World"),
|
|
71
|
-
new FlowlayoutItem(
|
|
72
|
-
"FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"
|
|
73
|
-
),
|
|
67
|
+
new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"),
|
|
74
68
|
new FlowlayoutItem("New Item"),
|
|
75
69
|
new FlowlayoutItem("Hello"),
|
|
76
70
|
new FlowlayoutItem("World"),
|
|
77
|
-
new FlowlayoutItem(
|
|
78
|
-
"FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"
|
|
79
|
-
),
|
|
71
|
+
new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"),
|
|
80
72
|
new FlowlayoutItem("New Item"),
|
|
81
73
|
];
|
|
82
74
|
},
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PreferenceListView,
|
|
3
|
-
PreferenceSection,
|
|
4
|
-
} from "../components/static-preference-listview";
|
|
1
|
+
import { PreferenceListView, PreferenceSection } from "../components/static-preference-listview";
|
|
5
2
|
const sections: PreferenceSection[] = [
|
|
6
3
|
{
|
|
7
4
|
title: "Section 1",
|
package/tsconfig.json
CHANGED
|
@@ -107,8 +107,7 @@
|
|
|
107
107
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
108
|
},
|
|
109
109
|
"include": [
|
|
110
|
-
"node_modules/jsbox-types
|
|
111
|
-
"node_modules/jsbox-types/*/*.d.ts",
|
|
110
|
+
"node_modules/jsbox-types/index.d.ts",
|
|
112
111
|
"test.ts",
|
|
113
112
|
"index.ts",
|
|
114
113
|
"utils/*.ts",
|
package/utils/cvid.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
function makeid(length: number) {
|
|
7
7
|
let result = "";
|
|
8
|
-
const characters =
|
|
9
|
-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
8
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
10
9
|
var charactersLength = characters.length;
|
|
11
10
|
for (let i = 0; i < length; i++) {
|
|
12
11
|
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
package/utils/path.ts
CHANGED
|
@@ -29,10 +29,7 @@ export function split(path: string): [string, string] {
|
|
|
29
29
|
} else if (lastIndex === 0) {
|
|
30
30
|
return [protocol + "/", remainingPath.slice(1)];
|
|
31
31
|
} else {
|
|
32
|
-
return [
|
|
33
|
-
protocol + remainingPath.slice(0, lastIndex),
|
|
34
|
-
remainingPath.slice(lastIndex + 1),
|
|
35
|
-
];
|
|
32
|
+
return [protocol + remainingPath.slice(0, lastIndex), remainingPath.slice(lastIndex + 1)];
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
|
package/utils/uitools.ts
CHANGED
|
@@ -12,10 +12,7 @@ export function getWindowSize(): JBSize {
|
|
|
12
12
|
* 获取单行字符串应有的宽度
|
|
13
13
|
* 默认额外添加3 inset
|
|
14
14
|
*/
|
|
15
|
-
export function getTextWidth(
|
|
16
|
-
text: string,
|
|
17
|
-
{ font = $font(17), inset = 3 } = {}
|
|
18
|
-
): number {
|
|
15
|
+
export function getTextWidth(text: string, { font = $font(17), inset = 3 } = {}): number {
|
|
19
16
|
return (
|
|
20
17
|
Math.ceil(
|
|
21
18
|
$text.sizeThatFits({
|
|
@@ -23,7 +20,7 @@ export function getTextWidth(
|
|
|
23
20
|
width: 10000,
|
|
24
21
|
font,
|
|
25
22
|
lineSpacing: 0,
|
|
26
|
-
}).width
|
|
23
|
+
}).width,
|
|
27
24
|
) + inset
|
|
28
25
|
);
|
|
29
26
|
}
|
|
@@ -34,7 +31,7 @@ export function getTextWidth(
|
|
|
34
31
|
*/
|
|
35
32
|
export function getTextHeight(
|
|
36
33
|
text: string,
|
|
37
|
-
{ width = 300, font = $font(17), inset = 3, lineSpacing = 0 } = {}
|
|
34
|
+
{ width = 300, font = $font(17), inset = 3, lineSpacing = 0 } = {},
|
|
38
35
|
): number {
|
|
39
36
|
return (
|
|
40
37
|
Math.ceil(
|
|
@@ -43,7 +40,7 @@ export function getTextHeight(
|
|
|
43
40
|
width,
|
|
44
41
|
font,
|
|
45
42
|
lineSpacing,
|
|
46
|
-
}).height
|
|
43
|
+
}).height,
|
|
47
44
|
) + inset
|
|
48
45
|
);
|
|
49
46
|
}
|
|
@@ -114,7 +111,7 @@ export function setLayer(
|
|
|
114
111
|
shadowOpacity = 0,
|
|
115
112
|
shadowOffset = $size(0, 0),
|
|
116
113
|
shadowColor = $color("clear"),
|
|
117
|
-
} = {}
|
|
114
|
+
} = {},
|
|
118
115
|
): void {
|
|
119
116
|
const layer = view.ocValue().invoke("layer");
|
|
120
117
|
layer.invoke("setCornerRadius", cornerRadius);
|