@columenlabs/lumen-ui 0.1.132 → 0.1.134
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/saved-answers.js +13 -3
- package/dist/settings.js +9 -1
- package/package.json +2 -2
package/dist/saved-answers.js
CHANGED
|
@@ -10,8 +10,17 @@
|
|
|
10
10
|
*/
|
|
11
11
|
const KEY = 'queries';
|
|
12
12
|
export function savedAnswers({ name, restoreMs = 1500, writeMs = 1000, }) {
|
|
13
|
-
// No IndexedDB (a test runner, a locked-down browser
|
|
14
|
-
|
|
13
|
+
// No IndexedDB (a test runner, a locked-down browser where even reading `indexedDB` throws):
|
|
14
|
+
// nothing is saved, every load asks the server.
|
|
15
|
+
const idb = (() => {
|
|
16
|
+
try {
|
|
17
|
+
return typeof indexedDB === 'undefined' ? undefined : indexedDB;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
if (!idb)
|
|
15
24
|
return {
|
|
16
25
|
persistClient: () => { },
|
|
17
26
|
restoreClient: async () => undefined,
|
|
@@ -21,7 +30,8 @@ export function savedAnswers({ name, restoreMs = 1500, writeMs = 1000, }) {
|
|
|
21
30
|
const open = () => {
|
|
22
31
|
if (!db)
|
|
23
32
|
db = new Promise((resolve, reject) => {
|
|
24
|
-
|
|
33
|
+
// `open` itself can throw (a private window that refuses storage): that rejects too.
|
|
34
|
+
const req = idb.open(name, 1);
|
|
25
35
|
req.onupgradeneeded = () => req.result.createObjectStore('cache');
|
|
26
36
|
req.onsuccess = () => resolve(req.result);
|
|
27
37
|
req.onerror = () => reject(req.error);
|
package/dist/settings.js
CHANGED
|
@@ -150,6 +150,14 @@ export function LumenSettings({ open, section, onOpen, onClose, appLabel, profil
|
|
|
150
150
|
.map((el) => el.dataset.settingsSection ?? '');
|
|
151
151
|
setFound((f) => (f.join() === ids.join() ? f : ids));
|
|
152
152
|
});
|
|
153
|
+
// A long nav scrolls; keep the open section's row in view (Settings can open at one far down).
|
|
154
|
+
const navList = useRef(null);
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (!open)
|
|
157
|
+
return;
|
|
158
|
+
const id = requestAnimationFrame(() => navList.current?.querySelector('[data-active=true]')?.scrollIntoView({ block: 'nearest' }));
|
|
159
|
+
return () => cancelAnimationFrame(id);
|
|
160
|
+
}, [open]);
|
|
153
161
|
const shown = (s) => !q || found.includes(s.id);
|
|
154
162
|
const go = (id) => {
|
|
155
163
|
setQuery('');
|
|
@@ -177,7 +185,7 @@ export function LumenSettings({ open, section, onOpen, onClose, appLabel, profil
|
|
|
177
185
|
e.preventDefault();
|
|
178
186
|
setQuery('');
|
|
179
187
|
}
|
|
180
|
-
}, className: "flex h-[min(720px,calc(100svh-2rem))] flex-col gap-0 overflow-hidden p-0 sm:max-w-4xl md:flex-row", children: [_jsx(DialogTitle, { className: "sr-only", children: "Settings" }), _jsx(DialogDescription, { className: "sr-only", children: "Your preferences and this desk's settings." }), _jsxs("nav", { "aria-label": "Settings sections", className: "hidden w-56 shrink-0 flex-col border-r bg-sidebar
|
|
188
|
+
}, className: "flex h-[min(720px,calc(100svh-2rem))] flex-col gap-0 overflow-hidden p-0 sm:max-w-4xl md:flex-row", children: [_jsx(DialogTitle, { className: "sr-only", children: "Settings" }), _jsx(DialogDescription, { className: "sr-only", children: "Your preferences and this desk's settings." }), _jsxs("nav", { "aria-label": "Settings sections", className: "hidden min-h-0 w-56 shrink-0 flex-col border-r bg-sidebar pt-2 md:flex", children: [_jsx("div", { className: "shrink-0 px-2 pt-1 pb-1", children: search }), _jsx("div", { ref: navList, "data-slot": "settings-nav-list", className: "flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain pb-2 *:shrink-0", children: navGroups.map((g) => (_jsxs(SidebarGroup, { className: "py-1", children: [_jsx(SidebarGroupLabel, { children: g.label }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: g.items.map((s) => (_jsx(SidebarMenuItem, { children: _jsxs(SidebarMenuButton, { isActive: !q && s.id === current.id, className: s.sub ? 'pl-7' : undefined, onClick: () => go(s.id), children: [_jsx(s.icon, {}), _jsx("span", { children: s.title })] }) }, s.id))) }) })] }, g.label))) })] }), _jsxs("div", { className: "flex flex-col gap-2 border-b p-3 pr-12 md:hidden", children: [search, !q && (_jsx(LumenSelector, { label: "Settings section", className: "w-full", groups: navGroups.map((g) => ({
|
|
181
189
|
label: g.label,
|
|
182
190
|
options: g.items.map((s) => ({
|
|
183
191
|
value: s.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.134",
|
|
4
4
|
"description": "Lumen: shared React components (frame, views, widgets, charts, drawers).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@codemirror/lang-javascript": "6.2.5",
|
|
50
50
|
"@codemirror/lang-json": "6.0.2",
|
|
51
51
|
"@codemirror/lang-sql": "6.10.0",
|
|
52
|
-
"@columenlabs/lumen-ui-types": "0.1.
|
|
52
|
+
"@columenlabs/lumen-ui-types": "0.1.134",
|
|
53
53
|
"@dnd-kit/core": "6.3.1",
|
|
54
54
|
"@dnd-kit/sortable": "10.0.0",
|
|
55
55
|
"@dnd-kit/utilities": "3.2.2",
|