@nstudio/nativescript-effect-ui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/crash/index.d.ts +49 -0
- package/dist/crash/index.d.ts.map +1 -0
- package/dist/crash/index.js +199 -0
- package/dist/crash/index.js.map +1 -0
- package/dist/devtools/index.d.ts +77 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +158 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/keyboard/index.d.ts +97 -0
- package/dist/keyboard/index.d.ts.map +1 -0
- package/dist/keyboard/index.js +226 -0
- package/dist/keyboard/index.js.map +1 -0
- package/dist/list/index.d.ts +91 -0
- package/dist/list/index.d.ts.map +1 -0
- package/dist/list/index.js +192 -0
- package/dist/list/index.js.map +1 -0
- package/dist/macos/MacosHost.d.ts +77 -0
- package/dist/macos/MacosHost.d.ts.map +1 -0
- package/dist/macos/MacosHost.js +878 -0
- package/dist/macos/MacosHost.js.map +1 -0
- package/dist/macos/index.d.ts +5 -0
- package/dist/macos/index.d.ts.map +1 -0
- package/dist/macos/index.js +5 -0
- package/dist/macos/index.js.map +1 -0
- package/dist/macos/layout.d.ts +39 -0
- package/dist/macos/layout.d.ts.map +1 -0
- package/dist/macos/layout.js +226 -0
- package/dist/macos/layout.js.map +1 -0
- package/dist/macos/platform.d.ts +12 -0
- package/dist/macos/platform.d.ts.map +1 -0
- package/dist/macos/platform.js +103 -0
- package/dist/macos/platform.js.map +1 -0
- package/dist/macos/styles.d.ts +66 -0
- package/dist/macos/styles.d.ts.map +1 -0
- package/dist/macos/styles.js +350 -0
- package/dist/macos/styles.js.map +1 -0
- package/dist/mason/MasonHost.d.ts +102 -0
- package/dist/mason/MasonHost.d.ts.map +1 -0
- package/dist/mason/MasonHost.js +413 -0
- package/dist/mason/MasonHost.js.map +1 -0
- package/dist/mason/dialog.d.ts +23 -0
- package/dist/mason/dialog.d.ts.map +1 -0
- package/dist/mason/dialog.js +186 -0
- package/dist/mason/dialog.js.map +1 -0
- package/dist/mason/elements.d.ts +50 -0
- package/dist/mason/elements.d.ts.map +1 -0
- package/dist/mason/elements.js +194 -0
- package/dist/mason/elements.js.map +1 -0
- package/dist/mason/events.d.ts +37 -0
- package/dist/mason/events.d.ts.map +1 -0
- package/dist/mason/events.js +304 -0
- package/dist/mason/events.js.map +1 -0
- package/dist/mason/index.d.ts +6 -0
- package/dist/mason/index.d.ts.map +1 -0
- package/dist/mason/index.js +6 -0
- package/dist/mason/index.js.map +1 -0
- package/dist/mason/services.d.ts +36 -0
- package/dist/mason/services.d.ts.map +1 -0
- package/dist/mason/services.js +268 -0
- package/dist/mason/services.js.map +1 -0
- package/dist/mason/styles.d.ts +20 -0
- package/dist/mason/styles.d.ts.map +1 -0
- package/dist/mason/styles.js +269 -0
- package/dist/mason/styles.js.map +1 -0
- package/dist/motion/index.d.ts +179 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +332 -0
- package/dist/motion/index.js.map +1 -0
- package/dist/native/Native.d.ts +163 -0
- package/dist/native/Native.d.ts.map +1 -0
- package/dist/native/Native.js +144 -0
- package/dist/native/Native.js.map +1 -0
- package/dist/native/NativeCommand.d.ts +36 -0
- package/dist/native/NativeCommand.d.ts.map +1 -0
- package/dist/native/NativeCommand.js +38 -0
- package/dist/native/NativeCommand.js.map +1 -0
- package/dist/native/NativeHost.d.ts +46 -0
- package/dist/native/NativeHost.d.ts.map +1 -0
- package/dist/native/NativeHost.js +346 -0
- package/dist/native/NativeHost.js.map +1 -0
- package/dist/native/index.d.ts +4 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +4 -0
- package/dist/native/index.js.map +1 -0
- package/dist/platform/index.d.ts +86 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +131 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/native.d.ts +12 -0
- package/dist/platform/native.d.ts.map +1 -0
- package/dist/platform/native.js +127 -0
- package/dist/platform/native.js.map +1 -0
- package/dist/sheet/index.d.ts +113 -0
- package/dist/sheet/index.d.ts.map +1 -0
- package/dist/sheet/index.js +202 -0
- package/dist/sheet/index.js.map +1 -0
- package/dist/testing/MockMasonHost.d.ts +48 -0
- package/dist/testing/MockMasonHost.d.ts.map +1 -0
- package/dist/testing/MockMasonHost.js +142 -0
- package/dist/testing/MockMasonHost.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +116 -3
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native keyboard height/phase `Subscription` and docked composer helpers for
|
|
3
|
+
* `@nstudio/nativescript-effect-ui`: zero plugins.
|
|
4
|
+
*
|
|
5
|
+
* - **iOS:** Subscribes directly to `NSNotificationCenter.defaultCenter`
|
|
6
|
+
* (`UIKeyboardWillChangeFrameNotification` / `UIKeyboardWillHideNotification`).
|
|
7
|
+
* - **Android:** Reads real IME insets via `androidx.core.view.ViewCompat`
|
|
8
|
+
* (`WindowInsetsCompat.Type.ime()`), converting pixels to DIPs.
|
|
9
|
+
* - **Tests:** `makeTestKeyboardLayer()` provides deterministic `.emit(...)`
|
|
10
|
+
* driving `Keyboard.watch(...)` in Node Vitest.
|
|
11
|
+
*/
|
|
12
|
+
import * as Command from '@effect/ui/Command';
|
|
13
|
+
import * as Component from '@effect/ui/Component';
|
|
14
|
+
import * as Subscription from '@effect/ui/Subscription';
|
|
15
|
+
import * as Context from 'effect/Context';
|
|
16
|
+
import * as Effect from 'effect/Effect';
|
|
17
|
+
import * as Layer from 'effect/Layer';
|
|
18
|
+
import * as Schema from 'effect/Schema';
|
|
19
|
+
import * as Stream from 'effect/Stream';
|
|
20
|
+
export declare const KeyboardPhase: Schema.Literals<readonly ["hidden", "showing", "visible", "hiding"]>;
|
|
21
|
+
export type KeyboardPhase = typeof KeyboardPhase.Type;
|
|
22
|
+
export declare const KeyboardState: Schema.Struct<{
|
|
23
|
+
readonly visible: Schema.Boolean;
|
|
24
|
+
readonly height: Schema.Number;
|
|
25
|
+
readonly durationMs: Schema.Number;
|
|
26
|
+
readonly phase: Schema.Literals<readonly ["hidden", "showing", "visible", "hiding"]>;
|
|
27
|
+
}>;
|
|
28
|
+
export type KeyboardState = typeof KeyboardState.Type;
|
|
29
|
+
export declare const initialKeyboardState: KeyboardState;
|
|
30
|
+
export interface KeyboardServiceShape {
|
|
31
|
+
readonly current: Effect.Effect<KeyboardState>;
|
|
32
|
+
readonly changes: Stream.Stream<KeyboardState>;
|
|
33
|
+
readonly dismiss: Effect.Effect<void>;
|
|
34
|
+
}
|
|
35
|
+
declare const Keyboard_base: Context.ServiceClass<Keyboard, "@nstudio/nativescript-effect-ui/Keyboard", KeyboardServiceShape>;
|
|
36
|
+
/**
|
|
37
|
+
* Host-agnostic Effect `Context.Service` for keyboard visibility, height,
|
|
38
|
+
* animation duration, and programmatic dismissal.
|
|
39
|
+
*/
|
|
40
|
+
export declare class Keyboard extends Keyboard_base {
|
|
41
|
+
}
|
|
42
|
+
declare const DismissKeyboard_base: Command.Service<DismissKeyboard, "Keyboard/Dismiss", {}, Component.NoopSchema, false, Schema.Never, never>;
|
|
43
|
+
/**
|
|
44
|
+
* Effect UI `Command.Service` that dismisses the native software keyboard.
|
|
45
|
+
*/
|
|
46
|
+
export declare class DismissKeyboard extends DismissKeyboard_base {
|
|
47
|
+
static readonly layer: Layer.Layer<DismissKeyboard, never, Keyboard>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Effect UI `Subscription` streaming native keyboard state transitions to your
|
|
51
|
+
* component's `update` handler.
|
|
52
|
+
*/
|
|
53
|
+
export declare const watchKeyboard: <Msg>(toMessage: (state: KeyboardState) => Msg) => Subscription.Subscription<Msg, Keyboard>;
|
|
54
|
+
/**
|
|
55
|
+
* Computes docked composer styles so an input bar sits cleanly above the
|
|
56
|
+
* active keyboard (or resting safe-area inset when hidden).
|
|
57
|
+
*/
|
|
58
|
+
export declare function dockedComposerStyle(state: KeyboardState, restingBottomInset?: number): {
|
|
59
|
+
readonly marginBottom: number;
|
|
60
|
+
readonly paddingBottom: number;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Creates a live NativeScript `Keyboard` Layer using direct iOS
|
|
64
|
+
* `NSNotificationCenter` and Android `WindowInsetsCompat.Type.ime()` APIs.
|
|
65
|
+
*/
|
|
66
|
+
export declare const KeyboardNativeLayer: Layer.Layer<Keyboard>;
|
|
67
|
+
/**
|
|
68
|
+
* Deterministic in-memory `Keyboard` test Layer for Node Vitest suites.
|
|
69
|
+
*/
|
|
70
|
+
export declare function makeTestKeyboardLayer(): {
|
|
71
|
+
readonly layer: Layer.Layer<Keyboard>;
|
|
72
|
+
readonly emit: (state: KeyboardState) => void;
|
|
73
|
+
readonly getDismissCount: () => number;
|
|
74
|
+
};
|
|
75
|
+
export declare const NativeKeyboard: {
|
|
76
|
+
readonly Keyboard: typeof Keyboard;
|
|
77
|
+
readonly KeyboardPhase: Schema.Literals<readonly ["hidden", "showing", "visible", "hiding"]>;
|
|
78
|
+
readonly KeyboardState: Schema.Struct<{
|
|
79
|
+
readonly visible: Schema.Boolean;
|
|
80
|
+
readonly height: Schema.Number;
|
|
81
|
+
readonly durationMs: Schema.Number;
|
|
82
|
+
readonly phase: Schema.Literals<readonly ["hidden", "showing", "visible", "hiding"]>;
|
|
83
|
+
}>;
|
|
84
|
+
readonly initialKeyboardState: {
|
|
85
|
+
readonly visible: boolean;
|
|
86
|
+
readonly height: number;
|
|
87
|
+
readonly durationMs: number;
|
|
88
|
+
readonly phase: "hidden" | "visible" | "showing" | "hiding";
|
|
89
|
+
};
|
|
90
|
+
readonly DismissKeyboard: typeof DismissKeyboard;
|
|
91
|
+
readonly watchKeyboard: <Msg>(toMessage: (state: KeyboardState) => Msg) => Subscription.Subscription<Msg, Keyboard>;
|
|
92
|
+
readonly dockedComposerStyle: typeof dockedComposerStyle;
|
|
93
|
+
readonly KeyboardNativeLayer: Layer.Layer<Keyboard, never, never>;
|
|
94
|
+
readonly makeTestKeyboardLayer: typeof makeTestKeyboardLayer;
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyboard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,aAAa,sEAA8D,CAAC;AACzF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AAEtD,eAAO,MAAM,aAAa;;;;;EAKxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AAEtD,eAAO,MAAM,oBAAoB,EAAE,aAKlC,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC/C,QAAQ,CAA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|
+
* - **iOS:** Subscribes directly to `NSNotificationCenter.defaultCenter`
|
|
6
|
+
* (`UIKeyboardWillChangeFrameNotification` / `UIKeyboardWillHideNotification`).
|
|
7
|
+
* - **Android:** Reads real IME insets via `androidx.core.view.ViewCompat`
|
|
8
|
+
* (`WindowInsetsCompat.Type.ime()`), converting pixels to DIPs.
|
|
9
|
+
* - **Tests:** `makeTestKeyboardLayer()` provides deterministic `.emit(...)`
|
|
10
|
+
* driving `Keyboard.watch(...)` in Node Vitest.
|
|
11
|
+
*/
|
|
12
|
+
import * as Command from '@effect/ui/Command';
|
|
13
|
+
import * as Component from '@effect/ui/Component';
|
|
14
|
+
import * as Subscription from '@effect/ui/Subscription';
|
|
15
|
+
import * as Context from 'effect/Context';
|
|
16
|
+
import * as Effect from 'effect/Effect';
|
|
17
|
+
import * as Layer from 'effect/Layer';
|
|
18
|
+
import * as Queue from 'effect/Queue';
|
|
19
|
+
import * as Schema from 'effect/Schema';
|
|
20
|
+
import * as Stream from 'effect/Stream';
|
|
21
|
+
export const KeyboardPhase = Schema.Literals(['hidden', 'showing', 'visible', 'hiding']);
|
|
22
|
+
export const KeyboardState = Schema.Struct({
|
|
23
|
+
visible: Schema.Boolean,
|
|
24
|
+
height: Schema.Number,
|
|
25
|
+
durationMs: Schema.Number,
|
|
26
|
+
phase: KeyboardPhase,
|
|
27
|
+
});
|
|
28
|
+
export const initialKeyboardState = {
|
|
29
|
+
visible: false,
|
|
30
|
+
height: 0,
|
|
31
|
+
durationMs: 0,
|
|
32
|
+
phase: 'hidden',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Host-agnostic Effect `Context.Service` for keyboard visibility, height,
|
|
36
|
+
* animation duration, and programmatic dismissal.
|
|
37
|
+
*/
|
|
38
|
+
export class Keyboard extends Context.Service()('@nstudio/nativescript-effect-ui/Keyboard') {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Effect UI `Command.Service` that dismisses the native software keyboard.
|
|
42
|
+
*/
|
|
43
|
+
export class DismissKeyboard extends Command.Service()('Keyboard/Dismiss', {
|
|
44
|
+
args: {},
|
|
45
|
+
success: Component.Noop,
|
|
46
|
+
}) {
|
|
47
|
+
static layer = this.toLayer(Effect.gen(function* () {
|
|
48
|
+
const kb = yield* Keyboard;
|
|
49
|
+
return () => kb.dismiss.pipe(Effect.as(Component.noop));
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Effect UI `Subscription` streaming native keyboard state transitions to your
|
|
54
|
+
* component's `update` handler.
|
|
55
|
+
*/
|
|
56
|
+
export const watchKeyboard = (toMessage) => Subscription.make('Keyboard/watch', null, () => Stream.unwrap(Effect.gen(function* () {
|
|
57
|
+
const kb = yield* Keyboard;
|
|
58
|
+
return Stream.map(kb.changes, toMessage);
|
|
59
|
+
})));
|
|
60
|
+
/**
|
|
61
|
+
* Computes docked composer styles so an input bar sits cleanly above the
|
|
62
|
+
* active keyboard (or resting safe-area inset when hidden).
|
|
63
|
+
*/
|
|
64
|
+
export function dockedComposerStyle(state, restingBottomInset = 12) {
|
|
65
|
+
const bottom = state.visible ? Math.max(0, Math.round(state.height)) : restingBottomInset;
|
|
66
|
+
return {
|
|
67
|
+
marginBottom: bottom,
|
|
68
|
+
paddingBottom: state.visible ? 8 : 12,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a live NativeScript `Keyboard` Layer using direct iOS
|
|
73
|
+
* `NSNotificationCenter` and Android `WindowInsetsCompat.Type.ime()` APIs.
|
|
74
|
+
*/
|
|
75
|
+
export const KeyboardNativeLayer = Layer.sync(Keyboard, () => {
|
|
76
|
+
let latest = initialKeyboardState;
|
|
77
|
+
const dismiss = Effect.sync(() => {
|
|
78
|
+
try {
|
|
79
|
+
if (typeof __APPLE__ !== 'undefined' && __APPLE__) {
|
|
80
|
+
UIApplication.sharedApplication.sendActionToFromForEvent('resignFirstResponder', null, null, null);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (typeof __ANDROID__ !== 'undefined' && __ANDROID__) {
|
|
84
|
+
// Lazy-import `@nativescript/core` only when running on native Android.
|
|
85
|
+
void import('@nativescript/core').then(({ Application, Utils }) => {
|
|
86
|
+
const activity = Application.android?.foregroundActivity ?? Application.android?.startActivity;
|
|
87
|
+
const focus = activity?.getCurrentFocus?.();
|
|
88
|
+
const imm = Utils.android
|
|
89
|
+
.getApplicationContext()
|
|
90
|
+
?.getSystemService(android.content.Context.INPUT_METHOD_SERVICE);
|
|
91
|
+
if (focus && imm) {
|
|
92
|
+
imm.hideSoftInputFromWindow(focus.getWindowToken(), 0);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Ignore on simulator / unavailable native window.
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const changes = Stream.callback((queue) => Effect.gen(function* () {
|
|
102
|
+
const push = (next) => {
|
|
103
|
+
latest = next;
|
|
104
|
+
Queue.offerUnsafe(queue, next);
|
|
105
|
+
};
|
|
106
|
+
if (typeof __APPLE__ !== 'undefined' && __APPLE__) {
|
|
107
|
+
const center = NSNotificationCenter.defaultCenter;
|
|
108
|
+
const onFrameChange = (notification) => {
|
|
109
|
+
try {
|
|
110
|
+
const info = notification.userInfo;
|
|
111
|
+
const endValue = info?.objectForKey(UIKeyboardFrameEndUserInfoKey);
|
|
112
|
+
const durValue = info?.objectForKey(UIKeyboardAnimationDurationUserInfoKey);
|
|
113
|
+
const screenH = UIScreen.mainScreen.bounds.size.height;
|
|
114
|
+
const endRect = endValue?.CGRectValue;
|
|
115
|
+
const height = endRect ? Math.max(0, Math.round(screenH - endRect.origin.y)) : 0;
|
|
116
|
+
const durationMs = durValue ? Math.round(durValue.doubleValue * 1000) : 250;
|
|
117
|
+
push({
|
|
118
|
+
visible: height > 0,
|
|
119
|
+
height,
|
|
120
|
+
durationMs,
|
|
121
|
+
phase: height > 0 ? 'visible' : 'hidden',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Ignore malformed notification payload.
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const showObs = center.addObserverForNameObjectQueueUsingBlock(UIKeyboardWillChangeFrameNotification, null, NSOperationQueue.mainQueue, onFrameChange);
|
|
129
|
+
const hideObs = center.addObserverForNameObjectQueueUsingBlock(UIKeyboardWillHideNotification, null, NSOperationQueue.mainQueue, () => {
|
|
130
|
+
push({ visible: false, height: 0, durationMs: 250, phase: 'hidden' });
|
|
131
|
+
});
|
|
132
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
133
|
+
center.removeObserver(showObs);
|
|
134
|
+
center.removeObserver(hideObs);
|
|
135
|
+
}));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (typeof __ANDROID__ !== 'undefined' && __ANDROID__) {
|
|
139
|
+
const { Application, Utils } = yield* Effect.promise(() => import('@nativescript/core'));
|
|
140
|
+
const activity = Application.android?.foregroundActivity ?? Application.android?.startActivity;
|
|
141
|
+
const decorView = activity?.getWindow?.()?.getDecorView?.();
|
|
142
|
+
if (decorView && typeof androidx !== 'undefined') {
|
|
143
|
+
const listener = new androidx.core.view.OnApplyWindowInsetsListener({
|
|
144
|
+
onApplyWindowInsets(v, insets) {
|
|
145
|
+
try {
|
|
146
|
+
const imeType = androidx.core.view.WindowInsetsCompat.Type.ime();
|
|
147
|
+
const visible = insets.isVisible(imeType);
|
|
148
|
+
const px = insets.getInsets(imeType).bottom;
|
|
149
|
+
const height = visible
|
|
150
|
+
? Math.max(0, Math.round(Utils.layout.toDeviceIndependentPixels(px)))
|
|
151
|
+
: 0;
|
|
152
|
+
push({
|
|
153
|
+
visible,
|
|
154
|
+
height,
|
|
155
|
+
durationMs: 220,
|
|
156
|
+
phase: visible ? 'visible' : 'hidden',
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
// Ignore insets read failure.
|
|
161
|
+
}
|
|
162
|
+
return androidx.core.view.ViewCompat.onApplyWindowInsets(v, insets);
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(decorView, listener);
|
|
166
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
167
|
+
androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(decorView, null);
|
|
168
|
+
}));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
172
|
+
return {
|
|
173
|
+
current: Effect.sync(() => latest),
|
|
174
|
+
changes,
|
|
175
|
+
dismiss,
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* Deterministic in-memory `Keyboard` test Layer for Node Vitest suites.
|
|
180
|
+
*/
|
|
181
|
+
export function makeTestKeyboardLayer() {
|
|
182
|
+
let latest = initialKeyboardState;
|
|
183
|
+
let dismissCount = 0;
|
|
184
|
+
const listeners = new Set();
|
|
185
|
+
const emit = (state) => {
|
|
186
|
+
latest = state;
|
|
187
|
+
for (const listener of listeners) {
|
|
188
|
+
listener(state);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const layer = Layer.succeed(Keyboard, {
|
|
192
|
+
current: Effect.sync(() => latest),
|
|
193
|
+
changes: Stream.callback((queue) => Effect.gen(function* () {
|
|
194
|
+
const listener = (state) => {
|
|
195
|
+
Queue.offerUnsafe(queue, state);
|
|
196
|
+
};
|
|
197
|
+
listeners.add(listener);
|
|
198
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => {
|
|
199
|
+
listeners.delete(listener);
|
|
200
|
+
}));
|
|
201
|
+
})),
|
|
202
|
+
dismiss: Effect.sync(() => {
|
|
203
|
+
dismissCount += 1;
|
|
204
|
+
if (latest.visible) {
|
|
205
|
+
emit({ visible: false, height: 0, durationMs: 0, phase: 'hidden' });
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
});
|
|
209
|
+
return {
|
|
210
|
+
layer,
|
|
211
|
+
emit,
|
|
212
|
+
getDismissCount: () => dismissCount,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
export const NativeKeyboard = {
|
|
216
|
+
Keyboard,
|
|
217
|
+
KeyboardPhase,
|
|
218
|
+
KeyboardState,
|
|
219
|
+
initialKeyboardState,
|
|
220
|
+
DismissKeyboard,
|
|
221
|
+
watchKeyboard,
|
|
222
|
+
dockedComposerStyle,
|
|
223
|
+
KeyboardNativeLayer,
|
|
224
|
+
makeTestKeyboardLayer,
|
|
225
|
+
};
|
|
226
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keyboard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGzF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM;IACzB,KAAK,EAAE,a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SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAC9B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACf,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC7B,CAAC,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CACH;QACD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACxB,YAAY,IAAI,CAAC,CAAC;YAClB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YACtE,CAAC;QACH,CAAC,CAAC;KACH,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,IAAI;QACJ,eAAe,EAAE,GAAG,EAAE,CAAC,YAAY;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,QAAQ;IACR,aAAa;IACb,aAAa;IACb,oBAAoB;IACpB,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;CACb,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-agnostic slot-recycled `VirtualList` for `@nstudio/nativescript-effect-ui`.
|
|
3
|
+
*
|
|
4
|
+
* Works identically across `MasonHost`, `NativeHost`, and `BrowserHost`:
|
|
5
|
+
* - Keeps a small bounded window of visible + overscan rows in the Effect UI Model.
|
|
6
|
+
* - Supports variable measured row heights (`measureHeight`).
|
|
7
|
+
* - When `recycle: true`, keys rows by `slot = index % poolSize` so scrolling
|
|
8
|
+
* through 1,000+ items reuses the exact same native views with **zero native
|
|
9
|
+
* view allocations** after initial fill.
|
|
10
|
+
* - Returns the exact same Model reference when the visible window has not
|
|
11
|
+
* moved (`scrolled`), so Effect UI skips re-rendering completely on quiet ticks.
|
|
12
|
+
*/
|
|
13
|
+
import * as Schema from 'effect/Schema';
|
|
14
|
+
export declare const VirtualListModel: Schema.Struct<{
|
|
15
|
+
readonly totalCount: Schema.Number;
|
|
16
|
+
readonly viewportHeight: Schema.Number;
|
|
17
|
+
readonly estimatedItemHeight: Schema.Number;
|
|
18
|
+
readonly overscanPx: Schema.Number;
|
|
19
|
+
readonly scrollOffset: Schema.Number;
|
|
20
|
+
readonly startIndex: Schema.Number;
|
|
21
|
+
readonly endIndex: Schema.Number;
|
|
22
|
+
readonly poolSize: Schema.Number;
|
|
23
|
+
readonly recycle: Schema.Boolean;
|
|
24
|
+
readonly measuredHeights: Schema.$Record<Schema.String, Schema.Number>;
|
|
25
|
+
}>;
|
|
26
|
+
export type VirtualListModel = typeof VirtualListModel.Type;
|
|
27
|
+
export interface VirtualListInitOptions {
|
|
28
|
+
readonly totalCount: number;
|
|
29
|
+
readonly viewportHeight?: number | undefined;
|
|
30
|
+
readonly estimatedItemHeight?: number | undefined;
|
|
31
|
+
readonly overscanPx?: number | undefined;
|
|
32
|
+
readonly recycle?: boolean | undefined;
|
|
33
|
+
}
|
|
34
|
+
export interface VirtualWindow<A> {
|
|
35
|
+
readonly startIndex: number;
|
|
36
|
+
readonly endIndex: number;
|
|
37
|
+
readonly totalHeight: number;
|
|
38
|
+
readonly topSpacerPx: number;
|
|
39
|
+
readonly bottomSpacerPx: number;
|
|
40
|
+
readonly visibleItems: ReadonlyArray<{
|
|
41
|
+
readonly index: number;
|
|
42
|
+
readonly key: string;
|
|
43
|
+
readonly slot: number;
|
|
44
|
+
readonly offsetY: number;
|
|
45
|
+
readonly height: number;
|
|
46
|
+
readonly item: A;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Initializes a `VirtualListModel` ready for 1,000+ rows.
|
|
51
|
+
*/
|
|
52
|
+
export declare function init(options: VirtualListInitOptions): VirtualListModel;
|
|
53
|
+
/**
|
|
54
|
+
* Updates the scroll offset and recalculates the visible window.
|
|
55
|
+
*
|
|
56
|
+
* Returns the **exact same object reference** when `[startIndex, endIndex]` is
|
|
57
|
+
* unchanged, allowing Effect UI to skip view reconciliation completely.
|
|
58
|
+
*/
|
|
59
|
+
export declare function scrolled(model: VirtualListModel, scrollOffset: number): VirtualListModel;
|
|
60
|
+
/**
|
|
61
|
+
* Records a measured native layout height for an item index.
|
|
62
|
+
*/
|
|
63
|
+
export declare function measureHeight(model: VirtualListModel, index: number, height: number): VirtualListModel;
|
|
64
|
+
/**
|
|
65
|
+
* Updates total item count (e.g. after filtering or appending rows).
|
|
66
|
+
*/
|
|
67
|
+
export declare function setCount(model: VirtualListModel, totalCount: number): VirtualListModel;
|
|
68
|
+
/**
|
|
69
|
+
* Computes spacer heights and slot-recycled visible items for the current window.
|
|
70
|
+
*/
|
|
71
|
+
export declare function computeWindow<A>(model: VirtualListModel, items: ReadonlyArray<A>): VirtualWindow<A>;
|
|
72
|
+
export declare const VirtualList: {
|
|
73
|
+
readonly VirtualListModel: Schema.Struct<{
|
|
74
|
+
readonly totalCount: Schema.Number;
|
|
75
|
+
readonly viewportHeight: Schema.Number;
|
|
76
|
+
readonly estimatedItemHeight: Schema.Number;
|
|
77
|
+
readonly overscanPx: Schema.Number;
|
|
78
|
+
readonly scrollOffset: Schema.Number;
|
|
79
|
+
readonly startIndex: Schema.Number;
|
|
80
|
+
readonly endIndex: Schema.Number;
|
|
81
|
+
readonly poolSize: Schema.Number;
|
|
82
|
+
readonly recycle: Schema.Boolean;
|
|
83
|
+
readonly measuredHeights: Schema.$Record<Schema.String, Schema.Number>;
|
|
84
|
+
}>;
|
|
85
|
+
readonly init: typeof init;
|
|
86
|
+
readonly scrolled: typeof scrolled;
|
|
87
|
+
readonly measureHeight: typeof measureHeight;
|
|
88
|
+
readonly setCount: typeof setCount;
|
|
89
|
+
readonly computeWindow: typeof computeWindow;
|
|
90
|
+
};
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sDD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,sBAAsB,GAAG,gBAAgB,CAwBtE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,GAAG,gBAAgB,CAoBxF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,gBAAgB,CAmBlB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAiBtF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GACtB,aAAa,CAAC,CAAC,CAAC,CA2DlB;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CAOd,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-agnostic slot-recycled `VirtualList` for `@nstudio/nativescript-effect-ui`.
|
|
3
|
+
*
|
|
4
|
+
* Works identically across `MasonHost`, `NativeHost`, and `BrowserHost`:
|
|
5
|
+
* - Keeps a small bounded window of visible + overscan rows in the Effect UI Model.
|
|
6
|
+
* - Supports variable measured row heights (`measureHeight`).
|
|
7
|
+
* - When `recycle: true`, keys rows by `slot = index % poolSize` so scrolling
|
|
8
|
+
* through 1,000+ items reuses the exact same native views with **zero native
|
|
9
|
+
* view allocations** after initial fill.
|
|
10
|
+
* - Returns the exact same Model reference when the visible window has not
|
|
11
|
+
* moved (`scrolled`), so Effect UI skips re-rendering completely on quiet ticks.
|
|
12
|
+
*/
|
|
13
|
+
import * as Schema from 'effect/Schema';
|
|
14
|
+
export const VirtualListModel = Schema.Struct({
|
|
15
|
+
totalCount: Schema.Number,
|
|
16
|
+
viewportHeight: Schema.Number,
|
|
17
|
+
estimatedItemHeight: Schema.Number,
|
|
18
|
+
overscanPx: Schema.Number,
|
|
19
|
+
scrollOffset: Schema.Number,
|
|
20
|
+
startIndex: Schema.Number,
|
|
21
|
+
endIndex: Schema.Number,
|
|
22
|
+
poolSize: Schema.Number,
|
|
23
|
+
recycle: Schema.Boolean,
|
|
24
|
+
measuredHeights: Schema.Record(Schema.String, Schema.Number),
|
|
25
|
+
});
|
|
26
|
+
function heightOf(index, measured, estimated) {
|
|
27
|
+
const h = measured[String(index)];
|
|
28
|
+
return h !== undefined && h > 0 ? h : estimated;
|
|
29
|
+
}
|
|
30
|
+
function computeRange(totalCount, scrollOffset, viewportHeight, overscanPx, estimatedItemHeight, measuredHeights) {
|
|
31
|
+
if (totalCount <= 0) {
|
|
32
|
+
return { startIndex: 0, endIndex: -1, poolSize: 0 };
|
|
33
|
+
}
|
|
34
|
+
const minY = Math.max(0, scrollOffset - overscanPx);
|
|
35
|
+
const maxY = scrollOffset + Math.max(1, viewportHeight) + overscanPx;
|
|
36
|
+
let y = 0;
|
|
37
|
+
let startIndex = 0;
|
|
38
|
+
let foundStart = false;
|
|
39
|
+
let endIndex = totalCount - 1;
|
|
40
|
+
for (let i = 0; i < totalCount; i++) {
|
|
41
|
+
const h = heightOf(i, measuredHeights, estimatedItemHeight);
|
|
42
|
+
const nextY = y + h;
|
|
43
|
+
if (!foundStart && nextY >= minY) {
|
|
44
|
+
startIndex = i;
|
|
45
|
+
foundStart = true;
|
|
46
|
+
}
|
|
47
|
+
if (foundStart && y > maxY) {
|
|
48
|
+
endIndex = Math.max(startIndex, i - 1);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
y = nextY;
|
|
52
|
+
}
|
|
53
|
+
const visibleSpan = endIndex - startIndex + 1;
|
|
54
|
+
const maxPool = Math.ceil((viewportHeight + overscanPx * 2) / Math.max(1, estimatedItemHeight)) + 4;
|
|
55
|
+
return {
|
|
56
|
+
startIndex,
|
|
57
|
+
endIndex,
|
|
58
|
+
poolSize: Math.max(visibleSpan, maxPool),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Initializes a `VirtualListModel` ready for 1,000+ rows.
|
|
63
|
+
*/
|
|
64
|
+
export function init(options) {
|
|
65
|
+
const viewportHeight = Math.max(1, options.viewportHeight ?? 640);
|
|
66
|
+
const estimatedItemHeight = Math.max(1, options.estimatedItemHeight ?? 68);
|
|
67
|
+
const overscanPx = Math.max(0, options.overscanPx ?? 320);
|
|
68
|
+
const range = computeRange(options.totalCount, 0, viewportHeight, overscanPx, estimatedItemHeight, {});
|
|
69
|
+
return {
|
|
70
|
+
totalCount: options.totalCount,
|
|
71
|
+
viewportHeight,
|
|
72
|
+
estimatedItemHeight,
|
|
73
|
+
overscanPx,
|
|
74
|
+
scrollOffset: 0,
|
|
75
|
+
startIndex: range.startIndex,
|
|
76
|
+
endIndex: range.endIndex,
|
|
77
|
+
poolSize: range.poolSize,
|
|
78
|
+
recycle: options.recycle ?? true,
|
|
79
|
+
measuredHeights: {},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Updates the scroll offset and recalculates the visible window.
|
|
84
|
+
*
|
|
85
|
+
* Returns the **exact same object reference** when `[startIndex, endIndex]` is
|
|
86
|
+
* unchanged, allowing Effect UI to skip view reconciliation completely.
|
|
87
|
+
*/
|
|
88
|
+
export function scrolled(model, scrollOffset) {
|
|
89
|
+
const clamped = Math.max(0, scrollOffset);
|
|
90
|
+
const range = computeRange(model.totalCount, clamped, model.viewportHeight, model.overscanPx, model.estimatedItemHeight, model.measuredHeights);
|
|
91
|
+
if (range.startIndex === model.startIndex && range.endIndex === model.endIndex) {
|
|
92
|
+
return model;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...model,
|
|
96
|
+
scrollOffset: clamped,
|
|
97
|
+
startIndex: range.startIndex,
|
|
98
|
+
endIndex: range.endIndex,
|
|
99
|
+
poolSize: Math.max(model.poolSize, range.poolSize),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Records a measured native layout height for an item index.
|
|
104
|
+
*/
|
|
105
|
+
export function measureHeight(model, index, height) {
|
|
106
|
+
const rounded = Math.max(1, Math.round(height));
|
|
107
|
+
if (model.measuredHeights[String(index)] === rounded)
|
|
108
|
+
return model;
|
|
109
|
+
const nextMeasured = { ...model.measuredHeights, [String(index)]: rounded };
|
|
110
|
+
const range = computeRange(model.totalCount, model.scrollOffset, model.viewportHeight, model.overscanPx, model.estimatedItemHeight, nextMeasured);
|
|
111
|
+
return {
|
|
112
|
+
...model,
|
|
113
|
+
measuredHeights: nextMeasured,
|
|
114
|
+
startIndex: range.startIndex,
|
|
115
|
+
endIndex: range.endIndex,
|
|
116
|
+
poolSize: Math.max(model.poolSize, range.poolSize),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Updates total item count (e.g. after filtering or appending rows).
|
|
121
|
+
*/
|
|
122
|
+
export function setCount(model, totalCount) {
|
|
123
|
+
if (totalCount === model.totalCount)
|
|
124
|
+
return model;
|
|
125
|
+
const range = computeRange(totalCount, model.scrollOffset, model.viewportHeight, model.overscanPx, model.estimatedItemHeight, model.measuredHeights);
|
|
126
|
+
return {
|
|
127
|
+
...model,
|
|
128
|
+
totalCount,
|
|
129
|
+
startIndex: range.startIndex,
|
|
130
|
+
endIndex: range.endIndex,
|
|
131
|
+
poolSize: Math.max(model.poolSize, range.poolSize),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Computes spacer heights and slot-recycled visible items for the current window.
|
|
136
|
+
*/
|
|
137
|
+
export function computeWindow(model, items) {
|
|
138
|
+
const count = Math.min(model.totalCount, items.length);
|
|
139
|
+
if (count <= 0 || model.endIndex < model.startIndex) {
|
|
140
|
+
return {
|
|
141
|
+
startIndex: 0,
|
|
142
|
+
endIndex: -1,
|
|
143
|
+
totalHeight: 0,
|
|
144
|
+
topSpacerPx: 0,
|
|
145
|
+
bottomSpacerPx: 0,
|
|
146
|
+
visibleItems: [],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const start = Math.max(0, Math.min(model.startIndex, count - 1));
|
|
150
|
+
const end = Math.max(start, Math.min(model.endIndex, count - 1));
|
|
151
|
+
const pool = Math.max(1, model.poolSize);
|
|
152
|
+
let topSpacerPx = 0;
|
|
153
|
+
for (let i = 0; i < start; i++) {
|
|
154
|
+
topSpacerPx += heightOf(i, model.measuredHeights, model.estimatedItemHeight);
|
|
155
|
+
}
|
|
156
|
+
let offsetY = topSpacerPx;
|
|
157
|
+
const visibleItems = [];
|
|
158
|
+
for (let i = start; i <= end; i++) {
|
|
159
|
+
const h = heightOf(i, model.measuredHeights, model.estimatedItemHeight);
|
|
160
|
+
const slot = i % pool;
|
|
161
|
+
visibleItems.push({
|
|
162
|
+
index: i,
|
|
163
|
+
key: model.recycle ? `vslot-${slot}` : `vitem-${i}`,
|
|
164
|
+
slot,
|
|
165
|
+
offsetY,
|
|
166
|
+
height: h,
|
|
167
|
+
item: items[i],
|
|
168
|
+
});
|
|
169
|
+
offsetY += h;
|
|
170
|
+
}
|
|
171
|
+
let bottomSpacerPx = 0;
|
|
172
|
+
for (let i = end + 1; i < count; i++) {
|
|
173
|
+
bottomSpacerPx += heightOf(i, model.measuredHeights, model.estimatedItemHeight);
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
startIndex: start,
|
|
177
|
+
endIndex: end,
|
|
178
|
+
totalHeight: offsetY + bottomSpacerPx,
|
|
179
|
+
topSpacerPx,
|
|
180
|
+
bottomSpacerPx,
|
|
181
|
+
visibleItems,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export const VirtualList = {
|
|
185
|
+
VirtualListModel,
|
|
186
|
+
init,
|
|
187
|
+
scrolled,
|
|
188
|
+
measureHeight,
|
|
189
|
+
setCount,
|
|
190
|
+
computeWindow,
|
|
191
|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