@ganttloom/gantt-vue 0.6.0 → 0.6.2

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/README.md CHANGED
@@ -1,358 +1,359 @@
1
- # @ganttloom/gantt-vue
2
-
3
- [![npm](https://img.shields.io/npm/v/%40ganttloom%2Fgantt-vue)](https://www.npmjs.com/package/@ganttloom/gantt-vue)
4
- [![license](https://img.shields.io/npm/l/%40ganttloom%2Fgantt-vue)](../../LICENSE)
5
-
6
- Vue 3 component wrapping [`@ganttloom/gantt-core`](../gantt-core). A thin
7
- wrapper: it owns no scheduling logic of its own, just Vue lifecycle,
8
- props-as-events, and an exposed handle for the escape hatches (undo/redo,
9
- zoom, export) that don't fit the declarative-props model.
10
-
11
- ![ganttloom overview — day-view Gantt chart with dependencies, critical path, and baselines](https://raw.githubusercontent.com/santhoshkumarhari/ganttLoom/master/docs/screenshots/overview.png)
12
-
13
- ## Install
14
-
15
- ```bash
16
- npm install @ganttloom/gantt-vue
17
- # vue >=3.3 is a peer dependency
18
- ```
19
-
20
- ## Quick start
21
-
22
- ```vue
23
- <script setup lang="ts">
24
- import { GanttChart } from "@ganttloom/gantt-vue";
25
-
26
- const tasks = [
27
- { id: "1", name: "Design", start: new Date("2026-01-05"), end: new Date("2026-01-09"), progress: 60 },
28
- { id: "2", name: "Build", start: new Date("2026-01-09"), end: new Date("2026-01-16"), progress: 10 },
29
- ];
30
- const dependencies = [{ fromId: "1", toId: "2", type: "FS" as const }];
31
- </script>
32
-
33
- <template>
34
- <GanttChart
35
- :tasks="tasks"
36
- :dependencies="dependencies"
37
- view-mode="day"
38
- show-critical-path
39
- enable-history
40
- @date-change="(task, start, end) => console.log(task.name, start, end)"
41
- />
42
- </template>
43
- ```
44
-
45
- `<GanttChart />` bundles `@ganttloom/gantt-core`'s default stylesheet
46
- automatically. Props mirror `@ganttloom/gantt-core`'s `GanttOptions`
47
- one-to-one (in kebab-case, per Vue convention) — see that package's README
48
- for what each one does. Pass new array/object references to trigger a sync
49
- (`setTasks`/`setDependencies`/`setOptions` underneath); mutating in place
50
- won't re-render.
51
-
52
- `class`/`style` fall through onto the chart's root element automatically —
53
- there's no separate prop for them.
54
-
55
- ## Imperative handle
56
-
57
- Props/events cover the declarative surface (tasks, dependencies, view
58
- options, event listeners). For everything else, use a template ref:
59
-
60
- ```vue
61
- <script setup lang="ts">
62
- import { ref } from "vue";
63
- import { GanttChart, type GanttChartHandle } from "@ganttloom/gantt-vue";
64
-
65
- const chartRef = ref<GanttChartHandle | null>(null);
66
- </script>
67
-
68
- <template>
69
- <button @click="chartRef?.undo()">Undo</button>
70
- <button @click="chartRef?.zoomIn()">Zoom in</button>
71
- <GanttChart ref="chartRef" :tasks="tasks" enable-history />
72
- </template>
73
- ```
74
-
75
- The exposed `GanttChartHandle` has: `undo`/`redo`/`canUndo`/`canRedo`,
76
- `expandAll`/`collapseAll`/`toggleGroup`, `removeDependency`,
77
- `updateDependency`, `updateTask`, `setViewMode`,
78
- `zoomIn`/`zoomOut`/`getZoomLevel`, `fitToViewport`, `scrollToToday`,
79
- `scrollToRangeStart`/`scrollToRangeEnd`, `getPageCount`/`setPage`,
80
- `getResourceHistogram`, `getLeveledTasks`,
81
- `selectTask`/`selectAllVisible`/`clearSelection`/`getSelectedTaskIds`/`bulkShiftDates`/`bulkDelete`,
82
- `setSort`/`getSort`, `toSVGString`/`toPNGDataURL`/`toPNGDataURLs`,
83
- `getRenderModel`, and `getInstance()` for direct access to the underlying
84
- `@ganttloom/gantt-core` `GanttChart` when you need something not on this
85
- list.
86
-
87
- ## Multi-select and bulk actions
88
-
89
- ```vue
90
- <GanttChart
91
- :tasks="tasks"
92
- selectable
93
- @selection-change="(taskIds) => (selectedCount = taskIds.length)"
94
- />
95
- ```
96
-
97
- Click selects one bar, ctrl/cmd-click toggles it into the selection,
98
- shift-click selects a range. Then drive it from the handle:
99
- `chartRef.value?.bulkShiftDates(dayMs)`, `chartRef.value?.bulkDelete()`.
100
-
101
- ## Row reorder and dependency editing
102
-
103
- ```vue
104
- <GanttChart
105
- :tasks="tasks"
106
- @task-reorder="(draggedId, targetId, position) => { /* position: before | after | inside */ }"
107
- @dependency-dblclick="(dep) => {
108
- // show your own 'edit link' UI, then:
109
- chartRef?.updateDependency(dep.fromId, dep.toId, { type: 'SS' });
110
- }"
111
- />
112
- ```
113
-
114
- Both off by default (same construction-time-only wiring caveat as
115
- `task-create` below — attach the listener from the first render).
116
- Double-clicking a task bar itself fires the separate
117
- `@task-dblclick="(task) => ..."`, same caveat.
118
-
119
- ## Filling the viewport at any zoom level
120
-
121
- A short project at month/year zoom, or just a handful of tasks, naturally
122
- renders narrow. `auto-fit-to-viewport` stretches (never shrinks) the
123
- timeline to fill the container instead of leaving empty space:
124
-
125
- ```vue
126
- <GanttChart :tasks="tasks" auto-fit-to-viewport />
127
- ```
128
-
129
- Off by default — upgrading doesn't silently change an existing chart's
130
- pixel layout for anyone who hasn't opted in.
131
-
132
- Always on, separately: the visible range is padded to a minimum tick count
133
- per zoom level, so a short project at year/quarter zoom never collapses
134
- into one or two lonely columns, and the date header stays pinned to the
135
- top while scrolling a tall task list vertically (still scrolling
136
- horizontally in sync with the bars).
137
-
138
- ## Header position
139
-
140
- `header-position` places the grid and timeline headers at `"top"` (the
141
- default), `"bottom"`, or `"none"` to hide them entirely:
142
-
143
- ```vue
144
- <GanttChart :tasks="tasks" header-position="bottom" />
145
- ```
146
-
147
- ## Drag-to-create
148
-
149
- Off by default; attach a `@task-create` listener to turn it on (the core
150
- only wires the drag listener when a creation handler is present, so existing
151
- consumers see no behavior change):
152
-
153
- ```vue
154
- <GanttChart :tasks="tasks" @task-create="(task) => console.log('created', task)" />
155
- ```
156
-
157
- > The core only checks for a listener **at mount** (same caveat as the other
158
- > gated events above) — attach it from the first render if you want
159
- > drag-to-create enabled; toggling it on after mount won't retroactively wire it.
160
-
161
- ## Timeline markers, column resize/reorder, and search
162
-
163
- ```vue
164
- <script setup lang="ts">
165
- import { filterTasks } from "@ganttloom/gantt-vue";
166
- </script>
167
-
168
- <template>
169
- <GanttChart
170
- :tasks="filterTasks(tasks, (t) => t.name.includes(query)).tasks"
171
- :markers="[{ date: releaseDate, label: 'Release' }]"
172
- @column-resize="(id, width) => (columnWidths[id] = width)"
173
- @column-reorder="(order) => (columnOrder = order)"
174
- />
175
- </template>
176
- ```
177
-
178
- See `@ganttloom/gantt-core`'s README for the full behavior of each — the
179
- props/events here are 1:1 mirrors of its `GanttOptions` fields, and
180
- `filterTasks` is a pure re-export.
181
-
182
- ## Column sorting
183
-
184
- Mark a column `sortable`; clicking its header cycles asc → desc → none:
185
-
186
- ```vue
187
- <GanttChart
188
- :tasks="tasks"
189
- :columns="[{ id: 'name', title: 'Task', sortable: true }]"
190
- @sort-change="(sort) => console.log(sort)"
191
- />
192
- ```
193
-
194
- `chartRef.value?.setSort(columnId, direction)` / `.getSort()` are also
195
- available on the handle.
196
-
197
- ## Resource leveling and multi-page PNG export
198
-
199
- ```ts
200
- const { tasks: leveled, shifted } = chartRef.value!.getLeveledTasks();
201
- if (shifted.length) tasks.value = leveled; // if you're holding tasks in your own state
202
-
203
- const pages = await chartRef.value!.toPNGDataURLs({ pageWidthPx: 1600, pageHeightPx: 1200 });
204
- ```
205
-
206
- ## Resource histogram
207
-
208
- ```vue
209
- <script setup lang="ts">
210
- import { computed } from "vue";
211
- import { renderResourceHistogramSVG } from "@ganttloom/gantt-vue";
212
-
213
- const histogramSvg = computed(() => renderResourceHistogramSVG(chartRef.value?.getResourceHistogram() ?? []));
214
- </script>
215
-
216
- <template>
217
- <div v-html="histogramSvg" />
218
- </template>
219
- ```
220
-
221
- ## Hover tooltips
222
-
223
- On by default (name/dates/progress/assignees/notes), styled via plain CSS
224
- (`.gantt-tooltip`, see `gantt-core`'s README) — not the browser's native
225
- tooltip. `renderTooltip` fully replaces the content:
226
-
227
- ```vue
228
- <GanttChart
229
- :tasks="tasks"
230
- :render-tooltip="(task) => (task.isMilestone ? null : `${task.name} — ${task.progress ?? 0}%`)"
231
- />
232
- ```
233
-
234
- Set `:show-tooltip="false"` to disable it entirely.
235
-
236
- ## i18n / overridable labels
237
-
238
- A handful of built-in strings (aria-labels, the default name for a
239
- newly-created task, the tooltip's date/progress formatting) can be overridden
240
- via the `labels` prop — see `gantt-core`'s README for the full field list:
241
-
242
- ```vue
243
- <GanttChart
244
- :tasks="tasks"
245
- :labels="{
246
- expand: 'Développer',
247
- collapse: 'Réduire',
248
- newTaskName: 'Nouvelle tâche',
249
- formatDate: (d) => d.toLocaleDateString('fr-FR'),
250
- }"
251
- />
252
- ```
253
-
254
- `labels.formatTickLabel` overrides the timeline header's own day/week/month
255
- tick labels (distinct from `formatDate` above, which only covers the tooltip
256
- and bar aria-label) - it receives each tick's `Date` and the current
257
- `view-mode`:
258
-
259
- ```vue
260
- <GanttChart
261
- :tasks="tasks"
262
- view-mode="week"
263
- :labels="{ formatTickLabel: (date, viewMode) => date.toLocaleDateString('fr-FR') }"
264
- />
265
- ```
266
-
267
- ## Custom sort comparator
268
-
269
- Set `sortFn` on a sortable `GanttColumn` to fully control its comparison
270
- instead of the default accessor-based one - see `gantt-core`'s README for
271
- details:
272
-
273
- ```vue
274
- <GanttChart
275
- :tasks="tasks"
276
- :columns="[
277
- {
278
- id: 'priority',
279
- title: 'Priority',
280
- accessor: (t) => t.data?.priority,
281
- sortable: true,
282
- sortFn: (a, b) => (a.data?.priority === 'high' ? -1 : 1),
283
- },
284
- ]"
285
- />
286
- ```
287
-
288
- ## Custom task-bar rendering
289
-
290
- `render-bar` lets you draw custom SVG content into a task bar (icons,
291
- patterns, extra shapes) without forking the renderer - see `gantt-core`'s
292
- README for the append-only contract that keeps drag/resize hit-testing intact:
293
-
294
- ```vue
295
- <GanttChart
296
- :tasks="tasks"
297
- :render-bar="
298
- ({ task, bar, group }) => {
299
- if (!task.data?.flagged) return;
300
- const icon = document.createElementNS('http://www.w3.org/2000/svg', 'text');
301
- icon.setAttribute('x', String(bar.width + 6));
302
- icon.setAttribute('y', '-4');
303
- icon.textContent = '⚑';
304
- group.appendChild(icon);
305
- }
306
- "
307
- />
308
- ```
309
-
310
- ## Arbitrary attributes on the root element
311
-
312
- `<GanttChart>` has a single root `<div>`, so any attribute you pass that
313
- isn't a declared prop - `id`, `data-*`, `aria-*`, `class`, `style`, etc. -
314
- falls through onto it automatically (Vue's default [attribute
315
- inheritance](https://vuejs.org/guide/components/attrs.html)), no extra prop
316
- needed:
317
-
318
- ```vue
319
- <GanttChart :tasks="tasks" data-testid="project-gantt" aria-label="Project schedule" />
320
- ```
321
-
322
- ## `useGanttChart` (lower-level composable)
323
-
324
- If you want to own the container element/DOM tree yourself instead of using
325
- `<GanttChart />`:
326
-
327
- ```vue
328
- <script setup lang="ts">
329
- import { ref } from "vue";
330
- import { useGanttChart, type GanttTask, type GanttDependency } from "@ganttloom/gantt-vue";
331
-
332
- const props = defineProps<{ tasks: GanttTask[]; dependencies: GanttDependency[] }>();
333
- const containerRef = ref<HTMLDivElement | null>(null);
334
- const { chart, canUndo, canRedo } = useGanttChart(
335
- containerRef,
336
- () => props.tasks,
337
- () => props.dependencies,
338
- () => ({ enableHistory: true })
339
- );
340
- </script>
341
-
342
- <template>
343
- <div ref="containerRef" />
344
- </template>
345
- ```
346
-
347
- `useGanttChart` takes getter functions (not refs) for `tasks`/`dependencies`/`options`
348
- so it can track whatever reactive source each one reads — a prop, a `ref`, a `computed`.
349
-
350
- ## Re-exported types & helpers
351
-
352
- For convenience, this package re-exports every `@ganttloom/gantt-core` type
353
- (`GanttTask`, `GanttDependency`, `GanttColumn`, `GanttTheme`, `ViewMode`,
354
- `WorkingCalendar`, `ConstraintType`, `ResourceLoadBucket`, etc.) and the
355
- standalone helper functions (`computeWBSCodes`, `applyConstraint`,
356
- `isWorkingDay`, `nextWorkingDay`, `computeResourceHistogram`,
357
- `renderResourceHistogramSVG`, ...) so you never need
358
- `@ganttloom/gantt-core` as a direct dependency just to reference them.
1
+ # @ganttloom/gantt-vue
2
+
3
+ [![npm](https://img.shields.io/npm/v/%40ganttloom%2Fgantt-vue)](https://www.npmjs.com/package/@ganttloom/gantt-vue)
4
+ [![license](https://img.shields.io/npm/l/%40ganttloom%2Fgantt-vue)](../../LICENSE)
5
+
6
+ Vue 3 component wrapping [`@ganttloom/gantt-core`](../gantt-core). A thin
7
+ wrapper: it owns no scheduling logic of its own, just Vue lifecycle,
8
+ props-as-events, and an exposed handle for the escape hatches (undo/redo,
9
+ zoom, export) that don't fit the declarative-props model.
10
+
11
+ ![ganttloom overview — day-view Gantt chart with dependencies, critical path, and baselines](https://raw.githubusercontent.com/santhoshkumarhari/ganttLoom/master/docs/screenshots/overview.png)
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @ganttloom/gantt-vue
17
+ # vue >=3.3 is a peer dependency
18
+ ```
19
+
20
+ ## Quick start
21
+
22
+ ```vue
23
+ <script setup lang="ts">
24
+ import { GanttChart } from "@ganttloom/gantt-vue";
25
+
26
+ const tasks = [
27
+ { id: "1", name: "Design", start: new Date("2026-01-05"), end: new Date("2026-01-09"), progress: 60 },
28
+ { id: "2", name: "Build", start: new Date("2026-01-09"), end: new Date("2026-01-16"), progress: 10 },
29
+ ];
30
+ const dependencies = [{ fromId: "1", toId: "2", type: "FS" as const }];
31
+ </script>
32
+
33
+ <template>
34
+ <GanttChart
35
+ :tasks="tasks"
36
+ :dependencies="dependencies"
37
+ view-mode="day"
38
+ show-critical-path
39
+ enable-history
40
+ @date-change="(task, start, end) => console.log(task.name, start, end)"
41
+ />
42
+ </template>
43
+ ```
44
+
45
+ `<GanttChart />` injects `@ganttloom/gantt-core`'s default stylesheet
46
+ automatically (a `<style>` tag added to `<head>` on first mount; no CSS
47
+ import, so the package also loads under SSR/Node/Jest). Props mirror `@ganttloom/gantt-core`'s `GanttOptions`
48
+ one-to-one (in kebab-case, per Vue convention) — see that package's README
49
+ for what each one does. Pass new array/object references to trigger a sync
50
+ (`setTasks`/`setDependencies`/`setOptions` underneath); mutating in place
51
+ won't re-render.
52
+
53
+ `class`/`style` fall through onto the chart's root element automatically —
54
+ there's no separate prop for them.
55
+
56
+ ## Imperative handle
57
+
58
+ Props/events cover the declarative surface (tasks, dependencies, view
59
+ options, event listeners). For everything else, use a template ref:
60
+
61
+ ```vue
62
+ <script setup lang="ts">
63
+ import { ref } from "vue";
64
+ import { GanttChart, type GanttChartHandle } from "@ganttloom/gantt-vue";
65
+
66
+ const chartRef = ref<GanttChartHandle | null>(null);
67
+ </script>
68
+
69
+ <template>
70
+ <button @click="chartRef?.undo()">Undo</button>
71
+ <button @click="chartRef?.zoomIn()">Zoom in</button>
72
+ <GanttChart ref="chartRef" :tasks="tasks" enable-history />
73
+ </template>
74
+ ```
75
+
76
+ The exposed `GanttChartHandle` has: `undo`/`redo`/`canUndo`/`canRedo`,
77
+ `expandAll`/`collapseAll`/`toggleGroup`, `removeDependency`,
78
+ `updateDependency`, `updateTask`, `setViewMode`,
79
+ `zoomIn`/`zoomOut`/`getZoomLevel`, `fitToViewport`, `scrollToToday`,
80
+ `scrollToRangeStart`/`scrollToRangeEnd`, `getPageCount`/`setPage`,
81
+ `getResourceHistogram`, `getLeveledTasks`,
82
+ `selectTask`/`selectAllVisible`/`clearSelection`/`getSelectedTaskIds`/`bulkShiftDates`/`bulkDelete`,
83
+ `setSort`/`getSort`, `toSVGString`/`toPNGDataURL`/`toPNGDataURLs`,
84
+ `getRenderModel`, and `getInstance()` for direct access to the underlying
85
+ `@ganttloom/gantt-core` `GanttChart` when you need something not on this
86
+ list.
87
+
88
+ ## Multi-select and bulk actions
89
+
90
+ ```vue
91
+ <GanttChart
92
+ :tasks="tasks"
93
+ selectable
94
+ @selection-change="(taskIds) => (selectedCount = taskIds.length)"
95
+ />
96
+ ```
97
+
98
+ Click selects one bar, ctrl/cmd-click toggles it into the selection,
99
+ shift-click selects a range. Then drive it from the handle:
100
+ `chartRef.value?.bulkShiftDates(dayMs)`, `chartRef.value?.bulkDelete()`.
101
+
102
+ ## Row reorder and dependency editing
103
+
104
+ ```vue
105
+ <GanttChart
106
+ :tasks="tasks"
107
+ @task-reorder="(draggedId, targetId, position) => { /* position: before | after | inside */ }"
108
+ @dependency-dblclick="(dep) => {
109
+ // show your own 'edit link' UI, then:
110
+ chartRef?.updateDependency(dep.fromId, dep.toId, { type: 'SS' });
111
+ }"
112
+ />
113
+ ```
114
+
115
+ Both off by default (same construction-time-only wiring caveat as
116
+ `task-create` below — attach the listener from the first render).
117
+ Double-clicking a task bar itself fires the separate
118
+ `@task-dblclick="(task) => ..."`, same caveat.
119
+
120
+ ## Filling the viewport at any zoom level
121
+
122
+ A short project at month/year zoom, or just a handful of tasks, naturally
123
+ renders narrow. `auto-fit-to-viewport` stretches (never shrinks) the
124
+ timeline to fill the container instead of leaving empty space:
125
+
126
+ ```vue
127
+ <GanttChart :tasks="tasks" auto-fit-to-viewport />
128
+ ```
129
+
130
+ Off by default — upgrading doesn't silently change an existing chart's
131
+ pixel layout for anyone who hasn't opted in.
132
+
133
+ Always on, separately: the visible range is padded to a minimum tick count
134
+ per zoom level, so a short project at year/quarter zoom never collapses
135
+ into one or two lonely columns, and the date header stays pinned to the
136
+ top while scrolling a tall task list vertically (still scrolling
137
+ horizontally in sync with the bars).
138
+
139
+ ## Header position
140
+
141
+ `header-position` places the grid and timeline headers at `"top"` (the
142
+ default), `"bottom"`, or `"none"` to hide them entirely:
143
+
144
+ ```vue
145
+ <GanttChart :tasks="tasks" header-position="bottom" />
146
+ ```
147
+
148
+ ## Drag-to-create
149
+
150
+ Off by default; attach a `@task-create` listener to turn it on (the core
151
+ only wires the drag listener when a creation handler is present, so existing
152
+ consumers see no behavior change):
153
+
154
+ ```vue
155
+ <GanttChart :tasks="tasks" @task-create="(task) => console.log('created', task)" />
156
+ ```
157
+
158
+ > The core only checks for a listener **at mount** (same caveat as the other
159
+ > gated events above) — attach it from the first render if you want
160
+ > drag-to-create enabled; toggling it on after mount won't retroactively wire it.
161
+
162
+ ## Timeline markers, column resize/reorder, and search
163
+
164
+ ```vue
165
+ <script setup lang="ts">
166
+ import { filterTasks } from "@ganttloom/gantt-vue";
167
+ </script>
168
+
169
+ <template>
170
+ <GanttChart
171
+ :tasks="filterTasks(tasks, (t) => t.name.includes(query)).tasks"
172
+ :markers="[{ date: releaseDate, label: 'Release' }]"
173
+ @column-resize="(id, width) => (columnWidths[id] = width)"
174
+ @column-reorder="(order) => (columnOrder = order)"
175
+ />
176
+ </template>
177
+ ```
178
+
179
+ See `@ganttloom/gantt-core`'s README for the full behavior of each — the
180
+ props/events here are 1:1 mirrors of its `GanttOptions` fields, and
181
+ `filterTasks` is a pure re-export.
182
+
183
+ ## Column sorting
184
+
185
+ Mark a column `sortable`; clicking its header cycles asc → desc → none:
186
+
187
+ ```vue
188
+ <GanttChart
189
+ :tasks="tasks"
190
+ :columns="[{ id: 'name', title: 'Task', sortable: true }]"
191
+ @sort-change="(sort) => console.log(sort)"
192
+ />
193
+ ```
194
+
195
+ `chartRef.value?.setSort(columnId, direction)` / `.getSort()` are also
196
+ available on the handle.
197
+
198
+ ## Resource leveling and multi-page PNG export
199
+
200
+ ```ts
201
+ const { tasks: leveled, shifted } = chartRef.value!.getLeveledTasks();
202
+ if (shifted.length) tasks.value = leveled; // if you're holding tasks in your own state
203
+
204
+ const pages = await chartRef.value!.toPNGDataURLs({ pageWidthPx: 1600, pageHeightPx: 1200 });
205
+ ```
206
+
207
+ ## Resource histogram
208
+
209
+ ```vue
210
+ <script setup lang="ts">
211
+ import { computed } from "vue";
212
+ import { renderResourceHistogramSVG } from "@ganttloom/gantt-vue";
213
+
214
+ const histogramSvg = computed(() => renderResourceHistogramSVG(chartRef.value?.getResourceHistogram() ?? []));
215
+ </script>
216
+
217
+ <template>
218
+ <div v-html="histogramSvg" />
219
+ </template>
220
+ ```
221
+
222
+ ## Hover tooltips
223
+
224
+ On by default (name/dates/progress/assignees/notes), styled via plain CSS
225
+ (`.gantt-tooltip`, see `gantt-core`'s README) — not the browser's native
226
+ tooltip. `renderTooltip` fully replaces the content:
227
+
228
+ ```vue
229
+ <GanttChart
230
+ :tasks="tasks"
231
+ :render-tooltip="(task) => (task.isMilestone ? null : `${task.name} — ${task.progress ?? 0}%`)"
232
+ />
233
+ ```
234
+
235
+ Set `:show-tooltip="false"` to disable it entirely.
236
+
237
+ ## i18n / overridable labels
238
+
239
+ A handful of built-in strings (aria-labels, the default name for a
240
+ newly-created task, the tooltip's date/progress formatting) can be overridden
241
+ via the `labels` prop — see `gantt-core`'s README for the full field list:
242
+
243
+ ```vue
244
+ <GanttChart
245
+ :tasks="tasks"
246
+ :labels="{
247
+ expand: 'Développer',
248
+ collapse: 'Réduire',
249
+ newTaskName: 'Nouvelle tâche',
250
+ formatDate: (d) => d.toLocaleDateString('fr-FR'),
251
+ }"
252
+ />
253
+ ```
254
+
255
+ `labels.formatTickLabel` overrides the timeline header's own day/week/month
256
+ tick labels (distinct from `formatDate` above, which only covers the tooltip
257
+ and bar aria-label) - it receives each tick's `Date` and the current
258
+ `view-mode`:
259
+
260
+ ```vue
261
+ <GanttChart
262
+ :tasks="tasks"
263
+ view-mode="week"
264
+ :labels="{ formatTickLabel: (date, viewMode) => date.toLocaleDateString('fr-FR') }"
265
+ />
266
+ ```
267
+
268
+ ## Custom sort comparator
269
+
270
+ Set `sortFn` on a sortable `GanttColumn` to fully control its comparison
271
+ instead of the default accessor-based one - see `gantt-core`'s README for
272
+ details:
273
+
274
+ ```vue
275
+ <GanttChart
276
+ :tasks="tasks"
277
+ :columns="[
278
+ {
279
+ id: 'priority',
280
+ title: 'Priority',
281
+ accessor: (t) => t.data?.priority,
282
+ sortable: true,
283
+ sortFn: (a, b) => (a.data?.priority === 'high' ? -1 : 1),
284
+ },
285
+ ]"
286
+ />
287
+ ```
288
+
289
+ ## Custom task-bar rendering
290
+
291
+ `render-bar` lets you draw custom SVG content into a task bar (icons,
292
+ patterns, extra shapes) without forking the renderer - see `gantt-core`'s
293
+ README for the append-only contract that keeps drag/resize hit-testing intact:
294
+
295
+ ```vue
296
+ <GanttChart
297
+ :tasks="tasks"
298
+ :render-bar="
299
+ ({ task, bar, group }) => {
300
+ if (!task.data?.flagged) return;
301
+ const icon = document.createElementNS('http://www.w3.org/2000/svg', 'text');
302
+ icon.setAttribute('x', String(bar.width + 6));
303
+ icon.setAttribute('y', '-4');
304
+ icon.textContent = '⚑';
305
+ group.appendChild(icon);
306
+ }
307
+ "
308
+ />
309
+ ```
310
+
311
+ ## Arbitrary attributes on the root element
312
+
313
+ `<GanttChart>` has a single root `<div>`, so any attribute you pass that
314
+ isn't a declared prop - `id`, `data-*`, `aria-*`, `class`, `style`, etc. -
315
+ falls through onto it automatically (Vue's default [attribute
316
+ inheritance](https://vuejs.org/guide/components/attrs.html)), no extra prop
317
+ needed:
318
+
319
+ ```vue
320
+ <GanttChart :tasks="tasks" data-testid="project-gantt" aria-label="Project schedule" />
321
+ ```
322
+
323
+ ## `useGanttChart` (lower-level composable)
324
+
325
+ If you want to own the container element/DOM tree yourself instead of using
326
+ `<GanttChart />`:
327
+
328
+ ```vue
329
+ <script setup lang="ts">
330
+ import { ref } from "vue";
331
+ import { useGanttChart, type GanttTask, type GanttDependency } from "@ganttloom/gantt-vue";
332
+
333
+ const props = defineProps<{ tasks: GanttTask[]; dependencies: GanttDependency[] }>();
334
+ const containerRef = ref<HTMLDivElement | null>(null);
335
+ const { chart, canUndo, canRedo } = useGanttChart(
336
+ containerRef,
337
+ () => props.tasks,
338
+ () => props.dependencies,
339
+ () => ({ enableHistory: true })
340
+ );
341
+ </script>
342
+
343
+ <template>
344
+ <div ref="containerRef" />
345
+ </template>
346
+ ```
347
+
348
+ `useGanttChart` takes getter functions (not refs) for `tasks`/`dependencies`/`options`
349
+ so it can track whatever reactive source each one reads — a prop, a `ref`, a `computed`.
350
+
351
+ ## Re-exported types & helpers
352
+
353
+ For convenience, this package re-exports every `@ganttloom/gantt-core` type
354
+ (`GanttTask`, `GanttDependency`, `GanttColumn`, `GanttTheme`, `ViewMode`,
355
+ `WorkingCalendar`, `ConstraintType`, `ResourceLoadBucket`, etc.) and the
356
+ standalone helper functions (`computeWBSCodes`, `applyConstraint`,
357
+ `isWorkingDay`, `nextWorkingDay`, `computeResourceHistogram`,
358
+ `renderResourceHistogramSVG`, ...) so you never need
359
+ `@ganttloom/gantt-core` as a direct dependency just to reference them.
package/dist/index.cjs CHANGED
@@ -45,7 +45,6 @@ __export(index_exports, {
45
45
  module.exports = __toCommonJS(index_exports);
46
46
 
47
47
  // src/GanttChart.ts
48
- var import_styles = require("@ganttloom/gantt-core/styles.css");
49
48
  var import_vue2 = require("vue");
50
49
 
51
50
  // src/useGanttChart.ts
@@ -59,6 +58,7 @@ function useGanttChart(containerRef, getTasks, getDependencies, getOptions) {
59
58
  (0, import_vue.onMounted)(() => {
60
59
  const container = containerRef.value;
61
60
  if (!container) return;
61
+ (0, import_gantt_core.injectStyles)(container.ownerDocument);
62
62
  const instance = new import_gantt_core.GanttChart(container, getTasks(), getDependencies(), getOptions());
63
63
  chart.value = instance;
64
64
  canUndo.value = instance.canUndo;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/GanttChart.ts","../src/useGanttChart.ts"],"sourcesContent":["export { GanttChart, default } from \"./GanttChart\";\nexport type { GanttChartProps, GanttChartHandle } from \"./GanttChart\";\n\nexport { useGanttChart } from \"./useGanttChart\";\nexport type { UseGanttChartResult } from \"./useGanttChart\";\n\n// Re-exported so consumers never need to add @ganttloom/gantt-core as a direct\n// dependency just to reference its types.\nexport type {\n ViewMode,\n DependencyType,\n GanttDependency,\n GanttAssignee,\n GanttTask,\n GanttColumn,\n GanttTheme,\n GanttRenderRow,\n GanttRenderBar,\n GanttRenderLink,\n GanttRenderTick,\n GanttRenderModel,\n GanttOptions,\n GanttEventMap,\n WorkingCalendar,\n ConstraintType,\n ResourceHistogramOptions,\n ResourceLoadBucket,\n GanttMarker,\n GanttRenderMarker,\n FilterTasksOptions,\n FilterTasksResult,\n Density,\n ResourceLevelingOptions,\n ResourceLevelingResult,\n} from \"@ganttloom/gantt-core\";\n\nexport {\n computeWBSCodes,\n applyConstraint,\n isWorkingDay,\n isHoliday,\n isWithinWorkingHours,\n isWorkingTime,\n nextWorkingDay,\n previousWorkingDay,\n shiftToWorkingDay,\n shiftToWorkingTime,\n computeResourceHistogram,\n renderResourceHistogramSVG,\n filterTasks,\n colorByField,\n applyColorByField,\n DEFAULT_PALETTE,\n DENSITY_PRESETS,\n levelResources,\n} from \"@ganttloom/gantt-core\";\n","// Pulls in the core's default styles so consumers get a working chart out of the box.\r\n// This resolves through gantt-core's package.json \"exports\" map (\"./styles.css\" -> \"./dist/styles.css\").\r\n// If your bundler can't resolve CSS imports from a dependency's export map, import it yourself instead:\r\n// import \"@ganttloom/gantt-core/styles.css\";\r\nimport \"@ganttloom/gantt-core/styles.css\";\r\n\r\nimport {\r\n defineComponent,\r\n getCurrentInstance,\r\n h,\r\n onBeforeUnmount,\r\n ref,\r\n watch,\r\n type ExtractPropTypes,\r\n type PropType,\r\n} from \"vue\";\r\nimport type {\r\n GanttChart as GanttCore,\r\n GanttColumn,\r\n GanttDependency,\r\n GanttLabels,\r\n GanttMarker,\r\n GanttOptions,\r\n GanttRenderBarContext,\r\n GanttRenderModel,\r\n GanttTask,\r\n GanttTheme,\r\n ResourceHistogramOptions,\r\n ResourceLoadBucket,\r\n ResourceLevelingOptions,\r\n ResourceLevelingResult,\r\n ViewMode,\r\n WorkingCalendar,\r\n} from \"@ganttloom/gantt-core\";\r\nimport { useGanttChart } from \"./useGanttChart\";\r\n\r\n/** Imperative escape hatches, available via a template ref (see the package README). */\r\nexport interface GanttChartHandle {\r\n /** Reverts the most recent move/resize/link/progress/create action. No-op unless `enable-history` is set. */\r\n undo(): void;\r\n /** Re-applies the most recently undone action. No-op unless `enable-history` is set. */\r\n redo(): void;\r\n /** Whether `undo()` currently has anything to revert. */\r\n canUndo(): boolean;\r\n /** Whether `redo()` currently has anything to re-apply. */\r\n canRedo(): boolean;\r\n /** Expands every collapsed group row. */\r\n expandAll(): void;\r\n /** Collapses every group row that has children. */\r\n collapseAll(): void;\r\n /** Toggles a single group row's collapsed state. */\r\n toggleGroup(taskId: string): void;\r\n /** Removes a dependency link between two tasks, if it exists. */\r\n removeDependency(fromId: string, toId: string): void;\r\n /** Patches an existing dependency link's fields (e.g. its `type` or `lagMs`). */\r\n updateDependency(fromId: string, toId: string, partial: Partial<GanttDependency>): void;\r\n /** Patches a task's fields in place (e.g. dates, progress, name) and re-renders. */\r\n updateTask(id: string, partial: Partial<GanttTask>): void;\r\n /** Look up a task by id. Returns a cloned copy, or undefined if not found. */\r\n getTask(id: string): GanttTask | undefined;\r\n /** Add a new task to the chart. Undoable with enable-history. */\r\n addTask(task: GanttTask, options?: { parentId?: string; index?: number }): void;\r\n /** Delete a single task and any dependencies touching it. Undoable with enable-history. */\r\n deleteTask(id: string): void;\r\n /** Add a dependency link. Returns false if invalid (e.g. self-loop, duplicate, or cycle), true if added. Undoable with enable-history. */\r\n addDependency(dep: GanttDependency): boolean;\r\n /** Snapshot of current dependencies, as cloned copies. */\r\n getDependencies(): GanttDependency[];\r\n /** Convert a pixel offset in timeline space back to a real Date based on current rangeStart and zoom level. */\r\n getDateAtX(xPx: number): Date;\r\n /** Convert a Date to a pixel coordinate in timeline space. */\r\n getXForDate(date: Date): number;\r\n /** Switches the timeline's zoom level (hour/day/week/month/quarter/year). */\r\n setViewMode(mode: ViewMode): void;\r\n /** Grows `column-width` (never shrinks) so the timeline exactly fills the given container width. */\r\n fitToViewport(containerWidthPx: number): void;\r\n /** Scrolls the timeline so today's date is centered in the viewport. */\r\n scrollToToday(): void;\r\n /** Scrolls the timeline to the very start of the task date range. */\r\n scrollToRangeStart(): void;\r\n /** Scrolls the timeline to the very end of the task date range. */\r\n scrollToRangeEnd(): void;\r\n /** Total number of pages, when `pagination` is set (always `1` otherwise). */\r\n getPageCount(): number;\r\n /** Jumps to a 1-indexed page of top-level rows, when `pagination` is set. */\r\n setPage(page: number): void;\r\n /** Multiplies `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomIn(factor?: number): void;\r\n /** Divides `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomOut(factor?: number): void;\r\n /** Current `column-width` in px per smallest time unit. */\r\n getZoomLevel(): number;\r\n /** Per-assignee workload buckets, for spotting over-allocation. */\r\n getResourceHistogram(options?: ResourceHistogramOptions): ResourceLoadBucket[];\r\n /** Computes a conflict-free schedule by delaying double-booked assignees' tasks; does not mutate the chart's own tasks. */\r\n getLeveledTasks(options?: ResourceLevelingOptions): ResourceLevelingResult;\r\n /** Selects one task bar; pass `{ additive: true }` to add to the existing selection instead of replacing it. Requires `selectable`. */\r\n selectTask(id: string, options?: { additive?: boolean }): void;\r\n /** Selects every currently-visible task bar. Requires `selectable`. */\r\n selectAllVisible(): void;\r\n /** Clears the current bar selection. */\r\n clearSelection(): void;\r\n /** IDs of the currently-selected task bars. */\r\n getSelectedTaskIds(): string[];\r\n /** Sorts sibling rows at every tree level by a column's value; `direction` omitted/`null` clears sorting. */\r\n setSort(columnId: string | null, direction?: \"asc\" | \"desc\" | null): void;\r\n /** The current sort state, or `null` if unsorted. */\r\n getSort(): { columnId: string; direction: \"asc\" | \"desc\" } | null;\r\n /** Shifts every selected task's start/end by `deltaMs`. Requires `selectable`. */\r\n bulkShiftDates(deltaMs: number): void;\r\n /** Deletes every currently-selected task. Requires `selectable`. */\r\n bulkDelete(): void;\r\n /** Serializes the current chart to a standalone SVG string. */\r\n toSVGString(): string;\r\n /** Renders the current chart to a single PNG data URL. */\r\n toPNGDataURL(): Promise<string>;\r\n /** Renders the current chart to one PNG data URL per page, tiled to the given page pixel size. */\r\n toPNGDataURLs(options?: { pageWidthPx?: number; pageHeightPx?: number }): Promise<string[]>;\r\n /** The current computed render model (rows/bars/links/ticks), or `null` before first render. */\r\n getRenderModel(): GanttRenderModel | null;\r\n /** Direct access to the underlying framework-agnostic core instance (null before mount). */\r\n getInstance(): GanttCore | null;\r\n}\r\n\r\nconst EMPTY_RENDER_MODEL: GanttRenderModel = {\r\n width: 0,\r\n height: 0,\r\n rowHeight: 0,\r\n headerHeight: 0,\r\n rows: [],\r\n bars: [],\r\n links: [],\r\n ticks: [],\r\n columns: [],\r\n theme: {} as GanttTheme,\r\n markers: [],\r\n rangeStart: new Date(0),\r\n sort: null,\r\n};\r\n\r\n/**\r\n * Checks whether the parent actually bound a listener for `eventName` (e.g. \"onTaskCreate\")\r\n * on this component's *initial* vnode. A handful of gantt-core options only wire up their\r\n * DOM interaction (drag-to-create, column resize/reorder, dependency double-click, context\r\n * menu) when the corresponding callback is truthy AT CONSTRUCTION TIME — so a stable no-op\r\n * is passed there to force the wiring on, and the real dispatch goes through the reactive\r\n * \"task-create\" etc. event subscription below instead. Reading `vnode.props` (rather than a\r\n * declared prop/emit) is what lets this stay accurate for both `@task-create=\"...\"` template\r\n * listeners and a plain `onTaskCreate` prop, without needing the caller to pass anything else.\r\n */\r\nfunction hasInitialListener(eventName: string): boolean {\r\n const instance = getCurrentInstance();\r\n return !!(instance?.vnode.props && eventName in instance.vnode.props);\r\n}\r\n\r\nconst ganttChartProps = {\r\n tasks: { type: Array as PropType<GanttTask[]>, required: true },\r\n dependencies: { type: Array as PropType<GanttDependency[]>, default: () => [] },\r\n viewMode: { type: String as PropType<ViewMode>, default: undefined },\r\n columns: { type: Array as PropType<GanttColumn[]>, default: undefined },\r\n theme: { type: Object as PropType<Partial<GanttTheme>>, default: undefined },\r\n colorScheme: { type: String as PropType<\"light\" | \"dark\" | \"auto\">, default: undefined },\r\n columnWidth: { type: Number, default: undefined },\r\n readonly: { type: Boolean, default: undefined },\r\n showProgress: { type: Boolean, default: undefined },\r\n showDependencies: { type: Boolean, default: undefined },\r\n gridPanelWidth: { type: Number, default: undefined },\r\n showCriticalPath: { type: Boolean, default: undefined },\r\n showBaseline: { type: Boolean, default: undefined },\r\n showDeadlines: { type: Boolean, default: undefined },\r\n /** Positions the grid and timeline headers. Default is \"top\". */\r\n headerPosition: { type: String as PropType<\"top\" | \"bottom\" | \"none\">, default: undefined },\r\n /** hover tooltip on task bars, defaults to true. A floating, CSS-customizable element (`.gantt-tooltip`) - not the browser's native title tooltip. */\r\n showTooltip: { type: Boolean, default: undefined },\r\n /** fully control tooltip content/markup; return null/undefined to suppress it for a specific task. Defaults to name/dates/progress/assignees/notes. */\r\n renderTooltip: {\r\n type: Function as PropType<(task: GanttTask) => HTMLElement | string | null | undefined>,\r\n default: undefined,\r\n },\r\n /** Overridable UI strings/formatters (aria-labels, default new-task name, tooltip date/progress formatting) for i18n or custom copy. */\r\n labels: { type: Object as PropType<GanttLabels>, default: undefined },\r\n /**\r\n * Customize a task bar's visual content beyond color/label (icons, patterns, custom shapes)\r\n * without forking the renderer - mutate `ctx.group` in place. See `GanttRenderBarContext` in\r\n * gantt-core for the append-only contract that keeps drag/resize hit-testing intact.\r\n */\r\n renderBar: {\r\n type: Function as PropType<(ctx: GanttRenderBarContext) => void>,\r\n default: undefined,\r\n },\r\n showAssigneeAvatars: { type: Boolean, default: undefined },\r\n enableHistory: { type: Boolean, default: undefined },\r\n keyboardAccessible: { type: Boolean, default: undefined },\r\n virtualScroll: { type: Boolean, default: undefined },\r\n autoSchedule: { type: Boolean, default: undefined },\r\n pagination: { type: Object as PropType<{ pageSize: number; page: number }>, default: undefined },\r\n snapToUnit: { type: [String, Boolean] as PropType<\"hour\" | \"day\" | \"week\" | false>, default: undefined },\r\n /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */\r\n calendar: { type: Object as PropType<WorkingCalendar>, default: undefined },\r\n /** arbitrary labeled vertical lines on the timeline, independent of any task */\r\n markers: { type: Array as PropType<GanttMarker[]>, default: undefined },\r\n /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */\r\n autoRollupProgress: { type: Boolean, default: undefined },\r\n /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */\r\n selectable: { type: Boolean, default: undefined },\r\n /**\r\n * Stretch (never shrink) the timeline to fill the container's width instead of leaving empty\r\n * space - the common \"short project at month/year zoom\" or \"just a few tasks\" case. Off by\r\n * default (a new chart's pixel layout shouldn't change for existing consumers who don't opt in).\r\n */\r\n autoFitToViewport: { type: Boolean, default: undefined },\r\n} as const;\r\n\r\nexport type GanttChartProps = ExtractPropTypes<typeof ganttChartProps>;\r\n\r\nconst ganttChartEmits = {\r\n \"date-change\": (_task: GanttTask, _start: Date, _end: Date) => true,\r\n \"progress-change\": (_task: GanttTask, _progress: number) => true,\r\n \"dependency-create\": (_dep: GanttDependency) => true,\r\n \"dependency-remove\": (_dep: GanttDependency) => true,\r\n \"dependency-dblclick\": (_dep: GanttDependency) => true,\r\n \"task-click\": (_task: GanttTask) => true,\r\n \"task-dblclick\": (_task: GanttTask) => true,\r\n \"group-toggle\": (_task: GanttTask, _collapsed: boolean) => true,\r\n \"context-menu\": (_task: GanttTask, _evt: PointerEvent) => true,\r\n \"task-create\": (_task: GanttTask) => true,\r\n \"column-resize\": (_columnId: string, _width: number) => true,\r\n \"column-reorder\": (_order: string[]) => true,\r\n \"task-reorder\": (\r\n _draggedTaskId: string,\r\n _targetTaskId: string,\r\n _position: \"before\" | \"after\" | \"inside\"\r\n ) => true,\r\n \"selection-change\": (_taskIds: string[]) => true,\r\n \"sort-change\": (_sort: { columnId: string; direction: \"asc\" | \"desc\" } | null) => true,\r\n};\r\n\r\nexport const GanttChart = defineComponent({\r\n name: \"GanttChart\",\r\n props: ganttChartProps,\r\n emits: ganttChartEmits,\r\n setup(props, { emit, expose }) {\r\n const containerRef = ref<HTMLElement | null>(null);\r\n const noop = () => {};\r\n\r\n // See hasInitialListener's doc comment: these six only affect whether gantt-core wires\r\n // up the relevant DOM interaction at construction, and are captured once, up front.\r\n // onContextMenu is deliberately always wired (unlike the other six) so right-click\r\n // handling works out of the box even for consumers who haven't attached a listener.\r\n const wireTaskCreate = hasInitialListener(\"onTaskCreate\");\r\n const wireColumnResize = hasInitialListener(\"onColumnResize\");\r\n const wireColumnReorder = hasInitialListener(\"onColumnReorder\");\r\n const wireTaskReorder = hasInitialListener(\"onTaskReorder\");\r\n const wireDependencyDblClick = hasInitialListener(\"onDependencyDblClick\");\r\n const wireTaskDblClick = hasInitialListener(\"onTaskDblClick\");\r\n\r\n // gantt-core invokes every one of these seven callbacks from a call site that ALSO\r\n // unconditionally emits the matching public event (\"date-change\", \"selection-change\", ...).\r\n // So none of them belong in `options` below — doing that would fire the Vue listener\r\n // twice per event, once here and once through the chart.on(...) subscription further down.\r\n // options only ever needs: (a) the six gate-a-DOM-feature callbacks, as stable no-ops/undefined\r\n // purely to control wiring, and (b) everything else, which is plain reactive config.\r\n const getOptions = (): GanttOptions => ({\r\n viewMode: props.viewMode,\r\n columns: props.columns,\r\n theme: props.theme,\r\n colorScheme: props.colorScheme,\r\n columnWidth: props.columnWidth,\r\n readonly: props.readonly,\r\n showProgress: props.showProgress,\r\n showDependencies: props.showDependencies,\r\n gridPanelWidth: props.gridPanelWidth,\r\n showCriticalPath: props.showCriticalPath,\r\n showBaseline: props.showBaseline,\r\n showDeadlines: props.showDeadlines,\r\n headerPosition: props.headerPosition,\r\n showTooltip: props.showTooltip,\r\n renderTooltip: props.renderTooltip,\r\n labels: props.labels,\r\n renderBar: props.renderBar,\r\n showAssigneeAvatars: props.showAssigneeAvatars,\r\n enableHistory: props.enableHistory,\r\n keyboardAccessible: props.keyboardAccessible,\r\n virtualScroll: props.virtualScroll,\r\n autoSchedule: props.autoSchedule,\r\n pagination: props.pagination,\r\n snapToUnit: props.snapToUnit,\r\n calendar: props.calendar,\r\n markers: props.markers,\r\n autoRollupProgress: props.autoRollupProgress,\r\n selectable: props.selectable,\r\n autoFitToViewport: props.autoFitToViewport,\r\n onContextMenu: noop,\r\n onTaskCreate: wireTaskCreate ? noop : undefined,\r\n onColumnResize: wireColumnResize ? noop : undefined,\r\n onColumnReorder: wireColumnReorder ? noop : undefined,\r\n onTaskReorder: wireTaskReorder ? noop : undefined,\r\n onDependencyDblClick: wireDependencyDblClick ? noop : undefined,\r\n onTaskDblClick: wireTaskDblClick ? noop : undefined,\r\n });\r\n\r\n const { chart } = useGanttChart(\r\n containerRef,\r\n () => props.tasks,\r\n () => props.dependencies,\r\n getOptions\r\n );\r\n\r\n // useGanttChart already watches getOptions and calls setOptions on change -\r\n // no need to duplicate that here.\r\n\r\n // All real event dispatch goes through the chart's public emitter — set up once when the\r\n // instance appears. `emit` is stable for the component's lifetime, so (unlike the React\r\n // wrapper's ref-of-latest-callback dance) there's no need to guard against re-subscribing.\r\n watch(chart, (instance, _prev, onCleanup) => {\r\n if (!instance) return;\r\n instance.on(\"date-change\", handleDateChange);\r\n instance.on(\"progress-change\", handleProgressChange);\r\n instance.on(\"dependency-create\", handleDependencyCreate);\r\n instance.on(\"dependency-remove\", handleDependencyRemove);\r\n instance.on(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.on(\"task-click\", handleTaskClick);\r\n instance.on(\"task-dblclick\", handleTaskDblClick);\r\n instance.on(\"group-toggle\", handleGroupToggle);\r\n instance.on(\"context-menu\", handleContextMenu);\r\n instance.on(\"task-create\", handleTaskCreate);\r\n instance.on(\"column-resize\", handleColumnResize);\r\n instance.on(\"column-reorder\", handleColumnReorder);\r\n instance.on(\"task-reorder\", handleTaskReorder);\r\n instance.on(\"selection-change\", handleSelectionChange);\r\n instance.on(\"sort-change\", handleSortChange);\r\n onCleanup(() => {\r\n instance.off(\"date-change\", handleDateChange);\r\n instance.off(\"progress-change\", handleProgressChange);\r\n instance.off(\"dependency-create\", handleDependencyCreate);\r\n instance.off(\"dependency-remove\", handleDependencyRemove);\r\n instance.off(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.off(\"task-click\", handleTaskClick);\r\n instance.off(\"task-dblclick\", handleTaskDblClick);\r\n instance.off(\"group-toggle\", handleGroupToggle);\r\n instance.off(\"context-menu\", handleContextMenu);\r\n instance.off(\"task-create\", handleTaskCreate);\r\n instance.off(\"column-resize\", handleColumnResize);\r\n instance.off(\"column-reorder\", handleColumnReorder);\r\n instance.off(\"task-reorder\", handleTaskReorder);\r\n instance.off(\"selection-change\", handleSelectionChange);\r\n instance.off(\"sort-change\", handleSortChange);\r\n });\r\n }, { flush: \"sync\" }); // synchronous: chart.value is set inside useGanttChart's onMounted,\r\n // and listeners must be attached before that same tick's synchronous code (e.g. a ref call\r\n // right after mount) can trigger an event — Vue's default 'pre' flush would run this a tick late.\r\n\r\n function handleDateChange(p: { task: GanttTask; start: Date; end: Date }) {\r\n emit(\"date-change\", p.task, p.start, p.end);\r\n }\r\n function handleProgressChange(p: { task: GanttTask; progress: number }) {\r\n emit(\"progress-change\", p.task, p.progress);\r\n }\r\n function handleDependencyCreate(dep: GanttDependency) {\r\n emit(\"dependency-create\", dep);\r\n }\r\n function handleDependencyRemove(dep: GanttDependency) {\r\n emit(\"dependency-remove\", dep);\r\n }\r\n function handleDependencyDblClick(dep: GanttDependency) {\r\n emit(\"dependency-dblclick\", dep);\r\n }\r\n function handleTaskClick(p: { task: GanttTask }) {\r\n emit(\"task-click\", p.task);\r\n }\r\n function handleTaskDblClick(p: { task: GanttTask }) {\r\n emit(\"task-dblclick\", p.task);\r\n }\r\n function handleGroupToggle(p: { task: GanttTask; collapsed: boolean }) {\r\n emit(\"group-toggle\", p.task, p.collapsed);\r\n }\r\n function handleContextMenu(p: { task: GanttTask; evt: PointerEvent }) {\r\n emit(\"context-menu\", p.task, p.evt);\r\n }\r\n function handleTaskCreate(p: { task: GanttTask }) {\r\n emit(\"task-create\", p.task);\r\n }\r\n function handleColumnResize(p: { columnId: string; width: number }) {\r\n emit(\"column-resize\", p.columnId, p.width);\r\n }\r\n function handleColumnReorder(p: { order: string[] }) {\r\n emit(\"column-reorder\", p.order);\r\n }\r\n function handleTaskReorder(p: {\r\n draggedTaskId: string;\r\n targetTaskId: string;\r\n position: \"before\" | \"after\" | \"inside\";\r\n }) {\r\n emit(\"task-reorder\", p.draggedTaskId, p.targetTaskId, p.position);\r\n }\r\n function handleSelectionChange(p: { taskIds: string[] }) {\r\n emit(\"selection-change\", p.taskIds);\r\n }\r\n function handleSortChange(p: { sort: { columnId: string; direction: \"asc\" | \"desc\" } | null }) {\r\n emit(\"sort-change\", p.sort);\r\n }\r\n\r\n onBeforeUnmount(() => {\r\n containerRef.value = null;\r\n });\r\n\r\n const handle: GanttChartHandle = {\r\n undo: () => chart.value?.undo(),\r\n redo: () => chart.value?.redo(),\r\n canUndo: () => chart.value?.canUndo ?? false,\r\n canRedo: () => chart.value?.canRedo ?? false,\r\n expandAll: () => chart.value?.expandAll(),\r\n collapseAll: () => chart.value?.collapseAll(),\r\n toggleGroup: (taskId) => chart.value?.toggleGroup(taskId),\r\n removeDependency: (fromId, toId) => chart.value?.removeDependency(fromId, toId),\r\n updateDependency: (fromId, toId, partial) => chart.value?.updateDependency(fromId, toId, partial),\r\n updateTask: (id, partial) => chart.value?.updateTask(id, partial),\r\n getTask: (id) => chart.value?.getTask(id),\r\n addTask: (task, options) => chart.value?.addTask(task, options),\r\n deleteTask: (id) => chart.value?.deleteTask(id),\r\n addDependency: (dep) => chart.value?.addDependency(dep) ?? false,\r\n getDependencies: () => chart.value?.getDependencies() ?? [],\r\n getDateAtX: (xPx) => chart.value?.getDateAtX(xPx) ?? new Date(0),\r\n getXForDate: (date) => chart.value?.getXForDate(date) ?? 0,\r\n setViewMode: (mode) => chart.value?.setViewMode(mode),\r\n fitToViewport: (containerWidthPx) => chart.value?.fitToViewport(containerWidthPx),\r\n scrollToToday: () => chart.value?.scrollToToday(),\r\n scrollToRangeStart: () => chart.value?.scrollToRangeStart(),\r\n scrollToRangeEnd: () => chart.value?.scrollToRangeEnd(),\r\n getPageCount: () => chart.value?.getPageCount() ?? 1,\r\n setPage: (page) => chart.value?.setPage(page),\r\n zoomIn: (factor) => chart.value?.zoomIn(factor),\r\n zoomOut: (factor) => chart.value?.zoomOut(factor),\r\n getZoomLevel: () => chart.value?.getZoomLevel() ?? 0,\r\n getResourceHistogram: (options) => chart.value?.getResourceHistogram(options) ?? [],\r\n getLeveledTasks: (options) => chart.value?.getLeveledTasks(options) ?? { tasks: [], shifted: [] },\r\n selectTask: (id, options) => chart.value?.selectTask(id, options),\r\n selectAllVisible: () => chart.value?.selectAllVisible(),\r\n clearSelection: () => chart.value?.clearSelection(),\r\n getSelectedTaskIds: () => chart.value?.getSelectedTaskIds() ?? [],\r\n setSort: (columnId, direction) => chart.value?.setSort(columnId, direction),\r\n getSort: () => chart.value?.getSort() ?? null,\r\n bulkShiftDates: (deltaMs) => chart.value?.bulkShiftDates(deltaMs),\r\n bulkDelete: () => chart.value?.bulkDelete(),\r\n toSVGString: () => chart.value?.toSVGString() ?? \"\",\r\n toPNGDataURL: () => chart.value?.toPNGDataURL() ?? Promise.resolve(\"\"),\r\n toPNGDataURLs: (options) => chart.value?.toPNGDataURLs(options) ?? Promise.resolve([]),\r\n getRenderModel: () => chart.value?.getRenderModel() ?? EMPTY_RENDER_MODEL,\r\n getInstance: () => chart.value,\r\n };\r\n expose(handle);\r\n\r\n // A single root element: class/style attrs fall through onto it automatically.\r\n return () => h(\"div\", { ref: containerRef });\r\n },\r\n});\r\n\r\nexport default GanttChart;\r\n","import { onBeforeUnmount, onMounted, shallowRef, watch, type Ref, type ShallowRef } from \"vue\";\nimport { GanttChart as GanttCore } from \"@ganttloom/gantt-core\";\nimport type { GanttDependency, GanttOptions, GanttTask } from \"@ganttloom/gantt-core\";\n\nexport interface UseGanttChartResult {\n /** The underlying framework-agnostic GanttChart instance, or null before the mount effect runs. */\n chart: ShallowRef<GanttCore | null>;\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\n canUndo: Ref<boolean>;\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\n canRedo: Ref<boolean>;\n}\n\n/**\n * Lower-level escape hatch for consumers who want to own their own container element\n * and DOM tree instead of using the <GanttChart /> component. Constructs a\n * @ganttloom/gantt-core GanttChart instance against `containerRef.value` on mount,\n * keeps it in sync with the tasks/dependencies/options getters via setTasks / setDependencies /\n * setOptions (reference-equality checks only — return a new array/object to trigger a sync),\n * and destroys it on unmount.\n *\n * `getTasks`/`getDependencies`/`getOptions` are plain functions (not refs) so this composable\n * can track whatever reactive source each one reads — a prop, a ref, a computed — without\n * imposing a shape on the caller.\n */\nexport function useGanttChart(\n containerRef: Ref<HTMLElement | null>,\n getTasks: () => GanttTask[],\n getDependencies: () => GanttDependency[],\n getOptions: () => GanttOptions\n): UseGanttChartResult {\n const chart = shallowRef<GanttCore | null>(null);\n const canUndo = shallowRef(false);\n const canRedo = shallowRef(false);\n\n let onHistoryChange: ((state: { canUndo: boolean; canRedo: boolean }) => void) | undefined;\n\n onMounted(() => {\n const container = containerRef.value;\n if (!container) return;\n\n const instance = new GanttCore(container, getTasks(), getDependencies(), getOptions());\n chart.value = instance;\n canUndo.value = instance.canUndo;\n canRedo.value = instance.canRedo;\n\n onHistoryChange = (state) => {\n canUndo.value = state.canUndo;\n canRedo.value = state.canRedo;\n };\n instance.on(\"history-change\", onHistoryChange);\n });\n\n onBeforeUnmount(() => {\n const instance = chart.value;\n if (!instance) return;\n if (onHistoryChange) instance.off(\"history-change\", onHistoryChange);\n instance.destroy();\n chart.value = null;\n canUndo.value = false;\n canRedo.value = false;\n });\n\n // Non-immediate: the initial values were already passed to the constructor above,\n // so these only need to fire on subsequent changes.\n watch(getTasks, (tasks) => chart.value?.setTasks(tasks));\n watch(getDependencies, (deps) => chart.value?.setDependencies(deps));\n watch(getOptions, (options) => chart.value?.setOptions(options));\n\n return { chart, canUndo, canRedo };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIA,oBAAO;AAEP,IAAAA,cASO;;;ACfP,iBAAyF;AACzF,wBAAwC;AAwBjC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QAAQ,QAAQ,EAAE;AAAA,MACrE,eAAe,CAAC,YAAY,MAAM,OAAO,cAAc,OAAO,KAAK,QAAQ,QAAQ,CAAC,CAAC;AAAA,MACrF,gBAAgB,MAAM,MAAM,OAAO,eAAe,KAAK;AAAA,MACvD,aAAa,MAAM,MAAM;AAAA,IAC3B;AACA,WAAO,MAAM;AAGb,WAAO,UAAM,eAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AAAA,EAC7C;AACF,CAAC;AAED,IAAO,qBAAQ;;;ADraf,IAAAC,qBAmBO;","names":["import_vue","GanttCore","import_gantt_core"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/GanttChart.ts","../src/useGanttChart.ts"],"sourcesContent":["export { GanttChart, default } from \"./GanttChart\";\nexport type { GanttChartProps, GanttChartHandle } from \"./GanttChart\";\n\nexport { useGanttChart } from \"./useGanttChart\";\nexport type { UseGanttChartResult } from \"./useGanttChart\";\n\n// Re-exported so consumers never need to add @ganttloom/gantt-core as a direct\n// dependency just to reference its types.\nexport type {\n ViewMode,\n DependencyType,\n GanttDependency,\n GanttAssignee,\n GanttTask,\n GanttColumn,\n GanttTheme,\n GanttRenderRow,\n GanttRenderBar,\n GanttRenderLink,\n GanttRenderTick,\n GanttRenderModel,\n GanttOptions,\n GanttEventMap,\n WorkingCalendar,\n ConstraintType,\n ResourceHistogramOptions,\n ResourceLoadBucket,\n GanttMarker,\n GanttRenderMarker,\n FilterTasksOptions,\n FilterTasksResult,\n Density,\n ResourceLevelingOptions,\n ResourceLevelingResult,\n} from \"@ganttloom/gantt-core\";\n\nexport {\n computeWBSCodes,\n applyConstraint,\n isWorkingDay,\n isHoliday,\n isWithinWorkingHours,\n isWorkingTime,\n nextWorkingDay,\n previousWorkingDay,\n shiftToWorkingDay,\n shiftToWorkingTime,\n computeResourceHistogram,\n renderResourceHistogramSVG,\n filterTasks,\n colorByField,\n applyColorByField,\n DEFAULT_PALETTE,\n DENSITY_PRESETS,\n levelResources,\n} from \"@ganttloom/gantt-core\";\n","import {\r\n defineComponent,\r\n getCurrentInstance,\r\n h,\r\n onBeforeUnmount,\r\n ref,\r\n watch,\r\n type ExtractPropTypes,\r\n type PropType,\r\n} from \"vue\";\r\nimport type {\r\n GanttChart as GanttCore,\r\n GanttColumn,\r\n GanttDependency,\r\n GanttLabels,\r\n GanttMarker,\r\n GanttOptions,\r\n GanttRenderBarContext,\r\n GanttRenderModel,\r\n GanttTask,\r\n GanttTheme,\r\n ResourceHistogramOptions,\r\n ResourceLoadBucket,\r\n ResourceLevelingOptions,\r\n ResourceLevelingResult,\r\n ViewMode,\r\n WorkingCalendar,\r\n} from \"@ganttloom/gantt-core\";\r\nimport { useGanttChart } from \"./useGanttChart\";\r\n\r\n/** Imperative escape hatches, available via a template ref (see the package README). */\r\nexport interface GanttChartHandle {\r\n /** Reverts the most recent move/resize/link/progress/create action. No-op unless `enable-history` is set. */\r\n undo(): void;\r\n /** Re-applies the most recently undone action. No-op unless `enable-history` is set. */\r\n redo(): void;\r\n /** Whether `undo()` currently has anything to revert. */\r\n canUndo(): boolean;\r\n /** Whether `redo()` currently has anything to re-apply. */\r\n canRedo(): boolean;\r\n /** Expands every collapsed group row. */\r\n expandAll(): void;\r\n /** Collapses every group row that has children. */\r\n collapseAll(): void;\r\n /** Toggles a single group row's collapsed state. */\r\n toggleGroup(taskId: string): void;\r\n /** Removes a dependency link between two tasks, if it exists. */\r\n removeDependency(fromId: string, toId: string): void;\r\n /** Patches an existing dependency link's fields (e.g. its `type` or `lagMs`). */\r\n updateDependency(fromId: string, toId: string, partial: Partial<GanttDependency>): void;\r\n /** Patches a task's fields in place (e.g. dates, progress, name) and re-renders. */\r\n updateTask(id: string, partial: Partial<GanttTask>): void;\r\n /** Look up a task by id. Returns a cloned copy, or undefined if not found. */\r\n getTask(id: string): GanttTask | undefined;\r\n /** Add a new task to the chart. Undoable with enable-history. */\r\n addTask(task: GanttTask, options?: { parentId?: string; index?: number }): void;\r\n /** Delete a single task and any dependencies touching it. Undoable with enable-history. */\r\n deleteTask(id: string): void;\r\n /** Add a dependency link. Returns false if invalid (e.g. self-loop, duplicate, or cycle), true if added. Undoable with enable-history. */\r\n addDependency(dep: GanttDependency): boolean;\r\n /** Snapshot of current dependencies, as cloned copies. */\r\n getDependencies(): GanttDependency[];\r\n /** Convert a pixel offset in timeline space back to a real Date based on current rangeStart and zoom level. */\r\n getDateAtX(xPx: number): Date;\r\n /** Convert a Date to a pixel coordinate in timeline space. */\r\n getXForDate(date: Date): number;\r\n /** Switches the timeline's zoom level (hour/day/week/month/quarter/year). */\r\n setViewMode(mode: ViewMode): void;\r\n /** Grows `column-width` (never shrinks) so the timeline exactly fills the given container width. */\r\n fitToViewport(containerWidthPx: number): void;\r\n /** Scrolls the timeline so today's date is centered in the viewport. */\r\n scrollToToday(): void;\r\n /** Scrolls the timeline to the very start of the task date range. */\r\n scrollToRangeStart(): void;\r\n /** Scrolls the timeline to the very end of the task date range. */\r\n scrollToRangeEnd(): void;\r\n /** Total number of pages, when `pagination` is set (always `1` otherwise). */\r\n getPageCount(): number;\r\n /** Jumps to a 1-indexed page of top-level rows, when `pagination` is set. */\r\n setPage(page: number): void;\r\n /** Multiplies `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomIn(factor?: number): void;\r\n /** Divides `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomOut(factor?: number): void;\r\n /** Current `column-width` in px per smallest time unit. */\r\n getZoomLevel(): number;\r\n /** Per-assignee workload buckets, for spotting over-allocation. */\r\n getResourceHistogram(options?: ResourceHistogramOptions): ResourceLoadBucket[];\r\n /** Computes a conflict-free schedule by delaying double-booked assignees' tasks; does not mutate the chart's own tasks. */\r\n getLeveledTasks(options?: ResourceLevelingOptions): ResourceLevelingResult;\r\n /** Selects one task bar; pass `{ additive: true }` to add to the existing selection instead of replacing it. Requires `selectable`. */\r\n selectTask(id: string, options?: { additive?: boolean }): void;\r\n /** Selects every currently-visible task bar. Requires `selectable`. */\r\n selectAllVisible(): void;\r\n /** Clears the current bar selection. */\r\n clearSelection(): void;\r\n /** IDs of the currently-selected task bars. */\r\n getSelectedTaskIds(): string[];\r\n /** Sorts sibling rows at every tree level by a column's value; `direction` omitted/`null` clears sorting. */\r\n setSort(columnId: string | null, direction?: \"asc\" | \"desc\" | null): void;\r\n /** The current sort state, or `null` if unsorted. */\r\n getSort(): { columnId: string; direction: \"asc\" | \"desc\" } | null;\r\n /** Shifts every selected task's start/end by `deltaMs`. Requires `selectable`. */\r\n bulkShiftDates(deltaMs: number): void;\r\n /** Deletes every currently-selected task. Requires `selectable`. */\r\n bulkDelete(): void;\r\n /** Serializes the current chart to a standalone SVG string. */\r\n toSVGString(): string;\r\n /** Renders the current chart to a single PNG data URL. */\r\n toPNGDataURL(): Promise<string>;\r\n /** Renders the current chart to one PNG data URL per page, tiled to the given page pixel size. */\r\n toPNGDataURLs(options?: { pageWidthPx?: number; pageHeightPx?: number }): Promise<string[]>;\r\n /** The current computed render model (rows/bars/links/ticks), or `null` before first render. */\r\n getRenderModel(): GanttRenderModel | null;\r\n /** Direct access to the underlying framework-agnostic core instance (null before mount). */\r\n getInstance(): GanttCore | null;\r\n}\r\n\r\nconst EMPTY_RENDER_MODEL: GanttRenderModel = {\r\n width: 0,\r\n height: 0,\r\n rowHeight: 0,\r\n headerHeight: 0,\r\n rows: [],\r\n bars: [],\r\n links: [],\r\n ticks: [],\r\n columns: [],\r\n theme: {} as GanttTheme,\r\n markers: [],\r\n rangeStart: new Date(0),\r\n sort: null,\r\n};\r\n\r\n/**\r\n * Checks whether the parent actually bound a listener for `eventName` (e.g. \"onTaskCreate\")\r\n * on this component's *initial* vnode. A handful of gantt-core options only wire up their\r\n * DOM interaction (drag-to-create, column resize/reorder, dependency double-click, context\r\n * menu) when the corresponding callback is truthy AT CONSTRUCTION TIME — so a stable no-op\r\n * is passed there to force the wiring on, and the real dispatch goes through the reactive\r\n * \"task-create\" etc. event subscription below instead. Reading `vnode.props` (rather than a\r\n * declared prop/emit) is what lets this stay accurate for both `@task-create=\"...\"` template\r\n * listeners and a plain `onTaskCreate` prop, without needing the caller to pass anything else.\r\n */\r\nfunction hasInitialListener(eventName: string): boolean {\r\n const instance = getCurrentInstance();\r\n return !!(instance?.vnode.props && eventName in instance.vnode.props);\r\n}\r\n\r\nconst ganttChartProps = {\r\n tasks: { type: Array as PropType<GanttTask[]>, required: true },\r\n dependencies: { type: Array as PropType<GanttDependency[]>, default: () => [] },\r\n viewMode: { type: String as PropType<ViewMode>, default: undefined },\r\n columns: { type: Array as PropType<GanttColumn[]>, default: undefined },\r\n theme: { type: Object as PropType<Partial<GanttTheme>>, default: undefined },\r\n colorScheme: { type: String as PropType<\"light\" | \"dark\" | \"auto\">, default: undefined },\r\n columnWidth: { type: Number, default: undefined },\r\n readonly: { type: Boolean, default: undefined },\r\n showProgress: { type: Boolean, default: undefined },\r\n showDependencies: { type: Boolean, default: undefined },\r\n gridPanelWidth: { type: Number, default: undefined },\r\n showCriticalPath: { type: Boolean, default: undefined },\r\n showBaseline: { type: Boolean, default: undefined },\r\n showDeadlines: { type: Boolean, default: undefined },\r\n /** Positions the grid and timeline headers. Default is \"top\". */\r\n headerPosition: { type: String as PropType<\"top\" | \"bottom\" | \"none\">, default: undefined },\r\n /** hover tooltip on task bars, defaults to true. A floating, CSS-customizable element (`.gantt-tooltip`) - not the browser's native title tooltip. */\r\n showTooltip: { type: Boolean, default: undefined },\r\n /** fully control tooltip content/markup; return null/undefined to suppress it for a specific task. Defaults to name/dates/progress/assignees/notes. */\r\n renderTooltip: {\r\n type: Function as PropType<(task: GanttTask) => HTMLElement | string | null | undefined>,\r\n default: undefined,\r\n },\r\n /** Overridable UI strings/formatters (aria-labels, default new-task name, tooltip date/progress formatting) for i18n or custom copy. */\r\n labels: { type: Object as PropType<GanttLabels>, default: undefined },\r\n /**\r\n * Customize a task bar's visual content beyond color/label (icons, patterns, custom shapes)\r\n * without forking the renderer - mutate `ctx.group` in place. See `GanttRenderBarContext` in\r\n * gantt-core for the append-only contract that keeps drag/resize hit-testing intact.\r\n */\r\n renderBar: {\r\n type: Function as PropType<(ctx: GanttRenderBarContext) => void>,\r\n default: undefined,\r\n },\r\n showAssigneeAvatars: { type: Boolean, default: undefined },\r\n enableHistory: { type: Boolean, default: undefined },\r\n keyboardAccessible: { type: Boolean, default: undefined },\r\n virtualScroll: { type: Boolean, default: undefined },\r\n autoSchedule: { type: Boolean, default: undefined },\r\n pagination: { type: Object as PropType<{ pageSize: number; page: number }>, default: undefined },\r\n snapToUnit: { type: [String, Boolean] as PropType<\"hour\" | \"day\" | \"week\" | false>, default: undefined },\r\n /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */\r\n calendar: { type: Object as PropType<WorkingCalendar>, default: undefined },\r\n /** arbitrary labeled vertical lines on the timeline, independent of any task */\r\n markers: { type: Array as PropType<GanttMarker[]>, default: undefined },\r\n /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */\r\n autoRollupProgress: { type: Boolean, default: undefined },\r\n /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */\r\n selectable: { type: Boolean, default: undefined },\r\n /**\r\n * Stretch (never shrink) the timeline to fill the container's width instead of leaving empty\r\n * space - the common \"short project at month/year zoom\" or \"just a few tasks\" case. Off by\r\n * default (a new chart's pixel layout shouldn't change for existing consumers who don't opt in).\r\n */\r\n autoFitToViewport: { type: Boolean, default: undefined },\r\n} as const;\r\n\r\nexport type GanttChartProps = ExtractPropTypes<typeof ganttChartProps>;\r\n\r\nconst ganttChartEmits = {\r\n \"date-change\": (_task: GanttTask, _start: Date, _end: Date) => true,\r\n \"progress-change\": (_task: GanttTask, _progress: number) => true,\r\n \"dependency-create\": (_dep: GanttDependency) => true,\r\n \"dependency-remove\": (_dep: GanttDependency) => true,\r\n \"dependency-dblclick\": (_dep: GanttDependency) => true,\r\n \"task-click\": (_task: GanttTask) => true,\r\n \"task-dblclick\": (_task: GanttTask) => true,\r\n \"group-toggle\": (_task: GanttTask, _collapsed: boolean) => true,\r\n \"context-menu\": (_task: GanttTask, _evt: PointerEvent) => true,\r\n \"task-create\": (_task: GanttTask) => true,\r\n \"column-resize\": (_columnId: string, _width: number) => true,\r\n \"column-reorder\": (_order: string[]) => true,\r\n \"task-reorder\": (\r\n _draggedTaskId: string,\r\n _targetTaskId: string,\r\n _position: \"before\" | \"after\" | \"inside\"\r\n ) => true,\r\n \"selection-change\": (_taskIds: string[]) => true,\r\n \"sort-change\": (_sort: { columnId: string; direction: \"asc\" | \"desc\" } | null) => true,\r\n};\r\n\r\nexport const GanttChart = defineComponent({\r\n name: \"GanttChart\",\r\n props: ganttChartProps,\r\n emits: ganttChartEmits,\r\n setup(props, { emit, expose }) {\r\n const containerRef = ref<HTMLElement | null>(null);\r\n const noop = () => {};\r\n\r\n // See hasInitialListener's doc comment: these six only affect whether gantt-core wires\r\n // up the relevant DOM interaction at construction, and are captured once, up front.\r\n // onContextMenu is deliberately always wired (unlike the other six) so right-click\r\n // handling works out of the box even for consumers who haven't attached a listener.\r\n const wireTaskCreate = hasInitialListener(\"onTaskCreate\");\r\n const wireColumnResize = hasInitialListener(\"onColumnResize\");\r\n const wireColumnReorder = hasInitialListener(\"onColumnReorder\");\r\n const wireTaskReorder = hasInitialListener(\"onTaskReorder\");\r\n const wireDependencyDblClick = hasInitialListener(\"onDependencyDblClick\");\r\n const wireTaskDblClick = hasInitialListener(\"onTaskDblClick\");\r\n\r\n // gantt-core invokes every one of these seven callbacks from a call site that ALSO\r\n // unconditionally emits the matching public event (\"date-change\", \"selection-change\", ...).\r\n // So none of them belong in `options` below — doing that would fire the Vue listener\r\n // twice per event, once here and once through the chart.on(...) subscription further down.\r\n // options only ever needs: (a) the six gate-a-DOM-feature callbacks, as stable no-ops/undefined\r\n // purely to control wiring, and (b) everything else, which is plain reactive config.\r\n const getOptions = (): GanttOptions => ({\r\n viewMode: props.viewMode,\r\n columns: props.columns,\r\n theme: props.theme,\r\n colorScheme: props.colorScheme,\r\n columnWidth: props.columnWidth,\r\n readonly: props.readonly,\r\n showProgress: props.showProgress,\r\n showDependencies: props.showDependencies,\r\n gridPanelWidth: props.gridPanelWidth,\r\n showCriticalPath: props.showCriticalPath,\r\n showBaseline: props.showBaseline,\r\n showDeadlines: props.showDeadlines,\r\n headerPosition: props.headerPosition,\r\n showTooltip: props.showTooltip,\r\n renderTooltip: props.renderTooltip,\r\n labels: props.labels,\r\n renderBar: props.renderBar,\r\n showAssigneeAvatars: props.showAssigneeAvatars,\r\n enableHistory: props.enableHistory,\r\n keyboardAccessible: props.keyboardAccessible,\r\n virtualScroll: props.virtualScroll,\r\n autoSchedule: props.autoSchedule,\r\n pagination: props.pagination,\r\n snapToUnit: props.snapToUnit,\r\n calendar: props.calendar,\r\n markers: props.markers,\r\n autoRollupProgress: props.autoRollupProgress,\r\n selectable: props.selectable,\r\n autoFitToViewport: props.autoFitToViewport,\r\n onContextMenu: noop,\r\n onTaskCreate: wireTaskCreate ? noop : undefined,\r\n onColumnResize: wireColumnResize ? noop : undefined,\r\n onColumnReorder: wireColumnReorder ? noop : undefined,\r\n onTaskReorder: wireTaskReorder ? noop : undefined,\r\n onDependencyDblClick: wireDependencyDblClick ? noop : undefined,\r\n onTaskDblClick: wireTaskDblClick ? noop : undefined,\r\n });\r\n\r\n const { chart } = useGanttChart(\r\n containerRef,\r\n () => props.tasks,\r\n () => props.dependencies,\r\n getOptions\r\n );\r\n\r\n // useGanttChart already watches getOptions and calls setOptions on change -\r\n // no need to duplicate that here.\r\n\r\n // All real event dispatch goes through the chart's public emitter — set up once when the\r\n // instance appears. `emit` is stable for the component's lifetime, so (unlike the React\r\n // wrapper's ref-of-latest-callback dance) there's no need to guard against re-subscribing.\r\n watch(chart, (instance, _prev, onCleanup) => {\r\n if (!instance) return;\r\n instance.on(\"date-change\", handleDateChange);\r\n instance.on(\"progress-change\", handleProgressChange);\r\n instance.on(\"dependency-create\", handleDependencyCreate);\r\n instance.on(\"dependency-remove\", handleDependencyRemove);\r\n instance.on(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.on(\"task-click\", handleTaskClick);\r\n instance.on(\"task-dblclick\", handleTaskDblClick);\r\n instance.on(\"group-toggle\", handleGroupToggle);\r\n instance.on(\"context-menu\", handleContextMenu);\r\n instance.on(\"task-create\", handleTaskCreate);\r\n instance.on(\"column-resize\", handleColumnResize);\r\n instance.on(\"column-reorder\", handleColumnReorder);\r\n instance.on(\"task-reorder\", handleTaskReorder);\r\n instance.on(\"selection-change\", handleSelectionChange);\r\n instance.on(\"sort-change\", handleSortChange);\r\n onCleanup(() => {\r\n instance.off(\"date-change\", handleDateChange);\r\n instance.off(\"progress-change\", handleProgressChange);\r\n instance.off(\"dependency-create\", handleDependencyCreate);\r\n instance.off(\"dependency-remove\", handleDependencyRemove);\r\n instance.off(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.off(\"task-click\", handleTaskClick);\r\n instance.off(\"task-dblclick\", handleTaskDblClick);\r\n instance.off(\"group-toggle\", handleGroupToggle);\r\n instance.off(\"context-menu\", handleContextMenu);\r\n instance.off(\"task-create\", handleTaskCreate);\r\n instance.off(\"column-resize\", handleColumnResize);\r\n instance.off(\"column-reorder\", handleColumnReorder);\r\n instance.off(\"task-reorder\", handleTaskReorder);\r\n instance.off(\"selection-change\", handleSelectionChange);\r\n instance.off(\"sort-change\", handleSortChange);\r\n });\r\n }, { flush: \"sync\" }); // synchronous: chart.value is set inside useGanttChart's onMounted,\r\n // and listeners must be attached before that same tick's synchronous code (e.g. a ref call\r\n // right after mount) can trigger an event — Vue's default 'pre' flush would run this a tick late.\r\n\r\n function handleDateChange(p: { task: GanttTask; start: Date; end: Date }) {\r\n emit(\"date-change\", p.task, p.start, p.end);\r\n }\r\n function handleProgressChange(p: { task: GanttTask; progress: number }) {\r\n emit(\"progress-change\", p.task, p.progress);\r\n }\r\n function handleDependencyCreate(dep: GanttDependency) {\r\n emit(\"dependency-create\", dep);\r\n }\r\n function handleDependencyRemove(dep: GanttDependency) {\r\n emit(\"dependency-remove\", dep);\r\n }\r\n function handleDependencyDblClick(dep: GanttDependency) {\r\n emit(\"dependency-dblclick\", dep);\r\n }\r\n function handleTaskClick(p: { task: GanttTask }) {\r\n emit(\"task-click\", p.task);\r\n }\r\n function handleTaskDblClick(p: { task: GanttTask }) {\r\n emit(\"task-dblclick\", p.task);\r\n }\r\n function handleGroupToggle(p: { task: GanttTask; collapsed: boolean }) {\r\n emit(\"group-toggle\", p.task, p.collapsed);\r\n }\r\n function handleContextMenu(p: { task: GanttTask; evt: PointerEvent }) {\r\n emit(\"context-menu\", p.task, p.evt);\r\n }\r\n function handleTaskCreate(p: { task: GanttTask }) {\r\n emit(\"task-create\", p.task);\r\n }\r\n function handleColumnResize(p: { columnId: string; width: number }) {\r\n emit(\"column-resize\", p.columnId, p.width);\r\n }\r\n function handleColumnReorder(p: { order: string[] }) {\r\n emit(\"column-reorder\", p.order);\r\n }\r\n function handleTaskReorder(p: {\r\n draggedTaskId: string;\r\n targetTaskId: string;\r\n position: \"before\" | \"after\" | \"inside\";\r\n }) {\r\n emit(\"task-reorder\", p.draggedTaskId, p.targetTaskId, p.position);\r\n }\r\n function handleSelectionChange(p: { taskIds: string[] }) {\r\n emit(\"selection-change\", p.taskIds);\r\n }\r\n function handleSortChange(p: { sort: { columnId: string; direction: \"asc\" | \"desc\" } | null }) {\r\n emit(\"sort-change\", p.sort);\r\n }\r\n\r\n onBeforeUnmount(() => {\r\n containerRef.value = null;\r\n });\r\n\r\n const handle: GanttChartHandle = {\r\n undo: () => chart.value?.undo(),\r\n redo: () => chart.value?.redo(),\r\n canUndo: () => chart.value?.canUndo ?? false,\r\n canRedo: () => chart.value?.canRedo ?? false,\r\n expandAll: () => chart.value?.expandAll(),\r\n collapseAll: () => chart.value?.collapseAll(),\r\n toggleGroup: (taskId) => chart.value?.toggleGroup(taskId),\r\n removeDependency: (fromId, toId) => chart.value?.removeDependency(fromId, toId),\r\n updateDependency: (fromId, toId, partial) => chart.value?.updateDependency(fromId, toId, partial),\r\n updateTask: (id, partial) => chart.value?.updateTask(id, partial),\r\n getTask: (id) => chart.value?.getTask(id),\r\n addTask: (task, options) => chart.value?.addTask(task, options),\r\n deleteTask: (id) => chart.value?.deleteTask(id),\r\n addDependency: (dep) => chart.value?.addDependency(dep) ?? false,\r\n getDependencies: () => chart.value?.getDependencies() ?? [],\r\n getDateAtX: (xPx) => chart.value?.getDateAtX(xPx) ?? new Date(0),\r\n getXForDate: (date) => chart.value?.getXForDate(date) ?? 0,\r\n setViewMode: (mode) => chart.value?.setViewMode(mode),\r\n fitToViewport: (containerWidthPx) => chart.value?.fitToViewport(containerWidthPx),\r\n scrollToToday: () => chart.value?.scrollToToday(),\r\n scrollToRangeStart: () => chart.value?.scrollToRangeStart(),\r\n scrollToRangeEnd: () => chart.value?.scrollToRangeEnd(),\r\n getPageCount: () => chart.value?.getPageCount() ?? 1,\r\n setPage: (page) => chart.value?.setPage(page),\r\n zoomIn: (factor) => chart.value?.zoomIn(factor),\r\n zoomOut: (factor) => chart.value?.zoomOut(factor),\r\n getZoomLevel: () => chart.value?.getZoomLevel() ?? 0,\r\n getResourceHistogram: (options) => chart.value?.getResourceHistogram(options) ?? [],\r\n getLeveledTasks: (options) => chart.value?.getLeveledTasks(options) ?? { tasks: [], shifted: [] },\r\n selectTask: (id, options) => chart.value?.selectTask(id, options),\r\n selectAllVisible: () => chart.value?.selectAllVisible(),\r\n clearSelection: () => chart.value?.clearSelection(),\r\n getSelectedTaskIds: () => chart.value?.getSelectedTaskIds() ?? [],\r\n setSort: (columnId, direction) => chart.value?.setSort(columnId, direction),\r\n getSort: () => chart.value?.getSort() ?? null,\r\n bulkShiftDates: (deltaMs) => chart.value?.bulkShiftDates(deltaMs),\r\n bulkDelete: () => chart.value?.bulkDelete(),\r\n toSVGString: () => chart.value?.toSVGString() ?? \"\",\r\n toPNGDataURL: () => chart.value?.toPNGDataURL() ?? Promise.resolve(\"\"),\r\n toPNGDataURLs: (options) => chart.value?.toPNGDataURLs(options) ?? Promise.resolve([]),\r\n getRenderModel: () => chart.value?.getRenderModel() ?? EMPTY_RENDER_MODEL,\r\n getInstance: () => chart.value,\r\n };\r\n expose(handle);\r\n\r\n // A single root element: class/style attrs fall through onto it automatically.\r\n return () => h(\"div\", { ref: containerRef });\r\n },\r\n});\r\n\r\nexport default GanttChart;\r\n","import { onBeforeUnmount, onMounted, shallowRef, watch, type Ref, type ShallowRef } from \"vue\";\r\nimport { GanttChart as GanttCore, injectStyles } from \"@ganttloom/gantt-core\";\r\nimport type { GanttDependency, GanttOptions, GanttTask } from \"@ganttloom/gantt-core\";\r\n\r\nexport interface UseGanttChartResult {\r\n /** The underlying framework-agnostic GanttChart instance, or null before the mount effect runs. */\r\n chart: ShallowRef<GanttCore | null>;\r\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\r\n canUndo: Ref<boolean>;\r\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\r\n canRedo: Ref<boolean>;\r\n}\r\n\r\n/**\r\n * Lower-level escape hatch for consumers who want to own their own container element\r\n * and DOM tree instead of using the <GanttChart /> component. Constructs a\r\n * @ganttloom/gantt-core GanttChart instance against `containerRef.value` on mount,\r\n * keeps it in sync with the tasks/dependencies/options getters via setTasks / setDependencies /\r\n * setOptions (reference-equality checks only — return a new array/object to trigger a sync),\r\n * and destroys it on unmount.\r\n *\r\n * `getTasks`/`getDependencies`/`getOptions` are plain functions (not refs) so this composable\r\n * can track whatever reactive source each one reads — a prop, a ref, a computed — without\r\n * imposing a shape on the caller.\r\n */\r\nexport function useGanttChart(\r\n containerRef: Ref<HTMLElement | null>,\r\n getTasks: () => GanttTask[],\r\n getDependencies: () => GanttDependency[],\r\n getOptions: () => GanttOptions\r\n): UseGanttChartResult {\r\n const chart = shallowRef<GanttCore | null>(null);\r\n const canUndo = shallowRef(false);\r\n const canRedo = shallowRef(false);\r\n\r\n let onHistoryChange: ((state: { canUndo: boolean; canRedo: boolean }) => void) | undefined;\r\n\r\n onMounted(() => {\r\n const container = containerRef.value;\r\n if (!container) return;\r\n\r\n // Default styles are injected at runtime rather than via a CSS import, so the\r\n // package also loads in plain Node / SSR / Jest where \".css\" can't be required.\r\n injectStyles(container.ownerDocument);\r\n const instance = new GanttCore(container, getTasks(), getDependencies(), getOptions());\r\n chart.value = instance;\r\n canUndo.value = instance.canUndo;\r\n canRedo.value = instance.canRedo;\r\n\r\n onHistoryChange = (state) => {\r\n canUndo.value = state.canUndo;\r\n canRedo.value = state.canRedo;\r\n };\r\n instance.on(\"history-change\", onHistoryChange);\r\n });\r\n\r\n onBeforeUnmount(() => {\r\n const instance = chart.value;\r\n if (!instance) return;\r\n if (onHistoryChange) instance.off(\"history-change\", onHistoryChange);\r\n instance.destroy();\r\n chart.value = null;\r\n canUndo.value = false;\r\n canRedo.value = false;\r\n });\r\n\r\n // Non-immediate: the initial values were already passed to the constructor above,\r\n // so these only need to fire on subsequent changes.\r\n watch(getTasks, (tasks) => chart.value?.setTasks(tasks));\r\n watch(getDependencies, (deps) => chart.value?.setDependencies(deps));\r\n watch(getOptions, (options) => chart.value?.setOptions(options));\r\n\r\n return { chart, canUndo, canRedo };\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,cASO;;;ACTP,iBAAyF;AACzF,wBAAsD;AAwB/C,SAAS,cACd,cACA,UACA,iBACA,YACqB;AACrB,QAAM,YAAQ,uBAA6B,IAAI;AAC/C,QAAM,cAAU,uBAAW,KAAK;AAChC,QAAM,cAAU,uBAAW,KAAK;AAEhC,MAAI;AAEJ,4BAAU,MAAM;AACd,UAAM,YAAY,aAAa;AAC/B,QAAI,CAAC,UAAW;AAIhB,wCAAa,UA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,WAAO,MAAM;AAGb,WAAO,UAAM,eAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AAAA,EAC7C;AACF,CAAC;AAED,IAAO,qBAAQ;;;AD/Zf,IAAAC,qBAmBO;","names":["import_vue","GanttCore","import_gantt_core"]}
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // src/GanttChart.ts
2
- import "@ganttloom/gantt-core/styles.css";
3
2
  import {
4
3
  defineComponent,
5
4
  getCurrentInstance,
@@ -11,7 +10,7 @@ import {
11
10
 
12
11
  // src/useGanttChart.ts
13
12
  import { onBeforeUnmount, onMounted, shallowRef, watch } from "vue";
14
- import { GanttChart as GanttCore } from "@ganttloom/gantt-core";
13
+ import { GanttChart as GanttCore, injectStyles } from "@ganttloom/gantt-core";
15
14
  function useGanttChart(containerRef, getTasks, getDependencies, getOptions) {
16
15
  const chart = shallowRef(null);
17
16
  const canUndo = shallowRef(false);
@@ -20,6 +19,7 @@ function useGanttChart(containerRef, getTasks, getDependencies, getOptions) {
20
19
  onMounted(() => {
21
20
  const container = containerRef.value;
22
21
  if (!container) return;
22
+ injectStyles(container.ownerDocument);
23
23
  const instance = new GanttCore(container, getTasks(), getDependencies(), getOptions());
24
24
  chart.value = instance;
25
25
  canUndo.value = instance.canUndo;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/GanttChart.ts","../src/useGanttChart.ts","../src/index.ts"],"sourcesContent":["// Pulls in the core's default styles so consumers get a working chart out of the box.\r\n// This resolves through gantt-core's package.json \"exports\" map (\"./styles.css\" -> \"./dist/styles.css\").\r\n// If your bundler can't resolve CSS imports from a dependency's export map, import it yourself instead:\r\n// import \"@ganttloom/gantt-core/styles.css\";\r\nimport \"@ganttloom/gantt-core/styles.css\";\r\n\r\nimport {\r\n defineComponent,\r\n getCurrentInstance,\r\n h,\r\n onBeforeUnmount,\r\n ref,\r\n watch,\r\n type ExtractPropTypes,\r\n type PropType,\r\n} from \"vue\";\r\nimport type {\r\n GanttChart as GanttCore,\r\n GanttColumn,\r\n GanttDependency,\r\n GanttLabels,\r\n GanttMarker,\r\n GanttOptions,\r\n GanttRenderBarContext,\r\n GanttRenderModel,\r\n GanttTask,\r\n GanttTheme,\r\n ResourceHistogramOptions,\r\n ResourceLoadBucket,\r\n ResourceLevelingOptions,\r\n ResourceLevelingResult,\r\n ViewMode,\r\n WorkingCalendar,\r\n} from \"@ganttloom/gantt-core\";\r\nimport { useGanttChart } from \"./useGanttChart\";\r\n\r\n/** Imperative escape hatches, available via a template ref (see the package README). */\r\nexport interface GanttChartHandle {\r\n /** Reverts the most recent move/resize/link/progress/create action. No-op unless `enable-history` is set. */\r\n undo(): void;\r\n /** Re-applies the most recently undone action. No-op unless `enable-history` is set. */\r\n redo(): void;\r\n /** Whether `undo()` currently has anything to revert. */\r\n canUndo(): boolean;\r\n /** Whether `redo()` currently has anything to re-apply. */\r\n canRedo(): boolean;\r\n /** Expands every collapsed group row. */\r\n expandAll(): void;\r\n /** Collapses every group row that has children. */\r\n collapseAll(): void;\r\n /** Toggles a single group row's collapsed state. */\r\n toggleGroup(taskId: string): void;\r\n /** Removes a dependency link between two tasks, if it exists. */\r\n removeDependency(fromId: string, toId: string): void;\r\n /** Patches an existing dependency link's fields (e.g. its `type` or `lagMs`). */\r\n updateDependency(fromId: string, toId: string, partial: Partial<GanttDependency>): void;\r\n /** Patches a task's fields in place (e.g. dates, progress, name) and re-renders. */\r\n updateTask(id: string, partial: Partial<GanttTask>): void;\r\n /** Look up a task by id. Returns a cloned copy, or undefined if not found. */\r\n getTask(id: string): GanttTask | undefined;\r\n /** Add a new task to the chart. Undoable with enable-history. */\r\n addTask(task: GanttTask, options?: { parentId?: string; index?: number }): void;\r\n /** Delete a single task and any dependencies touching it. Undoable with enable-history. */\r\n deleteTask(id: string): void;\r\n /** Add a dependency link. Returns false if invalid (e.g. self-loop, duplicate, or cycle), true if added. Undoable with enable-history. */\r\n addDependency(dep: GanttDependency): boolean;\r\n /** Snapshot of current dependencies, as cloned copies. */\r\n getDependencies(): GanttDependency[];\r\n /** Convert a pixel offset in timeline space back to a real Date based on current rangeStart and zoom level. */\r\n getDateAtX(xPx: number): Date;\r\n /** Convert a Date to a pixel coordinate in timeline space. */\r\n getXForDate(date: Date): number;\r\n /** Switches the timeline's zoom level (hour/day/week/month/quarter/year). */\r\n setViewMode(mode: ViewMode): void;\r\n /** Grows `column-width` (never shrinks) so the timeline exactly fills the given container width. */\r\n fitToViewport(containerWidthPx: number): void;\r\n /** Scrolls the timeline so today's date is centered in the viewport. */\r\n scrollToToday(): void;\r\n /** Scrolls the timeline to the very start of the task date range. */\r\n scrollToRangeStart(): void;\r\n /** Scrolls the timeline to the very end of the task date range. */\r\n scrollToRangeEnd(): void;\r\n /** Total number of pages, when `pagination` is set (always `1` otherwise). */\r\n getPageCount(): number;\r\n /** Jumps to a 1-indexed page of top-level rows, when `pagination` is set. */\r\n setPage(page: number): void;\r\n /** Multiplies `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomIn(factor?: number): void;\r\n /** Divides `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomOut(factor?: number): void;\r\n /** Current `column-width` in px per smallest time unit. */\r\n getZoomLevel(): number;\r\n /** Per-assignee workload buckets, for spotting over-allocation. */\r\n getResourceHistogram(options?: ResourceHistogramOptions): ResourceLoadBucket[];\r\n /** Computes a conflict-free schedule by delaying double-booked assignees' tasks; does not mutate the chart's own tasks. */\r\n getLeveledTasks(options?: ResourceLevelingOptions): ResourceLevelingResult;\r\n /** Selects one task bar; pass `{ additive: true }` to add to the existing selection instead of replacing it. Requires `selectable`. */\r\n selectTask(id: string, options?: { additive?: boolean }): void;\r\n /** Selects every currently-visible task bar. Requires `selectable`. */\r\n selectAllVisible(): void;\r\n /** Clears the current bar selection. */\r\n clearSelection(): void;\r\n /** IDs of the currently-selected task bars. */\r\n getSelectedTaskIds(): string[];\r\n /** Sorts sibling rows at every tree level by a column's value; `direction` omitted/`null` clears sorting. */\r\n setSort(columnId: string | null, direction?: \"asc\" | \"desc\" | null): void;\r\n /** The current sort state, or `null` if unsorted. */\r\n getSort(): { columnId: string; direction: \"asc\" | \"desc\" } | null;\r\n /** Shifts every selected task's start/end by `deltaMs`. Requires `selectable`. */\r\n bulkShiftDates(deltaMs: number): void;\r\n /** Deletes every currently-selected task. Requires `selectable`. */\r\n bulkDelete(): void;\r\n /** Serializes the current chart to a standalone SVG string. */\r\n toSVGString(): string;\r\n /** Renders the current chart to a single PNG data URL. */\r\n toPNGDataURL(): Promise<string>;\r\n /** Renders the current chart to one PNG data URL per page, tiled to the given page pixel size. */\r\n toPNGDataURLs(options?: { pageWidthPx?: number; pageHeightPx?: number }): Promise<string[]>;\r\n /** The current computed render model (rows/bars/links/ticks), or `null` before first render. */\r\n getRenderModel(): GanttRenderModel | null;\r\n /** Direct access to the underlying framework-agnostic core instance (null before mount). */\r\n getInstance(): GanttCore | null;\r\n}\r\n\r\nconst EMPTY_RENDER_MODEL: GanttRenderModel = {\r\n width: 0,\r\n height: 0,\r\n rowHeight: 0,\r\n headerHeight: 0,\r\n rows: [],\r\n bars: [],\r\n links: [],\r\n ticks: [],\r\n columns: [],\r\n theme: {} as GanttTheme,\r\n markers: [],\r\n rangeStart: new Date(0),\r\n sort: null,\r\n};\r\n\r\n/**\r\n * Checks whether the parent actually bound a listener for `eventName` (e.g. \"onTaskCreate\")\r\n * on this component's *initial* vnode. A handful of gantt-core options only wire up their\r\n * DOM interaction (drag-to-create, column resize/reorder, dependency double-click, context\r\n * menu) when the corresponding callback is truthy AT CONSTRUCTION TIME — so a stable no-op\r\n * is passed there to force the wiring on, and the real dispatch goes through the reactive\r\n * \"task-create\" etc. event subscription below instead. Reading `vnode.props` (rather than a\r\n * declared prop/emit) is what lets this stay accurate for both `@task-create=\"...\"` template\r\n * listeners and a plain `onTaskCreate` prop, without needing the caller to pass anything else.\r\n */\r\nfunction hasInitialListener(eventName: string): boolean {\r\n const instance = getCurrentInstance();\r\n return !!(instance?.vnode.props && eventName in instance.vnode.props);\r\n}\r\n\r\nconst ganttChartProps = {\r\n tasks: { type: Array as PropType<GanttTask[]>, required: true },\r\n dependencies: { type: Array as PropType<GanttDependency[]>, default: () => [] },\r\n viewMode: { type: String as PropType<ViewMode>, default: undefined },\r\n columns: { type: Array as PropType<GanttColumn[]>, default: undefined },\r\n theme: { type: Object as PropType<Partial<GanttTheme>>, default: undefined },\r\n colorScheme: { type: String as PropType<\"light\" | \"dark\" | \"auto\">, default: undefined },\r\n columnWidth: { type: Number, default: undefined },\r\n readonly: { type: Boolean, default: undefined },\r\n showProgress: { type: Boolean, default: undefined },\r\n showDependencies: { type: Boolean, default: undefined },\r\n gridPanelWidth: { type: Number, default: undefined },\r\n showCriticalPath: { type: Boolean, default: undefined },\r\n showBaseline: { type: Boolean, default: undefined },\r\n showDeadlines: { type: Boolean, default: undefined },\r\n /** Positions the grid and timeline headers. Default is \"top\". */\r\n headerPosition: { type: String as PropType<\"top\" | \"bottom\" | \"none\">, default: undefined },\r\n /** hover tooltip on task bars, defaults to true. A floating, CSS-customizable element (`.gantt-tooltip`) - not the browser's native title tooltip. */\r\n showTooltip: { type: Boolean, default: undefined },\r\n /** fully control tooltip content/markup; return null/undefined to suppress it for a specific task. Defaults to name/dates/progress/assignees/notes. */\r\n renderTooltip: {\r\n type: Function as PropType<(task: GanttTask) => HTMLElement | string | null | undefined>,\r\n default: undefined,\r\n },\r\n /** Overridable UI strings/formatters (aria-labels, default new-task name, tooltip date/progress formatting) for i18n or custom copy. */\r\n labels: { type: Object as PropType<GanttLabels>, default: undefined },\r\n /**\r\n * Customize a task bar's visual content beyond color/label (icons, patterns, custom shapes)\r\n * without forking the renderer - mutate `ctx.group` in place. See `GanttRenderBarContext` in\r\n * gantt-core for the append-only contract that keeps drag/resize hit-testing intact.\r\n */\r\n renderBar: {\r\n type: Function as PropType<(ctx: GanttRenderBarContext) => void>,\r\n default: undefined,\r\n },\r\n showAssigneeAvatars: { type: Boolean, default: undefined },\r\n enableHistory: { type: Boolean, default: undefined },\r\n keyboardAccessible: { type: Boolean, default: undefined },\r\n virtualScroll: { type: Boolean, default: undefined },\r\n autoSchedule: { type: Boolean, default: undefined },\r\n pagination: { type: Object as PropType<{ pageSize: number; page: number }>, default: undefined },\r\n snapToUnit: { type: [String, Boolean] as PropType<\"hour\" | \"day\" | \"week\" | false>, default: undefined },\r\n /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */\r\n calendar: { type: Object as PropType<WorkingCalendar>, default: undefined },\r\n /** arbitrary labeled vertical lines on the timeline, independent of any task */\r\n markers: { type: Array as PropType<GanttMarker[]>, default: undefined },\r\n /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */\r\n autoRollupProgress: { type: Boolean, default: undefined },\r\n /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */\r\n selectable: { type: Boolean, default: undefined },\r\n /**\r\n * Stretch (never shrink) the timeline to fill the container's width instead of leaving empty\r\n * space - the common \"short project at month/year zoom\" or \"just a few tasks\" case. Off by\r\n * default (a new chart's pixel layout shouldn't change for existing consumers who don't opt in).\r\n */\r\n autoFitToViewport: { type: Boolean, default: undefined },\r\n} as const;\r\n\r\nexport type GanttChartProps = ExtractPropTypes<typeof ganttChartProps>;\r\n\r\nconst ganttChartEmits = {\r\n \"date-change\": (_task: GanttTask, _start: Date, _end: Date) => true,\r\n \"progress-change\": (_task: GanttTask, _progress: number) => true,\r\n \"dependency-create\": (_dep: GanttDependency) => true,\r\n \"dependency-remove\": (_dep: GanttDependency) => true,\r\n \"dependency-dblclick\": (_dep: GanttDependency) => true,\r\n \"task-click\": (_task: GanttTask) => true,\r\n \"task-dblclick\": (_task: GanttTask) => true,\r\n \"group-toggle\": (_task: GanttTask, _collapsed: boolean) => true,\r\n \"context-menu\": (_task: GanttTask, _evt: PointerEvent) => true,\r\n \"task-create\": (_task: GanttTask) => true,\r\n \"column-resize\": (_columnId: string, _width: number) => true,\r\n \"column-reorder\": (_order: string[]) => true,\r\n \"task-reorder\": (\r\n _draggedTaskId: string,\r\n _targetTaskId: string,\r\n _position: \"before\" | \"after\" | \"inside\"\r\n ) => true,\r\n \"selection-change\": (_taskIds: string[]) => true,\r\n \"sort-change\": (_sort: { columnId: string; direction: \"asc\" | \"desc\" } | null) => true,\r\n};\r\n\r\nexport const GanttChart = defineComponent({\r\n name: \"GanttChart\",\r\n props: ganttChartProps,\r\n emits: ganttChartEmits,\r\n setup(props, { emit, expose }) {\r\n const containerRef = ref<HTMLElement | null>(null);\r\n const noop = () => {};\r\n\r\n // See hasInitialListener's doc comment: these six only affect whether gantt-core wires\r\n // up the relevant DOM interaction at construction, and are captured once, up front.\r\n // onContextMenu is deliberately always wired (unlike the other six) so right-click\r\n // handling works out of the box even for consumers who haven't attached a listener.\r\n const wireTaskCreate = hasInitialListener(\"onTaskCreate\");\r\n const wireColumnResize = hasInitialListener(\"onColumnResize\");\r\n const wireColumnReorder = hasInitialListener(\"onColumnReorder\");\r\n const wireTaskReorder = hasInitialListener(\"onTaskReorder\");\r\n const wireDependencyDblClick = hasInitialListener(\"onDependencyDblClick\");\r\n const wireTaskDblClick = hasInitialListener(\"onTaskDblClick\");\r\n\r\n // gantt-core invokes every one of these seven callbacks from a call site that ALSO\r\n // unconditionally emits the matching public event (\"date-change\", \"selection-change\", ...).\r\n // So none of them belong in `options` below — doing that would fire the Vue listener\r\n // twice per event, once here and once through the chart.on(...) subscription further down.\r\n // options only ever needs: (a) the six gate-a-DOM-feature callbacks, as stable no-ops/undefined\r\n // purely to control wiring, and (b) everything else, which is plain reactive config.\r\n const getOptions = (): GanttOptions => ({\r\n viewMode: props.viewMode,\r\n columns: props.columns,\r\n theme: props.theme,\r\n colorScheme: props.colorScheme,\r\n columnWidth: props.columnWidth,\r\n readonly: props.readonly,\r\n showProgress: props.showProgress,\r\n showDependencies: props.showDependencies,\r\n gridPanelWidth: props.gridPanelWidth,\r\n showCriticalPath: props.showCriticalPath,\r\n showBaseline: props.showBaseline,\r\n showDeadlines: props.showDeadlines,\r\n headerPosition: props.headerPosition,\r\n showTooltip: props.showTooltip,\r\n renderTooltip: props.renderTooltip,\r\n labels: props.labels,\r\n renderBar: props.renderBar,\r\n showAssigneeAvatars: props.showAssigneeAvatars,\r\n enableHistory: props.enableHistory,\r\n keyboardAccessible: props.keyboardAccessible,\r\n virtualScroll: props.virtualScroll,\r\n autoSchedule: props.autoSchedule,\r\n pagination: props.pagination,\r\n snapToUnit: props.snapToUnit,\r\n calendar: props.calendar,\r\n markers: props.markers,\r\n autoRollupProgress: props.autoRollupProgress,\r\n selectable: props.selectable,\r\n autoFitToViewport: props.autoFitToViewport,\r\n onContextMenu: noop,\r\n onTaskCreate: wireTaskCreate ? noop : undefined,\r\n onColumnResize: wireColumnResize ? noop : undefined,\r\n onColumnReorder: wireColumnReorder ? noop : undefined,\r\n onTaskReorder: wireTaskReorder ? noop : undefined,\r\n onDependencyDblClick: wireDependencyDblClick ? noop : undefined,\r\n onTaskDblClick: wireTaskDblClick ? noop : undefined,\r\n });\r\n\r\n const { chart } = useGanttChart(\r\n containerRef,\r\n () => props.tasks,\r\n () => props.dependencies,\r\n getOptions\r\n );\r\n\r\n // useGanttChart already watches getOptions and calls setOptions on change -\r\n // no need to duplicate that here.\r\n\r\n // All real event dispatch goes through the chart's public emitter — set up once when the\r\n // instance appears. `emit` is stable for the component's lifetime, so (unlike the React\r\n // wrapper's ref-of-latest-callback dance) there's no need to guard against re-subscribing.\r\n watch(chart, (instance, _prev, onCleanup) => {\r\n if (!instance) return;\r\n instance.on(\"date-change\", handleDateChange);\r\n instance.on(\"progress-change\", handleProgressChange);\r\n instance.on(\"dependency-create\", handleDependencyCreate);\r\n instance.on(\"dependency-remove\", handleDependencyRemove);\r\n instance.on(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.on(\"task-click\", handleTaskClick);\r\n instance.on(\"task-dblclick\", handleTaskDblClick);\r\n instance.on(\"group-toggle\", handleGroupToggle);\r\n instance.on(\"context-menu\", handleContextMenu);\r\n instance.on(\"task-create\", handleTaskCreate);\r\n instance.on(\"column-resize\", handleColumnResize);\r\n instance.on(\"column-reorder\", handleColumnReorder);\r\n instance.on(\"task-reorder\", handleTaskReorder);\r\n instance.on(\"selection-change\", handleSelectionChange);\r\n instance.on(\"sort-change\", handleSortChange);\r\n onCleanup(() => {\r\n instance.off(\"date-change\", handleDateChange);\r\n instance.off(\"progress-change\", handleProgressChange);\r\n instance.off(\"dependency-create\", handleDependencyCreate);\r\n instance.off(\"dependency-remove\", handleDependencyRemove);\r\n instance.off(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.off(\"task-click\", handleTaskClick);\r\n instance.off(\"task-dblclick\", handleTaskDblClick);\r\n instance.off(\"group-toggle\", handleGroupToggle);\r\n instance.off(\"context-menu\", handleContextMenu);\r\n instance.off(\"task-create\", handleTaskCreate);\r\n instance.off(\"column-resize\", handleColumnResize);\r\n instance.off(\"column-reorder\", handleColumnReorder);\r\n instance.off(\"task-reorder\", handleTaskReorder);\r\n instance.off(\"selection-change\", handleSelectionChange);\r\n instance.off(\"sort-change\", handleSortChange);\r\n });\r\n }, { flush: \"sync\" }); // synchronous: chart.value is set inside useGanttChart's onMounted,\r\n // and listeners must be attached before that same tick's synchronous code (e.g. a ref call\r\n // right after mount) can trigger an event — Vue's default 'pre' flush would run this a tick late.\r\n\r\n function handleDateChange(p: { task: GanttTask; start: Date; end: Date }) {\r\n emit(\"date-change\", p.task, p.start, p.end);\r\n }\r\n function handleProgressChange(p: { task: GanttTask; progress: number }) {\r\n emit(\"progress-change\", p.task, p.progress);\r\n }\r\n function handleDependencyCreate(dep: GanttDependency) {\r\n emit(\"dependency-create\", dep);\r\n }\r\n function handleDependencyRemove(dep: GanttDependency) {\r\n emit(\"dependency-remove\", dep);\r\n }\r\n function handleDependencyDblClick(dep: GanttDependency) {\r\n emit(\"dependency-dblclick\", dep);\r\n }\r\n function handleTaskClick(p: { task: GanttTask }) {\r\n emit(\"task-click\", p.task);\r\n }\r\n function handleTaskDblClick(p: { task: GanttTask }) {\r\n emit(\"task-dblclick\", p.task);\r\n }\r\n function handleGroupToggle(p: { task: GanttTask; collapsed: boolean }) {\r\n emit(\"group-toggle\", p.task, p.collapsed);\r\n }\r\n function handleContextMenu(p: { task: GanttTask; evt: PointerEvent }) {\r\n emit(\"context-menu\", p.task, p.evt);\r\n }\r\n function handleTaskCreate(p: { task: GanttTask }) {\r\n emit(\"task-create\", p.task);\r\n }\r\n function handleColumnResize(p: { columnId: string; width: number }) {\r\n emit(\"column-resize\", p.columnId, p.width);\r\n }\r\n function handleColumnReorder(p: { order: string[] }) {\r\n emit(\"column-reorder\", p.order);\r\n }\r\n function handleTaskReorder(p: {\r\n draggedTaskId: string;\r\n targetTaskId: string;\r\n position: \"before\" | \"after\" | \"inside\";\r\n }) {\r\n emit(\"task-reorder\", p.draggedTaskId, p.targetTaskId, p.position);\r\n }\r\n function handleSelectionChange(p: { taskIds: string[] }) {\r\n emit(\"selection-change\", p.taskIds);\r\n }\r\n function handleSortChange(p: { sort: { columnId: string; direction: \"asc\" | \"desc\" } | null }) {\r\n emit(\"sort-change\", p.sort);\r\n }\r\n\r\n onBeforeUnmount(() => {\r\n containerRef.value = null;\r\n });\r\n\r\n const handle: GanttChartHandle = {\r\n undo: () => chart.value?.undo(),\r\n redo: () => chart.value?.redo(),\r\n canUndo: () => chart.value?.canUndo ?? false,\r\n canRedo: () => chart.value?.canRedo ?? false,\r\n expandAll: () => chart.value?.expandAll(),\r\n collapseAll: () => chart.value?.collapseAll(),\r\n toggleGroup: (taskId) => chart.value?.toggleGroup(taskId),\r\n removeDependency: (fromId, toId) => chart.value?.removeDependency(fromId, toId),\r\n updateDependency: (fromId, toId, partial) => chart.value?.updateDependency(fromId, toId, partial),\r\n updateTask: (id, partial) => chart.value?.updateTask(id, partial),\r\n getTask: (id) => chart.value?.getTask(id),\r\n addTask: (task, options) => chart.value?.addTask(task, options),\r\n deleteTask: (id) => chart.value?.deleteTask(id),\r\n addDependency: (dep) => chart.value?.addDependency(dep) ?? false,\r\n getDependencies: () => chart.value?.getDependencies() ?? [],\r\n getDateAtX: (xPx) => chart.value?.getDateAtX(xPx) ?? new Date(0),\r\n getXForDate: (date) => chart.value?.getXForDate(date) ?? 0,\r\n setViewMode: (mode) => chart.value?.setViewMode(mode),\r\n fitToViewport: (containerWidthPx) => chart.value?.fitToViewport(containerWidthPx),\r\n scrollToToday: () => chart.value?.scrollToToday(),\r\n scrollToRangeStart: () => chart.value?.scrollToRangeStart(),\r\n scrollToRangeEnd: () => chart.value?.scrollToRangeEnd(),\r\n getPageCount: () => chart.value?.getPageCount() ?? 1,\r\n setPage: (page) => chart.value?.setPage(page),\r\n zoomIn: (factor) => chart.value?.zoomIn(factor),\r\n zoomOut: (factor) => chart.value?.zoomOut(factor),\r\n getZoomLevel: () => chart.value?.getZoomLevel() ?? 0,\r\n getResourceHistogram: (options) => chart.value?.getResourceHistogram(options) ?? [],\r\n getLeveledTasks: (options) => chart.value?.getLeveledTasks(options) ?? { tasks: [], shifted: [] },\r\n selectTask: (id, options) => chart.value?.selectTask(id, options),\r\n selectAllVisible: () => chart.value?.selectAllVisible(),\r\n clearSelection: () => chart.value?.clearSelection(),\r\n getSelectedTaskIds: () => chart.value?.getSelectedTaskIds() ?? [],\r\n setSort: (columnId, direction) => chart.value?.setSort(columnId, direction),\r\n getSort: () => chart.value?.getSort() ?? null,\r\n bulkShiftDates: (deltaMs) => chart.value?.bulkShiftDates(deltaMs),\r\n bulkDelete: () => chart.value?.bulkDelete(),\r\n toSVGString: () => chart.value?.toSVGString() ?? \"\",\r\n toPNGDataURL: () => chart.value?.toPNGDataURL() ?? Promise.resolve(\"\"),\r\n toPNGDataURLs: (options) => chart.value?.toPNGDataURLs(options) ?? Promise.resolve([]),\r\n getRenderModel: () => chart.value?.getRenderModel() ?? EMPTY_RENDER_MODEL,\r\n getInstance: () => chart.value,\r\n };\r\n expose(handle);\r\n\r\n // A single root element: class/style attrs fall through onto it automatically.\r\n return () => h(\"div\", { ref: containerRef });\r\n },\r\n});\r\n\r\nexport default GanttChart;\r\n","import { onBeforeUnmount, onMounted, shallowRef, watch, type Ref, type ShallowRef } from \"vue\";\nimport { GanttChart as GanttCore } from \"@ganttloom/gantt-core\";\nimport type { GanttDependency, GanttOptions, GanttTask } from \"@ganttloom/gantt-core\";\n\nexport interface UseGanttChartResult {\n /** The underlying framework-agnostic GanttChart instance, or null before the mount effect runs. */\n chart: ShallowRef<GanttCore | null>;\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\n canUndo: Ref<boolean>;\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\n canRedo: Ref<boolean>;\n}\n\n/**\n * Lower-level escape hatch for consumers who want to own their own container element\n * and DOM tree instead of using the <GanttChart /> component. Constructs a\n * @ganttloom/gantt-core GanttChart instance against `containerRef.value` on mount,\n * keeps it in sync with the tasks/dependencies/options getters via setTasks / setDependencies /\n * setOptions (reference-equality checks only — return a new array/object to trigger a sync),\n * and destroys it on unmount.\n *\n * `getTasks`/`getDependencies`/`getOptions` are plain functions (not refs) so this composable\n * can track whatever reactive source each one reads — a prop, a ref, a computed — without\n * imposing a shape on the caller.\n */\nexport function useGanttChart(\n containerRef: Ref<HTMLElement | null>,\n getTasks: () => GanttTask[],\n getDependencies: () => GanttDependency[],\n getOptions: () => GanttOptions\n): UseGanttChartResult {\n const chart = shallowRef<GanttCore | null>(null);\n const canUndo = shallowRef(false);\n const canRedo = shallowRef(false);\n\n let onHistoryChange: ((state: { canUndo: boolean; canRedo: boolean }) => void) | undefined;\n\n onMounted(() => {\n const container = containerRef.value;\n if (!container) return;\n\n const instance = new GanttCore(container, getTasks(), getDependencies(), getOptions());\n chart.value = instance;\n canUndo.value = instance.canUndo;\n canRedo.value = instance.canRedo;\n\n onHistoryChange = (state) => {\n canUndo.value = state.canUndo;\n canRedo.value = state.canRedo;\n };\n instance.on(\"history-change\", onHistoryChange);\n });\n\n onBeforeUnmount(() => {\n const instance = chart.value;\n if (!instance) return;\n if (onHistoryChange) instance.off(\"history-change\", onHistoryChange);\n instance.destroy();\n chart.value = null;\n canUndo.value = false;\n canRedo.value = false;\n });\n\n // Non-immediate: the initial values were already passed to the constructor above,\n // so these only need to fire on subsequent changes.\n watch(getTasks, (tasks) => chart.value?.setTasks(tasks));\n watch(getDependencies, (deps) => chart.value?.setDependencies(deps));\n watch(getOptions, (options) => chart.value?.setOptions(options));\n\n return { chart, canUndo, canRedo };\n}\n","export { GanttChart, default } from \"./GanttChart\";\nexport type { GanttChartProps, GanttChartHandle } from \"./GanttChart\";\n\nexport { useGanttChart } from \"./useGanttChart\";\nexport type { UseGanttChartResult } from \"./useGanttChart\";\n\n// Re-exported so consumers never need to add @ganttloom/gantt-core as a direct\n// dependency just to reference its types.\nexport type {\n ViewMode,\n DependencyType,\n GanttDependency,\n GanttAssignee,\n GanttTask,\n GanttColumn,\n GanttTheme,\n GanttRenderRow,\n GanttRenderBar,\n GanttRenderLink,\n GanttRenderTick,\n GanttRenderModel,\n GanttOptions,\n GanttEventMap,\n WorkingCalendar,\n ConstraintType,\n ResourceHistogramOptions,\n ResourceLoadBucket,\n GanttMarker,\n GanttRenderMarker,\n FilterTasksOptions,\n FilterTasksResult,\n Density,\n ResourceLevelingOptions,\n ResourceLevelingResult,\n} from \"@ganttloom/gantt-core\";\n\nexport {\n computeWBSCodes,\n applyConstraint,\n isWorkingDay,\n isHoliday,\n isWithinWorkingHours,\n isWorkingTime,\n nextWorkingDay,\n previousWorkingDay,\n shiftToWorkingDay,\n shiftToWorkingTime,\n computeResourceHistogram,\n renderResourceHistogramSVG,\n filterTasks,\n colorByField,\n applyColorByField,\n DEFAULT_PALETTE,\n DENSITY_PRESETS,\n levelResources,\n} from \"@ganttloom/gantt-core\";\n"],"mappings":";AAIA,OAAO;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAAA;AAAA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,WAAW;AAAA,MAC1C,aAAa,MAAM,MAAM,OAAO,YAAY,KAAK;AAAA,MACjD,cAAc,MAAM,MAAM,OAAO,aAAa,KAAK,QAAQ,QAAQ,EAAE;AAAA,MACrE,eAAe,CAAC,YAAY,MAAM,OAAO,cAAc,OAAO,KAAK,QAAQ,QAAQ,CAAC,CAAC;AAAA,MACrF,gBAAgB,MAAM,MAAM,OAAO,eAAe,KAAK;AAAA,MACvD,aAAa,MAAM,MAAM;AAAA,IAC3B;AACA,WAAO,MAAM;AAGb,WAAO,MAAM,EAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AAAA,EAC7C;AACF,CAAC;AAED,IAAO,qBAAQ;;;AEraf;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["onBeforeUnmount","watch","watch","onBeforeUnmount"]}
1
+ {"version":3,"sources":["../src/GanttChart.ts","../src/useGanttChart.ts","../src/index.ts"],"sourcesContent":["import {\r\n defineComponent,\r\n getCurrentInstance,\r\n h,\r\n onBeforeUnmount,\r\n ref,\r\n watch,\r\n type ExtractPropTypes,\r\n type PropType,\r\n} from \"vue\";\r\nimport type {\r\n GanttChart as GanttCore,\r\n GanttColumn,\r\n GanttDependency,\r\n GanttLabels,\r\n GanttMarker,\r\n GanttOptions,\r\n GanttRenderBarContext,\r\n GanttRenderModel,\r\n GanttTask,\r\n GanttTheme,\r\n ResourceHistogramOptions,\r\n ResourceLoadBucket,\r\n ResourceLevelingOptions,\r\n ResourceLevelingResult,\r\n ViewMode,\r\n WorkingCalendar,\r\n} from \"@ganttloom/gantt-core\";\r\nimport { useGanttChart } from \"./useGanttChart\";\r\n\r\n/** Imperative escape hatches, available via a template ref (see the package README). */\r\nexport interface GanttChartHandle {\r\n /** Reverts the most recent move/resize/link/progress/create action. No-op unless `enable-history` is set. */\r\n undo(): void;\r\n /** Re-applies the most recently undone action. No-op unless `enable-history` is set. */\r\n redo(): void;\r\n /** Whether `undo()` currently has anything to revert. */\r\n canUndo(): boolean;\r\n /** Whether `redo()` currently has anything to re-apply. */\r\n canRedo(): boolean;\r\n /** Expands every collapsed group row. */\r\n expandAll(): void;\r\n /** Collapses every group row that has children. */\r\n collapseAll(): void;\r\n /** Toggles a single group row's collapsed state. */\r\n toggleGroup(taskId: string): void;\r\n /** Removes a dependency link between two tasks, if it exists. */\r\n removeDependency(fromId: string, toId: string): void;\r\n /** Patches an existing dependency link's fields (e.g. its `type` or `lagMs`). */\r\n updateDependency(fromId: string, toId: string, partial: Partial<GanttDependency>): void;\r\n /** Patches a task's fields in place (e.g. dates, progress, name) and re-renders. */\r\n updateTask(id: string, partial: Partial<GanttTask>): void;\r\n /** Look up a task by id. Returns a cloned copy, or undefined if not found. */\r\n getTask(id: string): GanttTask | undefined;\r\n /** Add a new task to the chart. Undoable with enable-history. */\r\n addTask(task: GanttTask, options?: { parentId?: string; index?: number }): void;\r\n /** Delete a single task and any dependencies touching it. Undoable with enable-history. */\r\n deleteTask(id: string): void;\r\n /** Add a dependency link. Returns false if invalid (e.g. self-loop, duplicate, or cycle), true if added. Undoable with enable-history. */\r\n addDependency(dep: GanttDependency): boolean;\r\n /** Snapshot of current dependencies, as cloned copies. */\r\n getDependencies(): GanttDependency[];\r\n /** Convert a pixel offset in timeline space back to a real Date based on current rangeStart and zoom level. */\r\n getDateAtX(xPx: number): Date;\r\n /** Convert a Date to a pixel coordinate in timeline space. */\r\n getXForDate(date: Date): number;\r\n /** Switches the timeline's zoom level (hour/day/week/month/quarter/year). */\r\n setViewMode(mode: ViewMode): void;\r\n /** Grows `column-width` (never shrinks) so the timeline exactly fills the given container width. */\r\n fitToViewport(containerWidthPx: number): void;\r\n /** Scrolls the timeline so today's date is centered in the viewport. */\r\n scrollToToday(): void;\r\n /** Scrolls the timeline to the very start of the task date range. */\r\n scrollToRangeStart(): void;\r\n /** Scrolls the timeline to the very end of the task date range. */\r\n scrollToRangeEnd(): void;\r\n /** Total number of pages, when `pagination` is set (always `1` otherwise). */\r\n getPageCount(): number;\r\n /** Jumps to a 1-indexed page of top-level rows, when `pagination` is set. */\r\n setPage(page: number): void;\r\n /** Multiplies `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomIn(factor?: number): void;\r\n /** Divides `column-width` by `factor` (default `1.25`), clamped to a sane zoom range. */\r\n zoomOut(factor?: number): void;\r\n /** Current `column-width` in px per smallest time unit. */\r\n getZoomLevel(): number;\r\n /** Per-assignee workload buckets, for spotting over-allocation. */\r\n getResourceHistogram(options?: ResourceHistogramOptions): ResourceLoadBucket[];\r\n /** Computes a conflict-free schedule by delaying double-booked assignees' tasks; does not mutate the chart's own tasks. */\r\n getLeveledTasks(options?: ResourceLevelingOptions): ResourceLevelingResult;\r\n /** Selects one task bar; pass `{ additive: true }` to add to the existing selection instead of replacing it. Requires `selectable`. */\r\n selectTask(id: string, options?: { additive?: boolean }): void;\r\n /** Selects every currently-visible task bar. Requires `selectable`. */\r\n selectAllVisible(): void;\r\n /** Clears the current bar selection. */\r\n clearSelection(): void;\r\n /** IDs of the currently-selected task bars. */\r\n getSelectedTaskIds(): string[];\r\n /** Sorts sibling rows at every tree level by a column's value; `direction` omitted/`null` clears sorting. */\r\n setSort(columnId: string | null, direction?: \"asc\" | \"desc\" | null): void;\r\n /** The current sort state, or `null` if unsorted. */\r\n getSort(): { columnId: string; direction: \"asc\" | \"desc\" } | null;\r\n /** Shifts every selected task's start/end by `deltaMs`. Requires `selectable`. */\r\n bulkShiftDates(deltaMs: number): void;\r\n /** Deletes every currently-selected task. Requires `selectable`. */\r\n bulkDelete(): void;\r\n /** Serializes the current chart to a standalone SVG string. */\r\n toSVGString(): string;\r\n /** Renders the current chart to a single PNG data URL. */\r\n toPNGDataURL(): Promise<string>;\r\n /** Renders the current chart to one PNG data URL per page, tiled to the given page pixel size. */\r\n toPNGDataURLs(options?: { pageWidthPx?: number; pageHeightPx?: number }): Promise<string[]>;\r\n /** The current computed render model (rows/bars/links/ticks), or `null` before first render. */\r\n getRenderModel(): GanttRenderModel | null;\r\n /** Direct access to the underlying framework-agnostic core instance (null before mount). */\r\n getInstance(): GanttCore | null;\r\n}\r\n\r\nconst EMPTY_RENDER_MODEL: GanttRenderModel = {\r\n width: 0,\r\n height: 0,\r\n rowHeight: 0,\r\n headerHeight: 0,\r\n rows: [],\r\n bars: [],\r\n links: [],\r\n ticks: [],\r\n columns: [],\r\n theme: {} as GanttTheme,\r\n markers: [],\r\n rangeStart: new Date(0),\r\n sort: null,\r\n};\r\n\r\n/**\r\n * Checks whether the parent actually bound a listener for `eventName` (e.g. \"onTaskCreate\")\r\n * on this component's *initial* vnode. A handful of gantt-core options only wire up their\r\n * DOM interaction (drag-to-create, column resize/reorder, dependency double-click, context\r\n * menu) when the corresponding callback is truthy AT CONSTRUCTION TIME — so a stable no-op\r\n * is passed there to force the wiring on, and the real dispatch goes through the reactive\r\n * \"task-create\" etc. event subscription below instead. Reading `vnode.props` (rather than a\r\n * declared prop/emit) is what lets this stay accurate for both `@task-create=\"...\"` template\r\n * listeners and a plain `onTaskCreate` prop, without needing the caller to pass anything else.\r\n */\r\nfunction hasInitialListener(eventName: string): boolean {\r\n const instance = getCurrentInstance();\r\n return !!(instance?.vnode.props && eventName in instance.vnode.props);\r\n}\r\n\r\nconst ganttChartProps = {\r\n tasks: { type: Array as PropType<GanttTask[]>, required: true },\r\n dependencies: { type: Array as PropType<GanttDependency[]>, default: () => [] },\r\n viewMode: { type: String as PropType<ViewMode>, default: undefined },\r\n columns: { type: Array as PropType<GanttColumn[]>, default: undefined },\r\n theme: { type: Object as PropType<Partial<GanttTheme>>, default: undefined },\r\n colorScheme: { type: String as PropType<\"light\" | \"dark\" | \"auto\">, default: undefined },\r\n columnWidth: { type: Number, default: undefined },\r\n readonly: { type: Boolean, default: undefined },\r\n showProgress: { type: Boolean, default: undefined },\r\n showDependencies: { type: Boolean, default: undefined },\r\n gridPanelWidth: { type: Number, default: undefined },\r\n showCriticalPath: { type: Boolean, default: undefined },\r\n showBaseline: { type: Boolean, default: undefined },\r\n showDeadlines: { type: Boolean, default: undefined },\r\n /** Positions the grid and timeline headers. Default is \"top\". */\r\n headerPosition: { type: String as PropType<\"top\" | \"bottom\" | \"none\">, default: undefined },\r\n /** hover tooltip on task bars, defaults to true. A floating, CSS-customizable element (`.gantt-tooltip`) - not the browser's native title tooltip. */\r\n showTooltip: { type: Boolean, default: undefined },\r\n /** fully control tooltip content/markup; return null/undefined to suppress it for a specific task. Defaults to name/dates/progress/assignees/notes. */\r\n renderTooltip: {\r\n type: Function as PropType<(task: GanttTask) => HTMLElement | string | null | undefined>,\r\n default: undefined,\r\n },\r\n /** Overridable UI strings/formatters (aria-labels, default new-task name, tooltip date/progress formatting) for i18n or custom copy. */\r\n labels: { type: Object as PropType<GanttLabels>, default: undefined },\r\n /**\r\n * Customize a task bar's visual content beyond color/label (icons, patterns, custom shapes)\r\n * without forking the renderer - mutate `ctx.group` in place. See `GanttRenderBarContext` in\r\n * gantt-core for the append-only contract that keeps drag/resize hit-testing intact.\r\n */\r\n renderBar: {\r\n type: Function as PropType<(ctx: GanttRenderBarContext) => void>,\r\n default: undefined,\r\n },\r\n showAssigneeAvatars: { type: Boolean, default: undefined },\r\n enableHistory: { type: Boolean, default: undefined },\r\n keyboardAccessible: { type: Boolean, default: undefined },\r\n virtualScroll: { type: Boolean, default: undefined },\r\n autoSchedule: { type: Boolean, default: undefined },\r\n pagination: { type: Object as PropType<{ pageSize: number; page: number }>, default: undefined },\r\n snapToUnit: { type: [String, Boolean] as PropType<\"hour\" | \"day\" | \"week\" | false>, default: undefined },\r\n /** working-day/holiday definition used to shade non-working time and (with autoSchedule) skip it when cascading */\r\n calendar: { type: Object as PropType<WorkingCalendar>, default: undefined },\r\n /** arbitrary labeled vertical lines on the timeline, independent of any task */\r\n markers: { type: Array as PropType<GanttMarker[]>, default: undefined },\r\n /** a group task with no explicit `progress` gets a duration-weighted average of its children's progress instead of 0 */\r\n autoRollupProgress: { type: Boolean, default: undefined },\r\n /** enables click/ctrl-click/shift-click multi-selection of task bars, and the handle's bulkShiftDates()/bulkDelete() */\r\n selectable: { type: Boolean, default: undefined },\r\n /**\r\n * Stretch (never shrink) the timeline to fill the container's width instead of leaving empty\r\n * space - the common \"short project at month/year zoom\" or \"just a few tasks\" case. Off by\r\n * default (a new chart's pixel layout shouldn't change for existing consumers who don't opt in).\r\n */\r\n autoFitToViewport: { type: Boolean, default: undefined },\r\n} as const;\r\n\r\nexport type GanttChartProps = ExtractPropTypes<typeof ganttChartProps>;\r\n\r\nconst ganttChartEmits = {\r\n \"date-change\": (_task: GanttTask, _start: Date, _end: Date) => true,\r\n \"progress-change\": (_task: GanttTask, _progress: number) => true,\r\n \"dependency-create\": (_dep: GanttDependency) => true,\r\n \"dependency-remove\": (_dep: GanttDependency) => true,\r\n \"dependency-dblclick\": (_dep: GanttDependency) => true,\r\n \"task-click\": (_task: GanttTask) => true,\r\n \"task-dblclick\": (_task: GanttTask) => true,\r\n \"group-toggle\": (_task: GanttTask, _collapsed: boolean) => true,\r\n \"context-menu\": (_task: GanttTask, _evt: PointerEvent) => true,\r\n \"task-create\": (_task: GanttTask) => true,\r\n \"column-resize\": (_columnId: string, _width: number) => true,\r\n \"column-reorder\": (_order: string[]) => true,\r\n \"task-reorder\": (\r\n _draggedTaskId: string,\r\n _targetTaskId: string,\r\n _position: \"before\" | \"after\" | \"inside\"\r\n ) => true,\r\n \"selection-change\": (_taskIds: string[]) => true,\r\n \"sort-change\": (_sort: { columnId: string; direction: \"asc\" | \"desc\" } | null) => true,\r\n};\r\n\r\nexport const GanttChart = defineComponent({\r\n name: \"GanttChart\",\r\n props: ganttChartProps,\r\n emits: ganttChartEmits,\r\n setup(props, { emit, expose }) {\r\n const containerRef = ref<HTMLElement | null>(null);\r\n const noop = () => {};\r\n\r\n // See hasInitialListener's doc comment: these six only affect whether gantt-core wires\r\n // up the relevant DOM interaction at construction, and are captured once, up front.\r\n // onContextMenu is deliberately always wired (unlike the other six) so right-click\r\n // handling works out of the box even for consumers who haven't attached a listener.\r\n const wireTaskCreate = hasInitialListener(\"onTaskCreate\");\r\n const wireColumnResize = hasInitialListener(\"onColumnResize\");\r\n const wireColumnReorder = hasInitialListener(\"onColumnReorder\");\r\n const wireTaskReorder = hasInitialListener(\"onTaskReorder\");\r\n const wireDependencyDblClick = hasInitialListener(\"onDependencyDblClick\");\r\n const wireTaskDblClick = hasInitialListener(\"onTaskDblClick\");\r\n\r\n // gantt-core invokes every one of these seven callbacks from a call site that ALSO\r\n // unconditionally emits the matching public event (\"date-change\", \"selection-change\", ...).\r\n // So none of them belong in `options` below — doing that would fire the Vue listener\r\n // twice per event, once here and once through the chart.on(...) subscription further down.\r\n // options only ever needs: (a) the six gate-a-DOM-feature callbacks, as stable no-ops/undefined\r\n // purely to control wiring, and (b) everything else, which is plain reactive config.\r\n const getOptions = (): GanttOptions => ({\r\n viewMode: props.viewMode,\r\n columns: props.columns,\r\n theme: props.theme,\r\n colorScheme: props.colorScheme,\r\n columnWidth: props.columnWidth,\r\n readonly: props.readonly,\r\n showProgress: props.showProgress,\r\n showDependencies: props.showDependencies,\r\n gridPanelWidth: props.gridPanelWidth,\r\n showCriticalPath: props.showCriticalPath,\r\n showBaseline: props.showBaseline,\r\n showDeadlines: props.showDeadlines,\r\n headerPosition: props.headerPosition,\r\n showTooltip: props.showTooltip,\r\n renderTooltip: props.renderTooltip,\r\n labels: props.labels,\r\n renderBar: props.renderBar,\r\n showAssigneeAvatars: props.showAssigneeAvatars,\r\n enableHistory: props.enableHistory,\r\n keyboardAccessible: props.keyboardAccessible,\r\n virtualScroll: props.virtualScroll,\r\n autoSchedule: props.autoSchedule,\r\n pagination: props.pagination,\r\n snapToUnit: props.snapToUnit,\r\n calendar: props.calendar,\r\n markers: props.markers,\r\n autoRollupProgress: props.autoRollupProgress,\r\n selectable: props.selectable,\r\n autoFitToViewport: props.autoFitToViewport,\r\n onContextMenu: noop,\r\n onTaskCreate: wireTaskCreate ? noop : undefined,\r\n onColumnResize: wireColumnResize ? noop : undefined,\r\n onColumnReorder: wireColumnReorder ? noop : undefined,\r\n onTaskReorder: wireTaskReorder ? noop : undefined,\r\n onDependencyDblClick: wireDependencyDblClick ? noop : undefined,\r\n onTaskDblClick: wireTaskDblClick ? noop : undefined,\r\n });\r\n\r\n const { chart } = useGanttChart(\r\n containerRef,\r\n () => props.tasks,\r\n () => props.dependencies,\r\n getOptions\r\n );\r\n\r\n // useGanttChart already watches getOptions and calls setOptions on change -\r\n // no need to duplicate that here.\r\n\r\n // All real event dispatch goes through the chart's public emitter — set up once when the\r\n // instance appears. `emit` is stable for the component's lifetime, so (unlike the React\r\n // wrapper's ref-of-latest-callback dance) there's no need to guard against re-subscribing.\r\n watch(chart, (instance, _prev, onCleanup) => {\r\n if (!instance) return;\r\n instance.on(\"date-change\", handleDateChange);\r\n instance.on(\"progress-change\", handleProgressChange);\r\n instance.on(\"dependency-create\", handleDependencyCreate);\r\n instance.on(\"dependency-remove\", handleDependencyRemove);\r\n instance.on(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.on(\"task-click\", handleTaskClick);\r\n instance.on(\"task-dblclick\", handleTaskDblClick);\r\n instance.on(\"group-toggle\", handleGroupToggle);\r\n instance.on(\"context-menu\", handleContextMenu);\r\n instance.on(\"task-create\", handleTaskCreate);\r\n instance.on(\"column-resize\", handleColumnResize);\r\n instance.on(\"column-reorder\", handleColumnReorder);\r\n instance.on(\"task-reorder\", handleTaskReorder);\r\n instance.on(\"selection-change\", handleSelectionChange);\r\n instance.on(\"sort-change\", handleSortChange);\r\n onCleanup(() => {\r\n instance.off(\"date-change\", handleDateChange);\r\n instance.off(\"progress-change\", handleProgressChange);\r\n instance.off(\"dependency-create\", handleDependencyCreate);\r\n instance.off(\"dependency-remove\", handleDependencyRemove);\r\n instance.off(\"dependency-dblclick\", handleDependencyDblClick);\r\n instance.off(\"task-click\", handleTaskClick);\r\n instance.off(\"task-dblclick\", handleTaskDblClick);\r\n instance.off(\"group-toggle\", handleGroupToggle);\r\n instance.off(\"context-menu\", handleContextMenu);\r\n instance.off(\"task-create\", handleTaskCreate);\r\n instance.off(\"column-resize\", handleColumnResize);\r\n instance.off(\"column-reorder\", handleColumnReorder);\r\n instance.off(\"task-reorder\", handleTaskReorder);\r\n instance.off(\"selection-change\", handleSelectionChange);\r\n instance.off(\"sort-change\", handleSortChange);\r\n });\r\n }, { flush: \"sync\" }); // synchronous: chart.value is set inside useGanttChart's onMounted,\r\n // and listeners must be attached before that same tick's synchronous code (e.g. a ref call\r\n // right after mount) can trigger an event — Vue's default 'pre' flush would run this a tick late.\r\n\r\n function handleDateChange(p: { task: GanttTask; start: Date; end: Date }) {\r\n emit(\"date-change\", p.task, p.start, p.end);\r\n }\r\n function handleProgressChange(p: { task: GanttTask; progress: number }) {\r\n emit(\"progress-change\", p.task, p.progress);\r\n }\r\n function handleDependencyCreate(dep: GanttDependency) {\r\n emit(\"dependency-create\", dep);\r\n }\r\n function handleDependencyRemove(dep: GanttDependency) {\r\n emit(\"dependency-remove\", dep);\r\n }\r\n function handleDependencyDblClick(dep: GanttDependency) {\r\n emit(\"dependency-dblclick\", dep);\r\n }\r\n function handleTaskClick(p: { task: GanttTask }) {\r\n emit(\"task-click\", p.task);\r\n }\r\n function handleTaskDblClick(p: { task: GanttTask }) {\r\n emit(\"task-dblclick\", p.task);\r\n }\r\n function handleGroupToggle(p: { task: GanttTask; collapsed: boolean }) {\r\n emit(\"group-toggle\", p.task, p.collapsed);\r\n }\r\n function handleContextMenu(p: { task: GanttTask; evt: PointerEvent }) {\r\n emit(\"context-menu\", p.task, p.evt);\r\n }\r\n function handleTaskCreate(p: { task: GanttTask }) {\r\n emit(\"task-create\", p.task);\r\n }\r\n function handleColumnResize(p: { columnId: string; width: number }) {\r\n emit(\"column-resize\", p.columnId, p.width);\r\n }\r\n function handleColumnReorder(p: { order: string[] }) {\r\n emit(\"column-reorder\", p.order);\r\n }\r\n function handleTaskReorder(p: {\r\n draggedTaskId: string;\r\n targetTaskId: string;\r\n position: \"before\" | \"after\" | \"inside\";\r\n }) {\r\n emit(\"task-reorder\", p.draggedTaskId, p.targetTaskId, p.position);\r\n }\r\n function handleSelectionChange(p: { taskIds: string[] }) {\r\n emit(\"selection-change\", p.taskIds);\r\n }\r\n function handleSortChange(p: { sort: { columnId: string; direction: \"asc\" | \"desc\" } | null }) {\r\n emit(\"sort-change\", p.sort);\r\n }\r\n\r\n onBeforeUnmount(() => {\r\n containerRef.value = null;\r\n });\r\n\r\n const handle: GanttChartHandle = {\r\n undo: () => chart.value?.undo(),\r\n redo: () => chart.value?.redo(),\r\n canUndo: () => chart.value?.canUndo ?? false,\r\n canRedo: () => chart.value?.canRedo ?? false,\r\n expandAll: () => chart.value?.expandAll(),\r\n collapseAll: () => chart.value?.collapseAll(),\r\n toggleGroup: (taskId) => chart.value?.toggleGroup(taskId),\r\n removeDependency: (fromId, toId) => chart.value?.removeDependency(fromId, toId),\r\n updateDependency: (fromId, toId, partial) => chart.value?.updateDependency(fromId, toId, partial),\r\n updateTask: (id, partial) => chart.value?.updateTask(id, partial),\r\n getTask: (id) => chart.value?.getTask(id),\r\n addTask: (task, options) => chart.value?.addTask(task, options),\r\n deleteTask: (id) => chart.value?.deleteTask(id),\r\n addDependency: (dep) => chart.value?.addDependency(dep) ?? false,\r\n getDependencies: () => chart.value?.getDependencies() ?? [],\r\n getDateAtX: (xPx) => chart.value?.getDateAtX(xPx) ?? new Date(0),\r\n getXForDate: (date) => chart.value?.getXForDate(date) ?? 0,\r\n setViewMode: (mode) => chart.value?.setViewMode(mode),\r\n fitToViewport: (containerWidthPx) => chart.value?.fitToViewport(containerWidthPx),\r\n scrollToToday: () => chart.value?.scrollToToday(),\r\n scrollToRangeStart: () => chart.value?.scrollToRangeStart(),\r\n scrollToRangeEnd: () => chart.value?.scrollToRangeEnd(),\r\n getPageCount: () => chart.value?.getPageCount() ?? 1,\r\n setPage: (page) => chart.value?.setPage(page),\r\n zoomIn: (factor) => chart.value?.zoomIn(factor),\r\n zoomOut: (factor) => chart.value?.zoomOut(factor),\r\n getZoomLevel: () => chart.value?.getZoomLevel() ?? 0,\r\n getResourceHistogram: (options) => chart.value?.getResourceHistogram(options) ?? [],\r\n getLeveledTasks: (options) => chart.value?.getLeveledTasks(options) ?? { tasks: [], shifted: [] },\r\n selectTask: (id, options) => chart.value?.selectTask(id, options),\r\n selectAllVisible: () => chart.value?.selectAllVisible(),\r\n clearSelection: () => chart.value?.clearSelection(),\r\n getSelectedTaskIds: () => chart.value?.getSelectedTaskIds() ?? [],\r\n setSort: (columnId, direction) => chart.value?.setSort(columnId, direction),\r\n getSort: () => chart.value?.getSort() ?? null,\r\n bulkShiftDates: (deltaMs) => chart.value?.bulkShiftDates(deltaMs),\r\n bulkDelete: () => chart.value?.bulkDelete(),\r\n toSVGString: () => chart.value?.toSVGString() ?? \"\",\r\n toPNGDataURL: () => chart.value?.toPNGDataURL() ?? Promise.resolve(\"\"),\r\n toPNGDataURLs: (options) => chart.value?.toPNGDataURLs(options) ?? Promise.resolve([]),\r\n getRenderModel: () => chart.value?.getRenderModel() ?? EMPTY_RENDER_MODEL,\r\n getInstance: () => chart.value,\r\n };\r\n expose(handle);\r\n\r\n // A single root element: class/style attrs fall through onto it automatically.\r\n return () => h(\"div\", { ref: containerRef });\r\n },\r\n});\r\n\r\nexport default GanttChart;\r\n","import { onBeforeUnmount, onMounted, shallowRef, watch, type Ref, type ShallowRef } from \"vue\";\r\nimport { GanttChart as GanttCore, injectStyles } from \"@ganttloom/gantt-core\";\r\nimport type { GanttDependency, GanttOptions, GanttTask } from \"@ganttloom/gantt-core\";\r\n\r\nexport interface UseGanttChartResult {\r\n /** The underlying framework-agnostic GanttChart instance, or null before the mount effect runs. */\r\n chart: ShallowRef<GanttCore | null>;\r\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\r\n canUndo: Ref<boolean>;\r\n /** Reactive, subscribed to the core's \"history-change\" event. Only meaningful when `enableHistory` is set in options. */\r\n canRedo: Ref<boolean>;\r\n}\r\n\r\n/**\r\n * Lower-level escape hatch for consumers who want to own their own container element\r\n * and DOM tree instead of using the <GanttChart /> component. Constructs a\r\n * @ganttloom/gantt-core GanttChart instance against `containerRef.value` on mount,\r\n * keeps it in sync with the tasks/dependencies/options getters via setTasks / setDependencies /\r\n * setOptions (reference-equality checks only — return a new array/object to trigger a sync),\r\n * and destroys it on unmount.\r\n *\r\n * `getTasks`/`getDependencies`/`getOptions` are plain functions (not refs) so this composable\r\n * can track whatever reactive source each one reads — a prop, a ref, a computed — without\r\n * imposing a shape on the caller.\r\n */\r\nexport function useGanttChart(\r\n containerRef: Ref<HTMLElement | null>,\r\n getTasks: () => GanttTask[],\r\n getDependencies: () => GanttDependency[],\r\n getOptions: () => GanttOptions\r\n): UseGanttChartResult {\r\n const chart = shallowRef<GanttCore | null>(null);\r\n const canUndo = shallowRef(false);\r\n const canRedo = shallowRef(false);\r\n\r\n let onHistoryChange: ((state: { canUndo: boolean; canRedo: boolean }) => void) | undefined;\r\n\r\n onMounted(() => {\r\n const container = containerRef.value;\r\n if (!container) return;\r\n\r\n // Default styles are injected at runtime rather than via a CSS import, so the\r\n // package also loads in plain Node / SSR / Jest where \".css\" can't be required.\r\n injectStyles(container.ownerDocument);\r\n const instance = new GanttCore(container, getTasks(), getDependencies(), getOptions());\r\n chart.value = instance;\r\n canUndo.value = instance.canUndo;\r\n canRedo.value = instance.canRedo;\r\n\r\n onHistoryChange = (state) => {\r\n canUndo.value = state.canUndo;\r\n canRedo.value = state.canRedo;\r\n };\r\n instance.on(\"history-change\", onHistoryChange);\r\n });\r\n\r\n onBeforeUnmount(() => {\r\n const instance = chart.value;\r\n if (!instance) return;\r\n if (onHistoryChange) instance.off(\"history-change\", onHistoryChange);\r\n instance.destroy();\r\n chart.value = null;\r\n canUndo.value = false;\r\n canRedo.value = false;\r\n });\r\n\r\n // Non-immediate: the initial values were already passed to the constructor above,\r\n // so these only need to fire on subsequent changes.\r\n watch(getTasks, (tasks) => chart.value?.setTasks(tasks));\r\n watch(getDependencies, (deps) => chart.value?.setDependencies(deps));\r\n watch(getOptions, (options) => chart.value?.setOptions(options));\r\n\r\n return { chart, canUndo, canRedo };\r\n}\r\n","export { GanttChart, default } from \"./GanttChart\";\nexport type { GanttChartProps, GanttChartHandle } from \"./GanttChart\";\n\nexport { useGanttChart } from \"./useGanttChart\";\nexport type { UseGanttChartResult } from \"./useGanttChart\";\n\n// Re-exported so consumers never need to add @ganttloom/gantt-core as a direct\n// dependency just to reference its types.\nexport type {\n ViewMode,\n DependencyType,\n GanttDependency,\n GanttAssignee,\n GanttTask,\n GanttColumn,\n GanttTheme,\n GanttRenderRow,\n GanttRenderBar,\n GanttRenderLink,\n GanttRenderTick,\n GanttRenderModel,\n GanttOptions,\n GanttEventMap,\n WorkingCalendar,\n ConstraintType,\n ResourceHistogramOptions,\n ResourceLoadBucket,\n GanttMarker,\n GanttRenderMarker,\n FilterTasksOptions,\n FilterTasksResult,\n Density,\n ResourceLevelingOptions,\n ResourceLevelingResult,\n} from \"@ganttloom/gantt-core\";\n\nexport {\n computeWBSCodes,\n applyConstraint,\n isWorkingDay,\n isHoliday,\n isWithinWorkingHours,\n isWorkingTime,\n nextWorkingDay,\n previousWorkingDay,\n shiftToWorkingDay,\n shiftToWorkingTime,\n computeResourceHistogram,\n renderResourceHistogramSVG,\n filterTasks,\n colorByField,\n applyColorByField,\n DEFAULT_PALETTE,\n DENSITY_PRESETS,\n levelResources,\n} from \"@ganttloom/gantt-core\";\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAAA;AAAA,EACA;AAAA,EACA,SAAAC;AAAA,OAGK;;;ACTP,SAAS,iBAAiB,WAAW,YAAY,aAAwC;AACzF,SAAS,cAAc,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jD,cAAc,MAAM,MAAM,OAAO,aAAa,KAAK,QAAQ,QAAQ,EAAE;AAAA,MACrE,eAAe,CAAC,YAAY,MAAM,OAAO,cAAc,OAAO,KAAK,QAAQ,QAAQ,CAAC,CAAC;AAAA,MACrF,gBAAgB,MAAM,MAAM,OAAO,eAAe,KAAK;AAAA,MACvD,aAAa,MAAM,MAAM;AAAA,IAC3B;AACA,WAAO,MAAM;AAGb,WAAO,MAAM,EAAE,OAAO,EAAE,KAAK,aAAa,CAAC;AAAA,EAC7C;AACF,CAAC;AAED,IAAO,qBAAQ;;;AE/Zf;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["onBeforeUnmount","watch","watch","onBeforeUnmount"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ganttloom/gantt-vue",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Vue 3 wrapper for @ganttloom/gantt-core — fully customizable Gantt chart component.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -8,9 +8,14 @@
8
8
  "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
14
19
  }
15
20
  },
16
21
  "files": [
@@ -44,7 +49,7 @@
44
49
  "vue": ">=3.3"
45
50
  },
46
51
  "dependencies": {
47
- "@ganttloom/gantt-core": "0.6.0"
52
+ "@ganttloom/gantt-core": "0.6.2"
48
53
  },
49
54
  "devDependencies": {
50
55
  "vue": "^3.5.13",