@dataverse-kit/calendar-kit 0.1.0 → 0.2.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/README.md +65 -0
- package/dist/{CalendarView-Dd8BHOLE.d.cts → CalendarView-Cx1rnN1I.d.cts} +1 -1
- package/dist/{CalendarView-CShiWFsR.d.ts → CalendarView-DokZ3UaA.d.ts} +1 -1
- package/dist/code-app.cjs +364 -0
- package/dist/code-app.cjs.map +1 -0
- package/dist/code-app.d.cts +53 -0
- package/dist/code-app.d.ts +53 -0
- package/dist/code-app.mjs +337 -0
- package/dist/code-app.mjs.map +1 -0
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/dataverse.cjs +85 -2
- package/dist/dataverse.cjs.map +1 -1
- package/dist/dataverse.d.cts +21 -114
- package/dist/dataverse.d.ts +21 -114
- package/dist/dataverse.mjs +78 -1
- package/dist/dataverse.mjs.map +1 -1
- package/dist/fake.d.cts +1 -1
- package/dist/fake.d.ts +1 -1
- package/dist/index.cjs +95 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.mjs +94 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mapping-DRx7vxQl.d.cts +121 -0
- package/dist/mapping-P6GFE8dF.d.ts +121 -0
- package/dist/pcf-dataset.d.cts +2 -2
- package/dist/pcf-dataset.d.ts +2 -2
- package/dist/portal.cjs +371 -0
- package/dist/portal.cjs.map +1 -0
- package/dist/portal.d.cts +40 -0
- package/dist/portal.d.ts +40 -0
- package/dist/portal.mjs +344 -0
- package/dist/portal.mjs.map +1 -0
- package/dist/pull-DXFuI2sU.d.ts +47 -0
- package/dist/pull-DuZIyoqY.d.cts +47 -0
- package/dist/{types-u3Gpxk53.d.cts → types-Bxkg9NIR.d.cts} +1 -1
- package/dist/{types-u3Gpxk53.d.ts → types-Bxkg9NIR.d.ts} +1 -1
- package/dist/v9.d.cts +2 -2
- package/dist/v9.d.ts +2 -2
- package/package.json +11 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
export { C as CalendarTheme, a as CalendarView, b as CalendarViewName, c as CalendarViewProps, t as themeStyle } from './CalendarView-
|
|
2
|
-
|
|
1
|
+
export { C as CalendarTheme, a as CalendarView, b as CalendarViewName, c as CalendarViewProps, t as themeStyle } from './CalendarView-Cx1rnN1I.cjs';
|
|
2
|
+
import { C as CalendarEvent, V as VisibleRange, b as CalendarEventChange, S as SlotSelection, a as CalendarDataSource } from './types-Bxkg9NIR.cjs';
|
|
3
|
+
export { B as BusinessHours, c as CalendarValue, d as ValueKind, Z as ZoneOffset } from './types-Bxkg9NIR.cjs';
|
|
3
4
|
export { GROUP_PALETTE, addDays, browserZone, contrastRatio, fixedZone, fromWall, groupColor, kindOf, normaliseFloating, parseHex, readableTextOn, toDate, toInstant, toWall, utcFieldsToWall } from './core.cjs';
|
|
4
5
|
import 'react';
|
|
6
|
+
|
|
7
|
+
interface CalendarSourceBinding {
|
|
8
|
+
events: readonly CalendarEvent[];
|
|
9
|
+
loading: boolean;
|
|
10
|
+
/** The last load failure, or null. A failed load keeps the previous events on screen. */
|
|
11
|
+
error: string | null;
|
|
12
|
+
/** Re-run the current range (e.g. after booking a slot elsewhere on the page). */
|
|
13
|
+
reload: () => void;
|
|
14
|
+
/** Spread onto `<CalendarView>` / `<FluentCalendar>`. */
|
|
15
|
+
props: {
|
|
16
|
+
events: readonly CalendarEvent[];
|
|
17
|
+
loading: boolean;
|
|
18
|
+
editable: boolean;
|
|
19
|
+
selectable: boolean;
|
|
20
|
+
onRangeChange: (range: VisibleRange) => void;
|
|
21
|
+
onEventChange?: (change: CalendarEventChange) => Promise<void>;
|
|
22
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
23
|
+
onSelectRange?: (slot: SlotSelection) => void;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Drive a calendar from a PULLED `CalendarDataSource` (code app, Power Pages): load on every range
|
|
28
|
+
* change, save a drag through the source, then reload so the calendar shows what the server kept.
|
|
29
|
+
*
|
|
30
|
+
* ★ Only the NEWEST load may land. Ranges change faster than networks answer (click "next" three
|
|
31
|
+
* times), so an older response arriving last must not overwrite the newer week. Each load aborts
|
|
32
|
+
* its predecessor AND is sequence-checked — a source that ignores `signal` is still safe.
|
|
33
|
+
* ★ A save that rejects is RE-THROWN, so the calendar's optimistic layer reverts the event and shows
|
|
34
|
+
* the message; swallowing it here would leave the event where it was dropped, unsaved.
|
|
35
|
+
*/
|
|
36
|
+
declare function useCalendarSource(source: CalendarDataSource | null | undefined): CalendarSourceBinding;
|
|
37
|
+
|
|
38
|
+
export { CalendarDataSource, CalendarEvent, CalendarEventChange, type CalendarSourceBinding, SlotSelection, VisibleRange, useCalendarSource };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
export { C as CalendarTheme, a as CalendarView, b as CalendarViewName, c as CalendarViewProps, t as themeStyle } from './CalendarView-
|
|
2
|
-
|
|
1
|
+
export { C as CalendarTheme, a as CalendarView, b as CalendarViewName, c as CalendarViewProps, t as themeStyle } from './CalendarView-DokZ3UaA.js';
|
|
2
|
+
import { C as CalendarEvent, V as VisibleRange, b as CalendarEventChange, S as SlotSelection, a as CalendarDataSource } from './types-Bxkg9NIR.js';
|
|
3
|
+
export { B as BusinessHours, c as CalendarValue, d as ValueKind, Z as ZoneOffset } from './types-Bxkg9NIR.js';
|
|
3
4
|
export { GROUP_PALETTE, addDays, browserZone, contrastRatio, fixedZone, fromWall, groupColor, kindOf, normaliseFloating, parseHex, readableTextOn, toDate, toInstant, toWall, utcFieldsToWall } from './core.js';
|
|
4
5
|
import 'react';
|
|
6
|
+
|
|
7
|
+
interface CalendarSourceBinding {
|
|
8
|
+
events: readonly CalendarEvent[];
|
|
9
|
+
loading: boolean;
|
|
10
|
+
/** The last load failure, or null. A failed load keeps the previous events on screen. */
|
|
11
|
+
error: string | null;
|
|
12
|
+
/** Re-run the current range (e.g. after booking a slot elsewhere on the page). */
|
|
13
|
+
reload: () => void;
|
|
14
|
+
/** Spread onto `<CalendarView>` / `<FluentCalendar>`. */
|
|
15
|
+
props: {
|
|
16
|
+
events: readonly CalendarEvent[];
|
|
17
|
+
loading: boolean;
|
|
18
|
+
editable: boolean;
|
|
19
|
+
selectable: boolean;
|
|
20
|
+
onRangeChange: (range: VisibleRange) => void;
|
|
21
|
+
onEventChange?: (change: CalendarEventChange) => Promise<void>;
|
|
22
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
23
|
+
onSelectRange?: (slot: SlotSelection) => void;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Drive a calendar from a PULLED `CalendarDataSource` (code app, Power Pages): load on every range
|
|
28
|
+
* change, save a drag through the source, then reload so the calendar shows what the server kept.
|
|
29
|
+
*
|
|
30
|
+
* ★ Only the NEWEST load may land. Ranges change faster than networks answer (click "next" three
|
|
31
|
+
* times), so an older response arriving last must not overwrite the newer week. Each load aborts
|
|
32
|
+
* its predecessor AND is sequence-checked — a source that ignores `signal` is still safe.
|
|
33
|
+
* ★ A save that rejects is RE-THROWN, so the calendar's optimistic layer reverts the event and shows
|
|
34
|
+
* the message; swallowing it here would leave the event where it was dropped, unsaved.
|
|
35
|
+
*/
|
|
36
|
+
declare function useCalendarSource(source: CalendarDataSource | null | undefined): CalendarSourceBinding;
|
|
37
|
+
|
|
38
|
+
export { CalendarDataSource, CalendarEvent, CalendarEventChange, type CalendarSourceBinding, SlotSelection, VisibleRange, useCalendarSource };
|
package/dist/index.mjs
CHANGED
|
@@ -493,6 +493,99 @@ function CalendarView(props) {
|
|
|
493
493
|
}
|
|
494
494
|
);
|
|
495
495
|
}
|
|
496
|
+
|
|
497
|
+
// src/view/useCalendarSource.ts
|
|
498
|
+
import * as React3 from "react";
|
|
499
|
+
function describe2(error) {
|
|
500
|
+
const m = error?.message;
|
|
501
|
+
return typeof m === "string" && m ? m : String(error);
|
|
502
|
+
}
|
|
503
|
+
var isAbort = (e) => e?.name === "AbortError";
|
|
504
|
+
function useCalendarSource(source) {
|
|
505
|
+
const [events, setEvents] = React3.useState([]);
|
|
506
|
+
const [loading, setLoading] = React3.useState(false);
|
|
507
|
+
const [error, setError] = React3.useState(null);
|
|
508
|
+
const range = React3.useRef(null);
|
|
509
|
+
const seq = React3.useRef(0);
|
|
510
|
+
const inflight = React3.useRef(null);
|
|
511
|
+
const load = React3.useCallback(async () => {
|
|
512
|
+
const r = range.current;
|
|
513
|
+
if (!source || !r) return;
|
|
514
|
+
inflight.current?.abort();
|
|
515
|
+
const controller = new AbortController();
|
|
516
|
+
inflight.current = controller;
|
|
517
|
+
const mine = ++seq.current;
|
|
518
|
+
setLoading(true);
|
|
519
|
+
try {
|
|
520
|
+
const next = await source.load(r, controller.signal);
|
|
521
|
+
if (mine !== seq.current) return;
|
|
522
|
+
setEvents(next);
|
|
523
|
+
setError(null);
|
|
524
|
+
} catch (e) {
|
|
525
|
+
if (mine !== seq.current || isAbort(e)) return;
|
|
526
|
+
setError(describe2(e));
|
|
527
|
+
} finally {
|
|
528
|
+
if (mine === seq.current) setLoading(false);
|
|
529
|
+
}
|
|
530
|
+
}, [source]);
|
|
531
|
+
React3.useEffect(() => {
|
|
532
|
+
setEvents([]);
|
|
533
|
+
void load();
|
|
534
|
+
}, [load]);
|
|
535
|
+
React3.useEffect(
|
|
536
|
+
() => () => {
|
|
537
|
+
seq.current++;
|
|
538
|
+
inflight.current?.abort();
|
|
539
|
+
},
|
|
540
|
+
[]
|
|
541
|
+
);
|
|
542
|
+
const onRangeChange = React3.useCallback(
|
|
543
|
+
(r) => {
|
|
544
|
+
const prev = range.current;
|
|
545
|
+
range.current = r;
|
|
546
|
+
if (prev && prev.start === r.start && prev.end === r.end) return;
|
|
547
|
+
void load();
|
|
548
|
+
},
|
|
549
|
+
[load]
|
|
550
|
+
);
|
|
551
|
+
const reload = React3.useCallback(() => void load(), [load]);
|
|
552
|
+
const onEventChange = React3.useMemo(
|
|
553
|
+
() => source?.capabilities.update && source.update ? async (change) => {
|
|
554
|
+
await source.update(change);
|
|
555
|
+
await load();
|
|
556
|
+
} : void 0,
|
|
557
|
+
[source, load]
|
|
558
|
+
);
|
|
559
|
+
const open = React3.useMemo(
|
|
560
|
+
() => source?.capabilities.open && source.open ? (e) => source.open(e) : void 0,
|
|
561
|
+
[source]
|
|
562
|
+
);
|
|
563
|
+
const onSelectRange = React3.useMemo(
|
|
564
|
+
() => source?.capabilities.create && source.create ? (slot) => {
|
|
565
|
+
void Promise.resolve().then(() => source.create(slot)).then(
|
|
566
|
+
() => load(),
|
|
567
|
+
(e) => setError(describe2(e))
|
|
568
|
+
);
|
|
569
|
+
} : void 0,
|
|
570
|
+
[source, load]
|
|
571
|
+
);
|
|
572
|
+
return {
|
|
573
|
+
events,
|
|
574
|
+
loading,
|
|
575
|
+
error,
|
|
576
|
+
reload,
|
|
577
|
+
props: {
|
|
578
|
+
events,
|
|
579
|
+
loading,
|
|
580
|
+
editable: !!onEventChange,
|
|
581
|
+
selectable: !!onSelectRange,
|
|
582
|
+
onRangeChange,
|
|
583
|
+
...onEventChange ? { onEventChange } : {},
|
|
584
|
+
...open ? { onEventClick: open } : {},
|
|
585
|
+
...onSelectRange ? { onSelectRange } : {}
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
}
|
|
496
589
|
export {
|
|
497
590
|
CalendarView,
|
|
498
591
|
GROUP_PALETTE,
|
|
@@ -510,6 +603,7 @@ export {
|
|
|
510
603
|
toDate,
|
|
511
604
|
toInstant,
|
|
512
605
|
toWall,
|
|
606
|
+
useCalendarSource,
|
|
513
607
|
utcFieldsToWall
|
|
514
608
|
};
|
|
515
609
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/view/CalendarView.tsx","../src/core/datetime.ts","../src/core/colors.ts","../src/view/fcBridge.ts","../src/view/useOptimisticChanges.ts","../src/view/theme.ts"],"sourcesContent":["import * as React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/react/daygrid';\nimport timeGridPlugin from '@fullcalendar/react/timegrid';\nimport listPlugin from '@fullcalendar/react/list';\nimport interactionPlugin from '@fullcalendar/react/interaction';\nimport classicThemePlugin from '@fullcalendar/react/themes/classic';\nimport type {\n DateSelectInfo,\n DatesSetInfo,\n EventChangeInfo,\n EventClickInfo,\n} from '@fullcalendar/react';\n\nimport '@fullcalendar/react/skeleton.css';\nimport '@fullcalendar/react/themes/classic/theme.css';\nimport '@fullcalendar/react/themes/classic/palette.css';\n\nimport { browserZone } from '../core/datetime';\nimport type { BusinessHours, CalendarEvent, CalendarEventChange, SlotSelection, VisibleRange, ZoneOffset } from '../core/types';\nimport { applyPending, nowWall, sameAllDayness, toFcEvent, toSelection, toVisibleRange } from './fcBridge';\nimport { useOptimisticChanges, type ChangeInfoLike } from './useOptimisticChanges';\nimport { themeStyle, type CalendarTheme } from './theme';\n\n/** The views a host can ask for, by plain name. */\nexport type CalendarViewName = 'month' | 'week' | 'workWeek' | 'day' | 'list';\n\nconst FC_VIEW: Record<CalendarViewName, string> = {\n month: 'dayGridMonth',\n week: 'timeGridWeek',\n workWeek: 'timeGridWorkWeek',\n day: 'timeGridDay',\n list: 'listWeek',\n};\n\nconst VIEW_LABEL: Record<CalendarViewName, string> = {\n month: 'Month',\n week: 'Week',\n workWeek: 'Work week',\n day: 'Day',\n list: 'List',\n};\n\nexport interface CalendarViewProps {\n /** Plain event objects. See `CalendarEvent` for how a value's shape sets its kind. */\n events: readonly CalendarEvent[];\n /** The zone to show instants in. Default: the browser's. A PCF host passes the USER's. */\n zone?: ZoneOffset;\n /** Starting view. Default `week`. */\n view?: CalendarViewName;\n /** View buttons offered, in order. Default: month, week, day, list. */\n views?: readonly CalendarViewName[];\n /** `YYYY-MM-DD` to open on. Default today (in `zone`). */\n initialDate?: string;\n /** Allow drag and resize. Default false — read-only is the safe default. */\n editable?: boolean;\n /** Allow selecting an empty range (→ `onSelectRange`). Default: true when a handler is given. */\n selectable?: boolean;\n businessHours?: readonly BusinessHours[];\n /** 0 = Sunday. */\n firstDay?: number;\n /** `HH:mm:ss` bounds of the time grid. */\n slotMinTime?: string;\n slotMaxTime?: string;\n /** Where the time grid first scrolls to. Default `08:00:00`. */\n scrollTime?: string;\n /** Any CSS height, `'auto'`, or a number of pixels. Default `'auto'`. */\n height?: number | string;\n theme?: CalendarTheme;\n /** Shown while data for a new range loads. */\n loading?: boolean;\n className?: string;\n /**\n * Classes for FullCalendar's own parts. ★ v7 HASHES its class names (`fc-classic-1El`), so a\n * descendant selector like `.fc-button` matches NOTHING — measured: 0 of 7 buttons. These go\n * through FullCalendar's `buttonClass` / `headerToolbarClass` options instead.\n */\n classNames?: { button?: string; toolbar?: string };\n /** Accessible name for the calendar region. */\n 'aria-label'?: string;\n\n onEventClick?: (event: CalendarEvent) => void;\n onSelectRange?: (selection: SlotSelection) => void;\n /**\n * A move or resize. Return a promise to make it OPTIMISTIC: the event stays where it was\n * dropped while the promise runs, and goes back — with a message — if it rejects.\n */\n onEventChange?: (change: CalendarEventChange) => void | Promise<void>;\n onRangeChange?: (range: VisibleRange) => void;\n /** Called after a failed change has been reverted. The banner is shown either way. */\n onChangeError?: (error: unknown, change: CalendarEventChange) => void;\n}\n\n/** FullCalendar's change info → the hook's minimal shape (what the hook reads, and nothing else). */\nconst asChangeInfo = (info: EventChangeInfo): ChangeInfoLike => ({\n event: {\n start: info.event.start as Date | null,\n end: info.event.end as Date | null,\n allDay: info.event.allDay,\n extendedProps: info.event.extendedProps,\n },\n revert: () => info.revert(),\n});\n\nconst bannerStyle: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n marginBottom: 6,\n borderRadius: 4,\n border: '1px solid currentColor',\n};\n\n/**\n * FullCalendar v7 (MIT views only), fed plain events. Knows nothing about Dataverse and nothing\n * about Fluent — this entry is what a Power Pages site uses. `FluentCalendar` (`./v9`) wraps it\n * with Fluent tokens.\n *\n * ★ Nothing here portals and nothing uses tabster, so it cannot join the Fluent/tabster\n * singleton race that has taken down PCF controls on model-driven forms. The error banner is\n * in-tree for the same reason: a Toast or Dialog would portal to `document.body`.\n */\nexport function CalendarView(props: CalendarViewProps): React.ReactElement {\n const zone = props.zone ?? browserZone;\n const zoneRef = React.useRef(zone);\n zoneRef.current = zone;\n\n const { pending, error, dismissError, handleChange } = useOptimisticChanges(\n props.events,\n props.onEventChange,\n props.onChangeError,\n zoneRef\n );\n\n const fcEvents = React.useMemo(\n () => applyPending(props.events, pending).map((e) => toFcEvent(e, zone)),\n [props.events, pending, zone]\n );\n\n const views = props.views ?? (['month', 'week', 'day', 'list'] as const);\n\n /**\n * ★★ Options the host did not set are OMITTED, never passed as `undefined`. FullCalendar's\n * option refiners treat a present-but-undefined key as a value: `slotMinTime={undefined}`\n * replaced the default and the time-grid views threw \"Cannot read properties of undefined\n * (reading 'years')\" on first render. The list view never reads it, so a list-only test\n * was green — found by rendering the WEEK view.\n */\n const optional: Record<string, unknown> = {};\n if (props.firstDay !== undefined) optional.firstDay = props.firstDay;\n if (props.slotMinTime !== undefined) optional.slotMinTime = props.slotMinTime;\n if (props.slotMaxTime !== undefined) optional.slotMaxTime = props.slotMaxTime;\n if (props.initialDate !== undefined) optional.initialDate = props.initialDate;\n if (props.classNames?.button) optional.buttonClass = props.classNames.button;\n if (props.classNames?.toolbar) optional.headerToolbarClass = props.classNames.toolbar;\n if (props.businessHours) optional.businessHours = props.businessHours.map((b) => ({ ...b, daysOfWeek: [...b.daysOfWeek] }));\n const selectable = props.selectable ?? !!props.onSelectRange;\n\n return (\n <div\n className={props.className}\n style={themeStyle(props.theme)}\n role=\"region\"\n aria-label={props['aria-label'] ?? 'Calendar'}\n aria-busy={props.loading || undefined}\n data-calendar-kit=\"\"\n >\n {error && (\n <div role=\"alert\" style={{ ...bannerStyle, color: props.theme?.error ?? '#a4262c' }}>\n <span style={{ flex: 1 }}>{error}</span>\n <button type=\"button\" onClick={dismissError} aria-label=\"Dismiss\" style={{ font: 'inherit' }}>\n ×\n </button>\n </div>\n )}\n <FullCalendar\n plugins={[dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin, classicThemePlugin]}\n timeZone=\"UTC\"\n now={() => nowWall(zoneRef.current)}\n initialView={FC_VIEW[props.view ?? 'week']}\n views={{ timeGridWorkWeek: { type: 'timeGridWeek', hiddenDays: [0, 6] } }}\n headerToolbar={{\n start: 'today prev,next',\n center: 'title',\n end: views.map((v) => FC_VIEW[v]).join(','),\n }}\n // ★ v7 renamed v6's `buttonText` to `buttons: { name: { text } }`, keyed by VIEW name.\n buttons={{\n today: { text: 'Today' },\n ...Object.fromEntries(views.map((v) => [FC_VIEW[v], { text: VIEW_LABEL[v] }])),\n }}\n height={props.height ?? 'auto'}\n events={fcEvents}\n editable={!!props.editable && !!props.onEventChange}\n selectable={selectable}\n selectMirror\n nowIndicator\n dayMaxEvents\n {...optional}\n scrollTime={props.scrollTime ?? '08:00:00'}\n eventAllow={(span, moving) => (moving ? sameAllDayness(span.allDay, moving.allDay) : true)}\n datesSet={(info: DatesSetInfo) =>\n props.onRangeChange?.(toVisibleRange(info.start as Date, info.end as Date, info.view.type, zoneRef.current))\n }\n eventClick={(info: EventClickInfo) => {\n info.jsEvent.preventDefault();\n const source = (info.event.extendedProps as { source?: CalendarEvent }).source;\n if (source) props.onEventClick?.(source);\n }}\n select={(info: DateSelectInfo) => {\n props.onSelectRange?.(toSelection(info.start as Date, info.end as Date, info.allDay, zoneRef.current));\n info.view.calendar.unselect();\n }}\n eventDrop={(info: EventChangeInfo) => handleChange('move')(asChangeInfo(info))}\n eventResize={(info: EventChangeInfo) => handleChange('resize')(asChangeInfo(info))}\n />\n </div>\n );\n}\n","import type { CalendarValue, ValueKind, ZoneOffset } from './types';\n\n/**\n * Value-kind detection and zone conversion.\n *\n * ★★ Nothing in this file may read the PROCESS time zone. Every `Date` is built and read through\n * its UTC fields, so the same input gives the same output on a laptop in Auckland and a CI\n * runner in UTC. `npm test` runs the suite under three TZ values to prove it — a single-zone\n * run cannot see a leak, because the developer's zone is the one the code was written in.\n */\n\nconst DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst FLOATING_RE = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,9})?)?$/;\nconst INSTANT_RE = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?(?:Z|[+-]\\d{2}:?\\d{2})$/i;\n\nconst pad = (n: number, w = 2): string => String(n).padStart(w, '0');\n\n/** The browser's own zone, east-positive. The default when a host supplies none. */\nexport const browserZone: ZoneOffset = (instant) => -instant.getTimezoneOffset();\n\n/** A fixed zone (no daylight saving). Mostly for tests and demos. */\nexport const fixedZone =\n (minutesEast: number): ZoneOffset =>\n () =>\n minutesEast;\n\nexport function kindOf(value: CalendarValue | Date): ValueKind {\n if (value instanceof Date) {\n if (Number.isNaN(value.getTime())) throw new RangeError('Invalid Date');\n return 'instant';\n }\n const local = DATE_RE.test(value) ? 'date' : FLOATING_RE.test(value) ? 'floating' : null;\n if (local) {\n // ★ The regex accepts `2026-02-31`; Date.UTC would silently roll it to March 3rd. Reject\n // any date whose fields do not survive a round trip.\n const m = (FLOATING_RE.exec(value) ?? DATE_RE.exec(value))!;\n const [, y, mo, d, h = '0', mi = '0', sec = '0'] = m;\n const t = new Date(Date.UTC(+y, +mo - 1, +d, +h, +mi, +sec));\n if (t.getUTCFullYear() !== +y || t.getUTCMonth() !== +mo - 1 || t.getUTCDate() !== +d || +h > 23 || +mi > 59 || +sec > 59) {\n throw new RangeError(`Not a real calendar date or time: ${JSON.stringify(value)}`);\n }\n return local;\n }\n if (INSTANT_RE.test(value) && !Number.isNaN(new Date(value).getTime())) return 'instant';\n throw new RangeError(`Not an ISO-8601 date, wall-clock time or instant: ${JSON.stringify(value)}`);\n}\n\n/** An instant as canonical UTC ISO text (`…T…Z`, milliseconds kept). */\nexport function toInstant(value: CalendarValue | Date): CalendarValue {\n if (value instanceof Date) return value.toISOString();\n if (kindOf(value) !== 'instant') throw new RangeError(`Not an instant: ${value}`);\n return new Date(value).toISOString();\n}\n\n/** `Date.UTC` from wall-clock fields — i.e. the wall clock treated AS IF it were UTC. */\nfunction wallMillis(wall: string): number {\n const m = FLOATING_RE.exec(wall) ?? DATE_RE.exec(wall);\n if (!m) throw new RangeError(`Not a date or wall-clock time: ${wall}`);\n const [, y, mo, d, h = '0', mi = '0', s = '0'] = m;\n return Date.UTC(+y, +mo - 1, +d, +h, +mi, +s);\n}\n\nfunction formatWall(ms: number): string {\n const d = new Date(ms);\n return (\n `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}` +\n `T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`\n );\n}\n\n/** The wall-clock reading of an instant in `zone`, as floating text (`YYYY-MM-DDTHH:mm:ss`). */\nexport function toWall(instant: CalendarValue | Date, zone: ZoneOffset): CalendarValue {\n const at = instant instanceof Date ? instant : new Date(toInstant(instant));\n return formatWall(at.getTime() + zone(at) * 60_000);\n}\n\n/**\n * The instant at which `zone`'s clocks read `wall`.\n *\n * The offset depends on the instant being solved for, so this takes the offset in force a day\n * BEFORE and a day AFTER the wall reading (no zone changes offset twice in 48 h) and tries both:\n * - an ordinary time: both give the same instant;\n * - a wall time that exists TWICE (fall-back): both round-trip, and the EARLIER is returned;\n * - a wall time that DOES NOT EXIST (spring-forward gap): neither round-trips, and the\n * pre-transition offset is used, which pushes it forward by the gap (02:30 → 03:30), as JS\n * `Date` does. What Dataverse does with one is UNMEASURED.\n *\n * ★ A reviewer caught the first version returning the LATER occurrence east of UTC (Berlin) and\n * the earlier one west of it (Pacific): the two-pass guess settled on whichever offset the\n * first guess happened to land in. Tests now pin both hemispheres with synthetic zones.\n */\nexport function fromWall(wall: CalendarValue, zone: ZoneOffset): CalendarValue {\n const w = wallMillis(wall);\n const before = zone(new Date(w - 86_400_000));\n const after = zone(new Date(w + 86_400_000));\n const fits = (offset: number): number | null => {\n const t = w - offset * 60_000;\n return zone(new Date(t)) === offset ? t : null;\n };\n const candidates = [fits(before), fits(after)].filter((t): t is number => t !== null);\n const t = candidates.length > 0 ? Math.min(...candidates) : w - before * 60_000;\n return new Date(t).toISOString();\n}\n\n/** The calendar day (`YYYY-MM-DD`) of any value, in `zone` for instants. */\nexport function toDate(value: CalendarValue | Date, zone: ZoneOffset): CalendarValue {\n const k = kindOf(value);\n if (k === 'date') return value as string;\n if (k === 'floating') return (value as string).slice(0, 10);\n return toWall(value, zone).slice(0, 10);\n}\n\n/** Calendar-day arithmetic on a `YYYY-MM-DD` value (no zone involved). */\nexport function addDays(date: CalendarValue, days: number): CalendarValue {\n if (kindOf(date) !== 'date') throw new RangeError(`addDays needs a date, got ${date}`);\n return formatWall(wallMillis(date) + days * 86_400_000).slice(0, 10);\n}\n\n/**\n * The UTC fields of a `Date` as floating text. For reading a `Date` that some library has\n * produced in a \"UTC-as-wall-clock\" convention (FullCalendar with `timeZone: 'UTC'`).\n */\nexport function utcFieldsToWall(d: Date): CalendarValue {\n return formatWall(d.getTime());\n}\n\n/** Normalise floating text to seconds precision (`…T09:00` → `…T09:00:00`). */\nexport function normaliseFloating(value: CalendarValue): CalendarValue {\n return formatWall(wallMillis(value));\n}\n","/**\n * Event colours.\n *\n * ★ Without FullCalendar Premium there are no resource lanes, so \"appointments by location\"\n * is expressed as ONE COLOUR PER GROUP. `groupColor` is deterministic (same key → same colour\n * on every load and every machine), which is what lets a person learn the legend.\n * ★ Every palette entry carries white text at >= 4.5:1 (WCAG AA, normal text) — asserted by a\n * test, not by eye. Host-supplied colours (Dataverse option colours are often pale) get their\n * text colour from `readableTextOn` instead of assuming white; a well-known client control\n * hard-coded white on yellow, which is ~1.4:1.\n */\nexport const GROUP_PALETTE: readonly string[] = [\n '#0f6cbd', // blue\n '#107c10', // green\n '#c50f1f', // red\n '#8764b8', // lavender\n '#ae4b00', // dark orange\n '#03787c', // teal\n '#4f52b2', // indigo\n '#8a5b00', // dark gold\n '#c0077d', // magenta\n '#5c2e91', // purple\n];\n\n/** FNV-1a — tiny, stable across engines, good enough spread for a 10-colour palette. */\nfunction hash(key: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < key.length; i++) {\n h ^= key.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return h >>> 0;\n}\n\nexport function groupColor(key: string, palette: readonly string[] = GROUP_PALETTE): string {\n return palette[hash(key) % palette.length];\n}\n\n/** `#rgb` / `#rrggbb` → [r, g, b] 0-255, or null for anything else (named colours, var()). */\nexport function parseHex(color: string): [number, number, number] | null {\n const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());\n if (!m) return null;\n const h = m[1].length === 3 ? m[1].replace(/./g, (c) => c + c) : m[1];\n return [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16)) as [number, number, number];\n}\n\nfunction luminance([r, g, b]: [number, number, number]): number {\n const lin = (c: number): number => {\n const s = c / 255;\n return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n };\n return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);\n}\n\n/** WCAG contrast ratio between two hex colours, or null if either cannot be parsed. */\nexport function contrastRatio(a: string, b: string): number | null {\n const pa = parseHex(a);\n const pb = parseHex(b);\n if (!pa || !pb) return null;\n const [hi, lo] = [luminance(pa), luminance(pb)].sort((x, y) => y - x);\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/**\n * Black or white text, whichever reads better on `background`. Unparseable backgrounds\n * (a CSS variable, a named colour) get `undefined`, i.e. the theme's own event text colour.\n */\nexport function readableTextOn(background: string): '#000000' | '#ffffff' | undefined {\n const onWhite = contrastRatio(background, '#ffffff');\n const onBlack = contrastRatio(background, '#000000');\n if (onWhite === null || onBlack === null) return undefined;\n return onWhite >= onBlack ? '#ffffff' : '#000000';\n}\n","import { readableTextOn } from '../core/colors';\nimport { addDays, fromWall, kindOf, normaliseFloating, toInstant, toWall, utcFieldsToWall } from '../core/datetime';\nimport type {\n CalendarEvent,\n CalendarEventChange,\n CalendarValue,\n SlotSelection,\n ValueKind,\n VisibleRange,\n ZoneOffset,\n} from '../core/types';\n\n/**\n * The translation between the kit's contract and FullCalendar's. Pure (types only from here),\n * so every rule is unit-testable without rendering a calendar.\n *\n * ★★★ THE ZONE STRATEGY. FullCalendar is always run with `timeZone: 'UTC'` and fed WALL-CLOCK\n * values already shifted into the calendar's zone. Its `Date`s then carry the wall clock in\n * their UTC fields, and we shift back on the way out.\n *\n * Why not give FullCalendar the zone? Because a PCF host does not expose one. It exposes\n * `getTimeZoneOffsetMinutes(date)` — an offset per instant, no IANA name — and MEASURED on an\n * org, a user set to Tokyo in a Pacific browser saw an event FullCalendar placed on Monday 9:00\n * that the grid beside it said was Tuesday 1:00. The browser's zone is simply the wrong zone.\n * Shifting per instant with that function is also daylight-saving correct, which a fixed\n * `'+09:00'`-style offset would not be.\n */\n\nexport interface FcEventInput {\n id: string;\n title: string;\n start: string;\n end?: string;\n allDay: boolean;\n color?: string;\n textColor?: string;\n editable?: boolean;\n durationEditable?: boolean;\n /**\n * `kind` is how FullCalendar holds the values (`date` when shown all-day); `originalKind` is\n * what the host SENT, and what a change is converted back into — the \"an event keeps its kind\"\n * contract. They differ only for an instant/floating start forced all-day with `allDay: true`.\n */\n extendedProps: { source: CalendarEvent; kind: ValueKind; originalKind: ValueKind };\n}\n\nfunction toFcValue(value: CalendarValue | Date, zone: ZoneOffset): string {\n const k = kindOf(value);\n if (k === 'instant') return toWall(value, zone);\n if (k === 'floating') return normaliseFloating(value as string);\n return value as string;\n}\n\n/** The exclusive all-day end for any end value: a timed end that is not midnight rounds UP a day. */\nfunction exclusiveAllDayEnd(end: CalendarValue | Date, zone: ZoneOffset): string {\n const wall = toFcValue(end, zone);\n if (wall.length === 10) return wall;\n return wall.slice(11, 19) === '00:00:00' ? wall.slice(0, 10) : addDays(wall.slice(0, 10), 1);\n}\n\nexport function toFcEvent(event: CalendarEvent, zone: ZoneOffset): FcEventInput {\n const originalKind = kindOf(event.start);\n const allDay = event.allDay ?? originalKind === 'date';\n const start = allDay ? toFcValue(event.start, zone).slice(0, 10) : toFcValue(event.start, zone);\n const out: FcEventInput = {\n id: event.id,\n title: event.title,\n start,\n allDay,\n extendedProps: { source: event, kind: allDay ? 'date' : originalKind, originalKind },\n };\n // ★★ Optional keys are OMITTED, never set to `undefined`. FullCalendar treats a PRESENT key as a\n // value: `editable: undefined` resolves to `startEditable === false` (read back through\n // FullCalendar's API — see fullcalendar-contract.test.tsx), which locked EVERY event in an\n // editable calendar. Same family as the `slotMinTime={undefined}` crash in CalendarView.\n if (event.end !== undefined) out.end = allDay ? exclusiveAllDayEnd(event.end, zone) : toFcValue(event.end, zone);\n if (event.color) {\n out.color = event.color;\n const text = readableTextOn(event.color);\n if (text) out.textColor = text;\n }\n if (event.readOnly) out.editable = false;\n // ★ An event with no END is not resizable: a resize would invent an end the host has nowhere\n // to store (a map with no end column), and the calendar would keep showing a length that\n // was never saved. Moving it is still fine.\n else if (event.end === undefined) out.durationEditable = false;\n return out;\n}\n\n/** A FullCalendar `Date` (UTC fields = wall clock) → a value of `kind`. */\nexport function fromFcDate(d: Date, kind: ValueKind, zone: ZoneOffset): CalendarValue {\n const wall = utcFieldsToWall(d);\n if (kind === 'date') return wall.slice(0, 10);\n if (kind === 'floating') return wall;\n return fromWall(wall, zone);\n}\n\nexport interface FcChangedEventLike {\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps: Record<string, unknown>;\n}\n\n/** A calendar value of `kind` → the same moment in `target` kind (all-day midnight for dates). */\nfunction asKind(value: CalendarValue, from: ValueKind, target: ValueKind, zone: ZoneOffset): CalendarValue {\n if (from === target || from !== 'date') return value;\n return target === 'instant' ? fromWall(`${value}T00:00:00`, zone) : `${value}T00:00:00`;\n}\n\n/** The host's original value, canonicalised, for fields a change did not touch. */\nfunction canonical(value: CalendarValue | Date): CalendarValue {\n const k = kindOf(value);\n return k === 'instant' ? toInstant(value) : k === 'floating' ? normaliseFloating(value as string) : (value as string);\n}\n\n/** A dropped/resized FullCalendar event → a change in the ORIGINAL event's kind. */\nexport function toChange(\n fcEvent: FcChangedEventLike,\n kind: CalendarEventChange['kind'],\n zone: ZoneOffset\n): CalendarEventChange {\n const { source, kind: valueKind, originalKind } = fcEvent.extendedProps as FcEventInput['extendedProps'];\n if (!fcEvent.start) throw new Error(`FullCalendar returned no start for event ${source.id}`);\n const back = (d: Date): CalendarValue => asKind(fromFcDate(d, valueKind, zone), valueKind, originalKind ?? valueKind, zone);\n return {\n event: source,\n kind,\n // ★ A RESIZE never moves the start. Recomputing it from FullCalendar's wall-clock Date is\n // lossy on the fall-back day (the second 01:30 reads back as the first), and toWebApiPatch\n // writes `start` unconditionally — so resizing an end silently moved the start an hour.\n start: kind === 'resize' ? canonical(source.start) : back(fcEvent.start),\n end: fcEvent.end ? back(fcEvent.end) : undefined,\n allDay: fcEvent.allDay,\n };\n}\n\nexport function toSelection(start: Date, end: Date, allDay: boolean, zone: ZoneOffset): SlotSelection {\n const kind: ValueKind = allDay ? 'date' : 'instant';\n return { start: fromFcDate(start, kind, zone), end: fromFcDate(end, kind, zone), allDay };\n}\n\nexport function toVisibleRange(start: Date, end: Date, view: string, zone: ZoneOffset): VisibleRange {\n return {\n start: fromFcDate(start, 'instant', zone),\n end: fromFcDate(end, 'instant', zone),\n view,\n startDate: utcFieldsToWall(start).slice(0, 10),\n endDate: utcFieldsToWall(end).slice(0, 10),\n };\n}\n\n/** \"Now\" in the calendar's zone, for FullCalendar's `now` option (drives today + now-line). */\nexport const nowWall = (zone: ZoneOffset): string => toWall(new Date(), zone);\n\n/**\n * ★ A drag may not change an event's KIND. Dropping a timed appointment on the all-day row\n * would have to invent a date-only value for a date-time column (or the reverse), and there\n * is no right answer to invent. FullCalendar allows it by default; this forbids it.\n */\nexport const sameAllDayness = (spanAllDay: boolean, eventAllDay: boolean): boolean => spanAllDay === eventAllDay;\n\n/* ── Optimistic overrides ────────────────────────────────────────────────────────────────────\n * FullCalendar moves an event the moment it is dropped. The host's `events` prop still has the\n * OLD position until its save resolves AND it re-renders with fresh data — and a PCF host\n * re-renders on anything (resize, focus), so without this the event would snap back mid-save\n * and jump forward again later. An override holds the new position until the props agree.\n */\nexport interface PendingMove {\n start: CalendarValue;\n end: CalendarValue | undefined;\n allDay: boolean;\n /** Increments per change; only the newest change for an event may settle or revert it. */\n token: number;\n /**\n * Set when the save RESOLVED: the `events` prop at that moment. The move is dropped on the\n * first `events` that is a different array — whether or not it matches. Without this a save\n * whose value never comes back verbatim (no end column mapped, a plugin adjusting the time)\n * kept its override forever, showing a position that was never stored.\n */\n savedWith?: readonly CalendarEvent[];\n}\n\nconst same = (a: CalendarValue | Date | undefined, b: CalendarValue | undefined): boolean => {\n if (a === undefined || b === undefined) return a === b;\n const ka = kindOf(a);\n if (ka !== kindOf(b)) return false;\n if (ka === 'instant') return new Date(a).getTime() === new Date(b).getTime();\n return ka === 'floating' ? normaliseFloating(a as string) === normaliseFloating(b) : a === b;\n};\n\n/** Events with pending moves applied. */\nexport function applyPending(events: readonly CalendarEvent[], pending: ReadonlyMap<string, PendingMove>): CalendarEvent[] {\n if (pending.size === 0) return events as CalendarEvent[];\n return events.map((e) => {\n const p = pending.get(e.id);\n return p ? { ...e, start: p.start, end: p.end, allDay: p.allDay } : e;\n });\n}\n\n/**\n * Ids whose pending move can be dropped: the props now agree, the event vanished (deleted\n * elsewhere — no ghost), or the save resolved and the host has since re-rendered.\n */\nexport function settledIds(events: readonly CalendarEvent[], pending: ReadonlyMap<string, PendingMove>): string[] {\n const byId = new Map(events.map((e) => [e.id, e]));\n const done: string[] = [];\n for (const [id, p] of pending) {\n const e = byId.get(id);\n if (!e || (same(e.start, p.start) && same(e.end, p.end)) || (p.savedWith !== undefined && p.savedWith !== events)) done.push(id);\n }\n return done;\n}\n","import * as React from 'react';\nimport type { CalendarEvent, CalendarEventChange, ZoneOffset } from '../core/types';\nimport { settledIds, toChange, type FcChangedEventLike, type PendingMove } from './fcBridge';\n\n/** The part of FullCalendar's EventChangeInfo this hook uses — small enough to fake in a test. */\nexport interface ChangeInfoLike {\n event: FcChangedEventLike;\n revert(): void;\n}\n\nexport type ChangeHandler = (change: CalendarEventChange) => void | Promise<void>;\n\nfunction describe(error: unknown): string {\n const m = (error as { message?: unknown } | null)?.message;\n return typeof m === 'string' && m ? m : String(error);\n}\n\n/**\n * The optimistic-save state machine behind drag and resize, separated from the calendar so\n * every transition is testable without driving a real drag (which synthetic input could not do\n * against FullCalendar v7 — see CLAUDE.md).\n *\n * drop ──▶ pending(token) ──resolve──▶ saved (held until the host's next `events`)\n * └─reject/throw─▶ revert + banner (only if still the NEWEST change)\n */\nexport function useOptimisticChanges(\n events: readonly CalendarEvent[],\n onEventChange: ChangeHandler | undefined,\n onChangeError: ((error: unknown, change: CalendarEventChange) => void) | undefined,\n zoneRef: React.MutableRefObject<ZoneOffset>\n): {\n pending: ReadonlyMap<string, PendingMove>;\n error: string | null;\n dismissError: () => void;\n handleChange: (kind: CalendarEventChange['kind']) => (info: ChangeInfoLike) => void;\n} {\n const [pending, setPending] = React.useState<ReadonlyMap<string, PendingMove>>(() => new Map());\n const [error, setError] = React.useState<string | null>(null);\n const eventsRef = React.useRef(events);\n eventsRef.current = events;\n // ★ The newest token per event, held in a REF so a settling promise can ask \"am I still the\n // current change?\" synchronously. Asking inside a setState updater would be a side effect in\n // an updater, which React may run twice or late.\n const latest = React.useRef(new Map<string, number>());\n const seq = React.useRef(0);\n const mounted = React.useRef(true);\n React.useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n React.useEffect(() => {\n const done = settledIds(events, pending);\n if (done.length === 0) return;\n for (const id of done) if (latest.current.get(id) === pending.get(id)?.token) latest.current.delete(id);\n setPending((prev) => {\n const next = new Map(prev);\n for (const id of done) next.delete(id);\n return next;\n });\n }, [events, pending]);\n\n const handleChange = React.useCallback(\n (kind: CalendarEventChange['kind']) =>\n (info: ChangeInfoLike): void => {\n if (!onEventChange) {\n info.revert();\n return;\n }\n let change: CalendarEventChange;\n try {\n change = toChange(info.event, kind, zoneRef.current);\n } catch (e) {\n info.revert();\n setError(describe(e));\n return;\n }\n setError(null);\n const id = change.event.id;\n const token = ++seq.current;\n\n const fail = (err: unknown): void => {\n const current = latest.current.get(id) === token;\n if (current) latest.current.delete(id);\n // ★ onChangeError BEFORE revert, so a revert that throws (calendar already destroyed)\n // cannot swallow the host's error callback.\n onChangeError?.(err, change);\n if (!mounted.current) return;\n setError(`Could not save \"${change.event.title}\": ${describe(err)}`);\n if (!current) return; // a newer move of this event owns its position now\n setPending((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n try {\n info.revert();\n } catch {\n /* the calendar was torn down under us; nothing left to put back */\n }\n };\n\n // ★ Registered BEFORE the handler runs: a synchronous throw calls `fail`, which asks \"am I\n // the current change?\" — registering after the call answered \"no\" and skipped the\n // revert (caught by the sync-throw test).\n latest.current.set(id, token);\n let result: void | Promise<void>;\n try {\n result = onEventChange(change);\n } catch (err) {\n // A handler that throws synchronously is a failed save, not an unhandled error that\n // leaves the event where it was dropped.\n fail(err);\n return;\n }\n if (!result || typeof (result as Promise<void>).then !== 'function') {\n // Fire-and-forget handler: nothing to hold; the host owns the position from here.\n if (latest.current.get(id) === token) latest.current.delete(id);\n return;\n }\n\n setPending((prev) => new Map(prev).set(id, { start: change.start, end: change.end, allDay: change.allDay, token }));\n (result as Promise<void>).then(\n () => {\n if (!mounted.current || latest.current.get(id) !== token) return;\n const savedWith = eventsRef.current;\n setPending((prev) => {\n const p = prev.get(id);\n if (!p || p.token !== token) return prev;\n return new Map(prev).set(id, { ...p, savedWith });\n });\n },\n fail\n );\n },\n [onEventChange, onChangeError, zoneRef]\n );\n\n return { pending, error, dismissError: React.useCallback(() => setError(null), []), handleChange };\n}\n","import type * as React from 'react';\n\n/**\n * The colours a calendar can be themed with, as plain CSS values (hex, rgb(), or `var(--x)`).\n * Each maps onto one of FullCalendar v7's classic-theme custom properties, so theming is just\n * setting variables on the calendar's own container — no stylesheet override, nothing global.\n *\n * ★ Scoped to the container on purpose: FullCalendar's palette declares its defaults on `:root`,\n * and a PCF control shares `:root` with the whole form. Two calendars on one form each set\n * their own, and neither touches the host.\n */\nexport interface CalendarTheme {\n primary?: string;\n primaryForeground?: string;\n background?: string;\n foreground?: string;\n mutedForeground?: string;\n faint?: string;\n muted?: string;\n strong?: string;\n border?: string;\n strongBorder?: string;\n today?: string;\n highlight?: string;\n now?: string;\n button?: string;\n buttonForeground?: string;\n buttonBorder?: string;\n buttonStrong?: string;\n buttonStrongBorder?: string;\n fontFamily?: string;\n fontSize?: string;\n /** Rendered as a banner above the calendar when a save fails. */\n error?: string;\n}\n\nconst VAR: Record<Exclude<keyof CalendarTheme, 'fontFamily' | 'fontSize' | 'error'>, string> = {\n primary: '--fc-classic-primary',\n primaryForeground: '--fc-classic-primary-foreground',\n background: '--fc-classic-background',\n foreground: '--fc-classic-foreground',\n mutedForeground: '--fc-classic-muted-foreground',\n faint: '--fc-classic-faint',\n muted: '--fc-classic-muted',\n strong: '--fc-classic-strong',\n border: '--fc-classic-border',\n strongBorder: '--fc-classic-strong-border',\n today: '--fc-classic-today',\n highlight: '--fc-classic-highlight',\n now: '--fc-classic-now',\n button: '--fc-classic-button',\n buttonForeground: '--fc-classic-button-foreground',\n buttonBorder: '--fc-classic-button-border',\n buttonStrong: '--fc-classic-button-strong',\n buttonStrongBorder: '--fc-classic-button-strong-border',\n};\n\n/** The container style that applies `theme`. Unset keys keep FullCalendar's defaults. */\nexport function themeStyle(theme: CalendarTheme | undefined): React.CSSProperties {\n const style: Record<string, string> = {};\n if (!theme) return style;\n for (const [key, cssVar] of Object.entries(VAR)) {\n const v = theme[key as keyof typeof VAR];\n if (v) style[cssVar] = v;\n }\n if (theme.fontFamily) style.fontFamily = theme.fontFamily;\n if (theme.fontSize) style.fontSize = theme.fontSize;\n if (theme.background) style.background = theme.background;\n if (theme.foreground) style.color = theme.foreground;\n return style as React.CSSProperties;\n}\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AACvB,OAAO,uBAAuB;AAC9B,OAAO,wBAAwB;AAQ/B,OAAO;AACP,OAAO;AACP,OAAO;;;ACLP,IAAM,UAAU;AAChB,IAAM,cAAc;AACpB,IAAM,aAAa;AAEnB,IAAM,MAAM,CAAC,GAAW,IAAI,MAAc,OAAO,CAAC,EAAE,SAAS,GAAG,GAAG;AAG5D,IAAM,cAA0B,CAAC,YAAY,CAAC,QAAQ,kBAAkB;AAGxE,IAAM,YACX,CAAC,gBACD,MACE;AAEG,SAAS,OAAO,OAAwC;AAC7D,MAAI,iBAAiB,MAAM;AACzB,QAAI,OAAO,MAAM,MAAM,QAAQ,CAAC,EAAG,OAAM,IAAI,WAAW,cAAc;AACtE,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,QAAQ,KAAK,KAAK,IAAI,SAAS,YAAY,KAAK,KAAK,IAAI,aAAa;AACpF,MAAI,OAAO;AAGT,UAAM,IAAK,YAAY,KAAK,KAAK,KAAK,QAAQ,KAAK,KAAK;AACxD,UAAM,CAAC,EAAE,GAAG,IAAI,GAAG,IAAI,KAAK,KAAK,KAAK,MAAM,GAAG,IAAI;AACnD,UAAM,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3D,QAAI,EAAE,eAAe,MAAM,CAAC,KAAK,EAAE,YAAY,MAAM,CAAC,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A0B,aAAa,QAAQ,EAAE,aAAa,IAAI,CAAC;AAAA;AAAA,QACnF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["React","t"]}
|
|
1
|
+
{"version":3,"sources":["../src/view/CalendarView.tsx","../src/core/datetime.ts","../src/core/colors.ts","../src/view/fcBridge.ts","../src/view/useOptimisticChanges.ts","../src/view/theme.ts","../src/view/useCalendarSource.ts"],"sourcesContent":["import * as React from 'react';\nimport FullCalendar from '@fullcalendar/react';\nimport dayGridPlugin from '@fullcalendar/react/daygrid';\nimport timeGridPlugin from '@fullcalendar/react/timegrid';\nimport listPlugin from '@fullcalendar/react/list';\nimport interactionPlugin from '@fullcalendar/react/interaction';\nimport classicThemePlugin from '@fullcalendar/react/themes/classic';\nimport type {\n DateSelectInfo,\n DatesSetInfo,\n EventChangeInfo,\n EventClickInfo,\n} from '@fullcalendar/react';\n\nimport '@fullcalendar/react/skeleton.css';\nimport '@fullcalendar/react/themes/classic/theme.css';\nimport '@fullcalendar/react/themes/classic/palette.css';\n\nimport { browserZone } from '../core/datetime';\nimport type { BusinessHours, CalendarEvent, CalendarEventChange, SlotSelection, VisibleRange, ZoneOffset } from '../core/types';\nimport { applyPending, nowWall, sameAllDayness, toFcEvent, toSelection, toVisibleRange } from './fcBridge';\nimport { useOptimisticChanges, type ChangeInfoLike } from './useOptimisticChanges';\nimport { themeStyle, type CalendarTheme } from './theme';\n\n/** The views a host can ask for, by plain name. */\nexport type CalendarViewName = 'month' | 'week' | 'workWeek' | 'day' | 'list';\n\nconst FC_VIEW: Record<CalendarViewName, string> = {\n month: 'dayGridMonth',\n week: 'timeGridWeek',\n workWeek: 'timeGridWorkWeek',\n day: 'timeGridDay',\n list: 'listWeek',\n};\n\nconst VIEW_LABEL: Record<CalendarViewName, string> = {\n month: 'Month',\n week: 'Week',\n workWeek: 'Work week',\n day: 'Day',\n list: 'List',\n};\n\nexport interface CalendarViewProps {\n /** Plain event objects. See `CalendarEvent` for how a value's shape sets its kind. */\n events: readonly CalendarEvent[];\n /** The zone to show instants in. Default: the browser's. A PCF host passes the USER's. */\n zone?: ZoneOffset;\n /** Starting view. Default `week`. */\n view?: CalendarViewName;\n /** View buttons offered, in order. Default: month, week, day, list. */\n views?: readonly CalendarViewName[];\n /** `YYYY-MM-DD` to open on. Default today (in `zone`). */\n initialDate?: string;\n /** Allow drag and resize. Default false — read-only is the safe default. */\n editable?: boolean;\n /** Allow selecting an empty range (→ `onSelectRange`). Default: true when a handler is given. */\n selectable?: boolean;\n businessHours?: readonly BusinessHours[];\n /** 0 = Sunday. */\n firstDay?: number;\n /** `HH:mm:ss` bounds of the time grid. */\n slotMinTime?: string;\n slotMaxTime?: string;\n /** Where the time grid first scrolls to. Default `08:00:00`. */\n scrollTime?: string;\n /** Any CSS height, `'auto'`, or a number of pixels. Default `'auto'`. */\n height?: number | string;\n theme?: CalendarTheme;\n /** Shown while data for a new range loads. */\n loading?: boolean;\n className?: string;\n /**\n * Classes for FullCalendar's own parts. ★ v7 HASHES its class names (`fc-classic-1El`), so a\n * descendant selector like `.fc-button` matches NOTHING — measured: 0 of 7 buttons. These go\n * through FullCalendar's `buttonClass` / `headerToolbarClass` options instead.\n */\n classNames?: { button?: string; toolbar?: string };\n /** Accessible name for the calendar region. */\n 'aria-label'?: string;\n\n onEventClick?: (event: CalendarEvent) => void;\n onSelectRange?: (selection: SlotSelection) => void;\n /**\n * A move or resize. Return a promise to make it OPTIMISTIC: the event stays where it was\n * dropped while the promise runs, and goes back — with a message — if it rejects.\n */\n onEventChange?: (change: CalendarEventChange) => void | Promise<void>;\n onRangeChange?: (range: VisibleRange) => void;\n /** Called after a failed change has been reverted. The banner is shown either way. */\n onChangeError?: (error: unknown, change: CalendarEventChange) => void;\n}\n\n/** FullCalendar's change info → the hook's minimal shape (what the hook reads, and nothing else). */\nconst asChangeInfo = (info: EventChangeInfo): ChangeInfoLike => ({\n event: {\n start: info.event.start as Date | null,\n end: info.event.end as Date | null,\n allDay: info.event.allDay,\n extendedProps: info.event.extendedProps,\n },\n revert: () => info.revert(),\n});\n\nconst bannerStyle: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n marginBottom: 6,\n borderRadius: 4,\n border: '1px solid currentColor',\n};\n\n/**\n * FullCalendar v7 (MIT views only), fed plain events. Knows nothing about Dataverse and nothing\n * about Fluent — this entry is what a Power Pages site uses. `FluentCalendar` (`./v9`) wraps it\n * with Fluent tokens.\n *\n * ★ Nothing here portals and nothing uses tabster, so it cannot join the Fluent/tabster\n * singleton race that has taken down PCF controls on model-driven forms. The error banner is\n * in-tree for the same reason: a Toast or Dialog would portal to `document.body`.\n */\nexport function CalendarView(props: CalendarViewProps): React.ReactElement {\n const zone = props.zone ?? browserZone;\n const zoneRef = React.useRef(zone);\n zoneRef.current = zone;\n\n const { pending, error, dismissError, handleChange } = useOptimisticChanges(\n props.events,\n props.onEventChange,\n props.onChangeError,\n zoneRef\n );\n\n const fcEvents = React.useMemo(\n () => applyPending(props.events, pending).map((e) => toFcEvent(e, zone)),\n [props.events, pending, zone]\n );\n\n const views = props.views ?? (['month', 'week', 'day', 'list'] as const);\n\n /**\n * ★★ Options the host did not set are OMITTED, never passed as `undefined`. FullCalendar's\n * option refiners treat a present-but-undefined key as a value: `slotMinTime={undefined}`\n * replaced the default and the time-grid views threw \"Cannot read properties of undefined\n * (reading 'years')\" on first render. The list view never reads it, so a list-only test\n * was green — found by rendering the WEEK view.\n */\n const optional: Record<string, unknown> = {};\n if (props.firstDay !== undefined) optional.firstDay = props.firstDay;\n if (props.slotMinTime !== undefined) optional.slotMinTime = props.slotMinTime;\n if (props.slotMaxTime !== undefined) optional.slotMaxTime = props.slotMaxTime;\n if (props.initialDate !== undefined) optional.initialDate = props.initialDate;\n if (props.classNames?.button) optional.buttonClass = props.classNames.button;\n if (props.classNames?.toolbar) optional.headerToolbarClass = props.classNames.toolbar;\n if (props.businessHours) optional.businessHours = props.businessHours.map((b) => ({ ...b, daysOfWeek: [...b.daysOfWeek] }));\n const selectable = props.selectable ?? !!props.onSelectRange;\n\n return (\n <div\n className={props.className}\n style={themeStyle(props.theme)}\n role=\"region\"\n aria-label={props['aria-label'] ?? 'Calendar'}\n aria-busy={props.loading || undefined}\n data-calendar-kit=\"\"\n >\n {error && (\n <div role=\"alert\" style={{ ...bannerStyle, color: props.theme?.error ?? '#a4262c' }}>\n <span style={{ flex: 1 }}>{error}</span>\n <button type=\"button\" onClick={dismissError} aria-label=\"Dismiss\" style={{ font: 'inherit' }}>\n ×\n </button>\n </div>\n )}\n <FullCalendar\n plugins={[dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin, classicThemePlugin]}\n timeZone=\"UTC\"\n now={() => nowWall(zoneRef.current)}\n initialView={FC_VIEW[props.view ?? 'week']}\n views={{ timeGridWorkWeek: { type: 'timeGridWeek', hiddenDays: [0, 6] } }}\n headerToolbar={{\n start: 'today prev,next',\n center: 'title',\n end: views.map((v) => FC_VIEW[v]).join(','),\n }}\n // ★ v7 renamed v6's `buttonText` to `buttons: { name: { text } }`, keyed by VIEW name.\n buttons={{\n today: { text: 'Today' },\n ...Object.fromEntries(views.map((v) => [FC_VIEW[v], { text: VIEW_LABEL[v] }])),\n }}\n height={props.height ?? 'auto'}\n events={fcEvents}\n editable={!!props.editable && !!props.onEventChange}\n selectable={selectable}\n selectMirror\n nowIndicator\n dayMaxEvents\n {...optional}\n scrollTime={props.scrollTime ?? '08:00:00'}\n eventAllow={(span, moving) => (moving ? sameAllDayness(span.allDay, moving.allDay) : true)}\n datesSet={(info: DatesSetInfo) =>\n props.onRangeChange?.(toVisibleRange(info.start as Date, info.end as Date, info.view.type, zoneRef.current))\n }\n eventClick={(info: EventClickInfo) => {\n info.jsEvent.preventDefault();\n const source = (info.event.extendedProps as { source?: CalendarEvent }).source;\n if (source) props.onEventClick?.(source);\n }}\n select={(info: DateSelectInfo) => {\n props.onSelectRange?.(toSelection(info.start as Date, info.end as Date, info.allDay, zoneRef.current));\n info.view.calendar.unselect();\n }}\n eventDrop={(info: EventChangeInfo) => handleChange('move')(asChangeInfo(info))}\n eventResize={(info: EventChangeInfo) => handleChange('resize')(asChangeInfo(info))}\n />\n </div>\n );\n}\n","import type { CalendarValue, ValueKind, ZoneOffset } from './types';\n\n/**\n * Value-kind detection and zone conversion.\n *\n * ★★ Nothing in this file may read the PROCESS time zone. Every `Date` is built and read through\n * its UTC fields, so the same input gives the same output on a laptop in Auckland and a CI\n * runner in UTC. `npm test` runs the suite under three TZ values to prove it — a single-zone\n * run cannot see a leak, because the developer's zone is the one the code was written in.\n */\n\nconst DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst FLOATING_RE = /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.\\d{1,9})?)?$/;\nconst INSTANT_RE = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,9})?)?(?:Z|[+-]\\d{2}:?\\d{2})$/i;\n\nconst pad = (n: number, w = 2): string => String(n).padStart(w, '0');\n\n/** The browser's own zone, east-positive. The default when a host supplies none. */\nexport const browserZone: ZoneOffset = (instant) => -instant.getTimezoneOffset();\n\n/** A fixed zone (no daylight saving). Mostly for tests and demos. */\nexport const fixedZone =\n (minutesEast: number): ZoneOffset =>\n () =>\n minutesEast;\n\nexport function kindOf(value: CalendarValue | Date): ValueKind {\n if (value instanceof Date) {\n if (Number.isNaN(value.getTime())) throw new RangeError('Invalid Date');\n return 'instant';\n }\n const local = DATE_RE.test(value) ? 'date' : FLOATING_RE.test(value) ? 'floating' : null;\n if (local) {\n // ★ The regex accepts `2026-02-31`; Date.UTC would silently roll it to March 3rd. Reject\n // any date whose fields do not survive a round trip.\n const m = (FLOATING_RE.exec(value) ?? DATE_RE.exec(value))!;\n const [, y, mo, d, h = '0', mi = '0', sec = '0'] = m;\n const t = new Date(Date.UTC(+y, +mo - 1, +d, +h, +mi, +sec));\n if (t.getUTCFullYear() !== +y || t.getUTCMonth() !== +mo - 1 || t.getUTCDate() !== +d || +h > 23 || +mi > 59 || +sec > 59) {\n throw new RangeError(`Not a real calendar date or time: ${JSON.stringify(value)}`);\n }\n return local;\n }\n if (INSTANT_RE.test(value) && !Number.isNaN(new Date(value).getTime())) return 'instant';\n throw new RangeError(`Not an ISO-8601 date, wall-clock time or instant: ${JSON.stringify(value)}`);\n}\n\n/** An instant as canonical UTC ISO text (`…T…Z`, milliseconds kept). */\nexport function toInstant(value: CalendarValue | Date): CalendarValue {\n if (value instanceof Date) return value.toISOString();\n if (kindOf(value) !== 'instant') throw new RangeError(`Not an instant: ${value}`);\n return new Date(value).toISOString();\n}\n\n/** `Date.UTC` from wall-clock fields — i.e. the wall clock treated AS IF it were UTC. */\nfunction wallMillis(wall: string): number {\n const m = FLOATING_RE.exec(wall) ?? DATE_RE.exec(wall);\n if (!m) throw new RangeError(`Not a date or wall-clock time: ${wall}`);\n const [, y, mo, d, h = '0', mi = '0', s = '0'] = m;\n return Date.UTC(+y, +mo - 1, +d, +h, +mi, +s);\n}\n\nfunction formatWall(ms: number): string {\n const d = new Date(ms);\n return (\n `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}` +\n `T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`\n );\n}\n\n/** The wall-clock reading of an instant in `zone`, as floating text (`YYYY-MM-DDTHH:mm:ss`). */\nexport function toWall(instant: CalendarValue | Date, zone: ZoneOffset): CalendarValue {\n const at = instant instanceof Date ? instant : new Date(toInstant(instant));\n return formatWall(at.getTime() + zone(at) * 60_000);\n}\n\n/**\n * The instant at which `zone`'s clocks read `wall`.\n *\n * The offset depends on the instant being solved for, so this takes the offset in force a day\n * BEFORE and a day AFTER the wall reading (no zone changes offset twice in 48 h) and tries both:\n * - an ordinary time: both give the same instant;\n * - a wall time that exists TWICE (fall-back): both round-trip, and the EARLIER is returned;\n * - a wall time that DOES NOT EXIST (spring-forward gap): neither round-trips, and the\n * pre-transition offset is used, which pushes it forward by the gap (02:30 → 03:30), as JS\n * `Date` does. What Dataverse does with one is UNMEASURED.\n *\n * ★ A reviewer caught the first version returning the LATER occurrence east of UTC (Berlin) and\n * the earlier one west of it (Pacific): the two-pass guess settled on whichever offset the\n * first guess happened to land in. Tests now pin both hemispheres with synthetic zones.\n */\nexport function fromWall(wall: CalendarValue, zone: ZoneOffset): CalendarValue {\n const w = wallMillis(wall);\n const before = zone(new Date(w - 86_400_000));\n const after = zone(new Date(w + 86_400_000));\n const fits = (offset: number): number | null => {\n const t = w - offset * 60_000;\n return zone(new Date(t)) === offset ? t : null;\n };\n const candidates = [fits(before), fits(after)].filter((t): t is number => t !== null);\n const t = candidates.length > 0 ? Math.min(...candidates) : w - before * 60_000;\n return new Date(t).toISOString();\n}\n\n/** The calendar day (`YYYY-MM-DD`) of any value, in `zone` for instants. */\nexport function toDate(value: CalendarValue | Date, zone: ZoneOffset): CalendarValue {\n const k = kindOf(value);\n if (k === 'date') return value as string;\n if (k === 'floating') return (value as string).slice(0, 10);\n return toWall(value, zone).slice(0, 10);\n}\n\n/** Calendar-day arithmetic on a `YYYY-MM-DD` value (no zone involved). */\nexport function addDays(date: CalendarValue, days: number): CalendarValue {\n if (kindOf(date) !== 'date') throw new RangeError(`addDays needs a date, got ${date}`);\n return formatWall(wallMillis(date) + days * 86_400_000).slice(0, 10);\n}\n\n/**\n * The UTC fields of a `Date` as floating text. For reading a `Date` that some library has\n * produced in a \"UTC-as-wall-clock\" convention (FullCalendar with `timeZone: 'UTC'`).\n */\nexport function utcFieldsToWall(d: Date): CalendarValue {\n return formatWall(d.getTime());\n}\n\n/** Normalise floating text to seconds precision (`…T09:00` → `…T09:00:00`). */\nexport function normaliseFloating(value: CalendarValue): CalendarValue {\n return formatWall(wallMillis(value));\n}\n","/**\n * Event colours.\n *\n * ★ Without FullCalendar Premium there are no resource lanes, so \"appointments by location\"\n * is expressed as ONE COLOUR PER GROUP. `groupColor` is deterministic (same key → same colour\n * on every load and every machine), which is what lets a person learn the legend.\n * ★ Every palette entry carries white text at >= 4.5:1 (WCAG AA, normal text) — asserted by a\n * test, not by eye. Host-supplied colours (Dataverse option colours are often pale) get their\n * text colour from `readableTextOn` instead of assuming white; a well-known client control\n * hard-coded white on yellow, which is ~1.4:1.\n */\nexport const GROUP_PALETTE: readonly string[] = [\n '#0f6cbd', // blue\n '#107c10', // green\n '#c50f1f', // red\n '#8764b8', // lavender\n '#ae4b00', // dark orange\n '#03787c', // teal\n '#4f52b2', // indigo\n '#8a5b00', // dark gold\n '#c0077d', // magenta\n '#5c2e91', // purple\n];\n\n/** FNV-1a — tiny, stable across engines, good enough spread for a 10-colour palette. */\nfunction hash(key: string): number {\n let h = 0x811c9dc5;\n for (let i = 0; i < key.length; i++) {\n h ^= key.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return h >>> 0;\n}\n\nexport function groupColor(key: string, palette: readonly string[] = GROUP_PALETTE): string {\n return palette[hash(key) % palette.length];\n}\n\n/** `#rgb` / `#rrggbb` → [r, g, b] 0-255, or null for anything else (named colours, var()). */\nexport function parseHex(color: string): [number, number, number] | null {\n const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());\n if (!m) return null;\n const h = m[1].length === 3 ? m[1].replace(/./g, (c) => c + c) : m[1];\n return [0, 2, 4].map((i) => parseInt(h.slice(i, i + 2), 16)) as [number, number, number];\n}\n\nfunction luminance([r, g, b]: [number, number, number]): number {\n const lin = (c: number): number => {\n const s = c / 255;\n return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;\n };\n return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);\n}\n\n/** WCAG contrast ratio between two hex colours, or null if either cannot be parsed. */\nexport function contrastRatio(a: string, b: string): number | null {\n const pa = parseHex(a);\n const pb = parseHex(b);\n if (!pa || !pb) return null;\n const [hi, lo] = [luminance(pa), luminance(pb)].sort((x, y) => y - x);\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/**\n * Black or white text, whichever reads better on `background`. Unparseable backgrounds\n * (a CSS variable, a named colour) get `undefined`, i.e. the theme's own event text colour.\n */\nexport function readableTextOn(background: string): '#000000' | '#ffffff' | undefined {\n const onWhite = contrastRatio(background, '#ffffff');\n const onBlack = contrastRatio(background, '#000000');\n if (onWhite === null || onBlack === null) return undefined;\n return onWhite >= onBlack ? '#ffffff' : '#000000';\n}\n","import { readableTextOn } from '../core/colors';\nimport { addDays, fromWall, kindOf, normaliseFloating, toInstant, toWall, utcFieldsToWall } from '../core/datetime';\nimport type {\n CalendarEvent,\n CalendarEventChange,\n CalendarValue,\n SlotSelection,\n ValueKind,\n VisibleRange,\n ZoneOffset,\n} from '../core/types';\n\n/**\n * The translation between the kit's contract and FullCalendar's. Pure (types only from here),\n * so every rule is unit-testable without rendering a calendar.\n *\n * ★★★ THE ZONE STRATEGY. FullCalendar is always run with `timeZone: 'UTC'` and fed WALL-CLOCK\n * values already shifted into the calendar's zone. Its `Date`s then carry the wall clock in\n * their UTC fields, and we shift back on the way out.\n *\n * Why not give FullCalendar the zone? Because a PCF host does not expose one. It exposes\n * `getTimeZoneOffsetMinutes(date)` — an offset per instant, no IANA name — and MEASURED on an\n * org, a user set to Tokyo in a Pacific browser saw an event FullCalendar placed on Monday 9:00\n * that the grid beside it said was Tuesday 1:00. The browser's zone is simply the wrong zone.\n * Shifting per instant with that function is also daylight-saving correct, which a fixed\n * `'+09:00'`-style offset would not be.\n */\n\nexport interface FcEventInput {\n id: string;\n title: string;\n start: string;\n end?: string;\n allDay: boolean;\n color?: string;\n textColor?: string;\n editable?: boolean;\n durationEditable?: boolean;\n /**\n * `kind` is how FullCalendar holds the values (`date` when shown all-day); `originalKind` is\n * what the host SENT, and what a change is converted back into — the \"an event keeps its kind\"\n * contract. They differ only for an instant/floating start forced all-day with `allDay: true`.\n */\n extendedProps: { source: CalendarEvent; kind: ValueKind; originalKind: ValueKind };\n}\n\nfunction toFcValue(value: CalendarValue | Date, zone: ZoneOffset): string {\n const k = kindOf(value);\n if (k === 'instant') return toWall(value, zone);\n if (k === 'floating') return normaliseFloating(value as string);\n return value as string;\n}\n\n/** The exclusive all-day end for any end value: a timed end that is not midnight rounds UP a day. */\nfunction exclusiveAllDayEnd(end: CalendarValue | Date, zone: ZoneOffset): string {\n const wall = toFcValue(end, zone);\n if (wall.length === 10) return wall;\n return wall.slice(11, 19) === '00:00:00' ? wall.slice(0, 10) : addDays(wall.slice(0, 10), 1);\n}\n\nexport function toFcEvent(event: CalendarEvent, zone: ZoneOffset): FcEventInput {\n const originalKind = kindOf(event.start);\n const allDay = event.allDay ?? originalKind === 'date';\n const start = allDay ? toFcValue(event.start, zone).slice(0, 10) : toFcValue(event.start, zone);\n const out: FcEventInput = {\n id: event.id,\n title: event.title,\n start,\n allDay,\n extendedProps: { source: event, kind: allDay ? 'date' : originalKind, originalKind },\n };\n // ★★ Optional keys are OMITTED, never set to `undefined`. FullCalendar treats a PRESENT key as a\n // value: `editable: undefined` resolves to `startEditable === false` (read back through\n // FullCalendar's API — see fullcalendar-contract.test.tsx), which locked EVERY event in an\n // editable calendar. Same family as the `slotMinTime={undefined}` crash in CalendarView.\n if (event.end !== undefined) out.end = allDay ? exclusiveAllDayEnd(event.end, zone) : toFcValue(event.end, zone);\n if (event.color) {\n out.color = event.color;\n const text = readableTextOn(event.color);\n if (text) out.textColor = text;\n }\n if (event.readOnly) out.editable = false;\n // ★ An event with no END is not resizable: a resize would invent an end the host has nowhere\n // to store (a map with no end column), and the calendar would keep showing a length that\n // was never saved. Moving it is still fine.\n else if (event.end === undefined) out.durationEditable = false;\n return out;\n}\n\n/** A FullCalendar `Date` (UTC fields = wall clock) → a value of `kind`. */\nexport function fromFcDate(d: Date, kind: ValueKind, zone: ZoneOffset): CalendarValue {\n const wall = utcFieldsToWall(d);\n if (kind === 'date') return wall.slice(0, 10);\n if (kind === 'floating') return wall;\n return fromWall(wall, zone);\n}\n\nexport interface FcChangedEventLike {\n start: Date | null;\n end: Date | null;\n allDay: boolean;\n extendedProps: Record<string, unknown>;\n}\n\n/** A calendar value of `kind` → the same moment in `target` kind (all-day midnight for dates). */\nfunction asKind(value: CalendarValue, from: ValueKind, target: ValueKind, zone: ZoneOffset): CalendarValue {\n if (from === target || from !== 'date') return value;\n return target === 'instant' ? fromWall(`${value}T00:00:00`, zone) : `${value}T00:00:00`;\n}\n\n/** The host's original value, canonicalised, for fields a change did not touch. */\nfunction canonical(value: CalendarValue | Date): CalendarValue {\n const k = kindOf(value);\n return k === 'instant' ? toInstant(value) : k === 'floating' ? normaliseFloating(value as string) : (value as string);\n}\n\n/** A dropped/resized FullCalendar event → a change in the ORIGINAL event's kind. */\nexport function toChange(\n fcEvent: FcChangedEventLike,\n kind: CalendarEventChange['kind'],\n zone: ZoneOffset\n): CalendarEventChange {\n const { source, kind: valueKind, originalKind } = fcEvent.extendedProps as FcEventInput['extendedProps'];\n if (!fcEvent.start) throw new Error(`FullCalendar returned no start for event ${source.id}`);\n const back = (d: Date): CalendarValue => asKind(fromFcDate(d, valueKind, zone), valueKind, originalKind ?? valueKind, zone);\n return {\n event: source,\n kind,\n // ★ A RESIZE never moves the start. Recomputing it from FullCalendar's wall-clock Date is\n // lossy on the fall-back day (the second 01:30 reads back as the first), and toWebApiPatch\n // writes `start` unconditionally — so resizing an end silently moved the start an hour.\n start: kind === 'resize' ? canonical(source.start) : back(fcEvent.start),\n end: fcEvent.end ? back(fcEvent.end) : undefined,\n allDay: fcEvent.allDay,\n };\n}\n\nexport function toSelection(start: Date, end: Date, allDay: boolean, zone: ZoneOffset): SlotSelection {\n const kind: ValueKind = allDay ? 'date' : 'instant';\n return { start: fromFcDate(start, kind, zone), end: fromFcDate(end, kind, zone), allDay };\n}\n\nexport function toVisibleRange(start: Date, end: Date, view: string, zone: ZoneOffset): VisibleRange {\n return {\n start: fromFcDate(start, 'instant', zone),\n end: fromFcDate(end, 'instant', zone),\n view,\n startDate: utcFieldsToWall(start).slice(0, 10),\n endDate: utcFieldsToWall(end).slice(0, 10),\n };\n}\n\n/** \"Now\" in the calendar's zone, for FullCalendar's `now` option (drives today + now-line). */\nexport const nowWall = (zone: ZoneOffset): string => toWall(new Date(), zone);\n\n/**\n * ★ A drag may not change an event's KIND. Dropping a timed appointment on the all-day row\n * would have to invent a date-only value for a date-time column (or the reverse), and there\n * is no right answer to invent. FullCalendar allows it by default; this forbids it.\n */\nexport const sameAllDayness = (spanAllDay: boolean, eventAllDay: boolean): boolean => spanAllDay === eventAllDay;\n\n/* ── Optimistic overrides ────────────────────────────────────────────────────────────────────\n * FullCalendar moves an event the moment it is dropped. The host's `events` prop still has the\n * OLD position until its save resolves AND it re-renders with fresh data — and a PCF host\n * re-renders on anything (resize, focus), so without this the event would snap back mid-save\n * and jump forward again later. An override holds the new position until the props agree.\n */\nexport interface PendingMove {\n start: CalendarValue;\n end: CalendarValue | undefined;\n allDay: boolean;\n /** Increments per change; only the newest change for an event may settle or revert it. */\n token: number;\n /**\n * Set when the save RESOLVED: the `events` prop at that moment. The move is dropped on the\n * first `events` that is a different array — whether or not it matches. Without this a save\n * whose value never comes back verbatim (no end column mapped, a plugin adjusting the time)\n * kept its override forever, showing a position that was never stored.\n */\n savedWith?: readonly CalendarEvent[];\n}\n\nconst same = (a: CalendarValue | Date | undefined, b: CalendarValue | undefined): boolean => {\n if (a === undefined || b === undefined) return a === b;\n const ka = kindOf(a);\n if (ka !== kindOf(b)) return false;\n if (ka === 'instant') return new Date(a).getTime() === new Date(b).getTime();\n return ka === 'floating' ? normaliseFloating(a as string) === normaliseFloating(b) : a === b;\n};\n\n/** Events with pending moves applied. */\nexport function applyPending(events: readonly CalendarEvent[], pending: ReadonlyMap<string, PendingMove>): CalendarEvent[] {\n if (pending.size === 0) return events as CalendarEvent[];\n return events.map((e) => {\n const p = pending.get(e.id);\n return p ? { ...e, start: p.start, end: p.end, allDay: p.allDay } : e;\n });\n}\n\n/**\n * Ids whose pending move can be dropped: the props now agree, the event vanished (deleted\n * elsewhere — no ghost), or the save resolved and the host has since re-rendered.\n */\nexport function settledIds(events: readonly CalendarEvent[], pending: ReadonlyMap<string, PendingMove>): string[] {\n const byId = new Map(events.map((e) => [e.id, e]));\n const done: string[] = [];\n for (const [id, p] of pending) {\n const e = byId.get(id);\n if (!e || (same(e.start, p.start) && same(e.end, p.end)) || (p.savedWith !== undefined && p.savedWith !== events)) done.push(id);\n }\n return done;\n}\n","import * as React from 'react';\nimport type { CalendarEvent, CalendarEventChange, ZoneOffset } from '../core/types';\nimport { settledIds, toChange, type FcChangedEventLike, type PendingMove } from './fcBridge';\n\n/** The part of FullCalendar's EventChangeInfo this hook uses — small enough to fake in a test. */\nexport interface ChangeInfoLike {\n event: FcChangedEventLike;\n revert(): void;\n}\n\nexport type ChangeHandler = (change: CalendarEventChange) => void | Promise<void>;\n\nfunction describe(error: unknown): string {\n const m = (error as { message?: unknown } | null)?.message;\n return typeof m === 'string' && m ? m : String(error);\n}\n\n/**\n * The optimistic-save state machine behind drag and resize, separated from the calendar so\n * every transition is testable without driving a real drag (which synthetic input could not do\n * against FullCalendar v7 — see CLAUDE.md).\n *\n * drop ──▶ pending(token) ──resolve──▶ saved (held until the host's next `events`)\n * └─reject/throw─▶ revert + banner (only if still the NEWEST change)\n */\nexport function useOptimisticChanges(\n events: readonly CalendarEvent[],\n onEventChange: ChangeHandler | undefined,\n onChangeError: ((error: unknown, change: CalendarEventChange) => void) | undefined,\n zoneRef: React.MutableRefObject<ZoneOffset>\n): {\n pending: ReadonlyMap<string, PendingMove>;\n error: string | null;\n dismissError: () => void;\n handleChange: (kind: CalendarEventChange['kind']) => (info: ChangeInfoLike) => void;\n} {\n const [pending, setPending] = React.useState<ReadonlyMap<string, PendingMove>>(() => new Map());\n const [error, setError] = React.useState<string | null>(null);\n const eventsRef = React.useRef(events);\n eventsRef.current = events;\n // ★ The newest token per event, held in a REF so a settling promise can ask \"am I still the\n // current change?\" synchronously. Asking inside a setState updater would be a side effect in\n // an updater, which React may run twice or late.\n const latest = React.useRef(new Map<string, number>());\n const seq = React.useRef(0);\n const mounted = React.useRef(true);\n React.useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n React.useEffect(() => {\n const done = settledIds(events, pending);\n if (done.length === 0) return;\n for (const id of done) if (latest.current.get(id) === pending.get(id)?.token) latest.current.delete(id);\n setPending((prev) => {\n const next = new Map(prev);\n for (const id of done) next.delete(id);\n return next;\n });\n }, [events, pending]);\n\n const handleChange = React.useCallback(\n (kind: CalendarEventChange['kind']) =>\n (info: ChangeInfoLike): void => {\n if (!onEventChange) {\n info.revert();\n return;\n }\n let change: CalendarEventChange;\n try {\n change = toChange(info.event, kind, zoneRef.current);\n } catch (e) {\n info.revert();\n setError(describe(e));\n return;\n }\n setError(null);\n const id = change.event.id;\n const token = ++seq.current;\n\n const fail = (err: unknown): void => {\n const current = latest.current.get(id) === token;\n if (current) latest.current.delete(id);\n // ★ onChangeError BEFORE revert, so a revert that throws (calendar already destroyed)\n // cannot swallow the host's error callback.\n onChangeError?.(err, change);\n if (!mounted.current) return;\n setError(`Could not save \"${change.event.title}\": ${describe(err)}`);\n if (!current) return; // a newer move of this event owns its position now\n setPending((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Map(prev);\n next.delete(id);\n return next;\n });\n try {\n info.revert();\n } catch {\n /* the calendar was torn down under us; nothing left to put back */\n }\n };\n\n // ★ Registered BEFORE the handler runs: a synchronous throw calls `fail`, which asks \"am I\n // the current change?\" — registering after the call answered \"no\" and skipped the\n // revert (caught by the sync-throw test).\n latest.current.set(id, token);\n let result: void | Promise<void>;\n try {\n result = onEventChange(change);\n } catch (err) {\n // A handler that throws synchronously is a failed save, not an unhandled error that\n // leaves the event where it was dropped.\n fail(err);\n return;\n }\n if (!result || typeof (result as Promise<void>).then !== 'function') {\n // Fire-and-forget handler: nothing to hold; the host owns the position from here.\n if (latest.current.get(id) === token) latest.current.delete(id);\n return;\n }\n\n setPending((prev) => new Map(prev).set(id, { start: change.start, end: change.end, allDay: change.allDay, token }));\n (result as Promise<void>).then(\n () => {\n if (!mounted.current || latest.current.get(id) !== token) return;\n const savedWith = eventsRef.current;\n setPending((prev) => {\n const p = prev.get(id);\n if (!p || p.token !== token) return prev;\n return new Map(prev).set(id, { ...p, savedWith });\n });\n },\n fail\n );\n },\n [onEventChange, onChangeError, zoneRef]\n );\n\n return { pending, error, dismissError: React.useCallback(() => setError(null), []), handleChange };\n}\n","import type * as React from 'react';\n\n/**\n * The colours a calendar can be themed with, as plain CSS values (hex, rgb(), or `var(--x)`).\n * Each maps onto one of FullCalendar v7's classic-theme custom properties, so theming is just\n * setting variables on the calendar's own container — no stylesheet override, nothing global.\n *\n * ★ Scoped to the container on purpose: FullCalendar's palette declares its defaults on `:root`,\n * and a PCF control shares `:root` with the whole form. Two calendars on one form each set\n * their own, and neither touches the host.\n */\nexport interface CalendarTheme {\n primary?: string;\n primaryForeground?: string;\n background?: string;\n foreground?: string;\n mutedForeground?: string;\n faint?: string;\n muted?: string;\n strong?: string;\n border?: string;\n strongBorder?: string;\n today?: string;\n highlight?: string;\n now?: string;\n button?: string;\n buttonForeground?: string;\n buttonBorder?: string;\n buttonStrong?: string;\n buttonStrongBorder?: string;\n fontFamily?: string;\n fontSize?: string;\n /** Rendered as a banner above the calendar when a save fails. */\n error?: string;\n}\n\nconst VAR: Record<Exclude<keyof CalendarTheme, 'fontFamily' | 'fontSize' | 'error'>, string> = {\n primary: '--fc-classic-primary',\n primaryForeground: '--fc-classic-primary-foreground',\n background: '--fc-classic-background',\n foreground: '--fc-classic-foreground',\n mutedForeground: '--fc-classic-muted-foreground',\n faint: '--fc-classic-faint',\n muted: '--fc-classic-muted',\n strong: '--fc-classic-strong',\n border: '--fc-classic-border',\n strongBorder: '--fc-classic-strong-border',\n today: '--fc-classic-today',\n highlight: '--fc-classic-highlight',\n now: '--fc-classic-now',\n button: '--fc-classic-button',\n buttonForeground: '--fc-classic-button-foreground',\n buttonBorder: '--fc-classic-button-border',\n buttonStrong: '--fc-classic-button-strong',\n buttonStrongBorder: '--fc-classic-button-strong-border',\n};\n\n/** The container style that applies `theme`. Unset keys keep FullCalendar's defaults. */\nexport function themeStyle(theme: CalendarTheme | undefined): React.CSSProperties {\n const style: Record<string, string> = {};\n if (!theme) return style;\n for (const [key, cssVar] of Object.entries(VAR)) {\n const v = theme[key as keyof typeof VAR];\n if (v) style[cssVar] = v;\n }\n if (theme.fontFamily) style.fontFamily = theme.fontFamily;\n if (theme.fontSize) style.fontSize = theme.fontSize;\n if (theme.background) style.background = theme.background;\n if (theme.foreground) style.color = theme.foreground;\n return style as React.CSSProperties;\n}\n","import * as React from 'react';\nimport type { CalendarDataSource, CalendarEvent, CalendarEventChange, SlotSelection, VisibleRange } from '../core/types';\n\nexport interface CalendarSourceBinding {\n events: readonly CalendarEvent[];\n loading: boolean;\n /** The last load failure, or null. A failed load keeps the previous events on screen. */\n error: string | null;\n /** Re-run the current range (e.g. after booking a slot elsewhere on the page). */\n reload: () => void;\n /** Spread onto `<CalendarView>` / `<FluentCalendar>`. */\n props: {\n events: readonly CalendarEvent[];\n loading: boolean;\n editable: boolean;\n selectable: boolean;\n onRangeChange: (range: VisibleRange) => void;\n onEventChange?: (change: CalendarEventChange) => Promise<void>;\n onEventClick?: (event: CalendarEvent) => void;\n onSelectRange?: (slot: SlotSelection) => void;\n };\n}\n\nfunction describe(error: unknown): string {\n const m = (error as { message?: unknown } | null)?.message;\n return typeof m === 'string' && m ? m : String(error);\n}\n\nconst isAbort = (e: unknown): boolean => (e as { name?: unknown } | null)?.name === 'AbortError';\n\n/**\n * Drive a calendar from a PULLED `CalendarDataSource` (code app, Power Pages): load on every range\n * change, save a drag through the source, then reload so the calendar shows what the server kept.\n *\n * ★ Only the NEWEST load may land. Ranges change faster than networks answer (click \"next\" three\n * times), so an older response arriving last must not overwrite the newer week. Each load aborts\n * its predecessor AND is sequence-checked — a source that ignores `signal` is still safe.\n * ★ A save that rejects is RE-THROWN, so the calendar's optimistic layer reverts the event and shows\n * the message; swallowing it here would leave the event where it was dropped, unsaved.\n */\nexport function useCalendarSource(source: CalendarDataSource | null | undefined): CalendarSourceBinding {\n const [events, setEvents] = React.useState<readonly CalendarEvent[]>([]);\n const [loading, setLoading] = React.useState(false);\n const [error, setError] = React.useState<string | null>(null);\n const range = React.useRef<VisibleRange | null>(null);\n const seq = React.useRef(0);\n const inflight = React.useRef<AbortController | null>(null);\n\n const load = React.useCallback(async (): Promise<void> => {\n const r = range.current;\n if (!source || !r) return;\n inflight.current?.abort();\n const controller = new AbortController();\n inflight.current = controller;\n const mine = ++seq.current;\n setLoading(true);\n try {\n const next = await source.load(r, controller.signal);\n if (mine !== seq.current) return;\n setEvents(next);\n setError(null);\n } catch (e) {\n if (mine !== seq.current || isAbort(e)) return;\n setError(describe(e));\n } finally {\n if (mine === seq.current) setLoading(false);\n }\n }, [source]);\n\n // A new source (different filter, different table) re-queries the range already on screen.\n React.useEffect(() => {\n setEvents([]);\n void load();\n }, [load]);\n\n React.useEffect(\n () => () => {\n seq.current++;\n inflight.current?.abort();\n },\n []\n );\n\n const onRangeChange = React.useCallback(\n (r: VisibleRange) => {\n const prev = range.current;\n range.current = r;\n if (prev && prev.start === r.start && prev.end === r.end) return;\n void load();\n },\n [load]\n );\n\n const reload = React.useCallback(() => void load(), [load]);\n\n const onEventChange = React.useMemo(\n () =>\n source?.capabilities.update && source.update\n ? async (change: CalendarEventChange): Promise<void> => {\n await source.update!(change);\n await load();\n }\n : undefined,\n [source, load]\n );\n\n const open = React.useMemo(\n () => (source?.capabilities.open && source.open ? (e: CalendarEvent) => source.open!(e) : undefined),\n [source]\n );\n const onSelectRange = React.useMemo(\n () =>\n source?.capabilities.create && source.create\n ? (slot: SlotSelection) => {\n void Promise.resolve()\n .then(() => source.create!(slot))\n .then(\n () => load(),\n (e: unknown) => setError(describe(e))\n );\n }\n : undefined,\n [source, load]\n );\n\n return {\n events,\n loading,\n error,\n reload,\n props: {\n events,\n loading,\n editable: !!onEventChange,\n selectable: !!onSelectRange,\n onRangeChange,\n ...(onEventChange ? { onEventChange } : {}),\n ...(open ? { onEventClick: open } : {}),\n ...(onSelectRange ? { onSelectRange } : {}),\n },\n };\n}\n"],"mappings":";AAAA,YAAYA,YAAW;AACvB,OAAO,kBAAkB;AACzB,OAAO,mBAAmB;AAC1B,OAAO,oBAAoB;AAC3B,OAAO,gBAAgB;AACvB,OAAO,uBAAuB;AAC9B,OAAO,wBAAwB;AAQ/B,OAAO;AACP,OAAO;AACP,OAAO;;;ACLP,IAAM,UAAU;AAChB,IAAM,cAAc;AACpB,IAAM,aAAa;AAEnB,IAAM,MAAM,CAAC,GAAW,IAAI,MAAc,OAAO,CAAC,EAAE,SAAS,GAAG,GAAG;AAG5D,IAAM,cAA0B,CAAC,YAAY,CAAC,QAAQ,kBAAkB;AAGxE,IAAM,YACX,CAAC,gBACD,MACE;AAEG,SAAS,OAAO,OAAwC;AAC7D,MAAI,iBAAiB,MAAM;AACzB,QAAI,OAAO,MAAM,MAAM,QAAQ,CAAC,EAAG,OAAM,IAAI,WAAW,cAAc;AACtE,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,QAAQ,KAAK,KAAK,IAAI,SAAS,YAAY,KAAK,KAAK,IAAI,aAAa;AACpF,MAAI,OAAO;AAGT,UAAM,IAAK,YAAY,KAAK,KAAK,KAAK,QAAQ,KAAK,KAAK;AACxD,UAAM,CAAC,EAAE,GAAG,IAAI,GAAG,IAAI,KAAK,KAAK,KAAK,MAAM,GAAG,IAAI;AACnD,UAAM,IAAI,IAAI,KAAK,KAAK,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3D,QAAI,EAAE,eAAe,MAAM,CAAC,KAAK,EAAE,YAAY,MAAM,CAAC,KAAK,KAAK,EAAE,WAAW,MAAM,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,MAAM,CAAC,MAAM,I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I,CAAC;AAAA,IAC3C;AAAA,EACF;AACF;","names":["React","t","React","describe"]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { c as CalendarValue, Z as ZoneOffset, C as CalendarEvent, S as SlotSelection, b as CalendarEventChange } from './types-Bxkg9NIR.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dataverse's three DateTime behaviours, and the FOUR different shapes one value takes on its
|
|
5
|
+
* way through a model-driven app. Every rule below was MEASURED on a live org (2026-09-26,
|
|
6
|
+
* `spikes/calendar-view-fc7/FINDINGS.md` in the parent workspace); none is from documentation.
|
|
7
|
+
*
|
|
8
|
+
* ★★★ The two write paths are DIFFERENT CONTRACTS. The same text means different things to
|
|
9
|
+
* `webAPI.updateRecord` and to `navigation.openForm` parameters:
|
|
10
|
+
*
|
|
11
|
+
* | behaviour | read (dataset getValue) | Web API write | form parameter (quick create) |
|
|
12
|
+
* |------------|-----------------------------|------------------------|-------------------------------|
|
|
13
|
+
* | UserLocal | `…T06:30:00.000Z` instant | instant `…Z` | wall clock, NO `Z` |
|
|
14
|
+
* | DateOnly | `…T00:00:00.000Z` UTC-midn. | `YYYY-MM-DD` | `YYYY-MM-DDT00:00:00`, NO `Z` |
|
|
15
|
+
* | TZI | `…T23:30:00.000Z` face+`Z` | wall clock WITH `Z` | wall clock, NO `Z` |
|
|
16
|
+
*
|
|
17
|
+
* Measured failures of the obvious choice, each of which a unit test here pins:
|
|
18
|
+
* - a DateOnly read through `new Date()` lands on the PREVIOUS day anywhere west of UTC;
|
|
19
|
+
* - a bare `YYYY-MM-DD` form parameter was stored as the previous day (Pacific user);
|
|
20
|
+
* - a TZI form parameter WITH `Z` was treated as UTC and shifted −7 h.
|
|
21
|
+
* The first two are why a well-known client control had a "+1 day" hack in its click handler.
|
|
22
|
+
*/
|
|
23
|
+
declare const DateTimeBehavior: {
|
|
24
|
+
readonly UserLocal: 1;
|
|
25
|
+
readonly DateOnly: 2;
|
|
26
|
+
readonly TimeZoneIndependent: 3;
|
|
27
|
+
};
|
|
28
|
+
type DateTimeBehavior = (typeof DateTimeBehavior)[keyof typeof DateTimeBehavior];
|
|
29
|
+
/**
|
|
30
|
+
* The behaviour of a column, from whatever metadata shape the host produced.
|
|
31
|
+
*
|
|
32
|
+
* ★ `getEntityMetadata` in a PCF host answers `Behavior: 1|2|3` (MEASURED). The Web API's
|
|
33
|
+
* `EntityDefinitions` answers `DateTimeBehavior: { Value: 'UserLocal' }`. Both are accepted.
|
|
34
|
+
* ★ A DateOnly column is also recognisable from its PCF `dataType` alone
|
|
35
|
+
* (`DateAndTime.DateOnly`). TZI and UserLocal are NOT — both report `DateAndTime.DateAndTime` —
|
|
36
|
+
* so without metadata a TZI column is indistinguishable and is treated as UserLocal. Callers
|
|
37
|
+
* that can see that ambiguity should surface it (see `adapters/pcf-dataset`).
|
|
38
|
+
*/
|
|
39
|
+
declare function behaviorOf(meta: unknown, dataType?: string): DateTimeBehavior;
|
|
40
|
+
/**
|
|
41
|
+
* A raw column value (dataset `getValue()`, or a Web API property) → a calendar value.
|
|
42
|
+
*
|
|
43
|
+
* ★★★ `getValue()` returns an ISO STRING for all three behaviours, despite
|
|
44
|
+
* `@types/powerapps-component-framework` declaring `Date`. A `Date` is still accepted, because a
|
|
45
|
+
* test double or another host may produce one — and it is read through its UTC fields, which is
|
|
46
|
+
* what the platform's strings encode.
|
|
47
|
+
*/
|
|
48
|
+
declare function readDataverseDate(raw: unknown, behavior: DateTimeBehavior): CalendarValue | null;
|
|
49
|
+
/**
|
|
50
|
+
* A calendar value → the text `webAPI.updateRecord` / `createRecord` wants for this behaviour.
|
|
51
|
+
* `zone` is needed only to turn a value of a different kind into this one (e.g. an all-day drop
|
|
52
|
+
* onto a UserLocal column); same-kind values pass straight through.
|
|
53
|
+
*/
|
|
54
|
+
declare function toWebApiDate(value: CalendarValue, behavior: DateTimeBehavior, zone: ZoneOffset): string;
|
|
55
|
+
/**
|
|
56
|
+
* A calendar value → the text a `navigation.openForm` form PARAMETER wants (quick create
|
|
57
|
+
* prefill). Wall clock in the user's zone, never with `Z`.
|
|
58
|
+
*
|
|
59
|
+
* ★ UNMEASURED: whether "wall clock" here means the Dynamics USER's zone or the BROWSER's when
|
|
60
|
+
* they differ. Measured only with both in Pacific. Pass the user zone; if the org proof shows
|
|
61
|
+
* the browser's is used, this is the one function to change.
|
|
62
|
+
*/
|
|
63
|
+
declare function toFormParameterDate(value: CalendarValue, behavior: DateTimeBehavior, zone: ZoneOffset): string;
|
|
64
|
+
/** Dataverse stores an all-day END inclusive; the calendar's is exclusive. */
|
|
65
|
+
declare const inclusiveEndToExclusive: (lastDay: CalendarValue) => CalendarValue;
|
|
66
|
+
declare const exclusiveEndToInclusive: (dayAfter: CalendarValue) => CalendarValue;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Which columns hold what. Logical names. Only `start` is required — that is the whole
|
|
70
|
+
* genericity story: the same calendar shows Appointments for one client and Orders for another,
|
|
71
|
+
* because a maker names the columns rather than a developer.
|
|
72
|
+
*/
|
|
73
|
+
interface ColumnMap {
|
|
74
|
+
start: string;
|
|
75
|
+
end?: string;
|
|
76
|
+
title?: string;
|
|
77
|
+
/** A hex colour column, or a choice column whose option colours `colorOf` resolves. */
|
|
78
|
+
color?: string;
|
|
79
|
+
/** Location / staff / queue. Drives `resourceId` and, failing `color`, a group colour. */
|
|
80
|
+
group?: string;
|
|
81
|
+
/** A Yes/No column that forces all-day. */
|
|
82
|
+
allDay?: string;
|
|
83
|
+
}
|
|
84
|
+
/** The minimum a record source must answer — a dataset record, a Web API row, a fixture. */
|
|
85
|
+
interface RecordAccessor {
|
|
86
|
+
id: string;
|
|
87
|
+
value(column: string): unknown;
|
|
88
|
+
formatted(column: string): string;
|
|
89
|
+
}
|
|
90
|
+
interface MapOptions {
|
|
91
|
+
/** Behaviour per DATE column (logical name). Missing ⇒ UserLocal. */
|
|
92
|
+
behaviors: Readonly<Record<string, DateTimeBehavior>>;
|
|
93
|
+
zone: ZoneOffset;
|
|
94
|
+
/** Resolve a colour column's value (e.g. choice option colours). Return undefined to fall back. */
|
|
95
|
+
colorOf?: (column: string, raw: unknown, formatted: string) => string | undefined;
|
|
96
|
+
/** Per-record read-only, e.g. a status that forbids rescheduling. */
|
|
97
|
+
isReadOnly?: (record: RecordAccessor) => boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* ★★ A Yes/No column's raw value in a PCF dataset is the STRING `"0"` / `"1"` — and
|
|
101
|
+
* `Boolean("0")` is `true`. MEASURED on a sibling gallery control, where every `false` row
|
|
102
|
+
* rendered ON. Read the digits, never truthiness.
|
|
103
|
+
*/
|
|
104
|
+
declare function readYesNo(raw: unknown): boolean;
|
|
105
|
+
/** One record → one event, or null when it has no usable start. */
|
|
106
|
+
declare function mapRecordToEvent(record: RecordAccessor, map: ColumnMap, opts: MapOptions): CalendarEvent | null;
|
|
107
|
+
/**
|
|
108
|
+
* A move/resize → the column values to PATCH through the Web API.
|
|
109
|
+
* Columns the map does not name are never written.
|
|
110
|
+
*/
|
|
111
|
+
declare function toWebApiPatch(change: CalendarEventChange, map: ColumnMap, opts: Pick<MapOptions, 'behaviors' | 'zone'>): Record<string, string>;
|
|
112
|
+
/**
|
|
113
|
+
* A selected empty range → quick-create form parameters. `extra` is merged underneath, so a
|
|
114
|
+
* host can prefill a lookup (the parent record) without it being overwritten by dates.
|
|
115
|
+
*
|
|
116
|
+
* ★ The all-day column is set to boolean `true` for an all-day selection. The accepted shape of
|
|
117
|
+
* a Yes/No FORM PARAMETER is UNMEASURED; the date shapes are measured.
|
|
118
|
+
*/
|
|
119
|
+
declare function toQuickCreateParameters(selection: SlotSelection, map: ColumnMap, opts: Pick<MapOptions, 'behaviors' | 'zone'>, extra?: Record<string, unknown>): Record<string, unknown>;
|
|
120
|
+
|
|
121
|
+
export { type ColumnMap as C, DateTimeBehavior as D, type MapOptions as M, type RecordAccessor as R, readYesNo as a, behaviorOf as b, toQuickCreateParameters as c, toWebApiDate as d, exclusiveEndToInclusive as e, toWebApiPatch as f, inclusiveEndToExclusive as i, mapRecordToEvent as m, readDataverseDate as r, toFormParameterDate as t };
|