@flatkit/types 0.35.3 → 0.36.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 +26 -3
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -362,11 +362,19 @@ type Cel = {
362
362
  shapeTween?: boolean;
363
363
  ease?: Easing;
364
364
  };
365
- /** Per-object interaction state exposed to channel expressions as `self.hovered`/`self.grabbed`/`self.pressed` (0/1). */
365
+ /** Per-object interaction state exposed to channel expressions as `self.hovered`/`self.grabbed`/`self.pressed`/`self.focused` (0/1). */
366
366
  type ItemInteractionState = {
367
367
  hovered: number;
368
368
  grabbed: number;
369
369
  pressed: number;
370
+ focused?: number;
371
+ };
372
+ /** `focusable [order <n>] [noring]`: the object takes the KEYBOARD focus (Tab reaches it, Enter/Space click it).
373
+ * `order` = its rank (lower first; unranked ones follow, in document order). `noRing` = the player does not
374
+ * draw its default focus ring on it (the scene draws its own from `self.focused`). */
375
+ type Focusable = {
376
+ order?: number;
377
+ noRing?: boolean;
370
378
  };
371
379
  /** Resolution context (container expressions + guide layer). `itemState` lets channel expressions read the
372
380
  * object's own interaction state (`self.hovered`…); the PLAYER provides it, absent elsewhere (flags → 0).
@@ -390,6 +398,12 @@ type Region = {
390
398
  name?: string;
391
399
  color: string;
392
400
  path: Path;
401
+ poly?: {
402
+ xs: string;
403
+ ys: string;
404
+ count?: string;
405
+ closed?: boolean;
406
+ };
393
407
  paint?: Paint;
394
408
  fillParam?: string;
395
409
  stroke?: Stroke;
@@ -433,6 +447,7 @@ type Group = {
433
447
  expressions?: Partial<Record<BindChannel, string>>;
434
448
  modifiers?: Partial<Record<ExprChannel, ChannelModifier>>;
435
449
  clip?: ClipRect;
450
+ focusable?: Focusable;
436
451
  };
437
452
  /** Instance of a reusable symbol: a transform + a reference to the symbol. */
438
453
  type Instance = {
@@ -447,12 +462,17 @@ type Instance = {
447
462
  noHit?: boolean;
448
463
  pivot?: Point;
449
464
  playback?: InstancePlayback;
465
+ hitbox?: {
466
+ w: number;
467
+ h: number;
468
+ };
450
469
  filters?: Filter[];
451
470
  blend?: BlendMode;
452
471
  expressions?: Partial<Record<BindChannel, string>>;
453
472
  modifiers?: Partial<Record<ExprChannel, ChannelModifier>>;
454
473
  params?: Record<string, string>;
455
474
  clip?: ClipRect;
475
+ focusable?: Focusable;
456
476
  };
457
477
  /** A rectangular clip region in a container's LOCAL coordinates (`clip <x> <y> <w> <h>`). */
458
478
  type ClipRect = {
@@ -490,7 +510,7 @@ type StateMachine = {
490
510
  ease?: Easing;
491
511
  };
492
512
  /** Type of an exposed symbol param. `color` → a fill (`fill <name>`); `number`/`bool` → a scope variable. */
493
- type ParamType = 'color' | 'number' | 'bool';
513
+ type ParamType = 'color' | 'number' | 'bool' | 'text';
494
514
  /**
495
515
  * One exposed param of a symbol — its public, named, defaulted, documented interface. A consumer sets it
496
516
  * at the instance call-site (`instance "Boat" { hull = #fff }`), in `--preview --set`, or (number/bool)
@@ -540,6 +560,7 @@ type Text = {
540
560
  name: string;
541
561
  transform: Transform;
542
562
  content: string;
563
+ contentParam?: string;
543
564
  font: string;
544
565
  size: number;
545
566
  align: 'left' | 'center' | 'right';
@@ -568,6 +589,7 @@ type Text = {
568
589
  blend?: BlendMode;
569
590
  expressions?: Partial<Record<BindChannel, string>>;
570
591
  modifiers?: Partial<Record<ExprChannel, ChannelModifier>>;
592
+ focusable?: Focusable;
571
593
  };
572
594
  /** Bitmap image: a leaf item animatable like text. References an asset; `w`/`h` = intrinsic size in px
573
595
  * (local coords, origin = top-left corner). */
@@ -588,6 +610,7 @@ type Image = {
588
610
  blend?: BlendMode;
589
611
  expressions?: Partial<Record<BindChannel, string>>;
590
612
  modifiers?: Partial<Record<ExprChannel, ChannelModifier>>;
613
+ focusable?: Focusable;
591
614
  };
592
615
  /** Layer content: material, one-off group, symbol instance, text, or image. */
593
616
  type Item = Region | Group | Instance | Text | Image;
@@ -643,4 +666,4 @@ type EditFrame = {
643
666
  };
644
667
  type Tool = 'brush' | 'rect' | 'ellipse' | 'eraser' | 'fill' | 'select' | 'transform' | 'text' | 'pan' | 'pen' | 'pathselect' | 'ink';
645
668
 
646
- export type { Action, Asset, BBox, BindChannel, BlendMode, Cel, ChannelModifier, ClipRect, ContentKey, ContentTrack, Doc, Easing, EditFrame, ExprChannel, ExprContext, Filter, Folder, FrameAction, FrameLabel, FuncDef, Group, Image, Instance, InstanceBind, InstancePlayback, Interaction, Interactor, Item, ItemEvent, ItemInteractionState, Keyframe, Layer, OffsetChannel, Paint, ParamDef, ParamType, Path, PlaybackMode, Point, PolyGroup, Polygon, Pose, Region, ResolveOpts, Ring, Seg, SendPayload, Shape, SoundClip, SpinDir, StateAnchor, StateMachine, Stop, Stroke, Subpath, SymbolDef, Text, TextPath, Timeline, TimelineTrack, Tint, Tool, Transform };
669
+ export type { Action, Asset, BBox, BindChannel, BlendMode, Cel, ChannelModifier, ClipRect, ContentKey, ContentTrack, Doc, Easing, EditFrame, ExprChannel, ExprContext, Filter, Focusable, Folder, FrameAction, FrameLabel, FuncDef, Group, Image, Instance, InstanceBind, InstancePlayback, Interaction, Interactor, Item, ItemEvent, ItemInteractionState, Keyframe, Layer, OffsetChannel, Paint, ParamDef, ParamType, Path, PlaybackMode, Point, PolyGroup, Polygon, Pose, Region, ResolveOpts, Ring, Seg, SendPayload, Shape, SoundClip, SpinDir, StateAnchor, StateMachine, Stop, Stroke, Subpath, SymbolDef, Text, TextPath, Timeline, TimelineTrack, Tint, Tool, Transform };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flatkit/types",
3
- "version": "0.35.3",
3
+ "version": "0.36.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",