@algorisys/zen-ui-vanilla 13.10.1 → 13.11.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/AGENTS.md +2 -2
- package/dist/_core/index.d.ts +1 -0
- package/dist/_core/messages-all.d.ts +5 -0
- package/dist/_core/messages.d.ts +5 -0
- package/dist/_core/planning-gesture.d.ts +31 -0
- package/dist/_core/planning.d.ts +71 -9
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/event-calendar/event-calendar-item.d.ts.map +1 -1
- package/dist/components/event-calendar/event-calendar-model.d.ts +6 -0
- package/dist/components/event-calendar/event-calendar-model.d.ts.map +1 -1
- package/dist/components/planning-calendar/planning-calendar.d.ts +61 -3
- package/dist/components/planning-calendar/planning-calendar.d.ts.map +1 -1
- package/dist/components/rich-text/rich-text.d.ts +5 -7
- package/dist/components/rich-text/rich-text.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index108.js +12 -4
- package/dist/index108.js.map +1 -1
- package/dist/index112.js +244 -144
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +6 -6
- package/dist/index114.js +1 -1
- package/dist/index115.js +1 -1
- package/dist/index116.js +1 -1
- package/dist/index118.js +2 -2
- package/dist/index120.js +2 -2
- package/dist/index168.js +1 -1
- package/dist/index175.js +1 -1
- package/dist/index187.js +1 -1
- package/dist/index191.js +1 -1
- package/dist/index194.js +2 -2
- package/dist/index199.js +1 -1
- package/dist/index211.js +5 -0
- package/dist/index211.js.map +1 -1
- package/dist/index230.js +107 -75
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +95 -7
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +7 -48
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +45 -37
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +38 -149
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +138 -177
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +190 -90
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +90 -444
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +436 -98
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +106 -2
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +2 -18804
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +18798 -117
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +122 -13
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +13 -3012
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +3006 -123
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +125 -140
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +138 -93
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +91 -104
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +95 -111
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +127 -4
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +5 -34
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +34 -9
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +10 -7
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +6 -15
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +15 -11
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +11 -3
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +7 -0
- package/dist/index256.js.map +1 -0
- package/dist/index99.js.map +1 -1
- package/dist/previews/analytic-chart.jpg +0 -0
- package/dist/previews/code-editor.jpg +0 -0
- package/dist/previews/countdown.jpg +0 -0
- package/dist/previews/loading.jpg +0 -0
- package/dist/previews/map.jpg +0 -0
- package/dist/previews/skeleton.jpg +0 -0
- package/dist/previews/tile.jpg +0 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/skills/zen-ui/SKILL.md +1 -1
- package/skills/zen-ui/references/api/event-calendar-event-calendar.md +1 -0
- package/skills/zen-ui/references/api/index.md +1 -1
- package/skills/zen-ui/references/api/locale.md +5 -0
- package/skills/zen-ui/references/api/planning-calendar.md +30 -1
- package/skills/zen-ui/references/api/rich-text.md +1 -1
- package/skills/zen-ui/references/api/scan-input.md +1 -1
- package/skills/zen-ui/references/catalogue.md +2 -2
package/dist/index230.js
CHANGED
|
@@ -1,107 +1,139 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return c(
|
|
1
|
+
import { sameTimeDaysLater as Y, calendarDayDiff as H } from "./index117.js";
|
|
2
|
+
const A = 6e4, $ = 60 * A, W = 24 * $, R = (t) => new Date(t.getFullYear(), t.getMonth(), t.getDate(), 0, 0, 0, 0), c = (t, e) => new Date(t.getFullYear(), t.getMonth(), t.getDate() + e, 0, 0, 0, 0), y = (t, e) => t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate(), M = (t) => String(t).padStart(2, "0"), D = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
3
|
+
function k(t, e = 1) {
|
|
4
|
+
return c(t, -((t.getDay() - e + 7) % 7));
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return new Date(
|
|
6
|
+
function p(t) {
|
|
7
|
+
return new Date(t.getFullYear(), t.getMonth(), 1, 0, 0, 0, 0);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (
|
|
11
|
-
const a =
|
|
9
|
+
function b(t, e, r = 1) {
|
|
10
|
+
if (t === "day") {
|
|
11
|
+
const a = R(e);
|
|
12
12
|
return { start: a, end: c(a, 1) };
|
|
13
13
|
}
|
|
14
|
-
if (
|
|
15
|
-
const a =
|
|
14
|
+
if (t === "week") {
|
|
15
|
+
const a = k(e, r);
|
|
16
16
|
return { start: a, end: c(a, 7) };
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
return { start:
|
|
20
|
-
}
|
|
21
|
-
function
|
|
22
|
-
if (
|
|
23
|
-
if (
|
|
24
|
-
const a =
|
|
25
|
-
return new Date(a.getFullYear(), a.getMonth() +
|
|
26
|
-
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const s =
|
|
31
|
-
for (let
|
|
32
|
-
const
|
|
18
|
+
const n = p(e);
|
|
19
|
+
return { start: n, end: new Date(n.getFullYear(), n.getMonth() + 1, 1, 0, 0, 0, 0) };
|
|
20
|
+
}
|
|
21
|
+
function O(t, e, r, n = 1) {
|
|
22
|
+
if (t === "day") return c(e, r);
|
|
23
|
+
if (t === "week") return c(k(e, n), r * 7);
|
|
24
|
+
const a = p(e);
|
|
25
|
+
return new Date(a.getFullYear(), a.getMonth() + r, 1, 0, 0, 0, 0);
|
|
26
|
+
}
|
|
27
|
+
function P(t, e, r = {}) {
|
|
28
|
+
const n = r.now ?? /* @__PURE__ */ new Date(), a = r.nonWorkingDays ?? [0, 6], o = [];
|
|
29
|
+
if (t === "day") {
|
|
30
|
+
const s = r.hourStep && r.hourStep > 0 ? r.hourStep : 1, l = r.dayStartHour ?? 0, h = r.dayEndHour ?? 24, [T, f] = r.workingHours ?? [9, 18], w = new Date(e.getFullYear(), e.getMonth(), e.getDate(), l, 0, 0, 0), d = new Date(e.getFullYear(), e.getMonth(), e.getDate(), h, 0, 0, 0).getTime();
|
|
31
|
+
for (let m = w.getTime(); m < d; m += s * $) {
|
|
32
|
+
const u = new Date(m), S = new Date(Math.min(m + s * $, d)), F = u.getHours() + u.getMinutes() / 60;
|
|
33
33
|
o.push({
|
|
34
|
-
start:
|
|
34
|
+
start: u,
|
|
35
35
|
end: S,
|
|
36
|
-
label: `${M(
|
|
36
|
+
label: `${M(u.getHours())}:${M(u.getMinutes())}`,
|
|
37
37
|
sublabel: "",
|
|
38
|
-
nonWorking:
|
|
38
|
+
nonWorking: F < T || F >= f,
|
|
39
39
|
// Every column of a day view is "today" or none of them is, so the flag
|
|
40
40
|
// would paint the whole row. It marks the column containing `now`, which
|
|
41
41
|
// is the only reading that says anything.
|
|
42
|
-
today: y(
|
|
42
|
+
today: y(u, n) && n.getTime() >= u.getTime() && n.getTime() < S.getTime()
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
return o;
|
|
46
46
|
}
|
|
47
|
-
const { start:
|
|
48
|
-
for (let s =
|
|
49
|
-
const
|
|
47
|
+
const { start: g, end: i } = b(t, e, r.weekStartsOn);
|
|
48
|
+
for (let s = g; s.getTime() < i.getTime(); s = c(s, 1)) {
|
|
49
|
+
const l = c(s, 1);
|
|
50
50
|
o.push({
|
|
51
51
|
start: s,
|
|
52
|
-
end:
|
|
53
|
-
label:
|
|
54
|
-
sublabel:
|
|
55
|
-
nonWorking:
|
|
56
|
-
today: y(s,
|
|
52
|
+
end: l,
|
|
53
|
+
label: t === "week" ? `${D[s.getDay()]} ${s.getDate()}` : String(s.getDate()),
|
|
54
|
+
sublabel: t === "month" ? D[s.getDay()] : "",
|
|
55
|
+
nonWorking: a.includes(s.getDay()),
|
|
56
|
+
today: y(s, n)
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
return o;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const { start:
|
|
63
|
-
if (
|
|
64
|
-
return `${D[
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
return `${
|
|
61
|
+
function I(t, e, r = 1) {
|
|
62
|
+
const { start: n, end: a } = b(t, e, r), o = (g) => g.toLocaleString(void 0, { month: "long" });
|
|
63
|
+
if (t === "day")
|
|
64
|
+
return `${D[n.getDay()]} ${n.getDate()} ${o(n)} ${n.getFullYear()}`;
|
|
65
|
+
if (t === "week") {
|
|
66
|
+
const g = new Date(a.getTime() - W);
|
|
67
|
+
return `${n.getFullYear() === g.getFullYear() ? n.getMonth() === g.getMonth() ? `${n.getDate()}` : `${n.getDate()} ${o(n)}` : `${n.getDate()} ${o(n)} ${n.getFullYear()}`} – ${g.getDate()} ${o(g)} ${g.getFullYear()}`;
|
|
68
68
|
}
|
|
69
|
-
return `${
|
|
69
|
+
return `${o(n)} ${n.getFullYear()}`;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
71
|
+
function _(t, e, r = 0.5) {
|
|
72
|
+
const n = e.start.getTime(), a = e.end.getTime(), o = a - n;
|
|
73
73
|
if (o <= 0) return null;
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
return { startPct:
|
|
78
|
-
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
for (const
|
|
82
|
-
let o =
|
|
83
|
-
o === -1 ? (o =
|
|
74
|
+
const g = t.start.getTime(), i = t.end.getTime(), s = Math.min(g, i), l = Math.max(g, i);
|
|
75
|
+
if (l <= n || s >= a) return null;
|
|
76
|
+
const h = s < n, T = l > a, f = Math.max(s, n), w = Math.min(l, a), d = (f - n) / o * 100, m = (w - f) / o * 100, u = Math.min(Math.max(m, r), 100 - d);
|
|
77
|
+
return { startPct: d, widthPct: u, clippedStart: h, clippedEnd: T };
|
|
78
|
+
}
|
|
79
|
+
function v(t) {
|
|
80
|
+
const e = t.map((a, o) => ({ index: o, start: Math.min(a.start.getTime(), a.end.getTime()), end: Math.max(a.start.getTime(), a.end.getTime()) })).sort((a, o) => a.start - o.start || a.end - o.end), r = [], n = new Array(t.length).fill(0);
|
|
81
|
+
for (const a of e) {
|
|
82
|
+
let o = r.findIndex((g) => g <= a.start);
|
|
83
|
+
o === -1 ? (o = r.length, r.push(a.end)) : r[o] = a.end, n[a.index] = o;
|
|
84
84
|
}
|
|
85
|
-
return { lanes:
|
|
85
|
+
return { lanes: n, laneCount: r.length };
|
|
86
|
+
}
|
|
87
|
+
function C(t, e = /* @__PURE__ */ new Date()) {
|
|
88
|
+
const r = t.start.getTime(), n = t.end.getTime(), a = e.getTime();
|
|
89
|
+
return a < r || a >= n ? null : (a - r) / (n - r) * 100;
|
|
90
|
+
}
|
|
91
|
+
function K(t, e) {
|
|
92
|
+
const r = (n) => `${M(n.getHours())}:${M(n.getMinutes())}`;
|
|
93
|
+
return y(t, e) ? `${r(t)} – ${r(e)}` : `${t.getDate()} ${D[t.getDay()]} ${r(t)} – ${e.getDate()} ${D[e.getDay()]} ${r(e)}`;
|
|
86
94
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
function B(t, e) {
|
|
96
|
+
return t.length === 0 ? e : { start: t[0].start, end: t[t.length - 1].end };
|
|
97
|
+
}
|
|
98
|
+
function x(t, e) {
|
|
99
|
+
return { start: Y(t.start, e), end: Y(t.end, e) };
|
|
100
|
+
}
|
|
101
|
+
function E(t, e, r) {
|
|
102
|
+
const n = Math.max(0, t.end.getTime() - t.start.getTime()), a = new Date(t.start.getTime() + e), o = r > 0 ? r : 1, g = a.getHours() * 60 + a.getMinutes() + a.getSeconds() / 60, i = Math.round(g / o) * o, s = new Date(a.getFullYear(), a.getMonth(), a.getDate(), 0, i, 0, 0);
|
|
103
|
+
return { start: s, end: new Date(s.getTime() + n) };
|
|
104
|
+
}
|
|
105
|
+
function N(t, e, r, n) {
|
|
106
|
+
return n.view === "day" ? E(t, r.getTime() - e.getTime(), n.snapMinutes ?? 15) : x(t, H(e, r));
|
|
107
|
+
}
|
|
108
|
+
function U(t, e, r) {
|
|
109
|
+
if (e !== "ArrowLeft" && e !== "ArrowRight") return null;
|
|
110
|
+
const n = e === "ArrowRight" !== r.rtl ? 1 : -1;
|
|
111
|
+
if (r.view === "day") {
|
|
112
|
+
const a = r.snapMinutes ?? 15;
|
|
113
|
+
return E(t, n * a * A, a);
|
|
114
|
+
}
|
|
115
|
+
return x(t, n);
|
|
90
116
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
return
|
|
117
|
+
function j(t, e) {
|
|
118
|
+
const r = Math.min(1, Math.max(0, e));
|
|
119
|
+
return new Date(t.start.getTime() + r * (t.end.getTime() - t.start.getTime()));
|
|
94
120
|
}
|
|
95
121
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
x as
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
K as formatTimeRange,
|
|
123
|
+
v as layoutLanes,
|
|
124
|
+
x as moveAppointmentByDays,
|
|
125
|
+
E as moveAppointmentInDay,
|
|
126
|
+
C as nowPct,
|
|
127
|
+
_ as placeAppointment,
|
|
128
|
+
B as planningAxis,
|
|
129
|
+
P as planningColumns,
|
|
130
|
+
U as planningKeyboardMove,
|
|
131
|
+
N as planningPointerMove,
|
|
132
|
+
b as planningRange,
|
|
133
|
+
I as planningRangeLabel,
|
|
134
|
+
j as planningTimeAt,
|
|
135
|
+
O as shiftPlanningAnchor,
|
|
136
|
+
p as startOfMonth,
|
|
137
|
+
k as startOfWeek
|
|
106
138
|
};
|
|
107
139
|
//# sourceMappingURL=index230.js.map
|
package/dist/index230.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index230.js","sources":["../../core/src/planning.ts"],"sourcesContent":["/**\n * Layout maths for a resource-by-time grid — the arithmetic behind\n * PlanningCalendar, with no DOM and no framework in it.\n *\n * A planning calendar is four calculations wearing a component: which columns a\n * view shows, where an appointment sits along that axis, which appointments\n * collide and therefore need stacking, and where \"now\" is. Every one of them\n * fails silently when wrong — a block lands half a column left, an overlap hides\n * a meeting behind another, a bar for \"now\" sits at 3pm on a Tuesday you are not\n * looking at. None of it throws.\n *\n * It lives here rather than in a binding because four renderers must not each\n * re-derive it; that is how two calendars end up disagreeing about where a\n * 09:30 meeting starts. Pinned by scripts/check-planning.ts.\n *\n * TIME ZONES: everything is computed from the caller's `Date` objects in local\n * time, deliberately. A calendar that converted would have to be told which zone\n * to convert TO, and getting that wrong moves every appointment by hours without\n * anything looking broken. If your data is UTC, convert before you pass it.\n */\n\nexport type PlanningView = \"day\" | \"week\" | \"month\";\n\nexport interface PlanningColumn {\n /** Inclusive start of the column. */\n start: Date;\n /** Exclusive end. `end` of column n is `start` of column n+1, exactly. */\n end: Date;\n /** \"09:00\", \"Mon 21\", \"21\" — what the header shows. */\n label: string;\n /** Second line of the header: the weekday for a month view, \"\" otherwise. */\n sublabel: string;\n /** Saturday/Sunday in day-column views, or outside working hours in a day view. */\n nonWorking: boolean;\n /** Contains the reference \"now\". */\n today: boolean;\n}\n\nexport interface PlanningRange {\n start: Date;\n /** Exclusive. */\n end: Date;\n}\n\nexport interface PlanningAppointmentInput {\n start: Date;\n end: Date;\n}\n\n/** Where a block sits on the axis, as percentages of the whole range. */\nexport interface PlanningPlacement {\n /** 0–100, from the range start. */\n startPct: number;\n /** >0, never taking startPct+widthPct past 100. */\n widthPct: number;\n /** The appointment begins before the visible range and is cut at the left. */\n clippedStart: boolean;\n /** …and at the right. */\n clippedEnd: boolean;\n}\n\nconst MS_MIN = 60_000;\nconst MS_HOUR = 60 * MS_MIN;\nconst MS_DAY = 24 * MS_HOUR;\n\nconst startOfDay = (d: Date): Date =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);\n\nconst addDays = (d: Date, n: number): Date =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate() + n, 0, 0, 0, 0);\n\nconst sameDay = (a: Date, b: Date): boolean =>\n a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();\n\nconst pad2 = (n: number): string => String(n).padStart(2, \"0\");\n\nconst WEEKDAYS = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\n/**\n * Monday, not Sunday.\n *\n * A week view whose first column is Sunday puts the weekend at both ends and\n * splits the working week in two, which is the one thing the view exists to show\n * whole. This is a fixed choice rather than a locale lookup: the alternative is\n * a calendar whose columns move when the browser language changes, and a caller\n * who wants Sunday-first can pass the Sunday as `start` — the range functions\n * honour the date they are given for `day`, and only `week` normalises.\n */\nexport function startOfWeek(d: Date): Date {\n const day = d.getDay();\n const backToMonday = day === 0 ? 6 : day - 1;\n return addDays(d, -backToMonday);\n}\n\nexport function startOfMonth(d: Date): Date {\n return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);\n}\n\n/**\n * The half-open interval a view covers, normalised from any date inside it.\n *\n * Half-open — `end` is the first instant NOT shown — because the alternative is\n * 23:59:59.999 arithmetic, where an appointment ending exactly at midnight\n * belongs to two days and gets drawn twice.\n */\nexport function planningRange(view: PlanningView, anchor: Date): PlanningRange {\n if (view === \"day\") {\n const start = startOfDay(anchor);\n return { start, end: addDays(start, 1) };\n }\n if (view === \"week\") {\n const start = startOfWeek(anchor);\n return { start, end: addDays(start, 7) };\n }\n const start = startOfMonth(anchor);\n return { start, end: new Date(start.getFullYear(), start.getMonth() + 1, 1, 0, 0, 0, 0) };\n}\n\n/** Move the anchor one view forward or back. `delta` is in views, not days. */\nexport function shiftPlanningAnchor(view: PlanningView, anchor: Date, delta: number): Date {\n if (view === \"day\") return addDays(anchor, delta);\n if (view === \"week\") return addDays(startOfWeek(anchor), delta * 7);\n const m = startOfMonth(anchor);\n // Month arithmetic through the Date constructor: month 12 rolls the year, and\n // day 1 cannot overflow the way \"31 January + 1 month\" does.\n return new Date(m.getFullYear(), m.getMonth() + delta, 1, 0, 0, 0, 0);\n}\n\nexport interface PlanningColumnOptions {\n /** Hours per column in the day view. Default 1. */\n hourStep?: number;\n /** Inclusive first hour of the day view. Default 0. */\n dayStartHour?: number;\n /** Exclusive last hour of the day view. Default 24. */\n dayEndHour?: number;\n /** Marks columns outside it non-working in the day view. Default 9–18. */\n workingHours?: [number, number];\n /** Day indexes (0 = Sunday) that count as non-working. Default Sat + Sun. */\n nonWorkingDays?: number[];\n /** What counts as \"today\". Defaults to the real clock. */\n now?: Date;\n}\n\n/**\n * The columns a view shows.\n *\n * A day view is hours; a week and a month are days. The month view is\n * deliberately NOT a 6×7 page grid: this is a resource-by-time chart, so a month\n * is one long axis of 28–31 columns that scrolls, and every row stays a single\n * timeline. Wrapping it into weeks would give each resource six separate rows\n * and lose the one comparison the component exists to make.\n */\nexport function planningColumns(\n view: PlanningView,\n anchor: Date,\n options: PlanningColumnOptions = {},\n): PlanningColumn[] {\n const now = options.now ?? new Date();\n const nonWorkingDays = options.nonWorkingDays ?? [0, 6];\n const columns: PlanningColumn[] = [];\n\n if (view === \"day\") {\n const step = options.hourStep && options.hourStep > 0 ? options.hourStep : 1;\n const from = options.dayStartHour ?? 0;\n const to = options.dayEndHour ?? 24;\n const [workFrom, workTo] = options.workingHours ?? [9, 18];\n /* The WALL CLOCK bounds the day, and each label is read from the instant the\n column really starts. Stepping `hour * 60 minutes` from midnight instead\n left a column labelled \"23:00\" that began at the next day's 00:00 on a\n 23-hour clock-change day, and mislabelled every hour after the jump. The\n bounds come from the local Date constructor (hour 24 normalises to the\n next midnight); the steps are real elapsed time, so a 23-hour day has 23\n columns and a 25-hour day says 01:00 twice, as the clock on the wall did. */\n const dayStart = new Date(anchor.getFullYear(), anchor.getMonth(), anchor.getDate(), from, 0, 0, 0);\n const dayEnd = new Date(anchor.getFullYear(), anchor.getMonth(), anchor.getDate(), to, 0, 0, 0).getTime();\n for (let at = dayStart.getTime(); at < dayEnd; at += step * MS_HOUR) {\n const start = new Date(at);\n const end = new Date(Math.min(at + step * MS_HOUR, dayEnd));\n const hour = start.getHours() + start.getMinutes() / 60;\n columns.push({\n start,\n end,\n label: `${pad2(start.getHours())}:${pad2(start.getMinutes())}`,\n sublabel: \"\",\n nonWorking: hour < workFrom || hour >= workTo,\n // Every column of a day view is \"today\" or none of them is, so the flag\n // would paint the whole row. It marks the column containing `now`, which\n // is the only reading that says anything.\n today: sameDay(start, now) && now.getTime() >= start.getTime() && now.getTime() < end.getTime(),\n });\n }\n return columns;\n }\n\n const { start, end } = planningRange(view, anchor);\n for (let d = start; d.getTime() < end.getTime(); d = addDays(d, 1)) {\n const next = addDays(d, 1);\n columns.push({\n start: d,\n end: next,\n label: view === \"week\" ? `${WEEKDAYS[d.getDay()]} ${d.getDate()}` : String(d.getDate()),\n sublabel: view === \"month\" ? WEEKDAYS[d.getDay()] : \"\",\n nonWorking: nonWorkingDays.includes(d.getDay()),\n today: sameDay(d, now),\n });\n }\n return columns;\n}\n\n/** A heading for the whole range — what the toolbar shows between the arrows. */\nexport function planningRangeLabel(view: PlanningView, anchor: Date): string {\n const { start, end } = planningRange(view, anchor);\n const month = (d: Date) => d.toLocaleString(undefined, { month: \"long\" });\n if (view === \"day\") {\n return `${WEEKDAYS[start.getDay()]} ${start.getDate()} ${month(start)} ${start.getFullYear()}`;\n }\n if (view === \"week\") {\n const last = new Date(end.getTime() - MS_DAY);\n // \"29 September – 5 October 2026\", not \"29 September 2026 – 5 October 2026\":\n // the year is repeated only when the week actually crosses one.\n const left =\n start.getFullYear() === last.getFullYear()\n ? start.getMonth() === last.getMonth()\n ? `${start.getDate()}`\n : `${start.getDate()} ${month(start)}`\n : `${start.getDate()} ${month(start)} ${start.getFullYear()}`;\n return `${left} – ${last.getDate()} ${month(last)} ${last.getFullYear()}`;\n }\n return `${month(start)} ${start.getFullYear()}`;\n}\n\n/**\n * Where a block sits on the axis, or `null` when it is not in view at all.\n *\n * Percentages rather than pixels, so the same numbers drive a 400px column and a\n * 2,000px one and nothing has to be measured or re-measured on resize.\n *\n * A zero-length appointment gets a real, if small, width. A block of 0% is\n * invisible and unclickable, which reads as data that did not load rather than a\n * milestone at 14:00.\n */\nexport function placeAppointment(\n appointment: PlanningAppointmentInput,\n range: PlanningRange,\n minWidthPct = 0.5,\n): PlanningPlacement | null {\n const rangeStart = range.start.getTime();\n const rangeEnd = range.end.getTime();\n const span = rangeEnd - rangeStart;\n if (span <= 0) return null;\n\n const rawStart = appointment.start.getTime();\n const rawEnd = appointment.end.getTime();\n // An inverted appointment is not a short one. Treated as a point in time at\n // its start rather than silently swapped: swapping invents a duration the\n // caller's data does not have.\n const from = Math.min(rawStart, rawEnd);\n const to = Math.max(rawStart, rawEnd);\n\n // Half-open on both sides: something ending exactly at the range start, or\n // starting exactly at its end, is not in view. Without this an appointment\n // that ends at midnight draws a zero-width sliver on the next day too.\n if (to <= rangeStart || from >= rangeEnd) return null;\n\n const clippedStart = from < rangeStart;\n const clippedEnd = to > rangeEnd;\n const visibleFrom = Math.max(from, rangeStart);\n const visibleTo = Math.min(to, rangeEnd);\n\n const startPct = ((visibleFrom - rangeStart) / span) * 100;\n const rawWidth = ((visibleTo - visibleFrom) / span) * 100;\n const widthPct = Math.min(Math.max(rawWidth, minWidthPct), 100 - startPct);\n\n return { startPct, widthPct, clippedStart, clippedEnd };\n}\n\n/**\n * Assign each appointment a lane so that overlapping ones stack instead of\n * hiding each other.\n *\n * Greedy by start time into the first lane whose last block has ended — the\n * standard interval-partitioning result, which uses exactly as many lanes as the\n * busiest instant needs. Returns one lane index per input, IN INPUT ORDER, plus\n * the total; the caller keys on its own ids and must not be handed a re-sorted\n * array it did not ask for.\n *\n * Touching is not overlapping: 10:00–11:00 and 11:00–12:00 share a lane. Half-\n * open again, and the reason a back-to-back day does not stack into a staircase.\n */\nexport function layoutLanes(appointments: PlanningAppointmentInput[]): {\n lanes: number[];\n laneCount: number;\n} {\n const order = appointments\n .map((a, index) => ({ index, start: Math.min(a.start.getTime(), a.end.getTime()), end: Math.max(a.start.getTime(), a.end.getTime()) }))\n .sort((x, y) => x.start - y.start || x.end - y.end);\n\n const laneEnds: number[] = [];\n const lanes = new Array<number>(appointments.length).fill(0);\n\n for (const item of order) {\n let lane = laneEnds.findIndex((end) => end <= item.start);\n if (lane === -1) {\n lane = laneEnds.length;\n laneEnds.push(item.end);\n } else {\n laneEnds[lane] = item.end;\n }\n lanes[item.index] = lane;\n }\n\n return { lanes, laneCount: laneEnds.length };\n}\n\n/**\n * Where \"now\" sits in the range, as a percentage, or `null` when it is outside.\n *\n * Null rather than a clamped 0 or 100: a line pinned to the left edge of next\n * week reads as \"it is Monday morning\", which is a worse answer than no line.\n */\nexport function nowPct(range: PlanningRange, now: Date = new Date()): number | null {\n const start = range.start.getTime();\n const end = range.end.getTime();\n const at = now.getTime();\n if (at < start || at >= end) return null;\n return ((at - start) / (end - start)) * 100;\n}\n\n/** \"09:00 – 10:30\", for an appointment's accessible name and tooltip. */\nexport function formatTimeRange(start: Date, end: Date): string {\n const t = (d: Date) => `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;\n return sameDay(start, end)\n ? `${t(start)} – ${t(end)}`\n : `${start.getDate()} ${WEEKDAYS[start.getDay()]} ${t(start)} – ${end.getDate()} ${WEEKDAYS[end.getDay()]} ${t(end)}`;\n}\n"],"names":["startOfDay","d","addDays","sameDay","a","b","pad2","n","WEEKDAYS","startOfWeek","day","backToMonday","startOfMonth","planningRange","view","anchor","start","shiftPlanningAnchor","delta","m","planningColumns","options","now","nonWorkingDays","columns","step","from","to","workFrom","workTo","dayStart","dayEnd","at","end","hour","next","planningRangeLabel","month","last","placeAppointment","appointment","range","minWidthPct","rangeStart","rangeEnd","span","rawStart","rawEnd","clippedStart","clippedEnd","visibleFrom","visibleTo","startPct","rawWidth","widthPct","layoutLanes","appointments","order","index","x","y","laneEnds","lanes","item","lane","nowPct","formatTimeRange"],"mappings":"AAiEA,MAAMA,IAAa,CAACC,MAClB,IAAI,KAAKA,EAAE,YAAA,GAAeA,EAAE,SAAA,GAAYA,EAAE,QAAA,GAAW,GAAG,GAAG,GAAG,CAAC,GAE3DC,IAAU,CAACD,GAAS,MACxB,IAAI,KAAKA,EAAE,YAAA,GAAeA,EAAE,SAAA,GAAYA,EAAE,YAAY,GAAG,GAAG,GAAG,GAAG,CAAC,GAE/DE,IAAU,CAACC,GAASC,MACxBD,EAAE,YAAA,MAAkBC,EAAE,YAAA,KAAiBD,EAAE,SAAA,MAAeC,EAAE,SAAA,KAAcD,EAAE,QAAA,MAAcC,EAAE,QAAA,GAEtFC,IAAO,CAACC,MAAsB,OAAOA,CAAC,EAAE,SAAS,GAAG,GAAG,GAEvDC,IAAW,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AAY1D,SAASC,EAAYR,GAAe;AACzC,QAAMS,IAAMT,EAAE,OAAA,GACRU,IAAeD,MAAQ,IAAI,IAAIA,IAAM;AAC3C,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CAAI,IAAID,EAAK,KAExBD,EAAMC,EAAK,KAAK,IAAIC;AAAA,EACtB;AAEA,SAAO,EAAE,OAAAF,GAAO,WAAWD,EAAS,OAAA;AACtC;AAQO,SAASI,EAAOxB,GAAsBnB,IAAY,oBAAI,QAAuB;AAClF,QAAMN,IAAQyB,EAAM,MAAM,QAAA,GACpBR,IAAMQ,EAAM,IAAI,QAAA,GAChBT,IAAKV,EAAI,QAAA;AACf,SAAIU,IAAKhB,KAASgB,KAAMC,IAAY,QAC3BD,IAAKhB,MAAUiB,IAAMjB,KAAU;AAC1C;AAGO,SAASkD,EAAgBlD,GAAaiB,GAAmB;AAC9D,QAAM,IAAI,CAAChC,MAAY,GAAGK,EAAKL,EAAE,UAAU,CAAC,IAAIK,EAAKL,EAAE,WAAA,CAAY,CAAC;AACpE,SAAOE,EAAQa,GAAOiB,CAAG,IACrB,GAAG,EAAEjB,CAAK,CAAC,MAAM,EAAEiB,CAAG,CAAC,KACvB,GAAGjB,EAAM,QAAA,CAAS,IAAIR,EAASQ,EAAM,OAAA,CAAQ,CAAC,IAAI,EAAEA,CAAK,CAAC,MAAMiB,EAAI,QAAA,CAAS,IAAIzB,EAASyB,EAAI,OAAA,CAAQ,CAAC,IAAI,EAAEA,CAAG,CAAC;AACvH;"}
|
|
1
|
+
{"version":3,"file":"index230.js","sources":["../../core/src/planning.ts"],"sourcesContent":["/**\n * Layout maths for a resource-by-time grid — the arithmetic behind\n * PlanningCalendar, with no DOM and no framework in it.\n *\n * A planning calendar is four calculations wearing a component: which columns a\n * view shows, where an appointment sits along that axis, which appointments\n * collide and therefore need stacking, and where \"now\" is. Every one of them\n * fails silently when wrong — a block lands half a column left, an overlap hides\n * a meeting behind another, a bar for \"now\" sits at 3pm on a Tuesday you are not\n * looking at. None of it throws.\n *\n * It lives here rather than in a binding because four renderers must not each\n * re-derive it; that is how two calendars end up disagreeing about where a\n * 09:30 meeting starts. Pinned by scripts/check-planning.ts.\n *\n * TIME ZONES: everything is computed from the caller's `Date` objects in local\n * time, deliberately. A calendar that converted would have to be told which zone\n * to convert TO, and getting that wrong moves every appointment by hours without\n * anything looking broken. If your data is UTC, convert before you pass it.\n */\n\nimport { calendarDayDiff, sameTimeDaysLater, type Weekday } from \"./event-calendar\";\n\nexport type PlanningView = \"day\" | \"week\" | \"month\";\n\nexport interface PlanningColumn {\n /** Inclusive start of the column. */\n start: Date;\n /** Exclusive end. `end` of column n is `start` of column n+1, exactly. */\n end: Date;\n /** \"09:00\", \"Mon 21\", \"21\" — what the header shows. */\n label: string;\n /** Second line of the header: the weekday for a month view, \"\" otherwise. */\n sublabel: string;\n /** Saturday/Sunday in day-column views, or outside working hours in a day view. */\n nonWorking: boolean;\n /** Contains the reference \"now\". */\n today: boolean;\n}\n\nexport interface PlanningRange {\n start: Date;\n /** Exclusive. */\n end: Date;\n}\n\nexport interface PlanningAppointmentInput {\n start: Date;\n end: Date;\n}\n\n/** Where a block sits on the axis, as percentages of the whole range. */\nexport interface PlanningPlacement {\n /** 0–100, from the range start. */\n startPct: number;\n /** >0, never taking startPct+widthPct past 100. */\n widthPct: number;\n /** The appointment begins before the visible range and is cut at the left. */\n clippedStart: boolean;\n /** …and at the right. */\n clippedEnd: boolean;\n}\n\nconst MS_MIN = 60_000;\nconst MS_HOUR = 60 * MS_MIN;\nconst MS_DAY = 24 * MS_HOUR;\n\nconst startOfDay = (d: Date): Date =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0, 0);\n\nconst addDays = (d: Date, n: number): Date =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate() + n, 0, 0, 0, 0);\n\nconst sameDay = (a: Date, b: Date): boolean =>\n a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();\n\nconst pad2 = (n: number): string => String(n).padStart(2, \"0\");\n\nconst WEEKDAYS = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\n/**\n * Monday by default, not Sunday.\n *\n * A week view whose first column is Sunday puts the weekend at both ends and\n * splits the working week in two, which is the one thing the view exists to show\n * whole. It is an explicit option (`weekStartsOn`, 0 = Sunday) rather than a\n * locale lookup: the alternative is a calendar whose columns move when the\n * browser language changes. Same option, same default, as EventCalendar.\n *\n * `(getDay() - weekStartsOn + 7) % 7` days back: the tempting\n * `d - getDay() + weekStartsOn` sends a Sunday FORWARD into next week whenever\n * the week starts on Monday, because Sunday is 0.\n */\nexport function startOfWeek(d: Date, weekStartsOn: Weekday = 1): Date {\n return addDays(d, -((d.getDay() - weekStartsOn + 7) % 7));\n}\n\nexport function startOfMonth(d: Date): Date {\n return new Date(d.getFullYear(), d.getMonth(), 1, 0, 0, 0, 0);\n}\n\n/**\n * The half-open interval a view covers, normalised from any date inside it.\n *\n * Half-open — `end` is the first instant NOT shown — because the alternative is\n * 23:59:59.999 arithmetic, where an appointment ending exactly at midnight\n * belongs to two days and gets drawn twice.\n */\nexport function planningRange(view: PlanningView, anchor: Date, weekStartsOn: Weekday = 1): PlanningRange {\n if (view === \"day\") {\n const start = startOfDay(anchor);\n return { start, end: addDays(start, 1) };\n }\n if (view === \"week\") {\n const start = startOfWeek(anchor, weekStartsOn);\n return { start, end: addDays(start, 7) };\n }\n const start = startOfMonth(anchor);\n return { start, end: new Date(start.getFullYear(), start.getMonth() + 1, 1, 0, 0, 0, 0) };\n}\n\n/** Move the anchor one view forward or back. `delta` is in views, not days. */\nexport function shiftPlanningAnchor(\n view: PlanningView,\n anchor: Date,\n delta: number,\n weekStartsOn: Weekday = 1,\n): Date {\n if (view === \"day\") return addDays(anchor, delta);\n if (view === \"week\") return addDays(startOfWeek(anchor, weekStartsOn), delta * 7);\n const m = startOfMonth(anchor);\n // Month arithmetic through the Date constructor: month 12 rolls the year, and\n // day 1 cannot overflow the way \"31 January + 1 month\" does.\n return new Date(m.getFullYear(), m.getMonth() + delta, 1, 0, 0, 0, 0);\n}\n\nexport interface PlanningColumnOptions {\n /** Hours per column in the day view. Default 1. */\n hourStep?: number;\n /** Inclusive first hour of the day view. Default 0. */\n dayStartHour?: number;\n /** Exclusive last hour of the day view. Default 24. */\n dayEndHour?: number;\n /** Marks columns outside it non-working in the day view. Default 9–18. */\n workingHours?: [number, number];\n /** Day indexes (0 = Sunday) that count as non-working. Default Sat + Sun. */\n nonWorkingDays?: number[];\n /** First day of a week view (0 = Sunday). Default 1, Monday. */\n weekStartsOn?: Weekday;\n /** What counts as \"today\". Defaults to the real clock. */\n now?: Date;\n}\n\n/**\n * The columns a view shows.\n *\n * A day view is hours; a week and a month are days. The month view is\n * deliberately NOT a 6×7 page grid: this is a resource-by-time chart, so a month\n * is one long axis of 28–31 columns that scrolls, and every row stays a single\n * timeline. Wrapping it into weeks would give each resource six separate rows\n * and lose the one comparison the component exists to make.\n */\nexport function planningColumns(\n view: PlanningView,\n anchor: Date,\n options: PlanningColumnOptions = {},\n): PlanningColumn[] {\n const now = options.now ?? new Date();\n const nonWorkingDays = options.nonWorkingDays ?? [0, 6];\n const columns: PlanningColumn[] = [];\n\n if (view === \"day\") {\n const step = options.hourStep && options.hourStep > 0 ? options.hourStep : 1;\n const from = options.dayStartHour ?? 0;\n const to = options.dayEndHour ?? 24;\n const [workFrom, workTo] = options.workingHours ?? [9, 18];\n /* The WALL CLOCK bounds the day, and each label is read from the instant the\n column really starts. Stepping `hour * 60 minutes` from midnight instead\n left a column labelled \"23:00\" that began at the next day's 00:00 on a\n 23-hour clock-change day, and mislabelled every hour after the jump. The\n bounds come from the local Date constructor (hour 24 normalises to the\n next midnight); the steps are real elapsed time, so a 23-hour day has 23\n columns and a 25-hour day says 01:00 twice, as the clock on the wall did. */\n const dayStart = new Date(anchor.getFullYear(), anchor.getMonth(), anchor.getDate(), from, 0, 0, 0);\n const dayEnd = new Date(anchor.getFullYear(), anchor.getMonth(), anchor.getDate(), to, 0, 0, 0).getTime();\n for (let at = dayStart.getTime(); at < dayEnd; at += step * MS_HOUR) {\n const start = new Date(at);\n const end = new Date(Math.min(at + step * MS_HOUR, dayEnd));\n const hour = start.getHours() + start.getMinutes() / 60;\n columns.push({\n start,\n end,\n label: `${pad2(start.getHours())}:${pad2(start.getMinutes())}`,\n sublabel: \"\",\n nonWorking: hour < workFrom || hour >= workTo,\n // Every column of a day view is \"today\" or none of them is, so the flag\n // would paint the whole row. It marks the column containing `now`, which\n // is the only reading that says anything.\n today: sameDay(start, now) && now.getTime() >= start.getTime() && now.getTime() < end.getTime(),\n });\n }\n return columns;\n }\n\n const { start, end } = planningRange(view, anchor, options.weekStartsOn);\n for (let d = start; d.getTime() < end.getTime(); d = addDays(d, 1)) {\n const next = addDays(d, 1);\n columns.push({\n start: d,\n end: next,\n label: view === \"week\" ? `${WEEKDAYS[d.getDay()]} ${d.getDate()}` : String(d.getDate()),\n sublabel: view === \"month\" ? WEEKDAYS[d.getDay()] : \"\",\n nonWorking: nonWorkingDays.includes(d.getDay()),\n today: sameDay(d, now),\n });\n }\n return columns;\n}\n\n/** A heading for the whole range — what the toolbar shows between the arrows. */\nexport function planningRangeLabel(view: PlanningView, anchor: Date, weekStartsOn: Weekday = 1): string {\n const { start, end } = planningRange(view, anchor, weekStartsOn);\n const month = (d: Date) => d.toLocaleString(undefined, { month: \"long\" });\n if (view === \"day\") {\n return `${WEEKDAYS[start.getDay()]} ${start.getDate()} ${month(start)} ${start.getFullYear()}`;\n }\n if (view === \"week\") {\n const last = new Date(end.getTime() - MS_DAY);\n // \"29 September – 5 October 2026\", not \"29 September 2026 – 5 October 2026\":\n // the year is repeated only when the week actually crosses one.\n const left =\n start.getFullYear() === last.getFullYear()\n ? start.getMonth() === last.getMonth()\n ? `${start.getDate()}`\n : `${start.getDate()} ${month(start)}`\n : `${start.getDate()} ${month(start)} ${start.getFullYear()}`;\n return `${left} – ${last.getDate()} ${month(last)} ${last.getFullYear()}`;\n }\n return `${month(start)} ${start.getFullYear()}`;\n}\n\n/**\n * Where a block sits on the axis, or `null` when it is not in view at all.\n *\n * Percentages rather than pixels, so the same numbers drive a 400px column and a\n * 2,000px one and nothing has to be measured or re-measured on resize.\n *\n * A zero-length appointment gets a real, if small, width. A block of 0% is\n * invisible and unclickable, which reads as data that did not load rather than a\n * milestone at 14:00.\n */\nexport function placeAppointment(\n appointment: PlanningAppointmentInput,\n range: PlanningRange,\n minWidthPct = 0.5,\n): PlanningPlacement | null {\n const rangeStart = range.start.getTime();\n const rangeEnd = range.end.getTime();\n const span = rangeEnd - rangeStart;\n if (span <= 0) return null;\n\n const rawStart = appointment.start.getTime();\n const rawEnd = appointment.end.getTime();\n // An inverted appointment is not a short one. Treated as a point in time at\n // its start rather than silently swapped: swapping invents a duration the\n // caller's data does not have.\n const from = Math.min(rawStart, rawEnd);\n const to = Math.max(rawStart, rawEnd);\n\n // Half-open on both sides: something ending exactly at the range start, or\n // starting exactly at its end, is not in view. Without this an appointment\n // that ends at midnight draws a zero-width sliver on the next day too.\n if (to <= rangeStart || from >= rangeEnd) return null;\n\n const clippedStart = from < rangeStart;\n const clippedEnd = to > rangeEnd;\n const visibleFrom = Math.max(from, rangeStart);\n const visibleTo = Math.min(to, rangeEnd);\n\n const startPct = ((visibleFrom - rangeStart) / span) * 100;\n const rawWidth = ((visibleTo - visibleFrom) / span) * 100;\n const widthPct = Math.min(Math.max(rawWidth, minWidthPct), 100 - startPct);\n\n return { startPct, widthPct, clippedStart, clippedEnd };\n}\n\n/**\n * Assign each appointment a lane so that overlapping ones stack instead of\n * hiding each other.\n *\n * Greedy by start time into the first lane whose last block has ended — the\n * standard interval-partitioning result, which uses exactly as many lanes as the\n * busiest instant needs. Returns one lane index per input, IN INPUT ORDER, plus\n * the total; the caller keys on its own ids and must not be handed a re-sorted\n * array it did not ask for.\n *\n * Touching is not overlapping: 10:00–11:00 and 11:00–12:00 share a lane. Half-\n * open again, and the reason a back-to-back day does not stack into a staircase.\n */\nexport function layoutLanes(appointments: PlanningAppointmentInput[]): {\n lanes: number[];\n laneCount: number;\n} {\n const order = appointments\n .map((a, index) => ({ index, start: Math.min(a.start.getTime(), a.end.getTime()), end: Math.max(a.start.getTime(), a.end.getTime()) }))\n .sort((x, y) => x.start - y.start || x.end - y.end);\n\n const laneEnds: number[] = [];\n const lanes = new Array<number>(appointments.length).fill(0);\n\n for (const item of order) {\n let lane = laneEnds.findIndex((end) => end <= item.start);\n if (lane === -1) {\n lane = laneEnds.length;\n laneEnds.push(item.end);\n } else {\n laneEnds[lane] = item.end;\n }\n lanes[item.index] = lane;\n }\n\n return { lanes, laneCount: laneEnds.length };\n}\n\n/**\n * Where \"now\" sits in the range, as a percentage, or `null` when it is outside.\n *\n * Null rather than a clamped 0 or 100: a line pinned to the left edge of next\n * week reads as \"it is Monday morning\", which is a worse answer than no line.\n */\nexport function nowPct(range: PlanningRange, now: Date = new Date()): number | null {\n const start = range.start.getTime();\n const end = range.end.getTime();\n const at = now.getTime();\n if (at < start || at >= end) return null;\n return ((at - start) / (end - start)) * 100;\n}\n\n/** \"09:00 – 10:30\", for an appointment's accessible name and tooltip. */\nexport function formatTimeRange(start: Date, end: Date): string {\n const t = (d: Date) => `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;\n return sameDay(start, end)\n ? `${t(start)} – ${t(end)}`\n : `${start.getDate()} ${WEEKDAYS[start.getDay()]} ${t(start)} – ${end.getDate()} ${WEEKDAYS[end.getDay()]} ${t(end)}`;\n}\n\n/**\n * The span the time axis actually draws: the first column's start to the last\n * column's end.\n *\n * Not `planningRange`. A day view trimmed to 08:00–20:00 draws twelve columns,\n * and placing blocks against the whole 24-hour range would put 09:00 a third of\n * the way across a grid whose left edge says 08:00. For a week or a month the\n * two are the same. Falls back to the view's range when there are no columns\n * (a day view whose start hour is not before its end hour).\n */\nexport function planningAxis(columns: PlanningColumn[], fallback: PlanningRange): PlanningRange {\n if (columns.length === 0) return fallback;\n return { start: columns[0].start, end: columns[columns.length - 1].end };\n}\n\n/* ------------------------------------------------------------------------ *\n * Moves. These return where an appointment WOULD go; nothing here applies\n * anything. PlanningCalendar proposes and the caller decides, the same rule as\n * EventCalendar and reschedule.ts: a conflict policy, an undo and a permission\n * model belong to the caller's domain.\n * ------------------------------------------------------------------------ */\n\nexport interface PlanningMoveOptions {\n view: PlanningView;\n /** Minutes a move snaps to in the day view. Default 15. Week and month move whole days. */\n snapMinutes?: number;\n}\n\n/**\n * The same appointment `days` calendar days later (or earlier), keeping its\n * wall-clock start and end.\n *\n * Calendar days, not 24-hour steps: a 10:00 meeting moved across a clock change\n * is still at 10:00, and an all-day project ending at 23:59 still ends at 23:59.\n */\nexport function moveAppointmentByDays(appointment: PlanningAppointmentInput, days: number): PlanningAppointmentInput {\n return { start: sameTimeDaysLater(appointment.start, days), end: sameTimeDaysLater(appointment.end, days) };\n}\n\n/**\n * Move by `deltaMs` of elapsed time and snap the START to the wall-clock grid\n * of `snap` minutes, keeping the duration.\n *\n * Snapping the start rather than the delta is what lands a dragged 10:07\n * meeting on 10:15 instead of on 10:22.\n */\nexport function moveAppointmentInDay(\n appointment: PlanningAppointmentInput,\n deltaMs: number,\n snap: number,\n): PlanningAppointmentInput {\n const duration = Math.max(0, appointment.end.getTime() - appointment.start.getTime());\n const raw = new Date(appointment.start.getTime() + deltaMs);\n const step = snap > 0 ? snap : 1;\n const minutes = raw.getHours() * 60 + raw.getMinutes() + raw.getSeconds() / 60;\n const snapped = Math.round(minutes / step) * step;\n const start = new Date(raw.getFullYear(), raw.getMonth(), raw.getDate(), 0, snapped, 0, 0);\n return { start, end: new Date(start.getTime() + duration) };\n}\n\n/**\n * Where a pointer drag proposes the appointment goes: grabbed at `from`,\n * released over `to` (both instants on the axis).\n *\n * Week and month move by whole calendar days between the two, so a project\n * dragged from Monday to Thursday keeps its times. The day view moves by the\n * elapsed time and snaps.\n */\nexport function planningPointerMove(\n appointment: PlanningAppointmentInput,\n from: Date,\n to: Date,\n options: PlanningMoveOptions,\n): PlanningAppointmentInput {\n if (options.view === \"day\") {\n return moveAppointmentInDay(appointment, to.getTime() - from.getTime(), options.snapMinutes ?? 15);\n }\n return moveAppointmentByDays(appointment, calendarDayDiff(from, to));\n}\n\n/**\n * What Alt+ArrowLeft / Alt+ArrowRight propose for a focused appointment: one\n * day in a week or month, `snapMinutes` in a day. Left and Right swap under RTL,\n * where the later time is drawn on the left. Anything else returns null; rows\n * (Up / Down) are the component's business, since only it knows the row order.\n */\nexport function planningKeyboardMove(\n appointment: PlanningAppointmentInput,\n key: string,\n options: PlanningMoveOptions & { rtl: boolean },\n): PlanningAppointmentInput | null {\n if (key !== \"ArrowLeft\" && key !== \"ArrowRight\") return null;\n const sign = (key === \"ArrowRight\") !== options.rtl ? 1 : -1;\n if (options.view === \"day\") {\n const snap = options.snapMinutes ?? 15;\n return moveAppointmentInDay(appointment, sign * snap * MS_MIN, snap);\n }\n return moveAppointmentByDays(appointment, sign);\n}\n\n/**\n * The instant under a pointer at `fraction` (0–1) across the axis, measured\n * from its START edge: the caller flips it under RTL. Clamped to the axis, so a\n * drag past either end lands on the edge instead of in a week nobody sees.\n */\nexport function planningTimeAt(axis: PlanningRange, fraction: number): Date {\n const f = Math.min(1, Math.max(0, fraction));\n return new Date(axis.start.getTime() + f * (axis.end.getTime() - axis.start.getTime()));\n}\n"],"names":["MS_MIN","MS_HOUR","MS_DAY","startOfDay","d","addDays","n","sameDay","a","b","pad2","WEEKDAYS","startOfWeek","weekStartsOn","startOfMonth","planningRange","view","anchor","start","shiftPlanningAnchor","delta","m","planningColumns","options","now","nonWorkingDays","columns","step","from","to","workFrom","workTo","dayStart","dayEnd","at","end","hour","next","planningRangeLabel","month","last","placeAppointment","appointment","range","minWidthPct","rangeStart","rangeEnd","span","rawStart","rawEnd","clippedStart","clippedEnd","visibleFrom","visibleTo","startPct","rawWidth","widthPct","layoutLanes","appointments","order","index","x","y","laneEnds","lanes","item","lane","nowPct","formatTimeRange","t","planningAxis","fallback","moveAppointmentByDays","days","sameTimeDaysLater","moveAppointmentInDay","deltaMs","snap","duration","raw","minutes","snapped","planningPointerMove","calendarDayDiff","planningKeyboardMove","key","sign","planningTimeAt","axis","fraction","f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S,QACZoD,EAAqBjC,GAAab,EAAG,QAAA,IAAYD,EAAK,WAAWL,EAAQ,eAAe,EAAE,IAE5FiD,EAAsB9B,GAAayC,EAAgBvD,GAAMC,CAAE,CAAC;AACrE;AAQO,SAASuD,EACd1C,GACA2C,GACA9D,GACiC;AACjC,MAAI8D,MAAQ,eAAeA,MAAQ,aAAc,QAAO;AACxD,QAAMC,IAAQD,MAAQ,iBAAkB9D,EAAQ,MAAM,IAAI;AAC1D,MAAIA,EAAQ,SAAS,OAAO;AAC1B,UAAMsD,IAAOtD,EAAQ,eAAe;AACpC,WAAOoD,EAAqBjC,GAAa4C,IAAOT,IAAO7E,GAAQ6E,CAAI;AAAA,EACrE;AACA,SAAOL,EAAsB9B,GAAa4C,CAAI;AAChD;AAOO,SAASC,EAAeC,GAAqBC,GAAwB;AAC1E,QAAMC,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGD,CAAQ,CAAC;AAC3C,SAAO,IAAI,KAAKD,EAAK,MAAM,YAAYE,KAAKF,EAAK,IAAI,QAAA,IAAYA,EAAK,MAAM,UAAU;AACxF;"}
|
package/dist/index231.js
CHANGED
|
@@ -1,10 +1,98 @@
|
|
|
1
|
-
|
|
1
|
+
import { LONG_PRESS_MS as U } from "./index246.js";
|
|
2
|
+
import { planningTimeAt as O, planningPointerMove as K } from "./index230.js";
|
|
3
|
+
const j = 3, z = 8, m = 40, G = 14;
|
|
4
|
+
function H(t, n, o) {
|
|
5
|
+
const s = t.getRootNode(), i = s.elementsFromPoint ? s.elementsFromPoint(n, o) : t.ownerDocument.elementsFromPoint(n, o);
|
|
6
|
+
for (const g of i) {
|
|
7
|
+
const c = g.closest?.("[data-plan-lane]");
|
|
8
|
+
if (!(!c || !t.contains(c)))
|
|
9
|
+
return { rowId: c.getAttribute("data-plan-lane") ?? "", fraction: J(c, n) };
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
function J(t, n) {
|
|
14
|
+
const o = t.getBoundingClientRect();
|
|
15
|
+
if (o.width <= 0) return 0;
|
|
16
|
+
const s = (n - o.left) / o.width, i = getComputedStyle(t).direction === "rtl";
|
|
17
|
+
return Math.min(1, Math.max(0, i ? 1 - s : s));
|
|
18
|
+
}
|
|
19
|
+
function W(t) {
|
|
20
|
+
const { event: n, root: o, axis: s, scroller: i } = t;
|
|
21
|
+
if (n.button !== 0 || !n.isPrimary) return !1;
|
|
22
|
+
const g = H(o, n.clientX, n.clientY);
|
|
23
|
+
if (!g) return !1;
|
|
24
|
+
const c = t.target ?? (n.currentTarget instanceof Element ? n.currentTarget : n.target), f = n.pointerId;
|
|
25
|
+
try {
|
|
26
|
+
c.setPointerCapture(f);
|
|
27
|
+
} catch {
|
|
28
|
+
}
|
|
29
|
+
n.pointerType === "mouse" && n.preventDefault();
|
|
30
|
+
const b = O(s, g.fraction), L = n.clientX, E = n.clientY;
|
|
31
|
+
let l = L, w = E, a = !1, p = !1, u = null, d = 0;
|
|
32
|
+
const q = () => {
|
|
33
|
+
const e = H(o, l, w);
|
|
34
|
+
if (!e) return u;
|
|
35
|
+
const r = O(s, e.fraction);
|
|
36
|
+
return { ...K(t.appointment, b, r, {
|
|
37
|
+
view: t.view,
|
|
38
|
+
snapMinutes: t.snapMinutes
|
|
39
|
+
}), rowId: t.allowRowChange ? e.rowId : t.rowId };
|
|
40
|
+
}, B = (e, r) => e === r || !!e && !!r && e.start.getTime() === r.start.getTime() && e.end.getTime() === r.end.getTime() && e.rowId === r.rowId, P = () => {
|
|
41
|
+
const e = q();
|
|
42
|
+
B(e, u) || (u = e, t.onPreview(u));
|
|
43
|
+
}, I = () => {
|
|
44
|
+
if (d = 0, !a) return;
|
|
45
|
+
let e = !1;
|
|
46
|
+
if (i) {
|
|
47
|
+
const r = i.getBoundingClientRect(), h = r.left + m - l, x = l - (r.right - m), F = h > 0 ? -Math.ceil(Math.min(h, m) / m * G) : x > 0 ? Math.ceil(Math.min(x, m) / m * G) : 0;
|
|
48
|
+
if (F !== 0) {
|
|
49
|
+
const Y = i.scrollLeft;
|
|
50
|
+
i.scrollLeft = Y + F, e = i.scrollLeft !== Y;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
P(), e && (d = requestAnimationFrame(I));
|
|
54
|
+
}, N = () => {
|
|
55
|
+
d || (d = requestAnimationFrame(I));
|
|
56
|
+
}, C = n.pointerType === "touch";
|
|
57
|
+
let y = !C, v = 0;
|
|
58
|
+
const X = (e) => {
|
|
59
|
+
e.cancelable && e.preventDefault();
|
|
60
|
+
}, k = (e) => e.preventDefault();
|
|
61
|
+
C && (window.addEventListener("contextmenu", k, !0), v = window.setTimeout(() => {
|
|
62
|
+
v = 0, y = !0, a = !0, window.addEventListener("touchmove", X, { capture: !0, passive: !1 }), P();
|
|
63
|
+
}, U));
|
|
64
|
+
const D = (e) => {
|
|
65
|
+
if (!(e.pointerId !== f || p)) {
|
|
66
|
+
if (l = e.clientX, w = e.clientY, !y) {
|
|
67
|
+
Math.hypot(l - L, w - E) > z && T(!1);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
!a && Math.hypot(l - L, w - E) > j && (a = !0), a && N();
|
|
71
|
+
}
|
|
72
|
+
}, _ = (e) => {
|
|
73
|
+
e.stopPropagation(), e.preventDefault();
|
|
74
|
+
}, R = () => {
|
|
75
|
+
d && cancelAnimationFrame(d), d = 0, u && t.onPreview(null), u = null;
|
|
76
|
+
}, T = (e) => {
|
|
77
|
+
v && window.clearTimeout(v), v = 0, window.removeEventListener("touchmove", X, !0), window.removeEventListener("contextmenu", k, !0), window.removeEventListener("pointermove", D, !0), window.removeEventListener("pointerup", S, !0), window.removeEventListener("pointercancel", A, !0), window.removeEventListener("keydown", M, !0);
|
|
78
|
+
try {
|
|
79
|
+
c.isConnected && c.hasPointerCapture?.(f) && c.releasePointerCapture(f);
|
|
80
|
+
} catch {
|
|
81
|
+
}
|
|
82
|
+
(a || p) && (window.addEventListener("click", _, { capture: !0, once: !0 }), setTimeout(() => window.removeEventListener("click", _, { capture: !0 }), 0));
|
|
83
|
+
const r = u;
|
|
84
|
+
if (R(), !e || p || !a || !r) return;
|
|
85
|
+
r.rowId === t.rowId && r.start.getTime() === t.appointment.start.getTime() && r.end.getTime() === t.appointment.end.getTime() || t.onCommit(r);
|
|
86
|
+
}, S = (e) => {
|
|
87
|
+
e.pointerId === f && (l = e.clientX, w = e.clientY, a && !p && P(), T(!0));
|
|
88
|
+
}, A = (e) => {
|
|
89
|
+
e.pointerId === f && T(!1);
|
|
90
|
+
}, M = (e) => {
|
|
91
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), p = !0, window.removeEventListener("keydown", M, !0), R());
|
|
92
|
+
};
|
|
93
|
+
return window.addEventListener("pointermove", D, !0), window.addEventListener("pointerup", S, !0), window.addEventListener("pointercancel", A, !0), window.addEventListener("keydown", M, !0), !0;
|
|
94
|
+
}
|
|
2
95
|
export {
|
|
3
|
-
|
|
4
|
-
E as eventHourPx,
|
|
5
|
-
u as eventRowPx,
|
|
6
|
-
s as ganttBarPx,
|
|
7
|
-
b as laneBarPx,
|
|
8
|
-
l as scheduleRowPx
|
|
96
|
+
W as startPlanningGesture
|
|
9
97
|
};
|
|
10
98
|
//# sourceMappingURL=index231.js.map
|
package/dist/index231.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index231.js","sources":["../../core/src/density.ts"],"sourcesContent":["/**\n * Component density — the opt-in `density` prop on the schedules,\n * PlanningCalendar, SpreadsheetGrid and Tree.\n *\n * bun run check:density\n *\n * The same three names as the `data-density` tokens (tokens.css). This is a\n * PROP rather than a reading of that attribute on purpose: these components\n * never followed data-density, and starting to would reflow every app that\n * already sets data-density=\"touch\" for its controls. A prop changes only the\n * component it is set on.\n *\n * \"comfortable\" is the default and is exactly the size each component always\n * drew. \"touch\" reaches 48px targets, like data-density=\"touch\" for controls.\n * An explicit size (rowHeight, laneHeight) wins over density. The classes for\n * SpreadsheetGrid and Tree live in variants.ts, which Uno scans.\n */\n\nexport type Density = \"compact\" | \"comfortable\" | \"touch\";\nexport const DENSITIES: readonly Density[] = [\"compact\", \"comfortable\", \"touch\"];\n\nconst SCHEDULE_ROW: Record<Density, number> = { compact: 28, comfortable: 36, touch: 48 };\nconst GANTT_BAR: Record<Density, number> = { compact: 14, comfortable: 18, touch: 32 };\nconst LANE_BAR: Record<Density, number> = { compact: 12, comfortable: 16, touch: 32 };\n// A calendar block is its lane less 6px: touch's 54 makes a 48px block.\nconst CALENDAR_LANE: Record<Density, number> = { compact: 24, comfortable: 30, touch: 54 };\n// EventCalendar: one hour of the time grid, and one row of a month cell or the\n// all-day strip. Touch's row is 44, the smallest target WCAG's AAA level allows,\n// rather than 48: a month cell must still fit several of them.\nconst EVENT_HOUR: Record<Density, number> = { compact: 36, comfortable: 48, touch: 64 };\nconst EVENT_ROW: Record<Density, number> = { compact: 20, comfortable: 24, touch: 44 };\n\n/** A Gantt row, or ProductionSchedule's least row height. */\nexport const scheduleRowPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? SCHEDULE_ROW[density];\n/** A Gantt bar's height. */\nexport const ganttBarPx = (density: Density = \"comfortable\"): number => GANTT_BAR[density];\n/** One lane's bar in ProductionSchedule. */\nexport const laneBarPx = (density: Density = \"comfortable\"): number => LANE_BAR[density];\n/** A PlanningCalendar lane. */\nexport const calendarLanePx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? CALENDAR_LANE[density];\n/** One hour of EventCalendar's time grid. */\nexport const eventHourPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? EVENT_HOUR[density];\n/** One event row in an EventCalendar month cell or all-day strip. */\nexport const eventRowPx = (density: Density = \"comfortable\"): number => EVENT_ROW[density];\n"],"names":["SCHEDULE_ROW","GANTT_BAR","LANE_BAR","CALENDAR_LANE","EVENT_HOUR","EVENT_ROW","scheduleRowPx","density","explicit","ganttBarPx","laneBarPx","calendarLanePx","eventHourPx","eventRowPx"],"mappings":"AAqBA,MAAMA,IAAwC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC/EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC5EC,IAAoC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAE3EC,IAAyC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAIhFC,IAAsC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC7EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAGrEC,IAAgB,CAACC,IAAmB,eAAeC,MAC9DA,KAAYR,EAAaO,CAAO,GAErBE,IAAa,CAACF,IAAmB,kBAA0BN,EAAUM,CAAO,GAE5EG,IAAY,CAACH,IAAmB,kBAA0BL,EAASK,CAAO,GAE1EI,IAAiB,CAACJ,IAAmB,eAAeC,MAC/DA,KAAYL,EAAcI,CAAO,GAEtBK,IAAc,CAACL,IAAmB,eAAeC,MAC5DA,KAAYJ,EAAWG,CAAO,GAEnBM,IAAa,CAACN,IAAmB,kBAA0BF,EAAUE,CAAO;"}
|
|
1
|
+
{"version":3,"file":"index231.js","sources":["../../core/src/planning-gesture.ts"],"sourcesContent":["/**\n * The pointer half of PlanningCalendar's editing: drag an appointment along its\n * row to reschedule it, and (when the caller allows it) onto another row.\n * Plain DOM, so every binding wires the same gesture instead of re-deriving one.\n *\n * EventCalendar's gesture (event-calendar-gesture.ts) is the model and shares\n * its rules, but not its geometry: there, time runs DOWN a day column; here it\n * runs ACROSS a resource row, and the row itself is part of the answer.\n *\n * It PROPOSES. `onPreview` gets the move the gesture would make while it runs,\n * `onCommit` gets it once on release, and nothing here touches an appointment.\n *\n * Hit-testing goes through the DOM on every move: a row's time lane is any\n * element with `data-plan-lane=\"<row id>\"`. Reading the element under the\n * pointer makes RTL, page scroll, the grid's own scroll and a resize during the\n * drag all correct for free. The binding must keep its preview ghost\n * `pointer-events: none`, or the ghost becomes the element under the pointer.\n *\n * Touch starts on a long press, as in EventCalendar: move first and it is a\n * scroll. Escape abandons the drag; the release after it is swallowed so it\n * does not arrive as a click that opens the appointment.\n */\nimport { LONG_PRESS_MS } from \"./event-calendar-gesture\";\nimport {\n planningPointerMove,\n planningTimeAt,\n type PlanningAppointmentInput,\n type PlanningRange,\n type PlanningView,\n} from \"./planning\";\n\nexport interface PlanningProposedMove {\n start: Date;\n end: Date;\n /** The row it would land in: the one it started in unless row changes are allowed. */\n rowId: string;\n}\n\nexport interface PlanningGestureOptions {\n /** The pointerdown that starts it. Ignored unless it is the primary button. */\n event: PointerEvent;\n /** The pressed element, which takes pointer capture. Default: the event's currentTarget. */\n target?: Element;\n /** Hit-testing is limited to this element, so two calendars cannot steal each other's drags. */\n root: HTMLElement;\n /** What the time lanes draw, start edge to end edge (planningAxis). */\n axis: PlanningRange;\n view: PlanningView;\n /** Minutes a day-view move snaps to. */\n snapMinutes: number;\n appointment: PlanningAppointmentInput;\n /** The row the appointment is in. */\n rowId: string;\n /** Whether the drag may land in another row. */\n allowRowChange: boolean;\n /** Scrolled sideways while the pointer is near its start or end edge. */\n scroller?: HTMLElement | null;\n onPreview: (move: PlanningProposedMove | null) => void;\n onCommit: (move: PlanningProposedMove) => void;\n}\n\n/** Below this a press is a click. Without it every click proposes a zero move. */\nconst DRAG_THRESHOLD_PX = 3;\nconst TOUCH_SLOP_PX = 8;\nconst EDGE_PX = 40;\nconst MAX_SCROLL_PX = 14;\n\ninterface Hit {\n rowId: string;\n /** 0–1 across the lane from its START edge (right edge under RTL). */\n fraction: number;\n}\n\nfunction hitTest(root: HTMLElement, x: number, y: number): Hit | null {\n const scope = root.getRootNode() as Document | ShadowRoot;\n const nodes = scope.elementsFromPoint ? scope.elementsFromPoint(x, y) : root.ownerDocument.elementsFromPoint(x, y);\n for (const node of nodes) {\n const el = (node as HTMLElement).closest?.(\"[data-plan-lane]\") as HTMLElement | null;\n if (!el || !root.contains(el)) continue;\n return { rowId: el.getAttribute(\"data-plan-lane\") ?? \"\", fraction: fractionIn(el, x) };\n }\n return null;\n}\n\nfunction fractionIn(lane: HTMLElement, x: number): number {\n const rect = lane.getBoundingClientRect();\n if (rect.width <= 0) return 0;\n const f = (x - rect.left) / rect.width;\n const rtl = getComputedStyle(lane).direction === \"rtl\";\n return Math.min(1, Math.max(0, rtl ? 1 - f : f));\n}\n\n/** Start a move from a pointerdown. Returns false when it did not start (wrong button, not over a lane). */\nexport function startPlanningGesture(options: PlanningGestureOptions): boolean {\n const { event, root, axis, scroller } = options;\n if (event.button !== 0 || !event.isPrimary) return false;\n const origin = hitTest(root, event.clientX, event.clientY);\n if (!origin) return false;\n\n const target = options.target ?? (event.currentTarget instanceof Element ? event.currentTarget : (event.target as Element));\n const pointerId = event.pointerId;\n try {\n target.setPointerCapture(pointerId);\n } catch {\n /* A synthetic event with no active pointer cannot be captured; the\n listeners are on window, so the gesture still runs. */\n }\n // Mouse only: stops text selection and the native drag image. A touch\n // pointerdown is left alone so the page can still pan.\n if (event.pointerType === \"mouse\") event.preventDefault();\n\n const from = planningTimeAt(axis, origin.fraction);\n const originX = event.clientX;\n const originY = event.clientY;\n let lastX = originX;\n let lastY = originY;\n let moved = false;\n let cancelled = false;\n let preview: PlanningProposedMove | null = null;\n let frame = 0;\n\n const compute = (): PlanningProposedMove | null => {\n const hit = hitTest(root, lastX, lastY);\n if (!hit) return preview;\n const to = planningTimeAt(axis, hit.fraction);\n const next = planningPointerMove(options.appointment, from, to, {\n view: options.view,\n snapMinutes: options.snapMinutes,\n });\n return { ...next, rowId: options.allowRowChange ? hit.rowId : options.rowId };\n };\n\n const same = (a: PlanningProposedMove | null, b: PlanningProposedMove | null) =>\n a === b ||\n (!!a && !!b && a.start.getTime() === b.start.getTime() && a.end.getTime() === b.end.getTime() && a.rowId === b.rowId);\n\n const refresh = () => {\n const next = compute();\n if (!same(next, preview)) {\n preview = next;\n options.onPreview(preview);\n }\n };\n\n /* One frame drives both the preview and the auto-scroll, so a burst of\n pointermoves costs one layout read per frame. */\n const tick = () => {\n frame = 0;\n if (!moved) return;\n let scrolled = false;\n if (scroller) {\n const rect = scroller.getBoundingClientRect();\n const left = rect.left + EDGE_PX - lastX;\n const right = lastX - (rect.right - EDGE_PX);\n const step =\n left > 0\n ? -Math.ceil((Math.min(left, EDGE_PX) / EDGE_PX) * MAX_SCROLL_PX)\n : right > 0\n ? Math.ceil((Math.min(right, EDGE_PX) / EDGE_PX) * MAX_SCROLL_PX)\n : 0;\n if (step !== 0) {\n const before = scroller.scrollLeft;\n scroller.scrollLeft = before + step;\n scrolled = scroller.scrollLeft !== before;\n }\n }\n refresh();\n if (scrolled) frame = requestAnimationFrame(tick);\n };\n const schedule = () => {\n if (!frame) frame = requestAnimationFrame(tick);\n };\n\n const touch = event.pointerType === \"touch\";\n let armed = !touch;\n let pressTimer = 0;\n const blockScroll = (e: TouchEvent) => {\n if (e.cancelable) e.preventDefault();\n };\n const blockMenu = (e: Event) => e.preventDefault();\n if (touch) {\n window.addEventListener(\"contextmenu\", blockMenu, true);\n pressTimer = window.setTimeout(() => {\n pressTimer = 0;\n armed = true;\n moved = true;\n window.addEventListener(\"touchmove\", blockScroll, { capture: true, passive: false });\n // The preview appears at once, so the finger knows the hold registered.\n refresh();\n }, LONG_PRESS_MS);\n }\n\n const onMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId || cancelled) return;\n lastX = e.clientX;\n lastY = e.clientY;\n if (!armed) {\n if (Math.hypot(lastX - originX, lastY - originY) > TOUCH_SLOP_PX) finish(false);\n return;\n }\n if (!moved && Math.hypot(lastX - originX, lastY - originY) > DRAG_THRESHOLD_PX) moved = true;\n if (moved) schedule();\n };\n\n const swallowClick = (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n };\n\n const clearPreview = () => {\n if (frame) cancelAnimationFrame(frame);\n frame = 0;\n if (preview) options.onPreview(null);\n preview = null;\n };\n\n const finish = (commit: boolean) => {\n if (pressTimer) window.clearTimeout(pressTimer);\n pressTimer = 0;\n window.removeEventListener(\"touchmove\", blockScroll, true);\n window.removeEventListener(\"contextmenu\", blockMenu, true);\n window.removeEventListener(\"pointermove\", onMove, true);\n window.removeEventListener(\"pointerup\", onUp, true);\n window.removeEventListener(\"pointercancel\", onCancel, true);\n window.removeEventListener(\"keydown\", onKey, true);\n try {\n if (target.isConnected && target.hasPointerCapture?.(pointerId)) target.releasePointerCapture(pointerId);\n } catch {\n /* already released */\n }\n if (moved || cancelled) {\n // The release after a drag still fires a click; it is the end of the\n // gesture, not a request to open the appointment.\n window.addEventListener(\"click\", swallowClick, { capture: true, once: true });\n setTimeout(() => window.removeEventListener(\"click\", swallowClick, { capture: true }), 0);\n }\n const result = preview;\n clearPreview();\n if (!commit || cancelled || !moved || !result) return;\n // Dropped where it started: nothing to propose.\n const unchanged =\n result.rowId === options.rowId &&\n result.start.getTime() === options.appointment.start.getTime() &&\n result.end.getTime() === options.appointment.end.getTime();\n if (!unchanged) options.onCommit(result);\n };\n\n const onUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n lastX = e.clientX;\n lastY = e.clientY;\n if (moved && !cancelled) refresh();\n finish(true);\n };\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId === pointerId) finish(false);\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== \"Escape\") return;\n e.preventDefault();\n e.stopPropagation();\n cancelled = true;\n window.removeEventListener(\"keydown\", onKey, true);\n clearPreview();\n };\n\n /* On WINDOW, capture phase: the pressed element can be replaced mid-drag\n (the caller's rows changed), and a removed element receives nothing more. */\n window.addEventListener(\"pointermove\", onMove, true);\n window.addEventListener(\"pointerup\", onUp, true);\n window.addEventListener(\"pointercancel\", onCancel, true);\n window.addEventListener(\"keydown\", onKey, true);\n return true;\n}\n"],"names":["DRAG_THRESHOLD_PX","TOUCH_SLOP_PX","EDGE_PX","MAX_SCROLL_PX","hitTest","root","x","y","scope","nodes","node","el","fractionIn","lane","rect","f","rtl","startPlanningGesture","options","event","axis","scroller","origin","target","pointerId","from","planningTimeAt","originX","originY","lastX","lastY","moved","cancelled","preview","frame","compute","hit","to","planningPointerMove","same","a","b","refresh","next","tick","scrolled","left","right","step","before","schedule","touch","armed","pressTimer","blockScroll","blockMenu","LONG_PRESS_MS","onMove","finish","swallowClick","clearPreview","commit","onUp","onCancel","onKey","result"],"mappings":";;AA8DA,MAAMA,IAAoB,GACpBC,IAAgB,GAChBC,IAAU,IACVC,IAAgB;AAQtB,SAASC,EAAQC,GAAmBC,GAAWC,GAAuB;AACpE,QAAMC,IAAQH,EAAK,YAAA,GACbI,IAAQD,EAAM,oBAAoBA,EAAM,kBAAkBF,GAAGC,CAAC,IAAIF,EAAK,cAAc,kBAAkBC,GAAGC,CAAC;AACjH,aAAWG,KAAQD,GAAO;AACxB,UAAME,IAAMD,EAAqB,UAAU,kBAAkB;AAC7D,QAAI,GAACC,KAAM,CAACN,EAAK,SAASM,CAAE;AAC5B,aAAO,EAAE,OAAOA,EAAG,aAAa,gBAAgB,KAAK,IAAI,UAAUC,EAAWD,GAAIL,CAAC,EAAA;AAAA,EACrF;AACA,SAAO;AACT;AAEA,SAASM,EAAWC,GAAmBP,GAAmB;AACxD,QAAMQ,IAAOD,EAAK,sBAAA;AAClB,MAAIC,EAAK,SAAS,EAAG,QAAO;AAC5B,QAAMC,KAAKT,IAAIQ,EAAK,QAAQA,EAAK,OAC3BE,IAAM,iBAAiBH,CAAI,EAAE,cAAc;AACjD,SAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGG,IAAM,IAAID,IAAIA,CAAC,CAAC;AACjD;AAGO,SAASE,EAAqBC,GAA0C;AAC7E,QAAM,EAAE,OAAAC,GAAO,MAAAd,GAAM,MAAAe,GAAM,UAAAC,MAAaH;AACxC,MAAIC,EAAM,WAAW,KAAK,CAACA,EAAM,UAAW,QAAO;AACnD,QAAMG,IAASlB,EAAQC,GAAMc,EAAM,SAASA,EAAM,OAAO;AACzD,MAAI,CAACG,EAAQ,QAAO;AAEpB,QAAMC,IAASL,EAAQ,WAAWC,EA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ACC,KAAWU,EAAA,GACzBgB,EAAO,EAAI;AAAA,EACb,GACMK,IAAW,CAAC,MAAoB;AACpC,IAAI,EAAE,cAAcvC,KAAWkC,EAAO,EAAK;AAAA,EAC7C,GACMM,IAAQ,CAAC,MAAqB;AAClC,IAAI,EAAE,QAAQ,aACd,EAAE,eAAA,GACF,EAAE,gBAAA,GACFhC,IAAY,IACZ,OAAO,oBAAoB,WAAWgC,GAAO,EAAI,GACjDJ,EAAA;AAAA,EACF;AAIA,gBAAO,iBAAiB,eAAeH,GAAQ,EAAI,GACnD,OAAO,iBAAiB,aAAaK,GAAM,EAAI,GAC/C,OAAO,iBAAiB,iBAAiBC,GAAU,EAAI,GACvD,OAAO,iBAAiB,WAAWC,GAAO,EAAI,GACvC;AACT;"}
|
package/dist/index232.js
CHANGED
|
@@ -1,51 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { toNodes as l } from "./index195.js";
|
|
3
|
-
import { eventItem as f } from "./index244.js";
|
|
4
|
-
import { el as o, sameDay as u, markMoving as c } from "./index233.js";
|
|
5
|
-
import { cn as i } from "./index194.js";
|
|
6
|
-
function b(n, z, d) {
|
|
7
|
-
const s = o("ul", "zen-m-0 zen-flex zen-list-none zen-flex-col zen-gap-0.5 zen-p-0");
|
|
8
|
-
for (const t of d) {
|
|
9
|
-
const e = z[t.index], r = o("li", "zen-flex zen-min-w-0 zen-items-center zen-gap-3 zen-rounded-zen-sm hover:zen-bg-zen-muted"), a = o(
|
|
10
|
-
"span",
|
|
11
|
-
"zen-w-32 zen-shrink-0 zen-ps-1.5 zen-text-xs zen-tabular-nums zen-text-zen-muted-fg",
|
|
12
|
-
t.allDay ? n.loc.t("eventCalendar.allDay") : n.timeLabel(e)
|
|
13
|
-
);
|
|
14
|
-
a.setAttribute("aria-hidden", "true"), r.append(
|
|
15
|
-
a,
|
|
16
|
-
f(n, e, {
|
|
17
|
-
variant: "row",
|
|
18
|
-
continuesBefore: t.continuesBefore,
|
|
19
|
-
continuesAfter: t.continuesAfter,
|
|
20
|
-
class: "zen-min-h-8 zen-flex-1"
|
|
21
|
-
})
|
|
22
|
-
), s.append(r);
|
|
23
|
-
}
|
|
24
|
-
return s;
|
|
25
|
-
}
|
|
26
|
-
function w(n) {
|
|
27
|
-
const z = n.props.events ?? [], d = p(z, m("agenda", n.anchor, n.options)), s = (e) => new Intl.DateTimeFormat(n.loc.locale, { weekday: "long", day: "numeric", month: "long" }).format(e), t = o("div", "zen-rounded-zen-md zen-border zen-border-zen-border");
|
|
28
|
-
if (d.length === 0) {
|
|
29
|
-
const e = o("p", "zen-m-0 zen-py-10 zen-text-center zen-text-sm zen-text-zen-muted-fg");
|
|
30
|
-
e.append(...l(n.props.emptyMessage ?? n.loc.t("eventCalendar.noEvents"))), t.append(e);
|
|
31
|
-
}
|
|
32
|
-
for (const e of d) {
|
|
33
|
-
const r = o(
|
|
34
|
-
"section",
|
|
35
|
-
i("zen-flex zen-flex-col zen-gap-1 zen-border-b zen-border-zen-border zen-px-3 zen-py-2 last:zen-border-b-0", n.props.dayClassName?.(e.date))
|
|
36
|
-
);
|
|
37
|
-
r.setAttribute("aria-label", s(e.date));
|
|
38
|
-
const a = o(
|
|
39
|
-
"p",
|
|
40
|
-
i("zen-m-0 zen-text-sm zen-font-semibold", u(e.date, n.now) ? "zen-text-zen-primary" : "zen-text-zen-foreground"),
|
|
41
|
-
s(e.date)
|
|
42
|
-
);
|
|
43
|
-
a.setAttribute("aria-hidden", "true"), r.append(a, b(n, z, e.items)), t.append(r);
|
|
44
|
-
}
|
|
45
|
-
return { el: t, applyPreview: (e) => c(n.root, e?.eventId) };
|
|
46
|
-
}
|
|
1
|
+
const t = { compact: 28, comfortable: 36, touch: 48 }, a = { compact: 14, comfortable: 18, touch: 32 }, e = { compact: 12, comfortable: 16, touch: 32 }, m = { compact: 24, comfortable: 30, touch: 54 }, n = { compact: 36, comfortable: 48, touch: 64 }, r = { compact: 20, comfortable: 24, touch: 44 }, l = (o = "comfortable", c) => c ?? t[o], s = (o = "comfortable") => a[o], b = (o = "comfortable") => e[o], f = (o = "comfortable", c) => c ?? m[o], E = (o = "comfortable", c) => c ?? n[o], u = (o = "comfortable") => r[o];
|
|
47
2
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
3
|
+
f as calendarLanePx,
|
|
4
|
+
E as eventHourPx,
|
|
5
|
+
u as eventRowPx,
|
|
6
|
+
s as ganttBarPx,
|
|
7
|
+
b as laneBarPx,
|
|
8
|
+
l as scheduleRowPx
|
|
50
9
|
};
|
|
51
10
|
//# sourceMappingURL=index232.js.map
|
package/dist/index232.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index232.js","sources":["
|
|
1
|
+
{"version":3,"file":"index232.js","sources":["../../core/src/density.ts"],"sourcesContent":["/**\n * Component density — the opt-in `density` prop on the schedules,\n * PlanningCalendar, SpreadsheetGrid and Tree.\n *\n * bun run check:density\n *\n * The same three names as the `data-density` tokens (tokens.css). This is a\n * PROP rather than a reading of that attribute on purpose: these components\n * never followed data-density, and starting to would reflow every app that\n * already sets data-density=\"touch\" for its controls. A prop changes only the\n * component it is set on.\n *\n * \"comfortable\" is the default and is exactly the size each component always\n * drew. \"touch\" reaches 48px targets, like data-density=\"touch\" for controls.\n * An explicit size (rowHeight, laneHeight) wins over density. The classes for\n * SpreadsheetGrid and Tree live in variants.ts, which Uno scans.\n */\n\nexport type Density = \"compact\" | \"comfortable\" | \"touch\";\nexport const DENSITIES: readonly Density[] = [\"compact\", \"comfortable\", \"touch\"];\n\nconst SCHEDULE_ROW: Record<Density, number> = { compact: 28, comfortable: 36, touch: 48 };\nconst GANTT_BAR: Record<Density, number> = { compact: 14, comfortable: 18, touch: 32 };\nconst LANE_BAR: Record<Density, number> = { compact: 12, comfortable: 16, touch: 32 };\n// A calendar block is its lane less 6px: touch's 54 makes a 48px block.\nconst CALENDAR_LANE: Record<Density, number> = { compact: 24, comfortable: 30, touch: 54 };\n// EventCalendar: one hour of the time grid, and one row of a month cell or the\n// all-day strip. Touch's row is 44, the smallest target WCAG's AAA level allows,\n// rather than 48: a month cell must still fit several of them.\nconst EVENT_HOUR: Record<Density, number> = { compact: 36, comfortable: 48, touch: 64 };\nconst EVENT_ROW: Record<Density, number> = { compact: 20, comfortable: 24, touch: 44 };\n\n/** A Gantt row, or ProductionSchedule's least row height. */\nexport const scheduleRowPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? SCHEDULE_ROW[density];\n/** A Gantt bar's height. */\nexport const ganttBarPx = (density: Density = \"comfortable\"): number => GANTT_BAR[density];\n/** One lane's bar in ProductionSchedule. */\nexport const laneBarPx = (density: Density = \"comfortable\"): number => LANE_BAR[density];\n/** A PlanningCalendar lane. */\nexport const calendarLanePx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? CALENDAR_LANE[density];\n/** One hour of EventCalendar's time grid. */\nexport const eventHourPx = (density: Density = \"comfortable\", explicit?: number): number =>\n explicit ?? EVENT_HOUR[density];\n/** One event row in an EventCalendar month cell or all-day strip. */\nexport const eventRowPx = (density: Density = \"comfortable\"): number => EVENT_ROW[density];\n"],"names":["SCHEDULE_ROW","GANTT_BAR","LANE_BAR","CALENDAR_LANE","EVENT_HOUR","EVENT_ROW","scheduleRowPx","density","explicit","ganttBarPx","laneBarPx","calendarLanePx","eventHourPx","eventRowPx"],"mappings":"AAqBA,MAAMA,IAAwC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC/EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC5EC,IAAoC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAE3EC,IAAyC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAIhFC,IAAsC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAC7EC,IAAqC,EAAE,SAAS,IAAI,aAAa,IAAI,OAAO,GAAA,GAGrEC,IAAgB,CAACC,IAAmB,eAAeC,MAC9DA,KAAYR,EAAaO,CAAO,GAErBE,IAAa,CAACF,IAAmB,kBAA0BN,EAAUM,CAAO,GAE5EG,IAAY,CAACH,IAAmB,kBAA0BL,EAASK,CAAO,GAE1EI,IAAiB,CAACJ,IAAmB,eAAeC,MAC/DA,KAAYL,EAAcI,CAAO,GAEtBK,IAAc,CAACL,IAAmB,eAAeC,MAC5DA,KAAYJ,EAAWG,CAAO,GAEnBM,IAAa,CAACN,IAAmB,kBAA0BF,EAAUE,CAAO;"}
|