@bridge-ds/toolbar 0.1.0 → 0.3.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
@@ -6,8 +6,13 @@ The Bridge toolbar for a product built with the Bridge design system. Bridge Stu
6
6
 
7
7
  - **Code changes** (an exploration in the product's repository, a feature branch): Before is the product in
8
8
  production, After is the branch's preview. Flipping keeps the screen and the scroll position.
9
- - **Token changes** of the design system: the live tokens swap in without a reload, and Show what changed outlines
10
- every surface that differs.
9
+ - **Token changes** of the design system: the live tokens swap in without a reload. As soon as the toolbar is open,
10
+ every surface that differs is outlined and counted in the bar ("13 changed", then "2 / 13 changed"). Previous and Next scroll to each one
11
+ in reading order and outline it stronger than the others; Isolate dims the rest of the page (Esc turns it off). The
12
+ outlines, the position and Isolate hold when you flip to Live product, since both sides are the same page.
13
+
14
+ Keyboard: **B** flips Live product and This change on the same screen and scroll position, **C** turns the outlines
15
+ off and on, **Esc** ends Isolate. None of them fires while you type in a field.
11
16
 
12
17
  Without `?bridge=` (or the session that remembers it) it renders nothing and loads nothing: the toolbar and its styles
13
18
  are one lazy chunk.
@@ -47,5 +52,10 @@ live tokens). `bridge connect` prints this line with your values.
47
52
  | `scope` | A hook returning `{ theme, brand, density, shop, set }` when your app keeps theme and shop in state. Default: the `data-theme`, `data-brand` and `data-density` attributes `ThemeProvider asRoot` puts on `<html>`. |
48
53
  | `shops` | `{ id, name, brand }[]` of a multi-brand product, for the screens list and "Switch to <shop>". |
49
54
  | `together` | A loader of the latest library's token files (`togetherBase` from `@bridge-ds/toolbar/together`), so Studio's "Try them together" runs on your production. |
55
+ | `proxy` | Bridge's origin, whose read proxy serves the toolbar's GitHub reads. Default `https://bridge.floriangouloubi.com`; `null` reads GitHub directly. |
50
56
 
51
- Reads are anonymous (public repositories): at most a few GitHub API reads per change and session.
57
+ Reads go through Bridge's read proxy (`<proxy>/api/contribute?repo=<ds>&gh=<path>`: allow-listed, cached, read-only
58
+ on the server), so visitors never meet GitHub's limit of 60 anonymous reads an hour. Bridge serves a public design
59
+ system and the public product repositories its `bridge.config.json` lists, to the origins that config names
60
+ (`production` and `preview` of each product, and localhost). When Bridge refuses or cannot be reached, the toolbar
61
+ reads GitHub directly (anonymous, public repositories): at most a few API reads per change and session.
@@ -10,6 +10,12 @@ export interface BridgeToolbarProps {
10
10
  studio?: string | null;
11
11
  production?: string | null;
12
12
  preview?: string | null;
13
+ /**
14
+ * Bridge's origin, whose read proxy serves the toolbar's GitHub reads (no limit of 60 an hour per visitor). Default
15
+ * production Bridge (https://bridge.floriangouloubi.com); null reads GitHub directly. GitHub directly anyway when
16
+ * Bridge refuses or cannot be reached.
17
+ */
18
+ proxy?: string | null;
13
19
  /** The deploy environment ("production", "preview"), when the host tells it at build time (VERCEL_ENV). */
14
20
  deployEnv?: string | null;
15
21
  /** Every fact at once, read at build time: no config read at run time (the Admin demo passes it). */
@@ -0,0 +1,18 @@
1
+ export interface ChangeNavProps {
2
+ /** "Show what changed", "13 changed", "2 / 13 changed", "Nothing changed here". */
3
+ countText: string;
4
+ /** The count's tooltip: what changed and the C shortcut. */
5
+ tip: string;
6
+ outlinesOn: boolean;
7
+ /** The change shows nothing in this theme or brand: the count is muted. */
8
+ disabled: boolean;
9
+ /** Changes to step through, null while outlines are off or measuring. */
10
+ total: number | null;
11
+ isolate: boolean;
12
+ /** Said to screen readers on each step: "Changed element 2 of 13: Save bar". */
13
+ announce: string;
14
+ onToggle: () => void;
15
+ onStep: (delta: 1 | -1) => void;
16
+ onIsolate: (on: boolean) => void;
17
+ }
18
+ export declare function ChangeNav({ countText, tip, outlinesOn, disabled, total, isolate, announce, onToggle, onStep, onIsolate }: ChangeNavProps): import("react/jsx-runtime").JSX.Element;
@@ -2,19 +2,24 @@ import { type ReactNode } from 'react';
2
2
  import type { Theme } from '@bridge-ds/react';
3
3
  import { type ChangedElement } from './outline';
4
4
  import type { Rect } from './session';
5
+ import { type Box as TipBox } from './navigate';
5
6
  export interface Shown {
6
7
  /** Visible surfaces, in order. */
7
8
  count: number;
8
9
  /** Boxes of the visible surfaces that are not page-sized: the toolbar keeps clear of them. */
9
10
  obstacles: Rect[];
10
11
  }
11
- export declare function ChangeOutlines({ surfaces, theme, tip, onShown, emphasis, flash, }: {
12
+ export declare function ChangeOutlines({ surfaces, theme, tip, onShown, emphasis, flash, isolate, bar, }: {
12
13
  surfaces: ChangedElement[];
13
14
  theme: Theme;
14
15
  /** The surface whose list row is hovered, focused or activated: chip and stronger outline. */
15
16
  emphasis: number | null;
16
17
  /** Show every chip (the moment outlines turn on). */
17
18
  flash: boolean;
19
+ /** Dim everything but the changed surfaces. */
20
+ isolate?: boolean;
21
+ /** Where the toolbar is: the before and after tooltip never covers it. */
22
+ bar?: () => TipBox | null;
18
23
  /** Tooltip content for a surface: its role, token and before and after. */
19
24
  tip: (s: ChangedElement) => ReactNode;
20
25
  onShown: (shown: Shown) => void;