@tsminh/spreacte 0.1.9 → 0.2.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/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=require("react/jsx-runtime"),e=require("react"),t=require("@fluejs/noscroll"),i=require("styled-components"),r=function(){return r=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++)for(var r in e=arguments[t])Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},r.apply(this,arguments)};function o(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}"function"==typeof SuppressedError&&SuppressedError;var a,s,c,d,l=function(){document.documentElement.style.setProperty("--vw","".concat(window.innerWidth,"px")),document.documentElement.style.setProperty("--vh","".concat(window.innerHeight,"px"))},u=Object.freeze({__proto__:null,isDev:function(){return window.location.hostname.includes("localhost")},measureWindowSize:l,numberWithCommas:function(n){void 0===n&&(n=0);var e=n.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),e.join(".")}}),p=e.createContext({ratio:1,imgRootPath:""}),f=function(){return e.useContext(p)},v={mt:["marginTop"],mb:["marginBottom"],ml:["marginLeft"],mr:["marginRight"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],pt:["paddingTop"],pb:["paddingBottom"],pl:["paddingLeft"],pr:["paddingRight"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},h=new Set(["onClick","children","className","style","img","fwidth","safeAreaTop"]),m=new Set(["fwidth","safeAreaTop","img"]),g=function(n){var e=n.img,t=n.imgRootPath;return e?{backgroundImage:e.startsWith("http")?e:"url(".concat([process.env.PUBLIC_URL,t,e].filter(function(n){return!!n}).join("/"),")"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}:void 0},w=i.div(s||(s=o(["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"],["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"])),function(n){var e=n.$open;return i.css(a||(a=o(["\n opacity: ",";\n pointer-events: ",";\n "],["\n opacity: ",";\n pointer-events: ",";\n "])),e?1:0,e?"all":"none")}),x=i.div(d||(d=o(["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"],["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"])),function(n){var e=n.$open;return i.css(c||(c=o(["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "],["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "])),e?1:0,e?"all":"none",e?0:20,e?1:.9)});exports.Box=function(t){var i=f(),o=i.ratio,a=i.imgRootPath,s=e.useMemo(function(){var n;return r({style:r(r(r(r(r(r({},Object.fromEntries(Object.entries(t).filter(function(n){var e=n[0];return!h.has(e)&&"style"!==e}).flatMap(function(n){var e=n[0],t=n[1];return v[e]?v[e].map(function(n){return[n,t*o]}):[[e,t*o]]}))),g({img:t.img,imgRootPath:a})),t.safeAreaTop?{top:"calc(var(--ot) + ".concat((null!==(n=t.top)&&void 0!==n?n:0)*o,"px)")}:void 0),t.fwidth?{width:"var(--vw)"}:void 0),{aspectRatio:t.aspectRatio,pointerEvents:t.onClick||!t.img?"all":"none"}),t.style)},Object.fromEntries(Object.entries(t).filter(function(n){var e=n[0];return h.has(e)&&!m.has(e)}).map(function(n){return[n[0],n[1]]})))},[a,t,o]);return console.log(s),alert(1),n.jsx("div",r({},s))},exports.GlobalContextProvider=function(t){var i=t.children,o=t.width,a=t.imgRootPath,s=void 0===a?"":a,c=function(n){var t=e.useState({width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/n}),i=t[0],r=t[1];return e.useEffect(function(){function e(){r({width:window.screen.availWidth,height:window.screen.availHeight,ratio:window.screen.availWidth/n})}return window.addEventListener("resize",e),e(),function(){return window.removeEventListener("resize",e)}},[n]),i}(o).ratio,d=e.useMemo(function(){return{ratio:c,imgRootPath:s}},[s,c]);return e.useEffect(function(){return l(),window.addEventListener("resize",l),function(){window.removeEventListener("resize",l)}},[]),n.jsx(p.Provider,r({value:d},{children:i}))},exports.Modal=function(i){var o=i.open,a=i.children,s=e.useMemo(function(){return Math.floor(1e3*Math.random())},[]);return e.useEffect(function(){o?t.disablePageScroll():t.enablePageScroll()},[o]),n.jsxs(n.Fragment,{children:[n.jsx(w,{"data-mid":s,$open:o}),n.jsx(x,r({"data-mid":s,$open:o},{children:a}))]})},exports.useGlobalContext=f,exports.utils=u;
|
|
1
|
+
"use strict";var n=require("react/jsx-runtime"),e=require("react"),t=require("@fluejs/noscroll"),i=require("styled-components"),r=function(){return r=Object.assign||function(n){for(var e,t=1,i=arguments.length;t<i;t++)for(var r in e=arguments[t])Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},r.apply(this,arguments)};function o(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}"function"==typeof SuppressedError&&SuppressedError;var a,s,c,d,l=function(){document.documentElement.style.setProperty("--vw","".concat(window.innerWidth,"px")),document.documentElement.style.setProperty("--vh","".concat(window.innerHeight,"px"))},u=Object.freeze({__proto__:null,isDev:function(){return window.location.hostname.includes("localhost")},measureWindowSize:l,numberWithCommas:function(n){void 0===n&&(n=0);var e=n.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),e.join(".")}}),p=e.createContext({ratio:1,imgRootPath:""}),f=function(){return e.useContext(p)},v={mt:["marginTop"],mb:["marginBottom"],ml:["marginLeft"],mr:["marginRight"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],pt:["paddingTop"],pb:["paddingBottom"],pl:["paddingLeft"],pr:["paddingRight"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},h=new Set(["onClick","children","className","style","img","fwidth","safeAreaTop"]),m=new Set(["fwidth","safeAreaTop","img","style"]),g=function(n){var e=n.img,t=n.imgRootPath;return e?{backgroundImage:e.startsWith("http")?e:"url(".concat([process.env.PUBLIC_URL,t,e].filter(function(n){return!!n}).join("/"),")"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}:void 0},w=i.div(s||(s=o(["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"],["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"])),function(n){var e=n.$open;return i.css(a||(a=o(["\n opacity: ",";\n pointer-events: ",";\n "],["\n opacity: ",";\n pointer-events: ",";\n "])),e?1:0,e?"all":"none")}),x=i.div(d||(d=o(["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"],["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"])),function(n){var e=n.$open;return i.css(c||(c=o(["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "],["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "])),e?1:0,e?"all":"none",e?0:20,e?1:.9)});exports.Box=function(t){var i=f(),o=i.ratio,a=i.imgRootPath,s=e.useMemo(function(){var n;return r({style:r(r(r(r(r(r({},Object.fromEntries(Object.entries(t).filter(function(n){var e=n[0];return!h.has(e)&&"style"!==e}).flatMap(function(n){var e=n[0],t=n[1];return v[e]?v[e].map(function(n){return[n,t*o]}):[[e,t*o]]}))),g({img:t.img,imgRootPath:a})),t.safeAreaTop?{top:"calc(var(--ot) + ".concat((null!==(n=t.top)&&void 0!==n?n:0)*o,"px)")}:void 0),t.fwidth?{width:"var(--vw)"}:void 0),{aspectRatio:t.aspectRatio,pointerEvents:t.onClick||!t.img?"all":"none"}),t.style)},Object.fromEntries(Object.entries(t).filter(function(n){var e=n[0];return h.has(e)&&!m.has(e)}).map(function(n){return[n[0],n[1]]})))},[a,t,o]);return console.log(s),alert(1),n.jsx("div",r({},s))},exports.GlobalContextProvider=function(t){var i=t.children,o=t.width,a=t.imgRootPath,s=void 0===a?"":a,c=function(n){var t=e.useState({width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/n}),i=t[0],r=t[1];return e.useEffect(function(){function e(){r({width:window.screen.availWidth,height:window.screen.availHeight,ratio:window.screen.availWidth/n})}return window.addEventListener("resize",e),e(),function(){return window.removeEventListener("resize",e)}},[n]),i}(o).ratio,d=e.useMemo(function(){return{ratio:c,imgRootPath:s}},[s,c]);return e.useEffect(function(){return l(),window.addEventListener("resize",l),function(){window.removeEventListener("resize",l)}},[]),n.jsx(p.Provider,r({value:d},{children:i}))},exports.Modal=function(i){var o=i.open,a=i.children,s=e.useMemo(function(){return Math.floor(1e3*Math.random())},[]);return e.useEffect(function(){o?t.disablePageScroll():t.enablePageScroll()},[o]),n.jsxs(n.Fragment,{children:[n.jsx(w,{"data-mid":s,$open:o}),n.jsx(x,r({"data-mid":s,$open:o},{children:a}))]})},exports.useGlobalContext=f,exports.utils=u;
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n,jsxs as t,Fragment as e}from"react/jsx-runtime";import{useState as i,useEffect as r,createContext as o,useMemo as a,useContext as c}from"react";import{disablePageScroll as d,enablePageScroll as s}from"@fluejs/noscroll";import l,{css as p}from"styled-components";var u=function(){return u=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},u.apply(this,arguments)};function f(n,t){return Object.defineProperty?Object.defineProperty(n,"raw",{value:t}):n.raw=t,n}"function"==typeof SuppressedError&&SuppressedError;var m,v,h,g,w=function(){document.documentElement.style.setProperty("--vw","".concat(window.innerWidth,"px")),document.documentElement.style.setProperty("--vh","".concat(window.innerHeight,"px"))},y=Object.freeze({__proto__:null,isDev:function(){return window.location.hostname.includes("localhost")},measureWindowSize:w,numberWithCommas:function(n){void 0===n&&(n=0);var t=n.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),t.join(".")}}),x=o({ratio:1,imgRootPath:""}),b=function(t){var e=t.children,o=t.width,c=t.imgRootPath,d=void 0===c?"":c,s=function(n){var t=i({width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/n}),e=t[0],o=t[1];return r(function(){function t(){o({width:window.screen.availWidth,height:window.screen.availHeight,ratio:window.screen.availWidth/n})}return window.addEventListener("resize",t),t(),function(){return window.removeEventListener("resize",t)}},[n]),e}(o).ratio,l=a(function(){return{ratio:s,imgRootPath:d}},[d,s]);return r(function(){return w(),window.addEventListener("resize",w),function(){window.removeEventListener("resize",w)}},[]),n(x.Provider,u({value:l},{children:e}))},j=function(){return c(x)},P={mt:["marginTop"],mb:["marginBottom"],ml:["marginLeft"],mr:["marginRight"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],pt:["paddingTop"],pb:["paddingBottom"],pl:["paddingLeft"],pr:["paddingRight"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},R=new Set(["onClick","children","className","style","img","fwidth","safeAreaTop"]),z=new Set(["fwidth","safeAreaTop","img"]),E=function(n){var t=n.img,e=n.imgRootPath;return t?{backgroundImage:t.startsWith("http")?t:"url(".concat([process.env.PUBLIC_URL,e,t].filter(function(n){return!!n}).join("/"),")"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}:void 0},L=function(t){var e=j(),i=e.ratio,r=e.imgRootPath,o=a(function(){var n;return u({style:u(u(u(u(u(u({},Object.fromEntries(Object.entries(t).filter(function(n){var t=n[0];return!R.has(t)&&"style"!==t}).flatMap(function(n){var t=n[0],e=n[1];return P[t]?P[t].map(function(n){return[n,e*i]}):[[t,e*i]]}))),E({img:t.img,imgRootPath:r})),t.safeAreaTop?{top:"calc(var(--ot) + ".concat((null!==(n=t.top)&&void 0!==n?n:0)*i,"px)")}:void 0),t.fwidth?{width:"var(--vw)"}:void 0),{aspectRatio:t.aspectRatio,pointerEvents:t.onClick||!t.img?"all":"none"}),t.style)},Object.fromEntries(Object.entries(t).filter(function(n){var t=n[0];return R.has(t)&&!z.has(t)}).map(function(n){return[n[0],n[1]]})))},[r,t,i]);return console.log(o),alert(1),n("div",u({},o))},O=l.div(v||(v=f(["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"],["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"])),function(n){var t=n.$open;return p(m||(m=f(["\n opacity: ",";\n pointer-events: ",";\n "],["\n opacity: ",";\n pointer-events: ",";\n "])),t?1:0,t?"all":"none")}),k=l.div(g||(g=f(["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"],["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"])),function(n){var t=n.$open;return p(h||(h=f(["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "],["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "])),t?1:0,t?"all":"none",t?0:20,t?1:.9)}),W=function(i){var o=i.open,c=i.children,l=a(function(){return Math.floor(1e3*Math.random())},[]);return r(function(){o?d():s()},[o]),t(e,{children:[n(O,{"data-mid":l,$open:o}),n(k,u({"data-mid":l,$open:o},{children:c}))]})};export{L as Box,b as GlobalContextProvider,W as Modal,j as useGlobalContext,y as utils};
|
|
1
|
+
import{jsx as n,jsxs as t,Fragment as e}from"react/jsx-runtime";import{useState as i,useEffect as r,createContext as o,useMemo as a,useContext as c}from"react";import{disablePageScroll as d,enablePageScroll as s}from"@fluejs/noscroll";import l,{css as p}from"styled-components";var u=function(){return u=Object.assign||function(n){for(var t,e=1,i=arguments.length;e<i;e++)for(var r in t=arguments[e])Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},u.apply(this,arguments)};function f(n,t){return Object.defineProperty?Object.defineProperty(n,"raw",{value:t}):n.raw=t,n}"function"==typeof SuppressedError&&SuppressedError;var m,v,h,g,w=function(){document.documentElement.style.setProperty("--vw","".concat(window.innerWidth,"px")),document.documentElement.style.setProperty("--vh","".concat(window.innerHeight,"px"))},y=Object.freeze({__proto__:null,isDev:function(){return window.location.hostname.includes("localhost")},measureWindowSize:w,numberWithCommas:function(n){void 0===n&&(n=0);var t=n.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,"."),t.join(".")}}),x=o({ratio:1,imgRootPath:""}),b=function(t){var e=t.children,o=t.width,c=t.imgRootPath,d=void 0===c?"":c,s=function(n){var t=i({width:window.innerWidth,height:window.innerHeight,ratio:window.innerWidth/n}),e=t[0],o=t[1];return r(function(){function t(){o({width:window.screen.availWidth,height:window.screen.availHeight,ratio:window.screen.availWidth/n})}return window.addEventListener("resize",t),t(),function(){return window.removeEventListener("resize",t)}},[n]),e}(o).ratio,l=a(function(){return{ratio:s,imgRootPath:d}},[d,s]);return r(function(){return w(),window.addEventListener("resize",w),function(){window.removeEventListener("resize",w)}},[]),n(x.Provider,u({value:l},{children:e}))},j=function(){return c(x)},P={mt:["marginTop"],mb:["marginBottom"],ml:["marginLeft"],mr:["marginRight"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],pt:["paddingTop"],pb:["paddingBottom"],pl:["paddingLeft"],pr:["paddingRight"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},R=new Set(["onClick","children","className","style","img","fwidth","safeAreaTop"]),z=new Set(["fwidth","safeAreaTop","img","style"]),E=function(n){var t=n.img,e=n.imgRootPath;return t?{backgroundImage:t.startsWith("http")?t:"url(".concat([process.env.PUBLIC_URL,e,t].filter(function(n){return!!n}).join("/"),")"),backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}:void 0},L=function(t){var e=j(),i=e.ratio,r=e.imgRootPath,o=a(function(){var n;return u({style:u(u(u(u(u(u({},Object.fromEntries(Object.entries(t).filter(function(n){var t=n[0];return!R.has(t)&&"style"!==t}).flatMap(function(n){var t=n[0],e=n[1];return P[t]?P[t].map(function(n){return[n,e*i]}):[[t,e*i]]}))),E({img:t.img,imgRootPath:r})),t.safeAreaTop?{top:"calc(var(--ot) + ".concat((null!==(n=t.top)&&void 0!==n?n:0)*i,"px)")}:void 0),t.fwidth?{width:"var(--vw)"}:void 0),{aspectRatio:t.aspectRatio,pointerEvents:t.onClick||!t.img?"all":"none"}),t.style)},Object.fromEntries(Object.entries(t).filter(function(n){var t=n[0];return R.has(t)&&!z.has(t)}).map(function(n){return[n[0],n[1]]})))},[r,t,i]);return console.log(o),alert(1),n("div",u({},o))},O=l.div(v||(v=f(["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"],["\n background: rgba(0, 0, 0, 0.7);\n width: var(--vw);\n height: var(--vh);\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99;\n transition: 0.5s ease all;\n ","\n"])),function(n){var t=n.$open;return p(m||(m=f(["\n opacity: ",";\n pointer-events: ",";\n "],["\n opacity: ",";\n pointer-events: ",";\n "])),t?1:0,t?"all":"none")}),k=l.div(g||(g=f(["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"],["\n width: var(--vw);\n height: var(--vh);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 100;\n transition: 0.2s ease all;\n ","\n"])),function(n){var t=n.$open;return p(h||(h=f(["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "],["\n opacity: ",";\n pointer-events: ",";\n transform: translateY(","px) scale(",");\n "])),t?1:0,t?"all":"none",t?0:20,t?1:.9)}),W=function(i){var o=i.open,c=i.children,l=a(function(){return Math.floor(1e3*Math.random())},[]);return r(function(){o?d():s()},[o]),t(e,{children:[n(O,{"data-mid":l,$open:o}),n(k,u({"data-mid":l,$open:o},{children:c}))]})};export{L as Box,b as GlobalContextProvider,W as Modal,j as useGlobalContext,y as utils};
|