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,19 +1,19 @@
1
1
  "use strict";
2
2
  /**
3
- * GanttDiagram generates a horizontal timeline / Gantt chart SVG.
3
+ * GanttDiagram - generates a horizontal timeline / Gantt chart SVG.
4
4
  *
5
5
  * Features:
6
6
  * - Left label column listing task/row names
7
7
  * - Right time-axis area with vertical gridlines (days / weeks / months)
8
8
  * - One horizontal bar per task, positioned/sized by its start & end dates
9
- * - Tasks grouped into sections, each colored from a rotated accent palette
9
+ * - Tasks grouped into sections
10
10
  * - Optional % complete overlay drawn on top of each bar
11
11
  * - Milestones rendered as diamonds
12
12
  * - Dependency arrows drawn between a task and the task it depends on
13
- * - Auto-sized SVG viewBox, light/dark theme aware
13
+ * - Auto-sized SVG viewBox
14
14
  *
15
15
  * The time scale is computed from the minimum start to the maximum end across
16
- * all tasks; dates are mapped linearly to x. Everything is deterministic
16
+ * all tasks; dates are mapped linearly to x. Everything is deterministic -
17
17
  * no Date.now()/new Date()-with-no-args/Math.random() is used.
18
18
  *
19
19
  * Usage:
@@ -58,24 +58,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
58
58
  exports.GanttDiagram = void 0;
59
59
  const fs = __importStar(require("fs"));
60
60
  const path = __importStar(require("path"));
61
- const palette_1 = require("./palette");
62
- const svg_dom_1 = require("./svg-dom");
63
- // ─── Industry design system ────────────────────────────────────────────────
64
- // Barlow / JetBrains Mono typography, hairline borders and square "blueprint"
65
- // corners are fixed by the Industry spec; accent + surface colours still route
66
- // through resolveAccent / resolveTheme so --color / --theme keep working.
67
- const IND_FONT_HEAD = '"Barlow Condensed", system-ui, sans-serif';
68
- const IND_FONT_BODY = '"Barlow", system-ui, sans-serif';
69
- const IND_FONT_MONO = 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace';
70
- const IND_HAIRLINE = 'rgba(29,31,32,0.16)';
71
- 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');";
72
- // ─── Internal helpers ──────────────────────────────────────────────────────
61
+ const svg_1 = require("./core/svg");
62
+ const theme_1 = require("./core/theme");
63
+ const layout_1 = require("./core/layout");
73
64
  const DAY_MS = 24 * 60 * 60 * 1000;
74
65
  function parseDate(s) {
75
66
  const t = new Date(s).getTime();
76
67
  return Number.isNaN(t) ? 0 : t;
77
68
  }
78
- // ─── Main class ────────────────────────────────────────────────────────────
79
69
  class GanttDiagram {
80
70
  constructor(options) {
81
71
  this.opts = {
@@ -88,7 +78,6 @@ class GanttDiagram {
88
78
  }
89
79
  /** Group tasks into sections preserving first-seen order. */
90
80
  buildSections() {
91
- const palettes = (0, palette_1.rotatedPalettes)(this.opts.color);
92
81
  const order = [];
93
82
  const map = new Map();
94
83
  this.opts.tasks.forEach((task, index) => {
@@ -99,16 +88,13 @@ class GanttDiagram {
99
88
  }
100
89
  map.get(key).push({ task, index });
101
90
  });
102
- return order.map((name, i) => ({
91
+ return order.map((name) => ({
103
92
  name,
104
- accent: palettes[i % palettes.length],
105
93
  tasks: map.get(name),
106
94
  }));
107
95
  }
108
- generate() {
109
- const { title, theme, color, axis, tasks } = this.opts;
110
- const accent = (0, palette_1.resolveAccent)(color);
111
- const t = (0, palette_1.resolveTheme)(theme);
96
+ build() {
97
+ const { title, axis, tasks } = this.opts;
112
98
  const LABEL_W = GanttDiagram.LABEL_W;
113
99
  const AXIS_W = GanttDiagram.AXIS_W;
114
100
  const HDR = GanttDiagram.HDR;
@@ -117,9 +103,8 @@ class GanttDiagram {
117
103
  const SECTION_H = GanttDiagram.SECTION_H;
118
104
  const BAR_PAD = GanttDiagram.BAR_PAD;
119
105
  const PAD = GanttDiagram.PAD;
120
- const FOOTER = GanttDiagram.FOOTER;
121
106
  const sections = this.buildSections();
122
- // ── Time scale: min start max end across all tasks ────────────────
107
+ // Time scale: min start to max end across all tasks.
123
108
  let minStart = Infinity;
124
109
  let maxEnd = -Infinity;
125
110
  for (const task of tasks) {
@@ -135,7 +120,7 @@ class GanttDiagram {
135
120
  if (!Number.isFinite(maxEnd) || maxEnd <= minStart)
136
121
  maxEnd = minStart + DAY_MS;
137
122
  const span = maxEnd - minStart;
138
- // ── Row layout: sections add a heading row each ─────────────────────
123
+ // Row layout: sections add a heading row each.
139
124
  const showSectionHeadings = sections.some((s) => s.name !== '');
140
125
  let bodyH = 0;
141
126
  for (const sec of sections) {
@@ -147,54 +132,40 @@ class GanttDiagram {
147
132
  const chartLeft = PAD;
148
133
  const axisLeft = chartLeft + LABEL_W;
149
134
  const svgW = LABEL_W + AXIS_W + 2 * PAD;
150
- const svgH = chartTop + bodyH + FOOTER + PAD;
151
- const doc = new svg_dom_1.SvgDocument(svgW, svgH);
135
+ const svgH = chartTop + bodyH + GanttDiagram.FOOTER + PAD;
136
+ const doc = new svg_1.SvgDocument(svgW, svgH);
152
137
  const svg = doc.root;
153
- const uid = title.replace(/\W/g, '') || 'gantt';
154
- // ── Map a date (ms) → x within the axis area ─────────────────────────
138
+ // Map a date (ms) to x within the axis area.
155
139
  const xForMs = (ms) => axisLeft + ((ms - minStart) / span) * AXIS_W;
156
140
  const xForDate = (s) => xForMs(parseDate(s));
157
- // ── Background + embedded Industry web-fonts ────────────────────────
158
- svg.child('rect', { class: 'canvas', width: svgW, height: svgH, fill: t.canvasBg });
159
- svg.child('style').text(IND_FONT_IMPORT);
160
- // ── Defs: arrow marker (solid accent header — no gradient) ──────────
161
- const marker = doc
162
- .defs()
163
- .child('marker', {
164
- id: `arrow${uid}`,
165
- markerWidth: 8,
166
- markerHeight: 8,
167
- refX: 6,
168
- refY: 3,
169
- orient: 'auto',
170
- markerUnits: 'userSpaceOnUse',
171
- });
172
- marker.child('path', { d: 'M0,0 L6,3 L0,6 Z', fill: t.textSecondary });
173
- // ── Header bar ──────────────────────────────────────────────────────
141
+ svg.child('rect', { class: 'canvas', width: svgW, height: svgH, fill: theme_1.INK.ground });
142
+ (0, layout_1.defineArrowhead)(doc.defs(), 'ganttArrow');
143
+ // Header bar.
174
144
  svg.child('rect', {
175
145
  class: 'header',
176
146
  x: chartLeft,
177
147
  y: PAD,
178
148
  width: LABEL_W + AXIS_W,
179
149
  height: HDR,
180
- fill: accent.mid,
150
+ fill: theme_1.INK.wash,
151
+ stroke: theme_1.INK.line,
152
+ 'stroke-width': theme_1.STROKE.hair,
181
153
  });
182
154
  svg
183
155
  .child('text', {
184
156
  x: chartLeft + 18,
185
157
  y: PAD + 40,
186
- 'font-family': IND_FONT_HEAD,
187
- 'font-size': 22,
188
- 'font-weight': 600,
189
- fill: '#FFFFFF',
158
+ 'font-family': theme_1.FONT.family,
159
+ 'font-size': theme_1.FONT.title + 9,
160
+ 'font-weight': 'bold',
161
+ fill: theme_1.INK.line,
190
162
  })
191
163
  .text(title);
192
- // ── Axis area geometry ──────────────────────────────────────────────
164
+ // Axis area geometry.
193
165
  const axisTop = PAD + HDR;
194
166
  const chartBottom = chartTop + bodyH;
195
- // ── Gridlines + axis tick labels ────────────────────────────────────
167
+ // Gridlines + axis tick labels.
196
168
  const step = axis === 'days' ? DAY_MS : axis === 'months' ? 30 * DAY_MS : 7 * DAY_MS;
197
- // Iterate from minStart to maxEnd inclusive, drawing a vertical line at each tick.
198
169
  for (let ms = minStart; ms <= maxEnd + 1; ms += step) {
199
170
  const x = xForMs(Math.min(ms, maxEnd));
200
171
  svg.child('line', {
@@ -203,8 +174,8 @@ class GanttDiagram {
203
174
  y1: axisTop + AXIS_HDR,
204
175
  x2: x,
205
176
  y2: chartBottom,
206
- stroke: t.border,
207
- 'stroke-width': 1,
177
+ stroke: theme_1.INK.line,
178
+ 'stroke-width': theme_1.STROKE.hair,
208
179
  });
209
180
  const label = new Date(ms).toISOString().slice(0, 10);
210
181
  svg
@@ -212,9 +183,9 @@ class GanttDiagram {
212
183
  class: 'axis-tick',
213
184
  x: x + 3,
214
185
  y: axisTop + AXIS_HDR - 8,
215
- 'font-family': IND_FONT_MONO,
216
- 'font-size': 9,
217
- fill: t.textSecondary,
186
+ 'font-family': theme_1.FONT.mono,
187
+ 'font-size': theme_1.FONT.small - 1,
188
+ fill: theme_1.INK.muted,
218
189
  })
219
190
  .text(label);
220
191
  }
@@ -225,8 +196,8 @@ class GanttDiagram {
225
196
  y1: axisTop + AXIS_HDR,
226
197
  x2: xForMs(maxEnd),
227
198
  y2: chartBottom,
228
- stroke: t.border,
229
- 'stroke-width': 1,
199
+ stroke: theme_1.INK.line,
200
+ 'stroke-width': theme_1.STROKE.hair,
230
201
  });
231
202
  // Separator between label column and axis.
232
203
  svg.child('line', {
@@ -235,11 +206,11 @@ class GanttDiagram {
235
206
  y1: axisTop,
236
207
  x2: axisLeft,
237
208
  y2: chartBottom,
238
- stroke: t.border,
239
- 'stroke-width': 1.5,
209
+ stroke: theme_1.INK.line,
210
+ 'stroke-width': theme_1.STROKE.heavy,
240
211
  });
241
- // ── Rows: sections + tasks + bars ───────────────────────────────────
242
- // Track each task's bar geometry by name for dependency arrows.
212
+ // Rows: sections + tasks + bars. Track each task's bar geometry by name
213
+ // for dependency arrows.
243
214
  const barGeom = new Map();
244
215
  let y = chartTop;
245
216
  for (const sec of sections) {
@@ -250,7 +221,7 @@ class GanttDiagram {
250
221
  y,
251
222
  width: LABEL_W + AXIS_W,
252
223
  height: SECTION_H,
253
- fill: sec.accent.light,
224
+ fill: theme_1.INK.wash,
254
225
  });
255
226
  svg.child('rect', {
256
227
  class: 'section-accent',
@@ -258,17 +229,17 @@ class GanttDiagram {
258
229
  y,
259
230
  width: 5,
260
231
  height: SECTION_H,
261
- fill: sec.accent.mid,
232
+ fill: theme_1.INK.line,
262
233
  });
263
234
  svg
264
235
  .child('text', {
265
236
  class: 'section-label',
266
237
  x: chartLeft + 16,
267
238
  y: y + SECTION_H / 2 + 4,
268
- 'font-family': IND_FONT_BODY,
269
- 'font-size': 12,
270
- 'font-weight': 700,
271
- fill: sec.accent.text,
239
+ 'font-family': theme_1.FONT.family,
240
+ 'font-size': theme_1.FONT.body + 1,
241
+ 'font-weight': 'bold',
242
+ fill: theme_1.INK.line,
272
243
  'letter-spacing': 0.5,
273
244
  })
274
245
  .text(sec.name);
@@ -277,19 +248,18 @@ class GanttDiagram {
277
248
  for (const { task } of sec.tasks) {
278
249
  const rowY = y;
279
250
  const midY = rowY + ROW_H / 2;
280
- // Row label
281
- const dispName = task.name.length > 26 ? task.name.slice(0, 25) + '…' : task.name;
251
+ // Row label.
282
252
  svg
283
253
  .child('text', {
284
254
  class: 'task-label',
285
255
  x: chartLeft + 14,
286
256
  y: midY + 4,
287
- 'font-family': IND_FONT_BODY,
288
- 'font-size': 12,
289
- 'font-weight': 600,
290
- fill: t.textPrimary,
257
+ 'font-family': theme_1.FONT.family,
258
+ 'font-size': theme_1.FONT.body + 1,
259
+ 'font-weight': 'bold',
260
+ fill: theme_1.INK.line,
291
261
  })
292
- .text(dispName);
262
+ .text((0, layout_1.truncate)(task.name, LABEL_W - 24, theme_1.FONT.body + 1));
293
263
  const sx = xForDate(task.start);
294
264
  const ex = xForDate(task.end);
295
265
  if (task.milestone) {
@@ -300,9 +270,9 @@ class GanttDiagram {
300
270
  svg.child('path', {
301
271
  class: 'milestone',
302
272
  d: `M${cx},${cy - r} L${cx + r},${cy} L${cx},${cy + r} L${cx - r},${cy} Z`,
303
- fill: sec.accent.from,
304
- stroke: sec.accent.mid,
305
- 'stroke-width': 1.5,
273
+ fill: theme_1.INK.line,
274
+ stroke: theme_1.INK.line,
275
+ 'stroke-width': theme_1.STROKE.hair,
306
276
  });
307
277
  barGeom.set(task.name, { x: cx - r, y: cy - r, w: 2 * r, h: 2 * r });
308
278
  }
@@ -310,17 +280,18 @@ class GanttDiagram {
310
280
  const barY = rowY + BAR_PAD;
311
281
  const barH = ROW_H - 2 * BAR_PAD;
312
282
  const barW = Math.max(2, ex - sx);
313
- // Full bar
283
+ // Full bar.
314
284
  svg.child('rect', {
315
285
  class: 'bar',
316
286
  x: sx,
317
287
  y: barY,
318
288
  width: barW,
319
289
  height: barH,
320
- fill: sec.accent.mid,
321
- opacity: 0.85,
290
+ fill: theme_1.INK.wash,
291
+ stroke: theme_1.INK.line,
292
+ 'stroke-width': theme_1.STROKE.hair,
322
293
  });
323
- // % complete overlay
294
+ // % complete overlay.
324
295
  if (typeof task.percent === 'number' && task.percent > 0) {
325
296
  const pct = Math.max(0, Math.min(100, task.percent));
326
297
  svg.child('rect', {
@@ -329,17 +300,17 @@ class GanttDiagram {
329
300
  y: barY,
330
301
  width: Math.max(1, (barW * pct) / 100),
331
302
  height: barH,
332
- fill: sec.accent.from,
303
+ fill: theme_1.INK.line,
333
304
  });
334
305
  svg
335
306
  .child('text', {
336
307
  class: 'bar-pct',
337
308
  x: sx + barW + 6,
338
309
  y: midY + 4,
339
- 'font-family': IND_FONT_MONO,
340
- 'font-size': 10,
341
- 'font-weight': 700,
342
- fill: t.textSecondary,
310
+ 'font-family': theme_1.FONT.mono,
311
+ 'font-size': theme_1.FONT.small - 1,
312
+ 'font-weight': 'bold',
313
+ fill: theme_1.INK.muted,
343
314
  })
344
315
  .text(`${pct}%`);
345
316
  }
@@ -348,7 +319,7 @@ class GanttDiagram {
348
319
  y += ROW_H;
349
320
  }
350
321
  }
351
- // ── Dependency arrows ───────────────────────────────────────────────
322
+ // Dependency arrows.
352
323
  for (const task of tasks) {
353
324
  if (!task.dependsOn)
354
325
  continue;
@@ -365,27 +336,30 @@ class GanttDiagram {
365
336
  class: 'dependency',
366
337
  d: `M${x1},${y1} C${midX},${y1} ${midX},${y2} ${x2},${y2}`,
367
338
  fill: 'none',
368
- stroke: t.textSecondary,
369
- 'stroke-width': 1.5,
339
+ stroke: theme_1.INK.line,
340
+ 'stroke-width': theme_1.STROKE.hair,
370
341
  'stroke-dasharray': '4 3',
371
- 'marker-end': `url(#arrow${uid})`,
342
+ 'marker-end': 'url(#ganttArrow)',
372
343
  });
373
344
  }
374
- // ── Footer ──────────────────────────────────────────────────────────
345
+ // Footer.
375
346
  const footerY = chartBottom + 10;
376
347
  svg
377
348
  .child('text', {
378
349
  class: 'footer',
379
350
  x: chartLeft + 2,
380
351
  y: footerY + 22,
381
- 'font-family': IND_FONT_BODY,
382
- 'font-size': 11,
383
- fill: t.textSecondary,
352
+ 'font-family': theme_1.FONT.family,
353
+ 'font-size': theme_1.FONT.small + 2,
354
+ fill: theme_1.INK.muted,
384
355
  })
385
- .text(`${tasks.length} task${tasks.length !== 1 ? 's' : ''} · ${new Date(minStart)
356
+ .text(`${tasks.length} task${tasks.length !== 1 ? 's' : ''}, ${new Date(minStart)
386
357
  .toISOString()
387
- .slice(0, 10)} ${new Date(maxEnd).toISOString().slice(0, 10)}`);
388
- return doc.toString('Generated by ts-prorm-orm GanttDiagram');
358
+ .slice(0, 10)} - ${new Date(maxEnd).toISOString().slice(0, 10)}`);
359
+ return doc;
360
+ }
361
+ generate() {
362
+ return this.build().toString('Generated by ts-prorm-orm GanttDiagram');
389
363
  }
390
364
  /**
391
365
  * Write the SVG to a file. Creates parent directories if needed.
@@ -1,18 +1,14 @@
1
1
  /**
2
- * IndexDiagram an INDEX & CONSTRAINT MAP for a single table.
2
+ * IndexDiagram - an INDEX & CONSTRAINT MAP for a single table.
3
3
  *
4
4
  * A table's columns are laid out as a horizontal strip of "column chips".
5
5
  * Below the strip, every index/constraint is drawn as a labeled "bracket" that
6
- * spans the column chips it covers so composite indexes visibly span multiple
6
+ * spans the column chips it covers - so composite indexes visibly span multiple
7
7
  * columns and overlapping coverage is obvious at a glance.
8
8
  *
9
9
  * Index kinds (PRIMARY / UNIQUE / INDEX / FULLTEXT / FOREIGN KEY / CHECK) are
10
- * distinguished by color + a short badge; each row also shows the index name,
11
- * its access method (btree/hash/gin) and whether it is unique.
12
- *
13
- * `--theme light|dark` drives the canvas/text colors and `--color <name|hex>`
14
- * drives the accent used for the header and the PRIMARY index — both genuinely
15
- * change fill/stroke values in the generated SVG.
10
+ * distinguished by a short ASCII badge; each row also shows the index name,
11
+ * its access method (btree/hash/gin...) and whether it is unique.
16
12
  *
17
13
  * Usage:
18
14
  * const diag = new IndexDiagram({ table: 'users', columns: [...], indexes: [...] });
@@ -37,8 +33,12 @@ export interface IndexDiagramOptions {
37
33
  columns: IdxColumn[];
38
34
  indexes: IdxIndex[];
39
35
  title?: string;
36
+ /**
37
+ * Accepted for backward compatibility and ignored: diagrams render in a
38
+ * single monochrome theme.
39
+ */
40
40
  theme?: 'light' | 'dark';
41
- /** Custom accent color (named palette or hex) for header + PRIMARY index */
41
+ /** Accepted for backward compatibility and ignored. */
42
42
  color?: string;
43
43
  }
44
44
  export declare class IndexDiagram {
@@ -52,9 +52,9 @@ export declare class IndexDiagram {
52
52
  private static readonly ROW_H;
53
53
  private static readonly LABEL_W;
54
54
  private static readonly MIN_CHIP_W;
55
- private static readonly R;
56
55
  constructor(options: IndexDiagramOptions);
57
56
  private chipWidth;
57
+ private build;
58
58
  generate(): string;
59
59
  /** Write the SVG to a file. Creates parent directories if needed. */
60
60
  save(outputPath: string): string;