@hyperframes/studio 0.9.39 → 0.9.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/assets/{codec-CY6KnWXa.js → codec-B_mpbc4w.js} +1 -1
  2. package/dist/assets/{hyperframes-player-B9-CuG_h.js → hyperframes-player-Dvi3I_mv.js} +1 -1
  3. package/dist/assets/{index-_pkzoYYF.js → index-B5ExwsOp.js} +146 -146
  4. package/dist/assets/{index-Bjz2UaYv.js → index-BrFm9Y5k.js} +1 -1
  5. package/dist/assets/{pausedVideoDecoder-Dr7nKUUu.js → pausedVideoDecoder-MHQ57yZ6.js} +1 -1
  6. package/dist/{chunk-NBULUIWH.js → chunk-4QQMX4BX.js} +17 -8
  7. package/dist/{chunk-ATDO3YLX.js → chunk-GVW7AU57.js} +190 -254
  8. package/dist/{chunk-44VRMER6.js → chunk-VHV2ZDKY.js} +17 -97
  9. package/dist/{domEditingLayers-FRVHP6IB.js → domEditingLayers-SA5KLSSS.js} +4 -2
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.html +1 -1
  12. package/dist/index.js +898 -551
  13. package/dist/player.js +2 -2
  14. package/package.json +8 -8
  15. package/src/components/editor/DomEditOverlay.tsx +3 -15
  16. package/src/components/editor/clickAfterPreventedPress.test.tsx +17 -1
  17. package/src/components/editor/domEditOverlayBasis.ts +7 -2
  18. package/src/components/editor/domEditOverlayCrop.test.ts +1 -1
  19. package/src/components/editor/domEditOverlayCrop.ts +17 -3
  20. package/src/components/editor/domEditOverlayGeometry.ts +64 -139
  21. package/src/components/editor/domEditSelectionRules.ts +138 -0
  22. package/src/components/editor/domEditing.test.ts +6 -28
  23. package/src/components/editor/domEditingDom.preview.test.ts +3 -3
  24. package/src/components/editor/domEditingDom.ts +24 -165
  25. package/src/components/editor/domEditingElement.ts +19 -240
  26. package/src/components/editor/domEditingGroups.ts +0 -31
  27. package/src/components/editor/domEditingLayers.ts +95 -100
  28. package/src/components/editor/domEditingRootLayer.ts +35 -30
  29. package/src/components/editor/domEditingTypes.ts +4 -0
  30. package/src/components/editor/previewGestureStarts.ts +73 -10
  31. package/src/components/editor/previewOverlayRects.test.ts +316 -0
  32. package/src/components/editor/previewOverlayRects.ts +123 -0
  33. package/src/components/editor/previewPointerTargets.test.ts +260 -0
  34. package/src/components/editor/previewSelection.test.ts +481 -0
  35. package/src/components/editor/previewSelection.ts +472 -0
  36. package/src/components/editor/probeSourceElement.ts +19 -1
  37. package/src/components/editor/propertyPanelFill.tsx +5 -1
  38. package/src/components/editor/useDomEditOverlayRects.ts +80 -1
  39. package/src/components/editor/useInlineTextEditing.tsx +1 -6
  40. package/src/hooks/domSelectionTestHarness.ts +1 -1
  41. package/src/hooks/useDomEditSession.test.tsx +23 -1
  42. package/src/hooks/useDomEditSession.ts +2 -1
  43. package/src/hooks/useDomSelection.ts +61 -47
  44. package/src/hooks/useGsapSelectionHandlers.test.tsx +17 -0
  45. package/src/hooks/useGsapSelectionHandlers.ts +2 -1
  46. package/src/hooks/usePreviewInteraction.test.ts +10 -2
  47. package/src/hooks/usePreviewInteraction.ts +5 -4
  48. package/src/hooks/useStudioSelectionPublisher.test.tsx +50 -0
  49. package/src/hooks/useStudioSelectionPublisher.ts +9 -7
  50. package/src/player/lib/previewChannel.ts +26 -10
  51. package/src/player/lib/previewElements.test.ts +167 -0
  52. package/src/player/lib/previewElements.ts +226 -0
  53. package/src/styles/hex-baseline.json +1 -2
  54. package/src/utils/studioHelpers.ts +0 -13
  55. package/src/utils/studioPreviewHelpers.test.ts +8 -8
  56. package/src/utils/studioPreviewHelpers.ts +26 -242
  57. package/src/components/editor/domEditOverlayTransform.ts +0 -126
@@ -46,7 +46,13 @@ function getSourceScopedSelectorIndex(doc, el, selector, sourceFile, resolveSour
46
46
 
47
47
  // src/components/editor/domEditingDom.ts
48
48
  import { getLogicalOpacity } from "@hyperframes/core/studio-preview-mark";
49
- import { COLOR_GRADING_SOURCE_HIDDEN_ATTR } from "@hyperframes/core/color-grading";
49
+ import {
50
+ buildStableSelector,
51
+ escapeCssString,
52
+ getPreferredClassSelector,
53
+ isElementVisibleThroughAncestors,
54
+ readElementSource
55
+ } from "@hyperframes/core/runtime/editing-port";
50
56
 
51
57
  // src/components/editor/domEditingTypes.ts
52
58
  var CURATED_STYLE_PROPERTIES = [
@@ -106,32 +112,6 @@ function isTextBearingTag(tagName) {
106
112
  function isEditableTextLeaf(el) {
107
113
  return isTextBearingTag(el.tagName.toLowerCase()) && el.children.length === 0;
108
114
  }
109
- function elementRendersItself(win, el) {
110
- const computed = win.getComputedStyle(el);
111
- if (computed.display === "none" || computed.visibility === "hidden") return false;
112
- const opacity = Number.parseFloat(getLogicalOpacity(el, computed));
113
- return !(Number.isFinite(opacity) && opacity <= 0.01 && !el.hasAttribute(COLOR_GRADING_SOURCE_HIDDEN_ATTR));
114
- }
115
- function isElementVisibleThroughAncestors(el, memo) {
116
- const win = el.ownerDocument.defaultView;
117
- if (!win) return true;
118
- const pending = [];
119
- let inherited = true;
120
- for (let node = el; node; node = node.parentElement) {
121
- const answered = memo?.get(node);
122
- if (answered !== void 0) {
123
- inherited = answered;
124
- break;
125
- }
126
- pending.push(node);
127
- }
128
- for (let i = pending.length - 1; i >= 0; i -= 1) {
129
- const node = pending[i];
130
- inherited = inherited && elementRendersItself(win, node);
131
- memo?.set(node, inherited);
132
- }
133
- return inherited;
134
- }
135
115
  function getCuratedComputedStyles(el) {
136
116
  const styles = {};
137
117
  const computed = el.ownerDocument.defaultView?.getComputedStyle(el);
@@ -159,17 +139,6 @@ function getDataAttributes(el) {
159
139
  }
160
140
  return attrs;
161
141
  }
162
- function findClosestByAttribute(el, attributeNames) {
163
- let current = el;
164
- while (current) {
165
- const candidate = current;
166
- if (attributeNames.some((attribute) => candidate.hasAttribute(attribute))) {
167
- return candidate;
168
- }
169
- current = current.parentElement;
170
- }
171
- return null;
172
- }
173
142
  var compositionSourceMap = /* @__PURE__ */ new Map();
174
143
  var compositionSourceMapRevision = 0;
175
144
  function setCompositionSourceMap(map) {
@@ -179,16 +148,13 @@ function setCompositionSourceMap(map) {
179
148
  function getCompositionSourceMapRevision() {
180
149
  return compositionSourceMapRevision;
181
150
  }
182
- function sourceFromCompositionId(ownerRoot) {
183
- if (!ownerRoot || compositionSourceMap.size === 0) return void 0;
184
- const authored = ownerRoot.getAttribute("data-hf-original-composition-id");
185
- const current = ownerRoot.getAttribute("data-composition-id");
186
- return (authored ? compositionSourceMap.get(authored) : void 0) ?? (current ? compositionSourceMap.get(current) : void 0);
151
+ function resolveElementSourceFile(source, activeCompositionPath) {
152
+ const { file, compositionId, originalCompositionId } = source;
153
+ const mapped = compositionSourceMap.size ? (originalCompositionId ? compositionSourceMap.get(originalCompositionId) : void 0) ?? (compositionId ? compositionSourceMap.get(compositionId) : void 0) : void 0;
154
+ return file ?? mapped ?? activeCompositionPath ?? "index.html";
187
155
  }
188
156
  function getSourceFileForElement(el, activeCompositionPath) {
189
- const sourceHost = findClosestByAttribute(el, ["data-composition-file", "data-composition-src"]);
190
- const ownerRoot = findClosestByAttribute(el, ["data-composition-id"]);
191
- 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";
157
+ const sourceFile = resolveElementSourceFile(readElementSource(el), activeCompositionPath);
192
158
  return {
193
159
  sourceFile,
194
160
  compositionPath: sourceFile
@@ -212,39 +178,6 @@ function normalizeTimelineCompositionSource(value) {
212
178
  }
213
179
  return trimmed;
214
180
  }
215
- function escapeCssIdentifier(value) {
216
- const css = globalThis.CSS;
217
- if (typeof css?.escape === "function") return css.escape(value);
218
- if (value === "-") return "\\-";
219
- let escaped = "";
220
- for (let index = 0; index < value.length; index += 1) {
221
- const char = value[index] ?? "";
222
- const code = char.charCodeAt(0);
223
- if (code === 0) {
224
- escaped += "\uFFFD";
225
- continue;
226
- }
227
- const isDigit = code >= 48 && code <= 57;
228
- const isUpperAlpha = code >= 65 && code <= 90;
229
- const isLowerAlpha = code >= 97 && code <= 122;
230
- const isControl = code >= 1 && code <= 31 || code === 127;
231
- const isLeadingDigit = index === 0 && isDigit;
232
- const isSecondDigitAfterDash = index === 1 && value.startsWith("-") && isDigit;
233
- if (isControl || isLeadingDigit || isSecondDigitAfterDash) {
234
- escaped += `\\${code.toString(16)} `;
235
- continue;
236
- }
237
- if (isUpperAlpha || isLowerAlpha || isDigit || char === "-" || char === "_" || code >= 128) {
238
- escaped += char;
239
- continue;
240
- }
241
- escaped += `\\${char}`;
242
- }
243
- return escaped;
244
- }
245
- function escapeCssString(value) {
246
- return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\a ").replace(/\r/g, "\\d ").replace(/\f/g, "\\c ");
247
- }
248
181
  function querySelectorAllSafely(doc, selector) {
249
182
  try {
250
183
  return Array.from(doc.querySelectorAll(selector));
@@ -255,20 +188,6 @@ function querySelectorAllSafely(doc, selector) {
255
188
  function humanizeIdentifier(value) {
256
189
  return value.replace(/\.html$/i, "").replace(/^compositions\//i, "").split("/").at(-1)?.replace(/[-_]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase()) ?? value;
257
190
  }
258
- function buildStableSelector(el) {
259
- if (el.id) return `#${escapeCssIdentifier(el.id)}`;
260
- const compositionId = el.getAttribute("data-composition-id");
261
- if (compositionId) return `[data-composition-id="${escapeCssString(compositionId)}"]`;
262
- const group = el.getAttribute("data-hf-group");
263
- if (group) return `[data-hf-group="${escapeCssString(group)}"]`;
264
- return getPreferredClassSelector(el);
265
- }
266
- function getPreferredClassSelector(el) {
267
- const classes = Array.from(el.classList).map((value) => value.trim()).filter(Boolean);
268
- if (classes.length === 0) return void 0;
269
- const preferred = classes.find((value) => value !== "clip" && !value.startsWith("__hf-")) ?? classes[0];
270
- return preferred ? `.${escapeCssIdentifier(preferred)}` : void 0;
271
- }
272
191
  function buildElementLabel(el) {
273
192
  const compositionId = el.getAttribute("data-hf-original-composition-id") ?? el.getAttribute("data-composition-id");
274
193
  if (compositionId && compositionId !== "main") {
@@ -1143,21 +1062,22 @@ export {
1143
1062
  rgbToHsv,
1144
1063
  hsvToRgb,
1145
1064
  withSelectorIndexPass,
1065
+ CURATED_STYLE_PROPERTIES,
1146
1066
  getLogicalOpacity,
1067
+ buildStableSelector,
1068
+ escapeCssString,
1069
+ isElementVisibleThroughAncestors,
1147
1070
  isHtmlElement,
1148
1071
  isEditableTextLeaf,
1149
- isElementVisibleThroughAncestors,
1150
1072
  getCuratedComputedStyles,
1151
1073
  getInlineStyles,
1152
1074
  getDataAttributes,
1153
- findClosestByAttribute,
1154
1075
  setCompositionSourceMap,
1155
1076
  getCompositionSourceMapRevision,
1077
+ resolveElementSourceFile,
1156
1078
  getSourceFileForElement,
1157
1079
  normalizeTimelineCompositionSource,
1158
- escapeCssString,
1159
1080
  querySelectorAllSafely,
1160
- buildStableSelector,
1161
1081
  buildElementLabel,
1162
1082
  getSelectorIndex,
1163
1083
  parsePx,
@@ -5,6 +5,7 @@ import {
5
5
  buildDomEditStylePatchOperation,
6
6
  buildDomEditTextPatchOperation,
7
7
  buildTextFieldChildLocator,
8
+ capabilityFacts,
8
9
  collectDomEditLayerItems,
9
10
  collectDomEditTextFields,
10
11
  countDomEditChildLayers,
@@ -19,8 +20,8 @@ import {
19
20
  resolveDomEditCapabilities,
20
21
  resolveDomEditSelection,
21
22
  serializeDomEditTextFields
22
- } from "./chunk-ATDO3YLX.js";
23
- import "./chunk-44VRMER6.js";
23
+ } from "./chunk-GVW7AU57.js";
24
+ import "./chunk-VHV2ZDKY.js";
24
25
  import "./chunk-MLKGABMK.js";
25
26
  export {
26
27
  buildDefaultDomEditTextField,
@@ -29,6 +30,7 @@ export {
29
30
  buildDomEditStylePatchOperation,
30
31
  buildDomEditTextPatchOperation,
31
32
  buildTextFieldChildLocator,
33
+ capabilityFacts,
32
34
  collectDomEditLayerItems,
33
35
  collectDomEditTextFields,
34
36
  countDomEditChildLayers,
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { RefObject, MutableRefObject, ReactNode, DragEventHandler, ComponentProp
4
4
  import { RuntimeTimelineClipIdentity, PlaybackHeldBy, HyperframePickerElementInfo } from '@hyperframes/core';
5
5
  import { GsapAnimation, ParsedGsap, PropertyGroupName } from '@hyperframes/core/gsap-parser';
6
6
  import { GsapAnimation as GsapAnimation$1, ArcPathSegment } from '@hyperframes/parsers/gsap-parser';
7
+ import { EditingElementHandle } from '@hyperframes/core/runtime/editing-port';
7
8
  import { Composition } from '@hyperframes/sdk';
8
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
10
  import { S as StudioKeys, a as StudioKeyAction } from './keys-CaWcxUST.js';
@@ -772,6 +773,9 @@ interface DomEditTextField {
772
773
  }
773
774
  interface DomEditSelection extends PatchTarget {
774
775
  element: HTMLElement;
776
+ handle?: EditingElementHandle;
777
+ hasAudio?: boolean;
778
+ src?: string | null;
775
779
  label: string;
776
780
  tagName: string;
777
781
  sourceFile: string;
package/dist/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  document.documentElement.dataset.theme = "paper";
15
15
  }
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-_pkzoYYF.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-B5ExwsOp.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-4VGEAZyf.css">
19
19
  </head>
20
20
  <body>