@flatkit/types 0.6.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 +44 -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;
@@ -322,6 +327,7 @@ type Region = {
322
327
  color: string;
323
328
  path: Path;
324
329
  paint?: Paint;
330
+ fillParam?: string;
325
331
  stroke?: Stroke;
326
332
  noFill?: boolean;
327
333
  xform?: Transform;
@@ -373,6 +379,7 @@ type Instance = {
373
379
  filters?: Filter[];
374
380
  blend?: BlendMode;
375
381
  expressions?: Partial<Record<ExprChannel, string>>;
382
+ params?: Record<string, string>;
376
383
  };
377
384
  /**
378
385
  * Library folder (pure organization, Flash style): a tree by `parent`. SYMBOLS stay FLAT (referenced by
@@ -384,12 +391,48 @@ type Folder = {
384
391
  parent?: string;
385
392
  collapsed?: boolean;
386
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
+ };
387
428
  /** Reusable definition (Flash MovieClip-style symbol) stored in the library. */
388
429
  type SymbolDef = {
389
430
  id: string;
390
431
  name: string;
391
432
  layers: Layer[];
392
433
  timeline?: Timeline;
434
+ states?: StateMachine[];
435
+ params?: ParamDef[];
393
436
  folderId?: string;
394
437
  };
395
438
  /**
@@ -503,4 +546,4 @@ type EditFrame = {
503
546
  };
504
547
  type Tool = 'brush' | 'rect' | 'ellipse' | 'eraser' | 'fill' | 'select' | 'transform' | 'text' | 'pan' | 'pen' | 'pathselect' | 'ink';
505
548
 
506
- 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.6.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",