Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@skeletonizer/utils

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@skeletonizer/utils - npm Package Compare versions

Comparing version 0.0.19-alpha.0 to 0.0.20-alpha.0

3

dist/src/models/schema.model.d.ts
import { TSchemaGenerator, TSchemaTransformer } from '../types';
export declare class Schema<T extends object> {
readonly generator: TSchemaGenerator<T>;
viewModel: TSchemaTransformer<T>;
readonly uuid: number;
readonly viewModel: TSchemaTransformer<T>;
get value(): T;

@@ -6,0 +7,0 @@ private readonly val;

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

(function(t,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(t=typeof globalThis<"u"?globalThis:t||self,s(t["@skeletonizer/utils"]={}))})(this,function(t){"use strict";var M=t=>{throw TypeError(t)};var A=(t,s,a)=>s.has(t)||M("Cannot "+a);var y=(t,s,a)=>(A(t,s,"read from private field"),a?a.call(t):s.get(t)),w=(t,s,a)=>s.has(t)?M("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),m=(t,s,a,d)=>(A(t,s,"write to private field"),d?d.call(t,a):s.set(t,a),a);var o;const s=["Lorem","ipsum","dolor","sit","amet,","consectetur","adipiscing","elit.","Mauris","posuere","tincidunt","purus,","id","laoreet","mauris","cursus","nec.","Quisque","id","ante","id","tellus","aliquam","pulvinar","eget","eu","dolor.","Donec","egestas","dapibus","massa,","vel","finibus","lectus","congue","eu.","Morbi","quis","erat","condimentum,","molestie","ex","a,","sollicitudin","metus.","Vestibulum","orci","metus,","sagittis","a","sagittis","a,","varius","id","diam.","Cras","egestas","eros","vestibulum,","tempus","ipsum","pellentesque,","dictum","justo.","Quisque","sed","justo","metus.","Suspendisse","id","felis","vitae","nunc","auctor","tristique","eu","sit","amet","mi.","Ut","luctus","posuere","viverra.","Nunc","sed","augue","a","velit","sodales","iaculis.","Sed","at","arcu","non","massa","hendrerit","scelerisque.","Nunc","commodo","vulputate","vestibulum.","Duis","ut","leo","nisi.","Mauris","dignissim","quis","sem","non","blandit.","Suspendisse","id","elit","eget","leo","efficitur","maximus.","Ut","eu","auctor","ligula.","Nulla","in","leo","luctus,","tempor","justo","vitae,","condimentum","massa.","Quisque","venenatis","elementum","posuere.","Sed","bibendum","bibendum","enim,","in","faucibus","ante.","Aliquam","pretium","sapien","ac","eleifend","suscipit.","Duis","lacinia","justo","quis","diam","elementum,","vitae","fringilla","lectus","faucibus.","Integer","dictum","commodo","diam","a","tempus.","Aenean","elementum","egestas","quam,","eget","feugiat","ligula","imperdiet","vitae.","Morbi","mattis","dui","sed","elementum","mollis.","In","interdum","viverra","urna,","at","scelerisque","sapien.","Sed","molestie","blandit","risus","nec","ornare.","Integer","pharetra","massa","purus,","ut","fringilla","augue","sollicitudin","in.","Pellentesque","eu","leo","pharetra,","hendrerit","lectus","id,","dapibus","ipsum.","Quisque","tincidunt","euismod","venenatis.","Sed","lacus","ex,","pulvinar","at","dui","vitae,","condimentum","rutrum","eros.","Nunc","viverra","cursus","ante,","ac","dapibus","ligula","volutpat","nec.","Integer","commodo","in","tortor","eget","aliquet.","Nam","bibendum","lectus","vitae","ligula","interdum","scelerisque.","Morbi","sit","amet","augue","diam.","Etiam","purus","lorem,","sodales","sed","sodales","ac,","dignissim","a","tellus.","Nunc","vehicula","nibh","in","erat","rhoncus","ullamcorper.","Orci","varius","natoque","penatibus","et","magnis","dis","parturient","montes,","nascetur","ridiculus","mus.","Aliquam","augue","nunc,","fringilla","at","dictum","quis,","luctus","sit","amet","nisl.","Nam","lectus","felis,","egestas","nec","lacinia","non,","auctor","eget","lorem.","Nunc","vel","velit","quis","magna","hendrerit","volutpat","in","nec","leo.","Aenean","tempor","lectus","tortor,","nec","bibendum","elit","aliquam","at.","In","id","libero","tincidunt,","interdum","libero","sit","amet,","gravida","est.","Morbi","ut","ipsum","enim.","Duis","vel","posuere","ante.","Praesent","sollicitudin","lacus","sit","amet","luctus","euismod.","Phasellus","lorem","elit,","auctor","sed","risus","a,","faucibus","tempor","lacus.","Integer","id","tellus","ut","eros","congue","ornare.","Cras","vitae","ornare","sem.","Cras","tincidunt","arcu","efficitur","mauris","molestie,","eu","eleifend","eros","mattis.","Integer","id","diam","mauris.","Duis","suscipit","enim","risus,","non","dignissim","nulla","imperdiet","hendrerit.","Vestibulum","sed","dignissim","erat.","Aliquam","erat","volutpat.","Nunc","mattis","auctor","justo,","non","fringilla","dolor","blandit","a.","Donec","et","velit","tristique","lacus","varius","aliquam.","Praesent","ac","molestie","quam,","vitae","scelerisque","tellus.","Praesent","eleifend","sed","diam","in","gravida.","Donec","tristique","sapien","ante,","in","egestas","diam","porta","ac.","Proin","ac","justo","eleifend,","consequat","ante","vitae,","laoreet","augue.","Mauris","scelerisque","arcu","dolor,","quis","lobortis","risus","pellentesque","eu.","Praesent","in","enim","a","elit","feugiat","dapibus.","Duis","quis","bibendum","mi.","Vestibulum","lacinia,","sem","at","efficitur","volutpat,","velit","ligula","vulputate","nisi,","sit","amet","dapibus","risus","metus","sed","est.","Sed","in","venenatis","ante.","Pellentesque","vel","ipsum","pharetra,","efficitur","quam","ut,","hendrerit","dolor."];var a=(u=>(u.Text="text",u.Input="input",u.Image="image",u.Video="video",u.WrapperElement="wrapper-element",u))(a||{}),d=(u=>(u.PrimaryColor="rgba(100, 100, 100, .6)",u.SecondaryColor="rgba(100, 100, 100, .3)",u))(d||{});class b{static daysInMs(e){return e*24*60*60*1e3}static dateBetween(e,i){return new Date(e.getTime()+Math.random()*(i.getTime()-e.getTime()))}}let q=0;class T{constructor(){w(this,o)}get value(){return y(this,o)}words(e){this.assertType();let i="",r=0;for(;r<e;)i+=this.randomLoremWord()+" ",r++;return m(this,o,i.trim()),this}paragraphs(e){this.assertType();let i="",r=0;const g=50;for(;r<e;){const p=g-Math.round(g*Math.random()*.2)*(Math.random()<.5?-1:1);i+=this.words(p).value,r!==e-1&&(i+=`
`),r++}return m(this,o,i),this}number(e=0,i=1e3){return this.assertType(),m(this,o,Math.ceil(Math.random()*(i-e))+e),this}multiply(e){return this.assertType(),m(this,o,y(this,o)*e),this}date(e={}){this.assertType();let i=e.max??new Date("2100-01-01"),r=e.min??new Date("1970-01-01");return e.isFuture?r=new Date(Date.now()+b.daysInMs(1)):e.isPast&&(i=new Date(Date.now()-b.daysInMs(1))),m(this,o,b.dateBetween(r,i)),this}uuid(){return q++,this.assertType(),m(this,o,q),this}boolean(){return this.assertType(),m(this,o,Math.random()<=.5),this}symbol(e=0){return this.assertType(),m(this,o,Symbol(e)),this}identical(e){return this.assertType(),m(this,o,e),this}assertType(){}randomLoremWord(){const e=Math.floor(Math.random()*s.length);return s[e]??"lorem"}}o=new WeakMap;class c{constructor(e){this.generator=e,this.viewModel=this.generator(),this.val=c.modelToValue(this.viewModel)}get value(){return this.val}static modelToValue(e){if(e instanceof T)return e.value;if(Array.isArray(e))return e.map(this.modelToValue);{const i={};return Object.keys(e).forEach(r=>{i[r]=c.modelToValue(e[r])}),i}}}class C{proxy(e){return e instanceof c?e.value:e}}class I{constructor(){this.config=null,this.viewModels=[]}setupModels(){if(this.config){const e=this.config.schemaGenerator;this.viewModels=Array.from({length:this.config.repeat},()=>new c(e))}}}const l=class l{static skeletonizeProjectedTemplate(e,i){const r=(i==null?void 0:i.primaryColor)??d.PrimaryColor,g=(i==null?void 0:i.secondaryColor)??d.SecondaryColor;e.setAttribute("style",`--skeletonizer-primary-color: ${r}; --skeletonizer-secondary-color: ${g};`),Array.from(e.querySelectorAll("*:not(svg, [data-skeletonizer])")).forEach(p=>{const x=["br","b","strong","i","em","mark","small","del","ins","sub","sup"],f=Array.from(p.childNodes).map(n=>n.nodeName.toLowerCase()).filter(n=>!x.includes(n)),P=f.length>0&&f.some(n=>n!==f[0]);p.childNodes.forEach(n=>{switch(n.nodeName.toLowerCase()){case"#text":{if(this.assertAs(n),n.wholeText.trim())if(P){const h=document.createElement("span");h.innerText=n.cloneNode().wholeText,h.innerText.length&&n.replaceWith(l.skeletonizedSpanGenerator(h.innerText,a.Text))}else{const h=l.skeletonizedSpanGenerator(p.innerHTML,a.Text);p.innerHTML=h.outerHTML}break}case"input":{n.setAttribute(l.dataAttr,a.Input);break}case"img":{n.setAttribute(l.dataAttr,a.Image);break}case"video":{n.setAttribute(l.dataAttr,a.Video);break}}})}),e.setAttribute(l.dataAttr,a.WrapperElement)}static skeletonizedSpanGenerator(e,i){const r=document.createElement("span");return r.innerHTML=e,r.setAttribute(l.dataAttr,i),r}static assertAs(e){}};l.dataAttr="data-skeletonizer";let v=l;t.Schema=c,t.SchemaItem=T,t.SkeletonAbstractComponent=C,t.SkeletonAdapterComponent=I,t.SkeletonDirective=v,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
(function(t,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(t=typeof globalThis<"u"?globalThis:t||self,s(t["@skeletonizer/utils"]={}))})(this,function(t){"use strict";var M=t=>{throw TypeError(t)};var A=(t,s,a)=>s.has(t)||M("Cannot "+a);var y=(t,s,a)=>(A(t,s,"read from private field"),a?a.call(t):s.get(t)),w=(t,s,a)=>s.has(t)?M("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),m=(t,s,a,d)=>(A(t,s,"write to private field"),d?d.call(t,a):s.set(t,a),a);var l;const s=["Lorem","ipsum","dolor","sit","amet,","consectetur","adipiscing","elit.","Mauris","posuere","tincidunt","purus,","id","laoreet","mauris","cursus","nec.","Quisque","id","ante","id","tellus","aliquam","pulvinar","eget","eu","dolor.","Donec","egestas","dapibus","massa,","vel","finibus","lectus","congue","eu.","Morbi","quis","erat","condimentum,","molestie","ex","a,","sollicitudin","metus.","Vestibulum","orci","metus,","sagittis","a","sagittis","a,","varius","id","diam.","Cras","egestas","eros","vestibulum,","tempus","ipsum","pellentesque,","dictum","justo.","Quisque","sed","justo","metus.","Suspendisse","id","felis","vitae","nunc","auctor","tristique","eu","sit","amet","mi.","Ut","luctus","posuere","viverra.","Nunc","sed","augue","a","velit","sodales","iaculis.","Sed","at","arcu","non","massa","hendrerit","scelerisque.","Nunc","commodo","vulputate","vestibulum.","Duis","ut","leo","nisi.","Mauris","dignissim","quis","sem","non","blandit.","Suspendisse","id","elit","eget","leo","efficitur","maximus.","Ut","eu","auctor","ligula.","Nulla","in","leo","luctus,","tempor","justo","vitae,","condimentum","massa.","Quisque","venenatis","elementum","posuere.","Sed","bibendum","bibendum","enim,","in","faucibus","ante.","Aliquam","pretium","sapien","ac","eleifend","suscipit.","Duis","lacinia","justo","quis","diam","elementum,","vitae","fringilla","lectus","faucibus.","Integer","dictum","commodo","diam","a","tempus.","Aenean","elementum","egestas","quam,","eget","feugiat","ligula","imperdiet","vitae.","Morbi","mattis","dui","sed","elementum","mollis.","In","interdum","viverra","urna,","at","scelerisque","sapien.","Sed","molestie","blandit","risus","nec","ornare.","Integer","pharetra","massa","purus,","ut","fringilla","augue","sollicitudin","in.","Pellentesque","eu","leo","pharetra,","hendrerit","lectus","id,","dapibus","ipsum.","Quisque","tincidunt","euismod","venenatis.","Sed","lacus","ex,","pulvinar","at","dui","vitae,","condimentum","rutrum","eros.","Nunc","viverra","cursus","ante,","ac","dapibus","ligula","volutpat","nec.","Integer","commodo","in","tortor","eget","aliquet.","Nam","bibendum","lectus","vitae","ligula","interdum","scelerisque.","Morbi","sit","amet","augue","diam.","Etiam","purus","lorem,","sodales","sed","sodales","ac,","dignissim","a","tellus.","Nunc","vehicula","nibh","in","erat","rhoncus","ullamcorper.","Orci","varius","natoque","penatibus","et","magnis","dis","parturient","montes,","nascetur","ridiculus","mus.","Aliquam","augue","nunc,","fringilla","at","dictum","quis,","luctus","sit","amet","nisl.","Nam","lectus","felis,","egestas","nec","lacinia","non,","auctor","eget","lorem.","Nunc","vel","velit","quis","magna","hendrerit","volutpat","in","nec","leo.","Aenean","tempor","lectus","tortor,","nec","bibendum","elit","aliquam","at.","In","id","libero","tincidunt,","interdum","libero","sit","amet,","gravida","est.","Morbi","ut","ipsum","enim.","Duis","vel","posuere","ante.","Praesent","sollicitudin","lacus","sit","amet","luctus","euismod.","Phasellus","lorem","elit,","auctor","sed","risus","a,","faucibus","tempor","lacus.","Integer","id","tellus","ut","eros","congue","ornare.","Cras","vitae","ornare","sem.","Cras","tincidunt","arcu","efficitur","mauris","molestie,","eu","eleifend","eros","mattis.","Integer","id","diam","mauris.","Duis","suscipit","enim","risus,","non","dignissim","nulla","imperdiet","hendrerit.","Vestibulum","sed","dignissim","erat.","Aliquam","erat","volutpat.","Nunc","mattis","auctor","justo,","non","fringilla","dolor","blandit","a.","Donec","et","velit","tristique","lacus","varius","aliquam.","Praesent","ac","molestie","quam,","vitae","scelerisque","tellus.","Praesent","eleifend","sed","diam","in","gravida.","Donec","tristique","sapien","ante,","in","egestas","diam","porta","ac.","Proin","ac","justo","eleifend,","consequat","ante","vitae,","laoreet","augue.","Mauris","scelerisque","arcu","dolor,","quis","lobortis","risus","pellentesque","eu.","Praesent","in","enim","a","elit","feugiat","dapibus.","Duis","quis","bibendum","mi.","Vestibulum","lacinia,","sem","at","efficitur","volutpat,","velit","ligula","vulputate","nisi,","sit","amet","dapibus","risus","metus","sed","est.","Sed","in","venenatis","ante.","Pellentesque","vel","ipsum","pharetra,","efficitur","quam","ut,","hendrerit","dolor."];var a=(u=>(u.Text="text",u.Input="input",u.Image="image",u.Video="video",u.WrapperElement="wrapper-element",u))(a||{}),d=(u=>(u.PrimaryColor="rgba(100, 100, 100, .6)",u.SecondaryColor="rgba(100, 100, 100, .3)",u))(d||{});class b{static daysInMs(e){return e*24*60*60*1e3}static dateBetween(e,i){return new Date(e.getTime()+Math.random()*(i.getTime()-e.getTime()))}}let q=0;class T{constructor(){w(this,l)}get value(){return y(this,l)}words(e){this.assertType();let i="",r=0;for(;r<e;)i+=this.randomLoremWord()+" ",r++;return m(this,l,i.trim()),this}paragraphs(e){this.assertType();let i="",r=0;const g=50;for(;r<e;){const p=g-Math.round(g*Math.random()*.2)*(Math.random()<.5?-1:1);i+=this.words(p).value,r!==e-1&&(i+=`
`),r++}return m(this,l,i),this}number(e=0,i=1e3){return this.assertType(),m(this,l,Math.ceil(Math.random()*(i-e))+e),this}multiply(e){return this.assertType(),m(this,l,y(this,l)*e),this}date(e={}){this.assertType();let i=e.max??new Date("2100-01-01"),r=e.min??new Date("1970-01-01");return e.isFuture?r=new Date(Date.now()+b.daysInMs(1)):e.isPast&&(i=new Date(Date.now()-b.daysInMs(1))),m(this,l,b.dateBetween(r,i)),this}uuid(){return q++,this.assertType(),m(this,l,q),this}boolean(){return this.assertType(),m(this,l,Math.random()<=.5),this}symbol(e=0){return this.assertType(),m(this,l,Symbol(e)),this}identical(e){return this.assertType(),m(this,l,e),this}assertType(){}randomLoremWord(){const e=Math.floor(Math.random()*s.length);return s[e]??"lorem"}}l=new WeakMap;let I=0;class c{constructor(e){this.generator=e,this.uuid=I++,this.viewModel=this.generator(),this.val=c.modelToValue(this.viewModel)}get value(){return this.val}static modelToValue(e){if(e instanceof T)return e.value;if(Array.isArray(e))return e.map(this.modelToValue);{const i={};return Object.keys(e).forEach(r=>{i[r]=c.modelToValue(e[r])}),i}}}class x{proxy(e){return e instanceof c?e.value:e}}class C{constructor(){this.config=null,this.viewModels=[]}setupModels(){if(this.config){const e=this.config.schemaGenerator;this.viewModels=Array.from({length:this.config.repeat},()=>new c(e))}}}const o=class o{static skeletonizeProjectedTemplate(e,i){const r=(i==null?void 0:i.primaryColor)??d.PrimaryColor,g=(i==null?void 0:i.secondaryColor)??d.SecondaryColor;e.setAttribute("style",`--skeletonizer-primary-color: ${r}; --skeletonizer-secondary-color: ${g};`),Array.from(e.querySelectorAll("*:not(svg, [data-skeletonizer])")).forEach(p=>{const P=["br","b","strong","i","em","mark","small","del","ins","sub","sup"],f=Array.from(p.childNodes).map(n=>n.nodeName.toLowerCase()).filter(n=>!P.includes(n)),k=f.length>0&&f.some(n=>n!==f[0]);p.childNodes.forEach(n=>{switch(n.nodeName.toLowerCase()){case"#text":{if(this.assertAs(n),n.wholeText.trim())if(k){const h=document.createElement("span");h.innerText=n.cloneNode().wholeText,h.innerText.length&&n.replaceWith(o.skeletonizedSpanGenerator(h.innerText,a.Text))}else{const h=o.skeletonizedSpanGenerator(p.innerHTML,a.Text);p.innerHTML=h.outerHTML}break}case"input":{n.setAttribute(o.dataAttr,a.Input);break}case"img":{n.setAttribute(o.dataAttr,a.Image);break}case"video":{n.setAttribute(o.dataAttr,a.Video);break}}})}),e.setAttribute(o.dataAttr,a.WrapperElement)}static skeletonizedSpanGenerator(e,i){const r=document.createElement("span");return r.innerHTML=e,r.setAttribute(o.dataAttr,i),r}static assertAs(e){}};o.dataAttr="data-skeletonizer";let v=o;t.Schema=c,t.SchemaItem=T,t.SkeletonAbstractComponent=x,t.SkeletonAdapterComponent=C,t.SkeletonDirective=v,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
{
"name": "@skeletonizer/utils",
"version": "0.0.19-alpha.0",
"version": "0.0.20-alpha.0",
"description": "Utils for all skeletonizer packages",

@@ -57,3 +57,3 @@ "author": "Luka Varga",

},
"gitHead": "4e0e1624e0f04c0e52658f573c15004ae2b9b3bd"
"gitHead": "8c8651dfea6a80f5b85e17ff097e6e23024cc7ac"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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