@floegence/floe-webapp-core 0.35.32 → 0.35.33

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,15 +1,16 @@
1
- import { addEventListener as le, use as K, insert as w, createComponent as b, effect as Y, setStyleProperty as X, className as G, template as C, spread as ce, mergeProps as se, memo as de, delegateEvents as ge } from "solid-js/web";
2
- import { createSignal as W, createMemo as j, createEffect as ue, Show as p, For as q, untrack as me, onCleanup as fe } from "solid-js";
1
+ import { addEventListener as le, use as K, insert as w, createComponent as C, effect as Y, setStyleProperty as X, className as G, template as b, spread as ce, mergeProps as se, memo as de, delegateEvents as ge } from "solid-js/web";
2
+ import { createSignal as W, createMemo as j, createEffect as ue, Show as A, For as q, untrack as me, onCleanup as fe } from "solid-js";
3
3
  import { cn as $ } from "../../utils/cn.js";
4
4
  import { useResizeObserver as he } from "../../hooks/useResizeObserver.js";
5
5
  import { useVirtualWindow as ve } from "../../hooks/useVirtualWindow.js";
6
6
  import { useFileBrowser as J } from "./FileBrowserContext.js";
7
7
  import { useFileBrowserDrag as xe } from "../../context/FileBrowserDragContext.js";
8
- import { FileItemIcon as be } from "./FileIcons.js";
9
- import { createLongPressContextMenuHandlers as Ce } from "./longPressContextMenu.js";
8
+ import { FileItemIcon as Ce } from "./FileIcons.js";
9
+ import { createLongPressContextMenuHandlers as be } from "./longPressContextMenu.js";
10
10
  import { fileBrowserTouchTargetAttrs as De } from "./touchInteractionGuard.js";
11
- var Ie = /* @__PURE__ */ C('<mark class="bg-warning/40 text-inherit rounded-sm">'), we = /* @__PURE__ */ C('<div class="grid gap-2">'), ye = /* @__PURE__ */ C('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Pe = /* @__PURE__ */ C('<span>No files matching "<!>"'), Se = /* @__PURE__ */ C('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Me = /* @__PURE__ */ C('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), _e = /* @__PURE__ */ C("<span>This folder is empty"), Te = /* @__PURE__ */ C('<div class="absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-primary flex items-center justify-center"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-2.5 h-2.5 text-primary-foreground"><polyline points="20 6 9 17 4 12">'), Ee = /* @__PURE__ */ C("<button type=button><div></div><span></span><div>");
12
- function Le(e) {
11
+ import { createItemContextMenuEvent as Ie } from "./contextMenuEvent.js";
12
+ var we = /* @__PURE__ */ b('<mark class="bg-warning/40 text-inherit rounded-sm">'), ye = /* @__PURE__ */ b('<div class="grid gap-2">'), Pe = /* @__PURE__ */ b('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Me = /* @__PURE__ */ b('<span>No files matching "<!>"'), Se = /* @__PURE__ */ b('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), _e = /* @__PURE__ */ b('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Te = /* @__PURE__ */ b("<span>This folder is empty"), Ee = /* @__PURE__ */ b('<div class="absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-primary flex items-center justify-center"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-2.5 h-2.5 text-primary-foreground"><polyline points="20 6 9 17 4 12">'), Le = /* @__PURE__ */ b("<button type=button><div></div><span></span><div>");
13
+ function $e(e) {
13
14
  const n = j(() => {
14
15
  if (!e.match || e.match.matchedIndices.length === 0)
15
16
  return [{
@@ -30,11 +31,11 @@ function Le(e) {
30
31
  highlight: d
31
32
  }), o;
32
33
  });
33
- return b(q, {
34
+ return C(q, {
34
35
  get each() {
35
36
  return n();
36
37
  },
37
- children: (o) => b(p, {
38
+ children: (o) => C(A, {
38
39
  get when() {
39
40
  return o.highlight;
40
41
  },
@@ -42,15 +43,15 @@ function Le(e) {
42
43
  return de(() => o.text);
43
44
  },
44
45
  get children() {
45
- var D = Ie();
46
+ var D = we();
46
47
  return w(D, () => o.text), D;
47
48
  }
48
49
  })
49
50
  });
50
51
  }
51
- function Ne(e) {
52
- const n = J(), o = xe(), D = () => (e.enableDragDrop ?? !0) && !!o, h = () => e.instanceId ?? "default", d = 112, l = 8, f = 180, y = 2, E = 6, [g, A] = W(null), O = he(g), v = j(() => {
53
- const s = O()?.width ?? 0;
52
+ function je(e) {
53
+ const n = J(), o = xe(), D = () => (e.enableDragDrop ?? !0) && !!o, h = () => e.instanceId ?? "default", d = 112, l = 8, f = 180, y = 2, E = 6, [g, O] = W(null), p = he(g), v = j(() => {
54
+ const s = p()?.width ?? 0;
54
55
  if (s <= 0) return y;
55
56
  const x = Math.floor((s + l) / (f + l));
56
57
  return Math.max(y, Math.min(E, x));
@@ -70,26 +71,26 @@ function Ne(e) {
70
71
  const x = k(), a = Math.floor(T.scrollTop / Math.max(1, x)) * Math.max(1, P), r = Math.floor(a / Math.max(1, s));
71
72
  T.scrollTop = r * x, c.onScroll(), P = s;
72
73
  }), (() => {
73
- var s = ye(), x = s.firstChild, S = x.firstChild;
74
+ var s = Pe(), x = s.firstChild, M = x.firstChild;
74
75
  return le(s, "scroll", c.onScroll), K((a) => {
75
76
  T = a, c.scrollRef(a), n.setScrollContainer(a);
76
- }, s), K((a) => A(a), S), w(x, b(p, {
77
+ }, s), K((a) => O(a), M), w(x, C(A, {
77
78
  get when() {
78
79
  return n.currentFiles().length > 0;
79
80
  },
80
81
  get fallback() {
81
82
  return (() => {
82
- var a = Me();
83
- return w(a, b(p, {
83
+ var a = _e();
84
+ return w(a, C(A, {
84
85
  get when() {
85
86
  return n.filterQueryApplied().trim();
86
87
  },
87
88
  get fallback() {
88
- return _e();
89
+ return Te();
89
90
  },
90
91
  get children() {
91
92
  return [(() => {
92
- var r = Pe(), M = r.firstChild, I = M.nextSibling;
93
+ var r = Me(), S = r.firstChild, I = S.nextSibling;
93
94
  return I.nextSibling, w(r, () => n.filterQueryApplied(), I), r;
94
95
  })(), (() => {
95
96
  var r = Se();
@@ -100,12 +101,12 @@ function Ne(e) {
100
101
  })();
101
102
  },
102
103
  get children() {
103
- var a = we();
104
- return w(a, b(q, {
104
+ var a = ye();
105
+ return w(a, C(q, {
105
106
  get each() {
106
107
  return F();
107
108
  },
108
- children: (r) => b($e, {
109
+ children: (r) => C(ke, {
109
110
  item: r,
110
111
  get instanceId() {
111
112
  return h();
@@ -116,8 +117,8 @@ function Ne(e) {
116
117
  dragContext: o
117
118
  })
118
119
  })), Y((r) => {
119
- var M = `repeat(${v()}, minmax(0, 1fr))`, I = `${c.paddingTop()}px`, H = `${c.paddingBottom()}px`;
120
- return M !== r.e && X(a, "grid-template-columns", r.e = M), I !== r.t && X(a, "padding-top", r.t = I), H !== r.a && X(a, "padding-bottom", r.a = H), r;
120
+ var S = `repeat(${v()}, minmax(0, 1fr))`, I = `${c.paddingTop()}px`, H = `${c.paddingBottom()}px`;
121
+ return S !== r.e && X(a, "grid-template-columns", r.e = S), I !== r.t && X(a, "padding-top", r.t = I), H !== r.a && X(a, "padding-bottom", r.a = H), r;
121
122
  }, {
122
123
  e: void 0,
123
124
  t: void 0,
@@ -127,10 +128,12 @@ function Ne(e) {
127
128
  }), null), Y(() => G(s, $("h-full min-h-0 overflow-auto", e.class))), s;
128
129
  })();
129
130
  }
130
- function $e(e) {
131
- const n = J(), o = () => n.isSelected(e.item.id), D = () => n.getFilterMatchForId(e.item.id), h = me(() => e.item), d = Ce(n, h);
131
+ function ke(e) {
132
+ const n = J(), o = () => n.isSelected(e.item.id), D = () => n.getFilterMatchForId(e.item.id), h = me(() => e.item), d = be(n, h, {
133
+ source: "grid"
134
+ });
132
135
  let l, f = null, y = 0, E = 0, g = !1;
133
- const A = 5, O = 500;
136
+ const O = 5, p = 500;
134
137
  let v = null;
135
138
  const [k, B] = W(!1), c = () => l === "touch" || l === "pen", N = () => e.item.type === "folder", L = () => N() && e.enableDragDrop && e.dragContext, F = () => {
136
139
  if (!L() || !e.dragContext) return !1;
@@ -143,14 +146,14 @@ function $e(e) {
143
146
  }, P = () => {
144
147
  v !== null && (clearTimeout(v), v = null);
145
148
  }, s = () => {
146
- typeof document > "u" || (document.removeEventListener("pointermove", r, !0), document.removeEventListener("pointerup", M, !0), document.removeEventListener("pointercancel", I, !0));
149
+ typeof document > "u" || (document.removeEventListener("pointermove", r, !0), document.removeEventListener("pointerup", S, !0), document.removeEventListener("pointercancel", I, !0));
147
150
  }, x = () => {
148
- typeof document > "u" || (document.addEventListener("pointermove", r, !0), document.addEventListener("pointerup", M, !0), document.addEventListener("pointercancel", I, !0));
149
- }, S = (t) => {
151
+ typeof document > "u" || (document.addEventListener("pointermove", r, !0), document.addEventListener("pointerup", S, !0), document.addEventListener("pointercancel", I, !0));
152
+ }, M = (t) => {
150
153
  P(), s(), g && e.dragContext && e.dragContext.endDrag(t), f = null, g = !1;
151
154
  };
152
155
  fe(() => {
153
- S(!1);
156
+ M(!1);
154
157
  });
155
158
  const a = (t, i) => {
156
159
  if (!e.enableDragDrop || !e.dragContext || g) return;
@@ -170,18 +173,18 @@ function $e(e) {
170
173
  if (f !== t.pointerId) return;
171
174
  const i = t.clientX - y, u = t.clientY - E, _ = Math.sqrt(i * i + u * u);
172
175
  if (c() && !g && _ > 10) {
173
- S(!1);
176
+ M(!1);
174
177
  return;
175
178
  }
176
- !c() && !g && _ > A && a(t.clientX, t.clientY), g && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
177
- }, M = (t) => {
178
- f === t.pointerId && (d.onPointerUp(), S(!0));
179
+ !c() && !g && _ > O && a(t.clientX, t.clientY), g && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
180
+ }, S = (t) => {
181
+ f === t.pointerId && (d.onPointerUp(), M(!0));
179
182
  }, I = (t) => {
180
- f === t.pointerId && (d.onPointerCancel(), S(!1));
183
+ f === t.pointerId && (d.onPointerCancel(), M(!1));
181
184
  }, H = (t) => {
182
185
  l = t.pointerType, d.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (f = t.pointerId, y = t.clientX, E = t.clientY, g = !1, x(), c() && (P(), v = setTimeout(() => {
183
186
  f !== null && !g && a(y, E);
184
- }, O))));
187
+ }, p))));
185
188
  }, Z = (t) => {
186
189
  l = t.pointerType, d.onPointerMove(t);
187
190
  }, ee = (t) => {
@@ -218,14 +221,16 @@ function $e(e) {
218
221
  if (t.preventDefault(), t.stopPropagation(), c()) return;
219
222
  o() || n.selectItem(e.item.id, !1);
220
223
  const i = n.getSelectedItemsList(), u = i.length > 0 ? i : [e.item];
221
- n.showContextMenu({
224
+ n.showContextMenu(Ie({
222
225
  x: t.clientX,
223
226
  y: t.clientY,
224
- items: u
225
- });
227
+ triggerItem: e.item,
228
+ items: u,
229
+ source: "grid"
230
+ }));
226
231
  }, ae = () => e.dragContext?.dragState(), oe = () => ae()?.isDragging ?? !1, U = () => k() && oe() && L();
227
232
  return (() => {
228
- var t = Ee(), i = t.firstChild, u = i.nextSibling, _ = u.nextSibling;
233
+ var t = Le(), i = t.firstChild, u = i.nextSibling, _ = u.nextSibling;
229
234
  return ce(t, se(De, {
230
235
  get title() {
231
236
  return e.item.name;
@@ -252,19 +257,19 @@ function $e(e) {
252
257
  U() && !F() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
253
258
  );
254
259
  }
255
- }), !1, !0), w(t, b(p, {
260
+ }), !1, !0), w(t, C(A, {
256
261
  get when() {
257
262
  return o();
258
263
  },
259
264
  get children() {
260
- return Te();
265
+ return Ee();
261
266
  }
262
- }), i), w(i, b(be, {
267
+ }), i), w(i, C(Ce, {
263
268
  get item() {
264
269
  return e.item;
265
270
  },
266
271
  class: "w-8 h-8"
267
- })), w(u, b(Le, {
272
+ })), w(u, C($e, {
268
273
  get name() {
269
274
  return e.item.name;
270
275
  },
@@ -284,5 +289,5 @@ function $e(e) {
284
289
  }
285
290
  ge(["click"]);
286
291
  export {
287
- Ne as FileGridView
292
+ je as FileGridView
288
293
  };