spoilerjs 0.1.1 → 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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Shajid Hasan
3
+ Copyright (c) 2025 Shajid Hasan
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1 +1 @@
1
- import{p as t,H as i,h as s}from"./p-CTHKI95o.js";class e{particles=[];config;width;height;spawningEnabled=!0;particleSizes=[{width:1,height:1},{width:1,height:2},{width:2,height:1},{width:2,height:2}];constructor(t,i,s){this.config=t,this.width=i,this.height=s,this.initializeParticles()}updateDimensions(t,i){this.width=t,this.height=i}initializeParticles(){const t=Math.ceil(.5*Math.ceil(this.width*this.height/100*this.config.density));for(let i=0;i<t;i++){const t=this.createParticle();t.life=Math.random()*t.maxLife,this.particles.push(t)}}createParticle(){const t=this.particleSizes[Math.floor(Math.random()*this.particleSizes.length)],i=this.config.scale,s=t.width*i,e=t.height*i,n=this.width-s-2,o=this.height-e-2,h=2+Math.random()*Math.max(0,n-2),a=2+Math.random()*Math.max(0,o-2),r=Math.random()*(this.config.maxVelocity-this.config.minVelocity)+this.config.minVelocity,l=Math.random()*Math.PI*2,c=Math.cos(l)*r,d=Math.sin(l)*r,u=.5*this.config.particleLifetime,p=1.5*this.config.particleLifetime,w=Math.random()*(p-u)+u;return{x:h,y:a,vx:c,vy:d,width:s,height:e,life:w,maxLife:w,alpha:0,maxAlpha:Math.random()<.5?1:.3+.3*Math.random()}}update(){const t=Math.ceil(this.width*this.height/100*this.config.density);for(let t=this.particles.length-1;t>=0;t--){const i=this.particles[t];i.x+=i.vx,i.y+=i.vy,i.life--;const s=.2*i.maxLife,e=.2*i.maxLife;i.alpha=i.life>i.maxLife-s?(i.maxLife-i.life)/s*i.maxAlpha:i.life<e?i.life/e*i.maxAlpha:i.maxAlpha;const n=.5*Math.max(this.width,this.height);(i.life<=0||i.x<-n||i.x>this.width+n||i.y<-n||i.y>this.height+n)&&this.particles.splice(t,1)}if(this.spawningEnabled)for(;this.particles.length<t;)this.particles.push(this.createParticle())}draw(t){t.fillStyle=this.config.textColor,this.particles.forEach((i=>{i.alpha>0&&(t.globalAlpha=i.alpha,t.fillRect(Math.round(i.x),Math.round(i.y),Math.ceil(i.width),Math.ceil(i.height)))})),t.globalAlpha=1}stopSpawning(){this.spawningEnabled=!1}hasParticles(){return this.particles.length>0}getMaxParticleLifetime(){if(0===this.particles.length)return 0;let t=0;for(const i of this.particles)i.life>t&&(t=i.life);return t}getParticles(){return this.particles}clear(){this.particles=[]}}const n=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get el(){return this}scale=1;minVelocity=.01;maxVelocity=.05;particleLifetime=120;density=8;revealDuration=500;spawnStopDelay=0;monitorPosition=!1;revealing=!1;revealed=!1;canvases=[];contexts=[];particleManagers=[];animationFrameId=null;textColor="#000000";slotElement;containerDiv;resizeObserver;scrollHandler;resizeHandler;updateDebounceTimer=null;setupDebounceTimer=null;dpr=window.devicePixelRatio||1;lastKnownWidth=0;lastKnownHeight=0;positionMonitorId=null;isMonitoringPosition=!1;componentDidLoad(){this.setupSpoiler(),this.resizeObserver=new ResizeObserver((t=>{if(!this.revealed)for(const i of t){const t=i.contentRect.width,s=i.contentRect.height;t===this.lastKnownWidth&&s===this.lastKnownHeight||(this.lastKnownWidth=t,this.lastKnownHeight=s,this.handleSizeChange())}})),this.resizeObserver.observe(this.containerDiv),this.scrollHandler=()=>{this.revealed||this.debouncedUpdateCanvasPositions()},this.resizeHandler=()=>{this.revealed||this.handleSizeChange()},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.resizeHandler,{passive:!0}),this.monitorPosition&&this.startPositionMonitoring()}disconnectedCallback(){this.cleanup(),this.stopPositionMonitoring(),this.resizeObserver&&this.resizeObserver.disconnect(),null!==this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),null!==this.setupDebounceTimer&&clearTimeout(this.setupDebounceTimer),window.removeEventListener("scroll",this.scrollHandler),window.removeEventListener("resize",this.resizeHandler)}cleanup(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.canvases.forEach((t=>{t.parentNode&&t.parentNode.removeChild(t)})),this.canvases=[],this.contexts=[],this.particleManagers=[]}handleSizeChange(){null!==this.setupDebounceTimer&&clearTimeout(this.setupDebounceTimer),this.setupDebounceTimer=window.setTimeout((()=>{this.setupSpoiler(),this.setupDebounceTimer=null}),50)}startPositionMonitoring(){this.isMonitoringPosition||(this.isMonitoringPosition=!0,this.monitorPositionLoop())}stopPositionMonitoring(){this.isMonitoringPosition=!1,null!==this.positionMonitorId&&(cancelAnimationFrame(this.positionMonitorId),this.positionMonitorId=null)}monitorPositionLoop=()=>{this.isMonitoringPosition&&!this.revealed?(this.updateCanvasPositionsImmediate(),this.positionMonitorId=requestAnimationFrame(this.monitorPositionLoop)):this.positionMonitorId=null};updateCanvasPositionsImmediate(){const t=this.slotElement.assignedNodes();if(0===t.length)return;const i=document.createRange();let s=0;const e=window.scrollX??window.pageXOffset,n=window.scrollY??window.pageYOffset;t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE){i.selectNodeContents(t);const o=i.getClientRects();for(let t=0;t<o.length;t++){const i=o[t];if(i.width>0&&i.height>0&&s<this.canvases.length){const t=this.canvases[s],o=i.left+e,h=i.top+n,a=parseFloat(t.style.left),r=parseFloat(t.style.top);(Math.abs(o-a)>.5||Math.abs(h-r)>.5)&&(t.style.left=o+"px",t.style.top=h+"px"),s++}}}else if(t.nodeType===Node.ELEMENT_NODE){const i=t.getClientRects();for(let t=0;t<i.length&&s<this.canvases.length;t++){const o=i[t];if(o.width>0&&o.height>0){const t=this.canvases[s],i=o.left+e,h=o.top+n,a=parseFloat(t.style.left),r=parseFloat(t.style.top);(Math.abs(i-a)>.5||Math.abs(h-r)>.5)&&(t.style.left=i+"px",t.style.top=h+"px"),s++}}}}))}debouncedUpdateCanvasPositions(){null!==this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout((()=>{this.updateCanvasPositions(),this.updateDebounceTimer=null}),16)}setupSpoiler(){this.cleanup();const t=window.getComputedStyle(this.el);this.textColor=t.color;const i=this.getTextBoundingBoxes();if(0===i.length)return;const s=this.containerDiv.getBoundingClientRect();this.lastKnownWidth=s.width,this.lastKnownHeight=s.height;const n={scale:this.scale,minVelocity:this.minVelocity,maxVelocity:this.maxVelocity,particleLifetime:this.particleLifetime,density:this.density,textColor:this.textColor};i.forEach((t=>{const i=document.createElement("canvas");i.width=t.width*this.dpr,i.height=t.height*this.dpr,i.style.width=t.width+"px",i.style.height=t.height+"px",i.style.position="absolute",i.style.left=t.x+"px",i.style.top=t.y+"px",i.style.pointerEvents="none",i.style.zIndex="1",document.body.appendChild(i);const s=i.getContext("2d",{alpha:!0});if(!s)return console.error("Failed to get 2D context for spoiler canvas"),void i.remove();s.scale(this.dpr,this.dpr),this.canvases.push(i),this.contexts.push(s);const o=new e(n,t.width,t.height);this.particleManagers.push(o)})),this.animate()}updateCanvasPositions(){const t=this.slotElement.assignedNodes();if(0===t.length)return;const i=document.createRange();let s=0;const e=window.scrollX??window.pageXOffset,n=window.scrollY??window.pageYOffset;t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE){i.selectNodeContents(t);const o=i.getClientRects();for(let t=0;t<o.length;t++){const i=o[t];if(i.width>0&&i.height>0&&s<this.canvases.length){const t=this.canvases[s];t.style.left=i.left+e+"px",t.style.top=i.top+n+"px",s++}}}else if(t.nodeType===Node.ELEMENT_NODE){const i=t.getClientRects();for(let t=0;t<i.length&&s<this.canvases.length;t++){const o=i[t];if(o.width>0&&o.height>0){const t=this.canvases[s];t.style.left=o.left+e+"px",t.style.top=o.top+n+"px",s++}}}}))}getTextBoundingBoxes(){const t=[],i=this.slotElement.assignedNodes();if(0===i.length)return t;const s=document.createRange(),e=window.scrollX??window.pageXOffset,n=window.scrollY??window.pageYOffset;return i.forEach((i=>{if(i.nodeType===Node.TEXT_NODE){s.selectNodeContents(i);const o=s.getClientRects();for(let i=0;i<o.length;i++){const s=o[i];s.width>0&&s.height>0&&t.push({x:s.left+e,y:s.top+n,width:s.width,height:s.height})}}else if(i.nodeType===Node.ELEMENT_NODE){const s=i.getClientRects();for(let i=0;i<s.length;i++){const o=s[i];o.width>0&&o.height>0&&t.push({x:o.left+e,y:o.top+n,width:o.width,height:o.height})}}})),t}animate=()=>{if(this.revealed)return;const t=this.particleManagers.every((t=>!t.hasParticles()));if(this.revealing&&t)return this.revealed=!0,this.stopPositionMonitoring(),this.cleanup(),void this.canvases.forEach((t=>t.remove()));this.particleManagers.forEach(((t,i)=>{const s=this.contexts[i],e=this.canvases[i];s.clearRect(0,0,e.width/this.dpr,e.height/this.dpr),t.update(),t.draw(s)})),this.animationFrameId=requestAnimationFrame(this.animate)};handleClick=()=>{this.revealed||this.revealing||(this.revealing=!0,setTimeout((()=>{this.particleManagers.forEach((t=>{t.stopSpawning()}))}),this.spawnStopDelay))};handleKeyDown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick())};render(){return s("div",{key:"9296a6978a17eb4944817639c04e0c3dbc9227b6",ref:t=>this.containerDiv=t,class:this.revealed?"revealed":this.revealing?"revealing":"hidden",style:this.revealing?{"--reveal-duration":this.revealDuration+"ms"}:{},onClick:this.handleClick,onKeyDown:this.handleKeyDown,role:"button",tabindex:this.revealed?-1:0,"aria-label":this.revealed?void 0:"Click to reveal spoiler","aria-pressed":this.revealed},s("slot",{key:"71b94b57e204778557b4d9417e7034dd70119006",ref:t=>this.slotElement=t}))}static get style(){return":host{display:inline}div{position:relative;display:inline;cursor:pointer;user-select:none}div.hidden{color:transparent;text-shadow:none}div.revealing{cursor:pointer;user-select:none;animation:fadeInText var(--reveal-duration, 600ms) ease-out forwards}div.revealed{color:inherit;cursor:default;user-select:text}@keyframes fadeInText{from{color:transparent}to{color:inherit}}"}},[257,"spoiler-span",{scale:[2],minVelocity:[2,"min-velocity"],maxVelocity:[2,"max-velocity"],particleLifetime:[2,"particle-lifetime"],density:[2],revealDuration:[2,"reveal-duration"],spawnStopDelay:[2,"spawn-stop-delay"],monitorPosition:[4,"monitor-position"],revealing:[32],revealed:[32]}]);function o(){"undefined"!=typeof customElements&&["spoiler-span"].forEach((t=>{"spoiler-span"===t&&(customElements.get(t)||customElements.define(t,n))}))}o();const h=n,a=o;export{h as SpoilerSpan,a as defineCustomElement}
1
+ import{p as t,H as i,h as s}from"./p-CTHKI95o.js";class e{particles=[];config;width;height;spawningEnabled=!0;particleSizes=[{width:1,height:1},{width:1,height:2},{width:2,height:1},{width:2,height:2}];constructor(t,i,s){this.config=t,this.width=i,this.height=s,this.initializeParticles()}updateDimensions(t,i){this.width=t,this.height=i}initializeParticles(){const t=Math.ceil(.5*Math.ceil(this.width*this.height/100*this.config.density));for(let i=0;i<t;i++){const t=this.createParticle();t.life=Math.random()*t.maxLife,this.particles.push(t)}}createParticle(){const t=this.particleSizes[Math.floor(Math.random()*this.particleSizes.length)],i=this.config.scale,s=t.width*i,e=t.height*i,n=this.width-s-2,o=this.height-e-2,h=2+Math.random()*Math.max(0,n-2),a=2+Math.random()*Math.max(0,o-2),r=Math.random()*(this.config.maxVelocity-this.config.minVelocity)+this.config.minVelocity,l=Math.random()*Math.PI*2,c=Math.cos(l)*r,d=Math.sin(l)*r,u=.5*this.config.particleLifetime,p=1.5*this.config.particleLifetime,m=Math.random()*(p-u)+u;return{x:h,y:a,vx:c,vy:d,width:s,height:e,life:m,maxLife:m,alpha:0,maxAlpha:Math.random()<.5?1:.3+.3*Math.random()}}update(){const t=Math.ceil(this.width*this.height/100*this.config.density);for(let t=this.particles.length-1;t>=0;t--){const i=this.particles[t];i.x+=i.vx,i.y+=i.vy,i.life--;const s=.2*i.maxLife,e=.2*i.maxLife;i.alpha=i.life>i.maxLife-s?(i.maxLife-i.life)/s*i.maxAlpha:i.life<e?i.life/e*i.maxAlpha:i.maxAlpha;const n=.5*Math.max(this.width,this.height);(i.life<=0||i.x<-n||i.x>this.width+n||i.y<-n||i.y>this.height+n)&&this.particles.splice(t,1)}if(this.spawningEnabled)for(;this.particles.length<t;)this.particles.push(this.createParticle())}draw(t){t.fillStyle=this.config.textColor,this.particles.forEach((i=>{i.alpha>0&&(t.globalAlpha=i.alpha,t.fillRect(Math.round(i.x),Math.round(i.y),Math.ceil(i.width),Math.ceil(i.height)))})),t.globalAlpha=1}stopSpawning(){this.spawningEnabled=!1}hasParticles(){return this.particles.length>0}getMaxParticleLifetime(){if(0===this.particles.length)return 0;let t=0;for(const i of this.particles)i.life>t&&(t=i.life);return t}getParticles(){return this.particles}clear(){this.particles=[]}}const n=t(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get el(){return this}scale=1;minVelocity=.01;maxVelocity=.05;particleLifetime=120;density=8;revealDuration=300;spawnStopDelay=0;monitorPosition=!1;fps=60;revealing=!1;revealed=!1;canvases=[];contexts=[];particleManagers=[];animationFrameId=null;textColor="#000000";slotElement;containerDiv;resizeObserver;scrollHandler;resizeHandler;updateDebounceTimer=null;setupDebounceTimer=null;dpr=window.devicePixelRatio||1;lastKnownWidth=0;lastKnownHeight=0;positionMonitorId=null;isMonitoringPosition=!1;lastFrameTime=0;frameInterval=1e3/60;componentDidLoad(){this.frameInterval=1e3/Math.max(1,this.fps),this.setupSpoiler(),this.resizeObserver=new ResizeObserver((t=>{if(!this.revealed)for(const i of t){const t=i.contentRect.width,s=i.contentRect.height;t===this.lastKnownWidth&&s===this.lastKnownHeight||(this.lastKnownWidth=t,this.lastKnownHeight=s,this.handleSizeChange())}})),this.resizeObserver.observe(this.containerDiv),this.scrollHandler=()=>{this.revealed||this.debouncedUpdateCanvasPositions()},this.resizeHandler=()=>{this.revealed||this.handleSizeChange()},window.addEventListener("scroll",this.scrollHandler,{passive:!0}),window.addEventListener("resize",this.resizeHandler,{passive:!0}),this.monitorPosition&&this.startPositionMonitoring()}disconnectedCallback(){this.cleanup(),this.stopPositionMonitoring(),this.resizeObserver&&this.resizeObserver.disconnect(),null!==this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),null!==this.setupDebounceTimer&&clearTimeout(this.setupDebounceTimer),window.removeEventListener("scroll",this.scrollHandler),window.removeEventListener("resize",this.resizeHandler)}cleanup(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.canvases.forEach((t=>{t.parentNode&&t.parentNode.removeChild(t)})),this.canvases=[],this.contexts=[],this.particleManagers=[]}handleSizeChange(){null!==this.setupDebounceTimer&&clearTimeout(this.setupDebounceTimer),this.setupDebounceTimer=window.setTimeout((()=>{this.setupSpoiler(),this.setupDebounceTimer=null}),50)}startPositionMonitoring(){this.isMonitoringPosition||(this.isMonitoringPosition=!0,this.monitorPositionLoop())}stopPositionMonitoring(){this.isMonitoringPosition=!1,null!==this.positionMonitorId&&(cancelAnimationFrame(this.positionMonitorId),this.positionMonitorId=null)}monitorPositionLoop=()=>{this.isMonitoringPosition&&!this.revealed?(this.updateCanvasPositionsImmediate(),this.positionMonitorId=requestAnimationFrame(this.monitorPositionLoop)):this.positionMonitorId=null};updateCanvasPositionsImmediate(){const t=this.slotElement.assignedNodes();if(0===t.length)return;const i=document.createRange();let s=0;const e=window.scrollX??window.pageXOffset,n=window.scrollY??window.pageYOffset;t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE){i.selectNodeContents(t);const o=i.getClientRects();for(let t=0;t<o.length;t++){const i=o[t];if(i.width>0&&i.height>0&&s<this.canvases.length){const t=this.canvases[s],o=i.left+e,h=i.top+n,a=parseFloat(t.style.left),r=parseFloat(t.style.top);(Math.abs(o-a)>.5||Math.abs(h-r)>.5)&&(t.style.left=o+"px",t.style.top=h+"px"),s++}}}else if(t.nodeType===Node.ELEMENT_NODE){const i=t.getClientRects();for(let t=0;t<i.length&&s<this.canvases.length;t++){const o=i[t];if(o.width>0&&o.height>0){const t=this.canvases[s],i=o.left+e,h=o.top+n,a=parseFloat(t.style.left),r=parseFloat(t.style.top);(Math.abs(i-a)>.5||Math.abs(h-r)>.5)&&(t.style.left=i+"px",t.style.top=h+"px"),s++}}}}))}debouncedUpdateCanvasPositions(){null!==this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout((()=>{this.updateCanvasPositions(),this.updateDebounceTimer=null}),16)}setupSpoiler(){this.cleanup();const t=window.getComputedStyle(this.el);this.textColor=t.color;const i=this.getTextBoundingBoxes();if(0===i.length)return;const s=this.containerDiv.getBoundingClientRect();this.lastKnownWidth=s.width,this.lastKnownHeight=s.height;const n={scale:this.scale,minVelocity:this.minVelocity,maxVelocity:this.maxVelocity,particleLifetime:this.particleLifetime,density:this.density,textColor:this.textColor};i.forEach((t=>{const i=document.createElement("canvas");i.width=t.width*this.dpr,i.height=t.height*this.dpr,i.style.width=t.width+"px",i.style.height=t.height+"px",i.style.position="absolute",i.style.left=t.x+"px",i.style.top=t.y+"px",i.style.pointerEvents="none",i.style.zIndex="1",document.body.appendChild(i);const s=i.getContext("2d",{alpha:!0});if(!s)return console.error("Failed to get 2D context for spoiler canvas"),void i.remove();s.scale(this.dpr,this.dpr),this.canvases.push(i),this.contexts.push(s);const o=new e(n,t.width,t.height);this.particleManagers.push(o)})),this.animate()}updateCanvasPositions(){const t=this.slotElement.assignedNodes();if(0===t.length)return;const i=document.createRange();let s=0;const e=window.scrollX??window.pageXOffset,n=window.scrollY??window.pageYOffset;t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE){i.selectNodeContents(t);const o=i.getClientRects();for(let t=0;t<o.length;t++){const i=o[t];if(i.width>0&&i.height>0&&s<this.canvases.length){const t=this.canvases[s];t.style.left=i.left+e+"px",t.style.top=i.top+n+"px",s++}}}else if(t.nodeType===Node.ELEMENT_NODE){const i=t.getClientRects();for(let t=0;t<i.length&&s<this.canvases.length;t++){const o=i[t];if(o.width>0&&o.height>0){const t=this.canvases[s];t.style.left=o.left+e+"px",t.style.top=o.top+n+"px",s++}}}}))}getTextBoundingBoxes(){const t=[],i=this.slotElement.assignedNodes();if(0===i.length)return t;const s=document.createRange(),e=window.scrollX??window.pageXOffset,n=window.scrollY??window.pageYOffset;return i.forEach((i=>{if(i.nodeType===Node.TEXT_NODE){s.selectNodeContents(i);const o=s.getClientRects();for(let i=0;i<o.length;i++){const s=o[i];s.width>0&&s.height>0&&t.push({x:s.left+e,y:s.top+n,width:s.width,height:s.height})}}else if(i.nodeType===Node.ELEMENT_NODE){const s=i.getClientRects();for(let i=0;i<s.length;i++){const o=s[i];o.width>0&&o.height>0&&t.push({x:o.left+e,y:o.top+n,width:o.width,height:o.height})}}})),t}animate=(t=0)=>{if(this.revealed)return;const i=t-this.lastFrameTime;if(i<this.frameInterval)return void(this.animationFrameId=requestAnimationFrame(this.animate));this.lastFrameTime=t-i%this.frameInterval;const s=this.particleManagers.every((t=>!t.hasParticles()));if(this.revealing&&s)return this.revealed=!0,this.stopPositionMonitoring(),this.cleanup(),void this.canvases.forEach((t=>t.remove()));this.particleManagers.forEach(((t,i)=>{const s=this.contexts[i],e=this.canvases[i];s.clearRect(0,0,e.width/this.dpr,e.height/this.dpr),t.update(),t.draw(s)})),this.animationFrameId=requestAnimationFrame(this.animate)};handleClick=()=>{this.revealed||this.revealing||(this.revealing=!0,setTimeout((()=>{this.particleManagers.forEach((t=>{t.stopSpawning()}))}),this.spawnStopDelay))};handleKeyDown=t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick())};render(){return s("div",{key:"5c608f3aaf71c06a4b18550b3aaab88fbe250edb",ref:t=>this.containerDiv=t,class:this.revealed?"revealed":this.revealing?"revealing":"hidden",style:this.revealing?{"--reveal-duration":this.revealDuration+"ms"}:{},onClick:this.handleClick,onKeyDown:this.handleKeyDown,role:"button",tabindex:this.revealed?-1:0,"aria-label":this.revealed?void 0:"Click to reveal spoiler","aria-pressed":this.revealed},s("slot",{key:"eeff7d3183449979c3c12c5c1dc531f154425b3b",ref:t=>this.slotElement=t}))}static get style(){return":host{display:inline}div{position:relative;display:inline;cursor:pointer;user-select:none}div.hidden{color:transparent;text-shadow:none}div.revealing{cursor:pointer;user-select:none;animation:fadeInText var(--reveal-duration, 600ms) ease-out forwards}div.revealed{color:inherit;cursor:default;user-select:text}@keyframes fadeInText{from{color:transparent}to{color:inherit}}"}},[257,"spoiler-span",{scale:[2],minVelocity:[2,"min-velocity"],maxVelocity:[2,"max-velocity"],particleLifetime:[2,"particle-lifetime"],density:[2],revealDuration:[2,"reveal-duration"],spawnStopDelay:[2,"spawn-stop-delay"],monitorPosition:[4,"monitor-position"],fps:[2],revealing:[32],revealed:[32]}]);function o(){"undefined"!=typeof customElements&&["spoiler-span"].forEach((t=>{"spoiler-span"===t&&(customElements.get(t)||customElements.define(t,n))}))}o();const h=n,a=o;export{h as SpoilerSpan,a as defineCustomElement}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoilerjs",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "A fast, lightweight web component for creating spoiler text with particle effects",
5
5
  "author": "Shajid Hasan",
6
6
  "main": "dist/components/index.js",
File without changes