hyperframes 0.8.145 → 0.8.147
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/{add-B6OUH46W.js → add-5CNUY3EW.js} +15 -15
- package/dist/{animatedGifPrep-MIWRDJIO.js → animatedGifPrep-ZID2XJRQ.js} +10 -10
- package/dist/{asset-XJ2B2PU3.js → asset-TFEENZ7K.js} +2 -2
- package/dist/{assetCataloger-A5ZLSCMZ.js → assetCataloger-GX4B55VB.js} +4 -4
- package/dist/{auth-5HOVCZMV.js → auth-EJVZW6C3.js} +2 -2
- package/dist/{autoUpdate-WVNL5K3D.js → autoUpdate-MBNEZ2U4.js} +2 -2
- package/dist/{backgroundChecks-IGF54SFH.js → backgroundChecks-DNW5NPTY.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-T6JEGCQV.js → batchRender-T7S2CGJE.js} +5 -5
- package/dist/{beats-37T6Y6QP.js → beats-STXBGN6Z.js} +16 -16
- package/dist/{benchmark-ZVVLOWPP.js → benchmark-AC6IGEQP.js} +12 -12
- package/dist/{browser-4SSJOLH4.js → browser-FB5AK32T.js} +5 -5
- package/dist/{bundleWithLocalizedFonts-XWK423QP.js → bundleWithLocalizedFonts-HSCWGCFO.js} +2 -2
- package/dist/{capture-KZXOPBMO.js → capture-I24MXH3Y.js} +13 -13
- package/dist/{capture-2SF7YP57.js → capture-VEIVUHWB.js} +2 -2
- package/dist/{catalog-NLD4A2C6.js → catalog-JRC4VTTI.js} +15 -15
- package/dist/{catch-up-4BSRN6IR.js → catch-up-NTCK7Z3G.js} +6 -6
- package/dist/{check-IA44QQWM.js → check-7M7W4LPN.js} +38 -38
- package/dist/{checkBrowser-VM35KZMW.js → checkBrowser-2YRVCAYB.js} +118 -61
- package/dist/{chunk-OTHDVXOJ.js → chunk-2IDHEEAN.js} +3 -3
- package/dist/{chunk-VHFEMFYL.js → chunk-3BETQ4XI.js} +3 -3
- package/dist/{chunk-3KU3PFDW.js → chunk-3BYMCR4O.js} +85 -75
- package/dist/{chunk-FXJJCPPB.js → chunk-3HSWLZ6S.js} +1 -1
- package/dist/{chunk-ZF7SXQJ7.js → chunk-3PPO64IB.js} +2 -2
- package/dist/{chunk-PLR7Z6TC.js → chunk-3YUFN37G.js} +1 -1
- package/dist/{chunk-GRY3PN3K.js → chunk-4YVMMRHR.js} +2 -2
- package/dist/{chunk-ICKDMTLA.js → chunk-55RZG5SQ.js} +2 -2
- package/dist/{chunk-3IBMBNYY.js → chunk-5OKZLMQK.js} +10 -10
- package/dist/{chunk-DIRJ322I.js → chunk-66SAATRI.js} +3 -3
- package/dist/{chunk-GMAJB2P6.js → chunk-6BSIQJPW.js} +1 -1
- package/dist/{chunk-4QWD6JYN.js → chunk-6WD636E5.js} +3 -3
- package/dist/{chunk-5WVW7P23.js → chunk-A72OAGNB.js} +6 -6
- package/dist/{chunk-XBX4QJP7.js → chunk-AFIATIKS.js} +1 -1
- package/dist/{chunk-G75ENCEZ.js → chunk-AIJS74LG.js} +3 -3
- package/dist/{chunk-FBCULCAL.js → chunk-AL2YEVOT.js} +1 -1
- package/dist/{chunk-GEMJYBRU.js → chunk-B45OFFOQ.js} +2 -2
- package/dist/{chunk-VRW6EBHV.js → chunk-BAKPN2D2.js} +101 -94
- package/dist/{chunk-HB7FJOY4.js → chunk-BPUFVVSH.js} +1 -1
- package/dist/{chunk-BIAC7IJT.js → chunk-DDNS2674.js} +1 -1
- package/dist/{chunk-QFSCCQIR.js → chunk-DMKI64EZ.js} +1 -1
- package/dist/{chunk-EPE2HRJK.js → chunk-DYWSCPCR.js} +69 -64
- package/dist/{chunk-ZIYZ77MR.js → chunk-EGO6Z24R.js} +3 -3
- package/dist/{chunk-KC5XXX3X.js → chunk-EOOEC32M.js} +1 -1
- package/dist/{chunk-XIHCMVMG.js → chunk-FDL4HV44.js} +2 -2
- package/dist/{chunk-QZ3AZTXI.js → chunk-FJWEYVEM.js} +42 -16
- package/dist/{chunk-PUGIRFPX.js → chunk-FMNVTKX2.js} +4 -4
- package/dist/{chunk-IHTRYDFN.js → chunk-H7B6JSHI.js} +1 -1
- package/dist/{chunk-T42U2W2R.js → chunk-IXLUTE6N.js} +1 -1
- package/dist/{chunk-FDT6KQV4.js → chunk-JBQJKC23.js} +2 -2
- package/dist/{chunk-IEIJRMLZ.js → chunk-JDB65PPT.js} +62 -63
- package/dist/{chunk-UXO2L7HJ.js → chunk-JF5L5SQ6.js} +278 -65
- package/dist/{chunk-USDEMXXL.js → chunk-JYVGYKXG.js} +1 -1
- package/dist/{chunk-R42WWQVB.js → chunk-KPJMBC4K.js} +2 -2
- package/dist/{chunk-MAYCCGMQ.js → chunk-KVGDFUVO.js} +1 -1
- package/dist/{chunk-CFUXNBWH.js → chunk-LE7T4ML7.js} +1 -1
- package/dist/{chunk-MQZVBHEY.js → chunk-LFNQDTSH.js} +1 -1
- package/dist/{chunk-KIFHYXPB.js → chunk-MOL32UKR.js} +45 -11
- package/dist/{chunk-6LGNTUZN.js → chunk-N53FLAMZ.js} +7 -7
- package/dist/{chunk-ADF3X6GM.js → chunk-P6HELLPU.js} +2 -2
- package/dist/{chunk-5NRXZGKK.js → chunk-POKK6XXU.js} +9 -9
- package/dist/{chunk-GBGJ7A3D.js → chunk-QHRPB2JQ.js} +6 -6
- package/dist/{chunk-BFACGEII.js → chunk-QTTDKWSM.js} +2 -2
- package/dist/{chunk-U5QY7KTN.js → chunk-SEABQTBP.js} +11 -8
- package/dist/{chunk-ZEUONDQG.js → chunk-SYUGVPYH.js} +1 -1
- package/dist/{chunk-PJ3HDUCY.js → chunk-VAS6HQX3.js} +39 -9
- package/dist/{chunk-GQJZORQP.js → chunk-XBSPQ52S.js} +1 -1
- package/dist/{chunk-4ORLNTET.js → chunk-XOJDBRNF.js} +1 -1
- package/dist/{chunk-LAFJSYDL.js → chunk-XVIYZU3D.js} +1 -1
- package/dist/{chunk-OB5MJR4W.js → chunk-YCGU3UNU.js} +1 -1
- package/dist/{chunk-GXJEGZL2.js → chunk-Z5C4LEAD.js} +17 -18
- package/dist/chunk-Z6FLHIDV.js +3795 -0
- package/dist/{chunk-DDIVWXN7.js → chunk-ZFN6GQU4.js} +4 -4
- package/dist/{chunk-QLSM7K5S.js → chunk-ZLL72U3I.js} +2 -2
- package/dist/{chunk-ZSVUAVMT.js → chunk-ZQXNL5DL.js} +5 -5
- package/dist/{chunk-DWUKJQTO.js → chunk-ZVZSFDW3.js} +2 -2
- package/dist/{clean-RDKJB5FK.js → clean-3RY3Y2GX.js} +23 -23
- package/dist/cli.js +52 -52
- package/dist/{cloud-QVPVVNCW.js → cloud-MLPBFCVE.js} +4 -4
- package/dist/{cloudrun-3RE2UCQG.js → cloudrun-NQF5KFQI.js} +6 -6
- package/dist/{compare-LEDOY7MO.js → compare-6EZX2754.js} +32 -32
- package/dist/{compiler-F54OZZPM.js → compiler-ACCPOZMQ.js} +6 -6
- package/dist/{component-N42M67WY.js → component-F5PQHP6A.js} +3 -3
- package/dist/{compositions-VB2J2LZI.js → compositions-AUHWSI2H.js} +15 -15
- package/dist/{delete-Q6RWMJ4Z.js → delete-VUF4SHHJ.js} +2 -2
- package/dist/{deterministicFonts-U2BIMGPG.js → deterministicFonts-C5JQLCTS.js} +2 -2
- package/dist/{dist-Q4BI5A73.js → dist-GPDOV3IQ.js} +4 -4
- package/dist/{dist-KDJTFJHA.js → dist-HUMFCJ6T.js} +3 -3
- package/dist/{doctor-JMMUHDRV.js → doctor-3XHCA5JM.js} +15 -15
- package/dist/{events-RGUAHIBW.js → events-FKOIB3R3.js} +5 -5
- package/dist/{events-6ZBSIBE5.js → events-TIU72LZM.js} +4 -4
- package/dist/{feedback-FIID6MZW.js → feedback-V6VATYBE.js} +10 -10
- package/dist/{ffmpeg-T5SH2EFJ.js → ffmpeg-5V4FP3R6.js} +2 -2
- package/dist/{figma-BL3JJC36.js → figma-YBJM2VGE.js} +3 -3
- package/dist/fontLocalizeCli.js +14 -14
- package/dist/{get-P46GS7S6.js → get-3YVCGZBX.js} +2 -2
- package/dist/{gpuPolicy-AQ2BPLBK.js → gpuPolicy-ZOUG66M7.js} +10 -10
- package/dist/{grade-compare-GDCWU7ZZ.js → grade-compare-MYXIRKQI.js} +33 -33
- package/dist/{help-HJR3RWFG.js → help-WFZ2SUUR.js} +2 -2
- package/dist/{history-GGO5AWJB.js → history-HWPRJFR5.js} +49 -22
- package/dist/hyperframe-runtime.js +214 -68
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +214 -68
- package/dist/hyperframes-player.global.js +4 -5
- package/dist/hyperframes-slideshow.global.js +3 -4
- package/dist/{info-3GFWUBJC.js → info-WJDTQ4OZ.js} +11 -11
- package/dist/{init-36OPU2ZG.js → init-EXHDN7RO.js} +31 -31
- package/dist/{inspect-F2HEL5ON.js → inspect-EAOLZOMQ.js} +33 -33
- package/dist/{installer-NI6P6GC4.js → installer-LZ4X5TZZ.js} +6 -6
- package/dist/{keyframes-7OY3LMAZ.js → keyframes-FSZYNEDN.js} +8 -8
- package/dist/{lambda-6GJIWNJ3.js → lambda-3GAKHMC3.js} +7 -7
- package/dist/{layout-FTMLNL5A.js → layout-M2TQ2CIX.js} +33 -33
- package/dist/{lint-U6POHUON.js → lint-7C5UPTNQ.js} +11 -11
- package/dist/{lintProject-UBZ3TDHU.js → lintProject-SSEXWCH6.js} +3 -3
- package/dist/{list-IP5KI5Q2.js → list-GU5KBZ73.js} +2 -2
- package/dist/{login-4VWTVPHG.js → login-ZL2NYBIZ.js} +4 -4
- package/dist/{manager-YKMHR6LN.js → manager-5ORDVWJB.js} +3 -3
- package/dist/{media-treatment-XGV44AGV.js → media-treatment-QC3TAHVU.js} +82 -54
- package/dist/{models-UCXB6UR5.js → models-A54I4QR5.js} +14 -14
- package/dist/{motionShot-WPVNBXKA.js → motionShot-ZXPK562F.js} +35 -29
- package/dist/{normalize-audio-TYJ3UEHO.js → normalize-audio-CAP3DAE6.js} +10 -10
- package/dist/{open-HENOLVB2.js → open-GUSBNMDB.js} +6 -6
- package/dist/{parakeetRunner-VFQ6WFTD.js → parakeetRunner-GCCH72CO.js} +14 -14
- package/dist/{pipeline-6WPSC3H4.js → pipeline-SCJ2MWYH.js} +11 -11
- package/dist/{play-OI53WNUM.js → play-FP2QLMGM.js} +26 -26
- package/dist/{preflight-B4AFK3RG.js → preflight-ONF5AJNO.js} +5 -5
- package/dist/{present-NGMEQ4NO.js → present-H5SA4APW.js} +23 -23
- package/dist/{preview-VT2HWRWZ.js → preview-ATPVKA6K.js} +57 -26
- package/dist/{producer-7TYEAUF7.js → producer-VBYUC27R.js} +1 -1
- package/dist/{projectConfig-B2AF5DXY.js → projectConfig-SBRMQZGG.js} +8 -8
- package/dist/{publication-2PANQVC6.js → publication-5BQICRZO.js} +4 -4
- package/dist/{publish-O5OL42BG.js → publish-XDUZA3E3.js} +27 -26
- package/dist/{remove-background-T2JM6UVP.js → remove-background-GA6F7JZW.js} +12 -12
- package/dist/{render-Z253WHBK.js → render-KUVZFNQD.js} +27 -27
- package/dist/{render-W7OFXDOJ.js → render-PCFO45RK.js} +5 -5
- package/dist/{render-OLPKOJRU.js → render-XCYXFZTL.js} +12 -12
- package/dist/{render-batch-46IIBFKL.js → render-batch-7R2NRNVJ.js} +5 -5
- package/dist/{renderCancellation-QTZOCDJ2.js → renderCancellation-NIXEWRAO.js} +10 -10
- package/dist/renderSetupWorker.js +3 -3
- package/dist/{resolver-J2PL5FVJ.js → resolver-C4FPX72I.js} +6 -6
- package/dist/{sherpa-ZF42V3RN.js → sherpa-IQY52XU6.js} +14 -14
- package/dist/skills/media-use/references/media-treatments.md +5 -1
- package/dist/{skills-ACDOO3PX.js → skills-JSSAEKUW.js} +7 -7
- package/dist/{skillsUpdateCheck-L5OXVVPU.js → skillsUpdateCheck-XE5E2K2F.js} +3 -3
- package/dist/{slideshow-4OJEPWNZ.js → slideshow-YTWATJRT.js} +1 -1
- package/dist/{snapshot-UUVNZOW5.js → snapshot-QMQOE2DD.js} +34 -34
- package/dist/{src-BSLKXEGX.js → src-2GMPFYHL.js} +11 -9
- package/dist/{src-KS3AWFGT.js → src-R55QLGWI.js} +13 -13
- package/dist/{staticProjectServer-2TTVGPQH.js → staticProjectServer-YH2RHYKW.js} +20 -20
- package/dist/{status-LXPGSSKY.js → status-PTKNQD2E.js} +2 -2
- package/dist/studio/assets/{hyperframes-player-DZ5JrMDg.js → hyperframes-player-_eMxRXF_.js} +3 -3
- package/dist/studio/assets/{index-BqFRhNZa.js → index-6okhHdnH.js} +1 -1
- package/dist/studio/assets/{index-BOs6C0aZ.js → index-CEq9KmY2.js} +1 -1
- package/dist/studio/assets/{index-D8W0a0Z9.js → index-bXzd7tvF.js} +135 -135
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-WYWF7XRC.js → studio-api-T2TS2CHL.js} +16 -14
- package/dist/{studioServer-3FG4YTP7.js → studioServer-Q4MT44LT.js} +50 -50
- package/dist/{system-OQLOGGPJ.js → system-OXRG57F2.js} +2 -2
- package/dist/{telemetry-PAOOB4T4.js → telemetry-V5JYZDS4.js} +5 -5
- package/dist/{timeline-JIIJKKPC.js → timeline-KTCTOKF5.js} +34 -25
- package/dist/{tokens-3QRAM75Z.js → tokens-ZHREZPK6.js} +2 -2
- package/dist/{transcribe-QSBP5MUG.js → transcribe-4QDEWCE6.js} +12 -12
- package/dist/{transcribe-SZB6UMXE.js → transcribe-CRAV4FU3.js} +13 -13
- package/dist/{updateCheck-V3DSB26K.js → updateCheck-E7RMSK3E.js} +2 -2
- package/dist/{upgrade-L5GISOEV.js → upgrade-27PFTDCV.js} +2 -2
- package/dist/{urlDownloader-52FERT4X.js → urlDownloader-EAF6PLUP.js} +9 -9
- package/dist/{validate-HVVLX7KO.js → validate-OKNFDBMG.js} +27 -27
- package/dist/{video-MEOWRMFG.js → video-IEVS4FIH.js} +10 -10
- package/package.json +3 -2
- package/dist/chunk-AUWHD7RA.js +0 -3753
- package/dist/studio/chunk-6JY3MTIX.js +0 -1204
- package/dist/studio/chunk-EEXSYY5F.js +0 -190
- package/dist/studio/chunk-NZPJUZKT.js +0 -1538
- package/dist/studio/chunk-PZ5AY32C.js +0 -10
- package/dist/studio/chunk-TP6D3U37.js +0 -845
- package/dist/studio/chunk-Y2OHHNM2.js +0 -970
- package/dist/studio/domEditingLayers-PTP2ICGM.js +0 -47
- package/dist/studio/index.css +0 -165
- package/dist/studio/index.d.ts +0 -4318
- package/dist/studio/index.js +0 -100952
- package/dist/studio/player.d.ts +0 -30
- package/dist/studio/player.js +0 -10
- package/dist/studio/styles/tailwind-preset.d.ts +0 -39
- package/dist/studio/styles/tailwind-preset.js +0 -50
- package/dist/studio/styles.css +0 -1
- package/dist/studio/ui.d.ts +0 -297
- package/dist/studio/ui.js +0 -66
|
@@ -1,845 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildElementLabel,
|
|
3
|
-
buildProjectApiPath,
|
|
4
|
-
buildStableSelector,
|
|
5
|
-
escapeCssString,
|
|
6
|
-
findClosestByAttribute,
|
|
7
|
-
getCompositionSourceMapRevision,
|
|
8
|
-
getCuratedComputedStyles,
|
|
9
|
-
getDataAttributes,
|
|
10
|
-
getInlineStyles,
|
|
11
|
-
getSelectorIndex,
|
|
12
|
-
getSourceFileForElement,
|
|
13
|
-
isAudibleVideoNode,
|
|
14
|
-
isEditableTextLeaf,
|
|
15
|
-
isElementVisibleThroughAncestors,
|
|
16
|
-
isHtmlElement,
|
|
17
|
-
normalizeTimelineCompositionSource,
|
|
18
|
-
parsePx,
|
|
19
|
-
querySelectorAllSafely,
|
|
20
|
-
studioApiFetch,
|
|
21
|
-
withSelectorIndexPass
|
|
22
|
-
} from "./chunk-6JY3MTIX.js";
|
|
23
|
-
|
|
24
|
-
// src/components/editor/domEditingLayers.ts
|
|
25
|
-
import { PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
|
|
26
|
-
|
|
27
|
-
// src/components/editor/probeSourceElement.ts
|
|
28
|
-
function knownSourceAnswer(previous, element, sourceFile, target) {
|
|
29
|
-
if (!previous || previous.element !== element || previous.sourceFile !== sourceFile) return;
|
|
30
|
-
const same = previous.id === target.id && previous.hfId === target.hfId && previous.selector === target.selector && previous.selectorIndex === target.selectorIndex;
|
|
31
|
-
return same ? previous.existsInSource : void 0;
|
|
32
|
-
}
|
|
33
|
-
var pending = /* @__PURE__ */ new Map();
|
|
34
|
-
async function sendBatch(projectId, sourceFile, probes) {
|
|
35
|
-
let exists = [];
|
|
36
|
-
try {
|
|
37
|
-
const response = await studioApiFetch(
|
|
38
|
-
buildProjectApiPath(
|
|
39
|
-
projectId,
|
|
40
|
-
`/file-mutations/probe-elements/${encodeURIComponent(sourceFile)}`
|
|
41
|
-
),
|
|
42
|
-
{
|
|
43
|
-
method: "POST",
|
|
44
|
-
headers: { "Content-Type": "application/json" },
|
|
45
|
-
body: JSON.stringify({ targets: probes.map((probe) => probe.target) })
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
if (response.ok) {
|
|
49
|
-
const data = await response.json();
|
|
50
|
-
if (Array.isArray(data?.exists)) exists = data.exists;
|
|
51
|
-
}
|
|
52
|
-
} catch {
|
|
53
|
-
}
|
|
54
|
-
probes.forEach((probe, index) => probe.resolve(exists[index] !== false));
|
|
55
|
-
}
|
|
56
|
-
function probeSourceElement(projectId, sourceFile, target) {
|
|
57
|
-
return new Promise((resolve) => {
|
|
58
|
-
const key = `${projectId}\0${sourceFile}`;
|
|
59
|
-
let probes = pending.get(key);
|
|
60
|
-
if (!probes) {
|
|
61
|
-
const batch = [];
|
|
62
|
-
probes = batch;
|
|
63
|
-
pending.set(key, batch);
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
pending.delete(key);
|
|
66
|
-
void sendBatch(projectId, sourceFile, batch);
|
|
67
|
-
}, 0);
|
|
68
|
-
}
|
|
69
|
-
probes.push({ target, resolve });
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/components/editor/domEditingLayers.ts
|
|
74
|
-
import {
|
|
75
|
-
resolveEditingAffordances,
|
|
76
|
-
resolveEditingSections
|
|
77
|
-
} from "@hyperframes/core/editing";
|
|
78
|
-
|
|
79
|
-
// src/components/editor/domEditingGroups.ts
|
|
80
|
-
function groupScopedLayerRoots(root, activeGroupElement) {
|
|
81
|
-
const els = activeGroupElement?.isConnected ? Array.from(activeGroupElement.children) : [root];
|
|
82
|
-
return els.filter(isHtmlElement);
|
|
83
|
-
}
|
|
84
|
-
function resolveGroupCapture(startEl, activeGroupElement) {
|
|
85
|
-
const groups = [];
|
|
86
|
-
for (let n = startEl; n; n = n.parentElement) {
|
|
87
|
-
if (n.hasAttribute("data-hf-group")) groups.push(n);
|
|
88
|
-
}
|
|
89
|
-
const result = (() => {
|
|
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;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// src/components/editor/domEditingElement.ts
|
|
103
|
-
function isElementComputedVisible(el, memo) {
|
|
104
|
-
return isElementVisibleThroughAncestors(el, memo);
|
|
105
|
-
}
|
|
106
|
-
var VISUAL_LEAF_TAGS = /* @__PURE__ */ new Set(["img", "video", "canvas", "svg", "audio"]);
|
|
107
|
-
function hasVisualPresence(el) {
|
|
108
|
-
const win = el.ownerDocument.defaultView;
|
|
109
|
-
if (!win) return false;
|
|
110
|
-
const cs = win.getComputedStyle(el);
|
|
111
|
-
if (cs.backgroundImage !== "none") return true;
|
|
112
|
-
if (cs.backgroundColor && cs.backgroundColor !== "transparent" && cs.backgroundColor !== "rgba(0, 0, 0, 0)")
|
|
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;
|
|
125
|
-
}
|
|
126
|
-
for (let i = 0; i < children.length; i += 1) {
|
|
127
|
-
const child = children[i];
|
|
128
|
-
if (!isHtmlElement(child)) continue;
|
|
129
|
-
if (VISUAL_LEAF_TAGS.has(child.tagName.toLowerCase())) return false;
|
|
130
|
-
if (isElementComputedVisible(child)) return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
function hasRenderedBox(el) {
|
|
135
|
-
const rect = el.getBoundingClientRect();
|
|
136
|
-
if (rect.width <= 1 || rect.height <= 1) return false;
|
|
137
|
-
if (!isElementComputedVisible(el)) return false;
|
|
138
|
-
if (isEmptyVisualContainer(el)) return false;
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
var DOM_LAYER_IGNORED_TAGS = /* @__PURE__ */ new Set([
|
|
142
|
-
"base",
|
|
143
|
-
"br",
|
|
144
|
-
"canvas",
|
|
145
|
-
"link",
|
|
146
|
-
"meta",
|
|
147
|
-
"script",
|
|
148
|
-
"source",
|
|
149
|
-
"style",
|
|
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;
|
|
160
|
-
}
|
|
161
|
-
function resolveLayerSelector(el) {
|
|
162
|
-
if (el.hasAttribute("data-composition-id")) return void 0;
|
|
163
|
-
return buildStableSelector(el);
|
|
164
|
-
}
|
|
165
|
-
function resolveDomLayerIdentity(el, activeCompositionPath) {
|
|
166
|
-
const selector = resolveLayerSelector(el);
|
|
167
|
-
if (!selector) return null;
|
|
168
|
-
const { sourceFile } = getSourceFileForElement(el, activeCompositionPath);
|
|
169
|
-
return {
|
|
170
|
-
id: el.id || void 0,
|
|
171
|
-
hfId: el.getAttribute("data-hf-id") || void 0,
|
|
172
|
-
selector,
|
|
173
|
-
selectorIndex: getSelectorIndex(
|
|
174
|
-
el.ownerDocument,
|
|
175
|
-
el,
|
|
176
|
-
selector,
|
|
177
|
-
sourceFile,
|
|
178
|
-
activeCompositionPath
|
|
179
|
-
),
|
|
180
|
-
sourceFile
|
|
181
|
-
};
|
|
182
|
-
}
|
|
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
|
-
function findElementForSelection(doc, selection, activeCompositionPath = null) {
|
|
233
|
-
const sourceMatches = (candidate) => isHtmlElement(candidate) && (!selection.sourceFile || getSourceFileForElement(candidate, activeCompositionPath).sourceFile === selection.sourceFile);
|
|
234
|
-
const findAll = (selector) => querySelectorAllSafely(doc, selector).filter(sourceMatches);
|
|
235
|
-
if (selection.hfId) {
|
|
236
|
-
const byHfId = findAll(`[data-hf-id="${escapeCssString(selection.hfId)}"]`)[0];
|
|
237
|
-
if (byHfId) return byHfId;
|
|
238
|
-
}
|
|
239
|
-
if (selection.id) {
|
|
240
|
-
const byId = findAll(`[id="${escapeCssString(selection.id)}"]`)[0];
|
|
241
|
-
if (byId) return byId;
|
|
242
|
-
}
|
|
243
|
-
if (!selection.selector) return null;
|
|
244
|
-
return findAll(selection.selector)[selection.selectorIndex ?? 0] ?? null;
|
|
245
|
-
}
|
|
246
|
-
function findPreviewNode(doc, el) {
|
|
247
|
-
if (!doc) return null;
|
|
248
|
-
if (el.element?.isConnected && el.element.ownerDocument === doc) return el.element;
|
|
249
|
-
return findElementForSelection(doc, el) ?? findElementForSelection(doc, { ...el, sourceFile: void 0 });
|
|
250
|
-
}
|
|
251
|
-
function findElementForTimelineElement(doc, element, options) {
|
|
252
|
-
const elementId = typeof element.id === "string" ? element.id : "";
|
|
253
|
-
const compositionSource = normalizeTimelineCompositionSource(element.compositionSrc) ?? options.compIdToSrc?.get(elementId);
|
|
254
|
-
const sourceFile = compositionSource ?? normalizeTimelineCompositionSource(element.sourceFile) ?? options.activeCompositionPath ?? "index.html";
|
|
255
|
-
const escapedElementId = escapeCssString(elementId);
|
|
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
|
-
}
|
|
275
|
-
const root = doc.querySelector("[data-composition-id]");
|
|
276
|
-
if (!isHtmlElement(root)) return null;
|
|
277
|
-
return getSourceFileForElement(root, options.activeCompositionPath).sourceFile === sourceFile ? root : null;
|
|
278
|
-
}
|
|
279
|
-
function getDirectLayerChildren(el) {
|
|
280
|
-
return Array.from(el.children).filter(
|
|
281
|
-
(child) => isHtmlElement(child) && isDomLayerElement(child)
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// src/components/editor/domEditingRootLayer.ts
|
|
286
|
-
var COMPOSITION_ROOT_LAYER_EPSILON_PX = 1;
|
|
287
|
-
function readPositiveDimension(value) {
|
|
288
|
-
if (!value) return null;
|
|
289
|
-
const parsed = Number.parseFloat(value);
|
|
290
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
291
|
-
}
|
|
292
|
-
function approximatelyEqual(a, b) {
|
|
293
|
-
return Math.abs(a - b) <= COMPOSITION_ROOT_LAYER_EPSILON_PX;
|
|
294
|
-
}
|
|
295
|
-
function getCompositionRootBounds(doc) {
|
|
296
|
-
const root = doc.querySelector("[data-composition-id]") ?? doc.documentElement ?? null;
|
|
297
|
-
const rootWidth = readPositiveDimension(root?.getAttribute("data-width") ?? null);
|
|
298
|
-
const rootHeight = readPositiveDimension(root?.getAttribute("data-height") ?? null);
|
|
299
|
-
if (!root || !rootWidth || !rootHeight) return null;
|
|
300
|
-
return { rect: root.getBoundingClientRect(), width: rootWidth, height: rootHeight };
|
|
301
|
-
}
|
|
302
|
-
function getRenderedLayerSize(element, computedStyles) {
|
|
303
|
-
const rect = element.getBoundingClientRect();
|
|
304
|
-
const width = rect.width || parsePx(computedStyles.width);
|
|
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);
|
|
310
|
-
}
|
|
311
|
-
function isExplicitFullBleedLayer(computedStyles) {
|
|
312
|
-
return computedStyles.position === "absolute" || computedStyles.position === "fixed";
|
|
313
|
-
}
|
|
314
|
-
function isCompositionRootLayer(element, doc, computedStyles) {
|
|
315
|
-
if (element.parentElement !== doc.body) return false;
|
|
316
|
-
if (element.hasAttribute("data-hf-allow-root-edit")) return false;
|
|
317
|
-
if (isExplicitFullBleedLayer(computedStyles)) return false;
|
|
318
|
-
const rootBounds = getCompositionRootBounds(doc);
|
|
319
|
-
const elementSize = getRenderedLayerSize(element, computedStyles);
|
|
320
|
-
return Boolean(
|
|
321
|
-
rootBounds && elementSize && matchesCompositionRootBounds(element.getBoundingClientRect(), elementSize, rootBounds)
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// src/components/editor/domEditLayerWalkCache.ts
|
|
326
|
-
var SELECTOR_IDENTITY_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
327
|
-
"id",
|
|
328
|
-
"class",
|
|
329
|
-
"data-hf-group",
|
|
330
|
-
"data-composition-id",
|
|
331
|
-
"data-composition-file",
|
|
332
|
-
"data-composition-src",
|
|
333
|
-
"data-hf-original-composition-id"
|
|
334
|
-
]);
|
|
335
|
-
var DOM_EDIT_LAYER_OBSERVER_INIT = {
|
|
336
|
-
attributes: true,
|
|
337
|
-
characterData: true,
|
|
338
|
-
childList: true,
|
|
339
|
-
subtree: true
|
|
340
|
-
};
|
|
341
|
-
var lastInlineVisibility = /* @__PURE__ */ new WeakMap();
|
|
342
|
-
function inlineVisibilityChanged(el) {
|
|
343
|
-
const next = el.style.visibility;
|
|
344
|
-
if (lastInlineVisibility.get(el) === next) return false;
|
|
345
|
-
lastInlineVisibility.set(el, next);
|
|
346
|
-
return true;
|
|
347
|
-
}
|
|
348
|
-
function createDomEditLayerWalkCache() {
|
|
349
|
-
let presence = /* @__PURE__ */ new WeakMap();
|
|
350
|
-
let identities = /* @__PURE__ */ new WeakMap();
|
|
351
|
-
let scope = null;
|
|
352
|
-
const invalidateAll = () => {
|
|
353
|
-
presence = /* @__PURE__ */ new WeakMap();
|
|
354
|
-
identities = /* @__PURE__ */ new WeakMap();
|
|
355
|
-
};
|
|
356
|
-
const drop = (el) => {
|
|
357
|
-
if (el) presence.delete(el);
|
|
358
|
-
};
|
|
359
|
-
const dropSubtree = (el) => {
|
|
360
|
-
for (const descendant of el.querySelectorAll("*")) {
|
|
361
|
-
if (isHtmlElement(descendant)) presence.delete(descendant);
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
const ingestOne = (record) => {
|
|
365
|
-
if (record.type === "childList") return false;
|
|
366
|
-
if (record.type === "characterData") {
|
|
367
|
-
for (let ancestor = record.target.parentElement; ancestor; ancestor = ancestor.parentElement) {
|
|
368
|
-
identities.delete(ancestor);
|
|
369
|
-
}
|
|
370
|
-
return true;
|
|
371
|
-
}
|
|
372
|
-
const target = record.target;
|
|
373
|
-
if (!isHtmlElement(target)) return true;
|
|
374
|
-
if (record.attributeName && SELECTOR_IDENTITY_ATTRIBUTES.has(record.attributeName))
|
|
375
|
-
return false;
|
|
376
|
-
drop(target);
|
|
377
|
-
drop(target.parentElement);
|
|
378
|
-
if (record.attributeName === "style" && inlineVisibilityChanged(target)) dropSubtree(target);
|
|
379
|
-
return true;
|
|
380
|
-
};
|
|
381
|
-
return {
|
|
382
|
-
beginWalk(activeCompositionPath) {
|
|
383
|
-
const nextScope = `${activeCompositionPath ?? ""}|${getCompositionSourceMapRevision()}`;
|
|
384
|
-
if (nextScope === scope) return;
|
|
385
|
-
scope = nextScope;
|
|
386
|
-
invalidateAll();
|
|
387
|
-
},
|
|
388
|
-
readInspectable(el, compute) {
|
|
389
|
-
const memo = presence.get(el) ?? {};
|
|
390
|
-
if (memo.inspectable === void 0) {
|
|
391
|
-
memo.inspectable = compute();
|
|
392
|
-
presence.set(el, memo);
|
|
393
|
-
}
|
|
394
|
-
return memo.inspectable;
|
|
395
|
-
},
|
|
396
|
-
readChildCount(el, compute) {
|
|
397
|
-
const memo = presence.get(el) ?? {};
|
|
398
|
-
if (memo.childCount === void 0) {
|
|
399
|
-
memo.childCount = compute();
|
|
400
|
-
presence.set(el, memo);
|
|
401
|
-
}
|
|
402
|
-
return memo.childCount;
|
|
403
|
-
},
|
|
404
|
-
readIdentity(el, compute) {
|
|
405
|
-
const memo = identities.get(el) ?? {};
|
|
406
|
-
if (memo.identity === void 0) {
|
|
407
|
-
memo.identity = compute();
|
|
408
|
-
identities.set(el, memo);
|
|
409
|
-
}
|
|
410
|
-
return memo.identity;
|
|
411
|
-
},
|
|
412
|
-
readLabel(el, compute) {
|
|
413
|
-
const memo = identities.get(el) ?? {};
|
|
414
|
-
if (memo.label === void 0) {
|
|
415
|
-
memo.label = compute();
|
|
416
|
-
identities.set(el, memo);
|
|
417
|
-
}
|
|
418
|
-
return memo.label;
|
|
419
|
-
},
|
|
420
|
-
ingest(records) {
|
|
421
|
-
for (const record of records) {
|
|
422
|
-
if (!ingestOne(record)) {
|
|
423
|
-
invalidateAll();
|
|
424
|
-
return;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
invalidateAll
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
function readDomEditLayerWalkEntry(el, activeCompositionPath, cache) {
|
|
432
|
-
const inspectable = cache ? cache.readInspectable(el, () => isInspectableLayerElement(el)) : isInspectableLayerElement(el);
|
|
433
|
-
if (!inspectable) return null;
|
|
434
|
-
const identity = () => resolveDomLayerIdentity(el, activeCompositionPath);
|
|
435
|
-
const target = cache ? cache.readIdentity(el, identity) : identity();
|
|
436
|
-
if (!target) return null;
|
|
437
|
-
const label = () => buildElementLabel(el);
|
|
438
|
-
const childCount = () => getDirectLayerChildren(el).length;
|
|
439
|
-
return {
|
|
440
|
-
target,
|
|
441
|
-
label: cache ? cache.readLabel(el, label) : label(),
|
|
442
|
-
childCount: cache ? cache.readChildCount(el, childCount) : childCount()
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
function drainPendingLayerMutations(observer, cache) {
|
|
446
|
-
if (!observer) return;
|
|
447
|
-
cache.ingest(observer.takeRecords());
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// src/components/editor/domEditingLayers.ts
|
|
451
|
-
function sameTagChildIndex(el) {
|
|
452
|
-
let index = 0;
|
|
453
|
-
let sibling = el.previousElementSibling;
|
|
454
|
-
while (sibling) {
|
|
455
|
-
if (sibling.tagName === el.tagName) index += 1;
|
|
456
|
-
sibling = sibling.previousElementSibling;
|
|
457
|
-
}
|
|
458
|
-
return index;
|
|
459
|
-
}
|
|
460
|
-
function getTextFieldLabel(_tagName, index, total, source) {
|
|
461
|
-
if (source === "self" || total === 1) return "Content";
|
|
462
|
-
return `Text ${index + 1}`;
|
|
463
|
-
}
|
|
464
|
-
var NOT_COPIED_ATTRS = /* @__PURE__ */ new Set(["style", ...PREVIEW_ONLY_ATTRS]);
|
|
465
|
-
function buildTextField(el, index, total, source, sourceChildIndex) {
|
|
466
|
-
const tagName = el.tagName.toLowerCase();
|
|
467
|
-
const key = el.getAttribute("data-hf-text-key") ?? `${source}:${index}:${tagName}`;
|
|
468
|
-
return {
|
|
469
|
-
key,
|
|
470
|
-
label: getTextFieldLabel(tagName, index, total, source),
|
|
471
|
-
value: el.textContent ?? "",
|
|
472
|
-
tagName,
|
|
473
|
-
attributes: Array.from(el.attributes).filter((attribute) => !NOT_COPIED_ATTRS.has(attribute.name)).map((attribute) => ({
|
|
474
|
-
name: attribute.name,
|
|
475
|
-
value: attribute.value
|
|
476
|
-
})),
|
|
477
|
-
inlineStyles: getInlineStyles(el),
|
|
478
|
-
computedStyles: getCuratedComputedStyles(el),
|
|
479
|
-
source,
|
|
480
|
-
...sourceChildIndex == null ? {} : { sourceChildIndex }
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
function collectDomEditTextFields(el) {
|
|
484
|
-
const childElements = Array.from(el.children).filter(isHtmlElement).filter(isEditableTextLeaf);
|
|
485
|
-
if (childElements.length > 0) {
|
|
486
|
-
const hasMixedContent = Array.from(el.childNodes).some(
|
|
487
|
-
(node) => node.nodeType === 3 && node.textContent?.trim()
|
|
488
|
-
);
|
|
489
|
-
if (hasMixedContent) {
|
|
490
|
-
const fields = [];
|
|
491
|
-
let childIdx = 0;
|
|
492
|
-
for (const node of el.childNodes) {
|
|
493
|
-
if (node.nodeType === 3) {
|
|
494
|
-
const text = node.textContent ?? "";
|
|
495
|
-
if (!text.trim()) continue;
|
|
496
|
-
fields.push({
|
|
497
|
-
key: `text-node:${childIdx}`,
|
|
498
|
-
label: `Text ${childIdx + 1}`,
|
|
499
|
-
value: text,
|
|
500
|
-
tagName: "#text",
|
|
501
|
-
attributes: [],
|
|
502
|
-
inlineStyles: {},
|
|
503
|
-
computedStyles: {},
|
|
504
|
-
source: "text-node"
|
|
505
|
-
});
|
|
506
|
-
childIdx++;
|
|
507
|
-
} else if (isHtmlElement(node) && isEditableTextLeaf(node)) {
|
|
508
|
-
fields.push(
|
|
509
|
-
buildTextField(node, childIdx, childElements.length, "child", sameTagChildIndex(node))
|
|
510
|
-
);
|
|
511
|
-
childIdx++;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return fields;
|
|
515
|
-
}
|
|
516
|
-
return childElements.map(
|
|
517
|
-
(child, index) => buildTextField(child, index, childElements.length, "child", sameTagChildIndex(child))
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
if (isEditableTextLeaf(el)) {
|
|
521
|
-
return [buildTextField(el, 0, 1, "self")];
|
|
522
|
-
}
|
|
523
|
-
return [];
|
|
524
|
-
}
|
|
525
|
-
function escapeHtmlText(value) {
|
|
526
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
527
|
-
}
|
|
528
|
-
function serializeTextFieldStyle(field) {
|
|
529
|
-
const entries = Object.entries(field.inlineStyles).filter(([, value]) => Boolean(value));
|
|
530
|
-
if (entries.length === 0) return "";
|
|
531
|
-
return entries.map(([key, value]) => `${key}: ${value}`).join("; ");
|
|
532
|
-
}
|
|
533
|
-
function serializeDomEditTextFields(fields) {
|
|
534
|
-
return fields.filter((field) => field.source === "child" || field.source === "text-node").map((field) => {
|
|
535
|
-
if (field.source === "text-node") {
|
|
536
|
-
return escapeHtmlText(field.value);
|
|
537
|
-
}
|
|
538
|
-
const attrs = [
|
|
539
|
-
...field.attributes.filter((attribute) => attribute.name !== "data-hf-text-key"),
|
|
540
|
-
{ name: "data-hf-text-key", value: field.key }
|
|
541
|
-
].map((attribute) => ` ${attribute.name}="${attribute.value.replace(/"/g, """)}"`).join("");
|
|
542
|
-
const style = serializeTextFieldStyle(field);
|
|
543
|
-
const styleAttr = style ? ` style="${style.replace(/"/g, """)}"` : "";
|
|
544
|
-
return `<${field.tagName}${attrs}${styleAttr}>${escapeHtmlText(field.value)}</${field.tagName}>`;
|
|
545
|
-
}).join("");
|
|
546
|
-
}
|
|
547
|
-
function buildDefaultDomEditTextField(base) {
|
|
548
|
-
return {
|
|
549
|
-
key: `child:new:${Date.now()}`,
|
|
550
|
-
label: "Text",
|
|
551
|
-
value: "New text",
|
|
552
|
-
tagName: "span",
|
|
553
|
-
attributes: [],
|
|
554
|
-
inlineStyles: {
|
|
555
|
-
"font-family": base?.computedStyles?.["font-family"] ?? "inherit",
|
|
556
|
-
"font-size": base?.computedStyles?.["font-size"] ?? "16px",
|
|
557
|
-
"font-weight": base?.computedStyles?.["font-weight"] ?? "400",
|
|
558
|
-
color: base?.computedStyles?.color ?? "inherit"
|
|
559
|
-
},
|
|
560
|
-
computedStyles: {},
|
|
561
|
-
source: "child"
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
function buildTextFieldChildLocator(fields, fieldKey) {
|
|
565
|
-
const field = fields.find((candidate) => candidate.key === fieldKey);
|
|
566
|
-
if (!field || field.source !== "child") return null;
|
|
567
|
-
if (field.sourceChildIndex == null) return null;
|
|
568
|
-
return {
|
|
569
|
-
childSelector: `:scope > ${field.tagName}`,
|
|
570
|
-
childIndex: field.sourceChildIndex
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
function capabilityFacts(geometry) {
|
|
574
|
-
return {
|
|
575
|
-
...geometry,
|
|
576
|
-
hasEditableText: false,
|
|
577
|
-
hasTimingStart: false,
|
|
578
|
-
animationCount: 0
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
function domEditSelectionToFacts(selection, animationCount = selection.gsapAnimations?.length ?? 0) {
|
|
582
|
-
return {
|
|
583
|
-
hasStableTarget: Boolean(selection.selector || selection.hfId),
|
|
584
|
-
tag: selection.tagName,
|
|
585
|
-
inlineStyles: selection.inlineStyles,
|
|
586
|
-
computedStyles: selection.computedStyles,
|
|
587
|
-
isCompositionHost: selection.isCompositionHost,
|
|
588
|
-
isCompositionRoot: false,
|
|
589
|
-
isInsideLockedComposition: selection.isInsideLockedComposition,
|
|
590
|
-
isMasterView: false,
|
|
591
|
-
existsInSource: true,
|
|
592
|
-
hasEditableText: selection.textFields.length > 0,
|
|
593
|
-
hasTimingStart: selection.dataAttributes.start != null,
|
|
594
|
-
animationCount,
|
|
595
|
-
hasAudio: isAudibleVideoNode(selection.element)
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
function resolveDomEditCapabilities(args) {
|
|
599
|
-
return resolveEditingAffordances(
|
|
600
|
-
capabilityFacts({
|
|
601
|
-
hasStableTarget: Boolean(args.selector || args.hfId),
|
|
602
|
-
tag: (args.tagName ?? "div").toLowerCase(),
|
|
603
|
-
inlineStyles: args.inlineStyles,
|
|
604
|
-
computedStyles: args.computedStyles,
|
|
605
|
-
isCompositionHost: args.isCompositionHost,
|
|
606
|
-
isCompositionRoot: args.isCompositionRoot ?? false,
|
|
607
|
-
isInsideLockedComposition: args.isInsideLockedComposition ?? false,
|
|
608
|
-
isMasterView: args.isMasterView,
|
|
609
|
-
existsInSource: args.existsInSource ?? true
|
|
610
|
-
})
|
|
611
|
-
).capabilities;
|
|
612
|
-
}
|
|
613
|
-
async function resolveDomEditSelection(startEl, options) {
|
|
614
|
-
if (!startEl) return null;
|
|
615
|
-
const doc = startEl.ownerDocument;
|
|
616
|
-
let capture = options.exactTarget ? { kind: "unit", element: startEl } : resolveGroupCapture(startEl, options.activeGroupElement ?? null);
|
|
617
|
-
if (capture.kind === "out-of-scope") {
|
|
618
|
-
capture = resolveGroupCapture(startEl, null);
|
|
619
|
-
}
|
|
620
|
-
let current = capture.kind === "unit" ? capture.element : getSelectionCandidate(startEl, options);
|
|
621
|
-
while (current && current !== doc.body && current !== doc.documentElement) {
|
|
622
|
-
const selector = buildStableSelector(current);
|
|
623
|
-
const hfId = readHfId(current);
|
|
624
|
-
if (!selector && !hfId) {
|
|
625
|
-
current = current.parentElement;
|
|
626
|
-
continue;
|
|
627
|
-
}
|
|
628
|
-
const { sourceFile, compositionPath } = getSourceFileForElement(
|
|
629
|
-
current,
|
|
630
|
-
options.activeCompositionPath
|
|
631
|
-
);
|
|
632
|
-
const selectorIndex = selector ? getSelectorIndex(doc, current, selector, sourceFile, options.activeCompositionPath) : void 0;
|
|
633
|
-
const compositionSrc = current.getAttribute("data-composition-src") ?? current.getAttribute("data-composition-file") ?? void 0;
|
|
634
|
-
const inlineStyles = getInlineStyles(current);
|
|
635
|
-
const computedStyles = getCuratedComputedStyles(current);
|
|
636
|
-
const isCompositionRoot = current.hasAttribute("data-composition-id") && !compositionSrc || isCompositionRootLayer(current, doc, computedStyles);
|
|
637
|
-
const textFields = collectDomEditTextFields(current);
|
|
638
|
-
const isInsideLocked = Boolean(findClosestByAttribute(current, ["data-timeline-locked"]));
|
|
639
|
-
const probeTarget = {};
|
|
640
|
-
if (current.id) probeTarget.id = current.id;
|
|
641
|
-
if (hfId) probeTarget.hfId = hfId;
|
|
642
|
-
if (selector) probeTarget.selector = selector;
|
|
643
|
-
if (selectorIndex != null) probeTarget.selectorIndex = selectorIndex;
|
|
644
|
-
let existsInSource = knownSourceAnswer(options.previous, current, sourceFile, probeTarget);
|
|
645
|
-
const probe = existsInSource === void 0 && !options.skipSourceProbe;
|
|
646
|
-
if (probe && options.projectId && (current.id || selector || hfId)) {
|
|
647
|
-
existsInSource = await probeSourceElement(options.projectId, sourceFile, probeTarget);
|
|
648
|
-
}
|
|
649
|
-
const capabilities = resolveEditingAffordances(
|
|
650
|
-
capabilityFacts({
|
|
651
|
-
hasStableTarget: Boolean(selector || hfId),
|
|
652
|
-
tag: current.tagName.toLowerCase(),
|
|
653
|
-
inlineStyles,
|
|
654
|
-
computedStyles,
|
|
655
|
-
isCompositionHost: Boolean(compositionSrc),
|
|
656
|
-
isCompositionRoot,
|
|
657
|
-
isInsideLockedComposition: isInsideLocked,
|
|
658
|
-
isMasterView: options.isMasterView,
|
|
659
|
-
existsInSource: existsInSource ?? true
|
|
660
|
-
})
|
|
661
|
-
).capabilities;
|
|
662
|
-
const rect = current.getBoundingClientRect();
|
|
663
|
-
return {
|
|
664
|
-
element: current,
|
|
665
|
-
id: current.id || void 0,
|
|
666
|
-
hfId,
|
|
667
|
-
selector,
|
|
668
|
-
selectorIndex,
|
|
669
|
-
sourceFile,
|
|
670
|
-
compositionPath,
|
|
671
|
-
compositionSrc,
|
|
672
|
-
isCompositionHost: Boolean(compositionSrc),
|
|
673
|
-
isInsideLockedComposition: isInsideLocked,
|
|
674
|
-
label: buildElementLabel(current),
|
|
675
|
-
tagName: current.tagName.toLowerCase(),
|
|
676
|
-
boundingBox: {
|
|
677
|
-
x: rect.left,
|
|
678
|
-
y: rect.top,
|
|
679
|
-
width: rect.width,
|
|
680
|
-
height: rect.height
|
|
681
|
-
},
|
|
682
|
-
textContent: current.textContent?.trim() || null,
|
|
683
|
-
dataAttributes: getDataAttributes(current),
|
|
684
|
-
inlineStyles,
|
|
685
|
-
computedStyles,
|
|
686
|
-
textFields,
|
|
687
|
-
capabilities,
|
|
688
|
-
existsInSource
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
return null;
|
|
692
|
-
}
|
|
693
|
-
async function refreshDomEditSelection(selection, activeCompositionPath) {
|
|
694
|
-
const doc = selection.element.ownerDocument;
|
|
695
|
-
const nextElement = findElementForSelection(doc, selection, activeCompositionPath);
|
|
696
|
-
return nextElement ? resolveDomEditSelection(nextElement, {
|
|
697
|
-
activeCompositionPath,
|
|
698
|
-
isMasterView: !activeCompositionPath || activeCompositionPath === "index.html"
|
|
699
|
-
}) : null;
|
|
700
|
-
}
|
|
701
|
-
function getDomEditLayerKey(target) {
|
|
702
|
-
const selectorIndex = target.selectorIndex ?? 0;
|
|
703
|
-
return `${target.sourceFile}:${target.id ?? target.selector ?? "layer"}:${selectorIndex}`;
|
|
704
|
-
}
|
|
705
|
-
function countDomEditChildLayers(root, options, maxCount = 99) {
|
|
706
|
-
if (!root) return 0;
|
|
707
|
-
let count = 0;
|
|
708
|
-
const visit = (el) => {
|
|
709
|
-
for (const child of Array.from(el.children)) {
|
|
710
|
-
if (!isHtmlElement(child)) continue;
|
|
711
|
-
if (isDomLayerElement(child)) {
|
|
712
|
-
count += 1;
|
|
713
|
-
if (count >= maxCount) return;
|
|
714
|
-
}
|
|
715
|
-
visit(child);
|
|
716
|
-
if (count >= maxCount) return;
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
visit(root);
|
|
720
|
-
return count;
|
|
721
|
-
}
|
|
722
|
-
function collectDomEditLayerItems(root, options, maxItems = Number.POSITIVE_INFINITY, cache) {
|
|
723
|
-
if (!root) return [];
|
|
724
|
-
cache?.beginWalk(options.activeCompositionPath);
|
|
725
|
-
const items = [];
|
|
726
|
-
const visit = (el, depth) => {
|
|
727
|
-
if (items.length >= maxItems) return;
|
|
728
|
-
const entry = readDomEditLayerWalkEntry(el, options.activeCompositionPath, cache);
|
|
729
|
-
if (entry) {
|
|
730
|
-
const { target } = entry;
|
|
731
|
-
items.push({
|
|
732
|
-
key: getDomEditLayerKey(target),
|
|
733
|
-
element: el,
|
|
734
|
-
label: entry.label,
|
|
735
|
-
tagName: el.tagName.toLowerCase(),
|
|
736
|
-
depth,
|
|
737
|
-
childCount: entry.childCount,
|
|
738
|
-
id: target.id ?? void 0,
|
|
739
|
-
hfId: target.hfId ?? void 0,
|
|
740
|
-
selector: target.selector ?? void 0,
|
|
741
|
-
selectorIndex: target.selectorIndex,
|
|
742
|
-
sourceFile: target.sourceFile
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
const nextDepth = entry ? depth + 1 : depth;
|
|
746
|
-
for (const child of Array.from(el.children)) {
|
|
747
|
-
if (!isHtmlElement(child)) continue;
|
|
748
|
-
visit(child, nextDepth);
|
|
749
|
-
if (items.length >= maxItems) return;
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
withSelectorIndexPass(root.ownerDocument, () => {
|
|
753
|
-
for (const el of groupScopedLayerRoots(root, options.activeGroupElement ?? null)) visit(el, 0);
|
|
754
|
-
});
|
|
755
|
-
return items;
|
|
756
|
-
}
|
|
757
|
-
function liveLayerElement(layer, doc, activeCompositionPath) {
|
|
758
|
-
if (layer.element.isConnected || !doc) return layer.element;
|
|
759
|
-
return findElementForSelection(doc, layer, activeCompositionPath) ?? layer.element;
|
|
760
|
-
}
|
|
761
|
-
function buildDomEditStylePatchOperation(property, value, childLocator) {
|
|
762
|
-
return {
|
|
763
|
-
type: "inline-style",
|
|
764
|
-
property,
|
|
765
|
-
value,
|
|
766
|
-
...childLocator
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
function buildDomEditTextPatchOperation(value, childLocator) {
|
|
770
|
-
return { type: "text-content", property: "text", value, ...childLocator };
|
|
771
|
-
}
|
|
772
|
-
function buildDomEditRichTextPatchOperation(value) {
|
|
773
|
-
return { type: "rich-text", property: "", value };
|
|
774
|
-
}
|
|
775
|
-
function hasSupportedDirectEdit(capabilities) {
|
|
776
|
-
return capabilities.canEditStyles || capabilities.canMove || capabilities.canResize || capabilities.canApplyManualOffset || capabilities.canApplyManualSize || capabilities.canApplyManualRotation;
|
|
777
|
-
}
|
|
778
|
-
function getDomEditNonEditableReason(element, selection) {
|
|
779
|
-
if (!selection) {
|
|
780
|
-
return "No stable source target";
|
|
781
|
-
}
|
|
782
|
-
if (selection.element !== element) {
|
|
783
|
-
return selection.isCompositionHost ? "Nested composition boundary" : `Selection resolves to ${selection.label}`;
|
|
784
|
-
}
|
|
785
|
-
if (!hasSupportedDirectEdit(selection.capabilities)) {
|
|
786
|
-
return selection.capabilities.reasonIfDisabled ?? "No supported direct edits";
|
|
787
|
-
}
|
|
788
|
-
return null;
|
|
789
|
-
}
|
|
790
|
-
function getDomEditTargetKey(selection) {
|
|
791
|
-
return [
|
|
792
|
-
selection.sourceFile || "index.html",
|
|
793
|
-
selection.hfId ?? "",
|
|
794
|
-
selection.id ?? "",
|
|
795
|
-
selection.selector ?? "",
|
|
796
|
-
selection.selectorIndex ?? ""
|
|
797
|
-
].join("|");
|
|
798
|
-
}
|
|
799
|
-
function isTextEditableSelection(selection) {
|
|
800
|
-
return resolveEditingSections(domEditSelectionToFacts(selection)).text;
|
|
801
|
-
}
|
|
802
|
-
function readHfId(element) {
|
|
803
|
-
return element.getAttribute("data-hf-id")?.trim() || void 0;
|
|
804
|
-
}
|
|
805
|
-
function buildDomEditPatchTarget(selection) {
|
|
806
|
-
return {
|
|
807
|
-
id: selection.id,
|
|
808
|
-
hfId: selection.hfId,
|
|
809
|
-
selector: selection.selector,
|
|
810
|
-
selectorIndex: selection.selectorIndex
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
export {
|
|
815
|
-
isElementComputedVisible,
|
|
816
|
-
getDomLayerPatchTarget,
|
|
817
|
-
resolveAllVisualDomEditTargets,
|
|
818
|
-
findElementForSelection,
|
|
819
|
-
findPreviewNode,
|
|
820
|
-
findElementForTimelineElement,
|
|
821
|
-
DOM_EDIT_LAYER_OBSERVER_INIT,
|
|
822
|
-
createDomEditLayerWalkCache,
|
|
823
|
-
drainPendingLayerMutations,
|
|
824
|
-
collectDomEditTextFields,
|
|
825
|
-
serializeDomEditTextFields,
|
|
826
|
-
buildDefaultDomEditTextField,
|
|
827
|
-
buildTextFieldChildLocator,
|
|
828
|
-
domEditSelectionToFacts,
|
|
829
|
-
resolveDomEditCapabilities,
|
|
830
|
-
resolveDomEditSelection,
|
|
831
|
-
refreshDomEditSelection,
|
|
832
|
-
getDomEditLayerKey,
|
|
833
|
-
countDomEditChildLayers,
|
|
834
|
-
collectDomEditLayerItems,
|
|
835
|
-
liveLayerElement,
|
|
836
|
-
buildDomEditStylePatchOperation,
|
|
837
|
-
buildDomEditTextPatchOperation,
|
|
838
|
-
buildDomEditRichTextPatchOperation,
|
|
839
|
-
getDomEditNonEditableReason,
|
|
840
|
-
getDomEditTargetKey,
|
|
841
|
-
isTextEditableSelection,
|
|
842
|
-
readHfId,
|
|
843
|
-
buildDomEditPatchTarget
|
|
844
|
-
};
|
|
845
|
-
//# sourceMappingURL=chunk-TP6D3U37.js.map
|