@functionalcms/svelte-components 5.0.0-beta3 → 5.0.1

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.
@@ -12,6 +12,7 @@
12
12
  } from 'flowbite-svelte';
13
13
  import { type MenuOption } from './menuItems.js';
14
14
  import { ChevronDownOutline } from 'flowbite-svelte-icons';
15
+ import { afterNavigate } from "$app/navigation";
15
16
 
16
17
  interface Styles {
17
18
  logo?: string;
@@ -62,6 +63,10 @@
62
63
  $effect(() => {
63
64
  activeUrl = page.url.pathname;
64
65
  });
66
+
67
+ afterNavigate(() => {
68
+ window.scrollTo({ top: 0, behavior: "instant" });
69
+ });
65
70
  </script>
66
71
 
67
72
  <svelte:head>
@@ -102,7 +107,7 @@
102
107
  {/each}
103
108
  </NavUl>
104
109
  </Navbar>
105
- <main>
110
+ <main class="min-h-screen">
106
111
  {@render children?.()}
107
112
  </main>
108
113
  {@render footerRender?.()}
@@ -2,28 +2,31 @@
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { MenuItem, MenuSection } from './menuItems.js';
4
4
  import Icon from '../Icon.svelte';
5
- import {
5
+ import { afterNavigate } from '$app/navigation';
6
+ import {
6
7
  Sidebar,
7
- SidebarDropdownItem,
8
- SidebarDropdownWrapper,
9
- SidebarGroup,
10
- SidebarItem,
8
+ SidebarDropdownItem,
9
+ SidebarDropdownWrapper,
10
+ SidebarGroup,
11
+ SidebarItem,
11
12
  SidebarButton,
12
- uiHelpers } from "flowbite-svelte";
13
+ uiHelpers
14
+ } from 'flowbite-svelte';
13
15
 
14
16
  interface TwoColumnLayoutProps {
15
17
  children: Snippet;
16
18
  menuItems: Array<MenuSection | MenuItem>;
17
19
  }
18
20
 
19
- let {
20
- children,
21
- menuItems = []
22
- }: Partial<TwoColumnLayoutProps> = $props();
21
+ let { children, menuItems = [] }: Partial<TwoColumnLayoutProps> = $props();
23
22
 
24
23
  let container: HTMLElement | undefined = undefined;
25
24
  const helpers = uiHelpers();
25
+ afterNavigate(() => {
26
+ window.scrollTo({ top: 0, behavior: 'instant' });
27
+ });
26
28
  </script>
29
+
27
30
  <section class="flex flex-column md:flex-row" bind:this={container}>
28
31
  <SidebarButton onclick={helpers.toggle} class="mb-2" />
29
32
  <Sidebar
@@ -31,7 +34,8 @@
31
34
  isOpen={helpers.isOpen}
32
35
  closeSidebar={helpers.close}
33
36
  position="fixed"
34
- class="z-50 h-full">
37
+ class="z-50 h-full"
38
+ >
35
39
  <SidebarGroup>
36
40
  {#each menuItems as item}
37
41
  {#if 'items' in item}
@@ -43,8 +47,7 @@
43
47
  {:else}
44
48
  <SidebarItem label={item.label} href={item.href}>
45
49
  {#snippet icon()}
46
- <Icon
47
- icon={item.icon} />
50
+ <Icon icon={item.icon} />
48
51
  {/snippet}
49
52
  </SidebarItem>
50
53
  {/if}
@@ -3,18 +3,15 @@
3
3
 
4
4
  interface Props {
5
5
  children: Snippet;
6
- width: number;
7
6
  class: string;
8
7
  }
9
8
 
10
9
  let {
11
10
  children,
12
- width = 95,
13
11
  class: css = '',
14
12
  }: Partial<Props> = $props();
15
-
16
13
  </script>
17
14
 
18
- <div class="well w-[{width}%] m-auto p-1 {css}">
15
+ <div class="well m-auto p-1 {css}">
19
16
  {@render children?.()}
20
17
  </div>
@@ -1,7 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  declare const Well: import("svelte").Component<Partial<{
3
3
  children: Snippet;
4
- width: number;
5
4
  class: string;
6
5
  }>, {}, "">;
7
6
  type Well = ReturnType<typeof Well>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "5.0.0-beta3",
3
+ "version": "5.0.1",
4
4
  "license": "MIT",
5
5
  "watch": {
6
6
  "build": {