@burdenoff/microfe-calendar 2026.1123.2 → 2026.1124.1
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/dist/components/AgendaView.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +596 -0
- package/dist/generated/wspace-operations.js +190 -85
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/translations/en.d.ts +292 -0
- package/dist/v2/CalendarPageV2.js +87 -14
- package/dist/v2/CalendarPageV2.js.map +1 -1
- package/dist/v2/colors.d.ts +23 -0
- package/dist/v2/colors.js +92 -0
- package/dist/v2/colors.js.map +1 -0
- package/dist/v2/data/enums.d.ts +6 -0
- package/dist/v2/data/enums.js +10 -0
- package/dist/v2/data/enums.js.map +1 -0
- package/dist/v2/data/errors.d.ts +4 -0
- package/dist/v2/data/errors.js +17 -0
- package/dist/v2/data/errors.js.map +1 -0
- package/dist/v2/data/invalidation.js +19 -0
- package/dist/v2/data/invalidation.js.map +1 -0
- package/dist/v2/data/normalize.js +181 -16
- package/dist/v2/data/normalize.js.map +1 -1
- package/dist/v2/data/serialWrites.d.ts +17 -0
- package/dist/v2/data/serialWrites.js +21 -0
- package/dist/v2/data/serialWrites.js.map +1 -0
- package/dist/v2/data/useCalendarsV2.d.ts +10 -1
- package/dist/v2/data/useCalendarsV2.js +68 -16
- package/dist/v2/data/useCalendarsV2.js.map +1 -1
- package/dist/v2/data/useEventActions.d.ts +49 -0
- package/dist/v2/data/useEventActions.js +399 -0
- package/dist/v2/data/useEventActions.js.map +1 -0
- package/dist/v2/data/useEventForPeek.d.ts +17 -0
- package/dist/v2/data/useEventForPeek.js +29 -0
- package/dist/v2/data/useEventForPeek.js.map +1 -0
- package/dist/v2/data/useEventSearchV2.d.ts +15 -0
- package/dist/v2/data/useEventSearchV2.js +80 -0
- package/dist/v2/data/useEventSearchV2.js.map +1 -0
- package/dist/v2/data/useEventsInRangeV2.js +78 -0
- package/dist/v2/data/useEventsInRangeV2.js.map +1 -0
- package/dist/v2/data/useFreeBusy.d.ts +5 -0
- package/dist/v2/data/useFreeBusy.js +83 -0
- package/dist/v2/data/useFreeBusy.js.map +1 -0
- package/dist/v2/data/useKeyedLoad.js +47 -0
- package/dist/v2/data/useKeyedLoad.js.map +1 -0
- package/dist/v2/data/useRoomsV2.d.ts +28 -0
- package/dist/v2/data/useRoomsV2.js +45 -0
- package/dist/v2/data/useRoomsV2.js.map +1 -0
- package/dist/v2/day/DayPanel.d.ts +6 -0
- package/dist/v2/day/DayPanel.js +215 -0
- package/dist/v2/day/DayPanel.js.map +1 -0
- package/dist/v2/day/daySummary.d.ts +37 -0
- package/dist/v2/day/daySummary.js +37 -0
- package/dist/v2/day/daySummary.js.map +1 -0
- package/dist/v2/dialogs/CalendarDialogsV2.d.ts +1 -0
- package/dist/v2/dialogs/CalendarDialogsV2.js +17 -0
- package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -0
- package/dist/v2/dialogs/ShortcutsDialog.d.ts +4 -0
- package/dist/v2/dialogs/ShortcutsDialog.js +42 -0
- package/dist/v2/dialogs/ShortcutsDialog.js.map +1 -0
- package/dist/v2/events/eventLook.d.ts +46 -0
- package/dist/v2/events/eventLook.js +35 -0
- package/dist/v2/events/eventLook.js.map +1 -0
- package/dist/v2/events/eventModel.d.ts +92 -0
- package/dist/v2/events/eventModel.js +116 -0
- package/dist/v2/events/eventModel.js.map +1 -0
- package/dist/v2/events/localChanges.d.ts +4 -0
- package/dist/v2/events/localChanges.js +23 -0
- package/dist/v2/events/localChanges.js.map +1 -0
- package/dist/v2/format.d.ts +67 -0
- package/dist/v2/format.js +112 -0
- package/dist/v2/format.js.map +1 -0
- package/dist/v2/grid/AllDayRow.d.ts +20 -0
- package/dist/v2/grid/AllDayRow.js +94 -0
- package/dist/v2/grid/AllDayRow.js.map +1 -0
- package/dist/v2/grid/EventBlock.d.ts +21 -0
- package/dist/v2/grid/EventBlock.js +112 -0
- package/dist/v2/grid/EventBlock.js.map +1 -0
- package/dist/v2/grid/GridParts.d.ts +40 -0
- package/dist/v2/grid/GridParts.js +204 -0
- package/dist/v2/grid/GridParts.js.map +1 -0
- package/dist/v2/grid/QuickCreate.d.ts +1 -0
- package/dist/v2/grid/QuickCreate.js +175 -0
- package/dist/v2/grid/QuickCreate.js.map +1 -0
- package/dist/v2/grid/TimeGrid.d.ts +1 -0
- package/dist/v2/grid/TimeGrid.js +179 -0
- package/dist/v2/grid/TimeGrid.js.map +1 -0
- package/dist/v2/grid/geometry.d.ts +72 -0
- package/dist/v2/grid/geometry.js +85 -0
- package/dist/v2/grid/geometry.js.map +1 -0
- package/dist/v2/grid/layout.d.ts +24 -0
- package/dist/v2/grid/layout.js +77 -0
- package/dist/v2/grid/layout.js.map +1 -0
- package/dist/v2/grid/useGridDrag.d.ts +42 -0
- package/dist/v2/grid/useGridDrag.js +181 -0
- package/dist/v2/grid/useGridDrag.js.map +1 -0
- package/dist/v2/grid/useSlotCursor.d.ts +32 -0
- package/dist/v2/grid/useSlotCursor.js +57 -0
- package/dist/v2/grid/useSlotCursor.js.map +1 -0
- package/dist/v2/grid/workingHours.d.ts +21 -0
- package/dist/v2/grid/workingHours.js +101 -0
- package/dist/v2/grid/workingHours.js.map +1 -0
- package/dist/v2/hooks/useAvailableHeight.d.ts +2 -0
- package/dist/v2/hooks/useAvailableHeight.js +25 -0
- package/dist/v2/hooks/useAvailableHeight.js.map +1 -0
- package/dist/v2/hooks/useCalendarShortcuts.d.ts +9 -0
- package/dist/v2/hooks/useCalendarShortcuts.js +60 -0
- package/dist/v2/hooks/useCalendarShortcuts.js.map +1 -0
- package/dist/v2/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/v2/hooks/useDebouncedValue.js +12 -0
- package/dist/v2/hooks/useDebouncedValue.js.map +1 -0
- package/dist/v2/hooks/useMediaQuery.d.ts +5 -0
- package/dist/v2/hooks/useMediaQuery.js +17 -0
- package/dist/v2/hooks/useMediaQuery.js.map +1 -0
- package/dist/v2/hooks/useNow.d.ts +2 -0
- package/dist/v2/hooks/useNow.js +31 -0
- package/dist/v2/hooks/useNow.js.map +1 -0
- package/dist/v2/limits.d.ts +6 -0
- package/dist/v2/limits.js +5 -0
- package/dist/v2/limits.js.map +1 -0
- package/dist/v2/list/EventListRow.d.ts +10 -0
- package/dist/v2/list/EventListRow.js +109 -0
- package/dist/v2/list/EventListRow.js.map +1 -0
- package/dist/v2/list/ListViewV2.d.ts +12 -0
- package/dist/v2/list/ListViewV2.js +90 -0
- package/dist/v2/list/ListViewV2.js.map +1 -0
- package/dist/v2/month/MonthView.d.ts +1 -0
- package/dist/v2/month/MonthView.js +324 -0
- package/dist/v2/month/MonthView.js.map +1 -0
- package/dist/v2/month/monthLayout.d.ts +39 -0
- package/dist/v2/month/monthLayout.js +29 -0
- package/dist/v2/month/monthLayout.js.map +1 -0
- package/dist/v2/page/CalendarChrome.d.ts +2 -0
- package/dist/v2/page/CalendarChrome.js +295 -0
- package/dist/v2/page/CalendarChrome.js.map +1 -0
- package/dist/v2/page/CalendarPageContext.d.ts +92 -0
- package/dist/v2/page/CalendarPageContext.js +11 -0
- package/dist/v2/page/CalendarPageContext.js.map +1 -0
- package/dist/v2/page/pageHelpers.d.ts +19 -0
- package/dist/v2/page/pageHelpers.js +39 -0
- package/dist/v2/page/pageHelpers.js.map +1 -0
- package/dist/v2/page/useCalendarPageModel.d.ts +2 -0
- package/dist/v2/page/useCalendarPageModel.js +198 -0
- package/dist/v2/page/useCalendarPageModel.js.map +1 -0
- package/dist/v2/page/viewState.d.ts +70 -0
- package/dist/v2/page/viewState.js +47 -0
- package/dist/v2/page/viewState.js.map +1 -0
- package/dist/v2/peek/EventPeek.d.ts +2 -0
- package/dist/v2/peek/EventPeek.js +92 -0
- package/dist/v2/peek/EventPeek.js.map +1 -0
- package/dist/v2/peek/PeekEvent.d.ts +4 -0
- package/dist/v2/peek/PeekEvent.js +443 -0
- package/dist/v2/peek/PeekEvent.js.map +1 -0
- package/dist/v2/peek/PeekParts.d.ts +14 -0
- package/dist/v2/peek/PeekParts.js +75 -0
- package/dist/v2/peek/PeekParts.js.map +1 -0
- package/dist/v2/prefs/calendarPrefs.d.ts +2 -2
- package/dist/v2/prefs/calendarPrefs.js +35 -34
- package/dist/v2/prefs/calendarPrefs.js.map +1 -1
- package/dist/v2/rail/CalendarRail.d.ts +3 -0
- package/dist/v2/rail/CalendarRail.js +284 -0
- package/dist/v2/rail/CalendarRail.js.map +1 -0
- package/dist/v2/rail/railStatus.d.ts +54 -0
- package/dist/v2/rail/railStatus.js +84 -0
- package/dist/v2/rail/railStatus.js.map +1 -0
- package/dist/v2/rail/syncWords.d.ts +10 -0
- package/dist/v2/rail/syncWords.js +75 -0
- package/dist/v2/rail/syncWords.js.map +1 -0
- package/dist/v2/rail/useMonthEventDates.d.ts +4 -0
- package/dist/v2/rail/useMonthEventDates.js +30 -0
- package/dist/v2/rail/useMonthEventDates.js.map +1 -0
- package/dist/v2/routes.js +4 -1
- package/dist/v2/routes.js.map +1 -1
- package/dist/v2/search/SearchResults.d.ts +1 -0
- package/dist/v2/search/SearchResults.js +88 -0
- package/dist/v2/search/SearchResults.js.map +1 -0
- package/dist/v2/search/searchModel.d.ts +20 -0
- package/dist/v2/search/searchModel.js +22 -0
- package/dist/v2/search/searchModel.js.map +1 -0
- package/dist/v2/state/calendarV2Store.d.ts +4 -1
- package/dist/v2/state/calendarV2Store.js +3 -1
- package/dist/v2/state/calendarV2Store.js.map +1 -1
- package/dist/v2/state/useCalendarV2Navigation.d.ts +1 -0
- package/dist/v2/state/useCalendarV2Navigation.js +4 -1
- package/dist/v2/state/useCalendarV2Navigation.js.map +1 -1
- package/dist/v2/states/CalendarStates.d.ts +18 -0
- package/dist/v2/states/CalendarStates.js +122 -0
- package/dist/v2/states/CalendarStates.js.map +1 -0
- package/dist/v2/styles.d.ts +32 -0
- package/dist/v2/styles.js +10 -0
- package/dist/v2/styles.js.map +1 -0
- package/dist/v2/time/calendarTime.js +121 -35
- package/dist/v2/time/calendarTime.js.map +1 -1
- package/dist/v2/types.d.ts +22 -2
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { technicalDetails as e } from "../data/errors.js";
|
|
2
|
+
import { useCalendarPage as t } from "../page/CalendarPageContext.js";
|
|
3
|
+
import { reasonWords as n } from "../rail/syncWords.js";
|
|
4
|
+
import { syncLine as r } from "../rail/railStatus.js";
|
|
5
|
+
import { useCalendarV2Store as i } from "../state/calendarV2Store.js";
|
|
6
|
+
import { ICON_BUTTON as a, VIEW_PANEL as o } from "../styles.js";
|
|
7
|
+
import { useState as s } from "react";
|
|
8
|
+
import { Eye as c, RefreshCw as l, X as u } from "lucide-react";
|
|
9
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
+
import { Button as m, EmptyState as h, Notice as g, ShowTechnicalDetails as _ } from "@burdenoff/fe-libs/ui";
|
|
11
|
+
// src/v2/states/CalendarStates.tsx
|
|
12
|
+
function v({ children: e }) {
|
|
13
|
+
return /* @__PURE__ */ f("section", {
|
|
14
|
+
className: `${o} grid place-items-center p-6`,
|
|
15
|
+
children: e
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function y({ failed: n, error: r, onRetry: i }) {
|
|
19
|
+
let { tr: a } = t(), o = n === "calendars" ? a("calendar.v2.calendarsFailed", "Couldn’t load your calendars") : n === "search" ? a("calendar.v2.searchFailed", "Couldn’t search your calendars") : a("calendar.v2.eventsFailed", "Couldn’t load your events");
|
|
20
|
+
return /* @__PURE__ */ f(v, { children: /* @__PURE__ */ f(h, {
|
|
21
|
+
size: "panel",
|
|
22
|
+
kind: "error",
|
|
23
|
+
title: o,
|
|
24
|
+
description: a("calendar.v2.failedBody", "The calendar service didn’t answer. Nothing was lost; try again in a moment."),
|
|
25
|
+
action: /* @__PURE__ */ p(m, {
|
|
26
|
+
type: "button",
|
|
27
|
+
onClick: i,
|
|
28
|
+
children: [/* @__PURE__ */ f(l, { "aria-hidden": "true" }), a("calendar.v2.tryAgain", "Try again")]
|
|
29
|
+
}),
|
|
30
|
+
secondaryAction: r ? /* @__PURE__ */ f(_, {
|
|
31
|
+
copyable: !0,
|
|
32
|
+
children: e(r)
|
|
33
|
+
}) : void 0
|
|
34
|
+
}) });
|
|
35
|
+
}
|
|
36
|
+
function b() {
|
|
37
|
+
let { tr: e } = t(), n = i((e) => e.showAllCalendars);
|
|
38
|
+
return /* @__PURE__ */ f(v, { children: /* @__PURE__ */ f(h, {
|
|
39
|
+
size: "panel",
|
|
40
|
+
kind: "filtered",
|
|
41
|
+
title: e("calendar.v2.allHidden", "Every calendar is hidden"),
|
|
42
|
+
description: e("calendar.v2.allHiddenBody", "Turn a calendar back on in the list, or show them all."),
|
|
43
|
+
action: /* @__PURE__ */ p(m, {
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: n,
|
|
46
|
+
children: [/* @__PURE__ */ f(c, { "aria-hidden": "true" }), e("calendar.v2.showAll", "Show every calendar")]
|
|
47
|
+
})
|
|
48
|
+
}) });
|
|
49
|
+
}
|
|
50
|
+
function x({ query: e }) {
|
|
51
|
+
let n = t(), { tr: r } = n, a = i((e) => e.setSearch), o = i((e) => e.showAllCalendars), s = n.hiddenCalendarIds.size;
|
|
52
|
+
return /* @__PURE__ */ f(v, { children: /* @__PURE__ */ f(h, {
|
|
53
|
+
size: "panel",
|
|
54
|
+
kind: "no-results",
|
|
55
|
+
title: r("calendar.v2.noResults", "No events match “{{query}}”", { query: e }),
|
|
56
|
+
description: s > 0 ? r("calendar.v2.noResultsHidden", "Hidden calendars aren’t searched. Check the spelling, or show every calendar.") : r("calendar.v2.noResultsBody", "Check the spelling, or try a word from the title or the notes."),
|
|
57
|
+
action: /* @__PURE__ */ f(m, {
|
|
58
|
+
type: "button",
|
|
59
|
+
variant: "outline",
|
|
60
|
+
onClick: () => a(""),
|
|
61
|
+
children: r("calendar.v2.clearSearch", "Clear search")
|
|
62
|
+
}),
|
|
63
|
+
secondaryAction: s > 0 ? /* @__PURE__ */ f(m, {
|
|
64
|
+
type: "button",
|
|
65
|
+
variant: "outline",
|
|
66
|
+
onClick: o,
|
|
67
|
+
children: r("calendar.v2.showAll", "Show every calendar")
|
|
68
|
+
}) : void 0
|
|
69
|
+
}) });
|
|
70
|
+
}
|
|
71
|
+
function S({ calendarIds: e, onRetry: n }) {
|
|
72
|
+
let r = t(), { tr: i } = r;
|
|
73
|
+
if (e.length === 0) return null;
|
|
74
|
+
let a = e.map((e) => r.calendarsById.get(e)?.name).filter((e) => !!e);
|
|
75
|
+
return /* @__PURE__ */ p(g, {
|
|
76
|
+
tone: "warn",
|
|
77
|
+
action: /* @__PURE__ */ f(m, {
|
|
78
|
+
type: "button",
|
|
79
|
+
size: "sm",
|
|
80
|
+
variant: "outline",
|
|
81
|
+
onClick: n,
|
|
82
|
+
children: i("calendar.v2.tryAgain", "Try again")
|
|
83
|
+
}),
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ f("b", { children: e.length === 1 ? i("calendar.v2.partialOne", "One calendar didn’t load.") : i("calendar.v2.partialMany", "{{count}} calendars didn’t load.", { count: e.length }) }),
|
|
86
|
+
" ",
|
|
87
|
+
a.length > 0 ? i("calendar.v2.partialNames", "{{names}}: its events may be missing here.", { names: a.join(", ") }) : null
|
|
88
|
+
]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function C() {
|
|
92
|
+
let e = t(), { tr: i } = e, [o, c] = s(/* @__PURE__ */ new Set()), l = e.calendars.filter((t) => !e.hiddenCalendarIds.has(t.id) && !o.has(t.id) && r(t)?.kind === "stopped");
|
|
93
|
+
return l.length === 0 ? null : /* @__PURE__ */ f(d, { children: l.map((t) => /* @__PURE__ */ p(g, {
|
|
94
|
+
tone: "bad",
|
|
95
|
+
action: /* @__PURE__ */ p("span", {
|
|
96
|
+
className: "flex items-center gap-1",
|
|
97
|
+
children: [t.sync?.provider === "ICS_URL" ? /* @__PURE__ */ f(m, {
|
|
98
|
+
type: "button",
|
|
99
|
+
size: "sm",
|
|
100
|
+
onClick: () => void e.actions.checkSyncNow(t),
|
|
101
|
+
children: i("calendar.v2.checkNowShort", "Check now")
|
|
102
|
+
}) : null, /* @__PURE__ */ f("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
className: a,
|
|
105
|
+
"aria-label": i("calendar.v2.hideMessage", "Hide this message"),
|
|
106
|
+
onClick: () => c((e) => /* @__PURE__ */ new Set([...e, t.id])),
|
|
107
|
+
children: /* @__PURE__ */ f(u, { "aria-hidden": "true" })
|
|
108
|
+
})]
|
|
109
|
+
}),
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ f("b", { children: i("calendar.v2.syncStoppedTitle", "Sync stopped · {{name}}.", { name: t.name }) }),
|
|
112
|
+
" ",
|
|
113
|
+
n(i, r(t)?.reason ?? null),
|
|
114
|
+
".",
|
|
115
|
+
" ",
|
|
116
|
+
i("calendar.v2.syncStoppedBody", "Changes made there since then may be missing here.")
|
|
117
|
+
]
|
|
118
|
+
}, t.id)) });
|
|
119
|
+
}
|
|
120
|
+
export { b as AllHiddenState, y as LoadErrorState, x as NoResultsState, S as PartialFailureNotice, C as SyncStoppedNotices };
|
|
121
|
+
|
|
122
|
+
//# sourceMappingURL=CalendarStates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarStates.js","names":["_Fragment","StatePanel","VIEW_PANEL","LoadErrorState","useCalendarPage","title","failed","tr","EmptyState","Button","onRetry","RefreshCw","error","ShowTechnicalDetails","technicalDetails","AllHiddenState","showAll","useCalendarV2Store","state","Eye","NoResultsState","page","setSearch","hidden","PartialFailureNotice","calendarIds","names","id","name","Notice","SyncStoppedNotices","dismissed","setDismissed","useState","stopped","calendar","syncLine","Fragment","ICON_BUTTON","current","X","reasonWords"],"sources":["../../../src/v2/states/CalendarStates.tsx"],"sourcesContent":["/**\n * The calendar's states (BOFF-15698 A1), in the glass style: a load that failed (never shown as\n * an empty calendar, always with Try again and the technical details), every calendar hidden,\n * and a search without matches. Plus the notices over a view: calendars that didn't answer, and\n * a followed calendar whose sync stopped.\n */\nimport { useState, type ReactNode } from 'react';\nimport { Eye, RefreshCw, X } from 'lucide-react';\nimport { Button, EmptyState, Notice, ShowTechnicalDetails } from '@burdenoff/fe-libs/ui';\nimport { technicalDetails } from '../data/errors';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { reasonWords } from '../rail/syncWords';\nimport { syncLine } from '../rail/railStatus';\nimport { useCalendarV2Store } from '../state/calendarV2Store';\nimport { ICON_BUTTON, VIEW_PANEL } from '../styles';\n\nfunction StatePanel({ children }: { children: ReactNode }) {\n return <section className={`${VIEW_PANEL} grid place-items-center p-6`}>{children}</section>;\n}\n\n/** A load failed: what failed, Try again, and the details for support. */\nexport function LoadErrorState({\n failed,\n error,\n onRetry,\n}: {\n failed: 'calendars' | 'events' | 'search';\n error: unknown;\n onRetry: () => void;\n}) {\n const { tr } = useCalendarPage();\n const title =\n failed === 'calendars'\n ? tr('calendar.v2.calendarsFailed', 'Couldn’t load your calendars')\n : failed === 'search'\n ? tr('calendar.v2.searchFailed', 'Couldn’t search your calendars')\n : tr('calendar.v2.eventsFailed', 'Couldn’t load your events');\n return (\n <StatePanel>\n <EmptyState\n size=\"panel\"\n kind=\"error\"\n title={title}\n description={tr(\n 'calendar.v2.failedBody',\n 'The calendar service didn’t answer. Nothing was lost; try again in a moment.'\n )}\n action={\n <Button type=\"button\" onClick={onRetry}>\n <RefreshCw aria-hidden=\"true\" />\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n secondaryAction={\n error ? (\n <ShowTechnicalDetails copyable>{technicalDetails(error)}</ShowTechnicalDetails>\n ) : undefined\n }\n />\n </StatePanel>\n );\n}\n\nexport function AllHiddenState() {\n const { tr } = useCalendarPage();\n const showAll = useCalendarV2Store((state) => state.showAllCalendars);\n return (\n <StatePanel>\n <EmptyState\n size=\"panel\"\n kind=\"filtered\"\n title={tr('calendar.v2.allHidden', 'Every calendar is hidden')}\n description={tr(\n 'calendar.v2.allHiddenBody',\n 'Turn a calendar back on in the list, or show them all.'\n )}\n action={\n <Button type=\"button\" onClick={showAll}>\n <Eye aria-hidden=\"true\" />\n {tr('calendar.v2.showAll', 'Show every calendar')}\n </Button>\n }\n />\n </StatePanel>\n );\n}\n\nexport function NoResultsState({ query }: { query: string }) {\n const page = useCalendarPage();\n const { tr } = page;\n const setSearch = useCalendarV2Store((state) => state.setSearch);\n const showAll = useCalendarV2Store((state) => state.showAllCalendars);\n const hidden = page.hiddenCalendarIds.size;\n return (\n <StatePanel>\n <EmptyState\n size=\"panel\"\n kind=\"no-results\"\n title={tr('calendar.v2.noResults', 'No events match “{{query}}”', { query })}\n description={\n hidden > 0\n ? tr(\n 'calendar.v2.noResultsHidden',\n 'Hidden calendars aren’t searched. Check the spelling, or show every calendar.'\n )\n : tr(\n 'calendar.v2.noResultsBody',\n 'Check the spelling, or try a word from the title or the notes.'\n )\n }\n action={\n <Button type=\"button\" variant=\"outline\" onClick={() => setSearch('')}>\n {tr('calendar.v2.clearSearch', 'Clear search')}\n </Button>\n }\n secondaryAction={\n hidden > 0 ? (\n <Button type=\"button\" variant=\"outline\" onClick={showAll}>\n {tr('calendar.v2.showAll', 'Show every calendar')}\n </Button>\n ) : undefined\n }\n />\n </StatePanel>\n );\n}\n\n/** Calendars whose events didn't load: named above the view, which shows the rest. */\nexport function PartialFailureNotice({\n calendarIds,\n onRetry,\n}: {\n calendarIds: readonly string[];\n /** Loads again what failed: the view's events, or the search. */\n onRetry: () => void;\n}) {\n const page = useCalendarPage();\n const { tr } = page;\n if (calendarIds.length === 0) return null;\n const names = calendarIds\n .map((id) => page.calendarsById.get(id)?.name)\n .filter((name): name is string => Boolean(name));\n return (\n <Notice\n tone=\"warn\"\n action={\n <Button type=\"button\" size=\"sm\" variant=\"outline\" onClick={onRetry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n >\n <b>\n {calendarIds.length === 1\n ? tr('calendar.v2.partialOne', 'One calendar didn’t load.')\n : tr('calendar.v2.partialMany', '{{count}} calendars didn’t load.', {\n count: calendarIds.length,\n })}\n </b>{' '}\n {names.length > 0\n ? tr('calendar.v2.partialNames', '{{names}}: its events may be missing here.', {\n names: names.join(', '),\n })\n : null}\n </Notice>\n );\n}\n\n/** A followed calendar whose sync stopped: red, the reason, and Check now. Dismissed for the visit. */\nexport function SyncStoppedNotices() {\n const page = useCalendarPage();\n const { tr } = page;\n const [dismissed, setDismissed] = useState<ReadonlySet<string>>(new Set());\n const stopped = page.calendars.filter(\n (calendar) =>\n !page.hiddenCalendarIds.has(calendar.id) &&\n !dismissed.has(calendar.id) &&\n syncLine(calendar)?.kind === 'stopped'\n );\n if (stopped.length === 0) return null;\n return (\n <>\n {stopped.map((calendar) => (\n <Notice\n key={calendar.id}\n tone=\"bad\"\n action={\n <span className=\"flex items-center gap-1\">\n {calendar.sync?.provider === 'ICS_URL' ? (\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => void page.actions.checkSyncNow(calendar)}\n >\n {tr('calendar.v2.checkNowShort', 'Check now')}\n </Button>\n ) : null}\n <button\n type=\"button\"\n className={ICON_BUTTON}\n aria-label={tr('calendar.v2.hideMessage', 'Hide this message')}\n onClick={() => setDismissed((current) => new Set([...current, calendar.id]))}\n >\n <X aria-hidden=\"true\" />\n </button>\n </span>\n }\n >\n <b>\n {tr('calendar.v2.syncStoppedTitle', 'Sync stopped · {{name}}.', {\n name: calendar.name,\n })}\n </b>{' '}\n {reasonWords(tr, syncLine(calendar)?.reason ?? null)}.{' '}\n {tr('calendar.v2.syncStoppedBody', 'Changes made there since then may be missing here.')}\n </Notice>\n ))}\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAASC,EAAW,EAAE,eAAqC;CACzD,OAAO,kBAAC,WAAD;EAAS,WAAW,GAAGC,EAAW;EAAgC;CAAkB,CAAA;AAC7F;AAGA,SAAgBC,EAAe,EAC7B,WACA,UACA,cAKC;CACD,IAAM,EAAE,UAAOC,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AS,EAAE,KACvC,CAACJ,EAAU,IAAII,EAAS,EAAE,KAC1BC,EAASD,CAAQ,CAAC,EAAE,SAAS,SACjC;CAEA,OADID,EAAQ,WAAW,IAAU,OAE/B,kBAAAlC,GAAA,EAAA,UACGkC,EAAQ,KAAK,MACZ,kBAACL,GAAD;EAEE,MAAK;EACL,QACE,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACGM,EAAS,MAAM,aAAa,YAC3B,kBAAC1B,GAAD;IACE,MAAK;IACL,MAAK;IACL,eAAe,KAAKY,EAAK,QAAQ,aAAac,CAAQ;IAErD,UAAA5B,EAAG,6BAA6B,WAAW;GACtC,CAAA,IACN,MACJ,kBAAC,UAAD;IACE,MAAK;IACL,WAAW+B;IACX,cAAY/B,EAAG,2BAA2B,mBAAmB;IAC7D,eAAeyB,GAAc,sBAAY,IAAI,IAAI,CAAC,GAAGO,GAASJ,EAAS,EAAE,CAAC,CAAC;IAE3E,UAAA,kBAACK,GAAD,EAAG,eAAY,OAAQ,CAAA;GACjB,CAAA,CACJ;;EAtBV,UAAA;GAyBE,kBAAC,KAAD,EAAA,UACGjC,EAAG,gCAAgC,4BAA4B,EAC9D,MAAM4B,EAAS,KACjB,CAAC,EACA,CAAA;GAAE;GACJM,EAAYlC,GAAI6B,EAASD,CAAQ,CAAC,EAAE,UAAU,IAAI;GAAE;GAAE;GACtD5B,EAAG,+BAA+B,oDAAoD;EACjF;CA/BD,GAAA4B,EAAS,EA+BR,CACT,EACD,CAAA;AAEN"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** An event's start edge in its hue. */
|
|
2
|
+
export declare const EVENT_EDGE = "border-s-[3px] border-s-[var(--cal-hue)]";
|
|
3
|
+
/** An event's faded border in its hue. */
|
|
4
|
+
export declare const EVENT_BORDER = "border border-[color-mix(in_oklab,var(--cal-hue)_35%,transparent)]";
|
|
5
|
+
/** An event's soft fill. */
|
|
6
|
+
export declare const EVENT_FILL = "bg-[color-mix(in_oklab,var(--cal-hue)_16%,var(--color-bg-surface))]";
|
|
7
|
+
/** An invitation waiting for an answer: outlined on the surface, its border dashed. */
|
|
8
|
+
export declare const EVENT_INVITATION_FILL = "border-dashed bg-bg-surface";
|
|
9
|
+
/** "Maybe": the fill striped. */
|
|
10
|
+
export declare const EVENT_MAYBE_FILL = "bg-[repeating-linear-gradient(135deg,color-mix(in_oklab,var(--cal-hue)_16%,var(--color-bg-surface))_0_7px,var(--color-bg-surface)_7px_12px)]";
|
|
11
|
+
/** Someone else's private time: hatched, with no fill of the hue. */
|
|
12
|
+
export declare const EVENT_BUSY_FILL = "border border-border-default bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)] text-text-secondary";
|
|
13
|
+
/** An event's fill for its marker: hatched private time, an outlined invitation, a striped maybe. */
|
|
14
|
+
export declare function blockFill(look: {
|
|
15
|
+
busyOnly: boolean;
|
|
16
|
+
invitation: boolean;
|
|
17
|
+
maybe: boolean;
|
|
18
|
+
}): string;
|
|
19
|
+
/** Ended (with "Fade past events" on). */
|
|
20
|
+
export declare const EVENT_PAST = "opacity-[0.56]";
|
|
21
|
+
/** On now: ringed in its hue. */
|
|
22
|
+
export declare const EVENT_NOW = "shadow-[0_0_0_1.5px_var(--cal-hue)]";
|
|
23
|
+
/** Picked: its peek is open. */
|
|
24
|
+
export declare const EVENT_SELECTED = "outline-2 outline-offset-1 outline-[var(--color-focus-ring)]";
|
|
25
|
+
/** A focus ring for the calendar's own buttons. */
|
|
26
|
+
export declare const FOCUS_RING = "focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]";
|
|
27
|
+
/** A small square icon button (rail sections, the peek's tools). */
|
|
28
|
+
export declare const ICON_BUTTON = "inline-flex size-8 shrink-0 items-center justify-center rounded-button text-text-secondary hover:bg-action-ghost-bgHover hover:text-text-primary disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)] [&_svg]:size-4";
|
|
29
|
+
/** An uppercase section label ("MY CALENDARS"). */
|
|
30
|
+
export declare const OVERLINE = "text-xs font-semibold uppercase tracking-[0.06em] text-text-muted";
|
|
31
|
+
/** The panel a view sits in. */
|
|
32
|
+
export declare const VIEW_PANEL = "relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-card border border-border-default bg-bg-surface";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { cn as e } from "@burdenoff/fe-libs/utils";
|
|
2
|
+
// src/v2/styles.ts
|
|
3
|
+
var t = "border-s-[3px] border-s-[var(--cal-hue)]", n = "border border-[color-mix(in_oklab,var(--cal-hue)_35%,transparent)]", r = "bg-[color-mix(in_oklab,var(--cal-hue)_16%,var(--color-bg-surface))]", i = "border-dashed bg-bg-surface", a = "bg-[repeating-linear-gradient(135deg,color-mix(in_oklab,var(--cal-hue)_16%,var(--color-bg-surface))_0_7px,var(--color-bg-surface)_7px_12px)]", o = "border border-border-default bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)] text-text-secondary";
|
|
4
|
+
function s(t) {
|
|
5
|
+
return t.busyOnly ? o : t.invitation ? e(n, i) : t.maybe ? e(n, a) : e(n, r);
|
|
6
|
+
}
|
|
7
|
+
var c = "opacity-[0.56]", l = "shadow-[0_0_0_1.5px_var(--cal-hue)]", u = "outline-2 outline-offset-1 outline-[var(--color-focus-ring)]", d = "focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]", f = "inline-flex size-8 shrink-0 items-center justify-center rounded-button text-text-secondary hover:bg-action-ghost-bgHover hover:text-text-primary disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)] [&_svg]:size-4", p = "text-xs font-semibold uppercase tracking-[0.06em] text-text-muted", m = "relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-card border border-border-default bg-bg-surface";
|
|
8
|
+
export { n as EVENT_BORDER, o as EVENT_BUSY_FILL, t as EVENT_EDGE, r as EVENT_FILL, i as EVENT_INVITATION_FILL, a as EVENT_MAYBE_FILL, l as EVENT_NOW, c as EVENT_PAST, u as EVENT_SELECTED, d as FOCUS_RING, f as ICON_BUTTON, p as OVERLINE, m as VIEW_PANEL, s as blockFill };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["EVENT_EDGE","EVENT_BORDER","EVENT_FILL","EVENT_INVITATION_FILL","EVENT_MAYBE_FILL","EVENT_BUSY_FILL","blockFill","look","cn","EVENT_PAST","EVENT_NOW","EVENT_SELECTED","FOCUS_RING","ICON_BUTTON","OVERLINE","VIEW_PANEL"],"sources":["../../src/v2/styles.ts"],"sourcesContent":["/**\n * Classes the calendar's views share (BOFF-15698 A1). Literal strings, so the host app's\n * Tailwind finds them in the built files; tokens only (the hue comes from `--cal-hue`, set by\n * `calendarHueStyle`).\n */\nimport { cn } from '@burdenoff/fe-libs/utils';\n\n/** An event's start edge in its hue. */\nexport const EVENT_EDGE = 'border-s-[3px] border-s-[var(--cal-hue)]';\n/** An event's faded border in its hue. */\nexport const EVENT_BORDER = 'border border-[color-mix(in_oklab,var(--cal-hue)_35%,transparent)]';\n/** An event's soft fill. */\nexport const EVENT_FILL = 'bg-[color-mix(in_oklab,var(--cal-hue)_16%,var(--color-bg-surface))]';\n/** An invitation waiting for an answer: outlined on the surface, its border dashed. */\nexport const EVENT_INVITATION_FILL = 'border-dashed bg-bg-surface';\n/** \"Maybe\": the fill striped. */\nexport const EVENT_MAYBE_FILL =\n 'bg-[repeating-linear-gradient(135deg,color-mix(in_oklab,var(--cal-hue)_16%,var(--color-bg-surface))_0_7px,var(--color-bg-surface)_7px_12px)]';\n/** Someone else's private time: hatched, with no fill of the hue. */\nexport const EVENT_BUSY_FILL =\n 'border border-border-default bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)] text-text-secondary';\n\n/** An event's fill for its marker: hatched private time, an outlined invitation, a striped maybe. */\nexport function blockFill(look: {\n busyOnly: boolean;\n invitation: boolean;\n maybe: boolean;\n}): string {\n if (look.busyOnly) return EVENT_BUSY_FILL;\n if (look.invitation) return cn(EVENT_BORDER, EVENT_INVITATION_FILL);\n if (look.maybe) return cn(EVENT_BORDER, EVENT_MAYBE_FILL);\n return cn(EVENT_BORDER, EVENT_FILL);\n}\n\n/** Ended (with \"Fade past events\" on). */\nexport const EVENT_PAST = 'opacity-[0.56]';\n/** On now: ringed in its hue. */\nexport const EVENT_NOW = 'shadow-[0_0_0_1.5px_var(--cal-hue)]';\n/** Picked: its peek is open. */\nexport const EVENT_SELECTED = 'outline-2 outline-offset-1 outline-[var(--color-focus-ring)]';\n\n/** A focus ring for the calendar's own buttons. */\nexport const FOCUS_RING =\n 'focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]';\n\n/** A small square icon button (rail sections, the peek's tools). */\nexport const ICON_BUTTON =\n 'inline-flex size-8 shrink-0 items-center justify-center rounded-button text-text-secondary hover:bg-action-ghost-bgHover hover:text-text-primary disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)] [&_svg]:size-4';\n\n/** An uppercase section label (\"MY CALENDARS\"). */\nexport const OVERLINE = 'text-xs font-semibold uppercase tracking-[0.06em] text-text-muted';\n\n/** The panel a view sits in. */\nexport const VIEW_PANEL =\n 'relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-card border border-border-default bg-bg-surface';\n"],"mappings":";;AAQA,IAAaA,IAAa,4CAEbC,IAAe,sEAEfC,IAAa,uEAEbC,IAAwB,+BAExBC,IACX,gJAEWC,IACX;AAGF,SAAgBC,EAAU,GAIf;CAIT,OAHIC,EAAK,WAAiBF,IACtBE,EAAK,aAAmBC,EAAGP,GAAcE,CAAqB,IAC9DI,EAAK,QAAcC,EAAGP,GAAcG,CAAgB,IACjDI,EAAGP,GAAcC,CAAU;AACpC;AAGA,IAAaO,IAAa,kBAEbC,IAAY,uCAEZC,IAAiB,gEAGjBC,IACX,0GAGWC,IACX,8RAGWC,IAAW,qEAGXC,IACX"}
|
|
@@ -1,59 +1,145 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { addDays as e, addMonths as t, canonicalTimeZone as n, dateValueInZone as r, endOfWeek as i, getLocalTimeZone as a, monthOf as o, parseDateValue as s, startOfWeek as c, timeZoneOffsetMinutes as l, todayDateValue as u } from "@burdenoff/fe-libs/ui";
|
|
2
2
|
// src/v2/time/calendarTime.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
3
|
+
var d = 1440, f = 6e4, p = 864e5;
|
|
4
|
+
function m(e) {
|
|
5
5
|
return e === 0 || e === 1 || e === 6;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return e
|
|
7
|
+
function h(e) {
|
|
8
|
+
return n(e) ?? a();
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function g(e, t = /* @__PURE__ */ new Date()) {
|
|
11
|
+
return u(e, t);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function _(e) {
|
|
14
|
+
let t = s(e);
|
|
15
|
+
if (!t) throw RangeError(`Not a calendar day: ${e}`);
|
|
16
|
+
return t;
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
+
function v(e) {
|
|
19
|
+
let { year: t, month: n, day: r } = _(e);
|
|
20
|
+
return Date.UTC(t, n - 1, r);
|
|
18
21
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
22
|
+
function y(e) {
|
|
23
|
+
return (/* @__PURE__ */ new Date(Math.floor(e / p) * p)).toISOString().slice(0, 10);
|
|
24
|
+
}
|
|
25
|
+
function b(e, t) {
|
|
26
|
+
return l(e, new Date(t)) * f;
|
|
27
|
+
}
|
|
28
|
+
function x(e) {
|
|
29
|
+
return new Date(v(e)).getUTCDay();
|
|
30
|
+
}
|
|
31
|
+
function S(e) {
|
|
32
|
+
let t = x(e);
|
|
33
|
+
return t === 0 || t === 6;
|
|
34
|
+
}
|
|
35
|
+
function C(t, n) {
|
|
36
|
+
let r = [];
|
|
37
|
+
for (let i = t; i <= n; i = e(i, 1)) r.push(i);
|
|
38
|
+
return r;
|
|
39
|
+
}
|
|
40
|
+
function w(e, t) {
|
|
41
|
+
return Math.round((v(t) - v(e)) / p);
|
|
42
|
+
}
|
|
43
|
+
function T(e, t, n) {
|
|
44
|
+
let r = v(e) + Math.round(t * f), i = b(n, r - p), a = b(n, r + p), o = (i === a ? [i] : [i, a]).map((e) => r - e).sort((e, t) => e - t);
|
|
45
|
+
for (let e of o) if (b(n, e) === r - e) return new Date(e);
|
|
46
|
+
return new Date(r - i);
|
|
47
|
+
}
|
|
48
|
+
function E(e, t) {
|
|
49
|
+
let n = e.getTime() + b(t, e.getTime()), r = Math.floor(n / p) * p;
|
|
50
|
+
return {
|
|
51
|
+
date: y(n),
|
|
52
|
+
minutes: Math.floor((n - r) / f)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function D(e, t) {
|
|
56
|
+
return T(e, 0, t);
|
|
57
|
+
}
|
|
58
|
+
function O(t, n, r) {
|
|
21
59
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
60
|
+
from: D(t, r),
|
|
61
|
+
to: D(e(n, 1), r)
|
|
24
62
|
};
|
|
25
63
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
64
|
+
function k(t, n, r) {
|
|
65
|
+
switch (t) {
|
|
66
|
+
case "day": return [n];
|
|
67
|
+
case "week": {
|
|
68
|
+
if (r.compact) return C(n, e(n, 2));
|
|
69
|
+
let t = C(c(n, r.weekStart), i(n, r.weekStart));
|
|
70
|
+
return r.showWeekends === !1 ? t.filter((e) => !S(e)) : t;
|
|
71
|
+
}
|
|
72
|
+
case "month": return A(n, r.weekStart);
|
|
73
|
+
case "list": return C(n, e(n, 13));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function A(n, r) {
|
|
77
|
+
let a = `${o(n)}-01`, s = e(t(a, 1), -1);
|
|
78
|
+
return C(c(a, r), i(s, r));
|
|
79
|
+
}
|
|
80
|
+
function j(n, r, i, a = {}) {
|
|
81
|
+
switch (n) {
|
|
82
|
+
case "day": return e(r, i);
|
|
83
|
+
case "week": return e(r, i * (a.compact ? 3 : 7));
|
|
84
|
+
case "month": return t(r, i);
|
|
85
|
+
case "list": return e(r, i * 7);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function M(t, n, r, i) {
|
|
89
|
+
let a = k(t, n, r), o = a[0] ?? n, s = a[a.length - 1] ?? n, { from: c, to: l } = O(e(o, -1), e(s, 1), i);
|
|
90
|
+
return {
|
|
91
|
+
days: a,
|
|
92
|
+
from: c,
|
|
93
|
+
to: l
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function N(t, n, r, i, a) {
|
|
97
|
+
let o = t.getTime(), s = Math.max(n.getTime(), o), c = E(t, r), l = E(new Date(s), r), u = l.date, p = l.minutes;
|
|
98
|
+
p === 0 && s > o && u > c.date && (u = e(u, -1), p = d);
|
|
99
|
+
let m = [], h = c.date > i ? c.date : i, g = u < a ? u : a;
|
|
100
|
+
for (let e of C(h, g)) {
|
|
101
|
+
let t = e === c.date ? c.minutes : 0, n = e === u ? p : d;
|
|
102
|
+
e === c.date && e === u && n <= t && s > o && (n = Math.min(d, t + Math.round((s - o) / f))), m.push({
|
|
103
|
+
date: e,
|
|
104
|
+
startMinute: t,
|
|
105
|
+
endMinute: n,
|
|
106
|
+
continuesBefore: e !== c.date,
|
|
107
|
+
continuesAfter: e !== u
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return m;
|
|
111
|
+
}
|
|
112
|
+
function P(e, t) {
|
|
113
|
+
return E(e, t).minutes === 0;
|
|
28
114
|
}
|
|
29
|
-
function
|
|
30
|
-
let a =
|
|
31
|
-
if (
|
|
32
|
-
start:
|
|
33
|
-
end:
|
|
115
|
+
function F(e, t, i) {
|
|
116
|
+
let a = n(i.eventTimeZone), o = e.getTime() % p === 0 ? "UTC" : a && P(e, a) ? a : i.viewerTimeZone, s = r(e, o);
|
|
117
|
+
if (t.getTime() <= e.getTime()) return {
|
|
118
|
+
start: s,
|
|
119
|
+
end: s
|
|
34
120
|
};
|
|
35
|
-
let
|
|
121
|
+
let c = r(/* @__PURE__ */ new Date(t.getTime() - 1), o);
|
|
36
122
|
return {
|
|
37
|
-
start:
|
|
38
|
-
end:
|
|
123
|
+
start: s,
|
|
124
|
+
end: c < s ? s : c
|
|
39
125
|
};
|
|
40
126
|
}
|
|
41
|
-
function
|
|
42
|
-
if (e.allDay) return
|
|
127
|
+
function I(e, t) {
|
|
128
|
+
if (e.allDay) return F(e.start, e.end, {
|
|
43
129
|
eventTimeZone: e.timeZone,
|
|
44
|
-
viewerTimeZone:
|
|
130
|
+
viewerTimeZone: t
|
|
45
131
|
});
|
|
46
|
-
let
|
|
132
|
+
let n = r(e.start, t);
|
|
47
133
|
if (e.end.getTime() <= e.start.getTime()) return {
|
|
48
|
-
start:
|
|
49
|
-
end:
|
|
134
|
+
start: n,
|
|
135
|
+
end: n
|
|
50
136
|
};
|
|
51
|
-
let i =
|
|
137
|
+
let i = r(/* @__PURE__ */ new Date(e.end.getTime() - 1), t);
|
|
52
138
|
return {
|
|
53
|
-
start:
|
|
54
|
-
end: i <
|
|
139
|
+
start: n,
|
|
140
|
+
end: i < n ? n : i
|
|
55
141
|
};
|
|
56
142
|
}
|
|
57
|
-
export {
|
|
143
|
+
export { d as MINUTES_PER_DAY, F as allDayDays, w as dayDifference, C as daysBetween, O as daysToInstants, I as eventDays, E as instantToZoned, m as isWeekStart, S as isWeekendDay, A as monthGridDays, h as resolveTimeZone, D as startOfDayInZone, j as stepAnchor, N as timedSegments, g as today, k as viewDays, M as viewQueryRange, x as weekdayOf, T as zonedTimeToInstant };
|
|
58
144
|
|
|
59
145
|
//# sourceMappingURL=calendarTime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendarTime.js","names":["MINUTE_MS","DAY_MS","isWeekStart","value","resolveTimeZone","canonicalTimeZone","preferred","getLocalTimeZone","today","todayDateValue","timeZone","now","dateOfWall","wall","offsetMs","timeZoneOffsetMinutes","instant","instantToZoned","midnight","isMidnightIn","allDayDays","eventZone","options","zone","start","first","dateValueInZone","end","lastDay","eventDays","event"],"sources":["../../../src/v2/time/calendarTime.ts"],"sourcesContent":["/**\n * The redesigned calendar's time maths (BOFF-15698 A0): which days a view shows, and where\n * an instant falls on the clock of an IANA time zone, correct on the days the clocks change.\n *\n * Built on fe-libs' calendar helpers (`@burdenoff/fe-libs/ui`): a day is a floating\n * `YYYY-MM-DD` (`DateValue`) whose arithmetic runs on UTC midnights, so adding days never\n * skips or repeats one; a zone's offset at an instant comes from `Intl`\n * (`timeZoneOffsetMinutes`). Nothing here assumes a fixed offset.\n *\n * - A wall-clock time the clocks skip (01:30 in London on 29 March 2026) moves forward by the\n * gap (02:30 BST); one that happens twice (01:30 on 25 October 2026) is the first of the\n * two. That is RFC 5545's rule and Temporal's \"compatible\" one.\n * - A day lasts 23 or 25 hours where the clocks change; the grid stays a 24-hour clock face,\n * so an event is placed by its wall-clock minutes (`timedSegments`).\n * - All-day events and blocks are floating days (`allDayDays`): the same days wherever they\n * are read.\n */\nimport {\n addDays,\n addMonths,\n canonicalTimeZone,\n dateValueInZone,\n endOfWeek,\n getLocalTimeZone,\n monthOf,\n parseDateValue,\n startOfWeek,\n timeZoneOffsetMinutes,\n todayDateValue,\n type DateValue,\n type WeekStart,\n} from '@burdenoff/fe-libs/ui';\nimport type { CalendarV2View, TimedSegment } from '../types';\n\nexport const MINUTES_PER_DAY = 1440;\n/** The list view shows two weeks from its day. */\nexport const LIST_VIEW_DAYS = 14;\n/** On a phone the week view shows three days from its day. */\nexport const COMPACT_WEEK_DAYS = 3;\n\nconst MINUTE_MS = 60_000;\nconst DAY_MS = 86_400_000;\n\n/** The week starts a person can pick, as fe-libs' pickers number them. */\nexport const WEEK_STARTS: readonly WeekStart[] = [1, 0, 6];\n\nexport function isWeekStart(value: unknown): value is WeekStart {\n return value === 0 || value === 1 || value === 6;\n}\n\n/**\n * The zone the calendar shows: the person's choice when it names a real zone (as today's IANA\n * name: Asia/Kolkata for Asia/Calcutta), else this device's.\n */\nexport function resolveTimeZone(preferred?: string | null): string {\n return canonicalTimeZone(preferred) ?? getLocalTimeZone();\n}\n\n/** Today in `timeZone`. */\nexport function today(timeZone: string, now: Date = new Date()): DateValue {\n return todayDateValue(timeZone, now);\n}\n\nfunction partsOf(date: DateValue): { year: number; month: number; day: number } {\n const parts = parseDateValue(date);\n if (!parts) throw new RangeError(`Not a calendar day: ${date}`);\n return parts;\n}\n\n/** The UTC midnight of a day: its wall clock read as if it were UTC. */\nfunction wallMidnight(date: DateValue): number {\n const { year, month, day } = partsOf(date);\n return Date.UTC(year, month - 1, day);\n}\n\n/** The day a \"wall clock as UTC\" millisecond count falls on. */\nfunction dateOfWall(wall: number): DateValue {\n return new Date(Math.floor(wall / DAY_MS) * DAY_MS).toISOString().slice(0, 10);\n}\n\nfunction offsetMs(timeZone: string, instant: number): number {\n return timeZoneOffsetMinutes(timeZone, new Date(instant)) * MINUTE_MS;\n}\n\n/** The day of the week, 0 Sunday to 6 Saturday. */\nexport function weekdayOf(date: DateValue): number {\n return new Date(wallMidnight(date)).getUTCDay();\n}\n\nexport function isWeekendDay(date: DateValue): boolean {\n const weekday = weekdayOf(date);\n return weekday === 0 || weekday === 6;\n}\n\n/** The days from `first` to `last`, both included; none when `last` is before `first`. */\nexport function daysBetween(first: DateValue, last: DateValue): DateValue[] {\n const days: DateValue[] = [];\n for (let day = first; day <= last; day = addDays(day, 1)) days.push(day);\n return days;\n}\n\n/** Whole days from `a` to `b` (negative when `b` is earlier). */\nexport function dayDifference(a: DateValue, b: DateValue): number {\n return Math.round((wallMidnight(b) - wallMidnight(a)) / DAY_MS);\n}\n\n/**\n * The instant a wall-clock time on a day stands for in `timeZone`. `minutes` count from the\n * day's midnight and may run past it (1500 is 01:00 the next day). A skipped time moves\n * forward by the gap; a repeated time is the first of the two.\n */\nexport function zonedTimeToInstant(date: DateValue, minutes: number, timeZone: string): Date {\n const wall = wallMidnight(date) + Math.round(minutes * MINUTE_MS);\n // The offsets in force a day either side: a time zone changes its offset at most once there.\n const before = offsetMs(timeZone, wall - DAY_MS);\n const after = offsetMs(timeZone, wall + DAY_MS);\n const candidates = (before === after ? [before] : [before, after])\n .map((offset) => wall - offset)\n .sort((a, b) => a - b);\n for (const instant of candidates) {\n // The clock reads `wall` at this instant: a real time (the earlier one when it repeats).\n if (offsetMs(timeZone, instant) === wall - instant) return new Date(instant);\n }\n // Skipped by the clocks: read it with the offset before the change, which lands after the gap.\n return new Date(wall - before);\n}\n\n/** The day, and the minutes after its midnight, that an instant shows on a clock in `timeZone`. */\nexport function instantToZoned(\n instant: Date,\n timeZone: string\n): { date: DateValue; minutes: number } {\n const wall = instant.getTime() + offsetMs(timeZone, instant.getTime());\n const midnight = Math.floor(wall / DAY_MS) * DAY_MS;\n return { date: dateOfWall(wall), minutes: Math.floor((wall - midnight) / MINUTE_MS) };\n}\n\n/** The first instant of a day in `timeZone`: its midnight, or the end of a gap at midnight. */\nexport function startOfDayInZone(date: DateValue, timeZone: string): Date {\n return zonedTimeToInstant(date, 0, timeZone);\n}\n\n/** How long a day lasts in `timeZone`, in minutes: 1440, or 1380 and 1500 when clocks change. */\nexport function dayLengthMinutes(date: DateValue, timeZone: string): number {\n const start = startOfDayInZone(date, timeZone).getTime();\n const next = startOfDayInZone(addDays(date, 1), timeZone).getTime();\n return Math.round((next - start) / MINUTE_MS);\n}\n\n/** The instants days `first` to `last` (both included) cover in `timeZone`: `[from, to)`. */\nexport function daysToInstants(\n first: DateValue,\n last: DateValue,\n timeZone: string\n): { from: Date; to: Date } {\n return {\n from: startOfDayInZone(first, timeZone),\n to: startOfDayInZone(addDays(last, 1), timeZone),\n };\n}\n\nexport interface ViewDaysOptions {\n weekStart: WeekStart;\n /** The week view without Saturday and Sunday when false. Default true. */\n showWeekends?: boolean;\n /** A phone: the week view shows three days from its day. */\n compact?: boolean;\n}\n\n/**\n * The days a view shows for its day `anchor`:\n * - day: that day;\n * - week: its week from the person's week start (Monday, Sunday or Saturday), without the\n * weekend when it is hidden; on a phone, three days from `anchor`;\n * - month: whole weeks from the week of the 1st to the week of the last day (4 to 6 rows);\n * - list: two weeks from `anchor`.\n */\nexport function viewDays(\n view: CalendarV2View,\n anchor: DateValue,\n options: ViewDaysOptions\n): DateValue[] {\n switch (view) {\n case 'day':\n return [anchor];\n case 'week': {\n if (options.compact) return daysBetween(anchor, addDays(anchor, COMPACT_WEEK_DAYS - 1));\n const week = daysBetween(\n startOfWeek(anchor, options.weekStart),\n endOfWeek(anchor, options.weekStart)\n );\n return options.showWeekends === false ? week.filter((day) => !isWeekendDay(day)) : week;\n }\n case 'month':\n return monthGridDays(anchor, options.weekStart);\n case 'list':\n return daysBetween(anchor, addDays(anchor, LIST_VIEW_DAYS - 1));\n }\n}\n\n/** The month grid of the month `anchor` is in: whole weeks, from the person's week start. */\nexport function monthGridDays(anchor: DateValue, weekStart: WeekStart): DateValue[] {\n const first = `${monthOf(anchor)}-01`;\n const last = addDays(addMonths(first, 1), -1);\n return daysBetween(startOfWeek(first, weekStart), endOfWeek(last, weekStart));\n}\n\n/**\n * The day a view moves to for \"previous\" (-1) and \"next\" (1): a day, a week (three days on a\n * phone), a month (the same day of the month, or its last day), or a week of the list.\n */\nexport function stepAnchor(\n view: CalendarV2View,\n anchor: DateValue,\n direction: -1 | 1,\n options: { compact?: boolean } = {}\n): DateValue {\n switch (view) {\n case 'day':\n return addDays(anchor, direction);\n case 'week':\n return addDays(anchor, direction * (options.compact ? COMPACT_WEEK_DAYS : 7));\n case 'month':\n return addMonths(anchor, direction);\n case 'list':\n return addDays(anchor, direction * 7);\n }\n}\n\n/**\n * What a view needs to load: its days, and the instants to ask the API for. The range runs a\n * day past either end, so an all-day event stored at a UTC midnight is still found when the\n * calendar's zone is far from UTC; the views place events by day and skip days they don't show.\n */\nexport function viewQueryRange(\n view: CalendarV2View,\n anchor: DateValue,\n options: ViewDaysOptions,\n timeZone: string\n): { days: DateValue[]; from: Date; to: Date } {\n const days = viewDays(view, anchor, options);\n const first = days[0] ?? anchor;\n const last = days[days.length - 1] ?? anchor;\n const { from, to } = daysToInstants(addDays(first, -1), addDays(last, 1), timeZone);\n return { days, from, to };\n}\n\n/**\n * A timed event's pieces, one per day it touches between `first` and `last` (both included),\n * on the clock in `timeZone`. An event that ends at midnight ends that day at 24:00 (1440), with\n * no empty piece on the next day. Where the clocks go back and the end reads earlier than the\n * start on the same day, or the same, the piece keeps the event's real length.\n */\nexport function timedSegments(\n start: Date,\n end: Date,\n timeZone: string,\n first: DateValue,\n last: DateValue\n): TimedSegment[] {\n const startMs = start.getTime();\n const endMs = Math.max(end.getTime(), startMs);\n const from = instantToZoned(start, timeZone);\n const to = instantToZoned(new Date(endMs), timeZone);\n let lastDay = to.date;\n let lastMinute = to.minutes;\n if (lastMinute === 0 && endMs > startMs && lastDay > from.date) {\n lastDay = addDays(lastDay, -1);\n lastMinute = MINUTES_PER_DAY;\n }\n const segments: TimedSegment[] = [];\n const firstShown = from.date > first ? from.date : first;\n const lastShown = lastDay < last ? lastDay : last;\n for (const date of daysBetween(firstShown, lastShown)) {\n const startMinute = date === from.date ? from.minutes : 0;\n let endMinute = date === lastDay ? lastMinute : MINUTES_PER_DAY;\n // Where the clocks go back, an end can read earlier than (or the same as) the start.\n if (date === from.date && date === lastDay && endMinute <= startMinute && endMs > startMs) {\n endMinute = Math.min(\n MINUTES_PER_DAY,\n startMinute + Math.round((endMs - startMs) / MINUTE_MS)\n );\n }\n segments.push({\n date,\n startMinute,\n endMinute,\n continuesBefore: date !== from.date,\n continuesAfter: date !== lastDay,\n });\n }\n return segments;\n}\n\nfunction isMidnightIn(instant: Date, timeZone: string): boolean {\n return instantToZoned(instant, timeZone).minutes === 0;\n}\n\n/**\n * The days an all-day event or block covers, both included, the same wherever it is read.\n *\n * All-day times are stored in two ways: at UTC midnights (links, imports, other apps, the API's\n * own rule) and, from today's event form, at midnight where the person who made it was. So the\n * day is read in UTC when the start is a UTC midnight, else in the event's own zone when the\n * start is a midnight there, else in `viewerTimeZone`. The end is exclusive (the next midnight)\n * or the last moment of the last day; an end at or before the start is a one-day event.\n */\nexport function allDayDays(\n start: Date,\n end: Date,\n options: { eventTimeZone?: string | null; viewerTimeZone: string }\n): { start: DateValue; end: DateValue } {\n const eventZone = canonicalTimeZone(options.eventTimeZone);\n const zone =\n start.getTime() % DAY_MS === 0\n ? 'UTC'\n : eventZone && isMidnightIn(start, eventZone)\n ? eventZone\n : options.viewerTimeZone;\n const first = dateValueInZone(start, zone);\n if (end.getTime() <= start.getTime()) return { start: first, end: first };\n const lastDay = dateValueInZone(new Date(end.getTime() - 1), zone);\n return { start: first, end: lastDay < first ? first : lastDay };\n}\n\n/**\n * The first and last day an event touches in `timeZone`: its days for an all-day event, else\n * the days of its start and of the moment before its end.\n */\nexport function eventDays(\n event: { start: Date; end: Date; allDay: boolean; timeZone?: string | null },\n timeZone: string\n): { start: DateValue; end: DateValue } {\n if (event.allDay) {\n return allDayDays(event.start, event.end, {\n eventTimeZone: event.timeZone,\n viewerTimeZone: timeZone,\n });\n }\n const first = dateValueInZone(event.start, timeZone);\n if (event.end.getTime() <= event.start.getTime()) return { start: first, end: first };\n const lastDay = dateValueInZone(new Date(event.end.getTime() - 1), timeZone);\n return { start: first, end: lastDay < first ? first : lastDay };\n}\n"],"mappings":";;AAwCA,IAAMA,IAAY,KACZC,IAAS;AAKf,SAAgBC,EAAY,GAAoC;CAC9D,OAAOC,MAAU,KAAKA,MAAU,KAAKA,MAAU;AACjD;AAMA,SAAgBC,EAAgB,GAAmC;CACjE,OAAOC,EAAkBC,CAAS,KAAKC,EAAiB;AAC1D;AAGA,SAAgBC,EAAM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ACxC,eAAeA,EAAM;EACrB,gBAAgBpB;CAClB,CAAC;CAEH,IAAMe,IAAQC,EAAgBI,EAAM,OAAOpB,CAAQ;CACnD,IAAIoB,EAAM,IAAI,QAAQ,KAAKA,EAAM,MAAM,QAAQ,GAAG,OAAO;EAAE,OAAOL;EAAO,KAAKA;CAAM;CACpF,IAAMG,IAAUF,kBAAgB,IAAI,KAAKI,EAAM,IAAI,QAAQ,IAAI,CAAC,GAAGpB,CAAQ;CAC3E,OAAO;EAAE,OAAOe;EAAO,KAAKG,IAAUH,IAAQA,IAAQG;CAAQ;AAChE"}
|
|
1
|
+
{"version":3,"file":"calendarTime.js","names":["MINUTES_PER_DAY","MINUTE_MS","DAY_MS","isWeekStart","value","resolveTimeZone","canonicalTimeZone","preferred","getLocalTimeZone","today","todayDateValue","timeZone","now","partsOf","parts","parseDateValue","date","wallMidnight","year","month","day","dateOfWall","wall","offsetMs","timeZoneOffsetMinutes","instant","weekdayOf","isWeekendDay","weekday","daysBetween","days","first","last","addDays","dayDifference","b","a","zonedTimeToInstant","minutes","before","after","candidates","offset","instantToZoned","midnight","startOfDayInZone","daysToInstants","viewDays","view","anchor","options","week","startOfWeek","endOfWeek","monthGridDays","monthOf","addMonths","weekStart","stepAnchor","direction","viewQueryRange","timedSegments","startMs","start","endMs","end","from","to","lastDay","lastMinute","segments","firstShown","lastShown","startMinute","endMinute","isMidnightIn","allDayDays","eventZone","zone","dateValueInZone","eventDays","event"],"sources":["../../../src/v2/time/calendarTime.ts"],"sourcesContent":["/**\n * The redesigned calendar's time maths (BOFF-15698 A0): which days a view shows, and where\n * an instant falls on the clock of an IANA time zone, correct on the days the clocks change.\n *\n * Built on fe-libs' calendar helpers (`@burdenoff/fe-libs/ui`): a day is a floating\n * `YYYY-MM-DD` (`DateValue`) whose arithmetic runs on UTC midnights, so adding days never\n * skips or repeats one; a zone's offset at an instant comes from `Intl`\n * (`timeZoneOffsetMinutes`). Nothing here assumes a fixed offset.\n *\n * - A wall-clock time the clocks skip (01:30 in London on 29 March 2026) moves forward by the\n * gap (02:30 BST); one that happens twice (01:30 on 25 October 2026) is the first of the\n * two. That is RFC 5545's rule and Temporal's \"compatible\" one.\n * - A day lasts 23 or 25 hours where the clocks change; the grid stays a 24-hour clock face,\n * so an event is placed by its wall-clock minutes (`timedSegments`).\n * - All-day events and blocks are floating days (`allDayDays`): the same days wherever they\n * are read.\n */\nimport {\n addDays,\n addMonths,\n canonicalTimeZone,\n dateValueInZone,\n endOfWeek,\n getLocalTimeZone,\n monthOf,\n parseDateValue,\n startOfWeek,\n timeZoneOffsetMinutes,\n todayDateValue,\n type DateValue,\n type WeekStart,\n} from '@burdenoff/fe-libs/ui';\nimport type { CalendarV2View, TimedSegment } from '../types';\n\nexport const MINUTES_PER_DAY = 1440;\n/** The list view shows two weeks from its day. */\nexport const LIST_VIEW_DAYS = 14;\n/** On a phone the week view shows three days from its day. */\nexport const COMPACT_WEEK_DAYS = 3;\n\nconst MINUTE_MS = 60_000;\nconst DAY_MS = 86_400_000;\n\n/** The week starts a person can pick, as fe-libs' pickers number them. */\nexport const WEEK_STARTS: readonly WeekStart[] = [1, 0, 6];\n\nexport function isWeekStart(value: unknown): value is WeekStart {\n return value === 0 || value === 1 || value === 6;\n}\n\n/**\n * The zone the calendar shows: the person's choice when it names a real zone (as today's IANA\n * name: Asia/Kolkata for Asia/Calcutta), else this device's.\n */\nexport function resolveTimeZone(preferred?: string | null): string {\n return canonicalTimeZone(preferred) ?? getLocalTimeZone();\n}\n\n/** Today in `timeZone`. */\nexport function today(timeZone: string, now: Date = new Date()): DateValue {\n return todayDateValue(timeZone, now);\n}\n\nfunction partsOf(date: DateValue): { year: number; month: number; day: number } {\n const parts = parseDateValue(date);\n if (!parts) throw new RangeError(`Not a calendar day: ${date}`);\n return parts;\n}\n\n/** The UTC midnight of a day: its wall clock read as if it were UTC. */\nfunction wallMidnight(date: DateValue): number {\n const { year, month, day } = partsOf(date);\n return Date.UTC(year, month - 1, day);\n}\n\n/** The day a \"wall clock as UTC\" millisecond count falls on. */\nfunction dateOfWall(wall: number): DateValue {\n return new Date(Math.floor(wall / DAY_MS) * DAY_MS).toISOString().slice(0, 10);\n}\n\nfunction offsetMs(timeZone: string, instant: number): number {\n return timeZoneOffsetMinutes(timeZone, new Date(instant)) * MINUTE_MS;\n}\n\n/** The day of the week, 0 Sunday to 6 Saturday. */\nexport function weekdayOf(date: DateValue): number {\n return new Date(wallMidnight(date)).getUTCDay();\n}\n\nexport function isWeekendDay(date: DateValue): boolean {\n const weekday = weekdayOf(date);\n return weekday === 0 || weekday === 6;\n}\n\n/** The days from `first` to `last`, both included; none when `last` is before `first`. */\nexport function daysBetween(first: DateValue, last: DateValue): DateValue[] {\n const days: DateValue[] = [];\n for (let day = first; day <= last; day = addDays(day, 1)) days.push(day);\n return days;\n}\n\n/** Whole days from `a` to `b` (negative when `b` is earlier). */\nexport function dayDifference(a: DateValue, b: DateValue): number {\n return Math.round((wallMidnight(b) - wallMidnight(a)) / DAY_MS);\n}\n\n/**\n * The instant a wall-clock time on a day stands for in `timeZone`. `minutes` count from the\n * day's midnight and may run past it (1500 is 01:00 the next day). A skipped time moves\n * forward by the gap; a repeated time is the first of the two.\n */\nexport function zonedTimeToInstant(date: DateValue, minutes: number, timeZone: string): Date {\n const wall = wallMidnight(date) + Math.round(minutes * MINUTE_MS);\n // The offsets in force a day either side: a time zone changes its offset at most once there.\n const before = offsetMs(timeZone, wall - DAY_MS);\n const after = offsetMs(timeZone, wall + DAY_MS);\n const candidates = (before === after ? [before] : [before, after])\n .map((offset) => wall - offset)\n .sort((a, b) => a - b);\n for (const instant of candidates) {\n // The clock reads `wall` at this instant: a real time (the earlier one when it repeats).\n if (offsetMs(timeZone, instant) === wall - instant) return new Date(instant);\n }\n // Skipped by the clocks: read it with the offset before the change, which lands after the gap.\n return new Date(wall - before);\n}\n\n/** The day, and the minutes after its midnight, that an instant shows on a clock in `timeZone`. */\nexport function instantToZoned(\n instant: Date,\n timeZone: string\n): { date: DateValue; minutes: number } {\n const wall = instant.getTime() + offsetMs(timeZone, instant.getTime());\n const midnight = Math.floor(wall / DAY_MS) * DAY_MS;\n return { date: dateOfWall(wall), minutes: Math.floor((wall - midnight) / MINUTE_MS) };\n}\n\n/** The first instant of a day in `timeZone`: its midnight, or the end of a gap at midnight. */\nexport function startOfDayInZone(date: DateValue, timeZone: string): Date {\n return zonedTimeToInstant(date, 0, timeZone);\n}\n\n/** How long a day lasts in `timeZone`, in minutes: 1440, or 1380 and 1500 when clocks change. */\nexport function dayLengthMinutes(date: DateValue, timeZone: string): number {\n const start = startOfDayInZone(date, timeZone).getTime();\n const next = startOfDayInZone(addDays(date, 1), timeZone).getTime();\n return Math.round((next - start) / MINUTE_MS);\n}\n\n/** The instants days `first` to `last` (both included) cover in `timeZone`: `[from, to)`. */\nexport function daysToInstants(\n first: DateValue,\n last: DateValue,\n timeZone: string\n): { from: Date; to: Date } {\n return {\n from: startOfDayInZone(first, timeZone),\n to: startOfDayInZone(addDays(last, 1), timeZone),\n };\n}\n\nexport interface ViewDaysOptions {\n weekStart: WeekStart;\n /** The week view without Saturday and Sunday when false. Default true. */\n showWeekends?: boolean;\n /** A phone: the week view shows three days from its day. */\n compact?: boolean;\n}\n\n/**\n * The days a view shows for its day `anchor`:\n * - day: that day;\n * - week: its week from the person's week start (Monday, Sunday or Saturday), without the\n * weekend when it is hidden; on a phone, three days from `anchor`;\n * - month: whole weeks from the week of the 1st to the week of the last day (4 to 6 rows);\n * - list: two weeks from `anchor`.\n */\nexport function viewDays(\n view: CalendarV2View,\n anchor: DateValue,\n options: ViewDaysOptions\n): DateValue[] {\n switch (view) {\n case 'day':\n return [anchor];\n case 'week': {\n if (options.compact) return daysBetween(anchor, addDays(anchor, COMPACT_WEEK_DAYS - 1));\n const week = daysBetween(\n startOfWeek(anchor, options.weekStart),\n endOfWeek(anchor, options.weekStart)\n );\n return options.showWeekends === false ? week.filter((day) => !isWeekendDay(day)) : week;\n }\n case 'month':\n return monthGridDays(anchor, options.weekStart);\n case 'list':\n return daysBetween(anchor, addDays(anchor, LIST_VIEW_DAYS - 1));\n }\n}\n\n/** The month grid of the month `anchor` is in: whole weeks, from the person's week start. */\nexport function monthGridDays(anchor: DateValue, weekStart: WeekStart): DateValue[] {\n const first = `${monthOf(anchor)}-01`;\n const last = addDays(addMonths(first, 1), -1);\n return daysBetween(startOfWeek(first, weekStart), endOfWeek(last, weekStart));\n}\n\n/**\n * The day a view moves to for \"previous\" (-1) and \"next\" (1): a day, a week (three days on a\n * phone), a month (the same day of the month, or its last day), or a week of the list.\n */\nexport function stepAnchor(\n view: CalendarV2View,\n anchor: DateValue,\n direction: -1 | 1,\n options: { compact?: boolean } = {}\n): DateValue {\n switch (view) {\n case 'day':\n return addDays(anchor, direction);\n case 'week':\n return addDays(anchor, direction * (options.compact ? COMPACT_WEEK_DAYS : 7));\n case 'month':\n return addMonths(anchor, direction);\n case 'list':\n return addDays(anchor, direction * 7);\n }\n}\n\n/**\n * What a view needs to load: its days, and the instants to ask the API for. The range runs a\n * day past either end, so an all-day event stored at a UTC midnight is still found when the\n * calendar's zone is far from UTC; the views place events by day and skip days they don't show.\n */\nexport function viewQueryRange(\n view: CalendarV2View,\n anchor: DateValue,\n options: ViewDaysOptions,\n timeZone: string\n): { days: DateValue[]; from: Date; to: Date } {\n const days = viewDays(view, anchor, options);\n const first = days[0] ?? anchor;\n const last = days[days.length - 1] ?? anchor;\n const { from, to } = daysToInstants(addDays(first, -1), addDays(last, 1), timeZone);\n return { days, from, to };\n}\n\n/**\n * A timed event's pieces, one per day it touches between `first` and `last` (both included),\n * on the clock in `timeZone`. An event that ends at midnight ends that day at 24:00 (1440), with\n * no empty piece on the next day. Where the clocks go back and the end reads earlier than the\n * start on the same day, or the same, the piece keeps the event's real length.\n */\nexport function timedSegments(\n start: Date,\n end: Date,\n timeZone: string,\n first: DateValue,\n last: DateValue\n): TimedSegment[] {\n const startMs = start.getTime();\n const endMs = Math.max(end.getTime(), startMs);\n const from = instantToZoned(start, timeZone);\n const to = instantToZoned(new Date(endMs), timeZone);\n let lastDay = to.date;\n let lastMinute = to.minutes;\n if (lastMinute === 0 && endMs > startMs && lastDay > from.date) {\n lastDay = addDays(lastDay, -1);\n lastMinute = MINUTES_PER_DAY;\n }\n const segments: TimedSegment[] = [];\n const firstShown = from.date > first ? from.date : first;\n const lastShown = lastDay < last ? lastDay : last;\n for (const date of daysBetween(firstShown, lastShown)) {\n const startMinute = date === from.date ? from.minutes : 0;\n let endMinute = date === lastDay ? lastMinute : MINUTES_PER_DAY;\n // Where the clocks go back, an end can read earlier than (or the same as) the start.\n if (date === from.date && date === lastDay && endMinute <= startMinute && endMs > startMs) {\n endMinute = Math.min(\n MINUTES_PER_DAY,\n startMinute + Math.round((endMs - startMs) / MINUTE_MS)\n );\n }\n segments.push({\n date,\n startMinute,\n endMinute,\n continuesBefore: date !== from.date,\n continuesAfter: date !== lastDay,\n });\n }\n return segments;\n}\n\nfunction isMidnightIn(instant: Date, timeZone: string): boolean {\n return instantToZoned(instant, timeZone).minutes === 0;\n}\n\n/**\n * The days an all-day event or block covers, both included, the same wherever it is read.\n *\n * All-day times are stored in two ways: at UTC midnights (links, imports, other apps, the API's\n * own rule) and, from today's event form, at midnight where the person who made it was. So the\n * day is read in UTC when the start is a UTC midnight, else in the event's own zone when the\n * start is a midnight there, else in `viewerTimeZone`. The end is exclusive (the next midnight)\n * or the last moment of the last day; an end at or before the start is a one-day event.\n */\nexport function allDayDays(\n start: Date,\n end: Date,\n options: { eventTimeZone?: string | null; viewerTimeZone: string }\n): { start: DateValue; end: DateValue } {\n const eventZone = canonicalTimeZone(options.eventTimeZone);\n const zone =\n start.getTime() % DAY_MS === 0\n ? 'UTC'\n : eventZone && isMidnightIn(start, eventZone)\n ? eventZone\n : options.viewerTimeZone;\n const first = dateValueInZone(start, zone);\n if (end.getTime() <= start.getTime()) return { start: first, end: first };\n const lastDay = dateValueInZone(new Date(end.getTime() - 1), zone);\n return { start: first, end: lastDay < first ? first : lastDay };\n}\n\n/**\n * The first and last day an event touches in `timeZone`: its days for an all-day event, else\n * the days of its start and of the moment before its end.\n */\nexport function eventDays(\n event: { start: Date; end: Date; allDay: boolean; timeZone?: string | null },\n timeZone: string\n): { start: DateValue; end: DateValue } {\n if (event.allDay) {\n return allDayDays(event.start, event.end, {\n eventTimeZone: event.timeZone,\n viewerTimeZone: timeZone,\n });\n }\n const first = dateValueInZone(event.start, timeZone);\n if (event.end.getTime() <= event.start.getTime()) return { start: first, end: first };\n const lastDay = dateValueInZone(new Date(event.end.getTime() - 1), timeZone);\n return { start: first, end: lastDay < first ? first : lastDay };\n}\n"],"mappings":";;AAkCA,IAAaA,IAAkB,MAMzBC,IAAY,KACZC,IAAS;AAKf,SAAgBC,EAAY,GAAoC;CAC9D,OAAOC,MAAU,KAAKA,MAAU,KAAKA,MAAU;AACjD;AAMA,SAAgBC,EAAgB,GAAmC;CACjE,OAAOC,EAAkBC,CAAS,KAAKC,EAAiB;AAC1D;AAGA,SAAgBC,EAAM,GAAkB,oBAAY,IAAI,KAAK,GAAc;CACzE,OAAOC,EAAeC,GAAUC,CAAG;AACrC;AAEA,SAASC,EAAQ,GAA+D;CAC9E,IAAMC,IAAQC,EAAeC,CAAI;CACjC,IAAI,CAACF,GAAO,MAAU,WAAW,uBAAuBE,GAAM;CAC9D,OAAOF;AACT;AAGA,SAASG,EAAa,GAAyB;CAC7C,IAAM,EAAE,SAAM,UAAO,WAAQJ,EAAQG,CAAI;CACzC,OAAO,KAAK,IAAIE,GAAMC,IAAQ,GAAGC,CAAG;AACtC;AAGA,SAASC,EAAW,GAAyB;CAC3C,wBAAO,IAAI,KAAK,KAAK,MAAMC,IAAOpB,CAAM,IAAIA,CAAM,EAAA,CAAE,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE;AAC/E;AAEA,SAASqB,EAAS,GAAkB,GAAyB;CAC3D,OAAOC,EAAsBb,GAAU,IAAI,KAAKc,CAAO,CAAC,IAAIxB;AAC9D;AAGA,SAAgByB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The views of the redesigned calendar. Phones show the week view as 3 days. */
|
|
3
3
|
export type CalendarV2View = 'day' | 'week' | 'month' | 'list';
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The dialogs an address can open (`?dialog=`): where today's pages went (§2: rooms, share,
|
|
6
|
+
* settings), the event dialog and Find a time (A2), and the keyboard shortcuts (A1).
|
|
7
|
+
*/
|
|
8
|
+
export type CalendarV2Dialog = 'rooms' | 'share' | 'settings' | 'event' | 'findtime' | 'shortcuts';
|
|
9
|
+
/**
|
|
10
|
+
* What the event dialog opens with (A2), set by the view that opened it: an event to edit, or a
|
|
11
|
+
* new event's day, times, calendar and title (a quick create's "More options").
|
|
12
|
+
*/
|
|
13
|
+
export interface CalendarV2EventDraft {
|
|
14
|
+
/** The event to edit; absent for a new event. */
|
|
15
|
+
eventId?: string;
|
|
16
|
+
/** The tab to open on: 'details', 'people', 'place' or 'more'. */
|
|
17
|
+
tab?: string;
|
|
18
|
+
/** A new event's day, and its times in minutes on the calendar's clock (end up to 1440). */
|
|
19
|
+
date?: DateValue;
|
|
20
|
+
start?: number;
|
|
21
|
+
end?: number;
|
|
22
|
+
allDay?: boolean;
|
|
23
|
+
calendarId?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
}
|
|
6
26
|
export type CalendarKindV2 = 'WORKSPACE' | 'GROUP' | 'PROJECT' | 'PERSONAL';
|
|
7
27
|
/** Where a calendar's events come from. `ICS_URL`: subscribed by link (read-only). */
|
|
8
28
|
export type CalendarSourceV2 = 'LOCAL' | 'ICS_URL' | 'GOOGLE_CALENDAR' | 'OUTLOOK_CALENDAR';
|