@inc2734/unitone-css 0.59.5 → 0.59.7
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/library.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function e(e,n){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return t(e,n)}(e))||n){i&&(e=i);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},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,u=!0,a=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return u=e.done,e},e:function(e){a=!0,l=e},f:function(){try{u||null==i.return||i.return()}finally{if(a)throw l}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var n=function(e){var t=parseFloat(window.getComputedStyle(document.documentElement).getPropertyValue("font-size")),n=parseFloat(window.getComputedStyle(e).getPropertyValue("font-size"));e.style.setProperty("--unitone--fluid-font-size-magnification",n/t)},i=function(e){var t,n,i=null===(t=[].slice.call(e.children))||void 0===t?void 0:t[0];i&&[].slice.call(e.children).forEach((function(e){var t,r=i.getBoundingClientRect(),o=null===(t=n)||void 0===t?void 0:t.getBoundingClientRect(),l=e.getBoundingClientRect(),u=(e.getAttribute("data-unitone-layout")||"").split(" ");r.top<l.top?u.includes("-linewrap")||u.push("-linewrap"):u=u.filter((function(e){return"-linewrap"!==e})),i===e||null!=o&&o.top&&o.top<l.top?u.includes("-bol")||u.push("-bol"):u=u.filter((function(e){return"-bol"!==e})),e.setAttribute("data-unitone-layout",u.join(" ")),n=e}))},r=function(e){var t,n=null===(t=[].slice.call(e.children))||void 0===t?void 0:t[0];if(n){var i,r=0,o=r;[].slice.call(e.children).forEach((function(e){var t,l=window.getComputedStyle(e).getPropertyValue("position");if("absolute"!==l&&"fixed"!==l){e.style.setProperty("--unitone--stairs-step","");var u=null===(t=i)||void 0===t?void 0:t.getBoundingClientRect(),a=e.getBoundingClientRect();n===e||null!=u&&u.left&&u.left>=a.left?(r=0,e.style.setProperty("--unitone--stairs-step",r)):(r++,e.style.setProperty("--unitone--stairs-step",r)),i=e,r>o&&(o=r)}})),e.getAttribute("data-unitone-layout").match(/-stairs-up:right/)?e.style.setProperty("--unitone--stairs-step",o):e.style.setProperty("--unitone--stairs-step",r)}},o=function(e){e.style.columnCount="",e.setAttribute("data-unitone-layout",e.getAttribute("data-unitone-layout").replace(" -force-switch",""));var t,n=getComputedStyle(e);if(String(n.getPropertyValue("--unitone--threshold")).trim()){var i=document.createElement("div");i.setAttribute("data-unitone-layout","vertical-writing__thresholder"),e.appendChild(i);var r=i.offsetWidth>=e.offsetWidth;if(e.removeChild(i),r)return void e.setAttribute("data-unitone-layout","".concat(e.getAttribute("data-unitone-layout")," -force-switch"))}if([].slice.call(e.children).reverse().some((function(e){if(!["absolute","fixed"].includes(getComputedStyle(e).position))return t=e,!0})),t){var o=!1;e.getBoundingClientRect().left>t.getBoundingClientRect().left&&(e.style.columnCount=2,o=!0),setTimeout((function(){var n=e.getBoundingClientRect().top+e.getBoundingClientRect().height,i=t.getBoundingClientRect().top+t.getBoundingClientRect().height;n!==i&&(e.parentNode.style.height="".concat(Math.ceil(i-e.getBoundingClientRect().top),"px"))}),o?250:0)}};exports.dividersResizeObserver=function(t){var n=0,r=0;new ResizeObserver((function(t){var o,l=e(t);try{for(l.s();!(o=l.n()).done;){var u,a,s=o.value,d=null===(u=s.borderBoxSize)||void 0===u?void 0:u[0].inlineSize,c=null===(a=s.borderBoxSize)||void 0===a?void 0:a[0].blockSize;d===n&&c===r||(i(s.target),n=d,r=c)}}catch(e){l.e(e)}finally{l.f()}})).observe(t)},exports.fluidFontSizeResizeObserver=function(t){var i=0;new ResizeObserver((function(t){var r,o=e(t);try{for(o.s();!(r=o.n()).done;){var l,u=r.value,a=null===(l=u.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;a!==i&&(n(u.target),i=a)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.setDividerLinewrap=i,exports.stairsResizeObserver=function(t){var n=0;new ResizeObserver((function(t){var i,o=e(t);try{for(o.s();!(i=o.n()).done;){var l,u=i.value,a=null===(l=u.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;a!==n&&(r(u.target),n=a)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.verticalsResizeObserver=function(t){var n=0;t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," -initialized"));var i=new ResizeObserver((function(r,l){var u,a=e(r);try{var s=function(){var e,r=u.value,a=null===(e=r.contentRect)||void 0===e?void 0:e.width;parseInt(a)!==parseInt(n)&&(n=a,i.unobserve(t),l.unobserve(r.target),r.target.parentNode.style.height="",o(r.target),setTimeout((function(){l.observe(r.target)}),500))};for(a.s();!(u=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}}));i.observe(t);var r,l={attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0};new MutationObserver((function(e,n){if(clearTimeout(r),0<e.length){var u,a,s=e[0],d=null===(u=s.addedNodes)||void 0===u?void 0:u[0],c=null===(a=s.removedNodes)||void 0===a?void 0:a[0];if((null==d?void 0:d.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===d.getAttribute("data-unitone-layout")||(null==c?void 0:c.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===c.getAttribute("data-unitone-layout"))return;n.disconnect(),i.unobserve(t),r=setTimeout((function(){o(t),setTimeout((function(){n.observe(t,l),i.observe(t)}),500)}),500)}})).observe(t,l)};
|
package/package.json
CHANGED
package/src/library.js
CHANGED
|
@@ -22,7 +22,7 @@ export const fluidFontSizeResizeObserver = (target) => {
|
|
|
22
22
|
observer.observe(target);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const setDividerLinewrap = (target) => {
|
|
25
|
+
export const setDividerLinewrap = (target) => {
|
|
26
26
|
const firstChild = [].slice.call(target.children)?.[0];
|
|
27
27
|
if (!!firstChild) {
|
|
28
28
|
let prevChild;
|