@eightkk/vue-weave 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +525 -0
  2. package/CONTRIBUTING.md +116 -0
  3. package/LICENSE +21 -0
  4. package/README.ja.md +278 -0
  5. package/README.md +275 -2
  6. package/THIRD_PARTY_NOTICES.md +25 -0
  7. package/dist/core-LWK21xl4.js +13672 -0
  8. package/dist/core.js +1 -0
  9. package/dist/index.js +8505 -0
  10. package/dist/style.css +2 -0
  11. package/dist/types/components/GanttChart.vue.d.ts +353 -0
  12. package/dist/types/components/NetworkGraph.vue.d.ts +252 -0
  13. package/dist/types/components/types.d.ts +27 -0
  14. package/dist/types/composables/useAsyncGraphLayout.d.ts +163 -0
  15. package/dist/types/composables/useEditHistory.d.ts +13 -0
  16. package/dist/types/composables/useEditTransaction.d.ts +46 -0
  17. package/dist/types/composables/useLinkedSelection.d.ts +118 -0
  18. package/dist/types/composables/useTimelineView.d.ts +24 -0
  19. package/dist/types/composables/useWindowedData.d.ts +83 -0
  20. package/dist/types/core/actuals.d.ts +170 -0
  21. package/dist/types/core/calendarFormat.d.ts +65 -0
  22. package/dist/types/core/editTransaction.d.ts +96 -0
  23. package/dist/types/core/exportSvg.d.ts +236 -0
  24. package/dist/types/core/fieldEditing.d.ts +114 -0
  25. package/dist/types/core/graph.d.ts +196 -0
  26. package/dist/types/core/graphAlgorithms.d.ts +51 -0
  27. package/dist/types/core/graphAnalysis.d.ts +96 -0
  28. package/dist/types/core/graphCollapse.d.ts +62 -0
  29. package/dist/types/core/graphCrossings.d.ts +25 -0
  30. package/dist/types/core/graphEditing.d.ts +52 -0
  31. package/dist/types/core/graphExpansion.d.ts +71 -0
  32. package/dist/types/core/graphFlow.d.ts +184 -0
  33. package/dist/types/core/graphForce.d.ts +29 -0
  34. package/dist/types/core/graphGeometry.d.ts +31 -0
  35. package/dist/types/core/graphIncremental.d.ts +93 -0
  36. package/dist/types/core/graphLasso.d.ts +15 -0
  37. package/dist/types/core/graphLayoutRequests.d.ts +218 -0
  38. package/dist/types/core/graphLayouts.d.ts +81 -0
  39. package/dist/types/core/graphObstacleRouting.d.ts +68 -0
  40. package/dist/types/core/graphPortRules.d.ts +111 -0
  41. package/dist/types/core/graphRouting.d.ts +84 -0
  42. package/dist/types/core/graphSnapping.d.ts +34 -0
  43. package/dist/types/core/graphSpatial.d.ts +49 -0
  44. package/dist/types/core/graphSwimlanes.d.ts +77 -0
  45. package/dist/types/core/graphTraversal.d.ts +51 -0
  46. package/dist/types/core/graphView.d.ts +73 -0
  47. package/dist/types/core/index.d.ts +76 -0
  48. package/dist/types/core/interchange.d.ts +6 -0
  49. package/dist/types/core/interchangeCsv.d.ts +75 -0
  50. package/dist/types/core/interchangeICalendar.d.ts +111 -0
  51. package/dist/types/core/interchangeMsProject.d.ts +339 -0
  52. package/dist/types/core/leveling.d.ts +57 -0
  53. package/dist/types/core/pert.d.ts +62 -0
  54. package/dist/types/core/placement.d.ts +100 -0
  55. package/dist/types/core/planComparison.d.ts +275 -0
  56. package/dist/types/core/resourceLoad.d.ts +65 -0
  57. package/dist/types/core/resourceTimeline.d.ts +179 -0
  58. package/dist/types/core/rowHierarchy.d.ts +25 -0
  59. package/dist/types/core/scheduleDiagnostics.d.ts +37 -0
  60. package/dist/types/core/scheduleModel.d.ts +187 -0
  61. package/dist/types/core/scheduleTrace.d.ts +118 -0
  62. package/dist/types/core/scheduling.d.ts +194 -0
  63. package/dist/types/core/sheetEditing.d.ts +36 -0
  64. package/dist/types/core/snapshot.d.ts +388 -0
  65. package/dist/types/core/statusDate.d.ts +36 -0
  66. package/dist/types/core/timeRangeTargets.d.ts +67 -0
  67. package/dist/types/core/timeline.d.ts +194 -0
  68. package/dist/types/core/timelineView.d.ts +101 -0
  69. package/dist/types/core/types.d.ts +805 -0
  70. package/dist/types/core/viewBindings.d.ts +112 -0
  71. package/dist/types/core/windowedData.d.ts +255 -0
  72. package/dist/types/core/workCalendar.d.ts +41 -0
  73. package/dist/types/core/workingTimeScale.d.ts +33 -0
  74. package/dist/types/index.d.ts +52 -0
  75. package/docs/api.md +2009 -0
  76. package/docs/architecture.md +112 -0
  77. package/docs/code-of-conduct.md +24 -0
  78. package/docs/integration.md +964 -0
  79. package/docs/scheduling.md +586 -0
  80. package/docs/security.md +26 -0
  81. package/docs/third-party-licenses.md +33 -0
  82. package/package.json +79 -4
@@ -0,0 +1,112 @@
1
+ /** An application-defined entity. `kind` keeps equal IDs of different kinds apart. */
2
+ export interface EntityRef {
3
+ kind: string;
4
+ id: string;
5
+ }
6
+ /** Something one view can show for an entity. A load target is a time range, because load segments have no ID. */
7
+ export type ViewTarget = {
8
+ view: 'graph';
9
+ kind: 'node' | 'edge' | 'group';
10
+ id: string;
11
+ } | {
12
+ view: 'timeline';
13
+ kind: 'bar' | 'dependency' | 'row';
14
+ id: string;
15
+ } | {
16
+ view: 'load';
17
+ resourceId: string;
18
+ start: number;
19
+ end: number;
20
+ };
21
+ /** How a target was reached: by pointer or keyboard. */
22
+ export type ViewTargetSource = 'pointer' | 'keyboard';
23
+ /**
24
+ * Payload of the `target-enter`, `target-leave` and `target-activate` component events. `T` narrows the target to the
25
+ * targets of one view, for example `ViewTargetEvent<GraphViewTarget>` for NetworkGraph.
26
+ */
27
+ export interface ViewTargetEvent<T extends ViewTarget = ViewTarget> {
28
+ target: T;
29
+ source: ViewTargetSource;
30
+ }
31
+ /** The graph variant of `ViewTarget`: a node, an edge or a group of a NetworkGraph. */
32
+ export type GraphViewTarget = Extract<ViewTarget, {
33
+ view: 'graph';
34
+ }>;
35
+ /**
36
+ * Result of a reveal method (`GanttChart.revealBar`, `NetworkGraph.revealNode`). `unknown`: no such item, nothing
37
+ * moved. `hidden-by-collapse`: the item exists but a collapsed ancestor hides it; `proxyId` is the visible item that
38
+ * stands in for it (for a bar, the nearest displayed ancestor row; for a node, the proxy of its outermost collapsed
39
+ * group) and nothing moved. `revealed`: the view scrolled or moved its camera to the item.
40
+ */
41
+ export type RevealStatus = 'revealed' | 'hidden-by-collapse' | 'unknown';
42
+ export interface RevealOptions {
43
+ /** Move DOM focus to the item after it is scrolled into view and rendered. Default false. */
44
+ focus?: boolean;
45
+ /** Camera scale for graph reveals. Timeline reveals ignore it. */
46
+ scale?: number;
47
+ }
48
+ export interface RevealResult {
49
+ status: RevealStatus;
50
+ proxyId?: string;
51
+ }
52
+ /** Links one entity to one target. Many-to-many links are allowed. */
53
+ export interface ViewBinding {
54
+ entity: EntityRef;
55
+ target: ViewTarget;
56
+ }
57
+ /** The load variant of `ViewTarget`: a half-open time range `[start, end)` of one resource. */
58
+ export type LoadViewTarget = Extract<ViewTarget, {
59
+ view: 'load';
60
+ }>;
61
+ /** A two-way index of bindings built by `buildViewBindingIndex`. Treat it as opaque. */
62
+ export interface ViewBindingIndex {
63
+ readonly entities: ReadonlyMap<string, {
64
+ entity: EntityRef;
65
+ targets: ViewTarget[];
66
+ }>;
67
+ readonly targets: ReadonlyMap<string, {
68
+ target: ViewTarget;
69
+ entities: EntityRef[];
70
+ }>;
71
+ }
72
+ /** Targets that resolve from entities; `unknown` lists the entities that no binding reaches. */
73
+ export interface ResolvedViewTargets {
74
+ targets: ViewTarget[];
75
+ unknown: EntityRef[];
76
+ }
77
+ /** Entities that resolve from targets; `unknown` lists the targets that no binding reaches. */
78
+ export interface ResolvedEntityRefs {
79
+ entities: EntityRef[];
80
+ unknown: ViewTarget[];
81
+ }
82
+ /** The part of `TimelineLoadSegment` that resolution needs. */
83
+ export interface LoadSegmentLike {
84
+ resourceId: string;
85
+ start: number;
86
+ end: number;
87
+ }
88
+ export interface ResolvedLoadTargets<S extends LoadSegmentLike = LoadSegmentLike> {
89
+ /** Current segments that overlap at least one target, in input order, without repeats. */
90
+ segments: S[];
91
+ /** Targets that overlap no current segment. They are never moved to another segment. */
92
+ unknown: LoadViewTarget[];
93
+ }
94
+ /**
95
+ * Builds a two-way index of `bindings`. Repeated identical bindings count once. Throws Error for an empty entity kind
96
+ * or ID or an invalid target, and RangeError for a load range that is not finite or ends before it starts. The input is
97
+ * not modified.
98
+ */
99
+ export declare function buildViewBindingIndex(bindings: readonly ViewBinding[]): ViewBindingIndex;
100
+ /** Returns the targets bound to `entities`, without repeats, in discovery order. Unbound entities are listed in `unknown`. */
101
+ export declare function resolveViewTargets(index: ViewBindingIndex, entities: Iterable<EntityRef>): ResolvedViewTargets;
102
+ /**
103
+ * Returns the entities bound to `targets`, without repeats, in discovery order. A load target matches the bound load
104
+ * targets of the same resource whose range it overlaps. Targets that reach no entity are listed in `unknown`.
105
+ */
106
+ export declare function resolveEntityRefs(index: ViewBindingIndex, targets: Iterable<ViewTarget>): ResolvedEntityRefs;
107
+ /**
108
+ * Finds the current load segments that overlap the given load targets. A target whose range overlaps no current segment
109
+ * of its resource is reported in `unknown`; it is never replaced by another segment, because segment boundaries change
110
+ * whenever load is recalculated. Throws RangeError for an invalid range. The inputs are not modified.
111
+ */
112
+ export declare function resolveLoadTargets<S extends LoadSegmentLike>(segments: readonly S[], targets: Iterable<LoadViewTarget>): ResolvedLoadTargets<S>;
@@ -0,0 +1,255 @@
1
+ import type { TimeRange } from './timeline.js';
2
+ /**
3
+ * Request state for partial (windowed) data loading. The time axis is cut into chunks of `chunkSize` time units
4
+ * starting at `origin`, and each chunk of each row (or each chunk alone, without rows) is a cell with its own status.
5
+ * The application describes what it shows (`WindowedView`), the state plans requests for the cells that are missing,
6
+ * and the application fetches them and reports each result or failure back. Everything here is pure: no timers, no
7
+ * DOM, no Vue. Transitions return a new state together with the requests to start and the request IDs to abort.
8
+ */
9
+ /**
10
+ * Status of one cell (a chunk of one row) or, aggregated, of a window:
11
+ * - `unloaded`: never requested, or its request was aborted, or the data was invalidated.
12
+ * - `loading`: a request for it is in flight.
13
+ * - `loaded-empty`: its request succeeded and returned nothing for it.
14
+ * - `loaded`: its request succeeded and returned at least one item for it.
15
+ * - `failed`: its request failed; it stays failed until `retryWindowedData`.
16
+ */
17
+ export type WindowedCellStatus = 'unloaded' | 'loading' | 'loaded-empty' | 'loaded' | 'failed';
18
+ /**
19
+ * What a view shows: a half-open time window `[start, end)` and, optionally, the IDs of the rows it shows. GanttChart's
20
+ * `visible-window-change` payload (`TimelineVisibleWindow`) is a `WindowedView`. Without `rowIds`, cells are whole
21
+ * chunks (use one mode consistently: cells with and without rows are kept apart).
22
+ */
23
+ export interface WindowedView {
24
+ start: number;
25
+ end: number;
26
+ rowIds?: readonly string[];
27
+ }
28
+ /** The visible window of a GanttChart, reported by its `visible-window-change` event. */
29
+ export interface TimelineVisibleWindow extends WindowedView {
30
+ /** Start of the rendered time window, in the chart's time units. Inside the chart's `range`. */
31
+ start: number;
32
+ /** End (exclusive) of the rendered time window. Inside the chart's `range`; never smaller than `start`. */
33
+ end: number;
34
+ /** IDs of the rendered rows, top to bottom: the displayed rows (after collapsing) in the scrolled row window plus overscan. */
35
+ rowIds: string[];
36
+ /** IDs of every displayed row that has child rows and is expanded, in display order. */
37
+ expandedIds: string[];
38
+ }
39
+ export interface WindowedDataOptions<T, L = never> {
40
+ /** Length of one chunk in time units; requests and cells are aligned to chunks. A positive finite number. Required. */
41
+ chunkSize: number;
42
+ /** Time at which chunk 0 starts. Default 0. Chunk `k` is `[origin + k * chunkSize, origin + (k + 1) * chunkSize)`. */
43
+ origin?: number;
44
+ /** Time units added before and after the view before it is aligned to chunks, so small scrolls do not refetch. Default 0. */
45
+ padding?: number;
46
+ /** Most chunks one request may span. Default Infinity (adjacent chunks with the same missing rows share one request). */
47
+ maxChunksPerRequest?: number;
48
+ /** Most cells one view may need; a larger view throws RangeError. Default 100000. */
49
+ maxCells?: number;
50
+ /** ID of an item. Default `item.id`. */
51
+ itemId?: (item: T) => string;
52
+ /** Row of an item, used to tell `loaded` from `loaded-empty` per row. Default `item.rowId`; undefined counts for every requested row. */
53
+ itemRow?: (item: T) => string | undefined;
54
+ /** Half-open interval of an item, used to tell `loaded` from `loaded-empty` per chunk. Default `item.start` and `item.end`; undefined counts for every requested chunk. */
55
+ itemRange?: (item: T) => TimeRange | undefined;
56
+ /** ID of a link (`WindowedDataPage.links`). Default `link.id`. */
57
+ linkId?: (link: L) => string;
58
+ }
59
+ /** One request the application must fetch. Compare responses by `requestId`; `key` names the data it asks for. */
60
+ export interface WindowedDataRequest {
61
+ /** Unique within one state; a new request for the same data gets a new ID. */
62
+ requestId: string;
63
+ /** Condition, time span and rows of the request, as text. Equal keys ask for the same data. */
64
+ key: string;
65
+ /** The caller's condition or version token the request belongs to (`setWindowedView`). */
66
+ condition: string;
67
+ /** Start of the requested span, aligned to a chunk. */
68
+ start: number;
69
+ /** End (exclusive) of the requested span, aligned to a chunk. Return the items that overlap `[start, end)`. */
70
+ end: number;
71
+ /** The rows to return items for, in view order. Omitted when the view has no `rowIds`. */
72
+ rowIds?: string[];
73
+ }
74
+ /** A response. The load function may also return the items array alone. */
75
+ export interface WindowedDataPage<T, L = never> {
76
+ items: readonly T[];
77
+ /** Links between items (dependencies or edges). Deduplicated by ID like items; see `splitDanglingLinks`. */
78
+ links?: readonly L[];
79
+ }
80
+ export interface WindowedCell {
81
+ status: WindowedCellStatus;
82
+ /** The request in flight for the cell while `loading`. */
83
+ requestId?: string;
84
+ /** The failure while `failed`. */
85
+ error?: unknown;
86
+ }
87
+ /** Options of a state with their defaults applied. */
88
+ export interface WindowedDataNormalizedOptions<T, L = never> {
89
+ chunkSize: number;
90
+ origin: number;
91
+ padding: number;
92
+ maxChunksPerRequest: number;
93
+ maxCells: number;
94
+ itemId: (item: T) => string;
95
+ itemRow: (item: T) => string | undefined;
96
+ itemRange: (item: T) => TimeRange | undefined;
97
+ linkId: (link: L) => string;
98
+ }
99
+ /** A request in flight with the chunks and cells it covers. */
100
+ export interface WindowedInFlightRequest extends WindowedDataRequest {
101
+ /** First and last chunk index of the request. */
102
+ first: number;
103
+ last: number;
104
+ cells: readonly string[];
105
+ }
106
+ export interface WindowedDataState<T, L = never> {
107
+ readonly options: Readonly<WindowedDataNormalizedOptions<T, L>>;
108
+ /** The condition or version token of the current data. */
109
+ readonly condition: string;
110
+ /** The current view, normalized; undefined before the first `setWindowedView`. */
111
+ readonly view?: Readonly<{
112
+ start: number;
113
+ end: number;
114
+ rowIds?: readonly string[];
115
+ }>;
116
+ /** Cells that are not `unloaded`, by cell key. */
117
+ readonly cells: ReadonlyMap<string, Readonly<WindowedCell>>;
118
+ /** Requests in flight, by request ID. */
119
+ readonly requests: ReadonlyMap<string, Readonly<WindowedDataRequest>>;
120
+ /** Every loaded item of the current condition, deduplicated by ID (the latest response wins), in first-arrival order. */
121
+ readonly items: ReadonlyMap<string, T>;
122
+ /** Every loaded link of the current condition, deduplicated by ID. */
123
+ readonly links: ReadonlyMap<string, L>;
124
+ /** Requests issued so far; the next request ID is `String(sequence + 1)`. */
125
+ readonly sequence: number;
126
+ /** @internal In-flight bookkeeping. */
127
+ readonly inflight: ReadonlyMap<string, WindowedInFlightRequest>;
128
+ }
129
+ export interface WindowedDataTransition<T, L = never> {
130
+ state: WindowedDataState<T, L>;
131
+ /** Requests to start now, in time order. */
132
+ start: WindowedDataRequest[];
133
+ /** IDs of requests in flight that are no longer wanted: abort them; their results are ignored. */
134
+ abort: string[];
135
+ }
136
+ export interface WindowedDataSettlement<T, L = never> {
137
+ state: WindowedDataState<T, L>;
138
+ /** False when the request is unknown, aborted or superseded: the result was ignored and `state` is unchanged. */
139
+ applied: boolean;
140
+ }
141
+ /** Status counts of the cells of a window. */
142
+ export interface WindowedCoverage {
143
+ /** Aggregate: `failed` if any cell failed, else `loading`, else `unloaded`, else `loaded` if any cell has items, else `loaded-empty`. */
144
+ status: WindowedCellStatus;
145
+ /**
146
+ * True only when every cell of the window has loaded (with or without items). Partial data can not answer questions
147
+ * about the whole plan: check the coverage of the whole extent, or compute on the server.
148
+ */
149
+ complete: boolean;
150
+ total: number;
151
+ unloaded: number;
152
+ loading: number;
153
+ empty: number;
154
+ loaded: number;
155
+ failed: number;
156
+ }
157
+ /** A fresh state without cells, requests or data. Throws RangeError for invalid options. */
158
+ export declare function createWindowedDataState<T, L = never>(options: WindowedDataOptions<T, L>, condition?: string): WindowedDataState<T, L>;
159
+ /**
160
+ * Sets the view (and optionally the condition) and plans requests for its missing cells. Requests in flight whose cells
161
+ * are all outside the new view are aborted, and their cells become `unloaded` again; a request that still covers some
162
+ * needed cell keeps running. A different `condition` (a filter, a query, a data version) aborts everything and drops all
163
+ * cells, items and links, so results for another condition are never attached. `view` undefined keeps the cells and data
164
+ * but aborts every request. A view with an empty `rowIds` needs no cell: it requests nothing and aborts every request.
165
+ * The work is bounded by `maxCells`. Throws RangeError for a non-finite view, `end < start`, more than `maxCells` cells,
166
+ * or a view so far from `origin` for `chunkSize` that its chunk indices are not safe integers or its chunk boundaries
167
+ * (`origin + k * chunkSize`) are not distinct finite numbers, Error
168
+ * (`Invalid view row ID: <value>`) for a row ID that is not a non-empty string (a repeated row ID is dropped, not an
169
+ * error), and TypeError for a view that is not an object, `rowIds` that is not an array or a condition that is not a
170
+ * string. A throw changes nothing: the given state
171
+ * is still the current one, with its condition, requests and data. To switch the condition even when the new view may be
172
+ * invalid, switch it first without a view (`setWindowedView(state, undefined, condition)`, which never throws for a string
173
+ * condition), apply that transition, and then set the view; `useWindowedData` does this.
174
+ */
175
+ export declare function setWindowedView<T, L = never>(state: WindowedDataState<T, L>, view: WindowedView | undefined, condition?: string): WindowedDataTransition<T, L>;
176
+ /**
177
+ * Applies the response of a request in flight: its items and links are merged into the data by ID (an item that an
178
+ * earlier, overlapping request already returned is replaced, never duplicated), and each of its cells becomes `loaded`
179
+ * or `loaded-empty`. A response is applied only while its request is in flight and belongs to the current condition;
180
+ * the response of an unknown, aborted or superseded request, or of a request of another condition, is ignored
181
+ * (`applied: false`). Throws Error for an item or link without a non-empty string ID or with an ID twice in the response,
182
+ * TypeError for a malformed response, and whatever an accessor throws; every check runs before anything is merged, so the
183
+ * state is then unchanged and nothing of the response is merged (report it with `rejectWindowedRequest`).
184
+ */
185
+ export declare function resolveWindowedRequest<T, L = never>(state: WindowedDataState<T, L>, requestId: string, response: readonly T[] | WindowedDataPage<T, L>): WindowedDataSettlement<T, L>;
186
+ /**
187
+ * Marks the cells of a failed request in flight `failed`. Loaded items and links stay, so what is displayed does not
188
+ * disappear. A failure of an unknown, aborted or superseded request, or of a request of another condition, is ignored
189
+ * (`applied: false`).
190
+ */
191
+ export declare function rejectWindowedRequest<T, L = never>(state: WindowedDataState<T, L>, requestId: string, error: unknown): WindowedDataSettlement<T, L>;
192
+ /**
193
+ * Makes failed cells `unloaded` again (all of them, or only those in `window`) and plans requests for those the
194
+ * current view needs. Loaded data stays.
195
+ */
196
+ export declare function retryWindowedData<T, L = never>(state: WindowedDataState<T, L>, window?: WindowedView): WindowedDataTransition<T, L>;
197
+ /**
198
+ * Aborts every request and makes every cell `unloaded`, keeping the loaded items and links on display, then plans
199
+ * requests for the current view. Use it to refresh after the server data changed; responses replace items by ID. Items
200
+ * that the server deleted stay until the condition changes (`setWindowedView` with a new condition) or `resetWindowedData`.
201
+ */
202
+ export declare function invalidateWindowedData<T, L = never>(state: WindowedDataState<T, L>): WindowedDataTransition<T, L>;
203
+ /** Aborts every request (their cells become `unloaded`) and keeps loaded data and cells. Plans nothing. */
204
+ export declare function cancelWindowedRequests<T, L = never>(state: WindowedDataState<T, L>): WindowedDataTransition<T, L>;
205
+ /** Aborts every request and drops all cells, items and links; keeps the options, condition and view. Plans nothing. */
206
+ export declare function resetWindowedData<T, L = never>(state: WindowedDataState<T, L>): WindowedDataTransition<T, L>;
207
+ /** The status of one cell: the chunk that contains `time`, of `rowId` (omit it for cells without rows). */
208
+ export declare function windowedCellStatus<T, L>(state: WindowedDataState<T, L>, time: number, rowId?: string): WindowedCellStatus;
209
+ /**
210
+ * Status counts of the cells that a window covers, without padding: by default the current view. `complete` is true
211
+ * only when every one of them has loaded. To know whether data is complete for the whole plan, pass its whole extent
212
+ * (its range and every row ID). The window is not limited by `maxCells`: `total` is computed from the chunk and row
213
+ * counts and `unloaded` is what the recorded cells leave, so the work is bounded by the smaller of the window's cell
214
+ * count and the number of recorded cells, never by the width of the window alone. Throws like `setWindowedView` for an
215
+ * invalid window, and RangeError when its chunk indices are not safe integers or its cell count exceeds
216
+ * `Number.MAX_SAFE_INTEGER`.
217
+ */
218
+ export declare function windowedCoverage<T, L>(state: WindowedDataState<T, L>, window?: WindowedView | undefined): WindowedCoverage;
219
+ /** A link with an end that is not loaded. */
220
+ export interface DanglingLink<L> {
221
+ link: L;
222
+ /** The IDs of its ends that are not present, `from` first. */
223
+ missingIds: string[];
224
+ }
225
+ export interface SplitDanglingLinksOptions<L> {
226
+ /** Source end of a link. Default `link.from`. */
227
+ from?: (link: L) => string;
228
+ /** Target end of a link. Default `link.to`. */
229
+ to?: (link: L) => string;
230
+ }
231
+ export interface SplitDanglingLinks<L> {
232
+ /** Links whose both ends are present, in input order: safe to pass to GanttChart `dependencies` or NetworkGraph `edges`. */
233
+ resolved: L[];
234
+ /** Links with a missing end, in input order. Keep them; they resolve when the missing item arrives. */
235
+ dangling: DanglingLink<L>[];
236
+ }
237
+ /**
238
+ * Splits links between loaded items into those whose both ends are present and those that point to an item that is not
239
+ * loaded (yet). The components throw for links to unknown items, so pass only `resolved` to them. Call it again with the
240
+ * new set of present IDs after more data arrives: a dangling link whose missing end has arrived moves to `resolved`.
241
+ * `present` is a set of item IDs (or anything with `has`, such as a Map by ID) or any iterable of them. The inputs are not modified.
242
+ * The ends are not validated: an end that is not a present ID (`undefined`, a number, `''`) is simply missing, so the link
243
+ * is dangling and `missingIds` holds the value as returned; a link is `resolved` only when both ends are present. A
244
+ * `from` or `to` accessor that throws makes the call throw; nothing is caught here (`useWindowedData` reports it
245
+ * through its `error`).
246
+ */
247
+ export declare function splitDanglingLinks<L extends {
248
+ from: string;
249
+ to: string;
250
+ }>(links: readonly L[], present: {
251
+ has(id: string): boolean;
252
+ } | Iterable<string>, options?: SplitDanglingLinksOptions<L>): SplitDanglingLinks<L>;
253
+ export declare function splitDanglingLinks<L>(links: readonly L[], present: {
254
+ has(id: string): boolean;
255
+ } | Iterable<string>, options: Required<SplitDanglingLinksOptions<L>>): SplitDanglingLinks<L>;
@@ -0,0 +1,41 @@
1
+ import type { TimeRange } from './timeline.js';
2
+ export interface WorkCalendar {
3
+ id: string;
4
+ periods: readonly TimeRange[];
5
+ }
6
+ export interface WorkShift {
7
+ startMinute: number;
8
+ endMinute: number;
9
+ }
10
+ export interface WeeklyShift extends WorkShift {
11
+ weekday: number;
12
+ }
13
+ export interface WorkWeek {
14
+ weekly: readonly WeeklyShift[];
15
+ utcOffsetMinutes?: number;
16
+ /**
17
+ * IANA time zone such as `Europe/Berlin`. Shift minutes are then local wall-clock times,
18
+ * resolved with daylight-saving rules. Cannot be combined with `utcOffsetMinutes`.
19
+ */
20
+ timeZone?: string;
21
+ exceptions?: Readonly<Record<string, readonly WorkShift[]>>;
22
+ }
23
+ /** The largest fixed UTC offset, in minutes, accepted by `buildWorkPeriods`, `calendarBands` and `toMsProjectXml`. */
24
+ export declare const maxUtcOffsetMinutes: number;
25
+ export declare function assertScheduleRange(range: TimeRange): void;
26
+ /** The RangeError text of a scheduling period without safe integer endpoints and positive length. */
27
+ export declare const integerPeriodMessage = "Working periods must have finite integer endpoints and positive length";
28
+ /** Clip, sort and unite half-open working periods without modifying the inputs. */
29
+ export declare function normalizeWorkPeriods(periods: readonly TimeRange[], range: TimeRange): TimeRange[];
30
+ /**
31
+ * The sorted half-open gaps between working periods inside `range`, for example the non-working time to shade on a
32
+ * chart. The periods are clipped, sorted and merged first, so they may be unsorted, overlapping or touching. Unlike
33
+ * `normalizeWorkPeriods`, endpoints only need to be finite, so any numeric unit works, including fractions.
34
+ */
35
+ export declare function invertWorkPeriods(periods: readonly TimeRange[], range: TimeRange): TimeRange[];
36
+ /**
37
+ * Build epoch-millisecond periods for a weekly calendar in a fixed UTC offset or an IANA time zone.
38
+ * With `timeZone`, shift minutes are local wall-clock times: a shift that crosses a daylight-saving
39
+ * transition gains or loses the difference.
40
+ */
41
+ export declare function buildWorkPeriods(range: TimeRange, week: WorkWeek): TimeRange[];
@@ -0,0 +1,33 @@
1
+ import type { TimeRange, TimeScale } from './timeline.js';
2
+ /** The default share of the working-time width that non-working time keeps. */
3
+ export declare const defaultNonWorkingRatio = 0.1;
4
+ /**
5
+ * A piecewise-linear `TimeScale` that gives working time `pixelsPerUnit` pixels per time unit and non-working time
6
+ * `pixelsPerUnit * nonWorkingRatio`. Use it as the `scale` prop of GanttChart so working hours get more room.
7
+ *
8
+ * - `periods` are half-open `[start, end)` working periods, as `buildWorkPeriods` returns them. They are clipped to
9
+ * `range`, and they may be unsorted, overlapping or touching: they are sorted and united. Periods outside the
10
+ * range are ignored. Endpoints must be finite with positive length (`RangeError` otherwise).
11
+ * - `nonWorkingRatio` is a fraction in `(0, 1]`, default 0.1. It cannot be 0: a collapsed interval would map many times
12
+ * to one pixel, so `toTime` could not invert `toX`. A ratio of 1 gives a plain linear scale.
13
+ * - With no working period inside the range the whole range is non-working, so the scale is linear at
14
+ * `pixelsPerUnit * nonWorkingRatio`.
15
+ * - Outside `range` the scale extrapolates linearly with the slope of the nearest edge segment, so `toX` and `toTime`
16
+ * stay strictly increasing and mutually inverse for drags past either edge. `toX(range.start)` is 0 and
17
+ * `toX(range.end)` is `width`.
18
+ *
19
+ * Both mappings binary-search precomputed breakpoints, so a call costs O(log n) for n periods. The round trip is exact
20
+ * at segment boundaries and within floating-point rounding elsewhere. Changing the ratio or `pixelsPerUnit` changes
21
+ * only x positions, never times. The scale does not depend on text direction; GanttChart positions from the inline
22
+ * start edge in right-to-left charts.
23
+ */
24
+ export declare function createWorkingTimeScale(range: TimeRange, periods: readonly TimeRange[], pixelsPerUnit: number, nonWorkingRatio?: number): TimeScale;
25
+ /**
26
+ * Which tick labels have room on a possibly non-linear scale (internal; GanttChart and renderTimelineSvg share it).
27
+ * A label sits after its tick and is shown when the next tick (`tick + step`) is at least `gap` pixels further on; the
28
+ * closing label at `end` sits before its tick and is shown when the previous tick is at least `gap` pixels back. On a
29
+ * linear scale whose step keeps ticks `gap` apart every label is shown; where a working-time scale squeezes ticks
30
+ * together, the squeezed labels are left out, so labels never overlap. The answer for a tick depends only on its
31
+ * neighbours, so it does not change while the chart scrolls.
32
+ */
33
+ export declare function tickLabelsWithRoom(ticks: readonly number[], toX: (time: number) => number, step: number, end: number, gap?: number): boolean[];
@@ -0,0 +1,52 @@
1
+ import type { ComponentPublicInstance, DefineComponent } from 'vue';
2
+ import NetworkGraphVue from './components/NetworkGraph.vue.js';
3
+ import GanttChartVue from './components/GanttChart.vue.js';
4
+ import type { GraphEdge } from './core/graph.js';
5
+ import type { NetworkGroup, NetworkNode, TimelineBar, TimelineRow } from './core/types.js';
6
+ type SfcContext<F extends (...args: any) => any> = NonNullable<ReturnType<F>['__ctx']>;
7
+ type SfcExposed<F extends (...args: any) => any> = Parameters<SfcContext<F>['expose']>[0];
8
+ type SfcInstance<F extends (...args: any) => any> = Omit<ComponentPublicInstance, '$props' | '$slots' | '$emit'> & {
9
+ $props: SfcContext<F>['props'];
10
+ $slots: SfcContext<F>['slots'];
11
+ $emit: SfcContext<F>['emit'];
12
+ } & SfcExposed<F>;
13
+ type SfcDefaultComponent<F extends (...args: any) => any> = new (props: SfcContext<F>['props']) => InstanceType<DefineComponent<SfcContext<F>['props'], SfcExposed<F>>> & {
14
+ $slots: SfcContext<F>['slots'];
15
+ };
16
+ type NetworkGraphSfc<N extends NetworkNode, E extends GraphEdge, G extends NetworkGroup> = typeof NetworkGraphVue<N, E, G>;
17
+ type GanttChartSfc<R extends TimelineRow, B extends TimelineBar> = typeof GanttChartVue<R, B>;
18
+ /**
19
+ * Methods that NetworkGraph exposes on its template ref. `N`, `E` and `G` are the node, edge and group types of the
20
+ * graph; use the same types as its props, for example `ref<NetworkGraphExposed<MyNode, MyEdge>>()`.
21
+ */
22
+ export type NetworkGraphExposed<N extends NetworkNode = NetworkNode, E extends GraphEdge = GraphEdge, G extends NetworkGroup = never> = SfcExposed<NetworkGraphSfc<N, E, G>>;
23
+ /** Methods that GanttChart exposes on its template ref. `R` and `B` are the row and bar types of the chart. */
24
+ export type GanttChartExposed<R extends TimelineRow = TimelineRow, B extends TimelineBar = TimelineBar> = SfcExposed<GanttChartSfc<R, B>>;
25
+ /**
26
+ * The type of the `NetworkGraph` component. In a template, the node, edge and group types are inferred from the
27
+ * `nodes`, `edges` and `groups` props.
28
+ */
29
+ export type NetworkGraphComponent = (new <N extends NetworkNode = NetworkNode, E extends GraphEdge = GraphEdge, G extends NetworkGroup = never>(props: {
30
+ nodes: readonly N[];
31
+ edges: readonly E[];
32
+ groups?: readonly G[];
33
+ } & Record<string, unknown>) => SfcInstance<NetworkGraphSfc<N & NetworkNode, E & GraphEdge, G>>) & SfcDefaultComponent<NetworkGraphSfc<NetworkNode, GraphEdge, NetworkGroup>>;
34
+ /** The type of the `GanttChart` component. In a template, the row and bar types are inferred from `rows` and `bars`. */
35
+ export type GanttChartComponent = (new <R extends TimelineRow = TimelineRow, B extends TimelineBar = TimelineBar>(props: {
36
+ rows: readonly R[];
37
+ bars: readonly B[];
38
+ } & Record<string, unknown>) => SfcInstance<GanttChartSfc<R & TimelineRow, B & TimelineBar>>) & SfcDefaultComponent<GanttChartSfc<TimelineRow, TimelineBar>>;
39
+ export declare const NetworkGraph: NetworkGraphComponent;
40
+ export declare const GanttChart: GanttChartComponent;
41
+ export type { GraphDrop, TimelineDrop } from './components/types.js';
42
+ export * from './core/index.js';
43
+ export { useEditHistory } from './composables/useEditHistory.js';
44
+ export { useTimelineView } from './composables/useTimelineView.js';
45
+ export { useEditTransaction } from './composables/useEditTransaction.js';
46
+ export type { UseEditTransactionOptions, HistoryReset } from './composables/useEditTransaction.js';
47
+ export { useLinkedSelection, revealLinkedTarget } from './composables/useLinkedSelection.js';
48
+ export type { LinkedGraphSets, LinkedLoadSets, LinkedTimelineSets, LinkedViewName, UseLinkedSelectionOptions, RevealLinkedTargetOptions, LinkedRevealResult, LinkedTimeRange, } from './composables/useLinkedSelection.js';
49
+ export { useAsyncGraphLayout, graphLayoutWorkerAdapter } from './composables/useAsyncGraphLayout.js';
50
+ export type { AsyncGraphLayoutAdapter, AsyncGraphFrame, AsyncGraphDisplayFrame, AsyncGraphLayoutError, UseAsyncGraphLayoutOptions, AsyncGraphLayout, AsyncGraphGestureListeners, GraphLayoutWorkerPort, GraphLayoutWorkerAdapterOptions, } from './composables/useAsyncGraphLayout.js';
51
+ export { useWindowedData } from './composables/useWindowedData.js';
52
+ export type { UseWindowedDataOptions, WindowedData, WindowedDataLoader, WindowedDataError } from './composables/useWindowedData.js';