@stacksjs/calendar-api 0.70.88 → 0.70.90

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.
@@ -0,0 +1,2 @@
1
+ import type { CalendarLink } from '../types';
2
+ export declare function generateGoogle(link: CalendarLink): string;
@@ -0,0 +1,2 @@
1
+ import type { CalendarLink } from '../types';
2
+ export declare function generateIcs(link: CalendarLink): string;
@@ -0,0 +1,2 @@
1
+ import type { CalendarLink } from '../types';
2
+ export declare function generateOutlook(link: CalendarLink): string;
@@ -0,0 +1,3 @@
1
+ import type { CalendarLink } from '../types';
2
+ export declare function generateYahoo(link: CalendarLink): string;
3
+ export default generateYahoo;
@@ -0,0 +1,5 @@
1
+ import type { CalendarLink } from './types';
2
+ export declare function exportCalendarGoogle(link: CalendarLink): string;
3
+ export declare function exportCalendarIcs(link: CalendarLink): string;
4
+ export declare function exportCalendarOutlook(link: CalendarLink): string;
5
+ export declare function exportCalendarYahoo(link: CalendarLink): string;
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{format as y}from"@stacksjs/datetime";var Q="YYYYMMDD",R="YYYYMMDDThhmmss";function D($){let p="https://calendar.google.com/calendar/render?action=TEMPLATE",L=B($.from,"UTC"),C=B($.to,"UTC"),Y=$.allDay?Q:R;if(p=`${p}&dates=${y(L,Y)}/${y(C,Y)}`,$.timezone)p=`${p}&ctz=${$.timezone}`;if(p=`${p}&text=${encodeURIComponent($.title)}`,$.description)p=`${p}&details=${encodeURIComponent($.description)}`;if($.address)p=`${p}&location=${encodeURIComponent($.address)}`;return p}function B($,p){let L=typeof $==="string"?new Date($):$;if(!p)return L;let C=L.toLocaleString("en-US",{timeZone:p}),Y=new Date(C);return Number.isNaN(Y.getTime())?L:Y}import{format as I}from"@stacksjs/datetime";import{createHash as U}from"crypto";function V($){return{toString:()=>U("md5").update($).digest("hex")}}function E($){let C=`UID:${W($)}`,Y=`SUMMARY:${$.title}`,x=["BEGIN:VCALENDAR","VERSION:2.0","PRODID:Spatie calendar-links","BEGIN:VEVENT",C,Y],O=`${$.timezone||"PST"}:YYYYMMDDThhmmss`,G=$.allDay?"YYYYMMDD":O;if($.allDay)x.push(`DTSTAMP;TZID=${I($.from,G)}`),x.push(`DTSTART:${I($.from,G)}`),x.push(`DURATION:P${Math.max(1,H($.from,$.to))}D`);else x.push(`DTSTAMP;TZID=${I($.from,G)}`),x.push(`DTSTART;TZID=${I($.from,G)}`),x.push(`DTEND;TZID=${I($.to,G)}`);if($.description)x.push(`X-ALT-DESC;FMTTYPE=text/html:${$.description}`);if($.address)x.push(`LOCATION:${$.address}`);return x.push("END:VEVENT"),x.push("END:VCALENDAR"),X(x)}function X($){return`data:text/calendar;charset=utf8;base64,${btoa($.join(`\r
3
+ `))}`}function H($,p){let C=Date.UTC($.getFullYear(),$.getMonth(),$.getDate()),Y=Date.UTC(p.getFullYear(),p.getMonth(),p.getDate());return Math.floor((Y-C)/86400000)}function W($){let L=I($.from,"YYYY-MM-DDThh:mm:ss+00:00"),C=I($.to,"YYYY-MM-DDThh:mm:ss+00:00");return V(`${L}${C}${$.title}`).toString()}import{format as _}from"@stacksjs/datetime";function K($){let Y="https://outlook.live.com/calendar/deeplink/compose?path=/calendar/action/compose&rru=addevent",x=J($.from,"UTC"),M=J($.to,"UTC"),O=$.allDay?"YYYY-MM-DD":"YYYY-MM-DDThh:mm:ss";if(Y=$.allDay?`${Y}&startdt=${_(x,O)}`:`${Y}&startdt=${_(x,O)}Z`,Y=$.allDay?`${Y}&enddt=${_(M,O)}`:`${Y}&enddt=${_(M,O)}Z`,$.allDay)Y=`${Y}&allday=true`;if(Y=`${Y}&subject=${encodeURIComponent($.title)}`,$.description)Y=`${Y}&body=${encodeURIComponent($.description)}`;if($.address)Y=`${Y}&location=${encodeURIComponent($.address)}`;return Y}function J($,p){return new Date((typeof $==="string"?new Date($):$).toLocaleString("en-US",{timeZone:p}))}import{format as q}from"@stacksjs/datetime";function P($){let C="https://calendar.yahoo.com/?v=60&view=d&type=20",Y=N($.from,"UTC"),x=N($.to,"UTC"),M=$.allDay?"YYYYMMDD":"YYYYMMDDThhmmss";if($.allDay)C=`${C}&ST=${q($.from,M)}`,C=`${C}&DUR=allday`,C=`${C}&ET=${q($.to,M)}`;else C=`${C}&ST=${q(Y,M)}Z`,C=`${C}&ET=${q(x,M)}Z`;if(C=`${C}&TITLE=${encodeURIComponent($.title)}`,$.description)C=`${C}&DESC=${encodeURIComponent($.description)}`;if($.address)C=`${C}&in_loc=${encodeURIComponent($.address)}`;return C}function N($,p){return new Date((typeof $==="string"?new Date($):$).toLocaleString("en-US",{timeZone:p}))}function T($){return D($)}function s($){return E($)}function o($){return K($)}function d($){return P($)}export{d as exportCalendarYahoo,o as exportCalendarOutlook,s as exportCalendarIcs,T as exportCalendarGoogle};
@@ -0,0 +1,43 @@
1
+ import type { Ref } from '@stacksjs/stx';
2
+ export declare interface CalendarStore {
3
+ day: number
4
+ month: Ref<number>
5
+ year: Ref<number>
6
+ currentMonthYear: Ref<string>
7
+ currentMonthDayYear: Ref<string>
8
+ datesOfThePastMonth: Ref<number[]>
9
+ datesOfTheMonth: Ref<number[]>
10
+ datesOfNextMonth: Ref<number[]>
11
+ currentWeekView: Ref<number[]>
12
+ currentWeekViewToday: Ref<number[]>
13
+ }
14
+ export declare interface Time {
15
+ from: string
16
+ to: string
17
+ }
18
+ export declare interface Events {
19
+ date: string
20
+ title: string
21
+ description: string
22
+ month: number
23
+ day: number
24
+ year: number
25
+ time: Time
26
+ }
27
+ export declare interface WeekDates {
28
+ month: number
29
+ date: number
30
+ }
31
+ export declare interface TimeTableStyle {
32
+ time: string
33
+ gridRow: string
34
+ }
35
+ export declare interface CalendarLink {
36
+ from: Date
37
+ to: Date
38
+ allDay: boolean
39
+ address: string
40
+ title: string
41
+ description: string
42
+ timezone: string
43
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/calendar-api",
3
3
  "type": "module",
4
- "version": "0.70.88",
4
+ "version": "0.70.90",
5
5
  "description": "Easily interact with calendar APIs.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -52,9 +52,9 @@
52
52
  "prepublishOnly": "bun run build"
53
53
  },
54
54
  "devDependencies": {
55
- "@stacksjs/browser": "0.70.88",
55
+ "@stacksjs/browser": "0.70.90",
56
56
  "better-dx": "^0.2.16",
57
- "@stacksjs/security": "0.70.88"
57
+ "@stacksjs/security": "0.70.90"
58
58
  },
59
59
  "sideEffects": false
60
60
  }