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