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