@hyperframes/lint 0.8.13 → 0.8.15
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 +14 -25
- package/dist/browser.js.map +1 -1
- package/dist/index.js +16 -32
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -96,13 +96,7 @@ function readDecodedAttr(tagSource, attr) {
|
|
|
96
96
|
return value;
|
|
97
97
|
}
|
|
98
98
|
function readJsonAttr(tagSource, attr) {
|
|
99
|
-
|
|
100
|
-
const escaped = attr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
101
|
-
const match = tagSource.match(
|
|
102
|
-
new RegExp(`(?<![\\w-])${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i")
|
|
103
|
-
);
|
|
104
|
-
if (!match) return null;
|
|
105
|
-
return match[1] ?? match[2] ?? null;
|
|
99
|
+
return readDecodedAttr(tagSource, attr);
|
|
106
100
|
}
|
|
107
101
|
function collectCompositionIds(tags) {
|
|
108
102
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -528,7 +522,7 @@ var coreRules = [
|
|
|
528
522
|
}
|
|
529
523
|
];
|
|
530
524
|
},
|
|
531
|
-
// missing_timeline_registry
|
|
525
|
+
// missing_timeline_registry
|
|
532
526
|
// fallow-ignore-next-line complexity
|
|
533
527
|
({ source, rawSource, rootTag, options }) => {
|
|
534
528
|
if (options.isSubComposition || rawSource.trimStart().toLowerCase().startsWith("<template")) {
|
|
@@ -544,14 +538,6 @@ var coreRules = [
|
|
|
544
538
|
fixHint: "Register each composition timeline on `window.__timelines[compositionId]`."
|
|
545
539
|
});
|
|
546
540
|
}
|
|
547
|
-
if (TIMELINE_REGISTRY_ASSIGN_PATTERN.test(source) && !TIMELINE_REGISTRY_INIT_PATTERN.test(source)) {
|
|
548
|
-
findings.push({
|
|
549
|
-
code: "timeline_registry_missing_init",
|
|
550
|
-
severity: "error",
|
|
551
|
-
message: "`window.__timelines[\u2026] = \u2026` is used without initializing `window.__timelines` first.",
|
|
552
|
-
fixHint: "Add `window.__timelines = window.__timelines || {};` before any timeline assignment."
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
541
|
return findings;
|
|
556
542
|
},
|
|
557
543
|
// timeline_id_mismatch
|
|
@@ -1105,9 +1091,9 @@ var mediaRules = [
|
|
|
1105
1091
|
findings.push({
|
|
1106
1092
|
code: "video_nested_in_timed_element",
|
|
1107
1093
|
severity: "error",
|
|
1108
|
-
message: `<video> with data-start is nested inside <${parent.name}${parent.id ? ` id="${parent.id}"` : ""}> which also has data-start. The
|
|
1094
|
+
message: `<video> with data-start is nested inside <${parent.name}${parent.id ? ` id="${parent.id}"` : ""}> which also has data-start. The frame extractor resolves the video's start from its own data-start without the wrapper's offset, while visibility uses the wrapper's window, so the two disagree: the clip shows the wrong source frames and then disappears partway through its slot.`,
|
|
1109
1095
|
elementId: readAttr(tag.raw, "id") || void 0,
|
|
1110
|
-
fixHint: "
|
|
1096
|
+
fixHint: "Time the wrapper OR the video, never both: remove data-start from the wrapper (use it as a non-timed visual container), or move the <video> up to be a direct child of the stage.",
|
|
1111
1097
|
snippet: truncateSnippet(tag.raw)
|
|
1112
1098
|
});
|
|
1113
1099
|
break;
|
|
@@ -3635,7 +3621,7 @@ var compositionRules = [
|
|
|
3635
3621
|
severity: "error",
|
|
3636
3622
|
message: `<${tag.name}${elementId ? ` id="${elementId}"` : ""}> uses data-layer instead of data-track-index.`,
|
|
3637
3623
|
elementId,
|
|
3638
|
-
fixHint: "Replace data-layer with data-track-index.
|
|
3624
|
+
fixHint: "Replace data-layer with data-track-index, which is the canonical name Studio and the linter read. Neither name is read by the render.",
|
|
3639
3625
|
snippet: truncateSnippet(tag.raw)
|
|
3640
3626
|
});
|
|
3641
3627
|
}
|
|
@@ -4033,10 +4019,13 @@ var compositionRules = [
|
|
|
4033
4019
|
// can't leak styles into each other. A rule whose LEFTMOST selector is the ROOT
|
|
4034
4020
|
// element's own class (e.g. `.frame { ... }` on the same element that carries
|
|
4035
4021
|
// data-composition-id) therefore becomes a DESCENDANT selector that can never
|
|
4036
|
-
// match the
|
|
4037
|
-
//
|
|
4038
|
-
//
|
|
4039
|
-
//
|
|
4022
|
+
// match the SCOPED element itself. NOTE on the symptom: since #1886 the producer
|
|
4023
|
+
// preserves the authored root as a `data-hf-inner-root` wrapper INSIDE the scoped
|
|
4024
|
+
// element (regression fixture packages/producer/tests/sub-comp-class-selector),
|
|
4025
|
+
// so the class still matches as a descendant and the scene no longer renders
|
|
4026
|
+
// unstyled. This rule is now a consistency constraint, not a render-bug guard:
|
|
4027
|
+
// `#root` is the shape the registry blocks model and the one the scoper
|
|
4028
|
+
// special-cases. Style the root via `#root`
|
|
4040
4029
|
// (the scoper special-cases the root id) and descendants via plain selectors,
|
|
4041
4030
|
// like the registry blocks — the runtime already scopes each scene by id, so a
|
|
4042
4031
|
// class namespace on the root is redundant.
|
|
@@ -4053,9 +4042,9 @@ var compositionRules = [
|
|
|
4053
4042
|
{
|
|
4054
4043
|
code: "subcomposition_root_styled_by_class",
|
|
4055
4044
|
severity: "error",
|
|
4056
|
-
message: `Root element has class="${rootClasses.join(" ")}" and is styled by ${offenders.length} rule(s) keyed off that class (e.g. ${example}). At render, every sub-composition rule is scoped to [data-composition-id="${rootCompositionId}"] <selector>, so a selector whose leftmost part is the ROOT's own class becomes a descendant selector that cannot match the
|
|
4045
|
+
message: `Root element has class="${rootClasses.join(" ")}" and is styled by ${offenders.length} rule(s) keyed off that class (e.g. ${example}). At render, every sub-composition rule is scoped to [data-composition-id="${rootCompositionId}"] <selector>, so a selector whose leftmost part is the ROOT's own class becomes a descendant selector that cannot match the scoped element itself. Since #1886 the producer preserves the authored root as an inner wrapper, so this no longer renders the scene unstyled, but #root is the shape the scoper special-cases and the registry blocks model. Use it so preview, render, and Studio agree.`,
|
|
4057
4046
|
selector: example,
|
|
4058
|
-
fixHint: `Give the root id="root" and style it with \`#root { ... }\` plus plain descendant selectors (\`.kicker\`, \`#hero\`) \u2014 the runtime already scopes each sub-composition by data-composition-id, so a class namespace on the root is redundant
|
|
4047
|
+
fixHint: `Give the root id="root" and style it with \`#root { ... }\` plus plain descendant selectors (\`.kicker\`, \`#hero\`) \u2014 the runtime already scopes each sub-composition by data-composition-id, so a class namespace on the root is redundant.`,
|
|
4059
4048
|
snippet: truncateSnippet(rootTag.raw)
|
|
4060
4049
|
}
|
|
4061
4050
|
];
|