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