vlite3 1.5.11 → 1.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +20 -8
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/CategoryManager/CategoryManager2.vue.js +1 -1
  4. package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
  5. package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
  6. package/components/Dropdown/DropdownMenu.vue.js +1 -1
  7. package/components/Form/{AccordionView.vue.js → AccordionView2.vue.js} +2 -2
  8. package/components/Form/Form.vue.js +2 -2
  9. package/components/Form/index2.vue.js +1 -1
  10. package/components/NavbarCommandPalette.vue.js +1 -1
  11. package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +7 -7
  12. package/components/PanZoomViewport/PanZoomViewport.vue.js +1 -1
  13. package/components/Screen/ScreenFilter.vue.js +1 -1
  14. package/components/Splitter/Splitter.vue.d.ts +7 -0
  15. package/components/Splitter/Splitter.vue.js +33 -29
  16. package/components/Tabes/Tabes.vue.js +2 -2
  17. package/docs/README.md +17 -0
  18. package/docs/all-components.md +89 -0
  19. package/docs/component-index.md +313 -0
  20. package/docs/components/accordion.md +52 -0
  21. package/docs/components/alert.md +34 -0
  22. package/docs/components/app-shell.md +371 -0
  23. package/docs/components/async-select.md +264 -0
  24. package/docs/components/attachments-list.md +231 -0
  25. package/docs/components/avatar-group.md +74 -0
  26. package/docs/components/avatar-uploader.md +61 -0
  27. package/docs/components/avatar.md +28 -0
  28. package/docs/components/badge.md +81 -0
  29. package/docs/components/barcode.md +42 -0
  30. package/docs/components/beacon.md +29 -0
  31. package/docs/components/breadcrumb.md +317 -0
  32. package/docs/components/button-group.md +35 -0
  33. package/docs/components/button.md +86 -0
  34. package/docs/components/calendar.md +95 -0
  35. package/docs/components/carousel.md +122 -0
  36. package/docs/components/cart.md +533 -0
  37. package/docs/components/category-manager.md +269 -0
  38. package/docs/components/category-menu.md +251 -0
  39. package/docs/components/charts.md +1456 -0
  40. package/docs/components/chat.md +330 -0
  41. package/docs/components/checkbox.md +31 -0
  42. package/docs/components/chip.md +137 -0
  43. package/docs/components/choice-box.md +40 -0
  44. package/docs/components/clipboard.md +105 -0
  45. package/docs/components/clock.md +70 -0
  46. package/docs/components/color-picker.md +82 -0
  47. package/docs/components/command-palette.md +214 -0
  48. package/docs/components/comment-thread.md +171 -0
  49. package/docs/components/confirmation-modal.md +50 -0
  50. package/docs/components/custom-fields-display.md +94 -0
  51. package/docs/components/custom-fields.md +97 -0
  52. package/docs/components/data-list.md +93 -0
  53. package/docs/components/data-table.md +922 -0
  54. package/docs/components/date-picker.md +58 -0
  55. package/docs/components/date-range-picker.md +24 -0
  56. package/docs/components/date-time.md +104 -0
  57. package/docs/components/dropdown.md +740 -0
  58. package/docs/components/empty.md +100 -0
  59. package/docs/components/export-data.md +320 -0
  60. package/docs/components/file-picker.md +83 -0
  61. package/docs/components/file-preview.md +42 -0
  62. package/docs/components/file-tree.md +144 -0
  63. package/docs/components/footer.md +251 -0
  64. package/docs/components/forms.md +776 -0
  65. package/docs/components/gantt-chart.md +767 -0
  66. package/docs/components/google-login.md +67 -0
  67. package/docs/components/google-map.md +128 -0
  68. package/docs/components/heatmap.md +80 -0
  69. package/docs/components/icon-picker.md +58 -0
  70. package/docs/components/icon.md +176 -0
  71. package/docs/components/image-comparison.md +51 -0
  72. package/docs/components/image-magnifier.md +26 -0
  73. package/docs/components/import-data.md +521 -0
  74. package/docs/components/input.md +58 -0
  75. package/docs/components/invoice.md +339 -0
  76. package/docs/components/kanban.md +302 -0
  77. package/docs/components/label.md +25 -0
  78. package/docs/components/list.md +419 -0
  79. package/docs/components/masonry.md +55 -0
  80. package/docs/components/modal.md +133 -0
  81. package/docs/components/multi-select.md +54 -0
  82. package/docs/components/navbar.md +403 -0
  83. package/docs/components/number-input.md +41 -0
  84. package/docs/components/otp-input.md +68 -0
  85. package/docs/components/pagination.md +83 -0
  86. package/docs/components/pan-zoom-viewport.md +245 -0
  87. package/docs/components/permission-editor.md +322 -0
  88. package/docs/components/persona.md +56 -0
  89. package/docs/components/price.md +106 -0
  90. package/docs/components/pricing-plan.md +68 -0
  91. package/docs/components/progress-bar.md +53 -0
  92. package/docs/components/qr-code.md +59 -0
  93. package/docs/components/rating.md +59 -0
  94. package/docs/components/rich-text-editor.md +210 -0
  95. package/docs/components/scale-generator.md +101 -0
  96. package/docs/components/screen.md +208 -0
  97. package/docs/components/seo-provider.md +189 -0
  98. package/docs/components/side-panel.md +94 -0
  99. package/docs/components/sidebar-menu.md +422 -0
  100. package/docs/components/skeleton.md +115 -0
  101. package/docs/components/slider.md +48 -0
  102. package/docs/components/spinner.md +27 -0
  103. package/docs/components/splitter.md +97 -0
  104. package/docs/components/stats.md +234 -0
  105. package/docs/components/status-chip.md +232 -0
  106. package/docs/components/switch.md +23 -0
  107. package/docs/components/tabs.md +335 -0
  108. package/docs/components/tag-input.md +55 -0
  109. package/docs/components/textarea.md +31 -0
  110. package/docs/components/theme-provider.md +130 -0
  111. package/docs/components/theme-toggle.md +36 -0
  112. package/docs/components/thumbnail-selector.md +186 -0
  113. package/docs/components/timeline.md +225 -0
  114. package/docs/components/toast-notification.md +89 -0
  115. package/docs/components/tooltip.md +31 -0
  116. package/docs/components/workbook.md +102 -0
  117. package/docs/composables/use-theme.md +59 -0
  118. package/docs/getting-started/setup.md +176 -0
  119. package/docs/guides/draggable.md +211 -0
  120. package/docs/guides/internationalization.md +281 -0
  121. package/docs/guides/performance.md +118 -0
  122. package/docs/guides/testing-forms.md +154 -0
  123. package/docs/guides/testing-overlays.md +131 -0
  124. package/docs/guides/theming.md +124 -0
  125. package/docs/utilities/search.md +580 -0
  126. package/docs/utilities/utilities.md +371 -0
  127. package/docs-manifest.json +339 -0
  128. package/package.json +6 -15
  129. package/scripts/generate-docs-manifest.js +207 -0
  130. package/scripts/sync-docs.js +754 -0
  131. package/style.css +1 -1
  132. /package/components/Dropdown/{DropdownMenu2.vue.js → DropdownMenu3.vue.js} +0 -0
@@ -0,0 +1,767 @@
1
+ # GanttChart
2
+
3
+ **Import:** `import { GanttChart } from 'vlite3'`
4
+
5
+ ## Description
6
+
7
+ `GanttChart` renders a project schedule with:
8
+
9
+ - Date-aligned task bars and milestones
10
+ - Collapsible groups in a left sidebar
11
+ - Progress fills, dependency arrows, and a today marker
12
+ - Wheel/pinch zoom with a parent-driven imperative API, and day / week / month view modes
13
+ - Controlled drag-to-move and edge-resize (with live preview)
14
+ - Optional interactive dependency create / delete
15
+
16
+ The chart is **fully controlled**. It never mutates the `tasks` prop.
17
+
18
+ | Interaction | What the chart does | What the parent must do |
19
+ | :--- | :--- | :--- |
20
+ | Move / resize | Temporary live preview → emit `@task-update` once on release | Update `tasks` with the new `start` / `end` |
21
+ | Create dependency | Preview line + validation → emit `@dependency-create` once | Persist the edge on `tasks`, then pass them back |
22
+ | Delete dependency | Select line → emit `@dependency-delete` once | Remove the edge from `tasks`, then pass them back |
23
+
24
+ Permanent bars and arrows update only after the parent returns updated `tasks`.
25
+
26
+ ---
27
+
28
+ ## Quick start
29
+
30
+ ```vue
31
+ <script setup lang="ts">
32
+ import { ref } from 'vue'
33
+ import { GanttChart, formatGanttLocalDate, type GanttTask } from 'vlite3'
34
+
35
+ const tasks = ref<GanttTask[]>([
36
+ {
37
+ id: 'planning',
38
+ name: 'Planning',
39
+ start: '2026-04-01',
40
+ end: '2026-04-10',
41
+ progress: 100,
42
+ group: 'Phase 1',
43
+ },
44
+ {
45
+ id: 'design',
46
+ name: 'Design',
47
+ start: '2026-04-08',
48
+ end: '2026-04-22',
49
+ progress: 65,
50
+ group: 'Phase 1',
51
+ dependencies: ['planning'],
52
+ },
53
+ ])
54
+
55
+ function onTaskUpdate(task: GanttTask, changes: { start: Date; end: Date }) {
56
+ tasks.value = tasks.value.map((item) =>
57
+ item.id === task.id
58
+ ? {
59
+ ...item,
60
+ start: formatGanttLocalDate(changes.start),
61
+ end: formatGanttLocalDate(changes.end),
62
+ }
63
+ : item,
64
+ )
65
+ }
66
+ </script>
67
+
68
+ <template>
69
+ <GanttChart
70
+ :tasks="tasks"
71
+ view-mode="week"
72
+ show-progress
73
+ show-dependencies
74
+ @task-update="onTaskUpdate"
75
+ />
76
+ </template>
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Props
82
+
83
+ | Prop | Type | Default | Description |
84
+ | :--- | :--- | :------ | :---------- |
85
+ | `tasks` | `GanttTask[]` | **required** | Task and milestone data rendered on the chart |
86
+ | `viewMode` | `GanttViewMode` | `week` | Time axis granularity: `day`, `week`, or `month` |
87
+ | `height` | `number` | `0` | Total chart height in px; `0` auto-fits rows |
88
+ | `rowHeight` | `number` | `44` | Height of each task row in px |
89
+ | `barRadius` | `number` | `6` | Corner radius for task bars |
90
+ | `barHeight` | `number` | `28` | Task bar height within each row; keep ≤ `rowHeight` |
91
+ | `sidebarWidth` | `number` | `220` | Width of the left task-name sidebar in px |
92
+ | `showGrid` | `boolean` | `true` | Show dashed vertical grid lines |
93
+ | `gridOpacity` | `number` | `0.15` | Opacity (0–1) for grid lines and row dividers |
94
+ | `showTooltip` | `boolean` | `true` | Show task details on hover |
95
+ | `showLabels` | `boolean` | `true` | Show task names inside bars when space allows |
96
+ | `showProgress` | `boolean` | `true` | Show progress fill inside task bars |
97
+ | `showDependencies` | `boolean` | `true` | Render existing dependency arrows |
98
+ | `showTodayLine` | `boolean` | `true` | Show the today marker line when today is in range |
99
+ | `showHeader` | `boolean` | `true` | Show the top date axis header |
100
+ | `animate` | `boolean` | `true` | Play the entry animation on mount |
101
+ | `colors` | `string[]` | `CHART_COLORS` | Palette for tasks without a custom `color` |
102
+ | `todayColor` | `string` | `var(--color-danger)` | CSS color for the today marker |
103
+ | `locale` | `string` | `en-US` | Locale for date labels, tooltips, and resize preview |
104
+ | `draggable` | `boolean` | `true` | Allow move and resize of non-milestone bars |
105
+ | `editableDependencies` | `boolean` | `false` | Opt-in `+` connectors and create/delete flows. Independent of `showDependencies` |
106
+ | `cascadeDependencies` | `boolean` | `false` | When moving a task, dependents follow as a visual preview. Release still emits one root `@task-update`; the parent owns the authoritative cascade |
107
+ | `zoom` | `boolean` | `true` | Enable Ctrl/Meta + wheel (and trackpad pinch) zoom. The chart renders **no** zoom buttons — drive zoom from the parent via the [exposed methods](#imperative-api) |
108
+ | `minZoom` | `number` | `0.2` | Lower bound for the zoom level |
109
+ | `maxZoom` | `number` | `5` | Upper bound for the zoom level |
110
+ | `zoomStep` | `number` | `0.2` | Increment applied by `zoomIn` / `zoomOut` |
111
+ | `visiblePeriodCount` | `number` | Day 7 · Week 4 · Month 1.7 | Period columns that fill the viewport at zoom 1 (fractional allowed). Zoom out/in to show more/fewer. See [Timeline viewport](#timeline-viewport--navigation) |
112
+ | `minColumnWidth` | `number` | per view | Minimum px width per column so the project never compresses to fit. Defaults: Day 44, Week 96, Month 130 |
113
+ | `timelineStart` | `Date \| string` | earliest task | Force the timeline start (aligned to the view's period boundary) |
114
+ | `timelineEnd` | `Date \| string` | last task | Force the timeline end instead of deriving it from the last task |
115
+ | `rangePadding` | `number` | `0` | Extra empty periods after the last task's completed boundary period (weeks in Day/Week, months in Month) |
116
+ | `preserveCenterDate` | `boolean` | `true` | Keep the viewport's centre date in view when switching Day / Week / Month |
117
+ | `collapsibleSidebar` | `boolean` | `true` | Show a collapse/expand control on the task sidebar to give the timeline more room |
118
+ | `defaultSidebarCollapsed` | `boolean` | `false` | Start with the sidebar collapsed |
119
+
120
+ ---
121
+
122
+ ## Events
123
+
124
+ | Event | Payload | Description |
125
+ | :---- | :------ | :---------- |
126
+ | `task-click` | `(task: GanttTask)` | Task row or bar click |
127
+ | `task-hover` | `(task: GanttTask \| null)` | Hover enter; `null` when hover ends |
128
+ | `task-update` | `(task: GanttTask, changes: { start: Date; end: Date })` | Emitted **once on release** after a move or resize. Live preview runs during the gesture without mutating `tasks` |
129
+ | `zoom-change` | `(state: GanttZoomState)` | Emitted whenever the zoom level changes (wheel or imperative). Use it to render accurate control states |
130
+ | `sidebar-toggle` | `(collapsed: boolean)` | Emitted when the task sidebar is collapsed or expanded |
131
+ | `dependency-create` | `(payload: GanttDependencyCreatePayload)` | Valid predecessor → successor link requested |
132
+ | `dependency-delete` | `(payload: GanttDependencyDeletePayload)` | Selected dependency deleted |
133
+
134
+ ### Dependency payloads
135
+
136
+ ```ts
137
+ interface GanttDependencyCreatePayload {
138
+ /** Task that must finish first (arrow origin) */
139
+ predecessorId: string
140
+ /** Task that waits on the predecessor */
141
+ successorId: string
142
+ predecessor: GanttTask
143
+ successor: GanttTask
144
+ /** Always `waiting-on` from the connector (successor's perspective) */
145
+ type: 'waiting-on'
146
+ /** Display label, e.g. `"Waiting on"` */
147
+ typeLabel: string
148
+ }
149
+
150
+ interface GanttDependencyDeletePayload {
151
+ predecessorId: string
152
+ successorId: string
153
+ predecessor: GanttTask
154
+ successor: GanttTask
155
+ type: 'waiting-on'
156
+ typeLabel: string
157
+ }
158
+ ```
159
+
160
+ **Parent responsibility**
161
+
162
+ - **Create:** persist one canonical schedule edge — successor **Waiting on** predecessor (same as predecessor **Blocking** successor). Update `dependencies` and/or `dependencyLinks`, then pass `tasks` back.
163
+ - **Delete:** remove that edge from parent state and pass updated `tasks` back.
164
+ - Do **not** store two DB rows for Waiting on + Blocking of the same pair.
165
+
166
+ The permanent arrow appears or disappears only after that update.
167
+
168
+ ---
169
+
170
+ ## Timeline viewport & navigation
171
+
172
+ The chart separates two concepts: the **complete project range** (derived from your task dates) and the **visible viewport window** (the readable slice on screen). Instead of squeezing every day/week/month into the available width, columns keep a sensible minimum width and the remainder of the project scrolls horizontally.
173
+
174
+ **Readable columns.** Each view mode targets a responsive number of visible columns and a minimum column width:
175
+
176
+ | View | Default visible | Min column width |
177
+ | :--- | :-------------- | :--------------- |
178
+ | Day | 7 days | 44px |
179
+ | Week | 4 weeks | 96px |
180
+ | Month | 1.7 months (one full + a peek) | 130px |
181
+
182
+ These counts fill the viewport at zoom 1; **zoom out to see more periods, zoom in to see fewer**. On narrow containers columns hold their minimum width and the timeline scrolls instead of shrinking. Override the default count with `visiblePeriodCount` or the floor with `minColumnWidth`.
183
+
184
+ **Range trimming.** The generated range aligns to period boundaries (weeks for Day/Week, months for Month) and trims unbounded empty space before and after the project. Internal gaps are always preserved so durations and dependency lines stay chronologically accurate — an empty Week 2 between tasks in Week 1 and Week 3 is kept. The boundary period containing the last task is always completed; `rangePadding` adds further empty periods after it if you want more navigation buffer. With no tasks, the current period is shown as context.
185
+
186
+ **Initial position & view switching.** The viewport opens on the current period when today falls inside the project range, otherwise on the earliest task's period. Switching Day / Week / Month preserves the date near the viewport centre (disable with `preserveCenterDate: false`) rather than jumping back to the start. Use `timelineStart` / `timelineEnd` to pin the range explicitly.
187
+
188
+ Column rendering is windowed with a small overscan, so long projects (months or years) stay smooth. Dragging, resizing, the today marker, milestones, and dependency connectors all remain correctly positioned while navigating.
189
+
190
+ ---
191
+
192
+ ## Imperative API
193
+
194
+ The chart deliberately ships **no chrome UI** (zoom controls, Today button, blocked legend). That keeps styling, placement, and behavior entirely in the parent's control. Hold a template ref to the chart and call its exposed methods; pair zoom with the `zoom-change` event to render accurate button states.
195
+
196
+ ### Exposed methods (via `ref`)
197
+
198
+ | Method | Signature | Description |
199
+ | :----- | :-------- | :---------- |
200
+ | `zoomIn` | `() => void` | Increase zoom by `zoomStep`, centered on the viewport |
201
+ | `zoomOut` | `() => void` | Decrease zoom by `zoomStep`, centered on the viewport |
202
+ | `setZoom` | `(level: number) => void` | Jump to an absolute level (clamped to `minZoom`…`maxZoom`) |
203
+ | `resetZoom` | `() => void` | Reset zoom back to `1` |
204
+ | `scrollToToday` | `() => void` | Smooth-scroll the timeline to the today marker |
205
+ | `isTodayVisible` | `() => boolean` | Whether today falls inside the rendered date range |
206
+ | `getZoom` | `() => number` | Read the current zoom level |
207
+ | `toggleSidebar` | `() => void` | Collapse / expand the task sidebar |
208
+ | `isSidebarCollapsed` | `() => boolean` | Read whether the sidebar is collapsed |
209
+
210
+ ### `GanttZoomState`
211
+
212
+ ```ts
213
+ export interface GanttZoomState {
214
+ zoom: number // current zoom level
215
+ canZoomIn: boolean // zoom < maxZoom
216
+ canZoomOut: boolean // zoom > minZoom
217
+ min: number // minZoom
218
+ max: number // maxZoom
219
+ }
220
+ ```
221
+
222
+ ### Example
223
+
224
+ ```vue
225
+ <script setup lang="ts">
226
+ import { computed, ref } from 'vue'
227
+ import GanttChart from '@/components/Chart/GanttChart.vue'
228
+ import type { GanttTask, GanttZoomState } from '@/components/Chart/types'
229
+
230
+ const gantt = ref<InstanceType<typeof GanttChart>>()
231
+ const tasks = ref<GanttTask[]>([/* ... */])
232
+ const zoom = ref<GanttZoomState>({ zoom: 1, canZoomIn: true, canZoomOut: true, min: 0.2, max: 5 })
233
+ const hasBlocked = computed(() => tasks.value.some((t) => t.blocked))
234
+ </script>
235
+
236
+ <template>
237
+ <div class="controls">
238
+ <span v-if="hasBlocked" class="legend-blocked">Blocked</span>
239
+ <button :disabled="!gantt?.isTodayVisible()" @click="gantt?.scrollToToday()">Today</button>
240
+ <button :disabled="!zoom.canZoomOut" @click="gantt?.zoomOut()">−</button>
241
+ <button @click="gantt?.resetZoom()">{{ Math.round(zoom.zoom * 100) }}%</button>
242
+ <button :disabled="!zoom.canZoomIn" @click="gantt?.zoomIn()">+</button>
243
+ </div>
244
+
245
+ <GanttChart ref="gantt" :tasks="tasks" @zoom-change="zoom = $event" />
246
+ </template>
247
+ ```
248
+
249
+ Ctrl/⌘ + wheel (and trackpad pinch) zoom stays built in and is toggled by the `zoom` prop.
250
+
251
+ ---
252
+
253
+ ## Types
254
+
255
+ ```ts
256
+ export type GanttViewMode = 'day' | 'week' | 'month'
257
+
258
+ /** User-facing type from the owning task's perspective */
259
+ export type GanttDependencyType = 'waiting-on' | 'blocking' | 'related-to'
260
+
261
+ export interface GanttTaskDependencyLink {
262
+ taskId: string
263
+ type: GanttDependencyType
264
+ }
265
+
266
+ export interface GanttTask {
267
+ id: string
268
+ name: string
269
+ start: Date | string
270
+ end: Date | string
271
+ progress?: number
272
+ color?: string
273
+ group?: string
274
+ /** Shorthand: predecessor IDs this task is waiting on (draws arrows) */
275
+ dependencies?: string[]
276
+ /** Typed links — `related-to` never draws arrows */
277
+ dependencyLinks?: GanttTaskDependencyLink[]
278
+ milestone?: boolean
279
+ /** Presentational blocked state: hatched overlay, lock marker, tooltip line, legend chip */
280
+ blocked?: boolean
281
+ /** Short reason shown in the tooltip when `blocked` */
282
+ blockedReason?: string
283
+ /** People on the task — shown in the tooltip (1 → Persona, many → AvatarGroup) */
284
+ assignees?: GanttPerson[]
285
+ }
286
+
287
+ export interface GanttPerson {
288
+ name?: string // display name → Persona label / AvatarGroup heading
289
+ src?: string // avatar image URL
290
+ alt?: string // image alt text
291
+ fallback?: string // initials shown when no image (auto-derived from name otherwise)
292
+ role?: string // secondary line → Persona secondaryLabel / AvatarGroup text
293
+ presence?: 'online' | 'offline' | 'busy' | 'dnd' | 'away' // only for a single assignee
294
+ }
295
+ ```
296
+
297
+ ### Data notes
298
+
299
+ - `id` must be unique. Dependencies and arrows key off this value.
300
+ - `start` / `end` accept `Date` objects or date strings.
301
+ - Date-only strings (`YYYY-MM-DD`) are parsed as **local calendar days** (not UTC midnight), so bars align with timeline columns in every timezone.
302
+ - Prefer `formatGanttLocalDate` when persisting dates — avoid `toISOString().slice(0, 10)` (UTC shift).
303
+ - `progress` is `0`–`100`.
304
+ - `group` creates collapsible headers in the left sidebar.
305
+ - `dependencies` = IDs this task is **waiting on** (predecessors).
306
+ - `dependencyLinks` is the typed form. Only `waiting-on` / `blocking` draw arrows; `related-to` never does.
307
+ - Waiting on and Blocking are opposite views of one schedule edge — persist once.
308
+ - `milestone: true` renders a diamond. Milestones can be clicked, hovered, and used as link endpoints; they are not moved or resized.
309
+ - Tasks without `color` use the `colors` palette.
310
+ - `assignees` render in the tooltip: a single person shows as a `Persona` (name, role, presence), multiple stack as an `AvatarGroup`. Avatars use `src`, or initials derived from `name` (or an explicit `fallback`).
311
+
312
+ ---
313
+
314
+ ## Dates and timezone
315
+
316
+ Task dates are **local calendar days**. Layout and snapping use the same calendar-day helpers.
317
+
318
+ ```ts
319
+ import { formatGanttLocalDate, parseGanttDate } from 'vlite3'
320
+
321
+ // Persist after @task-update
322
+ start: formatGanttLocalDate(changes.start) // "2026-04-08"
323
+
324
+ // Parse for comparisons
325
+ const day = parseGanttDate('2026-04-08') // local midnight
326
+ ```
327
+
328
+ | Helper (public) | Purpose |
329
+ | :--- | :------ |
330
+ | `formatGanttLocalDate(d)` | `YYYY-MM-DD` in local time |
331
+ | `parseGanttDate(d)` | Parse `Date` / string as local calendar day |
332
+ | `ganttCalendarDaysBetween(a, b)` | Whole calendar days between two dates |
333
+ | `ganttDateToX(...)` | Map a date to timeline X (advanced layout) |
334
+
335
+ Also exported: `GANTT_DEPENDENCY_TYPE_LABELS`, and the payload / task types listed above.
336
+
337
+ ---
338
+
339
+ ## Move and resize (live preview)
340
+
341
+ With `draggable` (default `true`):
342
+
343
+ - Drag the **middle** of a bar to move it.
344
+ - Drag the **left** or **right** edge to resize.
345
+ - Milestones are not move/resize targets.
346
+ - Move and dependency linking cannot run at the same time.
347
+
348
+ ### Live preview (temporary only)
349
+
350
+ While the pointer is down:
351
+
352
+ 1. The bar’s visible **position and/or width** update continuously.
353
+ 2. A date label above the bar shows the **previewed start — end** (same format family as the task tooltip).
354
+ 3. Preview dates use the **same half-day snap and minimum-duration rules** as the final emit.
355
+ 4. Preview stays aligned to timeline grid boundaries (geometry is derived from snapped dates, not a free CSS stretch that disagrees with dates).
356
+ 5. The active resize handle stays on the moving edge.
357
+ 6. The hover tooltip is suppressed during the gesture so it does not cover handles.
358
+ 7. Horizontal auto-scroll continues near the viewport edges.
359
+ 8. Screen readers receive throttled date updates via the chart’s live region.
360
+
361
+ The chart does **not**:
362
+
363
+ - Mutate `tasks` or overwrite the parent-controlled task object
364
+ - Keep a second persistent task collection
365
+ - Emit `@task-update` on every pointer move (emit once on successful release)
366
+
367
+ On **release**:
368
+
369
+ - If the snapped dates changed → emit `@task-update` once with the finalized `{ start, end }`
370
+ - Clear temporary preview state
371
+ - Parent-updated `tasks` become the permanent rendered state
372
+
373
+ On **cancel** (Escape, pointer cancel, unmount, or the task removed mid-gesture):
374
+
375
+ - Restore the original bar geometry
376
+ - Emit nothing
377
+
378
+ ### Edge behavior
379
+
380
+ | Case | Behavior |
381
+ | :--- | :------- |
382
+ | Right-edge resize | End date and width change; start stays fixed |
383
+ | Left-edge resize | Start date, left position, and width change; end stays fixed |
384
+ | Minimum duration | Enforced for preview and emit (half-day floor) |
385
+ | One-day / short tasks | Remain visible (min width) and resizable |
386
+ | `cascadeDependencies` | Dependents follow the bar **visually during a move**; on release only the root task emits `@task-update` |
387
+ | `draggable: false` | No move/resize preview or emits |
388
+
389
+ ```vue
390
+ <script setup lang="ts">
391
+ import { ref } from 'vue'
392
+ import { GanttChart, formatGanttLocalDate, type GanttTask } from 'vlite3'
393
+
394
+ const tasks = ref<GanttTask[]>([/* ... */])
395
+
396
+ function onTaskUpdate(task: GanttTask, changes: { start: Date; end: Date }) {
397
+ tasks.value = tasks.value.map((item) =>
398
+ item.id === task.id
399
+ ? {
400
+ ...item,
401
+ start: formatGanttLocalDate(changes.start),
402
+ end: formatGanttLocalDate(changes.end),
403
+ }
404
+ : item,
405
+ )
406
+ }
407
+ </script>
408
+
409
+ <template>
410
+ <GanttChart :tasks="tasks" @task-update="onTaskUpdate" />
411
+ </template>
412
+ ```
413
+
414
+ With `cascadeDependencies`, dependents follow the dragged bar as a **visual preview only**. On release the chart still emits exactly one `@task-update` for the root task — the parent (typically its server) owns the authoritative cascade and pushes the final dates for every affected task back through the `tasks` prop. Dependent movement is never persisted as N independent updates.
415
+
416
+ ---
417
+
418
+ ## Connector routing
419
+
420
+ Dependency arrows are routed by an obstacle-aware engine instead of a fixed elbow shape. Routing is purely visual — it never changes which edges exist or how scheduling behaves.
421
+
422
+ ### How paths are chosen
423
+
424
+ - A finish-to-start edge leaves the predecessor's **right edge** and enters the successor's **left edge** (milestones use the diamond tips).
425
+ - For every edge the router generates several orthogonal candidates — a direct line, Z-shaped routes, and routes through the clear corridors between rows — then picks the cheapest by total length, number of turns, task-bar collisions, connector crossings, and viewport boundaries.
426
+ - Candidate verticals that would pass through a bar are slid sideways past it, so lines route **around** task bars rather than through bars, labels, lock markers, or resize handles.
427
+ - Corners are consistently rounded; no sharp or irregular turns.
428
+
429
+ ### Dense graphs stay readable
430
+
431
+ - When several edges share a source or target, their exit / entry points are **distributed along the bar edge** so arrowheads never stack.
432
+ - Parallel connectors are assigned separate lanes with a minimum spacing; coincident segments are nudged apart deterministically.
433
+ - Where two connectors must cross, the later-routed line **hops** over the other with a small bridge arc instead of merging with it.
434
+ - Routing is deterministic: the same tasks and layout always produce identical paths — no jitter between renders. Paths recompute automatically on zoom, view-mode change, container resize, group collapse/expand, filtering, reordering, and task updates.
435
+
436
+ ### Tracing a connector
437
+
438
+ - Hovering (or keyboard-focusing, with `editableDependencies`) a connector darkens the **whole line and arrowhead**; unrelated connectors are left untouched. Selecting a connector turns it yellow. No shadows or dimming.
439
+ - The pointer target is a wide invisible stroke, so connectors are easy to grab without a visually thick line.
440
+
441
+ ### During interactions
442
+
443
+ While a bar is being moved or resized, connectors touching it follow with a **lightweight preview path** (no stale or frozen lines). The full obstacle-aware routing runs again once the gesture completes and the parent pushes updated `tasks`.
444
+
445
+ `related-to` links are unaffected by all of the above — they remain contextual, draw no arrow, and never participate in routing or scheduling.
446
+
447
+ ---
448
+
449
+ ## User-facing dependency types
450
+
451
+ | Type | Meaning | Gantt arrow? |
452
+ | :--- | :------ | :----------- |
453
+ | **Waiting on** | This task cannot proceed until the other completes | Yes (other → this) |
454
+ | **Blocking** | This task prevents the other from proceeding | Yes (this → other) — same edge as reverse Waiting on |
455
+ | **Related to** | Connected but non-blocking | No |
456
+
457
+ Selector pattern for parent UIs: `Type | Task` (e.g. `Waiting on | Task 1`).
458
+
459
+ ```ts
460
+ import {
461
+ GANTT_DEPENDENCY_TYPE_LABELS,
462
+ type GanttDependencyType,
463
+ } from 'vlite3'
464
+
465
+ // "Waiting on | Planning"
466
+ `${GANTT_DEPENDENCY_TYPE_LABELS['waiting-on']} | ${task.name}`
467
+ ```
468
+
469
+ PM / ERP mapping tip:
470
+
471
+ ```ts
472
+ // Schedule-blocking edges → Gantt arrows
473
+ dependencies: waitingOnTaskIds
474
+
475
+ // related-to stays in profile UI only — do not put in dependencies[]
476
+ ```
477
+
478
+ ---
479
+
480
+ ## Interactive dependency linking
481
+
482
+ Enable with `editableDependencies`. Separate from `showDependencies` (which only draws existing arrows).
483
+
484
+ ### Pointer flow (create)
485
+
486
+ 1. Hover or focus a task to reveal the `+` connector on its output edge (milestones included).
487
+ 2. Grab the connector and drag toward another visible task.
488
+ 3. A temporary dashed preview follows the pointer. Valid targets show a solid outline and ✓; invalid targets show a dashed outline and ✕.
489
+ 4. Release on a valid target to emit `@dependency-create` once. Release on empty space, an invalid target, or press Escape to cancel without emitting.
490
+
491
+ ### Select and delete
492
+
493
+ 1. Click an existing dependency line to select it (yellow stroke + glow).
494
+ 2. A yellow × appears at the line midpoint.
495
+ 3. Click ×, or press Delete / Backspace, to emit `@dependency-delete` once.
496
+ 4. Click empty chart space or press Escape to deselect without deleting.
497
+
498
+ ### Keyboard flow (create)
499
+
500
+ 1. Tab to a connector (`Create dependency from {task name}`).
501
+ 2. Press Enter or Space to start linking.
502
+ 3. Use Arrow keys to cycle visible targets; Enter/Space confirms; Escape cancels.
503
+ 4. Status updates are announced through an `aria-live` region (not color alone).
504
+
505
+ ### Validation (no success event when rejected)
506
+
507
+ | Rule | Behavior |
508
+ | :--- | :------- |
509
+ | Self-link | Rejected |
510
+ | Duplicate | Rejected if the successor already lists the predecessor |
511
+ | Circular | Rejected if the new edge would close a cycle |
512
+ | Collapsed / hidden tasks | Not hittable (only rows currently in the chart) |
513
+ | Chart without `editableDependencies` | No connectors; linking unavailable |
514
+
515
+ ### Controlled persistence
516
+
517
+ ```vue
518
+ <script setup lang="ts">
519
+ import { ref } from 'vue'
520
+ import {
521
+ GanttChart,
522
+ type GanttTask,
523
+ type GanttDependencyCreatePayload,
524
+ type GanttDependencyDeletePayload,
525
+ } from 'vlite3'
526
+
527
+ const tasks = ref<GanttTask[]>([
528
+ { id: 'a', name: 'A', start: '2026-04-01', end: '2026-04-08' },
529
+ { id: 'b', name: 'B', start: '2026-04-09', end: '2026-04-16' },
530
+ ])
531
+
532
+ function onDependencyCreate(payload: GanttDependencyCreatePayload) {
533
+ const { predecessorId, successorId } = payload
534
+ tasks.value = tasks.value.map((task) => {
535
+ if (task.id !== successorId) return task
536
+ if (task.dependencies?.includes(predecessorId)) return task
537
+ return {
538
+ ...task,
539
+ dependencies: [...(task.dependencies ?? []), predecessorId],
540
+ }
541
+ })
542
+ }
543
+
544
+ function onDependencyDelete(payload: GanttDependencyDeletePayload) {
545
+ const { predecessorId, successorId } = payload
546
+ tasks.value = tasks.value.map((task) => {
547
+ if (task.id !== successorId || !task.dependencies?.length) return task
548
+ const next = task.dependencies.filter((id) => id !== predecessorId)
549
+ return {
550
+ ...task,
551
+ dependencies: next.length ? next : undefined,
552
+ }
553
+ })
554
+ }
555
+ </script>
556
+
557
+ <template>
558
+ <GanttChart
559
+ :tasks="tasks"
560
+ editable-dependencies
561
+ show-dependencies
562
+ @dependency-create="onDependencyCreate"
563
+ @dependency-delete="onDependencyDelete"
564
+ />
565
+ </template>
566
+ ```
567
+
568
+ Linking cancels safely on Escape, pointer cancel, unmount, disabling `editableDependencies`, or replacing `tasks` mid-gesture. Move/resize and linking cannot activate at the same time.
569
+
570
+ During linking, the task tooltip stays clear of the `+` connector (hides near/on the connector and while linking). Dependency linking auto-scrolls the timeline when the pointer approaches viewport edges.
571
+
572
+ ---
573
+
574
+ ## Full interactive example
575
+
576
+ Local state, view modes, drag/resize persistence, and dependency create/delete — same pattern as the playground demo.
577
+
578
+ ```vue
579
+ <script setup lang="ts">
580
+ import { ref } from 'vue'
581
+ import {
582
+ GanttChart,
583
+ formatGanttLocalDate,
584
+ type GanttTask,
585
+ type GanttViewMode,
586
+ type GanttZoomState,
587
+ type GanttDependencyCreatePayload,
588
+ type GanttDependencyDeletePayload,
589
+ } from 'vlite3'
590
+
591
+ const initialTasks: GanttTask[] = [
592
+ {
593
+ id: 'task-1',
594
+ name: 'Research & Planning',
595
+ start: '2026-04-01',
596
+ end: '2026-04-10',
597
+ progress: 100,
598
+ group: 'Phase 1 - Discovery',
599
+ color: 'var(--color-chart-1)',
600
+ },
601
+ {
602
+ id: 'task-2',
603
+ name: 'Requirements Gathering',
604
+ start: '2026-04-06',
605
+ end: '2026-04-14',
606
+ progress: 85,
607
+ group: 'Phase 1 - Discovery',
608
+ color: 'var(--color-chart-5)',
609
+ dependencies: ['task-1'],
610
+ },
611
+ {
612
+ id: 'milestone-1',
613
+ name: 'Discovery Complete',
614
+ start: '2026-04-18',
615
+ end: '2026-04-19',
616
+ group: 'Phase 1 - Discovery',
617
+ milestone: true,
618
+ color: '#f59e0b',
619
+ dependencies: ['task-2'],
620
+ },
621
+ ]
622
+
623
+ const tasks = ref<GanttTask[]>(
624
+ initialTasks.map((t) => ({
625
+ ...t,
626
+ dependencies: t.dependencies ? [...t.dependencies] : undefined,
627
+ })),
628
+ )
629
+ const viewMode = ref<GanttViewMode>('week')
630
+ const lastAction = ref('')
631
+
632
+ // Parent owns the zoom UI — the chart exposes the methods
633
+ const gantt = ref<InstanceType<typeof GanttChart>>()
634
+ const zoom = ref<GanttZoomState>({ zoom: 1, canZoomIn: true, canZoomOut: true, min: 0.2, max: 5 })
635
+
636
+ const options = ref({
637
+ rowHeight: 44,
638
+ barRadius: 6,
639
+ barHeight: 28,
640
+ showGrid: true,
641
+ showLabels: true,
642
+ showTooltip: true,
643
+ showProgress: true,
644
+ showDependencies: true,
645
+ showTodayLine: true,
646
+ showHeader: true,
647
+ animate: true,
648
+ zoom: true,
649
+ draggable: true,
650
+ editableDependencies: true,
651
+ cascadeDependencies: false,
652
+ })
653
+
654
+ function onTaskUpdate(task: GanttTask, changes: { start: Date; end: Date }) {
655
+ tasks.value = tasks.value.map((item) =>
656
+ item.id === task.id
657
+ ? {
658
+ ...item,
659
+ start: formatGanttLocalDate(changes.start),
660
+ end: formatGanttLocalDate(changes.end),
661
+ }
662
+ : item,
663
+ )
664
+ }
665
+
666
+ function onDependencyCreate(payload: GanttDependencyCreatePayload) {
667
+ const { predecessorId, successorId, predecessor, successor } = payload
668
+ tasks.value = tasks.value.map((task) => {
669
+ if (task.id !== successorId) return task
670
+ if (task.dependencies?.includes(predecessorId)) return task
671
+ return {
672
+ ...task,
673
+ dependencies: [...(task.dependencies ?? []), predecessorId],
674
+ }
675
+ })
676
+ lastAction.value = `Linked: ${predecessor.name} → ${successor.name}`
677
+ }
678
+
679
+ function onDependencyDelete(payload: GanttDependencyDeletePayload) {
680
+ const { predecessorId, successorId, predecessor, successor } = payload
681
+ tasks.value = tasks.value.map((task) => {
682
+ if (task.id !== successorId || !task.dependencies?.length) return task
683
+ const next = task.dependencies.filter((id) => id !== predecessorId)
684
+ return {
685
+ ...task,
686
+ dependencies: next.length ? next : undefined,
687
+ }
688
+ })
689
+ lastAction.value = `Unlinked: ${predecessor.name} → ${successor.name}`
690
+ }
691
+
692
+ function onTaskClick(task: GanttTask) {
693
+ lastAction.value = `Clicked: ${task.name}`
694
+ }
695
+
696
+ function resetTasks() {
697
+ tasks.value = initialTasks.map((t) => ({
698
+ ...t,
699
+ dependencies: t.dependencies ? [...t.dependencies] : undefined,
700
+ }))
701
+ }
702
+ </script>
703
+
704
+ <template>
705
+ <div class="space-y-4">
706
+ <div class="flex flex-wrap items-center gap-2">
707
+ <button
708
+ v-for="mode in (['day', 'week', 'month'] as const)"
709
+ :key="mode"
710
+ type="button"
711
+ @click="viewMode = mode"
712
+ >
713
+ {{ mode }}
714
+ </button>
715
+ <button type="button" @click="resetTasks">Reset</button>
716
+
717
+ <!-- Parent-driven zoom controls -->
718
+ <button type="button" :disabled="!zoom.canZoomOut" @click="gantt?.zoomOut()">−</button>
719
+ <button type="button" @click="gantt?.resetZoom()">{{ Math.round(zoom.zoom * 100) }}%</button>
720
+ <button type="button" :disabled="!zoom.canZoomIn" @click="gantt?.zoomIn()">+</button>
721
+ </div>
722
+
723
+ <GanttChart
724
+ ref="gantt"
725
+ :tasks="tasks"
726
+ :view-mode="viewMode"
727
+ :row-height="options.rowHeight"
728
+ :bar-radius="options.barRadius"
729
+ :bar-height="options.barHeight"
730
+ :show-grid="options.showGrid"
731
+ :show-labels="options.showLabels"
732
+ :show-tooltip="options.showTooltip"
733
+ :show-progress="options.showProgress"
734
+ :show-dependencies="options.showDependencies"
735
+ :show-today-line="options.showTodayLine"
736
+ :show-header="options.showHeader"
737
+ :animate="options.animate"
738
+ :zoom="options.zoom"
739
+ :draggable="options.draggable"
740
+ :editable-dependencies="options.editableDependencies"
741
+ :cascade-dependencies="options.cascadeDependencies"
742
+ @task-click="onTaskClick"
743
+ @task-update="onTaskUpdate"
744
+ @zoom-change="zoom = $event"
745
+ @dependency-create="onDependencyCreate"
746
+ @dependency-delete="onDependencyDelete"
747
+ />
748
+
749
+ <p v-if="lastAction">{{ lastAction }}</p>
750
+ </div>
751
+ </template>
752
+ ```
753
+
754
+ ---
755
+
756
+ ## Interaction notes
757
+
758
+ - Drag a bar to move; drag left/right edges to resize. Preview updates in real time; `@task-update` fires once on release.
759
+ - Snap is half-day increments for both preview and emit.
760
+ - `cascadeDependencies` moves dependents as a visual preview during a move; release still emits one root `@task-update`. The parent applies the authoritative cascade through the `tasks` prop.
761
+ - `editableDependencies`: use `+` to create; click a line to select/delete. Chart never mutates `dependencies`.
762
+ - Hovering a dependency arrow shows both relationship perspectives (`B is waiting on A · A is blocking B`); selecting the arrow shows the same text as an on-chart label.
763
+ - Tasks with `blocked: true` render a hatched overlay, dashed outline, and lock marker; the tooltip shows `blockedReason`. Render any "Blocked" legend chip yourself from `tasks` (e.g. `tasks.some(t => t.blocked)`).
764
+ - Zoom and Today are parent-driven via the exposed methods (`zoomIn`/`zoomOut`/`setZoom`/`resetZoom`/`scrollToToday`); use `isTodayVisible()` to enable/disable a Today button. Ctrl/Meta + wheel and pinch also zoom when `zoom` is enabled. Track zoom state with `@zoom-change`. Changing `viewMode` resets zoom. See the [Imperative API](#imperative-api).
765
+ - Hover tooltip shows task details (dates, duration, progress, group, blocked reason, and any `assignees`); with `editableDependencies` it stays clear of the `+` connector.
766
+ - Linking and resizing both auto-scroll near timeline edges.
767
+ - Accessibility: connectors and selection have keyboard paths; status messages use `aria-live`.