@myrmidon/gve-snapshot-rendition 0.0.1

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 (42) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +135 -0
  3. package/dist/adapter/adapter-models.d.ts +171 -0
  4. package/dist/adapter/data-feature-adapter.d.ts +31 -0
  5. package/dist/adapter/feature-adapter.d.ts +34 -0
  6. package/dist/adapter/index.d.ts +6 -0
  7. package/dist/adapter/matcher.d.ts +38 -0
  8. package/dist/adapter/parser.d.ts +58 -0
  9. package/dist/adapter/tokenizer.d.ts +55 -0
  10. package/dist/animation/animation-engine.d.ts +118 -0
  11. package/dist/animation/animation-factory.d.ts +49 -0
  12. package/dist/core/color-palette.d.ts +39 -0
  13. package/dist/core/gve-snapshot-rendition.d.ts +318 -0
  14. package/dist/core/logger.d.ts +37 -0
  15. package/dist/hint-designer/gve-hint-designer.d.ts +298 -0
  16. package/dist/hint-designer/hint-designer-models.d.ts +32 -0
  17. package/dist/index.cjs.min.js +348 -0
  18. package/dist/index.cjs.min.js.map +1 -0
  19. package/dist/index.d.ts +16 -0
  20. package/dist/index.js +83396 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/models.d.ts +200 -0
  23. package/dist/rendering/bounds-cache.d.ts +62 -0
  24. package/dist/rendering/feature-resolver.d.ts +98 -0
  25. package/dist/rendering/hint-renderer.d.ts +109 -0
  26. package/dist/rendering/spreading-engine.d.ts +98 -0
  27. package/dist/rendering/svg-utils.d.ts +112 -0
  28. package/dist/rendering/text-layout.d.ts +75 -0
  29. package/dist/rendering/text-renderer.d.ts +73 -0
  30. package/dist/settings/hint-models.d.ts +66 -0
  31. package/dist/settings/settings.d.ts +122 -0
  32. package/dist/ui/details-area.d.ts +81 -0
  33. package/dist/ui/hilites.d.ts +69 -0
  34. package/dist/ui/operation-summary-service.d.ts +76 -0
  35. package/dist/ui/toolbar.d.ts +131 -0
  36. package/dist/ui/version-text-area.d.ts +131 -0
  37. package/dist/ui/versions-list-area.d.ts +88 -0
  38. package/dist/utils/color-palette.d.ts +36 -0
  39. package/dist/utils/feature-utils.d.ts +76 -0
  40. package/dist/utils/node-utils.d.ts +47 -0
  41. package/dist/utils/text-utils.d.ts +35 -0
  42. package/package.json +79 -0
@@ -0,0 +1,200 @@
1
+ /**
2
+ * Generic name=value feature.
3
+ */
4
+ export interface Feature {
5
+ name: string;
6
+ value: string;
7
+ setPolicy: FeatureSetPolicy;
8
+ }
9
+ /**
10
+ * Operation feature set policy.
11
+ */
12
+ export declare enum FeatureSetPolicy {
13
+ multiple = 0,
14
+ single = 1,
15
+ singleFirst = 2
16
+ }
17
+ /**
18
+ * Operation feature.
19
+ */
20
+ export interface OperationFeature extends Feature {
21
+ isNegated?: boolean;
22
+ isGlobal?: boolean;
23
+ isShortLived?: boolean;
24
+ }
25
+ /**
26
+ * Source about a text variant. This is typically used when
27
+ * variants come from different witnesses.
28
+ */
29
+ export interface OperationSource {
30
+ id: string;
31
+ type: string;
32
+ rank?: number;
33
+ note?: string;
34
+ }
35
+ /**
36
+ * Diplomatic data for a text variant.
37
+ */
38
+ export interface OperationDiplomatics {
39
+ g: string;
40
+ isNewTextHidden?: boolean;
41
+ features?: Feature[];
42
+ elementFeatures?: Record<string, Feature[]>;
43
+ }
44
+ /**
45
+ * Generic metadata about a text variant generation operation.
46
+ */
47
+ export interface OperationMetadata {
48
+ type: OperationType;
49
+ id: string;
50
+ rank?: number;
51
+ groupId?: string;
52
+ features?: OperationFeature[];
53
+ sources?: OperationSource[];
54
+ diplomatics?: OperationDiplomatics;
55
+ }
56
+ /**
57
+ * Type of a text operation.
58
+ */
59
+ export declare enum OperationType {
60
+ replace = 0,
61
+ delete = 1,
62
+ addBefore = 2,
63
+ addAfter = 3,
64
+ moveBefore = 4,
65
+ moveAfter = 5,
66
+ swap = 6,
67
+ annotate = 7
68
+ }
69
+ /**
70
+ * Metadata of a char-based chain operation.
71
+ */
72
+ export interface CharChainOperation extends OperationMetadata {
73
+ at: number;
74
+ atAsIndex?: boolean;
75
+ to?: number;
76
+ toAsIndex?: boolean;
77
+ inputTag?: string;
78
+ outputTag?: string;
79
+ run: number;
80
+ toRun?: number;
81
+ value?: string;
82
+ noTraceFeatures?: boolean;
83
+ dsl?: string;
84
+ }
85
+ /**
86
+ * A single character node in an operation execution result.
87
+ */
88
+ export interface CharNode {
89
+ id: number;
90
+ index: number;
91
+ label: string;
92
+ data: string;
93
+ sourceTag?: string;
94
+ features?: Feature[];
95
+ }
96
+ /**
97
+ * Execution step of a char-based chain operation.
98
+ */
99
+ export interface ChainOperationContextStep {
100
+ /**
101
+ * The operation that was executed.
102
+ */
103
+ operation: CharChainOperation;
104
+ /**
105
+ * The input version tag.
106
+ */
107
+ inputTag: string;
108
+ /**
109
+ * The output version tag.
110
+ */
111
+ outputTag: string;
112
+ /**
113
+ * The string synthetically representing the resulting text
114
+ * version.
115
+ */
116
+ result?: string;
117
+ /**
118
+ * The features emitted up to the executed operation.
119
+ * These are the features of the text as a whole, and
120
+ * those belonging to specific nodes, each keyed under
121
+ * a string built with `v` + output version tag + `_`
122
+ * + node ID (e.g. `v1_2` for node with ID 2 at version 1).
123
+ */
124
+ featureSet: {
125
+ features: OperationFeature[];
126
+ nodeFeatures: Record<string, OperationFeature[]>;
127
+ };
128
+ /**
129
+ * The reference node IDs of the operation which was
130
+ * executed.
131
+ */
132
+ refNodeIds: number[];
133
+ }
134
+ /**
135
+ * Result of execution of a char-based chain.
136
+ */
137
+ export interface CharChainResult {
138
+ /**
139
+ * The base text, as an array of character nodes or string.
140
+ * This is not returned by the API, but can be supplied
141
+ * by the caller.
142
+ */
143
+ text?: CharNode[] | string;
144
+ /**
145
+ * The execution steps of the chain.
146
+ */
147
+ steps: ChainOperationContextStep[];
148
+ /**
149
+ * The chain dump, which is the text representation of the chain.
150
+ */
151
+ chainDump: string;
152
+ /**
153
+ * The list of all unique tags in the chain.
154
+ */
155
+ chainTags: string[];
156
+ /**
157
+ * The sets of nodes in their order, for each version tag.
158
+ * These nodes are collected by following the path defined
159
+ * by the set of links of each version tag; so each of the
160
+ * sets contains only the nodes used at that step to build
161
+ * the text version, with their features up to that stage.
162
+ */
163
+ taggedNodes: {
164
+ [key: string]: CharNode[];
165
+ };
166
+ }
167
+ /**
168
+ * The input and output tags of a char-based chain operation.
169
+ */
170
+ export interface ChainOperationTags {
171
+ inputTag: string;
172
+ outputTag: string;
173
+ }
174
+ /**
175
+ * The node of a character-based chain, used for diagnostic
176
+ * or demonstration purposes.
177
+ */
178
+ export interface CharChainNode {
179
+ id: number;
180
+ label: string;
181
+ data: string;
182
+ sourceTag?: string;
183
+ }
184
+ /**
185
+ * The link of a character-based chain, used for diagnostic
186
+ * or demonstration purposes.
187
+ */
188
+ export interface CharChainLink {
189
+ tag: string;
190
+ sourceId: number;
191
+ targetId: number;
192
+ }
193
+ /**
194
+ * The character-based chain, as resulting from running operations
195
+ * on a base text, used for diagnostic or demonstration purposes.
196
+ */
197
+ export interface CharChain {
198
+ nodes: CharChainNode[];
199
+ links: CharChainLink[];
200
+ }
@@ -0,0 +1,62 @@
1
+ import { Logger } from "../core/logger";
2
+ /**
3
+ * Bounding rectangle with position and dimensions.
4
+ */
5
+ export interface BoundingRect {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ right: number;
11
+ bottom: number;
12
+ }
13
+ /**
14
+ * Cache for storing bounding rectangles of SVG elements.
15
+ * This avoids expensive getBBox() calls and improves spreading performance.
16
+ */
17
+ export declare class BoundsCache {
18
+ private _cache;
19
+ private _logger;
20
+ constructor(logger: Logger);
21
+ /**
22
+ * Add or update a bounding rectangle for an element.
23
+ */
24
+ set(elementId: string, bounds: DOMRect | SVGRect): void;
25
+ /**
26
+ * Get the bounding rectangle for an element.
27
+ */
28
+ get(elementId: string): BoundingRect | undefined;
29
+ /**
30
+ * Check if an element's bounds are cached.
31
+ */
32
+ has(elementId: string): boolean;
33
+ /**
34
+ * Remove bounds for an element.
35
+ */
36
+ delete(elementId: string): void;
37
+ /**
38
+ * Clear all cached bounds.
39
+ */
40
+ clear(): void;
41
+ /**
42
+ * Get all cached element IDs.
43
+ */
44
+ getAllIds(): string[];
45
+ /**
46
+ * Get all cached bounds.
47
+ */
48
+ getAllBounds(): BoundingRect[];
49
+ /**
50
+ * Update bounds for an element by ID from the DOM.
51
+ * Returns true if successful, false if element not found.
52
+ */
53
+ updateFromElement(element: SVGElement): boolean;
54
+ /**
55
+ * Get the bounding rectangle that encloses multiple elements.
56
+ */
57
+ getUnionBounds(elementIds: string[]): BoundingRect | undefined;
58
+ /**
59
+ * Get the number of cached items.
60
+ */
61
+ size(): number;
62
+ }
@@ -0,0 +1,98 @@
1
+ import { Feature, OperationFeature } 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
+ solid?: boolean;
15
+ displacedSpan?: {
16
+ nodeId: number;
17
+ count: number;
18
+ };
19
+ }
20
+ /**
21
+ * Resolved rendition configuration for text rendering.
22
+ */
23
+ export interface RenditionConfig {
24
+ fontSize: number;
25
+ fontFamily: string;
26
+ foreColor: string;
27
+ backColor: string;
28
+ italic: boolean;
29
+ bold: boolean;
30
+ underline?: number;
31
+ overline?: number;
32
+ strike?: number;
33
+ textLineStyle?: string;
34
+ textLineColor?: string;
35
+ rotate?: number;
36
+ textPosition?: string;
37
+ textOffsetX: number | string;
38
+ textOffsetY: number | string;
39
+ textSolid?: boolean;
40
+ textDisplacedSpan?: {
41
+ nodeId: number;
42
+ count: number;
43
+ };
44
+ hints?: string[];
45
+ hintOverrides?: Map<string, HintOverrides>;
46
+ hintVars?: Map<string, string>;
47
+ }
48
+ /**
49
+ * Feature resolver converts features into rendition configuration.
50
+ * This handles all the r_* rendition features and applies them to create
51
+ * a complete configuration for rendering.
52
+ */
53
+ export declare class FeatureResolver {
54
+ private _logger;
55
+ constructor(logger: Logger);
56
+ /**
57
+ * Resolve rendition features into a complete configuration.
58
+ * Features override the base settings.
59
+ *
60
+ * @param baseSettings - The base settings from component
61
+ * @param features - Array of features to apply
62
+ * @param nodeFeatureContext - Optional context for extracting node features for placeholder resolution
63
+ * @returns Resolved rendition configuration
64
+ */
65
+ resolve(baseSettings: GveRenditionSettings, features: Feature[] | undefined, nodeFeatureContext?: {
66
+ nodeFeatures: Record<string, OperationFeature[]>;
67
+ outputTag: string;
68
+ refNodeIds: number[];
69
+ }): RenditionConfig;
70
+ /**
71
+ * Extract character offsets from init features.
72
+ * This is used for base text layout adjustments.
73
+ *
74
+ * @param features - Features from the first annotate operation (init features)
75
+ * @returns Map of node IDs to their offsets
76
+ */
77
+ extractCharOffsets(features: Feature[] | undefined): Map<number, {
78
+ x?: number;
79
+ y?: number;
80
+ }>;
81
+ /**
82
+ * Check if features contain a specific rendition feature.
83
+ */
84
+ hasRenditionFeature(features: Feature[] | undefined, featureName: string): boolean;
85
+ /**
86
+ * Get the value of a rendition feature.
87
+ */
88
+ getRenditionFeatureValue(features: Feature[] | undefined, featureName: string): string | undefined;
89
+ /**
90
+ * Parse r_h-* hint override features.
91
+ * Format: "value" applies to all hints, or "@hintId1 hintId2:value" applies to specific hints.
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
+ }
@@ -0,0 +1,109 @@
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 { SpreadingEngine } from "./spreading-engine";
8
+ import { HintOverrides } from "./feature-resolver";
9
+ /**
10
+ * Hint renderer handles rendering of operation hints.
11
+ * Hints are visual counterparts of editing operations.
12
+ */
13
+ export declare class HintRenderer {
14
+ private _settings;
15
+ private _logger;
16
+ private _animationEngine;
17
+ private _boundsCache;
18
+ private _spreadingEngine;
19
+ constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache, spreadingEngine: SpreadingEngine);
20
+ /**
21
+ * Render a hint for an operation.
22
+ *
23
+ * @param hintId - ID of the hint from settings.hints
24
+ * @param hint - The hint configuration
25
+ * @param referenceNodes - Nodes referenced by the operation (for RBR calculation)
26
+ * @param rootSvg - Root SVG element to append hint to
27
+ * @param variables - Variables from r_hint-vars for placeholder resolution
28
+ * @param operationId - ID of the operation (for unique hint ID)
29
+ * @param hintOrdinal - Ordinal number of this hint for the operation (1, 2, 3...)
30
+ * @param allBaseNodes - All base text nodes (for displaced span)
31
+ * @param versionTag - Version tag to add as CSS class
32
+ * @param hintOverrides - Optional overrides from r_h-* features
33
+ * @param panZoomInstance - The svg-pan-zoom instance (for prolog)
34
+ * @param viewportWidth - Width of the visible viewport (for prolog)
35
+ * @param viewportHeight - Height of the visible viewport (for prolog)
36
+ * @returns Promise that resolves when rendering completes
37
+ */
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>;
39
+ /**
40
+ * Calculate Reference Bounding Rectangles (RBRs) from reference nodes.
41
+ * Nodes on different lines create separate RBRs.
42
+ */
43
+ private calculateRBRs;
44
+ /**
45
+ * Calculate RBRs from a displaced span reference (IDxN format).
46
+ */
47
+ private calculateDisplacedRBRs;
48
+ /**
49
+ * Calculate scaling information for the hint.
50
+ * Returns scale factors and target dimensions.
51
+ */
52
+ private calculateScalingInfo;
53
+ /**
54
+ * Apply size transforms (scale and rotation) to the hint.
55
+ * Per documentation, these are applied BEFORE positioning.
56
+ *
57
+ * IMPORTANT: We DON'T actually apply these as transforms on the element.
58
+ * Instead, we just return the scaling info and rotation, and later we'll create
59
+ * a combined transform that includes both sizing and positioning.
60
+ */
61
+ private applyHintSizeTransforms;
62
+ /**
63
+ * Apply complete transform to the hint (both sizing and positioning).
64
+ * This builds a single transform that:
65
+ * 1. Translates so the EBR alignment point is at origin
66
+ * 2. Scales and rotates the hint
67
+ * 3. Translates to the final RBR position
68
+ *
69
+ * Per documentation: hints use the handle's bounding box as EBR if a handle element exists,
70
+ * otherwise they use the whole hint's bounding box as EBR.
71
+ */
72
+ private applyHintPositionTransform;
73
+ /**
74
+ * Get the EBR (Element Bounding Rectangle) for positioning.
75
+ * Per documentation: if the hint has a handle element, use its bounding box.
76
+ * Otherwise, use the whole hint's bounding box.
77
+ */
78
+ private getEBRBounds;
79
+ /**
80
+ * Calculate the alignment point on the RBR based on position type.
81
+ * This is where the EBR's corresponding alignment point should be positioned.
82
+ */
83
+ private calculateRBRAlignmentPoint;
84
+ /**
85
+ * Calculate the alignment point on the EBR based on position type.
86
+ * This is the point on the EBR that should align with the RBR alignment point.
87
+ */
88
+ private calculateEBRAlignmentPoint;
89
+ /**
90
+ * Handle spreading for solid hints.
91
+ * @param versionTag - Version tag for tracking spreading history
92
+ */
93
+ private handleSpreading;
94
+ /**
95
+ * Apply r_h-* overrides to hint properties.
96
+ * Overrides can target specific hints or all hints ("*").
97
+ *
98
+ * @param hint - Original hint design
99
+ * @param hintId - ID of the hint being rendered
100
+ * @param hintOverrides - Map of overrides from r_h-* features
101
+ * @param allBaseNodes - All base nodes for displaced span resolution
102
+ * @returns Modified hint with overrides applied
103
+ */
104
+ private applyHintOverrides;
105
+ /**
106
+ * Update settings.
107
+ */
108
+ updateSettings(settings: GveRenditionSettings): void;
109
+ }
@@ -0,0 +1,98 @@
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
+ }
@@ -0,0 +1,112 @@
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
+ export declare function getTextWidth(text: string, fontFamily: string, fontSize: number, bold?: boolean, italic?: boolean): number;
105
+ /**
106
+ * Move an element to the back (lowest z-index in SVG).
107
+ */
108
+ export declare function moveToBack(element: SVGElement): void;
109
+ /**
110
+ * Move an element to the front (highest z-index in SVG).
111
+ */
112
+ export declare function moveToFront(element: SVGElement): void;