@getcortexlabs/mavis-core 0.1.0-alpha.5 → 0.1.0-alpha.6
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/app-icons.d.ts +27 -0
- package/dist/app-icons.d.ts.map +1 -0
- package/dist/app-icons.js +42 -0
- package/dist/app-icons.js.map +1 -0
- package/dist/capabilities.d.ts +7 -7
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +6 -4
- package/dist/capabilities.js.map +1 -1
- package/dist/contracts.d.ts +61 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +8 -1
- package/dist/contracts.js.map +1 -1
- package/dist/experimental-playback.d.ts +63 -0
- package/dist/experimental-playback.d.ts.map +1 -0
- package/dist/experimental-playback.js +46 -0
- package/dist/experimental-playback.js.map +1 -0
- package/dist/experimental-regions.d.ts +12 -0
- package/dist/experimental-regions.d.ts.map +1 -1
- package/dist/experimental-regions.js +125 -0
- package/dist/experimental-regions.js.map +1 -1
- package/dist/experimental.d.ts +29 -2
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +47 -7
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/link.d.ts +12 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +19 -0
- package/dist/link.js.map +1 -0
- package/dist/motion.d.ts +29 -4
- package/dist/motion.d.ts.map +1 -1
- package/dist/motion.js +55 -3
- package/dist/motion.js.map +1 -1
- package/dist/responsive.d.ts +18 -0
- package/dist/responsive.d.ts.map +1 -0
- package/dist/responsive.js +35 -0
- package/dist/responsive.js.map +1 -0
- package/dist/theme/themes.js +3 -3
- package/dist/theme/themes.js.map +1 -1
- package/dist/theme/types.d.ts +12 -3
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/vue/component-props.d.ts +187 -0
- package/dist/vue/component-props.d.ts.map +1 -1
- package/dist/vue/contracts.d.ts.map +1 -1
- package/dist/vue/contracts.js +7 -1
- package/dist/vue/contracts.js.map +1 -1
- package/dist/vue/date-picker.d.ts +42 -4
- package/dist/vue/date-picker.d.ts.map +1 -1
- package/dist/vue/date-picker.js +28 -6
- 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 +3 -0
- package/dist/vue/date-props.js.map +1 -1
- package/dist/vue/global-components.d.ts +5 -0
- package/dist/vue/global-components.d.ts.map +1 -1
- package/dist/vue/index.d.ts +4 -2
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -2
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/layout-context.d.ts +4 -2
- package/dist/vue/layout-context.d.ts.map +1 -1
- package/dist/vue/layout-context.js +7 -2
- package/dist/vue/layout-context.js.map +1 -1
- package/dist/vue/props.d.ts +365 -0
- package/dist/vue/props.d.ts.map +1 -1
- package/dist/vue/props.js +25 -1
- package/dist/vue/props.js.map +1 -1
- package/dist/vue/reveal-state.d.ts +18 -0
- package/dist/vue/reveal-state.d.ts.map +1 -0
- package/dist/vue/reveal-state.js +76 -0
- package/dist/vue/reveal-state.js.map +1 -0
- package/dist/vue/theme.d.ts +42 -0
- package/dist/vue/theme.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app-icons.ts +57 -0
- package/src/capabilities.ts +6 -4
- package/src/contracts.ts +12 -2
- package/src/experimental-playback.ts +115 -0
- package/src/experimental-regions.ts +151 -0
- package/src/experimental.ts +81 -9
- package/src/index.ts +6 -1
- package/src/link.ts +28 -0
- package/src/motion.ts +61 -3
- package/src/responsive.ts +61 -0
- package/src/theme/themes.ts +3 -3
- package/src/theme/types.ts +13 -1
- package/src/vue/contracts.ts +7 -1
- package/src/vue/date-picker.ts +33 -6
- package/src/vue/date-props.ts +3 -0
- package/src/vue/global-components.ts +5 -1
- package/src/vue/index.ts +6 -1
- package/src/vue/layout-context.ts +10 -3
- package/src/vue/props.ts +27 -1
- package/src/vue/reveal-state.ts +83 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal-state.js","sourceRoot":"","sources":["../../src/vue/reveal-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAU/D,wFAAwF;AACxF,MAAM,UAAU,cAAc,CAAC,IAAmB;IAChD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IAC3B,MAAM,KAAK,GAAG,GAAG,CAA4C,IAAI,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACxF,IAAI,IAA4B,CAAA;IAChC,IAAI,QAAuD,CAAA;IAC3D,IAAI,QAAQ,GAAG,CAAC,CAAA;IAChB,IAAI,KAAK,GAAG,KAAK,CAAA;IACjB,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE;QAC/B,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAA;QACtC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAA;IACtB,CAAC,CAAA;IACD,SAAS,GAAG,CAAC,IAAa;QACxB,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,MAAM,OAAO,GAAG,EAAE,QAAQ,CAAA;QAC1B,IAAI,IAAI;YAAE,IAAI,CAAC,YAAY,EAAE,CAAA;;YACxB,IAAI,CAAC,YAAY,EAAE,CAAA;QACxB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QACtB,+EAA+E;QAC/E,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACpC,KAAK,GAAG,KAAK,CAAA;QACb,OAAO,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAC3B,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,IAAI,EAAE,CAAA;YAChB,QAAQ,GAAG,SAAS,CAAA;YACpB,IAAI,EAAE,OAAO,EAAE,CAAA;YACf,IAAI,GAAG,IAAI,CAAA;YACX,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;gBAAE,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;;gBACzE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;QAC/B,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/vue/theme.d.ts
CHANGED
|
@@ -199,6 +199,13 @@ export declare function createThemeContext(options?: MavisTheme | ThemeContextOp
|
|
|
199
199
|
};
|
|
200
200
|
readonly motion: {
|
|
201
201
|
readonly pressScale: number;
|
|
202
|
+
readonly pressDuration: number;
|
|
203
|
+
readonly releaseDuration: number;
|
|
204
|
+
readonly releaseBounce: number;
|
|
205
|
+
readonly enterDuration: number;
|
|
206
|
+
readonly exitDuration: number;
|
|
207
|
+
readonly enterOffset: number;
|
|
208
|
+
readonly ease: import("../index.js").MotionEase;
|
|
202
209
|
};
|
|
203
210
|
}, {
|
|
204
211
|
readonly name: string;
|
|
@@ -385,6 +392,13 @@ export declare function createThemeContext(options?: MavisTheme | ThemeContextOp
|
|
|
385
392
|
};
|
|
386
393
|
readonly motion: {
|
|
387
394
|
readonly pressScale: number;
|
|
395
|
+
readonly pressDuration: number;
|
|
396
|
+
readonly releaseDuration: number;
|
|
397
|
+
readonly releaseBounce: number;
|
|
398
|
+
readonly enterDuration: number;
|
|
399
|
+
readonly exitDuration: number;
|
|
400
|
+
readonly enterOffset: number;
|
|
401
|
+
readonly ease: import("../index.js").MotionEase;
|
|
388
402
|
};
|
|
389
403
|
}>>;
|
|
390
404
|
themes: Readonly<import("@vue/reactivity").Ref<{
|
|
@@ -573,6 +587,13 @@ export declare function createThemeContext(options?: MavisTheme | ThemeContextOp
|
|
|
573
587
|
};
|
|
574
588
|
readonly motion: {
|
|
575
589
|
readonly pressScale: number;
|
|
590
|
+
readonly pressDuration: number;
|
|
591
|
+
readonly releaseDuration: number;
|
|
592
|
+
readonly releaseBounce: number;
|
|
593
|
+
readonly enterDuration: number;
|
|
594
|
+
readonly exitDuration: number;
|
|
595
|
+
readonly enterOffset: number;
|
|
596
|
+
readonly ease: import("../index.js").MotionEase;
|
|
576
597
|
};
|
|
577
598
|
} | undefined;
|
|
578
599
|
readonly dark?: {
|
|
@@ -760,6 +781,13 @@ export declare function createThemeContext(options?: MavisTheme | ThemeContextOp
|
|
|
760
781
|
};
|
|
761
782
|
readonly motion: {
|
|
762
783
|
readonly pressScale: number;
|
|
784
|
+
readonly pressDuration: number;
|
|
785
|
+
readonly releaseDuration: number;
|
|
786
|
+
readonly releaseBounce: number;
|
|
787
|
+
readonly enterDuration: number;
|
|
788
|
+
readonly exitDuration: number;
|
|
789
|
+
readonly enterOffset: number;
|
|
790
|
+
readonly ease: import("../index.js").MotionEase;
|
|
763
791
|
};
|
|
764
792
|
} | undefined;
|
|
765
793
|
}, {
|
|
@@ -948,6 +976,13 @@ export declare function createThemeContext(options?: MavisTheme | ThemeContextOp
|
|
|
948
976
|
};
|
|
949
977
|
readonly motion: {
|
|
950
978
|
readonly pressScale: number;
|
|
979
|
+
readonly pressDuration: number;
|
|
980
|
+
readonly releaseDuration: number;
|
|
981
|
+
readonly releaseBounce: number;
|
|
982
|
+
readonly enterDuration: number;
|
|
983
|
+
readonly exitDuration: number;
|
|
984
|
+
readonly enterOffset: number;
|
|
985
|
+
readonly ease: import("../index.js").MotionEase;
|
|
951
986
|
};
|
|
952
987
|
} | undefined;
|
|
953
988
|
readonly dark?: {
|
|
@@ -1135,6 +1170,13 @@ export declare function createThemeContext(options?: MavisTheme | ThemeContextOp
|
|
|
1135
1170
|
};
|
|
1136
1171
|
readonly motion: {
|
|
1137
1172
|
readonly pressScale: number;
|
|
1173
|
+
readonly pressDuration: number;
|
|
1174
|
+
readonly releaseDuration: number;
|
|
1175
|
+
readonly releaseBounce: number;
|
|
1176
|
+
readonly enterDuration: number;
|
|
1177
|
+
readonly exitDuration: number;
|
|
1178
|
+
readonly enterOffset: number;
|
|
1179
|
+
readonly ease: import("../index.js").MotionEase;
|
|
1138
1180
|
};
|
|
1139
1181
|
} | undefined;
|
|
1140
1182
|
}>>;
|
package/dist/vue/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/vue/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;AACjD,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,QAAQ,CAAA;AAElD,gHAAgH;AAChH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,UAAU,GAAG,SAAS,CAAA;IACjC,OAAO,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CAChE;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AASD,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,UAAU,GAAG,mBAAwB
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/vue/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,YAAY,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+B7E,6FAA6F;;wBAEzE,cAAc;IAIlC,2EAA2E;mBAC5D,UAAU;;EAS5B;AACD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAErE,eAAO,MAAM,QAAQ,EAAE,YAAY,CAAC,iBAAiB,CAAyB,CAAA;AAE9E,kFAAkF;AAClF,wBAAgB,aAAa,IAAI,iBAAiB,CAEjD"}
|
package/package.json
CHANGED
package/src/app-icons.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface AppIconChoice {
|
|
2
|
+
id: string
|
|
3
|
+
label: string
|
|
4
|
+
}
|
|
5
|
+
export interface AppIconAdapter {
|
|
6
|
+
supported(): boolean
|
|
7
|
+
current(): string | undefined
|
|
8
|
+
select(id: string): Promise<void>
|
|
9
|
+
}
|
|
10
|
+
export class AppIconError extends Error {
|
|
11
|
+
constructor(
|
|
12
|
+
public readonly code: 'unsupported' | 'configuration' | 'unknown-icon' | 'platform',
|
|
13
|
+
message: string,
|
|
14
|
+
options?: ErrorOptions,
|
|
15
|
+
) {
|
|
16
|
+
super(message, options)
|
|
17
|
+
this.name = 'AppIconError'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The OS stores selection. Requests are serialized; a rejected request does not block later ones. */
|
|
22
|
+
export function createAppIconController(
|
|
23
|
+
choices: readonly AppIconChoice[],
|
|
24
|
+
primary: string,
|
|
25
|
+
adapter: AppIconAdapter,
|
|
26
|
+
) {
|
|
27
|
+
const ids = new Set<string>()
|
|
28
|
+
for (const choice of choices) {
|
|
29
|
+
if (!choice.id.trim() || !choice.label.trim() || ids.has(choice.id))
|
|
30
|
+
throw new AppIconError('configuration', 'App icons need unique IDs and visible labels.')
|
|
31
|
+
ids.add(choice.id)
|
|
32
|
+
}
|
|
33
|
+
if (!ids.has(primary))
|
|
34
|
+
throw new AppIconError('configuration', 'The primary icon must be configured.')
|
|
35
|
+
let pending = Promise.resolve()
|
|
36
|
+
const select = (id: string): Promise<void> => {
|
|
37
|
+
if (!ids.has(id))
|
|
38
|
+
return Promise.reject(new AppIconError('unknown-icon', `Unknown app icon: ${id}`))
|
|
39
|
+
const task = pending.then(async () => {
|
|
40
|
+
if (!adapter.supported())
|
|
41
|
+
throw new AppIconError('unsupported', 'This runtime cannot change its launcher icon.')
|
|
42
|
+
if (adapter.current() === id) return
|
|
43
|
+
await adapter.select(id)
|
|
44
|
+
})
|
|
45
|
+
pending = task.catch(() => {})
|
|
46
|
+
return task
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
choices: Object.freeze(choices.map((choice) => Object.freeze({ ...choice }))),
|
|
50
|
+
primary,
|
|
51
|
+
supported: () => adapter.supported(),
|
|
52
|
+
current: () => adapter.current(),
|
|
53
|
+
select,
|
|
54
|
+
reset: () => select(primary),
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export type AppIconController = ReturnType<typeof createAppIconController>
|
package/src/capabilities.ts
CHANGED
|
@@ -3,6 +3,8 @@ export const componentNames = [
|
|
|
3
3
|
'MScreen',
|
|
4
4
|
'MRow',
|
|
5
5
|
'MColumn',
|
|
6
|
+
'MStack',
|
|
7
|
+
'MLink',
|
|
6
8
|
'MBox',
|
|
7
9
|
'MCard',
|
|
8
10
|
'MText',
|
|
@@ -47,7 +49,7 @@ export type CapabilityStatus = 'experimental' | 'planned' | 'unsupported' | 'unv
|
|
|
47
49
|
export const targetCapabilities = {
|
|
48
50
|
version: 1,
|
|
49
51
|
source: 'repository',
|
|
50
|
-
publishedBaseline: '0.1.0-alpha.
|
|
52
|
+
publishedBaseline: '0.1.0-alpha.5',
|
|
51
53
|
targets: [
|
|
52
54
|
{
|
|
53
55
|
id: 'vue-web',
|
|
@@ -64,9 +66,9 @@ export const targetCapabilities = {
|
|
|
64
66
|
streaming: 'unverified',
|
|
65
67
|
rsc: 'unsupported',
|
|
66
68
|
},
|
|
67
|
-
motion: { engine: 'jolt', minimum: '0.1.0-rc.
|
|
69
|
+
motion: { engine: 'jolt', minimum: '0.1.0-rc.8', start: 'client-mount' },
|
|
68
70
|
ssr: {
|
|
69
|
-
availability: '
|
|
71
|
+
availability: '0.1.0-alpha.5',
|
|
70
72
|
host: 'nuxt',
|
|
71
73
|
hostVersion: '4.6.3',
|
|
72
74
|
vueVersion: '3.5.44',
|
|
@@ -107,7 +109,7 @@ export const targetCapabilities = {
|
|
|
107
109
|
streaming: 'unsupported',
|
|
108
110
|
rsc: 'unsupported',
|
|
109
111
|
},
|
|
110
|
-
motion: { engine: 'jolt', minimum: '0.1.0-rc.
|
|
112
|
+
motion: { engine: 'jolt', minimum: '0.1.0-rc.8', start: 'native-loaded' },
|
|
111
113
|
},
|
|
112
114
|
],
|
|
113
115
|
planned: [
|
package/src/contracts.ts
CHANGED
|
@@ -2,9 +2,10 @@ import type { MotionSurface, MotionRegion } from './experimental.js'
|
|
|
2
2
|
import type { Dimension } from './layout.js'
|
|
3
3
|
import type { InputAction, InputHandle } from './input.js'
|
|
4
4
|
import type { IconName } from './icon.js'
|
|
5
|
+
import type { LinkNavigate, LinkTarget } from './link.js'
|
|
5
6
|
import type { FontWeight, Palette, Radius, Spacing } from './theme/types.js'
|
|
6
7
|
|
|
7
|
-
type PropertyKind = 'string' | 'number' | 'boolean' | 'object'
|
|
8
|
+
type PropertyKind = 'string' | 'number' | 'boolean' | 'object' | 'function'
|
|
8
9
|
declare const propertyValue: unique symbol
|
|
9
10
|
|
|
10
11
|
/** Plain metadata; the symbol carries a TypeScript type and is never emitted. */
|
|
@@ -113,7 +114,15 @@ export const columnContract = {
|
|
|
113
114
|
}),
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
export const navigationContract = {
|
|
118
|
+
href: optionalText,
|
|
119
|
+
target: property<LinkTarget>()({ kind: 'string', values: ['_self', '_blank'], default: '_self' }),
|
|
120
|
+
rel: optionalText,
|
|
121
|
+
navigate: property<LinkNavigate>()({ kind: 'function', default: undefined, runtimeOnly: true }),
|
|
122
|
+
}
|
|
123
|
+
|
|
116
124
|
export const buttonContract = {
|
|
125
|
+
...navigationContract,
|
|
117
126
|
motionSurface: property<MotionSurface>()({
|
|
118
127
|
kind: 'object',
|
|
119
128
|
default: undefined,
|
|
@@ -245,6 +254,7 @@ export interface InputEvents {
|
|
|
245
254
|
}
|
|
246
255
|
export interface ButtonEvents {
|
|
247
256
|
activate(): void
|
|
257
|
+
error(error: unknown): void
|
|
248
258
|
}
|
|
249
259
|
export type TextInputHandle = InputHandle
|
|
250
260
|
|
|
@@ -257,7 +267,7 @@ export const componentContracts = {
|
|
|
257
267
|
version: 1,
|
|
258
268
|
props: buttonContract,
|
|
259
269
|
slots: ['text', 'leading-decoration', 'trailing-decoration'],
|
|
260
|
-
events: { activate: 'none' },
|
|
270
|
+
events: { activate: 'none', error: 'unknown' },
|
|
261
271
|
},
|
|
262
272
|
MInput: {
|
|
263
273
|
version: 1,
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
MotionPlayback,
|
|
3
|
+
MotionFrames,
|
|
4
|
+
MotionOptions,
|
|
5
|
+
MotionSurface,
|
|
6
|
+
MotionSurfaceAdapter,
|
|
7
|
+
MotionValues,
|
|
8
|
+
MotionBinding,
|
|
9
|
+
} from './experimental.js'
|
|
10
|
+
|
|
11
|
+
/** Controls share the engine clock. resume() continues; it never restarts playback. */
|
|
12
|
+
export interface MotionControlledPlayback extends MotionPlayback {
|
|
13
|
+
readonly paused: boolean
|
|
14
|
+
readonly duration: number
|
|
15
|
+
progress: number
|
|
16
|
+
pause(): void
|
|
17
|
+
resume(): void
|
|
18
|
+
}
|
|
19
|
+
export interface MotionTimeline extends MotionPlayback {
|
|
20
|
+
readonly paused: boolean
|
|
21
|
+
readonly duration: number | undefined
|
|
22
|
+
pause(): void
|
|
23
|
+
resume(): void
|
|
24
|
+
}
|
|
25
|
+
export interface MotionValueOptions extends MotionOptions {
|
|
26
|
+
layer?: string
|
|
27
|
+
}
|
|
28
|
+
export interface MotionDecayOptions {
|
|
29
|
+
friction?: number
|
|
30
|
+
snap?: readonly number[] | { x?: readonly number[]; y?: readonly number[] }
|
|
31
|
+
}
|
|
32
|
+
export type MotionPosition = number | '<' | `${'+' | '-'}${number}`
|
|
33
|
+
export type MotionStep<T = MotionSurface> =
|
|
34
|
+
readonly [T, MotionFrames, (MotionOptions & { at?: MotionPosition })?] | (() => MotionPlayback)
|
|
35
|
+
export type MotionTimelineStep<T = MotionSurface> =
|
|
36
|
+
| readonly [T, MotionFrames, (MotionOptions & { at?: MotionPosition })?]
|
|
37
|
+
| (() => MotionControlledPlayback)
|
|
38
|
+
| { at?: MotionPosition; run: () => MotionControlledPlayback }
|
|
39
|
+
export type MotionStateDefinitions<K extends string = string> = Record<
|
|
40
|
+
string,
|
|
41
|
+
Partial<Record<K, MotionValues>>
|
|
42
|
+
>
|
|
43
|
+
export type MotionStateTransition = MotionOptions & { targets?: Record<string, MotionOptions> }
|
|
44
|
+
export interface MotionStates<S extends string = string> extends MotionBinding {
|
|
45
|
+
readonly current: S | undefined
|
|
46
|
+
readonly settled: S | undefined
|
|
47
|
+
readonly paused: boolean
|
|
48
|
+
to(state: S, transition?: MotionStateTransition): MotionPlayback
|
|
49
|
+
pause(): void
|
|
50
|
+
resume(): void
|
|
51
|
+
stop(): void
|
|
52
|
+
}
|
|
53
|
+
export interface MotionStatesAdapter {
|
|
54
|
+
readonly current: string | undefined
|
|
55
|
+
readonly settled: string | undefined
|
|
56
|
+
readonly paused: boolean
|
|
57
|
+
to(state: string, transition?: MotionStateTransition): MotionPlayback
|
|
58
|
+
attach(name: string, surface: MotionSurfaceAdapter | null): void
|
|
59
|
+
pause(): void
|
|
60
|
+
play(): void
|
|
61
|
+
stop(): void
|
|
62
|
+
dispose(): void
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const originals = new WeakMap<MotionPlayback, MotionPlayback>()
|
|
66
|
+
/** Renderer bridge. Returning the actual handle preserves Jolt's clock and arrival metadata. */
|
|
67
|
+
export function motionPlaybackAdapter(handle: MotionPlayback): MotionPlayback {
|
|
68
|
+
const raw = originals.get(handle)
|
|
69
|
+
if (!raw) throw new TypeError('Use playback returned by a Mavis motion surface or region.')
|
|
70
|
+
return raw
|
|
71
|
+
}
|
|
72
|
+
export function controlledMotionPlayback(
|
|
73
|
+
raw: MotionPlayback,
|
|
74
|
+
live: () => boolean,
|
|
75
|
+
): MotionControlledPlayback {
|
|
76
|
+
const control = raw as MotionPlayback & {
|
|
77
|
+
pause(): void
|
|
78
|
+
play(): void
|
|
79
|
+
paused: boolean
|
|
80
|
+
duration: number
|
|
81
|
+
progress: number
|
|
82
|
+
}
|
|
83
|
+
const assert = () => {
|
|
84
|
+
if (!live()) throw new Error('This motion presentation is disposed.')
|
|
85
|
+
}
|
|
86
|
+
const result: MotionControlledPlayback = {
|
|
87
|
+
finished: raw.finished,
|
|
88
|
+
stop() {
|
|
89
|
+
if (live()) raw.stop()
|
|
90
|
+
},
|
|
91
|
+
pause() {
|
|
92
|
+
assert()
|
|
93
|
+
control.pause()
|
|
94
|
+
},
|
|
95
|
+
resume() {
|
|
96
|
+
assert()
|
|
97
|
+
control.play()
|
|
98
|
+
},
|
|
99
|
+
get paused() {
|
|
100
|
+
return control.paused
|
|
101
|
+
},
|
|
102
|
+
get duration() {
|
|
103
|
+
return control.duration
|
|
104
|
+
},
|
|
105
|
+
get progress() {
|
|
106
|
+
return control.progress
|
|
107
|
+
},
|
|
108
|
+
set progress(value) {
|
|
109
|
+
assert()
|
|
110
|
+
control.progress = value
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
originals.set(result, raw)
|
|
114
|
+
return result
|
|
115
|
+
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
controlledMotionPlayback,
|
|
3
|
+
motionPlaybackAdapter,
|
|
4
|
+
type MotionStep,
|
|
5
|
+
type MotionTimelineStep,
|
|
6
|
+
type MotionTimeline,
|
|
7
|
+
type MotionStateDefinitions,
|
|
8
|
+
type MotionStates,
|
|
9
|
+
type MotionStateTransition,
|
|
10
|
+
type MotionStatesAdapter,
|
|
11
|
+
} from './experimental-playback.js'
|
|
12
|
+
import type { MotionPlayback } from './experimental.js'
|
|
1
13
|
import {
|
|
2
14
|
motionSurfaceAdapter,
|
|
3
15
|
motionScrollAdapter,
|
|
@@ -122,12 +134,26 @@ type Available = {
|
|
|
122
134
|
onAvailable(setup: () => void | (() => void)): () => void
|
|
123
135
|
}
|
|
124
136
|
export interface MotionRegion extends Available {
|
|
137
|
+
sequence(steps: readonly MotionStep[]): MotionPlayback
|
|
138
|
+
timeline(steps: readonly MotionTimelineStep[]): MotionTimeline
|
|
139
|
+
states<const S extends MotionStateDefinitions>(
|
|
140
|
+
targets: Record<string, MotionSurface>,
|
|
141
|
+
definitions: S,
|
|
142
|
+
options?: { transition?: MotionStateTransition },
|
|
143
|
+
): MotionStates<Extract<keyof S, string>>
|
|
125
144
|
viewportEnter(surfaces: readonly MotionSurface[], options?: MotionViewportOptions): MotionViewport
|
|
126
145
|
sharedLayout(options?: MotionSharedOptions): MotionSharedLayout
|
|
127
146
|
diagnostics(options: MotionDiagnosticsOptions): MotionDiagnostics
|
|
128
147
|
}
|
|
129
148
|
export interface MotionRegionAdapter {
|
|
130
149
|
readonly kind: 'web' | 'native'
|
|
150
|
+
sequence?(steps: readonly MotionStep<MotionSurfaceAdapter>[]): MotionPlayback
|
|
151
|
+
timeline?(steps: readonly MotionTimelineStep<MotionSurfaceAdapter>[]): MotionPlayback
|
|
152
|
+
states?(
|
|
153
|
+
targets: Record<string, MotionSurfaceAdapter | null>,
|
|
154
|
+
definitions: MotionStateDefinitions,
|
|
155
|
+
options?: { transition?: MotionStateTransition },
|
|
156
|
+
): MotionStatesAdapter
|
|
131
157
|
viewportEnter(
|
|
132
158
|
surfaces: readonly MotionSurfaceAdapter[],
|
|
133
159
|
options: Omit<MotionViewportOptions, 'root'> & {
|
|
@@ -267,6 +293,69 @@ function diagnosticsHandle(
|
|
|
267
293
|
return handle
|
|
268
294
|
}
|
|
269
295
|
|
|
296
|
+
/** Translate targets and factories only; all timing belongs to Jolt. */
|
|
297
|
+
function group(
|
|
298
|
+
region: MotionRegion,
|
|
299
|
+
steps: readonly (MotionStep | MotionTimelineStep)[],
|
|
300
|
+
controlled: boolean,
|
|
301
|
+
) {
|
|
302
|
+
const state = regionState(region)
|
|
303
|
+
const surfaces = new Set<MotionSurface>()
|
|
304
|
+
const factory = (run: () => MotionPlayback) => () => {
|
|
305
|
+
if (!state.valid) throw new Error('This motion region is disposed.')
|
|
306
|
+
return motionPlaybackAdapter(run())
|
|
307
|
+
}
|
|
308
|
+
const mapped = steps.map((step) => {
|
|
309
|
+
if (typeof step === 'function') return factory(step)
|
|
310
|
+
if ('run' in step) return { ...step, run: factory(step.run) }
|
|
311
|
+
const [surface, frames, options] = step
|
|
312
|
+
surfaces.add(surface)
|
|
313
|
+
return [motionSurfaceAdapter(surface), frames, options] as const
|
|
314
|
+
})
|
|
315
|
+
const create = controlled ? state.adapter.timeline : state.adapter.sequence
|
|
316
|
+
if (!create) throw new Error('Motion orchestration is unavailable.')
|
|
317
|
+
const raw = controlled
|
|
318
|
+
? state.adapter.timeline!(mapped as readonly MotionTimelineStep<MotionSurfaceAdapter>[])
|
|
319
|
+
: state.adapter.sequence!(mapped as readonly MotionStep<MotionSurfaceAdapter>[])
|
|
320
|
+
const releases: (() => void)[] = []
|
|
321
|
+
let ended = false
|
|
322
|
+
const dispose = () => {
|
|
323
|
+
if (ended) return
|
|
324
|
+
ended = true
|
|
325
|
+
raw.stop()
|
|
326
|
+
for (const release of releases) release()
|
|
327
|
+
state.resources.delete(resource)
|
|
328
|
+
}
|
|
329
|
+
const resource = { dispose }
|
|
330
|
+
state.resources.add(resource)
|
|
331
|
+
try {
|
|
332
|
+
for (const surface of surfaces)
|
|
333
|
+
releases.push(
|
|
334
|
+
surface.onAvailable(() => () => {
|
|
335
|
+
if (!ended) raw.stop()
|
|
336
|
+
}),
|
|
337
|
+
)
|
|
338
|
+
} catch (error) {
|
|
339
|
+
dispose()
|
|
340
|
+
throw error
|
|
341
|
+
}
|
|
342
|
+
const forget = () => {
|
|
343
|
+
ended = true
|
|
344
|
+
for (const release of releases) release()
|
|
345
|
+
state.resources.delete(resource)
|
|
346
|
+
}
|
|
347
|
+
void raw.finished.then(forget, forget)
|
|
348
|
+
const playback = controlledMotionPlayback(raw, () => state.valid)
|
|
349
|
+
return controlled
|
|
350
|
+
? playback
|
|
351
|
+
: {
|
|
352
|
+
finished: raw.finished,
|
|
353
|
+
stop: () => {
|
|
354
|
+
if (state.valid) raw.stop()
|
|
355
|
+
},
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
270
359
|
export function createMotionRegion(): MotionRegion {
|
|
271
360
|
const entry: { state?: RegionState; setups: Set<() => () => void> } = { setups: new Set() }
|
|
272
361
|
const region: MotionRegion = {
|
|
@@ -319,6 +408,68 @@ export function createMotionRegion(): MotionRegion {
|
|
|
319
408
|
cleanup?.()
|
|
320
409
|
}
|
|
321
410
|
},
|
|
411
|
+
sequence: (steps) => group(region, steps, false),
|
|
412
|
+
timeline: (steps) => group(region, steps, true) as MotionTimeline,
|
|
413
|
+
states(targets, definitions, options) {
|
|
414
|
+
const state = regionState(region)
|
|
415
|
+
if (!state.adapter.states) throw new Error('Named motion states are unavailable.')
|
|
416
|
+
const entries = Object.entries(targets)
|
|
417
|
+
if (
|
|
418
|
+
!entries.length ||
|
|
419
|
+
entries.length > 64 ||
|
|
420
|
+
new Set(entries.map(([, surface]) => surface)).size !== entries.length
|
|
421
|
+
)
|
|
422
|
+
throw new TypeError('Use 1–64 distinct named surfaces.')
|
|
423
|
+
const raw = state.adapter.states(
|
|
424
|
+
Object.fromEntries(
|
|
425
|
+
entries.map(([name, surface]) => [
|
|
426
|
+
name,
|
|
427
|
+
surface.available ? motionSurfaceAdapter(surface) : null,
|
|
428
|
+
]),
|
|
429
|
+
),
|
|
430
|
+
definitions,
|
|
431
|
+
options,
|
|
432
|
+
)
|
|
433
|
+
const releases: (() => void)[] = []
|
|
434
|
+
let disposed = false
|
|
435
|
+
try {
|
|
436
|
+
for (const [name, surface] of entries)
|
|
437
|
+
releases.push(
|
|
438
|
+
surface.onAvailable(() => {
|
|
439
|
+
if (disposed) return
|
|
440
|
+
raw.attach(name, motionSurfaceAdapter(surface))
|
|
441
|
+
return () => {
|
|
442
|
+
if (!disposed) raw.attach(name, null)
|
|
443
|
+
}
|
|
444
|
+
}),
|
|
445
|
+
)
|
|
446
|
+
} catch (error) {
|
|
447
|
+
disposed = true
|
|
448
|
+
for (const release of releases) release()
|
|
449
|
+
raw.dispose()
|
|
450
|
+
throw error
|
|
451
|
+
}
|
|
452
|
+
return owned(state, {
|
|
453
|
+
get current() {
|
|
454
|
+
return raw.current
|
|
455
|
+
},
|
|
456
|
+
get settled() {
|
|
457
|
+
return raw.settled
|
|
458
|
+
},
|
|
459
|
+
get paused() {
|
|
460
|
+
return raw.paused
|
|
461
|
+
},
|
|
462
|
+
to: (name: string, transition?: MotionStateTransition) => raw.to(name, transition),
|
|
463
|
+
pause: () => raw.pause(),
|
|
464
|
+
resume: () => raw.play(),
|
|
465
|
+
stop: () => raw.stop(),
|
|
466
|
+
dispose() {
|
|
467
|
+
disposed = true
|
|
468
|
+
for (const release of releases) release()
|
|
469
|
+
raw.dispose()
|
|
470
|
+
},
|
|
471
|
+
}) as MotionStates<Extract<keyof typeof definitions, string>>
|
|
472
|
+
},
|
|
322
473
|
viewportEnter(surfaces, options = {}) {
|
|
323
474
|
const state = regionState(region)
|
|
324
475
|
if (!surfaces.length || surfaces.length > 64 || new Set(surfaces).size !== surfaces.length)
|