@neo-reckoning/core 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/displayType.d.ts +9 -0
- package/dist/displayType.d.ts.map +1 -0
- package/dist/displayType.js +23 -0
- package/dist/displayType.js.map +1 -0
- package/dist/evaluator.d.ts +86 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +608 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/events.d.ts +10 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +28 -0
- package/dist/events.js.map +1 -0
- package/dist/grid.d.ts +36 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +177 -0
- package/dist/grid.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/scoring.d.ts +14 -0
- package/dist/scoring.d.ts.map +1 -0
- package/dist/scoring.js +152 -0
- package/dist/scoring.js.map +1 -0
- package/dist/time.d.ts +58 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +169 -0
- package/dist/time.js.map +1 -0
- package/dist/timeline.d.ts +24 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +158 -0
- package/dist/timeline.js.map +1 -0
- package/dist/types.d.ts +349 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/yearGrid.d.ts +16 -0
- package/dist/yearGrid.d.ts.map +1 -0
- package/dist/yearGrid.js +61 -0
- package/dist/yearGrid.js.map +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DateRange, ViewFidelity } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the effective display type for a range at a given fidelity level.
|
|
4
|
+
* If the range has an explicit displayType (not 'auto'), it is returned as-is.
|
|
5
|
+
* Otherwise, auto-resolution picks a sensible default based on range characteristics
|
|
6
|
+
* and the current view fidelity.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveDisplayType(range: DateRange, fidelity: ViewFidelity): string;
|
|
9
|
+
//# sourceMappingURL=displayType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayType.d.ts","sourceRoot":"","sources":["../src/displayType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAgBnF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the effective display type for a range at a given fidelity level.
|
|
3
|
+
* If the range has an explicit displayType (not 'auto'), it is returned as-is.
|
|
4
|
+
* Otherwise, auto-resolution picks a sensible default based on range characteristics
|
|
5
|
+
* and the current view fidelity.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveDisplayType(range, fidelity) {
|
|
8
|
+
if (range.displayType && range.displayType !== 'auto') {
|
|
9
|
+
return range.displayType;
|
|
10
|
+
}
|
|
11
|
+
// Auto-resolve based on range characteristics and view fidelity
|
|
12
|
+
if (fidelity === 'year')
|
|
13
|
+
return 'dot';
|
|
14
|
+
if (range.startTime || range.everyHour) {
|
|
15
|
+
return fidelity === 'month' ? 'chip' : 'block';
|
|
16
|
+
}
|
|
17
|
+
if (range.fromDate && range.toDate)
|
|
18
|
+
return 'span';
|
|
19
|
+
if (range.dates && range.dates.length === 1)
|
|
20
|
+
return 'dot';
|
|
21
|
+
return 'fill';
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=displayType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayType.js","sourceRoot":"","sources":["../src/displayType.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAgB,EAAE,QAAsB;IACzE,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC,WAAW,CAAC;IAC3B,CAAC;IAED,gEAAgE;IAChE,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IAEtC,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACvC,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACjD,CAAC;IAED,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IAClD,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE1D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DateRange, Occurrence, TimeSlot, SpanInfo, Conflict, FreeSlot } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* RangeEvaluator — the core computation engine of neo-reckoning.
|
|
4
|
+
*
|
|
5
|
+
* Determines whether dates/times fall within a DateRange and expands
|
|
6
|
+
* ranges into concrete occurrences within a given window.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RangeEvaluator {
|
|
9
|
+
private userTimezone;
|
|
10
|
+
constructor(userTimezone?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Check if a date (YYYY-MM-DD) falls within a range's day-level criteria.
|
|
13
|
+
*/
|
|
14
|
+
isDateInRange(dateStr: string, range: DateRange): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Get all time occurrences for a range on a specific day.
|
|
17
|
+
* Returns empty array for all-day ranges (check isDateInRange instead).
|
|
18
|
+
*/
|
|
19
|
+
getTimeSlots(dateStr: string, range: DateRange): TimeSlot[];
|
|
20
|
+
/**
|
|
21
|
+
* Check if a specific datetime falls within a range (both day and time criteria).
|
|
22
|
+
*/
|
|
23
|
+
isInRange(datetime: Date, range: DateRange): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Expand a DateRange into all concrete occurrences within a date window.
|
|
26
|
+
* This is the core computation described in the plan's Addendum C.
|
|
27
|
+
*/
|
|
28
|
+
expand(range: DateRange, from: Date, to: Date): Occurrence[];
|
|
29
|
+
/**
|
|
30
|
+
* Expand a DateRange for a single day — convenience for day/week views.
|
|
31
|
+
*/
|
|
32
|
+
expandDay(range: DateRange, dateStr: string): TimeSlot[];
|
|
33
|
+
/**
|
|
34
|
+
* Compute contiguous spans for multiple ranges within a date window.
|
|
35
|
+
* Groups consecutive matching days into SpanInfo objects, assigns lanes
|
|
36
|
+
* using greedy interval scheduling, and computes overlap metrics.
|
|
37
|
+
*/
|
|
38
|
+
computeSpans(ranges: DateRange[], from: Date, to: Date): SpanInfo[];
|
|
39
|
+
/**
|
|
40
|
+
* Find time-level conflicts among ranges on a single date.
|
|
41
|
+
* Two timed ranges that overlap in time are a conflict.
|
|
42
|
+
* Two all-day ranges, or an all-day + timed range, are NOT conflicts.
|
|
43
|
+
*/
|
|
44
|
+
findConflicts(ranges: DateRange[], date: string): Conflict[];
|
|
45
|
+
/**
|
|
46
|
+
* Find time-level conflicts across a date window.
|
|
47
|
+
*/
|
|
48
|
+
findConflictsInWindow(ranges: DateRange[], from: Date, to: Date): Conflict[];
|
|
49
|
+
/**
|
|
50
|
+
* Find free (unoccupied) time slots on a given date by analysing all ranges.
|
|
51
|
+
*
|
|
52
|
+
* Algorithm:
|
|
53
|
+
* 1. Expand all ranges for the date into time slots (using getTimeSlots)
|
|
54
|
+
* 2. Collect occupied intervals as [startMinutes, endMinutes] pairs
|
|
55
|
+
* 3. Merge overlapping intervals
|
|
56
|
+
* 4. Walk from dayStart to dayEnd — gaps between merged intervals are free slots
|
|
57
|
+
* 5. Filter by minDuration
|
|
58
|
+
*/
|
|
59
|
+
findFreeSlots(ranges: DateRange[], date: string, options?: {
|
|
60
|
+
minDuration?: number;
|
|
61
|
+
dayStart?: string;
|
|
62
|
+
dayEnd?: string;
|
|
63
|
+
}): FreeSlot[];
|
|
64
|
+
/**
|
|
65
|
+
* Find the next free slot of at least `duration` minutes, searching day by day
|
|
66
|
+
* from `from` to `to`.
|
|
67
|
+
*/
|
|
68
|
+
findNextFreeSlot(ranges: DateRange[], from: Date, to: Date, duration: number, options?: {
|
|
69
|
+
dayStart?: string;
|
|
70
|
+
dayEnd?: string;
|
|
71
|
+
}): FreeSlot | null;
|
|
72
|
+
/**
|
|
73
|
+
* Check if dateB is exactly the day after dateA.
|
|
74
|
+
*/
|
|
75
|
+
private isNextDay;
|
|
76
|
+
private isDateInBounds;
|
|
77
|
+
private getCandidateDays;
|
|
78
|
+
private hasTimeFields;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve a time in the range's timezone to the user's timezone.
|
|
81
|
+
* Returns null if the time doesn't exist (DST spring-forward gap).
|
|
82
|
+
* Returns the time unchanged if the range has no timezone (floating).
|
|
83
|
+
*/
|
|
84
|
+
private resolveTime;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgBhG;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAS;gBAEjB,YAAY,CAAC,EAAE,MAAM;IAIjC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO;IAoCzD;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,K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