jsbox-cview 1.6.5 → 1.6.6

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 (43) hide show
  1. package/components/dynamic-itemsize-section-matrix.ts +363 -0
  2. package/dist/components/alert/input-alert.js +1 -2
  3. package/dist/components/alert/login-alert.js +1 -2
  4. package/dist/components/alert/plain-alert.js +1 -2
  5. package/dist/components/custom-navigation-bar.js +7 -1
  6. package/dist/components/dialogs/form-dialog.js +1 -2
  7. package/dist/components/dialogs/list-dialog.js +1 -2
  8. package/dist/components/dialogs/text-dialog.js +1 -2
  9. package/dist/components/dynamic-contextmenu-view.js +5 -1
  10. package/dist/components/dynamic-itemsize-matrix.js +17 -15
  11. package/dist/components/dynamic-itemsize-section-matrix.js +293 -0
  12. package/dist/components/dynamic-preference-listview.js +25 -16
  13. package/dist/components/dynamic-rowheight-list.js +10 -3
  14. package/dist/components/enhanced-imageview.js +1 -1
  15. package/dist/components/flowlayout.js +10 -13
  16. package/dist/components/image-pager.js +6 -1
  17. package/dist/components/oc-webview.js +13 -5
  18. package/dist/components/page-control.js +2 -13
  19. package/dist/components/pageviewer-titlebar.js +7 -13
  20. package/dist/components/pageviewer.js +4 -1
  21. package/dist/components/refresh-button.js +3 -4
  22. package/dist/components/rotating-view.js +10 -2
  23. package/dist/components/searchbar.js +8 -1
  24. package/dist/components/single-views.js +11 -4
  25. package/dist/components/spinners/spinner-androidstyle.js +7 -1
  26. package/dist/components/static-preference-listview.js +13 -10
  27. package/dist/components/symbol-button.js +8 -1
  28. package/dist/components/tabbar.js +8 -1
  29. package/dist/controller/pageviewer-controller.js +4 -1
  30. package/dist/controller/presented-page-controller.js +7 -9
  31. package/dist/controller/splitview-controller.js +23 -11
  32. package/dist/controller/tabbar-controller.js +13 -14
  33. package/dist/index.js +1 -0
  34. package/dist/test/dynamic-itemsize-section-matrix.js +138 -0
  35. package/dist/test/oc-webview.js +2 -2
  36. package/dist/utils/l10n.js +1 -2
  37. package/dist/utils/path.js +8 -9
  38. package/dist/utils/rect.js +8 -9
  39. package/dist/utils/uitools.js +6 -6
  40. package/index.ts +1 -0
  41. package/package.json +4 -3
  42. package/test/dynamic-itemsize-section-matrix.ts +142 -0
  43. package/tsconfig.json +1 -1
@@ -39,7 +39,14 @@ class SearchBar extends base_1.Base {
39
39
  */
40
40
  constructor({ props, layout, events = {}, }) {
41
41
  super();
42
- this._props = Object.assign({ placeholder: (0, l10n_1.l10n)("SEARCH"), cancelText: (0, l10n_1.l10n)("CANCEL"), tintColor: $color("systemLink"), bgcolor: colors_1.searchBarBgcolor, style: 0 }, props);
42
+ this._props = {
43
+ placeholder: (0, l10n_1.l10n)("SEARCH"),
44
+ cancelText: (0, l10n_1.l10n)("CANCEL"),
45
+ tintColor: $color("systemLink"),
46
+ bgcolor: colors_1.searchBarBgcolor,
47
+ style: 0,
48
+ ...props,
49
+ };
43
50
  const cancelButtonWidth = (0, uitools_1.getTextWidth)(this._props.cancelText, {
44
51
  inset: 20,
45
52
  });
@@ -16,7 +16,10 @@ class SingleView extends base_1.Base {
16
16
  this._defineView = () => {
17
17
  return {
18
18
  type: this._type,
19
- props: Object.assign(Object.assign({}, this._props), { id: this.id }),
19
+ props: {
20
+ ...this._props,
21
+ id: this.id,
22
+ },
20
23
  layout: this._layout,
21
24
  events: this._events,
22
25
  views: this._views,
@@ -29,7 +32,7 @@ class ClearView extends SingleView {
29
32
  constructor({ props, layout = $layout.fill, events, views, }) {
30
33
  super({
31
34
  type: "view",
32
- props: Object.assign({}, props),
35
+ props: { ...props },
33
36
  layout,
34
37
  events,
35
38
  views,
@@ -41,7 +44,7 @@ class ContentView extends SingleView {
41
44
  constructor({ props, layout = $layout.fillSafeArea, events = {}, views, }) {
42
45
  super({
43
46
  type: "view",
44
- props: Object.assign({ bgcolor: $color("primarySurface") }, props),
47
+ props: { bgcolor: $color("primarySurface"), ...props },
45
48
  layout,
46
49
  events,
47
50
  views,
@@ -59,7 +62,11 @@ class MaskView extends SingleView {
59
62
  constructor({ props, layout = $layout.fill, events, views, }) {
60
63
  super({
61
64
  type: "view",
62
- props: Object.assign(Object.assign({ bgcolor: $rgba(0, 0, 0, 0.2) }, props), { userInteractionEnabled: true }),
65
+ props: {
66
+ bgcolor: $rgba(0, 0, 0, 0.2),
67
+ ...props,
68
+ userInteractionEnabled: true,
69
+ },
63
70
  layout,
64
71
  events,
65
72
  views,
@@ -18,7 +18,13 @@ class AndroidStyleSpinner extends base_1.Base {
18
18
  */
19
19
  constructor({ props, layout, }) {
20
20
  super();
21
- this._props = Object.assign({ weight: 2, diameter: 24, color: $color("gray"), bgcolor: $color("clear") }, props);
21
+ this._props = {
22
+ weight: 2,
23
+ diameter: 24,
24
+ color: $color("gray"),
25
+ bgcolor: $color("clear"),
26
+ ...props,
27
+ };
22
28
  this._defineView = () => {
23
29
  const weight = this._props.weight;
24
30
  const color = this._props.color;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PreferenceListView = exports.dateToString = exports.excludedTypes = exports.selectableTypes = void 0;
3
+ exports.PreferenceListView = exports.excludedTypes = exports.selectableTypes = void 0;
4
+ exports.dateToString = dateToString;
4
5
  const base_1 = require("./base");
5
6
  const uitools_1 = require("../utils/uitools");
6
7
  exports.selectableTypes = [
@@ -78,7 +79,6 @@ class BaseStringCell extends Cell {
78
79
  this._textColor = textColor;
79
80
  }
80
81
  _defineValueView() {
81
- var _a;
82
82
  return {
83
83
  type: "view",
84
84
  props: {},
@@ -105,7 +105,7 @@ class BaseStringCell extends Cell {
105
105
  type: "label",
106
106
  props: {
107
107
  id: "label",
108
- text: (_a = this._handleText(this._value)) === null || _a === void 0 ? void 0 : _a.toString(),
108
+ text: this._handleText(this._value)?.toString(),
109
109
  align: $align.right,
110
110
  font: $font(17),
111
111
  textColor: this._textColor,
@@ -483,7 +483,6 @@ function dateToString(mode, date) {
483
483
  return `${year}-${month}-${day} ${hours}:${minutes}`;
484
484
  }
485
485
  }
486
- exports.dateToString = dateToString;
487
486
  class DateCell extends Cell {
488
487
  constructor(props, values) {
489
488
  super(props, values);
@@ -642,13 +641,12 @@ class LinkCell extends Cell {
642
641
  }
643
642
  class SymbolActionCell extends Cell {
644
643
  constructor(props, values) {
645
- var _a, _b, _c;
646
644
  super(props, values);
647
645
  this._type = "symbol-action";
648
646
  this._symbol = props.symbol || "";
649
- this._tintColor = (_a = props.tintColor) !== null && _a !== void 0 ? _a : $color("primaryText");
650
- this._contentMode = (_b = props.contentMode) !== null && _b !== void 0 ? _b : 1;
651
- this._symbolSize = (_c = props.symbolSize) !== null && _c !== void 0 ? _c : $size(24, 24);
647
+ this._tintColor = props.tintColor ?? $color("primaryText");
648
+ this._contentMode = props.contentMode ?? 1;
649
+ this._symbolSize = props.symbolSize ?? $size(24, 24);
652
650
  }
653
651
  _defineValueView() {
654
652
  return {
@@ -845,10 +843,15 @@ class PreferenceListView extends base_1.Base {
845
843
  this._defineView = () => {
846
844
  return {
847
845
  type: "list",
848
- props: Object.assign(Object.assign({ style: 2 }, this._props), { id: this.id, data: this._cells.map((section) => ({
846
+ props: {
847
+ style: 2,
848
+ ...this._props,
849
+ id: this.id,
850
+ data: this._cells.map((section) => ({
849
851
  title: section.title,
850
852
  rows: section.rows.map((cell) => cell.definition),
851
- })) }),
853
+ })),
854
+ },
852
855
  layout: this._layout,
853
856
  events: {
854
857
  didSelect: (sender, indexPath, data) => {
@@ -18,7 +18,14 @@ const base_1 = require("./base");
18
18
  class SymbolButton extends base_1.Base {
19
19
  constructor({ props, layout, events = {}, }) {
20
20
  super();
21
- this._props = Object.assign({ enabled: true, contentMode: 1, insets: $insets(12.5, 12.5, 12.5, 12.5), tintColor: $color("primaryText"), hidden: false }, props);
21
+ this._props = {
22
+ enabled: true,
23
+ contentMode: 1,
24
+ insets: $insets(12.5, 12.5, 12.5, 12.5),
25
+ tintColor: $color("primaryText"),
26
+ hidden: false,
27
+ ...props,
28
+ };
22
29
  this._layout = layout;
23
30
  this._defineView = () => {
24
31
  const props = this._props.menu
@@ -168,7 +168,14 @@ class ImageCell extends base_1.Base {
168
168
  class TabBar extends base_1.Base {
169
169
  constructor({ props, events = {}, }) {
170
170
  super();
171
- this._props = Object.assign({ height: 50, index: 0, selectedSegmentTintColor: $color("systemLink"), defaultSegmentTintColor: colors_1.footBarDefaultSegmentColor }, props);
171
+ this._props = {
172
+ height: 50,
173
+ index: 0,
174
+ selectedSegmentTintColor: $color("systemLink"),
175
+ defaultSegmentTintColor: colors_1.footBarDefaultSegmentColor,
176
+ //bgcolor: $color("secondarySurface"),
177
+ ...props,
178
+ };
172
179
  this._index = this._props.index;
173
180
  this._events = events;
174
181
  this._cells = this._defineCells();
@@ -51,7 +51,10 @@ class PageViewerController extends base_controller_1.BaseController {
51
51
  },
52
52
  });
53
53
  this.cviews.navbar = new custom_navigation_bar_1.CustomNavigationBar({
54
- props: Object.assign(Object.assign({}, this._props.navBarProps), { titleView: this.cviews.titlebar }),
54
+ props: {
55
+ ...this._props.navBarProps,
56
+ titleView: this.cviews.titlebar,
57
+ },
55
58
  });
56
59
  this.rootView.views = [this.cviews.navbar, this.cviews.pageviewer];
57
60
  }
@@ -26,24 +26,22 @@ const sheet_1 = require("../components/sheet");
26
26
  */
27
27
  class PresentedPageController extends base_controller_1.BaseController {
28
28
  constructor({ props, layout, events, } = {}) {
29
- var _a, _b;
30
29
  super({
31
30
  props: {
32
- id: props === null || props === void 0 ? void 0 : props.id,
33
- bgcolor: props === null || props === void 0 ? void 0 : props.bgcolor,
31
+ id: props?.id,
32
+ bgcolor: props?.bgcolor,
34
33
  },
35
34
  layout,
36
35
  events,
37
36
  });
38
37
  this._sheet = new sheet_1.Sheet({
39
- presentMode: (_a = props === null || props === void 0 ? void 0 : props.presentMode) !== null && _a !== void 0 ? _a : 1,
40
- animated: (_b = props === null || props === void 0 ? void 0 : props.animated) !== null && _b !== void 0 ? _b : true,
41
- interactiveDismissalDisabled: (props === null || props === void 0 ? void 0 : props.interactiveDismissalDisabled) || false,
42
- bgcolor: (props === null || props === void 0 ? void 0 : props.bgcolor) || $color("secondarySurface"),
38
+ presentMode: props?.presentMode ?? 1,
39
+ animated: props?.animated ?? true,
40
+ interactiveDismissalDisabled: props?.interactiveDismissalDisabled || false,
41
+ bgcolor: props?.bgcolor || $color("secondarySurface"),
43
42
  cview: this.rootView,
44
43
  dismissalHandler: () => {
45
- var _a;
46
- (_a = events === null || events === void 0 ? void 0 : events.dismissed) === null || _a === void 0 ? void 0 : _a.call(events, this);
44
+ events?.dismissed?.(this);
47
45
  this.remove();
48
46
  },
49
47
  });
@@ -8,7 +8,10 @@ const cvid_1 = require("../utils/cvid");
8
8
  class SecondaryView extends base_1.Base {
9
9
  constructor({ props, layout, views = [], }) {
10
10
  super();
11
- this._props = Object.assign({ bgcolor: $color("groupedBackground", "secondarySurface") }, props);
11
+ this._props = {
12
+ bgcolor: $color("groupedBackground", "secondarySurface"),
13
+ ...props,
14
+ };
12
15
  this._layouts = {
13
16
  hidden: (make, view) => {
14
17
  make.top.bottom.inset(0);
@@ -37,7 +40,10 @@ class SecondaryView extends base_1.Base {
37
40
  this._defineView = () => {
38
41
  return {
39
42
  type: "view",
40
- props: Object.assign(Object.assign({}, this._props), { id: this.id }),
43
+ props: {
44
+ ...this._props,
45
+ id: this.id,
46
+ },
41
47
  layout,
42
48
  views: [...views, this.line.definition],
43
49
  };
@@ -65,7 +71,7 @@ class SecondaryView extends base_1.Base {
65
71
  class MaskView extends base_1.Base {
66
72
  constructor({ props, layout = $layout.fill, }) {
67
73
  super();
68
- this._props = Object.assign({ bgcolor: $color("clear") }, props);
74
+ this._props = { bgcolor: $color("clear"), ...props };
69
75
  this._shown = false;
70
76
  this._dismissEvent = () => {
71
77
  if (!this._shown)
@@ -76,7 +82,11 @@ class MaskView extends base_1.Base {
76
82
  this._defineView = () => {
77
83
  return {
78
84
  type: "view",
79
- props: Object.assign(Object.assign({}, this._props), { hidden: true, id: this.id }),
85
+ props: {
86
+ ...this._props,
87
+ hidden: true,
88
+ id: this.id,
89
+ },
80
90
  layout,
81
91
  events: {
82
92
  ready: (sender) => this._addGesture(sender, this._dismissEvent),
@@ -140,21 +150,23 @@ class SplitViewController extends base_controller_1.BaseController {
140
150
  bgcolor: props.bgcolor,
141
151
  },
142
152
  layout,
143
- events: Object.assign(Object.assign({}, events), { didAppear: (sender) => {
144
- var _a;
153
+ events: {
154
+ ...events,
155
+ didAppear: (sender) => {
145
156
  if (this._sideBarShown) {
146
157
  this._secondaryController.appear();
147
158
  }
148
159
  else {
149
160
  this._primaryController.appear();
150
161
  }
151
- (_a = events === null || events === void 0 ? void 0 : events.didAppear) === null || _a === void 0 ? void 0 : _a.call(events, this);
152
- }, didDisappear: () => {
153
- var _a;
162
+ events?.didAppear?.(this);
163
+ },
164
+ didDisappear: () => {
154
165
  this._primaryController.disappear();
155
166
  this._secondaryController.disappear();
156
- (_a = events === null || events === void 0 ? void 0 : events.didDisappear) === null || _a === void 0 ? void 0 : _a.call(events, this);
157
- } }),
167
+ events?.didDisappear?.(this);
168
+ },
169
+ },
158
170
  });
159
171
  this._sideBarShown = false;
160
172
  this._canShowSidebar = true;
@@ -27,15 +27,17 @@ class TabBarController extends base_controller_1.BaseController {
27
27
  bgcolor: props.bgcolor,
28
28
  },
29
29
  layout,
30
- events: Object.assign(Object.assign({}, events), { didAppear: () => {
31
- var _a;
30
+ events: {
31
+ ...events,
32
+ didAppear: () => {
32
33
  this._props.items[this.index].controller.appear();
33
- (_a = events.didAppear) === null || _a === void 0 ? void 0 : _a.call(events, this);
34
- }, didDisappear: () => {
35
- var _a;
34
+ events.didAppear?.(this);
35
+ },
36
+ didDisappear: () => {
36
37
  this._props.items[this.index].controller.disappear();
37
- (_a = events.didDisappear) === null || _a === void 0 ? void 0 : _a.call(events, this);
38
- } }),
38
+ events.didDisappear?.(this);
39
+ },
40
+ },
39
41
  });
40
42
  this._props = {
41
43
  items: props.items,
@@ -49,15 +51,13 @@ class TabBarController extends base_controller_1.BaseController {
49
51
  },
50
52
  events: {
51
53
  changed: (cview, index) => {
52
- var _a, _b;
53
54
  this.index = index;
54
- (_a = this._props.items.find((item) => item.controller.status === 2)) === null || _a === void 0 ? void 0 : _a.controller.disappear();
55
+ this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
55
56
  this._props.items[index].controller.appear();
56
- (_b = events.changed) === null || _b === void 0 ? void 0 : _b.call(events, this, index);
57
+ events.changed?.(this, index);
57
58
  },
58
59
  doubleTapped: (cview, index) => {
59
- var _a;
60
- (_a = events.doubleTapped) === null || _a === void 0 ? void 0 : _a.call(events, this, index);
60
+ events.doubleTapped?.(this, index);
61
61
  },
62
62
  },
63
63
  });
@@ -81,7 +81,6 @@ class TabBarController extends base_controller_1.BaseController {
81
81
  this.rootView.views = [this.cviews.pageContentView, this.cviews.tabbar];
82
82
  }
83
83
  set index(num) {
84
- var _a;
85
84
  if (this._props.index === num)
86
85
  return;
87
86
  this.cviews.tabbar.index = num;
@@ -89,7 +88,7 @@ class TabBarController extends base_controller_1.BaseController {
89
88
  n.view.hidden = i !== num;
90
89
  });
91
90
  this._props.index = num;
92
- (_a = this._props.items.find((item) => item.controller.status === 2)) === null || _a === void 0 ? void 0 : _a.controller.disappear();
91
+ this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
93
92
  this._props.items[num].controller.appear();
94
93
  }
95
94
  get index() {
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ __exportStar(require("./components/base"), exports);
18
18
  __exportStar(require("./components/custom-navigation-bar"), exports);
19
19
  __exportStar(require("./components/dynamic-contextmenu-view"), exports);
20
20
  __exportStar(require("./components/dynamic-itemsize-matrix"), exports);
21
+ __exportStar(require("./components/dynamic-itemsize-section-matrix"), exports);
21
22
  __exportStar(require("./components/dynamic-preference-listview"), exports);
22
23
  __exportStar(require("./components/dynamic-rowheight-list"), exports);
23
24
  __exportStar(require("./components/enhanced-imageview"), exports);
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const dynamic_itemsize_section_matrix_1 = require("../components/dynamic-itemsize-section-matrix");
4
+ const makeItem = (sectionName, index) => {
5
+ return {
6
+ symbol: { symbol: index % 2 === 0 ? "sparkles" : "square.grid.2x2" },
7
+ title: { text: `${sectionName} ${index}` },
8
+ subtitle: { text: `Item index ${index}` },
9
+ badge: { text: `${index}` },
10
+ };
11
+ };
12
+ const sections = [
13
+ {
14
+ title: "Pinned",
15
+ items: [makeItem("Pinned", 1), makeItem("Pinned", 2), makeItem("Pinned", 3)],
16
+ },
17
+ {
18
+ title: "Long Section Title To Verify The Custom Title Cell Uses Dynamic Height\nLine 2\nLine 3",
19
+ items: [makeItem("Recent", 1), makeItem("Recent", 2), makeItem("Recent", 3), makeItem("Recent", 4)],
20
+ },
21
+ {
22
+ title: "",
23
+ items: [makeItem("Untitled", 1), makeItem("Untitled", 2)],
24
+ },
25
+ ];
26
+ const matrix = new dynamic_itemsize_section_matrix_1.DynamicItemSizeSectionMatrix({
27
+ props: {
28
+ spacing: 8,
29
+ minItemWidth: $device.isIpad ? 180 : 142,
30
+ maxColumns: $device.isIpad ? 4 : 2,
31
+ data: sections,
32
+ template: {
33
+ views: [
34
+ {
35
+ type: "view",
36
+ props: {
37
+ bgcolor: $color("yellow"),
38
+ cornerRadius: 8,
39
+ },
40
+ layout: $layout.fill,
41
+ views: [
42
+ {
43
+ type: "image",
44
+ props: {
45
+ id: "symbol",
46
+ contentMode: $contentMode.scaleAspectFit,
47
+ tintColor: $color("tint"),
48
+ },
49
+ layout: (make, view) => {
50
+ make.left.top.inset(12);
51
+ make.size.equalTo($size(32, 32));
52
+ },
53
+ },
54
+ {
55
+ type: "label",
56
+ props: {
57
+ id: "badge",
58
+ align: $align.center,
59
+ font: $font(12),
60
+ textColor: $color("white"),
61
+ bgcolor: $color("tint"),
62
+ cornerRadius: 10,
63
+ },
64
+ layout: (make, view) => {
65
+ make.top.right.inset(12);
66
+ make.size.equalTo($size(28, 20));
67
+ },
68
+ },
69
+ {
70
+ type: "label",
71
+ props: {
72
+ id: "title",
73
+ font: $font("bold", 15),
74
+ textColor: $color("primaryText"),
75
+ },
76
+ layout: (make, view) => {
77
+ make.left.right.inset(12);
78
+ make.top.equalTo(view.prev.prev.bottom).offset(10);
79
+ make.height.equalTo(20);
80
+ },
81
+ },
82
+ {
83
+ type: "label",
84
+ props: {
85
+ id: "subtitle",
86
+ font: $font(12),
87
+ textColor: $color("secondaryText"),
88
+ },
89
+ layout: (make, view) => {
90
+ make.left.right.inset(12);
91
+ make.top.equalTo(view.prev.bottom).offset(4);
92
+ make.bottom.inset(12);
93
+ },
94
+ },
95
+ ],
96
+ },
97
+ ],
98
+ },
99
+ },
100
+ layout: $layout.fill,
101
+ events: {
102
+ itemHeight: (width) => Math.max(112, width * 0.72),
103
+ didSelect: (sender, indexPath, data) => {
104
+ const section = matrix.data[indexPath.section];
105
+ const title = data.title.text;
106
+ $ui.toast(`${section.title || "Untitled"} / ${title}`);
107
+ },
108
+ didLongPress: (sender, indexPath, data) => {
109
+ const title = data.title.text;
110
+ $ui.alert(`Long pressed ${title}`);
111
+ },
112
+ },
113
+ });
114
+ $ui.render({
115
+ props: {
116
+ navButtons: [
117
+ {
118
+ symbol: "plus",
119
+ handler: () => {
120
+ const nextIndex = matrix.data[0].items.length + 1;
121
+ matrix.insert({
122
+ indexPath: $indexPath(0, matrix.data[0].items.length),
123
+ value: makeItem("Pinned", nextIndex),
124
+ });
125
+ },
126
+ },
127
+ {
128
+ symbol: "trash",
129
+ handler: () => {
130
+ if (matrix.data[0].items.length === 0)
131
+ return;
132
+ matrix.delete($indexPath(0, matrix.data[0].items.length - 1));
133
+ },
134
+ },
135
+ ],
136
+ },
137
+ views: [matrix.definition],
138
+ });
@@ -59,11 +59,11 @@ const webView = new oc_webview_1.OCWebView({
59
59
  syncAddress(sender);
60
60
  logState("didFinish", sender);
61
61
  try {
62
- const localStorage = await webView.evaluateJavaScript(localStorageScript);
62
+ const localStorage = await webView.exec(localStorageScript);
63
63
  console.log(`[localStorage] ${localStorage || "{}"}`);
64
64
  }
65
65
  catch (error) {
66
- console.log(`[localStorage] error=${(error === null || error === void 0 ? void 0 : error.localizedDescription) || error}`);
66
+ console.log(`[localStorage] error=${error?.localizedDescription || error}`);
67
67
  }
68
68
  },
69
69
  didFail: (sender, error) => {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // 用于自定义的国际化支持
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.l10n = void 0;
4
+ exports.l10n = l10n;
5
5
  const language = $device.info.language;
6
6
  const strings = {
7
7
  "zh-Hans": {
@@ -41,4 +41,3 @@ function l10n(key) {
41
41
  const value = strings[language][key];
42
42
  return value || key;
43
43
  }
44
- exports.l10n = l10n;
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  // 用于处理路径的工具函数
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getFileSize = exports.getModificationDate = exports.getCreationDate = exports.join = exports.extname = exports.basename = exports.dirname = exports.split = void 0;
4
+ exports.split = split;
5
+ exports.dirname = dirname;
6
+ exports.basename = basename;
7
+ exports.extname = extname;
8
+ exports.join = join;
9
+ exports.getCreationDate = getCreationDate;
10
+ exports.getModificationDate = getModificationDate;
11
+ exports.getFileSize = getFileSize;
5
12
  function _splitProtocol(path) {
6
13
  const regex = /^\w+:\/\//;
7
14
  const result = regex.exec(path);
@@ -37,15 +44,12 @@ function split(path) {
37
44
  return [protocol + remainingPath.slice(0, lastIndex), remainingPath.slice(lastIndex + 1)];
38
45
  }
39
46
  }
40
- exports.split = split;
41
47
  function dirname(path) {
42
48
  return split(path)[0];
43
49
  }
44
- exports.dirname = dirname;
45
50
  function basename(path) {
46
51
  return split(path)[1];
47
52
  }
48
- exports.basename = basename;
49
53
  function extname(path) {
50
54
  const _basename = basename(path);
51
55
  if (!_basename)
@@ -58,7 +62,6 @@ function extname(path) {
58
62
  return "." + components.slice(-1)[0];
59
63
  }
60
64
  }
61
- exports.extname = extname;
62
65
  // 拼接目录
63
66
  function join(...args) {
64
67
  return args
@@ -73,7 +76,6 @@ function join(...args) {
73
76
  .filter((x) => x.length)
74
77
  .join("/");
75
78
  }
76
- exports.join = join;
77
79
  function _getAttributes(path) {
78
80
  if (!$file.exists(path))
79
81
  throw new Error("invalid path");
@@ -89,16 +91,13 @@ function getCreationDate(path) {
89
91
  return 0;
90
92
  return NSFileCreationDate.getTime();
91
93
  }
92
- exports.getCreationDate = getCreationDate;
93
94
  function getModificationDate(path) {
94
95
  const { NSFileModificationDate } = _getAttributes(path);
95
96
  if (!NSFileModificationDate)
96
97
  return 0;
97
98
  return NSFileModificationDate.getTime();
98
99
  }
99
- exports.getModificationDate = getModificationDate;
100
100
  function getFileSize(path) {
101
101
  const { NSFileSize } = _getAttributes(path);
102
102
  return NSFileSize || 0;
103
103
  }
104
- exports.getFileSize = getFileSize;