@floegence/floe-webapp-core 0.35.7 → 0.35.8
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/dist/components/ui/MobileKeyboard.d.ts +22 -0
- package/dist/components/ui/MobileKeyboard.js +287 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/mobileKeyboardModel.d.ts +24 -0
- package/dist/components/ui/mobileKeyboardModel.js +103 -0
- package/dist/floe.css +12 -0
- package/dist/full.d.ts +1 -0
- package/dist/full.js +546 -509
- package/dist/styles.css +1 -1
- package/dist/terminal/editorModel.d.ts +7 -0
- package/dist/terminal/editorModel.js +84 -0
- package/dist/terminal/mockRuntime.d.ts +2 -0
- package/dist/terminal/mockRuntime.js +287 -0
- package/dist/terminal/sessionModel.d.ts +37 -0
- package/dist/terminal/sessionModel.js +143 -0
- package/dist/terminal/suggestionEngine.d.ts +64 -0
- package/dist/terminal/suggestionEngine.js +1020 -0
- package/dist/terminal/types.d.ts +44 -0
- package/dist/terminal/workspaceProfile.d.ts +3 -0
- package/dist/terminal/workspaceProfile.js +30 -0
- package/dist/terminal.d.ts +6 -0
- package/dist/terminal.js +36 -0
- package/dist/ui.css +488 -0
- package/dist/ui.js +44 -42
- package/dist/utils/touchSurfaceGuard.d.ts +9 -0
- package/dist/utils/touchSurfaceGuard.js +16 -0
- package/dist/widgets/TerminalWidget.d.ts +17 -1
- package/dist/widgets/TerminalWidget.js +160 -65
- package/dist/widgets/index.d.ts +1 -1
- package/dist/widgets.js +5 -4
- package/package.json +5 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
export interface MobileKeyboardSuggestionItem {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
detail?: string;
|
|
6
|
+
kind?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MobileKeyboardProps<TSuggestion extends MobileKeyboardSuggestionItem = MobileKeyboardSuggestionItem> extends JSX.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
/** Whether the keyboard is visible */
|
|
10
|
+
visible: boolean;
|
|
11
|
+
/** Called whenever a key resolves to a terminal payload */
|
|
12
|
+
onKey?: (key: string) => void;
|
|
13
|
+
/** Called when the user dismisses the keyboard from the built-in control */
|
|
14
|
+
onDismiss?: () => void;
|
|
15
|
+
/** Additional terminal-friendly quick insert keys shown in the utility strip */
|
|
16
|
+
quickInserts?: readonly string[];
|
|
17
|
+
/** Optional terminal suggestions shown in a dedicated candidate rail */
|
|
18
|
+
suggestions?: readonly TSuggestion[];
|
|
19
|
+
/** Called when the user picks one of the terminal suggestions */
|
|
20
|
+
onSuggestionSelect?: (suggestion: TSuggestion) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function MobileKeyboard<TSuggestion extends MobileKeyboardSuggestionItem = MobileKeyboardSuggestionItem>(props: MobileKeyboardProps<TSuggestion>): JSX.Element;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { spread as B, mergeProps as N, insert as l, createComponent as b, memo as te, effect as re, className as ae, setStyleProperty as ie, template as f, setAttribute as $e, use as Se, delegateEvents as Re } from "solid-js/web";
|
|
2
|
+
import { splitProps as Ee, createSignal as u, createMemo as k, createEffect as Ae, onCleanup as Ke, Show as W, For as _ } from "solid-js";
|
|
3
|
+
import { cn as H } from "../../utils/cn.js";
|
|
4
|
+
import { isRepeatableTerminalAction as Ce, DEFAULT_MOBILE_KEYBOARD_QUICK_INSERTS as Oe, applyTerminalModifiers as De, createMobileKeyboardPressTracker as Le, mapTerminalActionToKey as Me } from "./mobileKeyboardModel.js";
|
|
5
|
+
import { floeTouchSurfaceAttrs as q, preventTouchSurfacePointerDown as oe } from "../../utils/touchSurfaceGuard.js";
|
|
6
|
+
var xe = /* @__PURE__ */ f("<button type=button>"), Be = /* @__PURE__ */ f("<button>Hide"), Ne = /* @__PURE__ */ f('<div class=mobile-keyboard-rail-shell><div class=mobile-keyboard-suggestion-rail role=list aria-label="Terminal suggestions">'), We = /* @__PURE__ */ f('<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">'), He = /* @__PURE__ */ f("<button>"), qe = /* @__PURE__ */ f("<div class=mobile-keyboard-row>");
|
|
7
|
+
const Ye = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"], Ue = ["a", "s", "d", "f", "g", "h", "j", "k", "l"], ze = ["z", "x", "c", "v", "b", "n", "m"], Fe = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"], je = ["@", "#", "$", "%", "&", "*", "(", ")", "[", "]"], Qe = ["+", "=", "{", "}", ".", ",", "?", "!", "'"], Ve = [{
|
|
8
|
+
action: "escape",
|
|
9
|
+
label: "Esc"
|
|
10
|
+
}, {
|
|
11
|
+
action: "tab",
|
|
12
|
+
label: "Tab"
|
|
13
|
+
}], Ge = [{
|
|
14
|
+
action: "arrow-up",
|
|
15
|
+
label: "↑",
|
|
16
|
+
position: "up"
|
|
17
|
+
}, {
|
|
18
|
+
action: "arrow-left",
|
|
19
|
+
label: "←",
|
|
20
|
+
position: "left"
|
|
21
|
+
}, {
|
|
22
|
+
action: "arrow-down",
|
|
23
|
+
label: "↓",
|
|
24
|
+
position: "down"
|
|
25
|
+
}, {
|
|
26
|
+
action: "arrow-right",
|
|
27
|
+
label: "→",
|
|
28
|
+
position: "right"
|
|
29
|
+
}], Je = 320, Xe = 68;
|
|
30
|
+
function it(le) {
|
|
31
|
+
const [n, se] = Ee(le, ["visible", "onKey", "onDismiss", "quickInserts", "suggestions", "onSuggestionSelect", "class"]), [g, Y] = u("letters"), [U, S] = u(!1), [z, R] = u(!1), [F, E] = u(!1), [ne, j] = u([]), [h, A] = u(null), ce = k(() => new Set(ne()));
|
|
32
|
+
let K, v;
|
|
33
|
+
const c = Le(), I = /* @__PURE__ */ new Map(), de = () => n.quickInserts ?? Oe, C = k(() => n.suggestions ?? []), Q = () => {
|
|
34
|
+
S(!1), R(!1), E(!1);
|
|
35
|
+
}, P = () => {
|
|
36
|
+
v && (clearTimeout(v), v = void 0);
|
|
37
|
+
}, O = () => {
|
|
38
|
+
j(c.getPressedKeyIds());
|
|
39
|
+
}, T = (e) => {
|
|
40
|
+
const t = I.get(e);
|
|
41
|
+
t && (t.delayTimer && clearTimeout(t.delayTimer), t.intervalTimer && clearInterval(t.intervalTimer), I.delete(e));
|
|
42
|
+
}, V = () => {
|
|
43
|
+
for (const e of I.keys())
|
|
44
|
+
T(e);
|
|
45
|
+
}, be = () => {
|
|
46
|
+
Y("letters"), Q(), c.reset(), j([]), A(null), P(), V();
|
|
47
|
+
}, G = (e) => {
|
|
48
|
+
e && n.onKey?.(e);
|
|
49
|
+
}, pe = (e) => {
|
|
50
|
+
G(De(e, {
|
|
51
|
+
ctrl: U(),
|
|
52
|
+
alt: z()
|
|
53
|
+
})), Q();
|
|
54
|
+
}, me = (e) => {
|
|
55
|
+
G(Me(e)), S(!1), R(!1);
|
|
56
|
+
}, D = (e) => g() !== "letters" ? e : F() ? e.toUpperCase() : e, ye = (e) => {
|
|
57
|
+
switch (e) {
|
|
58
|
+
case "ctrl":
|
|
59
|
+
S((t) => !t);
|
|
60
|
+
return;
|
|
61
|
+
case "alt":
|
|
62
|
+
R((t) => !t);
|
|
63
|
+
return;
|
|
64
|
+
case "shift":
|
|
65
|
+
E((t) => !t);
|
|
66
|
+
}
|
|
67
|
+
}, ue = (e) => {
|
|
68
|
+
Y(e), E(!1);
|
|
69
|
+
}, ke = (e, t, r) => {
|
|
70
|
+
const s = K?.getBoundingClientRect(), i = r.getBoundingClientRect();
|
|
71
|
+
P(), s && A({
|
|
72
|
+
pointerId: e,
|
|
73
|
+
label: t,
|
|
74
|
+
left: i.left - s.left + i.width / 2,
|
|
75
|
+
top: i.top - s.top,
|
|
76
|
+
visible: !0
|
|
77
|
+
});
|
|
78
|
+
}, J = (e) => {
|
|
79
|
+
h()?.pointerId === e && (P(), v = setTimeout(() => {
|
|
80
|
+
A((t) => t?.pointerId === e ? {
|
|
81
|
+
...t,
|
|
82
|
+
visible: !1
|
|
83
|
+
} : t), v = void 0;
|
|
84
|
+
}, 100));
|
|
85
|
+
}, fe = (e, t, r, s) => {
|
|
86
|
+
if (T(e), !r || typeof window > "u") return;
|
|
87
|
+
const i = {};
|
|
88
|
+
I.set(e, i), i.delayTimer = setTimeout(() => {
|
|
89
|
+
i.delayTimer = void 0, c.hasPress(e, t) && (c.markRepeated(e), s(), i.intervalTimer = setInterval(() => {
|
|
90
|
+
if (!c.hasPress(e, t)) {
|
|
91
|
+
T(e);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
s();
|
|
95
|
+
}, Xe));
|
|
96
|
+
}, Je);
|
|
97
|
+
}, he = (e, t) => {
|
|
98
|
+
t.preventDefault(), t.currentTarget.setPointerCapture?.(t.pointerId), c.startPress(t.pointerId, e.keyId), O(), ke(t.pointerId, e.label, t.currentTarget), fe(t.pointerId, e.keyId, e.repeatable, e.activate);
|
|
99
|
+
}, ve = (e, t) => {
|
|
100
|
+
t.currentTarget.releasePointerCapture?.(t.pointerId), T(t.pointerId);
|
|
101
|
+
const r = c.finishPress(t.pointerId, e.keyId);
|
|
102
|
+
O(), J(t.pointerId), r.shouldActivate && e.activate();
|
|
103
|
+
}, Te = (e) => {
|
|
104
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId), T(e.pointerId), c.cancelPress(e.pointerId), O(), J(e.pointerId);
|
|
105
|
+
}, we = (e, t) => {
|
|
106
|
+
t.detail === 0 && e.activate();
|
|
107
|
+
}, d = (e, t) => ({
|
|
108
|
+
keyId: t?.keyId ?? `text-${e}`,
|
|
109
|
+
label: t?.label ?? e,
|
|
110
|
+
repeatable: !1,
|
|
111
|
+
activate: () => pe(e),
|
|
112
|
+
width: t?.width,
|
|
113
|
+
class: t?.class,
|
|
114
|
+
kind: "text"
|
|
115
|
+
}), w = (e, t, r) => ({
|
|
116
|
+
keyId: r?.keyId ?? `action-${e}`,
|
|
117
|
+
label: t,
|
|
118
|
+
repeatable: r?.repeatable ?? Ce(e),
|
|
119
|
+
activate: () => me(e),
|
|
120
|
+
width: r?.width,
|
|
121
|
+
class: r?.class,
|
|
122
|
+
kind: "terminal"
|
|
123
|
+
}), L = (e, t, r) => ({
|
|
124
|
+
keyId: `modifier-${e}`,
|
|
125
|
+
label: t,
|
|
126
|
+
repeatable: !1,
|
|
127
|
+
activate: () => ye(e),
|
|
128
|
+
width: e === "shift" ? "wide" : "normal",
|
|
129
|
+
active: e === "ctrl" ? U() : e === "alt" ? z() : F(),
|
|
130
|
+
kind: "modifier",
|
|
131
|
+
class: r?.class
|
|
132
|
+
}), _e = k(() => [...Ve.map((e) => w(e.action, e.label, {
|
|
133
|
+
class: "mobile-keyboard-key-compact"
|
|
134
|
+
})), L("ctrl", "Ctrl", {
|
|
135
|
+
class: "mobile-keyboard-key-compact"
|
|
136
|
+
}), L("alt", "Alt", {
|
|
137
|
+
class: "mobile-keyboard-key-compact"
|
|
138
|
+
}), ...de().map((e) => d(e, {
|
|
139
|
+
keyId: `quick-${e}`,
|
|
140
|
+
class: "mobile-keyboard-key-compact mobile-keyboard-key-utility"
|
|
141
|
+
}))]), ge = k(() => g() === "symbols" ? [Fe.map((e) => d(e)), je.map((e) => d(e)), [...Qe.map((e) => d(e)), w("backspace", "⌫", {
|
|
142
|
+
width: "wide",
|
|
143
|
+
class: "mobile-keyboard-key-backspace"
|
|
144
|
+
})]] : [Ye.map((e) => d(D(e), {
|
|
145
|
+
keyId: `letter-${e}`
|
|
146
|
+
})), Ue.map((e) => d(D(e), {
|
|
147
|
+
keyId: `letter-${e}`
|
|
148
|
+
})), [L("shift", "Shift"), ...ze.map((e) => d(D(e), {
|
|
149
|
+
keyId: `letter-${e}`
|
|
150
|
+
})), w("backspace", "⌫", {
|
|
151
|
+
width: "wide",
|
|
152
|
+
class: "mobile-keyboard-key-backspace"
|
|
153
|
+
})]]), M = k(() => [{
|
|
154
|
+
keyId: "mode-switch",
|
|
155
|
+
label: g() === "letters" ? "123" : "ABC",
|
|
156
|
+
repeatable: !1,
|
|
157
|
+
activate: () => ue(g() === "letters" ? "symbols" : "letters"),
|
|
158
|
+
width: "wide",
|
|
159
|
+
kind: "mode",
|
|
160
|
+
class: "mobile-keyboard-key-bottom-mode"
|
|
161
|
+
}, d(" ", {
|
|
162
|
+
keyId: "space",
|
|
163
|
+
label: "Space",
|
|
164
|
+
width: "space",
|
|
165
|
+
class: "mobile-keyboard-key-bottom-space"
|
|
166
|
+
}), w("enter", "Enter", {
|
|
167
|
+
width: "wide",
|
|
168
|
+
class: "mobile-keyboard-key-bottom-enter"
|
|
169
|
+
})]), Ie = k(() => Ge.map((e) => w(e.action, e.label, {
|
|
170
|
+
class: `mobile-keyboard-direction-key mobile-keyboard-direction-key-${e.position}`
|
|
171
|
+
}))), m = (e) => (() => {
|
|
172
|
+
var t = xe();
|
|
173
|
+
return t.$$click = (r) => we(e, r), t.addEventListener("pointercancel", Te), t.$$pointerup = (r) => ve(e, r), t.$$pointerdown = (r) => he(e, r), l(t, () => e.label), re((r) => {
|
|
174
|
+
var s = H("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", ce().has(e.keyId) && "mobile-keyboard-key-pressed", e.class), i = e.active;
|
|
175
|
+
return s !== r.e && ae(t, r.e = s), i !== r.t && $e(t, "aria-pressed", r.t = i), r;
|
|
176
|
+
}, {
|
|
177
|
+
e: void 0,
|
|
178
|
+
t: void 0
|
|
179
|
+
}), t;
|
|
180
|
+
})(), X = () => b(W, {
|
|
181
|
+
get when() {
|
|
182
|
+
return n.onDismiss;
|
|
183
|
+
},
|
|
184
|
+
get children() {
|
|
185
|
+
var e = Be();
|
|
186
|
+
return B(e, N(q, {
|
|
187
|
+
type: "button",
|
|
188
|
+
class: "mobile-keyboard-dismiss",
|
|
189
|
+
"aria-label": "Close keyboard",
|
|
190
|
+
onPointerDown: (t) => {
|
|
191
|
+
oe(t), t.stopPropagation();
|
|
192
|
+
},
|
|
193
|
+
onClick: (t) => {
|
|
194
|
+
t.stopPropagation(), n.onDismiss?.();
|
|
195
|
+
}
|
|
196
|
+
}), !1, !0), e;
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return Ae(() => {
|
|
200
|
+
n.visible || be();
|
|
201
|
+
}), Ke(() => {
|
|
202
|
+
P(), V();
|
|
203
|
+
}), (() => {
|
|
204
|
+
var e = We(), t = e.firstChild, r = t.firstChild, s = r.nextSibling, i = s.firstChild, Pe = i.firstChild, Z = i.nextSibling, $ = Z.nextSibling, x = $.firstChild;
|
|
205
|
+
B(e, N(q, {
|
|
206
|
+
get class() {
|
|
207
|
+
return H("mobile-keyboard-root", n.visible && "mobile-keyboard-visible", n.class);
|
|
208
|
+
},
|
|
209
|
+
get "aria-hidden"() {
|
|
210
|
+
return !n.visible;
|
|
211
|
+
},
|
|
212
|
+
role: "group",
|
|
213
|
+
"aria-label": "Mobile terminal keyboard"
|
|
214
|
+
}, se), !1, !0);
|
|
215
|
+
var ee = K;
|
|
216
|
+
return typeof ee == "function" ? Se(ee, t) : K = t, l(r, () => h()?.label ?? ""), l(s, b(W, {
|
|
217
|
+
get when() {
|
|
218
|
+
return C().length > 0;
|
|
219
|
+
},
|
|
220
|
+
get children() {
|
|
221
|
+
var a = Ne(), p = a.firstChild;
|
|
222
|
+
return l(p, b(_, {
|
|
223
|
+
get each() {
|
|
224
|
+
return C();
|
|
225
|
+
},
|
|
226
|
+
children: (o) => (() => {
|
|
227
|
+
var y = He();
|
|
228
|
+
return B(y, N(q, {
|
|
229
|
+
type: "button",
|
|
230
|
+
class: "mobile-keyboard-suggestion",
|
|
231
|
+
get "data-kind"() {
|
|
232
|
+
return o.kind;
|
|
233
|
+
},
|
|
234
|
+
get title() {
|
|
235
|
+
return o.detail ?? o.label;
|
|
236
|
+
},
|
|
237
|
+
get "aria-label"() {
|
|
238
|
+
return te(() => !!o.detail)() ? `${o.label} (${o.detail})` : o.label;
|
|
239
|
+
},
|
|
240
|
+
onPointerDown: oe,
|
|
241
|
+
onClick: () => n.onSuggestionSelect?.(o)
|
|
242
|
+
}), !1, !0), l(y, () => o.label), y;
|
|
243
|
+
})()
|
|
244
|
+
})), l(a, X, null), a;
|
|
245
|
+
}
|
|
246
|
+
}), i), l(Pe, b(_, {
|
|
247
|
+
get each() {
|
|
248
|
+
return _e();
|
|
249
|
+
},
|
|
250
|
+
children: (a) => m(a)
|
|
251
|
+
})), l(i, b(W, {
|
|
252
|
+
get when() {
|
|
253
|
+
return te(() => !!n.onDismiss)() && C().length === 0;
|
|
254
|
+
},
|
|
255
|
+
get children() {
|
|
256
|
+
return X();
|
|
257
|
+
}
|
|
258
|
+
}), null), l(Z, b(_, {
|
|
259
|
+
get each() {
|
|
260
|
+
return ge();
|
|
261
|
+
},
|
|
262
|
+
children: (a) => (() => {
|
|
263
|
+
var p = qe();
|
|
264
|
+
return l(p, b(_, {
|
|
265
|
+
each: a,
|
|
266
|
+
children: (o) => m(o)
|
|
267
|
+
})), p;
|
|
268
|
+
})()
|
|
269
|
+
})), l($, () => m(M()[0]), x), l($, () => m(M()[1]), x), l(x, b(_, {
|
|
270
|
+
get each() {
|
|
271
|
+
return Ie();
|
|
272
|
+
},
|
|
273
|
+
children: (a) => m(a)
|
|
274
|
+
})), l($, () => m(M()[2]), null), re((a) => {
|
|
275
|
+
var p = H("mobile-keyboard-popup", h()?.visible && "mobile-keyboard-popup-visible"), o = `${h()?.left ?? 0}px`, y = `${h()?.top ?? 0}px`;
|
|
276
|
+
return p !== a.e && ae(r, a.e = p), o !== a.t && ie(r, "left", a.t = o), y !== a.a && ie(r, "top", a.a = y), a;
|
|
277
|
+
}, {
|
|
278
|
+
e: void 0,
|
|
279
|
+
t: void 0,
|
|
280
|
+
a: void 0
|
|
281
|
+
}), e;
|
|
282
|
+
})();
|
|
283
|
+
}
|
|
284
|
+
Re(["pointerdown", "pointerup", "click"]);
|
|
285
|
+
export {
|
|
286
|
+
it as MobileKeyboard
|
|
287
|
+
};
|
|
@@ -22,4 +22,5 @@ export { Switch, type SwitchProps, type SwitchSize } from './Switch';
|
|
|
22
22
|
export { SegmentedControl, type SegmentedControlProps, type SegmentedControlOption, type SegmentedControlSize, } from './SegmentedControl';
|
|
23
23
|
export { Checkbox, CheckboxGroup, CheckboxList, type CheckboxProps, type CheckboxGroupProps, type CheckboxListProps, type CheckboxSize, type CheckboxVariant, } from './Checkbox';
|
|
24
24
|
export { Pagination, type PaginationProps, type PaginationSize, type PaginationVariant, } from './Pagination';
|
|
25
|
+
export { MobileKeyboard, type MobileKeyboardProps, type MobileKeyboardSuggestionItem, } from './MobileKeyboard';
|
|
25
26
|
export { LinearProgress, CircularProgress, SegmentedProgress, StepsProgress, type LinearProgressProps, type CircularProgressProps, type SegmentedProgressProps, type StepsProgressProps, type ProgressSize, type ProgressColor, } from './Progress';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type MobileKeyboardAction = 'escape' | 'tab' | 'enter' | 'backspace' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right';
|
|
2
|
+
export type MobileKeyboardLayout = 'letters' | 'symbols';
|
|
3
|
+
export interface MobileKeyboardModifierState {
|
|
4
|
+
ctrl: boolean;
|
|
5
|
+
alt: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface MobileKeyboardPressResolution {
|
|
8
|
+
keyId: string | null;
|
|
9
|
+
shouldActivate: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_MOBILE_KEYBOARD_QUICK_INSERTS: string[];
|
|
12
|
+
export declare function applyTerminalModifiers(text: string, modifiers: MobileKeyboardModifierState): string;
|
|
13
|
+
export declare function mapTerminalActionToKey(action: MobileKeyboardAction): string;
|
|
14
|
+
export declare function isRepeatableTerminalAction(action: MobileKeyboardAction): boolean;
|
|
15
|
+
export declare function createMobileKeyboardPressTracker(): {
|
|
16
|
+
startPress(pointerId: number, keyId: string): void;
|
|
17
|
+
markRepeated(pointerId: number): boolean;
|
|
18
|
+
finishPress(pointerId: number, keyId: string): MobileKeyboardPressResolution;
|
|
19
|
+
cancelPress(pointerId: number): string | null;
|
|
20
|
+
hasPress(pointerId: number, keyId?: string): boolean;
|
|
21
|
+
isPressed(keyId: string): boolean;
|
|
22
|
+
getPressedKeyIds(): string[];
|
|
23
|
+
reset(): void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const u = ["|", "/", "-", "_", "~"];
|
|
2
|
+
function o(r, s) {
|
|
3
|
+
if (!r) return "";
|
|
4
|
+
let c = r;
|
|
5
|
+
if (s.ctrl && r.length === 1) {
|
|
6
|
+
const n = r.toLowerCase().charCodeAt(0);
|
|
7
|
+
n >= 97 && n <= 122 && (c = String.fromCharCode(n - 96));
|
|
8
|
+
}
|
|
9
|
+
return s.alt && (c = `\x1B${c}`), c;
|
|
10
|
+
}
|
|
11
|
+
function i(r) {
|
|
12
|
+
switch (r) {
|
|
13
|
+
case "enter":
|
|
14
|
+
return "\r";
|
|
15
|
+
case "backspace":
|
|
16
|
+
return "";
|
|
17
|
+
case "tab":
|
|
18
|
+
return " ";
|
|
19
|
+
case "escape":
|
|
20
|
+
return "\x1B";
|
|
21
|
+
case "arrow-up":
|
|
22
|
+
return "\x1B[A";
|
|
23
|
+
case "arrow-down":
|
|
24
|
+
return "\x1B[B";
|
|
25
|
+
case "arrow-left":
|
|
26
|
+
return "\x1B[D";
|
|
27
|
+
case "arrow-right":
|
|
28
|
+
return "\x1B[C";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function l(r) {
|
|
32
|
+
switch (r) {
|
|
33
|
+
case "tab":
|
|
34
|
+
case "enter":
|
|
35
|
+
case "backspace":
|
|
36
|
+
case "arrow-up":
|
|
37
|
+
case "arrow-down":
|
|
38
|
+
case "arrow-left":
|
|
39
|
+
case "arrow-right":
|
|
40
|
+
return !0;
|
|
41
|
+
case "escape":
|
|
42
|
+
return !1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function d() {
|
|
46
|
+
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = (e) => {
|
|
47
|
+
s.set(e, (s.get(e) ?? 0) + 1);
|
|
48
|
+
}, n = (e) => {
|
|
49
|
+
const t = (s.get(e) ?? 0) - 1;
|
|
50
|
+
if (t > 0) {
|
|
51
|
+
s.set(e, t);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
s.delete(e);
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
startPress(e, t) {
|
|
58
|
+
const a = r.get(e);
|
|
59
|
+
a && n(a.keyId), r.set(e, {
|
|
60
|
+
keyId: t,
|
|
61
|
+
didRepeat: !1
|
|
62
|
+
}), c(t);
|
|
63
|
+
},
|
|
64
|
+
markRepeated(e) {
|
|
65
|
+
const t = r.get(e);
|
|
66
|
+
return t ? (t.didRepeat = !0, !0) : !1;
|
|
67
|
+
},
|
|
68
|
+
finishPress(e, t) {
|
|
69
|
+
const a = r.get(e);
|
|
70
|
+
return a ? (r.delete(e), n(a.keyId), {
|
|
71
|
+
keyId: a.keyId,
|
|
72
|
+
shouldActivate: a.keyId === t && !a.didRepeat
|
|
73
|
+
}) : {
|
|
74
|
+
keyId: null,
|
|
75
|
+
shouldActivate: !1
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
cancelPress(e) {
|
|
79
|
+
const t = r.get(e);
|
|
80
|
+
return t ? (r.delete(e), n(t.keyId), t.keyId) : null;
|
|
81
|
+
},
|
|
82
|
+
hasPress(e, t) {
|
|
83
|
+
const a = r.get(e);
|
|
84
|
+
return a ? t ? a.keyId === t : !0 : !1;
|
|
85
|
+
},
|
|
86
|
+
isPressed(e) {
|
|
87
|
+
return s.has(e);
|
|
88
|
+
},
|
|
89
|
+
getPressedKeyIds() {
|
|
90
|
+
return [...s.keys()];
|
|
91
|
+
},
|
|
92
|
+
reset() {
|
|
93
|
+
r.clear(), s.clear();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
u as DEFAULT_MOBILE_KEYBOARD_QUICK_INSERTS,
|
|
99
|
+
o as applyTerminalModifiers,
|
|
100
|
+
d as createMobileKeyboardPressTracker,
|
|
101
|
+
l as isRepeatableTerminalAction,
|
|
102
|
+
i as mapTerminalActionToKey
|
|
103
|
+
};
|
package/dist/floe.css
CHANGED
|
@@ -321,6 +321,18 @@
|
|
|
321
321
|
user-select: none;
|
|
322
322
|
-webkit-touch-callout: none;
|
|
323
323
|
}
|
|
324
|
+
|
|
325
|
+
[data-floe-touch-surface='true'],
|
|
326
|
+
[data-floe-touch-surface='true'] * {
|
|
327
|
+
-webkit-user-select: none;
|
|
328
|
+
user-select: none;
|
|
329
|
+
-webkit-touch-callout: none;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
[data-floe-touch-surface='true'] {
|
|
333
|
+
-webkit-tap-highlight-color: transparent;
|
|
334
|
+
touch-action: manipulation;
|
|
335
|
+
}
|
|
324
336
|
}
|
|
325
337
|
|
|
326
338
|
/* Animation utilities */
|
package/dist/full.d.ts
CHANGED