@functionalcms/svelte-components 2.13.4 → 2.13.7

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,26 +1,26 @@
1
- <style>
2
- a {
3
- display: var(--functional-logo-display, 'inline-block');
4
- margin: var(--functional-mobile-logo-margin);
5
- padding: var(--functional-mobile-logo-padding);
6
- }
7
- a img {
8
- width: 100%;
9
- }
10
-
11
- @media (min-width: 960px) {
12
- a img {
13
- margin: var(--functional-logo-margin);
14
- padding: var(--functional-logo-padding);
15
- }
16
- }
17
- </style>
18
-
1
+ <style>
2
+ a {
3
+ display: var(--functional-logo-display, 'inline-block');
4
+ margin: var(--functional-mobile-logo-margin);
5
+ padding: var(--functional-mobile-logo-padding);
6
+ }
7
+ a img {
8
+ width: 100%;
9
+ }
10
+
11
+ @media (min-width: 960px) {
12
+ a img {
13
+ margin: var(--functional-logo-margin);
14
+ padding: var(--functional-logo-padding);
15
+ }
16
+ }
17
+ </style>
18
+
19
19
  <script>export let companyName;
20
20
  export let logoUrl;
21
21
  export let css = "logo";
22
- </script>
23
-
24
- <a href="/" class={css}>
25
- <img src={logoUrl} alt={companyName} />
22
+ </script>
23
+
24
+ <a href="/" class={css}>
25
+ <img src={logoUrl} alt={companyName} />
26
26
  </a>
@@ -13,6 +13,7 @@ import { metaDescription, metaKeywords } from "../../stores/meta";
13
13
  export let robots = "index, follow";
14
14
  export let headerIsSticky = false;
15
15
  export let tracker = "";
16
+ export let canonicalUrl = "";
16
17
  $:
17
18
  headerCss = headerIsSticky ? "sticky" : "";
18
19
  </script>
@@ -20,7 +21,7 @@ $:
20
21
  <svelte:head>
21
22
  <script data-goatcounter="https://{tracker}.goatcounter.com/count"
22
23
  async src="//gc.zgo.at/count.js"></script>
23
- <link rel="canonical" href="{$page.url.pathname}">
24
+ <link rel="canonical" href="{canonicalUrl}{$page.url.pathname}">
24
25
 
25
26
  <title>{$title}{$suffix}</title>
26
27
  <meta name="og:title" property="og:title" content="{$title}{$suffix}" />
@@ -4,6 +4,7 @@ declare const __propDef: {
4
4
  robots?: string | undefined;
5
5
  headerIsSticky?: boolean | undefined;
6
6
  tracker?: string | undefined;
7
+ canonicalUrl?: string | undefined;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
@@ -1,16 +1,15 @@
1
- <script>import { Visiblity, HeaderNavigationItem } from "./Menu.js";
1
+ <script>import { HeaderNavigationItem } from "./Menu.js";
2
2
  import { pages as pagesStore } from "../../stores/pages.js";
3
3
  import { selectVisible } from "./MenuFunctions.js";
4
- export let authentication = false;
4
+ import { isAuthenticated } from "./authentication.js";
5
+ import { page } from "$app/stores";
5
6
  export let css = "";
6
7
  export let navCss = "";
7
8
  export let localPages = [];
8
9
  $:
9
10
  activePages = !localPages || localPages.length == 0 ? $pagesStore : localPages;
10
11
  $:
11
- visibility = authentication ? Visiblity.Authenticated : Visiblity.NotAuthenticated;
12
- $:
13
- visibleNavItems = selectVisible(activePages, visibility);
12
+ visibleNavItems = selectVisible(activePages, isAuthenticated(page));
14
13
  const klasses = ["flex", "flex-dynamic-row", css ? css : ""].filter((c) => c).join(" ");
15
14
  </script>
16
15
 
@@ -19,7 +18,7 @@ const klasses = ["flex", "flex-dynamic-row", css ? css : ""].filter((c) => c).jo
19
18
  <slot name="mobile" pages={visibleNavItems} />
20
19
  </div>
21
20
  <div class="desktop">
22
- <slot name="desktop" pages={visibleNavItems}/>
21
+ <slot name="desktop" pages={visibleNavItems} />
23
22
  </div>
24
23
  </nav>
25
24
 
@@ -2,7 +2,6 @@ import { SvelteComponent } from "svelte";
2
2
  import { HeaderNavigationItem } from './Menu.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
- authentication?: boolean | undefined;
6
5
  css?: string | undefined;
7
6
  navCss?: string | undefined;
8
7
  localPages?: HeaderNavigationItem[] | undefined;
@@ -0,0 +1 @@
1
+ export declare function isAuthenticated(page: any): any;
@@ -0,0 +1,6 @@
1
+ import { Visiblity } from '@functionalcms/svelte-components';
2
+ export function isAuthenticated(page) {
3
+ const isAuthenticated = page?.data?.session == null;
4
+ const visibility = isAuthenticated ? Visiblity.Authenticated : Visiblity.NotAuthenticated;
5
+ return visibility;
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "2.13.4",
3
+ "version": "2.13.7",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [
@@ -60,5 +60,6 @@
60
60
  },
61
61
  "svelte": "./dist/index.js",
62
62
  "types": "./dist/index.d.ts",
63
- "type": "module"
63
+ "type": "module",
64
+ "sideEffects": false
64
65
  }