@valerius_petrini/corekit-ui 0.1.29 → 0.1.31

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.
@@ -14,7 +14,7 @@
14
14
  let pillClass = "rounded-full";
15
15
  let iconClass = "rounded-full p-2 flex-center";
16
16
  let defaultClass = $derived(twMerge(
17
- "text-white cursor-pointer px-2 py-1 transition-colors ",
17
+ "text-white cursor-pointer px-2 py-1 transition-colors duration-300",
18
18
  (pill ? pillClass : ""), (icon ? iconClass : "")));
19
19
 
20
20
  let combinedClass = $derived(twMerge(defaultClass, className));
@@ -1,15 +1,33 @@
1
1
  <script lang="ts">
2
+ import type { NavbarProps } from "../types/Navbar.js";
3
+ import { onMount } from "svelte";
2
4
  import { twMerge } from "tailwind-merge";
3
5
 
4
6
  let {
5
7
  children = undefined,
6
8
  class: className = "",
9
+ classTop = "",
7
10
  ...restProps
8
- } = $props();
11
+ }: NavbarProps = $props();
9
12
 
10
- let defaultClass = "bg-transparent transition-colors duration-300 backdrop-blur-[3px] fixed top-0 left-0 w-full z-50 flex items-center";
13
+ let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-50 flex items-center";
11
14
 
12
15
  let combinedClass = $derived(twMerge(defaultClass, className));
16
+
17
+ function onScroll() {
18
+ combinedClass = window.scrollY === 0
19
+ ? twMerge(defaultClass, className, classTop)
20
+ : twMerge(defaultClass, className);
21
+ }
22
+
23
+ onMount(() => {
24
+ window.addEventListener('scroll', onScroll);
25
+ onScroll();
26
+
27
+ return () => {
28
+ window.removeEventListener('scroll', onScroll);
29
+ };
30
+ });
13
31
  </script>
14
32
 
15
33
  <nav class={combinedClass} {...restProps}>
@@ -1,6 +1,4 @@
1
- declare const Navbar: import("svelte").Component<{
2
- children?: any;
3
- class?: string;
4
- } & Record<string, any>, {}, "">;
1
+ import type { NavbarProps } from "../types/Navbar.js";
2
+ declare const Navbar: import("svelte").Component<NavbarProps, {}, "">;
5
3
  type Navbar = ReturnType<typeof Navbar>;
6
4
  export default Navbar;
@@ -0,0 +1,37 @@
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+ import Button from "./Button.svelte";
4
+ import { onMount } from "svelte";
5
+ import type { NavbarElementProps } from "../types/Navbar.js";
6
+
7
+ let {
8
+ children = undefined,
9
+ class: className = "",
10
+ classTop = "",
11
+ href = undefined,
12
+ ...restProps
13
+ }: NavbarElementProps = $props();
14
+
15
+ let defaultClass = "navbar-element w-fit h-full flex items-center px-5 py-0";
16
+
17
+ let combinedClass = $derived(twMerge(defaultClass, className));
18
+
19
+ function onScroll() {
20
+ combinedClass = window.scrollY === 0
21
+ ? twMerge(defaultClass, className, classTop)
22
+ : twMerge(defaultClass, className);
23
+ }
24
+
25
+ onMount(() => {
26
+ window.addEventListener('scroll', onScroll);
27
+ onScroll();
28
+
29
+ return () => {
30
+ window.removeEventListener('scroll', onScroll);
31
+ };
32
+ });
33
+ </script>
34
+
35
+ <Button {href} class={combinedClass} {...restProps}>
36
+ {@render children?.()}
37
+ </Button>
@@ -0,0 +1,4 @@
1
+ import type { NavbarElementProps } from "../types/Navbar.js";
2
+ declare const NavbarElement: import("svelte").Component<NavbarElementProps, {}, "">;
3
+ type NavbarElement = ReturnType<typeof NavbarElement>;
4
+ export default NavbarElement;
@@ -1,12 +1,12 @@
1
- export default NavbarSeperator;
2
- type NavbarSeperator = SvelteComponent<{
1
+ export default NavbarSeparator;
2
+ type NavbarSeparator = SvelteComponent<{
3
3
  [x: string]: never;
4
4
  }, {
5
5
  [evt: string]: CustomEvent<any>;
6
6
  }, {}> & {
7
7
  $$bindings?: string | undefined;
8
8
  };
9
- declare const NavbarSeperator: $$__sveltets_2_IsomorphicComponent<{
9
+ declare const NavbarSeparator: $$__sveltets_2_IsomorphicComponent<{
10
10
  [x: string]: never;
11
11
  }, {
12
12
  [evt: string]: CustomEvent<any>;
package/dist/index.d.ts CHANGED
@@ -2,5 +2,8 @@ export { default as Button } from "./components/Button.svelte";
2
2
  export { default as Typewriter } from "./components/Typewriter.svelte";
3
3
  export { default as Analytics } from "./components/Analytics.svelte";
4
4
  export { default as SEO } from "./components/SEO.svelte";
5
+ export { default as Navbar } from "./components/Navbar.svelte";
6
+ export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
7
+ export { default as NavbarElement } from "./components/NavbarElement.svelte";
5
8
  export { fbmBackground } from "./actions/fbm.ts";
6
9
  export type { TypewriterAction, DisplaySegment } from "./types/Typewriter.d.ts";
package/dist/index.js CHANGED
@@ -2,4 +2,7 @@ export { default as Button } from "./components/Button.svelte";
2
2
  export { default as Typewriter } from "./components/Typewriter.svelte";
3
3
  export { default as Analytics } from "./components/Analytics.svelte";
4
4
  export { default as SEO } from "./components/SEO.svelte";
5
+ export { default as Navbar } from "./components/Navbar.svelte";
6
+ export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
7
+ export { default as NavbarElement } from "./components/NavbarElement.svelte";
5
8
  export { fbmBackground } from "./actions/fbm.js";
@@ -0,0 +1,14 @@
1
+ export interface NavbarProps {
2
+ children?: any;
3
+ class?: string;
4
+ classTop?: string;
5
+ [key: string]: any;
6
+ };
7
+
8
+ export interface NavbarElementProps {
9
+ children?: any;
10
+ class?: string;
11
+ classTop?: string;
12
+ href?: string;
13
+ [key: string]: any;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "description": "Component Library used across all my projects",
5
5
  "author": "Valerius Petrini Jr.",
6
6
  "license": "MIT",