@event-calendar/core 4.1.0 → 4.2.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 +3 -3
- package/dist/index.css +8 -1
- package/dist/index.js +30 -27
- package/package.json +2 -2
- package/src/Calendar.svelte +7 -8
- package/src/lib/components/BaseEvent.svelte +2 -2
- package/src/plugins/list/Event.svelte +1 -1
- package/src/plugins/resource-time-grid/View.svelte +7 -4
- package/src/plugins/time-grid/View.svelte +6 -3
- package/src/styles/index.scss +7 -0
package/README.md
CHANGED
|
@@ -227,8 +227,8 @@ This bundle contains a version of the calendar that includes all plugins and is
|
|
|
227
227
|
|
|
228
228
|
The first step is to include the following lines of code in the `<head>` section of your page:
|
|
229
229
|
```html
|
|
230
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.
|
|
231
|
-
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.
|
|
230
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.2.0/dist/event-calendar.min.css">
|
|
231
|
+
<script src="https://cdn.jsdelivr.net/npm/@event-calendar/build@4.2.0/dist/event-calendar.min.js"></script>
|
|
232
232
|
```
|
|
233
233
|
|
|
234
234
|
<details>
|
|
@@ -1552,7 +1552,7 @@ function (start, end) {
|
|
|
1552
1552
|
- Type `string`
|
|
1553
1553
|
- Default `undefined`
|
|
1554
1554
|
|
|
1555
|
-
Sets the default text color for events
|
|
1555
|
+
Sets the default text color for calendar events (except for `list` view).
|
|
1556
1556
|
|
|
1557
1557
|
You can use any of the CSS color formats such `'#f00'`, `'#ff0000'`, `'rgb(255,0,0)'`, or `'red'`.
|
|
1558
1558
|
|
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v4.
|
|
2
|
+
* EventCalendar v4.2.0
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
.ec {
|
|
@@ -541,6 +541,13 @@
|
|
|
541
541
|
top: 0;
|
|
542
542
|
z-index: 2;
|
|
543
543
|
}
|
|
544
|
+
.ec-list .ec-day.ec-today .ec-day-head:before {
|
|
545
|
+
content: "";
|
|
546
|
+
position: absolute;
|
|
547
|
+
inset: 0;
|
|
548
|
+
z-index: -1;
|
|
549
|
+
background-color: var(--ec-today-bg-color);
|
|
550
|
+
}
|
|
544
551
|
.ec-list .ec-day:first-child .ec-day-head {
|
|
545
552
|
border-top: none;
|
|
546
553
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* EventCalendar v4.
|
|
2
|
+
* EventCalendar v4.2.0
|
|
3
3
|
* https://github.com/vkurko/calendar
|
|
4
4
|
*/
|
|
5
5
|
import { tick, getContext, untrack, setContext, onMount, mount, unmount } from "svelte";
|
|
@@ -1670,18 +1670,17 @@ function Calendar($$anchor, $$props) {
|
|
|
1670
1670
|
return toEventWithLocalDates(event);
|
|
1671
1671
|
}
|
|
1672
1672
|
function updateEvent(event) {
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
return toEventWithLocalDates(event);
|
|
1679
|
-
}
|
|
1673
|
+
let id = String(event.id);
|
|
1674
|
+
let idx = $_events().findIndex((event2) => event2.id === id);
|
|
1675
|
+
if (idx >= 0) {
|
|
1676
|
+
$.store_mutate(_events, $.untrack($_events)[idx] = createEvents([event])[0], $.untrack($_events));
|
|
1677
|
+
return toEventWithLocalDates(event);
|
|
1680
1678
|
}
|
|
1681
1679
|
return null;
|
|
1682
1680
|
}
|
|
1683
1681
|
function removeEventById(id) {
|
|
1684
|
-
|
|
1682
|
+
id = String(id);
|
|
1683
|
+
let idx = $_events().findIndex((event) => event.id === id);
|
|
1685
1684
|
if (idx >= 0) {
|
|
1686
1685
|
$_events().splice(idx, 1);
|
|
1687
1686
|
$.store_set(_events, $_events());
|
|
@@ -1909,13 +1908,10 @@ function BaseEvent($$anchor, $$props) {
|
|
|
1909
1908
|
(_a = $$props.onpointerdown) == null ? void 0 : _a.apply(this, $$args);
|
|
1910
1909
|
};
|
|
1911
1910
|
{
|
|
1912
|
-
const defaultBody = ($$anchor2
|
|
1911
|
+
const defaultBody = ($$anchor2) => {
|
|
1913
1912
|
var div = root_1$a();
|
|
1914
1913
|
$.action(div, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $.get(content));
|
|
1915
|
-
$.template_effect(() =>
|
|
1916
|
-
$.set_class(div, 1, $.clsx($theme().eventBody));
|
|
1917
|
-
$.set_style(div, style2());
|
|
1918
|
-
});
|
|
1914
|
+
$.template_effect(() => $.set_class(div, 1, $.clsx($theme().eventBody)));
|
|
1919
1915
|
$.append($$anchor2, div);
|
|
1920
1916
|
};
|
|
1921
1917
|
var node = $.child(article);
|
|
@@ -3689,7 +3685,7 @@ function Event$3($$anchor, $$props) {
|
|
|
3689
3685
|
var div = $.first_child(fragment_1);
|
|
3690
3686
|
let styles_1;
|
|
3691
3687
|
var node = $.sibling(div, 2);
|
|
3692
|
-
$.snippet(node, defaultBody
|
|
3688
|
+
$.snippet(node, defaultBody);
|
|
3693
3689
|
$.template_effect(() => {
|
|
3694
3690
|
$.set_class(div, 1, $theme().eventTag);
|
|
3695
3691
|
styles_1 = $.set_style(div, "", styles_1, { "background-color": bgColor() });
|
|
@@ -4701,6 +4697,7 @@ function View$2($$anchor, $$props) {
|
|
|
4701
4697
|
const [$$stores, $$cleanup] = $.setup_stores();
|
|
4702
4698
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
4703
4699
|
const $_viewDates = () => $.store_get(_viewDates, "$_viewDates", $$stores);
|
|
4700
|
+
const $_today = () => $.store_get(_today, "$_today", $$stores);
|
|
4704
4701
|
const $_intlDayHeaderAL = () => $.store_get(_intlDayHeaderAL, "$_intlDayHeaderAL", $$stores);
|
|
4705
4702
|
const $_intlDayHeader = () => $.store_get(_intlDayHeader, "$_intlDayHeader", $$stores);
|
|
4706
4703
|
const $allDaySlot = () => $.store_get(allDaySlot, "$allDaySlot", $$stores);
|
|
@@ -4708,6 +4705,7 @@ function View$2($$anchor, $$props) {
|
|
|
4708
4705
|
_viewDates,
|
|
4709
4706
|
_intlDayHeader,
|
|
4710
4707
|
_intlDayHeaderAL,
|
|
4708
|
+
_today,
|
|
4711
4709
|
allDaySlot,
|
|
4712
4710
|
theme
|
|
4713
4711
|
} = getContext("state");
|
|
@@ -4725,16 +4723,17 @@ function View$2($$anchor, $$props) {
|
|
|
4725
4723
|
$.action(time, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $_intlDayHeader().format($.get(date)));
|
|
4726
4724
|
$.reset(div_1);
|
|
4727
4725
|
$.template_effect(
|
|
4728
|
-
($0, $1, $2) => {
|
|
4729
|
-
$.set_class(div_1, 1, `${$theme().day ?? ""} ${$0 ?? ""}`);
|
|
4730
|
-
$.set_attribute(time, "datetime", $
|
|
4731
|
-
$.set_attribute(time, "aria-label", $
|
|
4726
|
+
($0, $1, $2, $3) => {
|
|
4727
|
+
$.set_class(div_1, 1, `${$theme().day ?? ""} ${$0 ?? ""}${$1 ?? ""}`);
|
|
4728
|
+
$.set_attribute(time, "datetime", $2);
|
|
4729
|
+
$.set_attribute(time, "aria-label", $3);
|
|
4732
4730
|
},
|
|
4733
4731
|
[
|
|
4734
4732
|
() => {
|
|
4735
4733
|
var _a;
|
|
4736
4734
|
return (_a = $theme().weekdays) == null ? void 0 : _a[$.get(date).getUTCDay()];
|
|
4737
4735
|
},
|
|
4736
|
+
() => datesEqual($.get(date), $_today()) ? " " + $theme().today : "",
|
|
4738
4737
|
() => toISOString($.get(date), 10),
|
|
4739
4738
|
() => $_intlDayHeaderAL().format($.get(date))
|
|
4740
4739
|
],
|
|
@@ -4898,11 +4897,13 @@ function View$1($$anchor, $$props) {
|
|
|
4898
4897
|
const $_viewDates = () => $.store_get(_viewDates, "$_viewDates", $$stores);
|
|
4899
4898
|
const $_viewResources = () => $.store_get(_viewResources, "$_viewResources", $$stores);
|
|
4900
4899
|
const $theme = () => $.store_get(theme, "$theme", $$stores);
|
|
4900
|
+
const $_today = () => $.store_get(_today, "$_today", $$stores);
|
|
4901
4901
|
const $_intlDayHeaderAL = () => $.store_get(_intlDayHeaderAL, "$_intlDayHeaderAL", $$stores);
|
|
4902
4902
|
const $_intlDayHeader = () => $.store_get(_intlDayHeader, "$_intlDayHeader", $$stores);
|
|
4903
4903
|
const $allDaySlot = () => $.store_get(allDaySlot, "$allDaySlot", $$stores);
|
|
4904
4904
|
let {
|
|
4905
4905
|
datesAboveResources,
|
|
4906
|
+
_today,
|
|
4906
4907
|
_viewDates,
|
|
4907
4908
|
_viewResources,
|
|
4908
4909
|
_intlDayHeader,
|
|
@@ -4929,16 +4930,17 @@ function View$1($$anchor, $$props) {
|
|
|
4929
4930
|
$.action(time, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $_intlDayHeader().format($.get(item0)));
|
|
4930
4931
|
$.reset(div_2);
|
|
4931
4932
|
$.template_effect(
|
|
4932
|
-
($0, $1, $2) => {
|
|
4933
|
-
$.set_class(div_2, 1, `${$theme().day ?? ""} ${$0 ?? ""}`);
|
|
4934
|
-
$.set_attribute(time, "datetime", $
|
|
4935
|
-
$.set_attribute(time, "aria-label", $
|
|
4933
|
+
($0, $1, $2, $3) => {
|
|
4934
|
+
$.set_class(div_2, 1, `${$theme().day ?? ""} ${$0 ?? ""}${$1 ?? ""}`);
|
|
4935
|
+
$.set_attribute(time, "datetime", $2);
|
|
4936
|
+
$.set_attribute(time, "aria-label", $3);
|
|
4936
4937
|
},
|
|
4937
4938
|
[
|
|
4938
4939
|
() => {
|
|
4939
4940
|
var _a;
|
|
4940
4941
|
return (_a = $theme().weekdays) == null ? void 0 : _a[$.get(item0).getUTCDay()];
|
|
4941
4942
|
},
|
|
4943
|
+
() => datesEqual($.get(item0), $_today()) ? " " + $theme().today : "",
|
|
4942
4944
|
() => toISOString($.get(item0), 10),
|
|
4943
4945
|
() => $_intlDayHeaderAL().format($.get(item0))
|
|
4944
4946
|
]
|
|
@@ -4992,16 +4994,17 @@ function View$1($$anchor, $$props) {
|
|
|
4992
4994
|
$.action(time_1, ($$node, $$action_arg) => setContent == null ? void 0 : setContent($$node, $$action_arg), () => $_intlDayHeader().format($.get(item1)));
|
|
4993
4995
|
$.reset(div_6);
|
|
4994
4996
|
$.template_effect(
|
|
4995
|
-
($0, $1, $2) => {
|
|
4996
|
-
$.set_class(div_6, 1, `${$theme().day ?? ""} ${$0 ?? ""}`);
|
|
4997
|
-
$.set_attribute(time_1, "datetime", $
|
|
4998
|
-
$.set_attribute(time_1, "aria-label", `${resourceLabels[i] ?? ""}${$
|
|
4997
|
+
($0, $1, $2, $3) => {
|
|
4998
|
+
$.set_class(div_6, 1, `${$theme().day ?? ""} ${$0 ?? ""}${$1 ?? ""}`);
|
|
4999
|
+
$.set_attribute(time_1, "datetime", $2);
|
|
5000
|
+
$.set_attribute(time_1, "aria-label", `${resourceLabels[i] ?? ""}${$3 ?? ""}`);
|
|
4999
5001
|
},
|
|
5000
5002
|
[
|
|
5001
5003
|
() => {
|
|
5002
5004
|
var _a;
|
|
5003
5005
|
return (_a = $theme().weekdays) == null ? void 0 : _a[$.get(item1).getUTCDay()];
|
|
5004
5006
|
},
|
|
5007
|
+
() => datesEqual($.get(item1), $_today()) ? " " + $theme().today : "",
|
|
5005
5008
|
() => toISOString($.get(item1), 10),
|
|
5006
5009
|
() => $_intlDayHeaderAL().format($.get(item1))
|
|
5007
5010
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-calendar/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"title": "Event Calendar Core package",
|
|
5
5
|
"description": "Full-sized drag & drop event calendar with resource & timeline views",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"#components": "./src/lib/components/index.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"svelte": "^5.28.
|
|
35
|
+
"svelte": "^5.28.6"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/Calendar.svelte
CHANGED
|
@@ -68,19 +68,18 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function updateEvent(event) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return toEventWithLocalDates(event);
|
|
77
|
-
}
|
|
71
|
+
let id = String(event.id);
|
|
72
|
+
let idx = $_events.findIndex(event => event.id === id);
|
|
73
|
+
if (idx >= 0) {
|
|
74
|
+
$_events[idx] = createEvents([event])[0];
|
|
75
|
+
return toEventWithLocalDates(event);
|
|
78
76
|
}
|
|
79
77
|
return null;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
export function removeEventById(id) {
|
|
83
|
-
|
|
81
|
+
id = String(id);
|
|
82
|
+
let idx = $_events.findIndex(event => event.id === id);
|
|
84
83
|
if (idx >= 0) {
|
|
85
84
|
$_events.splice(idx, 1);
|
|
86
85
|
$_events = $_events;
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
{onmouseleave}
|
|
78
78
|
{onpointerdown}
|
|
79
79
|
>
|
|
80
|
-
{#snippet defaultBody(
|
|
81
|
-
<div class={$theme.eventBody}
|
|
80
|
+
{#snippet defaultBody()}
|
|
81
|
+
<div class={$theme.eventBody} use:setContent={content}></div>
|
|
82
82
|
{/snippet}
|
|
83
83
|
{#if body}
|
|
84
84
|
{@render body(defaultBody, bgColor, txtColor)}
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
<BaseEvent {chunk} {styles} onpointerdown={$_interaction.action?.noAction}>
|
|
18
18
|
{#snippet body(defaultBody, bgColor, txtColor)}
|
|
19
19
|
<div class="{$theme.eventTag}" style:background-color={bgColor}></div>
|
|
20
|
-
{@render defaultBody(
|
|
20
|
+
{@render defaultBody()}
|
|
21
21
|
{/snippet}
|
|
22
22
|
</BaseEvent>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {setContent, toISOString} from '#lib';
|
|
3
|
+
import {datesEqual, setContent, toISOString} from '#lib';
|
|
4
4
|
import {Section, Body, Day, Week} from '../time-grid/index.js';
|
|
5
5
|
import Label from './Label.svelte';
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
|
-
datesAboveResources, _viewDates, _viewResources, _intlDayHeader, _intlDayHeaderAL, allDaySlot, theme
|
|
8
|
+
datesAboveResources, _today, _viewDates, _viewResources, _intlDayHeader, _intlDayHeaderAL, allDaySlot, theme
|
|
9
9
|
} = getContext('state');
|
|
10
10
|
|
|
11
11
|
let loops = $derived($datesAboveResources ? [$_viewDates, $_viewResources] : [$_viewResources, $_viewDates]);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
{#each loops[0] as item0, i}
|
|
19
19
|
<div class="{$theme.resource}">
|
|
20
20
|
{#if $datesAboveResources}
|
|
21
|
-
<div class="{$theme.day} {$theme.weekdays?.[item0.getUTCDay()]}">
|
|
21
|
+
<div class="{$theme.day} {$theme.weekdays?.[item0.getUTCDay()]}{datesEqual(item0, $_today) ? ' ' + $theme.today : ''}">
|
|
22
22
|
<time
|
|
23
23
|
datetime="{toISOString(item0, 10)}"
|
|
24
24
|
aria-label="{$_intlDayHeaderAL.format(item0)}"
|
|
@@ -38,7 +38,10 @@
|
|
|
38
38
|
<Label resource={item1} date={item0} />
|
|
39
39
|
</div>
|
|
40
40
|
{:else}
|
|
41
|
-
<div
|
|
41
|
+
<div
|
|
42
|
+
class="{$theme.day} {$theme.weekdays?.[item1.getUTCDay()]}{datesEqual(item1, $_today) ? ' ' + $theme.today : ''}"
|
|
43
|
+
role="columnheader"
|
|
44
|
+
>
|
|
42
45
|
<time
|
|
43
46
|
datetime="{toISOString(item1, 10)}"
|
|
44
47
|
aria-label="{resourceLabels[i]}{$_intlDayHeaderAL.format(item1)}"
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import {getContext} from 'svelte';
|
|
3
|
-
import {setContent, toISOString} from '#lib';
|
|
3
|
+
import {datesEqual, setContent, toISOString} from '#lib';
|
|
4
4
|
import Section from './Section.svelte';
|
|
5
5
|
import Body from './Body.svelte';
|
|
6
6
|
import Day from './Day.svelte';
|
|
7
7
|
import Week from './all-day/Week.svelte';
|
|
8
8
|
|
|
9
|
-
let {_viewDates, _intlDayHeader, _intlDayHeaderAL, allDaySlot, theme} = getContext('state');
|
|
9
|
+
let {_viewDates, _intlDayHeader, _intlDayHeaderAL, _today, allDaySlot, theme} = getContext('state');
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<div class="{$theme.header}">
|
|
13
13
|
<Section>
|
|
14
14
|
{#each $_viewDates as date}
|
|
15
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
class="{$theme.day} {$theme.weekdays?.[date.getUTCDay()]}{datesEqual(date, $_today) ? ' ' + $theme.today : ''}"
|
|
17
|
+
role="columnheader"
|
|
18
|
+
>
|
|
16
19
|
<time
|
|
17
20
|
datetime="{toISOString(date, 10)}"
|
|
18
21
|
aria-label="{$_intlDayHeaderAL.format(date)}"
|
package/src/styles/index.scss
CHANGED
|
@@ -284,6 +284,13 @@
|
|
|
284
284
|
top: 0;
|
|
285
285
|
z-index: 2;
|
|
286
286
|
}
|
|
287
|
+
.ec-day.ec-today .ec-day-head:before {
|
|
288
|
+
content: '';
|
|
289
|
+
position: absolute;
|
|
290
|
+
inset: 0;
|
|
291
|
+
z-index: -1;
|
|
292
|
+
background-color: var(--ec-today-bg-color);
|
|
293
|
+
}
|
|
287
294
|
|
|
288
295
|
.ec-day:first-child .ec-day-head {
|
|
289
296
|
border-top: none;
|