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