@myrmidon/gve-snapshot-rendition 2.0.5 → 2.0.7

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 (59) 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 +72 -30
  4. package/dist/hint-designer/gve-hint-designer.d.ts +11 -1
  5. package/dist/index.cjs.min.js +7 -7
  6. package/dist/index.cjs.min.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +173 -81
  9. package/dist/index.js.map +1 -1
  10. package/dist/models.d.ts +21 -50
  11. package/dist/rendering/feature-resolver.d.ts +10 -10
  12. package/dist/rendering/hint-renderer.d.ts +9 -12
  13. package/dist/rendering/svg-utils.d.ts +38 -1
  14. package/dist/rendering/text-layout.d.ts +29 -4
  15. package/dist/rendering/text-renderer.d.ts +25 -14
  16. package/dist/settings/hint-models.d.ts +0 -5
  17. package/dist/settings/settings.d.ts +0 -4
  18. package/dist/ui/details-area.d.ts +31 -0
  19. package/dist/ui/hilites.d.ts +3 -9
  20. package/dist/ui/operation-summary-service.d.ts +4 -7
  21. package/dist/ui/toolbar.d.ts +10 -0
  22. package/dist/utils/feature-utils.d.ts +7 -3
  23. package/package.json +82 -73
  24. package/dist/rendering/spreading-engine.d.ts +0 -98
  25. package/dist/src/adapter/adapter-models.d.ts +0 -171
  26. package/dist/src/adapter/data-feature-adapter.d.ts +0 -30
  27. package/dist/src/adapter/feature-adapter.d.ts +0 -34
  28. package/dist/src/adapter/index.d.ts +0 -6
  29. package/dist/src/adapter/matcher.d.ts +0 -38
  30. package/dist/src/adapter/parser.d.ts +0 -58
  31. package/dist/src/adapter/tokenizer.d.ts +0 -55
  32. package/dist/src/animation/animation-engine.d.ts +0 -105
  33. package/dist/src/animation/animation-factory.d.ts +0 -49
  34. package/dist/src/core/color-palette.d.ts +0 -39
  35. package/dist/src/core/gve-snapshot-rendition.d.ts +0 -359
  36. package/dist/src/core/logger.d.ts +0 -37
  37. package/dist/src/hint-designer/gve-hint-designer.d.ts +0 -356
  38. package/dist/src/hint-designer/hint-designer-models.d.ts +0 -32
  39. package/dist/src/index.d.ts +0 -17
  40. package/dist/src/models.d.ts +0 -171
  41. package/dist/src/rendering/bounds-cache.d.ts +0 -62
  42. package/dist/src/rendering/feature-resolver.d.ts +0 -98
  43. package/dist/src/rendering/hint-renderer.d.ts +0 -103
  44. package/dist/src/rendering/svg-utils.d.ts +0 -133
  45. package/dist/src/rendering/text-layout.d.ts +0 -100
  46. package/dist/src/rendering/text-renderer.d.ts +0 -81
  47. package/dist/src/settings/hint-models.d.ts +0 -61
  48. package/dist/src/settings/settings.d.ts +0 -118
  49. package/dist/src/ui/details-area.d.ts +0 -112
  50. package/dist/src/ui/hilites.d.ts +0 -63
  51. package/dist/src/ui/operation-summary-service.d.ts +0 -73
  52. package/dist/src/ui/toolbar.d.ts +0 -141
  53. package/dist/src/ui/version-text-area.d.ts +0 -131
  54. package/dist/src/ui/versions-list-area.d.ts +0 -88
  55. package/dist/src/utils/color-palette.d.ts +0 -36
  56. package/dist/src/utils/feature-utils.d.ts +0 -80
  57. package/dist/src/utils/node-utils.d.ts +0 -47
  58. package/dist/src/utils/text-utils.d.ts +0 -35
  59. /package/dist/{src/layout → layout}/golden-layout-styles.d.ts +0 -0
@@ -1,105 +0,0 @@
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
- * Fade in multiple elements (used for hilites).
26
- *
27
- * @param elements - Array of elements to fade in
28
- * @param duration - Duration in milliseconds
29
- * @returns Promise that resolves when animation completes
30
- */
31
- fadeIn(elements: SVGElement[], duration: number): Promise<void>;
32
- /**
33
- * Fade out multiple elements (used for hilites).
34
- *
35
- * @param elements - Array of elements to fade out
36
- * @param duration - Duration in milliseconds
37
- * @returns Promise that resolves when animation completes
38
- */
39
- fadeOut(elements: SVGElement[], duration: number): Promise<void>;
40
- /**
41
- * Animate pan and zoom transition.
42
- *
43
- * @param panZoomInstance - The svg-pan-zoom instance
44
- * @param newPan - New pan coordinates {x, y}
45
- * @param newZoom - New zoom level
46
- * @param duration - Duration in milliseconds
47
- * @returns Promise that resolves when animation completes
48
- */
49
- animatePanZoom(panZoomInstance: any, newPan: {
50
- x: number;
51
- y: number;
52
- }, newZoom: number, duration: number): Promise<void>;
53
- /**
54
- * Animate prolog panning to make an element visible.
55
- * This gracefully pans the viewport so there is room to display an element
56
- * that would otherwise fall outside the visible area.
57
- *
58
- * @param panZoomInstance - The svg-pan-zoom instance
59
- * @param elementBounds - Bounding rectangle of the element to make visible
60
- * @param viewportWidth - Width of the visible viewport
61
- * @param viewportHeight - Height of the visible viewport
62
- * @param duration - Duration in milliseconds
63
- * @returns Promise that resolves when animation completes
64
- */
65
- animateProlog(panZoomInstance: any, elementBounds: {
66
- x: number;
67
- y: number;
68
- width: number;
69
- height: number;
70
- }, viewportWidth: number, viewportHeight: number, duration: number): Promise<void>;
71
- /**
72
- * Calculate the pan adjustment needed to make an element visible.
73
- * Returns null if the element is already fully visible.
74
- *
75
- * @param elementBounds - Bounding rectangle of the element in SVG coordinates
76
- * @param panZoomInstance - The svg-pan-zoom instance
77
- * @param viewportWidth - Width of the visible viewport
78
- * @param viewportHeight - Height of the visible viewport
79
- * @returns New pan coordinates or null if no adjustment needed
80
- */
81
- private calculatePrologPan;
82
- /**
83
- * Check if an element is fully visible in the current viewport.
84
- *
85
- * @param elementBounds - Bounding rectangle of the element in SVG coordinates
86
- * @param panZoomInstance - The svg-pan-zoom instance
87
- * @param viewportWidth - Width of the visible viewport
88
- * @param viewportHeight - Height of the visible viewport
89
- * @returns True if element is fully visible, false otherwise
90
- */
91
- isElementVisible(elementBounds: {
92
- x: number;
93
- y: number;
94
- width: number;
95
- height: number;
96
- }, panZoomInstance: any, viewportWidth: number, viewportHeight: number): boolean;
97
- /**
98
- * Kill all active animations.
99
- */
100
- killAll(): void;
101
- /**
102
- * Get the GSAP instance.
103
- */
104
- getGsap(): any;
105
- }
@@ -1,49 +0,0 @@
1
- import { Logger } from "../core/logger";
2
- /**
3
- * Animation function signature.
4
- * Receives gsap instance, target element, and root SVG element.
5
- * Returns a Promise that resolves when animation completes.
6
- */
7
- export type AnimationFunction = (gsap: any, targetEl: SVGElement, rootEl: SVGElement) => Promise<void>;
8
- /**
9
- * Factory for creating animation functions from code strings.
10
- * This wraps user-provided GSAP animation code into executable functions.
11
- */
12
- export declare class AnimationFactory {
13
- private _logger;
14
- private _gsap;
15
- constructor(gsap: any, logger: Logger);
16
- /**
17
- * Create an animation function from a code string.
18
- *
19
- * @param code - The JavaScript code as a string that uses GSAP
20
- * @param label - Optional label for debugging
21
- * @returns An animation function that returns a Promise
22
- */
23
- createAnimation(code: string, label?: string): AnimationFunction;
24
- /**
25
- * Create an animation function from an ID reference.
26
- * The ID should exist in the animations catalog.
27
- *
28
- * @param animationId - The ID of the animation (with or without # prefix)
29
- * @param animationsCatalog - The catalog of animations from settings
30
- * @param label - Optional label for debugging
31
- * @returns An animation function or undefined if not found
32
- */
33
- createAnimationFromId(animationId: string, animationsCatalog: Record<string, string>, label?: string): AnimationFunction | undefined;
34
- /**
35
- * Resolve an animation property value to an animation function.
36
- * Handles both direct code strings and ID references.
37
- *
38
- * @param animationValue - Either a code string or an ID reference (starting with #)
39
- * @param animationsCatalog - The catalog of animations from settings
40
- * @param label - Optional label for debugging
41
- * @returns An animation function or undefined
42
- */
43
- resolveAnimation(animationValue: string | undefined, animationsCatalog: Record<string, string>, label?: string): AnimationFunction | undefined;
44
- /**
45
- * Create a no-op animation that resolves immediately.
46
- * Used when no animation is specified.
47
- */
48
- createNoOpAnimation(): AnimationFunction;
49
- }
@@ -1,39 +0,0 @@
1
- /**
2
- * Generate a pastel color palette for version tags with maximum visual distinction.
3
- * Uses HSL color space to generate evenly distributed, light, pastel colors.
4
- */
5
- export declare class ColorPalette {
6
- private colors;
7
- /**
8
- * Generate a pastel color for a given version tag.
9
- * The color generation is idempotent - same version tag always generates the same color.
10
- * @param versionTag - Version tag (e.g., "v0", "v1", "v2")
11
- * @returns Pastel color as hex string (e.g., "#FFE4E1")
12
- */
13
- getColor(versionTag: string): string;
14
- /**
15
- * Extract version number from version tag.
16
- * @param versionTag - Version tag like "v0", "v1", etc.
17
- * @returns Version number
18
- */
19
- private extractVersionNumber;
20
- /**
21
- * Generate a pastel color using HSL color space with golden ratio distribution.
22
- * This ensures maximum visual distinction between colors.
23
- * @param index - Version index number
24
- * @returns Hex color string
25
- */
26
- private generatePastelColor;
27
- /**
28
- * Convert HSL to hex color.
29
- * @param h - Hue (0-360)
30
- * @param s - Saturation (0-100)
31
- * @param l - Lightness (0-100)
32
- * @returns Hex color string
33
- */
34
- private hslToHex;
35
- /**
36
- * Clear all cached colors.
37
- */
38
- clear(): void;
39
- }
@@ -1,359 +0,0 @@
1
- import { CharChainResult } from "../models";
2
- import { GveRenditionSettings } from "../settings/settings";
3
- /**
4
- * Relative position for elements (hints and additional text) with respect to the RBR.
5
- * Specifies how the EBR (Element Bounding Rectangle) aligns with the RBR (Reference Bounding Rectangle).
6
- */
7
- export type RelativePosition = "n" | "ne" | "e" | "se" | "s" | "sw" | "w" | "nw" | "inw" | "ine" | "isw" | "ise" | "o";
8
- /**
9
- * GVE Snapshot Rendition Web Component.
10
- * Renders interactive text transformations from snapshot model data.
11
- */
12
- export declare class GveSnapshotRendition extends HTMLElement {
13
- private _settings;
14
- private _data?;
15
- private _versionTag?;
16
- private _logger;
17
- private _animationEngine?;
18
- private _boundsCache;
19
- private _textRenderer?;
20
- private _hintRenderer?;
21
- private _featureResolver;
22
- private _shadow;
23
- private _rootSvg?;
24
- private _container?;
25
- private _toolbar?;
26
- private _versionTextArea?;
27
- private _detailsArea?;
28
- private _versionsListArea?;
29
- private _hilites?;
30
- private _panZoomInstance?;
31
- private _keyboardHandler?;
32
- private _goldenLayout?;
33
- private _versionsListEl?;
34
- private _svgContainerEl?;
35
- private _versionTextEl?;
36
- private _detailsEl?;
37
- /**
38
- * Get the library version.
39
- * This value is injected at build time via @rollup/plugin-replace
40
- * from package.json. It allows consumers to verify which version
41
- * of the web component is loaded.
42
- */
43
- static get version(): string;
44
- private _baseNodes;
45
- private _nodeMap;
46
- private _slideshowTimerId;
47
- private _currentVersion;
48
- private _currentVersionIndex;
49
- private _autoForwardEnabled;
50
- private _autoForwardTimerId;
51
- private _renderScheduled;
52
- constructor();
53
- /**
54
- * Observed attributes for the web component.
55
- */
56
- static get observedAttributes(): string[];
57
- /**
58
- * Called when component is added to the DOM.
59
- */
60
- connectedCallback(): void;
61
- /**
62
- * Called when component is removed from the DOM.
63
- */
64
- disconnectedCallback(): void;
65
- /**
66
- * Called when observed attributes change.
67
- */
68
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
69
- /**
70
- * Settings property (bindable).
71
- */
72
- get settings(): GveRenditionSettings;
73
- set settings(value: GveRenditionSettings);
74
- /**
75
- * Data property (bindable).
76
- */
77
- get data(): CharChainResult | undefined;
78
- set data(value: CharChainResult | undefined);
79
- /**
80
- * Version tag property (bindable).
81
- */
82
- get versionTag(): string | undefined;
83
- set versionTag(value: string | undefined);
84
- /**
85
- * Initialize GSAP when available.
86
- */
87
- private initializeGsap;
88
- /**
89
- * Process data to prepare for rendering.
90
- */
91
- private processData;
92
- /**
93
- * Render the component UI.
94
- */
95
- private render;
96
- /**
97
- * Wire up the drag-to-resize handle at the bottom of the component.
98
- * Dragging it adjusts the host element's inline height, which overrides
99
- * the --gve-height CSS variable while keeping GL's ResizeObserver in sync.
100
- */
101
- private setupBottomResizeHandle;
102
- /**
103
- * Initialize Golden Layout with the four resizable panels.
104
- * The SVG rendition panel has no header and acts as the fixed background.
105
- */
106
- private initializeGoldenLayout;
107
- /**
108
- * Default layout: mirrors the original Split.js arrangement.
109
- * Column:
110
- * Row (60 %): VersionsList (15 %) | TextRendition (85 %, no header)
111
- * Row (40 %): VersionText (60 %) | Details (40 %)
112
- */
113
- private getDefaultLayout;
114
- /**
115
- * Reset layout to default panel sizes by reloading the default config.
116
- */
117
- resetLayout(): void;
118
- /**
119
- * Coalesce concurrent render requests into a single call.
120
- * Multiple same-turn invocations (e.g. settings setter + data setter both
121
- * firing in the same Angular expression) collapse into one microtask render,
122
- * always running after all synchronous assignments have completed so the
123
- * latest data is used.
124
- */
125
- private scheduleRenderContent;
126
- /**
127
- * Render content (base text only - starts at v0).
128
- * Use goToVersionIndex() to navigate to specific versions.
129
- */
130
- private renderContent;
131
- /**
132
- * Initialize pan/zoom functionality on the SVG element.
133
- * Enables mouse wheel zoom, click-and-drag pan, with configurable limits.
134
- */
135
- private initializePanZoom;
136
- /**
137
- * Process a single operation step.
138
- */
139
- private processOperation;
140
- /**
141
- * Internal operation processing (called with pan/zoom disabled).
142
- */
143
- private processOperationInternal;
144
- /**
145
- * Get reference nodes for an operation from the flat node map.
146
- * All nodes (including deleted ones) are always present in the map.
147
- *
148
- * @param nodeIds - Array of node IDs from step.refNodeIds
149
- * @param inputTag - Kept for API compatibility; unused in new model
150
- * @returns Array of CharNode objects matching the IDs
151
- */
152
- private getReferenceNodes;
153
- /**
154
- * Get nodes added by a specific operation.
155
- * Nodes added by an operation carry an `opid` feature in their per-version
156
- * features for the output tag.
157
- *
158
- * @param operationId - The operation ID to match
159
- * @param outputTag - The output version tag (e.g., "v3") where the nodes were added
160
- * @returns Array of nodes added by this operation
161
- */
162
- private getAddedNodes;
163
- /**
164
- * Render hints for an operation.
165
- */
166
- private renderHints;
167
- /**
168
- * Navigate to a specific version index (0 = base text, 1+ = after operations).
169
- * Uses accumulation model: forward adds elements, backward removes them.
170
- */
171
- private goToVersionIndex;
172
- /**
173
- * Update the version text area with the current version's text.
174
- * @param versionIndex - The version index (0 = base text)
175
- */
176
- private updateVersionText;
177
- /**
178
- * Update the details area with the current version's information.
179
- * @param versionIndex - The version index (0 = base text)
180
- */
181
- private updateDetailsArea;
182
- /**
183
- * Set up hover listeners on all text elements to update details area.
184
- */
185
- private setupTextElementHoverListeners;
186
- /**
187
- * Get the node from the node map by its SVG element ID.
188
- * Returns the node and the version tag at which to read its features.
189
- */
190
- private getNodeForElement;
191
- /**
192
- * Handle hover over a text element.
193
- */
194
- private handleTextElementHover;
195
- /**
196
- * Handle leaving a text element.
197
- */
198
- private handleTextElementLeave;
199
- /**
200
- * Handle click on a text element (for pinning).
201
- */
202
- private handleTextElementClick;
203
- /**
204
- * Navigate forward by processing operations one by one.
205
- * Each operation adds hints and/or text that persist for all future versions.
206
- */
207
- private navigateForward;
208
- /**
209
- * Navigate backward by removing elements added in later versions.
210
- * Reverses operations from current down to target.
211
- */
212
- private navigateBackward;
213
- /**
214
- * Remove all elements belonging to a specific version.
215
- * Optionally fades them out before removal based on settings.
216
- */
217
- private removeVersionElements;
218
- /**
219
- * Extract char offsets from first operation if it's an annotate.
220
- */
221
- private extractCharOffsets;
222
- /**
223
- * Extract per-node rendition configs from the first operation if it's an annotate.
224
- * This allows init features like r_font-size, r_fore-color, etc. to override
225
- * the component-wide settings for specific base text nodes.
226
- */
227
- private extractInitNodeConfigs;
228
- /**
229
- * Zoom in by configured step amount.
230
- */
231
- zoomIn(): void;
232
- /**
233
- * Zoom out by configured step amount.
234
- */
235
- zoomOut(): void;
236
- /**
237
- * Reset zoom to 100% and center pan.
238
- */
239
- resetZoom(): void;
240
- /**
241
- * Set zoom to specific level (1.0 = 100%).
242
- */
243
- setZoom(zoomLevel: number): void;
244
- /**
245
- * Get current zoom level.
246
- */
247
- getZoom(): number;
248
- /**
249
- * Update toolbar with current zoom level.
250
- */
251
- private updateToolbarZoom;
252
- /**
253
- * Handle toolbar navigation actions.
254
- */
255
- private handleToolbarNavigation;
256
- /**
257
- * Returns true when the given version tag is a staged version.
258
- * Checks globalFeatures (from new API) for a "version" feature.
259
- */
260
- private isStagedVersion;
261
- /**
262
- * Navigate to previous staged version.
263
- */
264
- private goToPrevStagedVersion;
265
- /**
266
- * Navigate to next staged version.
267
- */
268
- private goToNextStagedVersion;
269
- /**
270
- * Handle toolbar slideshow actions.
271
- */
272
- private handleToolbarSlideshow;
273
- /**
274
- * Handle toolbar display actions.
275
- */
276
- private handleToolbarDisplay;
277
- /**
278
- * Fit SVG to view (center and zoom to fit all content).
279
- */
280
- private fitToView;
281
- /**
282
- * Download SVG as a file.
283
- */
284
- private downloadSVG;
285
- /**
286
- * Start slideshow mode.
287
- */
288
- private startSlideshow;
289
- /**
290
- * Stop slideshow mode.
291
- */
292
- private stopSlideshow;
293
- /**
294
- * Advance slideshow by one frame.
295
- */
296
- private slideshowAdvance;
297
- /**
298
- * Check if the current version belongs to a group and trigger auto-forward if needed.
299
- * Auto-forward continues to the next version after a delay, as long as operations
300
- * share the same groupId.
301
- *
302
- * @param versionIndex - The current version index (just navigated to)
303
- */
304
- private checkAndTriggerAutoForward;
305
- /**
306
- * Stop any pending auto-forward timer.
307
- */
308
- private stopAutoForward;
309
- /**
310
- * Toggle auto-forward on group feature.
311
- * @param enabled - Whether to enable auto-forward
312
- */
313
- setAutoForwardEnabled(enabled: boolean): void;
314
- /**
315
- * Get current auto-forward enabled state.
316
- */
317
- getAutoForwardEnabled(): boolean;
318
- /**
319
- * Setup keyboard shortcuts for navigation and zoom.
320
- * Shortcuts:
321
- * - ArrowLeft/ArrowRight: Previous/Next version
322
- * - Home/End: First/Last version
323
- * - 0-9: Jump to version 0-9
324
- * - +/-: Zoom in/out
325
- */
326
- private setupKeyboardShortcuts;
327
- /**
328
- * Get the SVG element where content should be appended.
329
- * When pan/zoom is active, returns the transformed viewport group.
330
- * When pan/zoom is inactive, returns the root SVG.
331
- *
332
- * CRITICAL: svg-pan-zoom wraps content in a <g> element. New elements
333
- * must be added to this group, not the root SVG, or they won't transform.
334
- */
335
- private getSvgContainer;
336
- /**
337
- * Temporarily disable pan/zoom for rendering operations.
338
- * CRITICAL: Disables user input but preserves viewport transform.
339
- */
340
- private disablePanZoom;
341
- /**
342
- * Re-enable pan/zoom after rendering operations complete.
343
- */
344
- private enablePanZoom;
345
- /**
346
- * Navigate to a specific version by tag.
347
- * @param versionTag - Version tag (e.g., "v0", "v1")
348
- */
349
- private navigateToVersion;
350
- /**
351
- * Toggle hilites for a specific version.
352
- * @param versionTag - Version tag to hilite, or null to clear hilites
353
- */
354
- private toggleHilites;
355
- /**
356
- * Get component styles (includes inlined GL CSS for Shadow DOM compatibility).
357
- */
358
- private getStyles;
359
- }
@@ -1,37 +0,0 @@
1
- /**
2
- * Logger utility for diagnostic output.
3
- * Logging is controlled by the debug setting in component settings.
4
- */
5
- export declare class Logger {
6
- private _enabled;
7
- private _prefix;
8
- constructor(prefix?: string, enabled?: boolean);
9
- /**
10
- * Enable or disable logging.
11
- */
12
- setEnabled(enabled: boolean): void;
13
- /**
14
- * Log an informational message.
15
- */
16
- info(message: string, ...args: any[]): void;
17
- /**
18
- * Log a warning message.
19
- */
20
- warn(message: string, ...args: any[]): void;
21
- /**
22
- * Log an error message (always logged, regardless of debug setting).
23
- */
24
- error(message: string, ...args: any[]): void;
25
- /**
26
- * Log a debug message with detailed context.
27
- */
28
- debug(category: string, message: string, data?: any): void;
29
- /**
30
- * Time a block of code execution.
31
- */
32
- time(label: string): void;
33
- /**
34
- * End timing a block of code.
35
- */
36
- timeEnd(label: string): void;
37
- }