@exegia/corpora-ui 0.21.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 (59) hide show
  1. package/dist-lib/components/blocks/layout.d.ts +4 -1
  2. package/dist-lib/components/blocks/profile/profile-card-block.d.ts +1 -1
  3. package/dist-lib/components/blocks/shell/index.d.ts +0 -12
  4. package/dist-lib/components/composed/logo.d.ts +34 -0
  5. package/dist-lib/components/user-avatar/type.d.ts +10 -2
  6. package/dist-lib/components/user-avatar/use-user-avatar.d.ts +5 -0
  7. package/dist-lib/components/user-avatar/user-avatar-atom.d.ts +9 -0
  8. package/dist-lib/components/user-avatar/utils.d.ts +22 -0
  9. package/dist-lib/index.d.ts +1 -1
  10. package/dist-lib/index.js +3083 -3229
  11. package/dist-lib/index.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/components/blocks/layout.ts +30 -2
  14. package/src/components/blocks/profile/profile-card-block.tsx +1 -1
  15. package/src/components/blocks/shell/index.ts +0 -13
  16. package/src/components/composed/__tests__/logo.test.tsx +60 -0
  17. package/src/components/composed/logo.tsx +159 -0
  18. package/src/components/user-avatar/__tests__/user-avatar.test.tsx +41 -0
  19. package/src/components/user-avatar/component.tsx +38 -8
  20. package/src/components/user-avatar/fallback.tsx +3 -1
  21. package/src/components/user-avatar/type.ts +10 -2
  22. package/src/components/user-avatar/use-user-avatar.ts +38 -2
  23. package/src/components/user-avatar/user-avatar-atom.ts +20 -0
  24. package/src/components/user-avatar/utils.ts +94 -0
  25. package/src/index.ts +1 -1
  26. package/dist-lib/components/blocks/nav/sidebar-block.d.ts +0 -14
  27. package/dist-lib/components/blocks/nav/sidebar-nav-row.d.ts +0 -3
  28. package/dist-lib/components/blocks/nav/types.d.ts +0 -60
  29. package/dist-lib/components/blocks/nav/utils.d.ts +0 -1
  30. package/dist-lib/components/blocks/shell/animated-sidebar-content.d.ts +0 -2
  31. package/dist-lib/components/blocks/shell/animated-sidebar-footer.d.ts +0 -2
  32. package/dist-lib/components/blocks/shell/animated-sidebar-group-content.d.ts +0 -2
  33. package/dist-lib/components/blocks/shell/animated-sidebar-group-label.d.ts +0 -2
  34. package/dist-lib/components/blocks/shell/animated-sidebar-group.d.ts +0 -2
  35. package/dist-lib/components/blocks/shell/animated-sidebar-header.d.ts +0 -2
  36. package/dist-lib/components/blocks/shell/animated-sidebar-menu-button.d.ts +0 -3
  37. package/dist-lib/components/blocks/shell/animated-sidebar-menu-item.d.ts +0 -2
  38. package/dist-lib/components/blocks/shell/animated-sidebar-menu-sub-button.d.ts +0 -3
  39. package/dist-lib/components/blocks/shell/animated-sidebar-menu-sub-item.d.ts +0 -2
  40. package/dist-lib/components/blocks/shell/animated-sidebar-menu-sub.d.ts +0 -2
  41. package/dist-lib/components/blocks/shell/animated-sidebar-menu.d.ts +0 -2
  42. package/src/components/blocks/nav/__tests__/sidebar-block.test.tsx +0 -125
  43. package/src/components/blocks/nav/sidebar-block.tsx +0 -142
  44. package/src/components/blocks/nav/sidebar-nav-row.tsx +0 -78
  45. package/src/components/blocks/nav/types.ts +0 -65
  46. package/src/components/blocks/nav/utils.ts +0 -4
  47. package/src/components/blocks/shell/animated-sidebar-content.tsx +0 -19
  48. package/src/components/blocks/shell/animated-sidebar-footer.tsx +0 -19
  49. package/src/components/blocks/shell/animated-sidebar-group-content.tsx +0 -16
  50. package/src/components/blocks/shell/animated-sidebar-group-label.tsx +0 -29
  51. package/src/components/blocks/shell/animated-sidebar-group.tsx +0 -16
  52. package/src/components/blocks/shell/animated-sidebar-header.tsx +0 -16
  53. package/src/components/blocks/shell/animated-sidebar-menu-button.tsx +0 -151
  54. package/src/components/blocks/shell/animated-sidebar-menu-item.tsx +0 -20
  55. package/src/components/blocks/shell/animated-sidebar-menu-sub-button.tsx +0 -85
  56. package/src/components/blocks/shell/animated-sidebar-menu-sub-item.tsx +0 -19
  57. package/src/components/blocks/shell/animated-sidebar-menu-sub.tsx +0 -44
  58. package/src/components/blocks/shell/animated-sidebar-menu.tsx +0 -26
  59. /package/dist-lib/components/{blocks/nav/__tests__/sidebar-block.test.d.ts → composed/__tests__/logo.test.d.ts} +0 -0
@@ -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;
@@ -32,7 +32,7 @@ export interface ProfileCardBlockProps {
32
32
  * its avatar — for an icon-collapsed sidebar rail. The fold animates: the
33
33
  * identity lines and chevron slide to zero width, the avatar stays put.
34
34
  * Controlled when passed. Left unset, the card follows the `AnimatedPanel`
35
- * it sits in (a `SidebarBlock` footer folds with the rail on its own), and
35
+ * it sits in (a panel footer folds with the rail on its own), and
36
36
  * outside a panel starts from `defaultVariant`.
37
37
  */
38
38
  variant?: ProfileCardVariant;
@@ -10,16 +10,4 @@ export * from './animated-panel';
10
10
  export * from './animated-panel-inset';
11
11
  export * from './animated-panel-provider';
12
12
  export * from './animated-panel-trigger';
13
- export * from './animated-sidebar-header';
14
- export * from './animated-sidebar-content';
15
- export * from './animated-sidebar-footer';
16
- export * from './animated-sidebar-group';
17
- export * from './animated-sidebar-group-label';
18
- export * from './animated-sidebar-group-content';
19
- export * from './animated-sidebar-menu';
20
- export * from './animated-sidebar-menu-item';
21
- export * from './animated-sidebar-menu-sub';
22
- export * from './animated-sidebar-menu-sub-item';
23
- export * from './animated-sidebar-menu-sub-button';
24
- export * from './animated-sidebar-menu-button';
25
13
  export { ShellLayout as default };
@@ -0,0 +1,34 @@
1
+ import * as React from "react";
2
+ /** `full` shows mark + wordmark; `mark` folds the wordmark away — an icon
3
+ * rail, a favicon-sized corner. */
4
+ export type LogoVariant = "full" | "mark";
5
+ export interface LogoProps extends Omit<React.HTMLAttributes<HTMLElement>, "children"> {
6
+ /**
7
+ * Brand name. Labels the logo for AT (and the link, when `href` renders
8
+ * one), drives the default wordmark, and the monogram tile when no mark
9
+ * is given.
10
+ */
11
+ name: string;
12
+ /** Custom mark — an inline SVG sized to fill its box. Wins over `src`. */
13
+ mark?: React.ReactNode;
14
+ /** Image URL for the mark. Decorative — `name` labels the logo. */
15
+ src?: string;
16
+ /** Wordmark content. Defaults to `name`. */
17
+ wordmark?: React.ReactNode;
18
+ /** `full` (default) or `mark` — the wordmark folds away, animated. */
19
+ variant?: LogoVariant;
20
+ /** Renders the logo as a link — the usual "mark goes home" affordance. */
21
+ href?: string;
22
+ }
23
+ /**
24
+ * Brand lockup: a mark beside a wordmark. The mark is whatever the brand
25
+ * has — an SVG (`mark`), an image (`src`), or, given neither, a monogram
26
+ * tile derived from `name`. `variant="mark"` folds the wordmark away with
27
+ * the same motion a collapsing rail uses, so the lockup can sit in one and
28
+ * follow its fold. With `href` the whole lockup is a link named by `name`.
29
+ *
30
+ * Sizing rides on the mark: it defaults to `size-8`; restyle via
31
+ * `[&_[data-slot=logo-mark]]:size-*` or wrap in a text-size context for the
32
+ * wordmark, which inherits.
33
+ */
34
+ export declare function Logo({ name, mark, src, wordmark, variant, href, className, ...props }: LogoProps): React.ReactElement;
@@ -31,8 +31,11 @@ export interface UserAvatarProps extends Omit<AvatarPrimitive.Root.Props, "child
31
31
  presence?: UserPresence;
32
32
  /**
33
33
  * Embossed rim whose highlight follows the pointer, so the avatar reads as
34
- * a lit bezel rather than a flat disc. Light and dark aware; static under
35
- * reduced motion. On by default — pass `false` for a flat disc.
34
+ * a lit bezel rather than a flat disc. Light and dark aware, and with a
35
+ * photo it samples the image's rim lightness (CORS permitting) to weight
36
+ * highlight against shadow, so the emboss reads on a dark portrait and a
37
+ * pale one alike. Static under reduced motion. On by default — pass
38
+ * `false` for a flat disc.
36
39
  */
37
40
  bezel?: boolean;
38
41
  /**
@@ -51,6 +54,11 @@ export interface UserAvatarState {
51
54
  * `((a % 360) + 360) % 360` if you need it normalised. */
52
55
  bezelAngle: number;
53
56
  imageStatus: ImageStatus;
57
+ /** Perceived lightness of the loaded image's rim, 0 (black) → 1 (white),
58
+ * or `null` while unknown — no image yet, or one that could not be sampled
59
+ * (non-CORS host, no canvas). The bezel's highlight/shadow alphas follow
60
+ * it so the emboss reads on a dark photo and a pale one alike. */
61
+ imageTone: number | null;
54
62
  }
55
63
  /** Write-only handles onto one avatar. Nothing here re-renders the caller. */
56
64
  export interface UserAvatarActions {
@@ -8,12 +8,17 @@ export interface UseUserAvatarOptions {
8
8
  bezel: boolean;
9
9
  /** Only meaningful with an image — no image, no status to track. */
10
10
  hasImage: boolean;
11
+ /** The image URL, sampled for its rim lightness once it has loaded so the
12
+ * bezel can pick alphas that read against it. Omit to skip sampling. */
13
+ src?: string;
11
14
  }
12
15
  export interface UserAvatarBinding {
13
16
  avatarId: UserAvatarInstanceId;
14
17
  presence: UserPresence | null;
15
18
  bezelAngle: number;
16
19
  imageStatus: ImageStatus;
20
+ /** Rim lightness of the loaded image, 0–1, or `null` while unknown. */
21
+ imageTone: number | null;
17
22
  /** Hand to the image's `onLoadingStatusChange`. Stable. */
18
23
  setImageStatus: (status: ImageStatus) => void;
19
24
  /** Attach to the avatar root — the bezel is lit relative to its centre. */
@@ -15,6 +15,10 @@ export declare const userAvatarBezelAngleAtom: Family<import('jotai').PrimitiveA
15
15
  export declare const userAvatarImageStatusAtom: Family<import('jotai').PrimitiveAtom<import('@base-ui/react').ImageLoadingStatus> & {
16
16
  init: import('@base-ui/react').ImageLoadingStatus;
17
17
  }>;
18
+ /** Rim lightness of the loaded image, `null` until sampled (or unsampleable). */
19
+ export declare const userAvatarImageToneAtom: Family<import('jotai').PrimitiveAtom<number | null> & {
20
+ init: number | null;
21
+ }>;
18
22
  /** @internal Which fields the mounted component controls from props. */
19
23
  export declare const userAvatarConfigAtom: Family<import('jotai').PrimitiveAtom<UserAvatarConfig> & {
20
24
  init: UserAvatarConfig;
@@ -42,6 +46,11 @@ export declare const setUserAvatarBezelAngleAtom: Family<import('jotai').Writabl
42
46
  export declare const setUserAvatarImageStatusAtom: Family<import('jotai').WritableAtom<null, [status: import('@base-ui/react').ImageLoadingStatus], void> & {
43
47
  init: null;
44
48
  }>;
49
+ /** @internal Written by the hook once the loaded image has been sampled;
50
+ * cleared (null) when the image changes or goes away. Clamped to [0, 1]. */
51
+ export declare const setUserAvatarImageToneAtom: Family<import('jotai').WritableAtom<null, [tone: number | null], void> & {
52
+ init: null;
53
+ }>;
45
54
  /** @internal Projection of the mounted component's controlled props. */
46
55
  export declare const projectUserAvatarPropsAtom: Family<import('jotai').WritableAtom<null, [config: UserAvatarConfig, presence: UserPresence | null | undefined], void> & {
47
56
  init: null;
@@ -1,2 +1,24 @@
1
1
  /** "Jenny Hamilton" → "JH", "luna" → "L". */
2
2
  export declare function initialsFrom(name: string): string;
3
+ /**
4
+ * Average perceived lightness, 0 (black) → 1 (white), of an image's outer
5
+ * band — the pixels the bezel ring overlays — or `null` when it cannot be
6
+ * measured: no DOM/canvas (SSR, test DOM), a decode failure, or a host
7
+ * without CORS headers (the sample needs a CORS-clean image; the avatar's
8
+ * own `<img>` is left untouched, so a non-CORS host still displays).
9
+ * Results are memoised per `src`, so a room of the same face samples once.
10
+ */
11
+ export declare function measureRimTone(src: string): Promise<number | null>;
12
+ /**
13
+ * Bezel highlight/shadow alphas for an image whose rim lightness is `tone`
14
+ * (0 → 1). Against a dark rim the white highlight is eased off (it glares)
15
+ * and the black shadow pushed up (it has to darken mid-tones to register);
16
+ * against a pale rim the reverse — the highlight can be full (it barely
17
+ * shows) and the shadow is what carries the emboss, so it sits lighter.
18
+ * Linear between; the end points are tuned by eye on a dark and a light
19
+ * photo in both themes.
20
+ */
21
+ export declare function bezelAlphasForTone(tone: number): {
22
+ hi: number;
23
+ lo: number;
24
+ };
@@ -20,6 +20,7 @@ export * from './components/ui/separator';
20
20
  export * from './components/ui/skeleton';
21
21
  export * from './components/ui/spinner';
22
22
  export * from './components/ui/textarea';
23
+ export * from './components/composed/logo';
23
24
  export * from './components/composed/password-input';
24
25
  export * from './components/composed/social-providers';
25
26
  export * from './components/composed/tree';
@@ -36,7 +37,6 @@ export * from './components/blocks/auth/passkey-manager-block';
36
37
  export * from './components/blocks/auth/passkey-sign-in-block';
37
38
  export * from './components/blocks/auth/signup-block';
38
39
  export * from './components/blocks/auth/update-password-block';
39
- export * from './components/blocks/nav/sidebar-block';
40
40
  export * from './components/blocks/nav/sidebar';
41
41
  export * from './components/blocks/shell';
42
42
  export { default as ShellLayout } from './components/blocks/shell';