@danxbot/ui 6.3.8 → 6.4.1
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/index.js +4922 -4880
- package/dist/index.js.map +1 -1
- package/dist/types/components/AppShell.d.ts +31 -1
- package/dist/types/components/Tabs.d.ts +46 -1
- package/dist/types/lib/persist.d.ts +17 -0
- package/package.json +1 -1
|
@@ -120,7 +120,37 @@ export interface AppShellProps {
|
|
|
120
120
|
* box itself.
|
|
121
121
|
*/
|
|
122
122
|
scrollResetKey?: string | number;
|
|
123
|
+
/**
|
|
124
|
+
* Remembers whether the sidebar is collapsed, under `danxbot-<persistId>`.
|
|
125
|
+
* `false` stops it being remembered at all.
|
|
126
|
+
*
|
|
127
|
+
* COLLAPSING IS THE ONE GESTURE ON THIS SHELL THAT ONLY MAKES SENSE KEPT.
|
|
128
|
+
* Its entire purpose is to give the content the sidebar's width back, and it
|
|
129
|
+
* was plain `useState` — so every refresh handed the width straight back to
|
|
130
|
+
* the navigation. Somebody who wants a narrow sidebar wants it on every load;
|
|
131
|
+
* re-collapsing it on each one is the app forgetting a decision that was
|
|
132
|
+
* never provisional.
|
|
133
|
+
*
|
|
134
|
+
* NOTE THE DIFFERENCE FROM `PanelGroup`'s `persistId`, which is undefined by
|
|
135
|
+
* default and persists nothing until a caller names it. That is right there
|
|
136
|
+
* and wrong here: a page can hold any number of panel groups, so none of them
|
|
137
|
+
* can claim a default key without colliding with the next one, whereas an
|
|
138
|
+
* application has exactly ONE shell and can safely name itself. Two shells on
|
|
139
|
+
* one origin — a shell previewed inside a shell — give the inner one its own
|
|
140
|
+
* id, which is what the test for that case pins.
|
|
141
|
+
*
|
|
142
|
+
* It is the ONLY thing this component stores, and it is the only KIND of
|
|
143
|
+
* thing it should: a per-viewer arrangement that can come back empty with no
|
|
144
|
+
* consequence. Every read and write goes through `lib/persist`, which
|
|
145
|
+
* swallows the throw `localStorage` raises in a private window or wherever
|
|
146
|
+
* storage is blocked by policy — the read happens in a `useState`
|
|
147
|
+
* initializer, where an unhandled throw unmounts the whole tree. A blocked
|
|
148
|
+
* browser gets an expanded sidebar and a working app, never a blank page.
|
|
149
|
+
*
|
|
150
|
+
* @default "app-shell-sidebar"
|
|
151
|
+
*/
|
|
152
|
+
persistId?: string | false;
|
|
123
153
|
children: ReactNode;
|
|
124
154
|
className?: string;
|
|
125
155
|
}
|
|
126
|
-
export declare function AppShell({ brand, sections, activeId, sidebarFooter, header, contentLandmark, navLabel, scroll, scrollResetKey, children, className, }: AppShellProps): import("react").JSX.Element;
|
|
156
|
+
export declare function AppShell({ brand, sections, activeId, sidebarFooter, header, contentLandmark, navLabel, scroll, scrollResetKey, persistId, children, className, }: AppShellProps): import("react").JSX.Element;
|
|
@@ -14,6 +14,12 @@ declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
14
14
|
indicator: string;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
+
fill: {
|
|
18
|
+
true: {
|
|
19
|
+
root: string;
|
|
20
|
+
panel: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
17
23
|
}, {
|
|
18
24
|
root: string;
|
|
19
25
|
list: string;
|
|
@@ -33,6 +39,12 @@ declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
33
39
|
indicator: string;
|
|
34
40
|
};
|
|
35
41
|
};
|
|
42
|
+
fill: {
|
|
43
|
+
true: {
|
|
44
|
+
root: string;
|
|
45
|
+
panel: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
36
48
|
}, {
|
|
37
49
|
root: string;
|
|
38
50
|
list: string;
|
|
@@ -52,6 +64,12 @@ declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
52
64
|
indicator: string;
|
|
53
65
|
};
|
|
54
66
|
};
|
|
67
|
+
fill: {
|
|
68
|
+
true: {
|
|
69
|
+
root: string;
|
|
70
|
+
panel: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
55
73
|
}, {
|
|
56
74
|
root: string;
|
|
57
75
|
list: string;
|
|
@@ -60,10 +78,37 @@ declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
60
78
|
panel: string;
|
|
61
79
|
}>>;
|
|
62
80
|
export interface TabsProps extends Omit<BaseTabs.Root.Props, "className">, VariantProps<typeof tabs> {
|
|
81
|
+
/**
|
|
82
|
+
* Fill the height this group was given, instead of sizing to the content of
|
|
83
|
+
* whichever panel is open.
|
|
84
|
+
*
|
|
85
|
+
* THIS IS THE SHAPE `AppShell` ASKS FOR AND A TABBED SCREEN COULD NOT GIVE.
|
|
86
|
+
* The shell bounds the viewport and hands its content column a real height;
|
|
87
|
+
* its own instruction to a screen that wants to use it is "write `flex-1
|
|
88
|
+
* min-h-0`, and never name a viewport unit". A tabbed screen was the one
|
|
89
|
+
* arrangement where that could not be honoured — the root here passes a
|
|
90
|
+
* height DOWN (it is already a flex column) but claims none of its own, and
|
|
91
|
+
* the panel below it is a plain block, so the two together are an
|
|
92
|
+
* auto-height gap in the middle of an otherwise sound chain. The only way
|
|
93
|
+
* through was for the content inside to name a fraction of the viewport,
|
|
94
|
+
* which is precisely the arithmetic the shell exists to have ended.
|
|
95
|
+
*
|
|
96
|
+
* OPT-IN, AND THAT IS THE DESIGN RATHER THAN CAUTION. A tab group inside a
|
|
97
|
+
* card is the ordinary case and must keep sizing to its content. It also
|
|
98
|
+
* cannot be a default safely: a consumer rendering SEVERAL panels at once
|
|
99
|
+
* (Base UI also keeps an OUTGOING panel mounted for the length of its exit
|
|
100
|
+
* transition, so even a one-panel group briefly has two) would have them
|
|
101
|
+
* split the same free space between them. Filling is a claim about the box
|
|
102
|
+
* this group was handed, so the caller who knows that box is the one who
|
|
103
|
+
* makes it.
|
|
104
|
+
*
|
|
105
|
+
* @default false
|
|
106
|
+
*/
|
|
107
|
+
fill?: boolean;
|
|
63
108
|
className?: string;
|
|
64
109
|
ref?: Ref<HTMLDivElement>;
|
|
65
110
|
}
|
|
66
|
-
export declare function Tabs({ variant, className, children, ref, ...props }: TabsProps): import("react").JSX.Element;
|
|
111
|
+
export declare function Tabs({ variant, fill, className, children, ref, ...props }: TabsProps): import("react").JSX.Element;
|
|
67
112
|
export interface TabListProps {
|
|
68
113
|
className?: string;
|
|
69
114
|
children: ReactNode;
|
|
@@ -11,6 +11,23 @@ export declare function storageKey(name: string): string;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function readStored<T>(name: string, isValid: (value: unknown) => value is T): T | undefined;
|
|
13
13
|
export declare function writeStored(name: string, value: unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* The same guarded read and write, for a value that is stored as a PLAIN
|
|
16
|
+
* STRING rather than as JSON — `preferences.ts`'s three, whose values are one
|
|
17
|
+
* of a few known words and are validated by membership rather than by a
|
|
18
|
+
* predicate. JSON-encoding them would put quotes in storage for no reason and
|
|
19
|
+
* break every entry a person already has.
|
|
20
|
+
*
|
|
21
|
+
* These exist because the guard did not reach that module and the failure was
|
|
22
|
+
* total: all three preferences read in a `useState` INITIALIZER, so the throw
|
|
23
|
+
* propagated out of render and React unmounted the tree — a blank page,
|
|
24
|
+
* because the app wanted to remember a colour scheme. The header above has
|
|
25
|
+
* claimed since it was written that "the namespace and the guarded read/write"
|
|
26
|
+
* were shared with `preferences.ts`; they were not, in either direction, and
|
|
27
|
+
* that sentence is only true now.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readStoredString(name: string): string | null;
|
|
30
|
+
export declare function writeStoredString(name: string, value: string): void;
|
|
14
31
|
export declare function clearStored(name: string): void;
|
|
15
32
|
/** Accepts anything — for callers whose stored shape needs no narrowing. */
|
|
16
33
|
export declare const anyValue: (value: unknown) => value is unknown;
|