@floegence/floe-webapp-core 0.48.5 → 0.49.0
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/components/ui/DirectoryInput.d.ts +6 -27
- package/dist/components/ui/DirectoryInput.js +41 -115
- package/dist/components/ui/DirectoryPicker.d.ts +1 -5
- package/dist/components/ui/DirectoryPicker.js +27 -116
- package/dist/components/ui/FileOpenPicker.js +95 -167
- package/dist/components/ui/FileSavePicker.js +73 -160
- package/dist/components/ui/index.d.ts +2 -1
- package/dist/components/ui/localInteractionSurface.js +8 -8
- package/dist/components/ui/picker/PickerBase.d.ts +58 -176
- package/dist/components/ui/picker/PickerBase.js +273 -490
- package/dist/components/ui/picker/PickerNavigation.d.ts +91 -0
- package/dist/components/ui/picker/PickerNavigation.js +160 -0
- package/dist/components/workbench/WorkbenchWidget.js +2 -2
- package/dist/components/workbench/types.d.ts +4 -1
- package/dist/full.js +346 -341
- package/dist/styles.css +1 -1
- package/dist/ui.js +120 -115
- package/package.json +1 -1
|
@@ -1,38 +1,17 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { FileItem } from '../file-browser/types';
|
|
1
|
+
import { type PickerPanelProps } from './picker/PickerBase';
|
|
3
2
|
export type DirectoryInputSize = 'sm' | 'md' | 'lg';
|
|
4
|
-
export interface DirectoryInputProps {
|
|
5
|
-
/** Currently selected directory path */
|
|
3
|
+
export interface DirectoryInputProps extends PickerPanelProps {
|
|
6
4
|
value?: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
files: FileItem[];
|
|
11
|
-
/** Callback to load directory contents (for lazy loading) */
|
|
12
|
-
onExpand?: (path: string) => void | Promise<void>;
|
|
13
|
-
/** Async resolver that guarantees a target path exists in the current tree snapshot. */
|
|
14
|
-
ensurePath?: PickerEnsurePath;
|
|
15
|
-
/** Placeholder text when no directory is selected */
|
|
5
|
+
onChange?: (absolutePath: string) => void;
|
|
6
|
+
/** The containing form's lifecycle; close invalidates outstanding loads. */
|
|
7
|
+
open?: boolean;
|
|
16
8
|
placeholder?: string;
|
|
17
|
-
/** Optional home directory path for display */
|
|
18
|
-
homePath?: string;
|
|
19
|
-
/** Label for home button in picker */
|
|
20
|
-
homeLabel?: string;
|
|
21
|
-
/** Initial path when picker opens */
|
|
22
|
-
initialPath?: string;
|
|
23
|
-
/** Whether the input is disabled */
|
|
24
9
|
disabled?: boolean;
|
|
25
|
-
/** Input size variant */
|
|
26
10
|
size?: DirectoryInputSize;
|
|
27
|
-
/** Error message - also sets visual error state */
|
|
28
11
|
error?: string;
|
|
29
|
-
/** Helper text displayed below the input */
|
|
30
12
|
helperText?: string;
|
|
31
|
-
/** Additional CSS class */
|
|
32
13
|
class?: string;
|
|
33
|
-
/** Maximum height for the tree panel (default: '200px') */
|
|
34
|
-
treeMaxHeight?: string;
|
|
35
|
-
/** Whether the tree panel is expanded by default (default: true) */
|
|
36
14
|
defaultExpanded?: boolean;
|
|
37
15
|
}
|
|
16
|
+
/** Inline picker keeps the surrounding form visible and commits only validated absolute paths. */
|
|
38
17
|
export declare function DirectoryInput(props: DirectoryInputProps): import("solid-js").JSX.Element;
|
|
@@ -1,137 +1,63 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import {
|
|
3
|
-
import { cn as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
container: "h-8 px-2.5",
|
|
15
|
-
icon: "w-4 h-4",
|
|
16
|
-
text: "text-xs"
|
|
17
|
-
},
|
|
18
|
-
lg: {
|
|
19
|
-
container: "h-9 px-3",
|
|
20
|
-
icon: "w-4 h-4",
|
|
21
|
-
text: "text-sm"
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function A(b) {
|
|
25
|
-
const [e] = $(b, ["value", "onChange", "files", "onExpand", "ensurePath", "placeholder", "homePath", "homeLabel", "initialPath", "disabled", "size", "error", "helperText", "class", "treeMaxHeight", "defaultExpanded"]), [d, v] = C(e.defaultExpanded !== !1), P = () => e.size ?? "md", i = () => M[P()];
|
|
26
|
-
f(() => {
|
|
27
|
-
d() && e.files.length === 0 && e.onExpand && e.onExpand("/");
|
|
28
|
-
});
|
|
29
|
-
const r = T({
|
|
30
|
-
initialPath: () => e.initialPath ?? "/",
|
|
31
|
-
open: () => !0,
|
|
32
|
-
files: () => e.files,
|
|
33
|
-
onExpand: (n) => e.onExpand?.(n),
|
|
34
|
-
// eslint-disable-next-line solid/reactivity -- ensurePath is a static callback
|
|
35
|
-
ensurePath: e.ensurePath,
|
|
36
|
-
homeLabel: () => e.homeLabel,
|
|
37
|
-
homePath: () => e.homePath
|
|
38
|
-
});
|
|
39
|
-
f(_(r.selectedPath, (n) => {
|
|
40
|
-
if (!d()) return;
|
|
41
|
-
const l = r.toDisplayPath(n);
|
|
42
|
-
e.onChange?.(l);
|
|
43
|
-
}));
|
|
44
|
-
const E = () => {
|
|
45
|
-
if (e.disabled) return;
|
|
46
|
-
const n = d();
|
|
47
|
-
!n && e.files.length === 0 && e.onExpand && e.onExpand("/"), v(!n);
|
|
48
|
-
}, w = () => e.value ? e.homePath && e.value.startsWith(e.homePath) ? "~" + (e.value.slice(e.homePath.length) || "") : e.value : null;
|
|
1
|
+
import { insert as r, createComponent as l, mergeProps as $, memo as y, effect as C, className as x, setAttribute as f, template as a, delegateEvents as _ } from "solid-js/web";
|
|
2
|
+
import { createSignal as E, mergeProps as S, Show as d } from "solid-js";
|
|
3
|
+
import { cn as b } from "../../utils/cn.js";
|
|
4
|
+
import { Folder as z, ChevronRight as A } from "../icons/index.js";
|
|
5
|
+
import { formatPickerPath as N } from "./picker/PickerNavigation.js";
|
|
6
|
+
import { usePickerNavigation as T, PickerPanel as D } from "./picker/PickerBase.js";
|
|
7
|
+
var F = /* @__PURE__ */ a("<div class=mt-2>"), I = /* @__PURE__ */ a('<p role=alert class="mt-1 text-xs text-error">'), R = /* @__PURE__ */ a('<p class="mt-1 text-xs text-muted-foreground">'), V = /* @__PURE__ */ a('<div><button type=button><span class="min-w-0 flex-1 truncate">');
|
|
8
|
+
function K(t) {
|
|
9
|
+
const [o, P] = E(t.defaultExpanded !== !1), w = S(t, {
|
|
10
|
+
get initialPath() {
|
|
11
|
+
return t.value || t.initialPath;
|
|
12
|
+
}
|
|
13
|
+
}), s = T(w, () => t.open ?? !0, (i) => t.onChange?.(i)), k = () => N(t.value ?? "", s.context()?.homePathAbs ?? t.homePath);
|
|
49
14
|
return (() => {
|
|
50
|
-
var
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
}), h), o(h, () => w() || e.placeholder || "Select a directory..."), o(l, a(N, {
|
|
15
|
+
var i = V(), n = i.firstChild, c = n.firstChild;
|
|
16
|
+
return n.$$click = () => P((e) => !e), r(n, l(z, {
|
|
17
|
+
class: "h-4 w-4 shrink-0 text-muted-foreground"
|
|
18
|
+
}), c), r(c, () => k() || t.placeholder || "Select a directory…"), r(n, l(A, {
|
|
56
19
|
get class() {
|
|
57
|
-
return
|
|
20
|
+
return b("h-3.5 w-3.5 shrink-0 transition-transform", o() && "rotate-90");
|
|
58
21
|
}
|
|
59
|
-
}), null),
|
|
22
|
+
}), null), r(i, l(d, {
|
|
60
23
|
get when() {
|
|
61
|
-
return
|
|
24
|
+
return o();
|
|
62
25
|
},
|
|
63
26
|
get children() {
|
|
64
|
-
var
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
get onClick() {
|
|
70
|
-
return r.handleBreadcrumbClick;
|
|
71
|
-
}
|
|
72
|
-
})), o(t, a(L, {
|
|
73
|
-
get rootFolders() {
|
|
74
|
-
return r.rootFolders;
|
|
75
|
-
},
|
|
76
|
-
get selectedPath() {
|
|
77
|
-
return r.selectedPath;
|
|
78
|
-
},
|
|
79
|
-
get expandedPaths() {
|
|
80
|
-
return r.expandedPaths;
|
|
81
|
-
},
|
|
82
|
-
get revealNonce() {
|
|
83
|
-
return r.revealNonce;
|
|
84
|
-
},
|
|
85
|
-
get onToggle() {
|
|
86
|
-
return r.toggleExpand;
|
|
87
|
-
},
|
|
88
|
-
get onSelect() {
|
|
89
|
-
return r.handleSelectFolder;
|
|
90
|
-
},
|
|
91
|
-
get onSelectRoot() {
|
|
92
|
-
return r.handleSelectRoot;
|
|
93
|
-
},
|
|
94
|
-
get isSelectable() {
|
|
95
|
-
return r.isSelectable;
|
|
96
|
-
},
|
|
97
|
-
get homeLabel() {
|
|
98
|
-
return r.homeLabel;
|
|
99
|
-
},
|
|
100
|
-
class: "border-0 rounded-none",
|
|
101
|
-
get style() {
|
|
102
|
-
return {
|
|
103
|
-
"max-height": e.treeMaxHeight ?? "200px"
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}), null), t;
|
|
27
|
+
var e = F();
|
|
28
|
+
return r(e, l(D, $(t, {
|
|
29
|
+
source: s
|
|
30
|
+
}))), e;
|
|
107
31
|
}
|
|
108
|
-
}), null),
|
|
32
|
+
}), null), r(i, l(d, {
|
|
109
33
|
get when() {
|
|
110
|
-
return
|
|
34
|
+
return t.error;
|
|
111
35
|
},
|
|
112
36
|
get children() {
|
|
113
|
-
var
|
|
114
|
-
return
|
|
37
|
+
var e = I();
|
|
38
|
+
return r(e, () => t.error), e;
|
|
115
39
|
}
|
|
116
|
-
}), null),
|
|
40
|
+
}), null), r(i, l(d, {
|
|
117
41
|
get when() {
|
|
118
|
-
return
|
|
42
|
+
return y(() => !!t.helperText)() && !t.error;
|
|
119
43
|
},
|
|
120
44
|
get children() {
|
|
121
|
-
var
|
|
122
|
-
return
|
|
45
|
+
var e = R();
|
|
46
|
+
return r(e, () => t.helperText), e;
|
|
123
47
|
}
|
|
124
|
-
}), null),
|
|
125
|
-
var
|
|
126
|
-
return
|
|
48
|
+
}), null), C((e) => {
|
|
49
|
+
var u = t.class, m = t.disabled, h = o(), v = t.value, g = b("flex w-full cursor-pointer items-center gap-2 rounded border border-input bg-background px-2 text-left shadow-sm focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", t.size === "lg" ? "h-9 text-sm" : t.size === "md" ? "h-8 text-xs" : "h-7 text-xs");
|
|
50
|
+
return u !== e.e && x(i, e.e = u), m !== e.t && (n.disabled = e.t = m), h !== e.a && f(n, "aria-expanded", e.a = h), v !== e.o && f(n, "title", e.o = v), g !== e.i && x(n, e.i = g), e;
|
|
127
51
|
}, {
|
|
128
52
|
e: void 0,
|
|
129
53
|
t: void 0,
|
|
130
|
-
a: void 0
|
|
131
|
-
|
|
54
|
+
a: void 0,
|
|
55
|
+
o: void 0,
|
|
56
|
+
i: void 0
|
|
57
|
+
}), i;
|
|
132
58
|
})();
|
|
133
59
|
}
|
|
134
|
-
|
|
60
|
+
_(["click"]);
|
|
135
61
|
export {
|
|
136
|
-
|
|
62
|
+
K as DirectoryInput
|
|
137
63
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { type BasePickerProps } from './picker/PickerBase';
|
|
2
2
|
export interface DirectoryPickerProps extends BasePickerProps {
|
|
3
|
-
/**
|
|
3
|
+
/** Receives the validated absolute directory path. */
|
|
4
4
|
onSelect: (path: string) => void;
|
|
5
5
|
}
|
|
6
|
-
/**
|
|
7
|
-
* Modal directory picker for selecting a folder path.
|
|
8
|
-
* Standalone component — does not depend on FileBrowserContext.
|
|
9
|
-
*/
|
|
10
6
|
export declare function DirectoryPicker(props: DirectoryPickerProps): import("solid-js").JSX.Element;
|
|
@@ -1,147 +1,58 @@
|
|
|
1
|
-
import { createComponent as r, insert as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { createComponent as r, mergeProps as o, insert as i, effect as u, setAttribute as m, template as g } from "solid-js/web";
|
|
2
|
+
import { cn as f } from "../../utils/cn.js";
|
|
3
|
+
import { Button as c } from "./Button.js";
|
|
4
4
|
import { Dialog as s } from "./Dialog.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
open: () => t.open,
|
|
13
|
-
files: () => t.files,
|
|
14
|
-
// eslint-disable-next-line solid/reactivity -- filter is a static callback
|
|
15
|
-
filter: t.filter ? (n) => t.filter(n) : void 0,
|
|
16
|
-
// eslint-disable-next-line solid/reactivity -- onExpand is a static callback
|
|
17
|
-
onExpand: t.onExpand,
|
|
18
|
-
// eslint-disable-next-line solid/reactivity -- ensurePath is a static callback
|
|
19
|
-
ensurePath: t.ensurePath,
|
|
20
|
-
homeLabel: () => t.homeLabel,
|
|
21
|
-
homePath: () => t.homePath
|
|
22
|
-
}), u = () => {
|
|
23
|
-
const n = e.selectedPath(), a = t.onSelect;
|
|
24
|
-
t.onOpenChange(!1), P(() => a(n));
|
|
25
|
-
}, c = () => {
|
|
26
|
-
t.onOpenChange(!1);
|
|
5
|
+
import { usePickerNavigation as h, PickerPanel as d, pickerCopy as x } from "./picker/PickerBase.js";
|
|
6
|
+
var C = /* @__PURE__ */ g('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">');
|
|
7
|
+
function w(e) {
|
|
8
|
+
const t = h(e, () => e.open), a = () => {
|
|
9
|
+
if (!t.valid()) return;
|
|
10
|
+
const n = t.currentPath();
|
|
11
|
+
e.onSelect(n), e.onOpenChange(!1);
|
|
27
12
|
};
|
|
28
13
|
return r(s, {
|
|
29
14
|
get open() {
|
|
30
|
-
return
|
|
15
|
+
return e.open;
|
|
31
16
|
},
|
|
32
17
|
get onOpenChange() {
|
|
33
|
-
return
|
|
18
|
+
return e.onOpenChange;
|
|
34
19
|
},
|
|
35
20
|
get title() {
|
|
36
|
-
return
|
|
21
|
+
return e.title ?? "Select Directory";
|
|
37
22
|
},
|
|
38
23
|
get class() {
|
|
39
|
-
return
|
|
24
|
+
return f("max-w-lg", e.class);
|
|
40
25
|
},
|
|
41
26
|
get footer() {
|
|
42
27
|
return (() => {
|
|
43
|
-
var n =
|
|
44
|
-
return l
|
|
28
|
+
var n = C(), l = n.firstChild;
|
|
29
|
+
return i(l, () => t.currentPath()), i(n, r(c, {
|
|
45
30
|
variant: "ghost",
|
|
46
31
|
size: "sm",
|
|
47
|
-
onClick:
|
|
32
|
+
onClick: () => e.onOpenChange(!1),
|
|
48
33
|
get children() {
|
|
49
|
-
return
|
|
34
|
+
return e.cancelText ?? x(e).cancel;
|
|
50
35
|
}
|
|
51
|
-
}), null),
|
|
36
|
+
}), null), i(n, r(c, {
|
|
52
37
|
variant: "primary",
|
|
53
38
|
size: "sm",
|
|
54
|
-
onClick:
|
|
39
|
+
onClick: a,
|
|
55
40
|
get disabled() {
|
|
56
|
-
return
|
|
41
|
+
return !t.valid();
|
|
57
42
|
},
|
|
58
43
|
get children() {
|
|
59
|
-
return
|
|
44
|
+
return e.confirmText ?? "Select";
|
|
60
45
|
}
|
|
61
|
-
}), null),
|
|
46
|
+
}), null), u(() => m(l, "title", t.currentPath())), n;
|
|
62
47
|
})();
|
|
63
48
|
},
|
|
64
49
|
get children() {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return e.pathInput;
|
|
69
|
-
},
|
|
70
|
-
onInput: (a) => {
|
|
71
|
-
e.setPathInput(a), e.setPathInputError("");
|
|
72
|
-
},
|
|
73
|
-
get pending() {
|
|
74
|
-
return e.pathPending;
|
|
75
|
-
},
|
|
76
|
-
get error() {
|
|
77
|
-
return e.pathInputError;
|
|
78
|
-
},
|
|
79
|
-
get onGo() {
|
|
80
|
-
return e.handlePathInputGo;
|
|
81
|
-
},
|
|
82
|
-
get onKeyDown() {
|
|
83
|
-
return e.handlePathInputKeyDown;
|
|
84
|
-
}
|
|
85
|
-
}), null), l(n, r(C, {
|
|
86
|
-
get segments() {
|
|
87
|
-
return e.breadcrumbSegments;
|
|
88
|
-
},
|
|
89
|
-
get onClick() {
|
|
90
|
-
return e.handleBreadcrumbClick;
|
|
91
|
-
}
|
|
92
|
-
}), null), l(n, r(p, {
|
|
93
|
-
get rootFolders() {
|
|
94
|
-
return e.rootFolders;
|
|
95
|
-
},
|
|
96
|
-
get selectedPath() {
|
|
97
|
-
return e.selectedPath;
|
|
98
|
-
},
|
|
99
|
-
get expandedPaths() {
|
|
100
|
-
return e.expandedPaths;
|
|
101
|
-
},
|
|
102
|
-
get revealNonce() {
|
|
103
|
-
return e.revealNonce;
|
|
104
|
-
},
|
|
105
|
-
get onToggle() {
|
|
106
|
-
return e.toggleExpand;
|
|
107
|
-
},
|
|
108
|
-
get onSelect() {
|
|
109
|
-
return e.handleSelectFolder;
|
|
110
|
-
},
|
|
111
|
-
get onSelectRoot() {
|
|
112
|
-
return e.handleSelectRoot;
|
|
113
|
-
},
|
|
114
|
-
get isSelectable() {
|
|
115
|
-
return e.isSelectable;
|
|
116
|
-
},
|
|
117
|
-
get homeLabel() {
|
|
118
|
-
return e.homeLabel;
|
|
119
|
-
},
|
|
120
|
-
style: {
|
|
121
|
-
"max-height": "280px",
|
|
122
|
-
"min-height": "160px"
|
|
123
|
-
}
|
|
124
|
-
}), null), l(n, r(d, {
|
|
125
|
-
get when() {
|
|
126
|
-
return t.onCreateFolder;
|
|
127
|
-
},
|
|
128
|
-
get children() {
|
|
129
|
-
return r(S, {
|
|
130
|
-
get parentPath() {
|
|
131
|
-
return e.selectedPath;
|
|
132
|
-
},
|
|
133
|
-
get onCreateFolder() {
|
|
134
|
-
return t.onCreateFolder;
|
|
135
|
-
},
|
|
136
|
-
get toDisplayPath() {
|
|
137
|
-
return e.toDisplayPath;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}), null), n;
|
|
50
|
+
return r(d, o(e, {
|
|
51
|
+
source: t
|
|
52
|
+
}));
|
|
142
53
|
}
|
|
143
54
|
});
|
|
144
55
|
}
|
|
145
56
|
export {
|
|
146
|
-
|
|
57
|
+
w as DirectoryPicker
|
|
147
58
|
};
|