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AMmC,EAAeC,SAASC,cAAc,kBACxCF,GAAc,IAAIrC,EAAaqC,E","sources":["webpack://tombras/./js/components/RecipeLayout.js"],"sourcesContent":["import { componentAnimationHandler } from \"../animations/AnimationHandler\";\nimport { qs } from \"../utils\";\nimport {\n\tDEFAULT_TIME,\n\tSIMPLE_ANIMATION_START,\n\tSIMPLE_ANIMATION_FINISH,\n\tDEFAULT_STAGGER,\n\tDEFAULT_TIME_SHORT,\n} from \"../animations/config\";\nimport gsap from \"gsap\";\nclass RecipeLayout {\n\tconstructor(el) {\n\t\tthis.el = el;\n\t\tthis.dom = this.domElement();\n\n\t\tthis.setupEvents();\n\t}\n\n\tdomElement() {\n\t\treturn {\n\t\t\ttopRatedBar: qs(\".recipe-top-rated\", this.el),\n\t\t\ttitle: qs(\".recipe-title\", this.el),\n\t\t\tattributes: qs(\".recipe-attributes\", this.el),\n\t\t\tmedia: qs(\".recipe-media\", this.el),\n\t\t\tingredients: qs(\".recipe-ingredients\", this.el),\n\t\t\tdirections: qs(\".recipe-directions\", this.el),\n\t\t};\n\t}\n\n\t// TODO: make this really cool\n\telementAnimations() {\n\t\tconst simpleAnimation = el => {\n\t\t\tgsap.fromTo(\n\t\t\t\tel,\n\t\t\t\tDEFAULT_TIME_SHORT,\n\t\t\t\tSIMPLE_ANIMATION_START,\n\t\t\t\tSIMPLE_ANIMATION_FINISH,\n\t\t\t);\n\t\t};\n\t\treturn {\n\t\t\ttopRatedBar() {\n\t\t\t\tsimpleAnimation(this);\n\t\t\t},\n\t\t\ttitle() {\n\t\t\t\tconst content = this.children[0].children;\n\t\t\t\tconst tl = gsap.timeline();\n\t\t\t\ttl.staggerFromTo(\n\t\t\t\t\tcontent,\n\t\t\t\t\tDEFAULT_TIME_SHORT,\n\t\t\t\t\tSIMPLE_ANIMATION_START,\n\t\t\t\t\tSIMPLE_ANIMATION_FINISH,\n\t\t\t\t\tDEFAULT_STAGGER,\n\t\t\t\t);\n\t\t\t},\n\t\t\tattributes() {\n\t\t\t\tsimpleAnimation(this);\n\t\t\t},\n\t\t\tmedia() {\n\t\t\t\tsimpleAnimation(this);\n\t\t\t},\n\t\t\tingredients() {\n\t\t\t\tsimpleAnimation(this);\n\t\t\t},\n\t\t\tdirections() {\n\t\t\t\tsimpleAnimation(this);\n\t\t\t},\n\t\t};\n\t}\n\n\tsetupEvents() {\n\t\tconst elements = Object.keys(this.dom);\n\t\telements.forEach(key => {\n\t\t\tconst el = this.dom[key];\n\t\t\tconst animations = this.elementAnimations();\n\t\t\tconsole.log(52, key, animations, animations[key]);\n\t\t\tif (animations[key]) {\n\t\t\t\tcomponentAnimationHandler.add(el);\n\t\t\t\tel.addEventListener(\"inview\", animations[key].bind(el));\n\t\t\t}\n\t\t});\n\t\t// this.dom.addEventListener('inview', this.animate.bind(this));\n\t}\n}\n\nconst recipeLayout = document.querySelector(\".recipe-layout\");\nif (recipeLayout) new RecipeLayout(recipeLayout);\n"],"names":["RecipeLayout","constructor","el","this","dom","domElement","setupEvents","topRatedBar","qs","title","attributes","media","ingredients","directions","elementAnimations","simpleAnimation","gsap","fromTo","DEFAULT_TIME_SHORT","SIMPLE_ANIMATION_START","SIMPLE_ANIMATION_FINISH","content","children","tl","timeline","staggerFromTo","DEFAULT_STAGGER","elements","Object","keys","forEach","key","animations","componentAnimationHandler","add","addEventListener","bind","recipeLayout","document","querySelector"],"sourceRoot":""}