@algorisys/tinyfly 0.95.0 → 0.98.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.
Files changed (51) hide show
  1. package/README.md +8 -8
  2. package/docs/acting.md +165 -0
  3. package/docs/character-appearance.md +281 -0
  4. package/docs/editor-guide.md +14 -6
  5. package/docs/examples.md +1 -1
  6. package/docs/getting-started.md +1 -1
  7. package/docs/gsap-compat.md +1 -1
  8. package/docs/llm-guide.md +44 -2
  9. package/docs/maps.md +2 -2
  10. package/docs/props.md +8 -6
  11. package/docs/teaching.md +1 -1
  12. package/lib/addons/characters.js +6266 -4087
  13. package/lib/browser/tinyfly.iife.js +16 -14
  14. package/lib/browser/tinyfly.js +8441 -6262
  15. package/lib/browser/tinyfly.umd.js +16 -14
  16. package/lib/types/characters/acting/index.d.ts +1 -0
  17. package/lib/types/characters/acting/surface-script.d.ts +92 -0
  18. package/lib/types/characters/capabilities.d.ts +20 -0
  19. package/lib/types/characters/cast.d.ts +284 -0
  20. package/lib/types/characters/character.d.ts +22 -4
  21. package/lib/types/characters/chart.d.ts +108 -0
  22. package/lib/types/characters/code-panel.d.ts +21 -46
  23. package/lib/types/characters/hands/held-items.d.ts +88 -0
  24. package/lib/types/characters/hands/index.d.ts +1 -0
  25. package/lib/types/characters/head/ears.d.ts +10 -0
  26. package/lib/types/characters/head/facial-hair.d.ts +118 -0
  27. package/lib/types/characters/head/glasses.d.ts +24 -0
  28. package/lib/types/characters/head/hair.d.ts +560 -0
  29. package/lib/types/characters/head/hats.d.ts +58 -0
  30. package/lib/types/characters/head/head-look.d.ts +53 -0
  31. package/lib/types/characters/head/index.d.ts +5 -0
  32. package/lib/types/characters/head/shell.d.ts +64 -0
  33. package/lib/types/characters/index.d.ts +7 -1
  34. package/lib/types/characters/interactions.d.ts +69 -0
  35. package/lib/types/characters/props/families/animals.d.ts +6 -0
  36. package/lib/types/characters/props/index.d.ts +1 -0
  37. package/lib/types/characters/props/prop-surface.d.ts +63 -0
  38. package/lib/types/characters/species/human-motion.d.ts +5 -2
  39. package/lib/types/characters/species/human.d.ts +111 -4
  40. package/lib/types/characters/surface/edit-log.d.ts +47 -0
  41. package/lib/types/characters/surface/index.d.ts +11 -0
  42. package/lib/types/characters/surface/pieces.d.ts +61 -0
  43. package/lib/types/characters/surface/ride.d.ts +31 -0
  44. package/lib/types/characters/surface/surface-box.d.ts +18 -0
  45. package/lib/types/characters/surface/surface.d.ts +79 -0
  46. package/lib/types/characters/wardrobe/basic-outfit.d.ts +19 -5
  47. package/lib/types/characters/whiteboard.d.ts +131 -0
  48. package/llms-full.txt +625 -28
  49. package/llms.txt +29 -28
  50. package/package.json +1 -1
  51. package/skills/tinyfly/SKILL.md +38 -9
@@ -1,14 +1,28 @@
1
1
  import type { CharacterLayers } from '../character';
2
2
  /**
3
- * A first outfit for the human character: a T-shirt and trousers, drawn as
4
- * layers on the body's parts, through the character's pen (so it matches the
5
- * look). The sleeves grow out of the shirt's shoulders with no seam. The full
6
- * wardrobe is a later milestone; this is the shape every garment will follow.
3
+ * Clothes for the human character, as plain data, drawn as layers on the
4
+ * body's parts through the character's pen (so they match the look). The
5
+ * base is a top and trousers whose sleeves grow out of the shirt's shoulders
6
+ * with no seam; the options change its cut (long or no sleeves, shorts, a
7
+ * skirt) and add pieces worn over it (a collar, a tie, an apron, a lab coat).
8
+ * The defaults are the original T-shirt and trousers, unchanged.
7
9
  */
8
10
  export interface BasicOutfitOptions {
9
11
  /** Shirt colour (default red) */
10
12
  shirt?: string;
11
- /** Trouser colour (default navy) */
13
+ /** Trouser (or shorts, or skirt) colour (default navy) */
12
14
  trousers?: string;
15
+ /** Sleeves: `short` (default), `long` (to the wrist) or `none` */
16
+ sleeves?: 'short' | 'long' | 'none';
17
+ /** Below the waist: `trousers` (default), `shorts` (to the knee) or `skirt` */
18
+ bottom?: 'trousers' | 'shorts' | 'skirt';
19
+ /** A shirt collar at the neck */
20
+ collar?: boolean;
21
+ /** A tie down the front, in this colour */
22
+ tie?: string | null;
23
+ /** Worn over the clothes: an apron or a lab coat (default none) */
24
+ over?: 'apron' | 'labCoat' | null;
25
+ /** The apron's or lab coat's colour (default: white coat, tan apron) */
26
+ overColor?: string;
13
27
  }
14
28
  export declare function basicOutfit(options?: BasicOutfitOptions): CharacterLayers;
@@ -0,0 +1,131 @@
1
+ import type { CustomTarget } from '../adapters/canvas/canvas-adapter';
2
+ import type { Track } from '../engine/types';
3
+ import { type EditOptions } from './surface/edit-log';
4
+ import { type FlingOptions, type SurfacePiece, type TimedPoint } from './surface/pieces';
5
+ import { type Surface, type SurfaceAbout, type SurfaceEditOptions } from './surface/surface';
6
+ import { type SurfaceBox } from './surface/surface-box';
7
+ /**
8
+ * A whiteboard (or a chalkboard) as a scene object figures act on: they
9
+ * write on it, circle and underline what matters, strike terms out, carry a
10
+ * term across the equals sign and erase it all.
11
+ *
12
+ * ```ts
13
+ * const board = whiteboard({
14
+ * x: 40, y: 30, width: 600, height: 340, theme: 'chalkboard',
15
+ * items: [
16
+ * { id: 'eq', text: '2x + 4 = 10', at: [60, 80] },
17
+ * { id: 'step', text: '2x = 6', at: [60, 160], hidden: true },
18
+ * { id: 'ring', mark: 'circle', around: 'term:eq:+ 4', hidden: true },
19
+ * ],
20
+ * })
21
+ * board.edit('draw', 'mark:ring', { at: 800 })
22
+ * board.edit('fling', 'term:eq:+ 4', { at: 1600 })
23
+ * board.edit('write', 'text:step', { at: 2400 })
24
+ * ```
25
+ *
26
+ * Everything on it is declared up front as plain data (`items`), so its
27
+ * places are known before anything plays. Text is laid out by arithmetic
28
+ * (each character a fixed `charWidth` em cell, drawn centred in it), never
29
+ * measured from a font, and marks get a hand-drawn wobble from a seed made
30
+ * of their id, so the same board is drawn the same everywhere. Items with
31
+ * `hidden: true` start unwritten (text) or undrawn (marks).
32
+ *
33
+ * Its places: `box`, `text:ID`, `term:ID:TEXT` (the first TEXT in that
34
+ * text; `term:ID#K:TEXT` for the Kth), `mark:ID`. A term can come loose as a
35
+ * piece. Edits are recorded as keys on its props (`text.ID.write`,
36
+ * `mark.ID.draw`, `strike.K.draw`, `piece.K.x`…) and written out by
37
+ * `tracks()`.
38
+ */
39
+ export type BoardThemeName = 'whiteboard' | 'chalkboard';
40
+ export interface BoardTheme {
41
+ background: string;
42
+ frame: string;
43
+ /** The default colour of text and marks */
44
+ ink: string;
45
+ /** Named colours an item's `color` can use (any CSS colour works too) */
46
+ colors: Record<string, string>;
47
+ font: string;
48
+ /** Mark line width, as a fraction of the font size */
49
+ stroke: number;
50
+ /** Ink opacity (chalk is a little see-through) */
51
+ opacity: number;
52
+ }
53
+ export declare const BOARD_THEMES: Record<BoardThemeName, BoardTheme>;
54
+ /** The marks a board can draw. */
55
+ export type BoardMarkKind = 'circle' | 'box' | 'underline' | 'arrow';
56
+ export declare const BOARD_MARKS: readonly BoardMarkKind[];
57
+ /** Text on the board. */
58
+ export interface BoardText {
59
+ id: string;
60
+ text: string;
61
+ /** Its top-left corner, px from the board's top-left */
62
+ at: [number, number];
63
+ /** Font size, px (default the board's `fontSize`) */
64
+ size?: number;
65
+ /** A theme colour name (`red`, `blue`…) or any CSS colour (default the theme's ink) */
66
+ color?: string;
67
+ /** Start unwritten, to be written in with the `write` edit */
68
+ hidden?: boolean;
69
+ }
70
+ /** A hand-drawn mark: a circle, box or underline around a place, or an arrow from one place to another. */
71
+ export interface BoardMark {
72
+ id: string;
73
+ mark: BoardMarkKind;
74
+ /** `circle`, `box`, `underline`: the place it goes around (an item before it: `text:ID`, `term:ID:TEXT`, `mark:ID`) */
75
+ around?: string;
76
+ /** `arrow`: from one place to another */
77
+ from?: string;
78
+ to?: string;
79
+ color?: string;
80
+ /** Start undrawn, to be drawn in with the `draw` edit */
81
+ hidden?: boolean;
82
+ }
83
+ export type BoardItem = BoardText | BoardMark;
84
+ export interface WhiteboardOptions {
85
+ /** Top-left corner, scene px */
86
+ x: number;
87
+ y: number;
88
+ width: number;
89
+ height: number;
90
+ theme?: BoardThemeName | Partial<BoardTheme>;
91
+ /** px (default 28) */
92
+ fontSize?: number;
93
+ /** Width of a character cell, em (default 0.55) */
94
+ charWidth?: number;
95
+ items?: BoardItem[];
96
+ }
97
+ /** A term that can come loose from its text: made by `piece()`. */
98
+ export interface BoardPiece extends SurfacePiece {
99
+ readonly text: string;
100
+ /** The text item it is part of, and where in it */
101
+ readonly item: string;
102
+ readonly column: number;
103
+ }
104
+ export interface Whiteboard extends Surface {
105
+ readonly kind: 'board';
106
+ readonly target: CustomTarget;
107
+ readonly box: SurfaceBox;
108
+ /** The box at a named place: `box`, `text:ID`, `term:ID:TEXT` (`term:ID#K:TEXT` for the Kth), `mark:ID` */
109
+ anchor(name: string, time?: number): SurfaceBox;
110
+ /** Make the term at a `term:` place a piece that can come loose */
111
+ piece(anchor: string): BoardPiece;
112
+ /** Change the board at a time by name, at named places (see `WHITEBOARD_SURFACE.edits`) */
113
+ edit(name: string, anchor: string | string[], options: SurfaceEditOptions): Whiteboard;
114
+ follow(piece: SurfacePiece, path: TimedPoint[]): Whiteboard;
115
+ fling(piece: SurfacePiece, options: FlingOptions): Whiteboard;
116
+ move(piece: SurfacePiece, options: EditOptions & {
117
+ to: {
118
+ x: number;
119
+ y: number;
120
+ };
121
+ }): Whiteboard;
122
+ /** A board has nothing to stand on that moves: the tracks come back as they are */
123
+ ride(tracks: Track[], target: string, options: {
124
+ ground: number;
125
+ every?: number;
126
+ }): Track[];
127
+ tracks(target: string): Track[];
128
+ }
129
+ /** A board's anchors and edits, as data: for its `about`, the capability catalog and the checks. */
130
+ export declare const WHITEBOARD_SURFACE: SurfaceAbout;
131
+ export declare function whiteboard(options: WhiteboardOptions): Whiteboard;