@builder.io/sdk-svelte 0.12.6 → 0.12.7

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.
@@ -39,6 +39,7 @@
39
39
  import type { BuilderContent } from "../../../types/builder-content.js";
40
40
  import type { ComponentInfo } from "../../../types/components.js";
41
41
  import type { Dictionary } from "../../../types/typescript.js";
42
+ import { triggerAnimation } from "../../block/animator.js";
42
43
  import type {
43
44
  BuilderComponentStateChange,
44
45
  ContentProps,
@@ -114,6 +115,10 @@
114
115
  forceReRenderCount = forceReRenderCount + 1; // This is a hack to force Qwik to re-render.
115
116
  break;
116
117
  }
118
+ case "builder.triggerAnimation": {
119
+ triggerAnimation(data.data);
120
+ break;
121
+ }
117
122
  case "builder.contentUpdate": {
118
123
  const messageContent = data.data;
119
124
  const key =
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.12.6"
1
+ export const SDK_VERSION = "0.12.7"
@@ -3,7 +3,28 @@ interface JSONObject {
3
3
  [x: string]: JSONValue;
4
4
  }
5
5
  interface JSONArray extends Array<JSONValue> {}
6
-
6
+ export interface AnimationStep {
7
+ // First one is always start state
8
+ // isStartState?: boolean;
9
+ styles: {
10
+ [key: string]: string;
11
+ };
12
+ delay?: number;
13
+ }
14
+ export interface BuilderAnimation {
15
+ elementId: string;
16
+ trigger: string;
17
+ steps: AnimationStep[];
18
+ duration: number;
19
+ delay?: number;
20
+ easing?: string;
21
+ // TODO: deprecate - only here because of an API bug
22
+ id?: string;
23
+ // only apply in scrollInView
24
+ repeat?: boolean;
25
+ // only apply in scrollInView, number from -1 to 1
26
+ thresholdPercent?: number;
27
+ }
7
28
  /** @todo typedoc this */
8
29
  export interface BuilderBlock {
9
30
  '@type': '@builder.io/sdk:Element';
@@ -52,7 +73,7 @@ export interface BuilderBlock {
52
73
  collection: string;
53
74
  itemName?: string;
54
75
  } | null;
55
- animations?: any[]; // TODO: type the animation spec
76
+ animations?: BuilderAnimation[];
56
77
  style?: Partial<CSSStyleDeclaration>;
57
78
  href?: string;
58
79