hyperframes 0.8.144 → 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 (209) hide show
  1. package/README.md +3 -2
  2. package/dist/{add-CWRTVGDB.js → add-6J4TLUDW.js} +15 -15
  3. package/dist/{animatedGifPrep-JTOHIWI4.js → animatedGifPrep-TPYA45ZZ.js} +10 -10
  4. package/dist/{asset-KU2Z4UFM.js → asset-B4C6ZU4V.js} +2 -2
  5. package/dist/{assetCataloger-3CS2P7PA.js → assetCataloger-GX4B55VB.js} +4 -4
  6. package/dist/{auth-IDSOIQWG.js → auth-T2V3URGO.js} +2 -2
  7. package/dist/{autoUpdate-373B4BA2.js → autoUpdate-O4R7IOYP.js} +2 -2
  8. package/dist/{backgroundChecks-53Q3NAMG.js → backgroundChecks-SQHGZCSH.js} +3 -3
  9. package/dist/backgroundChecksWorker.js +3 -3
  10. package/dist/{batchRender-UKZA6BME.js → batchRender-T7S2CGJE.js} +5 -5
  11. package/dist/{beats-N5JGEOFR.js → beats-RNEXDM7U.js} +16 -16
  12. package/dist/{benchmark-CUN3LN4V.js → benchmark-IVK6FCEU.js} +12 -12
  13. package/dist/{browser-NCZT5AP6.js → browser-WUE6VK2N.js} +5 -5
  14. package/dist/{bundleWithLocalizedFonts-FWC7PE2D.js → bundleWithLocalizedFonts-EEIRL7FT.js} +2 -2
  15. package/dist/{capture-YLS32UHT.js → capture-K3EONGGU.js} +2 -2
  16. package/dist/{capture-QBLG3VJR.js → capture-LEKIGJ4G.js} +13 -13
  17. package/dist/{catalog-HIWNAFHW.js → catalog-IXYQ2KXW.js} +15 -15
  18. package/dist/{catch-up-HGS7KIAC.js → catch-up-IIF7HKR6.js} +6 -6
  19. package/dist/{check-FH6UYYLO.js → check-W7CDOXNP.js} +38 -38
  20. package/dist/{checkBrowser-RNWNOMCZ.js → checkBrowser-5VSXEHBZ.js} +118 -61
  21. package/dist/{chunk-XU5GGV6R.js → chunk-2NAUEDA6.js} +2 -2
  22. package/dist/{chunk-GZM2EFOE.js → chunk-3HSWLZ6S.js} +1 -1
  23. package/dist/{chunk-YUAXFWSQ.js → chunk-4RUILXS6.js} +5 -5
  24. package/dist/{chunk-MXNDKDFT.js → chunk-54UXJKFF.js} +1 -1
  25. package/dist/{chunk-DIRJ322I.js → chunk-66SAATRI.js} +3 -3
  26. package/dist/{chunk-RI53TS2Y.js → chunk-6TTAXMDG.js} +2 -2
  27. package/dist/{chunk-YJXHMIZA.js → chunk-A72OAGNB.js} +6 -6
  28. package/dist/{chunk-G75ENCEZ.js → chunk-AIJS74LG.js} +3 -3
  29. package/dist/{chunk-GEWKFRFI.js → chunk-AJ5R4GM6.js} +1 -1
  30. package/dist/{chunk-3VYNNWVA.js → chunk-BAKPN2D2.js} +101 -94
  31. package/dist/{chunk-3XTEXWNN.js → chunk-CVPWZ5LY.js} +3 -3
  32. package/dist/{chunk-AUBOF2PN.js → chunk-DDNS2674.js} +1 -1
  33. package/dist/{chunk-QFSCCQIR.js → chunk-DMKI64EZ.js} +1 -1
  34. package/dist/{chunk-NOPBBSLA.js → chunk-DUU77E2S.js} +69 -64
  35. package/dist/{chunk-RVFEDAUV.js → chunk-EGO6Z24R.js} +3 -3
  36. package/dist/{chunk-KC5XXX3X.js → chunk-EOOEC32M.js} +1 -1
  37. package/dist/{chunk-2DA2BBNY.js → chunk-ETNQF37F.js} +10 -10
  38. package/dist/{chunk-54QISXOC.js → chunk-FDL4HV44.js} +2 -2
  39. package/dist/{chunk-VYSUZEJG.js → chunk-FJLHVAPO.js} +6 -6
  40. package/dist/{chunk-QZ3AZTXI.js → chunk-FJWEYVEM.js} +42 -16
  41. package/dist/{chunk-EX6C672Y.js → chunk-FKLYMV3U.js} +1 -1
  42. package/dist/{chunk-PUGIRFPX.js → chunk-FMNVTKX2.js} +4 -4
  43. package/dist/{chunk-L5TUCXWR.js → chunk-HBGJYBGE.js} +2 -2
  44. package/dist/{chunk-SLCFKB3Y.js → chunk-HTM4CIFS.js} +11 -8
  45. package/dist/{chunk-T42U2W2R.js → chunk-IXLUTE6N.js} +1 -1
  46. package/dist/{chunk-OUSLVRO4.js → chunk-JBQJKC23.js} +76 -6
  47. package/dist/{chunk-IEIJRMLZ.js → chunk-JDB65PPT.js} +62 -63
  48. package/dist/{chunk-USDEMXXL.js → chunk-JYVGYKXG.js} +1 -1
  49. package/dist/{chunk-P6WH6QTV.js → chunk-K7ES5RSK.js} +1 -1
  50. package/dist/{chunk-LC3RQURJ.js → chunk-KFZUUXUN.js} +3 -3
  51. package/dist/{chunk-OIDN7G42.js → chunk-KG265HQ7.js} +2 -2
  52. package/dist/{chunk-7RAYSCYT.js → chunk-KPJMBC4K.js} +2 -2
  53. package/dist/{chunk-MAYCCGMQ.js → chunk-KVGDFUVO.js} +1 -1
  54. package/dist/{chunk-JEHFZQYT.js → chunk-LE7T4ML7.js} +1 -1
  55. package/dist/{chunk-MQZVBHEY.js → chunk-LFNQDTSH.js} +1 -1
  56. package/dist/{chunk-ZOA2SC4P.js → chunk-MOL32UKR.js} +45 -11
  57. package/dist/{chunk-RG3QWWIE.js → chunk-QSSPIATO.js} +2 -2
  58. package/dist/{chunk-F2SMS24Q.js → chunk-R6R74HNZ.js} +117 -139
  59. package/dist/{chunk-7SDCIWHQ.js → chunk-SYMSKGXI.js} +2 -2
  60. package/dist/{chunk-ZEUONDQG.js → chunk-SYUGVPYH.js} +1 -1
  61. package/dist/{chunk-4OC7MQNB.js → chunk-TBOMPYG6.js} +2 -2
  62. package/dist/{chunk-KFKZ3ISO.js → chunk-TH4OXAWY.js} +1 -1
  63. package/dist/{chunk-4LAR447G.js → chunk-UOBYRLDD.js} +1 -1
  64. package/dist/{chunk-NV4RXIQ7.js → chunk-UZUUVYAO.js} +3 -3
  65. package/dist/{chunk-PJ3HDUCY.js → chunk-VAS6HQX3.js} +39 -9
  66. package/dist/{chunk-LFX2HEYP.js → chunk-VT563F4O.js} +7 -7
  67. package/dist/{chunk-5VMR4WBS.js → chunk-WU2B74TL.js} +363 -103
  68. package/dist/{chunk-5HJ343GH.js → chunk-WUZ6TMAO.js} +1 -1
  69. package/dist/{chunk-GQJZORQP.js → chunk-XBSPQ52S.js} +1 -1
  70. package/dist/{chunk-5WADG7PR.js → chunk-XJUZEB44.js} +1 -1
  71. package/dist/{chunk-I5KY7EZP.js → chunk-XVIYZU3D.js} +1 -1
  72. package/dist/{chunk-XGFHYAYN.js → chunk-Z5C4LEAD.js} +33 -28
  73. package/dist/chunk-Z6FLHIDV.js +3795 -0
  74. package/dist/{chunk-DDIVWXN7.js → chunk-ZFN6GQU4.js} +4 -4
  75. package/dist/{chunk-Y6UPYWJS.js → chunk-ZVZSFDW3.js} +2 -2
  76. package/dist/{chunk-A53CBD24.js → chunk-ZZ7H4IJ6.js} +9 -9
  77. package/dist/{clean-KPX27IKJ.js → clean-2GDD2B4F.js} +23 -23
  78. package/dist/cli.js +52 -52
  79. package/dist/{cloud-P7DAOISN.js → cloud-LUKGDTTE.js} +4 -4
  80. package/dist/{cloudrun-XM56TBOH.js → cloudrun-NQF5KFQI.js} +6 -6
  81. package/dist/{compare-F6YAFZZM.js → compare-4P6O4ONG.js} +32 -32
  82. package/dist/{compiler-JZ4GNFMG.js → compiler-ACCPOZMQ.js} +10 -6
  83. package/dist/{component-3CFOGIQA.js → component-SDDOLNJD.js} +3 -3
  84. package/dist/{compositions-CPCMWF24.js → compositions-P2L6HUVQ.js} +15 -15
  85. package/dist/{delete-GYVKOKB6.js → delete-Q6S4BJ3F.js} +2 -2
  86. package/dist/{deterministicFonts-U2BIMGPG.js → deterministicFonts-C5JQLCTS.js} +2 -2
  87. package/dist/{dist-YPWQDWJ4.js → dist-GPDOV3IQ.js} +4 -4
  88. package/dist/{dist-KDJTFJHA.js → dist-HUMFCJ6T.js} +3 -3
  89. package/dist/{doctor-GWI3B6JT.js → doctor-NL73UKHV.js} +15 -15
  90. package/dist/{events-BRRUDPPT.js → events-AVOPOKO3.js} +5 -5
  91. package/dist/{events-V2QFN4YM.js → events-X7KPU7LG.js} +4 -4
  92. package/dist/{feedback-CXMD7FWL.js → feedback-GJZ5NXSH.js} +10 -10
  93. package/dist/{ffmpeg-T5SH2EFJ.js → ffmpeg-5V4FP3R6.js} +2 -2
  94. package/dist/{figma-YABDWD66.js → figma-V7SVQQI5.js} +3 -3
  95. package/dist/fontLocalizeCli.js +14 -14
  96. package/dist/{get-L2SOQKHX.js → get-FO3YZYEU.js} +2 -2
  97. package/dist/{gpuPolicy-NBJNWHYS.js → gpuPolicy-QGS4TFWP.js} +10 -10
  98. package/dist/{grade-compare-STXQPKYQ.js → grade-compare-7ICSN7KE.js} +33 -33
  99. package/dist/{help-4H6BSFLB.js → help-Y5LYZG7K.js} +2 -2
  100. package/dist/{history-4IQOLTHJ.js → history-RKGBRNLD.js} +49 -22
  101. package/dist/hyperframe-runtime.js +214 -68
  102. package/dist/hyperframe.manifest.json +1 -1
  103. package/dist/hyperframe.runtime.iife.js +214 -68
  104. package/dist/hyperframes-player.global.js +4 -5
  105. package/dist/hyperframes-slideshow.global.js +3 -4
  106. package/dist/{info-2CZOTNBC.js → info-GGUTL2NR.js} +11 -11
  107. package/dist/{init-6BXK42VS.js → init-PG7NA5SQ.js} +31 -31
  108. package/dist/{inspect-VKU47TBH.js → inspect-FCXUB6DE.js} +33 -33
  109. package/dist/{installer-T2BSSUDY.js → installer-LZ4X5TZZ.js} +6 -6
  110. package/dist/{keyframes-IEYVHRPI.js → keyframes-R3K6WJ3N.js} +8 -8
  111. package/dist/{lambda-TIKG25CK.js → lambda-3GAKHMC3.js} +7 -7
  112. package/dist/{layout-XOI4PT7A.js → layout-XNIZIGA2.js} +33 -33
  113. package/dist/{lint-DWCMVIX5.js → lint-4KDS2F4O.js} +11 -11
  114. package/dist/{lintProject-UBZ3TDHU.js → lintProject-SSEXWCH6.js} +3 -3
  115. package/dist/{list-7GXKG5QM.js → list-OVPURFPK.js} +2 -2
  116. package/dist/{login-BQ5L2UHX.js → login-EE2AX2PE.js} +4 -4
  117. package/dist/{manager-YKMHR6LN.js → manager-5ORDVWJB.js} +3 -3
  118. package/dist/{media-treatment-IFB7OSZ3.js → media-treatment-UDUEOP67.js} +86 -55
  119. package/dist/{models-TY4PJ545.js → models-LPK2O4B2.js} +14 -14
  120. package/dist/{motionShot-WXMFHICW.js → motionShot-G76XBOYI.js} +35 -29
  121. package/dist/{normalize-audio-RFD776HQ.js → normalize-audio-TUKWZ3OR.js} +10 -10
  122. package/dist/{open-7IXXGO2E.js → open-7XB2TGVB.js} +6 -6
  123. package/dist/{parakeetRunner-IHLYYMTZ.js → parakeetRunner-DL556HXL.js} +14 -14
  124. package/dist/{pipeline-TXKPLL2U.js → pipeline-34N5DLWU.js} +11 -11
  125. package/dist/{play-J2KP64UK.js → play-DDA2UUQF.js} +26 -26
  126. package/dist/{preflight-B4AFK3RG.js → preflight-ONF5AJNO.js} +5 -5
  127. package/dist/{present-MHHNRVRA.js → present-LLNRKXF5.js} +23 -23
  128. package/dist/{preview-CONUOFFQ.js → preview-H3ZZS46F.js} +57 -26
  129. package/dist/{producer-ZI46K7HH.js → producer-IFQOZK2G.js} +1 -1
  130. package/dist/{projectConfig-FGGVG5MV.js → projectConfig-SBRMQZGG.js} +8 -8
  131. package/dist/{publication-TXFBMW6B.js → publication-5BQICRZO.js} +4 -4
  132. package/dist/{publish-YZSPBFRD.js → publish-XDUZA3E3.js} +27 -26
  133. package/dist/{remove-background-4ATVLHLG.js → remove-background-GNKRMFQS.js} +12 -12
  134. package/dist/{render-MH4IUPWB.js → render-JM6KNRIA.js} +27 -27
  135. package/dist/{render-6FBYLYGJ.js → render-KTTC3EE5.js} +12 -12
  136. package/dist/{render-GFW5BPES.js → render-PCFO45RK.js} +5 -5
  137. package/dist/{render-batch-XUCZ2PUJ.js → render-batch-7R2NRNVJ.js} +5 -5
  138. package/dist/{renderCancellation-XF7M7IUP.js → renderCancellation-GP3XD2FS.js} +10 -10
  139. package/dist/renderSetupWorker.js +3 -3
  140. package/dist/{resolver-W7AYCQGS.js → resolver-C4FPX72I.js} +6 -6
  141. package/dist/{sherpa-LDUB5NLY.js → sherpa-MZP3MV2X.js} +14 -14
  142. package/dist/skills/hyperframes/scripts/lib/frame-packets-core.mjs +2 -20
  143. package/dist/skills/hyperframes/scripts/lib/main-module.mjs +13 -0
  144. package/dist/skills/hyperframes/scripts/lib/main-module.test.mjs +51 -0
  145. package/dist/skills/hyperframes/scripts/plugin-cli.mjs +4 -3
  146. package/dist/skills/hyperframes/scripts/plugin-cli.test.mjs +5 -1
  147. package/dist/skills/hyperframes-cli/SKILL.md +2 -0
  148. package/dist/skills/media-use/audio/scripts/heygen-voice.mjs +2 -2
  149. package/dist/skills/media-use/audio/scripts/lib/main-module.mjs +13 -0
  150. package/dist/skills/media-use/references/media-treatments.md +5 -1
  151. package/dist/skills/media-use/scripts/lib/cube-validate.mjs +2 -3
  152. package/dist/skills/media-use/scripts/lib/main-module.mjs +13 -0
  153. package/dist/{skills-VENERS5X.js → skills-OET4XSHR.js} +7 -7
  154. package/dist/{skillsUpdateCheck-UXFYTACG.js → skillsUpdateCheck-IPFSKKJD.js} +3 -3
  155. package/dist/{slideshow-4OJEPWNZ.js → slideshow-YTWATJRT.js} +1 -1
  156. package/dist/{snapshot-C6T74HTI.js → snapshot-EC4N75MS.js} +34 -34
  157. package/dist/{src-VUJ2FUFK.js → src-LIERUCFW.js} +13 -9
  158. package/dist/{src-FS5RSVEI.js → src-ZZQJOKO6.js} +13 -13
  159. package/dist/{staticProjectServer-V2RZ4DWD.js → staticProjectServer-YH2RHYKW.js} +20 -20
  160. package/dist/{status-LXPGSSKY.js → status-PTKNQD2E.js} +2 -2
  161. package/dist/studio/assets/{hyperframes-player-Bw_jIaSX.js → hyperframes-player-tkxyWf5H.js} +3 -3
  162. package/dist/studio/assets/{index-Cj7W_c7p.js → index-BrdqOkqP.js} +1 -1
  163. package/dist/studio/assets/{index-BVM9NuWl.js → index-Cg48BxAo.js} +145 -145
  164. package/dist/studio/assets/{index-DyH9dT7b.js → index-Dllxg4aU.js} +1 -1
  165. package/dist/studio/index.html +1 -1
  166. package/dist/{studio-api-TQE7KWKO.js → studio-api-T2TS2CHL.js} +16 -14
  167. package/dist/{studioServer-CYKSQK7L.js → studioServer-GJVVJUEL.js} +54 -52
  168. package/dist/{system-OQLOGGPJ.js → system-OXRG57F2.js} +2 -2
  169. package/dist/{telemetry-A23PPRD6.js → telemetry-ZQ5XVE6Z.js} +5 -5
  170. package/dist/{timeline-T3QSGT3A.js → timeline-I2T5WIPD.js} +34 -25
  171. package/dist/{tokens-RT5HWA6C.js → tokens-ONUWOXEX.js} +2 -2
  172. package/dist/{transcribe-FOLNOC5G.js → transcribe-BCQMA537.js} +12 -12
  173. package/dist/{transcribe-HCF64LQK.js → transcribe-ZLJF7V5Y.js} +13 -13
  174. package/dist/{updateCheck-27PIP3AA.js → updateCheck-ZWHDXF73.js} +2 -2
  175. package/dist/{upgrade-TVGXBUPJ.js → upgrade-32JGFZWS.js} +2 -2
  176. package/dist/{urlDownloader-KBLBJKRL.js → urlDownloader-EVDP43GM.js} +9 -9
  177. package/dist/{validate-ZMYGK4QI.js → validate-G4PUGQCI.js} +27 -27
  178. package/dist/{video-AVE5GIGM.js → video-TILEY3VJ.js} +10 -10
  179. package/package.json +3 -2
  180. package/dist/chunk-WJB7WI4J.js +0 -3753
  181. package/dist/studio/chunk-3GHTHPZD.js +0 -1105
  182. package/dist/studio/chunk-3GHTHPZD.js.map +0 -1
  183. package/dist/studio/chunk-EEXSYY5F.js +0 -190
  184. package/dist/studio/chunk-EEXSYY5F.js.map +0 -1
  185. package/dist/studio/chunk-G3EDKRZH.js +0 -1442
  186. package/dist/studio/chunk-G3EDKRZH.js.map +0 -1
  187. package/dist/studio/chunk-PEAKCOUW.js +0 -942
  188. package/dist/studio/chunk-PEAKCOUW.js.map +0 -1
  189. package/dist/studio/chunk-PZ5AY32C.js +0 -10
  190. package/dist/studio/chunk-PZ5AY32C.js.map +0 -1
  191. package/dist/studio/chunk-Y2OHHNM2.js +0 -970
  192. package/dist/studio/chunk-Y2OHHNM2.js.map +0 -1
  193. package/dist/studio/domEditingLayers-PYST4G45.js +0 -47
  194. package/dist/studio/domEditingLayers-PYST4G45.js.map +0 -1
  195. package/dist/studio/index.css +0 -165
  196. package/dist/studio/index.css.map +0 -1
  197. package/dist/studio/index.d.ts +0 -4315
  198. package/dist/studio/index.js +0 -100971
  199. package/dist/studio/index.js.map +0 -1
  200. package/dist/studio/player.d.ts +0 -30
  201. package/dist/studio/player.js +0 -10
  202. package/dist/studio/player.js.map +0 -1
  203. package/dist/studio/styles/tailwind-preset.d.ts +0 -39
  204. package/dist/studio/styles/tailwind-preset.js +0 -50
  205. package/dist/studio/styles/tailwind-preset.js.map +0 -1
  206. package/dist/studio/styles.css +0 -1
  207. package/dist/studio/ui.d.ts +0 -297
  208. package/dist/studio/ui.js +0 -66
  209. package/dist/studio/ui.js.map +0 -1
@@ -1,942 +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
- withSelectorIndexPass
21
- } from "./chunk-3GHTHPZD.js";
22
- import {
23
- __export
24
- } from "./chunk-PZ5AY32C.js";
25
-
26
- // src/components/editor/domEditingLayers.ts
27
- import { PREVIEW_ONLY_ATTRS } from "@hyperframes/core/studio-preview-mark";
28
-
29
- // src/components/editor/manualEditingAvailability.ts
30
- var manualEditingAvailability_exports = {};
31
- __export(manualEditingAvailability_exports, {
32
- STUDIO_API_SAME_ORIGIN_CREDENTIALS: () => STUDIO_API_SAME_ORIGIN_CREDENTIALS,
33
- STUDIO_FLAT_INSPECTOR_ENABLED: () => STUDIO_FLAT_INSPECTOR_ENABLED,
34
- STUDIO_SDK_CUTOVER_ENABLED: () => STUDIO_SDK_CUTOVER_ENABLED,
35
- STUDIO_SDK_CUTOVER_FAMILIES: () => STUDIO_SDK_CUTOVER_FAMILIES,
36
- STUDIO_SDK_RESOLVER_SHADOW_ENABLED: () => STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
37
- resolveStudioBooleanEnvFlag: () => resolveStudioBooleanEnvFlag
38
- });
39
-
40
- // src/utils/sdkCutoverPolicy.ts
41
- var STUDIO_SDK_OPERATION_FAMILIES = [
42
- "dom",
43
- "timing",
44
- "gsap-animation",
45
- "gsap-keyframe",
46
- "lifecycle"
47
- ];
48
- function resolveEnabledSdkFamilies(env2, masterEnabled) {
49
- if (!masterEnabled) return /* @__PURE__ */ new Set();
50
- const raw = env2["VITE_STUDIO_SDK_CUTOVER_FAMILIES"];
51
- if (typeof raw !== "string" || raw.trim() === "") return new Set(STUDIO_SDK_OPERATION_FAMILIES);
52
- const requested = raw.split(",").map((family) => family.trim()).filter(Boolean);
53
- const known = new Set(STUDIO_SDK_OPERATION_FAMILIES);
54
- const unknown = requested.filter((family) => !known.has(family));
55
- if (unknown.length > 0) {
56
- throw new Error(`Unknown Studio SDK cutover families: ${unknown.join(", ")}`);
57
- }
58
- return new Set(requested);
59
- }
60
- function isSdkFamilyEnabled(masterEnabled, configured, family) {
61
- return masterEnabled && (configured?.has(family) ?? true);
62
- }
63
-
64
- // src/components/editor/manualEditingAvailability.ts
65
- var TRUTHY_ENV_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on", "enabled"]);
66
- var FALSY_ENV_VALUES = /* @__PURE__ */ new Set(["0", "false", "no", "off", "disabled"]);
67
- function resolveStudioBooleanEnvFlag(env2, names, fallback) {
68
- for (const name of names) {
69
- const value = env2[name];
70
- if (typeof value === "boolean") return value;
71
- if (typeof value !== "string") continue;
72
- const normalized = value.trim().toLowerCase();
73
- if (!normalized) continue;
74
- if (TRUTHY_ENV_VALUES.has(normalized)) return true;
75
- if (FALSY_ENV_VALUES.has(normalized)) return false;
76
- }
77
- return fallback;
78
- }
79
- var runtimeEnv = typeof window !== "undefined" ? window.__HF_STUDIO_ENV__ ?? {} : {};
80
- var env = { ...import.meta.env ?? {}, ...runtimeEnv };
81
- var STUDIO_SDK_CUTOVER_ENABLED = resolveStudioBooleanEnvFlag(
82
- env,
83
- ["VITE_STUDIO_SDK_CUTOVER_ENABLED"],
84
- true
85
- );
86
- var STUDIO_SDK_CUTOVER_FAMILIES = resolveEnabledSdkFamilies(
87
- env,
88
- STUDIO_SDK_CUTOVER_ENABLED
89
- );
90
- var STUDIO_SDK_RESOLVER_SHADOW_ENABLED = resolveStudioBooleanEnvFlag(
91
- env,
92
- ["VITE_STUDIO_SDK_RESOLVER_SHADOW_ENABLED"],
93
- true
94
- );
95
- var STUDIO_FLAT_INSPECTOR_ENABLED = resolveStudioBooleanEnvFlag(
96
- env,
97
- ["VITE_STUDIO_ENABLE_FLAT_INSPECTOR", "VITE_STUDIO_FLAT_INSPECTOR_ENABLED"],
98
- true
99
- );
100
- var STUDIO_API_SAME_ORIGIN_CREDENTIALS = resolveStudioBooleanEnvFlag(
101
- env,
102
- ["VITE_STUDIO_API_SAME_ORIGIN_CREDENTIALS"],
103
- false
104
- );
105
-
106
- // src/utils/studioApiFetch.ts
107
- var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
108
- function studioApiCredentials() {
109
- if (STUDIO_API_SAME_ORIGIN_CREDENTIALS) return "same-origin";
110
- const host = globalThis.location?.hostname;
111
- return !host || LOOPBACK_HOSTS.has(host) ? "omit" : "same-origin";
112
- }
113
- function studioApiFetch(input, init) {
114
- return globalThis.fetch(input, { ...init, credentials: studioApiCredentials() });
115
- }
116
-
117
- // src/components/editor/probeSourceElement.ts
118
- function knownSourceAnswer(previous, element, sourceFile, target) {
119
- if (!previous || previous.element !== element || previous.sourceFile !== sourceFile) return;
120
- const same = previous.id === target.id && previous.hfId === target.hfId && previous.selector === target.selector && previous.selectorIndex === target.selectorIndex;
121
- return same ? previous.existsInSource : void 0;
122
- }
123
- var pending = /* @__PURE__ */ new Map();
124
- async function sendBatch(projectId, sourceFile, probes) {
125
- let exists = [];
126
- try {
127
- const response = await studioApiFetch(
128
- buildProjectApiPath(
129
- projectId,
130
- `/file-mutations/probe-elements/${encodeURIComponent(sourceFile)}`
131
- ),
132
- {
133
- method: "POST",
134
- headers: { "Content-Type": "application/json" },
135
- body: JSON.stringify({ targets: probes.map((probe) => probe.target) })
136
- }
137
- );
138
- if (response.ok) {
139
- const data = await response.json();
140
- if (Array.isArray(data?.exists)) exists = data.exists;
141
- }
142
- } catch {
143
- }
144
- probes.forEach((probe, index) => probe.resolve(exists[index] !== false));
145
- }
146
- function probeSourceElement(projectId, sourceFile, target) {
147
- return new Promise((resolve) => {
148
- const key = `${projectId}\0${sourceFile}`;
149
- let probes = pending.get(key);
150
- if (!probes) {
151
- const batch = [];
152
- probes = batch;
153
- pending.set(key, batch);
154
- setTimeout(() => {
155
- pending.delete(key);
156
- void sendBatch(projectId, sourceFile, batch);
157
- }, 0);
158
- }
159
- probes.push({ target, resolve });
160
- });
161
- }
162
-
163
- // src/components/editor/domEditingLayers.ts
164
- import {
165
- resolveEditingAffordances,
166
- resolveEditingSections
167
- } from "@hyperframes/core/editing";
168
-
169
- // src/components/editor/domEditingGroups.ts
170
- function groupScopedLayerRoots(root, activeGroupElement) {
171
- const els = activeGroupElement?.isConnected ? Array.from(activeGroupElement.children) : [root];
172
- return els.filter(isHtmlElement);
173
- }
174
- function resolveGroupCapture(startEl, activeGroupElement) {
175
- const groups = [];
176
- for (let n = startEl; n; n = n.parentElement) {
177
- if (n.hasAttribute("data-hf-group")) groups.push(n);
178
- }
179
- const result = (() => {
180
- if (!activeGroupElement) {
181
- const outermost = groups[groups.length - 1];
182
- return outermost ? { kind: "unit", element: outermost } : { kind: "child" };
183
- }
184
- const idx = groups.indexOf(activeGroupElement);
185
- if (idx === -1) return { kind: "out-of-scope" };
186
- const nestedInside = groups[idx - 1];
187
- return nestedInside ? { kind: "unit", element: nestedInside } : { kind: "child" };
188
- })();
189
- return result;
190
- }
191
-
192
- // src/components/editor/domEditingElement.ts
193
- function isElementComputedVisible(el, memo) {
194
- return isElementVisibleThroughAncestors(el, memo);
195
- }
196
- var VISUAL_LEAF_TAGS = /* @__PURE__ */ new Set(["img", "video", "canvas", "svg", "audio"]);
197
- function hasVisualPresence(el) {
198
- const win = el.ownerDocument.defaultView;
199
- if (!win) return false;
200
- const cs = win.getComputedStyle(el);
201
- if (cs.backgroundImage !== "none") return true;
202
- if (cs.backgroundColor && cs.backgroundColor !== "transparent" && cs.backgroundColor !== "rgba(0, 0, 0, 0)")
203
- return true;
204
- if (cs.borderWidth && parseFloat(cs.borderWidth) > 0 && cs.borderStyle !== "none") return true;
205
- if (cs.boxShadow && cs.boxShadow !== "none") return true;
206
- return false;
207
- }
208
- function isEmptyVisualContainer(el) {
209
- const tag = el.tagName.toLowerCase();
210
- if (VISUAL_LEAF_TAGS.has(tag)) return false;
211
- if (hasVisualPresence(el)) return false;
212
- const { children } = el;
213
- if (children.length === 0) {
214
- return (el.textContent ?? "").trim().length === 0;
215
- }
216
- for (let i = 0; i < children.length; i += 1) {
217
- const child = children[i];
218
- if (!isHtmlElement(child)) continue;
219
- if (VISUAL_LEAF_TAGS.has(child.tagName.toLowerCase())) return false;
220
- if (isElementComputedVisible(child)) return false;
221
- }
222
- return true;
223
- }
224
- function hasRenderedBox(el) {
225
- const rect = el.getBoundingClientRect();
226
- if (rect.width <= 1 || rect.height <= 1) return false;
227
- if (!isElementComputedVisible(el)) return false;
228
- if (isEmptyVisualContainer(el)) return false;
229
- return true;
230
- }
231
- var DOM_LAYER_IGNORED_TAGS = /* @__PURE__ */ new Set([
232
- "base",
233
- "br",
234
- "canvas",
235
- "link",
236
- "meta",
237
- "script",
238
- "source",
239
- "style",
240
- "template",
241
- "track",
242
- "wbr"
243
- ]);
244
- function isInspectableLayerElement(el) {
245
- const tagName = el.tagName.toLowerCase();
246
- if (DOM_LAYER_IGNORED_TAGS.has(tagName)) return false;
247
- const computed = el.ownerDocument.defaultView?.getComputedStyle(el);
248
- if (computed?.display === "none" || computed?.visibility === "hidden") return false;
249
- return true;
250
- }
251
- function resolveLayerSelector(el) {
252
- if (el.hasAttribute("data-composition-id")) return void 0;
253
- return buildStableSelector(el);
254
- }
255
- function resolveDomLayerIdentity(el, activeCompositionPath) {
256
- const selector = resolveLayerSelector(el);
257
- if (!selector) return null;
258
- const { sourceFile } = getSourceFileForElement(el, activeCompositionPath);
259
- return {
260
- id: el.id || void 0,
261
- hfId: el.getAttribute("data-hf-id") || void 0,
262
- selector,
263
- selectorIndex: getSelectorIndex(
264
- el.ownerDocument,
265
- el,
266
- selector,
267
- sourceFile,
268
- activeCompositionPath
269
- ),
270
- sourceFile
271
- };
272
- }
273
- function getDomLayerPatchTarget(el, activeCompositionPath) {
274
- return isInspectableLayerElement(el) ? resolveDomLayerIdentity(el, activeCompositionPath) : null;
275
- }
276
- function isDomLayerElement(el) {
277
- return isInspectableLayerElement(el) && resolveLayerSelector(el) !== void 0;
278
- }
279
- function getPreferredClipAncestor(startEl) {
280
- let current = startEl;
281
- while (current) {
282
- if (current.classList.contains("clip")) {
283
- const isCompositionHost = current.hasAttribute("data-composition-src") || current.hasAttribute("data-composition-file");
284
- if (!isCompositionHost || current === startEl) return current;
285
- }
286
- current = current.parentElement;
287
- }
288
- return null;
289
- }
290
- function getSelectionCandidate(startEl, options) {
291
- if (options.preferClipAncestor) {
292
- const clipAncestor = getPreferredClipAncestor(startEl);
293
- if (clipAncestor) {
294
- return clipAncestor;
295
- }
296
- }
297
- return startEl;
298
- }
299
- function resolveAllVisualDomEditTargets(elementsFromPoint, options) {
300
- const raw = [];
301
- for (const entry of elementsFromPoint) {
302
- if (!isHtmlElement(entry)) continue;
303
- if (hasRenderedBox(entry) && getDomLayerPatchTarget(entry, options.activeCompositionPath)) {
304
- raw.push(entry);
305
- }
306
- }
307
- if (raw.length === 0) return [];
308
- const layers = [];
309
- let best = raw[0];
310
- for (let i = 1; i < raw.length; i++) {
311
- const el = raw[i];
312
- if (best.contains(el)) {
313
- best = el;
314
- } else {
315
- layers.push(best);
316
- best = el;
317
- }
318
- }
319
- layers.push(best);
320
- return layers;
321
- }
322
- function findElementForSelection(doc, selection, activeCompositionPath = null) {
323
- const sourceMatches = (candidate) => isHtmlElement(candidate) && (!selection.sourceFile || getSourceFileForElement(candidate, activeCompositionPath).sourceFile === selection.sourceFile);
324
- const findAll = (selector) => querySelectorAllSafely(doc, selector).filter(sourceMatches);
325
- if (selection.hfId) {
326
- const byHfId = findAll(`[data-hf-id="${escapeCssString(selection.hfId)}"]`)[0];
327
- if (byHfId) return byHfId;
328
- }
329
- if (selection.id) {
330
- const byId = findAll(`[id="${escapeCssString(selection.id)}"]`)[0];
331
- if (byId) return byId;
332
- }
333
- if (!selection.selector) return null;
334
- return findAll(selection.selector)[selection.selectorIndex ?? 0] ?? null;
335
- }
336
- function findPreviewNode(doc, el) {
337
- if (!doc) return null;
338
- if (el.element?.isConnected && el.element.ownerDocument === doc) return el.element;
339
- return findElementForSelection(doc, el) ?? findElementForSelection(doc, { ...el, sourceFile: void 0 });
340
- }
341
- function findElementForTimelineElement(doc, element, options) {
342
- const elementId = typeof element.id === "string" ? element.id : "";
343
- const compositionSource = normalizeTimelineCompositionSource(element.compositionSrc) ?? options.compIdToSrc?.get(elementId);
344
- const sourceFile = compositionSource ?? normalizeTimelineCompositionSource(element.sourceFile) ?? options.activeCompositionPath ?? "index.html";
345
- const escapedElementId = escapeCssString(elementId);
346
- const escapedCompositionSource = compositionSource ? escapeCssString(compositionSource) : null;
347
- const selector = element.selector ?? (compositionSource ? `[data-composition-src="${escapedCompositionSource}"],[data-composition-file="${escapedCompositionSource}"],[data-composition-id="${escapedElementId}"]` : escapedElementId ? `[data-composition-id="${escapedElementId}"]` : void 0);
348
- if (selector || element.domId) {
349
- const targetElement = findElementForSelection(
350
- doc,
351
- {
352
- id: element.domId ?? void 0,
353
- selector,
354
- selectorIndex: element.selectorIndex,
355
- sourceFile
356
- },
357
- options.activeCompositionPath
358
- );
359
- if (targetElement) return targetElement;
360
- }
361
- const hasExplicitDomTarget = Boolean(element.domId || element.selector || compositionSource);
362
- if (options.isMasterView || hasExplicitDomTarget || !options.activeCompositionPath) {
363
- return null;
364
- }
365
- const root = doc.querySelector("[data-composition-id]");
366
- if (!isHtmlElement(root)) return null;
367
- return getSourceFileForElement(root, options.activeCompositionPath).sourceFile === sourceFile ? root : null;
368
- }
369
- function getDirectLayerChildren(el) {
370
- return Array.from(el.children).filter(
371
- (child) => isHtmlElement(child) && isDomLayerElement(child)
372
- );
373
- }
374
-
375
- // src/components/editor/domEditingRootLayer.ts
376
- var COMPOSITION_ROOT_LAYER_EPSILON_PX = 1;
377
- function readPositiveDimension(value) {
378
- if (!value) return null;
379
- const parsed = Number.parseFloat(value);
380
- return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
381
- }
382
- function approximatelyEqual(a, b) {
383
- return Math.abs(a - b) <= COMPOSITION_ROOT_LAYER_EPSILON_PX;
384
- }
385
- function getCompositionRootBounds(doc) {
386
- const root = doc.querySelector("[data-composition-id]") ?? doc.documentElement ?? null;
387
- const rootWidth = readPositiveDimension(root?.getAttribute("data-width") ?? null);
388
- const rootHeight = readPositiveDimension(root?.getAttribute("data-height") ?? null);
389
- if (!root || !rootWidth || !rootHeight) return null;
390
- return { rect: root.getBoundingClientRect(), width: rootWidth, height: rootHeight };
391
- }
392
- function getRenderedLayerSize(element, computedStyles) {
393
- const rect = element.getBoundingClientRect();
394
- const width = rect.width || parsePx(computedStyles.width);
395
- const height = rect.height || parsePx(computedStyles.height);
396
- return width && height ? { width, height } : null;
397
- }
398
- function matchesCompositionRootBounds(elementRect, elementSize, rootBounds) {
399
- return approximatelyEqual(elementRect.left, rootBounds.rect.left) && approximatelyEqual(elementRect.top, rootBounds.rect.top) && approximatelyEqual(elementSize.width, rootBounds.width) && approximatelyEqual(elementSize.height, rootBounds.height);
400
- }
401
- function isExplicitFullBleedLayer(computedStyles) {
402
- return computedStyles.position === "absolute" || computedStyles.position === "fixed";
403
- }
404
- function isCompositionRootLayer(element, doc, computedStyles) {
405
- if (element.parentElement !== doc.body) return false;
406
- if (element.hasAttribute("data-hf-allow-root-edit")) return false;
407
- if (isExplicitFullBleedLayer(computedStyles)) return false;
408
- const rootBounds = getCompositionRootBounds(doc);
409
- const elementSize = getRenderedLayerSize(element, computedStyles);
410
- return Boolean(
411
- rootBounds && elementSize && matchesCompositionRootBounds(element.getBoundingClientRect(), elementSize, rootBounds)
412
- );
413
- }
414
-
415
- // src/components/editor/domEditLayerWalkCache.ts
416
- var SELECTOR_IDENTITY_ATTRIBUTES = /* @__PURE__ */ new Set([
417
- "id",
418
- "class",
419
- "data-hf-group",
420
- "data-composition-id",
421
- "data-composition-file",
422
- "data-composition-src",
423
- "data-hf-original-composition-id"
424
- ]);
425
- var DOM_EDIT_LAYER_OBSERVER_INIT = {
426
- attributes: true,
427
- characterData: true,
428
- childList: true,
429
- subtree: true
430
- };
431
- var lastInlineVisibility = /* @__PURE__ */ new WeakMap();
432
- function inlineVisibilityChanged(el) {
433
- const next = el.style.visibility;
434
- if (lastInlineVisibility.get(el) === next) return false;
435
- lastInlineVisibility.set(el, next);
436
- return true;
437
- }
438
- function createDomEditLayerWalkCache() {
439
- let presence = /* @__PURE__ */ new WeakMap();
440
- let identities = /* @__PURE__ */ new WeakMap();
441
- let scope = null;
442
- const invalidateAll = () => {
443
- presence = /* @__PURE__ */ new WeakMap();
444
- identities = /* @__PURE__ */ new WeakMap();
445
- };
446
- const drop = (el) => {
447
- if (el) presence.delete(el);
448
- };
449
- const dropSubtree = (el) => {
450
- for (const descendant of el.querySelectorAll("*")) {
451
- if (isHtmlElement(descendant)) presence.delete(descendant);
452
- }
453
- };
454
- const ingestOne = (record) => {
455
- if (record.type === "childList") return false;
456
- if (record.type === "characterData") {
457
- for (let ancestor = record.target.parentElement; ancestor; ancestor = ancestor.parentElement) {
458
- identities.delete(ancestor);
459
- }
460
- return true;
461
- }
462
- const target = record.target;
463
- if (!isHtmlElement(target)) return true;
464
- if (record.attributeName && SELECTOR_IDENTITY_ATTRIBUTES.has(record.attributeName))
465
- return false;
466
- drop(target);
467
- drop(target.parentElement);
468
- if (record.attributeName === "style" && inlineVisibilityChanged(target)) dropSubtree(target);
469
- return true;
470
- };
471
- return {
472
- beginWalk(activeCompositionPath) {
473
- const nextScope = `${activeCompositionPath ?? ""}|${getCompositionSourceMapRevision()}`;
474
- if (nextScope === scope) return;
475
- scope = nextScope;
476
- invalidateAll();
477
- },
478
- readInspectable(el, compute) {
479
- const memo = presence.get(el) ?? {};
480
- if (memo.inspectable === void 0) {
481
- memo.inspectable = compute();
482
- presence.set(el, memo);
483
- }
484
- return memo.inspectable;
485
- },
486
- readChildCount(el, compute) {
487
- const memo = presence.get(el) ?? {};
488
- if (memo.childCount === void 0) {
489
- memo.childCount = compute();
490
- presence.set(el, memo);
491
- }
492
- return memo.childCount;
493
- },
494
- readIdentity(el, compute) {
495
- const memo = identities.get(el) ?? {};
496
- if (memo.identity === void 0) {
497
- memo.identity = compute();
498
- identities.set(el, memo);
499
- }
500
- return memo.identity;
501
- },
502
- readLabel(el, compute) {
503
- const memo = identities.get(el) ?? {};
504
- if (memo.label === void 0) {
505
- memo.label = compute();
506
- identities.set(el, memo);
507
- }
508
- return memo.label;
509
- },
510
- ingest(records) {
511
- for (const record of records) {
512
- if (!ingestOne(record)) {
513
- invalidateAll();
514
- return;
515
- }
516
- }
517
- },
518
- invalidateAll
519
- };
520
- }
521
- function readDomEditLayerWalkEntry(el, activeCompositionPath, cache) {
522
- const inspectable = cache ? cache.readInspectable(el, () => isInspectableLayerElement(el)) : isInspectableLayerElement(el);
523
- if (!inspectable) return null;
524
- const identity = () => resolveDomLayerIdentity(el, activeCompositionPath);
525
- const target = cache ? cache.readIdentity(el, identity) : identity();
526
- if (!target) return null;
527
- const label = () => buildElementLabel(el);
528
- const childCount = () => getDirectLayerChildren(el).length;
529
- return {
530
- target,
531
- label: cache ? cache.readLabel(el, label) : label(),
532
- childCount: cache ? cache.readChildCount(el, childCount) : childCount()
533
- };
534
- }
535
- function drainPendingLayerMutations(observer, cache) {
536
- if (!observer) return;
537
- cache.ingest(observer.takeRecords());
538
- }
539
-
540
- // src/components/editor/domEditingLayers.ts
541
- function sameTagChildIndex(el) {
542
- let index = 0;
543
- let sibling = el.previousElementSibling;
544
- while (sibling) {
545
- if (sibling.tagName === el.tagName) index += 1;
546
- sibling = sibling.previousElementSibling;
547
- }
548
- return index;
549
- }
550
- function getTextFieldLabel(_tagName, index, total, source) {
551
- if (source === "self" || total === 1) return "Content";
552
- return `Text ${index + 1}`;
553
- }
554
- var NOT_COPIED_ATTRS = /* @__PURE__ */ new Set(["style", ...PREVIEW_ONLY_ATTRS]);
555
- function buildTextField(el, index, total, source, sourceChildIndex) {
556
- const tagName = el.tagName.toLowerCase();
557
- const key = el.getAttribute("data-hf-text-key") ?? `${source}:${index}:${tagName}`;
558
- return {
559
- key,
560
- label: getTextFieldLabel(tagName, index, total, source),
561
- value: el.textContent ?? "",
562
- tagName,
563
- attributes: Array.from(el.attributes).filter((attribute) => !NOT_COPIED_ATTRS.has(attribute.name)).map((attribute) => ({
564
- name: attribute.name,
565
- value: attribute.value
566
- })),
567
- inlineStyles: getInlineStyles(el),
568
- computedStyles: getCuratedComputedStyles(el),
569
- source,
570
- ...sourceChildIndex == null ? {} : { sourceChildIndex }
571
- };
572
- }
573
- function collectDomEditTextFields(el) {
574
- const childElements = Array.from(el.children).filter(isHtmlElement).filter(isEditableTextLeaf);
575
- if (childElements.length > 0) {
576
- const hasMixedContent = Array.from(el.childNodes).some(
577
- (node) => node.nodeType === 3 && node.textContent?.trim()
578
- );
579
- if (hasMixedContent) {
580
- const fields = [];
581
- let childIdx = 0;
582
- for (const node of el.childNodes) {
583
- if (node.nodeType === 3) {
584
- const text = node.textContent ?? "";
585
- if (!text.trim()) continue;
586
- fields.push({
587
- key: `text-node:${childIdx}`,
588
- label: `Text ${childIdx + 1}`,
589
- value: text,
590
- tagName: "#text",
591
- attributes: [],
592
- inlineStyles: {},
593
- computedStyles: {},
594
- source: "text-node"
595
- });
596
- childIdx++;
597
- } else if (isHtmlElement(node) && isEditableTextLeaf(node)) {
598
- fields.push(
599
- buildTextField(node, childIdx, childElements.length, "child", sameTagChildIndex(node))
600
- );
601
- childIdx++;
602
- }
603
- }
604
- return fields;
605
- }
606
- return childElements.map(
607
- (child, index) => buildTextField(child, index, childElements.length, "child", sameTagChildIndex(child))
608
- );
609
- }
610
- if (isEditableTextLeaf(el)) {
611
- return [buildTextField(el, 0, 1, "self")];
612
- }
613
- return [];
614
- }
615
- function escapeHtmlText(value) {
616
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
617
- }
618
- function serializeTextFieldStyle(field) {
619
- const entries = Object.entries(field.inlineStyles).filter(([, value]) => Boolean(value));
620
- if (entries.length === 0) return "";
621
- return entries.map(([key, value]) => `${key}: ${value}`).join("; ");
622
- }
623
- function serializeDomEditTextFields(fields) {
624
- return fields.filter((field) => field.source === "child" || field.source === "text-node").map((field) => {
625
- if (field.source === "text-node") {
626
- return escapeHtmlText(field.value);
627
- }
628
- const attrs = [
629
- ...field.attributes.filter((attribute) => attribute.name !== "data-hf-text-key"),
630
- { name: "data-hf-text-key", value: field.key }
631
- ].map((attribute) => ` ${attribute.name}="${attribute.value.replace(/"/g, "&quot;")}"`).join("");
632
- const style = serializeTextFieldStyle(field);
633
- const styleAttr = style ? ` style="${style.replace(/"/g, "&quot;")}"` : "";
634
- return `<${field.tagName}${attrs}${styleAttr}>${escapeHtmlText(field.value)}</${field.tagName}>`;
635
- }).join("");
636
- }
637
- function buildDefaultDomEditTextField(base) {
638
- return {
639
- key: `child:new:${Date.now()}`,
640
- label: "Text",
641
- value: "New text",
642
- tagName: "span",
643
- attributes: [],
644
- inlineStyles: {
645
- "font-family": base?.computedStyles?.["font-family"] ?? "inherit",
646
- "font-size": base?.computedStyles?.["font-size"] ?? "16px",
647
- "font-weight": base?.computedStyles?.["font-weight"] ?? "400",
648
- color: base?.computedStyles?.color ?? "inherit"
649
- },
650
- computedStyles: {},
651
- source: "child"
652
- };
653
- }
654
- function buildTextFieldChildLocator(fields, fieldKey) {
655
- const field = fields.find((candidate) => candidate.key === fieldKey);
656
- if (!field || field.source !== "child") return null;
657
- if (field.sourceChildIndex == null) return null;
658
- return {
659
- childSelector: `:scope > ${field.tagName}`,
660
- childIndex: field.sourceChildIndex
661
- };
662
- }
663
- function capabilityFacts(geometry) {
664
- return {
665
- ...geometry,
666
- hasEditableText: false,
667
- hasTimingStart: false,
668
- animationCount: 0
669
- };
670
- }
671
- function domEditSelectionToFacts(selection, animationCount = selection.gsapAnimations?.length ?? 0) {
672
- return {
673
- hasStableTarget: Boolean(selection.selector || selection.hfId),
674
- tag: selection.tagName,
675
- inlineStyles: selection.inlineStyles,
676
- computedStyles: selection.computedStyles,
677
- isCompositionHost: selection.isCompositionHost,
678
- isCompositionRoot: false,
679
- isInsideLockedComposition: selection.isInsideLockedComposition,
680
- isMasterView: false,
681
- existsInSource: true,
682
- hasEditableText: selection.textFields.length > 0,
683
- hasTimingStart: selection.dataAttributes.start != null,
684
- animationCount,
685
- hasAudio: isAudibleVideoNode(selection.element)
686
- };
687
- }
688
- function resolveDomEditCapabilities(args) {
689
- return resolveEditingAffordances(
690
- capabilityFacts({
691
- hasStableTarget: Boolean(args.selector || args.hfId),
692
- tag: (args.tagName ?? "div").toLowerCase(),
693
- inlineStyles: args.inlineStyles,
694
- computedStyles: args.computedStyles,
695
- isCompositionHost: args.isCompositionHost,
696
- isCompositionRoot: args.isCompositionRoot ?? false,
697
- isInsideLockedComposition: args.isInsideLockedComposition ?? false,
698
- isMasterView: args.isMasterView,
699
- existsInSource: args.existsInSource ?? true
700
- })
701
- ).capabilities;
702
- }
703
- async function resolveDomEditSelection(startEl, options) {
704
- if (!startEl) return null;
705
- const doc = startEl.ownerDocument;
706
- let capture = options.exactTarget ? { kind: "unit", element: startEl } : resolveGroupCapture(startEl, options.activeGroupElement ?? null);
707
- if (capture.kind === "out-of-scope") {
708
- capture = resolveGroupCapture(startEl, null);
709
- }
710
- let current = capture.kind === "unit" ? capture.element : getSelectionCandidate(startEl, options);
711
- while (current && current !== doc.body && current !== doc.documentElement) {
712
- const selector = buildStableSelector(current);
713
- const hfId = readHfId(current);
714
- if (!selector && !hfId) {
715
- current = current.parentElement;
716
- continue;
717
- }
718
- const { sourceFile, compositionPath } = getSourceFileForElement(
719
- current,
720
- options.activeCompositionPath
721
- );
722
- const selectorIndex = selector ? getSelectorIndex(doc, current, selector, sourceFile, options.activeCompositionPath) : void 0;
723
- const compositionSrc = current.getAttribute("data-composition-src") ?? current.getAttribute("data-composition-file") ?? void 0;
724
- const inlineStyles = getInlineStyles(current);
725
- const computedStyles = getCuratedComputedStyles(current);
726
- const isCompositionRoot = current.hasAttribute("data-composition-id") && !compositionSrc || isCompositionRootLayer(current, doc, computedStyles);
727
- const textFields = collectDomEditTextFields(current);
728
- const isInsideLocked = Boolean(findClosestByAttribute(current, ["data-timeline-locked"]));
729
- const probeTarget = {};
730
- if (current.id) probeTarget.id = current.id;
731
- if (hfId) probeTarget.hfId = hfId;
732
- if (selector) probeTarget.selector = selector;
733
- if (selectorIndex != null) probeTarget.selectorIndex = selectorIndex;
734
- let existsInSource = knownSourceAnswer(options.previous, current, sourceFile, probeTarget);
735
- const probe = existsInSource === void 0 && !options.skipSourceProbe;
736
- if (probe && options.projectId && (current.id || selector || hfId)) {
737
- existsInSource = await probeSourceElement(options.projectId, sourceFile, probeTarget);
738
- }
739
- const capabilities = resolveEditingAffordances(
740
- capabilityFacts({
741
- hasStableTarget: Boolean(selector || hfId),
742
- tag: current.tagName.toLowerCase(),
743
- inlineStyles,
744
- computedStyles,
745
- isCompositionHost: Boolean(compositionSrc),
746
- isCompositionRoot,
747
- isInsideLockedComposition: isInsideLocked,
748
- isMasterView: options.isMasterView,
749
- existsInSource: existsInSource ?? true
750
- })
751
- ).capabilities;
752
- const rect = current.getBoundingClientRect();
753
- return {
754
- element: current,
755
- id: current.id || void 0,
756
- hfId,
757
- selector,
758
- selectorIndex,
759
- sourceFile,
760
- compositionPath,
761
- compositionSrc,
762
- isCompositionHost: Boolean(compositionSrc),
763
- isInsideLockedComposition: isInsideLocked,
764
- label: buildElementLabel(current),
765
- tagName: current.tagName.toLowerCase(),
766
- boundingBox: {
767
- x: rect.left,
768
- y: rect.top,
769
- width: rect.width,
770
- height: rect.height
771
- },
772
- textContent: current.textContent?.trim() || null,
773
- dataAttributes: getDataAttributes(current),
774
- inlineStyles,
775
- computedStyles,
776
- textFields,
777
- capabilities,
778
- existsInSource
779
- };
780
- }
781
- return null;
782
- }
783
- async function refreshDomEditSelection(selection, activeCompositionPath) {
784
- const doc = selection.element.ownerDocument;
785
- const nextElement = findElementForSelection(doc, selection, activeCompositionPath);
786
- return nextElement ? resolveDomEditSelection(nextElement, {
787
- activeCompositionPath,
788
- isMasterView: !activeCompositionPath || activeCompositionPath === "index.html"
789
- }) : null;
790
- }
791
- function getDomEditLayerKey(target) {
792
- const selectorIndex = target.selectorIndex ?? 0;
793
- return `${target.sourceFile}:${target.id ?? target.selector ?? "layer"}:${selectorIndex}`;
794
- }
795
- function countDomEditChildLayers(root, options, maxCount = 99) {
796
- if (!root) return 0;
797
- let count = 0;
798
- const visit = (el) => {
799
- for (const child of Array.from(el.children)) {
800
- if (!isHtmlElement(child)) continue;
801
- if (isDomLayerElement(child)) {
802
- count += 1;
803
- if (count >= maxCount) return;
804
- }
805
- visit(child);
806
- if (count >= maxCount) return;
807
- }
808
- };
809
- visit(root);
810
- return count;
811
- }
812
- function collectDomEditLayerItems(root, options, maxItems = Number.POSITIVE_INFINITY, cache) {
813
- if (!root) return [];
814
- cache?.beginWalk(options.activeCompositionPath);
815
- const items = [];
816
- const visit = (el, depth) => {
817
- if (items.length >= maxItems) return;
818
- const entry = readDomEditLayerWalkEntry(el, options.activeCompositionPath, cache);
819
- if (entry) {
820
- const { target } = entry;
821
- items.push({
822
- key: getDomEditLayerKey(target),
823
- element: el,
824
- label: entry.label,
825
- tagName: el.tagName.toLowerCase(),
826
- depth,
827
- childCount: entry.childCount,
828
- id: target.id ?? void 0,
829
- hfId: target.hfId ?? void 0,
830
- selector: target.selector ?? void 0,
831
- selectorIndex: target.selectorIndex,
832
- sourceFile: target.sourceFile
833
- });
834
- }
835
- const nextDepth = entry ? depth + 1 : depth;
836
- for (const child of Array.from(el.children)) {
837
- if (!isHtmlElement(child)) continue;
838
- visit(child, nextDepth);
839
- if (items.length >= maxItems) return;
840
- }
841
- };
842
- withSelectorIndexPass(root.ownerDocument, () => {
843
- for (const el of groupScopedLayerRoots(root, options.activeGroupElement ?? null)) visit(el, 0);
844
- });
845
- return items;
846
- }
847
- function liveLayerElement(layer, doc, activeCompositionPath) {
848
- if (layer.element.isConnected || !doc) return layer.element;
849
- return findElementForSelection(doc, layer, activeCompositionPath) ?? layer.element;
850
- }
851
- function buildDomEditStylePatchOperation(property, value, childLocator) {
852
- return {
853
- type: "inline-style",
854
- property,
855
- value,
856
- ...childLocator
857
- };
858
- }
859
- function buildDomEditTextPatchOperation(value, childLocator) {
860
- return { type: "text-content", property: "text", value, ...childLocator };
861
- }
862
- function buildDomEditRichTextPatchOperation(value) {
863
- return { type: "rich-text", property: "", value };
864
- }
865
- function hasSupportedDirectEdit(capabilities) {
866
- return capabilities.canEditStyles || capabilities.canMove || capabilities.canResize || capabilities.canApplyManualOffset || capabilities.canApplyManualSize || capabilities.canApplyManualRotation;
867
- }
868
- function getDomEditNonEditableReason(element, selection) {
869
- if (!selection) {
870
- return "No stable source target";
871
- }
872
- if (selection.element !== element) {
873
- return selection.isCompositionHost ? "Nested composition boundary" : `Selection resolves to ${selection.label}`;
874
- }
875
- if (!hasSupportedDirectEdit(selection.capabilities)) {
876
- return selection.capabilities.reasonIfDisabled ?? "No supported direct edits";
877
- }
878
- return null;
879
- }
880
- function getDomEditTargetKey(selection) {
881
- return [
882
- selection.sourceFile || "index.html",
883
- selection.hfId ?? "",
884
- selection.id ?? "",
885
- selection.selector ?? "",
886
- selection.selectorIndex ?? ""
887
- ].join("|");
888
- }
889
- function isTextEditableSelection(selection) {
890
- return resolveEditingSections(domEditSelectionToFacts(selection)).text;
891
- }
892
- function readHfId(element) {
893
- return element.getAttribute("data-hf-id")?.trim() || void 0;
894
- }
895
- function buildDomEditPatchTarget(selection) {
896
- return {
897
- id: selection.id,
898
- hfId: selection.hfId,
899
- selector: selection.selector,
900
- selectorIndex: selection.selectorIndex
901
- };
902
- }
903
-
904
- export {
905
- isSdkFamilyEnabled,
906
- STUDIO_SDK_CUTOVER_ENABLED,
907
- STUDIO_SDK_CUTOVER_FAMILIES,
908
- STUDIO_SDK_RESOLVER_SHADOW_ENABLED,
909
- STUDIO_FLAT_INSPECTOR_ENABLED,
910
- manualEditingAvailability_exports,
911
- studioApiFetch,
912
- isElementComputedVisible,
913
- getDomLayerPatchTarget,
914
- resolveAllVisualDomEditTargets,
915
- findElementForSelection,
916
- findPreviewNode,
917
- findElementForTimelineElement,
918
- DOM_EDIT_LAYER_OBSERVER_INIT,
919
- createDomEditLayerWalkCache,
920
- drainPendingLayerMutations,
921
- collectDomEditTextFields,
922
- serializeDomEditTextFields,
923
- buildDefaultDomEditTextField,
924
- buildTextFieldChildLocator,
925
- domEditSelectionToFacts,
926
- resolveDomEditCapabilities,
927
- resolveDomEditSelection,
928
- refreshDomEditSelection,
929
- getDomEditLayerKey,
930
- countDomEditChildLayers,
931
- collectDomEditLayerItems,
932
- liveLayerElement,
933
- buildDomEditStylePatchOperation,
934
- buildDomEditTextPatchOperation,
935
- buildDomEditRichTextPatchOperation,
936
- getDomEditNonEditableReason,
937
- getDomEditTargetKey,
938
- isTextEditableSelection,
939
- readHfId,
940
- buildDomEditPatchTarget
941
- };
942
- //# sourceMappingURL=chunk-PEAKCOUW.js.map