animader-cli 0.1.0 → 0.2.1

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.
@@ -0,0 +1,305 @@
1
+ ; animader machine schema - the core state-machine tier (plan 02, phase 1).
2
+ ;
3
+ ; The core forms: `(input ...)`, `(hit-area ...)`, `(listener ...)` with its
4
+ ; slot-local `set`/`fire`, `(layer ...)`, `(state ...)` with its slot-local
5
+ ; `out`/`emit`, and `(transition ...)`. The machine's public surface,
6
+ ; `(output ...)` and `(route ...)`, lives in `schema/bridge.sjon`: a machine
7
+ ; document is validated against the AGGREGATE of both manifests, so an
8
+ ; `out :name` resolves through bridge.sjon's cross-ref target.
9
+ ;
10
+ ; Expressions are opaque here (`:walk-opaque true`): SJON checks the slot's
11
+ ; type and never descends, so an input name inside an expression is the
12
+ ; machine's `expr_invalid` from the load-time dry run, never a SJON
13
+ ; cross-ref diagnostic. Every name a form references (`:layer`, `:entry`,
14
+ ; `:from`, `:to`, `:hit`, `:input`, `out :name`) IS a cross-ref, so an
15
+ ; unresolved one is SJON's `not_cross_ref` with the span and candidate list.
16
+ ;
17
+ ; State names are unique across the whole machine, not per layer: states are
18
+ ; one cross-ref target, so `:from`/`:to`/`:entry` are plain references and a
19
+ ; generated name is unambiguous.
20
+ ;
21
+ ; The phase-5 verb heads (`on`, `hold`, `toggle`, `follow`) lower through the
22
+ ; `animader/<verb>-v1` hooks in `src/hooks/verbs.zig`. Each declares its own
23
+ ; closed `:produces` list; no verb emits a verb, so the produces graph stays
24
+ ; acyclic. The `not` wrapper `toggle` emits is declared as a positional local
25
+ ; of the core `set` (the positional carrier the plugin model blesses) so
26
+ ; `checkLowering` sees it reachable through `set`; `set`'s `:to` keeps its
27
+ ; expression typing, because hand-written listeners write expressions there.
28
+ (plugin :name animader
29
+
30
+ ; ---- value kinds ----
31
+
32
+ (value-kind :name input-kind
33
+ :description "Input kind: a number, a bool, or a trigger armed for exactly one instant."
34
+ :underlying symbol
35
+ :members (member-set :values [number bool trigger]))
36
+
37
+ (value-kind :name input-number
38
+ :description "An input default number; inputs are unitless, so a unit suffix is rejected."
39
+ :underlying number
40
+ :unit (unit-shape :reject true))
41
+
42
+ (value-kind :name input-default
43
+ :description "An input's declared default: a boolean for a bool input, a number for a number input. An omitted default reads 0/false at load."
44
+ :underlying union
45
+ :union (union-shape :alternatives [boolean input-number]))
46
+
47
+ (value-kind :name unit-number
48
+ :description "A number in 0..1, the normalised screen space hit-area rectangles use."
49
+ :underlying number
50
+ :numeric (numeric-bounds :min 0 :max 1)
51
+ :unit (unit-shape :reject true))
52
+
53
+ (value-kind :name rect
54
+ :description "A normalised canvas rectangle [x0 y0 x1 y1]."
55
+ :underlying vector
56
+ :vector (vector-shape :len 4 :element unit-number))
57
+
58
+ (value-kind :name seconds
59
+ :description "A duration in seconds, unit required: `2s`, `1.5s`, `0.5s`. The load stores microseconds."
60
+ :underlying number
61
+ :numeric (numeric-bounds :min 0 :max 1000000000)
62
+ :unit (unit-shape :required true :allowed [s]))
63
+
64
+ (value-kind :name input-ref
65
+ :description "Reference to an (input :name ...) declared in the same document."
66
+ :underlying symbol
67
+ :cross-ref (cross-ref :target input))
68
+
69
+ (value-kind :name hit-area-ref
70
+ :description "Reference to a (hit-area :name ...) declared in the same document."
71
+ :underlying symbol
72
+ :cross-ref (cross-ref :target hit-area))
73
+
74
+ (value-kind :name layer-ref
75
+ :description "Reference to a (layer :name ...) declared in the same document."
76
+ :underlying symbol
77
+ :cross-ref (cross-ref :target layer))
78
+
79
+ (value-kind :name state-ref
80
+ :description "Reference to a (state :name ...) declared in the same document; state names are unique machine-wide."
81
+ :underlying symbol
82
+ :cross-ref (cross-ref :target state))
83
+
84
+ (value-kind :name machine-output-ref
85
+ :description "Reference to an (output :name ...) declared in schema/bridge.sjon, the other half of the machine document's aggregate."
86
+ :underlying symbol
87
+ :cross-ref (cross-ref :target output))
88
+
89
+ (value-kind :name transition-any
90
+ :description "The `any` source of a transition: evaluated after the specific transitions of its layer."
91
+ :underlying symbol
92
+ :members (member-set :values [any]))
93
+
94
+ (value-kind :name transition-from
95
+ :description "A transition source: the `any` symbol or a state reference."
96
+ :underlying scalar-or-ref
97
+ :scalar-or-ref (scalar-or-ref-shape :base transition-any :ref state-ref))
98
+
99
+ (value-kind :name listener-kind
100
+ :description "What a listener selects on: the pointer and key kinds, nothing else. A host-defined event reaches the machine as an (input ...) record instead."
101
+ :underlying symbol
102
+ :members (member-set :values [down move up cancel wheel key]))
103
+
104
+ (value-kind :name transition-ease
105
+ :description "Named ease for a :duration blend: the v1 set, matching pacer's named formulas."
106
+ :underlying symbol
107
+ :members (member-set :values [
108
+ linear
109
+ in-quad
110
+ out-quad
111
+ in-out-quad
112
+ in-cubic
113
+ out-cubic
114
+ in-out-cubic
115
+ in-sine
116
+ out-sine
117
+ in-out-sine
118
+ ]))
119
+
120
+ ; ---- positional head-sets ----
121
+ ; The child forms are declared LOCAL to their parents (the closed
122
+ ; positional-set recipe): `set`/`fire` exist only inside a listener,
123
+ ; `out`/`emit` only inside a state, so neither occupies a global head.
124
+
125
+ (value-kind :name listener-section
126
+ :description "The slot-local children of (listener ...)."
127
+ :underlying form
128
+ :heads (head-set :names [set fire]))
129
+
130
+ (value-kind :name state-section
131
+ :description "The slot-local children of (state ...)."
132
+ :underlying form
133
+ :heads (head-set :names [out emit]))
134
+
135
+ ; =====================================================================
136
+ ; Core forms
137
+ ; =====================================================================
138
+
139
+ (form :name input
140
+ :description "One machine input: the machine's only mutable surface. Numbers are f64 at the snapshot; a trigger is true for exactly one instant."
141
+ (key :name name :type symbol
142
+ :description "Input name; the binding an expression reads.")
143
+ (key :name kind :type input-kind
144
+ :description "number, bool, or trigger.")
145
+ (key :name default :type input-default :optional true
146
+ :description "Declared default. Omitted: 0 for a number, false for a bool. A trigger has no default."))
147
+
148
+ (form :name hit-area
149
+ :description "A declared rectangle in normalised canvas coordinates; a listener's :hit names one."
150
+ (key :name name :type symbol
151
+ :description "Hit-area name; the join key of a listener's :hit.")
152
+ (key :name rect :type rect
153
+ :description "Normalised canvas rectangle [x0 y0 x1 y1]."))
154
+
155
+ (form :name listener
156
+ :description "A pointer or key listener. Its set/fire children run in document order when the event matches :on and :hit."
157
+ :positional listener-section
158
+ (form :name set
159
+ :description "Write one input from an expression over the event environment (event.x/event.y as f64 in 0..1)."
160
+ (key :name input :type input-ref
161
+ :description "The input written.")
162
+ (key :name to :type any :walk-opaque true
163
+ :description "The value expression; its interior is the machine's dry-run business, not SJON's.")
164
+ ; `not` is the one form `toggle` constructs around a carried author
165
+ ; value. It is declared as `set`'s positional local only so
166
+ ; `checkLowering` can resolve `toggle`'s `:produces` entry; `:to` is
167
+ ; walk-opaque, so the final pass never descends into the emitted
168
+ ; `(not I)` and this body declares reachability, not a checked shape.
169
+ ; The positional carrier is deliberate: retyping `:to` as `:type
170
+ ; form` would reject the expressions every hand-written listener
171
+ ; writes there.
172
+ (form :name not
173
+ :description "The boolean negation `toggle` wraps around a carried input name; evaluation resolves it through core's expression-function catalog."
174
+ :positional any))
175
+ (form :name fire
176
+ :description "Arm one trigger input for the event's instant."
177
+ (key :name input :type input-ref
178
+ :description "The trigger input armed."))
179
+ (key :name on :type listener-kind
180
+ :description "The event kind this listener selects.")
181
+ (key :name hit :type hit-area-ref :optional true
182
+ :description "Hit area tested against event.x/event.y; without one the listener matches everywhere."))
183
+
184
+ (form :name layer
185
+ :description "One concurrent layer: a name and the state it starts in. Every state and transition names its layer through :layer."
186
+ (key :name name :type symbol
187
+ :description "Layer name.")
188
+ (key :name entry :type state-ref
189
+ :description "The state the layer starts in."))
190
+
191
+ (form :name state
192
+ :description "One state of a layer: outputs are expressions, emits are entry events. State names are unique across the whole machine."
193
+ :positional state-section
194
+ (form :name out
195
+ :description "Define one output from an expression in the state's environment (number and bool inputs, elapsed, t)."
196
+ (key :name name :type machine-output-ref
197
+ :description "The output defined; an output is owned by exactly one layer.")
198
+ (key :name value :type any :walk-opaque true
199
+ :description "The value expression; its arity is checked against the output's :arity by the load-time dry run."))
200
+ (form :name emit
201
+ :description "An outbound event produced on state entry; returned to the host, never stored."
202
+ (key :name name :type symbol
203
+ :description "Emit name."))
204
+ (key :name name :type symbol
205
+ :description "State name, unique machine-wide.")
206
+ (key :name layer :type layer-ref
207
+ :description "The layer this state belongs to."))
208
+
209
+ (form :name transition
210
+ :description "One transition of one layer. The first whose :when holds and whose :after has elapsed fires; specifics outrank any."
211
+ (key :name layer :type layer-ref
212
+ :description "The layer the transition belongs to.")
213
+ (key :name from :type transition-from
214
+ :description "Source state, or `any` evaluated after the layer's specific transitions.")
215
+ (key :name to :type state-ref
216
+ :description "Target state; it must belong to :layer (transition_cross_layer otherwise).")
217
+ (key :name when :type any :optional true :walk-opaque true
218
+ :description "Condition over the inputs only; elapsed/t here is when_references_time at load.")
219
+ (key :name after :type seconds :optional true
220
+ :description "Exit time: seconds in the source state before the transition may fire.")
221
+ (key :name duration :type seconds :optional true
222
+ :description "Blend duration; the layer's outputs crossfade from the source state to the target over it.")
223
+ (key :name ease :type transition-ease :optional true :default linear
224
+ :description "Ease of the blend; absent is linear. A :default and :requires do not compose (the materialized default would demand :duration on every transition), so an :ease without :duration is simply inert."))
225
+
226
+ ; =====================================================================
227
+ ; Verb tier (plan 02, phase 5)
228
+ ; =====================================================================
229
+ ;
230
+ ; `on`, `hold`, `toggle` and `follow` are surface sugar: each lowers
231
+ ; through its `animader/<verb>-v1` hook into the core records above.
232
+ ; Every emitted head sits on the hook's closed `:produces` list; a
233
+ ; carried author expression has no hook-chosen head and is not checked
234
+ ; (the plugin model's atom rule). `on` declares `do`/`rest` as its
235
+ ; positional locals and no `:positional`, so the slot is untyped and
236
+ ; the leading event-kind symbol rides beside them; the hook reads that
237
+ ; symbol itself. A `do` at the root is nobody's local and stays
238
+ ; `unknown_form`.
239
+
240
+ (value-kind :name verb-set
241
+ :description "A do/rest `:set`: a vector of `(NAME EXPR)` pairs, each an output name and its expression. Opaque to SJON; the verb hook reads the pairs."
242
+ :underlying vector)
243
+
244
+ (form :name on
245
+ :description "An episode: a trigger input, a listener firing it, a layer, one state per `do` plus `N-rest`, and the transitions between them. `:name` is required and seeds every generated name."
246
+ :lowering (lowering :hook animader/on-v1
247
+ :produces [input listener fire layer state out emit transition])
248
+ (form :name do
249
+ :description "One step of the episode: its `:set` outputs are its state's outs, its `:for` is that state's exit time, its `:blend`/`:ease` are the blend into it, its `:emit` is its entry event."
250
+ (key :name for :type seconds
251
+ :description "Exit time in the state this do defines; required.")
252
+ (key :name set :type verb-set :optional true :walk-opaque true
253
+ :description "`(NAME EXPR)` pairs, each becoming an `(out :name NAME :value EXPR)` in the state.")
254
+ (key :name ease :type transition-ease :optional true
255
+ :description "Ease of the blend into this do's state; without a `:blend` it is inert.")
256
+ (key :name blend :type seconds :optional true :requires [ease]
257
+ :description "Blend duration into this do's state; requires `:ease`.")
258
+ (key :name emit :type symbol :optional true
259
+ :description "Entry event of this do's state."))
260
+ (form :name rest
261
+ :description "The episode's resting state: its `:set` outputs are the outs of `<name>-rest`."
262
+ (key :name set :type verb-set :optional true :walk-opaque true
263
+ :description "`(NAME EXPR)` pairs, each becoming an `(out :name NAME :value EXPR)` in the resting state."))
264
+ (key :name name :type symbol
265
+ :description "The verb's name; every generated name is `<name>-1`, `<name>-2`, … and `<name>-rest`.")
266
+ (key :name hit :type hit-area-ref :optional true
267
+ :description "Hit area the firing listener tests; absent matches everywhere."))
268
+
269
+ (form :name hold
270
+ :description "A bool held while a pointer is down: one listener sets it true on `:on`, one sets it false on `:until`."
271
+ :lowering (lowering :hook animader/hold-v1
272
+ :produces [listener set])
273
+ (key :name input :type input-ref
274
+ :description "The bool input written.")
275
+ (key :name on :type listener-kind
276
+ :description "The event that sets the input true.")
277
+ (key :name hit :type hit-area-ref :optional true
278
+ :description "Hit area the `:on` listener tests; absent matches everywhere. The `:until` listener matches everywhere.")
279
+ (key :name until :type listener-kind
280
+ :description "The event that sets the input false."))
281
+
282
+ (form :name toggle
283
+ :description "A bool flipped on an event: one listener writes `(not I)`."
284
+ :lowering (lowering :hook animader/toggle-v1
285
+ :produces [listener set not])
286
+ (key :name input :type input-ref
287
+ :description "The bool input flipped.")
288
+ (key :name on :type listener-kind
289
+ :description "The event that flips the input.")
290
+ (key :name hit :type hit-area-ref :optional true
291
+ :description "Hit area tested; absent matches everywhere."))
292
+
293
+ (form :name follow
294
+ :description "An input tracking an event expression: one listener writes `:from` over `event.x`/`event.y`."
295
+ :lowering (lowering :hook animader/follow-v1
296
+ :produces [listener set])
297
+ (key :name input :type input-ref
298
+ :description "The input written.")
299
+ (key :name on :type listener-kind
300
+ :description "The event that drives the write.")
301
+ (key :name hit :type hit-area-ref :optional true
302
+ :description "Hit area tested; absent matches everywhere.")
303
+ (key :name from :type any :walk-opaque true
304
+ :description "The value expression over event.x/event.y; its interior is the machine's dry-run business, not SJON's."))
305
+ )
@@ -0,0 +1,112 @@
1
+ {
2
+ "format": "animader-schema-snapshot/1",
3
+ "producers": {
4
+ "animader": { "version": "0.0.0" },
5
+ "tempura": { "version": "0.1.0" },
6
+ "pngine": { "version": "4.1.0" }
7
+ },
8
+ "sources": [
9
+ {
10
+ "name": "piece",
11
+ "file": "piece.sjon",
12
+ "owner": "animader",
13
+ "optional": false,
14
+ "bytes": 10963,
15
+ "sha256": "fe1695f5f66223f1d252887fd6dbc2f7c08e4d04268bd1719907050f0ed648de"
16
+ },
17
+ {
18
+ "name": "world",
19
+ "file": "world.sjon",
20
+ "owner": "animader",
21
+ "optional": false,
22
+ "bytes": 12832,
23
+ "sha256": "4fb0815596605032586546af9861041caa0add48eca9c07053ea36b2187c7378"
24
+ },
25
+ {
26
+ "name": "session",
27
+ "file": "session.sjon",
28
+ "owner": "animader",
29
+ "optional": false,
30
+ "bytes": 13189,
31
+ "sha256": "23346c2ebf83b5bf3a42369f56c7f07930ea33b1026a237f9c1e18b4ff904ec0"
32
+ },
33
+ {
34
+ "name": "machine",
35
+ "file": "machine.sjon",
36
+ "owner": "animader",
37
+ "optional": false,
38
+ "bytes": 15716,
39
+ "sha256": "d85a345806a0424014745a803a5298562ce7073a05e5e753407701bf0d9bd6dd"
40
+ },
41
+ {
42
+ "name": "bridge",
43
+ "file": "bridge.sjon",
44
+ "owner": "animader",
45
+ "optional": false,
46
+ "bytes": 4219,
47
+ "sha256": "da882003dd812dc878e4ca0806251f325c0f3e6b052c2c109396fc614f2437ed"
48
+ },
49
+ {
50
+ "name": "tempura",
51
+ "file": "tempura.sjon",
52
+ "owner": "tempura",
53
+ "optional": false,
54
+ "bytes": 32744,
55
+ "sha256": "54f9d9a7f30a5ee77efb090fdc4386603e38ef2970729b166753efae76fcbb8a"
56
+ },
57
+ {
58
+ "name": "midi",
59
+ "file": "midi.sjon",
60
+ "owner": "tempura",
61
+ "optional": false,
62
+ "bytes": 21290,
63
+ "sha256": "c9c29e14ca976f25c35379b8fbcaf0f4ace84db65cf2be364eca7725ffdc9775"
64
+ },
65
+ {
66
+ "name": "it",
67
+ "file": "it.sjon",
68
+ "owner": "tempura",
69
+ "optional": false,
70
+ "bytes": 45006,
71
+ "sha256": "580b42ecb7799de99ff396fb671979bfa67366b4a792960b96c62d1f47ac2765"
72
+ },
73
+ {
74
+ "name": "pacer",
75
+ "file": "pacer.sjon",
76
+ "owner": "tempura",
77
+ "optional": false,
78
+ "bytes": 22655,
79
+ "sha256": "37cffeeaa95b32d0380cd84822264ede3928a7e75e3afca86b531cfe5d95bde0"
80
+ },
81
+ {
82
+ "name": "pngine",
83
+ "file": "pngine.sjon",
84
+ "owner": "pngine",
85
+ "optional": true,
86
+ "bytes": 183654,
87
+ "sha256": "fd8fe786eabfd48a0445cef3e834340b9862cc9ef4886ad0cfe909d142c97e15"
88
+ }
89
+ ],
90
+ "bundles": [
91
+ {
92
+ "name": "timeline",
93
+ "manifests": [
94
+ "piece.sjon",
95
+ "world.sjon",
96
+ "session.sjon",
97
+ "machine.sjon",
98
+ "bridge.sjon",
99
+ "tempura.sjon",
100
+ "midi.sjon",
101
+ "it.sjon",
102
+ "pacer.sjon"
103
+ ]
104
+ },
105
+ {
106
+ "name": "program",
107
+ "manifests": [
108
+ "pngine.sjon"
109
+ ]
110
+ }
111
+ ]
112
+ }