@flemo/devtools 0.3.0 → 0.5.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.
@@ -0,0 +1,53 @@
1
+ import { MotionProgress } from './types';
2
+ /** Driver evidence gathered by the rAF sampler during a flight. */
3
+ export interface DriverEvidence {
4
+ /** A running CSSAnimation named flemo-* was observed on a participant. */
5
+ compiledAnimation: boolean;
6
+ /** A participant carried inline `animation` suppression. */
7
+ inlineSuppression: boolean;
8
+ /** Inline transform/opacity advanced between sampled frames. */
9
+ inlineAdvance: boolean;
10
+ }
11
+ /** Everything the frame probe accumulates for one flight. */
12
+ export interface FrameProbeState {
13
+ /** Frame gaps while any participant still carried an active anim-hold. */
14
+ heldGaps: number[];
15
+ /** Frame gaps after every hold released (the visible-motion phase). */
16
+ releasedGaps: number[];
17
+ lastFrameAt: number | null;
18
+ evidence: DriverEvidence;
19
+ lastPose: Map<Element, string>;
20
+ /** Cached compiled animations, so the clock read never re-queries per frame. */
21
+ clocks: Map<Element, Animation>;
22
+ lastClock: Map<Element, number>;
23
+ releasedFrames: number;
24
+ stalledFrames: number;
25
+ tailFrames: number;
26
+ stallRunMs: number;
27
+ longestStallMs: number;
28
+ pausedAfterRelease: boolean;
29
+ holdReassertedAtMs: number | null;
30
+ }
31
+ export declare const createFrameProbeState: () => FrameProbeState;
32
+ /**
33
+ * A hold is active while ANY participating element still carries an active
34
+ * `data-flemo-anim-hold` value; the flight is "released" once every one of
35
+ * them reads "false" (or drops the attribute). The engine deliberately absorbs
36
+ * heavy commits INTO the hold — the screen is posed, not moving — so gaps and
37
+ * long tasks are segmented on this boundary.
38
+ */
39
+ export declare const holdActive: (elements: readonly Element[]) => boolean;
40
+ /**
41
+ * Did this frame MOVE? Read from the cheapest honest source per tier: a
42
+ * compiled flight's own animation clock (getAnimations, no style flush) and an
43
+ * inline-driven flight's pose (already in the style attribute). A frame where
44
+ * neither moved is a stall — the signature that timing metrics miss.
45
+ */
46
+ export declare const sampleProgress: (state: FrameProbeState, elements: readonly Element[], frameGapMs: number) => void;
47
+ export declare const sampleDriverEvidence: (state: FrameProbeState, elements: readonly Element[]) => void;
48
+ /**
49
+ * Everything the frame probe knows about the motion. `firstAnimationAtMs` is
50
+ * deliberately NOT here: it comes from the browser's own `animationstart`
51
+ * event, which is a tripwire, and the orchestrator joins the two.
52
+ */
53
+ export declare const motionProgress: (state: FrameProbeState) => Omit<MotionProgress, "firstAnimationAtMs">;
package/dist/hud.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { FlightRecorderHandle } from './types';
2
+ export interface DevtoolsHudOptions {
3
+ /** Recorder to read. Defaults to this package's `window.flemo`, else its own. */
4
+ recorder?: FlightRecorderHandle;
5
+ /** Where the strip sits. Default "top". */
6
+ position?: "top" | "bottom";
7
+ /** Start expanded. Default false (the one-line summary). */
8
+ initialExpanded?: boolean;
9
+ /** Labels the long-press cycles through. Default ["A", "B"]. */
10
+ buckets?: string[];
11
+ }
12
+ export interface DevtoolsHudHandle {
13
+ detach: () => void;
14
+ }
15
+ /**
16
+ * Mount the on-device readout. Idempotent while mounted; inert without a DOM.
17
+ */
18
+ export declare const attachDevtoolsHud: (options?: DevtoolsHudOptions) => DevtoolsHudHandle;
@@ -0,0 +1,23 @@
1
+ import { ImageActivity } from './types';
2
+ export interface ImageProbeState {
3
+ /** Images being tracked for this flight: loading at t0, plus arrivals. */
4
+ tracked: Set<HTMLImageElement>;
5
+ loadingAtStart: number;
6
+ addedDuringFlight: number;
7
+ held: Set<Element>;
8
+ }
9
+ export declare const createImageProbeState: (screens: readonly Element[]) => ImageProbeState;
10
+ /**
11
+ * Images that arrive DURING the flight — a data commit landing mid-navigation,
12
+ * which is the case core's image hold watches for with its own observer.
13
+ * Without this the probe would only ever see the screens as they looked at t0.
14
+ */
15
+ export declare const trackAddedImages: (state: ImageProbeState, elements: readonly Element[], added: NodeList) => void;
16
+ /** One query per flight, on the first moving frame: which images the engine parked. */
17
+ export declare const snapshotHeldImages: (state: ImageProbeState, elements: readonly Element[]) => void;
18
+ /**
19
+ * Per-image accounting. Counting completions and holds separately and
20
+ * subtracting would cancel a held-but-still-loading image against an unheld
21
+ * completed one, hiding the exact regression this exists to catch.
22
+ */
23
+ export declare const imageActivity: (state: ImageProbeState) => ImageActivity;
package/dist/index.d.ts CHANGED
@@ -1,13 +1,22 @@
1
1
  export { attachFlightRecorder, REPORT_SCHEMA_VERSION } from './recorder';
2
2
  export type { FlemoGlobal } from './recorder';
3
- export { deriveFlightAnomalies, deriveReportAnomalies, LONG_GAP_MS, STUCK_STATUS_MS, OPENING_WINDOW_LEAD_MS, OPENING_WINDOW_TAIL_MS, MID_FLIGHT_TASK_MS } from './anomalies';
3
+ export { deriveFlightAnomalies, deriveReportAnomalies, LONG_GAP_MS, STALL_MS, STUCK_STATUS_MS, OPENING_WINDOW_LEAD_MS, OPENING_WINDOW_TAIL_MS, MID_FLIGHT_TASK_MS } from './anomalies';
4
4
  export type { FlightAnomalyInput, ReportAnomalyInput } from './anomalies';
5
5
  export { BLIND_SPOTS } from './blindSpots';
6
+ export { JUDGING_PROTOCOL } from './judging';
7
+ export { summariseBuckets } from './buckets';
6
8
  export { attachDevtoolsPanel } from './panel';
7
9
  export type { DevtoolsPanelHandle, DevtoolsPanelOptions } from './panel';
8
- export { captureEnvironment, detectEngine, isEmulationSuspected, sampleRafCadence } from './environment';
10
+ export { attachDevtoolsHud } from './hud';
11
+ export type { DevtoolsHudHandle, DevtoolsHudOptions } from './hud';
12
+ export { captureEnvironment, detectEngine, developmentHints, isEmulationSuspected, sampleRafCadence } from './environment';
13
+ export { derivePreconditions } from './preconditions';
14
+ export type { PreconditionInput } from './preconditions';
15
+ export { deriveVerdict } from './verdict';
16
+ export type { VerdictInput } from './verdict';
17
+ export { clearTrace, loadTrace, saveTrace, TRACE_KEY } from './persistence';
9
18
  export { CORE_FLAGS, deriveOverrideWarnings, DEVTOOLS_OWNED_FLAGS, FLAG_REGISTRY, PANEL_HEIGHT_KEY, RETIRED_FLAGS, RETIRED_MARKER, snapshotOverrides } from './overrides';
10
19
  export type { FlagClass, FlagDescriptor, RetiredFlag } from './overrides';
11
- export { classifyDriver, computeFrameStats, computePhaseStats, computePlayerGapStats, kindFromStatus, parseTranslateX } from './sampling';
12
- export type { DriverEvidence } from './sampling';
13
- export type { EnvironmentFingerprint, FlemoReport, FlightDriver, FlightHolds, FlightKind, FlightParticipants, FlightRecord, FlightRecorderHandle, FlightRecorderOptions, FlightTimestamp, FramePhaseStats, FrameSampleStats, LandingAudit, LongTaskSpan, ObservationCapabilities, OverridesSection, PlayerGapStats, UaBrand } from './types';
20
+ export { classifyDriver, computeFrameStats, computePhaseStats, kindFromStatus, parseTranslateX } from './sampling';
21
+ export type { DriverEvidence } from './frameProbe';
22
+ export type { BucketSummary, EnvironmentFingerprint, FlemoReport, FlightDriver, FlightHolds, FlightKind, FlightParticipants, FlightRecord, FlightRecorderHandle, FlightRecorderOptions, FlightTimestamp, FramePhaseStats, FrameSampleStats, ImageActivity, InputEvidence, LandingAudit, LongTaskSpan, MorphActivity, MotionProgress, ObservationCapabilities, OverridesSection, Precondition, PreconditionStatus, PreviousSession, TripwireHit, UaBrand } from './types';