@hyperframes/studio 0.6.0-alpha.9 → 0.6.1
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.
- package/dist/assets/hyperframes-player-CzwFysqv.js +418 -0
- package/dist/assets/index-D1JDq7Gg.css +1 -0
- package/dist/assets/index-hYc4aP7M.js +117 -0
- package/dist/favicon.svg +14 -0
- package/dist/index.html +3 -2
- package/package.json +9 -9
- package/src/App.tsx +421 -4303
- package/src/captions/components/CaptionOverlay.tsx +13 -246
- package/src/captions/components/CaptionOverlayUtils.ts +221 -0
- package/src/components/AskAgentModal.tsx +120 -0
- package/src/components/StudioHeader.tsx +133 -0
- package/src/components/StudioLeftSidebar.tsx +125 -0
- package/src/components/StudioPreviewArea.tsx +167 -0
- package/src/components/StudioRightPanel.tsx +198 -0
- package/src/components/TimelineToolbar.tsx +89 -0
- package/src/components/editor/DomEditOverlay.tsx +88 -993
- package/src/components/editor/EaseCurveEditor.tsx +221 -0
- package/src/components/editor/FileTree.tsx +13 -621
- package/src/components/editor/FileTreeIcons.tsx +128 -0
- package/src/components/editor/FileTreeNodes.tsx +496 -0
- package/src/components/editor/MotionPanel.tsx +16 -390
- package/src/components/editor/MotionPanelFields.tsx +185 -0
- package/src/components/editor/PropertyPanel.test.ts +0 -49
- package/src/components/editor/PropertyPanel.tsx +132 -2763
- package/src/components/editor/domEditOverlayGeometry.ts +211 -0
- package/src/components/editor/domEditOverlayGestures.ts +138 -0
- package/src/components/editor/domEditOverlayStartGesture.ts +155 -0
- package/src/components/editor/domEditing.ts +44 -1117
- package/src/components/editor/domEditingAgentPrompt.ts +97 -0
- package/src/components/editor/domEditingDom.ts +266 -0
- package/src/components/editor/domEditingElement.ts +329 -0
- package/src/components/editor/domEditingLayers.ts +460 -0
- package/src/components/editor/domEditingTypes.ts +125 -0
- package/src/components/editor/manualEditingAvailability.test.ts +2 -2
- package/src/components/editor/manualEditingAvailability.ts +1 -1
- package/src/components/editor/manualEdits.ts +84 -1049
- package/src/components/editor/manualEditsDom.ts +436 -0
- package/src/components/editor/manualEditsParsing.ts +280 -0
- package/src/components/editor/manualEditsSnapshot.ts +333 -0
- package/src/components/editor/manualEditsTypes.ts +141 -0
- package/src/components/editor/propertyPanelColor.tsx +371 -0
- package/src/components/editor/propertyPanelFill.tsx +421 -0
- package/src/components/editor/propertyPanelFont.tsx +455 -0
- package/src/components/editor/propertyPanelHelpers.ts +401 -0
- package/src/components/editor/propertyPanelPrimitives.tsx +357 -0
- package/src/components/editor/propertyPanelSections.tsx +453 -0
- package/src/components/editor/propertyPanelStyleSections.tsx +411 -0
- package/src/components/editor/studioMotion.ts +47 -434
- package/src/components/editor/studioMotionOps.ts +299 -0
- package/src/components/editor/studioMotionTypes.ts +168 -0
- package/src/components/editor/useDomEditOverlayGestures.ts +393 -0
- package/src/components/editor/useDomEditOverlayRects.ts +207 -0
- package/src/components/nle/NLELayout.tsx +68 -155
- package/src/components/nle/NLEPreview.tsx +3 -0
- package/src/components/nle/useCompositionStack.ts +126 -0
- package/src/components/renders/RenderQueue.tsx +102 -31
- package/src/components/renders/useRenderQueue.ts +8 -2
- package/src/components/sidebar/LeftSidebar.tsx +186 -186
- package/src/contexts/DomEditContext.tsx +137 -0
- package/src/contexts/FileManagerContext.tsx +110 -0
- package/src/contexts/PanelLayoutContext.tsx +68 -0
- package/src/contexts/StudioContext.tsx +135 -0
- package/src/hooks/useAppHotkeys.ts +326 -0
- package/src/hooks/useAskAgentModal.ts +162 -0
- package/src/hooks/useCaptionDetection.ts +132 -0
- package/src/hooks/useCompositionDimensions.ts +25 -0
- package/src/hooks/useConsoleErrorCapture.ts +60 -0
- package/src/hooks/useDomEditCommits.ts +437 -0
- package/src/hooks/useDomEditSession.ts +342 -0
- package/src/hooks/useDomEditTextCommits.ts +330 -0
- package/src/hooks/useDomSelection.ts +398 -0
- package/src/hooks/useFileManager.ts +431 -0
- package/src/hooks/useFrameCapture.ts +77 -0
- package/src/hooks/useLintModal.ts +35 -0
- package/src/hooks/useManifestPersistence.ts +492 -0
- package/src/hooks/usePanelLayout.ts +68 -0
- package/src/hooks/usePreviewInteraction.ts +153 -0
- package/src/hooks/useRenderClipContent.ts +124 -0
- package/src/hooks/useTimelineEditing.ts +472 -0
- package/src/hooks/useToast.ts +20 -0
- package/src/player/components/Player.tsx +33 -2
- package/src/player/components/Timeline.test.ts +0 -8
- package/src/player/components/Timeline.tsx +196 -1518
- package/src/player/components/TimelineCanvas.tsx +434 -0
- package/src/player/components/TimelineClip.tsx +9 -244
- package/src/player/components/TimelineEmptyState.tsx +102 -0
- package/src/player/components/TimelineRuler.tsx +90 -0
- package/src/player/components/timelineIcons.tsx +49 -0
- package/src/player/components/timelineLayout.ts +215 -0
- package/src/player/components/timelineUtils.ts +211 -0
- package/src/player/components/useTimelineClipDrag.ts +388 -0
- package/src/player/components/useTimelinePlayhead.ts +200 -0
- package/src/player/components/useTimelineRangeSelection.ts +135 -0
- package/src/player/hooks/usePlaybackKeyboard.ts +171 -0
- package/src/player/hooks/useTimelinePlayer.ts +105 -1371
- package/src/player/hooks/useTimelineSyncCallbacks.ts +288 -0
- package/src/player/lib/playbackAdapter.ts +145 -0
- package/src/player/lib/playbackShortcuts.ts +68 -0
- package/src/player/lib/playbackTypes.ts +60 -0
- package/src/player/lib/timelineDOM.ts +373 -0
- package/src/player/lib/timelineElementHelpers.ts +303 -0
- package/src/player/lib/timelineIframeHelpers.ts +269 -0
- package/src/utils/domEditHelpers.ts +50 -0
- package/src/utils/studioFontHelpers.ts +83 -0
- package/src/utils/studioHelpers.ts +214 -0
- package/src/utils/studioPreviewHelpers.ts +185 -0
- package/src/utils/timelineDiscovery.ts +1 -1
- package/dist/assets/hyperframes-player-DjsVzYFP.js +0 -418
- package/dist/assets/index-14zH9lqh.css +0 -1
- package/dist/assets/index-DYCiFGWQ.js +0 -108
- package/src/player/components/TimelineClip.test.ts +0 -92
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { DomEditSelection } from "./domEditing";
|
|
2
|
+
import type {
|
|
3
|
+
StudioManualEdit,
|
|
4
|
+
StudioManualEditManifest,
|
|
5
|
+
StudioManualEditTarget,
|
|
6
|
+
StudioPathOffsetEdit,
|
|
7
|
+
StudioBoxSizeEdit,
|
|
8
|
+
StudioRotationEdit,
|
|
9
|
+
} from "./manualEditsTypes";
|
|
10
|
+
import { STUDIO_MANUAL_EDITS_PATH } from "./manualEditsTypes";
|
|
11
|
+
|
|
12
|
+
/* ── Helpers ──────────────────────────────────────────────────────── */
|
|
13
|
+
export function finiteNumber(value: unknown): number | null {
|
|
14
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* ── Manifest factory ─────────────────────────────────────────────── */
|
|
18
|
+
export function emptyStudioManualEditManifest(): StudioManualEditManifest {
|
|
19
|
+
return { version: 1, edits: [] };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* ── Parsing ──────────────────────────────────────────────────────── */
|
|
23
|
+
function parsePathOffsetEdit(value: unknown): StudioPathOffsetEdit | null {
|
|
24
|
+
if (!value || typeof value !== "object") return null;
|
|
25
|
+
const record = value as Record<string, unknown>;
|
|
26
|
+
if (record.kind !== "path-offset") return null;
|
|
27
|
+
const target = record.target;
|
|
28
|
+
if (!target || typeof target !== "object") return null;
|
|
29
|
+
const targetRecord = target as Record<string, unknown>;
|
|
30
|
+
const sourceFile = typeof targetRecord.sourceFile === "string" ? targetRecord.sourceFile : "";
|
|
31
|
+
if (!sourceFile) return null;
|
|
32
|
+
|
|
33
|
+
const selector = typeof targetRecord.selector === "string" ? targetRecord.selector : undefined;
|
|
34
|
+
const id = typeof targetRecord.id === "string" ? targetRecord.id : undefined;
|
|
35
|
+
if (!selector && !id) return null;
|
|
36
|
+
|
|
37
|
+
const x = finiteNumber(record.x);
|
|
38
|
+
const y = finiteNumber(record.y);
|
|
39
|
+
if (x == null || y == null) return null;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
kind: "path-offset",
|
|
43
|
+
target: {
|
|
44
|
+
sourceFile,
|
|
45
|
+
selector,
|
|
46
|
+
selectorIndex: finiteNumber(targetRecord.selectorIndex) ?? undefined,
|
|
47
|
+
id,
|
|
48
|
+
},
|
|
49
|
+
x,
|
|
50
|
+
y,
|
|
51
|
+
updatedAt: typeof record.updatedAt === "string" ? record.updatedAt : undefined,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function parseBoxSizeEdit(value: unknown): StudioBoxSizeEdit | null {
|
|
56
|
+
if (!value || typeof value !== "object") return null;
|
|
57
|
+
const record = value as Record<string, unknown>;
|
|
58
|
+
if (record.kind !== "box-size") return null;
|
|
59
|
+
const target = record.target;
|
|
60
|
+
if (!target || typeof target !== "object") return null;
|
|
61
|
+
const targetRecord = target as Record<string, unknown>;
|
|
62
|
+
const sourceFile = typeof targetRecord.sourceFile === "string" ? targetRecord.sourceFile : "";
|
|
63
|
+
if (!sourceFile) return null;
|
|
64
|
+
|
|
65
|
+
const selector = typeof targetRecord.selector === "string" ? targetRecord.selector : undefined;
|
|
66
|
+
const id = typeof targetRecord.id === "string" ? targetRecord.id : undefined;
|
|
67
|
+
if (!selector && !id) return null;
|
|
68
|
+
|
|
69
|
+
const width = finiteNumber(record.width);
|
|
70
|
+
const height = finiteNumber(record.height);
|
|
71
|
+
if (width == null || height == null || width <= 0 || height <= 0) return null;
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
kind: "box-size",
|
|
75
|
+
target: {
|
|
76
|
+
sourceFile,
|
|
77
|
+
selector,
|
|
78
|
+
selectorIndex: finiteNumber(targetRecord.selectorIndex) ?? undefined,
|
|
79
|
+
id,
|
|
80
|
+
},
|
|
81
|
+
width,
|
|
82
|
+
height,
|
|
83
|
+
updatedAt: typeof record.updatedAt === "string" ? record.updatedAt : undefined,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function parseRotationEdit(value: unknown): StudioRotationEdit | null {
|
|
88
|
+
if (!value || typeof value !== "object") return null;
|
|
89
|
+
const record = value as Record<string, unknown>;
|
|
90
|
+
if (record.kind !== "rotation") return null;
|
|
91
|
+
const target = record.target;
|
|
92
|
+
if (!target || typeof target !== "object") return null;
|
|
93
|
+
const targetRecord = target as Record<string, unknown>;
|
|
94
|
+
const sourceFile = typeof targetRecord.sourceFile === "string" ? targetRecord.sourceFile : "";
|
|
95
|
+
if (!sourceFile) return null;
|
|
96
|
+
|
|
97
|
+
const selector = typeof targetRecord.selector === "string" ? targetRecord.selector : undefined;
|
|
98
|
+
const id = typeof targetRecord.id === "string" ? targetRecord.id : undefined;
|
|
99
|
+
if (!selector && !id) return null;
|
|
100
|
+
|
|
101
|
+
const angle = finiteNumber(record.angle);
|
|
102
|
+
if (angle == null) return null;
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
kind: "rotation",
|
|
106
|
+
target: {
|
|
107
|
+
sourceFile,
|
|
108
|
+
selector,
|
|
109
|
+
selectorIndex: finiteNumber(targetRecord.selectorIndex) ?? undefined,
|
|
110
|
+
id,
|
|
111
|
+
},
|
|
112
|
+
angle,
|
|
113
|
+
updatedAt: typeof record.updatedAt === "string" ? record.updatedAt : undefined,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function parseManualEdit(value: unknown): StudioManualEdit | null {
|
|
118
|
+
return parsePathOffsetEdit(value) ?? parseBoxSizeEdit(value) ?? parseRotationEdit(value);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function parseStudioManualEditManifest(content: string): StudioManualEditManifest {
|
|
122
|
+
if (!content.trim()) return emptyStudioManualEditManifest();
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
const parsed = JSON.parse(content) as unknown;
|
|
126
|
+
if (!parsed || typeof parsed !== "object") return emptyStudioManualEditManifest();
|
|
127
|
+
const edits = (parsed as { edits?: unknown }).edits;
|
|
128
|
+
if (!Array.isArray(edits)) return emptyStudioManualEditManifest();
|
|
129
|
+
return {
|
|
130
|
+
version: 1,
|
|
131
|
+
edits: edits.map(parseManualEdit).filter((edit): edit is StudioManualEdit => edit !== null),
|
|
132
|
+
};
|
|
133
|
+
} catch {
|
|
134
|
+
return emptyStudioManualEditManifest();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function serializeStudioManualEditManifest(manifest: StudioManualEditManifest): string {
|
|
139
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* ── File path utilities ──────────────────────────────────────────── */
|
|
143
|
+
function normalizeStudioFileChangePath(path: string): string {
|
|
144
|
+
return path
|
|
145
|
+
.trim()
|
|
146
|
+
.replace(/\\/g, "/")
|
|
147
|
+
.replace(/^\.?\//, "");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function readStudioFileChangePathFromValue(value: unknown): string | null {
|
|
151
|
+
if (typeof value === "string") {
|
|
152
|
+
const trimmed = value.trim();
|
|
153
|
+
if (!trimmed) return null;
|
|
154
|
+
if (trimmed.startsWith("{")) {
|
|
155
|
+
try {
|
|
156
|
+
return readStudioFileChangePathFromValue(JSON.parse(trimmed) as unknown);
|
|
157
|
+
} catch {
|
|
158
|
+
return normalizeStudioFileChangePath(trimmed);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return normalizeStudioFileChangePath(trimmed);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!value || typeof value !== "object") return null;
|
|
165
|
+
const record = value as Record<string, unknown>;
|
|
166
|
+
if (typeof record.path === "string") return normalizeStudioFileChangePath(record.path);
|
|
167
|
+
if (typeof record.filePath === "string") return normalizeStudioFileChangePath(record.filePath);
|
|
168
|
+
if ("data" in record) return readStudioFileChangePathFromValue(record.data);
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function readStudioFileChangePath(payload: unknown): string | null {
|
|
173
|
+
return readStudioFileChangePathFromValue(payload);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function isStudioManualEditManifestPath(path: string | null): boolean {
|
|
177
|
+
if (!path) return false;
|
|
178
|
+
const normalized = normalizeStudioFileChangePath(path);
|
|
179
|
+
return (
|
|
180
|
+
normalized === STUDIO_MANUAL_EDITS_PATH || normalized.endsWith(`/${STUDIO_MANUAL_EDITS_PATH}`)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* ── Target / upsert helpers ──────────────────────────────────────── */
|
|
185
|
+
function selectionTarget(selection: DomEditSelection): StudioManualEditTarget {
|
|
186
|
+
return {
|
|
187
|
+
sourceFile: selection.sourceFile || "index.html",
|
|
188
|
+
selector: selection.selector,
|
|
189
|
+
selectorIndex: selection.selectorIndex,
|
|
190
|
+
id: selection.id ?? undefined,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function targetKey(target: StudioManualEditTarget): string {
|
|
195
|
+
return [
|
|
196
|
+
target.sourceFile,
|
|
197
|
+
target.id ?? "",
|
|
198
|
+
target.selector ?? "",
|
|
199
|
+
target.selectorIndex ?? "",
|
|
200
|
+
].join("|");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function roundRotationAngle(angle: number): number {
|
|
204
|
+
return Math.round(angle * 10) / 10;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function upsertStudioPathOffsetEdit(
|
|
208
|
+
manifest: StudioManualEditManifest,
|
|
209
|
+
selection: DomEditSelection,
|
|
210
|
+
offset: { x: number; y: number },
|
|
211
|
+
): StudioManualEditManifest {
|
|
212
|
+
const target = selectionTarget(selection);
|
|
213
|
+
const key = targetKey(target);
|
|
214
|
+
const nextEdit: StudioPathOffsetEdit = {
|
|
215
|
+
kind: "path-offset",
|
|
216
|
+
target,
|
|
217
|
+
x: Math.round(offset.x),
|
|
218
|
+
y: Math.round(offset.y),
|
|
219
|
+
updatedAt: new Date().toISOString(),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const edits = manifest.edits.filter(
|
|
223
|
+
(edit) => edit.kind !== "path-offset" || targetKey(edit.target) !== key,
|
|
224
|
+
);
|
|
225
|
+
edits.push(nextEdit);
|
|
226
|
+
return { version: 1, edits };
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function upsertStudioBoxSizeEdit(
|
|
230
|
+
manifest: StudioManualEditManifest,
|
|
231
|
+
selection: DomEditSelection,
|
|
232
|
+
size: { width: number; height: number },
|
|
233
|
+
): StudioManualEditManifest {
|
|
234
|
+
const target = selectionTarget(selection);
|
|
235
|
+
const key = targetKey(target);
|
|
236
|
+
const nextEdit: StudioBoxSizeEdit = {
|
|
237
|
+
kind: "box-size",
|
|
238
|
+
target,
|
|
239
|
+
width: Math.round(Math.max(1, size.width)),
|
|
240
|
+
height: Math.round(Math.max(1, size.height)),
|
|
241
|
+
updatedAt: new Date().toISOString(),
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const edits = manifest.edits.filter(
|
|
245
|
+
(edit) => edit.kind !== "box-size" || targetKey(edit.target) !== key,
|
|
246
|
+
);
|
|
247
|
+
edits.push(nextEdit);
|
|
248
|
+
return { version: 1, edits };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function upsertStudioRotationEdit(
|
|
252
|
+
manifest: StudioManualEditManifest,
|
|
253
|
+
selection: DomEditSelection,
|
|
254
|
+
rotation: { angle: number },
|
|
255
|
+
): StudioManualEditManifest {
|
|
256
|
+
const target = selectionTarget(selection);
|
|
257
|
+
const key = targetKey(target);
|
|
258
|
+
const nextEdit: StudioRotationEdit = {
|
|
259
|
+
kind: "rotation",
|
|
260
|
+
target,
|
|
261
|
+
angle: roundRotationAngle(rotation.angle),
|
|
262
|
+
updatedAt: new Date().toISOString(),
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
const edits = manifest.edits.filter(
|
|
266
|
+
(edit) => edit.kind !== "rotation" || targetKey(edit.target) !== key,
|
|
267
|
+
);
|
|
268
|
+
edits.push(nextEdit);
|
|
269
|
+
return { version: 1, edits };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export function removeStudioManualEditsForSelection(
|
|
273
|
+
manifest: StudioManualEditManifest,
|
|
274
|
+
selection: DomEditSelection,
|
|
275
|
+
): StudioManualEditManifest {
|
|
276
|
+
const key = targetKey(selectionTarget(selection));
|
|
277
|
+
const edits = manifest.edits.filter((edit) => targetKey(edit.target) !== key);
|
|
278
|
+
if (edits.length === manifest.edits.length) return manifest;
|
|
279
|
+
return { version: 1, edits };
|
|
280
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import {
|
|
2
|
+
styleUsesStudioOffset,
|
|
3
|
+
styleUsesStudioSize,
|
|
4
|
+
styleUsesStudioRotation,
|
|
5
|
+
restoreInlineDisplay,
|
|
6
|
+
} from "./manualEditsDom";
|
|
7
|
+
import {
|
|
8
|
+
STUDIO_OFFSET_X_PROP,
|
|
9
|
+
STUDIO_OFFSET_Y_PROP,
|
|
10
|
+
STUDIO_WIDTH_PROP,
|
|
11
|
+
STUDIO_HEIGHT_PROP,
|
|
12
|
+
STUDIO_ROTATION_PROP,
|
|
13
|
+
STUDIO_PATH_OFFSET_ATTR,
|
|
14
|
+
STUDIO_MANUAL_EDIT_GESTURE_ATTR,
|
|
15
|
+
STUDIO_BOX_SIZE_ATTR,
|
|
16
|
+
STUDIO_ROTATION_ATTR,
|
|
17
|
+
STUDIO_ORIGINAL_TRANSLATE_ATTR,
|
|
18
|
+
STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR,
|
|
19
|
+
STUDIO_ORIGINAL_WIDTH_ATTR,
|
|
20
|
+
STUDIO_ORIGINAL_HEIGHT_ATTR,
|
|
21
|
+
STUDIO_ORIGINAL_MIN_WIDTH_ATTR,
|
|
22
|
+
STUDIO_ORIGINAL_MIN_HEIGHT_ATTR,
|
|
23
|
+
STUDIO_ORIGINAL_MAX_WIDTH_ATTR,
|
|
24
|
+
STUDIO_ORIGINAL_MAX_HEIGHT_ATTR,
|
|
25
|
+
STUDIO_ORIGINAL_FLEX_BASIS_ATTR,
|
|
26
|
+
STUDIO_ORIGINAL_FLEX_GROW_ATTR,
|
|
27
|
+
STUDIO_ORIGINAL_FLEX_SHRINK_ATTR,
|
|
28
|
+
STUDIO_ORIGINAL_BOX_SIZING_ATTR,
|
|
29
|
+
STUDIO_ORIGINAL_SCALE_ATTR,
|
|
30
|
+
STUDIO_ORIGINAL_TRANSFORM_ORIGIN_ATTR,
|
|
31
|
+
STUDIO_ORIGINAL_DISPLAY_ATTR,
|
|
32
|
+
STUDIO_ORIGINAL_ROTATE_ATTR,
|
|
33
|
+
STUDIO_ORIGINAL_INLINE_ROTATE_ATTR,
|
|
34
|
+
STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR,
|
|
35
|
+
STUDIO_ROTATION_DRAFT_ATTR,
|
|
36
|
+
STUDIO_ORIGINAL_TRANSFORM_DISPLAY_ATTR,
|
|
37
|
+
} from "./manualEditsTypes";
|
|
38
|
+
import type {
|
|
39
|
+
StudioBoxSizeSnapshot,
|
|
40
|
+
StudioRotationSnapshot,
|
|
41
|
+
StudioPathOffsetSnapshot,
|
|
42
|
+
} from "./manualEditsTypes";
|
|
43
|
+
|
|
44
|
+
/* ── Capture ──────────────────────────────────────────────────────── */
|
|
45
|
+
export function captureStudioBoxSize(element: HTMLElement): StudioBoxSizeSnapshot {
|
|
46
|
+
return {
|
|
47
|
+
width: element.style.getPropertyValue("width"),
|
|
48
|
+
height: element.style.getPropertyValue("height"),
|
|
49
|
+
minWidth: element.style.getPropertyValue("min-width"),
|
|
50
|
+
minHeight: element.style.getPropertyValue("min-height"),
|
|
51
|
+
maxWidth: element.style.getPropertyValue("max-width"),
|
|
52
|
+
maxHeight: element.style.getPropertyValue("max-height"),
|
|
53
|
+
flexBasis: element.style.getPropertyValue("flex-basis"),
|
|
54
|
+
flexGrow: element.style.getPropertyValue("flex-grow"),
|
|
55
|
+
flexShrink: element.style.getPropertyValue("flex-shrink"),
|
|
56
|
+
boxSizing: element.style.getPropertyValue("box-sizing"),
|
|
57
|
+
scale: element.style.getPropertyValue("scale"),
|
|
58
|
+
transformOrigin: element.style.getPropertyValue("transform-origin"),
|
|
59
|
+
display: element.style.getPropertyValue("display"),
|
|
60
|
+
studioWidth: element.style.getPropertyValue(STUDIO_WIDTH_PROP),
|
|
61
|
+
studioHeight: element.style.getPropertyValue(STUDIO_HEIGHT_PROP),
|
|
62
|
+
marker: element.getAttribute(STUDIO_BOX_SIZE_ATTR),
|
|
63
|
+
originalWidth: element.getAttribute(STUDIO_ORIGINAL_WIDTH_ATTR),
|
|
64
|
+
originalHeight: element.getAttribute(STUDIO_ORIGINAL_HEIGHT_ATTR),
|
|
65
|
+
originalMinWidth: element.getAttribute(STUDIO_ORIGINAL_MIN_WIDTH_ATTR),
|
|
66
|
+
originalMinHeight: element.getAttribute(STUDIO_ORIGINAL_MIN_HEIGHT_ATTR),
|
|
67
|
+
originalMaxWidth: element.getAttribute(STUDIO_ORIGINAL_MAX_WIDTH_ATTR),
|
|
68
|
+
originalMaxHeight: element.getAttribute(STUDIO_ORIGINAL_MAX_HEIGHT_ATTR),
|
|
69
|
+
originalFlexBasis: element.getAttribute(STUDIO_ORIGINAL_FLEX_BASIS_ATTR),
|
|
70
|
+
originalFlexGrow: element.getAttribute(STUDIO_ORIGINAL_FLEX_GROW_ATTR),
|
|
71
|
+
originalFlexShrink: element.getAttribute(STUDIO_ORIGINAL_FLEX_SHRINK_ATTR),
|
|
72
|
+
originalBoxSizing: element.getAttribute(STUDIO_ORIGINAL_BOX_SIZING_ATTR),
|
|
73
|
+
originalScale: element.getAttribute(STUDIO_ORIGINAL_SCALE_ATTR),
|
|
74
|
+
originalTransformOrigin: element.getAttribute(STUDIO_ORIGINAL_TRANSFORM_ORIGIN_ATTR),
|
|
75
|
+
originalDisplay: element.getAttribute(STUDIO_ORIGINAL_DISPLAY_ATTR),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function captureStudioRotation(element: HTMLElement): StudioRotationSnapshot {
|
|
80
|
+
return {
|
|
81
|
+
rotate: element.style.getPropertyValue("rotate"),
|
|
82
|
+
transformOrigin: element.style.getPropertyValue("transform-origin"),
|
|
83
|
+
studioRotation: element.style.getPropertyValue(STUDIO_ROTATION_PROP),
|
|
84
|
+
marker: element.getAttribute(STUDIO_ROTATION_ATTR),
|
|
85
|
+
draftMarker: element.getAttribute(STUDIO_ROTATION_DRAFT_ATTR),
|
|
86
|
+
originalRotate: element.getAttribute(STUDIO_ORIGINAL_ROTATE_ATTR),
|
|
87
|
+
originalInlineRotate: element.getAttribute(STUDIO_ORIGINAL_INLINE_ROTATE_ATTR),
|
|
88
|
+
originalTransformOrigin: element.getAttribute(STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function captureStudioPathOffset(element: HTMLElement): StudioPathOffsetSnapshot {
|
|
93
|
+
return {
|
|
94
|
+
translate: element.style.getPropertyValue("translate"),
|
|
95
|
+
x: element.style.getPropertyValue(STUDIO_OFFSET_X_PROP),
|
|
96
|
+
y: element.style.getPropertyValue(STUDIO_OFFSET_Y_PROP),
|
|
97
|
+
marker: element.getAttribute(STUDIO_PATH_OFFSET_ATTR),
|
|
98
|
+
originalTranslate: element.getAttribute(STUDIO_ORIGINAL_TRANSLATE_ATTR),
|
|
99
|
+
originalInlineTranslate: element.getAttribute(STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* ── Restore helpers ──────────────────────────────────────────────── */
|
|
104
|
+
function restoreAttribute(element: HTMLElement, attribute: string, value: string | null): void {
|
|
105
|
+
if (value == null) element.removeAttribute(attribute);
|
|
106
|
+
else element.setAttribute(attribute, value);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function restoreStyleProperty(element: HTMLElement, property: string, value: string): void {
|
|
110
|
+
if (value) element.style.setProperty(property, value);
|
|
111
|
+
else element.style.removeProperty(property);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function restoreStudioBoxSize(element: HTMLElement, previous: StudioBoxSizeSnapshot): void {
|
|
115
|
+
restoreStyleProperty(element, "width", previous.width);
|
|
116
|
+
restoreStyleProperty(element, "height", previous.height);
|
|
117
|
+
restoreStyleProperty(element, "min-width", previous.minWidth);
|
|
118
|
+
restoreStyleProperty(element, "min-height", previous.minHeight);
|
|
119
|
+
restoreStyleProperty(element, "max-width", previous.maxWidth);
|
|
120
|
+
restoreStyleProperty(element, "max-height", previous.maxHeight);
|
|
121
|
+
restoreStyleProperty(element, "flex-basis", previous.flexBasis);
|
|
122
|
+
restoreStyleProperty(element, "flex-grow", previous.flexGrow);
|
|
123
|
+
restoreStyleProperty(element, "flex-shrink", previous.flexShrink);
|
|
124
|
+
restoreStyleProperty(element, "box-sizing", previous.boxSizing);
|
|
125
|
+
restoreStyleProperty(element, "scale", previous.scale);
|
|
126
|
+
restoreStyleProperty(element, "transform-origin", previous.transformOrigin);
|
|
127
|
+
restoreStyleProperty(element, "display", previous.display);
|
|
128
|
+
restoreStyleProperty(element, STUDIO_WIDTH_PROP, previous.studioWidth);
|
|
129
|
+
restoreStyleProperty(element, STUDIO_HEIGHT_PROP, previous.studioHeight);
|
|
130
|
+
restoreAttribute(element, STUDIO_BOX_SIZE_ATTR, previous.marker);
|
|
131
|
+
restoreAttribute(element, STUDIO_ORIGINAL_WIDTH_ATTR, previous.originalWidth);
|
|
132
|
+
restoreAttribute(element, STUDIO_ORIGINAL_HEIGHT_ATTR, previous.originalHeight);
|
|
133
|
+
restoreAttribute(element, STUDIO_ORIGINAL_MIN_WIDTH_ATTR, previous.originalMinWidth);
|
|
134
|
+
restoreAttribute(element, STUDIO_ORIGINAL_MIN_HEIGHT_ATTR, previous.originalMinHeight);
|
|
135
|
+
restoreAttribute(element, STUDIO_ORIGINAL_MAX_WIDTH_ATTR, previous.originalMaxWidth);
|
|
136
|
+
restoreAttribute(element, STUDIO_ORIGINAL_MAX_HEIGHT_ATTR, previous.originalMaxHeight);
|
|
137
|
+
restoreAttribute(element, STUDIO_ORIGINAL_FLEX_BASIS_ATTR, previous.originalFlexBasis);
|
|
138
|
+
restoreAttribute(element, STUDIO_ORIGINAL_FLEX_GROW_ATTR, previous.originalFlexGrow);
|
|
139
|
+
restoreAttribute(element, STUDIO_ORIGINAL_FLEX_SHRINK_ATTR, previous.originalFlexShrink);
|
|
140
|
+
restoreAttribute(element, STUDIO_ORIGINAL_BOX_SIZING_ATTR, previous.originalBoxSizing);
|
|
141
|
+
restoreAttribute(element, STUDIO_ORIGINAL_SCALE_ATTR, previous.originalScale);
|
|
142
|
+
restoreAttribute(
|
|
143
|
+
element,
|
|
144
|
+
STUDIO_ORIGINAL_TRANSFORM_ORIGIN_ATTR,
|
|
145
|
+
previous.originalTransformOrigin,
|
|
146
|
+
);
|
|
147
|
+
restoreAttribute(element, STUDIO_ORIGINAL_DISPLAY_ATTR, previous.originalDisplay);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function restoreStudioRotation(
|
|
151
|
+
element: HTMLElement,
|
|
152
|
+
previous: StudioRotationSnapshot,
|
|
153
|
+
): void {
|
|
154
|
+
restoreStyleProperty(element, "rotate", previous.rotate);
|
|
155
|
+
restoreStyleProperty(element, "transform-origin", previous.transformOrigin);
|
|
156
|
+
restoreStyleProperty(element, STUDIO_ROTATION_PROP, previous.studioRotation);
|
|
157
|
+
restoreAttribute(element, STUDIO_ROTATION_ATTR, previous.marker);
|
|
158
|
+
restoreAttribute(element, STUDIO_ROTATION_DRAFT_ATTR, previous.draftMarker);
|
|
159
|
+
restoreAttribute(element, STUDIO_ORIGINAL_ROTATE_ATTR, previous.originalRotate);
|
|
160
|
+
restoreAttribute(element, STUDIO_ORIGINAL_INLINE_ROTATE_ATTR, previous.originalInlineRotate);
|
|
161
|
+
restoreAttribute(
|
|
162
|
+
element,
|
|
163
|
+
STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR,
|
|
164
|
+
previous.originalTransformOrigin,
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function restoreStudioPathOffset(
|
|
169
|
+
element: HTMLElement,
|
|
170
|
+
previous: StudioPathOffsetSnapshot,
|
|
171
|
+
): void {
|
|
172
|
+
if (previous.translate) element.style.setProperty("translate", previous.translate);
|
|
173
|
+
else element.style.removeProperty("translate");
|
|
174
|
+
|
|
175
|
+
if (previous.x) element.style.setProperty(STUDIO_OFFSET_X_PROP, previous.x);
|
|
176
|
+
else element.style.removeProperty(STUDIO_OFFSET_X_PROP);
|
|
177
|
+
|
|
178
|
+
if (previous.y) element.style.setProperty(STUDIO_OFFSET_Y_PROP, previous.y);
|
|
179
|
+
else element.style.removeProperty(STUDIO_OFFSET_Y_PROP);
|
|
180
|
+
|
|
181
|
+
restoreAttribute(element, STUDIO_PATH_OFFSET_ATTR, previous.marker);
|
|
182
|
+
restoreAttribute(element, STUDIO_ORIGINAL_TRANSLATE_ATTR, previous.originalTranslate);
|
|
183
|
+
restoreAttribute(
|
|
184
|
+
element,
|
|
185
|
+
STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR,
|
|
186
|
+
previous.originalInlineTranslate,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* ── DOM element collection ───────────────────────────────────────── */
|
|
191
|
+
export function collectStudioManualEditElements(doc: Document): HTMLElement[] {
|
|
192
|
+
const htmlElement = doc.defaultView?.HTMLElement;
|
|
193
|
+
if (!htmlElement) return [];
|
|
194
|
+
|
|
195
|
+
const elements = [doc.documentElement, ...Array.from(doc.getElementsByTagName("*"))].filter(
|
|
196
|
+
(element): element is HTMLElement => element instanceof htmlElement,
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
return elements.filter(
|
|
200
|
+
(element) =>
|
|
201
|
+
element.hasAttribute(STUDIO_PATH_OFFSET_ATTR) ||
|
|
202
|
+
element.hasAttribute(STUDIO_MANUAL_EDIT_GESTURE_ATTR) ||
|
|
203
|
+
element.hasAttribute(STUDIO_BOX_SIZE_ATTR) ||
|
|
204
|
+
element.hasAttribute(STUDIO_ROTATION_ATTR) ||
|
|
205
|
+
element.hasAttribute(STUDIO_ROTATION_DRAFT_ATTR) ||
|
|
206
|
+
element.hasAttribute(STUDIO_ORIGINAL_TRANSLATE_ATTR) ||
|
|
207
|
+
element.hasAttribute(STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR) ||
|
|
208
|
+
element.hasAttribute(STUDIO_ORIGINAL_TRANSFORM_DISPLAY_ATTR) ||
|
|
209
|
+
element.hasAttribute(STUDIO_ORIGINAL_MIN_WIDTH_ATTR) ||
|
|
210
|
+
element.hasAttribute(STUDIO_ORIGINAL_FLEX_BASIS_ATTR) ||
|
|
211
|
+
element.hasAttribute(STUDIO_ORIGINAL_SCALE_ATTR) ||
|
|
212
|
+
element.hasAttribute(STUDIO_ORIGINAL_ROTATE_ATTR) ||
|
|
213
|
+
element.hasAttribute(STUDIO_ORIGINAL_INLINE_ROTATE_ATTR) ||
|
|
214
|
+
Boolean(element.style.getPropertyValue(STUDIO_OFFSET_X_PROP)) ||
|
|
215
|
+
Boolean(element.style.getPropertyValue(STUDIO_OFFSET_Y_PROP)) ||
|
|
216
|
+
Boolean(element.style.getPropertyValue(STUDIO_WIDTH_PROP)) ||
|
|
217
|
+
Boolean(element.style.getPropertyValue(STUDIO_HEIGHT_PROP)) ||
|
|
218
|
+
Boolean(element.style.getPropertyValue(STUDIO_ROTATION_PROP)),
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* ── Clear functions ──────────────────────────────────────────────── */
|
|
223
|
+
type BoxSizeProperty =
|
|
224
|
+
| "width"
|
|
225
|
+
| "height"
|
|
226
|
+
| "min-width"
|
|
227
|
+
| "min-height"
|
|
228
|
+
| "max-width"
|
|
229
|
+
| "max-height"
|
|
230
|
+
| "flex-basis"
|
|
231
|
+
| "flex-grow"
|
|
232
|
+
| "flex-shrink"
|
|
233
|
+
| "box-sizing"
|
|
234
|
+
| "scale"
|
|
235
|
+
| "transform-origin"
|
|
236
|
+
| "display";
|
|
237
|
+
|
|
238
|
+
function restoreOriginalBoxSizeProperty(
|
|
239
|
+
element: HTMLElement,
|
|
240
|
+
property: BoxSizeProperty,
|
|
241
|
+
attribute: string,
|
|
242
|
+
): void {
|
|
243
|
+
const original = element.getAttribute(attribute);
|
|
244
|
+
if (original == null || original === "") element.style.removeProperty(property);
|
|
245
|
+
else element.style.setProperty(property, original);
|
|
246
|
+
element.removeAttribute(attribute);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function restoreOriginalRotationProperty(element: HTMLElement): void {
|
|
250
|
+
const original = element.getAttribute(STUDIO_ORIGINAL_INLINE_ROTATE_ATTR);
|
|
251
|
+
if (original == null || original === "") element.style.removeProperty("rotate");
|
|
252
|
+
else element.style.setProperty("rotate", original);
|
|
253
|
+
element.removeAttribute(STUDIO_ORIGINAL_INLINE_ROTATE_ATTR);
|
|
254
|
+
element.removeAttribute(STUDIO_ORIGINAL_ROTATE_ATTR);
|
|
255
|
+
const originalTransformOrigin = element.getAttribute(
|
|
256
|
+
STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR,
|
|
257
|
+
);
|
|
258
|
+
if (originalTransformOrigin != null) {
|
|
259
|
+
if (originalTransformOrigin === "") element.style.removeProperty("transform-origin");
|
|
260
|
+
else element.style.setProperty("transform-origin", originalTransformOrigin);
|
|
261
|
+
}
|
|
262
|
+
element.removeAttribute(STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function restoreOriginalTranslateProperty(element: HTMLElement): void {
|
|
266
|
+
const original = element.getAttribute(STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR);
|
|
267
|
+
if (original == null || original === "") element.style.removeProperty("translate");
|
|
268
|
+
else element.style.setProperty("translate", original);
|
|
269
|
+
element.removeAttribute(STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR);
|
|
270
|
+
element.removeAttribute(STUDIO_ORIGINAL_TRANSLATE_ATTR);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export function clearStudioPathOffset(element: HTMLElement): void {
|
|
274
|
+
if (
|
|
275
|
+
element.hasAttribute(STUDIO_PATH_OFFSET_ATTR) ||
|
|
276
|
+
styleUsesStudioOffset(element.style.getPropertyValue("translate"))
|
|
277
|
+
) {
|
|
278
|
+
restoreOriginalTranslateProperty(element);
|
|
279
|
+
}
|
|
280
|
+
restoreInlineDisplay(element);
|
|
281
|
+
element.style.removeProperty(STUDIO_OFFSET_X_PROP);
|
|
282
|
+
element.style.removeProperty(STUDIO_OFFSET_Y_PROP);
|
|
283
|
+
element.removeAttribute(STUDIO_PATH_OFFSET_ATTR);
|
|
284
|
+
element.removeAttribute(STUDIO_ORIGINAL_TRANSLATE_ATTR);
|
|
285
|
+
element.removeAttribute(STUDIO_ORIGINAL_INLINE_TRANSLATE_ATTR);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export function clearStudioRotation(element: HTMLElement): void {
|
|
289
|
+
if (
|
|
290
|
+
element.hasAttribute(STUDIO_ROTATION_ATTR) ||
|
|
291
|
+
styleUsesStudioRotation(element.style.getPropertyValue("rotate"))
|
|
292
|
+
) {
|
|
293
|
+
restoreOriginalRotationProperty(element);
|
|
294
|
+
}
|
|
295
|
+
restoreInlineDisplay(element);
|
|
296
|
+
element.style.removeProperty(STUDIO_ROTATION_PROP);
|
|
297
|
+
element.removeAttribute(STUDIO_ROTATION_ATTR);
|
|
298
|
+
element.removeAttribute(STUDIO_ROTATION_DRAFT_ATTR);
|
|
299
|
+
element.removeAttribute(STUDIO_ORIGINAL_ROTATE_ATTR);
|
|
300
|
+
element.removeAttribute(STUDIO_ORIGINAL_INLINE_ROTATE_ATTR);
|
|
301
|
+
element.removeAttribute(STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export function clearStudioBoxSize(element: HTMLElement): void {
|
|
305
|
+
if (
|
|
306
|
+
element.hasAttribute(STUDIO_BOX_SIZE_ATTR) ||
|
|
307
|
+
styleUsesStudioSize(element.style.getPropertyValue("width")) ||
|
|
308
|
+
styleUsesStudioSize(element.style.getPropertyValue("height")) ||
|
|
309
|
+
element.hasAttribute(STUDIO_ORIGINAL_SCALE_ATTR)
|
|
310
|
+
) {
|
|
311
|
+
restoreOriginalBoxSizeProperty(element, "width", STUDIO_ORIGINAL_WIDTH_ATTR);
|
|
312
|
+
restoreOriginalBoxSizeProperty(element, "height", STUDIO_ORIGINAL_HEIGHT_ATTR);
|
|
313
|
+
restoreOriginalBoxSizeProperty(element, "min-width", STUDIO_ORIGINAL_MIN_WIDTH_ATTR);
|
|
314
|
+
restoreOriginalBoxSizeProperty(element, "min-height", STUDIO_ORIGINAL_MIN_HEIGHT_ATTR);
|
|
315
|
+
restoreOriginalBoxSizeProperty(element, "max-width", STUDIO_ORIGINAL_MAX_WIDTH_ATTR);
|
|
316
|
+
restoreOriginalBoxSizeProperty(element, "max-height", STUDIO_ORIGINAL_MAX_HEIGHT_ATTR);
|
|
317
|
+
restoreOriginalBoxSizeProperty(element, "flex-basis", STUDIO_ORIGINAL_FLEX_BASIS_ATTR);
|
|
318
|
+
restoreOriginalBoxSizeProperty(element, "flex-grow", STUDIO_ORIGINAL_FLEX_GROW_ATTR);
|
|
319
|
+
restoreOriginalBoxSizeProperty(element, "flex-shrink", STUDIO_ORIGINAL_FLEX_SHRINK_ATTR);
|
|
320
|
+
restoreOriginalBoxSizeProperty(element, "box-sizing", STUDIO_ORIGINAL_BOX_SIZING_ATTR);
|
|
321
|
+
restoreOriginalBoxSizeProperty(element, "scale", STUDIO_ORIGINAL_SCALE_ATTR);
|
|
322
|
+
restoreOriginalBoxSizeProperty(
|
|
323
|
+
element,
|
|
324
|
+
"transform-origin",
|
|
325
|
+
STUDIO_ORIGINAL_TRANSFORM_ORIGIN_ATTR,
|
|
326
|
+
);
|
|
327
|
+
restoreOriginalBoxSizeProperty(element, "display", STUDIO_ORIGINAL_DISPLAY_ATTR);
|
|
328
|
+
}
|
|
329
|
+
restoreInlineDisplay(element);
|
|
330
|
+
element.style.removeProperty(STUDIO_WIDTH_PROP);
|
|
331
|
+
element.style.removeProperty(STUDIO_HEIGHT_PROP);
|
|
332
|
+
element.removeAttribute(STUDIO_BOX_SIZE_ATTR);
|
|
333
|
+
}
|