accomadesc 0.3.27 → 0.3.29

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.
@@ -3,6 +3,8 @@
3
3
  import { fade } from 'svelte/transition';
4
4
  import type { Nav, I18nFacade } from './types.js';
5
5
  import NavItem from './NavItem.svelte';
6
+ import { getContext } from 'svelte';
7
+ import { GLOBAL_STATE, GlobalState } from './state.svelte';
6
8
 
7
9
  let currentPath = $derived(page.url.pathname);
8
10
  let {
@@ -30,6 +32,8 @@
30
32
  return ['', lang, ...pathElements.slice(1)].join('/');
31
33
  }
32
34
  };
35
+
36
+ const gs: GlobalState = getContext(GLOBAL_STATE);
33
37
  </script>
34
38
 
35
39
  <button class="not-nav" onclick={close} aria-label="close" transition:fade|global></button>
@@ -50,7 +54,7 @@
50
54
  <a
51
55
  data-sveltekit-keepfocus
52
56
  data-sveltekit-noscroll
53
- class="lang-link"
57
+ class={{ 'lang-link': true, disabled: gs.disableLinks }}
54
58
  rel="alternate"
55
59
  onclick={() => (updateCurrentLang ? updateCurrentLang(langKey) : '')}
56
60
  href={pathForLang(langKey)}
@@ -136,4 +140,8 @@
136
140
  padding-left: 2.5rem;
137
141
  margin: 0;
138
142
  }
143
+
144
+ .disabled {
145
+ pointer-events: none;
146
+ }
139
147
  </style>
@@ -1,6 +1,8 @@
1
1
  <script lang="ts">
2
2
  import type { NavItem, I18nFacade } from './types.js';
3
3
  import ExtLinkSvg from './svg/ExtLinkSVG.svelte';
4
+ import { getContext } from 'svelte';
5
+ import { GLOBAL_STATE, GlobalState } from './state.svelte';
4
6
 
5
7
  let {
6
8
  n,
@@ -13,6 +15,8 @@
13
15
  } & I18nFacade = $props();
14
16
 
15
17
  const path = $derived(`/${currentLang}${n.path}`);
18
+
19
+ const gs: GlobalState = getContext(GLOBAL_STATE);
16
20
  </script>
17
21
 
18
22
  <div class="wrapper" class:sub={n.sub}>
@@ -22,12 +26,23 @@
22
26
  <div class="link-icon-wrapper">
23
27
  <ExtLinkSvg size="1.6rem" />
24
28
  </div>
25
- <a href={n.path} target="_blank" rel="noreferrer noopener nofollow">
29
+ <a
30
+ href={n.path}
31
+ target="_blank"
32
+ rel="noreferrer noopener nofollow"
33
+ class:disabled={gs.disableLinks}
34
+ >
26
35
  {translateFunc ? translateFunc(n.key) : ''}
27
36
  </a>
28
37
  </div>
29
38
  {:else}
30
- <a href={path} {onclick} data-sveltekit-keepfocus data-sveltekit-noscroll>
39
+ <a
40
+ href={path}
41
+ {onclick}
42
+ data-sveltekit-keepfocus
43
+ data-sveltekit-noscroll
44
+ class:disabled={gs.disableLinks}
45
+ >
31
46
  {translateFunc ? translateFunc(n.key) : ''}
32
47
  </a>
33
48
  {/if}
@@ -69,4 +84,8 @@
69
84
  position: relative;
70
85
  width: 100%;
71
86
  }
87
+
88
+ .disabled {
89
+ pointer-events: none;
90
+ }
72
91
  </style>
@@ -16,6 +16,8 @@
16
16
  import { page } from '$app/state';
17
17
  import Button from './basic/Button.svelte';
18
18
  import { fallbackCSS } from './style.js';
19
+ import { GLOBAL_STATE, GlobalState } from './state.svelte';
20
+ import { setContext } from 'svelte';
19
21
 
20
22
  let {
21
23
  hero,
@@ -31,6 +33,7 @@
31
33
  footerRef = 'footer_html',
32
34
  fixedHamburger = true,
33
35
  navbarOverHamburger = true,
36
+ disableLinks = false,
34
37
  translateFunc,
35
38
  formatMoneyFunc,
36
39
  formatDateFunc,
@@ -41,6 +44,8 @@
41
44
  calendarTranslation,
42
45
  }: PageProps & I18nFacade = $props();
43
46
 
47
+ setContext(GLOBAL_STATE, new GlobalState(disableLinks));
48
+
44
49
  let pageTitle = hero && hero.title ? hero.title : header ? header : title;
45
50
 
46
51
  let langSelectorOpen = $state(false);
@@ -100,6 +105,7 @@
100
105
  data-sveltekit-noscroll
101
106
  onclick={() => (updateCurrentLang ? updateCurrentLang(l) : '')}
102
107
  href={pathForLang(l)}
108
+ class:disabled={disableLinks}
103
109
  >
104
110
  <Icon iconName={l} height="1.5rem" width="1.5rem" />
105
111
  </a>
@@ -192,7 +198,10 @@
192
198
 
193
199
  {#each allTranslations as langKey}
194
200
  <a
195
- class="lang-link"
201
+ class={{
202
+ 'lang-link': true,
203
+ disabled: disableLinks,
204
+ }}
196
205
  rel="alternate"
197
206
  onclick={() => (updateCurrentLang ? updateCurrentLang(langKey) : '')}
198
207
  href={pathForLang(langKey)}
@@ -406,7 +415,7 @@
406
415
  }
407
416
 
408
417
  ul {
409
- margin-left: 1rem;
418
+ margin-left: 2rem;
410
419
  padding-left: 0.2rem;
411
420
  }
412
421
 
@@ -415,4 +424,8 @@
415
424
  color: var(--main-font-color);
416
425
  }
417
426
  }
427
+
428
+ .disabled {
429
+ pointer-events: none;
430
+ }
418
431
  </style>
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ import Section from './Section.svelte';
25
25
  import Text from './Text.svelte';
26
26
  import Weather from './Weather.svelte';
27
27
  import PageComponent from './PageComponent.svelte';
28
- export type { OccuplanTranslations } from './occuplan/state.svelte.ts';
28
+ export type { OccuplanTranslations } from './occuplan/state.svelte';
29
29
  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
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';
31
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, };
@@ -0,0 +1,5 @@
1
+ export declare const GLOBAL_STATE = "GLOBAL_STATE";
2
+ export declare class GlobalState {
3
+ disableLinks: boolean;
4
+ constructor(disableLinks: boolean);
5
+ }
@@ -0,0 +1,7 @@
1
+ export const GLOBAL_STATE = 'GLOBAL_STATE';
2
+ export class GlobalState {
3
+ disableLinks = $state(false);
4
+ constructor(disableLinks) {
5
+ this.disableLinks = disableLinks;
6
+ }
7
+ }
package/dist/types.d.ts CHANGED
@@ -363,6 +363,7 @@ export interface PageProps {
363
363
  footerRef?: string;
364
364
  fixedHamburger?: boolean;
365
365
  navbarOverHamburger?: boolean;
366
+ disableLinks?: boolean;
366
367
  selectedTheme?: 'light' | 'dark';
367
368
  content?: Section[];
368
369
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",