@functionalcms/svelte-components 0.8.6 → 0.8.8

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,20 +1,12 @@
1
- <script>
2
- // @ts-nocheck
3
- import { Header, HeaderNav, HeaderNavItem, MenuItem } from 'agnostic-svelte';
4
- import { HeaderNavigationItem } from './HeaderNavigationItem';
5
-
6
- /**
7
- * @type {string}
8
- */
9
- export let companyName;
10
- /**
11
- * @type {string}
12
- */
13
- export let logoUrl;
14
- /**
15
- * @type {HeaderNavigationItem[]}
16
- */
17
- export let pages;
1
+ <script>import { Header, HeaderNav, HeaderNavItem, MenuItem } from "agnostic-svelte";
2
+ import { Visiblity } from "./HeaderNavigationItem.js";
3
+ export let companyName;
4
+ export let logoUrl;
5
+ export let pages;
6
+ export let authentication;
7
+ let authenticationVisibility = Visiblity.NotAuthenticated;
8
+ authentication.subscribe((value) => value ? Visiblity.Authenticated : Visiblity.NotAuthenticated);
9
+ const selectVisible = (pages2) => pages2.filter((page) => page.visiblity === Visiblity.Always || page.visiblity === authenticationVisibility);
18
10
  </script>
19
11
 
20
12
  <div class="header">
@@ -25,7 +17,7 @@
25
17
  </a>
26
18
  </div>
27
19
  <HeaderNav>
28
- {#each pages.filter(x => x.isVisible) as page}
20
+ {#each selectVisible(pages) as page}
29
21
  <HeaderNavItem>
30
22
  <a on:click={page.action} href={page.path}>
31
23
  {page.name}
@@ -1,28 +1,28 @@
1
- /** @typedef {typeof __propDef.props} HeaderProps */
2
- /** @typedef {typeof __propDef.events} HeaderEvents */
3
- /** @typedef {typeof __propDef.slots} HeaderSlots */
4
- export default class Header extends SvelteComponent<{
5
- companyName: string;
6
- logoUrl: string;
7
- pages: HeaderNavigationItem[];
8
- }, {
9
- [evt: string]: CustomEvent<any>;
10
- }, {}> {
11
- }
12
- export type HeaderProps = typeof __propDef.props;
13
- export type HeaderEvents = typeof __propDef.events;
14
- export type HeaderSlots = typeof __propDef.slots;
15
- import { HeaderNavigationItem } from './HeaderNavigationItem';
16
1
  import { SvelteComponent } from "svelte";
2
+ import type { HeaderNavigationItem } from './HeaderNavigationItem.js';
17
3
  declare const __propDef: {
18
4
  props: {
19
- companyName: string;
20
- logoUrl: string;
21
- pages: HeaderNavigationItem[];
5
+ /**
6
+ * @type {string}
7
+ */ companyName: string;
8
+ /**
9
+ * @type {string}
10
+ */ logoUrl: string;
11
+ /**
12
+ * @type {HeaderNavigationItem[]}
13
+ */ pages: HeaderNavigationItem[];
14
+ /**
15
+ * @type {Readonly<bool>}
16
+ */ authentication: any;
22
17
  };
23
18
  events: {
24
19
  [evt: string]: CustomEvent<any>;
25
20
  };
26
21
  slots: {};
27
22
  };
23
+ export type HeaderProps = typeof __propDef.props;
24
+ export type HeaderEvents = typeof __propDef.events;
25
+ export type HeaderSlots = typeof __propDef.slots;
26
+ export default class Header extends SvelteComponent<HeaderProps, HeaderEvents, HeaderSlots> {
27
+ }
28
28
  export {};
@@ -1,8 +1,13 @@
1
1
  type ClickAction = () => void;
2
+ export declare enum Visiblity {
3
+ Always = 0,
4
+ Authenticated = 1,
5
+ NotAuthenticated = 2
6
+ }
2
7
  export declare class HeaderNavigationItem {
3
8
  name: string;
4
9
  path: string | undefined;
5
10
  action: ClickAction | undefined;
6
- isVisible: boolean;
11
+ visiblity: Visiblity;
7
12
  }
8
13
  export {};
@@ -1,6 +1,12 @@
1
+ export var Visiblity;
2
+ (function (Visiblity) {
3
+ Visiblity[Visiblity["Always"] = 0] = "Always";
4
+ Visiblity[Visiblity["Authenticated"] = 1] = "Authenticated";
5
+ Visiblity[Visiblity["NotAuthenticated"] = 2] = "NotAuthenticated";
6
+ })(Visiblity || (Visiblity = {}));
1
7
  export class HeaderNavigationItem {
2
8
  name;
3
9
  path;
4
10
  action;
5
- isVisible = false;
11
+ visiblity = Visiblity.Always;
6
12
  }
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ import Hero from './components/Hero.svelte';
3
3
  import Header from './components/Header.svelte';
4
4
  import Footer from './components/Footer.svelte';
5
5
  import { authStore } from './authStore.js';
6
- export { Box, Hero, Header, Footer, authStore };
6
+ import { Visiblity, HeaderNavigationItem } from './components/HeaderNavigationItem.js';
7
+ export { Box, Hero, Header, Footer, authStore, Visiblity, HeaderNavigationItem };
package/dist/index.js CHANGED
@@ -4,4 +4,5 @@ import Hero from './components/Hero.svelte';
4
4
  import Header from './components/Header.svelte';
5
5
  import Footer from './components/Footer.svelte';
6
6
  import { authStore } from './authStore.js';
7
- export { Box, Hero, Header, Footer, authStore };
7
+ import { Visiblity, HeaderNavigationItem } from './components/HeaderNavigationItem.js';
8
+ export { Box, Hero, Header, Footer, authStore, Visiblity, HeaderNavigationItem };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "0.8.6",
3
+ "version": "0.8.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },