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