@hierotech/frontend
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-dom"),require("react")):"function"==typeof define&&define.amd?define(["react-dom","react"],t):"object"==typeof exports?exports.hierotechFrontend=t(require("react-dom"),require("react")):e.hierotechFrontend=t(e["react-dom"],e.react)}(self,(function(e,t){return(()=>{"use strict";var n={297:e=>{e.exports=t},268:t=>{t.exports=e}},r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={exports:{}};return n[e](t,t.exports,o),t.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{Frontend:()=>e,Hooks:()=>t});var e={};o.r(e),o.d(e,{copyTextToClipboard:()=>y,createAssetLogoPortalUrl:()=>m,createAssetLogoUrl:()=>s,createAssetPlaceholderUrl:()=>h,createUserAvatarUrl:()=>p,createWindow:()=>v,findElement:()=>g,formatDate:()=>w,formatTimerTime:()=>b,getDocumentClientSize:()=>S,getTextWidth:()=>E,getWindowSize:()=>x,init:()=>A,isExternalUrl:()=>T,measureElement:()=>j});var t={};o.r(t),o.d(t,{useCurrentDate:()=>L,useDocumentClientSize:()=>M,useElementSize:()=>P,useWindowSize:()=>_});var n=o(268),r=3600,u=null,a=null,c=null,l=null,f=null;function d(e,t,n,r){if(!u)throw new Error("bucketUrl is not initialized");return"".concat(u,"/").concat(e,"/").concat(t,"/").concat(n,"/").concat(r)}function s(e){var t=e.files.find((function(e){return"asset_logo"===e.type}));return d("assets",e.ticker,"logo",t.name)}function m(e){if(!a)throw new Error("defaultAssetLogo is not initialized");var t=e.files.find((function(e){return"asset_logo_portal"===e.type}));return t?d("assets",e.ticker,"logo-portal",t.name):a}function h(e){if(!c)throw new Error("defaultAssetPlaceholder is not initialized");var t=e.files.find((function(e){return"asset_placeholder"===e.type}));return t?d("assets",e.ticker,"placeholder",t.name):c}function p(e){if(!l)throw new Error("defaultAvatar is not initialized");var t=e.files.find((function(e){return"user_avatar"===e.type}));return t?d("users",e.user_id,"avatar",t.name):l}function v(e){var t=arguments.length>1&&arguments[1]!==undefined&&arguments[1],n=window.open(e);t&&n&&n.focus()}function y(e){var t=document.createElement("textarea");t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.innerText=e;var n=document.getElementsByTagName("body")[0];n.appendChild(t),t.select(),document.execCommand("copy"),n.removeChild(t)}function g(e,t){for(var n=e;n;){if(n===t)return!0;n=n.parentNode}return!1}function w(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=t.mode,r=void 0===n?"datetime":n,o=new Date(e),i=o.toLocaleDateString("en",{day:"2-digit",month:"long",year:"numeric"});if("date"===r)return i;var u=o.toLocaleTimeString("en",{hour:"numeric",minute:"2-digit"});return"".concat(i,", ").concat(u)}function b(e){var t=Math.floor(e/86400);e%=86400;var n=Math.floor(e/r);return e%=r,[t,n,Math.floor(e/60),e%=60].map((function(e){return e.toString().padStart(2,"0")})).join(":")}function S(){return{height:document.documentElement.clientHeight||document.body.clientHeight,width:document.documentElement.clientWidth||document.body.clientWidth}}function E(e,t){f||(f=document.createElement("canvas"));var n=f.getContext("2d");return n.font=t,n.measureText(e).width}function x(){return{height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}function A(e){u=e.bucketUrl,a=e.defaultAssetLogo,c=e.defaultAssetPlaceholder,l=e.defaultAvatar}function T(e){return/^(https?:)?\/\//.test(e)}function j(e){var t=n.findDOMNode(e);return{width:t.offsetWidth,height:t.offsetHeight}}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=undefined;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(c){o=!0,i=c}finally{try{r||null==a["return"]||a["return"]()}finally{if(o)throw i}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.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)?z(e,t):void 0}}(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.")}()}var C=o(297),D=new Set,O=new Map,U=new Set;window.addEventListener("resize",(function(){var e=x(),t=S();U.forEach((function(t){t(e)})),D.forEach((function(e){e(t)})),O.forEach((function(e,t){t.current&&e(j(t.current))}))}));var L=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1e3,t=(0,C.useState)(new Date),n=W(t,2),r=n[0],o=n[1];return(0,C.useEffect)((function(){var t=setInterval((function(){o(new Date)}),e);return function(){return clearInterval(t)}}),[e]),r},M=function(){var e=W((0,C.useState)(S()),2),t=e[0],n=e[1];return(0,C.useEffect)((function(){return D.add(n),function(){D["delete"](n)}}),[]),(0,C.useLayoutEffect)((function(){n(S())}),[]),[t]},P=function(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{width:0,height:0},n=(0,C.useState)(t),r=W(n,2),o=r[0],i=r[1];return(0,C.useEffect)((function(){O.set(e,i),e.current&&i(j(e.current));var t=setTimeout((function(){t=null,e.current&&i(j(e.current))}),100);return function(){t&&clearTimeout(t),O["delete"](e)}}),[e]),[o]},_=function(){var e=W((0,C.useState)(x()),2),t=e[0],n=e[1];return(0,C.useEffect)((function(){return U.add(n),function(){U["delete"](n)}}),[]),[t]}})(),i})()})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-dom"),require("react")):"function"==typeof define&&define.amd?define(["react-dom","react"],t):"object"==typeof exports?exports.hierotechFrontend=t(require("react-dom"),require("react")):e.hierotechFrontend=t(e["react-dom"],e.react)}(self,(function(e,t){return(()=>{"use strict";var n={297:e=>{e.exports=t},268:t=>{t.exports=e}},r={};function o(e){var t=r[e];if(t!==undefined)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{o.r(i),o.d(i,{Frontend:()=>e,Hooks:()=>t});var e={};o.r(e),o.d(e,{copyTextToClipboard:()=>y,createAssetLogoPortalUrl:()=>m,createAssetLogoUrl:()=>s,createAssetPlaceholderUrl:()=>h,createUserAvatarUrl:()=>p,createWindow:()=>v,findElement:()=>g,formatDate:()=>w,formatTimerTime:()=>b,getDocumentClientSize:()=>S,getTextWidth:()=>E,getWindowSize:()=>x,init:()=>A,isExternalUrl:()=>T,measureElement:()=>j});var t={};o.r(t),o.d(t,{useCurrentDate:()=>L,useDocumentClientSize:()=>M,useElementSize:()=>P,useWindowSize:()=>_});var n=o(268),r=3600,u=null,a=null,c=null,d=null,f=null;function l(e,t,n,r){if(!u)throw new Error("bucketUrl is not initialized");return"".concat(u,"/").concat(e,"/").concat(t,"/").concat(n,"/").concat(r)}function s(e){var t=e.files.find((function(e){return"asset_logo"===e.type}));return l("assets",e.ticker,"logo",t.name)}function m(e){if(!a)throw new Error("defaultAssetLogo is not initialized");var t=e.files.find((function(e){return"asset_logo_portal"===e.type}));return t?l("assets",e.ticker,"logo-portal",t.name):a}function h(e){if(!c)throw new Error("defaultAssetPlaceholder is not initialized");var t=e.files.find((function(e){return"asset_placeholder"===e.type}));return t?l("assets",e.ticker,"placeholder",t.name):c}function p(e){if(!d)throw new Error("defaultAvatar is not initialized");var t=e.files.find((function(e){return"user_avatar"===e.type}));return t?l("users",e.user_id,"avatar",t.name):d}function v(e){var t=arguments.length>1&&arguments[1]!==undefined&&arguments[1],n=window.open(e);t&&n&&n.focus()}function y(e){var t=document.createElement("textarea");t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.innerText=e;var n=document.getElementsByTagName("body")[0];n.appendChild(t),t.select(),document.execCommand("copy"),n.removeChild(t)}function g(e,t){for(var n=e;n;){if(n===t)return!0;n=n.parentNode}return!1}function w(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=t.mode,r=void 0===n?"datetime":n,o=new Date(e),i=o.toLocaleDateString("en",{day:"2-digit",month:"long",year:"numeric"});if("date"===r)return i;var u=o.toLocaleTimeString("en",{hour:"numeric",minute:"2-digit"});return"".concat(i,", ").concat(u)}function b(e){var t=Math.floor(e/86400);e%=86400;var n=Math.floor(e/r);return e%=r,[t,n,Math.floor(e/60),e%=60].map((function(e){return e.toString().padStart(2,"0")})).join(":")}function S(){return{height:document.documentElement.clientHeight||document.body.clientHeight,width:document.documentElement.clientWidth||document.body.clientWidth}}function E(e,t){f||(f=document.createElement("canvas"));var n=f.getContext("2d");return n.font=t,n.measureText(e).width}function x(){return{height:window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,width:window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}}function A(e){u=e.bucketUrl,a=e.defaultAssetLogo,c=e.defaultAssetPlaceholder,d=e.defaultAvatar}function T(e){return/^(https?:)?\/\//.test(e)}function j(e){var t=n.findDOMNode(e);return{width:t.offsetWidth,height:t.offsetHeight}}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=undefined;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(c){o=!0,i=c}finally{try{r||null==a["return"]||a["return"]()}finally{if(o)throw i}}return n}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(e,t);var n=Object.prototype.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)?z(e,t):void 0}}(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.")}()}var C=o(297),D=new Set,O=new Map,U=new Set;window.addEventListener("resize",(function(){var e=x(),t=S();U.forEach((function(t){t(e)})),D.forEach((function(e){e(t)})),O.forEach((function(e,t){t.current&&e(j(t.current))}))}));var L=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1e3,t=(0,C.useState)(new Date),n=W(t,2),r=n[0],o=n[1];return(0,C.useEffect)((function(){var t=setInterval((function(){o(new Date)}),e);return function(){return clearInterval(t)}}),[e]),r},M=function(){var e=W((0,C.useState)(S()),2),t=e[0],n=e[1];return(0,C.useEffect)((function(){return D.add(n),function(){D["delete"](n)}}),[]),(0,C.useLayoutEffect)((function(){n(S())}),[]),[t]},P=function(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{width:0,height:0},n=(0,C.useState)(t),r=W(n,2),o=r[0],i=r[1];return(0,C.useEffect)((function(){O.set(e,i),e.current&&i(j(e.current));var t=setTimeout((function(){t=null,e.current&&i(j(e.current))}),100);return function(){t&&clearTimeout(t),O["delete"](e)}}),[e]),[o]},_=function(){var e=W((0,C.useState)(x()),2),t=e[0],n=e[1];return(0,C.useEffect)((function(){return U.add(n),function(){U["delete"](n)}}),[]),[t]}})(),i})()})); | ||
//# sourceMappingURL=index.browser.js.map |
{ | ||
"name": "@hierotech/frontend", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Common frontend methods and hooks", | ||
@@ -27,12 +27,12 @@ "main": "dist/index.browser.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.1", | ||
"@babel/register": "^7.13.0", | ||
"@babel/runtime": "^7.13.7", | ||
"@ololoepepe/babel-preset-default": "^0.1.15", | ||
"@babel/core": "^7.13.10", | ||
"@babel/register": "^7.13.8", | ||
"@babel/runtime": "^7.13.10", | ||
"@ololoepepe/babel-preset-default": "^0.1.16", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.2.2", | ||
"core-js": "^3.9.0", | ||
"eslint": "^7.20.0", | ||
"core-js": "^3.9.1", | ||
"eslint": "^7.22.0", | ||
"eslint-config-xo": "^0.35.0", | ||
"mocha": "^8.3.0", | ||
"mocha": "^8.3.2", | ||
"react": "^17.0.1", | ||
@@ -42,3 +42,3 @@ "react-dom": "^17.0.1", | ||
"terser-webpack-plugin": "^5.1.1", | ||
"webpack": "^5.24.2", | ||
"webpack": "^5.27.1", | ||
"webpack-cli": "^4.5.0" | ||
@@ -45,0 +45,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27738