@lazerlen/legend-calendar 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,20 @@
1
- $ tsup --dts
1
+
2
+ $ tsup --dts
2
3
  CLI Building entry: src/index.ts
3
4
  CLI Using tsconfig: tsconfig.json
4
- CLI tsup v8.0.2
5
+ CLI tsup v8.5.1
5
6
  CLI Using tsup config: /Users/leviwilliams/projects/legend-calendar/packages/legend-calendar/tsup.config.ts
6
- CLI Target: es2015
7
+ CLI Target: es2016
7
8
  CLI Cleaning output folder
8
9
  CJS Build start
9
10
  ESM Build start
10
- CJS dist/index.js 22.00 KB
11
- CJS dist/index.js.map 117.93 KB
12
- CJS ⚡️ Build success in 23ms
13
- ESM dist/index.mjs 21.27 KB
14
- ESM dist/index.mjs.map 118.18 KB
15
- ESM ⚡️ Build success in 24ms
16
- DTS Build start
17
- DTS ⚡️ Build success in 1385ms
18
- DTS dist/index.d.ts 23.93 KB
19
- DTS dist/index.d.mts 23.93 KB
11
+ DTS Build start
12
+ ESM dist/index.mjs 66.59 KB
13
+ ESM dist/index.mjs.map 135.15 KB
14
+ ESM ⚡️ Build success in 1028ms
15
+ CJS dist/index.js 69.65 KB
16
+ CJS dist/index.js.map 135.66 KB
17
+ CJS ⚡️ Build success in 1028ms
18
+ DTS ⚡️ Build success in 1163ms
19
+ DTS dist/index.d.ts 24.02 KB
20
+ DTS dist/index.d.mts 24.02 KB
@@ -1,4 +1,5 @@
1
- $ eslint src
1
+
2
+ $ eslint src
2
3
  =============
3
4
 
4
5
  WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
@@ -1,261 +1,217 @@
1
- $ bun test
1
+
2
+ $ bun test
2
3
  bun test v1.2.20 (6ad208bc)
3
4
  
4
5
  src/hooks/useDateRange.test.ts:
5
6
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
6
7
  The current testing environment is not configured to support act(...)
7
- ✓ useDateRange > should initialize with correct default values [8.97ms]
8
+ ✓ useDateRange > should initialize with correct default values [4.88ms]
8
9
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
9
10
  The current testing environment is not configured to support act(...)
10
11
  The current testing environment is not configured to support act(...)
11
12
  The current testing environment is not configured to support act(...)
12
13
  The current testing environment is not configured to support act(...)
13
14
  The current testing environment is not configured to support act(...)
14
- ✓ useDateRange > should update dateRange correctly on onCalendarDayPress [1.87ms]
15
+ ✓ useDateRange > should update dateRange correctly on onCalendarDayPress [0.69ms]
15
16
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
16
17
  The current testing environment is not configured to support act(...)
17
18
  The current testing environment is not configured to support act(...)
18
19
  The current testing environment is not configured to support act(...)
19
20
  The current testing environment is not configured to support act(...)
20
- ✓ useDateRange > should clear dateRange on onClearDateRange [1.57ms]
21
+ ✓ useDateRange > should clear dateRange on onClearDateRange [0.27ms]
21
22
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
22
23
  The current testing environment is not configured to support act(...)
23
24
  The current testing environment is not configured to support act(...)
24
25
  The current testing environment is not configured to support act(...)
25
26
  The current testing environment is not configured to support act(...)
26
- ✓ useDateRange > should update isDateRangeValid correctly [0.59ms]
27
+ ✓ useDateRange > should update isDateRangeValid correctly [0.33ms]
27
28
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
28
29
  The current testing environment is not configured to support act(...)
29
- ✓ useDateRange > can initialize a date range [0.57ms]
30
+ ✓ useDateRange > can initialize a date range [0.26ms]
30
31
  
31
32
  src/hooks/useCalendarList.test.ts:
32
- ✓ getHeightForMonth > Measures months with 5 weeks (no calendar spacing)
33
- ✓ getHeightForMonth > Measures months with 5 weeks (with calendar spacing)
33
+ ✓ getHeightForMonth > Measures months with 5 weeks (no calendar spacing) [0.04ms]
34
+ ✓ getHeightForMonth > Measures months with 5 weeks (with calendar spacing) [0.01ms]
34
35
  ✓ getHeightForMonth > Accounts for additional height
35
- ✓ getHeightForMonth > Measures months with 6 weeks [0.03ms]
36
- ✓ getHeightForMonth > February 24 has the right height with base options [0.43ms]
36
+ ✓ getHeightForMonth > Measures months with 6 weeks [0.01ms]
37
+ ✓ getHeightForMonth > February 24 has the right height with base options [0.40ms]
37
38
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
38
39
  The current testing environment is not configured to support act(...)
39
40
  The current testing environment is not configured to support act(...)
40
41
  The current testing environment is not configured to support act(...)
41
- ✓ useCalendarList > Min/Max dates > Max: virtualization still works as expected [1.23ms]
42
+ ✓ useCalendarList > Min/Max dates > Max: virtualization still works as expected [0.61ms]
42
43
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
43
44
  The current testing environment is not configured to support act(...)
44
45
  The current testing environment is not configured to support act(...)
45
46
  The current testing environment is not configured to support act(...)
47
+ ✓ useCalendarList > Min/Max dates > Min: virtualization still works as expected [0.28ms]
48
+ react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
46
49
  The current testing environment is not configured to support act(...)
47
- ✓ useCalendarList > Min/Max dates > Min: virtualization still works as expected [0.98ms]
50
+ ✓ useCalendarList > Min/Max dates > Returns a single month when min and max are in the same month [0.06ms]
48
51
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
49
52
  The current testing environment is not configured to support act(...)
50
- ✓ useCalendarList > Min/Max dates > Returns a single month when min and max are in the same month [0.35ms]
53
+ ✓ useCalendarList > Min/Max dates > Returns a range of months bounded by the min and max dates [0.11ms]
51
54
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
52
55
  The current testing environment is not configured to support act(...)
53
- ✓ useCalendarList > Min/Max dates > Returns a range of months bounded by the min and max dates [0.33ms]
56
+ ✓ useCalendarList > Min/Max dates > Ignores past/future scroll ranges when min/max dates are used [0.08ms]
54
57
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
55
58
  The current testing environment is not configured to support act(...)
56
- ✓ useCalendarList > Min/Max dates > Ignores past/future scroll ranges when min/max dates are used [0.21ms]
59
+ ✓ useCalendarList > Min/Max dates > Append/Prepend are no-op if min/max are reached [0.11ms]
57
60
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
58
61
  The current testing environment is not configured to support act(...)
59
62
  The current testing environment is not configured to support act(...)
60
- ✓ useCalendarList > Min/Max dates > Append/Prepend are no-op if min/max are reached [0.57ms]
63
+ The current testing environment is not configured to support act(...)
64
+ ✓ useCalendarList > Min/Max dates > Prepend does not trigger a state update when starting month is already present [0.21ms]
61
65
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
62
66
  The current testing environment is not configured to support act(...)
63
- ✓ useCalendarList > github issues > #16: Incorrect scroll position when setting calendarMinDateId [0.17ms]
67
+ ✓ useCalendarList > github issues > #16: Incorrect scroll position when setting calendarMinDateId [0.11ms]
64
68
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
65
69
  The current testing environment is not configured to support act(...)
66
- ✓ useCalendarList > Data is correctly built when future/past ranges are 0 [0.26ms]
70
+ ✓ useCalendarList > Data is correctly built when future/past ranges are 0 [0.07ms]
67
71
  
68
72
  src/hooks/useCalendar.test.ts:
69
- ✓ buildCalendar > isLastDayOfWeek > isLastDayOfWeek respects "sunday" as last day of week [9.71ms]
70
- ✓ buildCalendar > isLastDayOfWeek > isLastDayOfWeek respects "monday" as last day of week [1.23ms]
71
- ✓ buildCalendar > isWeekend > starting on sunday [1.58ms]
72
- ✓ buildCalendar > isWeekend > starting on monday [1.21ms]
73
- ✓ buildCalendar > state > active: supersedes today [1.16ms]
74
- ✓ buildCalendar > state > active: supersedes disabled (with calendarDisabledDateIds) [1.54ms]
75
- ✓ buildCalendar > state > active: supersedes disabled (with min) [1.22ms]
76
- ✓ buildCalendar > state > active: supersedes disabled (with max) [1.14ms]
77
- ✓ buildCalendar > state > active: supersedes idle [1.13ms]
78
- ✓ buildCalendar > state > disabled: supersedes idle [1.23ms]
79
- ✓ buildCalendar > state > today: supersedes idle [1.38ms]
80
- ✓ buildCalendar > state > idle: serves as the base state [2.10ms]
81
- ✓ buildCalendar > builds the month row [1.43ms]
82
- ✓ buildCalendar > build the month row with custom formatting [3.49ms]
83
- ✓ buildCalendar > builds the week days row starting on sunday [1.65ms]
84
- ✓ buildCalendar > builds the week days row starting on monday [1.56ms]
85
- ✓ buildCalendar > builds the weeks row [2.08ms]
86
- ✓ buildCalendar > build the weeks row with custom formatting [0.66ms]
87
- ✓ buildCalendar > handles the expected range [2.31ms]
88
- ✓ buildCalendar > calendarMinDate [2.04ms]
89
- ✓ buildCalendar > calendarMaxDate [1.88ms]
73
+ ✓ buildCalendar > isLastDayOfWeek > isLastDayOfWeek respects "sunday" as last day of week [7.38ms]
74
+ ✓ buildCalendar > isLastDayOfWeek > isLastDayOfWeek respects "monday" as last day of week [1.09ms]
75
+ ✓ buildCalendar > isWeekend > starting on sunday [1.14ms]
76
+ ✓ buildCalendar > isWeekend > starting on monday [1.20ms]
77
+ ✓ buildCalendar > state > active: supersedes today [1.10ms]
78
+ ✓ buildCalendar > state > active: supersedes disabled (with calendarDisabledDateIds) [1.08ms]
79
+ ✓ buildCalendar > state > active: supersedes disabled (with min) [1.53ms]
80
+ ✓ buildCalendar > state > active: supersedes disabled (with max) [1.15ms]
81
+ ✓ buildCalendar > state > active: supersedes idle [1.06ms]
82
+ ✓ buildCalendar > state > disabled: supersedes idle [1.13ms]
83
+ ✓ buildCalendar > state > today: supersedes idle [1.45ms]
84
+ ✓ buildCalendar > state > idle: serves as the base state [1.43ms]
85
+ ✓ buildCalendar > builds the month row [1.02ms]
86
+ ✓ buildCalendar > build the month row with custom formatting [1.55ms]
87
+ ✓ buildCalendar > builds the week days row starting on sunday [1.29ms]
88
+ ✓ buildCalendar > builds the week days row starting on monday [1.48ms]
89
+ ✓ buildCalendar > builds the weeks row [2.15ms]
90
+ ✓ buildCalendar > build the weeks row with custom formatting [1.45ms]
91
+ ✓ buildCalendar > handles the expected range [1.77ms]
92
+ ✓ buildCalendar > calendarMinDate [2.63ms]
93
+ ✓ buildCalendar > calendarMaxDate [1.38ms]
90
94
  
91
95
  src/hooks/useOptimizedDayMetadata.test.ts:
92
96
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
93
97
  The current testing environment is not configured to support act(...)
94
- ✓ useOptimizedDayMetadata > return the base metadata as the initial value [1.18ms]
98
+ ✓ useOptimizedDayMetadata > return the base metadata as the initial value [0.89ms]
95
99
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
96
100
  The current testing environment is not configured to support act(...)
97
101
  The current testing environment is not configured to support act(...)
98
- The current testing environment is not configured to support act(...)
99
102
  ✓ useOptimizedDayMetadata > if the base changes, the returned value should match it. [0.62ms]
100
103
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
101
104
  The current testing environment is not configured to support act(...)
102
105
  The current testing environment is not configured to support act(...)
103
- The current testing environment is not configured to support act(...)
104
- The current testing environment is not configured to support act(...)
105
- ✓ useOptimizedDayMetadata > endOfRange: returns the updated metadata once an event is emitted [0.69ms]
106
+ ✓ useOptimizedDayMetadata > endOfRange: returns the updated metadata once an event is emitted [0.55ms]
106
107
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
107
108
  The current testing environment is not configured to support act(...)
108
109
  The current testing environment is not configured to support act(...)
109
- The current testing environment is not configured to support act(...)
110
- The current testing environment is not configured to support act(...)
111
- The current testing environment is not configured to support act(...)
112
- ✓ useOptimizedDayMetadata > startOfRange: returns the updated metadata once an event is emitted [0.24ms]
110
+ ✓ useOptimizedDayMetadata > startOfRange: returns the updated metadata once an event is emitted [0.17ms]
113
111
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
114
112
  The current testing environment is not configured to support act(...)
115
113
  The current testing environment is not configured to support act(...)
116
- The current testing environment is not configured to support act(...)
117
- The current testing environment is not configured to support act(...)
118
- The current testing environment is not configured to support act(...)
119
- The current testing environment is not configured to support act(...)
120
- ✓ useOptimizedDayMetadata > startOfRange|endOfRange: returns the updated metadata once an event is emitted [0.19ms]
114
+ ✓ useOptimizedDayMetadata > startOfRange|endOfRange: returns the updated metadata once an event is emitted [0.20ms]
121
115
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
122
116
  The current testing environment is not configured to support act(...)
123
117
  The current testing environment is not configured to support act(...)
124
- The current testing environment is not configured to support act(...)
125
- The current testing environment is not configured to support act(...)
126
- The current testing environment is not configured to support act(...)
127
- The current testing environment is not configured to support act(...)
128
- The current testing environment is not configured to support act(...)
129
- The current testing environment is not configured to support act(...)
130
- The current testing environment is not configured to support act(...)
131
- The current testing environment is not configured to support act(...)
132
- The current testing environment is not configured to support act(...)
133
- The current testing environment is not configured to support act(...)
134
- The current testing environment is not configured to support act(...)
135
- The current testing environment is not configured to support act(...)
136
- The current testing environment is not configured to support act(...)
137
- The current testing environment is not configured to support act(...)
138
- The current testing environment is not configured to support act(...)
139
- The current testing environment is not configured to support act(...)
140
- The current testing environment is not configured to support act(...)
141
- The current testing environment is not configured to support act(...)
142
- The current testing environment is not configured to support act(...)
143
- The current testing environment is not configured to support act(...)
144
- ✓ useOptimizedDayMetadata > doesn't re-render if the active dates don't overlap [1.18ms]
118
+ ✓ useOptimizedDayMetadata > doesn't re-render if the active dates don't overlap [0.19ms]
145
119
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
146
120
  The current testing environment is not configured to support act(...)
147
121
  The current testing environment is not configured to support act(...)
148
122
  The current testing environment is not configured to support act(...)
149
- The current testing environment is not configured to support act(...)
150
- The current testing environment is not configured to support act(...)
151
- The current testing environment is not configured to support act(...)
152
- The current testing environment is not configured to support act(...)
153
- The current testing environment is not configured to support act(...)
154
- The current testing environment is not configured to support act(...)
155
- The current testing environment is not configured to support act(...)
156
- The current testing environment is not configured to support act(...)
157
- The current testing environment is not configured to support act(...)
158
- The current testing environment is not configured to support act(...)
159
- The current testing environment is not configured to support act(...)
160
- The current testing environment is not configured to support act(...)
161
- ✓ useOptimizedDayMetadata > resets the state once a new range is selected [1.22ms]
123
+ ✓ useOptimizedDayMetadata > resets the state once a new range is selected [0.17ms]
162
124
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
163
125
  The current testing environment is not configured to support act(...)
164
126
  The current testing environment is not configured to support act(...)
165
- The current testing environment is not configured to support act(...)
166
- The current testing environment is not configured to support act(...)
167
- The current testing environment is not configured to support act(...)
168
- The current testing environment is not configured to support act(...)
169
- The current testing environment is not configured to support act(...)
170
- The current testing environment is not configured to support act(...)
171
- ✓ useOptimizedDayMetadata with calendarInstanceId > uses the default instance ID when not provided [0.48ms]
127
+ ✓ useOptimizedDayMetadata with calendarInstanceId > uses the default instance ID when not provided [0.23ms]
172
128
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
173
129
  The current testing environment is not configured to support act(...)
174
130
  The current testing environment is not configured to support act(...)
175
- ✓ useOptimizedDayMetadata with calendarInstanceId > responds to events for the correct instance ID [0.42ms]
131
+ ✓ useOptimizedDayMetadata with calendarInstanceId > responds to events for the correct instance ID [0.72ms]
176
132
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
177
133
  The current testing environment is not configured to support act(...)
178
- ✓ useOptimizedDayMetadata with calendarInstanceId > ignores events for different instance IDs [0.35ms]
134
+ ✓ useOptimizedDayMetadata with calendarInstanceId > ignores events for different instance IDs [0.38ms]
179
135
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
180
136
  The current testing environment is not configured to support act(...)
181
137
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
182
138
  The current testing environment is not configured to support act(...)
183
139
  The current testing environment is not configured to support act(...)
184
140
  The current testing environment is not configured to support act(...)
185
- ✓ useOptimizedDayMetadata with calendarInstanceId > handles multiple instances correctly [0.41ms]
141
+ ✓ useOptimizedDayMetadata with calendarInstanceId > handles multiple instances correctly [0.77ms]
186
142
  react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer
187
143
  The current testing environment is not configured to support act(...)
188
144
  The current testing environment is not configured to support act(...)
189
145
  The current testing environment is not configured to support act(...)
190
- ✓ useOptimizedDayMetadata with calendarInstanceId > resets state for the correct instance when a new range is selected [0.17ms]
146
+ ✓ useOptimizedDayMetadata with calendarInstanceId > resets state for the correct instance when a new range is selected [0.65ms]
191
147
  
192
148
  src/helpers/dates.test.ts:
193
- ✓ toDateId: UTC time zone > January 1st, 2024 [0.09ms]
194
- ✓ toDateId: UTC time zone > January 31th, 2024 [0.01ms]
195
- ✓ toDateId: UTC time zone > February 1st, 2024 [0.01ms]
196
- ✓ toDateId: UTC time zone > February 10th, 2024 [0.01ms]
197
- ✓ toDateId: UTC time zone > convert between ID -> Date -> ID returns the original result
198
- ✓ toDateId: Brasilia time zone  > January 1st, 2024 [0.01ms]
199
- ✓ toDateId: Brasilia time zone  > January 31th, 2024 [0.02ms]
200
- ✓ toDateId: Brasilia time zone  > February 1st, 2024 [0.02ms]
201
- ✓ toDateId: Brasilia time zone  > February 10th, 2024
202
- ✓ toDateId: Brasilia time zone  > February 29th, 2024 [0.01ms]
203
- ✓ toDateId: Brasilia time zone  > convert between ID -> Date -> ID returns the original result [0.01ms]
204
- ✓ fromDateId: UTC time zone > parse Jan 1st [0.02ms]
205
- ✓ fromDateId: UTC time zone > parses March 1st
206
- ✓ fromDateId: Brasilia time zone > parse Jan 1st [0.01ms]
207
- ✓ fromDateId: Brasilia time zone > parses March 1st [0.01ms]
208
- ✓ startOfMonth > January [0.01ms]
209
- ✓ startOfMonth > February [0.01ms]
210
- ✓ startOfMonth > matches date-fns [1.52ms]
211
- ✓ endOfMonth > January [0.05ms]
149
+ ✓ toDateId: UTC time zone > January 1st, 2024 [0.08ms]
150
+ ✓ toDateId: UTC time zone > January 31th, 2024 [0.11ms]
151
+ ✓ toDateId: UTC time zone > February 1st, 2024 [0.06ms]
152
+ ✓ toDateId: UTC time zone > February 10th, 2024 [0.07ms]
153
+ ✓ toDateId: UTC time zone > convert between ID -> Date -> ID returns the original result [0.04ms]
154
+ ✓ toDateId: Brasilia time zone  > January 1st, 2024 [0.04ms]
155
+ ✓ toDateId: Brasilia time zone  > January 31th, 2024 [0.07ms]
156
+ ✓ toDateId: Brasilia time zone  > February 1st, 2024 [0.08ms]
157
+ ✓ toDateId: Brasilia time zone  > February 10th, 2024 [0.04ms]
158
+ ✓ toDateId: Brasilia time zone  > February 29th, 2024 [0.08ms]
159
+ ✓ toDateId: Brasilia time zone  > convert between ID -> Date -> ID returns the original result [0.04ms]
160
+ ✓ fromDateId: UTC time zone > parse Jan 1st [0.08ms]
161
+ ✓ fromDateId: UTC time zone > parses March 1st [0.05ms]
162
+ ✓ fromDateId: Brasilia time zone > parse Jan 1st [0.08ms]
163
+ ✓ fromDateId: Brasilia time zone > parses March 1st [0.05ms]
164
+ ✓ startOfMonth > January [0.06ms]
165
+ ✓ startOfMonth > February [0.03ms]
166
+ ✓ startOfMonth > matches date-fns [2.44ms]
167
+ ✓ endOfMonth > January [0.08ms]
212
168
  ✓ endOfMonth > February
213
- ✓ endOfMonth > matches date-fns [1.34ms]
214
- ✓ startOfWeek > sunday: week of February 17th [0.05ms]
169
+ ✓ endOfMonth > matches date-fns [1.33ms]
170
+ ✓ startOfWeek > sunday: week of February 17th [0.02ms]
215
171
  ✓ startOfWeek > sunday: week of February 11th
216
- ✓ startOfWeek > monday: week of February 17th [0.01ms]
217
- ✓ startOfWeek > monday: week of February 11th [0.01ms]
218
- ✓ startOfWeek > matches date-fns [1.27ms]
219
- ✓ addMonths > add 1 month [0.11ms]
172
+ ✓ startOfWeek > monday: week of February 17th
173
+ ✓ startOfWeek > monday: week of February 11th
174
+ ✓ startOfWeek > matches date-fns [1.10ms]
175
+ ✓ addMonths > add 1 month [0.01ms]
220
176
  ✓ addMonths > add 10 months
221
- ✓ addMonths > matches date-fns [0.18ms]
222
- ✓ subMonths > sub 1 month [0.02ms]
223
- ✓ subMonths > sub 10 months [0.01ms]
224
- ✓ subMonths > matches date-fns [0.23ms]
225
- ✓ addDays > add 1 day [0.02ms]
177
+ ✓ addMonths > matches date-fns [0.19ms]
178
+ ✓ subMonths > sub 1 month [0.03ms]
179
+ ✓ subMonths > sub 10 months [0.04ms]
180
+ ✓ subMonths > matches date-fns [0.21ms]
181
+ ✓ addDays > add 1 day [0.01ms]
226
182
  ✓ addDays > add 10 days
227
183
  ✓ addDays > matches date-fns [0.11ms]
228
- ✓ subDays > sub 1 day [0.10ms]
229
- ✓ subDays > sub 10 days [0.02ms]
230
- ✓ subDays > matches date-fns [0.15ms]
231
- ✓ isWeekend > Friday [0.03ms]
232
- ✓ isWeekend > Saturday [0.02ms]
233
- ✓ isWeekend > Sunday [0.02ms]
234
- ✓ isWeekend > Monday [0.03ms]
235
- ✓ differenceInMonths  > edge cases > it returns diff of 1 month between Feb 28 2021 and Jan 30 2021 [0.02ms]
184
+ ✓ subDays > sub 1 day [0.02ms]
185
+ ✓ subDays > sub 10 days
186
+ ✓ subDays > matches date-fns [0.08ms]
187
+ ✓ isWeekend > Friday
188
+ ✓ isWeekend > Saturday
189
+ ✓ isWeekend > Sunday
190
+ ✓ isWeekend > Monday
191
+ ✓ differenceInMonths  > edge cases > it returns diff of 1 month between Feb 28 2021 and Jan 30 2021
236
192
  ✓ differenceInMonths  > edge cases > it returns diff of 1 month between Feb 28 2021 and Jan 31 2021
237
193
  ✓ differenceInMonths  > edge cases > it returns diff of 1 month between Nov, 30 2021 and Oct, 31 2021
238
194
  ✓ differenceInMonths  > edge cases > it returns diff of 1 month between Oct, 31 2021 and Sep, 30 2021
239
- ✓ differenceInMonths  > edge cases > it returns diff of 6 month between Oct, 31 2021 and Apr, 30 2021 [0.01ms]
195
+ ✓ differenceInMonths  > edge cases > it returns diff of 6 month between Oct, 31 2021 and Apr, 30 2021
240
196
  ✓ differenceInMonths  > edge cases > it returns diff of -1 month between Sep, 30 2021 and Oct, 31 2021
241
- ✓ differenceInMonths  > edge cases > the days of months of the given dates are the same [0.02ms]
242
- ✓ differenceInMonths  > edge cases > the given dates are the same [0.05ms]
243
- ✓ differenceInMonths  > edge cases > does not return -0 when the given dates are the same [0.02ms]
244
- ✓ differenceInMonths  > edge cases > returns the number of full months between the given dates - end of Feb [0.05ms]
245
- ✓ differenceInMonths  > returns the number of full months between the given dates [0.02ms]
197
+ ✓ differenceInMonths  > edge cases > the days of months of the given dates are the same
198
+ ✓ differenceInMonths  > edge cases > the given dates are the same
199
+ ✓ differenceInMonths  > edge cases > does not return -0 when the given dates are the same
200
+ ✓ differenceInMonths  > edge cases > returns the number of full months between the given dates - end of Feb [0.04ms]
201
+ ✓ differenceInMonths  > returns the number of full months between the given dates
246
202
  ✓ differenceInMonths  > returns a negative number if the time value of the first date is smaller
247
- ✓ differenceInMonths  > returns NaN if the first date is `Invalid Date` [0.19ms]
248
- ✓ differenceInMonths  > returns NaN if the second date is `Invalid Date` [0.03ms]
249
- ✓ differenceInMonths  > returns NaN if the both dates are `Invalid Date`
203
+ ✓ differenceInMonths  > returns NaN if the first date is `Invalid Date`
204
+ ✓ differenceInMonths  > returns NaN if the second date is `Invalid Date`
205
+ ✓ differenceInMonths  > returns NaN if the both dates are `Invalid Date` [0.01ms]
250
206
  ✓ getWeeksInMonth > sunday: Month with 5 weeks [0.03ms]
251
- ✓ getWeeksInMonth > sunday: Month with 6 weeks [0.01ms]
252
- ✓ getWeeksInMonth > monday: Month with 5 weeks [0.03ms]
253
- ✓ getWeeksInMonth > matches date-fns [2.64ms]
254
- ✓ getWeekOfMonth > sunday: June [0.11ms]
255
- ✓ getWeekOfMonth > monday: June
256
- ✓ getWeekOfMonth > matches date-fns [1.36ms]
207
+ ✓ getWeeksInMonth > sunday: Month with 6 weeks
208
+ ✓ getWeeksInMonth > monday: Month with 5 weeks [0.01ms]
209
+ ✓ getWeeksInMonth > matches date-fns [2.55ms]
210
+ ✓ getWeekOfMonth > sunday: June [0.17ms]
211
+ ✓ getWeekOfMonth > monday: June [0.03ms]
212
+ ✓ getWeekOfMonth > matches date-fns [0.80ms]
257
213
 
258
-  115 pass
214
+  116 pass
259
215
   0 fail
260
- 8695 expect() calls
261
- Ran 115 tests across 5 files. [212.00ms]
216
+ 8696 expect() calls
217
+ Ran 116 tests across 5 files. [121.00ms]
@@ -1 +1,2 @@
1
- $ tsc --noEmit
1
+
2
+ $ tsc --noEmit
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { TextProps, ViewStyle, TextStyle, PressableProps, ColorSchemeName } from 'react-native';
4
+ import { LegendListProps } from '@legendapp/list/react-native';
4
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
- import { LegendListProps } from '@legendapp/list';
6
- import * as mitt from 'mitt';
6
+
7
+ type CalendarTextProps = Omit<TextProps, "onPress" | "onLongPress" | "onPressIn" | "onPressOut">;
7
8
 
8
9
  /** All fields that affects the day's state. */
9
10
  interface CalendarDayStateFields {
@@ -145,7 +146,7 @@ interface CalendarItemDayProps {
145
146
  /** The cell's height */
146
147
  height: number;
147
148
  /** Optional TextProps to spread to the <Text> component. */
148
- textProps?: Omit<TextProps, "children" | "onPress">;
149
+ textProps?: Omit<CalendarTextProps, "children">;
149
150
  /** Optional component to replace the default <Pressable> component. */
150
151
  CalendarPressableComponent?: PressableLike;
151
152
  }
@@ -157,7 +158,7 @@ interface CalendarItemDayProps {
157
158
  * `CalendarItemDayWithContainer`, since it also includes the spacing between
158
159
  * each day.
159
160
  */
160
- declare const CalendarItemDay: ({ onPress, children, theme, height, metadata, textProps, CalendarPressableComponent, }: CalendarItemDayProps) => react_jsx_runtime.JSX.Element;
161
+ declare const CalendarItemDay: react.NamedExoticComponent<CalendarItemDayProps>;
161
162
  interface CalendarItemDayContainerTheme {
162
163
  /** An empty view that acts as a spacer between each day. The spacing is
163
164
  * controlled by the `daySpacing` prop. */
@@ -184,7 +185,7 @@ interface CalendarItemDayContainerProps {
184
185
  /** The metadata for the day, extracted from the calendar's state. */
185
186
  metadata?: CalendarDayMetadata;
186
187
  }
187
- declare const CalendarItemDayContainer: ({ children, isStartOfWeek, shouldShowActiveDayFiller, theme, daySpacing, dayHeight, metadata, }: CalendarItemDayContainerProps) => react_jsx_runtime.JSX.Element;
188
+ declare const CalendarItemDayContainer: react.NamedExoticComponent<CalendarItemDayContainerProps>;
188
189
  interface CalendarItemDayWithContainerProps extends Omit<CalendarItemDayProps, "height">, Pick<CalendarItemDayContainerProps, "daySpacing" | "dayHeight"> {
189
190
  containerTheme?: CalendarItemDayContainerTheme;
190
191
  /**
@@ -200,7 +201,7 @@ interface CalendarItemDayWithContainerProps extends Omit<CalendarItemDayProps, "
200
201
  */
201
202
  calendarInstanceId?: string;
202
203
  }
203
- declare const CalendarItemDayWithContainer: ({ children, metadata: baseMetadata, onPress, theme, dayHeight, daySpacing, containerTheme, calendarInstanceId, CalendarPressableComponent, }: CalendarItemDayWithContainerProps) => react_jsx_runtime.JSX.Element;
204
+ declare const CalendarItemDayWithContainer: react.NamedExoticComponent<CalendarItemDayWithContainerProps>;
204
205
 
205
206
  interface CalendarItemEmptyProps {
206
207
  /** The height of the cell. Should be the same as `CalendarItemDay`. */
@@ -225,9 +226,9 @@ interface CalendarItemWeekNameProps {
225
226
  /** The theme of the week name, useful for customizing the component. */
226
227
  theme?: CalendarItemWeekNameTheme;
227
228
  /** Optional TextProps to spread to the <Text> component. */
228
- textProps?: Omit<TextProps, "children">;
229
+ textProps?: Omit<CalendarTextProps, "children">;
229
230
  }
230
- declare const CalendarItemWeekName: ({ children, height, theme, textProps, }: CalendarItemWeekNameProps) => react_jsx_runtime.JSX.Element;
231
+ declare const CalendarItemWeekName: react.NamedExoticComponent<CalendarItemWeekNameProps>;
231
232
 
232
233
  interface CalendarRowMonthTheme {
233
234
  container?: ViewStyle;
@@ -243,7 +244,7 @@ interface CalendarRowMonthProps {
243
244
  /** The theme of the month row, useful for customizing the component. */
244
245
  theme?: CalendarRowMonthTheme;
245
246
  }
246
- declare const CalendarRowMonth: ({ children, height, theme, }: CalendarRowMonthProps) => react_jsx_runtime.JSX.Element;
247
+ declare const CalendarRowMonth: react.NamedExoticComponent<CalendarRowMonthProps>;
247
248
 
248
249
  /**
249
250
  * Minimal theme for the Legend Calendar component.
@@ -329,7 +330,7 @@ interface CalendarRowWeekProps {
329
330
  interface CalendarRowWeekTheme {
330
331
  container?: ViewStyle;
331
332
  }
332
- declare const CalendarRowWeek: ({ children, spacing, theme, }: CalendarRowWeekProps) => react_jsx_runtime.JSX.Element;
333
+ declare const CalendarRowWeek: react.NamedExoticComponent<CalendarRowWeekProps>;
333
334
 
334
335
  type PressableLike = React.ComponentType<Pick<PressableProps, "children" | "style" | "disabled"> & {
335
336
  onPress: () => void;
@@ -620,25 +621,35 @@ declare function toDateId(date: Date): string;
620
621
  */
621
622
  declare function fromDateId(dateId: string): Date;
622
623
 
623
- interface OnSetActiveDateRangesPayload {
624
- instanceId?: string;
625
- ranges: CalendarActiveDateRange[];
624
+ /**
625
+ * A lightweight store for active date ranges. This replaces the mitt emitter
626
+ * with a more efficient useSyncExternalStore-compatible pattern.
627
+ */
628
+ declare class DateRangeStore {
629
+ private stores;
630
+ private getOrCreateStore;
631
+ setRanges(instanceId: string, ranges: CalendarActiveDateRange[]): void;
632
+ private rangesEqual;
633
+ getSnapshot(instanceId: string): CalendarActiveDateRange[];
634
+ getDaySnapshot(instanceId: string, baseMetadata: CalendarDayMetadata): CalendarDayMetadata;
635
+ subscribe(instanceId: string, callback: () => void): () => void;
636
+ /**
637
+ * Clears all stores. Useful for testing.
638
+ */
639
+ clear(): void;
626
640
  }
627
641
  /**
628
- * An event emitter for the active date ranges. This notifies the calendar items
629
- * when their state changes, allowing just the affected items to re-render.
642
+ * A store for active date ranges. This notifies calendar items when their state
643
+ * changes, allowing just the affected items to re-render.
630
644
  *
631
645
  * While this is an implementation detail focused on improving performance, it's
632
646
  * exported in case you need to build your own calendar. Check the source code
633
647
  * for a reference implementation.
634
648
  */
635
- declare const activeDateRangesEmitter: mitt.Emitter<{
636
- onSetActiveDateRanges: OnSetActiveDateRangesPayload;
637
- }>;
649
+ declare const activeDateRangesStore: DateRangeStore;
638
650
  /**
639
651
  * Returns an optimized metadata for a particular day. This hook listens to the
640
- * `activeDateRanges` emitter, enabling only the affected calendar items to
641
- * re-render.
652
+ * date range store, enabling only the affected calendar items to re-render.
642
653
  *
643
654
  * While this is an implementation detail focused on improving performance, it's
644
655
  * exported in case you need to build your own calendar. Check the source code
@@ -676,4 +687,4 @@ declare const useDateRange: (initialDateRange?: CalendarActiveDateRange) => {
676
687
  isDateRangeValid: boolean;
677
688
  };
678
689
 
679
- export { Calendar, type CalendarActiveDateRange, type CalendarDayMetadata, type CalendarItemDayContainerProps, type CalendarItemDayProps, type CalendarItemDayWithContainerProps, type CalendarItemEmptyProps, type CalendarItemWeekNameProps, type CalendarListProps, type CalendarListRef, type CalendarMonth, type CalendarMonthEnhanced, type CalendarOnDayPress, type CalendarProps, type CalendarRowMonthProps, type CalendarRowWeekProps, type CalendarTheme, type HStackProps, type UseCalendarListParams, type UseCalendarParams, type VStackProps, activeDateRangesEmitter, buildCalendar, fromDateId, getHeightForMonth, toDateId, useCalendar, useCalendarList, useDateRange, useOptimizedDayMetadata };
690
+ export { Calendar, type CalendarActiveDateRange, type CalendarDayMetadata, type CalendarItemDayContainerProps, type CalendarItemDayProps, type CalendarItemDayWithContainerProps, type CalendarItemEmptyProps, type CalendarItemWeekNameProps, type CalendarListProps, type CalendarListRef, type CalendarMonth, type CalendarMonthEnhanced, type CalendarOnDayPress, type CalendarProps, type CalendarRowMonthProps, type CalendarRowWeekProps, type CalendarTextProps, type CalendarTheme, type HStackProps, type UseCalendarListParams, type UseCalendarParams, type VStackProps, activeDateRangesStore, buildCalendar, fromDateId, getHeightForMonth, toDateId, useCalendar, useCalendarList, useDateRange, useOptimizedDayMetadata };