gantt-renderer 0.1.2 → 0.2.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,30 @@
1
+ # [0.2.0](https://github.com/doberkofler/gantt-renderer/compare/v0.1.3...v0.2.0) (2026-05-07)
2
+
3
+
4
+ * refactor(domain)!: rename duration to durationHours (days → hours) ([eb7a554](https://github.com/doberkofler/gantt-renderer/commit/eb7a5549e38ac3e36bb6ee47b66433e67ea9d78f))
5
+
6
+
7
+ ### Bug Fixes
8
+
9
+ * **api:** type parseGanttInput parameter as GanttInputRaw instead of unknown ([d12d96b](https://github.com/doberkofler/gantt-renderer/commit/d12d96b838b0670a668d313efc61bd02c55efa36))
10
+ * **rightPane:** offset absoluteLayer below timeline header to align bars with grid rows ([25f2785](https://github.com/doberkofler/gantt-renderer/commit/25f278561b4a789f0daf633436f6c95f4bae5ec9))
11
+
12
+
13
+ ### BREAKING CHANGES
14
+
15
+ * Task duration field renamed from `duration` (days) to
16
+ `durationHours` (hours). Durations are now integer hours; `0` = milestone.
17
+ Added addHours/diffHours to dateMath. PixelMapper, layoutEngine, drag
18
+ interactions, demo data, and all test fixtures updated accordingly.
19
+
20
+ ## [0.1.3](https://github.com/doberkofler/gantt-renderer/compare/v0.1.2...v0.1.3) (2026-05-07)
21
+
22
+
23
+ ### Features
24
+
25
+ * **demo:** add locale selector to demo control panel ([c45a353](https://github.com/doberkofler/gantt-renderer/commit/c45a353248fea61d9d498eca73ae9088dcb608c5))
26
+ * **gantt-chart:** add special-day indicator dots to timeline header cells ([6570ddb](https://github.com/doberkofler/gantt-renderer/commit/6570ddb77f72b66adfe368de0a1b922a7e007035))
27
+
1
28
  ## [0.1.2](https://github.com/doberkofler/gantt-renderer/compare/v0.1.1...v0.1.2) (2026-05-07)
2
29
 
3
30
 
package/README.md CHANGED
@@ -67,16 +67,17 @@ import {GanttChart, parseGanttInput} from 'gantt-renderer';
67
67
  import 'gantt-renderer/styles/gantt.css';
68
68
 
69
69
  const input = parseGanttInput(yourData);
70
- const instance = new GanttChart(document.getElementById('chart')!, input, {
70
+ const instance = new GanttChart(document.getElementById('chart')!, {
71
71
  scale: 'day',
72
72
  });
73
+ instance.update(input);
73
74
  ```
74
75
 
75
76
  ## Integration Pattern
76
77
 
77
78
  1. Compute/plan project data in your domain layer or backend.
78
79
  2. Validate the result with `parseGanttInput(yourData)`.
79
- 3. Render with `new GanttChart(container, input, options)` and react to interaction callbacks.
80
+ 3. Render with `new GanttChart(container, options)` followed by `instance.update(input)` and react to interaction callbacks.
80
81
  4. Persist user edits through your own business logic, then update with `instance.update(newInput)`.
81
82
 
82
83
  ## Package Exports
package/dist/index.d.mts CHANGED
@@ -28,10 +28,10 @@ declare const SpecialDaySchema: z.ZodObject<{
28
28
  declare const TaskSchema: z.ZodObject<{
29
29
  id: z.ZodNumber;
30
30
  text: z.ZodString;
31
- start_date: z.ZodString;
32
- duration: z.ZodNumber;
31
+ startDate: z.ZodString;
32
+ durationHours: z.ZodNumber;
33
33
  parent: z.ZodOptional<z.ZodNumber>;
34
- progress: z.ZodDefault<z.ZodNumber>;
34
+ percentComplete: z.ZodDefault<z.ZodNumber>;
35
35
  type: z.ZodDefault<z.ZodEnum<{
36
36
  task: "task";
37
37
  project: "project";
@@ -55,10 +55,10 @@ declare const GanttInputSchema: z.ZodObject<{
55
55
  tasks: z.ZodArray<z.ZodObject<{
56
56
  id: z.ZodNumber;
57
57
  text: z.ZodString;
58
- start_date: z.ZodString;
59
- duration: z.ZodNumber;
58
+ startDate: z.ZodString;
59
+ durationHours: z.ZodNumber;
60
60
  parent: z.ZodOptional<z.ZodNumber>;
61
- progress: z.ZodDefault<z.ZodNumber>;
61
+ percentComplete: z.ZodDefault<z.ZodNumber>;
62
62
  type: z.ZodDefault<z.ZodEnum<{
63
63
  task: "task";
64
64
  project: "project";
@@ -79,17 +79,46 @@ declare const GanttInputSchema: z.ZodObject<{
79
79
  }>>;
80
80
  }, z.core.$strip>>>;
81
81
  }, z.core.$strip>;
82
+ /** The raw, unvalidated input shape that consumers pass to {@link parseGanttInput}. */
83
+ type GanttInputRaw = z.input<typeof GanttInputSchema>;
84
+ /** Allowed dependency link type values: `'FS'`, `'SS'`, `'FF'`, or `'SF'`. */
82
85
  type LinkType = z.infer<typeof LinkTypeSchema>;
86
+ /** Allowed task type values: `'task'`, `'project'`, or `'milestone'`. */
83
87
  type TaskType = z.infer<typeof TaskTypeSchema>;
84
88
  type SpecialDayKind = z.infer<typeof SpecialDayKindSchema>;
85
89
  type SpecialDay = z.infer<typeof SpecialDaySchema>;
90
+ /**
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).
93
+ */
86
94
  type Task = z.infer<typeof TaskSchema>;
95
+ /**
96
+ * A dependency link between two tasks. The `type` determines the scheduling constraint
97
+ * (e.g., finish-to-start, start-to-start).
98
+ */
87
99
  type Link = z.infer<typeof LinkSchema>;
100
+ /**
101
+ * The complete input data for the chart.
102
+ *
103
+ * Pass a raw plain object (typed as {@link GanttInputRaw}) to
104
+ * {@link parseGanttInput} to validate and get back a typed {@link GanttInput}.
105
+ */
88
106
  type GanttInput = z.infer<typeof GanttInputSchema>;
89
- /** Parses raw external data. Throws ZodError on failure. */
90
- declare function parseGanttInput(raw: unknown): GanttInput;
91
- /** Returns null instead of throwing. */
92
- declare function safeParseGanttInput(raw: unknown): GanttInput | null;
107
+ /**
108
+ * Parses raw external data.
109
+ *
110
+ * @param raw - The unvalidated input from the consumer.
111
+ * @returns The parsed and validated {@link GanttInput}.
112
+ * @throws {import('zod').ZodError} On schema validation failure.
113
+ */
114
+ 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;
93
122
  //#endregion
94
123
  //#region src/gantt-chart/timeline/scale.d.ts
95
124
  type TimeScale = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
@@ -101,29 +130,48 @@ type ScaleConfig = {
101
130
  declare const SCALE_CONFIGS: Record<TimeScale, ScaleConfig>;
102
131
  //#endregion
103
132
  //#region src/gantt-chart/domain/tree.d.ts
133
+ /**
134
+ * A task node in the render tree, combining the flat {@link Task} input data
135
+ * with computed hierarchy structure.
136
+ *
137
+ * Produced by {@link buildTaskTree}; consumed by virtualized row rendering
138
+ * and the timeline layout engine.
139
+ */
104
140
  type TaskNode = Task & {
105
- children: TaskNode[]; /** 0 = root */
141
+ /** Array of child task nodes in the tree hierarchy. */children: TaskNode[]; /** 0 = root */
106
142
  depth: number;
107
143
  };
108
144
  /**
109
145
  * Builds a typed tree from a flat task array.
110
146
  * Order of tasks[] is irrelevant — parents need not precede children.
111
- * Throws if any parent reference is unresolvable.
147
+ *
148
+ * @param tasks - The flat array of tasks to convert into a tree.
149
+ * @returns Root-level {@link TaskNode} instances with populated `children`.
150
+ * @throws {GanttError} When a task references a `parent` id that does not exist.
112
151
  */
113
152
  declare function buildTaskTree(tasks: Task[]): TaskNode[];
114
153
  /**
115
154
  * Flattens a tree into a visible row list.
116
- * A node's children are included only when its id is in expandedIds.
155
+ * A node's children are included only when its id is in `expandedIds`.
156
+ *
157
+ * @param roots - The root-level {@link TaskNode} instances of the tree.
158
+ * @param expandedIds - Set of task IDs whose children should be rendered.
159
+ * @returns A depth-first flattened array of visible {@link TaskNode} items.
117
160
  */
118
161
  declare function flattenTree(roots: TaskNode[], expandedIds: ReadonlySet<number>): TaskNode[];
119
- /** Returns true when a node has children in the tree. */
162
+ /**
163
+ * Returns `true` when a node has children in the tree.
164
+ *
165
+ * @param node - The {@link TaskNode} to inspect.
166
+ * @returns `true` if `node.children.length > 0`.
167
+ */
120
168
  declare function isParent(node: TaskNode): boolean;
121
169
  //#endregion
122
170
  //#region src/gantt-chart/timeline/pixelMapper.d.ts
123
171
  type PixelMapper = {
124
172
  /** Date → x pixel offset from viewport start */toX: (date: Date) => number; /** x pixel offset → Date */
125
- toDate: (x: number) => Date; /** Days → pixel width */
126
- durationToWidth: (days: number) => number; /** Pixel width → days (float) */
173
+ toDate: (x: number) => Date; /** Hours → pixel width */
174
+ durationToWidth: (hours: number) => number; /** Pixel width → hours (float) */
127
175
  widthToDuration: (px: number) => number; /** The origin timestamp used for this mapper */
128
176
  originMs: number; /** Pixel width of one column unit */
129
177
  columnWidth: number;
@@ -131,6 +179,10 @@ type PixelMapper = {
131
179
  /**
132
180
  * Creates a stateless pixel mapper for the given scale and viewport start.
133
181
  * All conversions are O(1) arithmetic — safe to call in tight loops.
182
+ *
183
+ * @param scale - The active {@link TimeScale}.
184
+ * @param viewportStart - The leftmost date visible in the viewport.
185
+ * @returns A {@link PixelMapper} configured for the given viewport.
134
186
  */
135
187
  declare function createPixelMapper(scale: TimeScale, viewportStart: Date): PixelMapper;
136
188
  //#endregion
@@ -161,16 +213,23 @@ type BarLayout = {
161
213
  /**
162
214
  * Computes pixel-space layout for all visible task rows.
163
215
  * Returns a map keyed by task id for O(1) lookup during link routing.
216
+ *
217
+ * @param rows - The flattened, visible {@link TaskNode} rows.
218
+ * @param mapper - The {@link PixelMapper} for coordinate conversion.
219
+ * @returns A `Map` from task ID to its computed {@link BarLayout}.
164
220
  */
165
221
  declare function computeLayout(rows: TaskNode[], mapper: PixelMapper): Map<number, BarLayout>;
166
222
  /**
167
223
  * Derives viewport bounds from task data with padding.
168
- * Returns [start, end] as UTC midnight dates.
224
+ *
225
+ * @param tasks - The task nodes to derive bounds from.
226
+ * @param paddingHours - Extra hours added before the earliest start and after the latest end. Defaults to `48`.
227
+ * @returns A tuple `[start, end]` of UTC midnight `Date` instances.
169
228
  */
170
- declare function deriveViewport(tasks: TaskNode[], paddingDays?: number): [Date, Date];
229
+ declare function deriveViewport(tasks: TaskNode[], paddingHours?: number): [Date, Date];
171
230
  //#endregion
172
231
  //#region src/gantt-chart/locale.d.ts
173
- type LocaleLabelKey = 'aria_task' | 'aria_milestone' | 'add_subtask_title' | 'column_task_name' | 'column_start_time' | 'column_duration' | 'column_quarter';
232
+ type LocaleLabelKey = 'ariaTask' | 'ariaMilestone' | 'addSubtaskTitle' | 'columnTaskName' | 'columnStartDate' | 'columnDuration' | 'columnQuarter';
174
233
  type ChartLocale = {
175
234
  code: string;
176
235
  labels?: Partial<Record<LocaleLabelKey, string>>;
@@ -180,60 +239,119 @@ type ChartLocale = {
180
239
  };
181
240
  declare const EN_US_LABELS: Record<LocaleLabelKey, string>;
182
241
  declare const CHART_LOCALE_EN_US: ChartLocale;
183
- /**
184
- * Resolves a ChartLocale from either a full ChartLocale object or a BCP 47 string.
185
- * When given a string, derives weekStartsOn, weekNumbering, and weekendDays from CLDR conventions.
186
- */
187
- declare function resolveChartLocale(raw: ChartLocale | string | undefined): ChartLocale;
188
242
  /**
189
243
  * Derives the first day of week (0=Sun, 1=Mon, 6=Sat) from a BCP 47 code.
190
- * Uses Intl.Locale.getWeekInfo() where available (Chromium, Safari 15.4+),
244
+ * Uses `Intl.Locale.getWeekInfo()` where available (Chromium, Safari 15.4+),
191
245
  * with a CLDR-based fallback table for Firefox and older runtimes.
246
+ *
247
+ * @param code - A BCP 47 language tag (e.g. `'en-US'`, `'de-DE'`).
248
+ * @returns The first day of the week: `0` (Sunday), `1` (Monday), or `6` (Saturday).
192
249
  */
193
250
  declare function deriveWeekStartsOn(code: string): 0 | 1 | 6;
194
251
  /**
195
252
  * Derives the week numbering scheme from a BCP 47 code.
196
- * Europe and ISO-aligned regions default to 'iso'; Americas and others to 'us'.
253
+ * Europe and ISO-aligned regions default to `'iso'`; Americas and others to `'us'`.
254
+ *
255
+ * @param code - A BCP 47 language tag (e.g. `'en-US'`, `'de-DE'`).
256
+ * @returns The week numbering scheme: `'iso'`, `'us'`, or `'simple'`.
197
257
  */
198
258
  declare function deriveWeekNumbering(code: string): 'iso' | 'us' | 'simple';
199
259
  /**
200
260
  * Derives weekend days (0=Sun … 6=Sat) from a BCP 47 code.
201
- * Uses Intl.Locale.getWeekInfo() where available, with a CLDR-based fallback table.
261
+ * Uses `Intl.Locale.getWeekInfo()` where available, with a CLDR-based fallback table.
262
+ *
263
+ * @param code - A BCP 47 language tag (e.g. `'en-US'`, `'de-DE'`).
264
+ * @returns An array of weekend day indices (sorted ascending).
202
265
  */
203
266
  declare function deriveWeekendDays(code: string): number[];
267
+ /**
268
+ * Resolves a {@link ChartLocale} from either a full `ChartLocale` object or a BCP 47 string.
269
+ * When given a string, derives `weekStartsOn`, `weekNumbering`, and `weekendDays` from CLDR conventions.
270
+ *
271
+ * @param raw - A {@link ChartLocale} object, a BCP 47 language tag string, or `undefined`.
272
+ * @returns A fully resolved {@link ChartLocale} with defaults applied.
273
+ */
274
+ declare function resolveChartLocale(raw: ChartLocale | string | undefined): ChartLocale;
204
275
  /**
205
276
  * Formats a week number according to the specified scheme.
206
277
  *
207
278
  * - `'iso'`: ISO 8601 (week 1 contains the first Thursday; Monday start).
208
279
  * - `'us'`: Week 1 contains January 1; Sunday start.
209
280
  * - `'simple'`: `Math.ceil(dayOfYear / 7)`.
281
+ *
282
+ * @param date - The date to compute the week number for.
283
+ * @param scheme - The week numbering scheme: `'iso'`, `'us'`, or `'simple'`.
284
+ * @returns The week number as a positive integer.
210
285
  */
211
286
  declare function formatWeekNumber(date: Date, scheme: 'iso' | 'us' | 'simple'): number;
212
287
  /**
213
288
  * Formats a label template by replacing `{0}` with the given argument.
289
+ *
290
+ * @param template - The template string containing `{0}` as placeholder.
291
+ * @param arg - The value to substitute for `{0}`.
292
+ * @returns The formatted string with the placeholder replaced.
214
293
  */
215
294
  declare function formatLabel(template: string, arg: string): string;
216
295
  //#endregion
217
296
  //#region src/gantt-chart/domain/dependencies.d.ts
218
297
  /**
219
298
  * Detects circular dependencies in the link graph using DFS tri-colour marking.
220
- * Throws with a human-readable cycle path on detection.
221
- * Silent return = no cycles.
299
+ *
300
+ * @param tasks - The task list (used to build the vertex set).
301
+ * @param links - The dependency links defining the directed edges.
302
+ * @throws {GanttError} When a cycle is detected, with a human-readable cycle path.
222
303
  */
223
304
  declare function detectCycles(tasks: Task[], links: Link[]): void;
224
305
  /**
225
- * Returns true when all link source/target ids reference existing tasks.
226
- * Throws with details on failure.
306
+ * Validates that every link references existing task IDs.
307
+ *
308
+ * @param tasks - The task list (used as the reference set of valid IDs).
309
+ * @param links - The dependency links to validate.
310
+ * @throws {GanttError} When any link references a non-existent source or target task.
227
311
  */
228
312
  declare function validateLinkRefs(tasks: Task[], links: Link[]): void;
229
313
  //#endregion
230
314
  //#region src/gantt-chart/domain/dateMath.d.ts
231
- /** Parses YYYY-MM-DD → UTC midnight Date. Throws on invalid input. */
315
+ /**
316
+ * Parses `YYYY-MM-DD` → UTC midnight `Date`.
317
+ *
318
+ * @param dateStr - An ISO-8601 date string in `YYYY-MM-DD` format.
319
+ * @returns A `Date` representing UTC midnight of the given date.
320
+ * @throws {Error} When `dateStr` does not represent a valid date.
321
+ */
232
322
  declare function parseDate(dateStr: string): Date;
233
- /** Returns date + n days (exact ms arithmetic). */
323
+ /**
324
+ * Returns `date + n` days using exact millisecond arithmetic.
325
+ *
326
+ * @param date - The base date.
327
+ * @param days - Number of days to add (may be negative).
328
+ * @returns A new `Date` offset by the given number of days.
329
+ */
234
330
  declare function addDays(date: Date, days: number): Date;
235
- /** Difference in days (float). Positive when b > a. */
331
+ /**
332
+ * Returns `date + n` hours using exact millisecond arithmetic.
333
+ *
334
+ * @param date - The base date.
335
+ * @param hours - Number of hours to add (may be negative).
336
+ * @returns A new `Date` offset by the given number of hours.
337
+ */
338
+ declare function addHours(date: Date, hours: number): Date;
339
+ /**
340
+ * Difference in days (float). Positive when `b > a`.
341
+ *
342
+ * @param a - The earlier date.
343
+ * @param b - The later date.
344
+ * @returns The fractional number of days between the two dates.
345
+ */
236
346
  declare function diffDays(a: Date, b: Date): number;
347
+ /**
348
+ * Difference in hours (float). Positive when `b > a`.
349
+ *
350
+ * @param a - The earlier date.
351
+ * @param b - The later date.
352
+ * @returns The fractional number of hours between the two dates.
353
+ */
354
+ declare function diffHours(a: Date, b: Date): number;
237
355
  //#endregion
238
356
  //#region src/gantt-chart/rendering/linkRouter.d.ts
239
357
  type Point = {
@@ -250,6 +368,10 @@ type RoutedLink = {
250
368
  * Computes orthogonal routing for all dependency links.
251
369
  * Links whose source or target is not in the layout map are skipped silently
252
370
  * (e.g. when the row is collapsed).
371
+ *
372
+ * @param links - The dependency links to route.
373
+ * @param layouts - A map from task ID to its computed {@link BarLayout}.
374
+ * @returns An array of {@link RoutedLink} objects with computed vertex paths.
253
375
  */
254
376
  declare function routeLinks(links: Link[], layouts: Map<number, BarLayout>): RoutedLink[];
255
377
  //#endregion
@@ -266,12 +388,34 @@ type GridColumn = {
266
388
  declare const DEFAULT_GRID_COLUMNS: GridColumn[];
267
389
  /**
268
390
  * Returns a localized default grid column schema.
269
- * Column headers use locale label overrides with EN_US_LABELS fallback.
391
+ * Column headers use locale label overrides with `EN_US_LABELS` fallback.
392
+ *
393
+ * @param locale - The {@link ChartLocale} to derive column header labels from.
394
+ * @returns An array of {@link GridColumn} objects.
270
395
  */
271
396
  declare function gridColumnDefaults(locale: ChartLocale): GridColumn[];
397
+ /**
398
+ * Builds a CSS `grid-template-columns` value from a column schema.
399
+ *
400
+ * @param columns - The full column schema array (only visible columns are included).
401
+ * @returns A space-separated CSS track list.
402
+ */
272
403
  declare function gridTemplateColumns(columns: GridColumn[]): string;
404
+ /**
405
+ * Filters a column schema to only visible columns.
406
+ *
407
+ * @param columns - The full column schema array.
408
+ * @returns A new array containing only columns where `visible` is not `false`.
409
+ */
273
410
  declare function visibleColumns(columns: GridColumn[]): GridColumn[];
274
411
  declare const GRID_COLUMN_FR_MIN_WIDTH = 120;
412
+ /**
413
+ * Computes the minimum natural pixel width of a grid column schema.
414
+ *
415
+ * @param columns - The full column schema array.
416
+ * @returns The sum of minimum widths: `px` columns sum directly, `fr` units contribute
417
+ * `GRID_COLUMN_FR_MIN_WIDTH` px each.
418
+ */
275
419
  declare function gridNaturalWidth(columns: GridColumn[]): number;
276
420
  //#endregion
277
421
  //#region src/gantt-chart/vanilla/gantt-chart.d.ts
@@ -282,7 +426,7 @@ type OnTaskMove = (payload: {
282
426
  }) => void;
283
427
  type OnTaskResize = (payload: {
284
428
  id: number;
285
- duration: number;
429
+ durationHours: number;
286
430
  }) => void;
287
431
  type OnTaskAdd = (payload: {
288
432
  parentId: number;
@@ -294,7 +438,7 @@ type OnTaskDoubleClick = (payload: {
294
438
  type OnTaskEditIntent = (payload: {
295
439
  id: number;
296
440
  source: 'grid' | 'bar' | 'milestone';
297
- trigger: 'double_click';
441
+ trigger: 'doubleClick';
298
442
  task: Task;
299
443
  }) => void;
300
444
  type OnLinkCreate = (payload: {
@@ -342,23 +486,82 @@ type GanttInstance = {
342
486
  expandAll: () => void;
343
487
  destroy: () => void;
344
488
  };
489
+ /**
490
+ * Progressive-enhancement Gantt chart component.
491
+ * Validates input, builds a DOM tree, and renders a full interactive chart
492
+ * inside the given container element.
493
+ *
494
+ * @example
495
+ * ```ts
496
+ * const chart = new GanttChart(document.getElementById('chart')!, input, {
497
+ * locale: 'de-DE',
498
+ * theme: 'dark',
499
+ * });
500
+ * ```
501
+ */
345
502
  declare class GanttChart implements GanttInstance {
346
503
  #private;
347
- constructor(container: HTMLElement, input: GanttInput, opts?: GanttOptions);
504
+ /**
505
+ * Constructs a new chart, builds the DOM, and wires internal event handling.
506
+ * Data must be loaded via {@link update} before the chart renders.
507
+ *
508
+ * @param container - The host `HTMLElement` the chart will be appended to.
509
+ * @param opts - Configuration and callback options.
510
+ */
511
+ constructor(container: HTMLElement, opts?: GanttOptions);
512
+ /**
513
+ * Replaces the full dataset and re-renders.
514
+ *
515
+ * @param newInput - The new {@link GanttInput} to apply.
516
+ * @throws {GanttError} When the instance has been destroyed.
517
+ */
348
518
  update(newInput: GanttInput): void;
519
+ /**
520
+ * Switches the time scale and re-renders.
521
+ *
522
+ * @param scale - The new {@link TimeScale} to display.
523
+ * @throws {GanttError} When the instance has been destroyed.
524
+ */
349
525
  setScale(scale: TimeScale): void;
526
+ /**
527
+ * Programmatically selects or deselects a task.
528
+ *
529
+ * @param id - The task ID to select, or `null` to clear the selection.
530
+ * @throws {GanttError} When the instance has been destroyed.
531
+ */
350
532
  select(id: number | null): void;
533
+ /**
534
+ * Collapses all expandable groups in the task tree.
535
+ *
536
+ * @throws {GanttError} When the instance has been destroyed.
537
+ */
351
538
  collapseAll(): void;
539
+ /**
540
+ * Expands all expandable groups in the task tree.
541
+ *
542
+ * @throws {GanttError} When the instance has been destroyed.
543
+ */
352
544
  expandAll(): void;
545
+ /**
546
+ * Removes the chart DOM and internal listeners, rendering the instance
547
+ * unusable. Subsequent calls to any public method will throw.
548
+ */
353
549
  destroy(): void;
354
550
  }
355
551
  //#endregion
356
552
  //#region src/gantt-chart/errors.d.ts
357
553
  type GanttErrorCode = 'PARENT_REFERENCE' | 'LINK_REFERENCE' | 'DEPENDENCY_CYCLE' | 'INSTANCE_DESTROYED';
554
+ /**
555
+ * Domain-specific error with a machine-readable {@link GanttErrorCode}.
556
+ */
358
557
  declare class GanttError extends Error {
359
558
  readonly code: GanttErrorCode;
559
+ /**
560
+ * @param code - A machine-readable {@link GanttErrorCode} categorising the error.
561
+ * @param message - A human-readable description.
562
+ */
360
563
  constructor(code: GanttErrorCode, message: string);
361
564
  }
362
565
  //#endregion
363
- 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, 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, buildTaskTree, computeLayout, createPixelMapper, deriveViewport, deriveWeekNumbering, deriveWeekStartsOn, deriveWeekendDays, detectCycles, diffDays, flattenTree, formatLabel, formatWeekNumber, gridColumnDefaults, gridNaturalWidth, gridTemplateColumns, isParent, parseDate, parseGanttInput, resolveChartLocale, routeLinks, safeParseGanttInput, validateLinkRefs, visibleColumns };
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 };
364
567
  //# sourceMappingURL=index.d.mts.map