@makolabs/ripple 0.0.1-dev

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/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # MakoLabs Ripple UI
2
+
3
+ This is a simplistic UI library by makolabs.
4
+
5
+ ## Getting started
6
+
7
+ Install the project
8
+
9
+ ```shell
10
+ npm i @makolabs/ripple
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Import ripple UI
16
+
17
+ ```svelte
18
+ <script lang="ts">
19
+ import {Card} from '@makolabs/ripple/layout';
20
+ </script>
21
+
22
+ <div class="px-12 pt-12">
23
+ <Card title="Hello World" color="warning">
24
+ <p>This is a card component</p>
25
+ </Card>
26
+ </div>
27
+ ```
28
+
29
+
30
+ Paste the following CSS import code in `app.css`
31
+
32
+ ```css
33
+ @source "../node_modules/@makolabs/ripple";
34
+ ```
35
+
36
+ > More coming soon!
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,5 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,179 @@
1
+ <script lang="ts" module>
2
+ import { cn } from '../helper/cls';
3
+ import type { Snippet } from 'svelte';
4
+ import { tv, type ClassValue } from 'tailwind-variants';
5
+
6
+ const cardVariants = tv({
7
+ variants: {
8
+ size: {
9
+ 'xs': 'p-2',
10
+ 'sm': 'p-3',
11
+ 'base': 'p-4',
12
+ 'lg': 'p-5',
13
+ 'xl': 'p-6',
14
+ '2xl': 'p-8'
15
+ },
16
+ color: {
17
+ 'default': 'bg-default-50 dark:bg-default-800',
18
+ 'primary': 'bg-primary-50 dark:bg-primary-900/20',
19
+ 'secondary': 'bg-secondary-50 dark:bg-secondary-800/20',
20
+ 'info': 'bg-info-50 dark:bg-info-900/20',
21
+ 'success': 'bg-success-50 dark:bg-success-900/20',
22
+ 'warning': 'bg-warning-50 dark:bg-warning-900/20',
23
+ 'danger': 'bg-danger-50 dark:bg-danger-900/20'
24
+ },
25
+ border: {
26
+ 'none': 'border-0',
27
+ 'default': 'border border-gray-200 dark:border-gray-700',
28
+ 'colored': 'border'
29
+ },
30
+ rounded: {
31
+ 'none': 'rounded-none',
32
+ 'sm': 'rounded',
33
+ 'md': 'rounded-lg',
34
+ 'lg': 'rounded-xl',
35
+ 'full': 'rounded-3xl'
36
+ },
37
+ shadow: {
38
+ 'none': 'shadow-none',
39
+ 'sm': 'shadow-sm',
40
+ 'md': 'shadow',
41
+ 'lg': 'shadow-lg'
42
+ }
43
+ },
44
+ defaultVariants: {
45
+ size: 'base',
46
+ color: 'default',
47
+ border: 'default',
48
+ rounded: 'md',
49
+ shadow: 'sm'
50
+ }
51
+ });
52
+
53
+ const SIZE_TEXT_VARIANTS = {
54
+ 'xs': 'text-xs',
55
+ 'sm': 'text-sm',
56
+ 'base': 'text-base',
57
+ 'lg': 'text-lg',
58
+ 'xl': 'text-xl',
59
+ '2xl': 'text-2xl'
60
+ };
61
+
62
+ const cardTitleVariants = tv({
63
+ variants: {
64
+ color: {
65
+ 'default': 'text-default-900 dark:text-default-100',
66
+ 'primary': 'text-primary-900 dark:text-primary-100',
67
+ 'secondary': 'text-secondary-900 dark:text-secondary-100',
68
+ 'info': 'text-info-900 dark:text-info-100',
69
+ 'success': 'text-success-900 dark:text-success-100',
70
+ 'warning': 'text-warning-900 dark:text-warning-100',
71
+ 'danger': 'text-danger-900 dark:text-danger-100'
72
+ },
73
+ weight: {
74
+ 'normal': 'font-normal',
75
+ 'medium': 'font-medium',
76
+ 'semibold': 'font-semibold',
77
+ 'bold': 'font-bold'
78
+ },
79
+ size: SIZE_TEXT_VARIANTS
80
+ },
81
+ defaultVariants: {
82
+ color: 'default',
83
+ weight: 'semibold',
84
+ size: 'base'
85
+ }
86
+ });
87
+
88
+ const cardBodyVariants = tv({
89
+ variants: {
90
+ color: {
91
+ 'default': 'text-default-700 dark:text-default-300',
92
+ 'primary': 'text-primary-700 dark:text-primary-300',
93
+ 'secondary': 'text-secondary-700 dark:text-secondary-300',
94
+ 'info': 'text-info-700 dark:text-info-300',
95
+ 'success': 'text-success-700 dark:text-success-300',
96
+ 'warning': 'text-warning-700 dark:text-warning-300',
97
+ 'danger': 'text-danger-700 dark:text-danger-300'
98
+ },
99
+ size: SIZE_TEXT_VARIANTS
100
+ },
101
+ defaultVariants: {
102
+ color: 'default',
103
+ size: 'base'
104
+ }
105
+ });
106
+
107
+
108
+ export type BaseCardProps = {
109
+ class?: ClassValue
110
+ containerClass?: ClassValue
111
+ size?: keyof typeof cardVariants.variants.size
112
+ color?: keyof typeof cardVariants.variants.color
113
+ border?: keyof typeof cardVariants.variants.border
114
+ rounded?: keyof typeof cardVariants.variants.rounded
115
+ shadow?: keyof typeof cardVariants.variants.shadow;
116
+ titleWeight?: keyof typeof cardTitleVariants.variants.weight
117
+ }
118
+
119
+ type CustomCardProps = {
120
+ custom: Snippet
121
+ children?: never
122
+ title?: never
123
+ }
124
+
125
+ type CardWithChildrenProps = {
126
+ children: Snippet
127
+ custom?: never
128
+ title?: string
129
+ }
130
+
131
+ export type CardProps = BaseCardProps & (CardWithChildrenProps | CustomCardProps);
132
+ </script>
133
+
134
+ <script lang="ts">
135
+ let {
136
+ children,
137
+ custom,
138
+ title,
139
+ size = 'base',
140
+ color = 'default',
141
+ border = 'default',
142
+ rounded = 'md',
143
+ shadow = 'sm',
144
+ class: className = '',
145
+ titleWeight = 'semibold'
146
+ }: CardProps = $props();
147
+
148
+ const cardClasses = $derived(
149
+ cn(
150
+ cardVariants({ size, color, border, rounded, shadow }),
151
+ className
152
+ )
153
+ );
154
+
155
+ const cardTitleClasses = $derived(
156
+ cn(
157
+ cardTitleVariants({ color: color, weight: titleWeight, size })
158
+ )
159
+ );
160
+
161
+ const cardBodyClasses = $derived(
162
+ cn(
163
+ cardBodyVariants({ color: color, size })
164
+ )
165
+ );
166
+ </script>
167
+
168
+ <div class={cardClasses}>
169
+ {#if children}
170
+ {#if title}
171
+ <h3 class={cardTitleClasses}>{title}</h3>
172
+ {/if}
173
+ <div class={cardBodyClasses}>
174
+ {@render children()}
175
+ </div>
176
+ {:else if custom}
177
+ {@render custom()}
178
+ {/if}
179
+ </div>
@@ -0,0 +1,208 @@
1
+ import type { Snippet } from 'svelte';
2
+ import { type ClassValue } from 'tailwind-variants';
3
+ declare const cardVariants: import("tailwind-variants").TVReturnType<{
4
+ size: {
5
+ xs: string;
6
+ sm: string;
7
+ base: string;
8
+ lg: string;
9
+ xl: string;
10
+ '2xl': string;
11
+ };
12
+ color: {
13
+ default: string;
14
+ primary: string;
15
+ secondary: string;
16
+ info: string;
17
+ success: string;
18
+ warning: string;
19
+ danger: string;
20
+ };
21
+ border: {
22
+ none: string;
23
+ default: string;
24
+ colored: string;
25
+ };
26
+ rounded: {
27
+ none: string;
28
+ sm: string;
29
+ md: string;
30
+ lg: string;
31
+ full: string;
32
+ };
33
+ shadow: {
34
+ none: string;
35
+ sm: string;
36
+ md: string;
37
+ lg: string;
38
+ };
39
+ }, undefined, undefined, {
40
+ size: {
41
+ xs: string;
42
+ sm: string;
43
+ base: string;
44
+ lg: string;
45
+ xl: string;
46
+ '2xl': string;
47
+ };
48
+ color: {
49
+ default: string;
50
+ primary: string;
51
+ secondary: string;
52
+ info: string;
53
+ success: string;
54
+ warning: string;
55
+ danger: string;
56
+ };
57
+ border: {
58
+ none: string;
59
+ default: string;
60
+ colored: string;
61
+ };
62
+ rounded: {
63
+ none: string;
64
+ sm: string;
65
+ md: string;
66
+ lg: string;
67
+ full: string;
68
+ };
69
+ shadow: {
70
+ none: string;
71
+ sm: string;
72
+ md: string;
73
+ lg: string;
74
+ };
75
+ }, undefined, import("tailwind-variants").TVReturnType<{
76
+ size: {
77
+ xs: string;
78
+ sm: string;
79
+ base: string;
80
+ lg: string;
81
+ xl: string;
82
+ '2xl': string;
83
+ };
84
+ color: {
85
+ default: string;
86
+ primary: string;
87
+ secondary: string;
88
+ info: string;
89
+ success: string;
90
+ warning: string;
91
+ danger: string;
92
+ };
93
+ border: {
94
+ none: string;
95
+ default: string;
96
+ colored: string;
97
+ };
98
+ rounded: {
99
+ none: string;
100
+ sm: string;
101
+ md: string;
102
+ lg: string;
103
+ full: string;
104
+ };
105
+ shadow: {
106
+ none: string;
107
+ sm: string;
108
+ md: string;
109
+ lg: string;
110
+ };
111
+ }, undefined, undefined, unknown, unknown, undefined>>;
112
+ declare const cardTitleVariants: import("tailwind-variants").TVReturnType<{
113
+ color: {
114
+ default: string;
115
+ primary: string;
116
+ secondary: string;
117
+ info: string;
118
+ success: string;
119
+ warning: string;
120
+ danger: string;
121
+ };
122
+ weight: {
123
+ normal: string;
124
+ medium: string;
125
+ semibold: string;
126
+ bold: string;
127
+ };
128
+ size: {
129
+ xs: string;
130
+ sm: string;
131
+ base: string;
132
+ lg: string;
133
+ xl: string;
134
+ '2xl': string;
135
+ };
136
+ }, undefined, undefined, {
137
+ color: {
138
+ default: string;
139
+ primary: string;
140
+ secondary: string;
141
+ info: string;
142
+ success: string;
143
+ warning: string;
144
+ danger: string;
145
+ };
146
+ weight: {
147
+ normal: string;
148
+ medium: string;
149
+ semibold: string;
150
+ bold: string;
151
+ };
152
+ size: {
153
+ xs: string;
154
+ sm: string;
155
+ base: string;
156
+ lg: string;
157
+ xl: string;
158
+ '2xl': string;
159
+ };
160
+ }, undefined, import("tailwind-variants").TVReturnType<{
161
+ color: {
162
+ default: string;
163
+ primary: string;
164
+ secondary: string;
165
+ info: string;
166
+ success: string;
167
+ warning: string;
168
+ danger: string;
169
+ };
170
+ weight: {
171
+ normal: string;
172
+ medium: string;
173
+ semibold: string;
174
+ bold: string;
175
+ };
176
+ size: {
177
+ xs: string;
178
+ sm: string;
179
+ base: string;
180
+ lg: string;
181
+ xl: string;
182
+ '2xl': string;
183
+ };
184
+ }, undefined, undefined, unknown, unknown, undefined>>;
185
+ export type BaseCardProps = {
186
+ class?: ClassValue;
187
+ containerClass?: ClassValue;
188
+ size?: keyof typeof cardVariants.variants.size;
189
+ color?: keyof typeof cardVariants.variants.color;
190
+ border?: keyof typeof cardVariants.variants.border;
191
+ rounded?: keyof typeof cardVariants.variants.rounded;
192
+ shadow?: keyof typeof cardVariants.variants.shadow;
193
+ titleWeight?: keyof typeof cardTitleVariants.variants.weight;
194
+ };
195
+ type CustomCardProps = {
196
+ custom: Snippet;
197
+ children?: never;
198
+ title?: never;
199
+ };
200
+ type CardWithChildrenProps = {
201
+ children: Snippet;
202
+ custom?: never;
203
+ title?: string;
204
+ };
205
+ export type CardProps = BaseCardProps & (CardWithChildrenProps | CustomCardProps);
206
+ declare const Card: import("svelte").Component<CardProps, {}, "">;
207
+ type Card = ReturnType<typeof Card>;
208
+ export default Card;
@@ -0,0 +1 @@
1
+ export { default as Card, type CardProps } from './Card.svelte';
@@ -0,0 +1 @@
1
+ export { default as Card } from './Card.svelte';
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@makolabs/ripple",
3
+ "version": "0.0.1-dev",
4
+ "description": "Simple Svelte 5 powered component library ✨",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/makolabsai/mako-ui-components.git"
8
+ },
9
+ "scripts": {
10
+ "dev": "vite dev",
11
+ "build": "vite build && npm run prepack",
12
+ "preview": "vite preview",
13
+ "prepare": "svelte-kit sync || echo ''",
14
+ "prepack": "svelte-kit sync && svelte-package && publint",
15
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
16
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
17
+ "format": "prettier --write .",
18
+ "lint": "prettier --check . && eslint .",
19
+ "test:unit": "vitest",
20
+ "test": "npm run test:unit -- --run && npm run test:e2e",
21
+ "test:e2e": "playwright test"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "!dist/**/*.test.*",
26
+ "!dist/**/*.spec.*"
27
+ ],
28
+ "sideEffects": [
29
+ "**/*.css"
30
+ ],
31
+ "svelte": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "type": "module",
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "svelte": "./dist/index.js"
38
+ }
39
+ },
40
+ "peerDependencies": {
41
+ "svelte": "^5.0.0"
42
+ },
43
+ "devDependencies": {
44
+ "@eslint/compat": "^1.2.5",
45
+ "@eslint/js": "^9.18.0",
46
+ "@playwright/test": "^1.49.1",
47
+ "@sveltejs/adapter-cloudflare": "^5.0.1",
48
+ "@sveltejs/kit": "^2.16.0",
49
+ "@sveltejs/package": "^2.0.0",
50
+ "@sveltejs/vite-plugin-svelte": "^5.0.0",
51
+ "@tailwindcss/vite": "^4.0.0",
52
+ "@testing-library/jest-dom": "^6.6.3",
53
+ "@testing-library/svelte": "^5.2.4",
54
+ "eslint": "^9.18.0",
55
+ "eslint-config-prettier": "^10.0.1",
56
+ "eslint-plugin-svelte": "^3.0.0",
57
+ "globals": "^16.0.0",
58
+ "jsdom": "^26.0.0",
59
+ "prettier": "^3.4.2",
60
+ "prettier-plugin-svelte": "^3.3.3",
61
+ "prettier-plugin-tailwindcss": "^0.6.11",
62
+ "publint": "^0.3.2",
63
+ "svelte": "^5.0.0",
64
+ "svelte-check": "^4.0.0",
65
+ "tailwindcss": "^4.0.0",
66
+ "typescript": "^5.0.0",
67
+ "typescript-eslint": "^8.20.0",
68
+ "vite": "^6.0.0",
69
+ "vitest": "^3.0.0"
70
+ },
71
+ "keywords": [
72
+ "svelte"
73
+ ],
74
+ "dependencies": {
75
+ "tailwind-merge": "^3.0.2",
76
+ "tailwind-variants": "^1.0.0"
77
+ }
78
+ }