accomadesc 0.0.14 → 0.1.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/dist/AccoCard.svelte.d.ts +2 -1
- package/dist/AccoDescription.svelte.d.ts +2 -1
- package/dist/AmenitiesCore.svelte +2 -2
- package/dist/AmenitiesCore.svelte.d.ts +2 -1
- package/dist/BookingRequest.svelte +272 -0
- package/dist/BookingRequest.svelte.d.ts +5 -0
- package/dist/Calendar.svelte +25 -11
- package/dist/Calendar.svelte.d.ts +2 -1
- package/dist/CalendarAvailable.svelte +11 -18
- package/dist/CalendarAvailable.svelte.d.ts +2 -1
- package/dist/CalendarGrid.svelte +22 -0
- package/dist/CalendarGrid.svelte.d.ts +5 -0
- package/dist/CalendarRows.svelte +22 -0
- package/dist/CalendarRows.svelte.d.ts +5 -0
- package/dist/ContactForm.svelte +180 -0
- package/dist/ContactForm.svelte.d.ts +5 -0
- package/dist/Photo.svelte.d.ts +2 -1
- package/dist/PhotoGallery.svelte +89 -35
- package/dist/PhotoGallery.svelte.d.ts +2 -1
- package/dist/Pricing.svelte.d.ts +2 -1
- package/dist/PricingShort.svelte.d.ts +2 -1
- package/dist/Section.svelte.d.ts +2 -1
- package/dist/Text.svelte.d.ts +2 -1
- package/dist/Weather.svelte +1 -2
- package/dist/Weather.svelte.d.ts +2 -1
- package/dist/basic/Avatar.svelte.d.ts +3 -2
- package/dist/basic/Button.svelte +6 -3
- package/dist/basic/Button.svelte.d.ts +4 -3
- package/dist/basic/Icon.svelte.d.ts +3 -2
- package/dist/basic/Notes.svelte +83 -0
- package/dist/basic/Notes.svelte.d.ts +7 -0
- package/dist/basic/Spinner.svelte.d.ts +3 -2
- package/dist/basic/TextInput.svelte.d.ts +3 -2
- package/dist/helpers/debounce.d.ts +7 -0
- package/dist/helpers/debounce.js +49 -0
- package/dist/helpers/iCSEventExample.ics +14 -0
- package/dist/helpers/normalizeDate.d.ts +2 -0
- package/dist/helpers/normalizeDate.js +53 -0
- package/dist/helpers/readICS.d.ts +7 -0
- package/dist/helpers/readICS.js +94 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +7 -2
- package/dist/names/gen.js +3 -3
- package/dist/occuplan/OccuPlanAvailableInfo.svelte +38 -0
- package/dist/occuplan/OccuPlanAvailableInfo.svelte.d.ts +12 -0
- package/dist/occuplan/OccuPlanGrid.svelte +356 -0
- package/dist/occuplan/OccuPlanGrid.svelte.d.ts +13 -0
- package/dist/occuplan/OccuPlanPicker.svelte +558 -0
- package/dist/occuplan/OccuPlanPicker.svelte.d.ts +16 -0
- package/dist/occuplan/OccuPlanRows.svelte +360 -0
- package/dist/occuplan/OccuPlanRows.svelte.d.ts +13 -0
- package/dist/occuplan/OccuPlanWrapper.svelte +113 -0
- package/dist/occuplan/OccuPlanWrapper.svelte.d.ts +5 -0
- package/dist/occuplan/state.svelte.d.ts +90 -0
- package/dist/occuplan/state.svelte.js +383 -0
- package/dist/svg/ExtLinkSVG.svelte.d.ts +3 -2
- package/dist/svg/LinkSVG.svelte.d.ts +3 -2
- package/dist/types.d.ts +75 -4
- package/dist/types.js +20 -0
- package/package.json +64 -61
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,17 @@ import { randomName, randomID } from './names/gen.js';
|
|
|
2
2
|
import Avatar from './basic/Avatar.svelte';
|
|
3
3
|
import Button from './basic/Button.svelte';
|
|
4
4
|
import Icon from './basic/Icon.svelte';
|
|
5
|
+
import Notes from './basic/Notes.svelte';
|
|
5
6
|
import Spinner from './basic/Spinner.svelte';
|
|
6
7
|
import TextInput from './basic/TextInput.svelte';
|
|
7
8
|
import AccoCard from './AccoCard.svelte';
|
|
8
9
|
import AccoDescription from './AccoDescription.svelte';
|
|
9
10
|
import AmenitiesCore from './AmenitiesCore.svelte';
|
|
11
|
+
import BookingRequest from './BookingRequest.svelte';
|
|
10
12
|
import Calendar from './Calendar.svelte';
|
|
13
|
+
import CalendarGrid from './CalendarGrid.svelte';
|
|
14
|
+
import CalendarRows from './CalendarRows.svelte';
|
|
15
|
+
import ContactForm from './ContactForm.svelte';
|
|
11
16
|
import CalendarAvailable from './CalendarAvailable.svelte';
|
|
12
17
|
import LeafletMap from './LeafletMap.svelte';
|
|
13
18
|
import Photo from './Photo.svelte';
|
|
@@ -17,6 +22,6 @@ import PricingShort from './PricingShort.svelte';
|
|
|
17
22
|
import Section from './Section.svelte';
|
|
18
23
|
import Text from './Text.svelte';
|
|
19
24
|
import Weather from './Weather.svelte';
|
|
20
|
-
export type { GridPhoto, LeafletMap as LeafletMapI, LeafletMapContent, Calendar as CalendarI, CalendarContent, CalendarAvailable as CalendarAvailableI, CalendarAvailableContent, Text as TextI, TextContent, Weather as WeatherI, WeatherContent, Photo as PhotoI, PhotoContent, PhotoGallery as PhotoGalleryI, PhotoGalleryContent, Pricing as PricingI, PricingContent, PricingShort as PricingShortI, PricingShortContent, PricingEntry, PricingRange, StaticRangeDate, StaticPricingRange, AmenitiesCore as AmenitiesCoreI, AmenitiesCoreContent, AccoCard as AccoCardI, AccoCardContent, CardContent, AccoDescription as AccoDescriptionI, AccoDescriptionContent, Section as SectionI, I18nFacade, Acco as AccoI, } from './types.js';
|
|
21
|
-
export { PRICING_COLUMNS } from './types.js';
|
|
22
|
-
export { randomID, randomName, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, };
|
|
25
|
+
export type { GridPhoto, LeafletMap as LeafletMapI, LeafletMapContent, Calendar as CalendarI, CalendarContent, CalendarAvailable as CalendarAvailableI, CalendarAvailableContent, CalendarGrid as CalendarGridI, CalendarGridContent, CalendarRows as CalendarRowsI, CalendarRowsContent, Text as TextI, TextContent, Weather as WeatherI, WeatherContent, Photo as PhotoI, PhotoContent, PhotoGallery as PhotoGalleryI, PhotoGalleryContent, Pricing as PricingI, PricingContent, PricingShort as PricingShortI, PricingShortContent, PricingEntry, PricingRange, PricingColumn, StaticRangeDate, StaticPricingRange, AmenitiesCore as AmenitiesCoreI, AmenitiesCoreContent, AccoCard as AccoCardI, AccoCardContent, ContactForm as ContactFormI, ContactFormContent, BookingRequest as BookingRequestI, BookingRequestContent, CardContent, AccoDescription as AccoDescriptionI, AccoDescriptionContent, Section as SectionI, I18nFacade, Block, Acco as AccoI, } from './types.js';
|
|
26
|
+
export { PRICING_COLUMNS, isAccoCard, isText, isPhoto, isGallery, isLeafletMap, isWeather, isAmenitiesCore, isCalendarAvailable, isCalendar, isCalendarGrid, isCalendarRows, isPricing, isPricingShort, isAccoDescription, isBookingRequest, isContactForm, } from './types.js';
|
|
27
|
+
export { randomID, randomName, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, BookingRequest, ContactForm, CalendarRows, CalendarGrid, Notes, };
|
package/dist/index.js
CHANGED
|
@@ -3,12 +3,17 @@ import { randomName, randomID } from './names/gen.js';
|
|
|
3
3
|
import Avatar from './basic/Avatar.svelte';
|
|
4
4
|
import Button from './basic/Button.svelte';
|
|
5
5
|
import Icon from './basic/Icon.svelte';
|
|
6
|
+
import Notes from './basic/Notes.svelte';
|
|
6
7
|
import Spinner from './basic/Spinner.svelte';
|
|
7
8
|
import TextInput from './basic/TextInput.svelte';
|
|
8
9
|
import AccoCard from './AccoCard.svelte';
|
|
9
10
|
import AccoDescription from './AccoDescription.svelte';
|
|
10
11
|
import AmenitiesCore from './AmenitiesCore.svelte';
|
|
12
|
+
import BookingRequest from './BookingRequest.svelte';
|
|
11
13
|
import Calendar from './Calendar.svelte';
|
|
14
|
+
import CalendarGrid from './CalendarGrid.svelte';
|
|
15
|
+
import CalendarRows from './CalendarRows.svelte';
|
|
16
|
+
import ContactForm from './ContactForm.svelte';
|
|
12
17
|
import CalendarAvailable from './CalendarAvailable.svelte';
|
|
13
18
|
import LeafletMap from './LeafletMap.svelte';
|
|
14
19
|
import Photo from './Photo.svelte';
|
|
@@ -18,5 +23,5 @@ import PricingShort from './PricingShort.svelte';
|
|
|
18
23
|
import Section from './Section.svelte';
|
|
19
24
|
import Text from './Text.svelte';
|
|
20
25
|
import Weather from './Weather.svelte';
|
|
21
|
-
export { PRICING_COLUMNS } from './types.js';
|
|
22
|
-
export { randomID, randomName, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, };
|
|
26
|
+
export { PRICING_COLUMNS, isAccoCard, isText, isPhoto, isGallery, isLeafletMap, isWeather, isAmenitiesCore, isCalendarAvailable, isCalendar, isCalendarGrid, isCalendarRows, isPricing, isPricingShort, isAccoDescription, isBookingRequest, isContactForm, } from './types.js';
|
|
27
|
+
export { randomID, randomName, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, BookingRequest, ContactForm, CalendarRows, CalendarGrid, Notes, };
|
package/dist/names/gen.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import adjectives from './adjectives.json';
|
|
2
|
-
import plants from './plants.json';
|
|
1
|
+
import adjectives from './adjectives.json' with { type: 'json' };
|
|
2
|
+
import plants from './plants.json' with { type: 'json' };
|
|
3
3
|
const rndAdjective = () => {
|
|
4
4
|
let i = Math.floor(Math.random() * adjectives.length);
|
|
5
5
|
return adjectives[i];
|
|
@@ -12,7 +12,7 @@ const rndSpecies = () => {
|
|
|
12
12
|
};
|
|
13
13
|
const capWord = (w) => {
|
|
14
14
|
const [firstLetter, ...rest] = w;
|
|
15
|
-
return `${firstLetter.toLocaleUpperCase()}${rest.join(
|
|
15
|
+
return `${firstLetter.toLocaleUpperCase()}${rest.join('')}`.trim();
|
|
16
16
|
};
|
|
17
17
|
const rndName = () => {
|
|
18
18
|
const adj = rndAdjective();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
3
|
+
import { normalizeDate } from '../helpers/normalizeDate.js';
|
|
4
|
+
import type { AvailableSpans } from './state.svelte.js';
|
|
5
|
+
import { getContext, setContext, type Snippet } from 'svelte';
|
|
6
|
+
import { OCCUPATION_STATE, OccupationState } from './state.svelte.js';
|
|
7
|
+
import Spinner from '../basic/Spinner.svelte';
|
|
8
|
+
import { browser } from '$app/environment';
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
url,
|
|
12
|
+
search = [3, 7, 14],
|
|
13
|
+
maxFutureDate = normalizeDate(DateTime.utc().plus({ years: 1 })),
|
|
14
|
+
children,
|
|
15
|
+
}: {
|
|
16
|
+
url: string;
|
|
17
|
+
search?: number[];
|
|
18
|
+
maxFutureDate?: DateTime;
|
|
19
|
+
children: Snippet<[AvailableSpans]>;
|
|
20
|
+
} = $props();
|
|
21
|
+
|
|
22
|
+
const oStateID = `i-${url}-${OCCUPATION_STATE}`;
|
|
23
|
+
let occupationState: OccupationState = $state(getContext(oStateID));
|
|
24
|
+
|
|
25
|
+
$effect(() => {
|
|
26
|
+
if (!occupationState && browser) {
|
|
27
|
+
occupationState = new OccupationState(url);
|
|
28
|
+
setContext(oStateID, occupationState);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
let av = $derived(occupationState ? occupationState.calcAvailability(search, maxFutureDate) : {});
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
{#if !occupationState || occupationState.loading}
|
|
35
|
+
<Spinner />
|
|
36
|
+
{/if}
|
|
37
|
+
|
|
38
|
+
{@render children(av)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import type { AvailableSpans } from './state.svelte.js';
|
|
3
|
+
import { type Snippet } from 'svelte';
|
|
4
|
+
type $$ComponentProps = {
|
|
5
|
+
url: string;
|
|
6
|
+
search?: number[];
|
|
7
|
+
maxFutureDate?: DateTime;
|
|
8
|
+
children: Snippet<[AvailableSpans]>;
|
|
9
|
+
};
|
|
10
|
+
declare const OccuPlanAvailableInfo: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
|
+
type OccuPlanAvailableInfo = ReturnType<typeof OccuPlanAvailableInfo>;
|
|
12
|
+
export default OccuPlanAvailableInfo;
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { DateTime, type MonthNumbers } from 'luxon';
|
|
3
|
+
import * as Sqrl from 'squirrelly';
|
|
4
|
+
import {
|
|
5
|
+
defaultMonthHeaderFormat,
|
|
6
|
+
defaultMonthLabels,
|
|
7
|
+
defaultWeekdayLabels,
|
|
8
|
+
OCCUPATION_STATE,
|
|
9
|
+
OccupationState,
|
|
10
|
+
occupationTypeFormatting,
|
|
11
|
+
realFirstMonth,
|
|
12
|
+
type FirstMonth,
|
|
13
|
+
type OccupationType,
|
|
14
|
+
type OccuplanTranslations,
|
|
15
|
+
} from './state.svelte.js';
|
|
16
|
+
import { getContext, setContext } from 'svelte';
|
|
17
|
+
import Button from '../basic/Button.svelte';
|
|
18
|
+
import { browser } from '$app/environment';
|
|
19
|
+
import Spinner from '../basic/Spinner.svelte';
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
url,
|
|
23
|
+
header = '',
|
|
24
|
+
footer = '',
|
|
25
|
+
nextPage = '>',
|
|
26
|
+
prevPage = '<',
|
|
27
|
+
weekdayLabels = defaultWeekdayLabels,
|
|
28
|
+
monthLabels = defaultMonthLabels,
|
|
29
|
+
monthHeaderFormat = defaultMonthHeaderFormat,
|
|
30
|
+
numberOfMonth = 12,
|
|
31
|
+
maxWidth = '1200px',
|
|
32
|
+
firstMonth = DateTime.utc().month,
|
|
33
|
+
maxDate = DateTime.utc().plus({ years: 2 }),
|
|
34
|
+
minDate = DateTime.utc(),
|
|
35
|
+
typeLabels = {
|
|
36
|
+
one: 'BOOKING',
|
|
37
|
+
two: 'RESERVATION',
|
|
38
|
+
three: 'PERSONAL',
|
|
39
|
+
},
|
|
40
|
+
}: OccuplanTranslations & {
|
|
41
|
+
url: string;
|
|
42
|
+
numberOfMonth?: number;
|
|
43
|
+
firstMonth?: FirstMonth;
|
|
44
|
+
minDate?: DateTime;
|
|
45
|
+
maxDate?: DateTime;
|
|
46
|
+
maxWidth?: string;
|
|
47
|
+
} = $props();
|
|
48
|
+
|
|
49
|
+
const oStateID = `i-${url}-${OCCUPATION_STATE}`;
|
|
50
|
+
let occupationState: OccupationState = $state(getContext(oStateID));
|
|
51
|
+
$effect(() => {
|
|
52
|
+
if (!occupationState && browser) {
|
|
53
|
+
occupationState = new OccupationState(url);
|
|
54
|
+
setContext(oStateID, occupationState);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
let formatFun = $derived(Sqrl.compile(monthHeaderFormat, { useWith: true }));
|
|
59
|
+
const monthHeader = (monthNum: MonthNumbers, year: number): string => {
|
|
60
|
+
const monthLabel = monthLabels[monthNum];
|
|
61
|
+
return formatFun({ month: monthLabel, year }, Sqrl.defaultConfig);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
let page: number = $state(0);
|
|
65
|
+
let rfMonth: DateTime = $derived(realFirstMonth(firstMonth, numberOfMonth, page));
|
|
66
|
+
|
|
67
|
+
let currentMaxDate = $derived(rfMonth.plus({ month: numberOfMonth }));
|
|
68
|
+
|
|
69
|
+
let months: DateTime[] = $derived.by(() => {
|
|
70
|
+
const result = [];
|
|
71
|
+
|
|
72
|
+
let fMonth: DateTime = DateTime.utc(rfMonth.year, rfMonth.month, 1);
|
|
73
|
+
|
|
74
|
+
result.push(fMonth);
|
|
75
|
+
|
|
76
|
+
let nMonth = fMonth.plus({ months: 1 });
|
|
77
|
+
for (let c = 1; c < numberOfMonth; c++) {
|
|
78
|
+
result.push(nMonth);
|
|
79
|
+
nMonth = nMonth.plus({ months: 1 });
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const nextClicked = () => {
|
|
85
|
+
page += 1;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const prevClicked = () => {
|
|
89
|
+
page -= 1;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
let monthGridTemplateColumns = `[rowLegend] 1fr [d1] 1fr [d2] 1fr [d3] 1fr [d4] 1fr [d5] 1fr [d6] 1fr [d7] 1fr`;
|
|
93
|
+
|
|
94
|
+
let monthGridTemplateRows = (m: DateTime): string => {
|
|
95
|
+
let res = `[columnLegend] 1fr [w${m.weekNumber}] 1fr`;
|
|
96
|
+
let n = m.plus({ weeks: 1 });
|
|
97
|
+
for (let w = 1; w <= 5; w++) {
|
|
98
|
+
res += ` [w${n.weekNumber}] 1fr`;
|
|
99
|
+
n = n.plus({ weeks: 1 });
|
|
100
|
+
}
|
|
101
|
+
return res;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const weeks = (m: DateTime): DateTime[] => {
|
|
105
|
+
let n = m.plus({ weeks: 1 });
|
|
106
|
+
let res: DateTime[] = [m, n];
|
|
107
|
+
for (let i = 1; i <= 4; i++) {
|
|
108
|
+
n = n.plus({ weeks: 1 });
|
|
109
|
+
res.push(n);
|
|
110
|
+
}
|
|
111
|
+
return res;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const days = (m: DateTime): DateTime[] => {
|
|
115
|
+
//find first
|
|
116
|
+
let firstDay = m.startOf('week');
|
|
117
|
+
|
|
118
|
+
//find last
|
|
119
|
+
let lastDayOfMonth = m.endOf('month');
|
|
120
|
+
let lastDay = lastDayOfMonth.endOf('week');
|
|
121
|
+
|
|
122
|
+
let n = firstDay.plus({ days: 1 });
|
|
123
|
+
let res: DateTime[] = [firstDay];
|
|
124
|
+
|
|
125
|
+
while (n <= lastDay) {
|
|
126
|
+
res.push(n);
|
|
127
|
+
n = n.plus({ days: 1 });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return res;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const hiddenWeekNum = (m: DateTime, w: DateTime): boolean => {
|
|
134
|
+
let lastDayOfMonth = m.endOf('month');
|
|
135
|
+
let firstDayOfWeek = w.startOf('week');
|
|
136
|
+
return lastDayOfMonth < firstDayOfWeek;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
let foundOccupationTypes: OccupationType[] = $derived(
|
|
140
|
+
occupationState?.occupations.reduce((res, occupation) => {
|
|
141
|
+
if (!res.includes(occupation.type)) {
|
|
142
|
+
res.push(occupation.type);
|
|
143
|
+
}
|
|
144
|
+
return res;
|
|
145
|
+
}, [] as OccupationType[]),
|
|
146
|
+
);
|
|
147
|
+
</script>
|
|
148
|
+
|
|
149
|
+
{#if !occupationState || occupationState.loading}
|
|
150
|
+
<Spinner />
|
|
151
|
+
{/if}
|
|
152
|
+
|
|
153
|
+
<section class="occuplan-wrapper" style="max-width: {maxWidth};">
|
|
154
|
+
<header class="occupation-plan-header">
|
|
155
|
+
<div class="header-controls">
|
|
156
|
+
{#if rfMonth >= minDate}
|
|
157
|
+
<Button text={`${prevPage}`} clicked={prevClicked} />
|
|
158
|
+
{/if}
|
|
159
|
+
</div>
|
|
160
|
+
<div class="header-label"><h3>{@html header}</h3></div>
|
|
161
|
+
<div class="header-controls">
|
|
162
|
+
{#if currentMaxDate <= maxDate}
|
|
163
|
+
<Button text={`${nextPage}`} clicked={nextClicked} />
|
|
164
|
+
{/if}
|
|
165
|
+
</div>
|
|
166
|
+
</header>
|
|
167
|
+
<main>
|
|
168
|
+
{#each months as m (`${m.year}-${m.month}`)}
|
|
169
|
+
<div class="month">
|
|
170
|
+
<header class="month-header">{monthHeader(m.month as MonthNumbers, m.year)}</header>
|
|
171
|
+
<div
|
|
172
|
+
style="
|
|
173
|
+
grid-template-columns: {monthGridTemplateColumns};
|
|
174
|
+
grid-template-rows: {monthGridTemplateRows(m)};
|
|
175
|
+
"
|
|
176
|
+
class="days"
|
|
177
|
+
>
|
|
178
|
+
<div class="weekday-header" style="grid-area: columnLegend / d1 / columnLegend / d1;">
|
|
179
|
+
{weekdayLabels[1]}
|
|
180
|
+
</div>
|
|
181
|
+
<div class="weekday-header" style="grid-area: columnLegend / d2 / columnLegend / d2;">
|
|
182
|
+
{weekdayLabels[2]}
|
|
183
|
+
</div>
|
|
184
|
+
<div class="weekday-header" style="grid-area: columnLegend / d3 / columnLegend / d3;">
|
|
185
|
+
{weekdayLabels[3]}
|
|
186
|
+
</div>
|
|
187
|
+
<div class="weekday-header" style="grid-area: columnLegend / d4 / columnLegend / d4;">
|
|
188
|
+
{weekdayLabels[4]}
|
|
189
|
+
</div>
|
|
190
|
+
<div class="weekday-header" style="grid-area: columnLegend / d5 / columnLegend / d5;">
|
|
191
|
+
{weekdayLabels[5]}
|
|
192
|
+
</div>
|
|
193
|
+
<div class="weekday-header" style="grid-area: columnLegend / d6 / columnLegend / d6;">
|
|
194
|
+
{weekdayLabels[6]}
|
|
195
|
+
</div>
|
|
196
|
+
<div class="weekday-header" style="grid-area: columnLegend / d7 / columnLegend / d7;">
|
|
197
|
+
{weekdayLabels[7]}
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
{#each days(m) as d (`${d.year}-${d.month}-${d.day}`)}
|
|
201
|
+
<div
|
|
202
|
+
class:weekend={[6, 7].includes(d.weekday)}
|
|
203
|
+
class:other-month={m.month !== d.month}
|
|
204
|
+
class="day"
|
|
205
|
+
style="
|
|
206
|
+
grid-area: w{d.weekNumber} / d{d.weekday} / w{d.weekNumber} / d{d.weekday};
|
|
207
|
+
{occupationState?.occupationStyle(
|
|
208
|
+
{ day: d.day, month: d.month as MonthNumbers, year: d.year },
|
|
209
|
+
false,
|
|
210
|
+
maxDate,
|
|
211
|
+
)}
|
|
212
|
+
"
|
|
213
|
+
>
|
|
214
|
+
{d.day}
|
|
215
|
+
</div>
|
|
216
|
+
{/each}
|
|
217
|
+
|
|
218
|
+
{#each weeks(m) as w (`${w.year}-${w.month}-${w.weekNumber}`)}
|
|
219
|
+
<div
|
|
220
|
+
class:hidden={hiddenWeekNum(m, w)}
|
|
221
|
+
class="week-number"
|
|
222
|
+
style="grid-area: w{w.weekNumber} / rowLegend / w{w.weekNumber} / rowLegend;"
|
|
223
|
+
>
|
|
224
|
+
{w.weekNumber}
|
|
225
|
+
</div>
|
|
226
|
+
{/each}
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
{/each}
|
|
230
|
+
</main>
|
|
231
|
+
<footer>
|
|
232
|
+
<div class="legend">
|
|
233
|
+
{#each foundOccupationTypes as t}
|
|
234
|
+
{@const format = occupationTypeFormatting(t)}
|
|
235
|
+
<span>{typeLabels[t]}</span>
|
|
236
|
+
<div
|
|
237
|
+
id="occupation-type-{t}-legend"
|
|
238
|
+
class="legend-entry-marker"
|
|
239
|
+
style="background-color: {format.bgColor};"
|
|
240
|
+
>
|
|
241
|
+
|
|
242
|
+
</div>
|
|
243
|
+
{/each}
|
|
244
|
+
</div>
|
|
245
|
+
<div class="footer-content">
|
|
246
|
+
{@html footer}
|
|
247
|
+
</div>
|
|
248
|
+
</footer>
|
|
249
|
+
</section>
|
|
250
|
+
|
|
251
|
+
<style>
|
|
252
|
+
.footer-content {
|
|
253
|
+
display: flex;
|
|
254
|
+
flex-direction: column;
|
|
255
|
+
justify-content: flex-end;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.legend-entry-marker {
|
|
259
|
+
outline: var(--occuplan-grid-border);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.month-header {
|
|
263
|
+
text-align: center;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.hidden {
|
|
267
|
+
display: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.occupation-plan-header {
|
|
271
|
+
display: flex;
|
|
272
|
+
flex-direction: row;
|
|
273
|
+
width: 100%;
|
|
274
|
+
justify-content: space-between;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.header-label {
|
|
278
|
+
text-transform: capitalize;
|
|
279
|
+
font-weight: bold;
|
|
280
|
+
font-variant: small-caps;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.week-number {
|
|
284
|
+
text-align: left;
|
|
285
|
+
font-style: italic;
|
|
286
|
+
font-weight: lighter;
|
|
287
|
+
background-color: var(--occuplan-bg-color-weeknum);
|
|
288
|
+
color: var(--occuplan-font-color-weeknum);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.weekday-header {
|
|
292
|
+
text-align: center;
|
|
293
|
+
background-color: var(--occuplan-bg-color-days-header);
|
|
294
|
+
color: var(--occuplan-font-color-days-header);
|
|
295
|
+
grid-area: columnLegend / d1 / columnLegend / d1;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.day {
|
|
299
|
+
text-align: center;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.weekend {
|
|
303
|
+
font-weight: bold;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.occuplan-wrapper {
|
|
307
|
+
height: 100%;
|
|
308
|
+
width: calc(100% - 0.5rem);
|
|
309
|
+
padding: 0.5rem;
|
|
310
|
+
margin: 0;
|
|
311
|
+
display: flex;
|
|
312
|
+
flex-direction: column;
|
|
313
|
+
flex-wrap: nowrap;
|
|
314
|
+
align-items: center;
|
|
315
|
+
|
|
316
|
+
border: var(--occuplan-main-border);
|
|
317
|
+
color: var(--occuplan-font-color-main);
|
|
318
|
+
background-color: var(--occuplan-bg-color-main);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
main {
|
|
322
|
+
display: grid;
|
|
323
|
+
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
|
324
|
+
gap: 1rem;
|
|
325
|
+
width: 100%;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.month {
|
|
329
|
+
display: flex;
|
|
330
|
+
flex-direction: column;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.days {
|
|
334
|
+
display: grid;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
footer {
|
|
338
|
+
display: flex;
|
|
339
|
+
flex-direction: row;
|
|
340
|
+
align-items: stretch;
|
|
341
|
+
justify-content: space-between;
|
|
342
|
+
width: 100%;
|
|
343
|
+
margin-top: 1rem;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.legend {
|
|
347
|
+
display: grid;
|
|
348
|
+
grid-template-columns: [label] 1fr [marker] 1rem;
|
|
349
|
+
column-gap: 1rem;
|
|
350
|
+
text-transform: capitalize;
|
|
351
|
+
font-variant: small-caps;
|
|
352
|
+
}
|
|
353
|
+
.header-controls {
|
|
354
|
+
width: 2rem;
|
|
355
|
+
}
|
|
356
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { type FirstMonth, type OccuplanTranslations } from './state.svelte.js';
|
|
3
|
+
type $$ComponentProps = OccuplanTranslations & {
|
|
4
|
+
url: string;
|
|
5
|
+
numberOfMonth?: number;
|
|
6
|
+
firstMonth?: FirstMonth;
|
|
7
|
+
minDate?: DateTime;
|
|
8
|
+
maxDate?: DateTime;
|
|
9
|
+
maxWidth?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const OccuPlanGrid: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
|
+
type OccuPlanGrid = ReturnType<typeof OccuPlanGrid>;
|
|
13
|
+
export default OccuPlanGrid;
|