ts-prorm-orm 1.2.2 → 2.0.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 (129) hide show
  1. package/CHANGELOG.md +209 -0
  2. package/README.md +32 -24
  3. package/dist/compliance/index.d.ts +2 -0
  4. package/dist/compliance/index.js +13 -1
  5. package/dist/connection-manager.js +13 -1
  6. package/dist/core/expressions.d.ts +58 -0
  7. package/dist/core/expressions.js +83 -0
  8. package/dist/core/hooks-manager.d.ts +179 -0
  9. package/dist/core/hooks-manager.js +291 -0
  10. package/dist/core/types.d.ts +235 -0
  11. package/dist/core/types.js +9 -0
  12. package/dist/decorators/index.d.ts +2 -0
  13. package/dist/decorators/index.js +11 -1
  14. package/dist/diagrams/chen-diagram.d.ts +15 -12
  15. package/dist/diagrams/chen-diagram.js +76 -85
  16. package/dist/diagrams/class-diagram.d.ts +9 -8
  17. package/dist/diagrams/class-diagram.js +60 -82
  18. package/dist/diagrams/core/index.d.ts +13 -0
  19. package/dist/diagrams/core/index.js +33 -0
  20. package/dist/diagrams/core/layout.d.ts +104 -0
  21. package/dist/diagrams/core/layout.js +223 -0
  22. package/dist/diagrams/{svg-dom.d.ts → core/svg.d.ts} +8 -20
  23. package/dist/diagrams/{svg-dom.js → core/svg.js} +21 -29
  24. package/dist/diagrams/core/theme.d.ts +84 -0
  25. package/dist/diagrams/core/theme.js +62 -0
  26. package/dist/diagrams/dependency-diagram.d.ts +15 -14
  27. package/dist/diagrams/dependency-diagram.js +71 -105
  28. package/dist/diagrams/er-diagram.d.ts +13 -26
  29. package/dist/diagrams/er-diagram.js +180 -259
  30. package/dist/diagrams/flow-diagram.d.ts +16 -11
  31. package/dist/diagrams/flow-diagram.js +96 -91
  32. package/dist/diagrams/gantt-diagram.d.ts +10 -5
  33. package/dist/diagrams/gantt-diagram.js +77 -103
  34. package/dist/diagrams/index-diagram.d.ts +10 -10
  35. package/dist/diagrams/index-diagram.js +106 -116
  36. package/dist/diagrams/index.d.ts +6 -9
  37. package/dist/diagrams/index.js +9 -24
  38. package/dist/diagrams/migration-diagram.d.ts +8 -4
  39. package/dist/diagrams/migration-diagram.js +189 -161
  40. package/dist/diagrams/model-diagram.d.ts +34 -34
  41. package/dist/diagrams/model-diagram.js +106 -485
  42. package/dist/diagrams/package-diagram.d.ts +9 -6
  43. package/dist/diagrams/package-diagram.js +64 -101
  44. package/dist/diagrams/relational-diagram.d.ts +12 -10
  45. package/dist/diagrams/relational-diagram.js +87 -114
  46. package/dist/diagrams/schemadoc-diagram.d.ts +8 -8
  47. package/dist/diagrams/schemadoc-diagram.js +71 -93
  48. package/dist/diagrams/sequence-diagram.d.ts +10 -10
  49. package/dist/diagrams/sequence-diagram.js +64 -89
  50. package/dist/diagrams/state-diagram.d.ts +10 -9
  51. package/dist/diagrams/state-diagram.js +69 -92
  52. package/dist/diagrams/tree-diagram.d.ts +11 -5
  53. package/dist/diagrams/tree-diagram.js +41 -65
  54. package/dist/dialects/clickhouse/index.js +15 -0
  55. package/dist/dialects/cockroachdb/index.d.ts +1 -1
  56. package/dist/dialects/cockroachdb/index.js +32 -63
  57. package/dist/dialects/db2/index.js +23 -8
  58. package/dist/dialects/dialect.d.ts +29 -5
  59. package/dist/dialects/duckdb/index.js +9 -2
  60. package/dist/dialects/hana/index.js +22 -5
  61. package/dist/dialects/lock-clause-helper.d.ts +167 -0
  62. package/dist/dialects/lock-clause-helper.js +316 -0
  63. package/dist/dialects/mariadb/index.d.ts +7 -4
  64. package/dist/dialects/mariadb/index.js +36 -60
  65. package/dist/dialects/mssql/index.js +34 -3
  66. package/dist/dialects/mysql/index.d.ts +1 -1
  67. package/dist/dialects/mysql/index.js +17 -45
  68. package/dist/dialects/oracle/index.d.ts +14 -3
  69. package/dist/dialects/oracle/index.js +66 -36
  70. package/dist/dialects/order-expression-helper.d.ts +72 -0
  71. package/dist/dialects/order-expression-helper.js +154 -0
  72. package/dist/dialects/partial-index.d.ts +52 -0
  73. package/dist/dialects/partial-index.js +251 -0
  74. package/dist/dialects/postgres/index.d.ts +1 -1
  75. package/dist/dialects/postgres/index.js +43 -68
  76. package/dist/dialects/redshift/index.js +9 -2
  77. package/dist/dialects/snowflake/index.js +17 -0
  78. package/dist/dialects/spanner/index.js +7 -2
  79. package/dist/dialects/sqlite/driver.d.ts +55 -0
  80. package/dist/dialects/sqlite/driver.js +102 -0
  81. package/dist/dialects/sqlite/index.d.ts +1 -1
  82. package/dist/dialects/sqlite/index.js +49 -27
  83. package/dist/graph/base-graph-dialect.d.ts +24 -3
  84. package/dist/graph/base-graph-dialect.js +43 -2
  85. package/dist/graph/dgraph/index.js +6 -0
  86. package/dist/graph/gremlin/index.d.ts +6 -0
  87. package/dist/graph/gremlin/index.js +12 -1
  88. package/dist/graph/index.d.ts +1 -1
  89. package/dist/graph/neo4j/index.d.ts +2 -0
  90. package/dist/graph/neo4j/index.js +6 -1
  91. package/dist/graph/types.d.ts +12 -1
  92. package/dist/index.d.ts +13 -4
  93. package/dist/index.js +54 -7
  94. package/dist/logging/index.d.ts +10 -0
  95. package/dist/logging/index.js +23 -0
  96. package/dist/logging/query-logging.d.ts +82 -0
  97. package/dist/logging/query-logging.js +102 -0
  98. package/dist/models/decorators.d.ts +39 -3
  99. package/dist/models/decorators.js +74 -0
  100. package/dist/models/eager-load.d.ts +99 -0
  101. package/dist/models/eager-load.js +348 -5
  102. package/dist/models/indexes.d.ts +3 -2
  103. package/dist/models/indexes.js +7 -1
  104. package/dist/models/model.js +69 -43
  105. package/dist/prorm.d.ts +175 -409
  106. package/dist/prorm.js +1142 -557
  107. package/dist/query-builders/order-limit-builder.js +12 -10
  108. package/dist/query-builders/sql-compiler.d.ts +10 -3
  109. package/dist/query-builders/sql-compiler.js +14 -43
  110. package/dist/query-interface.d.ts +2 -1
  111. package/dist/sql-constants.d.ts +44 -0
  112. package/dist/sql-constants.js +138 -1
  113. package/dist/types/index.d.ts +53 -17
  114. package/dist/types/index.js +10 -15
  115. package/dist/types/query-types.d.ts +26 -0
  116. package/dist/types/query-types.js +30 -0
  117. package/package.json +32 -5
  118. package/dist/decorators/belongs-to-many.js +0 -115
  119. package/dist/decorators/belongs-to.js +0 -115
  120. package/dist/decorators/has-many.js +0 -127
  121. package/dist/decorators/has-one.js +0 -116
  122. package/dist/diagrams/palette.d.ts +0 -138
  123. package/dist/diagrams/palette.js +0 -194
  124. package/dist/hooks/hooks-manager.d.ts +0 -189
  125. package/dist/hooks/hooks-manager.js +0 -350
  126. package/dist/hooks/index.d.ts +0 -8
  127. package/dist/hooks/index.js +0 -37
  128. /package/dist/{logging.d.ts → logging/logger.d.ts} +0 -0
  129. /package/dist/{logging.js → logging/logger.js} +0 -0
@@ -1,20 +1,20 @@
1
1
  /**
2
- * FlowDiagram generates a general flowchart / data-flow SVG.
2
+ * FlowDiagram - generates a general flowchart / data-flow SVG.
3
3
  *
4
4
  * Renders a directed graph of typed nodes connected by labeled edges, using a
5
5
  * simple top-to-bottom (or left-to-right) layered layout. Each node type gets a
6
6
  * distinct SVG geometry:
7
7
  *
8
- * - process rounded rectangle
9
- * - decision diamond (polygon)
10
- * - start / end stadium / pill (accent-filled)
11
- * - data / io parallelogram (polygon)
12
- * - database cylinder (rect + two ellipses)
8
+ * - process -> square hairline box
9
+ * - decision -> diamond (polygon)
10
+ * - start / end -> filled square (wash fill)
11
+ * - data / io -> parallelogram (polygon)
12
+ * - database -> cylinder (rect + two ellipses)
13
13
  *
14
- * Edges are orthogonal-ish connectors with accent-colored arrowheads and
15
- * optional labels (e.g. the "yes"/"no" branches of a decision node). Layout is
16
- * driven by optional `row`/`col` hints on each node; when omitted, nodes are
17
- * placed sequentially, one per layer, forming a clean vertical chain.
14
+ * Edges are orthogonal-ish connectors with an arrowhead and optional labels
15
+ * (e.g. the "yes"/"no" branches of a decision node). Layout is driven by
16
+ * optional `row`/`col` hints on each node; when omitted, nodes are placed
17
+ * sequentially, one per layer, forming a clean vertical chain.
18
18
  *
19
19
  * Good for visualizing a query pipeline or a migration flow.
20
20
  *
@@ -43,8 +43,12 @@ export interface FlowDiagramOptions {
43
43
  nodes: FlowNode[];
44
44
  edges: FlowEdge[];
45
45
  title?: string;
46
+ /**
47
+ * Accepted for backward compatibility and ignored: diagrams render in a
48
+ * single monochrome theme.
49
+ */
46
50
  theme?: 'light' | 'dark';
47
- /** Accent color: a named palette entry or a hex string. */
51
+ /** Accepted for backward compatibility and ignored. */
48
52
  color?: string;
49
53
  direction?: 'vertical' | 'horizontal';
50
54
  }
@@ -61,6 +65,7 @@ export declare class FlowDiagram {
61
65
  private layout;
62
66
  private drawNode;
63
67
  private drawEdge;
68
+ private build;
64
69
  generate(): string;
65
70
  /**
66
71
  * Write the SVG to a file. Creates parent directories if needed.
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  /**
3
- * FlowDiagram generates a general flowchart / data-flow SVG.
3
+ * FlowDiagram - generates a general flowchart / data-flow SVG.
4
4
  *
5
5
  * Renders a directed graph of typed nodes connected by labeled edges, using a
6
6
  * simple top-to-bottom (or left-to-right) layered layout. Each node type gets a
7
7
  * distinct SVG geometry:
8
8
  *
9
- * - process rounded rectangle
10
- * - decision diamond (polygon)
11
- * - start / end stadium / pill (accent-filled)
12
- * - data / io parallelogram (polygon)
13
- * - database cylinder (rect + two ellipses)
9
+ * - process -> square hairline box
10
+ * - decision -> diamond (polygon)
11
+ * - start / end -> filled square (wash fill)
12
+ * - data / io -> parallelogram (polygon)
13
+ * - database -> cylinder (rect + two ellipses)
14
14
  *
15
- * Edges are orthogonal-ish connectors with accent-colored arrowheads and
16
- * optional labels (e.g. the "yes"/"no" branches of a decision node). Layout is
17
- * driven by optional `row`/`col` hints on each node; when omitted, nodes are
18
- * placed sequentially, one per layer, forming a clean vertical chain.
15
+ * Edges are orthogonal-ish connectors with an arrowhead and optional labels
16
+ * (e.g. the "yes"/"no" branches of a decision node). Layout is driven by
17
+ * optional `row`/`col` hints on each node; when omitted, nodes are placed
18
+ * sequentially, one per layer, forming a clean vertical chain.
19
19
  *
20
20
  * Good for visualizing a query pipeline or a migration flow.
21
21
  *
@@ -62,18 +62,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
62
62
  exports.FlowDiagram = void 0;
63
63
  const fs = __importStar(require("fs"));
64
64
  const path = __importStar(require("path"));
65
- const palette_1 = require("./palette");
66
- const svg_dom_1 = require("./svg-dom");
67
- // ─── Industry design system ────────────────────────────────────────────────
68
- // Barlow / JetBrains Mono typography, hairline borders and square "blueprint"
69
- // corners are fixed by the Industry spec; accent + surface colours still route
70
- // through resolveAccent / resolveTheme so --color / --theme keep working.
71
- const IND_FONT_HEAD = '"Barlow Condensed", system-ui, sans-serif';
72
- const IND_FONT_BODY = '"Barlow", system-ui, sans-serif';
73
- const IND_FONT_MONO = 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace';
74
- const IND_HAIRLINE = 'rgba(29,31,32,0.16)';
75
- const IND_FONT_IMPORT = "@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&family=Barlow+Condensed:wght@400;600&family=JetBrains+Mono&display=swap');";
76
- // ─── Main class ──────────────────────────────────────────────────────────────
65
+ const svg_1 = require("./core/svg");
66
+ const theme_1 = require("./core/theme");
67
+ const layout_1 = require("./core/layout");
77
68
  class FlowDiagram {
78
69
  constructor(options) {
79
70
  this.opts = {
@@ -85,7 +76,7 @@ class FlowDiagram {
85
76
  direction: options.direction ?? 'vertical',
86
77
  };
87
78
  }
88
- // ── Assign nodes to layers, honoring row/col hints ────────────────────────
79
+ // -- Assign nodes to layers, honoring row/col hints -------------------------
89
80
  layout() {
90
81
  const { nodes, direction } = this.opts;
91
82
  const NODE_W = FlowDiagram.NODE_W;
@@ -150,29 +141,27 @@ class FlowDiagram {
150
141
  });
151
142
  return { placed, contentW, contentH, titleH };
152
143
  }
153
- // ── Draw a single typed node into the SVG ─────────────────────────────────
154
- drawNode(svg, p, accent, t) {
144
+ // -- Draw a single typed node into the SVG -----------------------------------
145
+ drawNode(svg, p) {
155
146
  const W = FlowDiagram.NODE_W;
156
147
  const H = FlowDiagram.NODE_H;
157
148
  const { cx, cy, type } = p;
158
149
  const left = cx - W / 2;
159
150
  const top = cy - H / 2;
160
151
  const isTerminal = type === 'start' || type === 'end';
161
- const fill = isTerminal ? accent.mid : t.cardBg;
162
- const stroke = isTerminal ? accent.from : accent.mid;
163
- const textFill = isTerminal ? '#FFFFFF' : t.textPrimary;
152
+ const fill = isTerminal ? theme_1.INK.wash : theme_1.INK.ground;
153
+ const strokeWidth = isTerminal ? theme_1.STROKE.heavy : theme_1.STROKE.hair;
164
154
  switch (type) {
165
155
  case 'start':
166
156
  case 'end': {
167
- // Terminal: solid accent square (blueprint — no radius).
168
157
  svg.child('rect', {
169
158
  x: left,
170
159
  y: top,
171
160
  width: W,
172
161
  height: H,
173
162
  fill,
174
- stroke,
175
- 'stroke-width': 1,
163
+ stroke: theme_1.INK.line,
164
+ 'stroke-width': strokeWidth,
176
165
  });
177
166
  break;
178
167
  }
@@ -184,7 +173,7 @@ class FlowDiagram {
184
173
  `${cx},${top + H}`,
185
174
  `${left},${cy}`,
186
175
  ].join(' ');
187
- svg.child('polygon', { points: pts, fill, stroke, 'stroke-width': 1 });
176
+ svg.child('polygon', { points: pts, fill, stroke: theme_1.INK.line, 'stroke-width': theme_1.STROKE.hair });
188
177
  break;
189
178
  }
190
179
  case 'data': {
@@ -196,14 +185,13 @@ class FlowDiagram {
196
185
  `${left + W - s},${top + H}`,
197
186
  `${left},${top + H}`,
198
187
  ].join(' ');
199
- svg.child('polygon', { points: pts, fill, stroke, 'stroke-width': 1 });
188
+ svg.child('polygon', { points: pts, fill, stroke: theme_1.INK.line, 'stroke-width': theme_1.STROKE.hair });
200
189
  break;
201
190
  }
202
191
  case 'database': {
203
192
  // Cylinder: body rect + top & bottom ellipses.
204
193
  const ry = FlowDiagram.CYL_RY;
205
194
  const rx = W / 2;
206
- // Body (between the two ellipse centers).
207
195
  svg.child('rect', {
208
196
  x: left,
209
197
  y: top + ry,
@@ -211,13 +199,40 @@ class FlowDiagram {
211
199
  height: H - 2 * ry,
212
200
  fill,
213
201
  });
214
- // Side walls.
215
- svg.child('line', { x1: left, y1: top + ry, x2: left, y2: top + H - ry, stroke, 'stroke-width': 2 });
216
- svg.child('line', { x1: left + W, y1: top + ry, x2: left + W, y2: top + H - ry, stroke, 'stroke-width': 2 });
217
- // Bottom (front) ellipse.
218
- svg.child('ellipse', { cx, cy: top + H - ry, rx, ry, fill, stroke, 'stroke-width': 2 });
219
- // Top ellipse (drawn last so its rim sits on top).
220
- svg.child('ellipse', { cx, cy: top + ry, rx, ry, fill, stroke, 'stroke-width': 2 });
202
+ svg.child('line', {
203
+ x1: left,
204
+ y1: top + ry,
205
+ x2: left,
206
+ y2: top + H - ry,
207
+ stroke: theme_1.INK.line,
208
+ 'stroke-width': theme_1.STROKE.hair,
209
+ });
210
+ svg.child('line', {
211
+ x1: left + W,
212
+ y1: top + ry,
213
+ x2: left + W,
214
+ y2: top + H - ry,
215
+ stroke: theme_1.INK.line,
216
+ 'stroke-width': theme_1.STROKE.hair,
217
+ });
218
+ svg.child('ellipse', {
219
+ cx,
220
+ cy: top + H - ry,
221
+ rx,
222
+ ry,
223
+ fill,
224
+ stroke: theme_1.INK.line,
225
+ 'stroke-width': theme_1.STROKE.hair,
226
+ });
227
+ svg.child('ellipse', {
228
+ cx,
229
+ cy: top + ry,
230
+ rx,
231
+ ry,
232
+ fill,
233
+ stroke: theme_1.INK.line,
234
+ 'stroke-width': theme_1.STROKE.hair,
235
+ });
221
236
  break;
222
237
  }
223
238
  case 'process':
@@ -228,36 +243,35 @@ class FlowDiagram {
228
243
  width: W,
229
244
  height: H,
230
245
  fill,
231
- stroke,
232
- 'stroke-width': 1,
246
+ stroke: theme_1.INK.line,
247
+ 'stroke-width': strokeWidth,
233
248
  });
234
249
  break;
235
250
  }
236
251
  }
237
252
  // Node label (centered). Truncate very long labels.
238
253
  const label = p.node.label ?? p.node.id;
239
- const disp = label.length > 24 ? label.slice(0, 23) + '…' : label;
240
254
  svg
241
255
  .child('text', {
242
256
  x: cx,
243
257
  y: cy + 5,
244
- 'font-family': IND_FONT_HEAD,
245
- 'font-size': 13,
246
- 'font-weight': isTerminal ? 700 : 600,
247
- fill: textFill,
258
+ 'font-family': theme_1.FONT.family,
259
+ 'font-size': theme_1.FONT.body + 2,
260
+ 'font-weight': 'bold',
261
+ fill: theme_1.INK.line,
248
262
  'text-anchor': 'middle',
249
263
  })
250
- .text(disp);
264
+ .text((0, layout_1.truncate)(label, W - 16, theme_1.FONT.body + 2));
251
265
  }
252
- // ── Draw one edge (orthogonal-ish connector) with optional label ──────────
253
- drawEdge(svg, from, to, edge, markerId, accent, t) {
266
+ // -- Draw one edge (orthogonal-ish connector) with optional label ------------
267
+ drawEdge(svg, from, to, edge, markerId) {
254
268
  const W = FlowDiagram.NODE_W;
255
269
  const H = FlowDiagram.NODE_H;
256
270
  const vertical = this.opts.direction !== 'horizontal';
257
271
  let d;
258
272
  let labelX;
259
273
  let labelY;
260
- const forward = vertical ? to.layer > from.layer : to.layer > from.layer;
274
+ const forward = to.layer > from.layer;
261
275
  if (forward) {
262
276
  if (vertical) {
263
277
  const sx = from.cx;
@@ -294,86 +308,77 @@ class FlowDiagram {
294
308
  svg.child('path', {
295
309
  d,
296
310
  fill: 'none',
297
- stroke: t.textSecondary,
298
- 'stroke-width': 1,
311
+ stroke: theme_1.INK.line,
312
+ 'stroke-width': theme_1.STROKE.hair,
299
313
  'marker-end': `url(#${markerId})`,
300
314
  });
301
315
  if (edge.label) {
302
- // Label chip (accent light tint, square) so text stays legible.
316
+ // Label chip so text stays legible against crossing lines.
303
317
  const chipW = edge.label.length * 6.5 + 12;
304
318
  svg.child('rect', {
305
319
  x: labelX - 2,
306
320
  y: labelY - 12,
307
321
  width: chipW,
308
322
  height: 16,
309
- fill: accent.light,
323
+ fill: theme_1.INK.ground,
324
+ stroke: theme_1.INK.line,
325
+ 'stroke-width': theme_1.STROKE.hair,
310
326
  });
311
327
  svg
312
328
  .child('text', {
313
329
  x: labelX + chipW / 2 - 2,
314
330
  y: labelY,
315
- 'font-family': IND_FONT_MONO,
316
- 'font-size': 10,
317
- 'font-weight': 700,
318
- fill: accent.text,
331
+ 'font-family': theme_1.FONT.mono,
332
+ 'font-size': theme_1.FONT.small,
333
+ 'font-weight': 'bold',
334
+ fill: theme_1.INK.line,
319
335
  'text-anchor': 'middle',
320
336
  })
321
337
  .text(edge.label);
322
338
  }
323
339
  }
324
- // ── Generate full SVG string ──────────────────────────────────────────────
325
- generate() {
326
- const { title, theme, color } = this.opts;
327
- const accent = (0, palette_1.resolveAccent)(color);
328
- const t = (0, palette_1.resolveTheme)(theme);
340
+ // -- Build the SVG document --------------------------------------------------
341
+ build() {
342
+ const { title } = this.opts;
329
343
  const PAD = FlowDiagram.PAD;
330
344
  const { placed, contentW, contentH, titleH } = this.layout();
331
345
  const svgW = contentW + 2 * PAD;
332
346
  const svgH = contentH + titleH + 2 * PAD;
333
- const doc = new svg_dom_1.SvgDocument(Math.max(svgW, 320), Math.max(svgH, 160));
347
+ const W = Math.max(svgW, 320);
348
+ const H = Math.max(svgH, 160);
349
+ const doc = new svg_1.SvgDocument(W, H);
334
350
  const svg = doc.root;
335
- // ── Canvas background + embedded Industry web-fonts ────────────────────
336
- svg.child('rect', { width: Math.max(svgW, 320), height: Math.max(svgH, 160), fill: t.canvasBg });
337
- svg.child('style').text(IND_FONT_IMPORT);
338
- // ── Arrowhead marker (accent-colored) ──────────────────────────────────
351
+ svg.child('rect', { width: W, height: H, fill: theme_1.INK.ground });
339
352
  const markerId = 'flowArrow';
340
- const marker = doc.defs().child('marker', {
341
- id: markerId,
342
- viewBox: '0 0 10 10',
343
- refX: 9,
344
- refY: 5,
345
- markerWidth: 7,
346
- markerHeight: 7,
347
- orient: 'auto-start-reverse',
348
- });
349
- marker.child('path', { d: 'M 0 0 L 10 5 L 0 10 z', fill: accent.mid });
350
- // ── Title ──────────────────────────────────────────────────────────────
353
+ (0, layout_1.defineArrowhead)(doc.defs(), markerId);
351
354
  if (title) {
352
355
  svg
353
356
  .child('text', {
354
357
  x: PAD,
355
358
  y: PAD + 26,
356
- 'font-family': IND_FONT_HEAD,
357
- 'font-size': 22,
358
- 'font-weight': 600,
359
- fill: t.textPrimary,
359
+ 'font-family': theme_1.FONT.family,
360
+ 'font-size': theme_1.FONT.title + 9,
361
+ 'font-weight': 'bold',
362
+ fill: theme_1.INK.line,
360
363
  })
361
364
  .text(title);
362
- svg.child('rect', { x: PAD, y: PAD + 36, width: 56, height: 4, fill: accent.mid });
365
+ svg.child('rect', { x: PAD, y: PAD + 36, width: 56, height: 4, fill: theme_1.INK.line });
363
366
  }
364
- // ── Edges first (so nodes render on top) ───────────────────────────────
367
+ // Edges first, so nodes render on top.
365
368
  for (const edge of this.opts.edges) {
366
369
  const from = placed.get(edge.from);
367
370
  const to = placed.get(edge.to);
368
371
  if (!from || !to)
369
372
  continue;
370
- this.drawEdge(svg, from, to, edge, markerId, accent, t);
373
+ this.drawEdge(svg, from, to, edge, markerId);
371
374
  }
372
- // ── Nodes ──────────────────────────────────────────────────────────────
373
375
  for (const p of placed.values()) {
374
- this.drawNode(svg, p, accent, t);
376
+ this.drawNode(svg, p);
375
377
  }
376
- return doc.toString('Generated by ts-prorm-orm FlowDiagram');
378
+ return doc;
379
+ }
380
+ generate() {
381
+ return this.build().toString('Generated by ts-prorm-orm FlowDiagram');
377
382
  }
378
383
  /**
379
384
  * Write the SVG to a file. Creates parent directories if needed.
@@ -1,18 +1,18 @@
1
1
  /**
2
- * GanttDiagram generates a horizontal timeline / Gantt chart SVG.
2
+ * GanttDiagram - generates a horizontal timeline / Gantt chart SVG.
3
3
  *
4
4
  * Features:
5
5
  * - Left label column listing task/row names
6
6
  * - Right time-axis area with vertical gridlines (days / weeks / months)
7
7
  * - One horizontal bar per task, positioned/sized by its start & end dates
8
- * - Tasks grouped into sections, each colored from a rotated accent palette
8
+ * - Tasks grouped into sections
9
9
  * - Optional % complete overlay drawn on top of each bar
10
10
  * - Milestones rendered as diamonds
11
11
  * - Dependency arrows drawn between a task and the task it depends on
12
- * - Auto-sized SVG viewBox, light/dark theme aware
12
+ * - Auto-sized SVG viewBox
13
13
  *
14
14
  * The time scale is computed from the minimum start to the maximum end across
15
- * all tasks; dates are mapped linearly to x. Everything is deterministic
15
+ * all tasks; dates are mapped linearly to x. Everything is deterministic -
16
16
  * no Date.now()/new Date()-with-no-args/Math.random() is used.
17
17
  *
18
18
  * Usage:
@@ -38,8 +38,12 @@ export interface GanttTask {
38
38
  export interface GanttDiagramOptions {
39
39
  tasks: GanttTask[];
40
40
  title?: string;
41
+ /**
42
+ * Accepted for backward compatibility and ignored: diagrams render in a
43
+ * single monochrome theme.
44
+ */
41
45
  theme?: 'light' | 'dark';
42
- /** Custom accent color name or hex string */
46
+ /** Accepted for backward compatibility and ignored. */
43
47
  color?: string;
44
48
  /** Gridline granularity along the time axis */
45
49
  axis?: 'days' | 'weeks' | 'months';
@@ -58,6 +62,7 @@ export declare class GanttDiagram {
58
62
  constructor(options: GanttDiagramOptions);
59
63
  /** Group tasks into sections preserving first-seen order. */
60
64
  private buildSections;
65
+ private build;
61
66
  generate(): string;
62
67
  /**
63
68
  * Write the SVG to a file. Creates parent directories if needed.