@myrmidon/gve-snapshot-rendition 2.0.4 → 2.0.6

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.
Files changed (56) hide show
  1. package/dist/adapter/data-feature-adapter.d.ts +2 -3
  2. package/dist/animation/animation-engine.d.ts +0 -13
  3. package/dist/core/gve-snapshot-rendition.d.ts +49 -44
  4. package/dist/hint-designer/gve-hint-designer.d.ts +11 -1
  5. package/dist/index.cjs.min.js +1 -1
  6. package/dist/index.cjs.min.js.map +1 -1
  7. package/dist/index.js +483 -470
  8. package/dist/index.js.map +1 -1
  9. package/dist/models.d.ts +21 -50
  10. package/dist/rendering/feature-resolver.d.ts +6 -7
  11. package/dist/rendering/hint-renderer.d.ts +6 -12
  12. package/dist/rendering/text-layout.d.ts +2 -1
  13. package/dist/rendering/text-renderer.d.ts +13 -12
  14. package/dist/settings/hint-models.d.ts +0 -5
  15. package/dist/settings/settings.d.ts +0 -4
  16. package/dist/ui/details-area.d.ts +2 -1
  17. package/dist/ui/hilites.d.ts +3 -9
  18. package/dist/ui/operation-summary-service.d.ts +4 -7
  19. package/package.json +82 -73
  20. package/dist/rendering/spreading-engine.d.ts +0 -98
  21. package/dist/src/adapter/adapter-models.d.ts +0 -171
  22. package/dist/src/adapter/data-feature-adapter.d.ts +0 -30
  23. package/dist/src/adapter/feature-adapter.d.ts +0 -34
  24. package/dist/src/adapter/index.d.ts +0 -6
  25. package/dist/src/adapter/matcher.d.ts +0 -38
  26. package/dist/src/adapter/parser.d.ts +0 -58
  27. package/dist/src/adapter/tokenizer.d.ts +0 -55
  28. package/dist/src/animation/animation-engine.d.ts +0 -105
  29. package/dist/src/animation/animation-factory.d.ts +0 -49
  30. package/dist/src/core/color-palette.d.ts +0 -39
  31. package/dist/src/core/gve-snapshot-rendition.d.ts +0 -359
  32. package/dist/src/core/logger.d.ts +0 -37
  33. package/dist/src/hint-designer/gve-hint-designer.d.ts +0 -356
  34. package/dist/src/hint-designer/hint-designer-models.d.ts +0 -32
  35. package/dist/src/index.d.ts +0 -17
  36. package/dist/src/models.d.ts +0 -171
  37. package/dist/src/rendering/bounds-cache.d.ts +0 -62
  38. package/dist/src/rendering/feature-resolver.d.ts +0 -98
  39. package/dist/src/rendering/hint-renderer.d.ts +0 -103
  40. package/dist/src/rendering/spreading-engine.d.ts +0 -98
  41. package/dist/src/rendering/svg-utils.d.ts +0 -133
  42. package/dist/src/rendering/text-layout.d.ts +0 -100
  43. package/dist/src/rendering/text-renderer.d.ts +0 -81
  44. package/dist/src/settings/hint-models.d.ts +0 -61
  45. package/dist/src/settings/settings.d.ts +0 -118
  46. package/dist/src/ui/details-area.d.ts +0 -112
  47. package/dist/src/ui/hilites.d.ts +0 -63
  48. package/dist/src/ui/operation-summary-service.d.ts +0 -73
  49. package/dist/src/ui/toolbar.d.ts +0 -141
  50. package/dist/src/ui/version-text-area.d.ts +0 -131
  51. package/dist/src/ui/versions-list-area.d.ts +0 -88
  52. package/dist/src/utils/color-palette.d.ts +0 -36
  53. package/dist/src/utils/feature-utils.d.ts +0 -80
  54. package/dist/src/utils/node-utils.d.ts +0 -47
  55. package/dist/src/utils/text-utils.d.ts +0 -35
  56. /package/dist/{src/layout → layout}/golden-layout-styles.d.ts +0 -0
@@ -1,98 +0,0 @@
1
- import { Feature, CharNode } from "../models";
2
- import { GveRenditionSettings } from "../settings/settings";
3
- import { Logger } from "../core/logger";
4
- /**
5
- * Hint property overrides from r_h-* features.
6
- */
7
- export interface HintOverrides {
8
- position?: string;
9
- offsetX?: string;
10
- offsetY?: string;
11
- scaleX?: string;
12
- scaleY?: string;
13
- rotation?: string;
14
- displacedSpan?: {
15
- nodeId: number;
16
- count: number;
17
- };
18
- }
19
- /**
20
- * Resolved rendition configuration for text rendering.
21
- */
22
- export interface RenditionConfig {
23
- fontSize: number;
24
- fontFamily: string;
25
- foreColor: string;
26
- backColor: string;
27
- italic: boolean;
28
- bold: boolean;
29
- underline?: number;
30
- overline?: number;
31
- strike?: number;
32
- textLineStyle?: string;
33
- textLineColor?: string;
34
- rotate?: number;
35
- textPosition?: string;
36
- textOffsetX: number | string;
37
- textOffsetY: number | string;
38
- textDisplacedSpan?: {
39
- nodeId: number;
40
- count: number;
41
- };
42
- textValue?: string;
43
- hints?: string[];
44
- hintOverrides?: Map<string | number, HintOverrides>;
45
- hintVars?: Map<string, string>;
46
- }
47
- /**
48
- * Feature resolver converts features into rendition configuration.
49
- * This handles all the r_* rendition features and applies them to create
50
- * a complete configuration for rendering.
51
- */
52
- export declare class FeatureResolver {
53
- private _logger;
54
- constructor(logger: Logger);
55
- /**
56
- * Resolve rendition features into a complete configuration.
57
- * Features override the base settings.
58
- *
59
- * @param baseSettings - The base settings from component
60
- * @param features - Array of features to apply
61
- * @param nodeFeatureContext - Optional context for extracting node features for placeholder resolution
62
- * @returns Resolved rendition configuration
63
- */
64
- resolve(baseSettings: GveRenditionSettings, features: Feature[] | undefined, nodeFeatureContext?: {
65
- refNodes: CharNode[];
66
- outputTag: string;
67
- }): RenditionConfig;
68
- /**
69
- * Extract character offsets from init features.
70
- * This is used for base text layout adjustments.
71
- *
72
- * @param features - Features from the first annotate operation (init features)
73
- * @returns Map of node IDs to their offsets (values may be numbers or "Ntw"/"Nth" strings)
74
- */
75
- extractCharOffsets(features: Feature[] | undefined): Map<number, {
76
- x?: number | string;
77
- y?: number | string;
78
- }>;
79
- /**
80
- * Check if features contain a specific rendition feature.
81
- */
82
- hasRenditionFeature(features: Feature[] | undefined, featureName: string): boolean;
83
- /**
84
- * Get the value of a rendition feature.
85
- */
86
- getRenditionFeatureValue(features: Feature[] | undefined, featureName: string): string | undefined;
87
- /**
88
- * Parse r_h-* hint override features.
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
- *
93
- * @param featureName - The feature name (e.g., "r_h-position")
94
- * @param value - The feature value
95
- * @param config - The rendition config to update
96
- */
97
- private parseHintOverride;
98
- }
@@ -1,103 +0,0 @@
1
- import { CharNode } from "../models";
2
- import { GveRenditionSettings } from "../settings/settings";
3
- import { OperationHint } from "../settings/hint-models";
4
- import { Logger } from "../core/logger";
5
- import { AnimationEngine } from "../animation/animation-engine";
6
- import { BoundsCache } from "./bounds-cache";
7
- import { HintOverrides } from "./feature-resolver";
8
- /**
9
- * Hint renderer handles rendering of operation hints.
10
- * Hints are visual counterparts of editing operations.
11
- */
12
- export declare class HintRenderer {
13
- private _settings;
14
- private _logger;
15
- private _animationEngine;
16
- private _boundsCache;
17
- constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache);
18
- /**
19
- * Render a hint for an operation.
20
- *
21
- * @param hintId - ID of the hint from settings.hints
22
- * @param hint - The hint configuration
23
- * @param referenceNodes - Nodes referenced by the operation (for RBR calculation)
24
- * @param rootSvg - Root SVG element to append hint to
25
- * @param variables - Variables from r_hint-vars for placeholder resolution
26
- * @param operationId - ID of the operation (for unique hint ID)
27
- * @param hintOrdinal - Ordinal number of this hint for the operation (1, 2, 3...)
28
- * @param allBaseNodes - All base text nodes (for displaced span)
29
- * @param versionTag - Version tag to add as CSS class
30
- * @param hintOverrides - Optional overrides from r_h-* features
31
- * @param panZoomInstance - The svg-pan-zoom instance (for prolog)
32
- * @param viewportWidth - Width of the visible viewport (for prolog)
33
- * @param viewportHeight - Height of the visible viewport (for prolog)
34
- * @returns Promise that resolves when rendering completes
35
- */
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>;
37
- /**
38
- * Calculate Reference Bounding Rectangles (RBRs) from reference nodes.
39
- * Nodes on different lines create separate RBRs.
40
- */
41
- private calculateRBRs;
42
- /**
43
- * Calculate RBRs from a displaced span reference (IDxN format).
44
- */
45
- private calculateDisplacedRBRs;
46
- /**
47
- * Calculate scaling information for the hint.
48
- * Returns scale factors and target dimensions.
49
- */
50
- private calculateScalingInfo;
51
- /**
52
- * Apply size transforms (scale and rotation) to the hint.
53
- * Per documentation, these are applied BEFORE positioning.
54
- *
55
- * IMPORTANT: We DON'T actually apply these as transforms on the element.
56
- * Instead, we just return the scaling info and rotation, and later we'll create
57
- * a combined transform that includes both sizing and positioning.
58
- */
59
- private applyHintSizeTransforms;
60
- /**
61
- * Apply complete transform to the hint (both sizing and positioning).
62
- * This builds a single transform that:
63
- * 1. Translates so the EBR alignment point is at origin
64
- * 2. Scales and rotates the hint
65
- * 3. Translates to the final RBR position
66
- *
67
- * Per documentation: hints use the handle's bounding box as EBR if a handle element exists,
68
- * otherwise they use the whole hint's bounding box as EBR.
69
- */
70
- private applyHintPositionTransform;
71
- /**
72
- * Get the EBR (Element Bounding Rectangle) for positioning.
73
- * Per documentation: if the hint has a handle element, use its bounding box.
74
- * Otherwise, use the whole hint's bounding box.
75
- */
76
- private getEBRBounds;
77
- /**
78
- * Calculate the alignment point on the RBR based on position type.
79
- * This is where the EBR's corresponding alignment point should be positioned.
80
- */
81
- private calculateRBRAlignmentPoint;
82
- /**
83
- * Calculate the alignment point on the EBR based on position type.
84
- * This is the point on the EBR that should align with the RBR alignment point.
85
- */
86
- private calculateEBRAlignmentPoint;
87
- /**
88
- * Apply r_h-* overrides to hint properties.
89
- * Priority (lowest to highest): wildcard ("*") < key-based < ordinal-based.
90
- *
91
- * @param hint - Original hint design
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)
95
- * @param allBaseNodes - All base nodes for displaced span resolution
96
- * @returns Modified hint with overrides applied
97
- */
98
- private applyHintOverrides;
99
- /**
100
- * Update settings.
101
- */
102
- updateSettings(settings: GveRenditionSettings): void;
103
- }
@@ -1,98 +0,0 @@
1
- import { BoundsCache, BoundingRect } from "./bounds-cache";
2
- import { Logger } from "../core/logger";
3
- /**
4
- * Result of spreading calculation.
5
- */
6
- export interface SpreadingResult {
7
- /** Map of element ID to its horizontal shift amount */
8
- horizontalShifts: Map<string, number>;
9
- /** Map of element ID to its vertical shift amount */
10
- verticalShifts: Map<string, number>;
11
- /** Whether any spreading was needed */
12
- hasShifts: boolean;
13
- }
14
- /**
15
- * Metadata about spreading applied to an element for a specific version.
16
- */
17
- export interface SpreadingMetadata {
18
- /** Version index that caused this spreading */
19
- versionIndex: number;
20
- /** Horizontal shift applied (in pixels) */
21
- horizontalShift: number;
22
- /** Vertical shift applied (in pixels) */
23
- verticalShift: number;
24
- }
25
- /**
26
- * Engine for calculating spreading (making room for new elements).
27
- * Implements the "stone in pond" ripple effect to preserve layout.
28
- */
29
- export declare class SpreadingEngine {
30
- private _boundsCache;
31
- private _logger;
32
- /**
33
- * Map of element ID to array of spreading metadata (one per version).
34
- * Each element can be shifted multiple times by different versions.
35
- */
36
- private _spreadingHistory;
37
- constructor(boundsCache: BoundsCache, logger: Logger);
38
- /**
39
- * Track spreading metadata for elements affected by a version.
40
- * Called after spreading is applied to record what happened.
41
- *
42
- * @param versionIndex - Version index that caused the spreading
43
- * @param horizontalShifts - Map of element IDs to horizontal shifts
44
- * @param verticalShifts - Map of element IDs to vertical shifts
45
- */
46
- trackSpreading(versionIndex: number, horizontalShifts: Map<string, number>, verticalShifts: Map<string, number>): void;
47
- /**
48
- * Get spreading metadata for elements affected by a specific version.
49
- * Used when reversing spreading during backward navigation.
50
- *
51
- * @param versionIndex - Version index to get spreading for
52
- * @returns Map of element ID to spreading metadata
53
- */
54
- getSpreadingForVersion(versionIndex: number): Map<string, SpreadingMetadata>;
55
- /**
56
- * Remove spreading history for a specific version.
57
- * Called after spreading is reversed during backward navigation.
58
- *
59
- * @param versionIndex - Version index to remove history for
60
- */
61
- clearSpreadingForVersion(versionIndex: number): void;
62
- /**
63
- * Calculate spreading required to make room for a new element.
64
- *
65
- * @param newElementBounds - Bounds of the element to be added
66
- * @param excludeIds - Element IDs to exclude from shifting (e.g., the new element itself)
67
- * @returns Spreading result with shift amounts for each affected element
68
- */
69
- calculateSpreading(newElementBounds: BoundingRect, excludeIds?: string[]): SpreadingResult;
70
- /**
71
- * Calculate horizontal spreading.
72
- * Elements overlapping on the left are shifted left, those on the right are shifted right.
73
- */
74
- private calculateHorizontalSpreading;
75
- /**
76
- * Calculate vertical spreading.
77
- * Elements overlapping from above are shifted up, those from below are shifted down.
78
- */
79
- private calculateVerticalSpreading;
80
- /**
81
- * Calculate the horizontal overlap between two bounding rectangles.
82
- * Returns 0 if there is no overlap.
83
- */
84
- private calculateHorizontalOverlap;
85
- /**
86
- * Calculate the vertical overlap between two bounding rectangles.
87
- * Returns 0 if there is no overlap.
88
- */
89
- private calculateVerticalOverlap;
90
- /**
91
- * Check if two bounding rectangles overlap.
92
- */
93
- checkOverlap(rect1: BoundingRect, rect2: BoundingRect): boolean;
94
- /**
95
- * Find all elements that overlap with given bounds.
96
- */
97
- findOverlappingElements(bounds: BoundingRect, excludeIds?: string[]): string[];
98
- }
@@ -1,133 +0,0 @@
1
- /**
2
- * SVG utility functions for creating and manipulating SVG elements.
3
- */
4
- /**
5
- * Create an SVG element with the given tag name.
6
- */
7
- export declare function createSVGElement<K extends keyof SVGElementTagNameMap>(tagName: K): SVGElementTagNameMap[K];
8
- /**
9
- * Set multiple attributes on an SVG element.
10
- */
11
- export declare function setAttributes(element: SVGElement, attributes: Record<string, string | number>): void;
12
- /**
13
- * Create an SVG text element with content and attributes.
14
- */
15
- export declare function createTextElement(content: string, attributes?: Record<string, string | number>): SVGTextElement;
16
- /**
17
- * Create an SVG group element.
18
- */
19
- export declare function createGroup(id?: string, classes?: string[]): SVGGElement;
20
- /**
21
- * Create an SVG rect element.
22
- */
23
- export declare function createRect(x: number, y: number, width: number, height: number, attributes?: Record<string, string | number>): SVGRectElement;
24
- /**
25
- * Create an SVG line element.
26
- */
27
- export declare function createLine(x1: number, y1: number, x2: number, y2: number, attributes?: Record<string, string | number>): SVGLineElement;
28
- /**
29
- * Apply text styling attributes based on settings.
30
- */
31
- export declare function applyTextStyle(element: SVGTextElement, style: {
32
- fontFamily?: string;
33
- fontSize?: number;
34
- foreColor?: string;
35
- backColor?: string;
36
- italic?: boolean;
37
- bold?: boolean;
38
- underline?: number;
39
- overline?: number;
40
- strike?: number;
41
- rotate?: number;
42
- }): void;
43
- /**
44
- * Apply line decoration to text (for custom thickness support).
45
- * This creates actual line elements for better control over thickness.
46
- */
47
- export declare function applyLineDecoration(parentGroup: SVGGElement, textElement: SVGTextElement, type: "underline" | "overline" | "strike", thickness: number, color: string, style?: string): SVGLineElement;
48
- /**
49
- * Parse SVG from string and return the root element.
50
- * Assumes the SVG content has a root <g> element.
51
- */
52
- export declare function parseSVGContent(svgString: string): SVGGElement | null;
53
- /**
54
- * Clone an SVG element and all its children.
55
- */
56
- export declare function cloneSVGElement<T extends SVGElement>(element: T): T;
57
- /**
58
- * Get the bounding box of an SVG element in a safe way.
59
- * Returns a default rectangle if getBBox() fails.
60
- *
61
- * IMPORTANT: This returns the bbox in LOCAL coordinates (without transforms).
62
- * Use getTransformedBBox() if you need the actual screen/SVG coordinates.
63
- */
64
- export declare function getSafeBBox(element: SVGElement): DOMRect;
65
- /**
66
- * Get the bounding box of an SVG element WITH transforms applied.
67
- * This returns the actual position in the SVG coordinate system.
68
- *
69
- * This is crucial for visibility checks because getBBox() returns local coords
70
- * which don't reflect the element's actual position after transforms.
71
- *
72
- * @param element - The SVG element
73
- * @returns The bounding box in SVG coordinate space (with transforms applied)
74
- */
75
- export declare function getTransformedBBox(element: SVGElement): DOMRect;
76
- /**
77
- * Apply a transform to an SVG element.
78
- */
79
- export declare function applyTransform(element: SVGElement, transform: {
80
- translateX?: number;
81
- translateY?: number;
82
- scaleX?: number;
83
- scaleY?: number;
84
- rotate?: number;
85
- originX?: number;
86
- originY?: number;
87
- }): void;
88
- /**
89
- * Calculate the center point of a bounding rectangle.
90
- */
91
- export declare function getRectCenter(rect: DOMRect | {
92
- x: number;
93
- y: number;
94
- width: number;
95
- height: number;
96
- }): {
97
- x: number;
98
- y: number;
99
- };
100
- /**
101
- * Get computed text width for a given text and style.
102
- * Creates a temporary SVG element to measure.
103
- *
104
- * IMPORTANT: The measurementRoot parameter is critical for correct measurements
105
- * when the component runs inside Angular or other frameworks that apply global
106
- * CSS styles (like font-family) to document.body. Without it, measurements
107
- * happen in document.body where inherited styles may affect font metrics,
108
- * but actual rendering happens inside Shadow DOM where styles are isolated.
109
- * This mismatch causes text positions and hint placements to be incorrect.
110
- *
111
- * When measurementRoot is provided (typically the component's root SVG element),
112
- * measurements happen in the same CSS context as the actual rendering,
113
- * ensuring consistent font metrics.
114
- *
115
- * @param text - The text to measure
116
- * @param fontFamily - Font family to use
117
- * @param fontSize - Font size in pixels
118
- * @param bold - Whether text is bold
119
- * @param italic - Whether text is italic
120
- * @param measurementRoot - Optional SVG element to use as measurement context.
121
- * If provided, a temporary text element is appended here
122
- * for measurement (same CSS context as rendering).
123
- * If not provided, falls back to document.body (legacy behavior).
124
- */
125
- export declare function getTextWidth(text: string, fontFamily: string, fontSize: number, bold?: boolean, italic?: boolean, measurementRoot?: SVGElement): number;
126
- /**
127
- * Move an element to the back (lowest z-index in SVG).
128
- */
129
- export declare function moveToBack(element: SVGElement): void;
130
- /**
131
- * Move an element to the front (highest z-index in SVG).
132
- */
133
- export declare function moveToFront(element: SVGElement): void;
@@ -1,100 +0,0 @@
1
- import { CharNode } from "../models";
2
- import { GveRenditionSettings } from "../settings/settings";
3
- import { Logger } from "../core/logger";
4
- import { RenditionConfig } from "./feature-resolver";
5
- /**
6
- * Position information for a character node.
7
- */
8
- export interface CharPosition {
9
- x: number;
10
- y: number;
11
- nodeId: number;
12
- lineNumber: number;
13
- }
14
- /**
15
- * Text layout calculator.
16
- * Handles positioning of base text characters, respecting line breaks,
17
- * spaces, and character offsets.
18
- */
19
- export declare class TextLayout {
20
- private _settings;
21
- private _logger;
22
- private _spaceWidth;
23
- /**
24
- * The SVG element used as the measurement context for text width calculations.
25
- * This ensures measurements happen in the same CSS context as actual rendering,
26
- * which is critical when the component runs inside frameworks like Angular
27
- * that may apply global CSS styles affecting font metrics.
28
- *
29
- * When this is undefined, measurements fall back to document.body (legacy behavior)
30
- * which can cause position mismatches if global styles differ from Shadow DOM styles.
31
- */
32
- private _measurementRoot?;
33
- constructor(settings: GveRenditionSettings, logger: Logger);
34
- /**
35
- * Set the measurement root for text width calculations.
36
- * This should be called with the root SVG element after it's created,
37
- * before any layout calculations are performed.
38
- *
39
- * IMPORTANT: This ensures text measurements happen in the same CSS context
40
- * as actual rendering (inside Shadow DOM), avoiding position mismatches
41
- * caused by different font metrics in document.body vs Shadow DOM.
42
- *
43
- * @param root - The SVG element to use as measurement context
44
- */
45
- setMeasurementRoot(root: SVGElement): void;
46
- /**
47
- * Calculate the width of a space character based on reference character.
48
- */
49
- private calculateSpaceWidth;
50
- /**
51
- * Calculate positions for all base text nodes.
52
- *
53
- * @param nodes - The character nodes to position
54
- * @param charOffsets - Map of node IDs to their offset overrides (from r_char-offsets feature).
55
- * Offset values may be plain numbers (px) or strings with units "tw"/"th"
56
- * (average character width / height of the current font).
57
- * @returns Array of character positions
58
- */
59
- calculateBaseTextPositions(nodes: CharNode[], charOffsets?: Map<number, {
60
- x?: number | string;
61
- y?: number | string;
62
- }>, nodeConfigs?: Map<number, RenditionConfig>): CharPosition[];
63
- /**
64
- * Calculate position for a single additional text node.
65
- * Additional text positioning is driven by rendition features.
66
- *
67
- * @param referencePosition - The position to use as reference (e.g., from RBR)
68
- * @param position - Position type (n, ne, e, se, s, sw, w, nw, o)
69
- * @param offsetX - X offset (can be number or string like "0.5th")
70
- * @param offsetY - Y offset (can be number or string like "0.5tw")
71
- * @param refBounds - Reference bounding rectangle dimensions
72
- * @returns Calculated position
73
- */
74
- calculateAdditionalTextPosition(referencePosition: {
75
- x: number;
76
- y: number;
77
- }, position: string, offsetX: number, offsetY: number, refBounds: {
78
- width: number;
79
- height: number;
80
- }): {
81
- x: number;
82
- y: number;
83
- };
84
- /**
85
- * Get the line number for a given node ID from positions.
86
- */
87
- getLineNumber(positions: CharPosition[], nodeId: number): number;
88
- /**
89
- * Get all positions for a specific line.
90
- */
91
- getLinePositions(positions: CharPosition[], lineNumber: number): CharPosition[];
92
- /**
93
- * Update settings and recalculate space width.
94
- */
95
- updateSettings(settings: GveRenditionSettings): void;
96
- /**
97
- * Get the computed space width.
98
- */
99
- getSpaceWidth(): number;
100
- }
@@ -1,81 +0,0 @@
1
- import { CharNode } from "../models";
2
- import { GveRenditionSettings } from "../settings/settings";
3
- import { Logger } from "../core/logger";
4
- import { AnimationEngine } from "../animation/animation-engine";
5
- import { BoundsCache } from "./bounds-cache";
6
- import { RenditionConfig } from "./feature-resolver";
7
- /**
8
- * Text renderer handles rendering of base text and additional text.
9
- */
10
- export declare class TextRenderer {
11
- private _settings;
12
- private _logger;
13
- private _animationEngine;
14
- private _boundsCache;
15
- private _textLayout;
16
- /**
17
- * Reference to the root SVG element for text width measurements.
18
- * This ensures measurements happen in the same CSS context as rendering,
19
- * which is critical when running inside Angular or other frameworks
20
- * that apply global CSS styles to document.body.
21
- */
22
- private _measurementRoot?;
23
- constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache);
24
- /**
25
- * Render base text (v0).
26
- *
27
- * @param nodes - Character nodes to render
28
- * @param rootSvg - Root SVG element
29
- * @param charOffsets - Optional character offset overrides
30
- * @returns Promise that resolves when rendering completes
31
- */
32
- renderBaseText(nodes: CharNode[], rootSvg: SVGElement, charOffsets?: Map<number, {
33
- x?: number | string;
34
- y?: number | string;
35
- }>, nodeConfigs?: Map<number, RenditionConfig>): Promise<void>;
36
- /**
37
- * Render a single character node.
38
- */
39
- private renderCharacter;
40
- /**
41
- * Render additional text added by operations.
42
- *
43
- * @param nodes - Nodes to render
44
- * @param rootSvg - Root SVG element
45
- * @param config - Rendition configuration
46
- * @param versionTag - Version tag for class
47
- * @param referenceNodes - Reference nodes for RBR calculation
48
- * @param allBaseNodes - All base text nodes (for displaced span)
49
- * @param panZoomInstance - The svg-pan-zoom instance (for prolog)
50
- * @param viewportWidth - Width of the visible viewport (for prolog)
51
- * @param viewportHeight - Height of the visible viewport (for prolog)
52
- * @returns Promise that resolves when rendering completes
53
- */
54
- renderAdditionalText(nodes: CharNode[], rootSvg: SVGElement, config: RenditionConfig, versionTag: string, referenceNodes: CharNode[], allBaseNodes: CharNode[], panZoomInstance?: any, viewportWidth?: number, viewportHeight?: number): Promise<void>;
55
- /**
56
- * Calculate positions for additional text characters.
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.
60
- */
61
- private calculateAdditionalTextPositions;
62
- /**
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.
65
- */
66
- private calculateRBRAlignmentPoint;
67
- /**
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
- */
71
- private calculateEBRAlignmentPoint;
72
- /**
73
- * Calculate RBRs from reference nodes.
74
- * Nodes on different lines create separate RBRs.
75
- */
76
- private calculateRBRs;
77
- /**
78
- * Update settings.
79
- */
80
- updateSettings(settings: GveRenditionSettings): void;
81
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * Models for operation hints.
3
- */
4
- import { RelativePosition } from "../core/gve-snapshot-rendition";
5
- /**
6
- * An editing operation's hint.
7
- * Hints represent the visual counterpart of an operation.
8
- */
9
- export interface OperationHint {
10
- /**
11
- * SVG code for hint's visuals.
12
- * Always has a root `g` element.
13
- * May contain placeholders in {{name}} format.
14
- */
15
- svg: string;
16
- /**
17
- * Relative position for the hint with respect to the reference bounding rectangle.
18
- */
19
- position: RelativePosition;
20
- /**
21
- * X offset from the computed position.
22
- * Can be:
23
- * - A number (pixels)
24
- * - A string with suffix: "0.5th" (half text height), "0.5tw" (half text width)
25
- */
26
- offsetX: number | string;
27
- /**
28
- * Y offset from the computed position.
29
- * Can be:
30
- * - A number (pixels)
31
- * - A string with suffix: "0.5th" (half text height), "0.5tw" (half text width)
32
- */
33
- offsetY: number | string;
34
- /**
35
- * Horizontal scale: 1 = match bounds width, 1.1 = 110% of bounds width.
36
- * Default: 1
37
- */
38
- scaleX: number;
39
- /**
40
- * Vertical scale: 1 = match bounds height, 1.1 = 110% of bounds height.
41
- * Default: 1
42
- */
43
- scaleY: number;
44
- /**
45
- * Rotation in degrees. 0 = no rotation.
46
- * Rotation is applied with reference to the origin of the reference bounding rectangle.
47
- */
48
- rotation: number;
49
- /**
50
- * JS code for animating the hint's entrance via GSAP.
51
- * If it starts with "#", it references an animation from settings.animations.
52
- * The code receives parameters: (gsap, hintEl, rootEl)
53
- */
54
- animation?: string;
55
- /**
56
- * A span of base text with format IDxN where ID=node ID and N=count of chars,
57
- * to be used as the RBR instead of the default RBR.
58
- * Used for displaced hints.
59
- */
60
- displacedRefSpan?: string;
61
- }