hyperframes 0.8.113 → 0.8.115

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 (169) hide show
  1. package/dist/{add-ILIGSLV4.js → add-ZSLFODRZ.js} +15 -14
  2. package/dist/{animatedGifPrep-U7FMC7DB.js → animatedGifPrep-72A45YER.js} +5 -5
  3. package/dist/{asset-OFDEIAGM.js → asset-SGDOHBBN.js} +2 -2
  4. package/dist/{assetCataloger-5LCGR5XU.js → assetCataloger-Q7BCDARF.js} +2 -2
  5. package/dist/{auth-5JDDEX2M.js → auth-5JGFN7SV.js} +2 -2
  6. package/dist/{autoUpdate-JXVZVJCV.js → autoUpdate-ZVTMYO7Z.js} +2 -2
  7. package/dist/{backgroundChecks-BBWGY3V6.js → backgroundChecks-IY3G5G2D.js} +3 -3
  8. package/dist/backgroundChecksWorker.js +3 -3
  9. package/dist/{batchRender-QVJ7NEUH.js → batchRender-QVLLL5DN.js} +3 -3
  10. package/dist/{beats-YEYVQMX6.js → beats-66KZIB5V.js} +14 -10
  11. package/dist/{benchmark-J2V46VWI.js → benchmark-AWFKSWQH.js} +11 -11
  12. package/dist/{browser-XBWASLD2.js → browser-J54EXMCE.js} +8 -8
  13. package/dist/{bundleWithLocalizedFonts-4CVITCYK.js → bundleWithLocalizedFonts-BLLHP2TO.js} +2 -2
  14. package/dist/{capture-GLHK4ST7.js → capture-D4HRSVSK.js} +2 -2
  15. package/dist/{capture-F2Y7TIHU.js → capture-SLI2I5BS.js} +16 -11
  16. package/dist/{catalog-3QDMTDK2.js → catalog-BUMLQU7L.js} +15 -14
  17. package/dist/{check-O3RR4NWI.js → check-HEZUK62C.js} +31 -29
  18. package/dist/{checkBrowser-K36DAG4S.js → checkBrowser-RVJM6IUO.js} +30 -28
  19. package/dist/{chunk-EMZF2TPA.js → chunk-2DX6JYL2.js} +2 -2
  20. package/dist/{chunk-BOUDTDBQ.js → chunk-2GWVY66H.js} +1 -1
  21. package/dist/{chunk-P3FGUSFK.js → chunk-2H37RGJ2.js} +7 -7
  22. package/dist/{chunk-7543YIMQ.js → chunk-3J4EBX5M.js} +1 -1
  23. package/dist/{chunk-3XPZJUKM.js → chunk-3R6P5BIG.js} +2 -2
  24. package/dist/{chunk-ZZIXIOK2.js → chunk-3YTWSGBV.js} +4 -4
  25. package/dist/{chunk-HYXL3VJA.js → chunk-4HIF3LI3.js} +5 -5
  26. package/dist/{chunk-HTQR7SUZ.js → chunk-4P2TOD7N.js} +1 -1
  27. package/dist/{chunk-G2T2X6FZ.js → chunk-5MXN7WM4.js} +2 -2
  28. package/dist/{chunk-2DBYGR4N.js → chunk-5YSA3YXO.js} +14 -18
  29. package/dist/{chunk-7CGIICLA.js → chunk-6SEUZGID.js} +3 -3
  30. package/dist/{chunk-VLC7JS4K.js → chunk-74RAXWDF.js} +1 -1
  31. package/dist/{chunk-ZYSS3JED.js → chunk-AXXK3LWL.js} +1 -1
  32. package/dist/chunk-BDNCUMZM.js +2961 -0
  33. package/dist/{chunk-E52XEEAA.js → chunk-BQG33YTI.js} +1 -1
  34. package/dist/{chunk-QPR4N2D4.js → chunk-CVBWF2MD.js} +1 -1
  35. package/dist/{chunk-R4NWAW35.js → chunk-HOBR4IHC.js} +7 -7
  36. package/dist/{chunk-XZM2I47O.js → chunk-HPWPLV5J.js} +2 -2
  37. package/dist/{chunk-FCEFKWPM.js → chunk-IEE7GIVX.js} +1 -1
  38. package/dist/{chunk-L5QASNBN.js → chunk-IOJAVV6J.js} +1 -1
  39. package/dist/{chunk-DDK22K3I.js → chunk-KLZ7OCHR.js} +3 -3
  40. package/dist/{chunk-OCNCK5FQ.js → chunk-M7XTMZF5.js} +1 -1
  41. package/dist/{chunk-GDJ74GHW.js → chunk-MPB7BQT7.js} +1 -1
  42. package/dist/{chunk-VIJ35BJ6.js → chunk-ORAISNGN.js} +14 -17
  43. package/dist/{chunk-IP3XINRB.js → chunk-P6LJ4Y32.js} +23 -2944
  44. package/dist/chunk-P73WQPSB.js +93 -0
  45. package/dist/{chunk-VTP4VSRP.js → chunk-PLP4K6WZ.js} +194 -52
  46. package/dist/{chunk-LMC46FK5.js → chunk-QMFCL2ZN.js} +1 -1
  47. package/dist/{chunk-DR7QW6C5.js → chunk-QXNRRMBQ.js} +2 -2
  48. package/dist/{chunk-C6AIZOQN.js → chunk-RRPJEHHW.js} +1 -1
  49. package/dist/{chunk-FXHVADV6.js → chunk-SAO3NQPF.js} +1 -1
  50. package/dist/{chunk-3IUSKIZW.js → chunk-SC7ICSIU.js} +1 -1
  51. package/dist/{chunk-FW7K32YT.js → chunk-SK53U3PF.js} +1 -1
  52. package/dist/{chunk-XXKBPGPJ.js → chunk-SOEQWMNS.js} +2 -2
  53. package/dist/{chunk-L5SYYW2P.js → chunk-SSZYJCAL.js} +2 -2
  54. package/dist/{chunk-U4VSY56O.js → chunk-T5HXGUM3.js} +1 -1
  55. package/dist/{chunk-ENHAGQEP.js → chunk-TMCJPHPP.js} +1 -1
  56. package/dist/{chunk-XFJXFNJF.js → chunk-TWJT2RGZ.js} +27 -12
  57. package/dist/{chunk-ZMMSMDCA.js → chunk-VDASTWUM.js} +1 -1
  58. package/dist/{chunk-T3NMEYGM.js → chunk-WZYHTXZY.js} +1 -1
  59. package/dist/{chunk-IRJBTYJF.js → chunk-XJQ7TRLG.js} +1 -1
  60. package/dist/{chunk-OEA2J2TF.js → chunk-Y2Y4LBJD.js} +3 -3
  61. package/dist/{chunk-SIN32SJB.js → chunk-YNHP6OFJ.js} +2 -2
  62. package/dist/{chunk-4KGMIOMY.js → chunk-ZBQP54CD.js} +10 -7
  63. package/dist/{clean-RPB34TT6.js → clean-X6Y252ZC.js} +14 -14
  64. package/dist/cli.js +53 -52
  65. package/dist/{cloud-QECFFPKC.js → cloud-EE4GALWR.js} +4 -4
  66. package/dist/{cloudrun-BML6ZG7K.js → cloudrun-Y6A42KHE.js} +3 -3
  67. package/dist/{compare-PF6WHQ4T.js → compare-K6XJZ3OC.js} +25 -23
  68. package/dist/{compiler-ZHVIEP26.js → compiler-DYACPLUW.js} +2 -2
  69. package/dist/{component-4ENCNLED.js → component-T6IYSCFP.js} +3 -3
  70. package/dist/{compositions-5UA33RSG.js → compositions-4KUTNS5L.js} +10 -10
  71. package/dist/{delete-SARS5LIK.js → delete-C64TWAPE.js} +2 -2
  72. package/dist/{dist-OKRUIHYU.js → dist-KNGSQALD.js} +2 -2
  73. package/dist/{doctor-TSAQGYP4.js → doctor-WJXZK5QN.js} +9 -9
  74. package/dist/{events-3HUO73ZE.js → events-FVG3Y6Q4.js} +8 -8
  75. package/dist/{events-SZ5NWYWD.js → events-QRWJBSV4.js} +7 -7
  76. package/dist/{feedback-42OTOFC6.js → feedback-NQHRUOZP.js} +9 -9
  77. package/dist/{figma-RYNFCYXB.js → figma-MEX4CSIM.js} +3 -3
  78. package/dist/fontLocalizeCli.js +7 -7
  79. package/dist/{get-IRHLG5OQ.js → get-CMJIHGSA.js} +2 -2
  80. package/dist/{gpuPolicy-LRMOZXFU.js → gpuPolicy-5S4OZDME.js} +5 -5
  81. package/dist/{grade-compare-KGJP5HV7.js → grade-compare-NIDMIUGZ.js} +25 -23
  82. package/dist/{help-C5HS56RZ.js → help-G6AWAWJW.js} +1 -1
  83. package/dist/{history-DFJNDM2T.js → history-ZBOK2JQF.js} +20 -18
  84. package/dist/hyperframe-runtime.js +36 -36
  85. package/dist/hyperframe.manifest.json +1 -1
  86. package/dist/hyperframe.runtime.iife.js +36 -36
  87. package/dist/hyperframes-player.global.js +1 -1
  88. package/dist/{info-26GTDTKN.js → info-2ORQZ6I2.js} +10 -10
  89. package/dist/{init-RXA6NI73.js → init-3PSKH6UR.js} +22 -21
  90. package/dist/{inspect-2S5GAZYC.js → inspect-NR54RMEE.js} +26 -24
  91. package/dist/{installer-DGYYDGWJ.js → installer-YQUWHYBZ.js} +5 -4
  92. package/dist/{keyframes-WBMAX7XZ.js → keyframes-KT7T4AEV.js} +11 -11
  93. package/dist/{lambda-OQBFCEFA.js → lambda-3FF4V3X3.js} +4 -4
  94. package/dist/{layout-ZRU7PXBG.js → layout-RB3M37ER.js} +26 -24
  95. package/dist/{lint-ATVNZ6FG.js → lint-HR57M5YP.js} +11 -11
  96. package/dist/{list-E2GHYPCQ.js → list-YDXYHXHF.js} +2 -2
  97. package/dist/{login-LOC4KA7H.js → login-N6UNRVYW.js} +4 -4
  98. package/dist/{media-treatment-L43MVH2V.js → media-treatment-UXJOTNRO.js} +11 -11
  99. package/dist/{models-JF5OOZ5A.js → models-Z3XFMGXB.js} +6 -6
  100. package/dist/{motionShot-BJ5CLYMN.js → motionShot-KQMCXJ77.js} +15 -12
  101. package/dist/{normalize-audio-K33FKGAF.js → normalize-audio-XJQMDWRV.js} +10 -10
  102. package/dist/{pipeline-IWPF5ZMK.js → pipeline-U3OISHWV.js} +5 -5
  103. package/dist/{play-PHHXYCQI.js → play-XP77PML5.js} +20 -19
  104. package/dist/{preflight-2GH2Z4GZ.js → preflight-CANFVC4Y.js} +6 -6
  105. package/dist/{present-KBFK2YVB.js → present-MWGA3O4S.js} +15 -15
  106. package/dist/{preview-T3E5TFDC.js → preview-X5GWZ3Q6.js} +31 -24
  107. package/dist/{producer-SL66UNEP.js → producer-B2IHU7MA.js} +1 -1
  108. package/dist/{projectConfig-7AKXZNNR.js → projectConfig-2A64YU5H.js} +7 -6
  109. package/dist/{publication-B2OERUY7.js → publication-CFYBPLRS.js} +2 -2
  110. package/dist/{publish-ZGKT7KED.js → publish-WE6AS77D.js} +8 -7
  111. package/dist/{remove-background-4LRTT6YL.js → remove-background-XSDOCVN5.js} +6 -6
  112. package/dist/{render-H6RSJF2V.js → render-5TMRIC73.js} +11 -11
  113. package/dist/{render-OKNPNMFS.js → render-HVZUCLYW.js} +21 -20
  114. package/dist/{render-TGCDBKMP.js → render-QX6AKB6Y.js} +3 -3
  115. package/dist/{render-batch-WRQFW4UC.js → render-batch-QJXFVTDE.js} +3 -3
  116. package/dist/{renderCancellation-BFCQYGVV.js → renderCancellation-WSSSHRFR.js} +5 -5
  117. package/dist/{resolver-37UOGAMT.js → resolver-WTXO6WXA.js} +5 -4
  118. package/dist/{sherpa-SDVKYXCX.js → sherpa-S6ZBBEFO.js} +6 -6
  119. package/dist/skills/hyperframes/SKILL.md +4 -0
  120. package/dist/skills/hyperframes-cli/SKILL.md +8 -0
  121. package/dist/skills/hyperframes-cli/references/upgrade-info-misc.md +8 -0
  122. package/dist/skills/media-use/audio/scripts/audio.mjs +4 -1
  123. package/dist/skills/media-use/audio/scripts/audio.test.mjs +33 -0
  124. package/dist/skills/media-use/audio/scripts/lib/tts.mjs +1 -0
  125. package/dist/skills/media-use/audio/scripts/lib/tts.test.mjs +44 -1
  126. package/dist/{skills-O25ZTFTO.js → skills-CDRSTETB.js} +10 -10
  127. package/dist/{skillsUpdateCheck-Y2V4OMMT.js → skillsUpdateCheck-FKREJXSF.js} +3 -3
  128. package/dist/{snapshot-KGM2HZIC.js → snapshot-T4PFSXTH.js} +142 -51
  129. package/dist/{src-PLWCT745.js → src-5BZDQAVN.js} +6 -6
  130. package/dist/{src-PJJ6NISA.js → src-IZMCUYK7.js} +4 -4
  131. package/dist/{staticProjectServer-OCE7GU5S.js → staticProjectServer-VN4ARAH4.js} +14 -13
  132. package/dist/{status-LENRPQS5.js → status-OJZWJB53.js} +5 -5
  133. package/dist/studio/assets/{hyperframes-player-DzJbtQVO.js → hyperframes-player-C-9N8nk0.js} +1 -1
  134. package/dist/studio/assets/{index-n5FUn1xv.js → index-BoUM6Xqb.js} +1 -1
  135. package/dist/studio/assets/{index-DRhF3v4Z.js → index-CAvZ0AA-.js} +204 -204
  136. package/dist/studio/assets/{index-DgwDQK5G.js → index-CVuorIMv.js} +1 -1
  137. package/dist/studio/assets/index-t1LH6H5H.css +1 -0
  138. package/dist/studio/{chunk-K47E2ZJA.js → chunk-5EKWJZLM.js} +504 -17
  139. package/dist/studio/chunk-5EKWJZLM.js.map +1 -0
  140. package/dist/studio/{chunk-VWT7STY3.js → chunk-J6Q572FA.js} +2 -2
  141. package/dist/studio/{chunk-BIUXP3PG.js → chunk-TXZMMOMA.js} +43 -276
  142. package/dist/studio/chunk-TXZMMOMA.js.map +1 -0
  143. package/dist/studio/{domEditingLayers-V67MS4WP.js → domEditingLayers-D7VYFJJD.js} +3 -5
  144. package/dist/studio/index.d.ts +46 -22
  145. package/dist/studio/index.html +2 -2
  146. package/dist/studio/index.js +3899 -3487
  147. package/dist/studio/index.js.map +1 -1
  148. package/dist/studio/player.js +2 -2
  149. package/dist/studio/styles.css +1 -1
  150. package/dist/{studio-api-IEQ5BIHT.js → studio-api-CIO2NKK5.js} +9 -7
  151. package/dist/{studioServer-LXJ34MGN.js → studioServer-G5GNYWDI.js} +45 -45
  152. package/dist/{system-4KRSV2B7.js → system-PPNNGVIM.js} +5 -5
  153. package/dist/{telemetry-R3BPD6VK.js → telemetry-GMDMISOX.js} +8 -8
  154. package/dist/{timeline-N5UKVS2S.js → timeline-5LSQX4OS.js} +14 -14
  155. package/dist/{tokens-774UBF2R.js → tokens-VBXAT7CK.js} +2 -2
  156. package/dist/{transcribe-IP74EZLM.js → transcribe-GYCAIIEQ.js} +11 -11
  157. package/dist/{transcribe-3UXXEDXX.js → transcribe-VGYAWRXS.js} +6 -6
  158. package/dist/{updateCheck-EXHNAPKI.js → updateCheck-AZEREUQV.js} +2 -2
  159. package/dist/{upgrade-A4M3O2F2.js → upgrade-S63QN2LA.js} +2 -2
  160. package/dist/{urlDownloader-4KNER64L.js → urlDownloader-SM6ODN5O.js} +4 -4
  161. package/dist/usage-EC3KFUIJ.js +2139 -0
  162. package/dist/{validate-DV75GM6J.js → validate-7MNUK5MH.js} +15 -14
  163. package/dist/{video-GINAMW5I.js → video-JEOHARTC.js} +5 -5
  164. package/package.json +1 -1
  165. package/dist/studio/assets/index-DbfKVTId.css +0 -1
  166. package/dist/studio/chunk-BIUXP3PG.js.map +0 -1
  167. package/dist/studio/chunk-K47E2ZJA.js.map +0 -1
  168. /package/dist/studio/{chunk-VWT7STY3.js.map → chunk-J6Q572FA.js.map} +0 -0
  169. /package/dist/studio/{domEditingLayers-V67MS4WP.js.map → domEditingLayers-D7VYFJJD.js.map} +0 -0
@@ -38,6 +38,473 @@ function getSourceScopedSelectorIndex(doc, el, selector, sourceFile, resolveSour
38
38
  }
39
39
  }
40
40
 
41
+ // src/components/editor/domEditingDom.ts
42
+ import { COLOR_GRADING_SOURCE_HIDDEN_ATTR } from "@hyperframes/core/color-grading";
43
+
44
+ // src/components/editor/domEditingTypes.ts
45
+ var CURATED_STYLE_PROPERTIES = [
46
+ "position",
47
+ "display",
48
+ "top",
49
+ "left",
50
+ "right",
51
+ "bottom",
52
+ "inset",
53
+ "width",
54
+ "height",
55
+ "gap",
56
+ "justify-content",
57
+ "align-items",
58
+ "flex-direction",
59
+ "font-size",
60
+ "font-style",
61
+ "font-weight",
62
+ "font-family",
63
+ "line-height",
64
+ "letter-spacing",
65
+ "text-align",
66
+ "text-transform",
67
+ "color",
68
+ "background-color",
69
+ "background-image",
70
+ "opacity",
71
+ "mix-blend-mode",
72
+ "border-radius",
73
+ "border-width",
74
+ "border-style",
75
+ "border-color",
76
+ "border-top-width",
77
+ "border-top-style",
78
+ "border-top-color",
79
+ "outline-color",
80
+ "overflow",
81
+ "clip-path",
82
+ "box-shadow",
83
+ "filter",
84
+ "backdrop-filter",
85
+ "z-index",
86
+ "transform",
87
+ "object-fit",
88
+ "object-position"
89
+ ];
90
+
91
+ // src/components/editor/domEditingDom.ts
92
+ import { parsePx } from "@hyperframes/core/editing";
93
+ function isHtmlElement(value) {
94
+ return typeof value === "object" && value !== null && "nodeType" in value && typeof value.nodeType === "number" && value.nodeType === 1;
95
+ }
96
+ function isTextBearingTag(tagName) {
97
+ return ["div", "span", "p", "strong", "h1", "h2", "h3", "h4", "h5", "h6"].includes(tagName);
98
+ }
99
+ function isEditableTextLeaf(el) {
100
+ return isTextBearingTag(el.tagName.toLowerCase()) && el.children.length === 0;
101
+ }
102
+ function elementRendersItself(win, el) {
103
+ const computed = win.getComputedStyle(el);
104
+ if (computed.display === "none" || computed.visibility === "hidden") return false;
105
+ const opacity = Number.parseFloat(computed.opacity);
106
+ return !(Number.isFinite(opacity) && opacity <= 0.01 && !el.hasAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR));
107
+ }
108
+ function isElementVisibleThroughAncestors(el, memo) {
109
+ const win = el.ownerDocument.defaultView;
110
+ if (!win) return true;
111
+ const pending = [];
112
+ let inherited = true;
113
+ for (let node = el; node; node = node.parentElement) {
114
+ const answered = memo?.get(node);
115
+ if (answered !== void 0) {
116
+ inherited = answered;
117
+ break;
118
+ }
119
+ pending.push(node);
120
+ }
121
+ for (let i = pending.length - 1; i >= 0; i -= 1) {
122
+ const node = pending[i];
123
+ inherited = inherited && elementRendersItself(win, node);
124
+ memo?.set(node, inherited);
125
+ }
126
+ return inherited;
127
+ }
128
+ function getCuratedComputedStyles(el) {
129
+ const styles = {};
130
+ const computed = el.ownerDocument.defaultView?.getComputedStyle(el);
131
+ if (!computed) return styles;
132
+ for (const prop of CURATED_STYLE_PROPERTIES) {
133
+ const value = computed.getPropertyValue(prop);
134
+ if (value) styles[prop] = value;
135
+ }
136
+ return styles;
137
+ }
138
+ function getInlineStyles(el) {
139
+ const styles = {};
140
+ for (const property of CURATED_STYLE_PROPERTIES) {
141
+ const value = el.style.getPropertyValue(property);
142
+ if (value) styles[property] = value;
143
+ }
144
+ return styles;
145
+ }
146
+ function getDataAttributes(el) {
147
+ const attrs = {};
148
+ for (const attr of el.attributes) {
149
+ if (attr.name.startsWith("data-")) {
150
+ attrs[attr.name.slice(5)] = attr.value;
151
+ }
152
+ }
153
+ return attrs;
154
+ }
155
+ function findClosestByAttribute(el, attributeNames) {
156
+ let current = el;
157
+ while (current) {
158
+ const candidate = current;
159
+ if (attributeNames.some((attribute) => candidate.hasAttribute(attribute))) {
160
+ return candidate;
161
+ }
162
+ current = current.parentElement;
163
+ }
164
+ return null;
165
+ }
166
+ var compositionSourceMap = /* @__PURE__ */ new Map();
167
+ var compositionSourceMapRevision = 0;
168
+ function setCompositionSourceMap(map) {
169
+ compositionSourceMap = map;
170
+ compositionSourceMapRevision += 1;
171
+ }
172
+ function getCompositionSourceMapRevision() {
173
+ return compositionSourceMapRevision;
174
+ }
175
+ function sourceFromCompositionId(ownerRoot) {
176
+ if (!ownerRoot || compositionSourceMap.size === 0) return void 0;
177
+ const authored = ownerRoot.getAttribute("data-hf-original-composition-id");
178
+ const current = ownerRoot.getAttribute("data-composition-id");
179
+ return (authored ? compositionSourceMap.get(authored) : void 0) ?? (current ? compositionSourceMap.get(current) : void 0);
180
+ }
181
+ function getSourceFileForElement(el, activeCompositionPath) {
182
+ const sourceHost = findClosestByAttribute(el, ["data-composition-file", "data-composition-src"]);
183
+ const ownerRoot = findClosestByAttribute(el, ["data-composition-id"]);
184
+ const sourceFile = sourceHost?.getAttribute("data-composition-file") ?? sourceHost?.getAttribute("data-composition-src") ?? ownerRoot?.getAttribute("data-composition-file") ?? ownerRoot?.getAttribute("data-composition-src") ?? sourceFromCompositionId(ownerRoot) ?? activeCompositionPath ?? "index.html";
185
+ return {
186
+ sourceFile,
187
+ compositionPath: sourceFile
188
+ };
189
+ }
190
+ function normalizeTimelineCompositionSource(value) {
191
+ const trimmed = value?.trim();
192
+ if (!trimmed) return void 0;
193
+ if (!/^([a-z][a-z0-9+.-]*:|\/)/i.test(trimmed)) return trimmed;
194
+ let pathname = trimmed;
195
+ try {
196
+ pathname = new URL(trimmed, "http://studio.local").pathname;
197
+ } catch {
198
+ pathname = trimmed;
199
+ }
200
+ for (const marker of ["/preview/comp/", "/preview/"]) {
201
+ const markerIndex = pathname.indexOf(marker);
202
+ if (markerIndex < 0) continue;
203
+ const sourcePath = pathname.slice(markerIndex + marker.length).replace(/^\/+/, "");
204
+ return sourcePath || trimmed;
205
+ }
206
+ return trimmed;
207
+ }
208
+ function escapeCssIdentifier(value) {
209
+ const css = globalThis.CSS;
210
+ if (typeof css?.escape === "function") return css.escape(value);
211
+ if (value === "-") return "\\-";
212
+ let escaped = "";
213
+ for (let index = 0; index < value.length; index += 1) {
214
+ const char = value[index] ?? "";
215
+ const code = char.charCodeAt(0);
216
+ if (code === 0) {
217
+ escaped += "\uFFFD";
218
+ continue;
219
+ }
220
+ const isDigit = code >= 48 && code <= 57;
221
+ const isUpperAlpha = code >= 65 && code <= 90;
222
+ const isLowerAlpha = code >= 97 && code <= 122;
223
+ const isControl = code >= 1 && code <= 31 || code === 127;
224
+ const isLeadingDigit = index === 0 && isDigit;
225
+ const isSecondDigitAfterDash = index === 1 && value.startsWith("-") && isDigit;
226
+ if (isControl || isLeadingDigit || isSecondDigitAfterDash) {
227
+ escaped += `\\${code.toString(16)} `;
228
+ continue;
229
+ }
230
+ if (isUpperAlpha || isLowerAlpha || isDigit || char === "-" || char === "_" || code >= 128) {
231
+ escaped += char;
232
+ continue;
233
+ }
234
+ escaped += `\\${char}`;
235
+ }
236
+ return escaped;
237
+ }
238
+ function escapeCssString(value) {
239
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\a ").replace(/\r/g, "\\d ").replace(/\f/g, "\\c ");
240
+ }
241
+ function querySelectorAllSafely(doc, selector) {
242
+ try {
243
+ return Array.from(doc.querySelectorAll(selector));
244
+ } catch {
245
+ return [];
246
+ }
247
+ }
248
+ function humanizeIdentifier(value) {
249
+ return value.replace(/\.html$/i, "").replace(/^compositions\//i, "").split("/").at(-1)?.replace(/[-_]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase()) ?? value;
250
+ }
251
+ function buildStableSelector(el) {
252
+ if (el.id) return `#${escapeCssIdentifier(el.id)}`;
253
+ const compositionId = el.getAttribute("data-composition-id");
254
+ if (compositionId) return `[data-composition-id="${escapeCssString(compositionId)}"]`;
255
+ const group = el.getAttribute("data-hf-group");
256
+ if (group) return `[data-hf-group="${escapeCssString(group)}"]`;
257
+ return getPreferredClassSelector(el);
258
+ }
259
+ function getPreferredClassSelector(el) {
260
+ const classes = Array.from(el.classList).map((value) => value.trim()).filter(Boolean);
261
+ if (classes.length === 0) return void 0;
262
+ const preferred = classes.find((value) => value !== "clip" && !value.startsWith("__hf-")) ?? classes[0];
263
+ return preferred ? `.${escapeCssIdentifier(preferred)}` : void 0;
264
+ }
265
+ function buildElementLabel(el) {
266
+ const compositionId = el.getAttribute("data-hf-original-composition-id") ?? el.getAttribute("data-composition-id");
267
+ if (compositionId && compositionId !== "main") {
268
+ return humanizeIdentifier(compositionId);
269
+ }
270
+ const compositionSrc = el.getAttribute("data-composition-src") ?? el.getAttribute("data-composition-file");
271
+ if (compositionSrc) {
272
+ return humanizeIdentifier(compositionSrc);
273
+ }
274
+ const group = el.getAttribute("data-hf-group");
275
+ if (group) return group;
276
+ if (el.id) return humanizeIdentifier(el.id);
277
+ const preferredClass = getPreferredClassSelector(el);
278
+ if (preferredClass) {
279
+ return humanizeIdentifier(preferredClass.replace(/^\./, ""));
280
+ }
281
+ const text = (el.textContent ?? "").trim().replace(/\s+/g, " ");
282
+ if (text) return text.length > 40 ? `${text.slice(0, 39)}\u2026` : text;
283
+ return el.tagName.toLowerCase();
284
+ }
285
+ function getSelectorIndex(doc, el, selector, sourceFile, activeCompositionPath) {
286
+ if (!selector?.startsWith(".")) return void 0;
287
+ return getSourceScopedSelectorIndex(
288
+ doc,
289
+ el,
290
+ selector,
291
+ sourceFile,
292
+ (candidate) => isHtmlElement(candidate) ? getSourceFileForElement(candidate, activeCompositionPath).sourceFile : void 0
293
+ );
294
+ }
295
+
296
+ // src/player/lib/timelineText.ts
297
+ import { isHtmlElement as isHtmlElement2 } from "@hyperframes/core/runtime/dom-realm";
298
+
299
+ // src/utils/rounding.ts
300
+ function roundTo3(val) {
301
+ return Math.round(val * 1e3) / 1e3;
302
+ }
303
+ function roundToLayoutPx(val) {
304
+ return Math.round(val);
305
+ }
306
+ function roundToCenti(val) {
307
+ return Math.round(val * 100) / 100;
308
+ }
309
+
310
+ // src/components/editor/colorValue.ts
311
+ function clampChannel(value) {
312
+ return Math.max(0, Math.min(255, Math.round(value)));
313
+ }
314
+ function clampAlpha(value) {
315
+ return Math.max(0, Math.min(1, value));
316
+ }
317
+ function toHex(value) {
318
+ return clampChannel(value).toString(16).padStart(2, "0");
319
+ }
320
+ function formatAlpha(value) {
321
+ return `${roundToCenti(clampAlpha(value))}`;
322
+ }
323
+ function parseComponent(value, scale) {
324
+ return value.endsWith("%") ? Number(value.slice(0, -1)) * scale / 100 : Number(value);
325
+ }
326
+ var NUMBER = String.raw`(?:\d+(?:\.\d+)?|\.\d+)`;
327
+ var COMMA_RGB = new RegExp(
328
+ String.raw`^rgba?\(\s*(${NUMBER})\s*,\s*(${NUMBER})\s*,\s*(${NUMBER})(?:\s*,\s*(${NUMBER}))?\s*\)$`
329
+ );
330
+ var SPACE_RGB = new RegExp(
331
+ String.raw`^rgba?\(\s*(${NUMBER}%?)\s+(${NUMBER}%?)\s+(${NUMBER}%?)(?:\s*\/\s*(${NUMBER}%?))?\s*\)$`
332
+ );
333
+ function parseSerializedColor(value) {
334
+ const trimmed = value.trim().toLowerCase();
335
+ if (!trimmed) return null;
336
+ if (trimmed === "transparent") {
337
+ return { red: 0, green: 0, blue: 0, alpha: 0 };
338
+ }
339
+ const hex = trimmed.match(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/);
340
+ if (hex) {
341
+ const digits = hex[1].length <= 4 ? [...hex[1]].map((digit) => digit + digit).join("") : hex[1];
342
+ return {
343
+ red: Number.parseInt(digits.slice(0, 2), 16),
344
+ green: Number.parseInt(digits.slice(2, 4), 16),
345
+ blue: Number.parseInt(digits.slice(4, 6), 16),
346
+ alpha: digits.length === 8 ? Number.parseInt(digits.slice(6, 8), 16) / 255 : 1
347
+ };
348
+ }
349
+ const rgba = trimmed.match(COMMA_RGB) ?? trimmed.match(SPACE_RGB);
350
+ if (rgba) {
351
+ return {
352
+ red: clampChannel(parseComponent(rgba[1], 255)),
353
+ green: clampChannel(parseComponent(rgba[2], 255)),
354
+ blue: clampChannel(parseComponent(rgba[3], 255)),
355
+ alpha: clampAlpha(rgba[4] != null ? parseComponent(rgba[4], 1) : 1)
356
+ };
357
+ }
358
+ return null;
359
+ }
360
+ var colorContext = null;
361
+ function canResolveInBrowser(value) {
362
+ return typeof document !== "undefined" && typeof CSS !== "undefined" && CSS.supports("color", value) && !/\bcurrentcolor\b|\bvar\s*\(|\blight-dark\s*\(/i.test(value);
363
+ }
364
+ function parseBrowserColor(value) {
365
+ try {
366
+ if (!canResolveInBrowser(value)) return null;
367
+ colorContext ??= document.createElement("canvas").getContext("2d");
368
+ if (!colorContext) return null;
369
+ return parseCanvasColor(
370
+ colorContext,
371
+ `color(from ${value} srgb r g b / alpha)`,
372
+ parseSrgbSerialization
373
+ ) ?? parseCanvasColor(colorContext, value, parseSerializedColor);
374
+ } catch {
375
+ return null;
376
+ }
377
+ }
378
+ function parseCanvasColor(context, value, parse) {
379
+ const serialized = readCanvasColor(context, value);
380
+ return serialized === null ? null : parse(serialized);
381
+ }
382
+ function readCanvasColor(context, value) {
383
+ context.fillStyle = "transparent";
384
+ context.fillStyle = value;
385
+ const first = context.fillStyle;
386
+ context.fillStyle = "white";
387
+ context.fillStyle = value;
388
+ return typeof first === "string" && first === context.fillStyle ? first : null;
389
+ }
390
+ function parseSrgbSerialization(serialized) {
391
+ const match = serialized.match(/^color\(srgb ([^ ]+) ([^ ]+) ([^ /)]+)(?: \/ ([^)]+))?\)$/);
392
+ if (!match) return null;
393
+ const channels = match.slice(1, 4).map(Number);
394
+ const alpha = match[4] === void 0 ? 1 : Number(match[4]);
395
+ if (!channels.every(Number.isFinite) || !Number.isFinite(alpha)) return null;
396
+ return {
397
+ red: clampChannel(channels[0] * 255),
398
+ green: clampChannel(channels[1] * 255),
399
+ blue: clampChannel(channels[2] * 255),
400
+ alpha: clampAlpha(alpha)
401
+ };
402
+ }
403
+ function parseCssColor(value) {
404
+ return parseSerializedColor(value) ?? parseBrowserColor(value.trim());
405
+ }
406
+ function resolvePickerColor(value, element, fallback) {
407
+ const view = element?.ownerDocument.defaultView;
408
+ const parsed = (value ? parseCssColor(value) : null) ?? (element && view ? parseCssColor(view.getComputedStyle(element).color) : null);
409
+ return parsed ? toHexColor(parsed) : fallback;
410
+ }
411
+ function toHexColor(color) {
412
+ return `#${toHex(color.red)}${toHex(color.green)}${toHex(color.blue)}`;
413
+ }
414
+ function formatCssColor(color) {
415
+ const red = clampChannel(color.red);
416
+ const green = clampChannel(color.green);
417
+ const blue = clampChannel(color.blue);
418
+ const alpha = clampAlpha(color.alpha);
419
+ if (alpha >= 1) {
420
+ return `rgb(${red}, ${green}, ${blue})`;
421
+ }
422
+ return `rgba(${red}, ${green}, ${blue}, ${formatAlpha(alpha)})`;
423
+ }
424
+ function rgbToHsv(color) {
425
+ const red = clampChannel(color.red) / 255;
426
+ const green = clampChannel(color.green) / 255;
427
+ const blue = clampChannel(color.blue) / 255;
428
+ const max = Math.max(red, green, blue);
429
+ const min = Math.min(red, green, blue);
430
+ const delta = max - min;
431
+ let hue = 0;
432
+ if (delta !== 0) {
433
+ if (max === red) {
434
+ hue = 60 * ((green - blue) / delta % 6);
435
+ } else if (max === green) {
436
+ hue = 60 * ((blue - red) / delta + 2);
437
+ } else {
438
+ hue = 60 * ((red - green) / delta + 4);
439
+ }
440
+ }
441
+ if (hue < 0) hue += 360;
442
+ return {
443
+ hue,
444
+ saturation: max === 0 ? 0 : delta / max,
445
+ value: max
446
+ };
447
+ }
448
+ function hsvToRgb(color) {
449
+ const hue = (color.hue % 360 + 360) % 360 / 60;
450
+ const saturation = Math.max(0, Math.min(1, color.saturation));
451
+ const value = Math.max(0, Math.min(1, color.value));
452
+ const chroma = value * saturation;
453
+ const x = chroma * (1 - Math.abs(hue % 2 - 1));
454
+ const m = value - chroma;
455
+ let red = 0;
456
+ let green = 0;
457
+ let blue = 0;
458
+ if (hue >= 0 && hue < 1) {
459
+ red = chroma;
460
+ green = x;
461
+ } else if (hue >= 1 && hue < 2) {
462
+ red = x;
463
+ green = chroma;
464
+ } else if (hue >= 2 && hue < 3) {
465
+ green = chroma;
466
+ blue = x;
467
+ } else if (hue >= 3 && hue < 4) {
468
+ green = x;
469
+ blue = chroma;
470
+ } else if (hue >= 4 && hue < 5) {
471
+ red = x;
472
+ blue = chroma;
473
+ } else {
474
+ red = chroma;
475
+ blue = x;
476
+ }
477
+ return {
478
+ red: clampChannel((red + m) * 255),
479
+ green: clampChannel((green + m) * 255),
480
+ blue: clampChannel((blue + m) * 255)
481
+ };
482
+ }
483
+
484
+ // src/player/lib/timelineText.ts
485
+ function readTimelineText(el) {
486
+ if (!isHtmlElement2(el) || !isTextBearingTag(el.localName)) return void 0;
487
+ const children = Array.from(el.children);
488
+ if (!children.every((child) => isHtmlElement2(child) && isEditableTextLeaf(child)))
489
+ return void 0;
490
+ const value = el.textContent?.replace(/\s+/g, " ").trim();
491
+ if (!value) return void 0;
492
+ const style = getCuratedComputedStyles(el);
493
+ if ((style["background-image"] ?? "none") !== "none") return void 0;
494
+ const background = style["background-color"];
495
+ return {
496
+ value,
497
+ fontFamily: style["font-family"],
498
+ fontWeight: style["font-weight"],
499
+ color: style.color,
500
+ background: background && parseCssColor(background)?.alpha === 1 ? background : void 0
501
+ };
502
+ }
503
+ function sameTimelineText(a, b) {
504
+ if (!a || !b) return a === b;
505
+ return a.value === b.value && a.fontFamily === b.fontFamily && a.fontWeight === b.fontWeight && a.color === b.color && a.background === b.background;
506
+ }
507
+
41
508
  // src/player/lib/playbackAdapter.ts
42
509
  function isFinitePositive(value) {
43
510
  return Number.isFinite(value) && value > 0;
@@ -173,6 +640,7 @@ function wrapTimeline(tl) {
173
640
  // src/player/lib/timelineElementHelpers.ts
174
641
  import { HF_AUDIO_GROUP_TAG } from "@hyperframes/core/audio-groups";
175
642
  import { readElementFades } from "@hyperframes/core/audio-fade";
643
+ import { isHtmlElement as isHtmlElement3, isImageElement, isMediaElement } from "@hyperframes/core/runtime/dom-realm";
176
644
 
177
645
  // src/player/lib/storedVolume.ts
178
646
  function parseStoredVolume(text) {
@@ -253,21 +721,14 @@ function furthestClipEndFromSource(source) {
253
721
  if (!source) return 0;
254
722
  return furthestClipEndFromDocument(new DOMParser().parseFromString(source, "text/html"));
255
723
  }
256
- function isHtmlElement(el) {
257
- const HtmlElementCtor = el.ownerDocument.defaultView?.HTMLElement ?? globalThis.HTMLElement;
258
- return typeof HtmlElementCtor !== "undefined" && el instanceof HtmlElementCtor;
259
- }
260
724
  function isCompositionHost(el) {
261
725
  return el.hasAttribute("data-composition-id") || el.hasAttribute("data-composition-src") || el.hasAttribute("data-composition-file");
262
726
  }
263
727
  function resolveMediaElement(el) {
264
- const win = el.ownerDocument.defaultView ?? window;
265
- const MediaElementCtor = win.HTMLMediaElement ?? globalThis.HTMLMediaElement;
266
- const ImageElementCtor = win.HTMLImageElement ?? globalThis.HTMLImageElement;
267
- if (el instanceof MediaElementCtor || el instanceof ImageElementCtor) return el;
728
+ if (isMediaElement(el) || isImageElement(el)) return el;
268
729
  if (isCompositionHost(el)) return null;
269
730
  const candidate = el.querySelector("video, audio, img");
270
- return candidate instanceof MediaElementCtor || candidate instanceof ImageElementCtor ? candidate : null;
731
+ return isMediaElement(candidate) || isImageElement(candidate) ? candidate : null;
271
732
  }
272
733
  function readPlaybackStartAttributes(getAttr) {
273
734
  const playbackStartAttr = getAttr("data-playback-start") != null ? "playback-start" : getAttr("data-media-start") != null ? "media-start" : void 0;
@@ -321,6 +782,7 @@ function applyFadeMetadataFromElement(entry, el) {
321
782
  setOptional(entry, "fadeOut", fades.fadeOut > 0 ? fades.fadeOut : void 0);
322
783
  }
323
784
  function applyMediaMetadataFromElement(entry, el) {
785
+ setOptional(entry, "text", readTimelineText(el));
324
786
  applyPlaybackMetadataFromElement(entry, el);
325
787
  applyAudioMetadataFromElement(entry, el);
326
788
  applyFadeMetadataFromElement(entry, el);
@@ -329,9 +791,7 @@ function applyMediaMetadataFromElement(entry, el) {
329
791
  entry.tag = mediaEl.tagName.toLowerCase();
330
792
  const src = mediaEl.getAttribute("src");
331
793
  if (src) entry.src = src;
332
- const win = mediaEl.ownerDocument.defaultView ?? window;
333
- const MediaElementCtor = win.HTMLMediaElement ?? globalThis.HTMLMediaElement;
334
- if (typeof MediaElementCtor === "undefined" || !(mediaEl instanceof MediaElementCtor)) return;
794
+ if (!isMediaElement(mediaEl)) return;
335
795
  const sourceDurationAttr = el.getAttribute("data-source-duration") ?? mediaEl.getAttribute("data-source-duration");
336
796
  const sourceDuration = sourceDurationAttr ? parseFloat(sourceDurationAttr) : mediaEl.duration;
337
797
  if (Number.isFinite(sourceDuration) && sourceDuration > 0) {
@@ -351,10 +811,10 @@ function getTimelineElementDisplayLabel(input) {
351
811
  return tag ? `${tag} clip` : "Timeline clip";
352
812
  }
353
813
  function getTimelineElementSelector(el) {
354
- if (isHtmlElement(el) && el.id) return `#${CSS.escape(el.id)}`;
814
+ if (isHtmlElement3(el) && el.id) return `#${CSS.escape(el.id)}`;
355
815
  const compId = el.getAttribute("data-composition-id");
356
816
  if (compId) return `[data-composition-id="${CSS.escape(compId)}"]`;
357
- if (isHtmlElement(el)) {
817
+ if (isHtmlElement3(el)) {
358
818
  const classes = el.className.split(/\s+/).filter(Boolean);
359
819
  const firstClass = classes.find((className) => className !== "clip") ?? classes[0];
360
820
  if (firstClass) return `.${CSS.escape(firstClass)}`;
@@ -575,13 +1035,40 @@ export {
575
1035
  parseProjectHashRoute,
576
1036
  parseProjectIdFromHash,
577
1037
  buildProjectApiPath,
1038
+ roundTo3,
1039
+ roundToLayoutPx,
1040
+ roundToCenti,
1041
+ parseCssColor,
1042
+ resolvePickerColor,
1043
+ toHexColor,
1044
+ formatCssColor,
1045
+ rgbToHsv,
1046
+ hsvToRgb,
1047
+ withSelectorIndexPass,
1048
+ isHtmlElement,
1049
+ isEditableTextLeaf,
1050
+ isElementVisibleThroughAncestors,
1051
+ getCuratedComputedStyles,
1052
+ getInlineStyles,
1053
+ getDataAttributes,
1054
+ findClosestByAttribute,
1055
+ setCompositionSourceMap,
1056
+ getCompositionSourceMapRevision,
1057
+ getSourceFileForElement,
1058
+ normalizeTimelineCompositionSource,
1059
+ escapeCssString,
1060
+ querySelectorAllSafely,
1061
+ buildStableSelector,
1062
+ buildElementLabel,
1063
+ getSelectorIndex,
1064
+ parsePx,
1065
+ readTimelineText,
1066
+ sameTimelineText,
578
1067
  getAdapterDuration,
579
1068
  getDefaultStaticSeekPlaybackClock,
580
1069
  releaseStaticSeekCache,
581
1070
  resolveStaticSeekFallback,
582
1071
  wrapTimeline,
583
- withSelectorIndexPass,
584
- getSourceScopedSelectorIndex,
585
1072
  parseStoredVolume,
586
1073
  elementVolume,
587
1074
  LAYER_REVEAL_PRIOR_Z_ATTR,
@@ -613,4 +1100,4 @@ export {
613
1100
  findClipElementById,
614
1101
  createTimelineDomNodeResolver
615
1102
  };
616
- //# sourceMappingURL=chunk-K47E2ZJA.js.map
1103
+ //# sourceMappingURL=chunk-5EKWJZLM.js.map