accomadesc 0.3.35 → 0.3.37

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.
@@ -1,6 +1,5 @@
1
1
  <script lang="ts">
2
2
  import type { BookingRequestContent, I18nFacade } from './types.js';
3
- import { getContext } from 'svelte';
4
3
  import Button from './basic/Button.svelte';
5
4
  import Notes from './basic/Notes.svelte';
6
5
  import Spinner from './basic/Spinner.svelte';
@@ -55,7 +54,7 @@
55
54
  let sending = $state(false);
56
55
  let disabled = $derived(preview || errored || successfullySent);
57
56
 
58
- let occupationState: OccupationState = getOccupationState(calUrl);
57
+ let occupationState: OccupationState = $derived(getOccupationState(calUrl));
59
58
  let invalid = $derived(
60
59
  occupationState && arrival && leave ? !occupationState.validRequest(arrival, leave) : false,
61
60
  );
@@ -19,14 +19,13 @@
19
19
  close: () => void;
20
20
  } & I18nFacade = $props();
21
21
 
22
- let allTranslations = $state(supportedLangs);
23
22
  const pathForLang = (lang: string) => {
24
23
  const pathElements = currentPath.split('/');
25
24
  //initial slash results in empty string real first element
26
25
  if (pathElements.length == 1) return `/${lang}`;
27
26
 
28
27
  const firstElement = pathElements[1];
29
- if (allTranslations?.includes(firstElement)) {
28
+ if (supportedLangs?.includes(firstElement)) {
30
29
  return ['', lang, ...pathElements.slice(2)].join('/');
31
30
  } else {
32
31
  return ['', lang, ...pathElements.slice(1)].join('/');
@@ -46,11 +45,11 @@
46
45
  </li>
47
46
  {/each}
48
47
  </ul>
49
- {#if allTranslations && allTranslations.length > 1}
48
+ {#if supportedLangs && supportedLangs.length > 1}
50
49
  <fieldset>
51
50
  <legend>{translateFunc ? translateFunc('lang') : ''}</legend>
52
51
 
53
- {#each allTranslations as langKey}
52
+ {#each supportedLangs as langKey}
54
53
  <a
55
54
  data-sveltekit-keepfocus
56
55
  data-sveltekit-noscroll
@@ -36,13 +36,7 @@
36
36
  </a>
37
37
  </div>
38
38
  {:else}
39
- <a
40
- href={path}
41
- {onclick}
42
- data-sveltekit-keepfocus
43
- data-sveltekit-noscroll
44
- class:disabled={gs.disableLinks}
45
- >
39
+ <a href={path} {onclick} class:disabled={gs.disableLinks}>
46
40
  {translateFunc ? translateFunc(n.key) : ''}
47
41
  </a>
48
42
  {/if}
@@ -17,7 +17,7 @@
17
17
  import Button from './basic/Button.svelte';
18
18
  import { fallbackCSS } from './style.js';
19
19
  import { GLOBAL_STATE, GlobalState } from './state.svelte';
20
- import { setContext } from 'svelte';
20
+ import { setContext, untrack } from 'svelte';
21
21
 
22
22
  let {
23
23
  hero,
@@ -44,12 +44,11 @@
44
44
  calendarTranslation,
45
45
  }: PageProps & I18nFacade = $props();
46
46
 
47
- setContext(GLOBAL_STATE, new GlobalState(disableLinks));
48
-
49
- let pageTitle = hero && hero.title ? hero.title : header ? header : title;
47
+ // initialize global state, use the initial value of disableLinks
48
+ setContext(GLOBAL_STATE, new GlobalState(untrack(() => disableLinks)));
50
49
 
50
+ let pageTitle = $derived(hero && hero.title ? hero.title : header ? header : title);
51
51
  let langSelectorOpen = $state(false);
52
- let allTranslations = $state(supportedLangs);
53
52
 
54
53
  let currentPath = $derived(page.url.pathname);
55
54
  const pathForLang = (lang: string) => {
@@ -58,7 +57,7 @@
58
57
  if (pathElements.length == 1) return `/${lang}`;
59
58
 
60
59
  const firstElement = pathElements[1];
61
- if (allTranslations?.includes(firstElement)) {
60
+ if (supportedLangs?.includes(firstElement)) {
62
61
  return ['', lang, ...pathElements.slice(2)].join('/');
63
62
  } else {
64
63
  return ['', lang, ...pathElements.slice(1)].join('/');
@@ -192,11 +191,11 @@
192
191
  {/if}
193
192
  {/if}
194
193
 
195
- {#if langSelectorOpen && allTranslations && allTranslations.length > 1}
194
+ {#if langSelectorOpen && supportedLangs && supportedLangs.length > 1}
196
195
  <fieldset class="lang-selector" transition:fade>
197
196
  <legend>{translateFunc ? translateFunc('lang') : ''}</legend>
198
197
 
199
- {#each allTranslations as langKey}
198
+ {#each supportedLangs as langKey}
200
199
  <a
201
200
  class={{
202
201
  'lang-link': true,
@@ -4,7 +4,7 @@
4
4
 
5
5
  let { nav, ref, translateFunc, currentLang }: { nav: Nav; ref?: string } & I18nFacade = $props();
6
6
 
7
- const contentRef = ref ?? 'footer_html';
7
+ const contentRef = $derived(ref ?? 'footer_html');
8
8
  </script>
9
9
 
10
10
  <footer>
@@ -24,9 +24,9 @@
24
24
  currentLang,
25
25
  }: PricingContent & I18nFacade = $props();
26
26
 
27
- if (!ranges || (ranges.length == 0 && entries)) {
28
- ranges = entries;
29
- }
27
+ $effect(() => {
28
+ if (!ranges || (ranges.length == 0 && entries)) ranges = entries;
29
+ });
30
30
 
31
31
  const colHeaderStyle: Record<PricingColumn, string> = {
32
32
  timeRange: 'width: 20%;',
@@ -14,7 +14,10 @@
14
14
  formatFunc,
15
15
  }: PricingShortContent & I18nFacade = $props();
16
16
 
17
- if (!ranges && entries) ranges = entries;
17
+ $effect(() => {
18
+ //unclear if this is even needed and working as expected
19
+ if (!ranges && entries) ranges = entries;
20
+ });
18
21
 
19
22
  let filteredEntries = $derived.by(() => {
20
23
  let now = DateTime.now();
@@ -53,7 +53,7 @@
53
53
 
54
54
  let translatedHeader = $derived(header && translateFunc ? translateFunc(header) : '');
55
55
 
56
- let gridTemplateColumns = $state(`repeat(${columnCount}, 1fr)`);
56
+ let gridTemplateColumns = $state(`repeat(2, 1fr)`);
57
57
 
58
58
  let originalPadding = $state(padding);
59
59
 
@@ -66,7 +66,7 @@
66
66
  gridTemplateColumns = '1fr 1fr';
67
67
  padding = originalPadding;
68
68
  } else {
69
- if (!!columnCount && columnCount > 1) {
69
+ if (!!columnCount) {
70
70
  gridTemplateColumns = `repeat(${columnCount}, 1fr)`;
71
71
  }
72
72
  padding = originalPadding;
@@ -0,0 +1,32 @@
1
+ import type { CookieSelection, Translation as CookieTranslation } from 'gdpr-cooco-banner';
2
+ import { DateTime } from 'luxon';
3
+ import type { FormatSpec, I18nFacade, SiteConfig } from './types.ts';
4
+ import type { OccuplanTranslations } from './occuplan/state.svelte.ts';
5
+ interface FullTranslation {
6
+ calendar: OccuplanTranslations;
7
+ cookies: CookieTranslation;
8
+ site: Record<string, string>;
9
+ }
10
+ export declare class SiteState implements I18nFacade {
11
+ _getSiteConfigFn: () => SiteConfig;
12
+ get fullTranslations(): Record<string, FullTranslation>;
13
+ get calendarTranslations(): Record<string, OccuplanTranslations>;
14
+ get cookieTranslations(): Record<string, CookieTranslation>;
15
+ get siteTranslations(): Record<string, Record<string, string>>;
16
+ get supportedLangs(): string[];
17
+ cookieSelection: CookieSelection;
18
+ currentLang: string;
19
+ get translations(): Record<string, Record<string, string>>;
20
+ get calendarTranslation(): OccuplanTranslations;
21
+ get cookieTranslation(): CookieTranslation;
22
+ get formats(): Record<string, FormatSpec>;
23
+ selectedTheme: 'light' | 'dark';
24
+ selectedThemeInitialized: boolean;
25
+ constructor(getSiteConfig: () => SiteConfig, lang: string | undefined);
26
+ updateCurrentLang: (lang: string) => string;
27
+ translateFunc: (ref: string) => string;
28
+ formatFunc: (ref: string, props: Record<string, any>) => string;
29
+ formatDateFunc: (d: DateTime | string) => string;
30
+ translateWithLangFunc: (ref: string, lang: string) => string;
31
+ }
32
+ export {};
@@ -0,0 +1,113 @@
1
+ import { DateTime } from 'luxon';
2
+ import { format } from './helpers/format.ts';
3
+ export class SiteState {
4
+ _getSiteConfigFn;
5
+ //fullTranslations: Record<string, FullTranslation> = $derived(this._getSiteConfigFn().lang.translations);
6
+ get fullTranslations() {
7
+ return this._getSiteConfigFn().lang.translations;
8
+ }
9
+ get calendarTranslations() {
10
+ return Object.entries(this.fullTranslations).reduce((s, e) => {
11
+ s[e[0]] = e[1].calendar;
12
+ return s;
13
+ }, {});
14
+ }
15
+ ;
16
+ get cookieTranslations() {
17
+ return Object.entries(this.fullTranslations).reduce((s, e) => {
18
+ s[e[0]] = e[1].cookies;
19
+ return s;
20
+ }, {});
21
+ }
22
+ get siteTranslations() {
23
+ return Object.entries(this.fullTranslations).reduce((s, e) => {
24
+ s[e[0]] = e[1].site;
25
+ return s;
26
+ }, {});
27
+ }
28
+ get supportedLangs() {
29
+ return this._getSiteConfigFn().lang.supportedLangs;
30
+ }
31
+ cookieSelection = $state({
32
+ analytics: false,
33
+ marketing: false,
34
+ preferences: false,
35
+ necessary: true,
36
+ });
37
+ currentLang = $state('en');
38
+ get translations() {
39
+ return this.siteTranslations;
40
+ }
41
+ get calendarTranslation() {
42
+ return this.calendarTranslations[this.currentLang];
43
+ }
44
+ get cookieTranslation() {
45
+ return this.cookieTranslations[this.currentLang];
46
+ }
47
+ get formats() {
48
+ return this._getSiteConfigFn().lang.formats;
49
+ }
50
+ selectedTheme = $state('light');
51
+ selectedThemeInitialized = $state(false);
52
+ constructor(getSiteConfig, lang) {
53
+ this._getSiteConfigFn = getSiteConfig;
54
+ if (!lang || !getSiteConfig().lang.supportedLangs.includes(lang)) {
55
+ this.currentLang = getSiteConfig().lang.defaultLang;
56
+ }
57
+ else {
58
+ this.currentLang = lang;
59
+ }
60
+ }
61
+ updateCurrentLang = (lang) => (this.currentLang = lang);
62
+ translateFunc = (ref) => {
63
+ if (!ref)
64
+ return '[UNDEF]';
65
+ const current = this.translations[this.currentLang];
66
+ if (!current[ref])
67
+ return '';
68
+ return this.translations[this.currentLang][ref];
69
+ };
70
+ formatFunc = (ref, props) => {
71
+ const fString = this.formats[this.currentLang][ref];
72
+ if (!fString) {
73
+ console.warn(`[Missing formatFunc: ${ref}]`);
74
+ return '[UNDEF]';
75
+ }
76
+ let formatted = format(fString, props);
77
+ return formatted;
78
+ };
79
+ formatDateFunc = (d) => {
80
+ if (!d)
81
+ return this.translateFunc("invalid");
82
+ const formatSpecs = this.formats[this.currentLang];
83
+ let f = 'yyyy-MM-dd';
84
+ if (formatSpecs?.dateFormat) {
85
+ f = formatSpecs.dateFormat;
86
+ }
87
+ let date;
88
+ if (typeof d === 'string')
89
+ date = DateTime.fromISO(d);
90
+ else
91
+ date = d;
92
+ // if d was invalid to begin with or
93
+ // translformation from ISO didn't yield a valid DateTime object
94
+ if (date.isValid)
95
+ return this.translateFunc("invalid");
96
+ return date.setLocale(formatSpecs.locale).toFormat(f);
97
+ };
98
+ translateWithLangFunc = (ref, lang) => {
99
+ const translation = this.translations[lang];
100
+ if (!translation) {
101
+ console.error(`[Tried to access unknown translation: ${lang}]`);
102
+ return "[UNDEF]";
103
+ }
104
+ const res = translation[ref];
105
+ if (res === undefined) {
106
+ console.warn(`[Missing Translation for: ${ref}]`);
107
+ return '[UNDEF]';
108
+ }
109
+ else {
110
+ return res;
111
+ }
112
+ };
113
+ }
@@ -141,7 +141,7 @@
141
141
  let innerShadowWidth = $derived(activated ? size / 16 : size / 8);
142
142
  let outerShadowWidth = $derived(activated ? size / 8 : size / 4);
143
143
 
144
- const borderRadius = $state(size / 1.8);
144
+ const borderRadius = $derived(size / 1.8);
145
145
 
146
146
  let buttonWidth = $derived.by(() => {
147
147
  if (iconName && !text) {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { randomName, randomID } from './names/gen.js';
2
2
  import { format } from './helpers/format.js';
3
3
  import { MoneyFormats } from './helpers/moneyFormats.js';
4
+ import { SiteState } from './SiteState.svelte.js';
4
5
  import Avatar from './basic/Avatar.svelte';
5
6
  import Button from './basic/Button.svelte';
6
7
  import Icon from './basic/Icon.svelte';
@@ -28,4 +29,4 @@ import PageComponent from './PageComponent.svelte';
28
29
  export type { OccuplanTranslations } from './occuplan/state.svelte';
29
30
  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, AccoDescription as AccoDescriptionI, AccoDescriptionContent, Section as SectionI, I18nFacade, AccoBlock, Block, PageProps, PageConfig, Nav as NavI, Style, NavItem, FormatSpec, FormatTemplateName, SiteConfig, LangConfig, CookieConfig, SiteFonts, SiteTranslation, FontSpec, Hero, } from './types.js';
30
31
  export { PRICING_COLUMNS, BLOCK_KINDS, isAccoCard, isText, isPhoto, isGallery, isLeafletMap, isWeather, isAmenitiesCore, isCalendarAvailable, isCalendar, isCalendarGrid, isCalendarRows, isPricing, isPricingShort, isAccoDescription, isBookingRequest, isContactForm, isAccoBlock, } from './types.js';
31
- export { randomID, randomName, format, MoneyFormats, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, BookingRequest, ContactForm, CalendarRows, CalendarGrid, Notes, PageComponent, };
32
+ export { randomID, randomName, format, MoneyFormats, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, BookingRequest, ContactForm, CalendarRows, CalendarGrid, Notes, PageComponent, SiteState, };
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { randomName, randomID } from './names/gen.js';
3
3
  import { format } from './helpers/format.js';
4
4
  import { MoneyFormats } from './helpers/moneyFormats.js';
5
+ import { SiteState } from './SiteState.svelte.js';
5
6
  import Avatar from './basic/Avatar.svelte';
6
7
  import Button from './basic/Button.svelte';
7
8
  import Icon from './basic/Icon.svelte';
@@ -27,4 +28,4 @@ import Text from './Text.svelte';
27
28
  import Weather from './Weather.svelte';
28
29
  import PageComponent from './PageComponent.svelte';
29
30
  export { PRICING_COLUMNS, BLOCK_KINDS, isAccoCard, isText, isPhoto, isGallery, isLeafletMap, isWeather, isAmenitiesCore, isCalendarAvailable, isCalendar, isCalendarGrid, isCalendarRows, isPricing, isPricingShort, isAccoDescription, isBookingRequest, isContactForm, isAccoBlock, } from './types.js';
30
- export { randomID, randomName, format, MoneyFormats, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, BookingRequest, ContactForm, CalendarRows, CalendarGrid, Notes, PageComponent, };
31
+ export { randomID, randomName, format, MoneyFormats, Avatar, Button, Icon, Spinner, TextInput, AccoCard, AccoDescription, AmenitiesCore, Calendar, CalendarAvailable, LeafletMap, Photo, PhotoGallery, Pricing, PricingShort, Section, Text, Weather, BookingRequest, ContactForm, CalendarRows, CalendarGrid, Notes, PageComponent, SiteState, };
@@ -23,8 +23,7 @@
23
23
  children: Snippet<[AvailableSpans]>;
24
24
  } = $props();
25
25
 
26
- let occupationState: OccupationState = getOccupationState(url, debug);
27
-
26
+ let occupationState: OccupationState = $derived(getOccupationState(url, debug));
28
27
  let av = $derived(occupationState ? occupationState.calcAvailability(search, maxFutureDate) : {});
29
28
 
30
29
  onMount(() => {
@@ -49,7 +49,7 @@
49
49
 
50
50
  const id = randomID();
51
51
 
52
- let occupationState: OccupationState = getOccupationState(url, debug);
52
+ let occupationState: OccupationState = $derived(getOccupationState(url, debug));
53
53
 
54
54
  //let formatFun = $derived(Sqrl.compile(monthHeaderFormat, { useWith: true }));
55
55
  const monthHeader = (monthNum: MonthNumbers, year: number): string => {
@@ -56,7 +56,7 @@
56
56
  dateSelected?: (arrival: DateTime, leave: DateTime) => void;
57
57
  } = $props();
58
58
 
59
- let occupationState: OccupationState = getOccupationState(url, debug);
59
+ let occupationState: OccupationState = $derived(getOccupationState(url, debug));
60
60
 
61
61
  const monthHeader = (monthNum: MonthNumbers, year: number): string => {
62
62
  const monthLabel = monthLabels[monthNum];
@@ -103,8 +103,17 @@
103
103
  page -= 1;
104
104
  };
105
105
 
106
- let requestStart: DateTime | undefined = $state(arrival);
107
- let requestEnd: DateTime | undefined = $state(leave);
106
+ let requestStart: DateTime | undefined = $state();
107
+ let requestEnd: DateTime | undefined = $state();
108
+
109
+ $effect(() => {
110
+ requestStart = arrival;
111
+ });
112
+
113
+ $effect(() => {
114
+ requestEnd = leave;
115
+ });
116
+
108
117
  let earliestStart: DateTime | undefined = $derived(
109
118
  occupationState ? occupationState.earliestRequestStart(requestEnd) : undefined,
110
119
  );
@@ -47,7 +47,7 @@
47
47
 
48
48
  const id = randomID();
49
49
 
50
- let occupationState: OccupationState = getOccupationState(url, debug);
50
+ let occupationState: OccupationState = $derived(getOccupationState(url, debug));
51
51
 
52
52
  let page: number = $state(0);
53
53
  let rfMonth: number | DateTime = $derived(
@@ -0,0 +1,157 @@
1
+ export declare const DefaultCalTranslations: {
2
+ es: {
3
+ weekdayLabels: {
4
+ 1: string;
5
+ 2: string;
6
+ 3: string;
7
+ 4: string;
8
+ 5: string;
9
+ 6: string;
10
+ 7: string;
11
+ };
12
+ monthLabels: {
13
+ 1: string;
14
+ 2: string;
15
+ 3: string;
16
+ 4: string;
17
+ 5: string;
18
+ 6: string;
19
+ 7: string;
20
+ 8: string;
21
+ 9: string;
22
+ 10: string;
23
+ 11: string;
24
+ 12: string;
25
+ };
26
+ weekendLabel: string;
27
+ typeLabels: {
28
+ one: string;
29
+ two: string;
30
+ three: string;
31
+ };
32
+ };
33
+ fr: {
34
+ weekdayLabels: {
35
+ 1: string;
36
+ 2: string;
37
+ 3: string;
38
+ 4: string;
39
+ 5: string;
40
+ 6: string;
41
+ 7: string;
42
+ };
43
+ monthLabels: {
44
+ 1: string;
45
+ 2: string;
46
+ 3: string;
47
+ 4: string;
48
+ 5: string;
49
+ 6: string;
50
+ 7: string;
51
+ 8: string;
52
+ 9: string;
53
+ 10: string;
54
+ 11: string;
55
+ 12: string;
56
+ };
57
+ weekendLabel: string;
58
+ typeLabels: {
59
+ one: string;
60
+ two: string;
61
+ three: string;
62
+ };
63
+ };
64
+ pl: {
65
+ weekdayLabels: {
66
+ 1: string;
67
+ 2: string;
68
+ 3: string;
69
+ 4: string;
70
+ 5: string;
71
+ 6: string;
72
+ 7: string;
73
+ };
74
+ monthLabels: {
75
+ 1: string;
76
+ 2: string;
77
+ 3: string;
78
+ 4: string;
79
+ 5: string;
80
+ 6: string;
81
+ 7: string;
82
+ 8: string;
83
+ 9: string;
84
+ 10: string;
85
+ 11: string;
86
+ 12: string;
87
+ };
88
+ weekendLabel: string;
89
+ typeLabels: {
90
+ one: string;
91
+ two: string;
92
+ three: string;
93
+ };
94
+ };
95
+ en: {
96
+ weekdayLabels: {
97
+ 1: string;
98
+ 2: string;
99
+ 3: string;
100
+ 4: string;
101
+ 5: string;
102
+ 6: string;
103
+ 7: string;
104
+ };
105
+ monthLabels: {
106
+ 1: string;
107
+ 2: string;
108
+ 3: string;
109
+ 4: string;
110
+ 5: string;
111
+ 6: string;
112
+ 7: string;
113
+ 8: string;
114
+ 9: string;
115
+ 10: string;
116
+ 11: string;
117
+ 12: string;
118
+ };
119
+ weekendLabel: string;
120
+ typeLabels: {
121
+ one: string;
122
+ two: string;
123
+ three: string;
124
+ };
125
+ };
126
+ de: {
127
+ weekdayLabels: {
128
+ 1: string;
129
+ 2: string;
130
+ 3: string;
131
+ 4: string;
132
+ 5: string;
133
+ 6: string;
134
+ 7: string;
135
+ };
136
+ monthLabels: {
137
+ 1: string;
138
+ 2: string;
139
+ 3: string;
140
+ 4: string;
141
+ 5: string;
142
+ 6: string;
143
+ 7: string;
144
+ 8: string;
145
+ 9: string;
146
+ 10: string;
147
+ 11: string;
148
+ 12: string;
149
+ };
150
+ weekendLabel: string;
151
+ typeLabels: {
152
+ one: string;
153
+ two: string;
154
+ three: string;
155
+ };
156
+ };
157
+ };
@@ -0,0 +1,157 @@
1
+ export const DefaultCalTranslations = {
2
+ es: {
3
+ weekdayLabels: {
4
+ 1: 'Lu',
5
+ 2: 'Ma',
6
+ 3: 'Mi',
7
+ 4: 'Ju',
8
+ 5: 'Vi',
9
+ 6: 'Sa',
10
+ 7: 'Do',
11
+ },
12
+ monthLabels: {
13
+ 1: 'Ene',
14
+ 2: 'Feb',
15
+ 3: 'Mar',
16
+ 4: 'Abr',
17
+ 5: 'May',
18
+ 6: 'Jun',
19
+ 7: 'Jul',
20
+ 8: 'Ago',
21
+ 9: 'Sep',
22
+ 10: 'Oct',
23
+ 11: 'Nov',
24
+ 12: 'Dic',
25
+ },
26
+ weekendLabel: 'Fin de Semana',
27
+ typeLabels: {
28
+ one: 'Ocupado',
29
+ two: 'Ocupade',
30
+ three: '',
31
+ },
32
+ },
33
+ fr: {
34
+ weekdayLabels: {
35
+ 1: 'Lu',
36
+ 2: 'Ma',
37
+ 3: 'Me',
38
+ 4: 'Je',
39
+ 5: 'Ve',
40
+ 6: 'Sa',
41
+ 7: 'Di',
42
+ },
43
+ monthLabels: {
44
+ 1: 'Jan',
45
+ 2: 'Fév',
46
+ 3: 'Mar',
47
+ 4: 'Avr',
48
+ 5: 'Mai',
49
+ 6: 'Juin',
50
+ 7: 'Juil',
51
+ 8: 'Août',
52
+ 9: 'Sept',
53
+ 10: 'Oct',
54
+ 11: 'Nov',
55
+ 12: 'Déc',
56
+ },
57
+ weekendLabel: 'Week-end',
58
+ typeLabels: {
59
+ one: 'Occupé',
60
+ two: 'Occupé',
61
+ three: '',
62
+ },
63
+ },
64
+ pl: {
65
+ weekdayLabels: {
66
+ 1: 'Pon',
67
+ 2: 'Wt',
68
+ 3: 'Śr',
69
+ 4: 'Czw',
70
+ 5: 'Pt',
71
+ 6: 'Sob',
72
+ 7: 'Ndz',
73
+ },
74
+ monthLabels: {
75
+ 1: 'Sty',
76
+ 2: 'Lut',
77
+ 3: 'Mar',
78
+ 4: 'Kwi',
79
+ 5: 'Maj',
80
+ 6: 'Cze',
81
+ 7: 'Lip',
82
+ 8: 'Sie',
83
+ 9: 'Wrz',
84
+ 10: 'Paź',
85
+ 11: 'Lis',
86
+ 12: 'Gru',
87
+ },
88
+ weekendLabel: 'Weekend',
89
+ typeLabels: {
90
+ one: 'Zajęty',
91
+ two: 'Zajęty',
92
+ three: '',
93
+ },
94
+ },
95
+ en: {
96
+ weekdayLabels: {
97
+ 1: 'Mo',
98
+ 2: 'Tu',
99
+ 3: 'We',
100
+ 4: 'Th',
101
+ 5: 'Fr',
102
+ 6: 'Sa',
103
+ 7: 'Su',
104
+ },
105
+ monthLabels: {
106
+ 1: 'Jan',
107
+ 2: 'Feb',
108
+ 3: 'Mar',
109
+ 4: 'Apr',
110
+ 5: 'May',
111
+ 6: 'Jun',
112
+ 7: 'Jul',
113
+ 8: 'Aug',
114
+ 9: 'Sep',
115
+ 10: 'Oct',
116
+ 11: 'Nov',
117
+ 12: 'Dec',
118
+ },
119
+ weekendLabel: 'Weekend',
120
+ typeLabels: {
121
+ one: 'Occupied',
122
+ two: 'Blocked',
123
+ three: 'Requested',
124
+ },
125
+ },
126
+ de: {
127
+ weekdayLabels: {
128
+ 1: 'Mo',
129
+ 2: 'Di',
130
+ 3: 'Mi',
131
+ 4: 'Do',
132
+ 5: 'Fr',
133
+ 6: 'Sa',
134
+ 7: 'So',
135
+ },
136
+ monthLabels: {
137
+ 1: 'Jan',
138
+ 2: 'Feb',
139
+ 3: 'Mär',
140
+ 4: 'Apr',
141
+ 5: 'Mai',
142
+ 6: 'Jun',
143
+ 7: 'Jul',
144
+ 8: 'Aug',
145
+ 9: 'Sep',
146
+ 10: 'Okt',
147
+ 11: 'Nov',
148
+ 12: 'Dez',
149
+ },
150
+ weekendLabel: 'Wochenende',
151
+ typeLabels: {
152
+ one: 'Belegt',
153
+ two: 'Geblockt',
154
+ three: 'Anfrage',
155
+ },
156
+ },
157
+ };
@@ -411,7 +411,7 @@ export class OccupationState {
411
411
  export const getOccupationState = (url, debug = false) => {
412
412
  if (debug)
413
413
  console.log('Get OState /w url', url);
414
- const stateID = `i-${url}-${OCCUPATION_STATE}`;
414
+ const stateID = Symbol(`i-${url}-${OCCUPATION_STATE}`);
415
415
  let _instance = getContext(stateID);
416
416
  if (_instance)
417
417
  return _instance;
@@ -1,4 +1,4 @@
1
- export declare const GLOBAL_STATE = "GLOBAL_STATE";
1
+ export declare const GLOBAL_STATE: unique symbol;
2
2
  export declare class GlobalState {
3
3
  disableLinks: boolean;
4
4
  constructor(disableLinks: boolean);
@@ -1,4 +1,4 @@
1
- export const GLOBAL_STATE = 'GLOBAL_STATE';
1
+ export const GLOBAL_STATE = Symbol('GLOBAL_STATE');
2
2
  export class GlobalState {
3
3
  disableLinks = $state(false);
4
4
  constructor(disableLinks) {
package/dist/types.d.ts CHANGED
@@ -396,6 +396,7 @@ export interface I18nFacade {
396
396
  supportedLangs?: string[];
397
397
  calendarTranslation?: OccuplanTranslations;
398
398
  translateFunc?: (ref: string) => string;
399
+ translateWithLangFunc?: (ref: string, lang: string) => string;
399
400
  formatFunc?: (formatter: string, props: Record<string, any>) => string;
400
401
  formatMoneyFunc?: (d: number) => string;
401
402
  formatDateFunc?: (d: DateTime | string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.3.35",
3
+ "version": "0.3.37",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -26,16 +26,16 @@
26
26
  "devDependencies": {
27
27
  "@sveltejs/adapter-auto": "^3.3.1",
28
28
  "@sveltejs/adapter-static": "^3.0.10",
29
- "@sveltejs/kit": "^2.49.0",
30
- "@sveltejs/package": "^2.5.6",
29
+ "@sveltejs/kit": "^2.49.2",
30
+ "@sveltejs/package": "^2.5.7",
31
31
  "@sveltejs/vite-plugin-svelte": "^5.1.1",
32
32
  "@types/luxon": "^3.7.1",
33
- "gdpr-cooco-banner": "^0.0.11",
34
- "prettier": "^3.6.2",
35
- "prettier-plugin-svelte": "^3.4.0",
36
- "publint": "^0.3.15",
37
- "svelte": "^5.43.14",
38
- "svelte-check": "^4.3.4",
33
+ "gdpr-cooco-banner": "^0.0.12",
34
+ "prettier": "^3.7.4",
35
+ "prettier-plugin-svelte": "^3.4.1",
36
+ "publint": "^0.3.16",
37
+ "svelte": "^5.46.1",
38
+ "svelte-check": "^4.3.5",
39
39
  "typescript": "^5.9.3",
40
40
  "vite": "^6.4.1"
41
41
  },