@flemo/devtools 0.6.0 → 0.8.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
@@ -14,7 +14,7 @@ import { FlemoDevtools } from "@flemo/devtools/react";
14
14
 
15
15
  That is the whole wiring. Leave it in the tree and ship it: under the `production` export condition the same specifier resolves to a component that renders null and imports nothing, so the recorder, the panel and the readout never enter a production graph. There is no flag to remember and nothing to strip before a release.
16
16
 
17
- Props are `recorder`, `hud` (`true`), `panel` (`true`), `hudPosition` (`"top"`), `panelPosition` (`"bottom-left"`), `initialOpen` (`false`) and `buckets` (`["A", "B"]`). `react` is an optional peer dependency, needed only for this entry.
17
+ Props are `recorder`, `hud` (`true`), `panel` (`true`), `hudPosition` (`"bottom-right"`), `panelPosition` (`"bottom-left"`), `initialOpen` (`false`) and `buckets` (`["A", "B"]`). `react` is an optional peer dependency, needed only for this entry.
18
18
 
19
19
  Do not reach for `@flemo/devtools/force` to make the component appear in a production build. The specifier survives whatever guard is wrapped around it, so it puts the real panel back into a public chunk; that is a measured mistake, made twice on this project's own site.
20
20
 
@@ -38,7 +38,7 @@ Unless `installGlobal: false` or the name is already owned, the recorder install
38
38
  copy(JSON.stringify(window.flemo.report(), null, 2));
39
39
  ```
40
40
 
41
- Use `/playground?devtools=on` to enable the playground recorder and its surfaces. `flemo:devtools` persists in `sessionStorage`; `?devtools=off` disables it. Armed, the playground imports `@flemo/devtools/force`, and that is the part worth copying: a plain import of this package resolves to the inert production entry, so an instrument wired the ordinary way exists only in the builds whose numbers the judging protocol below says do not count. `attachFlightRecorder()` is idempotent while attached and returns an inert handle during SSR.
41
+ There is nothing to turn on. `<FlemoDevtools />` is rendered unconditionally and a production build resolves it to the inert entry, so the recorder and its surfaces exist in exactly the builds whose numbers the judging protocol below says do not count, and in no others. That is the part worth copying: an instrument wired the ordinary way cannot be left on by accident, and there is no flag whose state you have to remember. `flemo:devtools`, the query opt-in this used to need, is retired; a session still carrying it is reported as residue. `attachFlightRecorder()` is idempotent while attached and returns an inert handle during SSR.
42
42
 
43
43
  ## Production safety
44
44
 
@@ -73,7 +73,7 @@ Install as a devDependency, but do not rely on dependency fields for bundle excl
73
73
 
74
74
  ```ts
75
75
  import { attachDevtoolsHud } from "@flemo/devtools";
76
- const hud = attachDevtoolsHud({ position: "top" });
76
+ const hud = attachDevtoolsHud({ position: "bottom-right" });
77
77
  // hud.detach();
78
78
  ```
79
79
 
@@ -83,7 +83,9 @@ A phone has no console. The readout is one monospaced line, high contrast and re
83
83
  POP 412ms gap 33.4 drop 1 !2
84
84
  ```
85
85
 
86
- Tap it for the detail block (frames, motion, holds, shared elements, what drove the navigation, and the flight's anomalies); long-press to cycle the comparison bucket. Options are `recorder`, `position` (`"top"` or `"bottom"`), `initialExpanded` (`false`) and `buckets` (`["A", "B"]`).
86
+ Tap it for the detail block (frames, motion, holds, shared elements, what drove the navigation, and the flight's anomalies); long-press to cycle the comparison bucket. The pill beside it hides the readout down to itself and brings it back, and the choice is remembered for the session, because judging motion means getting the instruments off the glass without unmounting them. Hidden, it stops polling.
87
+
88
+ Options are `recorder`, `position` (a corner, `"bottom-right"` by default, or the centred `"top"` and `"bottom"` strips), `initialExpanded` (`false`), `initialHidden` (the session's last choice) and `buckets` (`["A", "B"]`).
87
89
 
88
90
  It obeys the same rules the panel does: it repaints only between flights, its stylesheet carries no transition and no keyframe, and its host is a zero-sized fixed element that cannot join a flight.
89
91
 
@@ -169,7 +171,7 @@ Read `verdict`, then `preconditions`, then each flight's `anomalies`, then `blin
169
171
  ## API
170
172
 
171
173
  - `attachFlightRecorder(options?)` returns `{ report(), mark(), detach() }`; options: `maxFlights` (50), `log` (`false`), `installGlobal` (`true`), `persist` (`true`).
172
- - `attachDevtoolsHud(options?)` returns `{ detach() }`; options: `recorder`, `position` (`"top"`), `initialExpanded` (`false`), `buckets`.
174
+ - `attachDevtoolsHud(options?)` returns `{ detach() }`; options: `recorder`, `position` (`"bottom-right"`), `initialExpanded` (`false`), `initialHidden`, `buckets`.
173
175
  - `attachDevtoolsPanel(options?)` returns `{ detach() }`; options: `recorder`, `initialOpen` (`false`), `position` (`"bottom-right"`), `buckets`.
174
176
  - Pure helpers: `deriveFlightAnomalies`, `deriveReportAnomalies`, `deriveOverrideWarnings`, `derivePreconditions`, `deriveVerdict`, `summariseBuckets`, `classifyDriver`, `computeFrameStats`, `parseTranslateX`, `kindFromStatus`.
175
177
  - Constants and registries: `BLIND_SPOTS`, `JUDGING_PROTOCOL`, `FLAG_REGISTRY`, `LONG_GAP_MS`, `STALL_MS`, `STUCK_STATUS_MS`, `REPORT_SCHEMA_VERSION`.
@@ -0,0 +1 @@
1
+ export {};
package/dist/hud.d.ts CHANGED
@@ -1,17 +1,29 @@
1
1
  import { FlightRecorderHandle } from './types';
2
+ /**
3
+ * Where the readout docks.
4
+ *
5
+ * A corner keeps it clear of the middle of the screen, which is where the
6
+ * motion being measured is. `"top"` and `"bottom"` are the centred strips this
7
+ * started as.
8
+ */
9
+ export type DevtoolsHudPosition = "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
2
10
  export interface DevtoolsHudOptions {
3
11
  /** Recorder to read. Defaults to this package's `window.flemo`, else its own. */
4
12
  recorder?: FlightRecorderHandle;
5
- /** Where the strip sits. Default "top". */
6
- position?: "top" | "bottom";
13
+ /** Where the strip sits. Default "bottom-right", opposite the panel's toggle. */
14
+ position?: DevtoolsHudPosition;
7
15
  /** Start expanded. Default false (the one-line summary). */
8
16
  initialExpanded?: boolean;
17
+ /** Start hidden, leaving only the control. Default false, or whatever the last session chose. */
18
+ initialHidden?: boolean;
9
19
  /** Labels the long-press cycles through. Default ["A", "B"]. */
10
20
  buckets?: string[];
11
21
  }
12
22
  export interface DevtoolsHudHandle {
13
23
  detach: () => void;
14
24
  }
25
+ /** Where the hidden/shown choice lives, so a reload does not undo it. */
26
+ export declare const HUD_HIDDEN_KEY = "flemo:devtools-hud-hidden";
15
27
  /**
16
28
  * Mount the on-device readout. Idempotent while mounted; inert without a DOM.
17
29
  */
package/dist/index.d.ts CHANGED
@@ -8,8 +8,10 @@ export { summariseBuckets } from './buckets';
8
8
  export { attachDevtoolsPanel } from './panel';
9
9
  export type { DevtoolsPanelHandle, DevtoolsPanelOptions } from './panel';
10
10
  export { attachDevtoolsHud } from './hud';
11
- export type { DevtoolsHudHandle, DevtoolsHudOptions } from './hud';
11
+ export type { DevtoolsHudHandle, DevtoolsHudOptions, DevtoolsHudPosition } from './hud';
12
12
  export { captureEnvironment, detectEngine, developmentHints, isEmulationSuspected, sampleRafCadence } from './environment';
13
+ export { attachSwipeProbe, SWIPE_PROBE_MS } from './swipeProbe';
14
+ export type { SwipeProbeHandle, SwipeProbeOptions, SwipeReleaseAudit, SwipeSample } from './swipeProbe';
13
15
  export { derivePreconditions } from './preconditions';
14
16
  export type { PreconditionInput } from './preconditions';
15
17
  export { deriveVerdict } from './verdict';