@fullcalendar/icalendar 7.0.0-beta.3 → 7.0.0-beta.5
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/LICENSE.md +1 -1
- package/README.md +7 -1
- package/{index.cjs → cjs/index.cjs} +10 -26
- package/{index.js → esm/index.js} +3 -3
- package/{index.global.js → global.js} +7 -23
- package/global.min.js +6 -0
- package/package.json +18 -15
- package/index.global.min.js +0 -6
- /package/{index.d.ts → esm/index.d.ts} +0 -0
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -25,12 +25,18 @@ Instantiate a Calendar with the necessary plugins and options:
|
|
|
25
25
|
import { Calendar } from '@fullcalendar/core'
|
|
26
26
|
import iCalendarPlugin from '@fullcalendar/icalendar'
|
|
27
27
|
import dayGridPlugin from '@fullcalendar/daygrid'
|
|
28
|
+
import classicThemePlugin from '@fullcalendar/theme-classic'
|
|
29
|
+
|
|
30
|
+
import '@fullcalendar/core/skeleton.css'
|
|
31
|
+
import '@fullcalendar/theme-classic/theme.css'
|
|
32
|
+
import '@fullcalendar/theme-classic/palette.css'
|
|
28
33
|
|
|
29
34
|
const calendarEl = document.getElementById('calendar')
|
|
30
35
|
const calendar = new Calendar(calendarEl, {
|
|
31
36
|
plugins: [
|
|
32
37
|
iCalendarPlugin,
|
|
33
|
-
dayGridPlugin
|
|
38
|
+
dayGridPlugin,
|
|
39
|
+
classicThemePlugin
|
|
34
40
|
],
|
|
35
41
|
initialView: 'dayGridMonth',
|
|
36
42
|
events: {
|
|
@@ -2,38 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var core = require('@fullcalendar/core');
|
|
6
|
+
var internal = require('@fullcalendar/core/internal');
|
|
7
7
|
var ICAL = require('ical.js');
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n["default"] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
10
|
|
|
27
|
-
var
|
|
11
|
+
var ICAL__default = /*#__PURE__*/_interopDefaultLegacy(ICAL);
|
|
28
12
|
|
|
29
13
|
/* eslint-disable */
|
|
30
14
|
class IcalExpander {
|
|
31
15
|
constructor(opts) {
|
|
32
16
|
this.maxIterations = opts.maxIterations != null ? opts.maxIterations : 1000;
|
|
33
17
|
this.skipInvalidDates = opts.skipInvalidDates != null ? opts.skipInvalidDates : false;
|
|
34
|
-
this.jCalData =
|
|
35
|
-
this.component = new
|
|
36
|
-
this.events = this.component.getAllSubcomponents('vevent').map(vevent => new
|
|
18
|
+
this.jCalData = ICAL__default["default"].parse(opts.ics);
|
|
19
|
+
this.component = new ICAL__default["default"].Component(this.jCalData);
|
|
20
|
+
this.events = this.component.getAllSubcomponents('vevent').map(vevent => new ICAL__default["default"].Event(vevent));
|
|
37
21
|
if (this.skipInvalidDates) {
|
|
38
22
|
this.events = this.events.filter((evt) => {
|
|
39
23
|
try {
|
|
@@ -168,8 +152,8 @@ const eventSourceDef = {
|
|
|
168
152
|
function expandICalEvents(iCalExpander, range) {
|
|
169
153
|
// expand the range. because our `range` is timeZone-agnostic UTC
|
|
170
154
|
// or maybe because ical.js always produces dates in local time? i forget
|
|
171
|
-
let rangeStart =
|
|
172
|
-
let rangeEnd =
|
|
155
|
+
let rangeStart = internal.addDays(range.start, -1);
|
|
156
|
+
let rangeEnd = internal.addDays(range.end, 1);
|
|
173
157
|
let iCalRes = iCalExpander.between(rangeStart, rangeEnd); // end inclusive. will give extra results
|
|
174
158
|
let expanded = [];
|
|
175
159
|
// TODO: instead of using startDate/endDate.toString to communicate allDay,
|
|
@@ -209,7 +193,7 @@ function specifiesEnd(iCalEvent) {
|
|
|
209
193
|
Boolean(iCalEvent.component.getFirstProperty('duration'));
|
|
210
194
|
}
|
|
211
195
|
|
|
212
|
-
var index =
|
|
196
|
+
var index = core.createPlugin({
|
|
213
197
|
name: '@fullcalendar/icalendar',
|
|
214
198
|
eventSourceDefs: [eventSourceDef],
|
|
215
199
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createPlugin } from '@fullcalendar/core
|
|
2
|
-
import { addDays } from '@fullcalendar/core/internal
|
|
3
|
-
import
|
|
1
|
+
import { createPlugin } from '@fullcalendar/core';
|
|
2
|
+
import { addDays } from '@fullcalendar/core/internal';
|
|
3
|
+
import ICAL from 'ical.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
class IcalExpander {
|
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar iCalendar Plugin v7.0.0-beta.
|
|
2
|
+
FullCalendar iCalendar Plugin v7.0.0-beta.5
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/icalendar
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2025 Adam Shaw
|
|
5
5
|
*/
|
|
6
6
|
FullCalendar.ICalendar = (function (exports, core, internal, ICAL) {
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n["default"] = e;
|
|
24
|
-
return n;
|
|
25
|
-
}
|
|
9
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
26
10
|
|
|
27
|
-
var
|
|
11
|
+
var ICAL__default = /*#__PURE__*/_interopDefault(ICAL);
|
|
28
12
|
|
|
29
13
|
/* eslint-disable */
|
|
30
14
|
class IcalExpander {
|
|
31
15
|
constructor(opts) {
|
|
32
16
|
this.maxIterations = opts.maxIterations != null ? opts.maxIterations : 1000;
|
|
33
17
|
this.skipInvalidDates = opts.skipInvalidDates != null ? opts.skipInvalidDates : false;
|
|
34
|
-
this.jCalData =
|
|
35
|
-
this.component = new
|
|
36
|
-
this.events = this.component.getAllSubcomponents('vevent').map(vevent => new
|
|
18
|
+
this.jCalData = ICAL__default["default"].parse(opts.ics);
|
|
19
|
+
this.component = new ICAL__default["default"].Component(this.jCalData);
|
|
20
|
+
this.events = this.component.getAllSubcomponents('vevent').map(vevent => new ICAL__default["default"].Event(vevent));
|
|
37
21
|
if (this.skipInvalidDates) {
|
|
38
22
|
this.events = this.events.filter((evt) => {
|
|
39
23
|
try {
|
package/global.min.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
FullCalendar iCalendar Plugin v7.0.0-beta.5
|
|
3
|
+
Docs & License: https://fullcalendar.io/docs/icalendar
|
|
4
|
+
(c) 2025 Adam Shaw
|
|
5
|
+
*/
|
|
6
|
+
FullCalendar.ICalendar=function(e,t,n,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var s=a(r);class i{constructor(e){this.maxIterations=null!=e.maxIterations?e.maxIterations:1e3,this.skipInvalidDates=null!=e.skipInvalidDates&&e.skipInvalidDates,this.jCalData=s.default.parse(e.ics),this.component=new s.default.Component(this.jCalData),this.events=this.component.getAllSubcomponents("vevent").map(e=>new s.default.Event(e)),this.skipInvalidDates&&(this.events=this.events.filter(e=>{try{return e.startDate.toJSDate(),e.endDate.toJSDate(),!0}catch(e){return!1}}))}between(e,t){function n(n,r){return(!e||r>=e.getTime())&&(!t||n<=t.getTime())}function r(e){const t=e.startDate.toJSDate().getTime();let n=e.endDate.toJSDate().getTime();return e.endDate.isDate&&n>t&&(n-=1),{startTime:t,endTime:n}}const a=[];this.events.forEach(e=>{e.isRecurrenceException()&&a.push(e)});const s={events:[],occurrences:[]};return this.events.filter(e=>!e.isRecurrenceException()).forEach(e=>{const i=[];if(e.component.getAllProperties("exdate").forEach(e=>{const t=e.getFirstValue();i.push(t.toJSDate().getTime())}),e.isRecurring()){const o=e.iterator();let l,u=0;do{if(u+=1,l=o.next(),l){const o=e.getOccurrenceDetails(l),{startTime:u,endTime:c}=r(o),d=-1!==i.indexOf(u),p=a.find(t=>t.uid===e.uid&&t.recurrenceId.toJSDate().getTime()===o.startDate.toJSDate().getTime());if(t&&u>t.getTime())break;n(u,c)&&(p?s.events.push(p):d||s.occurrences.push(o))}}while(l&&(!this.maxIterations||u<this.maxIterations));return}const{startTime:o,endTime:l}=r(e);n(o,l)&&s.events.push(e)}),s}before(e){return this.between(void 0,e)}after(e){return this.between(e)}all(){return this.between()}}const o={parseMeta:e=>e.url&&"ics"===e.format?{url:e.url,format:"ics"}:null,fetch(e,t,n){let r=e.eventSource.meta,{internalState:a}=r;a&&!e.isRefetch||(a=r.internalState={response:null,iCalExpanderPromise:fetch(r.url,{method:"GET"}).then(e=>e.text().then(t=>(a.response=e,new i({ics:t,skipInvalidDates:!0}))))}),a.iCalExpanderPromise.then(n=>{t({rawEvents:l(n,e.range),response:a.response})},n)}};function l(e,t){let r=n.addDays(t.start,-1),a=n.addDays(t.end,1),s=e.between(r,a),i=[];for(let e of s.events)i.push(Object.assign(Object.assign({},u(e)),{start:e.startDate.toString(),end:d(e)&&e.endDate?e.endDate.toString():null}));for(let e of s.occurrences){let t=e.item;i.push(Object.assign(Object.assign({},u(t)),{start:e.startDate.toString(),end:d(t)&&e.endDate?e.endDate.toString():null}))}return i}function u(e){return{title:e.summary,url:c(e),extendedProps:{location:e.location,organizer:e.organizer,description:e.description}}}function c(e){let t=e.component.getFirstProperty("url");return t?t.getFirstValue():""}function d(e){return Boolean(e.component.getFirstProperty("dtend"))||Boolean(e.component.getFirstProperty("duration"))}var p=t.createPlugin({name:"@fullcalendar/icalendar",eventSourceDefs:[o]});return t.globalPlugins.push(p),e.default=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.Internal,ICAL);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/icalendar",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.5",
|
|
4
4
|
"title": "FullCalendar iCalendar Plugin",
|
|
5
5
|
"description": "Display events from a public iCalendar feed",
|
|
6
6
|
"keywords": [
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://fullcalendar.io/docs/icalendar",
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@fullcalendar/core": "7.0.0-beta.
|
|
17
|
-
"ical.js": "^
|
|
16
|
+
"@fullcalendar/core": "7.0.0-beta.5",
|
|
17
|
+
"ical.js": "^2.0.0"
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"bugs": "https://fullcalendar.io/reporting-bugs",
|
|
@@ -29,21 +29,24 @@
|
|
|
29
29
|
"email": "arshaw@arshaw.com",
|
|
30
30
|
"url": "http://arshaw.com/"
|
|
31
31
|
},
|
|
32
|
-
"copyright": "
|
|
33
|
-
"types": "./index.d.ts",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"unpkg": "./
|
|
37
|
-
"jsdelivr": "./
|
|
32
|
+
"copyright": "2025 Adam Shaw",
|
|
33
|
+
"types": "./esm/index.d.ts",
|
|
34
|
+
"module": "./esm/index.js",
|
|
35
|
+
"main": "./cjs/index.cjs",
|
|
36
|
+
"unpkg": "./global.min.js",
|
|
37
|
+
"jsdelivr": "./global.min.js",
|
|
38
38
|
"exports": {
|
|
39
39
|
"./package.json": "./package.json",
|
|
40
|
-
"./index.cjs": "./index.cjs",
|
|
41
|
-
"./index.js": "./index.js",
|
|
42
40
|
".": {
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./esm/index.d.ts",
|
|
43
|
+
"default": "./esm/index.js"
|
|
44
|
+
},
|
|
45
|
+
"require": "./cjs/index.cjs"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
"sideEffects":
|
|
48
|
+
"sideEffects": [
|
|
49
|
+
"./global.js",
|
|
50
|
+
"./global.min.js"
|
|
51
|
+
]
|
|
49
52
|
}
|
package/index.global.min.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
FullCalendar iCalendar Plugin v7.0.0-beta.3
|
|
3
|
-
Docs & License: https://fullcalendar.io/docs/icalendar
|
|
4
|
-
(c) 2024 Adam Shaw
|
|
5
|
-
*/
|
|
6
|
-
FullCalendar.ICalendar=function(e,t,n,r){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,t}var s=a(r);class i{constructor(e){this.maxIterations=null!=e.maxIterations?e.maxIterations:1e3,this.skipInvalidDates=null!=e.skipInvalidDates&&e.skipInvalidDates,this.jCalData=s.parse(e.ics),this.component=new s.Component(this.jCalData),this.events=this.component.getAllSubcomponents("vevent").map(e=>new s.Event(e)),this.skipInvalidDates&&(this.events=this.events.filter(e=>{try{return e.startDate.toJSDate(),e.endDate.toJSDate(),!0}catch(e){return!1}}))}between(e,t){function n(n,r){return(!e||r>=e.getTime())&&(!t||n<=t.getTime())}function r(e){const t=e.startDate.toJSDate().getTime();let n=e.endDate.toJSDate().getTime();return e.endDate.isDate&&n>t&&(n-=1),{startTime:t,endTime:n}}const a=[];this.events.forEach(e=>{e.isRecurrenceException()&&a.push(e)});const s={events:[],occurrences:[]};return this.events.filter(e=>!e.isRecurrenceException()).forEach(e=>{const i=[];if(e.component.getAllProperties("exdate").forEach(e=>{const t=e.getFirstValue();i.push(t.toJSDate().getTime())}),e.isRecurring()){const o=e.iterator();let c,l=0;do{if(l+=1,c=o.next(),c){const o=e.getOccurrenceDetails(c),{startTime:l,endTime:u}=r(o),d=-1!==i.indexOf(l),p=a.find(t=>t.uid===e.uid&&t.recurrenceId.toJSDate().getTime()===o.startDate.toJSDate().getTime());if(t&&l>t.getTime())break;n(l,u)&&(p?s.events.push(p):d||s.occurrences.push(o))}}while(c&&(!this.maxIterations||l<this.maxIterations));return}const{startTime:o,endTime:c}=r(e);n(o,c)&&s.events.push(e)}),s}before(e){return this.between(void 0,e)}after(e){return this.between(e)}all(){return this.between()}}const o={parseMeta:e=>e.url&&"ics"===e.format?{url:e.url,format:"ics"}:null,fetch(e,t,n){let r=e.eventSource.meta,{internalState:a}=r;a&&!e.isRefetch||(a=r.internalState={response:null,iCalExpanderPromise:fetch(r.url,{method:"GET"}).then(e=>e.text().then(t=>(a.response=e,new i({ics:t,skipInvalidDates:!0}))))}),a.iCalExpanderPromise.then(n=>{t({rawEvents:c(n,e.range),response:a.response})},n)}};function c(e,t){let r=n.addDays(t.start,-1),a=n.addDays(t.end,1),s=e.between(r,a),i=[];for(let e of s.events)i.push(Object.assign(Object.assign({},l(e)),{start:e.startDate.toString(),end:d(e)&&e.endDate?e.endDate.toString():null}));for(let e of s.occurrences){let t=e.item;i.push(Object.assign(Object.assign({},l(t)),{start:e.startDate.toString(),end:d(t)&&e.endDate?e.endDate.toString():null}))}return i}function l(e){return{title:e.summary,url:u(e),extendedProps:{location:e.location,organizer:e.organizer,description:e.description}}}function u(e){let t=e.component.getFirstProperty("url");return t?t.getFirstValue():""}function d(e){return Boolean(e.component.getFirstProperty("dtend"))||Boolean(e.component.getFirstProperty("duration"))}var p=t.createPlugin({name:"@fullcalendar/icalendar",eventSourceDefs:[o]});return t.globalPlugins.push(p),e.default=p,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,FullCalendar.Internal,ICAL);
|
|
File without changes
|