Socket
Socket
Sign inDemoInstall

@deckdeckgo/utils

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deckdeckgo/utils - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

lib/cjs/index.cjs.js

3

lib/index.cjs.js

@@ -1,2 +0,1 @@

var d=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var E=e=>d(e,"__esModule",{value:!0});var y=(e,n)=>{for(var t in n)d(e,t,{get:n[t],enumerable:!0})},S=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of w(n))!b.call(e,r)&&(t||r!=="default")&&d(e,r,{get:()=>n[r],enumerable:!(o=x(n,r))||o.enumerable});return e};var h=(e=>(n,t)=>e&&e.get(n)||(t=S(E({}),n,1),e&&e.set(n,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var $={};y($,{caretPosition:()=>K,catchTab:()=>X,clearTheSelection:()=>O,debounce:()=>L,extractRgb:()=>f,extractRgba:()=>F,getAnchorElement:()=>J,getSelection:()=>a,hexToRgb:()=>z,injectCSS:()=>k,injectJS:()=>I,isAndroid:()=>l,isAndroidTablet:()=>P,isFirefox:()=>M,isFullscreen:()=>R,isIOS:()=>v,isIPad:()=>c,isLandscape:()=>N,isMobile:()=>s,isPortrait:()=>u,isRTL:()=>A,lazyLoadSelectedImages:()=>C,lazyLoadSelectedLazyImagesComponent:()=>H,moveCursorToEnd:()=>B,moveCursorToOffset:()=>j,moveCursorToStart:()=>_,rgbToHex:()=>D,unifyEvent:()=>T});function T(e){return e.changedTouches?e.changedTouches[0]:e}function L(e,n){let t;return(...o)=>{let r=()=>e(...o);t&&clearTimeout(t),t=setTimeout(r,n&&n>0?n:300)}}function s(){if(!window)return!1;let e=window.matchMedia("(any-pointer:coarse)").matches,n=window.matchMedia("(any-pointer:fine)").matches;return e&&!n}function v(){if(!window||!navigator)return!1;let e=i();return/iPhone|iPod/i.test(e)||c()}function c(){if(!window||!navigator)return!1;let e=i();return/iPad/i.test(e)?!0:/Macintosh/i.test(e)&&s()}function R(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}function M(){if(!window||!navigator)return!1;let e=i();return/firefox/i.test(e)}function A(){let e=document.documentElement.getAttribute("dir");return e!==null&&e==="rtl"}function N(){return!u()}function u(){return window?window.matchMedia&&window.matchMedia("(orientation: portrait)").matches:!1}var l=()=>{if(!window)return!1;let e=i();return/android|sink/i.test(e)},P=()=>{if(!window)return!1;let e=i();return l()&&!/mobile/i.test(e)},i=()=>navigator.userAgent||navigator.vendor||window.opera;function C(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none")}),n()})}var H=async e=>{let n=e.map(t=>t.lazyLoad());await Promise.all(n)};function I(e,n){return new Promise((t,o)=>{if(document.getElementById(e)){t("JS already loaded.");return}let r=document.createElement("script");r.id=e,r.async=!0,r.defer=!0,r.src=n,r.addEventListener("load",()=>t("JS loaded.")),r.addEventListener("error",()=>o("Error loading script.")),r.addEventListener("abort",()=>o("Script loading aborted.")),document.head.appendChild(r)})}function k(e,n){return new Promise((t,o)=>{if(document.getElementById(e)){t("CSS already loaded.");return}let r=document.createElement("link");r.id=e,r.setAttribute("rel","stylesheet"),r.setAttribute("href",n),r.addEventListener("load",()=>t("CSS loaded.")),r.addEventListener("error",()=>o("Error loading css.")),r.addEventListener("abort",()=>o("CSS loading aborted.")),document.head.appendChild(r)})}function z(e){if(!e||e===void 0||e==="")return;let n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?`${parseInt(n[1],16)}, ${parseInt(n[2],16)}, ${parseInt(n[3],16)}`:void 0}function D(e){return e?(t=>{if(!!t)return`#${t.map(o=>o.toString(16).padStart(2,"0")).join("")}`})(f(e)):void 0}function f(e){let n=e.match(/([.\d]+),\s*([.\d]+),\s*([.\d]+)/);if(!!n)return n.splice(1,3).map(t=>Number(t))}function F(e){let n=e.match(/([.\d]+),\s*([.\d]+),\s*([.\d]+),\s*([.\d]+)/);if(!!n)return n.splice(1,4).map(t=>Number(t))}var O=()=>{var e,n,t,o;window&&window.getSelection?((e=window.getSelection())==null?void 0:e.empty)?(n=window.getSelection())==null||n.empty():((t=window.getSelection())==null?void 0:t.removeAllRanges)&&((o=window.getSelection())==null||o.removeAllRanges()):document&&document.selection&&document.selection.empty()},a=()=>window&&window.getSelection?window.getSelection():document&&document.getSelection?document.getSelection():document&&document.selection?document.selection.createRange().text:null,J=e=>{let n=e==null?void 0:e.anchorNode;return n?n.nodeType!==Node.TEXT_NODE&&n.nodeType!==Node.COMMENT_NODE?n:n.parentElement:null},B=e=>{m({element:e,collapse:"end"})},_=e=>{m({element:e,collapse:"start"})},m=({element:e,collapse:n})=>{if(!e)return;let t=document.createRange();t.selectNodeContents(e),t.collapse(n==="start"),g(t)},j=({element:e,offset:n})=>{if(!e)return;let t=document.createRange();t.setStart(e,n),g(t)},g=e=>{let n=a();n==null||n.removeAllRanges(),n==null||n.addRange(e),e.detach()},K=({target:e})=>{let n=a(),t=n==null?void 0:n.getRangeAt(0),o=t==null?void 0:t.cloneRange();if(!o||!t)return;let{endContainer:r,endOffset:p}=t;return o.selectNodeContents(e),o.setEnd(r,p),o.toString().length};var X=e=>{(e==null?void 0:e.key)==="Tab"&&(e.preventDefault(),document.execCommand("insertHTML",!1,"&#009"))};module.exports=h($);0&&(module.exports={caretPosition,catchTab,clearTheSelection,debounce,extractRgb,extractRgba,getAnchorElement,getSelection,hexToRgb,injectCSS,injectJS,isAndroid,isAndroidTablet,isFirefox,isFullscreen,isIOS,isIPad,isLandscape,isMobile,isPortrait,isRTL,lazyLoadSelectedImages,lazyLoadSelectedLazyImagesComponent,moveCursorToEnd,moveCursorToOffset,moveCursorToStart,rgbToHex,unifyEvent});
//# sourceMappingURL=index.cjs.js.map
module.exports = require('./cjs/index.cjs.js');

@@ -1,2 +0,1 @@

function p(e){return e.changedTouches?e.changedTouches[0]:e}function x(e,n){let t;return(...r)=>{let o=()=>e(...r);t&&clearTimeout(t),t=setTimeout(o,n&&n>0?n:300)}}function u(){if(!window)return!1;let e=window.matchMedia("(any-pointer:coarse)").matches,n=window.matchMedia("(any-pointer:fine)").matches;return e&&!n}function w(){if(!window||!navigator)return!1;let e=i();return/iPhone|iPod/i.test(e)||l()}function l(){if(!window||!navigator)return!1;let e=i();return/iPad/i.test(e)?!0:/Macintosh/i.test(e)&&u()}function b(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)}function E(){if(!window||!navigator)return!1;let e=i();return/firefox/i.test(e)}function y(){let e=document.documentElement.getAttribute("dir");return e!==null&&e==="rtl"}function S(){return!f()}function f(){return window?window.matchMedia&&window.matchMedia("(orientation: portrait)").matches:!1}var m=()=>{if(!window)return!1;let e=i();return/android|sink/i.test(e)},h=()=>{if(!window)return!1;let e=i();return m()&&!/mobile/i.test(e)},i=()=>navigator.userAgent||navigator.vendor||window.opera;function v(e){return new Promise(n=>{if(!e){n();return}e.forEach(t=>{t.hasAttribute("data-src")&&(t.setAttribute("src",`${t.getAttribute("data-src")}`),t.removeAttribute("data-src"),t.classList.contains("deckgo-reveal")||t.style.setProperty("visibility","inherit")),t.style.setProperty("pointer-events","none")}),n()})}var L=async e=>{let n=e.map(t=>t.lazyLoad());await Promise.all(n)};function M(e,n){return new Promise((t,r)=>{if(document.getElementById(e)){t("JS already loaded.");return}let o=document.createElement("script");o.id=e,o.async=!0,o.defer=!0,o.src=n,o.addEventListener("load",()=>t("JS loaded.")),o.addEventListener("error",()=>r("Error loading script.")),o.addEventListener("abort",()=>r("Script loading aborted.")),document.head.appendChild(o)})}function A(e,n){return new Promise((t,r)=>{if(document.getElementById(e)){t("CSS already loaded.");return}let o=document.createElement("link");o.id=e,o.setAttribute("rel","stylesheet"),o.setAttribute("href",n),o.addEventListener("load",()=>t("CSS loaded.")),o.addEventListener("error",()=>r("Error loading css.")),o.addEventListener("abort",()=>r("CSS loading aborted.")),document.head.appendChild(o)})}function P(e){if(!e||e===void 0||e==="")return;let n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return n?`${parseInt(n[1],16)}, ${parseInt(n[2],16)}, ${parseInt(n[3],16)}`:void 0}function C(e){return e?(t=>{if(!!t)return`#${t.map(r=>r.toString(16).padStart(2,"0")).join("")}`})(g(e)):void 0}function g(e){let n=e.match(/([.\d]+),\s*([.\d]+),\s*([.\d]+)/);if(!!n)return n.splice(1,3).map(t=>Number(t))}function H(e){let n=e.match(/([.\d]+),\s*([.\d]+),\s*([.\d]+),\s*([.\d]+)/);if(!!n)return n.splice(1,4).map(t=>Number(t))}var k=()=>{window&&window.getSelection?window.getSelection()?.empty?window.getSelection()?.empty():window.getSelection()?.removeAllRanges&&window.getSelection()?.removeAllRanges():document&&document.selection&&document.selection.empty()},d=()=>window&&window.getSelection?window.getSelection():document&&document.getSelection?document.getSelection():document&&document.selection?document.selection.createRange().text:null,z=e=>{let n=e?.anchorNode;return n?n.nodeType!==Node.TEXT_NODE&&n.nodeType!==Node.COMMENT_NODE?n:n.parentElement:null},D=e=>{s({element:e,collapse:"end"})},F=e=>{s({element:e,collapse:"start"})},s=({element:e,collapse:n})=>{if(!e)return;let t=document.createRange();t.selectNodeContents(e),t.collapse(n==="start"),a(t)},O=({element:e,offset:n})=>{if(!e)return;let t=document.createRange();t.setStart(e,n),a(t)},a=e=>{let n=d();n?.removeAllRanges(),n?.addRange(e),e.detach()},$=({target:e})=>{let t=d()?.getRangeAt(0),r=t?.cloneRange();if(!r||!t)return;let{endContainer:o,endOffset:c}=t;return r.selectNodeContents(e),r.setEnd(o,c),r.toString().length};var B=e=>{e?.key==="Tab"&&(e.preventDefault(),document.execCommand("insertHTML",!1,"&#009"))};export{$ as caretPosition,B as catchTab,k as clearTheSelection,x as debounce,g as extractRgb,H as extractRgba,z as getAnchorElement,d as getSelection,P as hexToRgb,A as injectCSS,M as injectJS,m as isAndroid,h as isAndroidTablet,E as isFirefox,b as isFullscreen,w as isIOS,l as isIPad,S as isLandscape,u as isMobile,f as isPortrait,y as isRTL,v as lazyLoadSelectedImages,L as lazyLoadSelectedLazyImagesComponent,D as moveCursorToEnd,O as moveCursorToOffset,F as moveCursorToStart,C as rgbToHex,p as unifyEvent};
//# sourceMappingURL=index.js.map
export * from './esm/index.js';
{
"name": "@deckdeckgo/utils",
"version": "4.0.0",
"version": "5.0.0",
"author": "David Dal Busco",

@@ -16,7 +16,7 @@ "description": "A collection of utils methods and functions developed for DeckDeckGo",

},
"main": "lib/index.cjs.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"main": "lib/cjs/index.cjs.js",
"module": "lib/esm/index.js",
"types": "lib/types/index.d.ts",
"scripts": {
"ts-declaration": " tsc --emitDeclarationOnly --outDir lib",
"ts-declaration": " tsc --emitDeclarationOnly --outDir lib/types",
"build": "rimraf lib && node ./esbuild.js && npm run ts-declaration"

@@ -23,0 +23,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc