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