@exegia/corpora-ui 0.20.0 → 0.21.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-lib/components/blocks/auth/__tests__/auth-state-atom.test.d.ts +1 -0
- package/dist-lib/components/blocks/auth/auth-flow-atom.d.ts +77 -0
- package/dist-lib/components/blocks/auth/auth-session-atom.d.ts +28 -0
- package/dist-lib/components/blocks/auth/auth-state-type.d.ts +71 -0
- package/dist-lib/components/blocks/auth/auth-state.d.ts +9 -0
- package/dist-lib/components/blocks/auth/use-auth-state.d.ts +52 -0
- package/dist-lib/components/blocks/nav/sidebar/__tests__/ai-sidebar-atom.test.d.ts +1 -0
- package/dist-lib/components/blocks/nav/sidebar/ai-sidebar-atom.d.ts +217 -0
- package/dist-lib/components/blocks/nav/sidebar/index.d.ts +3 -1
- package/dist-lib/components/blocks/nav/sidebar/sidebar-context.d.ts +3 -0
- package/dist-lib/components/blocks/nav/sidebar/sidebar-row.d.ts +3 -1
- package/dist-lib/components/blocks/nav/sidebar/type.d.ts +109 -29
- package/dist-lib/components/blocks/nav/sidebar/use-ai-sidebar-state.d.ts +29 -0
- package/dist-lib/components/blocks/nav/sidebar/use-ai-sidebar.d.ts +6 -1
- package/dist-lib/components/blocks/nav/sidebar/utils.d.ts +1 -1
- package/dist-lib/components/blocks/profile/index.d.ts +7 -0
- package/dist-lib/components/blocks/profile/profile-card-atom.d.ts +68 -0
- package/dist-lib/components/blocks/profile/profile-card-block.d.ts +28 -39
- package/dist-lib/components/blocks/profile/type.d.ts +80 -0
- package/dist-lib/components/blocks/profile/use-profile-card-state.d.ts +24 -0
- package/dist-lib/components/blocks/profile/use-profile-card.d.ts +34 -0
- package/dist-lib/components/blocks/shell/__tests__/shell-fit-atom.test.d.ts +1 -0
- package/dist-lib/components/blocks/shell/__tests__/shell-metrics.test.d.ts +1 -0
- package/dist-lib/components/blocks/shell/animated-panel-provider.d.ts +1 -1
- package/dist-lib/components/blocks/shell/animated-panel.d.ts +1 -1
- package/dist-lib/components/blocks/shell/index.d.ts +4 -0
- package/dist-lib/components/blocks/shell/shell-fit-atom.d.ts +68 -0
- package/dist-lib/components/blocks/shell/shell-metrics.d.ts +54 -0
- package/dist-lib/components/blocks/shell/type.d.ts +115 -3
- package/dist-lib/components/blocks/shell/use-shell-fit-state.d.ts +25 -0
- package/dist-lib/components/blocks/shell/use-shell-fit.d.ts +14 -0
- package/dist-lib/components/blocks/shell/use-shell-panels.d.ts +12 -1
- package/dist-lib/components/blocks/shell/utils.d.ts +32 -0
- package/dist-lib/components/composed/tree/__tests__/tree-atom.test.d.ts +1 -0
- package/dist-lib/components/composed/tree/constants.d.ts +4 -4
- package/dist-lib/components/composed/tree/index.d.ts +3 -1
- package/dist-lib/components/composed/tree/tree-atom.d.ts +160 -0
- package/dist-lib/components/composed/tree/tree-node.d.ts +6 -1
- package/dist-lib/components/composed/tree/type.d.ts +116 -18
- package/dist-lib/components/composed/tree/use-tree-dnd.d.ts +18 -7
- package/dist-lib/components/composed/tree/use-tree-state.d.ts +25 -0
- package/dist-lib/components/composed/tree/use-tree.d.ts +4 -0
- package/dist-lib/components/composed/user-avatar.d.ts +5 -28
- package/dist-lib/components/user-avatar/__tests__/user-avatar.test.d.ts +1 -0
- package/dist-lib/components/user-avatar/component.d.ts +1 -8
- package/dist-lib/components/user-avatar/index.d.ts +5 -0
- package/dist-lib/components/user-avatar/presence-badge.d.ts +16 -0
- package/dist-lib/components/user-avatar/type.d.ts +45 -0
- package/dist-lib/components/user-avatar/use-user-avatar-state.d.ts +26 -0
- package/dist-lib/components/user-avatar/use-user-avatar.d.ts +32 -0
- package/dist-lib/components/user-avatar/user-avatar-atom.d.ts +55 -0
- package/dist-lib/index.d.ts +5 -2
- package/dist-lib/index.js +3004 -1796
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/state/exegia-provider.d.ts +51 -0
- package/dist-lib/state/index.d.ts +4 -0
- package/dist-lib/state/store.d.ts +17 -0
- package/package.json +15 -12
- package/src/components/blocks/auth/__tests__/auth-state-atom.test.tsx +247 -0
- package/src/components/blocks/auth/auth-flow-atom.ts +238 -0
- package/src/components/blocks/auth/auth-session-atom.ts +82 -0
- package/src/components/blocks/auth/auth-state-type.ts +97 -0
- package/src/components/blocks/auth/auth-state.ts +52 -0
- package/src/components/blocks/auth/use-auth-state.ts +127 -0
- package/src/components/blocks/nav/sidebar/__tests__/ai-sidebar-atom.test.tsx +325 -0
- package/src/components/blocks/nav/sidebar/ai-sidebar-atom.ts +698 -0
- package/src/components/blocks/nav/sidebar/ai-sidebar.tsx +48 -42
- package/src/components/blocks/nav/sidebar/index.ts +53 -1
- package/src/components/blocks/nav/sidebar/sidebar-context.ts +15 -0
- package/src/components/blocks/nav/sidebar/sidebar-row.tsx +119 -50
- package/src/components/blocks/nav/sidebar/type.ts +125 -30
- package/src/components/blocks/nav/sidebar/use-ai-sidebar-state.ts +123 -0
- package/src/components/blocks/nav/sidebar/use-ai-sidebar.ts +301 -248
- package/src/components/blocks/nav/sidebar/utils.ts +1 -1
- package/src/components/blocks/profile/__tests__/profile-card-block.test.tsx +194 -0
- package/src/components/blocks/profile/index.ts +28 -0
- package/src/components/blocks/profile/profile-card-atom.ts +247 -0
- package/src/components/blocks/profile/profile-card-block.tsx +153 -74
- package/src/components/blocks/profile/type.ts +95 -0
- package/src/components/blocks/profile/use-profile-card-state.ts +67 -0
- package/src/components/blocks/profile/use-profile-card.ts +126 -0
- package/src/components/blocks/shell/__tests__/shell-fit-atom.test.tsx +360 -0
- package/src/components/blocks/shell/__tests__/shell-layout.test.tsx +192 -3
- package/src/components/blocks/shell/__tests__/shell-metrics.test.ts +108 -0
- package/src/components/blocks/shell/animated-panel-inset.tsx +5 -1
- package/src/components/blocks/shell/animated-panel-provider.tsx +77 -11
- package/src/components/blocks/shell/animated-panel-trigger.tsx +4 -0
- package/src/components/blocks/shell/animated-panel.tsx +126 -29
- package/src/components/blocks/shell/index.ts +18 -0
- package/src/components/blocks/shell/shell-fit-atom.ts +243 -0
- package/src/components/blocks/shell/shell-layout.tsx +55 -53
- package/src/components/blocks/shell/shell-metrics.ts +79 -0
- package/src/components/blocks/shell/type.ts +130 -3
- package/src/components/blocks/shell/use-shell-fit-state.ts +49 -0
- package/src/components/blocks/shell/use-shell-fit.ts +135 -0
- package/src/components/blocks/shell/use-shell-panels.ts +57 -4
- package/src/components/blocks/shell/utils.ts +44 -4
- package/src/components/composed/tree/CLAUDE.md +132 -0
- package/src/components/composed/tree/__tests__/tree-atom.test.tsx +217 -0
- package/src/components/composed/tree/__tests__/tree.test.tsx +162 -37
- package/src/components/composed/tree/__tests__/use-tree.test.tsx +2 -1
- package/src/components/composed/tree/constants.ts +4 -4
- package/src/components/composed/tree/index.ts +38 -0
- package/src/components/composed/tree/tree-atom.ts +590 -0
- package/src/components/composed/tree/tree-node.tsx +117 -78
- package/src/components/composed/tree/tree.tsx +24 -16
- package/src/components/composed/tree/type.ts +125 -15
- package/src/components/composed/tree/use-tree-dnd.ts +82 -51
- package/src/components/composed/tree/use-tree-state.ts +105 -0
- package/src/components/composed/tree/use-tree.ts +185 -184
- package/src/components/composed/user-avatar.tsx +11 -99
- package/src/components/user-avatar/__tests__/user-avatar.test.tsx +245 -0
- package/src/components/user-avatar/component.tsx +121 -22
- package/src/components/user-avatar/index.ts +19 -0
- package/src/components/user-avatar/presence-badge.tsx +56 -0
- package/src/components/user-avatar/type.ts +50 -0
- package/src/components/user-avatar/use-user-avatar-state.ts +60 -0
- package/src/components/user-avatar/use-user-avatar.ts +144 -0
- package/src/components/user-avatar/user-avatar-atom.ts +198 -0
- package/src/index.ts +34 -2
- package/src/state/exegia-provider.tsx +79 -0
- package/src/state/index.ts +4 -0
- package/src/state/store.ts +19 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useAtomValue, useSetAtom } from "jotai";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
aiSidebarStateAtom,
|
|
8
|
+
cancelAISidebarRenameAtom,
|
|
9
|
+
closeAISidebarMenuAtom,
|
|
10
|
+
collapseAISidebarRowAtom,
|
|
11
|
+
collapseAllAISidebarRowsAtom,
|
|
12
|
+
expandAISidebarRowAtom,
|
|
13
|
+
expandAllAISidebarRowsAtom,
|
|
14
|
+
focusAISidebarRowAtom,
|
|
15
|
+
moveAISidebarRowAtom,
|
|
16
|
+
openAISidebarMenuAtom,
|
|
17
|
+
renameAISidebarRowAtom,
|
|
18
|
+
resetAISidebarAtom,
|
|
19
|
+
revealAISidebarRowAtom,
|
|
20
|
+
selectAISidebarRowAtom,
|
|
21
|
+
setAISidebarItemsAtom,
|
|
22
|
+
startAISidebarRenameAtom,
|
|
23
|
+
toggleAISidebarRowAtom,
|
|
24
|
+
} from "./ai-sidebar-atom.ts";
|
|
25
|
+
import type {
|
|
26
|
+
AISidebarActions,
|
|
27
|
+
AISidebarInstanceId,
|
|
28
|
+
AISidebarState,
|
|
29
|
+
} from "./type.ts";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Read the sidebar registered under `sidebarId` from anywhere below
|
|
33
|
+
* `ExegiaProvider` — no controller, no props, no provider of its own.
|
|
34
|
+
*
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const { selectedId, movePending } = useAISidebarState("app-resources")
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* This returns the whole state object, so the caller re-renders on any
|
|
40
|
+
* change. A component that reads one field should subscribe to that field's
|
|
41
|
+
* atom instead: `useAtomValue(aiSidebarActiveIdAtom("app-resources"))`.
|
|
42
|
+
*/
|
|
43
|
+
export function useAISidebarState(
|
|
44
|
+
sidebarId: AISidebarInstanceId
|
|
45
|
+
): AISidebarState {
|
|
46
|
+
return useAtomValue(aiSidebarStateAtom(sidebarId));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Drive the sidebar registered under `sidebarId` from anywhere. Writes only —
|
|
51
|
+
* the caller never re-renders when the sidebar changes, so this is what a
|
|
52
|
+
* command palette, a keyboard shortcut or a route guard should reach for.
|
|
53
|
+
*
|
|
54
|
+
* `focus` and `closeMenu` move the store's roving target; DOM focus follows
|
|
55
|
+
* only for callers that hold the controller, because the row refs live in
|
|
56
|
+
* the block rather than the store.
|
|
57
|
+
*
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const resources = useAISidebarActions("app-resources")
|
|
60
|
+
* <Button onClick={resources.collapseAll}>Collapse all</Button>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function useAISidebarActions(
|
|
64
|
+
sidebarId: AISidebarInstanceId
|
|
65
|
+
): AISidebarActions {
|
|
66
|
+
const select = useSetAtom(selectAISidebarRowAtom(sidebarId));
|
|
67
|
+
const expand = useSetAtom(expandAISidebarRowAtom(sidebarId));
|
|
68
|
+
const collapse = useSetAtom(collapseAISidebarRowAtom(sidebarId));
|
|
69
|
+
const toggleExpanded = useSetAtom(toggleAISidebarRowAtom(sidebarId));
|
|
70
|
+
const expandAll = useSetAtom(expandAllAISidebarRowsAtom(sidebarId));
|
|
71
|
+
const collapseAll = useSetAtom(collapseAllAISidebarRowsAtom(sidebarId));
|
|
72
|
+
const reveal = useSetAtom(revealAISidebarRowAtom(sidebarId));
|
|
73
|
+
const focus = useSetAtom(focusAISidebarRowAtom(sidebarId));
|
|
74
|
+
const startRename = useSetAtom(startAISidebarRenameAtom(sidebarId));
|
|
75
|
+
const cancelRename = useSetAtom(cancelAISidebarRenameAtom(sidebarId));
|
|
76
|
+
const rename = useSetAtom(renameAISidebarRowAtom(sidebarId));
|
|
77
|
+
const openMenu = useSetAtom(openAISidebarMenuAtom(sidebarId));
|
|
78
|
+
const closeMenuInStore = useSetAtom(closeAISidebarMenuAtom(sidebarId));
|
|
79
|
+
const move = useSetAtom(moveAISidebarRowAtom(sidebarId));
|
|
80
|
+
const setItems = useSetAtom(setAISidebarItemsAtom(sidebarId));
|
|
81
|
+
const reset = useSetAtom(resetAISidebarAtom(sidebarId));
|
|
82
|
+
|
|
83
|
+
return useMemo(
|
|
84
|
+
() => ({
|
|
85
|
+
select,
|
|
86
|
+
expand,
|
|
87
|
+
collapse,
|
|
88
|
+
toggleExpanded,
|
|
89
|
+
expandAll,
|
|
90
|
+
collapseAll,
|
|
91
|
+
reveal,
|
|
92
|
+
focus,
|
|
93
|
+
startRename,
|
|
94
|
+
cancelRename,
|
|
95
|
+
rename,
|
|
96
|
+
openMenu,
|
|
97
|
+
// The atom returns the id it closed so the block can move DOM focus;
|
|
98
|
+
// remote callers have no refs, so the return value is dropped here.
|
|
99
|
+
closeMenu: () => void closeMenuInStore(),
|
|
100
|
+
move,
|
|
101
|
+
setItems,
|
|
102
|
+
reset,
|
|
103
|
+
}),
|
|
104
|
+
[
|
|
105
|
+
select,
|
|
106
|
+
expand,
|
|
107
|
+
collapse,
|
|
108
|
+
toggleExpanded,
|
|
109
|
+
expandAll,
|
|
110
|
+
collapseAll,
|
|
111
|
+
reveal,
|
|
112
|
+
focus,
|
|
113
|
+
startRename,
|
|
114
|
+
cancelRename,
|
|
115
|
+
rename,
|
|
116
|
+
openMenu,
|
|
117
|
+
closeMenuInStore,
|
|
118
|
+
move,
|
|
119
|
+
setItems,
|
|
120
|
+
reset,
|
|
121
|
+
]
|
|
122
|
+
);
|
|
123
|
+
}
|