@valerius_petrini/corekit-ui 0.1.36 → 0.1.41

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.
@@ -117,7 +117,7 @@ function initBuffers(gl) {
117
117
  };
118
118
  }
119
119
  export function fbmBackground(canvas, options = {}) {
120
- let gl = canvas.getContext("webgl", { antialias: true });
120
+ let gl = canvas.getContext("webgl", { antialias: true, premultipliedAlpha: false, preserveDrawingBuffer: true });
121
121
  if (!gl) {
122
122
  console.error("WebGL not supported");
123
123
  return;
@@ -145,8 +145,14 @@ export function fbmBackground(canvas, options = {}) {
145
145
  const buffers = initBuffers(gl);
146
146
  function updateCanvasSize() {
147
147
  const DPR = window.devicePixelRatio || 1;
148
- canvas.width = Math.floor(canvas.clientWidth * DPR);
149
- canvas.height = Math.floor(canvas.clientHeight * DPR);
148
+ const newWidth = Math.floor(canvas.offsetWidth * DPR);
149
+ const newHeight = Math.floor(canvas.offsetHeight * DPR);
150
+ if (canvas.width !== newWidth || canvas.height !== newHeight) {
151
+ canvas.width = newWidth;
152
+ canvas.height = newHeight;
153
+ if (gl)
154
+ gl.viewport(0, 0, canvas.width, canvas.height);
155
+ }
150
156
  }
151
157
  function render() {
152
158
  updateCanvasSize();
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ let {
5
+ children = undefined,
6
+ class: className = "",
7
+ ...restProps
8
+ } = $props();
9
+
10
+ let defaultClass = "text-main-text shadow-xl rounded-lg transition-colors bg-sub-background hover:bg-sub-background-hover p-4";
11
+ let combinedClass = $derived(twMerge(defaultClass, className));
12
+ </script>
13
+
14
+ <div class={combinedClass}>
15
+ {@render children?.()}
16
+ </div>
@@ -0,0 +1,6 @@
1
+ declare const Card: import("svelte").Component<{
2
+ children?: any;
3
+ class?: string;
4
+ } & Record<string, any>, {}, "">;
5
+ type Card = ReturnType<typeof Card>;
6
+ export default Card;
@@ -21,14 +21,14 @@
21
21
  let hasContent = $derived(value !== undefined && value !== null && value.toString().length > 0);
22
22
  let isValid = $derived(!touched || !validInputRegex || validInputRegex.test(value || ""));
23
23
 
24
- let defaultClass = "z-20 bg-form-input-background text-main-text w-full border rounded px-2 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
24
+ let defaultClass = "z-20 bg-form-input-background text-main-text w-full rounded px-2 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
25
25
  let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
26
26
  let defaultDivClass = "relative";
27
27
 
28
28
  let originalLabelClass = "left-2 top-1/2 transform -translate-y-1/2 z-0";
29
29
  let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]";
30
30
 
31
- let invalidClass = "border-red-500 focus:ring-red-500";
31
+ let invalidClass = "border border-red-500 focus:ring-red-500";
32
32
 
33
33
  let combinedLabelClass = $derived(twMerge(defaultLabelClass, isFocused || hasContent ? selectedLabelClass : originalLabelClass, labelClass));
34
34
  let combinedClass = $derived(twMerge(defaultClass, className, isValid ? "" : invalidClass));
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ let {
5
+ children = undefined,
6
+ class: className = "",
7
+ options = [],
8
+ id = crypto.randomUUID(),
9
+ ...restProps
10
+ } = $props();
11
+
12
+ let defaultSelectClass = "cursor-pointer bg-form-input-background text-main-text z-20 w-full rounded px-1 pt-4 pb-1 text-xs outline-none focus:ring-2 focus:ring-blue-500 transition-all";
13
+ let defaultLabelClass = "block text-sub-text rounded-md text-sm font-medium mb-1 absolute transition-all duration-100 pointer-events-none";
14
+ let defaultDivClass = "relative w-fit";
15
+
16
+ let originalLabelClass = "left-2 top-1/2 transform -translate-y-1/2 z-0";
17
+ let selectedLabelClass = "left-2 z-30 top-0.5 text-[10px]";
18
+
19
+ let combinedLabelClass = $derived(twMerge(defaultLabelClass, selectedLabelClass, className));
20
+ let combinedSelectClass = $derived(twMerge(defaultSelectClass, className));
21
+ </script>
22
+
23
+ <div class={defaultDivClass}>
24
+ <label for={id} class={combinedLabelClass}>
25
+ {@render children?.()}
26
+ </label>
27
+ <select {id} class={combinedSelectClass} {...restProps}>
28
+ {#each options as option}
29
+ <option value={option.value}>{option.label}</option>
30
+ {/each}
31
+ </select>
32
+ </div>
@@ -0,0 +1,8 @@
1
+ declare const FloatingSelect: import("svelte").Component<{
2
+ children?: any;
3
+ class?: string;
4
+ options?: any[];
5
+ id?: any;
6
+ } & Record<string, any>, {}, "">;
7
+ type FloatingSelect = ReturnType<typeof FloatingSelect>;
8
+ export default FloatingSelect;
@@ -10,7 +10,7 @@
10
10
  ...restProps
11
11
  }: NavbarProps = $props();
12
12
 
13
- let defaultClass = "transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-main-background border-b-sub-background border-b";
13
+ let defaultClass = "box-border transition-colors duration-300 fixed top-0 left-0 w-full h-14 z-[100] flex items-center bg-main-background/99 border-b-sub-background border-b";
14
14
 
15
15
  let scrollY = $state(0);
16
16
 
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ let {
5
+ children = undefined,
6
+ class: className = "",
7
+ ...restProps
8
+ } = $props();
9
+
10
+ let defaultClass = "text-main-text";
11
+ let combinedClass = $derived(twMerge(defaultClass, className));
12
+ </script>
13
+
14
+ <p class={combinedClass}>
15
+ {@render children?.()}
16
+ </p>
@@ -0,0 +1,6 @@
1
+ declare const Text: import("svelte").Component<{
2
+ children?: any;
3
+ class?: string;
4
+ } & Record<string, any>, {}, "">;
5
+ type Text = ReturnType<typeof Text>;
6
+ export default Text;
package/dist/index.d.ts CHANGED
@@ -6,5 +6,8 @@ export { default as Navbar } from "./components/Navbar.svelte";
6
6
  export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
7
7
  export { default as NavbarElement } from "./components/NavbarElement.svelte";
8
8
  export { default as FloatingInput } from "./components/FloatingInput.svelte";
9
+ export { default as FloatingSelect } from "./components/FloatingSelect.svelte";
10
+ export { default as Text } from "./components/Text.svelte";
11
+ export { default as Card } from "./components/Card.svelte";
9
12
  export { fbmBackground } from "./actions/fbm.ts";
10
13
  export type { TypewriterAction, DisplaySegment } from "./types/Typewriter.d.ts";
package/dist/index.js CHANGED
@@ -6,4 +6,7 @@ export { default as Navbar } from "./components/Navbar.svelte";
6
6
  export { default as NavbarSeparator } from "./components/NavbarSeparator.svelte";
7
7
  export { default as NavbarElement } from "./components/NavbarElement.svelte";
8
8
  export { default as FloatingInput } from "./components/FloatingInput.svelte";
9
+ export { default as FloatingSelect } from "./components/FloatingSelect.svelte";
10
+ export { default as Text } from "./components/Text.svelte";
11
+ export { default as Card } from "./components/Card.svelte";
9
12
  export { fbmBackground } from "./actions/fbm.js";
@@ -6,5 +6,6 @@ export declare const colorStyles: {
6
6
  pink: string;
7
7
  purple: string;
8
8
  gray: string;
9
+ sub: string;
9
10
  };
10
11
  export type ColorStyle = keyof typeof colorStyles;
@@ -6,4 +6,5 @@ export const colorStyles = {
6
6
  pink: "bg-pink-500 hover:bg-pink-600",
7
7
  purple: "bg-purple-500 hover:bg-purple-600",
8
8
  gray: "bg-gray-500 hover:bg-gray-600",
9
+ sub: "bg-sub-background hover:bg-sub-background-hover"
9
10
  };
@@ -1,6 +1,4 @@
1
1
  @import 'tailwindcss';
2
- @plugin '@tailwindcss/forms';
3
- @plugin '@tailwindcss/typography';
4
2
 
5
3
  @utility flex-center {
6
4
  @apply flex items-center justify-center;
@@ -11,27 +9,33 @@
11
9
  @theme {
12
10
  --color-main-background: var(--vpcui-color-main-background);
13
11
  --color-sub-background: var(--vpcui-color-sub-background);
12
+ --color-sub-background-hover: var(--vpcui-color-sub-background-hover);
14
13
  --color-main-text: var(--vpcui-color-main-text);
15
14
  --color-sub-text: var(--vpcui-color-sub-text);
16
15
  --color-form-input-background: var(--vpcui-color-form-input-background);
16
+ --color-form-input-hover: var(--vpcui-color-form-input-hover);
17
17
  --color-navbar-element-hover-background: var(--vpcui-color-navbar-element-hover-background);
18
18
  }
19
19
 
20
20
  :root {
21
- --vpcui-color-main-background: var(--color-stone-50);
22
- --vpcui-color-sub-background: var(--color-stone-300);
21
+ --vpcui-color-main-background: var(--color-mist-50);
22
+ --vpcui-color-sub-background: var(--color-mist-300);
23
+ --vpcui-color-sub-background-hover: var(--color-mist-400);
23
24
  --vpcui-color-main-text: #000;
24
25
  --vpcui-color-sub-text: #555;
25
- --vpcui-color-form-input-background: var(--color-stone-100);
26
- --vpcui-color-navbar-element-hover-background: var(--color-zinc-100);
26
+ --vpcui-color-form-input-background: var(--color-mist-100);
27
+ --vpcui-color-form-input-hover: var(--color-mist-200);
28
+ --vpcui-color-navbar-element-hover-background: var(--color-mist-100);
27
29
  }
28
30
 
29
31
  html.dark {
30
- --vpcui-color-main-background: var(--color-stone-950);
31
- --vpcui-color-sub-background: var(--color-stone-700);
32
+ --vpcui-color-main-background: #121212;
33
+ --vpcui-color-sub-background: #161616;
34
+ --vpcui-color-sub-background-hover: #1c1c1c;
32
35
  --vpcui-color-main-text: #fff;
33
36
  --vpcui-color-sub-text: #aaa;
34
- --vpcui-color-form-input-background: var(--color-stone-800);
37
+ --vpcui-color-form-input-background: #1c1c1c;
38
+ --vpcui-color-form-input-hover: #2c2c2c;
35
39
  --vpcui-color-navbar-element-hover-background: var(--color-zinc-900);
36
40
  }
37
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valerius_petrini/corekit-ui",
3
- "version": "0.1.36",
3
+ "version": "0.1.41",
4
4
  "description": "Component Library used across all my projects",
5
5
  "author": "Valerius Petrini Jr.",
6
6
  "license": "MIT",
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "files": [
17
17
  "dist",
18
- "src/lib/styles",
19
18
  "!dist/**/*.test.*",
20
19
  "!dist/**/*.spec.*"
21
20
  ],
@@ -29,7 +28,8 @@
29
28
  ".": {
30
29
  "types": "./dist/index.d.ts",
31
30
  "svelte": "./dist/index.js"
32
- }
31
+ },
32
+ "./layout.css": "./dist/styles/layout.css"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "svelte": "^5.0.0"
@@ -1,11 +0,0 @@
1
- export const colorStyles = {
2
- red: "bg-red-500 hover:bg-red-600",
3
- yellow: "bg-yellow-500 hover:bg-yellow-600",
4
- lightgreen: "bg-green-500 hover:bg-green-600",
5
- blue: "bg-blue-500 hover:bg-blue-600",
6
- pink: "bg-pink-500 hover:bg-pink-600",
7
- purple: "bg-purple-500 hover:bg-purple-600",
8
- gray: "bg-gray-500 hover:bg-gray-600",
9
- };
10
-
11
- export type ColorStyle = keyof typeof colorStyles;
@@ -1,40 +0,0 @@
1
- @import 'tailwindcss';
2
- @plugin '@tailwindcss/forms';
3
- @plugin '@tailwindcss/typography';
4
-
5
- @utility flex-center {
6
- @apply flex items-center justify-center;
7
- }
8
-
9
- @custom-variant dark (&:where(.dark, .dark *));
10
-
11
- @theme {
12
- --color-main-background: var(--vpcui-color-main-background);
13
- --color-sub-background: var(--vpcui-color-sub-background);
14
- --color-main-text: var(--vpcui-color-main-text);
15
- --color-sub-text: var(--vpcui-color-sub-text);
16
- --color-form-input-background: var(--vpcui-color-form-input-background);
17
- --color-navbar-element-hover-background: var(--vpcui-color-navbar-element-hover-background);
18
- }
19
-
20
- :root {
21
- --vpcui-color-main-background: var(--color-stone-50);
22
- --vpcui-color-sub-background: var(--color-stone-300);
23
- --vpcui-color-main-text: #000;
24
- --vpcui-color-sub-text: #555;
25
- --vpcui-color-form-input-background: var(--color-stone-100);
26
- --vpcui-color-navbar-element-hover-background: var(--color-zinc-100);
27
- }
28
-
29
- html.dark {
30
- --vpcui-color-main-background: var(--color-stone-950);
31
- --vpcui-color-sub-background: var(--color-stone-700);
32
- --vpcui-color-main-text: #fff;
33
- --vpcui-color-sub-text: #aaa;
34
- --vpcui-color-form-input-background: var(--color-stone-800);
35
- --vpcui-color-navbar-element-hover-background: var(--color-zinc-900);
36
- }
37
-
38
- html {
39
- background-color: var(--color-main-background);
40
- }