@inc2734/unitone-css 0.94.3 → 0.95.0
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.css +1 -1
- package/dist/app.js +1 -1
- package/dist/behaviors/dividers.js +1 -0
- package/dist/behaviors/index.js +1 -0
- package/dist/behaviors/stairs.js +1 -0
- package/dist/compatibility/fluid-typography.js +1 -0
- package/dist/compatibility/index.js +1 -0
- package/dist/layout-primitives/both-sides/react.js +1 -0
- package/dist/layout-primitives/center/react.js +1 -0
- package/dist/layout-primitives/cluster/react.js +1 -0
- package/dist/layout-primitives/container/react.js +1 -0
- package/dist/layout-primitives/cover/react.js +1 -0
- package/dist/layout-primitives/decorator/react.js +1 -0
- package/dist/layout-primitives/float/react.js +1 -0
- package/dist/layout-primitives/frame/react.js +1 -0
- package/dist/layout-primitives/gutters/react.js +1 -0
- package/dist/layout-primitives/index.js +1 -0
- package/dist/layout-primitives/layers/react.js +1 -0
- package/dist/layout-primitives/marquee/behavior.js +1 -0
- package/dist/layout-primitives/marquee/react.js +1 -0
- package/dist/layout-primitives/masonry/react.js +1 -0
- package/dist/layout-primitives/reel/react.js +1 -0
- package/dist/layout-primitives/responsive-grid/react.js +1 -0
- package/dist/layout-primitives/stack/react.js +1 -0
- package/dist/layout-primitives/switcher/react.js +1 -0
- package/dist/layout-primitives/text/react.js +1 -0
- package/dist/layout-primitives/texture/react.js +1 -0
- package/dist/layout-primitives/vertical-writing/behavior.js +1 -0
- package/dist/layout-primitives/vertical-writing/react.js +1 -0
- package/dist/layout-primitives/with-sidebar/react.js +1 -0
- package/dist/library.js +1 -1
- package/package.json +24 -19
- package/src/app.js +3 -110
- package/src/app.scss +4 -4
- package/src/behaviors/_index.scss +43 -0
- package/src/{helper → behaviors}/_typography.scss +1 -1
- package/src/behaviors/dividers.js +8 -0
- package/src/behaviors/index.js +2 -0
- package/src/behaviors/stairs.js +8 -0
- package/src/compatibility/fluid-typography.js +18 -0
- package/src/compatibility/index.js +1 -0
- package/src/foundation/_foundation-core.scss +107 -0
- package/src/foundation/_foundation.scss +2 -106
- package/src/foundation/_index.scss +1 -0
- package/src/helper/_helper.scss +2 -42
- package/src/layout-primitives/_index.scss +1 -0
- package/src/layout-primitives/_layout-primitives-core.scss +41 -0
- package/src/layout-primitives/_layout-primitives.scss +2 -42
- package/src/layout-primitives/both-sides/_both-sides-core.scss +31 -0
- package/src/layout-primitives/both-sides/_both-sides.scss +2 -30
- package/src/layout-primitives/both-sides/_index.scss +1 -0
- package/src/layout-primitives/both-sides/react.jsx +1 -0
- package/src/layout-primitives/center/_center-core.scss +22 -0
- package/src/layout-primitives/center/_center.scss +2 -21
- package/src/layout-primitives/center/_index.scss +1 -0
- package/src/layout-primitives/center/react.jsx +1 -0
- package/src/layout-primitives/cluster/_cluster-core.scss +126 -0
- package/src/layout-primitives/cluster/_cluster.scss +2 -125
- package/src/layout-primitives/cluster/_index.scss +1 -0
- package/src/layout-primitives/cluster/react.jsx +3 -0
- package/src/layout-primitives/container/_container-core.scss +18 -0
- package/src/layout-primitives/container/_container.scss +2 -17
- package/src/layout-primitives/container/_index.scss +1 -0
- package/src/layout-primitives/container/react.jsx +1 -0
- package/src/layout-primitives/cover/_cover-core.scss +80 -0
- package/src/layout-primitives/cover/_cover.scss +2 -79
- package/src/layout-primitives/cover/_index.scss +1 -0
- package/src/layout-primitives/cover/react.jsx +1 -0
- package/src/layout-primitives/decorator/_decorator-core.scss +104 -0
- package/src/layout-primitives/decorator/_decorator.scss +2 -103
- package/src/layout-primitives/decorator/_index.scss +1 -0
- package/src/layout-primitives/decorator/react.jsx +1 -0
- package/src/layout-primitives/float/_float-core.scss +29 -0
- package/src/layout-primitives/float/_float.scss +2 -28
- package/src/layout-primitives/float/_index.scss +1 -0
- package/src/layout-primitives/float/react.jsx +1 -0
- package/src/layout-primitives/frame/_frame-core.scss +36 -0
- package/src/layout-primitives/frame/_frame.scss +2 -35
- package/src/layout-primitives/frame/_index.scss +1 -0
- package/src/layout-primitives/frame/react.jsx +1 -0
- package/src/layout-primitives/gutters/_gutters-core.scss +12 -0
- package/src/layout-primitives/gutters/_gutters.scss +2 -11
- package/src/layout-primitives/gutters/_index.scss +1 -0
- package/src/layout-primitives/gutters/react.jsx +1 -0
- package/src/layout-primitives/index.js +2 -20
- package/src/layout-primitives/layers/_index.scss +1 -0
- package/src/layout-primitives/layers/_layers-core.scss +139 -0
- package/src/layout-primitives/layers/_layers.scss +2 -138
- package/src/layout-primitives/layers/react.jsx +1 -0
- package/src/layout-primitives/marquee/_index.scss +1 -0
- package/src/layout-primitives/marquee/_marquee-core.scss +73 -0
- package/src/layout-primitives/marquee/_marquee.scss +2 -72
- package/src/layout-primitives/marquee/behavior.js +8 -0
- package/src/layout-primitives/marquee/react.jsx +3 -0
- package/src/layout-primitives/masonry/_index.scss +1 -0
- package/src/layout-primitives/masonry/_masonry-core.scss +26 -0
- package/src/layout-primitives/masonry/_masonry.scss +2 -25
- package/src/layout-primitives/masonry/react.jsx +1 -0
- package/src/layout-primitives/reel/_index.scss +1 -0
- package/src/layout-primitives/reel/_reel-core.scss +55 -0
- package/src/layout-primitives/reel/_reel.scss +2 -54
- package/src/layout-primitives/reel/react.jsx +1 -0
- package/src/layout-primitives/responsive-grid/_index.scss +1 -0
- package/src/layout-primitives/responsive-grid/_responsive-grid-core.scss +249 -0
- package/src/layout-primitives/responsive-grid/_responsive-grid.scss +2 -248
- package/src/layout-primitives/responsive-grid/react.jsx +4 -0
- package/src/layout-primitives/stack/_index.scss +1 -0
- package/src/layout-primitives/stack/_stack-core.scss +201 -0
- package/src/layout-primitives/stack/_stack.scss +2 -200
- package/src/layout-primitives/stack/react.jsx +3 -0
- package/src/layout-primitives/switcher/_index.scss +1 -0
- package/src/layout-primitives/switcher/_switcher-core.scss +70 -0
- package/src/layout-primitives/switcher/_switcher.scss +2 -69
- package/src/layout-primitives/switcher/react.jsx +3 -0
- package/src/layout-primitives/text/_index.scss +1 -0
- package/src/layout-primitives/text/_text-core.scss +169 -0
- package/src/layout-primitives/text/_text.scss +2 -168
- package/src/layout-primitives/text/react.jsx +1 -0
- package/src/layout-primitives/texture/_index.scss +1 -0
- package/src/layout-primitives/texture/_texture-core.scss +235 -0
- package/src/layout-primitives/texture/_texture.scss +2 -234
- package/src/layout-primitives/texture/react.jsx +1 -0
- package/src/layout-primitives/vertical-writing/_index.scss +1 -0
- package/src/layout-primitives/vertical-writing/_vertical-writing-core.scss +118 -0
- package/src/layout-primitives/vertical-writing/_vertical-writing.scss +2 -117
- package/src/layout-primitives/vertical-writing/behavior.js +8 -0
- package/src/layout-primitives/vertical-writing/react.jsx +3 -0
- package/src/layout-primitives/with-sidebar/_index.scss +1 -0
- package/src/layout-primitives/with-sidebar/_with-sidebar-core.scss +337 -0
- package/src/layout-primitives/with-sidebar/_with-sidebar.scss +2 -336
- package/src/layout-primitives/with-sidebar/react.jsx +3 -0
- package/src/library.js +653 -219
- package/src/register-layout-initializer.js +132 -0
- package/src/settings/_html.scss +1 -1
- package/src/settings/_index.scss +1 -0
- package/src/settings/_root.scss +1 -1
- package/src/settings/_settings-core.scss +3 -0
- package/src/settings/_settings.scss +3 -3
- package/src/variables/_index.scss +1 -0
- package/src/variables/_variables-core.scss +78 -0
- package/src/variables/_variables.scss +2 -77
- package/dist/index.js +0 -1
- package/src/index.js +0 -1
- /package/src/{helper → behaviors}/_align-content.scss +0 -0
- /package/src/{helper → behaviors}/_align-items.scss +0 -0
- /package/src/{helper → behaviors}/_align-self.scss +0 -0
- /package/src/{helper → behaviors}/_align.scss +0 -0
- /package/src/{helper → behaviors}/_auto-phrase.scss +0 -0
- /package/src/{helper → behaviors}/_auto-repeat.scss +0 -0
- /package/src/{helper → behaviors}/_background-clip.scss +0 -0
- /package/src/{helper → behaviors}/_gap.scss +0 -0
- /package/src/{helper → behaviors}/_gutters.scss +0 -0
- /package/src/{helper → behaviors}/_justify-content.scss +0 -0
- /package/src/{helper → behaviors}/_justify-items.scss +0 -0
- /package/src/{helper → behaviors}/_justify-self.scss +0 -0
- /package/src/{helper → behaviors}/_link-decoration.scss +0 -0
- /package/src/{helper → behaviors}/_mix-blend-mode.scss +0 -0
- /package/src/{helper → behaviors}/_negative-gap.scss +0 -0
- /package/src/{helper → behaviors}/_overflow.scss +0 -0
- /package/src/{helper → behaviors}/_padding.scss +0 -0
- /package/src/{helper → behaviors}/_position.scss +0 -0
- /package/src/{helper → behaviors}/_stairs.scss +0 -0
- /package/src/{helper → behaviors}/_text-orientation.scss +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react");function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(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(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,l,a=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(u=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw i}}return a}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.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)?l(e,t):void 0}}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var a="data-unitone-layout",u="".concat(200,"px 0px"),c=function(e,t){var n,r=t.filter(Boolean).join(" ");(null!==(n=e.getAttribute(a))&&void 0!==n?n:"")!==r&&e.setAttribute(a,r)},s=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.getValue,l=r.delay,a=!0,u=new ResizeObserver(p((function(e){var r,l=o(e);try{for(l.s();!(r=l.n()).done;){var u=r.value,c=null==i?void 0:i(u);a?(n=c,a=!1):void 0!==c&&c===n||(t(u.target,u),n=c)}}catch(e){l.e(e)}finally{l.f()}}),void 0===l?250:l));return u.observe(e),u},d=function(e,t,n){var r=new MutationObserver((function(t){requestAnimationFrame((function(){null!=e&&e.isConnected&&n(t)}))}));return r.observe(e,t),r},f=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getResizeValue,l=n.delay,a=void 0===l?250:l,c=n.observeResize,f=void 0===c||c,v=n.observeIntersection,b=void 0!==v&&v,m=n.observeDirectChildrenResize,h=void 0!==m&&m,g=n.targetMutation,w=n.directChildMutation,O=b&&"undefined"!=typeof IntersectionObserver,S=!O||y(e),A=O&&!S,E=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;null!=n&&n.isConnected&&(!O||S?(A=!1,t(n)):A=!0)},C=function(e,t){var n,r=0;return function(){var i,o;null!==(o=n=null==e||null===(i=e.ownerDocument)||void 0===i?void 0:i.defaultView)&&void 0!==o&&o.requestAnimationFrame?r||(r=n.requestAnimationFrame((function(){r=0,n=null,null!=e&&e.isConnected&&t(e)}))):t(e)}}(e,E),j=function(){null!=e&&e.isConnected&&(!O||S?(A=!0,C()):A=!0)},z=function(){},P=f?h?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getValue,i=n.delay,l=void 0===i?250:i,a=n.onChildList,u=new WeakMap,c=new Set,s=new ResizeObserver(p((function(n){var i,l=!1,a=o(n);try{for(a.s();!(i=a.n()).done;){var c=i.value,s=null==r?void 0:r(c);u.has(c.target)?(void 0!==s&&s===u.get(c.target)||(l=!0),u.set(c.target,s)):u.set(c.target,s)}}catch(e){a.e(e)}finally{a.f()}l&&t(e)}),l)),f=function(){var t;Array.from(c).forEach((function(t){t.parentElement!==e&&(s.unobserve(t),c.delete(t),u.delete(t))})),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){c.has(e)||(s.observe(e),c.add(e))}))};s.observe(e),f();var v=d(e,{childList:!0},(function(n){n.some((function(e){return"childList"===e.type}))&&(f(),null==a||a(n),t(e))}));return{resizeObserver:s,mutationObserver:v}}(e,j,{getValue:r,delay:a,onChildList:function(){z()}}):{resizeObserver:s(e,j,{getValue:r,delay:a})}:{mutationObserver:null};O&&function(e,t){var n=new IntersectionObserver((function(e){var n=i(e,1)[0];n&&t(n)}),{rootMargin:u});n.observe(e)}(e,(function(e){(S=e.isIntersecting)&&A&&j()})),null!=g&&g.options&&d(e,g.options,(function(e){var t,n;(null!==(t=null===(n=g.shouldApply)||void 0===n?void 0:n.call(g,e))&&void 0!==t?t:0<e.length)&&j()}));var I=null!=w&&w.attributeFilter&&w.shouldApply?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.attributeFilter,i=n.shouldApply,o=n.attributeOldValue,l=void 0===o||o,a=new MutationObserver((function(n){requestAnimationFrame((function(){null!=e&&e.isConnected&&n.some((function(t){return"attributes"===t.type&&t.target.parentElement===e&&i(t)}))&&t(e)}))})),u=function(){var t;a.disconnect(),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){a.observe(e,{attributes:!0,attributeFilter:r,attributeOldValue:l})}))};return u(),{observer:a,syncObservedChildren:u}}(e,j,{attributeFilter:w.attributeFilter,shouldApply:w.shouldApply,attributeOldValue:w.attributeOldValue}):null;I&&(z=I.syncObservedChildren),!P.mutationObserver&&I&&d(e,{childList:!0},(function(e){e.some((function(e){return"childList"===e.type}))&&(z(),j())})),O&&!S||E(e)},v=function(e){return!(null==e||!e.isConnected)&&0<e.getClientRects().length},y=function(e){var t;if(!v(e))return!1;var n=null==e||null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView;if(!n)return!0;var r=e.getBoundingClientRect(),i=n.innerWidth,o=n.innerHeight;return r.bottom>-200&&r.right>0&&r.top<o+200&&r.left<i};function p(e,t){var n;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var l=this;clearTimeout(n),n=setTimeout((function(){e.apply(l,i)}),t)}}var b=function(e){var t,n,i,o,l,u=Array.from(e.children),s=(i=(null!==(l=e.getAttribute(a))&&void 0!==l?l:"").split(/\s+/).filter(Boolean),o=["stairs:initialized"],i.filter((function(e){return!o.includes(e)})));c(e,s);var d=u[0];if(d){if(e.style.removeProperty("--unitone--stairs-step-overflow-volume"),e.style.removeProperty("--unitone--max-stairs-step"),u.forEach((function(e){e.style.removeProperty("--unitone--stairs-step")})),v(e)){var f,y=null===(t=(null!==(n=e.getAttribute("data-unitone-layout"))&&void 0!==n?n:"").split(/\s+/).find((function(e){return e.startsWith("-stairs-up:")})))||void 0===t?void 0:t.replace("-stairs-up:",""),p=["up-down","down-up"].includes(y),b=window.getComputedStyle(e).getPropertyValue("flex-direction"),m=e.getBoundingClientRect().bottom,h=u.reduce((function(e,t){var n=window.getComputedStyle(t).getPropertyValue("position"),r=window.getComputedStyle(t).getPropertyValue("display");return"absolute"===n||"fixed"===n||"none"===r||e.push({child:t,rect:t.getBoundingClientRect()}),e}),[]),g=0,w=g;h.map((function(e,t){var n,r,i=e.child,o=e.rect,l="row-reverse"===b?(null===(n=f)||void 0===n?void 0:n.left)<=o.left:(null===(r=f)||void 0===r?void 0:r.left)>=o.left;return 0===t||d===i&&!f||l?g=0:p?g=0===g?1:0:g++,f=o,g>w&&(w=g),{child:i,stairsStep:g}})).forEach((function(e){var t=e.child,n=e.stairsStep;t.style.setProperty("--unitone--stairs-step",n)})),e.style.setProperty("--unitone--max-stairs-step",w);var O=h.reduce((function(e,t){var n=t.child.getBoundingClientRect().bottom-m;return e>n?e:n}),0);e.style.setProperty("--unitone--stairs-step-overflow-volume",O),c(e,[].concat(r(s),["stairs:initialized"]))}}else c(e,[].concat(r(s),["stairs:initialized"]))},m=Symbol.for("@inc2734/unitone-css/layout-initializers"),h=function(){return"undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof MutationObserver||"undefined"==typeof Node?null:(globalThis[m]||(globalThis[m]={initializers:new Map,pendingNodes:new Set,observer:null,rafId:0,hasDOMContentLoadedListener:!1}),globalThis[m])},g=function(e,t){var n,r;if(e.enabled()&&(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE){var i=new Set;null!==(n=t.matches)&&void 0!==n&&n.call(t,e.selector)&&i.add(t),null===(r=t.querySelectorAll)||void 0===r||r.call(t,e.selector).forEach((function(e){i.add(e)})),i.forEach((function(t){e.initialized.has(t)||(e.initialize(t),e.initialized.add(t))}))}},w=function(e){var t=h();t&&t.initializers.forEach((function(t){g(t,e)}))},O=function(){var e=h();e&&(e.pendingNodes.forEach((function(e){w(e)})),e.pendingNodes.clear(),e.rafId=0)},S=function(){var e=h();e&&!e.observer&&document.body&&(w(document.body),e.observer=new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE&&e.pendingNodes.add(t)}))})),!e.rafId&&0<e.pendingNodes.size&&(e.rafId=requestAnimationFrame(O))})),e.observer.observe(document.body,{childList:!0,subtree:!0}))};function A(){return A=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(null,arguments)}function E(e){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(e)}function C(e){var t=function(e,t){if("object"!=E(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=E(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==E(t)?t:t+""}function j(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){var t=e.key,n=e.selector,r=e.initialize,i=e.enabled,o=void 0===i?function(){return!0}:i,l=h();if(l&&!l.initializers.has(t)){var a={selector:n,initialize:r,enabled:o,initialized:new WeakSet};l.initializers.set(t,a),l.observer?g(a,document.body):"loading"!==document.readyState?S():l.hasDOMContentLoadedListener||(document.addEventListener("DOMContentLoaded",S,{once:!0}),l.hasDOMContentLoadedListener=!0)}}({key:"behaviors/stairs",selector:'[data-unitone-layout*="-stairs:"]',initialize:function(e){f(e,b,{observeIntersection:!0,observeDirectChildrenResize:!0})}});var z=["gap","columnGap","rowGap","limit","revert","threshold","alignItems","stairs","stairsUp","style"];function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}exports.Switcher=function(t){var n=t.gap,r=t.columnGap,i=t.rowGap;t.limit;var o=t.revert,l=t.threshold,a=t.alignItems,u=t.stairs,c=t.stairsUp,s=t.style,d=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,z);return s=I(I({},s),{},{"--unitone--threshold":""!==l?l:void 0}),e.createElement("div",A({"data-unitone-layout":["switcher",o?"-revert":void 0,""!==(null!=n?n:"")?"-gap:".concat(n):void 0,""!==(null!=r?r:"")?"-column-gap:".concat(r):void 0,""!==(null!=i?i:"")?"-row-gap:".concat(i):void 0,""!==(null!=a?a:"")?"-align-items:".concat(a):void 0,""!==(null!=u?u:"")?"-stairs:".concat(u):void 0,""!==(null!=c?c:"")?"-stairs-up:".concat(c):void 0].filter(Boolean).join(" "),style:s},d),d.children)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("react");function r(){return r=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},r.apply(null,arguments)}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r);if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function o(t,r,e){return(r=n(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}var i=["center","column","applyGap","gap","gutters","maxWidth","columnWidth","style"];function u(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function c(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?u(Object(e),!0).forEach((function(r){o(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}exports.Text=function(e){var n=e.center,o=e.column,u=e.applyGap,l=e.gap,a=e.gutters,f=e.maxWidth,p=e.columnWidth,y=e.style,b=function(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==r.indexOf(n))continue;e[n]=t[n]}return e}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],-1===r.indexOf(e)&&{}.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}(e,i);return y=c(c({},y),{},{"--unitone--max-width":""!==f?f:void 0,"--unitone--column-width":""!==p?p:void 0}),t.createElement("div",r({"data-unitone-layout":["text",n?"-center":void 0,o?"-column":void 0,u?"-gap":void 0,""!==(null!=l?l:"")?"-gap:".concat(l):void 0,""!==(null!=a?a:"")?"-gutters:".concat(a):void 0].filter(Boolean).join(" "),style:y},b),b.children)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("react");function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)({}).hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},e.apply(null,arguments)}function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,e);if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}function n(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var u=["texture","textureColor","textureGap","textureSize","textureTop","textureRight","textureBottom","textureLeft","textureBorderRadius","textureBorderTopLeftRadius","textureBorderTopRightRadius","textureBorderBottomLeftRadius","textureBorderBottomRightRadius","style"];function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}exports.Texture=function(r){var o=r.texture,n=r.textureColor,i=r.textureGap,l=r.textureSize,c=r.textureTop,f=r.textureRight,d=r.textureBottom,s=r.textureLeft,b=r.textureBorderRadius,p=r.textureBorderTopLeftRadius,x=r.textureBorderTopRightRadius,y=r.textureBorderBottomLeftRadius,v=r.textureBorderBottomRightRadius,m=r.style,O=function(t,e){if(null==t)return{};var r,o,n=function(t,e){if(null==t)return{};var r={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(-1!==e.indexOf(o))continue;r[o]=t[o]}return r}(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(o=0;o<u.length;o++)r=u[o],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}(r,u);return m=a(a({},m),{},{"--unitone--texture-color":""!==n?n:void 0,"--unitone--texture-gap":""!==i?i:void 0,"--unitone--texture-size":""!==l?l:void 0,"--unitone--texture-top":""!==c?c:void 0,"--unitone--texture-right":""!==f?f:void 0,"--unitone--texture-bottom":""!==d?d:void 0,"--unitone--texture-left":""!==s?s:void 0,"--unitone--texture-border-radius":""!==b?b:void 0,"--unitone--texture-border-top-left-radius":""!==p?p:void 0,"--unitone--texture-border-top-right-radius":""!==x?x:void 0,"--unitone--texture-border-bottom-left-radius":""!==y?y:void 0,"--unitone--texture-border-bottom-right-radius":""!==v?v:void 0}),t.createElement("div",e({"data-unitone-layout":["texture",""!==(null!=o?o:"")?"-texture:".concat(o):void 0].filter(Boolean).join(" "),style:m},O),O.children)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.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)?e(t,n):void 0}}function n(n){return function(t){if(Array.isArray(t))return e(t)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||t(n)||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(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,l=[],u=!0,d=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(u=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);u=!0);}catch(e){d=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(d)throw i}}return l}}(e,n)||t(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.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)?o(e,t):void 0}}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){u=!0,a=e},f:function(){try{l||null==n.return||n.return()}finally{if(u)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var a="data-unitone-layout",l="".concat(200,"px 0px"),u=function(e,t){return e.filter((function(e){return!t.includes(e)}))},d=function(e,t){var n,r=t.filter(Boolean).join(" ");(null!==(n=e.getAttribute(a))&&void 0!==n?n:"")!==r&&e.setAttribute(a,r)},c=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.getValue,a=r.delay,l=!0,u=new ResizeObserver(y((function(e){var r,a=i(e);try{for(a.s();!(r=a.n()).done;){var u=r.value,d=null==o?void 0:o(u);l?(n=d,l=!1):void 0!==d&&d===n||(t(u.target,u),n=d)}}catch(e){a.e(e)}finally{a.f()}}),void 0===a?250:a));return u.observe(e),u},s=function(e,t,n){var r=new MutationObserver((function(t){requestAnimationFrame((function(){null!=e&&e.isConnected&&n(t)}))}));return r.observe(e,t),r},f=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.getResizeValue,a=n.delay,u=void 0===a?250:a,d=n.observeResize,f=void 0===d||d,v=n.observeIntersection,b=void 0!==v&&v,g=n.observeDirectChildrenResize,p=void 0!==g&&g,m=n.targetMutation,w=n.directChildMutation,A=b&&"undefined"!=typeof IntersectionObserver,C=!A||h(e),O=A&&!C,E=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;null!=n&&n.isConnected&&(!A||C?(O=!1,t(n)):O=!0)},z=function(e,t){var n,r=0;return function(){var i,o;null!==(o=n=null==e||null===(i=e.ownerDocument)||void 0===i?void 0:i.defaultView)&&void 0!==o&&o.requestAnimationFrame?r||(r=n.requestAnimationFrame((function(){r=0,n=null,null!=e&&e.isConnected&&t(e)}))):t(e)}}(e,E),S=function(){null!=e&&e.isConnected&&(!A||C?(O=!0,z()):O=!0)},N=function(){},L=f?p?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getValue,o=n.delay,a=void 0===o?250:o,l=n.onChildList,u=new WeakMap,d=new Set,c=new ResizeObserver(y((function(n){var o,a=!1,l=i(n);try{for(l.s();!(o=l.n()).done;){var d=o.value,c=null==r?void 0:r(d);u.has(d.target)?(void 0!==c&&c===u.get(d.target)||(a=!0),u.set(d.target,c)):u.set(d.target,c)}}catch(e){l.e(e)}finally{l.f()}a&&t(e)}),a)),f=function(){var t;Array.from(d).forEach((function(t){t.parentElement!==e&&(c.unobserve(t),d.delete(t),u.delete(t))})),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){d.has(e)||(c.observe(e),d.add(e))}))};c.observe(e),f();var v=s(e,{childList:!0},(function(n){n.some((function(e){return"childList"===e.type}))&&(f(),null==l||l(n),t(e))}));return{resizeObserver:c,mutationObserver:v}}(e,S,{getValue:o,delay:u,onChildList:function(){N()}}):{resizeObserver:c(e,S,{getValue:o,delay:u})}:{mutationObserver:null};A&&function(e,t){var n=new IntersectionObserver((function(e){var n=r(e,1)[0];n&&t(n)}),{rootMargin:l});n.observe(e)}(e,(function(e){(C=e.isIntersecting)&&O&&S()})),null!=m&&m.options&&s(e,m.options,(function(e){var t,n;(null!==(t=null===(n=m.shouldApply)||void 0===n?void 0:n.call(m,e))&&void 0!==t?t:0<e.length)&&S()}));var M=null!=w&&w.attributeFilter&&w.shouldApply?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.attributeFilter,i=n.shouldApply,o=n.attributeOldValue,a=void 0===o||o,l=new MutationObserver((function(n){requestAnimationFrame((function(){null!=e&&e.isConnected&&n.some((function(t){return"attributes"===t.type&&t.target.parentElement===e&&i(t)}))&&t(e)}))})),u=function(){var t;l.disconnect(),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){l.observe(e,{attributes:!0,attributeFilter:r,attributeOldValue:a})}))};return u(),{observer:l,syncObservedChildren:u}}(e,S,{attributeFilter:w.attributeFilter,shouldApply:w.shouldApply,attributeOldValue:w.attributeOldValue}):null;M&&(N=M.syncObservedChildren),!L.mutationObserver&&M&&s(e,{childList:!0},(function(e){e.some((function(e){return"childList"===e.type}))&&(N(),S())})),A&&!C||E(e)},v=function(e){var t;return parseInt(null===(t=e.contentRect)||void 0===t?void 0:t.width)},h=function(e){var t;if(!function(e){return!(null==e||!e.isConnected)&&0<e.getClientRects().length}(e))return!1;var n=null==e||null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView;if(!n)return!0;var r=e.getBoundingClientRect(),i=n.innerWidth,o=n.innerHeight;return r.bottom>-200&&r.right>0&&r.top<o+200&&r.left<i};function y(e,t){var n;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=this;clearTimeout(n),n=setTimeout((function(){e.apply(a,i)}),t)}}var b=function(e){return e.some((function(e){return"attributes"===e.type||"childList"===e.type&&[].concat(n(e.addedNodes),n(e.removedNodes)).some((function(e){return!function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE&&["vertical-writing__thresholder","vertical-writing:initialized","vertical-writing:safari"].includes(e.getAttribute("data-unitone-layout"))}(e)}))}))},g=function(e){if(e){var t,r,i=(null!==(t=e.getAttribute(a))&&void 0!==t?t:"").split(/\s+/).filter(Boolean),o=u(i,["vertical-writing:safari","-force-switch"]),l=u(i,["vertical-writing:initialized","vertical-writing:safari","-force-switch"]);if(d(e,o),Array.from(e.children).reverse().some((function(e){if(!["absolute","fixed"].includes(getComputedStyle(e).position)&&"none"!==getComputedStyle(e).display)return r=e,!0})),r){var c=getComputedStyle(e),s=String(c.getPropertyValue("--unitone--threshold")).trim(),f=!1;if(s){var v=e.ownerDocument.createElement("div");v.setAttribute(a,"vertical-writing__thresholder"),e.appendChild(v),f=v.offsetWidth>=e.offsetWidth,v.remove()}if(f)l.push("-force-switch");else e.getBoundingClientRect().left>r.getBoundingClientRect().left&&l.push("vertical-writing:safari");d(e,[].concat(n(l),["vertical-writing:initialized"])),requestAnimationFrame((function(){var t;if(null!=e&&e.isConnected&&null!==(t=e.parentNode)&&void 0!==t&&t.style){if(f)return void(e.parentNode.style.height="");var n=e.getBoundingClientRect(),i=r.getBoundingClientRect(),o=n.top+n.height,a=i.top+i.height;e.parentNode.style.height=o!==a?"".concat(Math.ceil(a-n.top),"px"):""}}))}else d(e,[].concat(n(l),["vertical-writing:initialized"]))}},p=Symbol.for("@inc2734/unitone-css/layout-initializers"),m=function(){return"undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof MutationObserver||"undefined"==typeof Node?null:(globalThis[p]||(globalThis[p]={initializers:new Map,pendingNodes:new Set,observer:null,rafId:0,hasDOMContentLoadedListener:!1}),globalThis[p])},w=function(e,t){var n,r;if(e.enabled()&&(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE){var i=new Set;null!==(n=t.matches)&&void 0!==n&&n.call(t,e.selector)&&i.add(t),null===(r=t.querySelectorAll)||void 0===r||r.call(t,e.selector).forEach((function(e){i.add(e)})),i.forEach((function(t){e.initialized.has(t)||(e.initialize(t),e.initialized.add(t))}))}},A=function(e){var t=m();t&&t.initializers.forEach((function(t){w(t,e)}))},C=function(){var e=m();e&&(e.pendingNodes.forEach((function(e){A(e)})),e.pendingNodes.clear(),e.rafId=0)},O=function(){var e=m();e&&!e.observer&&document.body&&(A(document.body),e.observer=new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE&&e.pendingNodes.add(t)}))})),!e.rafId&&0<e.pendingNodes.size&&(e.rafId=requestAnimationFrame(C))})),e.observer.observe(document.body,{childList:!0,subtree:!0}))};!function(e){var t=e.key,n=e.selector,r=e.initialize,i=e.enabled,o=void 0===i?function(){return!0}:i,a=m();if(a&&!a.initializers.has(t)){var l={selector:n,initialize:r,enabled:o,initialized:new WeakSet};a.initializers.set(t,l),a.observer?w(l,document.body):"loading"!==document.readyState?O():a.hasDOMContentLoadedListener||(document.addEventListener("DOMContentLoaded",O,{once:!0}),a.hasDOMContentLoadedListener=!0)}}({key:"layout-primitives/vertical-writing",selector:'[data-unitone-layout~="vertical-writing"]',initialize:function(e){f(e,(function(e){var t;null!==(t=e.parentNode)&&void 0!==t&&t.style&&(e.parentNode.style.height=""),g(e)}),{getResizeValue:v,observeIntersection:!0,targetMutation:{options:{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0},shouldApply:b}})}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react");function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(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(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,l=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(u=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return l}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.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)?a(e,t):void 0}}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,l=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return l=e.done,e},e:function(e){u=!0,o=e},f:function(){try{l||null==n.return||n.return()}finally{if(u)throw o}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var l="data-unitone-layout",u="".concat(200,"px 0px"),c=function(e,t){return e.filter((function(e){return!t.includes(e)}))},d=function(e,t){var n,r=t.filter(Boolean).join(" ");(null!==(n=e.getAttribute(l))&&void 0!==n?n:"")!==r&&e.setAttribute(l,r)},s=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.getValue,a=r.delay,l=!0,u=new ResizeObserver(h((function(e){var r,a=o(e);try{for(a.s();!(r=a.n()).done;){var u=r.value,c=null==i?void 0:i(u);l?(n=c,l=!1):void 0!==c&&c===n||(t(u.target,u),n=c)}}catch(e){a.e(e)}finally{a.f()}}),void 0===a?250:a));return u.observe(e),u},f=function(e,t,n){var r=new MutationObserver((function(t){requestAnimationFrame((function(){null!=e&&e.isConnected&&n(t)}))}));return r.observe(e,t),r},v=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getResizeValue,a=n.delay,l=void 0===a?250:a,c=n.observeResize,d=void 0===c||c,v=n.observeIntersection,y=void 0!==v&&v,p=n.observeDirectChildrenResize,g=void 0!==p&&p,m=n.targetMutation,w=n.directChildMutation,O=y&&"undefined"!=typeof IntersectionObserver,A=!O||b(e),S=O&&!A,E=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;null!=n&&n.isConnected&&(!O||A?(S=!1,t(n)):S=!0)},C=function(e,t){var n,r=0;return function(){var i,o;null!==(o=n=null==e||null===(i=e.ownerDocument)||void 0===i?void 0:i.defaultView)&&void 0!==o&&o.requestAnimationFrame?r||(r=n.requestAnimationFrame((function(){r=0,n=null,null!=e&&e.isConnected&&t(e)}))):t(e)}}(e,E),j=function(){null!=e&&e.isConnected&&(!O||A?(S=!0,C()):S=!0)},z=function(){},N=d?g?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getValue,i=n.delay,a=void 0===i?250:i,l=n.onChildList,u=new WeakMap,c=new Set,d=new ResizeObserver(h((function(n){var i,a=!1,l=o(n);try{for(l.s();!(i=l.n()).done;){var c=i.value,d=null==r?void 0:r(c);u.has(c.target)?(void 0!==d&&d===u.get(c.target)||(a=!0),u.set(c.target,d)):u.set(c.target,d)}}catch(e){l.e(e)}finally{l.f()}a&&t(e)}),a)),s=function(){var t;Array.from(c).forEach((function(t){t.parentElement!==e&&(d.unobserve(t),c.delete(t),u.delete(t))})),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){c.has(e)||(d.observe(e),c.add(e))}))};d.observe(e),s();var v=f(e,{childList:!0},(function(n){n.some((function(e){return"childList"===e.type}))&&(s(),null==l||l(n),t(e))}));return{resizeObserver:d,mutationObserver:v}}(e,j,{getValue:r,delay:l,onChildList:function(){z()}}):{resizeObserver:s(e,j,{getValue:r,delay:l})}:{mutationObserver:null};O&&function(e,t){var n=new IntersectionObserver((function(e){var n=i(e,1)[0];n&&t(n)}),{rootMargin:u});n.observe(e)}(e,(function(e){(A=e.isIntersecting)&&S&&j()})),null!=m&&m.options&&f(e,m.options,(function(e){var t,n;(null!==(t=null===(n=m.shouldApply)||void 0===n?void 0:n.call(m,e))&&void 0!==t?t:0<e.length)&&j()}));var M=null!=w&&w.attributeFilter&&w.shouldApply?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.attributeFilter,i=n.shouldApply,o=n.attributeOldValue,a=void 0===o||o,l=new MutationObserver((function(n){requestAnimationFrame((function(){null!=e&&e.isConnected&&n.some((function(t){return"attributes"===t.type&&t.target.parentElement===e&&i(t)}))&&t(e)}))})),u=function(){var t;l.disconnect(),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){l.observe(e,{attributes:!0,attributeFilter:r,attributeOldValue:a})}))};return u(),{observer:l,syncObservedChildren:u}}(e,j,{attributeFilter:w.attributeFilter,shouldApply:w.shouldApply,attributeOldValue:w.attributeOldValue}):null;M&&(z=M.syncObservedChildren),!N.mutationObserver&&M&&f(e,{childList:!0},(function(e){e.some((function(e){return"childList"===e.type}))&&(z(),j())})),O&&!A||E(e)},y=function(e){var t;return parseInt(null===(t=e.contentRect)||void 0===t?void 0:t.width)},b=function(e){var t;if(!function(e){return!(null==e||!e.isConnected)&&0<e.getClientRects().length}(e))return!1;var n=null==e||null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView;if(!n)return!0;var r=e.getBoundingClientRect(),i=n.innerWidth,o=n.innerHeight;return r.bottom>-200&&r.right>0&&r.top<o+200&&r.left<i};function h(e,t){var n;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=this;clearTimeout(n),n=setTimeout((function(){e.apply(a,i)}),t)}}var p=function(e){return e.some((function(e){return"attributes"===e.type||"childList"===e.type&&[].concat(r(e.addedNodes),r(e.removedNodes)).some((function(e){return!function(e){return(null==e?void 0:e.nodeType)===Node.ELEMENT_NODE&&["vertical-writing__thresholder","vertical-writing:initialized","vertical-writing:safari"].includes(e.getAttribute("data-unitone-layout"))}(e)}))}))},g=function(e){if(e){var t,n,i=(null!==(t=e.getAttribute(l))&&void 0!==t?t:"").split(/\s+/).filter(Boolean),o=c(i,["vertical-writing:safari","-force-switch"]),a=c(i,["vertical-writing:initialized","vertical-writing:safari","-force-switch"]);if(d(e,o),Array.from(e.children).reverse().some((function(e){if(!["absolute","fixed"].includes(getComputedStyle(e).position)&&"none"!==getComputedStyle(e).display)return n=e,!0})),n){var u=getComputedStyle(e),s=String(u.getPropertyValue("--unitone--threshold")).trim(),f=!1;if(s){var v=e.ownerDocument.createElement("div");v.setAttribute(l,"vertical-writing__thresholder"),e.appendChild(v),f=v.offsetWidth>=e.offsetWidth,v.remove()}if(f)a.push("-force-switch");else e.getBoundingClientRect().left>n.getBoundingClientRect().left&&a.push("vertical-writing:safari");d(e,[].concat(r(a),["vertical-writing:initialized"])),requestAnimationFrame((function(){var t;if(null!=e&&e.isConnected&&null!==(t=e.parentNode)&&void 0!==t&&t.style){if(f)return void(e.parentNode.style.height="");var r=e.getBoundingClientRect(),i=n.getBoundingClientRect(),o=r.top+r.height,a=i.top+i.height;e.parentNode.style.height=o!==a?"".concat(Math.ceil(a-r.top),"px"):""}}))}else d(e,[].concat(r(a),["vertical-writing:initialized"]))}},m=Symbol.for("@inc2734/unitone-css/layout-initializers"),w=function(){return"undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof MutationObserver||"undefined"==typeof Node?null:(globalThis[m]||(globalThis[m]={initializers:new Map,pendingNodes:new Set,observer:null,rafId:0,hasDOMContentLoadedListener:!1}),globalThis[m])},O=function(e,t){var n,r;if(e.enabled()&&(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE){var i=new Set;null!==(n=t.matches)&&void 0!==n&&n.call(t,e.selector)&&i.add(t),null===(r=t.querySelectorAll)||void 0===r||r.call(t,e.selector).forEach((function(e){i.add(e)})),i.forEach((function(t){e.initialized.has(t)||(e.initialize(t),e.initialized.add(t))}))}},A=function(e){var t=w();t&&t.initializers.forEach((function(t){O(t,e)}))},S=function(){var e=w();e&&(e.pendingNodes.forEach((function(e){A(e)})),e.pendingNodes.clear(),e.rafId=0)},E=function(){var e=w();e&&!e.observer&&document.body&&(A(document.body),e.observer=new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE&&e.pendingNodes.add(t)}))})),!e.rafId&&0<e.pendingNodes.size&&(e.rafId=requestAnimationFrame(S))})),e.observer.observe(document.body,{childList:!0,subtree:!0}))};function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},C.apply(null,arguments)}function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function z(e){var t=function(e,t){if("object"!=j(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==j(t)?t:t+""}function N(e,t,n){return(t=z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){var t=e.key,n=e.selector,r=e.initialize,i=e.enabled,o=void 0===i?function(){return!0}:i,a=w();if(a&&!a.initializers.has(t)){var l={selector:n,initialize:r,enabled:o,initialized:new WeakSet};a.initializers.set(t,l),a.observer?O(l,document.body):"loading"!==document.readyState?E():a.hasDOMContentLoadedListener||(document.addEventListener("DOMContentLoaded",E,{once:!0}),a.hasDOMContentLoadedListener=!0)}}({key:"layout-primitives/vertical-writing",selector:'[data-unitone-layout~="vertical-writing"]',initialize:function(e){v(e,(function(e){var t;null!==(t=e.parentNode)&&void 0!==t&&t.style&&(e.parentNode.style.height=""),g(e)}),{getResizeValue:y,observeIntersection:!0,targetMutation:{options:{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0},shouldApply:p}})}});var M=["textOrientation","gap","maxHeight","switchWritingMode","threshold","style"];function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}exports.VerticalWriting=function(t){var n=t.textOrientation,r=t.gap,i=t.maxHeight,o=t.switchWritingMode,a=t.threshold,l=t.style,u=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,M);return l=I(I({},l),{},{"--unitone--max-height":""!==i?i:void 0,"--unitone--threshold":""!==a?a:void 0}),e.createElement("div",{"data-unitone-layout":"vertical-writing-wrapper"},e.createElement("div",C({"data-unitone-layout":["vertical-writing",""!==(null!=n?n:"")?"-text-orientation:".concat(n):void 0,""!==(null!=r?r:"")?"-gap:".concat(r):void 0,o?"-switch":void 0].filter(Boolean).join(" "),style:l},u),u.children))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react");function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function r(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(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(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,l,u=[],a=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(a=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{if(!a&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw i}}return u}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.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)?l(e,t):void 0}}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,u=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){a=!0,o=e},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var u="data-unitone-layout",a="".concat(200,"px 0px"),c=function(e){var t;return(null!==(t=e.getAttribute(u))&&void 0!==t?t:"").split(/\s+/).filter(Boolean)},d=function(e,t){return e.filter((function(e){return!t.includes(e)}))},s=function(e,t){var n,r=t.filter(Boolean).join(" ");(null!==(n=e.getAttribute(u))&&void 0!==n?n:"")!==r&&e.setAttribute(u,r)},f=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=r.getValue,l=r.delay,u=!0,a=new ResizeObserver(m((function(e){var r,l=o(e);try{for(l.s();!(r=l.n()).done;){var a=r.value,c=null==i?void 0:i(a);u?(n=c,u=!1):void 0!==c&&c===n||(t(a.target,a),n=c)}}catch(e){l.e(e)}finally{l.f()}}),void 0===l?250:l));return a.observe(e),a},v=function(e,t,n){var r=new MutationObserver((function(t){requestAnimationFrame((function(){null!=e&&e.isConnected&&n(t)}))}));return r.observe(e,t),r},b=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getResizeValue,l=n.delay,u=void 0===l?250:l,c=n.observeResize,d=void 0===c||c,s=n.observeIntersection,b=void 0!==s&&s,y=n.observeDirectChildrenResize,p=void 0!==y&&y,g=n.targetMutation,w=n.directChildMutation,O=b&&"undefined"!=typeof IntersectionObserver,A=!O||h(e),S=O&&!A,j=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;null!=n&&n.isConnected&&(!O||A?(S=!1,t(n)):S=!0)},E=function(e,t){var n,r=0;return function(){var i,o;null!==(o=n=null==e||null===(i=e.ownerDocument)||void 0===i?void 0:i.defaultView)&&void 0!==o&&o.requestAnimationFrame?r||(r=n.requestAnimationFrame((function(){r=0,n=null,null!=e&&e.isConnected&&t(e)}))):t(e)}}(e,j),z=function(){null!=e&&e.isConnected&&(!O||A?(S=!0,E()):S=!0)},C=function(){},M=d?p?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getValue,i=n.delay,l=void 0===i?250:i,u=n.onChildList,a=new WeakMap,c=new Set,d=new ResizeObserver(m((function(n){var i,l=!1,u=o(n);try{for(u.s();!(i=u.n()).done;){var c=i.value,d=null==r?void 0:r(c);a.has(c.target)?(void 0!==d&&d===a.get(c.target)||(l=!0),a.set(c.target,d)):a.set(c.target,d)}}catch(e){u.e(e)}finally{u.f()}l&&t(e)}),l)),s=function(){var t;Array.from(c).forEach((function(t){t.parentElement!==e&&(d.unobserve(t),c.delete(t),a.delete(t))})),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){c.has(e)||(d.observe(e),c.add(e))}))};d.observe(e),s();var f=v(e,{childList:!0},(function(n){n.some((function(e){return"childList"===e.type}))&&(s(),null==u||u(n),t(e))}));return{resizeObserver:d,mutationObserver:f}}(e,z,{getValue:r,delay:u,onChildList:function(){C()}}):{resizeObserver:f(e,z,{getValue:r,delay:u})}:{mutationObserver:null};O&&function(e,t){var n=new IntersectionObserver((function(e){var n=i(e,1)[0];n&&t(n)}),{rootMargin:a});n.observe(e)}(e,(function(e){(A=e.isIntersecting)&&S&&z()})),null!=g&&g.options&&v(e,g.options,(function(e){var t,n;(null!==(t=null===(n=g.shouldApply)||void 0===n?void 0:n.call(g,e))&&void 0!==t?t:0<e.length)&&z()}));var I=null!=w&&w.attributeFilter&&w.shouldApply?function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.attributeFilter,i=n.shouldApply,o=n.attributeOldValue,l=void 0===o||o,u=new MutationObserver((function(n){requestAnimationFrame((function(){null!=e&&e.isConnected&&n.some((function(t){return"attributes"===t.type&&t.target.parentElement===e&&i(t)}))&&t(e)}))})),a=function(){var t;u.disconnect(),Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]).forEach((function(e){u.observe(e,{attributes:!0,attributeFilter:r,attributeOldValue:l})}))};return a(),{observer:u,syncObservedChildren:a}}(e,z,{attributeFilter:w.attributeFilter,shouldApply:w.shouldApply,attributeOldValue:w.attributeOldValue}):null;I&&(C=I.syncObservedChildren),!M.mutationObserver&&I&&v(e,{childList:!0},(function(e){e.some((function(e){return"childList"===e.type}))&&(C(),z())})),O&&!A||j(e)},y=function(e){var t;return null===(t=e.borderBoxSize)||void 0===t?void 0:t[0].inlineSize},p=function(e){return!(null==e||!e.isConnected)&&0<e.getClientRects().length},h=function(e){var t;if(!p(e))return!1;var n=null==e||null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView;if(!n)return!0;var r=e.getBoundingClientRect(),i=n.innerWidth,o=n.innerHeight;return r.bottom>-200&&r.right>0&&r.top<o+200&&r.left<i};function m(e,t){var n;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var l=this;clearTimeout(n),n=setTimeout((function(){e.apply(l,i)}),t)}}var g=function(e){var t,n=Array.from(null!==(t=null==e?void 0:e.children)&&void 0!==t?t:[]),i=n[0];if(i){var o=d(c(e),["divider:initialized","-stack"]);s(e,o);var l=new Map;if(n.forEach((function(e){var t=d(c(e),["-bol","-linewrap"]);l.set(e,t),s(e,t)})),p(e)){var u,a=i.getBoundingClientRect(),f=n.reduce((function(e,t){var n,r=window.getComputedStyle(t).getPropertyValue("position"),i=window.getComputedStyle(t).getPropertyValue("display");"absolute"!==r&&"fixed"!==r&&"none"!==i&&e.push({child:t,layoutTokens:null!==(n=l.get(t))&&void 0!==n?n:[],rect:t.getBoundingClientRect()});return e}),[]);f.map((function(e,t){var n,i,o=e.child,l=e.layoutTokens,c=e.rect,d=r(l);return(0===t||(null===(n=u)||void 0===n?void 0:n.top)<c.top&&(null===(i=u)||void 0===i?void 0:i.left)>=c.left)&&d.push("-bol"),0<t&&a.top<c.top&&d.push("-linewrap"),u=c,{child:o,layoutTokens:d}})).forEach((function(e){var t=e.child,n=e.layoutTokens;s(t,n)}));var v=f.every((function(e){return e.rect.left===a.left})),b=r(o);v&&b.push("-stack"),b.push("divider:initialized"),s(e,b)}}},w=Symbol.for("@inc2734/unitone-css/layout-initializers"),O=function(){return"undefined"==typeof window||"undefined"==typeof document||"undefined"==typeof MutationObserver||"undefined"==typeof Node?null:(globalThis[w]||(globalThis[w]={initializers:new Map,pendingNodes:new Set,observer:null,rafId:0,hasDOMContentLoadedListener:!1}),globalThis[w])},A=function(e,t){var n,r;if(e.enabled()&&(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE){var i=new Set;null!==(n=t.matches)&&void 0!==n&&n.call(t,e.selector)&&i.add(t),null===(r=t.querySelectorAll)||void 0===r||r.call(t,e.selector).forEach((function(e){i.add(e)})),i.forEach((function(t){e.initialized.has(t)||(e.initialize(t),e.initialized.add(t))}))}},S=function(e){var t=O();t&&t.initializers.forEach((function(t){A(t,e)}))},j=function(){var e=O();e&&(e.pendingNodes.forEach((function(e){S(e)})),e.pendingNodes.clear(),e.rafId=0)},E=function(){var e=O();e&&!e.observer&&document.body&&(S(document.body),e.observer=new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE&&e.pendingNodes.add(t)}))})),!e.rafId&&0<e.pendingNodes.size&&(e.rafId=requestAnimationFrame(j))})),e.observer.observe(document.body,{childList:!0,subtree:!0}))};function z(){return z=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},z.apply(null,arguments)}function C(e){return C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(e)}function M(e){var t=function(e,t){if("object"!=C(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=C(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==C(t)?t:t+""}function I(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){var t=e.key,n=e.selector,r=e.initialize,i=e.enabled,o=void 0===i?function(){return!0}:i,l=O();if(l&&!l.initializers.has(t)){var u={selector:n,initialize:r,enabled:o,initialized:new WeakSet};l.initializers.set(t,u),l.observer?A(u,document.body):"loading"!==document.readyState?E():l.hasDOMContentLoadedListener||(document.addEventListener("DOMContentLoaded",E,{once:!0}),l.hasDOMContentLoadedListener=!0)}}({key:"behaviors/dividers",selector:'[data-unitone-layout*="-divider:"]',initialize:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(e){if("data-unitone-layout"===e.attributeName){var n,i,o,l,u=[].concat(r(null!==(n=null==t||null===(i=t.ignore)||void 0===i?void 0:i.layout)&&void 0!==n?n:[]),["divider:initialized","-bol","-linewrap","-stack"]);return(null!==(o=e.target.getAttribute(e.attributeName))&&void 0!==o?o:"").split(" ").filter((function(e){return!u.includes(e)})).join(" ")!==(null!==(l=e.oldValue)&&void 0!==l?l:"").split(" ").filter((function(e){return!u.includes(e)})).join(" ")}if("class"===e.attributeName){var a,c,d,s,f=r(null!==(a=null==t||null===(c=t.ignore)||void 0===c?void 0:c.className)&&void 0!==a?a:[]);return(null!==(d=e.target.getAttribute(e.attributeName))&&void 0!==d?d:"").split(" ").filter((function(e){return!f.includes(e)})).join(" ")!==(null!==(s=e.oldValue)&&void 0!==s?s:"").split(" ").filter((function(e){return!f.includes(e)})).join(" ")}return"style"===e.attributeName};b(e,g,{getResizeValue:y,observeIntersection:!0,observeDirectChildrenResize:!0,targetMutation:{options:{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0},shouldApply:function(t){return function(e,t){return e.some((function(e){return"attributes"===e.type&&t(e)}))}(t,(function(t){return t.target===e&&n(t)}))}},directChildMutation:{attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0,shouldApply:n}})}});var N=["gap","columnGap","rowGap","contentMinWidth","revert","sidebar","sidebarWidth","alignItems","overflow","divider","style"];function V(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?V(Object(n),!0).forEach((function(t){I(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}exports.WithSidebar=function(t){var n=t.gap,r=t.columnGap,i=t.rowGap,o=t.contentMinWidth,l=t.revert,u=t.sidebar,a=t.sidebarWidth,c=t.alignItems,d=t.overflow,s=t.divider,f=t.style,v=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,N);return f=L(L({},f),{},{"--unitone--sidebar-width":""!==a?a:void 0,"--unitone--content-min-width":""!==o?o:void 0}),e.createElement("div",z({"data-unitone-layout":["with-sidebar",l?"-revert":void 0,""!==(null!=n?n:"")?"-gap:".concat(n):void 0,""!==(null!=r?r:"")?"-column-gap:".concat(r):void 0,""!==(null!=i?i:"")?"-row-gap:".concat(i):void 0,""!==(null!=u?u:"")?"-sidebar:".concat(u):void 0,""!==(null!=c?c:"")?"-align-items:".concat(c):void 0,""!==(null!=d?d:"")?"-overflow:".concat(d):void 0,""!==(null!=s?s:"")?"-divider:".concat(s):void 0].filter(Boolean).join(" "),style:f},v),v.children)};
|
package/dist/library.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(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 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,n){if(e){if("string"==typeof e)return t(e,n);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?t(e,n):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 n(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={}.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){n&&(t=n);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 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,i=Array(e);n<e;n++)i[n]=t[n];return i}var r="data-unitone-layout",o=function(t){var e;return(null!==(e=t.getAttribute(r))&&void 0!==e?e:"").split(/\s+/).filter(Boolean)},u=function(t,e){return t.filter((function(t){return!e.includes(t)}))},a=function(t,e){var n,i=e.filter(Boolean).join(" ");(null!==(n=t.getAttribute(r))&&void 0!==n?n:"")!==i&&t.setAttribute(r,i)},l=function(t,e){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.getValue,u=r.delay,a=void 0===u?250:u;e(t);var l=!0,s=new ResizeObserver(f((function(t){var r,u=n(t);try{for(u.s();!(r=u.n()).done;){var a=r.value,s=null==o?void 0:o(a);l?(i=s,l=!1):void 0!==s&&s===i||(e(a.target,a),i=s)}}catch(t){u.e(t)}finally{u.f()}}),a));return s.observe(t),s},s=function(t,e,n){var i=new MutationObserver((function(e){requestAnimationFrame((function(){null!=t&&t.isConnected&&n(e)}))}));return i.observe(t,e),i},d=function(t){var e;return null===(e=t.borderBoxSize)||void 0===e?void 0:e[0].inlineSize},c=function(t){var e;return parseInt(null===(e=t.contentRect)||void 0===e?void 0:e.width)},v=function(t){return!(null==t||!t.isConnected)&&0<t.getClientRects().length};function f(t,e){var n;return function(){for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];var u=this;clearTimeout(n),n=setTimeout((function(){t.apply(u,r)}),e)}}var p=function(t){var n,i=Array.from(null!==(n=null==t?void 0:t.children)&&void 0!==n?n:[]),r=i[0];if(r){var l=u(o(t),["divider:initialized","-stack"]);a(t,l);var s=new Map;if(i.forEach((function(t){var e=u(o(t),["-bol","-linewrap"]);s.set(t,e),a(t,e)})),v(t)){var d,c=r.getBoundingClientRect(),f=i.reduce((function(t,e){var n,i=window.getComputedStyle(e).getPropertyValue("position"),r=window.getComputedStyle(e).getPropertyValue("display");"absolute"!==i&&"fixed"!==i&&"none"!==r&&t.push({child:e,layoutTokens:null!==(n=s.get(e))&&void 0!==n?n:[],rect:e.getBoundingClientRect()});return t}),[]);f.map((function(t,n){var i,r,o=t.child,u=t.layoutTokens,a=t.rect,l=e(u);return(0===n||(null===(i=d)||void 0===i?void 0:i.top)<a.top&&(null===(r=d)||void 0===r?void 0:r.left)>=a.left)&&l.push("-bol"),0<n&&c.top<a.top&&l.push("-linewrap"),d=a,{child:o,layoutTokens:l}})).forEach((function(t){var e=t.child,n=t.layoutTokens;a(e,n)}));var p=f.every((function(t){return t.rect.left===c.left})),y=e(l);p&&y.push("-stack"),y.push("divider:initialized"),a(t,y)}}},y=function(t){var n,i,r=Array.from(t.children),l=u(o(t),["stairs:initialized"]);a(t,l);var s=r[0];if(s){if(t.style.removeProperty("--unitone--stairs-step-overflow-volume"),t.style.removeProperty("--unitone--max-stairs-step"),r.forEach((function(t){t.style.removeProperty("--unitone--stairs-step")})),v(t)){var d,c=null===(n=(null!==(i=t.getAttribute("data-unitone-layout"))&&void 0!==i?i:"").split(/\s+/).find((function(t){return t.startsWith("-stairs-up:")})))||void 0===n?void 0:n.replace("-stairs-up:",""),f=["up-down","down-up"].includes(c),p=window.getComputedStyle(t).getPropertyValue("flex-direction"),y=t.getBoundingClientRect().bottom,g=r.reduce((function(t,e){var n=window.getComputedStyle(e).getPropertyValue("position"),i=window.getComputedStyle(e).getPropertyValue("display");return"absolute"===n||"fixed"===n||"none"===i||t.push({child:e,rect:e.getBoundingClientRect()}),t}),[]),m=0,h=m;g.map((function(t,e){var n,i,r=t.child,o=t.rect,u="row-reverse"===p?(null===(n=d)||void 0===n?void 0:n.left)<=o.left:(null===(i=d)||void 0===i?void 0:i.left)>=o.left;return 0===e||s===r&&!d||u?m=0:f?m=0===m?1:0:m++,d=o,m>h&&(h=m),{child:r,stairsStep:m}})).forEach((function(t){var e=t.child,n=t.stairsStep;e.style.setProperty("--unitone--stairs-step",n)})),t.style.setProperty("--unitone--max-stairs-step",h);var b=g.reduce((function(t,e){var n=e.child.getBoundingClientRect().bottom-y;return t>n?t:n}),0);t.style.setProperty("--unitone--stairs-step-overflow-volume",b),a(t,[].concat(e(l),["stairs:initialized"]))}}else a(t,[].concat(e(l),["stairs:initialized"]))},g=function(t){var e;if(t){var n,i=(null!==(e=t.getAttribute("data-unitone-layout"))&&void 0!==e?e:"").split(/\s+/);if(i.some((function(t){return["vertical-writing:initialized","vertical-writing:safari","-force-switch"].includes(t)}))&&(i=i.filter((function(t){return!["vertical-writing:initialized","vertical-writing:safari","-force-switch"].includes(t)})),t.setAttribute("data-unitone-layout",i.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)return i.push("vertical-writing:initialized"),void t.setAttribute("data-unitone-layout",i.join(" "));var r=getComputedStyle(t),o=String(r.getPropertyValue("--unitone--threshold")).trim(),u=!1;setTimeout((function(){if(null!=t&&t.isConnected){if(o){var e=document.createElement("div");e.setAttribute("data-unitone-layout","vertical-writing__thresholder"),t.appendChild(e),u=e.offsetWidth>=t.offsetWidth,e.parentNode&&e.parentNode.removeChild(e)}var r;if(u)i.push("-force-switch"),null!==(r=t.parentNode)&&void 0!==r&&r.style&&(t.parentNode.style.height="");else t.getBoundingClientRect().left>n.getBoundingClientRect().left&&i.push("vertical-writing:safari"),t.setAttribute("data-unitone-layout",i.join(" ")),requestAnimationFrame((function(){if(null!=t&&t.isConnected){var e,i=t.getBoundingClientRect(),r=n.getBoundingClientRect(),o=i.top+i.height,u=r.top+r.height;if(o!==u)null!==(e=t.parentNode)&&void 0!==e&&e.style&&(t.parentNode.style.height="".concat(Math.ceil(u-i.top),"px"))}}));i.push("vertical-writing:initialized"),t.setAttribute("data-unitone-layout",i.join(" "))}}),250)}},m=function(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(e.fontSize);n!==parseFloat(e.getPropertyValue("--unitone--result--1em-px"))&&t.style.setProperty("--unitone--result--1em-px",n)},h=function(t){var e,n=function(){return t.querySelectorAll(':scope > [data-unitone-layout~="marquee"]')},i=n();if(0!==i.length){if(1===t.childElementCount&&1===i.length){var r=i[0];(e=r.cloneNode(!0)).setAttribute("aria-hidden","true"),r.after(e)}return(i=n()).forEach((function(t){var e,n,i;i=(null!==(n=(e=t).getAttribute("data-unitone-layout"))&&void 0!==n?n:"").split(/\s+/).filter((function(t){return t&&"marquee:initialized"!==t})).join(" "),e.setAttribute("data-unitone-layout",i)})),requestAnimationFrame((function(){null!=t&&t.isConnected&&n().forEach((function(t){var e,n,i;(i=null!==(n=(e=t).getAttribute("data-unitone-layout"))&&void 0!==n?n:"").split(/\s+/).includes("marquee:initialized")||e.setAttribute("data-unitone-layout","".concat(i," marquee:initialized").trim())}))})),e}};exports.debounce=f,exports.dividersResizeObserver=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{resizeObserver:l(t,p,{getValue:d}),mutationObserver:s(t,{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0,subtree:!0,characterData:!0},(function(r){var o,u=n(r);try{var a=function(){var n=o.value;if("attributes"===n.type&&"data-unitone-layout"===n.attributeName){var r,u,a,l,s=[].concat(e(null!==(r=null==i||null===(u=i.ignore)||void 0===u?void 0:u.layout)&&void 0!==r?r:[]),["divider:initialized","-bol","-linewrap","-stack"]);(null!==(a=n.target.getAttribute(n.attributeName))&&void 0!==a?a:"").split(" ").filter((function(t){return!s.includes(t)})).join(" ")!==(null!==(l=n.oldValue)&&void 0!==l?l:"").split(" ").filter((function(t){return!s.includes(t)})).join(" ")&&p(t)}else if("attributes"===n.type&&"class"===n.attributeName){var d,c,v,f,y=e(null!==(d=null==i||null===(c=i.ignore)||void 0===c?void 0:c.className)&&void 0!==d?d:[]);(null!==(v=n.target.getAttribute(n.attributeName))&&void 0!==v?v:"").split(" ").filter((function(t){return!y.includes(t)})).join(" ")!==(null!==(f=n.oldValue)&&void 0!==f?f:"").split(" ").filter((function(t){return!y.includes(t)})).join(" ")&&p(t)}else"attributes"===n.type&&"style"===n.attributeName&&p(t)};for(u.s();!(o=u.n()).done;)a()}catch(t){u.e(t)}finally{u.f()}}))}},exports.marqueeResizeObserver=function(t){var e,n=function(t){e=h(t)};return{resizeObserver:l(t,n,{getValue:c}),mutationObserver:s(t,{childList:!0},(function(i){var r;if(null!=t&&t.isConnected){var o=i.flatMap((function(t){var e;return Array.from(null!==(e=t.addedNodes)&&void 0!==e?e:[])})),u=i.flatMap((function(t){var e;return Array.from(null!==(e=t.removedNodes)&&void 0!==e?e:[])}));null!==(r=e)&&void 0!==r&&r.isConnected&&1===o.length&&0===u.length&&o[0]===e?e=null:(e=null,n(t))}}))}},exports.result1emPxForFireFoxObserver=function(t){var e=t.ownerDocument;if(e.defaultView.getComputedStyle(e.documentElement).getPropertyValue("--unitone--is-firefox").trim()){return{resizeObserver:l(t,m,{getValue:d}),mutationObserver:s(t,{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],characterData:!0},(function(){m(t)}))}}},exports.setColumnCountForVertical=g,exports.setDividerLinewrap=p,exports.setMarquee=h,exports.setResult1emPxForFireFox=m,exports.setStairsStep=y,exports.stairsResizeObserver=function(t){return l(t,y)},exports.verticalsResizeObserver=function(t){var e=0,i=new ResizeObserver(f((function(t){var i,r=n(t);try{for(r.s();!(i=r.n()).done;){var o,u=i.value,a=null===(o=u.contentRect)||void 0===o?void 0:o.width;parseInt(a)!==parseInt(e)&&(e=a,u.target.parentNode.style.height="",g(u.target))}}catch(t){r.e(t)}finally{r.f()}}),250));i.observe(t);var r=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],u=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==u?void 0:u.nodeType)===Node.ELEMENT_NODE&&"vertical-writing__thresholder"===u.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===o.getAttribute("data-unitone-layout")||(null==u?void 0:u.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:initialized"===u.getAttribute("data-unitone-layout")||(null==o?void 0:o.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===o.getAttribute("data-unitone-layout")||(null==u?void 0:u.nodeType)===Node.ELEMENT_NODE&&"vertical-writing:safari"===u.getAttribute("data-unitone-layout"))return;g(t)}}))}));return r.observe(t,{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0}),{resizeObserver:i,mutationObserver:r}};
|
|
1
|
+
"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function e(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function n(n){return function(e){if(Array.isArray(e))return t(e)}(n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(n)||e(n)||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,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,u,l=[],a=!0,s=!1;try{if(o=(n=n.call(t)).next,0===e);else for(;!(a=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{if(!a&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(s)throw i}}return l}}(t,n)||e(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}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 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 r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}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,l=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return l=t.done,t},e:function(t){a=!0,u=t},f:function(){try{l||null==n.return||n.return()}finally{if(a)throw u}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var u="data-unitone-layout",l="".concat(200,"px 0px"),a=function(t){var e;return(null!==(e=t.getAttribute(u))&&void 0!==e?e:"").split(/\s+/).filter(Boolean)},s=function(t,e){return t.filter((function(t){return!e.includes(t)}))},c=function(t,e){var n,r=e.filter(Boolean).join(" ");(null!==(n=t.getAttribute(u))&&void 0!==n?n:"")!==r&&t.setAttribute(u,r)},d=function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=r.getValue,u=r.delay,l=!0,a=new ResizeObserver(m((function(t){var r,u=i(t);try{for(u.s();!(r=u.n()).done;){var a=r.value,s=null==o?void 0:o(a);l?(n=s,l=!1):void 0!==s&&s===n||(e(a.target,a),n=s)}}catch(t){u.e(t)}finally{u.f()}}),void 0===u?250:u));return a.observe(t),a},f=function(t,e,n){var r=new MutationObserver((function(e){requestAnimationFrame((function(){null!=t&&t.isConnected&&n(e)}))}));return r.observe(t,e),r},v=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.getResizeValue,u=n.delay,a=void 0===u?250:u,s=n.observeResize,c=void 0===s||s,v=n.observeIntersection,p=void 0!==v&&v,y=n.observeDirectChildrenResize,h=void 0!==y&&y,b=n.targetMutation,w=n.directChildMutation,A=p&&"undefined"!=typeof IntersectionObserver,C=!A||g(t),z=A&&!C,S=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t;null!=n&&n.isConnected&&(!A||C?(z=!1,e(n)):z=!0)},x=function(t,e){var n,r=0;return function(){var i,o;null!==(o=n=null==t||null===(i=t.ownerDocument)||void 0===i?void 0:i.defaultView)&&void 0!==o&&o.requestAnimationFrame?r||(r=n.requestAnimationFrame((function(){r=0,n=null,null!=t&&t.isConnected&&e(t)}))):e(t)}}(t,S),V=function(){null!=t&&t.isConnected&&(!A||C?(z=!0,x()):z=!0)},O=function(){},R=c?h?function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getValue,o=n.delay,u=void 0===o?250:o,l=n.onChildList,a=new WeakMap,s=new Set,c=new ResizeObserver(m((function(n){var o,u=!1,l=i(n);try{for(l.s();!(o=l.n()).done;){var s=o.value,c=null==r?void 0:r(s);a.has(s.target)?(void 0!==c&&c===a.get(s.target)||(u=!0),a.set(s.target,c)):a.set(s.target,c)}}catch(t){l.e(t)}finally{l.f()}u&&e(t)}),u)),d=function(){var e;Array.from(s).forEach((function(e){e.parentElement!==t&&(c.unobserve(e),s.delete(e),a.delete(e))})),Array.from(null!==(e=null==t?void 0:t.children)&&void 0!==e?e:[]).forEach((function(t){s.has(t)||(c.observe(t),s.add(t))}))};c.observe(t),d();var v=f(t,{childList:!0},(function(n){n.some((function(t){return"childList"===t.type}))&&(d(),null==l||l(n),e(t))}));return{resizeObserver:c,mutationObserver:v}}(t,V,{getValue:o,delay:a,onChildList:function(){O()}}):{resizeObserver:d(t,V,{getValue:o,delay:a})}:{mutationObserver:null};A&&function(t,e){var n=new IntersectionObserver((function(t){var n=r(t,1)[0];n&&e(n)}),{rootMargin:l});n.observe(t)}(t,(function(t){(C=t.isIntersecting)&&z&&V()})),null!=b&&b.options&&f(t,b.options,(function(t){var e,n;(null!==(e=null===(n=b.shouldApply)||void 0===n?void 0:n.call(b,t))&&void 0!==e?e:0<t.length)&&V()}));var F=null!=w&&w.attributeFilter&&w.shouldApply?function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.attributeFilter,i=n.shouldApply,o=n.attributeOldValue,u=void 0===o||o,l=new MutationObserver((function(n){requestAnimationFrame((function(){null!=t&&t.isConnected&&n.some((function(e){return"attributes"===e.type&&e.target.parentElement===t&&i(e)}))&&e(t)}))})),a=function(){var e;l.disconnect(),Array.from(null!==(e=null==t?void 0:t.children)&&void 0!==e?e:[]).forEach((function(t){l.observe(t,{attributes:!0,attributeFilter:r,attributeOldValue:u})}))};return a(),{observer:l,syncObservedChildren:a}}(t,V,{attributeFilter:w.attributeFilter,shouldApply:w.shouldApply,attributeOldValue:w.attributeOldValue}):null;F&&(O=F.syncObservedChildren),!R.mutationObserver&&F&&f(t,{childList:!0},(function(t){t.some((function(t){return"childList"===t.type}))&&(O(),V())})),A&&!C||S(t)},p=function(t){var e;return null===(e=t.borderBoxSize)||void 0===e?void 0:e[0].inlineSize},y=function(t){var e;return parseInt(null===(e=t.contentRect)||void 0===e?void 0:e.width)},h=function(t){return!(null==t||!t.isConnected)&&0<t.getClientRects().length},g=function(t){var e;if(!h(t))return!1;var n=null==t||null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView;if(!n)return!0;var r=t.getBoundingClientRect(),i=n.innerWidth,o=n.innerHeight;return r.bottom>-200&&r.right>0&&r.top<o+200&&r.left<i};function m(t,e){var n;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var u=this;clearTimeout(n),n=setTimeout((function(){t.apply(u,i)}),e)}}var b=function(t){var e,r=Array.from(null!==(e=null==t?void 0:t.children)&&void 0!==e?e:[]),i=r[0];if(i){var o=s(a(t),["divider:initialized","-stack"]);c(t,o);var u=new Map;if(r.forEach((function(t){var e=s(a(t),["-bol","-linewrap"]);u.set(t,e),c(t,e)})),h(t)){var l,d=i.getBoundingClientRect(),f=r.reduce((function(t,e){var n,r=window.getComputedStyle(e).getPropertyValue("position"),i=window.getComputedStyle(e).getPropertyValue("display");"absolute"!==r&&"fixed"!==r&&"none"!==i&&t.push({child:e,layoutTokens:null!==(n=u.get(e))&&void 0!==n?n:[],rect:e.getBoundingClientRect()});return t}),[]);f.map((function(t,e){var r,i,o=t.child,u=t.layoutTokens,a=t.rect,s=n(u);return(0===e||(null===(r=l)||void 0===r?void 0:r.top)<a.top&&(null===(i=l)||void 0===i?void 0:i.left)>=a.left)&&s.push("-bol"),0<e&&d.top<a.top&&s.push("-linewrap"),l=a,{child:o,layoutTokens:s}})).forEach((function(t){var e=t.child,n=t.layoutTokens;c(e,n)}));var v=f.every((function(t){return t.rect.left===d.left})),p=n(o);v&&p.push("-stack"),p.push("divider:initialized"),c(t,p)}}},w=function(t){var e,r,i=Array.from(t.children),o=s(a(t),["stairs:initialized"]);c(t,o);var u=i[0];if(u){if(t.style.removeProperty("--unitone--stairs-step-overflow-volume"),t.style.removeProperty("--unitone--max-stairs-step"),i.forEach((function(t){t.style.removeProperty("--unitone--stairs-step")})),h(t)){var l,d=null===(e=(null!==(r=t.getAttribute("data-unitone-layout"))&&void 0!==r?r:"").split(/\s+/).find((function(t){return t.startsWith("-stairs-up:")})))||void 0===e?void 0:e.replace("-stairs-up:",""),f=["up-down","down-up"].includes(d),v=window.getComputedStyle(t).getPropertyValue("flex-direction"),p=t.getBoundingClientRect().bottom,y=i.reduce((function(t,e){var n=window.getComputedStyle(e).getPropertyValue("position"),r=window.getComputedStyle(e).getPropertyValue("display");return"absolute"===n||"fixed"===n||"none"===r||t.push({child:e,rect:e.getBoundingClientRect()}),t}),[]),g=0,m=g;y.map((function(t,e){var n,r,i=t.child,o=t.rect,a="row-reverse"===v?(null===(n=l)||void 0===n?void 0:n.left)<=o.left:(null===(r=l)||void 0===r?void 0:r.left)>=o.left;return 0===e||u===i&&!l||a?g=0:f?g=0===g?1:0:g++,l=o,g>m&&(m=g),{child:i,stairsStep:g}})).forEach((function(t){var e=t.child,n=t.stairsStep;e.style.setProperty("--unitone--stairs-step",n)})),t.style.setProperty("--unitone--max-stairs-step",m);var b=y.reduce((function(t,e){var n=e.child.getBoundingClientRect().bottom-p;return t>n?t:n}),0);t.style.setProperty("--unitone--stairs-step-overflow-volume",b),c(t,[].concat(n(o),["stairs:initialized"]))}}else c(t,[].concat(n(o),["stairs:initialized"]))},A=function(t){return t.some((function(t){return"attributes"===t.type||"childList"===t.type&&[].concat(n(t.addedNodes),n(t.removedNodes)).some((function(t){return!function(t){return(null==t?void 0:t.nodeType)===Node.ELEMENT_NODE&&["vertical-writing__thresholder","vertical-writing:initialized","vertical-writing:safari"].includes(t.getAttribute("data-unitone-layout"))}(t)}))}))},C=function(t){if(t){var e,r=a(t),i=s(r,["vertical-writing:safari","-force-switch"]),o=s(r,["vertical-writing:initialized","vertical-writing:safari","-force-switch"]);if(c(t,i),Array.from(t.children).reverse().some((function(t){if(!["absolute","fixed"].includes(getComputedStyle(t).position)&&"none"!==getComputedStyle(t).display)return e=t,!0})),e){var l=getComputedStyle(t),d=String(l.getPropertyValue("--unitone--threshold")).trim(),f=!1;if(d){var v=t.ownerDocument.createElement("div");v.setAttribute(u,"vertical-writing__thresholder"),t.appendChild(v),f=v.offsetWidth>=t.offsetWidth,v.remove()}if(f)o.push("-force-switch");else t.getBoundingClientRect().left>e.getBoundingClientRect().left&&o.push("vertical-writing:safari");c(t,[].concat(n(o),["vertical-writing:initialized"])),requestAnimationFrame((function(){var n;if(null!=t&&t.isConnected&&null!==(n=t.parentNode)&&void 0!==n&&n.style){if(f)return void(t.parentNode.style.height="");var r=t.getBoundingClientRect(),i=e.getBoundingClientRect(),o=r.top+r.height,u=i.top+i.height;t.parentNode.style.height=o!==u?"".concat(Math.ceil(u-r.top),"px"):""}}))}else c(t,[].concat(n(o),["vertical-writing:initialized"]))}},z=function(t){var e=t.ownerDocument.defaultView.getComputedStyle(t),n=parseFloat(e.fontSize);n!==parseFloat(e.getPropertyValue("--unitone--result--1em-px"))&&t.style.setProperty("--unitone--result--1em-px",n)},S=function(t){var e,n=function(t){var e,n=null!==(e=t.getAttribute("data-unitone-layout"))&&void 0!==e?e:"";n.split(/\s+/).includes("marquee:initialized")||t.setAttribute("data-unitone-layout","".concat(n," marquee:initialized").trim())},r=function(){return t.querySelectorAll(':scope > [data-unitone-layout~="marquee"]')},i=r();if(0!==i.length){var o=Array.from(i).some((function(t){var e;return(null!==(e=t.getAttribute(u))&&void 0!==e?e:"").split(/\s+/).includes("marquee:initialized")}));if(1===t.childElementCount&&1===i.length){var l=i[0];(e=l.cloneNode(!0)).setAttribute("aria-hidden","true"),l.after(e)}return i=r(),o?(i.forEach((function(t){var e,n,r;r=(null!==(n=(e=t).getAttribute("data-unitone-layout"))&&void 0!==n?n:"").split(/\s+/).filter((function(t){return t&&"marquee:initialized"!==t})).join(" "),e.setAttribute("data-unitone-layout",r)})),requestAnimationFrame((function(){null!=t&&t.isConnected&&r().forEach((function(t){n(t)}))})),e):(i.forEach((function(t){n(t)})),e)}};exports.debounce=m,exports.dividersResizeObserver=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=function(t){if("data-unitone-layout"===t.attributeName){var r,i,o,u,l=[].concat(n(null!==(r=null==e||null===(i=e.ignore)||void 0===i?void 0:i.layout)&&void 0!==r?r:[]),["divider:initialized","-bol","-linewrap","-stack"]);return(null!==(o=t.target.getAttribute(t.attributeName))&&void 0!==o?o:"").split(" ").filter((function(t){return!l.includes(t)})).join(" ")!==(null!==(u=t.oldValue)&&void 0!==u?u:"").split(" ").filter((function(t){return!l.includes(t)})).join(" ")}if("class"===t.attributeName){var a,s,c,d,f=n(null!==(a=null==e||null===(s=e.ignore)||void 0===s?void 0:s.className)&&void 0!==a?a:[]);return(null!==(c=t.target.getAttribute(t.attributeName))&&void 0!==c?c:"").split(" ").filter((function(t){return!f.includes(t)})).join(" ")!==(null!==(d=t.oldValue)&&void 0!==d?d:"").split(" ").filter((function(t){return!f.includes(t)})).join(" ")}return"style"===t.attributeName};v(t,b,{getResizeValue:p,observeIntersection:!0,observeDirectChildrenResize:!0,targetMutation:{options:{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0},shouldApply:function(e){return function(t,e){return t.some((function(t){return"attributes"===t.type&&e(t)}))}(e,(function(e){return e.target===t&&r(e)}))}},directChildMutation:{attributeFilter:["style","data-unitone-layout","class"],attributeOldValue:!0,shouldApply:r}})},exports.marqueeResizeObserver=function(t){var e;v(t,(function(t){e=S(t)}),{observeResize:!1,observeIntersection:!0,targetMutation:{options:{childList:!0},shouldApply:function(t){var n,r=t.flatMap((function(t){var e;return Array.from(null!==(e=t.addedNodes)&&void 0!==e?e:[])})),i=t.flatMap((function(t){var e;return Array.from(null!==(e=t.removedNodes)&&void 0!==e?e:[])}));return null!==(n=e)&&void 0!==n&&n.isConnected&&1===r.length&&0===i.length&&r[0]===e?(e=null,!1):(e=null,!0)}}})},exports.result1emPxForFireFoxObserver=function(t){var e=t.ownerDocument;e.defaultView.getComputedStyle(e.documentElement).getPropertyValue("--unitone--is-firefox").trim()&&v(t,z,{getResizeValue:p,targetMutation:{options:{attributes:!0,attributeFilter:["style","data-unitone-layout","class"],characterData:!0},shouldApply:function(){return!0}}})},exports.setColumnCountForVertical=C,exports.setDividerLinewrap=b,exports.setMarquee=S,exports.setResult1emPxForFireFox=z,exports.setStairsStep=w,exports.stairsResizeObserver=function(t){v(t,w,{observeIntersection:!0,observeDirectChildrenResize:!0})},exports.verticalsResizeObserver=function(t){v(t,(function(t){var e;null!==(e=t.parentNode)&&void 0!==e&&e.style&&(t.parentNode.style.height=""),C(t)}),{getResizeValue:y,observeIntersection:!0,targetMutation:{options:{attributes:!0,attributeFilter:["style"],childList:!0,subtree:!0},shouldApply:A}})};
|
package/package.json
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inc2734/unitone-css",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.10.0",
|
|
7
7
|
"npm": ">=10.2.3"
|
|
8
8
|
},
|
|
9
9
|
"volta": {
|
|
10
|
-
|
|
10
|
+
"node": "24.14.1"
|
|
11
11
|
},
|
|
12
|
-
"main": "dist/index.js",
|
|
13
12
|
"exports": {
|
|
14
|
-
".": "./dist/index.js",
|
|
15
13
|
"./app": "./dist/app.js",
|
|
16
|
-
"./library": "./dist/library.js"
|
|
14
|
+
"./library": "./dist/library.js",
|
|
15
|
+
"./layout-primitives": "./dist/layout-primitives/index.js",
|
|
16
|
+
"./layout-primitives/*/react": "./dist/layout-primitives/*/react.js",
|
|
17
|
+
"./layout-primitives/*/behavior": "./dist/layout-primitives/*/behavior.js",
|
|
18
|
+
"./behaviors": "./dist/behaviors/index.js",
|
|
19
|
+
"./behaviors/*": "./dist/behaviors/*.js",
|
|
20
|
+
"./compatibility": "./dist/compatibility/index.js",
|
|
21
|
+
"./compatibility/*": "./dist/compatibility/*.js"
|
|
17
22
|
},
|
|
18
23
|
"license": "MIT",
|
|
19
24
|
"repository": {
|
|
@@ -41,28 +46,28 @@
|
|
|
41
46
|
"format": "run-p format:*"
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|
|
44
|
-
"@babel/core": "^7.
|
|
45
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
46
|
-
"@babel/preset-env": "^7.
|
|
49
|
+
"@babel/core": "^7.29.0",
|
|
50
|
+
"@babel/plugin-transform-runtime": "^7.29.0",
|
|
51
|
+
"@babel/preset-env": "^7.29.2",
|
|
47
52
|
"@babel/preset-react": "^7.28.5",
|
|
48
|
-
"@rollup/plugin-babel": "^
|
|
49
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
53
|
+
"@rollup/plugin-babel": "^7.0.0",
|
|
54
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
50
55
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
51
|
-
"@rollup/plugin-terser": "^0.
|
|
52
|
-
"autoprefixer": "^10.4.
|
|
53
|
-
"babel-loader": "^10.
|
|
54
|
-
"cssnano": "^7.1.
|
|
56
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
57
|
+
"autoprefixer": "^10.4.27",
|
|
58
|
+
"babel-loader": "^10.1.1",
|
|
59
|
+
"cssnano": "^7.1.4",
|
|
55
60
|
"npm-run-all": "^4.1.5",
|
|
56
|
-
"postcss": "^8.5.
|
|
61
|
+
"postcss": "^8.5.8",
|
|
57
62
|
"postcss-cli": "^11.0.1",
|
|
58
63
|
"postcss-import": "^16.1.1",
|
|
59
64
|
"react": "^19.2.4",
|
|
60
65
|
"react-dom": "^19.2.4",
|
|
61
|
-
"react-syntax-highlighter": "^16.1.
|
|
66
|
+
"react-syntax-highlighter": "^16.1.1",
|
|
62
67
|
"remark-gfm": "^4.0.1",
|
|
63
|
-
"rimraf": "^6.1.
|
|
64
|
-
"rollup": "^4.
|
|
65
|
-
"sass": "^1.
|
|
68
|
+
"rimraf": "^6.1.3",
|
|
69
|
+
"rollup": "^4.60.1",
|
|
70
|
+
"sass": "^1.99.0"
|
|
66
71
|
},
|
|
67
72
|
"workspaces": [
|
|
68
73
|
"website"
|
package/src/app.js
CHANGED
|
@@ -1,110 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
verticalsResizeObserver,
|
|
5
|
-
result1emPxForFireFoxObserver,
|
|
6
|
-
marqueeResizeObserver,
|
|
7
|
-
} from '@inc2734/unitone-css/library';
|
|
8
|
-
|
|
9
|
-
const createInitializer = ({ selector, initialize, enabled = () => true }) => {
|
|
10
|
-
const initialized = new WeakSet();
|
|
11
|
-
|
|
12
|
-
return (root) => {
|
|
13
|
-
if (!enabled() || root?.nodeType !== Node.ELEMENT_NODE) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const targets = new Set();
|
|
18
|
-
|
|
19
|
-
if (root.matches?.(selector)) {
|
|
20
|
-
targets.add(root);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
root.querySelectorAll?.(selector).forEach((target) => {
|
|
24
|
-
targets.add(target);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
targets.forEach((target) => {
|
|
28
|
-
if (initialized.has(target)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
initialize(target);
|
|
33
|
-
initialized.add(target);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const initializeLayouts = () => {
|
|
39
|
-
const computedStyle = window.getComputedStyle(document.documentElement);
|
|
40
|
-
const isFirefox = !!computedStyle.getPropertyValue('--unitone--is-firefox').trim();
|
|
41
|
-
|
|
42
|
-
const initializers = [
|
|
43
|
-
createInitializer({
|
|
44
|
-
selector: '[data-unitone-layout*="-divider:"]',
|
|
45
|
-
initialize: dividersResizeObserver,
|
|
46
|
-
}),
|
|
47
|
-
createInitializer({
|
|
48
|
-
selector: '[data-unitone-layout*="-stairs:"]',
|
|
49
|
-
initialize: stairsResizeObserver,
|
|
50
|
-
}),
|
|
51
|
-
createInitializer({
|
|
52
|
-
selector: '[data-unitone-layout~="vertical-writing"]',
|
|
53
|
-
initialize: verticalsResizeObserver,
|
|
54
|
-
}),
|
|
55
|
-
createInitializer({
|
|
56
|
-
selector: '[style*="font-size:"], [data-unitone-layout~="-fluid-typography"]',
|
|
57
|
-
initialize: result1emPxForFireFoxObserver,
|
|
58
|
-
enabled: () => isFirefox,
|
|
59
|
-
}),
|
|
60
|
-
createInitializer({
|
|
61
|
-
selector: '[data-unitone-layout~="marquee-wrapper"]',
|
|
62
|
-
initialize: marqueeResizeObserver,
|
|
63
|
-
}),
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
const initializeNode = (node) => {
|
|
67
|
-
initializers.forEach((initialize) => {
|
|
68
|
-
initialize(node);
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
initializeNode(document.body);
|
|
73
|
-
|
|
74
|
-
const pendingNodes = new Set();
|
|
75
|
-
let rafId = 0;
|
|
76
|
-
|
|
77
|
-
const flushPendingNodes = () => {
|
|
78
|
-
pendingNodes.forEach((node) => {
|
|
79
|
-
initializeNode(node);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
pendingNodes.clear();
|
|
83
|
-
rafId = 0;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const observer = new MutationObserver((entries) => {
|
|
87
|
-
for (const entry of entries) {
|
|
88
|
-
entry.addedNodes.forEach((addedNode) => {
|
|
89
|
-
if (addedNode?.nodeType === Node.ELEMENT_NODE) {
|
|
90
|
-
pendingNodes.add(addedNode);
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (!rafId && 0 < pendingNodes.size) {
|
|
96
|
-
rafId = requestAnimationFrame(flushPendingNodes);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
observer.observe(document.body, {
|
|
101
|
-
childList: true,
|
|
102
|
-
subtree: true,
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
if ('loading' === document.readyState) {
|
|
107
|
-
document.addEventListener('DOMContentLoaded', initializeLayouts, { once: true });
|
|
108
|
-
} else {
|
|
109
|
-
initializeLayouts();
|
|
110
|
-
}
|
|
1
|
+
import './layout-primitives';
|
|
2
|
+
import './behaviors';
|
|
3
|
+
import './compatibility';
|
package/src/app.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use "sass:meta";
|
|
2
|
-
@use 'settings
|
|
2
|
+
@use 'settings';
|
|
3
3
|
|
|
4
|
-
@include meta.load-css("foundation
|
|
5
|
-
@include meta.load-css("layout-primitives
|
|
6
|
-
@include meta.load-css("
|
|
4
|
+
@include meta.load-css("foundation");
|
|
5
|
+
@include meta.load-css("layout-primitives");
|
|
6
|
+
@include meta.load-css("behaviors");
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
@use './align-content';
|
|
2
|
+
@use './align-items';
|
|
3
|
+
@use './align-self';
|
|
4
|
+
@use './align';
|
|
5
|
+
@use './auto-repeat';
|
|
6
|
+
@use './auto-phrase';
|
|
7
|
+
@use './background-clip';
|
|
8
|
+
@use './gap';
|
|
9
|
+
@use './gutters';
|
|
10
|
+
@use './justify-content';
|
|
11
|
+
@use './justify-items';
|
|
12
|
+
@use './justify-self';
|
|
13
|
+
@use './link-decoration';
|
|
14
|
+
@use './mix-blend-mode';
|
|
15
|
+
@use './negative-gap';
|
|
16
|
+
@use './overflow';
|
|
17
|
+
@use './padding';
|
|
18
|
+
@use './position';
|
|
19
|
+
@use './stairs';
|
|
20
|
+
@use './text-orientation';
|
|
21
|
+
@use './typography';
|
|
22
|
+
|
|
23
|
+
@include align-content.align-content();
|
|
24
|
+
@include align-items.align-items();
|
|
25
|
+
@include align-self.align-self();
|
|
26
|
+
@include align.align();
|
|
27
|
+
@include auto-repeat.auto-repeat();
|
|
28
|
+
@include auto-phrase.auto-phrase();
|
|
29
|
+
@include background-clip.background-clip();
|
|
30
|
+
@include gap.gap();
|
|
31
|
+
@include gutters.gutters();
|
|
32
|
+
@include justify-content.justify-content();
|
|
33
|
+
@include justify-items.justify-items();
|
|
34
|
+
@include justify-self.justify-self();
|
|
35
|
+
@include link-decoration.link-decoration();
|
|
36
|
+
@include mix-blend-mode.mix-blend-mode();
|
|
37
|
+
@include negative-gap.negative-gap();
|
|
38
|
+
@include overflow.overflow();
|
|
39
|
+
@include padding.padding();
|
|
40
|
+
@include stairs.stairs();
|
|
41
|
+
@include position.position();
|
|
42
|
+
@include text-orientation.text-orientation();
|
|
43
|
+
@include typography.typography();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { dividersResizeObserver } from '../library';
|
|
2
|
+
import { registerLayoutInitializer } from '../register-layout-initializer';
|
|
3
|
+
|
|
4
|
+
registerLayoutInitializer({
|
|
5
|
+
key: 'behaviors/dividers',
|
|
6
|
+
selector: '[data-unitone-layout*="-divider:"]',
|
|
7
|
+
initialize: dividersResizeObserver,
|
|
8
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { stairsResizeObserver } from '../library';
|
|
2
|
+
import { registerLayoutInitializer } from '../register-layout-initializer';
|
|
3
|
+
|
|
4
|
+
registerLayoutInitializer({
|
|
5
|
+
key: 'behaviors/stairs',
|
|
6
|
+
selector: '[data-unitone-layout*="-stairs:"]',
|
|
7
|
+
initialize: stairsResizeObserver,
|
|
8
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { result1emPxForFireFoxObserver } from '../library';
|
|
2
|
+
import { registerLayoutInitializer } from '../register-layout-initializer';
|
|
3
|
+
|
|
4
|
+
const isFirefox = () => {
|
|
5
|
+
if ('undefined' === typeof window || 'undefined' === typeof document) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const computedStyle = window.getComputedStyle(document.documentElement);
|
|
10
|
+
return !!computedStyle.getPropertyValue('--unitone--is-firefox').trim();
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
registerLayoutInitializer({
|
|
14
|
+
key: 'compatibility/fluid-typography',
|
|
15
|
+
selector: '[style*="font-size:"], [data-unitone-layout~="-fluid-typography"]',
|
|
16
|
+
initialize: result1emPxForFireFoxObserver,
|
|
17
|
+
enabled: isFirefox,
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './fluid-typography';
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@use '../variables' as variables;
|
|
2
|
+
|
|
3
|
+
:where(:not(a):not(b):not(bdi):not(bdo):not(cite):not(data):not(del):not(dfn):not(em):not(i):not(ins):not(mark):not(q):not(ruby):not(s):not(samp):not(small):not(span):not(strong):not(sub):not(sup):not(time):not(u):not(svg)) {
|
|
4
|
+
@include variables.typography();
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
*,
|
|
8
|
+
*::before,
|
|
9
|
+
*::after {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
a {
|
|
14
|
+
text-underline-offset: 0.1em;
|
|
15
|
+
text-decoration-thickness: 1px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:where(
|
|
19
|
+
address,
|
|
20
|
+
article,
|
|
21
|
+
aside,
|
|
22
|
+
blockquote,
|
|
23
|
+
details,
|
|
24
|
+
dialog,
|
|
25
|
+
dd,
|
|
26
|
+
div,
|
|
27
|
+
dl,
|
|
28
|
+
dt,
|
|
29
|
+
fieldset,
|
|
30
|
+
figcaption,
|
|
31
|
+
figure,
|
|
32
|
+
footer,
|
|
33
|
+
form,
|
|
34
|
+
h1,
|
|
35
|
+
h2,
|
|
36
|
+
h3,
|
|
37
|
+
h4,
|
|
38
|
+
h5,
|
|
39
|
+
h6,
|
|
40
|
+
header,
|
|
41
|
+
hgroup,
|
|
42
|
+
hr,
|
|
43
|
+
li,
|
|
44
|
+
main,
|
|
45
|
+
nav,
|
|
46
|
+
ol,
|
|
47
|
+
p,
|
|
48
|
+
pre,
|
|
49
|
+
section,
|
|
50
|
+
table,
|
|
51
|
+
ul
|
|
52
|
+
) {
|
|
53
|
+
margin: 0;
|
|
54
|
+
padding: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:where(li) {
|
|
58
|
+
margin-inline-start: 1.5em;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
small {
|
|
62
|
+
font-size: smaller;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
sup {
|
|
66
|
+
font-size: smaller;
|
|
67
|
+
|
|
68
|
+
@supports (font-variant-position: super) {
|
|
69
|
+
font-variant-position: super;
|
|
70
|
+
vertical-align: baseline;
|
|
71
|
+
font-size: inherit;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
sub {
|
|
76
|
+
font-size: smaller;
|
|
77
|
+
|
|
78
|
+
@supports (font-variant-position: sub) {
|
|
79
|
+
font-variant-position: sub;
|
|
80
|
+
vertical-align: baseline;
|
|
81
|
+
font-size: inherit;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
img,
|
|
86
|
+
video {
|
|
87
|
+
height: auto;
|
|
88
|
+
max-width: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
figure {
|
|
92
|
+
max-width: 100%;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
figcaption {
|
|
96
|
+
--unitone--font-size: -2;
|
|
97
|
+
|
|
98
|
+
margin: var(--unitone--s-2) 0 0;
|
|
99
|
+
display: block;
|
|
100
|
+
width: 0;
|
|
101
|
+
min-width: fit-content !important;
|
|
102
|
+
text-align: start;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
pre {
|
|
106
|
+
text-spacing-trim: space-all;
|
|
107
|
+
}
|