File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/// <reference types="./global" />
2+
23export { default as hooks } from "./hooks.js" ;
34export { default as reactify } from "./reactify.js" ;
45export { default as sveltify } from "./sveltify.svelte.js" ;
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ function getFiles() {
3+ const modules = import .meta .glob (" ../../tests/fixtures/*.svelte" );
4+ return Object .keys (modules ).map (
5+ (path ) => path .match (/ ([^ /] + )\. svelte$ / )?.[1 ],
6+ );
7+ }
8+ </script >
9+
10+ <ul >
11+ {#each getFiles () as file }
12+ <li ><a href ="/fixtures/ {file }" >{file }</a ></li >
13+ {/each }
14+ </ul >
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ let { data } = $props ();
3+ </script >
4+
5+ <header >
6+ <h1 >{data .title }</h1 >
7+ </header >
8+ <data .Fixture />
9+
10+ <style >
11+ header {
12+ background : #5c1eba ;
13+ color : white ;
14+ padding : 0.6em ;
15+ border-radius : 8px ;
16+ text-align : center ;
17+ margin-bottom : 2em ;
18+ }
19+
20+ h1 {
21+ font : 24px /1.1 sans-serif ;
22+ margin : 0 ;
23+ }
24+ </style >
Original file line number Diff line number Diff line change 1+ import type { Component } from "svelte" ;
2+
3+ export async function load ( { params } ) {
4+ return {
5+ title : params . fixture ,
6+ Fixture : await getModule ( params . fixture ) ,
7+ } ;
8+ }
9+
10+ async function getModule ( name : string ) {
11+ const modules = import . meta. glob ( "../../../tests/fixtures/*.svelte" ) ;
12+ const loader = Object . entries ( modules ) . find (
13+ ( [ path ] ) => path . match ( / ( [ ^ / ] + ) \. s v e l t e $ / ) ?. [ 1 ] === name ,
14+ ) ;
15+ if ( ! loader ) {
16+ throw new Error ( `Fixture not found: ${ name } ` ) ;
17+ }
18+ const module = await loader [ 1 ] ( ) ;
19+ return ( module as { default : Component } ) . default ;
20+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <script lang =" ts" >
2+ import type React from " react" ;
3+
4+ const props: React .JSX .IntrinsicElements [" div" ] = {
5+ style: { backgroundColor: " #4c80db" },
6+ onClick : () => console .info (" clicked" ),
7+ };
8+ </script >
9+
10+ <react .div {...props }><span >Hi</span ></react .div >
You can’t perform that action at this time.
0 commit comments