create-skybridge 0.0.0-dev.fd05cd0 → 0.0.0-dev.ff23e30

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.
@@ -1,272 +0,0 @@
1
- import {
2
- LoaderCircleIcon,
3
- LoaderIcon,
4
- LoaderPinwheelIcon,
5
- type LucideProps,
6
- } from "lucide-react";
7
- import { cn } from "../../../../utils";
8
-
9
- type SpinnerVariantProps = Omit<SpinnerProps, "variant">;
10
-
11
- const Default = ({ className, ...props }: SpinnerVariantProps) => (
12
- <LoaderIcon className={cn("animate-spin", className)} {...props} />
13
- );
14
-
15
- const Circle = ({ className, ...props }: SpinnerVariantProps) => (
16
- <LoaderCircleIcon className={cn("animate-spin", className)} {...props} />
17
- );
18
-
19
- const Pinwheel = ({ className, ...props }: SpinnerVariantProps) => (
20
- <LoaderPinwheelIcon className={cn("animate-spin", className)} {...props} />
21
- );
22
-
23
- const CircleFilled = ({
24
- className,
25
- size = 24,
26
- ...props
27
- }: SpinnerVariantProps) => (
28
- <div className="relative" style={{ width: size, height: size }}>
29
- <div className="absolute inset-0 rotate-180">
30
- <LoaderCircleIcon
31
- className={cn("animate-spin", className, "text-foreground opacity-20")}
32
- size={size}
33
- {...props}
34
- />
35
- </div>
36
- <LoaderCircleIcon
37
- className={cn("relative animate-spin", className)}
38
- size={size}
39
- {...props}
40
- />
41
- </div>
42
- );
43
-
44
- const Ellipsis = ({ size = 24, ...props }: SpinnerVariantProps) => {
45
- return (
46
- <svg
47
- height={size}
48
- viewBox="0 0 24 24"
49
- width={size}
50
- xmlns="http://www.w3.org/2000/svg"
51
- {...props}
52
- >
53
- <title>Loading...</title>
54
- <circle cx="4" cy="12" fill="currentColor" r="2">
55
- <animate
56
- attributeName="cy"
57
- begin="0;ellipsis3.end+0.25s"
58
- calcMode="spline"
59
- dur="0.6s"
60
- id="ellipsis1"
61
- keySplines=".33,.66,.66,1;.33,0,.66,.33"
62
- values="12;6;12"
63
- />
64
- </circle>
65
- <circle cx="12" cy="12" fill="currentColor" r="2">
66
- <animate
67
- attributeName="cy"
68
- begin="ellipsis1.begin+0.1s"
69
- calcMode="spline"
70
- dur="0.6s"
71
- keySplines=".33,.66,.66,1;.33,0,.66,.33"
72
- values="12;6;12"
73
- />
74
- </circle>
75
- <circle cx="20" cy="12" fill="currentColor" r="2">
76
- <animate
77
- attributeName="cy"
78
- begin="ellipsis1.begin+0.2s"
79
- calcMode="spline"
80
- dur="0.6s"
81
- id="ellipsis3"
82
- keySplines=".33,.66,.66,1;.33,0,.66,.33"
83
- values="12;6;12"
84
- />
85
- </circle>
86
- </svg>
87
- );
88
- };
89
-
90
- const Ring = ({ size = 24, ...props }: SpinnerVariantProps) => (
91
- <svg
92
- height={size}
93
- stroke="currentColor"
94
- viewBox="0 0 44 44"
95
- width={size}
96
- xmlns="http://www.w3.org/2000/svg"
97
- {...props}
98
- >
99
- <title>Loading...</title>
100
- <g fill="none" fillRule="evenodd" strokeWidth="2">
101
- <circle cx="22" cy="22" r="1">
102
- <animate
103
- attributeName="r"
104
- begin="0s"
105
- calcMode="spline"
106
- dur="1.8s"
107
- keySplines="0.165, 0.84, 0.44, 1"
108
- keyTimes="0; 1"
109
- repeatCount="indefinite"
110
- values="1; 20"
111
- />
112
- <animate
113
- attributeName="stroke-opacity"
114
- begin="0s"
115
- calcMode="spline"
116
- dur="1.8s"
117
- keySplines="0.3, 0.61, 0.355, 1"
118
- keyTimes="0; 1"
119
- repeatCount="indefinite"
120
- values="1; 0"
121
- />
122
- </circle>
123
- <circle cx="22" cy="22" r="1">
124
- <animate
125
- attributeName="r"
126
- begin="-0.9s"
127
- calcMode="spline"
128
- dur="1.8s"
129
- keySplines="0.165, 0.84, 0.44, 1"
130
- keyTimes="0; 1"
131
- repeatCount="indefinite"
132
- values="1; 20"
133
- />
134
- <animate
135
- attributeName="stroke-opacity"
136
- begin="-0.9s"
137
- calcMode="spline"
138
- dur="1.8s"
139
- keySplines="0.3, 0.61, 0.355, 1"
140
- keyTimes="0; 1"
141
- repeatCount="indefinite"
142
- values="1; 0"
143
- />
144
- </circle>
145
- </g>
146
- </svg>
147
- );
148
-
149
- const Bars = ({ size = 24, ...props }: SpinnerVariantProps) => (
150
- <svg
151
- height={size}
152
- viewBox="0 0 24 24"
153
- width={size}
154
- xmlns="http://www.w3.org/2000/svg"
155
- {...props}
156
- >
157
- <title>Loading...</title>
158
- <style>{`
159
- .spinner-bar {
160
- animation: spinner-bars-animation .8s linear infinite;
161
- animation-delay: -.8s;
162
- }
163
- .spinner-bars-2 {
164
- animation-delay: -.65s;
165
- }
166
- .spinner-bars-3 {
167
- animation-delay: -0.5s;
168
- }
169
- @keyframes spinner-bars-animation {
170
- 0% {
171
- y: 1px;
172
- height: 22px;
173
- }
174
- 93.75% {
175
- y: 5px;
176
- height: 14px;
177
- opacity: 0.2;
178
- }
179
- }
180
- `}</style>
181
- <rect
182
- className="spinner-bar"
183
- fill="currentColor"
184
- height="22"
185
- width="6"
186
- x="1"
187
- y="1"
188
- />
189
- <rect
190
- className="spinner-bar spinner-bars-2"
191
- fill="currentColor"
192
- height="22"
193
- width="6"
194
- x="9"
195
- y="1"
196
- />
197
- <rect
198
- className="spinner-bar spinner-bars-3"
199
- fill="currentColor"
200
- height="22"
201
- width="6"
202
- x="17"
203
- y="1"
204
- />
205
- </svg>
206
- );
207
-
208
- const Infinite = ({ size = 24, ...props }: SpinnerVariantProps) => (
209
- <svg
210
- height={size}
211
- preserveAspectRatio="xMidYMid"
212
- viewBox="0 0 100 100"
213
- width={size}
214
- xmlns="http://www.w3.org/2000/svg"
215
- {...props}
216
- >
217
- <title>Loading...</title>
218
- <path
219
- d="M24.3 30C11.4 30 5 43.3 5 50s6.4 20 19.3 20c19.3 0 32.1-40 51.4-40 C88.6 30 95 43.3 95 50s-6.4 20-19.3 20C56.4 70 43.6 30 24.3 30z"
220
- fill="none"
221
- stroke="currentColor"
222
- strokeDasharray="205.271142578125 51.317785644531256"
223
- strokeLinecap="round"
224
- strokeWidth="10"
225
- style={{
226
- transform: "scale(0.8)",
227
- transformOrigin: "50px 50px",
228
- }}
229
- >
230
- <animate
231
- attributeName="stroke-dashoffset"
232
- dur="2s"
233
- keyTimes="0;1"
234
- repeatCount="indefinite"
235
- values="0;256.58892822265625"
236
- />
237
- </path>
238
- </svg>
239
- );
240
-
241
- export type SpinnerProps = LucideProps & {
242
- variant?:
243
- | "default"
244
- | "circle"
245
- | "pinwheel"
246
- | "circle-filled"
247
- | "ellipsis"
248
- | "ring"
249
- | "bars"
250
- | "infinite";
251
- };
252
-
253
- export const Spinner = ({ variant, ...props }: SpinnerProps) => {
254
- switch (variant) {
255
- case "circle":
256
- return <Circle {...props} />;
257
- case "pinwheel":
258
- return <Pinwheel {...props} />;
259
- case "circle-filled":
260
- return <CircleFilled {...props} />;
261
- case "ellipsis":
262
- return <Ellipsis {...props} />;
263
- case "ring":
264
- return <Ring {...props} />;
265
- case "bars":
266
- return <Bars {...props} />;
267
- case "infinite":
268
- return <Infinite {...props} />;
269
- default:
270
- return <Default {...props} />;
271
- }
272
- };
@@ -1,6 +0,0 @@
1
- import { type ClassValue, clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs));
6
- }
@@ -1,203 +0,0 @@
1
- import { Spinner } from "@/components/ui/shadcn-io/spinner";
2
- import "@/index.css";
3
-
4
- import { mountWidget } from "skybridge/web";
5
- import { useCallTool, useToolInfo } from "../helpers";
6
-
7
- const typesSvgs = {
8
- bug: "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/bug.svg",
9
- dark: "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/dark.svg",
10
- dragon:
11
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/dragon.svg",
12
- electric:
13
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/electric.svg",
14
- fairy:
15
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/fairy.svg",
16
- fighting:
17
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/fighting.svg",
18
- fire: "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/fire.svg",
19
- flying:
20
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/flying.svg",
21
- ghost:
22
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/ghost.svg",
23
- grass:
24
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/grass.svg",
25
- ground:
26
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/ground.svg",
27
- ice: "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/ice.svg",
28
- normal:
29
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/normal.svg",
30
- poison:
31
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/poison.svg",
32
- psychic:
33
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/psychic.svg",
34
- rock: "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/rock.svg",
35
- steel:
36
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/steel.svg",
37
- water:
38
- "https://raw.githubusercontent.com/partywhale/pokemon-type-icons/refs/heads/main/icons/water.svg",
39
- };
40
-
41
- const typesToClassnames: Record<
42
- string,
43
- {
44
- background: {
45
- widget: string;
46
- tiles: string;
47
- };
48
- text: string;
49
- }
50
- > = {
51
- bug: {
52
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
53
- text: "black",
54
- },
55
- dark: {
56
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
57
- text: "black",
58
- },
59
- dragon: {
60
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
61
- text: "black",
62
- },
63
- electric: {
64
- background: { widget: "bg-yellow-100", tiles: "bg-yellow-50" },
65
- text: "text-yellow-600",
66
- },
67
- fairy: {
68
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
69
- text: "black",
70
- },
71
- fighting: {
72
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
73
- text: "black",
74
- },
75
- fire: {
76
- background: { widget: "bg-orange-100", tiles: "bg-orange-50" },
77
- text: "text-orange-600",
78
- },
79
- flying: {
80
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
81
- text: "black",
82
- },
83
- ghost: {
84
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
85
- text: "black",
86
- },
87
- grass: {
88
- background: { widget: "bg-green-100", tiles: "bg-green-50" },
89
- text: "text-green-600",
90
- },
91
- ground: {
92
- background: { widget: "bg-[#D7CCC8]", tiles: "bg-[#EFEBE9]" },
93
- text: "text-[#6D4C41]",
94
- },
95
- ice: {
96
- background: { widget: "bg-blue-100", tiles: "bg-blue-50" },
97
- text: "text-blue-600",
98
- },
99
- normal: {
100
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
101
- text: "black",
102
- },
103
- poison: {
104
- background: { widget: "bg-purple-100", tiles: "bg-purple-50" },
105
- text: "text-purple-600",
106
- },
107
- psychic: {
108
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
109
- text: "black",
110
- },
111
- rock: {
112
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
113
- text: "black",
114
- },
115
- steel: {
116
- background: { widget: "bg-gray-100", tiles: "bg-gray-50" },
117
- text: "black",
118
- },
119
- water: {
120
- background: { widget: "bg-blue-100", tiles: "bg-blue-50" },
121
- text: "text-blue-600",
122
- },
123
- };
124
-
125
- function Pokemon() {
126
- const toolInfo = useToolInfo<"pokemon">();
127
-
128
- const pokemon = toolInfo.output ?? null;
129
-
130
- const { callTool: captureTool } = useCallTool("capture");
131
-
132
- if (!pokemon) {
133
- return (
134
- <div className="flex justify-center items-center h-50">
135
- <Spinner />
136
- </div>
137
- );
138
- }
139
-
140
- return (
141
- <div
142
- className={`p-4 rounded-xl flex flex-row gap-4 ${typesToClassnames[pokemon.types[0].id].background.widget}`}
143
- >
144
- <img
145
- src={pokemon.imageUrl}
146
- alt={pokemon.name}
147
- className="object-contain drop-shadow-2xl"
148
- />
149
- <div className="flex flex-col gap-2">
150
- <Tile color={pokemon.types[0].id}>
151
- <div className="flex flex-row justify-between items-center">
152
- <div>
153
- <h2 className="text-lg font-bold uppercase">{pokemon.name}</h2>
154
- <h2
155
- className={`text-md font-bold ${typesToClassnames[pokemon.types[0].id].text}`}
156
- >
157
- {String(pokemon.order).padStart(3, "0")}
158
- </h2>
159
- </div>
160
- <div className="flex flex-row gap-2">
161
- {pokemon.types.map(({ id, name }) => (
162
- <img
163
- key={id}
164
- src={typesSvgs[id as keyof typeof typesSvgs]}
165
- alt={name}
166
- className="w-6 h-6"
167
- />
168
- ))}
169
- </div>
170
- </div>
171
- <p className="text-gray-500">{pokemon.description}</p>
172
- <button
173
- type="button"
174
- onClick={() => captureTool({})}
175
- className="mt-4 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors"
176
- >
177
- Capture Pokemon
178
- </button>
179
- </Tile>
180
- </div>
181
- </div>
182
- );
183
- }
184
-
185
- const Tile = ({
186
- children,
187
- color,
188
- }: {
189
- children: React.ReactNode;
190
- color: string;
191
- }) => {
192
- return (
193
- <div
194
- className={`p-4 rounded-xl ${typesToClassnames[color].background.tiles}`}
195
- >
196
- {children}
197
- </div>
198
- );
199
- };
200
-
201
- export default Pokemon;
202
-
203
- mountWidget(<Pokemon />);