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