@hyperframes/inspector 0.8.181 → 0.8.184

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.
@@ -1,7 +1,11 @@
1
- export declare function scopeCssToComposition(css: string, compositionId: string, scopeSelectorOverride?: string, authoredRootId?: string | null, options?: {
1
+ type ScopeOptions = {
2
2
  compoundAuthoredRoot?: boolean;
3
3
  scopeRootSelectors?: boolean;
4
- }): string;
4
+ };
5
+ export declare function scopeCssToComposition(css: string, compositionId: string, scopeSelectorOverride?: string, authoredRootId?: string | null, options?: ScopeOptions): string;
6
+ /** `scopeCssToComposition` for sheets mounted many times: each sheet is scoped once around a
7
+ * placeholder scope, which each mount's own scope then replaces. */
8
+ export declare function createCompositionCssScoper(): typeof scopeCssToComposition;
5
9
  /** Drops repeats of an identical `@font-face` across the given style texts, keeping the last copy:
6
10
  * the last matching rule is the one the browser uses, so a rule in between never gains precedence. */
7
11
  export declare const dedupeFontFaceRules: (styleTexts: string[]) => string[];
@@ -30,3 +34,4 @@ export declare function wrapInlineScriptWithErrorBoundary(source: string, errorL
30
34
  * table goes through `jsonScriptLiteral` — see there for why.
31
35
  */
32
36
  export declare function buildVariablesByCompScript(variablesByComp: Record<string, Record<string, unknown>>): string | null;
37
+ export {};
@@ -55,6 +55,7 @@ export interface BundleOptions {
55
55
  sceneParts?: boolean;
56
56
  /** Warn when the compiled HTML breaks the HyperFrames contract (default true). */
57
57
  staticGuard?: boolean;
58
+ /** Called once per build for each project file the build reads or looks for. */
58
59
  onRead?: (filePath: string) => void;
59
60
  }
60
61
  export declare function bundleToSingleHtml(projectDir: string, options?: BundleOptions): Promise<string>;
@@ -1,41 +1 @@
1
- export declare const MEDIA_START_BASIS_ATTR = "data-hf-media-start-basis";
2
- export type MediaStartBasis = "local" | "global";
3
- export declare function readMediaStartBasis(value: string | null | undefined): MediaStartBasis;
4
- /** Resolve authored media time onto the root timeline. Nested media is local
5
- * by default; only an explicit compatibility marker preserves a legacy
6
- * root-global value. */
7
- export declare function resolveAbsoluteMediaStartSeconds(input: {
8
- authoredStart: number;
9
- hostStart: number;
10
- basis?: string | null;
11
- }): number;
12
- /** The one rule for a media element's root-timeline start; the runtime and the CLI both call it.
13
- * `hostStart` is the composition's origin. With no literal start, an auto-injected start, or an
14
- * origin at 0 there is nothing for the basis to disambiguate, so ordinary resolution applies. */
15
- export declare function resolveMediaStartSeconds(input: MediaStartInput & {
16
- ordinaryStart: () => number;
17
- }): number;
18
- /** True when the authored start is already root time, so no host offset applies. */
19
- export declare function isRootGlobalMediaStart(input: MediaStartInput): boolean;
20
- export interface MediaStartInput {
21
- authoredStart: number | null;
22
- hostStart: number;
23
- hasAutoStart: boolean;
24
- basis?: string | null;
25
- }
26
- /** A composition host's in-point; only a host with one shifts or cuts what it holds. */
27
- export declare function hostInPointSeconds(host: Pick<Element, "getAttribute">): number;
28
- /** Main-timeline time of a sub-composition's local t=0: its host's start minus its in-point. */
29
- export declare function compositionOriginSeconds(hostStart: number, host: Pick<Element, "getAttribute">): number;
30
- export interface HostSlot {
31
- start: number;
32
- end: number;
33
- }
34
- /** Each in-point host cuts the span to its own window. */
35
- export declare function cutToHostSlots(span: {
36
- start: number;
37
- end: number;
38
- }, hosts: readonly HostSlot[]): {
39
- start: number;
40
- end: number;
41
- };
1
+ export * from "@hyperframes/parsers/media-timing";
@@ -261,6 +261,7 @@ export type RuntimeTimelineLike = {
261
261
  seek: (timeSeconds?: number, suppressEvents?: boolean) => unknown;
262
262
  totalTime?: (timeSeconds?: number, suppressEvents?: boolean) => unknown;
263
263
  totalDuration?: () => number;
264
+ shiftChildren?: (amount: number) => unknown;
264
265
  progress?: (value?: number, suppressEvents?: boolean) => unknown;
265
266
  time: () => number;
266
267
  duration: () => number;
@@ -11,7 +11,7 @@ export interface LiveInspection {
11
11
  timeline(runner: PageRunner, request: TimelineRequest): Promise<TimelineReport>;
12
12
  elementMap(runner: PageRunner): Promise<ElementMapReport>;
13
13
  }
14
- export declare function prepareLiveInspection(projectDir: string, html: string, provenance: readonly BundleScriptProvenance[], sourceVersion: string): LiveInspection;
14
+ export declare function prepareLiveInspection(projectDir: string, html: string, provenance: readonly BundleScriptProvenance[], sourceVersion: string, reads?: readonly string[]): LiveInspection;
15
15
  export declare function previewGeneration(runner: PageRunner): Promise<string | null>;
16
16
  export declare function fingerprint(project: string): string;
17
17
  export type { ComponentReport, ElementMapReport, InspectRequest, PageRunner, TimelineReport, TimelineRequest, };
@@ -1,5 +1,18 @@
1
1
  import { Sources } from "./sources.js";
2
2
  import type { InspectRequest, RuntimeResponse, Snippet } from "./types.js";
3
+ declare function shown(snippet: Snippet, targetCount: number): {
4
+ id: string;
5
+ kind: string[];
6
+ code: string;
7
+ uniqueInFile: boolean;
8
+ targets?: undefined;
9
+ } | {
10
+ id: string;
11
+ kind: string[];
12
+ targets: number[];
13
+ code: string;
14
+ uniqueInFile: boolean;
15
+ };
3
16
  export declare function mapInspection(raw: RuntimeResponse, request: InspectRequest, context: {
4
17
  sources: Sources;
5
18
  map: ReturnType<Sources["mapper"]>;
@@ -13,6 +26,11 @@ export declare function mapInspection(raw: RuntimeResponse, request: InspectRequ
13
26
  duration: number | undefined;
14
27
  };
15
28
  }): {
29
+ recordLimitReached: boolean;
30
+ hooked: boolean;
31
+ debugAvailable: boolean;
32
+ elapsedMs: number;
33
+ coverage?: string[];
16
34
  generation: string;
17
35
  visualState: {
18
36
  time: number | undefined;
@@ -21,29 +39,30 @@ export declare function mapInspection(raw: RuntimeResponse, request: InspectRequ
21
39
  sourceVersion: string;
22
40
  reused: boolean;
23
41
  results: {
42
+ unmappedAnimations: number;
43
+ scopeTruncated: boolean;
44
+ coTargetsOmitted?: number | undefined;
24
45
  target: number;
25
46
  status: "missing" | "found" | "ambiguous" | "stale-ref" | "invalid-selector";
26
47
  candidates: import("./types.js").ElementRef[];
27
48
  candidatesOmitted: number;
28
49
  animations: number;
29
50
  coTargets: import("./types.js").ElementRef[];
30
- unmappedAnimations: number;
31
- scopeTruncated: boolean;
32
51
  }[];
33
- snippets: Snippet[];
52
+ snippets: ReturnType<typeof shown>[];
34
53
  omitted: {
35
54
  id: string;
36
55
  bytes: number;
37
56
  }[];
38
57
  omittedCount: number;
39
58
  nextOffset: number | null;
40
- coverage: string[];
59
+ } | {
60
+ debug: RuntimeResponse;
41
61
  recordLimitReached: boolean;
42
62
  hooked: boolean;
43
63
  debugAvailable: boolean;
44
64
  elapsedMs: number;
45
- } | {
46
- debug: RuntimeResponse;
65
+ coverage?: string[];
47
66
  generation: string;
48
67
  visualState: {
49
68
  time: number | undefined;
@@ -52,25 +71,22 @@ export declare function mapInspection(raw: RuntimeResponse, request: InspectRequ
52
71
  sourceVersion: string;
53
72
  reused: boolean;
54
73
  results: {
74
+ unmappedAnimations: number;
75
+ scopeTruncated: boolean;
76
+ coTargetsOmitted?: number | undefined;
55
77
  target: number;
56
78
  status: "missing" | "found" | "ambiguous" | "stale-ref" | "invalid-selector";
57
79
  candidates: import("./types.js").ElementRef[];
58
80
  candidatesOmitted: number;
59
81
  animations: number;
60
82
  coTargets: import("./types.js").ElementRef[];
61
- unmappedAnimations: number;
62
- scopeTruncated: boolean;
63
83
  }[];
64
- snippets: Snippet[];
84
+ snippets: ReturnType<typeof shown>[];
65
85
  omitted: {
66
86
  id: string;
67
87
  bytes: number;
68
88
  }[];
69
89
  omittedCount: number;
70
90
  nextOffset: number | null;
71
- coverage: string[];
72
- recordLimitReached: boolean;
73
- hooked: boolean;
74
- debugAvailable: boolean;
75
- elapsedMs: number;
76
91
  };
92
+ export {};
@@ -29,6 +29,11 @@ export declare class Inspector {
29
29
  private view;
30
30
  private idle;
31
31
  inspect(request: InspectRequest): Promise<{
32
+ recordLimitReached: boolean;
33
+ hooked: boolean;
34
+ debugAvailable: boolean;
35
+ elapsedMs: number;
36
+ coverage?: string[];
32
37
  generation: string;
33
38
  visualState: {
34
39
  time: number | undefined;
@@ -37,29 +42,42 @@ export declare class Inspector {
37
42
  sourceVersion: string;
38
43
  reused: boolean;
39
44
  results: {
45
+ unmappedAnimations: number;
46
+ scopeTruncated: boolean;
47
+ coTargetsOmitted?: number | undefined;
40
48
  target: number;
41
49
  status: "missing" | "found" | "ambiguous" | "stale-ref" | "invalid-selector";
42
50
  candidates: import("./types.js").ElementRef[];
43
51
  candidatesOmitted: number;
44
52
  animations: number;
45
53
  coTargets: import("./types.js").ElementRef[];
46
- unmappedAnimations: number;
47
- scopeTruncated: boolean;
48
54
  }[];
49
- snippets: Snippet[];
55
+ snippets: ReturnType<(snippet: Snippet, targetCount: number) => {
56
+ id: string;
57
+ kind: string[];
58
+ code: string;
59
+ uniqueInFile: boolean;
60
+ targets?: undefined;
61
+ } | {
62
+ id: string;
63
+ kind: string[];
64
+ targets: number[];
65
+ code: string;
66
+ uniqueInFile: boolean;
67
+ }>[];
50
68
  omitted: {
51
69
  id: string;
52
70
  bytes: number;
53
71
  }[];
54
72
  omittedCount: number;
55
73
  nextOffset: number | null;
56
- coverage: string[];
74
+ } | {
75
+ debug: import("./types.js").RuntimeResponse;
57
76
  recordLimitReached: boolean;
58
77
  hooked: boolean;
59
78
  debugAvailable: boolean;
60
79
  elapsedMs: number;
61
- } | {
62
- debug: import("./types.js").RuntimeResponse;
80
+ coverage?: string[];
63
81
  generation: string;
64
82
  visualState: {
65
83
  time: number | undefined;
@@ -68,27 +86,35 @@ export declare class Inspector {
68
86
  sourceVersion: string;
69
87
  reused: boolean;
70
88
  results: {
89
+ unmappedAnimations: number;
90
+ scopeTruncated: boolean;
91
+ coTargetsOmitted?: number | undefined;
71
92
  target: number;
72
93
  status: "missing" | "found" | "ambiguous" | "stale-ref" | "invalid-selector";
73
94
  candidates: import("./types.js").ElementRef[];
74
95
  candidatesOmitted: number;
75
96
  animations: number;
76
97
  coTargets: import("./types.js").ElementRef[];
77
- unmappedAnimations: number;
78
- scopeTruncated: boolean;
79
98
  }[];
80
- snippets: Snippet[];
99
+ snippets: ReturnType<(snippet: Snippet, targetCount: number) => {
100
+ id: string;
101
+ kind: string[];
102
+ code: string;
103
+ uniqueInFile: boolean;
104
+ targets?: undefined;
105
+ } | {
106
+ id: string;
107
+ kind: string[];
108
+ targets: number[];
109
+ code: string;
110
+ uniqueInFile: boolean;
111
+ }>[];
81
112
  omitted: {
82
113
  id: string;
83
114
  bytes: number;
84
115
  }[];
85
116
  omittedCount: number;
86
117
  nextOffset: number | null;
87
- coverage: string[];
88
- recordLimitReached: boolean;
89
- hooked: boolean;
90
- debugAvailable: boolean;
91
- elapsedMs: number;
92
118
  }>;
93
119
  private query;
94
120
  timeline(request: TimelineRequest): Promise<import("./timelineReport.js").TimelineReport>;
@@ -27,6 +27,10 @@ export interface HtmlTag {
27
27
  hfId?: string;
28
28
  classes: string[];
29
29
  tag: string;
30
+ compositionId?: string;
31
+ compositionSrc?: string;
32
+ inMarkup: boolean;
33
+ parent?: number;
30
34
  }
31
35
  export interface AuthoredHtml {
32
36
  files: Map<string, {
@@ -47,13 +51,18 @@ export declare class Sources {
47
51
  end: number;
48
52
  }[];
49
53
  readonly htmlTags: HtmlTag[];
50
- constructor(project: string);
54
+ constructor(project: string, served?: Iterable<string>);
51
55
  private addChunk;
52
56
  private addCss;
53
57
  slice(file: string, start: number, end: number, kind: string, target: number): Snippet | null;
54
58
  markup(element: ElementRef, target: number): Snippet | null;
59
+ markupTag(element: ElementRef): HtmlTag | null;
60
+ private nestingIndex?;
61
+ private get nested();
62
+ private fileByPath?;
63
+ private mountedFile;
64
+ compositions(tag: HtmlTag, target: number): Snippet[];
55
65
  mapper(html: string, provenance: BundleScriptProvenance[]): (stack: string, target: number) => Snippet[];
56
66
  }
57
- export declare function markupSnippet(sources: Sources, element: ElementRef, target: number): Snippet | null;
58
67
  export declare function mergeSnippets(snippets: Snippet[], sources: Sources): Snippet[];
59
68
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/inspector",
3
- "version": "0.8.181",
3
+ "version": "0.8.184",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -40,10 +40,11 @@
40
40
  "acorn": "^8.17.0",
41
41
  "esbuild": "^0.25.12",
42
42
  "eslint-scope": "^9.1.2",
43
+ "htmlparser2": "^10.1.0",
43
44
  "postcss": "^8.5.8",
44
45
  "puppeteer-core": "^25.8.0",
45
- "@hyperframes/core": "0.8.181",
46
- "@hyperframes/parsers": "0.8.181"
46
+ "@hyperframes/parsers": "0.8.184",
47
+ "@hyperframes/core": "0.8.184"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@types/node": "^25.0.10",