@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
package/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ License: Pending
2
+
3
+ This package is published for internal evaluation and staging use only.
4
+ A final open-source license will be added in a future release.
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # GVE Snapshot Rendition Component
2
+
3
+ This workspace contains a custom web component for the rendition of a complex Academic model representing the transformations of an autograph text. This peculiar document was written by the hand of the author, and contains a lot of often chaotic annotations on top of a base text. These annotations represent changes to the first draft of the text mostly by the hand of the author himself, thus providing a unique insight in the writer's creative process.
4
+
5
+ For the purpose of the visualization of the digital model designed to represent this text with all its variations together with its diplomatic data, we consider 3 entities to display:
6
+
7
+ - the base text, which is the starting point and the bearer of all the annotations.
8
+ - the added text. This is text added by operations like add or replace.
9
+ - all other signs: these are the visual counterparts of editing operations on the text, which hint at them in a graphical way. For instance, a line on top of a text meaning it should be deleted. There is no limit to the variety of these signs: they might be lines, shapes, callouts, boxes, etc.
10
+
11
+ Text (whether it is base or added text) is represented character by character; each character is named _node_, because in backend, where all the transformations happen, there is a graph-like structure which recombines the same characters to form different versions of the text, just like nodes are connected by edges in a graph.
12
+
13
+ The transformations are essentially represented by a set of editing operations (like delete, replace, add, move, swap) which are executed one after another starting with a base text. The base text is known as version 0 (tag=`v0`). All the operations are executed in their order and each outputs a new version of the text, progressively numbered (`v1`, `v2`...).
14
+
15
+ Operations also inject metadata, in form of features (essentially name=value pairs), either into versions as a whole (for global features), or into specific characters of the output text (node features). A specific set of features (rendition features, all starting with prefix `r_`) is used to represent the visual counterpart of each operation; for instance, a delete might be visually represented by a diagonal line on top of the portion of the text being deleted. In this case, multiple features of the operation (which injects them into nodes) are used to set the drawing connected to it, in this case a line, and specify additional parameters like its color. Such drawings are often recurring multiple times; so, they belong to a catalog of so-called "hints", because they hint at the operation with their appearance (e.g. a line stroke on a text hints at its deletion). These hints have entrance animations, handled by GSAP (like any other animations in this project). These too typically belong to a catalog of animations.
16
+
17
+ Both hints and animations are part of the settings for the component. The component is found under [src/core/gve-snapshot-rendition.ts](src/core/gve-snapshot-rendition.ts), and most of its logic is properly encapsulated in its own set of classes, following a systematic separation of concerns to ensure flexibility, extendibility, and easy maintenance.
18
+
19
+ ## Documentation
20
+
21
+ Conceptual documentation and sample data:
22
+
23
+ - [snapshot backend model](docs/snapshot.md): overview of the backend data used by the component.
24
+ - [rendition description](docs/rendition.md): details about the architecture and logic of this component.
25
+ - [sample request to backend snapshot processor](docs/sample/request.json): the request used to generate our sample data via backend. This is used only when we want to change our sample data.
26
+ - [sample response from backend snapshot processor](docs/sample/response.json): the response received from backend corresponding to our request. This is used only when we want to change our sample data.
27
+ - [data used in the demo](data.json): the data loaded in the web component to test it. This is copied from [response.json](docs/sample/response.json), and contains all the data received by the web component for rendering.
28
+ - [features adapter services](docs/adapter.md): complementary services independent from the GVE snapshot rendition component, possibly used to adapt data before passing it to the component.
29
+
30
+ The test page used in this project is `index.html` and its code is `consumer.js`. The data model is `CharChainResult` and it is found with all the imported models in `models.ts`. These are the models imported from another package and should not be touched.
31
+
32
+ ### Feature Adapter
33
+
34
+ The **Feature Adapter** is a utility system for transforming features in snapshot data. It enables you to adapt high-level features into low-level rendition features that the component can use:
35
+
36
+ - [Feature Adapter Overview](docs/adapter.md): Architecture and usage guide.
37
+ - [Detailed Documentation](src/adapter/README.md): Complete API reference and examples.
38
+
39
+ ### Hint Designer
40
+
41
+ The **Hint Designer** is a companion web component which can be used to help users edit and test their hints SVG and JS animation code. The main web component used for display has no relation with it. Rather, the hint designer component reuses some logic from the main component, while still being aside.
42
+
43
+ - [hint designer documentation](docs/hint-designer.md)
44
+ - [hint designer usage](src/hint-designer/README.md)
45
+
46
+ Use the npm script to start the designer:
47
+
48
+ ```bash
49
+ pnpm run start:designer
50
+ ```
51
+
52
+ This will build the component and open the hint designer in your browser.
53
+
54
+ ## Quick Start
55
+
56
+ To start working with this code:
57
+
58
+ 1. clone this repository.
59
+ 2. download dependencies with `pnpm i`.
60
+ 3. run with `pnpm start`.
61
+
62
+ Note: if you need to **update sample data**, follow these steps:
63
+
64
+ 1. open the GVE backend solution and run the demo.
65
+ 2. set text and operations as you want (to start with the current data, pick the "rendition features" preset).
66
+ 3. click the "build request" button.
67
+ 4. paste the request in [docs/sample/request.json](docs/sample/request.json) if you want to make it the default data.
68
+ 5. run the GVE backend API and use Postman or similar to send the request body with this header:
69
+
70
+ ```txt
71
+ POST http://localhost:5239/api/text/operations/run
72
+ Accept: application/json
73
+ Content-Type: application/json
74
+
75
+ ...paste your JSON request body here...
76
+ ```
77
+
78
+ 6. copy the response and paste it into [data.json](data.json) and also into [docs/sample/response.json](docs/sample/response.json) if you want to make it the default data.
79
+
80
+ ## Requirements
81
+
82
+ This component requires the following packages:
83
+
84
+ - [GSAP](https://gsap.com) for animations (`pnpm i gsap @types/gsap`).
85
+ - [svg-pan-zoom](https://github.com/bumbu/svg-pan-zoom) for zooming and panning (`pnpm i svg-pan-zoom @types/svg-pan-zoom`).
86
+ - [fast-diff](https://github.com/jhchen/fast-diff) for text diffing (`pnpm i fast-diff @types/fast-diff`).
87
+ - [feather-icons](https://github.com/feathericons/feather) for icons. See also the [icons list](https://feathericons.com) (`pnpm i feather-icons`).
88
+ - [highlight.js](https://highlightjs.org/) for the hint designer (syntax highlight for SVG and JS code; `pnpm i highlight.js`).
89
+
90
+ ## Task List
91
+
92
+ This is only a reminder.
93
+
94
+ - consider simplifying logic by drawing node features from tagged nodes rather than from steps.
95
+
96
+ ## Deployment
97
+
98
+ You must be logged into NPM with your account (verify with `npm whoami`, login with `npm login` if required).
99
+
100
+ 1. ensure that tests pass (`pnpm test`) and be sure to build (`pnpm build`).
101
+ 2. publish via `pnpm run publish:public` or directly via `npm publish --access=public`.
102
+
103
+ Check that your package is available:
104
+
105
+ ```bash
106
+ npm view @myrmidon/gve-snapshot-rendition
107
+ ```
108
+
109
+ Or visit: <https://www.npmjs.com/package/@myrmidon/gve-snapshot-rendition>
110
+
111
+ The following files/directories are included in the package (defined in `package.json` `files` field):
112
+
113
+ - `dist/` - Compiled JavaScript and TypeScript declarations
114
+ - `README.md` - Package documentation
115
+ - `LICENSE` - License file
116
+
117
+ The package includes these automated scripts:
118
+
119
+ - **prepublishOnly**: Runs before `npm publish` - executes tests and build
120
+ - **prepack**: Runs before creating a tarball - executes build
121
+ - **publish:public**: Custom script to publish with public access
122
+
123
+ To unpublish a specific version:
124
+
125
+ ```bash
126
+ npm unpublish @myrmidon/gve-snapshot-rendition@0.0.1
127
+ ```
128
+
129
+ To unpublish the entire package (only allowed within 72 hours):
130
+
131
+ ```bash
132
+ npm unpublish @myrmidon/gve-snapshot-rendition --force
133
+ ```
134
+
135
+ >⚠️ Unpublishing can break projects that depend on your package. Only do this for critical security issues or accidental publications.
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Models and types for the feature adapter system.
3
+ */
4
+ import { Feature } from "../models.js";
5
+ /**
6
+ * Comparison operator for feature matching.
7
+ */
8
+ export declare enum ComparisonOperator {
9
+ /** Equals (string) */
10
+ EQUALS = "=",
11
+ /** Not equals (string) */
12
+ NOT_EQUALS = "!=",
13
+ /** Starts with */
14
+ STARTS_WITH = "^=",
15
+ /** Ends with */
16
+ ENDS_WITH = "$=",
17
+ /** Contains */
18
+ CONTAINS = "*=",
19
+ /** Matches wildcards (? and *) */
20
+ MATCHES_WILDCARDS = "?=",
21
+ /** Matches regular expression */
22
+ MATCHES_REGEX = "~",
23
+ /** Numeric equals */
24
+ NUMERIC_EQUALS = "==",
25
+ /** Numeric not equals */
26
+ NUMERIC_NOT_EQUALS = "<>",
27
+ /** Numeric greater than */
28
+ NUMERIC_GT = ">",
29
+ /** Numeric less than */
30
+ NUMERIC_LT = "<",
31
+ /** Numeric greater than or equal */
32
+ NUMERIC_GTE = ">=",
33
+ /** Numeric less than or equal */
34
+ NUMERIC_LTE = "<="
35
+ }
36
+ /**
37
+ * Logical operator for combining clauses.
38
+ */
39
+ export declare enum LogicalOperator {
40
+ AND = "AND",
41
+ OR = "OR",
42
+ AND_NOT = "AND NOT",
43
+ OR_NOT = "OR NOT"
44
+ }
45
+ /**
46
+ * Token type for DSL parsing.
47
+ */
48
+ export declare enum TokenType {
49
+ /** Feature name */
50
+ NAME = 0,
51
+ /** Comparison operator */
52
+ OPERATOR = 1,
53
+ /** Value (quoted or unquoted) */
54
+ VALUE = 2,
55
+ /** Logical operator (AND, OR, AND NOT, OR NOT) */
56
+ LOGICAL = 3,
57
+ /** Left parenthesis */
58
+ LPAREN = 4,
59
+ /** Right parenthesis */
60
+ RPAREN = 5,
61
+ /** Left square bracket for group capture */
62
+ LBRACKET = 6,
63
+ /** Right square bracket for group capture */
64
+ RBRACKET = 7,
65
+ /** Colon (used in named groups) */
66
+ COLON = 8,
67
+ /** End of input */
68
+ EOF = 9
69
+ }
70
+ /**
71
+ * Token from DSL parsing.
72
+ */
73
+ export interface Token {
74
+ type: TokenType;
75
+ value: string;
76
+ position: number;
77
+ }
78
+ /**
79
+ * A single clause in a pattern (e.g., "name=value").
80
+ */
81
+ export interface Clause {
82
+ /** Feature name to match */
83
+ name: string;
84
+ /** Comparison operator (optional if just matching by name) */
85
+ operator?: ComparisonOperator;
86
+ /** Value to compare against (optional if just matching by name) */
87
+ value?: string;
88
+ /** Whether this clause should be captured as a group */
89
+ capture?: boolean;
90
+ /** Group name (if named capture), or undefined for numbered capture */
91
+ groupName?: string;
92
+ }
93
+ /**
94
+ * Pattern expression node (for AST representation).
95
+ */
96
+ export interface PatternExpression {
97
+ type: "clause" | "logical";
98
+ }
99
+ /**
100
+ * Clause expression node.
101
+ */
102
+ export interface ClauseExpression extends PatternExpression {
103
+ type: "clause";
104
+ clause: Clause;
105
+ }
106
+ /**
107
+ * Logical expression node (binary operation).
108
+ */
109
+ export interface LogicalExpression extends PatternExpression {
110
+ type: "logical";
111
+ operator: LogicalOperator;
112
+ left: PatternExpression;
113
+ right: PatternExpression;
114
+ }
115
+ /**
116
+ * Result of matching a pattern against features.
117
+ */
118
+ export interface MatchResult {
119
+ /** Whether the pattern matched */
120
+ matched: boolean;
121
+ /** Captured groups (keyed by group name or number as string) */
122
+ captures: Map<string, CapturedGroup>;
123
+ /** Features that were matched */
124
+ matchedFeatures: Feature[];
125
+ }
126
+ /**
127
+ * A captured group from pattern matching.
128
+ */
129
+ export interface CapturedGroup {
130
+ name: string;
131
+ value: string;
132
+ }
133
+ /**
134
+ * Mode for feature processing.
135
+ */
136
+ export declare enum ProcessingMode {
137
+ /** Add features without removing matched ones */
138
+ ADD = "add",
139
+ /** Replace: remove matched features, then add new ones */
140
+ REPLACE = "replace"
141
+ }
142
+ /**
143
+ * A single adapter operation configuration.
144
+ */
145
+ export interface AdapterOperation {
146
+ /** Pattern DSL string to match features */
147
+ pattern: string;
148
+ /** Features to add (with format "name=value", can include placeholders) */
149
+ features: string[];
150
+ /** Processing mode (default: add) */
151
+ mode?: ProcessingMode;
152
+ }
153
+ /**
154
+ * Configuration for the feature adapter.
155
+ */
156
+ export interface FeatureAdapterSettings {
157
+ /** List of adapter operations to apply in order */
158
+ operations: AdapterOperation[];
159
+ }
160
+ /**
161
+ * Error thrown during DSL parsing or pattern matching.
162
+ */
163
+ export declare class AdapterError extends Error {
164
+ position?: number | undefined;
165
+ context?: string | undefined;
166
+ constructor(message: string, position?: number | undefined, context?: string | undefined);
167
+ /**
168
+ * Format error message with context.
169
+ */
170
+ toString(): string;
171
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Data feature adapter for applying feature transformations to CharChainResult data.
3
+ */
4
+ import { CharChainResult } from "../models";
5
+ import { FeatureAdapterSettings } from "./adapter-models";
6
+ /**
7
+ * Adapter service that applies feature transformations to CharChainResult data.
8
+ * This service creates a copy of the data and adapts all features except those
9
+ * belonging to operation metadata.
10
+ */
11
+ export declare class DataFeatureAdapter {
12
+ private featureAdapter;
13
+ constructor(settings: FeatureAdapterSettings);
14
+ /**
15
+ * Adapt all features in the CharChainResult data.
16
+ * Returns a new copy of the data with adapted features.
17
+ *
18
+ * Features adapted:
19
+ * - steps[i].featureSet.features (global features)
20
+ * - steps[i].featureSet.nodeFeatures (node-specific features)
21
+ * - taggedNodes[version][i].features (features on nodes)
22
+ *
23
+ * Features NOT adapted:
24
+ * - steps[i].operation.features (operation metadata)
25
+ */
26
+ adaptData(data: CharChainResult): CharChainResult;
27
+ /**
28
+ * Deep copy the CharChainResult data structure.
29
+ */
30
+ private deepCopyData;
31
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Feature adapter service for transforming feature sets.
3
+ */
4
+ import { FeatureAdapterSettings } from "./adapter-models";
5
+ import { Feature } from "../models";
6
+ /**
7
+ * Service for adapting features based on configured operations.
8
+ */
9
+ export declare class FeatureAdapter {
10
+ private settings;
11
+ private compiledPatterns;
12
+ private matcher;
13
+ constructor(settings: FeatureAdapterSettings);
14
+ /**
15
+ * Adapt a feature array by applying all configured operations.
16
+ */
17
+ adapt(features: Feature[]): Feature[];
18
+ /**
19
+ * Apply a single operation to a feature array.
20
+ */
21
+ private applyOperation;
22
+ /**
23
+ * Create features from feature specifications, resolving placeholders.
24
+ */
25
+ private createFeatures;
26
+ /**
27
+ * Resolve placeholders in a string (e.g., $1.value, $color.name).
28
+ */
29
+ private resolvePlaceholders;
30
+ /**
31
+ * Pre-compile all patterns to detect errors early.
32
+ */
33
+ private compilePatterns;
34
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Feature adapter module - public API.
3
+ */
4
+ export { FeatureAdapter } from "./feature-adapter.js";
5
+ export { DataFeatureAdapter } from "./data-feature-adapter.js";
6
+ export type { FeatureAdapterSettings, AdapterOperation, ProcessingMode, ComparisonOperator, LogicalOperator, AdapterError, } from "./adapter-models.js";
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Feature matching engine for the adapter.
3
+ */
4
+ import { PatternExpression, MatchResult } from "./adapter-models";
5
+ import { Feature } from "../models";
6
+ /**
7
+ * Matches features against a pattern expression.
8
+ */
9
+ export declare class FeatureMatcher {
10
+ /**
11
+ * Match features against a parsed pattern expression.
12
+ */
13
+ match(features: Feature[], expression: PatternExpression): MatchResult;
14
+ /**
15
+ * Evaluate a pattern expression against features.
16
+ */
17
+ private evaluateExpression;
18
+ /**
19
+ * Evaluate a clause against features.
20
+ */
21
+ private evaluateClause;
22
+ /**
23
+ * Check if a single feature matches a clause.
24
+ */
25
+ private matchFeature;
26
+ /**
27
+ * Compare values using the specified operator.
28
+ */
29
+ private compareValues;
30
+ /**
31
+ * Match a value against a wildcard pattern (? and *).
32
+ */
33
+ private matchWildcard;
34
+ /**
35
+ * Compare numeric values.
36
+ */
37
+ private compareNumeric;
38
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Parser for the feature adapter DSL.
3
+ * Implements recursive descent parsing with operator precedence:
4
+ * 1. NOT (highest)
5
+ * 2. AND
6
+ * 3. OR (lowest)
7
+ */
8
+ import { PatternExpression } from "./adapter-models";
9
+ /**
10
+ * Parser for DSL patterns.
11
+ */
12
+ export declare class Parser {
13
+ private input;
14
+ private tokens;
15
+ private position;
16
+ private current;
17
+ private groupCounter;
18
+ constructor(input: string);
19
+ /**
20
+ * Parse the pattern and return the AST.
21
+ */
22
+ parse(): PatternExpression;
23
+ /**
24
+ * Parse OR expression (lowest precedence).
25
+ * or_expr := and_expr (OR and_expr | OR NOT and_expr)*
26
+ */
27
+ private parseOrExpression;
28
+ /**
29
+ * Parse AND expression (middle precedence).
30
+ * and_expr := primary (AND primary | AND NOT primary)*
31
+ */
32
+ private parseAndExpression;
33
+ /**
34
+ * Parse primary expression (clause or grouped expression).
35
+ * primary := clause | '(' or_expr ')' | '[' clause ']' | '[' NAME ':' clause ']'
36
+ */
37
+ private parsePrimary;
38
+ /**
39
+ * Parse a captured clause: [name:clause] or [clause]
40
+ */
41
+ private parseCapturedClause;
42
+ /**
43
+ * Parse a clause: name [operator value]
44
+ */
45
+ private parseClause;
46
+ /**
47
+ * Advance to the next token.
48
+ */
49
+ private advance;
50
+ /**
51
+ * Peek at the next token without consuming it.
52
+ */
53
+ private peek;
54
+ /**
55
+ * Get context around a position for error messages.
56
+ */
57
+ private getContext;
58
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Tokenizer for the feature adapter DSL.
3
+ */
4
+ import { Token } from "./adapter-models";
5
+ /**
6
+ * Tokenizes a DSL pattern string into tokens.
7
+ */
8
+ export declare class Tokenizer {
9
+ private input;
10
+ private position;
11
+ private current;
12
+ private expectValue;
13
+ constructor(input: string);
14
+ /**
15
+ * Tokenize the entire input.
16
+ */
17
+ tokenize(): Token[];
18
+ /**
19
+ * Get the next token from input.
20
+ */
21
+ private nextToken;
22
+ /**
23
+ * Try to read a comparison operator.
24
+ */
25
+ private tryReadOperator;
26
+ /**
27
+ * Read a quoted string (handles escape sequences).
28
+ */
29
+ private readQuotedString;
30
+ /**
31
+ * Read a word (name or keyword).
32
+ */
33
+ private readWord;
34
+ /**
35
+ * Read an unquoted value (after an operator).
36
+ * Values can include special characters like *, ?, ^, $, etc.
37
+ */
38
+ private readUnquotedValue;
39
+ /**
40
+ * Peek at the next word without consuming it.
41
+ */
42
+ private peekWord;
43
+ /**
44
+ * Skip whitespace.
45
+ */
46
+ private skipWhitespace;
47
+ /**
48
+ * Advance to next character.
49
+ */
50
+ private advance;
51
+ /**
52
+ * Get context around current position for error messages.
53
+ */
54
+ private getContext;
55
+ }
@@ -0,0 +1,118 @@
1
+ import { Logger } from "../core/logger";
2
+ import { AnimationFactory, AnimationFunction } from "./animation-factory";
3
+ /**
4
+ * Animation engine that wraps GSAP and provides a consistent API.
5
+ */
6
+ export declare class AnimationEngine {
7
+ private _gsap;
8
+ private _logger;
9
+ private _factory;
10
+ constructor(gsap: any, logger: Logger);
11
+ /**
12
+ * Get the animation factory.
13
+ */
14
+ getFactory(): AnimationFactory;
15
+ /**
16
+ * Animate an element with an animation function.
17
+ *
18
+ * @param element - The target SVG element
19
+ * @param animation - The animation function to execute
20
+ * @param rootElement - The root SVG element
21
+ * @returns Promise that resolves when animation completes
22
+ */
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
+ /**
38
+ * Fade in multiple elements (used for hilites).
39
+ *
40
+ * @param elements - Array of elements to fade in
41
+ * @param duration - Duration in milliseconds
42
+ * @returns Promise that resolves when animation completes
43
+ */
44
+ fadeIn(elements: SVGElement[], duration: number): Promise<void>;
45
+ /**
46
+ * Fade out multiple elements (used for hilites).
47
+ *
48
+ * @param elements - Array of elements to fade out
49
+ * @param duration - Duration in milliseconds
50
+ * @returns Promise that resolves when animation completes
51
+ */
52
+ fadeOut(elements: SVGElement[], duration: number): Promise<void>;
53
+ /**
54
+ * Animate pan and zoom transition.
55
+ *
56
+ * @param panZoomInstance - The svg-pan-zoom instance
57
+ * @param newPan - New pan coordinates {x, y}
58
+ * @param newZoom - New zoom level
59
+ * @param duration - Duration in milliseconds
60
+ * @returns Promise that resolves when animation completes
61
+ */
62
+ animatePanZoom(panZoomInstance: any, newPan: {
63
+ x: number;
64
+ y: number;
65
+ }, newZoom: number, duration: number): Promise<void>;
66
+ /**
67
+ * Animate prolog panning to make an element visible.
68
+ * This gracefully pans the viewport so there is room to display an element
69
+ * that would otherwise fall outside the visible area.
70
+ *
71
+ * @param panZoomInstance - The svg-pan-zoom instance
72
+ * @param elementBounds - Bounding rectangle of the element to make visible
73
+ * @param viewportWidth - Width of the visible viewport
74
+ * @param viewportHeight - Height of the visible viewport
75
+ * @param duration - Duration in milliseconds
76
+ * @returns Promise that resolves when animation completes
77
+ */
78
+ animateProlog(panZoomInstance: any, elementBounds: {
79
+ x: number;
80
+ y: number;
81
+ width: number;
82
+ height: number;
83
+ }, viewportWidth: number, viewportHeight: number, duration: number): Promise<void>;
84
+ /**
85
+ * Calculate the pan adjustment needed to make an element visible.
86
+ * Returns null if the element is already fully visible.
87
+ *
88
+ * @param elementBounds - Bounding rectangle of the element in SVG coordinates
89
+ * @param panZoomInstance - The svg-pan-zoom instance
90
+ * @param viewportWidth - Width of the visible viewport
91
+ * @param viewportHeight - Height of the visible viewport
92
+ * @returns New pan coordinates or null if no adjustment needed
93
+ */
94
+ private calculatePrologPan;
95
+ /**
96
+ * Check if an element is fully visible in the current viewport.
97
+ *
98
+ * @param elementBounds - Bounding rectangle of the element in SVG coordinates
99
+ * @param panZoomInstance - The svg-pan-zoom instance
100
+ * @param viewportWidth - Width of the visible viewport
101
+ * @param viewportHeight - Height of the visible viewport
102
+ * @returns True if element is fully visible, false otherwise
103
+ */
104
+ isElementVisible(elementBounds: {
105
+ x: number;
106
+ y: number;
107
+ width: number;
108
+ height: number;
109
+ }, panZoomInstance: any, viewportWidth: number, viewportHeight: number): boolean;
110
+ /**
111
+ * Kill all active animations.
112
+ */
113
+ killAll(): void;
114
+ /**
115
+ * Get the GSAP instance.
116
+ */
117
+ getGsap(): any;
118
+ }