gantt-renderer 0.2.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # [0.4.0](https://github.com/doberkofler/gantt-renderer/compare/v0.2.0...v0.4.0) (2026-05-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * correct link routing geometry and dependency layer rendering ([d00de8a](https://github.com/doberkofler/gantt-renderer/commit/d00de8a8b51d69b7b50ec4c6bf0ce6dd3657e1a8))
7
+ * improve lint rules ([1644377](https://github.com/doberkofler/gantt-renderer/commit/1644377da0294838a77386ac4d74832c289fcbfb))
8
+ * **interaction:** deep-clone input in update() to prevent drag mutations leaking to consumer data ([ce814a0](https://github.com/doberkofler/gantt-renderer/commit/ce814a02bb87230108635ae663f165497f522f7e)), closes [#patchTask](https://github.com/doberkofler/gantt-renderer/issues/patchTask)
9
+ * prevent spurious onTaskMove callback on double-click in timeline ([14976d0](https://github.com/doberkofler/gantt-renderer/commit/14976d0ca8e17bf0b47b34a91e184513e316e811))
10
+ * **rendering:** offset multi-row link midpoint to avoid bar center slicing ([1fe09fa](https://github.com/doberkofler/gantt-renderer/commit/1fe09fa3d736cf948035c4f1619f398fa374464d))
11
+
12
+
13
+ ### Features
14
+
15
+ * add custom tooltip support with onTooltipText callback ([eacc7a8](https://github.com/doberkofler/gantt-renderer/commit/eacc7a845d346f007b4c7ad5a9ed901f9d2e8d60))
16
+ * add readonly support for tasks and links ([48cd946](https://github.com/doberkofler/gantt-renderer/commit/48cd946fe0b22bbcba18cb6b8e04d62d285300a0))
17
+ * **interaction:** add progress bar drag with progressDragEnabled option ([77833b5](https://github.com/doberkofler/gantt-renderer/commit/77833b50b5984158bd9a2ab3ddcc744d05ccb18f))
18
+
1
19
  # [0.2.0](https://github.com/doberkofler/gantt-renderer/compare/v0.1.3...v0.2.0) (2026-05-07)
2
20
 
3
21
 
package/README.md CHANGED
@@ -30,7 +30,7 @@ optimize timelines, resolve resource constraints, or perform planning logic itse
30
30
 
31
31
  ## Scope
32
32
 
33
- The library is designed as a core chart component (`src/gantt-chart/**/*`) that your product can
33
+ The library is designed as a core chart component (`src/lib/**/*`) that your product can
34
34
  embed. Outer-page/demo concerns (export toolbars, fullscreen shell controls, demo-only control
35
35
  rows) are intentionally outside the core scope.
36
36
 
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { z } from "zod";
2
2
 
3
- //#region src/gantt-chart/validation/schemas.d.ts
3
+ //#region src/lib/validation/schemas.d.ts
4
4
  declare const LinkTypeSchema: z.ZodEnum<{
5
5
  FS: "FS";
6
6
  SS: "SS";
7
7
  FF: "FF";
8
8
  SF: "SF";
9
9
  }>;
10
- declare const TaskTypeSchema: z.ZodEnum<{
10
+ declare const TaskKindSchema: z.ZodEnum<{
11
11
  task: "task";
12
12
  project: "project";
13
13
  milestone: "milestone";
@@ -25,21 +25,39 @@ declare const SpecialDaySchema: z.ZodObject<{
25
25
  label: z.ZodOptional<z.ZodString>;
26
26
  className: z.ZodOptional<z.ZodString>;
27
27
  }, z.core.$strip>;
28
- declare const TaskSchema: z.ZodObject<{
28
+ declare const TaskSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
+ kind: z.ZodLiteral<"task">;
30
+ durationHours: z.ZodNumber;
31
+ percentComplete: z.ZodDefault<z.ZodNumber>;
29
32
  id: z.ZodNumber;
30
33
  text: z.ZodString;
31
34
  startDate: z.ZodString;
32
- durationHours: z.ZodNumber;
33
35
  parent: z.ZodOptional<z.ZodNumber>;
36
+ color: z.ZodOptional<z.ZodString>;
37
+ readonly: z.ZodOptional<z.ZodBoolean>;
38
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ kind: z.ZodLiteral<"project">;
41
+ durationHours: z.ZodNumber;
34
42
  percentComplete: z.ZodDefault<z.ZodNumber>;
35
- type: z.ZodDefault<z.ZodEnum<{
36
- task: "task";
37
- project: "project";
38
- milestone: "milestone";
39
- }>>;
40
43
  open: z.ZodDefault<z.ZodBoolean>;
44
+ id: z.ZodNumber;
45
+ text: z.ZodString;
46
+ startDate: z.ZodString;
47
+ parent: z.ZodOptional<z.ZodNumber>;
41
48
  color: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>;
49
+ readonly: z.ZodOptional<z.ZodBoolean>;
50
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ kind: z.ZodLiteral<"milestone">;
53
+ id: z.ZodNumber;
54
+ text: z.ZodString;
55
+ startDate: z.ZodString;
56
+ parent: z.ZodOptional<z.ZodNumber>;
57
+ color: z.ZodOptional<z.ZodString>;
58
+ readonly: z.ZodOptional<z.ZodBoolean>;
59
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
60
+ }, z.core.$strip>], "kind">;
43
61
  declare const LinkSchema: z.ZodObject<{
44
62
  id: z.ZodNumber;
45
63
  source: z.ZodNumber;
@@ -50,23 +68,43 @@ declare const LinkSchema: z.ZodObject<{
50
68
  FF: "FF";
51
69
  SF: "SF";
52
70
  }>>;
71
+ readonly: z.ZodOptional<z.ZodBoolean>;
72
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
53
73
  }, z.core.$strip>;
54
74
  declare const GanttInputSchema: z.ZodObject<{
55
- tasks: z.ZodArray<z.ZodObject<{
75
+ tasks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
76
+ kind: z.ZodLiteral<"task">;
77
+ durationHours: z.ZodNumber;
78
+ percentComplete: z.ZodDefault<z.ZodNumber>;
56
79
  id: z.ZodNumber;
57
80
  text: z.ZodString;
58
81
  startDate: z.ZodString;
59
- durationHours: z.ZodNumber;
60
82
  parent: z.ZodOptional<z.ZodNumber>;
83
+ color: z.ZodOptional<z.ZodString>;
84
+ readonly: z.ZodOptional<z.ZodBoolean>;
85
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
86
+ }, z.core.$strip>, z.ZodObject<{
87
+ kind: z.ZodLiteral<"project">;
88
+ durationHours: z.ZodNumber;
61
89
  percentComplete: z.ZodDefault<z.ZodNumber>;
62
- type: z.ZodDefault<z.ZodEnum<{
63
- task: "task";
64
- project: "project";
65
- milestone: "milestone";
66
- }>>;
67
90
  open: z.ZodDefault<z.ZodBoolean>;
91
+ id: z.ZodNumber;
92
+ text: z.ZodString;
93
+ startDate: z.ZodString;
94
+ parent: z.ZodOptional<z.ZodNumber>;
68
95
  color: z.ZodOptional<z.ZodString>;
69
- }, z.core.$strip>>;
96
+ readonly: z.ZodOptional<z.ZodBoolean>;
97
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
98
+ }, z.core.$strip>, z.ZodObject<{
99
+ kind: z.ZodLiteral<"milestone">;
100
+ id: z.ZodNumber;
101
+ text: z.ZodString;
102
+ startDate: z.ZodString;
103
+ parent: z.ZodOptional<z.ZodNumber>;
104
+ color: z.ZodOptional<z.ZodString>;
105
+ readonly: z.ZodOptional<z.ZodBoolean>;
106
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
107
+ }, z.core.$strip>], "kind">>;
70
108
  links: z.ZodDefault<z.ZodArray<z.ZodObject<{
71
109
  id: z.ZodNumber;
72
110
  source: z.ZodNumber;
@@ -77,19 +115,25 @@ declare const GanttInputSchema: z.ZodObject<{
77
115
  FF: "FF";
78
116
  SF: "SF";
79
117
  }>>;
118
+ readonly: z.ZodOptional<z.ZodBoolean>;
119
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
80
120
  }, z.core.$strip>>>;
81
121
  }, z.core.$strip>;
82
122
  /** The raw, unvalidated input shape that consumers pass to {@link parseGanttInput}. */
83
123
  type GanttInputRaw = z.input<typeof GanttInputSchema>;
84
124
  /** Allowed dependency link type values: `'FS'`, `'SS'`, `'FF'`, or `'SF'`. */
85
125
  type LinkType = z.infer<typeof LinkTypeSchema>;
86
- /** Allowed task type values: `'task'`, `'project'`, or `'milestone'`. */
87
- type TaskType = z.infer<typeof TaskTypeSchema>;
126
+ /** Allowed task kind values: `'task'`, `'project'`, or `'milestone'`. */
127
+ type TaskKind = z.infer<typeof TaskKindSchema>;
88
128
  type SpecialDayKind = z.infer<typeof SpecialDayKindSchema>;
89
129
  type SpecialDay = z.infer<typeof SpecialDaySchema>;
90
130
  /**
91
- * A project task in the Gantt chart. Defines timing (start date, duration in hours),
92
- * hierarchy (parent id), and visual properties (type, percentComplete, color).
131
+ * A task in the Gantt chart discriminated by `kind` into leaf tasks,
132
+ * summary projects, and milestones.
133
+ *
134
+ * - **`kind: 'task'`** — A regular task with a colored bar and duration.
135
+ * - **`kind: 'project'`** — A summary/group row with a colored bar and optional tree state.
136
+ * - **`kind: 'milestone'`** — A zero-duration marker rendered as a diamond.
93
137
  */
94
138
  type Task = z.infer<typeof TaskSchema>;
95
139
  /**
@@ -112,15 +156,8 @@ type GanttInput = z.infer<typeof GanttInputSchema>;
112
156
  * @throws {import('zod').ZodError} On schema validation failure.
113
157
  */
114
158
  declare function parseGanttInput(raw: GanttInputRaw): GanttInput;
115
- /**
116
- * Parses without throwing; returns `null` on validation failure.
117
- *
118
- * @param raw - The unvalidated input from the consumer.
119
- * @returns The parsed {@link GanttInput} or `null` when the input is invalid.
120
- */
121
- declare function safeParseGanttInput(raw: GanttInputRaw): GanttInput | null;
122
159
  //#endregion
123
- //#region src/gantt-chart/timeline/scale.d.ts
160
+ //#region src/lib/timeline/scale.d.ts
124
161
  type TimeScale = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
125
162
  type ScaleConfig = {
126
163
  /** Pixel width of one column unit */columnWidth: number; /** Milliseconds per column unit */
@@ -129,7 +166,7 @@ type ScaleConfig = {
129
166
  };
130
167
  declare const SCALE_CONFIGS: Record<TimeScale, ScaleConfig>;
131
168
  //#endregion
132
- //#region src/gantt-chart/domain/tree.d.ts
169
+ //#region src/lib/domain/tree.d.ts
133
170
  /**
134
171
  * A task node in the render tree, combining the flat {@link Task} input data
135
172
  * with computed hierarchy structure.
@@ -147,7 +184,9 @@ type TaskNode = Task & {
147
184
  *
148
185
  * @param tasks - The flat array of tasks to convert into a tree.
149
186
  * @returns Root-level {@link TaskNode} instances with populated `children`.
150
- * @throws {GanttError} When a task references a `parent` id that does not exist.
187
+ * @throws {GanttError} When a task references a `parent` id that does not exist,
188
+ * when a parent cycle is detected, or when a `parent` points to a
189
+ * milestone or leaf task.
151
190
  */
152
191
  declare function buildTaskTree(tasks: Task[]): TaskNode[];
153
192
  /**
@@ -167,7 +206,7 @@ declare function flattenTree(roots: TaskNode[], expandedIds: ReadonlySet<number>
167
206
  */
168
207
  declare function isParent(node: TaskNode): boolean;
169
208
  //#endregion
170
- //#region src/gantt-chart/timeline/pixelMapper.d.ts
209
+ //#region src/lib/timeline/pixelMapper.d.ts
171
210
  type PixelMapper = {
172
211
  /** Date → x pixel offset from viewport start */toX: (date: Date) => number; /** x pixel offset → Date */
173
212
  toDate: (x: number) => Date; /** Hours → pixel width */
@@ -186,7 +225,7 @@ type PixelMapper = {
186
225
  */
187
226
  declare function createPixelMapper(scale: TimeScale, viewportStart: Date): PixelMapper;
188
227
  //#endregion
189
- //#region src/gantt-chart/timeline/layoutEngine.d.ts
228
+ //#region src/lib/timeline/layoutEngine.d.ts
190
229
  declare const DENSITY: {
191
230
  readonly rowHeight: 44;
192
231
  readonly barHeight: 28;
@@ -205,7 +244,7 @@ type BarLayout = {
205
244
  width: number;
206
245
  height: number;
207
246
  progressWidth: number;
208
- type: 'task' | 'project' | 'milestone';
247
+ kind: 'task' | 'project' | 'milestone';
209
248
  rowIndex: number; /** Center x; identical to x + width/2 or x for milestones */
210
249
  centerX: number;
211
250
  centerY: number;
@@ -228,7 +267,7 @@ declare function computeLayout(rows: TaskNode[], mapper: PixelMapper): Map<numbe
228
267
  */
229
268
  declare function deriveViewport(tasks: TaskNode[], paddingHours?: number): [Date, Date];
230
269
  //#endregion
231
- //#region src/gantt-chart/locale.d.ts
270
+ //#region src/lib/locale.d.ts
232
271
  type LocaleLabelKey = 'ariaTask' | 'ariaMilestone' | 'addSubtaskTitle' | 'columnTaskName' | 'columnStartDate' | 'columnDuration' | 'columnQuarter';
233
272
  type ChartLocale = {
234
273
  code: string;
@@ -293,7 +332,7 @@ declare function formatWeekNumber(date: Date, scheme: 'iso' | 'us' | 'simple'):
293
332
  */
294
333
  declare function formatLabel(template: string, arg: string): string;
295
334
  //#endregion
296
- //#region src/gantt-chart/domain/dependencies.d.ts
335
+ //#region src/lib/domain/dependencies.d.ts
297
336
  /**
298
337
  * Detects circular dependencies in the link graph using DFS tri-colour marking.
299
338
  *
@@ -303,15 +342,18 @@ declare function formatLabel(template: string, arg: string): string;
303
342
  */
304
343
  declare function detectCycles(tasks: Task[], links: Link[]): void;
305
344
  /**
306
- * Validates that every link references existing task IDs.
345
+ * Validates that every link references existing task IDs and that no
346
+ * duplicate (source, target) pairs exist.
307
347
  *
308
348
  * @param tasks - The task list (used as the reference set of valid IDs).
309
349
  * @param links - The dependency links to validate.
310
- * @throws {GanttError} When any link references a non-existent source or target task.
350
+ * @throws {GanttError} When any link references a non-existent source or target task,
351
+ * when a non-FS link connects to/from a milestone, or when duplicate
352
+ * (source, target) pairs exist.
311
353
  */
312
354
  declare function validateLinkRefs(tasks: Task[], links: Link[]): void;
313
355
  //#endregion
314
- //#region src/gantt-chart/domain/dateMath.d.ts
356
+ //#region src/lib/domain/dateMath.d.ts
315
357
  /**
316
358
  * Parses `YYYY-MM-DD` → UTC midnight `Date`.
317
359
  *
@@ -353,7 +395,7 @@ declare function diffDays(a: Date, b: Date): number;
353
395
  */
354
396
  declare function diffHours(a: Date, b: Date): number;
355
397
  //#endregion
356
- //#region src/gantt-chart/rendering/linkRouter.d.ts
398
+ //#region src/lib/rendering/linkRouter.d.ts
357
399
  type Point = {
358
400
  x: number;
359
401
  y: number;
@@ -361,7 +403,8 @@ type Point = {
361
403
  type RoutedLink = {
362
404
  linkId: number;
363
405
  sourceTaskId: number;
364
- targetTaskId: number; /** Ordered vertices of the orthogonal polyline (source → target). */
406
+ targetTaskId: number;
407
+ type: LinkType; /** Ordered vertices of the orthogonal polyline (source → target). */
365
408
  points: Point[];
366
409
  };
367
410
  /**
@@ -369,20 +412,26 @@ type RoutedLink = {
369
412
  * Links whose source or target is not in the layout map are skipped silently
370
413
  * (e.g. when the row is collapsed).
371
414
  *
372
- * @param links - The dependency links to route.
415
+ * @param links - The dependency links to route.
373
416
  * @param layouts - A map from task ID to its computed {@link BarLayout}.
374
417
  * @returns An array of {@link RoutedLink} objects with computed vertex paths.
375
418
  */
376
419
  declare function routeLinks(links: Link[], layouts: Map<number, BarLayout>): RoutedLink[];
377
420
  //#endregion
378
- //#region src/gantt-chart/vanilla/dom/gridColumns.d.ts
421
+ //#region src/lib/vanilla/dom/gridColumns.d.ts
422
+ /**
423
+ * Union of all field names that can appear on any {@link Task} variant.
424
+ * Use when referencing task fields in grid column schemas that apply
425
+ * across a heterogeneous set of task kinds.
426
+ */
427
+ type TaskDataField = keyof Task | 'durationHours' | 'percentComplete' | 'open';
379
428
  type GridColumn = {
380
429
  id: string;
381
430
  header: string;
382
431
  width: string;
383
432
  align?: 'left' | 'center' | 'right';
384
433
  visible?: boolean;
385
- field?: keyof Task;
434
+ field?: TaskDataField;
386
435
  format?: (value: unknown, task: Task, row: TaskNode, locale: ChartLocale) => string;
387
436
  };
388
437
  declare const DEFAULT_GRID_COLUMNS: GridColumn[];
@@ -418,50 +467,78 @@ declare const GRID_COLUMN_FR_MIN_WIDTH = 120;
418
467
  */
419
468
  declare function gridNaturalWidth(columns: GridColumn[]): number;
420
469
  //#endregion
421
- //#region src/gantt-chart/vanilla/gantt-chart.d.ts
422
- type OnTaskSelect = (taskId: number | null) => void;
470
+ //#region src/lib/vanilla/gantt-chart.d.ts
471
+ type OnTaskClick = (payload: {
472
+ task: Task;
473
+ instance: GanttInstance;
474
+ }) => void | Promise<void>;
423
475
  type OnTaskMove = (payload: {
424
- id: number;
425
- startDate: Date;
426
- }) => void;
476
+ task: Task;
477
+ newStartDate: Date;
478
+ instance: GanttInstance;
479
+ }) => boolean | Promise<boolean>;
427
480
  type OnTaskResize = (payload: {
428
- id: number;
429
- durationHours: number;
430
- }) => void;
481
+ task: Task;
482
+ newDurationHours: number;
483
+ instance: GanttInstance;
484
+ }) => boolean | Promise<boolean>;
431
485
  type OnTaskAdd = (payload: {
432
- parentId: number;
433
- }) => void;
486
+ parentTask: Task;
487
+ instance: GanttInstance;
488
+ }) => boolean | Promise<boolean>;
434
489
  type OnTaskDoubleClick = (payload: {
435
- id: number;
436
- source: 'grid' | 'bar' | 'milestone';
437
- }) => void;
438
- type OnTaskEditIntent = (payload: {
439
- id: number;
440
- source: 'grid' | 'bar' | 'milestone';
441
- trigger: 'doubleClick';
442
490
  task: Task;
443
- }) => void;
491
+ instance: GanttInstance;
492
+ }) => void | Promise<void>;
444
493
  type OnLinkCreate = (payload: {
445
- sourceTaskId: number;
446
- targetTaskId: number;
447
494
  type: 'FS';
448
- }) => void;
495
+ sourceTask: Task;
496
+ targetTask: Task;
497
+ instance: GanttInstance;
498
+ }) => boolean | Promise<boolean>;
499
+ type OnLinkClick = (payload: {
500
+ link: Link;
501
+ instance: GanttInstance;
502
+ }) => void | Promise<void>;
503
+ type OnLinkDblClick = (payload: {
504
+ link: Link;
505
+ instance: GanttInstance;
506
+ }) => void | Promise<void>;
507
+ type OnProgressChange = (payload: {
508
+ task: Task;
509
+ newPercentComplete: number;
510
+ instance: GanttInstance;
511
+ }) => boolean | Promise<boolean>;
512
+ type OnTooltipText = (payload: {
513
+ task: Task;
514
+ instance: GanttInstance;
515
+ }) => string | null;
449
516
  type GanttCallbacks = {
450
- onSelect?: OnTaskSelect;
451
- onMove?: OnTaskMove;
452
- onResize?: OnTaskResize;
453
- onAdd?: OnTaskAdd;
517
+ onTaskClick?: OnTaskClick;
518
+ onTaskMove?: OnTaskMove;
519
+ onTaskResize?: OnTaskResize;
520
+ onTaskAdd?: OnTaskAdd;
454
521
  onTaskDoubleClick?: OnTaskDoubleClick;
455
- onTaskEditIntent?: OnTaskEditIntent;
456
522
  onLinkCreate?: OnLinkCreate;
457
- onLeftPaneWidthChange?: (width: number) => void;
458
- onGridColumnsChange?: (columns: GridColumn[]) => void;
523
+ onLinkClick?: OnLinkClick;
524
+ onLinkDblClick?: OnLinkDblClick;
525
+ onProgressChange?: OnProgressChange;
526
+ onTooltipText?: OnTooltipText;
527
+ onLeftPaneWidthChange?: (payload: {
528
+ width: number;
529
+ instance: GanttInstance;
530
+ }) => void | Promise<void>;
531
+ onGridColumnsChange?: (payload: {
532
+ columns: GridColumn[];
533
+ instance: GanttInstance;
534
+ }) => void | Promise<void>;
459
535
  };
460
536
  type ThemeMode = 'light' | 'dark' | 'system';
461
537
  type GanttOptions = {
462
538
  scale?: TimeScale;
463
539
  highlightLinkedDependenciesOnSelect?: boolean;
464
540
  linkCreationEnabled?: boolean;
541
+ progressDragEnabled?: boolean;
465
542
  leftPaneWidth?: number;
466
543
  responsiveSplitPane?: boolean;
467
544
  mobileBreakpoint?: number;
@@ -477,11 +554,12 @@ type GanttOptions = {
477
554
  specialDays?: SpecialDay[];
478
555
  gridColumns?: GridColumn[];
479
556
  theme?: ThemeMode;
480
- } & GanttCallbacks;
557
+ };
481
558
  type GanttInstance = {
482
559
  update: (input: GanttInput) => void;
483
- setScale: (scale: TimeScale) => void;
484
- select: (id: number | null) => void;
560
+ setOptions: (opts: Partial<GanttOptions>) => void;
561
+ setCallbacks: (cbs: GanttCallbacks) => void;
562
+ select: (id: number | null, fireCallback?: boolean) => void;
485
563
  collapseAll: () => void;
486
564
  expandAll: () => void;
487
565
  destroy: () => void;
@@ -504,11 +582,20 @@ declare class GanttChart implements GanttInstance {
504
582
  /**
505
583
  * Constructs a new chart, builds the DOM, and wires internal event handling.
506
584
  * Data must be loaded via {@link update} before the chart renders.
585
+ * Callbacks must be set via {@link setCallbacks} before user interactions are handled.
507
586
  *
508
587
  * @param container - The host `HTMLElement` the chart will be appended to.
509
- * @param opts - Configuration and callback options.
588
+ * @param opts - Configuration options.
510
589
  */
511
590
  constructor(container: HTMLElement, opts?: GanttOptions);
591
+ /**
592
+ * Sets or replaces the chart's user-facing callbacks.
593
+ * Does not trigger a re-render.
594
+ *
595
+ * @param cbs - The {@link GanttCallbacks} to register.
596
+ * @throws {GanttError} When the instance has been destroyed.
597
+ */
598
+ setCallbacks(cbs: GanttCallbacks): void;
512
599
  /**
513
600
  * Replaces the full dataset and re-renders.
514
601
  *
@@ -517,19 +604,23 @@ declare class GanttChart implements GanttInstance {
517
604
  */
518
605
  update(newInput: GanttInput): void;
519
606
  /**
520
- * Switches the time scale and re-renders.
607
+ * Merges the supplied options into the current configuration and re-renders
608
+ * only the panes affected by the changed options.
521
609
  *
522
- * @param scale - The new {@link TimeScale} to display.
610
+ * @param opts - A partial {@link GanttOptions} object. Only the keys present
611
+ * in this parameter are updated; missing keys keep their
612
+ * previous values.
523
613
  * @throws {GanttError} When the instance has been destroyed.
524
614
  */
525
- setScale(scale: TimeScale): void;
615
+ setOptions(opts: Partial<GanttOptions>): void;
526
616
  /**
527
617
  * Programmatically selects or deselects a task.
528
618
  *
529
619
  * @param id - The task ID to select, or `null` to clear the selection.
620
+ * @param fireCallback - Whether to fire the `onTaskClick` callback. Default `true`.
530
621
  * @throws {GanttError} When the instance has been destroyed.
531
622
  */
532
- select(id: number | null): void;
623
+ select(id: number | null, fireCallback?: boolean): void;
533
624
  /**
534
625
  * Collapses all expandable groups in the task tree.
535
626
  *
@@ -549,8 +640,8 @@ declare class GanttChart implements GanttInstance {
549
640
  destroy(): void;
550
641
  }
551
642
  //#endregion
552
- //#region src/gantt-chart/errors.d.ts
553
- type GanttErrorCode = 'PARENT_REFERENCE' | 'LINK_REFERENCE' | 'DEPENDENCY_CYCLE' | 'INSTANCE_DESTROYED';
643
+ //#region src/lib/errors.d.ts
644
+ type GanttErrorCode = 'PARENT_REFERENCE' | 'PARENT_CYCLE' | 'LINK_REFERENCE' | 'DEPENDENCY_CYCLE' | 'MILESTONE_LINK_TYPE' | 'DUPLICATE_LINK_PAIR' | 'INSTANCE_DESTROYED';
554
645
  /**
555
646
  * Domain-specific error with a machine-readable {@link GanttErrorCode}.
556
647
  */
@@ -563,5 +654,5 @@ declare class GanttError extends Error {
563
654
  constructor(code: GanttErrorCode, message: string);
564
655
  }
565
656
  //#endregion
566
- export { BAR_HEIGHT, BAR_Y_OFFSET, type BarLayout, CHART_LOCALE_EN_US, type ChartLocale, DEFAULT_GRID_COLUMNS, DENSITY, EN_US_LABELS, GRID_COLUMN_FR_MIN_WIDTH, type GanttCallbacks, GanttChart, GanttError, type GanttErrorCode, type GanttInput, type GanttInputRaw, GanttInputSchema, type GanttInstance, type GanttOptions, type GridColumn, type Link, LinkSchema, type LinkType, LinkTypeSchema, type LocaleLabelKey, MILESTONE_HALF, MILESTONE_SIZE, type OnLinkCreate, type OnTaskAdd, type OnTaskDoubleClick, type OnTaskEditIntent, type OnTaskMove, type OnTaskResize, type OnTaskSelect, type PixelMapper, type Point, ROW_HEIGHT, type RoutedLink, SCALE_CONFIGS, type ScaleConfig, type SpecialDay, type SpecialDayKind, SpecialDayKindSchema, SpecialDaySchema, type Task, type TaskNode, TaskSchema, type TaskType, TaskTypeSchema, type ThemeMode, type TimeScale, addDays, addHours, buildTaskTree, computeLayout, createPixelMapper, deriveViewport, deriveWeekNumbering, deriveWeekStartsOn, deriveWeekendDays, detectCycles, diffDays, diffHours, flattenTree, formatLabel, formatWeekNumber, gridColumnDefaults, gridNaturalWidth, gridTemplateColumns, isParent, parseDate, parseGanttInput, resolveChartLocale, routeLinks, safeParseGanttInput, validateLinkRefs, visibleColumns };
657
+ export { BAR_HEIGHT, BAR_Y_OFFSET, type BarLayout, CHART_LOCALE_EN_US, type ChartLocale, DEFAULT_GRID_COLUMNS, DENSITY, EN_US_LABELS, GRID_COLUMN_FR_MIN_WIDTH, type GanttCallbacks, GanttChart, GanttError, type GanttErrorCode, type GanttInput, type GanttInputRaw, GanttInputSchema, type GanttInstance, type GanttOptions, type GridColumn, type Link, LinkSchema, type LinkType, LinkTypeSchema, type LocaleLabelKey, MILESTONE_HALF, MILESTONE_SIZE, type OnLinkClick, type OnLinkCreate, type OnLinkDblClick, type OnProgressChange, type OnTaskAdd, type OnTaskClick, type OnTaskDoubleClick, type OnTaskMove, type OnTaskResize, type OnTooltipText, type PixelMapper, type Point, ROW_HEIGHT, type RoutedLink, SCALE_CONFIGS, type ScaleConfig, type SpecialDay, type SpecialDayKind, SpecialDayKindSchema, SpecialDaySchema, type Task, type TaskDataField, type TaskKind, TaskKindSchema, type TaskNode, TaskSchema, type ThemeMode, type TimeScale, addDays, addHours, buildTaskTree, computeLayout, createPixelMapper, deriveViewport, deriveWeekNumbering, deriveWeekStartsOn, deriveWeekendDays, detectCycles, diffDays, diffHours, flattenTree, formatLabel, formatWeekNumber, gridColumnDefaults, gridNaturalWidth, gridTemplateColumns, isParent, parseDate, parseGanttInput, resolveChartLocale, routeLinks, validateLinkRefs, visibleColumns };
567
658
  //# sourceMappingURL=index.d.mts.map