litecanvas 0.83.0 → 0.83.2
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/README.md +26 -20
- package/dist/dist.dev.js +113 -161
- package/dist/dist.js +72 -54
- package/dist/dist.min.js +1 -1
- package/package.json +6 -3
- package/src/index.js +105 -170
- package/types/index.d.ts +12 -43
- package/types/types.d.ts +7 -22
package/dist/dist.js
CHANGED
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
function litecanvas(settings = {}) {
|
|
28
28
|
const root = globalThis, math = Math, TWO_PI = math.PI * 2, raf = requestAnimationFrame, _browserEventListeners = [], on = (elem, evt, callback) => {
|
|
29
29
|
elem.addEventListener(evt, callback, false);
|
|
30
|
-
_browserEventListeners.push(
|
|
31
|
-
() => elem.removeEventListener(evt, callback, false)
|
|
32
|
-
);
|
|
30
|
+
_browserEventListeners.push(() => elem.removeEventListener(evt, callback, false));
|
|
33
31
|
}, isNumber = Number.isFinite, defaults = {
|
|
34
32
|
width: null,
|
|
35
33
|
height: null,
|
|
@@ -88,7 +86,7 @@
|
|
|
88
86
|
*
|
|
89
87
|
* @type {number}
|
|
90
88
|
*/
|
|
91
|
-
HALF_PI:
|
|
89
|
+
HALF_PI: TWO_PI / 4,
|
|
92
90
|
/**
|
|
93
91
|
* Calculates a linear (interpolation) value over t%.
|
|
94
92
|
*
|
|
@@ -143,9 +141,9 @@
|
|
|
143
141
|
* @param {number} max
|
|
144
142
|
* @returns {number}
|
|
145
143
|
*/
|
|
146
|
-
clamp: (value,
|
|
147
|
-
if (value <
|
|
148
|
-
if (value >
|
|
144
|
+
clamp: (value, min2, max2) => {
|
|
145
|
+
if (value < min2) return min2;
|
|
146
|
+
if (value > max2) return max2;
|
|
149
147
|
return value;
|
|
150
148
|
},
|
|
151
149
|
/**
|
|
@@ -156,8 +154,8 @@
|
|
|
156
154
|
* @param {number} max
|
|
157
155
|
* @returns {number}
|
|
158
156
|
*/
|
|
159
|
-
wrap: (value,
|
|
160
|
-
return value - (
|
|
157
|
+
wrap: (value, min2, max2) => {
|
|
158
|
+
return value - (max2 - min2) * math.floor((value - min2) / (max2 - min2));
|
|
161
159
|
},
|
|
162
160
|
/**
|
|
163
161
|
* Re-maps a number from one range to another.
|
|
@@ -192,10 +190,12 @@
|
|
|
192
190
|
*
|
|
193
191
|
* @param {number} from - the lower bound
|
|
194
192
|
* @param {number} to - the higher bound
|
|
195
|
-
* @param {number} t - the
|
|
196
|
-
* @param {(n: number) => number} fn - the periodic function (which default to `Math.sin`)
|
|
193
|
+
* @param {number} t - value passed to the periodic function
|
|
194
|
+
* @param {(n: number) => number} [fn] - the periodic function (which default to `Math.sin`)
|
|
197
195
|
*/
|
|
198
|
-
wave: (from, to, t, fn = Math.sin) =>
|
|
196
|
+
wave: (from, to, t, fn = Math.sin) => {
|
|
197
|
+
return from + (fn(t) + 1) / 2 * (to - from);
|
|
198
|
+
},
|
|
199
199
|
/** RNG API */
|
|
200
200
|
/**
|
|
201
201
|
* Generates a pseudorandom float between min (inclusive) and max (exclusive)
|
|
@@ -205,12 +205,12 @@
|
|
|
205
205
|
* @param {number} [max=1.0]
|
|
206
206
|
* @returns {number} the random number
|
|
207
207
|
*/
|
|
208
|
-
rand: (
|
|
208
|
+
rand: (min2 = 0, max2 = 1) => {
|
|
209
209
|
const a = 1664525;
|
|
210
210
|
const c = 1013904223;
|
|
211
211
|
const m = 4294967296;
|
|
212
212
|
_rngSeed = (a * _rngSeed + c) % m;
|
|
213
|
-
return _rngSeed / m * (
|
|
213
|
+
return _rngSeed / m * (max2 - min2) + min2;
|
|
214
214
|
},
|
|
215
215
|
/**
|
|
216
216
|
* Generates a pseudorandom integer between min (inclusive) and max (inclusive)
|
|
@@ -219,8 +219,8 @@
|
|
|
219
219
|
* @param {number} [max=1]
|
|
220
220
|
* @returns {number} the random number
|
|
221
221
|
*/
|
|
222
|
-
randi: (
|
|
223
|
-
return math.floor(instance.rand(
|
|
222
|
+
randi: (min2 = 0, max2 = 1) => {
|
|
223
|
+
return math.floor(instance.rand(min2, max2 + 1));
|
|
224
224
|
},
|
|
225
225
|
/**
|
|
226
226
|
* Initializes the random number generator with an explicit seed value.
|
|
@@ -242,13 +242,7 @@
|
|
|
242
242
|
if (null == color) {
|
|
243
243
|
_ctx.clearRect(0, 0, _ctx.canvas.width, _ctx.canvas.height);
|
|
244
244
|
} else {
|
|
245
|
-
instance.rectfill(
|
|
246
|
-
0,
|
|
247
|
-
0,
|
|
248
|
-
_ctx.canvas.width,
|
|
249
|
-
_ctx.canvas.height,
|
|
250
|
-
color
|
|
251
|
-
);
|
|
245
|
+
instance.rectfill(0, 0, _ctx.canvas.width, _ctx.canvas.height, color);
|
|
252
246
|
}
|
|
253
247
|
},
|
|
254
248
|
/**
|
|
@@ -260,6 +254,8 @@
|
|
|
260
254
|
* @param {number} height
|
|
261
255
|
* @param {number} [color=0] the color index
|
|
262
256
|
* @param {number|number[]} [radii] A number or list specifying the radii used to draw a rounded-borders rectangle
|
|
257
|
+
*
|
|
258
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/roundRect
|
|
263
259
|
*/
|
|
264
260
|
rect(x, y, width, height, color, radii) {
|
|
265
261
|
_ctx.beginPath();
|
|
@@ -284,13 +280,7 @@
|
|
|
284
280
|
*/
|
|
285
281
|
rectfill(x, y, width, height, color, radii) {
|
|
286
282
|
_ctx.beginPath();
|
|
287
|
-
_ctx[radii ? "roundRect" : "rect"](
|
|
288
|
-
~~x,
|
|
289
|
-
~~y,
|
|
290
|
-
~~width,
|
|
291
|
-
~~height,
|
|
292
|
-
radii
|
|
293
|
-
);
|
|
283
|
+
_ctx[radii ? "roundRect" : "rect"](~~x, ~~y, ~~width, ~~height, radii);
|
|
294
284
|
instance.fill(color);
|
|
295
285
|
},
|
|
296
286
|
/**
|
|
@@ -553,6 +543,8 @@
|
|
|
553
543
|
/**
|
|
554
544
|
* Turn given path into a clipping region.
|
|
555
545
|
*
|
|
546
|
+
* Note: always call `push()` before and `pop()` after.
|
|
547
|
+
*
|
|
556
548
|
* @param {Path2D} path
|
|
557
549
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clip
|
|
558
550
|
*/
|
|
@@ -600,7 +592,11 @@
|
|
|
600
592
|
* @param {pluginCallback} callback
|
|
601
593
|
*/
|
|
602
594
|
use(callback, config = {}) {
|
|
603
|
-
|
|
595
|
+
if (_initialized) {
|
|
596
|
+
loadPlugin(callback, config);
|
|
597
|
+
} else {
|
|
598
|
+
_plugins.push([callback, config]);
|
|
599
|
+
}
|
|
604
600
|
},
|
|
605
601
|
/**
|
|
606
602
|
* Add a game event listener
|
|
@@ -741,25 +737,50 @@
|
|
|
741
737
|
on(root, "resize", resizeCanvas);
|
|
742
738
|
}
|
|
743
739
|
if (settings.tapEvents) {
|
|
744
|
-
const _getXY = (
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
740
|
+
const _getXY = (
|
|
741
|
+
/**
|
|
742
|
+
* @param {number} pageX
|
|
743
|
+
* @param {number} pageY
|
|
744
|
+
*/
|
|
745
|
+
(pageX, pageY) => [
|
|
746
|
+
(pageX - _canvas.offsetLeft) / _scale,
|
|
747
|
+
(pageY - _canvas.offsetTop) / _scale
|
|
748
|
+
]
|
|
749
|
+
), _taps = /* @__PURE__ */ new Map(), _registerTap = (
|
|
750
|
+
/**
|
|
751
|
+
* @param {number} id
|
|
752
|
+
* @param {number} [x]
|
|
753
|
+
* @param {number} [y]
|
|
754
|
+
*/
|
|
755
|
+
(id, x, y) => {
|
|
756
|
+
const tap = {
|
|
757
|
+
x,
|
|
758
|
+
y,
|
|
759
|
+
startX: x,
|
|
760
|
+
startY: y,
|
|
761
|
+
// timestamp
|
|
762
|
+
ts: performance.now()
|
|
763
|
+
};
|
|
764
|
+
_taps.set(id, tap);
|
|
765
|
+
return tap;
|
|
766
|
+
}
|
|
767
|
+
), _updateTap = (
|
|
768
|
+
/**
|
|
769
|
+
* @param {number} id
|
|
770
|
+
* @param {number} x
|
|
771
|
+
* @param {number} y
|
|
772
|
+
*/
|
|
773
|
+
(id, x, y) => {
|
|
774
|
+
const tap = _taps.get(id) || _registerTap(id);
|
|
775
|
+
tap.x = x;
|
|
776
|
+
tap.y = y;
|
|
777
|
+
}
|
|
778
|
+
), _checkTapped = (
|
|
779
|
+
/**
|
|
780
|
+
* @param {{ts: number}} tap
|
|
781
|
+
*/
|
|
782
|
+
(tap) => tap && performance.now() - tap.ts <= 300
|
|
783
|
+
), preventDefault = (ev) => ev.preventDefault();
|
|
763
784
|
let _pressingMouse = false;
|
|
764
785
|
on(
|
|
765
786
|
_canvas,
|
|
@@ -971,10 +992,7 @@
|
|
|
971
992
|
_canvas.style.display = "block";
|
|
972
993
|
_canvas.style.margin = "auto";
|
|
973
994
|
}
|
|
974
|
-
_scale = math.min(
|
|
975
|
-
root.innerWidth / instance.W,
|
|
976
|
-
root.innerHeight / instance.H
|
|
977
|
-
);
|
|
995
|
+
_scale = math.min(root.innerWidth / instance.W, root.innerHeight / instance.H);
|
|
978
996
|
_scale = (settings.pixelart ? ~~_scale : _scale) || 1;
|
|
979
997
|
_canvas.style.width = instance.W * _scale + "px";
|
|
980
998
|
_canvas.style.height = instance.H * _scale + "px";
|
package/dist/dist.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var e=new AudioContext,t=(t=1,a=.05,l=220,n=0,i=0,o=.1,r=0,s=1,f=0,c=0,d=0,p=0,u=0,h=0,g=0,m=0,w=0,b=1,v=0,x=0,y=0)=>{let C=Math,k=2*C.PI,E=f*=500*k/44100/44100,T=l*=(1-a+2*a*C.random(a=[]))*k/44100,z=0,A=0,
|
|
1
|
+
(()=>{var e=new AudioContext,t=(t=1,a=.05,l=220,n=0,i=0,o=.1,r=0,s=1,f=0,c=0,d=0,p=0,u=0,h=0,g=0,m=0,w=0,b=1,v=0,x=0,y=0)=>{let C=Math,k=2*C.PI,E=f*=500*k/44100/44100,T=l*=(1-a+2*a*C.random(a=[]))*k/44100,z=0,A=0,S=0,I=1,P=0,X=0,Y=0,L=y<0?-1:1,M=k*L*y*2/44100,N=C.cos(M),H=C.sin,W=H(M)/4,D=1+W,F=-2*N/D,V=(1-W)/D,q=(1+L*N)/2/D,B=-(L+N)/D,O=0,R=0,G=0,$=0;for(n=44100*n+9,v*=44100,i*=44100,o*=44100,w*=44100,c*=500*k/85766121e6,g*=k/44100,d*=k/44100,p*=44100,u=44100*u|0,t*=.3*(globalThis.zzfxV||1),L=n+v+i+o+w|0;S<L;a[S++]=Y*t)++X%(100*m|0)||(Y=r?1<r?2<r?3<r?H(z*z):C.max(C.min(C.tan(z),1),-1):1-(2*z/k%2+2)%2:1-4*C.abs(C.round(z/k)-z/k):H(z),Y=(u?1-x+x*H(k*S/u):1)*(Y<0?-1:1)*C.abs(Y)**s*(S<n?S/n:S<n+v?1-(S-n)/v*(1-b):S<n+v+i?b:S<L-w?(L-S-w)/o*b:0),Y=w?Y/2+(w>S?0:(S<L-w?1:(L-S)/w)*a[S-w|0]/2/t):Y,y&&(Y=$=q*O+B*(O=R)+q*(R=Y)-V*G-F*(G=$))),z+=(M=(l+=f+=c)*C.cos(g*A++))+M*h*H(S**5),I&&++I>p&&(l+=d,T+=d,I=0),!u||++P%u||(l=T,f=E,I=I||1);(t=e.createBuffer(1,L,44100)).getChannelData(0).set(a),(l=e.createBufferSource()).buffer=t,l.connect(e.destination),l.start()},a=["#111","#6a7799","#aec2c2","#FFF1E8","#e83b3b","#fabc20","#155fd9","#3cbcfc","#327345","#63c64d","#6c2c1f","#ac7c00"];globalThis.litecanvas=function(e={}){let l=globalThis,n=Math,i=2*n.PI,o=requestAnimationFrame,r=[],s=(e,t,a)=>{e.addEventListener(t,a,!1),r.push(()=>e.removeEventListener(t,a,!1))};e=Object.assign({width:null,height:null,autoscale:!0,pixelart:!1,antialias:!1,canvas:null,global:!0,loop:null,tapEvents:!0,keyboardEvents:!0,animate:!0},e);let f=!1,c=[],d,p=1,u,h=.5,g=1,m,w=1/60,b=0,v,x="sans-serif",y=20,C=Date.now(),k=a,E=[.5,0,1750,,,.3,1,,,,600,.1],T={init:null,update:null,draw:null,resized:null,tap:null,untap:null,tapping:null,tapped:null},z={CANVAS:null,W:0,H:0,T:0,CX:0,CY:0,MX:-1,MY:-1,TWO_PI:i,HALF_PI:i/4,lerp:(e,t,a)=>a*(t-e)+e,deg2rad:e=>n.PI/180*e,rad2deg:e=>180/n.PI*e,round:(e,t=0)=>{if(!t)return n.round(e);let a=10**t;return n.round(e*a)/a},clamp:(e,t,a)=>e<t?t:e>a?a:e,wrap:(e,t,a)=>e-(a-t)*n.floor((e-t)/(a-t)),map(e,t,a,l,n,i){let o=(e-t)/(a-t)*(n-l)+l;return i?z.clamp(o,l,n):o},norm:(e,t,a)=>z.map(e,t,a,0,1),wave:(e,t,a,l=Math.sin)=>e+(l(a)+1)/2*(t-e),rand:(e=0,t=1)=>(C=(1664525*C+0x3c6ef35f)%0x100000000)/0x100000000*(t-e)+e,randi:(e=0,t=1)=>n.floor(z.rand(e,t+1)),rseed(e){C=~~e},cls(e){null==e?u.clearRect(0,0,u.canvas.width,u.canvas.height):z.rectfill(0,0,u.canvas.width,u.canvas.height,e)},rect(e,t,a,l,n,i){u.beginPath(),u[i?"roundRect":"rect"](~~e-h,~~t-h,~~a+2*h,~~l+2*h,i),z.stroke(n)},rectfill(e,t,a,l,n,i){u.beginPath(),u[i?"roundRect":"rect"](~~e,~~t,~~a,~~l,i),z.fill(n)},circ(e,t,a,l){u.beginPath(),u.arc(~~e,~~t,~~a,0,i),z.stroke(l)},circfill(e,t,a,l){u.beginPath(),u.arc(~~e,~~t,~~a,0,i),z.fill(l)},line(e,t,a,l,n){u.beginPath();let i=.5*(0!==h&&~~e==~~a),o=.5*(0!==h&&~~t==~~l);u.moveTo(~~e+i,~~t+o),u.lineTo(~~a+i,~~l+o),z.stroke(n)},linewidth(e){u.lineWidth=~~e,h=.5*(0!=~~e%2)},linedash(e,t=0){u.setLineDash(e),u.lineDashOffset=t},text(e,t,a,l=3,n="normal"){u.font=`${n} ${y}px ${x}`,u.fillStyle=k[~~l%k.length],u.fillText(a,~~e,~~t)},textfont(e){x=e},textsize(e){y=e},textalign(e,t){e&&(u.textAlign=e),t&&(u.textBaseline=t)},image(e,t,a){u.drawImage(a,~~e,~~t)},paint(e,t,a,l={}){let n=l.canvas||new OffscreenCanvas(1,1),i=l.scale||1,o=u;if(n.width=e*i,n.height=t*i,(u=n.getContext("2d")).scale(i,i),a.push){let e=0,t=0;for(let l of(u.imageSmoothingEnabled=!1,a)){for(let a of l)" "!==a&&"."!==a&&z.rectfill(e,t,1,1,parseInt(a,16)),e++;t++,e=0}}else a(u);return u=o,n.transferToImageBitmap()},ctx:e=>(e&&(u=e),u),push:()=>u.save(),pop:()=>u.restore(),translate:(e,t)=>u.translate(~~e,~~t),scale:(e,t)=>u.scale(e,t||e),rotate:e=>u.rotate(e),alpha(e){u.globalAlpha=z.clamp(e,0,1)},path:e=>new Path2D(e),fill(e,t){u.fillStyle=k[~~e%k.length],t?u.fill(t):u.fill()},stroke(e,t){u.strokeStyle=k[~~e%k.length],t?u.stroke(t):u.stroke()},clip(e){u.clip(e)},sfx:(e,a=0,n=1)=>!(l.zzfxV<=0)&&(!navigator.userActivation||!!navigator.userActivation.hasBeenActive)&&(e=e||E,(0!==a||1!==n)&&((e=e.slice())[0]=n*(e[0]||1),e[10]=~~e[10]+a),t.apply(0,e),e),volume(e){l.zzfxV=e},use(e,t={}){f?X(e,t):c.push([e,t])},listen:(e,t)=>(T[e=e.toLowerCase()]=T[e]||new Set,T[e].add(t),()=>T[e].delete(t)),emit(e,t,a,l,n){f&&(P("before:"+(e=e.toLowerCase()),t,a,l,n),P(e,t,a,l,n),P("after:"+e,t,a,l,n))},pal(e=a){k=e},def(t,a){z[t]=a,e.global&&(l[t]=a)},timescale(e){g=e},framerate(e){w=1/~~e},stat(t){let a={index:t,value:[e,f,v,p,T,k,E,g,l.zzfxV||1,C,y,x][t]};return z.emit("stat",a),a.value},quit(){for(let e of(cancelAnimationFrame(v),v=0,z.emit("quit"),r))e();if(T={},e.global){for(let e in z)delete l[e];delete l.ENGINE}}};for(let e of"PI,sin,cos,atan2,hypot,tan,abs,ceil,floor,trunc,min,max,pow,sqrt,sign,exp".split(","))z[e]=n[e];function A(){let t=e.loop?e.loop:l;for(let e in T)t[e]&&z.listen(e,t[e]);for(let[e,t]of c)X(e,t);if(e.autoscale&&s(l,"resize",I),e.tapEvents){let e=(e,t)=>[(e-d.offsetLeft)/p,(t-d.offsetTop)/p],t=new Map,a=(e,a,l)=>{let n={x:a,y:l,startX:a,startY:l,ts:performance.now()};return t.set(e,n),n},n=(e,l,n)=>{let i=t.get(e)||a(e);i.x=l,i.y=n},i=e=>e&&performance.now()-e.ts<=300,o=e=>e.preventDefault(),r=!1;s(d,"mousedown",t=>{if(0===t.button){o(t);let[l,n]=e(t.pageX,t.pageY);z.emit("tap",l,n,0),a(0,l,n),r=!0}}),s(d,"mouseup",a=>{if(0===a.button){o(a);let l=t.get(0),[n,s]=e(a.pageX,a.pageY);i(l)&&z.emit("tapped",l.startX,l.startY,0),z.emit("untap",n,s,0),t.delete(0),r=!1}}),s(d,"mousemove",t=>{o(t);let[a,l]=e(t.pageX,t.pageY);z.def("MX",a),z.def("MY",l),r&&(z.emit("tapping",a,l,0),n(0,a,l))}),s(d,"touchstart",t=>{for(let l of(o(t),t.changedTouches)){let[t,n]=e(l.pageX,l.pageY);z.emit("tap",t,n,l.identifier+1),a(l.identifier+1,t,n)}}),s(d,"touchmove",t=>{for(let a of(o(t),t.changedTouches)){let[t,l]=e(a.pageX,a.pageY);z.emit("tapping",t,l,a.identifier+1),n(a.identifier+1,t,l)}});let f=e=>{o(e);let a=[];if(e.targetTouches.length>0)for(let t of e.targetTouches)a.push(t.identifier+1);for(let[e,l]of t)a.includes(e)||(i(l)&&z.emit("tapped",l.startX,l.startY,e),z.emit("untap",l.x,l.y,e),t.delete(e))};s(d,"touchend",f),s(d,"touchcancel",f),s(l,"blur",()=>{for(let[e,a]of(r=!1,t))z.emit("untap",a.x,a.y,e),t.delete(e)})}if(e.keyboardEvents){let e=new Set,t=new Set,a=(e,t="")=>(t=t.toLowerCase())?e.has("space"===t?" ":t):e.size>0;s(l,"keydown",a=>{let l=a.key.toLowerCase();e.has(l)||(e.add(l),t.add(l))}),s(l,"keyup",t=>{e.delete(t.key.toLowerCase())}),s(l,"blur",()=>e.clear()),z.listen("after:update",()=>t.clear()),z.def("iskeydown",t=>a(e,t)),z.def("iskeypressed",e=>a(t,e))}f=!0,z.emit("init",z),m=performance.now(),v=o(S)}function S(t){let a=0,l=(t-m)/1e3;if(m=t,e.animate){if(l>.3);else for(b+=l;b>=w;)a++,z.emit("update",w*g,a),z.def("T",z.T+w*g),b-=w;v&&(v=o(S))}else a=1;a&&(z.textalign("start","top"),z.emit("draw"))}function I(){let t=e.width||l.innerWidth,a=e.height||e.width||l.innerHeight;z.def("W",d.width=t),z.def("H",d.height=a),z.def("CX",z.W/2),z.def("CY",z.H/2),e.autoscale&&(d.style.display||(d.style.display="block",d.style.margin="auto"),p=n.min(l.innerWidth/z.W,l.innerHeight/z.H),p=(e.pixelart?~~p:p)||1,d.style.width=z.W*p+"px",d.style.height=z.H*p+"px"),(!e.antialias||e.pixelart)&&(u.imageSmoothingEnabled=!1,d.style.imageRendering="pixelated"),z.emit("resized",p),z.cls(0),e.animate||o(S)}function P(e,t,a,l,n){if(T[e])for(let i of T[e])i(t,a,l,n)}function X(e,t){let a=e(z,t);for(let e in a)z.def(e,a[e])}if(e.global){if(l.ENGINE)throw Error("two global litecanvas detected");Object.assign(l,z),l.ENGINE=z}return e.canvas&&(d=document.querySelector(e.canvas)),d=d||document.createElement("canvas"),z.def("CANVAS",d),u=d.getContext("2d"),s(d,"click",()=>l.focus()),d.style="",I(),d.parentNode||document.body.appendChild(d),"loading"===document.readyState?s(l,"DOMContentLoaded",()=>o(A)):o(A),z}})();
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litecanvas",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.2",
|
|
4
4
|
"description": "Lightweight HTML5 canvas 2D game engine suitable for small projects and creative coding. Inspired by PICO-8 and P5/Processing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Luiz Bills <luizbills@pm.me>",
|
|
7
7
|
"contributors": [],
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@swc/core": "^1.
|
|
9
|
+
"@swc/core": "^1.12.1",
|
|
10
10
|
"ava": "^6.4.0",
|
|
11
11
|
"esbuild": "^0.25.5",
|
|
12
12
|
"gzip-size": "^7.0.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"main": "src/index.js",
|
|
25
25
|
"types": "types/index.d.ts",
|
|
26
26
|
"scripts": {
|
|
27
|
-
"test": "ava",
|
|
27
|
+
"test": "ava --tap | tap-min",
|
|
28
28
|
"dev:test": "ava --watch",
|
|
29
29
|
"dev": "esbuild src/web.js --bundle --watch --outfile=dist/dist.dev.js --servedir=.",
|
|
30
30
|
"build": "node script/build.js",
|
|
@@ -57,5 +57,8 @@
|
|
|
57
57
|
"tests/**/*",
|
|
58
58
|
"!tests/_mocks"
|
|
59
59
|
]
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"tap-min": "^3.0.0"
|
|
60
63
|
}
|
|
61
64
|
}
|