@memberjunction/core-actions 2.107.0 → 2.109.0

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 (85) hide show
  1. package/dist/custom/ai/find-best-action.action.d.ts +53 -0
  2. package/dist/custom/ai/find-best-action.action.d.ts.map +1 -0
  3. package/dist/custom/ai/find-best-action.action.js +211 -0
  4. package/dist/custom/ai/find-best-action.action.js.map +1 -0
  5. package/dist/custom/ai/find-best-agent.action.d.ts +53 -0
  6. package/dist/custom/ai/find-best-agent.action.d.ts.map +1 -0
  7. package/dist/custom/ai/find-best-agent.action.js +194 -0
  8. package/dist/custom/ai/find-best-agent.action.js.map +1 -0
  9. package/dist/custom/ai/summarize-content.action.d.ts +3 -3
  10. package/dist/custom/ai/summarize-content.action.d.ts.map +1 -1
  11. package/dist/custom/ai/summarize-content.action.js +51 -143
  12. package/dist/custom/ai/summarize-content.action.js.map +1 -1
  13. package/dist/custom/code-execution/execute-code.action.d.ts +61 -0
  14. package/dist/custom/code-execution/execute-code.action.d.ts.map +1 -0
  15. package/dist/custom/code-execution/execute-code.action.js +172 -0
  16. package/dist/custom/code-execution/execute-code.action.js.map +1 -0
  17. package/dist/custom/data/csv-parser.action.js +1 -1
  18. package/dist/custom/data/csv-parser.action.js.map +1 -1
  19. package/dist/custom/data/execute-research-query.action.d.ts +36 -18
  20. package/dist/custom/data/execute-research-query.action.d.ts.map +1 -1
  21. package/dist/custom/data/execute-research-query.action.js +221 -114
  22. package/dist/custom/data/execute-research-query.action.js.map +1 -1
  23. package/dist/custom/data/explore-database-schema.action.d.ts +4 -0
  24. package/dist/custom/data/explore-database-schema.action.d.ts.map +1 -1
  25. package/dist/custom/data/explore-database-schema.action.js +101 -8
  26. package/dist/custom/data/explore-database-schema.action.js.map +1 -1
  27. package/dist/custom/data/get-entity-details.action.d.ts +63 -0
  28. package/dist/custom/data/get-entity-details.action.d.ts.map +1 -0
  29. package/dist/custom/data/get-entity-details.action.js +284 -0
  30. package/dist/custom/data/get-entity-details.action.js.map +1 -0
  31. package/dist/custom/data/get-entity-list.action.d.ts +57 -0
  32. package/dist/custom/data/get-entity-list.action.d.ts.map +1 -0
  33. package/dist/custom/data/get-entity-list.action.js +177 -0
  34. package/dist/custom/data/get-entity-list.action.js.map +1 -0
  35. package/dist/custom/visualization/create-svg-chart.action.d.ts +97 -0
  36. package/dist/custom/visualization/create-svg-chart.action.d.ts.map +1 -0
  37. package/dist/custom/visualization/create-svg-chart.action.js +326 -0
  38. package/dist/custom/visualization/create-svg-chart.action.js.map +1 -0
  39. package/dist/custom/visualization/create-svg-diagram.action.d.ts +151 -0
  40. package/dist/custom/visualization/create-svg-diagram.action.d.ts.map +1 -0
  41. package/dist/custom/visualization/create-svg-diagram.action.js +764 -0
  42. package/dist/custom/visualization/create-svg-diagram.action.js.map +1 -0
  43. package/dist/custom/visualization/create-svg-infographic.action.d.ts +72 -0
  44. package/dist/custom/visualization/create-svg-infographic.action.d.ts.map +1 -0
  45. package/dist/custom/visualization/create-svg-infographic.action.js +343 -0
  46. package/dist/custom/visualization/create-svg-infographic.action.js.map +1 -0
  47. package/dist/custom/visualization/create-svg-network.action.d.ts +106 -0
  48. package/dist/custom/visualization/create-svg-network.action.d.ts.map +1 -0
  49. package/dist/custom/visualization/create-svg-network.action.js +687 -0
  50. package/dist/custom/visualization/create-svg-network.action.js.map +1 -0
  51. package/dist/custom/visualization/create-svg-sketch-diagram.action.d.ts +97 -0
  52. package/dist/custom/visualization/create-svg-sketch-diagram.action.d.ts.map +1 -0
  53. package/dist/custom/visualization/create-svg-sketch-diagram.action.js +730 -0
  54. package/dist/custom/visualization/create-svg-sketch-diagram.action.js.map +1 -0
  55. package/dist/custom/visualization/create-svg-word-cloud.action.d.ts +94 -0
  56. package/dist/custom/visualization/create-svg-word-cloud.action.d.ts.map +1 -0
  57. package/dist/custom/visualization/create-svg-word-cloud.action.js +497 -0
  58. package/dist/custom/visualization/create-svg-word-cloud.action.js.map +1 -0
  59. package/dist/custom/visualization/shared/svg-theming.d.ts +91 -0
  60. package/dist/custom/visualization/shared/svg-theming.d.ts.map +1 -0
  61. package/dist/custom/visualization/shared/svg-theming.js +235 -0
  62. package/dist/custom/visualization/shared/svg-theming.js.map +1 -0
  63. package/dist/custom/visualization/shared/svg-types.d.ts +354 -0
  64. package/dist/custom/visualization/shared/svg-types.d.ts.map +1 -0
  65. package/dist/custom/visualization/shared/svg-types.js +11 -0
  66. package/dist/custom/visualization/shared/svg-types.js.map +1 -0
  67. package/dist/custom/visualization/shared/svg-utils.d.ts +166 -0
  68. package/dist/custom/visualization/shared/svg-utils.d.ts.map +1 -0
  69. package/dist/custom/visualization/shared/svg-utils.js +555 -0
  70. package/dist/custom/visualization/shared/svg-utils.js.map +1 -0
  71. package/dist/custom/web/google-custom-search.action.d.ts +6 -1
  72. package/dist/custom/web/google-custom-search.action.d.ts.map +1 -1
  73. package/dist/custom/web/google-custom-search.action.js +78 -10
  74. package/dist/custom/web/google-custom-search.action.js.map +1 -1
  75. package/dist/custom/web/web-page-content.action.d.ts +24 -0
  76. package/dist/custom/web/web-page-content.action.d.ts.map +1 -1
  77. package/dist/custom/web/web-page-content.action.js +90 -9
  78. package/dist/custom/web/web-page-content.action.js.map +1 -1
  79. package/dist/generated/action_subclasses.d.ts +4 -4
  80. package/dist/generated/action_subclasses.js +13 -13
  81. package/dist/index.d.ts +12 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +34 -0
  84. package/dist/index.js.map +1 -1
  85. package/package.json +30 -12
@@ -0,0 +1,354 @@
1
+ /**
2
+ * @fileoverview Type definitions for server-rendered SVG visualizations.
3
+ * These types support the MemberJunction infographic system and provide
4
+ * consistent interfaces across all visualization actions.
5
+ *
6
+ * @module @memberjunction/actions-core/visualization
7
+ * @since 2.107.0
8
+ */
9
+ import { ActionResultSimple } from '@memberjunction/actions-base';
10
+ /**
11
+ * ViewBox configuration for SVG canvas dimensions and padding
12
+ */
13
+ export interface ViewBox {
14
+ /** Final pixel width of the SVG */
15
+ width: number;
16
+ /** Final pixel height of the SVG */
17
+ height: number;
18
+ /** Padding around content (uniform or per-side) */
19
+ padding?: number | {
20
+ top?: number;
21
+ right?: number;
22
+ bottom?: number;
23
+ left?: number;
24
+ };
25
+ }
26
+ /**
27
+ * Font specification for text rendering
28
+ */
29
+ export interface FontSpec {
30
+ /** Font family stack (e.g., 'Inter, Arial, sans-serif') */
31
+ family?: string;
32
+ /** Font size in pixels (default: 12-14) */
33
+ size?: number;
34
+ /** Font weight (400, 600, 'bold', etc.) */
35
+ weight?: number | string;
36
+ /** Line height in em units */
37
+ lineHeight?: number;
38
+ }
39
+ /**
40
+ * Color palette configuration
41
+ */
42
+ export type Palette = {
43
+ type: 'named';
44
+ name: 'mjDefault' | 'gray' | 'pastel' | 'highContrast';
45
+ } | {
46
+ type: 'manual';
47
+ background?: string;
48
+ foreground?: string;
49
+ categorical?: string[];
50
+ sequential?: string[];
51
+ };
52
+ /**
53
+ * Branding and visual identity configuration
54
+ */
55
+ export interface Branding {
56
+ /** Color palette to use */
57
+ palette?: Palette;
58
+ /** Font specification */
59
+ font?: FontSpec;
60
+ /** Optional logo SVG snippet to place in corner */
61
+ logoSvg?: string;
62
+ /** Optional watermark text */
63
+ watermarkText?: string;
64
+ }
65
+ /**
66
+ * Accessibility configuration for WCAG compliance
67
+ */
68
+ export interface Accessibility {
69
+ /** Title for <title> element */
70
+ title?: string;
71
+ /** Description for <desc> element */
72
+ desc?: string;
73
+ /** ARIA role for root SVG */
74
+ ariaRole?: 'img' | 'graphics-document';
75
+ /** Include data table for screen readers */
76
+ includeDataTable?: boolean;
77
+ }
78
+ /**
79
+ * Animation configuration (primarily for web display)
80
+ */
81
+ export interface AnimationOptions {
82
+ /** Enable animations (default: false for print-first) */
83
+ enabled?: boolean;
84
+ /** Prefer CSS animations over inline JS */
85
+ preferCSS?: boolean;
86
+ /** Animation duration in milliseconds */
87
+ durationMs?: number;
88
+ /** Easing function */
89
+ ease?: 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out';
90
+ /** Stagger delay between items in milliseconds */
91
+ staggerMs?: number;
92
+ }
93
+ /**
94
+ * Interactivity configuration (requires inline JS)
95
+ */
96
+ export interface InteractivityOptions {
97
+ /** Enable interactivity (default: false) */
98
+ enabled?: boolean;
99
+ /** Show tooltips on hover */
100
+ tooltips?: boolean;
101
+ /** Enable expand/collapse for trees */
102
+ expandCollapse?: boolean;
103
+ /** Enable pan and zoom */
104
+ panZoom?: boolean;
105
+ /** Minimum zoom scale (default: 0.5) */
106
+ panZoomMinScale?: number;
107
+ /** Maximum zoom scale (default: 3) */
108
+ panZoomMaxScale?: number;
109
+ /** Show zoom control buttons (default: false) */
110
+ panZoomShowControls?: boolean;
111
+ /** Highlight connected nodes on hover (network graphs) */
112
+ highlightConnected?: boolean;
113
+ }
114
+ /**
115
+ * Export and rendering controls
116
+ */
117
+ export interface ExportControls {
118
+ /** Inline CSS in <style> tag (default: true) */
119
+ embedCSS?: boolean;
120
+ /** Inline JavaScript in <script> tag (default: false) */
121
+ embedJS?: boolean;
122
+ /** Prefix for element IDs to ensure uniqueness */
123
+ idPrefix?: string;
124
+ /** Seed for deterministic random layouts */
125
+ seed?: number;
126
+ /** Wrap SVG in scrollable HTML container */
127
+ wrapWithContainer?: boolean;
128
+ /** Maximum container width (default: 1200) */
129
+ maxContainerWidth?: number;
130
+ /** Maximum container height (default: 800) */
131
+ maxContainerHeight?: number;
132
+ }
133
+ /**
134
+ * Base configuration shared by all SVG actions
135
+ */
136
+ export interface ActionBase {
137
+ /** ViewBox dimensions and padding */
138
+ viewBox: ViewBox;
139
+ /** Branding and visual identity */
140
+ branding?: Branding;
141
+ /** Accessibility configuration */
142
+ a11y?: Accessibility;
143
+ /** Animation options */
144
+ animation?: AnimationOptions;
145
+ /** Interactivity options */
146
+ interactivity?: InteractivityOptions;
147
+ /** Export controls */
148
+ export?: ExportControls;
149
+ /** Pass-through metadata for tracing/debugging */
150
+ meta?: Record<string, unknown>;
151
+ }
152
+ /**
153
+ * Standardized result from SVG actions
154
+ */
155
+ export interface SVGActionResult extends ActionResultSimple {
156
+ /** SVG XML string ready to embed */
157
+ svg?: string;
158
+ /** Width in pixels */
159
+ width?: number;
160
+ /** Height in pixels */
161
+ height?: number;
162
+ /** Warnings about rendering issues */
163
+ warnings?: string[];
164
+ /** Diagnostic information */
165
+ diagnostics?: Record<string, unknown>;
166
+ }
167
+ /**
168
+ * Types of nodes in flowcharts
169
+ */
170
+ export type FlowNodeKind = 'start' | 'end' | 'process' | 'decision' | 'input' | 'output' | 'subprocess';
171
+ /**
172
+ * Node in a flowchart
173
+ */
174
+ export interface FlowNode {
175
+ /** Unique node identifier */
176
+ id: string;
177
+ /** Node type/shape */
178
+ kind: FlowNodeKind;
179
+ /** Display label */
180
+ label: string;
181
+ /** Optional note/description */
182
+ note?: string;
183
+ /** Optional icon SVG */
184
+ icon?: string;
185
+ /** Override width (auto-calculated if not provided) */
186
+ width?: number;
187
+ /** Override height (auto-calculated if not provided) */
188
+ height?: number;
189
+ }
190
+ /**
191
+ * Edge connecting flowchart nodes
192
+ */
193
+ export interface FlowEdge {
194
+ /** Source node ID */
195
+ from: string;
196
+ /** Target node ID */
197
+ to: string;
198
+ /** Optional edge label */
199
+ label?: string;
200
+ /** Render as dashed line */
201
+ dashed?: boolean;
202
+ }
203
+ /**
204
+ * Layout configuration for flowcharts
205
+ */
206
+ export interface FlowLayout {
207
+ /** Layout direction */
208
+ direction?: 'TB' | 'LR' | 'RL' | 'BT';
209
+ /** Vertical spacing between ranks */
210
+ rankSep?: number;
211
+ /** Horizontal spacing between nodes */
212
+ nodeSep?: number;
213
+ }
214
+ /**
215
+ * Node in an org chart
216
+ */
217
+ export interface OrgNode {
218
+ /** Unique node identifier */
219
+ id: string;
220
+ /** Person/position name */
221
+ label: string;
222
+ /** Job title/role */
223
+ role?: string;
224
+ /** Avatar URL (data URI or omitted) */
225
+ avatarUrl?: string;
226
+ /** Child nodes in hierarchy */
227
+ children?: OrgNode[];
228
+ /** Highlight this node */
229
+ highlight?: boolean;
230
+ }
231
+ /**
232
+ * Attribute in an entity
233
+ */
234
+ export interface ERAttribute {
235
+ /** Attribute name */
236
+ name: string;
237
+ /** Data type */
238
+ type?: string;
239
+ /** Primary key indicator */
240
+ pk?: boolean;
241
+ /** Foreign key indicator */
242
+ fk?: boolean;
243
+ }
244
+ /**
245
+ * Table/Entity in ER diagram
246
+ */
247
+ export interface ERTable {
248
+ /** Unique table identifier */
249
+ id: string;
250
+ /** Table display name */
251
+ name: string;
252
+ /** Table attributes/columns */
253
+ attrs: ERAttribute[];
254
+ }
255
+ /**
256
+ * Relationship between entities
257
+ */
258
+ export interface ERRelation {
259
+ /** Source table ID */
260
+ from: string;
261
+ /** Target table ID */
262
+ to: string;
263
+ /** Relationship cardinality */
264
+ label?: '1-1' | '1-N' | 'N-M';
265
+ }
266
+ /**
267
+ * Word with weight for cloud/tag visualization
268
+ */
269
+ export interface WordItem {
270
+ /** The word/term */
271
+ text: string;
272
+ /** Weight/frequency/importance */
273
+ weight: number;
274
+ }
275
+ /**
276
+ * Word cloud layout configuration
277
+ */
278
+ export interface CloudLayout {
279
+ /** Rotation strategy */
280
+ rotate?: 'none' | 'few' | 'mixed';
281
+ /** Padding between words */
282
+ padding?: number;
283
+ /** Spiral algorithm type */
284
+ spiral?: 'archimedean' | 'rectangular';
285
+ /** Minimum font size */
286
+ minFont?: number;
287
+ /** Maximum font size */
288
+ maxFont?: number;
289
+ }
290
+ /**
291
+ * Node in a network graph
292
+ */
293
+ export interface GraphNode {
294
+ /** Unique node identifier */
295
+ id: string;
296
+ /** Display label */
297
+ label?: string;
298
+ /** Group/category for coloring */
299
+ group?: string;
300
+ /** Node size (auto-calculated if not provided) */
301
+ size?: number;
302
+ }
303
+ /**
304
+ * Edge connecting graph nodes
305
+ */
306
+ export interface GraphEdge {
307
+ /** Optional edge identifier */
308
+ id?: string;
309
+ /** Source node ID */
310
+ source: string;
311
+ /** Target node ID */
312
+ target: string;
313
+ /** Edge weight/strength */
314
+ weight?: number;
315
+ /** Directed edge (arrow) */
316
+ directed?: boolean;
317
+ }
318
+ /**
319
+ * Network layout type
320
+ */
321
+ export type NetworkLayoutType = 'force' | 'radial' | 'tree' | 'grid';
322
+ /**
323
+ * Physics simulation parameters for force-directed layouts
324
+ */
325
+ export interface PhysicsParams {
326
+ /** Charge/repulsion strength (negative = repel) */
327
+ charge?: number;
328
+ /** Ideal distance between connected nodes */
329
+ linkDistance?: number;
330
+ /** Number of simulation iterations */
331
+ iterations?: number;
332
+ }
333
+ /**
334
+ * Decision tree node (hierarchical)
335
+ */
336
+ export interface DecisionNode {
337
+ /** Unique node identifier */
338
+ id: string;
339
+ /** Node label */
340
+ label: string;
341
+ /** Optional value/probability */
342
+ value?: number;
343
+ /** Child nodes in tree */
344
+ children?: DecisionNode[];
345
+ /** Collapsed state (if interactivity enabled) */
346
+ collapsed?: boolean;
347
+ /** Optional note */
348
+ note?: string;
349
+ }
350
+ /**
351
+ * Node shape for decision trees
352
+ */
353
+ export type NodeShape = 'rect' | 'circle' | 'pill';
354
+ //# sourceMappingURL=svg-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-types.d.ts","sourceRoot":"","sources":["../../../../src/custom/visualization/shared/svg-types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,OAAO;IACpB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,GAAG;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACvF;AA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IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Type definitions for server-rendered SVG visualizations.
4
+ * These types support the MemberJunction infographic system and provide
5
+ * consistent interfaces across all visualization actions.
6
+ *
7
+ * @module @memberjunction/actions-core/visualization
8
+ * @since 2.107.0
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=svg-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-types.js","sourceRoot":"","sources":["../../../../src/custom/visualization/shared/svg-types.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * @fileoverview Utility functions for SVG creation, manipulation, and sanitization.
3
+ * These utilities provide security, consistency, and convenience for all visualization actions.
4
+ *
5
+ * @module @memberjunction/actions-core/visualization
6
+ * @since 2.107.0
7
+ */
8
+ import { ViewBox, Accessibility } from './svg-types';
9
+ /**
10
+ * Utility class for SVG operations
11
+ */
12
+ export declare class SVGUtils {
13
+ /**
14
+ * Creates a base SVG element with proper namespace and dimensions
15
+ *
16
+ * @param width - SVG width in pixels
17
+ * @param height - SVG height in pixels
18
+ * @param idPrefix - Optional ID prefix for the root SVG element
19
+ * @returns JSDOM Document containing the SVG
20
+ */
21
+ static createSVG(width: number, height: number, idPrefix?: string): Document;
22
+ /**
23
+ * Sanitizes text content to prevent XSS attacks
24
+ *
25
+ * @param text - Raw text content
26
+ * @returns HTML-safe text
27
+ */
28
+ static sanitizeText(text: string): string;
29
+ /**
30
+ * Sanitizes SVG string to remove potentially malicious content
31
+ * - Removes event handlers (on*)
32
+ * - Removes external image references
33
+ * - Removes external use references
34
+ * - Restricts href to # and mailto: only
35
+ *
36
+ * @param svgString - Raw SVG XML string
37
+ * @returns Sanitized SVG string
38
+ */
39
+ static sanitizeSVG(svgString: string): string;
40
+ /**
41
+ * Generates a unique ID with prefix and timestamp
42
+ *
43
+ * @param prefix - ID prefix (e.g., 'flow', 'node')
44
+ * @param index - Index or identifier
45
+ * @returns Unique ID string
46
+ */
47
+ static generateId(prefix: string, index: number | string): string;
48
+ /**
49
+ * Adds accessibility elements to SVG root
50
+ *
51
+ * @param svg - SVG element to enhance
52
+ * @param a11y - Accessibility configuration
53
+ */
54
+ static addA11y(svg: SVGElement, a11y: Accessibility): void;
55
+ /**
56
+ * Injects inline CSS styles into SVG
57
+ *
58
+ * @param svg - SVG element
59
+ * @param css - CSS string to inject
60
+ */
61
+ static addStyles(svg: SVGElement, css: string): void;
62
+ /**
63
+ * Calculates viewBox with padding applied
64
+ *
65
+ * @param viewBox - ViewBox configuration
66
+ * @returns Padding-adjusted dimensions and offsets
67
+ */
68
+ static calculateViewBox(viewBox: ViewBox): {
69
+ x: number;
70
+ y: number;
71
+ width: number;
72
+ height: number;
73
+ contentWidth: number;
74
+ contentHeight: number;
75
+ };
76
+ /**
77
+ * Creates a <defs> element if it doesn't exist in SVG
78
+ *
79
+ * @param svg - SVG element
80
+ * @returns The defs element (existing or newly created)
81
+ */
82
+ static getOrCreateDefs(svg: SVGElement): SVGDefsElement;
83
+ /**
84
+ * Adds an arrowhead marker definition to SVG
85
+ *
86
+ * @param svg - SVG element
87
+ * @param id - Marker ID
88
+ * @param color - Arrow color
89
+ * @returns Marker ID for use in marker-end attribute
90
+ */
91
+ static addArrowMarker(svg: SVGElement, id: string, color?: string): string;
92
+ /**
93
+ * Creates a seeded pseudo-random number generator
94
+ * Uses simple Linear Congruential Generator for deterministic output
95
+ *
96
+ * @param seed - Random seed
97
+ * @returns Function that returns random numbers between 0 and 1
98
+ */
99
+ static seededRandom(seed: number): () => number;
100
+ /**
101
+ * Wraps text to fit within a specified width
102
+ *
103
+ * @param text - Text to wrap
104
+ * @param maxWidth - Maximum width in characters (approximate)
105
+ * @returns Array of text lines
106
+ */
107
+ static wrapText(text: string, maxWidth: number): string[];
108
+ /**
109
+ * Calculates text width (approximate based on character count and font size)
110
+ * More accurate measurement would require actual rendering
111
+ *
112
+ * @param text - Text content
113
+ * @param fontSize - Font size in pixels
114
+ * @returns Estimated width in pixels
115
+ */
116
+ static estimateTextWidth(text: string, fontSize?: number): number;
117
+ /**
118
+ * Creates a rounded rectangle path
119
+ *
120
+ * @param x - X coordinate
121
+ * @param y - Y coordinate
122
+ * @param width - Width
123
+ * @param height - Height
124
+ * @param radius - Corner radius
125
+ * @returns SVG path data string
126
+ */
127
+ static roundedRectPath(x: number, y: number, width: number, height: number, radius: number): string;
128
+ /**
129
+ * Wraps SVG string in a scrollable HTML container
130
+ * Useful for large visualizations that exceed viewport size
131
+ *
132
+ * @param svgString - The SVG XML string to wrap
133
+ * @param maxWidth - Maximum container width in pixels (default: 1200)
134
+ * @param maxHeight - Maximum container height in pixels (default: 800)
135
+ * @param showBorder - Whether to show container border (default: true)
136
+ * @param borderColor - Border color (default: #ddd)
137
+ * @returns HTML string with SVG wrapped in scrollable div
138
+ */
139
+ static wrapWithScrollContainer(svgString: string, maxWidth?: number, maxHeight?: number, showBorder?: boolean, borderColor?: string): string;
140
+ /**
141
+ * Generates self-contained pan/zoom script for SVG
142
+ * No external dependencies - fully embedded JavaScript
143
+ *
144
+ * @param containerId - ID of the SVG group to apply transform to
145
+ * @param minScale - Minimum zoom level (default: 0.5)
146
+ * @param maxScale - Maximum zoom level (default: 3)
147
+ * @param showControls - Show zoom in/out/reset buttons (default: false)
148
+ * @returns Script tag with pan/zoom implementation
149
+ */
150
+ static generatePanZoomScript(containerId?: string, minScale?: number, maxScale?: number, showControls?: boolean): string;
151
+ /**
152
+ * Generates zoom control buttons script
153
+ * @returns Script code for zoom controls (internal use)
154
+ */
155
+ private static generateZoomControlsScript;
156
+ /**
157
+ * Generates interactive tooltip script for SVG elements
158
+ * Elements must have data-tooltip attribute
159
+ *
160
+ * @param svg - SVG element to add tooltip to
161
+ * @param doc - Document to create elements in
162
+ * @returns Script tag with tooltip implementation
163
+ */
164
+ static addTooltipSupport(svg: SVGElement, doc: Document): void;
165
+ }
166
+ //# sourceMappingURL=svg-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg-utils.d.ts","sourceRoot":"","sources":["../../../../src/custom/visualization/shared/svg-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAW,MAAM,aAAa,CAAC;AAE9D;;GAEG;AACH,qBAAa,QAAQ;IACjB;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ;IAU5E;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IASzC;;;;;;;;;OASG;IACH,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAmB7C;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAIjE;;;;;OAKG;IACH,MAAM,CAAC,OAAO,C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