grav-svelte 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Your Name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Grav Svelte
2
+
3
+ A collection of Svelte components for building beautiful user interfaces.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install grav-svelte
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```svelte
14
+ <script>
15
+ import { Button } from 'grav-svelte';
16
+ </script>
17
+
18
+ <Button variant="primary" size="medium">Click me</Button>
19
+ ```
20
+
21
+ ## Components
22
+
23
+ ### Button
24
+
25
+ A versatile button component with multiple variants and sizes.
26
+
27
+ #### Props
28
+
29
+ | Prop | Type | Default | Description |
30
+ |------|------|---------|-------------|
31
+ | variant | 'primary' \| 'secondary' \| 'outline' | 'primary' | The visual style of the button |
32
+ | size | 'small' \| 'medium' \| 'large' | 'medium' | The size of the button |
33
+ | disabled | boolean | false | Whether the button is disabled |
34
+ | type | 'button' \| 'submit' \| 'reset' | 'button' | The HTML button type |
35
+ | class_name | string | '' | Additional CSS classes |
36
+
37
+ #### Examples
38
+
39
+ ```svelte
40
+ <!-- Primary button -->
41
+ <Button variant="primary">Primary Button</Button>
42
+
43
+ <!-- Secondary button -->
44
+ <Button variant="secondary">Secondary Button</Button>
45
+
46
+ <!-- Outline button -->
47
+ <Button variant="outline">Outline Button</Button>
48
+
49
+ <!-- Different sizes -->
50
+ <Button size="small">Small Button</Button>
51
+ <Button size="medium">Medium Button</Button>
52
+ <Button size="large">Large Button</Button>
53
+
54
+ <!-- Disabled state -->
55
+ <Button disabled>Disabled Button</Button>
56
+
57
+ <!-- With click handler -->
58
+ <Button on:click={() => alert('Clicked!')}>Click me</Button>
59
+ ```
60
+
61
+ ## Development
62
+
63
+ ```bash
64
+ # Install dependencies
65
+ npm install
66
+
67
+ # Start development server
68
+ npm run dev
69
+
70
+ # Build the package
71
+ npm run build
72
+
73
+ # Run type checking
74
+ npm run check
75
+ ```
76
+
77
+ ## License
78
+
79
+ MIT
@@ -0,0 +1,42 @@
1
+ <script lang="ts">
2
+ export let variant: "primary" | "secondary" | "outline" = "primary";
3
+ export let size: "small" | "medium" | "large" = "medium";
4
+ export let disabled = false;
5
+ export let type: "button" | "submit" | "reset" = "button";
6
+ export let class_name = "";
7
+
8
+ const baseClasses =
9
+ "rounded font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2";
10
+
11
+ const variantClasses = {
12
+ primary: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",
13
+ secondary:
14
+ "bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",
15
+ outline:
16
+ "border-2 border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500",
17
+ };
18
+
19
+ const sizeClasses = {
20
+ small: "px-3 py-1.5 text-sm",
21
+ medium: "px-4 py-2 text-base",
22
+ large: "px-6 py-3 text-lg",
23
+ };
24
+
25
+ const disabledClasses = "opacity-50 cursor-not-allowed";
26
+ </script>
27
+
28
+ <button
29
+ {type}
30
+ {disabled}
31
+ class="{baseClasses} {variantClasses[variant]} {sizeClasses[size]} {disabled
32
+ ? disabledClasses
33
+ : ''} {class_name}"
34
+ on:click
35
+ {...$$restProps}
36
+ >
37
+ <slot />
38
+ </button>
39
+
40
+ <style>
41
+ /* Add any component-specific styles here */
42
+ </style>
@@ -0,0 +1,36 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
15
+ default: any;
16
+ } ? Props extends Record<string, never> ? any : {
17
+ children?: any;
18
+ } : {});
19
+ declare const Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
20
+ [x: string]: any;
21
+ variant?: "primary" | "secondary" | "outline" | undefined;
22
+ size?: "small" | "medium" | "large" | undefined;
23
+ disabled?: boolean | undefined;
24
+ type?: "button" | "submit" | "reset" | undefined;
25
+ class_name?: string | undefined;
26
+ }, {
27
+ default: {};
28
+ }>, {
29
+ click: MouseEvent;
30
+ } & {
31
+ [evt: string]: CustomEvent<any>;
32
+ }, {
33
+ default: {};
34
+ }, {}, string>;
35
+ type Button = InstanceType<typeof Button>;
36
+ export default Button;
@@ -0,0 +1 @@
1
+ export { default as Button } from './Button.svelte';
@@ -0,0 +1 @@
1
+ export { default as Button } from './Button.svelte';
@@ -0,0 +1 @@
1
+ export { Button } from './Button/index.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // Reexport your entry components here
2
+ export { Button } from './Button/index.js';
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "grav-svelte",
3
+ "version": "0.0.1",
4
+ "description": "A collection of Svelte components",
5
+ "license": "MIT",
6
+ "scripts": {
7
+ "dev": "vite dev",
8
+ "build": "vite build && npm run prepack",
9
+ "preview": "vite preview",
10
+ "prepare": "svelte-kit sync || echo ''",
11
+ "prepack": "svelte-kit sync && svelte-package && publint",
12
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
13
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "!dist/**/*.test.*",
18
+ "!dist/**/*.spec.*"
19
+ ],
20
+ "sideEffects": [
21
+ "**/*.css"
22
+ ],
23
+ "svelte": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
25
+ "type": "module",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "svelte": "./dist/index.js"
30
+ }
31
+ },
32
+ "peerDependencies": {
33
+ "svelte": "^5.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@sveltejs/adapter-auto": "^6.0.0",
37
+ "@sveltejs/kit": "^2.16.0",
38
+ "@sveltejs/package": "^2.0.0",
39
+ "@sveltejs/vite-plugin-svelte": "^5.0.0",
40
+ "publint": "^0.3.2",
41
+ "svelte": "^5.0.0",
42
+ "svelte-check": "^4.0.0",
43
+ "typescript": "^5.0.0",
44
+ "vite": "^6.2.6"
45
+ },
46
+ "keywords": [
47
+ "svelte",
48
+ "components",
49
+ "ui",
50
+ "button"
51
+ ],
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/yourusername/grav-svelte.git"
55
+ },
56
+ "bugs": {
57
+ "url": "https://github.com/yourusername/grav-svelte/issues"
58
+ },
59
+ "homepage": "https://github.com/yourusername/grav-svelte#readme",
60
+ "author": "Your Name",
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
64
+ }