@onmark/cli 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/onmark-release.json +83 -53
  2. package/package.json +4 -4
  3. package/packages/authoring/dist/src/frame-motion.d.ts +10 -2
  4. package/packages/authoring/dist/src/frame-motion.js +29 -6
  5. package/packages/authoring/dist/src/index.d.ts +2 -2
  6. package/packages/authoring/dist/src/motion.d.ts +16 -4
  7. package/packages/authoring/dist/src/presentation.js +34 -1
  8. package/packages/authoring/dist/src/types.d.ts +1 -1
  9. package/packages/bundler/dist/src/authored_html.d.ts +17 -7
  10. package/packages/bundler/dist/src/authored_html.js +79 -21
  11. package/packages/bundler/dist/src/bundle_projection.d.ts +9 -0
  12. package/packages/bundler/dist/src/bundle_projection.js +66 -0
  13. package/packages/bundler/dist/src/command.js +28 -8
  14. package/packages/bundler/dist/src/generated/bundle-projection-validator.d.ts +7 -0
  15. package/packages/bundler/dist/src/generated/bundle-projection-validator.js +432 -0
  16. package/packages/bundler/dist/src/generated/bundle-projection.d.ts +25 -0
  17. package/packages/bundler/dist/src/generated/bundle-projection.js +2 -0
  18. package/packages/bundler/dist/src/index.d.ts +1 -1
  19. package/packages/bundler/dist/src/presentation.d.ts +13 -6
  20. package/packages/bundler/dist/src/presentation.js +58 -28
  21. package/packages/motion-gsap/dist/src/index.d.ts +10 -2
  22. package/packages/motion-gsap/dist/src/index.js +27 -5
  23. package/packages/runtime/dist/src/generated/browser-request.d.ts +15 -2
  24. package/packages/runtime/dist/src/generated/browser-response.d.ts +1 -1
  25. package/packages/runtime/dist/src/generated/runtime-contract.d.ts +2 -0
  26. package/packages/runtime/dist/src/generated/runtime-contract.js +2 -0
  27. package/packages/runtime/dist/src/generated/validators.d.ts +2 -2
  28. package/packages/runtime/dist/src/generated/validators.js +331 -128
  29. package/packages/runtime/dist/src/index.d.ts +2 -2
  30. package/packages/runtime/dist/src/index.js +1 -1
  31. package/packages/runtime/dist/src/presentation.d.ts +10 -0
  32. package/packages/runtime/dist/src/presentation.js +18 -3
  33. package/packages/runtime/dist/src/session.js +61 -12
  34. package/packages/runtime/dist/src/types.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  import { gsap } from "gsap";
2
- import type { PresentationExtension, PresentationTargetKind } from "../../../authoring/dist/src/index.js";
2
+ import type { PresentationExtension, PresentationElementTargetKind } from "../../../authoring/dist/src/index.js";
3
3
  /** Local GSAP authoring facts for one semantic screenplay element. */
4
4
  export interface GsapMotionContext {
5
5
  readonly durationSeconds: number;
@@ -8,9 +8,17 @@ export interface GsapMotionContext {
8
8
  }
9
9
  /** Adds local animation to one Onmark-owned paused timeline. */
10
10
  export type GsapMotionHandler = (context: GsapMotionContext) => void;
11
+ /** Local GSAP transition facts with both adjacent shot elements. */
12
+ export interface GsapTransitionContext extends GsapMotionContext {
13
+ readonly incomingElement: HTMLElement;
14
+ readonly outgoingElement: HTMLElement;
15
+ }
16
+ /** Adds local animation across one compiler-owned shot overlap. */
17
+ export type GsapTransitionHandler = (context: GsapTransitionContext) => void;
11
18
  /** Semantic handlers and optional selector handlers for local motion. */
12
- export type GsapMotionDefinition = Readonly<Partial<Record<PresentationTargetKind, GsapMotionHandler>> & {
19
+ export type GsapMotionDefinition = Readonly<Partial<Record<PresentationElementTargetKind, GsapMotionHandler>> & {
13
20
  readonly selectors?: Readonly<Record<string, GsapMotionHandler>>;
21
+ readonly transition?: GsapTransitionHandler;
14
22
  }>;
15
23
  /** Creates exact-frame GSAP effects without exposing runtime lifecycle code. */
16
24
  export declare function gsapMotion(definition: GsapMotionDefinition): PresentationExtension;
@@ -19,7 +19,7 @@ function bindGsapEffects(rules, context) {
19
19
  try {
20
20
  for (const target of context.targets) {
21
21
  const handlers = matchingHandlers(rules, target);
22
- if (handlers.length === 0) {
22
+ if (handlers.elements.length === 0 && handlers.transition === undefined) {
23
23
  continue;
24
24
  }
25
25
  effects.push(bindGsapEffect(handlers, target, context));
@@ -43,7 +43,10 @@ function bindGsapEffect(handlers, target, context) {
43
43
  element: target.element,
44
44
  timeline,
45
45
  });
46
- for (const handler of handlers) {
46
+ if (target.kind === "transition" && handlers.transition !== undefined) {
47
+ handlers.transition(transitionContext(motion, target));
48
+ }
49
+ for (const handler of handlers.elements) {
47
50
  handler(motion);
48
51
  }
49
52
  requireLocalTimeline(timeline, durationSeconds, target.kind);
@@ -88,7 +91,11 @@ function ownRules(definition) {
88
91
  caption: definition.caption,
89
92
  });
90
93
  const selectors = Object.freeze(Object.entries(definition.selectors ?? {}).map(ownSelector));
91
- return Object.freeze({ kinds, selectors });
94
+ return Object.freeze({
95
+ kinds,
96
+ selectors,
97
+ transition: definition.transition,
98
+ });
92
99
  }
93
100
  function ownSelector([selector, animate]) {
94
101
  if (selector.trim().length === 0) {
@@ -98,7 +105,7 @@ function ownSelector([selector, animate]) {
98
105
  }
99
106
  function matchingHandlers(rules, target) {
100
107
  const handlers = [];
101
- const kind = rules.kinds[target.kind];
108
+ const kind = target.kind === "transition" ? undefined : rules.kinds[target.kind];
102
109
  if (kind !== undefined) {
103
110
  handlers.push(kind);
104
111
  }
@@ -107,7 +114,10 @@ function matchingHandlers(rules, target) {
107
114
  handlers.push(rule.animate);
108
115
  }
109
116
  }
110
- return handlers;
117
+ return Object.freeze({
118
+ elements: Object.freeze(handlers),
119
+ transition: target.kind === "transition" ? rules.transition : undefined,
120
+ });
111
121
  }
112
122
  // ── Exact-frame playheads ──
113
123
  function intervalSeconds(target, context) {
@@ -117,8 +127,20 @@ function intervalSeconds(target, context) {
117
127
  function localSeconds(frame, target, context) {
118
128
  const durationFrames = target.interval.end - target.interval.start;
119
129
  const localFrame = Math.max(0, Math.min(frame.index - target.interval.start, durationFrames));
130
+ if (target.kind === "transition") {
131
+ const finalFrame = durationFrames - 1;
132
+ const progress = finalFrame === 0 ? 1 : localFrame / finalFrame;
133
+ return intervalSeconds(target, context) * progress;
134
+ }
120
135
  return ((localFrame / context.frameRate.numerator) * context.frameRate.denominator);
121
136
  }
137
+ function transitionContext(context, target) {
138
+ return Object.freeze({
139
+ ...context,
140
+ incomingElement: target.incomingElement,
141
+ outgoingElement: target.outgoingElement,
142
+ });
143
+ }
122
144
  function requireLocalTimeline(timeline, durationSeconds, label) {
123
145
  if (timeline.duration() <= durationSeconds) {
124
146
  return;
@@ -66,7 +66,7 @@ export type RequestId = number;
66
66
  /**
67
67
  * Version of the native-to-browser message contract.
68
68
  */
69
- export type ProtocolVersion = 3;
69
+ export type ProtocolVersion = 4;
70
70
  /**
71
71
  * One versioned command sent from the native executor to the browser.
72
72
  */
@@ -96,7 +96,11 @@ export interface BrowserPlan {
96
96
  */
97
97
  shots: BrowserShot[];
98
98
  timeline: WireInterval;
99
- timelineVersion: 2;
99
+ timelineVersion: 3;
100
+ /**
101
+ * @maxItems 10000
102
+ */
103
+ transitions: BrowserTransition[];
100
104
  /**
101
105
  * @maxItems 10000
102
106
  */
@@ -148,6 +152,15 @@ export interface BrowserShot {
148
152
  node: BrowserNode;
149
153
  sceneId: BrowserNodeId;
150
154
  }
155
+ /**
156
+ * One solved transition between two adjacent browser shots.
157
+ */
158
+ export interface BrowserTransition {
159
+ incomingShotId: BrowserNodeId;
160
+ interval: WireInterval;
161
+ node: BrowserNode;
162
+ outgoingShotId: BrowserNodeId;
163
+ }
151
164
  /**
152
165
  * One primary video placement consumed by the browser presentation adapter.
153
166
  */
@@ -47,7 +47,7 @@ export type RequestId = number;
47
47
  /**
48
48
  * Version of the native-to-browser message contract.
49
49
  */
50
- export type ProtocolVersion = 3;
50
+ export type ProtocolVersion = 4;
51
51
  /**
52
52
  * One versioned event returned by the browser runtime.
53
53
  */
@@ -1,5 +1,7 @@
1
1
  export declare const RUNTIME_HOST_NAME: "__ONMARK_RUNTIME__";
2
+ export declare const BROWSER_PROTOCOL_VERSION: 4;
2
3
  export declare const MAX_BROWSER_VIDEOS: 10000;
4
+ export declare const MAX_BROWSER_TRANSITIONS: 10000;
3
5
  export declare const MAX_BROWSER_OVERLAYS: 10000;
4
6
  export declare const MAX_BROWSER_OVERLAY_TEXT_CHARACTERS: 65536;
5
7
  export declare const MAX_FAILURE_MESSAGE_CHARACTERS: 4096;
@@ -1,6 +1,8 @@
1
1
  // Generated by `cargo xtask schema`; edit Rust protocol types instead.
2
2
  export const RUNTIME_HOST_NAME = "__ONMARK_RUNTIME__";
3
+ export const BROWSER_PROTOCOL_VERSION = 4;
3
4
  export const MAX_BROWSER_VIDEOS = 10000;
5
+ export const MAX_BROWSER_TRANSITIONS = 10000;
4
6
  export const MAX_BROWSER_OVERLAYS = 10000;
5
7
  export const MAX_BROWSER_OVERLAY_TEXT_CHARACTERS = 65536;
6
8
  export const MAX_FAILURE_MESSAGE_CHARACTERS = 4096;
@@ -4,8 +4,8 @@ declare function validate20(data: any, { instancePath, parentData, parentDataPro
4
4
  instancePath?: string | undefined;
5
5
  rootData?: any;
6
6
  }): boolean;
7
- export declare const validateBrowserResponse: typeof validate51;
8
- declare function validate51(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
7
+ export declare const validateBrowserResponse: typeof validate55;
8
+ declare function validate55(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
9
9
  dynamicAnchors?: {} | undefined;
10
10
  instancePath?: string | undefined;
11
11
  rootData?: any;