zabi-components 3.0.2 → 4.0.2
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 +118 -28
- package/dist/CodeBlock-pT5-FgZd.js +431 -0
- package/dist/ContactForm-CHI_jeFY.js +580 -0
- package/dist/FeatureCard-iBFGbgVE.js +656 -0
- package/dist/Navigation-BOT-UHg0.js +104 -0
- package/dist/ThemeToggle-BlNPkAQy.js +48 -0
- package/dist/atoms/index.js +16 -13
- package/dist/index/index.js +55 -39
- package/dist/molecules/index.js +11 -566
- package/dist/organisms/index.js +1 -1
- package/dist/ssr-safe-bsWGK4V4.js +2232 -0
- package/dist/zabi-components.css +1 -1
- package/package.json +3 -3
- package/dist/Navigation-BxP-osMQ.js +0 -78
- package/dist/OptimizedImage-Dio4ZB9h.js +0 -593
- package/dist/Textarea-DP1BihDh.js +0 -259
- package/dist/ThemeToggle-Cm25ThjX.js +0 -42
- package/dist/props-B4BdFk2B.js +0 -2339
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Zabi Components
|
|
2
2
|
|
|
3
|
-
A clean, minimal Svelte component library built with TypeScript and Tailwind CSS. **Less is more** - focused on essential components that just work.
|
|
3
|
+
A clean, minimal Svelte 5 component library built with TypeScript and Tailwind CSS. **Less is more** - focused on essential components that just work.
|
|
4
|
+
|
|
5
|
+
> **⚠️ Svelte 5 Required**: This library uses Svelte 5 runes syntax (`$props`, `$derived`, `$state`). Make sure you're using Svelte 5.38.10 or later.
|
|
4
6
|
|
|
5
7
|
## Philosophy
|
|
6
8
|
|
|
@@ -20,6 +22,8 @@ A clean, minimal Svelte component library built with TypeScript and Tailwind CSS
|
|
|
20
22
|
- 🚀 **Modern CSS** - CSS-only positioning, animations, and interactions
|
|
21
23
|
- ⚡ **Lightweight** - 60-80% less code than traditional component libraries
|
|
22
24
|
- 🎭 **Emoji Icons** - Simple emoji-based icons instead of complex SVG libraries
|
|
25
|
+
- 🛡️ **SSR Safe** - 100% server-side rendering compatible with zero runtime errors
|
|
26
|
+
- 🔄 **SvelteKit Ready** - Full SvelteKit integration with proper hydration
|
|
23
27
|
|
|
24
28
|
## Installation
|
|
25
29
|
|
|
@@ -32,7 +36,7 @@ npm install zabi-components
|
|
|
32
36
|
Make sure you have the required peer dependencies installed:
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
|
-
npm install svelte@^
|
|
39
|
+
npm install svelte@^5.38.10
|
|
36
40
|
npm install @sveltejs/kit@^2.0.0 # Optional, for SvelteKit projects
|
|
37
41
|
```
|
|
38
42
|
|
|
@@ -63,11 +67,11 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
63
67
|
// Clean Components - Less is More
|
|
64
68
|
import { Card, Form, Layout, Navigation, Button, Input, Textarea } from 'zabi-components';
|
|
65
69
|
|
|
66
|
-
let formData = {
|
|
70
|
+
let formData = $state({
|
|
67
71
|
name: '',
|
|
68
72
|
email: '',
|
|
69
73
|
message: '',
|
|
70
|
-
};
|
|
74
|
+
});
|
|
71
75
|
|
|
72
76
|
function handleFormSubmit(event: SubmitEvent) {
|
|
73
77
|
const formData = new FormData(event.target as HTMLFormElement);
|
|
@@ -118,7 +122,7 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
118
122
|
id="name"
|
|
119
123
|
name="name"
|
|
120
124
|
value={formData.name}
|
|
121
|
-
|
|
125
|
+
oninput={(e) => formData.name = e.target.value}
|
|
122
126
|
label="Name"
|
|
123
127
|
placeholder="Enter your name"
|
|
124
128
|
variant="default"
|
|
@@ -131,7 +135,7 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
131
135
|
name="email"
|
|
132
136
|
type="email"
|
|
133
137
|
value={formData.email}
|
|
134
|
-
|
|
138
|
+
oninput={(e) => formData.email = e.target.value}
|
|
135
139
|
label="Email"
|
|
136
140
|
placeholder="Enter your email"
|
|
137
141
|
variant="success"
|
|
@@ -143,7 +147,7 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
143
147
|
id="message"
|
|
144
148
|
name="message"
|
|
145
149
|
value={formData.message}
|
|
146
|
-
|
|
150
|
+
oninput={(e) => formData.message = e.target.value}
|
|
147
151
|
label="Message"
|
|
148
152
|
placeholder="Enter your message"
|
|
149
153
|
variant="default"
|
|
@@ -372,13 +376,12 @@ All components will automatically switch to their dark mode variants without any
|
|
|
372
376
|
|
|
373
377
|
```svelte
|
|
374
378
|
<Button
|
|
375
|
-
variant="primary" | "secondary" | "danger" | "success" | "
|
|
379
|
+
variant="primary" | "secondary" | "danger" | "success" | "ghost" | "brand"
|
|
376
380
|
size="sm" | "md" | "lg"
|
|
377
381
|
disabled={boolean}
|
|
378
|
-
loading={boolean}
|
|
379
382
|
type="button" | "submit" | "reset"
|
|
380
383
|
className={string}
|
|
381
|
-
|
|
384
|
+
onclick={(e) => console.log('Button clicked')}
|
|
382
385
|
>
|
|
383
386
|
Button Content
|
|
384
387
|
</Button>
|
|
@@ -388,12 +391,11 @@ All components will automatically switch to their dark mode variants without any
|
|
|
388
391
|
- `variant`: Button style variant (default: "primary")
|
|
389
392
|
- `size`: Button size (default: "md")
|
|
390
393
|
- `disabled`: Disable the button (default: false)
|
|
391
|
-
- `loading`: Show loading state (default: false)
|
|
392
394
|
- `type`: HTML button type (default: "button")
|
|
393
395
|
- `className`: Additional CSS classes
|
|
394
396
|
|
|
395
397
|
**Events:**
|
|
396
|
-
- `
|
|
398
|
+
- `onclick`: Native click event - `MouseEvent`
|
|
397
399
|
|
|
398
400
|
### Input Component
|
|
399
401
|
|
|
@@ -576,8 +578,8 @@ Zabi Components uses CSS custom properties and Tailwind CSS for easy theming. Yo
|
|
|
576
578
|
--zabi-primary-active: theme('colors.blue.800');
|
|
577
579
|
|
|
578
580
|
/* Secondary Colors */
|
|
579
|
-
--zabi-secondary: theme('colors.
|
|
580
|
-
--zabi-secondary-hover: theme('colors.
|
|
581
|
+
--zabi-secondary: theme('colors.stone.600');
|
|
582
|
+
--zabi-secondary-hover: theme('colors.stone.700');
|
|
581
583
|
|
|
582
584
|
/* Success Colors */
|
|
583
585
|
--zabi-success: theme('colors.green.600');
|
|
@@ -597,17 +599,17 @@ Zabi Components uses CSS custom properties and Tailwind CSS for easy theming. Yo
|
|
|
597
599
|
|
|
598
600
|
/* Surface Colors */
|
|
599
601
|
--zabi-surface: theme('colors.white');
|
|
600
|
-
--zabi-surface-hover: theme('colors.
|
|
602
|
+
--zabi-surface-hover: theme('colors.stone.50');
|
|
601
603
|
|
|
602
604
|
/* Border Colors */
|
|
603
|
-
--zabi-border: theme('colors.
|
|
604
|
-
--zabi-border-hover: theme('colors.
|
|
605
|
+
--zabi-border: theme('colors.stone.300');
|
|
606
|
+
--zabi-border-hover: theme('colors.stone.400');
|
|
605
607
|
--zabi-border-focus: theme('colors.blue.500');
|
|
606
608
|
|
|
607
609
|
/* Text Colors */
|
|
608
|
-
--zabi-text: theme('colors.
|
|
609
|
-
--zabi-text-muted: theme('colors.
|
|
610
|
-
--zabi-text-placeholder: theme('colors.
|
|
610
|
+
--zabi-text: theme('colors.stone.900');
|
|
611
|
+
--zabi-text-muted: theme('colors.stone.600');
|
|
612
|
+
--zabi-text-placeholder: theme('colors.stone.400');
|
|
611
613
|
--zabi-text-inverse: theme('colors.white');
|
|
612
614
|
}
|
|
613
615
|
```
|
|
@@ -618,11 +620,11 @@ Dark mode is automatically supported through CSS custom properties:
|
|
|
618
620
|
|
|
619
621
|
```css
|
|
620
622
|
.dark {
|
|
621
|
-
--zabi-surface: theme('colors.
|
|
622
|
-
--zabi-surface-hover: theme('colors.
|
|
623
|
-
--zabi-text: theme('colors.
|
|
624
|
-
--zabi-text-muted: theme('colors.
|
|
625
|
-
--zabi-border: theme('colors.
|
|
623
|
+
--zabi-surface: theme('colors.stone.800');
|
|
624
|
+
--zabi-surface-hover: theme('colors.stone.700');
|
|
625
|
+
--zabi-text: theme('colors.stone.200');
|
|
626
|
+
--zabi-text-muted: theme('colors.stone.500');
|
|
627
|
+
--zabi-border: theme('colors.stone.600');
|
|
626
628
|
}
|
|
627
629
|
```
|
|
628
630
|
|
|
@@ -748,6 +750,72 @@ interface InputProps {
|
|
|
748
750
|
}
|
|
749
751
|
```
|
|
750
752
|
|
|
753
|
+
## SSR Safety & SvelteKit Integration
|
|
754
|
+
|
|
755
|
+
Zabi Components is **100% SSR-safe** and fully compatible with SvelteKit's server-side rendering. All components have been thoroughly tested to eliminate runtime errors and ensure proper hydration.
|
|
756
|
+
|
|
757
|
+
### ✅ **Zero Runtime Errors**
|
|
758
|
+
|
|
759
|
+
All components are designed to work seamlessly in both server and client environments:
|
|
760
|
+
|
|
761
|
+
- **No "Cannot read properties of null" errors**
|
|
762
|
+
- **Proper hydration without mismatches**
|
|
763
|
+
- **Safe browser API access**
|
|
764
|
+
- **Consistent behavior across SSR and client**
|
|
765
|
+
|
|
766
|
+
### 🛡️ **SSR-Safe Patterns**
|
|
767
|
+
|
|
768
|
+
Components use consistent SSR-safe patterns:
|
|
769
|
+
|
|
770
|
+
```svelte
|
|
771
|
+
<script lang="ts">
|
|
772
|
+
import { onMount } from "svelte";
|
|
773
|
+
import { safeLocalStorage, safeDocument } from "zabi-components/ssr-safe";
|
|
774
|
+
|
|
775
|
+
let mounted = $state(false);
|
|
776
|
+
|
|
777
|
+
onMount(() => {
|
|
778
|
+
mounted = true;
|
|
779
|
+
// Safe browser API access after mount
|
|
780
|
+
const storage = safeLocalStorage();
|
|
781
|
+
if (storage) {
|
|
782
|
+
// Use localStorage safely
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
</script>
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
### 🔄 **SvelteKit Integration**
|
|
789
|
+
|
|
790
|
+
Perfect integration with SvelteKit features:
|
|
791
|
+
|
|
792
|
+
```svelte
|
|
793
|
+
<script lang="ts">
|
|
794
|
+
import { goto } from '$app/navigation';
|
|
795
|
+
import { Button } from 'zabi-components';
|
|
796
|
+
</script>
|
|
797
|
+
|
|
798
|
+
<!-- SSR-safe navigation -->
|
|
799
|
+
<Button onclick={() => goto('/about')}>
|
|
800
|
+
Go to About
|
|
801
|
+
</Button>
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### 🎯 **Key SSR Features**
|
|
805
|
+
|
|
806
|
+
- **Safe ID Generation**: Prevents hydration mismatches
|
|
807
|
+
- **Browser API Guards**: All browser APIs are safely accessed
|
|
808
|
+
- **Consistent State**: Server and client state remain synchronized
|
|
809
|
+
- **Theme Persistence**: Dark mode works correctly on first load
|
|
810
|
+
- **Form Stability**: Input IDs remain consistent across hydration
|
|
811
|
+
|
|
812
|
+
### 📋 **SSR Best Practices**
|
|
813
|
+
|
|
814
|
+
1. **Use SvelteKit Navigation**: Always use `goto()` instead of `window.location.href`
|
|
815
|
+
2. **Safe Browser Access**: Use provided SSR-safe utilities
|
|
816
|
+
3. **Consistent IDs**: Let components handle ID generation internally
|
|
817
|
+
4. **Theme Loading**: Components handle theme loading automatically
|
|
818
|
+
|
|
751
819
|
## Advanced Usage
|
|
752
820
|
|
|
753
821
|
### Custom Styling
|
|
@@ -865,7 +933,29 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
865
933
|
|
|
866
934
|
## Changelog
|
|
867
935
|
|
|
868
|
-
###
|
|
936
|
+
### v4.0.0 (Latest) - "Svelte 5 Runes" Edition
|
|
937
|
+
|
|
938
|
+
#### 🚀 **MAJOR UPDATE** - Svelte 5 Migration
|
|
939
|
+
|
|
940
|
+
This version migrates to Svelte 5 with runes syntax for better performance and developer experience.
|
|
941
|
+
|
|
942
|
+
#### ✅ **What's New**
|
|
943
|
+
- **Svelte 5 Runes**: All components now use `$props`, `$derived`, and `$state`
|
|
944
|
+
- **Better Performance**: Improved reactivity and reduced bundle size
|
|
945
|
+
- **Enhanced TypeScript**: Better type inference and safety
|
|
946
|
+
- **Modern Syntax**: Cleaner, more intuitive component APIs
|
|
947
|
+
|
|
948
|
+
#### 🔄 **Migration Required**
|
|
949
|
+
- **Svelte Version**: Requires Svelte 5.38.10 or later
|
|
950
|
+
- **Syntax Updates**: Components now use runes syntax
|
|
951
|
+
- **Event Handling**: Updated to use `oninput`, `onclick` instead of `on:input`, `on:click`
|
|
952
|
+
|
|
953
|
+
#### 📋 **Breaking Changes**
|
|
954
|
+
1. **Svelte Version**: Must upgrade to Svelte 5.38.10+
|
|
955
|
+
2. **Event Syntax**: Use `oninput`, `onclick` instead of `on:input`, `on:click`
|
|
956
|
+
3. **Component Props**: All components use Svelte 5 runes syntax
|
|
957
|
+
|
|
958
|
+
### v2.1.0 - "Cross-Framework Compatible" Edition
|
|
869
959
|
|
|
870
960
|
#### 🚀 **MAJOR BREAKING CHANGES** - Event Handling Overhaul
|
|
871
961
|
|
|
@@ -897,7 +987,7 @@ See the [Migration Guide](#migration-from-previous-versions) above for detailed
|
|
|
897
987
|
### Prerequisites
|
|
898
988
|
- Node.js 18+
|
|
899
989
|
- npm or yarn
|
|
900
|
-
- Svelte
|
|
990
|
+
- Svelte 5.38.10+ or SvelteKit 2+
|
|
901
991
|
|
|
902
992
|
### Local Development
|
|
903
993
|
```bash
|
|
@@ -984,7 +1074,7 @@ npm install zabi-components@latest
|
|
|
984
1074
|
If you encounter runtime errors, ensure you have the correct peer dependencies:
|
|
985
1075
|
|
|
986
1076
|
```bash
|
|
987
|
-
npm install svelte@^
|
|
1077
|
+
npm install svelte@^5.38.10 @sveltejs/kit@^2.0.0
|
|
988
1078
|
```
|
|
989
1079
|
|
|
990
1080
|
### Migration from Previous Versions
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import { z as P, H as W, I as X, J as Y, K as Z, L as A, M as $, p as t, f as k, c as V, y as ee, d as x, e as F, h as H, r as T, g as n, N as y, B as ae, k as h, s as D, l as K, i as I, j as q, A as N, F as E, O, G, C as J, P as te, x as re, Q } from "./ssr-safe-bsWGK4V4.js";
|
|
2
|
+
import { onMount as R } from "svelte";
|
|
3
|
+
function oe(r, e, a = !1, o = !1, d = !1) {
|
|
4
|
+
var g = r, u = "";
|
|
5
|
+
P(() => {
|
|
6
|
+
var s = (
|
|
7
|
+
/** @type {Effect} */
|
|
8
|
+
W
|
|
9
|
+
);
|
|
10
|
+
if (u !== (u = e() ?? "") && (s.nodes_start !== null && (X(
|
|
11
|
+
s.nodes_start,
|
|
12
|
+
/** @type {TemplateNode} */
|
|
13
|
+
s.nodes_end
|
|
14
|
+
), s.nodes_start = s.nodes_end = null), u !== "")) {
|
|
15
|
+
var i = u + "";
|
|
16
|
+
a ? i = `<svg>${i}</svg>` : o && (i = `<math>${i}</math>`);
|
|
17
|
+
var l = Y(i);
|
|
18
|
+
if ((a || o) && (l = /** @type {Element} */
|
|
19
|
+
A(l)), Z(
|
|
20
|
+
/** @type {TemplateNode} */
|
|
21
|
+
A(l),
|
|
22
|
+
/** @type {TemplateNode} */
|
|
23
|
+
l.lastChild
|
|
24
|
+
), a || o)
|
|
25
|
+
for (; A(l); )
|
|
26
|
+
g.before(
|
|
27
|
+
/** @type {Node} */
|
|
28
|
+
A(l)
|
|
29
|
+
);
|
|
30
|
+
else
|
|
31
|
+
g.before(l);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function se(r, e) {
|
|
36
|
+
$(() => {
|
|
37
|
+
var a = r.getRootNode(), o = (
|
|
38
|
+
/** @type {ShadowRoot} */
|
|
39
|
+
a.host ? (
|
|
40
|
+
/** @type {ShadowRoot} */
|
|
41
|
+
a
|
|
42
|
+
) : (
|
|
43
|
+
/** @type {Document} */
|
|
44
|
+
a.head ?? /** @type {Document} */
|
|
45
|
+
a.ownerDocument.head
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
if (!o.querySelector("#" + e.hash)) {
|
|
49
|
+
const d = document.createElement("style");
|
|
50
|
+
d.id = e.hash, d.textContent = e.code, o.appendChild(d);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
var le = k("<button><!></button>");
|
|
55
|
+
function we(r, e) {
|
|
56
|
+
H(e, !0);
|
|
57
|
+
let a = t(e, "variant", 3, "primary"), o = t(e, "size", 3, "md"), d = t(e, "disabled", 3, !1), g = t(e, "type", 3, "button"), u = t(e, "className", 3, ""), s = T(e, [
|
|
58
|
+
"$$slots",
|
|
59
|
+
"$$events",
|
|
60
|
+
"$$legacy",
|
|
61
|
+
"variant",
|
|
62
|
+
"size",
|
|
63
|
+
"disabled",
|
|
64
|
+
"type",
|
|
65
|
+
"className",
|
|
66
|
+
"children"
|
|
67
|
+
]), i = y(() => ({
|
|
68
|
+
sm: "px-3 py-1.5 text-sm font-medium",
|
|
69
|
+
md: "px-4 py-2 text-sm font-medium",
|
|
70
|
+
lg: "px-6 py-3 text-base font-semibold"
|
|
71
|
+
})), l = y(() => ({
|
|
72
|
+
primary: "bg-gray-100 text-white hover:bg-blue-700 active:bg-blue-800 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:bg-blue-400",
|
|
73
|
+
secondary: "bg-gray-600 text-white hover:bg-gray-700 active:bg-gray-800 focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:bg-gray-400",
|
|
74
|
+
danger: "bg-red-600 text-white hover:bg-red-700 active:bg-red-800 focus:ring-2 focus:ring-red-500 focus:ring-offset-2 disabled:bg-red-400",
|
|
75
|
+
success: "bg-green-600 text-white hover:bg-green-700 active:bg-green-800 focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:bg-green-400",
|
|
76
|
+
ghost: "bg-transparent text-gray-700 hover:bg-gray-100 active:bg-gray-200 focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:text-gray-400",
|
|
77
|
+
brand: "bg-purple-600 text-white hover:bg-purple-700 active:bg-purple-800 focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 disabled:bg-purple-400"
|
|
78
|
+
})), p = y(() => [
|
|
79
|
+
"inline-flex items-center justify-center rounded-md transition-all duration-200",
|
|
80
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none",
|
|
81
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
82
|
+
"active:scale-95 transform-gpu",
|
|
83
|
+
"shadow-sm hover:shadow-md",
|
|
84
|
+
n(i)[o()],
|
|
85
|
+
n(l)[a()],
|
|
86
|
+
u()
|
|
87
|
+
].filter(Boolean).join(" "));
|
|
88
|
+
var c = le();
|
|
89
|
+
V(c, () => ({
|
|
90
|
+
type: g(),
|
|
91
|
+
class: n(p),
|
|
92
|
+
disabled: d(),
|
|
93
|
+
...s
|
|
94
|
+
}));
|
|
95
|
+
var w = h(c);
|
|
96
|
+
ee(w, () => e.children ?? ae), x(r, c), F();
|
|
97
|
+
}
|
|
98
|
+
function U(r) {
|
|
99
|
+
const e = {
|
|
100
|
+
default: "border-gray-300 focus:border-blue-500 focus:ring-blue-500",
|
|
101
|
+
success: "border-green-300 focus:border-green-500 focus:ring-green-500",
|
|
102
|
+
warning: "border-yellow-300 focus:border-yellow-500 focus:ring-yellow-500",
|
|
103
|
+
error: "border-red-300 focus:border-red-500 focus:ring-red-500",
|
|
104
|
+
info: "border-blue-300 focus:border-blue-500 focus:ring-blue-500"
|
|
105
|
+
};
|
|
106
|
+
return e[r] || e.default;
|
|
107
|
+
}
|
|
108
|
+
function _e(r) {
|
|
109
|
+
const e = {
|
|
110
|
+
default: "border-gray-200 bg-white",
|
|
111
|
+
success: "border-green-200 bg-green-50",
|
|
112
|
+
warning: "border-yellow-200 bg-yellow-50",
|
|
113
|
+
error: "border-red-200 bg-red-50",
|
|
114
|
+
info: "border-blue-200 bg-blue-50"
|
|
115
|
+
};
|
|
116
|
+
return e[r] || e.default;
|
|
117
|
+
}
|
|
118
|
+
function S(r, e) {
|
|
119
|
+
var o;
|
|
120
|
+
const a = {
|
|
121
|
+
default: {
|
|
122
|
+
border: "border-gray-300",
|
|
123
|
+
text: "text-gray-900",
|
|
124
|
+
bg: "bg-white"
|
|
125
|
+
},
|
|
126
|
+
success: {
|
|
127
|
+
border: "border-green-300",
|
|
128
|
+
text: "text-green-900",
|
|
129
|
+
bg: "bg-green-50"
|
|
130
|
+
},
|
|
131
|
+
warning: {
|
|
132
|
+
border: "border-yellow-300",
|
|
133
|
+
text: "text-yellow-900",
|
|
134
|
+
bg: "bg-yellow-50"
|
|
135
|
+
},
|
|
136
|
+
error: {
|
|
137
|
+
border: "border-red-300",
|
|
138
|
+
text: "text-red-900",
|
|
139
|
+
bg: "bg-red-50"
|
|
140
|
+
},
|
|
141
|
+
info: {
|
|
142
|
+
border: "border-blue-300",
|
|
143
|
+
text: "text-blue-900",
|
|
144
|
+
bg: "bg-blue-50"
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
return ((o = a[r]) == null ? void 0 : o[e]) || a.default[e];
|
|
148
|
+
}
|
|
149
|
+
function ke(r) {
|
|
150
|
+
return {
|
|
151
|
+
border: S(r, "border"),
|
|
152
|
+
text: S(r, "text"),
|
|
153
|
+
bg: S(r, "bg")
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function Ce(r, e) {
|
|
157
|
+
return r.reduce((a, o) => (a[o] = `${e}-${o}`, a), {});
|
|
158
|
+
}
|
|
159
|
+
var ne = k("<label> </label>"), ie = k("<div><!> <input/></div>");
|
|
160
|
+
function ze(r, e) {
|
|
161
|
+
H(e, !0);
|
|
162
|
+
let a = t(e, "value", 7, ""), o = t(e, "type", 3, "text"), d = t(e, "name", 3, ""), g = t(e, "label", 3, ""), u = t(e, "placeholder", 3, ""), s = t(e, "disabled", 3, !1), i = t(e, "size", 3, "md"), l = t(e, "variant", 3, "default"), p = T(e, [
|
|
163
|
+
"$$slots",
|
|
164
|
+
"$$events",
|
|
165
|
+
"$$legacy",
|
|
166
|
+
"value",
|
|
167
|
+
"type",
|
|
168
|
+
"name",
|
|
169
|
+
"label",
|
|
170
|
+
"placeholder",
|
|
171
|
+
"disabled",
|
|
172
|
+
"size",
|
|
173
|
+
"variant",
|
|
174
|
+
"oninput"
|
|
175
|
+
]), c = q("");
|
|
176
|
+
R(() => {
|
|
177
|
+
D(c, K("input"), !0);
|
|
178
|
+
});
|
|
179
|
+
let w = y(() => ({
|
|
180
|
+
sm: "px-3 py-1.5 text-sm",
|
|
181
|
+
md: "px-4 py-2 text-sm",
|
|
182
|
+
lg: "px-5 py-3 text-base"
|
|
183
|
+
})), C = y(() => U(l())), b = y(() => [
|
|
184
|
+
"w-full rounded-md transition-colors duration-200",
|
|
185
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
|
|
186
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-surface-disabled",
|
|
187
|
+
n(w)[i()],
|
|
188
|
+
n(C)
|
|
189
|
+
].join(" ")), f = y(() => "block text-sm font-medium text-primary mb-1");
|
|
190
|
+
function z(v) {
|
|
191
|
+
const m = v.target;
|
|
192
|
+
a(m.value), e.oninput && e.oninput(v);
|
|
193
|
+
}
|
|
194
|
+
var M = ie(), j = h(M);
|
|
195
|
+
{
|
|
196
|
+
var _ = (v) => {
|
|
197
|
+
var m = ne();
|
|
198
|
+
E(m, 1, O(n(f)));
|
|
199
|
+
var L = h(m);
|
|
200
|
+
P(() => {
|
|
201
|
+
G(m, "for", n(c)), J(L, g());
|
|
202
|
+
}), x(v, m);
|
|
203
|
+
};
|
|
204
|
+
I(j, (v) => {
|
|
205
|
+
g() && v(_);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
var B = N(j, 2);
|
|
209
|
+
V(
|
|
210
|
+
B,
|
|
211
|
+
() => ({
|
|
212
|
+
id: n(c),
|
|
213
|
+
type: o(),
|
|
214
|
+
name: d(),
|
|
215
|
+
value: a(),
|
|
216
|
+
placeholder: u(),
|
|
217
|
+
disabled: s(),
|
|
218
|
+
class: n(b),
|
|
219
|
+
oninput: z,
|
|
220
|
+
...p
|
|
221
|
+
}),
|
|
222
|
+
void 0,
|
|
223
|
+
void 0,
|
|
224
|
+
void 0,
|
|
225
|
+
!0
|
|
226
|
+
), x(r, M), F();
|
|
227
|
+
}
|
|
228
|
+
var de = k("<label> </label>"), ue = k("<div><!> <textarea></textarea></div>");
|
|
229
|
+
function Me(r, e) {
|
|
230
|
+
H(e, !0);
|
|
231
|
+
let a = t(e, "value", 7, ""), o = t(e, "name", 3, ""), d = t(e, "label", 3, ""), g = t(e, "placeholder", 3, ""), u = t(e, "disabled", 3, !1), s = t(e, "rows", 3, 4), i = t(e, "size", 3, "md"), l = t(e, "variant", 3, "default"), p = T(e, [
|
|
232
|
+
"$$slots",
|
|
233
|
+
"$$events",
|
|
234
|
+
"$$legacy",
|
|
235
|
+
"value",
|
|
236
|
+
"name",
|
|
237
|
+
"label",
|
|
238
|
+
"placeholder",
|
|
239
|
+
"disabled",
|
|
240
|
+
"rows",
|
|
241
|
+
"size",
|
|
242
|
+
"variant",
|
|
243
|
+
"oninput"
|
|
244
|
+
]), c = te(typeof window < "u" ? `textarea-${Math.random().toString(36).substr(2, 9)}` : `textarea-ssr-${Date.now()}`), w = y(() => ({
|
|
245
|
+
sm: "px-3 py-1.5 text-sm",
|
|
246
|
+
md: "px-4 py-2 text-sm",
|
|
247
|
+
lg: "px-5 py-3 text-base"
|
|
248
|
+
})), C = y(() => U(l())), b = y(() => [
|
|
249
|
+
"w-full rounded-md transition-colors duration-200",
|
|
250
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
|
|
251
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-surface-disabled",
|
|
252
|
+
"resize-y",
|
|
253
|
+
n(w)[i()],
|
|
254
|
+
n(C)
|
|
255
|
+
].join(" ")), f = y(() => "block text-sm font-medium text-primary mb-1");
|
|
256
|
+
function z(v) {
|
|
257
|
+
const m = v.target;
|
|
258
|
+
a(m.value), e.oninput && e.oninput(v);
|
|
259
|
+
}
|
|
260
|
+
var M = ue(), j = h(M);
|
|
261
|
+
{
|
|
262
|
+
var _ = (v) => {
|
|
263
|
+
var m = de();
|
|
264
|
+
E(m, 1, O(n(f)));
|
|
265
|
+
var L = h(m);
|
|
266
|
+
P(() => {
|
|
267
|
+
G(m, "for", c), J(L, d());
|
|
268
|
+
}), x(v, m);
|
|
269
|
+
};
|
|
270
|
+
I(j, (v) => {
|
|
271
|
+
d() && v(_);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
var B = N(j, 2);
|
|
275
|
+
V(B, () => ({
|
|
276
|
+
id: c,
|
|
277
|
+
name: o(),
|
|
278
|
+
value: a(),
|
|
279
|
+
placeholder: g(),
|
|
280
|
+
disabled: u(),
|
|
281
|
+
rows: s(),
|
|
282
|
+
class: n(b),
|
|
283
|
+
oninput: z,
|
|
284
|
+
...p
|
|
285
|
+
})), x(r, M), F();
|
|
286
|
+
}
|
|
287
|
+
var ce = k('<label class="text-sm font-medium cursor-pointer"> </label>'), ge = k('<div class="flex items-center gap-2"><input/> <!></div>');
|
|
288
|
+
function je(r, e) {
|
|
289
|
+
H(e, !0);
|
|
290
|
+
let a = t(e, "checked", 7, !1), o = t(e, "name", 3, ""), d = t(e, "disabled", 3, !1), g = t(e, "label", 3, ""), u = T(e, [
|
|
291
|
+
"$$slots",
|
|
292
|
+
"$$events",
|
|
293
|
+
"$$legacy",
|
|
294
|
+
"checked",
|
|
295
|
+
"name",
|
|
296
|
+
"disabled",
|
|
297
|
+
"label"
|
|
298
|
+
]), s = q("");
|
|
299
|
+
R(() => {
|
|
300
|
+
D(s, K("checkbox"), !0);
|
|
301
|
+
});
|
|
302
|
+
let i = y(() => [
|
|
303
|
+
"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded",
|
|
304
|
+
"focus:ring-blue-500 focus:ring-2",
|
|
305
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
306
|
+
].join(" "));
|
|
307
|
+
function l(b) {
|
|
308
|
+
const f = b.target;
|
|
309
|
+
a(f.checked);
|
|
310
|
+
}
|
|
311
|
+
var p = ge(), c = h(p);
|
|
312
|
+
V(
|
|
313
|
+
c,
|
|
314
|
+
() => ({
|
|
315
|
+
type: "checkbox",
|
|
316
|
+
id: n(s),
|
|
317
|
+
name: o(),
|
|
318
|
+
checked: a(),
|
|
319
|
+
disabled: d(),
|
|
320
|
+
class: n(i),
|
|
321
|
+
onchange: l,
|
|
322
|
+
...u
|
|
323
|
+
}),
|
|
324
|
+
void 0,
|
|
325
|
+
void 0,
|
|
326
|
+
void 0,
|
|
327
|
+
!0
|
|
328
|
+
);
|
|
329
|
+
var w = N(c, 2);
|
|
330
|
+
{
|
|
331
|
+
var C = (b) => {
|
|
332
|
+
var f = ce(), z = h(f);
|
|
333
|
+
P(() => {
|
|
334
|
+
G(f, "for", n(s)), J(z, g());
|
|
335
|
+
}), x(b, f);
|
|
336
|
+
};
|
|
337
|
+
I(w, (b) => {
|
|
338
|
+
g() && b(C);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
x(r, p), F();
|
|
342
|
+
}
|
|
343
|
+
async function be(r, e, a) {
|
|
344
|
+
try {
|
|
345
|
+
await navigator.clipboard.writeText(e.code), D(a, !0), setTimeout(
|
|
346
|
+
() => {
|
|
347
|
+
D(a, !1);
|
|
348
|
+
},
|
|
349
|
+
2e3
|
|
350
|
+
);
|
|
351
|
+
} catch (o) {
|
|
352
|
+
console.error("Failed to copy code:", o);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
var fe = Q('<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"></path></svg> Copied!', 1), ve = Q('<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg> Copy', 1), me = k('<button class="flex items-center gap-2 px-3 py-1 text-xs text-gray-300 hover:text-white hover:bg-gray-700 rounded transition-colors duration-200" aria-label="Copy code to clipboard"><!></button>'), he = k('<div><div class="flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700"><div class="flex items-center gap-2"><div class="w-3 h-3 rounded-full bg-red-500"></div> <div class="w-3 h-3 rounded-full bg-yellow-500"></div> <div class="w-3 h-3 rounded-full bg-green-500"></div></div> <!></div> <pre class="p-4 overflow-x-auto text-sm text-gray-100 leading-relaxed"><code><!></code></pre></div>');
|
|
356
|
+
const ye = {
|
|
357
|
+
hash: "svelte-1dmazsz",
|
|
358
|
+
code: `.code-block.svelte-1dmazsz {font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}
|
|
359
|
+
|
|
360
|
+
/* Basic syntax highlighting for common languages */.language-svelte .token.tag,
|
|
361
|
+
.language-html .token.tag {color:#f92672;}.language-svelte .token.attr-name,
|
|
362
|
+
.language-html .token.attr-name {color:#a6e22e;}.language-svelte .token.attr-value,
|
|
363
|
+
.language-html .token.attr-value {color:#e6db74;}.language-javascript .token.keyword,
|
|
364
|
+
.language-typescript .token.keyword {color:#66d9ef;}.language-javascript .token.string,
|
|
365
|
+
.language-typescript .token.string {color:#e6db74;}.language-javascript .token.function,
|
|
366
|
+
.language-typescript .token.function {color:#a6e22e;}`
|
|
367
|
+
};
|
|
368
|
+
function Be(r, e) {
|
|
369
|
+
se(r, ye);
|
|
370
|
+
let a = t(e, "language", 3, "svelte"), o = t(e, "className", 3, ""), d = t(e, "showCopyButton", 3, !0), g = T(e, [
|
|
371
|
+
"$$slots",
|
|
372
|
+
"$$events",
|
|
373
|
+
"$$legacy",
|
|
374
|
+
"code",
|
|
375
|
+
"language",
|
|
376
|
+
"className",
|
|
377
|
+
"showCopyButton"
|
|
378
|
+
]), u = q(!1);
|
|
379
|
+
var s = he();
|
|
380
|
+
V(
|
|
381
|
+
s,
|
|
382
|
+
() => ({
|
|
383
|
+
class: `code-block relative bg-gray-900 rounded-lg overflow-hidden ${o() ?? ""}`,
|
|
384
|
+
...g
|
|
385
|
+
}),
|
|
386
|
+
void 0,
|
|
387
|
+
void 0,
|
|
388
|
+
"svelte-1dmazsz"
|
|
389
|
+
);
|
|
390
|
+
var i = h(s), l = N(h(i), 2);
|
|
391
|
+
{
|
|
392
|
+
var p = (b) => {
|
|
393
|
+
var f = me();
|
|
394
|
+
f.__click = [be, e, u];
|
|
395
|
+
var z = h(f);
|
|
396
|
+
{
|
|
397
|
+
var M = (_) => {
|
|
398
|
+
var B = fe();
|
|
399
|
+
x(_, B);
|
|
400
|
+
}, j = (_) => {
|
|
401
|
+
var B = ve();
|
|
402
|
+
x(_, B);
|
|
403
|
+
};
|
|
404
|
+
I(z, (_) => {
|
|
405
|
+
n(u) ? _(M) : _(j, !1);
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
x(b, f);
|
|
409
|
+
};
|
|
410
|
+
I(l, (b) => {
|
|
411
|
+
d() && b(p);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
var c = N(i, 2), w = h(c), C = h(w);
|
|
415
|
+
oe(C, () => e.code), P(() => E(w, 1, `language-${a() ?? ""}`, "svelte-1dmazsz")), x(r, s);
|
|
416
|
+
}
|
|
417
|
+
re(["click"]);
|
|
418
|
+
export {
|
|
419
|
+
we as B,
|
|
420
|
+
je as C,
|
|
421
|
+
ze as I,
|
|
422
|
+
Me as T,
|
|
423
|
+
Be as a,
|
|
424
|
+
_e as b,
|
|
425
|
+
S as c,
|
|
426
|
+
ke as d,
|
|
427
|
+
Ce as e,
|
|
428
|
+
se as f,
|
|
429
|
+
U as g,
|
|
430
|
+
oe as h
|
|
431
|
+
};
|