Blocksy Companion - Version 1.8.56

Version Description

Download this release

Release Info

Developer creativethemeshq
Plugin Icon wp plugin Blocksy Companion
Version 1.8.56
Comparing to
See all releases

Code changes from version 1.8.55 to 1.8.56

blocksy-companion.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Blocksy Companion
5
  Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
6
- Version: 1.8.55
7
  Author: CreativeThemes
8
  Author URI: https://creativethemes.com
9
  Text Domain: blocksy-companion
3
  /*
4
  Plugin Name: Blocksy Companion
5
  Description: This plugin is the companion for the Blocksy theme, it runs and adds its enhacements only if the Blocksy theme is installed and active.
6
+ Version: 1.8.56
7
  Author: CreativeThemes
8
  Author URI: https://creativethemes.com
9
  Text Domain: blocksy-companion
framework/extensions/cookies-consent/static/bundle/main.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
framework/extensions/newsletter-subscribe/static/bundle/main.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
framework/extensions/product-reviews/static/bundle/main-admin.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
framework/extensions/product-reviews/static/bundle/main.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
framework/extensions/trending/static/bundle/main.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
framework/extensions/widgets/static/bundle/main.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
framework/theme-integration.php CHANGED
@@ -514,7 +514,10 @@ class ThemeIntegration {
514
 
515
  if ($svg && function_exists('simplexml_load_string')) {
516
  $svg = @simplexml_load_string($svg);
517
- $attributes = $svg->attributes();
 
 
 
518
  }
519
 
520
  if (
514
 
515
  if ($svg && function_exists('simplexml_load_string')) {
516
  $svg = @simplexml_load_string($svg);
517
+
518
+ if ($svg) {
519
+ $attributes = $svg->attributes();
520
+ }
521
  }
522
 
523
  if (
languages/blocksy-companion.pot CHANGED
@@ -7,7 +7,7 @@ msgstr ""
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
- "POT-Creation-Date: 2022-11-02 22:28+0000\n"
11
  "Project-Id-Version: undefined\n"
12
  "X-Poedit-Basepath: ..\n"
13
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;"
7
  "MIME-Version: 1.0\n"
8
  "Content-Type: text/plain; charset=UTF-8\n"
9
  "Content-Transfer-Encoding: 8bit\n"
10
+ "POT-Creation-Date: 2022-11-04 16:01+0000\n"
11
  "Project-Id-Version: undefined\n"
12
  "X-Poedit-Basepath: ..\n"
13
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;"
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires PHP: 7.0
5
  Tested up to: 6.1
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
- Stable tag: 1.8.55
9
 
10
  == Description ==
11
 
@@ -23,6 +23,10 @@ It runs and adds its enhancements only if the Blocksy theme is installed and act
23
  2. Activate the plugin by going to **Plugins** page in WordPress admin and clicking on **Activate** link.
24
 
25
  == Changelog ==
 
 
 
 
26
  1.8.55: 2022-11-03
27
  - Improvement: XML strategy for SVG dimensions when simple xml is absent
28
  - Improvement: Correctly recalculate sticky position on page resize
5
  Tested up to: 6.1
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
+ Stable tag: 1.8.56
9
 
10
  == Description ==
11
 
23
  2. Activate the plugin by going to **Plugins** page in WordPress admin and clicking on **Activate** link.
24
 
25
  == Changelog ==
26
+ 1.8.56: 2022-11-04
27
+ - Improvement: Sticky header shrink with border correctly position floating cart
28
+ - Improvement: Better logic for simple XML svg parsing
29
+
30
  1.8.55: 2022-11-03
31
  - Improvement: XML strategy for SVG dimensions when simple xml is absent
32
  - Improvement: Correctly recalculate sticky position on page resize
static/bundle/account-lazy.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
static/bundle/dashboard.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
static/bundle/options.min.css CHANGED
@@ -1,5 +1,5 @@
1
  /**
2
- * - v1.8.55
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
1
  /**
2
+ * - v1.8.56
3
  *
4
  * Copyright (c) 2022
5
  * Licensed GPLv2+
static/bundle/sticky.js CHANGED
@@ -1 +1 @@
1
- !function(){"use strict";var t={n:function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.ctEvents,r=t.n(e),n=window.ctFrontend,i=function(t,e,r){return Math.max(t,Math.min(e,r))},o=function(t,e,r){return e[0]+(e[1]-e[0])/(t[1]-t[0])*(r-t[0])},a=function(t){var e=getComputedStyle(t);return parseFloat(e.getPropertyValue("--height"))},c=function(t){if(t.blcInitialHeight)return t.blcInitialHeight;var e=t.firstElementChild;t.firstElementChild.firstElementChild&&(e=t.firstElementChild.firstElementChild);var r=e.getBoundingClientRect().height;return t.blcInitialHeight=r,r},s=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.blcStickyHeight)return t.blcStickyHeight;var r=c(t),n=getComputedStyle(t),i=getComputedStyle(t.firstElementChild);if(t.closest('[data-sticky*="yes"]')){var o=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);e||(o=0);var s=t.getBoundingClientRect().height-o;if(s!==r||r>a(t))return t.blcStickyHeight=t.getBoundingClientRect().height,s}var l=100;return t.dataset.row.includes("middle")&&(l=n.getPropertyValue("--sticky-shrink")),l&&(r*=parseFloat(l)/100),r},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return 0},e=document.querySelector(".ct-floating-bar");e&&e.style.setProperty("--header-sticky-height-animated",t())};function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var d=null,y=function(t){var e,r=t.stickyContainer,n=t.startPosition;(e=r.querySelectorAll('[data-row*="middle"]'),function(t){if(Array.isArray(t))return u(t)}(e)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(t){if(t.querySelector('[data-id="logo"] .site-logo-container')){var e=t.querySelector('[data-id="logo"] .site-logo-container'),r=function(t){var e=t.logo,r=t.row;if(d)return d;var n=parseFloat(getComputedStyle(e).getPropertyValue("--logo-max-height")||50),i=parseFloat(getComputedStyle(e).getPropertyValue("--logo-sticky-shrink").toString().replace(",",".")||1),o=c(r),a=s(r);return d={initialHeight:n,stickyShrink:i,rowInitialHeight:o,rowStickyHeight:a}}({logo:e,row:t}),a=r.initialHeight,l=r.stickyShrink,u=r.rowInitialHeight,y=r.rowStickyHeight,f=a*l;1!==l&&e.style.setProperty("--logo-shrink-height","".concat(o([n,n+Math.abs(u===y?a-f:u-y)],[1,l],i(n,n+Math.abs(u===y?a-f:u-y),scrollY))*a,"px"))}}))},f=null,h=function(t){var e=t.stickyContainer,r=(t.containerInitialHeight,t.startPosition);e.querySelector('[data-row*="middle"]')&&[e.querySelector('[data-row*="middle"]')].map((function(t){var e=function(t){var e=t.row;if(f)return f;var r=c(e),n=s(e);return f={rowInitialHeight:r,rowStickyHeight:n}}({row:t}),n=e.rowInitialHeight,a=e.rowStickyHeight;if(n!==a){var l;l=o([r,r+Math.abs(n-a)],[n,a],i(r,r+Math.abs(n-a),scrollY)),t.style.setProperty("--shrink-height","".concat(l,"px"))}}))};function m(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function g(t){return function(t){if(Array.isArray(t))return k(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var v=function(t){var e=t.stickyContainer,r=g(e.querySelectorAll("[data-row]")).reduce((function(t,e){return t+s(e,!1)}),0);return{stickyContainerHeight:r,stickyContainerHeightAbsolute:r+parseFloat(getComputedStyle(e).top)}},b=null;function w(t){return function(t){if(Array.isArray(t))return S(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function A(t){return function(t){if(Array.isArray(t))return C(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var O=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yes";Array.from(t.querySelectorAll("[data-row][data-transparent-row]")).map((function(t){t.dataset.transparentRow=e}))},x=null,I=null,j=null,H=null,P=function(){f=null,d=null,x=null,I=null,j=null,H=null,q=null};r().on("blocksy:sticky:compute",(function(){setTimeout((function(){P(),Y()}),100)})),window.wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",(function(t){setTimeout((function(){P(),Y()}),500)}));var q=null,Y=function(){if(q!==scrollY){var t=document.querySelector('[data-device="'.concat((0,n.getCurrentScreen)(),'"] [data-sticky]'));if(t){var e=I;e||(e=I=Array.from(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+e.getBoundingClientRect().height}),0),t.parentNode.style.height="".concat(e,"px"));var r=x;null===r&&(r=function(t){if(-1===t.dataset.sticky.indexOf("shrink")&&-1===t.dataset.sticky.indexOf("auto-hide"))return t.parentNode.getBoundingClientRect().height+200;var e=t.closest("header").getBoundingClientRect().top+scrollY;if(e>0){var r=document.elementFromPoint(0,3);r&&function(t){for(var e=[];t&&t!==document;t=t.parentNode)e.push(t);return e}(r).map((function(t){return getComputedStyle(t).position})).indexOf("fixed")>-1&&(e-=r.getBoundingClientRect().height)}var n=t.parentNode,i=getComputedStyle(document.body),o=parseFloat(i.getPropertyValue("--header-sticky-offset")||0);if(o+=parseFloat(i.getPropertyValue("--frame-size"))||0,1===n.parentNode.children.length||n.parentNode.children[0].classList.contains("ct-sticky-container"))return e>0?e-o:e;var a=Array.from(n.parentNode.children).reduce((function(t,e,r){return t.indexOf(0)>-1||!e.dataset.row?[].concat(A(t),[0]):[].concat(A(t),[e.classList.contains("ct-sticky-container")?0:e.getBoundingClientRect().height])}),[]).reduce((function(t,e){return t+e}),e);return a>0?a-o:a}(t),x=r);var i=j;null===i&&(i=t.closest("[data-device]").getBoundingClientRect().height,j=i);var o=H,c=t.dataset.sticky.split(":").filter((function(t){return"yes"!==t&&"no"!==t&&"fixed"!==t}));o||(o=parseInt(t.getBoundingClientRect().height),H=parseInt(o),l((function(){return-1===c.indexOf("auto-hide")?o>A(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+a(e)}),0)?"".concat(o,"px"):"".concat(A(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+s(e)}),0),"px"):"0px"})));var u=r>0&&Math.abs(window.scrollY-r)<5||window.scrollY>r;c.indexOf("shrink")>-1&&(u=r>0?window.scrollY>=r:window.scrollY>0),setTimeout((function(){u&&-1===document.body.dataset.header.indexOf("shrink")&&(document.body.dataset.header="".concat(document.body.dataset.header,":shrink")),!u&&document.body.dataset.header.indexOf("shrink")>-1&&(document.body.dataset.header=document.body.dataset.header.replace(":shrink",""))}),300);var d=scrollY;c.indexOf("shrink")>-1&&function(t){var e=t.containerInitialHeight,r=t.stickyContainer,n=t.isSticky,i=t.startPosition,o=t.stickyComponents;if(0===i&&0===window.scrollY&&(r.dataset.sticky=["fixed"].concat(m(o)).join(":")),n){if(o.indexOf("yes")>-1)return;-1===r.dataset.sticky.indexOf("yes")&&(O(r,"no"),r.dataset.sticky=["yes"].concat(m(o)).join(":")),y({stickyContainer:r,startPosition:i}),h({stickyContainer:r,containerInitialHeight:e,startPosition:i})}else Array.from(r.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")})),Array.from(r.querySelectorAll('[data-row*="middle"] .site-logo-container')).map((function(t){return t.removeAttribute("style")})),O(r,"yes"),0===i&&window.scrollY<=0?r.dataset.sticky=["fixed"].concat(m(o)).join(":"):r.dataset.sticky=o.join(":")}({stickyContainer:t,stickyContainerHeight:o,containerInitialHeight:e,isSticky:u,startPosition:r,stickyComponents:c}),c.indexOf("auto-hide")>-1&&function(t){var e=t.currentScrollY,r=t.stickyContainer,n=t.containerInitialHeight,i=t.headerInitialHeight,o=t.startPosition,a=t.isSticky,c=t.stickyComponents;a&&e-t.prevScrollY==0&&l((function(){return"0px"})),a?-1===r.dataset.sticky.indexOf("yes")&&e>2*i+o&&(r.dataset.sticky=["yes"].concat(g(c)).join(":"),y({stickyContainer:r,startPosition:o}),h({stickyContainer:r,containerInitialHeight:n,startPosition:o}),O(r,"no"),document.body.removeAttribute("style")):(Array.from(r.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")})),Array.from(r.querySelectorAll('[data-row*="middle"] .site-logo-container')).map((function(t){return t.removeAttribute("style")})),r.dataset.sticky=g(c).join(":"),O(r,"yes"),l((function(){return"0px"})),b=null),null===b&&(b=1e3);var s=b+t.prevScrollY-e,u=0;if(e>2*i+o||r.dataset.sticky.indexOf("yes")>-1){if(e<=o)u=0;else if(e>t.prevScrollY){var d=v({stickyContainer:r}).stickyContainerHeightAbsolute;u=Math.abs(s)>d?-d:s}else u=s>0?0:s;r.style.transform="translateY(".concat(u,"px)"),b=u}else r.removeAttribute("style");r.dataset.sticky.indexOf("yes")>-1&&(e<=o||e>t.prevScrollY||(y({stickyContainer:r,startPosition:o}),h({stickyContainer:r,containerInitialHeight:n,startPosition:o}))),l((function(){var t=v({stickyContainer:r}).stickyContainerHeight;return"".concat(t-Math.abs(u),"px")}))}({stickyContainer:t,isSticky:u,startPosition:r,stickyComponents:c,containerInitialHeight:e,stickyContainerHeight:o,headerInitialHeight:i,currentScrollY:d,prevScrollY:q}),(c.indexOf("slide")>-1||c.indexOf("fade")>-1)&&function(t){var e=t.stickyContainer,r=t.startPosition,n=t.stickyComponents;t.isSticky?(-1===e.dataset.sticky.indexOf("yes")&&(e.dataset.sticky=["yes-start"].concat(w(n)).join(":"),setTimeout((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-start","yes-end"),setTimeout((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-end","yes")}),200)}),1)),O(e,"no")):-1===e.dataset.sticky.indexOf("yes-hide")&&e.dataset.sticky.indexOf("yes:")>-1&&(Math.abs(window.scrollY-r)>10?(e.dataset.sticky=n.join(":"),setTimeout((function(){Array.from(e.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")}))}),300),O(e,"yes")):(e.dataset.sticky=["yes-hide-start"].concat(w(n)).join(":"),requestAnimationFrame((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-hide-start","yes-hide-end"),setTimeout((function(){e.dataset.sticky=n.join(":"),setTimeout((function(){Array.from(e.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")}))}),300),O(e,"yes")}),200)}))))}({stickyContainer:t,isSticky:u,startPosition:r,stickyComponents:c}),q=d}}},E=function(){document.querySelector("header [data-sticky]")&&(window.addEventListener("resize",(function(t){P(),Y(t),r().trigger("ct:header:update")}),!1),window.addEventListener("orientationchange",(function(t){P(),Y(t),r().trigger("ct:header:update")})),window.addEventListener("scroll",Y,!1),window.addEventListener("load",Y,!1),Y())};document.body.className.indexOf("e-preview")>-1?setTimeout((function(){E()}),500):E(),(0,n.registerDynamicChunk)("blocksy_sticky_header",{mount:function(t){}})}();
1
+ !function(){"use strict";var t={n:function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},d:function(e,r){for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.ctEvents,r=t.n(e),n=window.ctFrontend,i=function(t,e,r){return Math.max(t,Math.min(e,r))},o=function(t,e,r){return e[0]+(e[1]-e[0])/(t[1]-t[0])*(r-t[0])},a=function(t){var e=getComputedStyle(t),r=getComputedStyle(t.firstElementChild),n=parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth)+parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth);return parseFloat(e.getPropertyValue("--height"))+n},c=function(t){if(t.blcInitialHeight)return t.blcInitialHeight;var e=t.firstElementChild;t.firstElementChild.firstElementChild&&(e=t.firstElementChild.firstElementChild);var r=e.getBoundingClientRect().height;return t.blcInitialHeight=r,r},s=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.blcStickyHeight)return t.blcStickyHeight;var r=c(t),n=getComputedStyle(t),i=getComputedStyle(t.firstElementChild);if(t.closest('[data-sticky*="yes"]')){var o=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth)+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);e||(o=0);var s=t.getBoundingClientRect().height-o;if(s!==r||r>a(t))return t.blcStickyHeight=t.getBoundingClientRect().height,s}var l=100;return t.dataset.row.includes("middle")&&(l=n.getPropertyValue("--sticky-shrink")),l&&(r*=parseFloat(l)/100),r},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return 0},e=document.querySelector(".ct-floating-bar");e&&e.style.setProperty("--header-sticky-height-animated",t())};function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var d=null,y=function(t){var e,r=t.stickyContainer,n=t.startPosition;(e=r.querySelectorAll('[data-row*="middle"]'),function(t){if(Array.isArray(t))return u(t)}(e)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(t){if(t.querySelector('[data-id="logo"] .site-logo-container')){var e=t.querySelector('[data-id="logo"] .site-logo-container'),r=function(t){var e=t.logo,r=t.row;if(d)return d;var n=parseFloat(getComputedStyle(e).getPropertyValue("--logo-max-height")||50),i=parseFloat(getComputedStyle(e).getPropertyValue("--logo-sticky-shrink").toString().replace(",",".")||1),o=c(r),a=s(r);return d={initialHeight:n,stickyShrink:i,rowInitialHeight:o,rowStickyHeight:a}}({logo:e,row:t}),a=r.initialHeight,l=r.stickyShrink,u=r.rowInitialHeight,y=r.rowStickyHeight,f=a*l;1!==l&&e.style.setProperty("--logo-shrink-height","".concat(o([n,n+Math.abs(u===y?a-f:u-y)],[1,l],i(n,n+Math.abs(u===y?a-f:u-y),scrollY))*a,"px"))}}))},f=null,h=function(t){var e=t.stickyContainer,r=(t.containerInitialHeight,t.startPosition);e.querySelector('[data-row*="middle"]')&&[e.querySelector('[data-row*="middle"]')].map((function(t){var e=function(t){var e=t.row;if(f)return f;var r=c(e),n=s(e);return f={rowInitialHeight:r,rowStickyHeight:n}}({row:t}),n=e.rowInitialHeight,a=e.rowStickyHeight;if(n!==a){var l;l=o([r,r+Math.abs(n-a)],[n,a],i(r,r+Math.abs(n-a),scrollY)),t.style.setProperty("--shrink-height","".concat(l,"px"))}}))};function m(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return p(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function g(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return b(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var k=function(t){var e=t.stickyContainer,r=g(e.querySelectorAll("[data-row]")).reduce((function(t,e){return t+s(e,!1)}),0);return{stickyContainerHeight:r,stickyContainerHeightAbsolute:r+parseFloat(getComputedStyle(e).top)}},v=null;function w(t){return function(t){if(Array.isArray(t))return S(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return S(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function A(t){return function(t){if(Array.isArray(t))return C(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var O=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yes";Array.from(t.querySelectorAll("[data-row][data-transparent-row]")).map((function(t){t.dataset.transparentRow=e}))},x=null,I=null,j=null,H=null,P=function(){f=null,d=null,x=null,I=null,j=null,H=null,q=null};r().on("blocksy:sticky:compute",(function(){setTimeout((function(){P(),Y()}),100)})),window.wp&&wp.customize&&wp.customize.selectiveRefresh&&wp.customize.selectiveRefresh.bind("partial-content-rendered",(function(t){setTimeout((function(){P(),Y()}),500)}));var q=null,Y=function(){if(q!==scrollY){var t=document.querySelector('[data-device="'.concat((0,n.getCurrentScreen)(),'"] [data-sticky]'));if(t){var e=I;e||(e=I=Array.from(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+e.getBoundingClientRect().height}),0),t.parentNode.style.height="".concat(e,"px"));var r=x;null===r&&(r=function(t){if(-1===t.dataset.sticky.indexOf("shrink")&&-1===t.dataset.sticky.indexOf("auto-hide"))return t.parentNode.getBoundingClientRect().height+200;var e=t.closest("header").getBoundingClientRect().top+scrollY;if(e>0){var r=document.elementFromPoint(0,3);r&&function(t){for(var e=[];t&&t!==document;t=t.parentNode)e.push(t);return e}(r).map((function(t){return getComputedStyle(t).position})).indexOf("fixed")>-1&&(e-=r.getBoundingClientRect().height)}var n=t.parentNode,i=getComputedStyle(document.body),o=parseFloat(i.getPropertyValue("--header-sticky-offset")||0);if(o+=parseFloat(i.getPropertyValue("--frame-size"))||0,1===n.parentNode.children.length||n.parentNode.children[0].classList.contains("ct-sticky-container"))return e>0?e-o:e;var a=Array.from(n.parentNode.children).reduce((function(t,e,r){return t.indexOf(0)>-1||!e.dataset.row?[].concat(A(t),[0]):[].concat(A(t),[e.classList.contains("ct-sticky-container")?0:e.getBoundingClientRect().height])}),[]).reduce((function(t,e){return t+e}),e);return a>0?a-o:a}(t),x=r);var i=j;null===i&&(i=t.closest("[data-device]").getBoundingClientRect().height,j=i);var o=H,c=t.dataset.sticky.split(":").filter((function(t){return"yes"!==t&&"no"!==t&&"fixed"!==t}));o||(o=parseInt(t.getBoundingClientRect().height),H=parseInt(o),l((function(){return-1===c.indexOf("auto-hide")?o>A(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+a(e)}),0)?"".concat(o,"px"):"".concat(A(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+s(e)}),0),"px"):"0px"})));var u=r>0&&Math.abs(window.scrollY-r)<5||window.scrollY>r;c.indexOf("shrink")>-1&&(u=r>0?window.scrollY>=r:window.scrollY>0),setTimeout((function(){u&&-1===document.body.dataset.header.indexOf("shrink")&&(document.body.dataset.header="".concat(document.body.dataset.header,":shrink")),!u&&document.body.dataset.header.indexOf("shrink")>-1&&(document.body.dataset.header=document.body.dataset.header.replace(":shrink",""))}),300);var d=scrollY;c.indexOf("shrink")>-1&&function(t){var e=t.containerInitialHeight,r=t.stickyContainer,n=t.isSticky,i=t.startPosition,o=t.stickyComponents;if(0===i&&0===window.scrollY&&(r.dataset.sticky=["fixed"].concat(m(o)).join(":")),n){if(o.indexOf("yes")>-1)return;-1===r.dataset.sticky.indexOf("yes")&&(O(r,"no"),r.dataset.sticky=["yes"].concat(m(o)).join(":")),y({stickyContainer:r,startPosition:i}),h({stickyContainer:r,containerInitialHeight:e,startPosition:i})}else Array.from(r.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")})),Array.from(r.querySelectorAll('[data-row*="middle"] .site-logo-container')).map((function(t){return t.removeAttribute("style")})),O(r,"yes"),0===i&&window.scrollY<=0?r.dataset.sticky=["fixed"].concat(m(o)).join(":"):r.dataset.sticky=o.join(":")}({stickyContainer:t,stickyContainerHeight:o,containerInitialHeight:e,isSticky:u,startPosition:r,stickyComponents:c}),c.indexOf("auto-hide")>-1&&function(t){var e=t.currentScrollY,r=t.stickyContainer,n=t.containerInitialHeight,i=t.headerInitialHeight,o=t.startPosition,a=t.isSticky,c=t.stickyComponents;a&&e-t.prevScrollY==0&&l((function(){return"0px"})),a?-1===r.dataset.sticky.indexOf("yes")&&e>2*i+o&&(r.dataset.sticky=["yes"].concat(g(c)).join(":"),y({stickyContainer:r,startPosition:o}),h({stickyContainer:r,containerInitialHeight:n,startPosition:o}),O(r,"no"),document.body.removeAttribute("style")):(Array.from(r.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")})),Array.from(r.querySelectorAll('[data-row*="middle"] .site-logo-container')).map((function(t){return t.removeAttribute("style")})),r.dataset.sticky=g(c).join(":"),O(r,"yes"),l((function(){return"0px"})),v=null),null===v&&(v=1e3);var s=v+t.prevScrollY-e,u=0;if(e>2*i+o||r.dataset.sticky.indexOf("yes")>-1){if(e<=o)u=0;else if(e>t.prevScrollY){var d=k({stickyContainer:r}).stickyContainerHeightAbsolute;u=Math.abs(s)>d?-d:s}else u=s>0?0:s;r.style.transform="translateY(".concat(u,"px)"),v=u}else r.removeAttribute("style");r.dataset.sticky.indexOf("yes")>-1&&(e<=o||e>t.prevScrollY||(y({stickyContainer:r,startPosition:o}),h({stickyContainer:r,containerInitialHeight:n,startPosition:o}))),l((function(){var t=k({stickyContainer:r}).stickyContainerHeight;return"".concat(t-Math.abs(u),"px")}))}({stickyContainer:t,isSticky:u,startPosition:r,stickyComponents:c,containerInitialHeight:e,stickyContainerHeight:o,headerInitialHeight:i,currentScrollY:d,prevScrollY:q}),(c.indexOf("slide")>-1||c.indexOf("fade")>-1)&&function(t){var e=t.stickyContainer,r=t.startPosition,n=t.stickyComponents;t.isSticky?(-1===e.dataset.sticky.indexOf("yes")&&(e.dataset.sticky=["yes-start"].concat(w(n)).join(":"),setTimeout((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-start","yes-end"),setTimeout((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-end","yes")}),200)}),1)),O(e,"no")):-1===e.dataset.sticky.indexOf("yes-hide")&&e.dataset.sticky.indexOf("yes:")>-1&&(Math.abs(window.scrollY-r)>10?(e.dataset.sticky=n.join(":"),setTimeout((function(){Array.from(e.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")}))}),300),O(e,"yes")):(e.dataset.sticky=["yes-hide-start"].concat(w(n)).join(":"),requestAnimationFrame((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-hide-start","yes-hide-end"),setTimeout((function(){e.dataset.sticky=n.join(":"),setTimeout((function(){Array.from(e.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")}))}),300),O(e,"yes")}),200)}))))}({stickyContainer:t,isSticky:u,startPosition:r,stickyComponents:c}),q=d}}},F=function(){document.querySelector("header [data-sticky]")&&(window.addEventListener("resize",(function(t){P(),Y(t),r().trigger("ct:header:update")}),!1),window.addEventListener("orientationchange",(function(t){P(),Y(t),r().trigger("ct:header:update")})),window.addEventListener("scroll",Y,!1),window.addEventListener("load",Y,!1),Y())};document.body.className.indexOf("e-preview")>-1?setTimeout((function(){F()}),500):F(),(0,n.registerDynamicChunk)("blocksy_sticky_header",{mount:function(t){}})}();
static/js/frontend/sticky/shrink-utils.js CHANGED
@@ -6,7 +6,15 @@ export const computeLinearScale = (domain, range, value) =>
6
 
7
  export const getRowInitialMinHeight = (el) => {
8
  const elComp = getComputedStyle(el)
9
- return parseFloat(elComp.getPropertyValue('--height'))
 
 
 
 
 
 
 
 
10
  }
11
 
12
  export const getRowInitialHeight = (el) => {
6
 
7
  export const getRowInitialMinHeight = (el) => {
8
  const elComp = getComputedStyle(el)
9
+ let containerStyles = getComputedStyle(el.firstElementChild)
10
+
11
+ let borderHeight =
12
+ parseFloat(elComp.borderTopWidth) +
13
+ parseFloat(elComp.borderBottomWidth) +
14
+ parseFloat(containerStyles.borderTopWidth) +
15
+ parseFloat(containerStyles.borderBottomWidth)
16
+
17
+ return parseFloat(elComp.getPropertyValue('--height')) + borderHeight
18
  }
19
 
20
  export const getRowInitialHeight = (el) => {