pre-mortem 0.1.9 → 0.2.1

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.
@@ -180,7 +180,7 @@ const p = {
180
180
  ];
181
181
  return c.Bodies.fromVertices(r, t, [f], o);
182
182
  } else if (e === "slacker" || e === "control_freak" || e === "prima_donna" || e === "quiet_quitter" || e === "slack_spammer") {
183
- const n = "https://raw.githubusercontent.com/Booby-Boobs/pre-mortem/main/public/", u = {
183
+ const n = "https://raw.githubusercontent.com/Booby-Boobs/Pre-Mortem/main/public/", u = {
184
184
  slacker: `${n}slacker.png`,
185
185
  control_freak: `${n}control-freak.png`,
186
186
  prima_donna: `${n}prima-donna.png`,
@@ -1,4 +1,4 @@
1
- (function(p,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("matter-js")):typeof define=="function"&&define.amd?define(["exports","matter-js"],o):(p=typeof globalThis<"u"?globalThis:p||self,o(p.PreMortem={},p.Matter))})(this,function(p,o){"use strict";var E=Object.defineProperty;var C=(p,o,d)=>o in p?E(p,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):p[o]=d;var l=(p,o,d)=>C(p,typeof o!="symbol"?o+"":o,d);var d=(c=>(c.BOOTSTRAP="bootstrap",c.VC="vc",c.SLACKER="slacker",c.CONTROL_FREAK="control_freak",c.PRIMA_DONNA="prima_donna",c.QUIET_QUITTER="quiet_quitter",c.SLACK_SPAMMER="slack_spammer",c))(d||{});const f={bootstrap:{w:132,h:44,color:"#555555",density:.005,friction:.8,restitution:0,label:"Refactoring",possibleLabels:["Refactoring","Unit Tests","Bug Fixes","User Support","Documentation","Security Audit","Compliance","Cleanup","Optimization","CI/CD Pipeline","Code Review","DB Tuning","API Design","Accessibility","Localization","Error Logs","Backups","Legacy Code","Hiring","Customer Love","Bossware","YAML Hell","DNS Propagation","Regex","npm audit","GDPR / SOC2","Migration","Certificate Expiry","On-Call","Technical Debt","Works on my machine","Yak Shaving"]},vc:{w:120,h:40,color:"#FF00FF",density:5e-4,friction:.3,restitution:.6,label:"AI Blockchain",possibleLabels:["GenAI","Blockchain","Web3","Metaverse","NFTs","Viral Growth","Pivot","Synergy","Disruption","Thought Leader","Influencers","Hyper-Scale","Quantum","Big Data","Growth Hack","Paradigm Shift","10x Engineer","Visionary","Series B Pitch","Exit Strategy","Vibe Coding","Founder Mode","Prompt Engineering","AGI","AI Wrapper","Unlimited PTO","Radical Candor","Community Led","Pre-Revenue","Fractional CxO"]},slacker:{w:64,h:64,color:"#FFFFFF",density:.01,friction:1,restitution:.1,label:"The Slacker",possibleLabels:["The Slacker"]},control_freak:{w:64,h:64,color:"#FF0000",density:.012,friction:.5,restitution:.2,label:"Control Freak",possibleLabels:["Control Freak"]},prima_donna:{w:56,h:56,color:"#FFFF00",density:.008,friction:.1,restitution:1.2,label:"Prima Donna",possibleLabels:["Prima Donna"]},quiet_quitter:{w:48,h:48,color:"#00FFFF",density:.005,friction:.01,restitution:.9,label:"Quiet Quitter",possibleLabels:["Quiet Quitter"]},slack_spammer:{w:60,h:60,color:"#00FF00",density:.01,friction:.4,restitution:.4,label:"Slack Spammer",possibleLabels:["Slack Spammer"]}},y=c=>{const t=f[c].possibleLabels||[];return t[Math.floor(Math.random()*t.length)]},v=(c,t,e)=>{const i=f[e],s=y(e),a={density:i.density,friction:i.friction,restitution:i.restitution,render:{fillStyle:i.color,strokeStyle:"#000",lineWidth:2},label:s};if(e==="vc"){const n=i.w,g=i.h,u=Math.random()*15,h=Math.random()*15,r=(Math.random()-.5)*20,m=[{x:0+r,y:u},{x:n+r,y:h},{x:n,y:g},{x:0,y:g}];return o.Bodies.fromVertices(c,t,[m],a)}else if(e==="slacker"||e==="control_freak"||e==="prima_donna"||e==="quiet_quitter"||e==="slack_spammer"){const n="https://raw.githubusercontent.com/Booby-Boobs/pre-mortem/main/public/",g={slacker:`${n}slacker.png`,control_freak:`${n}control-freak.png`,prima_donna:`${n}prima-donna.png`,quiet_quitter:`${n}quet-quitter.png`,slack_spammer:`${n}slack-spammer.png`},u={...a,render:{sprite:{texture:g[e],xScale:i.w/512*2,yScale:i.h/512*2},lineWidth:3,strokeStyle:"#ffffff"}};return e==="quiet_quitter"?o.Bodies.circle(c,t,i.w/2,u):e==="control_freak"?o.Bodies.trapezoid(c,t,i.w,i.h,.5,u):e==="prima_donna"?o.Bodies.polygon(c,t,5,i.w/2,u):e==="slack_spammer"?o.Bodies.polygon(c,t,6,i.w/2,u):o.Bodies.rectangle(c,t,i.w,i.h,u)}else return o.Bodies.rectangle(c,t,i.w,i.h,a)};class w{constructor(t){l(this,"runway");l(this,"valuation",0);l(this,"stage");l(this,"status","playing");l(this,"lastPenaltyReason","");l(this,"config");l(this,"currentStageIndex",0);l(this,"listeners",[]);if(this.config=t,this.runway=t.initialRunway,!this.config.stages||this.config.stages.length===0)throw new Error("Game must have at least one stage defined.");this.config.stages.sort((e,i)=>e.threshold-i.threshold),this.currentStageIndex=0,this.stage=this.config.stages[0].name,this.checkStage()}setPaused(t){t?this.status==="playing"&&(this.status="paused"):this.status==="paused"&&(this.status="playing"),this.notify()}togglePause(){this.setPaused(this.status==="playing")}tick(t){if(this.status!=="playing")return;const e=Math.min(t,.1),i=this.getDynamicBurnRate();this.runway-=i*e,this.runway<=0&&(this.runway=0,this.status="bankrupt");const s=this.config.stages[this.config.stages.length-1];this.valuation>=s.threshold&&this.status==="playing"&&(this.status="exited"),this.checkStage(),this.notify()}getDynamicBurnRate(){return this.config.stages[this.currentStageIndex].burnRate}addValuation(t){this.valuation+=t,this.checkStage(),this.notify()}spendMoney(t){this.runway-=t,this.notify()}addMoney(t){this.runway+=t,this.notify()}setCollapsed(){this.status==="playing"&&(this.status="collapsed",this.notify())}getNextStageThreshold(){return this.currentStageIndex<this.config.stages.length-1?this.config.stages[this.currentStageIndex+1].threshold:this.config.stages[this.config.stages.length-1].threshold}penalty(t,e){this.runway-=t,this.lastPenaltyReason=e,this.runway<0&&(this.runway=0,this.status="bankrupt"),this.notify("penalty")}checkStage(){let t=0;for(let e=0;e<this.config.stages.length&&this.valuation>=this.config.stages[e].threshold;e++)t=e;if(t!==this.currentStageIndex){if(t>this.currentStageIndex){const e=this.config.stages[t].fundingBonus||0;e>0&&(this.addMoney(e),this.notify("funding:"+e))}this.currentStageIndex=t,this.stage=this.config.stages[t].name}}subscribe(t){this.listeners.push(t)}notify(t){this.listeners.forEach(e=>e(t))}isPlaying(){return this.status==="playing"}isBankrupt(){return this.status==="bankrupt"}}class b{constructor(t,e={}){l(this,"engine");l(this,"render");l(this,"runner");l(this,"container");l(this,"width");l(this,"height");l(this,"mouseConstraint");l(this,"currentQuote",null);l(this,"chaosTimer",1e4);l(this,"chaosInterval",9e4);l(this,"onCrisis");l(this,"gameState");l(this,"spawnVertical",!1);this.container=t,this.width=e.width||t.clientWidth||800,this.height=e.height||t.clientHeight||600,this.onCrisis=e.onCrisis,this.chaosInterval=e.chaosInterval||9e4,this.chaosTimer=e.chaosInterval?e.chaosInterval:1e4;const i=[{name:"Seed Round",threshold:0,burnRate:2e3},{name:"Series A",threshold:1e8,burnRate:1e4,fundingBonus:25e4},{name:"Series B",threshold:25e7,burnRate:25e3,fundingBonus:5e5},{name:"Series C",threshold:5e8,burnRate:5e4,fundingBonus:1e6},{name:"Series D",threshold:7e8,burnRate:75e3,fundingBonus:2e6},{name:"Series E",threshold:85e7,burnRate:1e5,fundingBonus:5e6},{name:"Unicorn Status",threshold:1e9,burnRate:15e4,fundingBonus:1e7}];this.gameState=new w({initialRunway:e.initialRunway||2e5,stages:e.stages||i}),this.engine=o.Engine.create(),this.render=o.Render.create({element:this.container,engine:this.engine,options:{width:this.width,height:this.height,wireframes:!1,background:"#1a1a1a"}}),this.runner=o.Runner.create(),this.initWorld(),this.initMouse(),this.initRenderLoop(),this.initGameLoop(),this.initControls(),this.gameState.subscribe(()=>{this.gameState.status==="paused"?this.runner.enabled=!1:this.gameState.status==="playing"&&(this.runner.enabled=!0)})}initControls(){window.addEventListener("keydown",t=>{(t.key==="r"||t.key==="R")&&this.gameState.isPlaying()&&this.rotateHeldBody()})}rotateHeldBody(){const t=this.mouseConstraint.body;t&&o.Body.rotate(t,45*(Math.PI/180))}initWorld(){const{width:t,height:e}=this,i=60,s=o.Bodies.rectangle(t/2,e-i/2,t,i,{isStatic:!0,render:{fillStyle:"#333"}});o.Composite.add(this.engine.world,[s])}initMouse(){const t=o.Mouse.create(this.render.canvas);this.mouseConstraint=o.MouseConstraint.create(this.engine,{mouse:t,constraint:{stiffness:.2,render:{visible:!1}}}),o.Composite.add(this.engine.world,this.mouseConstraint),this.render.mouse=t}start(){o.Render.run(this.render),o.Runner.run(this.runner,this.engine)}stop(){o.Render.stop(this.render),o.Runner.stop(this.runner)}initRenderLoop(){o.Events.on(this.render,"afterRender",()=>{const t=this.render.context,e=this.width/2,i=400,s=700,a=100,n={x:e-i/2,y:a,w:i,h:this.height-a},g={x:e-s/2,y:a-50,w:s,h:this.height-a+100};if(t.beginPath(),t.setLineDash([10,10]),t.lineWidth=2,t.strokeStyle="rgba(255, 255, 255, 0.3)",t.strokeRect(n.x,n.y,n.w,n.h),t.font='10px "Inter", sans-serif',t.fillStyle="rgba(255, 255, 255, 0.3)",t.textAlign="center",t.fillText("ACCURATE VALUATION ZONE",e,n.y-15),!this.currentQuote){const h=[{text:`WE ARE A
1
+ (function(p,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("matter-js")):typeof define=="function"&&define.amd?define(["exports","matter-js"],o):(p=typeof globalThis<"u"?globalThis:p||self,o(p.PreMortem={},p.Matter))})(this,function(p,o){"use strict";var E=Object.defineProperty;var C=(p,o,d)=>o in p?E(p,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):p[o]=d;var l=(p,o,d)=>C(p,typeof o!="symbol"?o+"":o,d);var d=(c=>(c.BOOTSTRAP="bootstrap",c.VC="vc",c.SLACKER="slacker",c.CONTROL_FREAK="control_freak",c.PRIMA_DONNA="prima_donna",c.QUIET_QUITTER="quiet_quitter",c.SLACK_SPAMMER="slack_spammer",c))(d||{});const f={bootstrap:{w:132,h:44,color:"#555555",density:.005,friction:.8,restitution:0,label:"Refactoring",possibleLabels:["Refactoring","Unit Tests","Bug Fixes","User Support","Documentation","Security Audit","Compliance","Cleanup","Optimization","CI/CD Pipeline","Code Review","DB Tuning","API Design","Accessibility","Localization","Error Logs","Backups","Legacy Code","Hiring","Customer Love","Bossware","YAML Hell","DNS Propagation","Regex","npm audit","GDPR / SOC2","Migration","Certificate Expiry","On-Call","Technical Debt","Works on my machine","Yak Shaving"]},vc:{w:120,h:40,color:"#FF00FF",density:5e-4,friction:.3,restitution:.6,label:"AI Blockchain",possibleLabels:["GenAI","Blockchain","Web3","Metaverse","NFTs","Viral Growth","Pivot","Synergy","Disruption","Thought Leader","Influencers","Hyper-Scale","Quantum","Big Data","Growth Hack","Paradigm Shift","10x Engineer","Visionary","Series B Pitch","Exit Strategy","Vibe Coding","Founder Mode","Prompt Engineering","AGI","AI Wrapper","Unlimited PTO","Radical Candor","Community Led","Pre-Revenue","Fractional CxO"]},slacker:{w:64,h:64,color:"#FFFFFF",density:.01,friction:1,restitution:.1,label:"The Slacker",possibleLabels:["The Slacker"]},control_freak:{w:64,h:64,color:"#FF0000",density:.012,friction:.5,restitution:.2,label:"Control Freak",possibleLabels:["Control Freak"]},prima_donna:{w:56,h:56,color:"#FFFF00",density:.008,friction:.1,restitution:1.2,label:"Prima Donna",possibleLabels:["Prima Donna"]},quiet_quitter:{w:48,h:48,color:"#00FFFF",density:.005,friction:.01,restitution:.9,label:"Quiet Quitter",possibleLabels:["Quiet Quitter"]},slack_spammer:{w:60,h:60,color:"#00FF00",density:.01,friction:.4,restitution:.4,label:"Slack Spammer",possibleLabels:["Slack Spammer"]}},y=c=>{const t=f[c].possibleLabels||[];return t[Math.floor(Math.random()*t.length)]},v=(c,t,e)=>{const i=f[e],s=y(e),a={density:i.density,friction:i.friction,restitution:i.restitution,render:{fillStyle:i.color,strokeStyle:"#000",lineWidth:2},label:s};if(e==="vc"){const n=i.w,g=i.h,u=Math.random()*15,h=Math.random()*15,r=(Math.random()-.5)*20,m=[{x:0+r,y:u},{x:n+r,y:h},{x:n,y:g},{x:0,y:g}];return o.Bodies.fromVertices(c,t,[m],a)}else if(e==="slacker"||e==="control_freak"||e==="prima_donna"||e==="quiet_quitter"||e==="slack_spammer"){const n="https://raw.githubusercontent.com/Booby-Boobs/Pre-Mortem/main/public/",g={slacker:`${n}slacker.png`,control_freak:`${n}control-freak.png`,prima_donna:`${n}prima-donna.png`,quiet_quitter:`${n}quet-quitter.png`,slack_spammer:`${n}slack-spammer.png`},u={...a,render:{sprite:{texture:g[e],xScale:i.w/512*2,yScale:i.h/512*2},lineWidth:3,strokeStyle:"#ffffff"}};return e==="quiet_quitter"?o.Bodies.circle(c,t,i.w/2,u):e==="control_freak"?o.Bodies.trapezoid(c,t,i.w,i.h,.5,u):e==="prima_donna"?o.Bodies.polygon(c,t,5,i.w/2,u):e==="slack_spammer"?o.Bodies.polygon(c,t,6,i.w/2,u):o.Bodies.rectangle(c,t,i.w,i.h,u)}else return o.Bodies.rectangle(c,t,i.w,i.h,a)};class w{constructor(t){l(this,"runway");l(this,"valuation",0);l(this,"stage");l(this,"status","playing");l(this,"lastPenaltyReason","");l(this,"config");l(this,"currentStageIndex",0);l(this,"listeners",[]);if(this.config=t,this.runway=t.initialRunway,!this.config.stages||this.config.stages.length===0)throw new Error("Game must have at least one stage defined.");this.config.stages.sort((e,i)=>e.threshold-i.threshold),this.currentStageIndex=0,this.stage=this.config.stages[0].name,this.checkStage()}setPaused(t){t?this.status==="playing"&&(this.status="paused"):this.status==="paused"&&(this.status="playing"),this.notify()}togglePause(){this.setPaused(this.status==="playing")}tick(t){if(this.status!=="playing")return;const e=Math.min(t,.1),i=this.getDynamicBurnRate();this.runway-=i*e,this.runway<=0&&(this.runway=0,this.status="bankrupt");const s=this.config.stages[this.config.stages.length-1];this.valuation>=s.threshold&&this.status==="playing"&&(this.status="exited"),this.checkStage(),this.notify()}getDynamicBurnRate(){return this.config.stages[this.currentStageIndex].burnRate}addValuation(t){this.valuation+=t,this.checkStage(),this.notify()}spendMoney(t){this.runway-=t,this.notify()}addMoney(t){this.runway+=t,this.notify()}setCollapsed(){this.status==="playing"&&(this.status="collapsed",this.notify())}getNextStageThreshold(){return this.currentStageIndex<this.config.stages.length-1?this.config.stages[this.currentStageIndex+1].threshold:this.config.stages[this.config.stages.length-1].threshold}penalty(t,e){this.runway-=t,this.lastPenaltyReason=e,this.runway<0&&(this.runway=0,this.status="bankrupt"),this.notify("penalty")}checkStage(){let t=0;for(let e=0;e<this.config.stages.length&&this.valuation>=this.config.stages[e].threshold;e++)t=e;if(t!==this.currentStageIndex){if(t>this.currentStageIndex){const e=this.config.stages[t].fundingBonus||0;e>0&&(this.addMoney(e),this.notify("funding:"+e))}this.currentStageIndex=t,this.stage=this.config.stages[t].name}}subscribe(t){this.listeners.push(t)}notify(t){this.listeners.forEach(e=>e(t))}isPlaying(){return this.status==="playing"}isBankrupt(){return this.status==="bankrupt"}}class b{constructor(t,e={}){l(this,"engine");l(this,"render");l(this,"runner");l(this,"container");l(this,"width");l(this,"height");l(this,"mouseConstraint");l(this,"currentQuote",null);l(this,"chaosTimer",1e4);l(this,"chaosInterval",9e4);l(this,"onCrisis");l(this,"gameState");l(this,"spawnVertical",!1);this.container=t,this.width=e.width||t.clientWidth||800,this.height=e.height||t.clientHeight||600,this.onCrisis=e.onCrisis,this.chaosInterval=e.chaosInterval||9e4,this.chaosTimer=e.chaosInterval?e.chaosInterval:1e4;const i=[{name:"Seed Round",threshold:0,burnRate:2e3},{name:"Series A",threshold:1e8,burnRate:1e4,fundingBonus:25e4},{name:"Series B",threshold:25e7,burnRate:25e3,fundingBonus:5e5},{name:"Series C",threshold:5e8,burnRate:5e4,fundingBonus:1e6},{name:"Series D",threshold:7e8,burnRate:75e3,fundingBonus:2e6},{name:"Series E",threshold:85e7,burnRate:1e5,fundingBonus:5e6},{name:"Unicorn Status",threshold:1e9,burnRate:15e4,fundingBonus:1e7}];this.gameState=new w({initialRunway:e.initialRunway||2e5,stages:e.stages||i}),this.engine=o.Engine.create(),this.render=o.Render.create({element:this.container,engine:this.engine,options:{width:this.width,height:this.height,wireframes:!1,background:"#1a1a1a"}}),this.runner=o.Runner.create(),this.initWorld(),this.initMouse(),this.initRenderLoop(),this.initGameLoop(),this.initControls(),this.gameState.subscribe(()=>{this.gameState.status==="paused"?this.runner.enabled=!1:this.gameState.status==="playing"&&(this.runner.enabled=!0)})}initControls(){window.addEventListener("keydown",t=>{(t.key==="r"||t.key==="R")&&this.gameState.isPlaying()&&this.rotateHeldBody()})}rotateHeldBody(){const t=this.mouseConstraint.body;t&&o.Body.rotate(t,45*(Math.PI/180))}initWorld(){const{width:t,height:e}=this,i=60,s=o.Bodies.rectangle(t/2,e-i/2,t,i,{isStatic:!0,render:{fillStyle:"#333"}});o.Composite.add(this.engine.world,[s])}initMouse(){const t=o.Mouse.create(this.render.canvas);this.mouseConstraint=o.MouseConstraint.create(this.engine,{mouse:t,constraint:{stiffness:.2,render:{visible:!1}}}),o.Composite.add(this.engine.world,this.mouseConstraint),this.render.mouse=t}start(){o.Render.run(this.render),o.Runner.run(this.runner,this.engine)}stop(){o.Render.stop(this.render),o.Runner.stop(this.runner)}initRenderLoop(){o.Events.on(this.render,"afterRender",()=>{const t=this.render.context,e=this.width/2,i=400,s=700,a=100,n={x:e-i/2,y:a,w:i,h:this.height-a},g={x:e-s/2,y:a-50,w:s,h:this.height-a+100};if(t.beginPath(),t.setLineDash([10,10]),t.lineWidth=2,t.strokeStyle="rgba(255, 255, 255, 0.3)",t.strokeRect(n.x,n.y,n.w,n.h),t.font='10px "Inter", sans-serif',t.fillStyle="rgba(255, 255, 255, 0.3)",t.textAlign="center",t.fillText("ACCURATE VALUATION ZONE",e,n.y-15),!this.currentQuote){const h=[{text:`WE ARE A
2
2
  FAMILY`,author:"- CEO"},{text:`CHANGE THE
3
3
  WORLD`,author:"- Founder"},{text:`DISRUPT
4
4
  EVERYTHING`,author:"- VC"},{text:`MOVE FAST
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pre-mortem",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "The Exit Simulator: A satirical startup physics game",
5
5
  "main": "dist/pre-mortem.umd.js",
6
6
  "module": "dist/pre-mortem.mjs",