@loadmap/react 0.40.0 → 0.42.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
@@ -80,6 +80,20 @@ only. Inside a card of its own, `.card > .lm { --lm-pad: 0; --lm-root-bg: transp
80
80
  background (full screen keeps both); in a grid or a flex row, give it `min-width: 0`, since it sizes the diagram to
81
81
  its width.
82
82
 
83
+ `<Loadmap>` draws everything in one box, the canvas: the title, the scenarios and **▶ Story** in a bar over the
84
+ diagram, the load and the verdict in one line under it, and five panels that open one at a time from their tabs:
85
+ Limits (with the verdict's sentence), Design, Headroom (with the scenarios compared), Live and Assumes. The box has a
86
+ fixed height, `clamp(420px, 70dvh, 760px)` by default: give it yours with `.lm-canvas { height: 560px }`, or `fill` the
87
+ container. The canvas arranges itself by its own size:
88
+ the tabs are a rail from 900 px wide, a row when narrower and a menu under 420 px high; the open panel stands beside
89
+ the diagram, or is a sheet under 520 px. Nothing the reader does changes the box's height or lays the diagram out
90
+ again.
91
+
92
+ `panels={['limits', 'live']}` offers only those tabs (`LOADMAP_PANELS` lists the five: `limits`, `controls`,
93
+ `headroom`, `live`, `assumptions`; `[]` for none). `open`, `defaultOpen` and `onOpen` choose and follow the open one,
94
+ and `headroom={false}` or `compare={false}` leaves the chart or the scenarios compared out of Headroom. A
95
+ `Canvas.Panel` child of `<Loadmap>` is a panel of your own, its tab before the others.
96
+
83
97
  A `.loadmap` text draws with `<LoadmapSource source={text} name="shop.loadmap" />` from `@loadmap/react/source`: it
84
98
  compiles when the text changes, passes on the options the definition declares (your props win), and while the text
85
99
  does not compile shows its diagnostics as `loadmap check` prints them. An edit keeps the values the board shows (the
@@ -90,37 +104,42 @@ A scenario, a story step or a control that changes the structure (more pods, mor
90
104
  what stays moves to its new place, what is new fades in. `transition={1.2}` sets the seconds it takes (default 0.8);
91
105
  0 cuts, and so does reduced motion. The load never moves it.
92
106
 
93
- The scenarios and the load share one bar over the diagram, so the reader moves the load and watches what it does. It
94
- stays in view while the page scrolls; a page with a fixed header of its own sets `--lm-sticky-top` (its height) on an
95
- ancestor of the root. On a phone the bar sits under the diagram, in thumb reach. Its track is coloured by what the load
96
- does (under the target, past it, past capacity, a ± range as a blend) and runs on a log scale when the load spans ten
97
- times or more. Under it, a mark for today, each preset that sets the load, the target and where it runs out: a click
98
- takes it. ← → move a step, Page Up and Page Down to the next mark. Picking a scenario keeps the load.
99
-
100
- The diagram's **Full screen** fits the screen without scrolling: the diagram as wide as it, the verdict in one line
101
- under it, and the panels of the page side by side in a compact form (a phone shows one at a time, under tabs, and
102
- pans the diagram in its own box). Each compact panel opens whole over the diagram. `fullScreen={['verdict', 'live',
103
- 'controls']}` keeps only those (`LOADMAP_PANELS` lists them all: `verdict`, `live`, `limits`, `controls`, `headroom`,
104
- `compare`, `assumptions`; `controls` is the design, the load being in the bar). A switch beside Close, or the F key,
105
- turns full screen into **focus**: the bar, the diagram, the story and the verdict, if it is listed.
106
- `fullScreenMode="focus"` opens full screen there
107
- (default `'panels'`). The story bar's Play tells the story on the diagram: the whole diagram, a close-up on what each
108
- step changes, the change, and the whole diagram again for the step's `seconds`, a short title on the board (the step's
109
- `title`, or what it changes). The component that runs out first wears a ring that breathes while the story plays and
110
- once it is past the target. With reduced motion the camera cuts and the ring holds still. `ref.playStory()` plays it
111
- on the engine's clock, which `step()` advances.
112
-
113
- `zoom` lets the reader pan and zoom the diagram: a drag pans (a press that hardly moves still clicks a box), a pinch
114
- or the wheel with Ctrl or ⌘ zooms about the pointer, the keys + − 0 and the arrows work on the focused board, and the
115
- buttons on it go − · zoom · + · Fit. A page that scrolls keeps its plain wheel. `<Diagram lm={lm} canvas={{ left: 420
116
- }} />` fills its container as a canvas the wheel alone zooms; the insets are what the page floats over it, and Fit
117
- frames the diagram in the rest. Pictures and recordings always show the whole diagram, whatever the reader's view.
118
-
119
- `useLoadmap` with `LoadmapRoot`, `Diagram`, `Verdict`, `Limits`, `Controls` and the others builds a page of your own
120
- layout from the same pieces: `LoadBar` is the bar, `Scenarios` and `LoadRange` its two halves, and
121
- `<Controls load={false}>` leaves the load to it. The diagram's Full screen takes the whole root: inside a
122
- `<div className="lm-side">` after the `Diagram`, your pieces become a box below it that scrolls on its own; a title,
123
- the `LoadBar` (or `Scenarios`) and the `Story` stay above the diagram, and the rest waits outside. The controller has the state: `lm.fullScreen`,
124
- `lm.toggleFullScreen()`, `lm.fullScreenMode`, `lm.storyPlaying`, `lm.cue` (what the board says about the step played).
107
+ The load is under the diagram, in view whatever panel is open, so the reader moves it and watches what it does. Its
108
+ track is coloured by what the load does (under the target, past it, past capacity, a ± range as a blend) and runs on
109
+ a log scale when the load spans ten times or more. Under it, a mark for today, each preset that sets the load, the
110
+ target and where it runs out: a click takes it. ← → move a step, Page Up and Page Down to the next mark. Picking a
111
+ scenario keeps the load.
112
+
113
+ The bar's **Full screen** button shows the same canvas at the screen's size; from 1280 px wide one panel stays open
114
+ beside the diagram. **Panels** beside Close, or the F key, switches the tabs and the panel off and on:
115
+ `chrome="least"` opens full screen with the diagram, the load and the verdict alone. `fill` makes the root fill its
116
+ container for good, with no Full screen button, and `scrolls` leaves the plain wheel and one finger to a page that
117
+ scrolls around it. `fullScreen` and `fullScreenMode` are the names `panels` and `chrome` had before: they still work,
118
+ and say so in the console.
119
+
120
+ **▶ Story** puts the story over the bar: its text, Play, back and next. Play tells it on the diagram: the whole
121
+ diagram, a close-up on what each step changes, the change, and the whole diagram again for the step's `seconds`, a
122
+ short title on the board (the step's `title`, or what it changes). The component that runs out first wears a ring
123
+ that breathes while the story plays and once it is past the target. With reduced motion the camera cuts and the ring
124
+ holds still. `ref.playStory()` plays it on the engine's clock, which `step()` advances.
125
+
126
+ The reader pans and zooms the diagram: a drag pans (a press that hardly moves still clicks a box), two fingers or the
127
+ wheel with Ctrl or ⌘ zoom about the pointer, the keys + − 0 and the arrows work on the focused board, and the buttons
128
+ on it go − · zoom · + · Fit. The page keeps its plain wheel and one finger; in full screen they are the diagram's.
129
+ `zoom` is still taken and no longer needed. Pictures and recordings always show the whole diagram, whatever the
130
+ reader's view.
131
+
132
+ A layout of your own starts with `useLoadmap` and `LoadmapRoot`, and goes one of two ways. `Canvas` is the same box
133
+ with your parts in it: `Canvas.Bar`, `Canvas.Console` and a `Canvas.Panel` for each tab, with `useCanvasSize` and
134
+ `useCanvasPanels` for a part that folds by the canvas's size or opens a panel. Or a document of the parts, every
135
+ panel on the page at once: `Diagram`, `Story`, `Verdict`, `Limits`, `Controls` and the others, with `LoadBar` for the
136
+ scenarios and the load in one bar that stays in view (`--lm-sticky-top` puts it under a fixed header; `Scenarios` and
137
+ `LoadRange` are its two halves, and `<Controls load={false}>` leaves the load to it). There the diagram has its own
138
+ Full screen, which takes the whole root: inside a `<div className="lm-side">` after the `Diagram`, your pieces become
139
+ a box below it that scrolls on its own; a title, the `LoadBar` and the `Story` stay above the diagram, and the rest
140
+ waits outside. `useLoadmap(model, view, { zoom: true })` lets the reader pan and zoom that diagram, and
141
+ `<Diagram lm={lm} canvas={{ left: 420 }} />` fills its container as a canvas; the insets are what the page floats
142
+ over it. The controller has the state: `lm.fullScreen`, `lm.toggleFullScreen()`, `lm.fullScreenMode`,
143
+ `lm.storyPlaying`, `lm.cue` (what the board says about the step played).
125
144
 
126
145
  Docs, live examples and the editor: https://jaim3r0jas.github.io/loadmap/ · MIT