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