@40rty/ams-ui 0.5.4 → 0.5.5

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.
@@ -4,10 +4,8 @@ export interface SpacefrontIslandProps {
4
4
  placeholder?: string;
5
5
  /** What the answer line says before the visitor has asked anything. */
6
6
  emptyText?: string;
7
- /** The answer line while a turn is in flight, before its prose streams. */
7
+ /** The activity line while a turn is in flight and the agent has said nothing more specific. */
8
8
  workingText?: string;
9
- /** The folded pill's text. */
10
- pillLabel?: string;
11
9
  /**
12
10
  * `'viewport'` (default): fixed to the bottom of the window, between
13
11
  * `--fourty-island-inset-left/right`. `'column'`: sticky to the bottom of
@@ -22,15 +20,20 @@ export interface SpacefrontIslandProps {
22
20
  }
23
21
  /**
24
22
  * The AMS island — the composer every 40rty spacefront is recognised by, for a
25
- * host that brings its own page: grip, latest answer (expands to the thread),
26
- * field, round send stamp, suggestion chips, a pill while the visitor scrolls
27
- * down. Its shape is fixed; its look is the host's, set through the
28
- * `--fourty-island-*` custom properties in `@40rty/ams-ui/island.css` (which
29
- * the host imports — this module has no CSS side effect). Reads only the
30
- * public sdk hooks, so it works inside any `<Spacefront>`.
23
+ * host that brings its own page. Its shape is the spacefront's own page
24
+ * composer: the agent's follow-up chips above ONE frosted bar that is always
25
+ * there to type in — attach, field, dictation, send — with the latest answer
26
+ * line on top of the field (it expands to the thread). While the agent works,
27
+ * the field gives way to what it is doing. It never folds away: the visitor's
28
+ * input is the one thing on the page that must stay in reach.
29
+ *
30
+ * Its look is the host's, set through the `--fourty-island-*` custom
31
+ * properties in `@40rty/ams-ui/island.css` (which the host imports — this
32
+ * module has no CSS side effect); unset, it is the spacefront's frosted bar.
33
+ * Reads only the public sdk hooks, so it works inside any `<Spacefront>`.
31
34
  *
32
35
  * Beside a `<SpacefrontThreadPanel>` it yields while the panel is open on
33
36
  * screen — one composer at a time — and `<SpacefrontPresence>` attaches above
34
37
  * its slab (`host-shell-store.ts`).
35
38
  */
36
- export declare function SpacefrontIsland({ placeholder, emptyText, workingText, pillLabel, container, stopKeyPropagation, }: SpacefrontIslandProps): React.ReactElement | null;
39
+ export declare function SpacefrontIsland({ placeholder, emptyText, workingText, container, stopKeyPropagation, }: SpacefrontIslandProps): React.ReactElement | null;
@@ -30,7 +30,7 @@ export { DefaultMobileShell, type DefaultMobileShellProps, } from './mobile/Defa
30
30
  export { MobileVoiceConsole, type MobileVoiceConsoleProps, } from './mobile/MobileVoiceConsole';
31
31
  export { MorphIsland, type MorphIslandProps, type MorphIslandHandle, } from './mobile/MorphIsland';
32
32
  export { VOICE_ISLAND_HEIGHT, ISLAND_BOTTOM_GAP, ISLAND_KEYBOARD_GAP, KEYBOARD_LIKELY_MIN_PX } from './mobile/island-metrics';
33
- export { useClaimHeroEntryPoint, useOnScreen } from './mobile/hero-entry-point';
33
+ export { useEntryPoint, useClaimEntryPoint, useOnScreen, useFocusWithin } from './mobile/entry-point';
34
34
  export { Spinner } from './Spinner';
35
35
  export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from './Button';
36
36
  export { Skeleton, type SkeletonProps } from './Skeleton';
@@ -54,7 +54,7 @@ export interface MorphIslandProps {
54
54
  /** Rise from below the floor on mount instead of simply being there — the
55
55
  * island ARRIVING after a brand hero handed the entry point back, rather
56
56
  * than the island that has been docked since first paint. See
57
- * `ISLAND_ENTER_SPRING` and `hero-entry-point.tsx`. */
57
+ * `ISLAND_ENTER_SPRING` and `entry-point.tsx`. */
58
58
  enterFromFloor?: boolean;
59
59
  /** True when the OPEN sheet should sit FLUSH on the screen bottom (native
60
60
  * bottom-sheet anchoring) instead of floating at `bottomOffset` — the rest
@@ -1,14 +1,18 @@
1
1
  import * as React from 'react';
2
2
  /**
3
- * WHO OWNS THE FIRST SCREEN — the brand's hero, or the platform's island.
3
+ * WHO OWNS THE ENTRY POINT — a brand component's own ask box, or the
4
+ * platform's (the phone's island, the shell's page composer).
4
5
  *
5
- * On a phone the island is normally the only way to talk to the space, so it
6
- * is docked on the floor from first paint. But a brand hero can carry its own
7
- * entry point — a prompt box sitting in the hero, where the visitor is already
8
- * looking, with the brand's own conversation starters under it (a brand's
9
- * `HeroPromptInput`). When it does, two surfaces are asking the same question
10
- * at once, and the one at the bottom of the screen is the one the visitor did
11
- * not come for.
6
+ * The platform's box is normally the way to talk to the space, so it is docked
7
+ * from first paint. But ANY brand component can carry its own ask box — a hero,
8
+ * a banner, a block mid-page — where the visitor is already looking, with the
9
+ * brand's own starters under it. When one is up, two surfaces are asking the
10
+ * same question at once, and the platform's is the one the visitor did not
11
+ * come for. Nothing here knows or cares which component it is: a component
12
+ * claims through `useEntryPoint`, and that claim is the whole contract.
13
+ *
14
+ * The rulebook below was written for the first claimant, the home hero; it
15
+ * holds for any.
12
16
  *
13
17
  * THE RULEBOOK this implements, in the product's own words:
14
18
  *
@@ -47,7 +51,7 @@ import * as React from 'react';
47
51
  * The flicker the latch guarded against is handled where it belongs — in
48
52
  * `useOnScreen`'s hysteresis below.
49
53
  *
50
- * (`useHeroEntryPointVisible` is still read by the console's fold gate. With
54
+ * (`useEntryPointClaimed` is still read by the console's fold gate. With
51
55
  * the island unmounted for the whole life of a claim that term can no longer
52
56
  * fire on its own; it is kept as the honest expression of "a live claim means
53
57
  * step aside", and because this contract has now been rewritten twice.)
@@ -66,9 +70,9 @@ import * as React from 'react';
66
70
  * appear underneath it).
67
71
  */
68
72
  /** `+1` on claim, `-1` on release. */
69
- export type HeroEntryClaim = (delta: 1 | -1) => void;
70
- export declare function HeroEntryPointProvider({ claim, claimed, children, }: {
71
- claim: HeroEntryClaim;
73
+ export type EntryPointClaim = (delta: 1 | -1) => void;
74
+ export declare function EntryPointProvider({ claim, claimed, children, }: {
75
+ claim: EntryPointClaim;
72
76
  claimed: boolean;
73
77
  children: React.ReactNode;
74
78
  }): React.ReactElement;
@@ -77,7 +81,7 @@ export declare function HeroEntryPointProvider({ claim, claimed, children, }: {
77
81
  * right now? False everywhere there is no provider (desktop, embed), so a
78
82
  * consumer can call it without knowing which shell it is in.
79
83
  */
80
- export declare function useHeroEntryPointVisible(): boolean;
84
+ export declare function useEntryPointClaimed(): boolean;
81
85
  /**
82
86
  * Called by a brand hero for as long as IT is the entry point — its own
83
87
  * prompt box showing and on screen. The phone's island and a shell's page
@@ -88,7 +92,7 @@ export declare function useHeroEntryPointVisible(): boolean;
88
92
  * release. Outside a shell there is no provider and this is a no-op, so a
89
93
  * component can call it unconditionally without knowing where it is mounted.
90
94
  */
91
- export declare function useClaimHeroEntryPoint(active: boolean): void;
95
+ export declare function useClaimEntryPoint(active: boolean): void;
92
96
  /**
93
97
  * Is this element actually ON SCREEN — with hysteresis, so a boundary does not
94
98
  * flicker.
@@ -110,3 +114,20 @@ export declare function useOnScreen(ref: React.RefObject<HTMLElement | null>, op
110
114
  enter?: number;
111
115
  exit?: number;
112
116
  }): boolean;
117
+ /**
118
+ * Is focus inside this element right now — the box the visitor is typing in.
119
+ */
120
+ export declare function useFocusWithin(ref: React.RefObject<HTMLElement | null>): boolean;
121
+ /**
122
+ * THE one call for ANY brand component with its own ask box — a hero, a
123
+ * banner, a block mid-page, anything: pass the box (or its field) and whether
124
+ * the component is showing it. While the box is showing AND either on screen
125
+ * or focused, it is the entry point, and the phone's island and the shell's
126
+ * page composer stand aside.
127
+ *
128
+ * Focus is its own reason. On a short screen the box can sit partly below the
129
+ * fold, under the visibility threshold, while the visitor is typing in it; a
130
+ * second box rising under the one they are using is the exact collision the
131
+ * claim exists to prevent.
132
+ */
133
+ export declare function useEntryPoint(ref: React.RefObject<HTMLElement | null>, showing: boolean): void;
@@ -58,7 +58,7 @@ export declare const ISLAND_BOTTOM_GAP = 16;
58
58
  export declare const ISLAND_BOTTOM_TRAVEL_MS = 240;
59
59
  /**
60
60
  * The island's ARRIVAL, when a brand hero owned the first screen and has just
61
- * handed it back (see `hero-entry-point.tsx`).
61
+ * handed it back (see `entry-point.tsx`).
62
62
  *
63
63
  * It rises from below the floor rather than appearing. The visitor has just
64
64
  * sent their first message from a box in the hero and their eyes are up there,
@@ -0,0 +1,15 @@
1
+ /** Which sides of a sideways scroller have content running past them. */
2
+ export type ScrollFade = 'none' | 'start' | 'end' | 'both';
3
+ /**
4
+ * Tracks a horizontal scroller's hidden overflow, so it can fade exactly the
5
+ * edges a chip runs past — never the side that is already at its end, where a
6
+ * fade would only dim a chip that is fully in view.
7
+ *
8
+ * A callback ref, because the scroller remounts whenever its set is replaced.
9
+ * Re-measured on scroll, on resize, and when children stream in (a new chip
10
+ * widens the content without resizing the scroller itself).
11
+ */
12
+ export declare function useScrollEdges(): {
13
+ ref: (el: HTMLElement | null) => void;
14
+ fade: ScrollFade;
15
+ };
package/package.json CHANGED
@@ -76,12 +76,12 @@
76
76
  "zod": "^3.23.0"
77
77
  },
78
78
  "peerDependencies": {
79
- "@40rty/ams-sdk": "0.5.4",
79
+ "@40rty/ams-sdk": "0.5.5",
80
80
  "lucide-react": ">=0.400.0",
81
81
  "react": ">=18.0.0",
82
82
  "react-dom": ">=18.0.0"
83
83
  },
84
- "version": "0.5.4",
84
+ "version": "0.5.5",
85
85
  "homepage": "https://docs.40rty.ai",
86
86
  "license": "UNLICENSED",
87
87
  "engines": {