@popcraft/kit 0.1.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 (171) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +21 -0
  3. package/README.md +74 -0
  4. package/dist/index.js +160558 -0
  5. package/package.json +40 -0
  6. package/types/design-script.d.ts +39 -0
  7. package/types/lib/agent/design-script/build.d.ts +35 -0
  8. package/types/lib/agent/design-script/check.d.ts +11 -0
  9. package/types/lib/agent/design-script/helper-names.d.ts +1 -0
  10. package/types/lib/agent/design-script/kit-modules.d.ts +43 -0
  11. package/types/lib/agent/design-script/recorder.d.ts +52 -0
  12. package/types/lib/agent/design-script/replay.d.ts +13 -0
  13. package/types/lib/agent/design-script/run-node.d.ts +2 -0
  14. package/types/lib/ai/audio-models.d.ts +66 -0
  15. package/types/lib/ai/content.d.ts +27 -0
  16. package/types/lib/ai/limits.d.ts +42 -0
  17. package/types/lib/audio/presentation/loudness.d.ts +80 -0
  18. package/types/lib/audio/presentation/types.d.ts +112 -0
  19. package/types/lib/brand/apply.d.ts +25 -0
  20. package/types/lib/brand/review-kits.d.ts +10 -0
  21. package/types/lib/brand/types.d.ts +20 -0
  22. package/types/lib/code/hash.d.ts +2 -0
  23. package/types/lib/document/auto-layout.d.ts +10 -0
  24. package/types/lib/document/breakpoints.d.ts +45 -0
  25. package/types/lib/document/clone.d.ts +6 -0
  26. package/types/lib/document/color.d.ts +52 -0
  27. package/types/lib/document/detach.d.ts +12 -0
  28. package/types/lib/document/effects.d.ts +60 -0
  29. package/types/lib/document/expressions.d.ts +78 -0
  30. package/types/lib/document/instance-layout.d.ts +94 -0
  31. package/types/lib/document/instances.d.ts +63 -0
  32. package/types/lib/document/libraries.d.ts +97 -0
  33. package/types/lib/document/node-delta.d.ts +21 -0
  34. package/types/lib/document/page-tokens.d.ts +16 -0
  35. package/types/lib/document/photo-frames.d.ts +14 -0
  36. package/types/lib/document/print-pages.d.ts +85 -0
  37. package/types/lib/document/scene-graph.d.ts +194 -0
  38. package/types/lib/document/scene3d.d.ts +76 -0
  39. package/types/lib/document/shader-graph-effects.d.ts +8 -0
  40. package/types/lib/document/shader-graph.d.ts +134 -0
  41. package/types/lib/document/shader-params.d.ts +65 -0
  42. package/types/lib/document/shape-to-path.d.ts +20 -0
  43. package/types/lib/document/text-styles.d.ts +28 -0
  44. package/types/lib/document/text-tokens.d.ts +6 -0
  45. package/types/lib/document/transform.d.ts +79 -0
  46. package/types/lib/document/transform3d.d.ts +99 -0
  47. package/types/lib/document/trim.d.ts +35 -0
  48. package/types/lib/document/types.d.ts +2560 -0
  49. package/types/lib/document/variables.d.ts +14 -0
  50. package/types/lib/editor/easing.d.ts +46 -0
  51. package/types/lib/editor/modes/types.d.ts +131 -0
  52. package/types/lib/editor/prototype-connect.d.ts +49 -0
  53. package/types/lib/editor/smart-animate.d.ts +37 -0
  54. package/types/lib/engine/geometry/flatten.d.ts +2 -0
  55. package/types/lib/engine/geometry/shape-outline.d.ts +24 -0
  56. package/types/lib/engine/pixel/cells.d.ts +12 -0
  57. package/types/lib/engine/pixel/palettes.d.ts +25 -0
  58. package/types/lib/engine/readiness.d.ts +20 -0
  59. package/types/lib/engine/routing.d.ts +41 -0
  60. package/types/lib/engine/shader-graph-presets.d.ts +22 -0
  61. package/types/lib/engine/shader-presets-legacy.d.ts +7 -0
  62. package/types/lib/engine/shader-presets.d.ts +43 -0
  63. package/types/lib/engine/text/atlas.d.ts +120 -0
  64. package/types/lib/engine/text/emoji/segment.d.ts +15 -0
  65. package/types/lib/engine/text/fallback-fonts.d.ts +47 -0
  66. package/types/lib/engine/text/fontkit-lazy.d.ts +8 -0
  67. package/types/lib/engine/text/fonts.d.ts +33 -0
  68. package/types/lib/engine/text/glyph-linear.d.ts +22 -0
  69. package/types/lib/engine/text/google-fonts.d.ts +17 -0
  70. package/types/lib/engine/text/hyphenate/en-us.d.ts +6 -0
  71. package/types/lib/engine/text/hyphenate/liang.d.ts +21 -0
  72. package/types/lib/engine/text/layout-access.d.ts +16 -0
  73. package/types/lib/engine/text/layout.d.ts +168 -0
  74. package/types/lib/engine/text/lists.d.ts +16 -0
  75. package/types/lib/engine/text/measure.d.ts +58 -0
  76. package/types/lib/engine/text/outline-sdf.d.ts +34 -0
  77. package/types/lib/engine/text/shaper.d.ts +88 -0
  78. package/types/lib/engine/text/text-area.d.ts +16 -0
  79. package/types/lib/engine/text/text-fit.d.ts +51 -0
  80. package/types/lib/engine/text/text-path.d.ts +134 -0
  81. package/types/lib/engine/text/text-rings.d.ts +17 -0
  82. package/types/lib/engine/text/wrap-obstacles.d.ts +20 -0
  83. package/types/lib/i18n/catalogs.d.ts +10 -0
  84. package/types/lib/i18n/format.d.ts +27 -0
  85. package/types/lib/i18n/locales.d.ts +25 -0
  86. package/types/lib/i18n/pseudo.d.ts +10 -0
  87. package/types/lib/i18n/runtime.d.ts +27 -0
  88. package/types/lib/io/codecs/wav.d.ts +7 -0
  89. package/types/lib/io/codecs/webp.d.ts +7 -0
  90. package/types/lib/io/export-ir/children.d.ts +2 -0
  91. package/types/lib/io/json-export.d.ts +11 -0
  92. package/types/lib/media-library/types.d.ts +39 -0
  93. package/types/lib/motion/audio-analysis.d.ts +44 -0
  94. package/types/lib/motion/audio-clips.d.ts +92 -0
  95. package/types/lib/motion/audio-onsets.d.ts +13 -0
  96. package/types/lib/motion/audio-signals.d.ts +59 -0
  97. package/types/lib/motion/author.d.ts +80 -0
  98. package/types/lib/motion/composition.d.ts +99 -0
  99. package/types/lib/motion/instances.d.ts +95 -0
  100. package/types/lib/motion/key-selection.d.ts +100 -0
  101. package/types/lib/motion/keys.d.ts +41 -0
  102. package/types/lib/motion/layer-time-edit.d.ts +40 -0
  103. package/types/lib/motion/markers.d.ts +31 -0
  104. package/types/lib/motion/modifier-edit.d.ts +84 -0
  105. package/types/lib/motion/modifiers.d.ts +44 -0
  106. package/types/lib/motion/morph.d.ts +14 -0
  107. package/types/lib/motion/pose-layout.d.ts +6 -0
  108. package/types/lib/motion/pose.d.ts +115 -0
  109. package/types/lib/motion/presets.d.ts +148 -0
  110. package/types/lib/motion/properties.d.ts +74 -0
  111. package/types/lib/motion/sample-keys.d.ts +8 -0
  112. package/types/lib/motion/sample.d.ts +51 -0
  113. package/types/lib/motion/sound.d.ts +25 -0
  114. package/types/lib/motion/spatial-curve.d.ts +15 -0
  115. package/types/lib/motion/spatial.d.ts +38 -0
  116. package/types/lib/motion/text-animators.d.ts +79 -0
  117. package/types/lib/motion/text-units.d.ts +47 -0
  118. package/types/lib/motion/time.d.ts +58 -0
  119. package/types/lib/motion/transitions.d.ts +99 -0
  120. package/types/lib/motion/values.d.ts +12 -0
  121. package/types/lib/motion/video-clip.d.ts +63 -0
  122. package/types/lib/presets/page-presets.d.ts +50 -0
  123. package/types/lib/storage/media-hash.d.ts +4 -0
  124. package/types/lib/storage/media-refs.d.ts +2 -0
  125. package/types/lib/storage/media-store.d.ts +70 -0
  126. package/types/lib/templates/apply.d.ts +38 -0
  127. package/types/lib/templates/capture.d.ts +25 -0
  128. package/types/lib/templates/groups.d.ts +82 -0
  129. package/types/lib/templates/layout.d.ts +20 -0
  130. package/types/lib/templates/quality.d.ts +59 -0
  131. package/types/lib/templates/resize.d.ts +34 -0
  132. package/types/lib/templates/safe-areas.d.ts +42 -0
  133. package/types/lib/templates/text-measurer.d.ts +10 -0
  134. package/types/lib/templates/thumbnail.d.ts +134 -0
  135. package/types/lib/templates/types.d.ts +95 -0
  136. package/types/lib/templates/vocabulary.d.ts +50 -0
  137. package/types/lib/units/units.d.ts +23 -0
  138. package/types/packages/kit/src/index.d.ts +59 -0
  139. package/types/packages/runtime/src/expressions.d.ts +41 -0
  140. package/types/templates/src/app/shared.d.ts +29 -0
  141. package/types/templates/src/audio/beat-loop.d.ts +9 -0
  142. package/types/templates/src/audio/media.d.ts +42 -0
  143. package/types/templates/src/audio/music-synth.d.ts +57 -0
  144. package/types/templates/src/audio/music-worlds.d.ts +8 -0
  145. package/types/templates/src/audio/music.d.ts +19 -0
  146. package/types/templates/src/audio/studio/deck.d.ts +340 -0
  147. package/types/templates/src/audio/studio/dsp.d.ts +151 -0
  148. package/types/templates/src/audio/studio/fx.d.ts +96 -0
  149. package/types/templates/src/audio/studio/mix.d.ts +84 -0
  150. package/types/templates/src/audio/studio/voices.d.ts +120 -0
  151. package/types/templates/src/data/geometry.d.ts +16 -0
  152. package/types/templates/src/effects/shared.d.ts +17 -0
  153. package/types/templates/src/kit.d.ts +582 -0
  154. package/types/templates/src/motion3d/devices.d.ts +42 -0
  155. package/types/templates/src/motion3d/ui.d.ts +48 -0
  156. package/types/templates/src/saas/video-shared.d.ts +114 -0
  157. package/types/templates/src/saas/web-shared.d.ts +74 -0
  158. package/types/templates/src/shared/beat.d.ts +24 -0
  159. package/types/templates/src/shared/captions.d.ts +24 -0
  160. package/types/templates/src/shared/devices.d.ts +188 -0
  161. package/types/templates/src/shared/draw.d.ts +43 -0
  162. package/types/templates/src/shared/fit.d.ts +73 -0
  163. package/types/templates/src/shared/marks.d.ts +51 -0
  164. package/types/templates/src/shared/motion.d.ts +15 -0
  165. package/types/templates/src/shared/overlays.d.ts +80 -0
  166. package/types/templates/src/shared/pointer.d.ts +46 -0
  167. package/types/templates/src/shared/texture.d.ts +41 -0
  168. package/types/templates/src/shared/type.d.ts +6 -0
  169. package/types/templates/src/shared/window.d.ts +50 -0
  170. package/types/templates/src/social/shared.d.ts +66 -0
  171. package/types/templates/src/web/shared.d.ts +64 -0
@@ -0,0 +1,582 @@
1
+ import type { AnyNode, Color, Document, EasingType, Effect, FrameTimeline, InstancePlayback, KeyBinding, PlaybackField, InteractionTrigger, NavigationType, Orbit3D, Paint, PrototypeAction, DragDirection, PrototypeTransition, TimelineControl, StrokeStyle, TextNode, TextStyle, TimelineMarker, TransitionType, VariableType, Interp, Scene3D, SceneTransition, TextCounter, TimelineFps, VectorPath, ShaderParamValue } from '../../lib/document/types.js';
2
+ import { type PagePreset } from '../../lib/presets/page-presets.js';
3
+ import { type KeySpec } from '../../lib/motion/author.js';
4
+ import { type PresetId, type PresetParams, type StaggerPick } from '../../lib/motion/presets.js';
5
+ import type { Modifier, StaggerOrder, Stagger } from '../../lib/document/types.js';
6
+ /** What a shape can be filled with: a brand colour role, or paints built by `Kit.gradient`. */
7
+ export type Fill = string | Paint[];
8
+ /** `#RRGGBB` (or `#RRGGBBAA`) as a colour: lib/document/color.ts `hexToColor`, which an authoring typo fails loudly in. */
9
+ export declare const hex: (h: string, a?: number) => Color;
10
+ /** Placed out of the flow at a fixed spot inside an auto-layout parent. */
11
+ export interface AbsoluteAt {
12
+ x: number;
13
+ y: number;
14
+ }
15
+ /** A stroke bound to a brand colour role: centred, with round caps and joins, unless said. */
16
+ export interface BrandStroke {
17
+ color: string;
18
+ width: number;
19
+ align?: StrokeStyle['alignment'];
20
+ cap?: StrokeStyle['cap'];
21
+ join?: StrokeStyle['join']; /** `[dash, gap]` in px along the line; each dash takes the stroke's cap. */
22
+ dash?: [number, number];
23
+ }
24
+ export type Padding = number | {
25
+ top: number;
26
+ right: number;
27
+ bottom: number;
28
+ left: number;
29
+ };
30
+ export interface StackOpts {
31
+ direction?: 'VERTICAL' | 'HORIZONTAL';
32
+ gap?: number;
33
+ padding?: Padding;
34
+ width?: number | 'FILL' | 'HUG';
35
+ height?: number | 'HUG' | 'FILL';
36
+ align?: 'MIN' | 'CENTER' | 'MAX';
37
+ justify?: 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN';
38
+ fill?: Fill;
39
+ name?: string;
40
+ radius?: number;
41
+ wrap?: boolean;
42
+ clip?: boolean;
43
+ effects?: Effect[];
44
+ stroke?: BrandStroke;
45
+ absolute?: AbsoluteAt;
46
+ }
47
+ export interface TextOpts {
48
+ style?: string;
49
+ color?: string;
50
+ width?: number | 'FILL';
51
+ align?: TextNode['textAlign'];
52
+ name?: string;
53
+ list?: TextNode['list'];
54
+ tabStops?: TextNode['tabStops'];
55
+ autoWidth?: boolean;
56
+ effects?: Effect[];
57
+ absolute?: AbsoluteAt;
58
+ }
59
+ export interface ShapeOpts {
60
+ radius?: number;
61
+ name?: string;
62
+ effects?: Effect[];
63
+ stroke?: BrandStroke;
64
+ absolute?: AbsoluteAt;
65
+ opacity?: number; /** An alpha mask over the layers after it in its parent (a frame's first child masks the frame). */
66
+ mask?: boolean;
67
+ }
68
+ /**
69
+ * The pictures a `{{brand.logo}}` layer shows until a brand kit supplies one (lib/brand/apply.ts swaps the
70
+ * layer's image for the kit's first logo): a plain white mark for a brand-coloured ground, and the same mark
71
+ * on a grey tile for a layer that may land on any ground.
72
+ */
73
+ export declare const LOGO_PLACEHOLDERS: {
74
+ readonly mark: "/templates/logo-mark.svg";
75
+ readonly tile: "/templates/logo-tile.svg";
76
+ };
77
+ /**
78
+ * A motion preset on named layers of a sheet — what the Animate panel's preset picker applies
79
+ * (lib/motion/presets.ts `applyPresetToDocument`), written as data so the golden-pose tests are generated from
80
+ * the same list the template is built from. `layer` names one layer, or several when `stagger` is given
81
+ * (every layer of that name under the sheet, in tree order, each `stagger.delay` ms after the one before).
82
+ */
83
+ export interface Cue {
84
+ layer: string | readonly string[];
85
+ preset: PresetId;
86
+ /** Frame ms the preset starts at. */
87
+ at: number;
88
+ params?: PresetParams;
89
+ stagger?: {
90
+ delay: number;
91
+ order?: StaggerPick;
92
+ };
93
+ /**
94
+ * A build: present mode waits for a click before this cue plays — a `pause` marker at `at`, which is what the
95
+ * preset picker's "Wait for a click" writes (lib/motion/present.ts plays on from it on the next click).
96
+ */
97
+ onClick?: boolean;
98
+ }
99
+ /**
100
+ * A component property as a source writes it: a string is a TEXT property's default, `{ swap }` an INSTANCE_SWAP
101
+ * default (a component's name), `{ number }` a NUMBER input (with its range), `{ color }` a COLOR input whose
102
+ * default is a brand role's value, and `{ motion }` a MOTION property: a playback field every instance sets.
103
+ */
104
+ export type PropSpec = string | {
105
+ swap: string;
106
+ } | {
107
+ number: number;
108
+ min?: number;
109
+ max?: number;
110
+ step?: number;
111
+ } | {
112
+ color: string;
113
+ } | {
114
+ motion: PlaybackField;
115
+ value: string | number;
116
+ };
117
+ /** What an instance sets a property to: words, a swapped component (by name), a number or a colour. */
118
+ export type PropValue = string | number | Color | {
119
+ swap: string;
120
+ };
121
+ /** A component's own timeline (component ms): how long it plays, at what rate (30 fps unless said), and its markers. */
122
+ export interface ComponentTimeline {
123
+ duration: number;
124
+ fps?: TimelineFps;
125
+ markers?: TimelineMarker[];
126
+ }
127
+ /**
128
+ * A figure a text counts through — the keyable `text.counter` (lib/motion/text-animators.ts), what the Animate
129
+ * panel's counter row writes — as data, so the golden-pose tests are generated from the same list: at `at` the
130
+ * text reads `counter.from`, `duration` ms later `counter.to`, on `ease` (cubic out by default). With `tick`
131
+ * the figure steps instead of gliding — a hold key every `tick` ms, each one unit of the way, like a clock's
132
+ * seconds — so a countdown never shows a figure between two whole ones.
133
+ */
134
+ export interface Count {
135
+ layer: string;
136
+ /** Frame ms the count starts at. */
137
+ at: number;
138
+ duration: number;
139
+ counter: TextCounter;
140
+ ease?: Interp;
141
+ tick?: number;
142
+ }
143
+ /**
144
+ * One text that says several words in turn — a word swap — through a text animator of its own (id `swap`) and
145
+ * its `text.content` keys: each word's `unit`s (letters by default) rise in `stagger` ms apart over `in` ms, the
146
+ * word holds for `hold` ms once its last unit has landed, and leaves the same way over `out` ms; the next word
147
+ * starts as the last unit of the one before has gone. At rest the text reads its first word, whole. The text
148
+ * animator panel shows the animator, so switching its unit (letter → word) is one click.
149
+ */
150
+ export interface Swap {
151
+ layer: string;
152
+ words: readonly string[];
153
+ /** Frame ms the first word starts coming in. */
154
+ at: number;
155
+ hold: number;
156
+ stagger: number;
157
+ in: number;
158
+ out: number;
159
+ unit?: 'letter' | 'word';
160
+ /** How far (px) a unit rises in from, and away to. */
161
+ rise: number;
162
+ }
163
+ /** When each word of a swap comes in, has landed, starts leaving and is gone (frame ms). */
164
+ export declare function swapTimes(s: Swap): {
165
+ word: string;
166
+ enters: number;
167
+ landed: number;
168
+ leaves: number;
169
+ gone: number;
170
+ }[];
171
+ /** The default curve a count glides on: fast, then settling onto the figure. */
172
+ export declare const COUNT_EASE: Interp;
173
+ /** The value a count shows at `ms` of frame time (what the pose samples; the tests work it out on their own). */
174
+ export declare function countKeys(c: Count, local: number): KeySpec[];
175
+ /** The counter a count's text gets: a ticking count steps by the figures it covers per tick. */
176
+ export declare function countCounter(c: Count): TextCounter;
177
+ /**
178
+ * Scenes one after another: the sheets named in `scenes` (in order), each playing its own timeline, sequenced
179
+ * by a composition (lib/motion/composition.ts) — `transition` is how each scene after the first replaces the
180
+ * one before (null: a cut). What the Scenes panel builds, as data for the tests to be generated from.
181
+ */
182
+ export interface SceneSpec {
183
+ sheet: string;
184
+ cues: readonly Cue[];
185
+ counts?: readonly Count[];
186
+ transition?: SceneTransition | null;
187
+ }
188
+ /** A size a master is re-laid out at: a page preset, and what that size needs changing by hand. */
189
+ export interface VariantSpec {
190
+ preset: string;
191
+ /** Per-variant overrides, run on the resized copy (safe-area padding, a smaller headline). */
192
+ adjust?: (k: Kit, sheetId: string) => void;
193
+ }
194
+ export declare class Kit {
195
+ doc: Document;
196
+ private vars;
197
+ private styles;
198
+ private components;
199
+ private componentsPage;
200
+ /**
201
+ * Hold vector geometry to a thousandth of a px, so a template drawing arcs, rings and curves with Math.sin / cos builds
202
+ * byte for byte the same on macOS and on Linux (V8's maths library can differ in the last bit between them). On for
203
+ * templates made since (the Game UI kit sets it); older sources keep their committed fixtures.
204
+ */
205
+ quantizeGeometry: boolean;
206
+ constructor(name: string, preset: PagePreset);
207
+ get pageId(): string;
208
+ /** The last sheet on the first canvas page: a print page for fixed-page kinds, the starter frame for web / app. */
209
+ get sheet(): string;
210
+ node<T extends AnyNode = AnyNode>(id: string): T;
211
+ /** Replace one node (the kit's only mutation primitive after `add`). */
212
+ private put;
213
+ patch(id: string, props: Partial<AnyNode> | Record<string, unknown>): void;
214
+ /** A "Brand" collection: colours (hex, or a colour) as `brand/<role>` COLOR variables, fields as `brand/<name>` strings. */
215
+ brand(colors: Record<string, string | Color>, fields?: Record<string, string>): this;
216
+ /**
217
+ * Scenery colours: roles a template paints with that are no part of its brand (a farm's soil, a fen's water) — a
218
+ * "Palette" collection of `palette/<role>` COLOR variables, bound and edited like brand roles, but not offered as
219
+ * brand slots, so a template with a rich illustration keeps its brand to the colours a kit should swap.
220
+ */
221
+ palette(colors: Record<string, string | Color>): this;
222
+ /** The literal value of a brand colour role (what a gradient stop, which cannot bind, is resolved to). */
223
+ color(role: string, a?: number): Color;
224
+ /** A solid paint bound to a brand colour. An unknown role is an authoring error: every solid fill binds. */
225
+ paint(role: string): Paint[];
226
+ private fillOf;
227
+ /**
228
+ * A gradient between two brand colour roles. The stops are resolved to literal colours: `boundVariables`
229
+ * binds a SOLID paint's single colour and has nowhere to put a stop list, so a kit swap leaves gradients as
230
+ * they were — which is why a gradient here is always a glow over a bound solid, never the only ground.
231
+ */
232
+ gradient(o: {
233
+ from: string;
234
+ to: string;
235
+ kind?: 'LINEAR' | 'RADIAL';
236
+ angle?: number;
237
+ fromOpacity?: number;
238
+ toOpacity?: number;
239
+ opacity?: number;
240
+ handles?: {
241
+ x: number;
242
+ y: number;
243
+ }[];
244
+ }): Paint;
245
+ /**
246
+ * A live shader fill (lib/engine/shader-fill.ts): one of the presets by name (lib/engine/shader-presets.ts: a node
247
+ * graph, so the file can open it in the node editor), or WGSL of the template's own when `code` is given, with
248
+ * values for its params — a preset's by their plain names (`speed`, `colorA`) or knob fields (`mesh_speed`). The
249
+ * fill's id is `f1`, so its params key as `fills[@f1].shaderParams.<field>` — what `animateShader` writes and the
250
+ * fill panel's diamonds edit. A param the shader does not have is an authoring error, not a silent no-op. Colours
251
+ * cannot bind to brand variables (a param is not a paint), so pass the brand's literal colours (`k.color(role)`)
252
+ * and keep text on a bound ground or tint.
253
+ */
254
+ shader(name: string, params: Record<string, ShaderParamValue>, code?: string): Paint[];
255
+ /** Key a param of `id`'s shader fill (a number, or a colour / vector per component) by its name: `fills[@f1].shaderParams.<field>`. */
256
+ animateShader(id: string, param: string, keys: readonly {
257
+ t: number;
258
+ v: ShaderParamValue;
259
+ ease?: Interp;
260
+ }[]): void;
261
+ /** A named text style; defining the same name again returns the existing style (page builders share). */
262
+ textStyle(name: string, s: Partial<TextStyle> & {
263
+ size: number;
264
+ }): string;
265
+ /** The name of the text style `id` (what a variant's overrides restyle by). */
266
+ styleName(id: string): string | undefined;
267
+ private styleOf;
268
+ private add;
269
+ private width;
270
+ text(parent: string, characters: string, o?: TextOpts): string;
271
+ /** `n` set in the text style `name` (lib/document/text-styles.ts: the style's fields, as the renderer applies them). */
272
+ private styled;
273
+ rect(parent: string, w: number | 'FILL', h: number, color: Fill, o?: ShapeOpts): string;
274
+ ellipse(parent: string, size: number, color: Fill, o?: ShapeOpts): string;
275
+ /**
276
+ * A picture from the app's own public files (`/screenshots/x.png`): a shape filled with the image, cover-fit
277
+ * (`fit: 'FIT'` contains it), clipped to its corners — so a card's radius and shadow are the shape's own.
278
+ */
279
+ picture(parent: string, url: string, w: number | 'FILL', h: number, o?: ShapeOpts & {
280
+ fit?: 'FILL' | 'FIT';
281
+ }): string;
282
+ /** A solid paint bound to a brand colour, drawn at `opacity` (a translucent panel over what is behind it). */
283
+ tint(role: string, opacity: number): Paint[];
284
+ /** A five-point star in a brand colour (a rating mark drawn as a shape, so it needs no glyph from the font). */
285
+ star(parent: string, size: number, color: Fill, o?: ShapeOpts): string;
286
+ /**
287
+ * A vector shape in a brand colour (a chart's line or a donut's slice): `paths` in the layer's own px, inside a
288
+ * `width` × `height` box. `stroke` draws the paths as lines instead of filling them.
289
+ */
290
+ vector(parent: string, width: number, height: number, paths: VectorPath[], color: Fill, o?: ShapeOpts & {
291
+ strokeWidth?: number;
292
+ }): string;
293
+ /** A stroke in a brand colour. */
294
+ private brandStroke;
295
+ /**
296
+ * The brand logo: an IMAGE layer named `{{brand.logo}}`, which is what lib/brand/apply.ts fills from a kit
297
+ * and what `detectBrandSlots` advertises as the template's logo slot. Contain-fit, so any logo's aspect
298
+ * survives the swap.
299
+ */
300
+ logo(parent: string, width: number, height: number, o?: {
301
+ absolute?: AbsoluteAt;
302
+ opacity?: number;
303
+ placeholder?: keyof typeof LOGO_PLACEHOLDERS;
304
+ }): string;
305
+ /**
306
+ * A photo frame: a mask group of [shape as mask, placeholder] — what `makePhotoFrame` builds in the editor,
307
+ * except that the placeholder's ground is a brand colour (every solid paint in a template binds). Drop a
308
+ * picture on it and it fills, cover-fit to the mask. FIXED size: auto layout moves a group as a leaf.
309
+ */
310
+ photo(parent: string, width: number, height: number, o?: {
311
+ radius?: number;
312
+ ground?: string;
313
+ name?: string;
314
+ absolute?: AbsoluteAt;
315
+ }): string;
316
+ /**
317
+ * A group at a hand-picked box: a 3D scene, or a group of layers inside one (lib/document/scene3d.ts), where
318
+ * layers are placed in 3D (x, y, z, tilts) rather than by a layout. `absolute` inside an auto-layout parent.
319
+ */
320
+ group(parent: string, box: {
321
+ x: number;
322
+ y: number;
323
+ width: number;
324
+ height: number;
325
+ }, o?: {
326
+ name?: string;
327
+ absolute?: boolean;
328
+ }): string;
329
+ /** A picture, cover-fit to its box (a template's own art: a data URL or a file in public/). */
330
+ image(parent: string, url: string, width: number, height: number, o?: {
331
+ name?: string;
332
+ radius?: number;
333
+ }): string;
334
+ /** Make a group or frame a 3D scene: its layers are placed in 3D and seen through `scene`'s camera and lights. */
335
+ scene3d(id: string, scene: Scene3D): void;
336
+ /**
337
+ * A frame at a hand-picked box, placed out of its parent's flow: a world a prototype's camera flies over, a layer of
338
+ * it scaled about its corner, a stage for layers placed by hand. It is an auto-layout frame of a fixed size whose
339
+ * children are placed the same way (give each `absolute`): a layout never moves them, and the editor still offers
340
+ * them as a stack.
341
+ */
342
+ frame(parent: string, box: {
343
+ x: number;
344
+ y: number;
345
+ width: number;
346
+ height: number;
347
+ }, o?: {
348
+ name?: string;
349
+ fill?: Fill;
350
+ clip?: boolean;
351
+ radius?: number;
352
+ effects?: Effect[];
353
+ stroke?: BrandStroke;
354
+ opacity?: number;
355
+ visible?: boolean;
356
+ }): string;
357
+ /** An auto-layout frame. Width defaults to filling the parent; height hugs its children. */
358
+ stack(parent: string, o?: StackOpts): string;
359
+ /**
360
+ * Make the sheet itself an auto-layout column: its own fill (a brand variable, so a dark kit darkens the
361
+ * page), padding and spacing. `justify` spaces the sheet's children — a badge pinned top, a CTA bottom.
362
+ */
363
+ flowSheet(sheetId: string, gap: number, padding?: Padding, paper?: string, justify?: 'MIN' | 'CENTER' | 'MAX' | 'SPACE_BETWEEN', align?: 'MIN' | 'CENTER' | 'MAX'): void;
364
+ addSheet(preset?: PagePreset, name?: string): string;
365
+ /** The page that represents the whole file in the browser (Figma's "set as thumbnail"). */
366
+ setCover(nodeId: string): void;
367
+ nameSheet(sheetId: string, name: string): void;
368
+ /** A canvas page (web / app screens live on any page; components keep their own). */
369
+ addPage(name: string): string;
370
+ /** Another screen of a web / app template: a preset-sized frame beside the last one on `page`. */
371
+ addScreen(name: string, page?: string): string;
372
+ /** The frame a prototype starts on (shown in the flows list). */
373
+ flowStart(frameId: string, name: string): void;
374
+ /** A prototype link: clicking `from` goes to `to` with `transition` (BACK returns to the previous screen). */
375
+ link(from: string, to: string | null, transition?: TransitionType, o?: {
376
+ navigation?: NavigationType;
377
+ duration?: number;
378
+ trigger?: InteractionTrigger;
379
+ delay?: number;
380
+ easing?: EasingType;
381
+ spring?: PrototypeTransition['spring'];
382
+ stagger?: number;
383
+ origin?: PrototypeTransition['origin'];
384
+ direction?: DragDirection; /** A key that follows the link (`'*'`: any key). */
385
+ key?: string;
386
+ overlay?: Pick<PrototypeAction, 'overlayPosition' | 'overlayBackground' | 'closeOnOutsideClick'>;
387
+ }): void;
388
+ /**
389
+ * Any prototype action on `id` (a Set variable to an expression, a Conditional, a Change to…), on `trigger`, or on
390
+ * the key `key` (a KEY_DOWN; `'*'` for any key). What the Prototype panel's interaction card writes.
391
+ */
392
+ on(id: string, action: PrototypeAction, o?: {
393
+ trigger?: InteractionTrigger;
394
+ key?: string;
395
+ delay?: number;
396
+ }): void;
397
+ /**
398
+ * A TIMELINE action on layer `id` (lib/motion/timeline-control.ts): a drag (ON_DRAG) or a scroll (ON_SCROLL) scrubs a
399
+ * timeline, a click plays, pauses or seeks it — the frame's, or (`target: 'INSTANCE'`) the motion instance's.
400
+ */
401
+ timelineControl(id: string, trigger: InteractionTrigger, timeline: TimelineControl, o?: {
402
+ direction?: DragDirection;
403
+ }): void;
404
+ /** Make `id` a shared element: smart animate hands it to the layer with the same key on the other frame, wherever that sits. */
405
+ share(id: string, key: string): void;
406
+ /** Dragging `from` orbits `target` (a pass-through group in a 3D scene) live, by the drag (ORBIT_3D). */
407
+ orbit(from: string, target: string, orbit?: Orbit3D): void;
408
+ /** Add `interaction` to layer `id` (made by lib/editor/prototype-connect.ts `interactionFor`, as a drag-to-link is). */
409
+ private interact;
410
+ /** A master draws only its children on the pages that use it, so it carries no fill of its own. */
411
+ addMaster(): string;
412
+ useMaster(sheetIds: string[], masterId: string): void;
413
+ private ensureComponentsPage;
414
+ private definitions;
415
+ /** A component's auto-layout box (the parts `component` and each variant of `variantSet` share). */
416
+ private componentNode;
417
+ /**
418
+ * A component on the "Components" page; `build` adds its children. Text properties bind by name; NUMBER and
419
+ * COLOR inputs reach layers through `bindPath` / `bindKey`, MOTION properties set each instance's playback.
420
+ * With `timeline` it is a motion component: presets (`cues` on its id) and keys play on its own clock.
421
+ */
422
+ component(name: string, o: Omit<StackOpts, 'absolute'> & {
423
+ props?: Record<string, PropSpec>;
424
+ description?: string;
425
+ timeline?: ComponentTimeline;
426
+ }, build: (id: string) => void): string;
427
+ /**
428
+ * A variant set: one component per state of `axis` (`State=Idle`, `State=Hover`…), side by side in a set that
429
+ * holds the properties they share. The states are animation states: `changeTo` wires how an instance moves
430
+ * between them (present mode glides over the layers they share by name, then plays the new state's timeline).
431
+ * `build` fills each state; `each` gives a state its own box options (a fill, a timeline). Named
432
+ * `<set>/<state>` for `instance` and `changeTo`; the set's name alone is its first state.
433
+ */
434
+ variantSet(name: string, axis: string, states: readonly string[], o: Omit<StackOpts, 'absolute'> & {
435
+ props?: Record<string, PropSpec>;
436
+ description?: string;
437
+ }, build: (state: string, id: string) => void, each?: (state: string) => Omit<StackOpts, 'absolute'> & {
438
+ timeline?: ComponentTimeline;
439
+ }): Record<string, string>;
440
+ /**
441
+ * An interactive component's state change: on `trigger`, an instance showing `from` shows `to` instead,
442
+ * gliding (smart animate) for `duration` ms. ON_HOVER / ON_PRESS last while hovered or pressed.
443
+ */
444
+ changeTo(from: string, trigger: InteractionTrigger, to: string, duration?: number, easing?: EasingType, on?: string): void;
445
+ /** Whether a component named `name` has been made (parts shared by several sizes are made once). */
446
+ hasComponent(name: string): boolean;
447
+ /** The id of the component named `name` (a variant as `<set>/<state>`): what cues on its timeline land on. */
448
+ componentIdOf(name: string): string;
449
+ private componentId;
450
+ /** The definitions a layer's component answers with: its set's, for a variant (lib/document/instances.ts). */
451
+ private defsOf;
452
+ /** A text inside a component whose characters come from the property `prop`. */
453
+ propText(parent: string, prop: string, o?: TextOpts): string;
454
+ /** A nested instance inside a component whose main component comes from the INSTANCE_SWAP prop `prop`. */
455
+ propInstance(parent: string, prop: string, o?: {
456
+ name?: string;
457
+ }): string;
458
+ /**
459
+ * Layer `id` (inside a component) takes `path` from the NUMBER / COLOR property `prop`: `bindPath(bg,
460
+ * 'fills[#0].color', 'Accent')`. The item the path addresses gets a stable id, as a key's would.
461
+ */
462
+ bindPath(id: string, path: string, prop: string): void;
463
+ /** The key of `path` at `t` on layer `id` takes its value from a property (`value · mul + add`): "fill to Percent". */
464
+ bindKey(id: string, path: string, t: number, bind: KeyBinding): void;
465
+ /** An instance of a named component with property values, and (for a motion component) its own playback. */
466
+ instance(parent: string, component: string, props?: Record<string, PropValue>, o?: {
467
+ width?: number | 'FILL';
468
+ name?: string;
469
+ absolute?: AbsoluteAt;
470
+ playback?: InstancePlayback;
471
+ }): string;
472
+ private collections;
473
+ /**
474
+ * A variable in the collection `collection` (created on first use, one mode) — prototype state a layer binds
475
+ * to and a SET_VARIABLE interaction changes, like the pricing page's `billing/yearly`.
476
+ */
477
+ variable(collection: string, name: string, type: VariableType, value: unknown): string;
478
+ /**
479
+ * `prop` of layer `id` follows an expression over the variables, live (`boundExpressions`, lib/document/variables.ts):
480
+ * `bindExpression(bar, 'width', 'health / maxHealth * 320')`.
481
+ */
482
+ bindExpression(id: string, prop: string, expression: string): void;
483
+ /** `prop` of layer `id` (`visible`, `opacity`…) reads the variable `variableId` live. */
484
+ bindVariable(id: string, prop: string, variableId: string): void;
485
+ /** On `trigger`, `id` sets the variable (or flips a boolean one): a SET_VARIABLE action. */
486
+ setVariable(id: string, variableId: string, o?: {
487
+ toggle?: boolean;
488
+ value?: unknown;
489
+ trigger?: InteractionTrigger;
490
+ }): void;
491
+ /** A Set variable action (not yet on a layer): to `value`, or to `expression` worked out when it runs, gliding over `glide` ms. */
492
+ static set(variableId: string, v: {
493
+ value?: unknown;
494
+ expression?: string;
495
+ toggle?: boolean;
496
+ glide?: number;
497
+ easing?: EasingType;
498
+ }): PrototypeAction;
499
+ /** A Conditional action: the first branch whose condition holds runs its actions (a branch with no `if` is the else). */
500
+ static when(branches: readonly {
501
+ if?: string;
502
+ then: readonly PrototypeAction[];
503
+ }[]): PrototypeAction;
504
+ /** A Navigate (or overlay, back, close) action, for a Conditional's branch. */
505
+ static go(to: string | null, transition?: TransitionType, o?: {
506
+ navigation?: NavigationType;
507
+ duration?: number;
508
+ overlay?: Pick<PrototypeAction, 'overlayPosition' | 'overlayBackground' | 'closeOnOutsideClick'>;
509
+ }): PrototypeAction;
510
+ /** A Change to action: the instance it fires on shows the variant `to` (by name), gliding over `duration` ms. */
511
+ changeAction(to: string, duration?: number, easing?: EasingType): PrototypeAction;
512
+ /**
513
+ * Apply `cues` to the layers under `sheetId`, in order, through the one preset system. The layout is baked
514
+ * first, since a preset measures the layer it lands on (a rise travels half the layer's smaller side).
515
+ */
516
+ cues(sheetId: string, cues: readonly Cue[]): void;
517
+ /**
518
+ * How present mode brings a slide on (`print.transition`: what the slide panel's Transition row sets, the show
519
+ * plays, and the PPTX export writes as the slide's `<p:transition>`).
520
+ */
521
+ transition(sheetId: string, type: TransitionType, duration?: number): void;
522
+ /**
523
+ * Make each text `counts` names count (lib/motion/text-animators.ts `withCounter`: the text rests at the
524
+ * finished figure, formatted), keyed on `text.counter` in its own layer time. Layout is baked again after,
525
+ * since the figure a text rests at is what it is measured with.
526
+ */
527
+ counts(sheetId: string, counts: readonly Count[]): void;
528
+ /** Make each text `swaps` names a word swap (see `Swap`), keyed in its own layer time. */
529
+ swaps(sheetId: string, swaps: readonly Swap[]): void;
530
+ /**
531
+ * Sequence `sheetIds` as the scenes of one composition (id `compId`): each plays its whole timeline, and
532
+ * `transitions[i]` brings in scene i + 1 (lib/motion/author.ts `sceneSequence`). Behind the scenes, `ground`.
533
+ */
534
+ scenes(compId: string, name: string, sheetIds: readonly string[], transitions: readonly (SceneTransition | null | undefined)[], ground?: string): import("../../lib/document/types.js").Composition;
535
+ /** A top-level frame's timeline: duration, frame rate, markers. */
536
+ timeline(sheetId: string, tl: FrameTimeline): void;
537
+ /** Key `path` on `id` (see `animate` in lib/motion/author.ts). */
538
+ animate(id: string, path: string, keys: readonly KeySpec[]): void;
539
+ /**
540
+ * The tangent of the motion path at the position key at `t` (px from the key, broken: the other side is left as
541
+ * it is) — what dragging a dot's handle on the canvas writes (lib/motion/spatial.ts `setDotTangent`).
542
+ */
543
+ pathTangent(id: string, t: number, side: 'in' | 'out', vec: [number, number]): void;
544
+ /** Behaviours on `path` (spin, sine, wiggle…): see `behave` in lib/motion/author.ts. */
545
+ behave(id: string, path: string, modifiers: readonly Modifier[]): void;
546
+ /** Replace `id` with what `fn` makes of it (a preset from lib/motion/presets.ts, say). */
547
+ apply(id: string, fn: (n: AnyNode) => AnyNode): void;
548
+ /** `id` and its subtree start `ms` later (a layer start). */
549
+ delay(id: string, ms: number): void;
550
+ /** `id` staggers its children `ms` apart. */
551
+ stagger(id: string, ms: number, order?: StaggerOrder, more?: Omit<Stagger, 'delay' | 'order'>): void;
552
+ /** `id` set in the text style `name` instead (a variant's smaller headline: same style system, another step). */
553
+ restyle(id: string, name: string): void;
554
+ /** The nodes under `rootId` (inclusive) named `name`, in tree order — how a variant's overrides find things. */
555
+ named(rootId: string, name: string): string[];
556
+ /**
557
+ * Lay the finished master out again at each of `specs`' sizes, beside it, through the same motion-aware
558
+ * magic resize the editor offers (lib/templates/resize.ts): auto layout reflows, off-frame entrances stay
559
+ * off-frame, and each copy's `adjust` then makes the per-size changes by hand. Positions are baked first,
560
+ * so the copies start from what the master really looks like.
561
+ */
562
+ variants(masterId: string, specs: readonly VariantSpec[]): string[];
563
+ /**
564
+ * Make `masterId` responsive from its narrower copies (see `variants`): at each breakpoint the master's layers take
565
+ * what their twins in that copy set differently (lib/document/breakpoints.ts `foldVariant`), so a file made from
566
+ * the widest size reflows in a narrow window and in the web preview. `copies` is breakpoint id → copy, widest first.
567
+ */
568
+ responsive(masterId: string, copies: Record<string, string>): void;
569
+ /** Bake auto-layout positions and settle instance sizes (lib/templates/layout.ts). */
570
+ finish(): Document;
571
+ /**
572
+ * Bake the layout, re-measuring text as it will read (lib/templates/layout.ts `settleMeasuredLayout`): `{{brand.x}}`
573
+ * tokens stand for the brand field's words (what the canvas draws), and a text whose box width the layout changed
574
+ * wraps again at that width, until no text changes size.
575
+ */
576
+ private layout;
577
+ }
578
+ /** The layers `cue` lands on under `rootId`, in the order its names list them (each name's matches in tree order). */
579
+ export declare function cueLayers(doc: Document, rootId: string, cue: Cue): string[];
580
+ /** The layers under `rootId` (inclusive) named `name`, in tree order. */
581
+ export declare function layersNamed(doc: Document, rootId: string, name: string): string[];
582
+ export declare const preset: (id: string) => PagePreset;
@@ -0,0 +1,42 @@
1
+ import type { Kit } from '../kit.js';
2
+ import type { Effect } from '../../../lib/document/types.js';
3
+ /** The devices' own colours, as brand roles (a kit leaves them as they are unless it names them). */
4
+ export declare const DEVICE_COLORS: {
5
+ readonly device: "#101317";
6
+ readonly deviceEdge: "#353B44";
7
+ readonly shell: "#C9CED6";
8
+ readonly shellShade: "#AEB4BD";
9
+ readonly keys: "#2B3037";
10
+ };
11
+ export type DeviceName = 'Phone' | 'Phone back' | 'Tablet' | 'Laptop lid' | 'Laptop lid back' | 'Laptop base';
12
+ /** The phone's box: the screen and the bezel around it. */
13
+ export declare const PHONE: {
14
+ readonly width: number;
15
+ readonly height: number;
16
+ readonly radius: number;
17
+ };
18
+ export declare const TABLET: {
19
+ readonly width: number;
20
+ readonly height: number;
21
+ readonly radius: number;
22
+ };
23
+ export declare const LID: {
24
+ readonly width: number;
25
+ readonly height: number;
26
+ readonly radius: 26;
27
+ };
28
+ export declare const BASE: {
29
+ readonly width: 1420;
30
+ readonly height: 780;
31
+ };
32
+ /** A soft shadow under a device card (literal: an effect colour, not a fill). */
33
+ export declare const deviceShadow: (a?: number, y?: number, blur?: number) => Effect;
34
+ /**
35
+ * Make the devices `names` as components. `screens` gives each device's default screen (a component name from
36
+ * `appScreens`): the phone's, the tablet's and the laptop's.
37
+ */
38
+ export declare function devices(k: Kit, names: readonly DeviceName[], screens?: {
39
+ phone?: string;
40
+ tablet?: string;
41
+ laptop?: string;
42
+ }): void;
@@ -0,0 +1,48 @@
1
+ import type { Kit } from '../kit.js';
2
+ /** The sample app's colours, as brand roles: screen grounds, ink, the app's own primary and accent, and the device. */
3
+ export declare const APP_COLORS: {
4
+ readonly screen: "#F4F7F5";
5
+ readonly surface: "#FFFFFF";
6
+ readonly onScreen: "#0E1A16";
7
+ readonly onScreenMuted: "#51605A";
8
+ readonly line: "#DCE4E0";
9
+ readonly primary: "#0E7C5A";
10
+ readonly onPrimary: "#FFFFFF";
11
+ readonly accent: "#FFB84D";
12
+ readonly onAccent: "#231A05";
13
+ readonly positive: "#0B6B4D";
14
+ readonly track: "#DCE6E1";
15
+ readonly tile: "#E1EEE8";
16
+ readonly photo: "#BCD6CA";
17
+ };
18
+ /** The screens the kit can make. */
19
+ export type ScreenName = 'Welcome' | 'Spreadsheet' | 'Home' | 'Insights' | 'Goals' | 'Send' | 'Screenshot' | 'Tablet' | 'Dashboard';
20
+ /** A phone screen's size (points): iPhone 17. */
21
+ export declare const PHONE_SCREEN: {
22
+ readonly width: 402;
23
+ readonly height: 874;
24
+ readonly radius: 54;
25
+ };
26
+ export declare const TABLET_SCREEN: {
27
+ readonly width: 834;
28
+ readonly height: 1194;
29
+ readonly radius: 30;
30
+ };
31
+ export declare const DESKTOP_SCREEN: {
32
+ readonly width: 1280;
33
+ readonly height: 800;
34
+ readonly radius: 10;
35
+ };
36
+ /** Home's content, top to bottom: what the screen is made of, and what an exploded view takes apart. */
37
+ export declare const HOME_PARTS: readonly ["Greeting", "Balance", "Shortcuts", "Recent activity", "Activity"];
38
+ export type HomePart = typeof HOME_PARTS[number];
39
+ /**
40
+ * One part of Home in `parent` (the screen's column, or a layer of a 3D scene 354 wide): the greeting, the balance
41
+ * card, the shortcuts, the list heading or the activity list. Needs `appScreens(k, ['Home'])` first.
42
+ */
43
+ export declare function homePart(k: Kit, parent: string, part: HomePart): string;
44
+ /**
45
+ * Make the screens `names` (and the parts they use) as components: `Screen / Home` and so on. Returns the component
46
+ * names, in order, for instances and for a device's `Screen` swap.
47
+ */
48
+ export declare function appScreens(k: Kit, names: readonly ScreenName[]): string[];