@inc2734/unitone-css 0.82.0 → 0.83.1
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.
- package/dist/app.js +1 -1
- package/dist/library.js +1 -1
- package/package.json +1 -1
- package/src/library.js +46 -64
package/dist/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e={};var n=function(){if(t)return e;function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function i(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(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 r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){l=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(l)throw a}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function a(t,e){var n,i=this;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];clearTimeout(n),n=setTimeout((function(){t.apply(i,o)}),e)}}t=1;var u=function(t){var e,n,i=null===(e=[].slice.call(null!==(n=null==t?void 0:t.children)&&void 0!==n?n:[]))||void 0===e?void 0:e[0];if(i){var r,o=i.getBoundingClientRect();t.setAttribute("data-unitone-layout",t.getAttribute("data-unitone-layout").split(" ").filter((function(t){return!["divider:initialized","-stack"].includes(t)})).join(" "));var a=[].slice.call(t.children).filter((function(t){var e=window.getComputedStyle(t).getPropertyValue("position"),n=window.getComputedStyle(t).getPropertyValue("display");return"absolute"!==e&&"fixed"!==e&&"none"!==n}));a.forEach((function(t){var e=t.getAttribute("data-unitone-layout")||"",n=e.split(" ").filter((function(t){return!["-bol","-linewrap"].includes(t)})).join(" ");n!==e&&t.setAttribute("data-unitone-layout",n)})),a.forEach((function(t,e){var n,i=null===(n=r)||void 0===n?void 0:n.getBoundingClientRect(),a=t.getBoundingClientRect(),u=t.getAttribute("data-unitone-layout")||"",l=u.split(" ");(0===e||(null==i?void 0:i.top)<a.top&&(null==i?void 0:i.left)>=a.left)&&(l.includes("-bol")||l.push("-bol")),0<e&&o.top<a.top&&(l.includes("-linewrap")||l.push("-linewrap")),l!==u&&t.setAttribute("data-unitone-layout",l.filter(Boolean).join(" ")||""),r=t})),[].slice.call(a).every((function(t){return t.getBoundingClientRect().left===o.left}))&&t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," -stack")),t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," divider:initialized"))}},l=function(t){var e,n=[].slice.call(t.children),i=null==n?void 0:n[0];if(i){t.style.removeProperty("--unitone--stairs-step-overflow-volume"),t.style.removeProperty("--unitone--max-stairs-step"),[].slice.call(null!==(e=null==t?void 0:t.children)&&void 0!==e?e:[]).forEach((function(t){t.style.removeProperty("--unitone--stairs-step")}));var r,o=[],a=0,u=a,l=window.getComputedStyle(t).getPropertyValue("flex-direction");n.forEach((function(t){var e,n,d=window.getComputedStyle(t).getPropertyValue("position"),c=window.getComputedStyle(t).getPropertyValue("display");if("absolute"!==d&&"fixed"!==d&&"none"!==c){o.push(t);var s="row-reverse"===l?(null===(e=r)||void 0===e||null===(e=e.getBoundingClientRect())||void 0===e?void 0:e.left)<=t.getBoundingClientRect().left:(null===(n=r)||void 0===n||null===(n=n.getBoundingClientRect())||void 0===n?void 0:n.left)>=t.getBoundingClientRect().left;i===t||s?(a=0,t.style.setProperty("--unitone--stairs-step",a)):(a++,t.style.setProperty("--unitone--stairs-step",a)),r=t,a>u&&(u=a)}})),t.style.setProperty("--unitone--max-stairs-step",u);var d=t.getBoundingClientRect().bottom,c=o.reduce((function(t,e){var n=e.getBoundingClientRect().bottom-d;return t>n?t:n}),0);t.style.setProperty("--unitone--stairs-step-overflow-volume",c)}},d=function(t){t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout").replaceAll("vertical-writing:initialized","").trim())),t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout").replaceAll("vertical-writing:safari","").trim())),t.setAttribute("data-unitone-layout",t.getAttribute("data-unitone-layout").replace(" -force-switch",""));var e,n=getComputedStyle(t);if(String(n.getPropertyValue("--unitone--threshold")).trim()){var i=document.createElement("div");i.setAttribute("data-unitone-layout","vertical-writing__thresholder"),t.appendChild(i);var r=i.offsetWidth>=t.offsetWidth;if(t.removeChild(i),r)return void t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," -force-switch"))}[].slice.call(t.children).reverse().some((function(t){if(!["absolute","fixed"].includes(getComputedStyle(t).position)&&"none"!==getComputedStyle(t).display)return e=t,!0})),e&&(t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," vertical-writing:initialized")),t.getBoundingClientRect().left>e.getBoundingClientRect().left&&t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," vertical-writing:safari")),requestAnimationFrame((function(){var n=t.getBoundingClientRect().top+t.getBoundingClientRect().height,i=e.getBoundingClientRect().top+e.getBoundingClientRect().height;n!==i&&(t.parentNode.style.height="".concat(Math.ceil(i-t.getBoundingClientRect().top),"px"))})))};return e.debounce=a,e.dividersResizeObserver=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,o=new ResizeObserver(a((function(t){var e,i=r(t);try{for(i.s();!(e=i.n()).done;){var o,a=e.value,l=null===(o=a.borderBoxSize)||void 0===o?void 0:o[0].inlineSize;l!==n&&(u(a.target),n=l)}}catch(t){i.e(t)}finally{i.f()}}),250)),l=new MutationObserver((function(n){requestAnimationFrame((function(){var o,a=r(n);try{var l=function(){var n=o.value;if("attributes"===n.type&&"data-unitone-layout"===n.attributeName){var r,a,l,d,c=[].concat(i(null!==(r=null==e||null===(a=e.ignore)||void 0===a?void 0:a.layout)&&void 0!==r?r:[]),["divider:initialized","-bol","-linewrap","-stack"]);(null!==(l=n.target.getAttribute(n.attributeName))&&void 0!==l?l:"").split(" ").filter((function(t){return!c.includes(t)})).join(" ")!==(null!==(d=n.oldValue)&&void 0!==d?d:"").split(" ").filter((function(t){return!c.includes(t)})).join(" ")&&u(t)}else if("attributes"===n.type&&"class"===n.attributeName){var s,f,v,y,b=i(null!==(s=null==e||null===(f=e.ignore)||void 0===f?void 0:f.className)&&void 0!==s?s:[]);(null!==(v=n.target.getAttribute(n.attributeName))&&void 0!==v?v:"").split(" ").filter((function(t){return!b.includes(t)})).join(" ")!==(null!==(y=n.oldValue)&&void 0!==y?y:"").split(" ").filter((function(t){return!b.includes(t)})).join(" ")&&u(t)}else"attributes"===n.type&&"style"===n.attributeName&&u(t)};for(a.s();!(o=a.n()).done;)l()}catch(t){a.e(t)}finally{a.f()}}))}));return o.observe(t),l.observe(t,{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0,subtree:!0,characterData:!0}),{resizeObserver:o,mutationObserver:l}},e.setDividerLinewrap=u,e.setStairsStep=l,e.stairsResizeObserver=function(t){var e=new ResizeObserver(a((function(t){var e,n=r(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;l(i.target)}}catch(t){n.e(t)}finally{n.f()}}),250));return e.observe(t),e},e.verticalsResizeObserver=function(t){var e=0,n=new ResizeObserver(a((function(t){var n,i=r(t);try{for(i.s();!(n=i.n()).done;){var o,a=n.value,u=null===(o=a.contentRect)||void 0===o?void 0:o.width;parseInt(u)!==parseInt(e)&&(e=u,a.target.parentNode.style.height="",d(a.target))}}catch(t){i.e(t)}finally{i.f()}}),250));n.observe(t);var i=new MutationObserver((function(e){requestAnimationFrame((function(){if(0<e.length){var n,i,r=e[0],o=null===(n=r.addedNodes)||void 0===n?void 0:n[0],a=null===(i=r.removedNodes)||void 0===i?void 0:i[0];if((null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===o.getAttribute("data-unitone-layout")||(null==a?void 0:a.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===a.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===o.getAttribute("data-unitone-layout")||(null==a?void 0:a.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===a.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===o.getAttribute("data-unitone-layout")||(null==a?void 0:a.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===a.getAttribute("data-unitone-layout"))return;d(t)}}))}));return i.observe(t,{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0}),{resizeObserver:n,mutationObserver:i}},e}();function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return u=t.done,t},e:function(t){l=!0,a=t},f:function(){try{u||null==n.return||n.return()}finally{if(l)throw a}}}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){requestAnimationFrame((function(){var e,r=i(t);try{for(r.s();!(e=r.n()).done;){e.value.addedNodes.forEach((function(t){var e,i=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout*="-divider:"]');null==i||i.forEach((function(t){n.dividersResizeObserver(t)}))}))}}catch(t){r.e(t)}finally{r.f()}}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){requestAnimationFrame((function(){var e,r=i(t);try{for(r.s();!(e=r.n()).done;){e.value.addedNodes.forEach((function(t){var e,i=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout*="-stairs:"]');null==i||i.forEach((function(t){n.stairsResizeObserver(t)}))}))}}catch(t){r.e(t)}finally{r.f()}}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){requestAnimationFrame((function(){var e,r=i(t);try{for(r.s();!(e=r.n()).done;){e.value.addedNodes.forEach((function(t){var e,i=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout~="vertical-writing"]');null==i||i.forEach((function(t){n.verticalsResizeObserver(t)}))}))}}catch(t){r.e(t)}finally{r.f()}}))})).observe(document.body,{childList:!0,subtree:!0})}));
|
|
1
|
+
"use strict";var t,e={};var n=function(){if(t)return e;function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function i(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(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 r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}(t))||e){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){u=!0,a=t},f:function(){try{l||null==n.return||n.return()}finally{if(u)throw a}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function a(t,e){var n,i=this;return function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];clearTimeout(n),n=setTimeout((function(){t.apply(i,o)}),e)}}t=1;var l=function(t){var e,n,i=null===(e=[].slice.call(null!==(n=null==t?void 0:t.children)&&void 0!==n?n:[]))||void 0===e?void 0:e[0];if(i){var r,o=i.getBoundingClientRect(),a=t.getAttribute("data-unitone-layout").split(/\s+/);a.some((function(t){return["divider:initialized","-stack"].includes(t)}))&&(a=a.filter((function(t){return!["divider:initialized","-stack"].includes(t)})),t.setAttribute("data-unitone-layout",a.join(" ")));var l=[].slice.call(t.children).filter((function(t){var e=window.getComputedStyle(t).getPropertyValue("position"),n=window.getComputedStyle(t).getPropertyValue("display");return"absolute"!==e&&"fixed"!==e&&"none"!==n}));l.forEach((function(t,e){var n,i=t.getAttribute("data-unitone-layout").split(/\s+/);i.some((function(t){return["-bol","-linewrap"].includes(t)}))&&(i=i.filter((function(t){return!["-bol","-linewrap"].includes(t)})),t.setAttribute("data-unitone-layout",i.join(" ")));var a=null===(n=r)||void 0===n?void 0:n.getBoundingClientRect(),l=t.getBoundingClientRect(),u=!1;(0===e||(null==a?void 0:a.top)<l.top&&(null==a?void 0:a.left)>=l.left)&&(i.push("-bol"),u=!0),0<e&&o.top<l.top&&(i.push("-linewrap"),u=!0),u&&t.setAttribute("data-unitone-layout",i.join(" ")),r=t})),[].slice.call(l).every((function(t){return t.getBoundingClientRect().left===o.left}))&&a.push("-stack"),a.push("divider:initialized"),t.setAttribute("data-unitone-layout",a.join(" "))}},u=function(t){var e,n=[].slice.call(t.children),i=null==n?void 0:n[0];if(i){t.style.removeProperty("--unitone--stairs-step-overflow-volume"),t.style.removeProperty("--unitone--max-stairs-step"),[].slice.call(null!==(e=null==t?void 0:t.children)&&void 0!==e?e:[]).forEach((function(t){t.style.removeProperty("--unitone--stairs-step")}));var r,o=[],a=0,l=a,u=window.getComputedStyle(t).getPropertyValue("flex-direction");n.forEach((function(t){var e,n,d=window.getComputedStyle(t).getPropertyValue("position"),s=window.getComputedStyle(t).getPropertyValue("display");if("absolute"!==d&&"fixed"!==d&&"none"!==s){o.push(t);var c="row-reverse"===u?(null===(e=r)||void 0===e||null===(e=e.getBoundingClientRect())||void 0===e?void 0:e.left)<=t.getBoundingClientRect().left:(null===(n=r)||void 0===n||null===(n=n.getBoundingClientRect())||void 0===n?void 0:n.left)>=t.getBoundingClientRect().left;i===t||c?(a=0,t.style.setProperty("--unitone--stairs-step",a)):(a++,t.style.setProperty("--unitone--stairs-step",a)),r=t,a>l&&(l=a)}})),t.style.setProperty("--unitone--max-stairs-step",l);var d=t.getBoundingClientRect().bottom,s=o.reduce((function(t,e){var n=e.getBoundingClientRect().bottom-d;return t>n?t:n}),0);t.style.setProperty("--unitone--stairs-step-overflow-volume",s)}},d=function(t){var e=t.getAttribute("data-unitone-layout").split(/\s+/);e.some((function(t){return["vertical-writing:initialized","vertical-writing:safari","-force-switch"].includes(t)}))&&(e=e.filter((function(t){return!["vertical-writing:initialized","vertical-writing:safari","-force-switch"].includes(t)})),t.setAttribute("data-unitone-layout",e.join(" ")));var n,i=getComputedStyle(t);if(String(i.getPropertyValue("--unitone--threshold")).trim()){var r=document.createElement("div");r.setAttribute("data-unitone-layout","vertical-writing__thresholder"),t.appendChild(r);var o=r.offsetWidth>=t.offsetWidth;t.removeChild(r),o&&(e.push("-force-switch"),t.setAttribute("data-unitone-layout",e.join(" ")))}[].slice.call(t.children).reverse().some((function(t){if(!["absolute","fixed"].includes(getComputedStyle(t).position)&&"none"!==getComputedStyle(t).display)return n=t,!0})),n&&(e.push("vertical-writing:initialized"),t.getBoundingClientRect().left>n.getBoundingClientRect().left&&e.push("vertical-writing:safari"),t.setAttribute("data-unitone-layout",e.join(" ")),requestAnimationFrame((function(){var e=t.getBoundingClientRect().top+t.getBoundingClientRect().height,i=n.getBoundingClientRect().top+n.getBoundingClientRect().height;e!==i&&(t.parentNode.style.height="".concat(Math.ceil(i-t.getBoundingClientRect().top),"px"))})))};return e.debounce=a,e.dividersResizeObserver=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,o=new ResizeObserver(a((function(t){var e,i=r(t);try{for(i.s();!(e=i.n()).done;){var o,a=e.value,u=null===(o=a.borderBoxSize)||void 0===o?void 0:o[0].inlineSize;u!==n&&(l(a.target),n=u)}}catch(t){i.e(t)}finally{i.f()}}),250)),u=new MutationObserver((function(n){requestAnimationFrame((function(){var o,a=r(n);try{var u=function(){var n=o.value;if("attributes"===n.type&&"data-unitone-layout"===n.attributeName){var r,a,u,d,s=[].concat(i(null!==(r=null==e||null===(a=e.ignore)||void 0===a?void 0:a.layout)&&void 0!==r?r:[]),["divider:initialized","-bol","-linewrap","-stack"]);(null!==(u=n.target.getAttribute(n.attributeName))&&void 0!==u?u:"").split(" ").filter((function(t){return!s.includes(t)})).join(" ")!==(null!==(d=n.oldValue)&&void 0!==d?d:"").split(" ").filter((function(t){return!s.includes(t)})).join(" ")&&l(t)}else if("attributes"===n.type&&"class"===n.attributeName){var c,f,v,y,g=i(null!==(c=null==e||null===(f=e.ignore)||void 0===f?void 0:f.className)&&void 0!==c?c:[]);(null!==(v=n.target.getAttribute(n.attributeName))&&void 0!==v?v:"").split(" ").filter((function(t){return!g.includes(t)})).join(" ")!==(null!==(y=n.oldValue)&&void 0!==y?y:"").split(" ").filter((function(t){return!g.includes(t)})).join(" ")&&l(t)}else"attributes"===n.type&&"style"===n.attributeName&&l(t)};for(a.s();!(o=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}}))}));return o.observe(t),u.observe(t,{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0,subtree:!0,characterData:!0}),{resizeObserver:o,mutationObserver:u}},e.setColumnCountForVertical=d,e.setDividerLinewrap=l,e.setStairsStep=u,e.stairsResizeObserver=function(t){var e=new ResizeObserver(a((function(t){var e,n=r(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;u(i.target)}}catch(t){n.e(t)}finally{n.f()}}),250));return e.observe(t),e},e.verticalsResizeObserver=function(t){var e=0,n=new ResizeObserver(a((function(t){var n,i=r(t);try{for(i.s();!(n=i.n()).done;){var o,a=n.value,l=null===(o=a.contentRect)||void 0===o?void 0:o.width;parseInt(l)!==parseInt(e)&&(e=l,a.target.parentNode.style.height="",d(a.target))}}catch(t){i.e(t)}finally{i.f()}}),250));n.observe(t);var i=new MutationObserver((function(e){requestAnimationFrame((function(){if(0<e.length){var n,i,r=e[0],o=null===(n=r.addedNodes)||void 0===n?void 0:n[0],a=null===(i=r.removedNodes)||void 0===i?void 0:i[0];if((null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===o.getAttribute("data-unitone-layout")||(null==a?void 0:a.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===a.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===o.getAttribute("data-unitone-layout")||(null==a?void 0:a.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===a.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===o.getAttribute("data-unitone-layout")||(null==a?void 0:a.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===a.getAttribute("data-unitone-layout"))return;d(t)}}))}));return i.observe(t,{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0}),{resizeObserver:n,mutationObserver:i}},e}();function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,l=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){u=!0,a=t},f:function(){try{l||null==n.return||n.return()}finally{if(u)throw a}}}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){requestAnimationFrame((function(){var e,r=i(t);try{for(r.s();!(e=r.n()).done;){e.value.addedNodes.forEach((function(t){var e,i=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout*="-divider:"]');null==i||i.forEach((function(t){n.dividersResizeObserver(t)}))}))}}catch(t){r.e(t)}finally{r.f()}}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){requestAnimationFrame((function(){var e,r=i(t);try{for(r.s();!(e=r.n()).done;){e.value.addedNodes.forEach((function(t){var e,i=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout*="-stairs:"]');null==i||i.forEach((function(t){n.stairsResizeObserver(t)}))}))}}catch(t){r.e(t)}finally{r.f()}}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){requestAnimationFrame((function(){var e,r=i(t);try{for(r.s();!(e=r.n()).done;){e.value.addedNodes.forEach((function(t){var e,i=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout~="vertical-writing"]');null==i||i.forEach((function(t){n.verticalsResizeObserver(t)}))}))}}catch(t){r.e(t)}finally{r.f()}}))})).observe(document.body,{childList:!0,subtree:!0})}));
|
package/dist/library.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var
|
|
1
|
+
"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,i){if(e){if("string"==typeof e)return t(e,i);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,i):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.")}()}function i(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return n(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):void 0}}(t))||e){i&&(t=i);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,a=!0,u=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){u=!0,l=t},f:function(){try{a||null==i.return||i.return()}finally{if(u)throw l}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i<e;i++)n[i]=t[i];return n}function r(t,e){var i,n=this;return function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];clearTimeout(i),i=setTimeout((function(){t.apply(n,o)}),e)}}var o=function(t){var e,i,n=null===(e=[].slice.call(null!==(i=null==t?void 0:t.children)&&void 0!==i?i:[]))||void 0===e?void 0:e[0];if(n){var r,o=n.getBoundingClientRect(),l=t.getAttribute("data-unitone-layout").split(/\s+/);l.some((function(t){return["divider:initialized","-stack"].includes(t)}))&&(l=l.filter((function(t){return!["divider:initialized","-stack"].includes(t)})),t.setAttribute("data-unitone-layout",l.join(" ")));var a=[].slice.call(t.children).filter((function(t){var e=window.getComputedStyle(t).getPropertyValue("position"),i=window.getComputedStyle(t).getPropertyValue("display");return"absolute"!==e&&"fixed"!==e&&"none"!==i}));a.forEach((function(t,e){var i,n=t.getAttribute("data-unitone-layout").split(/\s+/);n.some((function(t){return["-bol","-linewrap"].includes(t)}))&&(n=n.filter((function(t){return!["-bol","-linewrap"].includes(t)})),t.setAttribute("data-unitone-layout",n.join(" ")));var l=null===(i=r)||void 0===i?void 0:i.getBoundingClientRect(),a=t.getBoundingClientRect(),u=!1;(0===e||(null==l?void 0:l.top)<a.top&&(null==l?void 0:l.left)>=a.left)&&(n.push("-bol"),u=!0),0<e&&o.top<a.top&&(n.push("-linewrap"),u=!0),u&&t.setAttribute("data-unitone-layout",n.join(" ")),r=t})),[].slice.call(a).every((function(t){return t.getBoundingClientRect().left===o.left}))&&l.push("-stack"),l.push("divider:initialized"),t.setAttribute("data-unitone-layout",l.join(" "))}},l=function(t){var e,i=[].slice.call(t.children),n=null==i?void 0:i[0];if(n){t.style.removeProperty("--unitone--stairs-step-overflow-volume"),t.style.removeProperty("--unitone--max-stairs-step"),[].slice.call(null!==(e=null==t?void 0:t.children)&&void 0!==e?e:[]).forEach((function(t){t.style.removeProperty("--unitone--stairs-step")}));var r,o=[],l=0,a=l,u=window.getComputedStyle(t).getPropertyValue("flex-direction");i.forEach((function(t){var e,i,s=window.getComputedStyle(t).getPropertyValue("position"),d=window.getComputedStyle(t).getPropertyValue("display");if("absolute"!==s&&"fixed"!==s&&"none"!==d){o.push(t);var c="row-reverse"===u?(null===(e=r)||void 0===e||null===(e=e.getBoundingClientRect())||void 0===e?void 0:e.left)<=t.getBoundingClientRect().left:(null===(i=r)||void 0===i||null===(i=i.getBoundingClientRect())||void 0===i?void 0:i.left)>=t.getBoundingClientRect().left;n===t||c?(l=0,t.style.setProperty("--unitone--stairs-step",l)):(l++,t.style.setProperty("--unitone--stairs-step",l)),r=t,l>a&&(a=l)}})),t.style.setProperty("--unitone--max-stairs-step",a);var s=t.getBoundingClientRect().bottom,d=o.reduce((function(t,e){var i=e.getBoundingClientRect().bottom-s;return t>i?t:i}),0);t.style.setProperty("--unitone--stairs-step-overflow-volume",d)}},a=function(t){var e=t.getAttribute("data-unitone-layout").split(/\s+/);e.some((function(t){return["vertical-writing:initialized","vertical-writing:safari","-force-switch"].includes(t)}))&&(e=e.filter((function(t){return!["vertical-writing:initialized","vertical-writing:safari","-force-switch"].includes(t)})),t.setAttribute("data-unitone-layout",e.join(" ")));var i,n=getComputedStyle(t);if(String(n.getPropertyValue("--unitone--threshold")).trim()){var r=document.createElement("div");r.setAttribute("data-unitone-layout","vertical-writing__thresholder"),t.appendChild(r);var o=r.offsetWidth>=t.offsetWidth;t.removeChild(r),o&&(e.push("-force-switch"),t.setAttribute("data-unitone-layout",e.join(" ")))}([].slice.call(t.children).reverse().some((function(t){if(!["absolute","fixed"].includes(getComputedStyle(t).position)&&"none"!==getComputedStyle(t).display)return i=t,!0})),i)&&(e.push("vertical-writing:initialized"),t.getBoundingClientRect().left>i.getBoundingClientRect().left&&e.push("vertical-writing:safari"),t.setAttribute("data-unitone-layout",e.join(" ")),requestAnimationFrame((function(){var e=t.getBoundingClientRect().top+t.getBoundingClientRect().height,n=i.getBoundingClientRect().top+i.getBoundingClientRect().height;e!==n&&(t.parentNode.style.height="".concat(Math.ceil(n-t.getBoundingClientRect().top),"px"))})))};exports.debounce=r,exports.dividersResizeObserver=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=0,a=new ResizeObserver(r((function(t){var e,n=i(t);try{for(n.s();!(e=n.n()).done;){var r,a=e.value,u=null===(r=a.borderBoxSize)||void 0===r?void 0:r[0].inlineSize;u!==l&&(o(a.target),l=u)}}catch(t){n.e(t)}finally{n.f()}}),250)),u=new MutationObserver((function(r){requestAnimationFrame((function(){var l,a=i(r);try{var u=function(){var i=l.value;if("attributes"===i.type&&"data-unitone-layout"===i.attributeName){var r,a,u,s,d=[].concat(e(null!==(r=null==n||null===(a=n.ignore)||void 0===a?void 0:a.layout)&&void 0!==r?r:[]),["divider:initialized","-bol","-linewrap","-stack"]);(null!==(u=i.target.getAttribute(i.attributeName))&&void 0!==u?u:"").split(" ").filter((function(t){return!d.includes(t)})).join(" ")!==(null!==(s=i.oldValue)&&void 0!==s?s:"").split(" ").filter((function(t){return!d.includes(t)})).join(" ")&&o(t)}else if("attributes"===i.type&&"class"===i.attributeName){var c,v,f,y,p=e(null!==(c=null==n||null===(v=n.ignore)||void 0===v?void 0:v.className)&&void 0!==c?c:[]);(null!==(f=i.target.getAttribute(i.attributeName))&&void 0!==f?f:"").split(" ").filter((function(t){return!p.includes(t)})).join(" ")!==(null!==(y=i.oldValue)&&void 0!==y?y:"").split(" ").filter((function(t){return!p.includes(t)})).join(" ")&&o(t)}else"attributes"===i.type&&"style"===i.attributeName&&o(t)};for(a.s();!(l=a.n()).done;)u()}catch(t){a.e(t)}finally{a.f()}}))}));return a.observe(t),u.observe(t,{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0,subtree:!0,characterData:!0}),{resizeObserver:a,mutationObserver:u}},exports.setColumnCountForVertical=a,exports.setDividerLinewrap=o,exports.setStairsStep=l,exports.stairsResizeObserver=function(t){var e=new ResizeObserver(r((function(t){var e,n=i(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;l(r.target)}}catch(t){n.e(t)}finally{n.f()}}),250));return e.observe(t),e},exports.verticalsResizeObserver=function(t){var e=0,n=new ResizeObserver(r((function(t){var n,r=i(t);try{for(r.s();!(n=r.n()).done;){var o,l=n.value,u=null===(o=l.contentRect)||void 0===o?void 0:o.width;parseInt(u)!==parseInt(e)&&(e=u,l.target.parentNode.style.height="",a(l.target))}}catch(t){r.e(t)}finally{r.f()}}),250));n.observe(t);var o=new MutationObserver((function(e){requestAnimationFrame((function(){if(0<e.length){var i,n,r=e[0],o=null===(i=r.addedNodes)||void 0===i?void 0:i[0],l=null===(n=r.removedNodes)||void 0===n?void 0:n[0];if((null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===o.getAttribute("data-unitone-layout")||(null==l?void 0:l.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===l.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===o.getAttribute("data-unitone-layout")||(null==l?void 0:l.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===l.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===o.getAttribute("data-unitone-layout")||(null==l?void 0:l.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===l.getAttribute("data-unitone-layout"))return;a(t)}}))}));return o.observe(t,{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0}),{resizeObserver:n,mutationObserver:o}};
|
package/package.json
CHANGED
package/src/library.js
CHANGED
|
@@ -14,17 +14,17 @@ export const setDividerLinewrap = (target) => {
|
|
|
14
14
|
if (!firstChild) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
+
|
|
17
18
|
let prevChild;
|
|
18
19
|
const baseRect = firstChild.getBoundingClientRect();
|
|
19
20
|
|
|
20
|
-
target.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
);
|
|
21
|
+
let currentLayoutArray = target.getAttribute('data-unitone-layout').split(/\s+/);
|
|
22
|
+
if (currentLayoutArray.some((value) => ['divider:initialized', '-stack'].includes(value))) {
|
|
23
|
+
currentLayoutArray = currentLayoutArray.filter(
|
|
24
|
+
(value) => !['divider:initialized', '-stack'].includes(value),
|
|
25
|
+
);
|
|
26
|
+
target.setAttribute('data-unitone-layout', currentLayoutArray.join(' '));
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
const targetChildren = [].slice.call(target.children).filter((child) => {
|
|
30
30
|
const position = window.getComputedStyle(child).getPropertyValue('position');
|
|
@@ -32,39 +32,32 @@ export const setDividerLinewrap = (target) => {
|
|
|
32
32
|
return 'absolute' !== position && 'fixed' !== position && 'none' !== display;
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
targetChildren.forEach((child) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (newLayout !== currentLayout) {
|
|
43
|
-
child.setAttribute('data-unitone-layout', newLayout);
|
|
35
|
+
targetChildren.forEach((child, index) => {
|
|
36
|
+
let childCurrentLayoutArray = child.getAttribute('data-unitone-layout').split(/\s+/);
|
|
37
|
+
if (childCurrentLayoutArray.some((value) => ['-bol', '-linewrap'].includes(value))) {
|
|
38
|
+
childCurrentLayoutArray = childCurrentLayoutArray.filter(
|
|
39
|
+
(value) => !['-bol', '-linewrap'].includes(value),
|
|
40
|
+
);
|
|
41
|
+
child.setAttribute('data-unitone-layout', childCurrentLayoutArray.join(' '));
|
|
44
42
|
}
|
|
45
|
-
});
|
|
46
43
|
|
|
47
|
-
targetChildren.forEach((child, index) => {
|
|
48
44
|
const prevRect = prevChild?.getBoundingClientRect();
|
|
49
45
|
const childRect = child.getBoundingClientRect();
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
const newLayout = currentLayout.split(' ');
|
|
47
|
+
let shouldUpdate = false;
|
|
53
48
|
|
|
54
49
|
if (0 === index || (prevRect?.top < childRect.top && prevRect?.left >= childRect.left)) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
50
|
+
childCurrentLayoutArray.push('-bol');
|
|
51
|
+
shouldUpdate = true;
|
|
58
52
|
}
|
|
59
53
|
|
|
60
54
|
if (0 < index && baseRect.top < childRect.top) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
55
|
+
childCurrentLayoutArray.push('-linewrap');
|
|
56
|
+
shouldUpdate = true;
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
if (
|
|
67
|
-
child.setAttribute('data-unitone-layout',
|
|
59
|
+
if (shouldUpdate) {
|
|
60
|
+
child.setAttribute('data-unitone-layout', childCurrentLayoutArray.join(' '));
|
|
68
61
|
}
|
|
69
62
|
|
|
70
63
|
prevChild = child;
|
|
@@ -74,16 +67,11 @@ export const setDividerLinewrap = (target) => {
|
|
|
74
67
|
.call(targetChildren)
|
|
75
68
|
.every((child) => child.getBoundingClientRect().left === baseRect.left);
|
|
76
69
|
if (isStack) {
|
|
77
|
-
|
|
78
|
-
'data-unitone-layout',
|
|
79
|
-
`${target.getAttribute('data-unitone-layout')} -stack`,
|
|
80
|
-
);
|
|
70
|
+
currentLayoutArray.push('-stack');
|
|
81
71
|
}
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`${target.getAttribute('data-unitone-layout')} divider:initialized`,
|
|
86
|
-
);
|
|
73
|
+
currentLayoutArray.push('divider:initialized');
|
|
74
|
+
target.setAttribute('data-unitone-layout', currentLayoutArray.join(' '));
|
|
87
75
|
};
|
|
88
76
|
|
|
89
77
|
export const dividersResizeObserver = (target, args = {}) => {
|
|
@@ -240,22 +228,23 @@ export const stairsResizeObserver = (target) => {
|
|
|
240
228
|
return observer;
|
|
241
229
|
};
|
|
242
230
|
|
|
243
|
-
const setColumnCountForVertical = (target) => {
|
|
244
|
-
target.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
231
|
+
export const setColumnCountForVertical = (target) => {
|
|
232
|
+
let currentLayoutArray = target.getAttribute('data-unitone-layout').split(/\s+/);
|
|
233
|
+
if (
|
|
234
|
+
currentLayoutArray.some((value) =>
|
|
235
|
+
['vertical-writing:initialized', 'vertical-writing:safari', '-force-switch'].includes(value),
|
|
236
|
+
)
|
|
237
|
+
) {
|
|
238
|
+
currentLayoutArray = currentLayoutArray.filter(
|
|
239
|
+
(value) =>
|
|
240
|
+
!['vertical-writing:initialized', 'vertical-writing:safari', '-force-switch'].includes(
|
|
241
|
+
value,
|
|
242
|
+
),
|
|
243
|
+
);
|
|
244
|
+
target.setAttribute('data-unitone-layout', currentLayoutArray.join(' '));
|
|
245
|
+
}
|
|
253
246
|
|
|
254
247
|
// Process of the threshold
|
|
255
|
-
target.setAttribute(
|
|
256
|
-
'data-unitone-layout',
|
|
257
|
-
target.getAttribute('data-unitone-layout').replace(' -force-switch', ''),
|
|
258
|
-
);
|
|
259
248
|
const computedStyle = getComputedStyle(target);
|
|
260
249
|
const threshold = String(computedStyle.getPropertyValue('--unitone--threshold')).trim();
|
|
261
250
|
if (!!threshold) {
|
|
@@ -265,11 +254,8 @@ const setColumnCountForVertical = (target) => {
|
|
|
265
254
|
const forceSwitch = thresholder.offsetWidth >= target.offsetWidth;
|
|
266
255
|
target.removeChild(thresholder);
|
|
267
256
|
if (forceSwitch) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
`${target.getAttribute('data-unitone-layout')} -force-switch`,
|
|
271
|
-
);
|
|
272
|
-
return;
|
|
257
|
+
currentLayoutArray.push('-force-switch');
|
|
258
|
+
target.setAttribute('data-unitone-layout', currentLayoutArray.join(' '));
|
|
273
259
|
}
|
|
274
260
|
}
|
|
275
261
|
|
|
@@ -291,20 +277,16 @@ const setColumnCountForVertical = (target) => {
|
|
|
291
277
|
return;
|
|
292
278
|
}
|
|
293
279
|
|
|
294
|
-
|
|
295
|
-
'data-unitone-layout',
|
|
296
|
-
`${target.getAttribute('data-unitone-layout')} vertical-writing:initialized`,
|
|
297
|
-
);
|
|
280
|
+
currentLayoutArray.push('vertical-writing:initialized');
|
|
298
281
|
|
|
299
282
|
// For Safari
|
|
300
283
|
const maybeSafari = target.getBoundingClientRect().left > lastChild.getBoundingClientRect().left;
|
|
301
284
|
if (maybeSafari) {
|
|
302
|
-
|
|
303
|
-
'data-unitone-layout',
|
|
304
|
-
`${target.getAttribute('data-unitone-layout')} vertical-writing:safari`,
|
|
305
|
-
);
|
|
285
|
+
currentLayoutArray.push('vertical-writing:safari');
|
|
306
286
|
}
|
|
307
287
|
|
|
288
|
+
target.setAttribute('data-unitone-layout', currentLayoutArray.join(' '));
|
|
289
|
+
|
|
308
290
|
requestAnimationFrame(() => {
|
|
309
291
|
const targetY = target.getBoundingClientRect().top + target.getBoundingClientRect().height;
|
|
310
292
|
const lastChildY =
|