@hyperframes/lint 0.8.2 → 0.8.4
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/browser.js +22 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -1402,8 +1402,29 @@ var mediaRules = [
|
|
|
1402
1402
|
// imperative_media_control
|
|
1403
1403
|
findImperativeMediaControlFindings,
|
|
1404
1404
|
// audio_volume_double_automation
|
|
1405
|
-
findVolumeDoubleAutomationFindings
|
|
1405
|
+
findVolumeDoubleAutomationFindings,
|
|
1406
|
+
// audio_volume_tween_overrides_gain
|
|
1407
|
+
findVolumeTweenOverridesGainFindings
|
|
1406
1408
|
];
|
|
1409
|
+
function findVolumeTweenOverridesGainFindings(ctx) {
|
|
1410
|
+
const boosted = ctx.tags.filter((tag) => isMediaTag(tag.name)).map((tag) => ({ tag, volume: Number(readAttr(tag.raw, "data-volume") ?? "1") })).filter((entry) => Number.isFinite(entry.volume) && entry.volume !== 1).filter((entry) => !readDecodedAttr(entry.tag.raw, "data-automation")).map((entry) => ({ ...entry, id: readAttr(entry.tag.raw, "id") })).filter((entry) => Boolean(entry.id));
|
|
1411
|
+
if (boosted.length === 0) return [];
|
|
1412
|
+
const script = ctx.scripts.map((block) => stripJsComments(block.content)).join("\n");
|
|
1413
|
+
const findings = [];
|
|
1414
|
+
for (const { tag, id, volume } of boosted) {
|
|
1415
|
+
if (!tweensVolumeInSameCall(script, id)) continue;
|
|
1416
|
+
const db = volume > 0 ? `${(20 * Math.log10(volume)).toFixed(1)} dB` : "silence";
|
|
1417
|
+
findings.push({
|
|
1418
|
+
code: "audio_volume_tween_overrides_gain",
|
|
1419
|
+
severity: "warning",
|
|
1420
|
+
message: `#${id} has data-volume="${volume}" (${db}) and a GSAP tween on \`volume\`. Tween values are absolute \u2014 they REPLACE this gain rather than scale it \u2014 so wherever the tween names a value the clip plays at that value, not at ${db}.`,
|
|
1421
|
+
elementId: id,
|
|
1422
|
+
fixHint: "Write the tween's targets in the same absolute gain (e.g. `volume: 1.95`, not `volume: 1`), or reset data-volume to 1 and let the tween carry the level on its own.",
|
|
1423
|
+
snippet: truncateSnippet(tag.raw)
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
return findings;
|
|
1427
|
+
}
|
|
1407
1428
|
function findVolumeDoubleAutomationFindings(ctx) {
|
|
1408
1429
|
const automated = ctx.tags.filter((tag) => isMediaTag(tag.name)).map((tag) => ({ tag, automation: readDecodedAttr(tag.raw, "data-automation") })).filter((entry) => entry.automation && /"target"\s*:\s*"volume"/.test(entry.automation)).map((entry) => ({ ...entry, id: readAttr(entry.tag.raw, "id") })).filter((entry) => Boolean(entry.id));
|
|
1409
1430
|
if (automated.length === 0) return [];
|