ical-generator 6.0.2-develop.8 → 7.0.0-develop.1
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 +8 -11
- package/dist/index.cjs +38 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +39 -39
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/event.ts +29 -11
- package/src/index.ts +2 -0
- package/src/types.ts +7 -1
package/package.json
CHANGED
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"esm": "^3.2.25",
|
|
26
26
|
"license-checker": "^25.0.1",
|
|
27
27
|
"luxon": "^3.4.4",
|
|
28
|
-
"mocha": "^10.
|
|
28
|
+
"mocha": "^10.3.0",
|
|
29
29
|
"mochawesome": "^7.1.3",
|
|
30
30
|
"moment": "^2.30.1",
|
|
31
31
|
"moment-timezone": "^0.5.45",
|
|
32
32
|
"nyc": "^15.1.0",
|
|
33
33
|
"rrule": "^2.8.1",
|
|
34
|
-
"semantic-release": "^23.0.
|
|
34
|
+
"semantic-release": "^23.0.2",
|
|
35
35
|
"semantic-release-license": "^1.0.2",
|
|
36
36
|
"source-map-support": "^0.5.21",
|
|
37
37
|
"ts-node": "^10.9.2",
|
|
38
|
-
"tsup": "^8.0.
|
|
39
|
-
"typedoc": "^0.25.
|
|
38
|
+
"tsup": "^8.0.2",
|
|
39
|
+
"typedoc": "^0.25.8",
|
|
40
40
|
"typescript": "^5.3.3"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"test": "mocha"
|
|
126
126
|
},
|
|
127
127
|
"type": "module",
|
|
128
|
-
"version": "
|
|
128
|
+
"version": "7.0.0-develop.1"
|
|
129
129
|
}
|
package/src/event.ts
CHANGED
|
@@ -880,7 +880,7 @@ export default class ICalEvent {
|
|
|
880
880
|
|
|
881
881
|
/**
|
|
882
882
|
* Set the event's location by passing a string (minimum) or
|
|
883
|
-
* an {@link
|
|
883
|
+
* an {@link ICalLocationWithTitle} object which will also fill the iCal
|
|
884
884
|
* `GEO` attribute and Apple's `X-APPLE-STRUCTURED-LOCATION`.
|
|
885
885
|
*
|
|
886
886
|
* ```javascript
|
|
@@ -904,6 +904,22 @@ export default class ICalEvent {
|
|
|
904
904
|
* GEO:52.50363;13.32865
|
|
905
905
|
* ```
|
|
906
906
|
*
|
|
907
|
+
* Since v6.1.0 you can also pass a {@link ICalLocationWithoutTitle} object to pass
|
|
908
|
+
* the geolocation only. This will only fill the iCal `GEO` attribute.
|
|
909
|
+
*
|
|
910
|
+
* ```javascript
|
|
911
|
+
* event.location({
|
|
912
|
+
* geo: {
|
|
913
|
+
* lat: 52.503630,
|
|
914
|
+
* lon: 13.328650
|
|
915
|
+
* }
|
|
916
|
+
* });
|
|
917
|
+
* ```
|
|
918
|
+
*
|
|
919
|
+
* ```text
|
|
920
|
+
* GEO:52.50363;13.32865
|
|
921
|
+
* ```
|
|
922
|
+
*
|
|
907
923
|
* @since 0.2.0
|
|
908
924
|
*/
|
|
909
925
|
location(location: ICalLocation | string | null): this;
|
|
@@ -917,10 +933,11 @@ export default class ICalEvent {
|
|
|
917
933
|
};
|
|
918
934
|
return this;
|
|
919
935
|
}
|
|
920
|
-
if (
|
|
921
|
-
(location && !location.title) ||
|
|
922
|
-
(location?.geo && (!isFinite(location.geo.lat) || !isFinite(location.geo.lon)))
|
|
923
|
-
|
|
936
|
+
if (location && (
|
|
937
|
+
('title' in location && !location.title) ||
|
|
938
|
+
(location?.geo && (!isFinite(location.geo.lat) || !isFinite(location.geo.lon))) ||
|
|
939
|
+
(!('title' in location) && !location?.geo)
|
|
940
|
+
)) {
|
|
924
941
|
throw new Error(
|
|
925
942
|
'`location` isn\'t formatted correctly. See https://sebbo2002.github.io/ical-generator/'+
|
|
926
943
|
'develop/reference/classes/ICalEvent.html#location'
|
|
@@ -1751,7 +1768,7 @@ export default class ICalEvent {
|
|
|
1751
1768
|
}
|
|
1752
1769
|
|
|
1753
1770
|
// LOCATION
|
|
1754
|
-
if (this.data.location
|
|
1771
|
+
if (this.data.location && 'title' in this.data.location && this.data.location.title) {
|
|
1755
1772
|
g += 'LOCATION:' + escape(
|
|
1756
1773
|
this.data.location.title +
|
|
1757
1774
|
(this.data.location.address ? '\n' + this.data.location.address : ''),
|
|
@@ -1766,13 +1783,14 @@ export default class ICalEvent {
|
|
|
1766
1783
|
':geo:' + escape(this.data.location.geo?.lat, false) + ',' +
|
|
1767
1784
|
escape(this.data.location.geo?.lon, false) + '\r\n';
|
|
1768
1785
|
}
|
|
1769
|
-
|
|
1770
|
-
if (this.data.location.geo) {
|
|
1771
|
-
g += 'GEO:' + escape(this.data.location.geo?.lat, false) + ';' +
|
|
1772
|
-
escape(this.data.location.geo?.lon, false) + '\r\n';
|
|
1773
|
-
}
|
|
1774
1786
|
}
|
|
1775
1787
|
|
|
1788
|
+
// GEO
|
|
1789
|
+
if (this.data.location && 'geo' in this.data.location && this.data.location.geo) {
|
|
1790
|
+
g += 'GEO:' + escape(this.data.location.geo?.lat, false) + ';' +
|
|
1791
|
+
escape(this.data.location.geo?.lon, false) + '\r\n';
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1776
1794
|
// DESCRIPTION
|
|
1777
1795
|
if (this.data.description) {
|
|
1778
1796
|
g += 'DESCRIPTION:' + escape(this.data.description.plain, false) + '\r\n';
|
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -19,13 +19,19 @@ export interface ICalRepeatingOptions {
|
|
|
19
19
|
startOfWeek?: ICalWeekday;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export type ICalLocation = ICalLocationWithTitle | ICalLocationWithoutTitle;
|
|
23
|
+
|
|
24
|
+
export interface ICalLocationWithTitle {
|
|
23
25
|
title: string;
|
|
24
26
|
address?: string;
|
|
25
27
|
radius?: number;
|
|
26
28
|
geo?: ICalGeo;
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
export interface ICalLocationWithoutTitle {
|
|
32
|
+
geo: ICalGeo;
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
export interface ICalGeo {
|
|
30
36
|
lat: number;
|
|
31
37
|
lon: number;
|