@tradalab/lyra 3.17.0 → 3.19.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/README.md +2 -2
- package/dist/blocks/index.d.ts +324 -7
- package/dist/blocks/index.js +1185 -74
- package/dist/blocks/index.js.map +1 -1
- package/dist/chunk-W3J2KTYP.js +82 -0
- package/dist/chunk-W3J2KTYP.js.map +1 -0
- package/dist/hooks/index.d.ts +18 -3
- package/dist/hooks/index.js +1 -1
- package/dist/{plate-BJ19iaVV.d.ts → plate-iXwbupLU.d.ts} +1 -1
- package/dist/{plate-picker-dhKLjz_6.d.ts → plate-picker-DdC2HFo6.d.ts} +1 -1
- package/dist/shell/index.d.ts +2 -2
- package/dist/shell/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/{use-compact-BvI4sJf9.d.ts → use-compact-ahmJWpSH.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-AIULLZYM.js +0 -21
- package/dist/chunk-AIULLZYM.js.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { useStoredSetting, PLATE_KEY, isPlate, useRootAttribute, COMPACT_KEY } from './chunk-D7DMRCDY.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-plate.ts
|
|
6
|
+
function usePlate() {
|
|
7
|
+
const [stored, store] = useStoredSetting(PLATE_KEY);
|
|
8
|
+
const plate = stored !== null && isPlate(stored) ? stored : null;
|
|
9
|
+
useRootAttribute("data-plate", plate);
|
|
10
|
+
return [plate, store];
|
|
11
|
+
}
|
|
12
|
+
function useCompact() {
|
|
13
|
+
const [stored, store] = useStoredSetting(COMPACT_KEY);
|
|
14
|
+
const compact = stored === "true";
|
|
15
|
+
const setCompact = useCallback((next) => store(next ? "true" : null), [store]);
|
|
16
|
+
useRootAttribute("data-compact", compact ? "true" : null);
|
|
17
|
+
return [compact, setCompact];
|
|
18
|
+
}
|
|
19
|
+
var same = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
20
|
+
function useDirtyFields(initial, current) {
|
|
21
|
+
return React.useMemo(() => {
|
|
22
|
+
const dirty = Object.keys(current).filter((k) => !same(initial[k], current[k]));
|
|
23
|
+
const set = new Set(dirty);
|
|
24
|
+
return { dirty, isDirty: dirty.length > 0, is: (key) => set.has(key) };
|
|
25
|
+
}, [initial, current]);
|
|
26
|
+
}
|
|
27
|
+
var KEY = /* @__PURE__ */ Symbol.for("@tradalab/lyra/back-layers");
|
|
28
|
+
function state() {
|
|
29
|
+
const g = globalThis;
|
|
30
|
+
return g[KEY] ??= { stack: [], ours: 0, waiting: 0, listening: false, next: 0 };
|
|
31
|
+
}
|
|
32
|
+
function entry(id) {
|
|
33
|
+
window.history.pushState({ ...window.history.state, lyraLayer: id }, "");
|
|
34
|
+
}
|
|
35
|
+
function onPop() {
|
|
36
|
+
const s = state();
|
|
37
|
+
if (s.ours > 0) {
|
|
38
|
+
s.ours--;
|
|
39
|
+
for (; s.ours === 0 && s.waiting > 0; s.waiting--) {
|
|
40
|
+
const layer = s.stack[s.stack.length - s.waiting];
|
|
41
|
+
if (layer) entry(layer.id);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
s.stack.pop()?.close();
|
|
46
|
+
}
|
|
47
|
+
function pushBackLayer(close) {
|
|
48
|
+
const s = state();
|
|
49
|
+
if (!s.listening) {
|
|
50
|
+
s.listening = true;
|
|
51
|
+
window.addEventListener("popstate", onPop);
|
|
52
|
+
}
|
|
53
|
+
const layer = { close, id: `l${s.next++}` };
|
|
54
|
+
s.stack.push(layer);
|
|
55
|
+
if (s.ours > 0) s.waiting++;
|
|
56
|
+
else entry(layer.id);
|
|
57
|
+
return () => {
|
|
58
|
+
const i = s.stack.indexOf(layer);
|
|
59
|
+
if (i < 0) return;
|
|
60
|
+
s.stack.splice(i, 1);
|
|
61
|
+
if (i !== s.stack.length) return;
|
|
62
|
+
if (s.waiting > 0) {
|
|
63
|
+
s.waiting--;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (window.history.state?.lyraLayer !== layer.id) return;
|
|
67
|
+
s.ours++;
|
|
68
|
+
window.history.back();
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function useBackClose(open, onClose) {
|
|
72
|
+
const latest = useRef(onClose);
|
|
73
|
+
latest.current = onClose;
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (!open) return;
|
|
76
|
+
return pushBackLayer(() => latest.current());
|
|
77
|
+
}, [open]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { pushBackLayer, useBackClose, useCompact, useDirtyFields, usePlate };
|
|
81
|
+
//# sourceMappingURL=chunk-W3J2KTYP.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-W3J2KTYP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-plate.ts","../src/hooks/use-compact.ts","../src/hooks/use-dirty-fields.ts","../src/hooks/use-back-close.ts"],"names":[],"mappings":";;;;;AAaO,SAAS,QAAA,GAA0D;AACxE,EAAA,MAAM,CAAC,MAAA,EAAQ,KAAK,CAAA,GAAI,iBAAiB,SAAS,CAAA;AAClD,EAAA,MAAM,QAAQ,MAAA,KAAW,IAAA,IAAQ,OAAA,CAAQ,MAAM,IAAI,MAAA,GAAS,IAAA;AAC5D,EAAA,gBAAA,CAAiB,cAAc,KAAK,CAAA;AACpC,EAAA,OAAO,CAAC,OAAO,KAAK,CAAA;AACtB;ACbO,SAAS,UAAA,GAAoD;AAClE,EAAA,MAAM,CAAC,MAAA,EAAQ,KAAK,CAAA,GAAI,iBAAiB,WAAW,CAAA;AACpD,EAAA,MAAM,UAAU,MAAA,KAAW,MAAA;AAC3B,EAAA,MAAM,UAAA,GAAa,WAAA,CAAY,CAAC,IAAA,KAAkB,KAAA,CAAM,IAAA,GAAO,MAAA,GA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CAAA,EAAG;AACX,IAAA,CAAA,CAAE,KAAA,CAAM,MAAA,CAAO,CAAA,EAAG,CAAC,CAAA;AACnB,IAAA,IAAI,CAAA,KAAM,CAAA,CAAE,KAAA,CAAM,MAAA,EAAQ;AAC1B,IAAA,IAAI,CAAA,CAAE,UAAU,CAAA,EAAG;AACjB,MAAA,CAAA,CAAE,OAAA,EAAA;AACF,MAAA;AAAA,IACF;AACA,IAAA,IAAK,MAAA,CAAO,OAAA,CAAQ,KAAA,EAAyC,SAAA,KAAc,MAAM,EAAA,EAAI;AACrF,IAAA,CAAA,CAAE,IAAA,EAAA;AACF,IAAA,MAAA,CAAO,QAAQ,IAAA,EAAK;AAAA,EACtB,CAAA;AACF;AAGO,SAAS,YAAA,CAAa,MAAe,OAAA,EAAqB;AAC/D,EAAA,MAAM,MAAA,GAAS,OAAO,OAAO,CAAA;AAC7B,EAAA,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,IAAA,EAAM;AACX,IAAA,OAAO,aAAA,CAAc,MAAM,MAAA,CAAO,OAAA,EAAS,CAAA;AAAA,EAC7C,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA;AACX","file":"chunk-W3J2KTYP.js","sourcesContent":["\"use client\"\n\nimport { PLATE_KEY, useRootAttribute, useStoredSetting } from \"./device-setting.js\"\nimport { isPlate, type Plate } from \"./plate.js\"\n\n/**\n * The plate this device is set to, and a way to change it.\n *\n * A stored name that is no longer a plate - a rename, a downgrade to an older lyra - reads as no\n * plate. The alternative is an attribute no rule matches, which looks identical to the neutral\n * default on screen while the picker shows nothing selected at all, so the reader cannot tell that\n * their choice was dropped or get back to a known state.\n */\nexport function usePlate(): [Plate | null, (plate: Plate | null) => void] {\n const [stored, store] = useStoredSetting(PLATE_KEY)\n const plate = stored !== null && isPlate(stored) ? stored : null\n useRootAttribute(\"data-plate\", plate)\n return [plate, store]\n}\n","\"use client\"\n\nimport { useCallback } from \"react\"\nimport { COMPACT_KEY, useRootAttribute, useStoredSetting } from \"./device-setting.js\"\n\nexport function useCompact(): [boolean, (compact: boolean) => void] {\n const [stored, store] = useStoredSetting(COMPACT_KEY)\n const compact = stored === \"true\"\n const setCompact = useCallback((next: boolean) => store(next ? \"true\" : null), [store])\n useRootAttribute(\"data-compact\", compact ? \"true\" : null)\n return [compact, setCompact]\n}\n","import * as React from \"react\"\n\nconst same = (a: unknown, b: unknown) => a === b || JSON.stringify(a) === JSON.stringify(b)\n\n/** Keys of `current` that differ from `initial`, compared by value; `isDirty` when any does. */\nexport function useDirtyFields<T extends Record<string, unknown>>(initial: T, current: T) {\n return React.useMemo(() => {\n const dirty = (Object.keys(current) as (keyof T)[]).filter((k) => !same(initial[k], current[k]))\n const set = new Set<keyof T>(dirty)\n return { dirty, isDirty: dirty.length > 0, is: (key: keyof T) => set.has(key) }\n }, [initial, current])\n}\n","\"use client\"\n\nimport { useEffect, useRef } from \"react\"\n\ntype Layer = { close: () => void; id: string }\n\ntype BackState = {\n stack: Layer[]\n ours: number\n waiting: number\n listening: boolean\n next: number\n}\n\nconst KEY = Symbol.for(\"@tradalab/lyra/back-layers\")\n\nfunction state(): BackState {\n const g = globalThis as { [KEY]?: BackState }\n return (g[KEY] ??= { stack: [], ours: 0, waiting: 0, listening: false, next: 0 })\n}\n\nfunction entry(id: string) {\n window.history.pushState({ ...window.history.state, lyraLayer: id }, \"\")\n}\n\nfunction onPop() {\n const s = state()\n if (s.ours > 0) {\n s.ours--\n for (; s.ours === 0 && s.waiting > 0; s.waiting--) {\n const layer = s.stack[s.stack.length - s.waiting]\n if (layer) entry(layer.id)\n }\n return\n }\n s.stack.pop()?.close()\n}\n\n/**\n * Holds one history entry while a layer is open, so Back (on Android, a WebView history step) calls `close`.\n * Returns a release for a layer that closed some other way; it drops the entry unless a navigation sits on top.\n */\nexport function pushBackLayer(close: () => void): () => void {\n const s = state()\n if (!s.listening) {\n s.listening = true\n window.addEventListener(\"popstate\", onPop)\n }\n const layer: Layer = { close, id: `l${s.next++}` }\n s.stack.push(layer)\n if (s.ours > 0) s.waiting++\n else entry(layer.id)\n return () => {\n const i = s.stack.indexOf(layer)\n if (i < 0) return\n s.stack.splice(i, 1)\n if (i !== s.stack.length) return\n if (s.waiting > 0) {\n s.waiting--\n return\n }\n if ((window.history.state as { lyraLayer?: string } | null)?.lyraLayer !== layer.id) return\n s.ours++\n window.history.back()\n }\n}\n\n/** Back calls `onClose` while `open` is true; the newest open layer closes first. */\nexport function useBackClose(open: boolean, onClose: () => void) {\n const latest = useRef(onClose)\n latest.current = onClose\n useEffect(() => {\n if (!open) return\n return pushBackLayer(() => latest.current())\n }, [open])\n}\n"]}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { B as BEARING_PLATES, a as BearingPlate,
|
|
2
|
-
export { u as useCompact, a as usePlate } from '../use-compact-
|
|
1
|
+
export { B as BEARING_PLATES, a as BearingPlate, b as PLATES, P as Plate, d as derivePlate, i as isPlate } from '../plate-iXwbupLU.js';
|
|
2
|
+
export { u as useCompact, a as usePlate } from '../use-compact-ahmJWpSH.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns `true` when viewport width is below the given mobile breakpoint.
|
|
@@ -9,4 +9,19 @@ export { u as useCompact, a as usePlate } from '../use-compact-BvI4sJf9.js';
|
|
|
9
9
|
*/
|
|
10
10
|
declare function useMobile(breakpointPx?: number): boolean;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** Keys of `current` that differ from `initial`, compared by value; `isDirty` when any does. */
|
|
13
|
+
declare function useDirtyFields<T extends Record<string, unknown>>(initial: T, current: T): {
|
|
14
|
+
dirty: (keyof T)[];
|
|
15
|
+
isDirty: boolean;
|
|
16
|
+
is: (key: keyof T) => boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Holds one history entry while a layer is open, so Back (on Android, a WebView history step) calls `close`.
|
|
21
|
+
* Returns a release for a layer that closed some other way; it drops the entry unless a navigation sits on top.
|
|
22
|
+
*/
|
|
23
|
+
declare function pushBackLayer(close: () => void): () => void;
|
|
24
|
+
/** Back calls `onClose` while `open` is true; the newest open layer closes first. */
|
|
25
|
+
declare function useBackClose(open: boolean, onClose: () => void): void;
|
|
26
|
+
|
|
27
|
+
export { pushBackLayer, useBackClose, useDirtyFields, useMobile };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { useCompact, usePlate } from '../chunk-
|
|
2
|
+
export { pushBackLayer, useBackClose, useCompact, useDirtyFields, usePlate } from '../chunk-W3J2KTYP.js';
|
|
3
3
|
export { BEARING_PLATES, PLATES, derivePlate, isPlate, useMobile } from '../chunk-D7DMRCDY.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -35,4 +35,4 @@ declare function isPlate(s: string): s is Plate;
|
|
|
35
35
|
*/
|
|
36
36
|
declare function derivePlate(id: string): BearingPlate;
|
|
37
37
|
|
|
38
|
-
export { BEARING_PLATES as B,
|
|
38
|
+
export { BEARING_PLATES as B, type Plate as P, type BearingPlate as a, PLATES as b, derivePlate as d, isPlate as i };
|
package/dist/shell/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentProps, ReactNode } from 'react';
|
|
3
3
|
import { S as SidebarProvider, a as SidebarInset, b as Sidebar, A as AccountMenuUser, c as AccountMenuLabels, B as Breadcrumb, T as Tabs } from '../account-menu-q2VMEk3b.js';
|
|
4
|
-
import { P as PlatePickerProps } from '../plate-picker-
|
|
4
|
+
import { P as PlatePickerProps } from '../plate-picker-DdC2HFo6.js';
|
|
5
5
|
import 'class-variance-authority/types';
|
|
6
6
|
import 'class-variance-authority';
|
|
7
7
|
import 'radix-ui';
|
|
8
|
-
import '../plate-
|
|
8
|
+
import '../plate-iXwbupLU.js';
|
|
9
9
|
|
|
10
10
|
interface AppShellProps extends Omit<ComponentProps<typeof SidebarProvider>, "children"> {
|
|
11
11
|
children: ReactNode;
|
package/dist/shell/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { usePlate, useCompact } from '../chunk-
|
|
2
|
+
import { usePlate, useCompact } from '../chunk-W3J2KTYP.js';
|
|
3
3
|
import { SidebarInset, SidebarProvider, useSidebar, Sidebar, SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarMenu, SidebarMenuItem, SidebarMenuButton, defaultAccountMenuLabels, initialsOf, PlatePicker, Switch, ScrollArea, ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ScrollBar, Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbPage, BreadcrumbLink, BreadcrumbSeparator, Card, CardTitle, CardDescription, Tabs } from '../chunk-UNRT3B6P.js';
|
|
4
4
|
import '../chunk-D7DMRCDY.js';
|
|
5
5
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuSeparator, DropdownMenuLabel, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuItem } from '../chunk-OH3OMK7A.js';
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -19,9 +19,9 @@ export { useMessageScroller, useMessageScrollerScrollable, useMessageScrollerVis
|
|
|
19
19
|
import { Questionnaire as Questionnaire$1 } from '@shadcn/react/questionnaire';
|
|
20
20
|
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
21
21
|
import { Toast as Toast$1 } from '@base-ui/react/toast';
|
|
22
|
-
export { a as PlatePicker, P as PlatePickerProps } from '../plate-picker-
|
|
22
|
+
export { a as PlatePicker, P as PlatePickerProps } from '../plate-picker-DdC2HFo6.js';
|
|
23
23
|
export { P as PreferenceScript } from '../preference-script-Dm-LEoYX.js';
|
|
24
|
-
import '../plate-
|
|
24
|
+
import '../plate-iXwbupLU.js';
|
|
25
25
|
|
|
26
26
|
declare function Accordion({ className, ...props }: React$1.ComponentProps<typeof Accordion$1.Root>): React$1.JSX.Element;
|
|
27
27
|
declare function AccordionItem({ className, ...props }: React$1.ComponentProps<typeof Accordion$1.Item>): React$1.JSX.Element;
|
package/package.json
CHANGED
package/dist/chunk-AIULLZYM.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useStoredSetting, PLATE_KEY, isPlate, useRootAttribute, COMPACT_KEY } from './chunk-D7DMRCDY.js';
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
|
|
4
|
-
// src/hooks/use-plate.ts
|
|
5
|
-
function usePlate() {
|
|
6
|
-
const [stored, store] = useStoredSetting(PLATE_KEY);
|
|
7
|
-
const plate = stored !== null && isPlate(stored) ? stored : null;
|
|
8
|
-
useRootAttribute("data-plate", plate);
|
|
9
|
-
return [plate, store];
|
|
10
|
-
}
|
|
11
|
-
function useCompact() {
|
|
12
|
-
const [stored, store] = useStoredSetting(COMPACT_KEY);
|
|
13
|
-
const compact = stored === "true";
|
|
14
|
-
const setCompact = useCallback((next) => store(next ? "true" : null), [store]);
|
|
15
|
-
useRootAttribute("data-compact", compact ? "true" : null);
|
|
16
|
-
return [compact, setCompact];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { useCompact, usePlate };
|
|
20
|
-
//# sourceMappingURL=chunk-AIULLZYM.js.map
|
|
21
|
-
//# sourceMappingURL=chunk-AIULLZYM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-plate.ts","../src/hooks/use-compact.ts"],"names":[],"mappings":";;;;AAaO,SAAS,QAAA,GAA0D;AACxE,EAAA,MAAM,CAAC,MAAA,EAAQ,KAAK,CAAA,GAAI,iBAAiB,SAAS,CAAA;AAClD,EAAA,MAAM,QAAQ,MAAA,KAAW,IAAA,IAAQ,OAAA,CAAQ,MAAM,IAAI,MAAA,GAAS,IAAA;AAC5D,EAAA,gBAAA,CAAiB,cAAc,KAAK,CAAA;AACpC,EAAA,OAAO,CAAC,OAAO,KAAK,CAAA;AACtB;ACbO,SAAS,UAAA,GAAoD;AAClE,EAAA,MAAM,CAAC,MAAA,EAAQ,KAAK,CAAA,GAAI,iBAAiB,WAAW,CAAA;AACpD,EAAA,MAAM,UAAU,MAAA,KAAW,MAAA;AAC3B,EAAA,MAAM,UAAA,GAAa,WAAA,CAAY,CAAC,IAAA,KAAkB,KAAA,CAAM,IAAA,GAAO,MAAA,GAAS,IAAI,CAAA,EAAG,CAAC,KAAK,CAAC,CAAA;AACtF,EAAA,gBAAA,CAAiB,cAAA,EAAgB,OAAA,GAAU,MAAA,GAAS,IAAI,CAAA;AACxD,EAAA,OAAO,CAAC,SAAS,UAAU,CAAA;AAC7B","file":"chunk-AIULLZYM.js","sourcesContent":["\"use client\"\n\nimport { PLATE_KEY, useRootAttribute, useStoredSetting } from \"./device-setting.js\"\nimport { isPlate, type Plate } from \"./plate.js\"\n\n/**\n * The plate this device is set to, and a way to change it.\n *\n * A stored name that is no longer a plate - a rename, a downgrade to an older lyra - reads as no\n * plate. The alternative is an attribute no rule matches, which looks identical to the neutral\n * default on screen while the picker shows nothing selected at all, so the reader cannot tell that\n * their choice was dropped or get back to a known state.\n */\nexport function usePlate(): [Plate | null, (plate: Plate | null) => void] {\n const [stored, store] = useStoredSetting(PLATE_KEY)\n const plate = stored !== null && isPlate(stored) ? stored : null\n useRootAttribute(\"data-plate\", plate)\n return [plate, store]\n}\n","\"use client\"\n\nimport { useCallback } from \"react\"\nimport { COMPACT_KEY, useRootAttribute, useStoredSetting } from \"./device-setting.js\"\n\nexport function useCompact(): [boolean, (compact: boolean) => void] {\n const [stored, store] = useStoredSetting(COMPACT_KEY)\n const compact = stored === \"true\"\n const setCompact = useCallback((next: boolean) => store(next ? \"true\" : null), [store])\n useRootAttribute(\"data-compact\", compact ? \"true\" : null)\n return [compact, setCompact]\n}\n"]}
|