@floegence/floe-webapp-core 0.35.9 → 0.35.10
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.
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import { spread as
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { isRepeatableTerminalAction as
|
|
5
|
-
import { floeTouchSurfaceAttrs as
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { spread as V, mergeProps as N, insert as l, createComponent as p, memo as oe, effect as ae, className as se, setStyleProperty as le, template as v, setAttribute as Ae, use as Ce, delegateEvents as Le } from "solid-js/web";
|
|
2
|
+
import { splitProps as Oe, createSignal as y, createMemo as u, createEffect as ne, onCleanup as ce, Show as z, For as _ } from "solid-js";
|
|
3
|
+
import { cn as q } from "../../utils/cn.js";
|
|
4
|
+
import { isRepeatableTerminalAction as Me, DEFAULT_MOBILE_KEYBOARD_QUICK_INSERTS as De, applyTerminalModifiers as xe, createMobileKeyboardPressTracker as We, mapTerminalActionToKey as Be } from "./mobileKeyboardModel.js";
|
|
5
|
+
import { floeTouchSurfaceAttrs as Y, preventTouchSurfacePointerDown as de } from "../../utils/touchSurfaceGuard.js";
|
|
6
|
+
import { buildMobileKeyboardViewportStyle as He, resolveMobileKeyboardViewportMetrics as Ve } from "./mobileKeyboardViewport.js";
|
|
7
|
+
var Ne = /* @__PURE__ */ v("<button type=button>"), ze = /* @__PURE__ */ v("<button>Hide"), qe = /* @__PURE__ */ v('<div class=mobile-keyboard-rail-shell><div class=mobile-keyboard-suggestion-rail role=list aria-label="Terminal suggestions">'), Ye = /* @__PURE__ */ v('<div><div class=mobile-keyboard-panel><div></div><div class=mobile-keyboard-scroll><div class=mobile-keyboard-rail-shell><div class=mobile-keyboard-top-strip></div></div><div class=mobile-keyboard-main></div><div class=mobile-keyboard-bottom-zone><div class=mobile-keyboard-direction-pad role=group aria-label="Arrow keys">'), Ue = /* @__PURE__ */ v("<button>"), je = /* @__PURE__ */ v("<div class=mobile-keyboard-row>");
|
|
8
|
+
function Fe(I, i) {
|
|
9
|
+
if (typeof i == "string") {
|
|
10
|
+
const $ = Object.entries(I).filter(([, c]) => c).map(([c, E]) => `${c}: ${E}`).join("; ");
|
|
11
|
+
return $ ? `${i}; ${$}` : i;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
...i ?? {},
|
|
15
|
+
...I
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const Qe = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"], Ge = ["a", "s", "d", "f", "g", "h", "j", "k", "l"], Je = ["z", "x", "c", "v", "b", "n", "m"], Xe = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"], Ze = ["@", "#", "$", "%", "&", "*", "(", ")", "[", "]"], et = ["+", "=", "{", "}", ".", ",", "?", "!", "'"], tt = [{
|
|
8
19
|
action: "escape",
|
|
9
20
|
label: "Esc"
|
|
10
21
|
}, {
|
|
11
22
|
action: "tab",
|
|
12
23
|
label: "Tab"
|
|
13
|
-
}],
|
|
24
|
+
}], rt = [{
|
|
14
25
|
action: "arrow-up",
|
|
15
26
|
label: "↑",
|
|
16
27
|
position: "up"
|
|
@@ -26,254 +37,274 @@ const Ye = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"], Ue = ["a", "s", "
|
|
|
26
37
|
action: "arrow-right",
|
|
27
38
|
label: "→",
|
|
28
39
|
position: "right"
|
|
29
|
-
}],
|
|
30
|
-
function
|
|
31
|
-
const [
|
|
32
|
-
let
|
|
33
|
-
const
|
|
34
|
-
|
|
40
|
+
}], it = 320, ot = 68;
|
|
41
|
+
function bt(I) {
|
|
42
|
+
const [i, $] = Oe(I, ["visible", "onKey", "onDismiss", "quickInserts", "suggestions", "onSuggestionSelect", "class", "style"]), [c, E] = y("letters"), [U, R] = y(!1), [j, A] = y(!1), [F, C] = y(!1), [be, Q] = y([]), [w, L] = y(null), [pe, G] = y({}), me = u(() => new Set(be()));
|
|
43
|
+
let O, h;
|
|
44
|
+
const d = We(), S = /* @__PURE__ */ new Map(), ye = () => i.quickInserts ?? De, M = u(() => i.suggestions ?? []), ue = u(() => Fe(pe(), i.style)), J = () => {
|
|
45
|
+
R(!1), A(!1), C(!1);
|
|
35
46
|
}, P = () => {
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
47
|
+
h && (clearTimeout(h), h = void 0);
|
|
48
|
+
}, D = () => {
|
|
49
|
+
Q(d.getPressedKeyIds());
|
|
39
50
|
}, T = (e) => {
|
|
40
|
-
const t =
|
|
41
|
-
t && (t.delayTimer && clearTimeout(t.delayTimer), t.intervalTimer && clearInterval(t.intervalTimer),
|
|
42
|
-
},
|
|
43
|
-
for (const e of
|
|
51
|
+
const t = S.get(e);
|
|
52
|
+
t && (t.delayTimer && clearTimeout(t.delayTimer), t.intervalTimer && clearInterval(t.intervalTimer), S.delete(e));
|
|
53
|
+
}, X = () => {
|
|
54
|
+
for (const e of S.keys())
|
|
44
55
|
T(e);
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
e &&
|
|
49
|
-
},
|
|
50
|
-
|
|
56
|
+
}, fe = () => {
|
|
57
|
+
E("letters"), J(), d.reset(), Q([]), L(null), P(), X();
|
|
58
|
+
}, Z = (e) => {
|
|
59
|
+
e && i.onKey?.(e);
|
|
60
|
+
}, ke = (e) => {
|
|
61
|
+
Z(xe(e, {
|
|
51
62
|
ctrl: U(),
|
|
52
|
-
alt:
|
|
53
|
-
})),
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
},
|
|
63
|
+
alt: j()
|
|
64
|
+
})), J();
|
|
65
|
+
}, ve = (e) => {
|
|
66
|
+
Z(Be(e)), R(!1), A(!1);
|
|
67
|
+
}, x = (e) => c() !== "letters" ? e : F() ? e.toUpperCase() : e, we = (e) => {
|
|
57
68
|
switch (e) {
|
|
58
69
|
case "ctrl":
|
|
59
|
-
|
|
70
|
+
R((t) => !t);
|
|
60
71
|
return;
|
|
61
72
|
case "alt":
|
|
62
|
-
|
|
73
|
+
A((t) => !t);
|
|
63
74
|
return;
|
|
64
75
|
case "shift":
|
|
65
|
-
|
|
76
|
+
C((t) => !t);
|
|
66
77
|
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
const
|
|
71
|
-
P(),
|
|
78
|
+
}, he = (e) => {
|
|
79
|
+
E(e), C(!1);
|
|
80
|
+
}, Te = (e, t, r) => {
|
|
81
|
+
const n = O?.getBoundingClientRect(), a = r.getBoundingClientRect();
|
|
82
|
+
P(), n && L({
|
|
72
83
|
pointerId: e,
|
|
73
84
|
label: t,
|
|
74
|
-
left:
|
|
75
|
-
top:
|
|
85
|
+
left: a.left - n.left + a.width / 2,
|
|
86
|
+
top: a.top - n.top,
|
|
76
87
|
visible: !0
|
|
77
88
|
});
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
}, ee = (e) => {
|
|
90
|
+
w()?.pointerId === e && (P(), h = setTimeout(() => {
|
|
91
|
+
L((t) => t?.pointerId === e ? {
|
|
81
92
|
...t,
|
|
82
93
|
visible: !1
|
|
83
|
-
} : t),
|
|
94
|
+
} : t), h = void 0;
|
|
84
95
|
}, 100));
|
|
85
|
-
},
|
|
96
|
+
}, ge = (e, t, r, n) => {
|
|
86
97
|
if (T(e), !r || typeof window > "u") return;
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (!
|
|
98
|
+
const a = {};
|
|
99
|
+
S.set(e, a), a.delayTimer = setTimeout(() => {
|
|
100
|
+
a.delayTimer = void 0, d.hasPress(e, t) && (d.markRepeated(e), n(), a.intervalTimer = setInterval(() => {
|
|
101
|
+
if (!d.hasPress(e, t)) {
|
|
91
102
|
T(e);
|
|
92
103
|
return;
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
t.preventDefault(), t.currentTarget.setPointerCapture?.(t.pointerId),
|
|
99
|
-
},
|
|
105
|
+
n();
|
|
106
|
+
}, ot));
|
|
107
|
+
}, it);
|
|
108
|
+
}, _e = (e, t) => {
|
|
109
|
+
t.preventDefault(), t.currentTarget.setPointerCapture?.(t.pointerId), d.startPress(t.pointerId, e.keyId), D(), Te(t.pointerId, e.label, t.currentTarget), ge(t.pointerId, e.keyId, e.repeatable, e.activate);
|
|
110
|
+
}, Ie = (e, t) => {
|
|
100
111
|
t.currentTarget.releasePointerCapture?.(t.pointerId), T(t.pointerId);
|
|
101
|
-
const r =
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
e.currentTarget.releasePointerCapture?.(e.pointerId), T(e.pointerId),
|
|
105
|
-
},
|
|
112
|
+
const r = d.finishPress(t.pointerId, e.keyId);
|
|
113
|
+
D(), ee(t.pointerId), r.shouldActivate && e.activate();
|
|
114
|
+
}, $e = (e) => {
|
|
115
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId), T(e.pointerId), d.cancelPress(e.pointerId), D(), ee(e.pointerId);
|
|
116
|
+
}, Ee = (e, t) => {
|
|
106
117
|
t.detail === 0 && e.activate();
|
|
107
|
-
},
|
|
118
|
+
}, b = (e, t) => ({
|
|
108
119
|
keyId: t?.keyId ?? `text-${e}`,
|
|
109
120
|
label: t?.label ?? e,
|
|
110
121
|
repeatable: !1,
|
|
111
|
-
activate: () =>
|
|
122
|
+
activate: () => ke(e),
|
|
112
123
|
width: t?.width,
|
|
113
124
|
class: t?.class,
|
|
114
125
|
kind: "text"
|
|
115
|
-
}),
|
|
126
|
+
}), g = (e, t, r) => ({
|
|
116
127
|
keyId: r?.keyId ?? `action-${e}`,
|
|
117
128
|
label: t,
|
|
118
|
-
repeatable: r?.repeatable ??
|
|
119
|
-
activate: () =>
|
|
129
|
+
repeatable: r?.repeatable ?? Me(e),
|
|
130
|
+
activate: () => ve(e),
|
|
120
131
|
width: r?.width,
|
|
121
132
|
class: r?.class,
|
|
122
133
|
kind: "terminal"
|
|
123
|
-
}),
|
|
134
|
+
}), W = (e, t, r) => ({
|
|
124
135
|
keyId: `modifier-${e}`,
|
|
125
136
|
label: t,
|
|
126
137
|
repeatable: !1,
|
|
127
|
-
activate: () =>
|
|
138
|
+
activate: () => we(e),
|
|
128
139
|
width: e === "shift" ? "wide" : "normal",
|
|
129
|
-
active: e === "ctrl" ? U() : e === "alt" ?
|
|
140
|
+
active: e === "ctrl" ? U() : e === "alt" ? j() : F(),
|
|
130
141
|
kind: "modifier",
|
|
131
142
|
class: r?.class
|
|
132
|
-
}),
|
|
143
|
+
}), Se = u(() => [...tt.map((e) => g(e.action, e.label, {
|
|
133
144
|
class: "mobile-keyboard-key-compact"
|
|
134
|
-
})),
|
|
145
|
+
})), W("ctrl", "Ctrl", {
|
|
135
146
|
class: "mobile-keyboard-key-compact"
|
|
136
|
-
}),
|
|
147
|
+
}), W("alt", "Alt", {
|
|
137
148
|
class: "mobile-keyboard-key-compact"
|
|
138
|
-
}), ...
|
|
149
|
+
}), ...ye().map((e) => b(e, {
|
|
139
150
|
keyId: `quick-${e}`,
|
|
140
151
|
class: "mobile-keyboard-key-compact mobile-keyboard-key-utility"
|
|
141
|
-
}))]),
|
|
152
|
+
}))]), Pe = u(() => c() === "symbols" ? [Xe.map((e) => b(e)), Ze.map((e) => b(e)), [...et.map((e) => b(e)), g("backspace", "⌫", {
|
|
142
153
|
width: "wide",
|
|
143
154
|
class: "mobile-keyboard-key-backspace"
|
|
144
|
-
})]] : [
|
|
155
|
+
})]] : [Qe.map((e) => b(x(e), {
|
|
145
156
|
keyId: `letter-${e}`
|
|
146
|
-
})),
|
|
157
|
+
})), Ge.map((e) => b(x(e), {
|
|
147
158
|
keyId: `letter-${e}`
|
|
148
|
-
})), [
|
|
159
|
+
})), [W("shift", "Shift"), ...Je.map((e) => b(x(e), {
|
|
149
160
|
keyId: `letter-${e}`
|
|
150
|
-
})),
|
|
161
|
+
})), g("backspace", "⌫", {
|
|
151
162
|
width: "wide",
|
|
152
163
|
class: "mobile-keyboard-key-backspace"
|
|
153
|
-
})]]),
|
|
164
|
+
})]]), B = u(() => [{
|
|
154
165
|
keyId: "mode-switch",
|
|
155
|
-
label:
|
|
166
|
+
label: c() === "letters" ? "123" : "ABC",
|
|
156
167
|
repeatable: !1,
|
|
157
|
-
activate: () =>
|
|
168
|
+
activate: () => he(c() === "letters" ? "symbols" : "letters"),
|
|
158
169
|
width: "wide",
|
|
159
170
|
kind: "mode",
|
|
160
171
|
class: "mobile-keyboard-key-bottom-mode"
|
|
161
|
-
},
|
|
172
|
+
}, b(" ", {
|
|
162
173
|
keyId: "space",
|
|
163
174
|
label: "Space",
|
|
164
175
|
width: "space",
|
|
165
176
|
class: "mobile-keyboard-key-bottom-space"
|
|
166
|
-
}),
|
|
177
|
+
}), g("enter", "Enter", {
|
|
167
178
|
width: "wide",
|
|
168
179
|
class: "mobile-keyboard-key-bottom-enter"
|
|
169
|
-
})]),
|
|
180
|
+
})]), Ke = u(() => rt.map((e) => g(e.action, e.label, {
|
|
170
181
|
class: `mobile-keyboard-direction-key mobile-keyboard-direction-key-${e.position}`
|
|
171
|
-
}))),
|
|
172
|
-
var t =
|
|
173
|
-
return t.$$click = (r) =>
|
|
174
|
-
var
|
|
175
|
-
return
|
|
182
|
+
}))), f = (e) => (() => {
|
|
183
|
+
var t = Ne();
|
|
184
|
+
return t.$$click = (r) => Ee(e, r), t.addEventListener("pointercancel", $e), t.$$pointerup = (r) => Ie(e, r), t.$$pointerdown = (r) => _e(e, r), l(t, () => e.label), ae((r) => {
|
|
185
|
+
var n = q("mobile-keyboard-key", e.kind === "terminal" && "mobile-keyboard-key-terminal", e.kind === "modifier" && "mobile-keyboard-key-modifier", e.kind === "mode" && "mobile-keyboard-key-mode", e.width === "wide" && "mobile-keyboard-key-wide", e.width === "space" && "mobile-keyboard-key-space", e.active && "mobile-keyboard-key-active", me().has(e.keyId) && "mobile-keyboard-key-pressed", e.class), a = e.active;
|
|
186
|
+
return n !== r.e && se(t, r.e = n), a !== r.t && Ae(t, "aria-pressed", r.t = a), r;
|
|
176
187
|
}, {
|
|
177
188
|
e: void 0,
|
|
178
189
|
t: void 0
|
|
179
190
|
}), t;
|
|
180
|
-
})(),
|
|
191
|
+
})(), te = () => p(z, {
|
|
181
192
|
get when() {
|
|
182
|
-
return
|
|
193
|
+
return i.onDismiss;
|
|
183
194
|
},
|
|
184
195
|
get children() {
|
|
185
|
-
var e =
|
|
186
|
-
return
|
|
196
|
+
var e = ze();
|
|
197
|
+
return V(e, N(Y, {
|
|
187
198
|
type: "button",
|
|
188
199
|
class: "mobile-keyboard-dismiss",
|
|
189
200
|
"aria-label": "Close keyboard",
|
|
190
201
|
onPointerDown: (t) => {
|
|
191
|
-
|
|
202
|
+
de(t), t.stopPropagation();
|
|
192
203
|
},
|
|
193
204
|
onClick: (t) => {
|
|
194
|
-
t.stopPropagation(),
|
|
205
|
+
t.stopPropagation(), i.onDismiss?.();
|
|
195
206
|
}
|
|
196
207
|
}), !1, !0), e;
|
|
197
208
|
}
|
|
198
209
|
});
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
}),
|
|
202
|
-
|
|
210
|
+
return ne(() => {
|
|
211
|
+
i.visible || fe();
|
|
212
|
+
}), ne(() => {
|
|
213
|
+
if (typeof window > "u" || !i.visible) {
|
|
214
|
+
G({});
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const e = () => {
|
|
218
|
+
G(He(Ve({
|
|
219
|
+
innerWidth: window.innerWidth,
|
|
220
|
+
innerHeight: window.innerHeight,
|
|
221
|
+
visualViewport: window.visualViewport
|
|
222
|
+
})));
|
|
223
|
+
};
|
|
224
|
+
e();
|
|
225
|
+
const t = window.visualViewport;
|
|
226
|
+
window.addEventListener("resize", e), window.addEventListener("orientationchange", e), t?.addEventListener("resize", e), t?.addEventListener("scroll", e), ce(() => {
|
|
227
|
+
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e), t?.removeEventListener("resize", e), t?.removeEventListener("scroll", e);
|
|
228
|
+
});
|
|
229
|
+
}), ce(() => {
|
|
230
|
+
P(), X();
|
|
203
231
|
}), (() => {
|
|
204
|
-
var e =
|
|
205
|
-
|
|
232
|
+
var e = Ye(), t = e.firstChild, r = t.firstChild, n = r.nextSibling, a = n.firstChild, Re = a.firstChild, re = a.nextSibling, K = re.nextSibling, H = K.firstChild;
|
|
233
|
+
V(e, N(Y, {
|
|
206
234
|
get class() {
|
|
207
|
-
return
|
|
235
|
+
return q("mobile-keyboard-root", i.visible && "mobile-keyboard-visible", i.class);
|
|
236
|
+
},
|
|
237
|
+
get style() {
|
|
238
|
+
return ue();
|
|
208
239
|
},
|
|
209
240
|
get "aria-hidden"() {
|
|
210
|
-
return !
|
|
241
|
+
return !i.visible;
|
|
211
242
|
},
|
|
212
243
|
role: "group",
|
|
213
244
|
"aria-label": "Mobile terminal keyboard"
|
|
214
|
-
},
|
|
215
|
-
var
|
|
216
|
-
return typeof
|
|
245
|
+
}, $), !1, !0);
|
|
246
|
+
var ie = O;
|
|
247
|
+
return typeof ie == "function" ? Ce(ie, t) : O = t, l(r, () => w()?.label ?? ""), l(n, p(z, {
|
|
217
248
|
get when() {
|
|
218
|
-
return
|
|
249
|
+
return M().length > 0;
|
|
219
250
|
},
|
|
220
251
|
get children() {
|
|
221
|
-
var
|
|
222
|
-
return l(
|
|
252
|
+
var o = qe(), m = o.firstChild;
|
|
253
|
+
return l(m, p(_, {
|
|
223
254
|
get each() {
|
|
224
|
-
return
|
|
255
|
+
return M();
|
|
225
256
|
},
|
|
226
|
-
children: (
|
|
227
|
-
var
|
|
228
|
-
return
|
|
257
|
+
children: (s) => (() => {
|
|
258
|
+
var k = Ue();
|
|
259
|
+
return V(k, N(Y, {
|
|
229
260
|
type: "button",
|
|
230
261
|
class: "mobile-keyboard-suggestion",
|
|
231
262
|
get "data-kind"() {
|
|
232
|
-
return
|
|
263
|
+
return s.kind;
|
|
233
264
|
},
|
|
234
265
|
get title() {
|
|
235
|
-
return
|
|
266
|
+
return s.detail ?? s.label;
|
|
236
267
|
},
|
|
237
268
|
get "aria-label"() {
|
|
238
|
-
return
|
|
269
|
+
return oe(() => !!s.detail)() ? `${s.label} (${s.detail})` : s.label;
|
|
239
270
|
},
|
|
240
|
-
onPointerDown:
|
|
241
|
-
onClick: () =>
|
|
242
|
-
}), !1, !0), l(
|
|
271
|
+
onPointerDown: de,
|
|
272
|
+
onClick: () => i.onSuggestionSelect?.(s)
|
|
273
|
+
}), !1, !0), l(k, () => s.label), k;
|
|
243
274
|
})()
|
|
244
|
-
})), l(
|
|
275
|
+
})), l(o, te, null), o;
|
|
245
276
|
}
|
|
246
|
-
}),
|
|
277
|
+
}), a), l(Re, p(_, {
|
|
247
278
|
get each() {
|
|
248
|
-
return
|
|
279
|
+
return Se();
|
|
249
280
|
},
|
|
250
|
-
children: (
|
|
251
|
-
})), l(
|
|
281
|
+
children: (o) => f(o)
|
|
282
|
+
})), l(a, p(z, {
|
|
252
283
|
get when() {
|
|
253
|
-
return
|
|
284
|
+
return oe(() => !!i.onDismiss)() && M().length === 0;
|
|
254
285
|
},
|
|
255
286
|
get children() {
|
|
256
|
-
return
|
|
287
|
+
return te();
|
|
257
288
|
}
|
|
258
|
-
}), null), l(
|
|
289
|
+
}), null), l(re, p(_, {
|
|
259
290
|
get each() {
|
|
260
|
-
return
|
|
291
|
+
return Pe();
|
|
261
292
|
},
|
|
262
|
-
children: (
|
|
263
|
-
var
|
|
264
|
-
return l(
|
|
265
|
-
each:
|
|
266
|
-
children: (
|
|
267
|
-
})),
|
|
293
|
+
children: (o) => (() => {
|
|
294
|
+
var m = je();
|
|
295
|
+
return l(m, p(_, {
|
|
296
|
+
each: o,
|
|
297
|
+
children: (s) => f(s)
|
|
298
|
+
})), m;
|
|
268
299
|
})()
|
|
269
|
-
})), l(
|
|
300
|
+
})), l(K, () => f(B()[0]), H), l(K, () => f(B()[1]), H), l(H, p(_, {
|
|
270
301
|
get each() {
|
|
271
|
-
return
|
|
302
|
+
return Ke();
|
|
272
303
|
},
|
|
273
|
-
children: (
|
|
274
|
-
})), l(
|
|
275
|
-
var
|
|
276
|
-
return
|
|
304
|
+
children: (o) => f(o)
|
|
305
|
+
})), l(K, () => f(B()[2]), null), ae((o) => {
|
|
306
|
+
var m = q("mobile-keyboard-popup", w()?.visible && "mobile-keyboard-popup-visible"), s = `${w()?.left ?? 0}px`, k = `${w()?.top ?? 0}px`;
|
|
307
|
+
return m !== o.e && se(r, o.e = m), s !== o.t && le(r, "left", o.t = s), k !== o.a && le(r, "top", o.a = k), o;
|
|
277
308
|
}, {
|
|
278
309
|
e: void 0,
|
|
279
310
|
t: void 0,
|
|
@@ -281,7 +312,7 @@ function it(le) {
|
|
|
281
312
|
}), e;
|
|
282
313
|
})();
|
|
283
314
|
}
|
|
284
|
-
|
|
315
|
+
Le(["pointerdown", "pointerup", "click"]);
|
|
285
316
|
export {
|
|
286
|
-
|
|
317
|
+
bt as MobileKeyboard
|
|
287
318
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface MobileKeyboardViewportSource {
|
|
2
|
+
innerWidth: number;
|
|
3
|
+
innerHeight: number;
|
|
4
|
+
visualViewport?: {
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
offsetLeft?: number;
|
|
8
|
+
offsetTop?: number;
|
|
9
|
+
} | null;
|
|
10
|
+
}
|
|
11
|
+
export interface MobileKeyboardViewportMetrics {
|
|
12
|
+
leftPx: number;
|
|
13
|
+
bottomPx: number;
|
|
14
|
+
widthPx: number;
|
|
15
|
+
heightPx: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveMobileKeyboardViewportMetrics(source: MobileKeyboardViewportSource): MobileKeyboardViewportMetrics;
|
|
18
|
+
export declare function buildMobileKeyboardViewportStyle(metrics: MobileKeyboardViewportMetrics): Record<string, string>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function n(t) {
|
|
2
|
+
return Math.round(t * 1e3) / 1e3;
|
|
3
|
+
}
|
|
4
|
+
function i(t, o, e) {
|
|
5
|
+
return Math.min(e, Math.max(o, t));
|
|
6
|
+
}
|
|
7
|
+
function x(t, o) {
|
|
8
|
+
return Number.isFinite(t) ? Number(t) : o;
|
|
9
|
+
}
|
|
10
|
+
function a(t, o) {
|
|
11
|
+
const e = x(t, o);
|
|
12
|
+
return e <= 0 ? Math.max(0, n(o)) : n(e);
|
|
13
|
+
}
|
|
14
|
+
function l(t) {
|
|
15
|
+
const o = Math.max(0, a(t.innerWidth, 0)), e = Math.max(0, a(t.innerHeight, 0)), r = t.visualViewport ?? null, u = i(
|
|
16
|
+
a(r?.width, o),
|
|
17
|
+
0,
|
|
18
|
+
o || Number.POSITIVE_INFINITY
|
|
19
|
+
), h = i(
|
|
20
|
+
a(r?.height, e),
|
|
21
|
+
0,
|
|
22
|
+
e || Number.POSITIVE_INFINITY
|
|
23
|
+
), P = Math.max(0, o - u), b = Math.max(0, e - h), m = i(n(x(r?.offsetLeft, 0)), 0, P), I = i(n(x(r?.offsetTop, 0)), 0, b), p = i(n(e - (I + h)), 0, e);
|
|
24
|
+
return {
|
|
25
|
+
leftPx: m,
|
|
26
|
+
bottomPx: p,
|
|
27
|
+
widthPx: u,
|
|
28
|
+
heightPx: h
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function s(t) {
|
|
32
|
+
return {
|
|
33
|
+
"--mobile-keyboard-viewport-left": `${t.leftPx}px`,
|
|
34
|
+
"--mobile-keyboard-viewport-bottom": `${t.bottomPx}px`,
|
|
35
|
+
"--mobile-keyboard-viewport-width": `${t.widthPx}px`,
|
|
36
|
+
"--mobile-keyboard-viewport-height": `${t.heightPx}px`
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
s as buildMobileKeyboardViewportStyle,
|
|
41
|
+
l as resolveMobileKeyboardViewportMetrics
|
|
42
|
+
};
|