@floegence/floe-webapp-core 0.1.7 → 0.1.9

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/index22.js CHANGED
@@ -1,44 +1,44 @@
1
- import { delegateEvents as ve, createComponent as l, Portal as ze, template as D, insert as f, effect as s, setAttribute as oe, addEventListener as m, className as a, memo as be, setStyleProperty as E, use as ye } from "solid-js/web";
2
- import { createUniqueId as pe, createSignal as M, onMount as Se, createEffect as le, onCleanup as Me, Show as W } from "solid-js";
3
- import { cn as q } from "./index62.js";
4
- import { Button as se } from "./index19.js";
5
- import { Restore as $e, Maximize as Pe, X as Ie } from "./index30.js";
6
- import { lockBodyStyle as Ce } from "./index66.js";
7
- var _e = /* @__PURE__ */ D('<h2 class="text-sm font-medium truncate select-none">'), Ee = /* @__PURE__ */ D('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), x = /* @__PURE__ */ D("<div style=touch-action:none>"), We = /* @__PURE__ */ D('<div role=dialog aria-modal=true><div style=touch-action:none><div class="flex-1 min-w-0"></div><div class="flex items-center gap-0.5 -mr-1"></div></div><div class="flex-1 overflow-auto p-3">');
8
- function Fe(i) {
9
- const T = () => i.resizable ?? !0, U = () => i.draggable ?? !0, H = () => i.minSize ?? {
1
+ import { delegateEvents as Me, createComponent as l, Portal as Se, template as O, insert as b, effect as u, setAttribute as ae, addEventListener as z, className as w, memo as Ie, setStyleProperty as D, use as $e } from "solid-js/web";
2
+ import { createUniqueId as Pe, createSignal as I, onMount as Ce, onCleanup as de, createEffect as he, Show as P } from "solid-js";
3
+ import { cn as j } from "./index62.js";
4
+ import { Button as ce } from "./index19.js";
5
+ import { Restore as Ee, Maximize as We, X as _e } from "./index30.js";
6
+ import { lockBodyStyle as He } from "./index66.js";
7
+ var Xe = /* @__PURE__ */ O('<h2 class="text-sm font-medium truncate select-none">'), De = /* @__PURE__ */ O('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), y = /* @__PURE__ */ O("<div style=touch-action:none>"), Le = /* @__PURE__ */ O('<div role=dialog aria-modal=true><div style=touch-action:none><div class="flex-1 min-w-0"></div><div class="flex items-center gap-0.5 -mr-1"></div></div><div class="flex-1 overflow-auto p-3">');
8
+ function Te(i) {
9
+ const G = () => i.resizable ?? !0, K = () => i.draggable ?? !0, L = () => i.minSize ?? {
10
10
  width: 200,
11
11
  height: 150
12
- }, X = () => i.maxSize ?? {
12
+ }, Y = () => i.maxSize ?? {
13
13
  width: 1 / 0,
14
14
  height: 1 / 0
15
- }, ae = () => i.zIndex ?? 100, de = pe(), j = () => `floating-window-${de}-title`, [$, P] = M(i.defaultPosition ?? {
15
+ }, ue = () => i.zIndex ?? 100, we = Pe(), R = 768, C = 16, [F, ge] = I(typeof window < "u" ? window.innerWidth < R : !1), Z = () => `floating-window-${we}-title`, [E, p] = I(i.defaultPosition ?? {
16
16
  x: 0,
17
17
  y: 0
18
- }), [y, A] = M(i.defaultSize ?? {
18
+ }), [M, W] = I(i.defaultSize ?? {
19
19
  width: 400,
20
20
  height: 300
21
- }), [d, G] = M(!1), [ue, N] = M(!1), [ce, Z] = M(!1), [he, we] = M(null);
22
- let F = {
21
+ }), [h, J] = I(!1), [me, Q] = I(!1), [fe, V] = I(!1), [xe, ve] = I(null);
22
+ let T = {
23
23
  x: 0,
24
24
  y: 0
25
- }, L = {
25
+ }, q = {
26
26
  x: 0,
27
27
  y: 0
28
- }, O = {
28
+ }, B = {
29
29
  x: 0,
30
30
  y: 0
31
- }, v = {
31
+ }, S = {
32
32
  width: 0,
33
33
  height: 0
34
- }, I = {
34
+ }, _ = {
35
35
  x: 0,
36
36
  y: 0
37
- }, C = "se", r, u = null, c = null, _ = {
37
+ }, H = "se", a, g = null, m = null, X = {
38
38
  x: 0,
39
39
  y: 0
40
- }, p = null, h = null;
41
- const ge = {
40
+ }, $ = null, f = null;
41
+ const be = {
42
42
  n: "ns-resize",
43
43
  s: "ns-resize",
44
44
  e: "ew-resize",
@@ -47,122 +47,148 @@ function Fe(i) {
47
47
  nw: "nwse-resize",
48
48
  se: "nwse-resize",
49
49
  sw: "nesw-resize"
50
- }, R = (t, n) => {
50
+ }, N = (t, n) => {
51
51
  if (!t) {
52
- h == null || h(), h = null;
52
+ f == null || f(), f = null;
53
53
  return;
54
54
  }
55
- h == null || h(), h = Ce({
55
+ f == null || f(), f = He({
56
56
  cursor: n,
57
57
  "user-select": "none"
58
58
  });
59
- }, B = (t) => {
60
- if (p !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(p), p = null), t !== void 0)
59
+ }, ee = (t) => {
60
+ if ($ !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame($), $ = null), t !== void 0)
61
61
  try {
62
- r == null || r.releasePointerCapture(t);
62
+ a == null || a.releasePointerCapture(t);
63
63
  } catch {
64
64
  }
65
- u = null, c = null, N(!1), Z(!1), R(!1, "");
65
+ g = null, m = null, Q(!1), V(!1), N(!1, "");
66
66
  };
67
- Se(() => {
68
- if (!i.defaultPosition) {
69
- const t = window.innerWidth, n = window.innerHeight, o = y();
70
- P({
71
- x: Math.max(0, (t - o.width) / 2),
72
- y: Math.max(0, (n - o.height) / 2)
73
- });
67
+ Ce(() => {
68
+ const t = () => {
69
+ const n = window.innerWidth < R;
70
+ if (ge(n), n && !h()) {
71
+ const r = window.innerWidth - C * 2;
72
+ W((s) => ({
73
+ ...s,
74
+ width: r
75
+ })), p((s) => ({
76
+ ...s,
77
+ x: C
78
+ }));
79
+ }
80
+ };
81
+ if (window.addEventListener("resize", t), de(() => window.removeEventListener("resize", t)), !i.defaultPosition) {
82
+ const n = window.innerWidth, r = window.innerHeight;
83
+ if (n < R) {
84
+ const d = n - C * 2, c = M();
85
+ W({
86
+ width: d,
87
+ height: c.height
88
+ }), p({
89
+ x: C,
90
+ y: Math.max(0, (r - c.height) / 2)
91
+ });
92
+ } else {
93
+ const d = M();
94
+ p({
95
+ x: Math.max(0, (n - d.width) / 2),
96
+ y: Math.max(0, (r - d.height) / 2)
97
+ });
98
+ }
74
99
  }
75
- }), le(() => {
100
+ }), he(() => {
76
101
  if (!i.open) return;
77
102
  const t = (n) => {
78
103
  n.key === "Escape" && i.onOpenChange(!1);
79
104
  };
80
- document.addEventListener("keydown", t), Me(() => document.removeEventListener("keydown", t));
81
- }), le(() => {
82
- i.open || B(u ?? void 0);
105
+ document.addEventListener("keydown", t), de(() => document.removeEventListener("keydown", t));
106
+ }), he(() => {
107
+ i.open || ee(g ?? void 0);
83
108
  });
84
- const fe = (t) => {
85
- if (!U() || d() || t.pointerType === "mouse" && t.button !== 0) return;
109
+ const ze = (t) => {
110
+ if (!K() || h() || t.pointerType === "mouse" && t.button !== 0) return;
86
111
  const n = t.target;
87
- n != null && n.closest('button, input, select, textarea, a, [role="button"]') || (t.preventDefault(), u = t.pointerId, c = "drag", N(!0), F = {
112
+ n != null && n.closest('button, input, select, textarea, a, [role="button"]') || (t.preventDefault(), g = t.pointerId, m = "drag", Q(!0), T = {
88
113
  x: t.clientX,
89
114
  y: t.clientY
90
- }, L = {
91
- ...$()
92
- }, _ = {
115
+ }, q = {
116
+ ...E()
117
+ }, X = {
93
118
  x: t.clientX,
94
119
  y: t.clientY
95
- }, R(!0, "grabbing"), r == null || r.setPointerCapture(t.pointerId));
96
- }, w = (t) => (n) => {
97
- !T() || d() || n.pointerType === "mouse" && n.button !== 0 || (n.preventDefault(), n.stopPropagation(), u = n.pointerId, c = "resize", Z(!0), C = t, O = {
120
+ }, N(!0, "grabbing"), a == null || a.setPointerCapture(t.pointerId));
121
+ }, x = (t) => (n) => {
122
+ !G() || h() || n.pointerType === "mouse" && n.button !== 0 || (n.preventDefault(), n.stopPropagation(), g = n.pointerId, m = "resize", V(!0), H = t, B = {
98
123
  x: n.clientX,
99
124
  y: n.clientY
100
- }, v = {
101
- ...y()
102
- }, I = {
103
- ...$()
125
+ }, S = {
126
+ ...M()
104
127
  }, _ = {
128
+ ...E()
129
+ }, X = {
105
130
  x: n.clientX,
106
131
  y: n.clientY
107
- }, R(!0, ge[t]), r == null || r.setPointerCapture(n.pointerId));
108
- }, J = () => {
109
- if (p = null, !i.open || u === null || c === null) return;
110
- const t = _.x - (c === "drag" ? F.x : O.x), n = _.y - (c === "drag" ? F.y : O.y);
111
- if (c === "drag") {
112
- const e = y(), Y = Math.max(0, Math.min(window.innerWidth - e.width, L.x + t)), k = Math.max(0, Math.min(window.innerHeight - e.height, L.y + n));
113
- P({
114
- x: Y,
115
- y: k
132
+ }, N(!0, be[t]), a == null || a.setPointerCapture(n.pointerId));
133
+ }, te = () => {
134
+ if ($ = null, !i.open || g === null || m === null) return;
135
+ const t = X.x - (m === "drag" ? T.x : B.x), n = X.y - (m === "drag" ? T.y : B.y);
136
+ if (m === "drag") {
137
+ const o = M(), k = F() ? C : Math.max(0, Math.min(window.innerWidth - o.width, q.x + t)), A = Math.max(0, Math.min(window.innerHeight - o.height, q.y + n));
138
+ p({
139
+ x: k,
140
+ y: A
116
141
  });
117
142
  return;
118
143
  }
119
- let o = v.width, z = v.height, S = I.x, b = I.y;
120
- if (C.includes("e") && (o = Math.max(H().width, Math.min(X().width, v.width + t))), C.includes("w")) {
121
- const e = v.width - t;
122
- e >= H().width && e <= X().width && (o = e, S = I.x + t);
144
+ let r = S.width, s = S.height, d = _.x, c = _.y;
145
+ const e = F();
146
+ if (!e && H.includes("e") && (r = Math.max(L().width, Math.min(Y().width, S.width + t))), !e && H.includes("w")) {
147
+ const o = S.width - t;
148
+ o >= L().width && o <= Y().width && (r = o, d = _.x + t);
123
149
  }
124
- if (C.includes("s") && (z = Math.max(H().height, Math.min(X().height, v.height + n))), C.includes("n")) {
125
- const e = v.height - n;
126
- e >= H().height && e <= X().height && (z = e, b = I.y + n);
150
+ if (H.includes("s") && (s = Math.max(L().height, Math.min(Y().height, S.height + n))), H.includes("n")) {
151
+ const o = S.height - n;
152
+ o >= L().height && o <= Y().height && (s = o, c = _.y + n);
127
153
  }
128
- S = Math.max(0, Math.min(window.innerWidth - o, S)), b = Math.max(0, Math.min(window.innerHeight - z, b)), A({
129
- width: o,
130
- height: z
131
- }), P({
132
- x: S,
133
- y: b
154
+ d = Math.max(0, Math.min(window.innerWidth - r, d)), c = Math.max(0, Math.min(window.innerHeight - s, c)), W({
155
+ width: r,
156
+ height: s
157
+ }), p({
158
+ x: d,
159
+ y: c
134
160
  });
135
- }, me = (t) => {
136
- if (!(u === null || t.pointerId !== u) && c !== null && (_ = {
161
+ }, ye = (t) => {
162
+ if (!(g === null || t.pointerId !== g) && m !== null && (X = {
137
163
  x: t.clientX,
138
164
  y: t.clientY
139
- }, p === null)) {
165
+ }, $ === null)) {
140
166
  if (typeof requestAnimationFrame > "u") {
141
- J();
167
+ te();
142
168
  return;
143
169
  }
144
- p = requestAnimationFrame(J);
170
+ $ = requestAnimationFrame(te);
145
171
  }
146
- }, K = (t) => {
147
- u === null || t.pointerId !== u || B(t.pointerId);
148
- }, Q = () => {
149
- if (d()) {
150
- const t = he();
151
- t && (P(t.position), A(t.size)), G(!1);
172
+ }, ne = (t) => {
173
+ g === null || t.pointerId !== g || ee(t.pointerId);
174
+ }, ie = () => {
175
+ if (h()) {
176
+ const t = xe();
177
+ t && (p(t.position), W(t.size)), J(!1);
152
178
  } else
153
- we({
154
- position: $(),
155
- size: y()
156
- }), P({
179
+ ve({
180
+ position: E(),
181
+ size: M()
182
+ }), p({
157
183
  x: 0,
158
184
  y: 0
159
- }), A({
185
+ }), W({
160
186
  width: window.innerWidth,
161
187
  height: window.innerHeight
162
- }), G(!0);
163
- }, xe = () => {
164
- Q();
165
- }, g = (t) => q("absolute z-10", {
188
+ }), J(!0);
189
+ }, pe = () => {
190
+ ie();
191
+ }, v = (t) => j("absolute z-10", {
166
192
  n: "cursor-ns-resize top-0 left-2 right-2 h-1",
167
193
  s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
168
194
  e: "cursor-ew-resize right-0 top-2 bottom-2 w-1",
@@ -172,52 +198,52 @@ function Fe(i) {
172
198
  se: "cursor-nwse-resize bottom-0 right-0 w-2 h-2",
173
199
  sw: "cursor-nesw-resize bottom-0 left-0 w-2 h-2"
174
200
  }[t]);
175
- return l(W, {
201
+ return l(P, {
176
202
  get when() {
177
203
  return i.open;
178
204
  },
179
205
  get children() {
180
- return l(ze, {
206
+ return l(Se, {
181
207
  get children() {
182
- var t = We(), n = t.firstChild, o = n.firstChild, z = o.nextSibling, S = n.nextSibling;
183
- t.addEventListener("pointercancel", K), t.$$pointerup = K, t.$$pointermove = me;
184
- var b = r;
185
- return typeof b == "function" ? ye(b, t) : r = t, n.$$dblclick = xe, n.$$pointerdown = fe, f(o, l(W, {
208
+ var t = Le(), n = t.firstChild, r = n.firstChild, s = r.nextSibling, d = n.nextSibling;
209
+ t.addEventListener("pointercancel", ne), t.$$pointerup = ne, t.$$pointermove = ye;
210
+ var c = a;
211
+ return typeof c == "function" ? $e(c, t) : a = t, n.$$dblclick = pe, n.$$pointerdown = ze, b(r, l(P, {
186
212
  get when() {
187
213
  return i.title;
188
214
  },
189
215
  get children() {
190
- var e = _e();
191
- return f(e, () => i.title), s(() => oe(e, "id", j())), e;
216
+ var e = Xe();
217
+ return b(e, () => i.title), u(() => ae(e, "id", Z())), e;
192
218
  }
193
- })), f(z, l(se, {
219
+ })), b(s, l(ce, {
194
220
  variant: "ghost",
195
221
  size: "icon",
196
222
  class: "h-6 w-6",
197
223
  onClick: (e) => {
198
- e.stopPropagation(), Q();
224
+ e.stopPropagation(), ie();
199
225
  },
200
226
  get "aria-label"() {
201
- return d() ? "Restore" : "Maximize";
227
+ return h() ? "Restore" : "Maximize";
202
228
  },
203
229
  get children() {
204
- return l(W, {
230
+ return l(P, {
205
231
  get when() {
206
- return d();
232
+ return h();
207
233
  },
208
234
  get fallback() {
209
- return l(Pe, {
235
+ return l(We, {
210
236
  class: "w-3 h-3"
211
237
  });
212
238
  },
213
239
  get children() {
214
- return l($e, {
240
+ return l(Ee, {
215
241
  class: "w-3 h-3"
216
242
  });
217
243
  }
218
244
  });
219
245
  }
220
- }), null), f(z, l(se, {
246
+ }), null), b(s, l(ce, {
221
247
  variant: "ghost",
222
248
  size: "icon",
223
249
  class: "h-6 w-6 hover:bg-error hover:text-error-foreground",
@@ -226,52 +252,59 @@ function Fe(i) {
226
252
  },
227
253
  "aria-label": "Close",
228
254
  get children() {
229
- return l(Ie, {
255
+ return l(_e, {
230
256
  class: "w-3.5 h-3.5"
231
257
  });
232
258
  }
233
- }), null), f(S, () => i.children), f(t, l(W, {
259
+ }), null), b(d, () => i.children), b(t, l(P, {
234
260
  get when() {
235
261
  return i.footer;
236
262
  },
237
263
  get children() {
238
- var e = Ee();
239
- return f(e, () => i.footer), e;
264
+ var e = De();
265
+ return b(e, () => i.footer), e;
240
266
  }
241
- }), null), f(t, l(W, {
267
+ }), null), b(t, l(P, {
242
268
  get when() {
243
- return be(() => !!T())() && !d();
269
+ return Ie(() => !!G())() && !h();
244
270
  },
245
271
  get children() {
246
272
  return [(() => {
247
- var e = x();
248
- return m(e, "pointerdown", w("n"), !0), s(() => a(e, g("n"))), e;
249
- })(), (() => {
250
- var e = x();
251
- return m(e, "pointerdown", w("s"), !0), s(() => a(e, g("s"))), e;
252
- })(), (() => {
253
- var e = x();
254
- return m(e, "pointerdown", w("e"), !0), s(() => a(e, g("e"))), e;
255
- })(), (() => {
256
- var e = x();
257
- return m(e, "pointerdown", w("w"), !0), s(() => a(e, g("w"))), e;
273
+ var e = y();
274
+ return z(e, "pointerdown", x("n"), !0), u(() => w(e, v("n"))), e;
258
275
  })(), (() => {
259
- var e = x();
260
- return m(e, "pointerdown", w("ne"), !0), s(() => a(e, g("ne"))), e;
261
- })(), (() => {
262
- var e = x();
263
- return m(e, "pointerdown", w("nw"), !0), s(() => a(e, g("nw"))), e;
264
- })(), (() => {
265
- var e = x();
266
- return m(e, "pointerdown", w("se"), !0), s(() => a(e, g("se"))), e;
267
- })(), (() => {
268
- var e = x();
269
- return m(e, "pointerdown", w("sw"), !0), s(() => a(e, g("sw"))), e;
270
- })()];
276
+ var e = y();
277
+ return z(e, "pointerdown", x("s"), !0), u(() => w(e, v("s"))), e;
278
+ })(), l(P, {
279
+ get when() {
280
+ return !F();
281
+ },
282
+ get children() {
283
+ return [(() => {
284
+ var e = y();
285
+ return z(e, "pointerdown", x("e"), !0), u(() => w(e, v("e"))), e;
286
+ })(), (() => {
287
+ var e = y();
288
+ return z(e, "pointerdown", x("w"), !0), u(() => w(e, v("w"))), e;
289
+ })(), (() => {
290
+ var e = y();
291
+ return z(e, "pointerdown", x("ne"), !0), u(() => w(e, v("ne"))), e;
292
+ })(), (() => {
293
+ var e = y();
294
+ return z(e, "pointerdown", x("nw"), !0), u(() => w(e, v("nw"))), e;
295
+ })(), (() => {
296
+ var e = y();
297
+ return z(e, "pointerdown", x("se"), !0), u(() => w(e, v("se"))), e;
298
+ })(), (() => {
299
+ var e = y();
300
+ return z(e, "pointerdown", x("sw"), !0), u(() => w(e, v("sw"))), e;
301
+ })()];
302
+ }
303
+ })];
271
304
  }
272
- }), null), s((e) => {
273
- var Y = q("fixed bg-card text-card-foreground rounded-md shadow-xl", "border border-border", "flex flex-col", "animate-in fade-in zoom-in-95", d() && "rounded-none", (ue() || ce()) && "select-none", i.class), k = `${$().x}px`, V = `${$().y}px`, ee = `${y().width}px`, te = `${y().height}px`, ne = ae(), ie = i.title ? j() : void 0, re = q("flex items-center justify-between h-9 px-3", "border-b border-border", "bg-muted/50", d() ? "rounded-none" : "rounded-t-md", U() && !d() && "cursor-move");
274
- return Y !== e.e && a(t, e.e = Y), k !== e.t && E(t, "left", e.t = k), V !== e.a && E(t, "top", e.a = V), ee !== e.o && E(t, "width", e.o = ee), te !== e.i && E(t, "height", e.i = te), ne !== e.n && E(t, "z-index", e.n = ne), ie !== e.s && oe(t, "aria-labelledby", e.s = ie), re !== e.h && a(n, e.h = re), e;
305
+ }), null), u((e) => {
306
+ var o = j("fixed bg-card text-card-foreground rounded-md shadow-xl", "border border-border", "flex flex-col", "animate-in fade-in zoom-in-95", h() && "rounded-none", (me() || fe()) && "select-none", i.class), U = `${E().x}px`, k = `${E().y}px`, A = `${M().width}px`, re = `${M().height}px`, oe = ue(), se = i.title ? Z() : void 0, le = j("flex items-center justify-between h-9 px-3", "border-b border-border", "bg-muted/50", h() ? "rounded-none" : "rounded-t-md", K() && !h() && "cursor-move");
307
+ return o !== e.e && w(t, e.e = o), U !== e.t && D(t, "left", e.t = U), k !== e.a && D(t, "top", e.a = k), A !== e.o && D(t, "width", e.o = A), re !== e.i && D(t, "height", e.i = re), oe !== e.n && D(t, "z-index", e.n = oe), se !== e.s && ae(t, "aria-labelledby", e.s = se), le !== e.h && w(n, e.h = le), e;
275
308
  }, {
276
309
  e: void 0,
277
310
  t: void 0,
@@ -287,7 +320,7 @@ function Fe(i) {
287
320
  }
288
321
  });
289
322
  }
290
- ve(["pointermove", "pointerup", "pointerdown", "dblclick"]);
323
+ Me(["pointermove", "pointerup", "pointerdown", "dblclick"]);
291
324
  export {
292
- Fe as FloatingWindow
325
+ Te as FloatingWindow
293
326
  };
package/dist/index3.js CHANGED
@@ -1,94 +1,101 @@
1
- import { delegateEvents as y, template as d, insert as c, createComponent as l, effect as v, className as m, Dynamic as x, memo as C, setAttribute as u } from "solid-js/web";
2
- import { For as s, Show as f } from "solid-js";
1
+ import { delegateEvents as h, template as d, insert as c, createComponent as r, effect as u, className as m, Dynamic as y, memo as x, setAttribute as f } from "solid-js/web";
2
+ import { For as b, Show as v } from "solid-js";
3
3
  import { cn as g } from "./index62.js";
4
- var w = /* @__PURE__ */ d('<div class="flex flex-col items-center py-1.5 gap-0.5 md:gap-2 md:py-2">'), A = /* @__PURE__ */ d('<div><div class="flex flex-col items-center py-1.5 gap-0.5 md:gap-2 md:py-2">'), k = /* @__PURE__ */ d('<div class="absolute -left-1.5 md:-left-2.5 top-1/2 -translate-y-1/2 w-1 h-7 bg-primary rounded-r">'), $ = /* @__PURE__ */ d("<span>"), _ = /* @__PURE__ */ d("<button type=button>");
5
- function D(e) {
4
+ import { Tooltip as C } from "./index24.js";
5
+ var w = /* @__PURE__ */ d('<div class="flex flex-col items-center py-1.5 gap-0.5 md:gap-2 md:py-2">'), A = /* @__PURE__ */ d('<div><div class="flex flex-col items-center py-1.5 gap-0.5 md:gap-2 md:py-2">'), $ = /* @__PURE__ */ d('<div class="absolute -left-1.5 md:-left-2.5 top-1/2 -translate-y-1/2 w-1 h-7 bg-primary rounded-r">'), k = /* @__PURE__ */ d("<span>"), _ = /* @__PURE__ */ d("<button type=button>");
6
+ function E(e) {
6
7
  const a = (t) => {
7
- var r, o;
8
+ var l, o;
8
9
  if (t.onClick) {
9
10
  t.onClick();
10
11
  return;
11
12
  }
12
- const i = e.activeId === t.id, n = e.collapsed ?? !1;
13
- if (i && !n) {
14
- (r = e.onCollapsedChange) == null || r.call(e, !0);
13
+ const n = e.activeId === t.id, i = e.collapsed ?? !1;
14
+ if (n && !i) {
15
+ (l = e.onCollapsedChange) == null || l.call(e, !0);
15
16
  return;
16
17
  }
17
18
  e.onActiveChange(t.id), (o = e.onCollapsedChange) == null || o.call(e, !1);
18
19
  };
19
20
  return (() => {
20
- var t = A(), i = t.firstChild;
21
- return c(i, l(s, {
21
+ var t = A(), n = t.firstChild;
22
+ return c(n, r(b, {
22
23
  get each() {
23
24
  return e.items;
24
25
  },
25
- children: (n) => l(h, {
26
- item: n,
26
+ children: (i) => r(s, {
27
+ item: i,
27
28
  get isActive() {
28
- return e.activeId === n.id;
29
+ return e.activeId === i.id;
29
30
  },
30
- onClick: () => a(n)
31
+ onClick: () => a(i)
31
32
  })
32
- })), c(t, l(f, {
33
+ })), c(t, r(v, {
33
34
  get when() {
34
- var n;
35
- return (n = e.bottomItems) == null ? void 0 : n.length;
35
+ var i;
36
+ return (i = e.bottomItems) == null ? void 0 : i.length;
36
37
  },
37
38
  get children() {
38
- var n = w();
39
- return c(n, l(s, {
39
+ var i = w();
40
+ return c(i, r(b, {
40
41
  get each() {
41
42
  return e.bottomItems;
42
43
  },
43
- children: (r) => l(h, {
44
- item: r,
44
+ children: (l) => r(s, {
45
+ item: l,
45
46
  isActive: !1,
46
- onClick: () => a(r)
47
+ onClick: () => a(l)
47
48
  })
48
- })), n;
49
+ })), i;
49
50
  }
50
- }), null), v(() => m(t, g("w-12 md:w-14 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-border", e.class))), t;
51
+ }), null), u(() => m(t, g("w-12 md:w-14 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-border", e.class))), t;
51
52
  })();
52
53
  }
53
- function h(e) {
54
+ function s(e) {
54
55
  const a = () => typeof e.item.badge == "function" ? e.item.badge() : e.item.badge;
55
- return (() => {
56
- var t = _();
57
- return t.$$click = () => e.onClick(), c(t, l(f, {
58
- get when() {
59
- return e.isActive;
60
- },
61
- get children() {
62
- return k();
63
- }
64
- }), null), c(t, l(x, {
65
- get component() {
66
- return e.item.icon;
67
- },
68
- class: "w-5 h-5"
69
- }), null), c(t, l(f, {
70
- get when() {
71
- return a();
72
- },
73
- get children() {
74
- var i = $();
75
- return c(i, (() => {
76
- var n = C(() => typeof a() == "number" && a() > 99);
77
- return () => n() ? "99+" : a();
78
- })()), v(() => m(i, g("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[9px] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), i;
79
- }
80
- }), null), v((i) => {
81
- var n = g("relative w-9 h-9 flex items-center justify-center rounded cursor-pointer", "transition-all duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", e.isActive ? "text-activity-bar-foreground-active bg-accent/80" : "text-activity-bar-foreground hover:text-activity-bar-foreground-active hover:bg-accent/40"), r = e.item.label, o = e.item.label, b = e.isActive;
82
- return n !== i.e && m(t, i.e = n), r !== i.t && u(t, "title", i.t = r), o !== i.a && u(t, "aria-label", i.a = o), b !== i.o && u(t, "aria-pressed", i.o = b), i;
83
- }, {
84
- e: void 0,
85
- t: void 0,
86
- a: void 0,
87
- o: void 0
88
- }), t;
89
- })();
56
+ return r(C, {
57
+ get content() {
58
+ return e.item.label;
59
+ },
60
+ placement: "right",
61
+ delay: 0,
62
+ get children() {
63
+ var t = _();
64
+ return t.$$click = () => e.onClick(), c(t, r(v, {
65
+ get when() {
66
+ return e.isActive;
67
+ },
68
+ get children() {
69
+ return $();
70
+ }
71
+ }), null), c(t, r(y, {
72
+ get component() {
73
+ return e.item.icon;
74
+ },
75
+ class: "w-5 h-5"
76
+ }), null), c(t, r(v, {
77
+ get when() {
78
+ return a();
79
+ },
80
+ get children() {
81
+ var n = k();
82
+ return c(n, (() => {
83
+ var i = x(() => typeof a() == "number" && a() > 99);
84
+ return () => i() ? "99+" : a();
85
+ })()), u(() => m(n, g("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[9px] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), n;
86
+ }
87
+ }), null), u((n) => {
88
+ var i = g("relative w-9 h-9 flex items-center justify-center rounded cursor-pointer", "transition-all duration-100", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring", e.isActive ? "text-activity-bar-foreground-active bg-accent/80" : "text-activity-bar-foreground hover:text-activity-bar-foreground-active hover:bg-accent/40"), l = e.item.label, o = e.isActive;
89
+ return i !== n.e && m(t, n.e = i), l !== n.t && f(t, "aria-label", n.t = l), o !== n.a && f(t, "aria-pressed", n.a = o), n;
90
+ }, {
91
+ e: void 0,
92
+ t: void 0,
93
+ a: void 0
94
+ }), t;
95
+ }
96
+ });
90
97
  }
91
- y(["click"]);
98
+ h(["click"]);
92
99
  export {
93
- D as ActivityBar
100
+ E as ActivityBar
94
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",