effect-motion 0.4.0 → 0.6.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 (91) hide show
  1. package/README.md +3 -3
  2. package/dist/Camera.d.ts +186 -49
  3. package/dist/Camera.js +343 -76
  4. package/dist/Color.d.ts +101 -1
  5. package/dist/Color.js +101 -1
  6. package/dist/EffectMotionError.d.ts +17 -0
  7. package/dist/EffectMotionError.js +17 -0
  8. package/dist/Entity.d.ts +684 -30
  9. package/dist/Entity.js +281 -27
  10. package/dist/Font.d.ts +108 -0
  11. package/dist/Font.js +95 -0
  12. package/dist/Image.d.ts +71 -0
  13. package/dist/Image.js +50 -0
  14. package/dist/Instance.d.ts +73 -11
  15. package/dist/Instance.js +44 -11
  16. package/dist/Motion.d.ts +328 -53
  17. package/dist/Motion.js +278 -46
  18. package/dist/Physics.d.ts +154 -20
  19. package/dist/Physics.js +92 -11
  20. package/dist/Projection.d.ts +36 -132
  21. package/dist/Projection.js +33 -292
  22. package/dist/Resource.d.ts +26 -0
  23. package/dist/Resource.js +41 -0
  24. package/dist/Runner.d.ts +714 -349
  25. package/dist/Runner.js +197 -150
  26. package/dist/Scene.d.ts +603 -175
  27. package/dist/Scene.js +596 -112
  28. package/dist/Timing.d.ts +170 -13
  29. package/dist/Timing.js +124 -6
  30. package/dist/Tree.d.ts +39 -0
  31. package/dist/Tree.js +127 -0
  32. package/dist/index.d.ts +54 -5
  33. package/dist/index.js +56 -5
  34. package/dist/particles/Particle.d.ts +2 -2
  35. package/dist/particles/ParticleField.d.ts +44 -42
  36. package/dist/particles/ParticleField.js +8 -9
  37. package/dist/particles/constructors.d.ts +5 -6
  38. package/dist/particles/constructors.js +8 -3
  39. package/dist/particles/legacy.d.ts +58 -0
  40. package/dist/particles/legacy.js +46 -0
  41. package/dist/particles/simulate.js +11 -3
  42. package/dist/particles/step.js +14 -10
  43. package/dist/types.d.ts +5 -0
  44. package/dist/types.js +1 -0
  45. package/package.json +58 -60
  46. package/dist/CameraHelpers.d.ts +0 -70
  47. package/dist/CameraHelpers.js +0 -239
  48. package/dist/CanvasExporter.d.ts +0 -12
  49. package/dist/CanvasExporter.js +0 -40
  50. package/dist/Fonts.d.ts +0 -41
  51. package/dist/Fonts.js +0 -27
  52. package/dist/Images.d.ts +0 -33
  53. package/dist/Images.js +0 -24
  54. package/dist/PngExporter.d.ts +0 -6
  55. package/dist/PngExporter.js +0 -85
  56. package/dist/Renderer.d.ts +0 -118
  57. package/dist/Renderer.js +0 -508
  58. package/dist/Shapes.d.ts +0 -11
  59. package/dist/Shapes.js +0 -11
  60. package/dist/demo.d.ts +0 -3
  61. package/dist/demo.js +0 -71
  62. package/dist/render/dof.d.ts +0 -27
  63. package/dist/render/dof.js +0 -37
  64. package/dist/render/paint.d.ts +0 -30
  65. package/dist/render/paint.js +0 -36
  66. package/dist/render/shapes.d.ts +0 -42
  67. package/dist/render/shapes.js +0 -310
  68. package/dist/shapes/Circle.d.ts +0 -32
  69. package/dist/shapes/Circle.js +0 -9
  70. package/dist/shapes/Ellipse.d.ts +0 -35
  71. package/dist/shapes/Ellipse.js +0 -10
  72. package/dist/shapes/Group.d.ts +0 -126
  73. package/dist/shapes/Group.js +0 -89
  74. package/dist/shapes/Hud.d.ts +0 -38
  75. package/dist/shapes/Hud.js +0 -35
  76. package/dist/shapes/Image.d.ts +0 -45
  77. package/dist/shapes/Image.js +0 -28
  78. package/dist/shapes/Line.d.ts +0 -47
  79. package/dist/shapes/Line.js +0 -35
  80. package/dist/shapes/Path.d.ts +0 -107
  81. package/dist/shapes/Path.js +0 -32
  82. package/dist/shapes/Rect.d.ts +0 -51
  83. package/dist/shapes/Rect.js +0 -22
  84. package/dist/shapes/Shape2D.d.ts +0 -49
  85. package/dist/shapes/Shape2D.js +0 -52
  86. package/dist/shapes/Shapes.d.ts +0 -11
  87. package/dist/shapes/Shapes.js +0 -11
  88. package/dist/shapes/Square.d.ts +0 -32
  89. package/dist/shapes/Square.js +0 -11
  90. package/dist/shapes/Text.d.ts +0 -51
  91. package/dist/shapes/Text.js +0 -24
package/dist/Entity.d.ts CHANGED
@@ -1,41 +1,695 @@
1
1
  import * as Schema from "effect/Schema";
2
- import type { AnyStructSchema } from "effect/unstable/workflow/Workflow";
3
- export declare const TypeId: "~motion/Entity";
2
+ import * as Color from "./Color.js";
4
3
  /**
5
- * A trait is a complete get/set lens over the entity's data — all or
6
- * nothing: a lone getter or setter is unrepresentable. `set` receives
7
- * the whole data and returns a new immutable whole with the change
8
- * applied, so each entity owns its semantics (e.g. Line's position
9
- * translates both endpoints).
4
+ * The closed entity world.
5
+ *
6
+ * Every entity the library knows is a member of one tagged union, declared
7
+ * here. There is deliberately no way to define an entity outside this module:
8
+ * an entity's complete field set is derivable from its `_tag` alone, which
9
+ * is what lets the runner, the animators, and the renderer narrow instead
10
+ * of casting.
11
+ *
12
+ * Shared fields come from mixins, never from per-entity declarations, so no
13
+ * entity can quietly omit or rename one. An `Instance` is a REFERENCE to a
14
+ * live entity in the runner tree — see `Instance.ts`.
10
15
  */
11
- export interface TraitLens<Data, Value> {
12
- readonly get: (data: Data) => Value;
13
- readonly set: (data: Data, value: Value) => Data;
14
- }
15
16
  /**
16
- * a type alias (not interface) so it satisfies Record constraints.
17
- * Position is 3D: `z` is depth (0 = the screen plane). 2D shapes default
18
- * z to 0 and read as plain-2D; the camera projects x/y/z to screen.
17
+ * A point or offset in 3D space.
18
+ *
19
+ * @remarks
20
+ * Scene coordinates with depth: `x` right, `y` UP (the mathematical
21
+ * convention), `z` toward the viewer, origin at the viewport center — a
22
+ * right-handed frame. Every axis defaults to 0, so `vec3({ x: 100 })` is a
23
+ * valid horizontal offset.
24
+ *
25
+ * At `z = 0` content renders exactly as flat 2D. Non-zero `z` is only
26
+ * meaningful under a perspective camera, where it changes apparent size and
27
+ * parallax.
19
28
  */
20
- export type Position = {
29
+ export declare const Vec3: Schema.TaggedStruct<"Vec3", {
30
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
31
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
32
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
33
+ }>;
34
+ export type Vec3 = typeof Vec3.Type;
35
+ /**
36
+ * Build a {@link Vec3}; omitted axes are 0.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * Entity.vec3({ x: 100, y: 50 })
41
+ * ```
42
+ */
43
+ export declare const vec3: (input: {
44
+ readonly _tag?: "Vec3";
45
+ readonly x?: number;
46
+ readonly y?: number;
47
+ readonly z?: number;
48
+ }, options?: Schema.MakeOptions) => {
49
+ readonly _tag: "Vec3";
21
50
  readonly x: number;
22
51
  readonly y: number;
23
52
  readonly z: number;
24
53
  };
25
- export type EntityTraits<Data> = {
26
- readonly "~position": TraitLens<Data, Position>;
27
- readonly "~opacity": TraitLens<Data, number>;
54
+ export declare const PathCommand: Schema.TaggedUnion<{
55
+ readonly L: Schema.TaggedStruct<"L", {
56
+ x: Schema.Number;
57
+ y: Schema.Number;
58
+ z: Schema.optionalKey<Schema.Number>;
59
+ }>;
60
+ readonly M: Schema.TaggedStruct<"M", {
61
+ x: Schema.Number;
62
+ y: Schema.Number;
63
+ z: Schema.optionalKey<Schema.Number>;
64
+ }>;
65
+ readonly Z: Schema.TaggedStruct<"Z", {}>;
66
+ }>;
67
+ export type PathCommand = typeof PathCommand.Type;
68
+ /**
69
+ * A segment. `start`/`end` are offsets from `position`, so moving the line
70
+ * translates it rigidly — no endpoint compensation anywhere in the system.
71
+ * Skeletal: parametrized by its endpoints, never by an anchor plus size.
72
+ */
73
+ export declare const Line: Schema.TaggedStruct<"Line", {
74
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
75
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
76
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
77
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
78
+ }>>;
79
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
80
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
81
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
82
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
83
+ }>>;
84
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
85
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
86
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
87
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
88
+ }>>;
89
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
90
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
91
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
92
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
93
+ readonly start: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
94
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
95
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
96
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
97
+ }>>;
98
+ readonly end: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
99
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
100
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
101
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
102
+ }>>;
103
+ }>;
104
+ /**
105
+ * A polyline/polygon. Command points are relative to `position` (see
106
+ * `point`). The first command must be `M` — an open vocabulary of M/L/Z;
107
+ * curves and arcs arrive later via deterministic flattening.
108
+ */
109
+ export declare const Path: Schema.TaggedStruct<"Path", {
110
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
111
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
112
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
113
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
114
+ }>>;
115
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
116
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
117
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
118
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
119
+ }>>;
120
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
121
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
122
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
123
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
124
+ }>>;
125
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
126
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
127
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
128
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
129
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
130
+ readonly commands: Schema.NonEmptyArray<Schema.TaggedUnion<{
131
+ readonly L: Schema.TaggedStruct<"L", {
132
+ x: Schema.Number;
133
+ y: Schema.Number;
134
+ z: Schema.optionalKey<Schema.Number>;
135
+ }>;
136
+ readonly M: Schema.TaggedStruct<"M", {
137
+ x: Schema.Number;
138
+ y: Schema.Number;
139
+ z: Schema.optionalKey<Schema.Number>;
140
+ }>;
141
+ readonly Z: Schema.TaggedStruct<"Z", {}>;
142
+ }>>;
143
+ }>;
144
+ /**
145
+ * The canonical 2.5D plane. All-zero rotation is a camera-facing billboard;
146
+ * non-zero tilts it as a real plane in 3D.
147
+ */
148
+ export declare const Rect: Schema.TaggedStruct<"Rect", {
149
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
150
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
151
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
152
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
153
+ }>>;
154
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
155
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
156
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
157
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
158
+ }>>;
159
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
160
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
161
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
162
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
163
+ }>>;
164
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
165
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
166
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
167
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
168
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
169
+ readonly width: Schema.withConstructorDefault<Schema.Number>;
170
+ readonly height: Schema.withConstructorDefault<Schema.Number>;
171
+ }>;
172
+ /** A filled circle of a given `radius`, centered on its `position`. */
173
+ export declare const Circle: Schema.TaggedStruct<"Circle", {
174
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
175
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
176
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
177
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
178
+ }>>;
179
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
180
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
181
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
182
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
183
+ }>>;
184
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
185
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
186
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
187
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
188
+ }>>;
189
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
190
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
191
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
192
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
193
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
194
+ readonly radius: Schema.withConstructorDefault<Schema.Number>;
195
+ }>;
196
+ /** An ellipse with independent `radiusX` and `radiusY`. */
197
+ export declare const Ellipse: Schema.TaggedStruct<"Ellipse", {
198
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
199
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
200
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
201
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
202
+ }>>;
203
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
204
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
205
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
206
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
207
+ }>>;
208
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
209
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
210
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
211
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
212
+ }>>;
213
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
214
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
215
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
216
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
217
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
218
+ readonly radiusX: Schema.withConstructorDefault<Schema.Number>;
219
+ readonly radiusY: Schema.withConstructorDefault<Schema.Number>;
220
+ }>;
221
+ /**
222
+ * A plain-string text leaf. The engine cannot measure text, so `text` has
223
+ * no dimensional fields — layout is the renderer's business. Inline
224
+ * formatting is expressed by composing several Texts, not by a rich tree.
225
+ */
226
+ export declare const Text: Schema.TaggedStruct<"Text", {
227
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
228
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
229
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
230
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
231
+ }>>;
232
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
233
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
234
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
235
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
236
+ }>>;
237
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
238
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
239
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
240
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
241
+ }>>;
242
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
243
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
244
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
245
+ readonly text: Schema.String;
246
+ readonly fontSize: Schema.withConstructorDefault<Schema.Number>;
247
+ readonly fontFamily: Schema.withConstructorDefault<Schema.TaggedStruct<"effect-motion/Resources/Font", {
248
+ readonly id: Schema.String;
249
+ }>>;
250
+ readonly textAnchor: Schema.optionalKey<Schema.Literals<readonly ["start", "middle", "end"]>>;
251
+ readonly baseline: Schema.optionalKey<Schema.Literals<readonly ["auto", "middle", "hanging"]>>;
252
+ }>;
253
+ /**
254
+ * A container: positions and structures its children, paints nothing
255
+ * itself. Its transform composes down the subtree like any entity's.
256
+ *
257
+ * It carries no composition bounds. `width`/`height`/`backgroundColor` used
258
+ * to live here so `Scene.play` could copy a nested scene's dimensions onto
259
+ * the mount group; a Scene owns those itself, and a render-to-texture
260
+ * boundary is `Scene.play`'s business, not a field on every group.
261
+ */
262
+ export declare const Group: Schema.TaggedStruct<"Group", {
263
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
264
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
265
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
266
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
267
+ }>>;
268
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
269
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
270
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
271
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
272
+ }>>;
273
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
274
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
275
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
276
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
277
+ }>>;
278
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
279
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
280
+ readonly children: Schema.withConstructorDefault<Schema.$Array<Schema.String>>;
281
+ }>;
282
+ /**
283
+ * A screen-space container: its subtree is projected through the identity
284
+ * camera rather than the active one, so HUD content ignores camera
285
+ * movement, zoom, and shake, and always paints on top.
286
+ *
287
+ * `position.z` is depth WITHIN the HUD tier — z consistently means depth in
288
+ * the entity's own coordinate space, world for world content and screen for
289
+ * HUD content. A Hud must be a top-level child of the root (or of another
290
+ * Hud); nesting one inside world content is a loud defect.
291
+ */
292
+ export declare const Hud: Schema.TaggedStruct<"Hud", {
293
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
294
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
295
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
296
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
297
+ }>>;
298
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
299
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
300
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
301
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
302
+ }>>;
303
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
304
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
305
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
306
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
307
+ }>>;
308
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
309
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
310
+ readonly children: Schema.withConstructorDefault<Schema.$Array<Schema.String>>;
311
+ }>;
312
+ /**
313
+ * A raster/vector image leaf. `image` is an Image resource reference; the
314
+ * bytes live in the scene's requirements, never in frame data.
315
+ *
316
+ * `width`/`height` are optional and undefaulted: set BOTH to draw at that
317
+ * size (numeric, so they tween), leave both absent for the source's natural
318
+ * size. A lone dimension is ignored — aspect math needs the natural size,
319
+ * which frame data never sees.
320
+ */
321
+ export declare const Image: Schema.TaggedStruct<"Image", {
322
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
323
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
324
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
325
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
326
+ }>>;
327
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
328
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
329
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
330
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
331
+ }>>;
332
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
333
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
334
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
335
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
336
+ }>>;
337
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
338
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
339
+ readonly image: Schema.TaggedStruct<"effect-motion/Resources/Image", {
340
+ readonly id: Schema.String;
341
+ }>;
342
+ readonly width: Schema.optionalKey<Schema.Number>;
343
+ readonly height: Schema.optionalKey<Schema.Number>;
344
+ }>;
345
+ /**
346
+ * The viewpoint — the one entity that is never drawn.
347
+ *
348
+ * @remarks
349
+ * A camera is view state rather than content, so it carries `position` and
350
+ * `rotation` but no `scale`, `opacity`, or `visible`, and is absent from the
351
+ * frame's instance map. Every scene has one already; reach for it with
352
+ * `Scene.camera`.
353
+ *
354
+ * `focalLength` sets the perspective strength — a longer lens flattens
355
+ * depth, a shorter one exaggerates it. It and the resting `z` are
356
+ * width-relative and filled in by the runner at instantiate time (only the
357
+ * runner knows the composition width), so the zero defaults here are
358
+ * placeholders that are always overwritten. The resting values are chosen so
359
+ * content at `z = 0` renders exactly as flat 2D.
360
+ *
361
+ * `poi` is an optional point of interest: when set, the camera auto-aims at
362
+ * that world point and any explicit `rotation` composes on top of the aim.
363
+ * The `Camera` module's helpers are the ergonomic way to drive it.
364
+ *
365
+ * `aperture` and `focusDistance` drive depth of field. `focusDistance` is
366
+ * the view-space distance to the sharp plane (the runner defaults it to the
367
+ * resting distance, so `z = 0` is in focus). `aperture` is the lens radius in
368
+ * world units; 0 (the default) is a pinhole and bypasses DoF entirely. A
369
+ * point at view distance d blurs to a disc of radius
370
+ * `aperture · |d − focusDistance| / d` world units on the focus plane — at
371
+ * rest, where one world unit is one pixel on that plane, that is its blur
372
+ * radius in pixels. Rack focus is a plain tween of `focusDistance`.
373
+ *
374
+ * Limits: blur is computed from the depth buffer, so it is correct for
375
+ * opaque shapes only — a semi-transparent shape blurs at its own depth, not
376
+ * what shows through it. Perspective cameras only. DoF roughly doubles the
377
+ * scene's draw cost (the scene renders twice per frame).
378
+ */
379
+ export declare const Camera: Schema.TaggedStruct<"Camera", {
380
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
381
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
382
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
383
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
384
+ }>>;
385
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
386
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
387
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
388
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
389
+ }>>;
390
+ readonly focalLength: Schema.withConstructorDefault<Schema.Number>;
391
+ readonly focusDistance: Schema.withConstructorDefault<Schema.Number>;
392
+ readonly aperture: Schema.withConstructorDefault<Schema.Number>;
393
+ readonly poi: Schema.withConstructorDefault<Schema.NullOr<Schema.TaggedStruct<"Vec3", {
394
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
395
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
396
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
397
+ }>>>;
398
+ }>;
399
+ export declare const EntityMap: {
400
+ readonly Line: Schema.TaggedStruct<"Line", {
401
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
402
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
403
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
404
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
405
+ }>>;
406
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
407
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
408
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
409
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
410
+ }>>;
411
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
412
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
413
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
414
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
415
+ }>>;
416
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
417
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
418
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
419
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
420
+ readonly start: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
421
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
422
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
423
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
424
+ }>>;
425
+ readonly end: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
426
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
427
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
428
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
429
+ }>>;
430
+ }>;
431
+ readonly Path: Schema.TaggedStruct<"Path", {
432
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
433
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
434
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
435
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
436
+ }>>;
437
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
438
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
439
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
440
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
441
+ }>>;
442
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
443
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
444
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
445
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
446
+ }>>;
447
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
448
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
449
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
450
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
451
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
452
+ readonly commands: Schema.NonEmptyArray<Schema.TaggedUnion<{
453
+ readonly L: Schema.TaggedStruct<"L", {
454
+ x: Schema.Number;
455
+ y: Schema.Number;
456
+ z: Schema.optionalKey<Schema.Number>;
457
+ }>;
458
+ readonly M: Schema.TaggedStruct<"M", {
459
+ x: Schema.Number;
460
+ y: Schema.Number;
461
+ z: Schema.optionalKey<Schema.Number>;
462
+ }>;
463
+ readonly Z: Schema.TaggedStruct<"Z", {}>;
464
+ }>>;
465
+ }>;
466
+ readonly Rect: Schema.TaggedStruct<"Rect", {
467
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
468
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
469
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
470
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
471
+ }>>;
472
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
473
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
474
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
475
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
476
+ }>>;
477
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
478
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
479
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
480
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
481
+ }>>;
482
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
483
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
484
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
485
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
486
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
487
+ readonly width: Schema.withConstructorDefault<Schema.Number>;
488
+ readonly height: Schema.withConstructorDefault<Schema.Number>;
489
+ }>;
490
+ readonly Circle: Schema.TaggedStruct<"Circle", {
491
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
492
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
493
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
494
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
495
+ }>>;
496
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
497
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
498
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
499
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
500
+ }>>;
501
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
502
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
503
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
504
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
505
+ }>>;
506
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
507
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
508
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
509
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
510
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
511
+ readonly radius: Schema.withConstructorDefault<Schema.Number>;
512
+ }>;
513
+ readonly Ellipse: Schema.TaggedStruct<"Ellipse", {
514
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
515
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
516
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
517
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
518
+ }>>;
519
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
520
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
521
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
522
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
523
+ }>>;
524
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
525
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
526
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
527
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
528
+ }>>;
529
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
530
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
531
+ readonly strokeWidth: Schema.withConstructorDefault<Schema.Number>;
532
+ readonly strokeColor: Schema.withConstructorDefault<typeof Color.Color>;
533
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
534
+ readonly radiusX: Schema.withConstructorDefault<Schema.Number>;
535
+ readonly radiusY: Schema.withConstructorDefault<Schema.Number>;
536
+ }>;
537
+ readonly Text: Schema.TaggedStruct<"Text", {
538
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
539
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
540
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
541
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
542
+ }>>;
543
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
544
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
545
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
546
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
547
+ }>>;
548
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
549
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
550
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
551
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
552
+ }>>;
553
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
554
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
555
+ readonly fillColor: Schema.withConstructorDefault<typeof Color.Color>;
556
+ readonly text: Schema.String;
557
+ readonly fontSize: Schema.withConstructorDefault<Schema.Number>;
558
+ readonly fontFamily: Schema.withConstructorDefault<Schema.TaggedStruct<"effect-motion/Resources/Font", {
559
+ readonly id: Schema.String;
560
+ }>>;
561
+ readonly textAnchor: Schema.optionalKey<Schema.Literals<readonly ["start", "middle", "end"]>>;
562
+ readonly baseline: Schema.optionalKey<Schema.Literals<readonly ["auto", "middle", "hanging"]>>;
563
+ }>;
564
+ readonly Group: Schema.TaggedStruct<"Group", {
565
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
566
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
567
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
568
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
569
+ }>>;
570
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
571
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
572
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
573
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
574
+ }>>;
575
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
576
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
577
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
578
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
579
+ }>>;
580
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
581
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
582
+ readonly children: Schema.withConstructorDefault<Schema.$Array<Schema.String>>;
583
+ }>;
584
+ readonly Hud: Schema.TaggedStruct<"Hud", {
585
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
586
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
587
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
588
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
589
+ }>>;
590
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
591
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
592
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
593
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
594
+ }>>;
595
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
596
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
597
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
598
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
599
+ }>>;
600
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
601
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
602
+ readonly children: Schema.withConstructorDefault<Schema.$Array<Schema.String>>;
603
+ }>;
604
+ readonly Image: Schema.TaggedStruct<"Image", {
605
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
606
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
607
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
608
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
609
+ }>>;
610
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
611
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
612
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
613
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
614
+ }>>;
615
+ readonly scale: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
616
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
617
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
618
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
619
+ }>>;
620
+ readonly opacity: Schema.withConstructorDefault<Schema.Number>;
621
+ readonly visible: Schema.withConstructorDefault<Schema.Boolean>;
622
+ readonly image: Schema.TaggedStruct<"effect-motion/Resources/Image", {
623
+ readonly id: Schema.String;
624
+ }>;
625
+ readonly width: Schema.optionalKey<Schema.Number>;
626
+ readonly height: Schema.optionalKey<Schema.Number>;
627
+ }>;
628
+ readonly Camera: Schema.TaggedStruct<"Camera", {
629
+ readonly position: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
630
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
631
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
632
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
633
+ }>>;
634
+ readonly rotation: Schema.withConstructorDefault<Schema.TaggedStruct<"Vec3", {
635
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
636
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
637
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
638
+ }>>;
639
+ readonly focalLength: Schema.withConstructorDefault<Schema.Number>;
640
+ readonly focusDistance: Schema.withConstructorDefault<Schema.Number>;
641
+ readonly aperture: Schema.withConstructorDefault<Schema.Number>;
642
+ readonly poi: Schema.withConstructorDefault<Schema.NullOr<Schema.TaggedStruct<"Vec3", {
643
+ readonly x: Schema.withConstructorDefault<Schema.Number>;
644
+ readonly y: Schema.withConstructorDefault<Schema.Number>;
645
+ readonly z: Schema.withConstructorDefault<Schema.Number>;
646
+ }>>>;
647
+ }>;
28
648
  };
29
- export type TraitKey = keyof EntityTraits<unknown>;
30
- export interface Entity<Name extends string = string, Data extends Schema.Top = Schema.Top, Traits extends Partial<EntityTraits<Data["Type"]>> = {}> {
31
- readonly [TypeId]: typeof TypeId;
32
- readonly name: Name;
33
- readonly data: Data;
34
- readonly traits: Traits;
35
- }
36
- export type AnyEntity = Entity<any, any, any>;
37
- /** the entity's trait lens, or a defect naming entity and trait */
38
- export declare const traitOrDie: <Data, Value>(entity: AnyEntity, key: TraitKey) => TraitLens<Data, Value>;
39
- type NormalizeStructLike<T extends Schema.Struct.Fields | AnyStructSchema> = T extends AnyStructSchema ? T : T extends Schema.Struct.Fields ? Schema.Struct<T> : never;
40
- export declare const make: <Name extends string, Data extends Schema.Struct.Fields | AnyStructSchema, const Traits extends Partial<EntityTraits<NormalizeStructLike<Data>["Type"]>> = {}>(name: Name, data: Data, traits?: Traits) => Entity<Name, NormalizeStructLike<Data>, Traits>;
649
+ /**
650
+ * Any entity's data — the union of every kind the library knows.
651
+ *
652
+ * @remarks
653
+ * Closed by design: `_tag` identifies the member, so the runner, the
654
+ * animators, and renderers all narrow on it instead of casting. Consumers
655
+ * switch on `_tag` and get the exact field set for that entity.
656
+ */
657
+ export type Entity = (typeof EntityMap)[keyof typeof EntityMap]["Type"];
658
+ /**
659
+ * Every entity kind's name — `"Circle"`, `"Rect"`, `"Text"`, and the rest.
660
+ * This is what you pass to `Scene.instantiate`.
661
+ */
662
+ export type EntityTag = Entity["_tag"];
663
+ /** The data type of one entity kind, selected by its tag. */
664
+ export type EntityByTag<Tag extends EntityTag> = Extract<Entity, {
665
+ _tag: Tag;
666
+ }>;
667
+ /** the definition (schema) of one entity, by tag */
668
+ type EntityDefinitionByTag<Tag extends EntityTag> = (typeof EntityMap)[Tag];
669
+ export declare const getEntityDefinitionByTag: <Tag extends EntityTag>(tag: Tag) => EntityDefinitionByTag<Tag>;
670
+ /**
671
+ * The constructor input for one entity: what `make` accepts, with defaulted
672
+ * fields optional. This is the authoring surface — `instantiate` widens
673
+ * `children` on top of it (see Runner.InstantiateProps).
674
+ */
675
+ export type MakeInput<Tag extends EntityTag> = EntityDefinitionByTag<Tag>["~type.make.in"];
676
+ /**
677
+ * Tags whose entity carries a given field — how animators state their
678
+ * requirements now that traits are gone. `TagsWith<"opacity">` is every
679
+ * paintable entity; `fade` constrains on it, so fading a Camera is a
680
+ * compile error naming the missing field rather than a runtime defect.
681
+ */
682
+ export type TagsWith<Field extends string> = Extract<Entity, Record<Field, unknown>>["_tag"];
683
+ /** The entity kinds that can hold children: `Group` and `Hud`. */
684
+ export type ContainerTag = TagsWith<"children">;
685
+ /** entity data narrowed to a container */
686
+ type ContainerEntity = Extract<Entity, {
687
+ children: ReadonlyArray<string>;
688
+ }>;
689
+ /**
690
+ * Whether an entity can hold children. Previously this was "does its data
691
+ * have a `children` field", answerable only at runtime because entity shapes
692
+ * were unknowable; now it is a property of the tag.
693
+ */
694
+ export declare const isContainer: (entity: Entity) => entity is ContainerEntity;
41
695
  export {};