sk-clib 1.19.0 → 2.0.5

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.
Files changed (47) hide show
  1. package/README.md +12 -32
  2. package/dist/index.d.ts +0 -2
  3. package/dist/index.js +2 -2
  4. package/dist/theme/index.d.ts +3 -4
  5. package/dist/theme/index.js +3 -7
  6. package/dist/theme/logic.d.ts +23 -3
  7. package/dist/theme/logic.js +74 -71
  8. package/dist/theme/theme-init/components/theme-init.svelte +9 -20
  9. package/dist/theme/theme-init/components/theme-init.svelte.d.ts +4 -14
  10. package/dist/theme/theme.css +162 -0
  11. package/dist/theme/types.d.ts +4 -15
  12. package/dist/theme/types.js +9 -10
  13. package/dist/ui/button/components/button.svelte +3 -3
  14. package/dist/ui/button/components/button.svelte.d.ts +4 -14
  15. package/dist/ui/flex/components/flex.svelte +1 -1
  16. package/dist/ui/flex/components/flex.svelte.d.ts +4 -14
  17. package/dist/ui/frame/components/frame.svelte +1 -1
  18. package/dist/ui/frame/components/frame.svelte.d.ts +4 -14
  19. package/dist/ui/index.d.ts +0 -2
  20. package/dist/ui/index.js +0 -1
  21. package/dist/ui/input/components/input.svelte +2 -1
  22. package/dist/ui/input/components/input.svelte.d.ts +4 -14
  23. package/dist/ui/spacer/components/spacer.svelte +1 -1
  24. package/dist/ui/spacer/components/spacer.svelte.d.ts +4 -14
  25. package/dist/ui/text/components/text.svelte +1 -1
  26. package/dist/ui/text/components/text.svelte.d.ts +4 -14
  27. package/dist/{utils.d.ts → utils/classname.d.ts} +0 -9
  28. package/dist/{utils.js → utils/classname.js} +0 -21
  29. package/dist/utils/crypto.d.ts +1 -0
  30. package/dist/utils/crypto.js +3 -0
  31. package/dist/utils/index.d.ts +3 -0
  32. package/dist/utils/index.js +3 -0
  33. package/dist/utils/number.d.ts +8 -0
  34. package/dist/utils/number.js +10 -0
  35. package/dist/utils/string.d.ts +18 -0
  36. package/dist/utils/string.js +28 -0
  37. package/package.json +35 -48
  38. package/dist/assets/favicon.svg +0 -1
  39. package/dist/styles.css +0 -1152
  40. package/dist/ui/header/components/header.svelte +0 -147
  41. package/dist/ui/header/components/header.svelte.d.ts +0 -52
  42. package/dist/ui/header/index.d.ts +0 -2
  43. package/dist/ui/header/index.js +0 -1
  44. package/dist/ui/header/types.d.ts +0 -31
  45. package/dist/ui/header/types.js +0 -1
  46. /package/dist/theme/{stores.svelte.d.ts → state.svelte.d.ts} +0 -0
  47. /package/dist/theme/{stores.svelte.js → state.svelte.js} +0 -0
@@ -1,14 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: Record<string, never>;
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {};
8
- };
9
- export type FrameProps = typeof __propDef.props;
10
- export type FrameEvents = typeof __propDef.events;
11
- export type FrameSlots = typeof __propDef.slots;
1
+ import type { Props } from '..';
12
2
  /**
13
3
  * Generated by SvelteForge🔥 [Component Template]
14
4
  *
@@ -27,6 +17,6 @@ export type FrameSlots = typeof __propDef.slots;
27
17
  * This will create a flex container that is a row, centered, and fills the available space.
28
18
  * The `class` prop can be used to add additional classes to the frame, and the `children` prop can be used to pass in child components.
29
19
  */
30
- export default class Frame extends SvelteComponentTyped<FrameProps, FrameEvents, FrameSlots> {
31
- }
32
- export {};
20
+ declare const Frame: import("svelte").Component<Props, {}, "shadow" | "scrim" | "surfaceVariant" | "background" | "surface" | "inverseSurface" | "outline" | "outlineVariant" | "primary" | "primaryContainer" | "inversePrimary" | "secondary" | "secondaryContainer" | "tertiary" | "tertiaryContainer" | "error" | "fill" | "class" | "flex" | "row" | "col" | "centerx" | "centery" | "center" | "fillw" | "fillh" | "noshrink" | "aspectSquare" | "cursorAuto" | "cursorDefault" | "cursorPointer">;
21
+ type Frame = ReturnType<typeof Frame>;
22
+ export default Frame;
@@ -1,14 +1,12 @@
1
1
  export { default as Button } from './button/components/button.svelte';
2
2
  export { default as Flex } from './flex/components/flex.svelte';
3
3
  export { default as Frame } from './frame/components/frame.svelte';
4
- export { default as Header } from './header/components/header.svelte';
5
4
  export { default as Input } from './input/components/input.svelte';
6
5
  export { default as Spacer } from './spacer/components/spacer.svelte';
7
6
  export { default as Text } from './text/components/text.svelte';
8
7
  export type { tButtonProps } from './button/types';
9
8
  export type { tFlexProps } from './flex/types';
10
9
  export type { tFrameProps } from './frame/types';
11
- export type { tHeaderProps } from './header/types';
12
10
  export type { tInputProps } from './input/types';
13
11
  export type { tSpacerProps } from './spacer/types';
14
12
  export type { tTextProps } from './text/types';
package/dist/ui/index.js CHANGED
@@ -4,7 +4,6 @@
4
4
  export { default as Button } from './button/components/button.svelte';
5
5
  export { default as Flex } from './flex/components/flex.svelte';
6
6
  export { default as Frame } from './frame/components/frame.svelte';
7
- export { default as Header } from './header/components/header.svelte';
8
7
  export { default as Input } from './input/components/input.svelte';
9
8
  export { default as Spacer } from './spacer/components/spacer.svelte';
10
9
  export { default as Text } from './text/components/text.svelte';
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  // --- Logic ---
3
- import { cn, uuidv4 } from '../../../utils';
3
+ import { cn } from '../../../utils/classname';
4
+ import { uuidv4 } from '../../../utils/crypto';
4
5
  import type { Props } from '..';
5
6
  import { Frame } from '../..';
6
7
 
@@ -1,20 +1,10 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: Record<string, never>;
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {};
8
- };
9
- export type InputProps = typeof __propDef.props;
10
- export type InputEvents = typeof __propDef.events;
11
- export type InputSlots = typeof __propDef.slots;
1
+ import type { Props } from '..';
12
2
  /**
13
3
  * Generated by SvelteForge🔥
14
4
  *
15
5
  * # Input Component
16
6
  * Wrapper for input element that renders children within a label tag
17
7
  */
18
- export default class Input extends SvelteComponentTyped<InputProps, InputEvents, InputSlots> {
19
- }
20
- export {};
8
+ declare const Input: import("svelte").Component<Props, {}, "fill" | "class" | "name" | "type" | "id" | "flex" | "row" | "col" | "centerx" | "centery" | "center" | "fillw" | "fillh" | "noshrink" | "aspectSquare" | "cursorAuto" | "cursorDefault" | "cursorPointer" | "classFrame">;
9
+ type Input = ReturnType<typeof Input>;
10
+ export default Input;
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  // --- Logic ---
3
- import { cn, Tokenizer } from '../../../utils';
3
+ import { cn, Tokenizer } from '../../../utils/classname';
4
4
  import type { Props } from '..';
5
5
 
6
6
  let {
@@ -1,14 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: Record<string, never>;
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {};
8
- };
9
- export type SpacerProps = typeof __propDef.props;
10
- export type SpacerEvents = typeof __propDef.events;
11
- export type SpacerSlots = typeof __propDef.slots;
1
+ import type { Props } from '..';
12
2
  /**
13
3
  * ---
14
4
  * name: Spacer
@@ -22,6 +12,6 @@ export type SpacerSlots = typeof __propDef.slots;
22
12
  * Element that is soley made to fill in space. If nothing is passed, assumes 'size-full',
23
13
  * otherwise, it fills the direction you tell it to.
24
14
  */
25
- export default class Spacer extends SvelteComponentTyped<SpacerProps, SpacerEvents, SpacerSlots> {
26
- }
27
- export {};
15
+ declare const Spacer: import("svelte").Component<Props, {}, "class" | "height" | "width" | "horizontal" | "vertical">;
16
+ type Spacer = ReturnType<typeof Spacer>;
17
+ export default Spacer;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
 
3
3
  // --- Logic ---
4
- import { cn, Tokenizer } from '../../../utils';
4
+ import { cn, Tokenizer } from '../../../utils/classname';
5
5
  import type { Props } from ".."
6
6
 
7
7
  // Size Class Lookup Table
@@ -1,15 +1,5 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: Record<string, never>;
4
- events: {
5
- [evt: string]: CustomEvent<any>;
6
- };
7
- slots: {};
8
- };
9
- export type TextProps = typeof __propDef.props;
10
- export type TextEvents = typeof __propDef.events;
11
- export type TextSlots = typeof __propDef.slots;
1
+ import type { Props } from "..";
12
2
  /** Generated by SvelteForge🔥 */
13
- export default class Text extends SvelteComponentTyped<TextProps, TextEvents, TextSlots> {
14
- }
15
- export {};
3
+ declare const Text: import("svelte").Component<Props, {}, "">;
4
+ type Text = ReturnType<typeof Text>;
5
+ export default Text;
@@ -43,15 +43,6 @@ export declare class cn_a {
43
43
  */
44
44
  static buildx(selector: string, classes: string): string;
45
45
  }
46
- export declare function expand(node: HTMLElement, params: any, { duration }: {
47
- duration?: number | undefined;
48
- }): {
49
- duration: number;
50
- easing: any;
51
- css: (t: number) => string;
52
- };
53
- export declare function uuidv4(): string;
54
- export declare function reference_package_to_form(package_name: string, location?: string | undefined): string;
55
46
  /**
56
47
  * A utility class for dynamically building class names based on conditional logic.
57
48
  * This class is particularly useful for managing conditional class tokens in a structured way.
@@ -1,7 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { base } from '$app/paths';
3
2
  import { clsx } from 'clsx';
4
- import { cubicOut } from 'svelte/easing';
5
3
  import { twMerge } from 'tailwind-merge';
6
4
  /**
7
5
  * Fix class naming conflicts by utilizing both :function:`twMerge` and :function:`clsx`
@@ -74,25 +72,6 @@ export class cn_a {
74
72
  return buffer.join(' '); // Return all the changes split
75
73
  }
76
74
  }
77
- export function expand(node, params, { duration = 300 }) {
78
- const height = node.scrollHeight;
79
- return {
80
- duration,
81
- easing: params.easing || cubicOut,
82
- css: (t) => `height: ${t * height}px; opacity: ${t}; margin-top: ${t * ((params.offset !== undefined) ? params.offset : 8)}px;`
83
- };
84
- }
85
- export function uuidv4() {
86
- return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));
87
- }
88
- export function reference_package_to_form(package_name, location = undefined) {
89
- let buff = `?tour-package=${package_name}`;
90
- if (location !== undefined) {
91
- buff += `&location=${location}`;
92
- }
93
- window.location.href = `${base}/form${buff}`;
94
- return buff;
95
- }
96
75
  /**
97
76
  * A utility class for dynamically building class names based on conditional logic.
98
77
  * This class is particularly useful for managing conditional class tokens in a structured way.
@@ -0,0 +1 @@
1
+ export declare function uuidv4(): string;
@@ -0,0 +1,3 @@
1
+ export function uuidv4() {
2
+ return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (+c / 4)))).toString(16));
3
+ }
@@ -0,0 +1,3 @@
1
+ export * from './classname';
2
+ export * from './number';
3
+ export * from './string';
@@ -0,0 +1,3 @@
1
+ export * from './classname';
2
+ export * from './number';
3
+ export * from './string';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Clamps a number between a given min and max
3
+ *
4
+ * @param number Number to clamp
5
+ * @param min Minimum the number can be
6
+ * @param max Maximum the number can be
7
+ */
8
+ export declare function clamp(number: number, min: number, max: number): number;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Clamps a number between a given min and max
3
+ *
4
+ * @param number Number to clamp
5
+ * @param min Minimum the number can be
6
+ * @param max Maximum the number can be
7
+ */
8
+ export function clamp(number, min, max) {
9
+ return Math.max(min, Math.min(number, max));
10
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Converts a string like "test_string" or "test-string" to "testString"
3
+ * @param s String to convert
4
+ */
5
+ export declare function snakeOrKebabToCamel(s: string): string;
6
+ /**
7
+ * Converts a snake_case string to kebab-case.
8
+ *
9
+ * Examples:
10
+ * - "test_string" -> "test-string"
11
+ * - "__Foo__Bar__" -> "foo-bar"
12
+ * - "already-kebab" -> "already-kebab"
13
+ *
14
+ * @param s Input string in snake_case (or similar).
15
+ * @returns The input converted to kebab-case (lowercased, underscores -> hyphens,
16
+ * consecutive underscores collapsed, and leading/trailing separators trimmed).
17
+ */
18
+ export declare function snakeToKebab(s: string): string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Converts a string like "test_string" or "test-string" to "testString"
3
+ * @param s String to convert
4
+ */
5
+ export function snakeOrKebabToCamel(s) {
6
+ return s.toLowerCase().replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', '').replace('_', ''));
7
+ }
8
+ /**
9
+ * Converts a snake_case string to kebab-case.
10
+ *
11
+ * Examples:
12
+ * - "test_string" -> "test-string"
13
+ * - "__Foo__Bar__" -> "foo-bar"
14
+ * - "already-kebab" -> "already-kebab"
15
+ *
16
+ * @param s Input string in snake_case (or similar).
17
+ * @returns The input converted to kebab-case (lowercased, underscores -> hyphens,
18
+ * consecutive underscores collapsed, and leading/trailing separators trimmed).
19
+ */
20
+ export function snakeToKebab(s) {
21
+ if (!s)
22
+ return s;
23
+ // Replace one-or-more underscores with a single hyphen, then trim hyphens, then lowercase.
24
+ return s
25
+ .replace(/_+/g, '-')
26
+ .replace(/^-+|-+$/g, '')
27
+ .toLowerCase();
28
+ }
package/package.json CHANGED
@@ -1,17 +1,32 @@
1
1
  {
2
2
  "name": "sk-clib",
3
- "version": "1.19.0",
3
+ "version": "2.0.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/TreltaSev/sk-clib"
7
7
  },
8
- "type": "module",
8
+ "scripts": {
9
+ "dev": "vite dev",
10
+ "build": "vite build && npm run prepack",
11
+ "preview": "vite preview",
12
+ "prepare": "svelte-kit sync || echo ''",
13
+ "prepack": "svelte-kit sync && svelte-package && publint",
14
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
15
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
16
+ "lint": "prettier --check .",
17
+ "format": "prettier --write ."
18
+ },
9
19
  "files": [
10
20
  "dist",
11
21
  "!dist/**/*.test.*",
12
- "!dist/**/*.spec.*",
13
- "dist/styles.css"
22
+ "!dist/**/*.spec.*"
14
23
  ],
24
+ "sideEffects": [
25
+ "**/*.css"
26
+ ],
27
+ "svelte": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "type": "module",
15
30
  "exports": {
16
31
  ".": {
17
32
  "types": "./dist/index.d.ts",
@@ -22,68 +37,40 @@
22
37
  "svelte": "./dist/ui/index.js"
23
38
  },
24
39
  "./style": {
25
- "default": "./dist/styles.css"
40
+ "default": "./dist/theme/theme.css"
26
41
  },
27
42
  "./theme": {
28
43
  "types": "./dist/theme/index.d.ts",
29
44
  "svelte": "./dist/theme/index.js",
30
45
  "default": "./dist/theme/index.js"
31
- },
32
- "./theme/types": {
33
- "types": "./dist/theme/types.d.ts",
34
- "default": "./dist/theme/types.js"
35
46
  }
36
47
  },
37
- "svelte": "./dist/index.js",
38
- "types": "./dist/index.d.ts",
39
- "sideEffects": [
40
- "**/*.css"
41
- ],
42
- "keywords": [
43
- "svelte",
44
- "component",
45
- "library"
46
- ],
47
- "scripts": {
48
- "dev": "vite dev",
49
- "build": "svelte-package && node ../../scripts/postbuild-theme-types.mjs && npm run css_build",
50
- "css_build": "npx tailwindcss -i ./src/library.css -o ./dist/styles.css",
51
- "preview": "vite preview",
52
- "prepare": "svelte-kit sync || echo ''",
53
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
54
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
55
- "lint": "prettier --check . && eslint .",
56
- "format": "prettier --write ."
48
+ "peerDependencies": {
49
+ "svelte": "^5.0.0"
57
50
  },
58
51
  "devDependencies": {
59
- "@eslint/compat": "^2.0.4",
60
- "@eslint/js": "^10.0.1",
61
- "@iconify/json": "^2.2.480",
62
- "@sveltejs/adapter-auto": "^7.0.1",
52
+ "@sveltejs/adapter-static": "^3.0.10",
53
+ "@sveltejs/kit": "^2.57.0",
54
+ "@sveltejs/package": "^2.5.7",
63
55
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
64
- "@types/node": "^22",
65
- "eslint": "^10.2.0",
66
- "eslint-config-prettier": "^10.1.8",
67
- "eslint-plugin-svelte": "^3.17.0",
68
- "globals": "^17.4.0",
56
+ "@tailwindcss/vite": "^4.2.2",
57
+ "@types/node": "^25.9.1",
69
58
  "prettier": "^3.8.1",
70
59
  "prettier-plugin-svelte": "^3.5.1",
71
60
  "prettier-plugin-tailwindcss": "^0.7.2",
61
+ "publint": "^0.3.18",
72
62
  "svelte": "^5.55.2",
73
63
  "svelte-check": "^4.4.6",
64
+ "tailwindcss": "^4.2.2",
74
65
  "typescript": "^6.0.2",
75
- "typescript-eslint": "^8.58.1",
76
- "unplugin-icons": "^23.0.1",
77
66
  "vite": "^8.0.7"
78
67
  },
68
+ "keywords": [
69
+ "svelte"
70
+ ],
79
71
  "dependencies": {
80
- "@material/material-color-utilities": "^0.3.0",
81
- "@sveltejs/package": "^2.5.7",
82
- "js-cookie": "^3.0.5",
83
- "tailwind-merge": "^3.2.0",
84
- "@sveltejs/kit": "^2.57.0",
85
- "@tailwindcss/cli": "^4.1.5",
86
- "@tailwindcss/vite": "^4.1.7",
87
- "tailwindcss": "^4.2.2"
72
+ "@poupe/material-color-utilities": "^0.4.1",
73
+ "js-cookie": "^3.0.8",
74
+ "tailwind-merge": "^3.6.0"
88
75
  }
89
76
  }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="107" height="128" viewBox="0 0 107 128"><title>svelte-logo</title><path d="M94.157 22.819c-10.4-14.885-30.94-19.297-45.792-9.835L22.282 29.608A29.92 29.92 0 0 0 8.764 49.65a31.5 31.5 0 0 0 3.108 20.231 30 30 0 0 0-4.477 11.183 31.9 31.9 0 0 0 5.448 24.116c10.402 14.887 30.942 19.297 45.791 9.835l26.083-16.624A29.92 29.92 0 0 0 98.235 78.35a31.53 31.53 0 0 0-3.105-20.232 30 30 0 0 0 4.474-11.182 31.88 31.88 0 0 0-5.447-24.116" style="fill:#ff3e00"/><path d="M45.817 106.582a20.72 20.72 0 0 1-22.237-8.243 19.17 19.17 0 0 1-3.277-14.503 18 18 0 0 1 .624-2.435l.49-1.498 1.337.981a33.6 33.6 0 0 0 10.203 5.098l.97.294-.09.968a5.85 5.85 0 0 0 1.052 3.878 6.24 6.24 0 0 0 6.695 2.485 5.8 5.8 0 0 0 1.603-.704L69.27 76.28a5.43 5.43 0 0 0 2.45-3.631 5.8 5.8 0 0 0-.987-4.371 6.24 6.24 0 0 0-6.698-2.487 5.7 5.7 0 0 0-1.6.704l-9.953 6.345a19 19 0 0 1-5.296 2.326 20.72 20.72 0 0 1-22.237-8.243 19.17 19.17 0 0 1-3.277-14.502 17.99 17.99 0 0 1 8.13-12.052l26.081-16.623a19 19 0 0 1 5.3-2.329 20.72 20.72 0 0 1 22.237 8.243 19.17 19.17 0 0 1 3.277 14.503 18 18 0 0 1-.624 2.435l-.49 1.498-1.337-.98a33.6 33.6 0 0 0-10.203-5.1l-.97-.294.09-.968a5.86 5.86 0 0 0-1.052-3.878 6.24 6.24 0 0 0-6.696-2.485 5.8 5.8 0 0 0-1.602.704L37.73 51.72a5.42 5.42 0 0 0-2.449 3.63 5.79 5.79 0 0 0 .986 4.372 6.24 6.24 0 0 0 6.698 2.486 5.8 5.8 0 0 0 1.602-.704l9.952-6.342a19 19 0 0 1 5.295-2.328 20.72 20.72 0 0 1 22.237 8.242 19.17 19.17 0 0 1 3.277 14.503 18 18 0 0 1-8.13 12.053l-26.081 16.622a19 19 0 0 1-5.3 2.328" style="fill:#fff"/></svg>