@kushagradhawan/kookie-ui 0.1.50 → 0.1.52
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/components.css +582 -116
- package/dist/cjs/components/_internal/shell-bottom.d.ts +31 -5
- package/dist/cjs/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-handles.js +1 -1
- package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.d.ts +23 -5
- package/dist/cjs/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-sidebar.d.ts +24 -6
- package/dist/cjs/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/chatbar.d.ts +21 -2
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +3 -3
- package/dist/cjs/components/shell.context.d.ts +88 -1
- package/dist/cjs/components/shell.context.d.ts.map +1 -1
- package/dist/cjs/components/shell.context.js +1 -1
- package/dist/cjs/components/shell.context.js.map +3 -3
- package/dist/cjs/components/shell.d.ts +51 -13
- package/dist/cjs/components/shell.d.ts.map +1 -1
- package/dist/cjs/components/shell.hooks.d.ts +7 -1
- package/dist/cjs/components/shell.hooks.d.ts.map +1 -1
- package/dist/cjs/components/shell.hooks.js +1 -1
- package/dist/cjs/components/shell.hooks.js.map +3 -3
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/shell.types.d.ts +1 -0
- package/dist/cjs/components/shell.types.d.ts.map +1 -1
- package/dist/cjs/components/shell.types.js +1 -1
- package/dist/cjs/components/shell.types.js.map +2 -2
- package/dist/esm/components/_internal/shell-bottom.d.ts +31 -5
- package/dist/esm/components/_internal/shell-bottom.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js.map +3 -3
- package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-handles.js +1 -1
- package/dist/esm/components/_internal/shell-handles.js.map +3 -3
- package/dist/esm/components/_internal/shell-inspector.d.ts +23 -5
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js.map +3 -3
- package/dist/esm/components/_internal/shell-sidebar.d.ts +24 -6
- package/dist/esm/components/_internal/shell-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/esm/components/chatbar.d.ts +21 -2
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/chatbar.js.map +3 -3
- package/dist/esm/components/shell.context.d.ts +88 -1
- package/dist/esm/components/shell.context.d.ts.map +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.context.js.map +3 -3
- package/dist/esm/components/shell.d.ts +51 -13
- package/dist/esm/components/shell.d.ts.map +1 -1
- package/dist/esm/components/shell.hooks.d.ts +7 -1
- package/dist/esm/components/shell.hooks.d.ts.map +1 -1
- package/dist/esm/components/shell.hooks.js +1 -1
- package/dist/esm/components/shell.hooks.js.map +3 -3
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.js.map +3 -3
- package/dist/esm/components/shell.types.d.ts +1 -0
- package/dist/esm/components/shell.types.d.ts.map +1 -1
- package/dist/esm/components/shell.types.js.map +2 -2
- package/package.json +14 -3
- package/schemas/base-button.json +1 -1
- package/schemas/button.json +1 -1
- package/schemas/icon-button.json +1 -1
- package/schemas/index.json +6 -6
- package/schemas/toggle-button.json +1 -1
- package/schemas/toggle-icon-button.json +1 -1
- package/src/components/_internal/base-menu.css +16 -16
- package/src/components/_internal/base-sidebar-menu.css +23 -20
- package/src/components/_internal/base-sidebar.css +13 -0
- package/src/components/_internal/shell-bottom.tsx +176 -49
- package/src/components/_internal/shell-handles.tsx +29 -4
- package/src/components/_internal/shell-inspector.tsx +175 -43
- package/src/components/_internal/shell-sidebar.tsx +177 -93
- package/src/components/chatbar.css +240 -21
- package/src/components/chatbar.tsx +280 -291
- package/src/components/sheet.css +8 -16
- package/src/components/shell.context.tsx +79 -3
- package/src/components/shell.css +0 -1
- package/src/components/shell.hooks.ts +35 -0
- package/src/components/shell.tsx +574 -235
- package/src/components/shell.types.ts +2 -0
- package/src/components/sidebar.css +2 -2
- package/styles.css +582 -116
package/src/components/sheet.css
CHANGED
|
@@ -12,28 +12,22 @@
|
|
|
12
12
|
|
|
13
13
|
/* Logical side anchoring (RTL-aware via logical inset) */
|
|
14
14
|
:where(.rt-SheetContent[data-side='start']) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
left: 0 !important;
|
|
18
|
-
right: auto !important;
|
|
15
|
+
inset-block: 0 !important;
|
|
16
|
+
inset-inline-start: 0 !important;
|
|
19
17
|
margin: 0 !important;
|
|
20
18
|
border-start-start-radius: 0;
|
|
21
19
|
border-end-start-radius: 0;
|
|
22
20
|
}
|
|
23
21
|
:where(.rt-SheetContent[data-side='end']) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
right: 0 !important;
|
|
27
|
-
left: auto !important;
|
|
22
|
+
inset-block: 0 !important;
|
|
23
|
+
inset-inline-end: 0 !important;
|
|
28
24
|
margin: 0 !important;
|
|
29
25
|
border-start-end-radius: 0;
|
|
30
26
|
border-end-end-radius: 0;
|
|
31
27
|
}
|
|
32
28
|
:where(.rt-SheetContent[data-side='top']) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
right: 0 !important;
|
|
36
|
-
bottom: auto !important;
|
|
29
|
+
inset-block-start: 0 !important;
|
|
30
|
+
inset-inline: 0 !important;
|
|
37
31
|
width: auto;
|
|
38
32
|
max-width: none;
|
|
39
33
|
height: var(--height, 75vh);
|
|
@@ -42,10 +36,8 @@
|
|
|
42
36
|
border-start-end-radius: 0;
|
|
43
37
|
}
|
|
44
38
|
:where(.rt-SheetContent[data-side='bottom']) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
right: 0 !important;
|
|
48
|
-
top: auto !important;
|
|
39
|
+
inset-block-end: 0 !important;
|
|
40
|
+
inset-inline: 0 !important;
|
|
49
41
|
width: auto;
|
|
50
42
|
max-width: none;
|
|
51
43
|
height: var(--height, 75vh);
|
|
@@ -20,9 +20,6 @@ export interface ShellContextValue {
|
|
|
20
20
|
peekPane: (target: PaneTarget) => void;
|
|
21
21
|
clearPeek: () => void;
|
|
22
22
|
|
|
23
|
-
// Sidebar presentation sequencing phase (library-managed)
|
|
24
|
-
sidebarPhase?: 'idle' | 'hiding' | 'resizing' | 'showing';
|
|
25
|
-
|
|
26
23
|
// Composition detection
|
|
27
24
|
hasLeft: boolean;
|
|
28
25
|
setHasLeft: (has: boolean) => void;
|
|
@@ -57,3 +54,82 @@ export function useShell() {
|
|
|
57
54
|
export function ShellProvider({ value, children }: { value: ShellContextValue; children: React.ReactNode }) {
|
|
58
55
|
return <ShellContext.Provider value={value}>{children}</ShellContext.Provider>;
|
|
59
56
|
}
|
|
57
|
+
|
|
58
|
+
// Phase 7: Split contexts for render isolation
|
|
59
|
+
|
|
60
|
+
// Pane mode slice contexts
|
|
61
|
+
type ModeSetter<T> = (mode: T) => void;
|
|
62
|
+
|
|
63
|
+
export const LeftModeContext = React.createContext<{ leftMode: PaneMode; setLeftMode: ModeSetter<PaneMode> } | null>(null as any);
|
|
64
|
+
export function useLeftMode() {
|
|
65
|
+
const ctx = React.useContext(LeftModeContext);
|
|
66
|
+
if (!ctx) throw new Error('useLeftMode must be used within Shell.Root');
|
|
67
|
+
return ctx;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const PanelModeContext = React.createContext<{ panelMode: PaneMode; setPanelMode: ModeSetter<PaneMode> } | null>(null as any);
|
|
71
|
+
export function usePanelMode() {
|
|
72
|
+
const ctx = React.useContext(PanelModeContext);
|
|
73
|
+
if (!ctx) throw new Error('usePanelMode must be used within Shell.Root');
|
|
74
|
+
return ctx;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const SidebarModeContext = React.createContext<{ sidebarMode: SidebarMode; setSidebarMode: ModeSetter<SidebarMode> } | null>(null as any);
|
|
78
|
+
export function useSidebarMode() {
|
|
79
|
+
const ctx = React.useContext(SidebarModeContext);
|
|
80
|
+
if (!ctx) throw new Error('useSidebarMode must be used within Shell.Root');
|
|
81
|
+
return ctx;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const InspectorModeContext = React.createContext<{ inspectorMode: PaneMode; setInspectorMode: ModeSetter<PaneMode> } | null>(null as any);
|
|
85
|
+
export function useInspectorMode() {
|
|
86
|
+
const ctx = React.useContext(InspectorModeContext);
|
|
87
|
+
if (!ctx) throw new Error('useInspectorMode must be used within Shell.Root');
|
|
88
|
+
return ctx;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const BottomModeContext = React.createContext<{ bottomMode: PaneMode; setBottomMode: ModeSetter<PaneMode> } | null>(null as any);
|
|
92
|
+
export function useBottomMode() {
|
|
93
|
+
const ctx = React.useContext(BottomModeContext);
|
|
94
|
+
if (!ctx) throw new Error('useBottomMode must be used within Shell.Root');
|
|
95
|
+
return ctx;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Presentation slice
|
|
99
|
+
export const PresentationContext = React.createContext<{ currentBreakpoint: Breakpoint; currentBreakpointReady: boolean; leftResolvedPresentation?: PresentationValue } | null>(null as any);
|
|
100
|
+
export function usePresentation() {
|
|
101
|
+
const ctx = React.useContext(PresentationContext);
|
|
102
|
+
if (!ctx) throw new Error('usePresentation must be used within Shell.Root');
|
|
103
|
+
return ctx;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Peek slice
|
|
107
|
+
export const PeekContext = React.createContext<{ peekTarget: PaneTarget | null; setPeekTarget: (t: PaneTarget | null) => void; peekPane: (t: PaneTarget) => void; clearPeek: () => void } | null>(
|
|
108
|
+
null as any,
|
|
109
|
+
);
|
|
110
|
+
export function usePeek() {
|
|
111
|
+
const ctx = React.useContext(PeekContext);
|
|
112
|
+
if (!ctx) throw new Error('usePeek must be used within Shell.Root');
|
|
113
|
+
return ctx;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Actions slice (stable callbacks)
|
|
117
|
+
export const ActionsContext = React.createContext<{
|
|
118
|
+
togglePane: (t: PaneTarget) => void;
|
|
119
|
+
expandPane: (t: PaneTarget) => void;
|
|
120
|
+
collapsePane: (t: PaneTarget) => void;
|
|
121
|
+
setSidebarToggleComputer?: (fn: (current: SidebarMode) => SidebarMode) => void;
|
|
122
|
+
} | null>(null as any);
|
|
123
|
+
export function useShellActions() {
|
|
124
|
+
const ctx = React.useContext(ActionsContext);
|
|
125
|
+
if (!ctx) throw new Error('useShellActions must be used within Shell.Root');
|
|
126
|
+
return ctx;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Composition slice
|
|
130
|
+
export const CompositionContext = React.createContext<{ hasLeft: boolean; setHasLeft: (v: boolean) => void; hasSidebar: boolean; setHasSidebar: (v: boolean) => void } | null>(null as any);
|
|
131
|
+
export function useComposition() {
|
|
132
|
+
const ctx = React.useContext(CompositionContext);
|
|
133
|
+
if (!ctx) throw new Error('useComposition must be used within Shell.Root');
|
|
134
|
+
return ctx;
|
|
135
|
+
}
|
package/src/components/shell.css
CHANGED
|
@@ -29,3 +29,38 @@ export function useResponsivePresentation(presentation: ResponsivePresentation):
|
|
|
29
29
|
return 'fixed';
|
|
30
30
|
}, [presentation, currentBreakpoint]);
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a responsive value (T or responsive map keyed by breakpoints) against the current Shell breakpoint.
|
|
35
|
+
* If no value is defined for the current breakpoint, search smaller breakpoints down to 'initial'.
|
|
36
|
+
* Returns undefined when passed a responsive map with no matching key across the chain.
|
|
37
|
+
*/
|
|
38
|
+
export function useResponsiveValue<T>(value: T | Partial<Record<Breakpoint, T>> | undefined): T | undefined {
|
|
39
|
+
const { currentBreakpoint } = useShell();
|
|
40
|
+
|
|
41
|
+
return React.useMemo(() => {
|
|
42
|
+
if (value == null) return undefined;
|
|
43
|
+
// Primitive value
|
|
44
|
+
if (typeof value !== 'object') {
|
|
45
|
+
return value as T;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const map = value as Partial<Record<Breakpoint, T>>;
|
|
49
|
+
if (map[currentBreakpoint as Breakpoint] !== undefined) {
|
|
50
|
+
return map[currentBreakpoint as Breakpoint] as T;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const bpKeys = Object.keys(BREAKPOINTS) as Array<keyof typeof BREAKPOINTS>;
|
|
54
|
+
const order: Breakpoint[] = ([...bpKeys].reverse() as Breakpoint[]).concat('initial' as Breakpoint);
|
|
55
|
+
const startIdx = order.indexOf(currentBreakpoint as Breakpoint);
|
|
56
|
+
|
|
57
|
+
for (let i = startIdx + 1; i < order.length; i++) {
|
|
58
|
+
const bp = order[i];
|
|
59
|
+
if (map[bp] !== undefined) {
|
|
60
|
+
return map[bp] as T;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return undefined;
|
|
65
|
+
}, [value, currentBreakpoint]);
|
|
66
|
+
}
|