@hyperframes/studio 0.5.7 → 0.6.0-alpha.10

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 (75) hide show
  1. package/dist/assets/index-14zH9lqh.css +1 -0
  2. package/dist/assets/index-B-16fRnH.js +108 -0
  3. package/dist/index.html +2 -2
  4. package/package.json +4 -4
  5. package/src/App.tsx +2965 -186
  6. package/src/components/LintModal.tsx +3 -4
  7. package/src/components/editor/DomEditOverlay.test.ts +241 -0
  8. package/src/components/editor/DomEditOverlay.tsx +1300 -0
  9. package/src/components/editor/MotionPanel.tsx +651 -0
  10. package/src/components/editor/PropertyPanel.test.ts +116 -0
  11. package/src/components/editor/PropertyPanel.tsx +2829 -205
  12. package/src/components/editor/TimelineLayerPanel.test.ts +42 -0
  13. package/src/components/editor/TimelineLayerPanel.tsx +113 -0
  14. package/src/components/editor/colorValue.test.ts +82 -0
  15. package/src/components/editor/colorValue.ts +175 -0
  16. package/src/components/editor/domEditing.test.ts +1120 -0
  17. package/src/components/editor/domEditing.ts +1117 -0
  18. package/src/components/editor/floatingPanel.test.ts +34 -0
  19. package/src/components/editor/floatingPanel.ts +54 -0
  20. package/src/components/editor/fontAssets.ts +32 -0
  21. package/src/components/editor/fontCatalog.ts +126 -0
  22. package/src/components/editor/gradientValue.test.ts +89 -0
  23. package/src/components/editor/gradientValue.ts +445 -0
  24. package/src/components/editor/manualEditingAvailability.test.ts +131 -0
  25. package/src/components/editor/manualEditingAvailability.ts +62 -0
  26. package/src/components/editor/manualEdits.test.ts +945 -0
  27. package/src/components/editor/manualEdits.ts +1409 -0
  28. package/src/components/editor/manualOffsetDrag.test.ts +140 -0
  29. package/src/components/editor/manualOffsetDrag.ts +307 -0
  30. package/src/components/editor/studioMotion.test.ts +355 -0
  31. package/src/components/editor/studioMotion.ts +632 -0
  32. package/src/components/nle/NLELayout.test.ts +12 -0
  33. package/src/components/nle/NLELayout.tsx +84 -22
  34. package/src/components/nle/NLEPreview.tsx +56 -5
  35. package/src/components/renders/RenderQueue.tsx +24 -11
  36. package/src/components/sidebar/AssetsTab.tsx +3 -4
  37. package/src/components/sidebar/CompositionsTab.test.ts +16 -1
  38. package/src/components/sidebar/CompositionsTab.tsx +117 -45
  39. package/src/components/sidebar/LeftSidebar.tsx +194 -179
  40. package/src/hooks/usePersistentEditHistory.test.ts +256 -0
  41. package/src/hooks/usePersistentEditHistory.ts +337 -0
  42. package/src/icons/SystemIcons.tsx +2 -0
  43. package/src/player/components/CompositionThumbnail.test.ts +19 -0
  44. package/src/player/components/CompositionThumbnail.tsx +50 -13
  45. package/src/player/components/EditModal.tsx +5 -20
  46. package/src/player/components/Player.test.ts +58 -0
  47. package/src/player/components/Player.tsx +88 -5
  48. package/src/player/components/PlayerControls.tsx +20 -7
  49. package/src/player/components/Timeline.test.ts +20 -0
  50. package/src/player/components/Timeline.tsx +147 -40
  51. package/src/player/components/TimelineClip.test.ts +92 -0
  52. package/src/player/components/TimelineClip.tsx +241 -7
  53. package/src/player/components/timelineEditing.test.ts +16 -3
  54. package/src/player/components/timelineEditing.ts +10 -3
  55. package/src/player/hooks/useTimelinePlayer.test.ts +148 -19
  56. package/src/player/hooks/useTimelinePlayer.ts +287 -16
  57. package/src/player/store/playerStore.ts +2 -0
  58. package/src/utils/clipboard.test.ts +89 -0
  59. package/src/utils/clipboard.ts +57 -0
  60. package/src/utils/editHistory.test.ts +244 -0
  61. package/src/utils/editHistory.ts +218 -0
  62. package/src/utils/editHistoryStorage.test.ts +37 -0
  63. package/src/utils/editHistoryStorage.ts +99 -0
  64. package/src/utils/mediaTypes.ts +1 -1
  65. package/src/utils/sourcePatcher.test.ts +128 -1
  66. package/src/utils/sourcePatcher.ts +130 -18
  67. package/src/utils/studioFileHistory.test.ts +156 -0
  68. package/src/utils/studioFileHistory.ts +61 -0
  69. package/src/utils/timelineAssetDrop.test.ts +31 -11
  70. package/src/utils/timelineAssetDrop.ts +22 -2
  71. package/src/utils/timelineDiscovery.ts +1 -1
  72. package/src/utils/timelineInspector.test.ts +79 -0
  73. package/src/utils/timelineInspector.ts +116 -0
  74. package/dist/assets/index-04Mp2wOn.css +0 -1
  75. package/dist/assets/index-Dcw3BoVw.js +0 -93
@@ -0,0 +1,116 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import {
3
+ buildStrokeStyleUpdates,
4
+ buildStrokeWidthStyleUpdates,
5
+ getClipPathInsetPx,
6
+ getCssFilterFunctionPx,
7
+ getPropertyPanelVisibleSections,
8
+ inferBoxShadowPreset,
9
+ inferClipPathPreset,
10
+ isPropertyPanelMediaLikeSelection,
11
+ normalizePanelPxValue,
12
+ setCssFilterFunctionPx,
13
+ } from "./PropertyPanel";
14
+
15
+ describe("PropertyPanel style helpers", () => {
16
+ it("normalizes bounded pixel values without accepting incompatible units", () => {
17
+ expect(normalizePanelPxValue("12", { min: 0, max: 40 })).toBe("12px");
18
+ expect(normalizePanelPxValue("12.50px", { min: 0, max: 40 })).toBe("12.5px");
19
+ expect(normalizePanelPxValue("-8", { min: 0, max: 40 })).toBe("0px");
20
+ expect(normalizePanelPxValue("80px", { min: 0, max: 40 })).toBe("40px");
21
+ expect(normalizePanelPxValue("1.2rem", { min: 0, max: 40 })).toBeNull();
22
+ expect(normalizePanelPxValue("auto", { min: 0, max: 40 })).toBeNull();
23
+ });
24
+
25
+ it("adds, replaces, and removes a named filter function while preserving other filters", () => {
26
+ expect(setCssFilterFunctionPx("none", "blur", 12)).toBe("blur(12px)");
27
+ expect(setCssFilterFunctionPx("brightness(1.08)", "blur", 4.5)).toBe(
28
+ "brightness(1.08) blur(4.5px)",
29
+ );
30
+ expect(setCssFilterFunctionPx("brightness(1.08) blur(12px) saturate(1.2)", "blur", 2)).toBe(
31
+ "brightness(1.08) saturate(1.2) blur(2px)",
32
+ );
33
+ expect(setCssFilterFunctionPx("brightness(1.08) blur(12px)", "blur", 0)).toBe(
34
+ "brightness(1.08)",
35
+ );
36
+ expect(setCssFilterFunctionPx("blur(12px)", "blur", 0)).toBe("none");
37
+ expect(getCssFilterFunctionPx("brightness(1.08) blur(3.5px)", "blur")).toBe(3.5);
38
+ expect(getCssFilterFunctionPx("drop-shadow(0 2px 8px black)", "blur")).toBe(0);
39
+ });
40
+
41
+ it("infers shadow and clip presets without losing custom values", () => {
42
+ expect(inferBoxShadowPreset("none")).toBe("none");
43
+ expect(inferBoxShadowPreset("0 12px 36px rgba(0, 0, 0, 0.28)")).toBe("soft");
44
+ expect(inferBoxShadowPreset("0 2px 4px red")).toBe("custom");
45
+
46
+ expect(inferClipPathPreset(undefined)).toBe("none");
47
+ expect(inferClipPathPreset("inset(12px round 8px)")).toBe("inset");
48
+ expect(inferClipPathPreset("circle(50% at 50% 50%)")).toBe("circle");
49
+ expect(inferClipPathPreset("polygon(0 0, 100% 0, 100% 100%)")).toBe("custom");
50
+ expect(getClipPathInsetPx("inset(12.5px round 8px)")).toBe(12.5);
51
+ expect(getClipPathInsetPx("circle(50% at 50% 50%)")).toBe(0);
52
+ });
53
+
54
+ it("keeps stroke width and style edits visually effective", () => {
55
+ expect(buildStrokeWidthStyleUpdates("3px", "none")).toEqual([
56
+ ["border-width", "3px"],
57
+ ["border-style", "solid"],
58
+ ]);
59
+ expect(buildStrokeWidthStyleUpdates("0px", "none")).toEqual([["border-width", "0px"]]);
60
+ expect(buildStrokeWidthStyleUpdates("3px", "dashed")).toEqual([["border-width", "3px"]]);
61
+
62
+ expect(buildStrokeStyleUpdates("dashed", "0px")).toEqual([
63
+ ["border-style", "dashed"],
64
+ ["border-width", "1px"],
65
+ ]);
66
+ expect(buildStrokeStyleUpdates("none", "4px")).toEqual([["border-style", "none"]]);
67
+ expect(buildStrokeStyleUpdates("solid", "4px")).toEqual([["border-style", "solid"]]);
68
+ });
69
+
70
+ it("orders the simplified default inspector sections around high-confidence edits", () => {
71
+ expect(
72
+ getPropertyPanelVisibleSections({
73
+ hasSelection: true,
74
+ canEditStyles: true,
75
+ hasTextControls: true,
76
+ hasColorControls: true,
77
+ }),
78
+ ).toEqual(["Text", "Layout", "Colors", "Radius", "Shadow"]);
79
+
80
+ expect(
81
+ getPropertyPanelVisibleSections({
82
+ hasSelection: true,
83
+ canEditStyles: true,
84
+ hasTextControls: false,
85
+ hasColorControls: false,
86
+ }),
87
+ ).toEqual(["Layout", "Radius", "Shadow"]);
88
+ });
89
+
90
+ it("treats media tags and background-image layers as image-like controls", () => {
91
+ expect(
92
+ isPropertyPanelMediaLikeSelection({
93
+ tagName: "img",
94
+ styles: {},
95
+ }),
96
+ ).toBe(true);
97
+
98
+ expect(
99
+ isPropertyPanelMediaLikeSelection({
100
+ tagName: "div",
101
+ styles: {
102
+ "background-image": "url(/assets/studio.png)",
103
+ },
104
+ }),
105
+ ).toBe(true);
106
+
107
+ expect(
108
+ isPropertyPanelMediaLikeSelection({
109
+ tagName: "div",
110
+ styles: {
111
+ "background-image": "none",
112
+ },
113
+ }),
114
+ ).toBe(false);
115
+ });
116
+ });