@functionalcms/svelte-components 0.0.2 → 0.3.0

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,49 +1,61 @@
1
1
  <script>
2
2
  // @ts-nocheck
3
-
4
3
  import { Header, HeaderNav, HeaderNavItem } from "agnostic-svelte";
5
- import logo from "../assets/logo.png";
6
- import { constants } from "../constants";
4
+
5
+ /**
6
+ * @type {string}
7
+ */
8
+ export let companyName;
9
+ /**
10
+ * @type {string}
11
+ */
12
+ export let logoUrl;
13
+ /**
14
+ * @type {array}
15
+ */
16
+ export let pages;
17
+ // import logo from "../assets/logo.png";
18
+ // import { constants } from "../constants";
7
19
 
8
- const { url } = import.meta;
9
- const modules = import.meta.glob("../../routes/*/*.svelte");
10
- const navItems = constants.Navigation;
20
+ // const { url } = import.meta;
21
+ // const modules = import.meta.glob("../../routes/*/*.svelte");
22
+ // const navItems = constants.Navigation;
11
23
 
12
- function getPages(url, modules) {
13
- const directory = url
14
- .replace(/(.*?)\/src\/lib\/components\//, "/")
15
- .replace(/(.*?)\/src\/routes\//, "/")
16
- .replace(/(.*?)\/immutable\/pages\//, "/")
17
- .replace(/(.*?)\/var\/task\//, "/") // Vercel
18
- .replace(/\/([^/])*.svelte.*/, "/");
19
- const pageRegex = /\/\+page\.svelte$/;
20
- const paths = Object.keys(modules)
21
- .map((path) => path.replace(/^(.\/)/, directory))
22
- .filter((path) => !/\[.*\]/.test(path))
23
- .filter((path) => pageRegex.test(path))
24
- .map((path) => path.replace(pageRegex, ""))
25
- .map((path) => path || "/")
26
- .map((path) => path.replace("../../routes/", ""))
27
- .map((path) => path.replace("../../routes", ""))
28
- .filter((page) => navItems.hasOwnProperty(page))
29
- .sort();
30
- return paths;
31
- };
24
+ // function getPages(url, modules) {
25
+ // const directory = url
26
+ // .replace(/(.*?)\/src\/lib\/components\//, "/")
27
+ // .replace(/(.*?)\/src\/routes\//, "/")
28
+ // .replace(/(.*?)\/immutable\/pages\//, "/")
29
+ // .replace(/(.*?)\/var\/task\//, "/") // Vercel
30
+ // .replace(/\/([^/])*.svelte.*/, "/");
31
+ // const pageRegex = /\/\+page\.svelte$/;
32
+ // const paths = Object.keys(modules)
33
+ // .map((path) => path.replace(/^(.\/)/, directory))
34
+ // .filter((path) => !/\[.*\]/.test(path))
35
+ // .filter((path) => pageRegex.test(path))
36
+ // .map((path) => path.replace(pageRegex, ""))
37
+ // .map((path) => path || "/")
38
+ // .map((path) => path.replace("../../routes/", ""))
39
+ // .map((path) => path.replace("../../routes", ""))
40
+ // .filter((page) => navItems.hasOwnProperty(page))
41
+ // .sort();
42
+ // return paths;
43
+ // };
32
44
 
33
- const pages = getPages(url, modules);
45
+ // const pages = getPages(url, modules);
34
46
  </script>
35
47
 
36
48
  <div class="container">
37
49
  <Header>
38
50
  <div slot="logoleft">
39
51
  <a href="/">
40
- <img src={logo} alt="Functional IT Solutions" />
52
+ <img src={logoUrl} alt={companyName} />
41
53
  </a>
42
54
  </div>
43
55
  <HeaderNav css="nav-overrides">
44
56
  {#each pages as page}
45
57
  <HeaderNavItem
46
- ><a href={page}>{navItems[page]}</a></HeaderNavItem
58
+ ><a href={page.path}>{page.name}</a></HeaderNavItem
47
59
  >
48
60
  {/each}
49
61
  </HeaderNav>
@@ -2,7 +2,9 @@
2
2
  /** @typedef {typeof __propDef.events} HeaderEvents */
3
3
  /** @typedef {typeof __propDef.slots} HeaderSlots */
4
4
  export default class Header extends SvelteComponent<{
5
- [x: string]: never;
5
+ companyName: string;
6
+ logoUrl: string;
7
+ pages: any;
6
8
  }, {
7
9
  [evt: string]: CustomEvent<any>;
8
10
  }, {}> {
@@ -13,7 +15,9 @@ export type HeaderSlots = typeof __propDef.slots;
13
15
  import { SvelteComponent } from "svelte";
14
16
  declare const __propDef: {
15
17
  props: {
16
- [x: string]: never;
18
+ companyName: string;
19
+ logoUrl: string;
20
+ pages: any;
17
21
  };
18
22
  events: {
19
23
  [evt: string]: CustomEvent<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "0.0.2",
3
+ "version": "0.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },