@inc2734/unitone-css 0.59.6 → 0.59.8

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 t(t,n){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,n){if(!t)return;if("string"==typeof t)return e(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return e(t,n)}(t))||n){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,u=!0,a=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return u=t.done,t},e:function(t){a=!0,l=t},f:function(){try{u||null==i.return||i.return()}finally{if(a)throw l}}}}function e(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}var n=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)},i=function(t){var e,n,i=null===(e=[].slice.call(t.children))||void 0===e?void 0:e[0];i&&[].slice.call(t.children).forEach((function(t){var e,r=i.getBoundingClientRect(),o=null===(e=n)||void 0===e?void 0:e.getBoundingClientRect(),l=t.getBoundingClientRect(),u=(t.getAttribute("data-unitone-layout")||"").split(" ");r.top<l.top?u.includes("-linewrap")||u.push("-linewrap"):u=u.filter((function(t){return"-linewrap"!==t})),i===t||null!=o&&o.top&&o.top<l.top?u.includes("-bol")||u.push("-bol"):u=u.filter((function(t){return"-bol"!==t})),t.setAttribute("data-unitone-layout",u.join(" ")),n=t}))},r=function(t){var e,n=null===(e=[].slice.call(t.children))||void 0===e?void 0:e[0];if(n){var i,r=0,o=r;[].slice.call(t.children).forEach((function(t){var e,l=window.getComputedStyle(t).getPropertyValue("position");if("absolute"!==l&&"fixed"!==l){t.style.setProperty("--unitone--stairs-step","");var u=null===(e=i)||void 0===e?void 0:e.getBoundingClientRect(),a=t.getBoundingClientRect();n===t||null!=u&&u.left&&u.left>=a.left?(r=0,t.style.setProperty("--unitone--stairs-step",r)):(r++,t.style.setProperty("--unitone--stairs-step",r)),i=t,r>o&&(o=r)}})),t.getAttribute("data-unitone-layout").match(/-stairs-up:right/)?t.style.setProperty("--unitone--stairs-step",o):t.style.setProperty("--unitone--stairs-step",r)}},o=function(t){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 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"))}if([].slice.call(t.children).reverse().some((function(t){if(!["absolute","fixed"].includes(getComputedStyle(t).position))return e=t,!0})),e){var o=!1;t.getBoundingClientRect().left>e.getBoundingClientRect().left&&(t.style.columnCount=2,o=!0),setTimeout((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"))}),o?250:0)}};exports.dividersResizeObserver=function(e){var n=0,r=0;new ResizeObserver((function(e){var o,l=t(e);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(t){l.e(t)}finally{l.f()}})).observe(e)},exports.fluidFontSizeResizeObserver=function(e){var i=0;new ResizeObserver((function(e){var r,o=t(e);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(t){o.e(t)}finally{o.f()}})).observe(e)},exports.stairsResizeObserver=function(e){var n=0;new ResizeObserver((function(e){var i,o=t(e);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(t){o.e(t)}finally{o.f()}})).observe(e)},exports.verticalsResizeObserver=function(e){var n=0;e.setAttribute("data-unitone-layout","".concat(e.getAttribute("data-unitone-layout")," -initialized"));var i=new ResizeObserver((function(r,l){var u,a=t(r);try{var s=function(){var t,r=u.value,a=null===(t=r.contentRect)||void 0===t?void 0:t.width;parseInt(a)!==parseInt(n)&&(n=a,i.unobserve(e),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(t){a.e(t)}finally{a.f()}}));i.observe(e);var r,l={attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0};new MutationObserver((function(t,n){if(clearTimeout(r),0<t.length){var u,a,s=t[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(e),r=setTimeout((function(){o(e),setTimeout((function(){n.observe(e,l),i.observe(e)}),500)}),500)}})).observe(e,l)};
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inc2734/unitone-css",
3
- "version": "0.59.6",
3
+ "version": "0.59.8",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=20.10.0",
@@ -41,6 +41,7 @@
41
41
  position: absolute;
42
42
  inset: 0;
43
43
  user-select: none;
44
+ pointer-events: none;
44
45
  border-right: var(--unitone--divider-width) var(--unitone--divider-style) var(--unitone--divider-color);
45
46
  }
46
47
  }
@@ -101,6 +102,7 @@
101
102
  position: absolute;
102
103
  inset: 0;
103
104
  user-select: none;
105
+ pointer-events: none;
104
106
  border-width: 0 var(--unitone--divider-width) var(--unitone--divider-width) 0;
105
107
  border-style: var(--unitone--divider-style);
106
108
  border-color: var(--unitone--divider-color);
@@ -96,6 +96,7 @@
96
96
  position: absolute;
97
97
  inset: 0;
98
98
  user-select: none;
99
+ pointer-events: none;
99
100
  border-width: 0 var(--unitone--divider-width) var(--unitone--divider-width) 0;
100
101
  border-style: var(--unitone--divider-style);
101
102
  border-color: var(--unitone--divider-color);
@@ -38,6 +38,7 @@
38
38
  position: absolute;
39
39
  inset: 0;
40
40
  user-select: none;
41
+ pointer-events: none;
41
42
  border-bottom: var(--unitone--divider-width) var(--unitone--divider-style) var(--unitone--divider-color);
42
43
  }
43
44
  }
@@ -62,6 +63,7 @@
62
63
  position: absolute;
63
64
  inset: 0;
64
65
  user-select: none;
66
+ pointer-events: none;
65
67
  border-bottom: var(--unitone--divider-width) var(--unitone--divider-style) var(--unitone--divider-color);
66
68
  }
67
69
  }
@@ -83,6 +85,7 @@
83
85
  position: absolute;
84
86
  inset: 0;
85
87
  user-select: none;
88
+ pointer-events: none;
86
89
  border-width: 0 var(--unitone--divider-width) var(--unitone--divider-width) var(--unitone--divider-width);
87
90
  border-style: var(--unitone--divider-style);
88
91
  border-color: var(--unitone--divider-color);
@@ -72,7 +72,7 @@
72
72
  }
73
73
 
74
74
  > :where(h2, h3, h4, h5, h6) {
75
- --unitone--text-gap-scale: 2;
75
+ --unitone--text-gap-scale: 1.5;
76
76
 
77
77
  & + :where(h2, h3, h4, h5, h6) {
78
78
  --unitone--text-gap-scale: 1;
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;