@motionscript/core 0.1.0-alpha.9 → 0.1.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/CHANGELOG.md +19 -0
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +20 -5
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/browser/chunks/chunk-CCGVIR4F.js +3 -0
- package/dist/browser/chunks/chunk-CCGVIR4F.js.map +7 -0
- package/dist/browser/chunks/chunk-N4WSN5WY.js +13 -0
- package/dist/browser/chunks/chunk-N4WSN5WY.js.map +7 -0
- package/dist/browser/chunks/chunk-WZSI3GSK.js +6 -0
- package/dist/browser/chunks/{chunk-7DB6BI27.js.map → chunk-WZSI3GSK.js.map} +4 -4
- package/dist/browser/component.js +1 -1
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/components/factory/views.d.ts.map +1 -1
- package/dist/components/factory/views.js +41 -1
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/trees/node/node-reactive.d.ts +3 -4
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -1
- package/dist/components/trees/node/node-reactive.js +13 -10
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/document/command-traits.d.ts +8 -0
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +17 -0
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/settled-index.d.ts +6 -0
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +18 -1
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +26 -6
- package/dist/document/timeline.js.map +1 -1
- package/dist/props/host.d.ts +5 -0
- package/dist/props/host.d.ts.map +1 -1
- package/dist/props/host.js +3 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/layout.d.ts +29 -0
- package/dist/props/layout.d.ts.map +1 -0
- package/dist/props/layout.js +84 -0
- package/dist/props/layout.js.map +1 -0
- package/package.json +1 -1
- package/dist/browser/chunks/chunk-7DB6BI27.js +0 -6
- package/dist/browser/chunks/chunk-IX53IFBD.js +0 -13
- package/dist/browser/chunks/chunk-IX53IFBD.js.map +0 -7
- package/dist/browser/chunks/chunk-Q55UPA3E.js +0 -3
- package/dist/browser/chunks/chunk-Q55UPA3E.js.map +0 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p,b as t,c as x,d as a,e as b,f as c,g as v,h as w}from"./chunks/chunk-4BDLFEOC.js";import{A as q,B as s,C as u,n as o,o as r,p as e,q as f,r as m,s as d,t as g,u as h,v as i,w as j,x as k,y as l,z as n}from"./chunks/chunk-
|
|
1
|
+
import{a as p,b as t,c as x,d as a,e as b,f as c,g as v,h as w}from"./chunks/chunk-4BDLFEOC.js";import{A as q,B as s,C as u,n as o,o as r,p as e,q as f,r as m,s as d,t as g,u as h,v as i,w as j,x as k,y as l,z as n}from"./chunks/chunk-CCGVIR4F.js";export{b as MAX_FRACTION_DIGITS,a as NUMBER_NODE_FORMATS,p as NUMBER_PATTERNS,r as STAR_DEFAULT_POINTS,o as STAR_DEFAULT_RATIO,q as cameraOrbit,w as enterBudget,t as formatNumber,m as hasShapeOutline,g as hostTextFamily,i as lerpColor3D,k as lerpCount,j as lerpFinite,v as niceStep,c as numberNodePattern,s as orbitPosition,u as orbitProps,x as patternFor,h as resolveColor3D,d as setHostTextFamily,f as shapeOutline,e as shapeOutlinePixels,n as snapFlag,l as snapValue};
|
|
2
2
|
//# sourceMappingURL=component.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$d as a,Ce as e,Ie as d,Je as m,Ke as p,Nd as o,Od as r,Rd as s,Vd as n,Ve as f,Wd as t,_e as _,he as c,le as x,xe as i}from"./chunks/chunk-
|
|
1
|
+
import{$d as a,Ce as e,Ie as d,Je as m,Ke as p,Nd as o,Od as r,Rd as s,Vd as n,Ve as f,Wd as t,_e as _,he as c,le as x,xe as i}from"./chunks/chunk-WZSI3GSK.js";import"./chunks/chunk-CCGVIR4F.js";var v=o,w=m,S=p,h=t,C=r,D=e;export{x as Aim,s as Corners,n as Flow,f as Material,a as Paint,c as Shapes,i as TextLayout,d as TextStyle,C as Types,_ as View3D,h as commandsFor,v as component2d,S as component3d,w as componentAudio,D as provides};
|
|
2
2
|
//# sourceMappingURL=experimental.js.map
|
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as Hs,$a as Gi,$b as qa,A as cs,Aa as _i,Ab as wa,Ac as gn,B as hs,Ba as Ai,Bb as ya,Bc as xn,C as ls,Ca as Pi,Cb as _a,Cc as un,D as gs,Da as Ti,Db as Aa,Dc as wn,E as xs,Ea as Fi,Eb as Pa,Ec as yn,F as us,Fa as Li,Fb as Ta,Fc as _n,G as ws,Ga as Si,Gb as Fa,Gc as An,H as ys,Ha as Ei,Hb as La,Hc as T,I as _s,Ia as Ni,Ib as Sa,Ic as Pn,J as bs,Ja as bi,Jb as Ea,Jc as F,K as Ds,Ka as Di,Kb as Na,Kc as L,L as Ms,La as Mi,Lb as ba,Lc as l,M as Us,Ma as Ui,Mb as Da,Mc as Tn,N as Cs,Na as Ci,Nb as Ma,Nc as Fn,O as vs,Oa as vi,Ob as Ua,Oc as Ln,P as Vs,Pa as Vi,Pb as Ca,Pc as Sn,Q as Is,Qa as Ii,Qb as va,Qc as bn,R as Ws,Ra as Wi,Rb as Va,Rc as Dn,S as Ks,Sa as Ki,Sb as A,Sc as Mn,T as Rs,Ta as Ri,Tb as P,Tc as Un,U as $s,Ua as $i,Ub as Ia,V as js,Va as ji,Vb as Wa,W as Ys,Wa as Yi,Wb as Ka,X as qs,Xa as qi,Xb as Ra,Y as zs,Ya as f,Yb as $a,Z as Bs,Za as zi,Zb as ja,_ as Gs,_a as Bi,_b as Ya,a as or,aa as Js,ab as Hi,ac as za,b as sr,ba as Qs,bb as Ji,bc as Ba,c as ir,ca as Xs,cb as Qi,cc as Ga,d as ar,da as Zs,db as Xi,dc as Ha,e as nr,ea as ks,eb as Zi,ec as Ja,f as dr,fa as Os,fb as m,fc as Qa,g as pr,ga as ei,gb as ki,gc as Xa,h as fr,ha as ti,hb as Oi,hc as Za,i as mr,ia as ri,ib as ea,ic as ka,j as Vr,ja as oi,jb as ta,jc as Oa,k as Ir,ka as si,kb as ra,kc as c,l as Wr,la as ii,lb as oa,lc as h,m as Kr,ma as ai,mb as sa,mc as en,n as Ao,na as ni,nb as ia,nc as tn,o as Po,oa as di,ob as aa,oc as rn,p as To,pa as pi,pb as na,pc as on,q as Fo,qa as fi,qb as da,qc as sn,r as Do,ra as mi,rb as pa,rc as an,s as ss,sa as ci,sb as fa,sc as nn,t as is,ta as hi,tb as ma,tc as dn,u as as,ua as li,ub as ca,uc as pn,v as ns,va as gi,vb as ha,vc as fn,w as ds,wa as xi,wb as la,wc as mn,x as ps,xa as ui,xb as ga,xc as cn,y as fs,ya as wi,yb as xa,yc as hn,z as ms,za as yi,zb as ua,zc as ln}from"./chunks/chunk-IX53IFBD.js";import{$ as Ue,$a as Ct,A as ae,Aa as ot,Ab as cr,Ad as Qo,Ae as Es,B as ne,Ba as st,Bb as hr,Bd as Xo,Be as Ns,C as de,Ca as it,Cb as lr,Cc as ro,Cd as Zo,D as pe,Da as at,Db as gr,Dc as oo,Dd as ko,E as fe,Ea as nt,Eb as xr,Ed as Oo,Fa as dt,Fb as ur,Fc as so,Fd as es,G as me,Ga as pt,Gb as wr,Gc as s,H as ce,Ha as ft,Hb as yr,Hc as io,Hd as ts,I as he,Ib as _r,Ic as ao,J as le,Ja as mt,Jb as Ar,Jc as no,K as ge,Ka as ct,Kb as Pr,Kc as po,Kd as rs,L as xe,Lb as Tr,Lc as fo,Ld as os,M as ue,Ma as ht,Mb as Fr,Mc as mo,N as we,Na as yt,Nb as Lr,Nc as co,O as ye,Oa as _t,Ob as Sr,Oc as ho,P as _e,Pa as At,Pc as lo,Q as Ae,Qa as Pt,Qc as go,R as Pe,Ra as Tt,Rb as Er,Rc as xo,S as Te,Sa as Ft,Sb as Nr,T as Fe,Ta as Lt,Tb as br,U as Le,Ua as St,Ub as Dr,V as Se,Va as Et,Vb as Mr,W as Ee,Wa as Nt,Wb as Ur,Wc as uo,X as Ne,Xa as bt,Xb as Cr,Y as be,Ya as Dt,Yb as vr,Z as De,Za as Mt,_ as Me,_a as Ut,a as E,aa as Ce,ab as vt,ac as y,ad as wo,b as N,ba as ve,bb as Vt,bd as yo,c as b,ca as Ve,cb as It,cd as _o,d as U,da as Ie,db as Wt,dd as Lo,e as C,ea as We,eb as Kt,ed as So,f as v,fa as Ke,fb as Rt,fd as Eo,g as $,gd as No,h as j,ha as Re,hb as $t,hd as bo,i as Y,ia as $e,ib as jt,ic as Rr,id as Mo,j as q,ja as je,jb as Yt,jc as $r,jd as Uo,k as z,ka as Ye,kb as qt,kc as jr,kd as Co,l as B,la as qe,lb as zt,lc as Yr,ld as vo,m as G,ma as ze,mb as Bt,mc as qr,md as Vo,me as As,n as H,na as Be,nb as Gt,nc as zr,nd as Io,ne as Ps,o as J,oa as Ge,ob as Ht,oc as Br,od as Wo,oe as Ts,p as Q,pa as He,pb as Jt,pc as Gr,pd as Ko,pe as Fs,q as X,qb as Qt,qc as Hr,qd as Ro,r as Z,ra as Je,rb as Xt,rc as Jr,rd as $o,s as k,sa as Qe,sb as Zt,sc as Qr,sd as jo,t as O,ta as Xe,tb as kt,tc as Xr,td as Yo,u as ee,ua as Ze,ub as Ot,uc as Zr,ud as qo,v as te,va as ke,vb as d,vc as kr,vd as zo,w as re,wa as Oe,wb as p,wc as Or,wd as Bo,x as oe,xa as et,xb as er,xc as eo,xd as Go,y as se,ya as tt,yb as tr,yc as to,yd as Ho,ye as Ls,z as ie,za as rt,zb as rr,zc as _,zd as Jo,ze as Ss}from"./chunks/chunk-7DB6BI27.js";import{g as En,h as Nn}from"./chunks/chunk-4BDLFEOC.js";import{b as D,c as M,d as V,e as I,f as W,g as K,h as R,i as lt,j as gt,k as xt,l as ut,m as wt}from"./chunks/chunk-Q55UPA3E.js";var vn=h,Vn=c;var x={width:1920,height:1080},u=60,Rn={viewport:x,fps:u},S={image:{},video:{},audio:{},font:{}},g=class{platform;viewport;fps;constructor(e,t={}){this.platform=e,this._registry=new f({nodes:t.nodes,shaders:t.shaders,lerps:t.lerps,dynamicNodes:t.dynamicNodes,strict:t.strict}),this.viewport=t.viewport??x,this.fps=t.fps??u,this._manifest=t.manifest??S,this._exporter=e.createExporter()}get manifest(){return this._manifest}get exporter(){return this._exporter}setManifest(e){this._manifest=e;for(let t of this._manifestListeners)t(e)}open(e){return new l(this,e)}knows(e){return this._registry.hasNode(e)}get registry(){return this._registry}async registerNode(e,t){return typeof e=="string"?this._registry.addNodeFromSource(e,t):(this._registry.addNode(e,t),e)}registerShader(e,t,r){return this._registry.addShader(e,t,r)}dispose(){this._manifestListeners.clear(),this.platform.dispose?.()}_registry;_manifest;_exporter;_manifestListeners=new Set;_onManifestChange(e){return this._manifestListeners.add(e),()=>this._manifestListeners.delete(e)}};var i=class{get schedulesAudio(){return!0}setMuted(e){}setVolume(e){}dispose(){this.stop()}};var a=class{catalog;viewport;constructor(e,t){this.catalog=e,this.viewport=t}setCatalog(e){this.catalog=e}inFlightLoads=new Map;cachedAssets=new Set;isLoaded(e){return this.cachedAssets.has(e)}async loadAsset(e,t){let r=this.inFlightLoads.get(e);if(r)return r;if(this.cachedAssets.has(e))return;let o=this.runLoad(e,t);this.inFlightLoads.set(e,o);try{await o}finally{this.inFlightLoads.delete(e)}}async runLoad(e,t){let r=!0;switch(t.type){case"image":await this.loadImage(e);break;case"video":await this.loadVideo(e,t.startFrame,t.endFrame,t.trimStart,t.trimEnd);break;case"font":{let{fontFamily:o,fontWeight:w}=this.parseFontKey(e);if(r=await this.loadFont(e,o,w),!r&&this.getDecodePolicy()==="exact")throw new s("font",o,`The manifest has no font entry for "${o}", so this frame would be shaped against the fallback face and differ from the one drawn once it is described. Add the family to the manifest's font record.`);break}case"audio":break;case"loader":throw new Error("Loader records must not be routed through StorageAdapter.loadAsset");default:{let o=t;throw new Error(`Unsupported asset type: ${o.type}`)}}r&&this.cachedAssets.add(e)}parseFontKey(e){let[t,r]=e.split("@"),o=r?parseInt(r,10):400;return{fontFamily:t||e,fontWeight:isNaN(o)?400:o}}async warmPendingVideo(){return!1}setDecodePolicy(e){}getDecodePolicy(){return"interactive"}hasPendingDecodes(){return!1}async warmPendingDecodes(){return this.warmPendingVideo()}hasPendingUpgrades(){return!1}async warmPendingUpgrades(){return!1}setPlaying(e){}dispose(){this.inFlightLoads.clear(),this.cachedAssets.clear()}};var id=m,ad=d,nd=p;export{Q as ASCII_CHARSETS,Ji as AUDIO_ROOT_ID,As as AUTOFIT_PROBE_SIZE,be as AdjustmentChain,Me as Adjustments,di as AmbientLight3D,hi as AreaLight3D,P as AssetDeclaration,A as AssetManager,s as AssetNotLoadedError,h as AssetTimeline,Is as AudioBus,er as AudioEffectChain,cr as AudioEffectRegistry,tr as AudioEffects,i as AudioSink,Z as BLEND_MODES_LIST,xs as BooleanGroup,Ys as Box3D,ro as COMMAND_META,ws as Camera,li as Camera3D,Do as Canvas2D,ui as Canvas3D,rs as CanvasRenderContext2D,Zs as Capsule3D,Qs as Circle3D,uo as Clip,Ja as ClipInstance,Xa as ClipStore,m as ClipTimeline,Gs as Cone3D,to as ContextMap,Bs as Cylinder3D,Pt as DEFAULT_CAP_SCALE,Mt as DEFAULT_EASE,u as DEFAULT_FPS,Rn as DEFAULT_OUTPUT,Qa as DEFAULT_PRECOMP_BUDGET_MS,x as DEFAULT_VIEWPORT,Ui as DOCUMENT_FORMAT_VERSION,vi as DOCUMENT_MIGRATIONS,Je as DRAWABLE_KINDS,Es as DataToken,Us as DefaultTextStyle,fi as DirectionalLight3D,Ci as DocumentTooNewError,z as EFFECT_OPTION_KEYS,S as EMPTY_MANIFEST,lt as EMPTY_PATH_DATA,Ur as EMPTY_TEXT_STYLE,he as EffectChain,le as Effects,is as Ellipse,g as Engine,xi as Environment3D,Oo as ExpressionError,Os as Extrude3D,_e as FillChain,Ae as Fills,gi as Fog3D,na as Geo,$e as Graphics2D,Xe as Graphics3D,$s as Group3D,pi as HemisphereLight3D,hs as Hexagon,co as IDENTITY_QUATERNION,Ce as ImageFilters,ri as Instances3D,ei as Lathe3D,si as Line3D,Ir as MAX_SHADER_PROPERTIES,Wr as MAX_SHADER_SOURCE,Te as MINOR_WIDTH_RATIO,va as MUTABLE_MATERIAL_KEYS,T as ManifestAssetCatalog,us as MaskGroup,da as Mat,js as Mesh3D,ai as Model3D,ni as ModelView3D,Co as NODE_META,Pr as NO_PROJECTION_3D,so as Node,wo as Node2D,Uo as Node3D,Lo as NodeAudio,k as NodeBlendModes,os as NullRenderContext,Ds as NumberNode,ls as Octagon,ys as OrbitCamera,gt as PATH_UNIT_EXTENT,xt as PATH_UNIT_HALF,ps as Path,Re as PathBuilder,ds as PathShape,cs as Pentagon,zs as Plane3D,Pn as Playback,_n as PlaybackController,mi as PointLight3D,oi as Points3D,as as Polygon,ns as Polygram,ks as Polyhedron3D,vn as Precomp,y as PropSlot,Cs as Provider,Pi as ROOT_NODE_ID,Yt as RampChain,Mn as Random,ss as Rect,f as Registry,ia as RenderBackendError,Ze as RenderContext3D,Ms as RichText,ms as RightTriangle,Xs as Ring3D,_s as RotatedBox,ka as SETTLE_PASSES,Io as SHAPE_ALIGNMENT_KEYS,Va as STRUCTURAL_MATERIAL_KEYS,Oe as Scene3D,id as SceneTimeline,Dn as SeedGenerator,Ns as SeedToken,l as Session,ar as Sound,Vs as SoundNode,qs as Sphere3D,ci as SpotLight3D,ii as Sprite3D,gs as Star,Za as StateEvaluator,L as SteppedClock,a as StorageAdapter,nt as TEXTURE_KEYS,Mr as TEXT_SHAPING_KEYS,Dr as TEXT_STYLE_KEYS,pa as Tex,bs as Text,Ls as TextStyleToken,vs as ThemeProvider,Ss as ThemeToken,F as Ticker,Hs as Torus3D,Js as TorusKnot3D,fs as Triangle,ti as Tube3D,ut as UNIT_PATH_BOX,Ws as Video,De as VideoAdjustmentChain,Ue as VideoAdjustments,ve as VideoFilters,ae as WGSL_CONTRACT,Ka as __resetSchedulerForTests,Ie as alignmentOps,Fo as applyEditorStates,Aa as applyMatrix4,wr as applyToPoint,Mi as asProjectDocument,$i as assertValidDocument,Ri as assertValidProjectDocument,hr as audioEffectsOps,Ot as audioParamOps,we as backdropEffects,So as busPathOf,Eo as busPathTo,mr as busStopKey,_r as cameraMatrix,mt as canLerpFill,et as canvas3DResourceKey,it as canvas3DResourceLoader,ra as caretCount,wn as caretOffsetAt,yn as caretRangeQuads,ba as centeredBox3,nn as childPlanePointAt,bt as clamp,Dt as clamp01,Zi as clipDocument,ir as clipDurationOf,Ra as clipFrameToTime,or as clipTimeAtSource,$a as clipTimeToFrame,xn as collectBoxes,tn as collectBoxes3D,H as colorOps,Zr as commandParallel,Xr as commandSequence,Ni as commandSpan,Pa as compose4,Go as containsClip,Ho as containsOps,U as cornerRadiusOps,C as cornerStyleOps,Ma as corners3,c as createAssetTimelineProfile,eo as createContext,Vn as createPrecompProfile,bn as createRef,Rt as curveEase,Wt as curveSegmentT,It as curveSegments,ga as cylinderRadii,de as describeEffect,ko as distanceToSegment,bi as documentDuration,Vi as documentFormatVersion,Jr as driveCommand,Ct as easeIn,Vt as easeInOut,$t as easeOfSpec,vt as easeOut,pe as effectDescriptors,fe as effectSurface,Fi as effectiveSpan,Si as effectiveSpanIn,Li as effectiveSpans,nr as effectsKey,xe as effectsOps,Nn as enterBudget,kt as equalsParam,mo as euler3Ops,ua as evaluateParametric,ma as evaluateRoundedBox,es as expressionOps,Fr as facesAway,ht as fillOps,Ee as filterSurface,No as findBusById,yo as findNode2D,io as flowOps,pt as forEachTexture3D,ye as foregroundShaderEffects,_o as frameIn,ja as frameSpecAtTime,Ga as frameTime,Sn as generateList,Ca as geometryBounds3D,O as getBlendModeHash,oo as getCommandMeta,vo as getNodeDescriptor,_ as getPropSlot,vr as getPropertyMeta,K as getTypographyPreset,fn as handleValueAt,at as hasCanvas3DBackend,Le as hasFilter,Tr as hasProjection3D,Ai as hasTimeline,zt as hold,gr as identity,wa as identity4,We as insetsOps,d as integrateSpeedToClipTime,ad as integrateSpeedToSceneTime,yr as invert,_a as invert4,_i as isAudioDocument,ue as isBackdropEffect,Gr as isCommand,yi as isCompositionDocument,Ye as isDataTexture3D,Kt as isEaseCurve,aa as isFatalRenderIssue,Vr as isKnownShaderProperty,Ks as isOrbitCamera3D,An as isParentNode,Fe as isPixelFilter,Di as isProjectDocument,lr as isProjective,Bt as isRamp,Un as isSteppable,wi as isStillDocument,Tt as isStrokeMarker,Ps as isStyleOnlySegment,qe as isSurfaceTexture3D,dt as isTextureLike,b as isUniformCorners,en as isViewport3D,ie as isWgslShader,G as lerpColor,v as lerpCornerScalarStyle,N as lerpCorners,me as lerpEffect,fo as lerpEuler3,ct as lerpFill,Se as lerpFilter,Ne as lerpFilterArray,Sr as lerpLookAt,D as lerpNumber,Zt as lerpParam,M as lerpPerspective,oe as lerpUniformRecord,te as lerpUniformValue,V as lerpVector2,no as lerpVector3,Ut as linear,Ta as lookAtRotation4,Ge as looksLikeAssetPath,Qr as loopCommand,$r as loopPasses,qr as loopPhase,jr as loopRepeats,Yr as loopSpan,Qi as loweredAudioDocument,Hr as makeCommand,Ii as migrateDocument,ts as migrateNodeProps,ji as missingNodeOf,ur as multiply,ya as multiply4,Zo as nearPolyline,En as niceStep,hn as nodeAt,mn as nodeBox,cn as nodeBoxAt,pn as nodeHandlesAt,Ar as nodeLocalMatrix,Ao as nodePath,Lr as nodeProjectedMatrix,Ti as nodeSpan,un as nodeTextLayout,zi as nodeTypeIsA,lo as normalizeQuaternion,Kr as normalizeShaderPack,ee as normalizeUniforms,Ia as now,Na as orthographic4,Xt as paramKey,Bi as parentIssue,an as parentPlanePointAt,Mo as parentSpaceOf,Fn as parseCSV,tt as parseCanvas3DResourceKey,R as parseColor,Ln as parseData,wt as pathOps,Ea as perspective4,gn as pickNode,on as pickNode3D,qa as placeTracks,Hi as placementIssues,Xo as pointInPolygon,Jo as polygonVertices,Qo as polygramVertices,Or as prepareNumericCellTween,kr as prepareNumericTween,To as primeMotionTree,rn as projectNode3D,ln as projectNode3DAt,go as quaternionFromEuler,xo as quaternionOps,qt as ramp,ot as registerCanvas3DResourceLoader,rt as registerCanvas3DWarmup,Yi as registryVocabulary,sa as renderIssueKey,sn as renderMatrix,Oa as renderSettled,dn as reparentPlacementAt,Ts as requireFontFamily,X as resolveAsciiCharset,rr as resolveAudioEffects,xa as resolveBevel3D,Rs as resolveCameraPlacement,Ve as resolveChainAdjustments,ge as resolveChainEffects,Pe as resolveChainFill,E as resolveCorners,$ as resolveEffectAxis,Y as resolveEffectColor,ft as resolveFill,He as resolveFill3D,Qe as resolveMaterialShorthand3D,J as resolveMotionBlurAlignment,$o as resolvePivotPosition,Tn as resolveProjectDocument,Gt as resolveRamp,ce as resolveShaderProperties,yt as resolveShadow,la as resolveShadowOptions3D,ke as resolveShadows3D,Ro as resolveShapeAlignment,Vo as resolveShapePivot,Et as resolveStroke,At as resolveStrokeAlign,Ft as resolveStrokeCap,Lt as resolveStrokeEnd,St as resolveStrokeJoin,je as resolveSurfaceSource,ze as resolveTexture3D,ao as resolveVector3,Ke as resolveVideoTimestamp,Sa as rotationOf4,j as sameEffectAxis,q as sameEffectColor,Jt as sampleParam,Ht as sampleRamp,Po as sampleTree,fa as segmentsOf,W as setTheme,Br as settles,zr as settling,ne as shaderContractOf,ca as shadowCasts,_t as shadowOps,ha as shadowReceives,Gi as siblingIssue,Nr as size2DOps,br as sizeInputOps,ho as slerpQuaternion,sr as sourceTimeAtClip,p as sourceTimeAtClipElapsed,nd as sourceTimeAtSceneElapsed,Er as space3dOps,Ha as spanFrames,Ba as spansCovering,jt as specOfEase,Qt as staticValue,Ko as stripShapeAlignmentKeys,Nt as strokeOps,bo as structuralPathOf,Cr as textOps,Be as texture3DSource,Rr as toCommand,ea as toPathString,oa as toRenderIssue,za as totalFramesOf,Ya as trackFrameCount,Ua as transformBox3,Fa as transformMatrix4,pr as transitionGainAt,fr as transitionKey,dr as transitionSpans,xr as translation,La as translation4,se as uniformRecordsEqual,re as uniformValuesEqual,Da as unionBox3,Ei as untimed,Wi as validateDocument,Ki as validateProjectDocument,Wo as validateShapeAlignmentProps,I as vector2Ops,po as vector3Ops,qi as vocabularyBreaks,st as warmCanvas3D,B as withEffectOptions,Yo as withEllipseDescriptor,Bo as withLineDescriptor,ta as withPathDescriptor,Xi as withPlayedSounds,qo as withPolygonDescriptor,zo as withPolygramDescriptor,jo as withRectDescriptor,ki as withRichTextDescriptor,Fs as withTextDescriptor,Oi as withTransformDescriptor,Wa as yieldToScheduler};
|
|
1
|
+
import{$ as Hs,$a as Gi,$b as qa,A as cs,Aa as _i,Ab as wa,Ac as gn,B as hs,Ba as Ai,Bb as ya,Bc as xn,C as ls,Ca as Pi,Cb as _a,Cc as un,D as gs,Da as Ti,Db as Aa,Dc as wn,E as xs,Ea as Fi,Eb as Pa,Ec as yn,F as us,Fa as Li,Fb as Ta,Fc as _n,G as ws,Ga as Si,Gb as Fa,Gc as An,H as ys,Ha as Ei,Hb as La,Hc as T,I as _s,Ia as Ni,Ib as Sa,Ic as Pn,J as bs,Ja as bi,Jb as Ea,Jc as F,K as Ds,Ka as Di,Kb as Na,Kc as L,L as Ms,La as Mi,Lb as ba,Lc as l,M as Us,Ma as Ui,Mb as Da,Mc as Tn,N as Cs,Na as Ci,Nb as Ma,Nc as Fn,O as vs,Oa as vi,Ob as Ua,Oc as Ln,P as Vs,Pa as Vi,Pb as Ca,Pc as Sn,Q as Is,Qa as Ii,Qb as va,Qc as bn,R as Ws,Ra as Wi,Rb as Va,Rc as Dn,S as Ks,Sa as Ki,Sb as A,Sc as Mn,T as Rs,Ta as Ri,Tb as P,Tc as Un,U as $s,Ua as $i,Ub as Ia,V as js,Va as ji,Vb as Wa,W as Ys,Wa as Yi,Wb as Ka,X as qs,Xa as qi,Xb as Ra,Y as zs,Ya as f,Yb as $a,Z as Bs,Za as zi,Zb as ja,_ as Gs,_a as Bi,_b as Ya,a as or,aa as Js,ab as Hi,ac as za,b as sr,ba as Qs,bb as Ji,bc as Ba,c as ir,ca as Xs,cb as Qi,cc as Ga,d as ar,da as Zs,db as Xi,dc as Ha,e as nr,ea as ks,eb as Zi,ec as Ja,f as dr,fa as Os,fb as m,fc as Qa,g as pr,ga as ei,gb as ki,gc as Xa,h as fr,ha as ti,hb as Oi,hc as Za,i as mr,ia as ri,ib as ea,ic as ka,j as Vr,ja as oi,jb as ta,jc as Oa,k as Ir,ka as si,kb as ra,kc as c,l as Wr,la as ii,lb as oa,lc as h,m as Kr,ma as ai,mb as sa,mc as en,n as Ao,na as ni,nb as ia,nc as tn,o as Po,oa as di,ob as aa,oc as rn,p as To,pa as pi,pb as na,pc as on,q as Fo,qa as fi,qb as da,qc as sn,r as Do,ra as mi,rb as pa,rc as an,s as ss,sa as ci,sb as fa,sc as nn,t as is,ta as hi,tb as ma,tc as dn,u as as,ua as li,ub as ca,uc as pn,v as ns,va as gi,vb as ha,vc as fn,w as ds,wa as xi,wb as la,wc as mn,x as ps,xa as ui,xb as ga,xc as cn,y as fs,ya as wi,yb as xa,yc as hn,z as ms,za as yi,zb as ua,zc as ln}from"./chunks/chunk-N4WSN5WY.js";import{$ as Ue,$a as Ct,A as ae,Aa as ot,Ab as cr,Ad as Qo,Ae as Es,B as ne,Ba as st,Bb as hr,Bd as Xo,Be as Ns,C as de,Ca as it,Cb as lr,Cc as ro,Cd as Zo,D as pe,Da as at,Db as gr,Dc as oo,Dd as ko,E as fe,Ea as nt,Eb as xr,Ed as Oo,Fa as dt,Fb as ur,Fc as so,Fd as es,G as me,Ga as pt,Gb as wr,Gc as s,H as ce,Ha as ft,Hb as yr,Hc as io,Hd as ts,I as he,Ib as _r,Ic as ao,J as le,Ja as mt,Jb as Ar,Jc as no,K as ge,Ka as ct,Kb as Pr,Kc as po,Kd as rs,L as xe,Lb as Tr,Lc as fo,Ld as os,M as ue,Ma as ht,Mb as Fr,Mc as mo,N as we,Na as yt,Nb as Lr,Nc as co,O as ye,Oa as _t,Ob as Sr,Oc as ho,P as _e,Pa as At,Pc as lo,Q as Ae,Qa as Pt,Qc as go,R as Pe,Ra as Tt,Rb as Er,Rc as xo,S as Te,Sa as Ft,Sb as Nr,T as Fe,Ta as Lt,Tb as br,U as Le,Ua as St,Ub as Dr,V as Se,Va as Et,Vb as Mr,W as Ee,Wa as Nt,Wb as Ur,Wc as uo,X as Ne,Xa as bt,Xb as Cr,Y as be,Ya as Dt,Yb as vr,Z as De,Za as Mt,_ as Me,_a as Ut,a as E,aa as Ce,ab as vt,ac as y,ad as wo,b as N,ba as ve,bb as Vt,bd as yo,c as b,ca as Ve,cb as It,cd as _o,d as U,da as Ie,db as Wt,dd as Lo,e as C,ea as We,eb as Kt,ed as So,f as v,fa as Ke,fb as Rt,fd as Eo,g as $,gd as No,h as j,ha as Re,hb as $t,hd as bo,i as Y,ia as $e,ib as jt,ic as Rr,id as Mo,j as q,ja as je,jb as Yt,jc as $r,jd as Uo,k as z,ka as Ye,kb as qt,kc as jr,kd as Co,l as B,la as qe,lb as zt,lc as Yr,ld as vo,m as G,ma as ze,mb as Bt,mc as qr,md as Vo,me as As,n as H,na as Be,nb as Gt,nc as zr,nd as Io,ne as Ps,o as J,oa as Ge,ob as Ht,oc as Br,od as Wo,oe as Ts,p as Q,pa as He,pb as Jt,pc as Gr,pd as Ko,pe as Fs,q as X,qb as Qt,qc as Hr,qd as Ro,r as Z,ra as Je,rb as Xt,rc as Jr,rd as $o,s as k,sa as Qe,sb as Zt,sc as Qr,sd as jo,t as O,ta as Xe,tb as kt,tc as Xr,td as Yo,u as ee,ua as Ze,ub as Ot,uc as Zr,ud as qo,v as te,va as ke,vb as d,vc as kr,vd as zo,w as re,wa as Oe,wb as p,wc as Or,wd as Bo,x as oe,xa as et,xb as er,xc as eo,xd as Go,y as se,ya as tt,yb as tr,yc as to,yd as Ho,ye as Ls,z as ie,za as rt,zb as rr,zc as _,zd as Jo,ze as Ss}from"./chunks/chunk-WZSI3GSK.js";import{g as En,h as Nn}from"./chunks/chunk-4BDLFEOC.js";import{b as D,c as M,d as V,e as I,f as W,g as K,h as R,i as lt,j as gt,k as xt,l as ut,m as wt}from"./chunks/chunk-CCGVIR4F.js";var vn=h,Vn=c;var x={width:1920,height:1080},u=60,Rn={viewport:x,fps:u},S={image:{},video:{},audio:{},font:{}},g=class{platform;viewport;fps;constructor(e,t={}){this.platform=e,this._registry=new f({nodes:t.nodes,shaders:t.shaders,lerps:t.lerps,dynamicNodes:t.dynamicNodes,strict:t.strict}),this.viewport=t.viewport??x,this.fps=t.fps??u,this._manifest=t.manifest??S,this._exporter=e.createExporter()}get manifest(){return this._manifest}get exporter(){return this._exporter}setManifest(e){this._manifest=e;for(let t of this._manifestListeners)t(e)}open(e){return new l(this,e)}knows(e){return this._registry.hasNode(e)}get registry(){return this._registry}async registerNode(e,t){return typeof e=="string"?this._registry.addNodeFromSource(e,t):(this._registry.addNode(e,t),e)}registerShader(e,t,r){return this._registry.addShader(e,t,r)}dispose(){this._manifestListeners.clear(),this.platform.dispose?.()}_registry;_manifest;_exporter;_manifestListeners=new Set;_onManifestChange(e){return this._manifestListeners.add(e),()=>this._manifestListeners.delete(e)}};var i=class{get schedulesAudio(){return!0}setMuted(e){}setVolume(e){}dispose(){this.stop()}};var a=class{catalog;viewport;constructor(e,t){this.catalog=e,this.viewport=t}setCatalog(e){this.catalog=e}inFlightLoads=new Map;cachedAssets=new Set;isLoaded(e){return this.cachedAssets.has(e)}async loadAsset(e,t){let r=this.inFlightLoads.get(e);if(r)return r;if(this.cachedAssets.has(e))return;let o=this.runLoad(e,t);this.inFlightLoads.set(e,o);try{await o}finally{this.inFlightLoads.delete(e)}}async runLoad(e,t){let r=!0;switch(t.type){case"image":await this.loadImage(e);break;case"video":await this.loadVideo(e,t.startFrame,t.endFrame,t.trimStart,t.trimEnd);break;case"font":{let{fontFamily:o,fontWeight:w}=this.parseFontKey(e);if(r=await this.loadFont(e,o,w),!r&&this.getDecodePolicy()==="exact")throw new s("font",o,`The manifest has no font entry for "${o}", so this frame would be shaped against the fallback face and differ from the one drawn once it is described. Add the family to the manifest's font record.`);break}case"audio":break;case"loader":throw new Error("Loader records must not be routed through StorageAdapter.loadAsset");default:{let o=t;throw new Error(`Unsupported asset type: ${o.type}`)}}r&&this.cachedAssets.add(e)}parseFontKey(e){let[t,r]=e.split("@"),o=r?parseInt(r,10):400;return{fontFamily:t||e,fontWeight:isNaN(o)?400:o}}async warmPendingVideo(){return!1}setDecodePolicy(e){}getDecodePolicy(){return"interactive"}hasPendingDecodes(){return!1}async warmPendingDecodes(){return this.warmPendingVideo()}hasPendingUpgrades(){return!1}async warmPendingUpgrades(){return!1}setPlaying(e){}dispose(){this.inFlightLoads.clear(),this.cachedAssets.clear()}};var id=m,ad=d,nd=p;export{Q as ASCII_CHARSETS,Ji as AUDIO_ROOT_ID,As as AUTOFIT_PROBE_SIZE,be as AdjustmentChain,Me as Adjustments,di as AmbientLight3D,hi as AreaLight3D,P as AssetDeclaration,A as AssetManager,s as AssetNotLoadedError,h as AssetTimeline,Is as AudioBus,er as AudioEffectChain,cr as AudioEffectRegistry,tr as AudioEffects,i as AudioSink,Z as BLEND_MODES_LIST,xs as BooleanGroup,Ys as Box3D,ro as COMMAND_META,ws as Camera,li as Camera3D,Do as Canvas2D,ui as Canvas3D,rs as CanvasRenderContext2D,Zs as Capsule3D,Qs as Circle3D,uo as Clip,Ja as ClipInstance,Xa as ClipStore,m as ClipTimeline,Gs as Cone3D,to as ContextMap,Bs as Cylinder3D,Pt as DEFAULT_CAP_SCALE,Mt as DEFAULT_EASE,u as DEFAULT_FPS,Rn as DEFAULT_OUTPUT,Qa as DEFAULT_PRECOMP_BUDGET_MS,x as DEFAULT_VIEWPORT,Ui as DOCUMENT_FORMAT_VERSION,vi as DOCUMENT_MIGRATIONS,Je as DRAWABLE_KINDS,Es as DataToken,Us as DefaultTextStyle,fi as DirectionalLight3D,Ci as DocumentTooNewError,z as EFFECT_OPTION_KEYS,S as EMPTY_MANIFEST,lt as EMPTY_PATH_DATA,Ur as EMPTY_TEXT_STYLE,he as EffectChain,le as Effects,is as Ellipse,g as Engine,xi as Environment3D,Oo as ExpressionError,Os as Extrude3D,_e as FillChain,Ae as Fills,gi as Fog3D,na as Geo,$e as Graphics2D,Xe as Graphics3D,$s as Group3D,pi as HemisphereLight3D,hs as Hexagon,co as IDENTITY_QUATERNION,Ce as ImageFilters,ri as Instances3D,ei as Lathe3D,si as Line3D,Ir as MAX_SHADER_PROPERTIES,Wr as MAX_SHADER_SOURCE,Te as MINOR_WIDTH_RATIO,va as MUTABLE_MATERIAL_KEYS,T as ManifestAssetCatalog,us as MaskGroup,da as Mat,js as Mesh3D,ai as Model3D,ni as ModelView3D,Co as NODE_META,Pr as NO_PROJECTION_3D,so as Node,wo as Node2D,Uo as Node3D,Lo as NodeAudio,k as NodeBlendModes,os as NullRenderContext,Ds as NumberNode,ls as Octagon,ys as OrbitCamera,gt as PATH_UNIT_EXTENT,xt as PATH_UNIT_HALF,ps as Path,Re as PathBuilder,ds as PathShape,cs as Pentagon,zs as Plane3D,Pn as Playback,_n as PlaybackController,mi as PointLight3D,oi as Points3D,as as Polygon,ns as Polygram,ks as Polyhedron3D,vn as Precomp,y as PropSlot,Cs as Provider,Pi as ROOT_NODE_ID,Yt as RampChain,Mn as Random,ss as Rect,f as Registry,ia as RenderBackendError,Ze as RenderContext3D,Ms as RichText,ms as RightTriangle,Xs as Ring3D,_s as RotatedBox,ka as SETTLE_PASSES,Io as SHAPE_ALIGNMENT_KEYS,Va as STRUCTURAL_MATERIAL_KEYS,Oe as Scene3D,id as SceneTimeline,Dn as SeedGenerator,Ns as SeedToken,l as Session,ar as Sound,Vs as SoundNode,qs as Sphere3D,ci as SpotLight3D,ii as Sprite3D,gs as Star,Za as StateEvaluator,L as SteppedClock,a as StorageAdapter,nt as TEXTURE_KEYS,Mr as TEXT_SHAPING_KEYS,Dr as TEXT_STYLE_KEYS,pa as Tex,bs as Text,Ls as TextStyleToken,vs as ThemeProvider,Ss as ThemeToken,F as Ticker,Hs as Torus3D,Js as TorusKnot3D,fs as Triangle,ti as Tube3D,ut as UNIT_PATH_BOX,Ws as Video,De as VideoAdjustmentChain,Ue as VideoAdjustments,ve as VideoFilters,ae as WGSL_CONTRACT,Ka as __resetSchedulerForTests,Ie as alignmentOps,Fo as applyEditorStates,Aa as applyMatrix4,wr as applyToPoint,Mi as asProjectDocument,$i as assertValidDocument,Ri as assertValidProjectDocument,hr as audioEffectsOps,Ot as audioParamOps,we as backdropEffects,So as busPathOf,Eo as busPathTo,mr as busStopKey,_r as cameraMatrix,mt as canLerpFill,et as canvas3DResourceKey,it as canvas3DResourceLoader,ra as caretCount,wn as caretOffsetAt,yn as caretRangeQuads,ba as centeredBox3,nn as childPlanePointAt,bt as clamp,Dt as clamp01,Zi as clipDocument,ir as clipDurationOf,Ra as clipFrameToTime,or as clipTimeAtSource,$a as clipTimeToFrame,xn as collectBoxes,tn as collectBoxes3D,H as colorOps,Zr as commandParallel,Xr as commandSequence,Ni as commandSpan,Pa as compose4,Go as containsClip,Ho as containsOps,U as cornerRadiusOps,C as cornerStyleOps,Ma as corners3,c as createAssetTimelineProfile,eo as createContext,Vn as createPrecompProfile,bn as createRef,Rt as curveEase,Wt as curveSegmentT,It as curveSegments,ga as cylinderRadii,de as describeEffect,ko as distanceToSegment,bi as documentDuration,Vi as documentFormatVersion,Jr as driveCommand,Ct as easeIn,Vt as easeInOut,$t as easeOfSpec,vt as easeOut,pe as effectDescriptors,fe as effectSurface,Fi as effectiveSpan,Si as effectiveSpanIn,Li as effectiveSpans,nr as effectsKey,xe as effectsOps,Nn as enterBudget,kt as equalsParam,mo as euler3Ops,ua as evaluateParametric,ma as evaluateRoundedBox,es as expressionOps,Fr as facesAway,ht as fillOps,Ee as filterSurface,No as findBusById,yo as findNode2D,io as flowOps,pt as forEachTexture3D,ye as foregroundShaderEffects,_o as frameIn,ja as frameSpecAtTime,Ga as frameTime,Sn as generateList,Ca as geometryBounds3D,O as getBlendModeHash,oo as getCommandMeta,vo as getNodeDescriptor,_ as getPropSlot,vr as getPropertyMeta,K as getTypographyPreset,fn as handleValueAt,at as hasCanvas3DBackend,Le as hasFilter,Tr as hasProjection3D,Ai as hasTimeline,zt as hold,gr as identity,wa as identity4,We as insetsOps,d as integrateSpeedToClipTime,ad as integrateSpeedToSceneTime,yr as invert,_a as invert4,_i as isAudioDocument,ue as isBackdropEffect,Gr as isCommand,yi as isCompositionDocument,Ye as isDataTexture3D,Kt as isEaseCurve,aa as isFatalRenderIssue,Vr as isKnownShaderProperty,Ks as isOrbitCamera3D,An as isParentNode,Fe as isPixelFilter,Di as isProjectDocument,lr as isProjective,Bt as isRamp,Un as isSteppable,wi as isStillDocument,Tt as isStrokeMarker,Ps as isStyleOnlySegment,qe as isSurfaceTexture3D,dt as isTextureLike,b as isUniformCorners,en as isViewport3D,ie as isWgslShader,G as lerpColor,v as lerpCornerScalarStyle,N as lerpCorners,me as lerpEffect,fo as lerpEuler3,ct as lerpFill,Se as lerpFilter,Ne as lerpFilterArray,Sr as lerpLookAt,D as lerpNumber,Zt as lerpParam,M as lerpPerspective,oe as lerpUniformRecord,te as lerpUniformValue,V as lerpVector2,no as lerpVector3,Ut as linear,Ta as lookAtRotation4,Ge as looksLikeAssetPath,Qr as loopCommand,$r as loopPasses,qr as loopPhase,jr as loopRepeats,Yr as loopSpan,Qi as loweredAudioDocument,Hr as makeCommand,Ii as migrateDocument,ts as migrateNodeProps,ji as missingNodeOf,ur as multiply,ya as multiply4,Zo as nearPolyline,En as niceStep,hn as nodeAt,mn as nodeBox,cn as nodeBoxAt,pn as nodeHandlesAt,Ar as nodeLocalMatrix,Ao as nodePath,Lr as nodeProjectedMatrix,Ti as nodeSpan,un as nodeTextLayout,zi as nodeTypeIsA,lo as normalizeQuaternion,Kr as normalizeShaderPack,ee as normalizeUniforms,Ia as now,Na as orthographic4,Xt as paramKey,Bi as parentIssue,an as parentPlanePointAt,Mo as parentSpaceOf,Fn as parseCSV,tt as parseCanvas3DResourceKey,R as parseColor,Ln as parseData,wt as pathOps,Ea as perspective4,gn as pickNode,on as pickNode3D,qa as placeTracks,Hi as placementIssues,Xo as pointInPolygon,Jo as polygonVertices,Qo as polygramVertices,Or as prepareNumericCellTween,kr as prepareNumericTween,To as primeMotionTree,rn as projectNode3D,ln as projectNode3DAt,go as quaternionFromEuler,xo as quaternionOps,qt as ramp,ot as registerCanvas3DResourceLoader,rt as registerCanvas3DWarmup,Yi as registryVocabulary,sa as renderIssueKey,sn as renderMatrix,Oa as renderSettled,dn as reparentPlacementAt,Ts as requireFontFamily,X as resolveAsciiCharset,rr as resolveAudioEffects,xa as resolveBevel3D,Rs as resolveCameraPlacement,Ve as resolveChainAdjustments,ge as resolveChainEffects,Pe as resolveChainFill,E as resolveCorners,$ as resolveEffectAxis,Y as resolveEffectColor,ft as resolveFill,He as resolveFill3D,Qe as resolveMaterialShorthand3D,J as resolveMotionBlurAlignment,$o as resolvePivotPosition,Tn as resolveProjectDocument,Gt as resolveRamp,ce as resolveShaderProperties,yt as resolveShadow,la as resolveShadowOptions3D,ke as resolveShadows3D,Ro as resolveShapeAlignment,Vo as resolveShapePivot,Et as resolveStroke,At as resolveStrokeAlign,Ft as resolveStrokeCap,Lt as resolveStrokeEnd,St as resolveStrokeJoin,je as resolveSurfaceSource,ze as resolveTexture3D,ao as resolveVector3,Ke as resolveVideoTimestamp,Sa as rotationOf4,j as sameEffectAxis,q as sameEffectColor,Jt as sampleParam,Ht as sampleRamp,Po as sampleTree,fa as segmentsOf,W as setTheme,Br as settles,zr as settling,ne as shaderContractOf,ca as shadowCasts,_t as shadowOps,ha as shadowReceives,Gi as siblingIssue,Nr as size2DOps,br as sizeInputOps,ho as slerpQuaternion,sr as sourceTimeAtClip,p as sourceTimeAtClipElapsed,nd as sourceTimeAtSceneElapsed,Er as space3dOps,Ha as spanFrames,Ba as spansCovering,jt as specOfEase,Qt as staticValue,Ko as stripShapeAlignmentKeys,Nt as strokeOps,bo as structuralPathOf,Cr as textOps,Be as texture3DSource,Rr as toCommand,ea as toPathString,oa as toRenderIssue,za as totalFramesOf,Ya as trackFrameCount,Ua as transformBox3,Fa as transformMatrix4,pr as transitionGainAt,fr as transitionKey,dr as transitionSpans,xr as translation,La as translation4,se as uniformRecordsEqual,re as uniformValuesEqual,Da as unionBox3,Ei as untimed,Wi as validateDocument,Ki as validateProjectDocument,Wo as validateShapeAlignmentProps,I as vector2Ops,po as vector3Ops,qi as vocabularyBreaks,st as warmCanvas3D,B as withEffectOptions,Yo as withEllipseDescriptor,Bo as withLineDescriptor,ta as withPathDescriptor,Xi as withPlayedSounds,qo as withPolygonDescriptor,zo as withPolygramDescriptor,jo as withRectDescriptor,ki as withRichTextDescriptor,Fs as withTextDescriptor,Oi as withTransformDescriptor,Wa as yieldToScheduler};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/browser/sdk.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as xo,$a as tr,$b as cr,A as we,Ac as Cr,B as Le,Ba as jo,Bc as Or,C as Me,Ca as ko,D as Be,Da as Go,E as be,Ea as _o,F as je,G as Ge,H as _e,Ha as zo,I as ze,Ia as Ho,J as Qe,Ja as qo,K as Ue,Ka as Ko,L as Je,La as Qo,M as We,Ma as Uo,Mc as vr,N as Xe,Na as Jo,Nc as Tr,O as Ye,Oc as Ar,P as $e,Pa as Wo,Pc as Rr,Q as eo,Qa as Xo,Qc as Er,R as oo,Ra as Yo,Rc as Vr,Sc as yr,T as ro,U as no,Ua as Zo,V as so,Va as $o,W as mo,X as po,Y as io,Ya as er,Z as lo,Za as or,_ as fo,_a as rr,aa as co,ab as ar,ba as Do,ca as uo,d as K,da as ho,ea as Po,fa as go,ga as So,ha as Co,ia as Oo,ib as nr,j as W,ja as vo,ka as To,la as Ao,m as X,ma as Ro,oa as Eo,pa as Vo,pb as sr,qa as yo,qb as mr,r as De,ra as Io,rb as pr,rc as Dr,s as Ae,sa as No,sb as ir,sc as ur,t as Re,ta as Fo,tb as lr,tc as hr,u as Ee,ua as wo,ub as fr,uc as Pr,v as Ve,va as Lo,vb as dr,vc as gr,w as ye,wa as Mo,wc as Sr,x as Ie,xa as bo,y as Ne,z as Fe,zb as xr}from"./chunks/chunk-
|
|
1
|
+
import{$ as xo,$a as tr,$b as cr,A as we,Ac as Cr,B as Le,Ba as jo,Bc as Or,C as Me,Ca as ko,D as Be,Da as Go,E as be,Ea as _o,F as je,G as Ge,H as _e,Ha as zo,I as ze,Ia as Ho,J as Qe,Ja as qo,K as Ue,Ka as Ko,L as Je,La as Qo,M as We,Ma as Uo,Mc as vr,N as Xe,Na as Jo,Nc as Tr,O as Ye,Oc as Ar,P as $e,Pa as Wo,Pc as Rr,Q as eo,Qa as Xo,Qc as Er,R as oo,Ra as Yo,Rc as Vr,Sc as yr,T as ro,U as no,Ua as Zo,V as so,Va as $o,W as mo,X as po,Y as io,Ya as er,Z as lo,Za as or,_ as fo,_a as rr,aa as co,ab as ar,ba as Do,ca as uo,d as K,da as ho,ea as Po,fa as go,ga as So,ha as Co,ia as Oo,ib as nr,j as W,ja as vo,ka as To,la as Ao,m as X,ma as Ro,oa as Eo,pa as Vo,pb as sr,qa as yo,qb as mr,r as De,ra as Io,rb as pr,rc as Dr,s as Ae,sa as No,sb as ir,sc as ur,t as Re,ta as Fo,tb as lr,tc as hr,u as Ee,ua as wo,ub as fr,uc as Pr,v as Ve,va as Lo,vb as dr,vc as gr,w as ye,wa as Mo,wc as Sr,x as Ie,xa as bo,y as Ne,z as Fe,zb as xr}from"./chunks/chunk-N4WSN5WY.js";import{$ as u,$a as j,$d as ve,C as m,Ce as qe,D as p,Dc as ae,Ed as ue,Fd as he,H as i,Ha as y,Hc as ne,Hd as Pe,I as l,Ic as se,Ie as Ke,J as f,Jc as me,Je as Ze,Ke as to,Lc as pe,Ma as I,Na as F,Nd as ge,Oa as w,Oc as ie,Od as Se,Pc as le,Q as d,Qc as fe,Rb as Q,Tb as U,Va as L,Vd as Ce,Ve as ao,Wa as M,Wc as de,Wd as Oe,Xa as B,Xb as J,Y as x,Z as c,_ as D,_a as b,_e as Bo,a as e,aa as h,ab as k,ba as P,bb as G,bd as xe,cd as ce,d as r,da as g,e as t,ea as S,ha as C,he as Te,ia as O,ja as v,kb as _,lb as z,le as ke,mb as H,n as s,pa as T,pc as Y,qc as Z,sc as $,ta as A,tc as ee,ua as R,uc as oe,va as E,wa as V,xc as re,xe as He,yb as q,yc as te}from"./chunks/chunk-WZSI3GSK.js";import"./chunks/chunk-4BDLFEOC.js";import{b as o,d as a,h as n,m as N}from"./chunks/chunk-CCGVIR4F.js";export{x as AdjustmentChain,D as Adjustments,ke as Aim,Eo as AmbientLight3D,Fo as AreaLight3D,eo as AudioBus,q as AudioEffects,be as BooleanGroup,mo as Box3D,Ge as Camera,wo as Camera3D,De as Canvas2D,bo as Canvas3D,ho as Capsule3D,Do as Circle3D,de as Clip,fo as Cone3D,te as ContextMap,lo as Cylinder3D,Uo as DOCUMENT_FORMAT_VERSION,We as DefaultTextStyle,yo as DirectionalLight3D,Jo as DocumentTooNewError,l as EffectChain,f as Effects,Re as Ellipse,Mo as Environment3D,ue as ExpressionError,go as Extrude3D,d as Fills,Ce as Flow,Lo as Fog3D,sr as Geo,O as Graphics2D,A as Graphics3D,no as Group3D,Vo as HemisphereLight3D,Le as Hexagon,h as ImageFilters,Oo as Instances3D,So as Lathe3D,To as Line3D,je as MaskGroup,mr as Mat,ao as Material,so as Mesh3D,Ro as Model3D,Ue as NumberNode,Me as Octagon,_e as OrbitCamera,ve as Paint,Ie as Path,C as PathBuilder,ye as PathShape,we as Pentagon,io as Plane3D,Io as PointLight3D,vo as Points3D,Ee as Polygon,Ve as Polygram,Po as Polyhedron3D,Xe as Provider,ko as ROOT_NODE_ID,yr as Random,Ae as Rect,er as Registry,R as RenderContext3D,Je as RichText,Fe as RightTriangle,uo as Ring3D,ze as RotatedBox,V as Scene3D,Vr as SeedGenerator,Te as Shapes,K as Sound,$e as SoundNode,po as Sphere3D,No as SpotLight3D,Ao as Sprite3D,Be as Star,pr as Tex,Qe as Text,He as TextLayout,Ye as ThemeProvider,xo as Torus3D,co as TorusKnot3D,Ne as Triangle,Co as Tube3D,Ke as Typeface,Se as Types,oo as Video,c as VideoAdjustmentChain,u as VideoAdjustments,P as VideoFilters,Bo as View3D,g as alignmentOps,Qo as asProjectDocument,Zo as assertValidDocument,ur as childPlanePointAt,B as clamp,Or as collectBoxes,s as colorOps,oe as commandParallel,ee as commandSequence,Ho as commandSpan,Oe as commandsFor,ge as component2d,to as component3d,Ze as componentAudio,r as cornerRadiusOps,t as cornerStyleOps,re as createContext,Er as createRef,m as describeEffect,qo as documentDuration,Wo as documentFormatVersion,j as easeIn,G as easeInOut,k as easeOut,p as effectDescriptors,_o as effectiveSpan,xr as evaluateParametric,lr as evaluateRoundedBox,he as expressionOps,I as fillOps,xe as findNode2D,ne as flowOps,ce as frameIn,Rr as generateList,ae as getCommandMeta,gr as handleValueAt,jo as hasTimeline,z as hold,S as insetsOps,Y as isCommand,W as isKnownShaderProperty,Ko as isProjectDocument,H as isRamp,pe as lerpEuler3,o as lerpNumber,a as lerpVector2,me as lerpVector3,b as linear,$ as loopCommand,Z as makeCommand,Xo as migrateDocument,Pe as migrateNodeProps,$o as missingNodeOf,Sr as nodeBox,Pr as nodeHandlesAt,Go as nodeSpan,or as nodeTypeIsA,le as normalizeQuaternion,X as normalizeShaderPack,rr as parentIssue,Dr as parentPlanePointAt,Tr as parseCSV,n as parseColor,Ar as parseData,N as pathOps,Cr as pickNode,cr as placeTracks,ar as placementIssues,qe as provides,fe as quaternionFromEuler,_ as ramp,hr as reparentPlacementAt,ro as resolveCameraPlacement,e as resolveCorners,y as resolveFill,T as resolveFill3D,vr as resolveProjectDocument,i as resolveShaderProperties,F as resolveShadow,E as resolveShadows3D,L as resolveStroke,v as resolveSurfaceSource,se as resolveVector3,ir as segmentsOf,fr as shadowCasts,w as shadowOps,dr as shadowReceives,tr as siblingIssue,U as sizeInputOps,ie as slerpQuaternion,Q as space3dOps,M as strokeOps,J as textOps,nr as toPathString,zo as untimed,Yo as validateDocument};
|
|
2
2
|
//# sourceMappingURL=sdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../../src/components/factory/views.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAK1C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAa,QAAQ,EAAS,e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CAAC,CAAC,GAAG,IAAI;IAOjH,2FAA2F;IAC3F,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;IAe/B,MAAM,IAAI,YAAY;CAKzB;AAKD,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,iBAAiB,CAGnE"}
|
|
@@ -47,8 +47,23 @@ class ChildViewImpl {
|
|
|
47
47
|
constructor(node) {
|
|
48
48
|
this[NODE] = node;
|
|
49
49
|
// The node's own accessors are its resolved values; a proxy keeps a parent from writing through them.
|
|
50
|
+
// Its props live on the prototype, so the proxy lists them as its own, as a spread or `Object.keys` expects.
|
|
50
51
|
this.state = new Proxy(node, {
|
|
51
52
|
set: () => { throw new TypeError("A child's state is read-only to its parent; animate it with a command."); },
|
|
53
|
+
ownKeys: (target) => {
|
|
54
|
+
const keys = Reflect.ownKeys(target);
|
|
55
|
+
const own = new Set(keys);
|
|
56
|
+
for (const key of propsOf(target))
|
|
57
|
+
if (!own.has(key))
|
|
58
|
+
keys.push(key);
|
|
59
|
+
return keys;
|
|
60
|
+
},
|
|
61
|
+
getOwnPropertyDescriptor: (target, key) => {
|
|
62
|
+
const own = Reflect.getOwnPropertyDescriptor(target, key);
|
|
63
|
+
if (own || typeof key !== "string" || !propsOf(target).has(key))
|
|
64
|
+
return own;
|
|
65
|
+
return { value: Reflect.get(target, key), writable: false, enumerable: true, configurable: true };
|
|
66
|
+
},
|
|
52
67
|
});
|
|
53
68
|
}
|
|
54
69
|
get id() { return this[NODE].id; }
|
|
@@ -75,6 +90,11 @@ class ChildViewImpl {
|
|
|
75
90
|
return { _piece: { kind: "run", node: this[NODE], name, args } };
|
|
76
91
|
}
|
|
77
92
|
}
|
|
93
|
+
const NO_PROPS = new Set();
|
|
94
|
+
function propsOf(node) {
|
|
95
|
+
const slots = node.__cells?.slots;
|
|
96
|
+
return slots ? new Set(slots.keys()) : NO_PROPS;
|
|
97
|
+
}
|
|
78
98
|
export function childView(node) {
|
|
79
99
|
let view = childViews.get(node);
|
|
80
100
|
if (!view)
|
|
@@ -181,7 +201,7 @@ export function stateViewPrototype(keys, references = new Set()) {
|
|
|
181
201
|
for (const key of keys) {
|
|
182
202
|
entries[key] = references.has(key)
|
|
183
203
|
? { get() { return referenced(this[NODE], this[NODE][key]); }, enumerable: true }
|
|
184
|
-
: { get()
|
|
204
|
+
: { get: entryGetter(key), enumerable: true };
|
|
185
205
|
}
|
|
186
206
|
const proto = {};
|
|
187
207
|
// The children of the node's own tree, as its commands see them too.
|
|
@@ -191,6 +211,26 @@ export function stateViewPrototype(keys, references = new Set()) {
|
|
|
191
211
|
});
|
|
192
212
|
return { proto, entries };
|
|
193
213
|
}
|
|
214
|
+
/** Reads the entry's slot by its index in the node's layout, found once per layout: no lookup by name per read. */
|
|
215
|
+
function entryGetter(key) {
|
|
216
|
+
let layout;
|
|
217
|
+
let i = -1;
|
|
218
|
+
return function () {
|
|
219
|
+
const node = this[NODE];
|
|
220
|
+
const cells = node.__cells;
|
|
221
|
+
if (cells !== undefined) {
|
|
222
|
+
if (cells.layout !== layout) {
|
|
223
|
+
i = cells.layout.indexOf(key);
|
|
224
|
+
// An entry not registered yet is looked for again next time.
|
|
225
|
+
layout = i < 0 ? undefined : cells.layout;
|
|
226
|
+
}
|
|
227
|
+
const slot = i < 0 ? undefined : cells.list[i];
|
|
228
|
+
if (slot !== undefined)
|
|
229
|
+
return slot.get();
|
|
230
|
+
}
|
|
231
|
+
return node[key];
|
|
232
|
+
};
|
|
233
|
+
}
|
|
194
234
|
export function stateView(shape, node) {
|
|
195
235
|
const view = Object.create(shape.proto);
|
|
196
236
|
Object.defineProperties(view, shape.entries);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.js","sourceRoot":"","sources":["../../../src/components/factory/views.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC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O;QACX,CAAC;QACD,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC;YACD,IAAI,EAAE,CAAC;QACX,CAAC;gBAAS,CAAC;YACP,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;IACL,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,UAAU,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AAED,uFAAuF;AACvF,MAAM,UAAU,GAAiB,IAAI,iBAAiB,EAAE,CAAC;AAEzD,MAAM,UAAU,WAAW,CAAC,GAAoB;IAC5C,IAAI,CAAC,CAAC,GAAG,YAAY,iBAAiB,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,iEAAiE,CAAC,CAAC;IAChI,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { Size2D } from \"@/attributes/layout/size\";\nimport type { SizeConstraints } from \"@/layout/constraints\";\nimport type { Node2D, CameraScope } from \"@/components/trees/2d/node2d\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport type { Graphics2D } from \"@/render/graphics2d\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { RenderPass2D } from \"@/render/render-context2d\";\nimport type { Clip } from \"@/render/clip\";\nimport { NullRenderContext } from \"@/render/null-render-context\";\nimport { Graphics2D as GraphicsClass } from \"@/render/graphics2d\";\nimport { frameIn, Node2D as Node2DClass } from \"@/components/trees/2d/node2d\";\nimport { Node3D } from \"@/components/trees/three/node3d\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\nimport type { ChildBoundsMode } from \"@/components/trees/2d/group-bounds\";\nimport type { SpaceCamera } from \"@/attributes/layout/space3d\";\nimport type { TextStyle } from \"@/attributes/text/types\";\nimport type { MergePaint, ChildView, Clock, Component, Element, FontSpec, Max, Measurer, NodeFrame, NodeView, Piece, RenderContext2D } from \"@/components/factory/api\";\nimport { clipOf } from \"@/components/factory/clip-of\";\n\n/**\n * What a render did with its children beyond drawing them: composited them\n * (the ink bounds that leaves), looked at them through a camera, or stood them\n * in a 2.5D space. Picking and the space machinery read it between frames.\n */\nexport interface Composite {\n readonly bounds?: ChildBoundsMode;\n readonly camera?: CameraScope;\n readonly space?: SpaceCamera;\n /** The scene its 3D children were rendered into: what picking projects through. */\n readonly scene?: Scene3D;\n}\n\n/** The node a view stands for: how the engine's own modules (`Paint`, `Flow`) reach past the public surface. */\nexport const NODE = Symbol(\"componentNode\");\n\n/** What a generated node exposes to its views and modules. Never part of the authoring surface. */\nexport interface ComponentHost extends Node2D {\n _renderOwnChildren(pass: RenderPass2D): void;\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown): unknown;\n _lastShape: Graphics2D | null;\n /** The composite its last render or probe declared; `undefined` before either. */\n _record: Composite | null | undefined;\n}\n\n// ---- the pass in progress -------------------------------------------------\n\n/**\n * Measure and layout run synchronously, one node at a time, so the node being\n * laid out and its measurer are a single slot rather than state on every view.\n */\ninterface Pass {\n readonly node: Node2D;\n readonly scope: MeasureContext2D;\n readonly room: Max;\n readonly sizes: Map<Node2D, Size2D>;\n}\n\nlet pass: Pass | null = null;\n\nexport function withPass<T>(node: Node2D, scope: MeasureContext2D, room: Max, run: () => T): T {\n const outer = pass;\n pass = { node, scope, room, sizes: new Map() };\n try {\n return run();\n } finally {\n pass = outer;\n }\n}\n\nconst decided = new WeakSet<Node2D>();\n\n/** An engine module sized this node itself in this measure: its factory reports the size as it stands. */\nexport function markDecided(node: Node2D): void {\n decided.add(node);\n}\n\nexport function takeDecided(node: Node2D): boolean {\n return decided.delete(node);\n}\n\nexport function currentPass(): Pass {\n if (!pass) throw new Error(\"A component's measure or layout helper ran outside a measure or layout pass.\");\n return pass;\n}\n\nfunction measureChild(node: Node2D, max: Max): Size2D {\n const p = currentPass();\n const constraints: SizeConstraints = { maxWidth: max.width, maxHeight: max.height };\n const measured = node.measure(constraints, p.scope);\n const size = { width: measured.width ?? 0, height: measured.height ?? 0 };\n p.sizes.set(node, size);\n return size;\n}\n\n// ---- child views ------------------------------------------------------------\n\nconst childViews = new WeakMap<Node2D, ChildViewImpl>();\n\n/** A child as its parent's fields see it. One per child node, reused every frame. */\nclass ChildViewImpl implements ChildView {\n readonly [NODE]: Node2D;\n readonly state: never;\n\n constructor(node: Node2D) {\n this[NODE] = node;\n // The node's own accessors are its resolved values; a proxy keeps a parent from writing through them.\n this.state = new Proxy(node, {\n set: () => { throw new TypeError(\"A child's state is read-only to its parent; animate it with a command.\"); },\n }) as never;\n }\n\n get id(): string { return this[NODE].id; }\n get key(): never { return (keyOf(this[NODE]) ?? this[NODE].className) as never; }\n\n get size(): Size2D {\n // Outside a pass (a command being built), the size it was last laid out at, as a command's own node reports.\n if (!pass) {\n const box = this[NODE].layoutBounds;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n return pass.sizes.get(this[NODE]) ?? measureChild(this[NODE], pass.room);\n }\n\n get children(): readonly ChildView[] {\n const node = this[NODE] as Node2D & { _commandChildren?(): readonly ChildView[] };\n return node._commandChildren ? node._commandChildren() : node.children.map(childView);\n }\n\n measure(max: Max): Size2D {\n return measureChild(this[NODE], max);\n }\n\n to(targets: object): Piece {\n return { _piece: { kind: \"child\", node: this[NODE], targets: targets as Record<string, unknown> } };\n }\n\n run(name: string, args?: object): Piece {\n return { _piece: { kind: \"run\", node: this[NODE], name, args } };\n }\n}\n\nexport function childView(node: Node2D | Node): ChildView {\n let view = childViews.get(node as Node2D);\n if (!view) childViews.set(node as Node2D, view = new ChildViewImpl(node as Node2D));\n return view as unknown as ChildView;\n}\n\nexport function nodeOfView(view: ChildView<any>): Node2D {\n return (view as unknown as ChildViewImpl)[NODE];\n}\n\nconst nodeViews = new WeakMap<Node, WeakMap<Node, NodeViewImpl>>();\n\nconst NO_FRAME: NodeFrame = { x: 0, y: 0, rotation: 0, scale: 1 };\n\n/** A node outside a component's own children (an ancestor, a referenced node), as one reader's fields read it. */\nclass NodeViewImpl implements NodeView {\n readonly [NODE]: Node;\n readonly state: never;\n\n constructor(node: Node, readonly reader: Node) {\n this[NODE] = node;\n // A component's state as its own fields read it: a reference of its own is a view from where it stands.\n // Anything else it has (a 2D node's cardinal points) reads off the node.\n const fields = (node as { _view?: object })._view ?? node;\n this.state = new Proxy(fields, {\n get: (target, key) => {\n // Its constructor is the node's: what a host asks to tell what kind of node it reads.\n if (key === \"constructor\") return node.constructor;\n if (key in target) return Reflect.get(target, key);\n const value = Reflect.get(node, key) as unknown;\n // A method of the node runs on the node, not on this read-only view.\n return typeof value === \"function\" ? (value as (...args: unknown[]) => unknown).bind(node) : value;\n },\n set: () => { throw new TypeError(\"Another node's state is read-only to a component; animate it with a command.\"); },\n }) as never;\n }\n\n get id(): string { return this[NODE].id; }\n get key(): never { return (keyOf(this[NODE] as Node2D) ?? this[NODE].className) as never; }\n\n get size(): Size2D {\n const node = this[NODE];\n const box = node instanceof Node2DClass ? node.layoutBounds : undefined;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n\n get frame(): NodeFrame {\n const node = this[NODE];\n return node instanceof Node2DClass && this.reader instanceof Node2DClass ? frameIn(this.reader, node) : NO_FRAME;\n }\n}\n\n/** `node` as `reader` sees it. One view per pair. */\nexport function nodeView(node: Node, reader: Node): NodeView {\n let byReader = nodeViews.get(node);\n if (!byReader) nodeViews.set(node, byReader = new WeakMap());\n let view = byReader.get(reader);\n if (!view) byReader.set(reader, view = new NodeViewImpl(node, reader));\n return view;\n}\n\nexport function nodeOfNodeView(view: NodeView): Node {\n return (view as unknown as NodeViewImpl)[NODE];\n}\n\nconst found = new WeakMap<Node, Map<string, Node>>();\n\n/** The node with `id` in `reader`'s scene, as `reader` sees it, or `null`. Remembered per reader while it stays in the scene. */\nexport function referenced(reader: Node, id: unknown): NodeView | null {\n if (typeof id !== \"string\" || id === \"\") return null;\n let known = found.get(reader);\n let node = known?.get(id);\n if (!node || node.id !== id || rootOf(node) !== rootOf(reader)) {\n node = findIn(rootOf(reader), id) ?? undefined;\n if (!node) {\n known?.delete(id);\n return null;\n }\n if (!known) found.set(reader, known = new Map());\n known.set(id, node);\n }\n return nodeView(node, reader);\n}\n\nfunction rootOf(node: Node): Node {\n let at = node;\n while (at.parent) at = at.parent;\n return at;\n}\n\nfunction findIn(at: Node, id: string): Node | null {\n if (at.id === id) return at;\n for (const child of at._allChildren) {\n const hit = findIn(child, id);\n if (hit) return hit;\n }\n return null;\n}\n\nlet keyOf: (node: Node2D) => string | undefined = () => undefined;\n/** Set by the factory module, which owns the node descriptors. */\nexport function setKeyLookup(lookup: (node: Node2D) => string | undefined): void {\n keyOf = lookup;\n}\n\n// ---- state views ------------------------------------------------------------\n\n/**\n * One prototype of getters per component, so a node's `state` is a single\n * object made once: every read goes straight to the node's own slot, and a\n * frame allocates nothing to hand its fields their values.\n */\nexport interface ViewShape {\n readonly proto: object;\n /** Own, so `{ ...state }` copies every entry; the getters themselves are shared. */\n readonly entries: PropertyDescriptorMap;\n}\n\nexport function stateViewPrototype(keys: readonly string[], references: ReadonlySet<string> = new Set()): ViewShape {\n const entries: PropertyDescriptorMap = {};\n for (const key of keys) {\n entries[key] = references.has(key)\n ? { get(this: { [NODE]: Node }) { return referenced(this[NODE], (this[NODE] as unknown as Record<string, unknown>)[key]); }, enumerable: true }\n : { get(this: { [NODE]: object }) { return (this[NODE] as Record<string, unknown>)[key]; }, enumerable: true };\n }\n const proto = {};\n // The children of the node's own tree, as its commands see them too.\n Object.defineProperty(proto, \"children\", {\n get(this: { [NODE]: { _commandChildren(): readonly ChildView[] } }) { return this[NODE]._commandChildren(); },\n enumerable: false,\n });\n return { proto, entries };\n}\n\nexport function stateView(shape: ViewShape, node: object): object {\n const view = Object.create(shape.proto) as { [NODE]: object };\n Object.defineProperties(view, shape.entries);\n view[NODE] = node;\n return view;\n}\n\n/** A command's `state`: where it starts, so a frame function reading it never sees its own writes. */\nexport function snapshot(view: object): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key in view) out[key] = (view as Record<string, unknown>)[key];\n return out;\n}\n\n// ---- measurer and render context --------------------------------------------\n\nexport class MeasurerImpl implements Measurer {\n max: Max = {};\n scope: MeasureContext2D | null = null;\n\n constructor(readonly host: Node) { }\n\n get time(): Clock {\n return this.host.time;\n }\n\n text(text: string, font: FontSpec): Size2D {\n if (!this.scope) throw new Error(\"measurer.text was called outside measure.\");\n return this.scope.measureText(text, font.fontSize, font.fontFamily, font.fontWeight, font.letterSpacing);\n }\n}\n\n/** Reused every frame: `pass` and `cut` are rewritten before each render. */\nexport class RenderContextImpl implements RenderContext2D {\n pass: RenderPass2D | null = null;\n /** The near-plane cut a 2.5D space puts in front of this node's own paint. */\n cut: Clip | null = null;\n\n /**\n * `probing`: `render` runs only to find the shape it paints (for clip and\n * picking outside a frame), so nothing is drawn and no child is visited.\n */\n constructor(readonly host: ComponentHost, readonly probing = false) { }\n\n get size(): Size2D {\n const box = this.host.layoutBounds;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n\n get time(): Clock {\n return this.host.time;\n }\n\n draw(graphics: Graphics2D | readonly Graphics2D[] | null | undefined): void {\n if (!graphics || this.probing) return;\n const out = this.target();\n if (Array.isArray(graphics)) for (const g of graphics) out.draw(g);\n else out.draw(graphics as Graphics2D);\n }\n\n children(): void {\n if (this.probing) return;\n // Drawn plainly, so a space or composite the last frame declared no longer holds for them.\n if (!this.composite) this.host._record = null;\n this.host._renderOwnChildren(this.target());\n }\n\n /** What this render has declared so far. Its host's record follows at once, so the children it draws see it. */\n composite: Composite | null = null;\n\n private _declare(composite: Composite): void {\n this.composite = { ...this.composite, ...composite };\n if (!this.probing) this.host._record = this.composite;\n }\n\n mask(options: MaskOptions): void {\n this._declare({ bounds: \"first\" });\n if (this.probing) return;\n const out = this.target();\n const [stencil, ...content] = this.host.children;\n if (!stencil) return;\n if (content.length === 0) {\n stencil.render(out);\n return;\n }\n out.beginMask({ mode: options.mode, inverted: options.inverted });\n stencil.render(out);\n out.applyMask();\n for (const child of content) child.render(out);\n out.endMask();\n }\n\n merge(op: BooleanOperation, paint: MergePaint): void {\n this._declare({ bounds: op === \"subtract\" ? \"first\" : op === \"intersect\" ? \"intersect\" : \"union\" });\n if (this.probing) return;\n const out = this.target();\n out.beginBoolean(op);\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\n out.endBoolean();\n // A drawing with no shape of its own paints the merged outline.\n out.draw(new GraphicsClass().shadow(paint.shadow).fill(paint.fill));\n if (paint.overlay && (paint.overlay as unknown[]).length > 0) out.draw(new GraphicsClass().fill(paint.overlay));\n out.draw(new GraphicsClass().stroke(paint.stroke));\n }\n\n /** Your children, through a camera viewing your box: aimed at `lookAt`, zoomed, turned by `heading`. */\n camera(scope: CameraScope): void {\n this._declare({ camera: scope });\n if (this.probing) return;\n const out = this.target();\n const rect = this.host.layoutBounds;\n out.beginCamera({ x: rect?.x ?? 0, y: -(rect?.y ?? 0), width: rect?.width ?? 0, height: rect?.height ?? 0 }, scope.lookAt, scope.zoom, scope.heading);\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\n out.endCamera();\n }\n\n /** Your 3D children, rendered in order into a new scene. */\n scene3D(): Scene3D {\n const scene = new Scene3D();\n for (const child of this.host._allChildren) if (child instanceof Node3D) child.render(scene);\n this._declare({ scene });\n return scene;\n }\n\n /** Your children, standing in one 2.5D space seen by `camera`, drawn far to near. */\n space(camera: SpaceCamera): void {\n this._declare({ space: camera });\n if (!this.probing) this.host._renderOwnChildren(this.target());\n }\n\n textStyle(style: TextStyle | null, body: () => void): void {\n if (this.probing) return body();\n const out = this.target();\n out.pushTextStyle(style);\n try {\n body();\n } finally {\n out.popTextStyle();\n }\n }\n\n clip(shape: Graphics2D, body: () => void): void {\n if (this.probing) return body();\n const outline = clipOf(shape);\n // No outline is no clip, as a node with no `clipSelf` confines nothing.\n if (outline.isEmpty()) return body();\n const out = this.target();\n out.beginClip(outline);\n try {\n body();\n } finally {\n out.endClip();\n }\n }\n\n /** An ancestor stands this node in a space: one opens it, and nothing between them flattens. */\n get inSpace(): boolean {\n for (let at = this.host.parent; at; at = at.parent) {\n if (!(at instanceof Node2DClass)) return false;\n if (at._spaceCamera()) return true;\n if (!at._rendersChildrenInSpace()) return false;\n }\n return false;\n }\n\n ancestor<K extends string, S, C>(component: Component<K, S, C, any, any, any>): NodeView<Element<K, S, C>> | null {\n for (let at = this.host.parent; at; at = at.parent) {\n if (at instanceof component.node) return nodeView(at, this.host) as unknown as NodeView<Element<K, S, C>>;\n }\n return null;\n }\n\n /** Paint `body` in front of the space's near plane, as `Node2D` does for its own paint. */\n inFront(body: () => void): void {\n if (this.probing) return;\n const out = this.target();\n if (!this.cut) {\n body();\n return;\n }\n out.beginClip(this.cut);\n try {\n body();\n } finally {\n out.endClip();\n }\n }\n\n target(): RenderPass2D {\n if (this.probing) return PROBE_PASS;\n if (!this.pass) throw new Error(\"A component's render context was used outside render.\");\n return this.pass;\n }\n}\n\n/** Where a probe's scoped calls (a clip, a camera) land: a pass that draws nothing. */\nconst PROBE_PASS: RenderPass2D = new NullRenderContext();\n\nexport function internalsOf(ctx: RenderContext2D): RenderContextImpl {\n if (!(ctx instanceof RenderContextImpl)) throw new TypeError(\"Paint.draw takes the render context its render field was given.\");\n return ctx;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"views.js","sourceRoot":"","sources":["../../../src/components/factory/views.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE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out/size\";\nimport type { SizeConstraints } from \"@/layout/constraints\";\nimport type { Node2D, CameraScope } from \"@/components/trees/2d/node2d\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport type { Graphics2D } from \"@/render/graphics2d\";\nimport type { MeasureContext2D } from \"@/render/measure-context\";\nimport type { RenderPass2D } from \"@/render/render-context2d\";\nimport type { Clip } from \"@/render/clip\";\nimport { NullRenderContext } from \"@/render/null-render-context\";\nimport { Graphics2D as GraphicsClass } from \"@/render/graphics2d\";\nimport { frameIn, Node2D as Node2DClass } from \"@/components/trees/2d/node2d\";\nimport { Node3D } from \"@/components/trees/three/node3d\";\nimport { Scene3D } from \"@/render3d/scene3d\";\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\nimport type { ChildBoundsMode } from \"@/components/trees/2d/group-bounds\";\nimport type { SpaceCamera } from \"@/attributes/layout/space3d\";\nimport type { TextStyle } from \"@/attributes/text/types\";\nimport type { MergePaint, ChildView, Clock, Component, Element, FontSpec, Max, Measurer, NodeFrame, NodeView, Piece, RenderContext2D } from \"@/components/factory/api\";\nimport { clipOf } from \"@/components/factory/clip-of\";\nimport type { PropHost } from \"@/props/host\";\nimport type { PropLayout } from \"@/props/layout\";\n\n/**\n * What a render did with its children beyond drawing them: composited them\n * (the ink bounds that leaves), looked at them through a camera, or stood them\n * in a 2.5D space. Picking and the space machinery read it between frames.\n */\nexport interface Composite {\n readonly bounds?: ChildBoundsMode;\n readonly camera?: CameraScope;\n readonly space?: SpaceCamera;\n /** The scene its 3D children were rendered into: what picking projects through. */\n readonly scene?: Scene3D;\n}\n\n/** The node a view stands for: how the engine's own modules (`Paint`, `Flow`) reach past the public surface. */\nexport const NODE = Symbol(\"componentNode\");\n\n/** What a generated node exposes to its views and modules. Never part of the authoring surface. */\nexport interface ComponentHost extends Node2D {\n _renderOwnChildren(pass: RenderPass2D): void;\n _animate(frame: (t: number) => Record<string, unknown>, duration: number, easing: unknown): unknown;\n _lastShape: Graphics2D | null;\n /** The composite its last render or probe declared; `undefined` before either. */\n _record: Composite | null | undefined;\n}\n\n// ---- the pass in progress -------------------------------------------------\n\n/**\n * Measure and layout run synchronously, one node at a time, so the node being\n * laid out and its measurer are a single slot rather than state on every view.\n */\ninterface Pass {\n readonly node: Node2D;\n readonly scope: MeasureContext2D;\n readonly room: Max;\n readonly sizes: Map<Node2D, Size2D>;\n}\n\nlet pass: Pass | null = null;\n\nexport function withPass<T>(node: Node2D, scope: MeasureContext2D, room: Max, run: () => T): T {\n const outer = pass;\n pass = { node, scope, room, sizes: new Map() };\n try {\n return run();\n } finally {\n pass = outer;\n }\n}\n\nconst decided = new WeakSet<Node2D>();\n\n/** An engine module sized this node itself in this measure: its factory reports the size as it stands. */\nexport function markDecided(node: Node2D): void {\n decided.add(node);\n}\n\nexport function takeDecided(node: Node2D): boolean {\n return decided.delete(node);\n}\n\nexport function currentPass(): Pass {\n if (!pass) throw new Error(\"A component's measure or layout helper ran outside a measure or layout pass.\");\n return pass;\n}\n\nfunction measureChild(node: Node2D, max: Max): Size2D {\n const p = currentPass();\n const constraints: SizeConstraints = { maxWidth: max.width, maxHeight: max.height };\n const measured = node.measure(constraints, p.scope);\n const size = { width: measured.width ?? 0, height: measured.height ?? 0 };\n p.sizes.set(node, size);\n return size;\n}\n\n// ---- child views ------------------------------------------------------------\n\nconst childViews = new WeakMap<Node2D, ChildViewImpl>();\n\n/** A child as its parent's fields see it. One per child node, reused every frame. */\nclass ChildViewImpl implements ChildView {\n readonly [NODE]: Node2D;\n readonly state: never;\n\n constructor(node: Node2D) {\n this[NODE] = node;\n // The node's own accessors are its resolved values; a proxy keeps a parent from writing through them.\n // Its props live on the prototype, so the proxy lists them as its own, as a spread or `Object.keys` expects.\n this.state = new Proxy(node, {\n set: () => { throw new TypeError(\"A child's state is read-only to its parent; animate it with a command.\"); },\n ownKeys: (target) => {\n const keys = Reflect.ownKeys(target);\n const own = new Set(keys);\n for (const key of propsOf(target)) if (!own.has(key)) keys.push(key);\n return keys;\n },\n getOwnPropertyDescriptor: (target, key) => {\n const own = Reflect.getOwnPropertyDescriptor(target, key);\n if (own || typeof key !== \"string\" || !propsOf(target).has(key)) return own;\n return { value: Reflect.get(target, key), writable: false, enumerable: true, configurable: true };\n },\n }) as never;\n }\n\n get id(): string { return this[NODE].id; }\n get key(): never { return (keyOf(this[NODE]) ?? this[NODE].className) as never; }\n\n get size(): Size2D {\n // Outside a pass (a command being built), the size it was last laid out at, as a command's own node reports.\n if (!pass) {\n const box = this[NODE].layoutBounds;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n return pass.sizes.get(this[NODE]) ?? measureChild(this[NODE], pass.room);\n }\n\n get children(): readonly ChildView[] {\n const node = this[NODE] as Node2D & { _commandChildren?(): readonly ChildView[] };\n return node._commandChildren ? node._commandChildren() : node.children.map(childView);\n }\n\n measure(max: Max): Size2D {\n return measureChild(this[NODE], max);\n }\n\n to(targets: object): Piece {\n return { _piece: { kind: \"child\", node: this[NODE], targets: targets as Record<string, unknown> } };\n }\n\n run(name: string, args?: object): Piece {\n return { _piece: { kind: \"run\", node: this[NODE], name, args } };\n }\n}\n\nconst NO_PROPS: ReadonlySet<string> = new Set();\n\nfunction propsOf(node: object): ReadonlySet<string> {\n const slots = (node as PropHost).__cells?.slots;\n return slots ? new Set(slots.keys()) : NO_PROPS;\n}\n\nexport function childView(node: Node2D | Node): ChildView {\n let view = childViews.get(node as Node2D);\n if (!view) childViews.set(node as Node2D, view = new ChildViewImpl(node as Node2D));\n return view as unknown as ChildView;\n}\n\nexport function nodeOfView(view: ChildView<any>): Node2D {\n return (view as unknown as ChildViewImpl)[NODE];\n}\n\nconst nodeViews = new WeakMap<Node, WeakMap<Node, NodeViewImpl>>();\n\nconst NO_FRAME: NodeFrame = { x: 0, y: 0, rotation: 0, scale: 1 };\n\n/** A node outside a component's own children (an ancestor, a referenced node), as one reader's fields read it. */\nclass NodeViewImpl implements NodeView {\n readonly [NODE]: Node;\n readonly state: never;\n\n constructor(node: Node, readonly reader: Node) {\n this[NODE] = node;\n // A component's state as its own fields read it: a reference of its own is a view from where it stands.\n // Anything else it has (a 2D node's cardinal points) reads off the node.\n const fields = (node as { _view?: object })._view ?? node;\n this.state = new Proxy(fields, {\n get: (target, key) => {\n // Its constructor is the node's: what a host asks to tell what kind of node it reads.\n if (key === \"constructor\") return node.constructor;\n if (key in target) return Reflect.get(target, key);\n const value = Reflect.get(node, key) as unknown;\n // A method of the node runs on the node, not on this read-only view.\n return typeof value === \"function\" ? (value as (...args: unknown[]) => unknown).bind(node) : value;\n },\n set: () => { throw new TypeError(\"Another node's state is read-only to a component; animate it with a command.\"); },\n }) as never;\n }\n\n get id(): string { return this[NODE].id; }\n get key(): never { return (keyOf(this[NODE] as Node2D) ?? this[NODE].className) as never; }\n\n get size(): Size2D {\n const node = this[NODE];\n const box = node instanceof Node2DClass ? node.layoutBounds : undefined;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n\n get frame(): NodeFrame {\n const node = this[NODE];\n return node instanceof Node2DClass && this.reader instanceof Node2DClass ? frameIn(this.reader, node) : NO_FRAME;\n }\n}\n\n/** `node` as `reader` sees it. One view per pair. */\nexport function nodeView(node: Node, reader: Node): NodeView {\n let byReader = nodeViews.get(node);\n if (!byReader) nodeViews.set(node, byReader = new WeakMap());\n let view = byReader.get(reader);\n if (!view) byReader.set(reader, view = new NodeViewImpl(node, reader));\n return view;\n}\n\nexport function nodeOfNodeView(view: NodeView): Node {\n return (view as unknown as NodeViewImpl)[NODE];\n}\n\nconst found = new WeakMap<Node, Map<string, Node>>();\n\n/** The node with `id` in `reader`'s scene, as `reader` sees it, or `null`. Remembered per reader while it stays in the scene. */\nexport function referenced(reader: Node, id: unknown): NodeView | null {\n if (typeof id !== \"string\" || id === \"\") return null;\n let known = found.get(reader);\n let node = known?.get(id);\n if (!node || node.id !== id || rootOf(node) !== rootOf(reader)) {\n node = findIn(rootOf(reader), id) ?? undefined;\n if (!node) {\n known?.delete(id);\n return null;\n }\n if (!known) found.set(reader, known = new Map());\n known.set(id, node);\n }\n return nodeView(node, reader);\n}\n\nfunction rootOf(node: Node): Node {\n let at = node;\n while (at.parent) at = at.parent;\n return at;\n}\n\nfunction findIn(at: Node, id: string): Node | null {\n if (at.id === id) return at;\n for (const child of at._allChildren) {\n const hit = findIn(child, id);\n if (hit) return hit;\n }\n return null;\n}\n\nlet keyOf: (node: Node2D) => string | undefined = () => undefined;\n/** Set by the factory module, which owns the node descriptors. */\nexport function setKeyLookup(lookup: (node: Node2D) => string | undefined): void {\n keyOf = lookup;\n}\n\n// ---- state views ------------------------------------------------------------\n\n/**\n * One prototype of getters per component, so a node's `state` is a single\n * object made once: every read goes straight to the node's own slot, and a\n * frame allocates nothing to hand its fields their values.\n */\nexport interface ViewShape {\n readonly proto: object;\n /** Own, so `{ ...state }` copies every entry; the getters themselves are shared. */\n readonly entries: PropertyDescriptorMap;\n}\n\nexport function stateViewPrototype(keys: readonly string[], references: ReadonlySet<string> = new Set()): ViewShape {\n const entries: PropertyDescriptorMap = {};\n for (const key of keys) {\n entries[key] = references.has(key)\n ? { get(this: { [NODE]: Node }) { return referenced(this[NODE], (this[NODE] as unknown as Record<string, unknown>)[key]); }, enumerable: true }\n : { get: entryGetter(key), enumerable: true };\n }\n const proto = {};\n // The children of the node's own tree, as its commands see them too.\n Object.defineProperty(proto, \"children\", {\n get(this: { [NODE]: { _commandChildren(): readonly ChildView[] } }) { return this[NODE]._commandChildren(); },\n enumerable: false,\n });\n return { proto, entries };\n}\n\n/** Reads the entry's slot by its index in the node's layout, found once per layout: no lookup by name per read. */\nfunction entryGetter(key: string): (this: { [NODE]: object }) => unknown {\n let layout: PropLayout | undefined;\n let i = -1;\n return function () {\n const node = this[NODE];\n const cells = (node as PropHost).__cells;\n if (cells !== undefined) {\n if (cells.layout !== layout) {\n i = cells.layout.indexOf(key);\n // An entry not registered yet is looked for again next time.\n layout = i < 0 ? undefined : cells.layout;\n }\n const slot = i < 0 ? undefined : cells.list[i];\n if (slot !== undefined) return slot.get();\n }\n return (node as Record<string, unknown>)[key];\n };\n}\n\nexport function stateView(shape: ViewShape, node: object): object {\n const view = Object.create(shape.proto) as { [NODE]: object };\n Object.defineProperties(view, shape.entries);\n view[NODE] = node;\n return view;\n}\n\n/** A command's `state`: where it starts, so a frame function reading it never sees its own writes. */\nexport function snapshot(view: object): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const key in view) out[key] = (view as Record<string, unknown>)[key];\n return out;\n}\n\n// ---- measurer and render context --------------------------------------------\n\nexport class MeasurerImpl implements Measurer {\n max: Max = {};\n scope: MeasureContext2D | null = null;\n\n constructor(readonly host: Node) { }\n\n get time(): Clock {\n return this.host.time;\n }\n\n text(text: string, font: FontSpec): Size2D {\n if (!this.scope) throw new Error(\"measurer.text was called outside measure.\");\n return this.scope.measureText(text, font.fontSize, font.fontFamily, font.fontWeight, font.letterSpacing);\n }\n}\n\n/** Reused every frame: `pass` and `cut` are rewritten before each render. */\nexport class RenderContextImpl implements RenderContext2D {\n pass: RenderPass2D | null = null;\n /** The near-plane cut a 2.5D space puts in front of this node's own paint. */\n cut: Clip | null = null;\n\n /**\n * `probing`: `render` runs only to find the shape it paints (for clip and\n * picking outside a frame), so nothing is drawn and no child is visited.\n */\n constructor(readonly host: ComponentHost, readonly probing = false) { }\n\n get size(): Size2D {\n const box = this.host.layoutBounds;\n return { width: box?.width ?? 0, height: box?.height ?? 0 };\n }\n\n get time(): Clock {\n return this.host.time;\n }\n\n draw(graphics: Graphics2D | readonly Graphics2D[] | null | undefined): void {\n if (!graphics || this.probing) return;\n const out = this.target();\n if (Array.isArray(graphics)) for (const g of graphics) out.draw(g);\n else out.draw(graphics as Graphics2D);\n }\n\n children(): void {\n if (this.probing) return;\n // Drawn plainly, so a space or composite the last frame declared no longer holds for them.\n if (!this.composite) this.host._record = null;\n this.host._renderOwnChildren(this.target());\n }\n\n /** What this render has declared so far. Its host's record follows at once, so the children it draws see it. */\n composite: Composite | null = null;\n\n private _declare(composite: Composite): void {\n this.composite = { ...this.composite, ...composite };\n if (!this.probing) this.host._record = this.composite;\n }\n\n mask(options: MaskOptions): void {\n this._declare({ bounds: \"first\" });\n if (this.probing) return;\n const out = this.target();\n const [stencil, ...content] = this.host.children;\n if (!stencil) return;\n if (content.length === 0) {\n stencil.render(out);\n return;\n }\n out.beginMask({ mode: options.mode, inverted: options.inverted });\n stencil.render(out);\n out.applyMask();\n for (const child of content) child.render(out);\n out.endMask();\n }\n\n merge(op: BooleanOperation, paint: MergePaint): void {\n this._declare({ bounds: op === \"subtract\" ? \"first\" : op === \"intersect\" ? \"intersect\" : \"union\" });\n if (this.probing) return;\n const out = this.target();\n out.beginBoolean(op);\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\n out.endBoolean();\n // A drawing with no shape of its own paints the merged outline.\n out.draw(new GraphicsClass().shadow(paint.shadow).fill(paint.fill));\n if (paint.overlay && (paint.overlay as unknown[]).length > 0) out.draw(new GraphicsClass().fill(paint.overlay));\n out.draw(new GraphicsClass().stroke(paint.stroke));\n }\n\n /** Your children, through a camera viewing your box: aimed at `lookAt`, zoomed, turned by `heading`. */\n camera(scope: CameraScope): void {\n this._declare({ camera: scope });\n if (this.probing) return;\n const out = this.target();\n const rect = this.host.layoutBounds;\n out.beginCamera({ x: rect?.x ?? 0, y: -(rect?.y ?? 0), width: rect?.width ?? 0, height: rect?.height ?? 0 }, scope.lookAt, scope.zoom, scope.heading);\n for (const child of this.host._allChildren) if (child instanceof Node2DClass) child.render(out);\n out.endCamera();\n }\n\n /** Your 3D children, rendered in order into a new scene. */\n scene3D(): Scene3D {\n const scene = new Scene3D();\n for (const child of this.host._allChildren) if (child instanceof Node3D) child.render(scene);\n this._declare({ scene });\n return scene;\n }\n\n /** Your children, standing in one 2.5D space seen by `camera`, drawn far to near. */\n space(camera: SpaceCamera): void {\n this._declare({ space: camera });\n if (!this.probing) this.host._renderOwnChildren(this.target());\n }\n\n textStyle(style: TextStyle | null, body: () => void): void {\n if (this.probing) return body();\n const out = this.target();\n out.pushTextStyle(style);\n try {\n body();\n } finally {\n out.popTextStyle();\n }\n }\n\n clip(shape: Graphics2D, body: () => void): void {\n if (this.probing) return body();\n const outline = clipOf(shape);\n // No outline is no clip, as a node with no `clipSelf` confines nothing.\n if (outline.isEmpty()) return body();\n const out = this.target();\n out.beginClip(outline);\n try {\n body();\n } finally {\n out.endClip();\n }\n }\n\n /** An ancestor stands this node in a space: one opens it, and nothing between them flattens. */\n get inSpace(): boolean {\n for (let at = this.host.parent; at; at = at.parent) {\n if (!(at instanceof Node2DClass)) return false;\n if (at._spaceCamera()) return true;\n if (!at._rendersChildrenInSpace()) return false;\n }\n return false;\n }\n\n ancestor<K extends string, S, C>(component: Component<K, S, C, any, any, any>): NodeView<Element<K, S, C>> | null {\n for (let at = this.host.parent; at; at = at.parent) {\n if (at instanceof component.node) return nodeView(at, this.host) as unknown as NodeView<Element<K, S, C>>;\n }\n return null;\n }\n\n /** Paint `body` in front of the space's near plane, as `Node2D` does for its own paint. */\n inFront(body: () => void): void {\n if (this.probing) return;\n const out = this.target();\n if (!this.cut) {\n body();\n return;\n }\n out.beginClip(this.cut);\n try {\n body();\n } finally {\n out.endClip();\n }\n }\n\n target(): RenderPass2D {\n if (this.probing) return PROBE_PASS;\n if (!this.pass) throw new Error(\"A component's render context was used outside render.\");\n return this.pass;\n }\n}\n\n/** Where a probe's scoped calls (a clip, a camera) land: a pass that draws nothing. */\nconst PROBE_PASS: RenderPass2D = new NullRenderContext();\n\nexport function internalsOf(ctx: RenderContext2D): RenderContextImpl {\n if (!(ctx instanceof RenderContextImpl)) throw new TypeError(\"Paint.draw takes the render context its render field was given.\");\n return ctx;\n}\n"]}
|
|
@@ -26,10 +26,9 @@ export interface ReactiveHost extends PropHost {
|
|
|
26
26
|
_stateStack: Map<string, PropSnapshot<any>>[];
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Create the {@link PropSlot}
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* (mapper-aware, binding-aware).
|
|
29
|
+
* Create the {@link PropSlot} for a freshly-declared prop, place it in its class's
|
|
30
|
+
* `PropLayout` (whose prototype accessor routes writes through
|
|
31
|
+
* `host._writeProp`) and register its tween/mapper metadata.
|
|
33
32
|
*/
|
|
34
33
|
/** @internal */
|
|
35
34
|
export declare function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-reactive.d.ts","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAe,QAAQ,EAAW,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE;;;;;;GAMG;AAEH;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC1C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,YAAY,CAAC;IACnG,kFAAkF;IAClF,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CACjD;AAED
|
|
1
|
+
{"version":3,"file":"node-reactive.d.ts","sourceRoot":"","sources":["../../../../src/components/trees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AAG,CAAC,GAChC,IAAI,CAcN;AAED,kFAAkF;AAClF,gBAAgB;AAChB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQzE;AAID;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAEvD,sEAAsE;AACtE,gBAAgB;AAChB,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CAQ1D;AAED,4EAA4E;AAC5E,gBAAgB;AAChB,wBAAgB,SAAS,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAGlD;AAED,wEAAwE;AACxE,gBAAgB;AAChB,wBAAgB,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAElE;AAED,iEAAiE;AACjE,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAM7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,gBAAgB;AAChB,wBAAgB,eAAe,CAC3B,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAkBhC"}
|
|
@@ -2,28 +2,31 @@ import { PropSlot } from "../../../props/slot.js";
|
|
|
2
2
|
import { ensureCells } from "../../../props/host.js";
|
|
3
3
|
import { driveCommand } from "../../../tween/command.js";
|
|
4
4
|
/**
|
|
5
|
-
* Create the {@link PropSlot}
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* (mapper-aware, binding-aware).
|
|
5
|
+
* Create the {@link PropSlot} for a freshly-declared prop, place it in its class's
|
|
6
|
+
* `PropLayout` (whose prototype accessor routes writes through
|
|
7
|
+
* `host._writeProp`) and register its tween/mapper metadata.
|
|
9
8
|
*/
|
|
10
9
|
/** @internal */
|
|
11
10
|
export function registerProp(host, field, options) {
|
|
12
11
|
const slot = new PropSlot(undefined, host, field);
|
|
13
12
|
const cells = ensureCells(host);
|
|
14
13
|
cells.slots.set(field, slot);
|
|
14
|
+
cells.list[cells.layout.place(field)] = slot;
|
|
15
15
|
if (options?.tween) {
|
|
16
16
|
(cells.tweens ??= new Map()).set(field, options.tween);
|
|
17
17
|
}
|
|
18
18
|
if (options?.mapper) {
|
|
19
19
|
(cells.mappers ??= new Map()).set(field, options.mapper);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
// Something of the instance's own, or its class's, already answers to the name: shadow it as before.
|
|
22
|
+
if (!cells.layout.serves(host, field)) {
|
|
23
|
+
Object.defineProperty(host, field, {
|
|
24
|
+
get: () => slot.get(),
|
|
25
|
+
set: (value) => host._writeProp(field, value),
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
* Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-reactive.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AA2B7D;;;;;GAKG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAM,IAAkB,EAAE,KAAa,EAAE,OAA+B;IAChG,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAM,SAA2B,EAAE,IAAI,EAA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,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC3B,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAAE,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,MAAM,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { PropSlot, PropSnapshot } from \"@/props/slot\";\nimport { ensureCells, PropHost, TweenFn } from \"@/props/host\";\nimport { EasingFunction } from \"@/tween/ease/type\";\nimport { driveCommand, type Command } from \"@/tween/command\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { PropOptions } from \"@/attributes/properties/decorator\";\n\n/**\n * Companion implementation of {@link Node2D}'s property machinery and its\n * save/restore state stack. The bodies live here as free functions over a\n * narrow {@link ReactiveHost} so `node.ts` keeps only thin delegators (and the\n * hot-path `set`/`_writeProp`, which stay inline on the class). Mirrors the\n * existing `getPropSlot(host, name)` pattern in `props/host.ts`.\n */\n\n/**\n * The slice of a {@link Node2D} these helpers touch: the {@link PropHost} maps\n * plus the internal write/tween seams. `_writeProp` and `_prepareStep` remain\n * methods on `Node2D`; the helpers call back through them so subclass behaviour\n * and the inline hot path are preserved.\n */\n/** @internal */\nexport interface ReactiveHost extends PropHost {\n readonly id: string;\n _writeProp(field: string, value: unknown): void;\n _prepareStep(to: Record<string, unknown>, duration: number, easing?: EasingFunction): TweenStepper;\n /** LIFO stack of save() snapshot layers; owned as an instance field on Node2D. */\n _stateStack: Map<string, PropSnapshot<any>>[];\n}\n\n/**\n * Create the {@link PropSlot} + accessor for a freshly-declared prop and register\n * its tween/mapper metadata. Extracted from `Node2D._registerProp`; defines the\n * getter/setter on `host` so writes route through `host._writeProp`\n * (mapper-aware, binding-aware).\n */\n/** @internal */\nexport function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void {\n const slot = new PropSlot<Int>(undefined as unknown as Int, host, field);\n const cells = ensureCells(host);\n cells.slots.set(field, slot);\n if (options?.tween) {\n (cells.tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\n }\n if (options?.mapper) {\n (cells.mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\n }\n Object.defineProperty(host, field, {\n get: () => slot.get(),\n set: (value: any) => host._writeProp(field, value),\n enumerable: true,\n configurable: true,\n });\n}\n\n/**\n * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first\n * call creates the cell via {@link registerProp}; a subsequent call for the same\n * field reuses the cell and only refines its tween/mapper (so a subclass can\n * override a parent default without losing the cell or its bindings), then\n * writes the value. Extracted from `Node2D.applyProp`.\n */\n/** @internal */\nexport function applyProp<Ext, Int = Ext>(\n host: ReactiveHost,\n field: string,\n initial: Ext | (() => Ext) | undefined,\n options?: PropOptions<Ext, Int>,\n): void {\n const existing = host.__cells?.slots.get(field);\n if (!existing) {\n registerProp<Int>(host, field, options);\n } else if (options) {\n // Allow subclasses to refine tween/mapper on an inherited field.\n if (options.tween) {\n (ensureCells(host).tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\n }\n if (options.mapper) {\n (ensureCells(host).mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\n }\n }\n host._writeProp(field, initial);\n}\n\n/** Snapshot every registered prop's current value/binding into a plain object. */\n/** @internal */\nexport function collectProperties(host: ReactiveHost): Record<string, any> {\n const result: Record<string, any> = {};\n if (host.__cells) {\n for (const key of host.__cells.slots.keys()) {\n result[key] = (host as any)[key];\n }\n }\n return result;\n}\n\n// ---- State stack (save / restore) -----------------------------------------\n\n/**\n * Every declared prop of a node, captured as the value **or binding** its slot\n * holds — see {@link Node2D.captureProps}, which is the public way to make one.\n *\n * Keyed by prop name. Opaque on purpose: what a slot holds is the *mapped*,\n * internal form, and reading it out to write back through `set` is exactly the\n * round-trip a layer exists to avoid.\n */\nexport type PropLayer = Map<string, PropSnapshot<any>>;\n\n/** Snapshot every prop slot (value or binding) into a fresh layer. */\n/** @internal */\nexport function captureLayer(host: ReactiveHost): PropLayer {\n const layer: PropLayer = new Map();\n const slots = host.__cells?.slots;\n if (!slots) return layer;\n for (const [key, slot] of slots) {\n layer.set(key, slot.snapshot());\n }\n return layer;\n}\n\n/** Push a snapshot of every prop slot (value or binding) onto the stack. */\n/** @internal */\nexport function saveState(host: ReactiveHost): void {\n if (!host.__cells) return;\n host._stateStack.push(captureLayer(host));\n}\n\n/** Pop the top snapshot layer, or `undefined` if the stack is empty. */\n/** @internal */\nexport function popState(host: ReactiveHost): PropLayer | undefined {\n return host._stateStack.pop();\n}\n\n/** Instantly reapply a snapshot layer to every captured slot. */\n/** @internal */\nexport function applySnapshotLayer(host: ReactiveHost, layer: PropLayer): void {\n const slots = host.__cells?.slots;\n if (!slots) return;\n for (const [key, snap] of layer) {\n slots.get(key)?.restoreFrom(snap);\n }\n}\n\n/**\n * Animated restore: tween the numeric / custom-tweenable props toward their\n * saved resolved values, then reapply the full snapshot so bindings are\n * restored (not frozen at the tween's landing value) and non-tweened props snap.\n *\n * A {@link Command} rather than a generator: `_prepareStep`'s stepper already\n * drives the tween as a pure function of elapsed time, so `driveCommand` wraps\n * it directly and fires the snapshot reapply exactly at `t === 1` — the same\n * \"commit at the end, restore what came before below it\" shape\n * `packages/components/code`'s `runTransition` uses.\n *\n * `_prepareStep` is called **lazily, on the command's first evaluation**, not\n * when this function runs — it snapshots each prop's `from` off the *live*\n * node, and a generator's body (what this replaces) never ran a line until the\n * caller's first `.next()` either. Building it eagerly would snapshot whatever\n * the node happened to hold at `restore()`-call time instead of at first-drive\n * time, which can differ if the caller does more to the node in between.\n */\n/** @internal */\nexport function restoreAnimated(\n host: ReactiveHost,\n layer: PropLayer | undefined,\n duration: number,\n easing?: EasingFunction,\n): Command<Record<string, never>> {\n let stepper: TweenStepper | null = null;\n\n return driveCommand(duration, (t) => {\n if (!stepper) {\n // `to()` reads each snapshot's resolved `value` (correct even for a\n // bound slot), so the node animates back to where it *was*.\n const target: Record<string, unknown> = {};\n if (layer) {\n for (const [key, snap] of layer) {\n target[key] = snap.value;\n }\n }\n stepper = host._prepareStep(target, duration);\n }\n stepper.seek(t * duration);\n if (layer && t >= 1) applySnapshotLayer(host, layer);\n }, easing);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-reactive.js","sourceRoot":"","sources":["../../../../src/components/trees/node/node-reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAgB,MAAM,iBAAiB,CAAC;AA2B7D;;;;GAIG;AACH,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAM,IAAkB,EAAE,KAAa,EAAE,OAA+B;IAChG,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAM,SAA2B,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7C,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACjB,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,KAAqB,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,CAAC,KAAK,CAAC,OAAO,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,MAAuC,CAAC,CAAC;IAC9F,CAAC;IACD,qGAAqG;IACrG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,CAAC,c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AAE,CAAC;QAC9B,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,gBAAgB;AAChB,MAAM,UAAU,eAAe,CAC3B,IAAkB,EAClB,KAA4B,EAC5B,QAAgB,EAChB,MAAuB;IAEvB,IAAI,OAAO,GAAwB,IAAI,CAAC;IAExC,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;QAChC,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,oEAAoE;YACpE,4DAA4D;YAC5D,MAAM,MAAM,GAA4B,EAAE,CAAC;YAC3C,IAAI,KAAK,EAAE,CAAC;gBACR,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;oBAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;gBAC7B,CAAC;YACL,CAAC;YACD,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC3B,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAAE,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,MAAM,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { PropSlot, PropSnapshot } from \"@/props/slot\";\nimport { ensureCells, PropHost, TweenFn } from \"@/props/host\";\nimport { EasingFunction } from \"@/tween/ease/type\";\nimport { driveCommand, type Command } from \"@/tween/command\";\nimport { TweenStepper } from \"@/tween/stepper\";\nimport { PropOptions } from \"@/attributes/properties/decorator\";\n\n/**\n * Companion implementation of {@link Node2D}'s property machinery and its\n * save/restore state stack. The bodies live here as free functions over a\n * narrow {@link ReactiveHost} so `node.ts` keeps only thin delegators (and the\n * hot-path `set`/`_writeProp`, which stay inline on the class). Mirrors the\n * existing `getPropSlot(host, name)` pattern in `props/host.ts`.\n */\n\n/**\n * The slice of a {@link Node2D} these helpers touch: the {@link PropHost} maps\n * plus the internal write/tween seams. `_writeProp` and `_prepareStep` remain\n * methods on `Node2D`; the helpers call back through them so subclass behaviour\n * and the inline hot path are preserved.\n */\n/** @internal */\nexport interface ReactiveHost extends PropHost {\n readonly id: string;\n _writeProp(field: string, value: unknown): void;\n _prepareStep(to: Record<string, unknown>, duration: number, easing?: EasingFunction): TweenStepper;\n /** LIFO stack of save() snapshot layers; owned as an instance field on Node2D. */\n _stateStack: Map<string, PropSnapshot<any>>[];\n}\n\n/**\n * Create the {@link PropSlot} for a freshly-declared prop, place it in its class's\n * `PropLayout` (whose prototype accessor routes writes through\n * `host._writeProp`) and register its tween/mapper metadata.\n */\n/** @internal */\nexport function registerProp<Int>(host: ReactiveHost, field: string, options?: PropOptions<any, Int>): void {\n const slot = new PropSlot<Int>(undefined as unknown as Int, host, field);\n const cells = ensureCells(host);\n cells.slots.set(field, slot);\n cells.list[cells.layout.place(field)] = slot;\n if (options?.tween) {\n (cells.tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\n }\n if (options?.mapper) {\n (cells.mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\n }\n // Something of the instance's own, or its class's, already answers to the name: shadow it as before.\n if (!cells.layout.serves(host, field)) {\n Object.defineProperty(host, field, {\n get: () => slot.get(),\n set: (value: any) => host._writeProp(field, value),\n enumerable: true,\n configurable: true,\n });\n }\n}\n\n/**\n * Apply (or re-apply) a prop's initial value plus optional tween/mapper. A first\n * call creates the cell via {@link registerProp}; a subsequent call for the same\n * field reuses the cell and only refines its tween/mapper (so a subclass can\n * override a parent default without losing the cell or its bindings), then\n * writes the value. Extracted from `Node2D.applyProp`.\n */\n/** @internal */\nexport function applyProp<Ext, Int = Ext>(\n host: ReactiveHost,\n field: string,\n initial: Ext | (() => Ext) | undefined,\n options?: PropOptions<Ext, Int>,\n): void {\n const existing = host.__cells?.slots.get(field);\n if (!existing) {\n registerProp<Int>(host, field, options);\n } else if (options) {\n // Allow subclasses to refine tween/mapper on an inherited field.\n if (options.tween) {\n (ensureCells(host).tweens ??= new Map()).set(field, options.tween as TweenFn<any>);\n }\n if (options.mapper) {\n (ensureCells(host).mappers ??= new Map()).set(field, options.mapper as (ext: any, prev?: any) => any);\n }\n }\n host._writeProp(field, initial);\n}\n\n/** Snapshot every registered prop's current value/binding into a plain object. */\n/** @internal */\nexport function collectProperties(host: ReactiveHost): Record<string, any> {\n const result: Record<string, any> = {};\n if (host.__cells) {\n for (const key of host.__cells.slots.keys()) {\n result[key] = (host as any)[key];\n }\n }\n return result;\n}\n\n// ---- State stack (save / restore) -----------------------------------------\n\n/**\n * Every declared prop of a node, captured as the value **or binding** its slot\n * holds — see {@link Node2D.captureProps}, which is the public way to make one.\n *\n * Keyed by prop name. Opaque on purpose: what a slot holds is the *mapped*,\n * internal form, and reading it out to write back through `set` is exactly the\n * round-trip a layer exists to avoid.\n */\nexport type PropLayer = Map<string, PropSnapshot<any>>;\n\n/** Snapshot every prop slot (value or binding) into a fresh layer. */\n/** @internal */\nexport function captureLayer(host: ReactiveHost): PropLayer {\n const layer: PropLayer = new Map();\n const slots = host.__cells?.slots;\n if (!slots) return layer;\n for (const [key, slot] of slots) {\n layer.set(key, slot.snapshot());\n }\n return layer;\n}\n\n/** Push a snapshot of every prop slot (value or binding) onto the stack. */\n/** @internal */\nexport function saveState(host: ReactiveHost): void {\n if (!host.__cells) return;\n host._stateStack.push(captureLayer(host));\n}\n\n/** Pop the top snapshot layer, or `undefined` if the stack is empty. */\n/** @internal */\nexport function popState(host: ReactiveHost): PropLayer | undefined {\n return host._stateStack.pop();\n}\n\n/** Instantly reapply a snapshot layer to every captured slot. */\n/** @internal */\nexport function applySnapshotLayer(host: ReactiveHost, layer: PropLayer): void {\n const slots = host.__cells?.slots;\n if (!slots) return;\n for (const [key, snap] of layer) {\n slots.get(key)?.restoreFrom(snap);\n }\n}\n\n/**\n * Animated restore: tween the numeric / custom-tweenable props toward their\n * saved resolved values, then reapply the full snapshot so bindings are\n * restored (not frozen at the tween's landing value) and non-tweened props snap.\n *\n * A {@link Command} rather than a generator: `_prepareStep`'s stepper already\n * drives the tween as a pure function of elapsed time, so `driveCommand` wraps\n * it directly and fires the snapshot reapply exactly at `t === 1` — the same\n * \"commit at the end, restore what came before below it\" shape\n * `packages/components/code`'s `runTransition` uses.\n *\n * `_prepareStep` is called **lazily, on the command's first evaluation**, not\n * when this function runs — it snapshots each prop's `from` off the *live*\n * node, and a generator's body (what this replaces) never ran a line until the\n * caller's first `.next()` either. Building it eagerly would snapshot whatever\n * the node happened to hold at `restore()`-call time instead of at first-drive\n * time, which can differ if the caller does more to the node in between.\n */\n/** @internal */\nexport function restoreAnimated(\n host: ReactiveHost,\n layer: PropLayer | undefined,\n duration: number,\n easing?: EasingFunction,\n): Command<Record<string, never>> {\n let stepper: TweenStepper | null = null;\n\n return driveCommand(duration, (t) => {\n if (!stepper) {\n // `to()` reads each snapshot's resolved `value` (correct even for a\n // bound slot), so the node animates back to where it *was*.\n const target: Record<string, unknown> = {};\n if (layer) {\n for (const [key, snap] of layer) {\n target[key] = snap.value;\n }\n }\n stepper = host._prepareStep(target, duration);\n }\n stepper.seek(t * duration);\n if (layer && t >= 1) applySnapshotLayer(host, layer);\n }, easing);\n}\n"]}
|
|
@@ -29,6 +29,14 @@ export declare const ALIGNMENT_KEYS: readonly string[];
|
|
|
29
29
|
* explicit root row may pass `undefined`.
|
|
30
30
|
*/
|
|
31
31
|
export declare function commandTraits(registry: Registry, spec: CommandSpec, target: NodeSpec | undefined): CommandTraits | null;
|
|
32
|
+
/**
|
|
33
|
+
* Whether a command with these traits, built, may be held at its end values once
|
|
34
|
+
* finished instead of run (`settled-index.ts`): the library's own implementation
|
|
35
|
+
* of a command whose `at` reads only what it captured when built. Expression args
|
|
36
|
+
* bind live values, so they keep it running. A component's own commands are
|
|
37
|
+
* marked by the factory instead, from their pieces.
|
|
38
|
+
*/
|
|
39
|
+
export declare function holdsWhenFinished(traits: CommandTraits | null, spec: CommandSpec): boolean;
|
|
32
40
|
/**
|
|
33
41
|
* The node ids a command's args name through a `nodeRef` argument — the nodes
|
|
34
42
|
* whose boxes it may read when it is built, beside its own target.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-traits.d.ts","sourceRoot":"","sources":["../../src/document/command-traits.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAwB,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGrD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC;IAC3B,oFAAoF;IACpF,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,WAAW,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,YAAY,EAAE,OAAO,CAAC;CACzB;AAED,0FAA0F;AAC1F,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAG3C,CAAC;AAIF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAqCvH;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,EAAE,CAY7G;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG3E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GA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,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,EAAE,CAY7G;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG3E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMlD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAO1F;AAED,8GAA8G;AAC9G,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGtF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAI9F"}
|
|
@@ -56,6 +56,17 @@ export function commandTraits(registry, spec, target) {
|
|
|
56
56
|
writesLayout: written === undefined || written.some((key) => !isLayoutNeutralProp(registry, row.type, key)),
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether a command with these traits, built, may be held at its end values once
|
|
61
|
+
* finished instead of run (`settled-index.ts`): the library's own implementation
|
|
62
|
+
* of a command whose `at` reads only what it captured when built. Expression args
|
|
63
|
+
* bind live values, so they keep it running. A component's own commands are
|
|
64
|
+
* marked by the factory instead, from their pieces.
|
|
65
|
+
*/
|
|
66
|
+
export function holdsWhenFinished(traits, spec) {
|
|
67
|
+
return traits !== null && traits.known && !traits.lifecycle && HELD.has(spec.type)
|
|
68
|
+
&& expressionOps.collect(spec.args ?? {}, "").length === 0;
|
|
69
|
+
}
|
|
59
70
|
/**
|
|
60
71
|
* The node ids a command's args name through a `nodeRef` argument — the nodes
|
|
61
72
|
* whose boxes it may read when it is built, beside its own target.
|
|
@@ -125,6 +136,12 @@ export function writesPlacementInPlace(registry, row, key) {
|
|
|
125
136
|
}
|
|
126
137
|
const LIFECYCLE = new Set(["removeChildAt", "addChildAt", "reparent"]);
|
|
127
138
|
const VARIABLE_COMMANDS = new Set(["variableTo", "variableSet"]);
|
|
139
|
+
// Known commands that are pure functions of `t`. A new one joins once `held-class-commands.test.ts` covers it.
|
|
140
|
+
const HELD = new Set([
|
|
141
|
+
"to", "set", "moveTo", "fadeTo", "rotateTo", "scaleTo", "layoutTo", "effectTo", "pulse", "wiggle",
|
|
142
|
+
"fillTo", "strokeTo", "shadowTo", "overlayTo", "progressTo", "zoomTo", "panTo", "headingTo",
|
|
143
|
+
"variableTo", "variableSet",
|
|
144
|
+
]);
|
|
128
145
|
const NEUTRAL_KEYS = new Set([
|
|
129
146
|
"x", "y", "rotation", "scale", "opacity", "fill", "stroke", "shadow", "overlay",
|
|
130
147
|
"effects", "blend", "transformOrigin", "zoom", "lookAt", "heading",
|