diff options
author | Mario <mario@mariovavti.com> | 2020-06-15 08:19:13 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2020-06-15 08:19:13 +0000 |
commit | 56ec55110a27a13cc2c7d1fb09f1650f8c4cd842 (patch) | |
tree | 1ed6199b0d09b232b3ba5dce28a0a0134242df55 /library/fullcalendar/packages/google-calendar | |
parent | 570497071d7dc231be6ab0eee951c22f1ad05df2 (diff) | |
download | volse-hubzilla-56ec55110a27a13cc2c7d1fb09f1650f8c4cd842.tar.gz volse-hubzilla-56ec55110a27a13cc2c7d1fb09f1650f8c4cd842.tar.bz2 volse-hubzilla-56ec55110a27a13cc2c7d1fb09f1650f8c4cd842.zip |
update fullcalendar to version 4.4.2
Diffstat (limited to 'library/fullcalendar/packages/google-calendar')
7 files changed, 269 insertions, 28 deletions
diff --git a/library/fullcalendar/packages/google-calendar/LICENSE.txt b/library/fullcalendar/packages/google-calendar/LICENSE.txt new file mode 100644 index 000000000..2149cfbef --- /dev/null +++ b/library/fullcalendar/packages/google-calendar/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2019 Adam Shaw + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/library/fullcalendar/packages/google-calendar/README.md b/library/fullcalendar/packages/google-calendar/README.md new file mode 100644 index 000000000..a4d6c5cc0 --- /dev/null +++ b/library/fullcalendar/packages/google-calendar/README.md @@ -0,0 +1,8 @@ + +# FullCalendar Google Calendar Plugin + +Fetch events from a public Google Calendar feed + +[View the docs »](https://fullcalendar.io/docs/google-calendar) + +This package was created from the [FullCalendar monorepo »](https://github.com/fullcalendar/fullcalendar) diff --git a/library/fullcalendar/packages/google-calendar/main.d.ts b/library/fullcalendar/packages/google-calendar/main.d.ts new file mode 100644 index 000000000..1ed96f778 --- /dev/null +++ b/library/fullcalendar/packages/google-calendar/main.d.ts @@ -0,0 +1,21 @@ +// Generated by dts-bundle v0.7.3-fork.1 +// Dependencies for this module: +// main.d.ts + +declare module '@fullcalendar/google-calendar' { + module '@fullcalendar/core' { + interface OptionsInput { + googleCalendarApiKey?: string; + } + } + module '@fullcalendar/core/structs/event-source' { + interface ExtendedEventSourceInput { + googleCalendarApiKey?: string; + googleCalendarId?: string; + googleCalendarApiBase?: string; + } + } + const _default: import("@fullcalendar/core").PluginDef; + export default _default; +} + diff --git a/library/fullcalendar/packages/google-calendar/main.esm.js b/library/fullcalendar/packages/google-calendar/main.esm.js new file mode 100644 index 000000000..58cb94106 --- /dev/null +++ b/library/fullcalendar/packages/google-calendar/main.esm.js @@ -0,0 +1,167 @@ +/*! +FullCalendar Google Calendar Plugin v4.4.2 +Docs & License: https://fullcalendar.io/ +(c) 2019 Adam Shaw +*/ + +import { createPlugin, refineProps, requestJson, addDays } from '@fullcalendar/core'; + +/*! *****************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+
+var __assign = function() {
+ __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+}; + +// TODO: expose somehow +var API_BASE = 'https://www.googleapis.com/calendar/v3/calendars'; +var STANDARD_PROPS = { + url: String, + googleCalendarApiKey: String, + googleCalendarId: String, + googleCalendarApiBase: String, + data: null +}; +var eventSourceDef = { + parseMeta: function (raw) { + if (typeof raw === 'string') { + raw = { url: raw }; + } + if (typeof raw === 'object') { + var standardProps = refineProps(raw, STANDARD_PROPS); + if (!standardProps.googleCalendarId && standardProps.url) { + standardProps.googleCalendarId = parseGoogleCalendarId(standardProps.url); + } + delete standardProps.url; + if (standardProps.googleCalendarId) { + return standardProps; + } + } + return null; + }, + fetch: function (arg, onSuccess, onFailure) { + var calendar = arg.calendar; + var meta = arg.eventSource.meta; + var apiKey = meta.googleCalendarApiKey || calendar.opt('googleCalendarApiKey'); + if (!apiKey) { + onFailure({ + message: 'Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/' + }); + } + else { + var url = buildUrl(meta); + var requestParams_1 = buildRequestParams(arg.range, apiKey, meta.data, calendar.dateEnv); + requestJson('GET', url, requestParams_1, function (body, xhr) { + if (body.error) { + onFailure({ + message: 'Google Calendar API: ' + body.error.message, + errors: body.error.errors, + xhr: xhr + }); + } + else { + onSuccess({ + rawEvents: gcalItemsToRawEventDefs(body.items, requestParams_1.timeZone), + xhr: xhr + }); + } + }, function (message, xhr) { + onFailure({ message: message, xhr: xhr }); + }); + } + } +}; +function parseGoogleCalendarId(url) { + var match; + // detect if the ID was specified as a single string. + // will match calendars like "asdf1234@calendar.google.com" in addition to person email calendars. + if (/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(url)) { + return url; + } + else if ((match = /^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(url)) || + (match = /^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(url))) { + return decodeURIComponent(match[1]); + } +} +function buildUrl(meta) { + var apiBase = meta.googleCalendarApiBase; + if (!apiBase) { + apiBase = API_BASE; + } + return apiBase + '/' + encodeURIComponent(meta.googleCalendarId) + '/events'; +} +function buildRequestParams(range, apiKey, extraParams, dateEnv) { + var params; + var startStr; + var endStr; + if (dateEnv.canComputeOffset) { + // strings will naturally have offsets, which GCal needs + startStr = dateEnv.formatIso(range.start); + endStr = dateEnv.formatIso(range.end); + } + else { + // when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day + // from the UTC day-start to guarantee we're getting all the events + // (start/end will be UTC-coerced dates, so toISOString is okay) + startStr = addDays(range.start, -1).toISOString(); + endStr = addDays(range.end, 1).toISOString(); + } + params = __assign({}, (extraParams || {}), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 }); + if (dateEnv.timeZone !== 'local') { + params.timeZone = dateEnv.timeZone; + } + return params; +} +function gcalItemsToRawEventDefs(items, gcalTimezone) { + return items.map(function (item) { + return gcalItemToRawEventDef(item, gcalTimezone); + }); +} +function gcalItemToRawEventDef(item, gcalTimezone) { + var url = item.htmlLink || null; + // make the URLs for each event show times in the correct timezone + if (url && gcalTimezone) { + url = injectQsComponent(url, 'ctz=' + gcalTimezone); + } + return { + id: item.id, + title: item.summary, + start: item.start.dateTime || item.start.date, + end: item.end.dateTime || item.end.date, + url: url, + location: item.location, + description: item.description + }; +} +// Injects a string like "arg=value" into the querystring of a URL +// TODO: move to a general util file? +function injectQsComponent(url, component) { + // inject it after the querystring but before the fragment + return url.replace(/(\?.*?)?(#|$)/, function (whole, qs, hash) { + return (qs ? qs + '&' : '?') + component + hash; + }); +} +var main = createPlugin({ + eventSourceDefs: [eventSourceDef] +}); + +export default main; diff --git a/library/fullcalendar/packages/google-calendar/main.js b/library/fullcalendar/packages/google-calendar/main.js index 89ce3d7a6..adf80e6a7 100644 --- a/library/fullcalendar/packages/google-calendar/main.js +++ b/library/fullcalendar/packages/google-calendar/main.js @@ -1,8 +1,9 @@ /*! -FullCalendar Google Calendar Plugin v4.0.2 +FullCalendar Google Calendar Plugin v4.4.2 Docs & License: https://fullcalendar.io/ (c) 2019 Adam Shaw */ + (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@fullcalendar/core')) : typeof define === 'function' && define.amd ? define(['exports', '@fullcalendar/core'], factory) : @@ -10,18 +11,18 @@ Docs & License: https://fullcalendar.io/ }(this, function (exports, core) { 'use strict'; /*! *****************************************************************************
- Copyright (c) Microsoft Corporation. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of the
- License at http://www.apache.org/licenses/LICENSE-2.0
+ Copyright (c) Microsoft Corporation.
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
- MERCHANTABLITY OR NON-INFRINGEMENT.
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
- See the Apache Version 2.0 License for specific language governing permissions
- and limitations under the License.
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var __assign = function() {
@@ -41,6 +42,7 @@ Docs & License: https://fullcalendar.io/ url: String, googleCalendarApiKey: String, googleCalendarId: String, + googleCalendarApiBase: String, data: null }; var eventSourceDef = { @@ -105,7 +107,11 @@ Docs & License: https://fullcalendar.io/ } } function buildUrl(meta) { - return API_BASE + '/' + encodeURIComponent(meta.googleCalendarId) + '/events'; + var apiBase = meta.googleCalendarApiBase; + if (!apiBase) { + apiBase = API_BASE; + } + return apiBase + '/' + encodeURIComponent(meta.googleCalendarId) + '/events'; } function buildRequestParams(range, apiKey, extraParams, dateEnv) { var params; diff --git a/library/fullcalendar/packages/google-calendar/main.min.js b/library/fullcalendar/packages/google-calendar/main.min.js index 51947e659..63ee15585 100644 --- a/library/fullcalendar/packages/google-calendar/main.min.js +++ b/library/fullcalendar/packages/google-calendar/main.min.js @@ -1,20 +1,6 @@ /*! -FullCalendar Google Calendar Plugin v4.0.2 +FullCalendar Google Calendar Plugin v4.4.2 Docs & License: https://fullcalendar.io/ (c) 2019 Adam Shaw */ -!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],r):(e=e||self,r(e.FullCalendarGoogleCalendar={},e.FullCalendar))}(this,function(e,r){"use strict";function t(e){var r;return/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(e)?e:(r=/^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(e))||(r=/^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(e))?decodeURIComponent(r[1]):void 0}function n(e){return s+"/"+encodeURIComponent(e.googleCalendarId)+"/events"}function o(e,t,n,o){var a,l,i;return o.canComputeOffset?(l=o.formatIso(e.start),i=o.formatIso(e.end)):(l=r.addDays(e.start,-1).toISOString(),i=r.addDays(e.end,1).toISOString()),a=d({},n||{},{key:t,timeMin:l,timeMax:i,singleEvents:!0,maxResults:9999}),"local"!==o.timeZone&&(a.timeZone=o.timeZone),a}function a(e,r){return e.map(function(e){return l(e,r)})}function l(e,r){var t=e.htmlLink||null;return t&&r&&(t=i(t,"ctz="+r)),{id:e.id,title:e.summary,start:e.start.dateTime||e.start.date,end:e.end.dateTime||e.end.date,url:t,location:e.location,description:e.description}}function i(e,r){return e.replace(/(\?.*?)?(#|$)/,function(e,t,n){return(t?t+"&":"?")+r+n})}/*! ***************************************************************************** - Copyright (c) Microsoft Corporation. All rights reserved. - Licensed under the Apache License, Version 2.0 (the "License"); you may not use - this file except in compliance with the License. You may obtain a copy of the - License at http://www.apache.org/licenses/LICENSE-2.0 - - THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED - WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. - - See the Apache Version 2.0 License for specific language governing permissions - and limitations under the License. - ***************************************************************************** */ -var d=function(){return d=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++){r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},d.apply(this,arguments)},s="https://www.googleapis.com/calendar/v3/calendars",c={url:String,googleCalendarApiKey:String,googleCalendarId:String,data:null},u={parseMeta:function(e){if("string"==typeof e&&(e={url:e}),"object"==typeof e){var n=r.refineProps(e,c);if(!n.googleCalendarId&&n.url&&(n.googleCalendarId=t(n.url)),delete n.url,n.googleCalendarId)return n}return null},fetch:function(e,t,l){var i=e.calendar,d=e.eventSource.meta,s=d.googleCalendarApiKey||i.opt("googleCalendarApiKey");if(s){var c=n(d),u=o(e.range,s,d.data,i.dateEnv);r.requestJson("GET",c,u,function(e,r){e.error?l({message:"Google Calendar API: "+e.error.message,errors:e.error.errors,xhr:r}):t({rawEvents:a(e.items,u.timeZone),xhr:r})},function(e,r){l({message:e,xhr:r})})}else l({message:"Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/"})}},g=r.createPlugin({eventSourceDefs:[u]});e.default=g,Object.defineProperty(e,"__esModule",{value:!0})});
\ No newline at end of file +!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","@fullcalendar/core"],r):r((e=e||self).FullCalendarGoogleCalendar={},e.FullCalendar)}(this,(function(e,r){"use strict";var n=function(){return(n=Object.assign||function(e){for(var r,n=1,t=arguments.length;n<t;n++)for(var a in r=arguments[n])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e}).apply(this,arguments)},t={url:String,googleCalendarApiKey:String,googleCalendarId:String,googleCalendarApiBase:String,data:null},a={parseMeta:function(e){if("string"==typeof e&&(e={url:e}),"object"==typeof e){var n=r.refineProps(e,t);if(!n.googleCalendarId&&n.url&&(n.googleCalendarId=function(e){var r;if(/^[^\/]+@([^\/\.]+\.)*(google|googlemail|gmail)\.com$/.test(e))return e;if((r=/^https:\/\/www.googleapis.com\/calendar\/v3\/calendars\/([^\/]*)/.exec(e))||(r=/^https?:\/\/www.google.com\/calendar\/feeds\/([^\/]*)/.exec(e)))return decodeURIComponent(r[1])}(n.url)),delete n.url,n.googleCalendarId)return n}return null},fetch:function(e,t,a){var o=e.calendar,l=e.eventSource.meta,i=l.googleCalendarApiKey||o.opt("googleCalendarApiKey");if(i){var d=function(e){var r=e.googleCalendarApiBase;r||(r="https://www.googleapis.com/calendar/v3/calendars");return r+"/"+encodeURIComponent(e.googleCalendarId)+"/events"}(l),s=function(e,t,a,o){var l,i,d;o.canComputeOffset?(i=o.formatIso(e.start),d=o.formatIso(e.end)):(i=r.addDays(e.start,-1).toISOString(),d=r.addDays(e.end,1).toISOString());l=n({},a||{},{key:t,timeMin:i,timeMax:d,singleEvents:!0,maxResults:9999}),"local"!==o.timeZone&&(l.timeZone=o.timeZone);return l}(e.range,i,l.data,o.dateEnv);r.requestJson("GET",d,s,(function(e,r){var n,o;e.error?a({message:"Google Calendar API: "+e.error.message,errors:e.error.errors,xhr:r}):t({rawEvents:(n=e.items,o=s.timeZone,n.map((function(e){return function(e,r){var n=e.htmlLink||null;n&&r&&(n=function(e,r){return e.replace(/(\?.*?)?(#|$)/,(function(e,n,t){return(n?n+"&":"?")+r+t}))}(n,"ctz="+r));return{id:e.id,title:e.summary,start:e.start.dateTime||e.start.date,end:e.end.dateTime||e.end.date,url:n,location:e.location,description:e.description}}(e,o)}))),xhr:r})}),(function(e,r){a({message:e,xhr:r})}))}else a({message:"Specify a googleCalendarApiKey. See http://fullcalendar.io/docs/google_calendar/"})}};var o=r.createPlugin({eventSourceDefs:[a]});e.default=o,Object.defineProperty(e,"__esModule",{value:!0})}));
\ No newline at end of file diff --git a/library/fullcalendar/packages/google-calendar/package.json b/library/fullcalendar/packages/google-calendar/package.json new file mode 100644 index 000000000..e701b3802 --- /dev/null +++ b/library/fullcalendar/packages/google-calendar/package.json @@ -0,0 +1,33 @@ +{ + "name": "@fullcalendar/google-calendar", + "version": "4.4.2", + "title": "FullCalendar Google Calendar Plugin", + "description": "Fetch events from a public Google Calendar feed", + "keywords": [ + "calendar", + "event", + "full-sized" + ], + "homepage": "https://fullcalendar.io/", + "docs": "https://fullcalendar.io/docs/google-calendar", + "bugs": "https://fullcalendar.io/reporting-bugs", + "repository": { + "type": "git", + "url": "https://github.com/fullcalendar/fullcalendar.git", + "homepage": "https://github.com/fullcalendar/fullcalendar" + }, + "license": "MIT", + "author": { + "name": "Adam Shaw", + "email": "arshaw@arshaw.com", + "url": "http://arshaw.com/" + }, + "copyright": "2019 Adam Shaw", + "peerDependencies": { + "@fullcalendar/core": "~4.4.0" + }, + "main": "main.js", + "module": "main.esm.js", + "unpkg": "main.min.js", + "types": "main.d.ts" +} |