accomadesc 0.0.13 → 0.1.0
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 +1 -1
- package/dist/AccoCard.svelte.d.ts +3 -2
- package/dist/AccoDescription.svelte +1 -1
- package/dist/AccoDescription.svelte.d.ts +3 -2
- package/dist/AmenitiesCore.svelte +3 -3
- package/dist/AmenitiesCore.svelte.d.ts +3 -2
- package/dist/BookingRequest.svelte +272 -0
- package/dist/BookingRequest.svelte.d.ts +5 -0
- package/dist/Calendar.svelte +26 -13
- package/dist/Calendar.svelte.d.ts +3 -2
- package/dist/CalendarAvailable.svelte +12 -19
- package/dist/CalendarAvailable.svelte.d.ts +3 -2
- 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/LeafletMap.svelte +1 -1
- package/dist/LeafletMap.svelte.d.ts +1 -1
- package/dist/Photo.svelte +1 -1
- package/dist/Photo.svelte.d.ts +3 -2
- package/dist/PhotoGallery.svelte +89 -35
- package/dist/PhotoGallery.svelte.d.ts +3 -2
- package/dist/Pricing.svelte +1 -1
- package/dist/Pricing.svelte.d.ts +3 -2
- package/dist/PricingShort.svelte +1 -1
- package/dist/PricingShort.svelte.d.ts +3 -2
- package/dist/Section.svelte +1 -1
- package/dist/Section.svelte.d.ts +3 -2
- package/dist/Text.svelte +1 -1
- package/dist/Text.svelte.d.ts +3 -2
- package/dist/Weather.svelte +2 -3
- package/dist/Weather.svelte.d.ts +3 -2
- 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 +2 -2
- package/dist/index.js +1 -1
- 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 +559 -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
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { normalizeDate } from '../helpers/normalizeDate.ts';
|
|
2
|
+
import { getEvents } from '../helpers/readICS.ts';
|
|
3
|
+
import { DateTime } from 'luxon';
|
|
4
|
+
import { DateTime as luxon } from 'luxon';
|
|
5
|
+
export const OCCUPATION_STATE = 'occupation-state';
|
|
6
|
+
export const occupationTypeFormattingByOccupation = (o) => {
|
|
7
|
+
return occupationTypeFormatting(o?.type);
|
|
8
|
+
};
|
|
9
|
+
export const occupationTypeFormatting = (t) => {
|
|
10
|
+
switch (t) {
|
|
11
|
+
case 'one':
|
|
12
|
+
return {
|
|
13
|
+
fontColor: 'var(--occupation-type-1-font-color)',
|
|
14
|
+
bgColor: 'var(--occupation-type-1-bg-color)',
|
|
15
|
+
};
|
|
16
|
+
case 'two':
|
|
17
|
+
return {
|
|
18
|
+
fontColor: 'var(--occupation-type-2-font-color)',
|
|
19
|
+
bgColor: 'var(--occupation-type-2-bg-color)',
|
|
20
|
+
};
|
|
21
|
+
case 'three':
|
|
22
|
+
return {
|
|
23
|
+
fontColor: 'var(--occupation-type-3-font-color)',
|
|
24
|
+
bgColor: 'var(--occupation-type-3-bg-color)',
|
|
25
|
+
};
|
|
26
|
+
default:
|
|
27
|
+
return {
|
|
28
|
+
fontColor: 'var(--occupation-type-1-font-color)',
|
|
29
|
+
bgColor: 'var(--occupation-type-1-bg-color)',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export const firstMonthValid = (value) => {
|
|
34
|
+
if (typeof value === 'number') {
|
|
35
|
+
const intValue = value;
|
|
36
|
+
return intValue >= 0 && intValue <= 12;
|
|
37
|
+
}
|
|
38
|
+
else if (value.length > 1) {
|
|
39
|
+
//check + sign
|
|
40
|
+
if (value[0] == '+') {
|
|
41
|
+
const toParse = value.slice(1);
|
|
42
|
+
try {
|
|
43
|
+
const intValue = parseInt(toParse);
|
|
44
|
+
if (intValue >= 0 && intValue <= 12) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
console.log('casting error', e);
|
|
50
|
+
}
|
|
51
|
+
//check - sign
|
|
52
|
+
}
|
|
53
|
+
else if (value[0] == '-') {
|
|
54
|
+
const toParse = value.slice(1);
|
|
55
|
+
try {
|
|
56
|
+
const intValue = parseInt(toParse);
|
|
57
|
+
if (intValue >= 0 && intValue <= 12) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
console.log('casting error', e);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const intValue = parseInt(value);
|
|
68
|
+
if (intValue >= 0 && intValue <= 12) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
console.log('casting error', e);
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
};
|
|
77
|
+
export const realFirstMonth = (firstMonth, numberOfMonth, page) => {
|
|
78
|
+
const monthToAdd = page * numberOfMonth;
|
|
79
|
+
if (typeof firstMonth === 'number') {
|
|
80
|
+
const intValue = firstMonth;
|
|
81
|
+
if (intValue >= 1 && intValue <= 12) {
|
|
82
|
+
const tDate = normalizeDate(DateTime.utc())
|
|
83
|
+
.set({ month: intValue })
|
|
84
|
+
.plus({ month: monthToAdd });
|
|
85
|
+
return tDate;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (typeof firstMonth === 'string' && firstMonth.length > 1) {
|
|
89
|
+
//check + sign
|
|
90
|
+
if (firstMonth[0] == '+') {
|
|
91
|
+
const toParse = firstMonth.slice(1);
|
|
92
|
+
try {
|
|
93
|
+
const intValue = parseInt(toParse);
|
|
94
|
+
if (intValue >= 1 && intValue <= 12) {
|
|
95
|
+
const tDate = normalizeDate(DateTime.utc())
|
|
96
|
+
.plus({ month: intValue })
|
|
97
|
+
.plus({ month: monthToAdd });
|
|
98
|
+
return tDate;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
console.log('casting error', e);
|
|
103
|
+
}
|
|
104
|
+
//check - sign
|
|
105
|
+
}
|
|
106
|
+
else if (firstMonth[0] == '-') {
|
|
107
|
+
const toParse = firstMonth.slice(1);
|
|
108
|
+
try {
|
|
109
|
+
const intValue = parseInt(toParse);
|
|
110
|
+
if (intValue >= 0 && intValue <= 12) {
|
|
111
|
+
const tDate = normalizeDate(DateTime.utc())
|
|
112
|
+
.minus({ month: intValue })
|
|
113
|
+
.plus({ month: monthToAdd });
|
|
114
|
+
return tDate;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
console.log('casting error', e);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (typeof firstMonth == 'string') {
|
|
123
|
+
try {
|
|
124
|
+
const intValue = parseInt(firstMonth);
|
|
125
|
+
//current dynamic month
|
|
126
|
+
if (intValue == 0) {
|
|
127
|
+
return normalizeDate(DateTime.utc()).plus({ month: monthToAdd });
|
|
128
|
+
}
|
|
129
|
+
//static month of current year
|
|
130
|
+
if (intValue >= 1 && intValue <= 12) {
|
|
131
|
+
const tDate = normalizeDate(DateTime.utc())
|
|
132
|
+
.set({ month: intValue })
|
|
133
|
+
.plus({ month: monthToAdd });
|
|
134
|
+
return tDate;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.log('casting error', e);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//first month of current year ... default
|
|
142
|
+
return normalizeDate(DateTime.utc()).set({ month: 1 }).plus({ month: monthToAdd });
|
|
143
|
+
};
|
|
144
|
+
const validDay = (d) => {
|
|
145
|
+
const today = luxon.utc();
|
|
146
|
+
const m = luxon.local(d.year, d.month, d.day);
|
|
147
|
+
if (m < today) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return d.day <= m.endOf('month').day;
|
|
151
|
+
};
|
|
152
|
+
export const defaultWeekendLabel = 'Weekend';
|
|
153
|
+
export const defaultWeekdayLabels = {
|
|
154
|
+
1: 'Mo',
|
|
155
|
+
2: 'Tu',
|
|
156
|
+
3: 'We',
|
|
157
|
+
4: 'Th',
|
|
158
|
+
5: 'Fr',
|
|
159
|
+
6: 'Sa',
|
|
160
|
+
7: 'Su',
|
|
161
|
+
};
|
|
162
|
+
export const defaultMonthLabels = {
|
|
163
|
+
1: 'Jan',
|
|
164
|
+
2: 'Feb',
|
|
165
|
+
3: 'Mar',
|
|
166
|
+
4: 'Apr',
|
|
167
|
+
5: 'May',
|
|
168
|
+
6: 'Jun',
|
|
169
|
+
7: 'Jul',
|
|
170
|
+
8: 'Aug',
|
|
171
|
+
9: 'Sep',
|
|
172
|
+
10: 'Oct',
|
|
173
|
+
11: 'Nov',
|
|
174
|
+
12: 'Dec',
|
|
175
|
+
};
|
|
176
|
+
export const defaultMonthHeaderFormat = '{{month}} / {{year}}';
|
|
177
|
+
export class OccupationState {
|
|
178
|
+
iCalURL;
|
|
179
|
+
occupiedDays = $state({});
|
|
180
|
+
occupations = $state([]);
|
|
181
|
+
loading = $state(false);
|
|
182
|
+
constructor(iCalURL) {
|
|
183
|
+
this.iCalURL = iCalURL;
|
|
184
|
+
this.loadOccupations();
|
|
185
|
+
}
|
|
186
|
+
loadOccupations = async () => {
|
|
187
|
+
this.loading = true;
|
|
188
|
+
if (this.iCalURL) {
|
|
189
|
+
const eventsResult = await getEvents(this.iCalURL, this.eventsIncomingCallback);
|
|
190
|
+
this.loading = false;
|
|
191
|
+
return !eventsResult.error;
|
|
192
|
+
}
|
|
193
|
+
return false;
|
|
194
|
+
};
|
|
195
|
+
eventsIncomingCallback = (o) => {
|
|
196
|
+
this.occupations.push(o);
|
|
197
|
+
this.updateOccupiedDays(o);
|
|
198
|
+
};
|
|
199
|
+
dayKey = (d) => {
|
|
200
|
+
return `${d.year}-${d.month}-${d.day}`;
|
|
201
|
+
};
|
|
202
|
+
updateOccupiedDays = (o) => {
|
|
203
|
+
let startDate = o.arrival;
|
|
204
|
+
let endDate = o.leave;
|
|
205
|
+
if (o.arrival > o.leave) {
|
|
206
|
+
startDate = o.leave;
|
|
207
|
+
endDate = o.arrival;
|
|
208
|
+
}
|
|
209
|
+
let cDate = startDate;
|
|
210
|
+
while (cDate < endDate) {
|
|
211
|
+
const key = this.dayKey(cDate);
|
|
212
|
+
this.occupiedDays[key] = true;
|
|
213
|
+
cDate = cDate.plus({ days: 1 });
|
|
214
|
+
}
|
|
215
|
+
//console.log(this.occupiedDays);
|
|
216
|
+
};
|
|
217
|
+
firstFree = (maxFutureDate) => {
|
|
218
|
+
let day = normalizeDate();
|
|
219
|
+
while (this.dayOccupied(day) && day < maxFutureDate) {
|
|
220
|
+
day = day.plus({ day: 1 });
|
|
221
|
+
}
|
|
222
|
+
return day;
|
|
223
|
+
};
|
|
224
|
+
earliestRequestStart = (currentEnd) => {
|
|
225
|
+
if (!currentEnd)
|
|
226
|
+
return;
|
|
227
|
+
let day = normalizeDate(currentEnd).minus({ day: 1 });
|
|
228
|
+
while (day > normalizeDate() && !this.dayOccupied(day)) {
|
|
229
|
+
day = day.minus({ day: 1 });
|
|
230
|
+
}
|
|
231
|
+
return day;
|
|
232
|
+
};
|
|
233
|
+
latestRequestEnd = (maxFutureDate, currentStart) => {
|
|
234
|
+
if (!currentStart)
|
|
235
|
+
return;
|
|
236
|
+
let day = normalizeDate(currentStart);
|
|
237
|
+
while (day < maxFutureDate && !this.dayOccupied(day)) {
|
|
238
|
+
day = day.plus({ day: 1 });
|
|
239
|
+
}
|
|
240
|
+
return day;
|
|
241
|
+
};
|
|
242
|
+
calcAvailability = (search, maxFutureDate) => {
|
|
243
|
+
let av = search.reduce((acc, num) => {
|
|
244
|
+
acc[num] = null;
|
|
245
|
+
return acc;
|
|
246
|
+
}, {});
|
|
247
|
+
let foundFirst = false;
|
|
248
|
+
let firstDate;
|
|
249
|
+
let consecutive = 0;
|
|
250
|
+
let d = normalizeDate(luxon.utc());
|
|
251
|
+
while (d <= maxFutureDate) {
|
|
252
|
+
const key = `${d.year}-${d.month}-${d.day}`;
|
|
253
|
+
if (this.occupiedDays[key]) {
|
|
254
|
+
foundFirst = false;
|
|
255
|
+
consecutive = 0;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
if (foundFirst) {
|
|
259
|
+
consecutive++;
|
|
260
|
+
search.forEach((n) => {
|
|
261
|
+
if (consecutive >= n && av[n] == null) {
|
|
262
|
+
av[n] = firstDate;
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
let foundAll = true;
|
|
266
|
+
search.forEach((num) => {
|
|
267
|
+
if (!av[num]) {
|
|
268
|
+
foundAll = false;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
if (foundAll)
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
foundFirst = true;
|
|
276
|
+
firstDate = d;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
d = d.plus({ day: 1 });
|
|
280
|
+
}
|
|
281
|
+
return av;
|
|
282
|
+
};
|
|
283
|
+
dayOccupied = (day) => {
|
|
284
|
+
const key = this.dayKey(day);
|
|
285
|
+
return this.occupiedDays[key];
|
|
286
|
+
};
|
|
287
|
+
startingOccupation = (d) => {
|
|
288
|
+
const startOfDay = d.startOf('day');
|
|
289
|
+
const endOfDay = d.endOf('day');
|
|
290
|
+
return this.occupations.find((o) => o.arrival > startOfDay && o.arrival < endOfDay);
|
|
291
|
+
};
|
|
292
|
+
endingOccupation = (d) => {
|
|
293
|
+
const startOfDay = d.startOf('day');
|
|
294
|
+
const endOfDay = d.endOf('day');
|
|
295
|
+
return this.occupations.find((o) => o.leave > startOfDay && o.leave < endOfDay);
|
|
296
|
+
};
|
|
297
|
+
fullOccupation = (d) => {
|
|
298
|
+
const startOfDay = d.startOf('day');
|
|
299
|
+
const endOfDay = d.endOf('day');
|
|
300
|
+
return this.occupations.find((o) => o.arrival < startOfDay && o.leave > endOfDay);
|
|
301
|
+
};
|
|
302
|
+
validRequest = (from, to) => {
|
|
303
|
+
//TODO take min nights into account
|
|
304
|
+
return !this.occupations.find((o) => o.arrival < to && o.leave > from);
|
|
305
|
+
};
|
|
306
|
+
occupationStyle = (d, highlightWeekend = false, maxDate) => {
|
|
307
|
+
const valid = validDay(d);
|
|
308
|
+
if (!valid) {
|
|
309
|
+
return 'background-color: var(--occuplan-bg-color-invalid-days);';
|
|
310
|
+
}
|
|
311
|
+
const day = luxon.utc(d.year, d.month, d.day);
|
|
312
|
+
const outOfScope = day >= maxDate;
|
|
313
|
+
if (outOfScope) {
|
|
314
|
+
return 'background-color: var(--occuplan-bg-color-invalid-days);';
|
|
315
|
+
}
|
|
316
|
+
const o = this.fullOccupation(day);
|
|
317
|
+
const oStarts = this.startingOccupation(day);
|
|
318
|
+
const oEnds = this.endingOccupation(day);
|
|
319
|
+
const isWeekend = [6, 7].includes(day.weekday);
|
|
320
|
+
if (o) {
|
|
321
|
+
const f = occupationTypeFormattingByOccupation(o);
|
|
322
|
+
if (highlightWeekend && isWeekend) {
|
|
323
|
+
return `
|
|
324
|
+
background: radial-gradient(var(--occuplan-bg-color-weekend), ${f.bgColor}, ${f.bgColor});
|
|
325
|
+
`;
|
|
326
|
+
}
|
|
327
|
+
return `
|
|
328
|
+
background-color: ${f.bgColor};
|
|
329
|
+
`;
|
|
330
|
+
}
|
|
331
|
+
if (oEnds && oStarts) {
|
|
332
|
+
const sf = occupationTypeFormattingByOccupation(oStarts);
|
|
333
|
+
const ef = occupationTypeFormattingByOccupation(oEnds);
|
|
334
|
+
if (isWeekend && highlightWeekend) {
|
|
335
|
+
return `
|
|
336
|
+
background: radial-gradient(var(--occuplan-bg-color-weekend), var(--occuplan-bg-color-main), var(--occuplan-bg-color-main)), linear-gradient(90deg, ${ef.bgColor}, ${sf.bgColor});
|
|
337
|
+
`;
|
|
338
|
+
}
|
|
339
|
+
return `
|
|
340
|
+
background: linear-gradient(90deg, ${ef.bgColor}, ${sf.bgColor});
|
|
341
|
+
`;
|
|
342
|
+
}
|
|
343
|
+
if (oStarts) {
|
|
344
|
+
const sf = occupationTypeFormattingByOccupation(oStarts);
|
|
345
|
+
if (isWeekend && highlightWeekend) {
|
|
346
|
+
return `
|
|
347
|
+
background: radial-gradient( var(--occuplan-bg-color-weekend), var(--occuplan-bg-color-main), var(--occuplan-bg-color-main)), linear-gradient(90deg, var(--occuplan-bg-color-main), ${sf.bgColor});
|
|
348
|
+
`;
|
|
349
|
+
}
|
|
350
|
+
return `
|
|
351
|
+
background: linear-gradient(90deg, var(--occuplan-bg-color-main), ${sf.bgColor});
|
|
352
|
+
`;
|
|
353
|
+
}
|
|
354
|
+
if (oEnds) {
|
|
355
|
+
const ef = occupationTypeFormattingByOccupation(oEnds);
|
|
356
|
+
if (isWeekend && highlightWeekend) {
|
|
357
|
+
return `
|
|
358
|
+
background: radial-gradient( var(--occuplan-bg-color-weekend), var(--occuplan-bg-color-main), var(--occuplan-bg-color-main)), linear-gradient(90deg, ${ef.bgColor}, var(--occuplan-bg-color-main));
|
|
359
|
+
`;
|
|
360
|
+
}
|
|
361
|
+
return `
|
|
362
|
+
background: linear-gradient(90deg, ${ef.bgColor}, var(--occuplan-bg-color-main));
|
|
363
|
+
`;
|
|
364
|
+
}
|
|
365
|
+
if (isWeekend && highlightWeekend) {
|
|
366
|
+
return `
|
|
367
|
+
background: radial-gradient(var(--occuplan-bg-color-weekend), var(--occuplan-bg-color-main), var(--occuplan-bg-color-main));
|
|
368
|
+
`;
|
|
369
|
+
}
|
|
370
|
+
return `
|
|
371
|
+
background-color: var(--occuplan-bg-color-main);
|
|
372
|
+
`;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
let _instances = {};
|
|
376
|
+
export const getOccupationState = (url) => {
|
|
377
|
+
const currentInstance = _instances[url];
|
|
378
|
+
if (currentInstance)
|
|
379
|
+
return currentInstance;
|
|
380
|
+
const newInstance = new OccupationState(url);
|
|
381
|
+
_instances[url] = newInstance;
|
|
382
|
+
return _instances[url];
|
|
383
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Dinero, type DineroSnapshot } from 'dinero.js';
|
|
2
2
|
import type { DateTime } from 'luxon';
|
|
3
3
|
import type { I18n } from 'occuplan';
|
|
4
|
+
import type { FirstMonth } from './occuplan/state.svelte.ts';
|
|
4
5
|
export interface GridPhoto {
|
|
5
6
|
photo: Photo;
|
|
6
7
|
zoomed: boolean;
|
|
@@ -23,7 +24,15 @@ export interface Calendar {
|
|
|
23
24
|
content: CalendarContent;
|
|
24
25
|
}
|
|
25
26
|
export interface CalendarContent {
|
|
26
|
-
|
|
27
|
+
url: string;
|
|
28
|
+
toggleGridOffset?: number;
|
|
29
|
+
gridMonthNumbers?: number;
|
|
30
|
+
gridFirstMonth?: FirstMonth;
|
|
31
|
+
gridMaxWidth?: string;
|
|
32
|
+
toggleRowsOffset?: number;
|
|
33
|
+
rowsMonthNumbers?: number;
|
|
34
|
+
rowsFirstMonth?: FirstMonth;
|
|
35
|
+
rowsMaxWidth?: string;
|
|
27
36
|
}
|
|
28
37
|
export interface CalendarAvailable {
|
|
29
38
|
id: string;
|
|
@@ -31,10 +40,30 @@ export interface CalendarAvailable {
|
|
|
31
40
|
content: CalendarAvailableContent;
|
|
32
41
|
}
|
|
33
42
|
export interface CalendarAvailableContent {
|
|
34
|
-
|
|
43
|
+
url: string;
|
|
35
44
|
search: number[];
|
|
36
45
|
maxFutureDate?: string;
|
|
37
46
|
}
|
|
47
|
+
export interface CalendarGrid {
|
|
48
|
+
id: string;
|
|
49
|
+
kind: 'calendar-grid';
|
|
50
|
+
content: CalendarGridContent;
|
|
51
|
+
}
|
|
52
|
+
export interface CalendarGridContent {
|
|
53
|
+
url: string;
|
|
54
|
+
maxYear?: number;
|
|
55
|
+
minYear?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface CalendarRows {
|
|
58
|
+
id: string;
|
|
59
|
+
kind: 'calendar-rows';
|
|
60
|
+
content: CalendarRowsContent;
|
|
61
|
+
}
|
|
62
|
+
export interface CalendarRowsContent {
|
|
63
|
+
url: string;
|
|
64
|
+
maxYear?: number;
|
|
65
|
+
minYear?: number;
|
|
66
|
+
}
|
|
38
67
|
export interface Text {
|
|
39
68
|
id: string;
|
|
40
69
|
kind: 'text';
|
|
@@ -55,7 +84,6 @@ export interface WeatherContent {
|
|
|
55
84
|
header1: string;
|
|
56
85
|
header2: string;
|
|
57
86
|
location: string;
|
|
58
|
-
currenLang: string;
|
|
59
87
|
}
|
|
60
88
|
export interface Photo {
|
|
61
89
|
id: string;
|
|
@@ -195,7 +223,46 @@ export interface AccoDescriptionContent {
|
|
|
195
223
|
textFontSize?: string;
|
|
196
224
|
headerFontSize?: string;
|
|
197
225
|
}
|
|
198
|
-
export
|
|
226
|
+
export interface ContactForm {
|
|
227
|
+
id: string;
|
|
228
|
+
kind: 'contact-form';
|
|
229
|
+
content: ContactFormContent;
|
|
230
|
+
}
|
|
231
|
+
export interface ContactFormContent {
|
|
232
|
+
userID: string;
|
|
233
|
+
endpoint: string;
|
|
234
|
+
nameLabel: string;
|
|
235
|
+
emailLabel: string;
|
|
236
|
+
questionLabel: string;
|
|
237
|
+
submitText: string;
|
|
238
|
+
successfullySentText: string;
|
|
239
|
+
sentErroredText: string;
|
|
240
|
+
maxCharsAllowed?: number;
|
|
241
|
+
explainer?: string;
|
|
242
|
+
}
|
|
243
|
+
export interface BookingRequest {
|
|
244
|
+
id: string;
|
|
245
|
+
kind: 'booking-request';
|
|
246
|
+
content: BookingRequestContent;
|
|
247
|
+
}
|
|
248
|
+
export interface BookingRequestContent {
|
|
249
|
+
endpoint: string;
|
|
250
|
+
userID: string;
|
|
251
|
+
acco: Acco;
|
|
252
|
+
calUrl: string;
|
|
253
|
+
nameLabel: string;
|
|
254
|
+
emailLabel: string;
|
|
255
|
+
dateEntryLabel: string;
|
|
256
|
+
submitText: string;
|
|
257
|
+
successfullySentText: string;
|
|
258
|
+
sentErroredText: string;
|
|
259
|
+
invalidText: string;
|
|
260
|
+
messageLabel: string;
|
|
261
|
+
numberOfNightsLabel: string;
|
|
262
|
+
maxCharsAllowed?: number;
|
|
263
|
+
explainer?: string;
|
|
264
|
+
}
|
|
265
|
+
export type Block = Text | Photo | PhotoGallery | Calendar | CalendarAvailable | CalendarGrid | CalendarRows | Pricing | PricingShort | AmenitiesCore | Weather | LeafletMap | AccoCard | AccoDescription | ContactForm | BookingRequest | undefined;
|
|
199
266
|
export interface Section {
|
|
200
267
|
id: string;
|
|
201
268
|
header?: string;
|
|
@@ -221,6 +288,10 @@ export declare const isWeather: (b: Block) => b is Weather;
|
|
|
221
288
|
export declare const isAmenitiesCore: (b: Block) => b is AmenitiesCore;
|
|
222
289
|
export declare const isCalendarAvailable: (b: Block) => b is CalendarAvailable;
|
|
223
290
|
export declare const isCalendar: (b: Block) => b is Calendar;
|
|
291
|
+
export declare const isCalendarGrid: (b: Block) => b is CalendarGrid;
|
|
292
|
+
export declare const isCalendarRows: (b: Block) => b is CalendarRows;
|
|
224
293
|
export declare const isPricing: (b: Block) => b is Pricing;
|
|
225
294
|
export declare const isPricingShort: (b: Block) => b is PricingShort;
|
|
226
295
|
export declare const isAccoDescription: (b: Block) => b is AccoDescription;
|
|
296
|
+
export declare const isContactForm: (b: Block) => b is ContactForm;
|
|
297
|
+
export declare const isBookingRequest: (b: Block) => b is BookingRequest;
|
package/dist/types.js
CHANGED
|
@@ -52,6 +52,16 @@ export const isCalendar = (b) => {
|
|
|
52
52
|
return false;
|
|
53
53
|
return b.kind === 'calendar';
|
|
54
54
|
};
|
|
55
|
+
export const isCalendarGrid = (b) => {
|
|
56
|
+
if (!b)
|
|
57
|
+
return false;
|
|
58
|
+
return b.kind === 'calendar-grid';
|
|
59
|
+
};
|
|
60
|
+
export const isCalendarRows = (b) => {
|
|
61
|
+
if (!b)
|
|
62
|
+
return false;
|
|
63
|
+
return b.kind === 'calendar-rows';
|
|
64
|
+
};
|
|
55
65
|
export const isPricing = (b) => {
|
|
56
66
|
if (!b)
|
|
57
67
|
return false;
|
|
@@ -67,3 +77,13 @@ export const isAccoDescription = (b) => {
|
|
|
67
77
|
return false;
|
|
68
78
|
return b.kind === 'acco-description';
|
|
69
79
|
};
|
|
80
|
+
export const isContactForm = (b) => {
|
|
81
|
+
if (!b)
|
|
82
|
+
return false;
|
|
83
|
+
return b.kind === 'contact-form';
|
|
84
|
+
};
|
|
85
|
+
export const isBookingRequest = (b) => {
|
|
86
|
+
if (!b)
|
|
87
|
+
return false;
|
|
88
|
+
return b.kind === 'booking-request';
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,62 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
2
|
+
"name": "accomadesc",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "vite dev",
|
|
6
|
+
"build": "vite build && npm run package",
|
|
7
|
+
"preview": "vite preview",
|
|
8
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
9
|
+
"prepublishOnly": "npm run package",
|
|
10
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
11
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
12
|
+
"test:unit": "vitest",
|
|
13
|
+
"test": "npm run test:unit -- --run",
|
|
14
|
+
"format": "prettier --write .",
|
|
15
|
+
"lint": "prettier --check ."
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"!dist/**/*.test.*",
|
|
20
|
+
"!dist/**/*.spec.*"
|
|
21
|
+
],
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"**/*.css"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"svelte": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"svelte": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@sveltejs/kit": "^2.15.2",
|
|
37
|
+
"svelte": "^5.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@sveltejs/adapter-auto": "^3.3.1",
|
|
41
|
+
"@sveltejs/kit": "^2.15.2",
|
|
42
|
+
"@sveltejs/package": "^2.3.7",
|
|
43
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
44
|
+
"@types/luxon": "^3.4.2",
|
|
45
|
+
"prettier": "^3.4.2",
|
|
46
|
+
"prettier-plugin-svelte": "^3.3.2",
|
|
47
|
+
"publint": "^0.3.1",
|
|
48
|
+
"svelte": "^5.17.3",
|
|
49
|
+
"svelte-check": "^4.1.3",
|
|
50
|
+
"typescript": "^5.7.3",
|
|
51
|
+
"vite": "^6.0.7",
|
|
52
|
+
"vitest": "^2.1.8"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@dinero.js/currencies": "2.0.0-alpha.14",
|
|
56
|
+
"@fontsource/raleway": "^5.1.1",
|
|
57
|
+
"@twicpics/components": "^0.31.1",
|
|
58
|
+
"@types/leaflet": "^1.9.16",
|
|
59
|
+
"dinero.js": "2.0.0-alpha.14",
|
|
60
|
+
"leaflet": "^1.9.4",
|
|
61
|
+
"luxon": "^3.5.0",
|
|
62
|
+
"occuplan": "^0.3.17",
|
|
63
|
+
"squirrelly": "^9.1.0"
|
|
64
|
+
}
|
|
65
|
+
}
|