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