accomadesc 0.1.41 → 0.1.42

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.
@@ -11,8 +11,14 @@
11
11
  type I18nFacade,
12
12
  } from './types.js';
13
13
 
14
- let { cardContent, displayName, translateFunc, formatFunc }: AccoCardContent & I18nFacade =
15
- $props();
14
+ let {
15
+ cardContent,
16
+ displayName,
17
+ translateFunc,
18
+ formatFunc,
19
+ formatMoneyFunc,
20
+ formatDateFunc,
21
+ }: AccoCardContent & I18nFacade = $props();
16
22
  let translatedSlug = $derived(
17
23
  translateFunc && cardContent.slug ? translateFunc(cardContent.slug) : '',
18
24
  );
@@ -35,11 +41,23 @@
35
41
  {#each cardContent.blocks as b, i}
36
42
  <div class="block-container-{i}">
37
43
  {#if isAmenitiesCore(b)}
38
- <AmenitiesCore {...b.content} {formatFunc} />
44
+ <AmenitiesCore {...b.content} {formatFunc} {formatMoneyFunc} {formatDateFunc} />
39
45
  {:else if isPricingShort(b)}
40
- <PricingShort {...b.content} {translateFunc} {formatFunc} />
46
+ <PricingShort
47
+ {...b.content}
48
+ {translateFunc}
49
+ {formatFunc}
50
+ {formatMoneyFunc}
51
+ {formatDateFunc}
52
+ />
41
53
  {:else if isCalendarAvailable(b)}
42
- <CalendarAvailable {...b.content} {translateFunc} {formatFunc} />
54
+ <CalendarAvailable
55
+ {...b.content}
56
+ {translateFunc}
57
+ {formatFunc}
58
+ {formatMoneyFunc}
59
+ {formatDateFunc}
60
+ />
43
61
  {:else}
44
62
  <span>Unsupported</span>
45
63
  {/if}
@@ -90,7 +108,7 @@
90
108
  color: var(--acco-card-font-color);
91
109
 
92
110
  * {
93
- --main-font-color: var(--acco-card-font);
111
+ --main-font-color: var(--acco-card-font-color);
94
112
  --main-bg-color: var(--acco-card-bg-color);
95
113
  background-color: var(--acco-card-bg-color);
96
114
  color: var(--acco-card-font-color);
@@ -9,6 +9,7 @@
9
9
  debug = true,
10
10
  search = [3, 7, 14],
11
11
  maxFutureDate = DateTime.now().plus({ years: 2 }).toISO(),
12
+ formatDateFunc,
12
13
  formatFunc,
13
14
  translateFunc,
14
15
  }: CalendarAvailableContent & I18nFacade & { debug?: boolean } = $props();
@@ -16,15 +17,17 @@
16
17
  let availHeader = $derived(translateFunc ? translateFunc('availability') : '[AVAILABILITY]');
17
18
 
18
19
  const formatAvailability = (from: DateTime | null, forDays: number): string => {
19
- if (!formatFunc) return '';
20
+ if (!formatFunc || !formatDateFunc) return '';
20
21
  if (from == null) {
22
+ const formattedFutureDate = formatDateFunc(maxFutureDate);
21
23
  return formatFunc('nothingAvailable', {
22
24
  forDays,
23
- maxFutureDate,
25
+ maxFutureDate: formattedFutureDate,
24
26
  });
25
27
  }
28
+ const formattedFrom = formatDateFunc(from);
26
29
  return formatFunc('availableFromFor', {
27
- from,
30
+ from: formattedFrom,
28
31
  forDays,
29
32
  });
30
33
  };
package/dist/Photo.svelte CHANGED
@@ -31,9 +31,10 @@
31
31
  class={className}
32
32
  src={photoPath}
33
33
  alt={altTranslation}
34
- {ratio}
35
34
  mode="cover"
36
35
  {eager}
36
+ {ratio}
37
+ position="center"
37
38
  {transition}
38
39
  />
39
40
  </div>
@@ -53,7 +54,7 @@
53
54
  style="width: {width}; height: {height};"
54
55
  href={link}
55
56
  target="_blank"
56
- rel="noreferrer noopener"
57
+ rel="noreferrer noopener nofollow"
57
58
  >
58
59
  {@render twic()}
59
60
  <div class="link-icon-wrapper"><ExtLinkSvg size="1.8rem" /></div>
@@ -107,6 +108,7 @@
107
108
  flex-direction: column;
108
109
  position: absolute;
109
110
  padding-bottom: 0.2rem;
111
+ padding-right: 0.3rem;
110
112
  top: 0;
111
113
  left: 0;
112
114
  width: 100%;
@@ -54,8 +54,9 @@
54
54
  if (formatFunc && translateFunc) {
55
55
  let terms = '';
56
56
  if (termsRef) terms = translateFunc(termsRef);
57
+ let formattedPrice = formatMoneyFunc?.(price);
57
58
  return formatFunc('additionalPersonPrice', {
58
- price,
59
+ price: formattedPrice,
59
60
  terms,
60
61
  });
61
62
  }
@@ -66,11 +67,15 @@
66
67
  let result = '';
67
68
  if (!formatFunc) return result;
68
69
  if (range.from && range.to) {
69
- result = formatFunc('rangeFromTo', { from: range.from, to: range.to });
70
+ const formattedFrom = formatDateFunc?.(range.from);
71
+ const formattedTo = formatDateFunc?.(range.to);
72
+ result = formatFunc('rangeFromTo', { from: formattedFrom, to: formattedTo });
70
73
  } else if (range.from) {
71
- result = formatFunc('rangeFrom', { from: range.from });
74
+ const formattedFrom = formatDateFunc?.(range.from);
75
+ result = formatFunc('rangeFrom', { from: formattedFrom });
72
76
  } else if (range.to) {
73
- result = formatFunc('rangeTo', { to: range.to });
77
+ const formattedTo = formatDateFunc?.(range.to);
78
+ result = formatFunc('rangeTo', { to: formattedTo });
74
79
  }
75
80
  return result;
76
81
  };
@@ -80,11 +85,22 @@
80
85
  if (!formatFunc) return result;
81
86
 
82
87
  if (range.from && range.to) {
83
- result = formatFunc('staticRangeFromTo', { from: range.from, to: range.to });
88
+ result = formatFunc('staticRangeFromTo', {
89
+ fromMonth: range.from.month,
90
+ fromDay: range.from.day,
91
+ toMonth: range.to.month,
92
+ toDay: range.to.day,
93
+ });
84
94
  } else if (range.from) {
85
- result = formatFunc('staticRangeFrom', { from: range.from });
95
+ result = formatFunc('staticRangeFrom', {
96
+ fromMonth: range.from.month,
97
+ fromDay: range.from.day,
98
+ });
86
99
  } else if (range.to) {
87
- result = formatFunc('staticRangeTo', { to: range.to });
100
+ result = formatFunc('staticRangeTo', {
101
+ toMonth: range.to.month,
102
+ toDay: range.to.day,
103
+ });
88
104
  }
89
105
 
90
106
  return result;
@@ -11,6 +11,7 @@
11
11
  staticRanges = [],
12
12
  showMaximum = true,
13
13
  showMinimum = true,
14
+ formatMoneyFunc,
14
15
  translateFunc,
15
16
  formatFunc,
16
17
  }: PricingShortContent & I18nFacade = $props();
@@ -26,7 +27,7 @@
26
27
  });
27
28
  });
28
29
 
29
- let calculatedMinium = $state(dinero({ amount: Number.MAX_SAFE_INTEGER, currency: EUR }));
30
+ let calculatedMinimum = $state(dinero({ amount: Number.MAX_SAFE_INTEGER, currency: EUR }));
30
31
  let calculatedMaximum = $state(dinero({ amount: 0, currency: EUR }));
31
32
 
32
33
  const calcAverage = (entry: PricingEntry): Dinero<number> | undefined => {
@@ -58,8 +59,8 @@
58
59
  if (greaterThan(avg, calculatedMaximum)) {
59
60
  calculatedMaximum = avg;
60
61
  }
61
- if (lessThan(avg, calculatedMinium)) {
62
- calculatedMinium = avg;
62
+ if (lessThan(avg, calculatedMinimum)) {
63
+ calculatedMinimum = avg;
63
64
  }
64
65
  }
65
66
  });
@@ -70,22 +71,29 @@
70
71
  if (greaterThan(globalAvg, calculatedMaximum)) {
71
72
  calculatedMaximum = globalAvg;
72
73
  }
73
- if (lessThan(globalAvg, calculatedMinium)) {
74
- calculatedMinium = globalAvg;
74
+ if (lessThan(globalAvg, calculatedMinimum)) {
75
+ calculatedMinimum = globalAvg;
75
76
  }
76
77
  }
77
78
  }
78
79
  });
80
+
81
+ let formattedMax: string | undefined = $derived(
82
+ formatMoneyFunc && formatMoneyFunc(calculatedMaximum),
83
+ );
84
+ let formattedMin: string | undefined = $derived(
85
+ formatMoneyFunc && formatMoneyFunc(calculatedMinimum),
86
+ );
79
87
  </script>
80
88
 
81
89
  <div class="pricing-short-wrapper">
82
90
  <h3>
83
91
  {translateFunc ? translateFunc('shortPriceLabel') : 'shortPriceLabel'}
84
92
  {#if showMinimum}<span
85
- >{formatFunc ? formatFunc('minimumPrice', { min: calculatedMinium }) : ''}</span
93
+ >{formatFunc ? formatFunc('minimumPrice', { min: formattedMin }) : ''}</span
86
94
  >{/if}
87
95
  {#if showMaximum}<span
88
- >{formatFunc ? formatFunc('maximumPrice', { max: calculatedMaximum }) : ''}</span
96
+ >{formatFunc ? formatFunc('maximumPrice', { max: formattedMax }) : ''}</span
89
97
  >{/if}
90
98
  </h3>
91
99
  </div>
@@ -88,21 +88,39 @@
88
88
  {#each blocks as block}
89
89
  <div class="block-container">
90
90
  {#if isAccoCard(block)}
91
- <AccoCard {...block.content} {translateFunc} {formatFunc} />
91
+ <AccoCard
92
+ {...block.content}
93
+ {translateFunc}
94
+ {formatFunc}
95
+ {formatDateFunc}
96
+ {formatMoneyFunc}
97
+ />
92
98
  {:else if isAccoDescription(block)}
93
- <AccoDescription {...block.content} {translateFunc} />
99
+ <AccoDescription {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
94
100
  {:else if isAmenitiesCore(block)}
95
- <AmenitiesCore {...block.content} {formatFunc} />
101
+ <AmenitiesCore {...block.content} {formatFunc} {formatDateFunc} {formatMoneyFunc} />
96
102
  {:else if isCalendar(block)}
97
- <Calendar {...block.content} {translateFunc} {calendarTranslation} />
103
+ <Calendar
104
+ {...block.content}
105
+ {translateFunc}
106
+ {calendarTranslation}
107
+ {formatDateFunc}
108
+ {formatMoneyFunc}
109
+ />
98
110
  {:else if isCalendarAvailable(block)}
99
- <CalendarAvailable {...block.content} {formatFunc} {translateFunc} />
111
+ <CalendarAvailable
112
+ {...block.content}
113
+ {formatFunc}
114
+ {translateFunc}
115
+ {formatDateFunc}
116
+ {formatMoneyFunc}
117
+ />
100
118
  {:else if isLeafletMap(block)}
101
119
  <LeafletMap {...block.content} />
102
120
  {:else if isPhoto(block)}
103
- <Photo {...block.content} {translateFunc} />
121
+ <Photo {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
104
122
  {:else if isGallery(block)}
105
- <PhotoGallery {...block.content} {translateFunc} />
123
+ <PhotoGallery {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
106
124
  {:else if isPricing(block)}
107
125
  <Pricing
108
126
  {...block.content}
@@ -113,19 +131,31 @@
113
131
  {currentLang}
114
132
  />
115
133
  {:else if isPricingShort(block)}
116
- <PricingShort {...block.content} {translateFunc} {formatFunc} />
134
+ <PricingShort
135
+ {...block.content}
136
+ {translateFunc}
137
+ {formatFunc}
138
+ {formatDateFunc}
139
+ {formatMoneyFunc}
140
+ />
117
141
  {:else if isText(block)}
118
- <Text {...block.content} {translateFunc} />
142
+ <Text {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
119
143
  {:else if isWeather(block)}
120
- <Weather {...block.content} {translateFunc} {currentLang} />
144
+ <Weather
145
+ {...block.content}
146
+ {translateFunc}
147
+ {currentLang}
148
+ {formatDateFunc}
149
+ {formatMoneyFunc}
150
+ />
121
151
  {:else if isBookingRequest(block)}
122
- <BookingRequest {...block.content} {translateFunc} {formatDateFunc} />
152
+ <BookingRequest {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
123
153
  {:else if isCalendarRows(block)}
124
- <CalendarRows {...block.content} {translateFunc} />
154
+ <CalendarRows {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
125
155
  {:else if isCalendarGrid(block)}
126
- <CalendarGrid {...block.content} {translateFunc} />
156
+ <CalendarGrid {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
127
157
  {:else if isContactForm(block)}
128
- <ContactForm {...block.content} {translateFunc} />
158
+ <ContactForm {...block.content} {translateFunc} {formatDateFunc} {formatMoneyFunc} />
129
159
  {:else}
130
160
  <div>[UNEXPECTED VALUE]</div>
131
161
  {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
@@ -46,7 +46,7 @@
46
46
  "prettier": "^3.5.2",
47
47
  "prettier-plugin-svelte": "^3.3.3",
48
48
  "publint": "^0.3.6",
49
- "svelte": "^5.20.2",
49
+ "svelte": "^5.20.4",
50
50
  "svelte-check": "^4.1.4",
51
51
  "typescript": "^5.7.3",
52
52
  "vite": "^6.1.1",