@flighthq/keyboard 0.5.1-next.1069.554a2ac → 0.5.1-next.1201.9b49dee
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 +2 -2
- package/dist/keyboard.d.ts +11 -11
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +21 -21
- package/dist/keyboard.js.map +1 -1
- package/package.json +4 -4
- package/src/keyboard.test.ts +129 -55
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/keyboard`. The `@fli
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/keyboard@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/keyboard@0.5.1-next.1201.9b49dee](https://github.com/flighthq/flight/tree/9b49dee3f22f6b2838c3d237edcc77bca65734f2/packages/keyboard)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/9b49dee3f22f6b2838c3d237edcc77bca65734f2/LICENSE.md)
|
package/dist/keyboard.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { Entity, EntityConstruction,
|
|
2
|
-
export declare function attachSoftKeyboard(
|
|
1
|
+
import type { Entity, EntityConstruction, HostSoftKeyboardAccessoryBarProvider, HostSoftKeyboardChangeProvider, HostSoftKeyboardInfoProvider, HostSoftKeyboardResizeModeWriteProvider, HostSoftKeyboardScrollAssistProvider, HostSoftKeyboardStyleProvider, HostSoftKeyboardVisibilityProvider, SoftKeyboard, SoftKeyboardAttachResult, SoftKeyboardInfo, SoftKeyboardResizeMode, SoftKeyboardSetterResult, SoftKeyboardStyleKind, SoftKeyboardVisibilityResult } from '@flighthq/types/contract';
|
|
2
|
+
export declare function attachSoftKeyboard(hostSoftKeyboardChange: Readonly<HostSoftKeyboardChangeProvider>, hostSoftKeyboardInfo: Readonly<HostSoftKeyboardInfoProvider>, keyboard: SoftKeyboard): Promise<SoftKeyboardAttachResult>;
|
|
3
3
|
export declare function createSoftKeyboard(): SoftKeyboard & Entity;
|
|
4
4
|
export declare function detachSoftKeyboard(keyboard: SoftKeyboard): void;
|
|
5
5
|
export declare function disposeSoftKeyboard(keyboard: SoftKeyboard): void;
|
|
6
|
-
export declare function getSoftKeyboardHeight(
|
|
7
|
-
export declare function getSoftKeyboardInfo(
|
|
8
|
-
export declare function hideSoftKeyboard(
|
|
6
|
+
export declare function getSoftKeyboardHeight(hostSoftKeyboardInfo: Readonly<HostSoftKeyboardInfoProvider>): number;
|
|
7
|
+
export declare function getSoftKeyboardInfo(hostSoftKeyboardInfo: Readonly<HostSoftKeyboardInfoProvider>, out: SoftKeyboardInfo): SoftKeyboardInfo;
|
|
8
|
+
export declare function hideSoftKeyboard(hostSoftKeyboardVisibility: Readonly<HostSoftKeyboardVisibilityProvider>): Promise<SoftKeyboardVisibilityResult>;
|
|
9
9
|
export declare function initializeSoftKeyboard(out: EntityConstruction<SoftKeyboard & Entity>): void;
|
|
10
|
-
export declare function isSoftKeyboardVisible(
|
|
11
|
-
export declare function setSoftKeyboardAccessoryBarVisible(
|
|
12
|
-
export declare function setSoftKeyboardResizeMode(
|
|
13
|
-
export declare function setSoftKeyboardScrollAssistEnabled(
|
|
14
|
-
export declare function setSoftKeyboardStyle(
|
|
15
|
-
export declare function showSoftKeyboard(
|
|
10
|
+
export declare function isSoftKeyboardVisible(hostSoftKeyboardInfo: Readonly<HostSoftKeyboardInfoProvider>): boolean;
|
|
11
|
+
export declare function setSoftKeyboardAccessoryBarVisible(hostSoftKeyboardAccessoryBar: Readonly<HostSoftKeyboardAccessoryBarProvider>, visible: boolean): Promise<SoftKeyboardSetterResult>;
|
|
12
|
+
export declare function setSoftKeyboardResizeMode(hostSoftKeyboardResizeModeWrite: Readonly<HostSoftKeyboardResizeModeWriteProvider>, mode: SoftKeyboardResizeMode): Promise<SoftKeyboardSetterResult>;
|
|
13
|
+
export declare function setSoftKeyboardScrollAssistEnabled(hostSoftKeyboardScrollAssist: Readonly<HostSoftKeyboardScrollAssistProvider>, enabled: boolean): Promise<SoftKeyboardSetterResult>;
|
|
14
|
+
export declare function setSoftKeyboardStyle(hostSoftKeyboardStyle: Readonly<HostSoftKeyboardStyleProvider>, style: SoftKeyboardStyleKind): Promise<SoftKeyboardSetterResult>;
|
|
15
|
+
export declare function showSoftKeyboard(hostSoftKeyboardVisibility: Readonly<HostSoftKeyboardVisibilityProvider>): Promise<SoftKeyboardVisibilityResult>;
|
|
16
16
|
//# sourceMappingURL=keyboard.d.ts.map
|
package/dist/keyboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../src/keyboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../src/keyboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,oCAAoC,EACpC,8BAA8B,EAC9B,4BAA4B,EAC5B,uCAAuC,EACvC,oCAAoC,EACpC,6BAA6B,EAC7B,kCAAkC,EAClC,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAElC,wBAAsB,kBAAkB,CACtC,sBAAsB,EAAE,QAAQ,CAAC,8BAA8B,CAAC,EAChE,oBAAoB,EAAE,QAAQ,CAAC,4BAA4B,CAAC,EAC5D,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,wBAAwB,CAAC,CAwBnC;AAED,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,MAAM,CAI1D;A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C,kCAAkC,CAAC,GACvE,OAAO,CAAC,4BAA4B,CAAC,CAEvC"}
|
package/dist/keyboard.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import { createSignal, emitSignal } from '@flighthq/signals/contract';
|
|
3
|
-
export async function attachSoftKeyboard(
|
|
3
|
+
export async function attachSoftKeyboard(hostSoftKeyboardChange, hostSoftKeyboardInfo, keyboard) {
|
|
4
4
|
detachSoftKeyboard(keyboard);
|
|
5
|
-
const change =
|
|
6
|
-
const info =
|
|
5
|
+
const change = hostSoftKeyboardChange;
|
|
6
|
+
const info = hostSoftKeyboardInfo;
|
|
7
7
|
let prevHeight = info.getInfo(_scratch).height;
|
|
8
8
|
const subscription = await change.subscribe(() => {
|
|
9
9
|
const nowInfo = info.getInfo(_scratch);
|
|
@@ -43,37 +43,37 @@ export function detachSoftKeyboard(keyboard) {
|
|
|
43
43
|
export function disposeSoftKeyboard(keyboard) {
|
|
44
44
|
detachSoftKeyboard(keyboard);
|
|
45
45
|
}
|
|
46
|
-
export function getSoftKeyboardHeight(
|
|
47
|
-
return
|
|
46
|
+
export function getSoftKeyboardHeight(hostSoftKeyboardInfo) {
|
|
47
|
+
return hostSoftKeyboardInfo.getInfo(_scratch).height;
|
|
48
48
|
}
|
|
49
|
-
export function getSoftKeyboardInfo(
|
|
50
|
-
return
|
|
49
|
+
export function getSoftKeyboardInfo(hostSoftKeyboardInfo, out) {
|
|
50
|
+
return hostSoftKeyboardInfo.getInfo(out);
|
|
51
51
|
}
|
|
52
|
-
export function hideSoftKeyboard(
|
|
53
|
-
return
|
|
52
|
+
export function hideSoftKeyboard(hostSoftKeyboardVisibility) {
|
|
53
|
+
return hostSoftKeyboardVisibility.hide();
|
|
54
54
|
}
|
|
55
55
|
export function initializeSoftKeyboard(out) {
|
|
56
56
|
out.onHide = createSignal();
|
|
57
57
|
out.onResize = createSignal();
|
|
58
58
|
out.onShow = createSignal();
|
|
59
59
|
}
|
|
60
|
-
export function isSoftKeyboardVisible(
|
|
61
|
-
return
|
|
60
|
+
export function isSoftKeyboardVisible(hostSoftKeyboardInfo) {
|
|
61
|
+
return hostSoftKeyboardInfo.getInfo(_scratch).visible;
|
|
62
62
|
}
|
|
63
|
-
export function setSoftKeyboardAccessoryBarVisible(
|
|
64
|
-
return
|
|
63
|
+
export function setSoftKeyboardAccessoryBarVisible(hostSoftKeyboardAccessoryBar, visible) {
|
|
64
|
+
return hostSoftKeyboardAccessoryBar.setAccessoryBarVisible(visible);
|
|
65
65
|
}
|
|
66
|
-
export function setSoftKeyboardResizeMode(
|
|
67
|
-
return
|
|
66
|
+
export function setSoftKeyboardResizeMode(hostSoftKeyboardResizeModeWrite, mode) {
|
|
67
|
+
return hostSoftKeyboardResizeModeWrite.setResizeMode(mode);
|
|
68
68
|
}
|
|
69
|
-
export function setSoftKeyboardScrollAssistEnabled(
|
|
70
|
-
return
|
|
69
|
+
export function setSoftKeyboardScrollAssistEnabled(hostSoftKeyboardScrollAssist, enabled) {
|
|
70
|
+
return hostSoftKeyboardScrollAssist.setScrollAssistEnabled(enabled);
|
|
71
71
|
}
|
|
72
|
-
export function setSoftKeyboardStyle(
|
|
73
|
-
return
|
|
72
|
+
export function setSoftKeyboardStyle(hostSoftKeyboardStyle, style) {
|
|
73
|
+
return hostSoftKeyboardStyle.setStyle(style);
|
|
74
74
|
}
|
|
75
|
-
export function showSoftKeyboard(
|
|
76
|
-
return
|
|
75
|
+
export function showSoftKeyboard(hostSoftKeyboardVisibility) {
|
|
76
|
+
return hostSoftKeyboardVisibility.show();
|
|
77
77
|
}
|
|
78
78
|
const _scratch = { visible: false, height: 0, x: 0, y: 0, width: 0 };
|
|
79
79
|
const _subscriptions = new WeakMap();
|
package/dist/keyboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.js","sourceRoot":"","sources":["../src/keyboard.ts"],"names":[],"mappings":"AAAA,OAA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0.5.1-next.1201.9b49dee",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1201.9b49dee",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.1201.9b49dee",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.1201.9b49dee"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/keyboard.test.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { connectSignal } from '@flighthq/signals/contract';
|
|
2
2
|
import { EntityRuntimeKey, SoftKeyboardResizeBodyKind } from '@flighthq/types/contract';
|
|
3
3
|
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
HostSoftKeyboardAccessoryBarProvider,
|
|
5
|
+
HostSoftKeyboardChangeProvider,
|
|
6
|
+
HostSoftKeyboardInfoProvider,
|
|
7
|
+
HostSoftKeyboardResizeModeWriteProvider,
|
|
8
|
+
HostSoftKeyboardScrollAssistProvider,
|
|
9
|
+
HostSoftKeyboardStyleProvider,
|
|
10
|
+
HostSoftKeyboardVisibilityProvider,
|
|
11
11
|
SoftKeyboardChangeSubscription,
|
|
12
12
|
SoftKeyboardInfo,
|
|
13
13
|
SoftKeyboardSetterResult,
|
|
@@ -35,7 +35,9 @@ type OmitRuntime<T> = Omit<T, typeof EntityRuntimeKey>;
|
|
|
35
35
|
|
|
36
36
|
function fakeInfoBackend(
|
|
37
37
|
info: Partial<SoftKeyboardInfo> = {},
|
|
38
|
-
): OmitRuntime<
|
|
38
|
+
): OmitRuntime<
|
|
39
|
+
{ readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider } }['input']['softKeyboardInfo']
|
|
40
|
+
> {
|
|
39
41
|
const data: SoftKeyboardInfo = { visible: false, height: 0, x: 0, y: 0, width: 0, ...info };
|
|
40
42
|
return {
|
|
41
43
|
getInfo(out: SoftKeyboardInfo): SoftKeyboardInfo {
|
|
@@ -49,7 +51,11 @@ function fakeInfoBackend(
|
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
function fakeChangeBackend(
|
|
54
|
+
function fakeChangeBackend(
|
|
55
|
+
willSucceed = true,
|
|
56
|
+
): OmitRuntime<
|
|
57
|
+
{ readonly input: { readonly softKeyboardChange: HostSoftKeyboardChangeProvider } }['input']['softKeyboardChange']
|
|
58
|
+
> {
|
|
53
59
|
return {
|
|
54
60
|
async subscribe(): Promise<SoftKeyboardChangeSubscription> {
|
|
55
61
|
if (!willSucceed) return { result: 'acquisition-failed', unsubscribe: null };
|
|
@@ -58,9 +64,13 @@ function fakeChangeBackend(willSucceed = true): OmitRuntime<HasSoftKeyboardChang
|
|
|
58
64
|
};
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
function fakeVisibilityBackend(
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
function fakeVisibilityBackend(result: SoftKeyboardVisibilityResult = 'ok'): OmitRuntime<
|
|
68
|
+
{
|
|
69
|
+
readonly input: {
|
|
70
|
+
readonly softKeyboardVisibility: HostSoftKeyboardVisibilityProvider;
|
|
71
|
+
};
|
|
72
|
+
}['input']['softKeyboardVisibility']
|
|
73
|
+
> {
|
|
64
74
|
return {
|
|
65
75
|
async show(): Promise<SoftKeyboardVisibilityResult> {
|
|
66
76
|
return result;
|
|
@@ -71,9 +81,13 @@ function fakeVisibilityBackend(
|
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
83
|
|
|
74
|
-
function fakeAccessoryBarBackend(
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
function fakeAccessoryBarBackend(result: SoftKeyboardSetterResult = 'ok'): OmitRuntime<
|
|
85
|
+
{
|
|
86
|
+
readonly input: {
|
|
87
|
+
readonly softKeyboardAccessoryBar: HostSoftKeyboardAccessoryBarProvider;
|
|
88
|
+
};
|
|
89
|
+
}['input']['softKeyboardAccessoryBar']
|
|
90
|
+
> {
|
|
77
91
|
return {
|
|
78
92
|
async setAccessoryBarVisible(): Promise<SoftKeyboardSetterResult> {
|
|
79
93
|
return result;
|
|
@@ -81,9 +95,13 @@ function fakeAccessoryBarBackend(
|
|
|
81
95
|
};
|
|
82
96
|
}
|
|
83
97
|
|
|
84
|
-
function fakeResizeModeWriteBackend(
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
function fakeResizeModeWriteBackend(result: SoftKeyboardSetterResult = 'ok'): OmitRuntime<
|
|
99
|
+
{
|
|
100
|
+
readonly input: {
|
|
101
|
+
readonly softKeyboardResizeModeWrite: HostSoftKeyboardResizeModeWriteProvider;
|
|
102
|
+
};
|
|
103
|
+
}['input']['softKeyboardResizeModeWrite']
|
|
104
|
+
> {
|
|
87
105
|
return {
|
|
88
106
|
async setResizeMode(): Promise<SoftKeyboardSetterResult> {
|
|
89
107
|
return result;
|
|
@@ -91,9 +109,13 @@ function fakeResizeModeWriteBackend(
|
|
|
91
109
|
};
|
|
92
110
|
}
|
|
93
111
|
|
|
94
|
-
function fakeScrollAssistBackend(
|
|
95
|
-
|
|
96
|
-
|
|
112
|
+
function fakeScrollAssistBackend(result: SoftKeyboardSetterResult = 'ok'): OmitRuntime<
|
|
113
|
+
{
|
|
114
|
+
readonly input: {
|
|
115
|
+
readonly softKeyboardScrollAssist: HostSoftKeyboardScrollAssistProvider;
|
|
116
|
+
};
|
|
117
|
+
}['input']['softKeyboardScrollAssist']
|
|
118
|
+
> {
|
|
97
119
|
return {
|
|
98
120
|
async setScrollAssistEnabled(): Promise<SoftKeyboardSetterResult> {
|
|
99
121
|
return result;
|
|
@@ -103,7 +125,9 @@ function fakeScrollAssistBackend(
|
|
|
103
125
|
|
|
104
126
|
function fakeStyleBackend(
|
|
105
127
|
result: SoftKeyboardSetterResult = 'ok',
|
|
106
|
-
): OmitRuntime<
|
|
128
|
+
): OmitRuntime<
|
|
129
|
+
{ readonly input: { readonly softKeyboardStyle: HostSoftKeyboardStyleProvider } }['input']['softKeyboardStyle']
|
|
130
|
+
> {
|
|
107
131
|
return {
|
|
108
132
|
async setStyle(): Promise<SoftKeyboardSetterResult> {
|
|
109
133
|
return result;
|
|
@@ -111,37 +135,55 @@ function fakeStyleBackend(
|
|
|
111
135
|
};
|
|
112
136
|
}
|
|
113
137
|
|
|
114
|
-
function infoHost(info: Partial<SoftKeyboardInfo> = {}):
|
|
115
|
-
|
|
138
|
+
function infoHost(info: Partial<SoftKeyboardInfo> = {}): {
|
|
139
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
140
|
+
} {
|
|
141
|
+
return { input: { softKeyboardInfo: fakeInfoBackend(info) } } as {
|
|
142
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
143
|
+
};
|
|
116
144
|
}
|
|
117
145
|
|
|
118
|
-
function visibilityHost(result: SoftKeyboardVisibilityResult = 'ok'):
|
|
119
|
-
|
|
146
|
+
function visibilityHost(result: SoftKeyboardVisibilityResult = 'ok'): {
|
|
147
|
+
readonly input: {
|
|
148
|
+
readonly softKeyboardVisibility: HostSoftKeyboardVisibilityProvider;
|
|
149
|
+
};
|
|
150
|
+
} {
|
|
151
|
+
return { input: { softKeyboardVisibility: fakeVisibilityBackend(result) } } as {
|
|
152
|
+
readonly input: {
|
|
153
|
+
readonly softKeyboardVisibility: HostSoftKeyboardVisibilityProvider;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
120
156
|
}
|
|
121
157
|
|
|
122
158
|
function attachHost(
|
|
123
159
|
willSucceed = true,
|
|
124
160
|
info: Partial<SoftKeyboardInfo> = {},
|
|
125
|
-
):
|
|
161
|
+
): { readonly input: { readonly softKeyboardChange: HostSoftKeyboardChangeProvider } } & {
|
|
162
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
163
|
+
} {
|
|
126
164
|
return {
|
|
127
165
|
input: {
|
|
128
166
|
softKeyboardChange: fakeChangeBackend(willSucceed),
|
|
129
167
|
softKeyboardInfo: fakeInfoBackend(info),
|
|
130
168
|
},
|
|
131
|
-
} as
|
|
169
|
+
} as { readonly input: { readonly softKeyboardChange: HostSoftKeyboardChangeProvider } } & {
|
|
170
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
171
|
+
};
|
|
132
172
|
}
|
|
133
173
|
|
|
134
174
|
describe('attachSoftKeyboard', () => {
|
|
135
175
|
it('returns ok when change and info backends are present and subscribe succeeds', async () => {
|
|
136
176
|
const host = attachHost(true);
|
|
137
177
|
const keyboard = createSoftKeyboard();
|
|
138
|
-
expect(await attachSoftKeyboard(host, keyboard)).toBe('ok');
|
|
178
|
+
expect(await attachSoftKeyboard(host.input.softKeyboardChange, host.input.softKeyboardInfo, keyboard)).toBe('ok');
|
|
139
179
|
});
|
|
140
180
|
|
|
141
181
|
it('returns acquisition-failed when subscribe returns null', async () => {
|
|
142
182
|
const host = attachHost(false);
|
|
143
183
|
const keyboard = createSoftKeyboard();
|
|
144
|
-
expect(await attachSoftKeyboard(host, keyboard)).toBe(
|
|
184
|
+
expect(await attachSoftKeyboard(host.input.softKeyboardChange, host.input.softKeyboardInfo, keyboard)).toBe(
|
|
185
|
+
'acquisition-failed',
|
|
186
|
+
);
|
|
145
187
|
});
|
|
146
188
|
|
|
147
189
|
it('fires onShow when height goes from 0 to positive', async () => {
|
|
@@ -166,13 +208,15 @@ describe('attachSoftKeyboard', () => {
|
|
|
166
208
|
},
|
|
167
209
|
},
|
|
168
210
|
},
|
|
169
|
-
} as
|
|
211
|
+
} as { readonly input: { readonly softKeyboardChange: HostSoftKeyboardChangeProvider } } & {
|
|
212
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
213
|
+
};
|
|
170
214
|
const keyboard = createSoftKeyboard();
|
|
171
215
|
let firedHeight = -1;
|
|
172
216
|
connectSignal(keyboard.onShow, (h) => {
|
|
173
217
|
firedHeight = h;
|
|
174
218
|
});
|
|
175
|
-
await attachSoftKeyboard(host, keyboard);
|
|
219
|
+
await attachSoftKeyboard(host.input.softKeyboardChange, host.input.softKeyboardInfo, keyboard);
|
|
176
220
|
data.visible = true;
|
|
177
221
|
data.height = 300;
|
|
178
222
|
listener!();
|
|
@@ -201,13 +245,15 @@ describe('attachSoftKeyboard', () => {
|
|
|
201
245
|
},
|
|
202
246
|
},
|
|
203
247
|
},
|
|
204
|
-
} as
|
|
248
|
+
} as { readonly input: { readonly softKeyboardChange: HostSoftKeyboardChangeProvider } } & {
|
|
249
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
250
|
+
};
|
|
205
251
|
const keyboard = createSoftKeyboard();
|
|
206
252
|
let hideFired = false;
|
|
207
253
|
connectSignal(keyboard.onHide, () => {
|
|
208
254
|
hideFired = true;
|
|
209
255
|
});
|
|
210
|
-
await attachSoftKeyboard(host, keyboard);
|
|
256
|
+
await attachSoftKeyboard(host.input.softKeyboardChange, host.input.softKeyboardInfo, keyboard);
|
|
211
257
|
data.visible = false;
|
|
212
258
|
data.height = 0;
|
|
213
259
|
listener!();
|
|
@@ -236,13 +282,15 @@ describe('attachSoftKeyboard', () => {
|
|
|
236
282
|
},
|
|
237
283
|
},
|
|
238
284
|
},
|
|
239
|
-
} as
|
|
285
|
+
} as { readonly input: { readonly softKeyboardChange: HostSoftKeyboardChangeProvider } } & {
|
|
286
|
+
readonly input: { readonly softKeyboardInfo: HostSoftKeyboardInfoProvider };
|
|
287
|
+
};
|
|
240
288
|
const keyboard = createSoftKeyboard();
|
|
241
289
|
let resizedHeight = -1;
|
|
242
290
|
connectSignal(keyboard.onResize, (h) => {
|
|
243
291
|
resizedHeight = h;
|
|
244
292
|
});
|
|
245
|
-
await attachSoftKeyboard(host, keyboard);
|
|
293
|
+
await attachSoftKeyboard(host.input.softKeyboardChange, host.input.softKeyboardInfo, keyboard);
|
|
246
294
|
data.height = 400;
|
|
247
295
|
listener!();
|
|
248
296
|
expect(resizedHeight).toBe(400);
|
|
@@ -272,11 +320,11 @@ describe('disposeSoftKeyboard', () => {
|
|
|
272
320
|
|
|
273
321
|
describe('getSoftKeyboardHeight', () => {
|
|
274
322
|
it('returns the height from the info backend', () => {
|
|
275
|
-
expect(getSoftKeyboardHeight(infoHost({ height: 250 }))).toBe(250);
|
|
323
|
+
expect(getSoftKeyboardHeight(infoHost({ height: 250 }).input.softKeyboardInfo)).toBe(250);
|
|
276
324
|
});
|
|
277
325
|
|
|
278
326
|
it('returns 0 when info reports 0', () => {
|
|
279
|
-
expect(getSoftKeyboardHeight(infoHost({ height: 0 }))).toBe(0);
|
|
327
|
+
expect(getSoftKeyboardHeight(infoHost({ height: 0 }).input.softKeyboardInfo)).toBe(0);
|
|
280
328
|
});
|
|
281
329
|
});
|
|
282
330
|
|
|
@@ -284,7 +332,7 @@ describe('getSoftKeyboardInfo', () => {
|
|
|
284
332
|
it('writes into the out parameter and returns it', () => {
|
|
285
333
|
const host = infoHost({ visible: true, height: 300, x: 10, y: 20, width: 400 });
|
|
286
334
|
const out: SoftKeyboardInfo = { visible: false, height: 0, x: 0, y: 0, width: 0 };
|
|
287
|
-
const result = getSoftKeyboardInfo(host, out);
|
|
335
|
+
const result = getSoftKeyboardInfo(host.input.softKeyboardInfo, out);
|
|
288
336
|
expect(result).toBe(out);
|
|
289
337
|
expect(out.visible).toBe(true);
|
|
290
338
|
expect(out.height).toBe(300);
|
|
@@ -296,11 +344,13 @@ describe('getSoftKeyboardInfo', () => {
|
|
|
296
344
|
|
|
297
345
|
describe('hideSoftKeyboard', () => {
|
|
298
346
|
it('delegates to the visibility backend', async () => {
|
|
299
|
-
expect(await hideSoftKeyboard(visibilityHost('ok'))).toBe('ok');
|
|
347
|
+
expect(await hideSoftKeyboard(visibilityHost('ok').input.softKeyboardVisibility)).toBe('ok');
|
|
300
348
|
});
|
|
301
349
|
|
|
302
350
|
it('returns operation-failed when the backend reports failure', async () => {
|
|
303
|
-
expect(await hideSoftKeyboard(visibilityHost('operation-failed'))).toBe(
|
|
351
|
+
expect(await hideSoftKeyboard(visibilityHost('operation-failed').input.softKeyboardVisibility)).toBe(
|
|
352
|
+
'operation-failed',
|
|
353
|
+
);
|
|
304
354
|
});
|
|
305
355
|
});
|
|
306
356
|
|
|
@@ -312,25 +362,35 @@ describe('initializeSoftKeyboard', () => {
|
|
|
312
362
|
|
|
313
363
|
describe('isSoftKeyboardVisible', () => {
|
|
314
364
|
it('returns true when info reports visible', () => {
|
|
315
|
-
expect(isSoftKeyboardVisible(infoHost({ visible: true, height: 300 }))).toBe(true);
|
|
365
|
+
expect(isSoftKeyboardVisible(infoHost({ visible: true, height: 300 }).input.softKeyboardInfo)).toBe(true);
|
|
316
366
|
});
|
|
317
367
|
|
|
318
368
|
it('returns false when info reports not visible', () => {
|
|
319
|
-
expect(isSoftKeyboardVisible(infoHost({ visible: false }))).toBe(false);
|
|
369
|
+
expect(isSoftKeyboardVisible(infoHost({ visible: false }).input.softKeyboardInfo)).toBe(false);
|
|
320
370
|
});
|
|
321
371
|
});
|
|
322
372
|
|
|
323
373
|
describe('setSoftKeyboardAccessoryBarVisible', () => {
|
|
324
374
|
it('delegates to the accessory bar backend', async () => {
|
|
325
|
-
const host = { input: { softKeyboardAccessoryBar: fakeAccessoryBarBackend('ok') } } as
|
|
326
|
-
|
|
375
|
+
const host = { input: { softKeyboardAccessoryBar: fakeAccessoryBarBackend('ok') } } as {
|
|
376
|
+
readonly input: {
|
|
377
|
+
readonly softKeyboardAccessoryBar: HostSoftKeyboardAccessoryBarProvider;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
expect(await setSoftKeyboardAccessoryBarVisible(host.input.softKeyboardAccessoryBar, true)).toBe('ok');
|
|
327
381
|
});
|
|
328
382
|
|
|
329
383
|
it('returns operation-failed from the backend', async () => {
|
|
330
384
|
const host = {
|
|
331
385
|
input: { softKeyboardAccessoryBar: fakeAccessoryBarBackend('operation-failed') },
|
|
332
|
-
} as
|
|
333
|
-
|
|
386
|
+
} as {
|
|
387
|
+
readonly input: {
|
|
388
|
+
readonly softKeyboardAccessoryBar: HostSoftKeyboardAccessoryBarProvider;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
expect(await setSoftKeyboardAccessoryBarVisible(host.input.softKeyboardAccessoryBar, false)).toBe(
|
|
392
|
+
'operation-failed',
|
|
393
|
+
);
|
|
334
394
|
});
|
|
335
395
|
});
|
|
336
396
|
|
|
@@ -338,8 +398,14 @@ describe('setSoftKeyboardResizeMode', () => {
|
|
|
338
398
|
it('delegates to the resize mode write backend', async () => {
|
|
339
399
|
const host = {
|
|
340
400
|
input: { softKeyboardResizeModeWrite: fakeResizeModeWriteBackend('ok') },
|
|
341
|
-
} as
|
|
342
|
-
|
|
401
|
+
} as {
|
|
402
|
+
readonly input: {
|
|
403
|
+
readonly softKeyboardResizeModeWrite: HostSoftKeyboardResizeModeWriteProvider;
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
expect(await setSoftKeyboardResizeMode(host.input.softKeyboardResizeModeWrite, SoftKeyboardResizeBodyKind)).toBe(
|
|
407
|
+
'ok',
|
|
408
|
+
);
|
|
343
409
|
});
|
|
344
410
|
});
|
|
345
411
|
|
|
@@ -347,23 +413,31 @@ describe('setSoftKeyboardScrollAssistEnabled', () => {
|
|
|
347
413
|
it('delegates to the scroll assist backend', async () => {
|
|
348
414
|
const host = {
|
|
349
415
|
input: { softKeyboardScrollAssist: fakeScrollAssistBackend('ok') },
|
|
350
|
-
} as
|
|
351
|
-
|
|
416
|
+
} as {
|
|
417
|
+
readonly input: {
|
|
418
|
+
readonly softKeyboardScrollAssist: HostSoftKeyboardScrollAssistProvider;
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
expect(await setSoftKeyboardScrollAssistEnabled(host.input.softKeyboardScrollAssist, true)).toBe('ok');
|
|
352
422
|
});
|
|
353
423
|
});
|
|
354
424
|
|
|
355
425
|
describe('setSoftKeyboardStyle', () => {
|
|
356
426
|
it('delegates to the style backend', async () => {
|
|
357
|
-
const host = { input: { softKeyboardStyle: fakeStyleBackend('ok') } } as
|
|
358
|
-
|
|
427
|
+
const host = { input: { softKeyboardStyle: fakeStyleBackend('ok') } } as {
|
|
428
|
+
readonly input: { readonly softKeyboardStyle: HostSoftKeyboardStyleProvider };
|
|
429
|
+
};
|
|
430
|
+
expect(await setSoftKeyboardStyle(host.input.softKeyboardStyle, 'Dark')).toBe('ok');
|
|
359
431
|
});
|
|
360
432
|
});
|
|
361
433
|
describe('showSoftKeyboard', () => {
|
|
362
434
|
it('delegates to the visibility backend', async () => {
|
|
363
|
-
expect(await showSoftKeyboard(visibilityHost('ok'))).toBe('ok');
|
|
435
|
+
expect(await showSoftKeyboard(visibilityHost('ok').input.softKeyboardVisibility)).toBe('ok');
|
|
364
436
|
});
|
|
365
437
|
|
|
366
438
|
it('returns operation-failed when the backend reports failure', async () => {
|
|
367
|
-
expect(await showSoftKeyboard(visibilityHost('operation-failed'))).toBe(
|
|
439
|
+
expect(await showSoftKeyboard(visibilityHost('operation-failed').input.softKeyboardVisibility)).toBe(
|
|
440
|
+
'operation-failed',
|
|
441
|
+
);
|
|
368
442
|
});
|
|
369
443
|
});
|