dioxus-motion-core 0.1.0-alpha.2

Shared serializable motion graph primitives for Dioxus animation packages.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# dioxus-motion-core

Shared serializable motion graph primitives for Dioxus animation packages.

## Install

~~~toml
[dependencies]
dioxus-motion-core = "0.1.0-alpha.1"
~~~

## Release Status

- Current crate version: `0.1.0-alpha.1`.
- Release wave: June 8, 2026 workspace integration update.
- Publish status: First crates.io publish for this package name.
- Scope: Shared serializable motion graph primitives for Dioxus animation packages.
- The README install examples and local workspace dependency requirements are aligned with this publish wave.

## API Syntax Gallery

Generated from the crate's rustdoc JSON so the visible syntax tracks the public API surface used for DX review.

### Checked Import Smoke Test

```rust
extern crate dioxus_motion_core as api;

fn main() {
    let _ = core::any::type_name::<api::Motion>();
}
```

### `crate root`
#### Modules
```text
pub mod prelude;
pub mod dx;
```
#### Constants
```text
pub const DEFAULT_MOTION_DURATION_MS: u32;
pub const DEFAULT_MOTION_STAGGER_MS: u32;
pub const DIOXUS_MOTION_CORE_VERSION: &str;
```
#### Type Aliases
```text
pub type Motion = MotionGraph;
pub type MotionGrp = MotionGroup;
pub type MotionKf = MotionKeyframe;
```
#### Free Functions
```text
motion(id: impl Into<String>) -> MotionGraph
motion_group(id: impl Into<String>) -> MotionGroup
keyframe(offset: f32) -> MotionKeyframe
duration_ms_u32(duration: std::time::Duration) -> u32
duration_ms_u16(duration: std::time::Duration) -> u16
motion_target_ref_borrowed<'a>(id: impl Into<std::borrow::Cow<'a, str>>, package: impl Into<std::borrow::Cow<'a, str>>) -> BorrowedMotionTargetRef<'a>
conservative_motion_group(id: impl Into<String>) -> MotionGroup
balanced_motion_group(id: impl Into<String>) -> MotionGroup
aggressive_motion_group(id: impl Into<String>) -> MotionGroup
motion_cache_key(graph: &MotionGraph, policy: &MotionIntegrationPolicy, route: Option<&str>) -> String
motion_manifest_fragment(graph: &MotionGraph, policy: &MotionIntegrationPolicy, route: impl AsRef<str>) -> MotionManifestFragment
explain_motion_integration(graph: &MotionGraph, policy: &MotionIntegrationPolicy, route: impl AsRef<str>) -> MotionExplainReport
motion_compatibility_matrix() -> Vec<MotionCompatibilityRow>
motion_workertown_offload_plan(graph: &MotionGraph, policy: &MotionIntegrationPolicy, route: impl AsRef<str>) -> MotionOffloadPlan
motion_doctor(graph: &MotionGraph, policy: &MotionIntegrationPolicy) -> MotionDoctorReport
motion_manifest_fragment_with_trace<F>(graph: &MotionGraph, policy: &MotionIntegrationPolicy, route: impl AsRef<str>, trace: F) -> MotionManifestFragment
motion_css_custom_properties(group: &MotionGroup) -> String
serialize_motion_fragment(fragment: &MotionManifestFragment, format: MotionSerializationFormat) -> serde_json::Result<String>
apply_motion_policy_hook<F>(graph: MotionGraph, hook: F) -> Result<MotionGraph, MotionDiagnostic>
batch_motion_manifest(graphs: &[MotionGraph], policy: &MotionIntegrationPolicy, route: impl AsRef<str>) -> Vec<MotionManifestFragment>
process_motion_batch(request: &MotionBatchRequest, policy: &MotionIntegrationPolicy) -> Vec<MotionManifestFragment>
motion_baseline_report(graph: &MotionGraph) -> MotionBaselineReport
compact_motion_dictionary(graph: &MotionGraph) -> std::collections::BTreeMap<String, u16>
validate_motion_graph(graph: &MotionGraph) -> Result<(), MotionValidationError>
```
#### Types, Variants, Fields, and Methods
```text
pub trait DurationDx { ... }
  fn ms(self: Self) -> Duration;
  fn s(self: Self) -> Duration;
pub enum MotionTrigger { ... }
variants: Manual, Load, Visible, AllVisible, AnyVisible, Hover, Click, ScrollProgress, RouteEnter, RouteExit, StateChange
methods:
  value.as_attr() -> &'static str
pub enum MotionPlayback { ... }
variants: Once, Replay, Loop, Yoyo, Reverse, Alternate, Infinite, Count(257)
methods:
  value.as_attr() -> &'static str
pub enum MotionCurve { ... }
variants: Linear, EaseIn, EaseOut, EaseInOut, Spring, CubicBezier(297, 298, 299, 300)
methods:
  value.css_value() -> String
pub enum MotionReducedMotionPolicy { ... }
variants: Initial, Final, Static, Animate, FadeOnly
methods:
  value.as_attr() -> &'static str
pub enum MotionRenderLane { ... }
variants: DomWaapi, LayoutFlip, ViewTransition, WorkerCanvas2d, WorkerTownRender, Text, TextFx, MorphFramePlan, MorphScene
methods:
  value.as_attr() -> &'static str
pub enum MotionTrackKind { ... }
variants: ElementKeyframes, Text, TextFx, MorphConfig, MorphScene, MorphFramePlan, RouteMorph, Custom
methods:
  value.as_attr() -> &'static str
pub struct MotionTargetRef { ... }
fields:
  .id: String
  .package: String
  .selector: Option<String>
methods:
  MotionTargetRef::new(id: impl Into<String>, package: impl Into<String>) -> Self
  value.with_selector(selector: impl Into<String>) -> Self
pub struct MotionKeyframe { ... }
fields:
  .offset: f32
  .values: std::collections::BTreeMap<String, serde_json::Value>
  .curve: Option<MotionCurve>
methods:
  MotionKeyframe::new(offset: f32) -> Self
  value.with_value(key: impl Into<String>, value: serde_json::Value) -> Self
  value.value(key: impl Into<String>, value: serde_json::Value) -> Self
  value.with_curve(curve: MotionCurve) -> Self
  value.curve(curve: MotionCurve) -> Self
pub struct MotionGroup { ... }
fields:
  .id: String
  .trigger: MotionTrigger
  .duration_ms: u32
  .delay_ms: u32
  .stagger_ms: u32
  .curve: MotionCurve
  .playback: MotionPlayback
  .reduced_motion: MotionReducedMotionPolicy
  .render_lanes: Vec<MotionRenderLane>
  .metadata: std::collections::BTreeMap<String, serde_json::Value>
methods:
  MotionGroup::new(id: impl Into<String>) -> Self
  value.with_trigger(trigger: MotionTrigger) -> Self
  value.trigger(trigger: MotionTrigger) -> Self
  value.with_duration_ms(duration_ms: u32) -> Self
  value.dur_ms(duration_ms: u32) -> Self
  value.with_delay_ms(delay_ms: u32) -> Self
  value.delay_ms(delay_ms: u32) -> Self
  value.with_stagger_ms(stagger_ms: u32) -> Self
  value.stagger_ms(stagger_ms: u32) -> Self
  value.with_curve(curve: MotionCurve) -> Self
  value.curve(curve: MotionCurve) -> Self
  value.with_playback(playback: MotionPlayback) -> Self
  value.playback(playback: MotionPlayback) -> Self
  value.with_reduced_motion(policy: MotionReducedMotionPolicy) -> Self
  value.reduced(policy: MotionReducedMotionPolicy) -> Self
  value.with_render_lane(lane: MotionRenderLane) -> Self
  value.lane(lane: MotionRenderLane) -> Self
  value.with_metadata(key: impl Into<String>, value: serde_json::Value) -> Self
  value.meta(key: impl Into<String>, value: serde_json::Value) -> Self
pub struct MotionTrack { ... }
fields:
  .id: String
  .group: String
  .kind: MotionTrackKind
  .target: MotionTargetRef
  .duration_ms: Option<u32>
  .delay_ms: Option<u32>
  .stagger_index: Option<u16>
  .keyframes: Vec<MotionKeyframe>
  .metadata: std::collections::BTreeMap<String, serde_json::Value>
methods:
  MotionTrack::new(id: impl Into<String>, group: impl Into<String>, kind: MotionTrackKind, target: MotionTargetRef) -> Self
  value.with_duration_ms(duration_ms: u32) -> Self
  value.dur_ms(duration_ms: u32) -> Self
  value.with_delay_ms(delay_ms: u32) -> Self
  value.delay_ms(delay_ms: u32) -> Self
  value.with_stagger_index(index: u16) -> Self
  value.stagger(index: u16) -> Self
  value.with_keyframes(keyframes: impl Into<Vec<MotionKeyframe>>) -> Self
  value.frames(keyframes: impl Into<Vec<MotionKeyframe>>) -> Self
  value.with_metadata(key: impl Into<String>, value: serde_json::Value) -> Self
  value.meta(key: impl Into<String>, value: serde_json::Value) -> Self
pub struct MotionGraph { ... }
fields:
  .id: String
  .groups: Vec<MotionGroup>
  .tracks: Vec<MotionTrack>
  .metadata: std::collections::BTreeMap<String, serde_json::Value>
methods:
  MotionGraph::new(id: impl Into<String>) -> Self
  value.with_group(group: MotionGroup) -> Self
  value.group(group: MotionGroup) -> Self
  value.with_track(track: MotionTrack) -> Self
  value.track(track: MotionTrack) -> Self
  value.with_metadata(key: impl Into<String>, value: serde_json::Value) -> Self
  value.meta(key: impl Into<String>, value: serde_json::Value) -> Self
  value.validate() -> Result<(), MotionValidationError>
  value.to_json() -> serde_json::Result<String>
pub enum MotionIntegrationTarget { ... }
variants: Morph, MotionSsr, TextFx, Theme, Timeline, TimelineCore, ViewTx, ViewTxCore, ViewTxSsr, StrataCore, StrataSsr, Resume, ResumeSsr, AssetBudget, CssOpt, HtmlOpt, JsOpt, NativePort, NativePortCore, NativePortCli, WorkerTownCore, WorkerTownSsr, DxrCli, Custom(700)
methods:
  value.package_name() -> &str
pub enum MotionPresetProfile { ... }
variants: Conservative, Balanced, Aggressive
methods:
  value.as_attr() -> &'static str
  value.apply_to_group(group: MotionGroup) -> MotionGroup
pub enum MotionDiagnosticLevel { ... }
variants: Off, Error, Warn, Info, Verbose
pub struct MotionDiagnosticVerbosity { ... }
fields:
  .build: MotionDiagnosticLevel
  .ssr: MotionDiagnosticLevel
  .runtime: MotionDiagnosticLevel
pub struct MotionDiagnostic { ... }
fields:
  .code: String
  .message: String
  .remediation: String
  .level: MotionDiagnosticLevel
  .route: Option<String>
methods:
  MotionDiagnostic::new(code: impl Into<String>, message: impl Into<String>, remediation: impl Into<String>) -> Self
  value.level(level: MotionDiagnosticLevel) -> Self
  value.route(route: impl Into<String>) -> Self
pub struct MotionBudget { ... }
fields:
  .max_bytes: u32
  .max_records: u32
  .max_duration_ms: u32
  .warn_only: bool
pub struct MotionRouteOverride { ... }
fields:
  .route: String
  .enabled: Option<bool>
  .duration_ms: Option<u32>
  .reduced_motion: Option<MotionReducedMotionPolicy>
  .profile: Option<MotionPresetProfile>
  .labels: std::collections::BTreeMap<String, String>
  .tags: Vec<String>
methods:
  MotionRouteOverride::new(route: impl Into<String>) -> Self
  value.enabled(enabled: bool) -> Self
  value.duration_ms(duration_ms: u32) -> Self
  value.reduced_motion(reduced_motion: MotionReducedMotionPolicy) -> Self
  value.profile(profile: MotionPresetProfile) -> Self
  value.label(key: impl Into<String>, value: impl Into<String>) -> Self
  value.tag(tag: impl Into<String>) -> Self
pub struct MotionIntegrationPolicy { ... }
fields:
  .package: String
  .target: MotionIntegrationTarget
  .profile: MotionPresetProfile
  .route_enabled_by_default: bool
  .reduced_motion: MotionReducedMotionPolicy
  .base_path: String
  .config_id: String
  .asset_name: String
  .budget: MotionBudget
  .diagnostics: MotionDiagnosticVerbosity
  .route_overrides: Vec<MotionRouteOverride>
  .labels: std::collections::BTreeMap<String, String>
  .tags: Vec<String>
methods:
  MotionIntegrationPolicy::new(target: MotionIntegrationTarget) -> Self
  value.target_package() -> &str
  value.profile(profile: MotionPresetProfile) -> Self
  value.route_enabled_by_default(enabled: bool) -> Self
  value.reduced_motion(reduced_motion: MotionReducedMotionPolicy) -> Self
  value.base_path(base_path: impl Into<String>) -> Self
  value.ids(config_id: impl Into<String>, asset_name: impl Into<String>) -> Self
  value.budget(budget: MotionBudget) -> Self
  value.diagnostics(diagnostics: MotionDiagnosticVerbosity) -> Self
  value.route_override(route_override: MotionRouteOverride) -> Self
  value.label(key: impl Into<String>, value: impl Into<String>) -> Self
  value.tag(tag: impl Into<String>) -> Self
  value.route_enabled(route: &str) -> bool
  value.route_override_for(route: &str) -> Option<&MotionRouteOverride>
pub struct MotionManifestFragment { ... }
fields:
  .package: String
  .target: String
  .cache_key: String
  .config_ref: String
  .route: String
  .enabled: bool
  .reduced_motion_aware: bool
  .runtime_base_path: String
  .asset_name: String
  .capabilities: Vec<String>
  .labels: std::collections::BTreeMap<String, String>
  .tags: Vec<String>
methods:
  value.to_json() -> serde_json::Result<String>
pub struct MotionExplainReport { ... }
fields:
  .package: String
  .target: String
  .profile: MotionPresetProfile
  .route: String
  .enabled: bool
  .cache_key: String
  .reasons: Vec<String>
  .diagnostics: Vec<MotionDiagnostic>
methods:
  value.to_text() -> String
pub struct MotionCompatibilityRow { ... }
fields:
  .surface: String
  .supported: bool
  .behavior: String
  .validation: String
pub struct MotionOffloadPlan { ... }
fields:
  .package: String
  .route: String
  .worker_task: String
  .cache_key: String
  .serializable: bool
  .fallback: String
  .estimated_operations: u32
  .transfer_fields: Vec<String>
pub struct MotionTraceEvent { ... }
fields:
  .package: String
  .phase: String
  .route: String
  .cache_key: String
  .decision: String
pub struct MotionBatchRequest { ... }
fields:
  .deterministic_parallel: bool
  .route: String
  .graphs: Vec<MotionGraph>
methods:
  MotionBatchRequest::new(route: impl Into<String>, graphs: impl Into<Vec<MotionGraph>>) -> Self
  value.deterministic_parallel(enabled: bool) -> Self
pub struct MotionBaselineReport { ... }
fields:
  .package: String
  .output_bytes: usize
  .group_count: usize
  .track_count: usize
  .keyframe_count: usize
  .estimated_operations: usize
pub enum MotionSerializationFormat { ... }
variants: Json, PrettyJson, CompactJson
pub struct MotionDoctorReport { ... }
fields:
  .ok: bool
  .cache_key: String
  .diagnostics: Vec<MotionDiagnostic>
pub enum MotionPolicyDecision { ... }
variants: Accept(1319), Reject(1321), Rewrite(1323, 1324)
pub trait MotionArtifactCache { ... }
  fn get(self: &Self, key: &str) -> Option<String>;
  fn insert(self: &mut Self, key: String, value: String);
pub struct MotionMemoryCache { ... }
pub struct BorrowedMotionTargetRef { ... }
fields:
  .id: std::borrow::Cow<'a, str>
  .package: std::borrow::Cow<'a, str>
  .selector: Option<std::borrow::Cow<'a, str>>
methods:
  BorrowedMotionTargetRef::new(id: impl Into<Cow<'a, str>>, package: impl Into<Cow<'a, str>>) -> Self
  value.selector(selector: impl Into<Cow<'a, str>>) -> Self
  value.into_owned() -> MotionTargetRef
pub enum MotionValidationError { ... }
variants: DuplicateGroupId(1410), DuplicateTrackId(1412), MissingTrackGroup { track: String, group: String }
```
### `prelude`
#### Re-exports
```text
pub use crate::BorrowedMotionTargetRef as BorrowedMotionTargetRef;
pub use crate::DurationDx as DurationDx;
pub use crate::Motion as Motion;
pub use crate::MotionArtifactCache as MotionArtifactCache;
pub use crate::MotionBaselineReport as MotionBaselineReport;
pub use crate::MotionBatchRequest as MotionBatchRequest;
pub use crate::MotionBudget as MotionBudget;
pub use crate::MotionCompatibilityRow as MotionCompatibilityRow;
pub use crate::MotionCurve as MotionCurve;
pub use crate::MotionDiagnostic as MotionDiagnostic;
pub use crate::MotionDiagnosticLevel as MotionDiagnosticLevel;
pub use crate::MotionDiagnosticVerbosity as MotionDiagnosticVerbosity;
pub use crate::MotionDoctorReport as MotionDoctorReport;
pub use crate::MotionExplainReport as MotionExplainReport;
pub use crate::MotionGraph as MotionGraph;
pub use crate::MotionGroup as MotionGroup;
pub use crate::MotionGrp as MotionGrp;
pub use crate::MotionIntegrationPolicy as MotionIntegrationPolicy;
pub use crate::MotionIntegrationTarget as MotionIntegrationTarget;
pub use crate::MotionKeyframe as MotionKeyframe;
pub use crate::MotionKf as MotionKf;
pub use crate::MotionManifestFragment as MotionManifestFragment;
pub use crate::MotionMemoryCache as MotionMemoryCache;
pub use crate::MotionOffloadPlan as MotionOffloadPlan;
pub use crate::MotionPlayback as MotionPlayback;
pub use crate::MotionPolicyDecision as MotionPolicyDecision;
pub use crate::MotionPresetProfile as MotionPresetProfile;
pub use crate::MotionReducedMotionPolicy as MotionReducedMotionPolicy;
pub use crate::MotionRenderLane as MotionRenderLane;
pub use crate::MotionRouteOverride as MotionRouteOverride;
pub use crate::MotionSerializationFormat as MotionSerializationFormat;
pub use crate::MotionTargetRef as MotionTargetRef;
pub use crate::MotionTraceEvent as MotionTraceEvent;
pub use crate::MotionTrack as MotionTrack;
pub use crate::MotionTrackKind as MotionTrackKind;
pub use crate::MotionTrigger as MotionTrigger;
pub use crate::aggressive_motion_group as aggressive_motion_group;
pub use crate::apply_motion_policy_hook as apply_motion_policy_hook;
pub use crate::balanced_motion_group as balanced_motion_group;
pub use crate::batch_motion_manifest as batch_motion_manifest;
pub use crate::compact_motion_dictionary as compact_motion_dictionary;
pub use crate::conservative_motion_group as conservative_motion_group;
pub use crate::duration_ms_u16 as duration_ms_u16;
pub use crate::duration_ms_u32 as duration_ms_u32;
pub use crate::explain_motion_integration as explain_motion_integration;
pub use crate::keyframe as keyframe;
pub use crate::motion as motion;
pub use crate::motion_baseline_report as motion_baseline_report;
pub use crate::motion_cache_key as motion_cache_key;
pub use crate::motion_compatibility_matrix as motion_compatibility_matrix;
pub use crate::motion_css_custom_properties as motion_css_custom_properties;
pub use crate::motion_doctor as motion_doctor;
pub use crate::motion_group as motion_group;
pub use crate::motion_manifest_fragment as motion_manifest_fragment;
pub use crate::motion_manifest_fragment_with_trace as motion_manifest_fragment_with_trace;
pub use crate::motion_target_ref_borrowed as motion_target_ref_borrowed;
pub use crate::motion_workertown_offload_plan as motion_workertown_offload_plan;
pub use crate::process_motion_batch as process_motion_batch;
pub use crate::serialize_motion_fragment as serialize_motion_fragment;
```
### `dx`
#### Re-exports
```text
pub use crate::DurationDx as DurationDx;
pub use crate::duration_ms_u16 as duration_ms_u16;
pub use crate::duration_ms_u32 as duration_ms_u32;
```

## Integration policy helpers

`MotionIntegrationPolicy` packages the shared knobs used by Motion, Timeline,
ViewTX, SSR, native-port, Strata, and CLI/audit tooling:

- stable `motion_cache_key` inputs for route/component reuse
- route-level enable/disable overrides and labels/tags
- conservative, balanced, and aggressive preset profiles
- reduced-motion-aware manifest fragments and explain/doctor reports
- compatibility matrix rows for web, server, native, and CLI surfaces