@neo-reckoning/react 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/useCalendar.d.ts +37 -0
- package/dist/useCalendar.d.ts.map +1 -0
- package/dist/useCalendar.js +48 -0
- package/dist/useCalendar.js.map +1 -0
- package/dist/useCalendarEvents.d.ts +19 -0
- package/dist/useCalendarEvents.d.ts.map +1 -0
- package/dist/useCalendarEvents.js +23 -0
- package/dist/useCalendarEvents.js.map +1 -0
- package/dist/useConflicts.d.ts +17 -0
- package/dist/useConflicts.d.ts.map +1 -0
- package/dist/useConflicts.js +13 -0
- package/dist/useConflicts.js.map +1 -0
- package/dist/useDayDetail.d.ts +13 -0
- package/dist/useDayDetail.d.ts.map +1 -0
- package/dist/useDayDetail.js +51 -0
- package/dist/useDayDetail.js.map +1 -0
- package/dist/useFreeSlots.d.ts +14 -0
- package/dist/useFreeSlots.d.ts.map +1 -0
- package/dist/useFreeSlots.js +18 -0
- package/dist/useFreeSlots.js.map +1 -0
- package/dist/useRangeCheck.d.ts +12 -0
- package/dist/useRangeCheck.d.ts.map +1 -0
- package/dist/useRangeCheck.js +20 -0
- package/dist/useRangeCheck.js.map +1 -0
- package/dist/useScheduleScore.d.ts +16 -0
- package/dist/useScheduleScore.d.ts.map +1 -0
- package/dist/useScheduleScore.js +17 -0
- package/dist/useScheduleScore.js.map +1 -0
- package/dist/useSpans.d.ts +17 -0
- package/dist/useSpans.d.ts.map +1 -0
- package/dist/useSpans.js +13 -0
- package/dist/useSpans.js.map +1 -0
- package/dist/useTimeline.d.ts +22 -0
- package/dist/useTimeline.d.ts.map +1 -0
- package/dist/useTimeline.js +20 -0
- package/dist/useTimeline.js.map +1 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useCalendar } from './useCalendar.js';
|
|
2
|
+
export { useRangeCheck } from './useRangeCheck.js';
|
|
3
|
+
export { useCalendarEvents } from './useCalendarEvents.js';
|
|
4
|
+
export { useDayDetail } from './useDayDetail.js';
|
|
5
|
+
export { useTimeline } from './useTimeline.js';
|
|
6
|
+
export { useSpans } from './useSpans.js';
|
|
7
|
+
export { useConflicts } from './useConflicts.js';
|
|
8
|
+
export { useFreeSlots } from './useFreeSlots.js';
|
|
9
|
+
export { useScheduleScore } from './useScheduleScore.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { useCalendar } from './useCalendar.js';
|
|
2
|
+
export { useRangeCheck } from './useRangeCheck.js';
|
|
3
|
+
export { useCalendarEvents } from './useCalendarEvents.js';
|
|
4
|
+
export { useDayDetail } from './useDayDetail.js';
|
|
5
|
+
export { useTimeline } from './useTimeline.js';
|
|
6
|
+
export { useSpans } from './useSpans.js';
|
|
7
|
+
export { useConflicts } from './useConflicts.js';
|
|
8
|
+
export { useFreeSlots } from './useFreeSlots.js';
|
|
9
|
+
export { useScheduleScore } from './useScheduleScore.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DateRange, Month, ViewFidelity } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseCalendarConfig {
|
|
3
|
+
/** Initial focus date (YYYY-MM-DD) */
|
|
4
|
+
focusDate: string;
|
|
5
|
+
/** Number of months to display */
|
|
6
|
+
numberOfMonths: number;
|
|
7
|
+
/** DateRanges to evaluate */
|
|
8
|
+
ranges: DateRange[];
|
|
9
|
+
/** Week start day: 0=Sunday, 1=Monday */
|
|
10
|
+
weekStartsOn?: number;
|
|
11
|
+
/** BCP 47 locale for formatting */
|
|
12
|
+
locale?: string;
|
|
13
|
+
/** User's timezone for range evaluation */
|
|
14
|
+
userTimezone?: string;
|
|
15
|
+
/** View fidelity level — controls detail computed per day. Default: 'month' */
|
|
16
|
+
fidelity?: ViewFidelity;
|
|
17
|
+
}
|
|
18
|
+
export interface UseCalendarResult {
|
|
19
|
+
/** The generated month grid data */
|
|
20
|
+
months: Month[];
|
|
21
|
+
/** Current focus date */
|
|
22
|
+
focusDate: string;
|
|
23
|
+
/** Number of months displayed */
|
|
24
|
+
numberOfMonths: number;
|
|
25
|
+
/** Navigate forward one month */
|
|
26
|
+
next: () => void;
|
|
27
|
+
/** Navigate backward one month */
|
|
28
|
+
prev: () => void;
|
|
29
|
+
/** Jump to a specific date */
|
|
30
|
+
goTo: (date: string) => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Core calendar hook — manages grid state and navigation.
|
|
34
|
+
* Returns data structures only — no DOM rendering.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useCalendar(config: UseCalendarConfig): UseCalendarResult;
|
|
37
|
+
//# sourceMappingURL=useCalendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalendar.d.ts","sourceRoot":"","sources":["../src/useCalendar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAsB,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE9F,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,kCAAkC;IAClC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,8BAA8B;IAC9B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CA6CxE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import { CalendarGrid } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Core calendar hook — manages grid state and navigation.
|
|
5
|
+
* Returns data structures only — no DOM rendering.
|
|
6
|
+
*/
|
|
7
|
+
export function useCalendar(config) {
|
|
8
|
+
const [focusDate, setFocusDate] = useState(config.focusDate);
|
|
9
|
+
const grid = useMemo(() => {
|
|
10
|
+
return new CalendarGrid({
|
|
11
|
+
focusDate,
|
|
12
|
+
numberOfMonths: config.numberOfMonths,
|
|
13
|
+
ranges: config.ranges,
|
|
14
|
+
weekStartsOn: config.weekStartsOn,
|
|
15
|
+
locale: config.locale,
|
|
16
|
+
userTimezone: config.userTimezone,
|
|
17
|
+
fidelity: config.fidelity,
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
focusDate,
|
|
21
|
+
config.numberOfMonths,
|
|
22
|
+
config.ranges,
|
|
23
|
+
config.weekStartsOn,
|
|
24
|
+
config.locale,
|
|
25
|
+
config.userTimezone,
|
|
26
|
+
config.fidelity,
|
|
27
|
+
]);
|
|
28
|
+
const next = useCallback(() => {
|
|
29
|
+
grid.next();
|
|
30
|
+
setFocusDate(grid.getFocusDate());
|
|
31
|
+
}, [grid]);
|
|
32
|
+
const prev = useCallback(() => {
|
|
33
|
+
grid.prev();
|
|
34
|
+
setFocusDate(grid.getFocusDate());
|
|
35
|
+
}, [grid]);
|
|
36
|
+
const goTo = useCallback((date) => {
|
|
37
|
+
setFocusDate(date);
|
|
38
|
+
}, []);
|
|
39
|
+
return {
|
|
40
|
+
months: grid.months,
|
|
41
|
+
focusDate,
|
|
42
|
+
numberOfMonths: config.numberOfMonths,
|
|
43
|
+
next,
|
|
44
|
+
prev,
|
|
45
|
+
goTo,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=useCalendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalendar.js","sourceRoot":"","sources":["../src/useCalendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmCnD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAAyB;IACnD,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE7D,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,OAAO,IAAI,YAAY,CAAC;YACtB,SAAS;YACT,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;IACL,CAAC,EAAE;QACD,SAAS;QACT,MAAM,CAAC,cAAc;QACrB,MAAM,CAAC,MAAM;QACb,MAAM,CAAC,YAAY;QACnB,MAAM,CAAC,MAAM;QACb,MAAM,CAAC,YAAY;QACnB,MAAM,CAAC,QAAQ;KAChB,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IACpC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,IAAY,EAAE,EAAE;QACxC,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS;QACT,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,IAAI;QACJ,IAAI;QACJ,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DateRange, CalendarEvent } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseCalendarEventsConfig {
|
|
3
|
+
/** Native DateRanges from the API */
|
|
4
|
+
ranges: DateRange[];
|
|
5
|
+
/** Imported events from @neo-reckoning/ical, already CalendarEvent[] */
|
|
6
|
+
importedEvents: CalendarEvent[];
|
|
7
|
+
/** View window start */
|
|
8
|
+
from: Date;
|
|
9
|
+
/** View window end */
|
|
10
|
+
to: Date;
|
|
11
|
+
/** User's timezone */
|
|
12
|
+
userTimezone?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Event normalization hook — merges native ranges and imported events
|
|
16
|
+
* into a single CalendarEvent[] for the rendering pipeline.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useCalendarEvents(config: UseCalendarEventsConfig): CalendarEvent[];
|
|
19
|
+
//# sourceMappingURL=useCalendarEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalendarEvents.d.ts","sourceRoot":"","sources":["../src/useCalendarEvents.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,WAAW,uBAAuB;IACtC,qCAAqC;IACrC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,wEAAwE;IACxE,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,wBAAwB;IACxB,IAAI,EAAE,IAAI,CAAC;IACX,sBAAsB;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,sBAAsB;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,aAAa,EAAE,CAoBlF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator, expandToEvents } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Event normalization hook — merges native ranges and imported events
|
|
5
|
+
* into a single CalendarEvent[] for the rendering pipeline.
|
|
6
|
+
*/
|
|
7
|
+
export function useCalendarEvents(config) {
|
|
8
|
+
const { ranges, importedEvents, from, to, userTimezone } = config;
|
|
9
|
+
return useMemo(() => {
|
|
10
|
+
const evaluator = new RangeEvaluator(userTimezone);
|
|
11
|
+
// Expand native ranges into CalendarEvents
|
|
12
|
+
const nativeEvents = ranges.flatMap(range => {
|
|
13
|
+
const occurrences = evaluator.expand(range, from, to);
|
|
14
|
+
return expandToEvents(range, occurrences);
|
|
15
|
+
});
|
|
16
|
+
// Merge with imported events
|
|
17
|
+
const allEvents = [...nativeEvents, ...importedEvents];
|
|
18
|
+
// Sort by start time
|
|
19
|
+
allEvents.sort((a, b) => a.start.getTime() - b.start.getTime());
|
|
20
|
+
return allEvents;
|
|
21
|
+
}, [ranges, importedEvents, from, to, userTimezone]);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=useCalendarEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCalendarEvents.js","sourceRoot":"","sources":["../src/useCalendarEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgBrE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA+B;IAC/D,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAElE,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC;QAEnD,2CAA2C;QAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC1C,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACtD,OAAO,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,6BAA6B;QAC7B,MAAM,SAAS,GAAG,CAAC,GAAG,YAAY,EAAE,GAAG,cAAc,CAAC,CAAC;QAEvD,qBAAqB;QACrB,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAEhE,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DateRange, Conflict } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseConflictsConfig {
|
|
3
|
+
/** DateRanges to check for conflicts */
|
|
4
|
+
ranges: DateRange[];
|
|
5
|
+
/** Start of the window */
|
|
6
|
+
from: Date;
|
|
7
|
+
/** End of the window */
|
|
8
|
+
to: Date;
|
|
9
|
+
/** User's timezone for range evaluation */
|
|
10
|
+
userTimezone?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Conflict detection hook — returns Conflict[] for all time-level conflicts
|
|
14
|
+
* between ranges within the given date window.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useConflicts(config: UseConflictsConfig): Conflict[];
|
|
17
|
+
//# sourceMappingURL=useConflicts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConflicts.d.ts","sourceRoot":"","sources":["../src/useConflicts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,0BAA0B;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,wBAAwB;IACxB,EAAE,EAAE,IAAI,CAAC;IACT,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,QAAQ,EAAE,CAcnE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Conflict detection hook — returns Conflict[] for all time-level conflicts
|
|
5
|
+
* between ranges within the given date window.
|
|
6
|
+
*/
|
|
7
|
+
export function useConflicts(config) {
|
|
8
|
+
const { ranges, from, to, userTimezone } = config;
|
|
9
|
+
const evaluator = useMemo(() => new RangeEvaluator(userTimezone), [userTimezone]);
|
|
10
|
+
const conflicts = useMemo(() => evaluator.findConflictsInWindow(ranges, from, to), [evaluator, ranges, from, to]);
|
|
11
|
+
return conflicts;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=useConflicts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConflicts.js","sourceRoot":"","sources":["../src/useConflicts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAcrD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAElD,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,YAAY,CAAC,EACtC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EACvD,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAC9B,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DateRange, TimeSlot, DayRangeInfo } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseDayDetailResult {
|
|
3
|
+
/** Sub-day time slots for the given day */
|
|
4
|
+
timeSlots: TimeSlot[];
|
|
5
|
+
/** All-day range memberships */
|
|
6
|
+
allDayRanges: DayRangeInfo[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Day detail hook — provides time slots and all-day range info for a specific day.
|
|
10
|
+
* Used for day-view and week-view rendering.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDayDetail(date: string, ranges: DateRange[], userTimezone?: string): UseDayDetailResult;
|
|
13
|
+
//# sourceMappingURL=useDayDetail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDayDetail.d.ts","sourceRoot":"","sources":["../src/useDayDetail.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7E,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,gCAAgC;IAChC,YAAY,EAAE,YAAY,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,EAAE,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,kBAAkB,CAuCpB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Day detail hook — provides time slots and all-day range info for a specific day.
|
|
5
|
+
* Used for day-view and week-view rendering.
|
|
6
|
+
*/
|
|
7
|
+
export function useDayDetail(date, ranges, userTimezone) {
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
const evaluator = new RangeEvaluator(userTimezone);
|
|
10
|
+
const timeSlots = [];
|
|
11
|
+
const allDayRanges = [];
|
|
12
|
+
for (const range of ranges) {
|
|
13
|
+
if (!evaluator.isDateInRange(date, range))
|
|
14
|
+
continue;
|
|
15
|
+
const slots = evaluator.expandDay(range, date);
|
|
16
|
+
if (slots.length > 0) {
|
|
17
|
+
timeSlots.push(...slots);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// All-day range — compute span info
|
|
21
|
+
const prevDate = shiftDay(date, -1);
|
|
22
|
+
const nextDate = shiftDay(date, 1);
|
|
23
|
+
const prevInRange = evaluator.isDateInRange(prevDate, range);
|
|
24
|
+
const nextInRange = evaluator.isDateInRange(nextDate, range);
|
|
25
|
+
allDayRanges.push({
|
|
26
|
+
rangeId: range.id,
|
|
27
|
+
label: range.label,
|
|
28
|
+
isStart: !prevInRange,
|
|
29
|
+
isEnd: !nextInRange,
|
|
30
|
+
isContinuation: prevInRange && nextInRange,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Sort time slots by start time
|
|
35
|
+
timeSlots.sort((a, b) => {
|
|
36
|
+
const aMin = parseInt(a.startTime.split(':')[0]) * 60 + parseInt(a.startTime.split(':')[1]);
|
|
37
|
+
const bMin = parseInt(b.startTime.split(':')[0]) * 60 + parseInt(b.startTime.split(':')[1]);
|
|
38
|
+
return aMin - bMin;
|
|
39
|
+
});
|
|
40
|
+
return { timeSlots, allDayRanges };
|
|
41
|
+
}, [date, ranges, userTimezone]);
|
|
42
|
+
}
|
|
43
|
+
function shiftDay(dateStr, delta) {
|
|
44
|
+
const [y, m, d] = dateStr.split('-').map(Number);
|
|
45
|
+
const date = new Date(y, m - 1, d + delta);
|
|
46
|
+
const year = date.getFullYear();
|
|
47
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
48
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
49
|
+
return `${year}-${month}-${day}`;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=useDayDetail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDayDetail.js","sourceRoot":"","sources":["../src/useDayDetail.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DateRange, FreeSlot } from '@neo-reckoning/core';
|
|
2
|
+
/**
|
|
3
|
+
* React hook that computes free (unoccupied) time slots for a given date.
|
|
4
|
+
* Wraps RangeEvaluator.findFreeSlots() with memoisation.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFreeSlots(config: {
|
|
7
|
+
ranges: DateRange[];
|
|
8
|
+
date: string;
|
|
9
|
+
minDuration?: number;
|
|
10
|
+
dayStart?: string;
|
|
11
|
+
dayEnd?: string;
|
|
12
|
+
userTimezone?: string;
|
|
13
|
+
}): FreeSlot[];
|
|
14
|
+
//# sourceMappingURL=useFreeSlots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFreeSlots.d.ts","sourceRoot":"","sources":["../src/useFreeSlots.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,QAAQ,EAAE,CAWb"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* React hook that computes free (unoccupied) time slots for a given date.
|
|
5
|
+
* Wraps RangeEvaluator.findFreeSlots() with memoisation.
|
|
6
|
+
*/
|
|
7
|
+
export function useFreeSlots(config) {
|
|
8
|
+
const { ranges, date, minDuration, dayStart, dayEnd, userTimezone } = config;
|
|
9
|
+
return useMemo(() => {
|
|
10
|
+
const evaluator = new RangeEvaluator(userTimezone);
|
|
11
|
+
return evaluator.findFreeSlots(ranges, date, {
|
|
12
|
+
minDuration,
|
|
13
|
+
dayStart,
|
|
14
|
+
dayEnd,
|
|
15
|
+
});
|
|
16
|
+
}, [ranges, date, minDuration, dayStart, dayEnd, userTimezone]);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=useFreeSlots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFreeSlots.js","sourceRoot":"","sources":["../src/useFreeSlots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAO5B;IACC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAE7E,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC;QACnD,OAAO,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE;YAC3C,WAAW;YACX,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DateRange, Occurrence } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseRangeCheckResult {
|
|
3
|
+
/** Check which ranges a datetime falls within */
|
|
4
|
+
isInRange: (datetime: Date) => DateRange[];
|
|
5
|
+
/** Expand all ranges within a window */
|
|
6
|
+
getOccurrences: (from: Date, to: Date) => Occurrence[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Range evaluation hook — provides isInRange checks and occurrence expansion.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useRangeCheck(ranges: DateRange[], userTimezone?: string): UseRangeCheckResult;
|
|
12
|
+
//# sourceMappingURL=useRangeCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRangeCheck.d.ts","sourceRoot":"","sources":["../src/useRangeCheck.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,SAAS,EAAE,CAAC,QAAQ,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;IAC3C,wCAAwC;IACxC,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;CACxD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EAAE,EACnB,YAAY,CAAC,EAAE,MAAM,GACpB,mBAAmB,CAmBrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Range evaluation hook — provides isInRange checks and occurrence expansion.
|
|
5
|
+
*/
|
|
6
|
+
export function useRangeCheck(ranges, userTimezone) {
|
|
7
|
+
const evaluator = useMemo(() => new RangeEvaluator(userTimezone), [userTimezone]);
|
|
8
|
+
const isInRange = useMemo(() => {
|
|
9
|
+
return (datetime) => {
|
|
10
|
+
return ranges.filter(r => evaluator.isInRange(datetime, r));
|
|
11
|
+
};
|
|
12
|
+
}, [ranges, evaluator]);
|
|
13
|
+
const getOccurrences = useMemo(() => {
|
|
14
|
+
return (from, to) => {
|
|
15
|
+
return ranges.flatMap(r => evaluator.expand(r, from, to));
|
|
16
|
+
};
|
|
17
|
+
}, [ranges, evaluator]);
|
|
18
|
+
return { isInRange, getOccurrences };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=useRangeCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRangeCheck.js","sourceRoot":"","sources":["../src/useRangeCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAUrD;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAmB,EACnB,YAAqB;IAErB,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,YAAY,CAAC,EACtC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE;QAC7B,OAAO,CAAC,QAAc,EAAe,EAAE;YACrC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAExB,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,OAAO,CAAC,IAAU,EAAE,EAAQ,EAAgB,EAAE;YAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IAExB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DateRange, ScheduleScore } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseScheduleScoreConfig {
|
|
3
|
+
ranges: DateRange[];
|
|
4
|
+
from: Date;
|
|
5
|
+
to: Date;
|
|
6
|
+
focusBlockMinutes?: number;
|
|
7
|
+
dayStart?: string;
|
|
8
|
+
dayEnd?: string;
|
|
9
|
+
userTimezone?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Compute a ScheduleScore for a set of ranges across a date window.
|
|
13
|
+
* Re-computes when inputs change.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useScheduleScore(config: UseScheduleScoreConfig): ScheduleScore;
|
|
16
|
+
//# sourceMappingURL=useScheduleScore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScheduleScore.d.ts","sourceRoot":"","sources":["../src/useScheduleScore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpE,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,EAAE,EAAE,IAAI,CAAC;IACT,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,aAAa,CA2B9E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator, scoreSchedule } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Compute a ScheduleScore for a set of ranges across a date window.
|
|
5
|
+
* Re-computes when inputs change.
|
|
6
|
+
*/
|
|
7
|
+
export function useScheduleScore(config) {
|
|
8
|
+
const { ranges, from, to, focusBlockMinutes, dayStart, dayEnd, userTimezone, } = config;
|
|
9
|
+
const evaluator = useMemo(() => new RangeEvaluator(userTimezone), [userTimezone]);
|
|
10
|
+
const score = useMemo(() => scoreSchedule(evaluator, ranges, from, to, {
|
|
11
|
+
focusBlockMinutes,
|
|
12
|
+
dayStart,
|
|
13
|
+
dayEnd,
|
|
14
|
+
}), [evaluator, ranges, from, to, focusBlockMinutes, dayStart, dayEnd]);
|
|
15
|
+
return score;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=useScheduleScore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScheduleScore.js","sourceRoot":"","sources":["../src/useScheduleScore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAapE;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA8B;IAC7D,MAAM,EACJ,MAAM,EACN,IAAI,EACJ,EAAE,EACF,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,YAAY,GACb,GAAG,MAAM,CAAC;IAEX,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,YAAY,CAAC,EACtC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QACzC,iBAAiB;QACjB,QAAQ;QACR,MAAM;KACP,CAAC,EACJ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,CAAC,CACnE,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DateRange, SpanInfo } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseSpansConfig {
|
|
3
|
+
/** DateRanges to compute spans for */
|
|
4
|
+
ranges: DateRange[];
|
|
5
|
+
/** Start of the window */
|
|
6
|
+
from: Date;
|
|
7
|
+
/** End of the window */
|
|
8
|
+
to: Date;
|
|
9
|
+
/** User's timezone for range evaluation */
|
|
10
|
+
userTimezone?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Span computation hook — returns SpanInfo[] for overlap-aware rendering.
|
|
14
|
+
* Computes contiguous spans, lane assignments, and overlap metrics.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useSpans(config: UseSpansConfig): SpanInfo[];
|
|
17
|
+
//# sourceMappingURL=useSpans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpans.d.ts","sourceRoot":"","sources":["../src/useSpans.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,0BAA0B;IAC1B,IAAI,EAAE,IAAI,CAAC;IACX,wBAAwB;IACxB,EAAE,EAAE,IAAI,CAAC;IACT,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,QAAQ,EAAE,CAc3D"}
|
package/dist/useSpans.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { RangeEvaluator } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Span computation hook — returns SpanInfo[] for overlap-aware rendering.
|
|
5
|
+
* Computes contiguous spans, lane assignments, and overlap metrics.
|
|
6
|
+
*/
|
|
7
|
+
export function useSpans(config) {
|
|
8
|
+
const { ranges, from, to, userTimezone } = config;
|
|
9
|
+
const evaluator = useMemo(() => new RangeEvaluator(userTimezone), [userTimezone]);
|
|
10
|
+
const spans = useMemo(() => evaluator.computeSpans(ranges, from, to), [evaluator, ranges, from, to]);
|
|
11
|
+
return spans;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=useSpans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpans.js","sourceRoot":"","sources":["../src/useSpans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAcrD;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAsB;IAC7C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAElD,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,YAAY,CAAC,EACtC,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAC9C,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAC9B,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CalendarEvent, TimelineSlot } from '@neo-reckoning/core';
|
|
2
|
+
export interface UseTimelineConfig {
|
|
3
|
+
/** Which day (YYYY-MM-DD) */
|
|
4
|
+
date: string;
|
|
5
|
+
/** Normalized events for this day */
|
|
6
|
+
events: CalendarEvent[];
|
|
7
|
+
/** Start hour (0-23). Default: 0 */
|
|
8
|
+
startHour?: number;
|
|
9
|
+
/** End hour (1-24). Default: 24 */
|
|
10
|
+
endHour?: number;
|
|
11
|
+
/** Slot granularity in minutes: 15, 30, or 60. Default: 60 */
|
|
12
|
+
intervalMinutes?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface UseTimelineResult {
|
|
15
|
+
/** Timeline slots with positioned events */
|
|
16
|
+
slots: TimelineSlot[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Timeline hook — produces positioned timeline data for day views.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useTimeline(config: UseTimelineConfig): UseTimelineResult;
|
|
22
|
+
//# sourceMappingURL=useTimeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimeline.d.ts","sourceRoot":"","sources":["../src/useTimeline.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvE,MAAM,WAAW,iBAAiB;IAChC,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAexE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { TimelineGrid } from '@neo-reckoning/core';
|
|
3
|
+
/**
|
|
4
|
+
* Timeline hook — produces positioned timeline data for day views.
|
|
5
|
+
*/
|
|
6
|
+
export function useTimeline(config) {
|
|
7
|
+
const { date, events, startHour, endHour, intervalMinutes } = config;
|
|
8
|
+
const slots = useMemo(() => {
|
|
9
|
+
const grid = new TimelineGrid({
|
|
10
|
+
date,
|
|
11
|
+
events,
|
|
12
|
+
startHour,
|
|
13
|
+
endHour,
|
|
14
|
+
intervalMinutes,
|
|
15
|
+
});
|
|
16
|
+
return grid.slots;
|
|
17
|
+
}, [date, events, startHour, endHour, intervalMinutes]);
|
|
18
|
+
return { slots };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=useTimeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTimeline.js","sourceRoot":"","sources":["../src/useTimeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAqBnD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAyB;IACnD,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;IAErE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC;YAC5B,IAAI;YACJ,MAAM;YACN,SAAS;YACT,OAAO;YACP,eAAe;SAChB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IAExD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neo-reckoning/react",
|
|
3
|
+
"version": "0.1.0-alpha.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --passWithNoTests",
|
|
16
|
+
"typecheck": "tsc --noEmit"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@neo-reckoning/core": "workspace:*"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/react": "^19.2.14"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/sdougbrown/neo-reckoning.git",
|
|
33
|
+
"directory": "packages/react"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
}
|
|
38
|
+
}
|