@flatkit/types 0.5.0 → 0.7.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 (2) hide show
  1. package/dist/index.d.ts +47 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -203,6 +203,11 @@ type Action = {
203
203
  name: string;
204
204
  index: string;
205
205
  value: string;
206
+ } | {
207
+ do: 'setParam';
208
+ target: string;
209
+ param: string;
210
+ value: string;
206
211
  } | {
207
212
  do: 'if';
208
213
  cond: string;
@@ -283,6 +288,9 @@ type Interactor = {
283
288
  type Pose = {
284
289
  id: string;
285
290
  transform?: Transform;
291
+ rotate?: number;
292
+ scaleX?: number;
293
+ scaleY?: number;
286
294
  opacity?: number;
287
295
  tint?: Tint;
288
296
  spin?: SpinDir;
@@ -319,6 +327,7 @@ type Region = {
319
327
  color: string;
320
328
  path: Path;
321
329
  paint?: Paint;
330
+ fillParam?: string;
322
331
  stroke?: Stroke;
323
332
  noFill?: boolean;
324
333
  xform?: Transform;
@@ -370,6 +379,7 @@ type Instance = {
370
379
  filters?: Filter[];
371
380
  blend?: BlendMode;
372
381
  expressions?: Partial<Record<ExprChannel, string>>;
382
+ params?: Record<string, string>;
373
383
  };
374
384
  /**
375
385
  * Library folder (pure organization, Flash style): a tree by `parent`. SYMBOLS stay FLAT (referenced by
@@ -381,12 +391,48 @@ type Folder = {
381
391
  parent?: string;
382
392
  collapsed?: boolean;
383
393
  };
394
+ /** One named state of a symbol: a label on the symbol's timeline (e.g. `closed at 0`, `open at 24`). */
395
+ type StateAnchor = {
396
+ name: string;
397
+ frame: number;
398
+ };
399
+ /**
400
+ * A symbol's exposed STATE MACHINE: the param `param` selects a named state, which drives the symbol's
401
+ * local playhead to that state's frame. A fractional/animated value between states plays the authored
402
+ * in-between animation (the timeline frames between the two anchors). `transition`/`ease` describe the
403
+ * default move between states (used by the live runtime; metadata for selection).
404
+ */
405
+ type StateMachine = {
406
+ param: string;
407
+ states: StateAnchor[];
408
+ initial?: string;
409
+ transition?: number;
410
+ ease?: Easing;
411
+ };
412
+ /** Type of an exposed symbol param. `color` → a fill (`fill <name>`); `number`/`bool` → a scope variable. */
413
+ type ParamType = 'color' | 'number' | 'bool';
414
+ /**
415
+ * One exposed param of a symbol — its public, named, defaulted, documented interface. A consumer sets it
416
+ * at the instance call-site (`instance "Boat" { hull = #fff }`), in `--preview --set`, or (number/bool)
417
+ * at runtime (`Boat.wave = 1.5`). `color` params feed `fill <name>`; `number`/`bool` become variables in
418
+ * the symbol's expressions.
419
+ */
420
+ type ParamDef = {
421
+ name: string;
422
+ type: ParamType;
423
+ default: string;
424
+ min?: number;
425
+ max?: number;
426
+ doc?: string;
427
+ };
384
428
  /** Reusable definition (Flash MovieClip-style symbol) stored in the library. */
385
429
  type SymbolDef = {
386
430
  id: string;
387
431
  name: string;
388
432
  layers: Layer[];
389
433
  timeline?: Timeline;
434
+ states?: StateMachine[];
435
+ params?: ParamDef[];
390
436
  folderId?: string;
391
437
  };
392
438
  /**
@@ -500,4 +546,4 @@ type EditFrame = {
500
546
  };
501
547
  type Tool = 'brush' | 'rect' | 'ellipse' | 'eraser' | 'fill' | 'select' | 'transform' | 'text' | 'pan' | 'pen' | 'pathselect' | 'ink';
502
548
 
503
- export type { Action, Asset, BBox, BlendMode, Cel, ContentKey, ContentTrack, Doc, Easing, EditFrame, ExprChannel, ExprContext, Filter, Folder, FrameAction, FrameLabel, FuncDef, Group, Image, Instance, InstanceBind, InstancePlayback, Interaction, Interactor, Item, ItemEvent, ItemInteractionState, Keyframe, Layer, Paint, Path, PlaybackMode, Point, PolyGroup, Polygon, Pose, Region, ResolveOpts, Ring, Seg, SendPayload, Shape, SoundClip, SpinDir, Stop, Stroke, Subpath, SymbolDef, Text, Timeline, TimelineTrack, Tint, Tool, Transform };
549
+ export type { Action, Asset, BBox, BlendMode, Cel, ContentKey, ContentTrack, Doc, Easing, EditFrame, ExprChannel, ExprContext, Filter, Folder, FrameAction, FrameLabel, FuncDef, Group, Image, Instance, InstanceBind, InstancePlayback, Interaction, Interactor, Item, ItemEvent, ItemInteractionState, Keyframe, Layer, Paint, ParamDef, ParamType, Path, PlaybackMode, Point, PolyGroup, Polygon, Pose, Region, ResolveOpts, Ring, Seg, SendPayload, Shape, SoundClip, SpinDir, StateAnchor, StateMachine, Stop, Stroke, Subpath, SymbolDef, Text, Timeline, TimelineTrack, Tint, Tool, Transform };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatkit/types",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Shared types for the FlatInk format (Doc, Layer, Item, …). The leaf of the dependency graph.",
5
5
  "license": "MIT",
6
6
  "author": "Zwyk Studio",