@event-calendar/core 1.5.1 → 2.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.
- package/README.md +85 -63
- package/index.css +20 -20
- package/index.js +214 -255
- package/package.json +1 -1
- package/src/Buttons.svelte +24 -6
- package/src/Calendar.svelte +2 -2
- package/src/index.scss +18 -18
- package/src/lib/a11y.js +0 -24
- package/src/lib/actions.js +4 -10
- package/src/lib/date.js +9 -77
- package/src/lib/dom.js +7 -5
- package/src/lib/events.js +12 -8
- package/src/lib/options.js +28 -0
- package/src/lib/stores.js +6 -7
- package/src/lib/utils.js +4 -4
- package/src/lib.js +1 -0
- package/src/storage/options.js +4 -7
- package/src/storage/state.js +33 -20
- package/src/storage/stores.js +12 -12
package/src/storage/stores.js
CHANGED
|
@@ -19,18 +19,18 @@ import {
|
|
|
19
19
|
debounce
|
|
20
20
|
} from '../lib.js';
|
|
21
21
|
|
|
22
|
-
export function
|
|
22
|
+
export function dayGrid(state) {
|
|
23
23
|
return derived(state.view, $view => $view?.startsWith('dayGrid'));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function activeRange(state) {
|
|
27
27
|
return derived(
|
|
28
|
-
[state._currentRange, state.firstDay, state.slotMaxTime, state.
|
|
29
|
-
([$_currentRange, $firstDay, $slotMaxTime, $
|
|
28
|
+
[state._currentRange, state.firstDay, state.slotMaxTime, state._dayGrid],
|
|
29
|
+
([$_currentRange, $firstDay, $slotMaxTime, $_dayGrid]) => {
|
|
30
30
|
let start = cloneDate($_currentRange.start);
|
|
31
31
|
let end = cloneDate($_currentRange.end);
|
|
32
32
|
|
|
33
|
-
if ($
|
|
33
|
+
if ($_dayGrid) {
|
|
34
34
|
// First day of week
|
|
35
35
|
prevClosestDay(start, $firstDay);
|
|
36
36
|
nextClosestDay(end, $firstDay);
|
|
@@ -49,10 +49,10 @@ export function activeRange(state) {
|
|
|
49
49
|
|
|
50
50
|
export function currentRange(state) {
|
|
51
51
|
return derived(
|
|
52
|
-
[state.date, state.duration, state.firstDay, state.
|
|
53
|
-
([$date, $duration, $firstDay, $
|
|
52
|
+
[state.date, state.duration, state.firstDay, state._dayGrid],
|
|
53
|
+
([$date, $duration, $firstDay, $_dayGrid]) => {
|
|
54
54
|
let start = cloneDate($date), end;
|
|
55
|
-
if ($
|
|
55
|
+
if ($_dayGrid) {
|
|
56
56
|
start.setUTCDate(1);
|
|
57
57
|
} else if ($duration.inWeeks) {
|
|
58
58
|
// First day of week
|
|
@@ -93,11 +93,11 @@ export function viewDates(state) {
|
|
|
93
93
|
|
|
94
94
|
export function viewTitle(state) {
|
|
95
95
|
return derived(
|
|
96
|
-
[state.date, state._activeRange, state.
|
|
97
|
-
([$date, $_activeRange, $
|
|
98
|
-
return $
|
|
99
|
-
? $
|
|
100
|
-
: $
|
|
96
|
+
[state.date, state._activeRange, state._intlTitle, state._dayGrid],
|
|
97
|
+
([$date, $_activeRange, $_intlTitle, $_dayGrid]) => {
|
|
98
|
+
return $_dayGrid
|
|
99
|
+
? $_intlTitle.formatRange($date, $date)
|
|
100
|
+
: $_intlTitle.formatRange($_activeRange.start, subtractDay(cloneDate($_activeRange.end)));
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
}
|