swf2es 0.1.3 → 0.1.4
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 +4 -4
- package/dist/chunks/{b66880f335048cfe.js → c9dbb43b77c0df16.js} +7 -4
- package/dist/chunks/c9dbb43b77c0df16.js.map +1 -0
- package/dist/swf2es.js +10 -10
- package/dist/swf2es.js.map +1 -1
- package/dist/worker.js +8 -8
- package/dist/worker.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunks/b66880f335048cfe.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,18 +9,18 @@ modules that loads from a CDN, with nothing to install or build. A page
|
|
|
9
9
|
that has a bundler installs `@swf2es/web` instead.
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
|
-
<script type="module" src="https://unpkg.com/swf2es@0.1.
|
|
12
|
+
<script type="module" src="https://unpkg.com/swf2es@0.1.4"></script>
|
|
13
13
|
|
|
14
14
|
<swf2es-player src="movie.swf" width="800" height="600"></swf2es-player>
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
jsDelivr serves it too, at `https://cdn.jsdelivr.net/npm/swf2es@0.1.
|
|
17
|
+
jsDelivr serves it too, at `https://cdn.jsdelivr.net/npm/swf2es@0.1.4`.
|
|
18
18
|
The module exports what `@swf2es/web` does. To call it, import it from the
|
|
19
19
|
same URL, so that the page has one copy:
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
22
|
<script type="module">
|
|
23
|
-
import { configure, watchFlash } from "https://unpkg.com/swf2es@0.1.
|
|
23
|
+
import { configure, watchFlash } from "https://unpkg.com/swf2es@0.1.4";
|
|
24
24
|
|
|
25
25
|
configure({ cache: true }); // keep compiled modules in IndexedDB
|
|
26
26
|
watchFlash(); // the page's Flash <object> and <embed> tags become players
|
|
@@ -37,7 +37,7 @@ Name a version in the URL. Until 1.0, a minor release (0.2) may change
|
|
|
37
37
|
what a page sees, so pin at least the minor version: unpkg's
|
|
38
38
|
`swf2es@0.1` takes 0.1's fixes as they are released, and redirects to the
|
|
39
39
|
exact version, whose files the page then loads together. On jsDelivr, pin
|
|
40
|
-
the exact version (`swf2es@0.1.
|
|
40
|
+
the exact version (`swf2es@0.1.4`): it serves a range without
|
|
41
41
|
redirecting, so the files the main one loads later would come from
|
|
42
42
|
whatever version the range names by then.
|
|
43
43
|
|
|
@@ -312,7 +312,8 @@ void main(void) {
|
|
|
312
312
|
vTexel = aTexel;
|
|
313
313
|
}
|
|
314
314
|
`,en=Array.from({length:8},(e,t)=>` case ${t+1}:
|
|
315
|
-
|
|
315
|
+
t = textureLod(uTextures[${t}], at / vec2(textureSize(uTextures[${t}], 0)), 0.0);
|
|
316
|
+
break;`).join("\n"),eo=`#version 300 es
|
|
316
317
|
precision highp float;
|
|
317
318
|
in vec4 vColor;
|
|
318
319
|
in vec2 vTexel;
|
|
@@ -323,11 +324,12 @@ uniform sampler2D uTextures[8];
|
|
|
323
324
|
out vec4 finalColor;
|
|
324
325
|
|
|
325
326
|
vec4 texel(vec2 at) {
|
|
327
|
+
vec4 t = vec4(0.0);
|
|
326
328
|
switch (vSlot) {
|
|
327
329
|
${en}
|
|
328
330
|
}
|
|
329
331
|
|
|
330
|
-
return
|
|
332
|
+
return t;
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
void main(void) {
|
|
@@ -682,11 +684,12 @@ out vec4 finalColor;
|
|
|
682
684
|
|
|
683
685
|
${ex}
|
|
684
686
|
vec4 texel(vec2 at) {
|
|
687
|
+
vec4 t = vec4(0.0);
|
|
685
688
|
switch (vSlot) {
|
|
686
689
|
${en}
|
|
687
690
|
}
|
|
688
691
|
|
|
689
|
-
return
|
|
692
|
+
return t;
|
|
690
693
|
}
|
|
691
694
|
|
|
692
695
|
void main(void) {
|
|
@@ -953,4 +956,4 @@ float pbPow(float x, float y) {
|
|
|
953
956
|
button[aria-checked=true]::before { content:"✓ "; }
|
|
954
957
|
hr { border:0; border-top:1px solid GrayText; margin:4px; }
|
|
955
958
|
`;let k=r.createElement("div");k.setAttribute("role","menu"),k.setAttribute("aria-label","SWF context menu"),k.tabIndex=-1;let M=[],T=!1,A=(e=!1)=>{!T&&(T=!0,g.abort(),y.remove(),h=null,iE.get(r)===A&&iE.delete(r),e&&v?.isConnected&&v.focus({preventScroll:!0}))};h=A,iE.set(r,A);let F=e=>{!T&&(A(!0),t.destroyed||e.select())};for(let e=0;e<m.length;e++){let t=m[e];if(t.separatorBefore&&e>0){let e=r.createElement("hr");e.setAttribute("role","separator"),k.append(e)}let i=r.createElement("button");i.type="button",i.setAttribute("role",void 0===t.checked?"menuitem":"menuitemradio"),void 0!==t.checked&&i.setAttribute("aria-checked",String(t.checked)),i.textContent=t.caption,i.disabled=!t.enabled,i.tabIndex=-1,i.addEventListener("click",()=>F(t)),t.enabled&&M.push(i),k.append(i)}w.append(b,k),(l instanceof ShadowRoot?l:r.fullscreenElement??r.body).append(y),y.showPopover?.();let R=y.getBoundingClientRect(),E=e.getBoundingClientRect(),L=c?E.left+E.width/2:n.clientX,S=c?E.top+E.height/2:n.clientY;y.style.left=`${Math.max(4,Math.min(L,(a?.innerWidth??0)-R.width-4))}px`,y.style.top=`${Math.max(4,Math.min(S,(a?.innerHeight??0)-R.height-4))}px`,(c?M[0]??k:k).focus({preventScroll:!0});let C=e=>e.composedPath().includes(y);r.addEventListener("pointerdown",e=>{C(e)||A()},x),y.addEventListener("pointerdown",e=>e.stopPropagation()),r.addEventListener("focusin",e=>{C(e)||A()},x),y.addEventListener("contextmenu",e=>{e.preventDefault(),e.stopPropagation()}),a?.addEventListener("blur",()=>A(),x),a?.addEventListener("resize",()=>A(),x),r.addEventListener("scroll",e=>{C(e)||A()},x),r.addEventListener("keyup",e=>e.stopPropagation(),x),r.addEventListener("keydown",e=>{e.stopPropagation();let t=M.indexOf(w.activeElement),i=t;switch(e.key){case"ArrowDown":i=(t+1)%M.length;break;case"ArrowUp":i=t<0?M.length-1:(t-1+M.length)%M.length;break;case"Home":i=0;break;case"End":i=M.length-1;break;case"Enter":case" ":e.preventDefault(),M[t]?.click();return;case"Escape":e.preventDefault(),A(!0);return;case"Tab":A(!0);return;default:return}e.preventDefault(),M[i]?.focus({preventScroll:!0})},x)},c=t=>{if(t.defaultPrevented||"ContextMenu"!==t.key&&!("F10"===t.key&&t.shiftKey))return;t.preventDefault(),t.stopPropagation();let i=new MouseEvent("contextmenu",{bubbles:!0,composed:!0,cancelable:!0});o.add(i),e.dispatchEvent(i)};return e.addEventListener("contextmenu",u),n.addEventListener("keydown",c,{capture:!0}),n!==e&&n.addEventListener("contextmenu",u),()=>{h?.(),e.removeEventListener("contextmenu",u),n.removeEventListener("contextmenu",u),n.removeEventListener("keydown",c,{capture:!0})}}(t,e,e=>{let[t,i]=l(e);return[t,i]},()=>i.bounds),u=new Map,c=(t,i)=>{let s=e.touch;if(!s)return;let[r,a,n,h]=l(i,i.width,i.height),c={x:r,y:a,id:i.pointerId,primary:i.isPrimary,width:n,height:h,pressure:i.pressure,altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,time:i.timeStamp};if("up"===t?u.delete(c.id):u.set(c.id,c),"move"===t){s.post(c),o();return}s.handle("down"===t?"begin":"end",c)},f=(t,i)=>{let s={x:a[0],y:a[1],button:i.button,buttons:i.buttons,altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,time:i.timeStamp};if("move"===t&&e.pointer){e.pointer.post(s),o();return}e.pointer?.handle(t,s)},d=new Set,p=!1,m=t=>{let i="touch"===t.pointerType,s=l(t,t.width,t.height)[4];if(i){(s||d.has(t.pointerId))&&c("move",t);return}s||e.pointer?.captured?(p=!1,f("move",t)):p&&(p=!1,f("leave",t))},g=e=>{l(e,e.width,e.height)[4]&&(d.add(e.pointerId),"touch"===e.pointerType?c("down",e):f("down",e))},x=t=>{let i=l(t,t.width,t.height)[4],s=d.delete(t.pointerId);if(!i&&!s)return;if("touch"===t.pointerType)return void c("up",t);let r=!i&&!!e.pointer?.captured;f("up",t),p||=r&&!e.pointer?.captured},v=e=>{"touch"!==e.pointerType&&(l(e),f("leave",e))},y=t=>{if("touch"!==t.pointerType)return;d.delete(t.pointerId);let i=u.get(t.pointerId);i&&(u.delete(i.id),e.touch?.handle("cancel",{...i,time:t.timeStamp}))},w={lines:0},b=t=>{let i,s,r=e.pointer;if(!r||0===t.deltaY||t.ctrlKey)return;let a=(i=Math.abs(t.deltaY),0!==t.deltaMode?w.lines=-t.deltaY*(2===t.deltaMode?3:1):i>=50?w.lines=-(3*Math.sign(t.deltaY))*Math.max(1,Math.round(i/100)):w.lines-=3*t.deltaY/100,s=Math.trunc(w.lines),w.lines-=s,s),[n,o]=l(t),h={x:n,y:o,buttons:t.buttons,altKey:t.altKey,shiftKey:t.shiftKey,time:t.timeStamp};r.wheel(h,a)&&t.preventDefault()},s.addEventListener("pointermove",m),t.addEventListener("pointerdown",g),s.addEventListener("pointerup",x),t.addEventListener("pointerleave",v),s.addEventListener("pointercancel",y),t.addEventListener("wheel",b,{passive:!1}),k=t.style.touchAction,t.style.touchAction="none",(M=e.pointer)&&(M.onCursor=e=>{t.style.cursor=e},t.style.cursor=M.cursor()),()=>{h(),M&&(M.onCursor=null,t.style.cursor=""),t.style.touchAction=k,n&&(s.cancelAnimationFrame(n),n=0),e.pointer?.flush(),e.touch?.flush(),s.removeEventListener("pointermove",m),t.removeEventListener("pointerdown",g),s.removeEventListener("pointerup",x),t.removeEventListener("pointerleave",v),s.removeEventListener("pointercancel",y),t.removeEventListener("wheel",b)}}destroy(){this.canvas.removeEventListener("webglcontextlost",this.lost),this.canvas.removeEventListener("webglcontextrestored",this.restored),this.backend.destroy(),this.releaseOutlines(),this.ownTessellator?.dispose(),this.ownCanvas&&!this.gl.isContextLost()&&this.gl.getExtension("WEBGL_lose_context")?.loseContext()}}function iB(e){let t=e.flatPlaced;for(let i=e.parent;i;i=i.parent)t=(0,tl.xW)(t,i.flatPlaced);return t}}};
|
|
956
|
-
//# sourceMappingURL=
|
|
959
|
+
//# sourceMappingURL=c9dbb43b77c0df16.js.map
|