@anvpx/motion-build 0.1.5 → 0.1.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.
@@ -0,0 +1,2 @@
1
+ import type { LintRule } from "./types.ts";
2
+ export declare const contentOverflowRule: LintRule;
@@ -0,0 +1,48 @@
1
+ import { estimateContentHeight } from "./layout-estimate.js";
2
+ /**
3
+ * Frame-agnostic content overflow guard.
4
+ *
5
+ * The platform safe-zone rule only runs on tagged tall (9:16) frames. A wide
6
+ * frame can overflow just as badly when a title and a multi-row card grid add
7
+ * up to more than the padded height; P14's five-card "tomatoes" scene did.
8
+ *
9
+ * This is an estimate (layout-estimate.ts is deliberately generous), so it
10
+ * warns instead of failing the build. It runs without platform metadata and
11
+ * assumes the same 5% top/bottom margin the scenes use.
12
+ */
13
+ const SAFE_FRACTION = 0.05;
14
+ const SLACK_PX = 2;
15
+ /** Estimates are ±20%; ignore small overruns so built-in templates do not false-positive. */
16
+ const OVERFLOW_SLACK_FRACTION = 0.08;
17
+ const round = (value) => Math.round(value);
18
+ export const contentOverflowRule = ({ storyboard, theme }) => {
19
+ if (theme === undefined)
20
+ return [];
21
+ const { meta } = storyboard;
22
+ const metrics = {
23
+ width: meta.width * (1 - 2 * SAFE_FRACTION),
24
+ theme,
25
+ };
26
+ const available = meta.height * (1 - 2 * SAFE_FRACTION);
27
+ const findings = [];
28
+ storyboard.scenes.forEach((scene, index) => {
29
+ if (scene.layer === "overlay")
30
+ return;
31
+ // Start with the measured multi-row grid; bullets/callouts have their own
32
+ // density rules and the estimate is too coarse for a frame-wide gate.
33
+ if (scene.type !== "icon-grid")
34
+ return;
35
+ const height = estimateContentHeight(scene.type, scene.props, metrics);
36
+ if (height === undefined || height <= available * (1 + OVERFLOW_SLACK_FRACTION) + SLACK_PX)
37
+ return;
38
+ findings.push({
39
+ severity: "warning",
40
+ path: `/scenes/${index}/props`,
41
+ message: `${scene.type} content (est. ${round(height)}px) exceeds the ` +
42
+ `${round(available)}px available inside the 5% safe area on ` +
43
+ `${meta.width}×${meta.height}; split the scene or shorten the title/items`,
44
+ suggestion: "split the scene, shorten the title, or use fewer items",
45
+ });
46
+ });
47
+ return findings;
48
+ };
@@ -1,3 +1,4 @@
1
+ import { contentOverflowRule } from "./content-overflow.ts";
1
2
  import { flowEdgeLabelRule, flowTextSizeRule, flowWordBreakRule } from "./flow.ts";
2
3
  import { hookFirstRule } from "./hook-first.ts";
3
4
  import { linearEaseRule } from "./linear-ease.ts";
@@ -15,7 +16,7 @@ import { duplicatedEmphasisRule, lineLengthRule, offGridSpacingRule, typeDensity
15
16
  import type { LintInput, LintResult, LintRule } from "./types.ts";
16
17
  import { wordsOnScreenRule } from "./words-on-screen.ts";
17
18
  export type { LintFinding, LintInput, LintResult, LintRule, PlatformMarginLookup, PlatformMargins, } from "./types.ts";
18
- export { duplicatedEmphasisRule, flatMotionRule, flowEdgeLabelRule, flowTextSizeRule, flowWordBreakRule, holdAfterAccentRule, hookFirstRule, linearEaseRule, lineLengthRule, longHoldRule, minHoldRule, narrationPaceRule, offGridSpacingRule, overlayFitRule, overlayStackRule, overlayTargetRule, readingTimeRule, safeZone9x16Rule, textFloorRule, transitionEaseMismatchRule, transitionImplementedRule, transitionLengthRule, typeDensityRule, unsupportedMotionRule, wordsOnScreenRule, };
19
+ export { contentOverflowRule, duplicatedEmphasisRule, flatMotionRule, flowEdgeLabelRule, flowTextSizeRule, flowWordBreakRule, holdAfterAccentRule, hookFirstRule, linearEaseRule, lineLengthRule, longHoldRule, minHoldRule, narrationPaceRule, offGridSpacingRule, overlayFitRule, overlayStackRule, overlayTargetRule, readingTimeRule, safeZone9x16Rule, textFloorRule, transitionEaseMismatchRule, transitionImplementedRule, transitionLengthRule, typeDensityRule, unsupportedMotionRule, wordsOnScreenRule, };
19
20
  /**
20
21
  * All rules, in report order. Contrast lives in theme tokens.
21
22
  * Craft rules (motion-craft, type-grid) run after the timing and layout
@@ -1,3 +1,4 @@
1
+ import { contentOverflowRule } from "./content-overflow.js";
1
2
  import { flowEdgeLabelRule, flowTextSizeRule, flowWordBreakRule } from "./flow.js";
2
3
  import { hookFirstRule } from "./hook-first.js";
3
4
  import { linearEaseRule } from "./linear-ease.js";
@@ -13,7 +14,7 @@ import { transitionImplementedRule } from "./transition-implemented.js";
13
14
  import { transitionLengthRule } from "./transition-length.js";
14
15
  import { duplicatedEmphasisRule, lineLengthRule, offGridSpacingRule, typeDensityRule, } from "./type-grid.js";
15
16
  import { wordsOnScreenRule } from "./words-on-screen.js";
16
- export { duplicatedEmphasisRule, flatMotionRule, flowEdgeLabelRule, flowTextSizeRule, flowWordBreakRule, holdAfterAccentRule, hookFirstRule, linearEaseRule, lineLengthRule, longHoldRule, minHoldRule, narrationPaceRule, offGridSpacingRule, overlayFitRule, overlayStackRule, overlayTargetRule, readingTimeRule, safeZone9x16Rule, textFloorRule, transitionEaseMismatchRule, transitionImplementedRule, transitionLengthRule, typeDensityRule, unsupportedMotionRule, wordsOnScreenRule, };
17
+ export { contentOverflowRule, duplicatedEmphasisRule, flatMotionRule, flowEdgeLabelRule, flowTextSizeRule, flowWordBreakRule, holdAfterAccentRule, hookFirstRule, linearEaseRule, lineLengthRule, longHoldRule, minHoldRule, narrationPaceRule, offGridSpacingRule, overlayFitRule, overlayStackRule, overlayTargetRule, readingTimeRule, safeZone9x16Rule, textFloorRule, transitionEaseMismatchRule, transitionImplementedRule, transitionLengthRule, typeDensityRule, unsupportedMotionRule, wordsOnScreenRule, };
17
18
  /**
18
19
  * All rules, in report order. Contrast lives in theme tokens.
19
20
  * Craft rules (motion-craft, type-grid) run after the timing and layout
@@ -37,6 +38,7 @@ export const LINT_RULES = [
37
38
  narrationPaceRule,
38
39
  hookFirstRule,
39
40
  safeZone9x16Rule,
41
+ contentOverflowRule,
40
42
  flatMotionRule,
41
43
  unsupportedMotionRule,
42
44
  transitionEaseMismatchRule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvpx/motion-build",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Storyboard compiler for @anvpx/motion: validation, scene emission and HyperFrames project output.",
5
5
  "license": "MIT",
6
6
  "author": "anvpx",
@@ -31,9 +31,9 @@
31
31
  "@fontsource/jetbrains-mono": "5.3.0",
32
32
  "@fontsource/source-serif-4": "5.3.1",
33
33
  "@fontsource/space-grotesk": "5.3.0",
34
- "@anvpx/motion-scenes": "0.1.5",
35
- "@anvpx/motion-schema": "0.1.5",
36
- "@anvpx/motion-themes": "0.1.5",
34
+ "@anvpx/motion-scenes": "0.1.7",
35
+ "@anvpx/motion-schema": "0.1.7",
36
+ "@anvpx/motion-themes": "0.1.7",
37
37
  "postprocessing": "6.39.5",
38
38
  "three": "0.186.0"
39
39
  },