@hyperframes/studio 0.9.40 → 0.9.41
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/dist/assets/{codec-BPK_2CLL.js → codec-B_mpbc4w.js} +1 -1
- package/dist/assets/{hyperframes-player-D7qTTDIp.js → hyperframes-player-Dvi3I_mv.js} +1 -1
- package/dist/assets/{index-CdA00Ybn.js → index-B5ExwsOp.js} +146 -146
- package/dist/assets/{index-QS-DuxAU.js → index-BrFm9Y5k.js} +1 -1
- package/dist/assets/{pausedVideoDecoder-Byzz98Gb.js → pausedVideoDecoder-MHQ57yZ6.js} +1 -1
- package/dist/{chunk-KF6YVXJP.js → chunk-4QQMX4BX.js} +6 -3
- package/dist/{chunk-VZ5MD32A.js → chunk-GVW7AU57.js} +190 -254
- package/dist/{chunk-AV2PV7NE.js → chunk-VHV2ZDKY.js} +4 -40
- package/dist/{domEditingLayers-4KRREI5C.js → domEditingLayers-SA5KLSSS.js} +4 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.html +1 -1
- package/dist/index.js +898 -551
- package/dist/player.js +2 -2
- package/package.json +8 -8
- package/src/components/editor/DomEditOverlay.tsx +3 -15
- package/src/components/editor/clickAfterPreventedPress.test.tsx +17 -1
- package/src/components/editor/domEditOverlayBasis.ts +7 -2
- package/src/components/editor/domEditOverlayCrop.test.ts +1 -1
- package/src/components/editor/domEditOverlayCrop.ts +17 -3
- package/src/components/editor/domEditOverlayGeometry.ts +64 -139
- package/src/components/editor/domEditSelectionRules.ts +138 -0
- package/src/components/editor/domEditing.test.ts +6 -28
- package/src/components/editor/domEditingDom.preview.test.ts +3 -3
- package/src/components/editor/domEditingDom.ts +3 -76
- package/src/components/editor/domEditingElement.ts +19 -240
- package/src/components/editor/domEditingGroups.ts +0 -31
- package/src/components/editor/domEditingLayers.ts +95 -100
- package/src/components/editor/domEditingRootLayer.ts +35 -30
- package/src/components/editor/domEditingTypes.ts +4 -0
- package/src/components/editor/previewGestureStarts.ts +73 -10
- package/src/components/editor/previewOverlayRects.test.ts +316 -0
- package/src/components/editor/previewOverlayRects.ts +123 -0
- package/src/components/editor/previewPointerTargets.test.ts +260 -0
- package/src/components/editor/previewSelection.test.ts +481 -0
- package/src/components/editor/previewSelection.ts +472 -0
- package/src/components/editor/probeSourceElement.ts +19 -1
- package/src/components/editor/propertyPanelFill.tsx +5 -1
- package/src/components/editor/useDomEditOverlayRects.ts +80 -1
- package/src/components/editor/useInlineTextEditing.tsx +1 -6
- package/src/hooks/domSelectionTestHarness.ts +1 -1
- package/src/hooks/useDomEditSession.test.tsx +23 -1
- package/src/hooks/useDomEditSession.ts +2 -1
- package/src/hooks/useDomSelection.ts +61 -47
- package/src/hooks/useGsapSelectionHandlers.test.tsx +17 -0
- package/src/hooks/useGsapSelectionHandlers.ts +2 -1
- package/src/hooks/usePreviewInteraction.test.ts +10 -2
- package/src/hooks/usePreviewInteraction.ts +5 -4
- package/src/hooks/useStudioSelectionPublisher.test.tsx +50 -0
- package/src/hooks/useStudioSelectionPublisher.ts +9 -7
- package/src/player/lib/previewChannel.ts +4 -3
- package/src/player/lib/previewElements.ts +112 -3
- package/src/styles/hex-baseline.json +1 -2
- package/src/utils/studioHelpers.ts +0 -13
- package/src/utils/studioPreviewHelpers.test.ts +8 -8
- package/src/utils/studioPreviewHelpers.ts +26 -242
- package/src/components/editor/domEditOverlayTransform.ts +0 -126
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as Ht,m as Ke,I as qt,v as le,p as Di,t as oe,b as Ni,a as m,w as Hi,B as we,F as yt,c as ce,d as K,e as Rt,f as Qe,r as vs,g as As,h as Ms,i as Is,j as qi,k as _e,l as Oi,s as Fs,n as $i,o as Bs,q as Be,u as gt,x as Ki,y as Rs,U as Ot,R as Ws,z as ve,C as Oe,D as Qi,V as $e,P as je,E as Gi,G as $t,T as Kt,M as Qt,H as zs,J as Us,K as Vs,L as Ls,N as Ds,O as ji,Q as Xi,S as Ns,W as Yi,X as Ee,Y as Hs,Z as qs,_ as Xe,$ as Os,a0 as $s,a1 as Ks,a2 as Qs,a3 as Gs,a4 as Zi,a5 as ft,a6 as Ji,a7 as es,a8 as ts,a9 as is,aa as ss,ab as js,ac as rs,ad as as,ae as Xs,af as ns,ag as Ys,ah as ht,ai as Jt,aj as bt,ak as Zs,al as w,am as ei,an as Js,ao as er,ap as tr,aq as Me,ar as ir,as as ti,at as Je,au as sr,av as rr,aw as ar,ax as nr,ay as or,az as ii,aA as cr,aB as ur,aC as Y,aD as dr,aE as si,aF as os,aG as ri,aH as cs,aI as us,aJ as _t,aK as Wt,aL as ai,aM as ni,aN as lr,aO as mr,aP as fr,aQ as hr,aR as pr,aS as lt,aT as gr,aU as wr,aV as Tr,aW as oi,aX as yr,aY as br,aZ as _r,a_ as ci,a$ as ui,b0 as di,b1 as Ne,b2 as li,b3 as kr,b4 as Sr,b5 as zt,b6 as et,b7 as tt,b8 as it,b9 as Cr,ba as mt,bb as xr,bc as be,bd as Ut,be as Vt,bf as st,bg as Re,bh as Fe,bi as ke,bj as Ue,bk as Ye,bl as Pr,bm as Ve,bn as We,bo as kt,bp as Er,bq as mi,br as vr,bs as Ar,bt as Lt,bu as Dt,bv as Mr,bw as Ir,bx as Fr,by as Br,bz as ze,bA as rt,bB as fi,bC as Rr,bD as hi,bE as pi,bF as gi,bG as Wr,bH as zr,bI as Ur,bJ as Vr,bK as Lr,bL as Dr}from"./codec-
|
|
1
|
+
import{A as Ht,m as Ke,I as qt,v as le,p as Di,t as oe,b as Ni,a as m,w as Hi,B as we,F as yt,c as ce,d as K,e as Rt,f as Qe,r as vs,g as As,h as Ms,i as Is,j as qi,k as _e,l as Oi,s as Fs,n as $i,o as Bs,q as Be,u as gt,x as Ki,y as Rs,U as Ot,R as Ws,z as ve,C as Oe,D as Qi,V as $e,P as je,E as Gi,G as $t,T as Kt,M as Qt,H as zs,J as Us,K as Vs,L as Ls,N as Ds,O as ji,Q as Xi,S as Ns,W as Yi,X as Ee,Y as Hs,Z as qs,_ as Xe,$ as Os,a0 as $s,a1 as Ks,a2 as Qs,a3 as Gs,a4 as Zi,a5 as ft,a6 as Ji,a7 as es,a8 as ts,a9 as is,aa as ss,ab as js,ac as rs,ad as as,ae as Xs,af as ns,ag as Ys,ah as ht,ai as Jt,aj as bt,ak as Zs,al as w,am as ei,an as Js,ao as er,ap as tr,aq as Me,ar as ir,as as ti,at as Je,au as sr,av as rr,aw as ar,ax as nr,ay as or,az as ii,aA as cr,aB as ur,aC as Y,aD as dr,aE as si,aF as os,aG as ri,aH as cs,aI as us,aJ as _t,aK as Wt,aL as ai,aM as ni,aN as lr,aO as mr,aP as fr,aQ as hr,aR as pr,aS as lt,aT as gr,aU as wr,aV as Tr,aW as oi,aX as yr,aY as br,aZ as _r,a_ as ci,a$ as ui,b0 as di,b1 as Ne,b2 as li,b3 as kr,b4 as Sr,b5 as zt,b6 as et,b7 as tt,b8 as it,b9 as Cr,ba as mt,bb as xr,bc as be,bd as Ut,be as Vt,bf as st,bg as Re,bh as Fe,bi as ke,bj as Ue,bk as Ye,bl as Pr,bm as Ve,bn as We,bo as kt,bp as Er,bq as mi,br as vr,bs as Ar,bt as Lt,bu as Dt,bv as Mr,bw as Ir,bx as Fr,by as Br,bz as ze,bA as rt,bB as fi,bC as Rr,bD as hi,bE as pi,bF as gi,bG as Wr,bH as zr,bI as Ur,bJ as Vr,bK as Lr,bL as Dr}from"./codec-B_mpbc4w.js";import{bM as $n,bN as Kn,bO as Qn,bP as Gn,bQ as jn,bR as Xn,bS as Yn,bT as Zn,bU as Jn,bV as eo,bW as to,bX as io,bY as so,bZ as ro,b_ as ao,b$ as no,c0 as oo,c1 as co,c2 as uo,c3 as lo,c4 as mo,c5 as fo,c6 as ho,c7 as po,c8 as go,c9 as wo,ca as To,cb as yo,cc as bo,cd as _o,ce as ko,cf as So,cg as Co,ch as xo,ci as Po,cj as Eo,ck as vo,cl as Ao,cm as Mo,cn as Io,co as Fo,cp as Bo,cq as Ro,cr as Wo,cs as zo,ct as Uo,cu as Vo,cv as Lo,cw as Do,cx as No,cy as Ho,cz as qo,cA as Oo,cB as $o,cC as Ko,cD as Qo,cE as Go,cF as jo,cG as Xo,cH as Yo,cI as Zo,cJ as Jo,cK as ec,cL as tc,cM as ic,cN as sc,cO as rc,cP as ac,cQ as nc,cR as oc,cS as cc,cT as uc,cU as dc,cV as lc,cW as mc,cX as fc,cY as hc,cZ as pc,c_ as gc,c$ as wc,d0 as Tc,d1 as yc,d2 as bc,d3 as _c,d4 as kc,d5 as Sc,d6 as Cc,d7 as xc,d8 as Pc}from"./codec-B_mpbc4w.js";import{n as wi}from"./index-B5ExwsOp.js";/*!
|
|
2
2
|
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
3
3
|
*
|
|
4
4
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as V}from"./index-
|
|
1
|
+
import{l as V}from"./index-B5ExwsOp.js";import{bw as G,bN as K,cH as Q,bE as X}from"./codec-B_mpbc4w.js";const x=1e-5,k=1e-9,T=h=>!h.variableFrameRate&&(h.frameRate??0)>0;function Y(h,i){const{sourceLead:r,inputLead:l,timeResolution:w,frameRate:p=0}=i;if(!T(i))return Math.max(l,h-r+l)+k;const d=Math.max(0,Math.floor((h-r)*p+k)),f=l+d/p;return(w>0?Math.round(f*w)/w:f)+x}function J(h,i,r){const{frameRate:l=0,sourceLead:w,inputLead:p}=r,d=T(r)?Math.round((h-p)*l)/l+w:h-p+w,f=Math.min(i,d);return{timestamp:f,duration:Math.max(T(r)?1/l:0,i-f+x)}}const E=64*1024*1024,M=4,Z=.5,$=2e3;async function q(h,i){if(!h.transparent)return h.sink.getSample(i);let r=null;try{for await(const l of h.sink.samplesAtTimestamps([i]))r==null||r.close(),r=l;return r}catch(l){throw r==null||r.close(),l}}function ot(h){const i=new Map,r=new Map,l=new Map,w=new Map,p=new Map;let d=0,f=!1;const _=t=>{var o,n;let e=new URL(t,location.href).pathname;try{e=decodeURIComponent(e)}catch{}return(n=Object.entries(((o=h.contentWindow)==null?void 0:o.__HF_MEDIA_SOURCE_FACTS__)??{}).filter(([s])=>e.endsWith(s)).sort(([s],[a])=>a.length-s.length)[0])==null?void 0:n[1]},g=(t=E)=>{for(const[e,o]of p){if(d<=t)break;e.pins>0||(p.delete(e),o.cache.delete(e.timestamp),d-=e.bytes,e.image.close())}},v=async t=>{if(t.disposed)return;t.disposed=!0,clearTimeout(t.idleTimer),r.get(t.key)===t&&r.delete(t.key);const e=(async()=>{t.transparent&&await t.tail,t.cancelReads(),t.input.dispose(),await y(t).catch(()=>{});for(const o of t.cache.values())p.delete(o),d-=o.bytes,o.image.close();t.cache.clear(),t.canvas.width=t.canvas.height=0})();return t.transparent?new Promise((o,n)=>{const s=setTimeout(()=>{t.cancelReads(),o()},$);e.then(o,n).finally(()=>clearTimeout(s))}):e},P=t=>{clearTimeout(t.idleTimer),!(t.disposed||t.users>0||[...t.cache.values()].some(e=>e.pins>0))&&(t.idleTimer=setTimeout(()=>{t.users>0||[...t.cache.values()].some(e=>e.pins>0)||r.get(t.key)===t&&(i.delete(t.key),v(t))},1e4))},D=async t=>{const e=V("thumbnail"),o=new G({source:new Q(t,e),formats:K});l.set(o,e.cancelReads);try{const n=await o.getPrimaryVideoTrack();if(!n||f)throw new Error("Preview video unavailable");const[s,a,u,c,m,S,F,B,j]=await Promise.all([n.getDisplayWidth(),n.getDisplayHeight(),n.getFirstTimestamp(),n.getTimeResolution(),n.getSquarePixelWidth(),n.getSquarePixelHeight(),n.getRotation(),n.getFlip(),n.canBeTransparent()]),b=document.createElement("canvas");b.width=Math.max(1,Math.ceil(s));const z=F%180===0?m/S:S/m;return b.height=Math.max(1,Math.round(b.width/z)),{key:t,input:o,cancelReads:e.cancelReads,sink:new X(n),canvas:b,rotation:F,flip:B,width:s,height:a,lead:u,ticks:c,transparent:j,tail:Promise.resolve(),iterator:null,iteratorEnd:0,lastTime:-1/0,cache:new Map,users:0,disposed:!1}}catch(n){throw o.dispose(),e.cancelReads(),n}finally{l.delete(o)}},I=()=>{for(const[t]of i){if(i.size<M)break;const e=r.get(t);e&&e.users===0&&![...e.cache.values()].some(o=>o.pins>0)&&(i.delete(t),v(e))}if(i.size>=M)throw new Error("Preview decoder budget reached")},L=async t=>{const e=t;if((w.get(e)??0)>performance.now())throw new Error("Preview decoder cooling down");let o=i.get(e);o||(I(),o=D(t),i.set(e,o)),i.delete(e),i.set(e,o);let n;try{n=await o}catch(s){throw i.get(e)===o&&(i.delete(e),w.set(e,performance.now()+5e3)),s}if(f||n.disposed)throw new DOMException("Preview disposed","AbortError");return r.set(e,n),n.users++,clearTimeout(n.idleTimer),n},y=async t=>{const e=t.iterator;t.iterator=null,await(e==null?void 0:e.return())},R=(t,e)=>{if(e.throwIfAborted(),f||t.disposed)throw new Error("Preview disposed")},O=async(t,e,o)=>{for(t.iterator||(t.iteratorEnd=e+8,t.iterator=t.sink.samples(e,t.iteratorEnd));;){R(t,o);const n=await t.iterator.next();if(n.done)return null;const s=n.value;let a=!1;try{if(R(t,o),s.timestamp>e+1e-6)return null;if(a=s.timestamp+s.duration>e+1e-6,a)return s}finally{a||s.close()}}},A=(t,e)=>(e.pins++,p.delete(e),p.set(e,t),e),W=async(t,e,o,n,s)=>{const a=t.canvas.getContext("2d",{alpha:!0});if(!a)throw new Error("Preview canvas unavailable");a.clearRect(0,0,t.canvas.width,t.canvas.height),a.imageSmoothingQuality="high",e.drawWithFit(a,{fit:"fill",rotation:t.rotation,flip:t.flip});const u=await createImageBitmap(t.canvas);if(s.aborted||f||t.disposed)throw u.close(),s.throwIfAborted(),new Error("Preview disposed");const c={image:u,...J(e.timestamp,o,n),bytes:u.width*u.height*4,pins:1},m=t.cache.get(c.timestamp);if(m)return m.duration=Math.max(m.duration,c.duration),u.close(),A(t,m);if(g(E-c.bytes),d+c.bytes>E)throw u.close(),new Error("Preview frame budget reached");return t.cache.set(c.timestamp,c),p.set(c,t),d+=c.bytes,c},H=(t,e,o)=>!t.transparent&&!o.variableFrameRate&&(o.frameRate??0)>0&&e>t.lastTime+1e-6&&e-t.lastTime<=Z,N=async(t,e,o,n)=>{R(t,n);const s=[...t.cache.values()].find(m=>e>=m.timestamp-1e-6&&e<m.timestamp+m.duration-1e-6);if(s)return A(t,s);const a=Y(e,o),u=H(t,e,o);let c=null;try{if((!u||a>=t.iteratorEnd)&&await y(t),c=u?await O(t,a,n):null,c||(await y(t),c=await q(t,a)),!c)throw new Error("No preview frame at requested time");return R(t,n),t.lastTime=e,await W(t,c,e,o,n)}finally{c==null||c.close(),(n.aborted||f)&&await y(t).catch(()=>{})}},U=(t,e)=>{const o=_(t.source);return{frameRate:o==null?void 0:o.frameRate,variableFrameRate:o==null?void 0:o.variableFrameRate,sourceLead:e.lead,inputLead:e.lead,timeResolution:e.ticks}},C=async(t,e)=>{e.throwIfAborted();const o=t.source;if(!o)throw new Error("Preview source unavailable");const n=await L(o);try{const s=U(t,n),a=n.tail.then(()=>N(n,t.time,s,e));n.tail=a.then(()=>{},()=>{});const u=await a;let c=!1;return g(),{source:u.image,timestamp:u.timestamp,duration:u.duration,width:n.width,height:n.height,release(){c||(c=!0,u.pins--,g(),P(n))}}}finally{n.users--,P(n)}};return{async decode(t,e){if(f)throw new DOMException("Preview disposed","AbortError");if(new Set(t.map(({source:a})=>a)).size>M)throw new Error("Preview decoder budget reached");const o=await Promise.allSettled(t.map(a=>C(a,e))),n=o.find(a=>a.status==="rejected"),s=o.flatMap(a=>a.status==="fulfilled"?[a.value]:[]);if(n||f||e.aborted){for(const a of s)a.release();throw n?n.reason:new DOMException("Preview cancelled","AbortError")}return s},async suspend(){const t=[...i.values()].map(e=>e.then(v).catch(()=>{}));i.clear();for(const[e,o]of l)o(),e.dispose();await Promise.all(t)},dispose(){if(!f){f=!0;for(const[t,e]of l)e(),t.dispose();for(const t of i.values())t.then(v).catch(()=>{});i.clear(),w.clear()}}}}export{ot as createPausedVideoDecoder};
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
buildProjectApiPath,
|
|
6
6
|
splitTimelineElementKey,
|
|
7
7
|
studioApiFetch
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VHV2ZDKY.js";
|
|
9
9
|
|
|
10
10
|
// src/player/lib/time.ts
|
|
11
11
|
var STUDIO_PREVIEW_FPS = 30;
|
|
@@ -1765,8 +1765,9 @@ async function previewClipManifest(iframe) {
|
|
|
1765
1765
|
if (!Number.isFinite(durationInFrames)) return null;
|
|
1766
1766
|
return manifest;
|
|
1767
1767
|
}
|
|
1768
|
-
async function previewComputedStyles(iframe,
|
|
1769
|
-
const
|
|
1768
|
+
async function previewComputedStyles(iframe, target, properties) {
|
|
1769
|
+
const element = typeof target === "string" ? { selector: target } : { handle: target.handle };
|
|
1770
|
+
const reply = await previewRequest(iframe, "computed-styles", { ...element, properties });
|
|
1770
1771
|
const styles = reply?.styles;
|
|
1771
1772
|
if (typeof styles !== "object" || styles === null) return null;
|
|
1772
1773
|
const read = {};
|
|
@@ -2551,7 +2552,9 @@ export {
|
|
|
2551
2552
|
whileScriptWrites,
|
|
2552
2553
|
isPreviewChanging,
|
|
2553
2554
|
previewFrameOpaque,
|
|
2555
|
+
previewEditingClient,
|
|
2554
2556
|
setFrameLoopStart,
|
|
2557
|
+
previewRequest,
|
|
2555
2558
|
previewSeekPainted,
|
|
2556
2559
|
previewClipManifest,
|
|
2557
2560
|
previewComputedStyles,
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
buildProjectApiPath,
|
|
4
4
|
buildStableSelector,
|
|
5
5
|
escapeCssString,
|
|
6
|
-
findClosestByAttribute,
|
|
7
6
|
getCompositionSourceMapRevision,
|
|
8
7
|
getCuratedComputedStyles,
|
|
9
8
|
getDataAttributes,
|
|
@@ -19,7 +18,7 @@ import {
|
|
|
19
18
|
querySelectorAllSafely,
|
|
20
19
|
studioApiFetch,
|
|
21
20
|
withSelectorIndexPass
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VHV2ZDKY.js";
|
|
23
22
|
|
|
24
23
|
// src/components/editor/domEditingLayers.ts
|
|
25
24
|
import { isClipHiddenByRuntime, PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
|
|
@@ -69,6 +68,17 @@ function probeSourceElement(projectId, sourceFile, target) {
|
|
|
69
68
|
probes.push({ target, resolve });
|
|
70
69
|
});
|
|
71
70
|
}
|
|
71
|
+
async function existsInSourceFile(previous, element, sourceFile, target, options) {
|
|
72
|
+
const probeTarget = {};
|
|
73
|
+
if (target.id) probeTarget.id = target.id;
|
|
74
|
+
if (target.hfId) probeTarget.hfId = target.hfId;
|
|
75
|
+
if (target.selector) probeTarget.selector = target.selector;
|
|
76
|
+
if (target.selectorIndex != null) probeTarget.selectorIndex = target.selectorIndex;
|
|
77
|
+
const known = knownSourceAnswer(previous, element, sourceFile, probeTarget);
|
|
78
|
+
if (known !== void 0 || options.skipSourceProbe || !options.projectId) return known;
|
|
79
|
+
if (!target.id && !target.selector && !target.hfId) return known;
|
|
80
|
+
return probeSourceElement(options.projectId, sourceFile, probeTarget);
|
|
81
|
+
}
|
|
72
82
|
|
|
73
83
|
// src/components/editor/domEditingLayers.ts
|
|
74
84
|
import {
|
|
@@ -81,86 +91,80 @@ function groupScopedLayerRoots(root, activeGroupElement) {
|
|
|
81
91
|
const els = activeGroupElement?.isConnected ? Array.from(activeGroupElement.children) : [root];
|
|
82
92
|
return els.filter(isHtmlElement);
|
|
83
93
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
|
|
95
|
+
// src/components/editor/domEditSelectionRules.ts
|
|
96
|
+
var OUT_OF_SCOPE = -1;
|
|
97
|
+
var hasClass = (value, name) => (value ?? "").split(/[\t\n\f\r ]+/).includes(name);
|
|
98
|
+
function groupUnitIndex(chain, read, activeGroupIndex) {
|
|
99
|
+
const groups = chain.flatMap(
|
|
100
|
+
(node, index) => read.attr(node, "data-hf-group") === null ? [] : [index]
|
|
101
|
+
);
|
|
102
|
+
if (activeGroupIndex === null) return groups.at(-1) ?? null;
|
|
103
|
+
const at = groups.indexOf(activeGroupIndex);
|
|
104
|
+
if (at === -1) return OUT_OF_SCOPE;
|
|
105
|
+
return at > 0 ? groups[at - 1] : null;
|
|
106
|
+
}
|
|
107
|
+
function clipAncestorIndex(chain, read) {
|
|
108
|
+
for (let index = 0; index < chain.length; index += 1) {
|
|
109
|
+
const node = chain[index];
|
|
110
|
+
if (!hasClass(read.attr(node, "class"), "clip")) continue;
|
|
111
|
+
const isHost = read.attr(node, "data-composition-src") !== null || read.attr(node, "data-composition-file") !== null;
|
|
112
|
+
if (!isHost || index === 0) return index;
|
|
88
113
|
}
|
|
89
|
-
|
|
90
|
-
if (!activeGroupElement) {
|
|
91
|
-
const outermost = groups[groups.length - 1];
|
|
92
|
-
return outermost ? { kind: "unit", element: outermost } : { kind: "child" };
|
|
93
|
-
}
|
|
94
|
-
const idx = groups.indexOf(activeGroupElement);
|
|
95
|
-
if (idx === -1) return { kind: "out-of-scope" };
|
|
96
|
-
const nestedInside = groups[idx - 1];
|
|
97
|
-
return nestedInside ? { kind: "unit", element: nestedInside } : { kind: "child" };
|
|
98
|
-
})();
|
|
99
|
-
return result;
|
|
114
|
+
return null;
|
|
100
115
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
116
|
+
function selectionTargetIndex(chain, read, options) {
|
|
117
|
+
let start = options.exactTarget ? 0 : groupUnitIndex(chain, read, options.activeGroupIndex);
|
|
118
|
+
if (start === OUT_OF_SCOPE) start = groupUnitIndex(chain, read, null);
|
|
119
|
+
start ??= options.preferClipAncestor ? clipAncestorIndex(chain, read) ?? 0 : 0;
|
|
120
|
+
for (let index = start; index < chain.length; index += 1) {
|
|
121
|
+
const node = chain[index];
|
|
122
|
+
if (read.isDocumentRoot(node)) return null;
|
|
123
|
+
if (read.selector(node) || read.attr(node, "data-hf-id")?.trim()) return index;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
105
126
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
return true;
|
|
114
|
-
if (cs.borderWidth && parseFloat(cs.borderWidth) > 0 && cs.borderStyle !== "none") return true;
|
|
115
|
-
if (cs.boxShadow && cs.boxShadow !== "none") return true;
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
function isEmptyVisualContainer(el) {
|
|
119
|
-
const tag = el.tagName.toLowerCase();
|
|
120
|
-
if (VISUAL_LEAF_TAGS.has(tag)) return false;
|
|
121
|
-
if (hasVisualPresence(el)) return false;
|
|
122
|
-
const { children } = el;
|
|
123
|
-
if (children.length === 0) {
|
|
124
|
-
return (el.textContent ?? "").trim().length === 0;
|
|
127
|
+
function chainLocked(chain, read, index) {
|
|
128
|
+
return chain.slice(index).some((node) => read.attr(node, "data-timeline-locked") !== null);
|
|
129
|
+
}
|
|
130
|
+
function selectionLookups(selection) {
|
|
131
|
+
const lookups = [];
|
|
132
|
+
if (selection.hfId) {
|
|
133
|
+
lookups.push({ selector: `[data-hf-id="${escapeCssString(selection.hfId)}"]`, index: 0 });
|
|
125
134
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (VISUAL_LEAF_TAGS.has(child.tagName.toLowerCase())) return false;
|
|
130
|
-
if (isElementComputedVisible(child)) return false;
|
|
135
|
+
if (selection.id) lookups.push({ selector: `[id="${escapeCssString(selection.id)}"]`, index: 0 });
|
|
136
|
+
if (selection.selector) {
|
|
137
|
+
lookups.push({ selector: selection.selector, index: selection.selectorIndex ?? 0 });
|
|
131
138
|
}
|
|
132
|
-
return
|
|
139
|
+
return lookups;
|
|
133
140
|
}
|
|
134
|
-
function
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
"template",
|
|
151
|
-
"track",
|
|
152
|
-
"wbr"
|
|
153
|
-
]);
|
|
154
|
-
function isInspectableLayerElement(el) {
|
|
155
|
-
const tagName = el.tagName.toLowerCase();
|
|
156
|
-
if (DOM_LAYER_IGNORED_TAGS.has(tagName)) return false;
|
|
157
|
-
const computed = el.ownerDocument.defaultView?.getComputedStyle(el);
|
|
158
|
-
if (computed?.display === "none" || computed?.visibility === "hidden") return false;
|
|
159
|
-
return true;
|
|
141
|
+
function timelineElementLookup(element, options) {
|
|
142
|
+
const elementId = typeof element.id === "string" ? element.id : "";
|
|
143
|
+
const compositionSource = normalizeTimelineCompositionSource(element.compositionSrc) ?? options.compIdToSrc?.get(elementId);
|
|
144
|
+
const sourceFile = compositionSource ?? normalizeTimelineCompositionSource(element.sourceFile) ?? options.activeCompositionPath ?? "index.html";
|
|
145
|
+
const escapedElementId = escapeCssString(elementId);
|
|
146
|
+
const escapedCompositionSource = compositionSource ? escapeCssString(compositionSource) : null;
|
|
147
|
+
const selector = element.selector ?? (compositionSource ? `[data-composition-src="${escapedCompositionSource}"],[data-composition-file="${escapedCompositionSource}"],[data-composition-id="${escapedElementId}"]` : escapedElementId ? `[data-composition-id="${escapedElementId}"]` : void 0);
|
|
148
|
+
const target = selector || element.domId ? {
|
|
149
|
+
id: element.domId ?? void 0,
|
|
150
|
+
selector,
|
|
151
|
+
selectorIndex: element.selectorIndex,
|
|
152
|
+
sourceFile
|
|
153
|
+
} : null;
|
|
154
|
+
const hasExplicitDomTarget = Boolean(element.domId || element.selector || compositionSource);
|
|
155
|
+
const rootFallback = !options.isMasterView && !hasExplicitDomTarget && Boolean(options.activeCompositionPath);
|
|
156
|
+
return { target, sourceFile, rootFallback };
|
|
160
157
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
|
|
159
|
+
// src/components/editor/domEditingElement.ts
|
|
160
|
+
import {
|
|
161
|
+
isDomLayerElement,
|
|
162
|
+
isInspectableLayerElement,
|
|
163
|
+
resolveAllVisualDomEditTargets,
|
|
164
|
+
resolveLayerSelector
|
|
165
|
+
} from "@hyperframes/core/runtime/editing-port";
|
|
166
|
+
function isElementComputedVisible(el, memo) {
|
|
167
|
+
return isElementVisibleThroughAncestors(el, memo);
|
|
164
168
|
}
|
|
165
169
|
function resolveDomLayerIdentity(el, activeCompositionPath) {
|
|
166
170
|
const selector = resolveLayerSelector(el);
|
|
@@ -180,68 +184,13 @@ function resolveDomLayerIdentity(el, activeCompositionPath) {
|
|
|
180
184
|
sourceFile
|
|
181
185
|
};
|
|
182
186
|
}
|
|
183
|
-
function getDomLayerPatchTarget(el, activeCompositionPath) {
|
|
184
|
-
return isInspectableLayerElement(el) ? resolveDomLayerIdentity(el, activeCompositionPath) : null;
|
|
185
|
-
}
|
|
186
|
-
function isDomLayerElement(el) {
|
|
187
|
-
return isInspectableLayerElement(el) && resolveLayerSelector(el) !== void 0;
|
|
188
|
-
}
|
|
189
|
-
function getPreferredClipAncestor(startEl) {
|
|
190
|
-
let current = startEl;
|
|
191
|
-
while (current) {
|
|
192
|
-
if (current.classList.contains("clip")) {
|
|
193
|
-
const isCompositionHost = current.hasAttribute("data-composition-src") || current.hasAttribute("data-composition-file");
|
|
194
|
-
if (!isCompositionHost || current === startEl) return current;
|
|
195
|
-
}
|
|
196
|
-
current = current.parentElement;
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
function getSelectionCandidate(startEl, options) {
|
|
201
|
-
if (options.preferClipAncestor) {
|
|
202
|
-
const clipAncestor = getPreferredClipAncestor(startEl);
|
|
203
|
-
if (clipAncestor) {
|
|
204
|
-
return clipAncestor;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return startEl;
|
|
208
|
-
}
|
|
209
|
-
function resolveAllVisualDomEditTargets(elementsFromPoint, options) {
|
|
210
|
-
const raw = [];
|
|
211
|
-
for (const entry of elementsFromPoint) {
|
|
212
|
-
if (!isHtmlElement(entry)) continue;
|
|
213
|
-
if (hasRenderedBox(entry) && getDomLayerPatchTarget(entry, options.activeCompositionPath)) {
|
|
214
|
-
raw.push(entry);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (raw.length === 0) return [];
|
|
218
|
-
const layers = [];
|
|
219
|
-
let best = raw[0];
|
|
220
|
-
for (let i = 1; i < raw.length; i++) {
|
|
221
|
-
const el = raw[i];
|
|
222
|
-
if (best.contains(el)) {
|
|
223
|
-
best = el;
|
|
224
|
-
} else {
|
|
225
|
-
layers.push(best);
|
|
226
|
-
best = el;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
layers.push(best);
|
|
230
|
-
return layers;
|
|
231
|
-
}
|
|
232
187
|
function findElementForSelection(doc, selection, activeCompositionPath = null) {
|
|
233
188
|
const sourceMatches = (candidate) => isHtmlElement(candidate) && (!selection.sourceFile || getSourceFileForElement(candidate, activeCompositionPath).sourceFile === selection.sourceFile);
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (byHfId) return byHfId;
|
|
238
|
-
}
|
|
239
|
-
if (selection.id) {
|
|
240
|
-
const byId = findAll(`[id="${escapeCssString(selection.id)}"]`)[0];
|
|
241
|
-
if (byId) return byId;
|
|
189
|
+
for (const { selector, index } of selectionLookups(selection)) {
|
|
190
|
+
const found = querySelectorAllSafely(doc, selector).filter(sourceMatches)[index];
|
|
191
|
+
if (found) return found;
|
|
242
192
|
}
|
|
243
|
-
|
|
244
|
-
return findAll(selection.selector)[selection.selectorIndex ?? 0] ?? null;
|
|
193
|
+
return null;
|
|
245
194
|
}
|
|
246
195
|
function findPreviewNode(doc, el) {
|
|
247
196
|
if (!doc) return null;
|
|
@@ -249,29 +198,10 @@ function findPreviewNode(doc, el) {
|
|
|
249
198
|
return findElementForSelection(doc, el) ?? findElementForSelection(doc, { ...el, sourceFile: void 0 });
|
|
250
199
|
}
|
|
251
200
|
function findElementForTimelineElement(doc, element, options) {
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const escapedCompositionSource = compositionSource ? escapeCssString(compositionSource) : null;
|
|
257
|
-
const selector = element.selector ?? (compositionSource ? `[data-composition-src="${escapedCompositionSource}"],[data-composition-file="${escapedCompositionSource}"],[data-composition-id="${escapedElementId}"]` : escapedElementId ? `[data-composition-id="${escapedElementId}"]` : void 0);
|
|
258
|
-
if (selector || element.domId) {
|
|
259
|
-
const targetElement = findElementForSelection(
|
|
260
|
-
doc,
|
|
261
|
-
{
|
|
262
|
-
id: element.domId ?? void 0,
|
|
263
|
-
selector,
|
|
264
|
-
selectorIndex: element.selectorIndex,
|
|
265
|
-
sourceFile
|
|
266
|
-
},
|
|
267
|
-
options.activeCompositionPath
|
|
268
|
-
);
|
|
269
|
-
if (targetElement) return targetElement;
|
|
270
|
-
}
|
|
271
|
-
const hasExplicitDomTarget = Boolean(element.domId || element.selector || compositionSource);
|
|
272
|
-
if (options.isMasterView || hasExplicitDomTarget || !options.activeCompositionPath) {
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
201
|
+
const { target, sourceFile, rootFallback } = timelineElementLookup(element, options);
|
|
202
|
+
const found = target && findElementForSelection(doc, target, options.activeCompositionPath);
|
|
203
|
+
if (found) return found;
|
|
204
|
+
if (!rootFallback) return null;
|
|
275
205
|
const root = doc.querySelector("[data-composition-id]");
|
|
276
206
|
if (!isHtmlElement(root)) return null;
|
|
277
207
|
return getSourceFileForElement(root, options.activeCompositionPath).sourceFile === sourceFile ? root : null;
|
|
@@ -292,21 +222,16 @@ function readPositiveDimension(value) {
|
|
|
292
222
|
function approximatelyEqual(a, b) {
|
|
293
223
|
return Math.abs(a - b) <= COMPOSITION_ROOT_LAYER_EPSILON_PX;
|
|
294
224
|
}
|
|
295
|
-
function
|
|
296
|
-
|
|
297
|
-
const rootWidth = readPositiveDimension(root?.
|
|
298
|
-
const rootHeight = readPositiveDimension(root?.
|
|
299
|
-
if (!root || !rootWidth || !rootHeight) return
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const height = rect.height || parsePx(computedStyles.height);
|
|
306
|
-
return width && height ? { width, height } : null;
|
|
307
|
-
}
|
|
308
|
-
function matchesCompositionRootBounds(elementRect, elementSize, rootBounds) {
|
|
309
|
-
return approximatelyEqual(elementRect.left, rootBounds.rect.left) && approximatelyEqual(elementRect.top, rootBounds.rect.top) && approximatelyEqual(elementSize.width, rootBounds.width) && approximatelyEqual(elementSize.height, rootBounds.height);
|
|
225
|
+
function coversCompositionRoot(layer, root) {
|
|
226
|
+
if (isExplicitFullBleedLayer(layer.computedStyles)) return false;
|
|
227
|
+
const rootWidth = readPositiveDimension(root?.width ?? null);
|
|
228
|
+
const rootHeight = readPositiveDimension(root?.height ?? null);
|
|
229
|
+
if (!root || !rootWidth || !rootHeight) return false;
|
|
230
|
+
const width = layer.rect.width || parsePx(layer.computedStyles.width);
|
|
231
|
+
const height = layer.rect.height || parsePx(layer.computedStyles.height);
|
|
232
|
+
return Boolean(
|
|
233
|
+
width && height && approximatelyEqual(layer.rect.left, root.rect.left) && approximatelyEqual(layer.rect.top, root.rect.top) && approximatelyEqual(width, rootWidth) && approximatelyEqual(height, rootHeight)
|
|
234
|
+
);
|
|
310
235
|
}
|
|
311
236
|
function isExplicitFullBleedLayer(computedStyles) {
|
|
312
237
|
return computedStyles.position === "absolute" || computedStyles.position === "fixed";
|
|
@@ -314,11 +239,14 @@ function isExplicitFullBleedLayer(computedStyles) {
|
|
|
314
239
|
function isCompositionRootLayer(element, doc, computedStyles) {
|
|
315
240
|
if (element.parentElement !== doc.body) return false;
|
|
316
241
|
if (element.hasAttribute("data-hf-allow-root-edit")) return false;
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
242
|
+
const root = doc.querySelector("[data-composition-id]") ?? doc.documentElement ?? null;
|
|
243
|
+
return coversCompositionRoot(
|
|
244
|
+
{ rect: element.getBoundingClientRect(), computedStyles },
|
|
245
|
+
root && {
|
|
246
|
+
rect: root.getBoundingClientRect(),
|
|
247
|
+
width: root.getAttribute("data-width"),
|
|
248
|
+
height: root.getAttribute("data-height")
|
|
249
|
+
}
|
|
322
250
|
);
|
|
323
251
|
}
|
|
324
252
|
|
|
@@ -595,7 +523,7 @@ function domEditSelectionToFacts(selection, animationCount = selection.gsapAnima
|
|
|
595
523
|
hasEditableText: selection.textFields.length > 0,
|
|
596
524
|
hasTimingStart: selection.dataAttributes.start != null,
|
|
597
525
|
animationCount,
|
|
598
|
-
hasAudio: isAudibleVideoNode(selection.element)
|
|
526
|
+
hasAudio: selection.hasAudio ?? isAudibleVideoNode(selection.element)
|
|
599
527
|
};
|
|
600
528
|
}
|
|
601
529
|
function resolveDomEditCapabilities(args) {
|
|
@@ -616,82 +544,85 @@ function resolveDomEditCapabilities(args) {
|
|
|
616
544
|
async function resolveDomEditSelection(startEl, options) {
|
|
617
545
|
if (!startEl) return null;
|
|
618
546
|
const doc = startEl.ownerDocument;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
hasStableTarget: Boolean(selector || hfId),
|
|
655
|
-
tag: current.tagName.toLowerCase(),
|
|
656
|
-
inlineStyles,
|
|
657
|
-
computedStyles,
|
|
658
|
-
isCompositionHost: Boolean(compositionSrc),
|
|
659
|
-
isCompositionRoot,
|
|
660
|
-
isInsideLockedComposition: isInsideLocked,
|
|
661
|
-
isMasterView: options.isMasterView,
|
|
662
|
-
existsInSource: existsInSource ?? true
|
|
663
|
-
})
|
|
664
|
-
).capabilities;
|
|
665
|
-
const rect = current.getBoundingClientRect();
|
|
666
|
-
return {
|
|
667
|
-
element: current,
|
|
668
|
-
id: current.id || void 0,
|
|
669
|
-
hfId,
|
|
670
|
-
selector,
|
|
671
|
-
selectorIndex,
|
|
672
|
-
sourceFile,
|
|
673
|
-
compositionPath,
|
|
674
|
-
compositionSrc,
|
|
675
|
-
isCompositionHost: Boolean(compositionSrc),
|
|
676
|
-
isInsideLockedComposition: isInsideLocked,
|
|
677
|
-
label: buildElementLabel(current),
|
|
678
|
-
tagName: current.tagName.toLowerCase(),
|
|
679
|
-
boundingBox: {
|
|
680
|
-
x: rect.left,
|
|
681
|
-
y: rect.top,
|
|
682
|
-
width: rect.width,
|
|
683
|
-
height: rect.height
|
|
684
|
-
},
|
|
685
|
-
textContent: current.textContent?.trim() || null,
|
|
686
|
-
dataAttributes: getDataAttributes(current),
|
|
547
|
+
const chain = [];
|
|
548
|
+
for (let node = startEl; node; node = node.parentElement) chain.push(node);
|
|
549
|
+
const read = liveChainReader(doc);
|
|
550
|
+
const active = options.activeGroupElement ?? null;
|
|
551
|
+
const index = selectionTargetIndex(chain, read, {
|
|
552
|
+
exactTarget: options.exactTarget,
|
|
553
|
+
preferClipAncestor: options.preferClipAncestor,
|
|
554
|
+
activeGroupIndex: active ? chain.indexOf(active) : null
|
|
555
|
+
});
|
|
556
|
+
if (index === null) return null;
|
|
557
|
+
const current = chain[index];
|
|
558
|
+
const selector = buildStableSelector(current);
|
|
559
|
+
const hfId = readHfId(current);
|
|
560
|
+
const { sourceFile, compositionPath } = getSourceFileForElement(
|
|
561
|
+
current,
|
|
562
|
+
options.activeCompositionPath
|
|
563
|
+
);
|
|
564
|
+
const selectorIndex = selector ? getSelectorIndex(doc, current, selector, sourceFile, options.activeCompositionPath) : void 0;
|
|
565
|
+
const compositionSrc = current.getAttribute("data-composition-src") ?? current.getAttribute("data-composition-file") ?? void 0;
|
|
566
|
+
const inlineStyles = getInlineStyles(current);
|
|
567
|
+
const computedStyles = getCuratedComputedStyles(current);
|
|
568
|
+
const isCompositionRoot = current.hasAttribute("data-composition-id") && !compositionSrc || isCompositionRootLayer(current, doc, computedStyles);
|
|
569
|
+
const textFields = collectDomEditTextFields(current);
|
|
570
|
+
const isInsideLocked = chainLocked(chain, read, index);
|
|
571
|
+
const existsInSource = await existsInSourceFile(
|
|
572
|
+
options.previous,
|
|
573
|
+
current,
|
|
574
|
+
sourceFile,
|
|
575
|
+
{ id: current.id, hfId, selector, selectorIndex },
|
|
576
|
+
options
|
|
577
|
+
);
|
|
578
|
+
const capabilities = resolveEditingAffordances(
|
|
579
|
+
capabilityFacts({
|
|
580
|
+
hasStableTarget: Boolean(selector || hfId),
|
|
581
|
+
tag: current.tagName.toLowerCase(),
|
|
687
582
|
inlineStyles,
|
|
688
583
|
computedStyles,
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
584
|
+
isCompositionHost: Boolean(compositionSrc),
|
|
585
|
+
isCompositionRoot,
|
|
586
|
+
isInsideLockedComposition: isInsideLocked,
|
|
587
|
+
isMasterView: options.isMasterView,
|
|
588
|
+
existsInSource: existsInSource ?? true
|
|
589
|
+
})
|
|
590
|
+
).capabilities;
|
|
591
|
+
const rect = current.getBoundingClientRect();
|
|
592
|
+
return {
|
|
593
|
+
element: current,
|
|
594
|
+
id: current.id || void 0,
|
|
595
|
+
hfId,
|
|
596
|
+
selector,
|
|
597
|
+
selectorIndex,
|
|
598
|
+
sourceFile,
|
|
599
|
+
compositionPath,
|
|
600
|
+
compositionSrc,
|
|
601
|
+
isCompositionHost: Boolean(compositionSrc),
|
|
602
|
+
isInsideLockedComposition: isInsideLocked,
|
|
603
|
+
label: buildElementLabel(current),
|
|
604
|
+
tagName: current.tagName.toLowerCase(),
|
|
605
|
+
boundingBox: {
|
|
606
|
+
x: rect.left,
|
|
607
|
+
y: rect.top,
|
|
608
|
+
width: rect.width,
|
|
609
|
+
height: rect.height
|
|
610
|
+
},
|
|
611
|
+
textContent: current.textContent?.trim() || null,
|
|
612
|
+
dataAttributes: getDataAttributes(current),
|
|
613
|
+
inlineStyles,
|
|
614
|
+
computedStyles,
|
|
615
|
+
textFields,
|
|
616
|
+
capabilities,
|
|
617
|
+
existsInSource
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
function liveChainReader(doc) {
|
|
621
|
+
return {
|
|
622
|
+
attr: (el, name) => el.getAttribute(name),
|
|
623
|
+
selector: buildStableSelector,
|
|
624
|
+
isDocumentRoot: (el) => el === doc.body || el === doc.documentElement
|
|
625
|
+
};
|
|
695
626
|
}
|
|
696
627
|
async function refreshDomEditSelection(selection, activeCompositionPath) {
|
|
697
628
|
const doc = selection.element.ownerDocument;
|
|
@@ -816,12 +747,16 @@ function buildDomEditPatchTarget(selection) {
|
|
|
816
747
|
}
|
|
817
748
|
|
|
818
749
|
export {
|
|
750
|
+
selectionTargetIndex,
|
|
751
|
+
chainLocked,
|
|
752
|
+
selectionLookups,
|
|
753
|
+
timelineElementLookup,
|
|
819
754
|
isElementComputedVisible,
|
|
820
|
-
getDomLayerPatchTarget,
|
|
821
|
-
resolveAllVisualDomEditTargets,
|
|
822
755
|
findElementForSelection,
|
|
823
756
|
findPreviewNode,
|
|
824
757
|
findElementForTimelineElement,
|
|
758
|
+
existsInSourceFile,
|
|
759
|
+
coversCompositionRoot,
|
|
825
760
|
DOM_EDIT_LAYER_OBSERVER_INIT,
|
|
826
761
|
createDomEditLayerWalkCache,
|
|
827
762
|
drainPendingLayerMutations,
|
|
@@ -829,6 +764,7 @@ export {
|
|
|
829
764
|
serializeDomEditTextFields,
|
|
830
765
|
buildDefaultDomEditTextField,
|
|
831
766
|
buildTextFieldChildLocator,
|
|
767
|
+
capabilityFacts,
|
|
832
768
|
domEditSelectionToFacts,
|
|
833
769
|
resolveDomEditCapabilities,
|
|
834
770
|
resolveDomEditSelection,
|