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