@ag2/weave 0.13.0 → 0.15.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/README.md CHANGED
@@ -4,6 +4,27 @@
4
4
 
5
5
  The AG2 Space design system. Forked from [folds](https://github.com/cinnyapp/folds) 2.6.2 (Apache-2.0); `@ag2/weave@0.1.0` is folds@2.6.2 under the new name.
6
6
 
7
+ ## Temporary sidebar collapse
8
+
9
+ Keep `PageNav` mounted and call `useRoomNavAutoCollapse` once from the room layout:
10
+
11
+ ```tsx
12
+ import { useRoomNavAutoCollapse } from "@ag2/weave";
13
+
14
+ useRoomNavAutoCollapse(commonsOpen && !isMobile, roomId);
15
+ ```
16
+
17
+ The hook collapses the sidebar before paint without writing `roomNavCollapsed`.
18
+ Closing Commons or unmounting the layout releases the request and restores the saved
19
+ preference. Manual controls still use `useRoomNavCollapsed()`; they toggle the effective
20
+ state, save the user's choice, and override requests already active. Switching tabs in
21
+ the same room preserves that choice. Closing and reopening Commons, or changing `roomId`,
22
+ starts a fresh automatic collapse. Leave the optional scope unchanged for the lifetime
23
+ of one open panel, and disable the request on mobile.
24
+
25
+ `useRoomNavCollapsed()` retains its existing tuple and animation options. The collapsed
26
+ sidebar's restore button remains the way to expand it; no room-header control is needed.
27
+
7
28
  ## Ambient orb background
8
29
 
9
30
  `OrbBackground` renders the Absorb / Calm / Aura field and is the default background
@@ -104,6 +104,7 @@ export declare const Icons: {
104
104
  RecentClock: IconSrc;
105
105
  Power: IconSrc;
106
106
  ReplyArrow: IconSrc;
107
+ ForwardArrow: IconSrc;
107
108
  ArrowGoRight: IconSrc;
108
109
  ArrowGoRightPlus: IconSrc;
109
110
  ArrowGoRightCross: IconSrc;
@@ -66,4 +66,5 @@ export * from "./surface-toolbar";
66
66
  export * from "./dock";
67
67
  export * from "./inspector-tabs";
68
68
  export * from "./activity-item";
69
+ export * from "./quote-card";
69
70
  export * from "./orb-background";
@@ -12,6 +12,12 @@ export declare type RoomNavToggleOptions = {
12
12
  animate?: boolean;
13
13
  };
14
14
  export declare function useRoomNavCollapsed(): [boolean, (options?: RoomNavToggleOptions) => void];
15
+ /** Temporarily collapse the sidebar without writing its saved preference.
16
+ * Manual toggles win until this request ends. Changing scope starts a new request
17
+ * (for example, entering another room); switching surfaces in one scope does not.
18
+ * Call once from the layout owning the request, outside the collapsible content.
19
+ */
20
+ export declare function useRoomNavAutoCollapse(active: boolean, scope?: string): void;
15
21
  declare type PageNavProps = ClientDrawerLayoutProps & css.PageNavVariants & {
16
22
  /** Decorative brand mark shown in the collapsed rail until hover or keyboard focus. */
17
23
  collapsedMark?: ReactNode;
@@ -0,0 +1,7 @@
1
+ /** One effective state shared by the sidebar and all of its manual controls. */
2
+ export declare const createRoomNavCollapseStore: (storage: () => Pick<Storage, "getItem" | "setItem">) => {
3
+ getSnapshot: () => boolean;
4
+ subscribe: (listener: () => void) => () => void;
5
+ toggle: () => void;
6
+ requestCollapse: () => () => void;
7
+ };
@@ -0,0 +1,9 @@
1
+ export declare const QuoteCard: string;
2
+ export declare const Head: string;
3
+ export declare const Glyph: string;
4
+ export declare const Face: string;
5
+ export declare const Name: string;
6
+ export declare const Time: string;
7
+ export declare const Snippet: string;
8
+ export declare const FileRow: string;
9
+ export declare const Deleted: string;
@@ -0,0 +1,21 @@
1
+ import React, { ReactNode } from "react";
2
+ export declare type QuoteCardContext = "Reply" | "File" | "Forwarded" | "Deleted";
3
+ export declare type QuoteCardProps = {
4
+ /** Reply, a file-only parent, a forwarded message, or a parent that was deleted. */
5
+ context?: QuoteCardContext;
6
+ /** 20px: a photo, an initial, or an agent's mark. */
7
+ avatar?: ReactNode;
8
+ /** "You" when it's yours. */
9
+ name?: string;
10
+ time?: string;
11
+ /** Forwarded: where it came from, after the time ("Direct message", "#Invoke Only"). */
12
+ source?: string;
13
+ /** The parent's text, flattened, at most two lines. For a file: "Type · title". */
14
+ snippet?: ReactNode;
15
+ };
16
+ /**
17
+ * The parent of a reply, or a forwarded message, as one card you can't mistake for the reply.
18
+ * A button that jumps to the message (`as="div"` for a card that isn't a target); a deleted
19
+ * parent is never a target.
20
+ */
21
+ export declare const QuoteCard: <T extends React.ElementType<any> = "button">(props: import("..").AsOutProps<T, QuoteCardProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -0,0 +1,6 @@
1
+ export declare const ReplyBar: string;
2
+ export declare const Glyph: string;
3
+ export declare const What: string;
4
+ export declare const Name: string;
5
+ export declare const Mention: string;
6
+ export declare const Close: string;
@@ -0,0 +1,12 @@
1
+ import React, { ReactNode } from "react";
2
+ export declare type ReplyBarProps = {
3
+ /** Who you're replying to. */
4
+ name: string;
5
+ /** Their message, one line. */
6
+ snippet?: ReactNode;
7
+ /** Whether the reply mentions (notifies) them. Leave out to hide the control. */
8
+ mention?: boolean;
9
+ onMentionChange?: (mention: boolean) => void;
10
+ onCancel?: () => void;
11
+ };
12
+ export declare const ReplyBar: <T extends React.ElementType<any> = "div">(props: import("..").AsOutProps<T, ReplyBarProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -0,0 +1,2 @@
1
+ export * from "./QuoteCard";
2
+ export * from "./ReplyBar";