@umriss-ui/schedule 0.1.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -0
- package/README.md +52 -26
- package/dist/index.d.ts +203 -146
- package/dist/schedule.css +1 -1
- package/dist/schedule.js +1353 -942
- package/docs/llms-full.md +6304 -0
- package/package.json +8 -7
package/dist/schedule.js
CHANGED
|
@@ -1,310 +1,323 @@
|
|
|
1
1
|
import "./schedule.css";
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var f = (
|
|
5
|
-
import { jsxs as Y, Fragment as
|
|
6
|
-
import { useContext as
|
|
7
|
-
import {
|
|
8
|
-
import { useFormats as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
function
|
|
14
|
-
const t =
|
|
2
|
+
var es = Object.defineProperty;
|
|
3
|
+
var ss = (o, t, e) => t in o ? es(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
4
|
+
var f = (o, t, e) => ss(o, typeof t != "symbol" ? t + "" : t, e);
|
|
5
|
+
import { jsxs as Y, Fragment as St, jsx as k } from "react/jsx-runtime";
|
|
6
|
+
import { useContext as Se, createContext as Ae, useRef as $, useEffect as H, forwardRef as ns, useState as ht, useId as os, useLayoutEffect as It, useImperativeHandle as is, useSyncExternalStore as rs, useMemo as X } from "react";
|
|
7
|
+
import { toWorkingTimeClamped as K, resolveColours as as, removedIntervals as ls, localOffset as _e, MINUTE as W, calendarFrom as q, toWallClock as z, DAY as rt, timeStep as hs, workingTimeTicks as ds, HOUR as Et, LinearScale as us, subscribeTheme as cs } from "@umriss-ui/charts";
|
|
8
|
+
import { useFormats as Rt, useWording as ft, AngleGlyph as fs, VisuallyHidden as ae } from "@umriss-ui/core";
|
|
9
|
+
const De = Ae(null), Fe = Ae(null);
|
|
10
|
+
function Oe() {
|
|
11
|
+
return Se(Fe);
|
|
12
|
+
}
|
|
13
|
+
function ps(o) {
|
|
14
|
+
const t = Se(De);
|
|
15
15
|
if (t === null)
|
|
16
|
-
throw new Error(`@umriss-ui/schedule: <${
|
|
16
|
+
throw new Error(`@umriss-ui/schedule: <${o}> must be used inside a <Schedule>.`);
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const i =
|
|
21
|
-
|
|
22
|
-
r.current !== null &&
|
|
23
|
-
}), [i]),
|
|
19
|
+
function Pt(o, t, e, s, n) {
|
|
20
|
+
const i = ps(o), r = $(null);
|
|
21
|
+
H(() => (r.current = e(i, t), () => {
|
|
22
|
+
r.current !== null && n(i, r.current), r.current = null;
|
|
23
|
+
}), [i]), H(() => {
|
|
24
24
|
r.current !== null && s(i, r.current, t);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
function
|
|
37
|
-
let t = !1, e = !1, s = !1,
|
|
38
|
-
for (const i of
|
|
39
|
-
i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? s = !0 : i === "open" && (
|
|
40
|
-
return { dashed: t, hatched: e, muted: s, open:
|
|
41
|
-
}
|
|
42
|
-
const
|
|
43
|
-
function
|
|
44
|
-
const { lanes: t, groups: e, collapsed: s, laneHeight:
|
|
45
|
-
const
|
|
46
|
-
let L = r(
|
|
47
|
-
const
|
|
48
|
-
for (; L !== void 0 && !
|
|
49
|
-
|
|
50
|
-
return
|
|
51
|
-
},
|
|
52
|
-
for (const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
for (const L of
|
|
56
|
-
const
|
|
57
|
-
|
|
27
|
+
function ms(o) {
|
|
28
|
+
Pt("Lane", o, (t, e) => t.registerLane(e), (t, e, s) => t.updateLane(e, s), (t, e) => t.unregisterLane(e));
|
|
29
|
+
}
|
|
30
|
+
function gs(o) {
|
|
31
|
+
Pt("LaneGroup", o, (t, e) => t.registerGroup(e), (t, e, s) => t.updateGroup(e, s), (t, e) => t.unregisterGroup(e));
|
|
32
|
+
}
|
|
33
|
+
function Bt(o, t) {
|
|
34
|
+
Pt(o, t, (e, s) => e.registerLayer(s), (e, s, n) => e.updateLayer(s, n), (e, s) => e.unregisterLayer(s));
|
|
35
|
+
}
|
|
36
|
+
function pt(o) {
|
|
37
|
+
let t = !1, e = !1, s = !1, n = !1;
|
|
38
|
+
for (const i of o ?? [])
|
|
39
|
+
i === "provisional" ? (t = !0, e = !1) : i === "fixed" ? (e = !0, t = !1) : i === "muted" ? s = !0 : i === "open" && (n = !0);
|
|
40
|
+
return { dashed: t, hatched: e, muted: s, open: n };
|
|
41
|
+
}
|
|
42
|
+
const ks = 24, ys = 4, vs = 3, Ct = 4;
|
|
43
|
+
function le(o) {
|
|
44
|
+
const { lanes: t, groups: e, collapsed: s, laneHeight: n } = o, i = new Map(e.map((g) => [g.id, g])), r = (g) => g !== void 0 && i.has(g) ? g : void 0, a = /* @__PURE__ */ new Map(), h = (g) => {
|
|
45
|
+
const I = [];
|
|
46
|
+
let L = r(g.parent);
|
|
47
|
+
const F = /* @__PURE__ */ new Set();
|
|
48
|
+
for (; L !== void 0 && !F.has(L); )
|
|
49
|
+
F.add(L), I.unshift(L), L = r(i.get(L).parent);
|
|
50
|
+
return I;
|
|
51
|
+
}, d = /* @__PURE__ */ new Map();
|
|
52
|
+
for (const g of t) {
|
|
53
|
+
const I = h(g);
|
|
54
|
+
d.set(g.id, I);
|
|
55
|
+
for (const L of I) {
|
|
56
|
+
const F = a.get(L) ?? [];
|
|
57
|
+
F.push(g.id), a.set(L, F);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
const l = [],
|
|
61
|
-
let p = [],
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const { row:
|
|
65
|
-
l[
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
top: L.top +
|
|
71
|
-
height:
|
|
60
|
+
const l = [], c = /* @__PURE__ */ new Map();
|
|
61
|
+
let p = [], m = null, y = 0;
|
|
62
|
+
const C = (g) => (l.push({ ...g, top: y }), y += g.height, l.length - 1), S = (g) => g.find((I) => s.has(I)), A = () => {
|
|
63
|
+
if (m === null) return;
|
|
64
|
+
const { row: g, lanes: I } = m, L = l[g], F = Math.max(L.height, I.length * ys + 2 * Ct);
|
|
65
|
+
l[g] = { ...L, height: F }, y += F - L.height;
|
|
66
|
+
const D = F - 2 * Ct, N = Math.max(vs, Math.floor(D / I.length));
|
|
67
|
+
I.forEach((Q, lt) => {
|
|
68
|
+
const V = d.get(Q) ?? [];
|
|
69
|
+
c.set(Q, {
|
|
70
|
+
top: L.top + Ct + lt * N,
|
|
71
|
+
height: N,
|
|
72
72
|
miniature: !0,
|
|
73
|
-
group:
|
|
73
|
+
group: V[V.length - 1]
|
|
74
74
|
});
|
|
75
|
-
}),
|
|
75
|
+
}), m = null;
|
|
76
76
|
};
|
|
77
|
-
for (const
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
|
|
77
|
+
for (const g of t) {
|
|
78
|
+
const I = (d.get(g.id) ?? []).filter((D) => (a.get(D) ?? []).length > 0), L = S(I);
|
|
79
|
+
if (m !== null && L === m.group) {
|
|
80
|
+
m.lanes.push(g.id);
|
|
81
81
|
continue;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
p = p.slice(0,
|
|
86
|
-
for (const
|
|
87
|
-
if (p.push(
|
|
88
|
-
|
|
83
|
+
A();
|
|
84
|
+
const F = I.filter((D, N) => p[N] === D).length;
|
|
85
|
+
p = p.slice(0, F);
|
|
86
|
+
for (const D of I.slice(F)) {
|
|
87
|
+
if (p.push(D), D === L) break;
|
|
88
|
+
C({
|
|
89
89
|
kind: "groupHead",
|
|
90
90
|
lane: void 0,
|
|
91
|
-
group:
|
|
91
|
+
group: D,
|
|
92
92
|
depth: p.length - 1,
|
|
93
93
|
within: [...p],
|
|
94
|
-
lanes: (a.get(
|
|
95
|
-
height:
|
|
94
|
+
lanes: (a.get(D) ?? []).length,
|
|
95
|
+
height: ks
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
if (L !== void 0) {
|
|
99
|
-
const
|
|
99
|
+
const D = I.indexOf(L), N = C({
|
|
100
100
|
kind: "miniature",
|
|
101
101
|
lane: void 0,
|
|
102
102
|
group: L,
|
|
103
|
-
depth:
|
|
104
|
-
within:
|
|
103
|
+
depth: D,
|
|
104
|
+
within: I.slice(0, D + 1),
|
|
105
105
|
lanes: (a.get(L) ?? []).length,
|
|
106
|
-
height:
|
|
106
|
+
height: n
|
|
107
107
|
});
|
|
108
|
-
|
|
108
|
+
m = { group: L, row: N, lanes: [g.id] };
|
|
109
109
|
continue;
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
C({ kind: "lane", lane: g.id, group: I[I.length - 1], depth: I.length, within: I, lanes: 1, height: n }), c.set(g.id, {
|
|
112
112
|
top: l[l.length - 1].top,
|
|
113
|
-
height:
|
|
113
|
+
height: n,
|
|
114
114
|
miniature: !1,
|
|
115
|
-
group:
|
|
115
|
+
group: I[I.length - 1]
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
return
|
|
118
|
+
return A(), { rows: l, slots: c, height: y };
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
if (t.size === 0) return
|
|
120
|
+
function ws(o, t) {
|
|
121
|
+
if (t.size === 0) return o;
|
|
122
122
|
const e = /* @__PURE__ */ new Set();
|
|
123
|
-
for (const s of
|
|
123
|
+
for (const s of o) t.has(s) || e.add(s);
|
|
124
124
|
return e;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
if (t < 0 || t >=
|
|
128
|
-
let e = 0, s =
|
|
126
|
+
function Z(o, t) {
|
|
127
|
+
if (t < 0 || t >= o.height) return null;
|
|
128
|
+
let e = 0, s = o.rows.length - 1;
|
|
129
129
|
for (; e <= s; ) {
|
|
130
|
-
const
|
|
131
|
-
if (t < i.top) s =
|
|
132
|
-
else if (t >= i.top + i.height) e =
|
|
130
|
+
const n = e + s >> 1, i = o.rows[n];
|
|
131
|
+
if (t < i.top) s = n - 1;
|
|
132
|
+
else if (t >= i.top + i.height) e = n + 1;
|
|
133
133
|
else return i;
|
|
134
134
|
}
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
137
|
+
function Nt(o, t) {
|
|
138
|
+
return o.slots.get(t) ?? null;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
const e =
|
|
140
|
+
function bs(o, t) {
|
|
141
|
+
const e = Z(o, t);
|
|
142
142
|
if (e === null) return null;
|
|
143
143
|
if (e.kind === "lane") return e.lane ?? null;
|
|
144
144
|
if (e.kind === "groupHead") return null;
|
|
145
|
-
for (const [s,
|
|
146
|
-
if (
|
|
145
|
+
for (const [s, n] of o.slots)
|
|
146
|
+
if (n.miniature && t >= n.top && t < n.top + n.height) return s;
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
return { from:
|
|
149
|
+
function J(o) {
|
|
150
|
+
return { from: o.from - (o.leadIn ?? 0), to: o.to + (o.leadOut ?? 0) };
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
return (
|
|
152
|
+
function xt(o, t) {
|
|
153
|
+
return (o.leaves ?? "leadOut") === "main" ? t.to : t.to + (t.leadOut ?? 0);
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
return (
|
|
155
|
+
function Gt(o, t) {
|
|
156
|
+
return (o.arrives ?? "leadIn") === "main" ? t.from : t.from - (t.leadIn ?? 0);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
if (t.kind === "place" || t.subtask !==
|
|
158
|
+
function he(o, t) {
|
|
159
|
+
if (t.kind === "place" || t.subtask !== o.id) return o;
|
|
160
160
|
switch (t.kind) {
|
|
161
161
|
case "move":
|
|
162
162
|
case "stretch":
|
|
163
|
-
return { ...
|
|
164
|
-
case "
|
|
165
|
-
return { ...
|
|
166
|
-
case "
|
|
167
|
-
return { ...
|
|
163
|
+
return { ...o, from: t.from, to: t.to };
|
|
164
|
+
case "leadIn":
|
|
165
|
+
return { ...o, leadIn: t.leadIn };
|
|
166
|
+
case "leadOut":
|
|
167
|
+
return { ...o, leadOut: t.leadOut };
|
|
168
168
|
case "lane":
|
|
169
|
-
return { ...
|
|
169
|
+
return { ...o, lane: t.lane };
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function Qn(o, t) {
|
|
173
173
|
return {
|
|
174
174
|
id: t,
|
|
175
|
-
task:
|
|
176
|
-
lane:
|
|
177
|
-
from:
|
|
178
|
-
to:
|
|
179
|
-
...
|
|
180
|
-
...
|
|
175
|
+
task: o.task,
|
|
176
|
+
lane: o.lane,
|
|
177
|
+
from: o.from,
|
|
178
|
+
to: o.to,
|
|
179
|
+
...o.leadIn === void 0 ? {} : { leadIn: o.leadIn },
|
|
180
|
+
...o.leadOut === void 0 ? {} : { leadOut: o.leadOut }
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
const
|
|
184
|
-
function
|
|
185
|
-
return Math.round(
|
|
183
|
+
const Ms = 6, Ee = 3, ot = 2, de = 3, ue = 3;
|
|
184
|
+
function E(o, t) {
|
|
185
|
+
return Math.round(o.scale.toPx(K(t, o.calendar)));
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
const e =
|
|
189
|
-
return e === null ? null : { ...e, top: e.top -
|
|
187
|
+
function at(o, t) {
|
|
188
|
+
const e = Nt(o.rows, t);
|
|
189
|
+
return e === null ? null : { ...e, top: e.top - o.scrollY };
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
return
|
|
191
|
+
function ce(o, t) {
|
|
192
|
+
return bs(o.rows, t + o.scrollY);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
const i = s.miniature ? 0 :
|
|
194
|
+
function Re(o, t, e, s, n) {
|
|
195
|
+
const i = s.miniature ? 0 : Ms, r = s.miniature ? 0 : ue * de, a = Math.max(s.miniature ? 1 : 4, s.height - 2 * i - r), h = s.top - o.scrollY + Math.floor((s.height - a) / 2), d = J(t);
|
|
196
196
|
return {
|
|
197
197
|
subtask: t,
|
|
198
198
|
lane: e,
|
|
199
199
|
miniature: s.miniature,
|
|
200
|
-
depth:
|
|
201
|
-
y:
|
|
200
|
+
depth: n,
|
|
201
|
+
y: h + (s.miniature ? 0 : Math.min(n, ue) * de),
|
|
202
202
|
height: a,
|
|
203
|
-
outerFrom:
|
|
204
|
-
mainFrom:
|
|
205
|
-
mainTo:
|
|
206
|
-
outerTo:
|
|
203
|
+
outerFrom: E(o, d.from),
|
|
204
|
+
mainFrom: E(o, t.from),
|
|
205
|
+
mainTo: E(o, t.to),
|
|
206
|
+
outerTo: E(o, d.to)
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
if (e <
|
|
211
|
-
const s = Math.max(0, (6 - (
|
|
212
|
-
return t <
|
|
209
|
+
function Pe(o, t, e) {
|
|
210
|
+
if (e < o.y || e > o.y + o.height) return null;
|
|
211
|
+
const s = Math.max(0, (6 - (o.outerTo - o.outerFrom)) / 2);
|
|
212
|
+
return t < o.outerFrom - s || t > o.outerTo + s ? null : t < o.mainFrom ? "leadIn" : t > o.mainTo ? "leadOut" : "main";
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
if (e <
|
|
216
|
-
const
|
|
217
|
-
return Math.min(
|
|
214
|
+
function Ts(o, t, e, s = 5) {
|
|
215
|
+
if (e < o.y || e > o.y + o.height) return null;
|
|
216
|
+
const n = Math.abs(t - o.mainFrom), i = Math.abs(t - o.mainTo);
|
|
217
|
+
return Math.min(n, i) > s ? null : n <= i ? "from" : "to";
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
return
|
|
219
|
+
function At(o, t, e) {
|
|
220
|
+
return o.outerTo >= 0 && o.outerFrom <= t && o.y + o.height >= 0 && o.y <= e;
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
function
|
|
224
|
-
if (
|
|
225
|
-
const e =
|
|
226
|
-
return
|
|
222
|
+
const Is = 64;
|
|
223
|
+
function Cs(o, t) {
|
|
224
|
+
if (o.miniature) return null;
|
|
225
|
+
const e = pt(o.subtask.appearance).hatched ? ot + Ee + 1 : 0, s = Math.max(o.mainFrom + e, 0), n = Math.min(o.mainTo - e, t) - s;
|
|
226
|
+
return n < Is ? null : { x: s, width: n, y: o.y, height: o.height };
|
|
227
227
|
}
|
|
228
|
-
const
|
|
229
|
-
function
|
|
228
|
+
const Ls = 10;
|
|
229
|
+
function fe(o, t, e) {
|
|
230
230
|
const s = Math.round(t.y + t.height / 2);
|
|
231
|
-
return
|
|
231
|
+
return o === "centre" || e.y === t.y ? s : Math.round(e.y > t.y ? t.y + t.height - 1 : t.y + 1);
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
const i = t.route ??
|
|
233
|
+
function _t(o, t, e, s, n) {
|
|
234
|
+
const i = t.route ?? n.route, r = t.attach ?? n.attach, a = t.ends ?? n.ends, h = E(o, xt(t, e.subtask)), d = E(o, Gt(t, s.subtask)), l = fe(r, e, s), c = fe(r, s, e);
|
|
235
235
|
if (i === "straight")
|
|
236
|
-
return {
|
|
236
|
+
return { dependency: t, kind: i, ends: a, x1: h, y1: l, x2: d, y2: c, c1x: h, c2x: d, points: [h, l, d, c] };
|
|
237
237
|
if (i === "orthogonal") {
|
|
238
|
-
const
|
|
239
|
-
return {
|
|
240
|
-
}
|
|
241
|
-
const p = Math.max(14, Math.abs(
|
|
242
|
-
for (let
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
238
|
+
const S = h + Ls, A = l === c ? S : Math.round((S + d) / 2);
|
|
239
|
+
return { dependency: t, kind: i, ends: a, x1: h, y1: l, x2: d, y2: c, c1x: h, c2x: d, points: l === c ? [h, l, d, c] : [h, l, A, l, A, c, d, c] };
|
|
240
|
+
}
|
|
241
|
+
const p = Math.max(14, Math.abs(d - h) / 2), m = h + p, y = d - p, C = [];
|
|
242
|
+
for (let S = 0; S <= 16; S++) {
|
|
243
|
+
const A = S / 16, g = 1 - A;
|
|
244
|
+
C.push(
|
|
245
|
+
g * g * g * h + 3 * g * g * A * m + 3 * g * A * A * y + A * A * A * d,
|
|
246
|
+
g * g * g * l + 3 * g * g * A * l + 3 * g * A * A * c + A * A * A * c
|
|
247
247
|
);
|
|
248
248
|
}
|
|
249
|
-
return {
|
|
249
|
+
return { dependency: t, kind: "curve", ends: a, x1: h, y1: l, x2: d, y2: c, c1x: m, c2x: y, points: C };
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Ss(o, t, e) {
|
|
252
252
|
let s = 1 / 0;
|
|
253
|
-
const
|
|
254
|
-
for (let i = 0; i + 3 <
|
|
255
|
-
const r =
|
|
256
|
-
s = Math.min(s, Math.hypot(t - (r +
|
|
253
|
+
const n = o.points;
|
|
254
|
+
for (let i = 0; i + 3 < n.length; i += 2) {
|
|
255
|
+
const r = n[i], a = n[i + 1], h = n[i + 2], d = n[i + 3], l = h - r, c = d - a, p = l * l + c * c, m = p === 0 ? 0 : Math.max(0, Math.min(1, ((t - r) * l + (e - a) * c) / p));
|
|
256
|
+
s = Math.min(s, Math.hypot(t - (r + m * l), e - (a + m * c)));
|
|
257
257
|
}
|
|
258
258
|
return s;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function $t(o) {
|
|
261
261
|
const t = [], e = /* @__PURE__ */ new Map();
|
|
262
|
-
|
|
263
|
-
const { from: i, to: r } =
|
|
262
|
+
o.forEach((s, n) => {
|
|
263
|
+
const { from: i, to: r } = J(s);
|
|
264
264
|
if (!(i < r)) return;
|
|
265
265
|
const a = e.get(s.lane) ?? [];
|
|
266
|
-
a.push({ subtask: s, index:
|
|
266
|
+
a.push({ subtask: s, index: n, from: i, to: r }), e.set(s.lane, a);
|
|
267
267
|
});
|
|
268
|
-
for (const [s,
|
|
269
|
-
|
|
270
|
-
for (let i = 0; i <
|
|
271
|
-
const r =
|
|
272
|
-
for (let a = i + 1; a <
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
t.push({ lane: s, first: r.subtask.id, second:
|
|
268
|
+
for (const [s, n] of e) {
|
|
269
|
+
n.sort((i, r) => i.from - r.from || i.index - r.index);
|
|
270
|
+
for (let i = 0; i < n.length; i++) {
|
|
271
|
+
const r = n[i];
|
|
272
|
+
for (let a = i + 1; a < n.length; a++) {
|
|
273
|
+
const h = n[a];
|
|
274
|
+
if (h.from >= r.to) break;
|
|
275
|
+
t.push({ lane: s, first: r.subtask.id, second: h.subtask.id, from: h.from, to: Math.min(r.to, h.to) });
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function As(o) {
|
|
282
282
|
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
|
|
283
|
-
for (const s of
|
|
284
|
-
const
|
|
283
|
+
for (const s of o) {
|
|
284
|
+
const n = J(s), i = e.get(s.lane) ?? [];
|
|
285
285
|
let r = 0;
|
|
286
|
-
if (
|
|
287
|
-
for (const a of i)
|
|
288
|
-
i.push(
|
|
286
|
+
if (n.from < n.to) {
|
|
287
|
+
for (const a of i) n.from < a.to && a.from < n.to && r++;
|
|
288
|
+
i.push(n);
|
|
289
289
|
}
|
|
290
290
|
e.set(s.lane, i), t.set(s.id, r);
|
|
291
291
|
}
|
|
292
292
|
return t;
|
|
293
293
|
}
|
|
294
|
-
function
|
|
295
|
-
const e = new Map(
|
|
296
|
-
for (const
|
|
297
|
-
const i = e.get(
|
|
294
|
+
function Ht(o, t) {
|
|
295
|
+
const e = new Map(o.map((n) => [n.id, n])), s = [];
|
|
296
|
+
for (const n of t) {
|
|
297
|
+
const i = e.get(n.from), r = e.get(n.to);
|
|
298
298
|
if (i === void 0 || r === void 0) continue;
|
|
299
|
-
const a =
|
|
300
|
-
|
|
299
|
+
const a = xt(n, i), h = Gt(n, r), d = a + n.lag - h;
|
|
300
|
+
d > 0 && s.push({ dependency: n.id, departure: a, arrival: h, shortBy: d });
|
|
301
301
|
}
|
|
302
302
|
return s;
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
|
|
304
|
+
function Be(o, t) {
|
|
305
|
+
const e = [];
|
|
306
|
+
for (const s of o) {
|
|
307
|
+
const n = J(s);
|
|
308
|
+
for (const i of t)
|
|
309
|
+
i.lane !== s.lane || !(n.from < i.to && i.from < n.to) || e.push({ subtask: s.id, blocked: i.id, lane: i.lane, from: Math.max(n.from, i.from), to: Math.min(n.to, i.to) });
|
|
310
|
+
}
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
function to(o, t, e = []) {
|
|
314
|
+
return {
|
|
315
|
+
overlaps: $t(o),
|
|
316
|
+
violatedDependencies: Ht(o, t),
|
|
317
|
+
inBlockedTime: Be(o, e)
|
|
318
|
+
};
|
|
306
319
|
}
|
|
307
|
-
class
|
|
320
|
+
class _s {
|
|
308
321
|
/** `changed` is called after every registration change. */
|
|
309
322
|
constructor(t) {
|
|
310
323
|
f(this, "nextId", 1);
|
|
@@ -320,11 +333,14 @@ class ms {
|
|
|
320
333
|
f(this, "layers", []);
|
|
321
334
|
f(this, "subtasks", []);
|
|
322
335
|
f(this, "subtaskById", /* @__PURE__ */ new Map());
|
|
323
|
-
f(this, "
|
|
336
|
+
f(this, "dependencies", []);
|
|
337
|
+
/** Every blocked time, whichever layer declared it. */
|
|
338
|
+
f(this, "blocked", []);
|
|
324
339
|
f(this, "tasks", /* @__PURE__ */ new Map());
|
|
325
340
|
f(this, "overlaps", []);
|
|
326
|
-
f(this, "
|
|
341
|
+
f(this, "violatedById", /* @__PURE__ */ new Map());
|
|
327
342
|
f(this, "depth", /* @__PURE__ */ new Map());
|
|
343
|
+
f(this, "inBlocked", []);
|
|
328
344
|
this.changed = t;
|
|
329
345
|
}
|
|
330
346
|
registerLane(t) {
|
|
@@ -365,343 +381,383 @@ class ms {
|
|
|
365
381
|
rebuild() {
|
|
366
382
|
if (!this.dirty) return !1;
|
|
367
383
|
this.dirty = !1;
|
|
368
|
-
const t = (e) => [...e.keys()].sort((s,
|
|
369
|
-
this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.laneIndex = new Map(this.lanes.map((e, s) => [e.id, s])), this.layers = t(this.layerEntries), this.subtasks = [], this.
|
|
384
|
+
const t = (e) => [...e.keys()].sort((s, n) => s - n).map((s) => e.get(s));
|
|
385
|
+
this.lanes = t(this.laneEntries), this.groups = t(this.groupEntries), this.laneIndex = new Map(this.lanes.map((e, s) => [e.id, s])), this.layers = t(this.layerEntries), this.subtasks = [], this.dependencies = [], this.blocked = [], this.tasks = /* @__PURE__ */ new Map();
|
|
370
386
|
for (const e of this.layers)
|
|
371
387
|
if (e.kind === "subtasks") {
|
|
372
388
|
this.subtasks.push(...e.data);
|
|
373
389
|
for (const s of e.tasks) this.tasks.set(s.id, s);
|
|
374
|
-
} else
|
|
375
|
-
|
|
376
|
-
return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = At(this.subtasks), this.lateById = new Map(_t(this.subtasks, this.transports).map((e) => [e.transport, e])), this.depth = ps(this.subtasks), !0;
|
|
390
|
+
} else e.kind === "dependencies" ? this.dependencies.push(...e.data) : this.blocked.push(...e.data);
|
|
391
|
+
return this.subtaskById = new Map(this.subtasks.map((e) => [e.id, e])), this.overlaps = $t(this.subtasks), this.violatedById = new Map(Ht(this.subtasks, this.dependencies).map((e) => [e.dependency, e])), this.depth = As(this.subtasks), this.inBlocked = Be(this.subtasks, this.blocked), !0;
|
|
377
392
|
}
|
|
378
|
-
/** The task a
|
|
379
|
-
|
|
393
|
+
/** The task a dependency belongs to: its departing subtask's. */
|
|
394
|
+
taskOfDependency(t) {
|
|
380
395
|
var e;
|
|
381
396
|
return ((e = this.subtaskById.get(t.from)) == null ? void 0 : e.task) ?? null;
|
|
382
397
|
}
|
|
383
|
-
/** What a tooltip is about: the hovered subtask or
|
|
398
|
+
/** What a tooltip is about: the hovered subtask or dependency with what this
|
|
384
399
|
data knows about it - its task, and the findings it stands in. */
|
|
385
400
|
tooltipTargetFor(t) {
|
|
386
401
|
if (t.kind === "subtask") {
|
|
387
|
-
const
|
|
388
|
-
return { kind: "subtask", subtask: t.subtask, task: this.tasks.get(t.subtask.task), overlapping: i,
|
|
402
|
+
const n = t.subtask.id, i = this.overlaps.filter((h) => h.first === n || h.second === n).map((h) => this.subtaskById.get(h.first === n ? h.second : h.first)).filter((h) => h !== void 0), r = this.dependencies.filter((h) => h.from === n || h.to === n).map((h) => this.violatedById.get(h.id)).filter((h) => h !== void 0), a = this.inBlocked.filter((h) => h.subtask === n).map((h) => this.blocked.find((d) => d.id === h.blocked)).filter((h) => h !== void 0);
|
|
403
|
+
return { kind: "subtask", subtask: t.subtask, task: this.tasks.get(t.subtask.task), overlapping: i, violatedDependencies: r, blocked: a };
|
|
389
404
|
}
|
|
390
|
-
if (t.kind !== "
|
|
391
|
-
const e = t.
|
|
405
|
+
if (t.kind !== "dependency") return null;
|
|
406
|
+
const e = t.dependency, s = this.taskOfDependency(e);
|
|
392
407
|
return {
|
|
393
|
-
kind: "
|
|
394
|
-
|
|
408
|
+
kind: "dependency",
|
|
409
|
+
dependency: e,
|
|
395
410
|
task: s !== null ? this.tasks.get(s) : void 0,
|
|
396
411
|
from: this.subtaskById.get(e.from),
|
|
397
412
|
to: this.subtaskById.get(e.to),
|
|
398
|
-
|
|
413
|
+
violated: this.violatedById.get(e.id)
|
|
399
414
|
};
|
|
400
415
|
}
|
|
401
416
|
}
|
|
402
|
-
const
|
|
417
|
+
const Ds = {
|
|
403
418
|
line: "var(--u-hairline)",
|
|
404
419
|
lineStrong: "var(--u-hairline-strong)",
|
|
405
420
|
text: "var(--u-color-text)",
|
|
406
421
|
muted: "var(--u-color-text-muted)",
|
|
407
422
|
alarm: "var(--u-color-danger)",
|
|
408
423
|
surface: "var(--u-color-surface)",
|
|
409
|
-
|
|
424
|
+
/* The active subtask's mark - drawn in a colour of its own only under
|
|
425
|
+
forced colours; outside them it is the hover's wash (`drawHover`). */
|
|
426
|
+
active: "var(--u-color-accent)",
|
|
427
|
+
now: "var(--u-color-accent)",
|
|
410
428
|
/* What text and marks take ON a filled bar - the same token the bar labels
|
|
411
429
|
use in CSS, so a cap and the label beside it are one colour. */
|
|
412
430
|
onAccent: "var(--u-color-on-accent)"
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
431
|
+
}, Ne = {
|
|
432
|
+
line: "GrayText",
|
|
433
|
+
lineStrong: "CanvasText",
|
|
434
|
+
text: "CanvasText",
|
|
435
|
+
muted: "GrayText",
|
|
436
|
+
alarm: "CanvasText",
|
|
437
|
+
surface: "Canvas",
|
|
438
|
+
active: "Highlight",
|
|
439
|
+
now: "GrayText",
|
|
440
|
+
onAccent: "Canvas"
|
|
441
|
+
}, Fs = (o) => o ? Ne : Ds, Os = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(forced-colors: active)").matches;
|
|
442
|
+
function Es(o, t) {
|
|
443
|
+
const e = Os(), s = {};
|
|
444
|
+
for (const r of t.tasks.values()) s[`task:${r.id}`] = e ? Ne.text : r.color;
|
|
445
|
+
const n = as(o, { ...Fs(e), ...s }), i = /* @__PURE__ */ new Map();
|
|
446
|
+
for (const r of t.tasks.values()) i.set(r.id, n[`task:${r.id}`] ?? r.color);
|
|
419
447
|
return {
|
|
420
|
-
line:
|
|
421
|
-
lineStrong:
|
|
422
|
-
text:
|
|
423
|
-
muted:
|
|
424
|
-
alarm:
|
|
425
|
-
surface:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
448
|
+
line: n.line,
|
|
449
|
+
lineStrong: n.lineStrong,
|
|
450
|
+
text: n.text,
|
|
451
|
+
muted: n.muted,
|
|
452
|
+
alarm: n.alarm,
|
|
453
|
+
surface: n.surface,
|
|
454
|
+
active: n.active,
|
|
455
|
+
now: n.now,
|
|
456
|
+
onAccent: n.onAccent,
|
|
457
|
+
tasks: i,
|
|
458
|
+
forced: e
|
|
429
459
|
};
|
|
430
460
|
}
|
|
431
|
-
function
|
|
432
|
-
const t =
|
|
461
|
+
function ut(o) {
|
|
462
|
+
const t = o.match(/[\d.]+/g);
|
|
433
463
|
return t === null || t.length < 3 ? null : [Number(t[0]), Number(t[1]), Number(t[2])];
|
|
434
464
|
}
|
|
435
|
-
function
|
|
436
|
-
const t =
|
|
465
|
+
function pe(o) {
|
|
466
|
+
const t = ut(o);
|
|
437
467
|
if (t === null) return 0;
|
|
438
|
-
const [e, s,
|
|
468
|
+
const [e, s, n] = t.map((i) => {
|
|
439
469
|
const r = i / 255;
|
|
440
470
|
return r <= 0.04045 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
|
|
441
471
|
});
|
|
442
|
-
return 0.2126 * e + 0.7152 * s + 0.0722 *
|
|
472
|
+
return 0.2126 * e + 0.7152 * s + 0.0722 * n;
|
|
443
473
|
}
|
|
444
|
-
function
|
|
445
|
-
const e =
|
|
474
|
+
function me(o, t) {
|
|
475
|
+
const e = pe(o), s = pe(t);
|
|
446
476
|
return (Math.max(e, s) + 0.05) / (Math.min(e, s) + 0.05);
|
|
447
477
|
}
|
|
448
|
-
function
|
|
449
|
-
if (
|
|
450
|
-
const s = typeof window > "u" ? 1 : window.devicePixelRatio || 1,
|
|
451
|
-
|
|
452
|
-
const r =
|
|
478
|
+
function ge(o, t, e) {
|
|
479
|
+
if (o === null) return null;
|
|
480
|
+
const s = typeof window > "u" ? 1 : window.devicePixelRatio || 1, n = Math.round(t * s), i = Math.round(e * s);
|
|
481
|
+
o.width !== n && (o.width = n), o.height !== i && (o.height = i);
|
|
482
|
+
const r = o.getContext("2d");
|
|
453
483
|
return r === null ? null : (r.setTransform(s, 0, 0, s, 0, 0), r.clearRect(0, 0, t, e), r);
|
|
454
484
|
}
|
|
455
|
-
function
|
|
456
|
-
const { data: e, view: s } = t,
|
|
457
|
-
|
|
485
|
+
function Rs(o, t) {
|
|
486
|
+
const { data: e, view: s } = t, n = s.viewport();
|
|
487
|
+
xs(o, t, n);
|
|
488
|
+
for (const i of e.blocked) Ws(o, t, n, i);
|
|
489
|
+
Gs(o, t);
|
|
458
490
|
for (const i of e.layers) {
|
|
491
|
+
if (i.kind === "blocked") continue;
|
|
459
492
|
const r = new Set(i.data);
|
|
460
|
-
if (i.kind === "
|
|
461
|
-
for (const a of s.paths) r.has(a.
|
|
493
|
+
if (i.kind === "dependencies")
|
|
494
|
+
for (const a of s.paths) r.has(a.dependency) && Dt(o, t, a, !1);
|
|
462
495
|
else
|
|
463
|
-
for (const a of s.boxes) r.has(a.subtask) &&
|
|
496
|
+
for (const a of s.boxes) r.has(a.subtask) && Ge(o, t, a, 1);
|
|
464
497
|
}
|
|
465
|
-
for (const i of e.overlaps)
|
|
466
|
-
|
|
498
|
+
for (const i of e.overlaps) Ot(o, t, n, i);
|
|
499
|
+
for (const i of e.inBlocked) Ot(o, t, n, i);
|
|
500
|
+
Xs(o, t, n), js(o, t);
|
|
467
501
|
}
|
|
468
|
-
function
|
|
469
|
-
const { view: e, hover: s } = t,
|
|
502
|
+
function Ps(o, t) {
|
|
503
|
+
const { view: e, hover: s } = t, n = e.viewport();
|
|
470
504
|
if (t.ghost === null) {
|
|
471
505
|
if (s.kind === "subtask") {
|
|
472
506
|
const l = e.boxById.get(s.subtask.id);
|
|
473
|
-
l !== void 0 &&
|
|
474
|
-
} else if (s.kind === "
|
|
475
|
-
const l = e.paths.find((
|
|
476
|
-
l !== void 0 &&
|
|
507
|
+
l !== void 0 && zs(o, t, l);
|
|
508
|
+
} else if (s.kind === "dependency") {
|
|
509
|
+
const l = e.paths.find((c) => c.dependency === s.dependency);
|
|
510
|
+
l !== void 0 && Dt(o, t, l, !0);
|
|
477
511
|
}
|
|
478
512
|
return;
|
|
479
513
|
}
|
|
480
|
-
const { ghost: i, overlaps: r,
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
if (
|
|
484
|
-
for (const l of r)
|
|
485
|
-
const
|
|
486
|
-
for (const l of t.data.
|
|
514
|
+
const { ghost: i, overlaps: r, violated: a } = t.ghost;
|
|
515
|
+
Bs(o, t, n, t.ghost.refusedLanes);
|
|
516
|
+
const h = xe(n, i);
|
|
517
|
+
if (h === null) return;
|
|
518
|
+
for (const l of r) Ot(o, t, n, l);
|
|
519
|
+
const d = new Set(a.map((l) => l.dependency));
|
|
520
|
+
for (const l of t.data.dependencies) {
|
|
487
521
|
if (l.from !== i.id && l.to !== i.id) continue;
|
|
488
|
-
const
|
|
489
|
-
if (
|
|
490
|
-
const p = l.from === i.id ?
|
|
491
|
-
|
|
522
|
+
const c = e.boxById.get(l.from === i.id ? l.to : l.from);
|
|
523
|
+
if (c === void 0) continue;
|
|
524
|
+
const p = l.from === i.id ? _t(n, l, h, c, e.options) : _t(n, l, c, h, e.options);
|
|
525
|
+
Dt(o, t, p, !0, d.has(l.id));
|
|
492
526
|
}
|
|
493
|
-
|
|
527
|
+
Ge(o, t, h, 0.55), o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([3, 2]), o.strokeRect(h.outerFrom + 0.5, h.y + 0.5, Math.max(1, h.outerTo - h.outerFrom - 1), h.height - 1), o.setLineDash([]), t.ghost.tether !== null && Ns(o, t, h, t.ghost.tether);
|
|
494
528
|
}
|
|
495
|
-
function
|
|
529
|
+
function Bs(o, t, e, s) {
|
|
496
530
|
if (s.size === 0) return;
|
|
497
|
-
const { width:
|
|
531
|
+
const { width: n, height: i } = t.view;
|
|
498
532
|
for (const r of s) {
|
|
499
|
-
const a =
|
|
533
|
+
const a = at(e, r);
|
|
500
534
|
if (a === null) continue;
|
|
501
|
-
const { top:
|
|
502
|
-
|
|
535
|
+
const { top: h, height: d } = a;
|
|
536
|
+
h + d < 0 || h > i || (o.globalAlpha = 0.6, o.fillStyle = t.colours.surface, o.fillRect(0, h, n, d), o.globalAlpha = 1, He(o, 0, h, n, d, t.colours.muted, 0.7, $e, 1));
|
|
503
537
|
}
|
|
504
538
|
}
|
|
505
|
-
function
|
|
506
|
-
const
|
|
507
|
-
Math.hypot(s.x -
|
|
539
|
+
function Ns(o, t, e, s) {
|
|
540
|
+
const n = Math.max(e.outerFrom, Math.min(e.outerTo, s.x)), i = Math.max(e.y, Math.min(e.y + e.height, s.y));
|
|
541
|
+
Math.hypot(s.x - n, s.y - i) < 2 || (o.strokeStyle = t.colours.text, o.lineWidth = 1, o.setLineDash([2, 3]), o.beginPath(), o.moveTo(n + 0.5, i + 0.5), o.lineTo(s.x + 0.5, s.y + 0.5), o.stroke(), o.setLineDash([]));
|
|
508
542
|
}
|
|
509
|
-
function
|
|
510
|
-
const e =
|
|
511
|
-
return e === null ? null :
|
|
543
|
+
function xe(o, t) {
|
|
544
|
+
const e = Nt(o.rows, t.lane);
|
|
545
|
+
return e === null ? null : Re(o, t, t.lane, e, 0);
|
|
512
546
|
}
|
|
513
|
-
function
|
|
514
|
-
const { view: s, colours:
|
|
515
|
-
|
|
547
|
+
function xs(o, t, e) {
|
|
548
|
+
const { view: s, colours: n, bands: i } = t, { width: r, height: a } = s;
|
|
549
|
+
o.lineWidth = 1, o.strokeStyle = n.line, o.beginPath();
|
|
516
550
|
for (const l of i.ticks)
|
|
517
|
-
|
|
551
|
+
o.moveTo(l.x + 0.5, 0), o.lineTo(l.x + 0.5, a);
|
|
518
552
|
for (const l of e.rows.rows) {
|
|
519
|
-
const
|
|
520
|
-
|
|
553
|
+
const c = l.top + l.height - e.scrollY - 0.5;
|
|
554
|
+
c < 0 || c > a || (o.moveTo(0, c), o.lineTo(r, c));
|
|
521
555
|
}
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
const p =
|
|
556
|
+
const h = [...e.rows.slots.values()].filter((l) => l.miniature).sort((l, c) => l.top - c.top);
|
|
557
|
+
h.forEach((l, c) => {
|
|
558
|
+
const p = h[c + 1];
|
|
525
559
|
if (p === void 0 || p.top !== l.top + l.height || p.group === l.group) return;
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
}),
|
|
560
|
+
const m = l.top + l.height - e.scrollY - 0.5;
|
|
561
|
+
m < 0 || m > a || (o.moveTo(0, m), o.lineTo(r, m));
|
|
562
|
+
}), o.stroke(), o.strokeStyle = n.lineStrong, o.beginPath();
|
|
529
563
|
for (const l of i.days)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
if (
|
|
534
|
-
|
|
535
|
-
for (const l of
|
|
536
|
-
const
|
|
537
|
-
|
|
564
|
+
o.moveTo(l.x + 0.5, 0), o.lineTo(l.x + 0.5, a);
|
|
565
|
+
o.stroke();
|
|
566
|
+
const d = ls(s.options.calendar);
|
|
567
|
+
if (d.length > 0) {
|
|
568
|
+
o.strokeStyle = n.muted, o.setLineDash([2, 3]), o.beginPath();
|
|
569
|
+
for (const l of d) {
|
|
570
|
+
const c = Math.round(e.scale.toPx(l.workingTime)) + 0.5;
|
|
571
|
+
c < 0 || c > r || (o.moveTo(c, 0), o.lineTo(c, a));
|
|
538
572
|
}
|
|
539
|
-
|
|
573
|
+
o.stroke(), o.setLineDash([]);
|
|
540
574
|
}
|
|
541
575
|
}
|
|
542
|
-
function
|
|
576
|
+
function Gs(o, t) {
|
|
543
577
|
const e = t.view.nowX();
|
|
544
|
-
e !== null && (
|
|
578
|
+
e !== null && (o.fillStyle = t.colours.now, o.fillRect(e, 0, 2, t.view.height));
|
|
545
579
|
}
|
|
546
|
-
function
|
|
547
|
-
const
|
|
548
|
-
|
|
580
|
+
function $s(o, t, e, s) {
|
|
581
|
+
const n = t.colours.tasks.get(e.subtask.task) ?? t.colours.muted;
|
|
582
|
+
o.fillStyle = n;
|
|
549
583
|
for (const [i, r] of [
|
|
550
584
|
[e.outerFrom, e.mainFrom],
|
|
551
585
|
[e.mainTo, e.outerTo]
|
|
552
586
|
])
|
|
553
|
-
r <= i || (
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
function
|
|
557
|
-
if (
|
|
558
|
-
const s =
|
|
559
|
-
return { fill: s, onDark:
|
|
560
|
-
}
|
|
561
|
-
function
|
|
562
|
-
const s =
|
|
563
|
-
if (s === null ||
|
|
564
|
-
const i = (r) => Math.round(s[r] + (
|
|
587
|
+
r <= i || (o.globalAlpha = 0.28 * s, o.fillRect(i, e.y, r - i, e.height));
|
|
588
|
+
o.globalAlpha = s, o.fillRect(e.mainFrom, e.y, Math.max(1, e.mainTo - e.mainFrom), e.height), o.globalAlpha = 1;
|
|
589
|
+
}
|
|
590
|
+
function Yt(o, t, e) {
|
|
591
|
+
if (o.dashed) return { fill: null, onDark: !1 };
|
|
592
|
+
const s = o.muted ? Hs(t, e.surface, 0.5) : t;
|
|
593
|
+
return { fill: s, onDark: me(s, e.onAccent) > me(s, e.text) };
|
|
594
|
+
}
|
|
595
|
+
function Hs(o, t, e) {
|
|
596
|
+
const s = ut(o), n = ut(t);
|
|
597
|
+
if (s === null || n === null) return o;
|
|
598
|
+
const i = (r) => Math.round(s[r] + (n[r] - s[r]) * e);
|
|
565
599
|
return `rgb(${i(0)}, ${i(1)}, ${i(2)})`;
|
|
566
600
|
}
|
|
567
|
-
const
|
|
568
|
-
function
|
|
569
|
-
const { view:
|
|
570
|
-
if (!
|
|
601
|
+
const Ys = 2;
|
|
602
|
+
function Ge(o, t, e, s) {
|
|
603
|
+
const { view: n, colours: i } = t;
|
|
604
|
+
if (!At(e, n.width, n.height)) return;
|
|
571
605
|
if (e.miniature) {
|
|
572
|
-
|
|
606
|
+
$s(o, t, e, s);
|
|
573
607
|
return;
|
|
574
608
|
}
|
|
575
|
-
const r =
|
|
576
|
-
|
|
577
|
-
for (const [
|
|
609
|
+
const r = pt(e.subtask.appearance), a = i.tasks.get(e.subtask.task) ?? i.muted, h = Yt(r, a, i), d = e.y, l = e.height, c = Math.max(1, e.mainTo - e.mainFrom), p = h.onDark ? i.onAccent : i.text;
|
|
610
|
+
o.lineWidth = 1, o.fillStyle = a, o.strokeStyle = a;
|
|
611
|
+
for (const [y, C] of [
|
|
578
612
|
[e.outerFrom, e.mainFrom],
|
|
579
613
|
[e.mainTo, e.outerTo]
|
|
580
614
|
])
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
585
|
-
const
|
|
586
|
-
|
|
615
|
+
C <= y || (o.globalAlpha = 0.28 * s, o.fillRect(y, d, C - y, l), o.globalAlpha = s, o.strokeRect(y + 0.5, d + 0.5, C - y - 1, l - 1));
|
|
616
|
+
h.fill !== null && (o.globalAlpha = s, o.fillStyle = h.fill, o.fillRect(e.mainFrom, d, c, l));
|
|
617
|
+
const m = e.subtask.progress;
|
|
618
|
+
if (m !== void 0) {
|
|
619
|
+
const y = Math.min(4, Math.max(2, Math.round(l / 6))), C = d + l - y - Ys, S = Math.round(c * Math.max(0, Math.min(1, m)));
|
|
620
|
+
o.fillStyle = h.fill === null ? a : p, o.globalAlpha = 0.3 * s, o.fillRect(e.mainFrom, C, c, y), o.globalAlpha = s, S > 0 && o.fillRect(e.mainFrom, C, S, y);
|
|
587
621
|
}
|
|
588
622
|
if (r.hatched) {
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
r.open &&
|
|
593
|
-
}
|
|
594
|
-
const
|
|
595
|
-
function
|
|
596
|
-
|
|
597
|
-
for (let
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
function
|
|
602
|
-
const r = t.mainFrom < 0, a = t.mainTo > i,
|
|
603
|
-
r &&
|
|
604
|
-
}
|
|
605
|
-
function
|
|
606
|
-
const a =
|
|
607
|
-
a.addColorStop(0,
|
|
608
|
-
}
|
|
609
|
-
function
|
|
610
|
-
const e =
|
|
611
|
-
return e === null ?
|
|
612
|
-
}
|
|
613
|
-
function
|
|
614
|
-
const { data: i, colours: r } = t, a = i.
|
|
615
|
-
if (
|
|
616
|
-
|
|
623
|
+
const y = Math.max(1, Math.min(Ee, Math.floor((c - 2 * ot) / 3))), C = c >= 4 * y ? ot : 0, S = l >= 4 * ot ? ot : 0;
|
|
624
|
+
o.globalAlpha = s, o.fillStyle = p, o.fillRect(e.mainFrom + C, d + S, y, l - 2 * S), o.fillRect(e.mainTo - C - y, d + S, y, l - 2 * S);
|
|
625
|
+
}
|
|
626
|
+
r.open && Us(o, e, d, l, i.surface, n.width), r.dashed && (o.globalAlpha = s, o.strokeStyle = a, o.setLineDash([4, 3]), o.strokeRect(e.mainFrom + 0.5, d + 0.5, c - 1, l - 1), o.setLineDash([])), o.globalAlpha = 1, e.depth > 0 && s === 1 && (o.strokeStyle = i.surface, o.strokeRect(e.outerFrom - 0.5, d - 0.5, e.outerTo - e.outerFrom + 1, l + 1));
|
|
627
|
+
}
|
|
628
|
+
const $e = 6, Ks = 16;
|
|
629
|
+
function He(o, t, e, s, n, i, r, a, h) {
|
|
630
|
+
o.save(), o.beginPath(), o.rect(t, e, s, n), o.clip(), o.globalAlpha = 0.5 * r, o.strokeStyle = i, o.lineWidth = h, o.beginPath();
|
|
631
|
+
for (let d = t - n; d < t + s + n; d += a)
|
|
632
|
+
o.moveTo(d, e + n), o.lineTo(d + n, e);
|
|
633
|
+
o.stroke(), o.restore();
|
|
634
|
+
}
|
|
635
|
+
function Us(o, t, e, s, n, i) {
|
|
636
|
+
const r = t.mainFrom < 0, a = t.mainTo > i, h = Math.max(1, Math.min(t.mainTo, i) - Math.max(t.mainFrom, 0)), d = Math.min(Ks, h);
|
|
637
|
+
r && ke(o, 0, d, e, s, n, 1), a && ke(o, i, -d, e, s, n, 1);
|
|
638
|
+
}
|
|
639
|
+
function ke(o, t, e, s, n, i, r) {
|
|
640
|
+
const a = o.createLinearGradient(t, 0, t + e, 0);
|
|
641
|
+
a.addColorStop(0, ye(i, r)), a.addColorStop(1, ye(i, 0)), o.globalAlpha = 1, o.fillStyle = a, o.fillRect(Math.min(t, t + e), s, Math.abs(e), n);
|
|
642
|
+
}
|
|
643
|
+
function ye(o, t) {
|
|
644
|
+
const e = ut(o);
|
|
645
|
+
return e === null ? o : `rgba(${e[0]}, ${e[1]}, ${e[2]}, ${t})`;
|
|
646
|
+
}
|
|
647
|
+
function Dt(o, t, e, s, n) {
|
|
648
|
+
const { data: i, colours: r } = t, a = i.taskOfDependency(e.dependency), h = n ?? i.violatedById.has(e.dependency.id), d = a !== null && a === t.selectedTask, l = h ? r.alarm : (a !== null ? r.tasks.get(a) : void 0) ?? r.muted;
|
|
649
|
+
if (o.strokeStyle = l, o.fillStyle = l, o.lineWidth = s || d ? 2 : 1.25, o.setLineDash(h ? [4, 3] : []), o.beginPath(), o.moveTo(e.x1, e.y1), e.kind === "curve")
|
|
650
|
+
o.bezierCurveTo(e.c1x, e.y1, e.c2x, e.y2, e.x2, e.y2);
|
|
617
651
|
else
|
|
618
|
-
for (let
|
|
619
|
-
if (
|
|
620
|
-
for (const [
|
|
652
|
+
for (let c = 2; c + 1 < e.points.length; c += 2) o.lineTo(e.points[c], e.points[c + 1]);
|
|
653
|
+
if (o.stroke(), o.setLineDash([]), e.ends === "dot")
|
|
654
|
+
for (const [c, p] of [
|
|
621
655
|
[e.x1, e.y1],
|
|
622
656
|
[e.x2, e.y2]
|
|
623
657
|
])
|
|
624
|
-
|
|
658
|
+
o.beginPath(), o.arc(c, p, h ? 3 : 2.5, 0, Math.PI * 2), o.fill();
|
|
625
659
|
}
|
|
626
|
-
function
|
|
660
|
+
function Xs(o, t, e) {
|
|
627
661
|
const { data: s } = t;
|
|
628
|
-
if (s.
|
|
629
|
-
n
|
|
630
|
-
|
|
631
|
-
const i = s.transports.find((d) => d.id === o.transport), r = i === void 0 ? void 0 : s.subtaskById.get(i.to);
|
|
662
|
+
if (s.violatedById.size !== 0)
|
|
663
|
+
for (const n of s.violatedById.values()) {
|
|
664
|
+
const i = s.dependencies.find((c) => c.id === n.dependency), r = i === void 0 ? void 0 : s.subtaskById.get(i.to);
|
|
632
665
|
if (r === void 0) continue;
|
|
633
|
-
const a =
|
|
666
|
+
const a = at(e, r.lane);
|
|
634
667
|
if (a === null || !a.miniature) continue;
|
|
635
|
-
const
|
|
636
|
-
if (
|
|
637
|
-
const
|
|
638
|
-
|
|
668
|
+
const h = Z(e.rows, a.top + e.scrollY);
|
|
669
|
+
if (h === null) continue;
|
|
670
|
+
const d = E(e, n.arrival), l = Math.max(d + 2, E(e, n.arrival + n.shortBy));
|
|
671
|
+
Ft(o, t, d, l, h.top - e.scrollY + 1, 3);
|
|
639
672
|
}
|
|
673
|
+
}
|
|
674
|
+
function Ft(o, t, e, s, n, i) {
|
|
675
|
+
if (!t.colours.forced) {
|
|
676
|
+
o.fillStyle = t.colours.alarm, o.fillRect(e, n, s - e, i);
|
|
677
|
+
return;
|
|
640
678
|
}
|
|
679
|
+
o.strokeStyle = t.colours.alarm, o.lineWidth = i, o.setLineDash([4, 3]), o.beginPath(), o.moveTo(e, n + i / 2), o.lineTo(s, n + i / 2), o.stroke(), o.setLineDash([]);
|
|
641
680
|
}
|
|
642
|
-
function
|
|
643
|
-
const
|
|
644
|
-
if (
|
|
645
|
-
const i =
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
681
|
+
function Ws(o, t, e, s) {
|
|
682
|
+
const n = at(e, s.lane);
|
|
683
|
+
if (n === null || n.top + n.height < 0 || n.top > t.view.height) return;
|
|
684
|
+
const i = Math.max(0, E(e, s.from)), r = Math.min(t.view.width, E(e, s.to));
|
|
685
|
+
r <= i || (o.globalAlpha = 0.1, o.fillStyle = t.colours.muted, o.fillRect(i, n.top, r - i, n.height), o.globalAlpha = 1, He(o, i, n.top, r - i, n.height, t.colours.muted, 0.7, $e, 1));
|
|
686
|
+
}
|
|
687
|
+
function Ot(o, t, e, s) {
|
|
688
|
+
const n = at(e, s.lane);
|
|
689
|
+
if (n === null) return;
|
|
690
|
+
const i = E(e, s.from), r = Math.max(i + 2, E(e, s.to));
|
|
691
|
+
if (o.fillStyle = t.colours.alarm, o.globalAlpha = 0.14, o.fillRect(i, n.top + 1, r - i, Math.max(1, n.height - 2)), o.globalAlpha = 1, Ft(o, t, i, r, n.top + 1, Math.min(3, Math.max(1, n.height - 1))), n.miniature) {
|
|
692
|
+
const a = Z(e.rows, n.top + e.scrollY);
|
|
693
|
+
a !== null && Ft(o, t, i, r, a.top - e.scrollY + 1, 3);
|
|
649
694
|
}
|
|
650
695
|
}
|
|
651
|
-
function
|
|
652
|
-
const { colours: s } = t,
|
|
653
|
-
|
|
696
|
+
function zs(o, t, e) {
|
|
697
|
+
const { colours: s } = t, n = pt(e.subtask.appearance), i = Yt(n, s.tasks.get(e.subtask.task) ?? s.muted, s);
|
|
698
|
+
if (s.forced) {
|
|
699
|
+
o.strokeStyle = s.active, o.lineWidth = 2, o.strokeRect(e.outerFrom - 2, e.y - 2, Math.max(1, e.outerTo - e.outerFrom) + 4, e.height + 4);
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
o.globalAlpha = Vs, o.fillStyle = i.onDark ? s.onAccent : s.text, o.fillRect(e.outerFrom, e.y, Math.max(1, e.outerTo - e.outerFrom), e.height), o.globalAlpha = 1;
|
|
654
703
|
}
|
|
655
|
-
const
|
|
656
|
-
function
|
|
704
|
+
const Vs = 0.2;
|
|
705
|
+
function js(o, t) {
|
|
657
706
|
const e = t.selectedTask;
|
|
658
707
|
if (e !== null) {
|
|
659
|
-
|
|
708
|
+
o.strokeStyle = t.colours.text;
|
|
660
709
|
for (const s of t.view.boxes) {
|
|
661
710
|
if (s.subtask.task !== e) continue;
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
const i =
|
|
665
|
-
|
|
711
|
+
const n = s.subtask.id === t.selectedSubtask;
|
|
712
|
+
o.lineWidth = n ? 2 : 1;
|
|
713
|
+
const i = n ? 1 : 0.5;
|
|
714
|
+
o.strokeRect(s.outerFrom - i, s.y - i, s.outerTo - s.outerFrom + 2 * i, s.height + 2 * i);
|
|
666
715
|
}
|
|
667
716
|
}
|
|
668
717
|
}
|
|
669
|
-
const
|
|
670
|
-
function
|
|
671
|
-
if (!(t > 2 *
|
|
672
|
-
const e =
|
|
673
|
-
if (
|
|
674
|
-
const i = Math.min(1,
|
|
718
|
+
const dt = 32, qs = 18;
|
|
719
|
+
function ve(o, t) {
|
|
720
|
+
if (!(t > 2 * dt)) return 0;
|
|
721
|
+
const e = dt - o, s = o - (t - dt), n = Math.max(e, s);
|
|
722
|
+
if (n <= 0) return 0;
|
|
723
|
+
const i = Math.min(1, n / dt), r = qs * i * i;
|
|
675
724
|
return e > 0 ? -r : r;
|
|
676
725
|
}
|
|
677
|
-
function
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
return o;
|
|
726
|
+
function it(o, t, e) {
|
|
727
|
+
const s = (n, i) => {
|
|
728
|
+
const r = J(n);
|
|
729
|
+
return n.lane === i.lane && r.from < i.to && i.from < r.to;
|
|
730
|
+
};
|
|
731
|
+
return e.some((n) => s(o, n) && !(t !== null && s(t, n)));
|
|
732
|
+
}
|
|
733
|
+
function Zs(o, t, e, s) {
|
|
734
|
+
const n = /* @__PURE__ */ new Set();
|
|
735
|
+
if (s === void 0) return n;
|
|
736
|
+
for (const i of o)
|
|
737
|
+
i !== e && (s(t, i) || n.add(i));
|
|
738
|
+
return n;
|
|
683
739
|
}
|
|
684
|
-
function
|
|
740
|
+
function Js(o, t) {
|
|
685
741
|
const { step: e, offset: s } = typeof t == "number" ? { step: t, offset: 0 } : t;
|
|
686
|
-
if (!(e > 0) || !Number.isFinite(
|
|
687
|
-
const
|
|
688
|
-
return
|
|
742
|
+
if (!(e > 0) || !Number.isFinite(o)) return o;
|
|
743
|
+
const n = _e(o) + s;
|
|
744
|
+
return n + Math.round((o - n) / e) * e;
|
|
689
745
|
}
|
|
690
|
-
const
|
|
691
|
-
function
|
|
692
|
-
switch (
|
|
746
|
+
const we = "\0placing", be = /* @__PURE__ */ new Set();
|
|
747
|
+
function Lt(o) {
|
|
748
|
+
switch (o.kind) {
|
|
693
749
|
case "subtask":
|
|
694
|
-
return `subtask:${
|
|
695
|
-
case "
|
|
696
|
-
return `
|
|
750
|
+
return `subtask:${o.subtask.id}:${o.part}`;
|
|
751
|
+
case "dependency":
|
|
752
|
+
return `dependency:${o.dependency.id}`;
|
|
697
753
|
case "lane":
|
|
698
|
-
return `lane:${
|
|
754
|
+
return `lane:${o.lane}`;
|
|
699
755
|
default:
|
|
700
756
|
return "nothing";
|
|
701
757
|
}
|
|
702
758
|
}
|
|
703
|
-
const
|
|
704
|
-
class
|
|
759
|
+
const Me = 3, Qs = 10, tn = 600;
|
|
760
|
+
class en {
|
|
705
761
|
constructor(t) {
|
|
706
762
|
f(this, "gesture", { kind: "none" });
|
|
707
763
|
f(this, "touches", /* @__PURE__ */ new Map());
|
|
@@ -714,6 +770,9 @@ class Bs {
|
|
|
714
770
|
to. It is a fact about the pointer and not about the ghost, which stayed
|
|
715
771
|
where it was allowed. */
|
|
716
772
|
f(this, "refused", !1);
|
|
773
|
+
/** Whether the pointer last stood where the dragged work would cover blocked
|
|
774
|
+
time - as `refused`, a fact about the pointer and not about the ghost. */
|
|
775
|
+
f(this, "blocked", !1);
|
|
717
776
|
/** Where the pointer stands on the plot while a drag is in flight - what the
|
|
718
777
|
tether is drawn to, since the ghost is not following it. */
|
|
719
778
|
f(this, "dragPoint", { x: 0, y: 0 });
|
|
@@ -721,8 +780,13 @@ class Bs {
|
|
|
721
780
|
open it for this gesture. */
|
|
722
781
|
f(this, "resting", null);
|
|
723
782
|
f(this, "hover", { kind: "nothing" });
|
|
724
|
-
/** Where the pointer rests on the plot while nothing is being dragged
|
|
783
|
+
/** Where the pointer rests on the plot while nothing is being dragged - or,
|
|
784
|
+
where the keyboard set the hover, the point its tooltip stands at. */
|
|
725
785
|
f(this, "hoverPoint", { x: 0, y: 0 });
|
|
786
|
+
/** Whether the keyboard set the hover (ADR-0030): pointer and keys share one
|
|
787
|
+
**Active subtask**, and the last input wins. The keys' hover stays when
|
|
788
|
+
the pointer leaves, and the pointer takes it over by moving. */
|
|
789
|
+
f(this, "byKeyboard", !1);
|
|
726
790
|
f(this, "cursor", "default");
|
|
727
791
|
this.host = t;
|
|
728
792
|
}
|
|
@@ -743,55 +807,56 @@ class Bs {
|
|
|
743
807
|
return {
|
|
744
808
|
ghost: t.ghost,
|
|
745
809
|
overlaps: e.overlaps,
|
|
746
|
-
|
|
810
|
+
violated: e.violated,
|
|
747
811
|
refusedLanes: t.refused,
|
|
748
812
|
/* The tether is drawn only while the pointer really stands on a refused
|
|
749
813
|
lane: the marked lanes say where the work may not go, the tether says
|
|
750
814
|
that the ghost is held on purpose right now. */
|
|
751
|
-
tether: this.refused ? this.dragPoint : null
|
|
815
|
+
tether: this.refused || this.blocked ? this.dragPoint : null
|
|
752
816
|
};
|
|
753
817
|
}
|
|
754
818
|
ghostSummary() {
|
|
755
819
|
const t = this.gesture;
|
|
756
820
|
if (t.kind !== "edit" && t.kind !== "place") return null;
|
|
757
|
-
const e =
|
|
821
|
+
const e = xe(this.host.view.viewport(), t.ghost);
|
|
758
822
|
if (e === null) return null;
|
|
759
|
-
const s = this.ghostFindings(t.ghost, this.ghostHome(t)),
|
|
823
|
+
const s = this.ghostFindings(t.ghost, this.ghostHome(t)), n = t.kind === "edit" && (t.mode === "leadIn" || t.mode === "leadOut"), i = n ? J(t.ghost) : t.ghost;
|
|
760
824
|
return {
|
|
761
825
|
refused: this.refused,
|
|
762
826
|
refusedLanes: [...t.refused],
|
|
763
|
-
|
|
827
|
+
blocked: this.blocked,
|
|
828
|
+
x: n ? e.outerFrom : e.mainFrom,
|
|
764
829
|
y: e.y,
|
|
765
830
|
height: e.height,
|
|
766
831
|
from: i.from,
|
|
767
832
|
to: i.to,
|
|
768
833
|
overlap: s.overlaps.length > 0,
|
|
769
|
-
|
|
834
|
+
violated: s.violated.length > 0
|
|
770
835
|
};
|
|
771
836
|
}
|
|
772
837
|
/* ---------------------------------------------------------------- */
|
|
773
838
|
/* Pointer */
|
|
774
839
|
/* ---------------------------------------------------------------- */
|
|
775
840
|
local(t, e) {
|
|
776
|
-
var
|
|
777
|
-
const s = (
|
|
841
|
+
var n;
|
|
842
|
+
const s = (n = this.host.plotElement()) == null ? void 0 : n.getBoundingClientRect();
|
|
778
843
|
return { x: t - ((s == null ? void 0 : s.left) ?? 0), y: e - ((s == null ? void 0 : s.top) ?? 0) };
|
|
779
844
|
}
|
|
780
|
-
report(t, e, s,
|
|
781
|
-
var
|
|
845
|
+
report(t, e, s, n, i, r) {
|
|
846
|
+
var h, d;
|
|
782
847
|
const a = this.host.view;
|
|
783
|
-
(
|
|
848
|
+
(d = (h = this.host.handlers()).onInteraction) == null || d.call(h, { type: t, hit: e, clientX: s, clientY: n, time: a.timeAt(i), lane: a.laneIdAt(r) });
|
|
784
849
|
}
|
|
785
850
|
pointerDown(t) {
|
|
786
|
-
var a,
|
|
851
|
+
var a, h, d, l, c;
|
|
787
852
|
const { x: e, y: s } = this.local(t.clientX, t.clientY);
|
|
788
853
|
if (t.pointerType === "touch" && (this.touches.set(t.pointerId, { x: e, y: s }), this.touches.size >= 2)) {
|
|
789
854
|
this.gesture.kind !== "pinch" && (this.cancelEdit(), this.gesture = { kind: "pinch", distance: this.touchDistance() });
|
|
790
855
|
return;
|
|
791
856
|
}
|
|
792
857
|
if (t.button !== 0) return;
|
|
793
|
-
const
|
|
794
|
-
t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: "pan", subtask: null } : (
|
|
858
|
+
const n = (d = (h = (a = t.target) == null ? void 0 : a.closest) == null ? void 0 : h.call(a, "[data-grip]")) == null ? void 0 : d.getAttribute("data-grip"), i = this.host.selectedSubtask(), r = i !== null ? this.host.data.subtaskById.get(i) ?? null : null;
|
|
859
|
+
t.pointerType === "touch" ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: "pan", subtask: null } : (n === "leadIn" || n === "leadOut") && r !== null ? this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, mode: n, subtask: r } : this.gesture = { kind: "pending", pointerId: t.pointerId, x0: e, y0: s, ...this.modeAt(e, s) }, (c = (l = this.host.plotElement()) == null ? void 0 : l.setPointerCapture) == null || c.call(l, t.pointerId);
|
|
795
860
|
}
|
|
796
861
|
/** A drag over a folded group: resting on one opens it for the GESTURE.
|
|
797
862
|
|
|
@@ -801,13 +866,13 @@ class Bs {
|
|
|
801
866
|
never written to and no change is reported, because the application did
|
|
802
867
|
not fold anything (ADR-0025). */
|
|
803
868
|
restOver(t) {
|
|
804
|
-
var
|
|
869
|
+
var n;
|
|
805
870
|
const e = this.host.view, s = e.foldedGroupAt(t);
|
|
806
|
-
s !== ((
|
|
871
|
+
s !== ((n = this.resting) == null ? void 0 : n.group) && (this.stopResting(), s !== null && (this.resting = {
|
|
807
872
|
group: s,
|
|
808
873
|
timer: setTimeout(() => {
|
|
809
874
|
this.resting = null, e.openForGesture = /* @__PURE__ */ new Set([...e.openForGesture, s]), this.host.viewChanged();
|
|
810
|
-
},
|
|
875
|
+
}, tn)
|
|
811
876
|
}));
|
|
812
877
|
}
|
|
813
878
|
stopResting() {
|
|
@@ -829,28 +894,28 @@ class Bs {
|
|
|
829
894
|
lane is open. Asked at a drop, where the answer has to be current; while
|
|
830
895
|
a drag runs, the held set answers instead. */
|
|
831
896
|
allowed(t, e) {
|
|
832
|
-
var s,
|
|
833
|
-
return ((
|
|
897
|
+
var s, n;
|
|
898
|
+
return ((n = (s = this.host.handlers()).canMoveTo) == null ? void 0 : n.call(s, t, e)) ?? !0;
|
|
834
899
|
}
|
|
835
900
|
/** The lanes this work may not go to, for the gesture that is beginning. A
|
|
836
901
|
gesture that cannot change a lane at all asks nothing: the intents the
|
|
837
902
|
caller handles decide whether the question exists. */
|
|
838
903
|
askRefused(t, e) {
|
|
839
|
-
if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return
|
|
840
|
-
const s = this.host.data.lanes.map((
|
|
841
|
-
return
|
|
904
|
+
if (!this.host.view.options.intents.includes(e === null ? "place" : "lane")) return be;
|
|
905
|
+
const s = this.host.data.lanes.map((n) => n.id);
|
|
906
|
+
return Zs(s, t, e, this.host.handlers().canMoveTo);
|
|
842
907
|
}
|
|
843
908
|
/** What a press at a point would start, given the intents the caller handles. */
|
|
844
909
|
modeAt(t, e) {
|
|
845
|
-
const s = this.host.view,
|
|
910
|
+
const s = this.host.view, n = s.options.intents;
|
|
846
911
|
for (let i = s.boxes.length - 1; i >= 0; i--) {
|
|
847
912
|
const r = s.boxes[i];
|
|
848
|
-
if (
|
|
849
|
-
const a =
|
|
913
|
+
if (n.includes("stretch")) {
|
|
914
|
+
const a = Ts(r, t, e);
|
|
850
915
|
if (a !== null) return { mode: a === "from" ? "stretch-from" : "stretch-to", subtask: r.subtask };
|
|
851
916
|
}
|
|
852
|
-
if (
|
|
853
|
-
return
|
|
917
|
+
if (Pe(r, t, e) !== null)
|
|
918
|
+
return n.includes("move") || n.includes("lane") ? { mode: "move", subtask: r.subtask } : { mode: "pan", subtask: r.subtask };
|
|
854
919
|
}
|
|
855
920
|
return { mode: "pan", subtask: null };
|
|
856
921
|
}
|
|
@@ -861,24 +926,24 @@ class Bs {
|
|
|
861
926
|
r > 0 && this.gesture.distance > 0 && this.host.view.zoomAt(this.touchCentre(), this.gesture.distance / r) && this.host.viewMoved(!0), this.gesture = { kind: "pinch", distance: r };
|
|
862
927
|
return;
|
|
863
928
|
}
|
|
864
|
-
const
|
|
865
|
-
if (
|
|
866
|
-
if (Math.hypot(e -
|
|
867
|
-
if (
|
|
868
|
-
this.gesture = { kind: "pan", pointerId:
|
|
929
|
+
const n = this.gesture;
|
|
930
|
+
if (n.kind === "pending" && n.pointerId === t.pointerId) {
|
|
931
|
+
if (Math.hypot(e - n.x0, s - n.y0) < (t.pointerType === "touch" ? Qs : Me)) return;
|
|
932
|
+
if (n.mode === "pan" || n.subtask === null)
|
|
933
|
+
this.gesture = { kind: "pan", pointerId: n.pointerId, lastX: n.x0, lastY: n.y0 }, this.setCursor("grabbing");
|
|
869
934
|
else {
|
|
870
|
-
const r = this.host.view.viewport().scale.fromPx(
|
|
935
|
+
const r = this.host.view.viewport().scale.fromPx(n.x0);
|
|
871
936
|
this.gesture = {
|
|
872
937
|
kind: "edit",
|
|
873
|
-
pointerId:
|
|
874
|
-
mode:
|
|
875
|
-
subtask:
|
|
938
|
+
pointerId: n.pointerId,
|
|
939
|
+
mode: n.mode,
|
|
940
|
+
subtask: n.subtask,
|
|
876
941
|
t0: r,
|
|
877
|
-
ghost:
|
|
942
|
+
ghost: n.subtask,
|
|
878
943
|
/* Asked here, once, and drawn from the first frame of the drag: the
|
|
879
944
|
lanes that are closed are marked before the pointer reaches one. */
|
|
880
|
-
refused:
|
|
881
|
-
}, this.setCursor(
|
|
945
|
+
refused: n.mode === "move" ? this.askRefused(n.subtask, n.subtask.lane) : be
|
|
946
|
+
}, this.setCursor(n.mode === "move" ? "grabbing" : "ew-resize");
|
|
882
947
|
}
|
|
883
948
|
}
|
|
884
949
|
const i = this.gesture;
|
|
@@ -888,10 +953,10 @@ class Bs {
|
|
|
888
953
|
return;
|
|
889
954
|
}
|
|
890
955
|
if (i.kind === "edit" && i.pointerId === t.pointerId) {
|
|
891
|
-
this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: e, y: s }, this.restOver(s), this.gesture = { ...i, ghost: this.
|
|
956
|
+
this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: e, y: s }, this.restOver(s), this.gesture = { ...i, ghost: this.heldGhost(i, e, s) }, this.setCursor(this.refused || this.blocked ? "not-allowed" : i.mode === "move" ? "grabbing" : "ew-resize"), this.host.interactionChanged(), this.autoPan();
|
|
892
957
|
return;
|
|
893
958
|
}
|
|
894
|
-
i.kind === "none" && this.hoverAt(t.clientX, t.clientY, e, s);
|
|
959
|
+
i.kind === "none" && (this.byKeyboard = !1, this.hoverAt(t.clientX, t.clientY, e, s));
|
|
895
960
|
}
|
|
896
961
|
pointerUp(t) {
|
|
897
962
|
var i, r;
|
|
@@ -900,18 +965,18 @@ class Bs {
|
|
|
900
965
|
this.touches.size === 1 && a !== void 0 ? this.gesture = { kind: "pan", pointerId: a[0], lastX: a[1].x, lastY: a[1].y } : this.touches.size === 0 && (this.gesture = { kind: "none" });
|
|
901
966
|
return;
|
|
902
967
|
}
|
|
903
|
-
const e = this.gesture, { x: s, y:
|
|
968
|
+
const e = this.gesture, { x: s, y: n } = this.local(t.clientX, t.clientY);
|
|
904
969
|
if (e.kind === "pending" && e.pointerId === t.pointerId)
|
|
905
|
-
this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, s,
|
|
970
|
+
this.gesture = { kind: "none" }, this.click(t.clientX, t.clientY, s, n);
|
|
906
971
|
else if (e.kind === "pan" && e.pointerId === t.pointerId)
|
|
907
|
-
this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, s,
|
|
972
|
+
this.gesture = { kind: "none" }, this.setCursor("default"), this.hoverAt(t.clientX, t.clientY, s, n);
|
|
908
973
|
else if (e.kind === "edit" && e.pointerId === t.pointerId) {
|
|
909
974
|
this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" };
|
|
910
|
-
const a = e.ghost.lane === e.subtask.lane || this.allowed(e.subtask, e.ghost.lane),
|
|
911
|
-
(
|
|
975
|
+
const a = e.ghost.lane === e.subtask.lane || this.allowed(e.subtask, e.ghost.lane), h = this.intentsOf(e.subtask, e.ghost, e.mode).filter(
|
|
976
|
+
(d) => a || d.kind !== "lane"
|
|
912
977
|
);
|
|
913
|
-
this.refused = !1, this.cursor = "default", this.host.interactionChanged();
|
|
914
|
-
for (const
|
|
978
|
+
this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged();
|
|
979
|
+
for (const d of h) (r = (i = this.host.handlers()).onIntent) == null || r.call(i, d);
|
|
915
980
|
}
|
|
916
981
|
}
|
|
917
982
|
/** While a drag is in flight near an edge, pans along once per frame and
|
|
@@ -923,17 +988,17 @@ class Bs {
|
|
|
923
988
|
this.panFrame = 0;
|
|
924
989
|
const e = this.gesture;
|
|
925
990
|
if (e.kind !== "edit" && e.kind !== "place") return;
|
|
926
|
-
const s = this.host.view, { x:
|
|
991
|
+
const s = this.host.view, { x: n, y: i } = this.local(this.lastClient.x, this.lastClient.y), r = ve(n, s.width), a = ve(i, s.height);
|
|
927
992
|
if (r === 0 && a === 0) return;
|
|
928
|
-
const
|
|
929
|
-
if (
|
|
930
|
-
if (this.dragPoint = { x:
|
|
931
|
-
this.gesture = { ...e, ghost: this.
|
|
993
|
+
const h = s.pan(r, a);
|
|
994
|
+
if (h.moved) {
|
|
995
|
+
if (this.dragPoint = { x: n, y: i }, e.kind === "edit")
|
|
996
|
+
this.gesture = { ...e, ghost: this.heldGhost(e, n, i) };
|
|
932
997
|
else {
|
|
933
|
-
const
|
|
934
|
-
this.refused =
|
|
998
|
+
const d = this.placeGhost(e.item, n, i, e.refused);
|
|
999
|
+
this.refused = d.refused, this.blocked = d.blocked, this.gesture = { ...e, ghost: d.ghost ?? e.ghost };
|
|
935
1000
|
}
|
|
936
|
-
this.host.viewMoved(
|
|
1001
|
+
this.host.viewMoved(h.time), this.panFrame = requestAnimationFrame(t);
|
|
937
1002
|
}
|
|
938
1003
|
};
|
|
939
1004
|
this.panFrame = requestAnimationFrame(t);
|
|
@@ -949,17 +1014,17 @@ class Bs {
|
|
|
949
1014
|
pointer without the pointer moving, and a tooltip still naming the old
|
|
950
1015
|
times would be a lie. Nothing is reported: no interaction happened. */
|
|
951
1016
|
refreshHover() {
|
|
952
|
-
if (!this.idle || this.hoverKey === "nothing") return;
|
|
1017
|
+
if (!this.idle || this.hoverKey === "nothing" || this.byKeyboard) return;
|
|
953
1018
|
const { x: t, y: e } = this.hoverPoint, s = this.host.view.hitAt(t, e);
|
|
954
|
-
this.hover = s, this.hoverKey =
|
|
1019
|
+
this.hover = s, this.hoverKey = Lt(s);
|
|
955
1020
|
}
|
|
956
1021
|
pointerLeave() {
|
|
957
|
-
this.gesture.kind
|
|
1022
|
+
this.gesture.kind !== "none" || this.byKeyboard || this.setHover({ kind: "nothing" }, "nothing");
|
|
958
1023
|
}
|
|
959
1024
|
/** Escape while a drag is in flight: the ghost goes, and nothing is reported.
|
|
960
1025
|
It ends a drag from outside as it ends one inside. */
|
|
961
1026
|
cancelEdit() {
|
|
962
|
-
return this.gesture.kind !== "edit" && this.gesture.kind !== "place" ? !1 : (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.cursor = "default", this.host.interactionChanged(), !0);
|
|
1027
|
+
return this.gesture.kind !== "edit" && this.gesture.kind !== "place" ? !1 : (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !0);
|
|
963
1028
|
}
|
|
964
1029
|
contextMenu(t) {
|
|
965
1030
|
if (this.host.handlers().onInteraction === void 0) return;
|
|
@@ -972,36 +1037,42 @@ class Bs {
|
|
|
972
1037
|
their end; Ctrl or ⌘ zooms - a trackpad pinch arrives as a wheel with
|
|
973
1038
|
Ctrl -; horizontal or Shift pans through time. */
|
|
974
1039
|
wheel(t) {
|
|
975
|
-
const e = this.host.view, s = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)),
|
|
1040
|
+
const e = this.host.view, s = Math.max(0, Math.min(e.width, this.local(t.clientX, t.clientY).x)), n = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? e.height : 1, i = t.deltaX * n, r = t.deltaY * n;
|
|
976
1041
|
if (t.ctrlKey || t.metaKey) {
|
|
977
1042
|
t.preventDefault();
|
|
978
|
-
const
|
|
979
|
-
e.zoomAt(s, Math.exp(r *
|
|
1043
|
+
const d = Math.abs(r) < 50 ? 0.01 : 15e-4;
|
|
1044
|
+
e.zoomAt(s, Math.exp(r * d)) && this.host.viewMoved(!0);
|
|
980
1045
|
return;
|
|
981
1046
|
}
|
|
982
1047
|
if (Math.abs(i) > Math.abs(r) || t.shiftKey) {
|
|
983
1048
|
t.preventDefault();
|
|
984
|
-
const
|
|
985
|
-
|
|
1049
|
+
const d = e.pan(t.shiftKey && i === 0 ? r : i, 0);
|
|
1050
|
+
d.moved && this.host.viewMoved(d.time);
|
|
986
1051
|
return;
|
|
987
1052
|
}
|
|
988
1053
|
const a = r > 0 ? e.maxScroll() - e.scrollY : e.scrollY;
|
|
989
1054
|
if (r === 0 || a <= 0) return;
|
|
990
1055
|
t.preventDefault();
|
|
991
|
-
const
|
|
992
|
-
|
|
1056
|
+
const h = e.pan(0, r);
|
|
1057
|
+
h.moved && this.host.viewMoved(h.time);
|
|
993
1058
|
}
|
|
994
|
-
click(t, e, s,
|
|
995
|
-
const i = this.host.view.hitAt(s,
|
|
996
|
-
this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, s,
|
|
1059
|
+
click(t, e, s, n) {
|
|
1060
|
+
const i = this.host.view.hitAt(s, n), r = i.kind === "subtask" ? i.subtask.task : i.kind === "dependency" ? this.host.data.taskOfDependency(i.dependency) : null;
|
|
1061
|
+
this.host.select(r, i.kind === "subtask" ? i.subtask.id : null), this.report("click", i, t, e, s, n);
|
|
997
1062
|
}
|
|
998
|
-
hoverAt(t, e, s,
|
|
999
|
-
const i = this.host.view.hitAt(s,
|
|
1000
|
-
if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: s, y:
|
|
1001
|
-
(i.kind === "subtask" || i.kind === "
|
|
1063
|
+
hoverAt(t, e, s, n) {
|
|
1064
|
+
const i = this.host.view.hitAt(s, n), r = Lt(i), { mode: a } = this.modeAt(s, n);
|
|
1065
|
+
if (this.setCursor(a === "move" ? "grab" : a === "stretch-from" || a === "stretch-to" ? "ew-resize" : "default"), this.hoverPoint = { x: s, y: n }, r === this.hoverKey) {
|
|
1066
|
+
(i.kind === "subtask" || i.kind === "dependency") && this.host.interactionChanged();
|
|
1002
1067
|
return;
|
|
1003
1068
|
}
|
|
1004
|
-
this.setHover(i, r), this.report("hover", i, t, e, s,
|
|
1069
|
+
this.setHover(i, r), this.report("hover", i, t, e, s, n);
|
|
1070
|
+
}
|
|
1071
|
+
/** The keyboard sets the hover: drawn, and its tooltip shown, as the
|
|
1072
|
+
pointer's would be - and reported to nobody, since `onInteraction`
|
|
1073
|
+
speaks of pointer positions. `nothing` hands the hover back. */
|
|
1074
|
+
setKeyboardHover(t, e) {
|
|
1075
|
+
this.byKeyboard = t.kind !== "nothing", this.hoverPoint = e, this.hover = t, this.hoverKey = Lt(t), this.host.interactionChanged();
|
|
1005
1076
|
}
|
|
1006
1077
|
setHover(t, e) {
|
|
1007
1078
|
e !== this.hoverKey && (this.hoverKey = e, this.hover = t, this.host.interactionChanged());
|
|
@@ -1026,7 +1097,7 @@ class Bs {
|
|
|
1026
1097
|
dragOver(t, e) {
|
|
1027
1098
|
const s = this.host.view;
|
|
1028
1099
|
if (e === null || !s.options.intents.includes("place")) return;
|
|
1029
|
-
const { x:
|
|
1100
|
+
const { x: n, y: i } = this.local(t.clientX, t.clientY);
|
|
1030
1101
|
if (s.laneIdAt(i) === null && s.foldedGroupAt(i) === null) {
|
|
1031
1102
|
this.clearPlacing();
|
|
1032
1103
|
return;
|
|
@@ -1037,32 +1108,36 @@ class Bs {
|
|
|
1037
1108
|
pointer is not over one either, the rule is asked about an item
|
|
1038
1109
|
whose own lane is empty - which is the truth of it: `canMoveTo`
|
|
1039
1110
|
is asked ABOUT a lane, and the one this item is on is none. */
|
|
1040
|
-
this.askRefused(this.askedFor(e, this.onLane(i) ?? "",
|
|
1041
|
-
), a = this.placeGhost(e,
|
|
1042
|
-
this.refused = a.refused, this.setCursor(a.refused ? "not-allowed" : "default");
|
|
1043
|
-
const
|
|
1044
|
-
t.dataTransfer !== null && (t.dataTransfer.dropEffect =
|
|
1111
|
+
this.askRefused(this.askedFor(e, this.onLane(i) ?? "", n), null)
|
|
1112
|
+
), a = this.placeGhost(e, n, i, r);
|
|
1113
|
+
this.refused = a.refused, this.blocked = a.blocked, this.setCursor(a.refused || a.blocked ? "not-allowed" : "default");
|
|
1114
|
+
const h = this.gesture.kind === "place" ? this.gesture.ghost : null, d = a.ghost ?? (a.refused || a.blocked ? h : null);
|
|
1115
|
+
t.dataTransfer !== null && (t.dataTransfer.dropEffect = d === null ? "none" : "copy"), d !== null && (this.lastClient = { x: t.clientX, y: t.clientY }, this.dragPoint = { x: n, y: i }, this.gesture = { kind: "place", ghost: d, item: e, refused: r }, this.host.interactionChanged(), this.autoPan());
|
|
1045
1116
|
}
|
|
1046
1117
|
/** The ghost of a drag from outside at a point on the plot: none off the
|
|
1047
|
-
lanes,
|
|
1048
|
-
|
|
1049
|
-
|
|
1118
|
+
lanes, none where the caller refuses that lane and none where it would
|
|
1119
|
+
cover blocked time - which the answer says apart, because they mean
|
|
1120
|
+
different things to the drag. */
|
|
1121
|
+
placeGhost(t, e, s, n) {
|
|
1050
1122
|
const i = this.onLane(s);
|
|
1051
|
-
|
|
1123
|
+
if (i === null) return { ghost: null, refused: !1, blocked: !1 };
|
|
1124
|
+
if (n.has(i)) return { ghost: null, refused: !0, blocked: !1 };
|
|
1125
|
+
const r = { ...this.askedFor(t, i, e), id: we };
|
|
1126
|
+
return it(r, null, this.host.data.blocked) ? { ghost: null, refused: !1, blocked: !0 } : { ghost: r, refused: !1, blocked: !1 };
|
|
1052
1127
|
}
|
|
1053
1128
|
/** The dragged item as a subtask, under the caller's key for it - not the
|
|
1054
1129
|
internal sentinel: the rule is asked about the thing the application says
|
|
1055
1130
|
it is dragging, and the ghost only afterwards takes the sentinel. */
|
|
1056
1131
|
askedFor(t, e, s) {
|
|
1057
|
-
const
|
|
1132
|
+
const n = this.snapInside(this.host.view.timeAt(s), this.snapStep());
|
|
1058
1133
|
return {
|
|
1059
1134
|
id: t.item,
|
|
1060
1135
|
task: t.task,
|
|
1061
1136
|
lane: e,
|
|
1062
|
-
from:
|
|
1063
|
-
to:
|
|
1064
|
-
...t.
|
|
1065
|
-
...t.
|
|
1137
|
+
from: n,
|
|
1138
|
+
to: n + t.duration,
|
|
1139
|
+
...t.leadIn === void 0 ? {} : { leadIn: t.leadIn },
|
|
1140
|
+
...t.leadOut === void 0 ? {} : { leadOut: t.leadOut }
|
|
1066
1141
|
};
|
|
1067
1142
|
}
|
|
1068
1143
|
/** The drop: the place intent, and the ghost goes. Off every lane, or with
|
|
@@ -1072,17 +1147,17 @@ class Bs {
|
|
|
1072
1147
|
const e = this.gesture;
|
|
1073
1148
|
if (e.kind !== "place") return;
|
|
1074
1149
|
t.preventDefault();
|
|
1075
|
-
const { ghost: s, item:
|
|
1076
|
-
if (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.cursor = "default", this.host.interactionChanged(), !this.allowed({ ...s, id:
|
|
1150
|
+
const { ghost: s, item: n } = e;
|
|
1151
|
+
if (this.stopAutoPan(), this.closeGestureFolds(), this.gesture = { kind: "none" }, this.refused = !1, this.blocked = !1, this.cursor = "default", this.host.interactionChanged(), !this.allowed({ ...s, id: n.item }, s.lane)) return;
|
|
1077
1152
|
const i = {
|
|
1078
1153
|
kind: "place",
|
|
1079
|
-
item:
|
|
1154
|
+
item: n.item,
|
|
1080
1155
|
task: s.task,
|
|
1081
1156
|
lane: s.lane,
|
|
1082
1157
|
from: s.from,
|
|
1083
1158
|
to: s.to,
|
|
1084
|
-
...s.
|
|
1085
|
-
...s.
|
|
1159
|
+
...s.leadIn === void 0 ? {} : { leadIn: s.leadIn },
|
|
1160
|
+
...s.leadOut === void 0 ? {} : { leadOut: s.leadOut }
|
|
1086
1161
|
};
|
|
1087
1162
|
(a = (r = this.host.handlers()).onIntent) == null || a.call(r, i);
|
|
1088
1163
|
}
|
|
@@ -1091,7 +1166,7 @@ class Bs {
|
|
|
1091
1166
|
and a `dragend`, since it delivers no key events while a native drag
|
|
1092
1167
|
runs. */
|
|
1093
1168
|
clearPlacing() {
|
|
1094
|
-
this.refused = !1, this.cursor = "default", this.closeGestureFolds(), this.gesture.kind === "place" && (this.stopAutoPan(), this.gesture = { kind: "none" }, this.host.interactionChanged());
|
|
1169
|
+
this.refused = !1, this.blocked = !1, this.cursor = "default", this.closeGestureFolds(), this.gesture.kind === "place" && (this.stopAutoPan(), this.gesture = { kind: "none" }, this.host.interactionChanged());
|
|
1095
1170
|
}
|
|
1096
1171
|
/* ---------------------------------------------------------------- */
|
|
1097
1172
|
/* Ghost and intents */
|
|
@@ -1100,44 +1175,56 @@ class Bs {
|
|
|
1100
1175
|
const t = this.host.view.options.snap;
|
|
1101
1176
|
return t === "ticks" ? { step: this.host.view.step(), offset: 0 } : t === !1 ? { step: 0, offset: 0 } : typeof t == "number" ? { step: t, offset: 0 } : t;
|
|
1102
1177
|
}
|
|
1178
|
+
/** The ghost of a drag inside the plot at a point - or, where that would
|
|
1179
|
+
put the work into blocked time it did not already cover, the ghost where
|
|
1180
|
+
it last stood. It is held, not clamped: a pointer carried on past the
|
|
1181
|
+
blocked time takes the ghost along again. */
|
|
1182
|
+
heldGhost(t, e, s) {
|
|
1183
|
+
const n = this.ghostFor(t, e, s);
|
|
1184
|
+
return this.blocked = it(n, t.subtask, this.host.data.blocked), this.blocked ? t.ghost : n;
|
|
1185
|
+
}
|
|
1103
1186
|
ghostFor(t, e, s) {
|
|
1104
|
-
const
|
|
1187
|
+
const n = this.host.view, i = t.subtask, r = this.snapStep(), a = n.options.intents, h = this.snapInside(n.timeAt(e), r);
|
|
1105
1188
|
switch (t.mode) {
|
|
1106
1189
|
case "move": {
|
|
1107
|
-
let
|
|
1108
|
-
const l =
|
|
1109
|
-
|
|
1110
|
-
const g = j(o.options.calendar), b = B(i.from, g) + d, I = g.intervals.length === 0 ? b : U(Math.max(0, Math.min(g.total, b)), g);
|
|
1111
|
-
c = this.snapInside(I, r);
|
|
1112
|
-
}
|
|
1190
|
+
let d = i.from;
|
|
1191
|
+
const l = n.viewport().scale, c = l.fromPx(e) - t.t0;
|
|
1192
|
+
a.includes("move") && Math.abs(c * l.m) >= Me && (d = this.shifted(i.from, c, r));
|
|
1113
1193
|
let p = t.ghost.lane;
|
|
1114
1194
|
if (a.includes("lane")) {
|
|
1115
|
-
const
|
|
1116
|
-
this.refused = t.refused.has(
|
|
1195
|
+
const m = this.onLane(s) ?? p;
|
|
1196
|
+
this.refused = t.refused.has(m), this.refused || (p = m);
|
|
1117
1197
|
} else
|
|
1118
1198
|
this.refused = !1;
|
|
1119
|
-
return { ...i, from:
|
|
1199
|
+
return { ...i, from: d, to: d + (i.to - i.from), lane: p };
|
|
1120
1200
|
}
|
|
1121
1201
|
case "stretch-from":
|
|
1122
|
-
return { ...i, from: Math.min(
|
|
1202
|
+
return { ...i, from: Math.min(h, i.to - Math.max(r.step, W)) };
|
|
1123
1203
|
case "stretch-to":
|
|
1124
|
-
return { ...i, to: Math.max(
|
|
1125
|
-
case "
|
|
1126
|
-
return { ...i,
|
|
1127
|
-
case "
|
|
1128
|
-
return { ...i,
|
|
1204
|
+
return { ...i, to: Math.max(h, i.from + Math.max(r.step, W)) };
|
|
1205
|
+
case "leadIn":
|
|
1206
|
+
return { ...i, leadIn: Math.max(0, i.from - h) };
|
|
1207
|
+
case "leadOut":
|
|
1208
|
+
return { ...i, leadOut: Math.max(0, h - i.to) };
|
|
1129
1209
|
}
|
|
1130
1210
|
}
|
|
1211
|
+
/** A time moved by an amount of WORKING time and snapped: a drag moves
|
|
1212
|
+
a start this way, and a key by one step of the raster - one arithmetic,
|
|
1213
|
+
so a key proposes exactly what a drag of that length would. */
|
|
1214
|
+
shifted(t, e, s) {
|
|
1215
|
+
const n = q(this.host.view.options.calendar), i = K(t, n) + e, r = n.intervals.length === 0 ? i : z(Math.max(0, Math.min(n.total, i)), n);
|
|
1216
|
+
return this.snapInside(r, s);
|
|
1217
|
+
}
|
|
1131
1218
|
/** Snapped - and, where the raster lands in time the calendar removes, moved
|
|
1132
1219
|
on to the seam, where time counts again. An intent never asks for a time
|
|
1133
|
-
|
|
1220
|
+
nobody works. */
|
|
1134
1221
|
snapInside(t, e) {
|
|
1135
|
-
const s =
|
|
1136
|
-
return
|
|
1222
|
+
const s = Js(t, e), n = q(this.host.view.options.calendar);
|
|
1223
|
+
return n.intervals.length === 0 ? s : z(K(s, n), n);
|
|
1137
1224
|
}
|
|
1138
1225
|
intentsOf(t, e, s) {
|
|
1139
|
-
const
|
|
1140
|
-
return s === "move" ? (e.from !== t.from && i.includes("move") &&
|
|
1226
|
+
const n = [], i = this.host.view.options.intents, r = t.id;
|
|
1227
|
+
return s === "move" ? (e.from !== t.from && i.includes("move") && n.push({ kind: "move", subtask: r, from: e.from, to: e.to }), e.lane !== t.lane && i.includes("lane") && n.push({ kind: "lane", subtask: r, lane: e.lane })) : s === "stretch-from" || s === "stretch-to" ? (e.from !== t.from || e.to !== t.to) && n.push({ kind: "stretch", subtask: r, from: e.from, to: e.to }) : s === "leadIn" ? (e.leadIn ?? 0) !== (t.leadIn ?? 0) && n.push({ kind: "leadIn", subtask: r, leadIn: e.leadIn ?? 0 }) : (e.leadOut ?? 0) !== (t.leadOut ?? 0) && n.push({ kind: "leadOut", subtask: r, leadOut: e.leadOut ?? 0 }), n;
|
|
1141
1228
|
}
|
|
1142
1229
|
/** The lane the ghost came from - the only other lane a drag can touch. */
|
|
1143
1230
|
ghostHome(t) {
|
|
@@ -1153,57 +1240,282 @@ class Bs {
|
|
|
1153
1240
|
keeps a plan of hundreds of tasks fluid while a drag runs, since this is
|
|
1154
1241
|
computed on every pointer movement. */
|
|
1155
1242
|
ghostFindings(t, e) {
|
|
1156
|
-
const s = this.host.data,
|
|
1157
|
-
return { overlaps:
|
|
1243
|
+
const s = this.host.data, n = (l) => l.lane === t.lane || l.lane === e, r = [...s.subtasks.filter((l) => l.id !== t.id && n(l)), t], a = (l) => l.first === t.id || l.second === t.id, h = s.dependencies.filter((l) => l.from === t.id || l.to === t.id), d = t.id === we ? s.subtasks : s.subtasks.map((l) => l.id === t.id ? t : l);
|
|
1244
|
+
return { overlaps: $t(r).filter(a), violated: Ht(d, h) };
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
function sn(o, t) {
|
|
1248
|
+
const e = /* @__PURE__ */ new Map();
|
|
1249
|
+
for (const s of t) {
|
|
1250
|
+
const n = o.slots.get(s.lane), i = n === void 0 ? null : Z(o, n.top);
|
|
1251
|
+
if (i === null) continue;
|
|
1252
|
+
const r = o.rows.indexOf(i);
|
|
1253
|
+
e.set(r, [...e.get(r) ?? [], s]);
|
|
1254
|
+
}
|
|
1255
|
+
return [...e.entries()].sort(([s], [n]) => s - n).map(([, s]) => s.sort((n, i) => n.from - i.from || n.to - i.to));
|
|
1256
|
+
}
|
|
1257
|
+
const Te = (o, t) => t < o.from ? o.from - t : t > o.to ? t - o.to : 0;
|
|
1258
|
+
function nn(o, t, e, s) {
|
|
1259
|
+
var d;
|
|
1260
|
+
let n = -1, i = -1;
|
|
1261
|
+
for (let l = 0; l < o.length && t !== null && n < 0; l++)
|
|
1262
|
+
i = o[l].findIndex((c) => c.id === t), i >= 0 && (n = l);
|
|
1263
|
+
if (n < 0) {
|
|
1264
|
+
for (const l of o) {
|
|
1265
|
+
const c = l.find((p) => p.to > s[0] && p.from < s[1]);
|
|
1266
|
+
if (c !== void 0) return c;
|
|
1267
|
+
}
|
|
1268
|
+
return ((d = o[0]) == null ? void 0 : d[0]) ?? null;
|
|
1269
|
+
}
|
|
1270
|
+
const r = o[n], a = r[i], h = (s[1] - s[0]) / 10;
|
|
1271
|
+
switch (e) {
|
|
1272
|
+
case "next":
|
|
1273
|
+
return r[i + 1] ?? a;
|
|
1274
|
+
case "previous":
|
|
1275
|
+
return r[i - 1] ?? a;
|
|
1276
|
+
case "first":
|
|
1277
|
+
return r[0];
|
|
1278
|
+
case "last":
|
|
1279
|
+
return r[r.length - 1];
|
|
1280
|
+
case "pageNext":
|
|
1281
|
+
return r.find((l, c) => c > i && l.from >= a.from + h) ?? r[r.length - 1];
|
|
1282
|
+
case "pagePrevious":
|
|
1283
|
+
for (let l = i - 1; l >= 0; l--) if (r[l].from <= a.from - h) return r[l];
|
|
1284
|
+
return r[0];
|
|
1285
|
+
case "up":
|
|
1286
|
+
case "down": {
|
|
1287
|
+
const l = o[e === "up" ? n - 1 : n + 1];
|
|
1288
|
+
if (l === void 0) return a;
|
|
1289
|
+
const c = (a.from + a.to) / 2;
|
|
1290
|
+
return l.reduce((p, m) => Te(m, c) < Te(p, c) ? m : p);
|
|
1291
|
+
}
|
|
1158
1292
|
}
|
|
1159
1293
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
|
|
1294
|
+
function on(o, t, e, s) {
|
|
1295
|
+
if (e.kind === "dependency") {
|
|
1296
|
+
const i = o.find((a) => a.id === e.id), r = i === void 0 ? void 0 : s === "out" ? i.to : i.from;
|
|
1297
|
+
return r !== void 0 && t.has(r) ? { kind: "subtask", id: r } : e;
|
|
1298
|
+
}
|
|
1299
|
+
const n = o.find(
|
|
1300
|
+
(i) => (s === "out" ? i.from : i.to) === e.id && t.has(s === "out" ? i.to : i.from)
|
|
1301
|
+
);
|
|
1302
|
+
return n === void 0 ? e : { kind: "dependency", id: n.id };
|
|
1303
|
+
}
|
|
1304
|
+
const rn = 150, an = {
|
|
1305
|
+
ArrowRight: "next",
|
|
1306
|
+
ArrowLeft: "previous",
|
|
1307
|
+
ArrowUp: "up",
|
|
1308
|
+
ArrowDown: "down",
|
|
1309
|
+
Home: "first",
|
|
1310
|
+
End: "last",
|
|
1311
|
+
PageDown: "pageNext",
|
|
1312
|
+
PageUp: "pagePrevious"
|
|
1313
|
+
};
|
|
1314
|
+
class ln {
|
|
1315
|
+
constructor(t) {
|
|
1316
|
+
f(this, "spoken", null);
|
|
1317
|
+
f(this, "timer", null);
|
|
1318
|
+
this.host = t;
|
|
1319
|
+
}
|
|
1320
|
+
/** Where the keys stand: the hover, whoever set it. */
|
|
1321
|
+
active() {
|
|
1322
|
+
const t = this.host.gestures.hover;
|
|
1323
|
+
return t.kind === "subtask" ? { kind: "subtask", id: t.subtask.id } : t.kind === "dependency" ? { kind: "dependency", id: t.dependency.id } : null;
|
|
1324
|
+
}
|
|
1325
|
+
/** The focus came in by keyboard: the walk starts where the pointer
|
|
1326
|
+
stands, or at the first subtask in view. A click focuses the plot too,
|
|
1327
|
+
and must not start it. */
|
|
1328
|
+
focus(t) {
|
|
1329
|
+
!t || this.active() !== null || this.walk("first");
|
|
1330
|
+
}
|
|
1331
|
+
/** The focus left: the keys' subtask goes with it. */
|
|
1332
|
+
blur() {
|
|
1333
|
+
this.host.gestures.byKeyboard && this.host.gestures.setKeyboardHover({ kind: "nothing" }, { x: 0, y: 0 });
|
|
1334
|
+
}
|
|
1335
|
+
/** A key on the plot; true where the schedule took it. */
|
|
1336
|
+
key(t) {
|
|
1337
|
+
const e = this.host.gestures;
|
|
1338
|
+
if (t.metaKey || !e.idle) return !1;
|
|
1339
|
+
const s = t.key.toLowerCase() === "t" && !t.ctrlKey && !t.altKey;
|
|
1340
|
+
if (t.key === "]" || t.key === "[" || s) {
|
|
1341
|
+
const i = this.active();
|
|
1342
|
+
if (i === null) return !1;
|
|
1343
|
+
const r = this.host.data, a = s ? !t.shiftKey : t.key === "]";
|
|
1344
|
+
return this.show(on(r.dependencies, r.subtaskById, i, a ? "out" : "back")), !0;
|
|
1345
|
+
}
|
|
1346
|
+
if (t.ctrlKey) return !1;
|
|
1347
|
+
if (t.altKey) return this.edit(t);
|
|
1348
|
+
if (t.key === "Escape")
|
|
1349
|
+
return e.byKeyboard ? (this.blur(), !0) : !1;
|
|
1350
|
+
if (t.key === "Enter" || t.key === " ") return this.select();
|
|
1351
|
+
const n = t.shiftKey ? void 0 : an[t.key];
|
|
1352
|
+
return n === void 0 ? !1 : (this.walk(n), !0);
|
|
1353
|
+
}
|
|
1354
|
+
walk(t) {
|
|
1355
|
+
var h;
|
|
1356
|
+
const { data: e, view: s } = this.host, n = this.active(), i = n === null ? null : n.kind === "subtask" ? n.id : ((h = e.dependencies.find((d) => d.id === n.id)) == null ? void 0 : h.from) ?? null;
|
|
1357
|
+
let r = sn(s.rows, e.subtasks);
|
|
1358
|
+
if (i === null) {
|
|
1359
|
+
const d = r.filter((l) => {
|
|
1360
|
+
const c = s.boxById.get(l[0].id);
|
|
1361
|
+
return c !== void 0 && c.y + c.height > 0 && c.y < s.height;
|
|
1362
|
+
});
|
|
1363
|
+
d.length > 0 && (r = d);
|
|
1364
|
+
}
|
|
1365
|
+
const a = nn(r, i, t, this.host.visibleDomain());
|
|
1366
|
+
a !== null && this.show({ kind: "subtask", id: a.id });
|
|
1367
|
+
}
|
|
1368
|
+
/** Space and Enter select as a click does: the whole task, and the subtask. */
|
|
1369
|
+
select() {
|
|
1370
|
+
const t = this.host.gestures.hover;
|
|
1371
|
+
if (t.kind === "subtask") this.host.select(t.subtask.task, t.subtask.id);
|
|
1372
|
+
else if (t.kind === "dependency") this.host.select(this.host.data.taskOfDependency(t.dependency), null);
|
|
1373
|
+
else return !1;
|
|
1374
|
+
return !0;
|
|
1375
|
+
}
|
|
1376
|
+
/** Alt+←/→ proposes a move by one step of the raster, Alt+Shift+←/→ a new
|
|
1377
|
+
end - the intents a drag of that length reports (ADR-0023), and only
|
|
1378
|
+
where the caller handles them. Nothing is applied here. */
|
|
1379
|
+
edit(t) {
|
|
1380
|
+
var c, p;
|
|
1381
|
+
const e = this.host.gestures.hover, s = t.key === "ArrowRight" ? 1 : t.key === "ArrowLeft" ? -1 : 0;
|
|
1382
|
+
if (s === 0) return !1;
|
|
1383
|
+
if (e.kind !== "subtask") return !0;
|
|
1384
|
+
const n = e.subtask, i = this.host.gestures, r = this.host.view.options.intents, a = i.snapStep(), h = a.step > 0 ? a : { step: this.host.view.step(), offset: 0 }, d = this.host.data.blocked;
|
|
1385
|
+
let l = null;
|
|
1386
|
+
if (!t.shiftKey && r.includes("move")) {
|
|
1387
|
+
const m = (C) => ({ ...n, from: C, to: C + (n.to - n.from) });
|
|
1388
|
+
let y = n.from;
|
|
1389
|
+
for (let C = 0; C < 1e3; C++) {
|
|
1390
|
+
const S = i.shifted(y, s * h.step, h);
|
|
1391
|
+
if (S === y || (y = S, !it(m(y), n, d))) break;
|
|
1392
|
+
}
|
|
1393
|
+
y !== n.from && !it(m(y), n, d) && (l = { kind: "move", subtask: n.id, from: y, to: m(y).to });
|
|
1394
|
+
} else if (t.shiftKey && r.includes("stretch")) {
|
|
1395
|
+
const m = Math.max(i.shifted(n.to, s * h.step, h), n.from + Math.max(h.step, W));
|
|
1396
|
+
m !== n.to && !it({ ...n, to: m }, n, d) && (l = { kind: "stretch", subtask: n.id, from: n.from, to: m });
|
|
1397
|
+
}
|
|
1398
|
+
return i.byKeyboard = !0, l !== null && ((p = (c = this.host.handlers()).onIntent) == null || p.call(c, l)), this.scheduleReadout(), !0;
|
|
1399
|
+
}
|
|
1400
|
+
/** The keys stand on this target: brought into view, drawn as the hover. */
|
|
1401
|
+
show(t, e = !0) {
|
|
1402
|
+
const s = this.hitOf(t);
|
|
1403
|
+
if (s === null) return;
|
|
1404
|
+
e && this.reveal(t);
|
|
1405
|
+
const n = this.bounds(t);
|
|
1406
|
+
if (n === null) return;
|
|
1407
|
+
const { view: i } = this.host, r = (a, h) => Math.max(0, Math.min(h, a));
|
|
1408
|
+
this.host.gestures.setKeyboardHover(s, {
|
|
1409
|
+
x: (r(n.x0, i.width) + r(n.x1, i.width)) / 2,
|
|
1410
|
+
y: (r(n.y0, i.height) + r(n.y1, i.height)) / 2
|
|
1411
|
+
}), e && this.scheduleReadout();
|
|
1412
|
+
}
|
|
1413
|
+
hitOf(t) {
|
|
1414
|
+
const e = this.host.data;
|
|
1415
|
+
if (t.kind === "subtask") {
|
|
1416
|
+
const n = e.subtaskById.get(t.id);
|
|
1417
|
+
return n === void 0 ? null : { kind: "subtask", subtask: n, part: "main" };
|
|
1418
|
+
}
|
|
1419
|
+
const s = e.dependencies.find((n) => n.id === t.id);
|
|
1420
|
+
return s === void 0 ? null : { kind: "dependency", dependency: s };
|
|
1421
|
+
}
|
|
1422
|
+
/** Where a target lies on the plot: a subtask's bar, or the span between
|
|
1423
|
+
the two bars a dependency joins. */
|
|
1424
|
+
bounds(t) {
|
|
1425
|
+
const e = this.host.view, s = (a) => e.boxById.get(a);
|
|
1426
|
+
if (t.kind === "subtask") {
|
|
1427
|
+
const a = s(t.id);
|
|
1428
|
+
return a === void 0 ? null : { x0: a.outerFrom, x1: a.outerTo, y0: a.y, y1: a.y + a.height };
|
|
1429
|
+
}
|
|
1430
|
+
const n = this.host.data.dependencies.find((a) => a.id === t.id), i = n === void 0 ? void 0 : s(n.from), r = n === void 0 ? void 0 : s(n.to);
|
|
1431
|
+
return i === void 0 || r === void 0 ? null : {
|
|
1432
|
+
x0: Math.min(i.mainTo, r.mainFrom),
|
|
1433
|
+
x1: Math.max(i.mainTo, r.mainFrom),
|
|
1434
|
+
y0: Math.min(i.y, r.y),
|
|
1435
|
+
y1: Math.max(i.y + i.height, r.y + r.height)
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
/** Pans and scrolls just enough to bring a target into view, with a margin
|
|
1439
|
+
at the side it came in from; a target wider than the view shows its
|
|
1440
|
+
start. As a drag at the edge pans along, the keys do. */
|
|
1441
|
+
reveal(t) {
|
|
1442
|
+
const e = this.bounds(t), s = this.host.view;
|
|
1443
|
+
if (e === null || s.width <= 0) return;
|
|
1444
|
+
const n = Math.min(24, s.width / 10), i = e.x0 < 0 ? e.x0 - n : e.x1 > s.width ? Math.max(0, Math.min(e.x1 - s.width + n, e.x0 - n)) : 0, r = e.y0 < 0 ? e.y0 : e.y1 > s.height ? Math.min(e.y1 - s.height, e.y0) : 0;
|
|
1445
|
+
if (i === 0 && r === 0) return;
|
|
1446
|
+
const a = s.pan(i, r);
|
|
1447
|
+
a.moved && this.host.viewMoved(a.time);
|
|
1448
|
+
}
|
|
1449
|
+
/** After the data or the view changed: the keys' target is read anew by its
|
|
1450
|
+
id - its new times, its new place -, and dropped where it is gone. */
|
|
1451
|
+
refresh() {
|
|
1452
|
+
const t = this.active();
|
|
1453
|
+
!this.host.gestures.byKeyboard || t === null || (this.hitOf(t) === null || this.bounds(t) === null ? this.blur() : this.show(t, !1));
|
|
1454
|
+
}
|
|
1455
|
+
/** The readout, written once the keys rest - and only while they still hold
|
|
1456
|
+
the hover: a pointer that took it over in the pause is not spoken for. */
|
|
1457
|
+
scheduleReadout() {
|
|
1458
|
+
this.timer !== null && clearTimeout(this.timer), this.timer = setTimeout(() => {
|
|
1459
|
+
var s;
|
|
1460
|
+
this.timer = null;
|
|
1461
|
+
const t = this.host.gestures.hover;
|
|
1462
|
+
if (!this.host.gestures.byKeyboard) return;
|
|
1463
|
+
const e = this.host.data.tooltipTargetFor(t);
|
|
1464
|
+
e !== null && (this.spoken = { target: e, lane: t.kind === "subtask" ? t.subtask.lane : null, count: (((s = this.spoken) == null ? void 0 : s.count) ?? 0) + 1 }, this.host.spokenChanged());
|
|
1465
|
+
}, rn);
|
|
1466
|
+
}
|
|
1467
|
+
/** Unmount: no readout after it. */
|
|
1468
|
+
stop() {
|
|
1469
|
+
this.timer !== null && clearTimeout(this.timer), this.timer = null;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
const Ye = [], hn = 56;
|
|
1473
|
+
function dn(o, t = hn) {
|
|
1474
|
+
return o > 0 ? Math.min(rt, Math.max(15 * W, hs(o * t, 1))) : 15 * W;
|
|
1475
|
+
}
|
|
1476
|
+
function un(o, t, e = Ye) {
|
|
1477
|
+
const [s, n] = Ke(o, e);
|
|
1478
|
+
return ds(e, s, n, t, _e(s)).filter(
|
|
1479
|
+
(i) => i.workingTime >= o[0] && i.workingTime <= o[1]
|
|
1168
1480
|
);
|
|
1169
1481
|
}
|
|
1170
|
-
function
|
|
1171
|
-
const [e, s] =
|
|
1172
|
-
for (i.setHours(0, 0, 0, 0); i.getTime() < s &&
|
|
1482
|
+
function cn(o, t = Ye) {
|
|
1483
|
+
const [e, s] = Ke(o, t), n = [], i = new Date(e);
|
|
1484
|
+
for (i.setHours(0, 0, 0, 0); i.getTime() < s && n.length < 400; ) {
|
|
1173
1485
|
const r = i.getTime();
|
|
1174
1486
|
i.setDate(i.getDate() + 1);
|
|
1175
1487
|
const a = i.getTime();
|
|
1176
|
-
|
|
1488
|
+
n.push({
|
|
1177
1489
|
start: r,
|
|
1178
1490
|
end: a,
|
|
1179
|
-
from:
|
|
1180
|
-
to:
|
|
1491
|
+
from: K(r, t),
|
|
1492
|
+
to: K(a, t)
|
|
1181
1493
|
});
|
|
1182
1494
|
}
|
|
1183
|
-
return
|
|
1495
|
+
return n;
|
|
1184
1496
|
}
|
|
1185
|
-
function
|
|
1186
|
-
const
|
|
1187
|
-
if (!(
|
|
1188
|
-
const i = Math.min(s.max, Math.max(s.min,
|
|
1497
|
+
function fn(o, t, e, s) {
|
|
1498
|
+
const n = o[1] - o[0];
|
|
1499
|
+
if (!(n > 0)) return [o[0], o[1]];
|
|
1500
|
+
const i = Math.min(s.max, Math.max(s.min, n * e)), r = (t - o[0]) / n, a = t - r * i;
|
|
1189
1501
|
return [a, a + i];
|
|
1190
1502
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return [
|
|
1503
|
+
function pn(o, t) {
|
|
1504
|
+
return [o[0] + t, o[1] + t];
|
|
1193
1505
|
}
|
|
1194
|
-
function
|
|
1195
|
-
const e =
|
|
1196
|
-
if (e.intervals.length === 0) return [
|
|
1197
|
-
const s = (
|
|
1198
|
-
return [
|
|
1506
|
+
function Ke(o, t) {
|
|
1507
|
+
const e = q(t);
|
|
1508
|
+
if (e.intervals.length === 0) return [o[0], o[1]];
|
|
1509
|
+
const s = (n) => Math.max(0, Math.min(e.total, n));
|
|
1510
|
+
return [z(s(o[0]), e), z(s(o[1]), e)];
|
|
1199
1511
|
}
|
|
1200
|
-
const
|
|
1201
|
-
class
|
|
1512
|
+
const ct = 44;
|
|
1513
|
+
class mn {
|
|
1202
1514
|
constructor(t) {
|
|
1203
1515
|
f(this, "options", {
|
|
1204
|
-
laneHeight:
|
|
1516
|
+
laneHeight: ct,
|
|
1205
1517
|
calendar: [],
|
|
1206
|
-
zoomLimits: { min:
|
|
1518
|
+
zoomLimits: { min: Et, max: 28 * rt },
|
|
1207
1519
|
snap: "ticks",
|
|
1208
1520
|
intents: [],
|
|
1209
1521
|
now: null,
|
|
@@ -1211,14 +1523,14 @@ class Ws {
|
|
|
1211
1523
|
attach: "centre",
|
|
1212
1524
|
ends: "dot"
|
|
1213
1525
|
});
|
|
1214
|
-
f(this, "domain", [0,
|
|
1526
|
+
f(this, "domain", [0, rt]);
|
|
1215
1527
|
f(this, "scrollY", 0);
|
|
1216
1528
|
f(this, "width", 0);
|
|
1217
1529
|
f(this, "height", 0);
|
|
1218
1530
|
/* What is laid out from top to bottom (`rows.ts`). It is derived here and
|
|
1219
1531
|
not in the data, because a row's height comes from a view option; every y
|
|
1220
1532
|
in the package reads it. */
|
|
1221
|
-
f(this, "rows",
|
|
1533
|
+
f(this, "rows", le({ lanes: [], groups: [], collapsed: /* @__PURE__ */ new Set(), laneHeight: ct }));
|
|
1222
1534
|
/** The folded groups, as the scene holds them. */
|
|
1223
1535
|
f(this, "collapsed", /* @__PURE__ */ new Set());
|
|
1224
1536
|
/** The groups a gesture in flight holds open. Dropped when it ends; the
|
|
@@ -1232,20 +1544,20 @@ class Ws {
|
|
|
1232
1544
|
/** Takes new options; an initial domain in wall-clock time puts the view
|
|
1233
1545
|
there, and a new calendar keeps the wall-clock span in view. */
|
|
1234
1546
|
setOptions(t, e) {
|
|
1235
|
-
const s = t.calendar !== this.options.calendar,
|
|
1547
|
+
const s = t.calendar !== this.options.calendar, n = this.options.calendar;
|
|
1236
1548
|
if (this.options = t, e !== null)
|
|
1237
|
-
this.domain = [
|
|
1549
|
+
this.domain = [K(e[0], t.calendar), K(e[1], t.calendar)];
|
|
1238
1550
|
else if (s) {
|
|
1239
|
-
const i =
|
|
1240
|
-
const
|
|
1241
|
-
return
|
|
1551
|
+
const i = q(n), r = (a) => {
|
|
1552
|
+
const h = i.intervals.length === 0 ? a : Math.max(0, Math.min(i.total, a));
|
|
1553
|
+
return K(z(h, i), t.calendar) + (a - h);
|
|
1242
1554
|
};
|
|
1243
1555
|
this.domain = [r(this.domain[0]), r(this.domain[1])];
|
|
1244
1556
|
}
|
|
1245
1557
|
}
|
|
1246
1558
|
viewport() {
|
|
1247
1559
|
return {
|
|
1248
|
-
scale: new
|
|
1560
|
+
scale: new us(this.domain, [0, this.width]),
|
|
1249
1561
|
calendar: this.options.calendar,
|
|
1250
1562
|
laneHeight: this.options.laneHeight,
|
|
1251
1563
|
scrollY: this.scrollY,
|
|
@@ -1262,28 +1574,28 @@ class Ws {
|
|
|
1262
1574
|
/** The fine band's step at the current zoom. */
|
|
1263
1575
|
step() {
|
|
1264
1576
|
const t = this.domain[1] - this.domain[0];
|
|
1265
|
-
return
|
|
1577
|
+
return dn(this.width > 0 ? t / this.width : t);
|
|
1266
1578
|
}
|
|
1267
1579
|
/** Lays the rows out, clamps the scroll, and lays the data out anew. */
|
|
1268
1580
|
layout() {
|
|
1269
|
-
this.rows =
|
|
1581
|
+
this.rows = le({
|
|
1270
1582
|
lanes: this.data.lanes,
|
|
1271
1583
|
groups: this.data.groups,
|
|
1272
|
-
collapsed:
|
|
1584
|
+
collapsed: ws(this.collapsed, this.openForGesture),
|
|
1273
1585
|
laneHeight: this.options.laneHeight
|
|
1274
1586
|
}), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY));
|
|
1275
1587
|
const t = this.viewport();
|
|
1276
1588
|
this.boxes = [], this.boxById = /* @__PURE__ */ new Map();
|
|
1277
1589
|
for (const e of this.data.subtasks) {
|
|
1278
|
-
const s =
|
|
1590
|
+
const s = Nt(this.rows, e.lane);
|
|
1279
1591
|
if (s === null) continue;
|
|
1280
|
-
const
|
|
1281
|
-
this.boxes.push(
|
|
1592
|
+
const n = Re(t, e, e.lane, s, this.data.depth.get(e.id) ?? 0);
|
|
1593
|
+
this.boxes.push(n), this.boxById.set(e.id, n);
|
|
1282
1594
|
}
|
|
1283
1595
|
this.paths = [];
|
|
1284
|
-
for (const e of this.data.
|
|
1285
|
-
const s = this.boxById.get(e.from),
|
|
1286
|
-
s === void 0 ||
|
|
1596
|
+
for (const e of this.data.dependencies) {
|
|
1597
|
+
const s = this.boxById.get(e.from), n = this.boxById.get(e.to);
|
|
1598
|
+
s === void 0 || n === void 0 || this.paths.push(_t(t, e, s, n, this.options));
|
|
1287
1599
|
}
|
|
1288
1600
|
}
|
|
1289
1601
|
/** The days of the coarse band and the ticks of the fine band, in pixels. */
|
|
@@ -1292,11 +1604,11 @@ class Ws {
|
|
|
1292
1604
|
if (this.width <= 0) return { days: [], ticks: [], step: t };
|
|
1293
1605
|
const e = this.viewport().scale, s = this.options.calendar;
|
|
1294
1606
|
return {
|
|
1295
|
-
days:
|
|
1296
|
-
const i = Math.round(e.toPx(
|
|
1297
|
-
return { start:
|
|
1607
|
+
days: cn(this.domain, s).map((n) => {
|
|
1608
|
+
const i = Math.round(e.toPx(n.from));
|
|
1609
|
+
return { start: n.start, x: i, width: Math.round(e.toPx(n.to)) - i };
|
|
1298
1610
|
}),
|
|
1299
|
-
ticks:
|
|
1611
|
+
ticks: un(this.domain, t, s).map((n) => ({ wallClock: n.wallClock, x: Math.round(e.toPx(n.workingTime)) })),
|
|
1300
1612
|
step: t
|
|
1301
1613
|
};
|
|
1302
1614
|
}
|
|
@@ -1304,27 +1616,27 @@ class Ws {
|
|
|
1304
1616
|
nowX() {
|
|
1305
1617
|
const t = this.options.now;
|
|
1306
1618
|
if (t === null || this.width <= 0) return null;
|
|
1307
|
-
const e = Math.round(this.viewport().scale.toPx(
|
|
1619
|
+
const e = Math.round(this.viewport().scale.toPx(K(t, this.options.calendar)));
|
|
1308
1620
|
return e >= 0 && e <= this.width ? e : null;
|
|
1309
1621
|
}
|
|
1310
1622
|
hitAt(t, e) {
|
|
1311
1623
|
for (let r = this.boxes.length - 1; r >= 0; r--) {
|
|
1312
|
-
const a = this.boxes[r],
|
|
1313
|
-
if (
|
|
1624
|
+
const a = this.boxes[r], h = Pe(a, t, e);
|
|
1625
|
+
if (h !== null) return { kind: "subtask", subtask: a.subtask, part: h };
|
|
1314
1626
|
}
|
|
1315
|
-
let s = null,
|
|
1627
|
+
let s = null, n = 4;
|
|
1316
1628
|
for (const r of this.paths) {
|
|
1317
|
-
const a =
|
|
1318
|
-
a <=
|
|
1629
|
+
const a = Ss(r, t, e);
|
|
1630
|
+
a <= n && (n = a, s = r);
|
|
1319
1631
|
}
|
|
1320
|
-
if (s !== null) return { kind: "
|
|
1321
|
-
const i =
|
|
1632
|
+
if (s !== null) return { kind: "dependency", dependency: s.dependency };
|
|
1633
|
+
const i = ce(this.viewport(), e);
|
|
1322
1634
|
return i !== null ? { kind: "lane", lane: i } : { kind: "nothing" };
|
|
1323
1635
|
}
|
|
1324
1636
|
/** The wall-clock time at a plot x; within the calendar's extent. */
|
|
1325
1637
|
timeAt(t) {
|
|
1326
|
-
const e = this.viewport().scale.fromPx(t), s =
|
|
1327
|
-
return s.intervals.length === 0 ? e :
|
|
1638
|
+
const e = this.viewport().scale.fromPx(t), s = q(this.options.calendar);
|
|
1639
|
+
return s.intervals.length === 0 ? e : z(Math.max(0, Math.min(s.total, e)), s);
|
|
1328
1640
|
}
|
|
1329
1641
|
/** The lane at a y, strips included: what the pointer is ON.
|
|
1330
1642
|
|
|
@@ -1333,60 +1645,63 @@ class Ws {
|
|
|
1333
1645
|
`foldedGroupAt` - and a caller that reached through `viewport()` for it
|
|
1334
1646
|
would be depending on the layout rather than asking the view. */
|
|
1335
1647
|
laneIdAt(t) {
|
|
1336
|
-
return
|
|
1648
|
+
return ce(this.viewport(), t);
|
|
1337
1649
|
}
|
|
1338
1650
|
/** The lane a DROP at this y would land on.
|
|
1339
1651
|
|
|
1340
|
-
A **Miniature** is no drop target. A strip is three pixels of a
|
|
1652
|
+
A **Miniature** is no drop target. A strip is three pixels of a lane's
|
|
1341
1653
|
whole day, and a drop aimed at one would be a guess; resting over the
|
|
1342
1654
|
group opens it for the gesture instead, and then there is a real lane to
|
|
1343
1655
|
aim at. Hover, the tooltip and selection do read a strip - they cost
|
|
1344
1656
|
nothing if they are a pixel out. */
|
|
1345
1657
|
dropLaneIdAt(t) {
|
|
1346
|
-
const e =
|
|
1658
|
+
const e = Z(this.rows, t + this.scrollY);
|
|
1347
1659
|
return e === null || e.kind !== "lane" ? null : e.lane ?? null;
|
|
1348
1660
|
}
|
|
1349
1661
|
/** The folded group a y lies over, or null. */
|
|
1350
1662
|
foldedGroupAt(t) {
|
|
1351
|
-
const e =
|
|
1663
|
+
const e = Z(this.rows, t + this.scrollY);
|
|
1352
1664
|
return e !== null && e.kind === "miniature" ? e.group ?? null : null;
|
|
1353
1665
|
}
|
|
1354
1666
|
/** Pans by pixels. Says what moved: the span through time, the lanes, or
|
|
1355
1667
|
neither - a scroll through the lanes is no news about the time. */
|
|
1356
1668
|
pan(t, e) {
|
|
1357
|
-
const s = this.domain[0],
|
|
1358
|
-
this.width > 0 && t !== 0 && (this.domain =
|
|
1669
|
+
const s = this.domain[0], n = this.scrollY, i = this.domain[1] - s;
|
|
1670
|
+
this.width > 0 && t !== 0 && (this.domain = pn(this.domain, t / this.width * i)), this.scrollY = Math.max(0, Math.min(this.maxScroll(), this.scrollY + e));
|
|
1359
1671
|
const r = this.domain[0] !== s;
|
|
1360
|
-
return { moved: r || this.scrollY !==
|
|
1672
|
+
return { moved: r || this.scrollY !== n, time: r };
|
|
1361
1673
|
}
|
|
1362
1674
|
/** Zooms around a plot x; says whether the span changed. */
|
|
1363
1675
|
zoomAt(t, e) {
|
|
1364
1676
|
if (this.width <= 0 || !Number.isFinite(e)) return !1;
|
|
1365
|
-
const s = this.domain,
|
|
1366
|
-
return this.domain =
|
|
1677
|
+
const s = this.domain, n = this.viewport().scale.fromPx(t);
|
|
1678
|
+
return this.domain = fn(this.domain, n, e, this.options.zoomLimits), s[0] !== this.domain[0] || s[1] !== this.domain[1];
|
|
1367
1679
|
}
|
|
1368
1680
|
}
|
|
1369
|
-
const
|
|
1681
|
+
const Ie = {
|
|
1370
1682
|
width: 0,
|
|
1371
1683
|
height: 0,
|
|
1372
|
-
laneHeight:
|
|
1684
|
+
laneHeight: ct,
|
|
1373
1685
|
scrollY: 0,
|
|
1374
1686
|
headers: [],
|
|
1375
1687
|
days: [],
|
|
1376
1688
|
ticks: [],
|
|
1377
|
-
step:
|
|
1689
|
+
step: Et,
|
|
1378
1690
|
ghost: null,
|
|
1379
1691
|
grips: [],
|
|
1380
1692
|
cursor: "default",
|
|
1381
1693
|
tooltip: null,
|
|
1382
1694
|
now: null,
|
|
1383
|
-
bars: []
|
|
1695
|
+
bars: [],
|
|
1696
|
+
spoken: null,
|
|
1697
|
+
summary: { lanes: 0, subtasks: 0, from: 0, to: 0, overlaps: 0, violated: 0, blocked: 0 }
|
|
1384
1698
|
};
|
|
1385
|
-
class
|
|
1699
|
+
class gn {
|
|
1386
1700
|
constructor() {
|
|
1387
|
-
f(this, "data", new
|
|
1388
|
-
f(this, "view", new
|
|
1701
|
+
f(this, "data", new _s(() => this.viewChanged()));
|
|
1702
|
+
f(this, "view", new mn(this.data));
|
|
1389
1703
|
f(this, "gestures");
|
|
1704
|
+
f(this, "keys");
|
|
1390
1705
|
f(this, "handlersNow", {});
|
|
1391
1706
|
f(this, "placing", null);
|
|
1392
1707
|
f(this, "controlledTask");
|
|
@@ -1405,7 +1720,7 @@ class qs {
|
|
|
1405
1720
|
f(this, "frame", 0);
|
|
1406
1721
|
f(this, "domainFrame", 0);
|
|
1407
1722
|
f(this, "unsubscribeTheme", null);
|
|
1408
|
-
f(this, "snapshot",
|
|
1723
|
+
f(this, "snapshot", Ie);
|
|
1409
1724
|
f(this, "listeners", /* @__PURE__ */ new Set());
|
|
1410
1725
|
/* ---------------------------------------------------------------- */
|
|
1411
1726
|
/* Registration and options */
|
|
@@ -1423,7 +1738,7 @@ class qs {
|
|
|
1423
1738
|
this.listeners.delete(t);
|
|
1424
1739
|
}));
|
|
1425
1740
|
f(this, "getSnapshot", () => this.snapshot);
|
|
1426
|
-
f(this, "getServerSnapshot", () =>
|
|
1741
|
+
f(this, "getServerSnapshot", () => Ie);
|
|
1427
1742
|
/* ---------------------------------------------------------------- */
|
|
1428
1743
|
/* Gestures, as the component hands them in */
|
|
1429
1744
|
/* ---------------------------------------------------------------- */
|
|
@@ -1438,7 +1753,10 @@ class qs {
|
|
|
1438
1753
|
f(this, "drop", (t) => this.gestures.drop(t));
|
|
1439
1754
|
f(this, "dragLeave", () => this.gestures.clearPlacing());
|
|
1440
1755
|
f(this, "cancelEdit", () => this.gestures.cancelEdit());
|
|
1441
|
-
this
|
|
1756
|
+
f(this, "key", (t) => this.keys.key(t));
|
|
1757
|
+
f(this, "focus", (t) => this.keys.focus(t));
|
|
1758
|
+
f(this, "blur", () => this.keys.blur());
|
|
1759
|
+
this.gestures = new en({
|
|
1442
1760
|
data: this.data,
|
|
1443
1761
|
view: this.view,
|
|
1444
1762
|
plotElement: () => this.plot,
|
|
@@ -1450,6 +1768,17 @@ class qs {
|
|
|
1450
1768
|
this.viewChanged(), t && this.reportDomain();
|
|
1451
1769
|
},
|
|
1452
1770
|
interactionChanged: () => this.interactionChanged()
|
|
1771
|
+
}), this.keys = new ln({
|
|
1772
|
+
data: this.data,
|
|
1773
|
+
view: this.view,
|
|
1774
|
+
gestures: this.gestures,
|
|
1775
|
+
handlers: () => this.handlersNow,
|
|
1776
|
+
visibleDomain: () => this.visibleDomain(),
|
|
1777
|
+
select: (t, e) => this.select(t, e),
|
|
1778
|
+
viewMoved: (t) => {
|
|
1779
|
+
this.viewChanged(), t && this.reportDomain();
|
|
1780
|
+
},
|
|
1781
|
+
spokenChanged: () => this.publish()
|
|
1453
1782
|
});
|
|
1454
1783
|
}
|
|
1455
1784
|
setOptions(t, e) {
|
|
@@ -1476,9 +1805,9 @@ class qs {
|
|
|
1476
1805
|
/** Folds or unfolds one group. The caller's list is never written to: where
|
|
1477
1806
|
the state is controlled, only the report goes out. */
|
|
1478
1807
|
toggleGroup(t) {
|
|
1479
|
-
var
|
|
1808
|
+
var n, i;
|
|
1480
1809
|
const e = this.collapsedGroups, s = e.includes(t) ? e.filter((r) => r !== t) : [...e, t];
|
|
1481
|
-
this.controlledCollapsed === void 0 && (this.ownCollapsed = s), (i = (
|
|
1810
|
+
this.controlledCollapsed === void 0 && (this.ownCollapsed = s), (i = (n = this.handlersNow).onCollapsedGroupsChange) == null || i.call(n, s), this.viewChanged();
|
|
1482
1811
|
}
|
|
1483
1812
|
/** `undefined`: the scene keeps the selection itself. */
|
|
1484
1813
|
setControlledTask(t) {
|
|
@@ -1488,38 +1817,38 @@ class qs {
|
|
|
1488
1817
|
return this.controlledTask !== void 0 ? this.controlledTask : this.ownTask;
|
|
1489
1818
|
}
|
|
1490
1819
|
select(t, e) {
|
|
1491
|
-
var
|
|
1820
|
+
var n, i;
|
|
1492
1821
|
const s = t !== this.selectedTask || e !== this.selected;
|
|
1493
|
-
this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), s && ((i = (
|
|
1822
|
+
this.selected = e, t !== this.selectedTask && this.controlledTask === void 0 && (this.ownTask = t), s && ((i = (n = this.handlersNow).onSelectedTaskChange) == null || i.call(n, t, e)), this.interactionChanged();
|
|
1494
1823
|
}
|
|
1495
1824
|
/* ---------------------------------------------------------------- */
|
|
1496
1825
|
/* DOM binding */
|
|
1497
1826
|
/* ---------------------------------------------------------------- */
|
|
1498
|
-
bind(t, e, s,
|
|
1499
|
-
this.root = t, this.plot = e, this.dataCanvas = s, this.overlayCanvas =
|
|
1827
|
+
bind(t, e, s, n) {
|
|
1828
|
+
this.root = t, this.plot = e, this.dataCanvas = s, this.overlayCanvas = n, this.unsubscribeTheme = cs(() => {
|
|
1500
1829
|
this.colours = null, this.requestDraw();
|
|
1501
1830
|
}), this.viewChanged();
|
|
1502
1831
|
}
|
|
1503
1832
|
unbind() {
|
|
1504
1833
|
var t;
|
|
1505
|
-
this.gestures.cancelEdit(), (t = this.unsubscribeTheme) == null || t.call(this), this.unsubscribeTheme = null, this.frame !== 0 && cancelAnimationFrame(this.frame), this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.frame = this.domainFrame = 0, this.root = this.plot = this.dataCanvas = this.overlayCanvas = null;
|
|
1834
|
+
this.gestures.cancelEdit(), this.keys.stop(), (t = this.unsubscribeTheme) == null || t.call(this), this.unsubscribeTheme = null, this.frame !== 0 && cancelAnimationFrame(this.frame), this.domainFrame !== 0 && cancelAnimationFrame(this.domainFrame), this.frame = this.domainFrame = 0, this.root = this.plot = this.dataCanvas = this.overlayCanvas = null;
|
|
1506
1835
|
}
|
|
1507
1836
|
resize(t, e) {
|
|
1508
|
-
const s = Math.max(0, Math.round(t)),
|
|
1509
|
-
s === this.view.width &&
|
|
1837
|
+
const s = Math.max(0, Math.round(t)), n = Math.max(0, Math.round(e));
|
|
1838
|
+
s === this.view.width && n === this.view.height || (this.view.width = s, this.view.height = n, this.viewChanged());
|
|
1510
1839
|
}
|
|
1511
1840
|
/* ---------------------------------------------------------------- */
|
|
1512
1841
|
/* Changes */
|
|
1513
1842
|
/* ---------------------------------------------------------------- */
|
|
1514
1843
|
viewChanged() {
|
|
1515
|
-
this.view.collapsed = new Set(this.collapsedGroups), this.data.rebuild() && (this.colours = null, this.selected !== null && !this.data.subtaskById.has(this.selected) && (this.selected = null)), this.view.layout(), this.gestures.refreshHover(), this.interactionChanged();
|
|
1844
|
+
this.view.collapsed = new Set(this.collapsedGroups), this.data.rebuild() && (this.colours = null, this.selected !== null && !this.data.subtaskById.has(this.selected) && (this.selected = null)), this.view.layout(), this.gestures.refreshHover(), this.keys.refresh(), this.interactionChanged();
|
|
1516
1845
|
}
|
|
1517
1846
|
interactionChanged() {
|
|
1518
1847
|
this.publish(), this.requestDraw();
|
|
1519
1848
|
}
|
|
1520
1849
|
publish() {
|
|
1521
1850
|
const t = this.view, e = this.selected !== null ? t.boxById.get(this.selected) : void 0, s = [];
|
|
1522
|
-
e !== void 0 && !e.miniature && !this.gestures.editing && e.subtask.task === this.selectedTask && (t.options.intents.includes("
|
|
1851
|
+
e !== void 0 && !e.miniature && !this.gestures.editing && e.subtask.task === this.selectedTask && (t.options.intents.includes("leadIn") && s.push({ kind: "leadIn", x: e.outerFrom, y: e.y, height: e.height }), t.options.intents.includes("leadOut") && s.push({ kind: "leadOut", x: e.outerTo, y: e.y, height: e.height })), this.snapshot = {
|
|
1523
1852
|
width: t.width,
|
|
1524
1853
|
height: t.height,
|
|
1525
1854
|
laneHeight: t.options.laneHeight,
|
|
@@ -1531,27 +1860,29 @@ class qs {
|
|
|
1531
1860
|
cursor: this.gestures.cursor,
|
|
1532
1861
|
tooltip: this.tooltip(),
|
|
1533
1862
|
now: t.nowX(),
|
|
1534
|
-
bars: this.bars()
|
|
1863
|
+
bars: this.bars(),
|
|
1864
|
+
spoken: this.keys.spoken,
|
|
1865
|
+
summary: this.summary()
|
|
1535
1866
|
};
|
|
1536
|
-
for (const
|
|
1867
|
+
for (const n of this.listeners) n();
|
|
1537
1868
|
}
|
|
1538
1869
|
/** One header per row, with what it says and where it sits. The scroll is
|
|
1539
1870
|
not taken off here: the header column is moved as a whole, as it always
|
|
1540
1871
|
was, so that a header and its row cannot drift apart by a rounding. */
|
|
1541
1872
|
headers() {
|
|
1542
|
-
const t = new Map(this.data.lanes.map((
|
|
1543
|
-
return this.view.rows.rows.map((
|
|
1544
|
-
key:
|
|
1545
|
-
kind:
|
|
1546
|
-
lane:
|
|
1547
|
-
group:
|
|
1548
|
-
label: (
|
|
1549
|
-
depth:
|
|
1550
|
-
within:
|
|
1551
|
-
lanes:
|
|
1552
|
-
collapsed:
|
|
1553
|
-
top:
|
|
1554
|
-
height:
|
|
1873
|
+
const t = new Map(this.data.lanes.map((n) => [n.id, n.label])), e = new Map(this.data.groups.map((n) => [n.id, n.label])), s = new Set(this.collapsedGroups);
|
|
1874
|
+
return this.view.rows.rows.map((n) => ({
|
|
1875
|
+
key: n.lane ?? n.group ?? "",
|
|
1876
|
+
kind: n.kind,
|
|
1877
|
+
lane: n.lane,
|
|
1878
|
+
group: n.group,
|
|
1879
|
+
label: (n.lane !== void 0 ? t.get(n.lane) : e.get(n.group ?? "")) ?? n.lane ?? n.group ?? "",
|
|
1880
|
+
depth: n.depth,
|
|
1881
|
+
within: n.within,
|
|
1882
|
+
lanes: n.lanes,
|
|
1883
|
+
collapsed: n.group === void 0 ? void 0 : s.has(n.group),
|
|
1884
|
+
top: n.top,
|
|
1885
|
+
height: n.height
|
|
1555
1886
|
}));
|
|
1556
1887
|
}
|
|
1557
1888
|
/** The bars a label could stand in: the visible part of every main time,
|
|
@@ -1562,24 +1893,38 @@ class qs {
|
|
|
1562
1893
|
if (t.width <= 0) return [];
|
|
1563
1894
|
const e = this.colours;
|
|
1564
1895
|
return t.boxes.flatMap((s) => {
|
|
1565
|
-
if (!
|
|
1566
|
-
const
|
|
1567
|
-
if (
|
|
1568
|
-
const i = e === null ? void 0 : e.tasks.get(s.subtask.task), r = i === void 0 || e === null ? !0 :
|
|
1569
|
-
return [{ subtask: s.subtask, ...
|
|
1896
|
+
if (!At(s, t.width, t.height)) return [];
|
|
1897
|
+
const n = Cs(s, t.width);
|
|
1898
|
+
if (n === null) return [];
|
|
1899
|
+
const i = e === null ? void 0 : e.tasks.get(s.subtask.task), r = i === void 0 || e === null ? !0 : Yt(pt(s.subtask.appearance), i, e).onDark;
|
|
1900
|
+
return [{ subtask: s.subtask, ...n, dark: r }];
|
|
1570
1901
|
});
|
|
1571
1902
|
}
|
|
1903
|
+
/** The findings count the whole plan - an overlap out of view is still one
|
|
1904
|
+
to know of -, the subtasks only what is in view. */
|
|
1905
|
+
summary() {
|
|
1906
|
+
const t = this.view, [e, s] = this.visibleDomain();
|
|
1907
|
+
return {
|
|
1908
|
+
lanes: this.data.lanes.length,
|
|
1909
|
+
subtasks: t.boxes.filter((n) => At(n, t.width, t.height)).length,
|
|
1910
|
+
from: e,
|
|
1911
|
+
to: s,
|
|
1912
|
+
overlaps: this.data.overlaps.length,
|
|
1913
|
+
violated: this.data.violatedById.size,
|
|
1914
|
+
blocked: this.data.inBlocked.length
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1572
1917
|
tooltip() {
|
|
1573
1918
|
const t = this.gestures.hover;
|
|
1574
1919
|
if (!this.gestures.idle) return null;
|
|
1575
1920
|
const e = this.data.tooltipTargetFor(t);
|
|
1576
1921
|
if (e === null) return null;
|
|
1577
|
-
const { x: s, y:
|
|
1578
|
-
return { target: e, x: s, y:
|
|
1922
|
+
const { x: s, y: n } = this.gestures.hoverPoint;
|
|
1923
|
+
return { target: e, x: s, y: n };
|
|
1579
1924
|
}
|
|
1580
1925
|
/** The visible span, as two wall-clock instants. */
|
|
1581
1926
|
visibleDomain() {
|
|
1582
|
-
const t =
|
|
1927
|
+
const t = q(this.view.options.calendar), e = (s) => t.intervals.length === 0 ? s : z(Math.max(0, Math.min(t.total, s)), t);
|
|
1583
1928
|
return [e(this.view.domain[0]), e(this.view.domain[1])];
|
|
1584
1929
|
}
|
|
1585
1930
|
/** Reported once per frame, however many wheel steps a planner turns - and
|
|
@@ -1593,8 +1938,8 @@ class qs {
|
|
|
1593
1938
|
return;
|
|
1594
1939
|
}
|
|
1595
1940
|
this.domainFrame === 0 && (this.domainFrame = requestAnimationFrame(() => {
|
|
1596
|
-
var s,
|
|
1597
|
-
this.domainFrame = 0, (
|
|
1941
|
+
var s, n;
|
|
1942
|
+
this.domainFrame = 0, (n = (s = this.handlersNow).onDomainChange) == null || n.call(s, this.visibleDomain());
|
|
1598
1943
|
}));
|
|
1599
1944
|
}
|
|
1600
1945
|
/** The time and the lane at a client point, or null outside the plot. */
|
|
@@ -1602,8 +1947,8 @@ class qs {
|
|
|
1602
1947
|
var r;
|
|
1603
1948
|
const s = (r = this.plot) == null ? void 0 : r.getBoundingClientRect();
|
|
1604
1949
|
if (s === void 0) return null;
|
|
1605
|
-
const
|
|
1606
|
-
return
|
|
1950
|
+
const n = t - s.left, i = e - s.top;
|
|
1951
|
+
return n < 0 || i < 0 || n > s.width || i > s.height ? null : { time: this.view.timeAt(n), lane: this.view.laneIdAt(i) };
|
|
1607
1952
|
}
|
|
1608
1953
|
/** The client point of a time, on a lane's middle where one is named, or
|
|
1609
1954
|
null while the schedule is not on screen. */
|
|
@@ -1611,8 +1956,8 @@ class qs {
|
|
|
1611
1956
|
var a;
|
|
1612
1957
|
const s = (a = this.plot) == null ? void 0 : a.getBoundingClientRect();
|
|
1613
1958
|
if (s === void 0) return null;
|
|
1614
|
-
const
|
|
1615
|
-
return { x: s.left +
|
|
1959
|
+
const n = this.view.viewport(), i = e === void 0 ? null : at(n, e), r = i === null ? 0 : i.top + i.height / 2;
|
|
1960
|
+
return { x: s.left + E(n, t), y: s.top + r };
|
|
1616
1961
|
}
|
|
1617
1962
|
requestDraw() {
|
|
1618
1963
|
this.frame !== 0 || this.dataCanvas === null || typeof requestAnimationFrame != "function" || (this.frame = requestAnimationFrame(() => {
|
|
@@ -1621,9 +1966,9 @@ class qs {
|
|
|
1621
1966
|
}
|
|
1622
1967
|
draw() {
|
|
1623
1968
|
if (this.root === null) return;
|
|
1624
|
-
this.colours === null && (this.colours =
|
|
1625
|
-
const { width: t, height: e } = this.view, s =
|
|
1626
|
-
if (s === null ||
|
|
1969
|
+
this.colours === null && (this.colours = Es(this.root, this.data), this.publish());
|
|
1970
|
+
const { width: t, height: e } = this.view, s = ge(this.dataCanvas, t, e), n = ge(this.overlayCanvas, t, e);
|
|
1971
|
+
if (s === null || n === null || t === 0) return;
|
|
1627
1972
|
const i = {
|
|
1628
1973
|
data: this.data,
|
|
1629
1974
|
view: this.view,
|
|
@@ -1634,385 +1979,451 @@ class qs {
|
|
|
1634
1979
|
hover: this.gestures.hover,
|
|
1635
1980
|
ghost: this.gestures.ghostDrawing()
|
|
1636
1981
|
};
|
|
1637
|
-
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
const
|
|
1641
|
-
root:
|
|
1642
|
-
corner:
|
|
1643
|
-
dayBand:
|
|
1644
|
-
tickBand:
|
|
1645
|
-
day:
|
|
1646
|
-
dayLabel:
|
|
1647
|
-
tick:
|
|
1648
|
-
tickLabel:
|
|
1649
|
-
headers:
|
|
1650
|
-
header:
|
|
1651
|
-
headerLabel:
|
|
1652
|
-
headerCount:
|
|
1653
|
-
chevron:
|
|
1654
|
-
plot:
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1982
|
+
Rs(s, i), Ps(n, i);
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
const kn = "_root_19uyg_4 _text_k1tvc_23", yn = "_corner_19uyg_19", vn = "_dayBand_19uyg_23", wn = "_tickBand_19uyg_24", bn = "_day_19uyg_23", Mn = "_dayLabel_19uyg_47", Tn = "_tick_19uyg_24", In = "_tickLabel_19uyg_65", Cn = "_headers_19uyg_73", Ln = "_header_19uyg_73", Sn = "_headerLabel_19uyg_91", An = "_headerCount_19uyg_104", _n = "_chevron_19uyg_113", Dn = "_plot_19uyg_171", Fn = "_focusRing_19uyg_178", On = "_layer_19uyg_196", En = "_grip_19uyg_205", Rn = "_ghostLabel_19uyg_215", Pn = "_finding_19uyg_228", Bn = "_refusal_19uyg_236", Nn = "_tooltip_19uyg_240", xn = "_tooltipHead_19uyg_259", Gn = "_tooltipTimes_19uyg_264", $n = "_now_19uyg_273", Hn = "_barLabel_19uyg_287", Yn = "_barLabelText_19uyg_300", w = {
|
|
1986
|
+
root: kn,
|
|
1987
|
+
corner: yn,
|
|
1988
|
+
dayBand: vn,
|
|
1989
|
+
tickBand: wn,
|
|
1990
|
+
day: bn,
|
|
1991
|
+
dayLabel: Mn,
|
|
1992
|
+
tick: Tn,
|
|
1993
|
+
tickLabel: In,
|
|
1994
|
+
headers: Cn,
|
|
1995
|
+
header: Ln,
|
|
1996
|
+
headerLabel: Sn,
|
|
1997
|
+
headerCount: An,
|
|
1998
|
+
chevron: _n,
|
|
1999
|
+
plot: Dn,
|
|
2000
|
+
focusRing: Fn,
|
|
2001
|
+
layer: On,
|
|
2002
|
+
grip: En,
|
|
2003
|
+
ghostLabel: Rn,
|
|
2004
|
+
finding: Pn,
|
|
2005
|
+
refusal: Bn,
|
|
2006
|
+
tooltip: Nn,
|
|
2007
|
+
tooltipHead: xn,
|
|
2008
|
+
tooltipTimes: Gn,
|
|
2009
|
+
now: $n,
|
|
2010
|
+
barLabel: Hn,
|
|
2011
|
+
barLabelText: Yn
|
|
1666
2012
|
};
|
|
1667
|
-
function
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
|
|
2013
|
+
function Ue() {
|
|
2014
|
+
const o = ft();
|
|
2015
|
+
return (t) => {
|
|
2016
|
+
const e = Math.round(t / W), s = Math.floor(e / 60), n = e % 60;
|
|
2017
|
+
return [s > 0 ? o.hoursShort(s) : "", n > 0 || s === 0 ? o.minutesShort(n) : ""].filter(Boolean).join(" ");
|
|
1671
2018
|
};
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
2019
|
+
}
|
|
2020
|
+
function Kn({ target: o, lane: t }) {
|
|
2021
|
+
const e = Rt(), s = ft(), n = Ue(), i = (c) => e.time(new Date(c), !1);
|
|
2022
|
+
if (o.kind === "subtask") {
|
|
2023
|
+
const { subtask: c, task: p } = o, m = [
|
|
2024
|
+
(p == null ? void 0 : p.name) ?? c.task,
|
|
2025
|
+
c.name ?? c.id,
|
|
2026
|
+
`${e.dateShort(new Date(c.from))} ${s.scheduleGhostTimes(i(c.from), i(c.to))}`,
|
|
2027
|
+
...o.overlapping.map((y) => s.scheduleOverlapWith(y.name ?? y.id)),
|
|
2028
|
+
...o.violatedDependencies.map((y) => s.scheduleViolatedBy(n(y.shortBy))),
|
|
2029
|
+
...o.blocked.map((y) => s.scheduleInBlockedTime(y.label))
|
|
2030
|
+
];
|
|
2031
|
+
return /* @__PURE__ */ Y(St, { children: [
|
|
2032
|
+
t,
|
|
2033
|
+
`, ${m.join(", ")}`
|
|
2034
|
+
] });
|
|
2035
|
+
}
|
|
2036
|
+
const { dependency: r, task: a, from: h, to: d, violated: l } = o;
|
|
2037
|
+
return [
|
|
2038
|
+
(a == null ? void 0 : a.name) ?? (a == null ? void 0 : a.id) ?? r.id,
|
|
2039
|
+
`${s.scheduleDependency} ${n(r.lag)}`,
|
|
2040
|
+
s.scheduleRoute((h == null ? void 0 : h.name) ?? r.from, (d == null ? void 0 : d.name) ?? r.to),
|
|
2041
|
+
...l === void 0 ? [] : [s.scheduleViolatedBy(n(l.shortBy))]
|
|
2042
|
+
].join(", ");
|
|
2043
|
+
}
|
|
2044
|
+
function Un({ target: o }) {
|
|
2045
|
+
const t = Rt(), e = ft(), s = (l) => t.time(new Date(l), !1), n = Ue();
|
|
2046
|
+
if (o.kind === "subtask") {
|
|
2047
|
+
const { subtask: l, task: c } = o;
|
|
2048
|
+
return /* @__PURE__ */ Y(St, { children: [
|
|
2049
|
+
/* @__PURE__ */ k("span", { className: w.tooltipHead, children: (c == null ? void 0 : c.name) ?? l.task }),
|
|
1676
2050
|
/* @__PURE__ */ k("span", { children: l.name ?? l.id }),
|
|
1677
|
-
/* @__PURE__ */ k("span", { className:
|
|
1678
|
-
(l.
|
|
1679
|
-
(l.
|
|
1680
|
-
|
|
1681
|
-
|
|
2051
|
+
/* @__PURE__ */ k("span", { className: w.tooltipTimes, children: e.scheduleGhostTimes(s(l.from), s(l.to)) }),
|
|
2052
|
+
(l.leadIn ?? 0) > 0 && /* @__PURE__ */ k("span", { children: `${e.scheduleLeadIn} ${n(l.leadIn)}` }),
|
|
2053
|
+
(l.leadOut ?? 0) > 0 && /* @__PURE__ */ k("span", { children: `${e.scheduleLeadOut} ${n(l.leadOut)}` }),
|
|
2054
|
+
o.overlapping.map((p) => /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleOverlapWith(p.name ?? p.id) }, p.id)),
|
|
2055
|
+
o.violatedDependencies.map((p) => /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleViolatedBy(n(p.shortBy)) }, p.dependency)),
|
|
2056
|
+
o.blocked.map((p) => /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleInBlockedTime(p.label) }, p.id))
|
|
1682
2057
|
] });
|
|
1683
2058
|
}
|
|
1684
|
-
const {
|
|
1685
|
-
return /* @__PURE__ */ Y(
|
|
1686
|
-
/* @__PURE__ */ k("span", { className:
|
|
1687
|
-
/* @__PURE__ */ k("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (
|
|
1688
|
-
/* @__PURE__ */ k("span", { children: `${e.
|
|
1689
|
-
|
|
2059
|
+
const { dependency: i, task: r, from: a, to: h, violated: d } = o;
|
|
2060
|
+
return /* @__PURE__ */ Y(St, { children: [
|
|
2061
|
+
/* @__PURE__ */ k("span", { className: w.tooltipHead, children: (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.id) ?? i.id }),
|
|
2062
|
+
/* @__PURE__ */ k("span", { children: e.scheduleRoute((a == null ? void 0 : a.name) ?? i.from, (h == null ? void 0 : h.name) ?? i.to) }),
|
|
2063
|
+
/* @__PURE__ */ k("span", { children: `${e.scheduleDependency} ${n(i.lag)}` }),
|
|
2064
|
+
d !== void 0 && /* @__PURE__ */ k("span", { className: w.finding, children: e.scheduleViolatedBy(n(d.shortBy)) })
|
|
1690
2065
|
] });
|
|
1691
2066
|
}
|
|
1692
|
-
const
|
|
2067
|
+
const Xn = [], Ce = { min: Et, max: 28 * rt }, Wn = [], Le = 20, eo = ns(function(t, e) {
|
|
2068
|
+
var ie;
|
|
1693
2069
|
const {
|
|
1694
2070
|
ariaLabel: s,
|
|
1695
|
-
initialDomain:
|
|
2071
|
+
initialDomain: n,
|
|
1696
2072
|
height: i = 400,
|
|
1697
|
-
laneHeight: r =
|
|
2073
|
+
laneHeight: r = ct,
|
|
1698
2074
|
headerWidth: a = 160,
|
|
1699
|
-
calendar:
|
|
1700
|
-
zoomLimits:
|
|
2075
|
+
calendar: h = Wn,
|
|
2076
|
+
zoomLimits: d,
|
|
1701
2077
|
snap: l = "ticks",
|
|
1702
|
-
intents:
|
|
2078
|
+
intents: c = Xn,
|
|
1703
2079
|
onIntent: p,
|
|
1704
|
-
canMoveTo:
|
|
1705
|
-
onInteraction:
|
|
1706
|
-
selectedTask:
|
|
1707
|
-
onSelectedTaskChange:
|
|
1708
|
-
collapsedGroups:
|
|
1709
|
-
defaultCollapsedGroups:
|
|
1710
|
-
onCollapsedGroupsChange:
|
|
2080
|
+
canMoveTo: m,
|
|
2081
|
+
onInteraction: y,
|
|
2082
|
+
selectedTask: C,
|
|
2083
|
+
onSelectedTaskChange: S,
|
|
2084
|
+
collapsedGroups: A,
|
|
2085
|
+
defaultCollapsedGroups: g,
|
|
2086
|
+
onCollapsedGroupsChange: I,
|
|
1711
2087
|
onDomainChange: L,
|
|
1712
|
-
placing:
|
|
1713
|
-
route:
|
|
1714
|
-
attach:
|
|
1715
|
-
ends:
|
|
1716
|
-
label:
|
|
1717
|
-
tooltip:
|
|
1718
|
-
now:
|
|
1719
|
-
className:
|
|
1720
|
-
style:
|
|
1721
|
-
children:
|
|
1722
|
-
} = t, [
|
|
1723
|
-
|
|
1724
|
-
if (
|
|
1725
|
-
const
|
|
1726
|
-
return () => clearInterval(
|
|
1727
|
-
}, [
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1734
|
-
{ laneHeight: r, calendar:
|
|
1735
|
-
|
|
2088
|
+
placing: F,
|
|
2089
|
+
route: D = "curve",
|
|
2090
|
+
attach: N = "centre",
|
|
2091
|
+
ends: Q = "dot",
|
|
2092
|
+
label: lt,
|
|
2093
|
+
tooltip: V,
|
|
2094
|
+
now: tt,
|
|
2095
|
+
className: Kt,
|
|
2096
|
+
style: Xe,
|
|
2097
|
+
children: We
|
|
2098
|
+
} = t, [v] = ht(() => new gn()), mt = os(), Ut = `${mt}-summary`, Xt = $(null), Wt = $(null), zt = $(null), Vt = $(null), x = Rt(), R = ft(), [gt, kt] = n, jt = (d == null ? void 0 : d.min) ?? Ce.min, qt = (d == null ? void 0 : d.max) ?? Ce.max, Zt = $(null), Jt = typeof l == "object" ? l.step : null, Qt = typeof l == "object" ? l.offset : null, te = typeof l == "object" ? null : l, [ze, Ve] = ht(() => Date.now());
|
|
2099
|
+
H(() => {
|
|
2100
|
+
if (tt !== !0) return;
|
|
2101
|
+
const u = setInterval(() => Ve(Date.now()), W);
|
|
2102
|
+
return () => clearInterval(u);
|
|
2103
|
+
}, [tt]);
|
|
2104
|
+
const ee = tt === !0 ? ze : typeof tt == "number" ? tt : null;
|
|
2105
|
+
It(() => {
|
|
2106
|
+
const u = `${gt}|${kt}`, M = Zt.current !== u;
|
|
2107
|
+
Zt.current = u;
|
|
2108
|
+
const _ = te ?? { step: Jt ?? 0, offset: Qt ?? 0 };
|
|
2109
|
+
v.setOptions(
|
|
2110
|
+
{ laneHeight: r, calendar: h, zoomLimits: { min: jt, max: qt }, snap: _, intents: c, now: ee, route: D, attach: N, ends: Q },
|
|
2111
|
+
M ? [gt, kt] : null
|
|
1736
2112
|
);
|
|
1737
|
-
}, [
|
|
1738
|
-
|
|
1739
|
-
}, [
|
|
1740
|
-
const
|
|
1741
|
-
|
|
1742
|
-
const
|
|
1743
|
-
|
|
1744
|
-
}, [
|
|
1745
|
-
|
|
1746
|
-
}, [
|
|
2113
|
+
}, [v, gt, kt, r, h, jt, qt, te, Jt, Qt, c, ee, D, N, Q]), H(() => {
|
|
2114
|
+
v.setHandlers({ onIntent: p, canMoveTo: m, onInteraction: y, onSelectedTaskChange: S, onCollapsedGroupsChange: I, onDomainChange: L });
|
|
2115
|
+
}, [v, p, m, y, S, I, L]);
|
|
2116
|
+
const je = $(g);
|
|
2117
|
+
H(() => {
|
|
2118
|
+
const u = je.current;
|
|
2119
|
+
u !== void 0 && v.setDefaultCollapsedGroups(u);
|
|
2120
|
+
}, [v]), H(() => {
|
|
2121
|
+
v.setCollapsedGroups(A);
|
|
2122
|
+
}, [v, A]), is(
|
|
1747
2123
|
e,
|
|
1748
2124
|
() => ({
|
|
1749
|
-
positionAt: (
|
|
1750
|
-
clientPointOf: (
|
|
1751
|
-
visibleDomain: () =>
|
|
2125
|
+
positionAt: (u, M) => v.positionAt(u, M),
|
|
2126
|
+
clientPointOf: (u, M) => v.clientPointOf(u, M),
|
|
2127
|
+
visibleDomain: () => v.visibleDomain()
|
|
1752
2128
|
}),
|
|
1753
|
-
[
|
|
1754
|
-
),
|
|
1755
|
-
|
|
1756
|
-
}, [
|
|
1757
|
-
|
|
1758
|
-
}, [
|
|
1759
|
-
const
|
|
1760
|
-
if (!
|
|
1761
|
-
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
const P = new ResizeObserver((
|
|
1765
|
-
var
|
|
1766
|
-
const
|
|
1767
|
-
|
|
2129
|
+
[v]
|
|
2130
|
+
), H(() => {
|
|
2131
|
+
v.setControlledTask(C);
|
|
2132
|
+
}, [v, C]), H(() => {
|
|
2133
|
+
v.setPlacing(F ?? null);
|
|
2134
|
+
}, [v, F]), H(() => {
|
|
2135
|
+
const u = Xt.current, M = Wt.current, _ = zt.current, G = Vt.current;
|
|
2136
|
+
if (!u || !M || !_ || !G) return;
|
|
2137
|
+
v.bind(u, M, _, G);
|
|
2138
|
+
const O = M.getBoundingClientRect();
|
|
2139
|
+
v.resize(O.width, O.height);
|
|
2140
|
+
const P = new ResizeObserver((B) => {
|
|
2141
|
+
var re;
|
|
2142
|
+
const nt = (re = B[B.length - 1]) == null ? void 0 : re.contentRect;
|
|
2143
|
+
nt !== void 0 && v.resize(nt.width, nt.height);
|
|
1768
2144
|
});
|
|
1769
|
-
P.observe(
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
const
|
|
1773
|
-
|
|
2145
|
+
P.observe(M);
|
|
2146
|
+
const et = (B) => v.wheel(B);
|
|
2147
|
+
u.addEventListener("wheel", et, { passive: !1 });
|
|
2148
|
+
const st = (B) => {
|
|
2149
|
+
B.key === "Escape" && v.cancelEdit() && B.preventDefault();
|
|
1774
2150
|
};
|
|
1775
|
-
return window.addEventListener("keydown",
|
|
1776
|
-
window.removeEventListener("keydown",
|
|
2151
|
+
return window.addEventListener("keydown", st), () => {
|
|
2152
|
+
window.removeEventListener("keydown", st), u.removeEventListener("wheel", et), P.disconnect(), v.unbind();
|
|
1777
2153
|
};
|
|
1778
|
-
}, [
|
|
1779
|
-
const T =
|
|
1780
|
-
const
|
|
1781
|
-
return
|
|
1782
|
-
},
|
|
1783
|
-
const
|
|
1784
|
-
for (const
|
|
1785
|
-
for (const
|
|
1786
|
-
|
|
1787
|
-
return
|
|
1788
|
-
}, [T.headers,
|
|
1789
|
-
|
|
1790
|
-
const
|
|
1791
|
-
if (
|
|
1792
|
-
const
|
|
1793
|
-
x: Math.max(2, Math.min(
|
|
1794
|
-
y:
|
|
1795
|
-
at:
|
|
2154
|
+
}, [v]);
|
|
2155
|
+
const T = rs(v.subscribe, v.getSnapshot, v.getServerSnapshot), qe = (u, M) => {
|
|
2156
|
+
const _ = new Date(u);
|
|
2157
|
+
return M >= 200 ? x.dateLong(_) : M >= 84 ? x.date(_) : M >= 44 ? x.dateShort(_) : "";
|
|
2158
|
+
}, b = T.ghost, j = T.spoken, yt = T.summary, se = (u) => `${x.dateShort(new Date(u))} ${x.time(new Date(u), !1)}`, vt = (u) => `${mt}-row-${encodeURIComponent(u.key)}`, Ze = X(() => {
|
|
2159
|
+
const u = /* @__PURE__ */ new Map();
|
|
2160
|
+
for (const M of T.headers)
|
|
2161
|
+
for (const _ of M.within)
|
|
2162
|
+
M.kind === "groupHead" && _ === M.group || u.set(_, [...u.get(_) ?? [], vt(M)]);
|
|
2163
|
+
return u;
|
|
2164
|
+
}, [T.headers, mt]), Je = X(() => new Set((b == null ? void 0 : b.refusedLanes) ?? []), [b == null ? void 0 : b.refusedLanes]), ne = $(null), [wt, Qe] = ht({ x: 0, y: 0, at: "" }), bt = b === null ? "" : `${b.x}:${b.y}:${b.from}:${b.to}:${b.overlap}:${b.violated}:${b.refused}:${b.blocked}`;
|
|
2165
|
+
It(() => {
|
|
2166
|
+
const u = ne.current;
|
|
2167
|
+
if (b === null || u === null) return;
|
|
2168
|
+
const M = 4, _ = b.y - u.offsetHeight - M, G = b.y + b.height + M, O = {
|
|
2169
|
+
x: Math.max(2, Math.min(b.x, T.width - u.offsetWidth - 2)),
|
|
2170
|
+
y: _ >= 2 ? _ : Math.min(G, T.height - u.offsetHeight - 2),
|
|
2171
|
+
at: bt
|
|
1796
2172
|
};
|
|
1797
|
-
|
|
1798
|
-
}, [
|
|
1799
|
-
const
|
|
1800
|
-
return
|
|
1801
|
-
const
|
|
1802
|
-
if (
|
|
1803
|
-
const
|
|
1804
|
-
const
|
|
1805
|
-
return Math.max(4, Math.min(
|
|
1806
|
-
},
|
|
1807
|
-
x:
|
|
1808
|
-
y:
|
|
1809
|
-
at:
|
|
2173
|
+
Qe((P) => P.x === O.x && P.y === O.y && P.at === O.at ? P : O);
|
|
2174
|
+
}, [b, bt, T.width, T.height]);
|
|
2175
|
+
const oe = $(null), [Mt, ts] = ht({ x: 0, y: 0, at: "" }), U = T.tooltip, Tt = U === null ? "" : `${U.x}:${U.y}:${U.target.kind}`;
|
|
2176
|
+
return It(() => {
|
|
2177
|
+
const u = oe.current;
|
|
2178
|
+
if (U === null || u === null) return;
|
|
2179
|
+
const M = 12, _ = (O, P, et) => {
|
|
2180
|
+
const st = O + M, B = O - M - P, nt = st + P <= et - 4 || B < 4 ? st : B;
|
|
2181
|
+
return Math.max(4, Math.min(nt, et - P - 4));
|
|
2182
|
+
}, G = {
|
|
2183
|
+
x: _(U.x, u.offsetWidth, T.width),
|
|
2184
|
+
y: _(U.y, u.offsetHeight, T.height),
|
|
2185
|
+
at: Tt
|
|
1810
2186
|
};
|
|
1811
|
-
|
|
1812
|
-
}, [
|
|
2187
|
+
ts((O) => O.x === G.x && O.y === G.y && O.at === G.at ? O : G);
|
|
2188
|
+
}, [U, Tt, T.width, T.height]), /* @__PURE__ */ Y(De.Provider, { value: v, children: [
|
|
1813
2189
|
/* @__PURE__ */ Y(
|
|
1814
2190
|
"div",
|
|
1815
2191
|
{
|
|
1816
|
-
ref:
|
|
2192
|
+
ref: Xt,
|
|
1817
2193
|
role: "figure",
|
|
1818
2194
|
"aria-label": s,
|
|
1819
|
-
className:
|
|
1820
|
-
style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...
|
|
2195
|
+
className: Kt ? `${w.root} ${Kt}` : w.root,
|
|
2196
|
+
style: { height: `${i}px`, gridTemplateColumns: `min(${a}px, 40%) minmax(0, 1fr)`, ...Xe },
|
|
1821
2197
|
children: [
|
|
1822
|
-
/* @__PURE__ */ k("div", { className:
|
|
1823
|
-
/* @__PURE__ */ k("div", { className:
|
|
1824
|
-
const
|
|
1825
|
-
return /* @__PURE__ */ k("span", { className:
|
|
2198
|
+
/* @__PURE__ */ k("div", { className: w.corner }),
|
|
2199
|
+
/* @__PURE__ */ k("div", { className: w.dayBand, "aria-hidden": "true", "data-schedule-days": "", "data-schedule-clip": "day band", children: T.days.map((u) => {
|
|
2200
|
+
const M = Math.max(0, -u.x), _ = Math.min(u.x + u.width, T.width) - Math.max(u.x, 0);
|
|
2201
|
+
return /* @__PURE__ */ k("span", { className: w.day, style: { left: `${u.x}px`, width: `${u.width}px` }, children: /* @__PURE__ */ k("span", { className: w.dayLabel, "data-schedule-overlay": "day label", style: { marginLeft: `${M}px` }, children: qe(u.start, _) }) }, u.start);
|
|
1826
2202
|
}) }),
|
|
1827
|
-
/* @__PURE__ */ k("div", { className:
|
|
2203
|
+
/* @__PURE__ */ k("div", { className: w.headers, "data-schedule-headers": "", children: /* @__PURE__ */ k("div", { className: w.headerRun, style: { transform: `translateY(${-T.scrollY}px)` }, children: T.headers.map((u) => /* @__PURE__ */ Y(
|
|
1828
2204
|
"div",
|
|
1829
2205
|
{
|
|
1830
|
-
id:
|
|
1831
|
-
className:
|
|
1832
|
-
style: { height: `${
|
|
1833
|
-
"data-lane":
|
|
1834
|
-
"data-group":
|
|
1835
|
-
"data-row":
|
|
1836
|
-
"data-schedule-clip": `header ${
|
|
1837
|
-
"data-refused":
|
|
2206
|
+
id: vt(u),
|
|
2207
|
+
className: w.header,
|
|
2208
|
+
style: { height: `${u.height}px`, paddingLeft: `calc(var(--u-space-3) + ${u.depth} * var(--u-space-3))` },
|
|
2209
|
+
"data-lane": u.lane,
|
|
2210
|
+
"data-group": u.group,
|
|
2211
|
+
"data-row": u.kind,
|
|
2212
|
+
"data-schedule-clip": `header ${u.kind}`,
|
|
2213
|
+
"data-refused": u.lane !== void 0 && Je.has(u.lane) ? "" : void 0,
|
|
1838
2214
|
children: [
|
|
1839
|
-
|
|
2215
|
+
u.kind !== "lane" && u.group !== void 0 && /* @__PURE__ */ k(
|
|
1840
2216
|
"button",
|
|
1841
2217
|
{
|
|
1842
2218
|
type: "button",
|
|
1843
|
-
className:
|
|
2219
|
+
className: w.chevron,
|
|
1844
2220
|
"data-schedule-overlay": "fold control",
|
|
1845
|
-
"aria-expanded":
|
|
1846
|
-
"aria-controls": (
|
|
1847
|
-
"aria-label": `${
|
|
1848
|
-
onClick: () =>
|
|
1849
|
-
children: /* @__PURE__ */ k(
|
|
2221
|
+
"aria-expanded": u.collapsed === !1,
|
|
2222
|
+
"aria-controls": (Ze.get(u.group) ?? [vt(u)]).join(" "),
|
|
2223
|
+
"aria-label": `${u.collapsed === !0 ? R.scheduleUnfoldGroup : R.scheduleFoldGroup}: ${typeof u.label == "string" ? u.label : u.group}`,
|
|
2224
|
+
onClick: () => v.toggleGroup(u.group),
|
|
2225
|
+
children: /* @__PURE__ */ k(fs, { size: 9, "data-open": u.collapsed === !1 ? "" : void 0 })
|
|
1850
2226
|
}
|
|
1851
2227
|
),
|
|
1852
|
-
/* @__PURE__ */ k("span", { className:
|
|
1853
|
-
|
|
2228
|
+
/* @__PURE__ */ k("span", { className: w.headerLabel, "data-schedule-overlay": "header label", children: u.label }),
|
|
2229
|
+
u.kind !== "lane" && /* @__PURE__ */ k("span", { className: w.headerCount, "data-schedule-overlay": "lane count", "data-lane-count": u.lanes, children: R.scheduleLaneCount(u.lanes) })
|
|
1854
2230
|
]
|
|
1855
2231
|
},
|
|
1856
|
-
|
|
2232
|
+
u.key
|
|
1857
2233
|
)) }) }),
|
|
1858
2234
|
/* @__PURE__ */ Y(
|
|
1859
2235
|
"div",
|
|
1860
2236
|
{
|
|
1861
|
-
ref:
|
|
1862
|
-
className:
|
|
2237
|
+
ref: Wt,
|
|
2238
|
+
className: w.plot,
|
|
1863
2239
|
"data-schedule-plot": "",
|
|
1864
2240
|
"data-schedule-clip": "plot",
|
|
1865
2241
|
style: { cursor: T.cursor },
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
2242
|
+
tabIndex: 0,
|
|
2243
|
+
role: "application",
|
|
2244
|
+
"aria-roledescription": R.scheduleRoleDescription,
|
|
2245
|
+
"aria-label": s,
|
|
2246
|
+
"aria-describedby": Ut,
|
|
2247
|
+
onKeyDown: (u) => {
|
|
2248
|
+
v.key(u.nativeEvent) && u.preventDefault();
|
|
2249
|
+
},
|
|
2250
|
+
onFocus: (u) => v.focus(zn(u.currentTarget)),
|
|
2251
|
+
onBlur: () => v.blur(),
|
|
2252
|
+
onPointerDown: (u) => v.pointerDown(u.nativeEvent),
|
|
2253
|
+
onPointerMove: (u) => v.pointerMove(u.nativeEvent),
|
|
2254
|
+
onPointerUp: (u) => v.pointerUp(u.nativeEvent),
|
|
2255
|
+
onPointerCancel: (u) => v.pointerCancel(u.nativeEvent),
|
|
2256
|
+
onPointerLeave: () => v.pointerLeave(),
|
|
2257
|
+
onContextMenu: (u) => v.contextMenu(u.nativeEvent),
|
|
2258
|
+
onDragOver: (u) => v.dragOver(u.nativeEvent),
|
|
2259
|
+
onDrop: (u) => v.drop(u.nativeEvent),
|
|
2260
|
+
onDragLeave: (u) => {
|
|
2261
|
+
const M = u.nativeEvent.relatedTarget;
|
|
2262
|
+
(!(M instanceof Node) || !u.currentTarget.contains(M)) && v.dragLeave();
|
|
1877
2263
|
},
|
|
1878
2264
|
children: [
|
|
1879
|
-
/* @__PURE__ */ k("canvas", { ref:
|
|
1880
|
-
/* @__PURE__ */ k("canvas", { ref:
|
|
1881
|
-
T.grips.map((
|
|
2265
|
+
/* @__PURE__ */ k("canvas", { ref: zt, className: w.layer, "aria-hidden": "true" }),
|
|
2266
|
+
/* @__PURE__ */ k("canvas", { ref: Vt, className: w.layer, "aria-hidden": "true" }),
|
|
2267
|
+
T.grips.map((u) => /* @__PURE__ */ k(
|
|
1882
2268
|
"span",
|
|
1883
2269
|
{
|
|
1884
|
-
"data-grip":
|
|
1885
|
-
"data-schedule-overlay": `${
|
|
2270
|
+
"data-grip": u.kind,
|
|
2271
|
+
"data-schedule-overlay": `${u.kind} grip`,
|
|
1886
2272
|
"aria-hidden": "true",
|
|
1887
|
-
className:
|
|
1888
|
-
style: { left: `${
|
|
2273
|
+
className: w.grip,
|
|
2274
|
+
style: { left: `${u.x}px`, top: `${u.y}px`, height: `${u.height}px` }
|
|
1889
2275
|
},
|
|
1890
|
-
|
|
2276
|
+
u.kind
|
|
1891
2277
|
)),
|
|
1892
|
-
|
|
2278
|
+
lt !== void 0 && T.bars.map((u) => /* @__PURE__ */ k(
|
|
1893
2279
|
"span",
|
|
1894
2280
|
{
|
|
1895
|
-
className:
|
|
1896
|
-
"data-bar-label":
|
|
2281
|
+
className: w.barLabel,
|
|
2282
|
+
"data-bar-label": u.subtask.id,
|
|
1897
2283
|
"data-schedule-overlay": "bar label",
|
|
1898
2284
|
"data-schedule-may-cover": "",
|
|
1899
|
-
"data-on":
|
|
1900
|
-
style: { left: `${
|
|
1901
|
-
children: /* @__PURE__ */ k("span", { className:
|
|
2285
|
+
"data-on": u.dark ? "dark" : "light",
|
|
2286
|
+
style: { left: `${u.x}px`, top: `${u.y}px`, width: `${u.width}px`, height: `${u.height}px` },
|
|
2287
|
+
children: /* @__PURE__ */ k("span", { className: w.barLabelText, children: lt(u.subtask) })
|
|
1902
2288
|
},
|
|
1903
|
-
|
|
2289
|
+
u.subtask.id
|
|
1904
2290
|
)),
|
|
1905
|
-
|
|
2291
|
+
V !== !1 && T.tooltip !== null && /* @__PURE__ */ k(
|
|
1906
2292
|
"span",
|
|
1907
2293
|
{
|
|
1908
|
-
ref:
|
|
2294
|
+
ref: oe,
|
|
1909
2295
|
role: "tooltip",
|
|
1910
|
-
className:
|
|
2296
|
+
className: w.tooltip,
|
|
1911
2297
|
"data-schedule-tooltip": "",
|
|
1912
2298
|
"data-schedule-overlay": "tooltip",
|
|
1913
2299
|
style: {
|
|
1914
|
-
left: `${
|
|
1915
|
-
top: `${
|
|
1916
|
-
visibility:
|
|
2300
|
+
left: `${Mt.x}px`,
|
|
2301
|
+
top: `${Mt.y}px`,
|
|
2302
|
+
visibility: Mt.at === Tt ? void 0 : "hidden"
|
|
1917
2303
|
},
|
|
1918
|
-
children: typeof
|
|
2304
|
+
children: typeof V == "function" ? V(T.tooltip.target) : /* @__PURE__ */ k(Un, { target: T.tooltip.target })
|
|
1919
2305
|
}
|
|
1920
2306
|
),
|
|
1921
|
-
|
|
2307
|
+
b !== null && /* @__PURE__ */ Y(
|
|
1922
2308
|
"span",
|
|
1923
2309
|
{
|
|
1924
|
-
ref:
|
|
1925
|
-
className:
|
|
2310
|
+
ref: ne,
|
|
2311
|
+
className: w.ghostLabel,
|
|
1926
2312
|
"data-ghost": "",
|
|
1927
2313
|
"data-schedule-overlay": "ghost label",
|
|
1928
|
-
"data-findings": [
|
|
1929
|
-
"data-refused":
|
|
2314
|
+
"data-findings": [b.overlap ? "overlap" : "", b.violated ? "violated-dependency" : ""].filter(Boolean).join(" "),
|
|
2315
|
+
"data-refused": b.refused ? "" : void 0,
|
|
2316
|
+
"data-blocked": b.blocked ? "" : void 0,
|
|
1930
2317
|
style: {
|
|
1931
|
-
left: `${
|
|
1932
|
-
top: `${
|
|
1933
|
-
visibility:
|
|
2318
|
+
left: `${wt.x}px`,
|
|
2319
|
+
top: `${wt.y}px`,
|
|
2320
|
+
visibility: wt.at === bt ? void 0 : "hidden"
|
|
1934
2321
|
},
|
|
1935
2322
|
children: [
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
2323
|
+
R.scheduleGhostTimes(x.time(new Date(b.from), !1), x.time(new Date(b.to), !1)),
|
|
2324
|
+
b.refused && /* @__PURE__ */ k("span", { className: w.refusal, children: R.scheduleLaneRefused }),
|
|
2325
|
+
b.blocked && /* @__PURE__ */ k("span", { className: w.refusal, children: R.scheduleBlockedTime }),
|
|
2326
|
+
b.overlap && /* @__PURE__ */ k("span", { className: w.finding, children: R.scheduleOverlap }),
|
|
2327
|
+
b.violated && /* @__PURE__ */ k("span", { className: w.finding, children: R.scheduleViolatedDependency })
|
|
1940
2328
|
]
|
|
1941
2329
|
}
|
|
1942
|
-
)
|
|
2330
|
+
),
|
|
2331
|
+
/* @__PURE__ */ k("span", { className: w.focusRing, "aria-hidden": "true" })
|
|
1943
2332
|
]
|
|
1944
2333
|
}
|
|
1945
2334
|
),
|
|
1946
|
-
/* @__PURE__ */ k("div", { className:
|
|
1947
|
-
/* @__PURE__ */ Y("div", { className:
|
|
1948
|
-
T.now !== null && /* @__PURE__ */ k("span", { className:
|
|
1949
|
-
T.ticks.map((
|
|
1950
|
-
] })
|
|
2335
|
+
/* @__PURE__ */ k("div", { className: w.corner }),
|
|
2336
|
+
/* @__PURE__ */ Y("div", { className: w.tickBand, "aria-hidden": "true", "data-schedule-ticks": "", "data-schedule-clip": "time band", children: [
|
|
2337
|
+
T.now !== null && /* @__PURE__ */ k("span", { className: w.now, "data-now": "", "data-schedule-overlay": "now mark", style: { left: `${T.now}px` } }),
|
|
2338
|
+
T.ticks.map((u) => /* @__PURE__ */ k("span", { className: w.tick, style: { left: `${u.x}px` }, children: u.x >= Le && u.x <= T.width - Le && /* @__PURE__ */ k("span", { className: w.tickLabel, "data-schedule-overlay": "time label", children: T.step >= rt ? x.dateShort(new Date(u.wallClock)) : x.time(new Date(u.wallClock), !1) }) }, u.wallClock))
|
|
2339
|
+
] }),
|
|
2340
|
+
/* @__PURE__ */ k(ae, { "aria-live": "polite", children: j !== null && /* @__PURE__ */ k(
|
|
2341
|
+
Kn,
|
|
2342
|
+
{
|
|
2343
|
+
target: j.target,
|
|
2344
|
+
lane: j.lane === null ? null : ((ie = v.data.lanes.find((u) => u.id === j.lane)) == null ? void 0 : ie.label) ?? j.lane
|
|
2345
|
+
},
|
|
2346
|
+
j.count
|
|
2347
|
+
) }),
|
|
2348
|
+
/* @__PURE__ */ k(ae, { id: Ut, children: `${R.scheduleSummary({ ...yt, from: se(yt.from), to: se(yt.to) })} ${R.scheduleKeyHelp}` })
|
|
1951
2349
|
]
|
|
1952
2350
|
}
|
|
1953
2351
|
),
|
|
1954
|
-
|
|
2352
|
+
We
|
|
1955
2353
|
] });
|
|
1956
2354
|
});
|
|
1957
|
-
function
|
|
1958
|
-
|
|
1959
|
-
|
|
2355
|
+
function zn(o) {
|
|
2356
|
+
try {
|
|
2357
|
+
return o.matches(":focus-visible");
|
|
2358
|
+
} catch {
|
|
2359
|
+
return !0;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
function so({ id: o, label: t }) {
|
|
2363
|
+
const e = Oe(), s = X(() => ({ id: o, label: t ?? o, ...e === null ? {} : { parent: e } }), [o, t, e]);
|
|
2364
|
+
return ms(s), null;
|
|
2365
|
+
}
|
|
2366
|
+
function no({ id: o, label: t, children: e }) {
|
|
2367
|
+
const s = Oe(), n = X(() => ({ id: o, label: t ?? o, ...s === null ? {} : { parent: s } }), [o, t, s]);
|
|
2368
|
+
return gs(n), /* @__PURE__ */ k(Fe.Provider, { value: o, children: e });
|
|
1960
2369
|
}
|
|
1961
|
-
function
|
|
1962
|
-
const
|
|
1963
|
-
return
|
|
2370
|
+
function oo({ data: o, tasks: t }) {
|
|
2371
|
+
const e = X(() => ({ kind: "subtasks", data: o, tasks: t }), [o, t]);
|
|
2372
|
+
return Bt("Subtasks", e), null;
|
|
1964
2373
|
}
|
|
1965
|
-
function
|
|
1966
|
-
const
|
|
1967
|
-
return
|
|
2374
|
+
function io({ data: o }) {
|
|
2375
|
+
const t = X(() => ({ kind: "dependencies", data: o }), [o]);
|
|
2376
|
+
return Bt("Dependencies", t), null;
|
|
1968
2377
|
}
|
|
1969
|
-
function
|
|
1970
|
-
const t =
|
|
1971
|
-
return
|
|
2378
|
+
function ro({ data: o }) {
|
|
2379
|
+
const t = X(() => ({ kind: "blocked", data: o }), [o]);
|
|
2380
|
+
return Bt("BlockedTimes", t), null;
|
|
1972
2381
|
}
|
|
1973
|
-
function
|
|
2382
|
+
function ao(o, t, e) {
|
|
1974
2383
|
if (e.kind === "place") return [];
|
|
1975
|
-
const s = new Map(
|
|
1976
|
-
for (const
|
|
1977
|
-
const
|
|
1978
|
-
|
|
2384
|
+
const s = new Map(o.map((h) => [h.id, he(h, e)])), n = /* @__PURE__ */ new Map();
|
|
2385
|
+
for (const h of t) {
|
|
2386
|
+
const d = n.get(h.from) ?? [];
|
|
2387
|
+
d.push(h), n.set(h.from, d);
|
|
1979
2388
|
}
|
|
1980
2389
|
const i = /* @__PURE__ */ new Map(), r = [e.subtask];
|
|
1981
|
-
let a = (
|
|
2390
|
+
let a = (o.length + 1) * (t.length + 1);
|
|
1982
2391
|
for (; r.length > 0 && a-- > 0; ) {
|
|
1983
|
-
const
|
|
1984
|
-
if (
|
|
1985
|
-
for (const l of
|
|
2392
|
+
const h = r.shift(), d = s.get(h);
|
|
2393
|
+
if (d !== void 0)
|
|
2394
|
+
for (const l of n.get(h) ?? []) {
|
|
1986
2395
|
if (l.to === e.subtask) continue;
|
|
1987
|
-
const
|
|
1988
|
-
if (
|
|
1989
|
-
const p =
|
|
2396
|
+
const c = s.get(l.to);
|
|
2397
|
+
if (c === void 0) continue;
|
|
2398
|
+
const p = xt(l, d) + l.lag - Gt(l, c);
|
|
1990
2399
|
if (!(p > 0)) continue;
|
|
1991
|
-
const
|
|
1992
|
-
s.set(
|
|
2400
|
+
const m = { kind: "move", subtask: c.id, from: c.from + p, to: c.to + p };
|
|
2401
|
+
s.set(c.id, he(c, m)), i.set(c.id, m), r.push(c.id);
|
|
1993
2402
|
}
|
|
1994
2403
|
}
|
|
1995
2404
|
return [...i.values()];
|
|
1996
2405
|
}
|
|
1997
|
-
function
|
|
1998
|
-
return e === 0 || !Number.isFinite(e) ? [] :
|
|
2406
|
+
function lo(o, t, e) {
|
|
2407
|
+
return e === 0 || !Number.isFinite(e) ? [] : o.filter((s) => s.task === t).map((s) => ({ kind: "move", subtask: s.id, from: s.from + e, to: s.to + e }));
|
|
1999
2408
|
}
|
|
2000
2409
|
export {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2410
|
+
ro as BlockedTimes,
|
|
2411
|
+
io as Dependencies,
|
|
2412
|
+
so as Lane,
|
|
2413
|
+
no as LaneGroup,
|
|
2414
|
+
eo as Schedule,
|
|
2415
|
+
oo as Subtasks,
|
|
2416
|
+
he as applyIntent,
|
|
2417
|
+
Gt as arrival,
|
|
2418
|
+
xt as departure,
|
|
2419
|
+
to as findings,
|
|
2420
|
+
Be as inBlockedTime,
|
|
2421
|
+
J as occupied,
|
|
2422
|
+
$t as overlaps,
|
|
2423
|
+
pt as resolveAppearance,
|
|
2424
|
+
ao as ripple,
|
|
2425
|
+
lo as shiftTask,
|
|
2426
|
+
Js as snapTime,
|
|
2427
|
+
Qn as subtaskFromPlace,
|
|
2428
|
+
Ht as violatedDependencies
|
|
2018
2429
|
};
|