accomadesc 0.4.13 → 0.4.15

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.
@@ -78,4 +78,26 @@
78
78
  width: 100%;
79
79
  min-height: 60vh;
80
80
  }
81
+
82
+ /* Auto-detect system dark mode */
83
+ @media (prefers-color-scheme: dark) {
84
+ /* Target ONLY the tile pane so markers and popups stay normal */
85
+ :global(.leaflet-tile-pane) {
86
+ filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
87
+ }
88
+
89
+ /* Darken the container so you don't get white flashes while tiles load */
90
+ :global(.leaflet-container) {
91
+ background-color: #222222 !important;
92
+ }
93
+
94
+ /* Optional: Tweak the attribution link colors for dark mode readability */
95
+ :global(.leaflet-control-attribution) {
96
+ background-color: rgba(34, 34, 34, 0.7) !important;
97
+ color: #ccc !important;
98
+ }
99
+ :global(.leaflet-control-attribution a) {
100
+ color: #66b2ff !important;
101
+ }
102
+ }
81
103
  </style>
@@ -49,7 +49,10 @@
49
49
  const formatAdditionalPersonPrice = (price: number, termsRef: string | undefined): string => {
50
50
  if (formatFunc && translateFunc) {
51
51
  let terms = '';
52
- if (termsRef) terms = translateFunc(termsRef);
52
+ if (termsRef) {
53
+ terms = translateFunc(termsRef);
54
+ if (!terms) terms = termsRef;
55
+ }
53
56
  let formattedPrice = formatMoneyFunc?.(price);
54
57
  return formatFunc('additionalPersonPrice', {
55
58
  price: formattedPrice,
@@ -124,13 +127,13 @@
124
127
  const formatExtraPersonCol = (entry: PricingEntry): string => {
125
128
  let result = '<div style="display:flex; column-gap: 2rem; padding-left:1rem;flex-wrap: wrap;">';
126
129
 
127
- if (entry.additionalPersonPrice1) {
130
+ if (entry.additionalPersonPrice1 && entry.additionalPersonText1) {
128
131
  result += `<span>${formatAdditionalPersonPrice(entry.additionalPersonPrice1, entry.additionalPersonText1)}</span>`;
129
132
  }
130
- if (entry.additionalPersonPrice2) {
133
+ if (entry.additionalPersonPrice2 && entry.additionalPersonText2) {
131
134
  result += `<span>${formatAdditionalPersonPrice(entry.additionalPersonPrice2, entry.additionalPersonText2)}</span>`;
132
135
  }
133
- if (entry.additionalPersonPrice3) {
136
+ if (entry.additionalPersonPrice3 && entry.additionalPersonText3) {
134
137
  result += `<span>${formatAdditionalPersonPrice(entry.additionalPersonPrice3, entry.additionalPersonText3)}</span>`;
135
138
  }
136
139
  result += '</div>';
@@ -8,6 +8,7 @@ interface FullTranslation {
8
8
  site: Record<string, string>;
9
9
  }
10
10
  export declare class SiteState implements I18nFacade {
11
+ #private;
11
12
  _getSiteConfigFn: () => SiteConfig;
12
13
  get fullTranslations(): Record<string, FullTranslation>;
13
14
  get calendarTranslations(): Record<string, OccuplanTranslations>;
@@ -22,11 +23,12 @@ export declare class SiteState implements I18nFacade {
22
23
  get formats(): Record<string, FormatSpec>;
23
24
  selectedTheme: 'light' | 'dark';
24
25
  selectedThemeInitialized: boolean;
25
- constructor(getSiteConfig: () => SiteConfig, lang: string | undefined);
26
+ constructor(getSiteConfig: () => SiteConfig, lang: string | undefined, defaultFormats?: Record<string, FormatSpec>);
26
27
  updateCurrentLang: (lang: string) => string;
27
28
  translateFunc: (ref: string) => string;
28
29
  formatFunc: (ref: string, props: Record<string, unknown>) => string;
29
30
  formatDateFunc: (d: DateTime | string) => string;
31
+ formatMoneyFunc: (value: number) => string;
30
32
  translateWithLangFunc: (ref: string, lang: string) => string;
31
33
  }
32
34
  export {};
@@ -1,5 +1,6 @@
1
1
  import { DateTime } from 'luxon';
2
2
  import { format } from './helpers/format.js';
3
+ import { MoneyFormats } from './helpers/moneyFormats.js';
3
4
  export class SiteState {
4
5
  _getSiteConfigFn;
5
6
  //fullTranslations: Record<string, FullTranslation> = $derived(this._getSiteConfigFn().lang.translations);
@@ -46,10 +47,12 @@ export class SiteState {
46
47
  get formats() {
47
48
  return this._getSiteConfigFn().lang.formats;
48
49
  }
50
+ #defaultFormats;
49
51
  selectedTheme = $state('light');
50
52
  selectedThemeInitialized = $state(false);
51
- constructor(getSiteConfig, lang) {
53
+ constructor(getSiteConfig, lang, defaultFormats) {
52
54
  this._getSiteConfigFn = getSiteConfig;
55
+ this.#defaultFormats = defaultFormats;
53
56
  if (!lang || !getSiteConfig().lang.supportedLangs.includes(lang)) {
54
57
  this.currentLang = getSiteConfig().lang.defaultLang;
55
58
  }
@@ -71,11 +74,8 @@ export class SiteState {
71
74
  };
72
75
  formatFunc = (ref, props) => {
73
76
  const langFormats = this.formats[this.currentLang];
74
- if (!langFormats) {
75
- console.warn(`[Missing format language: ${this.currentLang}]`);
76
- return '[UNDEF]';
77
- }
78
- const fString = langFormats[ref];
77
+ const defaultLangFormats = this.#defaultFormats?.[this.currentLang];
78
+ const fString = langFormats?.[ref] ?? defaultLangFormats?.[ref];
79
79
  if (!fString) {
80
80
  console.warn(`[Missing formatFunc: ${ref}]`);
81
81
  return '[UNDEF]';
@@ -87,12 +87,14 @@ export class SiteState {
87
87
  if (!d)
88
88
  return this.translateFunc('invalid');
89
89
  const formatSpecs = this.formats[this.currentLang];
90
- if (!formatSpecs) {
90
+ const defaultFormatSpecs = this.#defaultFormats?.[this.currentLang];
91
+ const effectiveFormat = formatSpecs ?? defaultFormatSpecs;
92
+ if (!effectiveFormat) {
91
93
  return this.translateFunc('invalid');
92
94
  }
93
95
  let f = 'yyyy-MM-dd';
94
- if (formatSpecs.dateFormat) {
95
- f = formatSpecs.dateFormat;
96
+ if (effectiveFormat.dateFormat) {
97
+ f = effectiveFormat.dateFormat;
96
98
  }
97
99
  let date;
98
100
  if (typeof d === 'string')
@@ -101,7 +103,15 @@ export class SiteState {
101
103
  date = d;
102
104
  if (!date.isValid)
103
105
  return this.translateFunc('invalid');
104
- return date.setLocale(formatSpecs.locale).toFormat(f);
106
+ return date.setLocale(effectiveFormat.locale).toFormat(f);
107
+ };
108
+ formatMoneyFunc = (value) => {
109
+ const scaled = value / 100.0;
110
+ const fmt = MoneyFormats[this.currentLang] ?? MoneyFormats['en'];
111
+ if (!fmt) {
112
+ return String(scaled);
113
+ }
114
+ return fmt.format(scaled);
105
115
  };
106
116
  translateWithLangFunc = (ref, lang) => {
107
117
  const translation = this.translations[lang];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -27,7 +27,7 @@
27
27
  "@playwright/test": "^1.59.1",
28
28
  "@sveltejs/adapter-auto": "^3.3.1",
29
29
  "@sveltejs/adapter-static": "^3.0.10",
30
- "@sveltejs/kit": "^2.57.1",
30
+ "@sveltejs/kit": "^2.58.0",
31
31
  "@sveltejs/package": "^2.5.7",
32
32
  "@sveltejs/vite-plugin-svelte": "^5.1.1",
33
33
  "@testing-library/dom": "^10.4.1",
@@ -35,17 +35,17 @@
35
35
  "@testing-library/svelte": "^5.3.1",
36
36
  "@types/luxon": "^3.7.1",
37
37
  "@types/node": "^25.6.0",
38
- "@vitest/ui": "^4.1.4",
38
+ "@vitest/ui": "^4.1.5",
39
39
  "gdpr-cooco-banner": "^0.0.13",
40
40
  "jsdom": "^27.4.0",
41
- "prettier": "^3.8.2",
41
+ "prettier": "^3.8.3",
42
42
  "prettier-plugin-svelte": "^3.5.1",
43
43
  "publint": "^0.3.18",
44
- "svelte": "^5.55.2",
44
+ "svelte": "^5.55.5",
45
45
  "svelte-check": "^4.4.6",
46
46
  "typescript": "^5.9.3",
47
47
  "vite": "^6.4.2",
48
- "vitest": "^4.1.4"
48
+ "vitest": "^4.1.5"
49
49
  },
50
50
  "dependencies": {
51
51
  "@fontsource/raleway": "^5.2.8",