hyperframes 0.8.145 → 0.8.146

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.
Files changed (186) hide show
  1. package/dist/{add-B6OUH46W.js → add-6J4TLUDW.js} +15 -15
  2. package/dist/{animatedGifPrep-MIWRDJIO.js → animatedGifPrep-TPYA45ZZ.js} +10 -10
  3. package/dist/{asset-XJ2B2PU3.js → asset-B4C6ZU4V.js} +2 -2
  4. package/dist/{assetCataloger-A5ZLSCMZ.js → assetCataloger-GX4B55VB.js} +4 -4
  5. package/dist/{auth-5HOVCZMV.js → auth-T2V3URGO.js} +2 -2
  6. package/dist/{autoUpdate-WVNL5K3D.js → autoUpdate-O4R7IOYP.js} +2 -2
  7. package/dist/{backgroundChecks-IGF54SFH.js → backgroundChecks-SQHGZCSH.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-T6JEGCQV.js → batchRender-T7S2CGJE.js} +5 -5
  10. package/dist/{beats-37T6Y6QP.js → beats-RNEXDM7U.js} +16 -16
  11. package/dist/{benchmark-ZVVLOWPP.js → benchmark-IVK6FCEU.js} +12 -12
  12. package/dist/{browser-4SSJOLH4.js → browser-WUE6VK2N.js} +5 -5
  13. package/dist/{bundleWithLocalizedFonts-XWK423QP.js → bundleWithLocalizedFonts-EEIRL7FT.js} +2 -2
  14. package/dist/{capture-2SF7YP57.js → capture-K3EONGGU.js} +2 -2
  15. package/dist/{capture-KZXOPBMO.js → capture-LEKIGJ4G.js} +13 -13
  16. package/dist/{catalog-NLD4A2C6.js → catalog-IXYQ2KXW.js} +15 -15
  17. package/dist/{catch-up-4BSRN6IR.js → catch-up-IIF7HKR6.js} +6 -6
  18. package/dist/{check-IA44QQWM.js → check-W7CDOXNP.js} +38 -38
  19. package/dist/{checkBrowser-VM35KZMW.js → checkBrowser-5VSXEHBZ.js} +118 -61
  20. package/dist/{chunk-ZF7SXQJ7.js → chunk-2NAUEDA6.js} +2 -2
  21. package/dist/{chunk-FXJJCPPB.js → chunk-3HSWLZ6S.js} +1 -1
  22. package/dist/{chunk-ZSVUAVMT.js → chunk-4RUILXS6.js} +5 -5
  23. package/dist/{chunk-FBCULCAL.js → chunk-54UXJKFF.js} +1 -1
  24. package/dist/{chunk-DIRJ322I.js → chunk-66SAATRI.js} +3 -3
  25. package/dist/{chunk-QLSM7K5S.js → chunk-6TTAXMDG.js} +2 -2
  26. package/dist/{chunk-5WVW7P23.js → chunk-A72OAGNB.js} +6 -6
  27. package/dist/{chunk-G75ENCEZ.js → chunk-AIJS74LG.js} +3 -3
  28. package/dist/{chunk-HB7FJOY4.js → chunk-AJ5R4GM6.js} +1 -1
  29. package/dist/{chunk-VRW6EBHV.js → chunk-BAKPN2D2.js} +101 -94
  30. package/dist/{chunk-OTHDVXOJ.js → chunk-CVPWZ5LY.js} +3 -3
  31. package/dist/{chunk-BIAC7IJT.js → chunk-DDNS2674.js} +1 -1
  32. package/dist/{chunk-QFSCCQIR.js → chunk-DMKI64EZ.js} +1 -1
  33. package/dist/{chunk-EPE2HRJK.js → chunk-DUU77E2S.js} +69 -64
  34. package/dist/{chunk-ZIYZ77MR.js → chunk-EGO6Z24R.js} +3 -3
  35. package/dist/{chunk-KC5XXX3X.js → chunk-EOOEC32M.js} +1 -1
  36. package/dist/{chunk-3IBMBNYY.js → chunk-ETNQF37F.js} +10 -10
  37. package/dist/{chunk-XIHCMVMG.js → chunk-FDL4HV44.js} +2 -2
  38. package/dist/{chunk-GBGJ7A3D.js → chunk-FJLHVAPO.js} +6 -6
  39. package/dist/{chunk-QZ3AZTXI.js → chunk-FJWEYVEM.js} +42 -16
  40. package/dist/{chunk-IHTRYDFN.js → chunk-FKLYMV3U.js} +1 -1
  41. package/dist/{chunk-PUGIRFPX.js → chunk-FMNVTKX2.js} +4 -4
  42. package/dist/{chunk-GEMJYBRU.js → chunk-HBGJYBGE.js} +2 -2
  43. package/dist/{chunk-U5QY7KTN.js → chunk-HTM4CIFS.js} +11 -8
  44. package/dist/{chunk-T42U2W2R.js → chunk-IXLUTE6N.js} +1 -1
  45. package/dist/{chunk-FDT6KQV4.js → chunk-JBQJKC23.js} +2 -2
  46. package/dist/{chunk-IEIJRMLZ.js → chunk-JDB65PPT.js} +62 -63
  47. package/dist/{chunk-USDEMXXL.js → chunk-JYVGYKXG.js} +1 -1
  48. package/dist/{chunk-PLR7Z6TC.js → chunk-K7ES5RSK.js} +1 -1
  49. package/dist/{chunk-VHFEMFYL.js → chunk-KFZUUXUN.js} +3 -3
  50. package/dist/{chunk-GRY3PN3K.js → chunk-KG265HQ7.js} +2 -2
  51. package/dist/{chunk-R42WWQVB.js → chunk-KPJMBC4K.js} +2 -2
  52. package/dist/{chunk-MAYCCGMQ.js → chunk-KVGDFUVO.js} +1 -1
  53. package/dist/{chunk-CFUXNBWH.js → chunk-LE7T4ML7.js} +1 -1
  54. package/dist/{chunk-MQZVBHEY.js → chunk-LFNQDTSH.js} +1 -1
  55. package/dist/{chunk-KIFHYXPB.js → chunk-MOL32UKR.js} +45 -11
  56. package/dist/{chunk-ICKDMTLA.js → chunk-QSSPIATO.js} +2 -2
  57. package/dist/{chunk-3KU3PFDW.js → chunk-R6R74HNZ.js} +74 -66
  58. package/dist/{chunk-ADF3X6GM.js → chunk-SYMSKGXI.js} +2 -2
  59. package/dist/{chunk-ZEUONDQG.js → chunk-SYUGVPYH.js} +1 -1
  60. package/dist/{chunk-BFACGEII.js → chunk-TBOMPYG6.js} +2 -2
  61. package/dist/{chunk-XBX4QJP7.js → chunk-TH4OXAWY.js} +1 -1
  62. package/dist/{chunk-GMAJB2P6.js → chunk-UOBYRLDD.js} +1 -1
  63. package/dist/{chunk-4QWD6JYN.js → chunk-UZUUVYAO.js} +3 -3
  64. package/dist/{chunk-PJ3HDUCY.js → chunk-VAS6HQX3.js} +39 -9
  65. package/dist/{chunk-6LGNTUZN.js → chunk-VT563F4O.js} +7 -7
  66. package/dist/{chunk-UXO2L7HJ.js → chunk-WU2B74TL.js} +267 -65
  67. package/dist/{chunk-OB5MJR4W.js → chunk-WUZ6TMAO.js} +1 -1
  68. package/dist/{chunk-GQJZORQP.js → chunk-XBSPQ52S.js} +1 -1
  69. package/dist/{chunk-4ORLNTET.js → chunk-XJUZEB44.js} +1 -1
  70. package/dist/{chunk-LAFJSYDL.js → chunk-XVIYZU3D.js} +1 -1
  71. package/dist/{chunk-GXJEGZL2.js → chunk-Z5C4LEAD.js} +17 -18
  72. package/dist/chunk-Z6FLHIDV.js +3795 -0
  73. package/dist/{chunk-DDIVWXN7.js → chunk-ZFN6GQU4.js} +4 -4
  74. package/dist/{chunk-DWUKJQTO.js → chunk-ZVZSFDW3.js} +2 -2
  75. package/dist/{chunk-5NRXZGKK.js → chunk-ZZ7H4IJ6.js} +9 -9
  76. package/dist/{clean-RDKJB5FK.js → clean-2GDD2B4F.js} +23 -23
  77. package/dist/cli.js +52 -52
  78. package/dist/{cloud-QVPVVNCW.js → cloud-LUKGDTTE.js} +4 -4
  79. package/dist/{cloudrun-3RE2UCQG.js → cloudrun-NQF5KFQI.js} +6 -6
  80. package/dist/{compare-LEDOY7MO.js → compare-4P6O4ONG.js} +32 -32
  81. package/dist/{compiler-F54OZZPM.js → compiler-ACCPOZMQ.js} +6 -6
  82. package/dist/{component-N42M67WY.js → component-SDDOLNJD.js} +3 -3
  83. package/dist/{compositions-VB2J2LZI.js → compositions-P2L6HUVQ.js} +15 -15
  84. package/dist/{delete-Q6RWMJ4Z.js → delete-Q6S4BJ3F.js} +2 -2
  85. package/dist/{deterministicFonts-U2BIMGPG.js → deterministicFonts-C5JQLCTS.js} +2 -2
  86. package/dist/{dist-Q4BI5A73.js → dist-GPDOV3IQ.js} +4 -4
  87. package/dist/{dist-KDJTFJHA.js → dist-HUMFCJ6T.js} +3 -3
  88. package/dist/{doctor-JMMUHDRV.js → doctor-NL73UKHV.js} +15 -15
  89. package/dist/{events-RGUAHIBW.js → events-AVOPOKO3.js} +5 -5
  90. package/dist/{events-6ZBSIBE5.js → events-X7KPU7LG.js} +4 -4
  91. package/dist/{feedback-FIID6MZW.js → feedback-GJZ5NXSH.js} +10 -10
  92. package/dist/{ffmpeg-T5SH2EFJ.js → ffmpeg-5V4FP3R6.js} +2 -2
  93. package/dist/{figma-BL3JJC36.js → figma-V7SVQQI5.js} +3 -3
  94. package/dist/fontLocalizeCli.js +14 -14
  95. package/dist/{get-P46GS7S6.js → get-FO3YZYEU.js} +2 -2
  96. package/dist/{gpuPolicy-AQ2BPLBK.js → gpuPolicy-QGS4TFWP.js} +10 -10
  97. package/dist/{grade-compare-GDCWU7ZZ.js → grade-compare-7ICSN7KE.js} +33 -33
  98. package/dist/{help-HJR3RWFG.js → help-Y5LYZG7K.js} +2 -2
  99. package/dist/{history-GGO5AWJB.js → history-RKGBRNLD.js} +49 -22
  100. package/dist/hyperframe-runtime.js +214 -68
  101. package/dist/hyperframe.manifest.json +1 -1
  102. package/dist/hyperframe.runtime.iife.js +214 -68
  103. package/dist/hyperframes-player.global.js +4 -5
  104. package/dist/hyperframes-slideshow.global.js +3 -4
  105. package/dist/{info-3GFWUBJC.js → info-GGUTL2NR.js} +11 -11
  106. package/dist/{init-36OPU2ZG.js → init-PG7NA5SQ.js} +31 -31
  107. package/dist/{inspect-F2HEL5ON.js → inspect-FCXUB6DE.js} +33 -33
  108. package/dist/{installer-NI6P6GC4.js → installer-LZ4X5TZZ.js} +6 -6
  109. package/dist/{keyframes-7OY3LMAZ.js → keyframes-R3K6WJ3N.js} +8 -8
  110. package/dist/{lambda-6GJIWNJ3.js → lambda-3GAKHMC3.js} +7 -7
  111. package/dist/{layout-FTMLNL5A.js → layout-XNIZIGA2.js} +33 -33
  112. package/dist/{lint-U6POHUON.js → lint-4KDS2F4O.js} +11 -11
  113. package/dist/{lintProject-UBZ3TDHU.js → lintProject-SSEXWCH6.js} +3 -3
  114. package/dist/{list-IP5KI5Q2.js → list-OVPURFPK.js} +2 -2
  115. package/dist/{login-4VWTVPHG.js → login-EE2AX2PE.js} +4 -4
  116. package/dist/{manager-YKMHR6LN.js → manager-5ORDVWJB.js} +3 -3
  117. package/dist/{media-treatment-XGV44AGV.js → media-treatment-UDUEOP67.js} +82 -54
  118. package/dist/{models-UCXB6UR5.js → models-LPK2O4B2.js} +14 -14
  119. package/dist/{motionShot-WPVNBXKA.js → motionShot-G76XBOYI.js} +35 -29
  120. package/dist/{normalize-audio-TYJ3UEHO.js → normalize-audio-TUKWZ3OR.js} +10 -10
  121. package/dist/{open-HENOLVB2.js → open-7XB2TGVB.js} +6 -6
  122. package/dist/{parakeetRunner-VFQ6WFTD.js → parakeetRunner-DL556HXL.js} +14 -14
  123. package/dist/{pipeline-6WPSC3H4.js → pipeline-34N5DLWU.js} +11 -11
  124. package/dist/{play-OI53WNUM.js → play-DDA2UUQF.js} +26 -26
  125. package/dist/{preflight-B4AFK3RG.js → preflight-ONF5AJNO.js} +5 -5
  126. package/dist/{present-NGMEQ4NO.js → present-LLNRKXF5.js} +23 -23
  127. package/dist/{preview-VT2HWRWZ.js → preview-H3ZZS46F.js} +57 -26
  128. package/dist/{producer-7TYEAUF7.js → producer-IFQOZK2G.js} +1 -1
  129. package/dist/{projectConfig-B2AF5DXY.js → projectConfig-SBRMQZGG.js} +8 -8
  130. package/dist/{publication-2PANQVC6.js → publication-5BQICRZO.js} +4 -4
  131. package/dist/{publish-O5OL42BG.js → publish-XDUZA3E3.js} +27 -26
  132. package/dist/{remove-background-T2JM6UVP.js → remove-background-GNKRMFQS.js} +12 -12
  133. package/dist/{render-Z253WHBK.js → render-JM6KNRIA.js} +27 -27
  134. package/dist/{render-OLPKOJRU.js → render-KTTC3EE5.js} +12 -12
  135. package/dist/{render-W7OFXDOJ.js → render-PCFO45RK.js} +5 -5
  136. package/dist/{render-batch-46IIBFKL.js → render-batch-7R2NRNVJ.js} +5 -5
  137. package/dist/{renderCancellation-QTZOCDJ2.js → renderCancellation-GP3XD2FS.js} +10 -10
  138. package/dist/renderSetupWorker.js +3 -3
  139. package/dist/{resolver-J2PL5FVJ.js → resolver-C4FPX72I.js} +6 -6
  140. package/dist/{sherpa-ZF42V3RN.js → sherpa-MZP3MV2X.js} +14 -14
  141. package/dist/skills/media-use/references/media-treatments.md +5 -1
  142. package/dist/{skills-ACDOO3PX.js → skills-OET4XSHR.js} +7 -7
  143. package/dist/{skillsUpdateCheck-L5OXVVPU.js → skillsUpdateCheck-IPFSKKJD.js} +3 -3
  144. package/dist/{slideshow-4OJEPWNZ.js → slideshow-YTWATJRT.js} +1 -1
  145. package/dist/{snapshot-UUVNZOW5.js → snapshot-EC4N75MS.js} +34 -34
  146. package/dist/{src-BSLKXEGX.js → src-LIERUCFW.js} +11 -9
  147. package/dist/{src-KS3AWFGT.js → src-ZZQJOKO6.js} +13 -13
  148. package/dist/{staticProjectServer-2TTVGPQH.js → staticProjectServer-YH2RHYKW.js} +20 -20
  149. package/dist/{status-LXPGSSKY.js → status-PTKNQD2E.js} +2 -2
  150. package/dist/studio/assets/{hyperframes-player-DZ5JrMDg.js → hyperframes-player-tkxyWf5H.js} +3 -3
  151. package/dist/studio/assets/{index-BqFRhNZa.js → index-BrdqOkqP.js} +1 -1
  152. package/dist/studio/assets/{index-D8W0a0Z9.js → index-Cg48BxAo.js} +135 -135
  153. package/dist/studio/assets/{index-BOs6C0aZ.js → index-Dllxg4aU.js} +1 -1
  154. package/dist/studio/index.html +1 -1
  155. package/dist/{studio-api-WYWF7XRC.js → studio-api-T2TS2CHL.js} +16 -14
  156. package/dist/{studioServer-3FG4YTP7.js → studioServer-GJVVJUEL.js} +50 -50
  157. package/dist/{system-OQLOGGPJ.js → system-OXRG57F2.js} +2 -2
  158. package/dist/{telemetry-PAOOB4T4.js → telemetry-ZQ5XVE6Z.js} +5 -5
  159. package/dist/{timeline-JIIJKKPC.js → timeline-I2T5WIPD.js} +34 -25
  160. package/dist/{tokens-3QRAM75Z.js → tokens-ONUWOXEX.js} +2 -2
  161. package/dist/{transcribe-QSBP5MUG.js → transcribe-BCQMA537.js} +12 -12
  162. package/dist/{transcribe-SZB6UMXE.js → transcribe-ZLJF7V5Y.js} +13 -13
  163. package/dist/{updateCheck-V3DSB26K.js → updateCheck-ZWHDXF73.js} +2 -2
  164. package/dist/{upgrade-L5GISOEV.js → upgrade-32JGFZWS.js} +2 -2
  165. package/dist/{urlDownloader-52FERT4X.js → urlDownloader-EVDP43GM.js} +9 -9
  166. package/dist/{validate-HVVLX7KO.js → validate-G4PUGQCI.js} +27 -27
  167. package/dist/{video-MEOWRMFG.js → video-TILEY3VJ.js} +10 -10
  168. package/package.json +3 -2
  169. package/dist/chunk-AUWHD7RA.js +0 -3753
  170. package/dist/studio/chunk-6JY3MTIX.js +0 -1204
  171. package/dist/studio/chunk-EEXSYY5F.js +0 -190
  172. package/dist/studio/chunk-NZPJUZKT.js +0 -1538
  173. package/dist/studio/chunk-PZ5AY32C.js +0 -10
  174. package/dist/studio/chunk-TP6D3U37.js +0 -845
  175. package/dist/studio/chunk-Y2OHHNM2.js +0 -970
  176. package/dist/studio/domEditingLayers-PTP2ICGM.js +0 -47
  177. package/dist/studio/index.css +0 -165
  178. package/dist/studio/index.d.ts +0 -4318
  179. package/dist/studio/index.js +0 -100952
  180. package/dist/studio/player.d.ts +0 -30
  181. package/dist/studio/player.js +0 -10
  182. package/dist/studio/styles/tailwind-preset.d.ts +0 -39
  183. package/dist/studio/styles/tailwind-preset.js +0 -50
  184. package/dist/studio/styles.css +0 -1
  185. package/dist/studio/ui.d.ts +0 -297
  186. 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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
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, "&quot;")}"`).join("");
542
- const style = serializeTextFieldStyle(field);
543
- const styleAttr = style ? ` style="${style.replace(/"/g, "&quot;")}"` : "";
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