@ag2/weave 0.12.0 → 0.14.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 +36 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/orb-background/OrbBackground.css.d.ts +3 -0
- package/dist/components/orb-background/OrbBackground.d.ts +7 -0
- package/dist/components/orb-background/index.d.ts +2 -0
- package/dist/components/orb-background/orbAppearance.d.ts +2 -0
- package/dist/components/orb-background/orbField.d.ts +1 -0
- package/dist/components/page/Page.d.ts +6 -0
- package/dist/components/page/roomNavCollapseStore.d.ts +7 -0
- package/dist/index.js +447 -59
- package/dist/index.js.map +1 -1
- package/dist/style.css +18 -3
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -4,6 +4,42 @@
|
|
|
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
|
+
|
|
28
|
+
## Ambient orb background
|
|
29
|
+
|
|
30
|
+
`OrbBackground` renders the Absorb / Calm / Aura field and is the default background
|
|
31
|
+
of `SplashScreen`. Place it inside an element with the exported `OrbBackgroundHost`
|
|
32
|
+
class so its decorative canvas sits behind content and is clipped at the surface edge.
|
|
33
|
+
The parent supplies its background colour through the normal theme tokens.
|
|
34
|
+
|
|
35
|
+
It follows the resolved `color.Background.Container` token, including nested and custom
|
|
36
|
+
themes. An optional `appearance="light" | "dark"` prop lets a framing host override the
|
|
37
|
+
colour intensity. Reduced motion renders a static field; hidden documents pause animation.
|
|
38
|
+
All animation frames, resize observers, and theme listeners are removed on unmount.
|
|
39
|
+
`Starfield` and `StarfieldHost` remain exported for existing consumers.
|
|
40
|
+
|
|
41
|
+
The field is adapted from [matty-morgs/octo-space](https://github.com/matty-morgs/octo-space/blob/7f5536888eaf0068200e1d339318ba2bc57a5e40/onboarding-aura/index.html).
|
|
42
|
+
|
|
7
43
|
<!-- original folds README follows -->
|
|
8
44
|
|
|
9
45
|
# Folds
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare type OrbBackgroundProps = {
|
|
2
|
+
className?: string;
|
|
3
|
+
/** Optional framing-host override; otherwise follows the active surface token. */
|
|
4
|
+
appearance?: "light" | "dark";
|
|
5
|
+
};
|
|
6
|
+
/** Calm, blurred orbs with absorb collisions. Place inside an OrbBackgroundHost surface. */
|
|
7
|
+
export declare const OrbBackground: ({ className, appearance }: OrbBackgroundProps) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startOrbField(element: HTMLCanvasElement): () => void;
|
|
@@ -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
|
+
};
|