@floegence/floe-webapp-core 0.77.0 → 0.77.2
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,5 +1,6 @@
|
|
|
1
1
|
import { type Component } from 'solid-js';
|
|
2
|
-
|
|
2
|
+
import type { ActivityBarItem } from './ActivityBar';
|
|
3
|
+
export interface MobileTabBarItem extends Pick<ActivityBarItem, 'buttonRef' | 'ariaExpanded' | 'ariaControls' | 'ariaHasPopup'> {
|
|
3
4
|
id: string;
|
|
4
5
|
icon: Component<{
|
|
5
6
|
class?: string;
|
|
@@ -1,160 +1,168 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { deferNonBlocking as
|
|
5
|
-
var q = /* @__PURE__ */
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
const [
|
|
9
|
-
let
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
if (
|
|
1
|
+
import { insert as m, createComponent as v, effect as L, className as w, setAttribute as f, template as x, use as E, Dynamic as _, memo as z, delegateEvents as D } from "solid-js/web";
|
|
2
|
+
import { createSignal as $, onMount as F, onCleanup as W, Show as S, For as j } from "solid-js";
|
|
3
|
+
import { cn as y } from "../../utils/cn.js";
|
|
4
|
+
import { deferNonBlocking as R } from "../../utils/defer.js";
|
|
5
|
+
var q = /* @__PURE__ */ x('<div class="absolute left-0 top-0 bottom-0 w-8 bg-gradient-to-r from-background to-transparent z-10 pointer-events-none">'), B = /* @__PURE__ */ x('<div class="absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent z-10 pointer-events-none">'), H = /* @__PURE__ */ x('<nav data-floe-shell-slot=mobile-tab-bar style=border-top-color:var(--bottom-bar-border)><div class="relative h-14"><div class="h-full flex items-center overflow-x-auto scrollbar-hide snap-x snap-mandatory"role=tablist aria-orientation=horizontal style=-webkit-overflow-scrolling:touch>'), K = /* @__PURE__ */ x("<span>"), N = /* @__PURE__ */ x('<div class="absolute bottom-0 left-1/2 -translate-x-1/2 w-8 h-0.5 bg-primary rounded-t">'), T = /* @__PURE__ */ x("<button type=button role=tab><div></div><span>");
|
|
6
|
+
function O(e) {
|
|
7
|
+
let l;
|
|
8
|
+
const [I, b] = $(!1), [n, h] = $(!1);
|
|
9
|
+
let c = null;
|
|
10
|
+
const g = () => {
|
|
11
|
+
l && (b(l.scrollLeft > 0), h(l.scrollLeft < l.scrollWidth - l.clientWidth - 1));
|
|
12
|
+
}, t = () => {
|
|
13
|
+
if (c === null) {
|
|
14
14
|
if (typeof requestAnimationFrame > "u") {
|
|
15
|
-
|
|
15
|
+
g();
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
c = requestAnimationFrame(() => {
|
|
19
|
+
c = null, g();
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
|
|
22
|
+
}, o = () => e.items, C = (a) => {
|
|
23
|
+
const i = o()[a];
|
|
24
|
+
if (i) {
|
|
25
|
+
if (i.onClick) {
|
|
26
|
+
R(() => i.onClick());
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
e.onSelect(
|
|
29
|
+
e.onSelect(i.id);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
|
|
32
|
+
return F(() => {
|
|
33
|
+
g();
|
|
34
|
+
const a = e.items.findIndex((i) => i.id === e.activeId);
|
|
35
|
+
if (a > 0 && l) {
|
|
36
|
+
const i = l.scrollWidth / e.items.length;
|
|
37
|
+
l.scrollLeft = Math.max(0, i * a - l.clientWidth / 2 + i / 2);
|
|
38
38
|
}
|
|
39
|
-
}),
|
|
40
|
-
|
|
39
|
+
}), W(() => {
|
|
40
|
+
c !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(c), c = null);
|
|
41
41
|
}), (() => {
|
|
42
|
-
var
|
|
43
|
-
|
|
42
|
+
var a = H(), i = a.firstChild, d = i.firstChild;
|
|
43
|
+
m(i, v(S, {
|
|
44
44
|
get when() {
|
|
45
|
-
return
|
|
45
|
+
return I();
|
|
46
46
|
},
|
|
47
47
|
get children() {
|
|
48
48
|
return q();
|
|
49
49
|
}
|
|
50
|
-
}),
|
|
50
|
+
}), d), m(i, v(S, {
|
|
51
51
|
get when() {
|
|
52
|
-
return
|
|
52
|
+
return n();
|
|
53
53
|
},
|
|
54
54
|
get children() {
|
|
55
55
|
return B();
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
58
|
-
var
|
|
59
|
-
return typeof
|
|
57
|
+
}), d), d.addEventListener("scroll", t);
|
|
58
|
+
var k = l;
|
|
59
|
+
return typeof k == "function" ? E(k, d) : l = d, m(d, v(j, {
|
|
60
60
|
get each() {
|
|
61
61
|
return e.items;
|
|
62
62
|
},
|
|
63
|
-
children: (
|
|
64
|
-
item:
|
|
63
|
+
children: (r, s) => v(P, {
|
|
64
|
+
item: r,
|
|
65
65
|
get isActive() {
|
|
66
|
-
return e.activeId ===
|
|
66
|
+
return e.activeId === r.id;
|
|
67
67
|
},
|
|
68
68
|
get index() {
|
|
69
|
-
return
|
|
69
|
+
return s();
|
|
70
70
|
},
|
|
71
71
|
get itemCount() {
|
|
72
72
|
return e.items.length;
|
|
73
73
|
},
|
|
74
74
|
onClick: () => {
|
|
75
75
|
"vibrate" in navigator && navigator.vibrate(10);
|
|
76
|
-
const
|
|
77
|
-
|
|
76
|
+
const u = r.onClick, A = e.onSelect, M = r.id;
|
|
77
|
+
r.onClick ? R(() => u()) : A(M);
|
|
78
78
|
},
|
|
79
|
-
onKeyboardSelect: (
|
|
79
|
+
onKeyboardSelect: (u) => C(u)
|
|
80
80
|
})
|
|
81
|
-
})),
|
|
82
|
-
var
|
|
81
|
+
})), L((r) => {
|
|
82
|
+
var s = e.hidden, u = y(
|
|
83
83
|
// Same safe-area rule as TopBar: keep the visual bar height stable, and
|
|
84
84
|
// add safe-area padding on an outer wrapper (avoid squeezing content).
|
|
85
85
|
"relative shrink-0 bg-background border-t border-border safe-bottom safe-left safe-right",
|
|
86
86
|
e.class
|
|
87
|
-
),
|
|
88
|
-
return
|
|
87
|
+
), A = e.ariaLabel;
|
|
88
|
+
return s !== r.e && (a.hidden = r.e = s), u !== r.t && w(a, r.t = u), A !== r.a && f(a, "aria-label", r.a = A), r;
|
|
89
89
|
}, {
|
|
90
90
|
e: void 0,
|
|
91
91
|
t: void 0,
|
|
92
92
|
a: void 0
|
|
93
|
-
}),
|
|
93
|
+
}), a;
|
|
94
94
|
})();
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
96
|
+
function P(e) {
|
|
97
|
+
let l;
|
|
98
|
+
const I = () => typeof e.item.ariaExpanded == "function" ? e.item.ariaExpanded() : e.item.ariaExpanded;
|
|
99
|
+
F(() => e.item.buttonRef?.(l ?? null)), W(() => e.item.buttonRef?.(null));
|
|
100
|
+
const b = () => typeof e.item.badge == "function" ? e.item.badge() : e.item.badge;
|
|
98
101
|
return (() => {
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
+
var n = T(), h = n.firstChild, c = h.nextSibling;
|
|
103
|
+
n.$$keydown = (t) => {
|
|
104
|
+
let o = null;
|
|
102
105
|
switch (t.key) {
|
|
103
106
|
case "ArrowRight":
|
|
104
107
|
case "ArrowDown":
|
|
105
|
-
|
|
108
|
+
o = (e.index + 1) % e.itemCount;
|
|
106
109
|
break;
|
|
107
110
|
case "ArrowLeft":
|
|
108
111
|
case "ArrowUp":
|
|
109
|
-
|
|
112
|
+
o = (e.index - 1 + e.itemCount) % e.itemCount;
|
|
110
113
|
break;
|
|
111
114
|
case "Home":
|
|
112
|
-
|
|
115
|
+
o = 0;
|
|
113
116
|
break;
|
|
114
117
|
case "End":
|
|
115
|
-
|
|
118
|
+
o = e.itemCount - 1;
|
|
116
119
|
break;
|
|
117
120
|
default:
|
|
118
121
|
return;
|
|
119
122
|
}
|
|
120
|
-
t.preventDefault(), e.onKeyboardSelect(
|
|
121
|
-
},
|
|
123
|
+
t.preventDefault(), e.onKeyboardSelect(o);
|
|
124
|
+
}, n.$$click = () => e.onClick();
|
|
125
|
+
var g = l;
|
|
126
|
+
return typeof g == "function" ? E(g, n) : l = n, m(h, v(_, {
|
|
122
127
|
get component() {
|
|
123
128
|
return e.item.icon;
|
|
124
129
|
},
|
|
125
130
|
class: "w-6 h-6"
|
|
126
|
-
}), null),
|
|
131
|
+
}), null), m(h, v(S, {
|
|
127
132
|
get when() {
|
|
128
|
-
return
|
|
133
|
+
return b();
|
|
129
134
|
},
|
|
130
135
|
get children() {
|
|
131
|
-
var t =
|
|
132
|
-
return
|
|
133
|
-
var
|
|
134
|
-
return () =>
|
|
135
|
-
})()),
|
|
136
|
+
var t = K();
|
|
137
|
+
return m(t, (() => {
|
|
138
|
+
var o = z(() => typeof b() == "number" && b() > 99);
|
|
139
|
+
return () => o() ? "99+" : b();
|
|
140
|
+
})()), L(() => w(t, y("absolute -top-1 -right-2 min-w-4 h-4 px-1", "flex items-center justify-center", "text-[10px] font-medium rounded-full", "bg-primary text-primary-foreground"))), t;
|
|
136
141
|
}
|
|
137
|
-
}), null), c
|
|
142
|
+
}), null), m(c, () => e.item.label), m(n, v(S, {
|
|
138
143
|
get when() {
|
|
139
144
|
return e.isActive;
|
|
140
145
|
},
|
|
141
146
|
get children() {
|
|
142
|
-
return
|
|
147
|
+
return N();
|
|
143
148
|
}
|
|
144
|
-
}), null),
|
|
145
|
-
var
|
|
146
|
-
return
|
|
149
|
+
}), null), L((t) => {
|
|
150
|
+
var o = y("relative flex-shrink-0 flex flex-col items-center justify-center", "min-w-16 h-full px-4 snap-center", "transition-[color] duration-150", "focus:outline-none focus-visible:bg-muted", e.isActive ? "text-primary" : "text-muted-foreground active:text-foreground"), C = e.item.label, a = e.isActive, i = I(), d = e.item.ariaControls, k = e.item.ariaHasPopup, r = e.isActive ? 0 : -1, s = y("relative transition-transform duration-150", e.isActive && "scale-110"), u = y("mt-1 text-[10px] font-medium truncate max-w-full", e.isActive && "font-semibold");
|
|
151
|
+
return o !== t.e && w(n, t.e = o), C !== t.t && f(n, "aria-label", t.t = C), a !== t.a && f(n, "aria-selected", t.a = a), i !== t.o && f(n, "aria-expanded", t.o = i), d !== t.i && f(n, "aria-controls", t.i = d), k !== t.n && f(n, "aria-haspopup", t.n = k), r !== t.s && f(n, "tabindex", t.s = r), s !== t.h && w(h, t.h = s), u !== t.r && w(c, t.r = u), t;
|
|
147
152
|
}, {
|
|
148
153
|
e: void 0,
|
|
149
154
|
t: void 0,
|
|
150
155
|
a: void 0,
|
|
151
156
|
o: void 0,
|
|
152
157
|
i: void 0,
|
|
153
|
-
n: void 0
|
|
154
|
-
|
|
158
|
+
n: void 0,
|
|
159
|
+
s: void 0,
|
|
160
|
+
h: void 0,
|
|
161
|
+
r: void 0
|
|
162
|
+
}), n;
|
|
155
163
|
})();
|
|
156
164
|
}
|
|
157
|
-
|
|
165
|
+
D(["click", "keydown"]);
|
|
158
166
|
export {
|
|
159
|
-
|
|
167
|
+
O as MobileTabBar
|
|
160
168
|
};
|
package/dist/remote-pointer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function U(a) {
|
|
2
|
-
const { surface: l } = a,
|
|
2
|
+
const { surface: l } = a, I = l.ownerDocument, c = I.defaultView;
|
|
3
3
|
if (!c) throw new Error("Remote pointer requires an attached document");
|
|
4
4
|
let o = null, f = null, u = null, p = null, y = 0, z = 0, M = !1, x = !1, D = 0, b = !1;
|
|
5
5
|
const g = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map(), C = [], w = (e) => !x && a.isTargetValid(e), O = (e, t) => Math.hypot(e.clientX - t.clientX, e.clientY - t.clientY), v = (e) => ({
|
|
@@ -43,7 +43,7 @@ function U(a) {
|
|
|
43
43
|
y = i;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function T(e, t, n, i, s = 1) {
|
|
47
47
|
const m = h.get(i);
|
|
48
48
|
if (!e && !m) return;
|
|
49
49
|
e || h.delete(i);
|
|
@@ -55,14 +55,14 @@ function U(a) {
|
|
|
55
55
|
return a.onActivate?.(e, t), n === D && w(t);
|
|
56
56
|
}
|
|
57
57
|
function Y(e, t, n, i = 1) {
|
|
58
|
-
K(e, t) && (
|
|
58
|
+
K(e, t) && (T(!0, e, t, n, i), T(!1, e, t, n, i));
|
|
59
59
|
}
|
|
60
60
|
function r() {
|
|
61
61
|
D++, H(), y && c.cancelAnimationFrame(y), y = 0;
|
|
62
62
|
const e = /* @__PURE__ */ new Set();
|
|
63
63
|
o && e.add(o.target), f && e.add(f.target), u !== null && e.add(u), f = null, o = null, u = null, p = null, b = g.size > 0;
|
|
64
64
|
for (const [t, n] of h)
|
|
65
|
-
e.add(n.target),
|
|
65
|
+
e.add(n.target), T(!1, n.command, n.target, t);
|
|
66
66
|
for (const t of e) a.release(t);
|
|
67
67
|
for (const t of [...L]) X(t);
|
|
68
68
|
}
|
|
@@ -79,7 +79,7 @@ function U(a) {
|
|
|
79
79
|
const n = v(e);
|
|
80
80
|
if ((t.mode === "pending" || t.mode === "hold") && O(t.origin, n) > 8) {
|
|
81
81
|
const i = t.mode === "hold";
|
|
82
|
-
if (H(), p = null, t.mode = i ? "drag" : "scroll", i && K(t.origin, t.target) &&
|
|
82
|
+
if (H(), p = null, t.mode = i ? "drag" : "scroll", i && K(t.origin, t.target) && T(!0, t.origin, t.target, 0), o !== t) return;
|
|
83
83
|
}
|
|
84
84
|
if (t.mode === "scroll") {
|
|
85
85
|
const i = t.last, s = i.clientX - n.clientX, m = i.clientY - n.clientY;
|
|
@@ -113,9 +113,9 @@ function U(a) {
|
|
|
113
113
|
}
|
|
114
114
|
o && (o.id !== e.pointerId || o.target !== t) && r(), k(), u !== null && (a.release(u), u = null), o = { id: e.pointerId, target: t, origin: n, last: n, mode: "direct" };
|
|
115
115
|
const i = e.button === 0 && p?.target === t && c.performance.now() - p.time <= 350 && O(p.position, n) <= 16;
|
|
116
|
-
K(n, t) &&
|
|
116
|
+
K(n, t) && T(!0, n, t, e.button, Math.max(1, e.detail, i ? 2 : 1));
|
|
117
117
|
}
|
|
118
|
-
B(e.pointerId), e.preventDefault();
|
|
118
|
+
B(e.pointerId), e.pointerType === "touch" && e.preventDefault();
|
|
119
119
|
}), d(l, "pointermove", (e) => {
|
|
120
120
|
if (e.pointerType === "touch") {
|
|
121
121
|
_(e);
|
|
@@ -132,7 +132,7 @@ function U(a) {
|
|
|
132
132
|
o.last = n;
|
|
133
133
|
for (const [i, s] of [[0, 1], [1, 4], [2, 2], [3, 8], [4, 16]]) {
|
|
134
134
|
const m = !!(e.buttons & s);
|
|
135
|
-
m !== h.has(i) && (k(),
|
|
135
|
+
m !== h.has(i) && (k(), T(m, n, t, i));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
E({ ...n, kind: "move" }, t);
|
|
@@ -146,12 +146,12 @@ function U(a) {
|
|
|
146
146
|
if (t.mode === "pending") {
|
|
147
147
|
const i = c.performance.now(), s = p?.target === t.target && i - p.time <= 350 && O(p.position, n) <= 16;
|
|
148
148
|
Y(n, t.target, 0, s ? 2 : 1), p = s ? null : { target: t.target, position: n, time: i };
|
|
149
|
-
} else t.mode === "hold" ? (p = null, Y(n, t.target, 2)) : (k(), t.mode === "drag" &&
|
|
149
|
+
} else t.mode === "hold" ? (p = null, Y(n, t.target, 2)) : (k(), t.mode === "drag" && T(!1, n, t.target, 0));
|
|
150
150
|
a.release(t.target), o = null;
|
|
151
151
|
} else {
|
|
152
152
|
f?.command.kind === "move" && (f.command = { ...v(e), kind: "move" }), k();
|
|
153
153
|
const n = h.get(e.button)?.command;
|
|
154
|
-
for (const i of [...h.keys()])
|
|
154
|
+
for (const i of [...h.keys()]) T(!1, v(e), t.target, i, n && "clicks" in n ? n.clicks : 1);
|
|
155
155
|
p = e.button === 0 && n && "clicks" in n && n.clicks === 1 && O(t.origin, v(e)) <= 8 ? { target: t.target, position: v(e), time: c.performance.now() } : null, h.size || (o = null);
|
|
156
156
|
}
|
|
157
157
|
(!o || o.id !== e.pointerId) && S(e.pointerId);
|
|
@@ -159,9 +159,9 @@ function U(a) {
|
|
|
159
159
|
r(), S(e.pointerId);
|
|
160
160
|
}), d(l, "lostpointercapture", (e) => {
|
|
161
161
|
L.has(e.pointerId) && (r(), S(e.pointerId));
|
|
162
|
-
}), d(
|
|
162
|
+
}), d(I, "pointerup", (e) => {
|
|
163
163
|
o?.id !== e.pointerId && S(e.pointerId);
|
|
164
|
-
}), d(
|
|
164
|
+
}), d(I, "pointercancel", (e) => S(e.pointerId)), d(I, "pointerdown", (e) => {
|
|
165
165
|
o && (e.pointerType === "touch" && e.pointerId !== o.id ? (g.add(e.pointerId), r()) : l.contains(e.target) || r());
|
|
166
166
|
}, !0), d(l, "wheel", (e) => {
|
|
167
167
|
const t = a.resolveTarget(e);
|
|
@@ -175,8 +175,8 @@ function U(a) {
|
|
|
175
175
|
a.resolveTarget(t) !== null && t.preventDefault();
|
|
176
176
|
});
|
|
177
177
|
for (const e of ["blur", "pagehide", "resize", "orientationchange"]) d(c, e, r);
|
|
178
|
-
if (d(
|
|
179
|
-
|
|
178
|
+
if (d(I, "visibilitychange", () => {
|
|
179
|
+
I.hidden && r();
|
|
180
180
|
}), d(c, "scroll", r, !0), c.visualViewport && (d(c.visualViewport, "resize", r), d(c.visualViewport, "scroll", r)), typeof ResizeObserver < "u") {
|
|
181
181
|
let e = `${l.clientWidth}:${l.clientHeight}`;
|
|
182
182
|
const t = new ResizeObserver(() => {
|