{
	"$schema": "https://shadcn-svelte.com/schema/registry-item.json",
	"name": "page-transition",
	"title": "Page Transition",
	"type": "registry:ui",
	"description": "Page transition from Amicro, ported to Svelte 5 and motion-sv.",
	"dependencies": [
		"motion-sv"
	],
	"files": [
		{
			"content": "<script lang=\"ts\">\n\timport { motion } from 'motion-sv';\n\timport type { Variants } from 'motion-sv';\n\n\tconst Div = motion.div;\n\n\texport type TransitionType =\n\t\t| 'double-stairs'\n\t\t| 'shutter-stairs'\n\t\t| 'split-stairs'\n\t\t| 'horizontal-split'\n\t\t| 'vertical-split'\n\t\t| 'slash'\n\t\t| 'lattice'\n\t\t| 'curtain-shred'\n\t\t| 'pixel'\n\t\t| 'pixel-wave'\n\t\t| 'pixel-spiral'\n\t\t| 'vortex'\n\t\t| 'cross-fade'\n\t\t| 'expand-grow'\n\t\t| 'push-slide'\n\t\t| 'pop-over'\n\t\t| 'depth-forward'\n\t\t| 'liquid-wave';\n\n\tinterface Props {\n\t\ttype?: TransitionType;\n\t\tisVisible: boolean;\n\t\tonComplete?: () => void;\n\t\tclass?: string;\n\t}\n\n\tlet { type = 'double-stairs', isVisible, onComplete, class: className = '' }: Props = $props();\n\n\tconst COLUMNS = 5;\n\tconst NUM_POINTS = 12;\n\tconst NUM_PATHS = 3;\n\tconst WAVE_MS = 1300;\n\n\tconst ease: [number, number, number, number] = [0.76, 0, 0.24, 1];\n\n\tconst variants: Variants = {\n\t\tinitial: (i: number) => ({ y: i % 2 === 0 ? '-100%' : '100%' }),\n\t\tenter: (i: number) => ({\n\t\t\ty: '0%',\n\t\t\ttransition: { duration: 0.8, ease, delay: i * 0.05 }\n\t\t}),\n\t\texit: (i: number) => ({\n\t\t\ty: i % 2 === 0 ? '100%' : '-100%',\n\t\t\ttransition: { duration: 0.8, ease, delay: i * 0.05 }\n\t\t})\n\t};\n\n\tlet paths = $state<Array<SVGPathElement | null>>([]);\n\n\t$effect(() => {\n\t\tif (type !== 'liquid-wave' || !isVisible) return;\n\n\t\tconst startTime = performance.now();\n\t\tconst stepX = 100 / (NUM_POINTS - 1);\n\n\t\tconst delays = Array.from({ length: NUM_PATHS }, (_, i) =>\n\t\t\tArray.from({ length: NUM_POINTS }, () => i * 0.08 + Math.random() * 0.15)\n\t\t);\n\n\t\tlet frame = 0;\n\n\t\tconst draw = (now: number) => {\n\t\t\tconst elapsed = (now - startTime) / 1000;\n\n\t\t\tpaths.forEach((path, i) => {\n\t\t\t\tif (!path) return;\n\n\t\t\t\tconst pointsY = delays[i].map((delay) => {\n\t\t\t\t\tconst raw = Math.max(0, Math.min(1, (elapsed - delay) / 0.65));\n\n\t\t\t\t\tconst eased = raw < 0.5 ? 2 * raw * raw : 1 - Math.pow(-2 * raw + 2, 2) / 2;\n\t\t\t\t\treturn 100 - eased * 110;\n\t\t\t\t});\n\n\t\t\t\tlet d = `M 0 100 V ${pointsY[0]}`;\n\t\t\t\tfor (let j = 0; j < NUM_POINTS - 1; j++) {\n\t\t\t\t\tconst currentX = j * stepX;\n\t\t\t\t\tconst nextX = (j + 1) * stepX;\n\t\t\t\t\tconst cpX = currentX + stepX * 0.5;\n\t\t\t\t\td += ` C ${cpX} ${pointsY[j]} ${cpX} ${pointsY[j + 1]} ${nextX} ${pointsY[j + 1]}`;\n\t\t\t\t}\n\t\t\t\td += ' V 100 H 0 Z';\n\t\t\t\tpath.setAttribute('d', d);\n\t\t\t});\n\n\t\t\tif (now - startTime < WAVE_MS) frame = requestAnimationFrame(draw);\n\t\t\telse onComplete?.();\n\t\t};\n\n\t\tframe = requestAnimationFrame(draw);\n\t\treturn () => cancelAnimationFrame(frame);\n\t});\n</script>\n\n{#if type === 'liquid-wave'}\n\t<svg\n\t\tclass={['page-transition-wave', className]}\n\t\tviewBox=\"0 0 100 100\"\n\t\tpreserveAspectRatio=\"none\"\n\t\taria-hidden=\"true\"\n\t>\n\t\t<path bind:this={paths[0]} fill=\"#3f3f46\" opacity=\"0.4\"></path>\n\t\t<path bind:this={paths[1]} fill=\"#27272a\" opacity=\"0.75\"></path>\n\t\t<path bind:this={paths[2]} fill=\"#09090b\"></path>\n\t</svg>\n{:else if isVisible && type === 'double-stairs'}\n\t<div class={['page-transition-stairs', className]} aria-hidden=\"true\">\n\t\t{#each Array(COLUMNS) as _, i (i)}\n\t\t\t<Div\n\t\t\t\t{variants}\n\t\t\t\tcustom={i}\n\t\t\t\tinitial=\"initial\"\n\t\t\t\tanimate=\"enter\"\n\t\t\t\texit=\"exit\"\n\t\t\t\tclass=\"page-transition-column\"\n\t\t\t\tonAnimationComplete={i === 0 ? onComplete : undefined}\n\t\t\t></Div>\n\t\t{/each}\n\t</div>\n{:else if isVisible}\n\t<Div\n\t\tclass={['page-transition-fade', className]}\n\t\tinitial={{ opacity: 0 }}\n\t\tanimate={{ opacity: 1 }}\n\t\ttransition={{ duration: 0.4 }}\n\t\tonAnimationComplete={onComplete}\n\t\taria-hidden=\"true\"\n\t></Div>\n{/if}\n\n<style>\n\t.page-transition-wave,\n\t.page-transition-stairs,\n\t:global(.page-transition-fade) {\n\t\tposition: fixed;\n\t\tinset: 0;\n\t\tz-index: 50;\n\t\tpointer-events: none;\n\t}\n\n\t.page-transition-wave {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t}\n\n\t.page-transition-stairs {\n\t\tdisplay: flex;\n\t\twidth: 100vw;\n\t\theight: 100vh;\n\t}\n\n\t:global(.page-transition-column) {\n\t\tposition: relative;\n\t\tflex: 1;\n\t\theight: 100%;\n\t\tborder-right: 1px solid #262626;\n\t\tbackground: #171717;\n\t}\n\n\t:global(.page-transition-column:last-child) {\n\t\tborder-right: 0;\n\t}\n\n\t:global(.page-transition-fade) {\n\t\tbackground: #171717;\n\t}\n</style>\n",
			"type": "registry:ui",
			"target": "amicro/PageTransition.svelte"
		},
		{
			"content": "This file was ported from Amicro (React) and copied into your project by the\namicro-sv registry: https://amicro-sv.enisdev.com\n\nOriginal: https://github.com/Subhan-code/Amicro--Micro-transitions-\n\nMIT License\n\nCopyright (c) 2026 SYED SUBHAN UDDIN\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n",
			"type": "registry:file",
			"target": "amicro/LICENSE"
		}
	]
}