@inc2734/unitone-css 0.52.0 → 0.52.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 +15 -0
package/dist/app.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t,e,n,o;function
|
|
1
|
+
"use strict";var t,e,n,o;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 i(t,e);var n=Object.prototype.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)?i(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,r=function(){};return{s:r,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},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 u,a=!0,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){l=!0,u=t},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw u}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var u=function(t){var e=parseFloat(window.getComputedStyle(document.documentElement).getPropertyValue("font-size")),n=parseFloat(window.getComputedStyle(t).getPropertyValue("font-size"));t.style.setProperty("--unitone--fluid-font-size-magnification",n/e)},a=function(t){var e,n,o=null===(e=[].slice.call(t.children))||void 0===e?void 0:e[0];o&&[].slice.call(t.children).forEach((function(t){var e,r=o.getBoundingClientRect(),i=null===(e=n)||void 0===e?void 0:e.getBoundingClientRect(),u=t.getBoundingClientRect(),a=(t.getAttribute("data-unitone-layout")||"").split(" ");r.top<u.top?a.includes("-linewrap")||a.push("-linewrap"):a=a.filter((function(t){return"-linewrap"!==t})),o===t||null!=i&&i.top&&i.top<u.top?a.includes("-bol")||a.push("-bol"):a=a.filter((function(t){return"-bol"!==t})),t.setAttribute("data-unitone-layout",a.join(" ")),n=t}))},l=function(t){var e,n=null===(e=[].slice.call(t.children))||void 0===e?void 0:e[0];if(n){var o,r=0;[].slice.call(t.children).forEach((function(e){var i;e.style.setProperty("--unitone--stairs-step","");var u=null===(i=o)||void 0===i?void 0:i.getBoundingClientRect(),a=e.getBoundingClientRect();n===e||null!=u&&u.top&&u.top<a.top?(r=0,e.style.setProperty("--unitone--stairs-step",r)):(r++,e.style.setProperty("--unitone--stairs-step",r)),o=e,t.style.setProperty("--unitone--stairs-step",r)}))}},c=function(t){t.parentNode.style.height="",t.parentNode.style.width="",t.style.columnCount="",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 o=document.createElement("div");o.setAttribute("data-unitone-layout","vertical-writing__thresholder"),t.appendChild(o);var r=o.offsetWidth>=t.offsetWidth;if(t.removeChild(o),r)return void t.setAttribute("data-unitone-layout","".concat(t.getAttribute("data-unitone-layout")," -force-switch"))}if([].slice.call(t.children).reverse().some((function(t){if(!["absolute","fixed"].includes(getComputedStyle(t).position))return e=t,!0})),e){var i=!1;t.getBoundingClientRect().left>e.getBoundingClientRect().left&&(t.style.columnCount=2,i=!0),setTimeout((function(){var n=t.getBoundingClientRect().top+t.getBoundingClientRect().height,o=e.getBoundingClientRect().top+e.getBoundingClientRect().height;n<o&&(t.parentNode.style.height="".concat(Math.ceil(o-t.getBoundingClientRect().top),"px"))}),i?250:0)}};o=function(t){var e=0;new ResizeObserver((function(t){var n,o=r(t);try{for(o.s();!(n=o.n()).done;){var i,u=n.value,l=null===(i=u.borderBoxSize)||void 0===i?void 0:i[0].inlineSize;l!==e&&(a(u.target),e=l)}}catch(t){o.e(t)}finally{o.f()}})).observe(t)},n=function(t){var e=0;new ResizeObserver((function(t){var n,o=r(t);try{for(o.s();!(n=o.n()).done;){var i,a=n.value,l=null===(i=a.borderBoxSize)||void 0===i?void 0:i[0].inlineSize;l!==e&&(u(a.target),e=l)}}catch(t){o.e(t)}finally{o.f()}})).observe(t)},e=function(t){var e=0;new ResizeObserver((function(t){var n,o=r(t);try{for(o.s();!(n=o.n()).done;){var i,u=n.value,a=null===(i=u.borderBoxSize)||void 0===i?void 0:i[0].inlineSize;a!==e&&(l(u.target),e=a)}}catch(t){o.e(t)}finally{o.f()}})).observe(t)},t=function(t){var e=0,n=new ResizeObserver((function(t,n){var o,i=r(t);try{var u=function(){var t,r=o.value,i=null===(t=r.contentRect)||void 0===t?void 0:t.width;parseInt(i)!==parseInt(e)&&(e=i,n.unobserve(r.target),c(r.target),setTimeout((function(){n.observe(r.target)}),500))};for(i.s();!(o=i.n()).done;)u()}catch(t){i.e(t)}finally{i.f()}}));n.observe(t),new MutationObserver((function(t){t.forEach((function(t){n.unobserve(t.target),c(t.target),setTimeout((function(){n.observe(t.target)}),500)}))})).observe(t,{attributes:!0,attributeFilter:["style"]})},document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){var e,o=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout~="-fluid-typography"]');null==o||o.forEach((function(t){n(t)}))}))}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){var e,n=null===(e=t.parentNode)||void 0===e?void 0:e.querySelectorAll('[data-unitone-layout*="-divider:"]');null==n||n.forEach((function(t){o(t)}))}))}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){var n,o=null===(n=t.parentNode)||void 0===n?void 0:n.querySelectorAll('[data-unitone-layout*="-stairs:"]');null==o||o.forEach((function(t){e(t)}))}))}))})).observe(document.body,{childList:!0,subtree:!0})})),document.addEventListener("DOMContentLoaded",(function(){new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){var n,o=null===(n=e.parentNode)||void 0===n?void 0:n.querySelectorAll('[data-unitone-layout~="vertical-writing"]');null==o||o.forEach((function(e){t(e)}))}))}))})).observe(document.body,{childList:!0,subtree:!0})}));
|
package/dist/library.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},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,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,l=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw l}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}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)},r=function(e){var t,n,r=null===(t=[].slice.call(e.children))||void 0===t?void 0:t[0];r&&[].slice.call(e.children).forEach((function(e){var t,i=r.getBoundingClientRect(),o=null===(t=n)||void 0===t?void 0:t.getBoundingClientRect(),l=e.getBoundingClientRect(),a=(e.getAttribute("data-unitone-layout")||"").split(" ");i.top<l.top?a.includes("-linewrap")||a.push("-linewrap"):a=a.filter((function(e){return"-linewrap"!==e})),r===e||null!=o&&o.top&&o.top<l.top?a.includes("-bol")||a.push("-bol"):a=a.filter((function(e){return"-bol"!==e})),e.setAttribute("data-unitone-layout",a.join(" ")),n=e}))},i=function(e){var t,n=null===(t=[].slice.call(e.children))||void 0===t?void 0:t[0];if(n){var r,i=0;[].slice.call(e.children).forEach((function(t){var o;t.style.setProperty("--unitone--stairs-step","");var l=null===(o=r)||void 0===o?void 0:o.getBoundingClientRect(),a=t.getBoundingClientRect();n===t||null!=l&&l.top&&l.top<a.top?(i=0,t.style.setProperty("--unitone--stairs-step",i)):(i++,t.style.setProperty("--unitone--stairs-step",i)),r=t,e.style.setProperty("--unitone--stairs-step",i)}))}};exports.dividersResizeObserver=function(t){var n=0;new ResizeObserver((function(t){var i,o=e(t);try{for(o.s();!(i=o.n()).done;){var l,a=i.value,u=null===(l=a.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;u!==n&&(r(a.target),n=u)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.fluidFontSizeResizeObserver=function(t){var r=0;new ResizeObserver((function(t){var i,o=e(t);try{for(o.s();!(i=o.n()).done;){var l,a=i.value,u=null===(l=a.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;u!==r&&(n(a.target),r=u)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.stairsResizeObserver=function(t){var n=0;new ResizeObserver((function(t){var r,o=e(t);try{for(o.s();!(r=o.n()).done;){var l,a=r.value,u=null===(l=a.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;u!==n&&(i(a.target),n=u)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.verticalsResizeObserver=function(t){var n=0,r=new ResizeObserver((function(t,r){var i,
|
|
1
|
+
"use strict";function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},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,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,l=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw l}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}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)},r=function(e){var t,n,r=null===(t=[].slice.call(e.children))||void 0===t?void 0:t[0];r&&[].slice.call(e.children).forEach((function(e){var t,i=r.getBoundingClientRect(),o=null===(t=n)||void 0===t?void 0:t.getBoundingClientRect(),l=e.getBoundingClientRect(),a=(e.getAttribute("data-unitone-layout")||"").split(" ");i.top<l.top?a.includes("-linewrap")||a.push("-linewrap"):a=a.filter((function(e){return"-linewrap"!==e})),r===e||null!=o&&o.top&&o.top<l.top?a.includes("-bol")||a.push("-bol"):a=a.filter((function(e){return"-bol"!==e})),e.setAttribute("data-unitone-layout",a.join(" ")),n=e}))},i=function(e){var t,n=null===(t=[].slice.call(e.children))||void 0===t?void 0:t[0];if(n){var r,i=0;[].slice.call(e.children).forEach((function(t){var o;t.style.setProperty("--unitone--stairs-step","");var l=null===(o=r)||void 0===o?void 0:o.getBoundingClientRect(),a=t.getBoundingClientRect();n===t||null!=l&&l.top&&l.top<a.top?(i=0,t.style.setProperty("--unitone--stairs-step",i)):(i++,t.style.setProperty("--unitone--stairs-step",i)),r=t,e.style.setProperty("--unitone--stairs-step",i)}))}},o=function(e){e.parentNode.style.height="",e.parentNode.style.width="",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 r=document.createElement("div");r.setAttribute("data-unitone-layout","vertical-writing__thresholder"),e.appendChild(r);var i=r.offsetWidth>=e.offsetWidth;if(e.removeChild(r),i)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,r=t.getBoundingClientRect().top+t.getBoundingClientRect().height;n<r&&(e.parentNode.style.height="".concat(Math.ceil(r-e.getBoundingClientRect().top),"px"))}),o?250:0)}};exports.dividersResizeObserver=function(t){var n=0;new ResizeObserver((function(t){var i,o=e(t);try{for(o.s();!(i=o.n()).done;){var l,a=i.value,u=null===(l=a.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;u!==n&&(r(a.target),n=u)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.fluidFontSizeResizeObserver=function(t){var r=0;new ResizeObserver((function(t){var i,o=e(t);try{for(o.s();!(i=o.n()).done;){var l,a=i.value,u=null===(l=a.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;u!==r&&(n(a.target),r=u)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.stairsResizeObserver=function(t){var n=0;new ResizeObserver((function(t){var r,o=e(t);try{for(o.s();!(r=o.n()).done;){var l,a=r.value,u=null===(l=a.borderBoxSize)||void 0===l?void 0:l[0].inlineSize;u!==n&&(i(a.target),n=u)}}catch(e){o.e(e)}finally{o.f()}})).observe(t)},exports.verticalsResizeObserver=function(t){var n=0,r=new ResizeObserver((function(t,r){var i,l=e(t);try{var a=function(){var e,t=i.value,l=null===(e=t.contentRect)||void 0===e?void 0:e.width;parseInt(l)!==parseInt(n)&&(n=l,r.unobserve(t.target),o(t.target),setTimeout((function(){r.observe(t.target)}),500))};for(l.s();!(i=l.n()).done;)a()}catch(e){l.e(e)}finally{l.f()}}));r.observe(t),new MutationObserver((function(e){e.forEach((function(e){r.unobserve(e.target),o(e.target),setTimeout((function(){r.observe(e.target)}),500)}))})).observe(t,{attributes:!0,attributeFilter:["style"]})};
|
package/package.json
CHANGED
package/src/library.js
CHANGED
|
@@ -194,4 +194,19 @@ export const verticalsResizeObserver = (target) => {
|
|
|
194
194
|
});
|
|
195
195
|
|
|
196
196
|
observer.observe(target);
|
|
197
|
+
|
|
198
|
+
const mObserver = new MutationObserver((entries) => {
|
|
199
|
+
entries.forEach((entry) => {
|
|
200
|
+
observer.unobserve(entry.target);
|
|
201
|
+
setColumnCountForVertical(entry.target);
|
|
202
|
+
setTimeout(() => {
|
|
203
|
+
observer.observe(entry.target);
|
|
204
|
+
}, 500);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
mObserver.observe(target, {
|
|
209
|
+
attributes: true,
|
|
210
|
+
attributeFilter: ['style'],
|
|
211
|
+
});
|
|
197
212
|
};
|