@octane-xplat/ui 0.7.2 → 0.9.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/README.md +4 -3
- package/dist/native/Button.tsrx.js +1 -1
- package/dist/native/CommandPalette.tsrx.js +7 -1
- package/dist/native/Grid.tsrx.js +31 -2
- package/dist/native/KeyboardAvoiding.mobile.tsrx.js +2 -2
- package/dist/native/Markdown.tsrx.js +233 -0
- package/dist/native/Overlay.tsrx.js +15 -26
- package/dist/native/Pagination.tsrx.js +15 -12
- package/dist/native/PinInput.tsrx.js +25 -7
- package/dist/native/Popover.tsrx.js +33 -23
- package/dist/native/Pressable.tsrx.js +4 -1
- package/dist/native/Screen.tsrx.js +1 -1
- package/dist/native/SearchInput.tsrx.js +6 -3
- package/dist/native/Sheet.tsrx.js +23 -38
- package/dist/native/Slider.tsrx.js +23 -14
- package/dist/native/Text.tsrx.js +16 -0
- package/dist/native/TextArea.tsrx.js +6 -3
- package/dist/native/TextInput.tsrx.js +6 -3
- package/dist/native/VirtualList.tsrx.js +305 -121
- package/dist/native/WebView.tsrx.js +17 -2
- package/dist/native/_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js +9 -0
- package/dist/native/escape-props.js +2 -0
- package/dist/native/grid-auto-placement.js +83 -0
- package/dist/native/grid-placement.js +20 -0
- package/dist/native/index.shared.js +7 -5
- package/dist/native/keyboard-inset.mobile.js +5 -5
- package/dist/native/navigation-request.js +26 -0
- package/dist/native/octane-client-build.json +1 -1
- package/dist/native/overlay-lifetime.mobile.js +65 -0
- package/dist/native/pan.tsrx.js +16 -2
- package/dist/native/route-table.js +90 -10
- package/dist/native/route.js +26 -16
- package/dist/native/shared.js +7 -5
- package/dist/native/sheet-service.js +2 -2
- package/dist/native/svg.mobile.js +1 -1
- package/dist/native/{tap-to-blur.mobile.js → tap-to-blur.ios.js} +20 -32
- package/dist/native/text-focus.js +10 -0
- package/dist/native/text-write.js +18 -11
- package/dist/native/toast-anchor.tsrx.js +1 -1
- package/dist/native/ui.js +7 -6
- package/dist/native/useMeasure.tsrx.js +17 -18
- package/dist/native/vendor/ui-svg/index.android.js +2 -2
- package/dist/native/vendor/ui-svg/index.ios.js +2 -2
- package/dist/native/vendor/ui-svg/{index.common.js → src/index.common.js} +1 -1
- package/dist/native/virtual-list-cell-pool.js +63 -0
- package/dist/web/Button.web.tsrx.js +1 -1
- package/dist/web/KeyboardAvoiding.web.tsrx.js +78 -0
- package/dist/web/Markdown.tsrx.js +98 -0
- package/dist/web/Overlay.web.tsrx.js +81 -32
- package/dist/web/PinInput.web.tsrx.js +24 -10
- package/dist/web/Pressable.web.tsrx.js +169 -53
- package/dist/web/SearchInput.web.tsrx.js +2 -2
- package/dist/web/Sheet.web.tsrx.js +20 -7
- package/dist/web/TextArea.web.tsrx.js +22 -17
- package/dist/web/TextInput.web.tsrx.js +2 -2
- package/dist/web/VirtualList.web.tsrx.js +220 -109
- package/dist/web/WebView.web.tsrx.js +3 -3
- package/dist/web/{index.shared.js → index.shared.web.js} +7 -5
- package/dist/web/modal-focus.web.js +95 -0
- package/dist/web/navigation-request.js +26 -0
- package/dist/web/octane-client-build.json +1 -1
- package/dist/web/pan.web.tsrx.js +27 -10
- package/dist/web/route-table.js +90 -10
- package/dist/web/route.web.js +88 -22
- package/dist/web/sheet-service.web.js +8 -0
- package/dist/web/theme/colorScheme.web.js +31 -4
- package/dist/web/ui.js +8 -6
- package/dist/web/virtual-list-cell-pool.js +63 -0
- package/package.json +21 -19
- package/platforms/android/native-api-usage.json +7 -7
- package/src/CommandPalette.tsrx +8 -1
- package/src/Grid.tsrx +32 -1
- package/src/Icon.macos.tsrx +1 -0
- package/src/KeyboardAvoiding.macos.tsrx +7 -1
- package/src/KeyboardAvoiding.mobile.tsrx +2 -2
- package/src/KeyboardAvoiding.tsrx +15 -0
- package/src/KeyboardAvoiding.web.tsrx +15 -0
- package/src/Markdown.tsrx +121 -0
- package/src/Meter.tsrx +1 -0
- package/src/Overlay.tsrx +15 -30
- package/src/Overlay.web.tsrx +12 -3
- package/src/Pagination.tsrx +6 -4
- package/src/PinInput.macos.tsrx +20 -6
- package/src/PinInput.mobile.test.ts +107 -0
- package/src/PinInput.tsrx +20 -6
- package/src/PinInput.web.test.tsrx +42 -0
- package/src/PinInput.web.tsrx +20 -6
- package/src/Popover.tsrx +36 -22
- package/src/Pressable.tsrx +1 -1
- package/src/Pressable.web.test.tsrx +36 -0
- package/src/Pressable.web.tsrx +37 -6
- package/src/RouteHost.macos.tsrx +1 -0
- package/src/Screen.tsrx +1 -1
- package/src/SearchInput.tsrx +4 -3
- package/src/SearchInput.web.tsrx +1 -1
- package/src/Sheet.tsrx +21 -42
- package/src/Sheet.web.tsrx +9 -1
- package/src/Slider.tsrx +13 -11
- package/src/Text.tsrx +36 -0
- package/src/TextArea.tsrx +6 -5
- package/src/TextArea.web.test.tsrx +39 -0
- package/src/TextArea.web.tsrx +7 -5
- package/src/TextInput.tsrx +6 -6
- package/src/TextInput.web.tsrx +1 -1
- package/src/VirtualList.macos.tsrx +93 -6
- package/src/VirtualList.mobile.test.tsrx +232 -0
- package/src/VirtualList.tsrx +285 -81
- package/src/VirtualList.web.tsrx +131 -25
- package/src/WebView.tsrx +20 -10
- package/src/WebView.web.tsrx +3 -0
- package/src/android/BottomNavigationView.android.tsrx +1 -0
- package/src/android/MaterialDialog.android.tsrx +1 -0
- package/src/anim.macos.tsrx +1 -0
- package/src/apply-native-modifiers.native.ts +4 -1
- package/src/child-array.ts +12 -7
- package/src/colorScheme.macos.ts +1 -0
- package/src/controls.macos.tsrx +4 -1
- package/src/data-driver.mobile.test.ts +120 -0
- package/src/data-lifecycle.mobile.test.ts +251 -0
- package/src/escape-props.ts +13 -1
- package/src/grid-auto-placement.ts +163 -0
- package/src/grid-placement.ts +29 -0
- package/src/hosted-unsupported.macos.tsrx +1 -0
- package/src/index.macos.ts +23 -3
- package/src/index.mobile.ts +0 -1
- package/src/index.shared.ts +22 -1
- package/src/index.shared.web.ts +291 -0
- package/src/index.web.ts +1 -1
- package/src/input-readiness.web.test.tsrx +82 -0
- package/src/ios/UITabBar.ios.tsrx +1 -0
- package/src/keyboard-inset.mobile.test.ts +62 -0
- package/src/keyboard-inset.mobile.ts +63 -43
- package/src/layout-shells.macos.tsrx +1 -5
- package/src/macos-extras.macos.tsrx +2 -0
- package/src/modal-focus.web.test.tsrx +63 -0
- package/src/modal-focus.web.ts +162 -0
- package/src/navigation-request.ts +37 -0
- package/src/overlay-lifecycle.mobile.test.ts +316 -0
- package/src/overlay-lifetime.mobile.ts +107 -0
- package/src/pan.mobile.test.tsrx +116 -0
- package/src/pan.tsrx +20 -2
- package/src/pan.web.tsrx +35 -7
- package/src/platformProps.ts +1 -0
- package/src/popover.mobile.test.ts +9 -1
- package/src/pressable-accessibility.mobile.test.ts +30 -0
- package/src/props.ts +163 -3
- package/src/refresh.ts +6 -1
- package/src/refresh.web.test.ts +77 -77
- package/src/route-android.test.ts +162 -0
- package/src/route-history.web.test.ts +80 -0
- package/src/route-navigation.web.test.ts +173 -0
- package/src/route-table.test.ts +188 -9
- package/src/route-table.ts +138 -10
- package/src/route.macos.ts +56 -13
- package/src/route.ts +54 -24
- package/src/route.web.ts +141 -24
- package/src/sheet-detents.ts +5 -3
- package/src/sheet-service.macos.ts +5 -1
- package/src/sheet-service.ts +1 -1
- package/src/sheet-service.web.ts +8 -0
- package/src/sheet-snap.test.ts +23 -23
- package/src/sheet-snap.ts +6 -1
- package/src/svg.mobile.ts +9 -3
- package/src/tap-to-blur.ios.ts +106 -0
- package/src/tap-to-blur.mobile.ts +21 -95
- package/src/text-focus.ts +12 -0
- package/src/text-input.mobile.test.ts +89 -0
- package/src/text-write.ts +21 -11
- package/src/theme/colorScheme.linux.ts +2 -4
- package/src/theme/colorScheme.web.ts +51 -4
- package/src/theme/theme-scheme.macos.ts +8 -2
- package/src/theme/tokens.css +1740 -1718
- package/src/translate.macos.ts +4 -1
- package/src/useMeasure.tsrx +20 -21
- package/src/virtual-list-cell-pool.test.ts +53 -0
- package/src/virtual-list-cell-pool.ts +81 -0
- package/src/virtual-list-layout.test.ts +11 -8
- package/src/virtual-list-layout.ts +4 -8
- package/src/windows.linux.ts +7 -2
- package/src/windows.macos.ts +1 -0
- package/types/generated/.tsrx-typegen-manifest.json +16 -3
- package/types/generated/Grid.d.ts +0 -1
- package/types/generated/KeyboardAvoiding.d.ts +3 -0
- package/types/generated/KeyboardAvoiding.web.d.ts +2 -0
- package/types/generated/Markdown.d.ts +59 -0
- package/types/generated/TextArea.d.ts +2 -2
- package/types/generated/TextArea.web.d.ts +1 -1
- package/types/generated/TextInput.d.ts +2 -3
- package/types/generated/VirtualList.d.ts +3 -3
- package/types/generated/escape-props.d.ts +4 -0
- package/types/generated/grid-auto-placement.d.ts +13 -0
- package/types/generated/grid-placement.d.ts +5 -0
- package/types/generated/index.mobile.d.ts +0 -1
- package/types/generated/index.shared.d.ts +6 -3
- package/types/generated/index.shared.web.d.ts +114 -0
- package/types/generated/index.web.d.ts +1 -1
- package/types/generated/modal-focus.web.d.ts +3 -0
- package/types/generated/navigation-request.d.ts +10 -0
- package/types/generated/overlay-lifetime.mobile.d.ts +10 -0
- package/types/generated/props.d.ts +111 -3
- package/types/generated/route-table.d.ts +14 -3
- package/types/generated/svg.mobile.d.ts +2 -2
- package/types/generated/tap-to-blur.ios.d.ts +13 -0
- package/types/generated/tap-to-blur.mobile.d.ts +1 -15
- package/types/generated/text-focus.d.ts +3 -0
- package/types/generated/text-write.d.ts +3 -1
- package/types/generated/theme/colorScheme.web.d.ts +5 -0
- package/types/generated/virtual-list-cell-pool.d.ts +18 -0
- package/types/index.macos.d.ts +15 -3
- /package/src/vendor/ui-svg/{index.android.ts → src/index.android.ts} +0 -0
- /package/src/vendor/ui-svg/{index.common.ts → src/index.common.ts} +0 -0
- /package/src/vendor/ui-svg/{index.ios.ts → src/index.ios.ts} +0 -0
- /package/src/vendor/ui-svg/{index.ts → src/index.ts} +0 -0
- /package/src/vendor/ui-svg/{typings → src/typings}/SVGKit.d.ts +0 -0
- /package/src/vendor/ui-svg/{typings → src/typings}/android.d.ts +0 -0
- /package/src/vendor/ui-svg/{typings → src/typings}/ios.d.ts +0 -0
- /package/types/generated/vendor/ui-svg/{index.common.d.ts → src/index.common.d.ts} +0 -0
- /package/types/generated/vendor/ui-svg/{index.d.ts → src/index.d.ts} +0 -0
- /package/types/generated/vendor/ui-svg/{index.ios.d.ts → src/index.ios.d.ts} +0 -0
|
@@ -2,9 +2,10 @@ import { cx } from "./cx.js";
|
|
|
2
2
|
import { applyEscapeProps, nativeAccessibilityRole, nativeAccessibilityState } from "./escape-props.js";
|
|
3
3
|
import { layoutChildProps } from "./layout-child.js";
|
|
4
4
|
import { VirtualListSizeIndex, createVirtualListEntries, estimateVirtualListSizes, virtualListMeasurementKey, virtualListRange } from "./virtual-list-layout.js";
|
|
5
|
-
import {
|
|
5
|
+
import { VirtualListCellPool } from "./virtual-list-cell-pool.js";
|
|
6
|
+
import { defineUniversalComponent, hookSlots, universalFor, universalPlan, universalProps, universalValue, useEffect, useMemo, useRef, useState } from "@nativescript-community/octane";
|
|
6
7
|
//#region src/VirtualList.tsrx
|
|
7
|
-
var _hs$ = /* @__PURE__ */ hookSlots(
|
|
8
|
+
var _hs$ = /* @__PURE__ */ hookSlots(32);
|
|
8
9
|
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
9
10
|
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
10
11
|
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
@@ -25,6 +26,18 @@ var _h$16 = /* @__PURE__ */ Symbol(_hs$ + 16);
|
|
|
25
26
|
var _h$17 = /* @__PURE__ */ Symbol(_hs$ + 17);
|
|
26
27
|
var _h$18 = /* @__PURE__ */ Symbol(_hs$ + 18);
|
|
27
28
|
var _h$19 = /* @__PURE__ */ Symbol(_hs$ + 19);
|
|
29
|
+
var _h$20 = /* @__PURE__ */ Symbol(_hs$ + 20);
|
|
30
|
+
var _h$21 = /* @__PURE__ */ Symbol(_hs$ + 21);
|
|
31
|
+
var _h$22 = /* @__PURE__ */ Symbol(_hs$ + 22);
|
|
32
|
+
var _h$23 = /* @__PURE__ */ Symbol(_hs$ + 23);
|
|
33
|
+
var _h$24 = /* @__PURE__ */ Symbol(_hs$ + 24);
|
|
34
|
+
var _h$25 = /* @__PURE__ */ Symbol(_hs$ + 25);
|
|
35
|
+
var _h$26 = /* @__PURE__ */ Symbol(_hs$ + 26);
|
|
36
|
+
var _h$27 = /* @__PURE__ */ Symbol(_hs$ + 27);
|
|
37
|
+
var _h$28 = /* @__PURE__ */ Symbol(_hs$ + 28);
|
|
38
|
+
var _h$29 = /* @__PURE__ */ Symbol(_hs$ + 29);
|
|
39
|
+
var _h$30 = /* @__PURE__ */ Symbol(_hs$ + 30);
|
|
40
|
+
var _h$31 = /* @__PURE__ */ Symbol(_hs$ + 31);
|
|
28
41
|
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
29
42
|
"kind": "host",
|
|
30
43
|
"type": "flexboxlayout",
|
|
@@ -64,13 +77,7 @@ var __octaneUniversalPlan2 = universalPlan("nativescript", {
|
|
|
64
77
|
}]
|
|
65
78
|
});
|
|
66
79
|
var __octaneUniversalPlan3 = universalPlan("nativescript", {
|
|
67
|
-
"kind": "
|
|
68
|
-
"type": "flexboxlayout",
|
|
69
|
-
"props": {
|
|
70
|
-
"flexDirection": "column",
|
|
71
|
-
"className": "vx-virtual-list-row"
|
|
72
|
-
},
|
|
73
|
-
"bindings": [["style", 0], ["onLayoutChanged", 1]],
|
|
80
|
+
"kind": "range",
|
|
74
81
|
"children": [{
|
|
75
82
|
"kind": "host",
|
|
76
83
|
"type": "flexboxlayout",
|
|
@@ -80,35 +87,44 @@ var __octaneUniversalPlan3 = universalPlan("nativescript", {
|
|
|
80
87
|
},
|
|
81
88
|
"children": [{
|
|
82
89
|
"kind": "slot",
|
|
83
|
-
"slot":
|
|
90
|
+
"slot": 0
|
|
84
91
|
}]
|
|
85
92
|
}, {
|
|
86
93
|
"kind": "slot",
|
|
87
|
-
"slot":
|
|
94
|
+
"slot": 1
|
|
88
95
|
}]
|
|
89
96
|
});
|
|
90
97
|
var __octaneUniversalPlan4 = universalPlan("nativescript", {
|
|
91
|
-
"kind": "
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
]
|
|
98
|
+
"kind": "host",
|
|
99
|
+
"type": "flexboxlayout",
|
|
100
|
+
"props": {
|
|
101
|
+
"flexDirection": "column",
|
|
102
|
+
"left": 0
|
|
103
|
+
},
|
|
104
|
+
"bindings": [
|
|
105
|
+
["ref", 0],
|
|
106
|
+
["className", 1],
|
|
107
|
+
["visibility", 2],
|
|
108
|
+
["top", 3],
|
|
109
|
+
["width", 4],
|
|
110
|
+
["onLayoutChanged", 5]
|
|
111
|
+
],
|
|
112
|
+
"children": [{
|
|
113
|
+
"kind": "slot",
|
|
114
|
+
"slot": 6
|
|
115
|
+
}]
|
|
110
116
|
});
|
|
111
117
|
var __octaneUniversalPlan5 = universalPlan("nativescript", {
|
|
118
|
+
"kind": "host",
|
|
119
|
+
"type": "absolutelayout",
|
|
120
|
+
"props": { "className": "vx-virtual-list-body" },
|
|
121
|
+
"bindings": [["style", 0]],
|
|
122
|
+
"children": [{
|
|
123
|
+
"kind": "slot",
|
|
124
|
+
"slot": 1
|
|
125
|
+
}]
|
|
126
|
+
});
|
|
127
|
+
var __octaneUniversalPlan6 = universalPlan("nativescript", {
|
|
112
128
|
"kind": "host",
|
|
113
129
|
"type": "flexboxlayout",
|
|
114
130
|
"props": {
|
|
@@ -121,7 +137,7 @@ var __octaneUniversalPlan5 = universalPlan("nativescript", {
|
|
|
121
137
|
"slot": 0
|
|
122
138
|
}]
|
|
123
139
|
});
|
|
124
|
-
var
|
|
140
|
+
var __octaneUniversalPlan7 = universalPlan("nativescript", {
|
|
125
141
|
"kind": "host",
|
|
126
142
|
"type": "scrollview",
|
|
127
143
|
"propsSlot": 0,
|
|
@@ -129,19 +145,19 @@ var __octaneUniversalPlan6 = universalPlan("nativescript", {
|
|
|
129
145
|
"kind": "host",
|
|
130
146
|
"type": "flexboxlayout",
|
|
131
147
|
"props": { "flexDirection": "column" },
|
|
132
|
-
"bindings": [["className", 1]],
|
|
148
|
+
"bindings": [["className", 1], ["onLayoutChanged", 2]],
|
|
133
149
|
"children": [
|
|
134
150
|
{
|
|
135
151
|
"kind": "slot",
|
|
136
|
-
"slot":
|
|
152
|
+
"slot": 3
|
|
137
153
|
},
|
|
138
154
|
{
|
|
139
155
|
"kind": "slot",
|
|
140
|
-
"slot":
|
|
156
|
+
"slot": 4
|
|
141
157
|
},
|
|
142
158
|
{
|
|
143
159
|
"kind": "slot",
|
|
144
|
-
"slot":
|
|
160
|
+
"slot": 5
|
|
145
161
|
}
|
|
146
162
|
]
|
|
147
163
|
}]
|
|
@@ -149,6 +165,30 @@ var __octaneUniversalPlan6 = universalPlan("nativescript", {
|
|
|
149
165
|
function sameSize(a, b) {
|
|
150
166
|
return Math.abs(a - b) < .5;
|
|
151
167
|
}
|
|
168
|
+
function scheduleListFrame(callback) {
|
|
169
|
+
const requestFrame = globalThis.requestAnimationFrame;
|
|
170
|
+
const cancelFrame = globalThis.cancelAnimationFrame;
|
|
171
|
+
if (typeof requestFrame !== "function" || typeof cancelFrame !== "function") {
|
|
172
|
+
const timer = setTimeout(callback, 16);
|
|
173
|
+
return () => clearTimeout(timer);
|
|
174
|
+
}
|
|
175
|
+
let cancelled = false;
|
|
176
|
+
let current = null;
|
|
177
|
+
let next = null;
|
|
178
|
+
current = requestFrame(() => {
|
|
179
|
+
current = null;
|
|
180
|
+
if (cancelled) return;
|
|
181
|
+
next = requestFrame(() => {
|
|
182
|
+
next = null;
|
|
183
|
+
if (!cancelled) callback();
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
return () => {
|
|
187
|
+
cancelled = true;
|
|
188
|
+
if (current != null) cancelFrame(current);
|
|
189
|
+
if (next != null) cancelFrame(next);
|
|
190
|
+
};
|
|
191
|
+
}
|
|
152
192
|
var VirtualList = defineUniversalComponent("nativescript", function VirtualList(props) {
|
|
153
193
|
const entries = useMemo(() => createVirtualListEntries(props.items, props.keyExtractor, props.getItemType), [
|
|
154
194
|
props.items,
|
|
@@ -157,29 +197,40 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
157
197
|
], _h$0);
|
|
158
198
|
const [windowVersion, setWindowVersion] = useState(0, _h$1);
|
|
159
199
|
const sizeIndexRef = useRef(new VirtualListSizeIndex(), _h$2);
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const
|
|
200
|
+
const cellsRef = useRef(new VirtualListCellPool(), _h$3);
|
|
201
|
+
const cellNodesRef = useRef(/* @__PURE__ */ new Map(), _h$4);
|
|
202
|
+
const cellCallbacksRef = useRef(/* @__PURE__ */ new Map(), _h$5);
|
|
203
|
+
const measuredAssignmentsRef = useRef(/* @__PURE__ */ new Map(), _h$6);
|
|
204
|
+
const sizeCacheRef = useRef(/* @__PURE__ */ new Map(), _h$7);
|
|
205
|
+
const typeSamplesRef = useRef(/* @__PURE__ */ new Map(), _h$8);
|
|
206
|
+
const appliedEstimatesRef = useRef(/* @__PURE__ */ new Map(), _h$9);
|
|
207
|
+
const estimateDirtyTypesRef = useRef(/* @__PURE__ */ new Set(), _h$10);
|
|
208
|
+
const entriesRef = useRef([], _h$11);
|
|
209
|
+
const indexByRowKeyRef = useRef(/* @__PURE__ */ new Map(), _h$12);
|
|
210
|
+
const scrollRef = useRef(null, _h$13);
|
|
211
|
+
const scrollOffsetRef = useRef(0, _h$14);
|
|
212
|
+
const viewportHeightRef = useRef(0, _h$15);
|
|
213
|
+
const viewportWidthRef = useRef(0, _h$16);
|
|
214
|
+
const contentWidthRef = useRef(0, _h$17);
|
|
215
|
+
const headerHeightRef = useRef(0, _h$18);
|
|
216
|
+
const estimateTimerRef = useRef(null, _h$19);
|
|
217
|
+
const frameCancelRef = useRef(null, _h$20);
|
|
218
|
+
const disposedRef = useRef(false, _h$21);
|
|
219
|
+
const pendingOffsetDeltaRef = useRef(0, _h$22);
|
|
220
|
+
const measurementsRef = useRef(/* @__PURE__ */ new Map(), _h$23);
|
|
170
221
|
const rangeRef = useRef({
|
|
171
222
|
start: -1,
|
|
172
223
|
end: -1,
|
|
173
224
|
top: -1,
|
|
174
225
|
bottom: -1
|
|
175
|
-
}, _h$
|
|
176
|
-
const pendingAnchorRef = useRef(null, _h$
|
|
177
|
-
const pendingAnchorRowsRef = useRef(/* @__PURE__ */ new Set(), _h$
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
const anchorRestoreTimerRef = useRef(null, _h$18);
|
|
226
|
+
}, _h$24);
|
|
227
|
+
const pendingAnchorRef = useRef(null, _h$25);
|
|
228
|
+
const pendingAnchorRowsRef = useRef(/* @__PURE__ */ new Set(), _h$26);
|
|
229
|
+
const anchorRestoreScheduledRef = useRef(false, _h$27);
|
|
230
|
+
const anchorRestoreTimerRef = useRef(null, _h$28);
|
|
181
231
|
const hasSeparator = Boolean(props.renderSeparator);
|
|
182
|
-
const hasSeparatorRef = useRef(hasSeparator, _h$
|
|
232
|
+
const hasSeparatorRef = useRef(hasSeparator, _h$29);
|
|
233
|
+
const separatorChanged = hasSeparatorRef.current !== hasSeparator;
|
|
183
234
|
hasSeparatorRef.current = hasSeparator;
|
|
184
235
|
function rebuildLayout(nextEntries, width) {
|
|
185
236
|
entriesRef.current = nextEntries;
|
|
@@ -191,10 +242,25 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
191
242
|
activeMeasurements.add(cacheKey);
|
|
192
243
|
}
|
|
193
244
|
for (const cacheKey of sizeCacheRef.current.keys()) if (!activeMeasurements.has(cacheKey)) sizeCacheRef.current.delete(cacheKey);
|
|
245
|
+
const samples = /* @__PURE__ */ new Map();
|
|
246
|
+
for (const entry of nextEntries) {
|
|
247
|
+
const cached = sizeCacheRef.current.get(virtualListMeasurementKey(entry.rowKey, hasSeparatorRef.current && entry.index < nextEntries.length - 1));
|
|
248
|
+
if (!cached) continue;
|
|
249
|
+
const sample = samples.get(entry.typeKey) ?? {
|
|
250
|
+
sum: 0,
|
|
251
|
+
count: 0
|
|
252
|
+
};
|
|
253
|
+
sample.sum += cached.height;
|
|
254
|
+
sample.count++;
|
|
255
|
+
samples.set(entry.typeKey, sample);
|
|
256
|
+
}
|
|
257
|
+
typeSamplesRef.current = samples;
|
|
258
|
+
estimateDirtyTypesRef.current.clear();
|
|
259
|
+
appliedEstimatesRef.current = new Map([...samples].map(([type, sample]) => [type, sample.count >= 4 ? sample.sum / sample.count : 48]));
|
|
194
260
|
indexByRowKeyRef.current = indexByKey;
|
|
195
|
-
sizeIndexRef.current.reset(estimateVirtualListSizes(nextEntries, hasSeparatorRef.current, width, sizeCacheRef.current));
|
|
261
|
+
sizeIndexRef.current.reset(estimateVirtualListSizes(nextEntries, hasSeparatorRef.current, contentWidthRef.current || width, sizeCacheRef.current));
|
|
196
262
|
}
|
|
197
|
-
if (entries !== entriesRef.current) {
|
|
263
|
+
if (entries !== entriesRef.current || separatorChanged) {
|
|
198
264
|
const anchor = captureCurrentAnchor();
|
|
199
265
|
const previousByKey = new Map(entriesRef.current.map((entry) => [entry.rowKey, entry]));
|
|
200
266
|
const changedRows = entries.filter((entry) => previousByKey.get(entry.rowKey)?.item !== entry.item);
|
|
@@ -210,7 +276,7 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
210
276
|
const listOffset = Math.max(0, scrollOffsetRef.current - headerHeightRef.current);
|
|
211
277
|
return virtualListRange(sizeIndexRef.current, listOffset, viewportHeightRef.current, viewportHeightRef.current);
|
|
212
278
|
}
|
|
213
|
-
function
|
|
279
|
+
function commitWindow() {
|
|
214
280
|
const next = currentRange();
|
|
215
281
|
const previous = rangeRef.current;
|
|
216
282
|
if (next.start !== previous.start || next.end !== previous.end || !sameSize(next.top, previous.top) || !sameSize(next.bottom, previous.bottom)) {
|
|
@@ -218,6 +284,29 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
218
284
|
setWindowVersion((version) => version + 1);
|
|
219
285
|
}
|
|
220
286
|
}
|
|
287
|
+
function refreshWindow() {
|
|
288
|
+
if (disposedRef.current || frameCancelRef.current != null) return;
|
|
289
|
+
frameCancelRef.current = scheduleListFrame(() => {
|
|
290
|
+
frameCancelRef.current = null;
|
|
291
|
+
if (disposedRef.current) return;
|
|
292
|
+
const measurements = [...measurementsRef.current.values()];
|
|
293
|
+
measurementsRef.current.clear();
|
|
294
|
+
for (const measurement of measurements) {
|
|
295
|
+
if (!cellsRef.current.isCurrent(measurement.cellId, measurement.entry.rowKey, measurement.generation)) continue;
|
|
296
|
+
const index = indexByRowKeyRef.current.get(measurement.entry.rowKey);
|
|
297
|
+
if (index === void 0 || entriesRef.current[index]?.item !== measurement.entry.item || entriesRef.current[index]?.index !== measurement.entry.index) continue;
|
|
298
|
+
if (measurement.view?.isLoaded === false) continue;
|
|
299
|
+
if (measurement.view?.isLayoutValid === false) {
|
|
300
|
+
measurementsRef.current.set(measurement.entry.rowKey, measurement);
|
|
301
|
+
refreshWindow();
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
const size = measurement.view?.getActualSize?.() ?? measurement;
|
|
305
|
+
if (size.width > 0 && size.height >= 0) recordRowSize(measurement.entry.rowKey, size.width, size.height);
|
|
306
|
+
}
|
|
307
|
+
commitWindow();
|
|
308
|
+
});
|
|
309
|
+
}
|
|
221
310
|
function captureAnchor() {
|
|
222
311
|
const listOffset = scrollOffsetRef.current - headerHeightRef.current;
|
|
223
312
|
if (listOffset < 0 || entriesRef.current.length === 0) return null;
|
|
@@ -232,39 +321,38 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
232
321
|
}
|
|
233
322
|
function captureCurrentAnchor() {
|
|
234
323
|
const nativeOffset = Number(scrollRef.current?.verticalOffset);
|
|
235
|
-
if (Number.isFinite(nativeOffset)) scrollOffsetRef.current = nativeOffset;
|
|
324
|
+
if (Number.isFinite(nativeOffset)) scrollOffsetRef.current = nativeOffset + pendingOffsetDeltaRef.current;
|
|
236
325
|
return captureAnchor();
|
|
237
326
|
}
|
|
238
327
|
function restoreAnchor(anchor) {
|
|
239
|
-
if (!anchor) return;
|
|
240
|
-
|
|
241
|
-
if (anchorRestoreScheduledRef.current) return;
|
|
328
|
+
if (!anchor || disposedRef.current) return;
|
|
329
|
+
const index = indexByRowKeyRef.current.get(anchor.rowKey);
|
|
242
330
|
const view = scrollRef.current;
|
|
243
|
-
if (!view) return;
|
|
331
|
+
if (index === void 0 || !view) return;
|
|
332
|
+
const nextOffset = Math.max(0, headerHeightRef.current + sizeIndexRef.current.prefix(index) + anchor.within);
|
|
333
|
+
const delta = nextOffset - scrollOffsetRef.current;
|
|
334
|
+
if (sameSize(delta, 0)) return;
|
|
335
|
+
pendingOffsetDeltaRef.current += delta;
|
|
336
|
+
scrollOffsetRef.current = nextOffset;
|
|
337
|
+
if (anchorRestoreScheduledRef.current) return;
|
|
244
338
|
anchorRestoreScheduledRef.current = true;
|
|
245
339
|
const timer = setTimeout(() => {
|
|
246
340
|
if (anchorRestoreTimerRef.current !== timer) return;
|
|
247
341
|
anchorRestoreTimerRef.current = null;
|
|
248
342
|
anchorRestoreScheduledRef.current = false;
|
|
249
|
-
if (scrollRef.current !== view) return;
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
if (!queuedAnchor) return;
|
|
253
|
-
const index = indexByRowKeyRef.current.get(queuedAnchor.rowKey);
|
|
254
|
-
if (index === void 0) return;
|
|
255
|
-
const nextOffset = Math.max(0, headerHeightRef.current + sizeIndexRef.current.prefix(index) + queuedAnchor.within);
|
|
343
|
+
if (disposedRef.current || scrollRef.current !== view) return;
|
|
344
|
+
const correction = pendingOffsetDeltaRef.current;
|
|
345
|
+
pendingOffsetDeltaRef.current = 0;
|
|
256
346
|
const nativeOffset = Number(view.verticalOffset);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
scrollOffsetRef.current = nextOffset;
|
|
347
|
+
const target = Math.max(0, nativeOffset + correction);
|
|
348
|
+
scrollOffsetRef.current = target;
|
|
349
|
+
if (sameSize(target, nativeOffset)) return;
|
|
262
350
|
const nativeView = view.nativeViewProtected;
|
|
263
351
|
const makePoint = globalThis.CGPointMake;
|
|
264
352
|
if (typeof nativeView?.setContentOffsetAnimated === "function" && typeof makePoint === "function") {
|
|
265
353
|
const current = nativeView.contentOffset;
|
|
266
|
-
nativeView.setContentOffsetAnimated(makePoint(current.x,
|
|
267
|
-
} else if (typeof view.scrollToVerticalOffset === "function") view.scrollToVerticalOffset(
|
|
354
|
+
nativeView.setContentOffsetAnimated(makePoint(current.x, target), false);
|
|
355
|
+
} else if (typeof view.scrollToVerticalOffset === "function") view.scrollToVerticalOffset(target, false);
|
|
268
356
|
}, 0);
|
|
269
357
|
anchorRestoreTimerRef.current = timer;
|
|
270
358
|
}
|
|
@@ -272,40 +360,62 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
272
360
|
if (anchorRestoreTimerRef.current != null) clearTimeout(anchorRestoreTimerRef.current);
|
|
273
361
|
anchorRestoreTimerRef.current = null;
|
|
274
362
|
anchorRestoreScheduledRef.current = false;
|
|
275
|
-
|
|
363
|
+
pendingOffsetDeltaRef.current = 0;
|
|
276
364
|
}
|
|
277
|
-
function scheduleEstimateRebuild(
|
|
278
|
-
if (
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const scheduledAnchor = estimateAnchorRef.current;
|
|
284
|
-
estimateAnchorRef.current = null;
|
|
365
|
+
function scheduleEstimateRebuild() {
|
|
366
|
+
if (estimateTimerRef.current != null) clearTimeout(estimateTimerRef.current);
|
|
367
|
+
estimateTimerRef.current = setTimeout(() => {
|
|
368
|
+
estimateTimerRef.current = null;
|
|
369
|
+
if (disposedRef.current || estimateDirtyTypesRef.current.size === 0) return;
|
|
370
|
+
const anchor = captureCurrentAnchor();
|
|
285
371
|
rebuildLayout(entriesRef.current, viewportWidthRef.current);
|
|
286
|
-
restoreAnchor(
|
|
372
|
+
restoreAnchor(anchor);
|
|
287
373
|
refreshWindow();
|
|
288
|
-
});
|
|
374
|
+
}, 120);
|
|
289
375
|
}
|
|
290
376
|
function recordRowSize(rowKey, width, height) {
|
|
291
377
|
if (!Number.isFinite(height) || height < 0) return;
|
|
292
378
|
const index = indexByRowKeyRef.current.get(rowKey);
|
|
293
379
|
if (index === void 0) return;
|
|
294
|
-
|
|
380
|
+
const entry = entriesRef.current[index];
|
|
381
|
+
if (!entry) return;
|
|
295
382
|
const hasRowSeparator = hasSeparatorRef.current && index < entriesRef.current.length - 1;
|
|
296
383
|
const cacheKey = virtualListMeasurementKey(rowKey, hasRowSeparator);
|
|
297
384
|
const pendingAnchor = pendingAnchorRowsRef.current.has(rowKey) ? pendingAnchorRef.current : null;
|
|
298
|
-
const
|
|
385
|
+
const previous = sizeCacheRef.current.get(cacheKey);
|
|
386
|
+
if (previous && sameSize(previous.width, width) && sameSize(previous.height, height) && sameSize(sizeIndexRef.current.get(index), height)) {
|
|
387
|
+
pendingAnchorRowsRef.current.delete(rowKey);
|
|
388
|
+
if (pendingAnchorRowsRef.current.size === 0) pendingAnchorRef.current = null;
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const anchor = pendingAnchor ?? captureCurrentAnchor();
|
|
299
392
|
sizeCacheRef.current.set(cacheKey, {
|
|
300
393
|
width,
|
|
301
394
|
height
|
|
302
395
|
});
|
|
396
|
+
const sample = typeSamplesRef.current.get(entry.typeKey) ?? {
|
|
397
|
+
sum: 0,
|
|
398
|
+
count: 0
|
|
399
|
+
};
|
|
400
|
+
sample.sum += height - (previous?.height ?? 0);
|
|
401
|
+
if (!previous) sample.count++;
|
|
402
|
+
typeSamplesRef.current.set(entry.typeKey, sample);
|
|
403
|
+
const applied = appliedEstimatesRef.current.get(entry.typeKey) ?? 48;
|
|
404
|
+
const estimateChanged = sample.count >= 4 && Math.abs(sample.sum / sample.count - applied) > Math.max(1, applied * .02);
|
|
303
405
|
const delta = sizeIndexRef.current.set(index, height);
|
|
304
406
|
if (Math.abs(delta) >= .5) {
|
|
305
407
|
const anchorIndex = anchor ? indexByRowKeyRef.current.get(anchor.rowKey) : void 0;
|
|
306
408
|
if (anchor && anchorIndex !== void 0 && index < anchorIndex) restoreAnchor(anchor);
|
|
307
|
-
|
|
308
|
-
|
|
409
|
+
}
|
|
410
|
+
if (estimateChanged) {
|
|
411
|
+
estimateDirtyTypesRef.current.add(entry.typeKey);
|
|
412
|
+
scheduleEstimateRebuild();
|
|
413
|
+
} else {
|
|
414
|
+
estimateDirtyTypesRef.current.delete(entry.typeKey);
|
|
415
|
+
if (estimateDirtyTypesRef.current.size === 0 && estimateTimerRef.current != null) {
|
|
416
|
+
clearTimeout(estimateTimerRef.current);
|
|
417
|
+
estimateTimerRef.current = null;
|
|
418
|
+
}
|
|
309
419
|
}
|
|
310
420
|
if (pendingAnchor) {
|
|
311
421
|
pendingAnchorRowsRef.current.delete(rowKey);
|
|
@@ -316,48 +426,123 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
316
426
|
if (!view) return;
|
|
317
427
|
const size = view.getActualSize?.();
|
|
318
428
|
if (!size) return;
|
|
429
|
+
const initialViewport = viewportHeightRef.current <= 0;
|
|
319
430
|
const widthChanged = !sameSize(size.width, viewportWidthRef.current);
|
|
320
431
|
viewportHeightRef.current = size.height;
|
|
321
432
|
if (widthChanged) {
|
|
322
|
-
const anchor =
|
|
433
|
+
const anchor = initialViewport ? null : captureCurrentAnchor();
|
|
323
434
|
viewportWidthRef.current = size.width;
|
|
324
435
|
rebuildLayout(entriesRef.current, size.width);
|
|
325
436
|
restoreAnchor(anchor);
|
|
326
437
|
}
|
|
327
|
-
|
|
438
|
+
if (initialViewport) commitWindow();
|
|
439
|
+
else refreshWindow();
|
|
328
440
|
}
|
|
329
441
|
function onScroll(event) {
|
|
330
442
|
const view = event.object ?? scrollRef.current;
|
|
331
443
|
const nextOffset = Number(view?.verticalOffset ?? 0);
|
|
332
|
-
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (anchorIndex !== void 0 && Math.abs(nextIndex - anchorIndex) > 1) cancelAnchorRestore();
|
|
444
|
+
if (Math.abs(nextOffset + pendingOffsetDeltaRef.current - scrollOffsetRef.current) > viewportHeightRef.current) cancelAnchorRestore();
|
|
445
|
+
if (!sameSize(nextOffset + pendingOffsetDeltaRef.current, scrollOffsetRef.current)) {
|
|
446
|
+
pendingAnchorRef.current = null;
|
|
447
|
+
pendingAnchorRowsRef.current.clear();
|
|
337
448
|
}
|
|
338
|
-
scrollOffsetRef.current = nextOffset;
|
|
449
|
+
scrollOffsetRef.current = nextOffset + pendingOffsetDeltaRef.current;
|
|
450
|
+
if (estimateTimerRef.current != null) scheduleEstimateRebuild();
|
|
451
|
+
refreshWindow();
|
|
452
|
+
}
|
|
453
|
+
function onContentLayout(event) {
|
|
454
|
+
const width = Number(event.object?.getActualSize?.().width ?? 0);
|
|
455
|
+
if (width <= 0 || sameSize(width, contentWidthRef.current)) return;
|
|
456
|
+
const anchor = scrollOffsetRef.current > 0 ? captureCurrentAnchor() : null;
|
|
457
|
+
contentWidthRef.current = width;
|
|
458
|
+
rebuildLayout(entriesRef.current, viewportWidthRef.current);
|
|
459
|
+
restoreAnchor(anchor);
|
|
339
460
|
refreshWindow();
|
|
340
461
|
}
|
|
341
462
|
function onHeaderLayout(event) {
|
|
342
463
|
const height = Number(event.object?.getActualSize?.().height ?? 0);
|
|
343
464
|
if (sameSize(height, headerHeightRef.current)) return;
|
|
344
|
-
const anchor =
|
|
465
|
+
const anchor = scrollOffsetRef.current > 0 ? captureCurrentAnchor() : null;
|
|
345
466
|
headerHeightRef.current = height;
|
|
346
467
|
restoreAnchor(anchor);
|
|
347
468
|
refreshWindow();
|
|
348
469
|
}
|
|
349
|
-
function
|
|
470
|
+
function cellCallback(id) {
|
|
471
|
+
let callback = cellCallbacksRef.current.get(id);
|
|
472
|
+
if (!callback) {
|
|
473
|
+
callback = (view) => {
|
|
474
|
+
if (view) {
|
|
475
|
+
view.reusable = true;
|
|
476
|
+
cellNodesRef.current.set(id, view);
|
|
477
|
+
} else {
|
|
478
|
+
cellNodesRef.current.get(id)?.destroyNode?.(true);
|
|
479
|
+
cellNodesRef.current.delete(id);
|
|
480
|
+
cellCallbacksRef.current.delete(id);
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
cellCallbacksRef.current.set(id, callback);
|
|
484
|
+
}
|
|
485
|
+
return callback;
|
|
486
|
+
}
|
|
487
|
+
function onRowLayout(cell, event) {
|
|
488
|
+
const entry = cell.entry;
|
|
350
489
|
const size = event.object?.getActualSize?.();
|
|
351
|
-
if (
|
|
490
|
+
if (!entry || !size || disposedRef.current) return;
|
|
491
|
+
measurementsRef.current.set(entry.rowKey, {
|
|
492
|
+
entry,
|
|
493
|
+
width: size.width,
|
|
494
|
+
height: size.height,
|
|
495
|
+
cellId: cell.id,
|
|
496
|
+
generation: cell.generation
|
|
497
|
+
});
|
|
498
|
+
refreshWindow();
|
|
352
499
|
}
|
|
500
|
+
useEffect(() => {
|
|
501
|
+
disposedRef.current = false;
|
|
502
|
+
return () => {
|
|
503
|
+
disposedRef.current = true;
|
|
504
|
+
frameCancelRef.current?.();
|
|
505
|
+
if (estimateTimerRef.current != null) clearTimeout(estimateTimerRef.current);
|
|
506
|
+
frameCancelRef.current = null;
|
|
507
|
+
estimateTimerRef.current = null;
|
|
508
|
+
measurementsRef.current.clear();
|
|
509
|
+
cellsRef.current.clear();
|
|
510
|
+
cellNodesRef.current.clear();
|
|
511
|
+
cellCallbacksRef.current.clear();
|
|
512
|
+
measuredAssignmentsRef.current.clear();
|
|
513
|
+
cancelAnchorRestore();
|
|
514
|
+
};
|
|
515
|
+
}, [], _h$30);
|
|
353
516
|
const range = currentRange();
|
|
354
517
|
rangeRef.current = range;
|
|
355
|
-
const
|
|
518
|
+
const cells = cellsRef.current.update(entries.slice(range.start, range.end)).map((cell) => ({
|
|
519
|
+
...cell,
|
|
520
|
+
top: cell.entry ? sizeIndexRef.current.prefix(cell.entry.index) : 0
|
|
521
|
+
}));
|
|
522
|
+
const contentHeight = sizeIndexRef.current.total;
|
|
523
|
+
useEffect(() => {
|
|
524
|
+
for (const cell of cells) {
|
|
525
|
+
if (!cell.entry || measuredAssignmentsRef.current.get(cell.id) === cell.generation) continue;
|
|
526
|
+
const view = cellNodesRef.current.get(cell.id);
|
|
527
|
+
if (!view) continue;
|
|
528
|
+
measuredAssignmentsRef.current.set(cell.id, cell.generation);
|
|
529
|
+
measurementsRef.current.set(cell.entry.rowKey, {
|
|
530
|
+
entry: cell.entry,
|
|
531
|
+
width: 0,
|
|
532
|
+
height: 0,
|
|
533
|
+
view,
|
|
534
|
+
cellId: cell.id,
|
|
535
|
+
generation: cell.generation
|
|
536
|
+
});
|
|
537
|
+
refreshWindow();
|
|
538
|
+
}
|
|
539
|
+
for (const id of measuredAssignmentsRef.current.keys()) if (!cellNodesRef.current.has(id)) measuredAssignmentsRef.current.delete(id);
|
|
540
|
+
}, [cells], _h$31);
|
|
356
541
|
const style = {
|
|
357
542
|
...props.style,
|
|
358
543
|
minHeight: props.style?.minHeight ?? 0
|
|
359
544
|
};
|
|
360
|
-
return universalValue(
|
|
545
|
+
return universalValue(__octaneUniversalPlan7, [
|
|
361
546
|
universalProps([
|
|
362
547
|
[
|
|
363
548
|
"set",
|
|
@@ -440,26 +625,25 @@ var VirtualList = defineUniversalComponent("nativescript", function VirtualList(
|
|
|
440
625
|
]
|
|
441
626
|
]),
|
|
442
627
|
cx("vx-virtual-list-content"),
|
|
628
|
+
onContentLayout,
|
|
443
629
|
props.renderHeader ? universalValue(__octaneUniversalPlan0, [onHeaderLayout, props.renderHeader()]) : null,
|
|
444
|
-
entries.length === 0 ? props.renderEmpty ? universalValue(__octaneUniversalPlan1, [props.renderEmpty()]) : null : universalValue(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
]),
|
|
462
|
-
props.renderFooter ? universalValue(__octaneUniversalPlan5, [props.renderFooter()]) : null
|
|
630
|
+
entries.length === 0 ? props.renderEmpty ? universalValue(__octaneUniversalPlan1, [props.renderEmpty()]) : null : universalValue(__octaneUniversalPlan5, [{
|
|
631
|
+
height: contentHeight,
|
|
632
|
+
flexShrink: 0
|
|
633
|
+
}, universalFor(cells, (cell, __octaneUniversalIndex) => cell.id, (cell, __octaneUniversalIndex) => {
|
|
634
|
+
return universalValue(__octaneUniversalPlan4, [
|
|
635
|
+
cellCallback(cell.id),
|
|
636
|
+
cell.entry ? "vx-virtual-list-cell vx-virtual-list-row" : "vx-virtual-list-cell",
|
|
637
|
+
cell.entry ? "visible" : "collapse",
|
|
638
|
+
cell.top,
|
|
639
|
+
contentWidthRef.current || viewportWidthRef.current || "100%",
|
|
640
|
+
(event) => onRowLayout(cell, event),
|
|
641
|
+
universalFor(cell.rows, (entry, __octaneUniversalIndex$) => entry.rowKey, (entry, __octaneUniversalIndex$) => {
|
|
642
|
+
return universalValue(__octaneUniversalPlan3, [props.renderItem(entry.item, entry.index), hasSeparator && entry.index < entries.length - 1 ? universalValue(__octaneUniversalPlan2, [props.renderSeparator?.()]) : null]);
|
|
643
|
+
})
|
|
644
|
+
]);
|
|
645
|
+
})]),
|
|
646
|
+
props.renderFooter ? universalValue(__octaneUniversalPlan6, [props.renderFooter()]) : null
|
|
463
647
|
]);
|
|
464
648
|
}, { "module": "@nativescript-community/octane" });
|
|
465
649
|
//#endregion
|
|
@@ -31,14 +31,23 @@ function reportContentLayout(view, props) {
|
|
|
31
31
|
view.style.height = height;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
function applyNativeScrollEnabled(view, enabled) {
|
|
35
|
+
if (isIOS) {
|
|
36
|
+
const scrollView = view?.ios?.scrollView;
|
|
37
|
+
if (scrollView) scrollView.scrollEnabled = enabled !== false;
|
|
38
|
+
} else if (isAndroid) {
|
|
39
|
+
const nativeView = view?.android;
|
|
40
|
+
if (!nativeView?.setOnTouchListener) return;
|
|
41
|
+
nativeView.setOnTouchListener(enabled === false ? new android.view.View.OnTouchListener({ onTouch: (_view, event) => event.getActionMasked() === android.view.MotionEvent.ACTION_MOVE }) : null);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
34
44
|
var WebView = defineUniversalComponent("nativescript", function WebView(props) {
|
|
35
45
|
const el = useRef(null, _h$0);
|
|
36
46
|
const loaded = useRef(false, _h$1);
|
|
37
47
|
useEffect(() => {
|
|
38
48
|
const v = el.current;
|
|
39
49
|
if (!v) return;
|
|
40
|
-
|
|
41
|
-
else if (isAndroid) v.android.setOnTouchListener(props.scrollEnabled === false ? new android.view.View.OnTouchListener({ onTouch: (_view, event) => event.getActionMasked() === android.view.MotionEvent.ACTION_MOVE }) : null);
|
|
50
|
+
applyNativeScrollEnabled(v, props.scrollEnabled);
|
|
42
51
|
if (props.matchContents && loaded.current) reportContentLayout(v, props);
|
|
43
52
|
}, [props.scrollEnabled, props.matchContents], _h$2);
|
|
44
53
|
return universalValue(__octaneUniversalPlan0, [universalProps([
|
|
@@ -79,10 +88,16 @@ var WebView = defineUniversalComponent("nativescript", function WebView(props) {
|
|
|
79
88
|
"src",
|
|
80
89
|
props.html !== void 0 ? props.html : props.src
|
|
81
90
|
],
|
|
91
|
+
[
|
|
92
|
+
"set",
|
|
93
|
+
"onLoaded",
|
|
94
|
+
() => applyNativeScrollEnabled(el.current, props.scrollEnabled)
|
|
95
|
+
],
|
|
82
96
|
[
|
|
83
97
|
"set",
|
|
84
98
|
"onLoadFinished",
|
|
85
99
|
(e) => {
|
|
100
|
+
applyNativeScrollEnabled(e.object ?? el.current, props.scrollEnabled);
|
|
86
101
|
if (e.error) props.onError?.({
|
|
87
102
|
url: e.url,
|
|
88
103
|
error: e.error
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/decorate.js
|
|
2
|
+
function __decorate(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { __decorate as default };
|