@orago/dodo 0.0.4 → 0.0.5

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.
@@ -1,2 +1,2 @@
1
- const e=require("../dodo.cjs");function t(t,n){let r=n.animation.direction==`reverse`||n.animation.direction==`alternate-reverse`?0:t.length-1;return i=>{let a=i.element.animate(t,n.animation);return n.ref(a),a.addEventListener(`finish`,()=>{n.save===!0&&new e.Dodo(i.element).style(t[r])}),a}}exports.animateStyles=t;
1
+ const e=require("../dodo.cjs");function t(t,n){let r=n.animation.direction==`reverse`||n.animation.direction==`alternate-reverse`?0:t.length-1;return i=>{let a=i.element.animate(t,n.animation);return n.ref!=null&&n.ref(a),a.addEventListener(`finish`,()=>{n.save===!0&&new e.Dodo(i.element).style(t[r])}),a}}exports.animateStyles=t;
2
2
  //# sourceMappingURL=plugin-animate.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-animate.cjs","names":["Dodo"],"sources":["../../src/plugins/plugin-animate.ts"],"sourcesContent":["import { StyleDeclaration } from \"@orago/kiwi\";\r\nimport { Dodo } from \"../dodo.js\";\r\n\r\nexport function animateStyles(\r\n\tstyles: StyleDeclaration[],\r\n\toptions: {\r\n\t\t/**\r\n\t\t * Apply last styles at end of animation\r\n\t\t */\r\n\t\tsave?: boolean;\r\n\t\tanimation: KeyframeAnimationOptions;\r\n\t\tref: (animation: Animation) => void;\r\n\t},\r\n) {\r\n\tconst use_reverse: boolean =\r\n\t\toptions.animation.direction == \"reverse\" ||\r\n\t\toptions.animation.direction == \"alternate-reverse\";\r\n\r\n\tconst end_index: number = use_reverse ? 0 : styles.length - 1;\r\n\r\n\treturn (node: { element: HTMLElement }) => {\r\n\t\tconst animation = node.element.animate(\r\n\t\t\tstyles as Keyframe[],\r\n\t\t\toptions.animation,\r\n\t\t);\r\n\r\n\t\toptions.ref(animation);\r\n\r\n\t\tanimation.addEventListener(\"finish\", () => {\r\n\t\t\tif (options.save === true) {\r\n\t\t\t\tnew Dodo(node.element).style(styles[end_index]);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn animation;\r\n\t};\r\n}\r\n"],"mappings":"+BAGA,SAAgB,EACf,EACA,EAQC,CAKD,IAAM,EAHL,EAAQ,UAAU,WAAa,WAC/B,EAAQ,UAAU,WAAa,oBAEQ,EAAI,EAAO,OAAS,EAE5D,MAAQ,IAAmC,CAC1C,IAAM,EAAY,EAAK,QAAQ,QAC9B,EACA,EAAQ,SACT,EAUA,OARA,EAAQ,IAAI,CAAS,EAErB,EAAU,iBAAiB,aAAgB,CACtC,EAAQ,OAAS,IACpB,IAAIA,EAAAA,KAAK,EAAK,OAAO,CAAC,CAAC,MAAM,EAAO,EAAU,CAEhD,CAAC,EAEM,CACR,CACD"}
1
+ {"version":3,"file":"plugin-animate.cjs","names":["Dodo"],"sources":["../../src/plugins/plugin-animate.ts"],"sourcesContent":["import { StyleDeclaration } from \"@orago/kiwi\";\r\nimport { Dodo } from \"../dodo.js\";\r\n\r\nexport function animateStyles(\r\n\tstyles: StyleDeclaration[],\r\n\toptions: {\r\n\t\t/**\r\n\t\t * Apply last styles at end of animation\r\n\t\t */\r\n\t\tsave?: boolean;\r\n\t\tanimation: KeyframeAnimationOptions;\r\n\t\tref?: (animation: Animation) => void;\r\n\t},\r\n) {\r\n\tconst use_reverse: boolean =\r\n\t\toptions.animation.direction == \"reverse\" ||\r\n\t\toptions.animation.direction == \"alternate-reverse\";\r\n\r\n\tconst end_index: number = use_reverse ? 0 : styles.length - 1;\r\n\r\n\treturn (node: { element: HTMLElement }) => {\r\n\t\tconst animation = node.element.animate(\r\n\t\t\tstyles as Keyframe[],\r\n\t\t\toptions.animation,\r\n\t\t);\r\n\r\n\t\tif (options.ref != undefined) {\r\n\t\t\toptions.ref(animation);\r\n\t\t}\r\n\r\n\t\tanimation.addEventListener(\"finish\", () => {\r\n\t\t\tif (options.save === true) {\r\n\t\t\t\tnew Dodo(node.element).style(styles[end_index]);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn animation;\r\n\t};\r\n}\r\n"],"mappings":"+BAGA,SAAgB,EACf,EACA,EAQC,CAKD,IAAM,EAHL,EAAQ,UAAU,WAAa,WAC/B,EAAQ,UAAU,WAAa,oBAEQ,EAAI,EAAO,OAAS,EAE5D,MAAQ,IAAmC,CAC1C,IAAM,EAAY,EAAK,QAAQ,QAC9B,EACA,EAAQ,SACT,EAYA,OAVI,EAAQ,KAAO,MAClB,EAAQ,IAAI,CAAS,EAGtB,EAAU,iBAAiB,aAAgB,CACtC,EAAQ,OAAS,IACpB,IAAIA,EAAAA,KAAK,EAAK,OAAO,CAAC,CAAC,MAAM,EAAO,EAAU,CAEhD,CAAC,EAEM,CACR,CACD"}
@@ -6,7 +6,7 @@ declare function animateStyles(styles: StyleDeclaration[], options: {
6
6
  */
7
7
  save?: boolean;
8
8
  animation: KeyframeAnimationOptions;
9
- ref: (animation: Animation) => void;
9
+ ref?: (animation: Animation) => void;
10
10
  }): (node: {
11
11
  element: HTMLElement;
12
12
  }) => Animation;
@@ -1,2 +1,2 @@
1
- import{Dodo as e}from"../dodo.mjs";function t(t,n){let r=n.animation.direction==`reverse`||n.animation.direction==`alternate-reverse`?0:t.length-1;return i=>{let a=i.element.animate(t,n.animation);return n.ref(a),a.addEventListener(`finish`,()=>{n.save===!0&&new e(i.element).style(t[r])}),a}}export{t as animateStyles};
1
+ import{Dodo as e}from"../dodo.mjs";function t(t,n){let r=n.animation.direction==`reverse`||n.animation.direction==`alternate-reverse`?0:t.length-1;return i=>{let a=i.element.animate(t,n.animation);return n.ref!=null&&n.ref(a),a.addEventListener(`finish`,()=>{n.save===!0&&new e(i.element).style(t[r])}),a}}export{t as animateStyles};
2
2
  //# sourceMappingURL=plugin-animate.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-animate.mjs","names":[],"sources":["../../src/plugins/plugin-animate.ts"],"sourcesContent":["import { StyleDeclaration } from \"@orago/kiwi\";\r\nimport { Dodo } from \"../dodo.js\";\r\n\r\nexport function animateStyles(\r\n\tstyles: StyleDeclaration[],\r\n\toptions: {\r\n\t\t/**\r\n\t\t * Apply last styles at end of animation\r\n\t\t */\r\n\t\tsave?: boolean;\r\n\t\tanimation: KeyframeAnimationOptions;\r\n\t\tref: (animation: Animation) => void;\r\n\t},\r\n) {\r\n\tconst use_reverse: boolean =\r\n\t\toptions.animation.direction == \"reverse\" ||\r\n\t\toptions.animation.direction == \"alternate-reverse\";\r\n\r\n\tconst end_index: number = use_reverse ? 0 : styles.length - 1;\r\n\r\n\treturn (node: { element: HTMLElement }) => {\r\n\t\tconst animation = node.element.animate(\r\n\t\t\tstyles as Keyframe[],\r\n\t\t\toptions.animation,\r\n\t\t);\r\n\r\n\t\toptions.ref(animation);\r\n\r\n\t\tanimation.addEventListener(\"finish\", () => {\r\n\t\t\tif (options.save === true) {\r\n\t\t\t\tnew Dodo(node.element).style(styles[end_index]);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn animation;\r\n\t};\r\n}\r\n"],"mappings":"mCAGA,SAAgB,EACf,EACA,EAQC,CAKD,IAAM,EAHL,EAAQ,UAAU,WAAa,WAC/B,EAAQ,UAAU,WAAa,oBAEQ,EAAI,EAAO,OAAS,EAE5D,MAAQ,IAAmC,CAC1C,IAAM,EAAY,EAAK,QAAQ,QAC9B,EACA,EAAQ,SACT,EAUA,OARA,EAAQ,IAAI,CAAS,EAErB,EAAU,iBAAiB,aAAgB,CACtC,EAAQ,OAAS,IACpB,IAAI,EAAK,EAAK,OAAO,CAAC,CAAC,MAAM,EAAO,EAAU,CAEhD,CAAC,EAEM,CACR,CACD"}
1
+ {"version":3,"file":"plugin-animate.mjs","names":[],"sources":["../../src/plugins/plugin-animate.ts"],"sourcesContent":["import { StyleDeclaration } from \"@orago/kiwi\";\r\nimport { Dodo } from \"../dodo.js\";\r\n\r\nexport function animateStyles(\r\n\tstyles: StyleDeclaration[],\r\n\toptions: {\r\n\t\t/**\r\n\t\t * Apply last styles at end of animation\r\n\t\t */\r\n\t\tsave?: boolean;\r\n\t\tanimation: KeyframeAnimationOptions;\r\n\t\tref?: (animation: Animation) => void;\r\n\t},\r\n) {\r\n\tconst use_reverse: boolean =\r\n\t\toptions.animation.direction == \"reverse\" ||\r\n\t\toptions.animation.direction == \"alternate-reverse\";\r\n\r\n\tconst end_index: number = use_reverse ? 0 : styles.length - 1;\r\n\r\n\treturn (node: { element: HTMLElement }) => {\r\n\t\tconst animation = node.element.animate(\r\n\t\t\tstyles as Keyframe[],\r\n\t\t\toptions.animation,\r\n\t\t);\r\n\r\n\t\tif (options.ref != undefined) {\r\n\t\t\toptions.ref(animation);\r\n\t\t}\r\n\r\n\t\tanimation.addEventListener(\"finish\", () => {\r\n\t\t\tif (options.save === true) {\r\n\t\t\t\tnew Dodo(node.element).style(styles[end_index]);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\treturn animation;\r\n\t};\r\n}\r\n"],"mappings":"mCAGA,SAAgB,EACf,EACA,EAQC,CAKD,IAAM,EAHL,EAAQ,UAAU,WAAa,WAC/B,EAAQ,UAAU,WAAa,oBAEQ,EAAI,EAAO,OAAS,EAE5D,MAAQ,IAAmC,CAC1C,IAAM,EAAY,EAAK,QAAQ,QAC9B,EACA,EAAQ,SACT,EAYA,OAVI,EAAQ,KAAO,MAClB,EAAQ,IAAI,CAAS,EAGtB,EAAU,iBAAiB,aAAgB,CACtC,EAAQ,OAAS,IACpB,IAAI,EAAK,EAAK,OAAO,CAAC,CAAC,MAAM,EAAO,EAAU,CAEhD,CAAC,EAEM,CACR,CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orago/dodo",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Dear Orago's Dom Objects",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -9,7 +9,7 @@ export function animateStyles(
9
9
  */
10
10
  save?: boolean;
11
11
  animation: KeyframeAnimationOptions;
12
- ref: (animation: Animation) => void;
12
+ ref?: (animation: Animation) => void;
13
13
  },
14
14
  ) {
15
15
  const use_reverse: boolean =
@@ -24,7 +24,9 @@ export function animateStyles(
24
24
  options.animation,
25
25
  );
26
26
 
27
- options.ref(animation);
27
+ if (options.ref != undefined) {
28
+ options.ref(animation);
29
+ }
28
30
 
29
31
  animation.addEventListener("finish", () => {
30
32
  if (options.save === true) {