@floegence/floe-webapp-core 0.8.2 → 0.8.3

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/index41.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import { createComponent as me } from "solid-js/web";
2
2
  import { createContext as we, createSignal as a, createMemo as N, useContext as Pe } from "solid-js";
3
- import { deferNonBlocking as I } from "./index70.js";
3
+ import { deferNonBlocking as F } from "./index70.js";
4
4
  const R = we();
5
- function Q(r, h) {
6
- if (!h) return [];
7
- const x = r.toLowerCase(), w = h.toLowerCase(), p = [];
8
- let g = 0;
9
- for (const S of w) {
10
- const m = x.indexOf(S, g);
11
- if (m === -1) return null;
12
- p.push(m), g = m + 1;
5
+ function Q(r, i) {
6
+ if (!i) return [];
7
+ const h = r.toLowerCase(), g = i.toLowerCase(), p = [];
8
+ let m = 0;
9
+ for (const x of g) {
10
+ const w = h.indexOf(x, m);
11
+ if (w === -1) return null;
12
+ p.push(w), m = w + 1;
13
13
  }
14
14
  return p;
15
15
  }
16
16
  function ye(r) {
17
- const [h, x] = a(r.initialPath ?? "/"), [w, p] = a(/* @__PURE__ */ new Set()), [g, S] = a(r.initialViewMode ?? "list"), [m, V] = a({
17
+ const i = (e) => {
18
+ const t = (e ?? "").trim();
19
+ return t === "" ? "/" : t;
20
+ }, [h, g] = a(i(r.initialPath ?? "/")), [p, m] = a(/* @__PURE__ */ new Set()), [x, w] = a(r.initialViewMode ?? "list"), [I, V] = a({
18
21
  field: "name",
19
22
  direction: "asc"
20
- }), [M, b] = a(/* @__PURE__ */ new Set(["/"])), [j, D] = a(!1), [G, O] = a(null), [v, k] = a(""), [H, B] = a(!1), J = () => r.homeLabel ?? "Root", [z, P] = a([]);
21
- let u = null, C = {
23
+ }), [M, b] = a(/* @__PURE__ */ new Set(["/"])), [j, D] = a(!1), [G, O] = a(null), [S, k] = a(""), [H, B] = a(!1), J = () => r.homeLabel ?? "Root", [z, P] = a([]);
24
+ let u = null, v = {
22
25
  top: 0,
23
26
  left: 0
24
27
  };
25
- const A = () => r.files, c = (e) => {
26
- const t = (e ?? "").trim();
27
- return t === "" ? "/" : t;
28
- }, L = (e) => {
29
- const t = c(e);
28
+ const A = () => r.files, L = (e) => {
29
+ const t = i(e);
30
30
  if (t === "/") return "/";
31
31
  const n = t.split("/").filter(Boolean);
32
32
  return n.pop(), n.length ? "/" + n.join("/") : "/";
@@ -34,22 +34,22 @@ function ye(r) {
34
34
  const n = z();
35
35
  if (n.length === 0) return e;
36
36
  let s = [...e];
37
- const d = c(t);
37
+ const d = i(t);
38
38
  for (const o of n)
39
39
  switch (o.type) {
40
40
  case "remove": {
41
- const l = new Set(o.paths.map(c));
42
- s = s.filter((i) => !l.has(c(i.path)));
41
+ const l = new Set(o.paths.map(i));
42
+ s = s.filter((c) => !l.has(i(c.path)));
43
43
  break;
44
44
  }
45
45
  case "update": {
46
- const l = c(o.oldPath), i = s.findIndex((f) => c(f.path) === l);
47
- if (i !== -1) {
48
- const f = o.updates.path ?? s[i].path;
49
- L(f) === d ? s[i] = {
50
- ...s[i],
46
+ const l = i(o.oldPath), c = s.findIndex((f) => i(f.path) === l);
47
+ if (c !== -1) {
48
+ const f = o.updates.path ?? s[c].path;
49
+ L(f) === d ? s[c] = {
50
+ ...s[c],
51
51
  ...o.updates
52
- } : s.splice(i, 1);
52
+ } : s.splice(c, 1);
53
53
  } else {
54
54
  const f = o.updates.path;
55
55
  f && L(f);
@@ -57,7 +57,7 @@ function ye(r) {
57
57
  break;
58
58
  }
59
59
  case "insert": {
60
- c(o.parentPath) === d && (s.some((i) => c(i.path) === c(o.item.path)) || s.push(o.item));
60
+ i(o.parentPath) === d && (s.some((c) => i(c.path) === i(o.item.path)) || s.push(o.item));
61
61
  break;
62
62
  }
63
63
  }
@@ -66,63 +66,64 @@ function ye(r) {
66
66
  const e = /* @__PURE__ */ new Map(), t = (s) => {
67
67
  var d;
68
68
  for (const o of s)
69
- o.type === "folder" && (e.set(c(o.path), o.children ?? []), (d = o.children) != null && d.length && t(o.children));
69
+ o.type === "folder" && (e.set(i(o.path), o.children ?? []), (d = o.children) != null && d.length && t(o.children));
70
70
  }, n = A();
71
71
  return e.set("/", n), t(n), e;
72
72
  }), T = N(() => {
73
- const e = c(h());
73
+ const e = i(h());
74
74
  let t = W().get(e) ?? [];
75
75
  t = K(t, e);
76
- const n = v().trim();
76
+ const n = S().trim();
77
77
  n && (t = t.filter((o) => Q(o.name, n) !== null));
78
- const s = m();
78
+ const s = I();
79
79
  return [...t].sort((o, l) => {
80
- var f, F;
80
+ var f, y;
81
81
  if (o.type !== l.type)
82
82
  return o.type === "folder" ? -1 : 1;
83
- let i = 0;
83
+ let c = 0;
84
84
  switch (s.field) {
85
85
  case "name":
86
- i = o.name.localeCompare(l.name);
86
+ c = o.name.localeCompare(l.name);
87
87
  break;
88
88
  case "size":
89
- i = (o.size ?? 0) - (l.size ?? 0);
89
+ c = (o.size ?? 0) - (l.size ?? 0);
90
90
  break;
91
91
  case "modifiedAt":
92
- i = (((f = o.modifiedAt) == null ? void 0 : f.getTime()) ?? 0) - (((F = l.modifiedAt) == null ? void 0 : F.getTime()) ?? 0);
92
+ c = (((f = o.modifiedAt) == null ? void 0 : f.getTime()) ?? 0) - (((y = l.modifiedAt) == null ? void 0 : y.getTime()) ?? 0);
93
93
  break;
94
94
  case "type":
95
- i = (o.extension ?? "").localeCompare(l.extension ?? "");
95
+ c = (o.extension ?? "").localeCompare(l.extension ?? "");
96
96
  break;
97
97
  }
98
- return s.direction === "asc" ? i : -i;
98
+ return s.direction === "asc" ? c : -c;
99
99
  });
100
- }), y = (e) => {
100
+ }), C = (e) => {
101
101
  var s;
102
- const t = c(e);
103
- x(t), p(/* @__PURE__ */ new Set()), k(""), B(!1);
102
+ const t = i(e);
103
+ if (t === h()) return;
104
+ g(t), m(/* @__PURE__ */ new Set()), k(""), B(!1);
104
105
  const n = r.onSelect;
105
- I(() => n == null ? void 0 : n([])), (s = r.onNavigate) == null || s.call(r, t);
106
+ F(() => n == null ? void 0 : n([])), (s = r.onNavigate) == null || s.call(r, t);
106
107
  }, X = () => {
107
108
  const e = h();
108
109
  if (e === "/" || e === "") return;
109
110
  const t = e.split("/").filter(Boolean);
110
- t.pop(), y(t.length ? "/" + t.join("/") : "/");
111
+ t.pop(), C(t.length ? "/" + t.join("/") : "/");
111
112
  }, U = (e) => {
112
- e.type === "folder" && (y(e.path), b((t) => {
113
+ e.type === "folder" && (C(e.path), b((t) => {
113
114
  const n = new Set(t);
114
115
  return n.add(e.path), n;
115
116
  }));
116
117
  }, Y = (e, t = !1) => {
117
- const n = w(), s = t ? new Set(n) : /* @__PURE__ */ new Set();
118
- t ? s.has(e) ? s.delete(e) : s.add(e) : (s.clear(), s.add(e)), p(s);
118
+ const n = p(), s = t ? new Set(n) : /* @__PURE__ */ new Set();
119
+ t ? s.has(e) ? s.delete(e) : s.add(e) : (s.clear(), s.add(e)), m(s);
119
120
  const d = T().filter((l) => s.has(l.id)), o = r.onSelect;
120
- I(() => o == null ? void 0 : o(d));
121
+ F(() => o == null ? void 0 : o(d));
121
122
  }, Z = () => {
122
- p(/* @__PURE__ */ new Set());
123
+ m(/* @__PURE__ */ new Set());
123
124
  const e = r.onSelect;
124
- I(() => e == null ? void 0 : e([]));
125
- }, _ = (e) => w().has(e), $ = (e) => {
125
+ F(() => e == null ? void 0 : e([]));
126
+ }, _ = (e) => p().has(e), $ = (e) => {
126
127
  b((t) => {
127
128
  const n = new Set(t);
128
129
  return n.has(e) ? n.delete(e) : n.add(e), n;
@@ -130,7 +131,7 @@ function ye(r) {
130
131
  }, ee = (e) => M().has(e), te = () => D((e) => !e), ne = (e) => O(e), oe = () => O(null), se = (e) => {
131
132
  k(e);
132
133
  }, re = (e) => {
133
- const t = v().trim();
134
+ const t = S().trim();
134
135
  if (!t) return null;
135
136
  const n = Q(e, t);
136
137
  return n ? {
@@ -172,24 +173,24 @@ function ye(r) {
172
173
  u && (u.scrollTop = e.top, u.scrollLeft = e.left);
173
174
  }, pe = {
174
175
  currentPath: h,
175
- setCurrentPath: y,
176
+ setCurrentPath: C,
176
177
  navigateUp: X,
177
178
  navigateTo: U,
178
179
  homeLabel: J,
179
- selectedItems: () => w(),
180
+ selectedItems: () => p(),
180
181
  selectItem: Y,
181
182
  clearSelection: Z,
182
183
  isSelected: _,
183
- viewMode: g,
184
- setViewMode: S,
185
- sortConfig: m,
184
+ viewMode: x,
185
+ setViewMode: w,
186
+ sortConfig: I,
186
187
  setSortConfig: V,
187
188
  expandedFolders: M,
188
189
  toggleFolder: $,
189
190
  isExpanded: ee,
190
191
  files: A,
191
192
  currentFiles: T,
192
- filterQuery: v,
193
+ filterQuery: S,
193
194
  setFilterQuery: se,
194
195
  isFilterActive: H,
195
196
  setFilterActive: B,
@@ -211,10 +212,10 @@ function ye(r) {
211
212
  setScrollContainer: he,
212
213
  getScrollPosition: E,
213
214
  setScrollPosition: q,
214
- saveScrollPosition: () => (C = E(), C),
215
+ saveScrollPosition: () => (v = E(), v),
215
216
  restoreScrollPosition: () => {
216
217
  requestAnimationFrame(() => {
217
- q(C);
218
+ q(v);
218
219
  });
219
220
  }
220
221
  };
package/dist/index42.js CHANGED
@@ -1,5 +1,5 @@
1
- import { delegateEvents as U, template as x, insert as s, createComponent as o, effect as $, className as g, setAttribute as j, memo as k, setStyleProperty as B } from "solid-js/web";
2
- import { createMemo as w, For as H, untrack as R, Show as b } from "solid-js";
1
+ import { delegateEvents as U, template as x, insert as s, createComponent as o, effect as y, className as g, setAttribute as j, memo as k, setStyleProperty as B } from "solid-js/web";
2
+ import { createMemo as w, For as H, untrack as R, Show as $ } from "solid-js";
3
3
  import { cn as v } from "./index69.js";
4
4
  import { useFileBrowser as T } from "./index41.js";
5
5
  import { FolderOpenIcon as X, FolderIcon as Y } from "./index48.js";
@@ -10,12 +10,12 @@ function ie(n) {
10
10
  const i = T(), r = w(() => i.files().filter((c) => c.type === "folder"));
11
11
  return (() => {
12
12
  var c = _();
13
- return c.$$contextmenu = (y) => y.preventDefault(), s(c, o(F, {
13
+ return c.$$contextmenu = (b) => b.preventDefault(), s(c, o(F, {
14
14
  get items() {
15
15
  return r();
16
16
  },
17
17
  depth: 0
18
- })), $(() => g(c, v("flex flex-col", n.class))), c;
18
+ })), y(() => g(c, v("flex flex-col", n.class))), c;
19
19
  })();
20
20
  }
21
21
  function F(n) {
@@ -33,7 +33,7 @@ function F(n) {
33
33
  });
34
34
  }
35
35
  function V(n) {
36
- const i = T(), r = () => i.isExpanded(n.item.path), c = () => i.currentPath() === n.item.path, y = R(() => n.item), f = z(i, y, {
36
+ const i = T(), r = () => i.isExpanded(n.item.path), c = () => i.currentPath() === n.item.path, b = R(() => n.item), f = z(i, b, {
37
37
  selectOnOpen: !1
38
38
  });
39
39
  let u;
@@ -49,7 +49,7 @@ function V(n) {
49
49
  }, I = (e) => {
50
50
  u = e.pointerType, f.onPointerCancel();
51
51
  }, L = (e) => {
52
- f.consumeClickSuppression(e) || i.setCurrentPath(n.item.path);
52
+ f.consumeClickSuppression(e) || i.navigateTo(b);
53
53
  }, N = (e) => {
54
54
  e.preventDefault(), e.stopPropagation(), !M() && i.showContextMenu({
55
55
  x: e.clientX,
@@ -61,7 +61,7 @@ function V(n) {
61
61
  };
62
62
  return (() => {
63
63
  var e = K(), d = e.firstChild, l = d.firstChild, C = l.firstChild, A = C.nextSibling;
64
- return s(d, o(b, {
64
+ return s(d, o($, {
65
65
  get when() {
66
66
  return m();
67
67
  },
@@ -72,15 +72,15 @@ function V(n) {
72
72
  var t = G();
73
73
  return t.$$click = O, s(t, o(q, {
74
74
  class: "w-3 h-3 opacity-50"
75
- })), $((a) => {
76
- var h = v("flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center cursor-pointer", "transition-transform duration-150", r() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring"), p = r() ? "Collapse folder" : "Expand folder";
77
- return h !== a.e && g(t, a.e = h), p !== a.t && j(t, "aria-label", a.t = p), a;
75
+ })), y((a) => {
76
+ var p = v("flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center cursor-pointer", "transition-transform duration-150", r() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring"), h = r() ? "Collapse folder" : "Expand folder";
77
+ return p !== a.e && g(t, a.e = p), h !== a.t && j(t, "aria-label", a.t = h), a;
78
78
  }, {
79
79
  e: void 0,
80
80
  t: void 0
81
81
  }), t;
82
82
  }
83
- }), l), l.addEventListener("pointercancel", I), l.$$pointerup = S, l.$$pointermove = E, l.$$pointerdown = D, l.$$contextmenu = N, l.$$click = L, s(C, o(b, {
83
+ }), l), l.addEventListener("pointercancel", I), l.$$pointerup = S, l.$$pointermove = E, l.$$pointerdown = D, l.$$contextmenu = N, l.$$click = L, s(C, o($, {
84
84
  get when() {
85
85
  return k(() => !!m())() && r();
86
86
  },
@@ -94,7 +94,7 @@ function V(n) {
94
94
  class: "w-4 h-4"
95
95
  });
96
96
  }
97
- })), s(A, () => n.item.name), s(l, o(b, {
97
+ })), s(A, () => n.item.name), s(l, o($, {
98
98
  get when() {
99
99
  return m();
100
100
  },
@@ -102,7 +102,7 @@ function V(n) {
102
102
  var t = J();
103
103
  return s(t, P), t;
104
104
  }
105
- }), null), s(e, o(b, {
105
+ }), null), s(e, o($, {
106
106
  get when() {
107
107
  return k(() => !!r())() && m();
108
108
  },
@@ -115,11 +115,11 @@ function V(n) {
115
115
  get depth() {
116
116
  return n.depth + 1;
117
117
  }
118
- })), $(() => g(t, v("overflow-hidden transition-all duration-200", r() ? "opacity-100" : "opacity-0"))), t;
118
+ })), y(() => g(t, v("overflow-hidden transition-all duration-200", r() ? "opacity-100" : "opacity-0"))), t;
119
119
  }
120
- }), null), $((t) => {
121
- var a = v("group flex items-center w-full py-1 text-xs", "transition-all duration-100", "hover:bg-sidebar-accent/60", c() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium"), h = `${8 + n.depth * 12}px`, p = v("flex items-center gap-1 flex-1 min-w-0 text-left cursor-pointer pl-1", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring");
122
- return a !== t.e && g(d, t.e = a), h !== t.t && B(d, "padding-left", t.t = h), p !== t.a && g(l, t.a = p), t;
120
+ }), null), y((t) => {
121
+ var a = v("group flex items-center w-full py-1 text-xs", "transition-all duration-100", "hover:bg-sidebar-accent/60", c() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium"), p = `${8 + n.depth * 12}px`, h = v("flex items-center gap-1 flex-1 min-w-0 text-left cursor-pointer pl-1", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring");
122
+ return a !== t.e && g(d, t.e = a), p !== t.t && B(d, "padding-left", t.t = p), h !== t.a && g(l, t.a = h), t;
123
123
  }, {
124
124
  e: void 0,
125
125
  t: void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",