tachlon 0.0.1 → 0.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 (44) hide show
  1. package/README.md +154 -3
  2. package/dist-lib/LiberationMono-Regular.woff2 +0 -0
  3. package/dist-lib/LiberationSans-Bold.woff2 +0 -0
  4. package/dist-lib/LiberationSans-Regular.woff2 +0 -0
  5. package/dist-lib/adapters/validate.js +159 -0
  6. package/dist-lib/app_bg.wasm +0 -0
  7. package/dist-lib/cli/args.js +36 -0
  8. package/dist-lib/cli/csp.js +68 -0
  9. package/dist-lib/cli/detect.js +86 -0
  10. package/dist-lib/cli/doctor.js +205 -0
  11. package/dist-lib/cli/gpu.js +66 -0
  12. package/dist-lib/cli/init.js +103 -0
  13. package/dist-lib/cli/main.js +7 -0
  14. package/dist-lib/cli/probe.js +35 -0
  15. package/dist-lib/cli/run.js +92 -0
  16. package/dist-lib/cli/template.js +52 -0
  17. package/dist-lib/engine-size.json +1 -0
  18. package/dist-lib/errors.js +44 -0
  19. package/dist-lib/gantt.css +2 -0
  20. package/dist-lib/product.js +4 -0
  21. package/dist-lib/react.js +75 -0
  22. package/dist-lib/schema.json +38 -0
  23. package/dist-lib/src-CTpvK70m.js +7212 -0
  24. package/dist-lib/tachlon.js +1 -0
  25. package/dist-lib/types/adapters/bryntum.d.ts +68 -0
  26. package/dist-lib/types/adapters/dhtmlx.d.ts +96 -0
  27. package/dist-lib/types/adapters/index.d.ts +7 -0
  28. package/dist-lib/types/adapters/plain.d.ts +35 -0
  29. package/dist-lib/types/adapters/validate.d.ts +26 -0
  30. package/dist-lib/types/api.d.ts +207 -0
  31. package/dist-lib/types/commands.d.ts +76 -0
  32. package/dist-lib/types/document.d.ts +59 -0
  33. package/dist-lib/types/edit-result.d.ts +51 -0
  34. package/dist-lib/types/errors.d.ts +33 -0
  35. package/dist-lib/types/events.d.ts +80 -0
  36. package/dist-lib/types/filter-names.d.ts +5 -0
  37. package/dist-lib/types/index.d.ts +92 -0
  38. package/dist-lib/types/mount-load.d.ts +30 -0
  39. package/dist-lib/types/open-schedule.d.ts +81 -0
  40. package/dist-lib/types/product.d.ts +2 -0
  41. package/dist-lib/types/react.d.ts +32 -0
  42. package/dist-lib/types/set-filter.d.ts +20 -0
  43. package/dist-lib/types/view-state.d.ts +95 -0
  44. package/package.json +61 -5
@@ -0,0 +1 @@
1
+ export { r as MountError, a as PRODUCT_NAME, s as PlainDataError, n as fromBryntum, l as fromDhtmlx, o as fromTasks, t as mount, i as preloadEngine, c as validate } from "./src-CTpvK70m.js";
@@ -0,0 +1,68 @@
1
+ /** One task of the document, in the shape `App.save` writes (version 1). */
2
+ export interface DocumentTask {
3
+ /** Working minutes of the task's calendar. */
4
+ duration: number;
5
+ calendar: number;
6
+ /** Earliest start, minutes from the origin Monday 00:00; null for none. */
7
+ snet: number | null;
8
+ actual_start: number | null;
9
+ actual_finish: number | null;
10
+ remaining: number | null;
11
+ name: string;
12
+ /** The index in `tasks` of the parent, or null for a top-level task. */
13
+ parent: number | null;
14
+ /** 1 for a top-level task. */
15
+ outline_level: number;
16
+ code: string | null;
17
+ wbs_code: string | null;
18
+ activity_codes: [string, string][];
19
+ /** Percent complete, 0 to 100. */
20
+ progress: number;
21
+ }
22
+ /** One link of the document, between two indexes of `tasks`. */
23
+ export interface DocumentLink {
24
+ pred: number;
25
+ succ: number;
26
+ kind: "FS" | "SS" | "FF" | "SF";
27
+ /** Working minutes; negative for a lead. */
28
+ lag: number;
29
+ lag_calendar: null;
30
+ }
31
+ /** The document (version 1) with the keys the adapter fills; `Gantt.load({ document })` takes it. */
32
+ export interface ScheduleDocument {
33
+ format: "gantt";
34
+ version: 1;
35
+ name: string;
36
+ /** Days from 1970-01-01 to the Monday that is instant 0. */
37
+ origin: number;
38
+ data_date: null;
39
+ lag_calendar: "successor";
40
+ calendars: {
41
+ week: [number, number][][];
42
+ exceptions: [];
43
+ }[];
44
+ tasks: DocumentTask[];
45
+ links: DocumentLink[];
46
+ baseline: null;
47
+ view: {
48
+ collapsed: [];
49
+ };
50
+ /** The lines of `leftOut`, which the chart shows as its import notes. */
51
+ notes: string[];
52
+ source: null;
53
+ }
54
+ /** What `fromBryntum` returns: the document and one line for each thing in the data it could not carry, or why there is no document. */
55
+ export type BryntumResult = {
56
+ ok: true;
57
+ document: ScheduleDocument;
58
+ leftOut: string[];
59
+ } | {
60
+ ok: false;
61
+ error: string;
62
+ };
63
+ /**
64
+ * Read Bryntum Gantt data into the document. `data` is what a Bryntum project loads: `{ tasks, dependencies }`, each
65
+ * a `{ rows: [...] }` store or an array (`tasksData` and `dependenciesData` are read too). A task is nested under its
66
+ * `children` or tied to its parent by `parentId`. Never throws: data with no task list gives `{ ok: false, error }`.
67
+ */
68
+ export declare function fromBryntum(data: unknown): BryntumResult;
@@ -0,0 +1,96 @@
1
+ /** A task of DHTMLX data. Only the fields named here are read; any other field is listed in `leftOut`. */
2
+ export interface DhtmlxTask {
3
+ id: string | number;
4
+ text?: string;
5
+ start_date?: string;
6
+ end_date?: string;
7
+ duration?: number | string;
8
+ progress?: number | string;
9
+ parent?: string | number;
10
+ type?: string;
11
+ [field: string]: unknown;
12
+ }
13
+ /** A link of DHTMLX data: `type` is `"0"` finish to start, `"1"` start to start, `"2"` finish to finish, `"3"` start to finish. */
14
+ export interface DhtmlxLink {
15
+ id?: string | number;
16
+ source: string | number;
17
+ target: string | number;
18
+ type?: string | number;
19
+ lag?: number | string;
20
+ [field: string]: unknown;
21
+ }
22
+ /** The JSON DHTMLX Gantt loads: the tasks and the links. */
23
+ export interface DhtmlxData {
24
+ data: DhtmlxTask[];
25
+ links?: DhtmlxLink[];
26
+ }
27
+ /** What `fromDhtmlx` takes beside the data. */
28
+ export interface DhtmlxOptions {
29
+ /** The schedule's name. Default `untitled`. */
30
+ name?: string;
31
+ /** The unit of the data's `duration` and `lag` (DHTMLX `duration_unit`): `day` (default) is a working day of 8 hours, `hour` an hour. */
32
+ durationUnit?: "day" | "hour";
33
+ /** The word the `leftOut` lines open with, naming where the data came from. Default `DHTMLX`. */
34
+ label?: string;
35
+ }
36
+ /** A task of the document. */
37
+ export interface DocumentTask {
38
+ duration: number;
39
+ calendar: number;
40
+ snet: number | null;
41
+ actual_start: null;
42
+ actual_finish: null;
43
+ remaining: null;
44
+ name: string;
45
+ parent: number | null;
46
+ outline_level: number;
47
+ code: string | null;
48
+ wbs_code: null;
49
+ activity_codes: [];
50
+ progress: number;
51
+ }
52
+ /** A link of the document. */
53
+ export interface DocumentLink {
54
+ pred: number;
55
+ succ: number;
56
+ kind: "FS" | "SS" | "FF" | "SF";
57
+ lag: number;
58
+ lag_calendar: null;
59
+ }
60
+ /** The document v1 that `fromDhtmlx` writes: keys in the order the writer uses. */
61
+ export interface ScheduleDocument {
62
+ format: "gantt";
63
+ version: 1;
64
+ name: string;
65
+ origin: number;
66
+ data_date: null;
67
+ lag_calendar: "successor";
68
+ calendars: {
69
+ week: [number, number][][];
70
+ exceptions: [];
71
+ }[];
72
+ tasks: DocumentTask[];
73
+ links: DocumentLink[];
74
+ baseline: null;
75
+ view: {
76
+ collapsed: [];
77
+ };
78
+ notes: string[];
79
+ source: null;
80
+ }
81
+ /** What `fromDhtmlx` returns: the document, and one line for each thing of the data it did not carry over (also in `document.notes`). */
82
+ export interface DhtmlxResult {
83
+ document: ScheduleDocument;
84
+ leftOut: string[];
85
+ }
86
+ export declare const DAY = 1440;
87
+ export declare const WORKING_DAY = 480;
88
+ /** Working time of the one calendar: Monday to Friday, 08:00 to 12:00 and 13:00 to 17:00. */
89
+ export declare const WORKING_WEEK: [number, number][][];
90
+ /** Minutes since 1970-01-01 00:00 of the wall-clock time `text` names, or null. Reads `YYYY-MM-DD[ T]HH:mm[:ss]` (a trailing `Z` is not converted) and `DD-MM-YYYY[ HH:mm]`. */
91
+ export declare function minutesOf(text: string): number | null;
92
+ /** The `leftOut` lines for the unread fields in `counts` (field to the number of items that carry it), by field name. */
93
+ export declare function unreadLines(counts: Map<string, number>, what: string, label: string): string[];
94
+ export declare function plural(count: number, one: string, many: string): string;
95
+ /** Read DHTMLX Gantt JSON into a document v1. Throws an `Error` whose message names the task or link it could not read. */
96
+ export declare function fromDhtmlx(source: unknown, options?: DhtmlxOptions): DhtmlxResult;
@@ -0,0 +1,7 @@
1
+ export { fromDhtmlx } from "./dhtmlx.js";
2
+ export type { DhtmlxOptions, DhtmlxResult } from "./dhtmlx.js";
3
+ export { fromTasks } from "./plain.js";
4
+ export type { PlainLink, PlainOptions, PlainResult, PlainTask } from "./plain.js";
5
+ export { PlainDataError, validate } from "./validate.js";
6
+ export type { PlainIssue, PlainValidation } from "./validate.js";
7
+ export { fromBryntum, type BryntumResult, type ScheduleDocument } from "./bryntum.js";
@@ -0,0 +1,35 @@
1
+ import { type ScheduleDocument } from "./dhtmlx.ts";
2
+ /** A task: `start` and `end` are `YYYY-MM-DD[THH:mm]`, `duration` is in working days, `progress` 0 to 100. A task with children is a summary that takes its dates from them. */
3
+ export interface PlainTask {
4
+ id: string | number;
5
+ name: string;
6
+ start: string;
7
+ end?: string;
8
+ duration?: number;
9
+ parent?: string | number;
10
+ progress?: number;
11
+ [field: string]: unknown;
12
+ }
13
+ /** A link from one task to another: `type` defaults to `FS` (finish to start), `lag` is in working days. */
14
+ export interface PlainLink {
15
+ from: string | number;
16
+ to: string | number;
17
+ type?: "FS" | "SS" | "FF" | "SF";
18
+ lag?: number;
19
+ [field: string]: unknown;
20
+ }
21
+ /** What `fromTasks` takes beside the data. */
22
+ export interface PlainOptions {
23
+ /** The schedule's name. Default `untitled`. */
24
+ name?: string;
25
+ }
26
+ /** What `fromTasks` returns: the document, and one line for each thing of the data it did not carry over (also in `document.notes`). */
27
+ export interface PlainResult {
28
+ document: ScheduleDocument;
29
+ leftOut: string[];
30
+ }
31
+ /** Read plain tasks and links into a document v1. Throws a `PlainDataError` that lists every problem (see `validate`) before it reads anything. */
32
+ export declare function fromTasks(data: {
33
+ tasks: PlainTask[];
34
+ links?: PlainLink[];
35
+ }, options?: PlainOptions): PlainResult;
@@ -0,0 +1,26 @@
1
+ /** One problem: `path` is like `tasks[0].start`; `fix` is a sentence a person or an assistant can act on. */
2
+ export interface PlainIssue {
3
+ path: string;
4
+ expected: string;
5
+ got: string;
6
+ fix: string;
7
+ }
8
+ /** What `validate` returns: `{ ok: true }`, or every problem, up to 50. */
9
+ export type PlainValidation = {
10
+ ok: true;
11
+ } | {
12
+ ok: false;
13
+ issues: PlainIssue[];
14
+ };
15
+ /** What `fromTasks` throws for data `validate` refuses; `issues` is the list, `message` is the list as lines. */
16
+ export declare class PlainDataError extends Error {
17
+ readonly issues: PlainIssue[];
18
+ constructor(issues: PlainIssue[]);
19
+ }
20
+ /** Check plain task data and name every problem, up to 50. */
21
+ export declare function validate(data: unknown): PlainValidation;
22
+ /** `validate`'s one walk of the data: the problems, and the index of each task by `String(id)` for the reader to use. */
23
+ export declare function inspect(data: unknown): {
24
+ issues: PlainIssue[];
25
+ ids: Map<string, number>;
26
+ };
@@ -0,0 +1,207 @@
1
+ import type { ZoomLevel } from "./view-state.js";
2
+ /** What `App.status()` returns. */
3
+ export interface Status {
4
+ backend: string;
5
+ /** Total task count, including tasks hidden by collapsed summaries. */
6
+ n: number;
7
+ /** Number of visible task rows. */
8
+ rowCount: number;
9
+ /** The leaf tasks the row filter and the lookahead window keep (collapse does not change it), or null while neither is on. */
10
+ keptLeaves: number | null;
11
+ /** Whether the critical-only filter is on. */
12
+ criticalOnly: boolean;
13
+ /** Whether the longest-path filter is on. */
14
+ longestPath: boolean;
15
+ filter: "off" | "critical" | "longest" | "slipped" | "joined" | "left" | "code" | "moved" | "near" | "status" | "float";
16
+ /** The lookahead window: `start` as `YYYY-MM-DD`. When `on` is false these are the defaults a reader gets (the data date's day, 3 weeks). */
17
+ lookahead: {
18
+ on: boolean;
19
+ start: string;
20
+ weeks: number;
21
+ };
22
+ rows: [number, number];
23
+ t: [number, number];
24
+ from: string;
25
+ to: string;
26
+ /** The time axis's unit at the current zoom (`timeline::Level::name`). */
27
+ level: ZoomLevel;
28
+ pxPerMinute: number;
29
+ scrollY: number;
30
+ rowHeight: number;
31
+ axisHeight: number;
32
+ bars: number;
33
+ criticalBars: number;
34
+ /** Dependency arrows drawn this frame. */
35
+ arrows: number;
36
+ /** Non-working-day columns drawn this frame. */
37
+ shaded: number;
38
+ /** The file's data date in minutes from the origin Monday, or null if it has none. */
39
+ dataDate: number | null;
40
+ /** x of the data-date line on the canvas in CSS pixels, or null when it is not drawn. */
41
+ dataDateX: number | null;
42
+ /** Counts the changes the schedule has had; a drag that ends where it began leaves it as it was. */
43
+ revision: number;
44
+ /** Counts the solutions shown, restores included; the table redraws its rows when it moves. */
45
+ stamp: number;
46
+ /** Counts the files opened in place; the shell resets what it keeps for the old schedule when it moves. */
47
+ epoch: number;
48
+ frames: number;
49
+ surface: [number, number];
50
+ hover: Hover | null;
51
+ /** The row the canvas draws as hovered: under its own pointer, else the one `set_hover_row` named; null if none. */
52
+ hoverRow: number | null;
53
+ drag: Drag | null;
54
+ selected: Selected | null;
55
+ /** The range selection as table rows `[first, last, extent]`: `first` to `last` inclusive, `extent` the end that moves; null with no range. */
56
+ range: [number, number, number] | null;
57
+ link: Link;
58
+ /** How the schedule differs from the baseline, or null with no baseline set. */
59
+ baseline: BaselineSummary | null;
60
+ /** The report of the last edit or drag release that moved other tasks, or null. */
61
+ moved: Moved | null;
62
+ /** The slide of the bars after an edit: whether one runs, and how long its copy took. */
63
+ slide: SlideStatus;
64
+ /** The nearest work before and after the window, as short dates, when no visible row has work in it; else null. */
65
+ offscreen: {
66
+ b: string | null;
67
+ a: string | null;
68
+ } | null;
69
+ }
70
+ /** The slide of the bars to their new places after an edit. */
71
+ export interface SlideStatus {
72
+ /** True while a slide runs. Never true while the page asked for reduced motion. */
73
+ active: boolean;
74
+ /** How long the copy of the last slide took, in milliseconds; null before the first slide. It stays after the slide ends. */
75
+ copyMs: number | null;
76
+ }
77
+ /** How the schedule differs from the baseline, as counts. A task counts only if it is live now and was live in the baseline, except `added` and `removed`. */
78
+ export interface BaselineSummary {
79
+ /** Tasks whose early finish is later than the baseline's. */
80
+ slipped: number;
81
+ /** Calendar days the project finish moved; negative when earlier. */
82
+ finish_days: number;
83
+ /** Tasks that have zero float now and had some in the baseline. */
84
+ joined: number;
85
+ /** Tasks that had zero float in the baseline and have some now. */
86
+ left: number;
87
+ /** Live tasks the baseline has no entry for (inserted since). */
88
+ added: number;
89
+ /** Tasks the baseline holds that are deleted now. */
90
+ removed: number;
91
+ }
92
+ /** What an edit or a drag moved besides the edited task. */
93
+ export interface Moved {
94
+ /** Counts reports, so a new one differs from the one already shown. */
95
+ seq: number;
96
+ /** For example `8 tasks moved · finish +7 days`. */
97
+ text: string;
98
+ /** Tasks other than the edited one whose early start or finish changed. */
99
+ others: number;
100
+ /** Calendar days the project finish moved; negative when earlier. */
101
+ finish_days: number;
102
+ /** 1 while the report is fully shown, then falls to 0 as it fades. */
103
+ alpha: number;
104
+ /** True for an edit, false for a drag release whose bars are already where the pointer left them. */
105
+ slide: boolean;
106
+ }
107
+ /** The selected link, the link drag in progress, and why the last link drag added nothing. */
108
+ export interface Link {
109
+ /** The selected link's id (a dependency slot), or null. */
110
+ selected: number | null;
111
+ /** A link drag that has moved past the threshold, or null. */
112
+ drag: LinkDrag | null;
113
+ /** The message the last link drag was refused with, until the next press; null if it was not refused. */
114
+ refusal: string | null;
115
+ /** A calm note about a bar drag that moved nothing (a finished task), until the next press; null if none. */
116
+ note: string | null;
117
+ }
118
+ /** A link drag in progress, from the bar of task `pred`. */
119
+ export interface LinkDrag {
120
+ pred: number;
121
+ /** The task under the pointer, or null. */
122
+ target: number | null;
123
+ /** The message a release on `target` would be refused with (a summary, a repeat or a loop), or null. */
124
+ refused: string | null;
125
+ }
126
+ /** A selected task and counts for its driving path. */
127
+ export interface Selected {
128
+ /** The selected task. */
129
+ task: number;
130
+ /** The selected task's timeline row. */
131
+ row: number;
132
+ /** Number of driving predecessors retained. */
133
+ backCount: number;
134
+ /** Number of driven successors retained. */
135
+ forwardCount: number;
136
+ /** More driving predecessors exist than were retained. */
137
+ backCapped: boolean;
138
+ /** More driven successors exist than were retained. */
139
+ forwardCapped: boolean;
140
+ }
141
+ /** The last bar drag's result. */
142
+ export interface Drag {
143
+ task: number;
144
+ /**
145
+ * First admissible start at or after where the pointer asked, minutes. A
146
+ * task starts on a working instant; a milestone may also start at the end
147
+ * of a working period.
148
+ */
149
+ wanted: number;
150
+ /** Start the schedule gave, minutes. */
151
+ es: number;
152
+ /** Predecessors hold the task later than the pointer asks. */
153
+ held: boolean;
154
+ recomputeMs: number;
155
+ /** The drag is still in progress. */
156
+ active: boolean;
157
+ }
158
+ /** The task under the pointer. */
159
+ export interface Hover {
160
+ task: number;
161
+ es: number;
162
+ ef: number;
163
+ float?: number;
164
+ critical: boolean;
165
+ summary?: true;
166
+ }
167
+ /** What `App.task_details()` returns for a scheduled task. */
168
+ export interface TaskDetails {
169
+ task: number;
170
+ name: string;
171
+ outlinePath: string;
172
+ /** The activity ID; empty when the task has none. */
173
+ activityId: string;
174
+ /** `Not started`, `In progress` or `Complete`. */
175
+ status: string;
176
+ /** Empty until set. */
177
+ actualStart: string;
178
+ /** Empty until set. */
179
+ actualFinish: string;
180
+ /** Empty for work not started. */
181
+ percentComplete: string;
182
+ start: string;
183
+ finish: string;
184
+ lateStart: string;
185
+ lateFinish: string;
186
+ floatMinutes: number;
187
+ floatDays: number;
188
+ floatHours: number;
189
+ floatRemMinutes: number;
190
+ floatText: string;
191
+ critical: boolean;
192
+ summary?: boolean;
193
+ predecessorCount: number;
194
+ predecessors: string[];
195
+ successorCount: number;
196
+ successors: string[];
197
+ /** The baseline's start date. Written for a leaf with a baseline entry, unless the baseline's date is before the origin. */
198
+ baselineStart?: string;
199
+ /** The baseline's finish date; written as `baselineStart` is. */
200
+ baselineFinish?: string;
201
+ /** The start and finish variance in working days (`+5d`, `-2d`, `0`), each null when the baseline's date is before the origin. Written for a leaf with a baseline entry. */
202
+ baselineVariance?: [string | null, string | null];
203
+ }
204
+ /** One table row from `App.table_rows`: task, start, finish, float, critical, and kind (leaf 0, expanded summary 1, collapsed summary 2), then the Start, Finish and Float variance against the baseline as signed working-day text (`+5d`, `-2d`, `0`), or null for a summary, a task the baseline lacks, a session with no baseline, a baseline from a file with no float (the Float cell) or with a date before the origin (that Start or Finish cell) and while a bar is dragged. Duration is read separately. */
205
+ export type TableRow = [number, string, string, number | null, boolean, 0 | 1 | 2, string | null, string | null, string | null];
206
+ /** What `App.print_pages(title, printed_on, page_size?)` returns, where the optional `page_size` is `"letter"` (the default) or `"a4"`: one SVG document per printed page, in page order, at least one. */
207
+ export type PrintPages = string[];
@@ -0,0 +1,76 @@
1
+ import { type Filter } from "./set-filter.js";
2
+ import { type CompareResult, type EditResult, type LinkResult, type RowResult } from "./edit-result.js";
3
+ /** Where `scrollTo` goes: a task's row, or a day (`YYYY-MM-DD`). */
4
+ export type ScrollTarget = {
5
+ task: number;
6
+ } | {
7
+ date: string;
8
+ };
9
+ /** What a host page may call to drive the chart. After `Gantt.destroy()` every method does nothing and returns undefined; none throws. */
10
+ export interface Commands {
11
+ /** Zoom in one step about the middle of the chart. */
12
+ zoomIn(): void;
13
+ /** Zoom out one step about the middle of the chart. */
14
+ zoomOut(): void;
15
+ /** Show the whole project, as the Fit button does. False, changing nothing, with no task. */
16
+ fit(): boolean | undefined;
17
+ /**
18
+ * Bring a task's row and bar into view (it selects the task), or show a day. False, changing nothing, for a task
19
+ * that is deleted, unknown or has no row (hidden by a collapsed summary or the row filter), for a day that is not a date, and while a bar is pressed or dragged.
20
+ */
21
+ scrollTo(target: ScrollTarget): boolean | undefined;
22
+ /** The same call as `scrollTo({ task })`: select `task` and bring its row and bar into view, as a click on its row does. False, changing nothing, in the cases `scrollTo({ task })` refuses. */
23
+ select(task: number): boolean | undefined;
24
+ /**
25
+ * Turn a filter on, as the toolbar, the Filters menu and the keys do: a row filter (`"critical"`, `"longestPath"`,
26
+ * `"nearCritical"`, `"slipped"`, `"floatLost"`, `"joinedCritical"`, `"leftCritical"`, `"moved"`, `{ status }`, `{ code }`) replaces the one that is on, `"off"` turns
27
+ * the row filter off, and `{ lookahead }` sets or (with null) removes the window, which combines with the row filter. True when
28
+ * the chart took it, also when it was already so; false, changing nothing, when it refused: no outline, a bar press, a value it
29
+ * does not know, Slipped, Joined or Left with no baseline, Float lost with no baseline float, Show moved with no move report.
30
+ */
31
+ setFilter(filter: Filter): boolean | undefined;
32
+ /** Turn the row filter and the lookahead window off together, as the Filters menu's Clear does. False when the filters cannot change now. */
33
+ clearFilters(): boolean | undefined;
34
+ /** Undo the latest edit. True means an edit was undone; a failure is reported on the console and gives false. */
35
+ undo(): boolean | undefined;
36
+ /** Redo the latest undone edit. True means an edit was redone; a failure is reported on the console and gives false. */
37
+ redo(): boolean | undefined;
38
+ /**
39
+ * Search the task names and outline paths for `query` (case-blind; with a row filter or the lookahead window on, only the
40
+ * shown rows), as the find box does, and return the number of matches. It selects nothing: `findGo` and `findNext` do.
41
+ * False for a query that is not a string. `findGo` and `findNext` run the last `find`'s query again when the schedule or the
42
+ * filters changed since (`Status.stamp` moved), so they go only to its matches; the chrome's find box searches through this same call.
43
+ */
44
+ find(query: string): number | false | undefined;
45
+ /** Go to the match after the task last gone to (the first after a `find`), wrapping, and return its index: an insert before that task skips nothing. False with no match, and while busy. */
46
+ findNext(): number | false | undefined;
47
+ /** Select match `index` (from 0) of the last `find` and bring its row into view. False for an index outside the matches or not a whole number, and while busy. */
48
+ findGo(index: number): boolean | undefined;
49
+ /** Collapse every summary at outline level `level` and deeper (1 is the top), as the toolbar's level buttons do. False, changing nothing, for a level that is not a whole number from 1, with no outline, and while busy. */
50
+ collapseToLevel(level: number): boolean | undefined;
51
+ /** Expand every summary. False with no outline, and while busy. */
52
+ expandAll(): boolean | undefined;
53
+ /** Insert a task named `New task` below the selected task's subtree (the last top-level row with nothing selected) and select it, as the Insert key does: `{ ok: true, task }`, or `{ ok: false, reason }` changing nothing. One undo step. */
54
+ insertRow(): RowResult | undefined;
55
+ /** Delete the selected task (never a selected link), as the Delete key does, and select the next row: `{ ok: true, task }` with the deleted task, or `{ ok: false, reason }` changing nothing. One undo step. */
56
+ deleteRow(): RowResult | undefined;
57
+ /** Remove the selected link, as the toolbar's Delete does when a link is selected: `{ ok: true, link }` with the removed link, or `{ ok: false, reason, message }` changing nothing (`"noSelection"` with no link selected). One undo step. */
58
+ deleteLink(): LinkResult | undefined;
59
+ /** Move the data date to 00:00 on `day`, written `YYYY-MM-DD`, and recompute, or clear it with null. `{ ok: true }`, or `{ ok: false, reason }` changing nothing (`"badDate"` for any other value). One undo step; the day already in force (`state().dataDate`) changes nothing and records none, even when it is a file's data date that is not the schedule's floor: no floor is set, so a host that wants one sets a different day first. */
60
+ setDataDate(day: string | null): EditResult | undefined;
61
+ /** Keep every task's dates as they are now as the baseline, replacing one already set. One undo step. */
62
+ setBaseline(): EditResult | undefined;
63
+ /** Drop the baseline. `"noBaseline"` with none. One undo step. */
64
+ clearBaseline(): EditResult | undefined;
65
+ /** Give the tasks added since the baseline their current dates as baseline, keeping every other entry. `"noBaseline"` with none. One undo step. */
66
+ addNewToBaseline(): EditResult | undefined;
67
+ /**
68
+ * Read `file`, an XER or MS Project XML file such as last month's, and make it the baseline: its tasks are matched to the open schedule's by ID.
69
+ * Resolves `{ ok: true, fileOnly }`, `fileOnly` the tasks only the file has, one line each in the file's order (`A1020 Pour slab`: the ID, a space, the name),
70
+ * the first 200 and then `and N more`; or a refusal that changes nothing: `"busy"`, or `"other"` with a sentence for a file that is empty, too big, not a
71
+ * schedule file, or holds no task with an ID the open schedule has. One undo step: Ctrl+Z puts back the baseline that was in force, or none.
72
+ */
73
+ setBaselineFromFile(file: File): Promise<CompareResult> | undefined;
74
+ }
75
+ /** Wrap `commands` so that each does nothing and returns undefined once `destroyed()` is true. Every method is wrapped, so a method added to `Commands` is too. */
76
+ export declare function guardCommands(commands: Commands, destroyed: () => boolean): Commands;
@@ -0,0 +1,59 @@
1
+ /** `text` as a gzip file's bytes. */
2
+ export declare function gzip(text: string): Promise<Uint8Array<ArrayBuffer>>;
3
+ /**
4
+ * The document text `bytes` holds, or `null` when `bytes` is not a gzip file whose JSON says `"format":"gantt"` (or the older value) (a P6
5
+ * or MS Project file, or any other gzip). A gzip file that cannot be read rejects.
6
+ */
7
+ export declare function documentText(bytes: Uint8Array): Promise<string | null>;
8
+ /** Hand `bytes` to the browser as a download called `fileName`, of media type `type` (a gzip file unless said). Returns when the download has started. */
9
+ export declare function download(fileName: string, bytes: Uint8Array<ArrayBuffer>, type?: string): void;
10
+ /** The schedule's name for a file: its name without the extension, `untitled` when nothing is left. */
11
+ export declare function documentName(fileName: string | undefined): string;
12
+ /** What `Gantt.load` takes: a document (the JSON of `toDocument`) or a file. */
13
+ export type LoadSource = {
14
+ document: unknown;
15
+ } | {
16
+ file: File;
17
+ };
18
+ /** What `Gantt.load` resolves with. A bad source gives `ok: false` and a line for a person; the schedule is as it was. */
19
+ export type LoadResult = {
20
+ ok: true;
21
+ } | {
22
+ ok: false;
23
+ error: string;
24
+ };
25
+ /** What an export returns: the file's bytes and one line for each thing it cannot carry. */
26
+ export interface ExportResult {
27
+ bytes: Uint8Array<ArrayBuffer>;
28
+ leftOut: string[];
29
+ }
30
+ /** The `{ bytes, left_out }` object of `App.export_xer` and `App.export_mspdi`, as an `ExportResult`. */
31
+ export declare function toExportResult(raw: unknown): ExportResult;
32
+ /**
33
+ * The schedule-quality counts `Gantt.checks` returns. Each is a count of tasks or links, and none says pass or fail. `invalidDates` is
34
+ * `null` when the schedule has no data date, because a 0 would read as a check that ran and found nothing.
35
+ */
36
+ export interface ChecksReport {
37
+ /** Unfinished tasks with no predecessor or no successor; summary tasks are not counted. */
38
+ missingLogic: number;
39
+ /** Links with a negative lag. */
40
+ leads: number;
41
+ /** Links with a positive lag. */
42
+ lags: number;
43
+ /** All links. */
44
+ links: number;
45
+ /** Links of type finish to start. */
46
+ finishToStart: number;
47
+ /** Unfinished tasks with more than 44 working days of total float. */
48
+ highFloat: number;
49
+ /** Tasks longer than 44 working days. */
50
+ highDuration: number;
51
+ /** Tasks with an actual start or finish after the data date; `null` without a data date. */
52
+ invalidDates: number | null;
53
+ /** Tasks the baseline had finishing by the data date that finished later or have not finished; 0 with no baseline or no data date. */
54
+ missed: number;
55
+ /** Tasks finished over tasks the baseline had finishing by the data date, 0 to 1; `null` with no baseline, no data date, or none due. */
56
+ executionIndex: number | null;
57
+ }
58
+ /** The JSON text of `App.checks`, as a `ChecksReport`. */
59
+ export declare function toChecksReport(json: string): ChecksReport;
@@ -0,0 +1,51 @@
1
+ /** Why an edit command changed nothing. */
2
+ export type EditRefusal =
3
+ /** A cell is being edited, or a bar or a link is being pressed or dragged (`Gantt.busy()`). */
4
+ "busy"
5
+ /** The schedule has no outline (a generated stress fixture). */
6
+ | "noOutline"
7
+ /** `deleteRow` with no task selected, `deleteLink` with no link selected. */
8
+ | "noSelection"
9
+ /** `insertRow` under a row filter or a lookahead window: the new row would not pass it and would vanish. */
10
+ | "filterActive"
11
+ /** `deleteRow` on a summary: delete or move its sub-tasks first. */
12
+ | "hasChildren"
13
+ /** `clearBaseline` or `addNewToBaseline` with no baseline set. */
14
+ | "noBaseline"
15
+ /** `setDataDate` with text that is not a real day written `YYYY-MM-DD`. */
16
+ | "badDate"
17
+ /** Anything else the schedule refused (rare: a solve that fails). */
18
+ | "other";
19
+ /** Why nothing changed: `reason` to match on, `message` to show (the chart's own sentence for it). */
20
+ export type Refusal = {
21
+ ok: false;
22
+ reason: EditRefusal;
23
+ message: string;
24
+ };
25
+ /** What `setDataDate`, `setBaseline`, `clearBaseline`, `addNewToBaseline` and, in a promise, `setBaselineFromFile` answer. */
26
+ export type EditResult = {
27
+ ok: true;
28
+ } | Refusal;
29
+ /** What `setBaselineFromFile` answers in a promise: `fileOnly` names the tasks only the file has (`A1020 Pour slab`), the first 200 and then `and N more`; or why nothing changed. */
30
+ export type CompareResult = {
31
+ ok: true;
32
+ fileOnly: readonly string[];
33
+ } | Refusal;
34
+ /** What `insertRow` and `deleteRow` answer: the task inserted or deleted, or why nothing changed. */
35
+ export type RowResult = {
36
+ ok: true;
37
+ task: number;
38
+ } | Refusal;
39
+ /** What `deleteLink` answers: the link removed (a dependency slot), or why nothing changed. */
40
+ export type LinkResult = {
41
+ ok: true;
42
+ link: number;
43
+ } | Refusal;
44
+ /** Read the JSON a `try_*` export answered. */
45
+ export declare function readAnswer(json: string): {
46
+ ok: true;
47
+ task?: number;
48
+ link?: number;
49
+ } | Refusal;
50
+ /** A refusal the page makes before asking the app, worded by the app: `"busy"`, or `"badDate"` for a day that is not one. */
51
+ export declare const refused: (reason: "busy" | "badDate") => Refusal;