@phil65/demoreel 0.1.0 → 0.4.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/README.md +52 -8
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/args.js +34 -0
- package/dist/cli.js +223 -5
- package/dist/compose.d.ts +4 -0
- package/dist/compose.js +4 -0
- package/dist/gif.d.ts +16 -0
- package/dist/gif.js +19 -0
- package/dist/idle.d.ts +8 -2
- package/dist/idle.js +12 -10
- package/dist/index.d.ts +5 -4
- package/dist/index.js +5 -4
- package/dist/marks.js +5 -4
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +3 -3
- package/dist/openscreen/project.js +3 -3
- package/dist/project.d.ts +51 -1
- package/dist/project.js +89 -1
- package/dist/record.d.ts +45 -3
- package/dist/record.js +110 -31
- package/dist/recorder.d.ts +1 -0
- package/dist/recorder.js +8 -0
- package/dist/renderer/assets/CanvasPool-PBu3bHFZ.js +1 -0
- package/dist/renderer/assets/CanvasRenderer-HmF-4gyW.js +1 -0
- package/dist/renderer/assets/RenderTargetSystem-Dk1U4wDJ.js +184 -0
- package/dist/renderer/assets/WebGLRenderer-C0v9HBel.js +149 -0
- package/dist/renderer/assets/WebGPURenderer-Ce0-U9Q1.js +95 -0
- package/dist/renderer/assets/{browserAll-aHn2isHo.js → browserAll-DhvWQ7nM.js} +2 -2
- package/dist/renderer/assets/canvasUtils-KRroregW.js +1 -0
- package/dist/renderer/assets/{getTexelRangeRects-yD6MQ0xy.js → getTexelRangeRects-D3pwCyRt.js} +3 -3
- package/dist/renderer/assets/index-CE-lli1m.js +556 -0
- package/dist/renderer/assets/init-DfmWKarH.js +83 -0
- package/dist/renderer/assets/webworkerAll-B41hok0-.js +1 -0
- package/dist/renderer/index.html +1 -6
- package/dist/scene.d.ts +85 -9
- package/dist/scene.js +310 -48
- package/dist/types.d.ts +6 -1
- package/dist/zoom.d.ts +2 -0
- package/dist/zoom.js +10 -4
- package/package.json +2 -2
- package/dist/renderer/assets/CanvasPool-CHSHS1-v.js +0 -23
- package/dist/renderer/assets/RenderTargetSystem-EAUH9iQk.js +0 -404
- package/dist/renderer/assets/canvasUtils-n5g2f3_X.js +0 -1
- package/dist/renderer/assets/getTextureBatchBindGroup-Bwvgbco6.js +0 -1
- package/dist/renderer/assets/index-BwP6rH7I.js +0 -556
- package/dist/renderer/assets/init-C2Za5NQh.js +0 -83
- package/dist/renderer/assets/webworkerAll-JSSmbaR2.js +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import{B as e,Ct as t,Dt as n,Et as r,H as i,L as a,M as o,R as s,Z as c,b as l,ct as u,dt as d,ut as f,z as p}from"./index-CE-lli1m.js";import{t as m}from"./canvasUtils-KRroregW.js";import{t as h}from"./CanvasPool-PBu3bHFZ.js";var g=new t;function _(e,t){t.clear();let n=t.matrix;for(let n=0;n<e.length;n++){let r=e[n];if(r.globalDisplayStatus<7)continue;let i=r.renderGroup??r.parentRenderGroup;t.matrix=i?.isCachedAsTexture?g.copyFrom(i.textureOffsetInverseTransform).append(r.worldTransform):i?._parentCacheAsTextureRenderGroup?g.copyFrom(i._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(r.groupTransform):r.worldTransform,t.addBounds(r.bounds)}return t.matrix=n,t}var v=new f;function y(e,t,n,r,i=!1,a){let o=v;o.minX=0,o.minY=0,o.maxX=e.width/r|0,o.maxY=e.height/r|0;let s=c.getOptimalTexture({width:o.width,height:o.height,resolution:r,autoGenerateMipmaps:i,scaleMode:a});return s.source.uploadMethodId=`image`,s.source.resource=e,s.source.alphaMode=`premultiply-alpha-on-upload`,s.frame.width=t/r,s.frame.height=n/r,s.source.emit(`update`,s.source),s.updateUvs(),s}function b(e){return typeof e.getCanvasFilterString==`function`}var x=class{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new f,this.cssFilterString=``}},S=class{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){let t=this._pushFilterFrame(),n=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=n,t.container=e.container,t.cssFilterString=``,n.every(e=>!e.enabled)){t.skip=!0;return}let r=[];for(let e of n){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&r.push(t)}if(r.length===0){t.skip=!0;return}t.cssFilterString=r.join(` `),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;let i=this.renderer.canvasContext.activeContext,a=i.filter||`none`;if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){let e=this.renderer.canvasContext.activeResolution||1;i.save(),i.setTransform(1,0,0,1,0,0),i.beginPath(),i.rect(t.bounds.x*e,t.bounds.y*e,t.bounds.width*e,t.bounds.height*e),i.clip()}else t.useClip=!1;t.cssFilterString&&(i.filter=a===`none`?t.cssFilterString:`${a} ${t.cssFilterString}`)}pop(){let e=this._popFilterFrame();if(e.skip)return;let t=this._savedStates.pop();if(!t)return;let n=this.renderer.canvasContext.activeContext;e.useClip?n.restore():n.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!t?.length||t.every(e=>!e.enabled))return e;let n=[];for(let e of t){if(!e.enabled)continue;if(!b(e)){this._warnUnsupportedFilter(e);continue}let t=e.getCanvasFilterString();t===null?this._warnUnsupportedFilter(e):t&&n.push(t)}if(n.length===0)return e;let r=m.getCanvasSource(e);if(!r)return e;let i=e.frame,a=e.source._resolution??e.source.resolution??1,o=i.width,s=i.height,{canvas:c,context:l}=h.getOptimalCanvasAndContext(o,s,a);l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,c.width,c.height),n.length&&(l.filter=n.join(` `));let u=i.x*a,d=i.y*a,f=o*a,p=s*a;return l.drawImage(r,u,d,f,p,0,0,f,p),l.filter=`none`,l.globalAlpha=1,y(c,o,s,a)}_calculateFilterArea(e,t){if(e.renderables?_(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){let n=(e.container.renderGroup||e.container.parentRenderGroup)?.cacheToLocalTransform;n&&t.applyMatrix(n)}}_warnUnsupportedFilter(e){let t=e?.constructor?.name||`Filter`;this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||=this._filterStack[this._filterStackIndex]=new x,this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}};S.extension={type:[r.CanvasSystem],name:`filter`};var C=`in vec2 aPosition;
|
|
2
|
+
out vec2 vTextureCoord;
|
|
3
|
+
|
|
4
|
+
uniform vec4 uInputSize;
|
|
5
|
+
uniform vec4 uOutputFrame;
|
|
6
|
+
uniform vec4 uOutputTexture;
|
|
7
|
+
|
|
8
|
+
vec4 filterVertexPosition( void )
|
|
9
|
+
{
|
|
10
|
+
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
|
|
11
|
+
|
|
12
|
+
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
|
|
13
|
+
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
|
|
14
|
+
|
|
15
|
+
return vec4(position, 0.0, 1.0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
vec2 filterTextureCoord( void )
|
|
19
|
+
{
|
|
20
|
+
return aPosition * (uOutputFrame.zw * uInputSize.zw);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void main(void)
|
|
24
|
+
{
|
|
25
|
+
gl_Position = filterVertexPosition();
|
|
26
|
+
vTextureCoord = filterTextureCoord();
|
|
27
|
+
}
|
|
28
|
+
`,w=`in vec2 vTextureCoord;
|
|
29
|
+
out vec4 finalColor;
|
|
30
|
+
uniform sampler2D uTexture;
|
|
31
|
+
void main() {
|
|
32
|
+
finalColor = texture(uTexture, vTextureCoord);
|
|
33
|
+
}
|
|
34
|
+
`,T=`struct GlobalFilterUniforms {
|
|
35
|
+
uInputSize: vec4<f32>,
|
|
36
|
+
uInputPixel: vec4<f32>,
|
|
37
|
+
uInputClamp: vec4<f32>,
|
|
38
|
+
uOutputFrame: vec4<f32>,
|
|
39
|
+
uGlobalFrame: vec4<f32>,
|
|
40
|
+
uOutputTexture: vec4<f32>,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms;
|
|
44
|
+
@group(0) @binding(1) var uTexture: texture_2d<f32>;
|
|
45
|
+
@group(0) @binding(2) var uSampler: sampler;
|
|
46
|
+
|
|
47
|
+
struct VSOutput {
|
|
48
|
+
@builtin(position) position: vec4<f32>,
|
|
49
|
+
@location(0) uv: vec2<f32>
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32>
|
|
53
|
+
{
|
|
54
|
+
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
|
|
55
|
+
|
|
56
|
+
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
|
|
57
|
+
position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
|
|
58
|
+
|
|
59
|
+
return vec4(position, 0.0, 1.0);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32>
|
|
63
|
+
{
|
|
64
|
+
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@vertex
|
|
68
|
+
fn mainVertex(
|
|
69
|
+
@location(0) aPosition: vec2<f32>,
|
|
70
|
+
) -> VSOutput {
|
|
71
|
+
return VSOutput(
|
|
72
|
+
filterVertexPosition(aPosition),
|
|
73
|
+
filterTextureCoord(aPosition)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@fragment
|
|
78
|
+
fn mainFragment(
|
|
79
|
+
@location(0) uv: vec2<f32>,
|
|
80
|
+
) -> @location(0) vec4<f32> {
|
|
81
|
+
return textureSample(uTexture, uSampler, uv);
|
|
82
|
+
}
|
|
83
|
+
`,E=class extends o{constructor(){let t=e.from({vertex:{source:T,entryPoint:`mainVertex`},fragment:{source:T,entryPoint:`mainFragment`},name:`passthrough-filter`}),n=i.from({vertex:C,fragment:w,name:`passthrough-filter`});super({gpuProgram:t,glProgram:n})}},D=class{constructor(e){this._renderer=e}push(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:`filter`,canBundle:!1,action:`pushFilter`,container:t,filterEffect:e})}pop(e,t,n){this._renderer.renderPipes.batch.break(n),n.add({renderPipeId:`filter`,action:`popFilter`,canBundle:!1})}execute(e){e.action===`pushFilter`?this._renderer.filter.push(e):e.action===`popFilter`&&this._renderer.filter.pop()}destroy(){this._renderer=null}};D.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:`filter`};var O=new l({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:`float32x2`,stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),k=class{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new f,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}},A=class{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new p({uInputSize:{value:new Float32Array(4),type:`vec4<f32>`},uInputPixel:{value:new Float32Array(4),type:`vec4<f32>`},uInputClamp:{value:new Float32Array(4),type:`vec4<f32>`},uOutputFrame:{value:new Float32Array(4),type:`vec4<f32>`},uGlobalFrame:{value:new Float32Array(4),type:`vec4<f32>`},uOutputTexture:{value:new Float32Array(4),type:`vec4<f32>`}}),this._globalFilterBindGroup=new s({}),this.renderer=e}init(){c.on(`evict`,this._unbindPassTextures,this)}get activeBackTexture(){return this._activeFilterData?.backTexture}push(e){let t=this.renderer,n=e.filterEffect.filters,r=this._pushFilterData();r.skip=!1,r.filters=n,r.container=e.container,r.outputRenderSurface=t.renderTarget.renderSurface;let i=t.renderTarget.renderTarget.colorTexture.source,a=i.resolution,o=i.antialias;if(n.every(e=>!e.enabled)){r.skip=!0;return}let s=r.bounds;if(this._calculateFilterArea(e,s),this._calculateFilterBounds(r,t.renderTarget.rootViewPort,o,a,1),r.skip)return;let c=this._getPreviousFilterData();this._setupFilterTextures(r,s,t,c)}generateFilteredTexture({texture:e,filters:t}){if(t.every(e=>!e.enabled))return e;let n=this._pushFilterData();this._activeFilterData=n,n.skip=!1,n.filters=t;let r=e.source,i=r.resolution,a=r.antialias,o=n.bounds;if(o.clear(),o.addRect(e.frame),this._calculateFilterBounds(n,o.rectangle,a,i,0),n.skip)return this._popFilterData(),e;n.outputRenderSurface=c.getOptimalTexture({width:o.width,height:o.height,resolution:n.resolution,antialias:n.antialias}),n.backTexture=d.EMPTY,n.inputTexture=e,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(n,!0);let s=n.outputRenderSurface;return s.source.alphaMode=`premultiplied-alpha`,this._popFilterData(),s}pop(){let e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&c.returnTexture(t.backTexture),c.returnTexture(t.inputTexture))}getBackTexture(e,t,n){let{_resolution:r,format:i}=e.colorTexture.source,a=c.getOptimalTexture({width:t.width,height:t.height,resolution:r,format:i});return this._copyBackTexture(e,a,t,n)}_copyBackTexture(e,t,n,r){let i=t.source._resolution,a=n.minX,o=n.minY;r&&(a-=r.minX,o-=r.minY),a=Math.floor(a*i+1e-6),o=Math.floor(o*i+1e-6);let s=Math.min(Math.ceil(n.width*i),t.source.pixelWidth),c=Math.min(Math.ceil(n.height*i),t.source.pixelHeight);return this.renderer.renderTarget.copyToTexture(e,t,{x:a,y:o},{width:s,height:c},{x:0,y:0}),t}applyFilter(e,t,n,r){let i=this.renderer,a=this._activeFilterData,o=a.outputRenderSurface===n,s=this._findClosestFilterData(),c=s?s.inputTexture.source._resolution:i.renderTarget.rootRenderTarget.colorTexture.source._resolution,l=0,u=0;o&&s&&(l=s.bounds.minX,u=s.bounds.minY),this._updateFilterUniforms(t,n,a,l,u,c,o,r);let d=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(d,t,i)}calculateSpriteMatrix(e,n){let r=this._activeFilterData,i=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),a=n.worldTransform.copyTo(t.shared),o=n.renderGroup||n.parentRenderGroup;return o&&o.cacheToLocalTransform&&a.prepend(o.cacheToLocalTransform),a.invert(),i.prepend(a),i.scale(1/n.texture.orig.width,1/n.texture.orig.height),i.translate(n.anchor.x,n.anchor.y),i}destroy(){this._passthroughFilter?.destroy(!0),this._passthroughFilter=null,c.off(`evict`,this._unbindPassTextures,this),this._globalFilterBindGroup.destroy()}_unbindPassTextures(){let e=this._globalFilterBindGroup;e.setResource(d.EMPTY.source,1),e.setResource(d.EMPTY.source.style,2),e.setResource(d.EMPTY.source,3)}_getPassthroughFilter(){return this._passthroughFilter??=new E,this._passthroughFilter}_setupBindGroupsAndRender(e,t,n){if(n.renderPipes.uniformBatch){let e=n.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(e,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:O,shader:e,state:e._state,topology:`triangle-list`}),n.type===a.WEBGL&&n.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,n,r){if(e.backTexture=d.EMPTY,e.inputTexture=c.getOptimalTexture({width:t.width,height:t.height,resolution:e.resolution,antialias:e.antialias}),e.blendRequired){n.renderTarget.finishRenderPass();let i=n.renderTarget.getRenderTarget(e.outputRenderSurface),a=i.colorTexture.source,o=c.getAlignedTexture(e.inputTexture,a._resolution,a.format);e.backTexture=this._copyBackTexture(i,o,t,r?.bounds)}n.renderTarget.bind({target:e.inputTexture,clear:!0}),n.globalUniforms.push({offset:t})}_updateFilterUniforms(e,t,n,r,i,a,o,s){let c=this._filterGlobalUniforms.uniforms,l=c.uOutputFrame,u=c.uInputSize,f=c.uInputPixel,p=c.uInputClamp,m=c.uGlobalFrame,h=c.uOutputTexture;o?(l[0]=n.bounds.minX-r,l[1]=n.bounds.minY-i):(l[0]=0,l[1]=0),l[2]=e.frame.width,l[3]=e.frame.height,u[0]=e.source.width,u[1]=e.source.height,u[2]=1/u[0],u[3]=1/u[1],f[0]=e.source.pixelWidth,f[1]=e.source.pixelHeight,f[2]=1/f[0],f[3]=1/f[1],p[0]=.5*f[2],p[1]=.5*f[3],p[2]=e.frame.width*u[2]-.5*f[2],p[3]=e.frame.height*u[3]-.5*f[3];let g=this.renderer.renderTarget.rootRenderTarget.colorTexture;m[0]=r*a,m[1]=i*a,m[2]=g.source.width*a,m[3]=g.source.height*a,t instanceof d&&(t.source.resource=null);let _=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind({target:t,clear:!!s}),t instanceof d?(h[0]=t.frame.width,h[1]=t.frame.height):(h[0]=_.width,h[1]=_.height),h[2]=_.isRoot?-1:1,this._filterGlobalUniforms.update()}_findClosestFilterData(){for(let e=this._filterStackIndex-1;e>=0;e--){let t=this._filterStack[e];if(!t.skip)return t}return null}_calculateFilterArea(e,t){if(e.renderables?_(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){let n=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;n&&t.applyMatrix(n)}}_applyFiltersToTexture(e,t){let n=e.inputTexture,r=e.bounds,i=e.filters,a=e.firstEnabledIndex,o=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(n.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),a===o)i[a].apply(this,n,e.outputRenderSurface,t);else{let n=e.inputTexture,s=c.getOptimalTexture({width:r.width,height:r.height,resolution:n.source._resolution}),l=s;for(let e=a;e<o;e++){let t=i[e];if(!t.enabled)continue;t.apply(this,n,l,!0);let r=n;n=l,l=r}i[o].apply(this,n,e.outputRenderSurface,t),c.returnTexture(s)}}_calculateFilterBounds(e,t,n,r,i){let a=this.renderer,o=e.bounds,s=e.filters,c=1/0,l=0,d=!0,f=!1,p=!1,m=!0,h=-1,g=-1;for(let e=0;e<s.length;e++){let t=s[e];if(t.enabled){if(h===-1&&(h=e),g=e,c=Math.min(c,t.resolution===`inherit`?r:t.resolution),l+=t.padding,t.antialias===`off`?d=!1:t.antialias===`inherit`&&(d&&=n),t.clipToViewport||(m=!1),!(t.compatibleRenderers&a.type)){p=!1;break}if(t.blendRequired&&!(a.backBuffer?.useBackBuffer??!0)){u("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),p=!1;break}p=!0,f||=t.blendRequired}}p?(m&&o.fitBounds(0,t.width/r,0,t.height/r),o.scale(c).ceil().scale(1/c).pad((l|0)*i),o.isPositive?(e.antialias=d,e.resolution=c,e.blendRequired=f,e.firstEnabledIndex=h,e.lastEnabledIndex=g):e.skip=!0):e.skip=!0}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){for(let e=this._filterStackIndex-2;e>=0;e--){let t=this._filterStack[e];if(!t.skip)return t}return null}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||=this._filterStack[this._filterStackIndex]=new k,this._filterStackIndex++,e}};A.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:`filter`},n.add(A,S),n.add(D);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./index-CE-lli1m.js";import"./init-DfmWKarH.js";
|
package/dist/renderer/index.html
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html>
|
|
3
|
-
<head><meta charset="utf-8" /><title>demoreel renderer</title> <script type="module" crossorigin src="./assets/index-
|
|
4
|
-
<link rel="modulepreload" crossorigin href="./assets/CanvasPool-CHSHS1-v.js">
|
|
5
|
-
<link rel="modulepreload" crossorigin href="./assets/canvasUtils-n5g2f3_X.js">
|
|
6
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderTargetSystem-EAUH9iQk.js">
|
|
7
|
-
<link rel="modulepreload" crossorigin href="./assets/getTextureBatchBindGroup-Bwvgbco6.js">
|
|
8
|
-
<link rel="modulepreload" crossorigin href="./assets/getTexelRangeRects-yD6MQ0xy.js">
|
|
3
|
+
<head><meta charset="utf-8" /><title>demoreel renderer</title> <script type="module" crossorigin src="./assets/index-CE-lli1m.js"></script>
|
|
9
4
|
</head>
|
|
10
5
|
<body style="margin:0;background:#111;color:#ddd;font:14px sans-serif">
|
|
11
6
|
<div id="status">demoreel headless renderer</div>
|
package/dist/scene.d.ts
CHANGED
|
@@ -5,10 +5,45 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Locator, Page } from "playwright";
|
|
7
7
|
import { type Point } from "./motion.ts";
|
|
8
|
-
import type { ScreencastRecorder } from "./recorder.ts";
|
|
9
8
|
import type { ActionRecord, Caption, CursorSample, Depth, Viewport, ZoomHint } from "./types.ts";
|
|
10
|
-
/**
|
|
11
|
-
export
|
|
9
|
+
/** Minimal recording clock (satisfied by ScreencastRecorder and dry-run clocks). */
|
|
10
|
+
export interface SceneClock {
|
|
11
|
+
now(): number;
|
|
12
|
+
}
|
|
13
|
+
/** Accessibility-first target spec mapped to Playwright's `getBy*` / `locator` methods. */
|
|
14
|
+
export type TargetSpec = {
|
|
15
|
+
role: Parameters<Page["getByRole"]>[0];
|
|
16
|
+
name?: string | RegExp;
|
|
17
|
+
exact?: boolean;
|
|
18
|
+
nth?: number;
|
|
19
|
+
} | {
|
|
20
|
+
label: string | RegExp;
|
|
21
|
+
exact?: boolean;
|
|
22
|
+
nth?: number;
|
|
23
|
+
} | {
|
|
24
|
+
placeholder: string | RegExp;
|
|
25
|
+
exact?: boolean;
|
|
26
|
+
nth?: number;
|
|
27
|
+
} | {
|
|
28
|
+
text: string | RegExp;
|
|
29
|
+
exact?: boolean;
|
|
30
|
+
nth?: number;
|
|
31
|
+
} | {
|
|
32
|
+
testId: string | RegExp;
|
|
33
|
+
nth?: number;
|
|
34
|
+
} | {
|
|
35
|
+
css: string;
|
|
36
|
+
nth?: number;
|
|
37
|
+
};
|
|
38
|
+
/** A CSS/Playwright selector string, a Playwright Locator, or a structured TargetSpec. */
|
|
39
|
+
export type Target = string | Locator | TargetSpec;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves a Target to a Playwright Locator filtered to visible matches.
|
|
42
|
+
* Uses `.nth(nth)` when `nth` is specified on a TargetSpec, otherwise `.first()`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveTarget(page: Page, target: Target): Locator;
|
|
45
|
+
/** Readable default label for a Target, used in timeline.json, marks.json and error messages. */
|
|
46
|
+
export declare function describeTarget(target: Target): string;
|
|
12
47
|
/** Attribute that marks a zoom anchor: actions inside it zoom onto the anchor's box. */
|
|
13
48
|
export declare const ZOOM_ATTRIBUTE = "data-demoreel-zoom";
|
|
14
49
|
export interface PacingOptions {
|
|
@@ -29,7 +64,7 @@ export declare const DEFAULT_PACING: PacingOptions;
|
|
|
29
64
|
export interface ActionOptions {
|
|
30
65
|
/** Zoom onto the target (click/type default true, hover default false). */
|
|
31
66
|
zoom?: boolean | ZoomHint;
|
|
32
|
-
/** Shown in timeline.json / marks.json (default: the
|
|
67
|
+
/** Shown in timeline.json / marks.json (default: derived from the target). */
|
|
33
68
|
label?: string;
|
|
34
69
|
/** Wait for a navigation started by this click. */
|
|
35
70
|
navigates?: boolean;
|
|
@@ -45,6 +80,14 @@ export interface ZoomOptions {
|
|
|
45
80
|
wait?: boolean;
|
|
46
81
|
label?: string;
|
|
47
82
|
}
|
|
83
|
+
export interface ClickRippleOptions {
|
|
84
|
+
/** Ring stroke colour (default "rgba(96, 165, 250, 0.9)"). */
|
|
85
|
+
color?: string;
|
|
86
|
+
/** Base ring diameter in px before expansion (default 36). */
|
|
87
|
+
size?: number;
|
|
88
|
+
/** Ripple animation duration in ms (default 380). */
|
|
89
|
+
durationMs?: number;
|
|
90
|
+
}
|
|
48
91
|
export interface HighlightOptions {
|
|
49
92
|
/** How long the highlight stays (ms, default 1800). */
|
|
50
93
|
duration?: number;
|
|
@@ -52,12 +95,23 @@ export interface HighlightOptions {
|
|
|
52
95
|
color?: string;
|
|
53
96
|
/** Space between element and outline (px, default 6). */
|
|
54
97
|
padding?: number;
|
|
98
|
+
/** Spotlight backdrop dim outside the element (`true` => 0.55 opacity, or a 0-1 alpha). */
|
|
99
|
+
dim?: boolean | number;
|
|
100
|
+
/** Optional short callout badge floating next to the highlighted element. */
|
|
101
|
+
badge?: string;
|
|
55
102
|
/** Also zoom onto the element while highlighted (default false). */
|
|
56
103
|
zoom?: boolean | ZoomHint;
|
|
57
104
|
/** Block until the highlight is gone (default false). */
|
|
58
105
|
wait?: boolean;
|
|
59
106
|
label?: string;
|
|
60
107
|
}
|
|
108
|
+
export interface PressOptions {
|
|
109
|
+
label?: string;
|
|
110
|
+
/** Show a keycap HUD overlay for this key press (overrides `look.showKeys`). */
|
|
111
|
+
show?: boolean;
|
|
112
|
+
/** How long the keycap HUD stays visible (ms). */
|
|
113
|
+
duration?: number;
|
|
114
|
+
}
|
|
61
115
|
/** Applies a `data-demoreel-zoom` value to an action's zoom setting. */
|
|
62
116
|
export declare function applyZoomAnchor(zoom: boolean | ZoomHint, anchor: {
|
|
63
117
|
value: string;
|
|
@@ -72,13 +126,17 @@ export declare class Scene {
|
|
|
72
126
|
private rand;
|
|
73
127
|
private recorder;
|
|
74
128
|
private startRecording;
|
|
129
|
+
private fast;
|
|
130
|
+
private clickRipple;
|
|
75
131
|
pacing: PacingOptions;
|
|
76
132
|
/** The underlying Playwright page, for anything the Scene API does not cover. */
|
|
77
133
|
readonly page: Page;
|
|
78
134
|
readonly viewport: Viewport;
|
|
79
|
-
constructor(page: Page, viewport: Viewport, startRecording: () => Promise<
|
|
135
|
+
constructor(page: Page, viewport: Viewport, startRecording: () => Promise<SceneClock>, opts?: {
|
|
80
136
|
seed?: number;
|
|
81
137
|
pacing?: Partial<PacingOptions>;
|
|
138
|
+
clickRipple?: boolean | ClickRippleOptions;
|
|
139
|
+
fast?: boolean;
|
|
82
140
|
});
|
|
83
141
|
private ensureRecording;
|
|
84
142
|
/** Current time on the recording clock (ms since the first frame; 0 before recording). */
|
|
@@ -94,19 +152,37 @@ export declare class Scene {
|
|
|
94
152
|
private kindAt;
|
|
95
153
|
/** Moves the real mouse along an eased curve at ~60 Hz, recording every position. */
|
|
96
154
|
private travel;
|
|
155
|
+
private showClickRipple;
|
|
97
156
|
private clickHere;
|
|
98
157
|
private record;
|
|
99
158
|
goto(url: string, opts?: {
|
|
100
159
|
waitUntil?: "load" | "domcontentloaded" | "networkidle";
|
|
101
160
|
}): Promise<void>;
|
|
102
161
|
click(target: Target, opts?: ActionOptions): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Moves to a `<select>` element and picks an option via Playwright's `selectOption`.
|
|
164
|
+
*/
|
|
165
|
+
select(target: Target, value: string | {
|
|
166
|
+
value?: string;
|
|
167
|
+
label?: string;
|
|
168
|
+
index?: number;
|
|
169
|
+
}, opts?: ActionOptions): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Drags from a target or viewport point to another target, point, or relative offset `{ dx, dy }`.
|
|
172
|
+
* Records continuous cursor telemetry so OpenScreen renders the cursor tracking the drag
|
|
173
|
+
* (useful for 3D canvases, sliders, and drag-and-drop).
|
|
174
|
+
*/
|
|
175
|
+
drag(from: Target | Point, to: Target | Point | {
|
|
176
|
+
dx: number;
|
|
177
|
+
dy: number;
|
|
178
|
+
}, opts?: ActionOptions & {
|
|
179
|
+
duration?: number;
|
|
180
|
+
}): Promise<void>;
|
|
103
181
|
type(target: Target, text: string, opts?: ActionOptions & {
|
|
104
182
|
clear?: boolean;
|
|
105
183
|
}): Promise<void>;
|
|
106
184
|
/** Presses a key or chord (Playwright syntax, e.g. "Enter", "Control+K"). */
|
|
107
|
-
press(key: string, opts?:
|
|
108
|
-
label?: string;
|
|
109
|
-
}): Promise<void>;
|
|
185
|
+
press(key: string, opts?: PressOptions): Promise<void>;
|
|
110
186
|
hover(target: Target, opts?: ActionOptions & {
|
|
111
187
|
dwell?: number;
|
|
112
188
|
}): Promise<void>;
|
|
@@ -133,7 +209,7 @@ export declare class Scene {
|
|
|
133
209
|
* Non-blocking by default: script the actions to show while zoomed right after it.
|
|
134
210
|
*/
|
|
135
211
|
zoom(target: Target, opts?: ZoomOptions): Promise<void>;
|
|
136
|
-
/** Draws an outline
|
|
212
|
+
/** Draws an outline (and optional spotlight dim / badge) around an element in the page. */
|
|
137
213
|
highlight(target: Target, opts?: HighlightOptions): Promise<void>;
|
|
138
214
|
pause(ms: number): Promise<void>;
|
|
139
215
|
/**
|