@hyperframes/lint 0.9.6 → 0.9.7

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 CHANGED
@@ -4191,6 +4191,19 @@ async function loadGsapScriptMotionPathFirstUseIndex() {
4191
4191
  }
4192
4192
  var SCENE_BOUNDARY_EPSILON_SECONDS = 0.05;
4193
4193
  var TWEEN_ENDPOINT_EPSILON_SECONDS = 1e-3;
4194
+ function windowOverlap(a, b) {
4195
+ const aIsPoint = a.end <= a.position;
4196
+ const bIsPoint = b.end <= b.position;
4197
+ if (aIsPoint && bIsPoint) return null;
4198
+ if (aIsPoint || bIsPoint) {
4199
+ const [point, running] = aIsPoint ? [a, b] : [b, a];
4200
+ const inside = point.position > running.position + TWEEN_ENDPOINT_EPSILON_SECONDS && point.position < running.end - TWEEN_ENDPOINT_EPSILON_SECONDS;
4201
+ return inside ? { start: point.position, end: point.position, running } : null;
4202
+ }
4203
+ const start = Math.max(a.position, b.position);
4204
+ const end = Math.min(a.end, b.end);
4205
+ return end - start > TWEEN_ENDPOINT_EPSILON_SECONDS ? { start, end } : null;
4206
+ }
4194
4207
  var UNRESOLVED_TARGET = "__unresolved__";
4195
4208
  function targetHasNoStableIdentity(selector, identity) {
4196
4209
  if (identity) return false;
@@ -4925,29 +4938,28 @@ var gsapRules = [
4925
4938
  for (let i = 0; i < gsapWindows.length; i++) {
4926
4939
  const left = gsapWindows[i];
4927
4940
  if (!left) continue;
4928
- if (left.end <= left.position) continue;
4929
4941
  if (targetHasNoStableIdentity(left.targetSelector, left.targetIdentity)) continue;
4930
4942
  for (let j = i + 1; j < gsapWindows.length; j++) {
4931
4943
  const right = gsapWindows[j];
4932
4944
  if (!right) continue;
4933
- if (right.end <= right.position) continue;
4934
4945
  const leftIdentity = left.targetIdentity ?? left.targetSelector;
4935
4946
  const rightIdentity = right.targetIdentity ?? right.targetSelector;
4936
4947
  if (leftIdentity !== rightIdentity) continue;
4937
- const overlapStart = Math.max(left.position, right.position);
4938
- const overlapEnd = Math.min(left.end, right.end);
4939
- if (overlapEnd - overlapStart <= TWEEN_ENDPOINT_EPSILON_SECONDS) continue;
4948
+ const overlap = windowOverlap(left, right);
4949
+ if (!overlap) continue;
4940
4950
  if (left.overwriteAuto || right.overwriteAuto) continue;
4941
4951
  const sharedProperties = left.properties.filter(
4942
4952
  (prop) => right.properties.includes(prop)
4943
4953
  );
4944
4954
  if (sharedProperties.length === 0) continue;
4955
+ const properties = sharedProperties.join(", ");
4956
+ const { running } = overlap;
4945
4957
  findings.push({
4946
4958
  code: "overlapping_gsap_tweens",
4947
4959
  severity: "warning",
4948
- message: `GSAP tweens overlap on "${left.targetSelector}" for ${sharedProperties.join(", ")} between ${overlapStart.toFixed(2)}s and ${overlapEnd.toFixed(2)}s.`,
4960
+ message: running ? `A GSAP set on "${left.targetSelector}" for ${properties} fires at ${overlap.start.toFixed(2)}s while a tween on it is still running (${running.position.toFixed(2)}s to ${running.end.toFixed(2)}s).` : `GSAP tweens overlap on "${left.targetSelector}" for ${properties} between ${overlap.start.toFixed(2)}s and ${overlap.end.toFixed(2)}s.`,
4949
4961
  selector: left.targetSelector,
4950
- fixHint: 'Shorten the earlier tween, move the later tween, or add `overwrite: "auto"`.',
4962
+ fixHint: running ? `Let the tween finish before the set fires: move the set to ${running.end.toFixed(2)}s or later, or shorten the tween. Played in order the set wins; seeked (scrub, export) the tween can win, so an old state stays visible.` : 'Shorten the earlier tween, move the later tween, or add `overwrite: "auto"`.',
4951
4963
  snippet: truncateSnippet(`${left.raw}
4952
4964
  ${right.raw}`)
4953
4965
  });
package/dist/index.js CHANGED
@@ -4197,6 +4197,19 @@ async function loadGsapScriptMotionPathFirstUseIndex() {
4197
4197
  }
4198
4198
  var SCENE_BOUNDARY_EPSILON_SECONDS = 0.05;
4199
4199
  var TWEEN_ENDPOINT_EPSILON_SECONDS = 1e-3;
4200
+ function windowOverlap(a, b) {
4201
+ const aIsPoint = a.end <= a.position;
4202
+ const bIsPoint = b.end <= b.position;
4203
+ if (aIsPoint && bIsPoint) return null;
4204
+ if (aIsPoint || bIsPoint) {
4205
+ const [point, running] = aIsPoint ? [a, b] : [b, a];
4206
+ const inside = point.position > running.position + TWEEN_ENDPOINT_EPSILON_SECONDS && point.position < running.end - TWEEN_ENDPOINT_EPSILON_SECONDS;
4207
+ return inside ? { start: point.position, end: point.position, running } : null;
4208
+ }
4209
+ const start = Math.max(a.position, b.position);
4210
+ const end = Math.min(a.end, b.end);
4211
+ return end - start > TWEEN_ENDPOINT_EPSILON_SECONDS ? { start, end } : null;
4212
+ }
4200
4213
  var UNRESOLVED_TARGET = "__unresolved__";
4201
4214
  function targetHasNoStableIdentity(selector, identity) {
4202
4215
  if (identity) return false;
@@ -4931,29 +4944,28 @@ var gsapRules = [
4931
4944
  for (let i = 0; i < gsapWindows.length; i++) {
4932
4945
  const left = gsapWindows[i];
4933
4946
  if (!left) continue;
4934
- if (left.end <= left.position) continue;
4935
4947
  if (targetHasNoStableIdentity(left.targetSelector, left.targetIdentity)) continue;
4936
4948
  for (let j = i + 1; j < gsapWindows.length; j++) {
4937
4949
  const right = gsapWindows[j];
4938
4950
  if (!right) continue;
4939
- if (right.end <= right.position) continue;
4940
4951
  const leftIdentity = left.targetIdentity ?? left.targetSelector;
4941
4952
  const rightIdentity = right.targetIdentity ?? right.targetSelector;
4942
4953
  if (leftIdentity !== rightIdentity) continue;
4943
- const overlapStart = Math.max(left.position, right.position);
4944
- const overlapEnd = Math.min(left.end, right.end);
4945
- if (overlapEnd - overlapStart <= TWEEN_ENDPOINT_EPSILON_SECONDS) continue;
4954
+ const overlap = windowOverlap(left, right);
4955
+ if (!overlap) continue;
4946
4956
  if (left.overwriteAuto || right.overwriteAuto) continue;
4947
4957
  const sharedProperties = left.properties.filter(
4948
4958
  (prop) => right.properties.includes(prop)
4949
4959
  );
4950
4960
  if (sharedProperties.length === 0) continue;
4961
+ const properties = sharedProperties.join(", ");
4962
+ const { running } = overlap;
4951
4963
  findings.push({
4952
4964
  code: "overlapping_gsap_tweens",
4953
4965
  severity: "warning",
4954
- message: `GSAP tweens overlap on "${left.targetSelector}" for ${sharedProperties.join(", ")} between ${overlapStart.toFixed(2)}s and ${overlapEnd.toFixed(2)}s.`,
4966
+ message: running ? `A GSAP set on "${left.targetSelector}" for ${properties} fires at ${overlap.start.toFixed(2)}s while a tween on it is still running (${running.position.toFixed(2)}s to ${running.end.toFixed(2)}s).` : `GSAP tweens overlap on "${left.targetSelector}" for ${properties} between ${overlap.start.toFixed(2)}s and ${overlap.end.toFixed(2)}s.`,
4955
4967
  selector: left.targetSelector,
4956
- fixHint: 'Shorten the earlier tween, move the later tween, or add `overwrite: "auto"`.',
4968
+ fixHint: running ? `Let the tween finish before the set fires: move the set to ${running.end.toFixed(2)}s or later, or shorten the tween. Played in order the set wins; seeked (scrub, export) the tween can win, so an old state stays visible.` : 'Shorten the earlier tween, move the later tween, or add `overwrite: "auto"`.',
4957
4969
  snippet: truncateSnippet(`${left.raw}
4958
4970
  ${right.raw}`)
4959
4971
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/lint",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -35,7 +35,7 @@
35
35
  "linkedom": "^0.18.12",
36
36
  "postcss": "^8.5.8",
37
37
  "postcss-selector-parser": "^7.1.4",
38
- "@hyperframes/parsers": "0.9.6"
38
+ "@hyperframes/parsers": "0.9.7"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^25.0.10",