@myrmidon/gve-snapshot-rendition 1.0.2 → 2.0.2
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/index.cjs.min.js +7 -7
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.js +427 -845
- package/dist/index.js.map +1 -1
- package/dist/src/animation/animation-engine.d.ts +0 -13
- package/dist/src/core/gve-snapshot-rendition.d.ts +0 -1
- package/dist/src/hint-designer/gve-hint-designer.d.ts +0 -1
- package/dist/src/rendering/feature-resolver.d.ts +4 -4
- package/dist/src/rendering/hint-renderer.d.ts +6 -12
- package/dist/src/rendering/text-renderer.d.ts +12 -11
- package/dist/src/settings/hint-models.d.ts +0 -5
- package/dist/src/settings/settings.d.ts +0 -4
- package/package.json +5 -5
|
@@ -21,19 +21,6 @@ export declare class AnimationEngine {
|
|
|
21
21
|
* @returns Promise that resolves when animation completes
|
|
22
22
|
*/
|
|
23
23
|
animate(element: SVGElement, animation: AnimationFunction, rootElement: SVGElement): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Animate multiple elements with spreading transitions.
|
|
26
|
-
* All elements are animated in parallel with GSAP.
|
|
27
|
-
*
|
|
28
|
-
* @param shifts - Map of element IDs to their shift amounts {x, y}
|
|
29
|
-
* @param duration - Duration in milliseconds
|
|
30
|
-
* @param rootElement - The root SVG element containing all elements
|
|
31
|
-
* @returns Promise that resolves when all animations complete
|
|
32
|
-
*/
|
|
33
|
-
animateSpreading(shifts: Map<string, {
|
|
34
|
-
x: number;
|
|
35
|
-
y: number;
|
|
36
|
-
}>, duration: number, rootElement: SVGElement): Promise<void>;
|
|
37
24
|
/**
|
|
38
25
|
* Fade in multiple elements (used for hilites).
|
|
39
26
|
*
|
|
@@ -11,7 +11,6 @@ export interface HintOverrides {
|
|
|
11
11
|
scaleX?: string;
|
|
12
12
|
scaleY?: string;
|
|
13
13
|
rotation?: string;
|
|
14
|
-
solid?: boolean;
|
|
15
14
|
displacedSpan?: {
|
|
16
15
|
nodeId: number;
|
|
17
16
|
count: number;
|
|
@@ -36,14 +35,13 @@ export interface RenditionConfig {
|
|
|
36
35
|
textPosition?: string;
|
|
37
36
|
textOffsetX: number | string;
|
|
38
37
|
textOffsetY: number | string;
|
|
39
|
-
textSolid?: boolean;
|
|
40
38
|
textDisplacedSpan?: {
|
|
41
39
|
nodeId: number;
|
|
42
40
|
count: number;
|
|
43
41
|
};
|
|
44
42
|
textValue?: string;
|
|
45
43
|
hints?: string[];
|
|
46
|
-
hintOverrides?: Map<string, HintOverrides>;
|
|
44
|
+
hintOverrides?: Map<string | number, HintOverrides>;
|
|
47
45
|
hintVars?: Map<string, string>;
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
@@ -88,7 +86,9 @@ export declare class FeatureResolver {
|
|
|
88
86
|
getRenditionFeatureValue(features: Feature[] | undefined, featureName: string): string | undefined;
|
|
89
87
|
/**
|
|
90
88
|
* Parse r_h-* hint override features.
|
|
91
|
-
* Format: "value" applies to all hints, or "@
|
|
89
|
+
* Format: "value" applies to all hints, or "@target1 target2:value" applies to specific hints.
|
|
90
|
+
* Targets can be hint ID strings or 1-based ordinal integers (e.g., "@1 beta:e" targets
|
|
91
|
+
* the first hint by position and all hints with key "beta"). Numbers and keys can be mixed.
|
|
92
92
|
*
|
|
93
93
|
* @param featureName - The feature name (e.g., "r_h-position")
|
|
94
94
|
* @param value - The feature value
|
|
@@ -4,7 +4,6 @@ import { OperationHint } from "../settings/hint-models";
|
|
|
4
4
|
import { Logger } from "../core/logger";
|
|
5
5
|
import { AnimationEngine } from "../animation/animation-engine";
|
|
6
6
|
import { BoundsCache } from "./bounds-cache";
|
|
7
|
-
import { SpreadingEngine } from "./spreading-engine";
|
|
8
7
|
import { HintOverrides } from "./feature-resolver";
|
|
9
8
|
/**
|
|
10
9
|
* Hint renderer handles rendering of operation hints.
|
|
@@ -15,8 +14,7 @@ export declare class HintRenderer {
|
|
|
15
14
|
private _logger;
|
|
16
15
|
private _animationEngine;
|
|
17
16
|
private _boundsCache;
|
|
18
|
-
|
|
19
|
-
constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache, spreadingEngine: SpreadingEngine);
|
|
17
|
+
constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache);
|
|
20
18
|
/**
|
|
21
19
|
* Render a hint for an operation.
|
|
22
20
|
*
|
|
@@ -35,7 +33,7 @@ export declare class HintRenderer {
|
|
|
35
33
|
* @param viewportHeight - Height of the visible viewport (for prolog)
|
|
36
34
|
* @returns Promise that resolves when rendering completes
|
|
37
35
|
*/
|
|
38
|
-
renderHint(hintId: string, hint: OperationHint, referenceNodes: CharNode[], rootSvg: SVGElement, variables: Map<string, string>, operationId: string, hintOrdinal: number, allBaseNodes: CharNode[], versionTag: string, hintOverrides?: Map<string, HintOverrides>, panZoomInstance?: any, viewportWidth?: number, viewportHeight?: number): Promise<void>;
|
|
36
|
+
renderHint(hintId: string, hint: OperationHint, referenceNodes: CharNode[], rootSvg: SVGElement, variables: Map<string, string>, operationId: string, hintOrdinal: number, allBaseNodes: CharNode[], versionTag: string, hintOverrides?: Map<string | number, HintOverrides>, panZoomInstance?: any, viewportWidth?: number, viewportHeight?: number): Promise<void>;
|
|
39
37
|
/**
|
|
40
38
|
* Calculate Reference Bounding Rectangles (RBRs) from reference nodes.
|
|
41
39
|
* Nodes on different lines create separate RBRs.
|
|
@@ -86,18 +84,14 @@ export declare class HintRenderer {
|
|
|
86
84
|
* This is the point on the EBR that should align with the RBR alignment point.
|
|
87
85
|
*/
|
|
88
86
|
private calculateEBRAlignmentPoint;
|
|
89
|
-
/**
|
|
90
|
-
* Handle spreading for solid hints.
|
|
91
|
-
* @param versionTag - Version tag for tracking spreading history
|
|
92
|
-
*/
|
|
93
|
-
private handleSpreading;
|
|
94
87
|
/**
|
|
95
88
|
* Apply r_h-* overrides to hint properties.
|
|
96
|
-
*
|
|
89
|
+
* Priority (lowest to highest): wildcard ("*") < key-based < ordinal-based.
|
|
97
90
|
*
|
|
98
91
|
* @param hint - Original hint design
|
|
99
|
-
* @param hintId - ID of the hint being rendered
|
|
100
|
-
* @param
|
|
92
|
+
* @param hintId - ID (key) of the hint being rendered
|
|
93
|
+
* @param hintOrdinal - 1-based ordinal position of this hint within the operation
|
|
94
|
+
* @param hintOverrides - Map of overrides from r_h-* features (keyed by ID string or ordinal number)
|
|
101
95
|
* @param allBaseNodes - All base nodes for displaced span resolution
|
|
102
96
|
* @returns Modified hint with overrides applied
|
|
103
97
|
*/
|
|
@@ -3,7 +3,6 @@ import { GveRenditionSettings } from "../settings/settings";
|
|
|
3
3
|
import { Logger } from "../core/logger";
|
|
4
4
|
import { AnimationEngine } from "../animation/animation-engine";
|
|
5
5
|
import { BoundsCache } from "./bounds-cache";
|
|
6
|
-
import { SpreadingEngine } from "./spreading-engine";
|
|
7
6
|
import { RenditionConfig } from "./feature-resolver";
|
|
8
7
|
/**
|
|
9
8
|
* Text renderer handles rendering of base text and additional text.
|
|
@@ -13,9 +12,7 @@ export declare class TextRenderer {
|
|
|
13
12
|
private _logger;
|
|
14
13
|
private _animationEngine;
|
|
15
14
|
private _boundsCache;
|
|
16
|
-
private _spreadingEngine;
|
|
17
15
|
private _textLayout;
|
|
18
|
-
private _featureResolver;
|
|
19
16
|
/**
|
|
20
17
|
* Reference to the root SVG element for text width measurements.
|
|
21
18
|
* This ensures measurements happen in the same CSS context as rendering,
|
|
@@ -23,7 +20,7 @@ export declare class TextRenderer {
|
|
|
23
20
|
* that apply global CSS styles to document.body.
|
|
24
21
|
*/
|
|
25
22
|
private _measurementRoot?;
|
|
26
|
-
constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache
|
|
23
|
+
constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache);
|
|
27
24
|
/**
|
|
28
25
|
* Render base text (v0).
|
|
29
26
|
*
|
|
@@ -58,21 +55,25 @@ export declare class TextRenderer {
|
|
|
58
55
|
/**
|
|
59
56
|
* Calculate positions for additional text characters.
|
|
60
57
|
* Additional text flows left to right from the base position.
|
|
58
|
+
* When config is provided its font metrics are used for character width
|
|
59
|
+
* measurement, matching what applyTextStyle will actually render.
|
|
61
60
|
*/
|
|
62
61
|
private calculateAdditionalTextPositions;
|
|
63
62
|
/**
|
|
64
|
-
* Calculate
|
|
65
|
-
*
|
|
63
|
+
* Calculate the RBR anchor point for a given position type.
|
|
64
|
+
* This is the point on the RBR where the corresponding EBR point will land.
|
|
66
65
|
*/
|
|
67
|
-
private
|
|
66
|
+
private calculateRBRAlignmentPoint;
|
|
68
67
|
/**
|
|
69
|
-
* Calculate
|
|
68
|
+
* Calculate the EBR anchor point for a given position type.
|
|
69
|
+
* This is the point on the EBR that should coincide with the RBR anchor point.
|
|
70
70
|
*/
|
|
71
|
-
private
|
|
71
|
+
private calculateEBRAlignmentPoint;
|
|
72
72
|
/**
|
|
73
|
-
* Calculate
|
|
73
|
+
* Calculate RBRs from reference nodes.
|
|
74
|
+
* Nodes on different lines create separate RBRs.
|
|
74
75
|
*/
|
|
75
|
-
private
|
|
76
|
+
private calculateRBRs;
|
|
76
77
|
/**
|
|
77
78
|
* Update settings.
|
|
78
79
|
*/
|
|
@@ -46,11 +46,6 @@ export interface OperationHint {
|
|
|
46
46
|
* Rotation is applied with reference to the origin of the reference bounding rectangle.
|
|
47
47
|
*/
|
|
48
48
|
rotation: number;
|
|
49
|
-
/**
|
|
50
|
-
* Whether this hint is "solid" and requires spreading.
|
|
51
|
-
* Default: false (most hints are overlays that don't need spreading)
|
|
52
|
-
*/
|
|
53
|
-
solid?: boolean;
|
|
54
49
|
/**
|
|
55
50
|
* JS code for animating the hint's entrance via GSAP.
|
|
56
51
|
* If it starts with "#", it references an animation from settings.animations.
|
|
@@ -78,8 +78,6 @@ export interface GveRenditionSettings {
|
|
|
78
78
|
animations: Record<string, string>;
|
|
79
79
|
/** ID of animation to use for each character (from animations catalog) */
|
|
80
80
|
charAnimationId?: string;
|
|
81
|
-
/** Duration in milliseconds for spreading animation (0=no animation) */
|
|
82
|
-
spreadTime: number;
|
|
83
81
|
/** Duration in milliseconds for element fade-out animation
|
|
84
82
|
* (backward navigation only): 0=no animation */
|
|
85
83
|
backwardFadeOutTime: number;
|
|
@@ -88,8 +86,6 @@ export interface GveRenditionSettings {
|
|
|
88
86
|
prologDuration: number;
|
|
89
87
|
/** Dictionary of hints, keyed by hint ID */
|
|
90
88
|
hints: Record<string, OperationHint>;
|
|
91
|
-
/** Margin around each rendered hint in pixels */
|
|
92
|
-
hintMargin: number;
|
|
93
89
|
/** Design-time width used when creating hints */
|
|
94
90
|
hintDesignWidth: number;
|
|
95
91
|
/** Design-time height used when creating hints */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrmidon/gve-snapshot-rendition",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"homepage": "https://github.com/vedph/gve-snapshot-rendition",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,18 +47,18 @@
|
|
|
47
47
|
"@rollup/plugin-replace": "^6.0.3",
|
|
48
48
|
"@rollup/plugin-terser": "^1.0.0",
|
|
49
49
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
50
|
-
"@vitest/ui": "^4.1.
|
|
50
|
+
"@vitest/ui": "^4.1.6",
|
|
51
51
|
"concurrency": "^0.1.4",
|
|
52
52
|
"concurrently": "^9.2.1",
|
|
53
53
|
"lite-server": "^2.6.1",
|
|
54
|
-
"rollup": "^4.60.
|
|
54
|
+
"rollup": "^4.60.3",
|
|
55
55
|
"source-map-loader": "^5.0.0",
|
|
56
56
|
"ts-loader": "^9.5.7",
|
|
57
57
|
"typescript": "^6.0.3",
|
|
58
|
-
"vitest": "^4.1.
|
|
58
|
+
"vitest": "^4.1.6"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@rollup/rollup-win32-arm64-msvc": "^4.60.
|
|
61
|
+
"@rollup/rollup-win32-arm64-msvc": "^4.60.3"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "rollup -c",
|