@fiestaboard/ui 2.1.0 → 2.1.1

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.
@@ -1,4 +1,61 @@
1
1
  import { type DeviceType } from "../../lib/board-dimensions";
2
+ /**
3
+ * Named flap cadences, in milliseconds per character step.
4
+ *
5
+ * Presets rather than a bare number because "how fast does the board flip" is a
6
+ * product decision with a handful of good answers, and the FiestaBoard app may
7
+ * expose it as a user setting — a name survives a settings screen, `92` does
8
+ * not. They are named for what they do on screen, with one exception:
9
+ * `hardware` is the only value actually derived from the device, so it is the
10
+ * only one that claims to be. Anything else goes through the `{ durationMs }`
11
+ * escape hatch.
12
+ */
13
+ export declare const FLAP_SPEED_PRESETS: {
14
+ /**
15
+ * 16ms — the hardware cadence (60 RPM × 62 flaps ≈ 16.1ms/flap). Roughly one
16
+ * frame per glyph at 60Hz: the cascade strobes and is unreadable until it
17
+ * settles. Offered because it is the honest hardware figure, not because it
18
+ * is a good default.
19
+ */
20
+ readonly hardware: 16;
21
+ /** 48ms — quicker than default; glyphs are still resolvable mid-cascade. */
22
+ readonly quick: 48;
23
+ /** 80ms — the default, and what FiestaBoard has always shipped. */
24
+ readonly standard: 80;
25
+ /** 130ms — a slow, deliberate flip for large or ambient displays. */
26
+ readonly relaxed: 130;
27
+ };
28
+ export type FlapSpeedPreset = keyof typeof FLAP_SPEED_PRESETS;
29
+ /** A named cadence, or an explicit per-step duration in milliseconds. */
30
+ export type FlapSpeed = FlapSpeedPreset | {
31
+ readonly durationMs: number;
32
+ };
33
+ /** Resolve a {@link FlapSpeed} to a whole number of milliseconds per step. */
34
+ export declare function resolveFlapSpeed(speed: FlapSpeed): number;
35
+ export interface FlapTiming {
36
+ /** Total duration of one character step. */
37
+ stepMs: number;
38
+ /** Top leaf falls over `[0, topMs)`. */
39
+ topMs: number;
40
+ /** Bottom leaf rises over `[bottomDelayMs, stepMs)`. */
41
+ bottomMs: number;
42
+ bottomDelayMs: number;
43
+ }
44
+ /**
45
+ * Split a step into its two leaf phases.
46
+ *
47
+ * The leaf that falls *is* the leaf that lands, so exactly one leaf may be in
48
+ * motion at any instant: the top runs `[0, topMs)`, the bottom runs
49
+ * `[topMs, stepMs)`, and the two tile the step exactly. Before issue #177 the
50
+ * bottom leaf started at 0.35 × step while the top ran for 0.55 × step, so both
51
+ * leaves moved for 20% of every step and the tile visibly split open at the
52
+ * midpoint — something a physical module cannot do. Handing off at the instant
53
+ * the top leaf lands is the whole fix.
54
+ *
55
+ * `bottomMs` is `stepMs - topMs` rather than a second rounding, so odd step
56
+ * durations still tile exactly instead of leaving a 1ms gap or overlap.
57
+ */
58
+ export declare function deriveFlapTiming(stepMs: number): FlapTiming;
2
59
  export interface BoardDisplayProps {
3
60
  message: string | null;
4
61
  isLoading?: boolean;
@@ -22,9 +79,15 @@ export interface BoardDisplayProps {
22
79
  * draw surface's hit-testing to reject them one by one. */
23
80
  emitCellMetadata?: boolean;
24
81
  /** Run the split-flap animation. In the app this is wired to the user's
25
- * board-animation setting and reduce-motion preference; when false, tiles
26
- * snap straight to their target characters. */
82
+ * board-animation setting; when false, tiles snap straight to their target
83
+ * characters. `prefers-reduced-motion: reduce` forces the same behaviour
84
+ * regardless of this prop — see the reduced-motion note in BoardDisplay. */
27
85
  animationsEnabled?: boolean;
86
+ /** How fast a tile advances one character: a named cadence
87
+ * (`"standard"` — the default 80ms — `"quick"`, `"relaxed"`, or the
88
+ * hardware's own `"hardware"`), or `{ durationMs }` for anything else.
89
+ * Drives the leaf animations and the loading cadence together. */
90
+ flapSpeed?: FlapSpeed;
28
91
  /** Accessible label while `isLoading` is true. */
29
92
  loadingLabel?: string;
30
93
  /** Accessible label when the board has no message. */
@@ -32,4 +95,4 @@ export interface BoardDisplayProps {
32
95
  /** Builds the accessible label for a shown message (color markup already stripped). */
33
96
  messageLabel?: (message: string) => string;
34
97
  }
35
- export declare const BoardDisplay: import("react").MemoExoticComponent<({ message, isLoading, size, className, boardType, deviceType, isStatic, notesWide, notesTall, emitCellMetadata, animationsEnabled, loadingLabel, emptyLabel, messageLabel, }: BoardDisplayProps) => import("react").JSX.Element>;
98
+ export declare const BoardDisplay: import("react").MemoExoticComponent<({ message, isLoading, size, className, boardType, deviceType, isStatic, notesWide, notesTall, emitCellMetadata, animationsEnabled, flapSpeed, loadingLabel, emptyLabel, messageLabel, }: BoardDisplayProps) => import("react").JSX.Element>;