@exegia/corpora-ui 0.20.0 → 0.22.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.
Files changed (165) hide show
  1. package/dist-lib/components/blocks/auth/auth-flow-atom.d.ts +77 -0
  2. package/dist-lib/components/blocks/auth/auth-session-atom.d.ts +28 -0
  3. package/dist-lib/components/blocks/auth/auth-state-type.d.ts +71 -0
  4. package/dist-lib/components/blocks/auth/auth-state.d.ts +9 -0
  5. package/dist-lib/components/blocks/auth/use-auth-state.d.ts +52 -0
  6. package/dist-lib/components/blocks/layout.d.ts +4 -1
  7. package/dist-lib/components/blocks/nav/sidebar/__tests__/ai-sidebar-atom.test.d.ts +1 -0
  8. package/dist-lib/components/blocks/nav/sidebar/ai-sidebar-atom.d.ts +217 -0
  9. package/dist-lib/components/blocks/nav/sidebar/index.d.ts +3 -1
  10. package/dist-lib/components/blocks/nav/sidebar/sidebar-context.d.ts +3 -0
  11. package/dist-lib/components/blocks/nav/sidebar/sidebar-row.d.ts +3 -1
  12. package/dist-lib/components/blocks/nav/sidebar/type.d.ts +109 -29
  13. package/dist-lib/components/blocks/nav/sidebar/use-ai-sidebar-state.d.ts +29 -0
  14. package/dist-lib/components/blocks/nav/sidebar/use-ai-sidebar.d.ts +6 -1
  15. package/dist-lib/components/blocks/nav/sidebar/utils.d.ts +1 -1
  16. package/dist-lib/components/blocks/profile/index.d.ts +7 -0
  17. package/dist-lib/components/blocks/profile/profile-card-atom.d.ts +68 -0
  18. package/dist-lib/components/blocks/profile/profile-card-block.d.ts +28 -39
  19. package/dist-lib/components/blocks/profile/type.d.ts +80 -0
  20. package/dist-lib/components/blocks/profile/use-profile-card-state.d.ts +24 -0
  21. package/dist-lib/components/blocks/profile/use-profile-card.d.ts +34 -0
  22. package/dist-lib/components/blocks/shell/__tests__/shell-fit-atom.test.d.ts +1 -0
  23. package/dist-lib/components/blocks/shell/__tests__/shell-metrics.test.d.ts +1 -0
  24. package/dist-lib/components/blocks/shell/animated-panel-provider.d.ts +1 -1
  25. package/dist-lib/components/blocks/shell/animated-panel.d.ts +1 -1
  26. package/dist-lib/components/blocks/shell/index.d.ts +4 -12
  27. package/dist-lib/components/blocks/shell/shell-fit-atom.d.ts +68 -0
  28. package/dist-lib/components/blocks/shell/shell-metrics.d.ts +54 -0
  29. package/dist-lib/components/blocks/shell/type.d.ts +115 -3
  30. package/dist-lib/components/blocks/shell/use-shell-fit-state.d.ts +25 -0
  31. package/dist-lib/components/blocks/shell/use-shell-fit.d.ts +14 -0
  32. package/dist-lib/components/blocks/shell/use-shell-panels.d.ts +12 -1
  33. package/dist-lib/components/blocks/shell/utils.d.ts +32 -0
  34. package/dist-lib/components/composed/__tests__/logo.test.d.ts +1 -0
  35. package/dist-lib/components/composed/logo.d.ts +34 -0
  36. package/dist-lib/components/composed/tree/__tests__/tree-atom.test.d.ts +1 -0
  37. package/dist-lib/components/composed/tree/constants.d.ts +4 -4
  38. package/dist-lib/components/composed/tree/index.d.ts +3 -1
  39. package/dist-lib/components/composed/tree/tree-atom.d.ts +160 -0
  40. package/dist-lib/components/composed/tree/tree-node.d.ts +6 -1
  41. package/dist-lib/components/composed/tree/type.d.ts +116 -18
  42. package/dist-lib/components/composed/tree/use-tree-dnd.d.ts +18 -7
  43. package/dist-lib/components/composed/tree/use-tree-state.d.ts +25 -0
  44. package/dist-lib/components/composed/tree/use-tree.d.ts +4 -0
  45. package/dist-lib/components/composed/user-avatar.d.ts +5 -28
  46. package/dist-lib/components/user-avatar/__tests__/user-avatar.test.d.ts +1 -0
  47. package/dist-lib/components/user-avatar/component.d.ts +1 -8
  48. package/dist-lib/components/user-avatar/index.d.ts +5 -0
  49. package/dist-lib/components/user-avatar/presence-badge.d.ts +16 -0
  50. package/dist-lib/components/user-avatar/type.d.ts +53 -0
  51. package/dist-lib/components/user-avatar/use-user-avatar-state.d.ts +26 -0
  52. package/dist-lib/components/user-avatar/use-user-avatar.d.ts +37 -0
  53. package/dist-lib/components/user-avatar/user-avatar-atom.d.ts +64 -0
  54. package/dist-lib/components/user-avatar/utils.d.ts +22 -0
  55. package/dist-lib/index.d.ts +6 -3
  56. package/dist-lib/index.js +3732 -2670
  57. package/dist-lib/index.js.map +1 -1
  58. package/dist-lib/state/exegia-provider.d.ts +51 -0
  59. package/dist-lib/state/index.d.ts +4 -0
  60. package/dist-lib/state/store.d.ts +17 -0
  61. package/package.json +15 -12
  62. package/src/components/blocks/auth/__tests__/auth-state-atom.test.tsx +247 -0
  63. package/src/components/blocks/auth/auth-flow-atom.ts +238 -0
  64. package/src/components/blocks/auth/auth-session-atom.ts +82 -0
  65. package/src/components/blocks/auth/auth-state-type.ts +97 -0
  66. package/src/components/blocks/auth/auth-state.ts +52 -0
  67. package/src/components/blocks/auth/use-auth-state.ts +127 -0
  68. package/src/components/blocks/layout.ts +30 -2
  69. package/src/components/blocks/nav/sidebar/__tests__/ai-sidebar-atom.test.tsx +325 -0
  70. package/src/components/blocks/nav/sidebar/ai-sidebar-atom.ts +698 -0
  71. package/src/components/blocks/nav/sidebar/ai-sidebar.tsx +48 -42
  72. package/src/components/blocks/nav/sidebar/index.ts +53 -1
  73. package/src/components/blocks/nav/sidebar/sidebar-context.ts +15 -0
  74. package/src/components/blocks/nav/sidebar/sidebar-row.tsx +119 -50
  75. package/src/components/blocks/nav/sidebar/type.ts +125 -30
  76. package/src/components/blocks/nav/sidebar/use-ai-sidebar-state.ts +123 -0
  77. package/src/components/blocks/nav/sidebar/use-ai-sidebar.ts +301 -248
  78. package/src/components/blocks/nav/sidebar/utils.ts +1 -1
  79. package/src/components/blocks/profile/__tests__/profile-card-block.test.tsx +194 -0
  80. package/src/components/blocks/profile/index.ts +28 -0
  81. package/src/components/blocks/profile/profile-card-atom.ts +247 -0
  82. package/src/components/blocks/profile/profile-card-block.tsx +153 -74
  83. package/src/components/blocks/profile/type.ts +95 -0
  84. package/src/components/blocks/profile/use-profile-card-state.ts +67 -0
  85. package/src/components/blocks/profile/use-profile-card.ts +126 -0
  86. package/src/components/blocks/shell/__tests__/shell-fit-atom.test.tsx +360 -0
  87. package/src/components/blocks/shell/__tests__/shell-layout.test.tsx +192 -3
  88. package/src/components/blocks/shell/__tests__/shell-metrics.test.ts +108 -0
  89. package/src/components/blocks/shell/animated-panel-inset.tsx +5 -1
  90. package/src/components/blocks/shell/animated-panel-provider.tsx +77 -11
  91. package/src/components/blocks/shell/animated-panel-trigger.tsx +4 -0
  92. package/src/components/blocks/shell/animated-panel.tsx +126 -29
  93. package/src/components/blocks/shell/index.ts +18 -13
  94. package/src/components/blocks/shell/shell-fit-atom.ts +243 -0
  95. package/src/components/blocks/shell/shell-layout.tsx +55 -53
  96. package/src/components/blocks/shell/shell-metrics.ts +79 -0
  97. package/src/components/blocks/shell/type.ts +130 -3
  98. package/src/components/blocks/shell/use-shell-fit-state.ts +49 -0
  99. package/src/components/blocks/shell/use-shell-fit.ts +135 -0
  100. package/src/components/blocks/shell/use-shell-panels.ts +57 -4
  101. package/src/components/blocks/shell/utils.ts +44 -4
  102. package/src/components/composed/__tests__/logo.test.tsx +60 -0
  103. package/src/components/composed/logo.tsx +159 -0
  104. package/src/components/composed/tree/CLAUDE.md +132 -0
  105. package/src/components/composed/tree/__tests__/tree-atom.test.tsx +217 -0
  106. package/src/components/composed/tree/__tests__/tree.test.tsx +162 -37
  107. package/src/components/composed/tree/__tests__/use-tree.test.tsx +2 -1
  108. package/src/components/composed/tree/constants.ts +4 -4
  109. package/src/components/composed/tree/index.ts +38 -0
  110. package/src/components/composed/tree/tree-atom.ts +590 -0
  111. package/src/components/composed/tree/tree-node.tsx +117 -78
  112. package/src/components/composed/tree/tree.tsx +24 -16
  113. package/src/components/composed/tree/type.ts +125 -15
  114. package/src/components/composed/tree/use-tree-dnd.ts +82 -51
  115. package/src/components/composed/tree/use-tree-state.ts +105 -0
  116. package/src/components/composed/tree/use-tree.ts +185 -184
  117. package/src/components/composed/user-avatar.tsx +11 -99
  118. package/src/components/user-avatar/__tests__/user-avatar.test.tsx +286 -0
  119. package/src/components/user-avatar/component.tsx +151 -22
  120. package/src/components/user-avatar/fallback.tsx +3 -1
  121. package/src/components/user-avatar/index.ts +19 -0
  122. package/src/components/user-avatar/presence-badge.tsx +56 -0
  123. package/src/components/user-avatar/type.ts +58 -0
  124. package/src/components/user-avatar/use-user-avatar-state.ts +60 -0
  125. package/src/components/user-avatar/use-user-avatar.ts +180 -0
  126. package/src/components/user-avatar/user-avatar-atom.ts +218 -0
  127. package/src/components/user-avatar/utils.ts +94 -0
  128. package/src/index.ts +35 -3
  129. package/src/state/exegia-provider.tsx +79 -0
  130. package/src/state/index.ts +4 -0
  131. package/src/state/store.ts +19 -0
  132. package/dist-lib/components/blocks/nav/sidebar-block.d.ts +0 -14
  133. package/dist-lib/components/blocks/nav/sidebar-nav-row.d.ts +0 -3
  134. package/dist-lib/components/blocks/nav/types.d.ts +0 -60
  135. package/dist-lib/components/blocks/nav/utils.d.ts +0 -1
  136. package/dist-lib/components/blocks/shell/animated-sidebar-content.d.ts +0 -2
  137. package/dist-lib/components/blocks/shell/animated-sidebar-footer.d.ts +0 -2
  138. package/dist-lib/components/blocks/shell/animated-sidebar-group-content.d.ts +0 -2
  139. package/dist-lib/components/blocks/shell/animated-sidebar-group-label.d.ts +0 -2
  140. package/dist-lib/components/blocks/shell/animated-sidebar-group.d.ts +0 -2
  141. package/dist-lib/components/blocks/shell/animated-sidebar-header.d.ts +0 -2
  142. package/dist-lib/components/blocks/shell/animated-sidebar-menu-button.d.ts +0 -3
  143. package/dist-lib/components/blocks/shell/animated-sidebar-menu-item.d.ts +0 -2
  144. package/dist-lib/components/blocks/shell/animated-sidebar-menu-sub-button.d.ts +0 -3
  145. package/dist-lib/components/blocks/shell/animated-sidebar-menu-sub-item.d.ts +0 -2
  146. package/dist-lib/components/blocks/shell/animated-sidebar-menu-sub.d.ts +0 -2
  147. package/dist-lib/components/blocks/shell/animated-sidebar-menu.d.ts +0 -2
  148. package/src/components/blocks/nav/__tests__/sidebar-block.test.tsx +0 -125
  149. package/src/components/blocks/nav/sidebar-block.tsx +0 -142
  150. package/src/components/blocks/nav/sidebar-nav-row.tsx +0 -78
  151. package/src/components/blocks/nav/types.ts +0 -65
  152. package/src/components/blocks/nav/utils.ts +0 -4
  153. package/src/components/blocks/shell/animated-sidebar-content.tsx +0 -19
  154. package/src/components/blocks/shell/animated-sidebar-footer.tsx +0 -19
  155. package/src/components/blocks/shell/animated-sidebar-group-content.tsx +0 -16
  156. package/src/components/blocks/shell/animated-sidebar-group-label.tsx +0 -29
  157. package/src/components/blocks/shell/animated-sidebar-group.tsx +0 -16
  158. package/src/components/blocks/shell/animated-sidebar-header.tsx +0 -16
  159. package/src/components/blocks/shell/animated-sidebar-menu-button.tsx +0 -151
  160. package/src/components/blocks/shell/animated-sidebar-menu-item.tsx +0 -20
  161. package/src/components/blocks/shell/animated-sidebar-menu-sub-button.tsx +0 -85
  162. package/src/components/blocks/shell/animated-sidebar-menu-sub-item.tsx +0 -19
  163. package/src/components/blocks/shell/animated-sidebar-menu-sub.tsx +0 -44
  164. package/src/components/blocks/shell/animated-sidebar-menu.tsx +0 -26
  165. /package/dist-lib/components/blocks/{nav/__tests__/sidebar-block.test.d.ts → auth/__tests__/auth-state-atom.test.d.ts} +0 -0
@@ -0,0 +1,77 @@
1
+ import { AuthStatus } from './auth-shell';
2
+ import { AuthFlowChannel, AuthFlowId, AuthFlowState, AuthFlowStep, AuthUser, BeginAuthVerificationOptions } from './auth-state-type';
3
+ export declare const DEFAULT_AUTH_FLOW_ID: AuthFlowId;
4
+ /**
5
+ * A string-keyed atom family (same in-house shape as `tree-atom.ts`:
6
+ * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only
7
+ * the string-keyed case with a `remove`). Dropping a key lets the store's
8
+ * WeakMap release that instance's state.
9
+ */
10
+ type Family<AtomType> = ((id: AuthFlowId) => AtomType) & {
11
+ remove: (id: AuthFlowId) => void;
12
+ };
13
+ /**
14
+ * Mask an identifier for display. Email → first character of the local part
15
+ * plus `"•••"`, domain intact (`"y•••@example.com"`; a 1-char local part
16
+ * still gets `"y•••@…"`). Non-email (sms) → `"•••"` + last 4 characters;
17
+ * fewer than 4 characters masks everything as `"•••"`.
18
+ */
19
+ export declare function maskAuthIdentifier(identifier: string): string;
20
+ export declare const authFlowStepAtom: Family<import('jotai').PrimitiveAtom<AuthFlowStep> & {
21
+ init: AuthFlowStep;
22
+ }>;
23
+ /** An email or phone number in flight — never a password or a code. */
24
+ export declare const authFlowIdentifierAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
25
+ init: string | null;
26
+ }>;
27
+ export declare const authFlowChannelAtom: Family<import('jotai').PrimitiveAtom<AuthFlowChannel> & {
28
+ init: AuthFlowChannel;
29
+ }>;
30
+ export declare const authFlowStatusAtom: Family<import('jotai').PrimitiveAtom<AuthStatus> & {
31
+ init: AuthStatus;
32
+ }>;
33
+ export declare const authFlowErrorAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
34
+ init: string | null;
35
+ }>;
36
+ /** `identifier` masked for display, `null` while nothing is in flight. */
37
+ export declare const authFlowMaskedIdentifierAtom: Family<import('jotai').Atom<string | null>>;
38
+ export declare const authFlowStateAtom: Family<import('jotai').Atom<AuthFlowState>>;
39
+ /** Show a step with a clean slate (`"idle"`, no error). Keeps the
40
+ * identifier so "back to verify" flows don't lose the destination. */
41
+ export declare const goToAuthStepAtom: Family<import('jotai').WritableAtom<null, [step: AuthFlowStep], void> & {
42
+ init: null;
43
+ }>;
44
+ /** Record the identifier in flight and move to the verification step. */
45
+ export declare const beginAuthVerificationAtom: Family<import('jotai').WritableAtom<null, [options: BeginAuthVerificationOptions], void> & {
46
+ init: null;
47
+ }>;
48
+ /** Mark the flow `"loading"` while an async attempt is in flight. */
49
+ export declare const beginAuthAttemptAtom: Family<import('jotai').WritableAtom<null, [], void> & {
50
+ init: null;
51
+ }>;
52
+ export declare const failAuthFlowAtom: Family<import('jotai').WritableAtom<null, [message: string], void> & {
53
+ init: null;
54
+ }>;
55
+ /** Mark the flow `"success"` and land on the success step. When `user` is
56
+ * given, also sign the session in — one atomic write for the whole
57
+ * "verification passed" transition. */
58
+ export declare const completeAuthFlowAtom: Family<import('jotai').WritableAtom<null, [user?: AuthUser | undefined], void> & {
59
+ init: null;
60
+ }>;
61
+ /** Back to the initial values (login step, no identifier, `"email"`,
62
+ * `"idle"`, no error). */
63
+ export declare const resetAuthFlowAtom: Family<import('jotai').WritableAtom<null, [], void> & {
64
+ init: null;
65
+ }>;
66
+ /**
67
+ * Sign out and return the default flow to the login step — the one to wire
68
+ * to a logout button. `useAuthSessionActions().signOut` is this atom;
69
+ * `signOutAtom` in `auth-session-atom.ts` clears the session only.
70
+ */
71
+ export declare const endAuthSessionAtom: import('jotai').WritableAtom<null, [], void> & {
72
+ init: null;
73
+ };
74
+ /** Drop every atom for `id`. Call on teardown of an explicit flow id; the
75
+ * default flow usually just gets `resetAuthFlowAtom`. */
76
+ export declare function removeAuthFlowInstance(id: AuthFlowId): void;
77
+ export {};
@@ -0,0 +1,28 @@
1
+ import { AuthSessionState, AuthSessionStatus, AuthUser } from './auth-state-type';
2
+ /** `"unknown"` until the app restores or rejects a session at boot. */
3
+ export declare const authSessionStatusAtom: import('jotai').PrimitiveAtom<AuthSessionStatus> & {
4
+ init: AuthSessionStatus;
5
+ };
6
+ export declare const authUserAtom: import('jotai').PrimitiveAtom<AuthUser | null> & {
7
+ init: AuthUser | null;
8
+ };
9
+ export declare const isAuthenticatedAtom: import('jotai').Atom<boolean>;
10
+ export declare const authSessionStateAtom: import('jotai').Atom<AuthSessionState>;
11
+ export declare const signInAtom: import('jotai').WritableAtom<null, [user: AuthUser], void> & {
12
+ init: null;
13
+ };
14
+ export declare const updateAuthUserAtom: import('jotai').WritableAtom<null, [patch: Partial<AuthUser>], void> & {
15
+ init: null;
16
+ };
17
+ /** What an app calls at boot when session restore fails. */
18
+ export declare const markUnauthenticatedAtom: import('jotai').WritableAtom<null, [], void> & {
19
+ init: null;
20
+ };
21
+ /**
22
+ * Clears the session only. Most consumers want `endAuthSessionAtom` from
23
+ * `auth-flow-atom.ts` instead, which also returns the default flow to the
24
+ * login step — the hooks expose that one as `signOut`.
25
+ */
26
+ export declare const signOutAtom: import('jotai').WritableAtom<null, [], void> & {
27
+ init: null;
28
+ };
@@ -0,0 +1,71 @@
1
+ import { AuthStatus } from './auth-shell';
2
+ export type AuthFlowId = string;
3
+ /** Which auth block the app is showing. */
4
+ export type AuthFlowStep = "login" | "signup" | "verify-code" | "forgot-password" | "update-password" | "onboarding" | "success";
5
+ export type AuthFlowChannel = "email" | "sms";
6
+ export interface AuthFlowState {
7
+ step: AuthFlowStep;
8
+ /** The identifier in flight — an email or phone number. Cleared by reset
9
+ * and by signOut. Never store passwords or codes here. */
10
+ identifier: string | null;
11
+ /** `identifier` masked for display — "y•••@example.com", "•••1234". */
12
+ maskedIdentifier: string | null;
13
+ channel: AuthFlowChannel;
14
+ status: AuthStatus;
15
+ error: string | null;
16
+ }
17
+ /** Options for `beginAuthVerificationAtom` / `beginVerification`. */
18
+ export interface BeginAuthVerificationOptions {
19
+ identifier: string;
20
+ /** @default "email" */
21
+ channel?: AuthFlowChannel;
22
+ /** @default "verify-code" */
23
+ step?: AuthFlowStep;
24
+ }
25
+ /** What `useAuthFlowActions(flowId)` returns. */
26
+ export interface AuthFlowActions {
27
+ /** Show a step; resets status to `"idle"` and clears the error. Keeps the
28
+ * identifier. */
29
+ goToStep: (step: AuthFlowStep) => void;
30
+ /** Record the identifier in flight and move to the verification step. */
31
+ beginVerification: (options: BeginAuthVerificationOptions) => void;
32
+ /** Mark the flow `"loading"` while an async attempt is in flight. */
33
+ beginAttempt: () => void;
34
+ /** Mark the flow `"error"` with a message. */
35
+ fail: (message: string) => void;
36
+ /** Mark the flow `"success"`; when a user is given, also sign the session
37
+ * in. */
38
+ complete: (user?: AuthUser) => void;
39
+ /** Back to the initial values (login step, no identifier). */
40
+ reset: () => void;
41
+ }
42
+ /** The signed-in identity, kept for the whole session. Structurally
43
+ * assignable to `ProfileCardUser`, so it drops into `ProfileCardBlock`. */
44
+ export interface AuthUser {
45
+ id: string;
46
+ name: string;
47
+ /** Secondary line — a handle, an email, a role. */
48
+ username?: string;
49
+ email?: string;
50
+ /** Avatar image URL. */
51
+ avatar?: string;
52
+ initials?: string;
53
+ /** App-specific extras the library never interprets. */
54
+ metadata?: Record<string, unknown>;
55
+ }
56
+ /** `unknown` until the app restores or rejects a session at boot. */
57
+ export type AuthSessionStatus = "unknown" | "unauthenticated" | "authenticated";
58
+ export interface AuthSessionState {
59
+ status: AuthSessionStatus;
60
+ user: AuthUser | null;
61
+ }
62
+ /** What `useAuthSessionActions()` returns. */
63
+ export interface AuthSessionActions {
64
+ signIn: (user: AuthUser) => void;
65
+ /** Shallow-merge a patch into the signed-in user; no-op when signed out. */
66
+ updateUser: (patch: Partial<AuthUser>) => void;
67
+ /** What an app calls at boot when session restore fails. */
68
+ markUnauthenticated: () => void;
69
+ /** Sign out AND return the default auth flow to the login step. */
70
+ signOut: () => void;
71
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Public barrel for the auth coordination state. Explicit named exports
3
+ * only — never `export *` from the atom modules, so internals can move
4
+ * without becoming a breaking-change surface.
5
+ */
6
+ export { DEFAULT_AUTH_FLOW_ID, authFlowChannelAtom, authFlowErrorAtom, authFlowIdentifierAtom, authFlowMaskedIdentifierAtom, authFlowStateAtom, authFlowStatusAtom, authFlowStepAtom, beginAuthAttemptAtom, beginAuthVerificationAtom, completeAuthFlowAtom, endAuthSessionAtom, failAuthFlowAtom, goToAuthStepAtom, maskAuthIdentifier, removeAuthFlowInstance, resetAuthFlowAtom, } from './auth-flow-atom';
7
+ export { authSessionStateAtom, authSessionStatusAtom, authUserAtom, isAuthenticatedAtom, markUnauthenticatedAtom, signInAtom, signOutAtom, updateAuthUserAtom, } from './auth-session-atom';
8
+ export { useAuthFlow, useAuthFlowActions, useAuthSession, useAuthSessionActions, } from './use-auth-state';
9
+ export type { AuthFlowActions, AuthFlowChannel, AuthFlowId, AuthFlowState, AuthFlowStep, AuthSessionActions, AuthSessionState, AuthSessionStatus, AuthUser, BeginAuthVerificationOptions, } from './auth-state-type';
@@ -0,0 +1,52 @@
1
+ import { AuthFlowActions, AuthFlowId, AuthFlowState, AuthSessionActions, AuthSessionState } from './auth-state-type';
2
+ /**
3
+ * Read the auth flow registered under `flowId` from anywhere below
4
+ * `ExegiaProvider`. Pairs with `useAuthFlowActions` to wire the auth blocks
5
+ * into one flow — the blocks keep passwords and codes in local state, the
6
+ * flow tracks which block shows and what identifier is in flight:
7
+ *
8
+ * ```tsx
9
+ * const flow = useAuthFlow()
10
+ * const { beginVerification, complete, fail } = useAuthFlowActions()
11
+ *
12
+ * {flow.step === "login" && (
13
+ * <LoginBlock
14
+ * onSubmit={async ({ email }) => {
15
+ * await api.requestCode(email)
16
+ * beginVerification({ identifier: email })
17
+ * }}
18
+ * />
19
+ * )}
20
+ * {flow.step === "verify-code" && (
21
+ * <CodeAuthBlock
22
+ * destination={flow.maskedIdentifier ?? undefined}
23
+ * onVerify={async (code) => complete(await api.verify(code))}
24
+ * />
25
+ * )}
26
+ * ```
27
+ *
28
+ * This returns the whole state object, so the caller re-renders on any
29
+ * change. A component that reads one field should subscribe to that field's
30
+ * atom instead: `useAtomValue(authFlowStepAtom(flowId))`.
31
+ */
32
+ export declare function useAuthFlow(flowId?: AuthFlowId): AuthFlowState;
33
+ /**
34
+ * Drive the auth flow registered under `flowId` from anywhere. Writes only —
35
+ * the caller never re-renders when the flow changes. See `useAuthFlow` for
36
+ * the intended wiring; a block's submit handler typically runs
37
+ * `beginAttempt()` → the API call → `complete(user)` or `fail(message)`.
38
+ */
39
+ export declare function useAuthFlowActions(flowId?: AuthFlowId): AuthFlowActions;
40
+ /**
41
+ * Read the session: `status` (`"unknown"` until the app restores or rejects
42
+ * a session at boot), the signed-in `user`, and derived `isAuthenticated`.
43
+ */
44
+ export declare function useAuthSession(): AuthSessionState & {
45
+ isAuthenticated: boolean;
46
+ };
47
+ /**
48
+ * Drive the session. Writes only. `signOut` is the composite
49
+ * `endAuthSessionAtom`: it clears the session AND returns the default flow
50
+ * to the login step — the one to wire to a logout button.
51
+ */
52
+ export declare function useAuthSessionActions(): AuthSessionActions;
@@ -1,5 +1,8 @@
1
- import { default as ShellLayout } from './shell';
1
+ import { default as ShellLayout, AnimatedPanel, useShellPanels, resetShellPanelWidthAtom, resizeShellPanelAtom, shellFitFitsAtom, shellFitMeasuredAtom, shellFitMetricsAtom, shellFitPanelBoundsAtom, shellFitPanelWidthAtom, shellFitRequestedWidthAtom, shellFitStateAtom } from './shell';
2
2
  declare const Layout: {
3
3
  Main: typeof ShellLayout;
4
+ Panel: typeof AnimatedPanel;
5
+ Trigger: import('react').ForwardRefExoticComponent<import('./shell').AnimatedSidebarTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
4
6
  };
7
+ export { useShellPanels, resetShellPanelWidthAtom, resizeShellPanelAtom, shellFitFitsAtom, shellFitMeasuredAtom, shellFitMetricsAtom, shellFitPanelBoundsAtom, shellFitPanelWidthAtom, shellFitRequestedWidthAtom, shellFitStateAtom, };
5
8
  export default Layout;
@@ -0,0 +1,217 @@
1
+ import { Atom } from 'jotai';
2
+ import { AISidebarConfig, AISidebarHandlers, AISidebarInstanceId, AISidebarSeed, AISidebarState, DropTarget, FlatResource, SidebarResource, SidebarResourceDropPosition, SidebarResourceMove } from './type.ts';
3
+ /** What a sidebar reads as before `useAISidebar` publishes its options. */
4
+ export declare const DEFAULT_AI_SIDEBAR_CONFIG: AISidebarConfig;
5
+ /**
6
+ * A string-keyed atom family.
7
+ *
8
+ * `jotai/utils`' `atomFamily` is deprecated for Jotai v3, and we need only
9
+ * the string-keyed case with a `remove` — so this stays in-house rather than
10
+ * adding `jotai-family` as a second Jotai package to keep version-aligned.
11
+ * Dropping a key lets the store's WeakMap release that instance's state.
12
+ */
13
+ type Family<AtomType> = ((id: AISidebarInstanceId) => AtomType) & {
14
+ remove: (id: AISidebarInstanceId) => void;
15
+ };
16
+ /** @internal */
17
+ export declare const aiSidebarConfigAtom: Family<import('jotai').PrimitiveAtom<AISidebarConfig> & {
18
+ init: AISidebarConfig;
19
+ }>;
20
+ /** @internal Refreshed every commit; nothing subscribes, so it is free. */
21
+ export declare const aiSidebarHandlersAtom: Family<import('jotai').PrimitiveAtom<AISidebarHandlers> & {
22
+ init: AISidebarHandlers;
23
+ }>;
24
+ /** The sidebar's current data — hook-owned, or the projection of a
25
+ * controlled `items` prop. */
26
+ export declare const aiSidebarItemsAtom: Family<import('jotai').PrimitiveAtom<SidebarResource[]> & {
27
+ init: SidebarResource[];
28
+ }>;
29
+ /** @internal The hook-owned selection. `select` writes it only while no
30
+ * `activeId` prop owns the selection — read `aiSidebarActiveIdAtom` for the
31
+ * value the sidebar actually renders. */
32
+ export declare const aiSidebarOwnActiveIdAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
33
+ init: string | null;
34
+ }>;
35
+ /** @internal Projection of a controlled `activeId` prop; `undefined` while
36
+ * the selection is hook-owned. */
37
+ export declare const aiSidebarControlledActiveIdAtom: Family<import('jotai').PrimitiveAtom<string | null | undefined> & {
38
+ init: string | null | undefined;
39
+ }>;
40
+ /** Open rows — hook-owned, or the projection of a controlled `expandedIds`
41
+ * prop. */
42
+ export declare const aiSidebarExpandedIdsAtom: Family<import('jotai').PrimitiveAtom<ReadonlySet<string>> & {
43
+ init: ReadonlySet<string>;
44
+ }>;
45
+ /** Roving-focus target. DOM focus is moved by the block, which owns the row
46
+ * refs; this is only which row is tabbable. */
47
+ export declare const aiSidebarFocusedIdAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
48
+ init: string | null;
49
+ }>;
50
+ export declare const aiSidebarDraggingIdAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
51
+ init: string | null;
52
+ }>;
53
+ export declare const aiSidebarDropTargetAtom: Family<import('jotai').PrimitiveAtom<DropTarget | null> & {
54
+ init: DropTarget | null;
55
+ }>;
56
+ export declare const aiSidebarMenuOpenIdAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
57
+ init: string | null;
58
+ }>;
59
+ export declare const aiSidebarRenamingIdAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
60
+ init: string | null;
61
+ }>;
62
+ export declare const aiSidebarHoveredIdAtom: Family<import('jotai').PrimitiveAtom<string | null> & {
63
+ init: string | null;
64
+ }>;
65
+ /** Live-region text for the last move or rename outcome. */
66
+ export declare const aiSidebarAnnouncementAtom: Family<import('jotai').PrimitiveAtom<string> & {
67
+ init: string;
68
+ }>;
69
+ /** A move is in flight. Read synchronously by `moveAISidebarRowAtom` before
70
+ * it starts another — the store needs no ref to see its own latest write. */
71
+ export declare const aiSidebarMovePendingAtom: Family<import('jotai').PrimitiveAtom<boolean> & {
72
+ init: boolean;
73
+ }>;
74
+ /** @internal The only items atom `useAISidebar` may subscribe to: empty
75
+ * while a controlled `items` prop owns the data, so the projection write
76
+ * never feeds back into the render that produced it. An inline `items={[…]}`
77
+ * array is a new reference every render, and a subscribed round-trip would
78
+ * loop. */
79
+ export declare const aiSidebarOwnedItemsAtom: Family<Atom<SidebarResource[]>>;
80
+ /** @internal The same guard for `expandedIds`, which is controllable here
81
+ * and arrives as an array — just as unstable an identity as `items`. */
82
+ export declare const aiSidebarOwnedExpandedIdsAtom: Family<Atom<ReadonlySet<string>>>;
83
+ /** The selected row: the controlled `activeId` when there is one, the
84
+ * hook-owned selection otherwise. Kept as two atoms because a controlled
85
+ * `activeId` of `null` falls through to the hook-owned value — the block has
86
+ * always read `activeId ?? internalActiveId`. */
87
+ export declare const aiSidebarActiveIdAtom: Family<Atom<string | null>>;
88
+ /** Visible rows in order, each with its depth and parent id. */
89
+ export declare const aiSidebarFlatAtom: Family<Atom<FlatResource[]>>;
90
+ /** Some row is hovered and no drag is running — mounts the pill wrapper. */
91
+ export declare const aiSidebarHoverActiveAtom: Family<Atom<boolean>>;
92
+ /** Whether this one row is the current selection. */
93
+ export declare const aiSidebarRowSelectedAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
94
+ /** Whether this one row is open. */
95
+ export declare const aiSidebarRowExpandedAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
96
+ /** Whether this one row is the roving-focus target. */
97
+ export declare const aiSidebarRowFocusedAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
98
+ /** Whether this one row is in rename mode. */
99
+ export declare const aiSidebarRowRenamingAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
100
+ /** Whether this one row's action menu is open. */
101
+ export declare const aiSidebarRowMenuOpenAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
102
+ /** Whether this one row is the row in flight. */
103
+ export declare const aiSidebarRowDraggingAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
104
+ /** Where a drop on this one row would land, `null` when it is not hovered
105
+ * by a drag. */
106
+ export declare const aiSidebarRowDropAtom: (id: AISidebarInstanceId, rowId: string) => Atom<SidebarResourceDropPosition | null>;
107
+ /** Whether this one row owns the sliding hover pill. */
108
+ export declare const aiSidebarRowHoveredAtom: (id: AISidebarInstanceId, rowId: string) => Atom<boolean>;
109
+ /** The whole state of one sidebar. Components reading a single field should
110
+ * subscribe to that field's atom instead — this one changes on every edit. */
111
+ export declare const aiSidebarStateAtom: Family<Atom<AISidebarState>>;
112
+ export declare const expandAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
113
+ init: null;
114
+ }>;
115
+ export declare const collapseAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
116
+ init: null;
117
+ }>;
118
+ export declare const toggleAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
119
+ init: null;
120
+ }>;
121
+ export declare const expandAllAISidebarRowsAtom: Family<import('jotai').WritableAtom<null, [], void> & {
122
+ init: null;
123
+ }>;
124
+ export declare const collapseAllAISidebarRowsAtom: Family<import('jotai').WritableAtom<null, [], void> & {
125
+ init: null;
126
+ }>;
127
+ /** Open every ancestor of `rowId` without touching the rest of the tree. */
128
+ export declare const revealAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
129
+ init: null;
130
+ }>;
131
+ export declare const selectAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
132
+ init: null;
133
+ }>;
134
+ /** The store half of `focus`: which row is tabbable. Moving DOM focus is the
135
+ * block's job — it owns the row refs. */
136
+ export declare const focusAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
137
+ init: null;
138
+ }>;
139
+ /** @internal Keeps the roving target on a row that still renders: a focused
140
+ * row that folds away hands focus to the first visible row instead of
141
+ * pointing at nothing. `useAISidebar` runs it after every projection. */
142
+ export declare const normalizeAISidebarFocusAtom: Family<import('jotai').WritableAtom<null, [], void> & {
143
+ init: null;
144
+ }>;
145
+ export declare const startAISidebarRenameAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
146
+ init: null;
147
+ }>;
148
+ export declare const cancelAISidebarRenameAtom: Family<import('jotai').WritableAtom<null, [], void> & {
149
+ init: null;
150
+ }>;
151
+ /** Commit a rename and leave rename mode. Applied optimistically and rolled
152
+ * back if `onRename` rejects. Blank and unchanged labels are dropped. */
153
+ export declare const renameAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [rowId: string, label: string], void> & {
154
+ init: null;
155
+ }>;
156
+ export declare const openAISidebarMenuAtom: Family<import('jotai').WritableAtom<null, [rowId: string], void> & {
157
+ init: null;
158
+ }>;
159
+ /** Closes the menu and hands the roving target back to the row that owned
160
+ * it, then returns that id so the block can move DOM focus there — otherwise
161
+ * focus falls back to the body and the keyboard user loses their place. */
162
+ export declare const closeAISidebarMenuAtom: Family<import('jotai').WritableAtom<null, [], string | null> & {
163
+ init: null;
164
+ }>;
165
+ /**
166
+ * Reorder, applied optimistically and rolled back if `onMove` rejects.
167
+ *
168
+ * The pending flag is read straight back out of the store, which is why this
169
+ * needs no ref to guard overlapping moves the way React state did: the write
170
+ * is visible to the next call immediately, not after a commit.
171
+ */
172
+ export declare const moveAISidebarRowAtom: Family<import('jotai').WritableAtom<null, [move: SidebarResourceMove], Promise<void>> & {
173
+ init: null;
174
+ }>;
175
+ /** Replace the data. Reports through `onItemsChange`; writes the atom only
176
+ * when no controlled `items` prop owns it. */
177
+ export declare const setAISidebarItemsAtom: Family<import('jotai').WritableAtom<null, [items: SidebarResource[]], void> & {
178
+ init: null;
179
+ }>;
180
+ export declare const setAISidebarHoveredAtom: Family<import('jotai').WritableAtom<null, [rowId: string, hovered: boolean], void> & {
181
+ init: null;
182
+ }>;
183
+ export declare const clearAISidebarHoverAtom: Family<import('jotai').WritableAtom<null, [], void> & {
184
+ init: null;
185
+ }>;
186
+ export declare const endAISidebarDragAtom: Family<import('jotai').WritableAtom<null, [], void> & {
187
+ init: null;
188
+ }>;
189
+ /** @internal Publish the latest options; seed the instance once. */
190
+ export declare const mountAISidebarAtom: Family<import('jotai').WritableAtom<null, [config: AISidebarConfig, seed: AISidebarSeed], void> & {
191
+ init: null;
192
+ }>;
193
+ /** @internal */
194
+ export declare const setAISidebarHandlersAtom: Family<import('jotai').WritableAtom<null, [handlers: AISidebarHandlers], void> & {
195
+ init: null;
196
+ }>;
197
+ /** @internal One-way projections of controlled props — no callbacks fire. */
198
+ export declare const projectAISidebarItemsAtom: Family<import('jotai').WritableAtom<null, [items: SidebarResource[]], void> & {
199
+ init: null;
200
+ }>;
201
+ /** @internal */
202
+ export declare const projectAISidebarActiveIdAtom: Family<import('jotai').WritableAtom<null, [activeId: string | null], void> & {
203
+ init: null;
204
+ }>;
205
+ /** @internal */
206
+ export declare const projectAISidebarExpandedIdsAtom: Family<import('jotai').WritableAtom<null, [expandedIds: string[]], void> & {
207
+ init: null;
208
+ }>;
209
+ /** Back to the values the instance mounted with. */
210
+ export declare const resetAISidebarAtom: Family<import('jotai').WritableAtom<null, [], void> & {
211
+ init: null;
212
+ }>;
213
+ /** Drop every atom for `id`. `useAISidebar` calls this on unmount for
214
+ * sidebars it keyed itself; an explicit `sidebarId` outlives its component,
215
+ * so an app-named sidebar keeps its open rows across a route change. */
216
+ export declare function removeAISidebarInstance(id: AISidebarInstanceId): void;
217
+ export {};
@@ -3,11 +3,13 @@ import { MarqueeLabel } from './marquee-label.tsx';
3
3
  import { ResourceRow } from './sidebar-row.tsx';
4
4
  import { SidebarIcon } from './sidebar-icon.tsx';
5
5
  export { useAISidebar, type UseAISidebarOptions } from './use-ai-sidebar.ts';
6
+ export { useAISidebarActions, useAISidebarState, } from './use-ai-sidebar-state.ts';
6
7
  export type * from './type.ts';
8
+ export { aiSidebarActiveIdAtom, aiSidebarAnnouncementAtom, aiSidebarDraggingIdAtom, aiSidebarDropTargetAtom, aiSidebarExpandedIdsAtom, aiSidebarFlatAtom, aiSidebarFocusedIdAtom, aiSidebarHoverActiveAtom, aiSidebarHoveredIdAtom, aiSidebarItemsAtom, aiSidebarMenuOpenIdAtom, aiSidebarMovePendingAtom, aiSidebarRenamingIdAtom, aiSidebarRowDraggingAtom, aiSidebarRowDropAtom, aiSidebarRowExpandedAtom, aiSidebarRowFocusedAtom, aiSidebarRowHoveredAtom, aiSidebarRowMenuOpenAtom, aiSidebarRowRenamingAtom, aiSidebarRowSelectedAtom, aiSidebarStateAtom, cancelAISidebarRenameAtom, clearAISidebarHoverAtom, closeAISidebarMenuAtom, collapseAISidebarRowAtom, collapseAllAISidebarRowsAtom, endAISidebarDragAtom, expandAISidebarRowAtom, expandAllAISidebarRowsAtom, focusAISidebarRowAtom, moveAISidebarRowAtom, openAISidebarMenuAtom, removeAISidebarInstance, renameAISidebarRowAtom, resetAISidebarAtom, revealAISidebarRowAtom, selectAISidebarRowAtom, setAISidebarHoveredAtom, setAISidebarItemsAtom, startAISidebarRenameAtom, toggleAISidebarRowAtom, } from './ai-sidebar-atom.ts';
7
9
  export { AISidebar, MarqueeLabel, ResourceRow, SidebarIcon };
8
10
  export declare const Sidebar: {
9
11
  Wrapper: typeof AISidebar;
10
12
  MarqueeLabel: typeof MarqueeLabel;
11
- Row: typeof ResourceRow;
13
+ Row: import('react').MemoExoticComponent<({ row }: import('./type.ts').ResourceRowProps) => import("react").JSX.Element>;
12
14
  Icon: typeof SidebarIcon;
13
15
  };
@@ -0,0 +1,3 @@
1
+ import { AISidebarContextValue } from './type.ts';
2
+ export declare const AISidebarContext: import('react').Context<AISidebarContextValue | null>;
3
+ export declare function useAISidebarContext(): AISidebarContextValue;
@@ -1,2 +1,4 @@
1
1
  import { ResourceRowProps } from './type';
2
- export declare function ResourceRow({ row, active, expanded, focused, draggingId, dropTarget, menuOpen, renaming, onDragEnd, onDragOver, onDragStart, onDrop, onFocus, onKeyDown, onMenuOpenChange, onRenameCancel, onRenameCommit, onRenameStart, onSelect, onToggle, hoverActive, hoverPill, hoverLayoutId, onHoverChange, renderIcon, renderMenu, renderActionsTrigger, setRef, }: ResourceRowProps): import("react").JSX.Element;
2
+ declare function ResourceRowImpl({ row }: ResourceRowProps): import("react").JSX.Element;
3
+ export declare const ResourceRow: import('react').MemoExoticComponent<typeof ResourceRowImpl>;
4
+ export {};