@functionalcms/svelte-components 2.28.1 → 2.30.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,3 +1,3 @@
1
1
  import { type Handle } from '@sveltejs/kit';
2
- declare const authorizationHandle: (protectedPaths: Array<string>) => Handle;
2
+ declare const authorizationHandle: () => Handle;
3
3
  export default authorizationHandle;
@@ -1,14 +1,13 @@
1
1
  import { redirect } from '@sveltejs/kit';
2
- const authorizationHandle = (protectedPaths) => {
2
+ const authorizationHandle = () => {
3
3
  return async ({ event, resolve }) => {
4
4
  const path = event.url.pathname;
5
5
  if (path.startsWith('/auth/') === false) {
6
- for (let protectedPath of protectedPaths) {
7
- if (path.match(protectedPath)) {
8
- const session = event?.locals?.session;
9
- if (!session) {
10
- return new Response('Login user', { status: 303, headers: { location: '/auth/login' } });
11
- }
6
+ const route = event.route;
7
+ if (route.id.includes('/(protect)/')) {
8
+ const session = event?.locals?.session;
9
+ if (!session) {
10
+ return new Response('Login user', { status: 303, headers: { location: '/auth/login' } });
12
11
  }
13
12
  }
14
13
  }
@@ -310,7 +310,6 @@ export let orientation = Orientation.Row;
310
310
  $: isSmall = size === ComponentSize.Small;
311
311
  $: isLarge = size === ComponentSize.Large;
312
312
  $: klasses = [
313
- "btn",
314
313
  isPrimary ? "btn-primary" : "",
315
314
  isDisabled ? "disabled" : "",
316
315
  isBordered ? "btn-bordered" : "",
@@ -328,7 +327,7 @@ $: klasses = [
328
327
  `${orientation}`,
329
328
  `${justify}`,
330
329
  `${alignItems}`,
331
- css ? css : ""
330
+ css ? css : "btn"
332
331
  ].filter((c) => c).join(" ");
333
332
  </script>
334
333
  <svelte:options customElement="active-link" />
@@ -9,20 +9,22 @@ export let orientation = Orientation.Column;
9
9
  export let localPages = [];
10
10
  $: showContent = false;
11
11
  $: showContentBeforeButton = contentPosition == Placement.Start;
12
- const contentKlasses = [contentCss].filter((c) => c).join(" ");
13
12
  </script>
14
13
 
15
14
  {#if showContent && showContentBeforeButton}
16
- <ColumnMenu {localPages} {orientation} css={contentKlasses} />
15
+ <ColumnMenu {localPages} {orientation} css={contentCss} />
17
16
  {/if}
18
-
19
- <Button css={buttonCss} on:click={() => (showContent = !showContent)}>
20
- <slot name="handle">&#9776;</slot>
21
- </Button>
22
-
17
+ <div>
18
+ <Button css={buttonCss} on:click={() => (showContent = !showContent)}>
19
+ <slot name="handle">&#9776;</slot>
20
+ </Button>
21
+ </div>
23
22
  {#if showContent && !showContentBeforeButton}
24
- <ColumnMenu {localPages} {orientation} css={contentKlasses} />
23
+ <ColumnMenu {localPages} {orientation} css={contentCss} />
25
24
  {/if}
26
25
 
27
26
  <style>
27
+ div {
28
+ margin: var(--fluid-8);
29
+ }
28
30
  </style>
@@ -1,6 +1,6 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import { Orientation, Placement } from "../Styling.js";
3
- import { HeaderNavigationItem } from "./Menu.js";
2
+ import { Orientation, Placement } from '../Styling.js';
3
+ import { HeaderNavigationItem } from './Menu.js';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  buttonCss?: string;
@@ -2,7 +2,9 @@
2
2
  import { page } from "$app/stores";
3
3
  import { isSelected } from "./MenuFunctions.js";
4
4
  import { Orientation } from "../Styling.js";
5
+ import Link from "../Link.svelte";
5
6
  export let css = "";
7
+ export let linkCss = "";
6
8
  export let localPages = [];
7
9
  export let orientation = Orientation.Column;
8
10
  export let includeSubpagesForSelect = false;
@@ -13,9 +15,9 @@ const klasses = ["flex", orientation, css ? css : ""].filter((c) => c).join(" ")
13
15
  {#each localPages as pageItem}
14
16
  <li aria-current={isSelected(includeSubpagesForSelect, $page, pageItem)}>
15
17
  <span class="screenreader-only">Navigate to {pageItem.name}</span>
16
- <a on:click={pageItem.action} href={pageItem.path}>
18
+ <Link href={pageItem.path} css={linkCss}>
17
19
  {pageItem.name}
18
- </a>
20
+ </Link>
19
21
  </li>
20
22
  {/each}
21
23
  </ul>
@@ -4,6 +4,7 @@ import { Orientation } from '../Styling.js';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  css?: string;
7
+ linkCss?: string;
7
8
  localPages?: Array<HeaderNavigationItem>;
8
9
  orientation?: Orientation;
9
10
  includeSubpagesForSelect?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "2.28.1",
3
+ "version": "2.30.0",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [