@algorisys/tinyfly 0.122.0 → 0.123.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.
@@ -22,8 +22,14 @@ import type { CharacterJoints } from '../character';
22
22
  * at the knee, sleeves to the wrist) and a `fedora` (a brim, a pinched crown
23
23
  * and a band). Big dark aviator `shades` are `face.shades` (see face.ts).
24
24
  *
25
- * Painter order: the back arm, the legs and the neck, the body (and the
26
- * coat), then the near arm and the head (and the fedora). Plain tube legs and
25
+ * Household clothes: a `skirt` (a sari or long skirt to the ankle, or a
26
+ * kurta's hem part way down the legs with `length`) that follows the legs,
27
+ * so it walks and sits; a `drape` (a pallu or dupatta from one shoulder
28
+ * across the chest to the hip) and `bangles` (a few rings on each wrist).
29
+ *
30
+ * Painter order: the back arm, the legs and the neck (and the skirt over
31
+ * both legs), the body (with its drape, and the coat), then the near arm and
32
+ * the head (and the fedora). Plain tube legs and
27
33
  * neck join the body without a seam, so they come after it.
28
34
  */
29
35
  export interface BeanOptions {
@@ -55,6 +61,20 @@ export interface BeanOptions {
55
61
  fedora?: string | null;
56
62
  /** Big dark aviator shades in place of the eyes, the brows still showing: sets `face.shades` (default false) */
57
63
  shades?: boolean;
64
+ /**
65
+ * A skirt over both legs: a colour (a sari or long skirt, to the ankle), or
66
+ * `{ color, length }` with `length` 0.1..1 of the way from the hips to the
67
+ * ankles (about 0.45 for a kurta's hem). It follows the legs: it flares
68
+ * standing and walking, and lies along the thighs seated (default none)
69
+ */
70
+ skirt?: string | {
71
+ color: string;
72
+ length?: number;
73
+ } | null;
74
+ /** A pallu or dupatta in this colour, from the near shoulder across the chest to the hip (default none) */
75
+ drape?: string | null;
76
+ /** Bangles in this colour, a few rings on each wrist (default none) */
77
+ bangles?: string | null;
58
78
  }
59
79
  export interface Bean {
60
80
  limbs: 'tube' | 'line';
@@ -70,6 +90,12 @@ export interface Bean {
70
90
  halo: string | null;
71
91
  coat: string | null;
72
92
  fedora: string | null;
93
+ skirt: {
94
+ color: string;
95
+ length: number;
96
+ } | null;
97
+ drape: string | null;
98
+ bangles: string | null;
73
99
  }
74
100
  /** Every bean option spelled out (plain data). */
75
101
  export declare function resolveBean(options?: BeanOptions): Bean;
@@ -145,6 +171,15 @@ export interface BeanHead {
145
171
  * tilting with the head and sliding a little with `head.turn`.
146
172
  */
147
173
  export declare function drawBeanFedora(ctx: CanvasRenderingContext2D, head: BeanHead, color: string, ink: string, outline: number, headTurn?: number): void;
174
+ /** A point `f` (0 hip … 1 ankle) along a leg's hip → knee → ankle path, by length. */
175
+ export declare function beanAlongLeg(joints: CharacterJoints, side: 'left' | 'right', f: number): Point;
176
+ /**
177
+ * Whether a bean stands (the knees well below the hips) rather than sits:
178
+ * standing, the skirt is one flared shape; seated, it lies along the thighs.
179
+ */
180
+ export declare function beanStanding(joints: CharacterJoints): boolean;
181
+ /** Where a bean's bangles sit: rings across the forearm at these fractions from the elbow to the wrist. */
182
+ export declare const BEAN_BANGLE_STOPS: readonly [0.7, 0.78, 0.86];
148
183
  export interface BeanDrawOptions {
149
184
  ink: string;
150
185
  /** The hands: `mitten` drawn here; others by the caller */
@@ -107,6 +107,17 @@ export interface Capabilities {
107
107
  /** `meetHands(kind, a, b)` */
108
108
  handMeetings: string[];
109
109
  };
110
+ /** The noir / detective kit: atmosphere, detective overlays and the case board (canvas drawing functions) */
111
+ noir: {
112
+ atmosphere: Record<string, string>;
113
+ overlays: Record<string, string>;
114
+ caseBoard: Record<string, string>;
115
+ cardKinds: readonly string[];
116
+ markKinds: Record<string, string>;
117
+ card: string;
118
+ string: string;
119
+ mark: string;
120
+ };
110
121
  codePanel: {
111
122
  languages: readonly string[];
112
123
  removeStyles: readonly string[];
@@ -556,6 +556,27 @@ export declare const BEAN_CAST: {
556
556
  };
557
557
  };
558
558
  };
559
+ beanSari: {
560
+ label: string;
561
+ group: "bean";
562
+ scale: number;
563
+ options: {
564
+ figure: "bean";
565
+ hair: {
566
+ style: "lowBun";
567
+ color: string;
568
+ };
569
+ bean: {
570
+ torso: number;
571
+ shirt: string;
572
+ sleeves: "short";
573
+ skirt: string;
574
+ drape: string;
575
+ bangles: string;
576
+ shoes: string;
577
+ };
578
+ };
579
+ };
559
580
  };
560
581
  export type BeanCastName = keyof typeof BEAN_CAST;
561
582
  export declare const CHARACTER_CAST: {
@@ -656,6 +677,27 @@ export declare const CHARACTER_CAST: {
656
677
  };
657
678
  };
658
679
  };
680
+ beanSari: {
681
+ label: string;
682
+ group: "bean";
683
+ scale: number;
684
+ options: {
685
+ figure: "bean";
686
+ hair: {
687
+ style: "lowBun";
688
+ color: string;
689
+ };
690
+ bean: {
691
+ torso: number;
692
+ shirt: string;
693
+ sleeves: "short";
694
+ skirt: string;
695
+ drape: string;
696
+ bangles: string;
697
+ shoes: string;
698
+ };
699
+ };
700
+ };
659
701
  mangaYoungMan: {
660
702
  label: string;
661
703
  group: "manga";
@@ -34,7 +34,7 @@ export { organicBodyContours, organicCenterLine, type OrganicBodyContours, type
34
34
  export { BODY_SHAPES, bodyShapeProfiles, measuredHipWidth, resolveMeasurements, type BodyMeasurements, type BodyShapeName, type BodyShapeProfiles } from './body/body-shape';
35
35
  export { humanPlan, humanPose, mirrorHumanPose, humanFieldLabel, HUMAN_REST, HUMAN_POSES, HUMAN_EXPRESSIONS, HUMAN_BUILDS, FOOT_SHAPES, type FootShape, type HumanBuild, type HumanBuildName, type HumanPoseName, type HumanExpressionName } from './species/human';
36
36
  export { CHARACTER_CAST, ANIME_CAST, MANGA_CAST, BEAN_CAST, castMember, type CastMember, type CastName, type AnimeCastName, type MangaCastName, type BeanCastName } from './cast';
37
- export { resolveBean, beanTorso, beanTorsoOutline, beanOrder, beanOverBody, beanLimbLine, mittenAt, beanShoeAt, drawBeanFedora, BEAN_ARM_REACH, BEAN_LEG_REACH, BEAN_SOLE, BEAN_DARK_SOLE, type Bean, type BeanOptions, type BeanTorso } from './body/bean-figure';
37
+ export { resolveBean, beanTorso, beanTorsoOutline, beanOrder, beanOverBody, beanLimbLine, mittenAt, beanShoeAt, beanAlongLeg, beanStanding, drawBeanFedora, BEAN_ARM_REACH, BEAN_BANGLE_STOPS, BEAN_LEG_REACH, BEAN_SOLE, BEAN_DARK_SOLE, type Bean, type BeanOptions, type BeanTorso } from './body/bean-figure';
38
38
  export type { FaceOptions, PupilCircle } from './head/face';
39
39
  export { meetHands, meetingSpacing, HAND_MEETINGS, embrace, embraceSpacing, EMBRACE, helpUp, helpUpSpacing, HELP_UP, type HandMeeting, type HandsMeet, type MeetingPartner, type MeetHandsOptions, type Embrace, type EmbraceOptions, type HelpUp, type HelpUpOptions } from './interactions';
40
40
  export * from './species/human-motion';
@@ -48,6 +48,7 @@ export * from './head';
48
48
  export { hairFollow, hairFollowTracks, hairMotionAt, type HairFollowSample, type HairFollowOptions, type HairFollowKey, type HairFollowTrackOptions } from './hair-follow';
49
49
  export * from './hands';
50
50
  export * from './acting';
51
+ export * from './noir';
51
52
  export * from './capabilities';
52
53
  export { describeTarget, checkTracks, animatableProperties, CANVAS_PROPERTIES, type PropertyInfo, type TargetAbout, type TargetDescription, type TrackProblem } from '../adapters/canvas/target-properties';
53
54
  export * from './props';
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Noir atmosphere for canvas scenes: rain in a window, light through
3
+ * venetian blinds, a dark room with torch beams and holes of light, soft
4
+ * pools of light, a vignette, lightning and a failing bulb.
5
+ *
6
+ * Everything is a pure function of its options and the time (ms): rain drops
7
+ * come from a seeded generator, never `Math.random`, so any frame draws the
8
+ * same whether it is rendered in order, out of order, or scrubbed to.
9
+ */
10
+ export interface NoirBox {
11
+ x: number;
12
+ y: number;
13
+ width: number;
14
+ height: number;
15
+ }
16
+ export interface RainOptions extends NoirBox {
17
+ /** How many streaks (default 70) */
18
+ drops?: number;
19
+ /** Streak opacity (default 0.35) */
20
+ opacity?: number;
21
+ /** Streak colour (default a cold blue-white) */
22
+ color?: string;
23
+ /** Fall speed of the slowest drop, px per second (default 900; the fastest are 60% quicker) */
24
+ speed?: number;
25
+ /** Streak length, px (default 34) */
26
+ length?: number;
27
+ /** Sideways drift over one streak, px; negative slants left (default -8) */
28
+ slant?: number;
29
+ /** Stroke width, px (default 2) */
30
+ lineWidth?: number;
31
+ /** Seed for where the drops fall (default 1) */
32
+ seed?: number;
33
+ }
34
+ /** Rain streaks falling inside a box (a window, the whole frame), clipped to it. */
35
+ export declare function drawRain(ctx: CanvasRenderingContext2D, time: number, options: RainOptions): void;
36
+ export interface BlindsOptions extends NoirBox {
37
+ /** Band opacity (default 0.12) */
38
+ opacity?: number;
39
+ /** Rise of each band per px across (default 0.35: falling to the right) */
40
+ slope?: number;
41
+ /** Distance between bands, px (default 52) */
42
+ spacing?: number;
43
+ /** Band thickness, px (default 24) */
44
+ band?: number;
45
+ /** Light colour (default a warm white) */
46
+ color?: string;
47
+ }
48
+ /** Key light through venetian blinds: parallel slanted bright bands across a box. */
49
+ export declare function drawBlinds(ctx: CanvasRenderingContext2D, options: BlindsOptions): void;
50
+ /** A torch beam: from (x, y) toward `angle` (degrees: 0 right, 90 down), `length` long, `width` half-wide at its end. */
51
+ export interface LightCone {
52
+ x: number;
53
+ y: number;
54
+ angle: number;
55
+ length: number;
56
+ width: number;
57
+ }
58
+ /** A round hole of light (a lamp, a lit window). */
59
+ export interface LightHole {
60
+ x: number;
61
+ y: number;
62
+ radius: number;
63
+ }
64
+ export interface DarknessOptions {
65
+ /** How dark, 0 (none) … 1 (full) */
66
+ amount: number;
67
+ /** Torch beams cut out of the dark */
68
+ cones?: LightCone[];
69
+ /** Round holes cut out of the dark */
70
+ holes?: LightHole[];
71
+ /** The area to darken (default a very large box: the whole canvas at any camera) */
72
+ bounds?: NoirBox;
73
+ /** The dark's colour (default near-black blue) */
74
+ color?: string;
75
+ /** Opacity of the dark at `amount` 1 (default 0.9) */
76
+ opacity?: number;
77
+ /** A faint tint inside each beam (default a warm white at 0.08; `null` for none) */
78
+ beam?: string | null;
79
+ beamOpacity?: number;
80
+ }
81
+ /** The three corners of a cone (apex first), in scene px. */
82
+ export declare function coneCorners(cone: LightCone): Array<{
83
+ x: number;
84
+ y: number;
85
+ }>;
86
+ /** A dark overlay with torch beams and round holes of light cut out of it. */
87
+ export declare function drawDarkness(ctx: CanvasRenderingContext2D, options: DarknessOptions): void;
88
+ export interface GlowOptions {
89
+ x: number;
90
+ y: number;
91
+ radius: number;
92
+ /** Light colour (default amber) */
93
+ color?: string;
94
+ /** Opacity at the centre (default 0.5), falling to 0 at the radius */
95
+ opacity?: number;
96
+ }
97
+ /** A soft pool of light: a radial gradient from `color` to clear. */
98
+ export declare function drawGlow(ctx: CanvasRenderingContext2D, options: GlowOptions): void;
99
+ export interface VignetteOptions {
100
+ width: number;
101
+ height: number;
102
+ x?: number;
103
+ y?: number;
104
+ /** Where the darkening starts, as a fraction of the half-diagonal (default 0.38) */
105
+ inner?: number;
106
+ /** Where it is full, as a fraction of the half-diagonal (default 1.05) */
107
+ outer?: number;
108
+ /** Darkness at the corners (default 0.55) */
109
+ opacity?: number;
110
+ color?: string;
111
+ }
112
+ /** A vignette: the frame's edges fall into dark. */
113
+ export declare function drawVignette(ctx: CanvasRenderingContext2D, options: VignetteOptions): void;
114
+ /**
115
+ * Lightning: how bright a flash is at `time` (0..1), from strikes at the
116
+ * given times (ms); each flares instantly and fades over `decay` ms either side.
117
+ * Fill the frame with a pale blue at about 0.25 × this.
118
+ */
119
+ export declare function lightningFlash(time: number, strikes: number[], decay?: number): number;
120
+ /**
121
+ * A failing bulb: how much darker the room is at `time` (0 or `strength`),
122
+ * flickering in an irregular but repeatable rhythm.
123
+ */
124
+ export declare function lightFlicker(time: number, strength?: number): number;
@@ -0,0 +1,137 @@
1
+ import type { Point } from '../../adapters/canvas/sketch';
2
+ /**
3
+ * A detective's case board as plain data: a cork board with pinned cards
4
+ * (photos of suspects, notes about clues), red string between them, and the
5
+ * marker's work over them (a cross-out, a single strike, a scribble-out, a
6
+ * ring round a card), each drawn on over time.
7
+ *
8
+ * ```ts
9
+ * const board = caseBoard({
10
+ * x: 60, y: 110, width: 1800, height: 900,
11
+ * cards: [
12
+ * { id: 'victim', x: 900, y: 240, title: 'The victim', note: 'Lift 2 · 9:40' },
13
+ * { id: 'aunt', x: 270, y: 190, title: 'The aunt', note: 'a grudge', at: 400 },
14
+ * { id: 'wire', x: 600, y: 200, kind: 'note', title: 'alarm wire: cut', at: 1200 },
15
+ * ],
16
+ * strings: [{ from: 'victim', to: 'aunt', at: 900 }, { from: 'victim', to: 'wire', at: 1500 }],
17
+ * marks: [{ on: 'aunt', kind: 'cross', at: 4000, duration: 1400 }],
18
+ * })
19
+ * drawCaseBoard(ctx, board, time, { drawCard: (ctx, card, area) => …draw a portrait in area… })
20
+ * const tip = caseBoardMarkerTip(board, time) // where the marker's nib is, for a hand
21
+ * ```
22
+ *
23
+ * Card positions are relative to the board's top-left; `x`, `y` is where a
24
+ * card is pinned (its top centre). Times are ms. Text is the caller's.
25
+ */
26
+ export type CaseCardKind = 'photo' | 'note';
27
+ export type CaseMarkKind = 'cross' | 'strike' | 'scribble' | 'circle';
28
+ export declare const CASE_CARD_KINDS: readonly CaseCardKind[];
29
+ export declare const CASE_MARK_KINDS: Record<CaseMarkKind, string>;
30
+ export interface CaseCard {
31
+ id: string;
32
+ /** Where it is pinned (its top centre), relative to the board */
33
+ x: number;
34
+ y: number;
35
+ /** `photo` (default): a print with a picture area, a title and a red note; `note`: a coloured slip with handwriting */
36
+ kind?: CaseCardKind;
37
+ title?: string;
38
+ note?: string;
39
+ /** Size, px (default photo 220 × 260, note 220 × 124) */
40
+ width?: number;
41
+ height?: number;
42
+ /** Tilt, degrees (default a small seeded tilt) */
43
+ angle?: number;
44
+ /** Paper colour (default photo cream, note yellow) */
45
+ color?: string;
46
+ /** When it is pinned up (pops on), ms (default 0: already up) */
47
+ at?: number;
48
+ /** A pulsing amber outline from `at` for `duration` ms */
49
+ highlight?: {
50
+ at: number;
51
+ duration: number;
52
+ };
53
+ }
54
+ export interface CaseString {
55
+ from: string;
56
+ to: string;
57
+ /** When it starts to stretch from `from` to `to`, ms (default 0) and how long that takes (default 600) */
58
+ at?: number;
59
+ duration?: number;
60
+ color?: string;
61
+ }
62
+ export interface CaseMark {
63
+ /** The card it goes over */
64
+ on: string;
65
+ kind: CaseMarkKind;
66
+ /** When the marker starts, ms, and how long the stroke takes (default 1400) */
67
+ at: number;
68
+ duration?: number;
69
+ color?: string;
70
+ /** Stroke width, px (default 16; 18 for a scribble) */
71
+ width?: number;
72
+ }
73
+ export interface CaseBoardOptions {
74
+ /** The board's top-left and size, scene px */
75
+ x: number;
76
+ y: number;
77
+ width: number;
78
+ height: number;
79
+ cards: CaseCard[];
80
+ strings?: CaseString[];
81
+ marks?: CaseMark[];
82
+ /** Cork colour (default a warm brown) and frame colour */
83
+ cork?: string;
84
+ frame?: string;
85
+ ink?: string;
86
+ /** Font family for titles (default system-ui) and for handwriting on notes (default the same) */
87
+ font?: string;
88
+ handFont?: string;
89
+ /** Seed for the cork's grain and the cards' default tilts (default 1) */
90
+ seed?: number;
91
+ }
92
+ export interface CaseBoard extends Required<Omit<CaseBoardOptions, 'cards' | 'strings' | 'marks'>> {
93
+ cards: Array<Required<Omit<CaseCard, 'title' | 'note' | 'highlight'>> & Pick<CaseCard, 'title' | 'note' | 'highlight'>>;
94
+ strings: Array<Required<CaseString>>;
95
+ marks: Array<Required<CaseMark>>;
96
+ }
97
+ /** A resolved card on a board (every default filled in). */
98
+ export type CaseBoardCard = CaseBoard['cards'][number];
99
+ /** Check and resolve a case board: every default spelled out, every id checked (with a did-you-mean). */
100
+ export declare function caseBoard(options: CaseBoardOptions): CaseBoard;
101
+ /** Where a card is: its pin and its four corners, scene px. */
102
+ export declare function caseCardBox(board: CaseBoard, id: string): {
103
+ pin: Point;
104
+ center: Point;
105
+ corners: Point[];
106
+ width: number;
107
+ height: number;
108
+ };
109
+ /** A mark's stroke path, scene px (a cross is its two diagonals end to end, drawn in turn). */
110
+ export declare function caseMarkPath(board: CaseBoard, mark: Pick<CaseMark, 'on' | 'kind'>): Point[][];
111
+ /** Where the marker's nib is at `time` (scene px), or null when no mark is being drawn. */
112
+ export declare function caseBoardMarkerTip(board: CaseBoard, time: number): Point | null;
113
+ /** A red push pin with a highlight. */
114
+ export declare function drawPushPin(ctx: CanvasRenderingContext2D, x: number, y: number, options?: {
115
+ color?: string;
116
+ radius?: number;
117
+ ink?: string;
118
+ }): void;
119
+ /** The first `progress` (0..1) of a marker stroke along points; returns the nib's point. */
120
+ export declare function drawMarkerStroke(ctx: CanvasRenderingContext2D, points: Point[], progress: number, options?: {
121
+ color?: string;
122
+ width?: number;
123
+ }): Point | null;
124
+ export interface DrawCaseBoardOptions {
125
+ /**
126
+ * Draws a card's picture (a suspect's portrait, a clue's sketch) inside
127
+ * `area`, in the card's own frame (origin at the pin), clipped to the area.
128
+ */
129
+ drawCard?: (ctx: CanvasRenderingContext2D, card: CaseBoardCard, area: {
130
+ x: number;
131
+ y: number;
132
+ width: number;
133
+ height: number;
134
+ }, time: number) => void;
135
+ }
136
+ /** Draw the board as it is at `time`: cork, strings, cards, pins and the marker's work. Returns the marker's nib, if a mark is being drawn. */
137
+ export declare function drawCaseBoard(ctx: CanvasRenderingContext2D, board: CaseBoard, time: number, options?: DrawCaseBoardOptions): Point | null;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The noir / detective kit: atmosphere (rain, blinds, darkness with torch
3
+ * beams, glow, vignette, lightning, a failing bulb), detective overlays (the
4
+ * clue marker, an evidence folder, a clock and a time chip, a suspect's name
5
+ * card, a narration box, speech bubbles) and a case board (cards, pins, red
6
+ * string, marker cross-outs and scribble-outs). See docs/noir-detective.md.
7
+ */
8
+ export * from './atmosphere';
9
+ export * from './overlays';
10
+ export * from './case-board';
11
+ export { fadeWindow, withAlpha, wrapText, popIn } from './noir-utils';
12
+ export { NOIR_KIT } from './noir-kit';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The noir / detective kit as data, for the capabilities catalog: every
3
+ * function with its call shape and what it draws.
4
+ */
5
+ export declare const NOIR_KIT: {
6
+ readonly atmosphere: {
7
+ readonly 'drawRain(ctx, time, { x, y, width, height, drops?, opacity?, color?, speed?, length?, slant?, lineWidth?, seed? })': "rain streaks falling in a box (a window, the frame), clipped to it; seeded, a pure function of time";
8
+ readonly 'drawBlinds(ctx, { x, y, width, height, opacity?, slope?, spacing?, band?, color? })': "key light through venetian blinds: slanted bright bands";
9
+ readonly 'drawDarkness(ctx, { amount, cones?: [{ x, y, angle (deg), length, width }], holes?: [{ x, y, radius }], bounds?, color?, opacity?, beam?, beamOpacity? })': "a dark room with torch beams and round holes of light cut out (coneCorners(cone) gives a beam’s corners)";
10
+ readonly 'drawGlow(ctx, { x, y, radius, color?, opacity? })': "a soft pool of light";
11
+ readonly 'drawVignette(ctx, { width, height, x?, y?, inner?, outer?, opacity?, color? })': "the frame’s edges fall into dark";
12
+ readonly 'lightningFlash(time, strikes, decay?)': "flash brightness 0..1 from strike times (ms)";
13
+ readonly 'lightFlicker(time, strength?)': "a failing bulb: how much darker the room is (0 or strength)";
14
+ };
15
+ readonly overlays: {
16
+ readonly 'drawClueMarker(ctx, time, { x, y, radius?, at, duration?, color?, lineWidth? })': "the red magnifier over a clue: pops on, pulses, fades (clueMarkerAt gives its opacity and scale)";
17
+ readonly 'drawEvidenceFolder(ctx, { x, y, scale?, angle?, color?, ink?, label?, font? })': "a tabbed evidence folder";
18
+ readonly 'drawClockFace(ctx, { x, y, radius?, hours, minutes, face?, ink? })': "a wall clock showing a time (clockHandAngles gives the hands)";
19
+ readonly 'drawTimeChip(ctx, time, { x, y, text, size?, font?, color?, background?, at? })': "a time/place chip in a corner; returns its width";
20
+ readonly 'drawNameCard(ctx, time, { name, role?, at, duration?, anchor, side?, frame?, dim?, color?, font?, tilt? })': "a freeze-frame suspect card: the frame dims, a slanted red band beside the head";
21
+ readonly 'drawNarrationBox(ctx, time, { text, start, end, speaker?, x?, width?, bottom?, size?, font?, typeDuration? })': "a first-person narration box along the bottom, words typed on (lineReveal gives opacity and reveal)";
22
+ readonly 'drawSpeechBubble(ctx, time, { text, start, end, tail, speaker?, maxWidth?, size?, font?, bounds?, maxCenterY?, gap? })': "a comic speech bubble above the speaker, tail to the head, popping on";
23
+ };
24
+ readonly caseBoard: {
25
+ readonly 'caseBoard({ x, y, width, height, cards, strings?, marks?, cork?, frame?, font?, handFont?, seed? })': "checks and resolves a case board (did-you-mean on unknown card ids and kinds)";
26
+ readonly 'drawCaseBoard(ctx, board, time, { drawCard? })': "the board at a time: cork, red strings stretching, cards popping up on pins, marker strokes; returns the nib point while a mark is drawn";
27
+ readonly 'caseBoardMarkerTip(board, time)': "where the marker’s nib is (for a hand), or null";
28
+ readonly 'caseCardBox(board, id)': "a card’s pin, centre and corners, scene px";
29
+ readonly 'caseMarkPath(board, { on, kind })': "a mark’s stroke points";
30
+ readonly 'drawPushPin(ctx, x, y, { color?, radius? })': "a red push pin";
31
+ readonly 'drawMarkerStroke(ctx, points, progress, { color?, width? })': "the first part of a marker stroke; returns the nib";
32
+ };
33
+ readonly cardKinds: readonly import("./case-board").CaseCardKind[];
34
+ readonly markKinds: Record<import("./case-board").CaseMarkKind, string>;
35
+ readonly card: "{ id, x, y (its pin, relative to the board), kind?, title?, note?, width?, height?, angle?, color?, at?, highlight?: { at, duration } }";
36
+ readonly string: "{ from, to, at?, duration?, color? }";
37
+ readonly mark: "{ on, kind, at, duration?, color?, width? }";
38
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Small pure helpers shared by the noir / detective kit: timing windows,
3
+ * easing, colours with an alpha, and word wrapping. Nothing here keeps state.
4
+ */
5
+ export declare const clamp01: (v: number) => number;
6
+ /** Smoothstep 0..1. */
7
+ export declare const smooth: (k: number) => number;
8
+ /** Progress 0..1 of `time` through [start, start + length]. */
9
+ export declare const progressIn: (time: number, start: number, length: number) => number;
10
+ /** A back-out pop 0..1 that overshoots a little before settling (cards pinned, a marker appearing). */
11
+ export declare function popIn(k: number): number;
12
+ /**
13
+ * How visible something is at `time` that appears at `at` and lasts
14
+ * `duration` ms: it fades in over `fadeIn`, holds, and fades out over the
15
+ * last `fadeOut` ms (0 outside the window).
16
+ */
17
+ export declare function fadeWindow(time: number, at: number, duration: number, fadeIn?: number, fadeOut?: number): number;
18
+ /** Any `#rgb`, `#rrggbb`, `rgb()` or `rgba()` colour with its alpha multiplied by `alpha` (other forms come back as they are). */
19
+ export declare function withAlpha(color: string, alpha: number): string;
20
+ /**
21
+ * Break text into lines no wider than `maxWidth` in the context's current
22
+ * font, at spaces (an explicit `\n` always breaks). A single word wider than
23
+ * the line stays whole.
24
+ */
25
+ export declare function wrapText(ctx: CanvasRenderingContext2D, text: string, maxWidth: number): string[];
26
+ /** A rounded rectangle path (no fill or stroke). */
27
+ export declare function roundedRect(ctx: CanvasRenderingContext2D, x: number, y: number, w: number, h: number, r: number): void;
28
+ /** A CSS font string: `weight size family`. */
29
+ export declare const fontOf: (size: number, weight: string | number, family: string) => string;
30
+ /** The default font family for the kit's text (any CSS family list works). */
31
+ export declare const NOIR_FONT = "system-ui, sans-serif";