@social-mail/social-mail-client 1.8.76 → 1.8.78

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 (127) hide show
  1. package/dist/site-editor/editor/CssParser.d.ts.map +1 -1
  2. package/dist/site-editor/editor/CssParser.js +12 -2
  3. package/dist/site-editor/editor/CssParser.js.map +1 -1
  4. package/dist/site-editor/suggestions/properties/animations/animations.d.ts +2 -0
  5. package/dist/site-editor/suggestions/properties/animations/animations.d.ts.map +1 -1
  6. package/dist/site-editor/suggestions/properties/animations/animations.js +20 -19
  7. package/dist/site-editor/suggestions/properties/animations/animations.js.map +1 -1
  8. package/dist/site-editor/suggestions/properties/animations/key-frames/blur/blur-in.d.ts.map +1 -1
  9. package/dist/site-editor/suggestions/properties/animations/key-frames/blur/blur-in.js +1 -1
  10. package/dist/site-editor/suggestions/properties/animations/key-frames/blur/blur-in.js.map +1 -1
  11. package/dist/site-editor/suggestions/properties/animations/key-frames/blur/blur-out.d.ts.map +1 -1
  12. package/dist/site-editor/suggestions/properties/animations/key-frames/blur/blur-out.js +1 -1
  13. package/dist/site-editor/suggestions/properties/animations/key-frames/blur/blur-out.js.map +1 -1
  14. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-in.d.ts +1 -4
  15. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-in.d.ts.map +1 -1
  16. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-in.js +8 -5
  17. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-in.js.map +1 -1
  18. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-out.d.ts +2 -0
  19. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-out.d.ts.map +1 -0
  20. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-out.js +38 -0
  21. package/dist/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-out.js.map +1 -0
  22. package/dist/site-editor/suggestions/properties/animations/key-frames/css.d.ts +33 -3
  23. package/dist/site-editor/suggestions/properties/animations/key-frames/css.d.ts.map +1 -1
  24. package/dist/site-editor/suggestions/properties/animations/key-frames/css.js +63 -6
  25. package/dist/site-editor/suggestions/properties/animations/key-frames/css.js.map +1 -1
  26. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-in.d.ts +1 -0
  27. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-in.d.ts.map +1 -1
  28. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-in.js +19 -3
  29. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-in.js.map +1 -1
  30. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-out.d.ts +1 -6
  31. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-out.d.ts.map +1 -1
  32. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-out.js +19 -11
  33. package/dist/site-editor/suggestions/properties/animations/key-frames/fade/fade-out.js.map +1 -1
  34. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-in.d.ts +1 -6
  35. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-in.d.ts.map +1 -1
  36. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-in.js +20 -11
  37. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-in.js.map +1 -1
  38. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-out.d.ts +1 -6
  39. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-out.d.ts.map +1 -1
  40. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-out.js +20 -11
  41. package/dist/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-out.js.map +1 -1
  42. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-in.d.ts +1 -6
  43. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-in.d.ts.map +1 -1
  44. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-in.js +20 -11
  45. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-in.js.map +1 -1
  46. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-out.d.ts +1 -6
  47. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-out.d.ts.map +1 -1
  48. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-out.js +20 -11
  49. package/dist/site-editor/suggestions/properties/animations/key-frames/scale/scale-out.js.map +1 -1
  50. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-in.d.ts +2 -0
  51. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-in.d.ts.map +1 -0
  52. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-in.js +28 -0
  53. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-in.js.map +1 -0
  54. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-out.d.ts +2 -0
  55. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-out.d.ts.map +1 -0
  56. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-out.js +28 -0
  57. package/dist/site-editor/suggestions/properties/animations/key-frames/slide/slide-out.js.map +1 -0
  58. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-in.d.ts +2 -0
  59. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-in.d.ts.map +1 -0
  60. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-in.js +33 -0
  61. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-in.js.map +1 -0
  62. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-out.d.ts +2 -0
  63. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-out.d.ts.map +1 -0
  64. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-out.js +28 -0
  65. package/dist/site-editor/suggestions/properties/animations/key-frames/speed/speed-out.js.map +1 -0
  66. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-in.d.ts +1 -6
  67. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-in.d.ts.map +1 -1
  68. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-in.js +20 -11
  69. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-in.js.map +1 -1
  70. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-out.d.ts +1 -6
  71. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-out.d.ts.map +1 -1
  72. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-out.js +20 -11
  73. package/dist/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-out.js.map +1 -1
  74. package/dist/site-editor-app/SiteEditorApp.pack.js +350 -146
  75. package/dist/site-editor-app/SiteEditorApp.pack.js.map +1 -1
  76. package/dist/site-editor-app/SiteEditorApp.pack.min.js +1 -1
  77. package/dist/site-editor-app/SiteEditorApp.pack.min.js.map +1 -1
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. package/package.json +1 -1
  80. package/src/site-editor/editor/CssParser.ts +38 -1
  81. package/src/site-editor/suggestions/properties/animations/animations.ts +36 -30
  82. package/src/site-editor/suggestions/properties/animations/key-frames/blur/blur-in.ts +13 -12
  83. package/src/site-editor/suggestions/properties/animations/key-frames/blur/blur-out.ts +13 -12
  84. package/src/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-in.ts +12 -28
  85. package/src/site-editor/suggestions/properties/animations/key-frames/bounce/bounce-out.ts +45 -0
  86. package/src/site-editor/suggestions/properties/animations/key-frames/css.ts +67 -22
  87. package/src/site-editor/suggestions/properties/animations/key-frames/fade/fade-in.ts +18 -1
  88. package/src/site-editor/suggestions/properties/animations/key-frames/fade/fade-out.ts +16 -11
  89. package/src/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-in.ts +16 -11
  90. package/src/site-editor/suggestions/properties/animations/key-frames/rotate/rotate-out.ts +16 -11
  91. package/src/site-editor/suggestions/properties/animations/key-frames/scale/scale-in.ts +16 -11
  92. package/src/site-editor/suggestions/properties/animations/key-frames/scale/scale-out.ts +16 -11
  93. package/src/site-editor/suggestions/properties/animations/key-frames/slide/slide-in.ts +14 -0
  94. package/src/site-editor/suggestions/properties/animations/key-frames/slide/slide-out.ts +14 -0
  95. package/src/site-editor/suggestions/properties/animations/key-frames/speed/speed-in.ts +19 -0
  96. package/src/site-editor/suggestions/properties/animations/key-frames/speed/speed-out.ts +14 -0
  97. package/src/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-in.ts +16 -11
  98. package/src/site-editor/suggestions/properties/animations/key-frames/zoom/zoom-out.ts +16 -11
  99. package/styler-lite/styler.css +1 -1
  100. package/styler-lite/styler.css.map +1 -1
  101. package/styler-lite/styles/animations/animations/generated.css +3200 -0
  102. package/styler-lite/styles/animations/animations/generated.css.js +91 -0
  103. package/styler-lite/styles/animations/animations/generated.css.map +1 -0
  104. package/styler-lite/styles/animations/animations/key-frames/blur/blur-in.js +17 -0
  105. package/styler-lite/styles/animations/animations/key-frames/blur/blur-out.js +17 -0
  106. package/styler-lite/styles/animations/animations/key-frames/bounce/bounce-in.js +43 -0
  107. package/styler-lite/styles/animations/animations/key-frames/bounce/bounce-out.js +43 -0
  108. package/styler-lite/styles/animations/animations/key-frames/css.js +119 -0
  109. package/styler-lite/styles/animations/animations/key-frames/fade/fade-in.js +16 -0
  110. package/styler-lite/styles/animations/animations/key-frames/fade/fade-out.js +16 -0
  111. package/styler-lite/styles/animations/animations/key-frames/rotate/rotate-in.js +16 -0
  112. package/styler-lite/styles/animations/animations/key-frames/rotate/rotate-out.js +16 -0
  113. package/styler-lite/styles/animations/animations/key-frames/scale/scale-in.js +16 -0
  114. package/styler-lite/styles/animations/animations/key-frames/scale/scale-out.js +16 -0
  115. package/styler-lite/styles/animations/animations/key-frames/slide/slide-in.js +14 -0
  116. package/styler-lite/styles/animations/animations/key-frames/slide/slide-out.js +14 -0
  117. package/styler-lite/styles/animations/animations/key-frames/speed/speed-in.js +19 -0
  118. package/styler-lite/styles/animations/animations/key-frames/speed/speed-out.js +14 -0
  119. package/styler-lite/styles/animations/animations/key-frames/zoom/zoom-in.js +16 -0
  120. package/styler-lite/styles/animations/animations/key-frames/zoom/zoom-out.js +16 -0
  121. package/dist/site-editor/suggestions/properties/animations/key-frames/cssTranslate.d.ts +0 -9
  122. package/dist/site-editor/suggestions/properties/animations/key-frames/cssTranslate.d.ts.map +0 -1
  123. package/dist/site-editor/suggestions/properties/animations/key-frames/cssTranslate.js +0 -45
  124. package/dist/site-editor/suggestions/properties/animations/key-frames/cssTranslate.js.map +0 -1
  125. package/src/site-editor/suggestions/properties/animations/key-frames/cssTranslate.ts +0 -84
  126. package/styler-lite/styles/animations/animations/fade-in.css +0 -0
  127. package/styler-lite/styles/animations/main-key-frames.css +0 -44
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.8.76",
3
+ "version": "1.8.78",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,6 +5,32 @@ import { AtomBinder } from "@web-atoms/core/dist/core/AtomBinder";
5
5
  import { UMD } from "@web-atoms/core/dist/core/types";
6
6
  import { editorSuggestions } from "../suggestions/editorSuggestions";
7
7
 
8
+ const timelineAttributes = [
9
+ 'styler-on-scroll',
10
+ 'styler-on-scroll-effect-1',
11
+ 'styler-on-scroll-effect-2',
12
+ 'styler-on-scroll-above',
13
+ 'styler-on-scroll-above-effect-1',
14
+ 'styler-on-scroll-above-effect-2',
15
+ 'styler-on-scroll-top-half',
16
+ 'styler-on-scroll-top-half-effect-1',
17
+ 'styler-on-scroll-top-half-effect-2',
18
+ ];
19
+
20
+ const keyFrameAttributes = [
21
+ 'styler-on-enter',
22
+ 'styler-on-enter-effect-1',
23
+ 'styler-on-enter-effect-2',
24
+ 'styler-on-hover',
25
+ 'styler-on-hover-effect-1',
26
+ 'styler-on-hover-effect-2',
27
+ 'styler-on-leave',
28
+ 'styler-on-leave-effect-1',
29
+ 'styler-on-leave-effect-2',
30
+ ... timelineAttributes
31
+ ];
32
+
33
+
8
34
  export default class CssParser {
9
35
 
10
36
  static async parse(editor: HtmlPageEditor) {
@@ -52,7 +78,18 @@ export default class CssParser {
52
78
  const cssRules = css.cssRules;
53
79
  // eslint-disable-next-line @typescript-eslint/prefer-for-of
54
80
  for (let i = 0; i < cssRules.length;i++) {
55
- const rule = cssRules[i] as CSSStyleRule;
81
+ const r1 = cssRules[i] as CSSRule;
82
+ const kr = (r1 as CSSKeyframesRule).name;
83
+
84
+ if (kr) {
85
+ for (const a of keyFrameAttributes) {
86
+ this.parseRule(suggestions, a, kr);
87
+ }
88
+ continue;
89
+ }
90
+
91
+ const rule = r1 as CSSStyleRule;
92
+
56
93
  const match = /\[(styler\-[^=\]]+)=([^\]]+)\]/g.exec(rule.selectorText);
57
94
  if (!match) {
58
95
  continue;
@@ -1,39 +1,45 @@
1
1
  import pair, { jsonPair } from "../../pair";
2
2
  import { blurIns } from "./key-frames/blur/blur-in";
3
3
  import { blurOuts } from "./key-frames/blur/blur-out";
4
- import { bounces } from "./key-frames/bounce/bounce-in";
4
+ import { bounceIns } from "./key-frames/bounce/bounce-in";
5
+ import { bounceOuts } from "./key-frames/bounce/bounce-out";
5
6
  import { IAnimation } from "./key-frames/css";
6
- import { cssTranslate } from "./key-frames/cssTranslate";
7
- import { fadeIn } from "./key-frames/fade/fade-in";
8
- import { fadeOut } from "./key-frames/fade/fade-out";
9
- import { rotateIn } from "./key-frames/rotate/rotate-in";
10
- import { rotateOut } from "./key-frames/rotate/rotate-out";
11
- import { scaleIn } from "./key-frames/scale/scale-in";
12
- import { scaleOut } from "./key-frames/scale/scale-out";
13
- import { zoomIn } from "./key-frames/zoom/zoom-in";
14
- import { zoomOut } from "./key-frames/zoom/zoom-out";
15
-
16
- const jsonKeyframe = (x: IAnimation) => jsonPair(x.title, x);
17
-
18
- const animations = [
19
- jsonPair("fade-in", fadeIn),
20
- jsonPair("fade-out", fadeOut),
21
-
22
- ... blurIns.map(jsonKeyframe),
23
- ... blurOuts.map(jsonKeyframe),
24
-
25
- jsonPair("zoom-in", zoomIn),
26
- jsonPair("zoom-out", zoomOut),
27
- jsonPair("scale-in", scaleIn),
28
- jsonPair("scale-out", scaleOut),
29
- jsonPair("rotate-in", rotateIn),
30
- jsonPair("rotate-out", rotateOut),
31
-
32
- ... cssTranslate({ title: "slide", keyframes: [{}, {}] }).map((x) => jsonPair(x.title, x)),
33
- ... bounces.map((x) => jsonPair(x.title, x))
34
-
7
+ import { fadeIns } from "./key-frames/fade/fade-in";
8
+ import { fadeOuts } from "./key-frames/fade/fade-out";
9
+ import { rotateIns } from "./key-frames/rotate/rotate-in";
10
+ import { rotateOuts } from "./key-frames/rotate/rotate-out";
11
+ import { scaleIns } from "./key-frames/scale/scale-in";
12
+ import { scaleOuts } from "./key-frames/scale/scale-out";
13
+ import { slideIns } from "./key-frames/slide/slide-in";
14
+ import { slideOuts } from "./key-frames/slide/slide-out";
15
+ import { zoomIns } from "./key-frames/zoom/zoom-in";
16
+ import { zoomOuts } from "./key-frames/zoom/zoom-out";
17
+
18
+ export const generatedAnimations = [
19
+ ... blurIns,
20
+ ... blurOuts,
21
+
22
+ ... bounceIns,
23
+ ... bounceOuts,
24
+
25
+ ... fadeIns,
26
+ ... fadeOuts,
27
+
28
+ ... rotateIns,
29
+ ... rotateOuts,
30
+
31
+ ... scaleIns,
32
+ ... scaleOuts,
33
+
34
+ ... zoomIns,
35
+ ... zoomOuts,
36
+
37
+ ... slideIns,
38
+ ... slideOuts
35
39
  ];
36
40
 
41
+ const animations = generatedAnimations.map((x) => pair(x.title, x.title));
42
+
37
43
  export const animationSuggestions = {
38
44
  "styler-on-enter": animations,
39
45
  "styler-on-enter-effect-1": animations,
@@ -2,15 +2,16 @@ import { CSSBuilder } from "../css";
2
2
 
3
3
  const { animation, keyFrame, backdropFilter, blur, opacity, transform, translate3d, px, move } = CSSBuilder;
4
4
 
5
- export const blurIns = move("blur-in", (title, x, y, z) => animation(title,
6
- keyFrame(0,
7
- opacity(0),
8
- transform(translate3d(x, y, z)),
9
- backdropFilter(blur(px(10)))
10
- ),
11
- keyFrame(100,
12
- opacity(1),
13
- transform(),
14
- backdropFilter(blur(px(0)))
15
- )
16
- ));
5
+ export const blurIns = move("blur-in", "from", (title, d, x, y, z) => animation(title,
6
+ keyFrame(0,
7
+ opacity(0),
8
+ d && translate3d(x, y, z),
9
+ backdropFilter(blur(px(10)))
10
+ ),
11
+ keyFrame(100,
12
+ opacity(1),
13
+ d && translate3d(),
14
+ backdropFilter(blur(px(0)))
15
+ )
16
+ ))
17
+ ;
@@ -2,15 +2,16 @@ import { CSSBuilder } from "../css";
2
2
 
3
3
  const { animation, keyFrame, backdropFilter, blur, opacity, transform, translate3d, px, move } = CSSBuilder;
4
4
 
5
- export const blurOuts = move("blur-out", (title, x, y, z) => animation(title,
6
- keyFrame(0,
7
- opacity(1),
8
- transform(translate3d(x, y, z)),
9
- backdropFilter(blur(px(0)))
10
- ),
11
- keyFrame(100,
12
- opacity(0),
13
- transform(),
14
- backdropFilter(blur(px(10)))
15
- )
16
- ));
5
+ export const blurOuts = move("blur-out", "to", (title, d, x, y, z) => animation(title,
6
+ keyFrame(0,
7
+ opacity(1),
8
+ d && translate3d(),
9
+ backdropFilter(blur(px(10)))
10
+ ),
11
+ keyFrame(100,
12
+ opacity(0),
13
+ d && translate3d(x, y, z),
14
+ backdropFilter(blur(px(0)))
15
+ )
16
+ ))
17
+ ;
@@ -1,8 +1,12 @@
1
1
  import { CSSBuilder } from "../css";
2
2
 
3
- const { animation, keyFrame, transitionTimingFunction, opacity, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
3
+ const { move, animation, keyFrame, transitionTimingFunction, opacity, translate3d, perc, vh, vw, px } = CSSBuilder;
4
4
 
5
- const bounce = (title: string, x = 0 as string | number, y = 0 as string | number, z = 0 as string | number) => {
5
+ const bounce = (title: string, direction?: string, x = 0 as string | number, y = 0 as string | number, z = 0 as string | number) => {
6
+
7
+ if (!direction) {
8
+ return void 0;
9
+ }
6
10
 
7
11
  const mx = (typeof x === "string" ? parseInt(x, 10) : x) > 0 ? 1 : -1;
8
12
  const my = (typeof y === "string" ? parseInt(y, 10) : y) > 0 ? 1 : -1;
@@ -20,42 +24,22 @@ const bounce = (title: string, x = 0 as string | number, y = 0 as string | numbe
20
24
  ),
21
25
  keyFrame(0,
22
26
  opacity(0),
23
- transform(translate3d(x, y, z))
27
+ translate3d(x, y, z)
24
28
  ),
25
29
  keyFrame(60,
26
30
  opacity(1),
27
- transform(translate3d(px(-25 * cx), px(-25 * cy), px(-25 * cz)))
31
+ translate3d(px(-25 * cx), px(-25 * cy), px(-25 * cz))
28
32
  ),
29
33
  keyFrame(75,
30
- transform(translate3d(px(10 * cx), px(10 * cy), px(10 * cz)))
34
+ translate3d(px(10 * cx), px(10 * cy), px(10 * cz))
31
35
  ),
32
36
  keyFrame(90,
33
- transform(translate3d(px(-5 * cx), px(-5 * cy), px(-5 * cz)))
37
+ translate3d(px(-5 * cx), px(-5 * cy), px(-5 * cz))
34
38
  ),
35
39
  keyFrame(100,
36
- transform()
40
+ translate3d()
37
41
  )
38
42
  );
39
43
  };
40
44
 
41
- export const bounces = [
42
- bounce("bounce-from-left", perc(-100), 0, 0),
43
- bounce("bounce-from-right", perc(100), 0, 0),
44
- bounce("bounce-from-top", 0, perc(-100), 0),
45
- bounce("bounce-from-bottom", 0, perc(100), 0),
46
-
47
- bounce("bounce-from-far-left", vw(-100), 0, 0),
48
- bounce("bounce-from-far-right", vw(100), 0, 0),
49
- bounce("bounce-from-far-top", 0, vh(-100), 0),
50
- bounce("bounce-from-far-bottom", 0, vh(100), 0),
51
-
52
- bounce("bounce-from-top-left", perc(-100), perc(-100), 0),
53
- bounce("bounce-from-top-right", perc(100), perc(-100), 0),
54
- bounce("bounce-from-bottom-left", perc(-100), perc(100), 0),
55
- bounce("bounce-from-bottom-right", perc(100), perc(100), 0),
56
-
57
- bounce("bounce-from-far-top-left", vw(-100), vh(-100), 0),
58
- bounce("bounce-from-far-top-right", vw(100), vh(-100), 0),
59
- bounce("bounce-from-far-bottom-left", vw(-100), vh(100), 0),
60
- bounce("bounce-from-far-bottom-right", vw(100), vh(100), 0),
61
- ];
45
+ export const bounceIns = move("bounce-in", "from", bounce);
@@ -0,0 +1,45 @@
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, transitionTimingFunction, opacity, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ const bounce = (title: string, direction?: string, x = 0 as string | number, y = 0 as string | number, z = 0 as string | number) => {
6
+
7
+ if(!direction) {
8
+ return void 0;
9
+ }
10
+
11
+ const mx = (typeof x === "string" ? parseInt(x, 10) : x) > 0 ? 1 : -1;
12
+ const my = (typeof y === "string" ? parseInt(y, 10) : y) > 0 ? 1 : -1;
13
+ const mz = (typeof z === "string" ? parseInt(z, 10) : z) > 0 ? 1 : -1;
14
+
15
+ const cx = x ? mx : 0;
16
+ const cy = y ? my : 0;
17
+ const cz = z ? mz : 0;
18
+
19
+ return animation(
20
+ title,
21
+ keyFrame(
22
+ "0%, 100%, 60%, 75%, 90%",
23
+ transitionTimingFunction("cubic-bezier(0.215, .61, .355, 1)"),
24
+ ),
25
+ keyFrame(0,
26
+ opacity(1),
27
+ translate3d()
28
+ ),
29
+ keyFrame(60,
30
+ translate3d(px(-5 * cx), px(-5 * cy), px(-5 * cz))
31
+ ),
32
+ keyFrame(75,
33
+ translate3d(px(10 * cx), px(10 * cy), px(10 * cz))
34
+ ),
35
+ keyFrame(90,
36
+ translate3d(px(-25 * cx), px(-25 * cy), px(-25 * cz))
37
+ ),
38
+ keyFrame(100,
39
+ opacity(0),
40
+ translate3d(x, y, z)
41
+ ),
42
+ );
43
+ };
44
+
45
+ export const bounceOuts = move("bounce-out", "to", bounce);
@@ -9,11 +9,40 @@ const px = (n: number | string) => n === 0
9
9
  ? 0
10
10
  : (typeof n === "string" ? n : `${n}px`);
11
11
 
12
+ const deg = (n: number | string) => typeof n === "string" ? n : `${n}deg`;
13
+
14
+
12
15
  const translate3d = (x=0 as number | string, y=0 as number | string, z=0 as number | string) => (x || y || z)
13
- ? `translate3d(${px(x)}, ${px(y)}, ${px(z)})`
14
- : "none";
16
+ ? { translate: `${px(x)} ${px(y)} ${px(z)}`, toString: () => `translate3d(${px(x)}, ${px(y)}, ${px(z)})` }
17
+ : { translate: "none", toString: () => "none" };
18
+
19
+ const rotate = (n?) => n
20
+ ? { rotate: deg(n), toString: () =>`rotate(${n})`}
21
+ : { rotate: "none", toString: () => `rotate(0deg)` };
22
+
23
+ const skew = (n?) => n
24
+ ? { rotate: deg(n), toString: () =>`skew(${n})`}
25
+ : { rotate: "none", toString: () => `skew(0deg)` };
26
+
27
+ const skewX = (n?) => n
28
+ ? { rotate: deg(n), toString: () =>`skewX(${n})`}
29
+ : { rotate: "none", toString: () => `skewX(0deg)` };
30
+
31
+ const skewY = (n?) => n
32
+ ? { rotate: deg(n), toString: () =>`skewY(${n})`}
33
+ : { rotate: "none", toString: () => `skewY(0deg)` };
34
+
35
+ const skewZ = (n?) => n
36
+ ? { rotate: deg(n), toString: () =>`skewZ(${n})`}
37
+ : { rotate: "none", toString: () => `skewZ(0deg)` };
38
+
39
+ const scale = (... x: any[]) => x.length
40
+ ? { scale: `${x.join(" ")}`, toString: () => `scale(${x.join(",")})` }
41
+ : { scale: "none", toString: () => `scale(1)` };
15
42
 
16
- const transform = (... n: string[]) => ({ transform: n.length ? n.join(" ") : "none"});
43
+
44
+
45
+ const transform = (... n: any[]) => ({ transform: n.length ? n.join(" ") : "none"});
17
46
 
18
47
  const transitionTimingFunction = (n: string) => ({ ["transition-timing-function"]: n });
19
48
 
@@ -29,6 +58,8 @@ export interface IProperties {
29
58
  ["backdrop-filter"]?: string;
30
59
  opacity?: string;
31
60
  scale?: string;
61
+ rotate?: string;
62
+ translate?: string;
32
63
  }
33
64
 
34
65
  export interface IKeyframe extends IProperties {
@@ -36,13 +67,15 @@ export interface IKeyframe extends IProperties {
36
67
  }
37
68
 
38
69
  const keyFrame = (offset: number | string, ... a: IProperties[]): IKeyframe => typeof offset === "string"
39
- ? { offset, ... Object.assign({}, ... a)}
70
+ ? { offset, ... Object.assign({}, ... a.filter((x) => x))}
40
71
  : {
41
72
  offset: offset > 1 ? `${offset}%` : `${Math.floor(offset * 100)}%`,
42
- ... Object.assign({}, ... a)};
73
+ ... Object.assign({}, ... a.filter((x) => x))};
43
74
 
44
75
  const opacity = (n: number) => ({ opacity: `${n}` });
45
76
 
77
+
78
+
46
79
  export interface IAnimation {
47
80
  title: string,
48
81
  keyframes: IKeyframe[];
@@ -51,28 +84,33 @@ export interface IAnimation {
51
84
  const vh = (n) => `${n}vh`;
52
85
  const vw = (n) => `${n}vw`;
53
86
 
54
- const move = (title, fx: (t: string, x?: string | number, y?: string | number, z? : string | number) => IAnimation) => {
87
+ const move = (title, direction, fx: (t: string, d?: string, x?: string | number, y?: string | number, z? : string | number) => IAnimation) => {
88
+
89
+ const first = [fx(title)].filter((x) => x);
90
+
55
91
  return [
56
92
 
57
- fx(`${title}-from-left`, perc(-100)),
58
- fx(`${title}-from-right`, perc(100)),
59
- fx(`${title}-from-top`, 0, perc(-100)),
60
- fx(`${title}-from-bottom`, perc(100)),
93
+ ... first,
94
+
95
+ fx(`${title}-${direction}-left`, direction, perc(-100)),
96
+ fx(`${title}-${direction}-right`, direction, perc(100)),
97
+ fx(`${title}-${direction}-top`, direction, 0, perc(-100)),
98
+ fx(`${title}-${direction}-bottom`, direction, perc(100)),
61
99
 
62
- fx(`${title}-from-far-left`, vw(-100)),
63
- fx(`${title}-from-far-right`, vw(100)),
64
- fx(`${title}-from-far-top`, 0, vh(-100)),
65
- fx(`${title}-from-far-bottom`, vh(100)),
100
+ fx(`${title}-${direction}-far-left`, direction, vw(-100)),
101
+ fx(`${title}-${direction}-far-right`, direction, vw(100)),
102
+ fx(`${title}-${direction}-far-top`, direction, 0, vh(-100)),
103
+ fx(`${title}-${direction}-far-bottom`, direction, vh(100)),
66
104
 
67
- fx(`${title}-from-top-left`, perc(-100), perc(-100)),
68
- fx(`${title}-from-top-right`, perc(100), perc(-100)),
69
- fx(`${title}-from-bottom-left`, perc(-100), perc(100)),
70
- fx(`${title}-from-bottom-right`, perc(100), perc(100)),
105
+ fx(`${title}-${direction}-top-left`, direction, perc(-100), perc(-100)),
106
+ fx(`${title}-${direction}-top-right`, direction, perc(100), perc(-100)),
107
+ fx(`${title}-${direction}-bottom-left`, direction, perc(-100), perc(100)),
108
+ fx(`${title}-${direction}-bottom-right`, direction, perc(100), perc(100)),
71
109
 
72
- fx(`${title}-from-far-top-left`, vw(-100), vh(-100)),
73
- fx(`${title}-from-far-top-right`, vw(100), vh(-100)),
74
- fx(`${title}-from-far-bottom-left`, vw(-100), vh(100)),
75
- fx(`${title}-from-far-bottom-right`, vw(100), vh(100)),
110
+ fx(`${title}-${direction}-far-top-left`, direction, vw(-100), vh(-100)),
111
+ fx(`${title}-${direction}-far-top-right`, direction, vw(100), vh(-100)),
112
+ fx(`${title}-${direction}-far-bottom-left`, direction, vw(-100), vh(100)),
113
+ fx(`${title}-${direction}-far-bottom-right`, direction, vw(100), vh(100)),
76
114
 
77
115
  ];
78
116
  };
@@ -89,6 +127,13 @@ export const CSSBuilder = {
89
127
  transform,
90
128
  keyFrame,
91
129
  opacity,
130
+ rotate,
131
+ scale,
132
+ skew,
133
+ skewX,
134
+ skewY,
135
+ skewZ,
136
+ deg,
92
137
  animation: (title: string, ... keyframes: IKeyframe[]) => ({
93
138
  title,
94
139
  keyframes
@@ -1,3 +1,7 @@
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, transitionTimingFunction, opacity, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
1
5
  export const fadeIn = {
2
6
  title: "fade-in",
3
7
  keyFrames: [
@@ -8,4 +12,17 @@ export const fadeIn = {
8
12
  opacity: 1
9
13
  }
10
14
  ]
11
- };
15
+ };
16
+
17
+ export const fadeIns = move("fade-in", "from", (title, direction, x, y, z) =>
18
+ animation(title,
19
+ keyFrame(0,
20
+ opacity(0.3),
21
+ direction && translate3d(x, y, z)
22
+ ),
23
+ keyFrame(100,
24
+ opacity(1),
25
+ direction && translate3d()
26
+ )
27
+ )
28
+ );
@@ -1,11 +1,16 @@
1
- export const fadeOut = {
2
- title: "fade-out",
3
- keyFrames: [
4
- {
5
- opacity: 1
6
- },
7
- {
8
- opacity: 0.3
9
- },
10
- ]
11
- };
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, transitionTimingFunction, opacity, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const fadeOuts = move("fade-out", "to", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ opacity(1),
9
+ direction && translate3d()
10
+ ),
11
+ keyFrame(100,
12
+ opacity(0.3),
13
+ direction && translate3d(x, y, z)
14
+ )
15
+ )
16
+ );
@@ -1,11 +1,16 @@
1
- export const rotateIn = {
2
- title: "rotate-in",
3
- keyFrames: [
4
- {
5
- rotate: "180deg"
6
- },
7
- {
8
- rotate: "0deg"
9
- }
10
- ]
11
- };
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, rotate, deg, opacity, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const rotateIns = move("rotate-in", "from", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ rotate(deg(180)),
9
+ direction && translate3d(x, y, z)
10
+ ),
11
+ keyFrame(100,
12
+ rotate(),
13
+ direction && translate3d(x, y, z)
14
+ )
15
+ )
16
+ );
@@ -1,11 +1,16 @@
1
- export const rotateOut = {
2
- title: "rotate-out",
3
- keyFrames: [
4
- {
5
- rotate: "0deg"
6
- },
7
- {
8
- rotate: "180deg"
9
- }
10
- ]
11
- };
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, rotate, deg, opacity, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const rotateOuts = move("rotate-out", "to", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ rotate(),
9
+ direction && transform()
10
+ ),
11
+ keyFrame(100,
12
+ rotate(180),
13
+ direction && translate3d(x, y, z)
14
+ )
15
+ )
16
+ );
@@ -1,11 +1,16 @@
1
- export const scaleIn = {
2
- title: "scale-in",
3
- keyFrames: [
4
- {
5
- scale: 2
6
- },
7
- {
8
- scale: 1
9
- }
10
- ]
11
- };
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, rotate, deg, scale, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const scaleIns = move("scale-in", "from", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ scale(2),
9
+ direction && translate3d(x, y, z)
10
+ ),
11
+ keyFrame(100,
12
+ scale(1),
13
+ direction && translate3d()
14
+ )
15
+ )
16
+ );
@@ -1,11 +1,16 @@
1
- export const scaleOut = {
2
- title: "scale-out",
3
- keyFrames: [
4
- {
5
- scale: 1
6
- },
7
- {
8
- scale: 2
9
- }
10
- ]
11
- };
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, rotate, deg, scale, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const scaleOuts = move("scale-out", "to", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ scale(1),
9
+ direction && transform()
10
+ ),
11
+ keyFrame(100,
12
+ scale(2),
13
+ direction && translate3d(x, y, z)
14
+ ),
15
+ )
16
+ );
@@ -0,0 +1,14 @@
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, rotate, deg, scale, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const slideIns = move("slide-in", "from", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ direction && translate3d(x, y, z)
9
+ ),
10
+ keyFrame(100,
11
+ direction && translate3d()
12
+ )
13
+ )
14
+ );
@@ -0,0 +1,14 @@
1
+ import { CSSBuilder } from "../css";
2
+
3
+ const { move, animation, keyFrame, rotate, deg, scale, transform, translate3d, perc, vh, vw, px } = CSSBuilder;
4
+
5
+ export const slideOuts = move("slide-out", "to", (title, direction, x, y, z) =>
6
+ animation(title,
7
+ keyFrame(0,
8
+ direction && transform()
9
+ ),
10
+ keyFrame(100,
11
+ direction && translate3d(x, y, z)
12
+ ),
13
+ )
14
+ );