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

cobe

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cobe - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

52

dist/index.d.ts

@@ -1,37 +0,25 @@

import Phenomenon from "phenomenon";
import Phenomenon from 'phenomenon'
declare namespace OptionKey {
const OPT_PHI = "phi";
const OPT_THETA = "theta";
const OPT_DOTS = "mapSamples";
const OPT_MAP_BRIGHTNESS = "mapBrightness";
const OPT_BASE_COLOR = "baseColor";
const OPT_MARKER_COLOR = "markerColor";
const OPT_GLOW_COLOR = "glowColor";
const OPT_MARKERS = "markers";
const OPT_DIFFUSE = "diffuse";
const OPT_DPR = "devicePixelRatio";
const OPT_DARK = "dark";
}
export interface Marker {
location: [number, number];
size: number;
location: [number, number]
size: number
}
export interface COBEOptions {
width: number;
height: number;
onRender: (state: Record<string, any>) => void;
[OptionKey.OPT_PHI]: number;
[OptionKey.OPT_THETA]: number;
[OptionKey.OPT_DOTS]: number;
[OptionKey.OPT_MAP_BRIGHTNESS]: number;
[OptionKey.OPT_BASE_COLOR]: [number, number, number];
[OptionKey.OPT_MARKER_COLOR]: [number, number, number];
[OptionKey.OPT_GLOW_COLOR]: [number, number, number];
[OptionKey.OPT_MARKERS]: Marker[];
[OptionKey.OPT_DIFFUSE]: number;
[OptionKey.OPT_DPR]: number;
[OptionKey.OPT_DARK]: number;
width: number
height: number
onRender: (state: Record<string, any>) => void
phi: number
theta: number
mapSamples: number
mapBrightness: number
baseColor: [number, number, number]
markerColor: [number, number, number]
glowColor: [number, number, number]
markers: Marker[]
diffuse: number
devicePixelRatio: number
dark: number
offset?: [number, number]
scale?: number
}

@@ -42,2 +30,2 @@

opts: COBEOptions
): Phenomenon;
): Phenomenon

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

import I from"phenomenon";var M="phi",A="theta",T="mapSamples",c="mapBrightness",O="baseColor",s="markerColor",N="glowColor",L="markers",G="diffuse",u="devicePixelRatio",X="dark",m={[M]:"z",[A]:"A",[T]:"k",[c]:"C",[O]:"J",[s]:"K",[N]:"x",[G]:"D",[X]:"E"},{PI:S,sin:P,cos:f}=Math,x=E=>[].concat(...E.map(n=>{let[_,a]=n.location;_=_*S/180,a=a*S/180-S;let e=f(_);return[-e*f(a),P(_),e*P(a),n.size]}),[0,0,0,0]),h=(E,n)=>{let _=(e,t)=>({type:e,value:n[t]}),a=new I({canvas:E,context:{alpha:!0,stencil:!1,antialias:!0,depth:!1,preserveDrawingBuffer:!1},settings:{[u]:n[u]||1,onSetup:e=>{let t=e.RGB,r=e.UNSIGNED_BYTE,o=e.TEXTURE_2D,R=e.createTexture();e.bindTexture(o,R),e.texImage2D(o,0,t,1,1,0,t,r,new Uint8Array([0,0,0,0]));let i=new Image;i.onload=()=>{e.bindTexture(o,R),e.texImage2D(o,0,t,t,r,i),e.generateMipmap(o);let d=e.getParameter(e.CURRENT_PROGRAM),U=e.getUniformLocation(d,"F");e.texParameteri(o,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(o,e.TEXTURE_MAG_FILTER,e.NEAREST),e.uniform1i(U,0)},i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAACAAQAAAADMzoqnAAAAAXNSR0IArs4c6QAABA5JREFUeNrV179uHEUAx/Hf3JpbF+E2VASBsmVKTBcpKJs3SMEDcDwBiVJAAewYEBUivIHT0uUBIt0YCovKD0CRjUC4QfHYh8hYXu+P25vZ2Zm9c66gMd/GJ/tz82d3bk8GN4SrByYF2366FNTACIAkivVAAazQdnf3MvAlbNUQfOPAdQDvSAimMWhwy4I2g4SU+Kp04ISLpPBAKLxPyic3O/CCi+Y7rUJbiodcpDOFY7CgxCEXmdYD2EYK2s5lApOx5pEDDYCUwM1XdJUwBV11QQMg59kePSCaPAASQMEL2hwo6TJFgxpg+TgC2ymXPbuvc40awr3D1QCFfbH9kcoqAOk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U5ErkJggg=="}}});return a.add("",{vertex:"attribute vec3 aPosition;uniform mat4 uProjectionMatrix;uniform mat4 uModelMatrix;uniform mat4 uViewMatrix;void main(){gl_Position=uProjectionMatrix*uModelMatrix*uViewMatrix*vec4(aPosition,1.);}",fragment:"precision highp float;uniform vec2 u;uniform vec3 J,K,x;uniform vec4 y[64];uniform float z,A,k,B,C,D,E;uniform sampler2D F;float G=1./k;mat3 H(float a,float b){float c=cos(a),d=cos(b),e=sin(a),f=sin(b);return mat3(d,f*e,-f*c,0.,c,e,f,d*-e,d*c);}vec3 v(vec3 c,out float w){c=c.xzy;float p=max(2.,floor(log2(2.236068*k*3.141593*(1.-c.z*c.z))*.72021));vec2 g=floor(pow(1.618034,p)/2.236068*vec2(1.,1.618034)+.5),d=fract((g+1.)*.618034)*6.283185-3.883222,e=-2.*g,f=vec2(atan(c.y,c.x),c.z-1.),q=floor(vec2(e.y*f.x-d.y*(f.y*k+1.),-e.x*f.x+d.x*(f.y*k+1.))/(d.x*e.y-e.x*d.y));float n=3.141593;vec3 r;for(float h=0.;h<4.;h+=1.){vec2 s=vec2(mod(h,2.),floor(h*.5));float j=dot(g,q+s);if(j>k)continue;float a=j,b=0.;if(a>=524288.)a-=524288.,b+=.803894;if(a>=262144.)a-=262144.,b+=.901947;if(a>=131072.)a-=131072.,b+=.950973;if(a>=65536.)a-=65536.,b+=.475487;if(a>=32768.)a-=32768.,b+=.737743;if(a>=16384.)a-=16384.,b+=.868872;if(a>=8192.)a-=8192.,b+=.934436;if(a>=4096.)a-=4096.,b+=.467218;if(a>=2048.)a-=2048.,b+=.733609;if(a>=1024.)a-=1024.,b+=.866804;if(a>=512.)a-=512.,b+=.433402;if(a>=256.)a-=256.,b+=.216701;if(a>=128.)a-=128.,b+=.108351;if(a>=64.)a-=64.,b+=.554175;if(a>=32.)a-=32.,b+=.777088;if(a>=16.)a-=16.,b+=.888544;if(a>=8.)a-=8.,b+=.944272;if(a>=4.)a-=4.,b+=.472136;if(a>=2.)a-=2.,b+=.236068;if(a>=1.)a-=1.,b+=.618034;float l=fract(b)*6.283185,i=1.-2.*j*G,m=sqrt(1.-i*i);vec3 o=vec3(cos(l)*m,sin(l)*m,i);float t=length(c-o);if(t<n)n=t,r=o;}w=n;return r.xzy;}void main(){vec2 a=gl_FragCoord.xy/u*2.-1.;a.x*=u.x/u.y;float c=dot(a,a),b;vec3 d=vec3(0.,0.,1.),e=normalize(vec3(a,sqrt(.64-c)));if(c<=.64){vec3 f=e*H(A,z),g=v(f,b);float j=asin(g.y),h=acos(-g.x/cos(j));h=g.z<0.?-h:h;float s=texture2D(F,vec2(h*.5/3.141593,-(j/3.141593+.5))).x,t=smoothstep(8e-3,0.,b),l=dot(e,d),r=pow(l,D)*C,m=s*t*r,L=mix((1.-m)*pow(l,.4),m,E)+.1;gl_FragColor=vec4(J*L,1.);int M=int(B);float n=0.;for(int i=0;i<64;i++){if(i>=M)break;vec4 o=y[i];vec3 p=o.xyz,w=p-f;float q=o.w;if(dot(w,w)>q*q*4.)continue;vec3 N=v(p,b);b=length(N-f),b<q?n+=smoothstep(q*.5,0.,b):0.;}n=min(1.,n*r),gl_FragColor.xyz=mix(gl_FragColor.xyz,K,n),gl_FragColor.xyz+=pow(1.-dot(e,d),4.)*x;}float I=pow(dot(normalize(vec3(-a,sqrt(1.-c))),d),4.)*smoothstep(.1,1.,.2/(c-.64));gl_FragColor+=vec4(I*x,I);}",uniforms:{u:{type:"vec2",value:[n.width,n.height]},z:_("float",M),A:_("float",A),k:_("float",T),C:_("float",c),J:_("vec3",O),K:_("vec3",s),D:_("float",G),x:_("vec3",N),E:_("float",X),y:{type:"vec4",value:x(n[L])},B:{type:"float",value:n[L].length}},mode:4,geometry:{vertices:[{x:-100,y:100,z:0},{x:-100,y:-100,z:0},{x:100,y:100,z:0},{x:100,y:-100,z:0},{x:-100,y:-100,z:0},{x:100,y:100,z:0}]},onRender:({uniforms:e})=>{let t={};if(n.onRender){n.onRender(t);for(let r in m)t[r]!==void 0&&(e[m[r]].value=t[r]);t[L]!==void 0&&(e["y"].value=x(t[L]),e["B"].value=t[L].length),t.width&&t.height&&(e["u"].value=[t.width,t.height])}}}),a};export{h as default};
import I from"phenomenon";var M="phi",R="theta",T="mapSamples",c="mapBrightness",O="baseColor",s="markerColor",N="glowColor",a="markers",G="diffuse",X="devicePixelRatio",u="dark",f="offset",P="scale",m={[M]:"A",[R]:"B",[T]:"k",[c]:"E",[O]:"L",[s]:"M",[N]:"y",[G]:"F",[u]:"G",[f]:"x",[P]:"C"},{PI:i,sin:d,cos:x}=Math,U=r=>[].concat(...r.map(n=>{let[_,L]=n.location;_=_*i/180,L=L*i/180-i;let e=x(_);return[-e*x(L),d(_),e*d(L),n.size]}),[0,0,0,0]),D=(r,n)=>{let _=(e,t,o)=>({type:e,value:typeof n[t]=="undefined"?o:n[t]}),L=new I({canvas:r,context:{alpha:!0,stencil:!1,antialias:!0,depth:!1,preserveDrawingBuffer:!1},settings:{[X]:n[X]||1,onSetup:e=>{let t=e.RGB,o=e.UNSIGNED_BYTE,E=e.TEXTURE_2D,A=e.createTexture();e.bindTexture(E,A),e.texImage2D(E,0,t,1,1,0,t,o,new Uint8Array([0,0,0,0]));let S=new Image;S.onload=()=>{e.bindTexture(E,A),e.texImage2D(E,0,t,t,o,S),e.generateMipmap(E);let l=e.getParameter(e.CURRENT_PROGRAM),v=e.getUniformLocation(l,"H");e.texParameteri(E,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(E,e.TEXTURE_MAG_FILTER,e.NEAREST),e.uniform1i(v,0)},S.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAACAAQAAAADMzoqnAAAAAXNSR0IArs4c6QAABA5JREFUeNrV179uHEUAx/Hf3JpbF+E2VASBsmVKTBcpKJs3SMEDcDwBiVJAAewYEBUivIHT0uUBIt0YCovKD0CRjUC4QfHYh8hYXu+P25vZ2Zm9c66gMd/GJ/tz82d3bk8GN4SrByYF2366FNTACIAkivVAAazQdnf3Mv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KGwEwC1CiQewJc5EKfgy7GmRAZA4vUVGwE2dPM/g0xuAInE/yG5aZ8ISxWGfYigUVbdyBElTHh2uCwGdfCkOLGgQVBh3Ewp+/QK4CDlR5Ws/Zf7yhCf8pH7vinWAvoVCQ6zz0NX5V/6GkAVV+2/5qsJ/gU8bsxpM8IeAQAAAABJRU5ErkJggg=="}}});return L.add("",{vertex:"attribute vec3 aPosition;uniform mat4 uProjectionMatrix;uniform mat4 uModelMatrix;uniform mat4 uViewMatrix;void main(){gl_Position=uProjectionMatrix*uModelMatrix*uViewMatrix*vec4(aPosition,1.);}",fragment:"precision highp float;uniform vec2 r,x;uniform vec3 L,M,y;uniform vec4 z[64];uniform float A,B,k,C,D,E,F,G;uniform sampler2D H;float I=1./k;mat3 J(float a,float b){float c=cos(a),d=cos(b),e=sin(a),f=sin(b);return mat3(d,f*e,-f*c,0.,c,e,f,d*-e,d*c);}vec3 v(vec3 c,out float w){c=c.xzy;float p=max(2.,floor(log2(2.236068*k*3.141593*(1.-c.z*c.z))*.72021));vec2 g=floor(pow(1.618034,p)/2.236068*vec2(1.,1.618034)+.5),d=fract((g+1.)*.618034)*6.283185-3.883222,e=-2.*g,f=vec2(atan(c.y,c.x),c.z-1.),q=floor(vec2(e.y*f.x-d.y*(f.y*k+1.),-e.x*f.x+d.x*(f.y*k+1.))/(d.x*e.y-e.x*d.y));float n=3.141593;vec3 s;for(float h=0.;h<4.;h+=1.){vec2 t=vec2(mod(h,2.),floor(h*.5));float j=dot(g,q+t);if(j>k)continue;float a=j,b=0.;if(a>=524288.)a-=524288.,b+=.803894;if(a>=262144.)a-=262144.,b+=.901947;if(a>=131072.)a-=131072.,b+=.950973;if(a>=65536.)a-=65536.,b+=.475487;if(a>=32768.)a-=32768.,b+=.737743;if(a>=16384.)a-=16384.,b+=.868872;if(a>=8192.)a-=8192.,b+=.934436;if(a>=4096.)a-=4096.,b+=.467218;if(a>=2048.)a-=2048.,b+=.733609;if(a>=1024.)a-=1024.,b+=.866804;if(a>=512.)a-=512.,b+=.433402;if(a>=256.)a-=256.,b+=.216701;if(a>=128.)a-=128.,b+=.108351;if(a>=64.)a-=64.,b+=.554175;if(a>=32.)a-=32.,b+=.777088;if(a>=16.)a-=16.,b+=.888544;if(a>=8.)a-=8.,b+=.944272;if(a>=4.)a-=4.,b+=.472136;if(a>=2.)a-=2.,b+=.236068;if(a>=1.)a-=1.,b+=.618034;float l=fract(b)*6.283185,i=1.-2.*j*I,m=sqrt(1.-i*i);vec3 o=vec3(cos(l)*m,sin(l)*m,i);float u=length(c-o);if(u<n)n=u,s=o;}w=n;return s.xzy;}void main(){vec2 a=(gl_FragCoord.xy/r*2.-1.)/C-x*vec2(1.,-1.)/r;a.x*=r.x/r.y;float c=dot(a,a),b;vec3 d=vec3(0.,0.,1.),e=normalize(vec3(a,sqrt(.64-c)));if(c<=.64){vec3 f=e*J(B,A),g=v(f,b);float j=asin(g.y),h=acos(-g.x/cos(j));h=g.z<0.?-h:h;float t=texture2D(H,vec2(h*.5/3.141593,-(j/3.141593+.5))).x,u=smoothstep(8e-3,0.,b),l=dot(e,d),s=pow(l,F)*E,m=t*u*s,N=mix((1.-m)*pow(l,.4),m,G)+.1;gl_FragColor=vec4(L*N,1.);int O=int(D);float n=0.;for(int i=0;i<64;i++){if(i>=O)break;vec4 o=z[i];vec3 p=o.xyz,w=p-f;float q=o.w;if(dot(w,w)>q*q*4.)continue;vec3 P=v(p,b);b=length(P-f),b<q?n+=smoothstep(q*.5,0.,b):0.;}n=min(1.,n*s),gl_FragColor.xyz=mix(gl_FragColor.xyz,M,n),gl_FragColor.xyz+=pow(1.-dot(e,d),4.)*y;}float K=pow(dot(normalize(vec3(-a,sqrt(1.-c))),d),4.)*smoothstep(.1,1.,.2/(c-.64));gl_FragColor+=vec4(K*y,K);}",uniforms:{r:{type:"vec2",value:[n.width,n.height]},A:_("float",M),B:_("float",R),k:_("float",T),E:_("float",c),L:_("vec3",O),M:_("vec3",s),F:_("float",G),y:_("vec3",N),G:_("float",u),z:{type:"vec4",value:U(n[a])},D:{type:"float",value:n[a].length},x:_("vec2",f,[0,0]),C:_("float",P,1)},mode:4,geometry:{vertices:[{x:-100,y:100,z:0},{x:-100,y:-100,z:0},{x:100,y:100,z:0},{x:100,y:-100,z:0},{x:-100,y:-100,z:0},{x:100,y:100,z:0}]},onRender:({uniforms:e})=>{let t={};if(n.onRender){n.onRender(t);for(let o in m)t[o]!==void 0&&(e[m[o]].value=t[o]);t[a]!==void 0&&(e["z"].value=U(t[a]),e["D"].value=t[a].length),t.width&&t.height&&(e["r"].value=[t.width,t.height])}}}),L};export{D as default};
{
"name": "cobe",
"version": "0.4.2",
"version": "0.5.0",
"type": "module",

@@ -14,3 +14,3 @@ "main": "./dist/index.esm.js",

"build:esm": "node scripts/build.js && cp src/index.d.ts dist/index.d.ts",
"build": "yarn build:esm"
"build": "pnpm build:esm"
},

@@ -17,0 +17,0 @@ "dependencies": {

@@ -39,2 +39,3 @@

diffuse: 1.2,
scale: 1,
mapSamples: 16000,

@@ -45,2 +46,3 @@ mapBrightness: 6,

glowColor: [1, 1, 1],
offset: [0, 0],
markers: [

@@ -47,0 +49,0 @@ { location: [37.7595, -122.4367], size: 0.03 },

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