@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
package/dist/models.d.ts CHANGED
@@ -91,78 +91,49 @@ export interface CharNode {
91
91
  label: string;
92
92
  data: string;
93
93
  sourceTag?: string;
94
- features?: Feature[];
94
+ /** Features keyed by version tag (e.g. "v1" → feature list). */
95
+ features?: Record<string, Feature[]>;
95
96
  }
96
97
  /**
97
98
  * Execution step of a char-based chain operation.
98
99
  */
99
100
  export interface ChainOperationContextStep {
100
- /**
101
- * The operation that was executed.
102
- */
101
+ /** The operation that was executed. */
103
102
  operation: CharChainOperation;
104
- /**
105
- * The input version tag.
106
- */
103
+ /** The input version tag. */
107
104
  inputTag: string;
108
- /**
109
- * The output version tag.
110
- */
105
+ /** The output version tag. */
111
106
  outputTag: string;
112
- /**
113
- * The string synthetically representing the resulting text
114
- * version.
115
- */
107
+ /** The string synthetically representing the resulting text version. */
116
108
  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
- */
109
+ /** The reference node IDs of the operation which was executed. */
132
110
  refNodeIds: number[];
133
111
  }
134
112
  /**
135
113
  * Result of execution of a char-based chain.
136
114
  */
137
115
  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
- */
116
+ /** The execution steps of the chain. */
147
117
  steps: ChainOperationContextStep[];
118
+ /** The chain dump, which is the text representation of the chain. */
119
+ chainDump: string | null;
120
+ /** The list of all unique tags in the chain, including v0. */
121
+ chainTags: string[];
148
122
  /**
149
- * The chain dump, which is the text representation of the chain.
123
+ * All character nodes in the chain (base text and added nodes).
124
+ * Node features are keyed by version tag.
150
125
  */
151
- chainDump: string;
126
+ nodes: CharNode[];
152
127
  /**
153
- * The list of all unique tags in the chain.
128
+ * IDs of nodes forming each version's text, keyed by version tag.
129
+ * Includes v0 (base text).
154
130
  */
155
- chainTags: string[];
131
+ versionNodeIds: Record<string, number[]>;
156
132
  /**
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.
133
+ * Global features accumulated up to each version, keyed by version tag.
134
+ * Includes v0 (empty list).
162
135
  */
163
- taggedNodes: {
164
- [key: string]: CharNode[];
165
- };
136
+ globalFeatures: Record<string, OperationFeature[]>;
166
137
  }
167
138
  /**
168
139
  * The input and output tags of a char-based chain operation.
@@ -1,4 +1,4 @@
1
- import { Feature, OperationFeature } from "../models";
1
+ import { Feature, CharNode } from "../models";
2
2
  import { GveRenditionSettings } from "../settings/settings";
3
3
  import { Logger } from "../core/logger";
4
4
  /**
@@ -11,7 +11,6 @@ export interface HintOverrides {
11
11
  scaleX?: string;
12
12
  scaleY?: string;
13
13
  rotation?: string;
14
- solid?: boolean;
15
14
  displacedSpan?: {
16
15
  nodeId: number;
17
16
  count: number;
@@ -36,14 +35,13 @@ export interface RenditionConfig {
36
35
  textPosition?: string;
37
36
  textOffsetX: number | string;
38
37
  textOffsetY: number | string;
39
- textSolid?: boolean;
40
38
  textDisplacedSpan?: {
41
39
  nodeId: number;
42
40
  count: number;
43
41
  };
44
42
  textValue?: string;
45
43
  hints?: string[];
46
- hintOverrides?: Map<string, HintOverrides>;
44
+ hintOverrides?: Map<string | number, HintOverrides>;
47
45
  hintVars?: Map<string, string>;
48
46
  }
49
47
  /**
@@ -64,9 +62,8 @@ export declare class FeatureResolver {
64
62
  * @returns Resolved rendition configuration
65
63
  */
66
64
  resolve(baseSettings: GveRenditionSettings, features: Feature[] | undefined, nodeFeatureContext?: {
67
- nodeFeatures: Record<string, OperationFeature[]>;
65
+ refNodes: CharNode[];
68
66
  outputTag: string;
69
- refNodeIds: number[];
70
67
  }): RenditionConfig;
71
68
  /**
72
69
  * Extract character offsets from init features.
@@ -89,7 +86,9 @@ export declare class FeatureResolver {
89
86
  getRenditionFeatureValue(features: Feature[] | undefined, featureName: string): string | undefined;
90
87
  /**
91
88
  * Parse r_h-* hint override features.
92
- * Format: "value" applies to all hints, or "@hintId1 hintId2:value" applies to specific hints.
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.
93
92
  *
94
93
  * @param featureName - The feature name (e.g., "r_h-position")
95
94
  * @param value - The feature value
@@ -4,7 +4,6 @@ import { OperationHint } from "../settings/hint-models";
4
4
  import { Logger } from "../core/logger";
5
5
  import { AnimationEngine } from "../animation/animation-engine";
6
6
  import { BoundsCache } from "./bounds-cache";
7
- import { SpreadingEngine } from "./spreading-engine";
8
7
  import { HintOverrides } from "./feature-resolver";
9
8
  /**
10
9
  * Hint renderer handles rendering of operation hints.
@@ -15,8 +14,7 @@ export declare class HintRenderer {
15
14
  private _logger;
16
15
  private _animationEngine;
17
16
  private _boundsCache;
18
- private _spreadingEngine;
19
- constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache, spreadingEngine: SpreadingEngine);
17
+ constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache);
20
18
  /**
21
19
  * Render a hint for an operation.
22
20
  *
@@ -35,7 +33,7 @@ export declare class HintRenderer {
35
33
  * @param viewportHeight - Height of the visible viewport (for prolog)
36
34
  * @returns Promise that resolves when rendering completes
37
35
  */
38
- renderHint(hintId: string, hint: OperationHint, referenceNodes: CharNode[], rootSvg: SVGElement, variables: Map<string, string>, operationId: string, hintOrdinal: number, allBaseNodes: CharNode[], versionTag: string, hintOverrides?: Map<string, HintOverrides>, panZoomInstance?: any, viewportWidth?: number, viewportHeight?: number): Promise<void>;
36
+ renderHint(hintId: string, hint: OperationHint, referenceNodes: CharNode[], rootSvg: SVGElement, variables: Map<string, string>, operationId: string, hintOrdinal: number, allBaseNodes: CharNode[], versionTag: string, hintOverrides?: Map<string | number, HintOverrides>, panZoomInstance?: any, viewportWidth?: number, viewportHeight?: number): Promise<void>;
39
37
  /**
40
38
  * Calculate Reference Bounding Rectangles (RBRs) from reference nodes.
41
39
  * Nodes on different lines create separate RBRs.
@@ -86,18 +84,14 @@ export declare class HintRenderer {
86
84
  * This is the point on the EBR that should align with the RBR alignment point.
87
85
  */
88
86
  private calculateEBRAlignmentPoint;
89
- /**
90
- * Handle spreading for solid hints.
91
- * @param versionTag - Version tag for tracking spreading history
92
- */
93
- private handleSpreading;
94
87
  /**
95
88
  * Apply r_h-* overrides to hint properties.
96
- * Overrides can target specific hints or all hints ("*").
89
+ * Priority (lowest to highest): wildcard ("*") < key-based < ordinal-based.
97
90
  *
98
91
  * @param hint - Original hint design
99
- * @param hintId - ID of the hint being rendered
100
- * @param hintOverrides - Map of overrides from r_h-* features
92
+ * @param hintId - ID (key) of the hint being rendered
93
+ * @param hintOrdinal - 1-based ordinal position of this hint within the operation
94
+ * @param hintOverrides - Map of overrides from r_h-* features (keyed by ID string or ordinal number)
101
95
  * @param allBaseNodes - All base nodes for displaced span resolution
102
96
  * @returns Modified hint with overrides applied
103
97
  */
@@ -1,6 +1,7 @@
1
1
  import { CharNode } from "../models";
2
2
  import { GveRenditionSettings } from "../settings/settings";
3
3
  import { Logger } from "../core/logger";
4
+ import { RenditionConfig } from "./feature-resolver";
4
5
  /**
5
6
  * Position information for a character node.
6
7
  */
@@ -58,7 +59,7 @@ export declare class TextLayout {
58
59
  calculateBaseTextPositions(nodes: CharNode[], charOffsets?: Map<number, {
59
60
  x?: number | string;
60
61
  y?: number | string;
61
- }>): CharPosition[];
62
+ }>, nodeConfigs?: Map<number, RenditionConfig>): CharPosition[];
62
63
  /**
63
64
  * Calculate position for a single additional text node.
64
65
  * Additional text positioning is driven by rendition features.
@@ -3,7 +3,6 @@ import { GveRenditionSettings } from "../settings/settings";
3
3
  import { Logger } from "../core/logger";
4
4
  import { AnimationEngine } from "../animation/animation-engine";
5
5
  import { BoundsCache } from "./bounds-cache";
6
- import { SpreadingEngine } from "./spreading-engine";
7
6
  import { RenditionConfig } from "./feature-resolver";
8
7
  /**
9
8
  * Text renderer handles rendering of base text and additional text.
@@ -13,9 +12,7 @@ export declare class TextRenderer {
13
12
  private _logger;
14
13
  private _animationEngine;
15
14
  private _boundsCache;
16
- private _spreadingEngine;
17
15
  private _textLayout;
18
- private _featureResolver;
19
16
  /**
20
17
  * Reference to the root SVG element for text width measurements.
21
18
  * This ensures measurements happen in the same CSS context as rendering,
@@ -23,7 +20,7 @@ export declare class TextRenderer {
23
20
  * that apply global CSS styles to document.body.
24
21
  */
25
22
  private _measurementRoot?;
26
- constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache, spreadingEngine: SpreadingEngine);
23
+ constructor(settings: GveRenditionSettings, logger: Logger, animationEngine: AnimationEngine, boundsCache: BoundsCache);
27
24
  /**
28
25
  * Render base text (v0).
29
26
  *
@@ -35,7 +32,7 @@ export declare class TextRenderer {
35
32
  renderBaseText(nodes: CharNode[], rootSvg: SVGElement, charOffsets?: Map<number, {
36
33
  x?: number | string;
37
34
  y?: number | string;
38
- }>): Promise<void>;
35
+ }>, nodeConfigs?: Map<number, RenditionConfig>): Promise<void>;
39
36
  /**
40
37
  * Render a single character node.
41
38
  */
@@ -58,21 +55,25 @@ export declare class TextRenderer {
58
55
  /**
59
56
  * Calculate positions for additional text characters.
60
57
  * Additional text flows left to right from the base position.
58
+ * When config is provided its font metrics are used for character width
59
+ * measurement, matching what applyTextStyle will actually render.
61
60
  */
62
61
  private calculateAdditionalTextPositions;
63
62
  /**
64
- * Calculate RBRs from reference nodes.
65
- * Nodes on different lines create separate RBRs.
63
+ * Calculate the RBR anchor point for a given position type.
64
+ * This is the point on the RBR where the corresponding EBR point will land.
66
65
  */
67
- private calculateRBRs;
66
+ private calculateRBRAlignmentPoint;
68
67
  /**
69
- * Calculate target position on the RBR based on position type.
68
+ * Calculate the EBR anchor point for a given position type.
69
+ * This is the point on the EBR that should coincide with the RBR anchor point.
70
70
  */
71
- private calculateTargetPosition;
71
+ private calculateEBRAlignmentPoint;
72
72
  /**
73
- * Calculate bounding rectangle for a set of positioned characters.
73
+ * Calculate RBRs from reference nodes.
74
+ * Nodes on different lines create separate RBRs.
74
75
  */
75
- private calculateTextBounds;
76
+ private calculateRBRs;
76
77
  /**
77
78
  * Update settings.
78
79
  */
@@ -46,11 +46,6 @@ export interface OperationHint {
46
46
  * Rotation is applied with reference to the origin of the reference bounding rectangle.
47
47
  */
48
48
  rotation: number;
49
- /**
50
- * Whether this hint is "solid" and requires spreading.
51
- * Default: false (most hints are overlays that don't need spreading)
52
- */
53
- solid?: boolean;
54
49
  /**
55
50
  * JS code for animating the hint's entrance via GSAP.
56
51
  * If it starts with "#", it references an animation from settings.animations.
@@ -78,8 +78,6 @@ export interface GveRenditionSettings {
78
78
  animations: Record<string, string>;
79
79
  /** ID of animation to use for each character (from animations catalog) */
80
80
  charAnimationId?: string;
81
- /** Duration in milliseconds for spreading animation (0=no animation) */
82
- spreadTime: number;
83
81
  /** Duration in milliseconds for element fade-out animation
84
82
  * (backward navigation only): 0=no animation */
85
83
  backwardFadeOutTime: number;
@@ -88,8 +86,6 @@ export interface GveRenditionSettings {
88
86
  prologDuration: number;
89
87
  /** Dictionary of hints, keyed by hint ID */
90
88
  hints: Record<string, OperationHint>;
91
- /** Margin around each rendered hint in pixels */
92
- hintMargin: number;
93
89
  /** Design-time width used when creating hints */
94
90
  hintDesignWidth: number;
95
91
  /** Design-time height used when creating hints */
@@ -71,6 +71,7 @@ export declare class DetailsArea {
71
71
  updateHoveredElements(hoveredElements: Array<{
72
72
  element: SVGTextElement;
73
73
  node: CharNode;
74
+ versionTag: string;
74
75
  }>): void;
75
76
  /**
76
77
  * Render hovered elements with pin button.
@@ -83,7 +84,7 @@ export declare class DetailsArea {
83
84
  /**
84
85
  * Pin a specific element (triggered by click).
85
86
  */
86
- pinElement(element: SVGTextElement, node: CharNode): void;
87
+ pinElement(element: SVGTextElement, node: CharNode, versionTag: string): void;
87
88
  /**
88
89
  * Filter features based on hidden features setting.
89
90
  */
@@ -1,5 +1,4 @@
1
1
  import { Logger } from "../core/logger";
2
- import { CharChainResult } from "../models";
3
2
  /**
4
3
  * Hilites manager - handles creating and animating hilite rectangles.
5
4
  */
@@ -21,20 +20,15 @@ export declare class Hilites {
21
20
  updateSettings(hilitePadding: number, hiliteFadeTime: number): void;
22
21
  /**
23
22
  * Show hilites for a specific version.
24
- * @param data - The CharChainResult data
25
- * @param versionTag - Version tag to hilite
23
+ * @param nodeIds - IDs of nodes to hilite (from versionNodeIds[versionTag])
24
+ * @param versionTag - Version tag label (for logging)
26
25
  * @param color - Hilite color
27
26
  */
28
- showHilites(data: CharChainResult, versionTag: string, color: string): Promise<void>;
27
+ showHilites(nodeIds: number[], versionTag: string, color: string): Promise<void>;
29
28
  /**
30
29
  * Clear all hilites.
31
30
  */
32
31
  clearHilites(): Promise<void>;
33
- /**
34
- * Get node IDs for a specific version.
35
- * For v0, if not found in taggedNodes, falls back to extracting from base text.
36
- */
37
- private getVersionNodeIds;
38
32
  /**
39
33
  * Create a hilite rectangle for a text element.
40
34
  *
@@ -32,17 +32,14 @@ export declare class OperationSummaryService {
32
32
  */
33
33
  getNodeText(nodeId: number, versionTag: string): string;
34
34
  /**
35
- * Get a node by ID, searching in version tagged nodes.
36
- *
37
- * Searches backwards from the specified version to v0. Since v0 is normalized
38
- * and added to taggedNodes by the component during data processing, no special
39
- * handling is needed.
35
+ * Get a node by ID from the flat nodes array.
36
+ * All nodes (including deleted ones) are always present.
40
37
  *
41
38
  * @param nodeId - Node ID
42
- * @param versionTag - Version tag to search in (searches backwards if not found)
39
+ * @param versionTag - Unused in new model; kept for API compatibility
43
40
  * @returns The node, or null
44
41
  */
45
- getNode(nodeId: number, versionTag: string): CharNode | null;
42
+ getNode(nodeId: number, versionTag?: string): CharNode | null;
46
43
  /**
47
44
  * Get text from a span of nodes.
48
45
  * @param nodeIds - Array of node IDs
package/package.json CHANGED
@@ -1,73 +1,82 @@
1
- {
2
- "name": "@myrmidon/gve-snapshot-rendition",
3
- "version": "2.0.4",
4
- "homepage": "https://github.com/vedph/gve-snapshot-rendition",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/vedph/gve-snapshot-rendition"
8
- },
9
- "author": "Daniele Fusi",
10
- "license": "",
11
- "description": "Web components for rendering interactive text transformations with hint designer. This package is an early version published for internal evaluation and staging use only. A final open-source license will be published later.",
12
- "keywords": [
13
- "snapshot",
14
- "rendition",
15
- "VEdition",
16
- "genetic-philology",
17
- "hint-designer",
18
- "text-transformation"
19
- ],
20
- "main": "./dist/index.js",
21
- "type": "module",
22
- "types": "./dist/index.d.ts",
23
- "exports": {
24
- ".": {
25
- "import": "./dist/index.js",
26
- "types": "./dist/index.d.ts"
27
- }
28
- },
29
- "files": [
30
- "dist",
31
- "README.md",
32
- "LICENSE"
33
- ],
34
- "dependencies": {
35
- "fast-diff": "^1.3.0",
36
- "feather-icons": "^4.29.2",
37
- "golden-layout": "^2.6.0",
38
- "gsap": "^3.15.0",
39
- "highlight.js": "^11.11.1",
40
- "svg-pan-zoom": "^3.6.2",
41
- "tslib": "^2.8.1",
42
- "typescript": "^6.0.3"
43
- },
44
- "devDependencies": {
45
- "@rollup/plugin-commonjs": "^29.0.2",
46
- "@rollup/plugin-node-resolve": "^16.0.3",
47
- "@rollup/plugin-replace": "^6.0.3",
48
- "@rollup/plugin-terser": "^1.0.0",
49
- "@rollup/plugin-typescript": "^12.3.0",
50
- "@vitest/ui": "^4.1.6",
51
- "concurrency": "^0.1.4",
52
- "concurrently": "^9.2.1",
53
- "lite-server": "^2.6.1",
54
- "rollup": "^4.60.3",
55
- "source-map-loader": "^5.0.0",
56
- "ts-loader": "^9.5.7",
57
- "typescript": "^6.0.3",
58
- "vitest": "^4.1.6"
59
- },
60
- "optionalDependencies": {
61
- "@rollup/rollup-win32-arm64-msvc": "^4.60.3"
62
- },
63
- "scripts": {
64
- "build": "rollup -c",
65
- "watch": "rollup -c -w",
66
- "start": "concurrently \"rollup -c -w\" \"lite-server\"",
67
- "start:designer": "concurrently \"rollup -c -w\" \"lite-server -c bs-config.designer.json\"",
68
- "test": "vitest run",
69
- "test:watch": "vitest",
70
- "test-ui": "vitest --ui",
71
- "publish:public": "npm publish --access=public"
72
- }
73
- }
1
+ {
2
+ "name": "@myrmidon/gve-snapshot-rendition",
3
+ "version": "2.0.6",
4
+ "homepage": "https://github.com/vedph/gve-snapshot-rendition",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/vedph/gve-snapshot-rendition"
8
+ },
9
+ "author": "Daniele Fusi",
10
+ "license": "",
11
+ "description": "Web components for rendering interactive text transformations with hint designer. This package is an early version published for internal evaluation and staging use only. A final open-source license will be published later.",
12
+ "keywords": [
13
+ "snapshot",
14
+ "rendition",
15
+ "VEdition",
16
+ "genetic-philology",
17
+ "hint-designer",
18
+ "text-transformation"
19
+ ],
20
+ "main": "./dist/index.js",
21
+ "type": "module",
22
+ "types": "./dist/index.d.ts",
23
+ "scripts": {
24
+ "clean": "node -e \"require('fs').rmSync('dist', {recursive:true, force:true})\"",
25
+ "build": "pnpm run clean && rollup -c",
26
+ "watch": "rollup -c -w",
27
+ "start": "concurrently \"rollup -c -w\" \"lite-server\"",
28
+ "start:designer": "concurrently \"rollup -c -w\" \"lite-server -c bs-config.designer.json\"",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "test-ui": "vitest --ui",
32
+ "prepublishOnly": "pnpm run test && pnpm run build",
33
+ "prepack": "pnpm run build",
34
+ "publish:public": "npm publish --access=public"
35
+ },
36
+ "exports": {
37
+ ".": {
38
+ "import": "./dist/index.js",
39
+ "types": "./dist/index.d.ts"
40
+ }
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "packageManager": "pnpm@11.9.0",
48
+ "dependencies": {
49
+ "fast-diff": "^1.3.0",
50
+ "feather-icons": "^4.29.2",
51
+ "golden-layout": "^2.6.0",
52
+ "gsap": "^3.15.0",
53
+ "highlight.js": "^11.11.1",
54
+ "svg-pan-zoom": "^3.6.2",
55
+ "tslib": "^2.8.1",
56
+ "typescript": "^6.0.3"
57
+ },
58
+ "devDependencies": {
59
+ "@rollup/plugin-commonjs": "^29.0.3",
60
+ "@rollup/plugin-node-resolve": "^16.0.3",
61
+ "@rollup/plugin-replace": "^6.0.3",
62
+ "@rollup/plugin-terser": "^1.0.0",
63
+ "@rollup/plugin-typescript": "^12.3.0",
64
+ "@vitest/ui": "^4.1.9",
65
+ "concurrency": "^0.1.4",
66
+ "concurrently": "^10.0.3",
67
+ "lite-server": "^2.6.1",
68
+ "rollup": "^4.62.2",
69
+ "source-map-loader": "^5.0.0",
70
+ "ts-loader": "^9.6.2",
71
+ "typescript": "^6.0.3",
72
+ "vitest": "^4.1.9"
73
+ },
74
+ "optionalDependencies": {
75
+ "@rollup/rollup-win32-arm64-msvc": "^4.62.2"
76
+ },
77
+ "pnpm": {
78
+ "overrides": {
79
+ "rollup": "npm:@rollup/wasm-node"
80
+ }
81
+ }
82
+ }
@@ -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
- }