@tanstack/router-vite-plugin 1.26.6 → 1.26.8

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.
@@ -0,0 +1,526 @@
1
+ import * as React from 'react'
2
+
3
+ import { CgCornerUpLeft, CgSpinner } from 'react-icons/cg'
4
+ import {
5
+ FaBolt,
6
+ FaBook,
7
+ FaCheckCircle,
8
+ FaCogs,
9
+ FaDiscord,
10
+ FaGithub,
11
+ FaTshirt,
12
+ FaTwitter,
13
+ } from 'react-icons/fa'
14
+ import { Await, Link, getRouteApi } from '@tanstack/react-router'
15
+ import { Carbon } from '~/components/Carbon'
16
+ import { Footer } from '~/components/Footer'
17
+ import { VscPreview, VscWand } from 'react-icons/vsc'
18
+ import { TbHeartHandshake } from 'react-icons/tb'
19
+ import SponsorPack from '~/components/SponsorPack'
20
+ import { startProject } from '~/projects/start'
21
+ import { createFileRoute } from '@tanstack/react-router'
22
+ import { Framework, getBranch } from '~/projects'
23
+ import { seo } from '~/utils/seo'
24
+
25
+ const menu = [
26
+ {
27
+ label: (
28
+ <div className="flex items-center gap-2">
29
+ <CgCornerUpLeft className="text-lg" /> TanStack
30
+ </div>
31
+ ),
32
+ to: '/',
33
+ },
34
+ // {
35
+ // label: (
36
+ // <div className="flex items-center gap-1">
37
+ // <VscPreview className="text-lg" /> Examples
38
+ // </div>
39
+ // ),
40
+ // to: './docs/react/examples/basic',
41
+ // },
42
+ // {
43
+ // label: (
44
+ // <div className="flex items-center gap-1">
45
+ // <FaBook className="text-lg" /> Docs
46
+ // </div>
47
+ // ),
48
+ // to: './docs/',
49
+ // },
50
+ // {
51
+ // label: (
52
+ // <div className="flex items-center gap-1">
53
+ // <FaGithub className="text-lg" /> GitHub
54
+ // </div>
55
+ // ),
56
+ // to: `https://github.com/${startProject.repo}`,
57
+ // },
58
+ {
59
+ label: (
60
+ <div className="flex items-center gap-1">
61
+ <FaDiscord className="text-lg" /> Discord
62
+ </div>
63
+ ),
64
+ to: 'https://tlinz.com/discord',
65
+ },
66
+ {
67
+ label: (
68
+ <div className="flex items-center gap-1">
69
+ <FaTshirt className="text-lg" /> Merch
70
+ </div>
71
+ ),
72
+ to: `https://cottonbureau.com/people/tanstack`,
73
+ },
74
+ ]
75
+
76
+ export const Route = createFileRoute('/_libraries/start/$version/')({
77
+ component: VersionIndex,
78
+ meta: () =>
79
+ seo({
80
+ title: startProject.name,
81
+ description: startProject.description,
82
+ }),
83
+ })
84
+
85
+ const librariesRouteApi = getRouteApi('/_libraries')
86
+
87
+ export default function VersionIndex() {
88
+ const { sponsorsPromise } = librariesRouteApi.useLoaderData()
89
+ const { version } = Route.useParams()
90
+ const branch = getBranch(startProject, version)
91
+ const [framework, setFramework] = React.useState<Framework>('react')
92
+ const [isDark, setIsDark] = React.useState(true)
93
+
94
+ React.useEffect(() => {
95
+ setIsDark(window.matchMedia?.(`(prefers-color-scheme: dark)`).matches)
96
+ }, [])
97
+
98
+ const gradientText = `inline-block text-transparent bg-clip-text bg-gradient-to-r ${startProject.colorFrom} ${startProject.colorTo}`
99
+
100
+ return (
101
+ <div className="flex flex-col gap-20 md:gap-32 max-w-full">
102
+ <div
103
+ className="flex flex-wrap py-2 px-4 items-center justify-center text-sm max-w-screen-xl mx-auto
104
+ md:text-base md:self-end"
105
+ >
106
+ {menu?.map((item, i) => {
107
+ const label = (
108
+ <div className="p-2 opacity-90 hover:opacity-100">{item.label}</div>
109
+ )
110
+
111
+ return (
112
+ <div key={i} className="hover:underline">
113
+ {item.to.startsWith('http') ? (
114
+ <a href={item.to}>{label}</a>
115
+ ) : (
116
+ <Link to={item.to} params>
117
+ {label}
118
+ </Link>
119
+ )}
120
+ </div>
121
+ )
122
+ })}
123
+ </div>
124
+ <div className="flex flex-col items-center gap-8 text-center px-4">
125
+ <div className="flex gap-2 lg:gap-4 items-center">
126
+ <h1
127
+ className={`inline-block
128
+ font-black text-4xl
129
+ md:text-6xl
130
+ lg:text-7xl relative`}
131
+ >
132
+ <span className={gradientText}>TanStack Start</span>
133
+ </h1>
134
+ </div>
135
+ {/* <div className="absolute left-1/2 top-0 -translate-x-1/2 -translate-y-[150%]"> */}
136
+ <div
137
+ className="text-sm
138
+ md:text-base font-black
139
+ lg:text-lg align-super text-white animate-bounce uppercase
140
+ dark:text-black bg-black dark:bg-white shadow-xl shadow-black/30 px-2 py-1 rounded-md
141
+ leading-none whitespace-nowrap"
142
+ >
143
+ Coming Soon!
144
+ {/* {version === 'latest' ? latestVersion : version} */}
145
+ </div>
146
+ {/* </div> */}
147
+ <h2
148
+ className="font-bold text-2xl max-w-md
149
+ md:text-3xl
150
+ lg:text-5xl lg:max-w-2xl"
151
+ >
152
+ Full-stack React framework{' '}
153
+ <span className="underline decoration-dashed decoration-yellow-500 decoration-3 underline-offset-2">
154
+ powered by TanStack Router
155
+ </span>{' '}
156
+ </h2>
157
+ <p
158
+ className="text opacity-90 max-w-[500px]
159
+ lg:text-xl lg:max-w-[600px]"
160
+ >
161
+ Full-document SSR, Streaming, Server Functions, bundling and more,
162
+ powered by <strong>TanStack Router</strong>, <strong>Vinxi</strong>,{' '}
163
+ <strong>Nitro</strong> and <strong>Vite</strong>. Ready to deploy to
164
+ your favorite hosting provider.
165
+ </p>
166
+ </div>
167
+ <div className="space-y-8 px-4">
168
+ <div className="font-black text-3xl mr-1 text-center">
169
+ So when can I use it?
170
+ </div>
171
+ <div className="max-w-full p-8 w-[800px] mx-auto leading-loose space-y-4 bg-white dark:bg-gray-700 rounded-xl shadow-xl shadow-black/10">
172
+ <div>
173
+ <strong>TanStack Start </strong> is currently in development and is
174
+ not yet available for public use. We are working hard to bring you
175
+ the best possible experience and will be releasing more details
176
+ soon. In the meantime, you can follow along with the development
177
+ process by watching the commits on this very website!
178
+ </div>
179
+ <div>
180
+ Yes, you heard that right!{' '}
181
+ <strong>
182
+ TanStack.com is already being built and deployed using TanStack
183
+ Start
184
+ </strong>
185
+ ! We are eating our own dog food and are excited to share the
186
+ results with you soon!
187
+ </div>
188
+ </div>
189
+ <div className="flex items-center gap-2 flex-wrap justify-center">
190
+ <a
191
+ href={`https://github.com/tanstack/tanstack.com`}
192
+ className={`flex items-center gap-2 py-2 px-4 bg-cyan-700 rounded text-white uppercase font-extrabold`}
193
+ >
194
+ <FaGithub /> View TanStack.com Source
195
+ </a>
196
+ <a
197
+ href={`https://twitter.com/intent/post?text=${encodeURIComponent(
198
+ `I'm excited for TanStack Start, new full-stack React framework coming soon from team @Tan_Stack!
199
+
200
+ Check it out at https://tanstack.com/start/`,
201
+ )}`}
202
+ target="_blank"
203
+ className={`flex items-center gap-2 py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}
204
+ >
205
+ <FaTwitter /> Tweet about it!
206
+ </a>{' '}
207
+ </div>
208
+ </div>
209
+ {/* <div
210
+ className="text-lg flex flex-col gap-12 p-8 max-w-[1200px] mx-auto
211
+ md:flex-row"
212
+ >
213
+ <div className="flex-1 flex flex-col gap-8 items-center">
214
+ <VscWand className="text-cyan-500 text-6xl" />
215
+ <div className="flex flex-col gap-4">
216
+ <h3 className="uppercase text-center text-xl font-black">
217
+ Built on TanStack Router
218
+ </h3>
219
+ <p className="text-sm text-gray-800 dark:text-gray-200 leading-6">
220
+ Writing your data fetching logic by hand is over. Tell TanStack
221
+ Query where to get your data and how fresh you need it to be and
222
+ the rest is automatic. It handles{' '}
223
+ <span className="font-semibold text-cyan-700 dark:text-cyan-400">
224
+ caching, background updates and stale data out of the box with
225
+ zero-configuration
226
+ </span>
227
+ .
228
+ </p>
229
+ </div>
230
+ </div>
231
+ <div className="flex-1 flex flex-col gap-8 items-center">
232
+ <div className="text-center">
233
+ <FaBolt className="text-sky-600 text-6xl" />
234
+ </div>
235
+ <div className="flex flex-col gap-4">
236
+ <h3 className="uppercase text-center text-xl font-black">
237
+ Simple & Familiar
238
+ </h3>
239
+ <p className="text-sm text-gray-800 dark:text-gray-200 leading-6">
240
+ If you know how to work with promises or async/await, then you
241
+ already know how to use TanStack Query. There's{' '}
242
+ <span className="font-semibold text-sky-700 dark:text-sky-400">
243
+ no global state to manage, reducers, normalization systems or
244
+ heavy configurations to understand
245
+ </span>
246
+ . Simply pass a function that resolves your data (or throws an
247
+ error) and the rest is history.
248
+ </p>
249
+ </div>
250
+ </div>
251
+ <div className="flex-1 flex flex-col gap-8 items-center">
252
+ <div className="text-center">
253
+ <FaCogs className="text-blue-500 text-6xl" />
254
+ </div>
255
+ <div className="flex flex-col gap-4">
256
+ <h3 className="uppercase text-center text-xl font-black">
257
+ Extensible
258
+ </h3>
259
+ <p className="text-sm text-gray-800 dark:text-gray-200 leading-6">
260
+ TanStack Query is configurable down to each observer instance of a
261
+ query with knobs and options to fit every use-case. It comes wired
262
+ up with{' '}
263
+ <span className="font-semibold text-blue-700 dark:text-blue-400">
264
+ dedicated devtools, infinite-loading APIs, and first class
265
+ mutation tools that make updating your data a breeze
266
+ </span>
267
+ . Don't worry though, everything is pre-configured for success!
268
+ </p>
269
+ </div>
270
+ </div>
271
+ </div> */}
272
+
273
+ {/* <div className="px-4 sm:px-6 lg:px-8 mx-auto">
274
+ <div className=" sm:text-center pb-16">
275
+ <h3 className="text-3xl text-center mx-auto leading-tight font-extrabold tracking-tight sm:text-4xl lg:leading-none mt-2">
276
+ No dependencies. All the Features.
277
+ </h3>
278
+ <p className="mt-4 text-xl max-w-3xl mx-auto leading-7 opacity-60">
279
+ With zero dependencies, TanStack Query is extremely lean given the
280
+ dense feature set it provides. From weekend hobbies all the way to
281
+ enterprise e-commerce systems (Yes, I'm lookin' at you Walmart! 😉),
282
+ TanStack Query is the battle-hardened tool to help you succeed at
283
+ the speed of your creativity.
284
+ </p>
285
+ </div>
286
+ <div className="grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-10 gap-y-4 mx-auto">
287
+ {[
288
+ 'Backend agnostic',
289
+ 'Dedicated Devtools',
290
+ 'Auto Caching',
291
+ 'Auto Refetching',
292
+ 'Window Focus Refetching',
293
+ 'Polling/Realtime Queries',
294
+ 'Parallel Queries',
295
+ 'Dependent Queries',
296
+ 'Mutations API',
297
+ 'Automatic Garbage Collection',
298
+ 'Paginated/Cursor Queries',
299
+ 'Load-More/Infinite Scroll Queries',
300
+ 'Scroll Recovery',
301
+ 'Request Cancellation',
302
+ 'Suspense Ready!',
303
+ 'Render-as-you-fetch',
304
+ 'Prefetching',
305
+ 'Variable-length Parallel Queries',
306
+ 'Offline Support',
307
+ 'SSR Support',
308
+ 'Data Selectors',
309
+ ].map((d, i) => {
310
+ return (
311
+ <span key={i} className="flex items-center gap-2">
312
+ <FaCheckCircle className="text-green-500 " /> {d}
313
+ </span>
314
+ )
315
+ })}
316
+ </div>
317
+ </div> */}
318
+
319
+ {/* <div>
320
+ <div className="uppercase tracking-wider text-sm font-semibold text-center text-gray-400 mb-3">
321
+ Trusted in Production by
322
+ </div>
323
+ <marquee scrollamount="2">
324
+ <div className="flex gap-2 items-center text-3xl font-bold ml-[-100%]">
325
+ {(new Array(4) as string[])
326
+ .fill('')
327
+ .reduce(
328
+ (all) => [...all, ...all],
329
+ [
330
+ 'Google',
331
+ 'Walmart',
332
+ 'Facebook',
333
+ 'PayPal',
334
+ 'Amazon',
335
+ 'American Express',
336
+ 'Microsoft',
337
+ 'Target',
338
+ 'Ebay',
339
+ 'Autodesk',
340
+ 'CarFAX',
341
+ 'Docusign',
342
+ 'HP',
343
+ 'MLB',
344
+ 'Volvo',
345
+ 'Ocado',
346
+ 'UPC.ch',
347
+ 'EFI.com',
348
+ 'ReactBricks',
349
+ 'Nozzle.io',
350
+ 'Uber',
351
+ ]
352
+ )
353
+ .map((d, i) => (
354
+ <span key={i} className="opacity-70 even:opacity-40">
355
+ {d}
356
+ </span>
357
+ ))}
358
+ </div>
359
+ </marquee>
360
+ </div> */}
361
+
362
+ <div className="px-4 w-[500px] max-w-full mx-auto">
363
+ <h3 className="text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8">
364
+ Partners
365
+ </h3>
366
+ <div className="h-8" />
367
+ <div
368
+ className="flex-1 flex flex-col items-center text-sm text-center
369
+ bg-white shadow-xl shadow-gray-500/20 rounded-lg
370
+ divide-y-2 divide-gray-500 divide-opacity-10 overflow-hidden
371
+ dark:bg-gray-800 dark:shadow-none"
372
+ >
373
+ <span className="flex items-center gap-2 p-12 text-4xl text-rose-500 font-black uppercase">
374
+ Start <TbHeartHandshake /> You?
375
+ </span>
376
+ <div className="flex flex-col p-4 gap-4">
377
+ <div>
378
+ We're looking for a TanStack Start OSS Partner to go above and
379
+ beyond the call of sponsorship. Are you as invested in TanStack
380
+ Start as we are? Let's push the boundaries of Start together!
381
+ </div>
382
+ <a
383
+ href="mailto:partners@tanstack.com?subject=TanStack Start Partnership"
384
+ className="text-blue-500 uppercase font-black text-sm"
385
+ >
386
+ Let's chat
387
+ </a>
388
+ </div>
389
+ </div>
390
+ </div>
391
+
392
+ <div className="relative text-lg overflow-hidden">
393
+ <h3 className="text-center text-3xl leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-8">
394
+ Sponsors
395
+ </h3>
396
+ <div
397
+ className="my-4 flex flex-wrap mx-auto max-w-screen-lg"
398
+ style={{
399
+ aspectRatio: '1/1',
400
+ }}
401
+ >
402
+ <Await
403
+ promise={sponsorsPromise}
404
+ fallback={<CgSpinner className="text-2xl animate-spin" />}
405
+ children={(sponsors) => {
406
+ return <SponsorPack sponsors={sponsors} />
407
+ }}
408
+ />
409
+ </div>
410
+ <div className="text-center">
411
+ <a
412
+ href="https://github.com/sponsors/tannerlinsley"
413
+ className="inline-block bg-green-500 px-4 py-2 text-xl mx-auto leading-tight font-extrabold tracking-tight text-white rounded-full"
414
+ >
415
+ Become a Sponsor!
416
+ </a>
417
+ </div>
418
+ </div>
419
+
420
+ <div className="mx-auto max-w-[400px] flex flex-col gap-2 items-center">
421
+ <div className="shadow-lg rounded-lg overflow-hidden bg-white dark:bg-gray-800 dark:text-white">
422
+ <Carbon />
423
+ </div>
424
+ <span
425
+ className="text-[.7rem] bg-gray-500 bg-opacity-10 py-1 px-2 rounded text-gray-500
426
+ dark:bg-opacity-20"
427
+ >
428
+ This ad helps us be happy about our invested time and not burn out and
429
+ rage-quit OSS. Yay money! 😉
430
+ </span>
431
+ </div>
432
+
433
+ {/* <div className="flex flex-col gap-4">
434
+ <div className="px-4 sm:px-6 lg:px-8 mx-auto max-w-3xl sm:text-center">
435
+ <h3 className="text-3xl text-center leading-8 font-extrabold tracking-tight sm:text-4xl sm:leading-10 lg:leading-none mt-2">
436
+ Less code, fewer edge cases.
437
+ </h3>
438
+ <p className="my-4 text-xl leading-7 text-gray-600">
439
+ Instead of writing reducers, caching logic, timers, retry logic,
440
+ complex async/await scripting (I could keep going...), you literally
441
+ write a tiny fraction of the code you normally would. You will be
442
+ surprised at how little code you're writing or how much code you're
443
+ deleting when you use TanStack Query. Try it out with one of the
444
+ examples below!
445
+ </p>
446
+ <div className="flex flex-wrap gap-2 justify-center">
447
+ {(
448
+ [
449
+ { label: 'Angular', value: 'angular' },
450
+ { label: 'React', value: 'react' },
451
+ { label: 'Solid', value: 'solid' },
452
+ { label: 'Svelte', value: 'svelte' },
453
+ { label: 'Vue', value: 'vue' },
454
+ ] as const
455
+ ).map((item) => (
456
+ <button
457
+ key={item.value}
458
+ className={`inline-block py-2 px-4 rounded text-white uppercase font-extrabold ${
459
+ item.value === framework
460
+ ? 'bg-cyan-500'
461
+ : 'bg-gray-300 dark:bg-gray-700 hover:bg-cyan-300'
462
+ }`}
463
+ onClick={() => setFramework(item.value)}
464
+ >
465
+ {item.label}
466
+ </button>
467
+ ))}
468
+ </div>
469
+ </div>
470
+ </div> */}
471
+
472
+ {/* {[''].includes(framework) ? (
473
+ <div className="px-2">
474
+ <div className="p-8 text-center text-lg w-full max-w-screen-lg mx-auto bg-black text-white rounded-xl">
475
+ Looking for the <strong>@tanstack/{framework}-query</strong>{' '}
476
+ example? We could use your help to build the{' '}
477
+ <strong>@tanstack/{framework}-query</strong> adapter! Join the{' '}
478
+ <a
479
+ href="https://tlinz.com/discord"
480
+ className="text-teal-500 font-bold"
481
+ >
482
+ TanStack Discord Server
483
+ </a>{' '}
484
+ and let's get to work!
485
+ </div>
486
+ </div>
487
+ ) : (
488
+ <div className="bg-white dark:bg-black">
489
+ <iframe
490
+ key={framework}
491
+ src={`https://stackblitz.com/github/${repo}/tree/${branch}/examples/${framework}/simple?embed=1&theme=${
492
+ isDark ? 'dark' : 'light'
493
+ }`}
494
+ title={`tannerlinsley/${framework}-query: basic`}
495
+ sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
496
+ className="shadow-2xl"
497
+ loading="lazy"
498
+ style={{
499
+ width: '100%',
500
+ height: '80vh',
501
+ border: '0',
502
+ }}
503
+ ></iframe>
504
+ </div>
505
+ )} */}
506
+
507
+ {/* <div className="flex flex-col gap-4 items-center">
508
+ <div className="font-extrabold text-xl lg:text-2xl">
509
+ Wow, you've come a long way!
510
+ </div>
511
+ <div className="italic font-sm opacity-70">
512
+ Only one thing left to do...
513
+ </div>
514
+ <div>
515
+ <Link
516
+ to="./docs/"
517
+ className={`inline-block py-2 px-4 bg-cyan-500 rounded text-white uppercase font-extrabold`}
518
+ >
519
+ Read the Docs!
520
+ </Link>
521
+ </div>
522
+ </div> */}
523
+ <Footer />
524
+ </div>
525
+ )
526
+ }