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