@getcortexlabs/mavis-core 0.1.0-alpha.7 → 0.1.0-alpha.9
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.
- package/dist/capabilities.d.ts +19 -6
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +17 -3
- package/dist/capabilities.js.map +1 -1
- package/dist/contracts.d.ts +42 -2
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +17 -0
- package/dist/contracts.js.map +1 -1
- package/dist/date-input.d.ts +10 -0
- package/dist/date-input.d.ts.map +1 -0
- package/dist/date-input.js +58 -0
- package/dist/date-input.js.map +1 -0
- package/dist/date-time.d.ts +19 -0
- package/dist/date-time.d.ts.map +1 -0
- package/dist/date-time.js +27 -0
- package/dist/date-time.js.map +1 -0
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +1 -0
- package/dist/dialog.js.map +1 -1
- package/dist/experimental-collections.d.ts +82 -0
- package/dist/experimental-collections.d.ts.map +1 -0
- package/dist/experimental-collections.js +8 -0
- package/dist/experimental-collections.js.map +1 -0
- package/dist/experimental-effects.d.ts +107 -0
- package/dist/experimental-effects.d.ts.map +1 -0
- package/dist/experimental-effects.js +24 -0
- package/dist/experimental-effects.js.map +1 -0
- package/dist/experimental-platforms.d.ts +94 -0
- package/dist/experimental-platforms.d.ts.map +1 -0
- package/dist/experimental-platforms.js +2 -0
- package/dist/experimental-platforms.js.map +1 -0
- package/dist/experimental-playback.d.ts +2 -2
- package/dist/experimental-playback.d.ts.map +1 -1
- package/dist/experimental-regions.d.ts +17 -2
- package/dist/experimental-regions.d.ts.map +1 -1
- package/dist/experimental-regions.js +91 -0
- package/dist/experimental-regions.js.map +1 -1
- package/dist/experimental-sensors.d.ts +42 -0
- package/dist/experimental-sensors.d.ts.map +1 -0
- package/dist/experimental-sensors.js +2 -0
- package/dist/experimental-sensors.js.map +1 -0
- package/dist/experimental-surfaces.d.ts +127 -0
- package/dist/experimental-surfaces.d.ts.map +1 -0
- package/dist/experimental-surfaces.js +2 -0
- package/dist/experimental-surfaces.js.map +1 -0
- package/dist/experimental.d.ts +28 -4
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +266 -1
- package/dist/experimental.js.map +1 -1
- package/dist/grid.d.ts +3 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +16 -0
- package/dist/grid.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +4 -0
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js.map +1 -1
- package/dist/link.d.ts +22 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +41 -0
- package/dist/link.js.map +1 -1
- package/dist/sheet.d.ts +7 -0
- package/dist/sheet.d.ts.map +1 -1
- package/dist/vue/component-props.d.ts +167 -20
- package/dist/vue/component-props.d.ts.map +1 -1
- package/dist/vue/configurator-props.d.ts +26 -0
- package/dist/vue/configurator-props.d.ts.map +1 -1
- package/dist/vue/configurator-props.js +7 -0
- package/dist/vue/configurator-props.js.map +1 -1
- package/dist/vue/configurator.d.ts +1 -1
- package/dist/vue/date-picker.d.ts +40 -5
- package/dist/vue/date-picker.d.ts.map +1 -1
- package/dist/vue/date-picker.js +67 -74
- package/dist/vue/date-picker.js.map +1 -1
- package/dist/vue/date-props.d.ts +9 -0
- package/dist/vue/date-props.d.ts.map +1 -1
- package/dist/vue/date-props.js +1 -0
- package/dist/vue/date-props.js.map +1 -1
- package/dist/vue/global-components.d.ts +3 -2
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +3 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -1
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/loading-effect.d.ts +7 -0
- package/dist/vue/loading-effect.d.ts.map +1 -0
- package/dist/vue/loading-effect.js +32 -0
- package/dist/vue/loading-effect.js.map +1 -0
- package/dist/vue/navigation.d.ts +7 -0
- package/dist/vue/navigation.d.ts.map +1 -0
- package/dist/vue/navigation.js +15 -0
- package/dist/vue/navigation.js.map +1 -0
- package/dist/vue/props.d.ts +280 -43
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +19 -0
- package/dist/vue/props.js.map +1 -1
- package/package.json +1 -1
- package/src/capabilities.ts +17 -3
- package/src/contracts.ts +17 -0
- package/src/date-input.ts +87 -0
- package/src/date-time.ts +37 -0
- package/src/dialog.ts +3 -1
- package/src/experimental-collections.ts +87 -0
- package/src/experimental-effects.ts +146 -0
- package/src/experimental-platforms.ts +96 -0
- package/src/experimental-playback.ts +1 -1
- package/src/experimental-regions.ts +136 -2
- package/src/experimental-sensors.ts +50 -0
- package/src/experimental-surfaces.ts +124 -0
- package/src/experimental.ts +309 -8
- package/src/grid.ts +19 -0
- package/src/index.ts +6 -2
- package/src/input.ts +5 -0
- package/src/link.ts +61 -0
- package/src/sheet.ts +11 -0
- package/src/vue/configurator-props.ts +8 -0
- package/src/vue/date-picker.ts +81 -85
- package/src/vue/date-props.ts +2 -0
- package/src/vue/global-components.ts +3 -2
- package/src/vue/index.ts +3 -0
- package/src/vue/loading-effect.ts +44 -0
- package/src/vue/navigation.ts +16 -0
- package/src/vue/props.ts +21 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { MotionBinding, MotionSurface } from './experimental.js'
|
|
2
|
+
|
|
3
|
+
export interface MotionKeyboardState {
|
|
4
|
+
readonly visible: boolean
|
|
5
|
+
readonly height: number
|
|
6
|
+
readonly duration: number
|
|
7
|
+
readonly backend: 'native' | 'virtual-keyboard' | 'visual-viewport' | 'none'
|
|
8
|
+
readonly accuracy: 'native' | 'exact' | 'estimated' | 'unavailable'
|
|
9
|
+
}
|
|
10
|
+
export interface MotionKeyboard extends MotionBinding {
|
|
11
|
+
snapshot(): MotionKeyboardState
|
|
12
|
+
}
|
|
13
|
+
export interface MotionVector {
|
|
14
|
+
x: number
|
|
15
|
+
y: number
|
|
16
|
+
}
|
|
17
|
+
export interface MotionPhysicsLine {
|
|
18
|
+
color: string
|
|
19
|
+
width?: number
|
|
20
|
+
}
|
|
21
|
+
export interface MotionAttachment {
|
|
22
|
+
anchor: MotionVector
|
|
23
|
+
length?: number
|
|
24
|
+
stiffness?: number
|
|
25
|
+
damping?: number
|
|
26
|
+
line?: MotionPhysicsLine
|
|
27
|
+
}
|
|
28
|
+
export interface MotionPhysicsSnap {
|
|
29
|
+
points: readonly MotionVector[]
|
|
30
|
+
stiffness?: number
|
|
31
|
+
damping?: number
|
|
32
|
+
projection?: number
|
|
33
|
+
}
|
|
34
|
+
export interface MotionPhysicsSpring {
|
|
35
|
+
id: string
|
|
36
|
+
from: string
|
|
37
|
+
to: string
|
|
38
|
+
length: number
|
|
39
|
+
stiffness?: number
|
|
40
|
+
damping?: number
|
|
41
|
+
line?: MotionPhysicsLine
|
|
42
|
+
}
|
|
43
|
+
export interface MotionCircleBody<T = MotionSurface> {
|
|
44
|
+
id: string
|
|
45
|
+
target: T
|
|
46
|
+
radius: number
|
|
47
|
+
x: number
|
|
48
|
+
y: number
|
|
49
|
+
mass?: number
|
|
50
|
+
velocity?: MotionVector
|
|
51
|
+
attachment?: MotionAttachment
|
|
52
|
+
snap?: MotionPhysicsSnap
|
|
53
|
+
drag?:
|
|
54
|
+
| 'direct'
|
|
55
|
+
| {
|
|
56
|
+
type: 'spring'
|
|
57
|
+
length?: number
|
|
58
|
+
stiffness?: number
|
|
59
|
+
damping?: number
|
|
60
|
+
line?: MotionPhysicsLine
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export interface MotionPhysicsOptions {
|
|
64
|
+
gravity?: MotionVector
|
|
65
|
+
restitution?: number
|
|
66
|
+
damping?: number
|
|
67
|
+
reducedMotion?: 'pause' | 'continue'
|
|
68
|
+
springs?: readonly MotionPhysicsSpring[]
|
|
69
|
+
}
|
|
70
|
+
export interface MotionPhysicsSnapshot {
|
|
71
|
+
status: 'running' | 'sleeping' | 'paused' | 'detached' | 'invalid-bounds' | 'disposed'
|
|
72
|
+
frames: number
|
|
73
|
+
steps: number
|
|
74
|
+
contacts: number
|
|
75
|
+
droppedMs: number
|
|
76
|
+
bodies: {
|
|
77
|
+
id: string
|
|
78
|
+
x: number
|
|
79
|
+
y: number
|
|
80
|
+
vx: number
|
|
81
|
+
vy: number
|
|
82
|
+
radius: number
|
|
83
|
+
held: boolean
|
|
84
|
+
}[]
|
|
85
|
+
}
|
|
86
|
+
export interface MotionPhysicsWorld extends MotionBinding {
|
|
87
|
+
readonly paused: boolean
|
|
88
|
+
pause(): void
|
|
89
|
+
resume(): void
|
|
90
|
+
reset(): void
|
|
91
|
+
impulse(id: string, impulse: MotionVector): void
|
|
92
|
+
attach(id: string, attachment: MotionAttachment | null): void
|
|
93
|
+
spring(id: string, spring: Omit<MotionPhysicsSpring, 'id'> | null): void
|
|
94
|
+
snapTo(id: string, index: number): void
|
|
95
|
+
snapshot(): MotionPhysicsSnapshot
|
|
96
|
+
}
|
|
@@ -22,7 +22,7 @@ export interface MotionTimeline extends MotionPlayback {
|
|
|
22
22
|
pause(): void
|
|
23
23
|
resume(): void
|
|
24
24
|
}
|
|
25
|
-
export
|
|
25
|
+
export type MotionValueOptions = MotionOptions & {
|
|
26
26
|
layer?: string
|
|
27
27
|
}
|
|
28
28
|
export interface MotionDecayOptions {
|
|
@@ -10,6 +10,20 @@ import {
|
|
|
10
10
|
type MotionStatesAdapter,
|
|
11
11
|
} from './experimental-playback.js'
|
|
12
12
|
import type { MotionPlayback } from './experimental.js'
|
|
13
|
+
import type {
|
|
14
|
+
MotionKeyboardState,
|
|
15
|
+
MotionKeyboard,
|
|
16
|
+
MotionCircleBody,
|
|
17
|
+
MotionPhysicsOptions,
|
|
18
|
+
MotionPhysicsWorld,
|
|
19
|
+
} from './experimental-platforms.js'
|
|
20
|
+
import {
|
|
21
|
+
mapMotionItems,
|
|
22
|
+
type MotionHeaderOptions,
|
|
23
|
+
type MotionHeader,
|
|
24
|
+
type MotionReorderOptions,
|
|
25
|
+
type MotionReorder,
|
|
26
|
+
} from './experimental-collections.js'
|
|
13
27
|
import {
|
|
14
28
|
motionSurfaceAdapter,
|
|
15
29
|
motionScrollAdapter,
|
|
@@ -82,7 +96,7 @@ export interface MotionSharedPlayback {
|
|
|
82
96
|
stop(): void
|
|
83
97
|
}
|
|
84
98
|
export interface MotionSharedOptions {
|
|
85
|
-
transition?: MotionOptions
|
|
99
|
+
transition?: Exclude<MotionOptions, { type: 'gravity' }>
|
|
86
100
|
layoutTimeout?: number
|
|
87
101
|
}
|
|
88
102
|
export interface MotionSharedLayout extends MotionBinding {
|
|
@@ -90,7 +104,10 @@ export interface MotionSharedLayout extends MotionBinding {
|
|
|
90
104
|
/** Explicit identity; follows replacement of this declared surface. */
|
|
91
105
|
attach(surface: MotionSurface, identity: string): () => void
|
|
92
106
|
/** Host mutation is synchronous; Jolt waits for renderer layout. */
|
|
93
|
-
transition(
|
|
107
|
+
transition(
|
|
108
|
+
change: () => void,
|
|
109
|
+
options?: Exclude<MotionOptions, { type: 'gravity' }>,
|
|
110
|
+
): MotionSharedPlayback
|
|
94
111
|
cancel(): void
|
|
95
112
|
}
|
|
96
113
|
export interface MotionDiagnosticsOptions {
|
|
@@ -134,6 +151,14 @@ type Available = {
|
|
|
134
151
|
onAvailable(setup: () => void | (() => void)): () => void
|
|
135
152
|
}
|
|
136
153
|
export interface MotionRegion extends Available {
|
|
154
|
+
onKeyboard(callback: (state: MotionKeyboardState) => void): MotionKeyboard
|
|
155
|
+
/** Waits for initial native layout; the engine owns simulation and later geometry. */
|
|
156
|
+
physicsWorld(
|
|
157
|
+
bodies: readonly MotionCircleBody[],
|
|
158
|
+
options?: MotionPhysicsOptions,
|
|
159
|
+
): Promise<MotionPhysicsWorld>
|
|
160
|
+
scrollHeader(source: MotionScrollSource, options: MotionHeaderOptions): MotionHeader
|
|
161
|
+
reorder(options: MotionReorderOptions): MotionReorder
|
|
137
162
|
sequence(steps: readonly MotionStep[]): MotionPlayback
|
|
138
163
|
timeline(steps: readonly MotionTimelineStep[]): MotionTimeline
|
|
139
164
|
states<const S extends MotionStateDefinitions>(
|
|
@@ -146,6 +171,18 @@ export interface MotionRegion extends Available {
|
|
|
146
171
|
diagnostics(options: MotionDiagnosticsOptions): MotionDiagnostics
|
|
147
172
|
}
|
|
148
173
|
export interface MotionRegionAdapter {
|
|
174
|
+
onKeyboard?(callback: (state: MotionKeyboardState) => void): Omit<MotionKeyboard, 'disposed'>
|
|
175
|
+
physicsWorld?(
|
|
176
|
+
bodies: readonly MotionCircleBody<MotionSurfaceAdapter>[],
|
|
177
|
+
options?: MotionPhysicsOptions,
|
|
178
|
+
): Promise<Omit<MotionPhysicsWorld, 'disposed'>>
|
|
179
|
+
scrollHeader?(
|
|
180
|
+
source: MotionScrollAdapter,
|
|
181
|
+
options: MotionHeaderOptions<MotionSurfaceAdapter>,
|
|
182
|
+
): Omit<MotionHeader, 'disposed'>
|
|
183
|
+
reorder?(
|
|
184
|
+
options: MotionReorderOptions<MotionSurfaceAdapter, MotionScrollAdapter>,
|
|
185
|
+
): Omit<MotionReorder, 'disposed'>
|
|
149
186
|
readonly kind: 'web' | 'native'
|
|
150
187
|
sequence?(steps: readonly MotionStep<MotionSurfaceAdapter>[]): MotionPlayback
|
|
151
188
|
timeline?(steps: readonly MotionTimelineStep<MotionSurfaceAdapter>[]): MotionPlayback
|
|
@@ -362,6 +399,46 @@ export function createMotionRegion(): MotionRegion {
|
|
|
362
399
|
get available() {
|
|
363
400
|
return Boolean(entry.state?.valid)
|
|
364
401
|
},
|
|
402
|
+
onKeyboard(callback) {
|
|
403
|
+
const state = regionState(region)
|
|
404
|
+
if (!state.adapter.onKeyboard) throw new Error('Keyboard observation is unavailable.')
|
|
405
|
+
return owned(state, state.adapter.onKeyboard(callback))
|
|
406
|
+
},
|
|
407
|
+
async physicsWorld(bodies, options) {
|
|
408
|
+
const state = regionState(region)
|
|
409
|
+
if (!state.adapter.physicsWorld) throw new Error('Circle physics is unavailable.')
|
|
410
|
+
const mapped = bodies.map(({ target, ...body }) => ({
|
|
411
|
+
...body,
|
|
412
|
+
target: motionSurfaceAdapter(target),
|
|
413
|
+
}))
|
|
414
|
+
const raw = await state.adapter.physicsWorld(mapped, options)
|
|
415
|
+
if (
|
|
416
|
+
!state.valid ||
|
|
417
|
+
bodies.some(
|
|
418
|
+
(body, index) =>
|
|
419
|
+
!body.target.available || motionSurfaceAdapter(body.target) !== mapped[index]!.target,
|
|
420
|
+
)
|
|
421
|
+
) {
|
|
422
|
+
raw.dispose()
|
|
423
|
+
throw new Error('Physics presentation changed while waiting for layout.')
|
|
424
|
+
}
|
|
425
|
+
let stop: (() => void) | undefined
|
|
426
|
+
const control = owned(state, {
|
|
427
|
+
...raw,
|
|
428
|
+
get paused() {
|
|
429
|
+
return raw.paused
|
|
430
|
+
},
|
|
431
|
+
dispose() {
|
|
432
|
+
stop?.()
|
|
433
|
+
raw.dispose()
|
|
434
|
+
},
|
|
435
|
+
})
|
|
436
|
+
stop = whenMotionAvailable(
|
|
437
|
+
bodies.map((body) => body.target),
|
|
438
|
+
() => () => control.dispose(),
|
|
439
|
+
)
|
|
440
|
+
return control
|
|
441
|
+
},
|
|
365
442
|
onAvailable(setup) {
|
|
366
443
|
let cleanup: (() => void) | undefined
|
|
367
444
|
const invoke = () => {
|
|
@@ -409,6 +486,63 @@ export function createMotionRegion(): MotionRegion {
|
|
|
409
486
|
}
|
|
410
487
|
},
|
|
411
488
|
sequence: (steps) => group(region, steps, false),
|
|
489
|
+
scrollHeader(source, options) {
|
|
490
|
+
const state = regionState(region)
|
|
491
|
+
if (!state.adapter.scrollHeader) throw new Error('Scroll headers are unavailable.')
|
|
492
|
+
const { header, artwork, title, toolbar, toolbarTitle, section, items, ...rest } = options
|
|
493
|
+
const raw = state.adapter.scrollHeader(motionScrollAdapter(source), {
|
|
494
|
+
...rest,
|
|
495
|
+
header: motionSurfaceAdapter(header),
|
|
496
|
+
artwork: motionSurfaceAdapter(artwork),
|
|
497
|
+
title: motionSurfaceAdapter(title),
|
|
498
|
+
toolbar: motionSurfaceAdapter(toolbar),
|
|
499
|
+
toolbarTitle: motionSurfaceAdapter(toolbarTitle),
|
|
500
|
+
section: motionSurfaceAdapter(section),
|
|
501
|
+
items: () => mapMotionItems(items(), motionSurfaceAdapter),
|
|
502
|
+
})
|
|
503
|
+
let off: (() => void) | undefined
|
|
504
|
+
const control = owned(state, {
|
|
505
|
+
...raw,
|
|
506
|
+
get ready() {
|
|
507
|
+
return raw.ready
|
|
508
|
+
},
|
|
509
|
+
get state() {
|
|
510
|
+
return raw.state
|
|
511
|
+
},
|
|
512
|
+
dispose() {
|
|
513
|
+
off?.()
|
|
514
|
+
raw.dispose()
|
|
515
|
+
},
|
|
516
|
+
})
|
|
517
|
+
off = whenMotionAvailable(
|
|
518
|
+
[source, header, artwork, title, toolbar, toolbarTitle, section],
|
|
519
|
+
() => () => control.dispose(),
|
|
520
|
+
)
|
|
521
|
+
return control
|
|
522
|
+
},
|
|
523
|
+
reorder(options) {
|
|
524
|
+
const state = regionState(region)
|
|
525
|
+
if (!state.adapter.reorder) throw new Error('Interactive reorder is unavailable.')
|
|
526
|
+
const raw = state.adapter.reorder({
|
|
527
|
+
...options,
|
|
528
|
+
scroll: motionScrollAdapter(options.scroll),
|
|
529
|
+
container: motionSurfaceAdapter(options.container),
|
|
530
|
+
items: () => mapMotionItems(options.items(), motionSurfaceAdapter),
|
|
531
|
+
})
|
|
532
|
+
let off: (() => void) | undefined
|
|
533
|
+
const control = owned(state, {
|
|
534
|
+
...raw,
|
|
535
|
+
get activeKey() {
|
|
536
|
+
return raw.activeKey
|
|
537
|
+
},
|
|
538
|
+
dispose() {
|
|
539
|
+
off?.()
|
|
540
|
+
raw.dispose()
|
|
541
|
+
},
|
|
542
|
+
})
|
|
543
|
+
off = whenMotionAvailable([options.scroll, options.container], () => () => control.dispose())
|
|
544
|
+
return control
|
|
545
|
+
},
|
|
412
546
|
timeline: (steps) => group(region, steps, true) as MotionTimeline,
|
|
413
547
|
states(targets, definitions, options) {
|
|
414
548
|
const state = regionState(region)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { MotionBinding, MotionReadable, MotionValueAdapter } from './experimental.js'
|
|
2
|
+
|
|
3
|
+
export type MotionSensorKind = 'rotation' | 'gravity'
|
|
4
|
+
export type MotionSensorStatus =
|
|
5
|
+
| 'idle'
|
|
6
|
+
| 'permission-required'
|
|
7
|
+
| 'starting'
|
|
8
|
+
| 'active'
|
|
9
|
+
| 'paused'
|
|
10
|
+
| 'unavailable'
|
|
11
|
+
| 'denied'
|
|
12
|
+
| 'error'
|
|
13
|
+
| 'replaying'
|
|
14
|
+
| 'disposed'
|
|
15
|
+
export interface MotionSensorOptions {
|
|
16
|
+
interval?: number | 'auto'
|
|
17
|
+
coordinates?: 'device' | 'interface'
|
|
18
|
+
reducedMotion?: 'pause' | 'continue'
|
|
19
|
+
onStatus?: (status: MotionSensorStatus) => void
|
|
20
|
+
}
|
|
21
|
+
export interface MotionSensorSnapshot {
|
|
22
|
+
status: MotionSensorStatus
|
|
23
|
+
available: boolean
|
|
24
|
+
timestamp: number | null
|
|
25
|
+
samples: number
|
|
26
|
+
values: number[]
|
|
27
|
+
backend: 'native' | 'device-orientation' | 'device-motion' | 'none'
|
|
28
|
+
reason?: string
|
|
29
|
+
}
|
|
30
|
+
export interface MotionSensor<T = MotionReadable> extends MotionBinding {
|
|
31
|
+
readonly kind: MotionSensorKind
|
|
32
|
+
readonly status: MotionSensorStatus
|
|
33
|
+
readonly available: boolean
|
|
34
|
+
readonly paused: boolean
|
|
35
|
+
readonly x: T
|
|
36
|
+
readonly y: T
|
|
37
|
+
readonly z: T
|
|
38
|
+
/** Only rotation provides a Hamilton quaternion (xyzw) and recenter. */
|
|
39
|
+
readonly quaternion?: Readonly<{ x: T; y: T; z: T; w: T }>
|
|
40
|
+
recenter(): void
|
|
41
|
+
/** Web may prompt. Native returns not-required, which is not availability. */
|
|
42
|
+
requestPermission(): Promise<'granted' | 'denied' | 'unavailable' | 'not-required'>
|
|
43
|
+
snapshot(): MotionSensorSnapshot
|
|
44
|
+
pause(): void
|
|
45
|
+
resume(): void
|
|
46
|
+
}
|
|
47
|
+
export type MotionSensorAdapter = Omit<
|
|
48
|
+
MotionSensor<Pick<MotionValueAdapter, 'get' | 'dispose'>>,
|
|
49
|
+
'disposed'
|
|
50
|
+
>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { MotionBinding, MotionOptions, MotionPlayback } from './experimental.js'
|
|
2
|
+
import type { MotionControlledPlayback } from './experimental-playback.js'
|
|
3
|
+
|
|
4
|
+
/** The common renderer subset. Distances are CSS pixels on Web and DIPs on native. */
|
|
5
|
+
export interface MotionParticleOptions {
|
|
6
|
+
colors?: readonly string[]
|
|
7
|
+
shape?: 'circle' | 'rectangle' | 'ring'
|
|
8
|
+
source?: 'center' | 'top' | 'bottom'
|
|
9
|
+
rate?: number
|
|
10
|
+
lifetime?: number
|
|
11
|
+
size?: number
|
|
12
|
+
velocity?: number
|
|
13
|
+
velocityRange?: number
|
|
14
|
+
angle?: number
|
|
15
|
+
spread?: number
|
|
16
|
+
gravity?: number
|
|
17
|
+
spin?: number
|
|
18
|
+
spinRange?: number
|
|
19
|
+
fadeOut?: boolean
|
|
20
|
+
duration?: number
|
|
21
|
+
}
|
|
22
|
+
export interface MotionConfettiOptions {
|
|
23
|
+
count?: number
|
|
24
|
+
colors?: readonly string[]
|
|
25
|
+
}
|
|
26
|
+
export interface MotionDecoration extends MotionBinding {
|
|
27
|
+
readonly supported: boolean
|
|
28
|
+
}
|
|
29
|
+
export interface MotionBlurOptions {
|
|
30
|
+
amount?: number
|
|
31
|
+
radius?: number
|
|
32
|
+
style?: 'system' | 'light' | 'dark'
|
|
33
|
+
}
|
|
34
|
+
export interface MotionBlur extends MotionBinding {
|
|
35
|
+
animate(amount: number, options?: MotionOptions): MotionControlledPlayback
|
|
36
|
+
set(amount: number): void
|
|
37
|
+
stop(): void
|
|
38
|
+
snapshot(): { amount: number; appliedAmount: number; backend: string; attached: boolean }
|
|
39
|
+
}
|
|
40
|
+
export interface MotionShapeValues {
|
|
41
|
+
d?: string
|
|
42
|
+
strokeStart?: number
|
|
43
|
+
strokeEnd?: number
|
|
44
|
+
}
|
|
45
|
+
export interface MotionShapeOptions extends MotionShapeValues {
|
|
46
|
+
d: string
|
|
47
|
+
viewBox: readonly [number, number, number, number]
|
|
48
|
+
stroke?: string
|
|
49
|
+
fill?: string
|
|
50
|
+
strokeWidth?: number
|
|
51
|
+
lineCap?: 'butt' | 'round' | 'square'
|
|
52
|
+
lineJoin?: 'miter' | 'round' | 'bevel'
|
|
53
|
+
fillRule?: 'nonzero' | 'evenodd'
|
|
54
|
+
}
|
|
55
|
+
export interface MotionShape extends MotionBinding {
|
|
56
|
+
animate(values: MotionShapeValues, options?: MotionOptions): MotionControlledPlayback
|
|
57
|
+
set(values: MotionShapeValues): void
|
|
58
|
+
stop(): void
|
|
59
|
+
}
|
|
60
|
+
export interface MotionLiquid extends MotionDecoration {
|
|
61
|
+
pause(): void
|
|
62
|
+
resume(): void
|
|
63
|
+
}
|
|
64
|
+
export interface MotionLiquidOptions {
|
|
65
|
+
intensity?: number
|
|
66
|
+
duration?: number
|
|
67
|
+
}
|
|
68
|
+
export type MotionImageEffectName = 'ripple' | 'distortion' | 'dissolve'
|
|
69
|
+
export interface MotionImagePlayback extends MotionControlledPlayback {
|
|
70
|
+
reverse(): void
|
|
71
|
+
finish(): void
|
|
72
|
+
}
|
|
73
|
+
export interface MotionImageEffectOptions {
|
|
74
|
+
origin?: { x: number; y: number }
|
|
75
|
+
amplitude?: number
|
|
76
|
+
radius?: number
|
|
77
|
+
duration?: number
|
|
78
|
+
seed?: number
|
|
79
|
+
/** A source URL, prepared by MImage before starting. Success emits update:src. */
|
|
80
|
+
to?: string
|
|
81
|
+
paused?: boolean
|
|
82
|
+
}
|
|
83
|
+
export type MotionSymbolEffectName = 'bounce' | 'pulse' | 'scale' | 'variableColor'
|
|
84
|
+
export interface MotionSymbolOptions {
|
|
85
|
+
speed?: number
|
|
86
|
+
repeat?: boolean
|
|
87
|
+
}
|
|
88
|
+
export interface MotionKeyboardFollowOptions {
|
|
89
|
+
offset?: number
|
|
90
|
+
}
|
|
91
|
+
export interface MotionSurfaceEffects {
|
|
92
|
+
particles(options?: MotionParticleOptions): MotionDecoration
|
|
93
|
+
confetti(options?: MotionConfettiOptions): MotionDecoration
|
|
94
|
+
blur(options?: MotionBlurOptions): MotionBlur
|
|
95
|
+
shape(options: MotionShapeOptions): MotionShape
|
|
96
|
+
/** Only a loaded MImage target, not its layout wrapper. */
|
|
97
|
+
liquid(options?: MotionLiquidOptions): MotionLiquid
|
|
98
|
+
imageEffect(
|
|
99
|
+
name: MotionImageEffectName,
|
|
100
|
+
options?: MotionImageEffectOptions,
|
|
101
|
+
): Promise<MotionImagePlayback>
|
|
102
|
+
/** MIcon artwork: Web supports glyphs; native requires an iOS system-symbol image. */
|
|
103
|
+
symbolEffect(name: MotionSymbolEffectName, options?: MotionSymbolOptions): MotionPlayback
|
|
104
|
+
/** Use a dedicated, untranslated composer surface. */
|
|
105
|
+
followKeyboard(options?: MotionKeyboardFollowOptions): MotionBinding
|
|
106
|
+
}
|
|
107
|
+
export interface MotionSurfaceEffectsAdapter {
|
|
108
|
+
particles(options?: MotionParticleOptions): Omit<MotionDecoration, 'disposed'>
|
|
109
|
+
confetti(options?: MotionConfettiOptions): Omit<MotionDecoration, 'disposed'>
|
|
110
|
+
blur(options?: MotionBlurOptions): Omit<MotionBlur, 'disposed' | 'animate'> & {
|
|
111
|
+
animate(amount: number, options?: MotionOptions): MotionPlayback
|
|
112
|
+
}
|
|
113
|
+
shape(options: MotionShapeOptions): Omit<MotionShape, 'disposed' | 'animate'> & {
|
|
114
|
+
animate(values: MotionShapeValues, options?: MotionOptions): MotionPlayback
|
|
115
|
+
}
|
|
116
|
+
liquid(options?: MotionLiquidOptions): Omit<MotionLiquid, 'disposed'>
|
|
117
|
+
imageEffect(
|
|
118
|
+
name: MotionImageEffectName,
|
|
119
|
+
options: MotionImageEffectOptions | undefined,
|
|
120
|
+
live: () => boolean,
|
|
121
|
+
): Promise<MotionPlayback>
|
|
122
|
+
symbolEffect(name: MotionSymbolEffectName, options?: MotionSymbolOptions): MotionPlayback
|
|
123
|
+
followKeyboard(options?: MotionKeyboardFollowOptions): { dispose(): void }
|
|
124
|
+
}
|