@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
- export interface MobileTabBarItem {
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 c, createComponent as d, effect as $, className as v, setAttribute as A, template as b, Dynamic as W, memo as M, use as R, delegateEvents as z } from "solid-js/web";
2
- import { createSignal as L, onMount as D, onCleanup as E, Show as S, For as j } from "solid-js";
3
- import { cn as g } from "../../utils/cn.js";
4
- import { deferNonBlocking as _ } from "../../utils/defer.js";
5
- var q = /* @__PURE__ */ b('<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__ */ b('<div class="absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent z-10 pointer-events-none">'), K = /* @__PURE__ */ b('<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>'), N = /* @__PURE__ */ b("<span>"), T = /* @__PURE__ */ b('<div class="absolute bottom-0 left-1/2 -translate-x-1/2 w-8 h-0.5 bg-primary rounded-t">'), H = /* @__PURE__ */ b("<button type=button role=tab><div></div><span>");
6
- function P(e) {
7
- let i;
8
- const [a, u] = L(!1), [h, t] = L(!1);
9
- let n = null;
10
- const s = () => {
11
- i && (u(i.scrollLeft > 0), t(i.scrollLeft < i.scrollWidth - i.clientWidth - 1));
12
- }, x = () => {
13
- if (n === null) {
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
- s();
15
+ g();
16
16
  return;
17
17
  }
18
- n = requestAnimationFrame(() => {
19
- n = null, s();
18
+ c = requestAnimationFrame(() => {
19
+ c = null, g();
20
20
  });
21
21
  }
22
- }, k = () => e.items, w = (r) => {
23
- const l = k()[r];
24
- if (l) {
25
- if (l.onClick) {
26
- _(() => l.onClick());
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(l.id);
29
+ e.onSelect(i.id);
30
30
  }
31
31
  };
32
- return D(() => {
33
- s();
34
- const r = e.items.findIndex((l) => l.id === e.activeId);
35
- if (r > 0 && i) {
36
- const l = i.scrollWidth / e.items.length;
37
- i.scrollLeft = Math.max(0, l * r - i.clientWidth / 2 + l / 2);
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
- }), E(() => {
40
- n !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(n), n = null);
39
+ }), W(() => {
40
+ c !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(c), c = null);
41
41
  }), (() => {
42
- var r = K(), l = r.firstChild, m = l.firstChild;
43
- c(l, d(S, {
42
+ var a = H(), i = a.firstChild, d = i.firstChild;
43
+ m(i, v(S, {
44
44
  get when() {
45
- return a();
45
+ return I();
46
46
  },
47
47
  get children() {
48
48
  return q();
49
49
  }
50
- }), m), c(l, d(S, {
50
+ }), d), m(i, v(S, {
51
51
  get when() {
52
- return h();
52
+ return n();
53
53
  },
54
54
  get children() {
55
55
  return B();
56
56
  }
57
- }), m), m.addEventListener("scroll", x);
58
- var I = i;
59
- return typeof I == "function" ? R(I, m) : i = m, c(m, d(j, {
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: (o, y) => d(U, {
64
- item: o,
63
+ children: (r, s) => v(P, {
64
+ item: r,
65
65
  get isActive() {
66
- return e.activeId === o.id;
66
+ return e.activeId === r.id;
67
67
  },
68
68
  get index() {
69
- return y();
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 f = o.onClick, C = e.onSelect, F = o.id;
77
- o.onClick ? _(() => f()) : C(F);
76
+ const u = r.onClick, A = e.onSelect, M = r.id;
77
+ r.onClick ? R(() => u()) : A(M);
78
78
  },
79
- onKeyboardSelect: (f) => w(f)
79
+ onKeyboardSelect: (u) => C(u)
80
80
  })
81
- })), $((o) => {
82
- var y = e.hidden, f = g(
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
- ), C = e.ariaLabel;
88
- return y !== o.e && (r.hidden = o.e = y), f !== o.t && v(r, o.t = f), C !== o.a && A(r, "aria-label", o.a = C), o;
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
- }), r;
93
+ }), a;
94
94
  })();
95
95
  }
96
- function U(e) {
97
- const i = () => typeof e.item.badge == "function" ? e.item.badge() : e.item.badge;
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 a = H(), u = a.firstChild, h = u.nextSibling;
100
- return a.$$keydown = (t) => {
101
- let n = null;
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
- n = (e.index + 1) % e.itemCount;
108
+ o = (e.index + 1) % e.itemCount;
106
109
  break;
107
110
  case "ArrowLeft":
108
111
  case "ArrowUp":
109
- n = (e.index - 1 + e.itemCount) % e.itemCount;
112
+ o = (e.index - 1 + e.itemCount) % e.itemCount;
110
113
  break;
111
114
  case "Home":
112
- n = 0;
115
+ o = 0;
113
116
  break;
114
117
  case "End":
115
- n = e.itemCount - 1;
118
+ o = e.itemCount - 1;
116
119
  break;
117
120
  default:
118
121
  return;
119
122
  }
120
- t.preventDefault(), e.onKeyboardSelect(n);
121
- }, a.$$click = () => e.onClick(), c(u, d(W, {
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), c(u, d(S, {
131
+ }), null), m(h, v(S, {
127
132
  get when() {
128
- return i();
133
+ return b();
129
134
  },
130
135
  get children() {
131
- var t = N();
132
- return c(t, (() => {
133
- var n = M(() => typeof i() == "number" && i() > 99);
134
- return () => n() ? "99+" : i();
135
- })()), $(() => v(t, g("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
+ 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(h, () => e.item.label), c(a, d(S, {
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 T();
147
+ return N();
143
148
  }
144
- }), null), $((t) => {
145
- var n = g("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"), s = e.item.label, x = e.isActive, k = e.isActive ? 0 : -1, w = g("relative transition-transform duration-150", e.isActive && "scale-110"), r = g("mt-1 text-[10px] font-medium truncate max-w-full", e.isActive && "font-semibold");
146
- return n !== t.e && v(a, t.e = n), s !== t.t && A(a, "aria-label", t.t = s), x !== t.a && A(a, "aria-selected", t.a = x), k !== t.o && A(a, "tabindex", t.o = k), w !== t.i && v(u, t.i = w), r !== t.n && v(h, t.n = r), t;
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
- }), a;
158
+ n: void 0,
159
+ s: void 0,
160
+ h: void 0,
161
+ r: void 0
162
+ }), n;
155
163
  })();
156
164
  }
157
- z(["click", "keydown"]);
165
+ D(["click", "keydown"]);
158
166
  export {
159
- P as MobileTabBar
167
+ O as MobileTabBar
160
168
  };
@@ -1,5 +1,5 @@
1
1
  function U(a) {
2
- const { surface: l } = a, T = l.ownerDocument, c = T.defaultView;
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 I(e, t, n, i, s = 1) {
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) && (I(!0, e, t, n, i), I(!1, e, t, n, i));
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), I(!1, n.command, n.target, t);
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) && I(!0, t.origin, t.target, 0), o !== t) return;
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) && I(!0, n, t, e.button, Math.max(1, e.detail, i ? 2 : 1));
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(), I(m, n, t, i));
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" && I(!1, n, t.target, 0));
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()]) I(!1, v(e), t.target, i, n && "clicks" in n ? n.clicks : 1);
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(T, "pointerup", (e) => {
162
+ }), d(I, "pointerup", (e) => {
163
163
  o?.id !== e.pointerId && S(e.pointerId);
164
- }), d(T, "pointercancel", (e) => S(e.pointerId)), d(T, "pointerdown", (e) => {
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(T, "visibilitychange", () => {
179
- T.hidden && r();
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(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.77.0",
3
+ "version": "0.77.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",