@hyperframes/core 0.7.14 → 0.7.16
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/compiler/staticGuard.js +1 -1
- package/dist/compiler/staticGuard.js.map +1 -1
- package/dist/core.types.d.ts +2 -369
- package/dist/core.types.d.ts.map +1 -1
- package/dist/core.types.js +1 -84
- package/dist/core.types.js.map +1 -1
- package/dist/generated/runtime-inline.js.map +1 -1
- package/dist/generators/hyperframes.d.ts +1 -1
- package/dist/generators/hyperframes.d.ts.map +1 -1
- package/dist/generators/hyperframes.js +1 -1
- package/dist/generators/hyperframes.js.map +1 -1
- package/dist/hyperframe.runtime.iife.js +20 -20
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/lint/index.d.ts +2 -2
- package/dist/lint/index.d.ts.map +1 -1
- package/dist/lint/index.js +2 -1
- package/dist/lint/index.js.map +1 -1
- package/dist/parsers/gsapConstants.d.ts +2 -12
- package/dist/parsers/gsapConstants.d.ts.map +1 -1
- package/dist/parsers/gsapConstants.js +2 -110
- package/dist/parsers/gsapConstants.js.map +1 -1
- package/dist/parsers/gsapParserAcorn.d.ts +2 -48
- package/dist/parsers/gsapParserAcorn.d.ts.map +1 -1
- package/dist/parsers/gsapParserAcorn.js +2 -1057
- package/dist/parsers/gsapParserAcorn.js.map +1 -1
- package/dist/parsers/gsapParserExports.d.ts +2 -20
- package/dist/parsers/gsapParserExports.d.ts.map +1 -1
- package/dist/parsers/gsapParserExports.js +2 -8
- package/dist/parsers/gsapParserExports.js.map +1 -1
- package/dist/parsers/gsapWriterAcorn.d.ts +2 -90
- package/dist/parsers/gsapWriterAcorn.d.ts.map +1 -1
- package/dist/parsers/gsapWriterAcorn.js +2 -2016
- package/dist/parsers/gsapWriterAcorn.js.map +1 -1
- package/dist/parsers/hfIds.d.ts +2 -16
- package/dist/parsers/hfIds.d.ts.map +1 -1
- package/dist/parsers/hfIds.js +2 -127
- package/dist/parsers/hfIds.js.map +1 -1
- package/dist/parsers/springEase.d.ts +2 -28
- package/dist/parsers/springEase.d.ts.map +1 -1
- package/dist/parsers/springEase.js +2 -69
- package/dist/parsers/springEase.js.map +1 -1
- package/dist/slideshow/index.d.ts +1 -0
- package/dist/slideshow/index.d.ts.map +1 -1
- package/dist/slideshow/index.js +1 -0
- package/dist/slideshow/index.js.map +1 -1
- package/dist/studio-api/helpers/draftMarkers.d.ts +2 -10
- package/dist/studio-api/helpers/draftMarkers.d.ts.map +1 -1
- package/dist/studio-api/helpers/draftMarkers.js +2 -10
- package/dist/studio-api/helpers/draftMarkers.js.map +1 -1
- package/dist/studio-api/helpers/finiteMutation.d.ts +2 -10
- package/dist/studio-api/helpers/finiteMutation.d.ts.map +1 -1
- package/dist/studio-api/helpers/finiteMutation.js +2 -20
- package/dist/studio-api/helpers/finiteMutation.js.map +1 -1
- package/dist/studio-api/helpers/manualEditsRenderScript.d.ts +2 -12
- package/dist/studio-api/helpers/manualEditsRenderScript.d.ts.map +1 -1
- package/dist/studio-api/helpers/manualEditsRenderScript.js +2 -632
- package/dist/studio-api/helpers/manualEditsRenderScript.js.map +1 -1
- package/dist/studio-api/helpers/screenshotClip.d.ts +2 -7
- package/dist/studio-api/helpers/screenshotClip.d.ts.map +1 -1
- package/dist/studio-api/helpers/screenshotClip.js +2 -21
- package/dist/studio-api/helpers/screenshotClip.js.map +1 -1
- package/dist/studio-api/helpers/studioMotionRenderScript.d.ts +2 -8
- package/dist/studio-api/helpers/studioMotionRenderScript.d.ts.map +1 -1
- package/dist/studio-api/helpers/studioMotionRenderScript.js +2 -207
- package/dist/studio-api/helpers/studioMotionRenderScript.js.map +1 -1
- package/dist/studio-api/index.d.ts +2 -9
- package/dist/studio-api/index.d.ts.map +1 -1
- package/dist/studio-api/index.js +2 -8
- package/dist/studio-api/index.js.map +1 -1
- package/package.json +16 -18
- package/dist/generated/runtime-inline.js +0 -11
- package/dist/hyperframe.manifest.json +0 -22
- package/dist/hyperframe.runtime.mjs +0 -325
- package/dist/lint/context.d.ts +0 -17
- package/dist/lint/context.d.ts.map +0 -1
- package/dist/lint/context.js +0 -37
- package/dist/lint/context.js.map +0 -1
- package/dist/lint/hyperframeLinter.d.ts +0 -14
- package/dist/lint/hyperframeLinter.d.ts.map +0 -1
- package/dist/lint/hyperframeLinter.js +0 -132
- package/dist/lint/hyperframeLinter.js.map +0 -1
- package/dist/lint/rules/adapters.d.ts +0 -3
- package/dist/lint/rules/adapters.d.ts.map +0 -1
- package/dist/lint/rules/adapters.js +0 -40
- package/dist/lint/rules/adapters.js.map +0 -1
- package/dist/lint/rules/captions.d.ts +0 -3
- package/dist/lint/rules/captions.d.ts.map +0 -1
- package/dist/lint/rules/captions.js +0 -242
- package/dist/lint/rules/captions.js.map +0 -1
- package/dist/lint/rules/composition.d.ts +0 -5
- package/dist/lint/rules/composition.d.ts.map +0 -1
- package/dist/lint/rules/composition.js +0 -694
- package/dist/lint/rules/composition.js.map +0 -1
- package/dist/lint/rules/core.d.ts +0 -3
- package/dist/lint/rules/core.d.ts.map +0 -1
- package/dist/lint/rules/core.js +0 -432
- package/dist/lint/rules/core.js.map +0 -1
- package/dist/lint/rules/fonts.d.ts +0 -3
- package/dist/lint/rules/fonts.d.ts.map +0 -1
- package/dist/lint/rules/fonts.js +0 -205
- package/dist/lint/rules/fonts.js.map +0 -1
- package/dist/lint/rules/gsap.d.ts +0 -4
- package/dist/lint/rules/gsap.d.ts.map +0 -1
- package/dist/lint/rules/gsap.js +0 -1039
- package/dist/lint/rules/gsap.js.map +0 -1
- package/dist/lint/rules/media.d.ts +0 -3
- package/dist/lint/rules/media.d.ts.map +0 -1
- package/dist/lint/rules/media.js +0 -491
- package/dist/lint/rules/media.js.map +0 -1
- package/dist/lint/rules/slideshow.d.ts +0 -4
- package/dist/lint/rules/slideshow.d.ts.map +0 -1
- package/dist/lint/rules/slideshow.js +0 -74
- package/dist/lint/rules/slideshow.js.map +0 -1
- package/dist/lint/rules/textures.d.ts +0 -3
- package/dist/lint/rules/textures.d.ts.map +0 -1
- package/dist/lint/rules/textures.js +0 -192
- package/dist/lint/rules/textures.js.map +0 -1
- package/dist/lint/types.d.ts +0 -36
- package/dist/lint/types.d.ts.map +0 -1
- package/dist/lint/types.js +0 -2
- package/dist/lint/types.js.map +0 -1
- package/dist/lint/utils.d.ts +0 -55
- package/dist/lint/utils.d.ts.map +0 -1
- package/dist/lint/utils.js +0 -264
- package/dist/lint/utils.js.map +0 -1
- package/dist/parsers/gsapInline.d.ts +0 -47
- package/dist/parsers/gsapInline.d.ts.map +0 -1
- package/dist/parsers/gsapInline.js +0 -513
- package/dist/parsers/gsapInline.js.map +0 -1
- package/dist/parsers/gsapParser.d.ts +0 -158
- package/dist/parsers/gsapParser.d.ts.map +0 -1
- package/dist/parsers/gsapParser.js +0 -2634
- package/dist/parsers/gsapParser.js.map +0 -1
- package/dist/parsers/gsapParser.test-helpers.d.ts +0 -49
- package/dist/parsers/gsapParser.test-helpers.d.ts.map +0 -1
- package/dist/parsers/gsapParser.test-helpers.js +0 -97
- package/dist/parsers/gsapParser.test-helpers.js.map +0 -1
- package/dist/parsers/gsapSerialize.d.ts +0 -191
- package/dist/parsers/gsapSerialize.d.ts.map +0 -1
- package/dist/parsers/gsapSerialize.js +0 -410
- package/dist/parsers/gsapSerialize.js.map +0 -1
- package/dist/parsers/gsapUnroll.d.ts +0 -7
- package/dist/parsers/gsapUnroll.d.ts.map +0 -1
- package/dist/parsers/gsapUnroll.js +0 -137
- package/dist/parsers/gsapUnroll.js.map +0 -1
- package/dist/parsers/htmlParser.d.ts +0 -27
- package/dist/parsers/htmlParser.d.ts.map +0 -1
- package/dist/parsers/htmlParser.js +0 -731
- package/dist/parsers/htmlParser.js.map +0 -1
- package/dist/studio-api/createStudioApi.d.ts +0 -10
- package/dist/studio-api/createStudioApi.d.ts.map +0 -1
- package/dist/studio-api/createStudioApi.js +0 -32
- package/dist/studio-api/createStudioApi.js.map +0 -1
- package/dist/studio-api/helpers/backupJournal.d.ts +0 -9
- package/dist/studio-api/helpers/backupJournal.d.ts.map +0 -1
- package/dist/studio-api/helpers/backupJournal.js +0 -81
- package/dist/studio-api/helpers/backupJournal.js.map +0 -1
- package/dist/studio-api/helpers/hfIdPersist.d.ts +0 -11
- package/dist/studio-api/helpers/hfIdPersist.d.ts.map +0 -1
- package/dist/studio-api/helpers/hfIdPersist.js +0 -39
- package/dist/studio-api/helpers/hfIdPersist.js.map +0 -1
- package/dist/studio-api/helpers/mediaValidation.d.ts +0 -20
- package/dist/studio-api/helpers/mediaValidation.d.ts.map +0 -1
- package/dist/studio-api/helpers/mediaValidation.js +0 -56
- package/dist/studio-api/helpers/mediaValidation.js.map +0 -1
- package/dist/studio-api/helpers/mime.d.ts +0 -4
- package/dist/studio-api/helpers/mime.d.ts.map +0 -1
- package/dist/studio-api/helpers/mime.js +0 -39
- package/dist/studio-api/helpers/mime.js.map +0 -1
- package/dist/studio-api/helpers/previewAdapter.d.ts +0 -43
- package/dist/studio-api/helpers/previewAdapter.d.ts.map +0 -1
- package/dist/studio-api/helpers/previewAdapter.js +0 -118
- package/dist/studio-api/helpers/previewAdapter.js.map +0 -1
- package/dist/studio-api/helpers/projectSignature.d.ts +0 -5
- package/dist/studio-api/helpers/projectSignature.d.ts.map +0 -1
- package/dist/studio-api/helpers/projectSignature.js +0 -154
- package/dist/studio-api/helpers/projectSignature.js.map +0 -1
- package/dist/studio-api/helpers/safePath.d.ts +0 -12
- package/dist/studio-api/helpers/safePath.d.ts.map +0 -1
- package/dist/studio-api/helpers/safePath.js +0 -38
- package/dist/studio-api/helpers/safePath.js.map +0 -1
- package/dist/studio-api/helpers/sourceMutation.d.ts +0 -28
- package/dist/studio-api/helpers/sourceMutation.d.ts.map +0 -1
- package/dist/studio-api/helpers/sourceMutation.js +0 -339
- package/dist/studio-api/helpers/sourceMutation.js.map +0 -1
- package/dist/studio-api/helpers/subComposition.d.ts +0 -20
- package/dist/studio-api/helpers/subComposition.d.ts.map +0 -1
- package/dist/studio-api/helpers/subComposition.js +0 -289
- package/dist/studio-api/helpers/subComposition.js.map +0 -1
- package/dist/studio-api/helpers/waveform.d.ts +0 -4
- package/dist/studio-api/helpers/waveform.d.ts.map +0 -1
- package/dist/studio-api/helpers/waveform.js +0 -80
- package/dist/studio-api/helpers/waveform.js.map +0 -1
- package/dist/studio-api/routes/files.d.ts +0 -4
- package/dist/studio-api/routes/files.d.ts.map +0 -1
- package/dist/studio-api/routes/files.js +0 -1200
- package/dist/studio-api/routes/files.js.map +0 -1
- package/dist/studio-api/routes/fonts.d.ts +0 -3
- package/dist/studio-api/routes/fonts.d.ts.map +0 -1
- package/dist/studio-api/routes/fonts.js +0 -157
- package/dist/studio-api/routes/fonts.js.map +0 -1
- package/dist/studio-api/routes/lint.d.ts +0 -4
- package/dist/studio-api/routes/lint.d.ts.map +0 -1
- package/dist/studio-api/routes/lint.js +0 -29
- package/dist/studio-api/routes/lint.js.map +0 -1
- package/dist/studio-api/routes/preview.d.ts +0 -4
- package/dist/studio-api/routes/preview.d.ts.map +0 -1
- package/dist/studio-api/routes/preview.js +0 -331
- package/dist/studio-api/routes/preview.js.map +0 -1
- package/dist/studio-api/routes/projects.d.ts +0 -4
- package/dist/studio-api/routes/projects.d.ts.map +0 -1
- package/dist/studio-api/routes/projects.js +0 -45
- package/dist/studio-api/routes/projects.js.map +0 -1
- package/dist/studio-api/routes/registry.d.ts +0 -4
- package/dist/studio-api/routes/registry.d.ts.map +0 -1
- package/dist/studio-api/routes/registry.js +0 -31
- package/dist/studio-api/routes/registry.js.map +0 -1
- package/dist/studio-api/routes/render.d.ts +0 -4
- package/dist/studio-api/routes/render.d.ts.map +0 -1
- package/dist/studio-api/routes/render.js +0 -269
- package/dist/studio-api/routes/render.js.map +0 -1
- package/dist/studio-api/routes/storyboard.d.ts +0 -4
- package/dist/studio-api/routes/storyboard.d.ts.map +0 -1
- package/dist/studio-api/routes/storyboard.js +0 -65
- package/dist/studio-api/routes/storyboard.js.map +0 -1
- package/dist/studio-api/routes/thumbnail.d.ts +0 -4
- package/dist/studio-api/routes/thumbnail.d.ts.map +0 -1
- package/dist/studio-api/routes/thumbnail.js +0 -107
- package/dist/studio-api/routes/thumbnail.js.map +0 -1
- package/dist/studio-api/routes/waveform.d.ts +0 -4
- package/dist/studio-api/routes/waveform.d.ts.map +0 -1
- package/dist/studio-api/routes/waveform.js +0 -41
- package/dist/studio-api/routes/waveform.js.map +0 -1
- package/dist/studio-api/types.d.ts +0 -120
- package/dist/studio-api/types.d.ts.map +0 -1
- package/dist/studio-api/types.js +0 -2
- package/dist/studio-api/types.js.map +0 -1
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
3
|
-
import { extname, isAbsolute, relative, resolve } from "node:path";
|
|
4
|
-
const SIGNATURE_TEXT_EXTENSIONS = new Set([
|
|
5
|
-
".cjs",
|
|
6
|
-
".css",
|
|
7
|
-
".html",
|
|
8
|
-
".js",
|
|
9
|
-
".json",
|
|
10
|
-
".jsx",
|
|
11
|
-
".mjs",
|
|
12
|
-
".svg",
|
|
13
|
-
".ts",
|
|
14
|
-
".tsx",
|
|
15
|
-
]);
|
|
16
|
-
const SIGNATURE_EXCLUDED_DIRS = new Set([
|
|
17
|
-
".cache",
|
|
18
|
-
".git",
|
|
19
|
-
".hyperframes",
|
|
20
|
-
".next",
|
|
21
|
-
".vite",
|
|
22
|
-
"build",
|
|
23
|
-
"coverage",
|
|
24
|
-
"dist",
|
|
25
|
-
"node_modules",
|
|
26
|
-
"outputs",
|
|
27
|
-
"renders",
|
|
28
|
-
]);
|
|
29
|
-
const MAX_SIGNATURE_TEXT_BYTES = 2_000_000;
|
|
30
|
-
const STUDIO_SIGNATURE_MANIFEST_PATHS = [
|
|
31
|
-
".hyperframes/studio-manual-edits.json",
|
|
32
|
-
".hyperframes/studio-motion.json",
|
|
33
|
-
];
|
|
34
|
-
const projectSignatureCache = new Map();
|
|
35
|
-
function isPathWithin(parentDir, childPath) {
|
|
36
|
-
const childRelativePath = relative(parentDir, childPath);
|
|
37
|
-
return (childRelativePath === "" ||
|
|
38
|
-
(!childRelativePath.startsWith("..") && !isAbsolute(childRelativePath)));
|
|
39
|
-
}
|
|
40
|
-
function isTextContentEligible(file, size) {
|
|
41
|
-
return (SIGNATURE_TEXT_EXTENSIONS.has(extname(file).toLowerCase()) && size <= MAX_SIGNATURE_TEXT_BYTES);
|
|
42
|
-
}
|
|
43
|
-
function collectProjectSignatureFiles(projectDir, dir, files) {
|
|
44
|
-
let entries;
|
|
45
|
-
try {
|
|
46
|
-
entries = readdirSync(dir).sort();
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
for (const entry of entries) {
|
|
52
|
-
if (SIGNATURE_EXCLUDED_DIRS.has(entry))
|
|
53
|
-
continue;
|
|
54
|
-
const file = resolve(dir, entry);
|
|
55
|
-
if (!isPathWithin(projectDir, file))
|
|
56
|
-
continue;
|
|
57
|
-
let stat;
|
|
58
|
-
try {
|
|
59
|
-
stat = lstatSync(file);
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (stat.isSymbolicLink())
|
|
65
|
-
continue;
|
|
66
|
-
if (stat.isDirectory()) {
|
|
67
|
-
collectProjectSignatureFiles(projectDir, file, files);
|
|
68
|
-
}
|
|
69
|
-
else if (stat.isFile()) {
|
|
70
|
-
files.push({
|
|
71
|
-
file,
|
|
72
|
-
mtimeMs: stat.mtimeMs,
|
|
73
|
-
size: stat.size,
|
|
74
|
-
textContentEligible: isTextContentEligible(file, stat.size),
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function collectProjectSignatureManifestFiles(projectDir, files) {
|
|
80
|
-
const seen = new Set(files.map((entry) => entry.file));
|
|
81
|
-
for (const manifestPath of STUDIO_SIGNATURE_MANIFEST_PATHS) {
|
|
82
|
-
const file = resolve(projectDir, manifestPath);
|
|
83
|
-
if (seen.has(file) || !isPathWithin(projectDir, file))
|
|
84
|
-
continue;
|
|
85
|
-
let stat;
|
|
86
|
-
try {
|
|
87
|
-
stat = lstatSync(file);
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (stat.isSymbolicLink() || !stat.isFile())
|
|
93
|
-
continue;
|
|
94
|
-
files.push({
|
|
95
|
-
file,
|
|
96
|
-
mtimeMs: stat.mtimeMs,
|
|
97
|
-
size: stat.size,
|
|
98
|
-
textContentEligible: isTextContentEligible(file, stat.size),
|
|
99
|
-
});
|
|
100
|
-
seen.add(file);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function createProjectFingerprint(projectDir, files) {
|
|
104
|
-
const hash = createHash("sha256");
|
|
105
|
-
for (const entry of files) {
|
|
106
|
-
hash.update(relative(projectDir, entry.file));
|
|
107
|
-
hash.update("\0");
|
|
108
|
-
hash.update(String(entry.size));
|
|
109
|
-
hash.update("\0");
|
|
110
|
-
hash.update(String(entry.mtimeMs));
|
|
111
|
-
hash.update("\0");
|
|
112
|
-
hash.update(entry.textContentEligible ? "text" : "binary");
|
|
113
|
-
hash.update("\0");
|
|
114
|
-
}
|
|
115
|
-
return hash.digest("hex").slice(0, 24);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Creates a stable preview cache-busting signature for project source plus Studio manifests.
|
|
119
|
-
*/
|
|
120
|
-
export function createProjectSignature(projectDir) {
|
|
121
|
-
const normalizedProjectDir = resolve(projectDir);
|
|
122
|
-
const files = [];
|
|
123
|
-
collectProjectSignatureFiles(normalizedProjectDir, normalizedProjectDir, files);
|
|
124
|
-
collectProjectSignatureManifestFiles(normalizedProjectDir, files);
|
|
125
|
-
files.sort((a, b) => a.file.localeCompare(b.file));
|
|
126
|
-
const fingerprint = createProjectFingerprint(normalizedProjectDir, files);
|
|
127
|
-
const cached = projectSignatureCache.get(normalizedProjectDir);
|
|
128
|
-
if (cached?.fingerprint === fingerprint)
|
|
129
|
-
return cached.signature;
|
|
130
|
-
const hash = createHash("sha256");
|
|
131
|
-
for (const entry of files) {
|
|
132
|
-
const relativePath = relative(normalizedProjectDir, entry.file);
|
|
133
|
-
hash.update(relativePath);
|
|
134
|
-
hash.update("\0");
|
|
135
|
-
hash.update(String(entry.size));
|
|
136
|
-
hash.update("\0");
|
|
137
|
-
if (entry.textContentEligible) {
|
|
138
|
-
try {
|
|
139
|
-
hash.update(readFileSync(entry.file));
|
|
140
|
-
}
|
|
141
|
-
catch {
|
|
142
|
-
hash.update(String(entry.mtimeMs));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
hash.update(String(entry.mtimeMs));
|
|
147
|
-
}
|
|
148
|
-
hash.update("\0");
|
|
149
|
-
}
|
|
150
|
-
const signature = hash.digest("hex").slice(0, 24);
|
|
151
|
-
projectSignatureCache.set(normalizedProjectDir, { fingerprint, signature });
|
|
152
|
-
return signature;
|
|
153
|
-
}
|
|
154
|
-
//# sourceMappingURL=projectSignature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"projectSignature.js","sourceRoot":"","sources":["../../../src/studio-api/helpers/projectSignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC;IACxC,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL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,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClD,qBAAqB,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5E,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { isSafePath, resolveWithinProject } from "../../safePath.js";
|
|
2
|
-
/**
|
|
3
|
-
* True when any directory segment of a relative path is a dot-directory or
|
|
4
|
-
* node_modules. Projects that vendor tooling assets under dot-directories
|
|
5
|
-
* (.hyperframes/, .cache/, …) ship example/preset HTML that must not surface
|
|
6
|
-
* as project compositions or studio lint targets (#1384). The file tree is
|
|
7
|
-
* deliberately not filtered — this only gates discovery.
|
|
8
|
-
*/
|
|
9
|
-
export declare function isInHiddenOrVendorDir(relPath: string): boolean;
|
|
10
|
-
/** Recursively walk a directory and return relative file paths. */
|
|
11
|
-
export declare function walkDir(dir: string, prefix?: string): string[];
|
|
12
|
-
//# sourceMappingURL=safePath.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safePath.d.ts","sourceRoot":"","sources":["../../../src/studio-api/helpers/safePath.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAQrE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG9D;AAED,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAK,GAAG,MAAM,EAAE,CAY1D"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { readdirSync } from "node:fs";
|
|
3
|
-
// `isSafePath` lives at the package root so non-studio-api layers (compiler,
|
|
4
|
-
// CLI, engine) can share it without a backwards dependency on studio-api.
|
|
5
|
-
// Re-exported here for back-compat with existing `../helpers/safePath.js` imports.
|
|
6
|
-
export { isSafePath, resolveWithinProject } from "../../safePath.js";
|
|
7
|
-
const IGNORE_DIRS = new Set([".thumbnails", "node_modules", ".git"]);
|
|
8
|
-
function shouldIgnoreDir(rel) {
|
|
9
|
-
return rel === ".hyperframes/backup";
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* True when any directory segment of a relative path is a dot-directory or
|
|
13
|
-
* node_modules. Projects that vendor tooling assets under dot-directories
|
|
14
|
-
* (.hyperframes/, .cache/, …) ship example/preset HTML that must not surface
|
|
15
|
-
* as project compositions or studio lint targets (#1384). The file tree is
|
|
16
|
-
* deliberately not filtered — this only gates discovery.
|
|
17
|
-
*/
|
|
18
|
-
export function isInHiddenOrVendorDir(relPath) {
|
|
19
|
-
const segments = relPath.split("/");
|
|
20
|
-
return segments.slice(0, -1).some((seg) => seg.startsWith(".") || seg === "node_modules");
|
|
21
|
-
}
|
|
22
|
-
/** Recursively walk a directory and return relative file paths. */
|
|
23
|
-
export function walkDir(dir, prefix = "") {
|
|
24
|
-
const files = [];
|
|
25
|
-
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
26
|
-
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
27
|
-
if (IGNORE_DIRS.has(entry.name) || shouldIgnoreDir(rel))
|
|
28
|
-
continue;
|
|
29
|
-
if (entry.isDirectory()) {
|
|
30
|
-
files.push(...walkDir(join(dir, entry.name), rel));
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
files.push(rel);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return files;
|
|
37
|
-
}
|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AAC,KAAK,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,GAAG,CAAC;YAAE,SAAS;QAClE,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export interface SourceMutationTarget {
|
|
2
|
-
id?: string | null;
|
|
3
|
-
hfId?: string;
|
|
4
|
-
selector?: string;
|
|
5
|
-
selectorIndex?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare function removeElementFromHtml(source: string, target: SourceMutationTarget): string;
|
|
8
|
-
export declare function isHTMLElement(el: Element): el is HTMLElement;
|
|
9
|
-
export interface PatchOperation {
|
|
10
|
-
type: "inline-style" | "attribute" | "html-attribute" | "text-content";
|
|
11
|
-
property: string;
|
|
12
|
-
value: string | null;
|
|
13
|
-
}
|
|
14
|
-
export declare function patchElementInHtml(source: string, target: SourceMutationTarget, operations: PatchOperation[]): {
|
|
15
|
-
html: string;
|
|
16
|
-
matched: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare function probeElementInSource(source: string, target: SourceMutationTarget): boolean;
|
|
19
|
-
export interface SplitElementResult {
|
|
20
|
-
html: string;
|
|
21
|
-
matched: boolean;
|
|
22
|
-
newId: string | null;
|
|
23
|
-
}
|
|
24
|
-
export declare function splitElementInHtml(source: string, target: SourceMutationTarget, splitTime: number, newId: string, fallbackTiming?: {
|
|
25
|
-
start: number;
|
|
26
|
-
duration: number;
|
|
27
|
-
}): SplitElementResult;
|
|
28
|
-
//# sourceMappingURL=sourceMutation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|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AAM,CAAA;CAAE,GACnD,kBAAkB,CAkFpB"}
|
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import { parseHTML } from "linkedom";
|
|
2
|
-
import postcss from "postcss";
|
|
3
|
-
import selectorParser from "postcss-selector-parser";
|
|
4
|
-
import { isAllowedHtmlAttribute, isSafeAttributeValue } from "../../utils/htmlAttrSafety.js";
|
|
5
|
-
function parseSourceDocument(source) {
|
|
6
|
-
const hasDocumentShell = /<!doctype|<html[\s>]/i.test(source);
|
|
7
|
-
if (hasDocumentShell) {
|
|
8
|
-
return { document: parseHTML(source).document, wrappedFragment: false };
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
document: parseHTML(`<!DOCTYPE html><html><head></head><body>${source}</body></html>`).document,
|
|
12
|
-
wrappedFragment: true,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function duplicateCssRulesForId(document, originalId, newId) {
|
|
16
|
-
const idToken = `#${originalId}`;
|
|
17
|
-
const transform = selectorParser((selectors) => {
|
|
18
|
-
selectors.walkIds((node) => {
|
|
19
|
-
if (node.value === originalId)
|
|
20
|
-
node.value = newId;
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
for (const styleEl of document.querySelectorAll("style")) {
|
|
24
|
-
const css = styleEl.textContent ?? "";
|
|
25
|
-
let root;
|
|
26
|
-
try {
|
|
27
|
-
root = postcss.parse(css);
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
const clones = [];
|
|
33
|
-
root.walkRules((rule) => {
|
|
34
|
-
if (!rule.selector.includes(idToken))
|
|
35
|
-
return;
|
|
36
|
-
const newSelector = transform.processSync(rule.selector);
|
|
37
|
-
if (newSelector === rule.selector)
|
|
38
|
-
return;
|
|
39
|
-
const clone = rule.clone({ selector: newSelector });
|
|
40
|
-
clones.push(clone);
|
|
41
|
-
});
|
|
42
|
-
if (clones.length > 0) {
|
|
43
|
-
for (const c of clones)
|
|
44
|
-
root.append(c);
|
|
45
|
-
styleEl.textContent = root.toString();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function querySelectorAllWithTemplates(root, selector) {
|
|
50
|
-
const matches = Array.from(root.querySelectorAll(selector));
|
|
51
|
-
if (matches.length > 0)
|
|
52
|
-
return matches;
|
|
53
|
-
// querySelectorAll doesn't traverse <template> content in linkedom.
|
|
54
|
-
// Search directly on each template element (NOT .content — removing from
|
|
55
|
-
// .content's DocumentFragment doesn't update the serialized output).
|
|
56
|
-
const templates = Array.from(root.querySelectorAll("template"));
|
|
57
|
-
for (const tmpl of templates) {
|
|
58
|
-
const inner = tmpl.querySelectorAll(selector);
|
|
59
|
-
if (inner.length > 0)
|
|
60
|
-
return Array.from(inner);
|
|
61
|
-
}
|
|
62
|
-
return [];
|
|
63
|
-
}
|
|
64
|
-
// Prevent CSS attribute-selector injection via a crafted hfId: escape
|
|
65
|
-
// backslashes first, then double-quotes. Keeps a malformed/hostile value from
|
|
66
|
-
// breaking out of the `[data-hf-id="…"]` selector once callers beyond the
|
|
67
|
-
// internal mint contract (R2+ user flows) pass values here.
|
|
68
|
-
function escapeCssAttrValue(value) {
|
|
69
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
70
|
-
}
|
|
71
|
-
function findByHfId(document, hfId) {
|
|
72
|
-
try {
|
|
73
|
-
const matches = querySelectorAllWithTemplates(document, `[data-hf-id="${escapeCssAttrValue(hfId)}"]`);
|
|
74
|
-
if (matches.length > 1) {
|
|
75
|
-
// The mint contract guarantees uniqueness; a duplicate means upstream
|
|
76
|
-
// id drift. Don't silently patch an arbitrary one — surface it.
|
|
77
|
-
// eslint-disable-next-line no-console
|
|
78
|
-
console.warn(`sourceMutation: data-hf-id "${hfId}" matched ${matches.length} elements; using the first. ids must be unique per document.`);
|
|
79
|
-
}
|
|
80
|
-
return matches[0] ?? null;
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// Malformed selector despite escaping — let the caller fall back.
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function findTargetElement(document, target) {
|
|
88
|
-
if (target.hfId) {
|
|
89
|
-
const el = findByHfId(document, target.hfId);
|
|
90
|
-
if (el)
|
|
91
|
-
return el;
|
|
92
|
-
}
|
|
93
|
-
if (target.id) {
|
|
94
|
-
const byId = document.getElementById(target.id);
|
|
95
|
-
if (byId)
|
|
96
|
-
return byId;
|
|
97
|
-
}
|
|
98
|
-
if (!target.selector)
|
|
99
|
-
return null;
|
|
100
|
-
try {
|
|
101
|
-
const matches = querySelectorAllWithTemplates(document, target.selector);
|
|
102
|
-
return matches[target.selectorIndex ?? 0] ?? null;
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
export function removeElementFromHtml(source, target) {
|
|
109
|
-
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
110
|
-
const element = findTargetElement(document, target);
|
|
111
|
-
if (!element)
|
|
112
|
-
return source;
|
|
113
|
-
element.remove();
|
|
114
|
-
return wrappedFragment ? document.body.innerHTML || "" : document.toString();
|
|
115
|
-
}
|
|
116
|
-
export function isHTMLElement(el) {
|
|
117
|
-
const HTMLEl = el.ownerDocument.defaultView?.HTMLElement;
|
|
118
|
-
return HTMLEl ? el instanceof HTMLEl : "style" in el;
|
|
119
|
-
}
|
|
120
|
-
// fallow-ignore-next-line complexity
|
|
121
|
-
function patchStyleAttrString(style, property, value) {
|
|
122
|
-
const props = new Map();
|
|
123
|
-
const order = [];
|
|
124
|
-
// Tokenize declarations robustly: values can contain ';' inside quoted strings
|
|
125
|
-
// (e.g. content: ';') and ':' inside values (data URIs, url(), etc.).
|
|
126
|
-
// Split on ';' only when outside quotes and balanced parens; the first ':' in
|
|
127
|
-
// the resulting segment is the property/value separator (property names never
|
|
128
|
-
// contain ':').
|
|
129
|
-
let i = 0;
|
|
130
|
-
while (i < style.length) {
|
|
131
|
-
let depth = 0;
|
|
132
|
-
let inSingle = false;
|
|
133
|
-
let inDouble = false;
|
|
134
|
-
const start = i;
|
|
135
|
-
while (i < style.length) {
|
|
136
|
-
const ch = style[i];
|
|
137
|
-
if (ch === "'" && !inDouble)
|
|
138
|
-
inSingle = !inSingle;
|
|
139
|
-
else if (ch === '"' && !inSingle)
|
|
140
|
-
inDouble = !inDouble;
|
|
141
|
-
else if (!inSingle && !inDouble) {
|
|
142
|
-
if (ch === "(")
|
|
143
|
-
depth++;
|
|
144
|
-
else if (ch === ")")
|
|
145
|
-
depth = Math.max(0, depth - 1);
|
|
146
|
-
else if (ch === ";" && depth === 0)
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
i++;
|
|
150
|
-
}
|
|
151
|
-
const decl = style.slice(start, i).trim();
|
|
152
|
-
i++; // advance past ';'
|
|
153
|
-
if (!decl)
|
|
154
|
-
continue;
|
|
155
|
-
const colon = decl.indexOf(":");
|
|
156
|
-
if (colon < 0)
|
|
157
|
-
continue;
|
|
158
|
-
const key = decl.slice(0, colon).trim();
|
|
159
|
-
const val = decl.slice(colon + 1).trim();
|
|
160
|
-
if (!key)
|
|
161
|
-
continue;
|
|
162
|
-
if (!props.has(key))
|
|
163
|
-
order.push(key);
|
|
164
|
-
props.set(key, val);
|
|
165
|
-
}
|
|
166
|
-
if (value === null) {
|
|
167
|
-
props.delete(property);
|
|
168
|
-
const idx = order.indexOf(property);
|
|
169
|
-
if (idx >= 0)
|
|
170
|
-
order.splice(idx, 1);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
if (!props.has(property))
|
|
174
|
-
order.push(property);
|
|
175
|
-
props.set(property, value);
|
|
176
|
-
}
|
|
177
|
-
return order
|
|
178
|
-
.map((k) => `${k}: ${props.get(k) ?? ""}`)
|
|
179
|
-
.filter((d) => d.trim())
|
|
180
|
-
.join("; ");
|
|
181
|
-
}
|
|
182
|
-
// fallow-ignore-next-line complexity
|
|
183
|
-
export function patchElementInHtml(source, target, operations) {
|
|
184
|
-
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
185
|
-
const el = findTargetElement(document, target);
|
|
186
|
-
if (!el || !isHTMLElement(el))
|
|
187
|
-
return { html: source, matched: false };
|
|
188
|
-
const htmlEl = el;
|
|
189
|
-
for (const op of operations) {
|
|
190
|
-
switch (op.type) {
|
|
191
|
-
case "inline-style":
|
|
192
|
-
// linkedom's CSSStyleDeclaration does not support CSS custom properties
|
|
193
|
-
// (--foo) or newer individual transform properties (translate, rotate,
|
|
194
|
-
// scale) via style.setProperty(). Manipulate the style attribute string
|
|
195
|
-
// directly so all property names survive the round-trip.
|
|
196
|
-
{
|
|
197
|
-
const raw = htmlEl.getAttribute("style") ?? "";
|
|
198
|
-
const patched = patchStyleAttrString(raw, op.property, op.value);
|
|
199
|
-
htmlEl.setAttribute("style", patched);
|
|
200
|
-
}
|
|
201
|
-
break;
|
|
202
|
-
case "attribute":
|
|
203
|
-
{
|
|
204
|
-
const fullAttr = op.property.startsWith("data-") ? op.property : `data-${op.property}`;
|
|
205
|
-
if (op.value != null) {
|
|
206
|
-
htmlEl.setAttribute(fullAttr, op.value);
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
htmlEl.removeAttribute(fullAttr);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
break;
|
|
213
|
-
case "html-attribute":
|
|
214
|
-
if (!isAllowedHtmlAttribute(op.property))
|
|
215
|
-
break;
|
|
216
|
-
if (op.value != null) {
|
|
217
|
-
if (!isSafeAttributeValue(op.property, op.value))
|
|
218
|
-
break;
|
|
219
|
-
htmlEl.setAttribute(op.property, op.value);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
htmlEl.removeAttribute(op.property);
|
|
223
|
-
}
|
|
224
|
-
break;
|
|
225
|
-
case "text-content":
|
|
226
|
-
if (op.value != null) {
|
|
227
|
-
const inner = htmlEl.children.length === 1 ? htmlEl.firstElementChild : null;
|
|
228
|
-
const textTarget = inner && isHTMLElement(inner) ? inner : htmlEl;
|
|
229
|
-
textTarget.textContent = op.value;
|
|
230
|
-
}
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return {
|
|
235
|
-
html: wrappedFragment ? document.body.innerHTML || "" : document.toString(),
|
|
236
|
-
matched: true,
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
export function probeElementInSource(source, target) {
|
|
240
|
-
if (!target.id && !target.hfId && !target.selector)
|
|
241
|
-
return false;
|
|
242
|
-
const { document } = parseSourceDocument(source);
|
|
243
|
-
const el = findTargetElement(document, target);
|
|
244
|
-
return el != null && isHTMLElement(el);
|
|
245
|
-
}
|
|
246
|
-
function resolveElementTiming(el) {
|
|
247
|
-
const start = parseFloat(el.getAttribute("data-start") ?? "0") || 0;
|
|
248
|
-
const usesDataEnd = el.hasAttribute("data-end");
|
|
249
|
-
const duration = usesDataEnd
|
|
250
|
-
? parseFloat(el.getAttribute("data-end") ?? "") - start || 0
|
|
251
|
-
: parseFloat(el.getAttribute("data-duration") ?? "0") || 0;
|
|
252
|
-
return { start, duration, usesDataEnd };
|
|
253
|
-
}
|
|
254
|
-
function setElementDuration(el, start, duration, usesDataEnd) {
|
|
255
|
-
if (usesDataEnd) {
|
|
256
|
-
const endTime = String(Math.round((start + duration) * 1000) / 1000);
|
|
257
|
-
el.setAttribute("data-end", endTime);
|
|
258
|
-
el.removeAttribute("data-duration");
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
el.setAttribute("data-duration", String(Math.round(duration * 1000) / 1000));
|
|
262
|
-
el.removeAttribute("data-end");
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// fallow-ignore-next-line complexity
|
|
266
|
-
export function splitElementInHtml(source, target, splitTime, newId, fallbackTiming) {
|
|
267
|
-
const { document, wrappedFragment } = parseSourceDocument(source);
|
|
268
|
-
const el = findTargetElement(document, target);
|
|
269
|
-
if (!el || !isHTMLElement(el))
|
|
270
|
-
return { html: source, matched: false, newId: null };
|
|
271
|
-
const timing = resolveElementTiming(el);
|
|
272
|
-
const { usesDataEnd } = timing;
|
|
273
|
-
let { start, duration } = timing;
|
|
274
|
-
// GSAP-animated elements carry their timing in the script, not in data-* attrs,
|
|
275
|
-
// so the source has no authored duration. Fall back to the store's (GSAP-derived)
|
|
276
|
-
// range — the runtime windows visibility off data-start/data-duration regardless
|
|
277
|
-
// of class, so stamping both halves below makes each half show only in its window.
|
|
278
|
-
if (duration <= 0 && fallbackTiming && fallbackTiming.duration > 0) {
|
|
279
|
-
start = fallbackTiming.start;
|
|
280
|
-
duration = fallbackTiming.duration;
|
|
281
|
-
}
|
|
282
|
-
if (duration <= 0 || splitTime <= start || splitTime >= start + duration) {
|
|
283
|
-
return { html: source, matched: false, newId: null };
|
|
284
|
-
}
|
|
285
|
-
if (document.getElementById(newId)) {
|
|
286
|
-
let suffix = 2;
|
|
287
|
-
const base = newId;
|
|
288
|
-
while (document.getElementById(newId)) {
|
|
289
|
-
newId = `${base}-${suffix++}`;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
const firstDuration = splitTime - start;
|
|
293
|
-
const secondDuration = duration - firstDuration;
|
|
294
|
-
const clone = el.cloneNode(true);
|
|
295
|
-
clone.setAttribute("id", newId);
|
|
296
|
-
clone.removeAttribute("data-hf-id");
|
|
297
|
-
// Descendants carry their own data-hf-id; leaving them duplicates the id of
|
|
298
|
-
// every nested node (e.g. an inner <span>), so strip them on the clone too.
|
|
299
|
-
for (const node of clone.querySelectorAll("[data-hf-id]"))
|
|
300
|
-
node.removeAttribute("data-hf-id");
|
|
301
|
-
clone.setAttribute("data-start", String(Math.round(splitTime * 1000) / 1000));
|
|
302
|
-
setElementDuration(clone, splitTime, secondDuration, usesDataEnd);
|
|
303
|
-
// Keep the "clip" class — the runtime uses it to control visibility
|
|
304
|
-
// based on data-start/data-duration timing.
|
|
305
|
-
// Adjust media trim offset for the second half
|
|
306
|
-
const playbackStartAttr = el.hasAttribute("data-playback-start")
|
|
307
|
-
? "data-playback-start"
|
|
308
|
-
: el.hasAttribute("data-media-start")
|
|
309
|
-
? "data-media-start"
|
|
310
|
-
: null;
|
|
311
|
-
if (playbackStartAttr) {
|
|
312
|
-
const currentTrim = parseFloat(el.getAttribute(playbackStartAttr) ?? "0") || 0;
|
|
313
|
-
const rateRaw = parseFloat(el.getAttribute("data-playback-rate") ?? "");
|
|
314
|
-
const rate = Number.isFinite(rateRaw) ? rateRaw : 1;
|
|
315
|
-
clone.setAttribute(playbackStartAttr, String(Math.round((currentTrim + firstDuration * rate) * 1000) / 1000));
|
|
316
|
-
}
|
|
317
|
-
// Duplicate CSS rules targeting the original ID so the clone inherits the same styles.
|
|
318
|
-
const originalId = el.getAttribute("id");
|
|
319
|
-
if (originalId) {
|
|
320
|
-
duplicateCssRulesForId(document, originalId, newId);
|
|
321
|
-
}
|
|
322
|
-
// Trim the original element's duration. A GSAP element had no data-start; stamp
|
|
323
|
-
// it so the runtime windows the first half (visibility selects on [data-start]).
|
|
324
|
-
el.setAttribute("data-start", String(Math.round(start * 1000) / 1000));
|
|
325
|
-
setElementDuration(el, start, firstDuration, usesDataEnd);
|
|
326
|
-
// Insert clone after original
|
|
327
|
-
if (el.nextSibling) {
|
|
328
|
-
el.parentElement.insertBefore(clone, el.nextSibling);
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
el.parentElement.appendChild(clone);
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
html: wrappedFragment ? document.body.innerHTML || "" : document.toString(),
|
|
335
|
-
matched: true,
|
|
336
|
-
newId,
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
//# sourceMappingURL=sourceMutation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sourceMutation.js","sourceRoot":"","sources":["../../../src/studio-api/helpers/sourceMutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,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AAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,aAAa,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CACvE,CAAC;IACJ,CAAC;IAED,uFAAuF;IACvF,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,UAAU,EAAE,CAAC;QACf,sBAAsB,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,gFAAgF;IAChF,iFAAiF;IACjF,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACvE,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAE1D,8BAA8B;IAC9B,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACnB,EAAE,CAAC,aAAc,CAAC,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,aAAc,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,OAAO;QACL,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE;QAC3E,OAAO,EAAE,IAAI;QACb,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build a standalone HTML page for a sub-composition.
|
|
3
|
-
*
|
|
4
|
-
* Uses the project's own index.html `<head>` so all dependencies (GSAP, fonts,
|
|
5
|
-
* Lottie, reset styles, runtime) are preserved — instead of building a minimal
|
|
6
|
-
* page from scratch that would miss important scripts/styles.
|
|
7
|
-
*
|
|
8
|
-
* Three dispatch modes, tried in order:
|
|
9
|
-
* 1. `<template>` wrapper → extract template content (existing compositions)
|
|
10
|
-
* 2. Full HTML document → parse and extract head/body separately (registry blocks)
|
|
11
|
-
* 3. Raw fragment → wrap in a minimal document
|
|
12
|
-
*
|
|
13
|
-
* For full-doc mode, the composition's own `<head>` content (styles, scripts,
|
|
14
|
-
* links, meta) is appended AFTER the project's index.html head. When both
|
|
15
|
-
* declare the same dependency (e.g. GSAP CDN), the composition's copy wins
|
|
16
|
-
* by last-write-wins script execution order — this is intentional so the
|
|
17
|
-
* composition can pin a specific version.
|
|
18
|
-
*/
|
|
19
|
-
export declare function buildSubCompositionHtml(projectDir: string, compPath: string, runtimeUrl: string, baseHref?: string): string | null;
|
|
20
|
-
//# sourceMappingURL=subComposition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subComposition.d.ts","sourceRoot":"","sources":["../../../src/studio-api/helpers/subComposition.ts"],"names":[],"mappings":"AA4NA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAsGf"}
|