zabi-components 3.0.1 → 4.0.0
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 +50 -28
- package/dist/CodeBlock-Bbv6JfD2.js +422 -0
- package/dist/ThemeToggle-Z2Ndc0if.js +42 -0
- package/dist/atoms/index.js +662 -18
- package/dist/index/index.js +45 -41
- package/dist/molecules/index.js +403 -391
- package/dist/organisms/index.js +102 -3
- package/dist/props-BKbHJRuR.js +2213 -0
- package/dist/zabi-components.css +1 -1
- package/package.json +3 -4
- package/dist/Navigation-A1Skrbs5.js +0 -81
- package/dist/OptimizedImage-CWv4Xphx.js +0 -593
- package/dist/Textarea-B0T7x4TT.js +0 -259
- package/dist/ThemeToggle-2HEU5v1Q.js +0 -42
- package/dist/props-DyILkQVH.js +0 -2340
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
|
|
|
@@ -32,7 +34,7 @@ npm install zabi-components
|
|
|
32
34
|
Make sure you have the required peer dependencies installed:
|
|
33
35
|
|
|
34
36
|
```bash
|
|
35
|
-
npm install svelte@^
|
|
37
|
+
npm install svelte@^5.38.10
|
|
36
38
|
npm install @sveltejs/kit@^2.0.0 # Optional, for SvelteKit projects
|
|
37
39
|
```
|
|
38
40
|
|
|
@@ -63,11 +65,11 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
63
65
|
// Clean Components - Less is More
|
|
64
66
|
import { Card, Form, Layout, Navigation, Button, Input, Textarea } from 'zabi-components';
|
|
65
67
|
|
|
66
|
-
let formData = {
|
|
68
|
+
let formData = $state({
|
|
67
69
|
name: '',
|
|
68
70
|
email: '',
|
|
69
71
|
message: '',
|
|
70
|
-
};
|
|
72
|
+
});
|
|
71
73
|
|
|
72
74
|
function handleFormSubmit(event: SubmitEvent) {
|
|
73
75
|
const formData = new FormData(event.target as HTMLFormElement);
|
|
@@ -118,7 +120,7 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
118
120
|
id="name"
|
|
119
121
|
name="name"
|
|
120
122
|
value={formData.name}
|
|
121
|
-
|
|
123
|
+
oninput={(e) => formData.name = e.target.value}
|
|
122
124
|
label="Name"
|
|
123
125
|
placeholder="Enter your name"
|
|
124
126
|
variant="default"
|
|
@@ -131,7 +133,7 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
131
133
|
name="email"
|
|
132
134
|
type="email"
|
|
133
135
|
value={formData.email}
|
|
134
|
-
|
|
136
|
+
oninput={(e) => formData.email = e.target.value}
|
|
135
137
|
label="Email"
|
|
136
138
|
placeholder="Enter your email"
|
|
137
139
|
variant="success"
|
|
@@ -143,7 +145,7 @@ import type { ButtonEvents, InputEvents } from 'zabi-components/types';
|
|
|
143
145
|
id="message"
|
|
144
146
|
name="message"
|
|
145
147
|
value={formData.message}
|
|
146
|
-
|
|
148
|
+
oninput={(e) => formData.message = e.target.value}
|
|
147
149
|
label="Message"
|
|
148
150
|
placeholder="Enter your message"
|
|
149
151
|
variant="default"
|
|
@@ -372,13 +374,12 @@ All components will automatically switch to their dark mode variants without any
|
|
|
372
374
|
|
|
373
375
|
```svelte
|
|
374
376
|
<Button
|
|
375
|
-
variant="primary" | "secondary" | "danger" | "success" | "
|
|
377
|
+
variant="primary" | "secondary" | "danger" | "success" | "ghost" | "brand"
|
|
376
378
|
size="sm" | "md" | "lg"
|
|
377
379
|
disabled={boolean}
|
|
378
|
-
loading={boolean}
|
|
379
380
|
type="button" | "submit" | "reset"
|
|
380
381
|
className={string}
|
|
381
|
-
|
|
382
|
+
onclick={(e) => console.log('Button clicked')}
|
|
382
383
|
>
|
|
383
384
|
Button Content
|
|
384
385
|
</Button>
|
|
@@ -388,12 +389,11 @@ All components will automatically switch to their dark mode variants without any
|
|
|
388
389
|
- `variant`: Button style variant (default: "primary")
|
|
389
390
|
- `size`: Button size (default: "md")
|
|
390
391
|
- `disabled`: Disable the button (default: false)
|
|
391
|
-
- `loading`: Show loading state (default: false)
|
|
392
392
|
- `type`: HTML button type (default: "button")
|
|
393
393
|
- `className`: Additional CSS classes
|
|
394
394
|
|
|
395
395
|
**Events:**
|
|
396
|
-
- `
|
|
396
|
+
- `onclick`: Native click event - `MouseEvent`
|
|
397
397
|
|
|
398
398
|
### Input Component
|
|
399
399
|
|
|
@@ -576,8 +576,8 @@ Zabi Components uses CSS custom properties and Tailwind CSS for easy theming. Yo
|
|
|
576
576
|
--zabi-primary-active: theme('colors.blue.800');
|
|
577
577
|
|
|
578
578
|
/* Secondary Colors */
|
|
579
|
-
--zabi-secondary: theme('colors.
|
|
580
|
-
--zabi-secondary-hover: theme('colors.
|
|
579
|
+
--zabi-secondary: theme('colors.stone.600');
|
|
580
|
+
--zabi-secondary-hover: theme('colors.stone.700');
|
|
581
581
|
|
|
582
582
|
/* Success Colors */
|
|
583
583
|
--zabi-success: theme('colors.green.600');
|
|
@@ -597,17 +597,17 @@ Zabi Components uses CSS custom properties and Tailwind CSS for easy theming. Yo
|
|
|
597
597
|
|
|
598
598
|
/* Surface Colors */
|
|
599
599
|
--zabi-surface: theme('colors.white');
|
|
600
|
-
--zabi-surface-hover: theme('colors.
|
|
600
|
+
--zabi-surface-hover: theme('colors.stone.50');
|
|
601
601
|
|
|
602
602
|
/* Border Colors */
|
|
603
|
-
--zabi-border: theme('colors.
|
|
604
|
-
--zabi-border-hover: theme('colors.
|
|
603
|
+
--zabi-border: theme('colors.stone.300');
|
|
604
|
+
--zabi-border-hover: theme('colors.stone.400');
|
|
605
605
|
--zabi-border-focus: theme('colors.blue.500');
|
|
606
606
|
|
|
607
607
|
/* Text Colors */
|
|
608
|
-
--zabi-text: theme('colors.
|
|
609
|
-
--zabi-text-muted: theme('colors.
|
|
610
|
-
--zabi-text-placeholder: theme('colors.
|
|
608
|
+
--zabi-text: theme('colors.stone.900');
|
|
609
|
+
--zabi-text-muted: theme('colors.stone.600');
|
|
610
|
+
--zabi-text-placeholder: theme('colors.stone.400');
|
|
611
611
|
--zabi-text-inverse: theme('colors.white');
|
|
612
612
|
}
|
|
613
613
|
```
|
|
@@ -618,11 +618,11 @@ Dark mode is automatically supported through CSS custom properties:
|
|
|
618
618
|
|
|
619
619
|
```css
|
|
620
620
|
.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.
|
|
621
|
+
--zabi-surface: theme('colors.stone.800');
|
|
622
|
+
--zabi-surface-hover: theme('colors.stone.700');
|
|
623
|
+
--zabi-text: theme('colors.stone.200');
|
|
624
|
+
--zabi-text-muted: theme('colors.stone.500');
|
|
625
|
+
--zabi-border: theme('colors.stone.600');
|
|
626
626
|
}
|
|
627
627
|
```
|
|
628
628
|
|
|
@@ -865,7 +865,29 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
865
865
|
|
|
866
866
|
## Changelog
|
|
867
867
|
|
|
868
|
-
###
|
|
868
|
+
### v4.0.0 (Latest) - "Svelte 5 Runes" Edition
|
|
869
|
+
|
|
870
|
+
#### 🚀 **MAJOR UPDATE** - Svelte 5 Migration
|
|
871
|
+
|
|
872
|
+
This version migrates to Svelte 5 with runes syntax for better performance and developer experience.
|
|
873
|
+
|
|
874
|
+
#### ✅ **What's New**
|
|
875
|
+
- **Svelte 5 Runes**: All components now use `$props`, `$derived`, and `$state`
|
|
876
|
+
- **Better Performance**: Improved reactivity and reduced bundle size
|
|
877
|
+
- **Enhanced TypeScript**: Better type inference and safety
|
|
878
|
+
- **Modern Syntax**: Cleaner, more intuitive component APIs
|
|
879
|
+
|
|
880
|
+
#### 🔄 **Migration Required**
|
|
881
|
+
- **Svelte Version**: Requires Svelte 5.38.10 or later
|
|
882
|
+
- **Syntax Updates**: Components now use runes syntax
|
|
883
|
+
- **Event Handling**: Updated to use `oninput`, `onclick` instead of `on:input`, `on:click`
|
|
884
|
+
|
|
885
|
+
#### 📋 **Breaking Changes**
|
|
886
|
+
1. **Svelte Version**: Must upgrade to Svelte 5.38.10+
|
|
887
|
+
2. **Event Syntax**: Use `oninput`, `onclick` instead of `on:input`, `on:click`
|
|
888
|
+
3. **Component Props**: All components use Svelte 5 runes syntax
|
|
889
|
+
|
|
890
|
+
### v2.1.0 - "Cross-Framework Compatible" Edition
|
|
869
891
|
|
|
870
892
|
#### 🚀 **MAJOR BREAKING CHANGES** - Event Handling Overhaul
|
|
871
893
|
|
|
@@ -897,7 +919,7 @@ See the [Migration Guide](#migration-from-previous-versions) above for detailed
|
|
|
897
919
|
### Prerequisites
|
|
898
920
|
- Node.js 18+
|
|
899
921
|
- npm or yarn
|
|
900
|
-
- Svelte
|
|
922
|
+
- Svelte 5.38.10+ or SvelteKit 2+
|
|
901
923
|
|
|
902
924
|
### Local Development
|
|
903
925
|
```bash
|
|
@@ -984,7 +1006,7 @@ npm install zabi-components@latest
|
|
|
984
1006
|
If you encounter runtime errors, ensure you have the correct peer dependencies:
|
|
985
1007
|
|
|
986
1008
|
```bash
|
|
987
|
-
npm install svelte@^
|
|
1009
|
+
npm install svelte@^5.38.10 @sveltejs/kit@^2.0.0
|
|
988
1010
|
```
|
|
989
1011
|
|
|
990
1012
|
### Migration from Previous Versions
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { t as V, j as O, k as Q, l as W, m as X, n as T, o as Y, p as t, f as k, a as D, q as Z, b as x, c as S, d as q, r as P, g as m, v as y, w as $, h, x as F, i as I, y as N, z as H, A as G, B as L, C as R, D as ee, e as ae, s as U, E as J } from "./props-BKbHJRuR.js";
|
|
2
|
+
function te(r, e, a = !1, o = !1, i = !1) {
|
|
3
|
+
var u = r, d = "";
|
|
4
|
+
V(() => {
|
|
5
|
+
var s = (
|
|
6
|
+
/** @type {Effect} */
|
|
7
|
+
O
|
|
8
|
+
);
|
|
9
|
+
if (d !== (d = e() ?? "") && (s.nodes_start !== null && (Q(
|
|
10
|
+
s.nodes_start,
|
|
11
|
+
/** @type {TemplateNode} */
|
|
12
|
+
s.nodes_end
|
|
13
|
+
), s.nodes_start = s.nodes_end = null), d !== "")) {
|
|
14
|
+
var n = d + "";
|
|
15
|
+
a ? n = `<svg>${n}</svg>` : o && (n = `<math>${n}</math>`);
|
|
16
|
+
var l = W(n);
|
|
17
|
+
if ((a || o) && (l = /** @type {Element} */
|
|
18
|
+
T(l)), X(
|
|
19
|
+
/** @type {TemplateNode} */
|
|
20
|
+
T(l),
|
|
21
|
+
/** @type {TemplateNode} */
|
|
22
|
+
l.lastChild
|
|
23
|
+
), a || o)
|
|
24
|
+
for (; T(l); )
|
|
25
|
+
u.before(
|
|
26
|
+
/** @type {Node} */
|
|
27
|
+
T(l)
|
|
28
|
+
);
|
|
29
|
+
else
|
|
30
|
+
u.before(l);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function re(r, e) {
|
|
35
|
+
Y(() => {
|
|
36
|
+
var a = r.getRootNode(), o = (
|
|
37
|
+
/** @type {ShadowRoot} */
|
|
38
|
+
a.host ? (
|
|
39
|
+
/** @type {ShadowRoot} */
|
|
40
|
+
a
|
|
41
|
+
) : (
|
|
42
|
+
/** @type {Document} */
|
|
43
|
+
a.head ?? /** @type {Document} */
|
|
44
|
+
a.ownerDocument.head
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
if (!o.querySelector("#" + e.hash)) {
|
|
48
|
+
const i = document.createElement("style");
|
|
49
|
+
i.id = e.hash, i.textContent = e.code, o.appendChild(i);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
var oe = k("<button><!></button>");
|
|
54
|
+
function ye(r, e) {
|
|
55
|
+
q(e, !0);
|
|
56
|
+
let a = t(e, "variant", 3, "primary"), o = t(e, "size", 3, "md"), i = t(e, "disabled", 3, !1), u = t(e, "type", 3, "button"), d = t(e, "className", 3, ""), s = P(e, [
|
|
57
|
+
"$$slots",
|
|
58
|
+
"$$events",
|
|
59
|
+
"$$legacy",
|
|
60
|
+
"variant",
|
|
61
|
+
"size",
|
|
62
|
+
"disabled",
|
|
63
|
+
"type",
|
|
64
|
+
"className",
|
|
65
|
+
"children"
|
|
66
|
+
]), n = y(() => ({
|
|
67
|
+
sm: "px-3 py-1.5 text-sm font-medium",
|
|
68
|
+
md: "px-4 py-2 text-sm font-medium",
|
|
69
|
+
lg: "px-6 py-3 text-base font-semibold"
|
|
70
|
+
})), l = y(() => ({
|
|
71
|
+
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",
|
|
72
|
+
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",
|
|
73
|
+
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",
|
|
74
|
+
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",
|
|
75
|
+
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",
|
|
76
|
+
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"
|
|
77
|
+
})), p = y(() => [
|
|
78
|
+
"inline-flex items-center justify-center rounded-md transition-all duration-200",
|
|
79
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none",
|
|
80
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2",
|
|
81
|
+
"active:scale-95 transform-gpu",
|
|
82
|
+
"shadow-sm hover:shadow-md",
|
|
83
|
+
m(n)[o()],
|
|
84
|
+
m(l)[a()],
|
|
85
|
+
d()
|
|
86
|
+
].filter(Boolean).join(" "));
|
|
87
|
+
var c = oe();
|
|
88
|
+
D(c, () => ({
|
|
89
|
+
type: u(),
|
|
90
|
+
class: m(p),
|
|
91
|
+
disabled: i(),
|
|
92
|
+
...s
|
|
93
|
+
}));
|
|
94
|
+
var w = h(c);
|
|
95
|
+
Z(w, () => e.children ?? $), x(r, c), S();
|
|
96
|
+
}
|
|
97
|
+
function K(r) {
|
|
98
|
+
const e = {
|
|
99
|
+
default: "border-gray-300 focus:border-blue-500 focus:ring-blue-500",
|
|
100
|
+
success: "border-green-300 focus:border-green-500 focus:ring-green-500",
|
|
101
|
+
warning: "border-yellow-300 focus:border-yellow-500 focus:ring-yellow-500",
|
|
102
|
+
error: "border-red-300 focus:border-red-500 focus:ring-red-500",
|
|
103
|
+
info: "border-blue-300 focus:border-blue-500 focus:ring-blue-500"
|
|
104
|
+
};
|
|
105
|
+
return e[r] || e.default;
|
|
106
|
+
}
|
|
107
|
+
function xe(r) {
|
|
108
|
+
const e = {
|
|
109
|
+
default: "border-gray-200 bg-white",
|
|
110
|
+
success: "border-green-200 bg-green-50",
|
|
111
|
+
warning: "border-yellow-200 bg-yellow-50",
|
|
112
|
+
error: "border-red-200 bg-red-50",
|
|
113
|
+
info: "border-blue-200 bg-blue-50"
|
|
114
|
+
};
|
|
115
|
+
return e[r] || e.default;
|
|
116
|
+
}
|
|
117
|
+
function E(r, e) {
|
|
118
|
+
var o;
|
|
119
|
+
const a = {
|
|
120
|
+
default: {
|
|
121
|
+
border: "border-gray-300",
|
|
122
|
+
text: "text-gray-900",
|
|
123
|
+
bg: "bg-white"
|
|
124
|
+
},
|
|
125
|
+
success: {
|
|
126
|
+
border: "border-green-300",
|
|
127
|
+
text: "text-green-900",
|
|
128
|
+
bg: "bg-green-50"
|
|
129
|
+
},
|
|
130
|
+
warning: {
|
|
131
|
+
border: "border-yellow-300",
|
|
132
|
+
text: "text-yellow-900",
|
|
133
|
+
bg: "bg-yellow-50"
|
|
134
|
+
},
|
|
135
|
+
error: {
|
|
136
|
+
border: "border-red-300",
|
|
137
|
+
text: "text-red-900",
|
|
138
|
+
bg: "bg-red-50"
|
|
139
|
+
},
|
|
140
|
+
info: {
|
|
141
|
+
border: "border-blue-300",
|
|
142
|
+
text: "text-blue-900",
|
|
143
|
+
bg: "bg-blue-50"
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return ((o = a[r]) == null ? void 0 : o[e]) || a.default[e];
|
|
147
|
+
}
|
|
148
|
+
function pe(r) {
|
|
149
|
+
return {
|
|
150
|
+
border: E(r, "border"),
|
|
151
|
+
text: E(r, "text"),
|
|
152
|
+
bg: E(r, "bg")
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function we(r, e) {
|
|
156
|
+
return r.reduce((a, o) => (a[o] = `${e}-${o}`, a), {});
|
|
157
|
+
}
|
|
158
|
+
var se = k("<label> </label>"), le = k("<div><!> <input/></div>");
|
|
159
|
+
function _e(r, e) {
|
|
160
|
+
q(e, !0);
|
|
161
|
+
let a = t(e, "value", 7, ""), o = t(e, "type", 3, "text"), i = t(e, "name", 3, ""), u = t(e, "label", 3, ""), d = t(e, "placeholder", 3, ""), s = t(e, "disabled", 3, !1), n = t(e, "size", 3, "md"), l = t(e, "variant", 3, "default"), p = P(e, [
|
|
162
|
+
"$$slots",
|
|
163
|
+
"$$events",
|
|
164
|
+
"$$legacy",
|
|
165
|
+
"value",
|
|
166
|
+
"type",
|
|
167
|
+
"name",
|
|
168
|
+
"label",
|
|
169
|
+
"placeholder",
|
|
170
|
+
"disabled",
|
|
171
|
+
"size",
|
|
172
|
+
"variant",
|
|
173
|
+
"oninput"
|
|
174
|
+
]), c = F(typeof window < "u" ? `input-${Math.random().toString(36).substr(2, 9)}` : `input-ssr-${Date.now()}`), w = y(() => ({
|
|
175
|
+
sm: "px-3 py-1.5 text-sm",
|
|
176
|
+
md: "px-4 py-2 text-sm",
|
|
177
|
+
lg: "px-5 py-3 text-base"
|
|
178
|
+
})), C = y(() => K(l())), g = y(() => [
|
|
179
|
+
"w-full rounded-md transition-colors duration-200",
|
|
180
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
|
|
181
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-surface-disabled",
|
|
182
|
+
m(w)[n()],
|
|
183
|
+
m(C)
|
|
184
|
+
].join(" ")), b = y(() => "block text-sm font-medium text-primary mb-1");
|
|
185
|
+
function z(f) {
|
|
186
|
+
const v = f.target;
|
|
187
|
+
a(v.value), e.oninput && e.oninput(f);
|
|
188
|
+
}
|
|
189
|
+
var M = le(), j = h(M);
|
|
190
|
+
{
|
|
191
|
+
var _ = (f) => {
|
|
192
|
+
var v = se();
|
|
193
|
+
H(v, 1, G(m(b)));
|
|
194
|
+
var A = h(v);
|
|
195
|
+
V(() => {
|
|
196
|
+
L(v, "for", c), R(A, u());
|
|
197
|
+
}), x(f, v);
|
|
198
|
+
};
|
|
199
|
+
I(j, (f) => {
|
|
200
|
+
u() && f(_);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
var B = N(j, 2);
|
|
204
|
+
D(
|
|
205
|
+
B,
|
|
206
|
+
() => ({
|
|
207
|
+
id: c,
|
|
208
|
+
type: o(),
|
|
209
|
+
name: i(),
|
|
210
|
+
value: a(),
|
|
211
|
+
placeholder: d(),
|
|
212
|
+
disabled: s(),
|
|
213
|
+
class: m(g),
|
|
214
|
+
oninput: z,
|
|
215
|
+
...p
|
|
216
|
+
}),
|
|
217
|
+
void 0,
|
|
218
|
+
void 0,
|
|
219
|
+
void 0,
|
|
220
|
+
!0
|
|
221
|
+
), x(r, M), S();
|
|
222
|
+
}
|
|
223
|
+
var ne = k("<label> </label>"), ie = k("<div><!> <textarea></textarea></div>");
|
|
224
|
+
function ke(r, e) {
|
|
225
|
+
q(e, !0);
|
|
226
|
+
let a = t(e, "value", 7, ""), o = t(e, "name", 3, ""), i = t(e, "label", 3, ""), u = t(e, "placeholder", 3, ""), d = t(e, "disabled", 3, !1), s = t(e, "rows", 3, 4), n = t(e, "size", 3, "md"), l = t(e, "variant", 3, "default"), p = P(e, [
|
|
227
|
+
"$$slots",
|
|
228
|
+
"$$events",
|
|
229
|
+
"$$legacy",
|
|
230
|
+
"value",
|
|
231
|
+
"name",
|
|
232
|
+
"label",
|
|
233
|
+
"placeholder",
|
|
234
|
+
"disabled",
|
|
235
|
+
"rows",
|
|
236
|
+
"size",
|
|
237
|
+
"variant",
|
|
238
|
+
"oninput"
|
|
239
|
+
]), c = F(typeof window < "u" ? `textarea-${Math.random().toString(36).substr(2, 9)}` : `textarea-ssr-${Date.now()}`), w = y(() => ({
|
|
240
|
+
sm: "px-3 py-1.5 text-sm",
|
|
241
|
+
md: "px-4 py-2 text-sm",
|
|
242
|
+
lg: "px-5 py-3 text-base"
|
|
243
|
+
})), C = y(() => K(l())), g = y(() => [
|
|
244
|
+
"w-full rounded-md transition-colors duration-200",
|
|
245
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
|
|
246
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-surface-disabled",
|
|
247
|
+
"resize-y",
|
|
248
|
+
m(w)[n()],
|
|
249
|
+
m(C)
|
|
250
|
+
].join(" ")), b = y(() => "block text-sm font-medium text-primary mb-1");
|
|
251
|
+
function z(f) {
|
|
252
|
+
const v = f.target;
|
|
253
|
+
a(v.value), e.oninput && e.oninput(f);
|
|
254
|
+
}
|
|
255
|
+
var M = ie(), j = h(M);
|
|
256
|
+
{
|
|
257
|
+
var _ = (f) => {
|
|
258
|
+
var v = ne();
|
|
259
|
+
H(v, 1, G(m(b)));
|
|
260
|
+
var A = h(v);
|
|
261
|
+
V(() => {
|
|
262
|
+
L(v, "for", c), R(A, i());
|
|
263
|
+
}), x(f, v);
|
|
264
|
+
};
|
|
265
|
+
I(j, (f) => {
|
|
266
|
+
i() && f(_);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
var B = N(j, 2);
|
|
270
|
+
D(B, () => ({
|
|
271
|
+
id: c,
|
|
272
|
+
name: o(),
|
|
273
|
+
value: a(),
|
|
274
|
+
placeholder: u(),
|
|
275
|
+
disabled: d(),
|
|
276
|
+
rows: s(),
|
|
277
|
+
class: m(g),
|
|
278
|
+
oninput: z,
|
|
279
|
+
...p
|
|
280
|
+
})), x(r, M), S();
|
|
281
|
+
}
|
|
282
|
+
var de = k('<label class="text-sm font-medium cursor-pointer"> </label>'), ue = k('<div class="flex items-center gap-2"><input/> <!></div>');
|
|
283
|
+
function Ce(r, e) {
|
|
284
|
+
q(e, !0);
|
|
285
|
+
let a = t(e, "checked", 7, !1), o = t(e, "name", 3, ""), i = t(e, "disabled", 3, !1), u = t(e, "label", 3, ""), d = P(e, [
|
|
286
|
+
"$$slots",
|
|
287
|
+
"$$events",
|
|
288
|
+
"$$legacy",
|
|
289
|
+
"checked",
|
|
290
|
+
"name",
|
|
291
|
+
"disabled",
|
|
292
|
+
"label"
|
|
293
|
+
]), s = F(typeof window < "u" ? `checkbox-${Math.random().toString(36).substr(2, 9)}` : `checkbox-ssr-${Date.now()}`), n = y(() => [
|
|
294
|
+
"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded",
|
|
295
|
+
"focus:ring-blue-500 focus:ring-2",
|
|
296
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
297
|
+
].join(" "));
|
|
298
|
+
function l(g) {
|
|
299
|
+
const b = g.target;
|
|
300
|
+
a(b.checked);
|
|
301
|
+
}
|
|
302
|
+
var p = ue(), c = h(p);
|
|
303
|
+
D(
|
|
304
|
+
c,
|
|
305
|
+
() => ({
|
|
306
|
+
type: "checkbox",
|
|
307
|
+
id: s,
|
|
308
|
+
name: o(),
|
|
309
|
+
checked: a(),
|
|
310
|
+
disabled: i(),
|
|
311
|
+
class: m(n),
|
|
312
|
+
onchange: l,
|
|
313
|
+
...d
|
|
314
|
+
}),
|
|
315
|
+
void 0,
|
|
316
|
+
void 0,
|
|
317
|
+
void 0,
|
|
318
|
+
!0
|
|
319
|
+
);
|
|
320
|
+
var w = N(c, 2);
|
|
321
|
+
{
|
|
322
|
+
var C = (g) => {
|
|
323
|
+
var b = de(), z = h(b);
|
|
324
|
+
V(() => {
|
|
325
|
+
L(b, "for", s), R(z, u());
|
|
326
|
+
}), x(g, b);
|
|
327
|
+
};
|
|
328
|
+
I(w, (g) => {
|
|
329
|
+
u() && g(C);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
x(r, p), S();
|
|
333
|
+
}
|
|
334
|
+
async function ce(r, e, a) {
|
|
335
|
+
try {
|
|
336
|
+
await navigator.clipboard.writeText(e.code), U(a, !0), setTimeout(
|
|
337
|
+
() => {
|
|
338
|
+
U(a, !1);
|
|
339
|
+
},
|
|
340
|
+
2e3
|
|
341
|
+
);
|
|
342
|
+
} catch (o) {
|
|
343
|
+
console.error("Failed to copy code:", o);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
var ge = J('<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), be = J('<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), fe = 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>'), ve = 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>');
|
|
347
|
+
const me = {
|
|
348
|
+
hash: "svelte-1dmazsz",
|
|
349
|
+
code: `.code-block.svelte-1dmazsz {font-family:"Monaco", "Menlo", "Ubuntu Mono", monospace;}
|
|
350
|
+
|
|
351
|
+
/* Basic syntax highlighting for common languages */.language-svelte .token.tag,
|
|
352
|
+
.language-html .token.tag {color:#f92672;}.language-svelte .token.attr-name,
|
|
353
|
+
.language-html .token.attr-name {color:#a6e22e;}.language-svelte .token.attr-value,
|
|
354
|
+
.language-html .token.attr-value {color:#e6db74;}.language-javascript .token.keyword,
|
|
355
|
+
.language-typescript .token.keyword {color:#66d9ef;}.language-javascript .token.string,
|
|
356
|
+
.language-typescript .token.string {color:#e6db74;}.language-javascript .token.function,
|
|
357
|
+
.language-typescript .token.function {color:#a6e22e;}`
|
|
358
|
+
};
|
|
359
|
+
function ze(r, e) {
|
|
360
|
+
re(r, me);
|
|
361
|
+
let a = t(e, "language", 3, "svelte"), o = t(e, "className", 3, ""), i = t(e, "showCopyButton", 3, !0), u = P(e, [
|
|
362
|
+
"$$slots",
|
|
363
|
+
"$$events",
|
|
364
|
+
"$$legacy",
|
|
365
|
+
"code",
|
|
366
|
+
"language",
|
|
367
|
+
"className",
|
|
368
|
+
"showCopyButton"
|
|
369
|
+
]), d = ae(!1);
|
|
370
|
+
var s = ve();
|
|
371
|
+
D(
|
|
372
|
+
s,
|
|
373
|
+
() => ({
|
|
374
|
+
class: `code-block relative bg-gray-900 rounded-lg overflow-hidden ${o() ?? ""}`,
|
|
375
|
+
...u
|
|
376
|
+
}),
|
|
377
|
+
void 0,
|
|
378
|
+
void 0,
|
|
379
|
+
"svelte-1dmazsz"
|
|
380
|
+
);
|
|
381
|
+
var n = h(s), l = N(h(n), 2);
|
|
382
|
+
{
|
|
383
|
+
var p = (g) => {
|
|
384
|
+
var b = fe();
|
|
385
|
+
b.__click = [ce, e, d];
|
|
386
|
+
var z = h(b);
|
|
387
|
+
{
|
|
388
|
+
var M = (_) => {
|
|
389
|
+
var B = ge();
|
|
390
|
+
x(_, B);
|
|
391
|
+
}, j = (_) => {
|
|
392
|
+
var B = be();
|
|
393
|
+
x(_, B);
|
|
394
|
+
};
|
|
395
|
+
I(z, (_) => {
|
|
396
|
+
m(d) ? _(M) : _(j, !1);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
x(g, b);
|
|
400
|
+
};
|
|
401
|
+
I(l, (g) => {
|
|
402
|
+
i() && g(p);
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
var c = N(n, 2), w = h(c), C = h(w);
|
|
406
|
+
te(C, () => e.code), V(() => H(w, 1, `language-${a() ?? ""}`, "svelte-1dmazsz")), x(r, s);
|
|
407
|
+
}
|
|
408
|
+
ee(["click"]);
|
|
409
|
+
export {
|
|
410
|
+
ye as B,
|
|
411
|
+
Ce as C,
|
|
412
|
+
_e as I,
|
|
413
|
+
ke as T,
|
|
414
|
+
xe as a,
|
|
415
|
+
E as b,
|
|
416
|
+
pe as c,
|
|
417
|
+
we as d,
|
|
418
|
+
ze as e,
|
|
419
|
+
re as f,
|
|
420
|
+
K as g,
|
|
421
|
+
te as h
|
|
422
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { p as h, u as v, f as l, a as b, i as k, b as n, c as y, d as _, s as S, e as T, g as i, r as w, h as x } from "./props-BKbHJRuR.js";
|
|
2
|
+
var D = l('<span class="text-lg">☀️</span>'), E = l('<span class="text-lg">🌙</span>'), I = l("<button><!></button>");
|
|
3
|
+
function j(d, s) {
|
|
4
|
+
_(s, !0);
|
|
5
|
+
let t = h(s, "isDark", 7, !1), f = w(s, ["$$slots", "$$events", "$$legacy", "isDark"]), o = T(!1);
|
|
6
|
+
v(() => {
|
|
7
|
+
if (S(o, !0), typeof localStorage < "u") {
|
|
8
|
+
const e = localStorage.getItem("theme"), a = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
9
|
+
t(e === "dark" || !e && a), c();
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
function u(e) {
|
|
13
|
+
t(!t()), c(), i(o) && typeof localStorage < "u" && localStorage.setItem("theme", t() ? "dark" : "light");
|
|
14
|
+
}
|
|
15
|
+
function c() {
|
|
16
|
+
i(o) && typeof document < "u" && (t() ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark"));
|
|
17
|
+
}
|
|
18
|
+
var r = I();
|
|
19
|
+
b(r, () => ({
|
|
20
|
+
onclick: u,
|
|
21
|
+
class: "w-10 h-10 bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-lg flex items-center justify-center text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
22
|
+
"aria-label": t() ? "Switch to light mode" : "Switch to dark mode",
|
|
23
|
+
...f
|
|
24
|
+
}));
|
|
25
|
+
var m = x(r);
|
|
26
|
+
{
|
|
27
|
+
var g = (e) => {
|
|
28
|
+
var a = D();
|
|
29
|
+
n(e, a);
|
|
30
|
+
}, p = (e) => {
|
|
31
|
+
var a = E();
|
|
32
|
+
n(e, a);
|
|
33
|
+
};
|
|
34
|
+
k(m, (e) => {
|
|
35
|
+
t() ? e(g) : e(p, !1);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
n(d, r), y();
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
j as T
|
|
42
|
+
};
|